WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress - Version 2.8.1

Version Description

Download this release

Release Info

Developer tareq1988
Plugin Icon 128x128 WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress
Version 2.8.1
Comparing to
See all releases

Code changes from version 2.8.0 to 2.8.1

Files changed (49) hide show
  1. admin/class-admin-settings.php +11 -6
  2. admin/class-admin-welcome.php +1 -1
  3. admin/form-builder/class-wpuf-form-builder-field-settings.php +8 -8
  4. admin/form.php +28 -2
  5. admin/html/form-settings-post.php +18 -5
  6. admin/html/form-submission-restriction.php +22 -22
  7. admin/html/whats-new.php +29 -0
  8. admin/installer.php +17 -13
  9. admin/post-forms-list-table.php +1 -1
  10. admin/settings-options.php +26 -33
  11. assets/css/admin.css +51 -0
  12. assets/css/admin/admin.css +1 -0
  13. assets/css/admin/wpuf-setup.css +1 -0
  14. assets/images/modules/email-templates.png +0 -0
  15. assets/images/modules/message.gif +0 -0
  16. assets/images/modules/wpuf-activity.png +0 -0
  17. assets/images/whats-new/category.png +0 -0
  18. assets/images/whats-new/user-status.png +0 -0
  19. assets/images/whats-new/wizard.gif +0 -0
  20. assets/js-templates/form-components.php +53 -48
  21. assets/js/admin/wpuf-enhanced-select.js +276 -0
  22. assets/js/admin/wpuf-enhanced-select.min.js +1 -0
  23. assets/js/admin/wpuf-setup.js +151 -0
  24. assets/js/admin/wpuf-setup.min.js +1 -0
  25. assets/js/jquery-blockui/jquery.blockUI.js +619 -0
  26. assets/js/jquery-blockui/jquery.blockUI.min.js +14 -0
  27. assets/js/selectWPUF/selectWPUF.full.js +6569 -0
  28. assets/js/selectWPUF/selectWPUF.full.min.js +1 -0
  29. assets/js/selectWPUF/selectWPUF.js +5858 -0
  30. assets/js/selectWPUF/selectWPUF.min.js +1 -0
  31. assets/js/wpuf-admin.js +22 -0
  32. assets/js/wpuf-form-builder-components.js +69 -41
  33. assets/js/wpuf-form-builder-mixins.js +5 -5
  34. assets/less/admin.less +77 -0
  35. assets/vendor/vue-router/vue-router.js +2631 -0
  36. class/frontend-account.php +1 -0
  37. class/frontend-form-post.php +10 -3
  38. class/payment.php +7 -4
  39. class/render-form.php +1 -1
  40. includes/free/loader.php +4 -3
  41. includes/free/post-form-templates/woocommerce.php +11 -3
  42. includes/setup-wizard.php +339 -0
  43. includes/upgrades/upgrade-2.8.0.php +1 -1
  44. languages/wpuf.pot +383 -274
  45. lib/class.settings-api.php +1 -0
  46. readme.txt +12 -1
  47. templates/account.php +4 -8
  48. wpuf-functions.php +64 -1
  49. wpuf.php +5 -3
admin/class-admin-settings.php CHANGED
@@ -97,12 +97,16 @@ class WPUF_Admin_Settings {
97
  if ( !class_exists( 'WeForms' ) ) {
98
  $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'weForms', 'wpuf' ), __( 'Contact Form', 'wpuf' ), $capability, 'wpuf_weforms', array($this, 'weforms_page') );
99
  }
 
 
 
100
 
101
- $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'Subscriptions', 'wpuf' ), __( 'Subscriptions', 'wpuf' ), $capability, 'edit.php?post_type=wpuf_subscription' );
102
 
103
- do_action( 'wpuf_admin_menu' );
 
 
104
 
105
- $transactions_page = add_submenu_page( 'wp-user-frontend', __( 'Transactions', 'wpuf' ), __( 'Transactions', 'wpuf' ), $capability, 'wpuf_transaction', array($this, 'transactions_page') );
106
  $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'Tools', 'wpuf' ), __( 'Tools', 'wpuf' ), $capability, 'wpuf_tools', array($this, 'tools_page') );
107
 
108
  do_action( 'wpuf_admin_menu_bottom' );
@@ -120,9 +124,10 @@ class WPUF_Admin_Settings {
120
  $this->menu_pages[] = 'edit-wpuf_subscription';
121
  $this->menu_pages[] = 'wpuf_subscribers';
122
  $this->menu_pages[] = 'user-frontend_page_wpuf_transaction';
123
-
124
- add_action( "load-$transactions_page", array( $this, 'transactions_screen_option' ) );
125
- // add_action( "load-wpuf_subscribers", array( $this, 'subscribers_screen_option' ) );
 
126
  }
127
 
128
  /**
97
  if ( !class_exists( 'WeForms' ) ) {
98
  $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'weForms', 'wpuf' ), __( 'Contact Form', 'wpuf' ), $capability, 'wpuf_weforms', array($this, 'weforms_page') );
99
  }
100
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
101
+ $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'Subscriptions', 'wpuf' ), __( 'Subscriptions', 'wpuf' ), $capability, 'edit.php?post_type=wpuf_subscription' );
102
+ }
103
 
104
+ do_action( 'wpuf_admin_menu' );
105
 
106
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
107
+ $transactions_page = add_submenu_page( 'wp-user-frontend', __( 'Transactions', 'wpuf' ), __( 'Transactions', 'wpuf' ), $capability, 'wpuf_transaction', array($this, 'transactions_page') );
108
+ }
109
 
 
110
  $this->menu_pages[] = add_submenu_page( 'wp-user-frontend', __( 'Tools', 'wpuf' ), __( 'Tools', 'wpuf' ), $capability, 'wpuf_tools', array($this, 'tools_page') );
111
 
112
  do_action( 'wpuf_admin_menu_bottom' );
124
  $this->menu_pages[] = 'edit-wpuf_subscription';
125
  $this->menu_pages[] = 'wpuf_subscribers';
126
  $this->menu_pages[] = 'user-frontend_page_wpuf_transaction';
127
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
128
+ add_action( "load-$transactions_page", array( $this, 'transactions_screen_option' ) );
129
+ // add_action( "load-wpuf_subscribers", array( $this, 'subscribers_screen_option' ) );
130
+ }
131
  }
132
 
133
  /**
admin/class-admin-welcome.php CHANGED
@@ -10,7 +10,7 @@ class WPUF_Admin_Welcome {
10
  function __construct() {
11
  add_action( 'admin_menu', array( $this, 'register_menu' ) );
12
  add_action( 'admin_head', array( $this, 'hide_menu' ) );
13
- add_action( 'admin_init', array( $this, 'redirect_to_page' ), 9999 );
14
  }
15
 
16
  /**
10
  function __construct() {
11
  add_action( 'admin_menu', array( $this, 'register_menu' ) );
12
  add_action( 'admin_head', array( $this, 'hide_menu' ) );
13
+ // add_action( 'admin_init', array( $this, 'redirect_to_page' ), 9999 );
14
  }
15
 
16
  /**
admin/form-builder/class-wpuf-form-builder-field-settings.php CHANGED
@@ -104,7 +104,7 @@ class WPUF_Form_Builder_Field_Settings {
104
  'name' => 'wpuf_visibility',
105
  'title' => __( 'Visibility', 'wpuf' ),
106
  'type' => 'visibility',
107
- 'section' => 'advanced',
108
  'options' => array(
109
  'everyone' => __( 'Everyone', 'wpuf' ),
110
  'hidden' => __( 'Hidden', 'wpuf' ),
@@ -146,7 +146,7 @@ class WPUF_Form_Builder_Field_Settings {
146
  'inline' => true,
147
  'help_text' => __( 'Select Yes if you want to show the field data in single post.', 'wpuf' ),
148
  )
149
- ));
150
  }
151
  }
152
 
@@ -333,7 +333,7 @@ class WPUF_Form_Builder_Field_Settings {
333
  'name' => '',
334
  'is_meta' => 'yes',
335
  'help' => '',
336
- 'width' => 'large',
337
  'css' => '',
338
  'placeholder' => '',
339
  'default' => '',
@@ -372,7 +372,7 @@ class WPUF_Form_Builder_Field_Settings {
372
  'name' => '',
373
  'is_meta' => 'yes',
374
  'help' => '',
375
- 'width' => 'medium',
376
  'css' => '',
377
  'rows' => 5,
378
  'cols' => 25,
@@ -448,7 +448,7 @@ class WPUF_Form_Builder_Field_Settings {
448
  'name' => '',
449
  'is_meta' => 'yes',
450
  'help' => '',
451
- 'width' => 'medium',
452
  'css' => '',
453
  'selected' => '',
454
  'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
@@ -491,7 +491,7 @@ class WPUF_Form_Builder_Field_Settings {
491
  'name' => '',
492
  'is_meta' => 'yes',
493
  'help' => '',
494
- 'width' => 'medium',
495
  'css' => '',
496
  'selected' => array(),
497
  'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
@@ -740,7 +740,7 @@ class WPUF_Form_Builder_Field_Settings {
740
  'id' => 0,
741
  'is_new' => true,
742
  'show_in_post' => 'yes',
743
- 'wpuf_visibility' => self::get_wpuf_visibility_prop(),
744
  'wpuf_cond' => null
745
  )
746
  );
@@ -948,4 +948,4 @@ class WPUF_Form_Builder_Field_Settings {
948
  )
949
  );
950
  }
951
- }
104
  'name' => 'wpuf_visibility',
105
  'title' => __( 'Visibility', 'wpuf' ),
106
  'type' => 'visibility',
107
+ 'section' => 'advanced',
108
  'options' => array(
109
  'everyone' => __( 'Everyone', 'wpuf' ),
110
  'hidden' => __( 'Hidden', 'wpuf' ),
146
  'inline' => true,
147
  'help_text' => __( 'Select Yes if you want to show the field data in single post.', 'wpuf' ),
148
  )
149
+ ));
150
  }
151
  }
152
 
333
  'name' => '',
334
  'is_meta' => 'yes',
335
  'help' => '',
336
+ 'width' => '',
337
  'css' => '',
338
  'placeholder' => '',
339
  'default' => '',
372
  'name' => '',
373
  'is_meta' => 'yes',
374
  'help' => '',
375
+ 'width' => '',
376
  'css' => '',
377
  'rows' => 5,
378
  'cols' => 25,
448
  'name' => '',
449
  'is_meta' => 'yes',
450
  'help' => '',
451
+ 'width' => '',
452
  'css' => '',
453
  'selected' => '',
454
  'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
491
  'name' => '',
492
  'is_meta' => 'yes',
493
  'help' => '',
494
+ 'width' => '',
495
  'css' => '',
496
  'selected' => array(),
497
  'options' => array( 'Option' => __( 'Option', 'wpuf' ) ),
740
  'id' => 0,
741
  'is_new' => true,
742
  'show_in_post' => 'yes',
743
+ 'wpuf_visibility' => self::get_wpuf_visibility_prop(),
744
  'wpuf_cond' => null
745
  )
746
  );
948
  )
949
  );
950
  }
951
+ }
admin/form.php CHANGED
@@ -608,7 +608,7 @@ class WPUF_Admin_Form {
608
  'name' => 'post_content',
609
  'is_meta' => 'no',
610
  'help' => '',
611
- 'width' => 'medium',
612
  'css' => '',
613
  'rows' => 5,
614
  'cols' => 25,
@@ -654,7 +654,7 @@ class WPUF_Admin_Form {
654
  'name' => 'post_excerpt',
655
  'is_meta' => 'no',
656
  'help' => '',
657
- 'width' => 'medium',
658
  'css' => '',
659
  'rows' => 5,
660
  'cols' => 25,
@@ -778,6 +778,30 @@ class WPUF_Admin_Form {
778
  'default' => 'select',
779
  ),
780
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
781
  array(
782
  'name' => 'orderby',
783
  'title' => __( 'Order By', 'wpuf' ),
@@ -872,6 +896,8 @@ class WPUF_Admin_Form {
872
  'width' => 'small',
873
  'css' => '',
874
  'type' => 'select',
 
 
875
  'orderby' => 'name',
876
  'order' => 'ASC',
877
  'exclude_type' => '',
608
  'name' => 'post_content',
609
  'is_meta' => 'no',
610
  'help' => '',
611
+ 'width' => '',
612
  'css' => '',
613
  'rows' => 5,
614
  'cols' => 25,
654
  'name' => 'post_excerpt',
655
  'is_meta' => 'no',
656
  'help' => '',
657
+ 'width' => '',
658
  'css' => '',
659
  'rows' => 5,
660
  'cols' => 25,
778
  'default' => 'select',
779
  ),
780
 
781
+ array(
782
+ 'name' => 'first',
783
+ 'title' => __( 'Select Text', 'wpuf' ),
784
+ 'type' => 'text',
785
+ 'section' => 'basic',
786
+ 'priority' => 13,
787
+ 'help_text' => __( "First element of the select dropdown. Leave this empty if you don't want to show this field", 'wpuf' ),
788
+ ),
789
+
790
+ array(
791
+ 'name' => 'show_inline',
792
+ 'title' => __( 'Show in inline list', 'wpuf' ),
793
+ 'type' => 'radio',
794
+ 'options' => array(
795
+ 'yes' => __( 'Yes', 'wpuf' ),
796
+ 'no' => __( 'No', 'wpuf' ),
797
+ ),
798
+ 'default' => 'no',
799
+ 'inline' => true,
800
+ 'section' => 'advanced',
801
+ 'priority' => 23,
802
+ 'help_text' => __( 'Show this option in an inline list', 'wpuf' ),
803
+ ),
804
+
805
  array(
806
  'name' => 'orderby',
807
  'title' => __( 'Order By', 'wpuf' ),
896
  'width' => 'small',
897
  'css' => '',
898
  'type' => 'select',
899
+ 'first' => __( '- select -', 'wpuf' ),
900
+ 'show_inline' => 'inline',
901
  'orderby' => 'name',
902
  'order' => 'ASC',
903
  'exclude_type' => '',
admin/html/form-settings-post.php CHANGED
@@ -9,7 +9,7 @@ $restrict_message = __( "This page is restricted. Please Log in / Register
9
  $post_type_selected = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
10
 
11
  $post_format_selected = isset( $form_settings['post_format'] ) ? $form_settings['post_format'] : 0;
12
- $default_cat = isset( $form_settings['default_cat'] ) ? $form_settings['default_cat'] : -1;
13
 
14
  $redirect_to = isset( $form_settings['redirect_to'] ) ? $form_settings['redirect_to'] : 'post';
15
  $message = isset( $form_settings['message'] ) ? $form_settings['message'] : __( 'Post saved', 'wpuf' );
@@ -89,14 +89,27 @@ $draft_post = isset( $form_settings['draft_post'] ) ? $form_settings[
89
  <th><?php _e( 'Default Post Category', 'wpuf' ); ?></th>
90
  <td>
91
  <?php
92
- wp_dropdown_categories( array(
93
  'hide_empty' => false,
94
  'hierarchical' => true,
95
  'selected' => $default_cat,
96
- 'name' => 'wpuf_settings[default_cat]',
97
- 'show_option_none' => __( '- None -', 'wpuf' ),
98
  'taxonomy' => ( $post_type_selected == 'product' ) ? 'product_cat' : 'category'
99
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  ?>
101
  <p class="description"><?php echo __( 'If users are not allowed to choose any category, this category will be used instead (if post type supports)', 'wpuf' ); ?></p>
102
  </td>
9
  $post_type_selected = isset( $form_settings['post_type'] ) ? $form_settings['post_type'] : 'post';
10
 
11
  $post_format_selected = isset( $form_settings['post_format'] ) ? $form_settings['post_format'] : 0;
12
+ $default_cat = isset( $form_settings['default_cat'] ) ? $form_settings['default_cat'] : array();
13
 
14
  $redirect_to = isset( $form_settings['redirect_to'] ) ? $form_settings['redirect_to'] : 'post';
15
  $message = isset( $form_settings['message'] ) ? $form_settings['message'] : __( 'Post saved', 'wpuf' );
89
  <th><?php _e( 'Default Post Category', 'wpuf' ); ?></th>
90
  <td>
91
  <?php
92
+ $args = array(
93
  'hide_empty' => false,
94
  'hierarchical' => true,
95
  'selected' => $default_cat,
 
 
96
  'taxonomy' => ( $post_type_selected == 'product' ) ? 'product_cat' : 'category'
97
+ );
98
+
99
+ echo '<select multiple name="wpuf_settings[default_cat][]">';
100
+
101
+ $categories = get_categories( $args );
102
+
103
+ foreach ( $categories as $category ) {
104
+ $selected = '';
105
+ if ( in_array( $category->term_id, $default_cat ) ) {
106
+ $selected = 'selected ';
107
+ }
108
+ echo '<option ' . $selected . 'value="' . $category->term_id . '">' . $category->name . '</option>';
109
+ }
110
+
111
+ echo '</select>';
112
+
113
  ?>
114
  <p class="description"><?php echo __( 'If users are not allowed to choose any category, this category will be used instead (if post type supports)', 'wpuf' ); ?></p>
115
  </td>
admin/html/form-submission-restriction.php CHANGED
@@ -3,24 +3,24 @@ global $post;
3
 
4
  $form_settings = wpuf_get_form_settings( $post->ID );
5
 
6
- $guest_post = isset( $form_settings['guest_post'] ) ? $form_settings['guest_post'] : 'false';
7
- $role_base = isset( $form_settings['role_base'] ) ? $form_settings['role_base'] : 'false';
8
- $roles = isset( $form_settings['roles'] ) ? $form_settings['roles'] : array( 'administrator' );
9
- $guest_details = isset( $form_settings['guest_details'] ) ? $form_settings['guest_details'] : 'true';
10
- $guest_email_verify = isset( $form_settings['guest_email_verify'] ) ? $form_settings['guest_email_verify'] : 'false';
11
- $name_label = isset( $form_settings['name_label'] ) ? $form_settings['name_label'] : __( 'Name', 'wpuf' );
12
- $email_label = isset( $form_settings['email_label'] ) ? $form_settings['email_label'] : __( 'Email', 'wpuf' );
13
- $message_restrict = isset( $form_settings['message_restrict'] ) ? $form_settings['message_restrict'] : $restrict_message;
14
-
15
- $schedule_form = isset( $form_settings['schedule_form'] ) ? $form_settings['schedule_form'] : 'false';
16
- $schedule_start = isset( $form_settings['schedule_start'] ) ? $form_settings['schedule_start'] : '';
17
- $schedule_end = isset( $form_settings['schedule_end'] ) ? $form_settings['schedule_end'] : '';
18
- $form_pending_message = isset( $form_settings['form_pending_message'] ) ? $form_settings['form_pending_message'] : 'Form submission not started.';
19
- $form_expired_message = isset( $form_settings['form_expired_message'] ) ? $form_settings['form_expired_message'] : 'Submission date expired.';
20
-
21
- $limit_entries = isset( $form_settings['limit_entries'] ) ? $form_settings['limit_entries'] : 'false';
22
- $limit_number = isset( $form_settings['limit_number'] ) ? $form_settings['limit_number'] : 100;
23
- $limit_message = isset( $form_settings['limit_message'] ) ? $form_settings['limit_message'] : 'Form submission limit exceeded';
24
  ?>
25
  <table class="form-table">
26
 
@@ -99,13 +99,13 @@ $limit_message = isset( $form_settings['limit_message'] ) ? $form_settings['li
99
  foreach ( wpuf_get_user_roles() as $key => $role ) { ?>
100
  <label>
101
  <input type="checkbox" name="wpuf_settings[roles][]" value="<?php echo $key; ?>"
102
- <?php echo in_array($key, $roles) ? 'checked="checked"' : '';
103
  echo 'administrator' == $key ? 'disabled' : '';
104
  ?> />
105
  <?php echo $role; ?>
106
  </label><br>
107
  <?php } ?>
108
-
109
  <p class="description"><?php _e( 'Choose which roles can submit posts.', 'wpuf' ); ?></p>
110
  </td>
111
  </tr>
@@ -135,11 +135,11 @@ $limit_message = isset( $form_settings['limit_message'] ) ? $form_settings['li
135
  <td>
136
 
137
  <?php _e( 'From', 'wpuf' ); ?>
138
- <input type="text" name="wpuf_settings[schedule_start]" id="schedule_start" value="" class="datepicker">
139
  <!-- <datepicker name="wpuf_settings[schedule_start]"></datepicker> -->
140
 
141
  <?php _e( 'To', 'wpuf' ); ?>
142
- <input type="text" name="wpuf_settings[schedule_end]" id="schedule_end" value="" class="datepicker">
143
  <!-- <datepicker name="wpuf_settings[schedule_end]"></datepicker> -->
144
  </td>
145
  </tr>
3
 
4
  $form_settings = wpuf_get_form_settings( $post->ID );
5
 
6
+ $guest_post = !empty( $form_settings['guest_post'] ) ? $form_settings['guest_post'] : 'false';
7
+ $role_base = !empty( $form_settings['role_base'] ) ? $form_settings['role_base'] : 'false';
8
+ $roles = !empty( $form_settings['roles'] ) ? $form_settings['roles'] : array( 'administrator' );
9
+ $guest_details = !empty( $form_settings['guest_details'] ) ? $form_settings['guest_details'] : 'true';
10
+ $guest_email_verify = !empty( $form_settings['guest_email_verify'] ) ? $form_settings['guest_email_verify'] : 'false';
11
+ $name_label = !empty( $form_settings['name_label'] ) ? $form_settings['name_label'] : __( 'Name', 'wpuf' );
12
+ $email_label = !empty( $form_settings['email_label'] ) ? $form_settings['email_label'] : __( 'Email', 'wpuf' );
13
+ $message_restrict = !empty( $form_settings['message_restrict'] ) ? $form_settings['message_restrict'] : $restrict_message;
14
+
15
+ $schedule_form = !empty( $form_settings['schedule_form'] ) ? $form_settings['schedule_form'] : 'false';
16
+ $schedule_start = !empty( $form_settings['schedule_start'] ) ? $form_settings['schedule_start'] : '';
17
+ $schedule_end = !empty( $form_settings['schedule_end'] ) ? $form_settings['schedule_end'] : '';
18
+ $form_pending_message = !empty( $form_settings['form_pending_message'] ) ? $form_settings['form_pending_message'] : 'Form submission not started.';
19
+ $form_expired_message = !empty( $form_settings['form_expired_message'] ) ? $form_settings['form_expired_message'] : 'Submission date expired.';
20
+
21
+ $limit_entries = !empty( $form_settings['limit_entries'] ) ? $form_settings['limit_entries'] : 'false';
22
+ $limit_number = !empty( $form_settings['limit_number'] ) ? $form_settings['limit_number'] : 100;
23
+ $limit_message = !empty( $form_settings['limit_message'] ) ? $form_settings['limit_message'] : 'Form submission limit exceeded';
24
  ?>
25
  <table class="form-table">
26
 
99
  foreach ( wpuf_get_user_roles() as $key => $role ) { ?>
100
  <label>
101
  <input type="checkbox" name="wpuf_settings[roles][]" value="<?php echo $key; ?>"
102
+ <?php echo in_array($key, $roles) || 'administrator' == $key ? 'checked="checked"' : '';
103
  echo 'administrator' == $key ? 'disabled' : '';
104
  ?> />
105
  <?php echo $role; ?>
106
  </label><br>
107
  <?php } ?>
108
+ <input type="hidden" name="wpuf_settings[roles][]" value="administrator">
109
  <p class="description"><?php _e( 'Choose which roles can submit posts.', 'wpuf' ); ?></p>
110
  </td>
111
  </tr>
135
  <td>
136
 
137
  <?php _e( 'From', 'wpuf' ); ?>
138
+ <input type="text" name="wpuf_settings[schedule_start]" id="schedule_start" value="<?php echo $schedule_start; ?>" class="datepicker">
139
  <!-- <datepicker name="wpuf_settings[schedule_start]"></datepicker> -->
140
 
141
  <?php _e( 'To', 'wpuf' ); ?>
142
+ <input type="text" name="wpuf_settings[schedule_end]" id="schedule_end" value="<?php echo $schedule_end; ?>" class="datepicker">
143
  <!-- <datepicker name="wpuf_settings[schedule_end]"></datepicker> -->
144
  </td>
145
  </tr>
admin/html/whats-new.php CHANGED
@@ -1,5 +1,34 @@
1
  <?php
2
  $changelog = array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  array(
4
  'version' => 'Version 2.8',
5
  'released' => '2018-01-06',
1
  <?php
2
  $changelog = array(
3
+ array(
4
+ 'version' => 'Version 2.8.1',
5
+ 'released' => '2018-01-14',
6
+ 'changes' => array(
7
+ array(
8
+ 'title' => __( 'Setup Wizard', 'wpuf' ),
9
+ 'type' => 'New',
10
+ 'description' => __( 'Setup Wizard added to turn off payment options and install pages.', 'wpuf' ) .
11
+ '<img src="'. WPUF_ASSET_URI .'/images/whats-new/wizard.gif" alt="Setup Wizard">'
12
+ ),
13
+ array(
14
+ 'title' => __( 'Multi-select Category', 'wpuf' ),
15
+ 'type' => 'New',
16
+ 'description' => __( 'Add multi-select to default category in post form settings.', 'wpuf' ) .
17
+ '<img src="'. WPUF_ASSET_URI .'/images/whats-new/category.png" alt="Multi-select Category">'
18
+ ),
19
+ array(
20
+ 'title' => __( 'Select Text option for Taxonomy', 'wpuf' ),
21
+ 'type' => 'Improvement',
22
+ 'description' => __( 'Add Select Text option for taxonomy fields. Now you can add default text with empty value as first option for Taxonomy dropdown.', 'wpuf' )
23
+ ),
24
+ array(
25
+ 'title' => __( 'Taxonomy Checkbox Inline', 'wpuf' ),
26
+ 'type' => 'Improvement',
27
+ 'description' => __( 'Added checkbox inline option to taxonomy checkbox. You can now display Taxonomy checkbox fields inline.', 'wpuf' )
28
+ ),
29
+ )
30
+ ),
31
+
32
  array(
33
  'version' => 'Version 2.8',
34
  'released' => '2018-01-06',
admin/installer.php CHANGED
@@ -20,7 +20,7 @@ class WPUF_Admin_Installer {
20
  function admin_notice() {
21
  $page_created = get_option( '_wpuf_page_created' );
22
 
23
- if ( $page_created != '1' ) {
24
  ?>
25
  <div class="updated error">
26
  <p>
@@ -79,11 +79,13 @@ class WPUF_Admin_Installer {
79
 
80
  $post_form = $this->create_form();
81
 
82
- // payment page
83
- $subscr_page = $this->create_page( __( 'Subscription', 'wpuf' ), __( '[wpuf_sub_pack]', 'wpuf') );
84
- $payment_page = $this->create_page( __( 'Payment', 'wpuf' ), __( 'Please select a gateway for payment', 'wpuf') );
85
- $thank_page = $this->create_page( __( 'Thank You', 'wpuf' ), __( '<h1>Payment is complete</h1><p>Congratulations, your payment has been completed!</p>', 'wpuf') );
86
- $bank_page = $this->create_page( __( 'Order Received', 'wpuf' ), __( 'Hi, we have received your order. We will validate the order and will take necessary steps to move forward.', 'wpuf') );
 
 
87
 
88
  // save the settings
89
  if ( $edit_page ) {
@@ -119,13 +121,15 @@ class WPUF_Admin_Installer {
119
 
120
  update_option( 'wpuf_profile', $profile_options );
121
 
122
- // payment pages
123
- update_option( 'wpuf_payment', array(
124
- 'subscription_page' => $subscr_page,
125
- 'payment_page' => $payment_page,
126
- 'payment_success' => $thank_page,
127
- 'bank_success' => $bank_page
128
- ) );
 
 
129
 
130
  update_option( '_wpuf_page_created', '1' );
131
 
20
  function admin_notice() {
21
  $page_created = get_option( '_wpuf_page_created' );
22
 
23
+ if ( $page_created != '1' && empty( wpuf_get_option( 'install_wpuf_pages', 'wpuf_general') ) ) {
24
  ?>
25
  <div class="updated error">
26
  <p>
79
 
80
  $post_form = $this->create_form();
81
 
82
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
83
+ // payment page
84
+ $subscr_page = $this->create_page( __( 'Subscription', 'wpuf' ), __( '[wpuf_sub_pack]', 'wpuf') );
85
+ $payment_page = $this->create_page( __( 'Payment', 'wpuf' ), __( 'Please select a gateway for payment', 'wpuf') );
86
+ $thank_page = $this->create_page( __( 'Thank You', 'wpuf' ), __( '<h1>Payment is complete</h1><p>Congratulations, your payment has been completed!</p>', 'wpuf') );
87
+ $bank_page = $this->create_page( __( 'Order Received', 'wpuf' ), __( 'Hi, we have received your order. We will validate the order and will take necessary steps to move forward.', 'wpuf') );
88
+ }
89
 
90
  // save the settings
91
  if ( $edit_page ) {
121
 
122
  update_option( 'wpuf_profile', $profile_options );
123
 
124
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
125
+ // payment pages
126
+ update_option( 'wpuf_payment', array(
127
+ 'subscription_page' => $subscr_page,
128
+ 'payment_page' => $payment_page,
129
+ 'payment_success' => $thank_page,
130
+ 'bank_success' => $bank_page
131
+ ) );
132
+ }
133
 
134
  update_option( '_wpuf_page_created', '1' );
135
 
admin/post-forms-list-table.php CHANGED
@@ -214,7 +214,7 @@ class WPUF_Admin_Post_Forms_List_Table extends WP_List_Table {
214
 
215
  $items = $this->item_query( $args );
216
 
217
- $this->counts = count( $items['count'] );
218
  $this->items = $items['forms'];
219
 
220
  $this->set_pagination_args( array(
214
 
215
  $items = $this->item_query( $args );
216
 
217
+ $this->counts = $items['count'];
218
  $this->items = $items['forms'];
219
 
220
  $this->set_pagination_args( array(
admin/settings-options.php CHANGED
@@ -264,28 +264,6 @@ function wpuf_settings_fields() {
264
  'no' => __( 'No', 'wpuf' )
265
  )
266
  ),
267
- array(
268
- 'name' => 'show_invoice',
269
- 'label' => __( 'Show Invoice', 'wpuf' ),
270
- 'desc' => __( 'Show Invoice tab in "my account" page where <code>[wpuf_account]</code> is located', 'wpuf' ),
271
- 'type' => 'select',
272
- 'default' => 'yes',
273
- 'options' => array(
274
- 'yes' => __( 'Yes', 'wpuf' ),
275
- 'no' => __( 'No', 'wpuf' )
276
- )
277
- ),
278
- array(
279
- 'name' => 'show_billing_address',
280
- 'label' => __( 'Show Billing Address', 'wpuf' ),
281
- 'desc' => __( 'Show Billing Address tab in "my account" page where <code>[wpuf_account]</code> is located', 'wpuf' ),
282
- 'type' => 'select',
283
- 'default' => 'yes',
284
- 'options' => array(
285
- 'yes' => __( 'Yes', 'wpuf' ),
286
- 'no' => __( 'No', 'wpuf' )
287
- )
288
- ),
289
  ) ),
290
  'wpuf_profile' => apply_filters( 'wpuf_options_profile', array(
291
  array(
@@ -318,6 +296,13 @@ function wpuf_settings_fields() {
318
  ),
319
  ) ),
320
  'wpuf_payment' => apply_filters( 'wpuf_options_payment', array(
 
 
 
 
 
 
 
321
  array(
322
  'name' => 'subscription_page',
323
  'label' => __( 'Subscription Pack Page', 'wpuf' ),
@@ -409,18 +394,26 @@ function wpuf_settings_fields() {
409
  ) ),
410
  'wpuf_mails' => apply_filters( 'wpuf_mail_options', array(
411
  array(
412
- 'name' => 'guest_email_subject',
413
- 'label' => __( 'Guest mail subject', 'wpuf' ),
414
- 'desc' => __( 'This sets the subject of the emails sent to guest users', 'wpuf' ),
415
- 'default' => 'Please Confirm Your Email to Get the Post Published!',
416
- 'type' => 'text',
 
 
 
 
 
 
 
417
  ),
418
  array(
419
- 'name' => 'guest_email_body',
420
- 'label' => __( 'Guest mail body', 'wpuf' ),
421
- 'desc' => __( "This sets the body of the emails sent to guest users. Please DON'T edit the <code>{activation_link}</code> part", 'wpuf' ),
422
- 'default' => "Hey There, \r\n\r\nWe just received your guest post and now we want you to confirm your email so that we can verify the content and move on to the publishing process.\r\n\r\nPlease click the link below to verify: \r\n\r\n{activation_link}\r\n\r\nRegards,\r\n%sitename%",
423
- 'type' => 'wysiwyg',
 
424
  ),
425
  ) )
426
  );
@@ -465,4 +458,4 @@ function wpuf_settings_field_profile( $form ) {
465
  }
466
  }
467
 
468
- add_action( 'wsa_form_bottom_wpuf_profile', 'wpuf_settings_field_profile' );
264
  'no' => __( 'No', 'wpuf' )
265
  )
266
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  ) ),
268
  'wpuf_profile' => apply_filters( 'wpuf_options_profile', array(
269
  array(
296
  ),
297
  ) ),
298
  'wpuf_payment' => apply_filters( 'wpuf_options_payment', array(
299
+ array(
300
+ 'name' => 'enable_payment',
301
+ 'label' => __( 'Enable Payments', 'wpuf' ),
302
+ 'desc' => __( 'Enable payments on your site.', 'wpuf' ),
303
+ 'type' => 'checkbox',
304
+ 'default' => 'on',
305
+ ),
306
  array(
307
  'name' => 'subscription_page',
308
  'label' => __( 'Subscription Pack Page', 'wpuf' ),
394
  ) ),
395
  'wpuf_mails' => apply_filters( 'wpuf_mail_options', array(
396
  array(
397
+ 'name' => 'guest_email_setting',
398
+ 'label' => __( '<span class="dashicons dashicons-universal-access-alt"></span> Guest Email', 'wpuf' ),
399
+ 'type' => 'html',
400
+ 'class' => 'guest-email-setting',
401
+ ),
402
+ array(
403
+ 'name' => 'guest_email_subject',
404
+ 'label' => __( 'Guest mail subject', 'wpuf' ),
405
+ 'desc' => __( 'This sets the subject of the emails sent to guest users', 'wpuf' ),
406
+ 'default' => 'Please Confirm Your Email to Get the Post Published!',
407
+ 'type' => 'text',
408
+ 'class' => 'guest-email-setting-option',
409
  ),
410
  array(
411
+ 'name' => 'guest_email_body',
412
+ 'label' => __( 'Guest mail body', 'wpuf' ),
413
+ 'desc' => __( "This sets the body of the emails sent to guest users. Please DON'T edit the <code>{activation_link}</code> part", 'wpuf' ),
414
+ 'default' => "Hey There, \r\n\r\nWe just received your guest post and now we want you to confirm your email so that we can verify the content and move on to the publishing process.\r\n\r\nPlease click the link below to verify: \r\n\r\n{activation_link}\r\n\r\nRegards,\r\n%sitename%",
415
+ 'type' => 'wysiwyg',
416
+ 'class' => 'guest-email-setting-option',
417
  ),
418
  ) )
419
  );
458
  }
459
  }
460
 
461
+ add_action( 'wsa_form_bottom_wpuf_profile', 'wpuf_settings_field_profile' );
assets/css/admin.css CHANGED
@@ -233,6 +233,7 @@ span.wpuf_help {
233
  .wpuf-settings-wrap .metabox-holder {
234
  flex: 3;
235
  margin-left: 30px;
 
236
  }
237
  .wpuf-settings-wrap .metabox-holder h2 {
238
  border-bottom: 1px solid #c8d7e1;
@@ -441,6 +442,56 @@ span.wpuf_help {
441
  .wpuf-premium .module-wrap .module-details h3 a {
442
  text-decoration: none;
443
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  .wpuf-help-tabbed {
445
  display: flex;
446
  width: 100%;
233
  .wpuf-settings-wrap .metabox-holder {
234
  flex: 3;
235
  margin-left: 30px;
236
+ margin-bottom: 30px;
237
  }
238
  .wpuf-settings-wrap .metabox-holder h2 {
239
  border-bottom: 1px solid #c8d7e1;
442
  .wpuf-premium .module-wrap .module-details h3 a {
443
  text-decoration: none;
444
  }
445
+ #wpuf_mails table tbody tr.hide {
446
+ display: none;
447
+ }
448
+ #wpuf_mails table tbody tr.heading {
449
+ cursor: pointer;
450
+ background-color: #f1f1f1;
451
+ border: 1px solid #c8d7e1;
452
+ }
453
+ #wpuf_mails table tbody tr.heading label {
454
+ font-size: 13px;
455
+ color: #444;
456
+ font-weight: 500;
457
+ }
458
+ #wpuf_mails table tbody tr.heading label span {
459
+ color: #0073aa;
460
+ padding-right: 6px;
461
+ }
462
+ #wpuf_mails table tbody tr.heading label span.dashicons-admin-generic {
463
+ color: #9b59b6;
464
+ }
465
+ #wpuf_mails table tbody tr.heading label span.dashicons-universal-access-alt {
466
+ color: #AD1457;
467
+ }
468
+ #wpuf_mails table tbody tr.heading label span.dashicons-unlock {
469
+ color: #9b59b6;
470
+ }
471
+ #wpuf_mails table tbody tr.heading label span.dashicons-email-alt {
472
+ color: #6c75ff;
473
+ }
474
+ #wpuf_mails table tbody tr.heading label span.dashicons-money {
475
+ color: #64DD17;
476
+ }
477
+ #wpuf_mails table tbody tr.heading label span.dashicons-admin-users {
478
+ color: #00aeff;
479
+ }
480
+ #wpuf_mails table tbody tr.heading label span.dashicons-groups {
481
+ color: #e67e22;
482
+ }
483
+ #wpuf_mails table tbody tr.heading label span.dashicons-dismiss {
484
+ color: #115da7;
485
+ }
486
+ #wpuf_mails table tbody tr.heading label span.dashicons-smiley {
487
+ color: #e74c3c;
488
+ }
489
+ #wpuf_mails table tbody tr.heading th {
490
+ padding: 16px 10px 16px 30px;
491
+ }
492
+ #wpuf_mails table tbody tr th {
493
+ padding-left: 30px;
494
+ }
495
  .wpuf-help-tabbed {
496
  display: flex;
497
  width: 100%;
assets/css/admin/admin.css ADDED
@@ -0,0 +1 @@
 
1
+ .select2-container{-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:block;height:28px;-moz-user-select:none;-ms-user-select:none;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{-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:block;min-height:32px;-moz-user-select:none;-ms-user-select:none;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{-webkit-box-sizing:border-box;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:#fff;border:1px solid #aaa;border-radius:4px;-webkit-box-sizing:border-box;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;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected],.select2-results__option[data-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%;-webkit-box-sizing:border-box;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}.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:700}.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:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{-webkit-box-sizing:border-box;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:700;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:700;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-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{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 #000 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--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{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:0 0;border:none;outline:0;-webkit-box-shadow:none;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],.select2-container--default .select2-results__option[data-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],.select2-container--default .select2-results__option--highlighted[data-selected]{background-color:#0073aa;color:#fff}.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-gradient(linear,left top,left bottom,color-stop(50%,#fff),to(#eee));background-image:-webkit-linear-gradient(top,#fff 50%,#eee 100%);background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--single:focus{border:1px solid #0073aa}.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:700;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-gradient(linear,left top,left bottom,color-stop(50%,#eee),to(#ccc));background-image:-webkit-linear-gradient(top,#eee 50%,#ccc 100%);background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x}.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 #0073aa}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;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-gradient(linear,left top,left bottom,from(white),color-stop(50%,#eee));background-image:-webkit-linear-gradient(top,#fff 0,#eee 50%);background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x}.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-gradient(linear,left top,left bottom,color-stop(50%,#eee),to(white));background-image:-webkit-linear-gradient(top,#eee 50%,#fff 100%);background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #0073aa}.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:700;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 #0073aa}.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;-webkit-box-shadow:none;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],.select2-container--classic .select2-results__option--highlighted[data-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:#0073aa}
assets/css/admin/wpuf-setup.css ADDED
@@ -0,0 +1 @@
 
1
+ @charset "UTF-8";body{margin:65px auto 24px;-webkit-box-shadow:none;box-shadow:none;background:#f1f1f1;padding:0}#wpuf-logo{border:0;margin:0 0 24px;padding:0;text-align:center}#wpuf-logo img{max-width:30%}.wpuf-setup-content{-webkit-box-shadow:0 1px 3px rgba(0,0,0,.13);box-shadow:0 1px 3px rgba(0,0,0,.13);padding:2em;margin:0 0 20px;background:#fff;overflow:hidden;zoom:1}.wpuf-setup-content h1,.wpuf-setup-content h2,.wpuf-setup-content h3,.wpuf-setup-content table{margin:0 0 20px;border:0;padding:0;color:#666;clear:none;font-weight:500}.wpuf-setup-content p{margin:20px 0;font-size:1em;line-height:1.75em;color:#666}.wpuf-setup-content table{font-size:1em;line-height:1.75em;color:#666}.wpuf-setup-content a{color:#40800d}.wpuf-setup-content a:focus,.wpuf-setup-content a:hover{color:#111}.wpuf-setup-content .form-table th{width:35%;vertical-align:top;font-weight:400}.wpuf-setup-content .form-table td{vertical-align:top}.wpuf-setup-content .form-table td input,.wpuf-setup-content .form-table td select{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpuf-setup-content .form-table td input[size]{width:auto}.wpuf-setup-content .form-table td .description{line-height:1.5em;display:block;margin-top:.25em;color:#999;font-style:italic}.wpuf-setup-content .form-table td .input-checkbox,.wpuf-setup-content .form-table td .input-radio{width:auto;-webkit-box-sizing:inherit;box-sizing:inherit;padding:inherit;margin:0 .5em 0 0;-webkit-box-shadow:none;box-shadow:none}.wpuf-setup-content .form-table .section_title td{padding:0}.wpuf-setup-content .form-table .section_title td h2,.wpuf-setup-content .form-table .section_title td p{margin:12px 0 0}.wpuf-setup-content .form-table td,.wpuf-setup-content .form-table th{padding:12px 0;margin:0;border:0}.wpuf-setup-content .form-table td:first-child,.wpuf-setup-content .form-table th:first-child{padding-right:1em}.wpuf-setup-content table.tax-rates{width:100%;font-size:.92em}.wpuf-setup-content table.tax-rates th{padding:0;text-align:center;width:auto;vertical-align:middle}.wpuf-setup-content table.tax-rates td{border:1px solid #f5f5f5;padding:6px;text-align:center;vertical-align:middle}.wpuf-setup-content table.tax-rates td input{outline:0;border:0;padding:0;-webkit-box-shadow:none;box-shadow:none;text-align:center;width:100%}.wpuf-setup-content table.tax-rates td.sort{cursor:move;color:#ccc}.wpuf-setup-content table.tax-rates td.sort::before{content:'\f333';font-family:dashicons}.wpuf-setup-content table.tax-rates td.readonly{background:#f5f5f5}.wpuf-setup-content table.tax-rates .add{padding:1em 0 0 1em;line-height:1em;font-size:1em;width:0;margin:6px 0 0;height:0;overflow:hidden;position:relative;display:inline-block}.wpuf-setup-content table.tax-rates .add::before{content:'\f502';font-family:dashicons;position:absolute;left:0;top:0}.wpuf-setup-content table.tax-rates .remove{padding:1em 0 0 1em;line-height:1em;font-size:1em;width:0;margin:0;height:0;overflow:hidden;position:relative;display:inline-block}.wpuf-setup-content table.tax-rates .remove::before{content:'\f182';font-family:dashicons;position:absolute;left:0;top:0}.wpuf-setup-content .wpuf-setup-pages{width:100%;border-top:1px solid #eee}.wpuf-setup-content .wpuf-setup-pages thead th{display:none}.wpuf-setup-content .wpuf-setup-pages .page-name{width:30%;font-weight:700}.wpuf-setup-content .wpuf-setup-pages td,.wpuf-setup-content .wpuf-setup-pages th{padding:14px 0;border-bottom:1px solid #eee}.wpuf-setup-content .wpuf-setup-pages td:first-child,.wpuf-setup-content .wpuf-setup-pages th:first-child{padding-right:9px}.wpuf-setup-content .wpuf-setup-pages th{padding-top:0}.wpuf-setup-content .wpuf-setup-pages .page-options p{color:#777;margin:6px 0 0 24px;line-height:1.75em}.wpuf-setup-content .wpuf-setup-pages .page-options p input{vertical-align:middle;margin:1px 0 0;height:1.75em;width:1.75em;line-height:1.75em}.wpuf-setup-content .wpuf-setup-pages .page-options p label{line-height:1}@media screen and (max-width:782px){.wpuf-setup-content .form-table tbody th{width:auto}}.wpuf-setup-content .twitter-share-button{float:right}.wpuf-setup-content .wpuf-setup-next-steps{overflow:hidden;margin:0 0 24px;padding-bottom:2px}.wpuf-setup-content .wpuf-setup-next-steps h2{margin-bottom:12px}.wpuf-setup-content .wpuf-setup-next-steps .wpuf-setup-next-steps-first{float:left;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpuf-setup-content .wpuf-setup-next-steps .wpuf-setup-next-steps-last{float:right;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpuf-setup-content .wpuf-setup-next-steps ul{padding:0 2em 0 0;list-style:none outside;margin:0}.wpuf-setup-content .wpuf-setup-next-steps ul li a{display:block;padding:0 0 .75em}.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button{background-color:#f7f7f7;border-color:#ccc;color:#23282d;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #ccc;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #ccc;text-shadow:1px 0 1px #eee,0 1px 1px #eee;font-size:1em;height:auto;line-height:1.75em;margin:0 0 .75em;opacity:1;padding:1em;text-align:center}.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button:active,.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button:focus,.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button:hover{background:#f5f5f5;border-color:#aaa}.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button-primary{color:#fff;background-color:#bb77ae;border-color:#30943d;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;text-shadow:0 -1px 1px #30943d,1px 0 1px #30943d,0 1px 1px #30943d,-1px 0 1px #30943d}.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button-primary:active,.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button-primary:focus,.wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a.button-primary:hover{color:#fff;background:#30943d;border-color:#30943d;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d}.wpuf-setup-content .wpuf-setup-next-steps ul li a::before{color:#82878c;font:normal 20px/1 dashicons;speak:none;display:inline-block;padding:0 10px 0 0;top:1px;position:relative;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none!important;vertical-align:top}.wpuf-setup-content .wpuf-setup-next-steps ul .learn-more a::before{content:'\f105'}.wpuf-setup-content .wpuf-setup-next-steps ul .video-walkthrough a::before{content:'\f126'}.wpuf-setup-content .wpuf-setup-next-steps ul .newsletter a::before{content:'\f465'}.wpuf-setup-content .updated,.wpuf-setup-content .woocommerce-newsletter,.wpuf-setup-content .woocommerce-tracker{padding:24px 24px 0;margin:0 0 24px;overflow:hidden;background:#f5f5f5}.wpuf-setup-content .updated p,.wpuf-setup-content .woocommerce-newsletter p,.wpuf-setup-content .woocommerce-tracker p{padding:0;margin:0 0 12px}.wpuf-setup-content .updated form,.wpuf-setup-content .updated p:last-child,.wpuf-setup-content .woocommerce-newsletter form,.wpuf-setup-content .woocommerce-newsletter p:last-child,.wpuf-setup-content .woocommerce-tracker form,.wpuf-setup-content .woocommerce-tracker p:last-child{margin:0 0 24px}.wpuf-setup-content .woocommerce-tracker+.woocommerce-newsletter{margin-top:-24px;border-top:2px dashed #ddd}.wpuf-setup-steps{padding:0 0 24px;margin:0;list-style:none outside;overflow:hidden;color:#ccc;width:100%;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex}.wpuf-setup-steps li{width:20%;float:left;padding:0 0 .8em;margin:0;text-align:center;position:relative;border-bottom:4px solid #ccc;line-height:1.4em}.wpuf-setup-steps li::before{content:'';border:4px solid #ccc;border-radius:100%;width:4px;height:4px;position:absolute;bottom:0;left:50%;margin-left:-6px;margin-bottom:-8px;background:#fff}.wpuf-setup-steps li.active{border-color:#40800d;color:#40800d}.wpuf-setup-steps li.active::before{border-color:#40800d}.wpuf-setup-steps li.done{border-color:#40800d;color:#40800d}.wpuf-setup-steps li.done::before{border-color:#40800d;background:#40800d}.wpuf-setup .wpuf-setup-actions{overflow:hidden;margin:20px 0 0}.wpuf-setup .wpuf-setup-actions .button{font-size:1.25em;padding:.5em 1em;line-height:1em;margin-right:.5em;margin-bottom:2px;height:auto;border-radius:4px}.wpuf-setup .wpuf-setup-actions .button-primary{background-color:#bb77ae;border-color:#30943d;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;text-shadow:0 -1px 1px #30943d,1px 0 1px #30943d,0 1px 1px #30943d,-1px 0 1px #30943d;margin:0;opacity:1}.wpuf-setup .wpuf-setup-actions .button-primary:active,.wpuf-setup .wpuf-setup-actions .button-primary:focus,.wpuf-setup .wpuf-setup-actions .button-primary:hover{background:#30943d;border-color:#30943d;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d;box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #30943d}.wpuf-setup-content p:last-child{margin-bottom:0}.wpuf-setup-content p.store-setup{margin-top:0}.wpuf-return-to-dashboard{font-size:.85em;color:#b5b5b5;margin:1.18em 0;display:block;text-align:center}.wpuf-wizard-storefront .wpuf-wizard-storefront-intro{padding:40px 40px 0;background:#f5f5f5;text-align:center}.wpuf-wizard-storefront .wpuf-wizard-storefront-intro img{margin:40px 0 0 0;width:100%;display:block}.wpuf-wizard-storefront .wpuf-wizard-storefront-features{list-style:none outside;margin:0 0 20px;padding:0 0 0 30px;overflow:hidden}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature{margin:0;padding:20px 30px 20px 2em;width:50%;-webkit-box-sizing:border-box;box-sizing:border-box}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature::before{margin-left:-2em;position:absolute}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature.first{clear:both;float:left}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature.last{float:right}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__bulletproof::before{content:'🔒'}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__mobile::before{content:'📱'}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__accessibility::before{content:'👓'}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__search::before{content:'🔍'}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__compatibility::before{content:'🔧'}.wpuf-wizard-storefront .wpuf-wizard-storefront-feature__extendable::before{content:'🎨'}.wpuf-wizard-services{border:1px solid #eee;padding:0;margin:0 0 1em;list-style:none outside;border-radius:4px}.wpuf-wizard-services p{margin:0 0 1em 0;padding:0;font-size:1em;line-height:1.5em}.wpuf-wizard-service-item,.wpuf-wizard-services-list-toggle{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:nowrap;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;padding:2em 0;border-bottom:1px solid #eee;color:#666}.wpuf-wizard-service-item:last-child,.wpuf-wizard-services-list-toggle:last-child{border-bottom:0}.wpuf-wizard-service-item .payment-gateway-fee,.wpuf-wizard-services-list-toggle .payment-gateway-fee{color:#a6a6a6}.wpuf-wizard-service-item .wpuf-wizard-service-name,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-name{-webkit-flex-basis:0;-ms-flex-preferred-size:0;flex-basis:0;min-width:175px;text-align:center;font-weight:700}.wpuf-wizard-service-item .wpuf-wizard-service-name img,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-name img{max-width:75px;margin-top:.5em}.wpuf-wizard-service-item .wpuf-wizard-service-description,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-description{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;padding:0 1em}.wpuf-wizard-service-item .wpuf-wizard-service-description p,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-description p{margin-bottom:0}.wpuf-wizard-service-item .wpuf-wizard-service-description .wpuf-wizard-service-settings,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-description .wpuf-wizard-service-settings{margin-top:1em}.wpuf-wizard-service-item .wpuf-wizard-service-description .wpuf-wizard-service-settings-description,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-description .wpuf-wizard-service-settings-description{display:block;font-style:italic;color:#999}.wpuf-wizard-service-item .wpuf-wizard-service-enable,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-enable{-webkit-flex-basis:0;-ms-flex-preferred-size:0;flex-basis:0;min-width:75px;text-align:center;cursor:pointer}.wpuf-wizard-service-item .wpuf-wizard-service-toggle,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-toggle{height:16px;width:32px;border:2px solid #935687;background-color:#935687;display:inline-block;text-indent:-9999px;border-radius:10em;position:relative}.wpuf-wizard-service-item .wpuf-wizard-service-toggle input[type=checkbox],.wpuf-wizard-services-list-toggle .wpuf-wizard-service-toggle input[type=checkbox]{display:none}.wpuf-wizard-service-item .wpuf-wizard-service-toggle:before,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-toggle:before{content:"";display:block;width:16px;height:16px;background:#fff;position:absolute;top:0;right:0;border-radius:100%}.wpuf-wizard-service-item .wpuf-wizard-service-toggle.disabled,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-toggle.disabled{border-color:#999;background-color:#999}.wpuf-wizard-service-item .wpuf-wizard-service-toggle.disabled:before,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-toggle.disabled:before{right:auto;left:0}.wpuf-wizard-service-item .wpuf-wizard-service-settings,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-settings{display:none;margin-bottom:0;cursor:default}.wpuf-wizard-service-item .wpuf-wizard-service-settings.hide,.wpuf-wizard-services-list-toggle .wpuf-wizard-service-settings.hide{display:none}.wpuf-wizard-service-item.checked .wpuf-wizard-service-settings,.wpuf-wizard-services-list-toggle.checked .wpuf-wizard-service-settings{display:inline-block}.wpuf-wizard-service-item.checked .wpuf-wizard-service-settings.hide,.wpuf-wizard-services-list-toggle.checked .wpuf-wizard-service-settings.hide{display:none}.wpuf-wizard-service-item.closed,.wpuf-wizard-services-list-toggle.closed{border-bottom:0}.wpuf-wizard-service-enable input{visibility:hidden;position:relative}.wpuf-wizard-service-enable input:before{content:"\f347";font-family:dashicons;visibility:initial;color:#666;font-size:25px;margin-left:-5px;top:-6px;position:absolute}.wpuf-wizard-service-enable input:checked:before{content:"\f343";top:-7px}.wpuf-wizard-services.manual .wpuf-wizard-service-item{display:none}.wpuf-wizard-services.shipping .wpuf-wizard-service-name{font-weight:400;text-align:left}.wpuf-wizard-services.shipping .wpuf-wizard-service-item{padding-left:2em}.wpuf-wizard-services.shipping .wpuf-wizard-service-item:first-child{border-bottom:0;padding-bottom:0;font-weight:700}.wpuf-wizard-services.shipping .wpuf-wizard-service-item:first-child .wpuf-wizard-service-name{font-weight:700}.wpuf-wizard-services.shipping .shipping-method-setting,.wpuf-wizard-services.shipping .wpuf-wizard-shipping-method-select{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.wpuf-wizard-services.shipping .shipping-method-setting.hide,.wpuf-wizard-services.shipping .wpuf-wizard-shipping-method-select.hide{display:none}.wpuf-wizard-services.shipping .shipping-method-setting input,.wpuf-wizard-services.shipping .wpuf-wizard-shipping-method-dropdown{margin-right:2em;margin-bottom:1em}.wpuf-wizard-services.shipping .shipping-method-setting input .select2,.wpuf-wizard-services.shipping .wpuf-wizard-shipping-method-dropdown .select2{min-width:130px}.wpuf-wizard-services.shipping .wpuf-wizard-service-description{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;color:#a6a6a6;font-size:.92em}.wpuf-wizard-services.shipping .shipping-method-setting input{width:95px;border:1px solid #aaa;border-color:#ddd;border-radius:4px;height:28px;padding-left:8px;padding-right:24px;font-size:14px;color:#444;background-color:#fff;display:inline-block}.wpuf-wizard-services.shipping .shipping-method-description,.wpuf-wizard-services.shipping .shipping-method-setting .description{color:#7e7e7e;font-size:.9em}.wpuf-wizard-services.shipping .shipping-method-setting input::-webkit-input-placeholder{color:#e1e1e1}.wpuf-wizard-services.shipping .shipping-method-setting input::-moz-placeholder{color:#e1e1e1}.wpuf-wizard-services.shipping .shipping-method-setting input:-ms-input-placeholder{color:#e1e1e1}.wpuf-wizard-services.shipping .shipping-method-setting input::placeholder{color:#e1e1e1}.wpuf-setup-shipping-units p{line-height:1.5em;font-size:13px;margin-bottom:.25em}.wpuf-setup-shipping-units .wpuf-setup-shipping-unit{margin-bottom:1.75em}.wpuf-setup-shipping-units .wpuf-setup-shipping-unit .select2{min-width:100%}.hide{display:none}.wpuf-wizard-features{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none;padding:0}.wpuf-wizard-features .wpuf-wizard-feature-item{-webkit-flex-basis:calc(50% - 4em - 3px);-ms-flex-preferred-size:calc(50% - 4em - 3px);flex-basis:calc(50% - 4em - 3px);border:1px solid #eee;padding:2em}.wpuf-wizard-features .wpuf-wizard-feature-item:nth-child(1){border-radius:4px 0 0 0}.wpuf-wizard-features .wpuf-wizard-feature-item:nth-child(2){border-left:0;border-radius:0 4px 0 0}.wpuf-wizard-features .wpuf-wizard-feature-item:nth-child(3){border-top:0;border-radius:0 0 0 4px}.wpuf-wizard-features .wpuf-wizard-feature-item:nth-child(4){border-top:0;border-left:0;border-radius:0 0 4px 0}.wpuf-wizard-features p.wpuf-wizard-feature-description,.wpuf-wizard-features p.wpuf-wizard-feature-name{margin:0;line-height:1.5em}h3.jetpack-reasons{text-align:center;margin:3em 0 1em 0;font-size:14px}.jetpack-logo{display:block;margin:1.75em auto 2em auto;max-height:175px}.step{text-align:center}.wpuf-setup .wpuf-setup-actions .button{font-weight:300;font-size:16px;padding:1em 2em;-webkit-box-shadow:none;box-shadow:none;min-width:12em;min-width:auto;margin-top:10px}.wpuf-setup .wpuf-setup-actions .button:active,.wpuf-setup .wpuf-setup-actions .button:focus,.wpuf-setup .wpuf-setup-actions .button:hover{-webkit-box-shadow:none;box-shadow:none}.location-prompt{color:#666;font-size:13px;font-weight:500;margin-bottom:.5em;margin-top:1em;display:inline-block}.location-input{border:1px solid #aaa;border-color:#ddd;border-radius:4px;height:30px;width:calc(100% - 8px - 24px - 2px);padding-left:8px;padding-right:24px;font-size:16px;color:#444;background-color:#fff;display:inline-block}.location-input.dropdown{width:100%}.address-step .select2{min-width:100%}.store-address-container{margin-bottom:24px}.store-address-container .city-and-postcode{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.store-address-container .city-and-postcode div{-webkit-flex-basis:50%;-ms-flex-preferred-size:50%;flex-basis:50%;margin-right:1em}.store-address-container .city-and-postcode div:last-of-type{margin-right:0}.wpuf-wizard-service-settings .payment-email-input{border:1px solid #aaa;border-color:#ddd;border-radius:4px;height:30px;padding:0 8px;font-size:14px;color:#444;background-color:#fff;display:inline-block}.newsletter-form-container{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.newsletter-form-container .newsletter-form-email{border:1px solid #aaa;border-color:#ddd;border-radius:4px;height:42px;padding:0 8px;font-size:16px;color:#666;background-color:#fff;display:inline-block;margin-right:6px;-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.newsletter-form-container .newsletter-form-button-container{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0}.wpuf-setup .wpuf-setup-actions .button.newsletter-form-button{height:42px;padding:0 1em;margin:0}.wpuf-wizard-next-steps{border:1px solid #eee;border-radius:4px;list-style:none;padding:0}.wpuf-wizard-next-steps li{padding:0}.wpuf-wizard-next-steps .wpuf-wizard-next-step-item{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-top:1px solid #eee}.wpuf-wizard-next-steps .wpuf-wizard-next-step-item:first-child{border-top:0}.wpuf-wizard-next-steps .wpuf-wizard-next-step-description{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;margin:1.5em}.wpuf-wizard-next-steps .wpuf-wizard-next-step-action{-webkit-box-flex:0;-webkit-flex-grow:0;-ms-flex-positive:0;flex-grow:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.wpuf-wizard-next-steps .wpuf-wizard-next-step-action .button{margin:1em}.wpuf-wizard-next-steps p.next-step-heading{margin:0;font-size:.95em;font-weight:400;font-variant:all-petite-caps}.wpuf-wizard-next-steps p.next-step-extra-info{margin:0}.wpuf-wizard-next-steps h3.next-step-description{margin:0;font-size:16px;font-weight:600}p.next-steps-help-text{color:#9f9f9f;padding:0 2em;text-align:center;font-size:.9em}p.jetpack-terms{font-size:.8em;text-align:center;max-width:480px;margin:0 auto;line-height:1.5em}.woocommerce-error{background:#ffe6e5;border-color:#ffc5c2;padding:1em;margin-bottom:1em}.woocommerce-error p{margin-top:0;margin-bottom:.5em;color:#444}.woocommerce-error a{color:#ff645c}.woocommerce-error .reconnect-reminder{font-size:.85em}.woocommerce-error .wpuf-setup-actions .button{font-size:14px}.allow-tracking{color:#9f9f9f;margin-top:2em;text-align:center;font-size:.9em}.wpuf-wizard-service-setting-stripe_create_account{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:end;-webkit-align-items:flex-end;-ms-flex-align:end;align-items:flex-end;margin-top:.75em}.wpuf-wizard-service-setting-stripe_create_account .payment-checkbox-input{-webkit-box-ordinal-group:2;-webkit-order:1;-ms-flex-order:1;order:1;margin-left:0;margin-right:0;width:1.5em}.wpuf-wizard-service-setting-stripe_create_account .stripe_create_account{-webkit-box-ordinal-group:3;-webkit-order:2;-ms-flex-order:2;order:2;margin-left:.3em}.wpuf-wizard-service-setting-stripe_email{margin-top:.75em}.wpuf-wizard-service-setting-stripe_email label.stripe_email{position:absolute;margin:-1px;padding:0;height:1px;width:1px;overflow:hidden;clip:rect(0 0 0 0);border:0}.wpuf-wizard-service-setting-stripe_email input.payment-email-input{margin-left:1.5em;margin-bottom:.5em;width:100%}.wpuf-wizard-service-setting-stripe_email .wpuf-wizard-service-settings-description{margin-left:1.5em}
assets/images/modules/email-templates.png ADDED
Binary file
assets/images/modules/message.gif ADDED
Binary file
assets/images/modules/wpuf-activity.png ADDED
Binary file
assets/images/whats-new/category.png ADDED
Binary file
assets/images/whats-new/user-status.png DELETED
Binary file
assets/images/whats-new/wizard.gif ADDED
Binary file
assets/js-templates/form-components.php CHANGED
@@ -74,7 +74,7 @@
74
  <?php do_action( 'wpuf-form-builder-template-builder-stage-bottom-area' ); ?>
75
  </div><!-- #form-preview-stage -->
76
  </script>
77
-
78
  <script type="text/x-template" id="tmpl-wpuf-field-checkbox">
79
  <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-checkbox">
80
  <label v-if="option_field.title" :class="option_field.title_class">
@@ -89,11 +89,11 @@
89
  </ul>
90
  </div>
91
  </script>
92
-
93
  <script type="text/x-template" id="tmpl-wpuf-field-html_help_text">
94
  <div class="panel-field-opt panel-field-html-help-text" v-html="option_field.text"></div>
95
  </script>
96
-
97
  <script type="text/x-template" id="tmpl-wpuf-field-option-data">
98
  <div class="panel-field-opt panel-field-opt-text">
99
  <label class="clearfix">
@@ -165,7 +165,7 @@
165
  <a v-if="!option_field.is_multiple && selected" href="#clear" @click.prevent="clear_selection"><?php _e( 'Clear Selection', 'wpuf' ); ?></a>
166
  </div>
167
  </script>
168
-
169
  <script type="text/x-template" id="tmpl-wpuf-field-option-pro-feature-alert">
170
  <div class="panel-field-opt panel-field-opt-pro-feature">
171
  <label>{{ option_field.title }}</label><br>
@@ -174,7 +174,7 @@
174
  </label>
175
  </div>
176
  </script>
177
-
178
  <script type="text/x-template" id="tmpl-wpuf-field-options">
179
  <div class="wpuf-form-builder-field-options">
180
  <div v-if="!parseInt(editing_field_id)" class="options-fileds-section text-center">
@@ -224,7 +224,7 @@
224
 
225
  </div>
226
  </script>
227
-
228
  <script type="text/x-template" id="tmpl-wpuf-field-radio">
229
  <div class="panel-field-opt panel-field-opt-radio">
230
  <label v-if="option_field.title">
@@ -240,7 +240,7 @@
240
  </ul>
241
  </div>
242
  </script>
243
-
244
  <script type="text/x-template" id="tmpl-wpuf-field-select">
245
  <div class="panel-field-opt panel-field-opt-select">
246
  <label v-if="option_field.title">
@@ -253,7 +253,7 @@
253
  </select>
254
  </div>
255
  </script>
256
-
257
  <script type="text/x-template" id="tmpl-wpuf-field-text">
258
  <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-text">
259
  <label>
@@ -277,7 +277,7 @@
277
  </label>
278
  </div>
279
  </script>
280
-
281
  <script type="text/x-template" id="tmpl-wpuf-field-text-meta">
282
  <div class="panel-field-opt panel-field-opt-text panel-field-opt-text-meta">
283
  <label>
@@ -289,7 +289,7 @@
289
  </label>
290
  </div>
291
  </script>
292
-
293
  <script type="text/x-template" id="tmpl-wpuf-field-textarea">
294
  <div class="panel-field-opt panel-field-opt-textarea">
295
  <label>
@@ -299,7 +299,7 @@
299
  </label>
300
  </div>
301
  </script>
302
-
303
  <script type="text/x-template" id="tmpl-wpuf-field-visibility">
304
  <div class="panel-field-opt panel-field-opt-radio">
305
  <label v-if="option_field.title">
@@ -360,7 +360,7 @@
360
 
361
  </div>
362
  </div></script>
363
-
364
  <script type="text/x-template" id="tmpl-wpuf-form-checkbox_field">
365
  <div class="wpuf-fields">
366
  <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
@@ -379,7 +379,7 @@
379
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
380
  </div>
381
  </script>
382
-
383
  <script type="text/x-template" id="tmpl-wpuf-form-custom_hidden_field">
384
  <div class="wpuf-fields">
385
  <input
@@ -392,11 +392,11 @@
392
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
393
  </div>
394
  </script>
395
-
396
  <script type="text/x-template" id="tmpl-wpuf-form-custom_html">
397
  <div class="wpuf-fields" v-html="field.html"></div>
398
  </script>
399
-
400
  <script type="text/x-template" id="tmpl-wpuf-form-dropdown_field">
401
  <div class="wpuf-fields">
402
  <select
@@ -415,7 +415,7 @@
415
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
416
  </div>
417
  </script>
418
-
419
  <script type="text/x-template" id="tmpl-wpuf-form-email_address">
420
  <div class="wpuf-fields">
421
  <input
@@ -428,7 +428,7 @@
428
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
429
  </div>
430
  </script>
431
-
432
  <script type="text/x-template" id="tmpl-wpuf-form-featured_image">
433
  <div class="wpuf-fields">
434
  <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
@@ -442,7 +442,7 @@
442
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
443
  </div>
444
  </script>
445
-
446
  <script type="text/x-template" id="tmpl-wpuf-form-fields">
447
  <div class="wpuf-form-builder-form-fields">
448
  <template v-for="(section, index) in panel_sections">
@@ -494,7 +494,7 @@
494
  </template>
495
  </div>
496
  </script>
497
-
498
  <script type="text/x-template" id="tmpl-wpuf-form-image_upload">
499
  <div class="wpuf-fields">
500
  <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
@@ -508,7 +508,7 @@
508
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
509
  </div>
510
  </script>
511
-
512
  <script type="text/x-template" id="tmpl-wpuf-form-multiple_select">
513
  <div class="wpuf-fields">
514
  <select
@@ -528,7 +528,7 @@
528
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
529
  </div>
530
  </script>
531
-
532
  <script type="text/x-template" id="tmpl-wpuf-form-post_content">
533
  <div class="wpuf-fields">
534
  <div class="wp-media-buttons" v-if="field.insert_image == 'yes'">
@@ -551,7 +551,7 @@
551
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
552
  </div>
553
  </script>
554
-
555
  <script type="text/x-template" id="tmpl-wpuf-form-post_excerpt">
556
  <div class="wpuf-fields">
557
  <textarea
@@ -563,7 +563,7 @@
563
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
564
  </div>
565
  </script>
566
-
567
  <script type="text/x-template" id="tmpl-wpuf-form-post_tags">
568
  <div class="wpuf-fields">
569
  <input
@@ -577,7 +577,7 @@
577
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
578
  </div>
579
  </script>
580
-
581
  <script type="text/x-template" id="tmpl-wpuf-form-post_title">
582
  <div class="wpuf-fields">
583
  <input
@@ -590,7 +590,7 @@
590
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
591
  </div>
592
  </script>
593
-
594
  <script type="text/x-template" id="tmpl-wpuf-form-radio_field">
595
  <div class="wpuf-fields">
596
  <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
@@ -609,7 +609,7 @@
609
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
610
  </div>
611
  </script>
612
-
613
  <script type="text/x-template" id="tmpl-wpuf-form-recaptcha">
614
  <div class="wpuf-fields">
615
  <template v-if="!has_recaptcha_api_keys">
@@ -623,20 +623,19 @@
623
  </template>
624
  </div>
625
  </script>
626
-
627
  <script type="text/x-template" id="tmpl-wpuf-form-section_break">
628
  <div class="wpuf-section-wrap">
629
  <h2 class="wpuf-section-title">{{ field.label }}</h2>
630
  <div class="wpuf-section-details">{{ field.description }}</div>
631
  </div>
632
  </script>
633
-
634
  <script type="text/x-template" id="tmpl-wpuf-form-taxonomy">
635
  <div class="wpuf-fields">
636
  <select
637
- v-if="'select' === field.type"
638
  :class="field.name"
639
- v-html="get_term_dropdown_options()"
640
  >
641
  </select>
642
 
@@ -659,8 +658,14 @@
659
  </div>
660
 
661
  <div v-if="'checkbox' === field.type" class="category-wrap">
662
- <div v-html="get_term_checklist()"></div>
 
 
 
 
 
663
  </div>
 
664
 
665
  <input
666
  v-if="'text' === field.type"
@@ -674,20 +679,7 @@
674
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
675
  </div>
676
  </script>
677
-
678
- <script type="text/x-template" id="tmpl-wpuf-form-text_field">
679
- <div class="wpuf-fields">
680
- <input
681
- type="text"
682
- :class="class_names('textfield')"
683
- :placeholder="field.placeholder"
684
- :value="field.default"
685
- :size="field.size"
686
- >
687
- <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
688
- </div>
689
- </script>
690
-
691
  <script type="text/x-template" id="tmpl-wpuf-form-textarea_field">
692
  <div class="wpuf-fields">
693
  <textarea
@@ -703,7 +695,20 @@
703
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
704
  </div>
705
  </script>
706
-
 
 
 
 
 
 
 
 
 
 
 
 
 
707
  <script type="text/x-template" id="tmpl-wpuf-form-website_url">
708
  <div class="wpuf-fields">
709
  <input
@@ -716,11 +721,11 @@
716
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
717
  </div>
718
  </script>
719
-
720
  <script type="text/x-template" id="tmpl-wpuf-help-text">
721
  <i class="fa fa-question-circle field-helper-text wpuf-tooltip" data-placement="top" :title="text"></i>
722
  </script>
723
-
724
  <script type="text/x-template" id="tmpl-wpuf-text-editor">
725
  <div class="wpuf-text-editor">
726
 
74
  <?php do_action( 'wpuf-form-builder-template-builder-stage-bottom-area' ); ?>
75
  </div><!-- #form-preview-stage -->
76
  </script>
77
+
78
  <script type="text/x-template" id="tmpl-wpuf-field-checkbox">
79
  <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-checkbox">
80
  <label v-if="option_field.title" :class="option_field.title_class">
89
  </ul>
90
  </div>
91
  </script>
92
+
93
  <script type="text/x-template" id="tmpl-wpuf-field-html_help_text">
94
  <div class="panel-field-opt panel-field-html-help-text" v-html="option_field.text"></div>
95
  </script>
96
+
97
  <script type="text/x-template" id="tmpl-wpuf-field-option-data">
98
  <div class="panel-field-opt panel-field-opt-text">
99
  <label class="clearfix">
165
  <a v-if="!option_field.is_multiple && selected" href="#clear" @click.prevent="clear_selection"><?php _e( 'Clear Selection', 'wpuf' ); ?></a>
166
  </div>
167
  </script>
168
+
169
  <script type="text/x-template" id="tmpl-wpuf-field-option-pro-feature-alert">
170
  <div class="panel-field-opt panel-field-opt-pro-feature">
171
  <label>{{ option_field.title }}</label><br>
174
  </label>
175
  </div>
176
  </script>
177
+
178
  <script type="text/x-template" id="tmpl-wpuf-field-options">
179
  <div class="wpuf-form-builder-field-options">
180
  <div v-if="!parseInt(editing_field_id)" class="options-fileds-section text-center">
224
 
225
  </div>
226
  </script>
227
+
228
  <script type="text/x-template" id="tmpl-wpuf-field-radio">
229
  <div class="panel-field-opt panel-field-opt-radio">
230
  <label v-if="option_field.title">
240
  </ul>
241
  </div>
242
  </script>
243
+
244
  <script type="text/x-template" id="tmpl-wpuf-field-select">
245
  <div class="panel-field-opt panel-field-opt-select">
246
  <label v-if="option_field.title">
253
  </select>
254
  </div>
255
  </script>
256
+
257
  <script type="text/x-template" id="tmpl-wpuf-field-text">
258
  <div v-if="met_dependencies" class="panel-field-opt panel-field-opt-text">
259
  <label>
277
  </label>
278
  </div>
279
  </script>
280
+
281
  <script type="text/x-template" id="tmpl-wpuf-field-text-meta">
282
  <div class="panel-field-opt panel-field-opt-text panel-field-opt-text-meta">
283
  <label>
289
  </label>
290
  </div>
291
  </script>
292
+
293
  <script type="text/x-template" id="tmpl-wpuf-field-textarea">
294
  <div class="panel-field-opt panel-field-opt-textarea">
295
  <label>
299
  </label>
300
  </div>
301
  </script>
302
+
303
  <script type="text/x-template" id="tmpl-wpuf-field-visibility">
304
  <div class="panel-field-opt panel-field-opt-radio">
305
  <label v-if="option_field.title">
360
 
361
  </div>
362
  </div></script>
363
+
364
  <script type="text/x-template" id="tmpl-wpuf-form-checkbox_field">
365
  <div class="wpuf-fields">
366
  <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
379
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
380
  </div>
381
  </script>
382
+
383
  <script type="text/x-template" id="tmpl-wpuf-form-custom_hidden_field">
384
  <div class="wpuf-fields">
385
  <input
392
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
393
  </div>
394
  </script>
395
+
396
  <script type="text/x-template" id="tmpl-wpuf-form-custom_html">
397
  <div class="wpuf-fields" v-html="field.html"></div>
398
  </script>
399
+
400
  <script type="text/x-template" id="tmpl-wpuf-form-dropdown_field">
401
  <div class="wpuf-fields">
402
  <select
415
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
416
  </div>
417
  </script>
418
+
419
  <script type="text/x-template" id="tmpl-wpuf-form-email_address">
420
  <div class="wpuf-fields">
421
  <input
428
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
429
  </div>
430
  </script>
431
+
432
  <script type="text/x-template" id="tmpl-wpuf-form-featured_image">
433
  <div class="wpuf-fields">
434
  <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
442
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
443
  </div>
444
  </script>
445
+
446
  <script type="text/x-template" id="tmpl-wpuf-form-fields">
447
  <div class="wpuf-form-builder-form-fields">
448
  <template v-for="(section, index) in panel_sections">
494
  </template>
495
  </div>
496
  </script>
497
+
498
  <script type="text/x-template" id="tmpl-wpuf-form-image_upload">
499
  <div class="wpuf-fields">
500
  <div :id="'wpuf-img_label-' + field.id + '-upload-container'">
508
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
509
  </div>
510
  </script>
511
+
512
  <script type="text/x-template" id="tmpl-wpuf-form-multiple_select">
513
  <div class="wpuf-fields">
514
  <select
528
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
529
  </div>
530
  </script>
531
+
532
  <script type="text/x-template" id="tmpl-wpuf-form-post_content">
533
  <div class="wpuf-fields">
534
  <div class="wp-media-buttons" v-if="field.insert_image == 'yes'">
551
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
552
  </div>
553
  </script>
554
+
555
  <script type="text/x-template" id="tmpl-wpuf-form-post_excerpt">
556
  <div class="wpuf-fields">
557
  <textarea
563
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
564
  </div>
565
  </script>
566
+
567
  <script type="text/x-template" id="tmpl-wpuf-form-post_tags">
568
  <div class="wpuf-fields">
569
  <input
577
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
578
  </div>
579
  </script>
580
+
581
  <script type="text/x-template" id="tmpl-wpuf-form-post_title">
582
  <div class="wpuf-fields">
583
  <input
590
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
591
  </div>
592
  </script>
593
+
594
  <script type="text/x-template" id="tmpl-wpuf-form-radio_field">
595
  <div class="wpuf-fields">
596
  <ul :class="['wpuf-fields-list', ('yes' === field.inline) ? 'wpuf-list-inline' : '']">
609
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
610
  </div>
611
  </script>
612
+
613
  <script type="text/x-template" id="tmpl-wpuf-form-recaptcha">
614
  <div class="wpuf-fields">
615
  <template v-if="!has_recaptcha_api_keys">
623
  </template>
624
  </div>
625
  </script>
626
+
627
  <script type="text/x-template" id="tmpl-wpuf-form-section_break">
628
  <div class="wpuf-section-wrap">
629
  <h2 class="wpuf-section-title">{{ field.label }}</h2>
630
  <div class="wpuf-section-details">{{ field.description }}</div>
631
  </div>
632
  </script>
633
+
634
  <script type="text/x-template" id="tmpl-wpuf-form-taxonomy">
635
  <div class="wpuf-fields">
636
  <select
 
637
  :class="field.name"
638
+ v-html ="get_term_dropdown_options()"
639
  >
640
  </select>
641
 
658
  </div>
659
 
660
  <div v-if="'checkbox' === field.type" class="category-wrap">
661
+ <div v-if="'yes' === field.show_inline" class="category-wrap">
662
+ <div v-html="get_term_checklist_inline()"></div>
663
+ </div>
664
+ <div v-else-if="'no' === field.show_inline" class="category-wrap">
665
+ <div v-html="get_term_checklist()"></div>
666
+ </div>
667
  </div>
668
+
669
 
670
  <input
671
  v-if="'text' === field.type"
679
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
680
  </div>
681
  </script>
682
+
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  <script type="text/x-template" id="tmpl-wpuf-form-textarea_field">
684
  <div class="wpuf-fields">
685
  <textarea
695
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
696
  </div>
697
  </script>
698
+
699
+ <script type="text/x-template" id="tmpl-wpuf-form-text_field">
700
+ <div class="wpuf-fields">
701
+ <input
702
+ type="text"
703
+ :class="class_names('textfield')"
704
+ :placeholder="field.placeholder"
705
+ :value="field.default"
706
+ :size="field.size"
707
+ >
708
+ <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
709
+ </div>
710
+ </script>
711
+
712
  <script type="text/x-template" id="tmpl-wpuf-form-website_url">
713
  <div class="wpuf-fields">
714
  <input
721
  <span v-if="field.help" class="wpuf-help">{{ field.help }}</span>
722
  </div>
723
  </script>
724
+
725
  <script type="text/x-template" id="tmpl-wpuf-help-text">
726
  <i class="fa fa-question-circle field-helper-text wpuf-tooltip" data-placement="top" :title="text"></i>
727
  </script>
728
+
729
  <script type="text/x-template" id="tmpl-wpuf-text-editor">
730
  <div class="wpuf-text-editor">
731
 
assets/js/admin/wpuf-enhanced-select.js ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global wpuf_enhanced_select_params */
2
+ jQuery( function( $ ) {
3
+
4
+ function getEnhancedSelectFormatString() {
5
+ return {
6
+ 'language': {
7
+ errorLoading: function() {
8
+ // Workaround for https://github.com/select2/select2/issues/4355 instead of i18n_ajax_error.
9
+ return wpuf_enhanced_select_params.i18n_searching;
10
+ },
11
+ inputTooLong: function( args ) {
12
+ var overChars = args.input.length - args.maximum;
13
+
14
+ if ( 1 === overChars ) {
15
+ return wpuf_enhanced_select_params.i18n_input_too_long_1;
16
+ }
17
+
18
+ return wpuf_enhanced_select_params.i18n_input_too_long_n.replace( '%qty%', overChars );
19
+ },
20
+ inputTooShort: function( args ) {
21
+ var remainingChars = args.minimum - args.input.length;
22
+
23
+ if ( 1 === remainingChars ) {
24
+ return wpuf_enhanced_select_params.i18n_input_too_short_1;
25
+ }
26
+
27
+ return wpuf_enhanced_select_params.i18n_input_too_short_n.replace( '%qty%', remainingChars );
28
+ },
29
+ loadingMore: function() {
30
+ return wpuf_enhanced_select_params.i18n_load_more;
31
+ },
32
+ maximumSelected: function( args ) {
33
+ if ( args.maximum === 1 ) {
34
+ return wpuf_enhanced_select_params.i18n_selection_too_long_1;
35
+ }
36
+
37
+ return wpuf_enhanced_select_params.i18n_selection_too_long_n.replace( '%qty%', args.maximum );
38
+ },
39
+ noResults: function() {
40
+ return wpuf_enhanced_select_params.i18n_no_matches;
41
+ },
42
+ searching: function() {
43
+ return wpuf_enhanced_select_params.i18n_searching;
44
+ }
45
+ }
46
+ };
47
+ }
48
+
49
+ try {
50
+ $( document.body )
51
+
52
+ .on( 'wpuf-enhanced-select-init', function() {
53
+
54
+ // Regular select boxes
55
+ $( ':input.wpuf-enhanced-select, :input.chosen_select' ).filter( ':not(.enhanced)' ).each( function() {
56
+ var select2_args = $.extend({
57
+ minimumResultsForSearch: 10,
58
+ allowpuflear: $( this ).data( 'allow_clear' ) ? true : false,
59
+ placeholder: $( this ).data( 'placeholder' )
60
+ }, getEnhancedSelectFormatString() );
61
+
62
+ $( this ).selectWoo( select2_args ).addClass( 'enhanced' );
63
+ });
64
+
65
+ $( ':input.wpuf-enhanced-select-nostd, :input.chosen_select_nostd' ).filter( ':not(.enhanced)' ).each( function() {
66
+ var select2_args = $.extend({
67
+ minimumResultsForSearch: 10,
68
+ allowpuflear: true,
69
+ placeholder: $( this ).data( 'placeholder' )
70
+ }, getEnhancedSelectFormatString() );
71
+
72
+ $( this ).selectWoo( select2_args ).addClass( 'enhanced' );
73
+ });
74
+
75
+ // Ajax product search box
76
+ $( ':input.wpuf-product-search' ).filter( ':not(.enhanced)' ).each( function() {
77
+ var select2_args = {
78
+ allowpuflear: $( this ).data( 'allow_clear' ) ? true : false,
79
+ placeholder: $( this ).data( 'placeholder' ),
80
+ minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '3',
81
+ escapeMarkup: function( m ) {
82
+ return m;
83
+ },
84
+ ajax: {
85
+ url: wpuf_enhanced_select_params.ajax_url,
86
+ dataType: 'json',
87
+ delay: 250,
88
+ data: function( params ) {
89
+ return {
90
+ term: params.term,
91
+ action: $( this ).data( 'action' ) || 'woocommerce_json_search_products_and_variations',
92
+ security: wpuf_enhanced_select_params.search_products_nonce,
93
+ exclude: $( this ).data( 'exclude' ),
94
+ include: $( this ).data( 'include' ),
95
+ limit: $( this ).data( 'limit' )
96
+ };
97
+ },
98
+ processResults: function( data ) {
99
+ var terms = [];
100
+ if ( data ) {
101
+ $.each( data, function( id, text ) {
102
+ terms.push( { id: id, text: text } );
103
+ });
104
+ }
105
+ return {
106
+ results: terms
107
+ };
108
+ },
109
+ cache: true
110
+ }
111
+ };
112
+
113
+ select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
114
+
115
+ $( this ).selectWoo( select2_args ).addClass( 'enhanced' );
116
+
117
+ if ( $( this ).data( 'sortable' ) ) {
118
+ var $select = $(this);
119
+ var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
120
+
121
+ $list.sortable({
122
+ placeholder : 'ui-state-highlight select2-selection__choice',
123
+ forcePlaceholderSize: true,
124
+ items : 'li:not(.select2-search__field)',
125
+ tolerance : 'pointer',
126
+ stop: function() {
127
+ $( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
128
+ var id = $( this ).data( 'data' ).id;
129
+ var option = $select.find( 'option[value="' + id + '"]' )[0];
130
+ $select.prepend( option );
131
+ } );
132
+ }
133
+ });
134
+ // Keep multiselects ordered alphabetically if they are not sortable.
135
+ } else if ( $( this ).prop( 'multiple' ) ) {
136
+ $( this ).on( 'change', function(){
137
+ var $children = $( this ).children();
138
+ $children.sort(function(a, b){
139
+ var atext = a.text.toLowerCase();
140
+ var btext = b.text.toLowerCase();
141
+
142
+ if ( atext > btext ) {
143
+ return 1;
144
+ }
145
+ if ( atext < btext ) {
146
+ return -1;
147
+ }
148
+ return 0;
149
+ });
150
+ $( this ).html( $children );
151
+ });
152
+ }
153
+ });
154
+
155
+ // Ajax customer search boxes
156
+ $( ':input.wpuf-customer-search' ).filter( ':not(.enhanced)' ).each( function() {
157
+ var select2_args = {
158
+ allowpuflear: $( this ).data( 'allow_clear' ) ? true : false,
159
+ placeholder: $( this ).data( 'placeholder' ),
160
+ minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : '1',
161
+ escapeMarkup: function( m ) {
162
+ return m;
163
+ },
164
+ ajax: {
165
+ url: wpuf_enhanced_select_params.ajax_url,
166
+ dataType: 'json',
167
+ delay: 1000,
168
+ data: function( params ) {
169
+ return {
170
+ term: params.term,
171
+ action: 'woocommerce_json_search_customers',
172
+ security: wpuf_enhanced_select_params.search_customers_nonce,
173
+ exclude: $( this ).data( 'exclude' )
174
+ };
175
+ },
176
+ processResults: function( data ) {
177
+ var terms = [];
178
+ if ( data ) {
179
+ $.each( data, function( id, text ) {
180
+ terms.push({
181
+ id: id,
182
+ text: text
183
+ });
184
+ });
185
+ }
186
+ return {
187
+ results: terms
188
+ };
189
+ },
190
+ cache: true
191
+ }
192
+ };
193
+
194
+ select2_args = $.extend( select2_args, getEnhancedSelectFormatString() );
195
+
196
+ $( this ).selectWoo( select2_args ).addClass( 'enhanced' );
197
+
198
+ if ( $( this ).data( 'sortable' ) ) {
199
+ var $select = $(this);
200
+ var $list = $( this ).next( '.select2-container' ).find( 'ul.select2-selection__rendered' );
201
+
202
+ $list.sortable({
203
+ placeholder : 'ui-state-highlight select2-selection__choice',
204
+ forcePlaceholderSize: true,
205
+ items : 'li:not(.select2-search__field)',
206
+ tolerance : 'pointer',
207
+ stop: function() {
208
+ $( $list.find( '.select2-selection__choice' ).get().reverse() ).each( function() {
209
+ var id = $( this ).data( 'data' ).id;
210
+ var option = $select.find( 'option[value="' + id + '"]' )[0];
211
+ $select.prepend( option );
212
+ } );
213
+ }
214
+ });
215
+ }
216
+ });
217
+
218
+ // Ajax category search boxes
219
+ $( ':input.wpuf-category-search' ).filter( ':not(.enhanced)' ).each( function() {
220
+ var select2_args = $.extend( {
221
+ allowpuflear : $( this ).data( 'allow_clear' ) ? true : false,
222
+ placeholder : $( this ).data( 'placeholder' ),
223
+ minimumInputLength: $( this ).data( 'minimum_input_length' ) ? $( this ).data( 'minimum_input_length' ) : 3,
224
+ escapeMarkup : function( m ) {
225
+ return m;
226
+ },
227
+ ajax: {
228
+ url: wpuf_enhanced_select_params.ajax_url,
229
+ dataType: 'json',
230
+ delay: 250,
231
+ data: function( params ) {
232
+ return {
233
+ term: params.term,
234
+ action: 'woocommerce_json_search_categories',
235
+ security: wpuf_enhanced_select_params.search_categories_nonce
236
+ };
237
+ },
238
+ processResults: function( data ) {
239
+ var terms = [];
240
+ if ( data ) {
241
+ $.each( data, function( id, term ) {
242
+ terms.push({
243
+ id: term.slug,
244
+ text: term.formatted_name
245
+ });
246
+ });
247
+ }
248
+ return {
249
+ results: terms
250
+ };
251
+ },
252
+ cache: true
253
+ }
254
+ }, getEnhancedSelectFormatString() );
255
+
256
+ $( this ).selectWoo( select2_args ).addClass( 'enhanced' );
257
+ });
258
+ })
259
+
260
+ // WooCommerce Backbone Modal
261
+ .on( 'wpuf_backbone_modal_before_remove', function() {
262
+ $( '.wpuf-enhanced-select, :input.wpuf-product-search, :input.wpuf-customer-search' ).filter( '.select2-hidden-accessible' ).selectWoo( 'close' );
263
+ })
264
+
265
+ .trigger( 'wpuf-enhanced-select-init' );
266
+
267
+ $( 'html' ).on( 'click', function( event ) {
268
+ if ( this === event.target ) {
269
+ $( '.wpuf-enhanced-select, :input.wpuf-product-search, :input.wpuf-customer-search' ).filter( '.select2-hidden-accessible' ).selectWoo( 'close' );
270
+ }
271
+ } );
272
+ } catch( err ) {
273
+ // If select2 failed (conflict?) log the error but don't stop other scripts breaking.
274
+ window.console.log( err );
275
+ }
276
+ });
assets/js/admin/wpuf-enhanced-select.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(e){function t(){return{language:{errorLoading:function(){return wpuf_enhanced_select_params.i18n_searching},inputTooLong:function(e){var t=e.input.length-e.maximum;return 1===t?wpuf_enhanced_select_params.i18n_input_too_long_1:wpuf_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",t)},inputTooShort:function(e){var t=e.minimum-e.input.length;return 1===t?wpuf_enhanced_select_params.i18n_input_too_short_1:wpuf_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",t)},loadingMore:function(){return wpuf_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wpuf_enhanced_select_params.i18n_selection_too_long_1:wpuf_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wpuf_enhanced_select_params.i18n_no_matches},searching:function(){return wpuf_enhanced_select_params.i18n_searching}}}}try{e(document.body).on("wpuf-enhanced-select-init",function(){e(":input.wpuf-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var n=e.extend({minimumResultsForSearch:10,allowpuflear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder")},t());e(this).selectWoo(n).addClass("enhanced")}),e(":input.wpuf-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var n=e.extend({minimumResultsForSearch:10,allowpuflear:!0,placeholder:e(this).data("placeholder")},t());e(this).selectWoo(n).addClass("enhanced")}),e(":input.wpuf-product-search").filter(":not(.enhanced)").each(function(){var n={allowpuflear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder"),minimumInputLength:e(this).data("minimum_input_length")?e(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:wpuf_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(t){return{term:t.term,action:e(this).data("action")||"woocommerce_json_search_products_and_variations",security:wpuf_enhanced_select_params.search_products_nonce,exclude:e(this).data("exclude"),include:e(this).data("include"),limit:e(this).data("limit")}},processResults:function(t){var n=[];return t&&e.each(t,function(e,t){n.push({id:e,text:t})}),{results:n}},cache:!0}};if(n=e.extend(n,t()),e(this).selectWoo(n).addClass("enhanced"),e(this).data("sortable")){var a=e(this),c=e(this).next(".select2-container").find("ul.select2-selection__rendered");c.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){e(c.find(".select2-selection__choice").get().reverse()).each(function(){var t=e(this).data("data").id,n=a.find('option[value="'+t+'"]')[0];a.prepend(n)})}})}else e(this).prop("multiple")&&e(this).on("change",function(){var t=e(this).children();t.sort(function(e,t){var n=e.text.toLowerCase(),a=t.text.toLowerCase();return n>a?1:n<a?-1:0}),e(this).html(t)})}),e(":input.wpuf-customer-search").filter(":not(.enhanced)").each(function(){var n={allowpuflear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder"),minimumInputLength:e(this).data("minimum_input_length")?e(this).data("minimum_input_length"):"1",escapeMarkup:function(e){return e},ajax:{url:wpuf_enhanced_select_params.ajax_url,dataType:"json",delay:1e3,data:function(t){return{term:t.term,action:"woocommerce_json_search_customers",security:wpuf_enhanced_select_params.search_customers_nonce,exclude:e(this).data("exclude")}},processResults:function(t){var n=[];return t&&e.each(t,function(e,t){n.push({id:e,text:t})}),{results:n}},cache:!0}};if(n=e.extend(n,t()),e(this).selectWoo(n).addClass("enhanced"),e(this).data("sortable")){var a=e(this),c=e(this).next(".select2-container").find("ul.select2-selection__rendered");c.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){e(c.find(".select2-selection__choice").get().reverse()).each(function(){var t=e(this).data("data").id,n=a.find('option[value="'+t+'"]')[0];a.prepend(n)})}})}}),e(":input.wpuf-category-search").filter(":not(.enhanced)").each(function(){var n=e.extend({allowpuflear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder"),minimumInputLength:e(this).data("minimum_input_length")?e(this).data("minimum_input_length"):3,escapeMarkup:function(e){return e},ajax:{url:wpuf_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(e){return{term:e.term,action:"woocommerce_json_search_categories",security:wpuf_enhanced_select_params.search_categories_nonce}},processResults:function(t){var n=[];return t&&e.each(t,function(e,t){n.push({id:t.slug,text:t.formatted_name})}),{results:n}},cache:!0}},t());e(this).selectWoo(n).addClass("enhanced")})}).on("wpuf_backbone_modal_before_remove",function(){e(".wpuf-enhanced-select, :input.wpuf-product-search, :input.wpuf-customer-search").filter(".select2-hidden-accessible").selectWoo("close")}).trigger("wpuf-enhanced-select-init"),e("html").on("click",function(t){this===t.target&&e(".wpuf-enhanced-select, :input.wpuf-product-search, :input.wpuf-customer-search").filter(".select2-hidden-accessible").selectWoo("close")})}catch(n){window.console.log(n)}});
assets/js/admin/wpuf-setup.js ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*global wpuf_setup_params */
2
+ /*global wpuf_setup_currencies */
3
+ jQuery( function( $ ) {
4
+ function blockWizardUI() {
5
+ $('.wpuf-setup-content').block({
6
+ message: null,
7
+ overlayCSS: {
8
+ background: '#fff',
9
+ opacity: 0.6
10
+ }
11
+ });
12
+ }
13
+
14
+ $( '.button-next' ).on( 'click', function() {
15
+ var form = $( this ).parents( 'form' ).get( 0 );
16
+
17
+ if ( ( 'function' !== typeof form.checkValidity ) || form.checkValidity() ) {
18
+ blockWizardUI();
19
+ }
20
+
21
+ return true;
22
+ } );
23
+
24
+ $( '.wpuf-wizard-services' ).on( 'change', '.wpuf-wizard-service-enable input', function() {
25
+ if ( $( this ).is( ':checked' ) ) {
26
+ $( this ).closest( '.wpuf-wizard-service-toggle' ).removeClass( 'disabled' );
27
+ $( this ).closest( '.wpuf-wizard-service-item' ).addClass( 'checked' );
28
+ $( this ).closest( '.wpuf-wizard-service-item' )
29
+ .find( '.wpuf-wizard-service-settings' ).removeClass( 'hide' );
30
+ } else {
31
+ $( this ).closest( '.wpuf-wizard-service-toggle' ).addClass( 'disabled' );
32
+ $( this ).closest( '.wpuf-wizard-service-item' ).removeClass( 'checked' );
33
+ $( this ).closest( '.wpuf-wizard-service-item' )
34
+ .find( '.wpuf-wizard-service-settings' ).addClass( 'hide' );
35
+ }
36
+ } );
37
+
38
+ $( '.wpuf-wizard-services' ).on( 'click', '.wpuf-wizard-service-enable', function( e ) {
39
+ var eventTarget = $( e.target );
40
+
41
+ if ( eventTarget.is( 'input' ) ) {
42
+ e.stopPropagation();
43
+ return;
44
+ }
45
+
46
+ var $checkbox = $( this ).find( 'input[type="checkbox"]' );
47
+
48
+ $checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).change();
49
+ } );
50
+
51
+ $( '.wpuf-wizard-services-list-toggle' ).on( 'change', '.wpuf-wizard-service-enable input', function() {
52
+ $( this ).closest( '.wpuf-wizard-services-list-toggle' ).toggleClass( 'closed' );
53
+ $( this ).closest( '.wpuf-wizard-services' ).find( '.wpuf-wizard-service-item' )
54
+ .slideToggle()
55
+ .css( 'display', 'flex' );
56
+ } );
57
+
58
+ $( '.wpuf-wizard-services' ).on( 'change', '.wpuf-wizard-shipping-method-select .method', function( e ) {
59
+ var zone = $( this ).closest( '.wpuf-wizard-service-description' );
60
+ var selectedMethod = e.target.value;
61
+
62
+ var description = zone.find( '.shipping-method-descriptions' );
63
+ description.find( '.shipping-method-description' ).addClass( 'hide' );
64
+ description.find( '.' + selectedMethod ).removeClass( 'hide' );
65
+
66
+ var settings = zone.find( '.shipping-method-settings' );
67
+ settings
68
+ .find( '.shipping-method-setting' )
69
+ .addClass( 'hide' )
70
+ .find( '.shipping-method-required-field' )
71
+ .prop( 'required', false );
72
+ settings
73
+ .find( '.' + selectedMethod )
74
+ .removeClass( 'hide' )
75
+ .find( '.shipping-method-required-field' )
76
+ .prop( 'required', true );
77
+ } );
78
+
79
+ $( '.wpuf-wizard-services' ).on( 'change', '.wpuf-wizard-shipping-method-enable', function() {
80
+ var checked = $( this ).is( ':checked' );
81
+
82
+ $( this )
83
+ .closest( '.wpuf-wizard-service-item' )
84
+ .find( '.shipping-method-required-field' )
85
+ .prop( 'required', checked );
86
+ } );
87
+
88
+ function submitActivateForm() {
89
+ $( 'form.activate-jetpack' ).submit();
90
+ }
91
+
92
+ function waitForJetpackInstall() {
93
+ wp.ajax.post( 'setup_wizard_check_jetpack' )
94
+ .then( function( result ) {
95
+ // If we receive success, or an unexpected result
96
+ // let the form submit.
97
+ if (
98
+ ! result ||
99
+ ! result.is_active ||
100
+ 'yes' === result.is_active
101
+ ) {
102
+ return submitActivateForm();
103
+ }
104
+
105
+ // Wait until checking the status again
106
+ setTimeout( waitForJetpackInstall, 3000 );
107
+ } )
108
+ .fail( function() {
109
+ // Submit the form as normal if the request fails
110
+ submitActivateForm();
111
+ } );
112
+ }
113
+
114
+ // Wait for a pending Jetpack install to finish before triggering a "save"
115
+ // on the activate step, which launches the Jetpack connection flow.
116
+ $( '.activate-jetpack' ).on( 'click', '.button-primary', function( e ) {
117
+ blockWizardUI();
118
+
119
+ if ( 'no' === wpuf_setup_params.pending_jetpack_install ) {
120
+ return true;
121
+ }
122
+
123
+ e.preventDefault();
124
+ waitForJetpackInstall();
125
+ } );
126
+
127
+ $( '.wpuf-wizard-services' ).on( 'change', 'input#stripe_create_account', function() {
128
+ if ( $( this ).is( ':checked' ) ) {
129
+ $( this ).closest( '.wpuf-wizard-service-settings' )
130
+ .find( 'input.payment-email-input' )
131
+ .prop( 'required', true );
132
+ $( this ).closest( '.wpuf-wizard-service-settings' )
133
+ .find( '.wpuf-wizard-service-setting-stripe_email' )
134
+ .show();
135
+ } else {
136
+ $( this ).closest( '.wpuf-wizard-service-settings' )
137
+ .find( 'input.payment-email-input' )
138
+ .prop( 'required', false );
139
+ $( this ).closest( '.wpuf-wizard-service-settings' )
140
+ .find( '.wpuf-wizard-service-setting-stripe_email' )
141
+ .hide();
142
+ }
143
+ } );
144
+
145
+ $( '.wpuf-wizard-services input#stripe_create_account' ).change();
146
+
147
+ $( 'select#store_country_state' ).on( 'change', function() {
148
+ var countryCode = this.value.split( ':' )[ 0 ];
149
+ $( 'select#currency_code' ).val( wpuf_setup_currencies[ countryCode ] ).change();
150
+ } );
151
+ } );
assets/js/admin/wpuf-setup.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(e){function i(){e(".wpuf-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function s(){e("form.activate-jetpack").submit()}function t(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return s();setTimeout(t,3e3)}).fail(function(){s()})}e(".button-next").on("click",function(){var s=e(this).parents("form").get(0);return("function"!=typeof s.checkValidity||s.checkValidity())&&i(),!0}),e(".wpuf-wizard-services").on("change",".wpuf-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wpuf-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wpuf-wizard-service-item").addClass("checked"),e(this).closest(".wpuf-wizard-service-item").find(".wpuf-wizard-service-settings").removeClass("hide")):(e(this).closest(".wpuf-wizard-service-toggle").addClass("disabled"),e(this).closest(".wpuf-wizard-service-item").removeClass("checked"),e(this).closest(".wpuf-wizard-service-item").find(".wpuf-wizard-service-settings").addClass("hide"))}),e(".wpuf-wizard-services").on("click",".wpuf-wizard-service-enable",function(i){if(e(i.target).is("input"))i.stopPropagation();else{var s=e(this).find('input[type="checkbox"]');s.prop("checked",!s.prop("checked")).change()}}),e(".wpuf-wizard-services-list-toggle").on("change",".wpuf-wizard-service-enable input",function(){e(this).closest(".wpuf-wizard-services-list-toggle").toggleClass("closed"),e(this).closest(".wpuf-wizard-services").find(".wpuf-wizard-service-item").slideToggle().css("display","flex")}),e(".wpuf-wizard-services").on("change",".wpuf-wizard-shipping-method-select .method",function(i){var s=e(this).closest(".wpuf-wizard-service-description"),t=i.target.value,c=s.find(".shipping-method-descriptions");c.find(".shipping-method-description").addClass("hide"),c.find("."+t).removeClass("hide");var r=s.find(".shipping-method-settings");r.find(".shipping-method-setting").addClass("hide").find(".shipping-method-required-field").prop("required",!1),r.find("."+t).removeClass("hide").find(".shipping-method-required-field").prop("required",!0)}),e(".wpuf-wizard-services").on("change",".wpuf-wizard-shipping-method-enable",function(){var i=e(this).is(":checked");e(this).closest(".wpuf-wizard-service-item").find(".shipping-method-required-field").prop("required",i)}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wpuf_setup_params.pending_jetpack_install)return!0;e.preventDefault(),t()}),e(".wpuf-wizard-services").on("change","input#stripe_create_account",function(){e(this).is(":checked")?(e(this).closest(".wpuf-wizard-service-settings").find("input.payment-email-input").prop("required",!0),e(this).closest(".wpuf-wizard-service-settings").find(".wpuf-wizard-service-setting-stripe_email").show()):(e(this).closest(".wpuf-wizard-service-settings").find("input.payment-email-input").prop("required",!1),e(this).closest(".wpuf-wizard-service-settings").find(".wpuf-wizard-service-setting-stripe_email").hide())}),e(".wpuf-wizard-services input#stripe_create_account").change(),e("select#store_country_state").on("change",function(){var i=this.value.split(":")[0];e("select#currency_code").val(wpuf_setup_currencies[i]).change()})});
assets/js/jquery-blockui/jquery.blockUI.js ADDED
@@ -0,0 +1,619 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery blockUI plugin
3
+ * Version 2.70.0-2014.11.23
4
+ * Requires jQuery v1.7 or later
5
+ *
6
+ * Examples at: http://malsup.com/jquery/block/
7
+ * Copyright (c) 2007-2013 M. Alsup
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
+ */
14
+ ;(function() {
15
+ /*jshint eqeqeq:false curly:false latedef:false */
16
+ "use strict";
17
+
18
+ function setup($) {
19
+ $.fn._fadeIn = $.fn.fadeIn;
20
+
21
+ var noOp = $.noop || function() {};
22
+
23
+ // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
24
+ // confusing userAgent strings on Vista)
25
+ var msie = /MSIE/.test(navigator.userAgent);
26
+ var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
27
+ var mode = document.documentMode || 0;
28
+ var setExpr = $.isFunction( document.createElement('div').style.setExpression );
29
+
30
+ // global $ methods for blocking/unblocking the entire page
31
+ $.blockUI = function(opts) { install(window, opts); };
32
+ $.unblockUI = function(opts) { remove(window, opts); };
33
+
34
+ // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
35
+ $.growlUI = function(title, message, timeout, onClose) {
36
+ var $m = $('<div class="growlUI"></div>');
37
+ if (title) $m.append('<h1>'+title+'</h1>');
38
+ if (message) $m.append('<h2>'+message+'</h2>');
39
+ if (timeout === undefined) timeout = 3000;
40
+
41
+ // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
42
+ var callBlock = function(opts) {
43
+ opts = opts || {};
44
+
45
+ $.blockUI({
46
+ message: $m,
47
+ fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
48
+ fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
49
+ timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
50
+ centerY: false,
51
+ showOverlay: false,
52
+ onUnblock: onClose,
53
+ css: $.blockUI.defaults.growlCSS
54
+ });
55
+ };
56
+
57
+ callBlock();
58
+ var nonmousedOpacity = $m.css('opacity');
59
+ $m.mouseover(function() {
60
+ callBlock({
61
+ fadeIn: 0,
62
+ timeout: 30000
63
+ });
64
+
65
+ var displayBlock = $('.blockMsg');
66
+ displayBlock.stop(); // cancel fadeout if it has started
67
+ displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
68
+ }).mouseout(function() {
69
+ $('.blockMsg').fadeOut(1000);
70
+ });
71
+ // End konapun additions
72
+ };
73
+
74
+ // plugin method for blocking element content
75
+ $.fn.block = function(opts) {
76
+ if ( this[0] === window ) {
77
+ $.blockUI( opts );
78
+ return this;
79
+ }
80
+ var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
81
+ this.each(function() {
82
+ var $el = $(this);
83
+ if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
84
+ return;
85
+ $el.unblock({ fadeOut: 0 });
86
+ });
87
+
88
+ return this.each(function() {
89
+ if ($.css(this,'position') == 'static') {
90
+ this.style.position = 'relative';
91
+ $(this).data('blockUI.static', true);
92
+ }
93
+ this.style.zoom = 1; // force 'hasLayout' in ie
94
+ install(this, opts);
95
+ });
96
+ };
97
+
98
+ // plugin method for unblocking element content
99
+ $.fn.unblock = function(opts) {
100
+ if ( this[0] === window ) {
101
+ $.unblockUI( opts );
102
+ return this;
103
+ }
104
+ return this.each(function() {
105
+ remove(this, opts);
106
+ });
107
+ };
108
+
109
+ $.blockUI.version = 2.70; // 2nd generation blocking at no extra cost!
110
+
111
+ // override these in your code to change the default behavior and style
112
+ $.blockUI.defaults = {
113
+ // message displayed when blocking (use null for no message)
114
+ message: '<h1>Please wait...</h1>',
115
+
116
+ title: null, // title string; only used when theme == true
117
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
118
+
119
+ theme: false, // set to true to use with jQuery UI themes
120
+
121
+ // styles for the message when blocking; if you wish to disable
122
+ // these and use an external stylesheet then do this in your code:
123
+ // $.blockUI.defaults.css = {};
124
+ css: {
125
+ padding: 0,
126
+ margin: 0,
127
+ width: '30%',
128
+ top: '40%',
129
+ left: '35%',
130
+ textAlign: 'center',
131
+ color: '#000',
132
+ border: '3px solid #aaa',
133
+ backgroundColor:'#fff',
134
+ cursor: 'wait'
135
+ },
136
+
137
+ // minimal style set used when themes are used
138
+ themedCSS: {
139
+ width: '30%',
140
+ top: '40%',
141
+ left: '35%'
142
+ },
143
+
144
+ // styles for the overlay
145
+ overlayCSS: {
146
+ backgroundColor: '#000',
147
+ opacity: 0.6,
148
+ cursor: 'wait'
149
+ },
150
+
151
+ // style to replace wait cursor before unblocking to correct issue
152
+ // of lingering wait cursor
153
+ cursorReset: 'default',
154
+
155
+ // styles applied when using $.growlUI
156
+ growlCSS: {
157
+ width: '350px',
158
+ top: '10px',
159
+ left: '',
160
+ right: '10px',
161
+ border: 'none',
162
+ padding: '5px',
163
+ opacity: 0.6,
164
+ cursor: 'default',
165
+ color: '#fff',
166
+ backgroundColor: '#000',
167
+ '-webkit-border-radius':'10px',
168
+ '-moz-border-radius': '10px',
169
+ 'border-radius': '10px'
170
+ },
171
+
172
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
173
+ // (hat tip to Jorge H. N. de Vasconcelos)
174
+ /*jshint scripturl:true */
175
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
176
+
177
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
178
+ forceIframe: false,
179
+
180
+ // z-index for the blocking overlay
181
+ baseZ: 1000,
182
+
183
+ // set these to true to have the message automatically centered
184
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
185
+ centerY: true,
186
+
187
+ // allow body element to be stetched in ie6; this makes blocking look better
188
+ // on "short" pages. disable if you wish to prevent changes to the body height
189
+ allowBodyStretch: true,
190
+
191
+ // enable if you want key and mouse events to be disabled for content that is blocked
192
+ bindEvents: true,
193
+
194
+ // be default blockUI will supress tab navigation from leaving blocking content
195
+ // (if bindEvents is true)
196
+ constrainTabKey: true,
197
+
198
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
199
+ fadeIn: 200,
200
+
201
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
202
+ fadeOut: 400,
203
+
204
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
205
+ timeout: 0,
206
+
207
+ // disable if you don't want to show the overlay
208
+ showOverlay: true,
209
+
210
+ // if true, focus will be placed in the first available input field when
211
+ // page blocking
212
+ focusInput: true,
213
+
214
+ // elements that can receive focus
215
+ focusableElements: ':input:enabled:visible',
216
+
217
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
218
+ // no longer needed in 2012
219
+ // applyPlatformOpacityRules: true,
220
+
221
+ // callback method invoked when fadeIn has completed and blocking message is visible
222
+ onBlock: null,
223
+
224
+ // callback method invoked when unblocking has completed; the callback is
225
+ // passed the element that has been unblocked (which is the window object for page
226
+ // blocks) and the options that were passed to the unblock call:
227
+ // onUnblock(element, options)
228
+ onUnblock: null,
229
+
230
+ // callback method invoked when the overlay area is clicked.
231
+ // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
232
+ onOverlayClick: null,
233
+
234
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
235
+ quirksmodeOffsetHack: 4,
236
+
237
+ // class name of the message block
238
+ blockMsgClass: 'blockMsg',
239
+
240
+ // if it is already blocked, then ignore it (don't unblock and reblock)
241
+ ignoreIfBlocked: false
242
+ };
243
+
244
+ // private data and functions follow...
245
+
246
+ var pageBlock = null;
247
+ var pageBlockEls = [];
248
+
249
+ function install(el, opts) {
250
+ var css, themedCSS;
251
+ var full = (el == window);
252
+ var msg = (opts && opts.message !== undefined ? opts.message : undefined);
253
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
254
+
255
+ if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
256
+ return;
257
+
258
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
259
+ css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
260
+ if (opts.onOverlayClick)
261
+ opts.overlayCSS.cursor = 'pointer';
262
+
263
+ themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
264
+ msg = msg === undefined ? opts.message : msg;
265
+
266
+ // remove the current block (if there is one)
267
+ if (full && pageBlock)
268
+ remove(window, {fadeOut:0});
269
+
270
+ // if an existing element is being used as the blocking content then we capture
271
+ // its current place in the DOM (and current display style) so we can restore
272
+ // it when we unblock
273
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
274
+ var node = msg.jquery ? msg[0] : msg;
275
+ var data = {};
276
+ $(el).data('blockUI.history', data);
277
+ data.el = node;
278
+ data.parent = node.parentNode;
279
+ data.display = node.style.display;
280
+ data.position = node.style.position;
281
+ if (data.parent)
282
+ data.parent.removeChild(node);
283
+ }
284
+
285
+ $(el).data('blockUI.onUnblock', opts.onUnblock);
286
+ var z = opts.baseZ;
287
+
288
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
289
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
290
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
291
+ // layer3 is the message content that is displayed while blocking
292
+ var lyr1, lyr2, lyr3, s;
293
+ if (msie || opts.forceIframe)
294
+ lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
295
+ else
296
+ lyr1 = $('<div class="blockUI" style="display:none"></div>');
297
+
298
+ if (opts.theme)
299
+ lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
300
+ else
301
+ lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
302
+
303
+ if (opts.theme && full) {
304
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
305
+ if ( opts.title ) {
306
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
307
+ }
308
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
309
+ s += '</div>';
310
+ }
311
+ else if (opts.theme) {
312
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
313
+ if ( opts.title ) {
314
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
315
+ }
316
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
317
+ s += '</div>';
318
+ }
319
+ else if (full) {
320
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
321
+ }
322
+ else {
323
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
324
+ }
325
+ lyr3 = $(s);
326
+
327
+ // if we have a message, style it
328
+ if (msg) {
329
+ if (opts.theme) {
330
+ lyr3.css(themedCSS);
331
+ lyr3.addClass('ui-widget-content');
332
+ }
333
+ else
334
+ lyr3.css(css);
335
+ }
336
+
337
+ // style the overlay
338
+ if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
339
+ lyr2.css(opts.overlayCSS);
340
+ lyr2.css('position', full ? 'fixed' : 'absolute');
341
+
342
+ // make iframe layer transparent in IE
343
+ if (msie || opts.forceIframe)
344
+ lyr1.css('opacity',0.0);
345
+
346
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
347
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
348
+ $.each(layers, function() {
349
+ this.appendTo($par);
350
+ });
351
+
352
+ if (opts.theme && opts.draggable && $.fn.draggable) {
353
+ lyr3.draggable({
354
+ handle: '.ui-dialog-titlebar',
355
+ cancel: 'li'
356
+ });
357
+ }
358
+
359
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
360
+ var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
361
+ if (ie6 || expr) {
362
+ // give body 100% height
363
+ if (full && opts.allowBodyStretch && $.support.boxModel)
364
+ $('html,body').css('height','100%');
365
+
366
+ // fix ie6 issue when blocked element has a border width
367
+ if ((ie6 || !$.support.boxModel) && !full) {
368
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
369
+ var fixT = t ? '(0 - '+t+')' : 0;
370
+ var fixL = l ? '(0 - '+l+')' : 0;
371
+ }
372
+
373
+ // simulate fixed position
374
+ $.each(layers, function(i,o) {
375
+ var s = o[0].style;
376
+ s.position = 'absolute';
377
+ if (i < 2) {
378
+ if (full)
379
+ s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
380
+ else
381
+ s.setExpression('height','this.parentNode.offsetHeight + "px"');
382
+ if (full)
383
+ s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
384
+ else
385
+ s.setExpression('width','this.parentNode.offsetWidth + "px"');
386
+ if (fixL) s.setExpression('left', fixL);
387
+ if (fixT) s.setExpression('top', fixT);
388
+ }
389
+ else if (opts.centerY) {
390
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
391
+ s.marginTop = 0;
392
+ }
393
+ else if (!opts.centerY && full) {
394
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
395
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
396
+ s.setExpression('top',expression);
397
+ }
398
+ });
399
+ }
400
+
401
+ // show the message
402
+ if (msg) {
403
+ if (opts.theme)
404
+ lyr3.find('.ui-widget-content').append(msg);
405
+ else
406
+ lyr3.append(msg);
407
+ if (msg.jquery || msg.nodeType)
408
+ $(msg).show();
409
+ }
410
+
411
+ if ((msie || opts.forceIframe) && opts.showOverlay)
412
+ lyr1.show(); // opacity is zero
413
+ if (opts.fadeIn) {
414
+ var cb = opts.onBlock ? opts.onBlock : noOp;
415
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
416
+ var cb2 = msg ? cb : noOp;
417
+ if (opts.showOverlay)
418
+ lyr2._fadeIn(opts.fadeIn, cb1);
419
+ if (msg)
420
+ lyr3._fadeIn(opts.fadeIn, cb2);
421
+ }
422
+ else {
423
+ if (opts.showOverlay)
424
+ lyr2.show();
425
+ if (msg)
426
+ lyr3.show();
427
+ if (opts.onBlock)
428
+ opts.onBlock.bind(lyr3)();
429
+ }
430
+
431
+ // bind key and mouse events
432
+ bind(1, el, opts);
433
+
434
+ if (full) {
435
+ pageBlock = lyr3[0];
436
+ pageBlockEls = $(opts.focusableElements,pageBlock);
437
+ if (opts.focusInput)
438
+ setTimeout(focus, 20);
439
+ }
440
+ else
441
+ center(lyr3[0], opts.centerX, opts.centerY);
442
+
443
+ if (opts.timeout) {
444
+ // auto-unblock
445
+ var to = setTimeout(function() {
446
+ if (full)
447
+ $.unblockUI(opts);
448
+ else
449
+ $(el).unblock(opts);
450
+ }, opts.timeout);
451
+ $(el).data('blockUI.timeout', to);
452
+ }
453
+ }
454
+
455
+ // remove the block
456
+ function remove(el, opts) {
457
+ var count;
458
+ var full = (el == window);
459
+ var $el = $(el);
460
+ var data = $el.data('blockUI.history');
461
+ var to = $el.data('blockUI.timeout');
462
+ if (to) {
463
+ clearTimeout(to);
464
+ $el.removeData('blockUI.timeout');
465
+ }
466
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
467
+ bind(0, el, opts); // unbind events
468
+
469
+ if (opts.onUnblock === null) {
470
+ opts.onUnblock = $el.data('blockUI.onUnblock');
471
+ $el.removeData('blockUI.onUnblock');
472
+ }
473
+
474
+ var els;
475
+ if (full) // crazy selector to handle odd field errors in ie6/7
476
+ els = $(document.body).children().filter('.blockUI').add('body > .blockUI');
477
+ else
478
+ els = $el.find('>.blockUI');
479
+
480
+ // fix cursor issue
481
+ if ( opts.cursorReset ) {
482
+ if ( els.length > 1 )
483
+ els[1].style.cursor = opts.cursorReset;
484
+ if ( els.length > 2 )
485
+ els[2].style.cursor = opts.cursorReset;
486
+ }
487
+
488
+ if (full)
489
+ pageBlock = pageBlockEls = null;
490
+
491
+ if (opts.fadeOut) {
492
+ count = els.length;
493
+ els.stop().fadeOut(opts.fadeOut, function() {
494
+ if ( --count === 0)
495
+ reset(els,data,opts,el);
496
+ });
497
+ }
498
+ else
499
+ reset(els, data, opts, el);
500
+ }
501
+
502
+ // move blocking element back into the DOM where it started
503
+ function reset(els,data,opts,el) {
504
+ var $el = $(el);
505
+ if ( $el.data('blockUI.isBlocked') )
506
+ return;
507
+
508
+ els.each(function(i,o) {
509
+ // remove via DOM calls so we don't lose event handlers
510
+ if (this.parentNode)
511
+ this.parentNode.removeChild(this);
512
+ });
513
+
514
+ if (data && data.el) {
515
+ data.el.style.display = data.display;
516
+ data.el.style.position = data.position;
517
+ data.el.style.cursor = 'default'; // #59
518
+ if (data.parent)
519
+ data.parent.appendChild(data.el);
520
+ $el.removeData('blockUI.history');
521
+ }
522
+
523
+ if ($el.data('blockUI.static')) {
524
+ $el.css('position', 'static'); // #22
525
+ }
526
+
527
+ if (typeof opts.onUnblock == 'function')
528
+ opts.onUnblock(el,opts);
529
+
530
+ // fix issue in Safari 6 where block artifacts remain until reflow
531
+ var body = $(document.body), w = body.width(), cssW = body[0].style.width;
532
+ body.width(w-1).width(w);
533
+ body[0].style.width = cssW;
534
+ }
535
+
536
+ // bind/unbind the handler
537
+ function bind(b, el, opts) {
538
+ var full = el == window, $el = $(el);
539
+
540
+ // don't bother unbinding if there is nothing to unbind
541
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
542
+ return;
543
+
544
+ $el.data('blockUI.isBlocked', b);
545
+
546
+ // don't bind events when overlay is not in use or if bindEvents is false
547
+ if (!full || !opts.bindEvents || (b && !opts.showOverlay))
548
+ return;
549
+
550
+ // bind anchors and inputs for mouse and key events
551
+ var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
552
+ if (b)
553
+ $(document).bind(events, opts, handler);
554
+ else
555
+ $(document).unbind(events, handler);
556
+
557
+ // former impl...
558
+ // var $e = $('a,:input');
559
+ // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
560
+ }
561
+
562
+ // event handler to suppress keyboard/mouse events when blocking
563
+ function handler(e) {
564
+ // allow tab navigation (conditionally)
565
+ if (e.type === 'keydown' && e.keyCode && e.keyCode == 9) {
566
+ if (pageBlock && e.data.constrainTabKey) {
567
+ var els = pageBlockEls;
568
+ var fwd = !e.shiftKey && e.target === els[els.length-1];
569
+ var back = e.shiftKey && e.target === els[0];
570
+ if (fwd || back) {
571
+ setTimeout(function(){focus(back);},10);
572
+ return false;
573
+ }
574
+ }
575
+ }
576
+ var opts = e.data;
577
+ var target = $(e.target);
578
+ if (target.hasClass('blockOverlay') && opts.onOverlayClick)
579
+ opts.onOverlayClick(e);
580
+
581
+ // allow events within the message content
582
+ if (target.parents('div.' + opts.blockMsgClass).length > 0)
583
+ return true;
584
+
585
+ // allow events for content that is not being blocked
586
+ return target.parents().children().filter('div.blockUI').length === 0;
587
+ }
588
+
589
+ function focus(back) {
590
+ if (!pageBlockEls)
591
+ return;
592
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
593
+ if (e)
594
+ e.focus();
595
+ }
596
+
597
+ function center(el, x, y) {
598
+ var p = el.parentNode, s = el.style;
599
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
600
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
601
+ if (x) s.left = l > 0 ? (l+'px') : '0';
602
+ if (y) s.top = t > 0 ? (t+'px') : '0';
603
+ }
604
+
605
+ function sz(el, p) {
606
+ return parseInt($.css(el,p),10)||0;
607
+ }
608
+
609
+ }
610
+
611
+
612
+ /*global define:true */
613
+ if (typeof define === 'function' && define.amd && define.amd.jQuery) {
614
+ define(['jquery'], setup);
615
+ } else {
616
+ setup(jQuery);
617
+ }
618
+
619
+ })();
assets/js/jquery-blockui/jquery.blockUI.min.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * jQuery blockUI plugin
3
+ * Version 2.70.0-2014.11.23
4
+ * Requires jQuery v1.7 or later
5
+ *
6
+ * Examples at: http://malsup.com/jquery/block/
7
+ * Copyright (c) 2007-2013 M. Alsup
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
+ */
14
+ !function(){"use strict";function e(e){function t(t,n){var s,h,k=t==window,y=n&&n.message!==undefined?n.message:undefined;if(!(n=e.extend({},e.blockUI.defaults,n||{})).ignoreIfBlocked||!e(t).data("blockUI.isBlocked")){if(n.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,n.overlayCSS||{}),s=e.extend({},e.blockUI.defaults.css,n.css||{}),n.onOverlayClick&&(n.overlayCSS.cursor="pointer"),h=e.extend({},e.blockUI.defaults.themedCSS,n.themedCSS||{}),y=y===undefined?n.message:y,k&&p&&o(window,{fadeOut:0}),y&&"string"!=typeof y&&(y.parentNode||y.jquery)){var m=y.jquery?y[0]:y,g={};e(t).data("blockUI.history",g),g.el=m,g.parent=m.parentNode,g.display=m.style.display,g.position=m.style.position,g.parent&&g.parent.removeChild(m)}e(t).data("blockUI.onUnblock",n.onUnblock);var v,I,w,U,x=n.baseZ;v=e(r||n.forceIframe?'<iframe class="blockUI" style="z-index:'+x+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+n.iframeSrc+'"></iframe>':'<div class="blockUI" style="display:none"></div>'),I=e(n.theme?'<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+x+++';display:none"></div>':'<div class="blockUI blockOverlay" style="z-index:'+x+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),n.theme&&k?(U='<div class="blockUI '+n.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(x+10)+';display:none;position:fixed">',n.title&&(U+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),U+='<div class="ui-widget-content ui-dialog-content"></div>',U+="</div>"):n.theme?(U='<div class="blockUI '+n.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(x+10)+';display:none;position:absolute">',n.title&&(U+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(n.title||"&nbsp;")+"</div>"),U+='<div class="ui-widget-content ui-dialog-content"></div>',U+="</div>"):U=k?'<div class="blockUI '+n.blockMsgClass+' blockPage" style="z-index:'+(x+10)+';display:none;position:fixed"></div>':'<div class="blockUI '+n.blockMsgClass+' blockElement" style="z-index:'+(x+10)+';display:none;position:absolute"></div>',w=e(U),y&&(n.theme?(w.css(h),w.addClass("ui-widget-content")):w.css(s)),n.theme||I.css(n.overlayCSS),I.css("position",k?"fixed":"absolute"),(r||n.forceIframe)&&v.css("opacity",0);var C=[v,I,w],S=e(k?"body":t);e.each(C,function(){this.appendTo(S)}),n.theme&&n.draggable&&e.fn.draggable&&w.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var O=f&&(!e.support.boxModel||e("object,embed",k?null:t).length>0);if(u||O){if(k&&n.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(u||!e.support.boxModel)&&!k)var E=a(t,"borderTopWidth"),T=a(t,"borderLeftWidth"),M=E?"(0 - "+E+")":0,B=T?"(0 - "+T+")":0;e.each(C,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)k?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+n.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),k?o.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),B&&o.setExpression("left",B),M&&o.setExpression("top",M);else if(n.centerY)k&&o.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),o.marginTop=0;else if(!n.centerY&&k){var i="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+(n.css&&n.css.top?parseInt(n.css.top,10):0)+') + "px"';o.setExpression("top",i)}})}if(y&&(n.theme?w.find(".ui-widget-content").append(y):w.append(y),(y.jquery||y.nodeType)&&e(y).show()),(r||n.forceIframe)&&n.showOverlay&&v.show(),n.fadeIn){var j=n.onBlock?n.onBlock:c,H=n.showOverlay&&!y?j:c,z=y?j:c;n.showOverlay&&I._fadeIn(n.fadeIn,H),y&&w._fadeIn(n.fadeIn,z)}else n.showOverlay&&I.show(),y&&w.show(),n.onBlock&&n.onBlock.bind(w)();if(i(1,t,n),k?(p=w[0],b=e(n.focusableElements,p),n.focusInput&&setTimeout(l,20)):d(w[0],n.centerX,n.centerY),n.timeout){var W=setTimeout(function(){k?e.unblockUI(n):e(t).unblock(n)},n.timeout);e(t).data("blockUI.timeout",W)}}}function o(t,o){var s,l=t==window,d=e(t),a=d.data("blockUI.history"),c=d.data("blockUI.timeout");c&&(clearTimeout(c),d.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),i(0,t,o),null===o.onUnblock&&(o.onUnblock=d.data("blockUI.onUnblock"),d.removeData("blockUI.onUnblock"));var r;r=l?e(document.body).children().filter(".blockUI").add("body > .blockUI"):d.find(">.blockUI"),o.cursorReset&&(r.length>1&&(r[1].style.cursor=o.cursorReset),r.length>2&&(r[2].style.cursor=o.cursorReset)),l&&(p=b=null),o.fadeOut?(s=r.length,r.stop().fadeOut(o.fadeOut,function(){0==--s&&n(r,a,o,t)})):n(r,a,o,t)}function n(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function i(t,o,n){var i=o==window,l=e(o);if((t||(!i||p)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).bind(d,n,s):e(document).unbind(d,s)}}function s(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&p&&t.data.constrainTabKey){var o=b,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){l(i)},10),!1}var s=t.data,d=e(t.target);return d.hasClass("blockOverlay")&&s.onOverlayClick&&s.onOverlayClick(t),d.parents("div."+s.blockMsgClass).length>0||0===d.parents().children().filter("div.blockUI").length}function l(e){if(b){var t=b[!0===e?b.length-1:0];t&&t.focus()}}function d(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-a(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-a(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0"),o&&(i.top=l>0?l+"px":"0")}function a(t,o){return parseInt(e.css(t,o),10)||0}e.fn._fadeIn=e.fn.fadeIn;var c=e.noop||function(){},r=/MSIE/.test(navigator.userAgent),u=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),f=(document.documentMode,e.isFunction(document.createElement("div").style.setExpression));e.blockUI=function(e){t(window,e)},e.unblockUI=function(e){o(window,e)},e.growlUI=function(t,o,n,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>"),o&&s.append("<h2>"+o+"</h2>"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.mouseover(function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).mouseout(function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(o){if(this[0]===window)return e.blockUI(o),this;var n=e.extend({},e.blockUI.defaults,o||{});return this.each(function(){var t=e(this);n.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,t(this,o)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){o(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var p=null,b=[]}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}();
assets/js/selectWPUF/selectWPUF.full.js ADDED
@@ -0,0 +1,6569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * SelectWoo 1.0.1
3
+ * https://github.com/woocommerce/selectWoo
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/woocommerce/selectWoo/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
+ // Determine whether the browser is on a touchscreen device.
776
+ Utils.isTouchscreen = function() {
777
+ if ('undefined' === typeof Utils._isTouchscreenCache) {
778
+ Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
779
+ }
780
+ return Utils._isTouchscreenCache;
781
+ }
782
+
783
+ return Utils;
784
+ });
785
+
786
+ S2.define('select2/results',[
787
+ 'jquery',
788
+ './utils'
789
+ ], function ($, Utils) {
790
+ function Results ($element, options, dataAdapter) {
791
+ this.$element = $element;
792
+ this.data = dataAdapter;
793
+ this.options = options;
794
+
795
+ Results.__super__.constructor.call(this);
796
+ }
797
+
798
+ Utils.Extend(Results, Utils.Observable);
799
+
800
+ Results.prototype.render = function () {
801
+ var $results = $(
802
+ '<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>'
803
+ );
804
+
805
+ if (this.options.get('multiple')) {
806
+ $results.attr('aria-multiselectable', 'true');
807
+ }
808
+
809
+ this.$results = $results;
810
+
811
+ return $results;
812
+ };
813
+
814
+ Results.prototype.clear = function () {
815
+ this.$results.empty();
816
+ };
817
+
818
+ Results.prototype.displayMessage = function (params) {
819
+ var escapeMarkup = this.options.get('escapeMarkup');
820
+
821
+ this.clear();
822
+ this.hideLoading();
823
+
824
+ var $message = $(
825
+ '<li role="alert" aria-live="assertive"' +
826
+ ' class="select2-results__option"></li>'
827
+ );
828
+
829
+ var message = this.options.get('translations').get(params.message);
830
+
831
+ $message.append(
832
+ escapeMarkup(
833
+ message(params.args)
834
+ )
835
+ );
836
+
837
+ $message[0].className += ' select2-results__message';
838
+
839
+ this.$results.append($message);
840
+ };
841
+
842
+ Results.prototype.hideMessages = function () {
843
+ this.$results.find('.select2-results__message').remove();
844
+ };
845
+
846
+ Results.prototype.append = function (data) {
847
+ this.hideLoading();
848
+
849
+ var $options = [];
850
+
851
+ if (data.results == null || data.results.length === 0) {
852
+ if (this.$results.children().length === 0) {
853
+ this.trigger('results:message', {
854
+ message: 'noResults'
855
+ });
856
+ }
857
+
858
+ return;
859
+ }
860
+
861
+ data.results = this.sort(data.results);
862
+
863
+ for (var d = 0; d < data.results.length; d++) {
864
+ var item = data.results[d];
865
+
866
+ var $option = this.option(item);
867
+
868
+ $options.push($option);
869
+ }
870
+
871
+ this.$results.append($options);
872
+ };
873
+
874
+ Results.prototype.position = function ($results, $dropdown) {
875
+ var $resultsContainer = $dropdown.find('.select2-results');
876
+ $resultsContainer.append($results);
877
+ };
878
+
879
+ Results.prototype.sort = function (data) {
880
+ var sorter = this.options.get('sorter');
881
+
882
+ return sorter(data);
883
+ };
884
+
885
+ Results.prototype.highlightFirstItem = function () {
886
+ var $options = this.$results
887
+ .find('.select2-results__option[data-selected]');
888
+
889
+ var $selected = $options.filter('[data-selected=true]');
890
+
891
+ // Check if there are any selected options
892
+ if ($selected.length > 0) {
893
+ // If there are selected options, highlight the first
894
+ $selected.first().trigger('mouseenter');
895
+ } else {
896
+ // If there are no selected options, highlight the first option
897
+ // in the dropdown
898
+ $options.first().trigger('mouseenter');
899
+ }
900
+
901
+ this.ensureHighlightVisible();
902
+ };
903
+
904
+ Results.prototype.setClasses = function () {
905
+ var self = this;
906
+
907
+ this.data.current(function (selected) {
908
+ var selectedIds = $.map(selected, function (s) {
909
+ return s.id.toString();
910
+ });
911
+
912
+ var $options = self.$results
913
+ .find('.select2-results__option[data-selected]');
914
+
915
+ $options.each(function () {
916
+ var $option = $(this);
917
+
918
+ var item = $.data(this, 'data');
919
+
920
+ // id needs to be converted to a string when comparing
921
+ var id = '' + item.id;
922
+
923
+ if ((item.element != null && item.element.selected) ||
924
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
925
+ $option.attr('data-selected', 'true');
926
+ } else {
927
+ $option.attr('data-selected', 'false');
928
+ }
929
+ });
930
+
931
+ });
932
+ };
933
+
934
+ Results.prototype.showLoading = function (params) {
935
+ this.hideLoading();
936
+
937
+ var loadingMore = this.options.get('translations').get('searching');
938
+
939
+ var loading = {
940
+ disabled: true,
941
+ loading: true,
942
+ text: loadingMore(params)
943
+ };
944
+ var $loading = this.option(loading);
945
+ $loading.className += ' loading-results';
946
+
947
+ this.$results.prepend($loading);
948
+ };
949
+
950
+ Results.prototype.hideLoading = function () {
951
+ this.$results.find('.loading-results').remove();
952
+ };
953
+
954
+ Results.prototype.option = function (data) {
955
+ var option = document.createElement('li');
956
+ option.className = 'select2-results__option';
957
+
958
+ var attrs = {
959
+ 'role': 'option',
960
+ 'data-selected': 'false',
961
+ 'tabindex': -1
962
+ };
963
+
964
+ if (data.disabled) {
965
+ delete attrs['data-selected'];
966
+ attrs['aria-disabled'] = 'true';
967
+ }
968
+
969
+ if (data.id == null) {
970
+ delete attrs['data-selected'];
971
+ }
972
+
973
+ if (data._resultId != null) {
974
+ option.id = data._resultId;
975
+ }
976
+
977
+ if (data.title) {
978
+ option.title = data.title;
979
+ }
980
+
981
+ if (data.children) {
982
+ attrs['aria-label'] = data.text;
983
+ delete attrs['data-selected'];
984
+ }
985
+
986
+ for (var attr in attrs) {
987
+ var val = attrs[attr];
988
+
989
+ option.setAttribute(attr, val);
990
+ }
991
+
992
+ if (data.children) {
993
+ var $option = $(option);
994
+
995
+ var label = document.createElement('strong');
996
+ label.className = 'select2-results__group';
997
+
998
+ var $label = $(label);
999
+ this.template(data, label);
1000
+ $label.attr('role', 'presentation');
1001
+
1002
+ var $children = [];
1003
+
1004
+ for (var c = 0; c < data.children.length; c++) {
1005
+ var child = data.children[c];
1006
+
1007
+ var $child = this.option(child);
1008
+
1009
+ $children.push($child);
1010
+ }
1011
+
1012
+ var $childrenContainer = $('<ul></ul>', {
1013
+ 'class': 'select2-results__options select2-results__options--nested',
1014
+ 'role': 'listbox'
1015
+ });
1016
+ $childrenContainer.append($children);
1017
+ $option.attr('role', 'list');
1018
+
1019
+ $option.append(label);
1020
+ $option.append($childrenContainer);
1021
+ } else {
1022
+ this.template(data, option);
1023
+ }
1024
+
1025
+ $.data(option, 'data', data);
1026
+
1027
+ return option;
1028
+ };
1029
+
1030
+ Results.prototype.bind = function (container, $container) {
1031
+ var self = this;
1032
+
1033
+ var id = container.id + '-results';
1034
+
1035
+ this.$results.attr('id', id);
1036
+
1037
+ container.on('results:all', function (params) {
1038
+ self.clear();
1039
+ self.append(params.data);
1040
+
1041
+ if (container.isOpen()) {
1042
+ self.setClasses();
1043
+ self.highlightFirstItem();
1044
+ }
1045
+ });
1046
+
1047
+ container.on('results:append', function (params) {
1048
+ self.append(params.data);
1049
+
1050
+ if (container.isOpen()) {
1051
+ self.setClasses();
1052
+ }
1053
+ });
1054
+
1055
+ container.on('query', function (params) {
1056
+ self.hideMessages();
1057
+ self.showLoading(params);
1058
+ });
1059
+
1060
+ container.on('select', function () {
1061
+ if (!container.isOpen()) {
1062
+ return;
1063
+ }
1064
+
1065
+ self.setClasses();
1066
+ self.highlightFirstItem();
1067
+ });
1068
+
1069
+ container.on('unselect', function () {
1070
+ if (!container.isOpen()) {
1071
+ return;
1072
+ }
1073
+
1074
+ self.setClasses();
1075
+ self.highlightFirstItem();
1076
+ });
1077
+
1078
+ container.on('open', function () {
1079
+ // When the dropdown is open, aria-expended="true"
1080
+ self.$results.attr('aria-expanded', 'true');
1081
+ self.$results.attr('aria-hidden', 'false');
1082
+
1083
+ self.setClasses();
1084
+ self.ensureHighlightVisible();
1085
+ });
1086
+
1087
+ container.on('close', function () {
1088
+ // When the dropdown is closed, aria-expended="false"
1089
+ self.$results.attr('aria-expanded', 'false');
1090
+ self.$results.attr('aria-hidden', 'true');
1091
+ self.$results.removeAttr('aria-activedescendant');
1092
+ });
1093
+
1094
+ container.on('results:toggle', function () {
1095
+ var $highlighted = self.getHighlightedResults();
1096
+
1097
+ if ($highlighted.length === 0) {
1098
+ return;
1099
+ }
1100
+
1101
+ $highlighted.trigger('mouseup');
1102
+ });
1103
+
1104
+ container.on('results:select', function () {
1105
+ var $highlighted = self.getHighlightedResults();
1106
+
1107
+ if ($highlighted.length === 0) {
1108
+ return;
1109
+ }
1110
+
1111
+ var data = $highlighted.data('data');
1112
+
1113
+ if ($highlighted.attr('data-selected') == 'true') {
1114
+ self.trigger('close', {});
1115
+ } else {
1116
+ self.trigger('select', {
1117
+ data: data
1118
+ });
1119
+ }
1120
+ });
1121
+
1122
+ container.on('results:previous', function () {
1123
+ var $highlighted = self.getHighlightedResults();
1124
+
1125
+ var $options = self.$results.find('[data-selected]');
1126
+
1127
+ var currentIndex = $options.index($highlighted);
1128
+
1129
+ // If we are already at te top, don't move further
1130
+ if (currentIndex === 0) {
1131
+ return;
1132
+ }
1133
+
1134
+ var nextIndex = currentIndex - 1;
1135
+
1136
+ // If none are highlighted, highlight the first
1137
+ if ($highlighted.length === 0) {
1138
+ nextIndex = 0;
1139
+ }
1140
+
1141
+ var $next = $options.eq(nextIndex);
1142
+
1143
+ $next.trigger('mouseenter');
1144
+
1145
+ var currentOffset = self.$results.offset().top;
1146
+ var nextTop = $next.offset().top;
1147
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1148
+
1149
+ if (nextIndex === 0) {
1150
+ self.$results.scrollTop(0);
1151
+ } else if (nextTop - currentOffset < 0) {
1152
+ self.$results.scrollTop(nextOffset);
1153
+ }
1154
+ });
1155
+
1156
+ container.on('results:next', function () {
1157
+ var $highlighted = self.getHighlightedResults();
1158
+
1159
+ var $options = self.$results.find('[data-selected]');
1160
+
1161
+ var currentIndex = $options.index($highlighted);
1162
+
1163
+ var nextIndex = currentIndex + 1;
1164
+
1165
+ // If we are at the last option, stay there
1166
+ if (nextIndex >= $options.length) {
1167
+ return;
1168
+ }
1169
+
1170
+ var $next = $options.eq(nextIndex);
1171
+
1172
+ $next.trigger('mouseenter');
1173
+
1174
+ var currentOffset = self.$results.offset().top +
1175
+ self.$results.outerHeight(false);
1176
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1177
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1178
+
1179
+ if (nextIndex === 0) {
1180
+ self.$results.scrollTop(0);
1181
+ } else if (nextBottom > currentOffset) {
1182
+ self.$results.scrollTop(nextOffset);
1183
+ }
1184
+ });
1185
+
1186
+ container.on('results:focus', function (params) {
1187
+ params.element.addClass('select2-results__option--highlighted').attr('aria-selected', 'true');
1188
+ self.$results.attr('aria-activedescendant', params.element.attr('id'));
1189
+ });
1190
+
1191
+ container.on('results:message', function (params) {
1192
+ self.displayMessage(params);
1193
+ });
1194
+
1195
+ if ($.fn.mousewheel) {
1196
+ this.$results.on('mousewheel', function (e) {
1197
+ var top = self.$results.scrollTop();
1198
+
1199
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1200
+
1201
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1202
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1203
+
1204
+ if (isAtTop) {
1205
+ self.$results.scrollTop(0);
1206
+
1207
+ e.preventDefault();
1208
+ e.stopPropagation();
1209
+ } else if (isAtBottom) {
1210
+ self.$results.scrollTop(
1211
+ self.$results.get(0).scrollHeight - self.$results.height()
1212
+ );
1213
+
1214
+ e.preventDefault();
1215
+ e.stopPropagation();
1216
+ }
1217
+ });
1218
+ }
1219
+
1220
+ this.$results.on('mouseup', '.select2-results__option[data-selected]',
1221
+ function (evt) {
1222
+ var $this = $(this);
1223
+
1224
+ var data = $this.data('data');
1225
+
1226
+ if ($this.attr('data-selected') === 'true') {
1227
+ if (self.options.get('multiple')) {
1228
+ self.trigger('unselect', {
1229
+ originalEvent: evt,
1230
+ data: data
1231
+ });
1232
+ } else {
1233
+ self.trigger('close', {});
1234
+ }
1235
+
1236
+ return;
1237
+ }
1238
+
1239
+ self.trigger('select', {
1240
+ originalEvent: evt,
1241
+ data: data
1242
+ });
1243
+ });
1244
+
1245
+ this.$results.on('mouseenter', '.select2-results__option[data-selected]',
1246
+ function (evt) {
1247
+ var data = $(this).data('data');
1248
+
1249
+ self.getHighlightedResults()
1250
+ .removeClass('select2-results__option--highlighted')
1251
+ .attr('aria-selected', 'false');
1252
+
1253
+ self.trigger('results:focus', {
1254
+ data: data,
1255
+ element: $(this)
1256
+ });
1257
+ });
1258
+ };
1259
+
1260
+ Results.prototype.getHighlightedResults = function () {
1261
+ var $highlighted = this.$results
1262
+ .find('.select2-results__option--highlighted');
1263
+
1264
+ return $highlighted;
1265
+ };
1266
+
1267
+ Results.prototype.destroy = function () {
1268
+ this.$results.remove();
1269
+ };
1270
+
1271
+ Results.prototype.ensureHighlightVisible = function () {
1272
+ var $highlighted = this.getHighlightedResults();
1273
+
1274
+ if ($highlighted.length === 0) {
1275
+ return;
1276
+ }
1277
+
1278
+ var $options = this.$results.find('[data-selected]');
1279
+
1280
+ var currentIndex = $options.index($highlighted);
1281
+
1282
+ var currentOffset = this.$results.offset().top;
1283
+ var nextTop = $highlighted.offset().top;
1284
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1285
+
1286
+ var offsetDelta = nextTop - currentOffset;
1287
+ nextOffset -= $highlighted.outerHeight(false) * 2;
1288
+
1289
+ if (currentIndex <= 2) {
1290
+ this.$results.scrollTop(0);
1291
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1292
+ this.$results.scrollTop(nextOffset);
1293
+ }
1294
+ };
1295
+
1296
+ Results.prototype.template = function (result, container) {
1297
+ var template = this.options.get('templateResult');
1298
+ var escapeMarkup = this.options.get('escapeMarkup');
1299
+
1300
+ var content = template(result, container);
1301
+
1302
+ if (content == null) {
1303
+ container.style.display = 'none';
1304
+ } else if (typeof content === 'string') {
1305
+ container.innerHTML = escapeMarkup(content);
1306
+ } else {
1307
+ $(container).append(content);
1308
+ }
1309
+ };
1310
+
1311
+ return Results;
1312
+ });
1313
+
1314
+ S2.define('select2/keys',[
1315
+
1316
+ ], function () {
1317
+ var KEYS = {
1318
+ BACKSPACE: 8,
1319
+ TAB: 9,
1320
+ ENTER: 13,
1321
+ SHIFT: 16,
1322
+ CTRL: 17,
1323
+ ALT: 18,
1324
+ ESC: 27,
1325
+ SPACE: 32,
1326
+ PAGE_UP: 33,
1327
+ PAGE_DOWN: 34,
1328
+ END: 35,
1329
+ HOME: 36,
1330
+ LEFT: 37,
1331
+ UP: 38,
1332
+ RIGHT: 39,
1333
+ DOWN: 40,
1334
+ DELETE: 46
1335
+ };
1336
+
1337
+ return KEYS;
1338
+ });
1339
+
1340
+ S2.define('select2/selection/base',[
1341
+ 'jquery',
1342
+ '../utils',
1343
+ '../keys'
1344
+ ], function ($, Utils, KEYS) {
1345
+ function BaseSelection ($element, options) {
1346
+ this.$element = $element;
1347
+ this.options = options;
1348
+
1349
+ BaseSelection.__super__.constructor.call(this);
1350
+ }
1351
+
1352
+ Utils.Extend(BaseSelection, Utils.Observable);
1353
+
1354
+ BaseSelection.prototype.render = function () {
1355
+ var $selection = $(
1356
+ '<span class="select2-selection" ' +
1357
+ ' aria-haspopup="true" aria-expanded="false">' +
1358
+ '</span>'
1359
+ );
1360
+
1361
+ this._tabindex = 0;
1362
+
1363
+ if (this.$element.data('old-tabindex') != null) {
1364
+ this._tabindex = this.$element.data('old-tabindex');
1365
+ } else if (this.$element.attr('tabindex') != null) {
1366
+ this._tabindex = this.$element.attr('tabindex');
1367
+ }
1368
+
1369
+ $selection.attr('title', this.$element.attr('title'));
1370
+ $selection.attr('tabindex', this._tabindex);
1371
+
1372
+ this.$selection = $selection;
1373
+
1374
+ return $selection;
1375
+ };
1376
+
1377
+ BaseSelection.prototype.bind = function (container, $container) {
1378
+ var self = this;
1379
+
1380
+ var id = container.id + '-container';
1381
+ var resultsId = container.id + '-results';
1382
+ var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
1383
+
1384
+ this.container = container;
1385
+
1386
+ this.$selection.on('focus', function (evt) {
1387
+ self.trigger('focus', evt);
1388
+ });
1389
+
1390
+ this.$selection.on('blur', function (evt) {
1391
+ self._handleBlur(evt);
1392
+ });
1393
+
1394
+ this.$selection.on('keydown', function (evt) {
1395
+ self.trigger('keypress', evt);
1396
+
1397
+ if (evt.which === KEYS.SPACE) {
1398
+ evt.preventDefault();
1399
+ }
1400
+ });
1401
+
1402
+ container.on('results:focus', function (params) {
1403
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1404
+ });
1405
+
1406
+ container.on('selection:update', function (params) {
1407
+ self.update(params.data);
1408
+ });
1409
+
1410
+ container.on('open', function () {
1411
+ // When the dropdown is open, aria-expanded="true"
1412
+ self.$selection.attr('aria-expanded', 'true');
1413
+ self.$selection.attr('aria-owns', resultsId);
1414
+
1415
+ self._attachCloseHandler(container);
1416
+ });
1417
+
1418
+ container.on('close', function () {
1419
+ // When the dropdown is closed, aria-expanded="false"
1420
+ self.$selection.attr('aria-expanded', 'false');
1421
+ self.$selection.removeAttr('aria-activedescendant');
1422
+ self.$selection.removeAttr('aria-owns');
1423
+
1424
+ // This needs to be delayed as the active element is the body when the
1425
+ // key is pressed.
1426
+ window.setTimeout(function () {
1427
+ self.$selection.focus();
1428
+ }, 1);
1429
+
1430
+ self._detachCloseHandler(container);
1431
+ });
1432
+
1433
+ container.on('enable', function () {
1434
+ self.$selection.attr('tabindex', self._tabindex);
1435
+ });
1436
+
1437
+ container.on('disable', function () {
1438
+ self.$selection.attr('tabindex', '-1');
1439
+ });
1440
+ };
1441
+
1442
+ BaseSelection.prototype._handleBlur = function (evt) {
1443
+ var self = this;
1444
+
1445
+ // This needs to be delayed as the active element is the body when the tab
1446
+ // key is pressed, possibly along with others.
1447
+ window.setTimeout(function () {
1448
+ // Don't trigger `blur` if the focus is still in the selection
1449
+ if (
1450
+ (document.activeElement == self.$selection[0]) ||
1451
+ ($.contains(self.$selection[0], document.activeElement))
1452
+ ) {
1453
+ return;
1454
+ }
1455
+
1456
+ self.trigger('blur', evt);
1457
+ }, 1);
1458
+ };
1459
+
1460
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1461
+ var self = this;
1462
+
1463
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1464
+ var $target = $(e.target);
1465
+
1466
+ var $select = $target.closest('.select2');
1467
+
1468
+ var $all = $('.select2.select2-container--open');
1469
+
1470
+ $all.each(function () {
1471
+ var $this = $(this);
1472
+
1473
+ if (this == $select[0]) {
1474
+ return;
1475
+ }
1476
+
1477
+ var $element = $this.data('element');
1478
+
1479
+ $element.select2('close');
1480
+ });
1481
+ });
1482
+ };
1483
+
1484
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1485
+ $(document.body).off('mousedown.select2.' + container.id);
1486
+ };
1487
+
1488
+ BaseSelection.prototype.position = function ($selection, $container) {
1489
+ var $selectionContainer = $container.find('.selection');
1490
+ $selectionContainer.append($selection);
1491
+ };
1492
+
1493
+ BaseSelection.prototype.destroy = function () {
1494
+ this._detachCloseHandler(this.container);
1495
+ };
1496
+
1497
+ BaseSelection.prototype.update = function (data) {
1498
+ throw new Error('The `update` method must be defined in child classes.');
1499
+ };
1500
+
1501
+ return BaseSelection;
1502
+ });
1503
+
1504
+ S2.define('select2/selection/single',[
1505
+ 'jquery',
1506
+ './base',
1507
+ '../utils',
1508
+ '../keys'
1509
+ ], function ($, BaseSelection, Utils, KEYS) {
1510
+ function SingleSelection () {
1511
+ SingleSelection.__super__.constructor.apply(this, arguments);
1512
+ }
1513
+
1514
+ Utils.Extend(SingleSelection, BaseSelection);
1515
+
1516
+ SingleSelection.prototype.render = function () {
1517
+ var $selection = SingleSelection.__super__.render.call(this);
1518
+
1519
+ $selection.addClass('select2-selection--single');
1520
+
1521
+ $selection.html(
1522
+ '<span class="select2-selection__rendered"></span>' +
1523
+ '<span class="select2-selection__arrow" role="presentation">' +
1524
+ '<b role="presentation"></b>' +
1525
+ '</span>'
1526
+ );
1527
+
1528
+ return $selection;
1529
+ };
1530
+
1531
+ SingleSelection.prototype.bind = function (container, $container) {
1532
+ var self = this;
1533
+
1534
+ SingleSelection.__super__.bind.apply(this, arguments);
1535
+
1536
+ var id = container.id + '-container';
1537
+
1538
+ this.$selection.find('.select2-selection__rendered')
1539
+ .attr('id', id)
1540
+ .attr('role', 'textbox')
1541
+ .attr('aria-readonly', 'true');
1542
+ this.$selection.attr('aria-labelledby', id);
1543
+
1544
+ // This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
1545
+ this.$selection.attr('role', 'combobox');
1546
+
1547
+ this.$selection.on('mousedown', function (evt) {
1548
+ // Only respond to left clicks
1549
+ if (evt.which !== 1) {
1550
+ return;
1551
+ }
1552
+
1553
+ self.trigger('toggle', {
1554
+ originalEvent: evt
1555
+ });
1556
+ });
1557
+
1558
+ this.$selection.on('focus', function (evt) {
1559
+ // User focuses on the container
1560
+ });
1561
+
1562
+ this.$selection.on('keydown', function (evt) {
1563
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
1564
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
1565
+ container.open();
1566
+ }
1567
+ });
1568
+
1569
+ this.$selection.on('blur', function (evt) {
1570
+ // User exits the container
1571
+ });
1572
+
1573
+ container.on('focus', function (evt) {
1574
+ if (!container.isOpen()) {
1575
+ self.$selection.focus();
1576
+ }
1577
+ });
1578
+
1579
+ container.on('selection:update', function (params) {
1580
+ self.update(params.data);
1581
+ });
1582
+ };
1583
+
1584
+ SingleSelection.prototype.clear = function () {
1585
+ this.$selection.find('.select2-selection__rendered').empty();
1586
+ };
1587
+
1588
+ SingleSelection.prototype.display = function (data, container) {
1589
+ var template = this.options.get('templateSelection');
1590
+ var escapeMarkup = this.options.get('escapeMarkup');
1591
+
1592
+ return escapeMarkup(template(data, container));
1593
+ };
1594
+
1595
+ SingleSelection.prototype.selectionContainer = function () {
1596
+ return $('<span></span>');
1597
+ };
1598
+
1599
+ SingleSelection.prototype.update = function (data) {
1600
+ if (data.length === 0) {
1601
+ this.clear();
1602
+ return;
1603
+ }
1604
+
1605
+ var selection = data[0];
1606
+
1607
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1608
+ var formatted = this.display(selection, $rendered);
1609
+
1610
+ $rendered.empty().append(formatted);
1611
+ $rendered.prop('title', selection.title || selection.text);
1612
+ };
1613
+
1614
+ return SingleSelection;
1615
+ });
1616
+
1617
+ S2.define('select2/selection/multiple',[
1618
+ 'jquery',
1619
+ './base',
1620
+ '../utils'
1621
+ ], function ($, BaseSelection, Utils) {
1622
+ function MultipleSelection ($element, options) {
1623
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1624
+ }
1625
+
1626
+ Utils.Extend(MultipleSelection, BaseSelection);
1627
+
1628
+ MultipleSelection.prototype.render = function () {
1629
+ var $selection = MultipleSelection.__super__.render.call(this);
1630
+
1631
+ $selection.addClass('select2-selection--multiple');
1632
+
1633
+ $selection.html(
1634
+ '<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>'
1635
+ );
1636
+
1637
+ return $selection;
1638
+ };
1639
+
1640
+ MultipleSelection.prototype.bind = function (container, $container) {
1641
+ var self = this;
1642
+
1643
+ MultipleSelection.__super__.bind.apply(this, arguments);
1644
+
1645
+ this.$selection.on('click', function (evt) {
1646
+ self.trigger('toggle', {
1647
+ originalEvent: evt
1648
+ });
1649
+ });
1650
+
1651
+ this.$selection.on(
1652
+ 'click',
1653
+ '.select2-selection__choice__remove',
1654
+ function (evt) {
1655
+ // Ignore the event if it is disabled
1656
+ if (self.options.get('disabled')) {
1657
+ return;
1658
+ }
1659
+
1660
+ var $remove = $(this);
1661
+ var $selection = $remove.parent();
1662
+
1663
+ var data = $selection.data('data');
1664
+
1665
+ self.trigger('unselect', {
1666
+ originalEvent: evt,
1667
+ data: data
1668
+ });
1669
+ }
1670
+ );
1671
+
1672
+ this.$selection.on('keydown', function (evt) {
1673
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
1674
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
1675
+ container.open();
1676
+ }
1677
+ });
1678
+ };
1679
+
1680
+ MultipleSelection.prototype.clear = function () {
1681
+ this.$selection.find('.select2-selection__rendered').empty();
1682
+ };
1683
+
1684
+ MultipleSelection.prototype.display = function (data, container) {
1685
+ var template = this.options.get('templateSelection');
1686
+ var escapeMarkup = this.options.get('escapeMarkup');
1687
+
1688
+ return escapeMarkup(template(data, container));
1689
+ };
1690
+
1691
+ MultipleSelection.prototype.selectionContainer = function () {
1692
+ var $container = $(
1693
+ '<li class="select2-selection__choice">' +
1694
+ '<span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">' +
1695
+ '&times;' +
1696
+ '</span>' +
1697
+ '</li>'
1698
+ );
1699
+
1700
+ return $container;
1701
+ };
1702
+
1703
+ MultipleSelection.prototype.update = function (data) {
1704
+ var self = this;
1705
+ this.clear();
1706
+
1707
+ if (data.length === 0) {
1708
+ return;
1709
+ }
1710
+
1711
+ var $selections = [];
1712
+
1713
+ for (var d = 0; d < data.length; d++) {
1714
+ var selection = data[d];
1715
+
1716
+ var $selection = this.selectionContainer();
1717
+ var formatted = this.display(selection, $selection).trim();
1718
+
1719
+ $selection.append(formatted);
1720
+ $selection.prop('title', selection.title || selection.text);
1721
+
1722
+ $selection.data('data', selection);
1723
+
1724
+ $selections.push($selection);
1725
+ }
1726
+
1727
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1728
+
1729
+ Utils.appendMany($rendered, $selections);
1730
+
1731
+ // Return cursor to search field after updating.
1732
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
1733
+ if ('undefined' !== typeof this.$search) {
1734
+ setTimeout(function(){
1735
+ self.$search.focus();
1736
+ }, 1);
1737
+ }
1738
+ };
1739
+
1740
+ return MultipleSelection;
1741
+ });
1742
+
1743
+ S2.define('select2/selection/placeholder',[
1744
+ '../utils'
1745
+ ], function (Utils) {
1746
+ function Placeholder (decorated, $element, options) {
1747
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1748
+
1749
+ decorated.call(this, $element, options);
1750
+ }
1751
+
1752
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1753
+ if (typeof placeholder === 'string') {
1754
+ placeholder = {
1755
+ id: '',
1756
+ text: placeholder
1757
+ };
1758
+ }
1759
+
1760
+ return placeholder;
1761
+ };
1762
+
1763
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1764
+ var $placeholder = this.selectionContainer();
1765
+
1766
+ $placeholder.html(this.display(placeholder));
1767
+ $placeholder.addClass('select2-selection__placeholder')
1768
+ .removeClass('select2-selection__choice');
1769
+
1770
+ return $placeholder;
1771
+ };
1772
+
1773
+ Placeholder.prototype.update = function (decorated, data) {
1774
+ var singlePlaceholder = (
1775
+ data.length == 1 && data[0].id != this.placeholder.id
1776
+ );
1777
+ var multipleSelections = data.length > 1;
1778
+
1779
+ if (multipleSelections || singlePlaceholder) {
1780
+ return decorated.call(this, data);
1781
+ }
1782
+
1783
+ this.clear();
1784
+
1785
+ var $placeholder = this.createPlaceholder(this.placeholder);
1786
+
1787
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1788
+ };
1789
+
1790
+ return Placeholder;
1791
+ });
1792
+
1793
+ S2.define('select2/selection/allowClear',[
1794
+ 'jquery',
1795
+ '../keys'
1796
+ ], function ($, KEYS) {
1797
+ function AllowClear () { }
1798
+
1799
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1800
+ var self = this;
1801
+
1802
+ decorated.call(this, container, $container);
1803
+
1804
+ if (this.placeholder == null) {
1805
+ if (this.options.get('debug') && window.console && console.error) {
1806
+ console.error(
1807
+ 'Select2: The `allowClear` option should be used in combination ' +
1808
+ 'with the `placeholder` option.'
1809
+ );
1810
+ }
1811
+ }
1812
+
1813
+ this.$selection.on('mousedown', '.select2-selection__clear',
1814
+ function (evt) {
1815
+ self._handleClear(evt);
1816
+ });
1817
+
1818
+ container.on('keypress', function (evt) {
1819
+ self._handleKeyboardClear(evt, container);
1820
+ });
1821
+ };
1822
+
1823
+ AllowClear.prototype._handleClear = function (_, evt) {
1824
+ // Ignore the event if it is disabled
1825
+ if (this.options.get('disabled')) {
1826
+ return;
1827
+ }
1828
+
1829
+ var $clear = this.$selection.find('.select2-selection__clear');
1830
+
1831
+ // Ignore the event if nothing has been selected
1832
+ if ($clear.length === 0) {
1833
+ return;
1834
+ }
1835
+
1836
+ evt.stopPropagation();
1837
+
1838
+ var data = $clear.data('data');
1839
+
1840
+ for (var d = 0; d < data.length; d++) {
1841
+ var unselectData = {
1842
+ data: data[d]
1843
+ };
1844
+
1845
+ // Trigger the `unselect` event, so people can prevent it from being
1846
+ // cleared.
1847
+ this.trigger('unselect', unselectData);
1848
+
1849
+ // If the event was prevented, don't clear it out.
1850
+ if (unselectData.prevented) {
1851
+ return;
1852
+ }
1853
+ }
1854
+
1855
+ this.$element.val(this.placeholder.id).trigger('change');
1856
+
1857
+ this.trigger('toggle', {});
1858
+ };
1859
+
1860
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1861
+ if (container.isOpen()) {
1862
+ return;
1863
+ }
1864
+
1865
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1866
+ this._handleClear(evt);
1867
+ }
1868
+ };
1869
+
1870
+ AllowClear.prototype.update = function (decorated, data) {
1871
+ decorated.call(this, data);
1872
+
1873
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1874
+ data.length === 0) {
1875
+ return;
1876
+ }
1877
+
1878
+ var $remove = $(
1879
+ '<span class="select2-selection__clear">' +
1880
+ '&times;' +
1881
+ '</span>'
1882
+ );
1883
+ $remove.data('data', data);
1884
+
1885
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1886
+ };
1887
+
1888
+ return AllowClear;
1889
+ });
1890
+
1891
+ S2.define('select2/selection/search',[
1892
+ 'jquery',
1893
+ '../utils',
1894
+ '../keys'
1895
+ ], function ($, Utils, KEYS) {
1896
+ function Search (decorated, $element, options) {
1897
+ decorated.call(this, $element, options);
1898
+ }
1899
+
1900
+ Search.prototype.render = function (decorated) {
1901
+ var $search = $(
1902
+ '<li class="select2-search select2-search--inline">' +
1903
+ '<input class="select2-search__field" type="text" tabindex="-1"' +
1904
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1905
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1906
+ '</li>'
1907
+ );
1908
+
1909
+ this.$searchContainer = $search;
1910
+ this.$search = $search.find('input');
1911
+
1912
+ var $rendered = decorated.call(this);
1913
+
1914
+ this._transferTabIndex();
1915
+
1916
+ return $rendered;
1917
+ };
1918
+
1919
+ Search.prototype.bind = function (decorated, container, $container) {
1920
+ var self = this;
1921
+ var resultsId = container.id + '-results';
1922
+
1923
+ decorated.call(this, container, $container);
1924
+
1925
+ container.on('open', function () {
1926
+ self.$search.attr('aria-owns', resultsId);
1927
+ self.$search.trigger('focus');
1928
+ });
1929
+
1930
+ container.on('close', function () {
1931
+ self.$search.val('');
1932
+ self.$search.removeAttr('aria-activedescendant');
1933
+ self.$search.removeAttr('aria-owns');
1934
+ self.$search.trigger('focus');
1935
+ });
1936
+
1937
+ container.on('enable', function () {
1938
+ self.$search.prop('disabled', false);
1939
+
1940
+ self._transferTabIndex();
1941
+ });
1942
+
1943
+ container.on('disable', function () {
1944
+ self.$search.prop('disabled', true);
1945
+ });
1946
+
1947
+ container.on('focus', function (evt) {
1948
+ self.$search.trigger('focus');
1949
+ });
1950
+
1951
+ container.on('results:focus', function (params) {
1952
+ self.$search.attr('aria-activedescendant', params.data._resultId);
1953
+ });
1954
+
1955
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1956
+ self.trigger('focus', evt);
1957
+ });
1958
+
1959
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1960
+ self._handleBlur(evt);
1961
+ });
1962
+
1963
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1964
+ evt.stopPropagation();
1965
+
1966
+ self.trigger('keypress', evt);
1967
+
1968
+ self._keyUpPrevented = evt.isDefaultPrevented();
1969
+
1970
+ var key = evt.which;
1971
+
1972
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1973
+ var $previousChoice = self.$searchContainer
1974
+ .prev('.select2-selection__choice');
1975
+
1976
+ if ($previousChoice.length > 0) {
1977
+ var item = $previousChoice.data('data');
1978
+
1979
+ self.searchRemoveChoice(item);
1980
+
1981
+ evt.preventDefault();
1982
+ }
1983
+ }
1984
+ });
1985
+
1986
+ // Try to detect the IE version should the `documentMode` property that
1987
+ // is stored on the document. This is only implemented in IE and is
1988
+ // slightly cleaner than doing a user agent check.
1989
+ // This property is not available in Edge, but Edge also doesn't have
1990
+ // this bug.
1991
+ var msie = document.documentMode;
1992
+ var disableInputEvents = msie && msie <= 11;
1993
+
1994
+ // Workaround for browsers which do not support the `input` event
1995
+ // This will prevent double-triggering of events for browsers which support
1996
+ // both the `keyup` and `input` events.
1997
+ this.$selection.on(
1998
+ 'input.searchcheck',
1999
+ '.select2-search--inline',
2000
+ function (evt) {
2001
+ // IE will trigger the `input` event when a placeholder is used on a
2002
+ // search box. To get around this issue, we are forced to ignore all
2003
+ // `input` events in IE and keep using `keyup`.
2004
+ if (disableInputEvents) {
2005
+ self.$selection.off('input.search input.searchcheck');
2006
+ return;
2007
+ }
2008
+
2009
+ // Unbind the duplicated `keyup` event
2010
+ self.$selection.off('keyup.search');
2011
+ }
2012
+ );
2013
+
2014
+ this.$selection.on(
2015
+ 'keyup.search input.search',
2016
+ '.select2-search--inline',
2017
+ function (evt) {
2018
+ // IE will trigger the `input` event when a placeholder is used on a
2019
+ // search box. To get around this issue, we are forced to ignore all
2020
+ // `input` events in IE and keep using `keyup`.
2021
+ if (disableInputEvents && evt.type === 'input') {
2022
+ self.$selection.off('input.search input.searchcheck');
2023
+ return;
2024
+ }
2025
+
2026
+ var key = evt.which;
2027
+
2028
+ // We can freely ignore events from modifier keys
2029
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
2030
+ return;
2031
+ }
2032
+
2033
+ // Tabbing will be handled during the `keydown` phase
2034
+ if (key == KEYS.TAB) {
2035
+ return;
2036
+ }
2037
+
2038
+ self.handleSearch(evt);
2039
+ }
2040
+ );
2041
+ };
2042
+
2043
+ /**
2044
+ * This method will transfer the tabindex attribute from the rendered
2045
+ * selection to the search box. This allows for the search box to be used as
2046
+ * the primary focus instead of the selection container.
2047
+ *
2048
+ * @private
2049
+ */
2050
+ Search.prototype._transferTabIndex = function (decorated) {
2051
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2052
+ this.$selection.attr('tabindex', '-1');
2053
+ };
2054
+
2055
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2056
+ this.$search.attr('placeholder', placeholder.text);
2057
+ };
2058
+
2059
+ Search.prototype.update = function (decorated, data) {
2060
+ var searchHadFocus = this.$search[0] == document.activeElement;
2061
+
2062
+ this.$search.attr('placeholder', '');
2063
+
2064
+ decorated.call(this, data);
2065
+
2066
+ this.$selection.find('.select2-selection__rendered')
2067
+ .append(this.$searchContainer);
2068
+
2069
+ this.resizeSearch();
2070
+ if (searchHadFocus) {
2071
+ this.$search.focus();
2072
+ }
2073
+ };
2074
+
2075
+ Search.prototype.handleSearch = function () {
2076
+ this.resizeSearch();
2077
+
2078
+ if (!this._keyUpPrevented) {
2079
+ var input = this.$search.val();
2080
+
2081
+ this.trigger('query', {
2082
+ term: input
2083
+ });
2084
+ }
2085
+
2086
+ this._keyUpPrevented = false;
2087
+ };
2088
+
2089
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2090
+ this.trigger('unselect', {
2091
+ data: item
2092
+ });
2093
+
2094
+ this.$search.val(item.text);
2095
+ this.handleSearch();
2096
+ };
2097
+
2098
+ Search.prototype.resizeSearch = function () {
2099
+ this.$search.css('width', '25px');
2100
+
2101
+ var width = '';
2102
+
2103
+ if (this.$search.attr('placeholder') !== '') {
2104
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2105
+ } else {
2106
+ var minimumWidth = this.$search.val().length + 1;
2107
+
2108
+ width = (minimumWidth * 0.75) + 'em';
2109
+ }
2110
+
2111
+ this.$search.css('width', width);
2112
+ };
2113
+
2114
+ return Search;
2115
+ });
2116
+
2117
+ S2.define('select2/selection/eventRelay',[
2118
+ 'jquery'
2119
+ ], function ($) {
2120
+ function EventRelay () { }
2121
+
2122
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2123
+ var self = this;
2124
+ var relayEvents = [
2125
+ 'open', 'opening',
2126
+ 'close', 'closing',
2127
+ 'select', 'selecting',
2128
+ 'unselect', 'unselecting'
2129
+ ];
2130
+
2131
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2132
+
2133
+ decorated.call(this, container, $container);
2134
+
2135
+ container.on('*', function (name, params) {
2136
+ // Ignore events that should not be relayed
2137
+ if ($.inArray(name, relayEvents) === -1) {
2138
+ return;
2139
+ }
2140
+
2141
+ // The parameters should always be an object
2142
+ params = params || {};
2143
+
2144
+ // Generate the jQuery event for the Select2 event
2145
+ var evt = $.Event('select2:' + name, {
2146
+ params: params
2147
+ });
2148
+
2149
+ self.$element.trigger(evt);
2150
+
2151
+ // Only handle preventable events if it was one
2152
+ if ($.inArray(name, preventableEvents) === -1) {
2153
+ return;
2154
+ }
2155
+
2156
+ params.prevented = evt.isDefaultPrevented();
2157
+ });
2158
+ };
2159
+
2160
+ return EventRelay;
2161
+ });
2162
+
2163
+ S2.define('select2/translation',[
2164
+ 'jquery',
2165
+ 'require'
2166
+ ], function ($, require) {
2167
+ function Translation (dict) {
2168
+ this.dict = dict || {};
2169
+ }
2170
+
2171
+ Translation.prototype.all = function () {
2172
+ return this.dict;
2173
+ };
2174
+
2175
+ Translation.prototype.get = function (key) {
2176
+ return this.dict[key];
2177
+ };
2178
+
2179
+ Translation.prototype.extend = function (translation) {
2180
+ this.dict = $.extend({}, translation.all(), this.dict);
2181
+ };
2182
+
2183
+ // Static functions
2184
+
2185
+ Translation._cache = {};
2186
+
2187
+ Translation.loadPath = function (path) {
2188
+ if (!(path in Translation._cache)) {
2189
+ var translations = require(path);
2190
+
2191
+ Translation._cache[path] = translations;
2192
+ }
2193
+
2194
+ return new Translation(Translation._cache[path]);
2195
+ };
2196
+
2197
+ return Translation;
2198
+ });
2199
+
2200
+ S2.define('select2/diacritics',[
2201
+
2202
+ ], function () {
2203
+ var diacritics = {
2204
+ '\u24B6': 'A',
2205
+ '\uFF21': 'A',
2206
+ '\u00C0': 'A',
2207
+ '\u00C1': 'A',
2208
+ '\u00C2': 'A',
2209
+ '\u1EA6': 'A',
2210
+ '\u1EA4': 'A',
2211
+ '\u1EAA': 'A',
2212
+ '\u1EA8': 'A',
2213
+ '\u00C3': 'A',
2214
+ '\u0100': 'A',
2215
+ '\u0102': 'A',
2216
+ '\u1EB0': 'A',
2217
+ '\u1EAE': 'A',
2218
+ '\u1EB4': 'A',
2219
+ '\u1EB2': 'A',
2220
+ '\u0226': 'A',
2221
+ '\u01E0': 'A',
2222
+ '\u00C4': 'A',
2223
+ '\u01DE': 'A',
2224
+ '\u1EA2': 'A',
2225
+ '\u00C5': 'A',
2226
+ '\u01FA': 'A',
2227
+ '\u01CD': 'A',
2228
+ '\u0200': 'A',
2229
+ '\u0202': 'A',
2230
+ '\u1EA0': 'A',
2231
+ '\u1EAC': 'A',
2232
+ '\u1EB6': 'A',
2233
+ '\u1E00': 'A',
2234
+ '\u0104': 'A',
2235
+ '\u023A': 'A',
2236
+ '\u2C6F': 'A',
2237
+ '\uA732': 'AA',
2238
+ '\u00C6': 'AE',
2239
+ '\u01FC': 'AE',
2240
+ '\u01E2': 'AE',
2241
+ '\uA734': 'AO',
2242
+ '\uA736': 'AU',
2243
+ '\uA738': 'AV',
2244
+ '\uA73A': 'AV',
2245
+ '\uA73C': 'AY',
2246
+ '\u24B7': 'B',
2247
+ '\uFF22': 'B',
2248
+ '\u1E02': 'B',
2249
+ '\u1E04': 'B',
2250
+ '\u1E06': 'B',
2251
+ '\u0243': 'B',
2252
+ '\u0182': 'B',
2253
+ '\u0181': 'B',
2254
+ '\u24B8': 'C',
2255
+ '\uFF23': 'C',
2256
+ '\u0106': 'C',
2257
+ '\u0108': 'C',
2258
+ '\u010A': 'C',
2259
+ '\u010C': 'C',
2260
+ '\u00C7': 'C',
2261
+ '\u1E08': 'C',
2262
+ '\u0187': 'C',
2263
+ '\u023B': 'C',
2264
+ '\uA73E': 'C',
2265
+ '\u24B9': 'D',
2266
+ '\uFF24': 'D',
2267
+ '\u1E0A': 'D',
2268
+ '\u010E': 'D',
2269
+ '\u1E0C': 'D',
2270
+ '\u1E10': 'D',
2271
+ '\u1E12': 'D',
2272
+ '\u1E0E': 'D',
2273
+ '\u0110': 'D',
2274
+ '\u018B': 'D',
2275
+ '\u018A': 'D',
2276
+ '\u0189': 'D',
2277
+ '\uA779': 'D',
2278
+ '\u01F1': 'DZ',
2279
+ '\u01C4': 'DZ',
2280
+ '\u01F2': 'Dz',
2281
+ '\u01C5': 'Dz',
2282
+ '\u24BA': 'E',
2283
+ '\uFF25': 'E',
2284
+ '\u00C8': 'E',
2285
+ '\u00C9': 'E',
2286
+ '\u00CA': 'E',
2287
+ '\u1EC0': 'E',
2288
+ '\u1EBE': 'E',
2289
+ '\u1EC4': 'E',
2290
+ '\u1EC2': 'E',
2291
+ '\u1EBC': 'E',
2292
+ '\u0112': 'E',
2293
+ '\u1E14': 'E',
2294
+ '\u1E16': 'E',
2295
+ '\u0114': 'E',
2296
+ '\u0116': 'E',
2297
+ '\u00CB': 'E',
2298
+ '\u1EBA': 'E',
2299
+ '\u011A': 'E',
2300
+ '\u0204': 'E',
2301
+ '\u0206': 'E',
2302
+ '\u1EB8': 'E',
2303
+ '\u1EC6': 'E',
2304
+ '\u0228': 'E',
2305
+ '\u1E1C': 'E',
2306
+ '\u0118': 'E',
2307
+ '\u1E18': 'E',
2308
+ '\u1E1A': 'E',
2309
+ '\u0190': 'E',
2310
+ '\u018E': 'E',
2311
+ '\u24BB': 'F',
2312
+ '\uFF26': 'F',
2313
+ '\u1E1E': 'F',
2314
+ '\u0191': 'F',
2315
+ '\uA77B': 'F',
2316
+ '\u24BC': 'G',
2317
+ '\uFF27': 'G',
2318
+ '\u01F4': 'G',
2319
+ '\u011C': 'G',
2320
+ '\u1E20': 'G',
2321
+ '\u011E': 'G',
2322
+ '\u0120': 'G',
2323
+ '\u01E6': 'G',
2324
+ '\u0122': 'G',
2325
+ '\u01E4': 'G',
2326
+ '\u0193': 'G',
2327
+ '\uA7A0': 'G',
2328
+ '\uA77D': 'G',
2329
+ '\uA77E': 'G',
2330
+ '\u24BD': 'H',
2331
+ '\uFF28': 'H',
2332
+ '\u0124': 'H',
2333
+ '\u1E22': 'H',
2334
+ '\u1E26': 'H',
2335
+ '\u021E': 'H',
2336
+ '\u1E24': 'H',
2337
+ '\u1E28': 'H',
2338
+ '\u1E2A': 'H',
2339
+ '\u0126': 'H',
2340
+ '\u2C67': 'H',
2341
+ '\u2C75': 'H',
2342
+ '\uA78D': 'H',
2343
+ '\u24BE': 'I',
2344
+ '\uFF29': 'I',
2345
+ '\u00CC': 'I',
2346
+ '\u00CD': 'I',
2347
+ '\u00CE': 'I',
2348
+ '\u0128': 'I',
2349
+ '\u012A': 'I',
2350
+ '\u012C': 'I',
2351
+ '\u0130': 'I',
2352
+ '\u00CF': 'I',
2353
+ '\u1E2E': 'I',
2354
+ '\u1EC8': 'I',
2355
+ '\u01CF': 'I',
2356
+ '\u0208': 'I',
2357
+ '\u020A': 'I',
2358
+ '\u1ECA': 'I',
2359
+ '\u012E': 'I',
2360
+ '\u1E2C': 'I',
2361
+ '\u0197': 'I',
2362
+ '\u24BF': 'J',
2363
+ '\uFF2A': 'J',
2364
+ '\u0134': 'J',
2365
+ '\u0248': 'J',
2366
+ '\u24C0': 'K',
2367
+ '\uFF2B': 'K',
2368
+ '\u1E30': 'K',
2369
+ '\u01E8': 'K',
2370
+ '\u1E32': 'K',
2371
+ '\u0136': 'K',
2372
+ '\u1E34': 'K',
2373
+ '\u0198': 'K',
2374
+ '\u2C69': 'K',
2375
+ '\uA740': 'K',
2376
+ '\uA742': 'K',
2377
+ '\uA744': 'K',
2378
+ '\uA7A2': 'K',
2379
+ '\u24C1': 'L',
2380
+ '\uFF2C': 'L',
2381
+ '\u013F': 'L',
2382
+ '\u0139': 'L',
2383
+ '\u013D': 'L',
2384
+ '\u1E36': 'L',
2385
+ '\u1E38': 'L',
2386
+ '\u013B': 'L',
2387
+ '\u1E3C': 'L',
2388
+ '\u1E3A': 'L',
2389
+ '\u0141': 'L',
2390
+ '\u023D': 'L',
2391
+ '\u2C62': 'L',
2392
+ '\u2C60': 'L',
2393
+ '\uA748': 'L',
2394
+ '\uA746': 'L',
2395
+ '\uA780': 'L',
2396
+ '\u01C7': 'LJ',
2397
+ '\u01C8': 'Lj',
2398
+ '\u24C2': 'M',
2399
+ '\uFF2D': 'M',
2400
+ '\u1E3E': 'M',
2401
+ '\u1E40': 'M',
2402
+ '\u1E42': 'M',
2403
+ '\u2C6E': 'M',
2404
+ '\u019C': 'M',
2405
+ '\u24C3': 'N',
2406
+ '\uFF2E': 'N',
2407
+ '\u01F8': 'N',
2408
+ '\u0143': 'N',
2409
+ '\u00D1': 'N',
2410
+ '\u1E44': 'N',
2411
+ '\u0147': 'N',
2412
+ '\u1E46': 'N',
2413
+ '\u0145': 'N',
2414
+ '\u1E4A': 'N',
2415
+ '\u1E48': 'N',
2416
+ '\u0220': 'N',
2417
+ '\u019D': 'N',
2418
+ '\uA790': 'N',
2419
+ '\uA7A4': 'N',
2420
+ '\u01CA': 'NJ',
2421
+ '\u01CB': 'Nj',
2422
+ '\u24C4': 'O',
2423
+ '\uFF2F': 'O',
2424
+ '\u00D2': 'O',
2425
+ '\u00D3': 'O',
2426
+ '\u00D4': 'O',
2427
+ '\u1ED2': 'O',
2428
+ '\u1ED0': 'O',
2429
+ '\u1ED6': 'O',
2430
+ '\u1ED4': 'O',
2431
+ '\u00D5': 'O',
2432
+ '\u1E4C': 'O',
2433
+ '\u022C': 'O',
2434
+ '\u1E4E': 'O',
2435
+ '\u014C': 'O',
2436
+ '\u1E50': 'O',
2437
+ '\u1E52': 'O',
2438
+ '\u014E': 'O',
2439
+ '\u022E': 'O',
2440
+ '\u0230': 'O',
2441
+ '\u00D6': 'O',
2442
+ '\u022A': 'O',
2443
+ '\u1ECE': 'O',
2444
+ '\u0150': 'O',
2445
+ '\u01D1': 'O',
2446
+ '\u020C': 'O',
2447
+ '\u020E': 'O',
2448
+ '\u01A0': 'O',
2449
+ '\u1EDC': 'O',
2450
+ '\u1EDA': 'O',
2451
+ '\u1EE0': 'O',
2452
+ '\u1EDE': 'O',
2453
+ '\u1EE2': 'O',
2454
+ '\u1ECC': 'O',
2455
+ '\u1ED8': 'O',
2456
+ '\u01EA': 'O',
2457
+ '\u01EC': 'O',
2458
+ '\u00D8': 'O',
2459
+ '\u01FE': 'O',
2460
+ '\u0186': 'O',
2461
+ '\u019F': 'O',
2462
+ '\uA74A': 'O',
2463
+ '\uA74C': 'O',
2464
+ '\u01A2': 'OI',
2465
+ '\uA74E': 'OO',
2466
+ '\u0222': 'OU',
2467
+ '\u24C5': 'P',
2468
+ '\uFF30': 'P',
2469
+ '\u1E54': 'P',
2470
+ '\u1E56': 'P',
2471
+ '\u01A4': 'P',
2472
+ '\u2C63': 'P',
2473
+ '\uA750': 'P',
2474
+ '\uA752': 'P',
2475
+ '\uA754': 'P',
2476
+ '\u24C6': 'Q',
2477
+ '\uFF31': 'Q',
2478
+ '\uA756': 'Q',
2479
+ '\uA758': 'Q',
2480
+ '\u024A': 'Q',
2481
+ '\u24C7': 'R',
2482
+ '\uFF32': 'R',
2483
+ '\u0154': 'R',
2484
+ '\u1E58': 'R',
2485
+ '\u0158': 'R',
2486
+ '\u0210': 'R',
2487
+ '\u0212': 'R',
2488
+ '\u1E5A': 'R',
2489
+ '\u1E5C': 'R',
2490
+ '\u0156': 'R',
2491
+ '\u1E5E': 'R',
2492
+ '\u024C': 'R',
2493
+ '\u2C64': 'R',
2494
+ '\uA75A': 'R',
2495
+ '\uA7A6': 'R',
2496
+ '\uA782': 'R',
2497
+ '\u24C8': 'S',
2498
+ '\uFF33': 'S',
2499
+ '\u1E9E': 'S',
2500
+ '\u015A': 'S',
2501
+ '\u1E64': 'S',
2502
+ '\u015C': 'S',
2503
+ '\u1E60': 'S',
2504
+ '\u0160': 'S',
2505
+ '\u1E66': 'S',
2506
+ '\u1E62': 'S',
2507
+ '\u1E68': 'S',
2508
+ '\u0218': 'S',
2509
+ '\u015E': 'S',
2510
+ '\u2C7E': 'S',
2511
+ '\uA7A8': 'S',
2512
+ '\uA784': 'S',
2513
+ '\u24C9': 'T',
2514
+ '\uFF34': 'T',
2515
+ '\u1E6A': 'T',
2516
+ '\u0164': 'T',
2517
+ '\u1E6C': 'T',
2518
+ '\u021A': 'T',
2519
+ '\u0162': 'T',
2520
+ '\u1E70': 'T',
2521
+ '\u1E6E': 'T',
2522
+ '\u0166': 'T',
2523
+ '\u01AC': 'T',
2524
+ '\u01AE': 'T',
2525
+ '\u023E': 'T',
2526
+ '\uA786': 'T',
2527
+ '\uA728': 'TZ',
2528
+ '\u24CA': 'U',
2529
+ '\uFF35': 'U',
2530
+ '\u00D9': 'U',
2531
+ '\u00DA': 'U',
2532
+ '\u00DB': 'U',
2533
+ '\u0168': 'U',
2534
+ '\u1E78': 'U',
2535
+ '\u016A': 'U',
2536
+ '\u1E7A': 'U',
2537
+ '\u016C': 'U',
2538
+ '\u00DC': 'U',
2539
+ '\u01DB': 'U',
2540
+ '\u01D7': 'U',
2541
+ '\u01D5': 'U',
2542
+ '\u01D9': 'U',
2543
+ '\u1EE6': 'U',
2544
+ '\u016E': 'U',
2545
+ '\u0170': 'U',
2546
+ '\u01D3': 'U',
2547
+ '\u0214': 'U',
2548
+ '\u0216': 'U',
2549
+ '\u01AF': 'U',
2550
+ '\u1EEA': 'U',
2551
+ '\u1EE8': 'U',
2552
+ '\u1EEE': 'U',
2553
+ '\u1EEC': 'U',
2554
+ '\u1EF0': 'U',
2555
+ '\u1EE4': 'U',
2556
+ '\u1E72': 'U',
2557
+ '\u0172': 'U',
2558
+ '\u1E76': 'U',
2559
+ '\u1E74': 'U',
2560
+ '\u0244': 'U',
2561
+ '\u24CB': 'V',
2562
+ '\uFF36': 'V',
2563
+ '\u1E7C': 'V',
2564
+ '\u1E7E': 'V',
2565
+ '\u01B2': 'V',
2566
+ '\uA75E': 'V',
2567
+ '\u0245': 'V',
2568
+ '\uA760': 'VY',
2569
+ '\u24CC': 'W',
2570
+ '\uFF37': 'W',
2571
+ '\u1E80': 'W',
2572
+ '\u1E82': 'W',
2573
+ '\u0174': 'W',
2574
+ '\u1E86': 'W',
2575
+ '\u1E84': 'W',
2576
+ '\u1E88': 'W',
2577
+ '\u2C72': 'W',
2578
+ '\u24CD': 'X',
2579
+ '\uFF38': 'X',
2580
+ '\u1E8A': 'X',
2581
+ '\u1E8C': 'X',
2582
+ '\u24CE': 'Y',
2583
+ '\uFF39': 'Y',
2584
+ '\u1EF2': 'Y',
2585
+ '\u00DD': 'Y',
2586
+ '\u0176': 'Y',
2587
+ '\u1EF8': 'Y',
2588
+ '\u0232': 'Y',
2589
+ '\u1E8E': 'Y',
2590
+ '\u0178': 'Y',
2591
+ '\u1EF6': 'Y',
2592
+ '\u1EF4': 'Y',
2593
+ '\u01B3': 'Y',
2594
+ '\u024E': 'Y',
2595
+ '\u1EFE': 'Y',
2596
+ '\u24CF': 'Z',
2597
+ '\uFF3A': 'Z',
2598
+ '\u0179': 'Z',
2599
+ '\u1E90': 'Z',
2600
+ '\u017B': 'Z',
2601
+ '\u017D': 'Z',
2602
+ '\u1E92': 'Z',
2603
+ '\u1E94': 'Z',
2604
+ '\u01B5': 'Z',
2605
+ '\u0224': 'Z',
2606
+ '\u2C7F': 'Z',
2607
+ '\u2C6B': 'Z',
2608
+ '\uA762': 'Z',
2609
+ '\u24D0': 'a',
2610
+ '\uFF41': 'a',
2611
+ '\u1E9A': 'a',
2612
+ '\u00E0': 'a',
2613
+ '\u00E1': 'a',
2614
+ '\u00E2': 'a',
2615
+ '\u1EA7': 'a',
2616
+ '\u1EA5': 'a',
2617
+ '\u1EAB': 'a',
2618
+ '\u1EA9': 'a',
2619
+ '\u00E3': 'a',
2620
+ '\u0101': 'a',
2621
+ '\u0103': 'a',
2622
+ '\u1EB1': 'a',
2623
+ '\u1EAF': 'a',
2624
+ '\u1EB5': 'a',
2625
+ '\u1EB3': 'a',
2626
+ '\u0227': 'a',
2627
+ '\u01E1': 'a',
2628
+ '\u00E4': 'a',
2629
+ '\u01DF': 'a',
2630
+ '\u1EA3': 'a',
2631
+ '\u00E5': 'a',
2632
+ '\u01FB': 'a',
2633
+ '\u01CE': 'a',
2634
+ '\u0201': 'a',
2635
+ '\u0203': 'a',
2636
+ '\u1EA1': 'a',
2637
+ '\u1EAD': 'a',
2638
+ '\u1EB7': 'a',
2639
+ '\u1E01': 'a',
2640
+ '\u0105': 'a',
2641
+ '\u2C65': 'a',
2642
+ '\u0250': 'a',
2643
+ '\uA733': 'aa',
2644
+ '\u00E6': 'ae',
2645
+ '\u01FD': 'ae',
2646
+ '\u01E3': 'ae',
2647
+ '\uA735': 'ao',
2648
+ '\uA737': 'au',
2649
+ '\uA739': 'av',
2650
+ '\uA73B': 'av',
2651
+ '\uA73D': 'ay',
2652
+ '\u24D1': 'b',
2653
+ '\uFF42': 'b',
2654
+ '\u1E03': 'b',
2655
+ '\u1E05': 'b',
2656
+ '\u1E07': 'b',
2657
+ '\u0180': 'b',
2658
+ '\u0183': 'b',
2659
+ '\u0253': 'b',
2660
+ '\u24D2': 'c',
2661
+ '\uFF43': 'c',
2662
+ '\u0107': 'c',
2663
+ '\u0109': 'c',
2664
+ '\u010B': 'c',
2665
+ '\u010D': 'c',
2666
+ '\u00E7': 'c',
2667
+ '\u1E09': 'c',
2668
+ '\u0188': 'c',
2669
+ '\u023C': 'c',
2670
+ '\uA73F': 'c',
2671
+ '\u2184': 'c',
2672
+ '\u24D3': 'd',
2673
+ '\uFF44': 'd',
2674
+ '\u1E0B': 'd',
2675
+ '\u010F': 'd',
2676
+ '\u1E0D': 'd',
2677
+ '\u1E11': 'd',
2678
+ '\u1E13': 'd',
2679
+ '\u1E0F': 'd',
2680
+ '\u0111': 'd',
2681
+ '\u018C': 'd',
2682
+ '\u0256': 'd',
2683
+ '\u0257': 'd',
2684
+ '\uA77A': 'd',
2685
+ '\u01F3': 'dz',
2686
+ '\u01C6': 'dz',
2687
+ '\u24D4': 'e',
2688
+ '\uFF45': 'e',
2689
+ '\u00E8': 'e',
2690
+ '\u00E9': 'e',
2691
+ '\u00EA': 'e',
2692
+ '\u1EC1': 'e',
2693
+ '\u1EBF': 'e',
2694
+ '\u1EC5': 'e',
2695
+ '\u1EC3': 'e',
2696
+ '\u1EBD': 'e',
2697
+ '\u0113': 'e',
2698
+ '\u1E15': 'e',
2699
+ '\u1E17': 'e',
2700
+ '\u0115': 'e',
2701
+ '\u0117': 'e',
2702
+ '\u00EB': 'e',
2703
+ '\u1EBB': 'e',
2704
+ '\u011B': 'e',
2705
+ '\u0205': 'e',
2706
+ '\u0207': 'e',
2707
+ '\u1EB9': 'e',
2708
+ '\u1EC7': 'e',
2709
+ '\u0229': 'e',
2710
+ '\u1E1D': 'e',
2711
+ '\u0119': 'e',
2712
+ '\u1E19': 'e',
2713
+ '\u1E1B': 'e',
2714
+ '\u0247': 'e',
2715
+ '\u025B': 'e',
2716
+ '\u01DD': 'e',
2717
+ '\u24D5': 'f',
2718
+ '\uFF46': 'f',
2719
+ '\u1E1F': 'f',
2720
+ '\u0192': 'f',
2721
+ '\uA77C': 'f',
2722
+ '\u24D6': 'g',
2723
+ '\uFF47': 'g',
2724
+ '\u01F5': 'g',
2725
+ '\u011D': 'g',
2726
+ '\u1E21': 'g',
2727
+ '\u011F': 'g',
2728
+ '\u0121': 'g',
2729
+ '\u01E7': 'g',
2730
+ '\u0123': 'g',
2731
+ '\u01E5': 'g',
2732
+ '\u0260': 'g',
2733
+ '\uA7A1': 'g',
2734
+ '\u1D79': 'g',
2735
+ '\uA77F': 'g',
2736
+ '\u24D7': 'h',
2737
+ '\uFF48': 'h',
2738
+ '\u0125': 'h',
2739
+ '\u1E23': 'h',
2740
+ '\u1E27': 'h',
2741
+ '\u021F': 'h',
2742
+ '\u1E25': 'h',
2743
+ '\u1E29': 'h',
2744
+ '\u1E2B': 'h',
2745
+ '\u1E96': 'h',
2746
+ '\u0127': 'h',
2747
+ '\u2C68': 'h',
2748
+ '\u2C76': 'h',
2749
+ '\u0265': 'h',
2750
+ '\u0195': 'hv',
2751
+ '\u24D8': 'i',
2752
+ '\uFF49': 'i',
2753
+ '\u00EC': 'i',
2754
+ '\u00ED': 'i',
2755
+ '\u00EE': 'i',
2756
+ '\u0129': 'i',
2757
+ '\u012B': 'i',
2758
+ '\u012D': 'i',
2759
+ '\u00EF': 'i',
2760
+ '\u1E2F': 'i',
2761
+ '\u1EC9': 'i',
2762
+ '\u01D0': 'i',
2763
+ '\u0209': 'i',
2764
+ '\u020B': 'i',
2765
+ '\u1ECB': 'i',
2766
+ '\u012F': 'i',
2767
+ '\u1E2D': 'i',
2768
+ '\u0268': 'i',
2769
+ '\u0131': 'i',
2770
+ '\u24D9': 'j',
2771
+ '\uFF4A': 'j',
2772
+ '\u0135': 'j',
2773
+ '\u01F0': 'j',
2774
+ '\u0249': 'j',
2775
+ '\u24DA': 'k',
2776
+ '\uFF4B': 'k',
2777
+ '\u1E31': 'k',
2778
+ '\u01E9': 'k',
2779
+ '\u1E33': 'k',
2780
+ '\u0137': 'k',
2781
+ '\u1E35': 'k',
2782
+ '\u0199': 'k',
2783
+ '\u2C6A': 'k',
2784
+ '\uA741': 'k',
2785
+ '\uA743': 'k',
2786
+ '\uA745': 'k',
2787
+ '\uA7A3': 'k',
2788
+ '\u24DB': 'l',
2789
+ '\uFF4C': 'l',
2790
+ '\u0140': 'l',
2791
+ '\u013A': 'l',
2792
+ '\u013E': 'l',
2793
+ '\u1E37': 'l',
2794
+ '\u1E39': 'l',
2795
+ '\u013C': 'l',
2796
+ '\u1E3D': 'l',
2797
+ '\u1E3B': 'l',
2798
+ '\u017F': 'l',
2799
+ '\u0142': 'l',
2800
+ '\u019A': 'l',
2801
+ '\u026B': 'l',
2802
+ '\u2C61': 'l',
2803
+ '\uA749': 'l',
2804
+ '\uA781': 'l',
2805
+ '\uA747': 'l',
2806
+ '\u01C9': 'lj',
2807
+ '\u24DC': 'm',
2808
+ '\uFF4D': 'm',
2809
+ '\u1E3F': 'm',
2810
+ '\u1E41': 'm',
2811
+ '\u1E43': 'm',
2812
+ '\u0271': 'm',
2813
+ '\u026F': 'm',
2814
+ '\u24DD': 'n',
2815
+ '\uFF4E': 'n',
2816
+ '\u01F9': 'n',
2817
+ '\u0144': 'n',
2818
+ '\u00F1': 'n',
2819
+ '\u1E45': 'n',
2820
+ '\u0148': 'n',
2821
+ '\u1E47': 'n',
2822
+ '\u0146': 'n',
2823
+ '\u1E4B': 'n',
2824
+ '\u1E49': 'n',
2825
+ '\u019E': 'n',
2826
+ '\u0272': 'n',
2827
+ '\u0149': 'n',
2828
+ '\uA791': 'n',
2829
+ '\uA7A5': 'n',
2830
+ '\u01CC': 'nj',
2831
+ '\u24DE': 'o',
2832
+ '\uFF4F': 'o',
2833
+ '\u00F2': 'o',
2834
+ '\u00F3': 'o',
2835
+ '\u00F4': 'o',
2836
+ '\u1ED3': 'o',
2837
+ '\u1ED1': 'o',
2838
+ '\u1ED7': 'o',
2839
+ '\u1ED5': 'o',
2840
+ '\u00F5': 'o',
2841
+ '\u1E4D': 'o',
2842
+ '\u022D': 'o',
2843
+ '\u1E4F': 'o',
2844
+ '\u014D': 'o',
2845
+ '\u1E51': 'o',
2846
+ '\u1E53': 'o',
2847
+ '\u014F': 'o',
2848
+ '\u022F': 'o',
2849
+ '\u0231': 'o',
2850
+ '\u00F6': 'o',
2851
+ '\u022B': 'o',
2852
+ '\u1ECF': 'o',
2853
+ '\u0151': 'o',
2854
+ '\u01D2': 'o',
2855
+ '\u020D': 'o',
2856
+ '\u020F': 'o',
2857
+ '\u01A1': 'o',
2858
+ '\u1EDD': 'o',
2859
+ '\u1EDB': 'o',
2860
+ '\u1EE1': 'o',
2861
+ '\u1EDF': 'o',
2862
+ '\u1EE3': 'o',
2863
+ '\u1ECD': 'o',
2864
+ '\u1ED9': 'o',
2865
+ '\u01EB': 'o',
2866
+ '\u01ED': 'o',
2867
+ '\u00F8': 'o',
2868
+ '\u01FF': 'o',
2869
+ '\u0254': 'o',
2870
+ '\uA74B': 'o',
2871
+ '\uA74D': 'o',
2872
+ '\u0275': 'o',
2873
+ '\u01A3': 'oi',
2874
+ '\u0223': 'ou',
2875
+ '\uA74F': 'oo',
2876
+ '\u24DF': 'p',
2877
+ '\uFF50': 'p',
2878
+ '\u1E55': 'p',
2879
+ '\u1E57': 'p',
2880
+ '\u01A5': 'p',
2881
+ '\u1D7D': 'p',
2882
+ '\uA751': 'p',
2883
+ '\uA753': 'p',
2884
+ '\uA755': 'p',
2885
+ '\u24E0': 'q',
2886
+ '\uFF51': 'q',
2887
+ '\u024B': 'q',
2888
+ '\uA757': 'q',
2889
+ '\uA759': 'q',
2890
+ '\u24E1': 'r',
2891
+ '\uFF52': 'r',
2892
+ '\u0155': 'r',
2893
+ '\u1E59': 'r',
2894
+ '\u0159': 'r',
2895
+ '\u0211': 'r',
2896
+ '\u0213': 'r',
2897
+ '\u1E5B': 'r',
2898
+ '\u1E5D': 'r',
2899
+ '\u0157': 'r',
2900
+ '\u1E5F': 'r',
2901
+ '\u024D': 'r',
2902
+ '\u027D': 'r',
2903
+ '\uA75B': 'r',
2904
+ '\uA7A7': 'r',
2905
+ '\uA783': 'r',
2906
+ '\u24E2': 's',
2907
+ '\uFF53': 's',
2908
+ '\u00DF': 's',
2909
+ '\u015B': 's',
2910
+ '\u1E65': 's',
2911
+ '\u015D': 's',
2912
+ '\u1E61': 's',
2913
+ '\u0161': 's',
2914
+ '\u1E67': 's',
2915
+ '\u1E63': 's',
2916
+ '\u1E69': 's',
2917
+ '\u0219': 's',
2918
+ '\u015F': 's',
2919
+ '\u023F': 's',
2920
+ '\uA7A9': 's',
2921
+ '\uA785': 's',
2922
+ '\u1E9B': 's',
2923
+ '\u24E3': 't',
2924
+ '\uFF54': 't',
2925
+ '\u1E6B': 't',
2926
+ '\u1E97': 't',
2927
+ '\u0165': 't',
2928
+ '\u1E6D': 't',
2929
+ '\u021B': 't',
2930
+ '\u0163': 't',
2931
+ '\u1E71': 't',
2932
+ '\u1E6F': 't',
2933
+ '\u0167': 't',
2934
+ '\u01AD': 't',
2935
+ '\u0288': 't',
2936
+ '\u2C66': 't',
2937
+ '\uA787': 't',
2938
+ '\uA729': 'tz',
2939
+ '\u24E4': 'u',
2940
+ '\uFF55': 'u',
2941
+ '\u00F9': 'u',
2942
+ '\u00FA': 'u',
2943
+ '\u00FB': 'u',
2944
+ '\u0169': 'u',
2945
+ '\u1E79': 'u',
2946
+ '\u016B': 'u',
2947
+ '\u1E7B': 'u',
2948
+ '\u016D': 'u',
2949
+ '\u00FC': 'u',
2950
+ '\u01DC': 'u',
2951
+ '\u01D8': 'u',
2952
+ '\u01D6': 'u',
2953
+ '\u01DA': 'u',
2954
+ '\u1EE7': 'u',
2955
+ '\u016F': 'u',
2956
+ '\u0171': 'u',
2957
+ '\u01D4': 'u',
2958
+ '\u0215': 'u',
2959
+ '\u0217': 'u',
2960
+ '\u01B0': 'u',
2961
+ '\u1EEB': 'u',
2962
+ '\u1EE9': 'u',
2963
+ '\u1EEF': 'u',
2964
+ '\u1EED': 'u',
2965
+ '\u1EF1': 'u',
2966
+ '\u1EE5': 'u',
2967
+ '\u1E73': 'u',
2968
+ '\u0173': 'u',
2969
+ '\u1E77': 'u',
2970
+ '\u1E75': 'u',
2971
+ '\u0289': 'u',
2972
+ '\u24E5': 'v',
2973
+ '\uFF56': 'v',
2974
+ '\u1E7D': 'v',
2975
+ '\u1E7F': 'v',
2976
+ '\u028B': 'v',
2977
+ '\uA75F': 'v',
2978
+ '\u028C': 'v',
2979
+ '\uA761': 'vy',
2980
+ '\u24E6': 'w',
2981
+ '\uFF57': 'w',
2982
+ '\u1E81': 'w',
2983
+ '\u1E83': 'w',
2984
+ '\u0175': 'w',
2985
+ '\u1E87': 'w',
2986
+ '\u1E85': 'w',
2987
+ '\u1E98': 'w',
2988
+ '\u1E89': 'w',
2989
+ '\u2C73': 'w',
2990
+ '\u24E7': 'x',
2991
+ '\uFF58': 'x',
2992
+ '\u1E8B': 'x',
2993
+ '\u1E8D': 'x',
2994
+ '\u24E8': 'y',
2995
+ '\uFF59': 'y',
2996
+ '\u1EF3': 'y',
2997
+ '\u00FD': 'y',
2998
+ '\u0177': 'y',
2999
+ '\u1EF9': 'y',
3000
+ '\u0233': 'y',
3001
+ '\u1E8F': 'y',
3002
+ '\u00FF': 'y',
3003
+ '\u1EF7': 'y',
3004
+ '\u1E99': 'y',
3005
+ '\u1EF5': 'y',
3006
+ '\u01B4': 'y',
3007
+ '\u024F': 'y',
3008
+ '\u1EFF': 'y',
3009
+ '\u24E9': 'z',
3010
+ '\uFF5A': 'z',
3011
+ '\u017A': 'z',
3012
+ '\u1E91': 'z',
3013
+ '\u017C': 'z',
3014
+ '\u017E': 'z',
3015
+ '\u1E93': 'z',
3016
+ '\u1E95': 'z',
3017
+ '\u01B6': 'z',
3018
+ '\u0225': 'z',
3019
+ '\u0240': 'z',
3020
+ '\u2C6C': 'z',
3021
+ '\uA763': 'z',
3022
+ '\u0386': '\u0391',
3023
+ '\u0388': '\u0395',
3024
+ '\u0389': '\u0397',
3025
+ '\u038A': '\u0399',
3026
+ '\u03AA': '\u0399',
3027
+ '\u038C': '\u039F',
3028
+ '\u038E': '\u03A5',
3029
+ '\u03AB': '\u03A5',
3030
+ '\u038F': '\u03A9',
3031
+ '\u03AC': '\u03B1',
3032
+ '\u03AD': '\u03B5',
3033
+ '\u03AE': '\u03B7',
3034
+ '\u03AF': '\u03B9',
3035
+ '\u03CA': '\u03B9',
3036
+ '\u0390': '\u03B9',
3037
+ '\u03CC': '\u03BF',
3038
+ '\u03CD': '\u03C5',
3039
+ '\u03CB': '\u03C5',
3040
+ '\u03B0': '\u03C5',
3041
+ '\u03C9': '\u03C9',
3042
+ '\u03C2': '\u03C3'
3043
+ };
3044
+
3045
+ return diacritics;
3046
+ });
3047
+
3048
+ S2.define('select2/data/base',[
3049
+ '../utils'
3050
+ ], function (Utils) {
3051
+ function BaseAdapter ($element, options) {
3052
+ BaseAdapter.__super__.constructor.call(this);
3053
+ }
3054
+
3055
+ Utils.Extend(BaseAdapter, Utils.Observable);
3056
+
3057
+ BaseAdapter.prototype.current = function (callback) {
3058
+ throw new Error('The `current` method must be defined in child classes.');
3059
+ };
3060
+
3061
+ BaseAdapter.prototype.query = function (params, callback) {
3062
+ throw new Error('The `query` method must be defined in child classes.');
3063
+ };
3064
+
3065
+ BaseAdapter.prototype.bind = function (container, $container) {
3066
+ // Can be implemented in subclasses
3067
+ };
3068
+
3069
+ BaseAdapter.prototype.destroy = function () {
3070
+ // Can be implemented in subclasses
3071
+ };
3072
+
3073
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3074
+ var id = '';
3075
+
3076
+ if (container != null) {
3077
+ id += container.id
3078
+ } else {
3079
+ id += Utils.generateChars(4);
3080
+ }
3081
+
3082
+ id += '-result-';
3083
+ id += Utils.generateChars(4);
3084
+
3085
+ if (data.id != null) {
3086
+ id += '-' + data.id.toString();
3087
+ } else {
3088
+ id += '-' + Utils.generateChars(4);
3089
+ }
3090
+ return id;
3091
+ };
3092
+
3093
+ return BaseAdapter;
3094
+ });
3095
+
3096
+ S2.define('select2/data/select',[
3097
+ './base',
3098
+ '../utils',
3099
+ 'jquery'
3100
+ ], function (BaseAdapter, Utils, $) {
3101
+ function SelectAdapter ($element, options) {
3102
+ this.$element = $element;
3103
+ this.options = options;
3104
+
3105
+ SelectAdapter.__super__.constructor.call(this);
3106
+ }
3107
+
3108
+ Utils.Extend(SelectAdapter, BaseAdapter);
3109
+
3110
+ SelectAdapter.prototype.current = function (callback) {
3111
+ var data = [];
3112
+ var self = this;
3113
+
3114
+ this.$element.find(':selected').each(function () {
3115
+ var $option = $(this);
3116
+
3117
+ var option = self.item($option);
3118
+
3119
+ data.push(option);
3120
+ });
3121
+
3122
+ callback(data);
3123
+ };
3124
+
3125
+ SelectAdapter.prototype.select = function (data) {
3126
+ var self = this;
3127
+
3128
+ data.selected = true;
3129
+
3130
+ // If data.element is a DOM node, use it instead
3131
+ if ($(data.element).is('option')) {
3132
+ data.element.selected = true;
3133
+
3134
+ this.$element.trigger('change');
3135
+
3136
+ return;
3137
+ }
3138
+
3139
+ if (this.$element.prop('multiple')) {
3140
+ this.current(function (currentData) {
3141
+ var val = [];
3142
+
3143
+ data = [data];
3144
+ data.push.apply(data, currentData);
3145
+
3146
+ for (var d = 0; d < data.length; d++) {
3147
+ var id = data[d].id;
3148
+
3149
+ if ($.inArray(id, val) === -1) {
3150
+ val.push(id);
3151
+ }
3152
+ }
3153
+
3154
+ self.$element.val(val);
3155
+ self.$element.trigger('change');
3156
+ });
3157
+ } else {
3158
+ var val = data.id;
3159
+
3160
+ this.$element.val(val);
3161
+ this.$element.trigger('change');
3162
+ }
3163
+ };
3164
+
3165
+ SelectAdapter.prototype.unselect = function (data) {
3166
+ var self = this;
3167
+
3168
+ if (!this.$element.prop('multiple')) {
3169
+ return;
3170
+ }
3171
+
3172
+ data.selected = false;
3173
+
3174
+ if ($(data.element).is('option')) {
3175
+ data.element.selected = false;
3176
+
3177
+ this.$element.trigger('change');
3178
+
3179
+ return;
3180
+ }
3181
+
3182
+ this.current(function (currentData) {
3183
+ var val = [];
3184
+
3185
+ for (var d = 0; d < currentData.length; d++) {
3186
+ var id = currentData[d].id;
3187
+
3188
+ if (id !== data.id && $.inArray(id, val) === -1) {
3189
+ val.push(id);
3190
+ }
3191
+ }
3192
+
3193
+ self.$element.val(val);
3194
+
3195
+ self.$element.trigger('change');
3196
+ });
3197
+ };
3198
+
3199
+ SelectAdapter.prototype.bind = function (container, $container) {
3200
+ var self = this;
3201
+
3202
+ this.container = container;
3203
+
3204
+ container.on('select', function (params) {
3205
+ self.select(params.data);
3206
+ });
3207
+
3208
+ container.on('unselect', function (params) {
3209
+ self.unselect(params.data);
3210
+ });
3211
+ };
3212
+
3213
+ SelectAdapter.prototype.destroy = function () {
3214
+ // Remove anything added to child elements
3215
+ this.$element.find('*').each(function () {
3216
+ // Remove any custom data set by Select2
3217
+ $.removeData(this, 'data');
3218
+ });
3219
+ };
3220
+
3221
+ SelectAdapter.prototype.query = function (params, callback) {
3222
+ var data = [];
3223
+ var self = this;
3224
+
3225
+ var $options = this.$element.children();
3226
+
3227
+ $options.each(function () {
3228
+ var $option = $(this);
3229
+
3230
+ if (!$option.is('option') && !$option.is('optgroup')) {
3231
+ return;
3232
+ }
3233
+
3234
+ var option = self.item($option);
3235
+
3236
+ var matches = self.matches(params, option);
3237
+
3238
+ if (matches !== null) {
3239
+ data.push(matches);
3240
+ }
3241
+ });
3242
+
3243
+ callback({
3244
+ results: data
3245
+ });
3246
+ };
3247
+
3248
+ SelectAdapter.prototype.addOptions = function ($options) {
3249
+ Utils.appendMany(this.$element, $options);
3250
+ };
3251
+
3252
+ SelectAdapter.prototype.option = function (data) {
3253
+ var option;
3254
+
3255
+ if (data.children) {
3256
+ option = document.createElement('optgroup');
3257
+ option.label = data.text;
3258
+ } else {
3259
+ option = document.createElement('option');
3260
+
3261
+ if (option.textContent !== undefined) {
3262
+ option.textContent = data.text;
3263
+ } else {
3264
+ option.innerText = data.text;
3265
+ }
3266
+ }
3267
+
3268
+ if (data.id !== undefined) {
3269
+ option.value = data.id;
3270
+ }
3271
+
3272
+ if (data.disabled) {
3273
+ option.disabled = true;
3274
+ }
3275
+
3276
+ if (data.selected) {
3277
+ option.selected = true;
3278
+ }
3279
+
3280
+ if (data.title) {
3281
+ option.title = data.title;
3282
+ }
3283
+
3284
+ var $option = $(option);
3285
+
3286
+ var normalizedData = this._normalizeItem(data);
3287
+ normalizedData.element = option;
3288
+
3289
+ // Override the option's data with the combined data
3290
+ $.data(option, 'data', normalizedData);
3291
+
3292
+ return $option;
3293
+ };
3294
+
3295
+ SelectAdapter.prototype.item = function ($option) {
3296
+ var data = {};
3297
+
3298
+ data = $.data($option[0], 'data');
3299
+
3300
+ if (data != null) {
3301
+ return data;
3302
+ }
3303
+
3304
+ if ($option.is('option')) {
3305
+ data = {
3306
+ id: $option.val(),
3307
+ text: $option.text(),
3308
+ disabled: $option.prop('disabled'),
3309
+ selected: $option.prop('selected'),
3310
+ title: $option.prop('title')
3311
+ };
3312
+ } else if ($option.is('optgroup')) {
3313
+ data = {
3314
+ text: $option.prop('label'),
3315
+ children: [],
3316
+ title: $option.prop('title')
3317
+ };
3318
+
3319
+ var $children = $option.children('option');
3320
+ var children = [];
3321
+
3322
+ for (var c = 0; c < $children.length; c++) {
3323
+ var $child = $($children[c]);
3324
+
3325
+ var child = this.item($child);
3326
+
3327
+ children.push(child);
3328
+ }
3329
+
3330
+ data.children = children;
3331
+ }
3332
+
3333
+ data = this._normalizeItem(data);
3334
+ data.element = $option[0];
3335
+
3336
+ $.data($option[0], 'data', data);
3337
+
3338
+ return data;
3339
+ };
3340
+
3341
+ SelectAdapter.prototype._normalizeItem = function (item) {
3342
+ if (!$.isPlainObject(item)) {
3343
+ item = {
3344
+ id: item,
3345
+ text: item
3346
+ };
3347
+ }
3348
+
3349
+ item = $.extend({}, {
3350
+ text: ''
3351
+ }, item);
3352
+
3353
+ var defaults = {
3354
+ selected: false,
3355
+ disabled: false
3356
+ };
3357
+
3358
+ if (item.id != null) {
3359
+ item.id = item.id.toString();
3360
+ }
3361
+
3362
+ if (item.text != null) {
3363
+ item.text = item.text.toString();
3364
+ }
3365
+
3366
+ if (item._resultId == null && item.id) {
3367
+ item._resultId = this.generateResultId(this.container, item);
3368
+ }
3369
+
3370
+ return $.extend({}, defaults, item);
3371
+ };
3372
+
3373
+ SelectAdapter.prototype.matches = function (params, data) {
3374
+ var matcher = this.options.get('matcher');
3375
+
3376
+ return matcher(params, data);
3377
+ };
3378
+
3379
+ return SelectAdapter;
3380
+ });
3381
+
3382
+ S2.define('select2/data/array',[
3383
+ './select',
3384
+ '../utils',
3385
+ 'jquery'
3386
+ ], function (SelectAdapter, Utils, $) {
3387
+ function ArrayAdapter ($element, options) {
3388
+ var data = options.get('data') || [];
3389
+
3390
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3391
+
3392
+ this.addOptions(this.convertToOptions(data));
3393
+ }
3394
+
3395
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3396
+
3397
+ ArrayAdapter.prototype.select = function (data) {
3398
+ var $option = this.$element.find('option').filter(function (i, elm) {
3399
+ return elm.value == data.id.toString();
3400
+ });
3401
+
3402
+ if ($option.length === 0) {
3403
+ $option = this.option(data);
3404
+
3405
+ this.addOptions($option);
3406
+ }
3407
+
3408
+ ArrayAdapter.__super__.select.call(this, data);
3409
+ };
3410
+
3411
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3412
+ var self = this;
3413
+
3414
+ var $existing = this.$element.find('option');
3415
+ var existingIds = $existing.map(function () {
3416
+ return self.item($(this)).id;
3417
+ }).get();
3418
+
3419
+ var $options = [];
3420
+
3421
+ // Filter out all items except for the one passed in the argument
3422
+ function onlyItem (item) {
3423
+ return function () {
3424
+ return $(this).val() == item.id;
3425
+ };
3426
+ }
3427
+
3428
+ for (var d = 0; d < data.length; d++) {
3429
+ var item = this._normalizeItem(data[d]);
3430
+
3431
+ // Skip items which were pre-loaded, only merge the data
3432
+ if ($.inArray(item.id, existingIds) >= 0) {
3433
+ var $existingOption = $existing.filter(onlyItem(item));
3434
+
3435
+ var existingData = this.item($existingOption);
3436
+ var newData = $.extend(true, {}, item, existingData);
3437
+
3438
+ var $newOption = this.option(newData);
3439
+
3440
+ $existingOption.replaceWith($newOption);
3441
+
3442
+ continue;
3443
+ }
3444
+
3445
+ var $option = this.option(item);
3446
+
3447
+ if (item.children) {
3448
+ var $children = this.convertToOptions(item.children);
3449
+
3450
+ Utils.appendMany($option, $children);
3451
+ }
3452
+
3453
+ $options.push($option);
3454
+ }
3455
+
3456
+ return $options;
3457
+ };
3458
+
3459
+ return ArrayAdapter;
3460
+ });
3461
+
3462
+ S2.define('select2/data/ajax',[
3463
+ './array',
3464
+ '../utils',
3465
+ 'jquery'
3466
+ ], function (ArrayAdapter, Utils, $) {
3467
+ function AjaxAdapter ($element, options) {
3468
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3469
+
3470
+ if (this.ajaxOptions.processResults != null) {
3471
+ this.processResults = this.ajaxOptions.processResults;
3472
+ }
3473
+
3474
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3475
+ }
3476
+
3477
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3478
+
3479
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3480
+ var defaults = {
3481
+ data: function (params) {
3482
+ return $.extend({}, params, {
3483
+ q: params.term
3484
+ });
3485
+ },
3486
+ transport: function (params, success, failure) {
3487
+ var $request = $.ajax(params);
3488
+
3489
+ $request.then(success);
3490
+ $request.fail(failure);
3491
+
3492
+ return $request;
3493
+ }
3494
+ };
3495
+
3496
+ return $.extend({}, defaults, options, true);
3497
+ };
3498
+
3499
+ AjaxAdapter.prototype.processResults = function (results) {
3500
+ return results;
3501
+ };
3502
+
3503
+ AjaxAdapter.prototype.query = function (params, callback) {
3504
+ var matches = [];
3505
+ var self = this;
3506
+
3507
+ if (this._request != null) {
3508
+ // JSONP requests cannot always be aborted
3509
+ if ($.isFunction(this._request.abort)) {
3510
+ this._request.abort();
3511
+ }
3512
+
3513
+ this._request = null;
3514
+ }
3515
+
3516
+ var options = $.extend({
3517
+ type: 'GET'
3518
+ }, this.ajaxOptions);
3519
+
3520
+ if (typeof options.url === 'function') {
3521
+ options.url = options.url.call(this.$element, params);
3522
+ }
3523
+
3524
+ if (typeof options.data === 'function') {
3525
+ options.data = options.data.call(this.$element, params);
3526
+ }
3527
+
3528
+ function request () {
3529
+ var $request = options.transport(options, function (data) {
3530
+ var results = self.processResults(data, params);
3531
+
3532
+ if (self.options.get('debug') && window.console && console.error) {
3533
+ // Check to make sure that the response included a `results` key.
3534
+ if (!results || !results.results || !$.isArray(results.results)) {
3535
+ console.error(
3536
+ 'Select2: The AJAX results did not return an array in the ' +
3537
+ '`results` key of the response.'
3538
+ );
3539
+ }
3540
+ }
3541
+
3542
+ callback(results);
3543
+ self.container.focusOnActiveElement();
3544
+ }, function () {
3545
+ // Attempt to detect if a request was aborted
3546
+ // Only works if the transport exposes a status property
3547
+ if ($request.status && $request.status === '0') {
3548
+ return;
3549
+ }
3550
+
3551
+ self.trigger('results:message', {
3552
+ message: 'errorLoading'
3553
+ });
3554
+ });
3555
+
3556
+ self._request = $request;
3557
+ }
3558
+
3559
+ if (this.ajaxOptions.delay && params.term != null) {
3560
+ if (this._queryTimeout) {
3561
+ window.clearTimeout(this._queryTimeout);
3562
+ }
3563
+
3564
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3565
+ } else {
3566
+ request();
3567
+ }
3568
+ };
3569
+
3570
+ return AjaxAdapter;
3571
+ });
3572
+
3573
+ S2.define('select2/data/tags',[
3574
+ 'jquery'
3575
+ ], function ($) {
3576
+ function Tags (decorated, $element, options) {
3577
+ var tags = options.get('tags');
3578
+
3579
+ var createTag = options.get('createTag');
3580
+
3581
+ if (createTag !== undefined) {
3582
+ this.createTag = createTag;
3583
+ }
3584
+
3585
+ var insertTag = options.get('insertTag');
3586
+
3587
+ if (insertTag !== undefined) {
3588
+ this.insertTag = insertTag;
3589
+ }
3590
+
3591
+ decorated.call(this, $element, options);
3592
+
3593
+ if ($.isArray(tags)) {
3594
+ for (var t = 0; t < tags.length; t++) {
3595
+ var tag = tags[t];
3596
+ var item = this._normalizeItem(tag);
3597
+
3598
+ var $option = this.option(item);
3599
+
3600
+ this.$element.append($option);
3601
+ }
3602
+ }
3603
+ }
3604
+
3605
+ Tags.prototype.query = function (decorated, params, callback) {
3606
+ var self = this;
3607
+
3608
+ this._removeOldTags();
3609
+
3610
+ if (params.term == null || params.page != null) {
3611
+ decorated.call(this, params, callback);
3612
+ return;
3613
+ }
3614
+
3615
+ function wrapper (obj, child) {
3616
+ var data = obj.results;
3617
+
3618
+ for (var i = 0; i < data.length; i++) {
3619
+ var option = data[i];
3620
+
3621
+ var checkChildren = (
3622
+ option.children != null &&
3623
+ !wrapper({
3624
+ results: option.children
3625
+ }, true)
3626
+ );
3627
+
3628
+ var optionText = (option.text || '').toUpperCase();
3629
+ var paramsTerm = (params.term || '').toUpperCase();
3630
+
3631
+ var checkText = optionText === paramsTerm;
3632
+
3633
+ if (checkText || checkChildren) {
3634
+ if (child) {
3635
+ return false;
3636
+ }
3637
+
3638
+ obj.data = data;
3639
+ callback(obj);
3640
+
3641
+ return;
3642
+ }
3643
+ }
3644
+
3645
+ if (child) {
3646
+ return true;
3647
+ }
3648
+
3649
+ var tag = self.createTag(params);
3650
+
3651
+ if (tag != null) {
3652
+ var $option = self.option(tag);
3653
+ $option.attr('data-select2-tag', true);
3654
+
3655
+ self.addOptions([$option]);
3656
+
3657
+ self.insertTag(data, tag);
3658
+ }
3659
+
3660
+ obj.results = data;
3661
+
3662
+ callback(obj);
3663
+ }
3664
+
3665
+ decorated.call(this, params, wrapper);
3666
+ };
3667
+
3668
+ Tags.prototype.createTag = function (decorated, params) {
3669
+ var term = $.trim(params.term);
3670
+
3671
+ if (term === '') {
3672
+ return null;
3673
+ }
3674
+
3675
+ return {
3676
+ id: term,
3677
+ text: term
3678
+ };
3679
+ };
3680
+
3681
+ Tags.prototype.insertTag = function (_, data, tag) {
3682
+ data.unshift(tag);
3683
+ };
3684
+
3685
+ Tags.prototype._removeOldTags = function (_) {
3686
+ var tag = this._lastTag;
3687
+
3688
+ var $options = this.$element.find('option[data-select2-tag]');
3689
+
3690
+ $options.each(function () {
3691
+ if (this.selected) {
3692
+ return;
3693
+ }
3694
+
3695
+ $(this).remove();
3696
+ });
3697
+ };
3698
+
3699
+ return Tags;
3700
+ });
3701
+
3702
+ S2.define('select2/data/tokenizer',[
3703
+ 'jquery'
3704
+ ], function ($) {
3705
+ function Tokenizer (decorated, $element, options) {
3706
+ var tokenizer = options.get('tokenizer');
3707
+
3708
+ if (tokenizer !== undefined) {
3709
+ this.tokenizer = tokenizer;
3710
+ }
3711
+
3712
+ decorated.call(this, $element, options);
3713
+ }
3714
+
3715
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3716
+ decorated.call(this, container, $container);
3717
+
3718
+ this.$search = container.dropdown.$search || container.selection.$search ||
3719
+ $container.find('.select2-search__field');
3720
+ };
3721
+
3722
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3723
+ var self = this;
3724
+
3725
+ function createAndSelect (data) {
3726
+ // Normalize the data object so we can use it for checks
3727
+ var item = self._normalizeItem(data);
3728
+
3729
+ // Check if the data object already exists as a tag
3730
+ // Select it if it doesn't
3731
+ var $existingOptions = self.$element.find('option').filter(function () {
3732
+ return $(this).val() === item.id;
3733
+ });
3734
+
3735
+ // If an existing option wasn't found for it, create the option
3736
+ if (!$existingOptions.length) {
3737
+ var $option = self.option(item);
3738
+ $option.attr('data-select2-tag', true);
3739
+
3740
+ self._removeOldTags();
3741
+ self.addOptions([$option]);
3742
+ }
3743
+
3744
+ // Select the item, now that we know there is an option for it
3745
+ select(item);
3746
+ }
3747
+
3748
+ function select (data) {
3749
+ self.trigger('select', {
3750
+ data: data
3751
+ });
3752
+ }
3753
+
3754
+ params.term = params.term || '';
3755
+
3756
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3757
+
3758
+ if (tokenData.term !== params.term) {
3759
+ // Replace the search term if we have the search box
3760
+ if (this.$search.length) {
3761
+ this.$search.val(tokenData.term);
3762
+ this.$search.focus();
3763
+ }
3764
+
3765
+ params.term = tokenData.term;
3766
+ }
3767
+
3768
+ decorated.call(this, params, callback);
3769
+ };
3770
+
3771
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3772
+ var separators = options.get('tokenSeparators') || [];
3773
+ var term = params.term;
3774
+ var i = 0;
3775
+
3776
+ var createTag = this.createTag || function (params) {
3777
+ return {
3778
+ id: params.term,
3779
+ text: params.term
3780
+ };
3781
+ };
3782
+
3783
+ while (i < term.length) {
3784
+ var termChar = term[i];
3785
+
3786
+ if ($.inArray(termChar, separators) === -1) {
3787
+ i++;
3788
+
3789
+ continue;
3790
+ }
3791
+
3792
+ var part = term.substr(0, i);
3793
+ var partParams = $.extend({}, params, {
3794
+ term: part
3795
+ });
3796
+
3797
+ var data = createTag(partParams);
3798
+
3799
+ if (data == null) {
3800
+ i++;
3801
+ continue;
3802
+ }
3803
+
3804
+ callback(data);
3805
+
3806
+ // Reset the term to not include the tokenized portion
3807
+ term = term.substr(i + 1) || '';
3808
+ i = 0;
3809
+ }
3810
+
3811
+ return {
3812
+ term: term
3813
+ };
3814
+ };
3815
+
3816
+ return Tokenizer;
3817
+ });
3818
+
3819
+ S2.define('select2/data/minimumInputLength',[
3820
+
3821
+ ], function () {
3822
+ function MinimumInputLength (decorated, $e, options) {
3823
+ this.minimumInputLength = options.get('minimumInputLength');
3824
+
3825
+ decorated.call(this, $e, options);
3826
+ }
3827
+
3828
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3829
+ params.term = params.term || '';
3830
+
3831
+ if (params.term.length < this.minimumInputLength) {
3832
+ this.trigger('results:message', {
3833
+ message: 'inputTooShort',
3834
+ args: {
3835
+ minimum: this.minimumInputLength,
3836
+ input: params.term,
3837
+ params: params
3838
+ }
3839
+ });
3840
+
3841
+ return;
3842
+ }
3843
+
3844
+ decorated.call(this, params, callback);
3845
+ };
3846
+
3847
+ return MinimumInputLength;
3848
+ });
3849
+
3850
+ S2.define('select2/data/maximumInputLength',[
3851
+
3852
+ ], function () {
3853
+ function MaximumInputLength (decorated, $e, options) {
3854
+ this.maximumInputLength = options.get('maximumInputLength');
3855
+
3856
+ decorated.call(this, $e, options);
3857
+ }
3858
+
3859
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3860
+ params.term = params.term || '';
3861
+
3862
+ if (this.maximumInputLength > 0 &&
3863
+ params.term.length > this.maximumInputLength) {
3864
+ this.trigger('results:message', {
3865
+ message: 'inputTooLong',
3866
+ args: {
3867
+ maximum: this.maximumInputLength,
3868
+ input: params.term,
3869
+ params: params
3870
+ }
3871
+ });
3872
+
3873
+ return;
3874
+ }
3875
+
3876
+ decorated.call(this, params, callback);
3877
+ };
3878
+
3879
+ return MaximumInputLength;
3880
+ });
3881
+
3882
+ S2.define('select2/data/maximumSelectionLength',[
3883
+
3884
+ ], function (){
3885
+ function MaximumSelectionLength (decorated, $e, options) {
3886
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3887
+
3888
+ decorated.call(this, $e, options);
3889
+ }
3890
+
3891
+ MaximumSelectionLength.prototype.query =
3892
+ function (decorated, params, callback) {
3893
+ var self = this;
3894
+
3895
+ this.current(function (currentData) {
3896
+ var count = currentData != null ? currentData.length : 0;
3897
+ if (self.maximumSelectionLength > 0 &&
3898
+ count >= self.maximumSelectionLength) {
3899
+ self.trigger('results:message', {
3900
+ message: 'maximumSelected',
3901
+ args: {
3902
+ maximum: self.maximumSelectionLength
3903
+ }
3904
+ });
3905
+ return;
3906
+ }
3907
+ decorated.call(self, params, callback);
3908
+ });
3909
+ };
3910
+
3911
+ return MaximumSelectionLength;
3912
+ });
3913
+
3914
+ S2.define('select2/dropdown',[
3915
+ 'jquery',
3916
+ './utils'
3917
+ ], function ($, Utils) {
3918
+ function Dropdown ($element, options) {
3919
+ this.$element = $element;
3920
+ this.options = options;
3921
+
3922
+ Dropdown.__super__.constructor.call(this);
3923
+ }
3924
+
3925
+ Utils.Extend(Dropdown, Utils.Observable);
3926
+
3927
+ Dropdown.prototype.render = function () {
3928
+ var $dropdown = $(
3929
+ '<span class="select2-dropdown">' +
3930
+ '<span class="select2-results"></span>' +
3931
+ '</span>'
3932
+ );
3933
+
3934
+ $dropdown.attr('dir', this.options.get('dir'));
3935
+
3936
+ this.$dropdown = $dropdown;
3937
+
3938
+ return $dropdown;
3939
+ };
3940
+
3941
+ Dropdown.prototype.bind = function () {
3942
+ // Should be implemented in subclasses
3943
+ };
3944
+
3945
+ Dropdown.prototype.position = function ($dropdown, $container) {
3946
+ // Should be implmented in subclasses
3947
+ };
3948
+
3949
+ Dropdown.prototype.destroy = function () {
3950
+ // Remove the dropdown from the DOM
3951
+ this.$dropdown.remove();
3952
+ };
3953
+
3954
+ return Dropdown;
3955
+ });
3956
+
3957
+ S2.define('select2/dropdown/search',[
3958
+ 'jquery',
3959
+ '../utils'
3960
+ ], function ($, Utils) {
3961
+ function Search () { }
3962
+
3963
+ Search.prototype.render = function (decorated) {
3964
+ var $rendered = decorated.call(this);
3965
+
3966
+ var $search = $(
3967
+ '<span class="select2-search select2-search--dropdown">' +
3968
+ '<input class="select2-search__field" type="text" tabindex="-1"' +
3969
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
3970
+ ' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
3971
+ '</span>'
3972
+ );
3973
+
3974
+ this.$searchContainer = $search;
3975
+ this.$search = $search.find('input');
3976
+
3977
+ $rendered.prepend($search);
3978
+
3979
+ return $rendered;
3980
+ };
3981
+
3982
+ Search.prototype.bind = function (decorated, container, $container) {
3983
+ var self = this;
3984
+ var resultsId = container.id + '-results';
3985
+
3986
+ decorated.call(this, container, $container);
3987
+
3988
+ this.$search.on('keydown', function (evt) {
3989
+ self.trigger('keypress', evt);
3990
+
3991
+ self._keyUpPrevented = evt.isDefaultPrevented();
3992
+ });
3993
+
3994
+ // Workaround for browsers which do not support the `input` event
3995
+ // This will prevent double-triggering of events for browsers which support
3996
+ // both the `keyup` and `input` events.
3997
+ this.$search.on('input', function (evt) {
3998
+ // Unbind the duplicated `keyup` event
3999
+ $(this).off('keyup');
4000
+ });
4001
+
4002
+ this.$search.on('keyup input', function (evt) {
4003
+ self.handleSearch(evt);
4004
+ });
4005
+
4006
+ container.on('open', function () {
4007
+ self.$search.attr('tabindex', 0);
4008
+ self.$search.attr('aria-owns', resultsId);
4009
+ self.$search.focus();
4010
+
4011
+ window.setTimeout(function () {
4012
+ self.$search.focus();
4013
+ }, 0);
4014
+ });
4015
+
4016
+ container.on('close', function () {
4017
+ self.$search.attr('tabindex', -1);
4018
+ self.$search.removeAttr('aria-activedescendant');
4019
+ self.$search.removeAttr('aria-owns');
4020
+ self.$search.val('');
4021
+ });
4022
+
4023
+ container.on('focus', function () {
4024
+ if (container.isOpen()) {
4025
+ self.$search.focus();
4026
+ }
4027
+ });
4028
+
4029
+ container.on('results:all', function (params) {
4030
+ if (params.query.term == null || params.query.term === '') {
4031
+ var showSearch = self.showSearch(params);
4032
+
4033
+ if (showSearch) {
4034
+ self.$searchContainer.removeClass('select2-search--hide');
4035
+ } else {
4036
+ self.$searchContainer.addClass('select2-search--hide');
4037
+ }
4038
+ }
4039
+ });
4040
+
4041
+ container.on('results:focus', function (params) {
4042
+ self.$search.attr('aria-activedescendant', params.data._resultId);
4043
+ });
4044
+ };
4045
+
4046
+ Search.prototype.handleSearch = function (evt) {
4047
+ if (!this._keyUpPrevented) {
4048
+ var input = this.$search.val();
4049
+
4050
+ this.trigger('query', {
4051
+ term: input
4052
+ });
4053
+ }
4054
+
4055
+ this._keyUpPrevented = false;
4056
+ };
4057
+
4058
+ Search.prototype.showSearch = function (_, params) {
4059
+ return true;
4060
+ };
4061
+
4062
+ return Search;
4063
+ });
4064
+
4065
+ S2.define('select2/dropdown/hidePlaceholder',[
4066
+
4067
+ ], function () {
4068
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4069
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4070
+
4071
+ decorated.call(this, $element, options, dataAdapter);
4072
+ }
4073
+
4074
+ HidePlaceholder.prototype.append = function (decorated, data) {
4075
+ data.results = this.removePlaceholder(data.results);
4076
+
4077
+ decorated.call(this, data);
4078
+ };
4079
+
4080
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4081
+ if (typeof placeholder === 'string') {
4082
+ placeholder = {
4083
+ id: '',
4084
+ text: placeholder
4085
+ };
4086
+ }
4087
+
4088
+ return placeholder;
4089
+ };
4090
+
4091
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4092
+ var modifiedData = data.slice(0);
4093
+
4094
+ for (var d = data.length - 1; d >= 0; d--) {
4095
+ var item = data[d];
4096
+
4097
+ if (this.placeholder.id === item.id) {
4098
+ modifiedData.splice(d, 1);
4099
+ }
4100
+ }
4101
+
4102
+ return modifiedData;
4103
+ };
4104
+
4105
+ return HidePlaceholder;
4106
+ });
4107
+
4108
+ S2.define('select2/dropdown/infiniteScroll',[
4109
+ 'jquery'
4110
+ ], function ($) {
4111
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4112
+ this.lastParams = {};
4113
+
4114
+ decorated.call(this, $element, options, dataAdapter);
4115
+
4116
+ this.$loadingMore = this.createLoadingMore();
4117
+ this.loading = false;
4118
+ }
4119
+
4120
+ InfiniteScroll.prototype.append = function (decorated, data) {
4121
+ this.$loadingMore.remove();
4122
+ this.loading = false;
4123
+
4124
+ decorated.call(this, data);
4125
+
4126
+ if (this.showLoadingMore(data)) {
4127
+ this.$results.append(this.$loadingMore);
4128
+ }
4129
+ };
4130
+
4131
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4132
+ var self = this;
4133
+
4134
+ decorated.call(this, container, $container);
4135
+
4136
+ container.on('query', function (params) {
4137
+ self.lastParams = params;
4138
+ self.loading = true;
4139
+ });
4140
+
4141
+ container.on('query:append', function (params) {
4142
+ self.lastParams = params;
4143
+ self.loading = true;
4144
+ });
4145
+
4146
+ this.$results.on('scroll', function () {
4147
+ var isLoadMoreVisible = $.contains(
4148
+ document.documentElement,
4149
+ self.$loadingMore[0]
4150
+ );
4151
+
4152
+ if (self.loading || !isLoadMoreVisible) {
4153
+ return;
4154
+ }
4155
+
4156
+ var currentOffset = self.$results.offset().top +
4157
+ self.$results.outerHeight(false);
4158
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4159
+ self.$loadingMore.outerHeight(false);
4160
+
4161
+ if (currentOffset + 50 >= loadingMoreOffset) {
4162
+ self.loadMore();
4163
+ }
4164
+ });
4165
+ };
4166
+
4167
+ InfiniteScroll.prototype.loadMore = function () {
4168
+ this.loading = true;
4169
+
4170
+ var params = $.extend({}, {page: 1}, this.lastParams);
4171
+
4172
+ params.page++;
4173
+
4174
+ this.trigger('query:append', params);
4175
+ };
4176
+
4177
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4178
+ return data.pagination && data.pagination.more;
4179
+ };
4180
+
4181
+ InfiniteScroll.prototype.createLoadingMore = function () {
4182
+ var $option = $(
4183
+ '<li ' +
4184
+ 'class="select2-results__option select2-results__option--load-more"' +
4185
+ 'role="option" aria-disabled="true"></li>'
4186
+ );
4187
+
4188
+ var message = this.options.get('translations').get('loadingMore');
4189
+
4190
+ $option.html(message(this.lastParams));
4191
+
4192
+ return $option;
4193
+ };
4194
+
4195
+ return InfiniteScroll;
4196
+ });
4197
+
4198
+ S2.define('select2/dropdown/attachBody',[
4199
+ 'jquery',
4200
+ '../utils'
4201
+ ], function ($, Utils) {
4202
+ function AttachBody (decorated, $element, options) {
4203
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4204
+
4205
+ decorated.call(this, $element, options);
4206
+ }
4207
+
4208
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4209
+ var self = this;
4210
+
4211
+ var setupResultsEvents = false;
4212
+
4213
+ decorated.call(this, container, $container);
4214
+
4215
+ container.on('open', function () {
4216
+ self._showDropdown();
4217
+ self._attachPositioningHandler(container);
4218
+
4219
+ if (!setupResultsEvents) {
4220
+ setupResultsEvents = true;
4221
+
4222
+ container.on('results:all', function () {
4223
+ self._positionDropdown();
4224
+ self._resizeDropdown();
4225
+ });
4226
+
4227
+ container.on('results:append', function () {
4228
+ self._positionDropdown();
4229
+ self._resizeDropdown();
4230
+ });
4231
+ }
4232
+ });
4233
+
4234
+ container.on('close', function () {
4235
+ self._hideDropdown();
4236
+ self._detachPositioningHandler(container);
4237
+ });
4238
+
4239
+ this.$dropdownContainer.on('mousedown', function (evt) {
4240
+ evt.stopPropagation();
4241
+ });
4242
+ };
4243
+
4244
+ AttachBody.prototype.destroy = function (decorated) {
4245
+ decorated.call(this);
4246
+
4247
+ this.$dropdownContainer.remove();
4248
+ };
4249
+
4250
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4251
+ // Clone all of the container classes
4252
+ $dropdown.attr('class', $container.attr('class'));
4253
+
4254
+ $dropdown.removeClass('select2');
4255
+ $dropdown.addClass('select2-container--open');
4256
+
4257
+ $dropdown.css({
4258
+ position: 'absolute',
4259
+ top: -999999
4260
+ });
4261
+
4262
+ this.$container = $container;
4263
+ };
4264
+
4265
+ AttachBody.prototype.render = function (decorated) {
4266
+ var $container = $('<span></span>');
4267
+
4268
+ var $dropdown = decorated.call(this);
4269
+ $container.append($dropdown);
4270
+
4271
+ this.$dropdownContainer = $container;
4272
+
4273
+ return $container;
4274
+ };
4275
+
4276
+ AttachBody.prototype._hideDropdown = function (decorated) {
4277
+ this.$dropdownContainer.detach();
4278
+ };
4279
+
4280
+ AttachBody.prototype._attachPositioningHandler =
4281
+ function (decorated, container) {
4282
+ var self = this;
4283
+
4284
+ var scrollEvent = 'scroll.select2.' + container.id;
4285
+ var resizeEvent = 'resize.select2.' + container.id;
4286
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4287
+
4288
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4289
+ $watchers.each(function () {
4290
+ $(this).data('select2-scroll-position', {
4291
+ x: $(this).scrollLeft(),
4292
+ y: $(this).scrollTop()
4293
+ });
4294
+ });
4295
+
4296
+ $watchers.on(scrollEvent, function (ev) {
4297
+ var position = $(this).data('select2-scroll-position');
4298
+ $(this).scrollTop(position.y);
4299
+ });
4300
+
4301
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4302
+ function (e) {
4303
+ self._positionDropdown();
4304
+ self._resizeDropdown();
4305
+ });
4306
+ };
4307
+
4308
+ AttachBody.prototype._detachPositioningHandler =
4309
+ function (decorated, container) {
4310
+ var scrollEvent = 'scroll.select2.' + container.id;
4311
+ var resizeEvent = 'resize.select2.' + container.id;
4312
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4313
+
4314
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4315
+ $watchers.off(scrollEvent);
4316
+
4317
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4318
+ };
4319
+
4320
+ AttachBody.prototype._positionDropdown = function () {
4321
+ var $window = $(window);
4322
+
4323
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4324
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4325
+
4326
+ var newDirection = null;
4327
+
4328
+ var offset = this.$container.offset();
4329
+
4330
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4331
+
4332
+ var container = {
4333
+ height: this.$container.outerHeight(false)
4334
+ };
4335
+
4336
+ container.top = offset.top;
4337
+ container.bottom = offset.top + container.height;
4338
+
4339
+ var dropdown = {
4340
+ height: this.$dropdown.outerHeight(false)
4341
+ };
4342
+
4343
+ var viewport = {
4344
+ top: $window.scrollTop(),
4345
+ bottom: $window.scrollTop() + $window.height()
4346
+ };
4347
+
4348
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4349
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4350
+
4351
+ var css = {
4352
+ left: offset.left,
4353
+ top: container.bottom
4354
+ };
4355
+
4356
+ // Determine what the parent element is to use for calciulating the offset
4357
+ var $offsetParent = this.$dropdownParent;
4358
+
4359
+ // For statically positoned elements, we need to get the element
4360
+ // that is determining the offset
4361
+ if ($offsetParent.css('position') === 'static') {
4362
+ $offsetParent = $offsetParent.offsetParent();
4363
+ }
4364
+
4365
+ var parentOffset = $offsetParent.offset();
4366
+
4367
+ css.top -= parentOffset.top;
4368
+ css.left -= parentOffset.left;
4369
+
4370
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4371
+ newDirection = 'below';
4372
+ }
4373
+
4374
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4375
+ newDirection = 'above';
4376
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4377
+ newDirection = 'below';
4378
+ }
4379
+
4380
+ if (newDirection == 'above' ||
4381
+ (isCurrentlyAbove && newDirection !== 'below')) {
4382
+ css.top = container.top - parentOffset.top - dropdown.height;
4383
+ }
4384
+
4385
+ if (newDirection != null) {
4386
+ this.$dropdown
4387
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4388
+ .addClass('select2-dropdown--' + newDirection);
4389
+ this.$container
4390
+ .removeClass('select2-container--below select2-container--above')
4391
+ .addClass('select2-container--' + newDirection);
4392
+ }
4393
+
4394
+ this.$dropdownContainer.css(css);
4395
+ };
4396
+
4397
+ AttachBody.prototype._resizeDropdown = function () {
4398
+ var css = {
4399
+ width: this.$container.outerWidth(false) + 'px'
4400
+ };
4401
+
4402
+ if (this.options.get('dropdownAutoWidth')) {
4403
+ css.minWidth = css.width;
4404
+ css.position = 'relative';
4405
+ css.width = 'auto';
4406
+ }
4407
+
4408
+ this.$dropdown.css(css);
4409
+ };
4410
+
4411
+ AttachBody.prototype._showDropdown = function (decorated) {
4412
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4413
+
4414
+ this._positionDropdown();
4415
+ this._resizeDropdown();
4416
+ };
4417
+
4418
+ return AttachBody;
4419
+ });
4420
+
4421
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4422
+
4423
+ ], function () {
4424
+ function countResults (data) {
4425
+ var count = 0;
4426
+
4427
+ for (var d = 0; d < data.length; d++) {
4428
+ var item = data[d];
4429
+
4430
+ if (item.children) {
4431
+ count += countResults(item.children);
4432
+ } else {
4433
+ count++;
4434
+ }
4435
+ }
4436
+
4437
+ return count;
4438
+ }
4439
+
4440
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4441
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4442
+
4443
+ if (this.minimumResultsForSearch < 0) {
4444
+ this.minimumResultsForSearch = Infinity;
4445
+ }
4446
+
4447
+ decorated.call(this, $element, options, dataAdapter);
4448
+ }
4449
+
4450
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4451
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4452
+ return false;
4453
+ }
4454
+
4455
+ return decorated.call(this, params);
4456
+ };
4457
+
4458
+ return MinimumResultsForSearch;
4459
+ });
4460
+
4461
+ S2.define('select2/dropdown/selectOnClose',[
4462
+
4463
+ ], function () {
4464
+ function SelectOnClose () { }
4465
+
4466
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4467
+ var self = this;
4468
+
4469
+ decorated.call(this, container, $container);
4470
+
4471
+ container.on('close', function (params) {
4472
+ self._handleSelectOnClose(params);
4473
+ });
4474
+ };
4475
+
4476
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4477
+ if (params && params.originalSelect2Event != null) {
4478
+ var event = params.originalSelect2Event;
4479
+
4480
+ // Don't select an item if the close event was triggered from a select or
4481
+ // unselect event
4482
+ if (event._type === 'select' || event._type === 'unselect') {
4483
+ return;
4484
+ }
4485
+ }
4486
+
4487
+ var $highlightedResults = this.getHighlightedResults();
4488
+
4489
+ // Only select highlighted results
4490
+ if ($highlightedResults.length < 1) {
4491
+ return;
4492
+ }
4493
+
4494
+ var data = $highlightedResults.data('data');
4495
+
4496
+ // Don't re-select already selected resulte
4497
+ if (
4498
+ (data.element != null && data.element.selected) ||
4499
+ (data.element == null && data.selected)
4500
+ ) {
4501
+ return;
4502
+ }
4503
+
4504
+ this.trigger('select', {
4505
+ data: data
4506
+ });
4507
+ };
4508
+
4509
+ return SelectOnClose;
4510
+ });
4511
+
4512
+ S2.define('select2/dropdown/closeOnSelect',[
4513
+
4514
+ ], function () {
4515
+ function CloseOnSelect () { }
4516
+
4517
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4518
+ var self = this;
4519
+
4520
+ decorated.call(this, container, $container);
4521
+
4522
+ container.on('select', function (evt) {
4523
+ self._selectTriggered(evt);
4524
+ });
4525
+
4526
+ container.on('unselect', function (evt) {
4527
+ self._selectTriggered(evt);
4528
+ });
4529
+ };
4530
+
4531
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4532
+ var originalEvent = evt.originalEvent;
4533
+
4534
+ // Don't close if the control key is being held
4535
+ if (originalEvent && originalEvent.ctrlKey) {
4536
+ return;
4537
+ }
4538
+
4539
+ this.trigger('close', {
4540
+ originalEvent: originalEvent,
4541
+ originalSelect2Event: evt
4542
+ });
4543
+ };
4544
+
4545
+ return CloseOnSelect;
4546
+ });
4547
+
4548
+ S2.define('select2/i18n/en',[],function () {
4549
+ // English
4550
+ return {
4551
+ errorLoading: function () {
4552
+ return 'The results could not be loaded.';
4553
+ },
4554
+ inputTooLong: function (args) {
4555
+ var overChars = args.input.length - args.maximum;
4556
+
4557
+ var message = 'Please delete ' + overChars + ' character';
4558
+
4559
+ if (overChars != 1) {
4560
+ message += 's';
4561
+ }
4562
+
4563
+ return message;
4564
+ },
4565
+ inputTooShort: function (args) {
4566
+ var remainingChars = args.minimum - args.input.length;
4567
+
4568
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4569
+
4570
+ return message;
4571
+ },
4572
+ loadingMore: function () {
4573
+ return 'Loading more results…';
4574
+ },
4575
+ maximumSelected: function (args) {
4576
+ var message = 'You can only select ' + args.maximum + ' item';
4577
+
4578
+ if (args.maximum != 1) {
4579
+ message += 's';
4580
+ }
4581
+
4582
+ return message;
4583
+ },
4584
+ noResults: function () {
4585
+ return 'No results found';
4586
+ },
4587
+ searching: function () {
4588
+ return 'Searching…';
4589
+ }
4590
+ };
4591
+ });
4592
+
4593
+ S2.define('select2/defaults',[
4594
+ 'jquery',
4595
+ 'require',
4596
+
4597
+ './results',
4598
+
4599
+ './selection/single',
4600
+ './selection/multiple',
4601
+ './selection/placeholder',
4602
+ './selection/allowClear',
4603
+ './selection/search',
4604
+ './selection/eventRelay',
4605
+
4606
+ './utils',
4607
+ './translation',
4608
+ './diacritics',
4609
+
4610
+ './data/select',
4611
+ './data/array',
4612
+ './data/ajax',
4613
+ './data/tags',
4614
+ './data/tokenizer',
4615
+ './data/minimumInputLength',
4616
+ './data/maximumInputLength',
4617
+ './data/maximumSelectionLength',
4618
+
4619
+ './dropdown',
4620
+ './dropdown/search',
4621
+ './dropdown/hidePlaceholder',
4622
+ './dropdown/infiniteScroll',
4623
+ './dropdown/attachBody',
4624
+ './dropdown/minimumResultsForSearch',
4625
+ './dropdown/selectOnClose',
4626
+ './dropdown/closeOnSelect',
4627
+
4628
+ './i18n/en'
4629
+ ], function ($, require,
4630
+
4631
+ ResultsList,
4632
+
4633
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4634
+ SelectionSearch, EventRelay,
4635
+
4636
+ Utils, Translation, DIACRITICS,
4637
+
4638
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4639
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4640
+
4641
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4642
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4643
+
4644
+ EnglishTranslation) {
4645
+ function Defaults () {
4646
+ this.reset();
4647
+ }
4648
+
4649
+ Defaults.prototype.apply = function (options) {
4650
+ options = $.extend(true, {}, this.defaults, options);
4651
+
4652
+ if (options.dataAdapter == null) {
4653
+ if (options.ajax != null) {
4654
+ options.dataAdapter = AjaxData;
4655
+ } else if (options.data != null) {
4656
+ options.dataAdapter = ArrayData;
4657
+ } else {
4658
+ options.dataAdapter = SelectData;
4659
+ }
4660
+
4661
+ if (options.minimumInputLength > 0) {
4662
+ options.dataAdapter = Utils.Decorate(
4663
+ options.dataAdapter,
4664
+ MinimumInputLength
4665
+ );
4666
+ }
4667
+
4668
+ if (options.maximumInputLength > 0) {
4669
+ options.dataAdapter = Utils.Decorate(
4670
+ options.dataAdapter,
4671
+ MaximumInputLength
4672
+ );
4673
+ }
4674
+
4675
+ if (options.maximumSelectionLength > 0) {
4676
+ options.dataAdapter = Utils.Decorate(
4677
+ options.dataAdapter,
4678
+ MaximumSelectionLength
4679
+ );
4680
+ }
4681
+
4682
+ if (options.tags) {
4683
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4684
+ }
4685
+
4686
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4687
+ options.dataAdapter = Utils.Decorate(
4688
+ options.dataAdapter,
4689
+ Tokenizer
4690
+ );
4691
+ }
4692
+
4693
+ if (options.query != null) {
4694
+ var Query = require(options.amdBase + 'compat/query');
4695
+
4696
+ options.dataAdapter = Utils.Decorate(
4697
+ options.dataAdapter,
4698
+ Query
4699
+ );
4700
+ }
4701
+
4702
+ if (options.initSelection != null) {
4703
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
4704
+
4705
+ options.dataAdapter = Utils.Decorate(
4706
+ options.dataAdapter,
4707
+ InitSelection
4708
+ );
4709
+ }
4710
+ }
4711
+
4712
+ if (options.resultsAdapter == null) {
4713
+ options.resultsAdapter = ResultsList;
4714
+
4715
+ if (options.ajax != null) {
4716
+ options.resultsAdapter = Utils.Decorate(
4717
+ options.resultsAdapter,
4718
+ InfiniteScroll
4719
+ );
4720
+ }
4721
+
4722
+ if (options.placeholder != null) {
4723
+ options.resultsAdapter = Utils.Decorate(
4724
+ options.resultsAdapter,
4725
+ HidePlaceholder
4726
+ );
4727
+ }
4728
+
4729
+ if (options.selectOnClose) {
4730
+ options.resultsAdapter = Utils.Decorate(
4731
+ options.resultsAdapter,
4732
+ SelectOnClose
4733
+ );
4734
+ }
4735
+ }
4736
+
4737
+ if (options.dropdownAdapter == null) {
4738
+ if (options.multiple) {
4739
+ options.dropdownAdapter = Dropdown;
4740
+ } else {
4741
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4742
+
4743
+ options.dropdownAdapter = SearchableDropdown;
4744
+ }
4745
+
4746
+ if (options.minimumResultsForSearch !== 0) {
4747
+ options.dropdownAdapter = Utils.Decorate(
4748
+ options.dropdownAdapter,
4749
+ MinimumResultsForSearch
4750
+ );
4751
+ }
4752
+
4753
+ if (options.closeOnSelect) {
4754
+ options.dropdownAdapter = Utils.Decorate(
4755
+ options.dropdownAdapter,
4756
+ CloseOnSelect
4757
+ );
4758
+ }
4759
+
4760
+ if (
4761
+ options.dropdownCssClass != null ||
4762
+ options.dropdownCss != null ||
4763
+ options.adaptDropdownCssClass != null
4764
+ ) {
4765
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4766
+
4767
+ options.dropdownAdapter = Utils.Decorate(
4768
+ options.dropdownAdapter,
4769
+ DropdownCSS
4770
+ );
4771
+ }
4772
+
4773
+ options.dropdownAdapter = Utils.Decorate(
4774
+ options.dropdownAdapter,
4775
+ AttachBody
4776
+ );
4777
+ }
4778
+
4779
+ if (options.selectionAdapter == null) {
4780
+ if (options.multiple) {
4781
+ options.selectionAdapter = MultipleSelection;
4782
+ } else {
4783
+ options.selectionAdapter = SingleSelection;
4784
+ }
4785
+
4786
+ // Add the placeholder mixin if a placeholder was specified
4787
+ if (options.placeholder != null) {
4788
+ options.selectionAdapter = Utils.Decorate(
4789
+ options.selectionAdapter,
4790
+ Placeholder
4791
+ );
4792
+ }
4793
+
4794
+ if (options.allowClear) {
4795
+ options.selectionAdapter = Utils.Decorate(
4796
+ options.selectionAdapter,
4797
+ AllowClear
4798
+ );
4799
+ }
4800
+
4801
+ if (options.multiple) {
4802
+ options.selectionAdapter = Utils.Decorate(
4803
+ options.selectionAdapter,
4804
+ SelectionSearch
4805
+ );
4806
+ }
4807
+
4808
+ if (
4809
+ options.containerCssClass != null ||
4810
+ options.containerCss != null ||
4811
+ options.adaptContainerCssClass != null
4812
+ ) {
4813
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4814
+
4815
+ options.selectionAdapter = Utils.Decorate(
4816
+ options.selectionAdapter,
4817
+ ContainerCSS
4818
+ );
4819
+ }
4820
+
4821
+ options.selectionAdapter = Utils.Decorate(
4822
+ options.selectionAdapter,
4823
+ EventRelay
4824
+ );
4825
+ }
4826
+
4827
+ if (typeof options.language === 'string') {
4828
+ // Check if the language is specified with a region
4829
+ if (options.language.indexOf('-') > 0) {
4830
+ // Extract the region information if it is included
4831
+ var languageParts = options.language.split('-');
4832
+ var baseLanguage = languageParts[0];
4833
+
4834
+ options.language = [options.language, baseLanguage];
4835
+ } else {
4836
+ options.language = [options.language];
4837
+ }
4838
+ }
4839
+
4840
+ if ($.isArray(options.language)) {
4841
+ var languages = new Translation();
4842
+ options.language.push('en');
4843
+
4844
+ var languageNames = options.language;
4845
+
4846
+ for (var l = 0; l < languageNames.length; l++) {
4847
+ var name = languageNames[l];
4848
+ var language = {};
4849
+
4850
+ try {
4851
+ // Try to load it with the original name
4852
+ language = Translation.loadPath(name);
4853
+ } catch (e) {
4854
+ try {
4855
+ // If we couldn't load it, check if it wasn't the full path
4856
+ name = this.defaults.amdLanguageBase + name;
4857
+ language = Translation.loadPath(name);
4858
+ } catch (ex) {
4859
+ // The translation could not be loaded at all. Sometimes this is
4860
+ // because of a configuration problem, other times this can be
4861
+ // because of how Select2 helps load all possible translation files.
4862
+ if (options.debug && window.console && console.warn) {
4863
+ console.warn(
4864
+ 'Select2: The language file for "' + name + '" could not be ' +
4865
+ 'automatically loaded. A fallback will be used instead.'
4866
+ );
4867
+ }
4868
+
4869
+ continue;
4870
+ }
4871
+ }
4872
+
4873
+ languages.extend(language);
4874
+ }
4875
+
4876
+ options.translations = languages;
4877
+ } else {
4878
+ var baseTranslation = Translation.loadPath(
4879
+ this.defaults.amdLanguageBase + 'en'
4880
+ );
4881
+ var customTranslation = new Translation(options.language);
4882
+
4883
+ customTranslation.extend(baseTranslation);
4884
+
4885
+ options.translations = customTranslation;
4886
+ }
4887
+
4888
+ return options;
4889
+ };
4890
+
4891
+ Defaults.prototype.reset = function () {
4892
+ function stripDiacritics (text) {
4893
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4894
+ function match(a) {
4895
+ return DIACRITICS[a] || a;
4896
+ }
4897
+
4898
+ return text.replace(/[^\u0000-\u007E]/g, match);
4899
+ }
4900
+
4901
+ function matcher (params, data) {
4902
+ // Always return the object if there is nothing to compare
4903
+ if ($.trim(params.term) === '') {
4904
+ return data;
4905
+ }
4906
+
4907
+ // Do a recursive check for options with children
4908
+ if (data.children && data.children.length > 0) {
4909
+ // Clone the data object if there are children
4910
+ // This is required as we modify the object to remove any non-matches
4911
+ var match = $.extend(true, {}, data);
4912
+
4913
+ // Check each child of the option
4914
+ for (var c = data.children.length - 1; c >= 0; c--) {
4915
+ var child = data.children[c];
4916
+
4917
+ var matches = matcher(params, child);
4918
+
4919
+ // If there wasn't a match, remove the object in the array
4920
+ if (matches == null) {
4921
+ match.children.splice(c, 1);
4922
+ }
4923
+ }
4924
+
4925
+ // If any children matched, return the new object
4926
+ if (match.children.length > 0) {
4927
+ return match;
4928
+ }
4929
+
4930
+ // If there were no matching children, check just the plain object
4931
+ return matcher(params, match);
4932
+ }
4933
+
4934
+ var original = stripDiacritics(data.text).toUpperCase();
4935
+ var term = stripDiacritics(params.term).toUpperCase();
4936
+
4937
+ // Check if the text contains the term
4938
+ if (original.indexOf(term) > -1) {
4939
+ return data;
4940
+ }
4941
+
4942
+ // If it doesn't contain the term, don't return anything
4943
+ return null;
4944
+ }
4945
+
4946
+ this.defaults = {
4947
+ amdBase: './',
4948
+ amdLanguageBase: './i18n/',
4949
+ closeOnSelect: true,
4950
+ debug: false,
4951
+ dropdownAutoWidth: false,
4952
+ escapeMarkup: Utils.escapeMarkup,
4953
+ language: EnglishTranslation,
4954
+ matcher: matcher,
4955
+ minimumInputLength: 0,
4956
+ maximumInputLength: 0,
4957
+ maximumSelectionLength: 0,
4958
+ minimumResultsForSearch: 0,
4959
+ selectOnClose: false,
4960
+ sorter: function (data) {
4961
+ return data;
4962
+ },
4963
+ templateResult: function (result) {
4964
+ return result.text;
4965
+ },
4966
+ templateSelection: function (selection) {
4967
+ return selection.text;
4968
+ },
4969
+ theme: 'default',
4970
+ width: 'resolve'
4971
+ };
4972
+ };
4973
+
4974
+ Defaults.prototype.set = function (key, value) {
4975
+ var camelKey = $.camelCase(key);
4976
+
4977
+ var data = {};
4978
+ data[camelKey] = value;
4979
+
4980
+ var convertedData = Utils._convertData(data);
4981
+
4982
+ $.extend(this.defaults, convertedData);
4983
+ };
4984
+
4985
+ var defaults = new Defaults();
4986
+
4987
+ return defaults;
4988
+ });
4989
+
4990
+ S2.define('select2/options',[
4991
+ 'require',
4992
+ 'jquery',
4993
+ './defaults',
4994
+ './utils'
4995
+ ], function (require, $, Defaults, Utils) {
4996
+ function Options (options, $element) {
4997
+ this.options = options;
4998
+
4999
+ if ($element != null) {
5000
+ this.fromElement($element);
5001
+ }
5002
+
5003
+ this.options = Defaults.apply(this.options);
5004
+
5005
+ if ($element && $element.is('input')) {
5006
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
5007
+
5008
+ this.options.dataAdapter = Utils.Decorate(
5009
+ this.options.dataAdapter,
5010
+ InputCompat
5011
+ );
5012
+ }
5013
+ }
5014
+
5015
+ Options.prototype.fromElement = function ($e) {
5016
+ var excludedData = ['select2'];
5017
+
5018
+ if (this.options.multiple == null) {
5019
+ this.options.multiple = $e.prop('multiple');
5020
+ }
5021
+
5022
+ if (this.options.disabled == null) {
5023
+ this.options.disabled = $e.prop('disabled');
5024
+ }
5025
+
5026
+ if (this.options.language == null) {
5027
+ if ($e.prop('lang')) {
5028
+ this.options.language = $e.prop('lang').toLowerCase();
5029
+ } else if ($e.closest('[lang]').prop('lang')) {
5030
+ this.options.language = $e.closest('[lang]').prop('lang');
5031
+ }
5032
+ }
5033
+
5034
+ if (this.options.dir == null) {
5035
+ if ($e.prop('dir')) {
5036
+ this.options.dir = $e.prop('dir');
5037
+ } else if ($e.closest('[dir]').prop('dir')) {
5038
+ this.options.dir = $e.closest('[dir]').prop('dir');
5039
+ } else {
5040
+ this.options.dir = 'ltr';
5041
+ }
5042
+ }
5043
+
5044
+ $e.prop('disabled', this.options.disabled);
5045
+ $e.prop('multiple', this.options.multiple);
5046
+
5047
+ if ($e.data('select2Tags')) {
5048
+ if (this.options.debug && window.console && console.warn) {
5049
+ console.warn(
5050
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
5051
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
5052
+ 'removed in future versions of Select2.'
5053
+ );
5054
+ }
5055
+
5056
+ $e.data('data', $e.data('select2Tags'));
5057
+ $e.data('tags', true);
5058
+ }
5059
+
5060
+ if ($e.data('ajaxUrl')) {
5061
+ if (this.options.debug && window.console && console.warn) {
5062
+ console.warn(
5063
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5064
+ '`data-ajax--url` and support for the old attribute will be removed' +
5065
+ ' in future versions of Select2.'
5066
+ );
5067
+ }
5068
+
5069
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
5070
+ $e.data('ajax--url', $e.data('ajaxUrl'));
5071
+ }
5072
+
5073
+ var dataset = {};
5074
+
5075
+ // Prefer the element's `dataset` attribute if it exists
5076
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5077
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5078
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5079
+ } else {
5080
+ dataset = $e.data();
5081
+ }
5082
+
5083
+ var data = $.extend(true, {}, dataset);
5084
+
5085
+ data = Utils._convertData(data);
5086
+
5087
+ for (var key in data) {
5088
+ if ($.inArray(key, excludedData) > -1) {
5089
+ continue;
5090
+ }
5091
+
5092
+ if ($.isPlainObject(this.options[key])) {
5093
+ $.extend(this.options[key], data[key]);
5094
+ } else {
5095
+ this.options[key] = data[key];
5096
+ }
5097
+ }
5098
+
5099
+ return this;
5100
+ };
5101
+
5102
+ Options.prototype.get = function (key) {
5103
+ return this.options[key];
5104
+ };
5105
+
5106
+ Options.prototype.set = function (key, val) {
5107
+ this.options[key] = val;
5108
+ };
5109
+
5110
+ return Options;
5111
+ });
5112
+
5113
+ S2.define('select2/core',[
5114
+ 'jquery',
5115
+ './options',
5116
+ './utils',
5117
+ './keys'
5118
+ ], function ($, Options, Utils, KEYS) {
5119
+ var Select2 = function ($element, options) {
5120
+ if ($element.data('select2') != null) {
5121
+ $element.data('select2').destroy();
5122
+ }
5123
+
5124
+ this.$element = $element;
5125
+
5126
+ this.id = this._generateId($element);
5127
+
5128
+ options = options || {};
5129
+
5130
+ this.options = new Options(options, $element);
5131
+
5132
+ Select2.__super__.constructor.call(this);
5133
+
5134
+ // Set up the tabindex
5135
+
5136
+ var tabindex = $element.attr('tabindex') || 0;
5137
+ $element.data('old-tabindex', tabindex);
5138
+ $element.attr('tabindex', '-1');
5139
+
5140
+ // Set up containers and adapters
5141
+
5142
+ var DataAdapter = this.options.get('dataAdapter');
5143
+ this.dataAdapter = new DataAdapter($element, this.options);
5144
+
5145
+ var $container = this.render();
5146
+
5147
+ this._placeContainer($container);
5148
+
5149
+ var SelectionAdapter = this.options.get('selectionAdapter');
5150
+ this.selection = new SelectionAdapter($element, this.options);
5151
+ this.$selection = this.selection.render();
5152
+
5153
+ this.selection.position(this.$selection, $container);
5154
+
5155
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5156
+ this.dropdown = new DropdownAdapter($element, this.options);
5157
+ this.$dropdown = this.dropdown.render();
5158
+
5159
+ this.dropdown.position(this.$dropdown, $container);
5160
+
5161
+ var ResultsAdapter = this.options.get('resultsAdapter');
5162
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5163
+ this.$results = this.results.render();
5164
+
5165
+ this.results.position(this.$results, this.$dropdown);
5166
+
5167
+ // Bind events
5168
+
5169
+ var self = this;
5170
+
5171
+ // Bind the container to all of the adapters
5172
+ this._bindAdapters();
5173
+
5174
+ // Register any DOM event handlers
5175
+ this._registerDomEvents();
5176
+
5177
+ // Register any internal event handlers
5178
+ this._registerDataEvents();
5179
+ this._registerSelectionEvents();
5180
+ this._registerDropdownEvents();
5181
+ this._registerResultsEvents();
5182
+ this._registerEvents();
5183
+
5184
+ // Set the initial state
5185
+ this.dataAdapter.current(function (initialData) {
5186
+ self.trigger('selection:update', {
5187
+ data: initialData
5188
+ });
5189
+ });
5190
+
5191
+ // Hide the original select
5192
+ $element.addClass('select2-hidden-accessible');
5193
+ $element.attr('aria-hidden', 'true');
5194
+
5195
+ // Synchronize any monitored attributes
5196
+ this._syncAttributes();
5197
+
5198
+ $element.data('select2', this);
5199
+ };
5200
+
5201
+ Utils.Extend(Select2, Utils.Observable);
5202
+
5203
+ Select2.prototype._generateId = function ($element) {
5204
+ var id = '';
5205
+
5206
+ if ($element.attr('id') != null) {
5207
+ id = $element.attr('id');
5208
+ } else if ($element.attr('name') != null) {
5209
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5210
+ } else {
5211
+ id = Utils.generateChars(4);
5212
+ }
5213
+
5214
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5215
+ id = 'select2-' + id;
5216
+
5217
+ return id;
5218
+ };
5219
+
5220
+ Select2.prototype._placeContainer = function ($container) {
5221
+ $container.insertAfter(this.$element);
5222
+
5223
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5224
+
5225
+ if (width != null) {
5226
+ $container.css('width', width);
5227
+ }
5228
+ };
5229
+
5230
+ Select2.prototype._resolveWidth = function ($element, method) {
5231
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5232
+
5233
+ if (method == 'resolve') {
5234
+ var styleWidth = this._resolveWidth($element, 'style');
5235
+
5236
+ if (styleWidth != null) {
5237
+ return styleWidth;
5238
+ }
5239
+
5240
+ return this._resolveWidth($element, 'element');
5241
+ }
5242
+
5243
+ if (method == 'element') {
5244
+ var elementWidth = $element.outerWidth(false);
5245
+
5246
+ if (elementWidth <= 0) {
5247
+ return 'auto';
5248
+ }
5249
+
5250
+ return elementWidth + 'px';
5251
+ }
5252
+
5253
+ if (method == 'style') {
5254
+ var style = $element.attr('style');
5255
+
5256
+ if (typeof(style) !== 'string') {
5257
+ return null;
5258
+ }
5259
+
5260
+ var attrs = style.split(';');
5261
+
5262
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5263
+ var attr = attrs[i].replace(/\s/g, '');
5264
+ var matches = attr.match(WIDTH);
5265
+
5266
+ if (matches !== null && matches.length >= 1) {
5267
+ return matches[1];
5268
+ }
5269
+ }
5270
+
5271
+ return null;
5272
+ }
5273
+
5274
+ return method;
5275
+ };
5276
+
5277
+ Select2.prototype._bindAdapters = function () {
5278
+ this.dataAdapter.bind(this, this.$container);
5279
+ this.selection.bind(this, this.$container);
5280
+
5281
+ this.dropdown.bind(this, this.$container);
5282
+ this.results.bind(this, this.$container);
5283
+ };
5284
+
5285
+ Select2.prototype._registerDomEvents = function () {
5286
+ var self = this;
5287
+
5288
+ this.$element.on('change.select2', function () {
5289
+ self.dataAdapter.current(function (data) {
5290
+ self.trigger('selection:update', {
5291
+ data: data
5292
+ });
5293
+ });
5294
+ });
5295
+
5296
+ this.$element.on('focus.select2', function (evt) {
5297
+ self.trigger('focus', evt);
5298
+ });
5299
+
5300
+ this._syncA = Utils.bind(this._syncAttributes, this);
5301
+ this._syncS = Utils.bind(this._syncSubtree, this);
5302
+
5303
+ if (this.$element[0].attachEvent) {
5304
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5305
+ }
5306
+
5307
+ var observer = window.MutationObserver ||
5308
+ window.WebKitMutationObserver ||
5309
+ window.MozMutationObserver
5310
+ ;
5311
+
5312
+ if (observer != null) {
5313
+ this._observer = new observer(function (mutations) {
5314
+ $.each(mutations, self._syncA);
5315
+ $.each(mutations, self._syncS);
5316
+ });
5317
+ this._observer.observe(this.$element[0], {
5318
+ attributes: true,
5319
+ childList: true,
5320
+ subtree: false
5321
+ });
5322
+ } else if (this.$element[0].addEventListener) {
5323
+ this.$element[0].addEventListener(
5324
+ 'DOMAttrModified',
5325
+ self._syncA,
5326
+ false
5327
+ );
5328
+ this.$element[0].addEventListener(
5329
+ 'DOMNodeInserted',
5330
+ self._syncS,
5331
+ false
5332
+ );
5333
+ this.$element[0].addEventListener(
5334
+ 'DOMNodeRemoved',
5335
+ self._syncS,
5336
+ false
5337
+ );
5338
+ }
5339
+ };
5340
+
5341
+ Select2.prototype._registerDataEvents = function () {
5342
+ var self = this;
5343
+
5344
+ this.dataAdapter.on('*', function (name, params) {
5345
+ self.trigger(name, params);
5346
+ });
5347
+ };
5348
+
5349
+ Select2.prototype._registerSelectionEvents = function () {
5350
+ var self = this;
5351
+ var nonRelayEvents = ['toggle', 'focus'];
5352
+
5353
+ this.selection.on('toggle', function () {
5354
+ self.toggleDropdown();
5355
+ });
5356
+
5357
+ this.selection.on('focus', function (params) {
5358
+ self.focus(params);
5359
+ });
5360
+
5361
+ this.selection.on('*', function (name, params) {
5362
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5363
+ return;
5364
+ }
5365
+
5366
+ self.trigger(name, params);
5367
+ });
5368
+ };
5369
+
5370
+ Select2.prototype._registerDropdownEvents = function () {
5371
+ var self = this;
5372
+
5373
+ this.dropdown.on('*', function (name, params) {
5374
+ self.trigger(name, params);
5375
+ });
5376
+ };
5377
+
5378
+ Select2.prototype._registerResultsEvents = function () {
5379
+ var self = this;
5380
+
5381
+ this.results.on('*', function (name, params) {
5382
+ self.trigger(name, params);
5383
+ });
5384
+ };
5385
+
5386
+ Select2.prototype._registerEvents = function () {
5387
+ var self = this;
5388
+
5389
+ this.on('open', function () {
5390
+ self.$container.addClass('select2-container--open');
5391
+ });
5392
+
5393
+ this.on('close', function () {
5394
+ self.$container.removeClass('select2-container--open');
5395
+ });
5396
+
5397
+ this.on('enable', function () {
5398
+ self.$container.removeClass('select2-container--disabled');
5399
+ });
5400
+
5401
+ this.on('disable', function () {
5402
+ self.$container.addClass('select2-container--disabled');
5403
+ });
5404
+
5405
+ this.on('blur', function () {
5406
+ self.$container.removeClass('select2-container--focus');
5407
+ });
5408
+
5409
+ this.on('query', function (params) {
5410
+ if (!self.isOpen()) {
5411
+ self.trigger('open', {});
5412
+ }
5413
+
5414
+ this.dataAdapter.query(params, function (data) {
5415
+ self.trigger('results:all', {
5416
+ data: data,
5417
+ query: params
5418
+ });
5419
+ });
5420
+ });
5421
+
5422
+ this.on('query:append', function (params) {
5423
+ this.dataAdapter.query(params, function (data) {
5424
+ self.trigger('results:append', {
5425
+ data: data,
5426
+ query: params
5427
+ });
5428
+ });
5429
+ });
5430
+
5431
+ this.on('open', function(){
5432
+ // Focus on the active element when opening dropdown.
5433
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
5434
+ setTimeout(function(){
5435
+ self.focusOnActiveElement();
5436
+ }, 1);
5437
+ });
5438
+
5439
+ $(document).on('keydown', function (evt) {
5440
+ var key = evt.which;
5441
+ if (self.isOpen()) {
5442
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5443
+ (key === KEYS.UP && evt.altKey)) {
5444
+ self.close();
5445
+
5446
+ evt.preventDefault();
5447
+ } else if (key === KEYS.ENTER) {
5448
+ self.trigger('results:select', {});
5449
+
5450
+ evt.preventDefault();
5451
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5452
+ self.trigger('results:toggle', {});
5453
+
5454
+ evt.preventDefault();
5455
+ } else if (key === KEYS.UP) {
5456
+ self.trigger('results:previous', {});
5457
+
5458
+ evt.preventDefault();
5459
+ } else if (key === KEYS.DOWN) {
5460
+ self.trigger('results:next', {});
5461
+
5462
+ evt.preventDefault();
5463
+ }
5464
+
5465
+ var $searchField = self.$dropdown.find('.select2-search__field');
5466
+ if (! $searchField.length) {
5467
+ $searchField = self.$container.find('.select2-search__field');
5468
+ }
5469
+
5470
+ // Move the focus to the selected element on keyboard navigation.
5471
+ // Required for screen readers to work properly.
5472
+ if (key === KEYS.DOWN || key === KEYS.UP) {
5473
+ self.focusOnActiveElement();
5474
+ } else {
5475
+ // Focus on the search if user starts typing.
5476
+ $searchField.focus();
5477
+ // Focus back to active selection when finished typing.
5478
+ // Small delay so typed character can be read by screen reader.
5479
+ setTimeout(function(){
5480
+ self.focusOnActiveElement();
5481
+ }, 1000);
5482
+ }
5483
+
5484
+ // If focus is in the search field, select the current active element on Enter key.
5485
+ $searchField.on('keydown', function (evt) {
5486
+ if (evt.which === KEYS.ENTER) {
5487
+ self.trigger('results:select', {});
5488
+ evt.preventDefault();
5489
+ }
5490
+ });
5491
+
5492
+ } else if (self.hasFocus()) {
5493
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5494
+ (key === KEYS.DOWN && evt.altKey)) {
5495
+ self.open();
5496
+ evt.preventDefault();
5497
+ }
5498
+ }
5499
+ });
5500
+ };
5501
+
5502
+ Select2.prototype.focusOnActiveElement = function () {
5503
+ // Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
5504
+ if (! Utils.isTouchscreen()) {
5505
+ this.$results.find('li.select2-results__option--highlighted').focus();
5506
+ }
5507
+ };
5508
+
5509
+ Select2.prototype._syncAttributes = function () {
5510
+ this.options.set('disabled', this.$element.prop('disabled'));
5511
+
5512
+ if (this.options.get('disabled')) {
5513
+ if (this.isOpen()) {
5514
+ this.close();
5515
+ }
5516
+
5517
+ this.trigger('disable', {});
5518
+ } else {
5519
+ this.trigger('enable', {});
5520
+ }
5521
+ };
5522
+
5523
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5524
+ var changed = false;
5525
+ var self = this;
5526
+
5527
+ // Ignore any mutation events raised for elements that aren't options or
5528
+ // optgroups. This handles the case when the select element is destroyed
5529
+ if (
5530
+ evt && evt.target && (
5531
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5532
+ )
5533
+ ) {
5534
+ return;
5535
+ }
5536
+
5537
+ if (!mutations) {
5538
+ // If mutation events aren't supported, then we can only assume that the
5539
+ // change affected the selections
5540
+ changed = true;
5541
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5542
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5543
+ var node = mutations.addedNodes[n];
5544
+
5545
+ if (node.selected) {
5546
+ changed = true;
5547
+ }
5548
+ }
5549
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5550
+ changed = true;
5551
+ }
5552
+
5553
+ // Only re-pull the data if we think there is a change
5554
+ if (changed) {
5555
+ this.dataAdapter.current(function (currentData) {
5556
+ self.trigger('selection:update', {
5557
+ data: currentData
5558
+ });
5559
+ });
5560
+ }
5561
+ };
5562
+
5563
+ /**
5564
+ * Override the trigger method to automatically trigger pre-events when
5565
+ * there are events that can be prevented.
5566
+ */
5567
+ Select2.prototype.trigger = function (name, args) {
5568
+ var actualTrigger = Select2.__super__.trigger;
5569
+ var preTriggerMap = {
5570
+ 'open': 'opening',
5571
+ 'close': 'closing',
5572
+ 'select': 'selecting',
5573
+ 'unselect': 'unselecting'
5574
+ };
5575
+
5576
+ if (args === undefined) {
5577
+ args = {};
5578
+ }
5579
+
5580
+ if (name in preTriggerMap) {
5581
+ var preTriggerName = preTriggerMap[name];
5582
+ var preTriggerArgs = {
5583
+ prevented: false,
5584
+ name: name,
5585
+ args: args
5586
+ };
5587
+
5588
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5589
+
5590
+ if (preTriggerArgs.prevented) {
5591
+ args.prevented = true;
5592
+
5593
+ return;
5594
+ }
5595
+ }
5596
+
5597
+ actualTrigger.call(this, name, args);
5598
+ };
5599
+
5600
+ Select2.prototype.toggleDropdown = function () {
5601
+ if (this.options.get('disabled')) {
5602
+ return;
5603
+ }
5604
+
5605
+ if (this.isOpen()) {
5606
+ this.close();
5607
+ } else {
5608
+ this.open();
5609
+ }
5610
+ };
5611
+
5612
+ Select2.prototype.open = function () {
5613
+ if (this.isOpen()) {
5614
+ return;
5615
+ }
5616
+
5617
+ this.trigger('query', {});
5618
+ };
5619
+
5620
+ Select2.prototype.close = function () {
5621
+ if (!this.isOpen()) {
5622
+ return;
5623
+ }
5624
+
5625
+ this.trigger('close', {});
5626
+ };
5627
+
5628
+ Select2.prototype.isOpen = function () {
5629
+ return this.$container.hasClass('select2-container--open');
5630
+ };
5631
+
5632
+ Select2.prototype.hasFocus = function () {
5633
+ return this.$container.hasClass('select2-container--focus');
5634
+ };
5635
+
5636
+ Select2.prototype.focus = function (data) {
5637
+ // No need to re-trigger focus events if we are already focused
5638
+ if (this.hasFocus()) {
5639
+ return;
5640
+ }
5641
+
5642
+ this.$container.addClass('select2-container--focus');
5643
+ this.trigger('focus', {});
5644
+ };
5645
+
5646
+ Select2.prototype.enable = function (args) {
5647
+ if (this.options.get('debug') && window.console && console.warn) {
5648
+ console.warn(
5649
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5650
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5651
+ ' instead.'
5652
+ );
5653
+ }
5654
+
5655
+ if (args == null || args.length === 0) {
5656
+ args = [true];
5657
+ }
5658
+
5659
+ var disabled = !args[0];
5660
+
5661
+ this.$element.prop('disabled', disabled);
5662
+ };
5663
+
5664
+ Select2.prototype.data = function () {
5665
+ if (this.options.get('debug') &&
5666
+ arguments.length > 0 && window.console && console.warn) {
5667
+ console.warn(
5668
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5669
+ 'should consider setting the value instead using `$element.val()`.'
5670
+ );
5671
+ }
5672
+
5673
+ var data = [];
5674
+
5675
+ this.dataAdapter.current(function (currentData) {
5676
+ data = currentData;
5677
+ });
5678
+
5679
+ return data;
5680
+ };
5681
+
5682
+ Select2.prototype.val = function (args) {
5683
+ if (this.options.get('debug') && window.console && console.warn) {
5684
+ console.warn(
5685
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5686
+ ' removed in later Select2 versions. Use $element.val() instead.'
5687
+ );
5688
+ }
5689
+
5690
+ if (args == null || args.length === 0) {
5691
+ return this.$element.val();
5692
+ }
5693
+
5694
+ var newVal = args[0];
5695
+
5696
+ if ($.isArray(newVal)) {
5697
+ newVal = $.map(newVal, function (obj) {
5698
+ return obj.toString();
5699
+ });
5700
+ }
5701
+
5702
+ this.$element.val(newVal).trigger('change');
5703
+ };
5704
+
5705
+ Select2.prototype.destroy = function () {
5706
+ this.$container.remove();
5707
+
5708
+ if (this.$element[0].detachEvent) {
5709
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5710
+ }
5711
+
5712
+ if (this._observer != null) {
5713
+ this._observer.disconnect();
5714
+ this._observer = null;
5715
+ } else if (this.$element[0].removeEventListener) {
5716
+ this.$element[0]
5717
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5718
+ this.$element[0]
5719
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5720
+ this.$element[0]
5721
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5722
+ }
5723
+
5724
+ this._syncA = null;
5725
+ this._syncS = null;
5726
+
5727
+ this.$element.off('.select2');
5728
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5729
+
5730
+ this.$element.removeClass('select2-hidden-accessible');
5731
+ this.$element.attr('aria-hidden', 'false');
5732
+ this.$element.removeData('select2');
5733
+
5734
+ this.dataAdapter.destroy();
5735
+ this.selection.destroy();
5736
+ this.dropdown.destroy();
5737
+ this.results.destroy();
5738
+
5739
+ this.dataAdapter = null;
5740
+ this.selection = null;
5741
+ this.dropdown = null;
5742
+ this.results = null;
5743
+ };
5744
+
5745
+ Select2.prototype.render = function () {
5746
+ var $container = $(
5747
+ '<span class="select2 select2-container">' +
5748
+ '<span class="selection"></span>' +
5749
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5750
+ '</span>'
5751
+ );
5752
+
5753
+ $container.attr('dir', this.options.get('dir'));
5754
+
5755
+ this.$container = $container;
5756
+
5757
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
5758
+
5759
+ $container.data('element', this.$element);
5760
+
5761
+ return $container;
5762
+ };
5763
+
5764
+ return Select2;
5765
+ });
5766
+
5767
+ S2.define('select2/compat/utils',[
5768
+ 'jquery'
5769
+ ], function ($) {
5770
+ function syncCssClasses ($dest, $src, adapter) {
5771
+ var classes, replacements = [], adapted;
5772
+
5773
+ classes = $.trim($dest.attr('class'));
5774
+
5775
+ if (classes) {
5776
+ classes = '' + classes; // for IE which returns object
5777
+
5778
+ $(classes.split(/\s+/)).each(function () {
5779
+ // Save all Select2 classes
5780
+ if (this.indexOf('select2-') === 0) {
5781
+ replacements.push(this);
5782
+ }
5783
+ });
5784
+ }
5785
+
5786
+ classes = $.trim($src.attr('class'));
5787
+
5788
+ if (classes) {
5789
+ classes = '' + classes; // for IE which returns object
5790
+
5791
+ $(classes.split(/\s+/)).each(function () {
5792
+ // Only adapt non-Select2 classes
5793
+ if (this.indexOf('select2-') !== 0) {
5794
+ adapted = adapter(this);
5795
+
5796
+ if (adapted != null) {
5797
+ replacements.push(adapted);
5798
+ }
5799
+ }
5800
+ });
5801
+ }
5802
+
5803
+ $dest.attr('class', replacements.join(' '));
5804
+ }
5805
+
5806
+ return {
5807
+ syncCssClasses: syncCssClasses
5808
+ };
5809
+ });
5810
+
5811
+ S2.define('select2/compat/containerCss',[
5812
+ 'jquery',
5813
+ './utils'
5814
+ ], function ($, CompatUtils) {
5815
+ // No-op CSS adapter that discards all classes by default
5816
+ function _containerAdapter (clazz) {
5817
+ return null;
5818
+ }
5819
+
5820
+ function ContainerCSS () { }
5821
+
5822
+ ContainerCSS.prototype.render = function (decorated) {
5823
+ var $container = decorated.call(this);
5824
+
5825
+ var containerCssClass = this.options.get('containerCssClass') || '';
5826
+
5827
+ if ($.isFunction(containerCssClass)) {
5828
+ containerCssClass = containerCssClass(this.$element);
5829
+ }
5830
+
5831
+ var containerCssAdapter = this.options.get('adaptContainerCssClass');
5832
+ containerCssAdapter = containerCssAdapter || _containerAdapter;
5833
+
5834
+ if (containerCssClass.indexOf(':all:') !== -1) {
5835
+ containerCssClass = containerCssClass.replace(':all:', '');
5836
+
5837
+ var _cssAdapter = containerCssAdapter;
5838
+
5839
+ containerCssAdapter = function (clazz) {
5840
+ var adapted = _cssAdapter(clazz);
5841
+
5842
+ if (adapted != null) {
5843
+ // Append the old one along with the adapted one
5844
+ return adapted + ' ' + clazz;
5845
+ }
5846
+
5847
+ return clazz;
5848
+ };
5849
+ }
5850
+
5851
+ var containerCss = this.options.get('containerCss') || {};
5852
+
5853
+ if ($.isFunction(containerCss)) {
5854
+ containerCss = containerCss(this.$element);
5855
+ }
5856
+
5857
+ CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
5858
+
5859
+ $container.css(containerCss);
5860
+ $container.addClass(containerCssClass);
5861
+
5862
+ return $container;
5863
+ };
5864
+
5865
+ return ContainerCSS;
5866
+ });
5867
+
5868
+ S2.define('select2/compat/dropdownCss',[
5869
+ 'jquery',
5870
+ './utils'
5871
+ ], function ($, CompatUtils) {
5872
+ // No-op CSS adapter that discards all classes by default
5873
+ function _dropdownAdapter (clazz) {
5874
+ return null;
5875
+ }
5876
+
5877
+ function DropdownCSS () { }
5878
+
5879
+ DropdownCSS.prototype.render = function (decorated) {
5880
+ var $dropdown = decorated.call(this);
5881
+
5882
+ var dropdownCssClass = this.options.get('dropdownCssClass') || '';
5883
+
5884
+ if ($.isFunction(dropdownCssClass)) {
5885
+ dropdownCssClass = dropdownCssClass(this.$element);
5886
+ }
5887
+
5888
+ var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
5889
+ dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
5890
+
5891
+ if (dropdownCssClass.indexOf(':all:') !== -1) {
5892
+ dropdownCssClass = dropdownCssClass.replace(':all:', '');
5893
+
5894
+ var _cssAdapter = dropdownCssAdapter;
5895
+
5896
+ dropdownCssAdapter = function (clazz) {
5897
+ var adapted = _cssAdapter(clazz);
5898
+
5899
+ if (adapted != null) {
5900
+ // Append the old one along with the adapted one
5901
+ return adapted + ' ' + clazz;
5902
+ }
5903
+
5904
+ return clazz;
5905
+ };
5906
+ }
5907
+
5908
+ var dropdownCss = this.options.get('dropdownCss') || {};
5909
+
5910
+ if ($.isFunction(dropdownCss)) {
5911
+ dropdownCss = dropdownCss(this.$element);
5912
+ }
5913
+
5914
+ CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
5915
+
5916
+ $dropdown.css(dropdownCss);
5917
+ $dropdown.addClass(dropdownCssClass);
5918
+
5919
+ return $dropdown;
5920
+ };
5921
+
5922
+ return DropdownCSS;
5923
+ });
5924
+
5925
+ S2.define('select2/compat/initSelection',[
5926
+ 'jquery'
5927
+ ], function ($) {
5928
+ function InitSelection (decorated, $element, options) {
5929
+ if (options.get('debug') && window.console && console.warn) {
5930
+ console.warn(
5931
+ 'Select2: The `initSelection` option has been deprecated in favor' +
5932
+ ' of a custom data adapter that overrides the `current` method. ' +
5933
+ 'This method is now called multiple times instead of a single ' +
5934
+ 'time when the instance is initialized. Support will be removed ' +
5935
+ 'for the `initSelection` option in future versions of Select2'
5936
+ );
5937
+ }
5938
+
5939
+ this.initSelection = options.get('initSelection');
5940
+ this._isInitialized = false;
5941
+
5942
+ decorated.call(this, $element, options);
5943
+ }
5944
+
5945
+ InitSelection.prototype.current = function (decorated, callback) {
5946
+ var self = this;
5947
+
5948
+ if (this._isInitialized) {
5949
+ decorated.call(this, callback);
5950
+
5951
+ return;
5952
+ }
5953
+
5954
+ this.initSelection.call(null, this.$element, function (data) {
5955
+ self._isInitialized = true;
5956
+
5957
+ if (!$.isArray(data)) {
5958
+ data = [data];
5959
+ }
5960
+
5961
+ callback(data);
5962
+ });
5963
+ };
5964
+
5965
+ return InitSelection;
5966
+ });
5967
+
5968
+ S2.define('select2/compat/inputData',[
5969
+ 'jquery'
5970
+ ], function ($) {
5971
+ function InputData (decorated, $element, options) {
5972
+ this._currentData = [];
5973
+ this._valueSeparator = options.get('valueSeparator') || ',';
5974
+
5975
+ if ($element.prop('type') === 'hidden') {
5976
+ if (options.get('debug') && console && console.warn) {
5977
+ console.warn(
5978
+ 'Select2: Using a hidden input with Select2 is no longer ' +
5979
+ 'supported and may stop working in the future. It is recommended ' +
5980
+ 'to use a `<select>` element instead.'
5981
+ );
5982
+ }
5983
+ }
5984
+
5985
+ decorated.call(this, $element, options);
5986
+ }
5987
+
5988
+ InputData.prototype.current = function (_, callback) {
5989
+ function getSelected (data, selectedIds) {
5990
+ var selected = [];
5991
+
5992
+ if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
5993
+ data.selected = true;
5994
+ selected.push(data);
5995
+ } else {
5996
+ data.selected = false;
5997
+ }
5998
+
5999
+ if (data.children) {
6000
+ selected.push.apply(selected, getSelected(data.children, selectedIds));
6001
+ }
6002
+
6003
+ return selected;
6004
+ }
6005
+
6006
+ var selected = [];
6007
+
6008
+ for (var d = 0; d < this._currentData.length; d++) {
6009
+ var data = this._currentData[d];
6010
+
6011
+ selected.push.apply(
6012
+ selected,
6013
+ getSelected(
6014
+ data,
6015
+ this.$element.val().split(
6016
+ this._valueSeparator
6017
+ )
6018
+ )
6019
+ );
6020
+ }
6021
+
6022
+ callback(selected);
6023
+ };
6024
+
6025
+ InputData.prototype.select = function (_, data) {
6026
+ if (!this.options.get('multiple')) {
6027
+ this.current(function (allData) {
6028
+ $.map(allData, function (data) {
6029
+ data.selected = false;
6030
+ });
6031
+ });
6032
+
6033
+ this.$element.val(data.id);
6034
+ this.$element.trigger('change');
6035
+ } else {
6036
+ var value = this.$element.val();
6037
+ value += this._valueSeparator + data.id;
6038
+
6039
+ this.$element.val(value);
6040
+ this.$element.trigger('change');
6041
+ }
6042
+ };
6043
+
6044
+ InputData.prototype.unselect = function (_, data) {
6045
+ var self = this;
6046
+
6047
+ data.selected = false;
6048
+
6049
+ this.current(function (allData) {
6050
+ var values = [];
6051
+
6052
+ for (var d = 0; d < allData.length; d++) {
6053
+ var item = allData[d];
6054
+
6055
+ if (data.id == item.id) {
6056
+ continue;
6057
+ }
6058
+
6059
+ values.push(item.id);
6060
+ }
6061
+
6062
+ self.$element.val(values.join(self._valueSeparator));
6063
+ self.$element.trigger('change');
6064
+ });
6065
+ };
6066
+
6067
+ InputData.prototype.query = function (_, params, callback) {
6068
+ var results = [];
6069
+
6070
+ for (var d = 0; d < this._currentData.length; d++) {
6071
+ var data = this._currentData[d];
6072
+
6073
+ var matches = this.matches(params, data);
6074
+
6075
+ if (matches !== null) {
6076
+ results.push(matches);
6077
+ }
6078
+ }
6079
+
6080
+ callback({
6081
+ results: results
6082
+ });
6083
+ };
6084
+
6085
+ InputData.prototype.addOptions = function (_, $options) {
6086
+ var options = $.map($options, function ($option) {
6087
+ return $.data($option[0], 'data');
6088
+ });
6089
+
6090
+ this._currentData.push.apply(this._currentData, options);
6091
+ };
6092
+
6093
+ return InputData;
6094
+ });
6095
+
6096
+ S2.define('select2/compat/matcher',[
6097
+ 'jquery'
6098
+ ], function ($) {
6099
+ function oldMatcher (matcher) {
6100
+ function wrappedMatcher (params, data) {
6101
+ var match = $.extend(true, {}, data);
6102
+
6103
+ if (params.term == null || $.trim(params.term) === '') {
6104
+ return match;
6105
+ }
6106
+
6107
+ if (data.children) {
6108
+ for (var c = data.children.length - 1; c >= 0; c--) {
6109
+ var child = data.children[c];
6110
+
6111
+ // Check if the child object matches
6112
+ // The old matcher returned a boolean true or false
6113
+ var doesMatch = matcher(params.term, child.text, child);
6114
+
6115
+ // If the child didn't match, pop it off
6116
+ if (!doesMatch) {
6117
+ match.children.splice(c, 1);
6118
+ }
6119
+ }
6120
+
6121
+ if (match.children.length > 0) {
6122
+ return match;
6123
+ }
6124
+ }
6125
+
6126
+ if (matcher(params.term, data.text, data)) {
6127
+ return match;
6128
+ }
6129
+
6130
+ return null;
6131
+ }
6132
+
6133
+ return wrappedMatcher;
6134
+ }
6135
+
6136
+ return oldMatcher;
6137
+ });
6138
+
6139
+ S2.define('select2/compat/query',[
6140
+
6141
+ ], function () {
6142
+ function Query (decorated, $element, options) {
6143
+ if (options.get('debug') && window.console && console.warn) {
6144
+ console.warn(
6145
+ 'Select2: The `query` option has been deprecated in favor of a ' +
6146
+ 'custom data adapter that overrides the `query` method. Support ' +
6147
+ 'will be removed for the `query` option in future versions of ' +
6148
+ 'Select2.'
6149
+ );
6150
+ }
6151
+
6152
+ decorated.call(this, $element, options);
6153
+ }
6154
+
6155
+ Query.prototype.query = function (_, params, callback) {
6156
+ params.callback = callback;
6157
+
6158
+ var query = this.options.get('query');
6159
+
6160
+ query.call(null, params);
6161
+ };
6162
+
6163
+ return Query;
6164
+ });
6165
+
6166
+ S2.define('select2/dropdown/attachContainer',[
6167
+
6168
+ ], function () {
6169
+ function AttachContainer (decorated, $element, options) {
6170
+ decorated.call(this, $element, options);
6171
+ }
6172
+
6173
+ AttachContainer.prototype.position =
6174
+ function (decorated, $dropdown, $container) {
6175
+ var $dropdownContainer = $container.find('.dropdown-wrapper');
6176
+ $dropdownContainer.append($dropdown);
6177
+
6178
+ $dropdown.addClass('select2-dropdown--below');
6179
+ $container.addClass('select2-container--below');
6180
+ };
6181
+
6182
+ return AttachContainer;
6183
+ });
6184
+
6185
+ S2.define('select2/dropdown/stopPropagation',[
6186
+
6187
+ ], function () {
6188
+ function StopPropagation () { }
6189
+
6190
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6191
+ decorated.call(this, container, $container);
6192
+
6193
+ var stoppedEvents = [
6194
+ 'blur',
6195
+ 'change',
6196
+ 'click',
6197
+ 'dblclick',
6198
+ 'focus',
6199
+ 'focusin',
6200
+ 'focusout',
6201
+ 'input',
6202
+ 'keydown',
6203
+ 'keyup',
6204
+ 'keypress',
6205
+ 'mousedown',
6206
+ 'mouseenter',
6207
+ 'mouseleave',
6208
+ 'mousemove',
6209
+ 'mouseover',
6210
+ 'mouseup',
6211
+ 'search',
6212
+ 'touchend',
6213
+ 'touchstart'
6214
+ ];
6215
+
6216
+ this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
6217
+ evt.stopPropagation();
6218
+ });
6219
+ };
6220
+
6221
+ return StopPropagation;
6222
+ });
6223
+
6224
+ S2.define('select2/selection/stopPropagation',[
6225
+
6226
+ ], function () {
6227
+ function StopPropagation () { }
6228
+
6229
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6230
+ decorated.call(this, container, $container);
6231
+
6232
+ var stoppedEvents = [
6233
+ 'blur',
6234
+ 'change',
6235
+ 'click',
6236
+ 'dblclick',
6237
+ 'focus',
6238
+ 'focusin',
6239
+ 'focusout',
6240
+ 'input',
6241
+ 'keydown',
6242
+ 'keyup',
6243
+ 'keypress',
6244
+ 'mousedown',
6245
+ 'mouseenter',
6246
+ 'mouseleave',
6247
+ 'mousemove',
6248
+ 'mouseover',
6249
+ 'mouseup',
6250
+ 'search',
6251
+ 'touchend',
6252
+ 'touchstart'
6253
+ ];
6254
+
6255
+ this.$selection.on(stoppedEvents.join(' '), function (evt) {
6256
+ evt.stopPropagation();
6257
+ });
6258
+ };
6259
+
6260
+ return StopPropagation;
6261
+ });
6262
+
6263
+ /*!
6264
+ * jQuery Mousewheel 3.1.13
6265
+ *
6266
+ * Copyright jQuery Foundation and other contributors
6267
+ * Released under the MIT license
6268
+ * http://jquery.org/license
6269
+ */
6270
+
6271
+ (function (factory) {
6272
+ if ( typeof S2.define === 'function' && S2.define.amd ) {
6273
+ // AMD. Register as an anonymous module.
6274
+ S2.define('jquery-mousewheel',['jquery'], factory);
6275
+ } else if (typeof exports === 'object') {
6276
+ // Node/CommonJS style for Browserify
6277
+ module.exports = factory;
6278
+ } else {
6279
+ // Browser globals
6280
+ factory(jQuery);
6281
+ }
6282
+ }(function ($) {
6283
+
6284
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
6285
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
6286
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
6287
+ slice = Array.prototype.slice,
6288
+ nullLowestDeltaTimeout, lowestDelta;
6289
+
6290
+ if ( $.event.fixHooks ) {
6291
+ for ( var i = toFix.length; i; ) {
6292
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
6293
+ }
6294
+ }
6295
+
6296
+ var special = $.event.special.mousewheel = {
6297
+ version: '3.1.12',
6298
+
6299
+ setup: function() {
6300
+ if ( this.addEventListener ) {
6301
+ for ( var i = toBind.length; i; ) {
6302
+ this.addEventListener( toBind[--i], handler, false );
6303
+ }
6304
+ } else {
6305
+ this.onmousewheel = handler;
6306
+ }
6307
+ // Store the line height and page height for this particular element
6308
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
6309
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
6310
+ },
6311
+
6312
+ teardown: function() {
6313
+ if ( this.removeEventListener ) {
6314
+ for ( var i = toBind.length; i; ) {
6315
+ this.removeEventListener( toBind[--i], handler, false );
6316
+ }
6317
+ } else {
6318
+ this.onmousewheel = null;
6319
+ }
6320
+ // Clean up the data we added to the element
6321
+ $.removeData(this, 'mousewheel-line-height');
6322
+ $.removeData(this, 'mousewheel-page-height');
6323
+ },
6324
+
6325
+ getLineHeight: function(elem) {
6326
+ var $elem = $(elem),
6327
+ $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6328
+ if (!$parent.length) {
6329
+ $parent = $('body');
6330
+ }
6331
+ return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6332
+ },
6333
+
6334
+ getPageHeight: function(elem) {
6335
+ return $(elem).height();
6336
+ },
6337
+
6338
+ settings: {
6339
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
6340
+ normalizeOffset: true // calls getBoundingClientRect for each event
6341
+ }
6342
+ };
6343
+
6344
+ $.fn.extend({
6345
+ mousewheel: function(fn) {
6346
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
6347
+ },
6348
+
6349
+ unmousewheel: function(fn) {
6350
+ return this.unbind('mousewheel', fn);
6351
+ }
6352
+ });
6353
+
6354
+
6355
+ function handler(event) {
6356
+ var orgEvent = event || window.event,
6357
+ args = slice.call(arguments, 1),
6358
+ delta = 0,
6359
+ deltaX = 0,
6360
+ deltaY = 0,
6361
+ absDelta = 0,
6362
+ offsetX = 0,
6363
+ offsetY = 0;
6364
+ event = $.event.fix(orgEvent);
6365
+ event.type = 'mousewheel';
6366
+
6367
+ // Old school scrollwheel delta
6368
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
6369
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
6370
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
6371
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
6372
+
6373
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
6374
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
6375
+ deltaX = deltaY * -1;
6376
+ deltaY = 0;
6377
+ }
6378
+
6379
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
6380
+ delta = deltaY === 0 ? deltaX : deltaY;
6381
+
6382
+ // New school wheel delta (wheel event)
6383
+ if ( 'deltaY' in orgEvent ) {
6384
+ deltaY = orgEvent.deltaY * -1;
6385
+ delta = deltaY;
6386
+ }
6387
+ if ( 'deltaX' in orgEvent ) {
6388
+ deltaX = orgEvent.deltaX;
6389
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
6390
+ }
6391
+
6392
+ // No change actually happened, no reason to go any further
6393
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
6394
+
6395
+ // Need to convert lines and pages to pixels if we aren't already in pixels
6396
+ // There are three delta modes:
6397
+ // * deltaMode 0 is by pixels, nothing to do
6398
+ // * deltaMode 1 is by lines
6399
+ // * deltaMode 2 is by pages
6400
+ if ( orgEvent.deltaMode === 1 ) {
6401
+ var lineHeight = $.data(this, 'mousewheel-line-height');
6402
+ delta *= lineHeight;
6403
+ deltaY *= lineHeight;
6404
+ deltaX *= lineHeight;
6405
+ } else if ( orgEvent.deltaMode === 2 ) {
6406
+ var pageHeight = $.data(this, 'mousewheel-page-height');
6407
+ delta *= pageHeight;
6408
+ deltaY *= pageHeight;
6409
+ deltaX *= pageHeight;
6410
+ }
6411
+
6412
+ // Store lowest absolute delta to normalize the delta values
6413
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
6414
+
6415
+ if ( !lowestDelta || absDelta < lowestDelta ) {
6416
+ lowestDelta = absDelta;
6417
+
6418
+ // Adjust older deltas if necessary
6419
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6420
+ lowestDelta /= 40;
6421
+ }
6422
+ }
6423
+
6424
+ // Adjust older deltas if necessary
6425
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6426
+ // Divide all the things by 40!
6427
+ delta /= 40;
6428
+ deltaX /= 40;
6429
+ deltaY /= 40;
6430
+ }
6431
+
6432
+ // Get a whole, normalized value for the deltas
6433
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
6434
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
6435
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
6436
+
6437
+ // Normalise offsetX and offsetY properties
6438
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
6439
+ var boundingRect = this.getBoundingClientRect();
6440
+ offsetX = event.clientX - boundingRect.left;
6441
+ offsetY = event.clientY - boundingRect.top;
6442
+ }
6443
+
6444
+ // Add information to the event object
6445
+ event.deltaX = deltaX;
6446
+ event.deltaY = deltaY;
6447
+ event.deltaFactor = lowestDelta;
6448
+ event.offsetX = offsetX;
6449
+ event.offsetY = offsetY;
6450
+ // Go ahead and set deltaMode to 0 since we converted to pixels
6451
+ // Although this is a little odd since we overwrite the deltaX/Y
6452
+ // properties with normalized deltas.
6453
+ event.deltaMode = 0;
6454
+
6455
+ // Add event and delta to the front of the arguments
6456
+ args.unshift(event, delta, deltaX, deltaY);
6457
+
6458
+ // Clearout lowestDelta after sometime to better
6459
+ // handle multiple device types that give different
6460
+ // a different lowestDelta
6461
+ // Ex: trackpad = 3 and mouse wheel = 120
6462
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
6463
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
6464
+
6465
+ return ($.event.dispatch || $.event.handle).apply(this, args);
6466
+ }
6467
+
6468
+ function nullLowestDelta() {
6469
+ lowestDelta = null;
6470
+ }
6471
+
6472
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
6473
+ // If this is an older event and the delta is divisable by 120,
6474
+ // then we are assuming that the browser is treating this as an
6475
+ // older mouse wheel event and that we should divide the deltas
6476
+ // by 40 to try and get a more usable deltaFactor.
6477
+ // Side note, this actually impacts the reported scroll distance
6478
+ // in older browsers and can cause scrolling to be slower than native.
6479
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
6480
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
6481
+ }
6482
+
6483
+ }));
6484
+
6485
+ S2.define('jquery.select2',[
6486
+ 'jquery',
6487
+ 'jquery-mousewheel',
6488
+
6489
+ './select2/core',
6490
+ './select2/defaults'
6491
+ ], function ($, _, Select2, Defaults) {
6492
+ if ($.fn.selectWoo == null) {
6493
+ // All methods that should return the element
6494
+ var thisMethods = ['open', 'close', 'destroy'];
6495
+
6496
+ $.fn.selectWoo = function (options) {
6497
+ options = options || {};
6498
+
6499
+ if (typeof options === 'object') {
6500
+ this.each(function () {
6501
+ var instanceOptions = $.extend(true, {}, options);
6502
+
6503
+ var instance = new Select2($(this), instanceOptions);
6504
+ });
6505
+
6506
+ return this;
6507
+ } else if (typeof options === 'string') {
6508
+ var ret;
6509
+ var args = Array.prototype.slice.call(arguments, 1);
6510
+
6511
+ this.each(function () {
6512
+ var instance = $(this).data('select2');
6513
+
6514
+ if (instance == null && window.console && console.error) {
6515
+ console.error(
6516
+ 'The select2(\'' + options + '\') method was called on an ' +
6517
+ 'element that is not using Select2.'
6518
+ );
6519
+ }
6520
+
6521
+ ret = instance[options].apply(instance, args);
6522
+ });
6523
+
6524
+ // Check if we should be returning `this`
6525
+ if ($.inArray(options, thisMethods) > -1) {
6526
+ return this;
6527
+ }
6528
+
6529
+ return ret;
6530
+ } else {
6531
+ throw new Error('Invalid arguments for Select2: ' + options);
6532
+ }
6533
+ };
6534
+ }
6535
+
6536
+ if ($.fn.select2 != null && $.fn.select2.defaults != null) {
6537
+ $.fn.selectWoo.defaults = $.fn.select2.defaults;
6538
+ }
6539
+
6540
+ if ($.fn.selectWoo.defaults == null) {
6541
+ $.fn.selectWoo.defaults = Defaults;
6542
+ }
6543
+
6544
+ // Also register selectWoo under select2 if select2 is not already present.
6545
+ $.fn.select2 = $.fn.select2 || $.fn.selectWoo;
6546
+
6547
+ return Select2;
6548
+ });
6549
+
6550
+ // Return the AMD loader configuration so it can be used outside of this file
6551
+ return {
6552
+ define: S2.define,
6553
+ require: S2.require
6554
+ };
6555
+ }());
6556
+
6557
+ // Autoload the jQuery bindings
6558
+ // We know that all of the modules exist above this, so we're safe
6559
+ var select2 = S2.require('jquery.select2');
6560
+
6561
+ // Hold the AMD module references on the jQuery function that was just loaded
6562
+ // This allows Select2 to use the internal loader outside of this file, such
6563
+ // as in the language files.
6564
+ jQuery.fn.select2.amd = S2;
6565
+ jQuery.fn.selectWoo.amd = S2;
6566
+
6567
+ // Return the Select2 instance for anyone who is importing it.
6568
+ return select2;
6569
+ }));
assets/js/selectWPUF/selectWPUF.full.min.js ADDED
@@ -0,0 +1 @@
 
1
+ /*! Select2 1.0.1 | 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.isTouchscreen=function(){return void 0===c._isTouchscreenCache&&(c._isTouchscreenCache="ontouchstart"in document.documentElement),c._isTouchscreenCache},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="listbox" tabindex="-1"></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="alert" 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[data-selected]"),b=a.filter("[data-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[data-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("data-selected","true"):b.attr("data-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:"option","data-selected":"false",tabindex:-1};b.disabled&&(delete d["data-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["data-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d["aria-label"]=b.text,delete d["data-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";var i=a(h);this.template(b,h),i.attr("role","presentation");for(var j=[],k=0;k<b.children.length;k++){var l=b.children[k],m=this.option(l);j.push(m)}var n=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"listbox"});n.append(j),g.attr("role","list"),g.append(h),g.append(n)}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("data-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[data-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("[data-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").attr("aria-selected","true"),d.$results.attr("aria-activedescendant",a.element.attr("id"))}),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[data-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("data-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[data-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),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("[data-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" 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.options.get("minimumResultsForSearch");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"),window.setTimeout(function(){d.$selection.focus()},1),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).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",d),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("keydown",function(b){!a.isOpen()&&b.which>=48&&b.which<=90&&a.open()}),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" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></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})}}),this.$selection.on("keydown",function(a){!b.isOpen()&&a.which>=48&&a.which<=90&&b.open()})},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" aria-hidden="true">&times;</span></li>')},d.prototype.update=function(a){var b=this;if(this.clear(),0!==a.length){for(var d=[],e=0;e<a.length;e++){var f=a[e],g=this.selectionContainer(),h=this.display(f,g).trim();g.append(h),g.prop("title",f.title||f.text),g.data("data",f),d.push(g)}var i=this.$selection.find(".select2-selection__rendered");c.appendMany(i,d),void 0!==this.$search&&setTimeout(function(){b.$search.focus()},1)}},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="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" 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,f=b.id+"-results";a.call(this,b,d),b.on("open",function(){e.$search.attr("aria-owns",f),e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),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.data._resultId)}),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 g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)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(h&&"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="";return d+=null!=b?b.id:a.generateChars(4),d+="-result-",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&&(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),e.container.focusOnActiveElement()},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="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this,f=c.id+"-results";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.attr("aria-owns",f),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),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.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.data._resultId)})},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="option" 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 b=this;this.on("open",function(){b.$container.addClass("select2-container--open")}),this.on("close",function(){b.$container.removeClass("select2-container--open")}),this.on("enable",function(){b.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){b.$container.addClass("select2-container--disabled")}),this.on("blur",function(){b.$container.removeClass("select2-container--focus")}),this.on("query",function(a){b.isOpen()||b.trigger("open",{}),this.dataAdapter.query(a,function(c){b.trigger("results:all",{data:c,query:a})})}),this.on("query:append",function(a){this.dataAdapter.query(a,function(c){b.trigger("results:append",{data:c,query:a})})}),this.on("open",function(){setTimeout(function(){b.focusOnActiveElement()},1)}),a(document).on("keydown",function(a){var c=a.which;if(b.isOpen()){c===d.ESC||c===d.TAB||c===d.UP&&a.altKey?(b.close(),a.preventDefault()):c===d.ENTER?(b.trigger("results:select",{}),a.preventDefault()):c===d.SPACE&&a.ctrlKey?(b.trigger("results:toggle",{}),a.preventDefault()):c===d.UP?(b.trigger("results:previous",{}),a.preventDefault()):c===d.DOWN&&(b.trigger("results:next",{}),a.preventDefault());var e=b.$dropdown.find(".select2-search__field");e.length||(e=b.$container.find(".select2-search__field")),c===d.DOWN||c===d.UP?b.focusOnActiveElement():(e.focus(),setTimeout(function(){b.focusOnActiveElement()},1e3)),e.on("keydown",function(a){a.which===d.ENTER&&(b.trigger("results:select",{}),a.preventDefault())})}else b.hasFocus()&&(c===d.ENTER||c===d.SPACE||c===d.DOWN&&a.altKey)&&(b.open(),a.preventDefault())})},e.prototype.focusOnActiveElement=function(){c.isTouchscreen()||this.$results.find("li.select2-results__option--highlighted").focus()},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("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(f=d(this))&&g.push(f)})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;if(this._isInitialized)return void b.call(this,c);this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];b.id!=f.id&&d.push(f.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),b.define("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f];b(c.term,g.text,g)||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c,this.options.get("query").call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){c.find(".dropdown-wrapper").append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n<f)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.selectWoo){var e=["open","close","destroy"];a.fn.selectWoo=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&&null!=a.fn.select2.defaults&&(a.fn.selectWoo.defaults=a.fn.select2.defaults),null==a.fn.selectWoo.defaults&&(a.fn.selectWoo.defaults=d),a.fn.select2=a.fn.select2||a.fn.selectWoo,c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,a.fn.selectWoo.amd=b,c});
assets/js/selectWPUF/selectWPUF.js ADDED
@@ -0,0 +1,5858 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * SelectWoo 1.0.1
3
+ * https://github.com/woocommerce/selectWoo
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/woocommerce/selectWoo/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
+ // Determine whether the browser is on a touchscreen device.
776
+ Utils.isTouchscreen = function() {
777
+ if ('undefined' === typeof Utils._isTouchscreenCache) {
778
+ Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
779
+ }
780
+ return Utils._isTouchscreenCache;
781
+ }
782
+
783
+ return Utils;
784
+ });
785
+
786
+ S2.define('select2/results',[
787
+ 'jquery',
788
+ './utils'
789
+ ], function ($, Utils) {
790
+ function Results ($element, options, dataAdapter) {
791
+ this.$element = $element;
792
+ this.data = dataAdapter;
793
+ this.options = options;
794
+
795
+ Results.__super__.constructor.call(this);
796
+ }
797
+
798
+ Utils.Extend(Results, Utils.Observable);
799
+
800
+ Results.prototype.render = function () {
801
+ var $results = $(
802
+ '<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>'
803
+ );
804
+
805
+ if (this.options.get('multiple')) {
806
+ $results.attr('aria-multiselectable', 'true');
807
+ }
808
+
809
+ this.$results = $results;
810
+
811
+ return $results;
812
+ };
813
+
814
+ Results.prototype.clear = function () {
815
+ this.$results.empty();
816
+ };
817
+
818
+ Results.prototype.displayMessage = function (params) {
819
+ var escapeMarkup = this.options.get('escapeMarkup');
820
+
821
+ this.clear();
822
+ this.hideLoading();
823
+
824
+ var $message = $(
825
+ '<li role="alert" aria-live="assertive"' +
826
+ ' class="select2-results__option"></li>'
827
+ );
828
+
829
+ var message = this.options.get('translations').get(params.message);
830
+
831
+ $message.append(
832
+ escapeMarkup(
833
+ message(params.args)
834
+ )
835
+ );
836
+
837
+ $message[0].className += ' select2-results__message';
838
+
839
+ this.$results.append($message);
840
+ };
841
+
842
+ Results.prototype.hideMessages = function () {
843
+ this.$results.find('.select2-results__message').remove();
844
+ };
845
+
846
+ Results.prototype.append = function (data) {
847
+ this.hideLoading();
848
+
849
+ var $options = [];
850
+
851
+ if (data.results == null || data.results.length === 0) {
852
+ if (this.$results.children().length === 0) {
853
+ this.trigger('results:message', {
854
+ message: 'noResults'
855
+ });
856
+ }
857
+
858
+ return;
859
+ }
860
+
861
+ data.results = this.sort(data.results);
862
+
863
+ for (var d = 0; d < data.results.length; d++) {
864
+ var item = data.results[d];
865
+
866
+ var $option = this.option(item);
867
+
868
+ $options.push($option);
869
+ }
870
+
871
+ this.$results.append($options);
872
+ };
873
+
874
+ Results.prototype.position = function ($results, $dropdown) {
875
+ var $resultsContainer = $dropdown.find('.select2-results');
876
+ $resultsContainer.append($results);
877
+ };
878
+
879
+ Results.prototype.sort = function (data) {
880
+ var sorter = this.options.get('sorter');
881
+
882
+ return sorter(data);
883
+ };
884
+
885
+ Results.prototype.highlightFirstItem = function () {
886
+ var $options = this.$results
887
+ .find('.select2-results__option[data-selected]');
888
+
889
+ var $selected = $options.filter('[data-selected=true]');
890
+
891
+ // Check if there are any selected options
892
+ if ($selected.length > 0) {
893
+ // If there are selected options, highlight the first
894
+ $selected.first().trigger('mouseenter');
895
+ } else {
896
+ // If there are no selected options, highlight the first option
897
+ // in the dropdown
898
+ $options.first().trigger('mouseenter');
899
+ }
900
+
901
+ this.ensureHighlightVisible();
902
+ };
903
+
904
+ Results.prototype.setClasses = function () {
905
+ var self = this;
906
+
907
+ this.data.current(function (selected) {
908
+ var selectedIds = $.map(selected, function (s) {
909
+ return s.id.toString();
910
+ });
911
+
912
+ var $options = self.$results
913
+ .find('.select2-results__option[data-selected]');
914
+
915
+ $options.each(function () {
916
+ var $option = $(this);
917
+
918
+ var item = $.data(this, 'data');
919
+
920
+ // id needs to be converted to a string when comparing
921
+ var id = '' + item.id;
922
+
923
+ if ((item.element != null && item.element.selected) ||
924
+ (item.element == null && $.inArray(id, selectedIds) > -1)) {
925
+ $option.attr('data-selected', 'true');
926
+ } else {
927
+ $option.attr('data-selected', 'false');
928
+ }
929
+ });
930
+
931
+ });
932
+ };
933
+
934
+ Results.prototype.showLoading = function (params) {
935
+ this.hideLoading();
936
+
937
+ var loadingMore = this.options.get('translations').get('searching');
938
+
939
+ var loading = {
940
+ disabled: true,
941
+ loading: true,
942
+ text: loadingMore(params)
943
+ };
944
+ var $loading = this.option(loading);
945
+ $loading.className += ' loading-results';
946
+
947
+ this.$results.prepend($loading);
948
+ };
949
+
950
+ Results.prototype.hideLoading = function () {
951
+ this.$results.find('.loading-results').remove();
952
+ };
953
+
954
+ Results.prototype.option = function (data) {
955
+ var option = document.createElement('li');
956
+ option.className = 'select2-results__option';
957
+
958
+ var attrs = {
959
+ 'role': 'option',
960
+ 'data-selected': 'false',
961
+ 'tabindex': -1
962
+ };
963
+
964
+ if (data.disabled) {
965
+ delete attrs['data-selected'];
966
+ attrs['aria-disabled'] = 'true';
967
+ }
968
+
969
+ if (data.id == null) {
970
+ delete attrs['data-selected'];
971
+ }
972
+
973
+ if (data._resultId != null) {
974
+ option.id = data._resultId;
975
+ }
976
+
977
+ if (data.title) {
978
+ option.title = data.title;
979
+ }
980
+
981
+ if (data.children) {
982
+ attrs['aria-label'] = data.text;
983
+ delete attrs['data-selected'];
984
+ }
985
+
986
+ for (var attr in attrs) {
987
+ var val = attrs[attr];
988
+
989
+ option.setAttribute(attr, val);
990
+ }
991
+
992
+ if (data.children) {
993
+ var $option = $(option);
994
+
995
+ var label = document.createElement('strong');
996
+ label.className = 'select2-results__group';
997
+
998
+ var $label = $(label);
999
+ this.template(data, label);
1000
+ $label.attr('role', 'presentation');
1001
+
1002
+ var $children = [];
1003
+
1004
+ for (var c = 0; c < data.children.length; c++) {
1005
+ var child = data.children[c];
1006
+
1007
+ var $child = this.option(child);
1008
+
1009
+ $children.push($child);
1010
+ }
1011
+
1012
+ var $childrenContainer = $('<ul></ul>', {
1013
+ 'class': 'select2-results__options select2-results__options--nested',
1014
+ 'role': 'listbox'
1015
+ });
1016
+ $childrenContainer.append($children);
1017
+ $option.attr('role', 'list');
1018
+
1019
+ $option.append(label);
1020
+ $option.append($childrenContainer);
1021
+ } else {
1022
+ this.template(data, option);
1023
+ }
1024
+
1025
+ $.data(option, 'data', data);
1026
+
1027
+ return option;
1028
+ };
1029
+
1030
+ Results.prototype.bind = function (container, $container) {
1031
+ var self = this;
1032
+
1033
+ var id = container.id + '-results';
1034
+
1035
+ this.$results.attr('id', id);
1036
+
1037
+ container.on('results:all', function (params) {
1038
+ self.clear();
1039
+ self.append(params.data);
1040
+
1041
+ if (container.isOpen()) {
1042
+ self.setClasses();
1043
+ self.highlightFirstItem();
1044
+ }
1045
+ });
1046
+
1047
+ container.on('results:append', function (params) {
1048
+ self.append(params.data);
1049
+
1050
+ if (container.isOpen()) {
1051
+ self.setClasses();
1052
+ }
1053
+ });
1054
+
1055
+ container.on('query', function (params) {
1056
+ self.hideMessages();
1057
+ self.showLoading(params);
1058
+ });
1059
+
1060
+ container.on('select', function () {
1061
+ if (!container.isOpen()) {
1062
+ return;
1063
+ }
1064
+
1065
+ self.setClasses();
1066
+ self.highlightFirstItem();
1067
+ });
1068
+
1069
+ container.on('unselect', function () {
1070
+ if (!container.isOpen()) {
1071
+ return;
1072
+ }
1073
+
1074
+ self.setClasses();
1075
+ self.highlightFirstItem();
1076
+ });
1077
+
1078
+ container.on('open', function () {
1079
+ // When the dropdown is open, aria-expended="true"
1080
+ self.$results.attr('aria-expanded', 'true');
1081
+ self.$results.attr('aria-hidden', 'false');
1082
+
1083
+ self.setClasses();
1084
+ self.ensureHighlightVisible();
1085
+ });
1086
+
1087
+ container.on('close', function () {
1088
+ // When the dropdown is closed, aria-expended="false"
1089
+ self.$results.attr('aria-expanded', 'false');
1090
+ self.$results.attr('aria-hidden', 'true');
1091
+ self.$results.removeAttr('aria-activedescendant');
1092
+ });
1093
+
1094
+ container.on('results:toggle', function () {
1095
+ var $highlighted = self.getHighlightedResults();
1096
+
1097
+ if ($highlighted.length === 0) {
1098
+ return;
1099
+ }
1100
+
1101
+ $highlighted.trigger('mouseup');
1102
+ });
1103
+
1104
+ container.on('results:select', function () {
1105
+ var $highlighted = self.getHighlightedResults();
1106
+
1107
+ if ($highlighted.length === 0) {
1108
+ return;
1109
+ }
1110
+
1111
+ var data = $highlighted.data('data');
1112
+
1113
+ if ($highlighted.attr('data-selected') == 'true') {
1114
+ self.trigger('close', {});
1115
+ } else {
1116
+ self.trigger('select', {
1117
+ data: data
1118
+ });
1119
+ }
1120
+ });
1121
+
1122
+ container.on('results:previous', function () {
1123
+ var $highlighted = self.getHighlightedResults();
1124
+
1125
+ var $options = self.$results.find('[data-selected]');
1126
+
1127
+ var currentIndex = $options.index($highlighted);
1128
+
1129
+ // If we are already at te top, don't move further
1130
+ if (currentIndex === 0) {
1131
+ return;
1132
+ }
1133
+
1134
+ var nextIndex = currentIndex - 1;
1135
+
1136
+ // If none are highlighted, highlight the first
1137
+ if ($highlighted.length === 0) {
1138
+ nextIndex = 0;
1139
+ }
1140
+
1141
+ var $next = $options.eq(nextIndex);
1142
+
1143
+ $next.trigger('mouseenter');
1144
+
1145
+ var currentOffset = self.$results.offset().top;
1146
+ var nextTop = $next.offset().top;
1147
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1148
+
1149
+ if (nextIndex === 0) {
1150
+ self.$results.scrollTop(0);
1151
+ } else if (nextTop - currentOffset < 0) {
1152
+ self.$results.scrollTop(nextOffset);
1153
+ }
1154
+ });
1155
+
1156
+ container.on('results:next', function () {
1157
+ var $highlighted = self.getHighlightedResults();
1158
+
1159
+ var $options = self.$results.find('[data-selected]');
1160
+
1161
+ var currentIndex = $options.index($highlighted);
1162
+
1163
+ var nextIndex = currentIndex + 1;
1164
+
1165
+ // If we are at the last option, stay there
1166
+ if (nextIndex >= $options.length) {
1167
+ return;
1168
+ }
1169
+
1170
+ var $next = $options.eq(nextIndex);
1171
+
1172
+ $next.trigger('mouseenter');
1173
+
1174
+ var currentOffset = self.$results.offset().top +
1175
+ self.$results.outerHeight(false);
1176
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1177
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1178
+
1179
+ if (nextIndex === 0) {
1180
+ self.$results.scrollTop(0);
1181
+ } else if (nextBottom > currentOffset) {
1182
+ self.$results.scrollTop(nextOffset);
1183
+ }
1184
+ });
1185
+
1186
+ container.on('results:focus', function (params) {
1187
+ params.element.addClass('select2-results__option--highlighted').attr('aria-selected', 'true');
1188
+ self.$results.attr('aria-activedescendant', params.element.attr('id'));
1189
+ });
1190
+
1191
+ container.on('results:message', function (params) {
1192
+ self.displayMessage(params);
1193
+ });
1194
+
1195
+ if ($.fn.mousewheel) {
1196
+ this.$results.on('mousewheel', function (e) {
1197
+ var top = self.$results.scrollTop();
1198
+
1199
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1200
+
1201
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1202
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1203
+
1204
+ if (isAtTop) {
1205
+ self.$results.scrollTop(0);
1206
+
1207
+ e.preventDefault();
1208
+ e.stopPropagation();
1209
+ } else if (isAtBottom) {
1210
+ self.$results.scrollTop(
1211
+ self.$results.get(0).scrollHeight - self.$results.height()
1212
+ );
1213
+
1214
+ e.preventDefault();
1215
+ e.stopPropagation();
1216
+ }
1217
+ });
1218
+ }
1219
+
1220
+ this.$results.on('mouseup', '.select2-results__option[data-selected]',
1221
+ function (evt) {
1222
+ var $this = $(this);
1223
+
1224
+ var data = $this.data('data');
1225
+
1226
+ if ($this.attr('data-selected') === 'true') {
1227
+ if (self.options.get('multiple')) {
1228
+ self.trigger('unselect', {
1229
+ originalEvent: evt,
1230
+ data: data
1231
+ });
1232
+ } else {
1233
+ self.trigger('close', {});
1234
+ }
1235
+
1236
+ return;
1237
+ }
1238
+
1239
+ self.trigger('select', {
1240
+ originalEvent: evt,
1241
+ data: data
1242
+ });
1243
+ });
1244
+
1245
+ this.$results.on('mouseenter', '.select2-results__option[data-selected]',
1246
+ function (evt) {
1247
+ var data = $(this).data('data');
1248
+
1249
+ self.getHighlightedResults()
1250
+ .removeClass('select2-results__option--highlighted')
1251
+ .attr('aria-selected', 'false');
1252
+
1253
+ self.trigger('results:focus', {
1254
+ data: data,
1255
+ element: $(this)
1256
+ });
1257
+ });
1258
+ };
1259
+
1260
+ Results.prototype.getHighlightedResults = function () {
1261
+ var $highlighted = this.$results
1262
+ .find('.select2-results__option--highlighted');
1263
+
1264
+ return $highlighted;
1265
+ };
1266
+
1267
+ Results.prototype.destroy = function () {
1268
+ this.$results.remove();
1269
+ };
1270
+
1271
+ Results.prototype.ensureHighlightVisible = function () {
1272
+ var $highlighted = this.getHighlightedResults();
1273
+
1274
+ if ($highlighted.length === 0) {
1275
+ return;
1276
+ }
1277
+
1278
+ var $options = this.$results.find('[data-selected]');
1279
+
1280
+ var currentIndex = $options.index($highlighted);
1281
+
1282
+ var currentOffset = this.$results.offset().top;
1283
+ var nextTop = $highlighted.offset().top;
1284
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1285
+
1286
+ var offsetDelta = nextTop - currentOffset;
1287
+ nextOffset -= $highlighted.outerHeight(false) * 2;
1288
+
1289
+ if (currentIndex <= 2) {
1290
+ this.$results.scrollTop(0);
1291
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1292
+ this.$results.scrollTop(nextOffset);
1293
+ }
1294
+ };
1295
+
1296
+ Results.prototype.template = function (result, container) {
1297
+ var template = this.options.get('templateResult');
1298
+ var escapeMarkup = this.options.get('escapeMarkup');
1299
+
1300
+ var content = template(result, container);
1301
+
1302
+ if (content == null) {
1303
+ container.style.display = 'none';
1304
+ } else if (typeof content === 'string') {
1305
+ container.innerHTML = escapeMarkup(content);
1306
+ } else {
1307
+ $(container).append(content);
1308
+ }
1309
+ };
1310
+
1311
+ return Results;
1312
+ });
1313
+
1314
+ S2.define('select2/keys',[
1315
+
1316
+ ], function () {
1317
+ var KEYS = {
1318
+ BACKSPACE: 8,
1319
+ TAB: 9,
1320
+ ENTER: 13,
1321
+ SHIFT: 16,
1322
+ CTRL: 17,
1323
+ ALT: 18,
1324
+ ESC: 27,
1325
+ SPACE: 32,
1326
+ PAGE_UP: 33,
1327
+ PAGE_DOWN: 34,
1328
+ END: 35,
1329
+ HOME: 36,
1330
+ LEFT: 37,
1331
+ UP: 38,
1332
+ RIGHT: 39,
1333
+ DOWN: 40,
1334
+ DELETE: 46
1335
+ };
1336
+
1337
+ return KEYS;
1338
+ });
1339
+
1340
+ S2.define('select2/selection/base',[
1341
+ 'jquery',
1342
+ '../utils',
1343
+ '../keys'
1344
+ ], function ($, Utils, KEYS) {
1345
+ function BaseSelection ($element, options) {
1346
+ this.$element = $element;
1347
+ this.options = options;
1348
+
1349
+ BaseSelection.__super__.constructor.call(this);
1350
+ }
1351
+
1352
+ Utils.Extend(BaseSelection, Utils.Observable);
1353
+
1354
+ BaseSelection.prototype.render = function () {
1355
+ var $selection = $(
1356
+ '<span class="select2-selection" ' +
1357
+ ' aria-haspopup="true" aria-expanded="false">' +
1358
+ '</span>'
1359
+ );
1360
+
1361
+ this._tabindex = 0;
1362
+
1363
+ if (this.$element.data('old-tabindex') != null) {
1364
+ this._tabindex = this.$element.data('old-tabindex');
1365
+ } else if (this.$element.attr('tabindex') != null) {
1366
+ this._tabindex = this.$element.attr('tabindex');
1367
+ }
1368
+
1369
+ $selection.attr('title', this.$element.attr('title'));
1370
+ $selection.attr('tabindex', this._tabindex);
1371
+
1372
+ this.$selection = $selection;
1373
+
1374
+ return $selection;
1375
+ };
1376
+
1377
+ BaseSelection.prototype.bind = function (container, $container) {
1378
+ var self = this;
1379
+
1380
+ var id = container.id + '-container';
1381
+ var resultsId = container.id + '-results';
1382
+ var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
1383
+
1384
+ this.container = container;
1385
+
1386
+ this.$selection.on('focus', function (evt) {
1387
+ self.trigger('focus', evt);
1388
+ });
1389
+
1390
+ this.$selection.on('blur', function (evt) {
1391
+ self._handleBlur(evt);
1392
+ });
1393
+
1394
+ this.$selection.on('keydown', function (evt) {
1395
+ self.trigger('keypress', evt);
1396
+
1397
+ if (evt.which === KEYS.SPACE) {
1398
+ evt.preventDefault();
1399
+ }
1400
+ });
1401
+
1402
+ container.on('results:focus', function (params) {
1403
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1404
+ });
1405
+
1406
+ container.on('selection:update', function (params) {
1407
+ self.update(params.data);
1408
+ });
1409
+
1410
+ container.on('open', function () {
1411
+ // When the dropdown is open, aria-expanded="true"
1412
+ self.$selection.attr('aria-expanded', 'true');
1413
+ self.$selection.attr('aria-owns', resultsId);
1414
+
1415
+ self._attachCloseHandler(container);
1416
+ });
1417
+
1418
+ container.on('close', function () {
1419
+ // When the dropdown is closed, aria-expanded="false"
1420
+ self.$selection.attr('aria-expanded', 'false');
1421
+ self.$selection.removeAttr('aria-activedescendant');
1422
+ self.$selection.removeAttr('aria-owns');
1423
+
1424
+ // This needs to be delayed as the active element is the body when the
1425
+ // key is pressed.
1426
+ window.setTimeout(function () {
1427
+ self.$selection.focus();
1428
+ }, 1);
1429
+
1430
+ self._detachCloseHandler(container);
1431
+ });
1432
+
1433
+ container.on('enable', function () {
1434
+ self.$selection.attr('tabindex', self._tabindex);
1435
+ });
1436
+
1437
+ container.on('disable', function () {
1438
+ self.$selection.attr('tabindex', '-1');
1439
+ });
1440
+ };
1441
+
1442
+ BaseSelection.prototype._handleBlur = function (evt) {
1443
+ var self = this;
1444
+
1445
+ // This needs to be delayed as the active element is the body when the tab
1446
+ // key is pressed, possibly along with others.
1447
+ window.setTimeout(function () {
1448
+ // Don't trigger `blur` if the focus is still in the selection
1449
+ if (
1450
+ (document.activeElement == self.$selection[0]) ||
1451
+ ($.contains(self.$selection[0], document.activeElement))
1452
+ ) {
1453
+ return;
1454
+ }
1455
+
1456
+ self.trigger('blur', evt);
1457
+ }, 1);
1458
+ };
1459
+
1460
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1461
+ var self = this;
1462
+
1463
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1464
+ var $target = $(e.target);
1465
+
1466
+ var $select = $target.closest('.select2');
1467
+
1468
+ var $all = $('.select2.select2-container--open');
1469
+
1470
+ $all.each(function () {
1471
+ var $this = $(this);
1472
+
1473
+ if (this == $select[0]) {
1474
+ return;
1475
+ }
1476
+
1477
+ var $element = $this.data('element');
1478
+
1479
+ $element.select2('close');
1480
+ });
1481
+ });
1482
+ };
1483
+
1484
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1485
+ $(document.body).off('mousedown.select2.' + container.id);
1486
+ };
1487
+
1488
+ BaseSelection.prototype.position = function ($selection, $container) {
1489
+ var $selectionContainer = $container.find('.selection');
1490
+ $selectionContainer.append($selection);
1491
+ };
1492
+
1493
+ BaseSelection.prototype.destroy = function () {
1494
+ this._detachCloseHandler(this.container);
1495
+ };
1496
+
1497
+ BaseSelection.prototype.update = function (data) {
1498
+ throw new Error('The `update` method must be defined in child classes.');
1499
+ };
1500
+
1501
+ return BaseSelection;
1502
+ });
1503
+
1504
+ S2.define('select2/selection/single',[
1505
+ 'jquery',
1506
+ './base',
1507
+ '../utils',
1508
+ '../keys'
1509
+ ], function ($, BaseSelection, Utils, KEYS) {
1510
+ function SingleSelection () {
1511
+ SingleSelection.__super__.constructor.apply(this, arguments);
1512
+ }
1513
+
1514
+ Utils.Extend(SingleSelection, BaseSelection);
1515
+
1516
+ SingleSelection.prototype.render = function () {
1517
+ var $selection = SingleSelection.__super__.render.call(this);
1518
+
1519
+ $selection.addClass('select2-selection--single');
1520
+
1521
+ $selection.html(
1522
+ '<span class="select2-selection__rendered"></span>' +
1523
+ '<span class="select2-selection__arrow" role="presentation">' +
1524
+ '<b role="presentation"></b>' +
1525
+ '</span>'
1526
+ );
1527
+
1528
+ return $selection;
1529
+ };
1530
+
1531
+ SingleSelection.prototype.bind = function (container, $container) {
1532
+ var self = this;
1533
+
1534
+ SingleSelection.__super__.bind.apply(this, arguments);
1535
+
1536
+ var id = container.id + '-container';
1537
+
1538
+ this.$selection.find('.select2-selection__rendered')
1539
+ .attr('id', id)
1540
+ .attr('role', 'textbox')
1541
+ .attr('aria-readonly', 'true');
1542
+ this.$selection.attr('aria-labelledby', id);
1543
+
1544
+ // This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
1545
+ this.$selection.attr('role', 'combobox');
1546
+
1547
+ this.$selection.on('mousedown', function (evt) {
1548
+ // Only respond to left clicks
1549
+ if (evt.which !== 1) {
1550
+ return;
1551
+ }
1552
+
1553
+ self.trigger('toggle', {
1554
+ originalEvent: evt
1555
+ });
1556
+ });
1557
+
1558
+ this.$selection.on('focus', function (evt) {
1559
+ // User focuses on the container
1560
+ });
1561
+
1562
+ this.$selection.on('keydown', function (evt) {
1563
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
1564
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
1565
+ container.open();
1566
+ }
1567
+ });
1568
+
1569
+ this.$selection.on('blur', function (evt) {
1570
+ // User exits the container
1571
+ });
1572
+
1573
+ container.on('focus', function (evt) {
1574
+ if (!container.isOpen()) {
1575
+ self.$selection.focus();
1576
+ }
1577
+ });
1578
+
1579
+ container.on('selection:update', function (params) {
1580
+ self.update(params.data);
1581
+ });
1582
+ };
1583
+
1584
+ SingleSelection.prototype.clear = function () {
1585
+ this.$selection.find('.select2-selection__rendered').empty();
1586
+ };
1587
+
1588
+ SingleSelection.prototype.display = function (data, container) {
1589
+ var template = this.options.get('templateSelection');
1590
+ var escapeMarkup = this.options.get('escapeMarkup');
1591
+
1592
+ return escapeMarkup(template(data, container));
1593
+ };
1594
+
1595
+ SingleSelection.prototype.selectionContainer = function () {
1596
+ return $('<span></span>');
1597
+ };
1598
+
1599
+ SingleSelection.prototype.update = function (data) {
1600
+ if (data.length === 0) {
1601
+ this.clear();
1602
+ return;
1603
+ }
1604
+
1605
+ var selection = data[0];
1606
+
1607
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1608
+ var formatted = this.display(selection, $rendered);
1609
+
1610
+ $rendered.empty().append(formatted);
1611
+ $rendered.prop('title', selection.title || selection.text);
1612
+ };
1613
+
1614
+ return SingleSelection;
1615
+ });
1616
+
1617
+ S2.define('select2/selection/multiple',[
1618
+ 'jquery',
1619
+ './base',
1620
+ '../utils'
1621
+ ], function ($, BaseSelection, Utils) {
1622
+ function MultipleSelection ($element, options) {
1623
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1624
+ }
1625
+
1626
+ Utils.Extend(MultipleSelection, BaseSelection);
1627
+
1628
+ MultipleSelection.prototype.render = function () {
1629
+ var $selection = MultipleSelection.__super__.render.call(this);
1630
+
1631
+ $selection.addClass('select2-selection--multiple');
1632
+
1633
+ $selection.html(
1634
+ '<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>'
1635
+ );
1636
+
1637
+ return $selection;
1638
+ };
1639
+
1640
+ MultipleSelection.prototype.bind = function (container, $container) {
1641
+ var self = this;
1642
+
1643
+ MultipleSelection.__super__.bind.apply(this, arguments);
1644
+
1645
+ this.$selection.on('click', function (evt) {
1646
+ self.trigger('toggle', {
1647
+ originalEvent: evt
1648
+ });
1649
+ });
1650
+
1651
+ this.$selection.on(
1652
+ 'click',
1653
+ '.select2-selection__choice__remove',
1654
+ function (evt) {
1655
+ // Ignore the event if it is disabled
1656
+ if (self.options.get('disabled')) {
1657
+ return;
1658
+ }
1659
+
1660
+ var $remove = $(this);
1661
+ var $selection = $remove.parent();
1662
+
1663
+ var data = $selection.data('data');
1664
+
1665
+ self.trigger('unselect', {
1666
+ originalEvent: evt,
1667
+ data: data
1668
+ });
1669
+ }
1670
+ );
1671
+
1672
+ this.$selection.on('keydown', function (evt) {
1673
+ // If user starts typing an alphanumeric key on the keyboard, open if not opened.
1674
+ if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
1675
+ container.open();
1676
+ }
1677
+ });
1678
+ };
1679
+
1680
+ MultipleSelection.prototype.clear = function () {
1681
+ this.$selection.find('.select2-selection__rendered').empty();
1682
+ };
1683
+
1684
+ MultipleSelection.prototype.display = function (data, container) {
1685
+ var template = this.options.get('templateSelection');
1686
+ var escapeMarkup = this.options.get('escapeMarkup');
1687
+
1688
+ return escapeMarkup(template(data, container));
1689
+ };
1690
+
1691
+ MultipleSelection.prototype.selectionContainer = function () {
1692
+ var $container = $(
1693
+ '<li class="select2-selection__choice">' +
1694
+ '<span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">' +
1695
+ '&times;' +
1696
+ '</span>' +
1697
+ '</li>'
1698
+ );
1699
+
1700
+ return $container;
1701
+ };
1702
+
1703
+ MultipleSelection.prototype.update = function (data) {
1704
+ var self = this;
1705
+ this.clear();
1706
+
1707
+ if (data.length === 0) {
1708
+ return;
1709
+ }
1710
+
1711
+ var $selections = [];
1712
+
1713
+ for (var d = 0; d < data.length; d++) {
1714
+ var selection = data[d];
1715
+
1716
+ var $selection = this.selectionContainer();
1717
+ var formatted = this.display(selection, $selection).trim();
1718
+
1719
+ $selection.append(formatted);
1720
+ $selection.prop('title', selection.title || selection.text);
1721
+
1722
+ $selection.data('data', selection);
1723
+
1724
+ $selections.push($selection);
1725
+ }
1726
+
1727
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1728
+
1729
+ Utils.appendMany($rendered, $selections);
1730
+
1731
+ // Return cursor to search field after updating.
1732
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
1733
+ if ('undefined' !== typeof this.$search) {
1734
+ setTimeout(function(){
1735
+ self.$search.focus();
1736
+ }, 1);
1737
+ }
1738
+ };
1739
+
1740
+ return MultipleSelection;
1741
+ });
1742
+
1743
+ S2.define('select2/selection/placeholder',[
1744
+ '../utils'
1745
+ ], function (Utils) {
1746
+ function Placeholder (decorated, $element, options) {
1747
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1748
+
1749
+ decorated.call(this, $element, options);
1750
+ }
1751
+
1752
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1753
+ if (typeof placeholder === 'string') {
1754
+ placeholder = {
1755
+ id: '',
1756
+ text: placeholder
1757
+ };
1758
+ }
1759
+
1760
+ return placeholder;
1761
+ };
1762
+
1763
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1764
+ var $placeholder = this.selectionContainer();
1765
+
1766
+ $placeholder.html(this.display(placeholder));
1767
+ $placeholder.addClass('select2-selection__placeholder')
1768
+ .removeClass('select2-selection__choice');
1769
+
1770
+ return $placeholder;
1771
+ };
1772
+
1773
+ Placeholder.prototype.update = function (decorated, data) {
1774
+ var singlePlaceholder = (
1775
+ data.length == 1 && data[0].id != this.placeholder.id
1776
+ );
1777
+ var multipleSelections = data.length > 1;
1778
+
1779
+ if (multipleSelections || singlePlaceholder) {
1780
+ return decorated.call(this, data);
1781
+ }
1782
+
1783
+ this.clear();
1784
+
1785
+ var $placeholder = this.createPlaceholder(this.placeholder);
1786
+
1787
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1788
+ };
1789
+
1790
+ return Placeholder;
1791
+ });
1792
+
1793
+ S2.define('select2/selection/allowClear',[
1794
+ 'jquery',
1795
+ '../keys'
1796
+ ], function ($, KEYS) {
1797
+ function AllowClear () { }
1798
+
1799
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1800
+ var self = this;
1801
+
1802
+ decorated.call(this, container, $container);
1803
+
1804
+ if (this.placeholder == null) {
1805
+ if (this.options.get('debug') && window.console && console.error) {
1806
+ console.error(
1807
+ 'Select2: The `allowClear` option should be used in combination ' +
1808
+ 'with the `placeholder` option.'
1809
+ );
1810
+ }
1811
+ }
1812
+
1813
+ this.$selection.on('mousedown', '.select2-selection__clear',
1814
+ function (evt) {
1815
+ self._handleClear(evt);
1816
+ });
1817
+
1818
+ container.on('keypress', function (evt) {
1819
+ self._handleKeyboardClear(evt, container);
1820
+ });
1821
+ };
1822
+
1823
+ AllowClear.prototype._handleClear = function (_, evt) {
1824
+ // Ignore the event if it is disabled
1825
+ if (this.options.get('disabled')) {
1826
+ return;
1827
+ }
1828
+
1829
+ var $clear = this.$selection.find('.select2-selection__clear');
1830
+
1831
+ // Ignore the event if nothing has been selected
1832
+ if ($clear.length === 0) {
1833
+ return;
1834
+ }
1835
+
1836
+ evt.stopPropagation();
1837
+
1838
+ var data = $clear.data('data');
1839
+
1840
+ for (var d = 0; d < data.length; d++) {
1841
+ var unselectData = {
1842
+ data: data[d]
1843
+ };
1844
+
1845
+ // Trigger the `unselect` event, so people can prevent it from being
1846
+ // cleared.
1847
+ this.trigger('unselect', unselectData);
1848
+
1849
+ // If the event was prevented, don't clear it out.
1850
+ if (unselectData.prevented) {
1851
+ return;
1852
+ }
1853
+ }
1854
+
1855
+ this.$element.val(this.placeholder.id).trigger('change');
1856
+
1857
+ this.trigger('toggle', {});
1858
+ };
1859
+
1860
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1861
+ if (container.isOpen()) {
1862
+ return;
1863
+ }
1864
+
1865
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1866
+ this._handleClear(evt);
1867
+ }
1868
+ };
1869
+
1870
+ AllowClear.prototype.update = function (decorated, data) {
1871
+ decorated.call(this, data);
1872
+
1873
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1874
+ data.length === 0) {
1875
+ return;
1876
+ }
1877
+
1878
+ var $remove = $(
1879
+ '<span class="select2-selection__clear">' +
1880
+ '&times;' +
1881
+ '</span>'
1882
+ );
1883
+ $remove.data('data', data);
1884
+
1885
+ this.$selection.find('.select2-selection__rendered').prepend($remove);
1886
+ };
1887
+
1888
+ return AllowClear;
1889
+ });
1890
+
1891
+ S2.define('select2/selection/search',[
1892
+ 'jquery',
1893
+ '../utils',
1894
+ '../keys'
1895
+ ], function ($, Utils, KEYS) {
1896
+ function Search (decorated, $element, options) {
1897
+ decorated.call(this, $element, options);
1898
+ }
1899
+
1900
+ Search.prototype.render = function (decorated) {
1901
+ var $search = $(
1902
+ '<li class="select2-search select2-search--inline">' +
1903
+ '<input class="select2-search__field" type="text" tabindex="-1"' +
1904
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1905
+ ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1906
+ '</li>'
1907
+ );
1908
+
1909
+ this.$searchContainer = $search;
1910
+ this.$search = $search.find('input');
1911
+
1912
+ var $rendered = decorated.call(this);
1913
+
1914
+ this._transferTabIndex();
1915
+
1916
+ return $rendered;
1917
+ };
1918
+
1919
+ Search.prototype.bind = function (decorated, container, $container) {
1920
+ var self = this;
1921
+ var resultsId = container.id + '-results';
1922
+
1923
+ decorated.call(this, container, $container);
1924
+
1925
+ container.on('open', function () {
1926
+ self.$search.attr('aria-owns', resultsId);
1927
+ self.$search.trigger('focus');
1928
+ });
1929
+
1930
+ container.on('close', function () {
1931
+ self.$search.val('');
1932
+ self.$search.removeAttr('aria-activedescendant');
1933
+ self.$search.removeAttr('aria-owns');
1934
+ self.$search.trigger('focus');
1935
+ });
1936
+
1937
+ container.on('enable', function () {
1938
+ self.$search.prop('disabled', false);
1939
+
1940
+ self._transferTabIndex();
1941
+ });
1942
+
1943
+ container.on('disable', function () {
1944
+ self.$search.prop('disabled', true);
1945
+ });
1946
+
1947
+ container.on('focus', function (evt) {
1948
+ self.$search.trigger('focus');
1949
+ });
1950
+
1951
+ container.on('results:focus', function (params) {
1952
+ self.$search.attr('aria-activedescendant', params.data._resultId);
1953
+ });
1954
+
1955
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1956
+ self.trigger('focus', evt);
1957
+ });
1958
+
1959
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1960
+ self._handleBlur(evt);
1961
+ });
1962
+
1963
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1964
+ evt.stopPropagation();
1965
+
1966
+ self.trigger('keypress', evt);
1967
+
1968
+ self._keyUpPrevented = evt.isDefaultPrevented();
1969
+
1970
+ var key = evt.which;
1971
+
1972
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1973
+ var $previousChoice = self.$searchContainer
1974
+ .prev('.select2-selection__choice');
1975
+
1976
+ if ($previousChoice.length > 0) {
1977
+ var item = $previousChoice.data('data');
1978
+
1979
+ self.searchRemoveChoice(item);
1980
+
1981
+ evt.preventDefault();
1982
+ }
1983
+ }
1984
+ });
1985
+
1986
+ // Try to detect the IE version should the `documentMode` property that
1987
+ // is stored on the document. This is only implemented in IE and is
1988
+ // slightly cleaner than doing a user agent check.
1989
+ // This property is not available in Edge, but Edge also doesn't have
1990
+ // this bug.
1991
+ var msie = document.documentMode;
1992
+ var disableInputEvents = msie && msie <= 11;
1993
+
1994
+ // Workaround for browsers which do not support the `input` event
1995
+ // This will prevent double-triggering of events for browsers which support
1996
+ // both the `keyup` and `input` events.
1997
+ this.$selection.on(
1998
+ 'input.searchcheck',
1999
+ '.select2-search--inline',
2000
+ function (evt) {
2001
+ // IE will trigger the `input` event when a placeholder is used on a
2002
+ // search box. To get around this issue, we are forced to ignore all
2003
+ // `input` events in IE and keep using `keyup`.
2004
+ if (disableInputEvents) {
2005
+ self.$selection.off('input.search input.searchcheck');
2006
+ return;
2007
+ }
2008
+
2009
+ // Unbind the duplicated `keyup` event
2010
+ self.$selection.off('keyup.search');
2011
+ }
2012
+ );
2013
+
2014
+ this.$selection.on(
2015
+ 'keyup.search input.search',
2016
+ '.select2-search--inline',
2017
+ function (evt) {
2018
+ // IE will trigger the `input` event when a placeholder is used on a
2019
+ // search box. To get around this issue, we are forced to ignore all
2020
+ // `input` events in IE and keep using `keyup`.
2021
+ if (disableInputEvents && evt.type === 'input') {
2022
+ self.$selection.off('input.search input.searchcheck');
2023
+ return;
2024
+ }
2025
+
2026
+ var key = evt.which;
2027
+
2028
+ // We can freely ignore events from modifier keys
2029
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
2030
+ return;
2031
+ }
2032
+
2033
+ // Tabbing will be handled during the `keydown` phase
2034
+ if (key == KEYS.TAB) {
2035
+ return;
2036
+ }
2037
+
2038
+ self.handleSearch(evt);
2039
+ }
2040
+ );
2041
+ };
2042
+
2043
+ /**
2044
+ * This method will transfer the tabindex attribute from the rendered
2045
+ * selection to the search box. This allows for the search box to be used as
2046
+ * the primary focus instead of the selection container.
2047
+ *
2048
+ * @private
2049
+ */
2050
+ Search.prototype._transferTabIndex = function (decorated) {
2051
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2052
+ this.$selection.attr('tabindex', '-1');
2053
+ };
2054
+
2055
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2056
+ this.$search.attr('placeholder', placeholder.text);
2057
+ };
2058
+
2059
+ Search.prototype.update = function (decorated, data) {
2060
+ var searchHadFocus = this.$search[0] == document.activeElement;
2061
+
2062
+ this.$search.attr('placeholder', '');
2063
+
2064
+ decorated.call(this, data);
2065
+
2066
+ this.$selection.find('.select2-selection__rendered')
2067
+ .append(this.$searchContainer);
2068
+
2069
+ this.resizeSearch();
2070
+ if (searchHadFocus) {
2071
+ this.$search.focus();
2072
+ }
2073
+ };
2074
+
2075
+ Search.prototype.handleSearch = function () {
2076
+ this.resizeSearch();
2077
+
2078
+ if (!this._keyUpPrevented) {
2079
+ var input = this.$search.val();
2080
+
2081
+ this.trigger('query', {
2082
+ term: input
2083
+ });
2084
+ }
2085
+
2086
+ this._keyUpPrevented = false;
2087
+ };
2088
+
2089
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2090
+ this.trigger('unselect', {
2091
+ data: item
2092
+ });
2093
+
2094
+ this.$search.val(item.text);
2095
+ this.handleSearch();
2096
+ };
2097
+
2098
+ Search.prototype.resizeSearch = function () {
2099
+ this.$search.css('width', '25px');
2100
+
2101
+ var width = '';
2102
+
2103
+ if (this.$search.attr('placeholder') !== '') {
2104
+ width = this.$selection.find('.select2-selection__rendered').innerWidth();
2105
+ } else {
2106
+ var minimumWidth = this.$search.val().length + 1;
2107
+
2108
+ width = (minimumWidth * 0.75) + 'em';
2109
+ }
2110
+
2111
+ this.$search.css('width', width);
2112
+ };
2113
+
2114
+ return Search;
2115
+ });
2116
+
2117
+ S2.define('select2/selection/eventRelay',[
2118
+ 'jquery'
2119
+ ], function ($) {
2120
+ function EventRelay () { }
2121
+
2122
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2123
+ var self = this;
2124
+ var relayEvents = [
2125
+ 'open', 'opening',
2126
+ 'close', 'closing',
2127
+ 'select', 'selecting',
2128
+ 'unselect', 'unselecting'
2129
+ ];
2130
+
2131
+ var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2132
+
2133
+ decorated.call(this, container, $container);
2134
+
2135
+ container.on('*', function (name, params) {
2136
+ // Ignore events that should not be relayed
2137
+ if ($.inArray(name, relayEvents) === -1) {
2138
+ return;
2139
+ }
2140
+
2141
+ // The parameters should always be an object
2142
+ params = params || {};
2143
+
2144
+ // Generate the jQuery event for the Select2 event
2145
+ var evt = $.Event('select2:' + name, {
2146
+ params: params
2147
+ });
2148
+
2149
+ self.$element.trigger(evt);
2150
+
2151
+ // Only handle preventable events if it was one
2152
+ if ($.inArray(name, preventableEvents) === -1) {
2153
+ return;
2154
+ }
2155
+
2156
+ params.prevented = evt.isDefaultPrevented();
2157
+ });
2158
+ };
2159
+
2160
+ return EventRelay;
2161
+ });
2162
+
2163
+ S2.define('select2/translation',[
2164
+ 'jquery',
2165
+ 'require'
2166
+ ], function ($, require) {
2167
+ function Translation (dict) {
2168
+ this.dict = dict || {};
2169
+ }
2170
+
2171
+ Translation.prototype.all = function () {
2172
+ return this.dict;
2173
+ };
2174
+
2175
+ Translation.prototype.get = function (key) {
2176
+ return this.dict[key];
2177
+ };
2178
+
2179
+ Translation.prototype.extend = function (translation) {
2180
+ this.dict = $.extend({}, translation.all(), this.dict);
2181
+ };
2182
+
2183
+ // Static functions
2184
+
2185
+ Translation._cache = {};
2186
+
2187
+ Translation.loadPath = function (path) {
2188
+ if (!(path in Translation._cache)) {
2189
+ var translations = require(path);
2190
+
2191
+ Translation._cache[path] = translations;
2192
+ }
2193
+
2194
+ return new Translation(Translation._cache[path]);
2195
+ };
2196
+
2197
+ return Translation;
2198
+ });
2199
+
2200
+ S2.define('select2/diacritics',[
2201
+
2202
+ ], function () {
2203
+ var diacritics = {
2204
+ '\u24B6': 'A',
2205
+ '\uFF21': 'A',
2206
+ '\u00C0': 'A',
2207
+ '\u00C1': 'A',
2208
+ '\u00C2': 'A',
2209
+ '\u1EA6': 'A',
2210
+ '\u1EA4': 'A',
2211
+ '\u1EAA': 'A',
2212
+ '\u1EA8': 'A',
2213
+ '\u00C3': 'A',
2214
+ '\u0100': 'A',
2215
+ '\u0102': 'A',
2216
+ '\u1EB0': 'A',
2217
+ '\u1EAE': 'A',
2218
+ '\u1EB4': 'A',
2219
+ '\u1EB2': 'A',
2220
+ '\u0226': 'A',
2221
+ '\u01E0': 'A',
2222
+ '\u00C4': 'A',
2223
+ '\u01DE': 'A',
2224
+ '\u1EA2': 'A',
2225
+ '\u00C5': 'A',
2226
+ '\u01FA': 'A',
2227
+ '\u01CD': 'A',
2228
+ '\u0200': 'A',
2229
+ '\u0202': 'A',
2230
+ '\u1EA0': 'A',
2231
+ '\u1EAC': 'A',
2232
+ '\u1EB6': 'A',
2233
+ '\u1E00': 'A',
2234
+ '\u0104': 'A',
2235
+ '\u023A': 'A',
2236
+ '\u2C6F': 'A',
2237
+ '\uA732': 'AA',
2238
+ '\u00C6': 'AE',
2239
+ '\u01FC': 'AE',
2240
+ '\u01E2': 'AE',
2241
+ '\uA734': 'AO',
2242
+ '\uA736': 'AU',
2243
+ '\uA738': 'AV',
2244
+ '\uA73A': 'AV',
2245
+ '\uA73C': 'AY',
2246
+ '\u24B7': 'B',
2247
+ '\uFF22': 'B',
2248
+ '\u1E02': 'B',
2249
+ '\u1E04': 'B',
2250
+ '\u1E06': 'B',
2251
+ '\u0243': 'B',
2252
+ '\u0182': 'B',
2253
+ '\u0181': 'B',
2254
+ '\u24B8': 'C',
2255
+ '\uFF23': 'C',
2256
+ '\u0106': 'C',
2257
+ '\u0108': 'C',
2258
+ '\u010A': 'C',
2259
+ '\u010C': 'C',
2260
+ '\u00C7': 'C',
2261
+ '\u1E08': 'C',
2262
+ '\u0187': 'C',
2263
+ '\u023B': 'C',
2264
+ '\uA73E': 'C',
2265
+ '\u24B9': 'D',
2266
+ '\uFF24': 'D',
2267
+ '\u1E0A': 'D',
2268
+ '\u010E': 'D',
2269
+ '\u1E0C': 'D',
2270
+ '\u1E10': 'D',
2271
+ '\u1E12': 'D',
2272
+ '\u1E0E': 'D',
2273
+ '\u0110': 'D',
2274
+ '\u018B': 'D',
2275
+ '\u018A': 'D',
2276
+ '\u0189': 'D',
2277
+ '\uA779': 'D',
2278
+ '\u01F1': 'DZ',
2279
+ '\u01C4': 'DZ',
2280
+ '\u01F2': 'Dz',
2281
+ '\u01C5': 'Dz',
2282
+ '\u24BA': 'E',
2283
+ '\uFF25': 'E',
2284
+ '\u00C8': 'E',
2285
+ '\u00C9': 'E',
2286
+ '\u00CA': 'E',
2287
+ '\u1EC0': 'E',
2288
+ '\u1EBE': 'E',
2289
+ '\u1EC4': 'E',
2290
+ '\u1EC2': 'E',
2291
+ '\u1EBC': 'E',
2292
+ '\u0112': 'E',
2293
+ '\u1E14': 'E',
2294
+ '\u1E16': 'E',
2295
+ '\u0114': 'E',
2296
+ '\u0116': 'E',
2297
+ '\u00CB': 'E',
2298
+ '\u1EBA': 'E',
2299
+ '\u011A': 'E',
2300
+ '\u0204': 'E',
2301
+ '\u0206': 'E',
2302
+ '\u1EB8': 'E',
2303
+ '\u1EC6': 'E',
2304
+ '\u0228': 'E',
2305
+ '\u1E1C': 'E',
2306
+ '\u0118': 'E',
2307
+ '\u1E18': 'E',
2308
+ '\u1E1A': 'E',
2309
+ '\u0190': 'E',
2310
+ '\u018E': 'E',
2311
+ '\u24BB': 'F',
2312
+ '\uFF26': 'F',
2313
+ '\u1E1E': 'F',
2314
+ '\u0191': 'F',
2315
+ '\uA77B': 'F',
2316
+ '\u24BC': 'G',
2317
+ '\uFF27': 'G',
2318
+ '\u01F4': 'G',
2319
+ '\u011C': 'G',
2320
+ '\u1E20': 'G',
2321
+ '\u011E': 'G',
2322
+ '\u0120': 'G',
2323
+ '\u01E6': 'G',
2324
+ '\u0122': 'G',
2325
+ '\u01E4': 'G',
2326
+ '\u0193': 'G',
2327
+ '\uA7A0': 'G',
2328
+ '\uA77D': 'G',
2329
+ '\uA77E': 'G',
2330
+ '\u24BD': 'H',
2331
+ '\uFF28': 'H',
2332
+ '\u0124': 'H',
2333
+ '\u1E22': 'H',
2334
+ '\u1E26': 'H',
2335
+ '\u021E': 'H',
2336
+ '\u1E24': 'H',
2337
+ '\u1E28': 'H',
2338
+ '\u1E2A': 'H',
2339
+ '\u0126': 'H',
2340
+ '\u2C67': 'H',
2341
+ '\u2C75': 'H',
2342
+ '\uA78D': 'H',
2343
+ '\u24BE': 'I',
2344
+ '\uFF29': 'I',
2345
+ '\u00CC': 'I',
2346
+ '\u00CD': 'I',
2347
+ '\u00CE': 'I',
2348
+ '\u0128': 'I',
2349
+ '\u012A': 'I',
2350
+ '\u012C': 'I',
2351
+ '\u0130': 'I',
2352
+ '\u00CF': 'I',
2353
+ '\u1E2E': 'I',
2354
+ '\u1EC8': 'I',
2355
+ '\u01CF': 'I',
2356
+ '\u0208': 'I',
2357
+ '\u020A': 'I',
2358
+ '\u1ECA': 'I',
2359
+ '\u012E': 'I',
2360
+ '\u1E2C': 'I',
2361
+ '\u0197': 'I',
2362
+ '\u24BF': 'J',
2363
+ '\uFF2A': 'J',
2364
+ '\u0134': 'J',
2365
+ '\u0248': 'J',
2366
+ '\u24C0': 'K',
2367
+ '\uFF2B': 'K',
2368
+ '\u1E30': 'K',
2369
+ '\u01E8': 'K',
2370
+ '\u1E32': 'K',
2371
+ '\u0136': 'K',
2372
+ '\u1E34': 'K',
2373
+ '\u0198': 'K',
2374
+ '\u2C69': 'K',
2375
+ '\uA740': 'K',
2376
+ '\uA742': 'K',
2377
+ '\uA744': 'K',
2378
+ '\uA7A2': 'K',
2379
+ '\u24C1': 'L',
2380
+ '\uFF2C': 'L',
2381
+ '\u013F': 'L',
2382
+ '\u0139': 'L',
2383
+ '\u013D': 'L',
2384
+ '\u1E36': 'L',
2385
+ '\u1E38': 'L',
2386
+ '\u013B': 'L',
2387
+ '\u1E3C': 'L',
2388
+ '\u1E3A': 'L',
2389
+ '\u0141': 'L',
2390
+ '\u023D': 'L',
2391
+ '\u2C62': 'L',
2392
+ '\u2C60': 'L',
2393
+ '\uA748': 'L',
2394
+ '\uA746': 'L',
2395
+ '\uA780': 'L',
2396
+ '\u01C7': 'LJ',
2397
+ '\u01C8': 'Lj',
2398
+ '\u24C2': 'M',
2399
+ '\uFF2D': 'M',
2400
+ '\u1E3E': 'M',
2401
+ '\u1E40': 'M',
2402
+ '\u1E42': 'M',
2403
+ '\u2C6E': 'M',
2404
+ '\u019C': 'M',
2405
+ '\u24C3': 'N',
2406
+ '\uFF2E': 'N',
2407
+ '\u01F8': 'N',
2408
+ '\u0143': 'N',
2409
+ '\u00D1': 'N',
2410
+ '\u1E44': 'N',
2411
+ '\u0147': 'N',
2412
+ '\u1E46': 'N',
2413
+ '\u0145': 'N',
2414
+ '\u1E4A': 'N',
2415
+ '\u1E48': 'N',
2416
+ '\u0220': 'N',
2417
+ '\u019D': 'N',
2418
+ '\uA790': 'N',
2419
+ '\uA7A4': 'N',
2420
+ '\u01CA': 'NJ',
2421
+ '\u01CB': 'Nj',
2422
+ '\u24C4': 'O',
2423
+ '\uFF2F': 'O',
2424
+ '\u00D2': 'O',
2425
+ '\u00D3': 'O',
2426
+ '\u00D4': 'O',
2427
+ '\u1ED2': 'O',
2428
+ '\u1ED0': 'O',
2429
+ '\u1ED6': 'O',
2430
+ '\u1ED4': 'O',
2431
+ '\u00D5': 'O',
2432
+ '\u1E4C': 'O',
2433
+ '\u022C': 'O',
2434
+ '\u1E4E': 'O',
2435
+ '\u014C': 'O',
2436
+ '\u1E50': 'O',
2437
+ '\u1E52': 'O',
2438
+ '\u014E': 'O',
2439
+ '\u022E': 'O',
2440
+ '\u0230': 'O',
2441
+ '\u00D6': 'O',
2442
+ '\u022A': 'O',
2443
+ '\u1ECE': 'O',
2444
+ '\u0150': 'O',
2445
+ '\u01D1': 'O',
2446
+ '\u020C': 'O',
2447
+ '\u020E': 'O',
2448
+ '\u01A0': 'O',
2449
+ '\u1EDC': 'O',
2450
+ '\u1EDA': 'O',
2451
+ '\u1EE0': 'O',
2452
+ '\u1EDE': 'O',
2453
+ '\u1EE2': 'O',
2454
+ '\u1ECC': 'O',
2455
+ '\u1ED8': 'O',
2456
+ '\u01EA': 'O',
2457
+ '\u01EC': 'O',
2458
+ '\u00D8': 'O',
2459
+ '\u01FE': 'O',
2460
+ '\u0186': 'O',
2461
+ '\u019F': 'O',
2462
+ '\uA74A': 'O',
2463
+ '\uA74C': 'O',
2464
+ '\u01A2': 'OI',
2465
+ '\uA74E': 'OO',
2466
+ '\u0222': 'OU',
2467
+ '\u24C5': 'P',
2468
+ '\uFF30': 'P',
2469
+ '\u1E54': 'P',
2470
+ '\u1E56': 'P',
2471
+ '\u01A4': 'P',
2472
+ '\u2C63': 'P',
2473
+ '\uA750': 'P',
2474
+ '\uA752': 'P',
2475
+ '\uA754': 'P',
2476
+ '\u24C6': 'Q',
2477
+ '\uFF31': 'Q',
2478
+ '\uA756': 'Q',
2479
+ '\uA758': 'Q',
2480
+ '\u024A': 'Q',
2481
+ '\u24C7': 'R',
2482
+ '\uFF32': 'R',
2483
+ '\u0154': 'R',
2484
+ '\u1E58': 'R',
2485
+ '\u0158': 'R',
2486
+ '\u0210': 'R',
2487
+ '\u0212': 'R',
2488
+ '\u1E5A': 'R',
2489
+ '\u1E5C': 'R',
2490
+ '\u0156': 'R',
2491
+ '\u1E5E': 'R',
2492
+ '\u024C': 'R',
2493
+ '\u2C64': 'R',
2494
+ '\uA75A': 'R',
2495
+ '\uA7A6': 'R',
2496
+ '\uA782': 'R',
2497
+ '\u24C8': 'S',
2498
+ '\uFF33': 'S',
2499
+ '\u1E9E': 'S',
2500
+ '\u015A': 'S',
2501
+ '\u1E64': 'S',
2502
+ '\u015C': 'S',
2503
+ '\u1E60': 'S',
2504
+ '\u0160': 'S',
2505
+ '\u1E66': 'S',
2506
+ '\u1E62': 'S',
2507
+ '\u1E68': 'S',
2508
+ '\u0218': 'S',
2509
+ '\u015E': 'S',
2510
+ '\u2C7E': 'S',
2511
+ '\uA7A8': 'S',
2512
+ '\uA784': 'S',
2513
+ '\u24C9': 'T',
2514
+ '\uFF34': 'T',
2515
+ '\u1E6A': 'T',
2516
+ '\u0164': 'T',
2517
+ '\u1E6C': 'T',
2518
+ '\u021A': 'T',
2519
+ '\u0162': 'T',
2520
+ '\u1E70': 'T',
2521
+ '\u1E6E': 'T',
2522
+ '\u0166': 'T',
2523
+ '\u01AC': 'T',
2524
+ '\u01AE': 'T',
2525
+ '\u023E': 'T',
2526
+ '\uA786': 'T',
2527
+ '\uA728': 'TZ',
2528
+ '\u24CA': 'U',
2529
+ '\uFF35': 'U',
2530
+ '\u00D9': 'U',
2531
+ '\u00DA': 'U',
2532
+ '\u00DB': 'U',
2533
+ '\u0168': 'U',
2534
+ '\u1E78': 'U',
2535
+ '\u016A': 'U',
2536
+ '\u1E7A': 'U',
2537
+ '\u016C': 'U',
2538
+ '\u00DC': 'U',
2539
+ '\u01DB': 'U',
2540
+ '\u01D7': 'U',
2541
+ '\u01D5': 'U',
2542
+ '\u01D9': 'U',
2543
+ '\u1EE6': 'U',
2544
+ '\u016E': 'U',
2545
+ '\u0170': 'U',
2546
+ '\u01D3': 'U',
2547
+ '\u0214': 'U',
2548
+ '\u0216': 'U',
2549
+ '\u01AF': 'U',
2550
+ '\u1EEA': 'U',
2551
+ '\u1EE8': 'U',
2552
+ '\u1EEE': 'U',
2553
+ '\u1EEC': 'U',
2554
+ '\u1EF0': 'U',
2555
+ '\u1EE4': 'U',
2556
+ '\u1E72': 'U',
2557
+ '\u0172': 'U',
2558
+ '\u1E76': 'U',
2559
+ '\u1E74': 'U',
2560
+ '\u0244': 'U',
2561
+ '\u24CB': 'V',
2562
+ '\uFF36': 'V',
2563
+ '\u1E7C': 'V',
2564
+ '\u1E7E': 'V',
2565
+ '\u01B2': 'V',
2566
+ '\uA75E': 'V',
2567
+ '\u0245': 'V',
2568
+ '\uA760': 'VY',
2569
+ '\u24CC': 'W',
2570
+ '\uFF37': 'W',
2571
+ '\u1E80': 'W',
2572
+ '\u1E82': 'W',
2573
+ '\u0174': 'W',
2574
+ '\u1E86': 'W',
2575
+ '\u1E84': 'W',
2576
+ '\u1E88': 'W',
2577
+ '\u2C72': 'W',
2578
+ '\u24CD': 'X',
2579
+ '\uFF38': 'X',
2580
+ '\u1E8A': 'X',
2581
+ '\u1E8C': 'X',
2582
+ '\u24CE': 'Y',
2583
+ '\uFF39': 'Y',
2584
+ '\u1EF2': 'Y',
2585
+ '\u00DD': 'Y',
2586
+ '\u0176': 'Y',
2587
+ '\u1EF8': 'Y',
2588
+ '\u0232': 'Y',
2589
+ '\u1E8E': 'Y',
2590
+ '\u0178': 'Y',
2591
+ '\u1EF6': 'Y',
2592
+ '\u1EF4': 'Y',
2593
+ '\u01B3': 'Y',
2594
+ '\u024E': 'Y',
2595
+ '\u1EFE': 'Y',
2596
+ '\u24CF': 'Z',
2597
+ '\uFF3A': 'Z',
2598
+ '\u0179': 'Z',
2599
+ '\u1E90': 'Z',
2600
+ '\u017B': 'Z',
2601
+ '\u017D': 'Z',
2602
+ '\u1E92': 'Z',
2603
+ '\u1E94': 'Z',
2604
+ '\u01B5': 'Z',
2605
+ '\u0224': 'Z',
2606
+ '\u2C7F': 'Z',
2607
+ '\u2C6B': 'Z',
2608
+ '\uA762': 'Z',
2609
+ '\u24D0': 'a',
2610
+ '\uFF41': 'a',
2611
+ '\u1E9A': 'a',
2612
+ '\u00E0': 'a',
2613
+ '\u00E1': 'a',
2614
+ '\u00E2': 'a',
2615
+ '\u1EA7': 'a',
2616
+ '\u1EA5': 'a',
2617
+ '\u1EAB': 'a',
2618
+ '\u1EA9': 'a',
2619
+ '\u00E3': 'a',
2620
+ '\u0101': 'a',
2621
+ '\u0103': 'a',
2622
+ '\u1EB1': 'a',
2623
+ '\u1EAF': 'a',
2624
+ '\u1EB5': 'a',
2625
+ '\u1EB3': 'a',
2626
+ '\u0227': 'a',
2627
+ '\u01E1': 'a',
2628
+ '\u00E4': 'a',
2629
+ '\u01DF': 'a',
2630
+ '\u1EA3': 'a',
2631
+ '\u00E5': 'a',
2632
+ '\u01FB': 'a',
2633
+ '\u01CE': 'a',
2634
+ '\u0201': 'a',
2635
+ '\u0203': 'a',
2636
+ '\u1EA1': 'a',
2637
+ '\u1EAD': 'a',
2638
+ '\u1EB7': 'a',
2639
+ '\u1E01': 'a',
2640
+ '\u0105': 'a',
2641
+ '\u2C65': 'a',
2642
+ '\u0250': 'a',
2643
+ '\uA733': 'aa',
2644
+ '\u00E6': 'ae',
2645
+ '\u01FD': 'ae',
2646
+ '\u01E3': 'ae',
2647
+ '\uA735': 'ao',
2648
+ '\uA737': 'au',
2649
+ '\uA739': 'av',
2650
+ '\uA73B': 'av',
2651
+ '\uA73D': 'ay',
2652
+ '\u24D1': 'b',
2653
+ '\uFF42': 'b',
2654
+ '\u1E03': 'b',
2655
+ '\u1E05': 'b',
2656
+ '\u1E07': 'b',
2657
+ '\u0180': 'b',
2658
+ '\u0183': 'b',
2659
+ '\u0253': 'b',
2660
+ '\u24D2': 'c',
2661
+ '\uFF43': 'c',
2662
+ '\u0107': 'c',
2663
+ '\u0109': 'c',
2664
+ '\u010B': 'c',
2665
+ '\u010D': 'c',
2666
+ '\u00E7': 'c',
2667
+ '\u1E09': 'c',
2668
+ '\u0188': 'c',
2669
+ '\u023C': 'c',
2670
+ '\uA73F': 'c',
2671
+ '\u2184': 'c',
2672
+ '\u24D3': 'd',
2673
+ '\uFF44': 'd',
2674
+ '\u1E0B': 'd',
2675
+ '\u010F': 'd',
2676
+ '\u1E0D': 'd',
2677
+ '\u1E11': 'd',
2678
+ '\u1E13': 'd',
2679
+ '\u1E0F': 'd',
2680
+ '\u0111': 'd',
2681
+ '\u018C': 'd',
2682
+ '\u0256': 'd',
2683
+ '\u0257': 'd',
2684
+ '\uA77A': 'd',
2685
+ '\u01F3': 'dz',
2686
+ '\u01C6': 'dz',
2687
+ '\u24D4': 'e',
2688
+ '\uFF45': 'e',
2689
+ '\u00E8': 'e',
2690
+ '\u00E9': 'e',
2691
+ '\u00EA': 'e',
2692
+ '\u1EC1': 'e',
2693
+ '\u1EBF': 'e',
2694
+ '\u1EC5': 'e',
2695
+ '\u1EC3': 'e',
2696
+ '\u1EBD': 'e',
2697
+ '\u0113': 'e',
2698
+ '\u1E15': 'e',
2699
+ '\u1E17': 'e',
2700
+ '\u0115': 'e',
2701
+ '\u0117': 'e',
2702
+ '\u00EB': 'e',
2703
+ '\u1EBB': 'e',
2704
+ '\u011B': 'e',
2705
+ '\u0205': 'e',
2706
+ '\u0207': 'e',
2707
+ '\u1EB9': 'e',
2708
+ '\u1EC7': 'e',
2709
+ '\u0229': 'e',
2710
+ '\u1E1D': 'e',
2711
+ '\u0119': 'e',
2712
+ '\u1E19': 'e',
2713
+ '\u1E1B': 'e',
2714
+ '\u0247': 'e',
2715
+ '\u025B': 'e',
2716
+ '\u01DD': 'e',
2717
+ '\u24D5': 'f',
2718
+ '\uFF46': 'f',
2719
+ '\u1E1F': 'f',
2720
+ '\u0192': 'f',
2721
+ '\uA77C': 'f',
2722
+ '\u24D6': 'g',
2723
+ '\uFF47': 'g',
2724
+ '\u01F5': 'g',
2725
+ '\u011D': 'g',
2726
+ '\u1E21': 'g',
2727
+ '\u011F': 'g',
2728
+ '\u0121': 'g',
2729
+ '\u01E7': 'g',
2730
+ '\u0123': 'g',
2731
+ '\u01E5': 'g',
2732
+ '\u0260': 'g',
2733
+ '\uA7A1': 'g',
2734
+ '\u1D79': 'g',
2735
+ '\uA77F': 'g',
2736
+ '\u24D7': 'h',
2737
+ '\uFF48': 'h',
2738
+ '\u0125': 'h',
2739
+ '\u1E23': 'h',
2740
+ '\u1E27': 'h',
2741
+ '\u021F': 'h',
2742
+ '\u1E25': 'h',
2743
+ '\u1E29': 'h',
2744
+ '\u1E2B': 'h',
2745
+ '\u1E96': 'h',
2746
+ '\u0127': 'h',
2747
+ '\u2C68': 'h',
2748
+ '\u2C76': 'h',
2749
+ '\u0265': 'h',
2750
+ '\u0195': 'hv',
2751
+ '\u24D8': 'i',
2752
+ '\uFF49': 'i',
2753
+ '\u00EC': 'i',
2754
+ '\u00ED': 'i',
2755
+ '\u00EE': 'i',
2756
+ '\u0129': 'i',
2757
+ '\u012B': 'i',
2758
+ '\u012D': 'i',
2759
+ '\u00EF': 'i',
2760
+ '\u1E2F': 'i',
2761
+ '\u1EC9': 'i',
2762
+ '\u01D0': 'i',
2763
+ '\u0209': 'i',
2764
+ '\u020B': 'i',
2765
+ '\u1ECB': 'i',
2766
+ '\u012F': 'i',
2767
+ '\u1E2D': 'i',
2768
+ '\u0268': 'i',
2769
+ '\u0131': 'i',
2770
+ '\u24D9': 'j',
2771
+ '\uFF4A': 'j',
2772
+ '\u0135': 'j',
2773
+ '\u01F0': 'j',
2774
+ '\u0249': 'j',
2775
+ '\u24DA': 'k',
2776
+ '\uFF4B': 'k',
2777
+ '\u1E31': 'k',
2778
+ '\u01E9': 'k',
2779
+ '\u1E33': 'k',
2780
+ '\u0137': 'k',
2781
+ '\u1E35': 'k',
2782
+ '\u0199': 'k',
2783
+ '\u2C6A': 'k',
2784
+ '\uA741': 'k',
2785
+ '\uA743': 'k',
2786
+ '\uA745': 'k',
2787
+ '\uA7A3': 'k',
2788
+ '\u24DB': 'l',
2789
+ '\uFF4C': 'l',
2790
+ '\u0140': 'l',
2791
+ '\u013A': 'l',
2792
+ '\u013E': 'l',
2793
+ '\u1E37': 'l',
2794
+ '\u1E39': 'l',
2795
+ '\u013C': 'l',
2796
+ '\u1E3D': 'l',
2797
+ '\u1E3B': 'l',
2798
+ '\u017F': 'l',
2799
+ '\u0142': 'l',
2800
+ '\u019A': 'l',
2801
+ '\u026B': 'l',
2802
+ '\u2C61': 'l',
2803
+ '\uA749': 'l',
2804
+ '\uA781': 'l',
2805
+ '\uA747': 'l',
2806
+ '\u01C9': 'lj',
2807
+ '\u24DC': 'm',
2808
+ '\uFF4D': 'm',
2809
+ '\u1E3F': 'm',
2810
+ '\u1E41': 'm',
2811
+ '\u1E43': 'm',
2812
+ '\u0271': 'm',
2813
+ '\u026F': 'm',
2814
+ '\u24DD': 'n',
2815
+ '\uFF4E': 'n',
2816
+ '\u01F9': 'n',
2817
+ '\u0144': 'n',
2818
+ '\u00F1': 'n',
2819
+ '\u1E45': 'n',
2820
+ '\u0148': 'n',
2821
+ '\u1E47': 'n',
2822
+ '\u0146': 'n',
2823
+ '\u1E4B': 'n',
2824
+ '\u1E49': 'n',
2825
+ '\u019E': 'n',
2826
+ '\u0272': 'n',
2827
+ '\u0149': 'n',
2828
+ '\uA791': 'n',
2829
+ '\uA7A5': 'n',
2830
+ '\u01CC': 'nj',
2831
+ '\u24DE': 'o',
2832
+ '\uFF4F': 'o',
2833
+ '\u00F2': 'o',
2834
+ '\u00F3': 'o',
2835
+ '\u00F4': 'o',
2836
+ '\u1ED3': 'o',
2837
+ '\u1ED1': 'o',
2838
+ '\u1ED7': 'o',
2839
+ '\u1ED5': 'o',
2840
+ '\u00F5': 'o',
2841
+ '\u1E4D': 'o',
2842
+ '\u022D': 'o',
2843
+ '\u1E4F': 'o',
2844
+ '\u014D': 'o',
2845
+ '\u1E51': 'o',
2846
+ '\u1E53': 'o',
2847
+ '\u014F': 'o',
2848
+ '\u022F': 'o',
2849
+ '\u0231': 'o',
2850
+ '\u00F6': 'o',
2851
+ '\u022B': 'o',
2852
+ '\u1ECF': 'o',
2853
+ '\u0151': 'o',
2854
+ '\u01D2': 'o',
2855
+ '\u020D': 'o',
2856
+ '\u020F': 'o',
2857
+ '\u01A1': 'o',
2858
+ '\u1EDD': 'o',
2859
+ '\u1EDB': 'o',
2860
+ '\u1EE1': 'o',
2861
+ '\u1EDF': 'o',
2862
+ '\u1EE3': 'o',
2863
+ '\u1ECD': 'o',
2864
+ '\u1ED9': 'o',
2865
+ '\u01EB': 'o',
2866
+ '\u01ED': 'o',
2867
+ '\u00F8': 'o',
2868
+ '\u01FF': 'o',
2869
+ '\u0254': 'o',
2870
+ '\uA74B': 'o',
2871
+ '\uA74D': 'o',
2872
+ '\u0275': 'o',
2873
+ '\u01A3': 'oi',
2874
+ '\u0223': 'ou',
2875
+ '\uA74F': 'oo',
2876
+ '\u24DF': 'p',
2877
+ '\uFF50': 'p',
2878
+ '\u1E55': 'p',
2879
+ '\u1E57': 'p',
2880
+ '\u01A5': 'p',
2881
+ '\u1D7D': 'p',
2882
+ '\uA751': 'p',
2883
+ '\uA753': 'p',
2884
+ '\uA755': 'p',
2885
+ '\u24E0': 'q',
2886
+ '\uFF51': 'q',
2887
+ '\u024B': 'q',
2888
+ '\uA757': 'q',
2889
+ '\uA759': 'q',
2890
+ '\u24E1': 'r',
2891
+ '\uFF52': 'r',
2892
+ '\u0155': 'r',
2893
+ '\u1E59': 'r',
2894
+ '\u0159': 'r',
2895
+ '\u0211': 'r',
2896
+ '\u0213': 'r',
2897
+ '\u1E5B': 'r',
2898
+ '\u1E5D': 'r',
2899
+ '\u0157': 'r',
2900
+ '\u1E5F': 'r',
2901
+ '\u024D': 'r',
2902
+ '\u027D': 'r',
2903
+ '\uA75B': 'r',
2904
+ '\uA7A7': 'r',
2905
+ '\uA783': 'r',
2906
+ '\u24E2': 's',
2907
+ '\uFF53': 's',
2908
+ '\u00DF': 's',
2909
+ '\u015B': 's',
2910
+ '\u1E65': 's',
2911
+ '\u015D': 's',
2912
+ '\u1E61': 's',
2913
+ '\u0161': 's',
2914
+ '\u1E67': 's',
2915
+ '\u1E63': 's',
2916
+ '\u1E69': 's',
2917
+ '\u0219': 's',
2918
+ '\u015F': 's',
2919
+ '\u023F': 's',
2920
+ '\uA7A9': 's',
2921
+ '\uA785': 's',
2922
+ '\u1E9B': 's',
2923
+ '\u24E3': 't',
2924
+ '\uFF54': 't',
2925
+ '\u1E6B': 't',
2926
+ '\u1E97': 't',
2927
+ '\u0165': 't',
2928
+ '\u1E6D': 't',
2929
+ '\u021B': 't',
2930
+ '\u0163': 't',
2931
+ '\u1E71': 't',
2932
+ '\u1E6F': 't',
2933
+ '\u0167': 't',
2934
+ '\u01AD': 't',
2935
+ '\u0288': 't',
2936
+ '\u2C66': 't',
2937
+ '\uA787': 't',
2938
+ '\uA729': 'tz',
2939
+ '\u24E4': 'u',
2940
+ '\uFF55': 'u',
2941
+ '\u00F9': 'u',
2942
+ '\u00FA': 'u',
2943
+ '\u00FB': 'u',
2944
+ '\u0169': 'u',
2945
+ '\u1E79': 'u',
2946
+ '\u016B': 'u',
2947
+ '\u1E7B': 'u',
2948
+ '\u016D': 'u',
2949
+ '\u00FC': 'u',
2950
+ '\u01DC': 'u',
2951
+ '\u01D8': 'u',
2952
+ '\u01D6': 'u',
2953
+ '\u01DA': 'u',
2954
+ '\u1EE7': 'u',
2955
+ '\u016F': 'u',
2956
+ '\u0171': 'u',
2957
+ '\u01D4': 'u',
2958
+ '\u0215': 'u',
2959
+ '\u0217': 'u',
2960
+ '\u01B0': 'u',
2961
+ '\u1EEB': 'u',
2962
+ '\u1EE9': 'u',
2963
+ '\u1EEF': 'u',
2964
+ '\u1EED': 'u',
2965
+ '\u1EF1': 'u',
2966
+ '\u1EE5': 'u',
2967
+ '\u1E73': 'u',
2968
+ '\u0173': 'u',
2969
+ '\u1E77': 'u',
2970
+ '\u1E75': 'u',
2971
+ '\u0289': 'u',
2972
+ '\u24E5': 'v',
2973
+ '\uFF56': 'v',
2974
+ '\u1E7D': 'v',
2975
+ '\u1E7F': 'v',
2976
+ '\u028B': 'v',
2977
+ '\uA75F': 'v',
2978
+ '\u028C': 'v',
2979
+ '\uA761': 'vy',
2980
+ '\u24E6': 'w',
2981
+ '\uFF57': 'w',
2982
+ '\u1E81': 'w',
2983
+ '\u1E83': 'w',
2984
+ '\u0175': 'w',
2985
+ '\u1E87': 'w',
2986
+ '\u1E85': 'w',
2987
+ '\u1E98': 'w',
2988
+ '\u1E89': 'w',
2989
+ '\u2C73': 'w',
2990
+ '\u24E7': 'x',
2991
+ '\uFF58': 'x',
2992
+ '\u1E8B': 'x',
2993
+ '\u1E8D': 'x',
2994
+ '\u24E8': 'y',
2995
+ '\uFF59': 'y',
2996
+ '\u1EF3': 'y',
2997
+ '\u00FD': 'y',
2998
+ '\u0177': 'y',
2999
+ '\u1EF9': 'y',
3000
+ '\u0233': 'y',
3001
+ '\u1E8F': 'y',
3002
+ '\u00FF': 'y',
3003
+ '\u1EF7': 'y',
3004
+ '\u1E99': 'y',
3005
+ '\u1EF5': 'y',
3006
+ '\u01B4': 'y',
3007
+ '\u024F': 'y',
3008
+ '\u1EFF': 'y',
3009
+ '\u24E9': 'z',
3010
+ '\uFF5A': 'z',
3011
+ '\u017A': 'z',
3012
+ '\u1E91': 'z',
3013
+ '\u017C': 'z',
3014
+ '\u017E': 'z',
3015
+ '\u1E93': 'z',
3016
+ '\u1E95': 'z',
3017
+ '\u01B6': 'z',
3018
+ '\u0225': 'z',
3019
+ '\u0240': 'z',
3020
+ '\u2C6C': 'z',
3021
+ '\uA763': 'z',
3022
+ '\u0386': '\u0391',
3023
+ '\u0388': '\u0395',
3024
+ '\u0389': '\u0397',
3025
+ '\u038A': '\u0399',
3026
+ '\u03AA': '\u0399',
3027
+ '\u038C': '\u039F',
3028
+ '\u038E': '\u03A5',
3029
+ '\u03AB': '\u03A5',
3030
+ '\u038F': '\u03A9',
3031
+ '\u03AC': '\u03B1',
3032
+ '\u03AD': '\u03B5',
3033
+ '\u03AE': '\u03B7',
3034
+ '\u03AF': '\u03B9',
3035
+ '\u03CA': '\u03B9',
3036
+ '\u0390': '\u03B9',
3037
+ '\u03CC': '\u03BF',
3038
+ '\u03CD': '\u03C5',
3039
+ '\u03CB': '\u03C5',
3040
+ '\u03B0': '\u03C5',
3041
+ '\u03C9': '\u03C9',
3042
+ '\u03C2': '\u03C3'
3043
+ };
3044
+
3045
+ return diacritics;
3046
+ });
3047
+
3048
+ S2.define('select2/data/base',[
3049
+ '../utils'
3050
+ ], function (Utils) {
3051
+ function BaseAdapter ($element, options) {
3052
+ BaseAdapter.__super__.constructor.call(this);
3053
+ }
3054
+
3055
+ Utils.Extend(BaseAdapter, Utils.Observable);
3056
+
3057
+ BaseAdapter.prototype.current = function (callback) {
3058
+ throw new Error('The `current` method must be defined in child classes.');
3059
+ };
3060
+
3061
+ BaseAdapter.prototype.query = function (params, callback) {
3062
+ throw new Error('The `query` method must be defined in child classes.');
3063
+ };
3064
+
3065
+ BaseAdapter.prototype.bind = function (container, $container) {
3066
+ // Can be implemented in subclasses
3067
+ };
3068
+
3069
+ BaseAdapter.prototype.destroy = function () {
3070
+ // Can be implemented in subclasses
3071
+ };
3072
+
3073
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3074
+ var id = '';
3075
+
3076
+ if (container != null) {
3077
+ id += container.id
3078
+ } else {
3079
+ id += Utils.generateChars(4);
3080
+ }
3081
+
3082
+ id += '-result-';
3083
+ id += Utils.generateChars(4);
3084
+
3085
+ if (data.id != null) {
3086
+ id += '-' + data.id.toString();
3087
+ } else {
3088
+ id += '-' + Utils.generateChars(4);
3089
+ }
3090
+ return id;
3091
+ };
3092
+
3093
+ return BaseAdapter;
3094
+ });
3095
+
3096
+ S2.define('select2/data/select',[
3097
+ './base',
3098
+ '../utils',
3099
+ 'jquery'
3100
+ ], function (BaseAdapter, Utils, $) {
3101
+ function SelectAdapter ($element, options) {
3102
+ this.$element = $element;
3103
+ this.options = options;
3104
+
3105
+ SelectAdapter.__super__.constructor.call(this);
3106
+ }
3107
+
3108
+ Utils.Extend(SelectAdapter, BaseAdapter);
3109
+
3110
+ SelectAdapter.prototype.current = function (callback) {
3111
+ var data = [];
3112
+ var self = this;
3113
+
3114
+ this.$element.find(':selected').each(function () {
3115
+ var $option = $(this);
3116
+
3117
+ var option = self.item($option);
3118
+
3119
+ data.push(option);
3120
+ });
3121
+
3122
+ callback(data);
3123
+ };
3124
+
3125
+ SelectAdapter.prototype.select = function (data) {
3126
+ var self = this;
3127
+
3128
+ data.selected = true;
3129
+
3130
+ // If data.element is a DOM node, use it instead
3131
+ if ($(data.element).is('option')) {
3132
+ data.element.selected = true;
3133
+
3134
+ this.$element.trigger('change');
3135
+
3136
+ return;
3137
+ }
3138
+
3139
+ if (this.$element.prop('multiple')) {
3140
+ this.current(function (currentData) {
3141
+ var val = [];
3142
+
3143
+ data = [data];
3144
+ data.push.apply(data, currentData);
3145
+
3146
+ for (var d = 0; d < data.length; d++) {
3147
+ var id = data[d].id;
3148
+
3149
+ if ($.inArray(id, val) === -1) {
3150
+ val.push(id);
3151
+ }
3152
+ }
3153
+
3154
+ self.$element.val(val);
3155
+ self.$element.trigger('change');
3156
+ });
3157
+ } else {
3158
+ var val = data.id;
3159
+
3160
+ this.$element.val(val);
3161
+ this.$element.trigger('change');
3162
+ }
3163
+ };
3164
+
3165
+ SelectAdapter.prototype.unselect = function (data) {
3166
+ var self = this;
3167
+
3168
+ if (!this.$element.prop('multiple')) {
3169
+ return;
3170
+ }
3171
+
3172
+ data.selected = false;
3173
+
3174
+ if ($(data.element).is('option')) {
3175
+ data.element.selected = false;
3176
+
3177
+ this.$element.trigger('change');
3178
+
3179
+ return;
3180
+ }
3181
+
3182
+ this.current(function (currentData) {
3183
+ var val = [];
3184
+
3185
+ for (var d = 0; d < currentData.length; d++) {
3186
+ var id = currentData[d].id;
3187
+
3188
+ if (id !== data.id && $.inArray(id, val) === -1) {
3189
+ val.push(id);
3190
+ }
3191
+ }
3192
+
3193
+ self.$element.val(val);
3194
+
3195
+ self.$element.trigger('change');
3196
+ });
3197
+ };
3198
+
3199
+ SelectAdapter.prototype.bind = function (container, $container) {
3200
+ var self = this;
3201
+
3202
+ this.container = container;
3203
+
3204
+ container.on('select', function (params) {
3205
+ self.select(params.data);
3206
+ });
3207
+
3208
+ container.on('unselect', function (params) {
3209
+ self.unselect(params.data);
3210
+ });
3211
+ };
3212
+
3213
+ SelectAdapter.prototype.destroy = function () {
3214
+ // Remove anything added to child elements
3215
+ this.$element.find('*').each(function () {
3216
+ // Remove any custom data set by Select2
3217
+ $.removeData(this, 'data');
3218
+ });
3219
+ };
3220
+
3221
+ SelectAdapter.prototype.query = function (params, callback) {
3222
+ var data = [];
3223
+ var self = this;
3224
+
3225
+ var $options = this.$element.children();
3226
+
3227
+ $options.each(function () {
3228
+ var $option = $(this);
3229
+
3230
+ if (!$option.is('option') && !$option.is('optgroup')) {
3231
+ return;
3232
+ }
3233
+
3234
+ var option = self.item($option);
3235
+
3236
+ var matches = self.matches(params, option);
3237
+
3238
+ if (matches !== null) {
3239
+ data.push(matches);
3240
+ }
3241
+ });
3242
+
3243
+ callback({
3244
+ results: data
3245
+ });
3246
+ };
3247
+
3248
+ SelectAdapter.prototype.addOptions = function ($options) {
3249
+ Utils.appendMany(this.$element, $options);
3250
+ };
3251
+
3252
+ SelectAdapter.prototype.option = function (data) {
3253
+ var option;
3254
+
3255
+ if (data.children) {
3256
+ option = document.createElement('optgroup');
3257
+ option.label = data.text;
3258
+ } else {
3259
+ option = document.createElement('option');
3260
+
3261
+ if (option.textContent !== undefined) {
3262
+ option.textContent = data.text;
3263
+ } else {
3264
+ option.innerText = data.text;
3265
+ }
3266
+ }
3267
+
3268
+ if (data.id !== undefined) {
3269
+ option.value = data.id;
3270
+ }
3271
+
3272
+ if (data.disabled) {
3273
+ option.disabled = true;
3274
+ }
3275
+
3276
+ if (data.selected) {
3277
+ option.selected = true;
3278
+ }
3279
+
3280
+ if (data.title) {
3281
+ option.title = data.title;
3282
+ }
3283
+
3284
+ var $option = $(option);
3285
+
3286
+ var normalizedData = this._normalizeItem(data);
3287
+ normalizedData.element = option;
3288
+
3289
+ // Override the option's data with the combined data
3290
+ $.data(option, 'data', normalizedData);
3291
+
3292
+ return $option;
3293
+ };
3294
+
3295
+ SelectAdapter.prototype.item = function ($option) {
3296
+ var data = {};
3297
+
3298
+ data = $.data($option[0], 'data');
3299
+
3300
+ if (data != null) {
3301
+ return data;
3302
+ }
3303
+
3304
+ if ($option.is('option')) {
3305
+ data = {
3306
+ id: $option.val(),
3307
+ text: $option.text(),
3308
+ disabled: $option.prop('disabled'),
3309
+ selected: $option.prop('selected'),
3310
+ title: $option.prop('title')
3311
+ };
3312
+ } else if ($option.is('optgroup')) {
3313
+ data = {
3314
+ text: $option.prop('label'),
3315
+ children: [],
3316
+ title: $option.prop('title')
3317
+ };
3318
+
3319
+ var $children = $option.children('option');
3320
+ var children = [];
3321
+
3322
+ for (var c = 0; c < $children.length; c++) {
3323
+ var $child = $($children[c]);
3324
+
3325
+ var child = this.item($child);
3326
+
3327
+ children.push(child);
3328
+ }
3329
+
3330
+ data.children = children;
3331
+ }
3332
+
3333
+ data = this._normalizeItem(data);
3334
+ data.element = $option[0];
3335
+
3336
+ $.data($option[0], 'data', data);
3337
+
3338
+ return data;
3339
+ };
3340
+
3341
+ SelectAdapter.prototype._normalizeItem = function (item) {
3342
+ if (!$.isPlainObject(item)) {
3343
+ item = {
3344
+ id: item,
3345
+ text: item
3346
+ };
3347
+ }
3348
+
3349
+ item = $.extend({}, {
3350
+ text: ''
3351
+ }, item);
3352
+
3353
+ var defaults = {
3354
+ selected: false,
3355
+ disabled: false
3356
+ };
3357
+
3358
+ if (item.id != null) {
3359
+ item.id = item.id.toString();
3360
+ }
3361
+
3362
+ if (item.text != null) {
3363
+ item.text = item.text.toString();
3364
+ }
3365
+
3366
+ if (item._resultId == null && item.id) {
3367
+ item._resultId = this.generateResultId(this.container, item);
3368
+ }
3369
+
3370
+ return $.extend({}, defaults, item);
3371
+ };
3372
+
3373
+ SelectAdapter.prototype.matches = function (params, data) {
3374
+ var matcher = this.options.get('matcher');
3375
+
3376
+ return matcher(params, data);
3377
+ };
3378
+
3379
+ return SelectAdapter;
3380
+ });
3381
+
3382
+ S2.define('select2/data/array',[
3383
+ './select',
3384
+ '../utils',
3385
+ 'jquery'
3386
+ ], function (SelectAdapter, Utils, $) {
3387
+ function ArrayAdapter ($element, options) {
3388
+ var data = options.get('data') || [];
3389
+
3390
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3391
+
3392
+ this.addOptions(this.convertToOptions(data));
3393
+ }
3394
+
3395
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3396
+
3397
+ ArrayAdapter.prototype.select = function (data) {
3398
+ var $option = this.$element.find('option').filter(function (i, elm) {
3399
+ return elm.value == data.id.toString();
3400
+ });
3401
+
3402
+ if ($option.length === 0) {
3403
+ $option = this.option(data);
3404
+
3405
+ this.addOptions($option);
3406
+ }
3407
+
3408
+ ArrayAdapter.__super__.select.call(this, data);
3409
+ };
3410
+
3411
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3412
+ var self = this;
3413
+
3414
+ var $existing = this.$element.find('option');
3415
+ var existingIds = $existing.map(function () {
3416
+ return self.item($(this)).id;
3417
+ }).get();
3418
+
3419
+ var $options = [];
3420
+
3421
+ // Filter out all items except for the one passed in the argument
3422
+ function onlyItem (item) {
3423
+ return function () {
3424
+ return $(this).val() == item.id;
3425
+ };
3426
+ }
3427
+
3428
+ for (var d = 0; d < data.length; d++) {
3429
+ var item = this._normalizeItem(data[d]);
3430
+
3431
+ // Skip items which were pre-loaded, only merge the data
3432
+ if ($.inArray(item.id, existingIds) >= 0) {
3433
+ var $existingOption = $existing.filter(onlyItem(item));
3434
+
3435
+ var existingData = this.item($existingOption);
3436
+ var newData = $.extend(true, {}, item, existingData);
3437
+
3438
+ var $newOption = this.option(newData);
3439
+
3440
+ $existingOption.replaceWith($newOption);
3441
+
3442
+ continue;
3443
+ }
3444
+
3445
+ var $option = this.option(item);
3446
+
3447
+ if (item.children) {
3448
+ var $children = this.convertToOptions(item.children);
3449
+
3450
+ Utils.appendMany($option, $children);
3451
+ }
3452
+
3453
+ $options.push($option);
3454
+ }
3455
+
3456
+ return $options;
3457
+ };
3458
+
3459
+ return ArrayAdapter;
3460
+ });
3461
+
3462
+ S2.define('select2/data/ajax',[
3463
+ './array',
3464
+ '../utils',
3465
+ 'jquery'
3466
+ ], function (ArrayAdapter, Utils, $) {
3467
+ function AjaxAdapter ($element, options) {
3468
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3469
+
3470
+ if (this.ajaxOptions.processResults != null) {
3471
+ this.processResults = this.ajaxOptions.processResults;
3472
+ }
3473
+
3474
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3475
+ }
3476
+
3477
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3478
+
3479
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3480
+ var defaults = {
3481
+ data: function (params) {
3482
+ return $.extend({}, params, {
3483
+ q: params.term
3484
+ });
3485
+ },
3486
+ transport: function (params, success, failure) {
3487
+ var $request = $.ajax(params);
3488
+
3489
+ $request.then(success);
3490
+ $request.fail(failure);
3491
+
3492
+ return $request;
3493
+ }
3494
+ };
3495
+
3496
+ return $.extend({}, defaults, options, true);
3497
+ };
3498
+
3499
+ AjaxAdapter.prototype.processResults = function (results) {
3500
+ return results;
3501
+ };
3502
+
3503
+ AjaxAdapter.prototype.query = function (params, callback) {
3504
+ var matches = [];
3505
+ var self = this;
3506
+
3507
+ if (this._request != null) {
3508
+ // JSONP requests cannot always be aborted
3509
+ if ($.isFunction(this._request.abort)) {
3510
+ this._request.abort();
3511
+ }
3512
+
3513
+ this._request = null;
3514
+ }
3515
+
3516
+ var options = $.extend({
3517
+ type: 'GET'
3518
+ }, this.ajaxOptions);
3519
+
3520
+ if (typeof options.url === 'function') {
3521
+ options.url = options.url.call(this.$element, params);
3522
+ }
3523
+
3524
+ if (typeof options.data === 'function') {
3525
+ options.data = options.data.call(this.$element, params);
3526
+ }
3527
+
3528
+ function request () {
3529
+ var $request = options.transport(options, function (data) {
3530
+ var results = self.processResults(data, params);
3531
+
3532
+ if (self.options.get('debug') && window.console && console.error) {
3533
+ // Check to make sure that the response included a `results` key.
3534
+ if (!results || !results.results || !$.isArray(results.results)) {
3535
+ console.error(
3536
+ 'Select2: The AJAX results did not return an array in the ' +
3537
+ '`results` key of the response.'
3538
+ );
3539
+ }
3540
+ }
3541
+
3542
+ callback(results);
3543
+ self.container.focusOnActiveElement();
3544
+ }, function () {
3545
+ // Attempt to detect if a request was aborted
3546
+ // Only works if the transport exposes a status property
3547
+ if ($request.status && $request.status === '0') {
3548
+ return;
3549
+ }
3550
+
3551
+ self.trigger('results:message', {
3552
+ message: 'errorLoading'
3553
+ });
3554
+ });
3555
+
3556
+ self._request = $request;
3557
+ }
3558
+
3559
+ if (this.ajaxOptions.delay && params.term != null) {
3560
+ if (this._queryTimeout) {
3561
+ window.clearTimeout(this._queryTimeout);
3562
+ }
3563
+
3564
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3565
+ } else {
3566
+ request();
3567
+ }
3568
+ };
3569
+
3570
+ return AjaxAdapter;
3571
+ });
3572
+
3573
+ S2.define('select2/data/tags',[
3574
+ 'jquery'
3575
+ ], function ($) {
3576
+ function Tags (decorated, $element, options) {
3577
+ var tags = options.get('tags');
3578
+
3579
+ var createTag = options.get('createTag');
3580
+
3581
+ if (createTag !== undefined) {
3582
+ this.createTag = createTag;
3583
+ }
3584
+
3585
+ var insertTag = options.get('insertTag');
3586
+
3587
+ if (insertTag !== undefined) {
3588
+ this.insertTag = insertTag;
3589
+ }
3590
+
3591
+ decorated.call(this, $element, options);
3592
+
3593
+ if ($.isArray(tags)) {
3594
+ for (var t = 0; t < tags.length; t++) {
3595
+ var tag = tags[t];
3596
+ var item = this._normalizeItem(tag);
3597
+
3598
+ var $option = this.option(item);
3599
+
3600
+ this.$element.append($option);
3601
+ }
3602
+ }
3603
+ }
3604
+
3605
+ Tags.prototype.query = function (decorated, params, callback) {
3606
+ var self = this;
3607
+
3608
+ this._removeOldTags();
3609
+
3610
+ if (params.term == null || params.page != null) {
3611
+ decorated.call(this, params, callback);
3612
+ return;
3613
+ }
3614
+
3615
+ function wrapper (obj, child) {
3616
+ var data = obj.results;
3617
+
3618
+ for (var i = 0; i < data.length; i++) {
3619
+ var option = data[i];
3620
+
3621
+ var checkChildren = (
3622
+ option.children != null &&
3623
+ !wrapper({
3624
+ results: option.children
3625
+ }, true)
3626
+ );
3627
+
3628
+ var optionText = (option.text || '').toUpperCase();
3629
+ var paramsTerm = (params.term || '').toUpperCase();
3630
+
3631
+ var checkText = optionText === paramsTerm;
3632
+
3633
+ if (checkText || checkChildren) {
3634
+ if (child) {
3635
+ return false;
3636
+ }
3637
+
3638
+ obj.data = data;
3639
+ callback(obj);
3640
+
3641
+ return;
3642
+ }
3643
+ }
3644
+
3645
+ if (child) {
3646
+ return true;
3647
+ }
3648
+
3649
+ var tag = self.createTag(params);
3650
+
3651
+ if (tag != null) {
3652
+ var $option = self.option(tag);
3653
+ $option.attr('data-select2-tag', true);
3654
+
3655
+ self.addOptions([$option]);
3656
+
3657
+ self.insertTag(data, tag);
3658
+ }
3659
+
3660
+ obj.results = data;
3661
+
3662
+ callback(obj);
3663
+ }
3664
+
3665
+ decorated.call(this, params, wrapper);
3666
+ };
3667
+
3668
+ Tags.prototype.createTag = function (decorated, params) {
3669
+ var term = $.trim(params.term);
3670
+
3671
+ if (term === '') {
3672
+ return null;
3673
+ }
3674
+
3675
+ return {
3676
+ id: term,
3677
+ text: term
3678
+ };
3679
+ };
3680
+
3681
+ Tags.prototype.insertTag = function (_, data, tag) {
3682
+ data.unshift(tag);
3683
+ };
3684
+
3685
+ Tags.prototype._removeOldTags = function (_) {
3686
+ var tag = this._lastTag;
3687
+
3688
+ var $options = this.$element.find('option[data-select2-tag]');
3689
+
3690
+ $options.each(function () {
3691
+ if (this.selected) {
3692
+ return;
3693
+ }
3694
+
3695
+ $(this).remove();
3696
+ });
3697
+ };
3698
+
3699
+ return Tags;
3700
+ });
3701
+
3702
+ S2.define('select2/data/tokenizer',[
3703
+ 'jquery'
3704
+ ], function ($) {
3705
+ function Tokenizer (decorated, $element, options) {
3706
+ var tokenizer = options.get('tokenizer');
3707
+
3708
+ if (tokenizer !== undefined) {
3709
+ this.tokenizer = tokenizer;
3710
+ }
3711
+
3712
+ decorated.call(this, $element, options);
3713
+ }
3714
+
3715
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3716
+ decorated.call(this, container, $container);
3717
+
3718
+ this.$search = container.dropdown.$search || container.selection.$search ||
3719
+ $container.find('.select2-search__field');
3720
+ };
3721
+
3722
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3723
+ var self = this;
3724
+
3725
+ function createAndSelect (data) {
3726
+ // Normalize the data object so we can use it for checks
3727
+ var item = self._normalizeItem(data);
3728
+
3729
+ // Check if the data object already exists as a tag
3730
+ // Select it if it doesn't
3731
+ var $existingOptions = self.$element.find('option').filter(function () {
3732
+ return $(this).val() === item.id;
3733
+ });
3734
+
3735
+ // If an existing option wasn't found for it, create the option
3736
+ if (!$existingOptions.length) {
3737
+ var $option = self.option(item);
3738
+ $option.attr('data-select2-tag', true);
3739
+
3740
+ self._removeOldTags();
3741
+ self.addOptions([$option]);
3742
+ }
3743
+
3744
+ // Select the item, now that we know there is an option for it
3745
+ select(item);
3746
+ }
3747
+
3748
+ function select (data) {
3749
+ self.trigger('select', {
3750
+ data: data
3751
+ });
3752
+ }
3753
+
3754
+ params.term = params.term || '';
3755
+
3756
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3757
+
3758
+ if (tokenData.term !== params.term) {
3759
+ // Replace the search term if we have the search box
3760
+ if (this.$search.length) {
3761
+ this.$search.val(tokenData.term);
3762
+ this.$search.focus();
3763
+ }
3764
+
3765
+ params.term = tokenData.term;
3766
+ }
3767
+
3768
+ decorated.call(this, params, callback);
3769
+ };
3770
+
3771
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3772
+ var separators = options.get('tokenSeparators') || [];
3773
+ var term = params.term;
3774
+ var i = 0;
3775
+
3776
+ var createTag = this.createTag || function (params) {
3777
+ return {
3778
+ id: params.term,
3779
+ text: params.term
3780
+ };
3781
+ };
3782
+
3783
+ while (i < term.length) {
3784
+ var termChar = term[i];
3785
+
3786
+ if ($.inArray(termChar, separators) === -1) {
3787
+ i++;
3788
+
3789
+ continue;
3790
+ }
3791
+
3792
+ var part = term.substr(0, i);
3793
+ var partParams = $.extend({}, params, {
3794
+ term: part
3795
+ });
3796
+
3797
+ var data = createTag(partParams);
3798
+
3799
+ if (data == null) {
3800
+ i++;
3801
+ continue;
3802
+ }
3803
+
3804
+ callback(data);
3805
+
3806
+ // Reset the term to not include the tokenized portion
3807
+ term = term.substr(i + 1) || '';
3808
+ i = 0;
3809
+ }
3810
+
3811
+ return {
3812
+ term: term
3813
+ };
3814
+ };
3815
+
3816
+ return Tokenizer;
3817
+ });
3818
+
3819
+ S2.define('select2/data/minimumInputLength',[
3820
+
3821
+ ], function () {
3822
+ function MinimumInputLength (decorated, $e, options) {
3823
+ this.minimumInputLength = options.get('minimumInputLength');
3824
+
3825
+ decorated.call(this, $e, options);
3826
+ }
3827
+
3828
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
3829
+ params.term = params.term || '';
3830
+
3831
+ if (params.term.length < this.minimumInputLength) {
3832
+ this.trigger('results:message', {
3833
+ message: 'inputTooShort',
3834
+ args: {
3835
+ minimum: this.minimumInputLength,
3836
+ input: params.term,
3837
+ params: params
3838
+ }
3839
+ });
3840
+
3841
+ return;
3842
+ }
3843
+
3844
+ decorated.call(this, params, callback);
3845
+ };
3846
+
3847
+ return MinimumInputLength;
3848
+ });
3849
+
3850
+ S2.define('select2/data/maximumInputLength',[
3851
+
3852
+ ], function () {
3853
+ function MaximumInputLength (decorated, $e, options) {
3854
+ this.maximumInputLength = options.get('maximumInputLength');
3855
+
3856
+ decorated.call(this, $e, options);
3857
+ }
3858
+
3859
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
3860
+ params.term = params.term || '';
3861
+
3862
+ if (this.maximumInputLength > 0 &&
3863
+ params.term.length > this.maximumInputLength) {
3864
+ this.trigger('results:message', {
3865
+ message: 'inputTooLong',
3866
+ args: {
3867
+ maximum: this.maximumInputLength,
3868
+ input: params.term,
3869
+ params: params
3870
+ }
3871
+ });
3872
+
3873
+ return;
3874
+ }
3875
+
3876
+ decorated.call(this, params, callback);
3877
+ };
3878
+
3879
+ return MaximumInputLength;
3880
+ });
3881
+
3882
+ S2.define('select2/data/maximumSelectionLength',[
3883
+
3884
+ ], function (){
3885
+ function MaximumSelectionLength (decorated, $e, options) {
3886
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
3887
+
3888
+ decorated.call(this, $e, options);
3889
+ }
3890
+
3891
+ MaximumSelectionLength.prototype.query =
3892
+ function (decorated, params, callback) {
3893
+ var self = this;
3894
+
3895
+ this.current(function (currentData) {
3896
+ var count = currentData != null ? currentData.length : 0;
3897
+ if (self.maximumSelectionLength > 0 &&
3898
+ count >= self.maximumSelectionLength) {
3899
+ self.trigger('results:message', {
3900
+ message: 'maximumSelected',
3901
+ args: {
3902
+ maximum: self.maximumSelectionLength
3903
+ }
3904
+ });
3905
+ return;
3906
+ }
3907
+ decorated.call(self, params, callback);
3908
+ });
3909
+ };
3910
+
3911
+ return MaximumSelectionLength;
3912
+ });
3913
+
3914
+ S2.define('select2/dropdown',[
3915
+ 'jquery',
3916
+ './utils'
3917
+ ], function ($, Utils) {
3918
+ function Dropdown ($element, options) {
3919
+ this.$element = $element;
3920
+ this.options = options;
3921
+
3922
+ Dropdown.__super__.constructor.call(this);
3923
+ }
3924
+
3925
+ Utils.Extend(Dropdown, Utils.Observable);
3926
+
3927
+ Dropdown.prototype.render = function () {
3928
+ var $dropdown = $(
3929
+ '<span class="select2-dropdown">' +
3930
+ '<span class="select2-results"></span>' +
3931
+ '</span>'
3932
+ );
3933
+
3934
+ $dropdown.attr('dir', this.options.get('dir'));
3935
+
3936
+ this.$dropdown = $dropdown;
3937
+
3938
+ return $dropdown;
3939
+ };
3940
+
3941
+ Dropdown.prototype.bind = function () {
3942
+ // Should be implemented in subclasses
3943
+ };
3944
+
3945
+ Dropdown.prototype.position = function ($dropdown, $container) {
3946
+ // Should be implmented in subclasses
3947
+ };
3948
+
3949
+ Dropdown.prototype.destroy = function () {
3950
+ // Remove the dropdown from the DOM
3951
+ this.$dropdown.remove();
3952
+ };
3953
+
3954
+ return Dropdown;
3955
+ });
3956
+
3957
+ S2.define('select2/dropdown/search',[
3958
+ 'jquery',
3959
+ '../utils'
3960
+ ], function ($, Utils) {
3961
+ function Search () { }
3962
+
3963
+ Search.prototype.render = function (decorated) {
3964
+ var $rendered = decorated.call(this);
3965
+
3966
+ var $search = $(
3967
+ '<span class="select2-search select2-search--dropdown">' +
3968
+ '<input class="select2-search__field" type="text" tabindex="-1"' +
3969
+ ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
3970
+ ' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
3971
+ '</span>'
3972
+ );
3973
+
3974
+ this.$searchContainer = $search;
3975
+ this.$search = $search.find('input');
3976
+
3977
+ $rendered.prepend($search);
3978
+
3979
+ return $rendered;
3980
+ };
3981
+
3982
+ Search.prototype.bind = function (decorated, container, $container) {
3983
+ var self = this;
3984
+ var resultsId = container.id + '-results';
3985
+
3986
+ decorated.call(this, container, $container);
3987
+
3988
+ this.$search.on('keydown', function (evt) {
3989
+ self.trigger('keypress', evt);
3990
+
3991
+ self._keyUpPrevented = evt.isDefaultPrevented();
3992
+ });
3993
+
3994
+ // Workaround for browsers which do not support the `input` event
3995
+ // This will prevent double-triggering of events for browsers which support
3996
+ // both the `keyup` and `input` events.
3997
+ this.$search.on('input', function (evt) {
3998
+ // Unbind the duplicated `keyup` event
3999
+ $(this).off('keyup');
4000
+ });
4001
+
4002
+ this.$search.on('keyup input', function (evt) {
4003
+ self.handleSearch(evt);
4004
+ });
4005
+
4006
+ container.on('open', function () {
4007
+ self.$search.attr('tabindex', 0);
4008
+ self.$search.attr('aria-owns', resultsId);
4009
+ self.$search.focus();
4010
+
4011
+ window.setTimeout(function () {
4012
+ self.$search.focus();
4013
+ }, 0);
4014
+ });
4015
+
4016
+ container.on('close', function () {
4017
+ self.$search.attr('tabindex', -1);
4018
+ self.$search.removeAttr('aria-activedescendant');
4019
+ self.$search.removeAttr('aria-owns');
4020
+ self.$search.val('');
4021
+ });
4022
+
4023
+ container.on('focus', function () {
4024
+ if (container.isOpen()) {
4025
+ self.$search.focus();
4026
+ }
4027
+ });
4028
+
4029
+ container.on('results:all', function (params) {
4030
+ if (params.query.term == null || params.query.term === '') {
4031
+ var showSearch = self.showSearch(params);
4032
+
4033
+ if (showSearch) {
4034
+ self.$searchContainer.removeClass('select2-search--hide');
4035
+ } else {
4036
+ self.$searchContainer.addClass('select2-search--hide');
4037
+ }
4038
+ }
4039
+ });
4040
+
4041
+ container.on('results:focus', function (params) {
4042
+ self.$search.attr('aria-activedescendant', params.data._resultId);
4043
+ });
4044
+ };
4045
+
4046
+ Search.prototype.handleSearch = function (evt) {
4047
+ if (!this._keyUpPrevented) {
4048
+ var input = this.$search.val();
4049
+
4050
+ this.trigger('query', {
4051
+ term: input
4052
+ });
4053
+ }
4054
+
4055
+ this._keyUpPrevented = false;
4056
+ };
4057
+
4058
+ Search.prototype.showSearch = function (_, params) {
4059
+ return true;
4060
+ };
4061
+
4062
+ return Search;
4063
+ });
4064
+
4065
+ S2.define('select2/dropdown/hidePlaceholder',[
4066
+
4067
+ ], function () {
4068
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4069
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4070
+
4071
+ decorated.call(this, $element, options, dataAdapter);
4072
+ }
4073
+
4074
+ HidePlaceholder.prototype.append = function (decorated, data) {
4075
+ data.results = this.removePlaceholder(data.results);
4076
+
4077
+ decorated.call(this, data);
4078
+ };
4079
+
4080
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4081
+ if (typeof placeholder === 'string') {
4082
+ placeholder = {
4083
+ id: '',
4084
+ text: placeholder
4085
+ };
4086
+ }
4087
+
4088
+ return placeholder;
4089
+ };
4090
+
4091
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4092
+ var modifiedData = data.slice(0);
4093
+
4094
+ for (var d = data.length - 1; d >= 0; d--) {
4095
+ var item = data[d];
4096
+
4097
+ if (this.placeholder.id === item.id) {
4098
+ modifiedData.splice(d, 1);
4099
+ }
4100
+ }
4101
+
4102
+ return modifiedData;
4103
+ };
4104
+
4105
+ return HidePlaceholder;
4106
+ });
4107
+
4108
+ S2.define('select2/dropdown/infiniteScroll',[
4109
+ 'jquery'
4110
+ ], function ($) {
4111
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4112
+ this.lastParams = {};
4113
+
4114
+ decorated.call(this, $element, options, dataAdapter);
4115
+
4116
+ this.$loadingMore = this.createLoadingMore();
4117
+ this.loading = false;
4118
+ }
4119
+
4120
+ InfiniteScroll.prototype.append = function (decorated, data) {
4121
+ this.$loadingMore.remove();
4122
+ this.loading = false;
4123
+
4124
+ decorated.call(this, data);
4125
+
4126
+ if (this.showLoadingMore(data)) {
4127
+ this.$results.append(this.$loadingMore);
4128
+ }
4129
+ };
4130
+
4131
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4132
+ var self = this;
4133
+
4134
+ decorated.call(this, container, $container);
4135
+
4136
+ container.on('query', function (params) {
4137
+ self.lastParams = params;
4138
+ self.loading = true;
4139
+ });
4140
+
4141
+ container.on('query:append', function (params) {
4142
+ self.lastParams = params;
4143
+ self.loading = true;
4144
+ });
4145
+
4146
+ this.$results.on('scroll', function () {
4147
+ var isLoadMoreVisible = $.contains(
4148
+ document.documentElement,
4149
+ self.$loadingMore[0]
4150
+ );
4151
+
4152
+ if (self.loading || !isLoadMoreVisible) {
4153
+ return;
4154
+ }
4155
+
4156
+ var currentOffset = self.$results.offset().top +
4157
+ self.$results.outerHeight(false);
4158
+ var loadingMoreOffset = self.$loadingMore.offset().top +
4159
+ self.$loadingMore.outerHeight(false);
4160
+
4161
+ if (currentOffset + 50 >= loadingMoreOffset) {
4162
+ self.loadMore();
4163
+ }
4164
+ });
4165
+ };
4166
+
4167
+ InfiniteScroll.prototype.loadMore = function () {
4168
+ this.loading = true;
4169
+
4170
+ var params = $.extend({}, {page: 1}, this.lastParams);
4171
+
4172
+ params.page++;
4173
+
4174
+ this.trigger('query:append', params);
4175
+ };
4176
+
4177
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4178
+ return data.pagination && data.pagination.more;
4179
+ };
4180
+
4181
+ InfiniteScroll.prototype.createLoadingMore = function () {
4182
+ var $option = $(
4183
+ '<li ' +
4184
+ 'class="select2-results__option select2-results__option--load-more"' +
4185
+ 'role="option" aria-disabled="true"></li>'
4186
+ );
4187
+
4188
+ var message = this.options.get('translations').get('loadingMore');
4189
+
4190
+ $option.html(message(this.lastParams));
4191
+
4192
+ return $option;
4193
+ };
4194
+
4195
+ return InfiniteScroll;
4196
+ });
4197
+
4198
+ S2.define('select2/dropdown/attachBody',[
4199
+ 'jquery',
4200
+ '../utils'
4201
+ ], function ($, Utils) {
4202
+ function AttachBody (decorated, $element, options) {
4203
+ this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4204
+
4205
+ decorated.call(this, $element, options);
4206
+ }
4207
+
4208
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4209
+ var self = this;
4210
+
4211
+ var setupResultsEvents = false;
4212
+
4213
+ decorated.call(this, container, $container);
4214
+
4215
+ container.on('open', function () {
4216
+ self._showDropdown();
4217
+ self._attachPositioningHandler(container);
4218
+
4219
+ if (!setupResultsEvents) {
4220
+ setupResultsEvents = true;
4221
+
4222
+ container.on('results:all', function () {
4223
+ self._positionDropdown();
4224
+ self._resizeDropdown();
4225
+ });
4226
+
4227
+ container.on('results:append', function () {
4228
+ self._positionDropdown();
4229
+ self._resizeDropdown();
4230
+ });
4231
+ }
4232
+ });
4233
+
4234
+ container.on('close', function () {
4235
+ self._hideDropdown();
4236
+ self._detachPositioningHandler(container);
4237
+ });
4238
+
4239
+ this.$dropdownContainer.on('mousedown', function (evt) {
4240
+ evt.stopPropagation();
4241
+ });
4242
+ };
4243
+
4244
+ AttachBody.prototype.destroy = function (decorated) {
4245
+ decorated.call(this);
4246
+
4247
+ this.$dropdownContainer.remove();
4248
+ };
4249
+
4250
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4251
+ // Clone all of the container classes
4252
+ $dropdown.attr('class', $container.attr('class'));
4253
+
4254
+ $dropdown.removeClass('select2');
4255
+ $dropdown.addClass('select2-container--open');
4256
+
4257
+ $dropdown.css({
4258
+ position: 'absolute',
4259
+ top: -999999
4260
+ });
4261
+
4262
+ this.$container = $container;
4263
+ };
4264
+
4265
+ AttachBody.prototype.render = function (decorated) {
4266
+ var $container = $('<span></span>');
4267
+
4268
+ var $dropdown = decorated.call(this);
4269
+ $container.append($dropdown);
4270
+
4271
+ this.$dropdownContainer = $container;
4272
+
4273
+ return $container;
4274
+ };
4275
+
4276
+ AttachBody.prototype._hideDropdown = function (decorated) {
4277
+ this.$dropdownContainer.detach();
4278
+ };
4279
+
4280
+ AttachBody.prototype._attachPositioningHandler =
4281
+ function (decorated, container) {
4282
+ var self = this;
4283
+
4284
+ var scrollEvent = 'scroll.select2.' + container.id;
4285
+ var resizeEvent = 'resize.select2.' + container.id;
4286
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4287
+
4288
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4289
+ $watchers.each(function () {
4290
+ $(this).data('select2-scroll-position', {
4291
+ x: $(this).scrollLeft(),
4292
+ y: $(this).scrollTop()
4293
+ });
4294
+ });
4295
+
4296
+ $watchers.on(scrollEvent, function (ev) {
4297
+ var position = $(this).data('select2-scroll-position');
4298
+ $(this).scrollTop(position.y);
4299
+ });
4300
+
4301
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4302
+ function (e) {
4303
+ self._positionDropdown();
4304
+ self._resizeDropdown();
4305
+ });
4306
+ };
4307
+
4308
+ AttachBody.prototype._detachPositioningHandler =
4309
+ function (decorated, container) {
4310
+ var scrollEvent = 'scroll.select2.' + container.id;
4311
+ var resizeEvent = 'resize.select2.' + container.id;
4312
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4313
+
4314
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4315
+ $watchers.off(scrollEvent);
4316
+
4317
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4318
+ };
4319
+
4320
+ AttachBody.prototype._positionDropdown = function () {
4321
+ var $window = $(window);
4322
+
4323
+ var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4324
+ var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4325
+
4326
+ var newDirection = null;
4327
+
4328
+ var offset = this.$container.offset();
4329
+
4330
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4331
+
4332
+ var container = {
4333
+ height: this.$container.outerHeight(false)
4334
+ };
4335
+
4336
+ container.top = offset.top;
4337
+ container.bottom = offset.top + container.height;
4338
+
4339
+ var dropdown = {
4340
+ height: this.$dropdown.outerHeight(false)
4341
+ };
4342
+
4343
+ var viewport = {
4344
+ top: $window.scrollTop(),
4345
+ bottom: $window.scrollTop() + $window.height()
4346
+ };
4347
+
4348
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4349
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4350
+
4351
+ var css = {
4352
+ left: offset.left,
4353
+ top: container.bottom
4354
+ };
4355
+
4356
+ // Determine what the parent element is to use for calciulating the offset
4357
+ var $offsetParent = this.$dropdownParent;
4358
+
4359
+ // For statically positoned elements, we need to get the element
4360
+ // that is determining the offset
4361
+ if ($offsetParent.css('position') === 'static') {
4362
+ $offsetParent = $offsetParent.offsetParent();
4363
+ }
4364
+
4365
+ var parentOffset = $offsetParent.offset();
4366
+
4367
+ css.top -= parentOffset.top;
4368
+ css.left -= parentOffset.left;
4369
+
4370
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4371
+ newDirection = 'below';
4372
+ }
4373
+
4374
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4375
+ newDirection = 'above';
4376
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4377
+ newDirection = 'below';
4378
+ }
4379
+
4380
+ if (newDirection == 'above' ||
4381
+ (isCurrentlyAbove && newDirection !== 'below')) {
4382
+ css.top = container.top - parentOffset.top - dropdown.height;
4383
+ }
4384
+
4385
+ if (newDirection != null) {
4386
+ this.$dropdown
4387
+ .removeClass('select2-dropdown--below select2-dropdown--above')
4388
+ .addClass('select2-dropdown--' + newDirection);
4389
+ this.$container
4390
+ .removeClass('select2-container--below select2-container--above')
4391
+ .addClass('select2-container--' + newDirection);
4392
+ }
4393
+
4394
+ this.$dropdownContainer.css(css);
4395
+ };
4396
+
4397
+ AttachBody.prototype._resizeDropdown = function () {
4398
+ var css = {
4399
+ width: this.$container.outerWidth(false) + 'px'
4400
+ };
4401
+
4402
+ if (this.options.get('dropdownAutoWidth')) {
4403
+ css.minWidth = css.width;
4404
+ css.position = 'relative';
4405
+ css.width = 'auto';
4406
+ }
4407
+
4408
+ this.$dropdown.css(css);
4409
+ };
4410
+
4411
+ AttachBody.prototype._showDropdown = function (decorated) {
4412
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4413
+
4414
+ this._positionDropdown();
4415
+ this._resizeDropdown();
4416
+ };
4417
+
4418
+ return AttachBody;
4419
+ });
4420
+
4421
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4422
+
4423
+ ], function () {
4424
+ function countResults (data) {
4425
+ var count = 0;
4426
+
4427
+ for (var d = 0; d < data.length; d++) {
4428
+ var item = data[d];
4429
+
4430
+ if (item.children) {
4431
+ count += countResults(item.children);
4432
+ } else {
4433
+ count++;
4434
+ }
4435
+ }
4436
+
4437
+ return count;
4438
+ }
4439
+
4440
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4441
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4442
+
4443
+ if (this.minimumResultsForSearch < 0) {
4444
+ this.minimumResultsForSearch = Infinity;
4445
+ }
4446
+
4447
+ decorated.call(this, $element, options, dataAdapter);
4448
+ }
4449
+
4450
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4451
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4452
+ return false;
4453
+ }
4454
+
4455
+ return decorated.call(this, params);
4456
+ };
4457
+
4458
+ return MinimumResultsForSearch;
4459
+ });
4460
+
4461
+ S2.define('select2/dropdown/selectOnClose',[
4462
+
4463
+ ], function () {
4464
+ function SelectOnClose () { }
4465
+
4466
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4467
+ var self = this;
4468
+
4469
+ decorated.call(this, container, $container);
4470
+
4471
+ container.on('close', function (params) {
4472
+ self._handleSelectOnClose(params);
4473
+ });
4474
+ };
4475
+
4476
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4477
+ if (params && params.originalSelect2Event != null) {
4478
+ var event = params.originalSelect2Event;
4479
+
4480
+ // Don't select an item if the close event was triggered from a select or
4481
+ // unselect event
4482
+ if (event._type === 'select' || event._type === 'unselect') {
4483
+ return;
4484
+ }
4485
+ }
4486
+
4487
+ var $highlightedResults = this.getHighlightedResults();
4488
+
4489
+ // Only select highlighted results
4490
+ if ($highlightedResults.length < 1) {
4491
+ return;
4492
+ }
4493
+
4494
+ var data = $highlightedResults.data('data');
4495
+
4496
+ // Don't re-select already selected resulte
4497
+ if (
4498
+ (data.element != null && data.element.selected) ||
4499
+ (data.element == null && data.selected)
4500
+ ) {
4501
+ return;
4502
+ }
4503
+
4504
+ this.trigger('select', {
4505
+ data: data
4506
+ });
4507
+ };
4508
+
4509
+ return SelectOnClose;
4510
+ });
4511
+
4512
+ S2.define('select2/dropdown/closeOnSelect',[
4513
+
4514
+ ], function () {
4515
+ function CloseOnSelect () { }
4516
+
4517
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4518
+ var self = this;
4519
+
4520
+ decorated.call(this, container, $container);
4521
+
4522
+ container.on('select', function (evt) {
4523
+ self._selectTriggered(evt);
4524
+ });
4525
+
4526
+ container.on('unselect', function (evt) {
4527
+ self._selectTriggered(evt);
4528
+ });
4529
+ };
4530
+
4531
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4532
+ var originalEvent = evt.originalEvent;
4533
+
4534
+ // Don't close if the control key is being held
4535
+ if (originalEvent && originalEvent.ctrlKey) {
4536
+ return;
4537
+ }
4538
+
4539
+ this.trigger('close', {
4540
+ originalEvent: originalEvent,
4541
+ originalSelect2Event: evt
4542
+ });
4543
+ };
4544
+
4545
+ return CloseOnSelect;
4546
+ });
4547
+
4548
+ S2.define('select2/i18n/en',[],function () {
4549
+ // English
4550
+ return {
4551
+ errorLoading: function () {
4552
+ return 'The results could not be loaded.';
4553
+ },
4554
+ inputTooLong: function (args) {
4555
+ var overChars = args.input.length - args.maximum;
4556
+
4557
+ var message = 'Please delete ' + overChars + ' character';
4558
+
4559
+ if (overChars != 1) {
4560
+ message += 's';
4561
+ }
4562
+
4563
+ return message;
4564
+ },
4565
+ inputTooShort: function (args) {
4566
+ var remainingChars = args.minimum - args.input.length;
4567
+
4568
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4569
+
4570
+ return message;
4571
+ },
4572
+ loadingMore: function () {
4573
+ return 'Loading more results…';
4574
+ },
4575
+ maximumSelected: function (args) {
4576
+ var message = 'You can only select ' + args.maximum + ' item';
4577
+
4578
+ if (args.maximum != 1) {
4579
+ message += 's';
4580
+ }
4581
+
4582
+ return message;
4583
+ },
4584
+ noResults: function () {
4585
+ return 'No results found';
4586
+ },
4587
+ searching: function () {
4588
+ return 'Searching…';
4589
+ }
4590
+ };
4591
+ });
4592
+
4593
+ S2.define('select2/defaults',[
4594
+ 'jquery',
4595
+ 'require',
4596
+
4597
+ './results',
4598
+
4599
+ './selection/single',
4600
+ './selection/multiple',
4601
+ './selection/placeholder',
4602
+ './selection/allowClear',
4603
+ './selection/search',
4604
+ './selection/eventRelay',
4605
+
4606
+ './utils',
4607
+ './translation',
4608
+ './diacritics',
4609
+
4610
+ './data/select',
4611
+ './data/array',
4612
+ './data/ajax',
4613
+ './data/tags',
4614
+ './data/tokenizer',
4615
+ './data/minimumInputLength',
4616
+ './data/maximumInputLength',
4617
+ './data/maximumSelectionLength',
4618
+
4619
+ './dropdown',
4620
+ './dropdown/search',
4621
+ './dropdown/hidePlaceholder',
4622
+ './dropdown/infiniteScroll',
4623
+ './dropdown/attachBody',
4624
+ './dropdown/minimumResultsForSearch',
4625
+ './dropdown/selectOnClose',
4626
+ './dropdown/closeOnSelect',
4627
+
4628
+ './i18n/en'
4629
+ ], function ($, require,
4630
+
4631
+ ResultsList,
4632
+
4633
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4634
+ SelectionSearch, EventRelay,
4635
+
4636
+ Utils, Translation, DIACRITICS,
4637
+
4638
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4639
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4640
+
4641
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4642
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4643
+
4644
+ EnglishTranslation) {
4645
+ function Defaults () {
4646
+ this.reset();
4647
+ }
4648
+
4649
+ Defaults.prototype.apply = function (options) {
4650
+ options = $.extend(true, {}, this.defaults, options);
4651
+
4652
+ if (options.dataAdapter == null) {
4653
+ if (options.ajax != null) {
4654
+ options.dataAdapter = AjaxData;
4655
+ } else if (options.data != null) {
4656
+ options.dataAdapter = ArrayData;
4657
+ } else {
4658
+ options.dataAdapter = SelectData;
4659
+ }
4660
+
4661
+ if (options.minimumInputLength > 0) {
4662
+ options.dataAdapter = Utils.Decorate(
4663
+ options.dataAdapter,
4664
+ MinimumInputLength
4665
+ );
4666
+ }
4667
+
4668
+ if (options.maximumInputLength > 0) {
4669
+ options.dataAdapter = Utils.Decorate(
4670
+ options.dataAdapter,
4671
+ MaximumInputLength
4672
+ );
4673
+ }
4674
+
4675
+ if (options.maximumSelectionLength > 0) {
4676
+ options.dataAdapter = Utils.Decorate(
4677
+ options.dataAdapter,
4678
+ MaximumSelectionLength
4679
+ );
4680
+ }
4681
+
4682
+ if (options.tags) {
4683
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4684
+ }
4685
+
4686
+ if (options.tokenSeparators != null || options.tokenizer != null) {
4687
+ options.dataAdapter = Utils.Decorate(
4688
+ options.dataAdapter,
4689
+ Tokenizer
4690
+ );
4691
+ }
4692
+
4693
+ if (options.query != null) {
4694
+ var Query = require(options.amdBase + 'compat/query');
4695
+
4696
+ options.dataAdapter = Utils.Decorate(
4697
+ options.dataAdapter,
4698
+ Query
4699
+ );
4700
+ }
4701
+
4702
+ if (options.initSelection != null) {
4703
+ var InitSelection = require(options.amdBase + 'compat/initSelection');
4704
+
4705
+ options.dataAdapter = Utils.Decorate(
4706
+ options.dataAdapter,
4707
+ InitSelection
4708
+ );
4709
+ }
4710
+ }
4711
+
4712
+ if (options.resultsAdapter == null) {
4713
+ options.resultsAdapter = ResultsList;
4714
+
4715
+ if (options.ajax != null) {
4716
+ options.resultsAdapter = Utils.Decorate(
4717
+ options.resultsAdapter,
4718
+ InfiniteScroll
4719
+ );
4720
+ }
4721
+
4722
+ if (options.placeholder != null) {
4723
+ options.resultsAdapter = Utils.Decorate(
4724
+ options.resultsAdapter,
4725
+ HidePlaceholder
4726
+ );
4727
+ }
4728
+
4729
+ if (options.selectOnClose) {
4730
+ options.resultsAdapter = Utils.Decorate(
4731
+ options.resultsAdapter,
4732
+ SelectOnClose
4733
+ );
4734
+ }
4735
+ }
4736
+
4737
+ if (options.dropdownAdapter == null) {
4738
+ if (options.multiple) {
4739
+ options.dropdownAdapter = Dropdown;
4740
+ } else {
4741
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4742
+
4743
+ options.dropdownAdapter = SearchableDropdown;
4744
+ }
4745
+
4746
+ if (options.minimumResultsForSearch !== 0) {
4747
+ options.dropdownAdapter = Utils.Decorate(
4748
+ options.dropdownAdapter,
4749
+ MinimumResultsForSearch
4750
+ );
4751
+ }
4752
+
4753
+ if (options.closeOnSelect) {
4754
+ options.dropdownAdapter = Utils.Decorate(
4755
+ options.dropdownAdapter,
4756
+ CloseOnSelect
4757
+ );
4758
+ }
4759
+
4760
+ if (
4761
+ options.dropdownCssClass != null ||
4762
+ options.dropdownCss != null ||
4763
+ options.adaptDropdownCssClass != null
4764
+ ) {
4765
+ var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4766
+
4767
+ options.dropdownAdapter = Utils.Decorate(
4768
+ options.dropdownAdapter,
4769
+ DropdownCSS
4770
+ );
4771
+ }
4772
+
4773
+ options.dropdownAdapter = Utils.Decorate(
4774
+ options.dropdownAdapter,
4775
+ AttachBody
4776
+ );
4777
+ }
4778
+
4779
+ if (options.selectionAdapter == null) {
4780
+ if (options.multiple) {
4781
+ options.selectionAdapter = MultipleSelection;
4782
+ } else {
4783
+ options.selectionAdapter = SingleSelection;
4784
+ }
4785
+
4786
+ // Add the placeholder mixin if a placeholder was specified
4787
+ if (options.placeholder != null) {
4788
+ options.selectionAdapter = Utils.Decorate(
4789
+ options.selectionAdapter,
4790
+ Placeholder
4791
+ );
4792
+ }
4793
+
4794
+ if (options.allowClear) {
4795
+ options.selectionAdapter = Utils.Decorate(
4796
+ options.selectionAdapter,
4797
+ AllowClear
4798
+ );
4799
+ }
4800
+
4801
+ if (options.multiple) {
4802
+ options.selectionAdapter = Utils.Decorate(
4803
+ options.selectionAdapter,
4804
+ SelectionSearch
4805
+ );
4806
+ }
4807
+
4808
+ if (
4809
+ options.containerCssClass != null ||
4810
+ options.containerCss != null ||
4811
+ options.adaptContainerCssClass != null
4812
+ ) {
4813
+ var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4814
+
4815
+ options.selectionAdapter = Utils.Decorate(
4816
+ options.selectionAdapter,
4817
+ ContainerCSS
4818
+ );
4819
+ }
4820
+
4821
+ options.selectionAdapter = Utils.Decorate(
4822
+ options.selectionAdapter,
4823
+ EventRelay
4824
+ );
4825
+ }
4826
+
4827
+ if (typeof options.language === 'string') {
4828
+ // Check if the language is specified with a region
4829
+ if (options.language.indexOf('-') > 0) {
4830
+ // Extract the region information if it is included
4831
+ var languageParts = options.language.split('-');
4832
+ var baseLanguage = languageParts[0];
4833
+
4834
+ options.language = [options.language, baseLanguage];
4835
+ } else {
4836
+ options.language = [options.language];
4837
+ }
4838
+ }
4839
+
4840
+ if ($.isArray(options.language)) {
4841
+ var languages = new Translation();
4842
+ options.language.push('en');
4843
+
4844
+ var languageNames = options.language;
4845
+
4846
+ for (var l = 0; l < languageNames.length; l++) {
4847
+ var name = languageNames[l];
4848
+ var language = {};
4849
+
4850
+ try {
4851
+ // Try to load it with the original name
4852
+ language = Translation.loadPath(name);
4853
+ } catch (e) {
4854
+ try {
4855
+ // If we couldn't load it, check if it wasn't the full path
4856
+ name = this.defaults.amdLanguageBase + name;
4857
+ language = Translation.loadPath(name);
4858
+ } catch (ex) {
4859
+ // The translation could not be loaded at all. Sometimes this is
4860
+ // because of a configuration problem, other times this can be
4861
+ // because of how Select2 helps load all possible translation files.
4862
+ if (options.debug && window.console && console.warn) {
4863
+ console.warn(
4864
+ 'Select2: The language file for "' + name + '" could not be ' +
4865
+ 'automatically loaded. A fallback will be used instead.'
4866
+ );
4867
+ }
4868
+
4869
+ continue;
4870
+ }
4871
+ }
4872
+
4873
+ languages.extend(language);
4874
+ }
4875
+
4876
+ options.translations = languages;
4877
+ } else {
4878
+ var baseTranslation = Translation.loadPath(
4879
+ this.defaults.amdLanguageBase + 'en'
4880
+ );
4881
+ var customTranslation = new Translation(options.language);
4882
+
4883
+ customTranslation.extend(baseTranslation);
4884
+
4885
+ options.translations = customTranslation;
4886
+ }
4887
+
4888
+ return options;
4889
+ };
4890
+
4891
+ Defaults.prototype.reset = function () {
4892
+ function stripDiacritics (text) {
4893
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4894
+ function match(a) {
4895
+ return DIACRITICS[a] || a;
4896
+ }
4897
+
4898
+ return text.replace(/[^\u0000-\u007E]/g, match);
4899
+ }
4900
+
4901
+ function matcher (params, data) {
4902
+ // Always return the object if there is nothing to compare
4903
+ if ($.trim(params.term) === '') {
4904
+ return data;
4905
+ }
4906
+
4907
+ // Do a recursive check for options with children
4908
+ if (data.children && data.children.length > 0) {
4909
+ // Clone the data object if there are children
4910
+ // This is required as we modify the object to remove any non-matches
4911
+ var match = $.extend(true, {}, data);
4912
+
4913
+ // Check each child of the option
4914
+ for (var c = data.children.length - 1; c >= 0; c--) {
4915
+ var child = data.children[c];
4916
+
4917
+ var matches = matcher(params, child);
4918
+
4919
+ // If there wasn't a match, remove the object in the array
4920
+ if (matches == null) {
4921
+ match.children.splice(c, 1);
4922
+ }
4923
+ }
4924
+
4925
+ // If any children matched, return the new object
4926
+ if (match.children.length > 0) {
4927
+ return match;
4928
+ }
4929
+
4930
+ // If there were no matching children, check just the plain object
4931
+ return matcher(params, match);
4932
+ }
4933
+
4934
+ var original = stripDiacritics(data.text).toUpperCase();
4935
+ var term = stripDiacritics(params.term).toUpperCase();
4936
+
4937
+ // Check if the text contains the term
4938
+ if (original.indexOf(term) > -1) {
4939
+ return data;
4940
+ }
4941
+
4942
+ // If it doesn't contain the term, don't return anything
4943
+ return null;
4944
+ }
4945
+
4946
+ this.defaults = {
4947
+ amdBase: './',
4948
+ amdLanguageBase: './i18n/',
4949
+ closeOnSelect: true,
4950
+ debug: false,
4951
+ dropdownAutoWidth: false,
4952
+ escapeMarkup: Utils.escapeMarkup,
4953
+ language: EnglishTranslation,
4954
+ matcher: matcher,
4955
+ minimumInputLength: 0,
4956
+ maximumInputLength: 0,
4957
+ maximumSelectionLength: 0,
4958
+ minimumResultsForSearch: 0,
4959
+ selectOnClose: false,
4960
+ sorter: function (data) {
4961
+ return data;
4962
+ },
4963
+ templateResult: function (result) {
4964
+ return result.text;
4965
+ },
4966
+ templateSelection: function (selection) {
4967
+ return selection.text;
4968
+ },
4969
+ theme: 'default',
4970
+ width: 'resolve'
4971
+ };
4972
+ };
4973
+
4974
+ Defaults.prototype.set = function (key, value) {
4975
+ var camelKey = $.camelCase(key);
4976
+
4977
+ var data = {};
4978
+ data[camelKey] = value;
4979
+
4980
+ var convertedData = Utils._convertData(data);
4981
+
4982
+ $.extend(this.defaults, convertedData);
4983
+ };
4984
+
4985
+ var defaults = new Defaults();
4986
+
4987
+ return defaults;
4988
+ });
4989
+
4990
+ S2.define('select2/options',[
4991
+ 'require',
4992
+ 'jquery',
4993
+ './defaults',
4994
+ './utils'
4995
+ ], function (require, $, Defaults, Utils) {
4996
+ function Options (options, $element) {
4997
+ this.options = options;
4998
+
4999
+ if ($element != null) {
5000
+ this.fromElement($element);
5001
+ }
5002
+
5003
+ this.options = Defaults.apply(this.options);
5004
+
5005
+ if ($element && $element.is('input')) {
5006
+ var InputCompat = require(this.get('amdBase') + 'compat/inputData');
5007
+
5008
+ this.options.dataAdapter = Utils.Decorate(
5009
+ this.options.dataAdapter,
5010
+ InputCompat
5011
+ );
5012
+ }
5013
+ }
5014
+
5015
+ Options.prototype.fromElement = function ($e) {
5016
+ var excludedData = ['select2'];
5017
+
5018
+ if (this.options.multiple == null) {
5019
+ this.options.multiple = $e.prop('multiple');
5020
+ }
5021
+
5022
+ if (this.options.disabled == null) {
5023
+ this.options.disabled = $e.prop('disabled');
5024
+ }
5025
+
5026
+ if (this.options.language == null) {
5027
+ if ($e.prop('lang')) {
5028
+ this.options.language = $e.prop('lang').toLowerCase();
5029
+ } else if ($e.closest('[lang]').prop('lang')) {
5030
+ this.options.language = $e.closest('[lang]').prop('lang');
5031
+ }
5032
+ }
5033
+
5034
+ if (this.options.dir == null) {
5035
+ if ($e.prop('dir')) {
5036
+ this.options.dir = $e.prop('dir');
5037
+ } else if ($e.closest('[dir]').prop('dir')) {
5038
+ this.options.dir = $e.closest('[dir]').prop('dir');
5039
+ } else {
5040
+ this.options.dir = 'ltr';
5041
+ }
5042
+ }
5043
+
5044
+ $e.prop('disabled', this.options.disabled);
5045
+ $e.prop('multiple', this.options.multiple);
5046
+
5047
+ if ($e.data('select2Tags')) {
5048
+ if (this.options.debug && window.console && console.warn) {
5049
+ console.warn(
5050
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
5051
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
5052
+ 'removed in future versions of Select2.'
5053
+ );
5054
+ }
5055
+
5056
+ $e.data('data', $e.data('select2Tags'));
5057
+ $e.data('tags', true);
5058
+ }
5059
+
5060
+ if ($e.data('ajaxUrl')) {
5061
+ if (this.options.debug && window.console && console.warn) {
5062
+ console.warn(
5063
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5064
+ '`data-ajax--url` and support for the old attribute will be removed' +
5065
+ ' in future versions of Select2.'
5066
+ );
5067
+ }
5068
+
5069
+ $e.attr('ajax--url', $e.data('ajaxUrl'));
5070
+ $e.data('ajax--url', $e.data('ajaxUrl'));
5071
+ }
5072
+
5073
+ var dataset = {};
5074
+
5075
+ // Prefer the element's `dataset` attribute if it exists
5076
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5077
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5078
+ dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5079
+ } else {
5080
+ dataset = $e.data();
5081
+ }
5082
+
5083
+ var data = $.extend(true, {}, dataset);
5084
+
5085
+ data = Utils._convertData(data);
5086
+
5087
+ for (var key in data) {
5088
+ if ($.inArray(key, excludedData) > -1) {
5089
+ continue;
5090
+ }
5091
+
5092
+ if ($.isPlainObject(this.options[key])) {
5093
+ $.extend(this.options[key], data[key]);
5094
+ } else {
5095
+ this.options[key] = data[key];
5096
+ }
5097
+ }
5098
+
5099
+ return this;
5100
+ };
5101
+
5102
+ Options.prototype.get = function (key) {
5103
+ return this.options[key];
5104
+ };
5105
+
5106
+ Options.prototype.set = function (key, val) {
5107
+ this.options[key] = val;
5108
+ };
5109
+
5110
+ return Options;
5111
+ });
5112
+
5113
+ S2.define('select2/core',[
5114
+ 'jquery',
5115
+ './options',
5116
+ './utils',
5117
+ './keys'
5118
+ ], function ($, Options, Utils, KEYS) {
5119
+ var Select2 = function ($element, options) {
5120
+ if ($element.data('select2') != null) {
5121
+ $element.data('select2').destroy();
5122
+ }
5123
+
5124
+ this.$element = $element;
5125
+
5126
+ this.id = this._generateId($element);
5127
+
5128
+ options = options || {};
5129
+
5130
+ this.options = new Options(options, $element);
5131
+
5132
+ Select2.__super__.constructor.call(this);
5133
+
5134
+ // Set up the tabindex
5135
+
5136
+ var tabindex = $element.attr('tabindex') || 0;
5137
+ $element.data('old-tabindex', tabindex);
5138
+ $element.attr('tabindex', '-1');
5139
+
5140
+ // Set up containers and adapters
5141
+
5142
+ var DataAdapter = this.options.get('dataAdapter');
5143
+ this.dataAdapter = new DataAdapter($element, this.options);
5144
+
5145
+ var $container = this.render();
5146
+
5147
+ this._placeContainer($container);
5148
+
5149
+ var SelectionAdapter = this.options.get('selectionAdapter');
5150
+ this.selection = new SelectionAdapter($element, this.options);
5151
+ this.$selection = this.selection.render();
5152
+
5153
+ this.selection.position(this.$selection, $container);
5154
+
5155
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5156
+ this.dropdown = new DropdownAdapter($element, this.options);
5157
+ this.$dropdown = this.dropdown.render();
5158
+
5159
+ this.dropdown.position(this.$dropdown, $container);
5160
+
5161
+ var ResultsAdapter = this.options.get('resultsAdapter');
5162
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5163
+ this.$results = this.results.render();
5164
+
5165
+ this.results.position(this.$results, this.$dropdown);
5166
+
5167
+ // Bind events
5168
+
5169
+ var self = this;
5170
+
5171
+ // Bind the container to all of the adapters
5172
+ this._bindAdapters();
5173
+
5174
+ // Register any DOM event handlers
5175
+ this._registerDomEvents();
5176
+
5177
+ // Register any internal event handlers
5178
+ this._registerDataEvents();
5179
+ this._registerSelectionEvents();
5180
+ this._registerDropdownEvents();
5181
+ this._registerResultsEvents();
5182
+ this._registerEvents();
5183
+
5184
+ // Set the initial state
5185
+ this.dataAdapter.current(function (initialData) {
5186
+ self.trigger('selection:update', {
5187
+ data: initialData
5188
+ });
5189
+ });
5190
+
5191
+ // Hide the original select
5192
+ $element.addClass('select2-hidden-accessible');
5193
+ $element.attr('aria-hidden', 'true');
5194
+
5195
+ // Synchronize any monitored attributes
5196
+ this._syncAttributes();
5197
+
5198
+ $element.data('select2', this);
5199
+ };
5200
+
5201
+ Utils.Extend(Select2, Utils.Observable);
5202
+
5203
+ Select2.prototype._generateId = function ($element) {
5204
+ var id = '';
5205
+
5206
+ if ($element.attr('id') != null) {
5207
+ id = $element.attr('id');
5208
+ } else if ($element.attr('name') != null) {
5209
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5210
+ } else {
5211
+ id = Utils.generateChars(4);
5212
+ }
5213
+
5214
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5215
+ id = 'select2-' + id;
5216
+
5217
+ return id;
5218
+ };
5219
+
5220
+ Select2.prototype._placeContainer = function ($container) {
5221
+ $container.insertAfter(this.$element);
5222
+
5223
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5224
+
5225
+ if (width != null) {
5226
+ $container.css('width', width);
5227
+ }
5228
+ };
5229
+
5230
+ Select2.prototype._resolveWidth = function ($element, method) {
5231
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5232
+
5233
+ if (method == 'resolve') {
5234
+ var styleWidth = this._resolveWidth($element, 'style');
5235
+
5236
+ if (styleWidth != null) {
5237
+ return styleWidth;
5238
+ }
5239
+
5240
+ return this._resolveWidth($element, 'element');
5241
+ }
5242
+
5243
+ if (method == 'element') {
5244
+ var elementWidth = $element.outerWidth(false);
5245
+
5246
+ if (elementWidth <= 0) {
5247
+ return 'auto';
5248
+ }
5249
+
5250
+ return elementWidth + 'px';
5251
+ }
5252
+
5253
+ if (method == 'style') {
5254
+ var style = $element.attr('style');
5255
+
5256
+ if (typeof(style) !== 'string') {
5257
+ return null;
5258
+ }
5259
+
5260
+ var attrs = style.split(';');
5261
+
5262
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5263
+ var attr = attrs[i].replace(/\s/g, '');
5264
+ var matches = attr.match(WIDTH);
5265
+
5266
+ if (matches !== null && matches.length >= 1) {
5267
+ return matches[1];
5268
+ }
5269
+ }
5270
+
5271
+ return null;
5272
+ }
5273
+
5274
+ return method;
5275
+ };
5276
+
5277
+ Select2.prototype._bindAdapters = function () {
5278
+ this.dataAdapter.bind(this, this.$container);
5279
+ this.selection.bind(this, this.$container);
5280
+
5281
+ this.dropdown.bind(this, this.$container);
5282
+ this.results.bind(this, this.$container);
5283
+ };
5284
+
5285
+ Select2.prototype._registerDomEvents = function () {
5286
+ var self = this;
5287
+
5288
+ this.$element.on('change.select2', function () {
5289
+ self.dataAdapter.current(function (data) {
5290
+ self.trigger('selection:update', {
5291
+ data: data
5292
+ });
5293
+ });
5294
+ });
5295
+
5296
+ this.$element.on('focus.select2', function (evt) {
5297
+ self.trigger('focus', evt);
5298
+ });
5299
+
5300
+ this._syncA = Utils.bind(this._syncAttributes, this);
5301
+ this._syncS = Utils.bind(this._syncSubtree, this);
5302
+
5303
+ if (this.$element[0].attachEvent) {
5304
+ this.$element[0].attachEvent('onpropertychange', this._syncA);
5305
+ }
5306
+
5307
+ var observer = window.MutationObserver ||
5308
+ window.WebKitMutationObserver ||
5309
+ window.MozMutationObserver
5310
+ ;
5311
+
5312
+ if (observer != null) {
5313
+ this._observer = new observer(function (mutations) {
5314
+ $.each(mutations, self._syncA);
5315
+ $.each(mutations, self._syncS);
5316
+ });
5317
+ this._observer.observe(this.$element[0], {
5318
+ attributes: true,
5319
+ childList: true,
5320
+ subtree: false
5321
+ });
5322
+ } else if (this.$element[0].addEventListener) {
5323
+ this.$element[0].addEventListener(
5324
+ 'DOMAttrModified',
5325
+ self._syncA,
5326
+ false
5327
+ );
5328
+ this.$element[0].addEventListener(
5329
+ 'DOMNodeInserted',
5330
+ self._syncS,
5331
+ false
5332
+ );
5333
+ this.$element[0].addEventListener(
5334
+ 'DOMNodeRemoved',
5335
+ self._syncS,
5336
+ false
5337
+ );
5338
+ }
5339
+ };
5340
+
5341
+ Select2.prototype._registerDataEvents = function () {
5342
+ var self = this;
5343
+
5344
+ this.dataAdapter.on('*', function (name, params) {
5345
+ self.trigger(name, params);
5346
+ });
5347
+ };
5348
+
5349
+ Select2.prototype._registerSelectionEvents = function () {
5350
+ var self = this;
5351
+ var nonRelayEvents = ['toggle', 'focus'];
5352
+
5353
+ this.selection.on('toggle', function () {
5354
+ self.toggleDropdown();
5355
+ });
5356
+
5357
+ this.selection.on('focus', function (params) {
5358
+ self.focus(params);
5359
+ });
5360
+
5361
+ this.selection.on('*', function (name, params) {
5362
+ if ($.inArray(name, nonRelayEvents) !== -1) {
5363
+ return;
5364
+ }
5365
+
5366
+ self.trigger(name, params);
5367
+ });
5368
+ };
5369
+
5370
+ Select2.prototype._registerDropdownEvents = function () {
5371
+ var self = this;
5372
+
5373
+ this.dropdown.on('*', function (name, params) {
5374
+ self.trigger(name, params);
5375
+ });
5376
+ };
5377
+
5378
+ Select2.prototype._registerResultsEvents = function () {
5379
+ var self = this;
5380
+
5381
+ this.results.on('*', function (name, params) {
5382
+ self.trigger(name, params);
5383
+ });
5384
+ };
5385
+
5386
+ Select2.prototype._registerEvents = function () {
5387
+ var self = this;
5388
+
5389
+ this.on('open', function () {
5390
+ self.$container.addClass('select2-container--open');
5391
+ });
5392
+
5393
+ this.on('close', function () {
5394
+ self.$container.removeClass('select2-container--open');
5395
+ });
5396
+
5397
+ this.on('enable', function () {
5398
+ self.$container.removeClass('select2-container--disabled');
5399
+ });
5400
+
5401
+ this.on('disable', function () {
5402
+ self.$container.addClass('select2-container--disabled');
5403
+ });
5404
+
5405
+ this.on('blur', function () {
5406
+ self.$container.removeClass('select2-container--focus');
5407
+ });
5408
+
5409
+ this.on('query', function (params) {
5410
+ if (!self.isOpen()) {
5411
+ self.trigger('open', {});
5412
+ }
5413
+
5414
+ this.dataAdapter.query(params, function (data) {
5415
+ self.trigger('results:all', {
5416
+ data: data,
5417
+ query: params
5418
+ });
5419
+ });
5420
+ });
5421
+
5422
+ this.on('query:append', function (params) {
5423
+ this.dataAdapter.query(params, function (data) {
5424
+ self.trigger('results:append', {
5425
+ data: data,
5426
+ query: params
5427
+ });
5428
+ });
5429
+ });
5430
+
5431
+ this.on('open', function(){
5432
+ // Focus on the active element when opening dropdown.
5433
+ // Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
5434
+ setTimeout(function(){
5435
+ self.focusOnActiveElement();
5436
+ }, 1);
5437
+ });
5438
+
5439
+ $(document).on('keydown', function (evt) {
5440
+ var key = evt.which;
5441
+ if (self.isOpen()) {
5442
+ if (key === KEYS.ESC || key === KEYS.TAB ||
5443
+ (key === KEYS.UP && evt.altKey)) {
5444
+ self.close();
5445
+
5446
+ evt.preventDefault();
5447
+ } else if (key === KEYS.ENTER) {
5448
+ self.trigger('results:select', {});
5449
+
5450
+ evt.preventDefault();
5451
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5452
+ self.trigger('results:toggle', {});
5453
+
5454
+ evt.preventDefault();
5455
+ } else if (key === KEYS.UP) {
5456
+ self.trigger('results:previous', {});
5457
+
5458
+ evt.preventDefault();
5459
+ } else if (key === KEYS.DOWN) {
5460
+ self.trigger('results:next', {});
5461
+
5462
+ evt.preventDefault();
5463
+ }
5464
+
5465
+ var $searchField = self.$dropdown.find('.select2-search__field');
5466
+ if (! $searchField.length) {
5467
+ $searchField = self.$container.find('.select2-search__field');
5468
+ }
5469
+
5470
+ // Move the focus to the selected element on keyboard navigation.
5471
+ // Required for screen readers to work properly.
5472
+ if (key === KEYS.DOWN || key === KEYS.UP) {
5473
+ self.focusOnActiveElement();
5474
+ } else {
5475
+ // Focus on the search if user starts typing.
5476
+ $searchField.focus();
5477
+ // Focus back to active selection when finished typing.
5478
+ // Small delay so typed character can be read by screen reader.
5479
+ setTimeout(function(){
5480
+ self.focusOnActiveElement();
5481
+ }, 1000);
5482
+ }
5483
+
5484
+ // If focus is in the search field, select the current active element on Enter key.
5485
+ $searchField.on('keydown', function (evt) {
5486
+ if (evt.which === KEYS.ENTER) {
5487
+ self.trigger('results:select', {});
5488
+ evt.preventDefault();
5489
+ }
5490
+ });
5491
+
5492
+ } else if (self.hasFocus()) {
5493
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5494
+ (key === KEYS.DOWN && evt.altKey)) {
5495
+ self.open();
5496
+ evt.preventDefault();
5497
+ }
5498
+ }
5499
+ });
5500
+ };
5501
+
5502
+ Select2.prototype.focusOnActiveElement = function () {
5503
+ // Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
5504
+ if (! Utils.isTouchscreen()) {
5505
+ this.$results.find('li.select2-results__option--highlighted').focus();
5506
+ }
5507
+ };
5508
+
5509
+ Select2.prototype._syncAttributes = function () {
5510
+ this.options.set('disabled', this.$element.prop('disabled'));
5511
+
5512
+ if (this.options.get('disabled')) {
5513
+ if (this.isOpen()) {
5514
+ this.close();
5515
+ }
5516
+
5517
+ this.trigger('disable', {});
5518
+ } else {
5519
+ this.trigger('enable', {});
5520
+ }
5521
+ };
5522
+
5523
+ Select2.prototype._syncSubtree = function (evt, mutations) {
5524
+ var changed = false;
5525
+ var self = this;
5526
+
5527
+ // Ignore any mutation events raised for elements that aren't options or
5528
+ // optgroups. This handles the case when the select element is destroyed
5529
+ if (
5530
+ evt && evt.target && (
5531
+ evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5532
+ )
5533
+ ) {
5534
+ return;
5535
+ }
5536
+
5537
+ if (!mutations) {
5538
+ // If mutation events aren't supported, then we can only assume that the
5539
+ // change affected the selections
5540
+ changed = true;
5541
+ } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5542
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5543
+ var node = mutations.addedNodes[n];
5544
+
5545
+ if (node.selected) {
5546
+ changed = true;
5547
+ }
5548
+ }
5549
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5550
+ changed = true;
5551
+ }
5552
+
5553
+ // Only re-pull the data if we think there is a change
5554
+ if (changed) {
5555
+ this.dataAdapter.current(function (currentData) {
5556
+ self.trigger('selection:update', {
5557
+ data: currentData
5558
+ });
5559
+ });
5560
+ }
5561
+ };
5562
+
5563
+ /**
5564
+ * Override the trigger method to automatically trigger pre-events when
5565
+ * there are events that can be prevented.
5566
+ */
5567
+ Select2.prototype.trigger = function (name, args) {
5568
+ var actualTrigger = Select2.__super__.trigger;
5569
+ var preTriggerMap = {
5570
+ 'open': 'opening',
5571
+ 'close': 'closing',
5572
+ 'select': 'selecting',
5573
+ 'unselect': 'unselecting'
5574
+ };
5575
+
5576
+ if (args === undefined) {
5577
+ args = {};
5578
+ }
5579
+
5580
+ if (name in preTriggerMap) {
5581
+ var preTriggerName = preTriggerMap[name];
5582
+ var preTriggerArgs = {
5583
+ prevented: false,
5584
+ name: name,
5585
+ args: args
5586
+ };
5587
+
5588
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5589
+
5590
+ if (preTriggerArgs.prevented) {
5591
+ args.prevented = true;
5592
+
5593
+ return;
5594
+ }
5595
+ }
5596
+
5597
+ actualTrigger.call(this, name, args);
5598
+ };
5599
+
5600
+ Select2.prototype.toggleDropdown = function () {
5601
+ if (this.options.get('disabled')) {
5602
+ return;
5603
+ }
5604
+
5605
+ if (this.isOpen()) {
5606
+ this.close();
5607
+ } else {
5608
+ this.open();
5609
+ }
5610
+ };
5611
+
5612
+ Select2.prototype.open = function () {
5613
+ if (this.isOpen()) {
5614
+ return;
5615
+ }
5616
+
5617
+ this.trigger('query', {});
5618
+ };
5619
+
5620
+ Select2.prototype.close = function () {
5621
+ if (!this.isOpen()) {
5622
+ return;
5623
+ }
5624
+
5625
+ this.trigger('close', {});
5626
+ };
5627
+
5628
+ Select2.prototype.isOpen = function () {
5629
+ return this.$container.hasClass('select2-container--open');
5630
+ };
5631
+
5632
+ Select2.prototype.hasFocus = function () {
5633
+ return this.$container.hasClass('select2-container--focus');
5634
+ };
5635
+
5636
+ Select2.prototype.focus = function (data) {
5637
+ // No need to re-trigger focus events if we are already focused
5638
+ if (this.hasFocus()) {
5639
+ return;
5640
+ }
5641
+
5642
+ this.$container.addClass('select2-container--focus');
5643
+ this.trigger('focus', {});
5644
+ };
5645
+
5646
+ Select2.prototype.enable = function (args) {
5647
+ if (this.options.get('debug') && window.console && console.warn) {
5648
+ console.warn(
5649
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
5650
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5651
+ ' instead.'
5652
+ );
5653
+ }
5654
+
5655
+ if (args == null || args.length === 0) {
5656
+ args = [true];
5657
+ }
5658
+
5659
+ var disabled = !args[0];
5660
+
5661
+ this.$element.prop('disabled', disabled);
5662
+ };
5663
+
5664
+ Select2.prototype.data = function () {
5665
+ if (this.options.get('debug') &&
5666
+ arguments.length > 0 && window.console && console.warn) {
5667
+ console.warn(
5668
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
5669
+ 'should consider setting the value instead using `$element.val()`.'
5670
+ );
5671
+ }
5672
+
5673
+ var data = [];
5674
+
5675
+ this.dataAdapter.current(function (currentData) {
5676
+ data = currentData;
5677
+ });
5678
+
5679
+ return data;
5680
+ };
5681
+
5682
+ Select2.prototype.val = function (args) {
5683
+ if (this.options.get('debug') && window.console && console.warn) {
5684
+ console.warn(
5685
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
5686
+ ' removed in later Select2 versions. Use $element.val() instead.'
5687
+ );
5688
+ }
5689
+
5690
+ if (args == null || args.length === 0) {
5691
+ return this.$element.val();
5692
+ }
5693
+
5694
+ var newVal = args[0];
5695
+
5696
+ if ($.isArray(newVal)) {
5697
+ newVal = $.map(newVal, function (obj) {
5698
+ return obj.toString();
5699
+ });
5700
+ }
5701
+
5702
+ this.$element.val(newVal).trigger('change');
5703
+ };
5704
+
5705
+ Select2.prototype.destroy = function () {
5706
+ this.$container.remove();
5707
+
5708
+ if (this.$element[0].detachEvent) {
5709
+ this.$element[0].detachEvent('onpropertychange', this._syncA);
5710
+ }
5711
+
5712
+ if (this._observer != null) {
5713
+ this._observer.disconnect();
5714
+ this._observer = null;
5715
+ } else if (this.$element[0].removeEventListener) {
5716
+ this.$element[0]
5717
+ .removeEventListener('DOMAttrModified', this._syncA, false);
5718
+ this.$element[0]
5719
+ .removeEventListener('DOMNodeInserted', this._syncS, false);
5720
+ this.$element[0]
5721
+ .removeEventListener('DOMNodeRemoved', this._syncS, false);
5722
+ }
5723
+
5724
+ this._syncA = null;
5725
+ this._syncS = null;
5726
+
5727
+ this.$element.off('.select2');
5728
+ this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5729
+
5730
+ this.$element.removeClass('select2-hidden-accessible');
5731
+ this.$element.attr('aria-hidden', 'false');
5732
+ this.$element.removeData('select2');
5733
+
5734
+ this.dataAdapter.destroy();
5735
+ this.selection.destroy();
5736
+ this.dropdown.destroy();
5737
+ this.results.destroy();
5738
+
5739
+ this.dataAdapter = null;
5740
+ this.selection = null;
5741
+ this.dropdown = null;
5742
+ this.results = null;
5743
+ };
5744
+
5745
+ Select2.prototype.render = function () {
5746
+ var $container = $(
5747
+ '<span class="select2 select2-container">' +
5748
+ '<span class="selection"></span>' +
5749
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5750
+ '</span>'
5751
+ );
5752
+
5753
+ $container.attr('dir', this.options.get('dir'));
5754
+
5755
+ this.$container = $container;
5756
+
5757
+ this.$container.addClass('select2-container--' + this.options.get('theme'));
5758
+
5759
+ $container.data('element', this.$element);
5760
+
5761
+ return $container;
5762
+ };
5763
+
5764
+ return Select2;
5765
+ });
5766
+
5767
+ S2.define('jquery-mousewheel',[
5768
+ 'jquery'
5769
+ ], function ($) {
5770
+ // Used to shim jQuery.mousewheel for non-full builds.
5771
+ return $;
5772
+ });
5773
+
5774
+ S2.define('jquery.select2',[
5775
+ 'jquery',
5776
+ 'jquery-mousewheel',
5777
+
5778
+ './select2/core',
5779
+ './select2/defaults'
5780
+ ], function ($, _, Select2, Defaults) {
5781
+ if ($.fn.selectWoo == null) {
5782
+ // All methods that should return the element
5783
+ var thisMethods = ['open', 'close', 'destroy'];
5784
+
5785
+ $.fn.selectWoo = function (options) {
5786
+ options = options || {};
5787
+
5788
+ if (typeof options === 'object') {
5789
+ this.each(function () {
5790
+ var instanceOptions = $.extend(true, {}, options);
5791
+
5792
+ var instance = new Select2($(this), instanceOptions);
5793
+ });
5794
+
5795
+ return this;
5796
+ } else if (typeof options === 'string') {
5797
+ var ret;
5798
+ var args = Array.prototype.slice.call(arguments, 1);
5799
+
5800
+ this.each(function () {
5801
+ var instance = $(this).data('select2');
5802
+
5803
+ if (instance == null && window.console && console.error) {
5804
+ console.error(
5805
+ 'The select2(\'' + options + '\') method was called on an ' +
5806
+ 'element that is not using Select2.'
5807
+ );
5808
+ }
5809
+
5810
+ ret = instance[options].apply(instance, args);
5811
+ });
5812
+
5813
+ // Check if we should be returning `this`
5814
+ if ($.inArray(options, thisMethods) > -1) {
5815
+ return this;
5816
+ }
5817
+
5818
+ return ret;
5819
+ } else {
5820
+ throw new Error('Invalid arguments for Select2: ' + options);
5821
+ }
5822
+ };
5823
+ }
5824
+
5825
+ if ($.fn.select2 != null && $.fn.select2.defaults != null) {
5826
+ $.fn.selectWoo.defaults = $.fn.select2.defaults;
5827
+ }
5828
+
5829
+ if ($.fn.selectWoo.defaults == null) {
5830
+ $.fn.selectWoo.defaults = Defaults;
5831
+ }
5832
+
5833
+ // Also register selectWoo under select2 if select2 is not already present.
5834
+ $.fn.select2 = $.fn.select2 || $.fn.selectWoo;
5835
+
5836
+ return Select2;
5837
+ });
5838
+
5839
+ // Return the AMD loader configuration so it can be used outside of this file
5840
+ return {
5841
+ define: S2.define,
5842
+ require: S2.require
5843
+ };
5844
+ }());
5845
+
5846
+ // Autoload the jQuery bindings
5847
+ // We know that all of the modules exist above this, so we're safe
5848
+ var select2 = S2.require('jquery.select2');
5849
+
5850
+ // Hold the AMD module references on the jQuery function that was just loaded
5851
+ // This allows Select2 to use the internal loader outside of this file, such
5852
+ // as in the language files.
5853
+ jQuery.fn.select2.amd = S2;
5854
+ jQuery.fn.selectWoo.amd = S2;
5855
+
5856
+ // Return the Select2 instance for anyone who is importing it.
5857
+ return select2;
5858
+ }));
assets/js/selectWPUF/selectWPUF.min.js ADDED
@@ -0,0 +1 @@
 
1
+ /*! Select2 1.0.1 | 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.isTouchscreen=function(){return void 0===c._isTouchscreenCache&&(c._isTouchscreenCache="ontouchstart"in document.documentElement),c._isTouchscreenCache},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="listbox" tabindex="-1"></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="alert" 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[data-selected]"),b=a.filter("[data-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[data-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("data-selected","true"):b.attr("data-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:"option","data-selected":"false",tabindex:-1};b.disabled&&(delete d["data-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["data-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d["aria-label"]=b.text,delete d["data-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";var i=a(h);this.template(b,h),i.attr("role","presentation");for(var j=[],k=0;k<b.children.length;k++){var l=b.children[k],m=this.option(l);j.push(m)}var n=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"listbox"});n.append(j),g.attr("role","list"),g.append(h),g.append(n)}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("data-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[data-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("[data-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").attr("aria-selected","true"),d.$results.attr("aria-activedescendant",a.element.attr("id"))}),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[data-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("data-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[data-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),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("[data-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" 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.options.get("minimumResultsForSearch");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"),window.setTimeout(function(){d.$selection.focus()},1),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).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",d),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("keydown",function(b){!a.isOpen()&&b.which>=48&&b.which<=90&&a.open()}),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" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></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})}}),this.$selection.on("keydown",function(a){!b.isOpen()&&a.which>=48&&a.which<=90&&b.open()})},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" aria-hidden="true">&times;</span></li>')},d.prototype.update=function(a){var b=this;if(this.clear(),0!==a.length){for(var d=[],e=0;e<a.length;e++){var f=a[e],g=this.selectionContainer(),h=this.display(f,g).trim();g.append(h),g.prop("title",f.title||f.text),g.data("data",f),d.push(g)}var i=this.$selection.find(".select2-selection__rendered");c.appendMany(i,d),void 0!==this.$search&&setTimeout(function(){b.$search.focus()},1)}},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="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" 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,f=b.id+"-results";a.call(this,b,d),b.on("open",function(){e.$search.attr("aria-owns",f),e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),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.data._resultId)}),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 g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)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(h&&"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="";return d+=null!=b?b.id:a.generateChars(4),d+="-result-",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&&(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),e.container.focusOnActiveElement()},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="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this,f=c.id+"-results";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.attr("aria-owns",f),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),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.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.data._resultId)})},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="option" 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 b=this;this.on("open",function(){b.$container.addClass("select2-container--open")}),this.on("close",function(){b.$container.removeClass("select2-container--open")}),this.on("enable",function(){b.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){b.$container.addClass("select2-container--disabled")}),this.on("blur",function(){b.$container.removeClass("select2-container--focus")}),this.on("query",function(a){b.isOpen()||b.trigger("open",{}),this.dataAdapter.query(a,function(c){b.trigger("results:all",{data:c,query:a})})}),this.on("query:append",function(a){this.dataAdapter.query(a,function(c){b.trigger("results:append",{data:c,query:a})})}),this.on("open",function(){setTimeout(function(){b.focusOnActiveElement()},1)}),a(document).on("keydown",function(a){var c=a.which;if(b.isOpen()){c===d.ESC||c===d.TAB||c===d.UP&&a.altKey?(b.close(),a.preventDefault()):c===d.ENTER?(b.trigger("results:select",{}),a.preventDefault()):c===d.SPACE&&a.ctrlKey?(b.trigger("results:toggle",{}),a.preventDefault()):c===d.UP?(b.trigger("results:previous",{}),a.preventDefault()):c===d.DOWN&&(b.trigger("results:next",{}),a.preventDefault());var e=b.$dropdown.find(".select2-search__field");e.length||(e=b.$container.find(".select2-search__field")),c===d.DOWN||c===d.UP?b.focusOnActiveElement():(e.focus(),setTimeout(function(){b.focusOnActiveElement()},1e3)),e.on("keydown",function(a){a.which===d.ENTER&&(b.trigger("results:select",{}),a.preventDefault())})}else b.hasFocus()&&(c===d.ENTER||c===d.SPACE||c===d.DOWN&&a.altKey)&&(b.open(),a.preventDefault())})},e.prototype.focusOnActiveElement=function(){c.isTouchscreen()||this.$results.find("li.select2-results__option--highlighted").focus()},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.selectWoo){var e=["open","close","destroy"];a.fn.selectWoo=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&&null!=a.fn.select2.defaults&&(a.fn.selectWoo.defaults=a.fn.select2.defaults),null==a.fn.selectWoo.defaults&&(a.fn.selectWoo.defaults=d),a.fn.select2=a.fn.select2||a.fn.selectWoo,c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,a.fn.selectWoo.amd=b,c});
assets/js/wpuf-admin.js CHANGED
@@ -31,4 +31,26 @@ jQuery(function($) {
31
  hide_sub_sections();
32
  }
33
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  });
31
  hide_sub_sections();
32
  }
33
  });
34
+
35
+ // Collapsable email settings field
36
+ group = [
37
+ '.email-setting',
38
+ '.guest-email-setting',
39
+ '.reset-email-setting',
40
+ '.confirmation-email-setting',
41
+ '.subscription-setting',
42
+ '.admin-new-user-email',
43
+ '.pending-user-email',
44
+ '.denied-user-email',
45
+ '.approved-user-email'
46
+ ]
47
+ group.forEach(function(header, index) {
48
+ $(header).addClass("heading");
49
+ $(header+"-option").addClass("hide");
50
+
51
+ $("#wpuf_mails "+header).click(function() {
52
+ $(header+"-option").toggleClass("hide");
53
+ });
54
+ })
55
+
56
  });
assets/js/wpuf-form-builder-components.js CHANGED
@@ -1,6 +1,6 @@
1
  ;(function($) {
2
  'use strict';
3
-
4
  Vue.component('builder-stage', {
5
  template: '#tmpl-wpuf-builder-stage',
6
 
@@ -183,7 +183,7 @@ Vue.component('builder-stage', {
183
  }
184
  }
185
  });
186
-
187
  Vue.component('field-checkbox', {
188
  template: '#tmpl-wpuf-field-checkbox',
189
 
@@ -225,7 +225,7 @@ Vue.component('field-checkbox', {
225
  }
226
  }
227
  });
228
-
229
  Vue.component('field-html_help_text', {
230
  template: '#tmpl-wpuf-field-html_help_text',
231
 
@@ -233,7 +233,7 @@ Vue.component('field-html_help_text', {
233
  wpuf_mixins.option_field_mixin
234
  ],
235
  });
236
-
237
  /**
238
  * Common settings component for option based fields
239
  * like select, multiselect, checkbox, radio
@@ -351,7 +351,7 @@ Vue.component('field-option-data', {
351
  }
352
  }
353
  });
354
-
355
  Vue.component('field-option-pro-feature-alert', {
356
  template: '#tmpl-wpuf-field-option-pro-feature-alert',
357
 
@@ -365,7 +365,7 @@ Vue.component('field-option-pro-feature-alert', {
365
  }
366
  }
367
  });
368
-
369
  /**
370
  * Sidebar field options panel
371
  */
@@ -434,7 +434,7 @@ Vue.component('field-options', {
434
  }
435
  }
436
  });
437
-
438
  Vue.component('field-radio', {
439
  template: '#tmpl-wpuf-field-radio',
440
 
@@ -458,7 +458,7 @@ Vue.component('field-radio', {
458
  }
459
  }
460
  });
461
-
462
  Vue.component('field-select', {
463
  template: '#tmpl-wpuf-field-select',
464
 
@@ -482,7 +482,7 @@ Vue.component('field-select', {
482
  }
483
  }
484
  });
485
-
486
  Vue.component('field-text', {
487
  template: '#tmpl-wpuf-field-text',
488
 
@@ -511,7 +511,7 @@ Vue.component('field-text', {
511
  }
512
  }
513
  });
514
-
515
  Vue.component('field-text-meta', {
516
  template: '#tmpl-wpuf-field-text-meta',
517
 
@@ -552,7 +552,7 @@ Vue.component('field-text-meta', {
552
  }
553
  }
554
  });
555
-
556
  Vue.component('field-textarea', {
557
  template: '#tmpl-wpuf-field-textarea',
558
 
@@ -572,7 +572,7 @@ Vue.component('field-textarea', {
572
  }
573
  },
574
  });
575
-
576
  Vue.component('field-visibility', {
577
  template: '#tmpl-wpuf-field-visibility',
578
 
@@ -627,7 +627,7 @@ Vue.component('field-visibility', {
627
  watch: {
628
 
629
  }
630
- });
631
  /**
632
  * Field template: Checkbox
633
  */
@@ -638,7 +638,7 @@ Vue.component('form-checkbox_field', {
638
  wpuf_mixins.form_field_mixin
639
  ]
640
  });
641
-
642
  /**
643
  * Field template: Hidden
644
  */
@@ -649,7 +649,7 @@ Vue.component('form-custom_hidden_field', {
649
  wpuf_mixins.form_field_mixin
650
  ]
651
  });
652
-
653
  /**
654
  * Field template: Custom HTML
655
  */
@@ -666,7 +666,7 @@ Vue.component('form-custom_html', {
666
  };
667
  }
668
  });
669
-
670
  /**
671
  * Field template: Dropdown/Select
672
  */
@@ -677,7 +677,7 @@ Vue.component('form-dropdown_field', {
677
  wpuf_mixins.form_field_mixin
678
  ]
679
  });
680
-
681
  /**
682
  * Field template: Email
683
  */
@@ -688,7 +688,7 @@ Vue.component('form-email_address', {
688
  wpuf_mixins.form_field_mixin
689
  ]
690
  });
691
-
692
  /**
693
  * Field template: Featured Image
694
  */
@@ -699,7 +699,7 @@ Vue.component('form-featured_image', {
699
  wpuf_mixins.form_field_mixin
700
  ]
701
  });
702
-
703
  /**
704
  * Sidebar form fields panel
705
  */
@@ -816,7 +816,7 @@ Vue.component('form-fields', {
816
  }
817
  }
818
  });
819
-
820
  /**
821
  * Field template: Image Upload
822
  */
@@ -827,7 +827,7 @@ Vue.component('form-image_upload', {
827
  wpuf_mixins.form_field_mixin
828
  ]
829
  });
830
-
831
  /**
832
  * Field template: Multi-Select
833
  */
@@ -838,7 +838,7 @@ Vue.component('form-multiple_select', {
838
  wpuf_mixins.form_field_mixin
839
  ]
840
  });
841
-
842
  /**
843
  * Field Template: Post Content
844
  */
@@ -849,7 +849,7 @@ Vue.component('form-post_content', {
849
  wpuf_mixins.form_field_mixin
850
  ]
851
  });
852
-
853
  /**
854
  * Field Template: Post Excerpt
855
  */
@@ -860,7 +860,7 @@ Vue.component('form-post_excerpt', {
860
  wpuf_mixins.form_field_mixin
861
  ]
862
  });
863
-
864
  /**
865
  * Field template: post_tags
866
  */
@@ -871,7 +871,7 @@ Vue.component('form-post_tags', {
871
  wpuf_mixins.form_field_mixin
872
  ]
873
  });
874
-
875
  /**
876
  * Field template: Post Title
877
  */
@@ -882,7 +882,7 @@ Vue.component('form-post_title', {
882
  wpuf_mixins.form_field_mixin
883
  ]
884
  });
885
-
886
  /**
887
  * Field template: Radio
888
  */
@@ -893,7 +893,7 @@ Vue.component('form-radio_field', {
893
  wpuf_mixins.form_field_mixin
894
  ]
895
  });
896
-
897
  /**
898
  * Field template: Recaptcha
899
  */
@@ -914,7 +914,7 @@ Vue.component('form-recaptcha', {
914
  }
915
  }
916
  });
917
-
918
  /**
919
  * Field template: Section Break
920
  */
@@ -925,7 +925,7 @@ Vue.component('form-section_break', {
925
  wpuf_mixins.form_field_mixin
926
  ]
927
  });
928
-
929
  /**
930
  * Field template: taxonomy
931
  */
@@ -1024,6 +1024,8 @@ Vue.component('form-taxonomy', {
1024
  var self = this,
1025
  options = '';
1026
 
 
 
1027
  _.each(self.sorted_terms, function (term) {
1028
  options += self.get_term_dropdown_options_children(term, 0);
1029
  });
@@ -1086,10 +1088,44 @@ Vue.component('form-taxonomy', {
1086
  }
1087
 
1088
  return li;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
  }
1090
  }
1091
  });
 
 
 
1092
 
 
 
 
 
 
1093
  /**
1094
  * Field template: Text
1095
  */
@@ -1100,15 +1136,7 @@ Vue.component('form-text_field', {
1100
  wpuf_mixins.form_field_mixin
1101
  ]
1102
  });
1103
-
1104
- Vue.component('form-textarea_field', {
1105
- template: '#tmpl-wpuf-form-textarea_field',
1106
-
1107
- mixins: [
1108
- wpuf_mixins.form_field_mixin
1109
- ]
1110
- });
1111
-
1112
  /**
1113
  * Field template: Website URL
1114
  */
@@ -1119,7 +1147,7 @@ Vue.component('form-website_url', {
1119
  wpuf_mixins.form_field_mixin
1120
  ]
1121
  });
1122
-
1123
  Vue.component('help-text', {
1124
  template: '#tmpl-wpuf-help-text',
1125
 
@@ -1134,7 +1162,7 @@ Vue.component('help-text', {
1134
  $(".wpuf-tooltip").tooltip();
1135
  }
1136
  });
1137
-
1138
  Vue.component('text-editor', {
1139
  template: '#tmpl-wpuf-text-editor',
1140
 
@@ -1150,5 +1178,5 @@ Vue.component('text-editor', {
1150
  }
1151
  }
1152
  });
1153
-
1154
  })(jQuery);
1
  ;(function($) {
2
  'use strict';
3
+
4
  Vue.component('builder-stage', {
5
  template: '#tmpl-wpuf-builder-stage',
6
 
183
  }
184
  }
185
  });
186
+
187
  Vue.component('field-checkbox', {
188
  template: '#tmpl-wpuf-field-checkbox',
189
 
225
  }
226
  }
227
  });
228
+
229
  Vue.component('field-html_help_text', {
230
  template: '#tmpl-wpuf-field-html_help_text',
231
 
233
  wpuf_mixins.option_field_mixin
234
  ],
235
  });
236
+
237
  /**
238
  * Common settings component for option based fields
239
  * like select, multiselect, checkbox, radio
351
  }
352
  }
353
  });
354
+
355
  Vue.component('field-option-pro-feature-alert', {
356
  template: '#tmpl-wpuf-field-option-pro-feature-alert',
357
 
365
  }
366
  }
367
  });
368
+
369
  /**
370
  * Sidebar field options panel
371
  */
434
  }
435
  }
436
  });
437
+
438
  Vue.component('field-radio', {
439
  template: '#tmpl-wpuf-field-radio',
440
 
458
  }
459
  }
460
  });
461
+
462
  Vue.component('field-select', {
463
  template: '#tmpl-wpuf-field-select',
464
 
482
  }
483
  }
484
  });
485
+
486
  Vue.component('field-text', {
487
  template: '#tmpl-wpuf-field-text',
488
 
511
  }
512
  }
513
  });
514
+
515
  Vue.component('field-text-meta', {
516
  template: '#tmpl-wpuf-field-text-meta',
517
 
552
  }
553
  }
554
  });
555
+
556
  Vue.component('field-textarea', {
557
  template: '#tmpl-wpuf-field-textarea',
558
 
572
  }
573
  },
574
  });
575
+
576
  Vue.component('field-visibility', {
577
  template: '#tmpl-wpuf-field-visibility',
578
 
627
  watch: {
628
 
629
  }
630
+ });
631
  /**
632
  * Field template: Checkbox
633
  */
638
  wpuf_mixins.form_field_mixin
639
  ]
640
  });
641
+
642
  /**
643
  * Field template: Hidden
644
  */
649
  wpuf_mixins.form_field_mixin
650
  ]
651
  });
652
+
653
  /**
654
  * Field template: Custom HTML
655
  */
666
  };
667
  }
668
  });
669
+
670
  /**
671
  * Field template: Dropdown/Select
672
  */
677
  wpuf_mixins.form_field_mixin
678
  ]
679
  });
680
+
681
  /**
682
  * Field template: Email
683
  */
688
  wpuf_mixins.form_field_mixin
689
  ]
690
  });
691
+
692
  /**
693
  * Field template: Featured Image
694
  */
699
  wpuf_mixins.form_field_mixin
700
  ]
701
  });
702
+
703
  /**
704
  * Sidebar form fields panel
705
  */
816
  }
817
  }
818
  });
819
+
820
  /**
821
  * Field template: Image Upload
822
  */
827
  wpuf_mixins.form_field_mixin
828
  ]
829
  });
830
+
831
  /**
832
  * Field template: Multi-Select
833
  */
838
  wpuf_mixins.form_field_mixin
839
  ]
840
  });
841
+
842
  /**
843
  * Field Template: Post Content
844
  */
849
  wpuf_mixins.form_field_mixin
850
  ]
851
  });
852
+
853
  /**
854
  * Field Template: Post Excerpt
855
  */
860
  wpuf_mixins.form_field_mixin
861
  ]
862
  });
863
+
864
  /**
865
  * Field template: post_tags
866
  */
871
  wpuf_mixins.form_field_mixin
872
  ]
873
  });
874
+
875
  /**
876
  * Field template: Post Title
877
  */
882
  wpuf_mixins.form_field_mixin
883
  ]
884
  });
885
+
886
  /**
887
  * Field template: Radio
888
  */
893
  wpuf_mixins.form_field_mixin
894
  ]
895
  });
896
+
897
  /**
898
  * Field template: Recaptcha
899
  */
914
  }
915
  }
916
  });
917
+
918
  /**
919
  * Field template: Section Break
920
  */
925
  wpuf_mixins.form_field_mixin
926
  ]
927
  });
928
+
929
  /**
930
  * Field template: taxonomy
931
  */
1024
  var self = this,
1025
  options = '';
1026
 
1027
+ options = '<option value="">' + this.field.first + '</option>';
1028
+
1029
  _.each(self.sorted_terms, function (term) {
1030
  options += self.get_term_dropdown_options_children(term, 0);
1031
  });
1088
  }
1089
 
1090
  return li;
1091
+ },
1092
+
1093
+ get_term_checklist_inline: function () {
1094
+ var self = this,
1095
+ checklist = '';
1096
+
1097
+ _.each(this.sorted_terms, function (term) {
1098
+ checklist += self.get_term_checklist_li_inline(term);
1099
+ });
1100
+
1101
+ return checklist;
1102
+ },
1103
+
1104
+ get_term_checklist_li_inline: function (term) {
1105
+ var self = this,
1106
+ li_inline = '';
1107
+
1108
+ li_inline += '<label class="wpuf-checkbox-inline"><input type="checkbox"> ' + term.name + '</label>';
1109
+
1110
+ if (term.children.length) {
1111
+ _.each(term.children, function (child_term) {
1112
+ li_inline += self.get_term_checklist_li_inline(child_term);
1113
+ });
1114
+ }
1115
+
1116
+ return li_inline;
1117
  }
1118
  }
1119
  });
1120
+
1121
+ Vue.component('form-textarea_field', {
1122
+ template: '#tmpl-wpuf-form-textarea_field',
1123
 
1124
+ mixins: [
1125
+ wpuf_mixins.form_field_mixin
1126
+ ]
1127
+ });
1128
+
1129
  /**
1130
  * Field template: Text
1131
  */
1136
  wpuf_mixins.form_field_mixin
1137
  ]
1138
  });
1139
+
 
 
 
 
 
 
 
 
1140
  /**
1141
  * Field template: Website URL
1142
  */
1147
  wpuf_mixins.form_field_mixin
1148
  ]
1149
  });
1150
+
1151
  Vue.component('help-text', {
1152
  template: '#tmpl-wpuf-help-text',
1153
 
1162
  $(".wpuf-tooltip").tooltip();
1163
  }
1164
  });
1165
+
1166
  Vue.component('text-editor', {
1167
  template: '#tmpl-wpuf-text-editor',
1168
 
1178
  }
1179
  }
1180
  });
1181
+
1182
  })(jQuery);
assets/js/wpuf-form-builder-mixins.js CHANGED
@@ -1,6 +1,6 @@
1
  ;(function($) {
2
  'use strict';
3
-
4
  /**
5
  * Mixin for form fields like
6
  * form-text_field, form-field_textarea etc
@@ -54,7 +54,7 @@ wpuf_mixins.form_field_mixin = {
54
  }
55
  }
56
  };
57
-
58
  /**
59
  * Global mixin
60
  */
@@ -126,7 +126,7 @@ Vue.mixin({
126
  }
127
  }
128
  });
129
-
130
  /**
131
  * Integration mixin
132
  *
@@ -179,7 +179,7 @@ wpuf_mixins.integration_mixin = {
179
  }
180
  }
181
  };
182
-
183
  /**
184
  * Mixin for option fields like
185
  * field-text, field-text-meta, field-radio etc
@@ -237,5 +237,5 @@ wpuf_mixins.option_field_mixin = {
237
  },
238
  }
239
  };
240
-
241
  })(jQuery);
1
  ;(function($) {
2
  'use strict';
3
+
4
  /**
5
  * Mixin for form fields like
6
  * form-text_field, form-field_textarea etc
54
  }
55
  }
56
  };
57
+
58
  /**
59
  * Global mixin
60
  */
126
  }
127
  }
128
  });
129
+
130
  /**
131
  * Integration mixin
132
  *
179
  }
180
  }
181
  };
182
+
183
  /**
184
  * Mixin for option fields like
185
  * field-text, field-text-meta, field-radio etc
237
  },
238
  }
239
  };
240
+
241
  })(jQuery);
assets/less/admin.less CHANGED
@@ -293,6 +293,7 @@ span {
293
  .metabox-holder {
294
  flex: 3;
295
  margin-left: 30px;
 
296
 
297
  h2 {
298
  border-bottom: 1px solid #c8d7e1;
@@ -558,6 +559,82 @@ span {
558
  }
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  @import "help.less";
562
  @import "whats-new.less";
563
  @import "metabox-tabs.less";
293
  .metabox-holder {
294
  flex: 3;
295
  margin-left: 30px;
296
+ margin-bottom: 30px;
297
 
298
  h2 {
299
  border-bottom: 1px solid #c8d7e1;
559
  }
560
  }
561
 
562
+ #wpuf_mails{
563
+ table{
564
+ tbody{
565
+ tr{
566
+
567
+ &.hide{
568
+ display: none;
569
+ }
570
+
571
+ &.heading{
572
+ cursor: pointer;
573
+ background-color: #f1f1f1;
574
+ border: 1px solid #c8d7e1;
575
+
576
+ label{
577
+ font-size: 13px;
578
+ color: #444;
579
+ font-weight: 500;
580
+
581
+ span{
582
+ color: #0073aa;
583
+ padding-right: 6px;
584
+
585
+ &.dashicons-admin-generic{
586
+ color: #9b59b6;
587
+ }
588
+
589
+ &.dashicons-universal-access-alt{
590
+ color: #AD1457;
591
+ }
592
+
593
+ &.dashicons-unlock{
594
+ color: #9b59b6;
595
+ }
596
+
597
+ &.dashicons-email-alt{
598
+ color: #6c75ff;
599
+ }
600
+
601
+ &.dashicons-money{
602
+ color: #64DD17;
603
+ }
604
+
605
+ &.dashicons-admin-users{
606
+ color: #00aeff;
607
+ }
608
+
609
+ &.dashicons-groups{
610
+ color: #e67e22;
611
+ }
612
+
613
+ &.dashicons-dismiss{
614
+ color: #115da7;
615
+ }
616
+
617
+ &.dashicons-smiley{
618
+ color: #e74c3c;
619
+ }
620
+ }
621
+ }
622
+
623
+ th{
624
+ padding: 16px 10px 16px 30px;
625
+ }
626
+ }
627
+
628
+ th{
629
+ padding-left: 30px;
630
+ }
631
+
632
+ }
633
+ }
634
+
635
+ }
636
+ }
637
+
638
  @import "help.less";
639
  @import "whats-new.less";
640
  @import "metabox-tabs.less";
assets/vendor/vue-router/vue-router.js ADDED
@@ -0,0 +1,2631 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * vue-router v3.0.1
3
+ * (c) 2017 Evan You
4
+ * @license MIT
5
+ */
6
+ (function (global, factory) {
7
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
8
+ typeof define === 'function' && define.amd ? define(factory) :
9
+ (global.VueRouter = factory());
10
+ }(this, (function () { 'use strict';
11
+
12
+ /* */
13
+
14
+ function assert (condition, message) {
15
+ if (!condition) {
16
+ throw new Error(("[vue-router] " + message))
17
+ }
18
+ }
19
+
20
+ function warn (condition, message) {
21
+ if ("development" !== 'production' && !condition) {
22
+ typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
23
+ }
24
+ }
25
+
26
+ function isError (err) {
27
+ return Object.prototype.toString.call(err).indexOf('Error') > -1
28
+ }
29
+
30
+ var View = {
31
+ name: 'router-view',
32
+ functional: true,
33
+ props: {
34
+ name: {
35
+ type: String,
36
+ default: 'default'
37
+ }
38
+ },
39
+ render: function render (_, ref) {
40
+ var props = ref.props;
41
+ var children = ref.children;
42
+ var parent = ref.parent;
43
+ var data = ref.data;
44
+
45
+ data.routerView = true;
46
+
47
+ // directly use parent context's createElement() function
48
+ // so that components rendered by router-view can resolve named slots
49
+ var h = parent.$createElement;
50
+ var name = props.name;
51
+ var route = parent.$route;
52
+ var cache = parent._routerViewCache || (parent._routerViewCache = {});
53
+
54
+ // determine current view depth, also check to see if the tree
55
+ // has been toggled inactive but kept-alive.
56
+ var depth = 0;
57
+ var inactive = false;
58
+ while (parent && parent._routerRoot !== parent) {
59
+ if (parent.$vnode && parent.$vnode.data.routerView) {
60
+ depth++;
61
+ }
62
+ if (parent._inactive) {
63
+ inactive = true;
64
+ }
65
+ parent = parent.$parent;
66
+ }
67
+ data.routerViewDepth = depth;
68
+
69
+ // render previous view if the tree is inactive and kept-alive
70
+ if (inactive) {
71
+ return h(cache[name], data, children)
72
+ }
73
+
74
+ var matched = route.matched[depth];
75
+ // render empty node if no matched route
76
+ if (!matched) {
77
+ cache[name] = null;
78
+ return h()
79
+ }
80
+
81
+ var component = cache[name] = matched.components[name];
82
+
83
+ // attach instance registration hook
84
+ // this will be called in the instance's injected lifecycle hooks
85
+ data.registerRouteInstance = function (vm, val) {
86
+ // val could be undefined for unregistration
87
+ var current = matched.instances[name];
88
+ if (
89
+ (val && current !== vm) ||
90
+ (!val && current === vm)
91
+ ) {
92
+ matched.instances[name] = val;
93
+ }
94
+ }
95
+
96
+ // also register instance in prepatch hook
97
+ // in case the same component instance is reused across different routes
98
+ ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
99
+ matched.instances[name] = vnode.componentInstance;
100
+ };
101
+
102
+ // resolve props
103
+ var propsToPass = data.props = resolveProps(route, matched.props && matched.props[name]);
104
+ if (propsToPass) {
105
+ // clone to prevent mutation
106
+ propsToPass = data.props = extend({}, propsToPass);
107
+ // pass non-declared props as attrs
108
+ var attrs = data.attrs = data.attrs || {};
109
+ for (var key in propsToPass) {
110
+ if (!component.props || !(key in component.props)) {
111
+ attrs[key] = propsToPass[key];
112
+ delete propsToPass[key];
113
+ }
114
+ }
115
+ }
116
+
117
+ return h(component, data, children)
118
+ }
119
+ };
120
+
121
+ function resolveProps (route, config) {
122
+ switch (typeof config) {
123
+ case 'undefined':
124
+ return
125
+ case 'object':
126
+ return config
127
+ case 'function':
128
+ return config(route)
129
+ case 'boolean':
130
+ return config ? route.params : undefined
131
+ default:
132
+ {
133
+ warn(
134
+ false,
135
+ "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
136
+ "expecting an object, function or boolean."
137
+ );
138
+ }
139
+ }
140
+ }
141
+
142
+ function extend (to, from) {
143
+ for (var key in from) {
144
+ to[key] = from[key];
145
+ }
146
+ return to
147
+ }
148
+
149
+ /* */
150
+
151
+ var encodeReserveRE = /[!'()*]/g;
152
+ var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
153
+ var commaRE = /%2C/g;
154
+
155
+ // fixed encodeURIComponent which is more conformant to RFC3986:
156
+ // - escapes [!'()*]
157
+ // - preserve commas
158
+ var encode = function (str) { return encodeURIComponent(str)
159
+ .replace(encodeReserveRE, encodeReserveReplacer)
160
+ .replace(commaRE, ','); };
161
+
162
+ var decode = decodeURIComponent;
163
+
164
+ function resolveQuery (
165
+ query,
166
+ extraQuery,
167
+ _parseQuery
168
+ ) {
169
+ if ( extraQuery === void 0 ) extraQuery = {};
170
+
171
+ var parse = _parseQuery || parseQuery;
172
+ var parsedQuery;
173
+ try {
174
+ parsedQuery = parse(query || '');
175
+ } catch (e) {
176
+ "development" !== 'production' && warn(false, e.message);
177
+ parsedQuery = {};
178
+ }
179
+ for (var key in extraQuery) {
180
+ parsedQuery[key] = extraQuery[key];
181
+ }
182
+ return parsedQuery
183
+ }
184
+
185
+ function parseQuery (query) {
186
+ var res = {};
187
+
188
+ query = query.trim().replace(/^(\?|#|&)/, '');
189
+
190
+ if (!query) {
191
+ return res
192
+ }
193
+
194
+ query.split('&').forEach(function (param) {
195
+ var parts = param.replace(/\+/g, ' ').split('=');
196
+ var key = decode(parts.shift());
197
+ var val = parts.length > 0
198
+ ? decode(parts.join('='))
199
+ : null;
200
+
201
+ if (res[key] === undefined) {
202
+ res[key] = val;
203
+ } else if (Array.isArray(res[key])) {
204
+ res[key].push(val);
205
+ } else {
206
+ res[key] = [res[key], val];
207
+ }
208
+ });
209
+
210
+ return res
211
+ }
212
+
213
+ function stringifyQuery (obj) {
214
+ var res = obj ? Object.keys(obj).map(function (key) {
215
+ var val = obj[key];
216
+
217
+ if (val === undefined) {
218
+ return ''
219
+ }
220
+
221
+ if (val === null) {
222
+ return encode(key)
223
+ }
224
+
225
+ if (Array.isArray(val)) {
226
+ var result = [];
227
+ val.forEach(function (val2) {
228
+ if (val2 === undefined) {
229
+ return
230
+ }
231
+ if (val2 === null) {
232
+ result.push(encode(key));
233
+ } else {
234
+ result.push(encode(key) + '=' + encode(val2));
235
+ }
236
+ });
237
+ return result.join('&')
238
+ }
239
+
240
+ return encode(key) + '=' + encode(val)
241
+ }).filter(function (x) { return x.length > 0; }).join('&') : null;
242
+ return res ? ("?" + res) : ''
243
+ }
244
+
245
+ /* */
246
+
247
+
248
+ var trailingSlashRE = /\/?$/;
249
+
250
+ function createRoute (
251
+ record,
252
+ location,
253
+ redirectedFrom,
254
+ router
255
+ ) {
256
+ var stringifyQuery$$1 = router && router.options.stringifyQuery;
257
+
258
+ var query = location.query || {};
259
+ try {
260
+ query = clone(query);
261
+ } catch (e) {}
262
+
263
+ var route = {
264
+ name: location.name || (record && record.name),
265
+ meta: (record && record.meta) || {},
266
+ path: location.path || '/',
267
+ hash: location.hash || '',
268
+ query: query,
269
+ params: location.params || {},
270
+ fullPath: getFullPath(location, stringifyQuery$$1),
271
+ matched: record ? formatMatch(record) : []
272
+ };
273
+ if (redirectedFrom) {
274
+ route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery$$1);
275
+ }
276
+ return Object.freeze(route)
277
+ }
278
+
279
+ function clone (value) {
280
+ if (Array.isArray(value)) {
281
+ return value.map(clone)
282
+ } else if (value && typeof value === 'object') {
283
+ var res = {};
284
+ for (var key in value) {
285
+ res[key] = clone(value[key]);
286
+ }
287
+ return res
288
+ } else {
289
+ return value
290
+ }
291
+ }
292
+
293
+ // the starting route that represents the initial state
294
+ var START = createRoute(null, {
295
+ path: '/'
296
+ });
297
+
298
+ function formatMatch (record) {
299
+ var res = [];
300
+ while (record) {
301
+ res.unshift(record);
302
+ record = record.parent;
303
+ }
304
+ return res
305
+ }
306
+
307
+ function getFullPath (
308
+ ref,
309
+ _stringifyQuery
310
+ ) {
311
+ var path = ref.path;
312
+ var query = ref.query; if ( query === void 0 ) query = {};
313
+ var hash = ref.hash; if ( hash === void 0 ) hash = '';
314
+
315
+ var stringify = _stringifyQuery || stringifyQuery;
316
+ return (path || '/') + stringify(query) + hash
317
+ }
318
+
319
+ function isSameRoute (a, b) {
320
+ if (b === START) {
321
+ return a === b
322
+ } else if (!b) {
323
+ return false
324
+ } else if (a.path && b.path) {
325
+ return (
326
+ a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
327
+ a.hash === b.hash &&
328
+ isObjectEqual(a.query, b.query)
329
+ )
330
+ } else if (a.name && b.name) {
331
+ return (
332
+ a.name === b.name &&
333
+ a.hash === b.hash &&
334
+ isObjectEqual(a.query, b.query) &&
335
+ isObjectEqual(a.params, b.params)
336
+ )
337
+ } else {
338
+ return false
339
+ }
340
+ }
341
+
342
+ function isObjectEqual (a, b) {
343
+ if ( a === void 0 ) a = {};
344
+ if ( b === void 0 ) b = {};
345
+
346
+ // handle null value #1566
347
+ if (!a || !b) { return a === b }
348
+ var aKeys = Object.keys(a);
349
+ var bKeys = Object.keys(b);
350
+ if (aKeys.length !== bKeys.length) {
351
+ return false
352
+ }
353
+ return aKeys.every(function (key) {
354
+ var aVal = a[key];
355
+ var bVal = b[key];
356
+ // check nested equality
357
+ if (typeof aVal === 'object' && typeof bVal === 'object') {
358
+ return isObjectEqual(aVal, bVal)
359
+ }
360
+ return String(aVal) === String(bVal)
361
+ })
362
+ }
363
+
364
+ function isIncludedRoute (current, target) {
365
+ return (
366
+ current.path.replace(trailingSlashRE, '/').indexOf(
367
+ target.path.replace(trailingSlashRE, '/')
368
+ ) === 0 &&
369
+ (!target.hash || current.hash === target.hash) &&
370
+ queryIncludes(current.query, target.query)
371
+ )
372
+ }
373
+
374
+ function queryIncludes (current, target) {
375
+ for (var key in target) {
376
+ if (!(key in current)) {
377
+ return false
378
+ }
379
+ }
380
+ return true
381
+ }
382
+
383
+ /* */
384
+
385
+ // work around weird flow bug
386
+ var toTypes = [String, Object];
387
+ var eventTypes = [String, Array];
388
+
389
+ var Link = {
390
+ name: 'router-link',
391
+ props: {
392
+ to: {
393
+ type: toTypes,
394
+ required: true
395
+ },
396
+ tag: {
397
+ type: String,
398
+ default: 'a'
399
+ },
400
+ exact: Boolean,
401
+ append: Boolean,
402
+ replace: Boolean,
403
+ activeClass: String,
404
+ exactActiveClass: String,
405
+ event: {
406
+ type: eventTypes,
407
+ default: 'click'
408
+ }
409
+ },
410
+ render: function render (h) {
411
+ var this$1 = this;
412
+
413
+ var router = this.$router;
414
+ var current = this.$route;
415
+ var ref = router.resolve(this.to, current, this.append);
416
+ var location = ref.location;
417
+ var route = ref.route;
418
+ var href = ref.href;
419
+
420
+ var classes = {};
421
+ var globalActiveClass = router.options.linkActiveClass;
422
+ var globalExactActiveClass = router.options.linkExactActiveClass;
423
+ // Support global empty active class
424
+ var activeClassFallback = globalActiveClass == null
425
+ ? 'router-link-active'
426
+ : globalActiveClass;
427
+ var exactActiveClassFallback = globalExactActiveClass == null
428
+ ? 'router-link-exact-active'
429
+ : globalExactActiveClass;
430
+ var activeClass = this.activeClass == null
431
+ ? activeClassFallback
432
+ : this.activeClass;
433
+ var exactActiveClass = this.exactActiveClass == null
434
+ ? exactActiveClassFallback
435
+ : this.exactActiveClass;
436
+ var compareTarget = location.path
437
+ ? createRoute(null, location, null, router)
438
+ : route;
439
+
440
+ classes[exactActiveClass] = isSameRoute(current, compareTarget);
441
+ classes[activeClass] = this.exact
442
+ ? classes[exactActiveClass]
443
+ : isIncludedRoute(current, compareTarget);
444
+
445
+ var handler = function (e) {
446
+ if (guardEvent(e)) {
447
+ if (this$1.replace) {
448
+ router.replace(location);
449
+ } else {
450
+ router.push(location);
451
+ }
452
+ }
453
+ };
454
+
455
+ var on = { click: guardEvent };
456
+ if (Array.isArray(this.event)) {
457
+ this.event.forEach(function (e) { on[e] = handler; });
458
+ } else {
459
+ on[this.event] = handler;
460
+ }
461
+
462
+ var data = {
463
+ class: classes
464
+ };
465
+
466
+ if (this.tag === 'a') {
467
+ data.on = on;
468
+ data.attrs = { href: href };
469
+ } else {
470
+ // find the first <a> child and apply listener and href
471
+ var a = findAnchor(this.$slots.default);
472
+ if (a) {
473
+ // in case the <a> is a static node
474
+ a.isStatic = false;
475
+ var extend = _Vue.util.extend;
476
+ var aData = a.data = extend({}, a.data);
477
+ aData.on = on;
478
+ var aAttrs = a.data.attrs = extend({}, a.data.attrs);
479
+ aAttrs.href = href;
480
+ } else {
481
+ // doesn't have <a> child, apply listener to self
482
+ data.on = on;
483
+ }
484
+ }
485
+
486
+ return h(this.tag, data, this.$slots.default)
487
+ }
488
+ };
489
+
490
+ function guardEvent (e) {
491
+ // don't redirect with control keys
492
+ if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
493
+ // don't redirect when preventDefault called
494
+ if (e.defaultPrevented) { return }
495
+ // don't redirect on right click
496
+ if (e.button !== undefined && e.button !== 0) { return }
497
+ // don't redirect if `target="_blank"`
498
+ if (e.currentTarget && e.currentTarget.getAttribute) {
499
+ var target = e.currentTarget.getAttribute('target');
500
+ if (/\b_blank\b/i.test(target)) { return }
501
+ }
502
+ // this may be a Weex event which doesn't have this method
503
+ if (e.preventDefault) {
504
+ e.preventDefault();
505
+ }
506
+ return true
507
+ }
508
+
509
+ function findAnchor (children) {
510
+ if (children) {
511
+ var child;
512
+ for (var i = 0; i < children.length; i++) {
513
+ child = children[i];
514
+ if (child.tag === 'a') {
515
+ return child
516
+ }
517
+ if (child.children && (child = findAnchor(child.children))) {
518
+ return child
519
+ }
520
+ }
521
+ }
522
+ }
523
+
524
+ var _Vue;
525
+
526
+ function install (Vue) {
527
+ if (install.installed && _Vue === Vue) { return }
528
+ install.installed = true;
529
+
530
+ _Vue = Vue;
531
+
532
+ var isDef = function (v) { return v !== undefined; };
533
+
534
+ var registerInstance = function (vm, callVal) {
535
+ var i = vm.$options._parentVnode;
536
+ if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
537
+ i(vm, callVal);
538
+ }
539
+ };
540
+
541
+ Vue.mixin({
542
+ beforeCreate: function beforeCreate () {
543
+ if (isDef(this.$options.router)) {
544
+ this._routerRoot = this;
545
+ this._router = this.$options.router;
546
+ this._router.init(this);
547
+ Vue.util.defineReactive(this, '_route', this._router.history.current);
548
+ } else {
549
+ this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
550
+ }
551
+ registerInstance(this, this);
552
+ },
553
+ destroyed: function destroyed () {
554
+ registerInstance(this);
555
+ }
556
+ });
557
+
558
+ Object.defineProperty(Vue.prototype, '$router', {
559
+ get: function get () { return this._routerRoot._router }
560
+ });
561
+
562
+ Object.defineProperty(Vue.prototype, '$route', {
563
+ get: function get () { return this._routerRoot._route }
564
+ });
565
+
566
+ Vue.component('router-view', View);
567
+ Vue.component('router-link', Link);
568
+
569
+ var strats = Vue.config.optionMergeStrategies;
570
+ // use the same hook merging strategy for route hooks
571
+ strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
572
+ }
573
+
574
+ /* */
575
+
576
+ var inBrowser = typeof window !== 'undefined';
577
+
578
+ /* */
579
+
580
+ function resolvePath (
581
+ relative,
582
+ base,
583
+ append
584
+ ) {
585
+ var firstChar = relative.charAt(0);
586
+ if (firstChar === '/') {
587
+ return relative
588
+ }
589
+
590
+ if (firstChar === '?' || firstChar === '#') {
591
+ return base + relative
592
+ }
593
+
594
+ var stack = base.split('/');
595
+
596
+ // remove trailing segment if:
597
+ // - not appending
598
+ // - appending to trailing slash (last segment is empty)
599
+ if (!append || !stack[stack.length - 1]) {
600
+ stack.pop();
601
+ }
602
+
603
+ // resolve relative path
604
+ var segments = relative.replace(/^\//, '').split('/');
605
+ for (var i = 0; i < segments.length; i++) {
606
+ var segment = segments[i];
607
+ if (segment === '..') {
608
+ stack.pop();
609
+ } else if (segment !== '.') {
610
+ stack.push(segment);
611
+ }
612
+ }
613
+
614
+ // ensure leading slash
615
+ if (stack[0] !== '') {
616
+ stack.unshift('');
617
+ }
618
+
619
+ return stack.join('/')
620
+ }
621
+
622
+ function parsePath (path) {
623
+ var hash = '';
624
+ var query = '';
625
+
626
+ var hashIndex = path.indexOf('#');
627
+ if (hashIndex >= 0) {
628
+ hash = path.slice(hashIndex);
629
+ path = path.slice(0, hashIndex);
630
+ }
631
+
632
+ var queryIndex = path.indexOf('?');
633
+ if (queryIndex >= 0) {
634
+ query = path.slice(queryIndex + 1);
635
+ path = path.slice(0, queryIndex);
636
+ }
637
+
638
+ return {
639
+ path: path,
640
+ query: query,
641
+ hash: hash
642
+ }
643
+ }
644
+
645
+ function cleanPath (path) {
646
+ return path.replace(/\/\//g, '/')
647
+ }
648
+
649
+ var isarray = Array.isArray || function (arr) {
650
+ return Object.prototype.toString.call(arr) == '[object Array]';
651
+ };
652
+
653
+ /**
654
+ * Expose `pathToRegexp`.
655
+ */
656
+ var pathToRegexp_1 = pathToRegexp;
657
+ var parse_1 = parse;
658
+ var compile_1 = compile;
659
+ var tokensToFunction_1 = tokensToFunction;
660
+ var tokensToRegExp_1 = tokensToRegExp;
661
+
662
+ /**
663
+ * The main path matching regexp utility.
664
+ *
665
+ * @type {RegExp}
666
+ */
667
+ var PATH_REGEXP = new RegExp([
668
+ // Match escaped characters that would otherwise appear in future matches.
669
+ // This allows the user to escape special characters that won't transform.
670
+ '(\\\\.)',
671
+ // Match Express-style parameters and un-named parameters with a prefix
672
+ // and optional suffixes. Matches appear as:
673
+ //
674
+ // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
675
+ // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
676
+ // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
677
+ '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
678
+ ].join('|'), 'g');
679
+
680
+ /**
681
+ * Parse a string for the raw tokens.
682
+ *
683
+ * @param {string} str
684
+ * @param {Object=} options
685
+ * @return {!Array}
686
+ */
687
+ function parse (str, options) {
688
+ var tokens = [];
689
+ var key = 0;
690
+ var index = 0;
691
+ var path = '';
692
+ var defaultDelimiter = options && options.delimiter || '/';
693
+ var res;
694
+
695
+ while ((res = PATH_REGEXP.exec(str)) != null) {
696
+ var m = res[0];
697
+ var escaped = res[1];
698
+ var offset = res.index;
699
+ path += str.slice(index, offset);
700
+ index = offset + m.length;
701
+
702
+ // Ignore already escaped sequences.
703
+ if (escaped) {
704
+ path += escaped[1];
705
+ continue
706
+ }
707
+
708
+ var next = str[index];
709
+ var prefix = res[2];
710
+ var name = res[3];
711
+ var capture = res[4];
712
+ var group = res[5];
713
+ var modifier = res[6];
714
+ var asterisk = res[7];
715
+
716
+ // Push the current path onto the tokens.
717
+ if (path) {
718
+ tokens.push(path);
719
+ path = '';
720
+ }
721
+
722
+ var partial = prefix != null && next != null && next !== prefix;
723
+ var repeat = modifier === '+' || modifier === '*';
724
+ var optional = modifier === '?' || modifier === '*';
725
+ var delimiter = res[2] || defaultDelimiter;
726
+ var pattern = capture || group;
727
+
728
+ tokens.push({
729
+ name: name || key++,
730
+ prefix: prefix || '',
731
+ delimiter: delimiter,
732
+ optional: optional,
733
+ repeat: repeat,
734
+ partial: partial,
735
+ asterisk: !!asterisk,
736
+ pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
737
+ });
738
+ }
739
+
740
+ // Match any characters still remaining.
741
+ if (index < str.length) {
742
+ path += str.substr(index);
743
+ }
744
+
745
+ // If the path exists, push it onto the end.
746
+ if (path) {
747
+ tokens.push(path);
748
+ }
749
+
750
+ return tokens
751
+ }
752
+
753
+ /**
754
+ * Compile a string to a template function for the path.
755
+ *
756
+ * @param {string} str
757
+ * @param {Object=} options
758
+ * @return {!function(Object=, Object=)}
759
+ */
760
+ function compile (str, options) {
761
+ return tokensToFunction(parse(str, options))
762
+ }
763
+
764
+ /**
765
+ * Prettier encoding of URI path segments.
766
+ *
767
+ * @param {string}
768
+ * @return {string}
769
+ */
770
+ function encodeURIComponentPretty (str) {
771
+ return encodeURI(str).replace(/[\/?#]/g, function (c) {
772
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
773
+ })
774
+ }
775
+
776
+ /**
777
+ * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
778
+ *
779
+ * @param {string}
780
+ * @return {string}
781
+ */
782
+ function encodeAsterisk (str) {
783
+ return encodeURI(str).replace(/[?#]/g, function (c) {
784
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
785
+ })
786
+ }
787
+
788
+ /**
789
+ * Expose a method for transforming tokens into the path function.
790
+ */
791
+ function tokensToFunction (tokens) {
792
+ // Compile all the tokens into regexps.
793
+ var matches = new Array(tokens.length);
794
+
795
+ // Compile all the patterns before compilation.
796
+ for (var i = 0; i < tokens.length; i++) {
797
+ if (typeof tokens[i] === 'object') {
798
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
799
+ }
800
+ }
801
+
802
+ return function (obj, opts) {
803
+ var path = '';
804
+ var data = obj || {};
805
+ var options = opts || {};
806
+ var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
807
+
808
+ for (var i = 0; i < tokens.length; i++) {
809
+ var token = tokens[i];
810
+
811
+ if (typeof token === 'string') {
812
+ path += token;
813
+
814
+ continue
815
+ }
816
+
817
+ var value = data[token.name];
818
+ var segment;
819
+
820
+ if (value == null) {
821
+ if (token.optional) {
822
+ // Prepend partial segment prefixes.
823
+ if (token.partial) {
824
+ path += token.prefix;
825
+ }
826
+
827
+ continue
828
+ } else {
829
+ throw new TypeError('Expected "' + token.name + '" to be defined')
830
+ }
831
+ }
832
+
833
+ if (isarray(value)) {
834
+ if (!token.repeat) {
835
+ throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
836
+ }
837
+
838
+ if (value.length === 0) {
839
+ if (token.optional) {
840
+ continue
841
+ } else {
842
+ throw new TypeError('Expected "' + token.name + '" to not be empty')
843
+ }
844
+ }
845
+
846
+ for (var j = 0; j < value.length; j++) {
847
+ segment = encode(value[j]);
848
+
849
+ if (!matches[i].test(segment)) {
850
+ throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
851
+ }
852
+
853
+ path += (j === 0 ? token.prefix : token.delimiter) + segment;
854
+ }
855
+
856
+ continue
857
+ }
858
+
859
+ segment = token.asterisk ? encodeAsterisk(value) : encode(value);
860
+
861
+ if (!matches[i].test(segment)) {
862
+ throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
863
+ }
864
+
865
+ path += token.prefix + segment;
866
+ }
867
+
868
+ return path
869
+ }
870
+ }
871
+
872
+ /**
873
+ * Escape a regular expression string.
874
+ *
875
+ * @param {string} str
876
+ * @return {string}
877
+ */
878
+ function escapeString (str) {
879
+ return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
880
+ }
881
+
882
+ /**
883
+ * Escape the capturing group by escaping special characters and meaning.
884
+ *
885
+ * @param {string} group
886
+ * @return {string}
887
+ */
888
+ function escapeGroup (group) {
889
+ return group.replace(/([=!:$\/()])/g, '\\$1')
890
+ }
891
+
892
+ /**
893
+ * Attach the keys as a property of the regexp.
894
+ *
895
+ * @param {!RegExp} re
896
+ * @param {Array} keys
897
+ * @return {!RegExp}
898
+ */
899
+ function attachKeys (re, keys) {
900
+ re.keys = keys;
901
+ return re
902
+ }
903
+
904
+ /**
905
+ * Get the flags for a regexp from the options.
906
+ *
907
+ * @param {Object} options
908
+ * @return {string}
909
+ */
910
+ function flags (options) {
911
+ return options.sensitive ? '' : 'i'
912
+ }
913
+
914
+ /**
915
+ * Pull out keys from a regexp.
916
+ *
917
+ * @param {!RegExp} path
918
+ * @param {!Array} keys
919
+ * @return {!RegExp}
920
+ */
921
+ function regexpToRegexp (path, keys) {
922
+ // Use a negative lookahead to match only capturing groups.
923
+ var groups = path.source.match(/\((?!\?)/g);
924
+
925
+ if (groups) {
926
+ for (var i = 0; i < groups.length; i++) {
927
+ keys.push({
928
+ name: i,
929
+ prefix: null,
930
+ delimiter: null,
931
+ optional: false,
932
+ repeat: false,
933
+ partial: false,
934
+ asterisk: false,
935
+ pattern: null
936
+ });
937
+ }
938
+ }
939
+
940
+ return attachKeys(path, keys)
941
+ }
942
+
943
+ /**
944
+ * Transform an array into a regexp.
945
+ *
946
+ * @param {!Array} path
947
+ * @param {Array} keys
948
+ * @param {!Object} options
949
+ * @return {!RegExp}
950
+ */
951
+ function arrayToRegexp (path, keys, options) {
952
+ var parts = [];
953
+
954
+ for (var i = 0; i < path.length; i++) {
955
+ parts.push(pathToRegexp(path[i], keys, options).source);
956
+ }
957
+
958
+ var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
959
+
960
+ return attachKeys(regexp, keys)
961
+ }
962
+
963
+ /**
964
+ * Create a path regexp from string input.
965
+ *
966
+ * @param {string} path
967
+ * @param {!Array} keys
968
+ * @param {!Object} options
969
+ * @return {!RegExp}
970
+ */
971
+ function stringToRegexp (path, keys, options) {
972
+ return tokensToRegExp(parse(path, options), keys, options)
973
+ }
974
+
975
+ /**
976
+ * Expose a function for taking tokens and returning a RegExp.
977
+ *
978
+ * @param {!Array} tokens
979
+ * @param {(Array|Object)=} keys
980
+ * @param {Object=} options
981
+ * @return {!RegExp}
982
+ */
983
+ function tokensToRegExp (tokens, keys, options) {
984
+ if (!isarray(keys)) {
985
+ options = /** @type {!Object} */ (keys || options);
986
+ keys = [];
987
+ }
988
+
989
+ options = options || {};
990
+
991
+ var strict = options.strict;
992
+ var end = options.end !== false;
993
+ var route = '';
994
+
995
+ // Iterate over the tokens and create our regexp string.
996
+ for (var i = 0; i < tokens.length; i++) {
997
+ var token = tokens[i];
998
+
999
+ if (typeof token === 'string') {
1000
+ route += escapeString(token);
1001
+ } else {
1002
+ var prefix = escapeString(token.prefix);
1003
+ var capture = '(?:' + token.pattern + ')';
1004
+
1005
+ keys.push(token);
1006
+
1007
+ if (token.repeat) {
1008
+ capture += '(?:' + prefix + capture + ')*';
1009
+ }
1010
+
1011
+ if (token.optional) {
1012
+ if (!token.partial) {
1013
+ capture = '(?:' + prefix + '(' + capture + '))?';
1014
+ } else {
1015
+ capture = prefix + '(' + capture + ')?';
1016
+ }
1017
+ } else {
1018
+ capture = prefix + '(' + capture + ')';
1019
+ }
1020
+
1021
+ route += capture;
1022
+ }
1023
+ }
1024
+
1025
+ var delimiter = escapeString(options.delimiter || '/');
1026
+ var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
1027
+
1028
+ // In non-strict mode we allow a slash at the end of match. If the path to
1029
+ // match already ends with a slash, we remove it for consistency. The slash
1030
+ // is valid at the end of a path match, not in the middle. This is important
1031
+ // in non-ending mode, where "/test/" shouldn't match "/test//route".
1032
+ if (!strict) {
1033
+ route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
1034
+ }
1035
+
1036
+ if (end) {
1037
+ route += '$';
1038
+ } else {
1039
+ // In non-ending mode, we need the capturing groups to match as much as
1040
+ // possible by using a positive lookahead to the end or next path segment.
1041
+ route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
1042
+ }
1043
+
1044
+ return attachKeys(new RegExp('^' + route, flags(options)), keys)
1045
+ }
1046
+
1047
+ /**
1048
+ * Normalize the given path string, returning a regular expression.
1049
+ *
1050
+ * An empty array can be passed in for the keys, which will hold the
1051
+ * placeholder key descriptions. For example, using `/user/:id`, `keys` will
1052
+ * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
1053
+ *
1054
+ * @param {(string|RegExp|Array)} path
1055
+ * @param {(Array|Object)=} keys
1056
+ * @param {Object=} options
1057
+ * @return {!RegExp}
1058
+ */
1059
+ function pathToRegexp (path, keys, options) {
1060
+ if (!isarray(keys)) {
1061
+ options = /** @type {!Object} */ (keys || options);
1062
+ keys = [];
1063
+ }
1064
+
1065
+ options = options || {};
1066
+
1067
+ if (path instanceof RegExp) {
1068
+ return regexpToRegexp(path, /** @type {!Array} */ (keys))
1069
+ }
1070
+
1071
+ if (isarray(path)) {
1072
+ return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
1073
+ }
1074
+
1075
+ return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
1076
+ }
1077
+
1078
+ pathToRegexp_1.parse = parse_1;
1079
+ pathToRegexp_1.compile = compile_1;
1080
+ pathToRegexp_1.tokensToFunction = tokensToFunction_1;
1081
+ pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
1082
+
1083
+ /* */
1084
+
1085
+ // $flow-disable-line
1086
+ var regexpCompileCache = Object.create(null);
1087
+
1088
+ function fillParams (
1089
+ path,
1090
+ params,
1091
+ routeMsg
1092
+ ) {
1093
+ try {
1094
+ var filler =
1095
+ regexpCompileCache[path] ||
1096
+ (regexpCompileCache[path] = pathToRegexp_1.compile(path));
1097
+ return filler(params || {}, { pretty: true })
1098
+ } catch (e) {
1099
+ {
1100
+ warn(false, ("missing param for " + routeMsg + ": " + (e.message)));
1101
+ }
1102
+ return ''
1103
+ }
1104
+ }
1105
+
1106
+ /* */
1107
+
1108
+ function createRouteMap (
1109
+ routes,
1110
+ oldPathList,
1111
+ oldPathMap,
1112
+ oldNameMap
1113
+ ) {
1114
+ // the path list is used to control path matching priority
1115
+ var pathList = oldPathList || [];
1116
+ // $flow-disable-line
1117
+ var pathMap = oldPathMap || Object.create(null);
1118
+ // $flow-disable-line
1119
+ var nameMap = oldNameMap || Object.create(null);
1120
+
1121
+ routes.forEach(function (route) {
1122
+ addRouteRecord(pathList, pathMap, nameMap, route);
1123
+ });
1124
+
1125
+ // ensure wildcard routes are always at the end
1126
+ for (var i = 0, l = pathList.length; i < l; i++) {
1127
+ if (pathList[i] === '*') {
1128
+ pathList.push(pathList.splice(i, 1)[0]);
1129
+ l--;
1130
+ i--;
1131
+ }
1132
+ }
1133
+
1134
+ return {
1135
+ pathList: pathList,
1136
+ pathMap: pathMap,
1137
+ nameMap: nameMap
1138
+ }
1139
+ }
1140
+
1141
+ function addRouteRecord (
1142
+ pathList,
1143
+ pathMap,
1144
+ nameMap,
1145
+ route,
1146
+ parent,
1147
+ matchAs
1148
+ ) {
1149
+ var path = route.path;
1150
+ var name = route.name;
1151
+ {
1152
+ assert(path != null, "\"path\" is required in a route configuration.");
1153
+ assert(
1154
+ typeof route.component !== 'string',
1155
+ "route config \"component\" for path: " + (String(path || name)) + " cannot be a " +
1156
+ "string id. Use an actual component instead."
1157
+ );
1158
+ }
1159
+
1160
+ var pathToRegexpOptions = route.pathToRegexpOptions || {};
1161
+ var normalizedPath = normalizePath(
1162
+ path,
1163
+ parent,
1164
+ pathToRegexpOptions.strict
1165
+ );
1166
+
1167
+ if (typeof route.caseSensitive === 'boolean') {
1168
+ pathToRegexpOptions.sensitive = route.caseSensitive;
1169
+ }
1170
+
1171
+ var record = {
1172
+ path: normalizedPath,
1173
+ regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
1174
+ components: route.components || { default: route.component },
1175
+ instances: {},
1176
+ name: name,
1177
+ parent: parent,
1178
+ matchAs: matchAs,
1179
+ redirect: route.redirect,
1180
+ beforeEnter: route.beforeEnter,
1181
+ meta: route.meta || {},
1182
+ props: route.props == null
1183
+ ? {}
1184
+ : route.components
1185
+ ? route.props
1186
+ : { default: route.props }
1187
+ };
1188
+
1189
+ if (route.children) {
1190
+ // Warn if route is named, does not redirect and has a default child route.
1191
+ // If users navigate to this route by name, the default child will
1192
+ // not be rendered (GH Issue #629)
1193
+ {
1194
+ if (route.name && !route.redirect && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
1195
+ warn(
1196
+ false,
1197
+ "Named Route '" + (route.name) + "' has a default child route. " +
1198
+ "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
1199
+ "the default child route will not be rendered. Remove the name from " +
1200
+ "this route and use the name of the default child route for named " +
1201
+ "links instead."
1202
+ );
1203
+ }
1204
+ }
1205
+ route.children.forEach(function (child) {
1206
+ var childMatchAs = matchAs
1207
+ ? cleanPath((matchAs + "/" + (child.path)))
1208
+ : undefined;
1209
+ addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
1210
+ });
1211
+ }
1212
+
1213
+ if (route.alias !== undefined) {
1214
+ var aliases = Array.isArray(route.alias)
1215
+ ? route.alias
1216
+ : [route.alias];
1217
+
1218
+ aliases.forEach(function (alias) {
1219
+ var aliasRoute = {
1220
+ path: alias,
1221
+ children: route.children
1222
+ };
1223
+ addRouteRecord(
1224
+ pathList,
1225
+ pathMap,
1226
+ nameMap,
1227
+ aliasRoute,
1228
+ parent,
1229
+ record.path || '/' // matchAs
1230
+ );
1231
+ });
1232
+ }
1233
+
1234
+ if (!pathMap[record.path]) {
1235
+ pathList.push(record.path);
1236
+ pathMap[record.path] = record;
1237
+ }
1238
+
1239
+ if (name) {
1240
+ if (!nameMap[name]) {
1241
+ nameMap[name] = record;
1242
+ } else if ("development" !== 'production' && !matchAs) {
1243
+ warn(
1244
+ false,
1245
+ "Duplicate named routes definition: " +
1246
+ "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
1247
+ );
1248
+ }
1249
+ }
1250
+ }
1251
+
1252
+ function compileRouteRegex (path, pathToRegexpOptions) {
1253
+ var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
1254
+ {
1255
+ var keys = Object.create(null);
1256
+ regex.keys.forEach(function (key) {
1257
+ warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
1258
+ keys[key.name] = true;
1259
+ });
1260
+ }
1261
+ return regex
1262
+ }
1263
+
1264
+ function normalizePath (path, parent, strict) {
1265
+ if (!strict) { path = path.replace(/\/$/, ''); }
1266
+ if (path[0] === '/') { return path }
1267
+ if (parent == null) { return path }
1268
+ return cleanPath(((parent.path) + "/" + path))
1269
+ }
1270
+
1271
+ /* */
1272
+
1273
+
1274
+ function normalizeLocation (
1275
+ raw,
1276
+ current,
1277
+ append,
1278
+ router
1279
+ ) {
1280
+ var next = typeof raw === 'string' ? { path: raw } : raw;
1281
+ // named target
1282
+ if (next.name || next._normalized) {
1283
+ return next
1284
+ }
1285
+
1286
+ // relative params
1287
+ if (!next.path && next.params && current) {
1288
+ next = assign({}, next);
1289
+ next._normalized = true;
1290
+ var params = assign(assign({}, current.params), next.params);
1291
+ if (current.name) {
1292
+ next.name = current.name;
1293
+ next.params = params;
1294
+ } else if (current.matched.length) {
1295
+ var rawPath = current.matched[current.matched.length - 1].path;
1296
+ next.path = fillParams(rawPath, params, ("path " + (current.path)));
1297
+ } else {
1298
+ warn(false, "relative params navigation requires a current route.");
1299
+ }
1300
+ return next
1301
+ }
1302
+
1303
+ var parsedPath = parsePath(next.path || '');
1304
+ var basePath = (current && current.path) || '/';
1305
+ var path = parsedPath.path
1306
+ ? resolvePath(parsedPath.path, basePath, append || next.append)
1307
+ : basePath;
1308
+
1309
+ var query = resolveQuery(
1310
+ parsedPath.query,
1311
+ next.query,
1312
+ router && router.options.parseQuery
1313
+ );
1314
+
1315
+ var hash = next.hash || parsedPath.hash;
1316
+ if (hash && hash.charAt(0) !== '#') {
1317
+ hash = "#" + hash;
1318
+ }
1319
+
1320
+ return {
1321
+ _normalized: true,
1322
+ path: path,
1323
+ query: query,
1324
+ hash: hash
1325
+ }
1326
+ }
1327
+
1328
+ function assign (a, b) {
1329
+ for (var key in b) {
1330
+ a[key] = b[key];
1331
+ }
1332
+ return a
1333
+ }
1334
+
1335
+ /* */
1336
+
1337
+
1338
+ function createMatcher (
1339
+ routes,
1340
+ router
1341
+ ) {
1342
+ var ref = createRouteMap(routes);
1343
+ var pathList = ref.pathList;
1344
+ var pathMap = ref.pathMap;
1345
+ var nameMap = ref.nameMap;
1346
+
1347
+ function addRoutes (routes) {
1348
+ createRouteMap(routes, pathList, pathMap, nameMap);
1349
+ }
1350
+
1351
+ function match (
1352
+ raw,
1353
+ currentRoute,
1354
+ redirectedFrom
1355
+ ) {
1356
+ var location = normalizeLocation(raw, currentRoute, false, router);
1357
+ var name = location.name;
1358
+
1359
+ if (name) {
1360
+ var record = nameMap[name];
1361
+ {
1362
+ warn(record, ("Route with name '" + name + "' does not exist"));
1363
+ }
1364
+ if (!record) { return _createRoute(null, location) }
1365
+ var paramNames = record.regex.keys
1366
+ .filter(function (key) { return !key.optional; })
1367
+ .map(function (key) { return key.name; });
1368
+
1369
+ if (typeof location.params !== 'object') {
1370
+ location.params = {};
1371
+ }
1372
+
1373
+ if (currentRoute && typeof currentRoute.params === 'object') {
1374
+ for (var key in currentRoute.params) {
1375
+ if (!(key in location.params) && paramNames.indexOf(key) > -1) {
1376
+ location.params[key] = currentRoute.params[key];
1377
+ }
1378
+ }
1379
+ }
1380
+
1381
+ if (record) {
1382
+ location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
1383
+ return _createRoute(record, location, redirectedFrom)
1384
+ }
1385
+ } else if (location.path) {
1386
+ location.params = {};
1387
+ for (var i = 0; i < pathList.length; i++) {
1388
+ var path = pathList[i];
1389
+ var record$1 = pathMap[path];
1390
+ if (matchRoute(record$1.regex, location.path, location.params)) {
1391
+ return _createRoute(record$1, location, redirectedFrom)
1392
+ }
1393
+ }
1394
+ }
1395
+ // no match
1396
+ return _createRoute(null, location)
1397
+ }
1398
+
1399
+ function redirect (
1400
+ record,
1401
+ location
1402
+ ) {
1403
+ var originalRedirect = record.redirect;
1404
+ var redirect = typeof originalRedirect === 'function'
1405
+ ? originalRedirect(createRoute(record, location, null, router))
1406
+ : originalRedirect;
1407
+
1408
+ if (typeof redirect === 'string') {
1409
+ redirect = { path: redirect };
1410
+ }
1411
+
1412
+ if (!redirect || typeof redirect !== 'object') {
1413
+ {
1414
+ warn(
1415
+ false, ("invalid redirect option: " + (JSON.stringify(redirect)))
1416
+ );
1417
+ }
1418
+ return _createRoute(null, location)
1419
+ }
1420
+
1421
+ var re = redirect;
1422
+ var name = re.name;
1423
+ var path = re.path;
1424
+ var query = location.query;
1425
+ var hash = location.hash;
1426
+ var params = location.params;
1427
+ query = re.hasOwnProperty('query') ? re.query : query;
1428
+ hash = re.hasOwnProperty('hash') ? re.hash : hash;
1429
+ params = re.hasOwnProperty('params') ? re.params : params;
1430
+
1431
+ if (name) {
1432
+ // resolved named direct
1433
+ var targetRecord = nameMap[name];
1434
+ {
1435
+ assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
1436
+ }
1437
+ return match({
1438
+ _normalized: true,
1439
+ name: name,
1440
+ query: query,
1441
+ hash: hash,
1442
+ params: params
1443
+ }, undefined, location)
1444
+ } else if (path) {
1445
+ // 1. resolve relative redirect
1446
+ var rawPath = resolveRecordPath(path, record);
1447
+ // 2. resolve params
1448
+ var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
1449
+ // 3. rematch with existing query and hash
1450
+ return match({
1451
+ _normalized: true,
1452
+ path: resolvedPath,
1453
+ query: query,
1454
+ hash: hash
1455
+ }, undefined, location)
1456
+ } else {
1457
+ {
1458
+ warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
1459
+ }
1460
+ return _createRoute(null, location)
1461
+ }
1462
+ }
1463
+
1464
+ function alias (
1465
+ record,
1466
+ location,
1467
+ matchAs
1468
+ ) {
1469
+ var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
1470
+ var aliasedMatch = match({
1471
+ _normalized: true,
1472
+ path: aliasedPath
1473
+ });
1474
+ if (aliasedMatch) {
1475
+ var matched = aliasedMatch.matched;
1476
+ var aliasedRecord = matched[matched.length - 1];
1477
+ location.params = aliasedMatch.params;
1478
+ return _createRoute(aliasedRecord, location)
1479
+ }
1480
+ return _createRoute(null, location)
1481
+ }
1482
+
1483
+ function _createRoute (
1484
+ record,
1485
+ location,
1486
+ redirectedFrom
1487
+ ) {
1488
+ if (record && record.redirect) {
1489
+ return redirect(record, redirectedFrom || location)
1490
+ }
1491
+ if (record && record.matchAs) {
1492
+ return alias(record, location, record.matchAs)
1493
+ }
1494
+ return createRoute(record, location, redirectedFrom, router)
1495
+ }
1496
+
1497
+ return {
1498
+ match: match,
1499
+ addRoutes: addRoutes
1500
+ }
1501
+ }
1502
+
1503
+ function matchRoute (
1504
+ regex,
1505
+ path,
1506
+ params
1507
+ ) {
1508
+ var m = path.match(regex);
1509
+
1510
+ if (!m) {
1511
+ return false
1512
+ } else if (!params) {
1513
+ return true
1514
+ }
1515
+
1516
+ for (var i = 1, len = m.length; i < len; ++i) {
1517
+ var key = regex.keys[i - 1];
1518
+ var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
1519
+ if (key) {
1520
+ params[key.name] = val;
1521
+ }
1522
+ }
1523
+
1524
+ return true
1525
+ }
1526
+
1527
+ function resolveRecordPath (path, record) {
1528
+ return resolvePath(path, record.parent ? record.parent.path : '/', true)
1529
+ }
1530
+
1531
+ /* */
1532
+
1533
+
1534
+ var positionStore = Object.create(null);
1535
+
1536
+ function setupScroll () {
1537
+ // Fix for #1585 for Firefox
1538
+ window.history.replaceState({ key: getStateKey() }, '');
1539
+ window.addEventListener('popstate', function (e) {
1540
+ saveScrollPosition();
1541
+ if (e.state && e.state.key) {
1542
+ setStateKey(e.state.key);
1543
+ }
1544
+ });
1545
+ }
1546
+
1547
+ function handleScroll (
1548
+ router,
1549
+ to,
1550
+ from,
1551
+ isPop
1552
+ ) {
1553
+ if (!router.app) {
1554
+ return
1555
+ }
1556
+
1557
+ var behavior = router.options.scrollBehavior;
1558
+ if (!behavior) {
1559
+ return
1560
+ }
1561
+
1562
+ {
1563
+ assert(typeof behavior === 'function', "scrollBehavior must be a function");
1564
+ }
1565
+
1566
+ // wait until re-render finishes before scrolling
1567
+ router.app.$nextTick(function () {
1568
+ var position = getScrollPosition();
1569
+ var shouldScroll = behavior(to, from, isPop ? position : null);
1570
+
1571
+ if (!shouldScroll) {
1572
+ return
1573
+ }
1574
+
1575
+ if (typeof shouldScroll.then === 'function') {
1576
+ shouldScroll.then(function (shouldScroll) {
1577
+ scrollToPosition((shouldScroll), position);
1578
+ }).catch(function (err) {
1579
+ {
1580
+ assert(false, err.toString());
1581
+ }
1582
+ });
1583
+ } else {
1584
+ scrollToPosition(shouldScroll, position);
1585
+ }
1586
+ });
1587
+ }
1588
+
1589
+ function saveScrollPosition () {
1590
+ var key = getStateKey();
1591
+ if (key) {
1592
+ positionStore[key] = {
1593
+ x: window.pageXOffset,
1594
+ y: window.pageYOffset
1595
+ };
1596
+ }
1597
+ }
1598
+
1599
+ function getScrollPosition () {
1600
+ var key = getStateKey();
1601
+ if (key) {
1602
+ return positionStore[key]
1603
+ }
1604
+ }
1605
+
1606
+ function getElementPosition (el, offset) {
1607
+ var docEl = document.documentElement;
1608
+ var docRect = docEl.getBoundingClientRect();
1609
+ var elRect = el.getBoundingClientRect();
1610
+ return {
1611
+ x: elRect.left - docRect.left - offset.x,
1612
+ y: elRect.top - docRect.top - offset.y
1613
+ }
1614
+ }
1615
+
1616
+ function isValidPosition (obj) {
1617
+ return isNumber(obj.x) || isNumber(obj.y)
1618
+ }
1619
+
1620
+ function normalizePosition (obj) {
1621
+ return {
1622
+ x: isNumber(obj.x) ? obj.x : window.pageXOffset,
1623
+ y: isNumber(obj.y) ? obj.y : window.pageYOffset
1624
+ }
1625
+ }
1626
+
1627
+ function normalizeOffset (obj) {
1628
+ return {
1629
+ x: isNumber(obj.x) ? obj.x : 0,
1630
+ y: isNumber(obj.y) ? obj.y : 0
1631
+ }
1632
+ }
1633
+
1634
+ function isNumber (v) {
1635
+ return typeof v === 'number'
1636
+ }
1637
+
1638
+ function scrollToPosition (shouldScroll, position) {
1639
+ var isObject = typeof shouldScroll === 'object';
1640
+ if (isObject && typeof shouldScroll.selector === 'string') {
1641
+ var el = document.querySelector(shouldScroll.selector);
1642
+ if (el) {
1643
+ var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
1644
+ offset = normalizeOffset(offset);
1645
+ position = getElementPosition(el, offset);
1646
+ } else if (isValidPosition(shouldScroll)) {
1647
+ position = normalizePosition(shouldScroll);
1648
+ }
1649
+ } else if (isObject && isValidPosition(shouldScroll)) {
1650
+ position = normalizePosition(shouldScroll);
1651
+ }
1652
+
1653
+ if (position) {
1654
+ window.scrollTo(position.x, position.y);
1655
+ }
1656
+ }
1657
+
1658
+ /* */
1659
+
1660
+ var supportsPushState = inBrowser && (function () {
1661
+ var ua = window.navigator.userAgent;
1662
+
1663
+ if (
1664
+ (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
1665
+ ua.indexOf('Mobile Safari') !== -1 &&
1666
+ ua.indexOf('Chrome') === -1 &&
1667
+ ua.indexOf('Windows Phone') === -1
1668
+ ) {
1669
+ return false
1670
+ }
1671
+
1672
+ return window.history && 'pushState' in window.history
1673
+ })();
1674
+
1675
+ // use User Timing api (if present) for more accurate key precision
1676
+ var Time = inBrowser && window.performance && window.performance.now
1677
+ ? window.performance
1678
+ : Date;
1679
+
1680
+ var _key = genKey();
1681
+
1682
+ function genKey () {
1683
+ return Time.now().toFixed(3)
1684
+ }
1685
+
1686
+ function getStateKey () {
1687
+ return _key
1688
+ }
1689
+
1690
+ function setStateKey (key) {
1691
+ _key = key;
1692
+ }
1693
+
1694
+ function pushState (url, replace) {
1695
+ saveScrollPosition();
1696
+ // try...catch the pushState call to get around Safari
1697
+ // DOM Exception 18 where it limits to 100 pushState calls
1698
+ var history = window.history;
1699
+ try {
1700
+ if (replace) {
1701
+ history.replaceState({ key: _key }, '', url);
1702
+ } else {
1703
+ _key = genKey();
1704
+ history.pushState({ key: _key }, '', url);
1705
+ }
1706
+ } catch (e) {
1707
+ window.location[replace ? 'replace' : 'assign'](url);
1708
+ }
1709
+ }
1710
+
1711
+ function replaceState (url) {
1712
+ pushState(url, true);
1713
+ }
1714
+
1715
+ /* */
1716
+
1717
+ function runQueue (queue, fn, cb) {
1718
+ var step = function (index) {
1719
+ if (index >= queue.length) {
1720
+ cb();
1721
+ } else {
1722
+ if (queue[index]) {
1723
+ fn(queue[index], function () {
1724
+ step(index + 1);
1725
+ });
1726
+ } else {
1727
+ step(index + 1);
1728
+ }
1729
+ }
1730
+ };
1731
+ step(0);
1732
+ }
1733
+
1734
+ /* */
1735
+
1736
+ function resolveAsyncComponents (matched) {
1737
+ return function (to, from, next) {
1738
+ var hasAsync = false;
1739
+ var pending = 0;
1740
+ var error = null;
1741
+
1742
+ flatMapComponents(matched, function (def, _, match, key) {
1743
+ // if it's a function and doesn't have cid attached,
1744
+ // assume it's an async component resolve function.
1745
+ // we are not using Vue's default async resolving mechanism because
1746
+ // we want to halt the navigation until the incoming component has been
1747
+ // resolved.
1748
+ if (typeof def === 'function' && def.cid === undefined) {
1749
+ hasAsync = true;
1750
+ pending++;
1751
+
1752
+ var resolve = once(function (resolvedDef) {
1753
+ if (isESModule(resolvedDef)) {
1754
+ resolvedDef = resolvedDef.default;
1755
+ }
1756
+ // save resolved on async factory in case it's used elsewhere
1757
+ def.resolved = typeof resolvedDef === 'function'
1758
+ ? resolvedDef
1759
+ : _Vue.extend(resolvedDef);
1760
+ match.components[key] = resolvedDef;
1761
+ pending--;
1762
+ if (pending <= 0) {
1763
+ next();
1764
+ }
1765
+ });
1766
+
1767
+ var reject = once(function (reason) {
1768
+ var msg = "Failed to resolve async component " + key + ": " + reason;
1769
+ "development" !== 'production' && warn(false, msg);
1770
+ if (!error) {
1771
+ error = isError(reason)
1772
+ ? reason
1773
+ : new Error(msg);
1774
+ next(error);
1775
+ }
1776
+ });
1777
+
1778
+ var res;
1779
+ try {
1780
+ res = def(resolve, reject);
1781
+ } catch (e) {
1782
+ reject(e);
1783
+ }
1784
+ if (res) {
1785
+ if (typeof res.then === 'function') {
1786
+ res.then(resolve, reject);
1787
+ } else {
1788
+ // new syntax in Vue 2.3
1789
+ var comp = res.component;
1790
+ if (comp && typeof comp.then === 'function') {
1791
+ comp.then(resolve, reject);
1792
+ }
1793
+ }
1794
+ }
1795
+ }
1796
+ });
1797
+
1798
+ if (!hasAsync) { next(); }
1799
+ }
1800
+ }
1801
+
1802
+ function flatMapComponents (
1803
+ matched,
1804
+ fn
1805
+ ) {
1806
+ return flatten(matched.map(function (m) {
1807
+ return Object.keys(m.components).map(function (key) { return fn(
1808
+ m.components[key],
1809
+ m.instances[key],
1810
+ m, key
1811
+ ); })
1812
+ }))
1813
+ }
1814
+
1815
+ function flatten (arr) {
1816
+ return Array.prototype.concat.apply([], arr)
1817
+ }
1818
+
1819
+ var hasSymbol =
1820
+ typeof Symbol === 'function' &&
1821
+ typeof Symbol.toStringTag === 'symbol';
1822
+
1823
+ function isESModule (obj) {
1824
+ return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
1825
+ }
1826
+
1827
+ // in Webpack 2, require.ensure now also returns a Promise
1828
+ // so the resolve/reject functions may get called an extra time
1829
+ // if the user uses an arrow function shorthand that happens to
1830
+ // return that Promise.
1831
+ function once (fn) {
1832
+ var called = false;
1833
+ return function () {
1834
+ var args = [], len = arguments.length;
1835
+ while ( len-- ) args[ len ] = arguments[ len ];
1836
+
1837
+ if (called) { return }
1838
+ called = true;
1839
+ return fn.apply(this, args)
1840
+ }
1841
+ }
1842
+
1843
+ /* */
1844
+
1845
+ var History = function History (router, base) {
1846
+ this.router = router;
1847
+ this.base = normalizeBase(base);
1848
+ // start with a route object that stands for "nowhere"
1849
+ this.current = START;
1850
+ this.pending = null;
1851
+ this.ready = false;
1852
+ this.readyCbs = [];
1853
+ this.readyErrorCbs = [];
1854
+ this.errorCbs = [];
1855
+ };
1856
+
1857
+ History.prototype.listen = function listen (cb) {
1858
+ this.cb = cb;
1859
+ };
1860
+
1861
+ History.prototype.onReady = function onReady (cb, errorCb) {
1862
+ if (this.ready) {
1863
+ cb();
1864
+ } else {
1865
+ this.readyCbs.push(cb);
1866
+ if (errorCb) {
1867
+ this.readyErrorCbs.push(errorCb);
1868
+ }
1869
+ }
1870
+ };
1871
+
1872
+ History.prototype.onError = function onError (errorCb) {
1873
+ this.errorCbs.push(errorCb);
1874
+ };
1875
+
1876
+ History.prototype.transitionTo = function transitionTo (location, onComplete, onAbort) {
1877
+ var this$1 = this;
1878
+
1879
+ var route = this.router.match(location, this.current);
1880
+ this.confirmTransition(route, function () {
1881
+ this$1.updateRoute(route);
1882
+ onComplete && onComplete(route);
1883
+ this$1.ensureURL();
1884
+
1885
+ // fire ready cbs once
1886
+ if (!this$1.ready) {
1887
+ this$1.ready = true;
1888
+ this$1.readyCbs.forEach(function (cb) { cb(route); });
1889
+ }
1890
+ }, function (err) {
1891
+ if (onAbort) {
1892
+ onAbort(err);
1893
+ }
1894
+ if (err && !this$1.ready) {
1895
+ this$1.ready = true;
1896
+ this$1.readyErrorCbs.forEach(function (cb) { cb(err); });
1897
+ }
1898
+ });
1899
+ };
1900
+
1901
+ History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
1902
+ var this$1 = this;
1903
+
1904
+ var current = this.current;
1905
+ var abort = function (err) {
1906
+ if (isError(err)) {
1907
+ if (this$1.errorCbs.length) {
1908
+ this$1.errorCbs.forEach(function (cb) { cb(err); });
1909
+ } else {
1910
+ warn(false, 'uncaught error during route navigation:');
1911
+ console.error(err);
1912
+ }
1913
+ }
1914
+ onAbort && onAbort(err);
1915
+ };
1916
+ if (
1917
+ isSameRoute(route, current) &&
1918
+ // in the case the route map has been dynamically appended to
1919
+ route.matched.length === current.matched.length
1920
+ ) {
1921
+ this.ensureURL();
1922
+ return abort()
1923
+ }
1924
+
1925
+ var ref = resolveQueue(this.current.matched, route.matched);
1926
+ var updated = ref.updated;
1927
+ var deactivated = ref.deactivated;
1928
+ var activated = ref.activated;
1929
+
1930
+ var queue = [].concat(
1931
+ // in-component leave guards
1932
+ extractLeaveGuards(deactivated),
1933
+ // global before hooks
1934
+ this.router.beforeHooks,
1935
+ // in-component update hooks
1936
+ extractUpdateHooks(updated),
1937
+ // in-config enter guards
1938
+ activated.map(function (m) { return m.beforeEnter; }),
1939
+ // async components
1940
+ resolveAsyncComponents(activated)
1941
+ );
1942
+
1943
+ this.pending = route;
1944
+ var iterator = function (hook, next) {
1945
+ if (this$1.pending !== route) {
1946
+ return abort()
1947
+ }
1948
+ try {
1949
+ hook(route, current, function (to) {
1950
+ if (to === false || isError(to)) {
1951
+ // next(false) -> abort navigation, ensure current URL
1952
+ this$1.ensureURL(true);
1953
+ abort(to);
1954
+ } else if (
1955
+ typeof to === 'string' ||
1956
+ (typeof to === 'object' && (
1957
+ typeof to.path === 'string' ||
1958
+ typeof to.name === 'string'
1959
+ ))
1960
+ ) {
1961
+ // next('/') or next({ path: '/' }) -> redirect
1962
+ abort();
1963
+ if (typeof to === 'object' && to.replace) {
1964
+ this$1.replace(to);
1965
+ } else {
1966
+ this$1.push(to);
1967
+ }
1968
+ } else {
1969
+ // confirm transition and pass on the value
1970
+ next(to);
1971
+ }
1972
+ });
1973
+ } catch (e) {
1974
+ abort(e);
1975
+ }
1976
+ };
1977
+
1978
+ runQueue(queue, iterator, function () {
1979
+ var postEnterCbs = [];
1980
+ var isValid = function () { return this$1.current === route; };
1981
+ // wait until async components are resolved before
1982
+ // extracting in-component enter guards
1983
+ var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
1984
+ var queue = enterGuards.concat(this$1.router.resolveHooks);
1985
+ runQueue(queue, iterator, function () {
1986
+ if (this$1.pending !== route) {
1987
+ return abort()
1988
+ }
1989
+ this$1.pending = null;
1990
+ onComplete(route);
1991
+ if (this$1.router.app) {
1992
+ this$1.router.app.$nextTick(function () {
1993
+ postEnterCbs.forEach(function (cb) { cb(); });
1994
+ });
1995
+ }
1996
+ });
1997
+ });
1998
+ };
1999
+
2000
+ History.prototype.updateRoute = function updateRoute (route) {
2001
+ var prev = this.current;
2002
+ this.current = route;
2003
+ this.cb && this.cb(route);
2004
+ this.router.afterHooks.forEach(function (hook) {
2005
+ hook && hook(route, prev);
2006
+ });
2007
+ };
2008
+
2009
+ function normalizeBase (base) {
2010
+ if (!base) {
2011
+ if (inBrowser) {
2012
+ // respect <base> tag
2013
+ var baseEl = document.querySelector('base');
2014
+ base = (baseEl && baseEl.getAttribute('href')) || '/';
2015
+ // strip full URL origin
2016
+ base = base.replace(/^https?:\/\/[^\/]+/, '');
2017
+ } else {
2018
+ base = '/';
2019
+ }
2020
+ }
2021
+ // make sure there's the starting slash
2022
+ if (base.charAt(0) !== '/') {
2023
+ base = '/' + base;
2024
+ }
2025
+ // remove trailing slash
2026
+ return base.replace(/\/$/, '')
2027
+ }
2028
+
2029
+ function resolveQueue (
2030
+ current,
2031
+ next
2032
+ ) {
2033
+ var i;
2034
+ var max = Math.max(current.length, next.length);
2035
+ for (i = 0; i < max; i++) {
2036
+ if (current[i] !== next[i]) {
2037
+ break
2038
+ }
2039
+ }
2040
+ return {
2041
+ updated: next.slice(0, i),
2042
+ activated: next.slice(i),
2043
+ deactivated: current.slice(i)
2044
+ }
2045
+ }
2046
+
2047
+ function extractGuards (
2048
+ records,
2049
+ name,
2050
+ bind,
2051
+ reverse
2052
+ ) {
2053
+ var guards = flatMapComponents(records, function (def, instance, match, key) {
2054
+ var guard = extractGuard(def, name);
2055
+ if (guard) {
2056
+ return Array.isArray(guard)
2057
+ ? guard.map(function (guard) { return bind(guard, instance, match, key); })
2058
+ : bind(guard, instance, match, key)
2059
+ }
2060
+ });
2061
+ return flatten(reverse ? guards.reverse() : guards)
2062
+ }
2063
+
2064
+ function extractGuard (
2065
+ def,
2066
+ key
2067
+ ) {
2068
+ if (typeof def !== 'function') {
2069
+ // extend now so that global mixins are applied.
2070
+ def = _Vue.extend(def);
2071
+ }
2072
+ return def.options[key]
2073
+ }
2074
+
2075
+ function extractLeaveGuards (deactivated) {
2076
+ return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
2077
+ }
2078
+
2079
+ function extractUpdateHooks (updated) {
2080
+ return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
2081
+ }
2082
+
2083
+ function bindGuard (guard, instance) {
2084
+ if (instance) {
2085
+ return function boundRouteGuard () {
2086
+ return guard.apply(instance, arguments)
2087
+ }
2088
+ }
2089
+ }
2090
+
2091
+ function extractEnterGuards (
2092
+ activated,
2093
+ cbs,
2094
+ isValid
2095
+ ) {
2096
+ return extractGuards(activated, 'beforeRouteEnter', function (guard, _, match, key) {
2097
+ return bindEnterGuard(guard, match, key, cbs, isValid)
2098
+ })
2099
+ }
2100
+
2101
+ function bindEnterGuard (
2102
+ guard,
2103
+ match,
2104
+ key,
2105
+ cbs,
2106
+ isValid
2107
+ ) {
2108
+ return function routeEnterGuard (to, from, next) {
2109
+ return guard(to, from, function (cb) {
2110
+ next(cb);
2111
+ if (typeof cb === 'function') {
2112
+ cbs.push(function () {
2113
+ // #750
2114
+ // if a router-view is wrapped with an out-in transition,
2115
+ // the instance may not have been registered at this time.
2116
+ // we will need to poll for registration until current route
2117
+ // is no longer valid.
2118
+ poll(cb, match.instances, key, isValid);
2119
+ });
2120
+ }
2121
+ })
2122
+ }
2123
+ }
2124
+
2125
+ function poll (
2126
+ cb, // somehow flow cannot infer this is a function
2127
+ instances,
2128
+ key,
2129
+ isValid
2130
+ ) {
2131
+ if (instances[key]) {
2132
+ cb(instances[key]);
2133
+ } else if (isValid()) {
2134
+ setTimeout(function () {
2135
+ poll(cb, instances, key, isValid);
2136
+ }, 16);
2137
+ }
2138
+ }
2139
+
2140
+ /* */
2141
+
2142
+
2143
+ var HTML5History = (function (History$$1) {
2144
+ function HTML5History (router, base) {
2145
+ var this$1 = this;
2146
+
2147
+ History$$1.call(this, router, base);
2148
+
2149
+ var expectScroll = router.options.scrollBehavior;
2150
+
2151
+ if (expectScroll) {
2152
+ setupScroll();
2153
+ }
2154
+
2155
+ var initLocation = getLocation(this.base);
2156
+ window.addEventListener('popstate', function (e) {
2157
+ var current = this$1.current;
2158
+
2159
+ // Avoiding first `popstate` event dispatched in some browsers but first
2160
+ // history route not updated since async guard at the same time.
2161
+ var location = getLocation(this$1.base);
2162
+ if (this$1.current === START && location === initLocation) {
2163
+ return
2164
+ }
2165
+
2166
+ this$1.transitionTo(location, function (route) {
2167
+ if (expectScroll) {
2168
+ handleScroll(router, route, current, true);
2169
+ }
2170
+ });
2171
+ });
2172
+ }
2173
+
2174
+ if ( History$$1 ) HTML5History.__proto__ = History$$1;
2175
+ HTML5History.prototype = Object.create( History$$1 && History$$1.prototype );
2176
+ HTML5History.prototype.constructor = HTML5History;
2177
+
2178
+ HTML5History.prototype.go = function go (n) {
2179
+ window.history.go(n);
2180
+ };
2181
+
2182
+ HTML5History.prototype.push = function push (location, onComplete, onAbort) {
2183
+ var this$1 = this;
2184
+
2185
+ var ref = this;
2186
+ var fromRoute = ref.current;
2187
+ this.transitionTo(location, function (route) {
2188
+ pushState(cleanPath(this$1.base + route.fullPath));
2189
+ handleScroll(this$1.router, route, fromRoute, false);
2190
+ onComplete && onComplete(route);
2191
+ }, onAbort);
2192
+ };
2193
+
2194
+ HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
2195
+ var this$1 = this;
2196
+
2197
+ var ref = this;
2198
+ var fromRoute = ref.current;
2199
+ this.transitionTo(location, function (route) {
2200
+ replaceState(cleanPath(this$1.base + route.fullPath));
2201
+ handleScroll(this$1.router, route, fromRoute, false);
2202
+ onComplete && onComplete(route);
2203
+ }, onAbort);
2204
+ };
2205
+
2206
+ HTML5History.prototype.ensureURL = function ensureURL (push) {
2207
+ if (getLocation(this.base) !== this.current.fullPath) {
2208
+ var current = cleanPath(this.base + this.current.fullPath);
2209
+ push ? pushState(current) : replaceState(current);
2210
+ }
2211
+ };
2212
+
2213
+ HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
2214
+ return getLocation(this.base)
2215
+ };
2216
+
2217
+ return HTML5History;
2218
+ }(History));
2219
+
2220
+ function getLocation (base) {
2221
+ var path = window.location.pathname;
2222
+ if (base && path.indexOf(base) === 0) {
2223
+ path = path.slice(base.length);
2224
+ }
2225
+ return (path || '/') + window.location.search + window.location.hash
2226
+ }
2227
+
2228
+ /* */
2229
+
2230
+
2231
+ var HashHistory = (function (History$$1) {
2232
+ function HashHistory (router, base, fallback) {
2233
+ History$$1.call(this, router, base);
2234
+ // check history fallback deeplinking
2235
+ if (fallback && checkFallback(this.base)) {
2236
+ return
2237
+ }
2238
+ ensureSlash();
2239
+ }
2240
+
2241
+ if ( History$$1 ) HashHistory.__proto__ = History$$1;
2242
+ HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
2243
+ HashHistory.prototype.constructor = HashHistory;
2244
+
2245
+ // this is delayed until the app mounts
2246
+ // to avoid the hashchange listener being fired too early
2247
+ HashHistory.prototype.setupListeners = function setupListeners () {
2248
+ var this$1 = this;
2249
+
2250
+ var router = this.router;
2251
+ var expectScroll = router.options.scrollBehavior;
2252
+ var supportsScroll = supportsPushState && expectScroll;
2253
+
2254
+ if (supportsScroll) {
2255
+ setupScroll();
2256
+ }
2257
+
2258
+ window.addEventListener(supportsPushState ? 'popstate' : 'hashchange', function () {
2259
+ var current = this$1.current;
2260
+ if (!ensureSlash()) {
2261
+ return
2262
+ }
2263
+ this$1.transitionTo(getHash(), function (route) {
2264
+ if (supportsScroll) {
2265
+ handleScroll(this$1.router, route, current, true);
2266
+ }
2267
+ if (!supportsPushState) {
2268
+ replaceHash(route.fullPath);
2269
+ }
2270
+ });
2271
+ });
2272
+ };
2273
+
2274
+ HashHistory.prototype.push = function push (location, onComplete, onAbort) {
2275
+ var this$1 = this;
2276
+
2277
+ var ref = this;
2278
+ var fromRoute = ref.current;
2279
+ this.transitionTo(location, function (route) {
2280
+ pushHash(route.fullPath);
2281
+ handleScroll(this$1.router, route, fromRoute, false);
2282
+ onComplete && onComplete(route);
2283
+ }, onAbort);
2284
+ };
2285
+
2286
+ HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
2287
+ var this$1 = this;
2288
+
2289
+ var ref = this;
2290
+ var fromRoute = ref.current;
2291
+ this.transitionTo(location, function (route) {
2292
+ replaceHash(route.fullPath);
2293
+ handleScroll(this$1.router, route, fromRoute, false);
2294
+ onComplete && onComplete(route);
2295
+ }, onAbort);
2296
+ };
2297
+
2298
+ HashHistory.prototype.go = function go (n) {
2299
+ window.history.go(n);
2300
+ };
2301
+
2302
+ HashHistory.prototype.ensureURL = function ensureURL (push) {
2303
+ var current = this.current.fullPath;
2304
+ if (getHash() !== current) {
2305
+ push ? pushHash(current) : replaceHash(current);
2306
+ }
2307
+ };
2308
+
2309
+ HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
2310
+ return getHash()
2311
+ };
2312
+
2313
+ return HashHistory;
2314
+ }(History));
2315
+
2316
+ function checkFallback (base) {
2317
+ var location = getLocation(base);
2318
+ if (!/^\/#/.test(location)) {
2319
+ window.location.replace(
2320
+ cleanPath(base + '/#' + location)
2321
+ );
2322
+ return true
2323
+ }
2324
+ }
2325
+
2326
+ function ensureSlash () {
2327
+ var path = getHash();
2328
+ if (path.charAt(0) === '/') {
2329
+ return true
2330
+ }
2331
+ replaceHash('/' + path);
2332
+ return false
2333
+ }
2334
+
2335
+ function getHash () {
2336
+ // We can't use window.location.hash here because it's not
2337
+ // consistent across browsers - Firefox will pre-decode it!
2338
+ var href = window.location.href;
2339
+ var index = href.indexOf('#');
2340
+ return index === -1 ? '' : href.slice(index + 1)
2341
+ }
2342
+
2343
+ function getUrl (path) {
2344
+ var href = window.location.href;
2345
+ var i = href.indexOf('#');
2346
+ var base = i >= 0 ? href.slice(0, i) : href;
2347
+ return (base + "#" + path)
2348
+ }
2349
+
2350
+ function pushHash (path) {
2351
+ if (supportsPushState) {
2352
+ pushState(getUrl(path));
2353
+ } else {
2354
+ window.location.hash = path;
2355
+ }
2356
+ }
2357
+
2358
+ function replaceHash (path) {
2359
+ if (supportsPushState) {
2360
+ replaceState(getUrl(path));
2361
+ } else {
2362
+ window.location.replace(getUrl(path));
2363
+ }
2364
+ }
2365
+
2366
+ /* */
2367
+
2368
+
2369
+ var AbstractHistory = (function (History$$1) {
2370
+ function AbstractHistory (router, base) {
2371
+ History$$1.call(this, router, base);
2372
+ this.stack = [];
2373
+ this.index = -1;
2374
+ }
2375
+
2376
+ if ( History$$1 ) AbstractHistory.__proto__ = History$$1;
2377
+ AbstractHistory.prototype = Object.create( History$$1 && History$$1.prototype );
2378
+ AbstractHistory.prototype.constructor = AbstractHistory;
2379
+
2380
+ AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
2381
+ var this$1 = this;
2382
+
2383
+ this.transitionTo(location, function (route) {
2384
+ this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
2385
+ this$1.index++;
2386
+ onComplete && onComplete(route);
2387
+ }, onAbort);
2388
+ };
2389
+
2390
+ AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
2391
+ var this$1 = this;
2392
+
2393
+ this.transitionTo(location, function (route) {
2394
+ this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
2395
+ onComplete && onComplete(route);
2396
+ }, onAbort);
2397
+ };
2398
+
2399
+ AbstractHistory.prototype.go = function go (n) {
2400
+ var this$1 = this;
2401
+
2402
+ var targetIndex = this.index + n;
2403
+ if (targetIndex < 0 || targetIndex >= this.stack.length) {
2404
+ return
2405
+ }
2406
+ var route = this.stack[targetIndex];
2407
+ this.confirmTransition(route, function () {
2408
+ this$1.index = targetIndex;
2409
+ this$1.updateRoute(route);
2410
+ });
2411
+ };
2412
+
2413
+ AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
2414
+ var current = this.stack[this.stack.length - 1];
2415
+ return current ? current.fullPath : '/'
2416
+ };
2417
+
2418
+ AbstractHistory.prototype.ensureURL = function ensureURL () {
2419
+ // noop
2420
+ };
2421
+
2422
+ return AbstractHistory;
2423
+ }(History));
2424
+
2425
+ /* */
2426
+
2427
+ var VueRouter = function VueRouter (options) {
2428
+ if ( options === void 0 ) options = {};
2429
+
2430
+ this.app = null;
2431
+ this.apps = [];
2432
+ this.options = options;
2433
+ this.beforeHooks = [];
2434
+ this.resolveHooks = [];
2435
+ this.afterHooks = [];
2436
+ this.matcher = createMatcher(options.routes || [], this);
2437
+
2438
+ var mode = options.mode || 'hash';
2439
+ this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
2440
+ if (this.fallback) {
2441
+ mode = 'hash';
2442
+ }
2443
+ if (!inBrowser) {
2444
+ mode = 'abstract';
2445
+ }
2446
+ this.mode = mode;
2447
+
2448
+ switch (mode) {
2449
+ case 'history':
2450
+ this.history = new HTML5History(this, options.base);
2451
+ break
2452
+ case 'hash':
2453
+ this.history = new HashHistory(this, options.base, this.fallback);
2454
+ break
2455
+ case 'abstract':
2456
+ this.history = new AbstractHistory(this, options.base);
2457
+ break
2458
+ default:
2459
+ {
2460
+ assert(false, ("invalid mode: " + mode));
2461
+ }
2462
+ }
2463
+ };
2464
+
2465
+ var prototypeAccessors = { currentRoute: { configurable: true } };
2466
+
2467
+ VueRouter.prototype.match = function match (
2468
+ raw,
2469
+ current,
2470
+ redirectedFrom
2471
+ ) {
2472
+ return this.matcher.match(raw, current, redirectedFrom)
2473
+ };
2474
+
2475
+ prototypeAccessors.currentRoute.get = function () {
2476
+ return this.history && this.history.current
2477
+ };
2478
+
2479
+ VueRouter.prototype.init = function init (app /* Vue component instance */) {
2480
+ var this$1 = this;
2481
+
2482
+ "development" !== 'production' && assert(
2483
+ install.installed,
2484
+ "not installed. Make sure to call `Vue.use(VueRouter)` " +
2485
+ "before creating root instance."
2486
+ );
2487
+
2488
+ this.apps.push(app);
2489
+
2490
+ // main app already initialized.
2491
+ if (this.app) {
2492
+ return
2493
+ }
2494
+
2495
+ this.app = app;
2496
+
2497
+ var history = this.history;
2498
+
2499
+ if (history instanceof HTML5History) {
2500
+ history.transitionTo(history.getCurrentLocation());
2501
+ } else if (history instanceof HashHistory) {
2502
+ var setupHashListener = function () {
2503
+ history.setupListeners();
2504
+ };
2505
+ history.transitionTo(
2506
+ history.getCurrentLocation(),
2507
+ setupHashListener,
2508
+ setupHashListener
2509
+ );
2510
+ }
2511
+
2512
+ history.listen(function (route) {
2513
+ this$1.apps.forEach(function (app) {
2514
+ app._route = route;
2515
+ });
2516
+ });
2517
+ };
2518
+
2519
+ VueRouter.prototype.beforeEach = function beforeEach (fn) {
2520
+ return registerHook(this.beforeHooks, fn)
2521
+ };
2522
+
2523
+ VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
2524
+ return registerHook(this.resolveHooks, fn)
2525
+ };
2526
+
2527
+ VueRouter.prototype.afterEach = function afterEach (fn) {
2528
+ return registerHook(this.afterHooks, fn)
2529
+ };
2530
+
2531
+ VueRouter.prototype.onReady = function onReady (cb, errorCb) {
2532
+ this.history.onReady(cb, errorCb);
2533
+ };
2534
+
2535
+ VueRouter.prototype.onError = function onError (errorCb) {
2536
+ this.history.onError(errorCb);
2537
+ };
2538
+
2539
+ VueRouter.prototype.push = function push (location, onComplete, onAbort) {
2540
+ this.history.push(location, onComplete, onAbort);
2541
+ };
2542
+
2543
+ VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
2544
+ this.history.replace(location, onComplete, onAbort);
2545
+ };
2546
+
2547
+ VueRouter.prototype.go = function go (n) {
2548
+ this.history.go(n);
2549
+ };
2550
+
2551
+ VueRouter.prototype.back = function back () {
2552
+ this.go(-1);
2553
+ };
2554
+
2555
+ VueRouter.prototype.forward = function forward () {
2556
+ this.go(1);
2557
+ };
2558
+
2559
+ VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
2560
+ var route = to
2561
+ ? to.matched
2562
+ ? to
2563
+ : this.resolve(to).route
2564
+ : this.currentRoute;
2565
+ if (!route) {
2566
+ return []
2567
+ }
2568
+ return [].concat.apply([], route.matched.map(function (m) {
2569
+ return Object.keys(m.components).map(function (key) {
2570
+ return m.components[key]
2571
+ })
2572
+ }))
2573
+ };
2574
+
2575
+ VueRouter.prototype.resolve = function resolve (
2576
+ to,
2577
+ current,
2578
+ append
2579
+ ) {
2580
+ var location = normalizeLocation(
2581
+ to,
2582
+ current || this.history.current,
2583
+ append,
2584
+ this
2585
+ );
2586
+ var route = this.match(location, current);
2587
+ var fullPath = route.redirectedFrom || route.fullPath;
2588
+ var base = this.history.base;
2589
+ var href = createHref(base, fullPath, this.mode);
2590
+ return {
2591
+ location: location,
2592
+ route: route,
2593
+ href: href,
2594
+ // for backwards compat
2595
+ normalizedTo: location,
2596
+ resolved: route
2597
+ }
2598
+ };
2599
+
2600
+ VueRouter.prototype.addRoutes = function addRoutes (routes) {
2601
+ this.matcher.addRoutes(routes);
2602
+ if (this.history.current !== START) {
2603
+ this.history.transitionTo(this.history.getCurrentLocation());
2604
+ }
2605
+ };
2606
+
2607
+ Object.defineProperties( VueRouter.prototype, prototypeAccessors );
2608
+
2609
+ function registerHook (list, fn) {
2610
+ list.push(fn);
2611
+ return function () {
2612
+ var i = list.indexOf(fn);
2613
+ if (i > -1) { list.splice(i, 1); }
2614
+ }
2615
+ }
2616
+
2617
+ function createHref (base, fullPath, mode) {
2618
+ var path = mode === 'hash' ? '#' + fullPath : fullPath;
2619
+ return base ? cleanPath(base + '/' + path) : path
2620
+ }
2621
+
2622
+ VueRouter.install = install;
2623
+ VueRouter.version = '3.0.1';
2624
+
2625
+ if (inBrowser && window.Vue) {
2626
+ window.Vue.use(VueRouter);
2627
+ }
2628
+
2629
+ return VueRouter;
2630
+
2631
+ })));
class/frontend-account.php CHANGED
@@ -111,6 +111,7 @@ class WPUF_Frontend_Account {
111
  $current_user = wpuf_get_user();
112
 
113
  if ( !$current_user->subscription()->current_pack_id() ) {
 
114
  return;
115
  }
116
 
111
  $current_user = wpuf_get_user();
112
 
113
  if ( !$current_user->subscription()->current_pack_id() ) {
114
+ _e( "<p>You've not subscribed any package yet.</p>", 'wpuf' );
115
  return;
116
  }
117
 
class/frontend-form-post.php CHANGED
@@ -259,7 +259,7 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
259
 
260
  if ( $has_limit ) {
261
 
262
- $limit = (int) isset( $form_settings['role_base'] ) && !empty( $form_settings['limit_number'] ) ? $form_settings['limit_number'] : 0;
263
  $form_entries = wpuf_form_posts_count( $form_id );
264
 
265
  if ( $limit && $limit <= $form_entries ) {
@@ -288,7 +288,10 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
288
  $no_captcha = $invisible_captcha = '';
289
 
290
  $check_recaptcha = $this->search( $post_vars, 'input_type', 'recaptcha' );
291
- $recaptcha_type = $check_recaptcha[0]['recaptcha_type'];
 
 
 
292
 
293
  // check recaptcha
294
  if ( $check_recaptcha ) {
@@ -477,7 +480,11 @@ class WPUF_Frontend_Form_Post extends WPUF_Render_Form {
477
 
478
  // set default post category if it's not been set yet and if post type supports
479
  if ( !isset( $postarr['post_category'] ) && isset( $form_settings['default_cat'] ) && is_object_in_taxonomy( $form_settings['post_type'], 'category' ) ) {
480
- $postarr['post_category'] = array( $form_settings['default_cat'] );
 
 
 
 
481
  }
482
 
483
  // validation filter
259
 
260
  if ( $has_limit ) {
261
 
262
+ $limit = (int) !empty( $form_settings['limit_number'] ) ? $form_settings['limit_number'] : 0;
263
  $form_entries = wpuf_form_posts_count( $form_id );
264
 
265
  if ( $limit && $limit <= $form_entries ) {
288
  $no_captcha = $invisible_captcha = '';
289
 
290
  $check_recaptcha = $this->search( $post_vars, 'input_type', 'recaptcha' );
291
+
292
+ if ( !empty( $check_recaptcha ) ) {
293
+ $recaptcha_type = $check_recaptcha[0]['recaptcha_type'];
294
+ }
295
 
296
  // check recaptcha
297
  if ( $check_recaptcha ) {
480
 
481
  // set default post category if it's not been set yet and if post type supports
482
  if ( !isset( $postarr['post_category'] ) && isset( $form_settings['default_cat'] ) && is_object_in_taxonomy( $form_settings['post_type'], 'category' ) ) {
483
+ if ( is_array( $form_settings['default_cat'] ) ) {
484
+ $postarr['post_category'] = $form_settings['default_cat'];
485
+ } else {
486
+ $postarr['post_category'] = array( $form_settings['default_cat'] );
487
+ }
488
  }
489
 
490
  // validation filter
class/payment.php CHANGED
@@ -271,10 +271,13 @@ class WPUF_Payment {
271
 
272
  switch ($type) {
273
  case 'post':
274
- $post = get_post( $post_id );
275
- $form_id = get_post_meta( $post_id, '_wpuf_form_id', true );
276
- $form = new WPUF_Form( $form_id );
277
- if ( $current_pack && !$current_user->subscription()->has_post_count( $form_settings['post_type'] ) ) {
 
 
 
278
  $amount = $form->get_subs_fallback_cost();
279
  } else {
280
  $amount = $form->get_pay_per_post_cost();
271
 
272
  switch ($type) {
273
  case 'post':
274
+ $post = get_post( $post_id );
275
+ $form_id = get_post_meta( $post_id, '_wpuf_form_id', true );
276
+ $form = new WPUF_Form( $form_id );
277
+ $form_settings = $form->get_settings();
278
+ $post_count = $current_user->subscription()->has_post_count( $form_settings['post_type'] );
279
+
280
+ if ( !is_wp_error ( $current_pack ) && !$post_count ) {
281
  $amount = $form->get_subs_fallback_cost();
282
  } else {
283
  $amount = $form->get_pay_per_post_cost();
class/render-form.php CHANGED
@@ -1449,7 +1449,7 @@ class WPUF_Render_Form {
1449
  $selected = $terms ? $terms[0] : '';
1450
  $required = sprintf( 'data-required="%s" data-type="select"', $attr['required'] );
1451
  $tax_args = array(
1452
- 'show_option_none' => __( '-- Select --', 'wpuf' ),
1453
  'hierarchical' => 1,
1454
  'hide_empty' => 0,
1455
  'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
1449
  $selected = $terms ? $terms[0] : '';
1450
  $required = sprintf( 'data-required="%s" data-type="select"', $attr['required'] );
1451
  $tax_args = array(
1452
+ 'show_option_none' => isset ( $attr['first'] ) ? $attr['first'] : '--select--',
1453
  'hierarchical' => 1,
1454
  'hide_empty' => 0,
1455
  'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
includes/free/loader.php CHANGED
@@ -78,9 +78,10 @@ class WPUF_Free_Loader extends WPUF_Pro_Prompt {
78
  }
79
 
80
  function admin_menu() {
81
- $capability = wpuf_admin_role();
82
-
83
- add_submenu_page( 'wp-user-frontend', __( 'Coupons', 'wpuf' ), __( 'Coupons', 'wpuf' ), $capability, 'wpuf_coupon', array($this, 'admin_coupon_page' ) );
 
84
  }
85
 
86
  function admin_reg_forms_page() {
78
  }
79
 
80
  function admin_menu() {
81
+ if ( 'on' == wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
82
+ $capability = wpuf_admin_role();
83
+ add_submenu_page( 'wp-user-frontend', __( 'Coupons', 'wpuf' ), __( 'Coupons', 'wpuf' ), $capability, 'wpuf_coupon', array($this, 'admin_coupon_page' ) );
84
+ }
85
  }
86
 
87
  function admin_reg_forms_page() {
includes/free/post-form-templates/woocommerce.php CHANGED
@@ -272,7 +272,11 @@ Edit URL: %editlink%',
272
  $reviews = get_post_meta( $post_id, 'product_reviews', true );
273
  $status = !empty( $reviews ) ? 'open' : 'close';
274
 
275
- wp_update_post( array( 'ID' => $post_id, 'comment_status' => 'open' ) );
 
 
 
 
276
  }
277
 
278
  /**
@@ -302,7 +306,9 @@ Edit URL: %editlink%',
302
  */
303
  public function update_gallery_images( $post_id ) {
304
  $images = get_post_meta( $post_id, '_product_image' );
305
- update_post_meta( $post_id, '_product_image_gallery', implode(',', $images) );
 
 
306
  }
307
 
308
  /**
@@ -316,7 +322,9 @@ Edit URL: %editlink%',
316
  $visibility = get_post_meta( $post_id, '_visibility', true );
317
 
318
  $product = wc_get_product( $post_id );
319
- $product->set_catalog_visibility( $visibility );
 
 
320
  $product->save();
321
  }
322
  }
272
  $reviews = get_post_meta( $post_id, 'product_reviews', true );
273
  $status = !empty( $reviews ) ? 'open' : 'close';
274
 
275
+ if ( 'open' === $status ) {
276
+ apply_filters( 'comments_open', true , $post_id );
277
+ } else {
278
+ apply_filters( 'comments_open', false , $post_id );
279
+ }
280
  }
281
 
282
  /**
306
  */
307
  public function update_gallery_images( $post_id ) {
308
  $images = get_post_meta( $post_id, '_product_image' );
309
+ if ( !empty( $images ) ) {
310
+ update_post_meta( $post_id, '_product_image_gallery', implode(',', $images) );
311
+ }
312
  }
313
 
314
  /**
322
  $visibility = get_post_meta( $post_id, '_visibility', true );
323
 
324
  $product = wc_get_product( $post_id );
325
+ if ( !empty( $visibility ) ) {
326
+ $product->set_catalog_visibility( $visibility );
327
+ }
328
  $product->save();
329
  }
330
  }
includes/setup-wizard.php ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Setup wizard class
4
+ *
5
+ * Walkthrough to the basic setup upon installation
6
+ */
7
+
8
+ /**
9
+ * The class
10
+ */
11
+ class WPUF_Setup_Wizard {
12
+ /** @var string Currenct Step */
13
+ protected $step = '';
14
+
15
+ /** @var array Steps for the setup wizard */
16
+ protected $steps = array();
17
+
18
+ /**
19
+ * Hook in tabs.
20
+ */
21
+ public function __construct() {
22
+ add_action( 'admin_menu', array( $this, 'admin_menus' ) );
23
+ add_action( 'admin_init', array( $this, 'setup_wizard' ), 99 );
24
+ add_action( 'admin_init', array( $this, 'redirect_to_page' ), 9999 );
25
+ }
26
+
27
+ /**
28
+ * Enqueue scripts & styles from wpuf plugin.
29
+ *
30
+ * @return void
31
+ */
32
+ public function enqueue_scripts() {
33
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
34
+
35
+ wp_register_script( 'jquery-blockui', WPUF_ASSET_URI . '/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array( 'jquery' ), '2.70', true );
36
+ wp_register_script( 'selectWPUF', WPUF_ASSET_URI . '/js/selectWPUF/selectWPUF.full' . $suffix . '.js', array( 'jquery' ), '1.0.1' );
37
+ wp_register_script( 'wpuf-enhanced-select', WPUF_ASSET_URI . '/js/admin/wpuf-enhanced-select' . $suffix . '.js', array( 'jquery', 'selectWPUF' ) );
38
+ wp_localize_script( 'wpuf-enhanced-select', 'wpuf_enhanced_select_params', array(
39
+ 'i18n_matches_1' => _x( 'One result is available, press enter to select it.', 'enhanced select', 'wpuf' ),
40
+ 'i18n_matches_n' => _x( '%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'wpuf' ),
41
+ 'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'wpuf' ),
42
+ 'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'wpuf' ),
43
+ 'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'wpuf' ),
44
+ 'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'wpuf' ),
45
+ 'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'wpuf' ),
46
+ 'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'wpuf' ),
47
+ 'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'wpuf' ),
48
+ 'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'wpuf' ),
49
+ 'i18n_load_more' => _x( 'Loading more results&hellip;', 'enhanced select', 'wpuf' ),
50
+ 'i18n_searching' => _x( 'Searching&hellip;', 'enhanced select', 'wpuf' ),
51
+ 'ajax_url' => admin_url( 'admin-ajax.php' ),
52
+ ) );
53
+
54
+ wp_enqueue_style( 'wpuf_admin_styles', WPUF_ASSET_URI . '/css/admin/admin.css', array() );
55
+ wp_enqueue_style( 'wpuf-setup', WPUF_ASSET_URI . '/css/admin/wpuf-setup.css', array( 'dashicons', 'install' ) );
56
+
57
+ wp_register_script( 'wpuf-setup', WPUF_ASSET_URI . '/js/admin/wpuf-setup' . $suffix . '.js', array( 'jquery', 'wpuf-enhanced-select', 'jquery-blockui' ) );
58
+ wp_localize_script( 'wpuf-setup', 'wpuf_setup_params', array() );
59
+ }
60
+
61
+ /**
62
+ * Add admin menus/screens.
63
+ */
64
+ public function admin_menus() {
65
+ add_dashboard_page( '', '', 'manage_options', 'wpuf-setup', '' );
66
+ }
67
+
68
+ /**
69
+ * Redirect to the welcome page once the plugin is installed
70
+ *
71
+ * @return void
72
+ */
73
+ public function redirect_to_page() {
74
+ if ( ! get_transient( 'wpuf_activation_redirect' ) ) {
75
+ return;
76
+ }
77
+
78
+ delete_transient( 'wpuf_activation_redirect' );
79
+
80
+ // Only do this for single site installs.
81
+ if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
82
+ return;
83
+ }
84
+
85
+ wp_safe_redirect( admin_url( 'index.php?page=wpuf-setup' ) );
86
+ exit;
87
+ }
88
+
89
+ /**
90
+ * Show the setup wizard.
91
+ */
92
+ public function setup_wizard() {
93
+ if ( empty( $_GET['page'] ) || 'wpuf-setup' !== $_GET['page'] ) {
94
+ return;
95
+ }
96
+ $this->steps = array(
97
+ 'introduction' => array(
98
+ 'name' => __( 'Introduction', 'wpuf' ),
99
+ 'view' => array( $this, 'wpuf_setup_introduction' ),
100
+ 'handler' => ''
101
+ ),
102
+ 'basic' => array(
103
+ 'name' => __( 'Settings', 'wpuf' ),
104
+ 'view' => array( $this, 'wpuf_setup_basic' ),
105
+ 'handler' => array( $this, 'wpuf_setup_basic_save' ),
106
+ ),
107
+ 'next_steps' => array(
108
+ 'name' => __( 'Ready!', 'wpuf' ),
109
+ 'view' => array( $this, 'wpuf_setup_ready' ),
110
+ 'handler' => ''
111
+ )
112
+ );
113
+ $this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
114
+
115
+ $this->enqueue_scripts();
116
+
117
+ if ( ! empty( $_POST['save_step'] ) && isset( $this->steps[ $this->step ]['handler'] ) ) { // WPCS: CSRF ok.
118
+ call_user_func( $this->steps[ $this->step ]['handler'] );
119
+ }
120
+
121
+ ob_start();
122
+ $this->setup_wizard_header();
123
+ $this->setup_wizard_steps();
124
+ $this->setup_wizard_content();
125
+ $this->setup_wizard_footer();
126
+ exit;
127
+ }
128
+
129
+ public function get_next_step_link() {
130
+ $keys = array_keys( $this->steps );
131
+
132
+ return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
133
+ }
134
+
135
+ /**
136
+ * Setup Wizard Header.
137
+ */
138
+ public function setup_wizard_header() {
139
+ ?>
140
+ <!DOCTYPE html>
141
+ <html <?php language_attributes(); ?>>
142
+ <head>
143
+ <meta name="viewport" content="width=device-width" />
144
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
145
+ <title><?php _e( 'WPUF &rsaquo; Setup Wizard', 'wpuf' ); ?></title>
146
+ <?php wp_print_scripts( 'wpuf-setup' ); ?>
147
+ <?php do_action( 'admin_print_styles' ); ?>
148
+ <?php do_action( 'admin_head' ); ?>
149
+ <?php do_action( 'wpuf_setup_wizard_styles' ); ?>
150
+ <style type="text/css">
151
+ .wpuf-setup-steps {
152
+ justify-content: center;
153
+ }
154
+ .wpuf-setup-content a {
155
+ color: #7dc443;
156
+ }
157
+ .wpuf-setup-steps li.active:before {
158
+ border-color: #7dc443;
159
+ }
160
+ .wpuf-setup-steps li.active {
161
+ border-color: #7dc443;
162
+ color: #7dc443;
163
+ }
164
+ .wpuf-setup-steps li.done:before {
165
+ border-color: #7dc443;
166
+ }
167
+ .wpuf-setup-steps li.done {
168
+ border-color: #7dc443;
169
+ color: #7dc443;
170
+ }
171
+ .wpuf-setup .wpuf-setup-actions .button-primary, .wpuf-setup .wpuf-setup-actions .button-primary, .wpuf-setup .wpuf-setup-actions .button-primary {
172
+ background: #7dc443 !important;
173
+ }
174
+ .wpuf-setup .wpuf-setup-actions .button-primary:active, .wpuf-setup .wpuf-setup-actions .button-primary:focus, .wpuf-setup .wpuf-setup-actions .button-primary:hover {
175
+ background: #63bf17 !important;
176
+ border-color: #63bf17 !important;
177
+ }
178
+ .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a, .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a, .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a {
179
+ background: #7dc443 !important;
180
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #7dc443;
181
+ }
182
+ .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a:active, .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a:focus, .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a:hover {
183
+ background: #19ca4f !important;
184
+ border-color: #19ca4f !important;
185
+ box-shadow: inset 0 1px 0 rgba(255,255,255,.25),0 1px 0 #19ca4f;
186
+ }
187
+ .wpuf-setup .wpuf-setup-actions .button-primary {
188
+ border-color: #7dc443 !important;
189
+ }
190
+ .wpuf-setup-content .wpuf-setup-next-steps ul .setup-product a {
191
+ border-color: #7dc443 !important;
192
+ }
193
+ ul.wpuf-wizard-payment-gateways li.wpuf-wizard-gateway .wpuf-wizard-gateway-enable input:checked+label:before {
194
+ background: #7dc443 !important;
195
+ border-color: #7dc443 !important;
196
+ }
197
+ </style>
198
+ </head>
199
+ <body class="wpuf-setup wp-core-ui">
200
+ <h1 id="wpuf-logo"><a href="https://wedevs.com/wp-user-frontend-pro/"><img src="<?php echo WPUF_ASSET_URI . '/images/icon-128x128.png'; ?>" alt="WPUF" /></a></h1>
201
+ <?php
202
+ }
203
+
204
+ /**
205
+ * Setup Wizard Footer.
206
+ */
207
+ public function setup_wizard_footer() {
208
+ ?>
209
+ <?php if ( 'next_steps' === $this->step ) : ?>
210
+ <a class="wpuf-return-to-dashboard" href="<?php echo esc_url( admin_url() ); ?>"><?php _e( 'Return to the WordPress Dashboard', 'wpuf' ); ?></a>
211
+ <?php endif; ?>
212
+ </body>
213
+ </html>
214
+ <?php
215
+ }
216
+
217
+ /**
218
+ * Output the steps.
219
+ */
220
+ public function setup_wizard_steps() {
221
+ $ouput_steps = $this->steps;
222
+ array_shift( $ouput_steps );
223
+ ?>
224
+ <ol class="wpuf-setup-steps">
225
+ <?php foreach ( $ouput_steps as $step_key => $step ) : ?>
226
+ <li class="<?php
227
+ if ( $step_key === $this->step ) {
228
+ echo 'active';
229
+ } elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
230
+ echo 'done';
231
+ }
232
+ ?>"><?php echo esc_html( $step['name'] ); ?></li>
233
+ <?php endforeach; ?>
234
+ </ol>
235
+ <?php
236
+ }
237
+
238
+ /**
239
+ * Output the content for the current step.
240
+ */
241
+ public function setup_wizard_content() {
242
+ echo '<div class="wpuf-setup-content">';
243
+ call_user_func( $this->steps[ $this->step ]['view'] );
244
+ echo '</div>';
245
+ }
246
+
247
+ /**
248
+ * Introduction step.
249
+ */
250
+ public function wpuf_setup_introduction() {
251
+ ?>
252
+ <h1><?php _e( 'Welcome to the world of WPUF!', 'wpuf' ); ?></h1>
253
+ <p><?php _e( 'Thank you for choosing WPUF to power your websites frontend! This quick setup wizard will help you configure the basic settings. <strong>It’s completely optional and shouldn’t take longer than a minute.</strong>', 'wpuf' ); ?></p>
254
+ <p><?php _e( 'No time right now? If you don’t want to go through the wizard, you can skip and return to the WordPress dashboard. Come back anytime if you change your mind!', 'wpuf' ); ?></p>
255
+ <p class="wpuf-setup-actions step">
256
+ <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large button-next"><?php _e( 'Let\'s Go!', 'wpuf' ); ?></a>
257
+ <a href="<?php echo esc_url( admin_url() ); ?>" class="button button-large"><?php _e( 'Not right now', 'wpuf' ); ?></a>
258
+ </p>
259
+ <?php
260
+ }
261
+
262
+ /**
263
+ * Selling step.
264
+ */
265
+ public function wpuf_setup_basic() {
266
+ $enable_payment = wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' );
267
+ $install_wpuf_pages = wpuf_get_option( 'install_wpuf_pages', 'wpuf_general', 'on' );
268
+ ?>
269
+ <h1><?php _e( 'Basic Setting', 'wpuf' ); ?></h1>
270
+ <form method="post">
271
+ <table class="form-table">
272
+ <tr>
273
+ <th scope="row"><label for="enable_payment"><?php _e( 'Enable Payments', 'wpuf' ); ?></label></th>
274
+ <td>
275
+ <input type="checkbox" name="enable_payment" id="enable_payment" class="input-checkbox" value="1" <?php echo ( $enable_payment == 'on' ) ? 'checked="checked"' : ''; ?>/>
276
+ <label for="enable_payment"><?php _e( 'Make payment enable for user to add posts on frontend.', 'wpuf' ); ?></label>
277
+ </td>
278
+ </tr>
279
+ <tr>
280
+ <th scope="row"><label for="install_wpuf_pages"><?php _e( 'Install WPUF Pages', 'wpuf' ); ?></label></th>
281
+ <td>
282
+ <input type="checkbox" name="install_wpuf_pages" id="install_wpuf_pages" class="input-checkbox" value="1" <?php echo ( $install_wpuf_pages == 'on' ) ? 'checked="checked"' : ''; ?>/>
283
+ <label for="install_wpuf_pages"><?php _e( 'Install neccessery pages on your site frontend.', 'wpuf' ); ?></label>
284
+ </td>
285
+ </tr>
286
+ </table>
287
+ <p class="wpuf-setup-actions step">
288
+ <input type="submit" class="button-primary button button-large button-next" value="<?php esc_attr_e( 'Continue', 'wpuf' ); ?>" name="save_step" />
289
+ <a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next"><?php _e( 'Skip this step', 'wpuf' ); ?></a>
290
+ <?php wp_nonce_field( 'wpuf-setup' ); ?>
291
+ </p>
292
+ </form>
293
+ <?php
294
+ }
295
+
296
+ /**
297
+ * Save selling options.
298
+ */
299
+ public function wpuf_setup_basic_save() {
300
+ check_admin_referer( 'wpuf-setup' );
301
+ $payment_options = get_option( 'wpuf_payment' );
302
+ $general_options = get_option( 'wpuf_general' );
303
+ $payment_options['enable_payment'] = isset( $_POST['enable_payment'] ) ? 'on' : 'off';
304
+ $general_options['install_wpuf_pages'] = isset( $_POST['install_wpuf_pages'] ) ? 'on' : 'off';
305
+
306
+ update_option( 'wpuf_payment', $payment_options );
307
+ update_option( 'wpuf_general', $general_options );
308
+
309
+ if ( 'on' == $general_options['install_wpuf_pages'] ) {
310
+ $installer = new WPUF_Admin_Installer();
311
+ $installer->init_pages();
312
+ }
313
+
314
+ wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
315
+ exit;
316
+ }
317
+
318
+ /**
319
+ * Final step.
320
+ */
321
+ public function wpuf_setup_ready() {
322
+ ?>
323
+ <h1><?php _e( 'Thank you!', 'wpuf' ); ?></h1>
324
+
325
+ <div class="wpuf-setup-next-steps">
326
+ <div class="wpuf-setup-next-steps-first">
327
+ <ul>
328
+ <li class="setup-product"><a class="button button-primary button-large" href="<?php echo esc_url( admin_url( 'admin.php?page=wpuf-welcome' ) ); ?>"><?php _e( 'Welcome to Awesomeness!', 'wpuf' ); ?></a></li>
329
+ </ul>
330
+ </div>
331
+ <div class="wpuf-setup-next-steps-last">
332
+ <h2><a href="<?php echo esc_url( admin_url( 'admin.php?page=wpuf-settings' ) ); ?>"><?php _e( 'Go to Full Settings', 'wpuf' ); ?></a></h2>
333
+ </div>
334
+ </div>
335
+ <?php
336
+ }
337
+ }
338
+
339
+ new WPUF_Setup_Wizard();
includes/upgrades/upgrade-2.8.0.php CHANGED
@@ -29,7 +29,7 @@ function wpuf_upgrade_2_8_update_new_options() {
29
 
30
  function wpuf_upgrade_2_8_update_mail_options() {
31
  $old_mail_options = get_option( 'wpuf_guest_mails' );
32
-
33
  if ( !empty ( $old_mail_options ) ) {
34
  add_option( 'wpuf_mails', $old_mail_options );
35
  }
29
 
30
  function wpuf_upgrade_2_8_update_mail_options() {
31
  $old_mail_options = get_option( 'wpuf_guest_mails' );
32
+
33
  if ( !empty ( $old_mail_options ) ) {
34
  add_option( 'wpuf_mails', $old_mail_options );
35
  }
languages/wpuf.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL2 or later.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP User Frontend 2.8.0\n"
6
  "Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
7
- "POT-Creation-Date: 2018-01-06 15:58:06+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -48,38 +48,38 @@ msgstr ""
48
  msgid "Subscriptions"
49
  msgstr ""
50
 
51
- #: admin/class-admin-settings.php:105 admin/class-tools.php:378
52
  #: admin/transactions.php:2
53
  msgid "Transactions"
54
  msgstr ""
55
 
56
- #: admin/class-admin-settings.php:106 admin/tools.php:13
57
  msgid "Tools"
58
  msgstr ""
59
 
60
- #: admin/class-admin-settings.php:111
61
  msgid "Premium"
62
  msgstr ""
63
 
64
- #: admin/class-admin-settings.php:113
65
  msgid "Help"
66
  msgstr ""
67
 
68
- #: admin/class-admin-settings.php:113
69
  msgid "<span style=\"color:#f18500\">Help</span>"
70
  msgstr ""
71
 
72
- #: admin/class-admin-settings.php:114 admin/class-admin-settings.php:151
73
- #: admin/form-builder/views/form-builder.php:9
74
  msgid "Settings"
75
  msgstr ""
76
 
77
- #: admin/class-admin-settings.php:116 admin/class-admin-subscription.php:185
78
  #: admin/subscribers.php:18
79
  msgid "Subscribers"
80
  msgstr ""
81
 
82
- #: admin/class-admin-settings.php:372
83
  msgid "Number of items per page:"
84
  msgstr ""
85
 
@@ -136,7 +136,7 @@ msgid "Duration"
136
  msgstr ""
137
 
138
  #: admin/class-admin-subscription.php:206
139
- #: admin/class-admin-subscription.php:560 class/frontend-account.php:134
140
  #: class/subscription.php:844 class/subscription.php:857
141
  #: includes/class-user-subscription.php:301
142
  msgid "Free"
@@ -147,11 +147,10 @@ msgstr ""
147
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:140
148
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:526
149
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:584
150
- #: admin/post-forms-list-table.php:345 admin/settings-options.php:101
151
- #: admin/settings-options.php:193 admin/settings-options.php:204
152
- #: admin/settings-options.php:263 admin/settings-options.php:274
153
- #: admin/settings-options.php:285 admin/template.php:70
154
- #: includes/free/form-element.php:477
155
  msgid "Yes"
156
  msgstr ""
157
 
@@ -160,11 +159,10 @@ msgstr ""
160
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:141
161
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:527
162
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:585
163
- #: admin/post-forms-list-table.php:346 admin/settings-options.php:102
164
- #: admin/settings-options.php:194 admin/settings-options.php:205
165
- #: admin/settings-options.php:264 admin/settings-options.php:275
166
- #: admin/settings-options.php:286 admin/template.php:71
167
- #: includes/free/form-element.php:478
168
  msgid "No"
169
  msgstr ""
170
 
@@ -394,6 +392,7 @@ msgid ""
394
  msgstr ""
395
 
396
  #: admin/class-tools.php:351 admin/installer.php:30
 
397
  msgid "Install WPUF Pages"
398
  msgstr ""
399
 
@@ -503,7 +502,7 @@ msgstr ""
503
  msgid "Insert Photo"
504
  msgstr ""
505
 
506
- #: admin/form-builder/assets/js/components/form-taxonomy/template.php:12
507
  msgid "— Select —"
508
  msgstr ""
509
 
@@ -788,6 +787,7 @@ msgstr ""
788
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:307
789
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:455
790
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:498
 
791
  msgid "- select -"
792
  msgstr ""
793
 
@@ -808,12 +808,12 @@ msgid "Add options for the form field"
808
  msgstr ""
809
 
810
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:428
811
- #: admin/template.php:449 admin/template.php:481
812
  msgid "Select Text"
813
  msgstr ""
814
 
815
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:432
816
- #: admin/template.php:438 admin/template.php:470
817
  msgid ""
818
  "First element of the select dropdown. Leave this empty if you don't want to "
819
  "show this field"
@@ -833,11 +833,13 @@ msgstr ""
833
 
834
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:523
835
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:581
 
836
  msgid "Show in inline list"
837
  msgstr ""
838
 
839
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:533
840
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:591
 
841
  msgid "Show this option in an inline list"
842
  msgstr ""
843
 
@@ -918,7 +920,7 @@ msgstr ""
918
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:902
919
  #: admin/template.php:544 admin/template.php:604 admin/template.php:683
920
  #: class/upload.php:164 templates/dashboard/posts.php:75
921
- #: templates/dashboard.php:73 wpuf-functions.php:730
922
  msgid "Title"
923
  msgstr ""
924
 
@@ -928,7 +930,7 @@ msgid "Title of the section"
928
  msgstr ""
929
 
930
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:825
931
- #: admin/template.php:609 class/upload.php:166 wpuf-functions.php:736
932
  msgid "Description"
933
  msgstr ""
934
 
@@ -1196,79 +1198,79 @@ msgstr ""
1196
  msgid "Ajax"
1197
  msgstr ""
1198
 
1199
- #: admin/form.php:783 admin/template-post.php:165
1200
  msgid "Order By"
1201
  msgstr ""
1202
 
1203
- #: admin/form.php:786 admin/html/form-submission-restriction.php:11
1204
  #: admin/template-post.php:167 includes/free/edit-profile.php:97
1205
  #: templates/registration-form.php:27
1206
  msgid "Name"
1207
  msgstr ""
1208
 
1209
- #: admin/form.php:787 admin/template-post.php:168
1210
  msgid "Term ID"
1211
  msgstr ""
1212
 
1213
- #: admin/form.php:788 admin/template-post.php:169
1214
  msgid "Slug"
1215
  msgstr ""
1216
 
1217
- #: admin/form.php:789 admin/template-post.php:170
1218
  msgid "Count"
1219
  msgstr ""
1220
 
1221
- #: admin/form.php:790 admin/template-post.php:171
1222
  msgid "Term Group"
1223
  msgstr ""
1224
 
1225
- #: admin/form.php:799 admin/template-post.php:176
1226
  msgid "Order"
1227
  msgstr ""
1228
 
1229
- #: admin/form.php:803 admin/template-post.php:178
1230
  msgid "ASC"
1231
  msgstr ""
1232
 
1233
- #: admin/form.php:804 admin/template-post.php:179
1234
  msgid "DESC"
1235
  msgstr ""
1236
 
1237
- #: admin/form.php:813 admin/template-post.php:184
1238
  msgid "Selection Type"
1239
  msgstr ""
1240
 
1241
- #: admin/form.php:816 admin/template-post.php:186
1242
  msgid "Exclude"
1243
  msgstr ""
1244
 
1245
- #: admin/form.php:817 admin/template-post.php:187
1246
  msgid "Include"
1247
  msgstr ""
1248
 
1249
- #: admin/form.php:818 admin/template-post.php:188
1250
  msgid "Child of"
1251
  msgstr ""
1252
 
1253
- #: admin/form.php:827
1254
  msgid "Selection Terms"
1255
  msgstr ""
1256
 
1257
- #: admin/form.php:831 admin/template-post.php:194
1258
  msgid ""
1259
  "Enter the term IDs as comma separated (without space) to exclude/include in "
1260
  "the form."
1261
  msgstr ""
1262
 
1263
- #: admin/form.php:839 admin/template-post.php:204
1264
  msgid "This taxonomy is a WooCommerce attribute"
1265
  msgstr ""
1266
 
1267
- #: admin/form.php:850 admin/template-post.php:216
1268
  msgid "Visible on product page"
1269
  msgstr ""
1270
 
1271
- #: admin/form.php:900
1272
  msgid "Post Forms must have either Post Title, Post Body or Excerpt field"
1273
  msgstr ""
1274
 
@@ -1296,7 +1298,8 @@ msgstr ""
1296
  msgid "Payment Options"
1297
  msgstr ""
1298
 
1299
- #: admin/html/form-settings-payment.php:25
 
1300
  msgid "Enable Payments"
1301
  msgstr ""
1302
 
@@ -1378,32 +1381,32 @@ msgid "No Change"
1378
  msgstr ""
1379
 
1380
  #: admin/html/form-settings-post-edit.php:30
1381
- #: admin/html/form-settings-post.php:106 includes/free/form-element.php:376
1382
  msgid "Redirect To"
1383
  msgstr ""
1384
 
1385
  #: admin/html/form-settings-post-edit.php:35
1386
- #: admin/html/form-settings-post.php:111
1387
  msgid "Newly created post"
1388
  msgstr ""
1389
 
1390
  #: admin/html/form-settings-post-edit.php:36
1391
- #: admin/html/form-settings-post.php:112 includes/free/form-element.php:381
1392
  msgid "Same Page"
1393
  msgstr ""
1394
 
1395
  #: admin/html/form-settings-post-edit.php:37
1396
- #: admin/html/form-settings-post.php:113 includes/free/form-element.php:382
1397
  msgid "To a page"
1398
  msgstr ""
1399
 
1400
  #: admin/html/form-settings-post-edit.php:38
1401
- #: admin/html/form-settings-post.php:114 includes/free/form-element.php:383
1402
  msgid "To a custom URL"
1403
  msgstr ""
1404
 
1405
  #: admin/html/form-settings-post-edit.php:47
1406
- #: admin/html/form-settings-post.php:123 includes/free/form-element.php:392
1407
  msgid "After successfull submit, where the page will redirect to"
1408
  msgstr ""
1409
 
@@ -1412,12 +1415,12 @@ msgid "Post Update Message"
1412
  msgstr ""
1413
 
1414
  #: admin/html/form-settings-post-edit.php:60
1415
- #: admin/html/form-settings-post.php:136 includes/free/form-element.php:412
1416
  msgid "Page"
1417
  msgstr ""
1418
 
1419
  #: admin/html/form-settings-post-edit.php:75
1420
- #: admin/html/form-settings-post.php:151 includes/free/form-element.php:427
1421
  msgid "Custom URL"
1422
  msgstr ""
1423
 
@@ -1461,7 +1464,7 @@ msgstr ""
1461
  msgid "Post Format"
1462
  msgstr ""
1463
 
1464
- #: admin/html/form-settings-post.php:74 admin/html/form-settings-post.php:97
1465
  msgid "- None -"
1466
  msgstr ""
1467
 
@@ -1469,41 +1472,41 @@ msgstr ""
1469
  msgid "Default Post Category"
1470
  msgstr ""
1471
 
1472
- #: admin/html/form-settings-post.php:101
1473
  msgid ""
1474
  "If users are not allowed to choose any category, this category will be used "
1475
  "instead (if post type supports)"
1476
  msgstr ""
1477
 
1478
- #: admin/html/form-settings-post.php:129
1479
  msgid "Message to show"
1480
  msgstr ""
1481
 
1482
- #: admin/html/form-settings-post.php:158
1483
  msgid "Comment Status"
1484
  msgstr ""
1485
 
1486
- #: admin/html/form-settings-post.php:161
1487
  msgid "Open"
1488
  msgstr ""
1489
 
1490
- #: admin/html/form-settings-post.php:162
1491
  msgid "Closed"
1492
  msgstr ""
1493
 
1494
- #: admin/html/form-settings-post.php:168
1495
  msgid "Submit Post Button text"
1496
  msgstr ""
1497
 
1498
- #: admin/html/form-settings-post.php:175
1499
  msgid "Post Draft"
1500
  msgstr ""
1501
 
1502
- #: admin/html/form-settings-post.php:180
1503
  msgid "Enable Saving as draft"
1504
  msgstr ""
1505
 
1506
- #: admin/html/form-settings-post.php:182
1507
  msgid "It will show a button to save as draft"
1508
  msgstr ""
1509
 
@@ -1808,62 +1811,42 @@ msgid "Contact Support"
1808
  msgstr ""
1809
 
1810
  #: admin/html/whats-new.php:8
1811
- msgid "Manage schedule for form submission"
1812
  msgstr ""
1813
 
1814
  #: admin/html/whats-new.php:10
1815
- msgid ""
1816
- "Do not accept form submission if the current date is not between the date "
1817
- "range of the schedule."
1818
  msgstr ""
1819
 
1820
  #: admin/html/whats-new.php:14
1821
- msgid "Restrict form submission based on the user roles"
1822
  msgstr ""
1823
 
1824
  #: admin/html/whats-new.php:16
1825
- msgid ""
1826
- "Restrict form submission based on the user roles. Now you can manage user "
1827
- "role base permission on form submission."
1828
  msgstr ""
1829
 
1830
  #: admin/html/whats-new.php:20
1831
- msgid "Limit how many entries a form will accept"
1832
  msgstr ""
1833
 
1834
  #: admin/html/whats-new.php:22
1835
  msgid ""
1836
- "Limit how many entries a form will accept and display a custom message when "
1837
- "that limit is reached."
1838
  msgstr ""
1839
 
1840
- #: admin/html/whats-new.php:26
1841
- msgid "Show/hide Admin Bar"
1842
  msgstr ""
1843
 
1844
- #: admin/html/whats-new.php:28
1845
- msgid "Control the admin bar visibility based on user roles."
1846
- msgstr ""
1847
-
1848
- #: admin/html/whats-new.php:32
1849
- msgid "Ajax Login widget"
1850
- msgstr ""
1851
-
1852
- #: admin/html/whats-new.php:34
1853
  msgid ""
1854
- "Login user is more simple now with Ajax Login Widget. The simple ajax login "
1855
- "form do not required page loading for login."
1856
- msgstr ""
1857
-
1858
- #: admin/html/whats-new.php:38
1859
- msgid "Form submission with Captcha field"
1860
  msgstr ""
1861
 
1862
- #: admin/html/whats-new.php:40
1863
- msgid "Form field validation process updated if form submits with captcha field."
1864
- msgstr ""
1865
-
1866
- #: admin/html/whats-new.php:54
1867
  msgid "What's New in WPUF?"
1868
  msgstr ""
1869
 
@@ -1888,7 +1871,7 @@ msgid ""
1888
  msgstr ""
1889
 
1890
  #: admin/installer.php:73 admin/settings-options.php:23
1891
- #: includes/free/admin/shortcode-button.php:82 wpuf-functions.php:1422
1892
  msgid "Dashboard"
1893
  msgstr ""
1894
 
@@ -1901,50 +1884,50 @@ msgstr ""
1901
  msgid "Login"
1902
  msgstr ""
1903
 
1904
- #: admin/installer.php:83 class/subscription.php:356 class/subscription.php:376
1905
  #: class/subscription.php:377 class/subscription.php:378
1906
- #: includes/free/admin/shortcode-button.php:102 wpuf-functions.php:1425
1907
  msgid "Subscription"
1908
  msgstr ""
1909
 
1910
- #: admin/installer.php:83
1911
  msgid "[wpuf_sub_pack]"
1912
  msgstr ""
1913
 
1914
- #: admin/installer.php:84 templates/dashboard/posts.php:82
1915
  #: templates/dashboard.php:109
1916
  msgid "Payment"
1917
  msgstr ""
1918
 
1919
- #: admin/installer.php:84
1920
  msgid "Please select a gateway for payment"
1921
  msgstr ""
1922
 
1923
- #: admin/installer.php:85
1924
  msgid "Thank You"
1925
  msgstr ""
1926
 
1927
- #: admin/installer.php:85
1928
  msgid ""
1929
  "<h1>Payment is complete</h1><p>Congratulations, your payment has been "
1930
  "completed!</p>"
1931
  msgstr ""
1932
 
1933
- #: admin/installer.php:86
1934
  msgid "Order Received"
1935
  msgstr ""
1936
 
1937
- #: admin/installer.php:86
1938
  msgid ""
1939
  "Hi, we have received your order. We will validate the order and will take "
1940
  "necessary steps to move forward."
1941
  msgstr ""
1942
 
1943
- #: admin/installer.php:165 includes/free/admin/shortcode-button.php:98
1944
  msgid "Registration"
1945
  msgstr ""
1946
 
1947
- #: admin/installer.php:174
1948
  msgid "Sample Form"
1949
  msgstr ""
1950
 
@@ -1999,23 +1982,23 @@ msgid "Draft"
1999
  msgstr ""
2000
 
2001
  #: admin/posting.php:66 class/asset-loader.php:51 class/render-form.php:1597
2002
- #: wpuf.php:481
2003
  msgid "Are you sure?"
2004
  msgstr ""
2005
 
2006
- #: admin/posting.php:72 class/asset-loader.php:57 wpuf.php:489
2007
  msgid "Allowed Files"
2008
  msgstr ""
2009
 
2010
- #: admin/posting.php:75 class/asset-loader.php:60 wpuf.php:495
2011
  msgid "Maximum number of files reached!"
2012
  msgstr ""
2013
 
2014
- #: admin/posting.php:76 class/asset-loader.php:61 wpuf.php:496
2015
  msgid "The file you have uploaded exceeds the file size limit. Please try again."
2016
  msgstr ""
2017
 
2018
- #: admin/posting.php:77 class/asset-loader.php:62 wpuf.php:497
2019
  msgid "You have uploaded an incorrect file type. Please try again."
2020
  msgstr ""
2021
 
@@ -2568,183 +2551,171 @@ msgid ""
2568
  "<code>[wpuf_account]</code> is located"
2569
  msgstr ""
2570
 
2571
- #: admin/settings-options.php:269
2572
- msgid "Show Invoice"
2573
- msgstr ""
2574
-
2575
- #: admin/settings-options.php:270
2576
- msgid ""
2577
- "Show Invoice tab in \"my account\" page where <code>[wpuf_account]</code> "
2578
- "is located"
2579
- msgstr ""
2580
-
2581
- #: admin/settings-options.php:280
2582
- msgid "Show Billing Address"
2583
- msgstr ""
2584
-
2585
- #: admin/settings-options.php:281
2586
- msgid ""
2587
- "Show Billing Address tab in \"my account\" page where "
2588
- "<code>[wpuf_account]</code> is located"
2589
- msgstr ""
2590
-
2591
- #: admin/settings-options.php:293
2592
  msgid "Auto Login After Registration"
2593
  msgstr ""
2594
 
2595
- #: admin/settings-options.php:294
2596
  msgid "If enabled, users after registration will be logged in to the system"
2597
  msgstr ""
2598
 
2599
- #: admin/settings-options.php:300
2600
  msgid "Login/Registration override"
2601
  msgstr ""
2602
 
2603
- #: admin/settings-options.php:301
2604
  msgid ""
2605
  "If enabled, default login and registration forms will be overridden by WPUF "
2606
  "with pages below"
2607
  msgstr ""
2608
 
2609
- #: admin/settings-options.php:307
2610
  msgid "Registration Page"
2611
  msgstr ""
2612
 
2613
- #: admin/settings-options.php:308
2614
  msgid ""
2615
  "Select the page you want to use as registration page override <em>(should "
2616
  "have shortcode)</em>"
2617
  msgstr ""
2618
 
2619
- #: admin/settings-options.php:314
2620
  msgid "Login Page"
2621
  msgstr ""
2622
 
2623
- #: admin/settings-options.php:315
2624
  msgid "Select the page which contains <code>[wpuf-login]</code> shortcode"
2625
  msgstr ""
2626
 
2627
- #: admin/settings-options.php:323
 
 
 
 
2628
  msgid "Subscription Pack Page"
2629
  msgstr ""
2630
 
2631
- #: admin/settings-options.php:324
2632
  msgid "Select the page where <code>[wpuf_sub_pack]</code> located."
2633
  msgstr ""
2634
 
2635
- #: admin/settings-options.php:330
2636
  msgid "Subscription at registration"
2637
  msgstr ""
2638
 
2639
- #: admin/settings-options.php:331
2640
  msgid "Registration time redirect to subscription page"
2641
  msgstr ""
2642
 
2643
- #: admin/settings-options.php:336
2644
  msgid "Currency"
2645
  msgstr ""
2646
 
2647
- #: admin/settings-options.php:343
2648
  msgid "Currency Position"
2649
  msgstr ""
2650
 
2651
- #: admin/settings-options.php:347
2652
  msgid "Left"
2653
  msgstr ""
2654
 
2655
- #: admin/settings-options.php:348
2656
  msgid "Right"
2657
  msgstr ""
2658
 
2659
- #: admin/settings-options.php:349
2660
  msgid "Left with space"
2661
  msgstr ""
2662
 
2663
- #: admin/settings-options.php:350
2664
  msgid "Right with space"
2665
  msgstr ""
2666
 
2667
- #: admin/settings-options.php:355
2668
  msgid "Thousand Separator"
2669
  msgstr ""
2670
 
2671
- #: admin/settings-options.php:356
2672
  msgid "This sets the thousand separator of displayed prices."
2673
  msgstr ""
2674
 
2675
- #: admin/settings-options.php:364
2676
  msgid "Decimal Separator"
2677
  msgstr ""
2678
 
2679
- #: admin/settings-options.php:365
2680
  msgid "This sets the decimal separator of displayed prices."
2681
  msgstr ""
2682
 
2683
- #: admin/settings-options.php:372
2684
  msgid "Number of Decimals"
2685
  msgstr ""
2686
 
2687
- #: admin/settings-options.php:373
2688
  msgid "This sets the number of decimal points shown in displayed prices."
2689
  msgstr ""
2690
 
2691
- #: admin/settings-options.php:383
2692
  msgid "Enable demo/sandbox mode"
2693
  msgstr ""
2694
 
2695
- #: admin/settings-options.php:384
2696
  msgid "When sandbox mode is active, all payment gateway will be used in demo mode"
2697
  msgstr ""
2698
 
2699
- #: admin/settings-options.php:390
2700
  msgid "Payment Page"
2701
  msgstr ""
2702
 
2703
- #: admin/settings-options.php:391
2704
  msgid "This page will be used to process payment options"
2705
  msgstr ""
2706
 
2707
- #: admin/settings-options.php:397
2708
  msgid "Payment Success Page"
2709
  msgstr ""
2710
 
2711
- #: admin/settings-options.php:398 lib/gateway/bank.php:37
2712
  msgid "After payment users will be redirected here"
2713
  msgstr ""
2714
 
2715
- #: admin/settings-options.php:404
2716
  msgid "Payment Gateways"
2717
  msgstr ""
2718
 
2719
- #: admin/settings-options.php:405
2720
  msgid "Active payment gateways"
2721
  msgstr ""
2722
 
2723
- #: admin/settings-options.php:413
 
 
 
 
2724
  msgid "Guest mail subject"
2725
  msgstr ""
2726
 
2727
- #: admin/settings-options.php:414
2728
  msgid "This sets the subject of the emails sent to guest users"
2729
  msgstr ""
2730
 
2731
- #: admin/settings-options.php:420
2732
  msgid "Guest mail body"
2733
  msgstr ""
2734
 
2735
- #: admin/settings-options.php:421
2736
  msgid ""
2737
  "This sets the body of the emails sent to guest users. Please DON'T edit the "
2738
  "<code>{activation_link}</code> part"
2739
  msgstr ""
2740
 
2741
- #: admin/settings-options.php:444
2742
  msgid ""
2743
  "Select profile/registration forms for user roles. These forms will be used "
2744
  "to populate extra edit profile fields in backend."
2745
  msgstr ""
2746
 
2747
- #: admin/settings-options.php:455
2748
  msgid " - select - "
2749
  msgstr ""
2750
 
@@ -2845,75 +2816,75 @@ msgstr ""
2845
  msgid "Install Now"
2846
  msgstr ""
2847
 
2848
- #: class/asset-loader.php:31 wpuf.php:413
2849
  msgid "is required"
2850
  msgstr ""
2851
 
2852
- #: class/asset-loader.php:32 wpuf.php:414
2853
  msgid "does not match"
2854
  msgstr ""
2855
 
2856
- #: class/asset-loader.php:33 wpuf.php:415
2857
  msgid "is not valid"
2858
  msgstr ""
2859
 
2860
- #: class/asset-loader.php:45 wpuf.php:475
2861
  msgid "Please fix the errors to proceed"
2862
  msgstr ""
2863
 
2864
- #: class/asset-loader.php:47 wpuf.php:477
2865
  msgid "Word limit reached"
2866
  msgstr ""
2867
 
2868
- #: class/frontend-account.php:123
2869
  msgid "<p>You've not subscribed any package yet.</p>"
2870
  msgstr ""
2871
 
2872
- #: class/frontend-account.php:125
2873
  msgid "<p>You've subscribed to the following package.</p>"
2874
  msgstr ""
2875
 
2876
- #: class/frontend-account.php:183 class/subscription.php:73
2877
  msgid "Nonce failure"
2878
  msgstr ""
2879
 
2880
- #: class/frontend-account.php:197
2881
  msgid "First Name is a required field."
2882
  msgstr ""
2883
 
2884
- #: class/frontend-account.php:201
2885
  msgid "Last Name is a required field."
2886
  msgstr ""
2887
 
2888
- #: class/frontend-account.php:205
2889
  msgid "Email is a required field."
2890
  msgstr ""
2891
 
2892
- #: class/frontend-account.php:216
2893
  msgid "Please provide a valid email address."
2894
  msgstr ""
2895
 
2896
- #: class/frontend-account.php:218
2897
  msgid "This email address is already registered."
2898
  msgstr ""
2899
 
2900
- #: class/frontend-account.php:224
2901
  msgid "Please fill out all password fields."
2902
  msgstr ""
2903
 
2904
- #: class/frontend-account.php:227
2905
  msgid "Please enter your current password."
2906
  msgstr ""
2907
 
2908
- #: class/frontend-account.php:230
2909
  msgid "Please re-enter your password."
2910
  msgstr ""
2911
 
2912
- #: class/frontend-account.php:233
2913
  msgid "New passwords do not match."
2914
  msgstr ""
2915
 
2916
- #: class/frontend-account.php:236 class/frontend-account.php:247
2917
  msgid "Your current password is incorrect."
2918
  msgstr ""
2919
 
@@ -2962,15 +2933,15 @@ msgstr ""
2962
  msgid "You can't edit a post while in pending mode."
2963
  msgstr ""
2964
 
2965
- #: class/frontend-form-post.php:298
2966
  msgid "Empty reCaptcha Field"
2967
  msgstr ""
2968
 
2969
- #: class/frontend-form-post.php:329
2970
  msgid "Invalid email address."
2971
  msgstr ""
2972
 
2973
- #: class/frontend-form-post.php:338
2974
  msgid ""
2975
  "You already have an account in our site. Please login to continue.\n"
2976
  "\n"
@@ -2979,15 +2950,15 @@ msgid ""
2979
  "Click 'Cancel' to stay at this page."
2980
  msgstr ""
2981
 
2982
- #: class/frontend-form-post.php:387
2983
  msgid "You do not have sufficient permissions to access this form."
2984
  msgstr ""
2985
 
2986
- #: class/frontend-form-post.php:757
2987
  msgid "Something went wrong"
2988
  msgstr ""
2989
 
2990
- #: class/frontend-form-post.php:1114
2991
  msgid "Email successfully verified. Please Login."
2992
  msgstr ""
2993
 
@@ -3047,11 +3018,11 @@ msgstr ""
3047
  msgid "No Payment gateway found"
3048
  msgstr ""
3049
 
3050
- #: class/payment.php:362 lib/gateway/bank.php:105
3051
  msgid "[%s] Payment Received"
3052
  msgstr ""
3053
 
3054
- #: class/payment.php:363
3055
  msgid "New payment received at %s"
3056
  msgstr ""
3057
 
@@ -3093,7 +3064,7 @@ msgstr ""
3093
  msgid "Strength indicator"
3094
  msgstr ""
3095
 
3096
- #: class/render-form.php:1336 class/render-form.php:1452
3097
  msgid "-- Select --"
3098
  msgstr ""
3099
 
@@ -3261,11 +3232,11 @@ msgstr ""
3261
  msgid "No transactions found."
3262
  msgstr ""
3263
 
3264
- #: class/upload.php:165 wpuf-functions.php:733
3265
  msgid "Caption"
3266
  msgstr ""
3267
 
3268
- #: includes/class-dokan-integration.php:37 wpuf-functions.php:1423
3269
  msgid "Posts"
3270
  msgstr ""
3271
 
@@ -3500,6 +3471,10 @@ msgstr ""
3500
  msgid "Unlimited"
3501
  msgstr ""
3502
 
 
 
 
 
3503
  #: includes/class-whats-new.php:67
3504
  msgid "Whats New"
3505
  msgstr ""
@@ -3564,7 +3539,7 @@ msgstr ""
3564
  msgid "Select a form to insert"
3565
  msgstr ""
3566
 
3567
- #: includes/free/admin/shortcode-builder.php:9 includes/free/loader.php:88
3568
  msgid "Registration Form"
3569
  msgstr ""
3570
 
@@ -3984,43 +3959,43 @@ msgstr ""
3984
  msgid "Update Button text"
3985
  msgstr ""
3986
 
3987
- #: includes/free/loader.php:83 includes/free/loader.php:142
3988
  msgid "Coupons"
3989
  msgstr ""
3990
 
3991
- #: includes/free/loader.php:91
3992
  msgid ""
3993
  "Use the shortcode <code>[wpuf-registration]</code> for a simple and default "
3994
  "WordPress registration form."
3995
  msgstr ""
3996
 
3997
- #: includes/free/loader.php:105
3998
  msgid ""
3999
  "Registration form builder is a two way form which can be used both for "
4000
  "<strong>user registration</strong> and <strong>profile editing</strong>."
4001
  msgstr ""
4002
 
4003
- #: includes/free/loader.php:124 includes/free/loader.php:154
4004
  msgid "Upgrade to Pro Version"
4005
  msgstr ""
4006
 
4007
- #: includes/free/loader.php:125
4008
  msgid "Learn More"
4009
  msgstr ""
4010
 
4011
- #: includes/free/loader.php:146
4012
  msgid "Use Coupon codes for subscription for discounts."
4013
  msgstr ""
4014
 
4015
- #: includes/free/loader.php:150
4016
  msgid "This feature is only available in the Pro Version."
4017
  msgstr ""
4018
 
4019
- #: includes/free/loader.php:155
4020
  msgid "Learn more about Coupons"
4021
  msgstr ""
4022
 
4023
- #: includes/free/loader.php:196
4024
  msgid "Upgrade to Pro"
4025
  msgstr ""
4026
 
@@ -4036,6 +4011,80 @@ msgstr ""
4036
  msgid "Enable Recurring Payment"
4037
  msgstr ""
4038
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4039
  #: lib/class-wedevs-insights.php:326
4040
  msgid ""
4041
  "Want to help make <strong>%s</strong> even more awesome? Allow weDevs to "
@@ -4078,7 +4127,7 @@ msgstr ""
4078
  msgid "You don't have permission to install the plugins"
4079
  msgstr ""
4080
 
4081
- #: lib/class.settings-api.php:365
4082
  msgid "Choose File"
4083
  msgstr ""
4084
 
@@ -4281,243 +4330,243 @@ msgstr ""
4281
  msgid "-- select --"
4282
  msgstr ""
4283
 
4284
- #: wpuf-functions.php:410
4285
  msgid "Images"
4286
  msgstr ""
4287
 
4288
- #: wpuf-functions.php:411
4289
  msgid "Audio"
4290
  msgstr ""
4291
 
4292
- #: wpuf-functions.php:412
4293
  msgid "Videos"
4294
  msgstr ""
4295
 
4296
- #: wpuf-functions.php:413
4297
  msgid "PDF"
4298
  msgstr ""
4299
 
4300
- #: wpuf-functions.php:414
4301
  msgid "Office Documents"
4302
  msgstr ""
4303
 
4304
- #: wpuf-functions.php:415
4305
  msgid "Zip Archives"
4306
  msgstr ""
4307
 
4308
- #: wpuf-functions.php:416
4309
  msgid "Executable Files"
4310
  msgstr ""
4311
 
4312
- #: wpuf-functions.php:417
4313
  msgid "CSV"
4314
  msgstr ""
4315
 
4316
- #: wpuf-functions.php:1424
4317
  msgid "Edit Profile"
4318
  msgstr ""
4319
 
4320
- #: wpuf-functions.php:1529
4321
  msgid "United Arab Emirates Dirham"
4322
  msgstr ""
4323
 
4324
- #: wpuf-functions.php:1530
4325
  msgid "Australian Dollars"
4326
  msgstr ""
4327
 
4328
- #: wpuf-functions.php:1531
4329
  msgid "Argentine Peso"
4330
  msgstr ""
4331
 
4332
- #: wpuf-functions.php:1532
4333
  msgid "Bangladeshi Taka"
4334
  msgstr ""
4335
 
4336
- #: wpuf-functions.php:1533
4337
  msgid "Brazilian Real"
4338
  msgstr ""
4339
 
4340
- #: wpuf-functions.php:1534
4341
  msgid "Bulgarian Lev"
4342
  msgstr ""
4343
 
4344
- #: wpuf-functions.php:1535
4345
  msgid "Canadian Dollars"
4346
  msgstr ""
4347
 
4348
- #: wpuf-functions.php:1536
4349
  msgid "Chilean Peso"
4350
  msgstr ""
4351
 
4352
- #: wpuf-functions.php:1537
4353
  msgid "Chinese Yuan"
4354
  msgstr ""
4355
 
4356
- #: wpuf-functions.php:1538
4357
  msgid "Colombian Peso"
4358
  msgstr ""
4359
 
4360
- #: wpuf-functions.php:1539
4361
  msgid "Czech Koruna"
4362
  msgstr ""
4363
 
4364
- #: wpuf-functions.php:1540
4365
  msgid "Danish Krone"
4366
  msgstr ""
4367
 
4368
- #: wpuf-functions.php:1541
4369
  msgid "Dominican Peso"
4370
  msgstr ""
4371
 
4372
- #: wpuf-functions.php:1542
4373
  msgid "Algerian Dinar"
4374
  msgstr ""
4375
 
4376
- #: wpuf-functions.php:1543
4377
  msgid "Euros"
4378
  msgstr ""
4379
 
4380
- #: wpuf-functions.php:1544
4381
  msgid "Hong Kong Dollar"
4382
  msgstr ""
4383
 
4384
- #: wpuf-functions.php:1545
4385
  msgid "Croatia kuna"
4386
  msgstr ""
4387
 
4388
- #: wpuf-functions.php:1546
4389
  msgid "Hungarian Forint"
4390
  msgstr ""
4391
 
4392
- #: wpuf-functions.php:1547
4393
  msgid "Icelandic krona"
4394
  msgstr ""
4395
 
4396
- #: wpuf-functions.php:1548
4397
  msgid "Indonesia Rupiah"
4398
  msgstr ""
4399
 
4400
- #: wpuf-functions.php:1549
4401
  msgid "Indian Rupee"
4402
  msgstr ""
4403
 
4404
- #: wpuf-functions.php:1550
4405
  msgid "Nepali Rupee"
4406
  msgstr ""
4407
 
4408
- #: wpuf-functions.php:1551
4409
  msgid "Israeli Shekel"
4410
  msgstr ""
4411
 
4412
- #: wpuf-functions.php:1552
4413
  msgid "Japanese Yen"
4414
  msgstr ""
4415
 
4416
- #: wpuf-functions.php:1553
4417
  msgid "Lao Kip"
4418
  msgstr ""
4419
 
4420
- #: wpuf-functions.php:1554
4421
  msgid "South Korean Won"
4422
  msgstr ""
4423
 
4424
- #: wpuf-functions.php:1555
4425
  msgid "Malaysian Ringgits"
4426
  msgstr ""
4427
 
4428
- #: wpuf-functions.php:1556
4429
  msgid "Mexican Peso"
4430
  msgstr ""
4431
 
4432
- #: wpuf-functions.php:1557
4433
  msgid "Nigerian Naira"
4434
  msgstr ""
4435
 
4436
- #: wpuf-functions.php:1558
4437
  msgid "Norwegian Krone"
4438
  msgstr ""
4439
 
4440
- #: wpuf-functions.php:1559
4441
  msgid "New Zealand Dollar"
4442
  msgstr ""
4443
 
4444
- #: wpuf-functions.php:1560
4445
  msgid "Omani Rial"
4446
  msgstr ""
4447
 
4448
- #: wpuf-functions.php:1561
4449
  msgid "Iranian Rial"
4450
  msgstr ""
4451
 
4452
- #: wpuf-functions.php:1562
4453
  msgid "Pakistani Rupee"
4454
  msgstr ""
4455
 
4456
- #: wpuf-functions.php:1563
4457
  msgid "Paraguayan Guaraní"
4458
  msgstr ""
4459
 
4460
- #: wpuf-functions.php:1564
4461
  msgid "Philippine Pesos"
4462
  msgstr ""
4463
 
4464
- #: wpuf-functions.php:1565
4465
  msgid "Polish Zloty"
4466
  msgstr ""
4467
 
4468
- #: wpuf-functions.php:1566
4469
  msgid "Pounds Sterling"
4470
  msgstr ""
4471
 
4472
- #: wpuf-functions.php:1567
4473
  msgid "Romanian Leu"
4474
  msgstr ""
4475
 
4476
- #: wpuf-functions.php:1568
4477
  msgid "Russian Ruble"
4478
  msgstr ""
4479
 
4480
- #: wpuf-functions.php:1569
4481
  msgid "Saudi Riyal"
4482
  msgstr ""
4483
 
4484
- #: wpuf-functions.php:1570
4485
  msgid "Singapore Dollar"
4486
  msgstr ""
4487
 
4488
- #: wpuf-functions.php:1571
4489
  msgid "South African rand"
4490
  msgstr ""
4491
 
4492
- #: wpuf-functions.php:1572
4493
  msgid "Swedish Krona"
4494
  msgstr ""
4495
 
4496
- #: wpuf-functions.php:1573
4497
  msgid "Swiss Franc"
4498
  msgstr ""
4499
 
4500
- #: wpuf-functions.php:1574
4501
  msgid "Taiwan New Dollars"
4502
  msgstr ""
4503
 
4504
- #: wpuf-functions.php:1575
4505
  msgid "Thai Baht"
4506
  msgstr ""
4507
 
4508
- #: wpuf-functions.php:1576
4509
  msgid "Turkish Lira"
4510
  msgstr ""
4511
 
4512
- #: wpuf-functions.php:1577
4513
  msgid "US Dollar"
4514
  msgstr ""
4515
 
4516
- #: wpuf-functions.php:1578
4517
  msgid "Vietnamese Dong"
4518
  msgstr ""
4519
 
4520
- #: wpuf-functions.php:1579
4521
  msgid "Egyptian Pound"
4522
  msgstr ""
4523
 
@@ -4537,7 +4586,7 @@ msgstr ""
4537
  msgid "Your Post Has Been Expired"
4538
  msgstr ""
4539
 
4540
- #: wpuf.php:634
4541
  msgid "Error: Nonce verification failed"
4542
  msgstr ""
4543
 
@@ -4559,7 +4608,67 @@ msgstr ""
4559
  msgid "https://tareq.co"
4560
  msgstr ""
4561
 
4562
- #: wpuf-functions.php:1041
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4563
  msgctxt "tag delimiter"
4564
  msgid ","
4565
  msgstr ""
2
  # This file is distributed under the GPL2 or later.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP User Frontend 2.8.1\n"
6
  "Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
7
+ "POT-Creation-Date: 2018-01-14 09:24:05+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
48
  msgid "Subscriptions"
49
  msgstr ""
50
 
51
+ #: admin/class-admin-settings.php:107 admin/class-tools.php:378
52
  #: admin/transactions.php:2
53
  msgid "Transactions"
54
  msgstr ""
55
 
56
+ #: admin/class-admin-settings.php:110 admin/tools.php:13
57
  msgid "Tools"
58
  msgstr ""
59
 
60
+ #: admin/class-admin-settings.php:115
61
  msgid "Premium"
62
  msgstr ""
63
 
64
+ #: admin/class-admin-settings.php:117
65
  msgid "Help"
66
  msgstr ""
67
 
68
+ #: admin/class-admin-settings.php:117
69
  msgid "<span style=\"color:#f18500\">Help</span>"
70
  msgstr ""
71
 
72
+ #: admin/class-admin-settings.php:118 admin/class-admin-settings.php:156
73
+ #: admin/form-builder/views/form-builder.php:9 includes/setup-wizard.php:103
74
  msgid "Settings"
75
  msgstr ""
76
 
77
+ #: admin/class-admin-settings.php:120 admin/class-admin-subscription.php:185
78
  #: admin/subscribers.php:18
79
  msgid "Subscribers"
80
  msgstr ""
81
 
82
+ #: admin/class-admin-settings.php:377
83
  msgid "Number of items per page:"
84
  msgstr ""
85
 
136
  msgstr ""
137
 
138
  #: admin/class-admin-subscription.php:206
139
+ #: admin/class-admin-subscription.php:560 class/frontend-account.php:135
140
  #: class/subscription.php:844 class/subscription.php:857
141
  #: includes/class-user-subscription.php:301
142
  msgid "Free"
147
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:140
148
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:526
149
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:584
150
+ #: admin/form.php:795 admin/post-forms-list-table.php:345
151
+ #: admin/settings-options.php:101 admin/settings-options.php:193
152
+ #: admin/settings-options.php:204 admin/settings-options.php:263
153
+ #: admin/template.php:70 includes/free/form-element.php:477
 
154
  msgid "Yes"
155
  msgstr ""
156
 
159
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:141
160
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:527
161
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:585
162
+ #: admin/form.php:796 admin/post-forms-list-table.php:346
163
+ #: admin/settings-options.php:102 admin/settings-options.php:194
164
+ #: admin/settings-options.php:205 admin/settings-options.php:264
165
+ #: admin/template.php:71 includes/free/form-element.php:478
 
166
  msgid "No"
167
  msgstr ""
168
 
392
  msgstr ""
393
 
394
  #: admin/class-tools.php:351 admin/installer.php:30
395
+ #: includes/setup-wizard.php:280
396
  msgid "Install WPUF Pages"
397
  msgstr ""
398
 
502
  msgid "Insert Photo"
503
  msgstr ""
504
 
505
+ #: admin/form-builder/assets/js/components/form-taxonomy/template.php:11
506
  msgid "— Select —"
507
  msgstr ""
508
 
787
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:307
788
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:455
789
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:498
790
+ #: admin/form.php:899
791
  msgid "- select -"
792
  msgstr ""
793
 
808
  msgstr ""
809
 
810
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:428
811
+ #: admin/form.php:783 admin/template.php:449 admin/template.php:481
812
  msgid "Select Text"
813
  msgstr ""
814
 
815
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:432
816
+ #: admin/form.php:787 admin/template.php:438 admin/template.php:470
817
  msgid ""
818
  "First element of the select dropdown. Leave this empty if you don't want to "
819
  "show this field"
833
 
834
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:523
835
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:581
836
+ #: admin/form.php:792
837
  msgid "Show in inline list"
838
  msgstr ""
839
 
840
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:533
841
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:591
842
+ #: admin/form.php:802
843
  msgid "Show this option in an inline list"
844
  msgstr ""
845
 
920
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:902
921
  #: admin/template.php:544 admin/template.php:604 admin/template.php:683
922
  #: class/upload.php:164 templates/dashboard/posts.php:75
923
+ #: templates/dashboard.php:73 wpuf-functions.php:738
924
  msgid "Title"
925
  msgstr ""
926
 
930
  msgstr ""
931
 
932
  #: admin/form-builder/class-wpuf-form-builder-field-settings.php:825
933
+ #: admin/template.php:609 class/upload.php:166 wpuf-functions.php:744
934
  msgid "Description"
935
  msgstr ""
936
 
1198
  msgid "Ajax"
1199
  msgstr ""
1200
 
1201
+ #: admin/form.php:807 admin/template-post.php:165
1202
  msgid "Order By"
1203
  msgstr ""
1204
 
1205
+ #: admin/form.php:810 admin/html/form-submission-restriction.php:11
1206
  #: admin/template-post.php:167 includes/free/edit-profile.php:97
1207
  #: templates/registration-form.php:27
1208
  msgid "Name"
1209
  msgstr ""
1210
 
1211
+ #: admin/form.php:811 admin/template-post.php:168
1212
  msgid "Term ID"
1213
  msgstr ""
1214
 
1215
+ #: admin/form.php:812 admin/template-post.php:169
1216
  msgid "Slug"
1217
  msgstr ""
1218
 
1219
+ #: admin/form.php:813 admin/template-post.php:170
1220
  msgid "Count"
1221
  msgstr ""
1222
 
1223
+ #: admin/form.php:814 admin/template-post.php:171
1224
  msgid "Term Group"
1225
  msgstr ""
1226
 
1227
+ #: admin/form.php:823 admin/template-post.php:176
1228
  msgid "Order"
1229
  msgstr ""
1230
 
1231
+ #: admin/form.php:827 admin/template-post.php:178
1232
  msgid "ASC"
1233
  msgstr ""
1234
 
1235
+ #: admin/form.php:828 admin/template-post.php:179
1236
  msgid "DESC"
1237
  msgstr ""
1238
 
1239
+ #: admin/form.php:837 admin/template-post.php:184
1240
  msgid "Selection Type"
1241
  msgstr ""
1242
 
1243
+ #: admin/form.php:840 admin/template-post.php:186
1244
  msgid "Exclude"
1245
  msgstr ""
1246
 
1247
+ #: admin/form.php:841 admin/template-post.php:187
1248
  msgid "Include"
1249
  msgstr ""
1250
 
1251
+ #: admin/form.php:842 admin/template-post.php:188
1252
  msgid "Child of"
1253
  msgstr ""
1254
 
1255
+ #: admin/form.php:851
1256
  msgid "Selection Terms"
1257
  msgstr ""
1258
 
1259
+ #: admin/form.php:855 admin/template-post.php:194
1260
  msgid ""
1261
  "Enter the term IDs as comma separated (without space) to exclude/include in "
1262
  "the form."
1263
  msgstr ""
1264
 
1265
+ #: admin/form.php:863 admin/template-post.php:204
1266
  msgid "This taxonomy is a WooCommerce attribute"
1267
  msgstr ""
1268
 
1269
+ #: admin/form.php:874 admin/template-post.php:216
1270
  msgid "Visible on product page"
1271
  msgstr ""
1272
 
1273
+ #: admin/form.php:926
1274
  msgid "Post Forms must have either Post Title, Post Body or Excerpt field"
1275
  msgstr ""
1276
 
1298
  msgid "Payment Options"
1299
  msgstr ""
1300
 
1301
+ #: admin/html/form-settings-payment.php:25 admin/settings-options.php:301
1302
+ #: includes/setup-wizard.php:273
1303
  msgid "Enable Payments"
1304
  msgstr ""
1305
 
1381
  msgstr ""
1382
 
1383
  #: admin/html/form-settings-post-edit.php:30
1384
+ #: admin/html/form-settings-post.php:119 includes/free/form-element.php:376
1385
  msgid "Redirect To"
1386
  msgstr ""
1387
 
1388
  #: admin/html/form-settings-post-edit.php:35
1389
+ #: admin/html/form-settings-post.php:124
1390
  msgid "Newly created post"
1391
  msgstr ""
1392
 
1393
  #: admin/html/form-settings-post-edit.php:36
1394
+ #: admin/html/form-settings-post.php:125 includes/free/form-element.php:381
1395
  msgid "Same Page"
1396
  msgstr ""
1397
 
1398
  #: admin/html/form-settings-post-edit.php:37
1399
+ #: admin/html/form-settings-post.php:126 includes/free/form-element.php:382
1400
  msgid "To a page"
1401
  msgstr ""
1402
 
1403
  #: admin/html/form-settings-post-edit.php:38
1404
+ #: admin/html/form-settings-post.php:127 includes/free/form-element.php:383
1405
  msgid "To a custom URL"
1406
  msgstr ""
1407
 
1408
  #: admin/html/form-settings-post-edit.php:47
1409
+ #: admin/html/form-settings-post.php:136 includes/free/form-element.php:392
1410
  msgid "After successfull submit, where the page will redirect to"
1411
  msgstr ""
1412
 
1415
  msgstr ""
1416
 
1417
  #: admin/html/form-settings-post-edit.php:60
1418
+ #: admin/html/form-settings-post.php:149 includes/free/form-element.php:412
1419
  msgid "Page"
1420
  msgstr ""
1421
 
1422
  #: admin/html/form-settings-post-edit.php:75
1423
+ #: admin/html/form-settings-post.php:164 includes/free/form-element.php:427
1424
  msgid "Custom URL"
1425
  msgstr ""
1426
 
1464
  msgid "Post Format"
1465
  msgstr ""
1466
 
1467
+ #: admin/html/form-settings-post.php:74
1468
  msgid "- None -"
1469
  msgstr ""
1470
 
1472
  msgid "Default Post Category"
1473
  msgstr ""
1474
 
1475
+ #: admin/html/form-settings-post.php:114
1476
  msgid ""
1477
  "If users are not allowed to choose any category, this category will be used "
1478
  "instead (if post type supports)"
1479
  msgstr ""
1480
 
1481
+ #: admin/html/form-settings-post.php:142
1482
  msgid "Message to show"
1483
  msgstr ""
1484
 
1485
+ #: admin/html/form-settings-post.php:171
1486
  msgid "Comment Status"
1487
  msgstr ""
1488
 
1489
+ #: admin/html/form-settings-post.php:174
1490
  msgid "Open"
1491
  msgstr ""
1492
 
1493
+ #: admin/html/form-settings-post.php:175
1494
  msgid "Closed"
1495
  msgstr ""
1496
 
1497
+ #: admin/html/form-settings-post.php:181
1498
  msgid "Submit Post Button text"
1499
  msgstr ""
1500
 
1501
+ #: admin/html/form-settings-post.php:188
1502
  msgid "Post Draft"
1503
  msgstr ""
1504
 
1505
+ #: admin/html/form-settings-post.php:193
1506
  msgid "Enable Saving as draft"
1507
  msgstr ""
1508
 
1509
+ #: admin/html/form-settings-post.php:195
1510
  msgid "It will show a button to save as draft"
1511
  msgstr ""
1512
 
1811
  msgstr ""
1812
 
1813
  #: admin/html/whats-new.php:8
1814
+ msgid "Setup Wizard"
1815
  msgstr ""
1816
 
1817
  #: admin/html/whats-new.php:10
1818
+ msgid "Setup Wizard added to turn off payment options and install pages."
 
 
1819
  msgstr ""
1820
 
1821
  #: admin/html/whats-new.php:14
1822
+ msgid "Multi-select Category"
1823
  msgstr ""
1824
 
1825
  #: admin/html/whats-new.php:16
1826
+ msgid "Add multi-select to default category in post form settings."
 
 
1827
  msgstr ""
1828
 
1829
  #: admin/html/whats-new.php:20
1830
+ msgid "Select Text option for Taxonomy"
1831
  msgstr ""
1832
 
1833
  #: admin/html/whats-new.php:22
1834
  msgid ""
1835
+ "Add Select Text option for taxonomy fields. Now you can add default text "
1836
+ "with empty value as first option for Taxonomy dropdown."
1837
  msgstr ""
1838
 
1839
+ #: admin/html/whats-new.php:25
1840
+ msgid "Taxonomy Checkbox Inline"
1841
  msgstr ""
1842
 
1843
+ #: admin/html/whats-new.php:27
 
 
 
 
 
 
 
 
1844
  msgid ""
1845
+ "Added checkbox inline option to taxonomy checkbox. You can now display "
1846
+ "Taxonomy checkbox fields inline."
 
 
 
 
1847
  msgstr ""
1848
 
1849
+ #: admin/html/whats-new.php:41
 
 
 
 
1850
  msgid "What's New in WPUF?"
1851
  msgstr ""
1852
 
1871
  msgstr ""
1872
 
1873
  #: admin/installer.php:73 admin/settings-options.php:23
1874
+ #: includes/free/admin/shortcode-button.php:82 wpuf-functions.php:1430
1875
  msgid "Dashboard"
1876
  msgstr ""
1877
 
1884
  msgid "Login"
1885
  msgstr ""
1886
 
1887
+ #: admin/installer.php:84 class/subscription.php:356 class/subscription.php:376
1888
  #: class/subscription.php:377 class/subscription.php:378
1889
+ #: includes/free/admin/shortcode-button.php:102 wpuf-functions.php:1433
1890
  msgid "Subscription"
1891
  msgstr ""
1892
 
1893
+ #: admin/installer.php:84
1894
  msgid "[wpuf_sub_pack]"
1895
  msgstr ""
1896
 
1897
+ #: admin/installer.php:85 templates/dashboard/posts.php:82
1898
  #: templates/dashboard.php:109
1899
  msgid "Payment"
1900
  msgstr ""
1901
 
1902
+ #: admin/installer.php:85
1903
  msgid "Please select a gateway for payment"
1904
  msgstr ""
1905
 
1906
+ #: admin/installer.php:86
1907
  msgid "Thank You"
1908
  msgstr ""
1909
 
1910
+ #: admin/installer.php:86
1911
  msgid ""
1912
  "<h1>Payment is complete</h1><p>Congratulations, your payment has been "
1913
  "completed!</p>"
1914
  msgstr ""
1915
 
1916
+ #: admin/installer.php:87
1917
  msgid "Order Received"
1918
  msgstr ""
1919
 
1920
+ #: admin/installer.php:87
1921
  msgid ""
1922
  "Hi, we have received your order. We will validate the order and will take "
1923
  "necessary steps to move forward."
1924
  msgstr ""
1925
 
1926
+ #: admin/installer.php:169 includes/free/admin/shortcode-button.php:98
1927
  msgid "Registration"
1928
  msgstr ""
1929
 
1930
+ #: admin/installer.php:178
1931
  msgid "Sample Form"
1932
  msgstr ""
1933
 
1982
  msgstr ""
1983
 
1984
  #: admin/posting.php:66 class/asset-loader.php:51 class/render-form.php:1597
1985
+ #: wpuf.php:483
1986
  msgid "Are you sure?"
1987
  msgstr ""
1988
 
1989
+ #: admin/posting.php:72 class/asset-loader.php:57 wpuf.php:491
1990
  msgid "Allowed Files"
1991
  msgstr ""
1992
 
1993
+ #: admin/posting.php:75 class/asset-loader.php:60 wpuf.php:497
1994
  msgid "Maximum number of files reached!"
1995
  msgstr ""
1996
 
1997
+ #: admin/posting.php:76 class/asset-loader.php:61 wpuf.php:498
1998
  msgid "The file you have uploaded exceeds the file size limit. Please try again."
1999
  msgstr ""
2000
 
2001
+ #: admin/posting.php:77 class/asset-loader.php:62 wpuf.php:499
2002
  msgid "You have uploaded an incorrect file type. Please try again."
2003
  msgstr ""
2004
 
2551
  "<code>[wpuf_account]</code> is located"
2552
  msgstr ""
2553
 
2554
+ #: admin/settings-options.php:271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2555
  msgid "Auto Login After Registration"
2556
  msgstr ""
2557
 
2558
+ #: admin/settings-options.php:272
2559
  msgid "If enabled, users after registration will be logged in to the system"
2560
  msgstr ""
2561
 
2562
+ #: admin/settings-options.php:278
2563
  msgid "Login/Registration override"
2564
  msgstr ""
2565
 
2566
+ #: admin/settings-options.php:279
2567
  msgid ""
2568
  "If enabled, default login and registration forms will be overridden by WPUF "
2569
  "with pages below"
2570
  msgstr ""
2571
 
2572
+ #: admin/settings-options.php:285
2573
  msgid "Registration Page"
2574
  msgstr ""
2575
 
2576
+ #: admin/settings-options.php:286
2577
  msgid ""
2578
  "Select the page you want to use as registration page override <em>(should "
2579
  "have shortcode)</em>"
2580
  msgstr ""
2581
 
2582
+ #: admin/settings-options.php:292
2583
  msgid "Login Page"
2584
  msgstr ""
2585
 
2586
+ #: admin/settings-options.php:293
2587
  msgid "Select the page which contains <code>[wpuf-login]</code> shortcode"
2588
  msgstr ""
2589
 
2590
+ #: admin/settings-options.php:302
2591
+ msgid "Enable payments on your site."
2592
+ msgstr ""
2593
+
2594
+ #: admin/settings-options.php:308
2595
  msgid "Subscription Pack Page"
2596
  msgstr ""
2597
 
2598
+ #: admin/settings-options.php:309
2599
  msgid "Select the page where <code>[wpuf_sub_pack]</code> located."
2600
  msgstr ""
2601
 
2602
+ #: admin/settings-options.php:315
2603
  msgid "Subscription at registration"
2604
  msgstr ""
2605
 
2606
+ #: admin/settings-options.php:316
2607
  msgid "Registration time redirect to subscription page"
2608
  msgstr ""
2609
 
2610
+ #: admin/settings-options.php:321
2611
  msgid "Currency"
2612
  msgstr ""
2613
 
2614
+ #: admin/settings-options.php:328
2615
  msgid "Currency Position"
2616
  msgstr ""
2617
 
2618
+ #: admin/settings-options.php:332
2619
  msgid "Left"
2620
  msgstr ""
2621
 
2622
+ #: admin/settings-options.php:333
2623
  msgid "Right"
2624
  msgstr ""
2625
 
2626
+ #: admin/settings-options.php:334
2627
  msgid "Left with space"
2628
  msgstr ""
2629
 
2630
+ #: admin/settings-options.php:335
2631
  msgid "Right with space"
2632
  msgstr ""
2633
 
2634
+ #: admin/settings-options.php:340
2635
  msgid "Thousand Separator"
2636
  msgstr ""
2637
 
2638
+ #: admin/settings-options.php:341
2639
  msgid "This sets the thousand separator of displayed prices."
2640
  msgstr ""
2641
 
2642
+ #: admin/settings-options.php:349
2643
  msgid "Decimal Separator"
2644
  msgstr ""
2645
 
2646
+ #: admin/settings-options.php:350
2647
  msgid "This sets the decimal separator of displayed prices."
2648
  msgstr ""
2649
 
2650
+ #: admin/settings-options.php:357
2651
  msgid "Number of Decimals"
2652
  msgstr ""
2653
 
2654
+ #: admin/settings-options.php:358
2655
  msgid "This sets the number of decimal points shown in displayed prices."
2656
  msgstr ""
2657
 
2658
+ #: admin/settings-options.php:368
2659
  msgid "Enable demo/sandbox mode"
2660
  msgstr ""
2661
 
2662
+ #: admin/settings-options.php:369
2663
  msgid "When sandbox mode is active, all payment gateway will be used in demo mode"
2664
  msgstr ""
2665
 
2666
+ #: admin/settings-options.php:375
2667
  msgid "Payment Page"
2668
  msgstr ""
2669
 
2670
+ #: admin/settings-options.php:376
2671
  msgid "This page will be used to process payment options"
2672
  msgstr ""
2673
 
2674
+ #: admin/settings-options.php:382
2675
  msgid "Payment Success Page"
2676
  msgstr ""
2677
 
2678
+ #: admin/settings-options.php:383 lib/gateway/bank.php:37
2679
  msgid "After payment users will be redirected here"
2680
  msgstr ""
2681
 
2682
+ #: admin/settings-options.php:389
2683
  msgid "Payment Gateways"
2684
  msgstr ""
2685
 
2686
+ #: admin/settings-options.php:390
2687
  msgid "Active payment gateways"
2688
  msgstr ""
2689
 
2690
+ #: admin/settings-options.php:398
2691
+ msgid "<span class=\"dashicons dashicons-universal-access-alt\"></span> Guest Email"
2692
+ msgstr ""
2693
+
2694
+ #: admin/settings-options.php:404
2695
  msgid "Guest mail subject"
2696
  msgstr ""
2697
 
2698
+ #: admin/settings-options.php:405
2699
  msgid "This sets the subject of the emails sent to guest users"
2700
  msgstr ""
2701
 
2702
+ #: admin/settings-options.php:412
2703
  msgid "Guest mail body"
2704
  msgstr ""
2705
 
2706
+ #: admin/settings-options.php:413
2707
  msgid ""
2708
  "This sets the body of the emails sent to guest users. Please DON'T edit the "
2709
  "<code>{activation_link}</code> part"
2710
  msgstr ""
2711
 
2712
+ #: admin/settings-options.php:437
2713
  msgid ""
2714
  "Select profile/registration forms for user roles. These forms will be used "
2715
  "to populate extra edit profile fields in backend."
2716
  msgstr ""
2717
 
2718
+ #: admin/settings-options.php:448
2719
  msgid " - select - "
2720
  msgstr ""
2721
 
2816
  msgid "Install Now"
2817
  msgstr ""
2818
 
2819
+ #: class/asset-loader.php:31 wpuf.php:414
2820
  msgid "is required"
2821
  msgstr ""
2822
 
2823
+ #: class/asset-loader.php:32 wpuf.php:415
2824
  msgid "does not match"
2825
  msgstr ""
2826
 
2827
+ #: class/asset-loader.php:33 wpuf.php:416
2828
  msgid "is not valid"
2829
  msgstr ""
2830
 
2831
+ #: class/asset-loader.php:45 wpuf.php:477
2832
  msgid "Please fix the errors to proceed"
2833
  msgstr ""
2834
 
2835
+ #: class/asset-loader.php:47 wpuf.php:479
2836
  msgid "Word limit reached"
2837
  msgstr ""
2838
 
2839
+ #: class/frontend-account.php:114 class/frontend-account.php:124
2840
  msgid "<p>You've not subscribed any package yet.</p>"
2841
  msgstr ""
2842
 
2843
+ #: class/frontend-account.php:126
2844
  msgid "<p>You've subscribed to the following package.</p>"
2845
  msgstr ""
2846
 
2847
+ #: class/frontend-account.php:184 class/subscription.php:73
2848
  msgid "Nonce failure"
2849
  msgstr ""
2850
 
2851
+ #: class/frontend-account.php:198
2852
  msgid "First Name is a required field."
2853
  msgstr ""
2854
 
2855
+ #: class/frontend-account.php:202
2856
  msgid "Last Name is a required field."
2857
  msgstr ""
2858
 
2859
+ #: class/frontend-account.php:206
2860
  msgid "Email is a required field."
2861
  msgstr ""
2862
 
2863
+ #: class/frontend-account.php:217
2864
  msgid "Please provide a valid email address."
2865
  msgstr ""
2866
 
2867
+ #: class/frontend-account.php:219
2868
  msgid "This email address is already registered."
2869
  msgstr ""
2870
 
2871
+ #: class/frontend-account.php:225
2872
  msgid "Please fill out all password fields."
2873
  msgstr ""
2874
 
2875
+ #: class/frontend-account.php:228
2876
  msgid "Please enter your current password."
2877
  msgstr ""
2878
 
2879
+ #: class/frontend-account.php:231
2880
  msgid "Please re-enter your password."
2881
  msgstr ""
2882
 
2883
+ #: class/frontend-account.php:234
2884
  msgid "New passwords do not match."
2885
  msgstr ""
2886
 
2887
+ #: class/frontend-account.php:237 class/frontend-account.php:248
2888
  msgid "Your current password is incorrect."
2889
  msgstr ""
2890
 
2933
  msgid "You can't edit a post while in pending mode."
2934
  msgstr ""
2935
 
2936
+ #: class/frontend-form-post.php:301
2937
  msgid "Empty reCaptcha Field"
2938
  msgstr ""
2939
 
2940
+ #: class/frontend-form-post.php:332
2941
  msgid "Invalid email address."
2942
  msgstr ""
2943
 
2944
+ #: class/frontend-form-post.php:341
2945
  msgid ""
2946
  "You already have an account in our site. Please login to continue.\n"
2947
  "\n"
2950
  "Click 'Cancel' to stay at this page."
2951
  msgstr ""
2952
 
2953
+ #: class/frontend-form-post.php:390
2954
  msgid "You do not have sufficient permissions to access this form."
2955
  msgstr ""
2956
 
2957
+ #: class/frontend-form-post.php:764
2958
  msgid "Something went wrong"
2959
  msgstr ""
2960
 
2961
+ #: class/frontend-form-post.php:1121
2962
  msgid "Email successfully verified. Please Login."
2963
  msgstr ""
2964
 
3018
  msgid "No Payment gateway found"
3019
  msgstr ""
3020
 
3021
+ #: class/payment.php:365 lib/gateway/bank.php:105
3022
  msgid "[%s] Payment Received"
3023
  msgstr ""
3024
 
3025
+ #: class/payment.php:366
3026
  msgid "New payment received at %s"
3027
  msgstr ""
3028
 
3064
  msgid "Strength indicator"
3065
  msgstr ""
3066
 
3067
+ #: class/render-form.php:1336
3068
  msgid "-- Select --"
3069
  msgstr ""
3070
 
3232
  msgid "No transactions found."
3233
  msgstr ""
3234
 
3235
+ #: class/upload.php:165 wpuf-functions.php:741
3236
  msgid "Caption"
3237
  msgstr ""
3238
 
3239
+ #: includes/class-dokan-integration.php:37 wpuf-functions.php:1431
3240
  msgid "Posts"
3241
  msgstr ""
3242
 
3471
  msgid "Unlimited"
3472
  msgstr ""
3473
 
3474
+ #: includes/class-user-subscription.php:374
3475
+ msgid "Change"
3476
+ msgstr ""
3477
+
3478
  #: includes/class-whats-new.php:67
3479
  msgid "Whats New"
3480
  msgstr ""
3539
  msgid "Select a form to insert"
3540
  msgstr ""
3541
 
3542
+ #: includes/free/admin/shortcode-builder.php:9 includes/free/loader.php:89
3543
  msgid "Registration Form"
3544
  msgstr ""
3545
 
3959
  msgid "Update Button text"
3960
  msgstr ""
3961
 
3962
+ #: includes/free/loader.php:83 includes/free/loader.php:143
3963
  msgid "Coupons"
3964
  msgstr ""
3965
 
3966
+ #: includes/free/loader.php:92
3967
  msgid ""
3968
  "Use the shortcode <code>[wpuf-registration]</code> for a simple and default "
3969
  "WordPress registration form."
3970
  msgstr ""
3971
 
3972
+ #: includes/free/loader.php:106
3973
  msgid ""
3974
  "Registration form builder is a two way form which can be used both for "
3975
  "<strong>user registration</strong> and <strong>profile editing</strong>."
3976
  msgstr ""
3977
 
3978
+ #: includes/free/loader.php:125 includes/free/loader.php:155
3979
  msgid "Upgrade to Pro Version"
3980
  msgstr ""
3981
 
3982
+ #: includes/free/loader.php:126
3983
  msgid "Learn More"
3984
  msgstr ""
3985
 
3986
+ #: includes/free/loader.php:147
3987
  msgid "Use Coupon codes for subscription for discounts."
3988
  msgstr ""
3989
 
3990
+ #: includes/free/loader.php:151
3991
  msgid "This feature is only available in the Pro Version."
3992
  msgstr ""
3993
 
3994
+ #: includes/free/loader.php:156
3995
  msgid "Learn more about Coupons"
3996
  msgstr ""
3997
 
3998
+ #: includes/free/loader.php:197
3999
  msgid "Upgrade to Pro"
4000
  msgstr ""
4001
 
4011
  msgid "Enable Recurring Payment"
4012
  msgstr ""
4013
 
4014
+ #: includes/setup-wizard.php:98
4015
+ msgid "Introduction"
4016
+ msgstr ""
4017
+
4018
+ #: includes/setup-wizard.php:108
4019
+ msgid "Ready!"
4020
+ msgstr ""
4021
+
4022
+ #: includes/setup-wizard.php:145
4023
+ msgid "WPUF &rsaquo; Setup Wizard"
4024
+ msgstr ""
4025
+
4026
+ #: includes/setup-wizard.php:210
4027
+ msgid "Return to the WordPress Dashboard"
4028
+ msgstr ""
4029
+
4030
+ #: includes/setup-wizard.php:252
4031
+ msgid "Welcome to the world of WPUF!"
4032
+ msgstr ""
4033
+
4034
+ #: includes/setup-wizard.php:253
4035
+ msgid ""
4036
+ "Thank you for choosing WPUF to power your websites frontend! This quick "
4037
+ "setup wizard will help you configure the basic settings. <strong>It’s "
4038
+ "completely optional and shouldn’t take longer than a minute.</strong>"
4039
+ msgstr ""
4040
+
4041
+ #: includes/setup-wizard.php:254
4042
+ msgid ""
4043
+ "No time right now? If you don’t want to go through the wizard, you can skip "
4044
+ "and return to the WordPress dashboard. Come back anytime if you change your "
4045
+ "mind!"
4046
+ msgstr ""
4047
+
4048
+ #: includes/setup-wizard.php:256
4049
+ msgid "Let's Go!"
4050
+ msgstr ""
4051
+
4052
+ #: includes/setup-wizard.php:257
4053
+ msgid "Not right now"
4054
+ msgstr ""
4055
+
4056
+ #: includes/setup-wizard.php:269
4057
+ msgid "Basic Setting"
4058
+ msgstr ""
4059
+
4060
+ #: includes/setup-wizard.php:276
4061
+ msgid "Make payment enable for user to add posts on frontend."
4062
+ msgstr ""
4063
+
4064
+ #: includes/setup-wizard.php:283
4065
+ msgid "Install neccessery pages on your site frontend."
4066
+ msgstr ""
4067
+
4068
+ #: includes/setup-wizard.php:288
4069
+ msgid "Continue"
4070
+ msgstr ""
4071
+
4072
+ #: includes/setup-wizard.php:289
4073
+ msgid "Skip this step"
4074
+ msgstr ""
4075
+
4076
+ #: includes/setup-wizard.php:323
4077
+ msgid "Thank you!"
4078
+ msgstr ""
4079
+
4080
+ #: includes/setup-wizard.php:328
4081
+ msgid "Welcome to Awesomeness!"
4082
+ msgstr ""
4083
+
4084
+ #: includes/setup-wizard.php:332
4085
+ msgid "Go to Full Settings"
4086
+ msgstr ""
4087
+
4088
  #: lib/class-wedevs-insights.php:326
4089
  msgid ""
4090
  "Want to help make <strong>%s</strong> even more awesome? Allow weDevs to "
4127
  msgid "You don't have permission to install the plugins"
4128
  msgstr ""
4129
 
4130
+ #: lib/class.settings-api.php:366
4131
  msgid "Choose File"
4132
  msgstr ""
4133
 
4330
  msgid "-- select --"
4331
  msgstr ""
4332
 
4333
+ #: wpuf-functions.php:418
4334
  msgid "Images"
4335
  msgstr ""
4336
 
4337
+ #: wpuf-functions.php:419
4338
  msgid "Audio"
4339
  msgstr ""
4340
 
4341
+ #: wpuf-functions.php:420
4342
  msgid "Videos"
4343
  msgstr ""
4344
 
4345
+ #: wpuf-functions.php:421
4346
  msgid "PDF"
4347
  msgstr ""
4348
 
4349
+ #: wpuf-functions.php:422
4350
  msgid "Office Documents"
4351
  msgstr ""
4352
 
4353
+ #: wpuf-functions.php:423
4354
  msgid "Zip Archives"
4355
  msgstr ""
4356
 
4357
+ #: wpuf-functions.php:424
4358
  msgid "Executable Files"
4359
  msgstr ""
4360
 
4361
+ #: wpuf-functions.php:425
4362
  msgid "CSV"
4363
  msgstr ""
4364
 
4365
+ #: wpuf-functions.php:1432
4366
  msgid "Edit Profile"
4367
  msgstr ""
4368
 
4369
+ #: wpuf-functions.php:1537
4370
  msgid "United Arab Emirates Dirham"
4371
  msgstr ""
4372
 
4373
+ #: wpuf-functions.php:1538
4374
  msgid "Australian Dollars"
4375
  msgstr ""
4376
 
4377
+ #: wpuf-functions.php:1539
4378
  msgid "Argentine Peso"
4379
  msgstr ""
4380
 
4381
+ #: wpuf-functions.php:1540
4382
  msgid "Bangladeshi Taka"
4383
  msgstr ""
4384
 
4385
+ #: wpuf-functions.php:1541
4386
  msgid "Brazilian Real"
4387
  msgstr ""
4388
 
4389
+ #: wpuf-functions.php:1542
4390
  msgid "Bulgarian Lev"
4391
  msgstr ""
4392
 
4393
+ #: wpuf-functions.php:1543
4394
  msgid "Canadian Dollars"
4395
  msgstr ""
4396
 
4397
+ #: wpuf-functions.php:1544
4398
  msgid "Chilean Peso"
4399
  msgstr ""
4400
 
4401
+ #: wpuf-functions.php:1545
4402
  msgid "Chinese Yuan"
4403
  msgstr ""
4404
 
4405
+ #: wpuf-functions.php:1546
4406
  msgid "Colombian Peso"
4407
  msgstr ""
4408
 
4409
+ #: wpuf-functions.php:1547
4410
  msgid "Czech Koruna"
4411
  msgstr ""
4412
 
4413
+ #: wpuf-functions.php:1548
4414
  msgid "Danish Krone"
4415
  msgstr ""
4416
 
4417
+ #: wpuf-functions.php:1549
4418
  msgid "Dominican Peso"
4419
  msgstr ""
4420
 
4421
+ #: wpuf-functions.php:1550
4422
  msgid "Algerian Dinar"
4423
  msgstr ""
4424
 
4425
+ #: wpuf-functions.php:1551
4426
  msgid "Euros"
4427
  msgstr ""
4428
 
4429
+ #: wpuf-functions.php:1552
4430
  msgid "Hong Kong Dollar"
4431
  msgstr ""
4432
 
4433
+ #: wpuf-functions.php:1553
4434
  msgid "Croatia kuna"
4435
  msgstr ""
4436
 
4437
+ #: wpuf-functions.php:1554
4438
  msgid "Hungarian Forint"
4439
  msgstr ""
4440
 
4441
+ #: wpuf-functions.php:1555
4442
  msgid "Icelandic krona"
4443
  msgstr ""
4444
 
4445
+ #: wpuf-functions.php:1556
4446
  msgid "Indonesia Rupiah"
4447
  msgstr ""
4448
 
4449
+ #: wpuf-functions.php:1557
4450
  msgid "Indian Rupee"
4451
  msgstr ""
4452
 
4453
+ #: wpuf-functions.php:1558
4454
  msgid "Nepali Rupee"
4455
  msgstr ""
4456
 
4457
+ #: wpuf-functions.php:1559
4458
  msgid "Israeli Shekel"
4459
  msgstr ""
4460
 
4461
+ #: wpuf-functions.php:1560
4462
  msgid "Japanese Yen"
4463
  msgstr ""
4464
 
4465
+ #: wpuf-functions.php:1561
4466
  msgid "Lao Kip"
4467
  msgstr ""
4468
 
4469
+ #: wpuf-functions.php:1562
4470
  msgid "South Korean Won"
4471
  msgstr ""
4472
 
4473
+ #: wpuf-functions.php:1563
4474
  msgid "Malaysian Ringgits"
4475
  msgstr ""
4476
 
4477
+ #: wpuf-functions.php:1564
4478
  msgid "Mexican Peso"
4479
  msgstr ""
4480
 
4481
+ #: wpuf-functions.php:1565
4482
  msgid "Nigerian Naira"
4483
  msgstr ""
4484
 
4485
+ #: wpuf-functions.php:1566
4486
  msgid "Norwegian Krone"
4487
  msgstr ""
4488
 
4489
+ #: wpuf-functions.php:1567
4490
  msgid "New Zealand Dollar"
4491
  msgstr ""
4492
 
4493
+ #: wpuf-functions.php:1568
4494
  msgid "Omani Rial"
4495
  msgstr ""
4496
 
4497
+ #: wpuf-functions.php:1569
4498
  msgid "Iranian Rial"
4499
  msgstr ""
4500
 
4501
+ #: wpuf-functions.php:1570
4502
  msgid "Pakistani Rupee"
4503
  msgstr ""
4504
 
4505
+ #: wpuf-functions.php:1571
4506
  msgid "Paraguayan Guaraní"
4507
  msgstr ""
4508
 
4509
+ #: wpuf-functions.php:1572
4510
  msgid "Philippine Pesos"
4511
  msgstr ""
4512
 
4513
+ #: wpuf-functions.php:1573
4514
  msgid "Polish Zloty"
4515
  msgstr ""
4516
 
4517
+ #: wpuf-functions.php:1574
4518
  msgid "Pounds Sterling"
4519
  msgstr ""
4520
 
4521
+ #: wpuf-functions.php:1575
4522
  msgid "Romanian Leu"
4523
  msgstr ""
4524
 
4525
+ #: wpuf-functions.php:1576
4526
  msgid "Russian Ruble"
4527
  msgstr ""
4528
 
4529
+ #: wpuf-functions.php:1577
4530
  msgid "Saudi Riyal"
4531
  msgstr ""
4532
 
4533
+ #: wpuf-functions.php:1578
4534
  msgid "Singapore Dollar"
4535
  msgstr ""
4536
 
4537
+ #: wpuf-functions.php:1579
4538
  msgid "South African rand"
4539
  msgstr ""
4540
 
4541
+ #: wpuf-functions.php:1580
4542
  msgid "Swedish Krona"
4543
  msgstr ""
4544
 
4545
+ #: wpuf-functions.php:1581
4546
  msgid "Swiss Franc"
4547
  msgstr ""
4548
 
4549
+ #: wpuf-functions.php:1582
4550
  msgid "Taiwan New Dollars"
4551
  msgstr ""
4552
 
4553
+ #: wpuf-functions.php:1583
4554
  msgid "Thai Baht"
4555
  msgstr ""
4556
 
4557
+ #: wpuf-functions.php:1584
4558
  msgid "Turkish Lira"
4559
  msgstr ""
4560
 
4561
+ #: wpuf-functions.php:1585
4562
  msgid "US Dollar"
4563
  msgstr ""
4564
 
4565
+ #: wpuf-functions.php:1586
4566
  msgid "Vietnamese Dong"
4567
  msgstr ""
4568
 
4569
+ #: wpuf-functions.php:1587
4570
  msgid "Egyptian Pound"
4571
  msgstr ""
4572
 
4586
  msgid "Your Post Has Been Expired"
4587
  msgstr ""
4588
 
4589
+ #: wpuf.php:636
4590
  msgid "Error: Nonce verification failed"
4591
  msgstr ""
4592
 
4608
  msgid "https://tareq.co"
4609
  msgstr ""
4610
 
4611
+ #: includes/setup-wizard.php:39
4612
+ msgctxt "enhanced select"
4613
+ msgid "One result is available, press enter to select it."
4614
+ msgstr ""
4615
+
4616
+ #: includes/setup-wizard.php:40
4617
+ msgctxt "enhanced select"
4618
+ msgid "%qty% results are available, use up and down arrow keys to navigate."
4619
+ msgstr ""
4620
+
4621
+ #: includes/setup-wizard.php:41
4622
+ msgctxt "enhanced select"
4623
+ msgid "No matches found"
4624
+ msgstr ""
4625
+
4626
+ #: includes/setup-wizard.php:42
4627
+ msgctxt "enhanced select"
4628
+ msgid "Loading failed"
4629
+ msgstr ""
4630
+
4631
+ #: includes/setup-wizard.php:43
4632
+ msgctxt "enhanced select"
4633
+ msgid "Please enter 1 or more characters"
4634
+ msgstr ""
4635
+
4636
+ #: includes/setup-wizard.php:44
4637
+ msgctxt "enhanced select"
4638
+ msgid "Please enter %qty% or more characters"
4639
+ msgstr ""
4640
+
4641
+ #: includes/setup-wizard.php:45
4642
+ msgctxt "enhanced select"
4643
+ msgid "Please delete 1 character"
4644
+ msgstr ""
4645
+
4646
+ #: includes/setup-wizard.php:46
4647
+ msgctxt "enhanced select"
4648
+ msgid "Please delete %qty% characters"
4649
+ msgstr ""
4650
+
4651
+ #: includes/setup-wizard.php:47
4652
+ msgctxt "enhanced select"
4653
+ msgid "You can only select 1 item"
4654
+ msgstr ""
4655
+
4656
+ #: includes/setup-wizard.php:48
4657
+ msgctxt "enhanced select"
4658
+ msgid "You can only select %qty% items"
4659
+ msgstr ""
4660
+
4661
+ #: includes/setup-wizard.php:49
4662
+ msgctxt "enhanced select"
4663
+ msgid "Loading more results&hellip;"
4664
+ msgstr ""
4665
+
4666
+ #: includes/setup-wizard.php:50
4667
+ msgctxt "enhanced select"
4668
+ msgid "Searching&hellip;"
4669
+ msgstr ""
4670
+
4671
+ #: wpuf-functions.php:1049
4672
  msgctxt "tag delimiter"
4673
  msgid ","
4674
  msgstr ""
lib/class.settings-api.php CHANGED
@@ -238,6 +238,7 @@ class WeDevs_Settings_API {
238
  function callback_multicheck( $args ) {
239
 
240
  $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
 
241
  $html = '<fieldset>';
242
  $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
243
  foreach ( $args['options'] as $key => $label ) {
238
  function callback_multicheck( $args ) {
239
 
240
  $value = $this->get_option( $args['id'], $args['section'], $args['std'] );
241
+ $value = $value ? $value : array();
242
  $html = '<fieldset>';
243
  $html .= sprintf( '<input type="hidden" name="%1$s[%2$s]" value="" />', $args['section'], $args['id'] );
244
  foreach ( $args['options'] as $key => $label ) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: Forms, registration, profile-builder, login, membership
5
  Requires at least: 4.0
6
  Tested up to: 4.8.1
7
  Requires PHP: 5.4
8
- Stable tag: 2.8.0
9
  License: GPLv2
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -170,6 +170,17 @@ redirected to the edit page with that post id. Then you'll see the edit post for
170
 
171
  == Changelog ==
172
 
 
 
 
 
 
 
 
 
 
 
 
173
  = v2.8.0 (6 January, 2017) =
174
 
175
  * **New:** Limit Entries: limit how many entries a form will accept and display a custom message when that limit is reached.
5
  Requires at least: 4.0
6
  Tested up to: 4.8.1
7
  Requires PHP: 5.4
8
+ Stable tag: 2.8.1
9
  License: GPLv2
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
170
 
171
  == Changelog ==
172
 
173
+ = v2.8.1 (14 January, 2017) =
174
+
175
+ * **New:** Setup Wizard: Setup Wizard added to turn off payment options and install pages.
176
+ * **New:** Multi-select Category: Add multi-select to default category in post form settings.
177
+ * **Improved:** Select Text option for Taxonomy: Add Select Text option for taxonomy fields. Now you can add default text with empty value as first option for Taxonomy dropdown.
178
+ * **Improved:** Taxonomy Checkbox Inline: Added checkbox inline option to taxonomy checkbox. You can now display Taxonomy checkbox fields inline.
179
+ * **Fix:** WooComerce Template fix: WooCommerce product form submittion error fixed. Product adding with WooCommerce template works fine now.
180
+ * **Fix:** Date Display Issue: Date not save/display after save form settings in Schedule form section.
181
+ * **Fix:** Default Field Width: Default Field Width set empty. Previously set as medium.
182
+
183
+
184
  = v2.8.0 (6 January, 2017) =
185
 
186
  * **New:** Limit Entries: limit how many entries a form will accept and display a custom message when that limit is reached.
templates/account.php CHANGED
@@ -4,14 +4,10 @@
4
  <?php
5
  if ( is_user_logged_in() ) {
6
  foreach ( $sections as $section ) {
7
- if ( 'subscription' == $section['slug'] && wpuf_get_option( 'show_subscriptions', 'wpuf_my_account' ) == 'no' ) {
8
- continue;
9
- }
10
- if ( 'invoices' == $section['slug'] && wpuf_get_option( 'show_invoice', 'wpuf_my_account' ) == 'no' ) {
11
- continue;
12
- }
13
- if ( 'billing_address' == $section['slug'] && wpuf_get_option( 'show_billing_address', 'wpuf_my_account' ) == 'no' ) {
14
- continue;
15
  }
16
  echo sprintf(
17
  '<li><a href="%s">%s</a></li>',
4
  <?php
5
  if ( is_user_logged_in() ) {
6
  foreach ( $sections as $section ) {
7
+ if ( 'subscription' == $section['slug']) {
8
+ if ( 'on' == wpuf_get_option( 'show_subscriptions', 'wpuf_my_account' ) || 'on' != wpuf_get_option( 'enable_payment', 'wpuf_payment', 'on' ) ) {
9
+ continue;
10
+ }
 
 
 
 
11
  }
12
  echo sprintf(
13
  '<li><a href="%s">%s</a></li>',
wpuf-functions.php CHANGED
@@ -327,8 +327,14 @@ class WPUF_Walker_Category_Checklist extends Walker {
327
  else
328
  $name = $taxonomy;
329
 
 
 
 
 
 
 
330
  $class = isset( $args['class'] ) ? $args['class'] : '';
331
- $output .= "\n<li id='{$taxonomy}-{$category->term_id}'>" . '<label class="selectit"><input class="'. $class . '" value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
332
  }
333
 
334
  function end_el( &$output, $category, $depth = 0, $args = array() ) {
@@ -366,6 +372,8 @@ function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr =
366
  $args['selected_cats'] = array();
367
  }
368
 
 
 
369
  $args['class'] = $class;
370
 
371
  $tax_args = array(
@@ -2325,3 +2333,58 @@ function wpuf_posts_submitted_by( $form_id ) {
2325
  function wpuf_form_posts_count( $form_id ) {
2326
  return count( wpuf_posts_submitted_by( $form_id ) );
2327
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  else
328
  $name = $taxonomy;
329
 
330
+ if ( 'yes' === $show_inline ) {
331
+ $inline_class = 'wpuf-checkbox-inline';
332
+ } else {
333
+ $inline_class = '';
334
+ }
335
+
336
  $class = isset( $args['class'] ) ? $args['class'] : '';
337
+ $output .= "\n<li class='" . $inline_class . "' id='{$taxonomy}-{$category->term_id}'>" . '<label class="selectit"><input class="'. $class . '" value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $selected_cats ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
338
  }
339
 
340
  function end_el( &$output, $category, $depth = 0, $args = array() ) {
372
  $args['selected_cats'] = array();
373
  }
374
 
375
+ $args['show_inline'] = $attr['show_inline'];
376
+
377
  $args['class'] = $class;
378
 
379
  $tax_args = array(
2333
  function wpuf_form_posts_count( $form_id ) {
2334
  return count( wpuf_posts_submitted_by( $form_id ) );
2335
  }
2336
+
2337
+ /**
2338
+ * Get formatted email body
2339
+ *
2340
+ * @since 2.9
2341
+ *
2342
+ * @param string $message
2343
+ *
2344
+ * @return string
2345
+ */
2346
+ function get_formatted_mail_body( $message, $subject ) {
2347
+
2348
+ if ( class_exists( 'WP_User_Frontend_Pro' ) && wpuf_pro_is_module_active( 'email-templates/email-templates.php' ) ) {
2349
+ $css = '';
2350
+ $header = apply_filters( 'wpuf_email_header', '' );
2351
+ $footer = apply_filters( 'wpuf_email_footer', '' );
2352
+
2353
+ if ( empty( $header ) ) {
2354
+ ob_start();
2355
+ include WPUF_PRO_INCLUDES . '/templates/email/header.php';
2356
+ $header = ob_get_clean();
2357
+ }
2358
+
2359
+ if ( empty( $footer ) ) {
2360
+ ob_start();
2361
+ include WPUF_PRO_INCLUDES . '/templates/email/footer.php';
2362
+ $footer = ob_get_clean();
2363
+ }
2364
+
2365
+ ob_start();
2366
+ include WPUF_PRO_INCLUDES . '/templates/email/style.php';
2367
+ $css = apply_filters( 'wpuf_email_style', ob_get_clean() );
2368
+
2369
+ $content = $header . $message . $footer;
2370
+
2371
+ if ( ! class_exists( 'Emogrifier' ) ) {
2372
+ require_once WPUF_PRO_INCLUDES . '/libs/Emogrifier.php';
2373
+ }
2374
+
2375
+ try {
2376
+
2377
+ // apply CSS styles inline for picky email clients
2378
+ $emogrifier = new Emogrifier( $content, $css );
2379
+ $content = $emogrifier->emogrify();
2380
+
2381
+ } catch ( Exception $e ) {
2382
+
2383
+ echo $e->getMessage();
2384
+ }
2385
+
2386
+ return $content;
2387
+ }
2388
+
2389
+ return $message;
2390
+ }
wpuf.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP User Frontend
4
  Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
5
  Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
6
  Author: Tareq Hasan
7
- Version: 2.8.0
8
  Author URI: https://tareq.co
9
  License: GPL2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -12,7 +12,7 @@ Text Domain: wpuf
12
  Domain Path: /languages
13
  */
14
 
15
- define( 'WPUF_VERSION', '2.8.0' );
16
  define( 'WPUF_FILE', __FILE__ );
17
  define( 'WPUF_ROOT', dirname( __FILE__ ) );
18
  define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
@@ -240,6 +240,7 @@ final class WP_User_Frontend {
240
  require_once WPUF_ROOT . '/class/frontend-account.php';
241
  require_once WPUF_ROOT . '/includes/class-form.php';
242
  require_once WPUF_ROOT . '/includes/class-login-widget.php';
 
243
 
244
  if ( class_exists( 'WeDevs_Dokan' ) ) {
245
  require_once WPUF_ROOT . '/includes/class-dokan-integration.php';
@@ -420,6 +421,7 @@ final class WP_User_Frontend {
420
  }
421
 
422
  wp_enqueue_style( 'wpuf-css', WPUF_ASSET_URI . '/css/frontend-forms.css' );
 
423
 
424
  if ( wpuf_get_option( 'load_script', 'wpuf_general', 'on' ) == 'on' ) {
425
  $this->plugin_scripts();
@@ -535,8 +537,8 @@ final class WP_User_Frontend {
535
  }
536
 
537
  $roles = wpuf_get_option( 'show_admin_bar', 'wpuf_general', array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ) );
 
538
  $current_user = wp_get_current_user();
539
-
540
  if ( !in_array( $current_user->roles[0], $roles ) ) {
541
  return false;
542
  }
4
  Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
5
  Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
6
  Author: Tareq Hasan
7
+ Version: 2.8.1
8
  Author URI: https://tareq.co
9
  License: GPL2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
  Domain Path: /languages
13
  */
14
 
15
+ define( 'WPUF_VERSION', '2.8.1' );
16
  define( 'WPUF_FILE', __FILE__ );
17
  define( 'WPUF_ROOT', dirname( __FILE__ ) );
18
  define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
240
  require_once WPUF_ROOT . '/class/frontend-account.php';
241
  require_once WPUF_ROOT . '/includes/class-form.php';
242
  require_once WPUF_ROOT . '/includes/class-login-widget.php';
243
+ require_once WPUF_ROOT . '/includes/setup-wizard.php';
244
 
245
  if ( class_exists( 'WeDevs_Dokan' ) ) {
246
  require_once WPUF_ROOT . '/includes/class-dokan-integration.php';
421
  }
422
 
423
  wp_enqueue_style( 'wpuf-css', WPUF_ASSET_URI . '/css/frontend-forms.css' );
424
+ wp_enqueue_script( 'wpuf-subscriptions', WPUF_ASSET_URI . '/js/subscriptions.js', array( 'jquery' ), false, true );
425
 
426
  if ( wpuf_get_option( 'load_script', 'wpuf_general', 'on' ) == 'on' ) {
427
  $this->plugin_scripts();
537
  }
538
 
539
  $roles = wpuf_get_option( 'show_admin_bar', 'wpuf_general', array( 'administrator', 'editor', 'author', 'contributor', 'subscriber' ) );
540
+ $roles = $roles ? $roles : array();
541
  $current_user = wp_get_current_user();
 
542
  if ( !in_array( $current_user->roles[0], $roles ) ) {
543
  return false;
544
  }