myCRED - Version 2.1

Version Description

NEW - Open badge functionality in myCred Badge addon. NEW - Introduce Achievement Types. NEW - Introduce a new shortcode mycred_badges_list. NEW - Single badge page. NEW - Added support into Badges for Anniversary hook. NEW - Added support into Badges for wooCommerce purchase reward. NEW - Added %rank_title% template tag support in Email Notifications. NEW - Added attributes in mycred_transfer shortcode. TWEAK - Removed deprecated functions. TWEAK - Code Improvement. TWEAK - Improve styling of mycred_transfer shortcode. FIX - mycred_history shortcode pagination not working properly when cache enabled. FIX - Ranks weren't working properly on the current balance. FIX - mycred_sell_this shortcode not working in the bbPress topic FIX - The central deposit missing log entry in some cases.

Download this release

Release Info

Developer wpexpertsio
Plugin Icon 128x128 myCRED
Version 2.1
Comparing to
See all releases

Code changes from version 2.0.2 to 2.1

Files changed (49) hide show
  1. addons/badges/assets/js/admin.js +32 -0
  2. addons/badges/assets/js/front.js +9 -0
  3. addons/badges/includes/mycred-badge-functions.php +353 -4
  4. addons/badges/includes/mycred-badge-object.php +90 -25
  5. addons/badges/includes/mycred-badge-shortcodes.php +242 -1
  6. addons/badges/includes/mycred-open-badge.php +296 -0
  7. addons/badges/myCRED-addon-badges.php +1725 -1206
  8. addons/banking/services/mycred-service-central.php +1 -1
  9. addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php +1 -1
  10. addons/cash-creds/gateways/bank-transfer.php +3 -1
  11. addons/cash-creds/includes/cashcred-shortcodes.php +4 -2
  12. addons/email-notices/includes/mycred-email-object.php +11 -1
  13. addons/ranks/includes/mycred-rank-functions.php +23 -2
  14. addons/ranks/myCRED-addon-ranks.php +22 -1
  15. addons/sell-content/myCRED-addon-sell-content.php +30 -3
  16. addons/transfer/includes/mycred-transfer-object.php +51 -17
  17. addons/transfer/includes/mycred-transfer-shortcodes.php +5 -1
  18. addons/transfer/myCRED-addon-transfer.php +2 -0
  19. assets/css/mycred-admin.css +6 -1
  20. assets/css/mycred-front.css +1 -1
  21. assets/css/tourguide.css +193 -0
  22. assets/images/about/56826.png +0 -0
  23. assets/images/about/account.png +0 -0
  24. assets/images/about/automatic-points.png +0 -0
  25. assets/images/about/badges.png +0 -0
  26. assets/images/about/buy-points.png +0 -0
  27. assets/images/about/convert-points.png +0 -0
  28. assets/images/about/leaderboards.png +0 -0
  29. assets/images/about/multi-points.png +0 -0
  30. assets/images/about/multi-site-support.png +0 -0
  31. assets/images/about/points-management.png +0 -0
  32. assets/images/about/sell-content.png +0 -0
  33. assets/images/about/welcome.png +0 -0
  34. assets/js/shepherd.js.map +1 -0
  35. assets/js/tourguide.min.js +121 -0
  36. includes/classes/class.query-log.php +9 -6
  37. includes/hooks/external/mycred-hook-buddypress.php +2 -2
  38. includes/hooks/external/mycred-hook-woocommerce.php +13 -0
  39. includes/mycred-about.php +503 -177
  40. includes/mycred-functions.php +84 -1
  41. includes/mycred-remote.php +41 -23
  42. includes/mycred-setup.php +30 -6
  43. includes/mycred-walkthrough.php +57 -0
  44. membership/mycred-connect-membership.php +0 -112
  45. membership/subscription-functions.php +1 -1
  46. modules/mycred-module-addons.php +1 -1
  47. modules/mycred-module-management.php +3 -2
  48. mycred.php +14 -6
  49. readme.txt +46 -3
addons/badges/assets/js/admin.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).ready(function (){
2
+ jQuery(document).on( 'click', '#mycred-badge-is-open-badge', function (){
3
+ if ( jQuery('input#mycred-badge-is-open-badge').is(':checked') ) {
4
+ if ( confirm('Activating Open Badge loss will all Levels of this badge.') ) {
5
+ return true;
6
+ } else {
7
+ return false;
8
+ }
9
+ }
10
+ } );
11
+ jQuery(document).on( 'click', '#switch-all-to-open-badge', function (e){
12
+ e.preventDefault();
13
+ if ( confirm('Activating Open Badge loss will all Levels of this badge.') ) {
14
+ jQuery.ajax({
15
+ url: ajaxurl,
16
+ data: {
17
+ action: 'mycred_switch_all_to_open_badge',
18
+ },
19
+ type: 'POST',
20
+ beforeSend: function() {
21
+ jQuery('.mycred-switch-all-badges-icon').css("display", "inherit");;
22
+ },
23
+ success:function(data) {
24
+ jQuery('.mycred-switch-all-badges-icon').hide();
25
+ alert( data );
26
+ }
27
+ })
28
+ } else {
29
+ return false;
30
+ }
31
+ } )
32
+ })
addons/badges/assets/js/front.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ // jQuery(document).ready(function(){
2
+ // jQuery("#myInput").on("keyup", function() {
3
+ // var value = jQuery(this).val().toLowerCase();
4
+ // jQuery(".mycred-tab-panels .mycred-badges-list-item").filter(function() {
5
+ // jQuery(this).toggle(jQuery(this).text().toLowerCase().indexOf(value) > -1)
6
+ // });
7
+ // });
8
+ // });
9
+
addons/badges/includes/mycred-badge-functions.php CHANGED
@@ -221,7 +221,9 @@ endif;
221
  if ( ! function_exists( 'mycred_display_badge_requirement' ) ) :
222
  function mycred_display_badge_requirements( $badge_id = NULL ) {
223
 
 
224
  $levels = mycred_get_badge_levels( $badge_id );
 
225
  if ( empty( $levels ) ) {
226
 
227
  $reply = '-';
@@ -261,9 +263,15 @@ if ( ! function_exists( 'mycred_display_badge_requirement' ) ) :
261
  $output = array();
262
  foreach ( $levels as $level => $setup ) {
263
 
264
- $level_label = '<strong>' . sprintf( __( 'Level %s', 'mycred' ), ( $level + 1 ) ) . ':</strong>';
265
- if ( $levels[ $level ]['label'] != '' )
266
- $level_label = '<strong>' . $levels[ $level ]['label'] . ':</strong>';
 
 
 
 
 
 
267
 
268
  // Construct requirements to be used in an unorganized list.
269
  $level_req = array();
@@ -295,7 +303,7 @@ if ( ! function_exists( 'mycred_display_badge_requirement' ) ) :
295
 
296
  if ( empty( $level_req ) ) continue;
297
 
298
- $output[] = $level_label . '<ul class="mycred-badge-requirement-list"><li>' . implode( '</li><li>', $level_req ) . '</li></ul>';
299
 
300
  }
301
 
@@ -697,3 +705,344 @@ if ( ! function_exists( 'mycred_get_badge_ids' ) ) :
697
 
698
  }
699
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  if ( ! function_exists( 'mycred_display_badge_requirement' ) ) :
222
  function mycred_display_badge_requirements( $badge_id = NULL ) {
223
 
224
+ $badge = mycred_get_badge( $badge_id );
225
  $levels = mycred_get_badge_levels( $badge_id );
226
+
227
  if ( empty( $levels ) ) {
228
 
229
  $reply = '-';
263
  $output = array();
264
  foreach ( $levels as $level => $setup ) {
265
 
266
+ $level_label = '';
267
+
268
+ if ( ! $badge->open_badge ) {
269
+
270
+ $level_label = '<strong>' . sprintf( __( 'Level %s', 'mycred' ), ( $level + 1 ) ) . ':</strong>';
271
+ if ( $levels[ $level ]['label'] != '' )
272
+ $level_label = '<strong>' . $levels[ $level ]['label'] . ':</strong>';
273
+
274
+ }
275
 
276
  // Construct requirements to be used in an unorganized list.
277
  $level_req = array();
303
 
304
  if ( empty( $level_req ) ) continue;
305
 
306
+ $output[] = $level_label . '<ul class="mycred-badge-requirement-list '. ( $badge->open_badge ? 'open_badge' : '' ) .'"><li>' . implode( '</li><li>', $level_req ) . '</li></ul>';
307
 
308
  }
309
 
705
 
706
  }
707
  endif;
708
+
709
+ /**
710
+ * Get Badges by Term ID
711
+ * @since 2.1
712
+ * @version 1.0
713
+ * @param $term_id Pass term Id
714
+ * return posts by term Id
715
+ */
716
+ if( !function_exists( 'mycred_get_badges_by_term_id' ) ) :
717
+ function mycred_get_badges_by_term_id($term_id ) {
718
+ $badge_args = query_posts(array(
719
+ 'post_type' => MYCRED_BADGE_KEY,
720
+ 'showposts' => -1,
721
+ 'tax_query' => array(
722
+ array(
723
+ 'taxonomy' => MYCRED_BADGE_CATEGORY,
724
+ 'terms' => $term_id,
725
+ 'field' => 'term_id',
726
+ )
727
+ ),
728
+ 'orderby' => 'title',
729
+ 'order' => 'ASC' )
730
+ );
731
+ return $badge_args;
732
+ }
733
+ endif;
734
+
735
+ /**
736
+ * Get Badge/ Level Requirements
737
+ * @since 2.1
738
+ * @version 1.0
739
+ * @param $badge_id Pass Badge ID
740
+ */
741
+ if( !function_exists( 'mycred_show_badge_requirements' ) ) :
742
+ function mycred_show_badge_requirements( $badge_id ) {
743
+
744
+ $data = array();
745
+ $levels = mycred_get_badge_levels( $badge_id );
746
+ if ( empty( $levels ) ) {
747
+
748
+ $reply = '-';
749
+
750
+ }
751
+ else {
752
+
753
+ $point_types = mycred_get_types(true);
754
+ $references = mycred_get_all_references();
755
+ $req_count = count($levels[0]['requires']);
756
+
757
+ // Get the requirements for the first level
758
+ $base_requirements = array();
759
+ foreach ($levels[0]['requires'] as $requirement_row => $requirement) {
760
+
761
+ if ($requirement['type'] == '')
762
+ $requirement['type'] = MYCRED_DEFAULT_TYPE_KEY;
763
+
764
+ if (!array_key_exists($requirement['type'], $point_types))
765
+ continue;
766
+
767
+ if (!array_key_exists($requirement['reference'], $references))
768
+ $reference = '-';
769
+ else
770
+ $reference = $references[$requirement['reference']];
771
+
772
+ $base_requirements[$requirement_row] = array(
773
+ 'type' => $requirement['type'],
774
+ 'ref' => $reference,
775
+ 'amount' => $requirement['amount'],
776
+ 'by' => $requirement['by']
777
+ );
778
+
779
+ }
780
+
781
+ // Loop through each level
782
+ $output = array();
783
+ foreach ($levels as $level => $setup) {
784
+ //collecting images
785
+ $image = false;
786
+
787
+ if ( $setup['attachment_id'] > 0 ) {
788
+
789
+ $_image = wp_get_attachment_url( $setup['attachment_id'] );
790
+ if ( strlen( $_image ) > 5 )
791
+ $output['image'] = $_image;
792
+
793
+ }
794
+ else {
795
+
796
+ if ( strlen( $setup['image_url'] ) > 5 )
797
+ $output['image'] = $setup['image_url'];
798
+ }
799
+
800
+ $level_label = sprintf(__('Level %s', 'mycred'), ($level + 1));
801
+ if ($levels[$level]['label'] != '')
802
+ $level_label = $levels[$level]['label'];
803
+
804
+ // Construct requirements to be used in an unorganized list.
805
+ $level_req = array();
806
+ foreach ($setup['requires'] as $requirement_row => $requirement) {
807
+ $level_value = $requirement['amount'];
808
+ $requirement = $base_requirements[$requirement_row];
809
+
810
+ $mycred = mycred($requirement['type']);
811
+
812
+ if ($level > 0)
813
+ $requirement['amount'] = $level_value;
814
+
815
+ if ($requirement['by'] == 'count')
816
+ $rendered_row = sprintf(_x('%s for "%s" x %d', '"Points" for "reference" x times', 'mycred'), $mycred->plural(), $requirement['ref'], $requirement['amount']);
817
+ else
818
+ $rendered_row = sprintf(_x('%s %s for "%s"', '"Gained/Lost" "x points" for "reference"', 'mycred'), (($requirement['amount'] < 0) ? __('Lost', 'mycred') : __('Gained', 'mycred')), $mycred->format_creds($requirement['amount']), $requirement['ref']);
819
+
820
+ $compare = _x('OR', 'Comparison of badge requirements. A OR B', 'mycred');
821
+ if ($setup['compare'] === 'AND')
822
+ $compare = _x('AND', 'Comparison of badge requirements. A AND B', 'mycred');
823
+
824
+ if ($req_count > 1 && $requirement_row + 1 < $req_count)
825
+ $rendered_row .= ' <span>' . $compare . '</span>';
826
+
827
+ $level_req[] = $rendered_row;
828
+
829
+ }
830
+
831
+ if ( empty( $level_req ) ) continue;
832
+
833
+ $output['heading'] = $level_label;
834
+ $output['requirements'] = $level_req;
835
+ $output["reward_type"] = $setup["reward"]["type"];
836
+ $output["amount"] = $setup["reward"]["amount"];
837
+
838
+ array_push( $data, $output );
839
+
840
+ }
841
+
842
+ if ( (int) mycred_get_post_meta( $badge_id, 'manual_badge', true ) === 1 )
843
+ $output[] = '<strong><small><em>' . __('This badge is manually awarded.', 'mycred') . '</em></small></strong>';
844
+
845
+ return $data;
846
+ }
847
+
848
+ }
849
+ endif;
850
+
851
+ /**
852
+ * Get users have have specific badge
853
+ * @param $badge_id Pass Badge ID
854
+ * @param int $level_id
855
+ * @return array Will return Array of User ID's have the specific Badge
856
+ * @since 2.1
857
+ * @version 1.0
858
+ */
859
+ if( !function_exists( 'mycred_get_users_has_earned_badge' ) ) :
860
+ function mycred_get_users_has_earned_badge( $badge_id, $level_id = 0 ) {
861
+
862
+ $users_has_badge = array();
863
+
864
+ $badge_id = absint( $badge_id );
865
+
866
+ $args = array(
867
+ 'fields' => array(
868
+ 'ID',
869
+ 'display_name'
870
+ )
871
+ );
872
+
873
+ $users = get_users( $args );
874
+
875
+ foreach ( $users as $user ) {
876
+
877
+ $has_badge = false;
878
+
879
+ $user_id = $user->ID;
880
+
881
+ // Get the badge object
882
+ $badge = mycred_get_badge( $badge_id );
883
+
884
+ // Most likely not a badge post ID
885
+ if ( $badge !== false ) {
886
+
887
+ $current_level = mycred_get_user_meta( $user_id, MYCRED_BADGE_KEY . $badge_id, '', true );
888
+
889
+ $current_level = $current_level == '0' ? true : $current_level;
890
+
891
+ if ( $current_level )
892
+ {
893
+ $has_badge = true;
894
+
895
+ if ( (int) $current_level < absint( $level_id ) )
896
+ {
897
+ $has_badge = false;
898
+ }
899
+ if ( $has_badge )
900
+ $users_has_badge[] = $user_id;
901
+ }
902
+ }
903
+ }
904
+ return $users_has_badge;
905
+
906
+ }
907
+ endif;
908
+
909
+ /**
910
+ * Get Badge Types
911
+ * @since 2.1
912
+ * @version 2.1
913
+ * @param $badge_id Pass the Badge id
914
+ * @return array Will return all the categories
915
+ */
916
+ if ( !function_exists('mycred_get_badge_type') ) :
917
+ function mycred_get_badge_type( $badge_id ) {
918
+
919
+ $badge_terms = get_the_terms( $badge_id, MYCRED_BADGE_CATEGORY, '', ', ' );
920
+
921
+ if (is_array( $badge_terms ) || is_object($badge_terms))
922
+ {
923
+ $badge_type = join( ', ', wp_list_pluck($badge_terms, 'name') );
924
+
925
+ return $badge_type;
926
+ }
927
+
928
+ return false;
929
+
930
+ }
931
+ endif;
932
+
933
+ /**
934
+ * Get Badge Level Image Url By Passing setup of Level Requirements Use Function mycred_get_badge_requirements()
935
+ * @since 2.1
936
+ * @version 1.0
937
+ * @param $setup
938
+ * @return bool|false|mixed|string
939
+ */
940
+ if( !function_exists( 'mycred_get_level_image_url' ) ) :
941
+ function mycred_get_level_image_url( $setup ) {
942
+
943
+ $image = false;
944
+
945
+ if ( $setup['attachment_id'] > 0 ) {
946
+
947
+ $_image = wp_get_attachment_url( $setup['attachment_id'] );
948
+ if ( strlen( $_image ) > 5 )
949
+ return $_image;
950
+
951
+ }
952
+ else {
953
+
954
+ if ( strlen( $setup['image_url'] ) > 5 )
955
+ return $setup['image_url'];
956
+ }
957
+
958
+ return $image;
959
+
960
+ }
961
+ endif;
962
+
963
+ /**
964
+ * Cretae Evidence page
965
+ * @since 2.1
966
+ * @version 1.0
967
+ */
968
+ if ( ! function_exists( 'mycred_get_evidence_page_id' ) ) :
969
+ function mycred_get_evidence_page_id() {
970
+
971
+ $evidencePageId = 0;
972
+
973
+ $badges = mycred_get_addon_settings( 'badges' );
974
+
975
+ //If Open badge enabled
976
+ if ( isset( $badges['open_badge'] ) && $badges['open_badge'] == '1' ) {
977
+
978
+ $canCreatePage = true;
979
+
980
+ $evidence_page_refrence = mycred_get_option( 'open_badge_evidence_page', 0 );
981
+
982
+ if ( ! empty( $badges['open_badge_evidence_page'] ) || ! empty( $evidence_page_refrence ) ) {
983
+
984
+ $pageId = intval( $evidence_page_refrence );
985
+
986
+ if ( ! empty( $badges['open_badge_evidence_page'] ) ) {
987
+
988
+ $pageId = intval( $badges['open_badge_evidence_page'] );
989
+
990
+ }
991
+
992
+ if ( get_post_status( $pageId ) == 'publish' ) {
993
+
994
+ $canCreatePage = false;
995
+ $evidencePageId = $pageId;
996
+
997
+ }
998
+
999
+ }
1000
+
1001
+ if ( $canCreatePage ) {
1002
+
1003
+ $postData = array(
1004
+ 'post_content' => '[' . MYCRED_SLUG . '_badge_evidence]',
1005
+ 'post_title' => 'Badge Evidence',
1006
+ 'post_status' => 'publish',
1007
+ 'post_type' => 'page',
1008
+ 'comment_status' => 'closed',
1009
+ 'post_name' => 'Badge Evidence'
1010
+ );
1011
+
1012
+ $pageId = wp_insert_post( $postData );
1013
+
1014
+ $evidencePageId = intval( $pageId );
1015
+
1016
+ mycred_update_option( 'open_badge_evidence_page', $evidencePageId );
1017
+
1018
+ mycred_set_badge_evidence_page( $evidencePageId );
1019
+
1020
+ }
1021
+
1022
+ }
1023
+
1024
+ return $evidencePageId;
1025
+
1026
+ }
1027
+ endif;
1028
+
1029
+ /**
1030
+ * Set Evidence page
1031
+ * @since 2.1
1032
+ * @version 1.0
1033
+ */
1034
+ if ( ! function_exists( 'mycred_set_badge_evidence_page' ) ) :
1035
+ function mycred_set_badge_evidence_page( $page_id ) {
1036
+
1037
+ $settings = mycred_get_option( 'mycred_pref_core' );
1038
+
1039
+ if ( isset( $settings[ 'badges' ] ) ) {
1040
+
1041
+ $settings[ 'badges' ][ 'open_badge_evidence_page' ] = intval( $page_id );
1042
+
1043
+ mycred_update_option( 'mycred_pref_core', $settings );
1044
+
1045
+ }
1046
+
1047
+ }
1048
+ endif;
addons/badges/includes/mycred-badge-object.php CHANGED
@@ -10,29 +10,33 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
10
  if ( ! class_exists( 'myCRED_Badge' ) ) :
11
  class myCRED_Badge extends myCRED_Object {
12
 
13
- public $post_id = false;
14
 
15
- public $title = '';
16
- public $earnedby = 0;
17
- public $manual = false;
 
18
 
19
- public $levels = array();
20
- public $main_image = false;
21
 
22
- public $level = false;
23
- public $level_id = false;
24
- public $level_label = false;
25
- public $level_image = false;
26
 
27
- public $image_width = false;
28
- public $image_height = false;
29
 
30
- public $references = array();
31
- public $point_types = array();
32
- protected $user_meta_key = '';
33
 
34
- public $user_id = false;
35
- public $current_level = false;
 
 
 
36
 
37
  /**
38
  * Construct
@@ -98,13 +102,19 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
98
  if ( absint( mycred_get_post_meta( $this->post_id, 'manual_badge', true ) ) === 1 )
99
  $this->manual = true;
100
 
 
 
 
 
101
  // If we requested a particular level
102
  if ( $level_id !== NULL )
103
  $this->level = $this->get_level( $level_id );
104
 
105
  // Get images
106
- $this->main_image = $this->get_image( 'main' );
107
- $this->level_image = $this->get_image( $level_id );
 
 
108
 
109
  }
110
 
@@ -357,7 +367,9 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
357
  if ( $execute ) {
358
 
359
  $new_level = apply_filters( 'mycred_badge_user_value', $new_level, $user_id, $this->post_id );
 
360
  mycred_update_user_meta( $user_id, $this->user_meta_key, '', $new_level );
 
361
 
362
  // Need to update counter with new assignments
363
  if ( $new_level == 0 ) {
@@ -603,6 +615,9 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
603
 
604
  mycred_update_post_meta( $this->post_id, 'total-users-with-badge', $this->earnedby );
605
 
 
 
 
606
  }
607
 
608
  }
@@ -692,6 +707,27 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
692
  $image_identification = false;
693
 
694
  $level = 'none';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
695
  if ( $image === 'main' )
696
  $image_identification = mycred_get_post_meta( $this->post_id, 'main_image', true );
697
 
@@ -700,24 +736,53 @@ if ( ! class_exists( 'myCRED_Badge' ) ) :
700
  $image_identification = $this->levels[ $image ]['image_url'];
701
  if ( $this->levels[ $image ]['attachment_id'] > 0 ) {
702
  $image_identification = $this->levels[ $image ]['attachment_id'];
703
- $level = $image;
704
  }
705
 
706
  }
707
 
708
  if ( $image_identification === false || strlen( $image_identification ) == 0 ) return false;
709
 
710
- $image_url = $image_identification;
711
 
712
  if ( is_numeric( $image_identification ) && strpos( '://', (string) $image_identification ) === false )
713
  $image_url = mycred_get_attachment_url( $image_identification );
714
 
715
- $image_width = ( $this->image_width !== false ) ? ' width="' . esc_attr( $this->image_width ) . '"' : '';
716
- $image_height = ( $this->image_height !== false ) ? ' height="' . esc_attr( $this->image_height ) . '"' : '';
717
 
718
- $html = '<img src="' . esc_url( $image_url ) . '" class="' . MYCRED_SLUG . '-badge-image badge-level' . esc_attr( $level ) . '" title="' . esc_attr( $this->title ) . '" alt="' . esc_attr( $this->title ) . '"' . $image_width . $image_height . ' />';
719
 
720
- return apply_filters( 'mycred_badge_image', $html, $image, $this );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
 
722
  }
723
 
10
  if ( ! class_exists( 'myCRED_Badge' ) ) :
11
  class myCRED_Badge extends myCRED_Object {
12
 
13
+ public $post_id = false;
14
 
15
+ public $title = '';
16
+ public $earnedby = 0;
17
+ public $manual = false;
18
+ public $open_badge = false;
19
 
20
+ public $levels = array();
21
+ public $main_image = false;
22
 
23
+ public $level = false;
24
+ public $level_id = false;
25
+ public $level_label = false;
26
+ public $level_image = false;
27
 
28
+ public $image_width = false;
29
+ public $image_height = false;
30
 
31
+ public $references = array();
32
+ public $point_types = array();
33
+ protected $user_meta_key = '';
34
 
35
+ public $user_id = false;
36
+ public $current_level = false;
37
+
38
+ public $main_image_url = false;
39
+ public $congratulation_msg = '';
40
 
41
  /**
42
  * Construct
102
  if ( absint( mycred_get_post_meta( $this->post_id, 'manual_badge', true ) ) === 1 )
103
  $this->manual = true;
104
 
105
+ // Indicate open badge
106
+ if ( absint( mycred_get_post_meta( $this->post_id, 'open_badge', true ) ) === 1 )
107
+ $this->open_badge = true;
108
+
109
  // If we requested a particular level
110
  if ( $level_id !== NULL )
111
  $this->level = $this->get_level( $level_id );
112
 
113
  // Get images
114
+ $this->main_image = $this->get_image( 'main' );
115
+ $this->main_image_url = $this->get_image_url( 'main' );
116
+ $this->level_image = $this->get_image( $level_id );
117
+ $this->congratulation_msg = mycred_get_post_meta( $this->post_id, 'congratulation_msg', true );
118
 
119
  }
120
 
367
  if ( $execute ) {
368
 
369
  $new_level = apply_filters( 'mycred_badge_user_value', $new_level, $user_id, $this->post_id );
370
+
371
  mycred_update_user_meta( $user_id, $this->user_meta_key, '', $new_level );
372
+ mycred_update_user_meta( $user_id, $this->user_meta_key, '_issued_on', time() );
373
 
374
  // Need to update counter with new assignments
375
  if ( $new_level == 0 ) {
615
 
616
  mycred_update_post_meta( $this->post_id, 'total-users-with-badge', $this->earnedby );
617
 
618
+ //Updating issued_on
619
+ mycred_update_user_meta( $row->user_id, $this->user_meta_key, '_issued_on', time() );
620
+
621
  }
622
 
623
  }
707
  $image_identification = false;
708
 
709
  $level = 'none';
710
+ if ( $image != 'main' && is_numeric( $image ) ) {
711
+
712
+ $level = $image;
713
+
714
+ }
715
+
716
+ $image_url = $this->get_image_url( $image );
717
+
718
+ $image_width = ( $this->image_width !== false ) ? ' width="' . esc_attr( $this->image_width ) . '"' : '';
719
+ $image_height = ( $this->image_height !== false ) ? ' height="' . esc_attr( $this->image_height ) . '"' : '';
720
+
721
+ $html = '<img src="' . esc_url( $image_url ) . '" class="' . MYCRED_SLUG . '-badge-image badge-level' . esc_attr( $level ) . '" title="' . esc_attr( $this->title ) . '" alt="' . esc_attr( $this->title ) . '"' . $image_width . $image_height . ' />';
722
+
723
+ return apply_filters( 'mycred_badge_image', $html, $image, $this );
724
+
725
+ }
726
+
727
+ public function get_image_url( $image = NULL ) {
728
+
729
+ $image_identification = false;
730
+
731
  if ( $image === 'main' )
732
  $image_identification = mycred_get_post_meta( $this->post_id, 'main_image', true );
733
 
736
  $image_identification = $this->levels[ $image ]['image_url'];
737
  if ( $this->levels[ $image ]['attachment_id'] > 0 ) {
738
  $image_identification = $this->levels[ $image ]['attachment_id'];
 
739
  }
740
 
741
  }
742
 
743
  if ( $image_identification === false || strlen( $image_identification ) == 0 ) return false;
744
 
745
+ $image_url = $image_identification;
746
 
747
  if ( is_numeric( $image_identification ) && strpos( '://', (string) $image_identification ) === false )
748
  $image_url = mycred_get_attachment_url( $image_identification );
749
 
750
+ return apply_filters( 'mycred_badge_image_url', $image_url, $image, $this );
 
751
 
752
+ }
753
 
754
+ public function get_earned_image( $user_id ) {
755
+
756
+ $image_url = $this->main_image_url;
757
+
758
+ if ( $this->open_badge && $this->user_has_badge( $user_id ) ) {
759
+
760
+ $wp_upload_dirs = wp_upload_dir();
761
+ $basedir = trailingslashit( $wp_upload_dirs[ 'basedir' ] );
762
+ $baseurl = trailingslashit( $wp_upload_dirs[ 'baseurl' ] );
763
+
764
+ $folderName = apply_filters( 'mycred_open_badge_folder', 'open_badges' );
765
+
766
+ $open_badge_directory = $basedir . $folderName;
767
+
768
+ $open_badge_directory = trailingslashit( $open_badge_directory );
769
+
770
+ $badge_id = $this->post_id;
771
+
772
+ $filename = "badge-{$badge_id}-{$user_id}.png";
773
+
774
+ if ( ! file_exists( $open_badge_directory . $filename ) ) {
775
+
776
+ $mycred_Open_Badge = new mycred_Open_Badge();
777
+ $mycred_Open_Badge->bake_users_image( $user_id, $badge_id );
778
+
779
+ }
780
+
781
+ $image_url = trailingslashit( $baseurl . $folderName ) . $filename;
782
+
783
+ }
784
+
785
+ return $image_url;
786
 
787
  }
788
 
addons/badges/includes/mycred-badge-shortcodes.php CHANGED
@@ -91,7 +91,6 @@ endif;
91
  */
92
  if ( ! function_exists( 'mycred_render_badges' ) ) :
93
  function mycred_render_badges( $atts, $template = '' ) {
94
-
95
  extract( shortcode_atts( array(
96
  'width' => MYCRED_BADGE_WIDTH,
97
  'height' => MYCRED_BADGE_HEIGHT
@@ -137,3 +136,245 @@ if ( ! function_exists( 'mycred_render_badges' ) ) :
137
 
138
  }
139
  endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  */
92
  if ( ! function_exists( 'mycred_render_badges' ) ) :
93
  function mycred_render_badges( $atts, $template = '' ) {
 
94
  extract( shortcode_atts( array(
95
  'width' => MYCRED_BADGE_WIDTH,
96
  'height' => MYCRED_BADGE_HEIGHT
136
 
137
  }
138
  endif;
139
+
140
+ /**
141
+ * myCRED Renders Badges List ShortCode
142
+ * @param string $atts
143
+ * @since 2.1
144
+ * @version 1.0
145
+ */
146
+ if( !function_exists( 'mycred_render_badges_list' ) ) :
147
+ function mycred_render_badges_list( $atts = '' ) {
148
+
149
+ extract( shortcode_atts( array(
150
+ 'achievement_tabs' => '1'
151
+ ),
152
+ $atts, MYCRED_SLUG . '_badges_list'
153
+ ) );
154
+
155
+ //User Id
156
+ $user_id = get_current_user_id();
157
+
158
+ $args = array(
159
+ 'taxonomy' => MYCRED_BADGE_CATEGORY,
160
+ 'orderby' => 'name',
161
+ 'field' => 'name',
162
+ 'order' => 'ASC',
163
+ 'hide_empty' => false
164
+ );
165
+
166
+ $categories = get_categories($args);
167
+
168
+ $category_count = count( $categories );
169
+
170
+ //Get Badges
171
+ $args = array(
172
+ 'post_type' => MYCRED_BADGE_KEY
173
+ );
174
+
175
+ $query = new WP_Query( $args );
176
+
177
+ ob_start();
178
+
179
+ //Main Div Start
180
+ echo '<div class="mycred-badges-list">';
181
+
182
+ //If achievement tab = true, and categorise > 0, Show navigation
183
+ if( $achievement_tabs == 1 ) {
184
+ if ( $category_count < 1 ) echo 'First Create Achievements Containing Badges';
185
+ ?>
186
+ <div class="mycred-badges-list-nav">
187
+ <div class="mycred-tabset">
188
+ <?php
189
+ //Navbar
190
+ $counter = 1;
191
+
192
+ foreach ( $categories as $category ) {
193
+ $category_id = $category->cat_ID;
194
+
195
+ $category_name = $category->cat_name;
196
+
197
+ $badge_args = mycred_get_badges_by_term_id( $category_id );
198
+
199
+ $badges_count = count( $badge_args );
200
+ if ($badges_count > 0) {
201
+ ?>
202
+ <input type="radio" name="mycred-tabset" id="mycred-tab<?php echo $category_id;?>" aria-controls="mycred-tab-area-<?php echo $category_id ?>" <?php if ($counter == 1) echo 'checked'; ?>>
203
+ <label for="mycred-tab<?php echo $category_id;?>">
204
+ <?php echo $category_name ?>
205
+ <span class="mycred-badge-count"><?php echo $badges_count?></span>
206
+ </label>
207
+ <?php
208
+ }
209
+ $counter++;
210
+ }
211
+
212
+ echo '<div class="mycred-tab-panels">';
213
+
214
+ //Body
215
+ foreach ( $categories as $category ) {
216
+
217
+ $category_id = $category->cat_ID;
218
+
219
+ $category_name = $category->cat_name;
220
+
221
+ //Gathering Badges
222
+ $badge_args = mycred_get_badges_by_term_id( $category_id );
223
+ ?>
224
+ <section id="mycred-tab-area-<?php echo $category_id ?>" class="mycred-tab-panel">
225
+ <?php
226
+
227
+ foreach ( $badge_args as $badge ) {
228
+
229
+ $badge_id = $badge->ID;
230
+
231
+ $badge_object = mycred_get_badge( $badge_id );
232
+
233
+ $image_url = $badge_object->main_image_url;
234
+
235
+ $has_earned = $badge_object->user_has_badge( $user_id ) ? 'earned' : 'not-earned';
236
+
237
+ ?>
238
+
239
+ <div class="mycred-badges-list-item <?php echo $has_earned; ?>" data-url="<?php echo mycred_get_permalink( $badge_id );?>">
240
+ <?php if ( $image_url ): ?>
241
+ <img src="<?php echo esc_url( $image_url ) ?>" alt="Badge Image">
242
+ <?php endif; ?>
243
+ <div class="mycred-left">
244
+ <h3>
245
+ <?php echo $badge->post_title; ?>
246
+ </h3>
247
+ <?php echo $badge->post_excerpt; ?>
248
+ </div>
249
+ <div class="clear"></div>
250
+ </div>
251
+ <?php
252
+ }
253
+ ?>
254
+ </section>
255
+ <?php
256
+ }
257
+ wp_reset_query();
258
+ ?>
259
+ </div>
260
+ </div>
261
+
262
+ <?php
263
+ }
264
+ else {
265
+ //Show Badges
266
+ while ( $query->have_posts() ) : $query->the_post();
267
+
268
+ $badge_id = get_the_ID();
269
+
270
+ $badge_object = mycred_get_badge( $badge_id );
271
+
272
+ $image_url = $badge_object->main_image_url;
273
+
274
+ $has_earned = $badge_object->user_has_badge( $user_id ) ? 'earned' : 'not-earned';
275
+
276
+ $category = mycred_get_badge_type( $badge_id );
277
+
278
+ $categories = explode(',', $category);
279
+
280
+ ?>
281
+ <div class="mycred-badges-list-item <?php echo $has_earned; ?>" data-url="<?php echo mycred_get_permalink( $badge_id );?>">
282
+ <?php if ( $image_url ): ?>
283
+ <img src="<?php echo esc_url( $image_url ) ?>" alt="Badge Image">
284
+ <?php endif; ?>
285
+ <div class="mycred-left">
286
+ <h3>
287
+ <?php echo get_the_title(); ?>
288
+ </h3>
289
+ <?php
290
+ if( $category_count > 0 ) {
291
+
292
+ foreach ($categories as $category) {
293
+
294
+ if( $category != '' ) {
295
+ echo '<sup class="mycred-sup-category">'.$category.'</sup>';
296
+ }
297
+
298
+ }
299
+
300
+ }
301
+ ?>
302
+ <?php echo the_excerpt(); ?>
303
+ </div>
304
+ <div class="clear"></div>
305
+ </div>
306
+ <?php
307
+ endwhile;
308
+
309
+ echo '<div>';
310
+ }
311
+ ?>
312
+
313
+ <script type="text/javascript">
314
+
315
+ jQuery(document).ready(function(){
316
+
317
+ jQuery('.mycred-badges-list-item').click(function(){
318
+
319
+ window.location.href = jQuery(this).data('url');
320
+
321
+ });
322
+
323
+ });
324
+
325
+ </script>
326
+
327
+ <?php
328
+ $content = ob_get_clean();
329
+
330
+ return $content;
331
+ }
332
+ endif;
333
+
334
+ /**
335
+ * Renders Badge's Evidence ShortCode
336
+ * @param string $atts
337
+ * @since 2.1
338
+ * @version 1.0
339
+ */
340
+ if ( !function_exists( 'mycred_render_badge_evidence' ) ) :
341
+ function mycred_render_badge_evidence( $atts = '' ) {
342
+
343
+ $content = '<div class="mycred-evidence-page">Evidence not found</div>';
344
+
345
+ if ( isset( $_GET['uid'] ) && isset( $_GET['bid'] ) ) {
346
+
347
+ $user_id = intval( $_GET['uid'] );
348
+ $badge_id = intval( $_GET['bid'] );
349
+
350
+ $user_info = get_userdata( $user_id );
351
+ $badge = mycred_get_badge( $badge_id );
352
+
353
+ if ( $user_info && $badge && $badge->open_badge ) {
354
+
355
+ $issued_on = mycred_get_user_meta( $user_id, MYCRED_BADGE_KEY . $badge_id, '_issued_on', true );
356
+
357
+ $content = '<div class="mycred-evidence-page">
358
+ <div class="mycred-left">
359
+ <img src="' . $badge->get_earned_image( $user_id ) . '" alt="">
360
+ </div>
361
+ <div class="mycred-left intro">
362
+ <h4 class="mycred-remove-margin">' . $badge->title . '</h4>
363
+ <div class="mycred-remove-margin">
364
+ <p>Name: '. $user_info->display_name .'</p>
365
+ <p>Email: ' . $user_info->user_email . '</p>
366
+ <p>Issued On: ' . date( 'Y-m-d\TH:i:sP', $issued_on ) . '</p>
367
+ <p><span class="dashicons dashicons-yes-alt"></span> <span class="icon-txt"> Verified</span></p>
368
+ </div>
369
+ </div>
370
+ <div class="mycred-clear"></div>
371
+ </div>';
372
+
373
+ }
374
+
375
+
376
+ }
377
+
378
+ return $content;
379
+ }
380
+ endif;
addons/badges/includes/mycred-open-badge.php ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * mycred_Open_Badge Class
6
+ * @since 2.1
7
+ * @version 1.0
8
+ */
9
+ if ( ! class_exists('mycred_Open_Badge') ) :
10
+ class mycred_Open_Badge {
11
+
12
+ public $salt;
13
+
14
+ /**
15
+ * Construct
16
+ */
17
+ public function __construct () {
18
+
19
+ $this->salt = apply_filters( 'mycred_open_badge_salt', 'MYCREDOPENBADGE' );
20
+
21
+ }
22
+
23
+ public function register_open_badge_routes() {
24
+
25
+ register_rest_route( 'open-badge', '/assertion/', array(
26
+ 'methods' => 'GET',
27
+ 'callback' => array( $this, 'get_assertion_data' ),
28
+ 'permission_callback' => '__return_true',
29
+ ) );
30
+
31
+ register_rest_route( 'open-badge', '/info/', array(
32
+ 'methods' => 'GET',
33
+ 'callback' => array( $this, 'get_badge_info' ),
34
+ 'permission_callback' => '__return_true',
35
+ ) );
36
+
37
+ register_rest_route( 'open-badge', '/issuer/', array(
38
+ 'methods' => 'GET',
39
+ 'callback' => array( $this, 'get_issuer_data' ),
40
+ 'permission_callback' => '__return_true',
41
+ ) );
42
+
43
+ }
44
+
45
+ function bake_users_image( $user_id, $badge_id ) {
46
+
47
+ $badge = mycred_get_badge( $badge_id );
48
+
49
+ if ( ! $badge->open_badge ) return;
50
+
51
+ $wp_upload_dirs = wp_upload_dir();
52
+ $basedir = trailingslashit( $wp_upload_dirs[ 'basedir' ] );
53
+ $baseurl = trailingslashit( $wp_upload_dirs[ 'baseurl' ] );
54
+
55
+ $folderName = apply_filters( 'mycred_open_badge_folder', 'open_badges' );
56
+
57
+ $user_badge_directory = $basedir . $folderName;
58
+
59
+ if ( ! file_exists( $user_badge_directory ) && ! is_dir( $user_badge_directory ) ) {
60
+ mkdir( $user_badge_directory );
61
+ }
62
+
63
+ $user_badge_directory = trailingslashit( $user_badge_directory );
64
+
65
+ $badge_image = $badge->main_image_url;
66
+
67
+ $badge_image_path = str_replace( $baseurl, $basedir, $badge_image );
68
+
69
+ $user_info = get_userdata( $user_id );
70
+
71
+ $identity = 'sha256$' . hash( 'sha256', $user_info->user_email . $this->salt );
72
+
73
+ $json = $this->get_image_json_data( $user_id, $badge_id, $identity, $badge->title, $badge_image );
74
+
75
+ $filename = "badge-{$badge_id}-{$user_id}.png";
76
+
77
+ $this->bake_image( $badge_image, $badge_image_path, $json, $filename, $user_badge_directory );
78
+
79
+ $user_image_url = trailingslashit( $baseurl . $folderName ).$user_id;
80
+
81
+ $json['user_image'] = trailingslashit( $user_image_url ) . $filename;
82
+
83
+ mycred_update_user_meta( $user_id, "open-badge-{$badge_id}-{$user_id}", '', $json );
84
+
85
+ }
86
+
87
+ public function get_assertion_data() {
88
+
89
+ $assertion_data = array();
90
+
91
+ if ( ! empty( $_GET['uid'] ) && ! empty( $_GET['bid'] ) ) {
92
+
93
+ $user_id = intval( $_GET['uid'] );
94
+ $badge_id = intval( $_GET['bid'] );
95
+
96
+ $user_info = get_userdata( $user_id );
97
+ $badge = mycred_get_badge( $badge_id );
98
+
99
+ if ( $user_info && $badge ) {
100
+
101
+ mycred_set_current_account( $user_id );
102
+
103
+ if( $badge->user_has_badge( $user_id ) ) {
104
+
105
+ $identity_id = 'sha256$' . hash( 'sha256', $user_info->user_email . $this->salt );
106
+
107
+ $issuedOn = mycred_get_user_meta( $user_id, MYCRED_BADGE_KEY . $badge_id, '_issued_on', true );
108
+
109
+ $assertion_data = array(
110
+ '@context' => 'https://w3id.org/openbadges/v2',
111
+ 'type' => 'Assertion',
112
+ 'id' => $this->get_assertion_url( $user_id, $badge_id ),
113
+ 'recipient' => array(
114
+ 'type' => 'email',
115
+ 'hashed' => true,
116
+ 'salt' => $this->salt,
117
+ 'identity' => $identity_id
118
+ ),
119
+ 'badge' => $this->get_badge_info_url( $badge_id ),
120
+ 'issuedOn' => date( 'Y-m-d\TH:i:sP', $issuedOn ),
121
+ 'image' => $badge->main_image_url,
122
+ 'verification' => array(
123
+ 'type' => 'HostedBadge',
124
+ 'verificationProperty' => 'id',
125
+ ),
126
+ 'evidence' => $this->get_evidence_url( $user_id, $badge_id )
127
+ );
128
+
129
+ }
130
+
131
+ }
132
+
133
+ }
134
+
135
+ return wp_send_json( $assertion_data );
136
+
137
+ }
138
+
139
+ public function get_badge_info() {
140
+
141
+ $badge_info = array();
142
+
143
+ if ( ! empty( $_GET['bid'] ) ) {
144
+
145
+ $badge_id = intval( $_GET['bid'] );
146
+
147
+ $badge = mycred_get_badge( $badge_id );
148
+
149
+ if( $badge ) {
150
+
151
+ $badge_info = array(
152
+ '@context' => 'https://w3id.org/openbadges/v2',
153
+ 'type' => 'BadgeClass',
154
+ 'id' => $this->get_badge_info_url( $badge_id ),
155
+ 'name' => $badge->title,
156
+ 'image' => $badge->main_image_url,
157
+ 'description' => '',
158
+ 'criteria' => mycred_get_permalink( $badge_id ),
159
+ 'issuer' => $this->get_endpoint_url( 'issuer' ),
160
+ 'tags' => array()
161
+ );
162
+
163
+ }
164
+
165
+ }
166
+
167
+ return wp_send_json( $badge_info );
168
+
169
+ }
170
+
171
+ public function get_issuer_data() {
172
+
173
+ $blog_title = get_bloginfo( 'name' );
174
+ $admin_email = get_bloginfo( 'admin_email' );
175
+ $blog_url = get_site_url();
176
+
177
+ $issuer_data = array(
178
+ '@context' => 'https://w3id.org/openbadges/v2',
179
+ 'type' => 'Issuer',
180
+ 'id' => $this->get_endpoint_url( 'issuer' ),
181
+ 'name' => $blog_title,
182
+ 'url' => $blog_url,
183
+ 'email' => $admin_email
184
+ );
185
+
186
+ return wp_send_json( $issuer_data );
187
+
188
+ }
189
+
190
+ public function get_image_json_data( $user_id, $badge_id, $identity, $badge_title, $badge_image ) {
191
+
192
+ return array(
193
+ '@context' => 'https://w3id.org/openbadges/v2',
194
+ 'type' => 'Assertion',
195
+ 'id' => $this->get_assertion_url( $user_id, $badge_id ),
196
+ 'recipient' => array(
197
+ 'type' => 'email',
198
+ 'hashed' => true,
199
+ 'salt' => $this->salt,
200
+ 'identity' => $identity
201
+ ),
202
+ 'badge' => array(
203
+ '@context' => 'https://w3id.org/openbadges/v2',
204
+ 'type' => 'BadgeClass',
205
+ 'id' => $this->get_badge_info_url( $badge_id ),
206
+ 'name' => $badge_title,
207
+ 'image' => $badge_image,
208
+ 'description' => '',
209
+ 'criteria' => mycred_get_permalink( $badge_id ),
210
+ 'issuer' => $this->get_endpoint_url( 'issuer' ),
211
+ 'tags' => [],
212
+ ),
213
+ 'issuedOn' => date('Y-m-d\TH:i:sP'),
214
+ 'image' => $badge_image,
215
+ 'verification' => array(
216
+ 'type' => 'HostedBadge',
217
+ 'verificationProperty' => 'id',
218
+ ),
219
+ 'evidence' => $this->get_evidence_url( $user_id, $badge_id )
220
+ );
221
+
222
+ }
223
+
224
+ public function bake_image( $badge_image, $badge_image_path, $json, $filename, $user_badge_directory ) {
225
+
226
+ $png = file_get_contents( $badge_image );
227
+
228
+ if( $png == false ) {
229
+ $png = file_get_contents( $badge_image_path, true );
230
+ }
231
+
232
+ $embed = [
233
+ 'openbadges',
234
+ '',
235
+ '',
236
+ '',
237
+ '',
238
+ ( string ) json_encode( $json ),
239
+ ];
240
+
241
+ // Glue with null-bytes.
242
+ $data = implode( "\0", $embed );
243
+
244
+ // Make the CRC.
245
+ $crc = pack( "N", crc32( 'iTXt' . $data ) );
246
+
247
+ // Put it all together.
248
+ $final = pack( "N", strlen( $data ) ) . 'iTXt' . $data . $crc;
249
+
250
+ // What's the length?
251
+ $length = strlen( $png );
252
+
253
+ // Put this all at the end, before IEND.
254
+ // We _should_ be removing all other iTXt blobs with keyword openbadges
255
+ // before writing this out.
256
+ $png = substr( $png, 0, $length - 12 ) . $final . substr( $png, $length - 12, 12 );
257
+
258
+ file_put_contents( $user_badge_directory . '/' . $filename, $png );
259
+
260
+ }
261
+
262
+ public function get_endpoint_url( $endpoint ) {
263
+
264
+ return get_site_url() . '/wp-json/open-badge/' . $endpoint;
265
+
266
+ }
267
+
268
+ public function get_assertion_url( $user_id, $badge_id ) {
269
+
270
+ $assertion_url = add_query_arg( 'uid', $user_id, $this->get_endpoint_url( 'assertion' ) );
271
+ $assertion_url = add_query_arg( 'bid', $badge_id, $assertion_url );
272
+
273
+ return $assertion_url;
274
+ }
275
+
276
+ public function get_badge_info_url( $badge_id ) {
277
+
278
+ $badge_info_url = add_query_arg( 'bid', $badge_id, $this->get_endpoint_url( 'info' ) );
279
+
280
+ return $badge_info_url;
281
+
282
+ }
283
+
284
+ public function get_evidence_url( $user_id, $badge_id ) {
285
+
286
+ $evidence_page_id = mycred_get_evidence_page_id();
287
+
288
+ $evidence_url = add_query_arg( 'uid', $user_id, mycred_get_permalink( $evidence_page_id ) );
289
+ $evidence_url = add_query_arg( 'bid', $badge_id, $evidence_url );
290
+
291
+ return $evidence_url;
292
+
293
+ }
294
+
295
+ }
296
+ endif;
addons/badges/myCRED-addon-badges.php CHANGED
@@ -7,26 +7,31 @@
7
  if ( ! defined( 'myCRED_VERSION' ) ) exit;
8
 
9
  define( 'myCRED_BADGE', __FILE__ );
10
- define( 'myCRED_BADGE_VERSION', '1.2' );
11
  define( 'MYCRED_BADGE_DIR', myCRED_ADDONS_DIR . 'badges/' );
12
  define( 'MYCRED_BADGE_INCLUDES_DIR', MYCRED_BADGE_DIR . 'includes/' );
13
 
14
  // Badge Key
15
  if ( ! defined( 'MYCRED_BADGE_KEY' ) )
16
- define( 'MYCRED_BADGE_KEY', 'mycred_badge' );
 
 
 
 
17
 
18
  // Default badge width
19
  if ( ! defined( 'MYCRED_BADGE_WIDTH' ) )
20
- define( 'MYCRED_BADGE_WIDTH', 100 );
21
 
22
  // Default badge height
23
  if ( ! defined( 'MYCRED_BADGE_HEIGHT' ) )
24
- define( 'MYCRED_BADGE_HEIGHT', 100 );
25
 
26
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-functions.php';
27
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-shortcodes.php';
28
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-object.php';
29
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-secondary.php';
 
30
 
31
  /**
32
  * myCRED_buyCRED_Module class
@@ -34,574 +39,730 @@ require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-secondary.php';
34
  * @version 1.2
35
  */
36
  if ( ! class_exists( 'myCRED_Badge_Module' ) ) :
37
- class myCRED_Badge_Module extends myCRED_Module {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
- /**
40
- * Construct
41
- */
42
- function __construct( $type = MYCRED_DEFAULT_TYPE_KEY ) {
43
 
44
- parent::__construct( 'myCRED_Badge_Module', array(
45
- 'module_name' => 'badges',
46
- 'defaults' => array(
47
- 'buddypress' => '',
48
- 'bbpress' => '',
49
- 'show_all_bp' => 0,
50
- 'show_all_bb' => 0
51
- ),
52
- 'add_to_core' => true,
53
- 'register' => false,
54
- 'menu_pos' => 50
55
- ), $type );
56
 
57
- }
 
58
 
59
- /**
60
- * Module Pre Init
61
- * @since 1.0
62
- * @version 1.0
63
- */
64
- public function module_pre_init() {
65
 
66
- add_filter( 'mycred_add_finished', array( $this, 'add_finished' ), 30, 3 );
67
 
68
- }
69
 
70
- /**
71
- * Module Init
72
- * @since 1.0
73
- * @version 1.0.3
74
- */
75
- public function module_init() {
76
-
77
- $this->register_badges();
78
-
79
- add_action( 'mycred_set_current_account', array( $this, 'populate_current_account' ) );
80
- add_action( 'mycred_get_account', array( $this, 'populate_account' ) );
81
-
82
- add_shortcode( MYCRED_SLUG . '_my_badges', 'mycred_render_my_badges' );
83
- add_shortcode( MYCRED_SLUG . '_badges', 'mycred_render_badges' );
84
-
85
- // Insert into bbPress
86
- if ( class_exists( 'bbPress' ) ) {
87
-
88
- if ( $this->badges['bbpress'] == 'profile' || $this->badges['bbpress'] == 'both' )
89
- add_action( 'bbp_template_after_user_profile', array( $this, 'insert_into_bbpress_profile' ) );
90
-
91
- if ( $this->badges['bbpress'] == 'reply' || $this->badges['bbpress'] == 'both' )
92
- add_action( 'bbp_theme_after_reply_author_details', array( $this, 'insert_into_bbpress_reply' ) );
93
-
94
- }
95
-
96
- // Insert into BuddyPress
97
- if ( class_exists( 'BuddyPress' ) ) {
98
-
99
- // Insert into header
100
- if ( $this->badges['buddypress'] == 'header' || $this->badges['buddypress'] == 'both' )
101
- add_action( 'bp_before_member_header_meta', array( $this, 'insert_into_buddypress' ) );
102
-
103
- // Insert into profile
104
- if ( $this->badges['buddypress'] == 'profile' || $this->badges['buddypress'] == 'both' )
105
- add_action( 'bp_after_profile_loop_content', array( $this, 'insert_into_buddypress' ) );
106
-
107
- }
108
-
109
- add_action( 'mycred_add_menu', array( $this, 'add_to_menu' ), $this->menu_pos );
110
-
111
- }
112
-
113
- /**
114
- * Module Admin Init
115
- * @since 1.0
116
- * @version 1.1
117
- */
118
- public function module_admin_init() {
119
-
120
- add_filter( 'parent_file', array( $this, 'parent_file' ) );
121
- add_filter( 'submenu_file', array( $this, 'subparent_file' ), 10, 2 );
122
- add_action( 'mycred_admin_enqueue', array( $this, 'enqueue_scripts' ), $this->menu_pos );
123
-
124
- add_filter( 'post_row_actions', array( $this, 'adjust_row_actions' ), 10, 2 );
125
-
126
- add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
127
- add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) );
128
- add_action( 'post_submitbox_start', array( $this, 'publishing_actions' ) );
129
-
130
- add_action( 'wp_ajax_mycred-assign-badge', array( $this, 'action_assign_badge' ) );
131
- add_action( 'wp_ajax_mycred-remove-connections', array( $this, 'action_remove_connections' ) );
132
-
133
- add_action( 'mycred_user_edit_after_balances', array( $this, 'badge_user_screen' ), 10 );
134
-
135
- add_action( 'personal_options_update', array( $this, 'save_manual_badges' ), 10 );
136
- add_action( 'edit_user_profile_update', array( $this, 'save_manual_badges' ), 10 );
137
-
138
- add_action( 'mycred_delete_point_type', array( $this, 'delete_point_type' ) );
139
- add_action( 'before_delete_post', array( $this, 'delete_badge' ) );
140
-
141
- add_filter( 'manage_' . MYCRED_BADGE_KEY . '_posts_columns', array( $this, 'adjust_column_headers' ) );
142
- add_action( 'manage_' . MYCRED_BADGE_KEY . '_posts_custom_column', array( $this, 'adjust_column_content' ), 10, 2 );
143
- add_action( 'save_post_' . MYCRED_BADGE_KEY, array( $this, 'save_badge' ), 10, 2 );
144
-
145
- }
146
 
147
- /**
148
- * Register Badge Post Type
149
- * @since 1.0
150
- * @version 1.0
151
- */
152
- public function register_badges() {
153
 
154
- $labels = array(
155
- 'name' => __( 'Badges', 'mycred' ),
156
- 'singular_name' => __( 'Badge', 'mycred' ),
157
- 'add_new' => __( 'Add New', 'mycred' ),
158
- 'add_new_item' => __( 'Add New', 'mycred' ),
159
- 'edit_item' => __( 'Edit Badge', 'mycred' ),
160
- 'new_item' => __( 'New Badge', 'mycred' ),
161
- 'all_items' => __( 'Badges', 'mycred' ),
162
- 'view_item' => __( 'View Badge', 'mycred' ),
163
- 'search_items' => __( 'Search Badge', 'mycred' ),
164
- 'not_found' => __( 'No badges found', 'mycred' ),
165
- 'not_found_in_trash' => __( 'No badges found in Trash', 'mycred' ),
166
- 'parent_item_colon' => '',
167
- 'menu_name' => __( 'Badges', 'mycred' )
168
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
- $args = array(
171
- 'labels' => $labels,
172
- 'supports' => array( 'title' ),
173
- 'hierarchical' => false,
174
- 'public' => false,
175
- 'show_ui' => true,
176
- 'show_in_menu' => false,
177
- 'show_in_nav_menus' => false,
178
- 'show_in_admin_bar' => false,
179
- 'can_export' => true,
180
- 'has_archive' => false,
181
- 'exclude_from_search' => true,
182
- 'publicly_queryable' => false,
183
- 'register_meta_box_cb' => array( $this, 'add_metaboxes' )
184
- );
 
 
 
 
 
 
 
 
 
 
 
185
 
186
- register_post_type( MYCRED_BADGE_KEY, apply_filters( 'mycred_register_badge', $args ) );
187
 
188
- }
189
 
190
- /**
191
- * Populate Current Account
192
- * @since 1.8
193
- * @version 1.0
194
- */
195
- public function populate_current_account() {
196
 
197
- global $mycred_current_account;
198
 
199
- if ( isset( $mycred_current_account )
200
- && ( $mycred_current_account instanceof myCRED_Account )
201
- && ( isset( $mycred_current_account->badges ) )
202
- ) return;
 
 
 
203
 
204
- $earned = array();
205
- $users_badges = mycred_get_users_badges( $mycred_current_account->user_id, true );
206
 
207
- if ( ! empty( $users_badges ) ) {
208
- foreach ( $users_badges as $badge_id => $level ) {
 
209
 
210
- if ( ! is_numeric( $level ) )
211
- $level = 0;
212
 
213
- $badge_id = absint( $badge_id );
214
- $level = absint( $level );
215
- $badge = mycred_get_badge( $badge_id, $level );
 
 
 
216
 
217
- $earned[ $badge_id ] = $badge;
218
 
219
- }
220
- }
 
 
 
 
221
 
222
- $mycred_current_account->badges = $earned;
223
- $mycred_current_account->badge_ids = $users_badges;
224
-
225
- }
226
-
227
- /**
228
- * Populate Account
229
- * @since 1.8
230
- * @version 1.0
231
- */
232
- public function populate_account() {
233
-
234
- global $mycred_account;
235
-
236
- if ( isset( $mycred_account )
237
- && ( $mycred_account instanceof myCRED_Account )
238
- && ( isset( $mycred_account->badges ) )
239
- ) return;
240
-
241
- $earned = array();
242
- $users_badges = mycred_get_users_badges( $mycred_account->user_id );
243
-
244
- if ( ! empty( $users_badges ) ) {
245
- foreach ( $users_badges as $badge_id => $level ) {
246
-
247
- if ( ! is_numeric( $level ) )
248
- $level = 0;
249
-
250
- $badge_id = absint( $badge_id );
251
- $level = absint( $level );
252
- $badge = mycred_get_badge( $badge_id, $level );
253
-
254
- $earned[ $badge_id ] = $badge;
255
-
256
- }
257
- }
258
-
259
- $mycred_account->badges = $earned;
260
- $mycred_account->badge_ids = $users_badges;
261
-
262
- }
263
-
264
- /**
265
- * Delete Point Type
266
- * When a point type is deleted, we want to remove any data saved for this point type.
267
- * @since 1.7
268
- * @version 1.0
269
- */
270
- public function delete_point_type( $point_type = NULL ) {
271
 
272
- if ( ! mycred_point_type_exists( $point_type ) || $point_type == MYCRED_DEFAULT_TYPE_KEY ) return;
 
 
 
 
 
 
 
 
 
 
 
 
273
 
274
- $mycred = mycred( $point_type );
275
 
276
- if ( ! $mycred->user_is_point_editor() ) return;
277
 
278
- mycred_delete_option( 'mycred-badge-refs-' . $point_type );
 
 
 
 
 
279
 
280
- }
 
 
281
 
282
- /**
283
- * Delete Badge
284
- * When a badge is deleted, we want to delete connections as well.
285
- * @since 1.7
286
- * @version 1.0
287
- */
288
- public function delete_badge( $post_id ) {
289
 
290
- if ( get_post_status( $post_id ) != MYCRED_BADGE_KEY ) return $post_id;
 
 
 
 
 
 
291
 
292
- // Delete reference list to force a new query
293
- foreach ( $this->point_types as $type_id => $label )
294
- mycred_delete_option( 'mycred-badge-refs-' . $type_id );
295
 
296
- global $wpdb;
 
 
 
 
 
297
 
298
- // Delete connections to keep usermeta table clean
299
- $wpdb->delete(
300
- $wpdb->usermeta,
301
- array( 'meta_key' => MYCRED_BADGE_KEY . $post_id ),
302
- array( '%s' )
303
- );
304
 
305
- }
306
 
307
- /**
308
- * Adjust Post Updated Messages
309
- * @since 1.0
310
- * @version 1.0
311
- */
312
- public function post_updated_messages( $messages ) {
313
 
314
- global $post;
315
 
316
- $messages[ MYCRED_BADGE_KEY ] = array(
317
- 0 => '',
318
- 1 => __( 'Badge Updated.', 'mycred' ),
319
- 2 => __( 'Badge Updated.', 'mycred' ),
320
- 3 => __( 'Badge Updated.', 'mycred' ),
321
- 4 => __( 'Badge Updated.', 'mycred' ),
322
- 5 => false,
323
- 6 => __( 'Badge Enabled.', 'mycred' ),
324
- 7 => __( 'Badge Saved.', 'mycred' ),
325
- 8 => __( 'Badge Updated.', 'mycred' ),
326
- 9 => __( 'Badge Updated.', 'mycred' ),
327
- 10 => __( 'Badge Updated.', 'mycred' )
328
- );
329
 
330
- return $messages;
331
 
332
- }
333
 
334
- /**
335
- * Add Admin Menu Item
336
- * @since 1.7
337
- * @version 1.1
338
- */
339
- public function add_to_menu() {
340
 
341
- // In case we are using the Master Template feautre on multisites, and this is not the main
342
- // site in the network, bail.
343
- if ( mycred_override_settings() && ! mycred_is_main_site() ) return;
344
 
345
- add_submenu_page(
346
- MYCRED_SLUG,
347
- __( 'Badges', 'mycred' ),
348
- __( 'Badges', 'mycred' ),
349
- $this->core->get_point_editor_capability(),
350
- 'edit.php?post_type=' . MYCRED_BADGE_KEY
351
- );
352
 
353
- }
354
 
355
- /**
356
- * Parent File
357
- * @since 1.6
358
- * @version 1.0.2
359
- */
360
- public function parent_file( $parent = '' ) {
361
 
362
- global $pagenow;
363
 
364
- if ( ( $pagenow == 'edit.php' || $pagenow == 'post-new.php' ) && isset( $_GET['post_type'] ) && $_GET['post_type'] == MYCRED_BADGE_KEY ) {
365
-
366
- return MYCRED_SLUG;
367
-
368
- }
369
 
370
- elseif ( $pagenow == 'post.php' && isset( $_GET['post'] ) && mycred_get_post_type( $_GET['post'] ) == MYCRED_BADGE_KEY ) {
371
 
372
- return MYCRED_SLUG;
373
 
374
- }
375
 
376
- return $parent;
377
 
378
- }
379
 
380
- /**
381
- * Sub Parent File
382
- * @since 1.7
383
- * @version 1.0
384
- */
385
- public function subparent_file( $subparent = '', $parent = '' ) {
386
 
387
- global $pagenow;
388
 
389
- if ( ( $pagenow == 'edit.php' || $pagenow == 'post-new.php' ) && isset( $_GET['post_type'] ) && $_GET['post_type'] == MYCRED_BADGE_KEY ) {
 
 
 
 
 
390
 
391
- return 'edit.php?post_type=' . MYCRED_BADGE_KEY;
392
-
393
- }
394
 
395
- elseif ( $pagenow == 'post.php' && isset( $_GET['post'] ) && mycred_get_post_type( $_GET['post'] ) == MYCRED_BADGE_KEY ) {
396
 
397
- return 'edit.php?post_type=' . MYCRED_BADGE_KEY;
398
 
399
- }
 
 
400
 
401
- return $subparent;
 
402
 
403
- }
 
404
 
405
- /**
406
- * Add Finished
407
- * @since 1.0
408
- * @version 1.4
409
- */
410
- public function add_finished( $result, $request, $mycred ) {
411
-
412
- if ( is_bool( $request ) ) return $result;
413
 
414
- extract( $request );
415
 
416
- if ( $result !== false && $ref != 'badge_reward' ) {
417
 
418
- // Check if this reference has badges
419
- $badge_ids = mycred_ref_has_badge( $ref, $type );
420
- if ( $badge_ids !== false ) {
421
 
422
- // Check if user gets any of the badges
423
- foreach ( $badge_ids as $badge_id ) {
424
 
425
- $badge = mycred_get_badge( $badge_id );
426
- if ( $badge === false ) continue;
427
 
428
- // Check what level we reached (if we reached any)
429
- $level_reached = $badge->query_users_level( $user_id );
430
- if ( $level_reached !== false )
431
- $badge->assign( $user_id, $level_reached );
 
 
432
 
433
- }
 
434
 
435
- }
 
 
 
 
 
 
 
436
 
437
- }
 
438
 
439
- return $result;
 
440
 
441
- }
442
 
443
- /**
444
- * Adjust Badge Column Header
445
- * @since 1.0
446
- * @version 1.0
447
- */
448
- public function adjust_column_headers( $defaults ) {
449
 
450
- $columns = array();
451
- $columns['cb'] = $defaults['cb'];
452
 
453
- // Add / Adjust
454
- $columns['title'] = __( 'Badge Name', 'mycred' );
455
- $columns['badge-default-image'] = __( 'Default Image', 'mycred' );
456
- $columns['badge-earned-image'] = __( 'First Level', 'mycred' );
457
- $columns['badge-reqs'] = __( 'Requirements', 'mycred' );
458
- $columns['badge-users'] = __( 'Users', 'mycred' );
459
 
460
- // Return
461
- return $columns;
462
 
463
- }
464
 
465
- /**
466
- * Adjust Badge Column Content
467
- * @since 1.0
468
- * @version 1.2
469
- */
470
- public function adjust_column_content( $column_name, $badge_id ) {
471
 
472
- // Default Images
473
- if ( $column_name == 'badge-default-image' ) {
 
 
 
 
474
 
475
- $badge = mycred_get_badge( $badge_id );
476
- if ( $badge === false || $badge->main_image === false )
477
- echo '-';
478
 
479
- elseif ( $badge->main_image !== false )
480
- echo $badge->main_image;
481
 
482
- }
483
 
484
- // First Level Image
485
- if ( $column_name == 'badge-earned-image' ) {
486
 
487
- $badge = mycred_get_badge( $badge_id );
488
- $image = $badge->get_image( 0 );
489
- if ( $image === false)
490
- echo '-';
491
- else
492
- echo $image;
493
 
494
- }
 
 
495
 
496
- // Badge Requirements
497
- elseif ( $column_name == 'badge-reqs' ) {
498
 
499
- echo mycred_display_badge_requirements( $badge_id );
500
 
501
- }
 
502
 
503
- // Badge Users
504
- elseif ( $column_name == 'badge-users' ) {
505
 
506
- $badge = mycred_get_badge( $badge_id );
507
- if ( $badge === false )
508
- echo 0;
509
 
510
- else
511
- echo $badge->earnedby;
512
 
513
- }
 
514
 
515
- }
516
 
517
- /**
518
- * Adjust Row Actions
519
- * @since 1.0
520
- * @version 1.0
521
- */
522
- public function adjust_row_actions( $actions, $post ) {
523
 
524
- if ( $post->post_type == MYCRED_BADGE_KEY ) {
525
- unset( $actions['inline hide-if-no-js'] );
526
- unset( $actions['view'] );
527
- }
528
 
529
- return $actions;
530
 
531
- }
 
 
 
 
 
532
 
533
- /**
534
- * Adjust Enter Title Here
535
- * @since 1.0
536
- * @version 1.0
537
- */
538
- public function enter_title_here( $title ) {
539
 
540
- global $post_type;
541
 
542
- if ( $post_type == MYCRED_BADGE_KEY )
543
- return __( 'Badge Name', 'mycred' );
544
 
545
- return $title;
 
 
 
 
 
546
 
547
- }
548
 
549
- /**
550
- * Enqueue Scripts
551
- * @since 1.0
552
- * @version 1.0.1
553
- */
554
- public function enqueue_scripts() {
555
 
556
- $screen = get_current_screen();
557
- if ( $screen->id == MYCRED_BADGE_KEY ) {
558
 
559
- wp_enqueue_media();
560
 
561
- wp_register_script(
562
- 'mycred-edit-badge',
563
- plugins_url( 'assets/js/edit-badge.js', myCRED_BADGE ),
564
- array( 'jquery', 'mycred-mustache' ),
565
- myCRED_BADGE_VERSION . '.1'
566
- );
567
 
568
- wp_localize_script(
569
- 'mycred-edit-badge',
570
- 'myCREDBadge',
571
- array(
572
- 'ajaxurl' => admin_url( 'admin-ajax.php' ),
573
- 'addlevel' => esc_js( __( 'Add Level', 'mycred' ) ),
574
- 'removelevel' => esc_js( __( 'Remove Level', 'mycred' ) ),
575
- 'setimage' => esc_js( __( 'Set Image', 'mycred' ) ),
576
- 'changeimage' => esc_js( __( 'Change Image', 'mycred' ) ),
577
- 'remove' => esc_js( esc_attr__( 'Are you sure you want to remove this level?', 'mycred' ) ),
578
- 'levellabel' => esc_js( sprintf( '%s {{level}}', __( 'Level', 'mycred' ) ) ),
579
- 'uploadtitle' => esc_js( esc_attr__( 'Badge Image', 'mycred' ) ),
580
- 'uploadbutton' => esc_js( esc_attr__( 'Use as Badge', 'mycred' ) ),
581
- 'compareAND' => esc_js( _x( 'AND', 'Comparison of badge requirements. A AND B', 'mycred' ) ),
582
- 'compareOR' => esc_js( _x( 'OR', 'Comparison of badge requirements. A OR B', 'mycred' ) )
583
- )
584
- );
585
 
586
- wp_enqueue_script( 'mycred-edit-badge' );
587
 
588
- wp_enqueue_style( 'mycred-bootstrap-grid' );
589
- wp_enqueue_style( 'mycred-forms' );
 
 
 
 
590
 
591
- add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-setup', array( $this, 'metabox_classes' ) );
592
- add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-default', array( $this, 'metabox_classes' ) );
593
- add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-rewards', array( $this, 'metabox_classes' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
594
 
595
- echo '<style type="text/css">
 
 
 
 
 
 
 
 
 
596
  #misc-publishing-actions #visibility, #misc-publishing-actions .misc-pub-post-status { display: none; }
597
  #save-action #save-post { margin-bottom: 12px; }
598
  </style>';
599
 
600
- }
601
 
602
- elseif ( $screen->id == 'edit-' . MYCRED_BADGE_KEY ) {
603
 
604
- echo '<style type="text/css">
605
  th#badge-default-image { width: 120px; }
606
  th#badge-earned-image { width: 120px; }
607
  th#badge-reqs { width: 35%; }
@@ -612,985 +773,1343 @@ th#badge-users { width: 10%; }
612
  .mycred-badge-requirement-list li span { float: right; }
613
  .column-badge-reqs strong { display: block; }
614
  .column-badge-reqs span { color: #aeaeae; }
 
615
  </style>';
616
 
617
- }
618
 
619
- }
620
 
621
- /**
622
- * Add Meta Boxes
623
- * @since 1.0
624
- * @version 1.0
625
- */
626
- public function add_metaboxes() {
627
 
628
- add_meta_box(
629
- 'mycred-badge-setup',
630
- __( 'Badge Setup', 'mycred' ),
631
- array( $this, 'metabox_badge_setup' ),
632
- MYCRED_BADGE_KEY,
633
- 'normal',
634
- 'high'
635
- );
636
 
637
- add_meta_box(
638
- 'mycred-badge-default',
639
- __( 'Default Badge Image', 'mycred' ),
640
- array( $this, 'metabox_badge_default' ),
641
- MYCRED_BADGE_KEY,
642
- 'side',
643
- 'low'
644
- );
645
 
646
- }
 
 
 
 
 
 
 
 
647
 
648
- /**
649
- * Level Template
650
- * @since 1.7
651
- * @version 1.0
652
- */
653
- public function level_template( $level = 0 ) {
 
 
654
 
655
- if ( $level == 0 )
656
- return '<div class="row badge-level" id="mycred-badge-level{{level}}" data-level="{{level}}"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center">{{addlevelbutton}}<div class="level-image"><div class="level-image-wrapper image-wrapper {{emptylevelimage}}">{{levelimage}}</div><div class="level-image-actions"><button type="button" class="button button-secondary change-level-image" data-level="{{level}}">{{levelimagebutton}}</button></div></div><div class="label-field"><input type="text" placeholder="{{levelplaceholder}}" name="mycred_badge[levels][{{level}}][label]" value="{{levellabel}}" /></div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="req-title">{{requirementslabel}}<div class="pull-right" id="badge-requirement-compare"><a href="javascript:void(0);" data-do="AND" class="{{adnselected}}">AND</a> / <a href="javascript:void(0);" data-do="OR" class="{{orselected}}">OR</a><input type="hidden" name="mycred_badge[levels][{{level}}][compare]" value="{{badge_compare_andor}}" /></div></div><div class="level-requirements">{{{requirements}}}</div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">{{rewards}}</div></div>';
657
 
658
- return '<div class="row badge-level" id="mycred-badge-level{{level}}" data-level="{{level}}"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center">{{removelevelbutton}}<div class="level-image"><div class="level-image-wrapper image-wrapper {{emptylevelimage}}">{{levelimage}}</div><div class="level-image-actions"><button type="button" class="button button-secondary change-level-image" data-level="{{level}}">{{levelimagebutton}}</button></div></div><div class="label-field"><input type="text" placeholder="{{levelplaceholder}}" name="mycred_badge[levels][{{level}}][label]" value="{{levellabel}}" /></div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="req-title">{{requirementslabel}}</div><div class="level-requirements">{{{requirements}}}</div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">{{rewards}}</div></div>';
 
 
 
 
 
659
 
660
- }
661
 
662
- /**
663
- * Get Level Image
664
- * @since 1.7
665
- * @version 1.0
666
- */
667
- public function get_level_image( $setup, $level = 0 ) {
668
 
669
- $image = false;
670
 
671
- if ( $setup['attachment_id'] > 0 ) {
 
672
 
673
- $_image = wp_get_attachment_url( $setup['attachment_id'] );
674
- if ( strlen( $_image ) > 5 )
675
- $image = '<img src="' . $_image . '" alt="Badge level image" /><input type="hidden" name="mycred_badge[levels][' . $level . '][attachment_id]" value="' . $setup['attachment_id'] . '" /><input type="hidden" name="mycred_badge[levels][' . $level . '][image_url]" value="" />';
676
 
677
- }
678
- else {
679
 
680
- if ( strlen( $setup['image_url'] ) > 5 )
681
- $image = '<img src="' . $setup['image_url'] . '" alt="Badge level image" /><input type="hidden" name="mycred_badge[levels][' . $level . '][attachment_id]" value="0" /><input type="hidden" name="mycred_badge[levels][' . $level . '][image_url]" value="' . $setup['image_url'] . '" />';
682
 
683
- }
684
 
685
- return $image;
 
 
 
 
 
686
 
687
- }
688
 
689
- /**
690
- * Requirements Template
691
- * @since 1.7
692
- * @version 1.0
693
- */
694
- public function requirements_template( $level = 0 ) {
695
 
696
- // only first level dictates requirements
697
- if ( $level == 0 )
698
- return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}" data-row="{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][type]" data-row="{{reqlevel}}" class="form-control point-type">{{pointtypes}}</select></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][reference]" data-row="{{reqlevel}}" class="form-control reference">{{references}}</select></div>{{{customrequirement}}}</div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][by]" data-row="{{reqlevel}}" class="form-control req-type">{{requirementtype}}</select></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 form">{{reqbutton}}</div></div>';
699
 
700
- // All other requirements reflect the level 0's setup
701
- return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group level-type"><p class="form-control-static level-requirement{{reqlevel}}-type">{{selectedtype}}</p></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group level-ref"><p class="form-control-static level-requirement{{reqlevel}}-ref">{{selectedref}}</p><p>{{refspecific}}</p></div></div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group level-val"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group level-type-by"><p class="form-control-static level-requirement{{reqlevel}}-by">{{selectedby}}</p></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 level-compare form"><p class="form-control-static" data-row="{{reqlevel}}">{{comparelabel}}</p></div></div>';
702
 
703
- }
 
704
 
705
- /**
706
- * Rewards Template
707
- * @since 1.7
708
- * @version 1.0
709
- */
710
- public function rewards_template() {
711
 
712
- return '<div class="req-title">{{rewardlabel}}</div><div class="row form"><div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"><select name="mycred_badge[levels][{{level}}][reward][type]" class="form-control">{{pointtypes}}</select></div><div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"><input type="text" class="form-control" name="mycred_badge[levels][{{level}}][reward][log]" placeholder="{{logplaceholder}}" value="{{logtemplate}}" /></div><div class="col-lg-2 col-md-2 col-sm-12 col-xs-12"><input type="text" class="form-control" name="mycred_badge[levels][{{level}}][reward][amount]" placeholder="0" value="{{rewardamount}}" /></div></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
 
714
- }
 
 
 
 
 
 
 
715
 
716
- /**
717
- * Badge Publishing Actions
718
- * @since 1.7
719
- * @version 1.1
720
- */
721
- public function publishing_actions() {
722
-
723
- global $post;
724
-
725
- if ( ! isset( $post->post_type ) || $post->post_type != MYCRED_BADGE_KEY ) return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
 
727
- $manual_badge = ( (int) mycred_get_post_meta( $post->ID, 'manual_badge', true ) == 1 ) ? true : false;
728
-
729
- ?>
730
- <div id="mycred-badge-actions" class="seperate-bottom">
 
731
 
732
- <?php do_action( 'mycred_edit_badge_before_actions', $post ); ?>
 
 
733
 
734
- <input type="hidden" name="mycred-badge-edit" value="<?php echo wp_create_nonce( 'edit-mycred-badge' ); ?>" />
735
- <input type="button" id="mycred-assign-badge-connections"<?php if ( $manual_badge || $post->post_status != 'publish' ) echo ' disabled="disabled"'; ?> value="<?php _e( 'Assign Badge', 'mycred' ); ?>" class="button button-secondary mycred-badge-action-button" data-action="mycred-assign-badge" data-token="<?php echo wp_create_nonce( 'mycred-assign-badge' ); ?>" />
736
- <input type="button" id="mycred-remove-badge-connections"<?php if ( $post->post_status != 'publish' ) echo ' disabled="disabled"'; ?> value="<?php _e( 'Remove Connections', 'mycred' ); ?>" class="button button-secondary mycred-badge-action-button" data-action="mycred-remove-connections" data-token="<?php echo wp_create_nonce( 'mycred-remove-badge-connection' ); ?>" />
737
 
738
- <?php do_action( 'mycred_edit_badge_after_actions', $post ); ?>
 
739
 
740
- <script type="text/javascript">
741
- jQuery(function($) {
742
 
743
- $( 'input.mycred-badge-action-button' ).click(function(){
744
- var button = $(this);
745
- var label = button.val();
746
 
747
- $.ajax({
748
- type : "POST",
749
- data : {
750
- action : button.attr( 'data-action' ),
751
- token : button.attr( 'data-token' ),
752
- badge_id : <?php echo $post->ID; ?>
753
- },
754
- dataType : "JSON",
755
- url : ajaxurl,
756
- beforeSend : function() {
757
- button.attr( 'value', '<?php echo esc_js( esc_attr__( 'Processing...', 'mycred' ) ); ?>' );
758
- button.attr( 'disabled', 'disabled' );
759
- },
760
- success : function( response ) {
761
- alert( response.data );
762
- button.removeAttr( 'disabled' );
763
- button.val( label );
764
- }
765
- });
766
- return false;
767
 
768
- });
 
769
 
770
- });
771
- </script>
772
 
773
- </div>
774
- <div id="mycred-manual-badge" class="seperate-bottom">
775
- <label for="mycred-badge-is-manual"><input type="checkbox" name="mycred_badge[manual]" id="mycred-badge-is-manual"<?php if ( $manual_badge ) echo ' checked="checked"'; ?> value="1" /> <?php _e( 'This badge is manually awarded.', 'mycred' ); ?></label>
776
- </div>
777
- <?php
778
 
779
- }
780
-
781
- /**
782
- * Default Image Metabox
783
- * @since 1.7
784
- * @version 1.0
785
- */
786
- public function metabox_badge_default( $post ) {
787
-
788
- $default_image = $di = mycred_get_post_meta( $post->ID, 'main_image', true );
789
- if ( $default_image != '' )
790
- $default_image = '<img src="' . $default_image . '" alt="" />';
791
-
792
- $attachment = false;
793
- if ( is_numeric( $di ) && strpos( '://', $di ) === false ) {
794
- $attachment = $di;
795
- $default_image = '<img src="' . wp_get_attachment_url( $di ) . '" alt="" />';
796
- }
797
-
798
- ?>
799
- <div class="row">
800
- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
801
- <div class="default-image text-center seperate-bottom">
802
- <div class="default-image-wrapper image-wrapper<?php if ( $default_image == '' ) echo ' empty dashicons'; ?>">
803
- <?php echo $default_image; ?>
804
- <input type="hidden" name="mycred_badge[main_image]" id="badge-main-image-id" value="<?php if ( $attachment ) echo esc_attr( $di ); ?>" />
805
- <input type="hidden" name="mycred_badge[main_image_url]" id="badge-main-image-url" value="<?php if ( $di != '' && strpos( '://', $di ) !== false ) echo esc_attr( $default_image ); ?>" />
806
- </div>
807
- <div class="level-image-actions">
808
- <button type="button" class="button button-secondary" id="badges-change-default-image" data-do="<?php if ( $default_image == '' ) echo 'set'; else echo 'change'; ?>"><?php if ( $default_image == '' ) _e( 'Set Image', 'mycred' ); else _e( 'Change Image', 'mycred' ); ?></button>
809
- <button type="button" class="button button-secondary <?php echo ( ( ! $attachment ) ? 'hidden' : '' ); ?>" id="badges-remove-default-image"><?php _e( 'Remove Image', 'mycred' ); ?></button>
810
- </div>
811
- </div>
812
- <span class="description"><?php _e( 'Optional image to show when a user has not earned this badge.', 'mycred' ); ?></span>
813
- </div>
814
- </div>
815
- <?php
816
 
817
- }
 
 
 
 
 
 
 
 
818
 
819
- /**
820
- * Badge Setup Metabox
821
- * @since 1.7
822
- * @version 1.2
823
- */
824
- public function metabox_badge_setup( $post ) {
825
 
826
- $badge = mycred_get_badge( $post->ID );
827
- $references = mycred_get_all_references();
828
- $point_types = mycred_get_types( true );
 
 
 
 
 
 
829
 
830
- $sums = apply_filters( 'mycred_badge_requirement_sums', array(
831
- 'count' => esc_js( __( 'Time(s)', 'mycred' ) ),
832
- 'sum' => esc_js( __( 'In total', 'mycred' ) )
833
- ), $badge );
834
 
835
- // Badge rewards can no be used as a requirement
836
- if ( array_key_exists( 'badge_reward', $references ) )
837
- unset( $references['badge_reward'] );
838
 
839
- $js_level = $this->level_template( 1 );
840
- $js_requirement = $this->requirements_template( 0 );
841
- $js_requirement_clone = $this->requirements_template( 1 );
842
 
843
- ?>
844
- <div id="badge-levels">
845
- <?php
846
 
847
- // Loop through each badge level
848
- $level_counter = 0;
849
- foreach ( $badge->levels as $level => $setup ) {
 
 
 
 
 
 
850
 
851
- $level = $level_counter;
852
 
853
- $add_level = '<button type="button" class="button button-seconary button-small top-right-corner" id="badges-add-new-level">' . esc_js( __( 'Add Level', 'mycred' ) ) . '</button>';
854
- $remove_level = '<button type="button" class="button button-seconary button-small top-right-corner remove-badge-level" data-level="' . $level . '">' . esc_js( __( 'Remove Level', 'mycred' ) ) . '</button>';
855
 
856
- $level_image = $this->get_level_image( $setup, $level );
857
- $empty_level = 'empty dashicons';
858
- if ( $level_image !== false )
859
- $empty_level = '';
860
 
861
- $template = $this->level_template( $level );
862
 
863
- $template = str_replace( '{{level}}', $level, $template );
864
- $template = str_replace( '{{addlevelbutton}}', $add_level, $template );
865
- $template = str_replace( '{{removelevelbutton}}', $remove_level, $template );
866
 
867
- $js_level = str_replace( '{{removelevelbutton}}', $remove_level, $js_level );
868
- $js_level = str_replace( '{{emptylevelimage}}', $empty_level, $js_level );
869
- $js_level = str_replace( '{{levelimage}}', '', $js_level );
870
- $js_level = str_replace( '{{levelimagebutton}}', esc_js( __( 'Set Image', 'mycred' ) ), $js_level );
871
- $js_level = str_replace( '{{levelplaceholder}}', esc_js( __( 'Level', 'mycred' ) ) . ' {{levelone}}', $js_level );
872
 
873
- $template = str_replace( '{{levelimage}}', $level_image, $template );
874
- $template = str_replace( '{{emptylevelimage}}', $empty_level, $template );
875
- $template = str_replace( '{{levelimagebutton}}', ( ( $level_image === false ) ? esc_js( __( 'Set Image', 'mycred' ) ) : esc_js( __( 'Change Image', 'mycred' ) ) ), $template );
876
 
877
- $template = str_replace( '{{levelplaceholder}}', esc_js( sprintf( __( 'Level %d', 'mycred' ), $level+1 ) ), $template );
878
- $template = str_replace( '{{levellabel}}', esc_js( $setup['label'] ), $template );
 
879
 
880
- $template = str_replace( '{{requirementslabel}}', esc_js( __( 'Requirement', 'mycred' ) ), $template );
881
- $js_level = str_replace( '{{requirementslabel}}', esc_js( __( 'Requirement', 'mycred' ) ), $js_level );
882
 
883
- $template = str_replace( '{{adnselected}}', ( ( $setup['compare'] === 'AND' ) ? 'selected' : '' ), $template );
884
- $template = str_replace( '{{orselected}}', ( ( $setup['compare'] === 'OR' ) ? 'selected' : '' ), $template );
885
 
886
- $template = str_replace( '{{badge_compare_andor}}', ( ( isset($setup['compare']) && !empty($setup['compare']) ) ? $setup['compare'] : 'AND' ), $template );
 
 
887
 
888
- //$requirement = $this->requirements_template( 1 );
889
 
890
- $total_requirements = count( $setup['requires'] );
891
- $level_requirements = '';
 
892
 
893
- foreach ( $setup['requires'] as $req_level => $reqsetup ) {
 
894
 
895
- $requirement = $this->requirements_template( $level );
896
 
897
- $requirement = str_replace( '{{level}}', $level, $requirement );
898
- $requirement = str_replace( '{{reqlevel}}', $req_level, $requirement );
899
 
900
- $point_type_options = '';
901
- $point_type_options .= '<option value=""';
902
- if ( $reqsetup['type'] == '' ) $point_type_options .= ' selected="selected"';
903
- $point_type_options .= '>' . esc_js( __( 'Select Point Type', 'mycred' ) ) . '</option>';
904
- foreach ( $point_types as $type_id => $type_label ) {
905
- $point_type_options .= '<option value="' . esc_attr( $type_id ) . '"';
906
- if ( $reqsetup['type'] == $type_id ) $point_type_options .= ' selected="selected"';
907
- $point_type_options .= '>' . esc_html( $type_label ) . '</option>';
908
- }
909
 
910
- $requirement = str_replace( '{{pointtypes}}', $point_type_options, $requirement );
911
- $point_type_options = str_replace( 'selected="selected"', '', $point_type_options );
912
- $js_requirement = str_replace( '{{pointtypes}}', $point_type_options, $js_requirement );
913
 
914
- $reference_options = '';
915
- $reference_options .= '<option value=""';
916
- if ( $reqsetup['reference'] == '' ) $reference_options .= ' selected="selected"';
917
- $reference_options .= '>' . esc_js( __( 'Select Reference', 'mycred' ) ) . '</option>';
918
- foreach ( $references as $ref_id => $ref_label ) {
919
- $reference_options .= '<option value="' . esc_attr( $ref_id ) . '"';
920
- if ( $reqsetup['reference'] == $ref_id ) $reference_options .= ' selected="selected"';
921
- $reference_options .= '>' . esc_html( $ref_label ) . '</option>';
922
- }
923
 
924
- $requirement = str_replace( '{{references}}', $reference_options, $requirement );
925
 
926
- $requirement_specific = apply_filters( 'mycred_badge_requirement_specific_template', '', $req_level, $reqsetup, $badge, $level );
927
- $requirement = str_replace( '{{{customrequirement}}}', $requirement_specific, $requirement );
928
 
929
- $requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $requirement );
 
 
 
 
 
930
 
931
- $reference_options = str_replace( 'selected="selected"', '', $reference_options );
932
- $js_requirement = str_replace( '{{references}}', $reference_options, $js_requirement );
933
- $js_requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $js_requirement );
 
934
 
935
- $by_options = '';
936
- $by_options .= '<option value=""';
937
- if ( $reqsetup['by'] == '' ) $by_options .= ' selected="selected"';
938
- $by_options .= '>' . __( 'Select', 'mycred' ) . '</option>';
939
- foreach ( $sums as $sum_id => $sum_label ) {
940
- $by_options .= '<option value="' . $sum_id . '"';
941
- if ( $reqsetup['by'] == $sum_id ) $by_options .= ' selected="selected"';
942
- $by_options .= '>' . $sum_label . '</option>';
943
- }
944
 
945
- $requirement = str_replace( '{{requirementtype}}', $by_options, $requirement );
946
 
947
- $by_options = str_replace( 'selected="selected"', '', $by_options );
948
- $js_requirement = str_replace( '{{requirementtype}}', $by_options, $js_requirement );
949
 
950
- $selectedtype = '-';
951
- if ( array_key_exists( $reqsetup['type'], $point_types ) )
952
- $selectedtype = $point_types[ $reqsetup['type'] ];
953
 
954
- $requirement = str_replace( '{{selectedtype}}', $selectedtype, $requirement );
955
 
956
- $requirement = str_replace( '{{refspecific}}', '', $requirement );
957
 
958
- $selectedreference = '-';
959
- if ( array_key_exists( $reqsetup['reference'], $references ) )
960
- $selectedreference = $references[ $reqsetup['reference'] ];
961
 
962
- $requirement = str_replace( '{{selectedref}}', $selectedreference, $requirement );
 
 
 
 
 
 
 
963
 
964
- $selectedby = '-';
965
- if ( array_key_exists( $reqsetup['by'], $sums ) )
966
- $selectedby = $sums[ $reqsetup['by'] ];
967
 
968
- $requirement = str_replace( '{{selectedby}}', $selectedby, $requirement );
 
 
 
 
 
969
 
970
- $requirement_button = '<button type="button" class="button button-primary form-control remove-requirement" data-req="{{reqlevel}}">-</button>';
971
- $js_requirement = str_replace( '{{reqbutton}}', $requirement_button, $js_requirement );
972
 
973
- $requirement_button = '<button type="button" class="button button-primary form-control remove-requirement" data-req="' . $req_level . '">-</button>';
974
- if ( $req_level == 0 )
975
- $requirement_button = '<button type="button" class="button button-secondary form-control" id="badges-add-new-requirement">+</button>';
976
 
977
- $requirement = str_replace( '{{reqbutton}}', $requirement_button, $requirement );
 
 
978
 
979
- $compare_label = '';
980
- if ( $level > 0 && $req_level < $total_requirements )
981
- $compare_label = ( ( $setup['compare'] === 'AND' ) ? _x( 'AND', 'Comparison of badge requirements. A AND B', 'mycred' ) : _x( 'OR', 'Comparison of badge requirements. A OR B', 'mycred' ) );
982
 
983
- if ( $req_level+1 == $total_requirements )
984
- $compare_label = '';
 
985
 
986
- $requirement = str_replace( '{{comparelabel}}', esc_js( $compare_label ), $requirement );
 
 
987
 
988
- $level_requirements .= $requirement;
 
 
989
 
990
- }
 
991
 
992
- $template = str_replace( '{{{requirements}}}', $level_requirements, $template );
 
993
 
994
- $rewards = $this->rewards_template();
995
 
996
- $js_level = str_replace( '{{reqamount}}', '', $js_level );
997
 
998
- $rewards = str_replace( '{{level}}', $level, $rewards );
999
- $rewards = str_replace( '{{rewardlabel}}', esc_js( __( 'Reward', 'mycred' ) ), $rewards );
1000
 
1001
- $point_type_options = '';
1002
- foreach ( $point_types as $type_id => $type_label ) {
1003
- $point_type_options .= '<option value="' . $type_id . '"';
1004
- if ( $setup['reward']['type'] == $type_id ) $point_type_options .= ' selected="selected"';
1005
- $point_type_options .= '>' . $type_label . '</option>';
1006
- }
 
 
 
1007
 
1008
- $rewards = str_replace( '{{pointtypes}}', $point_type_options, $rewards );
1009
- $rewards = str_replace( '{{logplaceholder}}', esc_js( __( 'Log template', 'mycred' ) ), $rewards );
1010
- $rewards = str_replace( '{{logtemplate}}', esc_js( $setup['reward']['log'] ), $rewards );
1011
- $rewards = str_replace( '{{rewardamount}}', $setup['reward']['amount'], $rewards );
1012
 
1013
- $template = str_replace( '{{rewards}}', $rewards, $template );
 
 
 
1014
 
1015
- $rewards = str_replace( $level, '{{level}}', $rewards );
1016
 
1017
- $js_level = str_replace( '{{rewards}}', $rewards, $js_level );
1018
 
1019
- echo $template;
1020
 
1021
- $level_counter++;
 
1022
 
1023
- }
 
 
 
 
 
1024
 
1025
- ?>
1026
- </div>
1027
- <script type="text/javascript">
1028
- var BadgeLevel = '<?php echo $js_level; ?>';
1029
- var BadgeNewRequrement = '<?php echo $js_requirement; ?>';
1030
- var BadgeRequirement = '<?php echo $js_requirement_clone; ?>';
1031
- </script>
1032
- <?php
1033
 
1034
- }
1035
 
1036
- /**
1037
- * Save Badge Details
1038
- * @since 1.7
1039
- * @version 1.1
1040
- */
1041
- public function save_badge( $post_id, $post = NULL ) {
1042
 
1043
- if ( $post === NULL || ! $this->core->user_is_point_editor() || ! isset( $_POST['mycred_badge'] ) ) return $post_id;
 
1044
 
1045
- $manual = 0;
1046
- if ( isset( $_POST['mycred_badge']['manual'] ) )
1047
- $manual = 1;
 
1048
 
1049
- $badge_levels = array();
1050
- $badge_requirements = array();
1051
 
1052
- // Run through each level
1053
- if ( ! empty( $_POST['mycred_badge']['levels'] ) ) {
1054
 
1055
- $level_row = 0;
1056
- foreach ( $_POST['mycred_badge']['levels'] as $level_id => $level_setup ) {
1057
 
1058
- $level = array();
1059
 
1060
- if ( array_key_exists( 'attachment_id', $level_setup ) ) {
1061
- $level['attachment_id'] = absint( $level_setup['attachment_id'] );
1062
- $level['image_url'] = ( ( array_key_exists( 'image_url', $level_setup ) ) ? sanitize_text_field( $level_setup['image_url'] ) : '' );
1063
- }
1064
- else {
1065
- $level['attachment_id'] = 0;
1066
- $level['image_url'] = '';
1067
- }
1068
 
1069
- $level['label'] = sanitize_text_field( $level_setup['label'] );
1070
 
1071
- if ( array_key_exists( 'compare', $level_setup ) )
1072
- $level['compare'] = ( ( $level_setup['compare'] == 'AND' ) ? 'AND' : 'OR' );
1073
- else
1074
- $level['compare'] = ( ( array_key_exists( 'compare', $badge_levels[0] ) ) ? $badge_levels[0]['compare'] : 'AND' );
1075
 
1076
- $level['requires'] = array();
 
 
 
1077
 
1078
- if ( array_key_exists( 'requires', $level_setup ) ) {
1079
 
1080
- $level_requirements = array();
1081
 
1082
- $row = 0;
1083
- foreach ( $level_setup['requires'] as $requirement_id => $requirement_setup ) {
1084
 
1085
- $requirement = array();
1086
- $requirement['type'] = ( ( array_key_exists( 'type', $requirement_setup ) ) ? sanitize_key( $requirement_setup['type'] ) : '' );
1087
- $requirement['reference'] = ( ( array_key_exists( 'reference', $requirement_setup ) ) ? sanitize_key( $requirement_setup['reference'] ) : '' );
1088
- $requirement['amount'] = ( ( array_key_exists( 'amount', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['amount'] ) : '' );
1089
- $requirement['by'] = ( ( array_key_exists( 'by', $requirement_setup ) ) ? sanitize_key( $requirement_setup['by'] ) : '' );
1090
- $requirement['specific'] = ( ( array_key_exists( 'specific', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['specific'] ) : '' );
1091
 
1092
- $level_requirements[ $row ] = $requirement;
1093
- $row ++;
1094
 
1095
- }
 
1096
 
1097
- if ( $level_row == 0 )
1098
- $badge_requirements = $level_requirements;
 
 
 
 
 
1099
 
1100
- $completed_requirements = array();
1101
- foreach ( $level_requirements as $requirement_id => $requirement_setup ) {
 
1102
 
1103
- if ( $level_row == 0 ) {
1104
- $completed_requirements[ $requirement_id ] = $requirement_setup;
1105
- continue;
1106
- }
1107
 
1108
- $completed_requirements[ $requirement_id ] = $badge_requirements[ $requirement_id ];
1109
- $completed_requirements[ $requirement_id ]['amount'] = $requirement_setup['amount'];
1110
 
1111
- }
1112
 
1113
- $level['requires'] = $completed_requirements;
1114
 
1115
- }
 
1116
 
1117
- $reward = array( 'type' => '', 'log' => '', 'amount' => '' );
1118
 
1119
- if ( array_key_exists( 'reward', $level_setup ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1120
 
1121
- $reward['type'] = sanitize_key( $level_setup['reward']['type'] );
1122
- $reward['log'] = sanitize_text_field( $level_setup['reward']['log'] );
 
 
1123
 
1124
- if ( $reward['type'] != MYCRED_DEFAULT_TYPE_KEY )
1125
- $mycred = mycred( $reward['type'] );
1126
- else
1127
- $mycred = $this->core;
 
1128
 
1129
- $reward['amount'] = $mycred->number( $level_setup['reward']['amount'] );
1130
 
1131
- }
1132
 
1133
- $level['reward'] = $reward;
 
 
 
1134
 
1135
- $badge_levels[] = $level;
1136
- $level_row ++;
1137
 
1138
- }
 
 
1139
 
1140
- }
1141
 
1142
- // Save Badge Setup
1143
- mycred_update_post_meta( $post_id, 'badge_prefs', $badge_levels );
 
1144
 
1145
- // If we just set the badge to be manual we need to re-parse all references.
1146
- $old_manual = mycred_get_post_meta( $post_id, 'manual_badge', true );
1147
- if ( absint( $old_manual ) === 0 && $manual === 1 ) {
1148
- foreach ( $this->point_types as $type_id => $label ) {
1149
- mycred_get_badge_references( $type_id, true );
1150
- }
1151
- }
1152
 
1153
- // Force re-calculation of used references
1154
- foreach ( $this->point_types as $type_id => $type )
1155
- mycred_delete_option( 'mycred-badge-refs-' . $type_id );
 
 
 
 
 
1156
 
1157
- // Save if badge is manuall
1158
- mycred_update_post_meta( $post_id, 'manual_badge', $manual );
1159
 
1160
- // Main image (used when a user has not earned a badge
1161
- $main_image = $_POST['mycred_badge']['main_image'];
1162
 
1163
- // If we are using an attachment
1164
- if ( absint( $main_image ) > 0 )
1165
- $image = absint( $main_image );
1166
 
1167
- // Else we are using a URL (old setup)
1168
- else
1169
- $image = sanitize_text_field( $_POST['mycred_badge']['main_image_url'] );
1170
 
1171
- mycred_update_post_meta( $post_id, 'main_image', $image );
 
 
1172
 
1173
- // Let others play
1174
- do_action( 'mycred_save_badge', $post_id );
1175
 
1176
- }
 
 
 
 
 
1177
 
1178
- /**
1179
- * Add to General Settings
1180
- * @since 1.0
1181
- * @version 1.1
1182
- */
1183
- public function after_general_settings( $mycred = NULL ) {
1184
 
1185
- $settings = $this->badges;
1186
 
1187
- $buddypress = ( ( class_exists( 'BuddyPress' ) ) ? true : false );
1188
- $bbpress = ( ( class_exists( 'bbPress' ) ) ? true : false );
1189
 
1190
- ?>
1191
- <h4><span class="dashicons dashicons-admin-plugins static"></span><?php _e( 'Badges', 'mycred' ); ?></h4>
1192
- <div class="body" style="display:none;">
1193
 
1194
- <h3><?php _e( 'Third-party Integrations', 'mycred' ); ?></h3>
1195
- <div class="row">
1196
- <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
1197
- <div class="form-group">
1198
- <label for="<?php echo $this->field_id( 'buddypress' ); ?>">BuddyPress</label>
1199
- <?php if ( $buddypress ) : ?>
1200
- <select name="<?php echo $this->field_name( 'buddypress' ); ?>" id="<?php echo $this->field_id( 'buddypress' ); ?>" class="form-control">
1201
- <?php
1202
 
1203
- $buddypress_options = array(
1204
- '' => __( 'Do not show', 'mycred' ),
1205
- 'header' => __( 'Include in Profile Header', 'mycred' ),
1206
- 'profile' => __( 'Include under the "Profile" tab', 'mycred' ),
1207
- 'both' => __( 'Include under the "Profile" tab and Profile Header', 'mycred' )
1208
- );
1209
-
1210
- foreach ( $buddypress_options as $location => $description ) {
1211
- echo '<option value="' . $location . '"';
1212
- if ( isset( $settings['buddypress'] ) && $settings['buddypress'] == $location ) echo ' selected="selected"';
1213
- echo '>' . $description . '</option>';
1214
- }
1215
-
1216
- ?>
1217
-
1218
- </select>
1219
- </div>
1220
- <div class="form-group">
1221
- <div class="checkbox">
1222
- <label for="<?php echo $this->field_id( 'show_all_bp' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_all_bp' ); ?>" id="<?php echo $this->field_id( 'show_all_bp' ); ?>" <?php checked( $settings['show_all_bp'], 1 ); ?> value="1" /> <?php _e( 'Show all badges, including badges users have not yet earned.', 'mycred' ); ?></label>
1223
- </div>
1224
- <?php else : ?>
1225
- <input type="hidden" name="<?php echo $this->field_name( 'buddypress' ); ?>" id="<?php echo $this->field_id( 'buddypress' ); ?>" value="" />
1226
- <p><span class="description"><?php _e( 'Not installed', 'mycred' ); ?></span></p>
1227
- <?php endif; ?>
1228
- </div>
1229
- </div>
1230
- <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
1231
- <div class="form-group">
1232
- <label for="<?php echo $this->field_id( 'bbpress' ); ?>">bbPress</label>
1233
- <?php if ( $bbpress ) : ?>
1234
- <select name="<?php echo $this->field_name( 'bbpress' ); ?>" id="<?php echo $this->field_id( 'bbpress' ); ?>" class="form-control">
1235
- <?php
1236
 
1237
- $bbpress_options = array(
1238
- '' => __( 'Do not show', 'mycred' ),
1239
- 'profile' => __( 'Include in Profile', 'mycred' ),
1240
- 'reply' => __( 'Include in Forum Replies', 'mycred' ),
1241
- 'both' => __( 'Include in Profile and Forum Replies', 'mycred' )
1242
- );
1243
-
1244
- foreach ( $bbpress_options as $location => $description ) {
1245
- echo '<option value="' . $location . '"';
1246
- if ( isset( $settings['bbpress'] ) && $settings['bbpress'] == $location ) echo ' selected="selected"';
1247
- echo '>' . $description . '</option>';
1248
- }
1249
-
1250
- ?>
1251
-
1252
- </select>
1253
- </div>
1254
- <div class="form-group">
1255
- <div class="checkbox">
1256
- <label for="<?php echo $this->field_id( 'show_all_bb' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_all_bb' ); ?>" id="<?php echo $this->field_id( 'show_all_bb' ); ?>" <?php checked( $settings['show_all_bb'], 1 ); ?> value="1" /> <?php _e( 'Show all badges, including badges users have not yet earned.', 'mycred' ); ?></label>
1257
- </div>
1258
- <?php else : ?>
1259
- <input type="hidden" name="<?php echo $this->field_name( 'bbpress' ); ?>" id="<?php echo $this->field_id( 'bbpress' ); ?>" value="" />
1260
- <p><span class="description"><?php _e( 'Not installed', 'mycred' ); ?></span></p>
1261
- <?php endif; ?>
1262
- </div>
1263
- </div>
1264
- </div>
1265
-
1266
- <h3 style="margin-bottom: 0;"><?php _e( 'Available Shortcodes', 'mycred' ); ?></h3>
1267
- <div class="row">
1268
- <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
1269
- <p><a href="http://codex.mycred.me/shortcodes/mycred_my_badges/" target="_blank">[mycred_my_badges]</a>, <a href="http://codex.mycred.me/shortcodes/mycred_badges/" target="_blank">[mycred_badges]</a></p>
1270
- </div>
1271
- </div>
1272
-
1273
- </div>
1274
- <?php
1275
 
1276
- }
1277
-
1278
- /**
1279
- * Save Settings
1280
- * @since 1.0
1281
- * @version 1.0.2
1282
- */
1283
- public function sanitize_extra_settings( $new_data, $data, $core ) {
1284
-
1285
- $new_data['badges']['show_all_bp'] = ( isset( $data['badges']['show_all_bp'] ) ) ? $data['badges']['show_all_bp'] : 0;
1286
- $new_data['badges']['show_all_bb'] = ( isset( $data['badges']['show_all_bb'] ) ) ? $data['badges']['show_all_bb'] : 0;
1287
-
1288
- $new_data['badges']['buddypress'] = ( isset( $data['badges']['buddypress'] ) ) ? sanitize_text_field( $data['badges']['buddypress'] ) : '';
1289
- $new_data['badges']['bbpress'] = ( isset( $data['badges']['bbpress'] ) ) ? sanitize_text_field( $data['badges']['bbpress'] ) : '';
1290
-
1291
- return $new_data;
1292
-
1293
- }
1294
-
1295
- /**
1296
- * User Badges Admin Screen
1297
- * @since 1.0
1298
- * @version 1.1
1299
- */
1300
- public function badge_user_screen( $user ) {
1301
-
1302
- // Only visible to admins
1303
- if ( ! mycred_is_admin() ) return;
1304
-
1305
- $user_id = $user->ID;
1306
- $all_badges = mycred_get_badge_ids();
1307
- $users_badges = mycred_get_users_badges( $user_id );
1308
-
1309
- ?>
1310
- <style type="text/css">
1311
- .badge-wrapper { min-height: 230px; }
1312
- .badge-wrapper select { width: 100%; }
1313
- .badge-image-wrap { text-align: center; }
1314
- .badge-image-wrap .badge-image { display: block; width: 100%; height: 100px; line-height: 100px; }
1315
- .badge-image-wrap .badge-image.empty { content: "<?php _e( 'No image set', 'mycred' ); ?>"; }
1316
- .badge-image-wrap .badge-image img { width: auto; height: auto; max-height: 100px; }
1317
- </style>
1318
- <table class="form-table">
1319
- <tr>
1320
- <th scope="row"><?php _e( 'Badges', 'mycred' ); ?></th>
1321
- <td>
1322
- <fieldset id="mycred-badge-list" class="badge-list">
1323
- <legend class="screen-reader-text"><span><?php _e( 'Badges', 'mycred' ); ?></span></legend>
1324
- <?php
1325
 
1326
- if ( ! empty( $all_badges ) ) {
1327
- foreach ( $all_badges as $badge_id ) {
 
1328
 
1329
- $badge_id = absint( $badge_id );
1330
- $badge = mycred_get_badge( $badge_id );
1331
- $earned = 0;
1332
- $earned_level = 0;
1333
- $badge_image = $badge->main_image;
1334
 
1335
- if ( array_key_exists( $badge_id, $users_badges ) ) {
1336
- $earned = 1;
1337
- $earned_level = $users_badges[ $badge_id ];
1338
- $badge_image = $badge->get_image( $earned_level );
1339
- }
1340
 
1341
- $level_select = '<input type="hidden" name="mycred_badge_manual[badges][' . $badge_id . '][level]" value="0" /><select disabled="disabled"><option>Level 1</option></select>';
1342
- if ( count( $badge->levels ) > 1 ) {
1343
 
1344
- $level_select = '<select name="mycred_badge_manual[badges][' . $badge_id . '][level]">';
1345
- $level_select .= '<option value=""';
1346
- if ( ! $earned ) $level_select .= ' selected="selected"';
1347
- $level_select .= '>' . __( 'Select a level', 'mycred' ) . '</option>';
1348
 
1349
- foreach ( $badge->levels as $level_id => $level ) {
1350
- $level_select .= '<option value="' . $level_id . '"';
1351
- if ( $earned && $earned_level == $level_id ) $level_select .= ' selected="selected"';
1352
- $level_select .= '>' . ( ( $level['label'] != '' ) ? $level['label'] : sprintf( '%s %d', __( 'Level', 'mycred' ), ( $level_id + 1 ) ) ) . '</option>';
1353
- }
1354
 
1355
- $level_select .= '</select>';
1356
 
1357
- }
1358
 
1359
- ?>
1360
- <div class="badge-wrapper color-option<?php if ( $earned === 1 ) echo ' selected'; ?>" id="mycred-badge<?php echo $badge_id; ?>-wrapper">
1361
- <label for="mycred-badge<?php echo $badge_id; ?>"><input type="checkbox" name="mycred_badge_manual[badges][<?php echo $badge_id; ?>][has]" class="toggle-badge" id="mycred-badge<?php echo $badge_id; ?>" <?php checked( $earned, 1 );?> value="1" /> <?php _e( 'Earned', 'mycred' ); ?></label>
1362
- <div class="badge-image-wrap">
1363
 
1364
- <div class="badge-image<?php if ( $badge_image == '' ) echo ' empty'; ?>"><?php echo $badge_image; ?></div>
1365
 
1366
- <h4><?php echo $badge->title; ?></h4>
1367
- </div>
1368
- <div class="badge-actions" style="min-height: 32px;">
1369
 
1370
- <?php echo $level_select; ?>
1371
 
1372
- </div>
1373
- </div>
1374
- <?php
1375
 
1376
- }
1377
- }
1378
 
1379
- ?>
1380
- </fieldset>
1381
- <input type="hidden" name="mycred_badge_manual[token]" value="<?php echo wp_create_nonce( 'mycred-manual-badges' . $user_id ); ?>" />
1382
- </td>
1383
- </tr>
1384
- </table>
1385
- <script type="text/javascript">
1386
- jQuery(function($) {
1387
 
1388
- $( '.badge-wrapper label input.toggle-badge' ).click(function(){
1389
 
1390
- if ( $(this).is( ':checked' ) )
1391
- $( '#' + $(this).attr( 'id' ) + '-wrapper' ).addClass( 'selected' );
1392
 
1393
- else
1394
- $( '#' + $(this).attr( 'id' ) + '-wrapper' ).removeClass( 'selected' );
 
 
 
 
1395
 
1396
- });
1397
 
1398
- });
1399
- </script>
1400
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1401
 
1402
- }
1403
 
1404
- /**
1405
- * Save Manual Badges
1406
- * @since 1.0
1407
- * @version 1.1
1408
- */
1409
- public function save_manual_badges( $user_id ) {
1410
 
1411
- if ( ! mycred_is_admin() ) return;
1412
 
1413
- if ( isset( $_POST['mycred_badge_manual']['token'] ) ) {
 
 
 
1414
 
1415
- if ( wp_verify_nonce( $_POST['mycred_badge_manual']['token'], 'mycred-manual-badges' . $user_id ) ) {
 
 
 
 
 
 
 
1416
 
1417
- $added = $removed = $updated = 0;
1418
- $users_badges = mycred_get_users_badges( $user_id );
1419
 
1420
- if ( ! empty( $_POST['mycred_badge_manual']['badges'] ) ) {
1421
- foreach ( $_POST['mycred_badge_manual']['badges'] as $badge_id => $data ) {
 
1422
 
1423
- $badge = mycred_get_badge( $badge_id );
 
 
 
 
 
1424
 
1425
- // Most likely not a badge post ID
1426
- if ( $badge === false ) continue;
1427
 
1428
- // Give badge
1429
- if ( ! array_key_exists( $badge_id, $users_badges ) && isset( $data['has'] ) && $data['has'] == 1 ) {
1430
 
1431
- $level = 0;
1432
- if ( isset( $data['level'] ) && $data['level'] != '' )
1433
- $level = absint( $data['level'] );
1434
 
1435
- $badge->assign( $user_id, $level );
1436
 
1437
- $added ++;
 
1438
 
1439
- }
 
1440
 
1441
- // Remove badge
1442
- elseif ( array_key_exists( $badge_id, $users_badges ) && ! isset( $data['has'] ) ) {
1443
 
1444
- $badge->divest( $user_id );
 
 
1445
 
1446
- $removed ++;
 
 
 
 
1447
 
1448
- }
 
1449
 
1450
- // Level change
1451
- elseif ( array_key_exists( $badge_id, $users_badges ) && isset( $data['level'] ) && $data['level'] != $users_badges[ $badge_id ] ) {
1452
 
1453
- $badge->assign( $user_id, $data['level'] );
1454
 
1455
- $updated ++;
 
1456
 
1457
- }
 
 
 
1458
 
1459
- }
1460
- }
1461
 
1462
- if ( $added > 0 || $removed > 0 || $updated > 0 )
1463
- mycred_delete_user_meta( $user_id, 'mycred_badge_ids' );
1464
 
1465
- }
1466
 
1467
- }
1468
 
1469
- }
1470
 
1471
- /**
1472
- * AJAX: Assign Badge
1473
- * @since 1.0
1474
- * @version 1.3
1475
- */
1476
- public function action_assign_badge() {
1477
 
1478
- check_ajax_referer( 'mycred-assign-badge', 'token' );
1479
 
1480
- $badge_id = absint( $_POST['badge_id'] );
1481
- if ( $badge_id === 0 ) wp_send_json_error();
1482
 
1483
- // Get the badge object
1484
- $badge = mycred_get_badge( $badge_id );
1485
 
1486
- // Most likely not a badge post ID
1487
- if ( $badge === false ) wp_send_json_error();
1488
 
1489
- $results = $badge->assign_all();
 
1490
 
1491
- if ( $results > 0 )
1492
- wp_send_json_success( sprintf( __( 'A total of %d users have received this badge.', 'mycred' ), $results ) );
1493
 
1494
- wp_send_json_error( __( 'No users has yet earned this badge.', 'mycred' ) );
1495
 
1496
- }
 
1497
 
1498
- /**
1499
- * AJAX: Remove Badge Connections
1500
- * @since 1.0
1501
- * @version 1.1
1502
- */
1503
- public function action_remove_connections() {
1504
 
1505
- check_ajax_referer( 'mycred-remove-badge-connection', 'token' );
 
1506
 
1507
- $badge_id = absint( $_POST['badge_id'] );
1508
- if ( $badge_id === 0 ) wp_send_json_error();
1509
 
1510
- // Get the badge object
1511
- $badge = mycred_get_badge( $badge_id );
1512
 
1513
- // Most likely not a badge post ID
1514
- if ( $badge === false ) wp_send_json_error();
1515
 
1516
- $results = $badge->divest_all();
 
 
 
1517
 
1518
- if ( $results == 0 )
1519
- wp_send_json_success( __( 'No connections where removed.', 'mycred' ) );
1520
 
1521
- wp_send_json_success( sprintf( __( '%s connections where removed.', 'mycred' ), $results ) );
1522
 
1523
- }
1524
 
1525
- /**
1526
- * Insert Badges into bbPress profile
1527
- * @since 1.0
1528
- * @version 1.1
1529
- */
1530
- public function insert_into_bbpress_profile() {
1531
 
1532
- $user_id = bbp_get_displayed_user_id();
1533
- if ( isset( $this->badges['show_all_bb'] ) && $this->badges['show_all_bb'] == 1 )
1534
- echo mycred_render_my_badges( array(
1535
- 'show' => 'all',
1536
- 'width' => MYCRED_BADGE_WIDTH,
1537
- 'height' => MYCRED_BADGE_HEIGHT,
1538
- 'user_id' => $user_id
1539
- ) );
1540
 
1541
- else
1542
- mycred_display_users_badges( $user_id );
1543
 
1544
- }
1545
 
1546
- /**
1547
- * Insert Badges into bbPress
1548
- * @since 1.0
1549
- * @version 1.1
1550
- */
1551
- public function insert_into_bbpress_reply() {
1552
 
1553
- $user_id = bbp_get_reply_author_id();
1554
 
1555
- if ( $user_id > 0 ) {
 
 
1556
 
1557
- if ( isset( $this->badges['show_all_bb'] ) && $this->badges['show_all_bb'] == 1 )
1558
- echo mycred_render_my_badges( array(
1559
- 'show' => 'all',
1560
- 'width' => MYCRED_BADGE_WIDTH,
1561
- 'height' => MYCRED_BADGE_HEIGHT,
1562
- 'user_id' => $user_id
1563
- ) );
1564
 
1565
- else
1566
- mycred_display_users_badges( $user_id );
 
1567
 
1568
- }
 
 
1569
 
1570
- }
1571
 
1572
- /**
1573
- * Insert Badges in BuddyPress
1574
- * @since 1.0
1575
- * @version 1.1.1
1576
- */
1577
- public function insert_into_buddypress() {
1578
 
1579
- $user_id = bp_displayed_user_id();
1580
- if ( isset( $this->badges['show_all_bp'] ) && $this->badges['show_all_bp'] == 1 )
1581
- echo mycred_render_my_badges( array(
1582
- 'show' => 'all',
1583
- 'width' => MYCRED_BADGE_WIDTH,
1584
- 'height' => MYCRED_BADGE_HEIGHT,
1585
- 'user_id' => $user_id
1586
- ) );
1587
 
1588
- else
1589
- mycred_display_users_badges( $user_id );
 
1590
 
1591
- }
1592
 
1593
- }
1594
  endif;
1595
 
1596
  /**
@@ -1599,13 +2118,13 @@ endif;
1599
  * @version 1.0
1600
  */
1601
  if ( ! function_exists( 'mycred_load_badges_addon' ) ) :
1602
- function mycred_load_badges_addon( $modules, $point_types ) {
1603
 
1604
- $modules['solo']['badges'] = new myCRED_Badge_Module();
1605
- $modules['solo']['badges']->load();
1606
 
1607
- return $modules;
1608
 
1609
- }
1610
  endif;
1611
- add_filter( 'mycred_load_modules', 'mycred_load_badges_addon', 10, 2 );
7
  if ( ! defined( 'myCRED_VERSION' ) ) exit;
8
 
9
  define( 'myCRED_BADGE', __FILE__ );
10
+ define( 'myCRED_BADGE_VERSION', '1.3' );
11
  define( 'MYCRED_BADGE_DIR', myCRED_ADDONS_DIR . 'badges/' );
12
  define( 'MYCRED_BADGE_INCLUDES_DIR', MYCRED_BADGE_DIR . 'includes/' );
13
 
14
  // Badge Key
15
  if ( ! defined( 'MYCRED_BADGE_KEY' ) )
16
+ define( 'MYCRED_BADGE_KEY', 'mycred_badge' );
17
+
18
+ // Badge Category
19
+ if ( ! defined( 'MYCRED_BADGE_CATEGORY' ) )
20
+ define( 'MYCRED_BADGE_CATEGORY', 'mycred_badge_category' );
21
 
22
  // Default badge width
23
  if ( ! defined( 'MYCRED_BADGE_WIDTH' ) )
24
+ define( 'MYCRED_BADGE_WIDTH', 100 );
25
 
26
  // Default badge height
27
  if ( ! defined( 'MYCRED_BADGE_HEIGHT' ) )
28
+ define( 'MYCRED_BADGE_HEIGHT', 100 );
29
 
30
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-functions.php';
31
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-shortcodes.php';
32
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-object.php';
33
  require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-badge-secondary.php';
34
+ require_once MYCRED_BADGE_INCLUDES_DIR . 'mycred-open-badge.php';
35
 
36
  /**
37
  * myCRED_buyCRED_Module class
39
  * @version 1.2
40
  */
41
  if ( ! class_exists( 'myCRED_Badge_Module' ) ) :
42
+ class myCRED_Badge_Module extends myCRED_Module {
43
+
44
+ /**
45
+ * Construct
46
+ */
47
+ function __construct( $type = MYCRED_DEFAULT_TYPE_KEY ) {
48
+
49
+ parent::__construct( 'myCRED_Badge_Module', array(
50
+ 'module_name' => 'badges',
51
+ 'defaults' => array(
52
+ 'show_level_description' => 0,
53
+ 'show_congo_text' => 0,
54
+ 'show_steps_to_achieve' => 0,
55
+ 'show_levels' => 0,
56
+ 'show_level_points' => 0,
57
+ 'show_earners' => 0,
58
+ 'open_badge' => 0,
59
+ 'open_badge_evidence_page' => 0,
60
+ 'buddypress' => '',
61
+ 'bbpress' => '',
62
+ 'show_all_bp' => 0,
63
+ 'show_all_bb' => 0
64
+ ),
65
+ 'add_to_core' => true,
66
+ 'register' => false,
67
+ 'menu_pos' => 50
68
+ ), $type );
69
+
70
+ }
71
+
72
+ /**
73
+ * Module Pre Init
74
+ * @since 1.0
75
+ * @version 1.1
76
+ */
77
+ public function module_pre_init() {
78
+
79
+ add_filter( 'mycred_add_finished', array( $this, 'add_finished' ), 30, 3 );
80
+ add_action("wp_ajax_mycred_switch_all_to_open_badge", array( $this, "mycred_switch_all_to_open_badge" ) );
81
+ add_action("wp_ajax_nopriv_mycred_switch_all_to_open_badge", array( $this, "mycred_switch_all_to_open_badge" ) );
82
+ }
83
+
84
+ /**
85
+ * Switch all badges to Open Badges
86
+ * @since 2.1
87
+ * @version 1.0
88
+ */
89
+ public function mycred_switch_all_to_open_badge()
90
+ {
91
+
92
+ $args = array(
93
+ 'post_type' => 'mycred_badge'
94
+ );
95
+
96
+ $query = new WP_Query( $args );
97
+
98
+ $badges = $query->posts;
99
+
100
+ foreach ( $badges as $badge )
101
+ {
102
+ $badge_id = $badge->ID;
103
+
104
+ mycred_update_post_meta( $badge_id, 'open_badge', '1' );
105
+ }
106
+
107
+ echo 'Badges successfully switched to Open Badge.';
108
+
109
+ die;
110
+ }
111
+
112
+ /**
113
+ * Module Init
114
+ * @since 1.0
115
+ * @version 1.0.3
116
+ */
117
+ public function module_init() {
118
 
119
+ $this->register_badges();
120
+ $this->register_badge_category();
 
 
121
 
122
+ add_action( 'mycred_set_current_account', array( $this, 'populate_current_account' ) );
123
+ add_action( 'mycred_get_account', array( $this, 'populate_account' ) );
 
 
 
 
 
 
 
 
 
 
124
 
125
+ add_shortcode( MYCRED_SLUG . '_my_badges', 'mycred_render_my_badges' );
126
+ add_shortcode( MYCRED_SLUG . '_badges', 'mycred_render_badges' );
127
 
 
 
 
 
 
 
128
 
129
+ add_shortcode( MYCRED_SLUG . '_badges_list', 'mycred_render_badges_list' );
130
 
131
+ add_shortcode( MYCRED_SLUG . '_badge_evidence', 'mycred_render_badge_evidence' );
132
 
133
+ // Insert into bbPress
134
+ if ( class_exists( 'bbPress' ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
+ if ( $this->badges['bbpress'] == 'profile' || $this->badges['bbpress'] == 'both' )
137
+ add_action( 'bbp_template_after_user_profile', array( $this, 'insert_into_bbpress_profile' ) );
 
 
 
 
138
 
139
+ if ( $this->badges['bbpress'] == 'reply' || $this->badges['bbpress'] == 'both' )
140
+ add_action( 'bbp_theme_after_reply_author_details', array( $this, 'insert_into_bbpress_reply' ) );
141
+
142
+ }
143
+
144
+ //Load open badge if enabled
145
+ if ( $this->badges['open_badge'] ) {
146
+
147
+ $this->mycred_open_badge_init();
148
+
149
+ }
150
+
151
+ // Insert into BuddyPress
152
+ if ( class_exists( 'BuddyPress' ) ) {
153
+
154
+ // Insert into header
155
+ if ( $this->badges['buddypress'] == 'header' || $this->badges['buddypress'] == 'both' )
156
+ add_action( 'bp_before_member_header_meta', array( $this, 'insert_into_buddypress' ) );
157
+
158
+ // Insert into profile
159
+ if ( $this->badges['buddypress'] == 'profile' || $this->badges['buddypress'] == 'both' )
160
+ add_action( 'bp_after_profile_loop_content', array( $this, 'insert_into_buddypress' ) );
161
+
162
+ }
163
+
164
+ add_action( 'mycred_add_menu', array( $this, 'add_to_menu' ), $this->menu_pos );
165
+ add_filter( 'the_content', array( $this, 'mycred_badge_page_template' ), 10, 1 );
166
+
167
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_front_scripts' ) );
168
+
169
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
170
+
171
+ }
172
+
173
+ /**
174
+ * Enqueue Front End Script
175
+ * @since 1.3
176
+ * @version 1.0
177
+ */
178
+ public function enqueue_front_scripts()
179
+ {
180
+ wp_enqueue_script( 'mycred-badge-front', plugins_url( 'assets/js/front.js', myCRED_BADGE ), '', myCRED_BADGE_VERSION );
181
+ }
182
+
183
+ /**
184
+ * Enqueue Admin Script
185
+ * @since 1.3
186
+ * @version 1.0
187
+ */
188
+ public function enqueue_admin_scripts()
189
+ {
190
+ wp_enqueue_script( 'mycred-badge-admin', plugins_url( 'assets/js/admin.js', myCRED_BADGE ), '', myCRED_BADGE_VERSION );
191
+ }
192
+
193
+ /**
194
+ * Module Admin Init
195
+ * @since 1.0
196
+ * @version 1.1
197
+ */
198
+ public function module_admin_init() {
199
+
200
+ add_filter( 'parent_file', array( $this, 'parent_file' ) );
201
+ add_filter( 'submenu_file', array( $this, 'subparent_file' ), 10, 2 );
202
+ add_action( 'mycred_admin_enqueue', array( $this, 'enqueue_scripts' ), $this->menu_pos );
203
+
204
+ add_filter( 'post_row_actions', array( $this, 'adjust_row_actions' ), 10, 2 );
205
+
206
+ add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
207
+ add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) );
208
+ add_action( 'post_submitbox_start', array( $this, 'publishing_actions' ) );
209
+
210
+ add_action( 'wp_ajax_mycred-assign-badge', array( $this, 'action_assign_badge' ) );
211
+ add_action( 'wp_ajax_mycred-remove-connections', array( $this, 'action_remove_connections' ) );
212
+
213
+ add_action( 'mycred_user_edit_after_balances', array( $this, 'badge_user_screen' ), 10 );
214
+
215
+ add_action( 'personal_options_update', array( $this, 'save_manual_badges' ), 10 );
216
+ add_action( 'edit_user_profile_update', array( $this, 'save_manual_badges' ), 10 );
217
+
218
+ add_action( 'mycred_delete_point_type', array( $this, 'delete_point_type' ) );
219
+ add_action( 'before_delete_post', array( $this, 'delete_badge' ) );
220
+
221
+ add_filter( 'manage_' . MYCRED_BADGE_KEY . '_posts_columns', array( $this, 'adjust_column_headers' ) );
222
+ add_action( 'manage_' . MYCRED_BADGE_KEY . '_posts_custom_column', array( $this, 'adjust_column_content' ), 10, 2 );
223
+ add_action( 'save_post_' . MYCRED_BADGE_KEY, array( $this, 'save_badge' ), 10, 2 );
224
+
225
+ $this->flush_rewrite_rules_for_badges();
226
+
227
+ }
228
+
229
+ /**
230
+ * Register Badge Post Type
231
+ * @since 1.0
232
+ * @version 1.0
233
+ */
234
+ public function register_badges() {
235
+
236
+ $labels = array(
237
+ 'name' => __( 'Badges', 'mycred' ),
238
+ 'singular_name' => __( 'Badge', 'mycred' ),
239
+ 'add_new' => __( 'Add New', 'mycred' ),
240
+ 'add_new_item' => __( 'Add New', 'mycred' ),
241
+ 'edit_item' => __( 'Edit Badge', 'mycred' ),
242
+ 'new_item' => __( 'New Badge', 'mycred' ),
243
+ 'all_items' => __( 'Badges', 'mycred' ),
244
+ 'view_item' => __( 'View Badge', 'mycred' ),
245
+ 'search_items' => __( 'Search Badge', 'mycred' ),
246
+ 'not_found' => __( 'No badges found', 'mycred' ),
247
+ 'not_found_in_trash' => __( 'No badges found in Trash', 'mycred' ),
248
+ 'parent_item_colon' => '',
249
+ 'menu_name' => __( 'Badges', 'mycred' )
250
+ );
251
+
252
+ $args = array(
253
+ 'labels' => $labels,
254
+ 'supports' => array( 'title', 'editor', 'excerpt' ),
255
+ 'hierarchical' => false,
256
+ 'public' => false,
257
+ 'show_ui' => true,
258
+ 'show_in_menu' => false,
259
+ 'show_in_nav_menus' => false,
260
+ 'show_in_admin_bar' => false,
261
+ 'can_export' => true,
262
+ 'has_archive' => false,
263
+ 'exclude_from_search' => true,
264
+ 'publicly_queryable' => false,
265
+ 'register_meta_box_cb' => array( $this, 'add_metaboxes' ),
266
+ 'capability_type' => 'post',
267
+ 'publicly_queryable' => true,
268
+ 'taxonomies' => array( MYCRED_BADGE_CATEGORY )
269
+ );
270
+
271
+ register_post_type( MYCRED_BADGE_KEY, apply_filters( 'mycred_register_badge', $args ) );
272
+
273
+ }
274
+
275
+ /**
276
+ * Register Badges Taxonomy
277
+ * @since 2.1
278
+ * @version 1.0
279
+ */
280
+ public function register_badge_category() {
281
+
282
+ $labels = [
283
+ 'name' => __( 'Achievement Type', 'mycred' ),
284
+ 'menu_name' => __( 'Achievement Type', 'mycred' ),
285
+ 'all_items' => __( 'All Achievements', 'mycred' ),
286
+ 'add_new_item' => __( 'Add New Achievement', 'mycred' ),
287
+ 'parent_item' => __( 'Parent Achievement', 'mycred' ),
288
+ ];
289
+
290
+ $object_type = [
291
+ MYCRED_BADGE_KEY
292
+ ];
293
+
294
+ $args = [
295
+ 'labels' => $labels,
296
+ 'show_ui' => true,
297
+ 'show_in_menu' => true,
298
+ 'show_admin_column' => false,
299
+ 'query_var' => true,
300
+ 'rewrite' => array(
301
+ 'slug' => MYCRED_BADGE_KEY
302
+ ),
303
+ 'hierarchical' => true,
304
+ ];
305
+
306
+ register_taxonomy(
307
+ MYCRED_BADGE_CATEGORY,
308
+ MYCRED_BADGE_KEY,
309
+ $args
310
+ );
311
+
312
+ }
313
+
314
+ /**
315
+ * Populate Current Account
316
+ * @since 1.8
317
+ * @version 1.0
318
+ */
319
+ public function populate_current_account() {
320
+
321
+ global $mycred_current_account;
322
+
323
+ if ( isset( $mycred_current_account )
324
+ && ( $mycred_current_account instanceof myCRED_Account )
325
+ && ( isset( $mycred_current_account->badges ) )
326
+ ) return;
327
+
328
+ $earned = array();
329
+ $users_badges = mycred_get_users_badges( $mycred_current_account->user_id, true );
330
+
331
+ if ( ! empty( $users_badges ) ) {
332
+ foreach ( $users_badges as $badge_id => $level ) {
333
+
334
+ if ( ! is_numeric( $level ) )
335
+ $level = 0;
336
+
337
+ $badge_id = absint( $badge_id );
338
+ $level = absint( $level );
339
+ $badge = mycred_get_badge( $badge_id, $level );
340
+
341
+ $earned[ $badge_id ] = $badge;
342
+
343
+ }
344
+ }
345
+
346
+ $mycred_current_account->badges = $earned;
347
+ $mycred_current_account->badge_ids = $users_badges;
348
+
349
+ }
350
+
351
+ /**
352
+ * Populate Account
353
+ * @since 1.8
354
+ * @version 1.0
355
+ */
356
+ public function populate_account() {
357
+
358
+ global $mycred_account;
359
+
360
+ if ( isset( $mycred_account )
361
+ && ( $mycred_account instanceof myCRED_Account )
362
+ && ( isset( $mycred_account->badges ) )
363
+ ) return;
364
+
365
+ $earned = array();
366
+ $users_badges = mycred_get_users_badges( $mycred_account->user_id );
367
+
368
+ if ( ! empty( $users_badges ) ) {
369
+ foreach ( $users_badges as $badge_id => $level ) {
370
 
371
+ if ( ! is_numeric( $level ) )
372
+ $level = 0;
373
+
374
+ $badge_id = absint( $badge_id );
375
+ $level = absint( $level );
376
+ $badge = mycred_get_badge( $badge_id, $level );
377
+
378
+ $earned[ $badge_id ] = $badge;
379
+
380
+ }
381
+ }
382
+
383
+ $mycred_account->badges = $earned;
384
+ $mycred_account->badge_ids = $users_badges;
385
+
386
+ }
387
+
388
+ /**
389
+ * Delete Point Type
390
+ * When a point type is deleted, we want to remove any data saved for this point type.
391
+ * @since 1.7
392
+ * @version 1.0
393
+ */
394
+ public function delete_point_type( $point_type = NULL ) {
395
+
396
+ if ( ! mycred_point_type_exists( $point_type ) || $point_type == MYCRED_DEFAULT_TYPE_KEY ) return;
397
 
398
+ $mycred = mycred( $point_type );
399
 
400
+ if ( ! $mycred->user_is_point_editor() ) return;
401
 
402
+ mycred_delete_option( 'mycred-badge-refs-' . $point_type );
 
 
 
 
 
403
 
404
+ }
405
 
406
+ /**
407
+ * Delete Badge
408
+ * When a badge is deleted, we want to delete connections as well.
409
+ * @since 1.7
410
+ * @version 1.0
411
+ */
412
+ public function delete_badge( $post_id ) {
413
 
414
+ if ( get_post_status( $post_id ) != MYCRED_BADGE_KEY ) return $post_id;
 
415
 
416
+ // Delete reference list to force a new query
417
+ foreach ( $this->point_types as $type_id => $label )
418
+ mycred_delete_option( 'mycred-badge-refs-' . $type_id );
419
 
420
+ global $wpdb;
 
421
 
422
+ // Delete connections to keep usermeta table clean
423
+ $wpdb->delete(
424
+ $wpdb->usermeta,
425
+ array( 'meta_key' => MYCRED_BADGE_KEY . $post_id ),
426
+ array( '%s' )
427
+ );
428
 
429
+ }
430
 
431
+ /**
432
+ * Adjust Post Updated Messages
433
+ * @since 1.0
434
+ * @version 1.0
435
+ */
436
+ public function post_updated_messages( $messages ) {
437
 
438
+ global $post;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
 
440
+ $messages[ MYCRED_BADGE_KEY ] = array(
441
+ 0 => '',
442
+ 1 => __( 'Badge Updated.', 'mycred' ),
443
+ 2 => __( 'Badge Updated.', 'mycred' ),
444
+ 3 => __( 'Badge Updated.', 'mycred' ),
445
+ 4 => __( 'Badge Updated.', 'mycred' ),
446
+ 5 => false,
447
+ 6 => __( 'Badge Enabled.', 'mycred' ),
448
+ 7 => __( 'Badge Saved.', 'mycred' ),
449
+ 8 => __( 'Badge Updated.', 'mycred' ),
450
+ 9 => __( 'Badge Updated.', 'mycred' ),
451
+ 10 => __( 'Badge Updated.', 'mycred' )
452
+ );
453
 
454
+ return $messages;
455
 
456
+ }
457
 
458
+ /**
459
+ * Add Admin Menu Item
460
+ * @since 1.7
461
+ * @version 1.1
462
+ */
463
+ public function add_to_menu() {
464
 
465
+ // In case we are using the Master Template feautre on multisites, and this is not the main
466
+ // site in the network, bail.
467
+ if ( mycred_override_settings() && ! mycred_is_main_site() ) return;
468
 
469
+ add_submenu_page(
470
+ MYCRED_SLUG,
471
+ __( 'Badges', 'mycred' ),
472
+ __( 'Badges', 'mycred' ),
473
+ $this->core->get_point_editor_capability(),
474
+ 'edit.php?post_type=' . MYCRED_BADGE_KEY
475
+ );
476
 
477
+ add_submenu_page(
478
+ MYCRED_SLUG,
479
+ __( 'Achievements', 'mycred' ),
480
+ __( 'Achievements', 'mycred' ),
481
+ $this->core->get_point_editor_capability(),
482
+ 'edit-tags.php?post_type=' . MYCRED_BADGE_KEY . '&taxonomy=' . MYCRED_BADGE_CATEGORY
483
+ );
484
 
485
+ }
 
 
486
 
487
+ /**
488
+ * Parent File
489
+ * @since 1.6
490
+ * @version 1.0.2
491
+ */
492
+ public function parent_file( $parent = '' ) {
493
 
494
+ global $pagenow, $submenu_file;
 
 
 
 
 
495
 
496
+ if ( ( $pagenow == 'edit.php' || $pagenow == 'post-new.php' ) && isset( $_GET['post_type'] ) && $_GET['post_type'] == MYCRED_BADGE_KEY ) {
497
 
498
+ return MYCRED_SLUG;
 
 
 
 
 
499
 
500
+ }
501
 
502
+ elseif ( $pagenow == 'post.php' && isset( $_GET['post'] ) && mycred_get_post_type( $_GET['post'] ) == MYCRED_BADGE_KEY ) {
 
 
 
 
 
 
 
 
 
 
 
 
503
 
504
+ return MYCRED_SLUG;
505
 
506
+ }
507
 
508
+ elseif ( ( $pagenow == 'edit-tags.php' ) && isset( $_GET['post_type'] ) && isset( $_GET['taxonomy'] ) && $_GET['post_type'] == MYCRED_BADGE_KEY && $_GET['taxonomy'] == MYCRED_BADGE_CATEGORY )
509
+ {
510
+ $submenu_file = 'edit-tags.php?post_type=' . MYCRED_BADGE_KEY . '&taxonomy=' . MYCRED_BADGE_CATEGORY;
 
 
 
511
 
512
+ return MYCRED_SLUG;
513
+ }
 
514
 
515
+ return $parent;
 
 
 
 
 
 
516
 
517
+ }
518
 
519
+ /**
520
+ * Sub Parent File
521
+ * @since 1.7
522
+ * @version 1.0
523
+ */
524
+ public function subparent_file( $subparent = '', $parent = '' ) {
525
 
526
+ global $pagenow;
527
 
528
+ if ( ( $pagenow == 'edit.php' || $pagenow == 'post-new.php' ) && isset( $_GET['post_type'] ) && $_GET['post_type'] == MYCRED_BADGE_KEY ) {
 
 
 
 
529
 
530
+ return 'edit.php?post_type=' . MYCRED_BADGE_KEY;
531
 
532
+ }
533
 
534
+ elseif ( $pagenow == 'post.php' && isset( $_GET['post'] ) && mycred_get_post_type( $_GET['post'] ) == MYCRED_BADGE_KEY ) {
535
 
536
+ return 'edit.php?post_type=' . MYCRED_BADGE_KEY;
537
 
538
+ }
539
 
540
+ return $subparent;
 
 
 
 
 
541
 
542
+ }
543
 
544
+ /**
545
+ * Add Finished
546
+ * @since 1.0
547
+ * @version 1.4
548
+ */
549
+ public function add_finished( $result, $request, $mycred ) {
550
 
551
+ if ( is_bool( $request ) ) return $result;
 
 
552
 
553
+ extract( $request );
554
 
555
+ if ( $result !== false && $ref != 'badge_reward' ) {
556
 
557
+ // Check if this reference has badges
558
+ $badge_ids = mycred_ref_has_badge( $ref, $type );
559
+ if ( $badge_ids !== false ) {
560
 
561
+ // Check if user gets any of the badges
562
+ foreach ( $badge_ids as $badge_id ) {
563
 
564
+ $badge = mycred_get_badge( $badge_id );
565
+ if ( $badge === false ) continue;
566
 
567
+ // Check what level we reached (if we reached any)
568
+ $level_reached = $badge->query_users_level( $user_id );
569
+ if ( $level_reached !== false )
570
+ $badge->assign( $user_id, $level_reached );
 
 
 
 
571
 
572
+ }
573
 
574
+ }
575
 
576
+ }
 
 
577
 
578
+ return $result;
 
579
 
580
+ }
 
581
 
582
+ /**
583
+ * Adjust Badge Column Header
584
+ * @since 1.0
585
+ * @version 1.0
586
+ */
587
+ public function adjust_column_headers( $defaults ) {
588
 
589
+ $columns = array();
590
+ $columns['cb'] = $defaults['cb'];
591
 
592
+ // Add / Adjust
593
+ $columns['title'] = __( 'Badge Name', 'mycred' );
594
+ $columns['badge-default-image'] = __( 'Default Image', 'mycred' );
595
+ $columns['badge-earned-image'] = __( 'First Level', 'mycred' );
596
+ $columns['badge-reqs'] = __( 'Requirements', 'mycred' );
597
+ $columns['badge-users'] = __( 'Users', 'mycred' );
598
+ $columns['badge-users'] = __( 'Users', 'mycred' );
599
+ $columns['badge-type'] = __( 'Achievements Type', 'mycred' );
600
 
601
+ if ( $this->badges['open_badge'] )
602
+ $columns['badge-open-badge'] = __( 'Open Badge', 'mycred' );
603
 
604
+ // Return
605
+ return $columns;
606
 
607
+ }
608
 
609
+ /**
610
+ * Adjust Badge Column Content
611
+ * @since 1.0
612
+ * @version 1.2
613
+ */
614
+ public function adjust_column_content( $column_name, $badge_id ) {
615
 
616
+ // Default Images
617
+ if ( $column_name == 'badge-default-image' ) {
618
 
619
+ $badge = mycred_get_badge( $badge_id );
620
+ if ( $badge === false || $badge->main_image === false )
621
+ echo '-';
 
 
 
622
 
623
+ elseif ( $badge->main_image !== false )
624
+ echo $badge->main_image;
625
 
626
+ }
627
 
628
+ // First Level Image
629
+ if ( $column_name == 'badge-earned-image' ) {
 
 
 
 
630
 
631
+ $badge = mycred_get_badge( $badge_id );
632
+ $image = $badge->get_image( 0 );
633
+ if ( $badge->open_badge || $image === false )
634
+ echo '-';
635
+ else
636
+ echo $image;
637
 
638
+ }
 
 
639
 
640
+ // Badge Requirements
641
+ elseif ( $column_name == 'badge-reqs' ) {
642
 
643
+ echo mycred_display_badge_requirements( $badge_id );
644
 
645
+ }
 
646
 
647
+ // Badge Users
648
+ elseif ( $column_name == 'badge-users' ) {
 
 
 
 
649
 
650
+ $badge = mycred_get_badge( $badge_id );
651
+ if ( $badge === false )
652
+ echo 0;
653
 
654
+ else
655
+ echo $badge->earnedby;
656
 
657
+ }
658
 
659
+ //Badge Type
660
+ elseif ( $column_name == 'badge-type' ) {
661
 
662
+ $badge = mycred_get_badge_type( $badge_id );
 
663
 
664
+ echo $badge == false ? 'No Acheivement Type' : $badge;
 
 
665
 
666
+ }
 
667
 
668
+ //Open Badge
669
+ elseif ( $column_name == 'badge-open-badge' ) {
670
 
671
+ $badge = mycred_get_badge( $badge_id );
672
 
673
+ echo $badge->open_badge ? 'Yes' : 'No';
 
 
 
 
 
674
 
675
+ }
 
 
 
676
 
677
+ }
678
 
679
+ /**
680
+ * Adjust Row Actions
681
+ * @since 1.0
682
+ * @version 1.0
683
+ */
684
+ public function adjust_row_actions( $actions, $post ) {
685
 
686
+ if ( $post->post_type == MYCRED_BADGE_KEY ) {
687
+ unset( $actions['inline hide-if-no-js'] );
688
+ }
 
 
 
689
 
690
+ return $actions;
691
 
692
+ }
 
693
 
694
+ /**
695
+ * Adjust Enter Title Here
696
+ * @since 1.0
697
+ * @version 1.0
698
+ */
699
+ public function enter_title_here( $title ) {
700
 
701
+ global $post_type;
702
 
703
+ if ( $post_type == MYCRED_BADGE_KEY )
704
+ return __( 'Badge Name', 'mycred' );
 
 
 
 
705
 
706
+ return $title;
 
707
 
708
+ }
709
 
710
+ /**
711
+ * Enqueue Scripts
712
+ * @since 1.0
713
+ * @version 1.0.1
714
+ */
715
+ public function enqueue_scripts() {
716
 
717
+ $screen = get_current_screen();
718
+ if ( $screen->id == MYCRED_BADGE_KEY ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
 
720
+ wp_enqueue_media();
721
 
722
+ wp_register_script(
723
+ 'mycred-edit-badge',
724
+ plugins_url( 'assets/js/edit-badge.js', myCRED_BADGE ),
725
+ array( 'jquery', 'mycred-mustache' ),
726
+ myCRED_BADGE_VERSION . '.1'
727
+ );
728
 
729
+ wp_localize_script(
730
+ 'mycred-edit-badge',
731
+ 'myCREDBadge',
732
+ array(
733
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
734
+ 'addlevel' => esc_js( __( 'Add Level', 'mycred' ) ),
735
+ 'removelevel' => esc_js( __( 'Remove Level', 'mycred' ) ),
736
+ 'setimage' => esc_js( __( 'Set Image', 'mycred' ) ),
737
+ 'changeimage' => esc_js( __( 'Change Image', 'mycred' ) ),
738
+ 'remove' => esc_js( esc_attr__( 'Are you sure you want to remove this level?', 'mycred' ) ),
739
+ 'levellabel' => esc_js( sprintf( '%s {{level}}', __( 'Level', 'mycred' ) ) ),
740
+ 'uploadtitle' => esc_js( esc_attr__( 'Badge Image', 'mycred' ) ),
741
+ 'uploadbutton' => esc_js( esc_attr__( 'Use as Badge', 'mycred' ) ),
742
+ 'compareAND' => esc_js( _x( 'AND', 'Comparison of badge requirements. A AND B', 'mycred' ) ),
743
+ 'compareOR' => esc_js( _x( 'OR', 'Comparison of badge requirements. A OR B', 'mycred' ) )
744
+ )
745
+ );
746
 
747
+ wp_enqueue_script( 'mycred-edit-badge' );
748
+
749
+ wp_enqueue_style( 'mycred-bootstrap-grid' );
750
+ wp_enqueue_style( 'mycred-forms' );
751
+
752
+ add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-setup', array( $this, 'metabox_classes' ) );
753
+ add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-default', array( $this, 'metabox_classes' ) );
754
+ add_filter( 'postbox_classes_' . MYCRED_BADGE_KEY . '_mycred-badge-rewards', array( $this, 'metabox_classes' ) );
755
+
756
+ echo '<style type="text/css">
757
  #misc-publishing-actions #visibility, #misc-publishing-actions .misc-pub-post-status { display: none; }
758
  #save-action #save-post { margin-bottom: 12px; }
759
  </style>';
760
 
761
+ }
762
 
763
+ elseif ( $screen->id == 'edit-' . MYCRED_BADGE_KEY ) {
764
 
765
+ echo '<style type="text/css">
766
  th#badge-default-image { width: 120px; }
767
  th#badge-earned-image { width: 120px; }
768
  th#badge-reqs { width: 35%; }
773
  .mycred-badge-requirement-list li span { float: right; }
774
  .column-badge-reqs strong { display: block; }
775
  .column-badge-reqs span { color: #aeaeae; }
776
+ .mycred-badge-requirement-list.open_badge { border: 0px; }
777
  </style>';
778
 
779
+ }
780
 
781
+ }
782
 
783
+ /**
784
+ * Add Meta Boxes
785
+ * @since 1.0
786
+ * @version 1.0
787
+ */
788
+ public function add_metaboxes() {
789
 
790
+ add_meta_box(
791
+ 'mycred-badge-setup',
792
+ __( 'Badge Setup', 'mycred' ),
793
+ array( $this, 'metabox_badge_setup' ),
794
+ MYCRED_BADGE_KEY,
795
+ 'normal',
796
+ 'low'
797
+ );
798
 
799
+ add_meta_box(
800
+ 'mycred-badge-default',
801
+ __( 'Default Badge Image', 'mycred' ),
802
+ array( $this, 'metabox_badge_default' ),
803
+ MYCRED_BADGE_KEY,
804
+ 'side',
805
+ 'low'
806
+ );
807
 
808
+ if ( $this->badges['open_badge'] )
809
+ add_meta_box(
810
+ 'mycred-badge-open-badge',
811
+ __( 'Open Badge', 'mycred' ),
812
+ array( $this, 'metabox_open_badge' ),
813
+ MYCRED_BADGE_KEY,
814
+ 'side',
815
+ 'high'
816
+ );
817
 
818
+ add_meta_box(
819
+ 'mycred-badge-congratulation-msg',
820
+ __( 'Congratulation Message', 'mycred' ),
821
+ array( $this, 'metabox_congratulation_msg' ),
822
+ MYCRED_BADGE_KEY,
823
+ 'normal',
824
+ 'low'
825
+ );
826
 
827
+ }
 
828
 
829
+ /**
830
+ * Level Template
831
+ * @since 1.7
832
+ * @version 1.0
833
+ */
834
+ public function level_template( $level = 0 ) {
835
 
836
+ $template = '<div class="row badge-level" id="mycred-badge-level{{level}}" data-level="{{level}}"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center">{{removelevelbutton}}<div class="level-image"><div class="level-image-wrapper image-wrapper {{emptylevelimage}}">{{levelimage}}</div><div class="level-image-actions"><button type="button" class="button button-secondary change-level-image" data-level="{{level}}">{{levelimagebutton}}</button></div></div><div class="label-field"><input type="text" placeholder="{{levelplaceholder}}" name="mycred_badge[levels][{{level}}][label]" value="{{levellabel}}" /></div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="req-title">{{requirementslabel}}</div><div class="level-requirements">{{{requirements}}}</div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">{{rewards}}</div></div>';
837
 
838
+ if ( $level == 0 ) {
 
 
 
 
 
839
 
840
+ $template = '<div class="row badge-level" id="mycred-badge-level{{level}}" data-level="{{level}}"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center">{{addlevelbutton}}<div class="level-image"><div class="level-image-wrapper image-wrapper {{emptylevelimage}}">{{levelimage}}</div><div class="level-image-actions"><button type="button" class="button button-secondary change-level-image" data-level="{{level}}">{{levelimagebutton}}</button></div></div><div class="label-field"><input type="text" placeholder="{{levelplaceholder}}" name="mycred_badge[levels][{{level}}][label]" value="{{levellabel}}" /></div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="req-title">{{requirementslabel}}<div class="pull-right" id="badge-requirement-compare"><a href="javascript:void(0);" data-do="AND" class="{{adnselected}}">AND</a> / <a href="javascript:void(0);" data-do="OR" class="{{orselected}}">OR</a><input type="hidden" name="mycred_badge[levels][{{level}}][compare]" value="{{badge_compare_andor}}" /></div></div><div class="level-requirements">{{{requirements}}}</div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">{{rewards}}</div></div>';
841
 
842
+ }
843
+ elseif ( $level < 0 ) {
844
 
845
+ $template = '<div class="row badge-level" id="mycred-badge-level{{level}}" data-level="{{level}}"><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><div class="req-title">{{requirementslabel}}<div class="pull-right" id="badge-requirement-compare"><a href="javascript:void(0);" data-do="AND" class="{{adnselected}}">AND</a> / <a href="javascript:void(0);" data-do="OR" class="{{orselected}}">OR</a><input type="hidden" name="mycred_badge[levels][{{level}}][compare]" value="{{badge_compare_andor}}" /></div></div><div class="level-requirements">{{{requirements}}}</div></div><div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">{{rewards}}</div></div>';
 
 
846
 
847
+ }
 
848
 
849
+ return $template;
 
850
 
851
+ }
852
 
853
+ /**
854
+ * Get Level Image
855
+ * @since 1.7
856
+ * @version 1.0
857
+ */
858
+ public function get_level_image( $setup, $level = 0 ) {
859
 
860
+ $image = false;
861
 
862
+ if ( $setup['attachment_id'] > 0 ) {
 
 
 
 
 
863
 
864
+ $_image = wp_get_attachment_url( $setup['attachment_id'] );
865
+ if ( strlen( $_image ) > 5 )
866
+ $image = '<img src="' . $_image . '" alt="Badge level image" /><input type="hidden" name="mycred_badge[levels][' . $level . '][attachment_id]" value="' . $setup['attachment_id'] . '" /><input type="hidden" name="mycred_badge[levels][' . $level . '][image_url]" value="" />';
867
 
868
+ }
869
+ else {
870
 
871
+ if ( strlen( $setup['image_url'] ) > 5 )
872
+ $image = '<img src="' . $setup['image_url'] . '" alt="Badge level image" /><input type="hidden" name="mycred_badge[levels][' . $level . '][attachment_id]" value="0" /><input type="hidden" name="mycred_badge[levels][' . $level . '][image_url]" value="' . $setup['image_url'] . '" />';
873
 
874
+ }
 
 
 
 
 
875
 
876
+ return $image;
877
+
878
+ }
879
+
880
+ /**
881
+ * Requirements Template
882
+ * @since 1.7
883
+ * @version 1.0
884
+ */
885
+ public function requirements_template( $level = 0 ) {
886
+
887
+ // only first level dictates requirements
888
+ if ( $level == 0 )
889
+ return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}" data-row="{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][type]" data-row="{{reqlevel}}" class="form-control point-type">{{pointtypes}}</select></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][reference]" data-row="{{reqlevel}}" class="form-control reference">{{references}}</select></div>{{{customrequirement}}}</div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group"><select name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][by]" data-row="{{reqlevel}}" class="form-control req-type">{{requirementtype}}</select></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 form">{{reqbutton}}</div></div>';
890
+
891
+ // All other requirements reflect the level 0's setup
892
+ return '<div class="row row-narrow" id="level{{level}}requirement{{reqlevel}}"><div class="col-lg-3 col-md-3 col-sm-6 col-xs-12 form"><div class="form-group level-type"><p class="form-control-static level-requirement{{reqlevel}}-type">{{selectedtype}}</p></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-xs-12 form"><div class="form-group level-ref"><p class="form-control-static level-requirement{{reqlevel}}-ref">{{selectedref}}</p><p>{{refspecific}}</p></div></div><div class="col-lg-3 col-md-3 col-sm-6 col-xs-10 form-inline"><div class="form-group level-val"><input type="text" size="5" name="mycred_badge[levels][{{level}}][requires][{{reqlevel}}][amount]" class="form-control" value="{{reqamount}}" /></div><div class="form-group level-type-by"><p class="form-control-static level-requirement{{reqlevel}}-by">{{selectedby}}</p></div></div><div class="col-lg-1 col-md-1 col-sm-6 col-xs-2 level-compare form"><p class="form-control-static" data-row="{{reqlevel}}">{{comparelabel}}</p></div></div>';
893
+
894
+ }
895
+
896
+ /**
897
+ * Rewards Template
898
+ * @since 1.7
899
+ * @version 1.0
900
+ */
901
+ public function rewards_template() {
902
+
903
+ return '<div class="req-title">{{rewardlabel}}</div><div class="row form"><div class="col-lg-4 col-md-4 col-sm-12 col-xs-12"><select name="mycred_badge[levels][{{level}}][reward][type]" class="form-control">{{pointtypes}}</select></div><div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"><input type="text" class="form-control" name="mycred_badge[levels][{{level}}][reward][log]" placeholder="{{logplaceholder}}" value="{{logtemplate}}" /></div><div class="col-lg-2 col-md-2 col-sm-12 col-xs-12"><input type="text" class="form-control" name="mycred_badge[levels][{{level}}][reward][amount]" placeholder="0" value="{{rewardamount}}" /></div></div>';
904
+
905
+ }
906
+
907
+ /**
908
+ * Badge Publishing Actions
909
+ * @since 1.7
910
+ * @version 1.1
911
+ */
912
+ public function publishing_actions() {
913
+
914
+ global $post;
915
+
916
+ if ( ! isset( $post->post_type ) || $post->post_type != MYCRED_BADGE_KEY ) return;
917
+
918
+ $manual_badge = ( (int) mycred_get_post_meta( $post->ID, 'manual_badge', true ) == 1 ) ? true : false;
919
+
920
+ ?>
921
+ <div id="mycred-badge-actions" class="seperate-bottom">
922
+
923
+ <?php do_action( 'mycred_edit_badge_before_actions', $post ); ?>
924
+
925
+ <input type="hidden" name="mycred-badge-edit" value="<?php echo wp_create_nonce( 'edit-mycred-badge' ); ?>" />
926
+ <input type="button" id="mycred-assign-badge-connections"<?php if ( $manual_badge || $post->post_status != 'publish' ) echo ' disabled="disabled"'; ?> value="<?php _e( 'Assign Badge', 'mycred' ); ?>" class="button button-secondary mycred-badge-action-button" data-action="mycred-assign-badge" data-token="<?php echo wp_create_nonce( 'mycred-assign-badge' ); ?>" />
927
+ <input type="button" id="mycred-remove-badge-connections"<?php if ( $post->post_status != 'publish' ) echo ' disabled="disabled"'; ?> value="<?php _e( 'Remove Connections', 'mycred' ); ?>" class="button button-secondary mycred-badge-action-button" data-action="mycred-remove-connections" data-token="<?php echo wp_create_nonce( 'mycred-remove-badge-connection' ); ?>" />
928
 
929
+ <?php do_action( 'mycred_edit_badge_after_actions', $post ); ?>
930
+
931
+ <script type="text/javascript">
932
+ jQuery(function($) {
933
+
934
+ $( 'input.mycred-badge-action-button' ).click(function(){
935
+ var button = $(this);
936
+ var label = button.val();
937
 
938
+ $.ajax({
939
+ type : "POST",
940
+ data : {
941
+ action : button.attr( 'data-action' ),
942
+ token : button.attr( 'data-token' ),
943
+ badge_id : <?php echo $post->ID; ?>
944
+ },
945
+ dataType : "JSON",
946
+ url : ajaxurl,
947
+ beforeSend : function() {
948
+ button.attr( 'value', '<?php echo esc_js( esc_attr__( 'Processing...', 'mycred' ) ); ?>' );
949
+ button.attr( 'disabled', 'disabled' );
950
+ },
951
+ success : function( response ) {
952
+ alert( response.data );
953
+ button.removeAttr( 'disabled' );
954
+ button.val( label );
955
+ }
956
+ });
957
+ return false;
958
+
959
+ });
960
+
961
+ });
962
+ </script>
963
+
964
+ </div>
965
+ <div id="mycred-manual-badge" class="seperate-bottom">
966
+ <label for="mycred-badge-is-manual"><input type="checkbox" name="mycred_badge[manual]" id="mycred-badge-is-manual"<?php if ( $manual_badge ) echo ' checked="checked"'; ?> value="1" /> <?php _e( 'This badge is manually awarded.', 'mycred' ); ?></label>
967
+ </div>
968
+ <?php
969
+
970
+ }
971
+
972
+ /**
973
+ * Default Image Metabox
974
+ * @since 1.7
975
+ * @version 1.0
976
+ */
977
+ public function metabox_badge_default( $post ) {
978
+
979
+ $default_image = $di = mycred_get_post_meta( $post->ID, 'main_image', true );
980
+ if ( $default_image != '' )
981
+ $default_image = '<img src="' . $default_image . '" alt="" />';
982
+
983
+ $attachment = false;
984
+ if ( is_numeric( $di ) && strpos( '://', $di ) === false ) {
985
+ $attachment = $di;
986
+ $default_image = '<img src="' . wp_get_attachment_url( $di ) . '" alt="" />';
987
+ }
988
+
989
+ ?>
990
+ <div class="row">
991
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
992
+ <div class="default-image text-center seperate-bottom">
993
+ <div class="default-image-wrapper image-wrapper<?php if ( $default_image == '' ) echo ' empty dashicons'; ?>">
994
+ <?php echo $default_image; ?>
995
+ <input type="hidden" name="mycred_badge[main_image]" id="badge-main-image-id" value="<?php if ( $attachment ) echo esc_attr( $di ); ?>" />
996
+ <input type="hidden" name="mycred_badge[main_image_url]" id="badge-main-image-url" value="<?php if ( $di != '' && strpos( '://', $di ) !== false ) echo esc_attr( $default_image ); ?>" />
997
+ </div>
998
+ <div class="level-image-actions">
999
+ <button type="button" class="button button-secondary" id="badges-change-default-image" data-do="<?php if ( $default_image == '' ) echo 'set'; else echo 'change'; ?>"><?php if ( $default_image == '' ) _e( 'Set Image', 'mycred' ); else _e( 'Change Image', 'mycred' ); ?></button>
1000
+ <button type="button" class="button button-secondary <?php echo ( ( ! $attachment ) ? 'hidden' : '' ); ?>" id="badges-remove-default-image"><?php _e( 'Remove Image', 'mycred' ); ?></button>
1001
+ </div>
1002
+ </div>
1003
+ <span class="description"><?php _e( 'Optional image to show when a user has not earned this badge.', 'mycred' ); ?></span>
1004
+ </div>
1005
+ </div>
1006
+ <?php
1007
+
1008
+ }
1009
+
1010
+ /**
1011
+ * Open Badge Metabox
1012
+ * @since 2.1
1013
+ * @version 1.0
1014
+ */
1015
+ public function metabox_open_badge( $post ) {
1016
+
1017
+ $open_badge = ( mycred_get_post_meta( $post->ID, 'open_badge', true ) == 1 ) ? true : false;
1018
+
1019
+ ?>
1020
+ <div id="mycred-open-badge" class="seperate-bottom">
1021
+ <label for="mycred-badge-is-open-badge"><input type="checkbox" name="mycred_badge[open_badge]" id="mycred-badge-is-open-badge"<?php if ( $open_badge ) echo ' checked="checked"'; ?> value="1" /> <?php _e( 'This badge is Open Badge.', 'mycred' ); ?></label>
1022
+ </div>
1023
+ <span class="description"><?php _e( 'Multi level badge settings will be disable when switched to open badge.', 'mycred' ); ?></span>
1024
+ <?php
1025
+
1026
+ }
1027
+
1028
+ /**
1029
+ * Congratulation Message Metabox
1030
+ * @since 2.1
1031
+ * @version 1.0
1032
+ */
1033
+ public function metabox_congratulation_msg( $post ) {
1034
+
1035
+ $congratulation_msg = mycred_get_post_meta( $post->ID, 'congratulation_msg', true );
1036
+
1037
+ ?>
1038
+ <style>#mycred-badge-congratulation-msg{display:block;margin:12px 0 0;width:100%;}</style>
1039
+ <textarea name="mycred_badge[congratulation_msg]" placeholder="You have earned this Badge!" id="mycred-badge-congratulation-msg"><?php echo empty( $congratulation_msg ) ? '' : $congratulation_msg; ?></textarea>
1040
+ <?php
1041
+
1042
+ }
1043
+
1044
+ /**
1045
+ * Badge Setup Metabox
1046
+ * @since 1.7
1047
+ * @version 1.2
1048
+ */
1049
+ public function metabox_badge_setup( $post ) {
1050
+
1051
+ $badge = mycred_get_badge( $post->ID );
1052
+ $references = mycred_get_all_references();
1053
+ $point_types = mycred_get_types( true );
1054
+ $open_badge = false;
1055
+
1056
+ if ( $this->badges['open_badge'] == 1 ) {
1057
+
1058
+ $open_badge = ( mycred_get_post_meta( $post->ID, 'open_badge', true ) == 1 ) ? true : false;
1059
+
1060
+ }
1061
+
1062
+ $sums = apply_filters( 'mycred_badge_requirement_sums', array(
1063
+ 'count' => esc_js( __( 'Time(s)', 'mycred' ) ),
1064
+ 'sum' => esc_js( __( 'In total', 'mycred' ) )
1065
+ ), $badge );
1066
+
1067
+ // Badge rewards can no be used as a requirement
1068
+ if ( array_key_exists( 'badge_reward', $references ) )
1069
+ unset( $references['badge_reward'] );
1070
+
1071
+ $js_level = $this->level_template( 1 );
1072
+ $js_requirement = $this->requirements_template( 0 );
1073
+ $js_requirement_clone = $this->requirements_template( 1 );
1074
+
1075
+ ?>
1076
+ <div id="badge-levels">
1077
+ <?php
1078
+
1079
+ // Loop through each badge level
1080
+ $level_counter = 0;
1081
+ foreach ( $badge->levels as $level => $setup ) {
1082
+
1083
+ $level = $level_counter;
1084
+
1085
+ $add_level = '<button type="button" class="button button-seconary button-small top-right-corner" id="badges-add-new-level">' . esc_js( __( 'Add Level', 'mycred' ) ) . '</button>';
1086
+ $remove_level = '<button type="button" class="button button-seconary button-small top-right-corner remove-badge-level" data-level="' . $level . '">' . esc_js( __( 'Remove Level', 'mycred' ) ) . '</button>';
1087
+
1088
+ $level_image = $this->get_level_image( $setup, $level );
1089
+ $empty_level = 'empty dashicons';
1090
+ if ( $level_image !== false )
1091
+ $empty_level = '';
1092
+
1093
+ $template = $this->level_template( ( $open_badge ? -1 : $level ) );
1094
+
1095
+ $template = str_replace( '{{level}}', $level, $template );
1096
+ $template = str_replace( '{{addlevelbutton}}', $add_level, $template );
1097
+ $template = str_replace( '{{removelevelbutton}}', $remove_level, $template );
1098
 
1099
+ $js_level = str_replace( '{{removelevelbutton}}', $remove_level, $js_level );
1100
+ $js_level = str_replace( '{{emptylevelimage}}', $empty_level, $js_level );
1101
+ $js_level = str_replace( '{{levelimage}}', '', $js_level );
1102
+ $js_level = str_replace( '{{levelimagebutton}}', esc_js( __( 'Set Image', 'mycred' ) ), $js_level );
1103
+ $js_level = str_replace( '{{levelplaceholder}}', esc_js( __( 'Level', 'mycred' ) ) . ' {{levelone}}', $js_level );
1104
 
1105
+ $template = str_replace( '{{levelimage}}', $level_image, $template );
1106
+ $template = str_replace( '{{emptylevelimage}}', $empty_level, $template );
1107
+ $template = str_replace( '{{levelimagebutton}}', ( ( $level_image === false ) ? esc_js( __( 'Set Image', 'mycred' ) ) : esc_js( __( 'Change Image', 'mycred' ) ) ), $template );
1108
 
1109
+ $template = str_replace( '{{levelplaceholder}}', esc_js( sprintf( __( 'Level %d', 'mycred' ), $level+1 ) ), $template );
1110
+ $template = str_replace( '{{levellabel}}', esc_js( $setup['label'] ), $template );
 
1111
 
1112
+ $template = str_replace( '{{requirementslabel}}', esc_js( __( 'Requirement', 'mycred' ) ), $template );
1113
+ $js_level = str_replace( '{{requirementslabel}}', esc_js( __( 'Requirement', 'mycred' ) ), $js_level );
1114
 
1115
+ $template = str_replace( '{{adnselected}}', ( ( $setup['compare'] === 'AND' ) ? 'selected' : '' ), $template );
1116
+ $template = str_replace( '{{orselected}}', ( ( $setup['compare'] === 'OR' ) ? 'selected' : '' ), $template );
1117
 
1118
+ $template = str_replace( '{{badge_compare_andor}}', ( ( isset($setup['compare']) && !empty($setup['compare']) ) ? $setup['compare'] : 'AND' ), $template );
 
 
1119
 
1120
+ //$requirement = $this->requirements_template( 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1121
 
1122
+ $total_requirements = count( $setup['requires'] );
1123
+ $level_requirements = '';
1124
 
1125
+ foreach ( $setup['requires'] as $req_level => $reqsetup ) {
 
1126
 
1127
+ $requirement = $this->requirements_template( $level );
 
 
 
 
1128
 
1129
+ $requirement = str_replace( '{{level}}', $level, $requirement );
1130
+ $requirement = str_replace( '{{reqlevel}}', $req_level, $requirement );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1131
 
1132
+ $point_type_options = '';
1133
+ $point_type_options .= '<option value=""';
1134
+ if ( $reqsetup['type'] == '' ) $point_type_options .= ' selected="selected"';
1135
+ $point_type_options .= '>' . esc_js( __( 'Select Point Type', 'mycred' ) ) . '</option>';
1136
+ foreach ( $point_types as $type_id => $type_label ) {
1137
+ $point_type_options .= '<option value="' . esc_attr( $type_id ) . '"';
1138
+ if ( $reqsetup['type'] == $type_id ) $point_type_options .= ' selected="selected"';
1139
+ $point_type_options .= '>' . esc_html( $type_label ) . '</option>';
1140
+ }
1141
 
1142
+ $requirement = str_replace( '{{pointtypes}}', $point_type_options, $requirement );
1143
+ $point_type_options = str_replace( 'selected="selected"', '', $point_type_options );
1144
+ $js_requirement = str_replace( '{{pointtypes}}', $point_type_options, $js_requirement );
 
 
 
1145
 
1146
+ $reference_options = '';
1147
+ $reference_options .= '<option value=""';
1148
+ if ( $reqsetup['reference'] == '' ) $reference_options .= ' selected="selected"';
1149
+ $reference_options .= '>' . esc_js( __( 'Select Reference', 'mycred' ) ) . '</option>';
1150
+ foreach ( $references as $ref_id => $ref_label ) {
1151
+ $reference_options .= '<option value="' . esc_attr( $ref_id ) . '"';
1152
+ if ( $reqsetup['reference'] == $ref_id ) $reference_options .= ' selected="selected"';
1153
+ $reference_options .= '>' . esc_html( $ref_label ) . '</option>';
1154
+ }
1155
 
1156
+ $requirement = str_replace( '{{references}}', $reference_options, $requirement );
 
 
 
1157
 
1158
+ $requirement_specific = apply_filters( 'mycred_badge_requirement_specific_template', '', $req_level, $reqsetup, $badge, $level );
1159
+ $requirement = str_replace( '{{{customrequirement}}}', $requirement_specific, $requirement );
 
1160
 
1161
+ $requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $requirement );
 
 
1162
 
1163
+ $reference_options = str_replace( 'selected="selected"', '', $reference_options );
1164
+ $js_requirement = str_replace( '{{references}}', $reference_options, $js_requirement );
1165
+ $js_requirement = str_replace( '{{reqamount}}', $reqsetup['amount'], $js_requirement );
1166
 
1167
+ $by_options = '';
1168
+ $by_options .= '<option value=""';
1169
+ if ( $reqsetup['by'] == '' ) $by_options .= ' selected="selected"';
1170
+ $by_options .= '>' . __( 'Select', 'mycred' ) . '</option>';
1171
+ foreach ( $sums as $sum_id => $sum_label ) {
1172
+ $by_options .= '<option value="' . $sum_id . '"';
1173
+ if ( $reqsetup['by'] == $sum_id ) $by_options .= ' selected="selected"';
1174
+ $by_options .= '>' . $sum_label . '</option>';
1175
+ }
1176
 
1177
+ $requirement = str_replace( '{{requirementtype}}', $by_options, $requirement );
1178
 
1179
+ $by_options = str_replace( 'selected="selected"', '', $by_options );
1180
+ $js_requirement = str_replace( '{{requirementtype}}', $by_options, $js_requirement );
1181
 
1182
+ $selectedtype = '-';
1183
+ if ( array_key_exists( $reqsetup['type'], $point_types ) )
1184
+ $selectedtype = $point_types[ $reqsetup['type'] ];
 
1185
 
1186
+ $requirement = str_replace( '{{selectedtype}}', $selectedtype, $requirement );
1187
 
1188
+ $requirement = str_replace( '{{refspecific}}', '', $requirement );
 
 
1189
 
1190
+ $selectedreference = '-';
1191
+ if ( array_key_exists( $reqsetup['reference'], $references ) )
1192
+ $selectedreference = $references[ $reqsetup['reference'] ];
 
 
1193
 
1194
+ $requirement = str_replace( '{{selectedref}}', $selectedreference, $requirement );
 
 
1195
 
1196
+ $selectedby = '-';
1197
+ if ( array_key_exists( $reqsetup['by'], $sums ) )
1198
+ $selectedby = $sums[ $reqsetup['by'] ];
1199
 
1200
+ $requirement = str_replace( '{{selectedby}}', $selectedby, $requirement );
 
1201
 
1202
+ $requirement_button = '<button type="button" class="button button-primary form-control remove-requirement" data-req="{{reqlevel}}">-</button>';
1203
+ $js_requirement = str_replace( '{{reqbutton}}', $requirement_button, $js_requirement );
1204
 
1205
+ $requirement_button = '<button type="button" class="button button-primary form-control remove-requirement" data-req="' . $req_level . '">-</button>';
1206
+ if ( $req_level == 0 )
1207
+ $requirement_button = '<button type="button" class="button button-secondary form-control" id="badges-add-new-requirement">+</button>';
1208
 
1209
+ $requirement = str_replace( '{{reqbutton}}', $requirement_button, $requirement );
1210
 
1211
+ $compare_label = '';
1212
+ if ( $level > 0 && $req_level < $total_requirements )
1213
+ $compare_label = ( ( $setup['compare'] === 'AND' ) ? _x( 'AND', 'Comparison of badge requirements. A AND B', 'mycred' ) : _x( 'OR', 'Comparison of badge requirements. A OR B', 'mycred' ) );
1214
 
1215
+ if ( $req_level+1 == $total_requirements )
1216
+ $compare_label = '';
1217
 
1218
+ $requirement = str_replace( '{{comparelabel}}', esc_js( $compare_label ), $requirement );
1219
 
1220
+ $level_requirements .= $requirement;
 
1221
 
1222
+ }
 
 
 
 
 
 
 
 
1223
 
1224
+ $template = str_replace( '{{{requirements}}}', $level_requirements, $template );
 
 
1225
 
1226
+ $rewards = $this->rewards_template();
 
 
 
 
 
 
 
 
1227
 
1228
+ $js_level = str_replace( '{{reqamount}}', '', $js_level );
1229
 
1230
+ $rewards = str_replace( '{{level}}', $level, $rewards );
1231
+ $rewards = str_replace( '{{rewardlabel}}', esc_js( __( 'Reward', 'mycred' ) ), $rewards );
1232
 
1233
+ $point_type_options = '';
1234
+ foreach ( $point_types as $type_id => $type_label ) {
1235
+ $point_type_options .= '<option value="' . $type_id . '"';
1236
+ if ( $setup['reward']['type'] == $type_id ) $point_type_options .= ' selected="selected"';
1237
+ $point_type_options .= '>' . $type_label . '</option>';
1238
+ }
1239
 
1240
+ $rewards = str_replace( '{{pointtypes}}', $point_type_options, $rewards );
1241
+ $rewards = str_replace( '{{logplaceholder}}', esc_js( __( 'Log template', 'mycred' ) ), $rewards );
1242
+ $rewards = str_replace( '{{logtemplate}}', esc_js( $setup['reward']['log'] ), $rewards );
1243
+ $rewards = str_replace( '{{rewardamount}}', $setup['reward']['amount'], $rewards );
1244
 
1245
+ $template = str_replace( '{{rewards}}', $rewards, $template );
 
 
 
 
 
 
 
 
1246
 
1247
+ $rewards = str_replace( $level, '{{level}}', $rewards );
1248
 
1249
+ $js_level = str_replace( '{{rewards}}', $rewards, $js_level );
 
1250
 
1251
+ echo $template;
 
 
1252
 
1253
+ $level_counter++;
1254
 
1255
+ if ( $open_badge ) break;
1256
 
1257
+ }
 
 
1258
 
1259
+ ?>
1260
+ </div>
1261
+ <script type="text/javascript">
1262
+ var BadgeLevel = '<?php echo $js_level; ?>';
1263
+ var BadgeNewRequrement = '<?php echo $js_requirement; ?>';
1264
+ var BadgeRequirement = '<?php echo $js_requirement_clone; ?>';
1265
+ </script>
1266
+ <?php
1267
 
1268
+ }
 
 
1269
 
1270
+ /**
1271
+ * Save Badge Details
1272
+ * @since 1.7
1273
+ * @version 1.1
1274
+ */
1275
+ public function save_badge( $post_id, $post = NULL ) {
1276
 
1277
+ if ( $post === NULL || ! $this->core->user_is_point_editor() || ! isset( $_POST['mycred_badge'] ) ) return $post_id;
 
1278
 
1279
+ // Main image (used when a user has not earned a badge
1280
+ $main_image = $_POST['mycred_badge']['main_image'];
 
1281
 
1282
+ // If we are using an attachment
1283
+ if ( absint( $main_image ) > 0 )
1284
+ $image = absint( $main_image );
1285
 
1286
+ // Else we are using a URL (old setup)
1287
+ else
1288
+ $image = sanitize_text_field( $_POST['mycred_badge']['main_image_url'] );
1289
 
1290
+ $manual = 0;
1291
+ if ( isset( $_POST['mycred_badge']['manual'] ) )
1292
+ $manual = 1;
1293
 
1294
+ $open_badge = 0;
1295
+ if ( isset( $_POST['mycred_badge']['open_badge'] ) )
1296
+ $open_badge = 1;
1297
 
1298
+ $congratulation_msg = '';
1299
+ if ( isset( $_POST['mycred_badge']['congratulation_msg'] ) )
1300
+ $congratulation_msg = sanitize_text_field( $_POST['mycred_badge']['congratulation_msg'] );
1301
 
1302
+ $badge_levels = array();
1303
+ $badge_requirements = array();
1304
 
1305
+ // Run through each level
1306
+ if ( ! empty( $_POST['mycred_badge']['levels'] ) ) {
1307
 
1308
+ $level_row = 0;
1309
 
1310
+ foreach ( $_POST['mycred_badge']['levels'] as $level_id => $level_setup ) {
1311
 
1312
+ $level = array();
 
1313
 
1314
+ if ( array_key_exists( 'attachment_id', $level_setup ) ) {
1315
+ $level['attachment_id'] = absint( $level_setup['attachment_id'] );
1316
+ $level['image_url'] = ( ( array_key_exists( 'image_url', $level_setup ) ) ? sanitize_text_field( $level_setup['image_url'] ) : '' );
1317
+ }
1318
+ //Setting default image on badge's level from badges
1319
+ else {
1320
+ $level['attachment_id'] = $image;
1321
+ $level['image_url'] = ( ( array_key_exists( 'image_url', $level_setup ) ) ? sanitize_text_field( $level_setup['image_url'] ) : '' );
1322
+ }
1323
 
1324
+ $level['label'] = sanitize_text_field( $level_setup['label'] );
 
 
 
1325
 
1326
+ if ( array_key_exists( 'compare', $level_setup ) )
1327
+ $level['compare'] = ( ( $level_setup['compare'] == 'AND' ) ? 'AND' : 'OR' );
1328
+ else
1329
+ $level['compare'] = ( ( array_key_exists( 'compare', $badge_levels[0] ) ) ? $badge_levels[0]['compare'] : 'AND' );
1330
 
1331
+ $level['requires'] = array();
1332
 
1333
+ if ( array_key_exists( 'requires', $level_setup ) ) {
1334
 
1335
+ $level_requirements = array();
1336
 
1337
+ $row = 0;
1338
+ foreach ( $level_setup['requires'] as $requirement_id => $requirement_setup ) {
1339
 
1340
+ $requirement = array();
1341
+ $requirement['type'] = ( ( array_key_exists( 'type', $requirement_setup ) ) ? sanitize_key( $requirement_setup['type'] ) : '' );
1342
+ $requirement['reference'] = ( ( array_key_exists( 'reference', $requirement_setup ) ) ? sanitize_key( $requirement_setup['reference'] ) : '' );
1343
+ $requirement['amount'] = ( ( array_key_exists( 'amount', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['amount'] ) : '' );
1344
+ $requirement['by'] = ( ( array_key_exists( 'by', $requirement_setup ) ) ? sanitize_key( $requirement_setup['by'] ) : '' );
1345
+ $requirement['specific'] = ( ( array_key_exists( 'specific', $requirement_setup ) ) ? sanitize_text_field( $requirement_setup['specific'] ) : '' );
1346
 
1347
+ $level_requirements[ $row ] = $requirement;
1348
+ $row ++;
 
 
 
 
 
 
1349
 
1350
+ }
1351
 
1352
+ if ( $level_row == 0 )
1353
+ $badge_requirements = $level_requirements;
 
 
 
 
1354
 
1355
+ $completed_requirements = array();
1356
+ foreach ( $level_requirements as $requirement_id => $requirement_setup ) {
1357
 
1358
+ if ( $level_row == 0 ) {
1359
+ $completed_requirements[ $requirement_id ] = $requirement_setup;
1360
+ continue;
1361
+ }
1362
 
1363
+ $completed_requirements[ $requirement_id ] = $badge_requirements[ $requirement_id ];
1364
+ $completed_requirements[ $requirement_id ]['amount'] = $requirement_setup['amount'];
1365
 
1366
+ }
 
1367
 
1368
+ $level['requires'] = $completed_requirements;
 
1369
 
1370
+ }
1371
 
1372
+ $reward = array( 'type' => '', 'log' => '', 'amount' => '' );
 
 
 
 
 
 
 
1373
 
1374
+ if ( array_key_exists( 'reward', $level_setup ) ) {
1375
 
1376
+ $reward['type'] = sanitize_key( $level_setup['reward']['type'] );
1377
+ $reward['log'] = sanitize_text_field( $level_setup['reward']['log'] );
 
 
1378
 
1379
+ if ( $reward['type'] != MYCRED_DEFAULT_TYPE_KEY )
1380
+ $mycred = mycred( $reward['type'] );
1381
+ else
1382
+ $mycred = $this->core;
1383
 
1384
+ $reward['amount'] = $mycred->number( $level_setup['reward']['amount'] );
1385
 
1386
+ }
1387
 
1388
+ $level['reward'] = $reward;
 
1389
 
1390
+ $badge_levels[] = $level;
1391
+ $level_row ++;
 
 
 
 
1392
 
1393
+ }
1394
+ }
1395
 
1396
+ // Save Badge Setup
1397
+ mycred_update_post_meta( $post_id, 'badge_prefs', $badge_levels );
1398
 
1399
+ // If we just set the badge to be manual we need to re-parse all references.
1400
+ $old_manual = mycred_get_post_meta( $post_id, 'manual_badge', true );
1401
+ if ( absint( $old_manual ) === 0 && $manual === 1 ) {
1402
+ foreach ( $this->point_types as $type_id => $label ) {
1403
+ mycred_get_badge_references( $type_id, true );
1404
+ }
1405
+ }
1406
 
1407
+ // Force re-calculation of used references
1408
+ foreach ( $this->point_types as $type_id => $type )
1409
+ mycred_delete_option( 'mycred-badge-refs-' . $type_id );
1410
 
1411
+ // Save if badge is manuall
1412
+ mycred_update_post_meta( $post_id, 'manual_badge', $manual );
 
 
1413
 
1414
+ mycred_update_post_meta( $post_id, 'open_badge', $open_badge );
 
1415
 
1416
+ mycred_update_post_meta( $post_id, 'congratulation_msg', $congratulation_msg );
1417
 
1418
+ mycred_update_post_meta( $post_id, 'main_image', $image );
1419
 
1420
+ // Let others play
1421
+ do_action( 'mycred_save_badge', $post_id );
1422
 
1423
+ }
1424
 
1425
+ /**
1426
+ * Add to General Settings
1427
+ * @since 1.0
1428
+ * @version 1.1
1429
+ */
1430
+ public function after_general_settings( $mycred = NULL ) {
1431
+
1432
+ $settings = $this->badges;
1433
+
1434
+ $buddypress = ( ( class_exists( 'BuddyPress' ) ) ? true : false );
1435
+ $bbpress = ( ( class_exists( 'bbPress' ) ) ? true : false );
1436
+
1437
+ ?>
1438
+ <h4><span class="dashicons dashicons-admin-plugins static"></span><?php _e( 'Badges', 'mycred' ); ?></h4>
1439
+ <div class="body" style="display:none;">
1440
+
1441
+ <h3><?php _e( 'Single Badge Page', 'mycred' ); ?></h3>
1442
+
1443
+ <div class="row">
1444
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
1445
+
1446
+ <div class="form-group">
1447
+ <div class="checkbox" style="padding-top: 4px;">
1448
+ <label for="<?php echo $this->field_id( 'show_level_description' ); ?>">
1449
+ <input type="checkbox" name="<?php echo $this->field_name( 'show_level_description' ); ?>" id="<?php echo $this->field_id( 'show_level_description' ); ?>" <?php checked( $settings['show_level_description'], 1 ); ?> value="1"><?php _e('Show Level Description', 'mycred'); ?>
1450
+ </label>
1451
+ </div>
1452
+ </div>
1453
+
1454
+ <div class="form-group">
1455
+ <div class="checkbox" style="padding-top: 4px;">
1456
+ <label for="<?php echo $this->field_id( 'show_congo_text' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_congo_text' ); ?>" id="<?php echo $this->field_id( 'show_congo_text' ); ?>" <?php checked( $settings['show_congo_text'], 1 ); ?> value="1"> <?php _e('Show Congratulation Text', 'mycred'); ?></label>
1457
+ </div>
1458
+ </div>
1459
+
1460
+ <div class="form-group">
1461
+ <div class="checkbox" style="padding-top: 4px;">
1462
+ <label for="<?php echo $this->field_id( 'show_steps_to_achieve' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_steps_to_achieve' ); ?>" id="<?php echo $this->field_id( 'show_steps_to_achieve' ); ?>" <?php checked( $settings['show_steps_to_achieve'], 1 ); ?> value="1"> <?php _e('Show Steps to Achieve', 'mycred'); ?></label>
1463
+ </div>
1464
+ </div>
1465
+
1466
+ </div>
1467
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
1468
+
1469
+ <div class="form-group">
1470
+ <div class="checkbox" style="padding-top: 4px;">
1471
+ <label for="<?php echo $this->field_id( 'show_levels' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_levels' ); ?>" id="<?php echo $this->field_id( 'show_levels' ); ?>" <?php checked( $settings['show_levels'], 1 ); ?> value="1"> <?php _e('Show Levels', 'mycred'); ?></label>
1472
+ </div>
1473
+ </div>
1474
+
1475
+ <div class="form-group">
1476
+ <div class="checkbox" style="padding-top: 4px;">
1477
+ <label for="<?php echo $this->field_id( 'show_level_points' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_level_points' ); ?>" id="<?php echo $this->field_id( 'show_level_points' ); ?>" <?php checked( $settings['show_level_points'], 1 ); ?> value="1"> <?php _e('Show Level Reward', 'mycred'); ?></label>
1478
+ </div>
1479
+ </div>
1480
+
1481
+ <div class="form-group">
1482
+ <div class="checkbox" style="padding-top: 4px;">
1483
+ <label for="<?php echo $this->field_id( 'show_earners' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_earners' ); ?>" id="<?php echo $this->field_id( 'show_earners' ); ?>" <?php checked( $settings['show_earners'], 1 ); ?> value="1"> <?php _e('Show Earners', 'mycred'); ?></label>
1484
+ </div>
1485
+ </div>
1486
+
1487
+ </div>
1488
+ </div>
1489
+
1490
+ <h3><?php _e( 'Open Badge', 'mycred' ); ?></h3>
1491
+ <div class="row">
1492
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
1493
+ <div class="form-group">
1494
+ <div class="checkbox">
1495
+ <label for="<?php echo $this->field_id( 'open_badge' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'open_badge' ); ?>" id="<?php echo $this->field_id( 'open_badge' ); ?>" <?php checked( $settings['open_badge'], 1 ); ?> value="1" > <?php _e( 'Enable Open Badge.', 'mycred' ); ?></label>
1496
+ </div>
1497
+ </div>
1498
+ </div>
1499
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
1500
+ <?php if( $settings['open_badge'] == '1' ):?>
1501
+ <div class="form-group">
1502
+ <label for="<?php echo $this->field_id( 'open_badge_evidence_page' ); ?>"><?php _e( 'Evidence Page', 'mycred' ); ?></label>
1503
+ <?php
1504
+
1505
+ $selectedEvidencePage = mycred_get_evidence_page_id();
1506
+
1507
+ $args = array(
1508
+ 'id' => $this->field_id( 'open_badge_evidence_page' ),
1509
+ 'name' => $this->field_name( 'open_badge_evidence_page' ),
1510
+ 'selected' => $selectedEvidencePage
1511
+ );
1512
+
1513
+ wp_dropdown_pages( $args );
1514
+ ?>
1515
+ </div>
1516
+ <?php endif;?>
1517
+ </div>
1518
+ <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
1519
+ <div class="form-group">
1520
+ <button class="button button-large large button-primary" id="switch-all-to-open-badge"><span class="dashicons dashicons-update mycred-switch-all-badges-icon"></span> Switch All Badges To Open Badge.</button>
1521
+ </div>
1522
+ </div>
1523
+ </div>
1524
+
1525
+ <h3><?php _e( 'Third-party Integrations', 'mycred' ); ?></h3>
1526
+ <div class="row">
1527
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
1528
+ <div class="form-group">
1529
+ <label for="<?php echo $this->field_id( 'buddypress' ); ?>">BuddyPress</label>
1530
+ <?php if ( $buddypress ) : ?>
1531
+ <select name="<?php echo $this->field_name( 'buddypress' ); ?>" id="<?php echo $this->field_id( 'buddypress' ); ?>" class="form-control">
1532
+ <?php
1533
+
1534
+ $buddypress_options = array(
1535
+ '' => __( 'Do not show', 'mycred' ),
1536
+ 'header' => __( 'Include in Profile Header', 'mycred' ),
1537
+ 'profile' => __( 'Include under the "Profile" tab', 'mycred' ),
1538
+ 'both' => __( 'Include under the "Profile" tab and Profile Header', 'mycred' )
1539
+ );
1540
+
1541
+ foreach ( $buddypress_options as $location => $description ) {
1542
+ echo '<option value="' . $location . '"';
1543
+ if ( isset( $settings['buddypress'] ) && $settings['buddypress'] == $location ) echo ' selected="selected"';
1544
+ echo '>' . $description . '</option>';
1545
+ }
1546
+
1547
+ ?>
1548
+
1549
+ </select>
1550
+ </div>
1551
+ <div class="form-group">
1552
+ <div class="checkbox">
1553
+ <label for="<?php echo $this->field_id( 'show_all_bp' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_all_bp' ); ?>" id="<?php echo $this->field_id( 'show_all_bp' ); ?>" <?php checked( $settings['show_all_bp'], 1 ); ?> value="1" /> <?php _e( 'Show all badges, including badges users have not yet earned.', 'mycred' ); ?></label>
1554
+ </div>
1555
+ <?php else : ?>
1556
+ <input type="hidden" name="<?php echo $this->field_name( 'buddypress' ); ?>" id="<?php echo $this->field_id( 'buddypress' ); ?>" value="" />
1557
+ <p><span class="description"><?php _e( 'Not installed', 'mycred' ); ?></span></p>
1558
+ <?php endif; ?>
1559
+ </div>
1560
+ </div>
1561
+ <div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
1562
+ <div class="form-group">
1563
+ <label for="<?php echo $this->field_id( 'bbpress' ); ?>">bbPress</label>
1564
+ <?php if ( $bbpress ) : ?>
1565
+ <select name="<?php echo $this->field_name( 'bbpress' ); ?>" id="<?php echo $this->field_id( 'bbpress' ); ?>" class="form-control">
1566
+ <?php
1567
+
1568
+ $bbpress_options = array(
1569
+ '' => __( 'Do not show', 'mycred' ),
1570
+ 'profile' => __( 'Include in Profile', 'mycred' ),
1571
+ 'reply' => __( 'Include in Forum Replies', 'mycred' ),
1572
+ 'both' => __( 'Include in Profile and Forum Replies', 'mycred' )
1573
+ );
1574
+
1575
+ foreach ( $bbpress_options as $location => $description ) {
1576
+ echo '<option value="' . $location . '"';
1577
+ if ( isset( $settings['bbpress'] ) && $settings['bbpress'] == $location ) echo ' selected="selected"';
1578
+ echo '>' . $description . '</option>';
1579
+ }
1580
+
1581
+ ?>
1582
+
1583
+ </select>
1584
+ </div>
1585
+ <div class="form-group">
1586
+ <div class="checkbox">
1587
+ <label for="<?php echo $this->field_id( 'show_all_bb' ); ?>"><input type="checkbox" name="<?php echo $this->field_name( 'show_all_bb' ); ?>" id="<?php echo $this->field_id( 'show_all_bb' ); ?>" <?php checked( $settings['show_all_bb'], 1 ); ?> value="1" /> <?php _e( 'Show all badges, including badges users have not yet earned.', 'mycred' ); ?></label>
1588
+ </div>
1589
+ <?php else : ?>
1590
+ <input type="hidden" name="<?php echo $this->field_name( 'bbpress' ); ?>" id="<?php echo $this->field_id( 'bbpress' ); ?>" value="" />
1591
+ <p><span class="description"><?php _e( 'Not installed', 'mycred' ); ?></span></p>
1592
+ <?php endif; ?>
1593
+ </div>
1594
+ </div>
1595
+ </div>
1596
+
1597
+ <h3 style="margin-bottom: 0;"><?php _e( 'Available Shortcodes', 'mycred' ); ?></h3>
1598
+ <div class="row">
1599
+ <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
1600
+ <p><a href="http://codex.mycred.me/shortcodes/mycred_my_badges/" target="_blank">[mycred_my_badges]</a>, <a href="http://codex.mycred.me/shortcodes/mycred_badges/" target="_blank">[mycred_badges]</a></p>
1601
+ </div>
1602
+ </div>
1603
+
1604
+ </div>
1605
+ <?php
1606
+
1607
+ }
1608
+
1609
+ /**
1610
+ * Save Settings
1611
+ * @since 1.0
1612
+ * @version 1.0.3
1613
+ */
1614
+ public function sanitize_extra_settings( $new_data, $data, $core ) {
1615
+
1616
+ $new_data['badges']['show_all_bp'] = ( isset( $data['badges']['show_all_bp'] ) ) ? $data['badges']['show_all_bp'] : 0;
1617
+ $new_data['badges']['show_all_bb'] = ( isset( $data['badges']['show_all_bb'] ) ) ? $data['badges']['show_all_bb'] : 0;
1618
+
1619
+ $new_data['badges']['buddypress'] = ( isset( $data['badges']['buddypress'] ) ) ? sanitize_text_field( $data['badges']['buddypress'] ) : '';
1620
+ $new_data['badges']['bbpress'] = ( isset( $data['badges']['bbpress'] ) ) ? sanitize_text_field( $data['badges']['bbpress'] ) : '';
1621
+
1622
+ $new_data['badges']['open_badge'] = ( isset( $data['badges']['open_badge'] ) ) ? intval( $data['badges']['open_badge'] ) : 0;
1623
+
1624
+ //Specific Badge Page Setup @since 2.1
1625
+ $new_data['badges']['show_level_description'] = ( isset( $data['badges']['show_level_description'] ) ) ? intval( $data['badges']['show_level_description'] ) : 0;
1626
+ $new_data['badges']['show_congo_text'] = ( isset( $data['badges']['show_congo_text'] ) ) ? intval( $data['badges']['show_congo_text'] ) : 0;
1627
+ $new_data['badges']['show_levels'] = ( isset( $data['badges']['show_levels'] ) ) ? intval( $data['badges']['show_levels'] ) : 0;
1628
+ $new_data['badges']['show_level_points'] = ( isset( $data['badges']['show_level_points'] ) ) ? intval( $data['badges']['show_level_points'] ) : 0;
1629
+ $new_data['badges']['show_steps_to_achieve'] = ( isset( $data['badges']['show_steps_to_achieve'] ) ) ? intval( $data['badges']['show_steps_to_achieve'] ) : 0;
1630
+ $new_data['badges']['show_earners'] = ( isset( $data['badges']['show_earners'] ) ) ? intval( $data['badges']['show_earners'] ) : 0;
1631
+ $new_data['badges']['open_badge_evidence_page'] = ( isset( $data['badges']['open_badge_evidence_page'] ) ) ? intval( $data['badges']['open_badge_evidence_page'] ) : 0;
1632
+
1633
+
1634
+ return $new_data;
1635
+
1636
+ }
1637
+
1638
+ /**
1639
+ * User Badges Admin Screen
1640
+ * @since 1.0
1641
+ * @version 1.1
1642
+ */
1643
+ public function badge_user_screen( $user ) {
1644
+
1645
+ // Only visible to admins
1646
+ if ( ! mycred_is_admin() ) return;
1647
+
1648
+ $user_id = $user->ID;
1649
+ $all_badges = mycred_get_badge_ids();
1650
+ $users_badges = mycred_get_users_badges( $user_id );
1651
+
1652
+ ?>
1653
+ <style type="text/css">
1654
+ .badge-wrapper { min-height: 230px; }
1655
+ .badge-wrapper select { width: 100%; }
1656
+ .badge-image-wrap { text-align: center; }
1657
+ .badge-image-wrap .badge-image { display: block; width: 100%; height: 100px; line-height: 100px; }
1658
+ .badge-image-wrap .badge-image.empty { content: "<?php _e( 'No image set', 'mycred' ); ?>"; }
1659
+ .badge-image-wrap .badge-image img { width: auto; height: auto; max-height: 100px; }
1660
+ </style>
1661
+ <table class="form-table">
1662
+ <tr>
1663
+ <th scope="row"><?php _e( 'Badges', 'mycred' ); ?></th>
1664
+ <td>
1665
+ <fieldset id="mycred-badge-list" class="badge-list">
1666
+ <legend class="screen-reader-text"><span><?php _e( 'Badges', 'mycred' ); ?></span></legend>
1667
+ <?php
1668
+
1669
+ if ( ! empty( $all_badges ) ) {
1670
+ foreach ( $all_badges as $badge_id ) {
1671
+
1672
+ $badge_id = absint( $badge_id );
1673
+ $badge = mycred_get_badge( $badge_id );
1674
+ $earned = 0;
1675
+ $earned_level = 0;
1676
+ $badge_image = $badge->main_image;
1677
+
1678
+ if ( array_key_exists( $badge_id, $users_badges ) ) {
1679
+ $earned = 1;
1680
+ $earned_level = $users_badges[ $badge_id ];
1681
+ $badge_image = $badge->get_image( $earned_level );
1682
+ }
1683
+
1684
+ $level_select = '<input type="hidden" name="mycred_badge_manual[badges][' . $badge_id . '][level]" value="0" /><select disabled="disabled"><option>Level 1</option></select>';
1685
+ if ( count( $badge->levels ) > 1 ) {
1686
 
1687
+ $level_select = '<select name="mycred_badge_manual[badges][' . $badge_id . '][level]">';
1688
+ $level_select .= '<option value=""';
1689
+ if ( ! $earned ) $level_select .= ' selected="selected"';
1690
+ $level_select .= '>' . __( 'Select a level', 'mycred' ) . '</option>';
1691
 
1692
+ foreach ( $badge->levels as $level_id => $level ) {
1693
+ $level_select .= '<option value="' . $level_id . '"';
1694
+ if ( $earned && $earned_level == $level_id ) $level_select .= ' selected="selected"';
1695
+ $level_select .= '>' . ( ( $level['label'] != '' ) ? $level['label'] : sprintf( '%s %d', __( 'Level', 'mycred' ), ( $level_id + 1 ) ) ) . '</option>';
1696
+ }
1697
 
1698
+ $level_select .= '</select>';
1699
 
1700
+ }
1701
 
1702
+ ?>
1703
+ <div class="badge-wrapper color-option<?php if ( $earned === 1 ) echo ' selected'; ?>" id="mycred-badge<?php echo $badge_id; ?>-wrapper">
1704
+ <label for="mycred-badge<?php echo $badge_id; ?>"><input type="checkbox" name="mycred_badge_manual[badges][<?php echo $badge_id; ?>][has]" class="toggle-badge" id="mycred-badge<?php echo $badge_id; ?>" <?php checked( $earned, 1 );?> value="1" /> <?php _e( 'Earned', 'mycred' ); ?></label>
1705
+ <div class="badge-image-wrap">
1706
 
1707
+ <div class="badge-image<?php if ( $badge_image == '' ) echo ' empty'; ?>"><?php echo $badge_image; ?></div>
 
1708
 
1709
+ <h4><?php echo $badge->title; ?></h4>
1710
+ </div>
1711
+ <div class="badge-actions" style="min-height: 32px;">
1712
 
1713
+ <?php echo $level_select; ?>
1714
 
1715
+ </div>
1716
+ </div>
1717
+ <?php
1718
 
1719
+ }
1720
+ }
 
 
 
 
 
1721
 
1722
+ ?>
1723
+ </fieldset>
1724
+ <input type="hidden" name="mycred_badge_manual[token]" value="<?php echo wp_create_nonce( 'mycred-manual-badges' . $user_id ); ?>" />
1725
+ </td>
1726
+ </tr>
1727
+ </table>
1728
+ <script type="text/javascript">
1729
+ jQuery(function($) {
1730
 
1731
+ $( '.badge-wrapper label input.toggle-badge' ).click(function(){
 
1732
 
1733
+ if ( $(this).is( ':checked' ) )
1734
+ $( '#' + $(this).attr( 'id' ) + '-wrapper' ).addClass( 'selected' );
1735
 
1736
+ else
1737
+ $( '#' + $(this).attr( 'id' ) + '-wrapper' ).removeClass( 'selected' );
 
1738
 
1739
+ });
 
 
1740
 
1741
+ });
1742
+ </script>
1743
+ <?php
1744
 
1745
+ }
 
1746
 
1747
+ /**
1748
+ * Save Manual Badges
1749
+ * @since 1.0
1750
+ * @version 1.1
1751
+ */
1752
+ public function save_manual_badges( $user_id ) {
1753
 
1754
+ if ( ! mycred_is_admin() ) return;
 
 
 
 
 
1755
 
1756
+ if ( isset( $_POST['mycred_badge_manual']['token'] ) ) {
1757
 
1758
+ if ( wp_verify_nonce( $_POST['mycred_badge_manual']['token'], 'mycred-manual-badges' . $user_id ) ) {
 
1759
 
1760
+ $added = $removed = $updated = 0;
1761
+ $users_badges = mycred_get_users_badges( $user_id );
 
1762
 
1763
+ if ( ! empty( $_POST['mycred_badge_manual']['badges'] ) ) {
1764
+ foreach ( $_POST['mycred_badge_manual']['badges'] as $badge_id => $data ) {
 
 
 
 
 
 
1765
 
1766
+ $badge = mycred_get_badge( $badge_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1767
 
1768
+ // Most likely not a badge post ID
1769
+ if ( $badge === false ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1770
 
1771
+ // Give badge
1772
+ if ( ! array_key_exists( $badge_id, $users_badges ) && isset( $data['has'] ) && $data['has'] == 1 ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1773
 
1774
+ $level = 0;
1775
+ if ( isset( $data['level'] ) && $data['level'] != '' )
1776
+ $level = absint( $data['level'] );
1777
 
1778
+ $badge->assign( $user_id, $level );
 
 
 
 
1779
 
1780
+ $added ++;
 
 
 
 
1781
 
1782
+ }
 
1783
 
1784
+ // Remove badge
1785
+ elseif ( array_key_exists( $badge_id, $users_badges ) && ! isset( $data['has'] ) ) {
 
 
1786
 
1787
+ $badge->divest( $user_id );
 
 
 
 
1788
 
1789
+ $removed ++;
1790
 
1791
+ }
1792
 
1793
+ // Level change
1794
+ elseif ( array_key_exists( $badge_id, $users_badges ) && isset( $data['level'] ) && $data['level'] != $users_badges[ $badge_id ] ) {
 
 
1795
 
1796
+ $badge->assign( $user_id, $data['level'] );
1797
 
1798
+ $updated ++;
 
 
1799
 
1800
+ }
1801
 
1802
+ }
1803
+ }
 
1804
 
1805
+ if ( $added > 0 || $removed > 0 || $updated > 0 )
1806
+ mycred_delete_user_meta( $user_id, 'mycred_badge_ids' );
1807
 
1808
+ }
 
 
 
 
 
 
 
1809
 
1810
+ }
1811
 
1812
+ }
 
1813
 
1814
+ /**
1815
+ * AJAX: Assign Badge
1816
+ * @since 1.0
1817
+ * @version 1.3
1818
+ */
1819
+ public function action_assign_badge() {
1820
 
1821
+ check_ajax_referer( 'mycred-assign-badge', 'token' );
1822
 
1823
+ $badge_id = absint( $_POST['badge_id'] );
1824
+ if ( $badge_id === 0 ) wp_send_json_error();
1825
+
1826
+ // Get the badge object
1827
+ $badge = mycred_get_badge( $badge_id );
1828
+
1829
+ // Most likely not a badge post ID
1830
+ if ( $badge === false ) wp_send_json_error();
1831
+
1832
+ $results = $badge->assign_all();
1833
+
1834
+ if ( $results > 0 )
1835
+ wp_send_json_success( sprintf( __( 'A total of %d users have received this badge.', 'mycred' ), $results ) );
1836
+
1837
+ wp_send_json_error( __( 'No users has yet earned this badge.', 'mycred' ) );
1838
+
1839
+ }
1840
+
1841
+ /**
1842
+ * AJAX: Remove Badge Connections
1843
+ * @since 1.0
1844
+ * @version 1.1
1845
+ */
1846
+ public function action_remove_connections() {
1847
+
1848
+ check_ajax_referer( 'mycred-remove-badge-connection', 'token' );
1849
+
1850
+ $badge_id = absint( $_POST['badge_id'] );
1851
+ if ( $badge_id === 0 ) wp_send_json_error();
1852
+
1853
+ // Get the badge object
1854
+ $badge = mycred_get_badge( $badge_id );
1855
+
1856
+ // Most likely not a badge post ID
1857
+ if ( $badge === false ) wp_send_json_error();
1858
+
1859
+ $results = $badge->divest_all();
1860
+
1861
+ if ( $results == 0 )
1862
+ wp_send_json_success( __( 'No connections where removed.', 'mycred' ) );
1863
+
1864
+ wp_send_json_success( sprintf( __( '%s connections where removed.', 'mycred' ), $results ) );
1865
+
1866
+ }
1867
+
1868
+ /**
1869
+ * Insert Badges into bbPress profile
1870
+ * @since 1.0
1871
+ * @version 1.1
1872
+ */
1873
+ public function insert_into_bbpress_profile() {
1874
+
1875
+ $user_id = bbp_get_displayed_user_id();
1876
+ if ( isset( $this->badges['show_all_bb'] ) && $this->badges['show_all_bb'] == 1 )
1877
+ echo mycred_render_my_badges( array(
1878
+ 'show' => 'all',
1879
+ 'width' => MYCRED_BADGE_WIDTH,
1880
+ 'height' => MYCRED_BADGE_HEIGHT,
1881
+ 'user_id' => $user_id
1882
+ ) );
1883
+
1884
+ else
1885
+ mycred_display_users_badges( $user_id );
1886
+
1887
+ }
1888
+
1889
+ /**
1890
+ * Insert Badges into bbPress
1891
+ * @since 1.0
1892
+ * @version 1.1
1893
+ */
1894
+ public function insert_into_bbpress_reply() {
1895
+
1896
+ $user_id = bbp_get_reply_author_id();
1897
+
1898
+ if ( $user_id > 0 ) {
1899
+
1900
+ if ( isset( $this->badges['show_all_bb'] ) && $this->badges['show_all_bb'] == 1 )
1901
+ echo mycred_render_my_badges( array(
1902
+ 'show' => 'all',
1903
+ 'width' => MYCRED_BADGE_WIDTH,
1904
+ 'height' => MYCRED_BADGE_HEIGHT,
1905
+ 'user_id' => $user_id
1906
+ ) );
1907
+
1908
+ else
1909
+ mycred_display_users_badges( $user_id );
1910
+
1911
+ }
1912
+
1913
+ }
1914
+
1915
+ /**
1916
+ * Insert Badges in BuddyPress
1917
+ * @since 1.0
1918
+ * @version 1.1.1
1919
+ */
1920
+ public function insert_into_buddypress() {
1921
+
1922
+ $user_id = bp_displayed_user_id();
1923
+ if ( isset( $this->badges['show_all_bp'] ) && $this->badges['show_all_bp'] == 1 )
1924
+ echo mycred_render_my_badges( array(
1925
+ 'show' => 'all',
1926
+ 'width' => MYCRED_BADGE_WIDTH,
1927
+ 'height' => MYCRED_BADGE_HEIGHT,
1928
+ 'user_id' => $user_id
1929
+ ) );
1930
+
1931
+ else
1932
+ mycred_display_users_badges( $user_id );
1933
 
1934
+ }
1935
 
1936
+ /**
1937
+ * Init Open Badge
1938
+ * @since 2.1
1939
+ * @version 1.0
1940
+ */
1941
+ public function mycred_open_badge_init() {
1942
 
1943
+ $mycred_Open_Badge = new mycred_Open_Badge();
1944
 
1945
+ add_action( 'mycred_after_badge_assign', array( $mycred_Open_Badge, 'bake_users_image' ), 10, 2 );
1946
+ add_action( 'rest_api_init', array( $mycred_Open_Badge, 'register_open_badge_routes' ) );
1947
+
1948
+ }
1949
 
1950
+ /**
1951
+ * Automatically runs when MYCRED_BADGE_KEY (Post Type Page Loads)
1952
+ * @param $content
1953
+ * @return string
1954
+ * @since 2.1
1955
+ * @version 1.0
1956
+ */
1957
+ public function mycred_badge_page_template( $content ) {
1958
 
1959
+ global $post;
 
1960
 
1961
+ if ( $post->post_type == MYCRED_BADGE_KEY && is_single() ) {
1962
+
1963
+ $mycred = mycred();
1964
 
1965
+ $show_level_description = $mycred->core["badges"]["show_level_description"] == '1' ? true : false;
1966
+ $show_congo_text = $mycred->core["badges"]["show_congo_text"] == '1' ? true : false;
1967
+ $show_levels = $mycred->core["badges"]["show_levels"] == '1' ? true : false;
1968
+ $show_level_points = $mycred->core["badges"]["show_level_points"] == '1' ? true : false;
1969
+ $show_steps_to_achieve = $mycred->core["badges"]["show_steps_to_achieve"] == '1' ? true : false;
1970
+ $show_earners = $mycred->core["badges"]["show_earners"] == '1' ? true : false;
1971
 
1972
+ //Badge ID
1973
+ $badge_id = $post->ID;
1974
 
1975
+ $user_id = get_current_user_id();
 
1976
 
1977
+ $has_earned = mycred_user_has_badge( $user_id, $badge_id );
 
 
1978
 
1979
+ $badge_object = mycred_get_badge( $badge_id );
1980
 
1981
+ //Level Image URL, If User has earned (Show Baked) else (Original)
1982
+ $badge_image_url = $badge_object->get_earned_image( $user_id );
1983
 
1984
+ //Preparing Template
1985
+ $content = '';
1986
 
1987
+ $content = '<div class="mycred-badge-page">';
 
1988
 
1989
+ if ( $show_congo_text && $has_earned ) {
1990
+ if (!empty($badge_object->congratulation_msg))
1991
+ {
1992
 
1993
+ $content .= '<div class="mycred-badge-congratulation-msg">' . $badge_object->congratulation_msg . '</div>';
1994
+ }
1995
+ }
1996
+
1997
+ $content .= '<img src="' . $badge_image_url . '" class="mycred-badge-image" alt="">';
1998
 
1999
+ //Level Description
2000
+ if( $show_level_description ) {
2001
 
2002
+ $content .= "<h3>" . __("Description", "mycred") . "</h3>";
2003
+ $content .= "<p>" . $post->post_content . "</p>";
2004
 
2005
+ }
2006
 
2007
+ //Showing Badge Levels
2008
+ if( $show_levels || $badge_object->open_badge && $show_steps_to_achieve ) {
2009
 
2010
+ if ( ! $badge_object->open_badge )
2011
+ $content .= "<h3>" . __("Levels", "mycred") . "</h3>";
2012
+ else
2013
+ $content .= "<h3>" . __("Requirement", "mycred") . "</h3>";
2014
 
2015
+ //Badge Requirements
2016
+ $levels = mycred_show_badge_requirements( $badge_id );
2017
 
2018
+ foreach ( $levels as $id => $level ) {
2019
+ $level_image_url = $level["image"];
2020
 
2021
+ $heading = $level["heading"];
2022
 
2023
+ $requirements = $level["requirements"];
2024
 
2025
+ $reward = $level["amount"];
2026
 
2027
+ $content .= '<div class="mycred-badge-page-level">';
 
 
 
 
 
2028
 
2029
+ if ( ! $badge_object->open_badge ) {
2030
 
2031
+ if ( $level_image_url != '' )
2032
+ $content .= '<img src="'.$level_image_url.'" class="mycred-level-image mycred-float-left" />';
2033
 
2034
+ $content .= "<div class='mycred-float-left'><h4>$heading</h4></div>";
2035
+ }
2036
 
2037
+ $content .= "<div class='clear'></div>";
 
2038
 
2039
+ if ( $show_steps_to_achieve )
2040
+ $content .= mycred_badge_level_req_check( $badge_id, $id );
2041
 
2042
+ if ( $show_level_points && $reward != 0 ) {
 
2043
 
2044
+ $reward_type = mycred( $level['reward_type'] );
2045
 
2046
+ $content .= '<div class="mycred-level-reward">' . __('Reward:', 'mycred') . ' ' . $reward_type->format_creds($reward ) .'</div>';
2047
+ }
2048
 
2049
+ $content .= '</div>';
2050
+ }
 
 
 
 
2051
 
2052
+ $content .= '<div class="clear"></div>';
2053
+ }
2054
 
2055
+ if( $show_earners ) {
 
2056
 
2057
+ $users_have_badge = mycred_get_users_has_earned_badge( $badge_id );
 
2058
 
2059
+ $earned_count = count( $users_have_badge );
 
2060
 
2061
+ //If Earners exist
2062
+ if ( $earned_count > 0 )
2063
+ {
2064
+ $content .= "<h3>" . __("Earners", "mycred") . "</h3>";
2065
 
2066
+ $content .= '<div class="mycred-badge-earners">';
 
2067
 
 
2068
 
2069
+ foreach ( $users_have_badge as $user ) {
2070
 
2071
+ $user_id = $user;
 
 
 
 
 
2072
 
2073
+ $user_profile = get_avatar_url( $user_id );
 
 
 
 
 
 
 
2074
 
2075
+ $user_info = get_userdata( $user_id );
 
2076
 
2077
+ $display_name = $user_info->display_name;
2078
 
2079
+ $content .= '<div class="mycred-badge-earner-grid mycred-float-left">';
2080
+ $content .= '<div><img src="' . $user_profile . '" /></div>';
2081
+ $content .= "<h4>$display_name</h4>";
2082
+ $content .= '</div>';
 
 
2083
 
2084
+ }
2085
 
2086
+ $content .= '</div>';
2087
+ }
2088
+ }
2089
 
2090
+ $content .= '</div>';
 
 
 
 
 
 
2091
 
2092
+ return $content;
2093
+
2094
+ }
2095
 
2096
+ return $content;
2097
+
2098
+ }
2099
 
2100
+ public function flush_rewrite_rules_for_badges() {
2101
 
2102
+ global $pagenow;
 
 
 
 
 
2103
 
2104
+ if ( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] == 'mycred-addons' && isset( $_GET['badges'] ) && $_GET['badges'] == 'activate' ) {
 
 
 
 
 
 
 
2105
 
2106
+ flush_rewrite_rules();
2107
+
2108
+ }
2109
 
2110
+ }
2111
 
2112
+ }
2113
  endif;
2114
 
2115
  /**
2118
  * @version 1.0
2119
  */
2120
  if ( ! function_exists( 'mycred_load_badges_addon' ) ) :
2121
+ function mycred_load_badges_addon( $modules, $point_types ) {
2122
 
2123
+ $modules['solo']['badges'] = new myCRED_Badge_Module();
2124
+ $modules['solo']['badges']->load();
2125
 
2126
+ return $modules;
2127
 
2128
+ }
2129
  endif;
2130
+ add_filter( 'mycred_load_modules', 'mycred_load_badges_addon', 10, 2 );
addons/banking/services/mycred-service-central.php CHANGED
@@ -55,7 +55,7 @@ if ( ! class_exists( 'myCRED_Banking_Service_Central' ) ) :
55
  extract( $request );
56
 
57
  // Make sure that the request is not for our bank account
58
- if ( $user_id == $this->prefs['bank_id'] ) return $reply;
59
 
60
  // Get the banks balance
61
  $bank_balance = $mycred->get_users_balance( $this->prefs['bank_id'], $this->mycred_type );
55
  extract( $request );
56
 
57
  // Make sure that the request is not for our bank account
58
+ //if ( $user_id == $this->prefs['bank_id'] ) return $reply;
59
 
60
  // Get the banks balance
61
  $bank_balance = $mycred->get_users_balance( $this->prefs['bank_id'], $this->mycred_type );
addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php CHANGED
@@ -193,7 +193,7 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
193
 
194
  elseif ( ! empty( $this->buycred_limit['max'] ) && $this->amount > floatval( $this->buycred_limit['max'] ) ){
195
  $valid = false;
196
- $this->errors[] = sprintf( __( 'The amount must be less than %d.', 'mycred' ), $this->buycred_limit['max'] );
197
  }
198
 
199
  elseif ( $this->exceeds_limit() ){
193
 
194
  elseif ( ! empty( $this->buycred_limit['max'] ) && $this->amount > floatval( $this->buycred_limit['max'] ) ){
195
  $valid = false;
196
+ $this->errors[] = apply_filters( 'buycred_max_amount_error', sprintf( __( 'The amount must be less than %d.', 'mycred' ), $this->buycred_limit['max'] ), $this->buycred_limit['max'], $this );
197
  }
198
 
199
  elseif ( $this->exceeds_limit() ){
addons/cash-creds/gateways/bank-transfer.php CHANGED
@@ -225,7 +225,7 @@ if ( ! class_exists( 'myCRED_cashcred_Bank_Transfer' ) ) :
225
  */
226
  public function form_fields() {
227
 
228
- return array(
229
  'ac_name' => array(
230
  'type' => 'text',
231
  'lable' => 'Account name',
@@ -270,6 +270,8 @@ if ( ! class_exists( 'myCRED_cashcred_Bank_Transfer' ) ) :
270
  )
271
  );
272
 
 
 
273
  }
274
 
275
 
225
  */
226
  public function form_fields() {
227
 
228
+ $gateway_fields = array(
229
  'ac_name' => array(
230
  'type' => 'text',
231
  'lable' => 'Account name',
270
  )
271
  );
272
 
273
+ return apply_filters( 'mycred_cashcred_bank_transfer_fields', $gateway_fields );
274
+
275
  }
276
 
277
 
addons/cash-creds/includes/cashcred-shortcodes.php CHANGED
@@ -102,9 +102,11 @@ if ( ! function_exists( 'mycred_render_cashcred' ) ) :
102
  <?php endforeach;?>
103
  </tbody>
104
  </table>
105
- <?php } else {?>
 
 
106
 
107
- <div class="cashcred_gateway_notice"><?php _e( 'Selected gateway details are incomplete.', 'mycred' ) ?></div>
108
 
109
  <form method="post" class="mycred-cashcred-form" action="">
110
 
102
  <?php endforeach;?>
103
  </tbody>
104
  </table>
105
+ <?php } else {
106
+ $mycred_cashcred_gateway_notice = apply_filters( 'mycred_cashcred_gateway_notice', 'Selected gateway details are incomplete.' );
107
+ ?>
108
 
109
+ <div class="cashcred_gateway_notice"><?php _e( $mycred_cashcred_gateway_notice, 'mycred' ) ?></div>
110
 
111
  <form method="post" class="mycred-cashcred-form" action="">
112
 
addons/email-notices/includes/mycred-email-object.php CHANGED
@@ -361,6 +361,13 @@ if ( ! class_exists( 'myCRED_Email' ) ) :
361
 
362
  if ( ! empty( $content ) ) {
363
 
 
 
 
 
 
 
 
364
  $mycred = mycred( $point_type );
365
 
366
  if ( $this->emailnotices['use_html'] === true )
@@ -400,7 +407,10 @@ if ( ! class_exists( 'myCRED_Email' ) ) :
400
  $content = str_replace( '%blog_info%', get_option( 'blogdescription' ), $content );
401
  $content = str_replace( '%admin_email%', get_option( 'admin_email' ), $content );
402
 
403
- }
 
 
 
404
 
405
  return apply_filters( 'mycred_email_notice_get_body', $content, $this );
406
 
361
 
362
  if ( ! empty( $content ) ) {
363
 
364
+ if ( is_array( $event ) && array_key_exists( 'ref_id', $event ) )
365
+ {
366
+ $rank = mycred_get_rank( $event['ref_id'] );
367
+ $rank_title = $rank->title;
368
+ $content = str_replace( '%rank_title%', $rank_title, $content );
369
+ }
370
+
371
  $mycred = mycred( $point_type );
372
 
373
  if ( $this->emailnotices['use_html'] === true )
407
  $content = str_replace( '%blog_info%', get_option( 'blogdescription' ), $content );
408
  $content = str_replace( '%admin_email%', get_option( 'admin_email' ), $content );
409
 
410
+ $content = str_replace( '%rank_title%', get_option( 'blogname' ), $content );
411
+
412
+
413
+ }
414
 
415
  return apply_filters( 'mycred_email_notice_get_body', $content, $this );
416
 
addons/ranks/includes/mycred-rank-functions.php CHANGED
@@ -642,10 +642,10 @@ endif;
642
 
643
  /**
644
  * Rank Based on Total
645
- * Checks if ranks for a given point type are based on total or current
646
  * balance.
647
  * @since 1.6
648
- * @version 1.1
649
  */
650
  if ( ! function_exists( 'mycred_rank_based_on_total' ) ) :
651
  function mycred_rank_based_on_total( $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
@@ -661,6 +661,27 @@ if ( ! function_exists( 'mycred_rank_based_on_total' ) ) :
661
  }
662
  endif;
663
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
  /**
665
  * Rank Shown in BuddyPress
666
  * Returns either false or the location where the rank is to be shown in BuddyPress.
642
 
643
  /**
644
  * Rank Based on Total
645
+ * Checks if ranks for a given point type are based in total
646
  * balance.
647
  * @since 1.6
648
+ * @version 1.2
649
  */
650
  if ( ! function_exists( 'mycred_rank_based_on_total' ) ) :
651
  function mycred_rank_based_on_total( $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
661
  }
662
  endif;
663
 
664
+
665
+ /**
666
+ * Rank Based on Total
667
+ * Checks if ranks for a given point type are based on current balance.
668
+ * @since 2.1
669
+ * @version 1.0
670
+ */
671
+ if ( ! function_exists( 'mycred_rank_based_on_current' ) ) :
672
+ function mycred_rank_based_on_current( $point_type = MYCRED_DEFAULT_TYPE_KEY ) {
673
+
674
+ $prefs = mycred_get_addon_settings( 'rank', $point_type );
675
+
676
+ $result = false;
677
+ if ( ! empty( $prefs ) && $prefs['base'] == 'current' )
678
+ $result = true;
679
+
680
+ return $result;
681
+
682
+ }
683
+ endif;
684
+
685
  /**
686
  * Rank Shown in BuddyPress
687
  * Returns either false or the location where the rank is to be shown in BuddyPress.
addons/ranks/myCRED-addon-ranks.php CHANGED
@@ -98,7 +98,7 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
98
  /**
99
  * Hook into Init
100
  * @since 1.4.4
101
- * @version 1.0.1
102
  */
103
  public function module_pre_init() {
104
 
@@ -107,6 +107,7 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
107
  add_filter( 'mycred_post_type_excludes', array( $this, 'exclude_ranks' ) );
108
  add_filter( 'mycred_add_finished', array( $this, 'balance_adjustment' ), 20, 3 );
109
  add_action( 'mycred_zero_balances', array( $this, 'zero_balance_action' ) );
 
110
 
111
  }
112
 
@@ -642,6 +643,26 @@ if ( ! class_exists( 'myCRED_Ranks_Module' ) ) :
642
 
643
  }
644
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
645
  /**
646
  * User Related Template Tags
647
  * Adds support for ranks of custom point types.
98
  /**
99
  * Hook into Init
100
  * @since 1.4.4
101
+ * @version 1.0.2
102
  */
103
  public function module_pre_init() {
104
 
107
  add_filter( 'mycred_post_type_excludes', array( $this, 'exclude_ranks' ) );
108
  add_filter( 'mycred_add_finished', array( $this, 'balance_adjustment' ), 20, 3 );
109
  add_action( 'mycred_zero_balances', array( $this, 'zero_balance_action' ) );
110
+ add_action( 'mycred_finish_without_log_entry', array( $this, 'balance_adjustment_without_log' ) );
111
 
112
  }
113
 
643
 
644
  }
645
 
646
+ /**
647
+ * Manual Balance Adjustment
648
+ * Checks if User's rank should be change.
649
+ * @param $result
650
+ * @since 2.1
651
+ * @version 1.0
652
+ */
653
+ public function balance_adjustment_without_log( $result )
654
+ {
655
+ extract( $result );
656
+
657
+ if( mycred_rank_based_on_current( $type ) )
658
+ {
659
+ $rank = mycred_find_users_rank( $user_id, $type );
660
+
661
+ if ( isset( $rank->rank_id ) && $rank->rank_id !== $rank->current_id )
662
+ mycred_save_users_rank( $user_id, $rank->rank_id, $type );
663
+ }
664
+ }
665
+
666
  /**
667
  * User Related Template Tags
668
  * Adds support for ranks of custom point types.
addons/sell-content/myCRED-addon-sell-content.php CHANGED
@@ -194,7 +194,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
194
 
195
  if ( is_user_logged_in() && ! mycred_is_admin() ) {
196
 
197
- if ( isset( $_POST['action'] ) && $_POST['action'] == 'mycred-buy-content' && isset( $_POST['postid'] ) && isset( $_POST['token'] ) && wp_verify_nonce( $_POST['token'], 'mycred-buy-this-content' ) ) {
198
 
199
  $post_id = absint( $_POST['postid'] );
200
  $point_type = sanitize_key( $_POST['ctype'] );
@@ -299,7 +299,7 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
299
  $payment_options = mycred_sell_content_payment_buttons( $this->current_user_id, $post_id );
300
 
301
  // User can buy
302
- if ( $payment_options !== false ) {
303
 
304
  $content = $this->sell_content['templates']['members'];
305
  $content = str_replace( '%buy_button%', $payment_options, $content );
@@ -342,16 +342,22 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
342
  global $mycred_partial_content_sale, $mycred_sell_this;
343
 
344
  $post_id = mycred_sell_content_post_id();
 
 
345
  $post = mycred_get_post( $post_id );
 
346
  $content = '';
347
 
 
 
348
  // If content is for sale
349
  if ( mycred_post_is_for_sale( $post_id ) && ( bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_single_reply() ) ) {
350
 
351
  $mycred_sell_this = true;
352
 
 
353
  // Partial Content Sale - We have already done the work in the shortcode
354
- if ( $mycred_partial_content_sale === true ) return;
355
 
356
  // Logged in users
357
  if ( is_user_logged_in() ) {
@@ -369,8 +375,10 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
369
  if ( $payment_options !== false ) {
370
 
371
  $content = $this->sell_content['templates']['members'];
 
372
  $content = str_replace( '%buy_button%', $payment_options, $content );
373
  $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-unpaid' );
 
374
  $this->mycred_bbp_sell_forum_actions();
375
 
376
  }
@@ -395,6 +403,8 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
395
 
396
  $content = $this->sell_content['templates']['visitors'];
397
  $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-visitor' );
 
 
398
  $this->mycred_bbp_sell_forum_actions();
399
 
400
  }
@@ -406,11 +416,14 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
406
  }
407
 
408
 
 
 
409
  public function mycred_bbp_sell_forum_actions() {
410
 
411
  add_action( 'bbp_template_before_single_forum', array( $this, 'bbp_template_before_single' ) );
412
  add_action( 'bbp_template_before_single_topic', array( $this, 'bbp_template_before_single' ) );
413
  add_filter( 'bbp_no_breadcrumb', array( $this, 'bbp_remove_breadcrumb' ), 10 );
 
414
  add_filter( 'bbp_get_forum_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
415
  add_filter( 'bbp_get_topic_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
416
  add_filter( 'bbp_get_topic_favorite_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
@@ -430,6 +443,20 @@ if ( ! class_exists( 'myCRED_Sell_Content_Module' ) ) :
430
  return true;
431
  }
432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
433
  public function bbp_remove_subscribe_link( $retval, $r, $args ) {
434
  return '';
435
  }
194
 
195
  if ( is_user_logged_in() && ! mycred_is_admin() ) {
196
 
197
+ if ( isset( $_POST['action'] ) && $_POST['action'] == 'mycred-buy-content' && isset( $_POST['postid'] ) && isset( $_POST['token'] ) && wp_verify_nonce( $_POST['token'], 'mycred-buy-this-content' ) ) {
198
 
199
  $post_id = absint( $_POST['postid'] );
200
  $point_type = sanitize_key( $_POST['ctype'] );
299
  $payment_options = mycred_sell_content_payment_buttons( $this->current_user_id, $post_id );
300
 
301
  // User can buy
302
+ if ( $payment_options !== false ) {
303
 
304
  $content = $this->sell_content['templates']['members'];
305
  $content = str_replace( '%buy_button%', $payment_options, $content );
342
  global $mycred_partial_content_sale, $mycred_sell_this;
343
 
344
  $post_id = mycred_sell_content_post_id();
345
+
346
+
347
  $post = mycred_get_post( $post_id );
348
+
349
  $content = '';
350
 
351
+
352
+
353
  // If content is for sale
354
  if ( mycred_post_is_for_sale( $post_id ) && ( bbp_is_single_forum() || bbp_is_single_topic() || bbp_is_single_reply() ) ) {
355
 
356
  $mycred_sell_this = true;
357
 
358
+
359
  // Partial Content Sale - We have already done the work in the shortcode
360
+ if ( $mycred_partial_content_sale === true ) return;
361
 
362
  // Logged in users
363
  if ( is_user_logged_in() ) {
375
  if ( $payment_options !== false ) {
376
 
377
  $content = $this->sell_content['templates']['members'];
378
+
379
  $content = str_replace( '%buy_button%', $payment_options, $content );
380
  $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-unpaid' );
381
+
382
  $this->mycred_bbp_sell_forum_actions();
383
 
384
  }
403
 
404
  $content = $this->sell_content['templates']['visitors'];
405
  $content = mycred_sell_content_template( $content, $post, 'mycred-sell-entire-content', 'mycred-sell-visitor' );
406
+
407
+
408
  $this->mycred_bbp_sell_forum_actions();
409
 
410
  }
416
  }
417
 
418
 
419
+
420
+
421
  public function mycred_bbp_sell_forum_actions() {
422
 
423
  add_action( 'bbp_template_before_single_forum', array( $this, 'bbp_template_before_single' ) );
424
  add_action( 'bbp_template_before_single_topic', array( $this, 'bbp_template_before_single' ) );
425
  add_filter( 'bbp_no_breadcrumb', array( $this, 'bbp_remove_breadcrumb' ), 10 );
426
+ add_filter( 'bbp_is_single_topic', array( $this, 'bbp_is_topic' ), 10 );
427
  add_filter( 'bbp_get_forum_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
428
  add_filter( 'bbp_get_topic_subscribe_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
429
  add_filter( 'bbp_get_topic_favorite_link', array( $this, 'bbp_remove_subscribe_link' ), 10 , 3 );
443
  return true;
444
  }
445
 
446
+ public function bbp_is_topic( $post_id = 0 ) {
447
+
448
+ // Assume false
449
+ $retval = false;
450
+
451
+ // Supplied ID is a topic
452
+ if ( ! empty( $post_id ) && ( bbp_get_topic_post_type() === get_post_type( $post_id ) ) ) {
453
+ $retval = true;
454
+ }
455
+
456
+ // Filter & return
457
+ return (bool) apply_filters( 'bbp_is_topic', $retval, $post_id );
458
+ }
459
+
460
  public function bbp_remove_subscribe_link( $retval, $r, $args ) {
461
  return '';
462
  }
addons/transfer/includes/mycred-transfer-object.php CHANGED
@@ -162,8 +162,9 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
162
  'button' => __( 'Transfer', 'mycred' )
163
  ),
164
  'autofill' => 'user_login',
165
- 'reload' => 1,
166
- 'message' => 0,
 
167
  'limit' => array(
168
  'amount' => 0,
169
  'limit' => 'none'
@@ -238,6 +239,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
238
 
239
  $transfer->data = maybe_unserialize( $log_entries[0]->data );
240
  $transfer->message = ( array_key_exists( 'message', $transfer->data ) && ! empty( $transfer->data['message'] ) ) ? $transfer->data['message'] : '';
 
241
 
242
  }
243
 
@@ -382,7 +384,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
382
  // Enforce minimum requirements
383
  if ( ! $this->user_can_transfer_minimum() ) {
384
 
385
- $this->errors['minimum'] = 'You do not have enough points to make a transfer.';
386
 
387
  return false;
388
 
@@ -583,8 +585,11 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
583
  'user_id' => 'current',
584
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
585
  'amount' => NULL,
 
586
  'reference' => 'transfer',
587
- 'message' => isset( $posted['message'] ) ? $posted['message'] : ''
 
 
588
  ), $posted ), $request );
589
 
590
  // Security
@@ -631,6 +636,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
631
 
632
  // Amount can not be zero
633
  $amount = $mycred->number( abs( $this->request['amount'] ) );
 
634
  if ( $amount < $mycred->get_lowest_value() )
635
  return 'error_5';
636
 
@@ -665,11 +671,16 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
665
  $this->message = $message;
666
  }
667
 
 
 
 
 
668
  $this->transfer_id = $this->generate_new_transfer_id( $this->sender_id, $this->recipient_id );
669
  $this->data = apply_filters( 'mycred_transfer_data', array(
670
  'ref_type' => 'user',
671
  'tid' => $this->transfer_id,
672
- 'message' => $this->message
 
673
  ), $this->transfer_id, $this->request, $this->settings );
674
 
675
  // Prevent Duplicate transactions
@@ -819,6 +830,9 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
819
  'show_limit' => 0,
820
  'show_message' => 1,
821
  'placeholder' => '',
 
 
 
822
  'recipient_label' => __( 'Recipient', 'mycred' ),
823
  'amount_label' => __( 'Amount', 'mycred' ),
824
  'balance_label' => __( 'Balance', 'mycred' ),
@@ -884,6 +898,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
884
 
885
  // If recipient is set, pre-populate it with the recipients details
886
  $recipients = array();
 
887
  if ( $this->recipient_id !== false ) {
888
 
889
  if ( is_array( $this->recipient_id ) ) {
@@ -893,6 +908,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
893
  $user = get_userdata( $user_id );
894
  if ( ! isset( $user->ID ) ) continue;
895
  $recipients[ $user_id ] = $user;
 
896
 
897
  }
898
 
@@ -909,12 +925,16 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
909
  }
910
 
911
  $placeholder = $this->args['placeholder'];
 
 
 
912
 
913
  if ( $this->args['placeholder'] == '' ) {
914
 
915
- if ( $this->settings['autofill'] == 'user_login' )
916
  $placeholder = __( 'username', 'mycred' );
917
-
 
918
  elseif ( $this->settings['autofill'] == 'user_email' )
919
  $placeholder = __( 'email', 'mycred' );
920
 
@@ -922,16 +942,18 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
922
 
923
  }
924
 
 
 
925
  $field = '<div class="form-group select-recipient-wrapper">';
926
- if ( $this->args['recipient_label'] != '' ) $field .= '<label>' . esc_html( $this->args['recipient_label'] ) . '</label>';
927
 
928
  // No recipient, one needs to be nominated
929
  if ( count( $recipients ) < 1 ) {
930
- $field .= '<input type="text" name="mycred_new_transfer[recipient_id]" value="" aria-required="true" class="mycred-autofill form-control" data-form="' . esc_attr( $this->reference ) . '" placeholder="' . $placeholder . '" />';
931
  }
932
 
933
  // One specific recipient is set
934
- elseif ( count( $recipients ) == 1 ) {
935
 
936
  $first_user = $recipients;
937
  $fist_user = reset( $first_user );
@@ -941,7 +963,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
941
  if ( isset( $fist_user->$autofill ) )
942
  $value = $fist_user->$autofill;
943
 
944
- $field .= '<p class="form-control-static">' . $value . '</p><input type="hidden" name="mycred_new_transfer[recipient_id]" value="' . esc_attr( $fist_user->ID ) . '" />';
945
 
946
  }
947
 
@@ -1022,13 +1044,17 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
1022
  $balance = $this->balances[ $type_id ];
1023
  $point_type = $balance->point_type;
1024
 
 
 
 
 
1025
  $field = '<div class="form-group select-amount-wrapper">';
1026
- if ( $this->args['amount_label'] != '' ) $field .= '<label>' . esc_html( $this->args['amount_label'] ) . '</label>';
1027
 
1028
  // User needs to nominate the amount
1029
- if ( ! is_array( $this->transfer_amount ) && $this->transfer_amount == 0 )
1030
- $field .= '<input type="text" name="mycred_new_transfer[amount]" placeholder="' . esc_attr( $balance->minimum ) . '" class="form-control" value="' . esc_attr( $balance->minimum ) . '" />';
1031
-
1032
  // Multiple amounts to pick from
1033
  elseif ( is_array( $this->transfer_amount ) && count( $this->transfer_amount ) > 1 ) {
1034
 
@@ -1045,7 +1071,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
1045
  else {
1046
 
1047
  $field .= '<input type="hidden" name="mycred_new_transfer[amount]" value="' . esc_attr( $this->transfer_amount ) . '" />';
1048
- $field .= '<p class="form-control-static">' . esc_attr( $this->transfer_amount ) . '</p>';
1049
 
1050
  }
1051
 
@@ -1097,6 +1123,8 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
1097
  */
1098
  public function get_transfer_message_field( $return = false ) {
1099
 
 
 
1100
  $field = '';
1101
 
1102
  if ( (bool) $this->args['show_message'] && $this->settings['message'] > 0 ) {
@@ -1104,12 +1132,14 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
1104
  $field = '<div class="form-group message-wrapper">';
1105
  if ( $this->args['message_label'] != '' ) $field .= '<label>' . esc_html( $this->args['message_label'] ) . '</label>';
1106
 
1107
- $field .= '<input type="text" class="form-control" name="message" value="" />';
1108
 
1109
  $field .= '</div>';
1110
 
1111
  }
1112
 
 
 
1113
  $field = apply_filters( 'mycred_transfer_form_message', $field, $this->args, $this->settings );
1114
 
1115
  if ( $field != '' )
@@ -1220,3 +1250,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
1220
 
1221
  }
1222
  endif;
 
 
 
 
162
  'button' => __( 'Transfer', 'mycred' )
163
  ),
164
  'autofill' => 'user_login',
165
+ 'placeholder' => '',
166
+ 'message' => 0,
167
+ 'reload' => 1,
168
  'limit' => array(
169
  'amount' => 0,
170
  'limit' => 'none'
239
 
240
  $transfer->data = maybe_unserialize( $log_entries[0]->data );
241
  $transfer->message = ( array_key_exists( 'message', $transfer->data ) && ! empty( $transfer->data['message'] ) ) ? $transfer->data['message'] : '';
242
+
243
 
244
  }
245
 
384
  // Enforce minimum requirements
385
  if ( ! $this->user_can_transfer_minimum() ) {
386
 
387
+ $this->errors['minimum'] = __('You do not have enough points to make a transfer.','mycred');
388
 
389
  return false;
390
 
585
  'user_id' => 'current',
586
  'ctype' => MYCRED_DEFAULT_TYPE_KEY,
587
  'amount' => NULL,
588
+ 'amount_placeholder' => NULL,
589
  'reference' => 'transfer',
590
+ 'message' => isset( $posted['message'] ) ? $posted['message'] : '',
591
+ // 'message_placeholder' => isset( $posted['message_placeholder'] ) ? $posted['message_placeholder'] : ''
592
+
593
  ), $posted ), $request );
594
 
595
  // Security
636
 
637
  // Amount can not be zero
638
  $amount = $mycred->number( abs( $this->request['amount'] ) );
639
+
640
  if ( $amount < $mycred->get_lowest_value() )
641
  return 'error_5';
642
 
671
  $this->message = $message;
672
  }
673
 
674
+
675
+
676
+
677
+
678
  $this->transfer_id = $this->generate_new_transfer_id( $this->sender_id, $this->recipient_id );
679
  $this->data = apply_filters( 'mycred_transfer_data', array(
680
  'ref_type' => 'user',
681
  'tid' => $this->transfer_id,
682
+ 'message' => $this->message,
683
+ // 'message_placeholder' => $this->message_placeholder
684
  ), $this->transfer_id, $this->request, $this->settings );
685
 
686
  // Prevent Duplicate transactions
830
  'show_limit' => 0,
831
  'show_message' => 1,
832
  'placeholder' => '',
833
+ 'amount_placeholder' => '',
834
+ 'message_placeholder' => '',
835
+ 'recipient_placeholder' => '',
836
  'recipient_label' => __( 'Recipient', 'mycred' ),
837
  'amount_label' => __( 'Amount', 'mycred' ),
838
  'balance_label' => __( 'Balance', 'mycred' ),
898
 
899
  // If recipient is set, pre-populate it with the recipients details
900
  $recipients = array();
901
+
902
  if ( $this->recipient_id !== false ) {
903
 
904
  if ( is_array( $this->recipient_id ) ) {
908
  $user = get_userdata( $user_id );
909
  if ( ! isset( $user->ID ) ) continue;
910
  $recipients[ $user_id ] = $user;
911
+ $recipients[ $user_id ] = $user;
912
 
913
  }
914
 
925
  }
926
 
927
  $placeholder = $this->args['placeholder'];
928
+
929
+ $recipient_placeholder = $this->args['recipient_placeholder'];
930
+
931
 
932
  if ( $this->args['placeholder'] == '' ) {
933
 
934
+ if ( $this->settings['autofill'] == 'user_login' ) {
935
  $placeholder = __( 'username', 'mycred' );
936
+
937
+ }
938
  elseif ( $this->settings['autofill'] == 'user_email' )
939
  $placeholder = __( 'email', 'mycred' );
940
 
942
 
943
  }
944
 
945
+
946
+
947
  $field = '<div class="form-group select-recipient-wrapper">';
948
+ if ( $this->args['recipient_label'] != '' ) $field .= '<label class="recipient-label">' . esc_html( $this->args['recipient_label'] ) . '</label>';
949
 
950
  // No recipient, one needs to be nominated
951
  if ( count( $recipients ) < 1 ) {
952
+ $field .= '<input type="text" name="mycred_new_transfer[recipient_id]" value="" aria-required="true" class="mycred-autofill form-control" data-form="' . esc_attr( $this->reference ) . '" placeholder="' . $recipient_placeholder . '" />';
953
  }
954
 
955
  // One specific recipient is set
956
+ elseif ( count( $recipients ) == 1 ) {
957
 
958
  $first_user = $recipients;
959
  $fist_user = reset( $first_user );
963
  if ( isset( $fist_user->$autofill ) )
964
  $value = $fist_user->$autofill;
965
 
966
+ $field .= '<span class="form-control-static">' . $value . '</span><input type="hidden" name="mycred_new_transfer[recipient_id]" value="' . esc_attr( $fist_user->ID ) . '" />';
967
 
968
  }
969
 
1044
  $balance = $this->balances[ $type_id ];
1045
  $point_type = $balance->point_type;
1046
 
1047
+
1048
+
1049
+
1050
+
1051
  $field = '<div class="form-group select-amount-wrapper">';
1052
+ if ( $this->args['amount_label'] != '' ) $field .= '<label class="amount-label">' . esc_html( $this->args['amount_label'] ) . '</label>';
1053
 
1054
  // User needs to nominate the amount
1055
+ if ( ! is_array( $this->transfer_amount ) && $this->transfer_amount == 0 ){
1056
+ $field .= '<input type="text" name="mycred_new_transfer[amount]" placeholder="' . esc_html( $this->args['amount_placeholder'] ) . '" class="form-control" value="" />';
1057
+ }
1058
  // Multiple amounts to pick from
1059
  elseif ( is_array( $this->transfer_amount ) && count( $this->transfer_amount ) > 1 ) {
1060
 
1071
  else {
1072
 
1073
  $field .= '<input type="hidden" name="mycred_new_transfer[amount]" value="' . esc_attr( $this->transfer_amount ) . '" />';
1074
+ $field .= '<span class="form-control-static" id="mycred-transfer-form-amount-field">' . esc_attr( $this->transfer_amount ) . '</span>';
1075
 
1076
  }
1077
 
1123
  */
1124
  public function get_transfer_message_field( $return = false ) {
1125
 
1126
+ $message = array();
1127
+
1128
  $field = '';
1129
 
1130
  if ( (bool) $this->args['show_message'] && $this->settings['message'] > 0 ) {
1132
  $field = '<div class="form-group message-wrapper">';
1133
  if ( $this->args['message_label'] != '' ) $field .= '<label>' . esc_html( $this->args['message_label'] ) . '</label>';
1134
 
1135
+ $field .= '<input type="text" class="form-control" id="mycred-transfer-form-message-field" name="message" value="" placeholder="' . esc_html( $this->args['message_placeholder'] ) . '" />';
1136
 
1137
  $field .= '</div>';
1138
 
1139
  }
1140
 
1141
+
1142
+
1143
  $field = apply_filters( 'mycred_transfer_form_message', $field, $this->args, $this->settings );
1144
 
1145
  if ( $field != '' )
1250
 
1251
  }
1252
  endif;
1253
+
1254
+
1255
+
1256
+
addons/transfer/includes/mycred-transfer-shortcodes.php CHANGED
@@ -22,8 +22,11 @@ if ( ! function_exists( 'mycred_transfer_render' ) ) :
22
  'show_limit' => 0,
23
  'ref' => 'transfer',
24
  'amount' => '',
 
25
  'min' => 0,
26
  'placeholder' => '',
 
 
27
  'types' => '',
28
  'excluded' => '',
29
  'recipient_label' => __( 'Recipient', 'mycred' ),
@@ -55,7 +58,8 @@ if ( ! function_exists( 'mycred_transfer_render' ) ) :
55
  'minimum' => $atts['min'],
56
  'amount' => $atts['amount'],
57
  'recipient' => $atts['pay_to'],
58
- 'point_types' => $atts['types']
 
59
  ) ) ) {
60
 
61
  // We meet the minimum requirements! Yay, now let the get_transfer_form() function render our form
22
  'show_limit' => 0,
23
  'ref' => 'transfer',
24
  'amount' => '',
25
+ 'amount_placeholder' => '',
26
  'min' => 0,
27
  'placeholder' => '',
28
+ 'message_placeholder' => '',
29
+ 'recipient_placeholder' => '',
30
  'types' => '',
31
  'excluded' => '',
32
  'recipient_label' => __( 'Recipient', 'mycred' ),
58
  'minimum' => $atts['min'],
59
  'amount' => $atts['amount'],
60
  'recipient' => $atts['pay_to'],
61
+ 'point_types' => $atts['types'],
62
+
63
  ) ) ) {
64
 
65
  // We meet the minimum requirements! Yay, now let the get_transfer_form() function render our form
addons/transfer/myCRED-addon-transfer.php CHANGED
@@ -224,6 +224,8 @@ if ( ! class_exists( 'myCRED_Transfer_Module' ) ) :
224
 
225
  }
226
 
 
 
227
  wp_send_json( $results );
228
 
229
  }
224
 
225
  }
226
 
227
+ $results = apply_filters( 'mycred_transfer_users_list' , $results, $user_id, $this->transfer['autofill'] );
228
+
229
  wp_send_json( $results );
230
 
231
  }
assets/css/mycred-admin.css CHANGED
@@ -185,4 +185,9 @@ body.version-3-8 #myCRED-wrap #accordion .ui-accordion-content { border-top: 1px
185
  .mycred-export-points .ui-button:focus, .mycred-export-points .ui-button:active { outline: none !important; }
186
  .mycred-export-points .ui-button .ui-button-text { display: block; text-indent: 0; }
187
  .mycred-export-points .ui-dialog-title { font-size: 22px; font-weight: 600; margin: 0 0 0 0; width: auto !important; float: none !important; }
188
- .mycred-export-points .form-control { width: 100%; margin-bottom: 6px; }
 
 
 
 
 
185
  .mycred-export-points .ui-button:focus, .mycred-export-points .ui-button:active { outline: none !important; }
186
  .mycred-export-points .ui-button .ui-button-text { display: block; text-indent: 0; }
187
  .mycred-export-points .ui-dialog-title { font-size: 22px; font-weight: 600; margin: 0 0 0 0; width: auto !important; float: none !important; }
188
+ .mycred-export-points .form-control { width: 100%; margin-bottom: 6px; }
189
+ .mycred-switch-all-badges-icon{ vertical-align: middle; display: none; }
190
+ .mycred-switch-all-badges-icon { -webkit-animation: spin 2s linear infinite; /* Safari */animation: spin 2s linear infinite;}
191
+ /* Safari */
192
+ @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } }
193
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
assets/css/mycred-front.css CHANGED
@@ -1 +1 @@
1
- .widget .myCRED-rank { float:right; }.widget .myCRED-rank span { padding-right:4px; color:gray; }.widget .myCRED-balance { display:block; margin-bottom:24px; text-align:center; font-size:larger; }.widget .myCRED-leaderboard .cred { float:right; }.widget .myCRED-leaderboard .first-item { font-size:110%; }.widget .myCRED-history { padding:0; margin:0; list-style-type:none; }.widget .myCRED-history .creds { float:right; padding: 0; clear:left; }.mycred-nav-rank img{display: inherit;}
1
+ .widget .myCRED-rank{float:right}.widget .myCRED-rank span{padding-right:4px;color:gray}.widget .myCRED-balance{display:block;margin-bottom:24px;text-align:center;font-size:larger}.widget .myCRED-leaderboard .cred{float:right}.widget .myCRED-leaderboard .first-item{font-size:110%}.widget .myCRED-history{padding:0;margin:0;list-style-type:none}.widget .myCRED-history .creds{float:right;padding:0;clear:left}.mycred-nav-rank img{display:inherit}input.mycred-submit-transfer.btn.btn-primary.btn-block.btn-lg{margin:20px 0}input.mycred-autofill.form-control.ui-autocomplete-input{margin-left:20px}input.form-control{margin-left:28px;margin-top:10px}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0 0;outline-offset:-6px;outline:2px solid currentColor}.site textarea:focus,input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{color:var(--form--color-text);outline-offset:2px;outline:0}.site .button:focus,.wp-block-button .wp-block-button__link:focus,.wp-block-search__button:focus,input[type=reset]:focus,input[type=submit]:focus{background:0 0;outline-offset:-6px;outline:0}span.form-control-static{text-transform:capitalize;font-weight:400;margin-left:20px}p.form-control-static{margin:0 16px}form#mycred-transfer-form-transfer{background:#f9f9f9;padding:25px;margin:150px 0;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}form#mycred-transfer-form-donation{background:#f9f9f9;padding:25px;margin:150px 0;box-shadow:0 0 20px 0 rgb(0 0 0 / 20%),0 5px 5px 0 rgb(0 0 0 / 24%);border-radius:10px}input#mycred-transfer-form-message-field{margin-left:24px}span#mycred-transfer-form-amount-field{margin-left: 28px;}.mycred-badges-list-item img{width: 25%;display: inline-block;float:left;} /*myCRED Badges*/ .mycred-badges-list-item h3{color: red;}.mycred-badges-list-item .mycred-left{float: left; width : 72%;margin-left: 15px;}.mycred-badges-list-item .clear{clear : both}.mycred-badges-list-item .mycred-mr-l{margin-left: 25px;}.mycred-badges-list-item { border-top: 0px solid #9c9c9c;min-height: 180px;padding: 15px 0;cursor: pointer;} .mycred-badges-list-item ~ .mycred-badges-list-item { border-top-width: 1px; } .mycred-badges-list h3:first-child {margin-bottom: 15px;margin-top:0px;}.mycred-badges-list-item.not-earned {filter: grayscale(1);}.mycred-tabset .mycred-badge-count {color: #ffffff;font-size: 18px;background: #0173aa;border-radius: 50%;padding: 0px 7px;}.mycred-badges-list-item .mycred-sup-category {background: #0173aa;color: #fff;margin: 0 3px;padding: 2px 6px;font-size: 14px;border-radius: 4px;} /*myCRED Badges Tabs*/ .mycred-tabset>input[type=radio]{position:absolute;left:-200vw}.mycred-tabset .mycred-tab-panel{display:none}.mycred-tabset>input:first-child:checked~.mycred-tab-panels>.mycred-tab-panel:first-child,.mycred-tabset>input:nth-child(11):checked~.mycred-tab-panels>.mycred-tab-panel:nth-child(6),.mycred-tabset>input:nth-child(3):checked~.mycred-tab-panels>.mycred-tab-panel:nth-child(2),.mycred-tabset>input:nth-child(5):checked~.mycred-tab-panels>.mycred-tab-panel:nth-child(3),.mycred-tabset>input:nth-child(7):checked~.mycred-tab-panels>.mycred-tab-panel:nth-child(4),.mycred-tabset>input:nth-child(9):checked~.mycred-tab-panels>.mycred-tab-panel:nth-child(5){display:block}.mycred-tabset>label{position:relative;display:inline-block;padding:15px 15px 25px;border:1px solid transparent;border-bottom:0;cursor:pointer;font-weight:600}.mycred-tabset>label::after{content:"";position:absolute;left:15px;bottom:10px;width:22px;height:4px;background:#8d8d8d}.mycred-tabset>input:focus+label,.mycred-tabset>label:hover{color:#0173aa}.mycred-tabset>input:checked+label::after,.mycred-tabset>input:focus+label::after,.mycred-tabset>label:hover::after{background:#0173aa}.mycred-tabset>input:checked+label{border-color:#ccc;border-bottom:1px solid #fff;margin-bottom:-1px}.mycred-tab-panel{padding:30px 0;border-top:1px solid #ccc}.mycred-tabset{max-width:65em}.mycred-badge-page .mycred-level-image {width: 150px;}.mycred-badge-page .mycred-badge-page-level {float: left;width: 30%;text-align: center;}.mycred-badge-page .mycred-level-requirement {font-size: 19px; text-align: left;}.mycred-badge-image {width: 150px;}.mycred-badge-page-level .mycred-level-image {width: 70px;}.mycred-float-left{ float: left; }.mycred-float-right{ float: right; }.mycred-badge-earner-grid img{width: 150px; height: 150px; padding: 10px;}.mycred-badge-earner-grid h4{margin: 0;}.mycred-badge-earner-grid{text-align: center;}.mycred-badges-list-item p{margin-top:0px }.mycred-left{float:left}.mycred-right{ float: right }.mycred-clear{ clear : both; }.mycred-remove-margin{ margin : 0px; }.mycred-remove-padding{ padding: 0px; }.mycred-evidence-page .intro{ margin-left: 45px; }.mycred-evidence-page p{ font-size: 19px;margin: 0; }.mycred-evidence-page a{ text-decoration: none; color: red; }.mycred-evidence-page .dashicons-yes-alt{ line-height: inherit; color : green; }.mycred-badge-page-level ul { margin-left: 0px;padding-left: 20px; }.mycred-badge-page-level .mycred-level-reward { text-align: left; }.mycred-level-reward{margin-bottom: 15px;}.mycred-badge-page-level{margin-right: 15px;}.mycred-badges-list-item:hover{background: #efefef;}.mycred-badge-congratulation-msg {background: #f0f0f0;padding: 25px 10px;margin: 20px 0px;border-radius: 5px;}li.mycred-strike-off {text-decoration: line-through;}
assets/css/tourguide.css ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .shepherd-element {
2
+ background: #fff;
3
+ border-radius: 5px;
4
+ box-shadow:2px 5px 8px 9px rgb(0 0 0 / 20%);
5
+ max-width: 400px;
6
+ opacity: 0;
7
+ outline: none;
8
+ transition: opacity 0.3s, visibility 0.3s;
9
+ visibility: hidden;
10
+ width: 100%;
11
+ z-index: 9999;
12
+ }
13
+ .shepherd-enabled.shepherd-element {
14
+ opacity: 1;
15
+ visibility: visible;
16
+ }
17
+ .shepherd-element[data-popper-reference-hidden]:not(.shepherd-centered) {
18
+ opacity: 0;
19
+ pointer-events: none;
20
+ visibility: hidden;
21
+ }
22
+ .shepherd-element,
23
+ .shepherd-element *,
24
+ .shepherd-element :after,
25
+ .shepherd-element :before {
26
+ box-sizing: border-box;
27
+ }
28
+ .shepherd-arrow,
29
+ .shepherd-arrow:before {
30
+ position: absolute;
31
+ width: 30px;
32
+ height: 30px;
33
+ z-index: -1;
34
+ }
35
+ .shepherd-arrow:before {
36
+ content: "";
37
+ transform: rotate(45deg);
38
+ background: #fff;
39
+ }
40
+ .shepherd-element[data-popper-placement^="top"] > .shepherd-arrow {
41
+ bottom: -10px;
42
+ }
43
+ .shepherd-element[data-popper-placement^="bottom"] > .shepherd-arrow {
44
+ top: -10px;
45
+ }
46
+ .shepherd-element[data-popper-placement^="left"] > .shepherd-arrow {
47
+ right: -10px;
48
+ }
49
+ .shepherd-element[data-popper-placement^="right"] > .shepherd-arrow {
50
+ left: -10px;
51
+ }
52
+ .shepherd-element.shepherd-centered > .shepherd-arrow {
53
+ opacity: 0;
54
+ }
55
+ .shepherd-element.shepherd-has-title[data-popper-placement^="bottom"] > .shepherd-arrow:before {
56
+ background-color: #9852f1;
57
+ }
58
+
59
+ .shepherd-target-click-disabled.shepherd-enabled.shepherd-target,
60
+ .shepherd-target-click-disabled.shepherd-enabled.shepherd-target * {
61
+ pointer-events: none;
62
+ }
63
+ .shepherd-modal-overlay-container {
64
+ -ms-filter: progid:dximagetransform.microsoft.gradient.alpha(Opacity=50);
65
+ filter: alpha(opacity=50);
66
+ height: 0;
67
+ left: 0;
68
+ opacity: 0;
69
+ overflow: hidden;
70
+ pointer-events: none;
71
+ position: fixed;
72
+ top: 0;
73
+ transition: all 0.3s ease-out, height 0ms 0.3s, opacity 0.3s 0ms;
74
+ width: 100vw;
75
+ z-index: 9997;
76
+ }
77
+ .shepherd-modal-overlay-container.shepherd-modal-is-visible {
78
+ height: 100vh;
79
+ opacity: 0.5;
80
+ transition: all 0.3s ease-out, height 0s 0s, opacity 0.3s 0s;
81
+ }
82
+ .shepherd-modal-overlay-container.shepherd-modal-is-visible path {
83
+ pointer-events: all;
84
+ }
85
+ .shepherd-content {
86
+ border-radius: 5px;
87
+ outline: none;
88
+ padding: 0;
89
+ }
90
+ .shepherd-header {
91
+ align-items: center;
92
+ border-top-left-radius: 5px;
93
+ border-top-right-radius: 5px;
94
+ display: flex;
95
+ justify-content: flex-end;
96
+ line-height: 2em;
97
+ padding: 0.75rem 0.75rem 0;
98
+ }
99
+ .shepherd-has-title .shepherd-content .shepherd-header {
100
+ background: #9852f1;
101
+ padding: 1em;
102
+ }
103
+ .shepherd-text {
104
+ color: black;
105
+ font-size: 13px;
106
+ line-height: 1.3em;
107
+ padding: 0.75em;
108
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
109
+ padding: 20px;
110
+ }
111
+ .shepherd-text p {
112
+ margin-top: 0;
113
+ }
114
+ .shepherd-text p:last-child {
115
+ margin-bottom: 0;
116
+ }
117
+ .shepherd-footer {
118
+ border-bottom-left-radius: 5px;
119
+ border-bottom-right-radius: 5px;
120
+ display: flex;
121
+ justify-content: flex-end;
122
+ padding: 0 0.75rem 0.75rem;
123
+ }
124
+ .shepherd-footer .shepherd-button:last-child {
125
+ margin-right: 0;
126
+ }
127
+ .shepherd-cancel-icon {
128
+ background: transparent;
129
+ border: none;
130
+ color: hsla(0, 0%, 50.2%, 0.75);
131
+ font-size: 2em;
132
+ cursor: pointer;
133
+ font-weight: 400;
134
+ margin: 0;
135
+ padding: 0;
136
+ transition: color 0.5s ease;
137
+ }
138
+ .shepherd-cancel-icon:hover {
139
+ color: rgba(0, 0, 0, 0.75);
140
+ }
141
+ .shepherd-has-title .shepherd-content .shepherd-cancel-icon {
142
+ color: hsla(0, 0%, 50.2%, 0.75);
143
+ }
144
+ .shepherd-has-title .shepherd-content .shepherd-cancel-icon:hover {
145
+ color: rgba(0, 0, 0, 0.75);
146
+ }
147
+ .shepherd-title {
148
+ color: white;
149
+ display: flex;
150
+ font-size: 1rem;
151
+ font-weight: 400;
152
+ flex: 1 0 auto;
153
+ margin: 0;
154
+ padding: 0;
155
+ }
156
+ .shepherd-button {
157
+ background: #9852f1;
158
+ border: 0;
159
+ border-radius: 3px;
160
+ color: hsl(0, 0%, 100%);
161
+ cursor: pointer;
162
+ margin-right: 0.5rem;
163
+ padding: 10px;
164
+ font-weight: 1000;
165
+ transition: all 0.5s ease;
166
+ }
167
+ .shepherd-button:not(:disabled):hover {
168
+ background: #7d32dd;
169
+ color: white
170
+ }
171
+ .shepherd-button.shepherd-button-secondary {
172
+ background: #f1f2f3;
173
+ color: rgba(0, 0, 0, 0.473);
174
+ }
175
+ .shepherd-button.shepherd-button-secondary:not(:disabled):hover {
176
+ background: #d6d9db;
177
+ color: rgba(0, 0, 0, 0.75);
178
+ }
179
+ .shepherd-button:disabled {
180
+ cursor: not-allowed;
181
+ }
182
+ .num{
183
+ margin-left: auto;
184
+ }
185
+ span.dashicons.dashicons-dismiss.cancel {
186
+ margin-top: 4px;
187
+ margin-left: 7px;
188
+ cursor: pointer;
189
+ }
190
+
191
+ span.dashicons.dashicons-dismiss.cancel:hover {
192
+ color: #dbdbdd;
193
+ }
assets/images/about/56826.png ADDED
Binary file
assets/images/about/account.png ADDED
Binary file
assets/images/about/automatic-points.png ADDED
Binary file
assets/images/about/badges.png ADDED
Binary file
assets/images/about/buy-points.png ADDED
Binary file
assets/images/about/convert-points.png ADDED
Binary file
assets/images/about/leaderboards.png ADDED
Binary file
assets/images/about/multi-points.png ADDED
Binary file
assets/images/about/multi-site-support.png ADDED
Binary file
assets/images/about/points-management.png ADDED
Binary file
assets/images/about/sell-content.png ADDED
Binary file
assets/images/about/welcome.png ADDED
Binary file
assets/js/shepherd.js.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"file":"shepherd.js","sources":["../../node_modules/deepmerge/dist/cjs.js","../../src/js/utils/type-check.js","../../src/js/evented.js","../../src/js/utils/auto-bind.js","../../src/js/utils/bind.js","../../node_modules/@popperjs/core/lib/enums.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js","../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js","../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","../../node_modules/@popperjs/core/lib/dom-utils/contains.js","../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","../../node_modules/@popperjs/core/lib/utils/math.js","../../node_modules/@popperjs/core/lib/utils/within.js","../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js","../../node_modules/@popperjs/core/lib/modifiers/arrow.js","../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js","../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js","../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js","../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","../../node_modules/@popperjs/core/lib/utils/getVariation.js","../../node_modules/@popperjs/core/lib/utils/computeOffsets.js","../../node_modules/@popperjs/core/lib/utils/detectOverflow.js","../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","../../node_modules/@popperjs/core/lib/modifiers/flip.js","../../node_modules/@popperjs/core/lib/modifiers/hide.js","../../node_modules/@popperjs/core/lib/modifiers/offset.js","../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","../../node_modules/@popperjs/core/lib/utils/getAltAxis.js","../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","../../node_modules/@popperjs/core/lib/utils/orderModifiers.js","../../node_modules/@popperjs/core/lib/utils/debounce.js","../../node_modules/@popperjs/core/lib/utils/mergeByName.js","../../node_modules/@popperjs/core/lib/createPopper.js","../../node_modules/@popperjs/core/lib/popper.js","../../src/js/utils/popper-options.js","../../src/js/utils/general.js","../../node_modules/svelte/internal/index.mjs","../../src/js/components/shepherd-button.svelte","../../src/js/components/shepherd-footer.svelte","../../src/js/components/shepherd-cancel-icon.svelte","../../src/js/components/shepherd-title.svelte","../../src/js/components/shepherd-header.svelte","../../src/js/components/shepherd-text.svelte","../../src/js/components/shepherd-content.svelte","../../src/js/components/shepherd-element.svelte","../../node_modules/smoothscroll-polyfill/dist/smoothscroll.js","../../src/js/step.js","../../src/js/utils/cleanup.js","../../src/js/utils/overlay-path.js","../../src/js/components/shepherd-modal.svelte","../../src/js/tour.js","../../src/js/shepherd.js"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn target.propertyIsEnumerable(symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\n","/**\n * Checks if `value` is classified as an `Element`.\n * @param {*} value The param to check if it is an Element\n */\nexport function isElement(value) {\n return value instanceof Element;\n}\n\n/**\n * Checks if `value` is classified as an `HTMLElement`.\n * @param {*} value The param to check if it is an HTMLElement\n */\nexport function isHTMLElement(value) {\n return value instanceof HTMLElement;\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n * @param {*} value The param to check if it is a function\n */\nexport function isFunction(value) {\n return typeof value === 'function';\n}\n\n/**\n * Checks if `value` is classified as a `String` object.\n * @param {*} value The param to check if it is a string\n */\nexport function isString(value) {\n return typeof value === 'string';\n}\n\n/**\n * Checks if `value` is undefined.\n * @param {*} value The param to check if it is undefined\n */\nexport function isUndefined(value) {\n return value === undefined;\n}\n","import { isUndefined } from './utils/type-check';\n\nexport class Evented {\n on(event, handler, ctx, once = false) {\n if (isUndefined(this.bindings)) {\n this.bindings = {};\n }\n if (isUndefined(this.bindings[event])) {\n this.bindings[event] = [];\n }\n this.bindings[event].push({ handler, ctx, once });\n\n return this;\n }\n\n once(event, handler, ctx) {\n return this.on(event, handler, ctx, true);\n }\n\n off(event, handler) {\n if (isUndefined(this.bindings) ||\n isUndefined(this.bindings[event])) {\n return this;\n }\n\n if (isUndefined(handler)) {\n delete this.bindings[event];\n } else {\n this.bindings[event].forEach((binding, index) => {\n if (binding.handler === handler) {\n this.bindings[event].splice(index, 1);\n }\n });\n }\n\n return this;\n }\n\n trigger(event, ...args) {\n if (!isUndefined(this.bindings) && this.bindings[event]) {\n this.bindings[event].forEach((binding, index) => {\n const { ctx, handler, once } = binding;\n\n const context = ctx || this;\n\n handler.apply(context, args);\n\n if (once) {\n this.bindings[event].splice(index, 1);\n }\n });\n }\n\n return this;\n }\n}","/**\n * Binds all the methods on a JS Class to the `this` context of the class.\n * Adapted from https://github.com/sindresorhus/auto-bind\n * @param {object} self The `this` context of the class\n * @return {object} The `this` context of the class\n */\nexport default function autoBind(self) {\n const keys = Object.getOwnPropertyNames(self.constructor.prototype);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const val = self[key];\n if (key !== 'constructor' && typeof val === 'function') {\n self[key] = val.bind(self);\n }\n }\n\n return self;\n}\n","import { isUndefined } from './type-check';\n\n/**\n * Sets up the handler to determine if we should advance the tour\n * @param {string} selector\n * @param {Step} step The step instance\n * @return {Function}\n * @private\n */\nfunction _setupAdvanceOnHandler(selector, step) {\n return (event) => {\n if (step.isOpen()) {\n const targetIsEl = step.el && event.currentTarget === step.el;\n const targetIsSelector = !isUndefined(selector) && event.currentTarget.matches(selector);\n\n if (targetIsSelector || targetIsEl) {\n step.tour.next();\n }\n }\n };\n}\n\n/**\n * Bind the event handler for advanceOn\n * @param {Step} step The step instance\n */\nexport function bindAdvance(step) {\n // An empty selector matches the step element\n const { event, selector } = step.options.advanceOn || {};\n if (event) {\n const handler = _setupAdvanceOnHandler(selector, step);\n\n // TODO: this should also bind/unbind on show/hide\n let el;\n try {\n el = document.querySelector(selector);\n } catch (e) {\n // TODO\n }\n if (!isUndefined(selector) && !el) {\n return console.error(`No element was found for the selector supplied to advanceOn: ${selector}`);\n } else if (el) {\n el.addEventListener(event, handler);\n step.on('destroy', () => {\n return el.removeEventListener(event, handler);\n });\n } else {\n document.body.addEventListener(event, handler, true);\n step.on('destroy', () => {\n return document.body.removeEventListener(event, handler, true);\n });\n }\n } else {\n return console.error('advanceOn was defined, but no event name was passed.');\n }\n}\n","export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];","export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}","export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}","import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };","import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};","import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}","export default function getBoundingClientRect(element) {\n var rect = element.getBoundingClientRect();\n return {\n width: rect.width,\n height: rect.height,\n top: rect.top,\n right: rect.right,\n bottom: rect.bottom,\n left: rect.left,\n x: rect.left,\n y: rect.top\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}","import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}","import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}","import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}","import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}","import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}","import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;\n var currentNode = getParentNode(element);\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}","export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}","export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;","import { max as mathMax, min as mathMin } from \"./math.js\";\nexport default function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}","export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}","import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}","export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport within from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n if (!isHTMLElement(arrowElement)) {\n console.error(['Popper: \"arrow\" element must be an HTMLElement (not an SVGElement).', 'To use an SVG arrow, wrap it in an HTMLElement that will be used as', 'the arrow.'].join(' '));\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: \"arrow\" modifier\\'s `element` must be a child of the popper', 'element.'].join(' '));\n }\n\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};","import { top, left, right, bottom } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref) {\n var x = _ref.x,\n y = _ref.y;\n var win = window;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(round(x * dpr) / dpr) || 0,\n y: round(round(y * dpr) / dpr) || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets;\n\n var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === 'function' ? roundOffsets(offsets) : offsets,\n _ref3$x = _ref3.x,\n x = _ref3$x === void 0 ? 0 : _ref3$x,\n _ref3$y = _ref3.y,\n y = _ref3$y === void 0 ? 0 : _ref3$y;\n\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top) {\n sideY = bottom; // $FlowFixMe[prop-missing]\n\n y -= offsetParent[heightProp] - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left) {\n sideX = right; // $FlowFixMe[prop-missing]\n\n x -= offsetParent[widthProp] - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref4) {\n var state = _ref4.state,\n options = _ref4.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n\n if (process.env.NODE_ENV !== \"production\") {\n var transitionProperty = getComputedStyle(state.elements.popper).transitionProperty || '';\n\n if (adaptive && ['transform', 'top', 'right', 'bottom', 'left'].some(function (property) {\n return transitionProperty.indexOf(property) >= 0;\n })) {\n console.warn(['Popper: Detected CSS transitions on at least one of the following', 'CSS properties: \"transform\", \"top\", \"right\", \"bottom\", \"left\".', '\\n\\n', 'Disable the \"computeStyles\" modifier\\'s `adaptive` option to allow', 'for smooth transitions, or remove these properties from the CSS', 'transition declaration on the popper element if only transitioning', 'opacity or background-color for example.', '\\n\\n', 'We recommend using the popper element as a wrapper around an inner', 'element that can have any CSS property transitioned for animations.'].join(' '));\n }\n }\n\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};","import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};","var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}","var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}","import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If <html> has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on <html>\n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}","import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nexport default function getViewportRect(element) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper\n // can be obscured underneath it.\n // Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even\n // if it isn't open, so if this isn't available, the popper will be detected\n // to overflow the bottom of the screen too early.\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)\n // In Chrome, it returns a value very close to 0 (+/-) but contains rounding\n // errors due to floating point numbers, so we need to check precision.\n // Safari returns a number <= 0, usually < -1 when pinch-zoomed\n // Feature detection fails in mobile emulation mode in Chrome.\n // Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <\n // 0.001\n // Fallback here: \"Not Safari\" userAgent\n\n if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}","import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}","import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}","import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}","import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}","export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}","import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element) {\n var rect = getBoundingClientRect(element);\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isHTMLElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}","export default function getVariation(placement) {\n return placement.split('-')[1];\n}","import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}","import getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var referenceElement = state.elements.reference;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);\n var referenceClientRect = getBoundingClientRect(referenceElement);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}","import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n\n if (process.env.NODE_ENV !== \"production\") {\n console.error(['Popper: The `allowedAutoPlacements` option did not allow any', 'placements. Ensure the `placement` option matches the variation', 'of the allowed placements.', 'For example, \"auto\" cannot be used to allow \"bottom-start\".', 'Use \"auto-start\" instead.'].join(' '));\n }\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}","import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases – research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};","import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};","import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\";\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};","import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};","export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}","import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport within from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { max as mathMax, min as mathMin } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis || checkAltAxis) {\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = popperOffsets[mainAxis] + overflow[mainSide];\n var max = popperOffsets[mainAxis] - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - tetherOffsetValue : minLen - arrowLen - arrowPaddingMin - tetherOffsetValue;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + tetherOffsetValue : maxLen + arrowLen + arrowPaddingMax + tetherOffsetValue;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = state.modifiersData.offset ? state.modifiersData.offset[state.placement][mainAxis] : 0;\n var tetherMin = popperOffsets[mainAxis] + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = popperOffsets[mainAxis] + maxOffset - offsetModifierValue;\n\n if (checkMainAxis) {\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var _preventedOffset = within(tether ? mathMin(_min, tetherMin) : _min, _offset, tether ? mathMax(_max, tetherMax) : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};","export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}","import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}","import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\"; // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement);\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}","import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}","export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}","export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}","import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport getComputedStyle from \"./dom-utils/getComputedStyle.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport validateModifiers from \"./utils/validateModifiers.js\";\nimport uniqueBy from \"./utils/uniqueBy.js\";\nimport getBasePlacement from \"./utils/getBasePlacement.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nimport { auto } from \"./enums.js\";\nvar INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';\nvar INFINITE_LOOP_ERROR = 'Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.';\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(options) {\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n }); // Validate the provided modifiers so that the consumer will get warned\n // if one of the modifiers is invalid for any reason\n\n if (process.env.NODE_ENV !== \"production\") {\n var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function (_ref) {\n var name = _ref.name;\n return name;\n });\n validateModifiers(modifiers);\n\n if (getBasePlacement(state.options.placement) === auto) {\n var flipModifier = state.orderedModifiers.find(function (_ref2) {\n var name = _ref2.name;\n return name === 'flip';\n });\n\n if (!flipModifier) {\n console.error(['Popper: \"auto\" placements require the \"flip\" modifier be', 'present and enabled to work.'].join(' '));\n }\n }\n\n var _getComputedStyle = getComputedStyle(popper),\n marginTop = _getComputedStyle.marginTop,\n marginRight = _getComputedStyle.marginRight,\n marginBottom = _getComputedStyle.marginBottom,\n marginLeft = _getComputedStyle.marginLeft; // We no longer take into account `margins` on the popper, and it can\n // cause bugs with positioning, so we'll warn the consumer\n\n\n if ([marginTop, marginRight, marginBottom, marginLeft].some(function (margin) {\n return parseFloat(margin);\n })) {\n console.warn(['Popper: CSS \"margin\" styles cannot be used to apply padding', 'between the popper and its reference element or boundary.', 'To replicate margin, use the `offset` modifier, as well as', 'the `padding` option in the `preventOverflow` and `flip`', 'modifiers.'].join(' '));\n }\n }\n\n runModifierEffects();\n return instance.update();\n },\n // Sync update – it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n var __debug_loops__ = 0;\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (process.env.NODE_ENV !== \"production\") {\n __debug_loops__ += 1;\n\n if (__debug_loops__ > 100) {\n console.error(INFINITE_LOOP_ERROR);\n break;\n }\n }\n\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update – it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n if (process.env.NODE_ENV !== \"production\") {\n console.error(INVALID_ELEMENT_ERROR);\n }\n\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref3) {\n var name = _ref3.name,\n _ref3$options = _ref3.options,\n options = _ref3$options === void 0 ? {} : _ref3$options,\n effect = _ref3.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };","import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";","function _getCenteredStylePopperModifier() {\n return [\n {\n name: 'applyStyles',\n fn({ state }) {\n Object.keys(state.elements).forEach((name) => {\n if (name !== 'popper') {\n return;\n }\n const style = {\n position: 'fixed',\n left: '50%',\n top: '50%',\n transform: 'translate(-50%, -50%)'\n };\n\n const attributes = state.attributes[name] || {};\n const element = state.elements[name];\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach((name) => {\n const value = attributes[name];\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n }\n },\n {\n name: 'computeStyles',\n options: {\n adaptive: false\n }\n }\n ];\n}\n\n/**\n * Generates the array of options for a tooltip that doesn't have a\n * target element in the DOM -- and thus is positioned in the center\n * of the view\n *\n * @param {Step} step The step instance\n * @return {Object} The final Popper options object\n */\nexport function makeCenteredPopper(step) {\n const centeredStylePopperModifier = _getCenteredStylePopperModifier();\n\n let popperOptions = {\n placement: 'top',\n strategy: 'fixed',\n modifiers: [\n {\n name: 'focusAfterRender',\n enabled: true,\n phase: 'afterWrite',\n fn() {\n setTimeout(() => {\n if (step.el) {\n step.el.focus();\n }\n }, 300);\n }\n }\n ]\n };\n\n popperOptions = {\n ...popperOptions,\n modifiers: Array.from(\n new Set([...popperOptions.modifiers, ...centeredStylePopperModifier])\n )\n };\n\n return popperOptions;\n}\n","import { createPopper } from '@popperjs/core';\nimport { isString } from './type-check';\nimport { makeCenteredPopper } from './popper-options';\n\n/**\n * Ensure class prefix ends in `-`\n * @param {string} prefix The prefix to prepend to the class names generated by nano-css\n * @return {string} The prefix ending in `-`\n */\nexport function normalizePrefix(prefix) {\n if (!isString(prefix) || prefix === '') {\n return '';\n }\n\n return prefix.charAt(prefix.length - 1) !== '-' ? `${prefix}-` : prefix;\n}\n\n/**\n * Checks if options.attachTo.element is a string, and if so, tries to find the element\n * @param {Step} step The step instance\n * @returns {{element, on}}\n * `element` is a qualified HTML Element\n * `on` is a string position value\n */\nexport function parseAttachTo(step) {\n const options = step.options.attachTo || {};\n const returnOpts = Object.assign({}, options);\n\n if (isString(options.element)) {\n // Can't override the element in user opts reference because we can't\n // guarantee that the element will exist in the future.\n try {\n returnOpts.element = document.querySelector(options.element);\n } catch (e) {\n // TODO\n }\n if (!returnOpts.element) {\n console.error(\n `The element for this Shepherd step was not found ${options.element}`\n );\n }\n }\n\n return returnOpts;\n}\n\n/**\n * Determines options for the tooltip and initializes\n * `step.tooltip` as a Popper instance.\n * @param {Step} step The step instance\n */\nexport function setupTooltip(step) {\n if (step.tooltip) {\n step.tooltip.destroy();\n }\n\n const attachToOptions = parseAttachTo(step);\n\n let target = attachToOptions.element;\n const popperOptions = getPopperOptions(attachToOptions, step);\n\n if (step.isCentered()) {\n target = document.body;\n const content = step.shepherdElementComponent.getElement();\n content.classList.add('shepherd-centered');\n }\n\n step.tooltip = createPopper(target, step.el, popperOptions);\n step.target = attachToOptions.element;\n\n return popperOptions;\n}\n\n/**\n * Create a unique id for steps, tours, modals, etc\n * @return {string}\n */\nexport function uuid() {\n let d = Date.now();\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n\n/**\n * Gets the `Popper` options from a set of base `attachTo` options\n * @param attachToOptions\n * @param {Step} step The step instance\n * @return {Object}\n * @private\n */\nexport function getPopperOptions(attachToOptions, step) {\n let popperOptions = {\n modifiers: [\n {\n name: 'preventOverflow',\n options: {\n altAxis: true\n }\n },\n {\n name: 'focusAfterRender',\n enabled: true,\n phase: 'afterWrite',\n fn() {\n setTimeout(() => {\n if (step.el) {\n step.el.focus();\n }\n }, 300);\n }\n }\n ],\n strategy: 'absolute'\n };\n\n if (step.isCentered()) {\n popperOptions = makeCenteredPopper(step);\n } else {\n popperOptions.placement = attachToOptions.on;\n }\n\n const defaultStepOptions =\n step.tour && step.tour.options && step.tour.options.defaultStepOptions;\n\n if (defaultStepOptions) {\n popperOptions = _mergeModifiers(defaultStepOptions, popperOptions);\n }\n\n popperOptions = _mergeModifiers(step.options, popperOptions);\n\n return popperOptions;\n}\n\nfunction _mergeModifiers(stepOptions, popperOptions) {\n if (stepOptions.popperOptions) {\n let mergedPopperOptions = Object.assign(\n {},\n popperOptions,\n stepOptions.popperOptions\n );\n\n if (\n stepOptions.popperOptions.modifiers &&\n stepOptions.popperOptions.modifiers.length > 0\n ) {\n const names = stepOptions.popperOptions.modifiers.map((mod) => mod.name);\n const filteredModifiers = popperOptions.modifiers.filter(\n (mod) => !names.includes(mod.name)\n );\n\n mergedPopperOptions.modifiers = Array.from(\n new Set([...filteredModifiers, ...stepOptions.popperOptions.modifiers])\n );\n }\n\n return mergedPopperOptions;\n }\n\n return popperOptions;\n}\n","function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\nfunction is_promise(value) {\n return value && typeof value === 'object' && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot_spread(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_spread_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_spread_changes_fn(dirty) | get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value = ret) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction detach(node) {\n node.parentNode.removeChild(node);\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction claim_element(nodes, name, attributes, svg) {\n for (let i = 0; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeName === name) {\n let j = 0;\n const remove = [];\n while (j < node.attributes.length) {\n const attribute = node.attributes[j++];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n for (let k = 0; k < remove.length; k++) {\n node.removeAttribute(remove[k]);\n }\n return nodes.splice(i, 1)[0];\n }\n }\n return svg ? svg_element(name) : element(name);\n}\nfunction claim_text(nodes, data) {\n for (let i = 0; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 3) {\n node.data = '' + data;\n return nodes.splice(i, 1)[0];\n }\n }\n return text(data);\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.wholeText !== data)\n text.data = data;\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n node.style.setProperty(key, value, important ? 'important' : '');\n}\nfunction select_option(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked') || select.options[0];\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}</script>\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, false, false, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nclass HtmlTag {\n constructor(anchor = null) {\n this.a = anchor;\n this.e = this.n = null;\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n this.e = element(target.nodeName);\n this.t = target;\n this.h(html);\n }\n this.i(anchor);\n }\n h(html) {\n this.e.innerHTML = html;\n this.n = Array.from(this.e.childNodes);\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert(this.t, this.n[i], anchor);\n }\n }\n p(html) {\n this.d();\n this.h(html);\n this.i(this.a);\n }\n d() {\n this.n.forEach(detach);\n }\n}\nfunction attribute_to_object(attributes) {\n const result = {};\n for (const attribute of attributes) {\n result[attribute.name] = attribute.value;\n }\n return result;\n}\nfunction get_custom_elements_slots(element) {\n const result = {};\n element.childNodes.forEach((node) => {\n result[node.slot || 'default'] = true;\n });\n return result;\n}\n\nconst active_docs = new Set();\nlet active = 0;\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\nfunction hash(str) {\n let hash = 5381;\n let i = str.length;\n while (i--)\n hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n return hash >>> 0;\n}\nfunction create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {\n const step = 16.666 / duration;\n let keyframes = '{\\n';\n for (let p = 0; p <= 1; p += step) {\n const t = a + (b - a) * ease(p);\n keyframes += p * 100 + `%{${fn(t, 1 - t)}}\\n`;\n }\n const rule = keyframes + `100% {${fn(b, 1 - b)}}\\n}`;\n const name = `__svelte_${hash(rule)}_${uid}`;\n const doc = node.ownerDocument;\n active_docs.add(doc);\n const stylesheet = doc.__svelte_stylesheet || (doc.__svelte_stylesheet = doc.head.appendChild(element('style')).sheet);\n const current_rules = doc.__svelte_rules || (doc.__svelte_rules = {});\n if (!current_rules[name]) {\n current_rules[name] = true;\n stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);\n }\n const animation = node.style.animation || '';\n node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;\n active += 1;\n return name;\n}\nfunction delete_rule(node, name) {\n const previous = (node.style.animation || '').split(', ');\n const next = previous.filter(name\n ? anim => anim.indexOf(name) < 0 // remove specific animation\n : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations\n );\n const deleted = previous.length - next.length;\n if (deleted) {\n node.style.animation = next.join(', ');\n active -= deleted;\n if (!active)\n clear_rules();\n }\n}\nfunction clear_rules() {\n raf(() => {\n if (active)\n return;\n active_docs.forEach(doc => {\n const stylesheet = doc.__svelte_stylesheet;\n let i = stylesheet.cssRules.length;\n while (i--)\n stylesheet.deleteRule(i);\n doc.__svelte_rules = {};\n });\n active_docs.clear();\n });\n}\n\nfunction create_animation(node, from, fn, params) {\n if (!from)\n return noop;\n const to = node.getBoundingClientRect();\n if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)\n return noop;\n const { delay = 0, duration = 300, easing = identity, \n // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?\n start: start_time = now() + delay, \n // @ts-ignore todo:\n end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params);\n let running = true;\n let started = false;\n let name;\n function start() {\n if (css) {\n name = create_rule(node, 0, 1, duration, delay, easing, css);\n }\n if (!delay) {\n started = true;\n }\n }\n function stop() {\n if (css)\n delete_rule(node, name);\n running = false;\n }\n loop(now => {\n if (!started && now >= start_time) {\n started = true;\n }\n if (started && now >= end) {\n tick(1, 0);\n stop();\n }\n if (!running) {\n return false;\n }\n if (started) {\n const p = now - start_time;\n const t = 0 + 1 * easing(p / duration);\n tick(t, 1 - t);\n }\n return true;\n });\n start();\n tick(0, 1);\n return stop;\n}\nfunction fix_position(node) {\n const style = getComputedStyle(node);\n if (style.position !== 'absolute' && style.position !== 'fixed') {\n const { width, height } = style;\n const a = node.getBoundingClientRect();\n node.style.position = 'absolute';\n node.style.width = width;\n node.style.height = height;\n add_transform(node, a);\n }\n}\nfunction add_transform(node, a) {\n const b = node.getBoundingClientRect();\n if (a.left !== b.left || a.top !== b.top) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;\n }\n}\n\nlet current_component;\nfunction set_current_component(component) {\n current_component = component;\n}\nfunction get_current_component() {\n if (!current_component)\n throw new Error('Function called outside component initialization');\n return current_component;\n}\nfunction beforeUpdate(fn) {\n get_current_component().$$.before_update.push(fn);\n}\nfunction onMount(fn) {\n get_current_component().$$.on_mount.push(fn);\n}\nfunction afterUpdate(fn) {\n get_current_component().$$.after_update.push(fn);\n}\nfunction onDestroy(fn) {\n get_current_component().$$.on_destroy.push(fn);\n}\nfunction createEventDispatcher() {\n const component = get_current_component();\n return (type, detail) => {\n const callbacks = component.$$.callbacks[type];\n if (callbacks) {\n // TODO are there situations where events could be dispatched\n // in a server (non-DOM) environment?\n const event = custom_event(type, detail);\n callbacks.slice().forEach(fn => {\n fn.call(component, event);\n });\n }\n };\n}\nfunction setContext(key, context) {\n get_current_component().$$.context.set(key, context);\n}\nfunction getContext(key) {\n return get_current_component().$$.context.get(key);\n}\nfunction hasContext(key) {\n return get_current_component().$$.context.has(key);\n}\n// TODO figure out if we still want to support\n// shorthand events, or if we want to implement\n// a real bubbling mechanism\nfunction bubble(component, event) {\n const callbacks = component.$$.callbacks[event.type];\n if (callbacks) {\n callbacks.slice().forEach(fn => fn(event));\n }\n}\n\nconst dirty_components = [];\nconst intros = { enabled: false };\nconst binding_callbacks = [];\nconst render_callbacks = [];\nconst flush_callbacks = [];\nconst resolved_promise = Promise.resolve();\nlet update_scheduled = false;\nfunction schedule_update() {\n if (!update_scheduled) {\n update_scheduled = true;\n resolved_promise.then(flush);\n }\n}\nfunction tick() {\n schedule_update();\n return resolved_promise;\n}\nfunction add_render_callback(fn) {\n render_callbacks.push(fn);\n}\nfunction add_flush_callback(fn) {\n flush_callbacks.push(fn);\n}\nlet flushing = false;\nconst seen_callbacks = new Set();\nfunction flush() {\n if (flushing)\n return;\n flushing = true;\n do {\n // first, call beforeUpdate functions\n // and update components\n for (let i = 0; i < dirty_components.length; i += 1) {\n const component = dirty_components[i];\n set_current_component(component);\n update(component.$$);\n }\n set_current_component(null);\n dirty_components.length = 0;\n while (binding_callbacks.length)\n binding_callbacks.pop()();\n // then, once components are updated, call\n // afterUpdate functions. This may cause\n // subsequent updates...\n for (let i = 0; i < render_callbacks.length; i += 1) {\n const callback = render_callbacks[i];\n if (!seen_callbacks.has(callback)) {\n // ...so guard against infinite loops\n seen_callbacks.add(callback);\n callback();\n }\n }\n render_callbacks.length = 0;\n } while (dirty_components.length);\n while (flush_callbacks.length) {\n flush_callbacks.pop()();\n }\n update_scheduled = false;\n flushing = false;\n seen_callbacks.clear();\n}\nfunction update($$) {\n if ($$.fragment !== null) {\n $$.update();\n run_all($$.before_update);\n const dirty = $$.dirty;\n $$.dirty = [-1];\n $$.fragment && $$.fragment.p($$.ctx, dirty);\n $$.after_update.forEach(add_render_callback);\n }\n}\n\nlet promise;\nfunction wait() {\n if (!promise) {\n promise = Promise.resolve();\n promise.then(() => {\n promise = null;\n });\n }\n return promise;\n}\nfunction dispatch(node, direction, kind) {\n node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\nconst outroing = new Set();\nlet outros;\nfunction group_outros() {\n outros = {\n r: 0,\n c: [],\n p: outros // parent group\n };\n}\nfunction check_outros() {\n if (!outros.r) {\n run_all(outros.c);\n }\n outros = outros.p;\n}\nfunction transition_in(block, local) {\n if (block && block.i) {\n outroing.delete(block);\n block.i(local);\n }\n}\nfunction transition_out(block, local, detach, callback) {\n if (block && block.o) {\n if (outroing.has(block))\n return;\n outroing.add(block);\n outros.c.push(() => {\n outroing.delete(block);\n if (callback) {\n if (detach)\n block.d(1);\n callback();\n }\n });\n block.o(local);\n }\n}\nconst null_transition = { duration: 0 };\nfunction create_in_transition(node, fn, params) {\n let config = fn(node, params);\n let running = false;\n let animation_name;\n let task;\n let uid = 0;\n function cleanup() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n tick(0, 1);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n if (task)\n task.abort();\n running = true;\n add_render_callback(() => dispatch(node, true, 'start'));\n task = loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(1, 0);\n dispatch(node, true, 'end');\n cleanup();\n return running = false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(t, 1 - t);\n }\n }\n return running;\n });\n }\n let started = false;\n return {\n start() {\n if (started)\n return;\n delete_rule(node);\n if (is_function(config)) {\n config = config();\n wait().then(go);\n }\n else {\n go();\n }\n },\n invalidate() {\n started = false;\n },\n end() {\n if (running) {\n cleanup();\n running = false;\n }\n }\n };\n}\nfunction create_out_transition(node, fn, params) {\n let config = fn(node, params);\n let running = true;\n let animation_name;\n const group = outros;\n group.r += 1;\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n add_render_callback(() => dispatch(node, false, 'start'));\n loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(0, 1);\n dispatch(node, false, 'end');\n if (!--group.r) {\n // this will result in `end()` being called,\n // so we don't need to clean up here\n run_all(group.c);\n }\n return false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(1 - t, t);\n }\n }\n return running;\n });\n }\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go();\n });\n }\n else {\n go();\n }\n return {\n end(reset) {\n if (reset && config.tick) {\n config.tick(1, 0);\n }\n if (running) {\n if (animation_name)\n delete_rule(node, animation_name);\n running = false;\n }\n }\n };\n}\nfunction create_bidirectional_transition(node, fn, params, intro) {\n let config = fn(node, params);\n let t = intro ? 0 : 1;\n let running_program = null;\n let pending_program = null;\n let animation_name = null;\n function clear_animation() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function init(program, duration) {\n const d = program.b - t;\n duration *= Math.abs(d);\n return {\n a: t,\n b: program.b,\n d,\n duration,\n start: program.start,\n end: program.start + duration,\n group: program.group\n };\n }\n function go(b) {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n const program = {\n start: now() + delay,\n b\n };\n if (!b) {\n // @ts-ignore todo: improve typings\n program.group = outros;\n outros.r += 1;\n }\n if (running_program || pending_program) {\n pending_program = program;\n }\n else {\n // if this is an intro, and there's a delay, we need to do\n // an initial tick and/or apply CSS animation immediately\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, b, duration, delay, easing, css);\n }\n if (b)\n tick(0, 1);\n running_program = init(program, duration);\n add_render_callback(() => dispatch(node, b, 'start'));\n loop(now => {\n if (pending_program && now > pending_program.start) {\n running_program = init(pending_program, duration);\n pending_program = null;\n dispatch(node, running_program.b, 'start');\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);\n }\n }\n if (running_program) {\n if (now >= running_program.end) {\n tick(t = running_program.b, 1 - t);\n dispatch(node, running_program.b, 'end');\n if (!pending_program) {\n // we're done\n if (running_program.b) {\n // intro — we can tidy up immediately\n clear_animation();\n }\n else {\n // outro — needs to be coordinated\n if (!--running_program.group.r)\n run_all(running_program.group.c);\n }\n }\n running_program = null;\n }\n else if (now >= running_program.start) {\n const p = now - running_program.start;\n t = running_program.a + running_program.d * easing(p / running_program.duration);\n tick(t, 1 - t);\n }\n }\n return !!(running_program || pending_program);\n });\n }\n }\n return {\n run(b) {\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go(b);\n });\n }\n else {\n go(b);\n }\n },\n end() {\n clear_animation();\n running_program = pending_program = null;\n }\n };\n}\n\nfunction handle_promise(promise, info) {\n const token = info.token = {};\n function update(type, index, key, value) {\n if (info.token !== token)\n return;\n info.resolved = value;\n let child_ctx = info.ctx;\n if (key !== undefined) {\n child_ctx = child_ctx.slice();\n child_ctx[key] = value;\n }\n const block = type && (info.current = type)(child_ctx);\n let needs_flush = false;\n if (info.block) {\n if (info.blocks) {\n info.blocks.forEach((block, i) => {\n if (i !== index && block) {\n group_outros();\n transition_out(block, 1, 1, () => {\n if (info.blocks[i] === block) {\n info.blocks[i] = null;\n }\n });\n check_outros();\n }\n });\n }\n else {\n info.block.d(1);\n }\n block.c();\n transition_in(block, 1);\n block.m(info.mount(), info.anchor);\n needs_flush = true;\n }\n info.block = block;\n if (info.blocks)\n info.blocks[index] = block;\n if (needs_flush) {\n flush();\n }\n }\n if (is_promise(promise)) {\n const current_component = get_current_component();\n promise.then(value => {\n set_current_component(current_component);\n update(info.then, 1, info.value, value);\n set_current_component(null);\n }, error => {\n set_current_component(current_component);\n update(info.catch, 2, info.error, error);\n set_current_component(null);\n if (!info.hasCatch) {\n throw error;\n }\n });\n // if we previously had a then/catch block, destroy it\n if (info.current !== info.pending) {\n update(info.pending, 0);\n return true;\n }\n }\n else {\n if (info.current !== info.then) {\n update(info.then, 1, info.value, promise);\n return true;\n }\n info.resolved = promise;\n }\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\nfunction destroy_block(block, lookup) {\n block.d(1);\n lookup.delete(block.key);\n}\nfunction outro_and_destroy_block(block, lookup) {\n transition_out(block, 1, 1, () => {\n lookup.delete(block.key);\n });\n}\nfunction fix_and_destroy_block(block, lookup) {\n block.f();\n destroy_block(block, lookup);\n}\nfunction fix_and_outro_and_destroy_block(block, lookup) {\n block.f();\n outro_and_destroy_block(block, lookup);\n}\nfunction update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {\n let o = old_blocks.length;\n let n = list.length;\n let i = o;\n const old_indexes = {};\n while (i--)\n old_indexes[old_blocks[i].key] = i;\n const new_blocks = [];\n const new_lookup = new Map();\n const deltas = new Map();\n i = n;\n while (i--) {\n const child_ctx = get_context(ctx, list, i);\n const key = get_key(child_ctx);\n let block = lookup.get(key);\n if (!block) {\n block = create_each_block(key, child_ctx);\n block.c();\n }\n else if (dynamic) {\n block.p(child_ctx, dirty);\n }\n new_lookup.set(key, new_blocks[i] = block);\n if (key in old_indexes)\n deltas.set(key, Math.abs(i - old_indexes[key]));\n }\n const will_move = new Set();\n const did_move = new Set();\n function insert(block) {\n transition_in(block, 1);\n block.m(node, next);\n lookup.set(block.key, block);\n next = block.first;\n n--;\n }\n while (o && n) {\n const new_block = new_blocks[n - 1];\n const old_block = old_blocks[o - 1];\n const new_key = new_block.key;\n const old_key = old_block.key;\n if (new_block === old_block) {\n // do nothing\n next = new_block.first;\n o--;\n n--;\n }\n else if (!new_lookup.has(old_key)) {\n // remove old block\n destroy(old_block, lookup);\n o--;\n }\n else if (!lookup.has(new_key) || will_move.has(new_key)) {\n insert(new_block);\n }\n else if (did_move.has(old_key)) {\n o--;\n }\n else if (deltas.get(new_key) > deltas.get(old_key)) {\n did_move.add(new_key);\n insert(new_block);\n }\n else {\n will_move.add(old_key);\n o--;\n }\n }\n while (o--) {\n const old_block = old_blocks[o];\n if (!new_lookup.has(old_block.key))\n destroy(old_block, lookup);\n }\n while (n)\n insert(new_blocks[n - 1]);\n return new_blocks;\n}\nfunction validate_each_keys(ctx, list, get_context, get_key) {\n const keys = new Set();\n for (let i = 0; i < list.length; i++) {\n const key = get_key(get_context(ctx, list, i));\n if (keys.has(key)) {\n throw new Error('Cannot have duplicate keys in a keyed each');\n }\n keys.add(key);\n }\n}\n\nfunction get_spread_update(levels, updates) {\n const update = {};\n const to_null_out = {};\n const accounted_for = { $$scope: 1 };\n let i = levels.length;\n while (i--) {\n const o = levels[i];\n const n = updates[i];\n if (n) {\n for (const key in o) {\n if (!(key in n))\n to_null_out[key] = 1;\n }\n for (const key in n) {\n if (!accounted_for[key]) {\n update[key] = n[key];\n accounted_for[key] = 1;\n }\n }\n levels[i] = n;\n }\n else {\n for (const key in o) {\n accounted_for[key] = 1;\n }\n }\n }\n for (const key in to_null_out) {\n if (!(key in update))\n update[key] = undefined;\n }\n return update;\n}\nfunction get_spread_object(spread_props) {\n return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};\n}\n\n// source: https://html.spec.whatwg.org/multipage/indices.html\nconst boolean_attributes = new Set([\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'ismap',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected'\n]);\n\nconst invalid_attribute_name_character = /[\\s'\">/=\\u{FDD0}-\\u{FDEF}\\u{FFFE}\\u{FFFF}\\u{1FFFE}\\u{1FFFF}\\u{2FFFE}\\u{2FFFF}\\u{3FFFE}\\u{3FFFF}\\u{4FFFE}\\u{4FFFF}\\u{5FFFE}\\u{5FFFF}\\u{6FFFE}\\u{6FFFF}\\u{7FFFE}\\u{7FFFF}\\u{8FFFE}\\u{8FFFF}\\u{9FFFE}\\u{9FFFF}\\u{AFFFE}\\u{AFFFF}\\u{BFFFE}\\u{BFFFF}\\u{CFFFE}\\u{CFFFF}\\u{DFFFE}\\u{DFFFF}\\u{EFFFE}\\u{EFFFF}\\u{FFFFE}\\u{FFFFF}\\u{10FFFE}\\u{10FFFF}]/u;\n// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n// https://infra.spec.whatwg.org/#noncharacter\nfunction spread(args, classes_to_add) {\n const attributes = Object.assign({}, ...args);\n if (classes_to_add) {\n if (attributes.class == null) {\n attributes.class = classes_to_add;\n }\n else {\n attributes.class += ' ' + classes_to_add;\n }\n }\n let str = '';\n Object.keys(attributes).forEach(name => {\n if (invalid_attribute_name_character.test(name))\n return;\n const value = attributes[name];\n if (value === true)\n str += ' ' + name;\n else if (boolean_attributes.has(name.toLowerCase())) {\n if (value)\n str += ' ' + name;\n }\n else if (value != null) {\n str += ` ${name}=\"${String(value).replace(/\"/g, '&#34;').replace(/'/g, '&#39;')}\"`;\n }\n });\n return str;\n}\nconst escaped = {\n '\"': '&quot;',\n \"'\": '&#39;',\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;'\n};\nfunction escape(html) {\n return String(html).replace(/[\"'&<>]/g, match => escaped[match]);\n}\nfunction each(items, fn) {\n let str = '';\n for (let i = 0; i < items.length; i += 1) {\n str += fn(items[i], i);\n }\n return str;\n}\nconst missing_component = {\n $$render: () => ''\n};\nfunction validate_component(component, name) {\n if (!component || !component.$$render) {\n if (name === 'svelte:component')\n name += ' this={...}';\n throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules`);\n }\n return component;\n}\nfunction debug(file, line, column, values) {\n console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console\n console.log(values); // eslint-disable-line no-console\n return '';\n}\nlet on_destroy;\nfunction create_ssr_component(fn) {\n function $$render(result, props, bindings, slots) {\n const parent_component = current_component;\n const $$ = {\n on_destroy,\n context: new Map(parent_component ? parent_component.$$.context : []),\n // these will be immediately discarded\n on_mount: [],\n before_update: [],\n after_update: [],\n callbacks: blank_object()\n };\n set_current_component({ $$ });\n const html = fn(result, props, bindings, slots);\n set_current_component(parent_component);\n return html;\n }\n return {\n render: (props = {}, options = {}) => {\n on_destroy = [];\n const result = { title: '', head: '', css: new Set() };\n const html = $$render(result, props, {}, options);\n run_all(on_destroy);\n return {\n html,\n css: {\n code: Array.from(result.css).map(css => css.code).join('\\n'),\n map: null // TODO\n },\n head: result.title + result.head\n };\n },\n $$render\n };\n}\nfunction add_attribute(name, value, boolean) {\n if (value == null || (boolean && !value))\n return '';\n return ` ${name}${value === true ? '' : `=${typeof value === 'string' ? JSON.stringify(escape(value)) : `\"${value}\"`}`}`;\n}\nfunction add_classes(classes) {\n return classes ? ` class=\"${classes}\"` : '';\n}\n\nfunction bind(component, name, callback) {\n const index = component.$$.props[name];\n if (index !== undefined) {\n component.$$.bound[index] = callback;\n callback(component.$$.ctx[index]);\n }\n}\nfunction create_component(block) {\n block && block.c();\n}\nfunction claim_component(block, parent_nodes) {\n block && block.l(parent_nodes);\n}\nfunction mount_component(component, target, anchor) {\n const { fragment, on_mount, on_destroy, after_update } = component.$$;\n fragment && fragment.m(target, anchor);\n // onMount happens before the initial afterUpdate\n add_render_callback(() => {\n const new_on_destroy = on_mount.map(run).filter(is_function);\n if (on_destroy) {\n on_destroy.push(...new_on_destroy);\n }\n else {\n // Edge case - component was destroyed immediately,\n // most likely as a result of a binding initialising\n run_all(new_on_destroy);\n }\n component.$$.on_mount = [];\n });\n after_update.forEach(add_render_callback);\n}\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n // TODO null out other refs, including component.$$ (but need to\n // preserve final state?)\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nfunction make_dirty(component, i) {\n if (component.$$.dirty[0] === -1) {\n dirty_components.push(component);\n schedule_update();\n component.$$.dirty.fill(0);\n }\n component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));\n}\nfunction init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {\n const parent_component = current_component;\n set_current_component(component);\n const $$ = component.$$ = {\n fragment: null,\n ctx: null,\n // state\n props,\n update: noop,\n not_equal,\n bound: blank_object(),\n // lifecycle\n on_mount: [],\n on_destroy: [],\n before_update: [],\n after_update: [],\n context: new Map(parent_component ? parent_component.$$.context : []),\n // everything else\n callbacks: blank_object(),\n dirty,\n skip_bound: false\n };\n let ready = false;\n $$.ctx = instance\n ? instance(component, options.props || {}, (i, ret, ...rest) => {\n const value = rest.length ? rest[0] : ret;\n if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {\n if (!$$.skip_bound && $$.bound[i])\n $$.bound[i](value);\n if (ready)\n make_dirty(component, i);\n }\n return ret;\n })\n : [];\n $$.update();\n ready = true;\n run_all($$.before_update);\n // `false` as a special case of no DOM component\n $$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n if (options.target) {\n if (options.hydrate) {\n const nodes = children(options.target);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.l(nodes);\n nodes.forEach(detach);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.c();\n }\n if (options.intro)\n transition_in(component.$$.fragment);\n mount_component(component, options.target, options.anchor);\n flush();\n }\n set_current_component(parent_component);\n}\nlet SvelteElement;\nif (typeof HTMLElement === 'function') {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n // @ts-ignore todo: improve typings\n for (const key in this.$$.slotted) {\n // @ts-ignore todo: improve typings\n this.appendChild(this.$$.slotted[key]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n // TODO should this delegate to addEventListener?\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n/**\n * Base class for Svelte components. Used when dev=false.\n */\nclass SvelteComponent {\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n}\n\nfunction dispatch_dev(type, detail) {\n document.dispatchEvent(custom_event(type, Object.assign({ version: '3.32.1' }, detail)));\n}\nfunction append_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append(target, node);\n}\nfunction insert_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert(target, node, anchor);\n}\nfunction detach_dev(node) {\n dispatch_dev('SvelteDOMRemove', { node });\n detach(node);\n}\nfunction detach_between_dev(before, after) {\n while (before.nextSibling && before.nextSibling !== after) {\n detach_dev(before.nextSibling);\n }\n}\nfunction detach_before_dev(after) {\n while (after.previousSibling) {\n detach_dev(after.previousSibling);\n }\n}\nfunction detach_after_dev(before) {\n while (before.nextSibling) {\n detach_dev(before.nextSibling);\n }\n}\nfunction listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {\n const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];\n if (has_prevent_default)\n modifiers.push('preventDefault');\n if (has_stop_propagation)\n modifiers.push('stopPropagation');\n dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });\n const dispose = listen(node, event, handler, options);\n return () => {\n dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });\n dispose();\n };\n}\nfunction attr_dev(node, attribute, value) {\n attr(node, attribute, value);\n if (value == null)\n dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });\n else\n dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });\n}\nfunction prop_dev(node, property, value) {\n node[property] = value;\n dispatch_dev('SvelteDOMSetProperty', { node, property, value });\n}\nfunction dataset_dev(node, property, value) {\n node.dataset[property] = value;\n dispatch_dev('SvelteDOMSetDataset', { node, property, value });\n}\nfunction set_data_dev(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n dispatch_dev('SvelteDOMSetData', { node: text, data });\n text.data = data;\n}\nfunction validate_each_argument(arg) {\n if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {\n let msg = '{#each} only iterates over array-like objects.';\n if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {\n msg += ' You can use a spread to convert this iterable into an array.';\n }\n throw new Error(msg);\n }\n}\nfunction validate_slots(name, slot, keys) {\n for (const slot_key of Object.keys(slot)) {\n if (!~keys.indexOf(slot_key)) {\n console.warn(`<${name}> received an unexpected slot \"${slot_key}\".`);\n }\n }\n}\n/**\n * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.\n */\nclass SvelteComponentDev extends SvelteComponent {\n constructor(options) {\n if (!options || (!options.target && !options.$$inline)) {\n throw new Error(\"'target' is a required option\");\n }\n super();\n }\n $destroy() {\n super.$destroy();\n this.$destroy = () => {\n console.warn('Component was already destroyed'); // eslint-disable-line no-console\n };\n }\n $capture_state() { }\n $inject_state() { }\n}\n/**\n * Base class to create strongly typed Svelte components.\n * This only exists for typing purposes and should be used in `.d.ts` files.\n *\n * ### Example:\n *\n * You have component library on npm called `component-library`, from which\n * you export a component called `MyComponent`. For Svelte+TypeScript users,\n * you want to provide typings. Therefore you create a `index.d.ts`:\n * ```ts\n * import { SvelteComponentTyped } from \"svelte\";\n * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}\n * ```\n * Typing this makes it possible for IDEs like VS Code with the Svelte extension\n * to provide intellisense and to use the component like this in a Svelte file\n * with TypeScript:\n * ```svelte\n * <script lang=\"ts\">\n * \timport { MyComponent } from \"component-library\";\n * </script>\n * <MyComponent foo={'bar'} />\n * ```\n *\n * #### Why not make this part of `SvelteComponent(Dev)`?\n * Because\n * ```ts\n * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}\n * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;\n * ```\n * will throw a type error, so we need to seperate the more strictly typed class.\n */\nclass SvelteComponentTyped extends SvelteComponentDev {\n constructor(options) {\n super(options);\n }\n}\nfunction loop_guard(timeout) {\n const start = Date.now();\n return () => {\n if (Date.now() - start > timeout) {\n throw new Error('Infinite loop detected');\n }\n };\n}\n\nexport { HtmlTag, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_location, add_render_callback, add_resize_listener, add_transform, afterUpdate, append, append_dev, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_component, claim_element, claim_space, claim_text, clear_loops, component_subscribe, compute_rest_props, compute_slots, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, escape, escaped, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, getContext, get_binding_group_value, get_current_component, get_custom_elements_slots, get_slot_changes, get_slot_context, get_spread_object, get_spread_update, get_store_value, globals, group_outros, handle_promise, hasContext, has_prop, identity, init, insert, insert_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, listen, listen_dev, loop, loop_guard, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_data, set_data_dev, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, spread, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, update_keyed_each, update_slot, update_slot_spread, validate_component, validate_each_argument, validate_each_keys, validate_slots, validate_store, xlink_attr };\n","<script>\n import { isFunction } from '../utils/type-check';\n\n export let config, step;\n let action, classes, disabled, label, secondary, text;\n\n $: {\n action = config.action ? config.action.bind(step.tour) : null;\n classes = config.classes;\n disabled = config.disabled ? getDisabled(config.disabled) : false;\n label = config.label;\n secondary = config.secondary;\n text = config.text;\n }\n\n function getDisabled(disabled) {\n if (isFunction(disabled)) {\n return disabled = disabled.call(step);\n }\n return disabled\n }\n\n</script>\n\n<style global>\n .shepherd-button {\n background: rgb(50, 136, 230);\n border: 0;\n border-radius: 3px;\n color: rgba(255, 255, 255, 0.75);\n cursor: pointer;\n margin-right: 0.5rem;\n padding: 0.5rem 1.5rem;\n transition: all 0.5s ease;\n }\n\n .shepherd-button:not(:disabled):hover {\n background: rgb(25, 111, 204);\n color: rgba(255, 255, 255, 0.75);\n }\n\n .shepherd-button.shepherd-button-secondary {\n background: rgb(241, 242, 243);\n color: rgba(0, 0, 0, 0.75);\n }\n\n .shepherd-button.shepherd-button-secondary:not(:disabled):hover {\n background: rgb(214, 217, 219);\n color: rgba(0, 0, 0, 0.75);\n }\n\n .shepherd-button:disabled {\n cursor: not-allowed;\n }\n</style>\n\n<button\n aria-label=\"{label ? label : null}\"\n class=\"{`${(classes || '')} shepherd-button ${(secondary ? 'shepherd-button-secondary' : '')}`}\"\n disabled={disabled}\n on:click={action}\n tabindex=\"0\"\n>\n {@html text}\n</button>\n","<script>\n import ShepherdButton from './shepherd-button.svelte';\n\n export let step;\n\n $: buttons = step.options.buttons;\n</script>\n\n<style global>\n .shepherd-footer {\n border-bottom-left-radius: 5px;\n border-bottom-right-radius: 5px;\n display: flex;\n justify-content: flex-end;\n padding: 0 0.75rem 0.75rem;\n }\n\n .shepherd-footer .shepherd-button:last-child {\n margin-right: 0;\n }\n</style>\n\n<footer class=\"shepherd-footer\">\n {#if buttons}\n {#each buttons as config}\n <ShepherdButton\n {config}\n {step}\n />\n {/each}\n {/if}\n</footer>\n","<script>\n export let cancelIcon, step;\n\n /**\n * Add a click listener to the cancel link that cancels the tour\n */\n const handleCancelClick = (e) => {\n e.preventDefault();\n step.cancel();\n };\n</script>\n\n<style global>\n .shepherd-cancel-icon {\n background: transparent;\n border: none;\n color: rgba(128, 128, 128, 0.75);\n font-size: 2em;\n cursor: pointer;\n font-weight: normal;\n margin: 0;\n padding: 0;\n transition: color 0.5s ease;\n }\n\n .shepherd-cancel-icon:hover {\n color: rgba(0, 0, 0, 0.75);\n }\n\n .shepherd-has-title .shepherd-content .shepherd-cancel-icon {\n color: rgba(128, 128, 128, 0.75);\n }\n\n .shepherd-has-title .shepherd-content .shepherd-cancel-icon:hover {\n color: rgba(0, 0, 0, 0.75);\n }\n</style>\n\n<button\n aria-label=\"{cancelIcon.label ? cancelIcon.label : 'Close Tour'}\"\n class=\"shepherd-cancel-icon\"\n on:click={handleCancelClick}\n type=\"button\"\n>\n <span aria-hidden=\"true\">&times;</span>\n</button>\n","<script>\n import { afterUpdate } from 'svelte';\n import { isFunction } from '../utils/type-check';\n \n export let labelId, element, title;\n \n afterUpdate(() => {\n if (isFunction(title)) {\n title = title();\n }\n \n element.innerHTML = title;\n });\n</script>\n\n<style global>\n .shepherd-title {\n color: rgba(0, 0, 0, 0.75);\n display: flex;\n font-size: 1rem;\n font-weight: normal;\n flex: 1 0 auto;\n margin: 0;\n padding: 0;\n }\n</style>\n\n<h3\n bind:this={element}\n id=\"{labelId}\"\n class=\"shepherd-title\"\n>\n</h3>\n","<script>\n import ShepherdCancelIcon from './shepherd-cancel-icon.svelte';\n import ShepherdTitle from './shepherd-title.svelte';\n\n export let labelId, step;\n let title, cancelIcon;\n\n $: {\n title = step.options.title;\n cancelIcon = step.options.cancelIcon;\n }\n</script>\n\n<style global>\n .shepherd-header {\n align-items: center;\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n display: flex;\n justify-content: flex-end;\n line-height: 2em;\n padding: 0.75rem 0.75rem 0;\n }\n\n .shepherd-has-title .shepherd-content .shepherd-header {\n background: #e6e6e6;\n padding: 1em;\n }\n</style>\n\n<header class=\"shepherd-header\">\n {#if title}\n <ShepherdTitle\n {labelId}\n {title}\n />\n {/if}\n\n {#if cancelIcon && cancelIcon.enabled}\n <ShepherdCancelIcon\n {cancelIcon}\n {step}\n />\n {/if}\n</header>\n","<script>\n import { afterUpdate } from 'svelte';\n import { isHTMLElement, isFunction } from '../utils/type-check';\n\n export let descriptionId, element, step;\n\n afterUpdate(() => {\n let { text } = step.options;\n\n if (isFunction(text)) {\n text = text.call(step);\n }\n\n if (isHTMLElement(text)) {\n element.appendChild(text);\n } else {\n element.innerHTML = text;\n }\n });\n</script>\n\n<style global>\n .shepherd-text {\n color: rgba(0, 0, 0, 0.75);\n font-size: 1rem;\n line-height: 1.3em;\n padding: 0.75em;\n }\n\n .shepherd-text p {\n margin-top: 0;\n }\n\n .shepherd-text p:last-child {\n margin-bottom: 0;\n }\n</style>\n\n<div\n bind:this={element}\n class=\"shepherd-text\"\n id=\"{descriptionId}\"\n>\n</div>\n\n","<script>\n import ShepherdFooter from './shepherd-footer.svelte';\n import ShepherdHeader from './shepherd-header.svelte';\n import ShepherdText from './shepherd-text.svelte';\n import { isUndefined } from '../utils/type-check.js';\n\n export let descriptionId, labelId, step;\n</script>\n\n<style global>\n .shepherd-content {\n border-radius: 5px;\n outline: none;\n padding: 0;\n }\n</style>\n\n<div\n class=\"shepherd-content\"\n>\n {#if !isUndefined(step.options.title) || (step.options.cancelIcon && step.options.cancelIcon.enabled)}\n <ShepherdHeader\n {labelId}\n {step}\n />\n {/if}\n\n {#if !isUndefined(step.options.text)}\n <ShepherdText\n {descriptionId}\n {step}\n />\n {/if}\n\n {#if Array.isArray(step.options.buttons) && step.options.buttons.length}\n <ShepherdFooter\n {step}\n />\n {/if}\n</div>\n","<script>\n import { onMount, afterUpdate } from 'svelte';\n import ShepherdContent from './shepherd-content.svelte';\n import { isUndefined, isString } from '../utils/type-check.js';\n\n const KEY_TAB = 9;\n const KEY_ESC = 27;\n const LEFT_ARROW = 37;\n const RIGHT_ARROW = 39;\n\n export let classPrefix, element, descriptionId, firstFocusableElement,\n focusableElements, labelId, lastFocusableElement, step, dataStepId;\n\n let hasCancelIcon, hasTitle, classes;\n\n $: {\n hasCancelIcon = step.options && step.options.cancelIcon && step.options.cancelIcon.enabled;\n hasTitle = step.options && step.options.title;\n }\n\n export const getElement = () => element;\n\n onMount(() => {\n // Get all elements that are focusable\n dataStepId = { [`data-${classPrefix}shepherd-step-id`]: step.id };\n focusableElements = element.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex=\"0\"]');\n firstFocusableElement = focusableElements[0];\n lastFocusableElement = focusableElements[focusableElements.length - 1];\n });\n\n afterUpdate(() => {\n if(classes !== step.options.classes) {\n updateDynamicClasses();\n }\n });\n\n function updateDynamicClasses() {\n removeClasses(classes);\n classes = step.options.classes;\n addClasses(classes);\n }\n\n function removeClasses(classes) {\n if (isString(classes)) {\n const oldClasses = getClassesArray(classes);\n if (oldClasses.length) {\n element.classList.remove(...oldClasses);\n }\n }\n }\n\n function addClasses(classes) {\n if(isString(classes)) {\n const newClasses = getClassesArray(classes);\n if (newClasses.length) {\n element.classList.add(...newClasses);\n }\n }\n }\n\n function getClassesArray(classes) {\n return classes.split(' ').filter(className => !!className.length);\n }\n\n /**\n * Setup keydown events to allow closing the modal with ESC\n *\n * Borrowed from this great post! https://bitsofco.de/accessible-modal-dialog/\n *\n * @private\n */\n const handleKeyDown = (e) => {\n const { tour } = step;\n switch (e.keyCode) {\n case KEY_TAB:\n if (focusableElements.length === 0) {\n e.preventDefault();\n break;\n }\n // Backward tab\n if (e.shiftKey) {\n if (document.activeElement === firstFocusableElement || document.activeElement.classList.contains('shepherd-element')) {\n e.preventDefault();\n lastFocusableElement.focus();\n }\n } else {\n if (document.activeElement === lastFocusableElement) {\n e.preventDefault();\n firstFocusableElement.focus();\n }\n }\n break;\n case KEY_ESC:\n if (tour.options.exitOnEsc) {\n step.cancel();\n }\n break;\n case LEFT_ARROW:\n if (tour.options.keyboardNavigation) {\n tour.back();\n }\n break;\n case RIGHT_ARROW:\n if (tour.options.keyboardNavigation) {\n tour.next();\n }\n break;\n default:\n break;\n }\n };\n</script>\n\n<style global>\n .shepherd-element {\n background: #fff;\n border-radius: 5px;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);\n max-width: 400px;\n opacity: 0;\n outline: none;\n transition: opacity 0.3s, visibility 0.3s;\n visibility: hidden;\n width: 100%;\n z-index: 9999;\n }\n\n .shepherd-enabled.shepherd-element {\n opacity: 1;\n visibility: visible;\n }\n\n .shepherd-element[data-popper-reference-hidden]:not(.shepherd-centered) {\n opacity: 0;\n pointer-events: none;\n visibility: hidden;\n }\n\n .shepherd-element, .shepherd-element *,\n .shepherd-element *:after,\n .shepherd-element *:before {\n box-sizing: border-box;\n }\n\n .shepherd-arrow,\n .shepherd-arrow::before {\n position: absolute;\n width: 16px;\n height: 16px;\n z-index: -1;\n }\n\n .shepherd-arrow:before {\n content: '';\n transform: rotate(45deg);\n background: #fff ;\n }\n\n .shepherd-element[data-popper-placement^='top'] > .shepherd-arrow {\n bottom: -8px;\n }\n\n .shepherd-element[data-popper-placement^='bottom'] > .shepherd-arrow {\n top: -8px;\n }\n\n .shepherd-element[data-popper-placement^='left'] > .shepherd-arrow {\n right: -8px;\n }\n\n .shepherd-element[data-popper-placement^='right'] > .shepherd-arrow {\n left: -8px;\n }\n\n .shepherd-element.shepherd-centered > .shepherd-arrow {\n opacity: 0;\n }\n\n\n /**\n * Arrow on top of tooltip centered horizontally, with title color\n */\n .shepherd-element.shepherd-has-title[data-popper-placement^='bottom'] > .shepherd-arrow::before {\n background-color: #e6e6e6;\n }\n\n .shepherd-target-click-disabled.shepherd-enabled.shepherd-target,\n .shepherd-target-click-disabled.shepherd-enabled.shepherd-target * {\n pointer-events: none;\n }\n</style>\n\n<div\n aria-describedby={!isUndefined(step.options.text) ? descriptionId : null}\n aria-labelledby={step.options.title ? labelId : null}\n bind:this={element}\n class:shepherd-has-cancel-icon=\"{hasCancelIcon}\"\n class:shepherd-has-title=\"{hasTitle}\"\n class:shepherd-element=\"{true}\"\n {...dataStepId}\n on:keydown={handleKeyDown}\n role=\"dialog\"\n tabindex=\"0\"\n>\n {#if step.options.arrow && step.options.attachTo && step.options.attachTo.element && step.options.attachTo.on}\n <div class=\"shepherd-arrow\" data-popper-arrow></div>\n {/if}\n <ShepherdContent\n {descriptionId}\n {labelId}\n {step}\n />\n</div>\n","/* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */\n(function () {\n 'use strict';\n\n // polyfill\n function polyfill() {\n // aliases\n var w = window;\n var d = document;\n\n // return if scroll behavior is supported and polyfill is not forced\n if (\n 'scrollBehavior' in d.documentElement.style &&\n w.__forceSmoothScrollPolyfill__ !== true\n ) {\n return;\n }\n\n // globals\n var Element = w.HTMLElement || w.Element;\n var SCROLL_TIME = 468;\n\n // object gathering original scroll methods\n var original = {\n scroll: w.scroll || w.scrollTo,\n scrollBy: w.scrollBy,\n elementScroll: Element.prototype.scroll || scrollElement,\n scrollIntoView: Element.prototype.scrollIntoView\n };\n\n // define timing method\n var now =\n w.performance && w.performance.now\n ? w.performance.now.bind(w.performance)\n : Date.now;\n\n /**\n * indicates if a the current browser is made by Microsoft\n * @method isMicrosoftBrowser\n * @param {String} userAgent\n * @returns {Boolean}\n */\n function isMicrosoftBrowser(userAgent) {\n var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];\n\n return new RegExp(userAgentPatterns.join('|')).test(userAgent);\n }\n\n /*\n * IE has rounding bug rounding down clientHeight and clientWidth and\n * rounding up scrollHeight and scrollWidth causing false positives\n * on hasScrollableSpace\n */\n var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;\n\n /**\n * changes scroll position inside an element\n * @method scrollElement\n * @param {Number} x\n * @param {Number} y\n * @returns {undefined}\n */\n function scrollElement(x, y) {\n this.scrollLeft = x;\n this.scrollTop = y;\n }\n\n /**\n * returns result of applying ease math function to a number\n * @method ease\n * @param {Number} k\n * @returns {Number}\n */\n function ease(k) {\n return 0.5 * (1 - Math.cos(Math.PI * k));\n }\n\n /**\n * indicates if a smooth behavior should be applied\n * @method shouldBailOut\n * @param {Number|Object} firstArg\n * @returns {Boolean}\n */\n function shouldBailOut(firstArg) {\n if (\n firstArg === null ||\n typeof firstArg !== 'object' ||\n firstArg.behavior === undefined ||\n firstArg.behavior === 'auto' ||\n firstArg.behavior === 'instant'\n ) {\n // first argument is not an object/null\n // or behavior is auto, instant or undefined\n return true;\n }\n\n if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {\n // first argument is an object and behavior is smooth\n return false;\n }\n\n // throw error when behavior is not supported\n throw new TypeError(\n 'behavior member of ScrollOptions ' +\n firstArg.behavior +\n ' is not a valid value for enumeration ScrollBehavior.'\n );\n }\n\n /**\n * indicates if an element has scrollable space in the provided axis\n * @method hasScrollableSpace\n * @param {Node} el\n * @param {String} axis\n * @returns {Boolean}\n */\n function hasScrollableSpace(el, axis) {\n if (axis === 'Y') {\n return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;\n }\n\n if (axis === 'X') {\n return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;\n }\n }\n\n /**\n * indicates if an element has a scrollable overflow property in the axis\n * @method canOverflow\n * @param {Node} el\n * @param {String} axis\n * @returns {Boolean}\n */\n function canOverflow(el, axis) {\n var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];\n\n return overflowValue === 'auto' || overflowValue === 'scroll';\n }\n\n /**\n * indicates if an element can be scrolled in either axis\n * @method isScrollable\n * @param {Node} el\n * @param {String} axis\n * @returns {Boolean}\n */\n function isScrollable(el) {\n var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');\n var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');\n\n return isScrollableY || isScrollableX;\n }\n\n /**\n * finds scrollable parent of an element\n * @method findScrollableParent\n * @param {Node} el\n * @returns {Node} el\n */\n function findScrollableParent(el) {\n while (el !== d.body && isScrollable(el) === false) {\n el = el.parentNode || el.host;\n }\n\n return el;\n }\n\n /**\n * self invoked function that, given a context, steps through scrolling\n * @method step\n * @param {Object} context\n * @returns {undefined}\n */\n function step(context) {\n var time = now();\n var value;\n var currentX;\n var currentY;\n var elapsed = (time - context.startTime) / SCROLL_TIME;\n\n // avoid elapsed times higher than one\n elapsed = elapsed > 1 ? 1 : elapsed;\n\n // apply easing to elapsed time\n value = ease(elapsed);\n\n currentX = context.startX + (context.x - context.startX) * value;\n currentY = context.startY + (context.y - context.startY) * value;\n\n context.method.call(context.scrollable, currentX, currentY);\n\n // scroll more if we have not reached our destination\n if (currentX !== context.x || currentY !== context.y) {\n w.requestAnimationFrame(step.bind(w, context));\n }\n }\n\n /**\n * scrolls window or element with a smooth behavior\n * @method smoothScroll\n * @param {Object|Node} el\n * @param {Number} x\n * @param {Number} y\n * @returns {undefined}\n */\n function smoothScroll(el, x, y) {\n var scrollable;\n var startX;\n var startY;\n var method;\n var startTime = now();\n\n // define scroll context\n if (el === d.body) {\n scrollable = w;\n startX = w.scrollX || w.pageXOffset;\n startY = w.scrollY || w.pageYOffset;\n method = original.scroll;\n } else {\n scrollable = el;\n startX = el.scrollLeft;\n startY = el.scrollTop;\n method = scrollElement;\n }\n\n // scroll looping over a frame\n step({\n scrollable: scrollable,\n method: method,\n startTime: startTime,\n startX: startX,\n startY: startY,\n x: x,\n y: y\n });\n }\n\n // ORIGINAL METHODS OVERRIDES\n // w.scroll and w.scrollTo\n w.scroll = w.scrollTo = function() {\n // avoid action when no arguments are passed\n if (arguments[0] === undefined) {\n return;\n }\n\n // avoid smooth behavior if not required\n if (shouldBailOut(arguments[0]) === true) {\n original.scroll.call(\n w,\n arguments[0].left !== undefined\n ? arguments[0].left\n : typeof arguments[0] !== 'object'\n ? arguments[0]\n : w.scrollX || w.pageXOffset,\n // use top prop, second argument if present or fallback to scrollY\n arguments[0].top !== undefined\n ? arguments[0].top\n : arguments[1] !== undefined\n ? arguments[1]\n : w.scrollY || w.pageYOffset\n );\n\n return;\n }\n\n // LET THE SMOOTHNESS BEGIN!\n smoothScroll.call(\n w,\n d.body,\n arguments[0].left !== undefined\n ? ~~arguments[0].left\n : w.scrollX || w.pageXOffset,\n arguments[0].top !== undefined\n ? ~~arguments[0].top\n : w.scrollY || w.pageYOffset\n );\n };\n\n // w.scrollBy\n w.scrollBy = function() {\n // avoid action when no arguments are passed\n if (arguments[0] === undefined) {\n return;\n }\n\n // avoid smooth behavior if not required\n if (shouldBailOut(arguments[0])) {\n original.scrollBy.call(\n w,\n arguments[0].left !== undefined\n ? arguments[0].left\n : typeof arguments[0] !== 'object' ? arguments[0] : 0,\n arguments[0].top !== undefined\n ? arguments[0].top\n : arguments[1] !== undefined ? arguments[1] : 0\n );\n\n return;\n }\n\n // LET THE SMOOTHNESS BEGIN!\n smoothScroll.call(\n w,\n d.body,\n ~~arguments[0].left + (w.scrollX || w.pageXOffset),\n ~~arguments[0].top + (w.scrollY || w.pageYOffset)\n );\n };\n\n // Element.prototype.scroll and Element.prototype.scrollTo\n Element.prototype.scroll = Element.prototype.scrollTo = function() {\n // avoid action when no arguments are passed\n if (arguments[0] === undefined) {\n return;\n }\n\n // avoid smooth behavior if not required\n if (shouldBailOut(arguments[0]) === true) {\n // if one number is passed, throw error to match Firefox implementation\n if (typeof arguments[0] === 'number' && arguments[1] === undefined) {\n throw new SyntaxError('Value could not be converted');\n }\n\n original.elementScroll.call(\n this,\n // use left prop, first number argument or fallback to scrollLeft\n arguments[0].left !== undefined\n ? ~~arguments[0].left\n : typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,\n // use top prop, second argument or fallback to scrollTop\n arguments[0].top !== undefined\n ? ~~arguments[0].top\n : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop\n );\n\n return;\n }\n\n var left = arguments[0].left;\n var top = arguments[0].top;\n\n // LET THE SMOOTHNESS BEGIN!\n smoothScroll.call(\n this,\n this,\n typeof left === 'undefined' ? this.scrollLeft : ~~left,\n typeof top === 'undefined' ? this.scrollTop : ~~top\n );\n };\n\n // Element.prototype.scrollBy\n Element.prototype.scrollBy = function() {\n // avoid action when no arguments are passed\n if (arguments[0] === undefined) {\n return;\n }\n\n // avoid smooth behavior if not required\n if (shouldBailOut(arguments[0]) === true) {\n original.elementScroll.call(\n this,\n arguments[0].left !== undefined\n ? ~~arguments[0].left + this.scrollLeft\n : ~~arguments[0] + this.scrollLeft,\n arguments[0].top !== undefined\n ? ~~arguments[0].top + this.scrollTop\n : ~~arguments[1] + this.scrollTop\n );\n\n return;\n }\n\n this.scroll({\n left: ~~arguments[0].left + this.scrollLeft,\n top: ~~arguments[0].top + this.scrollTop,\n behavior: arguments[0].behavior\n });\n };\n\n // Element.prototype.scrollIntoView\n Element.prototype.scrollIntoView = function() {\n // avoid smooth behavior if not required\n if (shouldBailOut(arguments[0]) === true) {\n original.scrollIntoView.call(\n this,\n arguments[0] === undefined ? true : arguments[0]\n );\n\n return;\n }\n\n // LET THE SMOOTHNESS BEGIN!\n var scrollableParent = findScrollableParent(this);\n var parentRects = scrollableParent.getBoundingClientRect();\n var clientRects = this.getBoundingClientRect();\n\n if (scrollableParent !== d.body) {\n // reveal element inside parent\n smoothScroll.call(\n this,\n scrollableParent,\n scrollableParent.scrollLeft + clientRects.left - parentRects.left,\n scrollableParent.scrollTop + clientRects.top - parentRects.top\n );\n\n // reveal parent in viewport unless is fixed\n if (w.getComputedStyle(scrollableParent).position !== 'fixed') {\n w.scrollBy({\n left: parentRects.left,\n top: parentRects.top,\n behavior: 'smooth'\n });\n }\n } else {\n // reveal element in viewport\n w.scrollBy({\n left: clientRects.left,\n top: clientRects.top,\n behavior: 'smooth'\n });\n }\n };\n }\n\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n // commonjs\n module.exports = { polyfill: polyfill };\n } else {\n // global\n polyfill();\n }\n\n}());\n","import merge from 'deepmerge';\nimport { Evented } from './evented.js';\nimport autoBind from './utils/auto-bind.js';\nimport { isElement, isHTMLElement, isFunction, isUndefined } from './utils/type-check.js';\nimport { bindAdvance } from './utils/bind.js';\nimport {\n setupTooltip,\n parseAttachTo,\n normalizePrefix,\n uuid\n} from './utils/general.js';\nimport ShepherdElement from './components/shepherd-element.svelte';\n\n// Polyfills\nimport smoothscroll from 'smoothscroll-polyfill';\nsmoothscroll.polyfill();\n\n/**\n * A class representing steps to be added to a tour.\n * @extends {Evented}\n */\nexport class Step extends Evented {\n /**\n * Create a step\n * @param {Tour} tour The tour for the step\n * @param {object} options The options for the step\n * @param {boolean} options.arrow Whether to display the arrow for the tooltip or not. Defaults to `true`.\n * @param {object} options.attachTo The element the step should be attached to on the page.\n * An object with properties `element` and `on`.\n *\n * ```js\n * const step = new Step(tour, {\n * attachTo: { element: '.some .selector-path', on: 'left' },\n * ...moreOptions\n * });\n * ```\n *\n * If you don’t specify an attachTo the element will appear in the middle of the screen.\n * If you omit the `on` portion of `attachTo`, the element will still be highlighted, but the tooltip will appear\n * in the middle of the screen, without an arrow pointing to the target.\n * @param {HTMLElement|string} options.attachTo.element An element selector string or a DOM element.\n * @param {string} options.attachTo.on The optional direction to place the Popper tooltip relative to the element.\n * - Possible string values: 'auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end'\n * @param {Object} options.advanceOn An action on the page which should advance shepherd to the next step.\n * It should be an object with a string `selector` and an `event` name\n * ```js\n * const step = new Step(tour, {\n * advanceOn: { selector: '.some .selector-path', event: 'click' },\n * ...moreOptions\n * });\n * ```\n * `event` doesn’t have to be an event inside the tour, it can be any event fired on any element on the page.\n * You can also always manually advance the Tour by calling `myTour.next()`.\n * @param {function} options.beforeShowPromise A function that returns a promise.\n * When the promise resolves, the rest of the `show` code for the step will execute.\n * @param {Object[]} options.buttons An array of buttons to add to the step. These will be rendered in a\n * footer below the main body text.\n * @param {function} options.buttons.button.action A function executed when the button is clicked on.\n * It is automatically bound to the `tour` the step is associated with, so things like `this.next` will\n * work inside the action.\n * You can use action to skip steps or navigate to specific steps, with something like:\n * ```js\n * action() {\n * return this.show('some_step_name');\n * }\n * ```\n * @param {string} options.buttons.button.classes Extra classes to apply to the `<a>`\n * @param {boolean} options.buttons.button.disabled Should the button be disabled?\n * @param {string} options.buttons.button.label The aria-label text of the button\n * @param {boolean} options.buttons.button.secondary If true, a shepherd-button-secondary class is applied to the button\n * @param {string} options.buttons.button.text The HTML text of the button\n * @param {boolean} options.canClickTarget A boolean, that when set to false, will set `pointer-events: none` on the target\n * @param {object} options.cancelIcon Options for the cancel icon\n * @param {boolean} options.cancelIcon.enabled Should a cancel “✕” be shown in the header of the step?\n * @param {string} options.cancelIcon.label The label to add for `aria-label`\n * @param {string} options.classes A string of extra classes to add to the step's content element.\n * @param {string} options.highlightClass An extra class to apply to the `attachTo` element when it is\n * highlighted (that is, when its step is active). You can then target that selector in your CSS.\n * @param {string} options.id The string to use as the `id` for the step.\n * @param {number} options.modalOverlayOpeningPadding An amount of padding to add around the modal overlay opening\n * @param {number} options.modalOverlayOpeningRadius An amount of border radius to add around the modal overlay opening\n * @param {object} options.popperOptions Extra options to pass to Popper\n * @param {boolean|Object} options.scrollTo Should the element be scrolled to when this step is shown? If true, uses the default `scrollIntoView`,\n * if an object, passes that object as the params to `scrollIntoView` i.e. `{behavior: 'smooth', block: 'center'}`\n * @param {function} options.scrollToHandler A function that lets you override the default scrollTo behavior and\n * define a custom action to do the scrolling, and possibly other logic.\n * @param {function} options.showOn A function that, when it returns `true`, will show the step.\n * If it returns false, the step will be skipped.\n * @param {string} options.text The text in the body of the step. It can be one of three types:\n * ```\n * - HTML string\n * - `HTMLElement` object\n * - `Function` to be executed when the step is built. It must return one the two options above.\n * ```\n * @param {string} options.title The step's title. It becomes an `h3` at the top of the step. It can be one of two types:\n * ```\n * - HTML string\n * - `Function` to be executed when the step is built. It must return HTML string.\n * ```\n * @param {object} options.when You can define `show`, `hide`, etc events inside `when`. For example:\n * ```js\n * when: {\n * show: function() {\n * window.scrollTo(0, 0);\n * }\n * }\n * ```\n * @return {Step} The newly created Step instance\n */\n constructor(tour, options = {}) {\n super(tour, options);\n this.tour = tour;\n this.classPrefix = this.tour.options\n ? normalizePrefix(this.tour.options.classPrefix)\n : '';\n this.styles = tour.styles;\n\n autoBind(this);\n\n this._setOptions(options);\n\n return this;\n }\n\n /**\n * Cancel the tour\n * Triggers the `cancel` event\n */\n cancel() {\n this.tour.cancel();\n this.trigger('cancel');\n }\n\n /**\n * Complete the tour\n * Triggers the `complete` event\n */\n complete() {\n this.tour.complete();\n this.trigger('complete');\n }\n\n /**\n * Remove the step, delete the step's element, and destroy the Popper instance for the step.\n * Triggers `destroy` event\n */\n destroy() {\n if (this.tooltip) {\n this.tooltip.destroy();\n this.tooltip = null;\n }\n\n if (isHTMLElement(this.el) && this.el.parentNode) {\n this.el.parentNode.removeChild(this.el);\n this.el = null;\n }\n\n this._updateStepTargetOnHide();\n\n this.trigger('destroy');\n }\n\n /**\n * Returns the tour for the step\n * @return {Tour} The tour instance\n */\n getTour() {\n return this.tour;\n }\n\n /**\n * Hide the step\n */\n hide() {\n this.tour.modal.hide();\n\n this.trigger('before-hide');\n\n if (this.el) {\n this.el.hidden = true;\n }\n\n this._updateStepTargetOnHide();\n\n this.trigger('hide');\n }\n\n /**\n * Checks if the step should be centered or not\n * @return {boolean} True if the step is centered\n */\n isCentered() {\n const attachToOptions = parseAttachTo(this);\n return !attachToOptions.element || !attachToOptions.on;\n }\n\n /**\n * Check if the step is open and visible\n * @return {boolean} True if the step is open and visible\n */\n isOpen() {\n return Boolean(this.el && !this.el.hidden);\n }\n\n /**\n * Wraps `_show` and ensures `beforeShowPromise` resolves before calling show\n * @return {*|Promise}\n */\n show() {\n if (isFunction(this.options.beforeShowPromise)) {\n const beforeShowPromise = this.options.beforeShowPromise();\n if (!isUndefined(beforeShowPromise)) {\n return beforeShowPromise.then(() => this._show());\n }\n }\n this._show();\n }\n\n /**\n * Updates the options of the step.\n *\n * @param {Object} options The options for the step\n */\n updateStepOptions(options) {\n Object.assign(this.options, options);\n\n if (this.shepherdElementComponent) {\n this.shepherdElementComponent.$set({ step: this });\n }\n }\n\n /**\n * Returns the element for the step\n * @return {HTMLElement|null|undefined} The element instance. undefined if it has never been shown, null if it has been destroyed\n */\n getElement() {\n return this.el;\n }\n\n /**\n * Returns the target for the step\n * @return {HTMLElement|null|undefined} The element instance. undefined if it has never been shown, null if query string has not been found\n */\n getTarget() {\n return this.target;\n }\n\n /**\n * Creates Shepherd element for step based on options\n *\n * @return {Element} The DOM element for the step tooltip\n * @private\n */\n _createTooltipContent() {\n const descriptionId = `${this.id}-description`;\n const labelId = `${this.id}-label`;\n\n this.shepherdElementComponent = new ShepherdElement({\n target: this.tour.options.stepsContainer || document.body,\n props: {\n classPrefix: this.classPrefix,\n descriptionId,\n labelId,\n step: this,\n styles: this.styles\n }\n });\n\n return this.shepherdElementComponent.getElement();\n }\n\n /**\n * If a custom scrollToHandler is defined, call that, otherwise do the generic\n * scrollIntoView call.\n *\n * @param {boolean|Object} scrollToOptions If true, uses the default `scrollIntoView`,\n * if an object, passes that object as the params to `scrollIntoView` i.e. `{ behavior: 'smooth', block: 'center' }`\n * @private\n */\n _scrollTo(scrollToOptions) {\n const { element } = parseAttachTo(this);\n\n if (isFunction(this.options.scrollToHandler)) {\n this.options.scrollToHandler(element);\n } else if (\n isElement(element) &&\n typeof element.scrollIntoView === 'function'\n ) {\n element.scrollIntoView(scrollToOptions);\n }\n }\n\n /**\n * _getClassOptions gets all possible classes for the step\n * @param {Object} stepOptions The step specific options\n * @returns {String} unique string from array of classes\n * @private\n */\n _getClassOptions(stepOptions) {\n const defaultStepOptions =\n this.tour && this.tour.options && this.tour.options.defaultStepOptions;\n const stepClasses = stepOptions.classes ? stepOptions.classes : '';\n const defaultStepOptionsClasses =\n defaultStepOptions && defaultStepOptions.classes\n ? defaultStepOptions.classes\n : '';\n const allClasses = [\n ...stepClasses.split(' '),\n ...defaultStepOptionsClasses.split(' ')\n ];\n const uniqClasses = new Set(allClasses);\n\n return Array.from(uniqClasses).join(' ').trim();\n }\n\n /**\n * Sets the options for the step, maps `when` to events, sets up buttons\n * @param {Object} options The options for the step\n * @private\n */\n _setOptions(options = {}) {\n let tourOptions =\n this.tour && this.tour.options && this.tour.options.defaultStepOptions;\n\n tourOptions = merge({}, tourOptions || {});\n\n this.options = Object.assign(\n {\n arrow: true\n },\n tourOptions,\n options\n );\n\n const { when } = this.options;\n\n this.options.classes = this._getClassOptions(options);\n\n this.destroy();\n this.id = this.options.id || `step-${uuid()}`;\n\n if (when) {\n Object.keys(when).forEach((event) => {\n this.on(event, when[event], this);\n });\n }\n }\n\n /**\n * Create the element and set up the Popper instance\n * @private\n */\n _setupElements() {\n if (!isUndefined(this.el)) {\n this.destroy();\n }\n\n this.el = this._createTooltipContent();\n\n if (this.options.advanceOn) {\n bindAdvance(this);\n }\n setupTooltip(this);\n }\n\n /**\n * Triggers `before-show`, generates the tooltip DOM content,\n * sets up a Popper instance for the tooltip, then triggers `show`.\n * @private\n */\n _show() {\n this.trigger('before-show');\n\n this._setupElements();\n\n if (!this.tour.modal) {\n this.tour._setupModal();\n }\n\n this.tour.modal.setupForStep(this);\n this._styleTargetElementForStep(this);\n this.el.hidden = false;\n\n // start scrolling to target before showing the step\n if (this.options.scrollTo) {\n setTimeout(() => {\n this._scrollTo(this.options.scrollTo);\n });\n }\n\n this.el.hidden = false;\n\n const content = this.shepherdElementComponent.getElement();\n const target = this.target || document.body;\n target.classList.add(`${this.classPrefix}shepherd-enabled`);\n target.classList.add(`${this.classPrefix}shepherd-target`);\n content.classList.add('shepherd-enabled');\n\n this.trigger('show');\n }\n\n /**\n * Modulates the styles of the passed step's target element, based on the step's options and\n * the tour's `modal` option, to visually emphasize the element\n *\n * @param step The step object that attaches to the element\n * @private\n */\n _styleTargetElementForStep(step) {\n const targetElement = step.target;\n\n if (!targetElement) {\n return;\n }\n\n if (step.options.highlightClass) {\n targetElement.classList.add(step.options.highlightClass);\n }\n\n if (step.options.canClickTarget === false) {\n targetElement.classList.add('shepherd-target-click-disabled');\n }\n }\n\n /**\n * When a step is hidden, remove the highlightClass and 'shepherd-enabled'\n * and 'shepherd-target' classes\n * @private\n */\n _updateStepTargetOnHide() {\n const target = this.target || document.body;\n\n if (this.options.highlightClass) {\n target.classList.remove(this.options.highlightClass);\n }\n\n target.classList.remove(\n 'shepherd-target-click-disabled',\n `${this.classPrefix}shepherd-enabled`,\n `${this.classPrefix}shepherd-target`\n );\n }\n}\n","/**\n * Cleanup the steps and set pointerEvents back to 'auto'\n * @param tour The tour object\n */\nexport function cleanupSteps(tour) {\n if (tour) {\n const { steps } = tour;\n\n steps.forEach((step) => {\n if (step.options && step.options.canClickTarget === false && step.options.attachTo) {\n if (step.target instanceof HTMLElement) {\n step.target.classList.remove('shepherd-target-click-disabled');\n }\n }\n });\n }\n}\n","/**\n * Generates the svg path data for a rounded rectangle overlay\n * @param {Object} dimension - Dimensions of rectangle.\n * @param {number} width - Width.\n * @param {number} height - Height.\n * @param {number} [x=0] - Offset from top left corner in x axis. default 0.\n * @param {number} [y=0] - Offset from top left corner in y axis. default 0.\n * @param {number} [r=0] - Corner Radius. Keep this smaller than half of width or height.\n * @returns {string} - Rounded rectangle overlay path data.\n */\nexport function makeOverlayPath({ width, height, x = 0, y = 0, r = 0 }) {\n const { innerWidth: w, innerHeight: h } = window;\n\n return `M${w},${h}\\\nH0\\\nV0\\\nH${w}\\\nV${h}\\\nZ\\\nM${x + r},${y}\\\na${r},${r},0,0,0-${r},${r}\\\nV${height + y - r}\\\na${r},${r},0,0,0,${r},${r}\\\nH${width + x - r}\\\na${r},${r},0,0,0,${r}-${r}\\\nV${y + r}\\\na${r},${r},0,0,0-${r}-${r}\\\nZ`;\n}\n","<script>\n import { uuid } from '../utils/general.js';\n import { makeOverlayPath } from '../utils/overlay-path.js';\n\n export let element, openingProperties;\n const guid = uuid();\n let modalIsVisible = false;\n let rafId = undefined;\n let pathDefinition;\n\n $: pathDefinition = makeOverlayPath(openingProperties);\n\n closeModalOpening();\n\n export const getElement = () => element;\n\n export function closeModalOpening() {\n openingProperties = {\n width: 0,\n height: 0,\n x: 0,\n y: 0,\n r: 0\n };\n }\n\n /**\n * Hide the modal overlay\n */\n export function hide() {\n modalIsVisible = false;\n\n // Ensure we cleanup all event listeners when we hide the modal\n _cleanupStepEventListeners();\n }\n\n /**\n * Uses the bounds of the element we want the opening overtop of to set the dimensions of the opening and position it\n * @param {Number} modalOverlayOpeningPadding An amount of padding to add around the modal overlay opening\n * @param {Number} modalOverlayOpeningRadius An amount of border radius to add around the modal overlay opening\n * @param {HTMLElement} scrollParent The scrollable parent of the target element\n * @param {HTMLElement} targetElement The element the opening will expose\n */\n export function positionModal(\n modalOverlayOpeningPadding = 0,\n modalOverlayOpeningRadius = 0,\n scrollParent,\n targetElement\n ) {\n if (targetElement) {\n const { y, height } = _getVisibleHeight(targetElement, scrollParent);\n const { x, width, left } = targetElement.getBoundingClientRect();\n\n // getBoundingClientRect is not consistent. Some browsers use x and y, while others use left and top\n openingProperties = {\n width: width + modalOverlayOpeningPadding * 2,\n height: height + modalOverlayOpeningPadding * 2,\n x: (x || left) - modalOverlayOpeningPadding,\n y: y - modalOverlayOpeningPadding,\n r: modalOverlayOpeningRadius\n };\n } else {\n closeModalOpening();\n }\n }\n\n /**\n * If modal is enabled, setup the svg mask opening and modal overlay for the step\n * @param {Step} step The step instance\n */\n export function setupForStep(step) {\n // Ensure we move listeners from the previous step, before we setup new ones\n _cleanupStepEventListeners();\n\n if (step.tour.options.useModalOverlay) {\n _styleForStep(step);\n show();\n } else {\n hide();\n }\n }\n\n /**\n * Show the modal overlay\n */\n export function show() {\n modalIsVisible = true;\n }\n\n const _preventModalBodyTouch = (e) => {\n e.preventDefault();\n };\n\n const _preventModalOverlayTouch = (e) => {\n e.stopPropagation();\n };\n\n /**\n * Add touchmove event listener\n * @private\n */\n function _addStepEventListeners() {\n // Prevents window from moving on touch.\n window.addEventListener('touchmove', _preventModalBodyTouch, {\n passive: false\n });\n }\n\n /**\n * Cancel the requestAnimationFrame loop and remove touchmove event listeners\n * @private\n */\n function _cleanupStepEventListeners() {\n if (rafId) {\n cancelAnimationFrame(rafId);\n rafId = undefined;\n }\n\n window.removeEventListener('touchmove', _preventModalBodyTouch, {\n passive: false\n });\n }\n\n /**\n * Style the modal for the step\n * @param {Step} step The step to style the opening for\n * @private\n */\n function _styleForStep(step) {\n const {\n modalOverlayOpeningPadding,\n modalOverlayOpeningRadius\n } = step.options;\n\n const scrollParent = _getScrollParent(step.target);\n\n // Setup recursive function to call requestAnimationFrame to update the modal opening position\n const rafLoop = () => {\n rafId = undefined;\n positionModal(\n modalOverlayOpeningPadding,\n modalOverlayOpeningRadius,\n scrollParent,\n step.target\n );\n rafId = requestAnimationFrame(rafLoop);\n };\n\n rafLoop();\n\n _addStepEventListeners();\n }\n\n /**\n * Find the closest scrollable parent element\n * @param {HTMLElement} element The target element\n * @returns {HTMLElement}\n * @private\n */\n function _getScrollParent(element) {\n if (!element) {\n return null;\n }\n\n const isHtmlElement = element instanceof HTMLElement;\n const overflowY =\n isHtmlElement && window.getComputedStyle(element).overflowY;\n const isScrollable = overflowY !== 'hidden' && overflowY !== 'visible';\n\n if (isScrollable && element.scrollHeight >= element.clientHeight) {\n return element;\n }\n\n return _getScrollParent(element.parentElement);\n }\n\n /**\n * Get the visible height of the target element relative to its scrollParent.\n * If there is no scroll parent, the height of the element is returned.\n *\n * @param {HTMLElement} element The target element\n * @param {HTMLElement} [scrollParent] The scrollable parent element\n * @returns {{y: number, height: number}}\n * @private\n */\n function _getVisibleHeight(element, scrollParent) {\n const elementRect = element.getBoundingClientRect();\n let top = elementRect.y || elementRect.top;\n let bottom = elementRect.bottom || top + elementRect.height;\n\n if (scrollParent) {\n const scrollRect = scrollParent.getBoundingClientRect();\n const scrollTop = scrollRect.y || scrollRect.top;\n const scrollBottom = scrollRect.bottom || scrollTop + scrollRect.height;\n\n top = Math.max(top, scrollTop);\n bottom = Math.min(bottom, scrollBottom);\n }\n\n const height = Math.max(bottom - top, 0); // Default to 0 if height is negative\n\n return { y: top, height };\n }\n</script>\n\n<svg\n bind:this={element}\n class={`${\n modalIsVisible ? 'shepherd-modal-is-visible' : ''\n } shepherd-modal-overlay-container`}\n on:touchmove={_preventModalOverlayTouch}\n>\n <path d={pathDefinition} />\n</svg>\n\n<style global>\n .shepherd-modal-overlay-container {\n -ms-filter: progid:dximagetransform.microsoft.gradient.alpha(Opacity=50);\n filter: alpha(opacity=50);\n height: 0;\n left: 0;\n opacity: 0;\n overflow: hidden;\n pointer-events: none;\n position: fixed;\n top: 0;\n transition: all 0.3s ease-out, height 0ms 0.3s, opacity 0.3s 0ms;\n width: 100vw;\n z-index: 9997;\n }\n\n .shepherd-modal-overlay-container.shepherd-modal-is-visible {\n height: 100vh;\n opacity: 0.5;\n transition: all 0.3s ease-out, height 0s 0s, opacity 0.3s 0s;\n }\n\n .shepherd-modal-overlay-container.shepherd-modal-is-visible path {\n pointer-events: all;\n }\n</style>\n","import { Evented } from './evented.js';\nimport { Step } from './step.js';\nimport autoBind from './utils/auto-bind.js';\nimport { isHTMLElement, isFunction, isString, isUndefined } from './utils/type-check.js';\nimport { cleanupSteps } from './utils/cleanup.js';\nimport { normalizePrefix, uuid } from './utils/general.js';\nimport ShepherdModal from './components/shepherd-modal.svelte';\n\nconst Shepherd = new Evented();\n\n/**\n * Class representing the site tour\n * @extends {Evented}\n */\nexport class Tour extends Evented {\n /**\n * @param {Object} options The options for the tour\n * @param {boolean} options.confirmCancel If true, will issue a `window.confirm` before cancelling\n * @param {string} options.confirmCancelMessage The message to display in the confirm dialog\n * @param {string} options.classPrefix The prefix to add to the `shepherd-enabled` and `shepherd-target` class names as well as the `data-shepherd-step-id`.\n * @param {Object} options.defaultStepOptions Default options for Steps ({@link Step#constructor}), created through `addStep`\n * @param {boolean} options.exitOnEsc Exiting the tour with the escape key will be enabled unless this is explicitly\n * set to false.\n * @param {boolean} options.keyboardNavigation Navigating the tour via left and right arrow keys will be enabled\n * unless this is explicitly set to false.\n * @param {HTMLElement} options.stepsContainer An optional container element for the steps.\n * If not set, the steps will be appended to `document.body`.\n * @param {HTMLElement} options.modalContainer An optional container element for the modal.\n * If not set, the modal will be appended to `document.body`.\n * @param {object[] | Step[]} options.steps An array of step options objects or Step instances to initialize the tour with\n * @param {string} options.tourName An optional \"name\" for the tour. This will be appended to the the tour's\n * dynamically generated `id` property -- which is also set on the `body` element as the `data-shepherd-active-tour` attribute\n * whenever the tour becomes active.\n * @param {boolean} options.useModalOverlay Whether or not steps should be placed above a darkened\n * modal overlay. If true, the overlay will create an opening around the target element so that it\n * can remain interactive\n * @returns {Tour}\n */\n constructor(options = {}) {\n super(options);\n\n autoBind(this);\n\n const defaultTourOptions = {\n exitOnEsc: true,\n keyboardNavigation: true\n };\n\n this.options = Object.assign({}, defaultTourOptions, options);\n this.classPrefix = normalizePrefix(this.options.classPrefix);\n this.steps = [];\n this.addSteps(this.options.steps);\n\n // Pass these events onto the global Shepherd object\n const events = ['active', 'cancel', 'complete', 'inactive', 'show', 'start'];\n events.map((event) => {\n ((e) => {\n this.on(e, (opts) => {\n opts = opts || {};\n opts.tour = this;\n Shepherd.trigger(e, opts);\n });\n })(event);\n });\n\n this._setTourID();\n\n return this;\n }\n\n /**\n * Adds a new step to the tour\n * @param {Object|Step} options An object containing step options or a Step instance\n * @param {number} index The optional index to insert the step at. If undefined, the step\n * is added to the end of the array.\n * @return {Step} The newly added step\n */\n addStep(options, index) {\n let step = options;\n\n if (!(step instanceof Step)) {\n step = new Step(this, step);\n } else {\n step.tour = this;\n }\n\n if (!isUndefined(index)) {\n this.steps.splice(index, 0, step);\n } else {\n this.steps.push(step);\n }\n\n return step;\n }\n\n /**\n * Add multiple steps to the tour\n * @param {Array<object> | Array<Step>} steps The steps to add to the tour\n */\n addSteps(steps) {\n if (Array.isArray(steps)) {\n steps.forEach((step) => {\n this.addStep(step);\n });\n }\n\n return this;\n }\n\n /**\n * Go to the previous step in the tour\n */\n back() {\n const index = this.steps.indexOf(this.currentStep);\n this.show(index - 1, false);\n }\n\n /**\n * Calls _done() triggering the 'cancel' event\n * If `confirmCancel` is true, will show a window.confirm before cancelling\n */\n cancel() {\n if (this.options.confirmCancel) {\n const cancelMessage = this.options.confirmCancelMessage || 'Are you sure you want to stop the tour?';\n const stopTour = window.confirm(cancelMessage);\n if (stopTour) {\n this._done('cancel');\n }\n } else {\n this._done('cancel');\n }\n }\n\n /**\n * Calls _done() triggering the `complete` event\n */\n complete() {\n this._done('complete');\n }\n\n /**\n * Gets the step from a given id\n * @param {Number|String} id The id of the step to retrieve\n * @return {Step} The step corresponding to the `id`\n */\n getById(id) {\n return this.steps.find((step) => {\n return step.id === id;\n });\n }\n\n /**\n * Gets the current step\n * @returns {Step|null}\n */\n getCurrentStep() {\n return this.currentStep;\n }\n\n /**\n * Hide the current step\n */\n hide() {\n const currentStep = this.getCurrentStep();\n\n if (currentStep) {\n return currentStep.hide();\n }\n }\n\n /**\n * Check if the tour is active\n * @return {boolean}\n */\n isActive() {\n return Shepherd.activeTour === this;\n }\n\n /**\n * Go to the next step in the tour\n * If we are at the end, call `complete`\n */\n next() {\n const index = this.steps.indexOf(this.currentStep);\n\n if (index === this.steps.length - 1) {\n this.complete();\n } else {\n this.show(index + 1, true);\n }\n }\n\n /**\n * Removes the step from the tour\n * @param {String} name The id for the step to remove\n */\n removeStep(name) {\n const current = this.getCurrentStep();\n\n // Find the step, destroy it and remove it from this.steps\n this.steps.some((step, i) => {\n if (step.id === name) {\n if (step.isOpen()) {\n step.hide();\n }\n\n step.destroy();\n this.steps.splice(i, 1);\n\n return true;\n }\n });\n\n if (current && current.id === name) {\n this.currentStep = undefined;\n\n // If we have steps left, show the first one, otherwise just cancel the tour\n this.steps.length ? this.show(0) : this.cancel();\n }\n }\n\n /**\n * Show a specific step in the tour\n * @param {Number|String} key The key to look up the step by\n * @param {Boolean} forward True if we are going forward, false if backward\n */\n show(key = 0, forward = true) {\n const step = isString(key) ? this.getById(key) : this.steps[key];\n\n if (step) {\n this._updateStateBeforeShow();\n\n const shouldSkipStep = isFunction(step.options.showOn) && !step.options.showOn();\n\n // If `showOn` returns false, we want to skip the step, otherwise, show the step like normal\n if (shouldSkipStep) {\n this._skipStep(step, forward);\n } else {\n this.trigger('show', {\n step,\n previous: this.currentStep\n });\n\n this.currentStep = step;\n step.show();\n }\n }\n }\n\n /**\n * Start the tour\n */\n start() {\n this.trigger('start');\n\n // Save the focused element before the tour opens\n this.focusedElBeforeOpen = document.activeElement;\n\n this.currentStep = null;\n\n this._setupModal();\n\n this._setupActiveTour();\n this.next();\n }\n\n /**\n * Called whenever the tour is cancelled or completed, basically anytime we exit the tour\n * @param {String} event The event name to trigger\n * @private\n */\n _done(event) {\n const index = this.steps.indexOf(this.currentStep);\n if (Array.isArray(this.steps)) {\n this.steps.forEach((step) => step.destroy());\n }\n\n cleanupSteps(this);\n\n this.trigger(event, { index });\n\n Shepherd.activeTour = null;\n this.trigger('inactive', { tour: this });\n\n if (this.modal) {\n this.modal.hide();\n }\n\n if (event === 'cancel' || event === 'complete') {\n if (this.modal) {\n const modalContainer = document.querySelector('.shepherd-modal-overlay-container');\n\n if (modalContainer) {\n modalContainer.remove();\n }\n }\n }\n\n // Focus the element that was focused before the tour started\n if (isHTMLElement(this.focusedElBeforeOpen)) {\n this.focusedElBeforeOpen.focus();\n }\n }\n\n /**\n * Make this tour \"active\"\n * @private\n */\n _setupActiveTour() {\n this.trigger('active', { tour: this });\n\n Shepherd.activeTour = this;\n }\n\n /**\n * _setupModal create the modal container and instance\n * @private\n */\n _setupModal() {\n this.modal = new ShepherdModal({\n target: this.options.modalContainer || document.body,\n props:\n {\n classPrefix: this.classPrefix,\n styles: this.styles\n }\n });\n }\n\n /**\n * Called when `showOn` evaluates to false, to skip the step\n * @param {Step} step The step to skip\n * @param {Boolean} forward True if we are going forward, false if backward\n * @private\n */\n _skipStep(step, forward) {\n const index = this.steps.indexOf(step);\n const nextIndex = forward ? index + 1 : index - 1;\n this.show(nextIndex, forward);\n }\n\n /**\n * Before showing, hide the current step and if the tour is not\n * already active, call `this._setupActiveTour`.\n * @private\n */\n _updateStateBeforeShow() {\n if (this.currentStep) {\n this.currentStep.hide();\n }\n\n if (!this.isActive()) {\n this._setupActiveTour();\n }\n }\n\n /**\n * Sets this.id to `${tourName}--${uuid}`\n * @private\n */\n _setTourID() {\n const tourName = this.options.tourName || 'tour';\n\n this.id = `${tourName}--${uuid()}`;\n }\n}\n\nexport { Shepherd };\n","import { Step } from './step.js';\nimport { Shepherd, Tour } from './tour.js';\n\nObject.assign(Shepherd, { Tour, Step });\n\nexport default Shepherd;\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","Object","prototype","toString","call","isReactElement","canUseSymbol","Symbol","for","REACT_ELEMENT_TYPE","$$typeof","emptyTarget","val","Array","isArray","cloneUnlessOtherwiseSpecified","options","clone","deepmerge","defaultArrayMerge","target","source","concat","map","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","getOwnPropertySymbols","filter","symbol","propertyIsEnumerable","getKeys","keys","propertyIsOnObject","object","property","_","propertyIsUnsafe","hasOwnProperty","mergeObject","destination","forEach","arrayMerge","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","all","deepmergeAll","array","Error","reduce","prev","next","deepmerge_1","isElement","Element","isHTMLElement","HTMLElement","isFunction","isString","isUndefined","undefined","Evented","on","event","handler","ctx","once","bindings","push","off","binding","index","splice","trigger","args","context","apply","autoBind","self","getOwnPropertyNames","constructor","i","length","bind","_setupAdvanceOnHandler","selector","step","isOpen","targetIsEl","el","currentTarget","targetIsSelector","matches","tour","bindAdvance","advanceOn","document","querySelector","e","console","error","addEventListener","removeEventListener","body","top","bottom","right","left","auto","basePlacements","start","end","clippingParents","viewport","popper","reference","variationPlacements","acc","placement","placements","beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite","modifierPhases","getNodeName","nodeName","toLowerCase","getWindow","node","window","ownerDocument","defaultView","OwnElement","isShadowRoot","ShadowRoot","applyStyles","_ref","state","elements","name","style","styles","attributes","assign","removeAttribute","setAttribute","effect","_ref2","initialStyles","position","strategy","margin","arrow","styleProperties","attribute","enabled","phase","fn","requires","getBasePlacement","split","getBoundingClientRect","rect","width","height","x","y","getLayoutRect","clientRect","offsetWidth","offsetHeight","Math","abs","offsetLeft","offsetTop","contains","parent","child","rootNode","getRootNode","isSameNode","parentNode","host","getComputedStyle","isTableElement","indexOf","getDocumentElement","documentElement","getParentNode","assignedSlot","getTrueOffsetParent","offsetParent","getContainingBlock","isFirefox","navigator","userAgent","currentNode","css","transform","perspective","contain","willChange","getOffsetParent","getMainAxisFromPlacement","max","min","round","within","mathMax","mathMin","getFreshSideObject","mergePaddingObject","paddingObject","expandToHashMap","hashMap","toPaddingObject","padding","rects","_state$modifiersData$","arrowElement","popperOffsets","modifiersData","basePlacement","axis","isVertical","len","arrowRect","minProp","maxProp","endDiff","startDiff","arrowOffsetParent","clientSize","clientHeight","clientWidth","centerToReference","center","offset","axisProp","centerOffset","_options$element","requiresIfExists","unsetSides","roundOffsetsByDPR","win","dpr","devicePixelRatio","mapToStyles","_Object$assign2","popperRect","offsets","gpuAcceleration","adaptive","roundOffsets","_ref3","_ref3$x","_ref3$y","hasX","hasY","sideX","sideY","heightProp","widthProp","commonStyles","_Object$assign","computeStyles","_ref4","_options$gpuAccelerat","_options$adaptive","_options$roundOffsets","data","passive","instance","_options$scroll","scroll","_options$resize","resize","scrollParents","scrollParent","update","hash","getOppositePlacement","replace","matched","getOppositeVariationPlacement","getWindowScroll","scrollLeft","pageXOffset","scrollTop","pageYOffset","getWindowScrollBarX","getViewportRect","html","visualViewport","test","getDocumentRect","_element$ownerDocumen","winScroll","scrollWidth","scrollHeight","direction","isScrollParent","_getComputedStyle","overflow","overflowX","overflowY","getScrollParent","listScrollParents","list","isBody","updatedList","rectToClientRect","getInnerBoundingClientRect","clientTop","clientLeft","getClientRectFromMixedType","clippingParent","getClippingParents","canEscapeClipping","clipperElement","getClippingRect","boundary","rootBoundary","mainClippingParents","firstClippingParent","clippingRect","accRect","getVariation","computeOffsets","variation","commonX","commonY","mainAxis","detectOverflow","_options","_options$placement","_options$boundary","_options$rootBoundary","_options$elementConte","elementContext","_options$altBoundary","altBoundary","_options$padding","altContext","referenceElement","clippingClientRect","contextElement","referenceClientRect","popperClientRect","elementClientRect","overflowOffsets","offsetData","multiply","computeAutoPlacement","flipVariations","_options$allowedAutoP","allowedAutoPlacements","allPlacements","allowedPlacements","overflows","sort","a","b","getExpandedFallbackPlacements","oppositePlacement","flip","_skip","_options$mainAxis","checkMainAxis","_options$altAxis","altAxis","checkAltAxis","specifiedFallbackPlacements","fallbackPlacements","_options$flipVariatio","preferredPlacement","isBasePlacement","referenceRect","checksMap","Map","makeFallbackChecks","firstFittingPlacement","_basePlacement","isStartVariation","mainVariationSide","altVariationSide","checks","every","check","set","numberOfChecks","_loop","_i","fittingPlacement","find","get","slice","_ret","reset","getSideOffsets","preventedOffsets","isAnySideFullyClipped","some","side","hide","preventOverflow","referenceOverflow","popperAltOverflow","referenceClippingOffsets","popperEscapeOffsets","isReferenceHidden","hasPopperEscaped","distanceAndSkiddingToXY","invertDistance","skidding","distance","_options$offset","_data$state$placement","getAltAxis","_options$tether","tether","_options$tetherOffset","tetherOffset","tetherOffsetValue","mainSide","altSide","additive","minLen","maxLen","arrowPaddingObject","arrowPaddingMin","arrowPaddingMax","arrowLen","minOffset","maxOffset","clientOffset","offsetModifierValue","tetherMin","tetherMax","preventedOffset","_mainSide","_altSide","_offset","_min","_max","_preventedOffset","getHTMLElementScroll","getNodeScroll","getCompositeRect","elementOrVirtualElement","isFixed","isOffsetParentAnElement","order","modifiers","visited","Set","result","modifier","add","dep","has","depModifier","orderModifiers","orderedModifiers","debounce","pending","Promise","resolve","then","mergeByName","merged","current","existing","DEFAULT_OPTIONS","areValidElements","_len","arguments","_key","popperGenerator","generatorOptions","_generatorOptions","_generatorOptions$def","defaultModifiers","_generatorOptions$def2","defaultOptions","createPopper","effectCleanupFns","isDestroyed","setOptions","cleanupModifierEffects","m","runModifierEffects","forceUpdate","_state$elements","_state$orderedModifie","_state$orderedModifie2","destroy","onFirstUpdate","_ref3$options","cleanupFn","noopFn","eventListeners","_getCenteredStylePopperModifier","makeCenteredPopper","centeredStylePopperModifier","popperOptions","setTimeout","focus","from","normalizePrefix","prefix","charAt","parseAttachTo","attachTo","returnOpts","setupTooltip","tooltip","attachToOptions","getPopperOptions","isCentered","content","shepherdElementComponent","getElement","classList","uuid","d","Date","now","c","r","random","floor","defaultStepOptions","_mergeModifiers","stepOptions","mergedPopperOptions","names","mod","filteredModifiers","includes","noop","tar","src","k","run","blank_object","create","run_all","fns","is_function","thing","safe_not_equal","is_empty","obj","append","appendChild","insert","anchor","insertBefore","detach","removeChild","destroy_each","iterations","detaching","createElement","svg_element","createElementNS","text","createTextNode","space","empty","listen","attr","getAttribute","set_attributes","descriptors","getOwnPropertyDescriptors","__proto__","cssText","children","childNodes","toggle_class","toggle","current_component","set_current_component","component","get_current_component","onMount","$$","on_mount","afterUpdate","after_update","dirty_components","binding_callbacks","render_callbacks","flush_callbacks","resolved_promise","update_scheduled","schedule_update","flush","add_render_callback","flushing","seen_callbacks","pop","callback","clear","fragment","before_update","dirty","p","outroing","outros","group_outros","check_outros","transition_in","block","local","delete","transition_out","o","get_spread_update","levels","updates","to_null_out","accounted_for","$$scope","n","create_component","mount_component","on_destroy","new_on_destroy","destroy_component","make_dirty","fill","init","create_fragment","not_equal","props","parent_component","bound","callbacks","skip_bound","ready","ret","rest","hydrate","nodes","l","intro","SvelteComponent","$destroy","$on","type","$set","$$props","$$set","config","action","classes","disabled","label","secondary","getDisabled","$","buttons","cancelIcon","handleCancelClick","preventDefault","cancel","labelId","title","innerHTML","descriptionId","KEY_TAB","KEY_ESC","LEFT_ARROW","RIGHT_ARROW","getClassesArray","className","classPrefix","firstFocusableElement","focusableElements","lastFocusableElement","dataStepId","hasCancelIcon","hasTitle","id","querySelectorAll","updateDynamicClasses","removeClasses","addClasses","oldClasses","remove","newClasses","handleKeyDown","keyCode","shiftKey","activeElement","exitOnEsc","keyboardNavigation","back","polyfill","w","__forceSmoothScrollPolyfill__","SCROLL_TIME","original","scrollTo","scrollBy","elementScroll","scrollElement","scrollIntoView","performance","isMicrosoftBrowser","userAgentPatterns","RegExp","join","ROUNDING_TOLERANCE","ease","cos","PI","shouldBailOut","firstArg","behavior","TypeError","hasScrollableSpace","canOverflow","overflowValue","isScrollable","isScrollableY","isScrollableX","findScrollableParent","time","currentX","currentY","elapsed","startTime","startX","startY","method","scrollable","requestAnimationFrame","smoothScroll","scrollX","scrollY","SyntaxError","scrollableParent","parentRects","clientRects","module","smoothscroll","Step","_setOptions","complete","_updateStepTargetOnHide","getTour","modal","hidden","Boolean","show","beforeShowPromise","_show","updateStepOptions","getTarget","_createTooltipContent","ShepherdElement","stepsContainer","_scrollTo","scrollToOptions","scrollToHandler","_getClassOptions","stepClasses","defaultStepOptionsClasses","allClasses","uniqClasses","trim","tourOptions","merge","when","_setupElements","_setupModal","setupForStep","_styleTargetElementForStep","targetElement","highlightClass","canClickTarget","cleanupSteps","steps","makeOverlayPath","innerWidth","innerHeight","h","_getScrollParent","isHtmlElement","parentElement","_getVisibleHeight","elementRect","scrollRect","scrollBottom","openingProperties","modalIsVisible","rafId","pathDefinition","closeModalOpening","_cleanupStepEventListeners","positionModal","modalOverlayOpeningPadding","modalOverlayOpeningRadius","useModalOverlay","_styleForStep","_preventModalBodyTouch","_preventModalOverlayTouch","stopPropagation","_addStepEventListeners","cancelAnimationFrame","rafLoop","Shepherd","Tour","defaultTourOptions","addSteps","events","opts","_setTourID","addStep","currentStep","confirmCancel","cancelMessage","confirmCancelMessage","stopTour","confirm","_done","getById","getCurrentStep","isActive","activeTour","removeStep","forward","_updateStateBeforeShow","shouldSkipStep","showOn","_skipStep","previous","focusedElBeforeOpen","_setupActiveTour","modalContainer","ShepherdModal","nextIndex","tourName"],"mappings":";;;;;;;;CAEA,IAAIA,iBAAiB,GAAG,SAASA,iBAAT,CAA2BC,KAA3B,EAAkC;CACzD,SAAOC,eAAe,CAACD,KAAD,CAAf,IACH,CAACE,SAAS,CAACF,KAAD,CADd;CAEA,CAHD;;CAKA,SAASC,eAAT,CAAyBD,KAAzB,EAAgC;CAC/B,SAAO,CAAC,CAACA,KAAF,IAAW,OAAOA,KAAP,KAAiB,QAAnC;CACA;;CAED,SAASE,SAAT,CAAmBF,KAAnB,EAA0B;CACzB,MAAIG,WAAW,GAAGC,MAAM,CAACC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BP,KAA/B,CAAlB;CAEA,SAAOG,WAAW,KAAK,iBAAhB,IACHA,WAAW,KAAK,eADb,IAEHK,cAAc,CAACR,KAAD,CAFlB;CAGA;;;CAGD,IAAIS,YAAY,GAAG,OAAOC,MAAP,KAAkB,UAAlB,IAAgCA,MAAM,CAACC,GAA1D;CACA,IAAIC,kBAAkB,GAAG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,CAAiBna,IAAjB;CACD;;CAED,QAAI,CAAC,KAAK4a,QAAL,EAAL,EAAsB;CACpB,WAAKU,gBAAL;CACD;CACF;CAED;CACF;CACA;CACA;;;CACErB,EAAAA,UAAU,GAAG;CACX,UAAMyB,QAAQ,GAAG,KAAKv0B,OAAL,CAAau0B,QAAb,IAAyB,MAA1C;CAEA,SAAKhK,EAAL,GAAW,GAAEgK,QAAS,KAAIlU,IAAI,EAAG,EAAjC;CACD;;CA9V+B;;CCXlCphB,MAAM,CAACuJ,MAAP,CAAcgqB,QAAd,EAAwB;CAAEC,EAAAA,IAAF;CAAQlE,EAAAA;CAAR,CAAxB;;;;"}
assets/js/tourguide.min.js ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Shepherd=e()}(this,function(){"use strict";var t=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var n=Object.prototype.toString.call(t);return"[object RegExp]"===n||"[object Date]"===n||function(t){return t.$$typeof===e}(t)}(t)};var e="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function o(t,e,o){return t.concat(e).map(function(t){return n(t,o)})}function r(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return t.propertyIsEnumerable(e)}):[]}(t))}function i(t,e){try{return e in t}catch(t){return!1}}function s(t,e,o){var s={};return o.isMergeableObject(t)&&r(t).forEach(function(e){s[e]=n(t[e],o)}),r(e).forEach(function(r){(function(t,e){return i(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,r)||(i(t,r)&&o.isMergeableObject(e[r])?s[r]=function(t,e){if(!e.customMerge)return a;var n=e.customMerge(t);return"function"==typeof n?n:a}(r,o)(t[r],e[r],o):s[r]=n(e[r],o))}),s}function a(e,r,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||t,i.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(r);return a===Array.isArray(e)?a?i.arrayMerge(e,r,i):s(e,r,i):n(r,i)}a.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return a(t,n,e)},{})};var l=a;function c(t){return t instanceof HTMLElement}function p(t){return"function"==typeof t}function u(t){return"string"==typeof t}function f(t){return void 0===t}class d{on(t,e,n,o=!1){return f(this.bindings)&&(this.bindings={}),f(this.bindings[t])&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o}),this}once(t,e,n){return this.on(t,e,n,!0)}off(t,e){return f(this.bindings)||f(this.bindings[t])?this:(f(e)?delete this.bindings[t]:this.bindings[t].forEach((n,o)=>{n.handler===e&&this.bindings[t].splice(o,1)}),this)}trigger(t,...e){return!f(this.bindings)&&this.bindings[t]&&this.bindings[t].forEach((n,o)=>{const{ctx:r,handler:i,once:s}=n,a=r||this;i.apply(a,e),s&&this.bindings[t].splice(o,1)}),this}}function h(t){const e=Object.getOwnPropertyNames(t.constructor.prototype);for(let n=0;n<e.length;n++){const o=e[n],r=t[o];"constructor"!==o&&"function"==typeof r&&(t[o]=r.bind(t))}return t}function m(t){const{event:e,selector:n}=t.options.advanceOn||{};if(!e)return console.error("advanceOn was defined, but no event name was passed.");{const o=function(t,e){return n=>{if(e.isOpen()){const o=e.el&&n.currentTarget===e.el;(!f(t)&&n.currentTarget.matches(t)||o)&&e.tour.next()}}}(n,t);let r;try{r=document.querySelector(n)}catch(t){}if(!f(n)&&!r)return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(e,o),t.on("destroy",()=>r.removeEventListener(e,o))):(document.body.addEventListener(e,o,!0),t.on("destroy",()=>document.body.removeEventListener(e,o,!0)))}}var g="top",b="bottom",y="right",v="left",x="auto",w=[g,b,y,v],$="start",O="end",E="clippingParents",S="viewport",T="popper",I="reference",j=w.reduce(function(t,e){return t.concat([e+"-"+$,e+"-"+O])},[]),_=[].concat(w,[x]).reduce(function(t,e){return t.concat([e,e+"-"+$,e+"-"+O])},[]),L=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function A(t){return t?(t.nodeName||"").toLowerCase():null}function M(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function k(t){return t instanceof M(t).Element||t instanceof Element}function C(t){return t instanceof M(t).HTMLElement||t instanceof HTMLElement}function P(t){return"undefined"!=typeof ShadowRoot&&(t instanceof M(t).ShadowRoot||t instanceof ShadowRoot)}var B={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach(function(t){var n=e.styles[t]||{},o=e.attributes[t]||{},r=e.elements[t];C(r)&&A(r)&&(Object.assign(r.style,n),Object.keys(o).forEach(function(t){var e=o[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)}))})},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(t){var o=e.elements[t],r=e.attributes[t]||{},i=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce(function(t,e){return t[e]="",t},{});C(o)&&A(o)&&(Object.assign(o.style,i),Object.keys(r).forEach(function(t){o.removeAttribute(t)}))})}},requires:["computeStyles"]};function D(t){return t.split("-")[0]}function H(t){var e=t.getBoundingClientRect();return{width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function R(t){var e=H(t),n=t.offsetWidth,o=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:o}}function W(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&P(n)){var o=e;do{if(o&&t.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function N(t){return M(t).getComputedStyle(t)}function F(t){return["table","td","th"].indexOf(A(t))>=0}function q(t){return((k(t)?t.ownerDocument:t.document)||window.document).documentElement}function V(t){return"html"===A(t)?t:t.assignedSlot||t.parentNode||(P(t)?t.host:null)||q(t)}function Y(t){return C(t)&&"fixed"!==N(t).position?t.offsetParent:null}function X(t){for(var e=M(t),n=Y(t);n&&F(n)&&"static"===N(n).position;)n=Y(n);return n&&("html"===A(n)||"body"===A(n)&&"static"===N(n).position)?e:n||function(t){for(var e=-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),n=V(t);C(n)&&["html","body"].indexOf(A(n))<0;){var o=N(n);if("none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||-1!==["transform","perspective"].indexOf(o.willChange)||e&&"filter"===o.willChange||e&&o.filter&&"none"!==o.filter)return n;n=n.parentNode}return null}(t)||e}function U(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}var z=Math.max,Z=Math.min,K=Math.round;function G(t,e,n){return z(t,Z(e,n))}function J(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function Q(t,e){return e.reduce(function(e,n){return e[n]=t,e},{})}var tt=function(t,e){return J("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:Q(t,w))};var et={top:"auto",right:"auto",bottom:"auto",left:"auto"};function nt(t){var e,n=t.popper,o=t.popperRect,r=t.placement,i=t.offsets,s=t.position,a=t.gpuAcceleration,l=t.adaptive,c=t.roundOffsets,p=!0===c?function(t){var e=t.x,n=t.y,o=window.devicePixelRatio||1;return{x:K(K(e*o+20)/o)||0,y:K(K(n*o)/o)||0}}(i):"function"==typeof c?c(i):i,u=p.x,f=void 0===u?0:u,d=p.y,h=void 0===d?0:d,m=i.hasOwnProperty("x"),x=i.hasOwnProperty("y"),w=v,$=g,O=window;if(l){var E=X(n),S="clientHeight",T="clientWidth";E===M(n)&&"static"!==N(E=q(n)).position&&(S="scrollHeight",T="scrollWidth"),E=E,r===g&&($=b,h-=E[S]-o.height,h*=a?1:-1),r===v&&(w=y,f-=E[T]-o.width,f*=a?1:-1)}var I,j=Object.assign({position:s},l&&et);return a?Object.assign({},j,((I={})[$]=x?"0":"",I[w]=m?"0":"",I.transform=(O.devicePixelRatio||1)<2?"translate("+f+"px, "+h+"px)":"translate3d("+f+"px, "+h+"px, 0)",I)):Object.assign({},j,((e={})[$]=x?h+"px":"",e[w]=m?f+"px":"",e.transform="",e))}var ot={passive:!0};var rt={left:"right",right:"left",bottom:"top",top:"bottom"};function it(t){return t.replace(/left|right|bottom|top/g,function(t){return rt[t]})}var st={start:"end",end:"start"};function at(t){return t.replace(/start|end/g,function(t){return st[t]})}function lt(t){var e=M(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ct(t){return H(q(t)).left+lt(t).scrollLeft}function pt(t){var e=N(t),n=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function ut(t,e){var n;void 0===e&&(e=[]);var o=function t(e){return["html","body","#document"].indexOf(A(e))>=0?e.ownerDocument.body:C(e)&&pt(e)?e:t(V(e))}(t),r=o===(null==(n=t.ownerDocument)?void 0:n.body),i=M(o),s=r?[i].concat(i.visualViewport||[],pt(o)?o:[]):o,a=e.concat(s);return r?a:a.concat(ut(V(s)))}function ft(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function dt(t,e){return e===S?ft(function(t){var e=M(t),n=q(t),o=e.visualViewport,r=n.clientWidth,i=n.clientHeight,s=0,a=0;return o&&(r=o.width,i=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=o.offsetLeft,a=o.offsetTop)),{width:r,height:i,x:s+ct(t),y:a}}(t)):C(e)?function(t){var e=H(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}(e):ft(function(t){var e,n=q(t),o=lt(t),r=null==(e=t.ownerDocument)?void 0:e.body,i=z(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=z(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-o.scrollLeft+ct(t),l=-o.scrollTop;return"rtl"===N(r||n).direction&&(a+=z(n.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}(q(t)))}function ht(t,e,n){var o="clippingParents"===e?function(t){var e=ut(V(t)),n=["absolute","fixed"].indexOf(N(t).position)>=0&&C(t)?X(t):t;return k(n)?e.filter(function(t){return k(t)&&W(t,n)&&"body"!==A(t)}):[]}(t):[].concat(e),r=[].concat(o,[n]),i=r[0],s=r.reduce(function(e,n){var o=dt(t,n);return e.top=z(o.top,e.top),e.right=Z(o.right,e.right),e.bottom=Z(o.bottom,e.bottom),e.left=z(o.left,e.left),e},dt(t,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function mt(t){return t.split("-")[1]}function gt(t){var e,n=t.reference,o=t.element,r=t.placement,i=r?D(r):null,s=r?mt(r):null,a=n.x+n.width/2-o.width/2,l=n.y+n.height/2-o.height/2;switch(i){case g:e={x:a,y:n.y-o.height};break;case b:e={x:a,y:n.y+n.height};break;case y:e={x:n.x+n.width,y:l};break;case v:e={x:n.x-o.width,y:l};break;default:e={x:n.x,y:n.y}}var c=i?U(i):null;if(null!=c){var p="y"===c?"height":"width";switch(s){case $:e[c]=e[c]-(n[p]/2-o[p]/2);break;case O:e[c]=e[c]+(n[p]/2-o[p]/2)}}return e}function bt(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=void 0===o?t.placement:o,i=n.boundary,s=void 0===i?E:i,a=n.rootBoundary,l=void 0===a?S:a,c=n.elementContext,p=void 0===c?T:c,u=n.altBoundary,f=void 0!==u&&u,d=n.padding,h=void 0===d?0:d,m=J("number"!=typeof h?h:Q(h,w)),v=p===T?I:T,x=t.elements.reference,$=t.rects.popper,O=t.elements[f?v:p],j=ht(k(O)?O:O.contextElement||q(t.elements.popper),s,l),_=H(x),L=gt({reference:_,element:$,strategy:"absolute",placement:r}),A=ft(Object.assign({},$,L)),M=p===T?A:_,C={top:j.top-M.top+m.top,bottom:M.bottom-j.bottom+m.bottom,left:j.left-M.left+m.left,right:M.right-j.right+m.right},P=t.modifiersData.offset;if(p===T&&P){var B=P[r];Object.keys(C).forEach(function(t){var e=[y,b].indexOf(t)>=0?1:-1,n=[g,b].indexOf(t)>=0?"y":"x";C[t]+=B[n]*e})}return C}function yt(t,e){void 0===e&&(e={});var n=e,o=n.placement,r=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,c=void 0===l?_:l,p=mt(o),u=p?a?j:j.filter(function(t){return mt(t)===p}):w,f=u.filter(function(t){return c.indexOf(t)>=0});0===f.length&&(f=u);var d=f.reduce(function(e,n){return e[n]=bt(t,{placement:n,boundary:r,rootBoundary:i,padding:s})[D(n)],e},{});return Object.keys(d).sort(function(t,e){return d[t]-d[e]})}function vt(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function xt(t){return[g,y,b,v].some(function(e){return t[e]>=0})}function wt(t,e,n){void 0===n&&(n=!1);var o,r,i=q(e),s=H(t),a=C(e),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(a||!a&&!n)&&(("body"!==A(e)||pt(i))&&(l=(o=e)!==M(o)&&C(o)?{scrollLeft:(r=o).scrollLeft,scrollTop:r.scrollTop}:lt(o)),C(e)?((c=H(e)).x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=ct(i))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function $t(t){var e=new Map,n=new Set,o=[];return t.forEach(function(t){e.set(t.name,t)}),t.forEach(function(t){n.has(t.name)||function t(r){n.add(r.name),[].concat(r.requires||[],r.requiresIfExists||[]).forEach(function(o){if(!n.has(o)){var r=e.get(o);r&&t(r)}}),o.push(r)}(t)}),o}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function Et(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}function St(t){void 0===t&&(t={});var e=t,n=e.defaultModifiers,o=void 0===n?[]:n,r=e.defaultOptions,i=void 0===r?Ot:r;return function(t,e,n){void 0===n&&(n=i);var r,s,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},l=[],c=!1,p={state:a,setOptions:function(n){u(),a.options=Object.assign({},i,a.options,n),a.scrollParents={reference:k(t)?ut(t):t.contextElement?ut(t.contextElement):[],popper:ut(e)};var r,s,c=function(t){var e=$t(t);return L.reduce(function(t,n){return t.concat(e.filter(function(t){return t.phase===n}))},[])}((r=[].concat(o,a.options.modifiers),s=r.reduce(function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t},{}),Object.keys(s).map(function(t){return s[t]})));return a.orderedModifiers=c.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var e=t.name,n=t.options,o=void 0===n?{}:n,r=t.effect;if("function"==typeof r){var i=r({state:a,name:e,instance:p,options:o});l.push(i||function(){})}}),p.update()},forceUpdate:function(){if(!c){var t=a.elements,e=t.reference,n=t.popper;if(Et(e,n)){a.rects={reference:wt(e,X(n),"fixed"===a.options.strategy),popper:R(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var o=0;o<a.orderedModifiers.length;o++)if(!0!==a.reset){var r=a.orderedModifiers[o],i=r.fn,s=r.options,l=void 0===s?{}:s,u=r.name;"function"==typeof i&&(a=i({state:a,options:l,name:u,instance:p})||a)}else a.reset=!1,o=-1}}},update:(r=function(){return new Promise(function(t){p.forceUpdate(),t(a)})},function(){return s||(s=new Promise(function(t){Promise.resolve().then(function(){s=void 0,t(r())})})),s}),destroy:function(){u(),c=!0}};if(!Et(t,e))return p;function u(){l.forEach(function(t){return t()}),l=[]}return p.setOptions(n).then(function(t){!c&&n.onFirstUpdate&&n.onFirstUpdate(t)}),p}}var Tt=St({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,o=t.options,r=o.scroll,i=void 0===r||r,s=o.resize,a=void 0===s||s,l=M(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(t){t.addEventListener("scroll",n.update,ot)}),a&&l.addEventListener("resize",n.update,ot),function(){i&&c.forEach(function(t){t.removeEventListener("scroll",n.update,ot)}),a&&l.removeEventListener("resize",n.update,ot)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state,n=t.name;e.modifiersData[n]=gt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,o=n.gpuAcceleration,r=void 0===o||o,i=n.adaptive,s=void 0===i||i,a=n.roundOffsets,l=void 0===a||a,c={placement:D(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,nt(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,nt(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},B,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.offset,i=void 0===r?[0,0]:r,s=_.reduce(function(t,n){return t[n]=function(t,e,n){var o=D(t),r=[v,g].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*r,[v,y].indexOf(o)>=0?{x:a,y:s}:{x:s,y:a}}(n,e.rects,i),t},{}),a=s[e.placement],l=a.x,c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[o]=s}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name;if(!e.modifiersData[o]._skip){for(var r=n.mainAxis,i=void 0===r||r,s=n.altAxis,a=void 0===s||s,l=n.fallbackPlacements,c=n.padding,p=n.boundary,u=n.rootBoundary,f=n.altBoundary,d=n.flipVariations,h=void 0===d||d,m=n.allowedAutoPlacements,w=e.options.placement,O=D(w),E=l||(O!==w&&h?function(t){if(D(t)===x)return[];var e=it(t);return[at(t),e,at(e)]}(w):[it(w)]),S=[w].concat(E).reduce(function(t,n){return t.concat(D(n)===x?yt(e,{placement:n,boundary:p,rootBoundary:u,padding:c,flipVariations:h,allowedAutoPlacements:m}):n)},[]),T=e.rects.reference,I=e.rects.popper,j=new Map,_=!0,L=S[0],A=0;A<S.length;A++){var M=S[A],k=D(M),C=mt(M)===$,P=[g,b].indexOf(k)>=0,B=P?"width":"height",H=bt(e,{placement:M,boundary:p,rootBoundary:u,altBoundary:f,padding:c}),R=P?C?y:v:C?b:g;T[B]>I[B]&&(R=it(R));var W=it(R),N=[];if(i&&N.push(H[k]<=0),a&&N.push(H[R]<=0,H[W]<=0),N.every(function(t){return t})){L=M,_=!1;break}j.set(M,N)}if(_)for(var F=function(t){var e=S.find(function(e){var n=j.get(e);if(n)return n.slice(0,t).every(function(t){return t})});if(e)return L=e,"break"},q=h?3:1;q>0&&"break"!==F(q);q--);e.placement!==L&&(e.modifiersData[o]._skip=!0,e.placement=L,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,o=t.name,r=n.mainAxis,i=void 0===r||r,s=n.altAxis,a=void 0!==s&&s,l=n.boundary,c=n.rootBoundary,p=n.altBoundary,u=n.padding,f=n.tether,d=void 0===f||f,h=n.tetherOffset,m=void 0===h?0:h,x=bt(e,{boundary:l,rootBoundary:c,padding:u,altBoundary:p}),w=D(e.placement),O=mt(e.placement),E=!O,S=U(w),T="x"===S?"y":"x",I=e.modifiersData.popperOffsets,j=e.rects.reference,_=e.rects.popper,L="function"==typeof m?m(Object.assign({},e.rects,{placement:e.placement})):m,A={x:0,y:0};if(I){if(i||a){var M="y"===S?g:v,k="y"===S?b:y,C="y"===S?"height":"width",P=I[S],B=I[S]+x[M],H=I[S]-x[k],W=d?-_[C]/2:0,N=O===$?j[C]:_[C],F=O===$?-_[C]:-j[C],q=e.elements.arrow,V=d&&q?R(q):{width:0,height:0},Y=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},K=Y[M],J=Y[k],Q=G(0,j[C],V[C]),tt=E?j[C]/2-W-Q-K-L:N-Q-K-L,et=E?-j[C]/2+W+Q+J+L:F+Q+J+L,nt=e.elements.arrow&&X(e.elements.arrow),ot=nt?"y"===S?nt.clientTop||0:nt.clientLeft||0:0,rt=e.modifiersData.offset?e.modifiersData.offset[e.placement][S]:0,it=I[S]+tt-rt-ot,st=I[S]+et-rt;if(i){var at=G(d?Z(B,it):B,P,d?z(H,st):H);I[S]=at,A[S]=at-P}if(a){var lt="x"===S?g:v,ct="x"===S?b:y,pt=I[T],ut=pt+x[lt],ft=pt-x[ct],dt=G(d?Z(ut,it):ut,pt,d?z(ft,st):ft);I[T]=dt,A[T]=dt-pt}}e.modifiersData[o]=A}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,o=t.name,r=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=D(n.placement),l=U(a),c=[v,y].indexOf(a)>=0?"height":"width";if(i&&s){var p=tt(r.padding,n),u=R(i),f="y"===l?g:v,d="y"===l?b:y,h=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],m=s[l]-n.rects.reference[l],x=X(i),w=x?"y"===l?x.clientHeight||0:x.clientWidth||0:0,$=h/2-m/2,O=p[f],E=w-u[c]-p[d],S=w/2-u[c]/2+$,T=G(O,S,E),I=l;n.modifiersData[o]=((e={})[I]=T,e.centerOffset=T-S,e)}},effect:function(t){var e=t.state,n=t.options.element,o=void 0===n?"[data-popper-arrow]":n;null!=o&&("string"!=typeof o||(o=e.elements.popper.querySelector(o)))&&W(e.elements.popper,o)&&(e.elements.arrow=o)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=bt(e,{elementContext:"reference"}),a=bt(e,{altBoundary:!0}),l=vt(s,o),c=vt(a,r,i),p=xt(l),u=xt(c);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:p,hasPopperEscaped:u},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":p,"data-popper-escaped":u})}}]});function It(){return(It=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function jt(t){const e=[{name:"applyStyles",fn({state:t}){Object.keys(t.elements).forEach(e=>{if("popper"!==e)return;const n=t.attributes[e]||{},o=t.elements[e];Object.assign(o.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}),Object.keys(n).forEach(t=>{const e=n[t];!1===e?o.removeAttribute(t):o.setAttribute(t,!0===e?"":e)})})}},{name:"computeStyles",options:{adaptive:!1}}];let n={placement:"top",strategy:"fixed",modifiers:[{name:"focusAfterRender",enabled:!0,phase:"afterWrite",fn(){setTimeout(()=>{t.el&&t.el.focus()},300)}}]};return n=It({},n,{modifiers:Array.from(new Set([...n.modifiers,...e]))})}function _t(t){return u(t)&&""!==t?"-"!==t.charAt(t.length-1)?`${t}-`:t:""}function Lt(t){const e=t.options.attachTo||{},n=Object.assign({},e);if(u(e.element)){try{n.element=document.querySelector(e.element)}catch(t){}n.element||console.error(`The element for this Shepherd step was not found ${e.element}`)}return n}function At(t){t.tooltip&&t.tooltip.destroy();const e=Lt(t);let n=e.element;const o=function(t,e){let n={modifiers:[{name:"preventOverflow",options:{altAxis:!0}},{name:"focusAfterRender",enabled:!0,phase:"afterWrite",fn(){setTimeout(()=>{e.el&&e.el.focus()},300)}}],strategy:"absolute"};e.isCentered()?n=jt(e):n.placement=t.on;const o=e.tour&&e.tour.options&&e.tour.options.defaultStepOptions;o&&(n=kt(o,n));return n=kt(e.options,n)}(e,t);if(t.isCentered()){n=document.body,t.shepherdElementComponent.getElement().classList.add("shepherd-centered")}return t.tooltip=Tt(n,t.el,o),t.target=e.element,o}function Mt(){let t=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?n:3&n|8).toString(16)})}function kt(t,e){if(t.popperOptions){let n=Object.assign({},e,t.popperOptions);if(t.popperOptions.modifiers&&t.popperOptions.modifiers.length>0){const o=t.popperOptions.modifiers.map(t=>t.name),r=e.modifiers.filter(t=>!o.includes(t.name));n.modifiers=Array.from(new Set([...r,...t.popperOptions.modifiers]))}return n}return e}function Ct(){}function Pt(t,e){for(const n in e)t[n]=e[n];return t}function Bt(t){return t()}function Dt(){return Object.create(null)}function Ht(t){t.forEach(Bt)}function Rt(t){return"function"==typeof t}function Wt(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function Nt(t,e){t.appendChild(e)}function Ft(t,e,n){t.insertBefore(e,n||null)}function qt(t){t.parentNode.removeChild(t)}function Vt(t){return document.createElement(t)}function Yt(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Xt(t){return document.createTextNode(t)}function Ut(){return Xt(" ")}function zt(t,e,n,o){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n,o)}function Zt(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Kt(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const o in e)null==e[o]?t.removeAttribute(o):"style"===o?t.style.cssText=e[o]:"__value"===o?t.value=t[o]=e[o]:n[o]&&n[o].set?t[o]=e[o]:Zt(t,o,e[o])}function Gt(t,e,n){t.classList[n?"add":"remove"](e)}let Jt;function Qt(t){Jt=t}function te(){if(!Jt)throw new Error("Function called outside component initialization");return Jt}function ee(t){te().$$.after_update.push(t)}const ne=[],oe=[],re=[],ie=[],se=Promise.resolve();let ae=!1;function le(t){re.push(t)}let ce=!1;const pe=new Set;function ue(){if(!ce){ce=!0;do{for(let t=0;t<ne.length;t+=1){const e=ne[t];Qt(e),fe(e.$$)}for(Qt(null),ne.length=0;oe.length;)oe.pop()();for(let t=0;t<re.length;t+=1){const e=re[t];pe.has(e)||(pe.add(e),e())}re.length=0}while(ne.length);for(;ie.length;)ie.pop()();ae=!1,ce=!1,pe.clear()}}function fe(t){if(null!==t.fragment){t.update(),Ht(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(le)}}const de=new Set;let he;function me(){he={r:0,c:[],p:he}}function ge(){he.r||Ht(he.c),he=he.p}function be(t,e){t&&t.i&&(de.delete(t),t.i(e))}function ye(t,e,n,o){if(t&&t.o){if(de.has(t))return;de.add(t),he.c.push(()=>{de.delete(t),o&&(n&&t.d(1),o())}),t.o(e)}}function ve(t){t&&t.c()}function xe(t,e,n){const{fragment:o,on_mount:r,on_destroy:i,after_update:s}=t.$$;o&&o.m(e,n),le(()=>{const e=r.map(Bt).filter(Rt);i?i.push(...e):Ht(e),t.$$.on_mount=[]}),s.forEach(le)}function we(t,e){const n=t.$$;null!==n.fragment&&(Ht(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function $e(t,e){-1===t.$$.dirty[0]&&(ne.push(t),ae||(ae=!0,se.then(ue)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Oe(t,e,n,o,r,i,s=[-1]){const a=Jt;Qt(t);const l=t.$$={fragment:null,ctx:null,props:i,update:Ct,not_equal:r,bound:Dt(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:[]),callbacks:Dt(),dirty:s,skip_bound:!1};let c=!1;if(l.ctx=n?n(t,e.props||{},(e,n,...o)=>{const i=o.length?o[0]:n;return l.ctx&&r(l.ctx[e],l.ctx[e]=i)&&(!l.skip_bound&&l.bound[e]&&l.bound[e](i),c&&$e(t,e)),n}):[],l.update(),c=!0,Ht(l.before_update),l.fragment=!!o&&o(l.ctx),e.target){if(e.hydrate){const t=(p=e.target,Array.from(p.childNodes));l.fragment&&l.fragment.l(t),t.forEach(qt)}else l.fragment&&l.fragment.c();e.intro&&be(t.$$.fragment),xe(t,e.target,e.anchor),ue()}var p;Qt(a)}class Ee{$destroy(){we(this,1),this.$destroy=Ct}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function Se(t){let e,n,o,r,i;return{c(){Zt(e=Vt("button"),"aria-label",n=t[3]?t[3]:null),Zt(e,"class",o=`${t[1]||""} shepherd-button ${t[4]?"shepherd-button-secondary":""}`),e.disabled=t[2],Zt(e,"tabindex","0")},m(n,o){Ft(n,e,o),e.innerHTML=t[5],r||(i=zt(e,"click",function(){Rt(t[0])&&t[0].apply(this,arguments)}),r=!0)},p(r,[i]){t=r,32&i&&(e.innerHTML=t[5]),8&i&&n!==(n=t[3]?t[3]:null)&&Zt(e,"aria-label",n),18&i&&o!==(o=`${t[1]||""} shepherd-button ${t[4]?"shepherd-button-secondary":""}`)&&Zt(e,"class",o),4&i&&(e.disabled=t[2])},i:Ct,o:Ct,d(t){t&&qt(e),r=!1,i()}}}function Te(t,e,n){let o,r,i,s,a,l,{config:c}=e,{step:u}=e;return t.$$set=(t=>{"config"in t&&n(6,c=t.config),"step"in t&&n(7,u=t.step)}),t.$$.update=(()=>{192&t.$$.dirty&&(n(0,o=c.action?c.action.bind(u.tour):null),n(1,r=c.classes),n(2,i=!!c.disabled&&function(t){return p(t)?t.call(u):t}(c.disabled)),n(3,s=c.label),n(4,a=c.secondary),n(5,l=c.text))}),[o,r,i,s,a,l,c,u]}class Ie extends Ee{constructor(t){super(),Oe(this,t,Te,Se,Wt,{config:6,step:7})}}function je(t,e,n){const o=t.slice();return o[2]=e[n],o}function _e(t){let e,n,o=t[1],r=[];for(let e=0;e<o.length;e+=1)r[e]=Le(je(t,o,e));const i=t=>ye(r[t],1,1,()=>{r[t]=null});return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=Xt("")},m(t,o){for(let e=0;e<r.length;e+=1)r[e].m(t,o);Ft(t,e,o),n=!0},p(t,n){if(3&n){let s;for(o=t[1],s=0;s<o.length;s+=1){const i=je(t,o,s);r[s]?(r[s].p(i,n),be(r[s],1)):(r[s]=Le(i),r[s].c(),be(r[s],1),r[s].m(e.parentNode,e))}for(me(),s=o.length;s<r.length;s+=1)i(s);ge()}},i(t){if(!n){for(let t=0;t<o.length;t+=1)be(r[t]);n=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)ye(r[t]);n=!1},d(t){!function(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}(r,t),t&&qt(e)}}}function Le(t){let e,n;return e=new Ie({props:{config:t[2],step:t[0]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};2&n&&(o.config=t[2]),1&n&&(o.step=t[0]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Ae(t){let e,n,o=t[1]&&_e(t);return{c(){e=Vt("footer"),o&&o.c(),Zt(e,"class","shepherd-footer")},m(t,r){Ft(t,e,r),o&&o.m(e,null),n=!0},p(t,[n]){t[1]?o?(o.p(t,n),2&n&&be(o,1)):((o=_e(t)).c(),be(o,1),o.m(e,null)):o&&(me(),ye(o,1,1,()=>{o=null}),ge())},i(t){n||(be(o),n=!0)},o(t){ye(o),n=!1},d(t){t&&qt(e),o&&o.d()}}}function Me(t,e,n){let o,{step:r}=e;return t.$$set=(t=>{"step"in t&&n(0,r=t.step)}),t.$$.update=(()=>{1&t.$$.dirty&&n(1,o=r.options.buttons)}),[r,o]}class ke extends Ee{constructor(t){super(),Oe(this,t,Me,Ae,Wt,{step:0})}}function Ce(t){let e,n,o,r,i;return{c(){e=Vt("button"),(n=Vt("span")).textContent="×",Zt(n,"aria-hidden","true"),Zt(e,"aria-label",o=t[0].label?t[0].label:"Close Tour"),Zt(e,"class","shepherd-cancel-icon"),Zt(e,"type","button")},m(o,s){Ft(o,e,s),Nt(e,n),r||(i=zt(e,"click",t[1]),r=!0)},p(t,[n]){1&n&&o!==(o=t[0].label?t[0].label:"Close Tour")&&Zt(e,"aria-label",o)},i:Ct,o:Ct,d(t){t&&qt(e),r=!1,i()}}}function Pe(t,e,n){let{cancelIcon:o}=e,{step:r}=e;return t.$$set=(t=>{"cancelIcon"in t&&n(0,o=t.cancelIcon),"step"in t&&n(2,r=t.step)}),[o,t=>{t.preventDefault(),r.cancel()},r]}class Be extends Ee{constructor(t){super(),Oe(this,t,Pe,Ce,Wt,{cancelIcon:0,step:2})}}function De(t){let e;return{c(){Zt(e=Vt("h3"),"id",t[1]),Zt(e,"class","shepherd-title")},m(n,o){Ft(n,e,o),t[3](e)},p(t,[n]){2&n&&Zt(e,"id",t[1])},i:Ct,o:Ct,d(n){n&&qt(e),t[3](null)}}}function He(t,e,n){let{labelId:o}=e,{element:r}=e,{title:i}=e;return ee(()=>{p(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)}),t.$$set=(t=>{"labelId"in t&&n(1,o=t.labelId),"element"in t&&n(0,r=t.element),"title"in t&&n(2,i=t.title)}),[r,o,i,function(t){oe[t?"unshift":"push"](()=>{n(0,r=t)})}]}class Re extends Ee{constructor(t){super(),Oe(this,t,He,De,Wt,{labelId:1,element:0,title:2})}}function We(t){let e,n;return e=new Re({props:{labelId:t[0],title:t[2]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};1&n&&(o.labelId=t[0]),4&n&&(o.title=t[2]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Ne(t){let e,n;return e=new Be({props:{cancelIcon:t[3],step:t[1]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};8&n&&(o.cancelIcon=t[3]),2&n&&(o.step=t[1]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Fe(t){let e,n,o,r=t[2]&&We(t),i=t[3]&&t[3].enabled&&Ne(t);return{c(){e=Vt("header"),r&&r.c(),n=Ut(),i&&i.c(),Zt(e,"class","shepherd-header")},m(t,s){Ft(t,e,s),r&&r.m(e,null),Nt(e,n),i&&i.m(e,null),o=!0},p(t,[o]){t[2]?r?(r.p(t,o),4&o&&be(r,1)):((r=We(t)).c(),be(r,1),r.m(e,n)):r&&(me(),ye(r,1,1,()=>{r=null}),ge()),t[3]&&t[3].enabled?i?(i.p(t,o),8&o&&be(i,1)):((i=Ne(t)).c(),be(i,1),i.m(e,null)):i&&(me(),ye(i,1,1,()=>{i=null}),ge())},i(t){o||(be(r),be(i),o=!0)},o(t){ye(r),ye(i),o=!1},d(t){t&&qt(e),r&&r.d(),i&&i.d()}}}function qe(t,e,n){let o,r,{labelId:i}=e,{step:s}=e;return t.$$set=(t=>{"labelId"in t&&n(0,i=t.labelId),"step"in t&&n(1,s=t.step)}),t.$$.update=(()=>{2&t.$$.dirty&&(n(2,o=s.options.title),n(3,r=s.options.cancelIcon))}),[i,s,o,r]}class Ve extends Ee{constructor(t){super(),Oe(this,t,qe,Fe,Wt,{labelId:0,step:1})}}function Ye(t){let e;return{c(){Zt(e=Vt("div"),"class","shepherd-text"),Zt(e,"id",t[1])},m(n,o){Ft(n,e,o),t[3](e)},p(t,[n]){2&n&&Zt(e,"id",t[1])},i:Ct,o:Ct,d(n){n&&qt(e),t[3](null)}}}function Xe(t,e,n){let{descriptionId:o}=e,{element:r}=e,{step:i}=e;return ee(()=>{let{text:t}=i.options;p(t)&&(t=t.call(i)),c(t)?r.appendChild(t):n(0,r.innerHTML=t,r)}),t.$$set=(t=>{"descriptionId"in t&&n(1,o=t.descriptionId),"element"in t&&n(0,r=t.element),"step"in t&&n(2,i=t.step)}),[r,o,i,function(t){oe[t?"unshift":"push"](()=>{n(0,r=t)})}]}class Ue extends Ee{constructor(t){super(),Oe(this,t,Xe,Ye,Wt,{descriptionId:1,element:0,step:2})}}function ze(t){let e,n;return e=new Ve({props:{labelId:t[1],step:t[2]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};2&n&&(o.labelId=t[1]),4&n&&(o.step=t[2]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Ze(t){let e,n;return e=new Ue({props:{descriptionId:t[0],step:t[2]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};1&n&&(o.descriptionId=t[0]),4&n&&(o.step=t[2]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Ke(t){let e,n;return e=new ke({props:{step:t[2]}}),{c(){ve(e.$$.fragment)},m(t,o){xe(e,t,o),n=!0},p(t,n){const o={};4&n&&(o.step=t[2]),e.$set(o)},i(t){n||(be(e.$$.fragment,t),n=!0)},o(t){ye(e.$$.fragment,t),n=!1},d(t){we(e,t)}}}function Ge(t){let e,n,o,r,i=!f(t[2].options.title)||t[2].options.cancelIcon&&t[2].options.cancelIcon.enabled,s=!f(t[2].options.text),a=Array.isArray(t[2].options.buttons)&&t[2].options.buttons.length,l=i&&ze(t),c=s&&Ze(t),p=a&&Ke(t);return{c(){e=Vt("div"),l&&l.c(),n=Ut(),c&&c.c(),o=Ut(),p&&p.c(),Zt(e,"class","shepherd-content")},m(t,i){Ft(t,e,i),l&&l.m(e,null),Nt(e,n),c&&c.m(e,null),Nt(e,o),p&&p.m(e,null),r=!0},p(t,[r]){4&r&&(i=!f(t[2].options.title)||t[2].options.cancelIcon&&t[2].options.cancelIcon.enabled),i?l?(l.p(t,r),4&r&&be(l,1)):((l=ze(t)).c(),be(l,1),l.m(e,n)):l&&(me(),ye(l,1,1,()=>{l=null}),ge()),4&r&&(s=!f(t[2].options.text)),s?c?(c.p(t,r),4&r&&be(c,1)):((c=Ze(t)).c(),be(c,1),c.m(e,o)):c&&(me(),ye(c,1,1,()=>{c=null}),ge()),4&r&&(a=Array.isArray(t[2].options.buttons)&&t[2].options.buttons.length),a?p?(p.p(t,r),4&r&&be(p,1)):((p=Ke(t)).c(),be(p,1),p.m(e,null)):p&&(me(),ye(p,1,1,()=>{p=null}),ge())},i(t){r||(be(l),be(c),be(p),r=!0)},o(t){ye(l),ye(c),ye(p),r=!1},d(t){t&&qt(e),l&&l.d(),c&&c.d(),p&&p.d()}}}function Je(t,e,n){let{descriptionId:o}=e,{labelId:r}=e,{step:i}=e;return t.$$set=(t=>{"descriptionId"in t&&n(0,o=t.descriptionId),"labelId"in t&&n(1,r=t.labelId),"step"in t&&n(2,i=t.step)}),[o,r,i]}class Qe extends Ee{constructor(t){super(),Oe(this,t,Je,Ge,Wt,{descriptionId:0,labelId:1,step:2})}}function tn(t){let e;return{c(){Zt(e=Vt("div"),"class","shepherd-arrow"),Zt(e,"data-popper-arrow","")},m(t,n){Ft(t,e,n)},d(t){t&&qt(e)}}}function en(t){let e,n,o,r,i,s,a,l,c=t[4].options.arrow&&t[4].options.attachTo&&t[4].options.attachTo.element&&t[4].options.attachTo.on&&tn();o=new Qe({props:{descriptionId:t[2],labelId:t[3],step:t[4]}});let p=[{"aria-describedby":r=f(t[4].options.text)?null:t[2]},{"aria-labelledby":i=t[4].options.title?t[3]:null},t[1],{role:"dialog"},{tabindex:"0"}],u={};for(let t=0;t<p.length;t+=1)u=Pt(u,p[t]);return{c(){e=Vt("div"),c&&c.c(),n=Ut(),ve(o.$$.fragment),Kt(e,u),Gt(e,"shepherd-has-cancel-icon",t[5]),Gt(e,"shepherd-has-title",t[6]),Gt(e,"shepherd-element",!0)},m(r,i){Ft(r,e,i),c&&c.m(e,null),Nt(e,n),xe(o,e,null),t[13](e),s=!0,a||(l=zt(e,"keydown",t[7]),a=!0)},p(t,[a]){t[4].options.arrow&&t[4].options.attachTo&&t[4].options.attachTo.element&&t[4].options.attachTo.on?c||((c=tn()).c(),c.m(e,n)):c&&(c.d(1),c=null);const l={};4&a&&(l.descriptionId=t[2]),8&a&&(l.labelId=t[3]),16&a&&(l.step=t[4]),o.$set(l),Kt(e,u=function(t,e){const n={},o={},r={$$scope:1};let i=t.length;for(;i--;){const s=t[i],a=e[i];if(a){for(const t in s)t in a||(o[t]=1);for(const t in a)r[t]||(n[t]=a[t],r[t]=1);t[i]=a}else for(const t in s)r[t]=1}for(const t in o)t in n||(n[t]=void 0);return n}(p,[(!s||20&a&&r!==(r=f(t[4].options.text)?null:t[2]))&&{"aria-describedby":r},(!s||24&a&&i!==(i=t[4].options.title?t[3]:null))&&{"aria-labelledby":i},2&a&&t[1],{role:"dialog"},{tabindex:"0"}])),Gt(e,"shepherd-has-cancel-icon",t[5]),Gt(e,"shepherd-has-title",t[6]),Gt(e,"shepherd-element",!0)},i(t){s||(be(o.$$.fragment,t),s=!0)},o(t){ye(o.$$.fragment,t),s=!1},d(n){n&&qt(e),c&&c.d(),we(o),t[13](null),a=!1,l()}}}const nn=9,on=27,rn=37,sn=39;function an(t){return t.split(" ").filter(t=>!!t.length)}function ln(t,e,n){let o,r,i,{classPrefix:s}=e,{element:a}=e,{descriptionId:l}=e,{firstFocusableElement:c}=e,{focusableElements:p}=e,{labelId:f}=e,{lastFocusableElement:d}=e,{step:h}=e,{dataStepId:m}=e;var g;g=(()=>{n(1,m={[`data-${s}shepherd-step-id`]:h.id}),n(9,p=a.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,c=p[0]),n(10,d=p[p.length-1])}),te().$$.on_mount.push(g),ee(()=>{i!==h.options.classes&&(function(t){if(u(t)){const e=an(t);e.length&&a.classList.remove(...e)}}(i),function(t){if(u(t)){const e=an(t);e.length&&a.classList.add(...e)}}(i=h.options.classes))});return t.$$set=(t=>{"classPrefix"in t&&n(11,s=t.classPrefix),"element"in t&&n(0,a=t.element),"descriptionId"in t&&n(2,l=t.descriptionId),"firstFocusableElement"in t&&n(8,c=t.firstFocusableElement),"focusableElements"in t&&n(9,p=t.focusableElements),"labelId"in t&&n(3,f=t.labelId),"lastFocusableElement"in t&&n(10,d=t.lastFocusableElement),"step"in t&&n(4,h=t.step),"dataStepId"in t&&n(1,m=t.dataStepId)}),t.$$.update=(()=>{16&t.$$.dirty&&(n(5,o=h.options&&h.options.cancelIcon&&h.options.cancelIcon.enabled),n(6,r=h.options&&h.options.title))}),[a,m,l,f,h,o,r,t=>{const{tour:e}=h;switch(t.keyCode){case nn:if(0===p.length){t.preventDefault();break}t.shiftKey?(document.activeElement===c||document.activeElement.classList.contains("shepherd-element"))&&(t.preventDefault(),d.focus()):document.activeElement===d&&(t.preventDefault(),c.focus());break;case on:e.options.exitOnEsc&&h.cancel();break;case rn:e.options.keyboardNavigation&&e.back();break;case sn:e.options.keyboardNavigation&&e.next()}},c,p,d,s,()=>a,function(t){oe[t?"unshift":"push"](()=>{n(0,a=t)})}]}class cn extends Ee{constructor(t){super(),Oe(this,t,ln,en,Wt,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}var pn,un=(function(t,e){!function(){t.exports={polyfill:function(){var t=window,e=document;if(!("scrollBehavior"in e.documentElement.style&&!0!==t.__forceSmoothScrollPolyfill__)){var n,o=t.HTMLElement||t.Element,r=468,i={scroll:t.scroll||t.scrollTo,scrollBy:t.scrollBy,elementScroll:o.prototype.scroll||l,scrollIntoView:o.prototype.scrollIntoView},s=t.performance&&t.performance.now?t.performance.now.bind(t.performance):Date.now,a=(n=t.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(n)?1:0);t.scroll=t.scrollTo=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?h.call(t,e.body,void 0!==arguments[0].left?~~arguments[0].left:t.scrollX||t.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:t.scrollY||t.pageYOffset):i.scroll.call(t,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:t.scrollX||t.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:t.scrollY||t.pageYOffset))},t.scrollBy=function(){void 0!==arguments[0]&&(c(arguments[0])?i.scrollBy.call(t,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(t,e.body,~~arguments[0].left+(t.scrollX||t.pageXOffset),~~arguments[0].top+(t.scrollY||t.pageYOffset)))},o.prototype.scroll=o.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==c(arguments[0])){var t=arguments[0].left,e=arguments[0].top;h.call(this,this,void 0===t?this.scrollLeft:~~t,void 0===e?this.scrollTop:~~e)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},o.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==c(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},o.prototype.scrollIntoView=function(){if(!0!==c(arguments[0])){var n=function(t){for(;t!==e.body&&!1===f(t);)t=t.parentNode||t.host;return t}(this),o=n.getBoundingClientRect(),r=this.getBoundingClientRect();n!==e.body?(h.call(this,n,n.scrollLeft+r.left-o.left,n.scrollTop+r.top-o.top),"fixed"!==t.getComputedStyle(n).position&&t.scrollBy({left:o.left,top:o.top,behavior:"smooth"})):t.scrollBy({left:r.left,top:r.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function l(t,e){this.scrollLeft=t,this.scrollTop=e}function c(t){if(null===t||"object"!=typeof t||void 0===t.behavior||"auto"===t.behavior||"instant"===t.behavior)return!0;if("object"==typeof t&&"smooth"===t.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+t.behavior+" is not a valid value for enumeration ScrollBehavior.")}function p(t,e){return"Y"===e?t.clientHeight+a<t.scrollHeight:"X"===e?t.clientWidth+a<t.scrollWidth:void 0}function u(e,n){var o=t.getComputedStyle(e,null)["overflow"+n];return"auto"===o||"scroll"===o}function f(t){var e=p(t,"Y")&&u(t,"Y"),n=p(t,"X")&&u(t,"X");return e||n}function d(e){var n,o,i,a,l=(s()-e.startTime)/r;a=l=l>1?1:l,n=.5*(1-Math.cos(Math.PI*a)),o=e.startX+(e.x-e.startX)*n,i=e.startY+(e.y-e.startY)*n,e.method.call(e.scrollable,o,i),o===e.x&&i===e.y||t.requestAnimationFrame(d.bind(t,e))}function h(n,o,r){var a,c,p,u,f=s();n===e.body?(a=t,c=t.scrollX||t.pageXOffset,p=t.scrollY||t.pageYOffset,u=i.scroll):(a=n,c=n.scrollLeft,p=n.scrollTop,u=l),d({scrollable:a,method:u,startTime:f,startX:c,startY:p,x:o,y:r})}}}}()}(pn={exports:{}},pn.exports),pn.exports);un.polyfill,un.polyfill();class fn extends d{constructor(t,e={}){return super(t,e),this.tour=t,this.classPrefix=this.tour.options?_t(this.tour.options.classPrefix):"",this.styles=t.styles,h(this),this._setOptions(e),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),c(this.el)&&this.el.parentNode&&(this.el.parentNode.removeChild(this.el),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){this.tour.modal.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}isCentered(){const t=Lt(this);return!t.element||!t.on}isOpen(){return Boolean(this.el&&!this.el.hidden)}show(){if(p(this.options.beforeShowPromise)){const t=this.options.beforeShowPromise();if(!f(t))return t.then(()=>this._show())}this._show()}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){const t=`${this.id}-description`,e=`${this.id}-label`;return this.shepherdElementComponent=new cn({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:t,labelId:e,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(t){const{element:e}=Lt(this);p(this.options.scrollToHandler)?this.options.scrollToHandler(e):e instanceof Element&&"function"==typeof e.scrollIntoView&&e.scrollIntoView(t)}_getClassOptions(t){const e=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,n=t.classes?t.classes:"",o=e&&e.classes?e.classes:"",r=[...n.split(" "),...o.split(" ")],i=new Set(r);return Array.from(i).join(" ").trim()}_setOptions(t={}){let e=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;e=l({},e||{}),this.options=Object.assign({arrow:!0},e,t);const{when:n}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${Mt()}`,n&&Object.keys(n).forEach(t=>{this.on(t,n[t],this)})}_setupElements(){f(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&m(this),At(this)}_show(){this.trigger("before-show"),this._setupElements(),this.tour.modal||this.tour._setupModal(),this.tour.modal.setupForStep(this),this._styleTargetElementForStep(this),this.el.hidden=!1,this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el.hidden=!1;const t=this.shepherdElementComponent.getElement(),e=this.target||document.body;e.classList.add(`${this.classPrefix}shepherd-enabled`),e.classList.add(`${this.classPrefix}shepherd-target`),t.classList.add("shepherd-enabled"),this.trigger("show")}_styleTargetElementForStep(t){const e=t.target;e&&(t.options.highlightClass&&e.classList.add(t.options.highlightClass),!1===t.options.canClickTarget&&e.classList.add("shepherd-target-click-disabled"))}_updateStepTargetOnHide(){const t=this.target||document.body;this.options.highlightClass&&t.classList.remove(this.options.highlightClass),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)}}function dn(t){let e,n,o,r,i;return{c(){e=Yt("svg"),Zt(n=Yt("path"),"d",t[2]),Zt(e,"class",o=`${t[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(o,s){Ft(o,e,s),Nt(e,n),t[11](e),r||(i=zt(e,"touchmove",t[3]),r=!0)},p(t,[r]){4&r&&Zt(n,"d",t[2]),2&r&&o!==(o=`${t[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&Zt(e,"class",o)},i:Ct,o:Ct,d(n){n&&qt(e),t[11](null),r=!1,i()}}}function hn(t,e,n){let{element:o}=e,{openingProperties:r}=e;Mt();let i,s=!1,a=void 0;l();function l(){n(4,r={width:0,height:0,x:0,y:0,r:0})}function c(){n(1,s=!1),d()}function p(t=0,e=0,o,i){if(i){const{y:s,height:a}=function(t,e){const n=t.getBoundingClientRect();let o=n.y||n.top,r=n.bottom||o+n.height;if(e){const t=e.getBoundingClientRect(),n=t.y||t.top,i=t.bottom||n+t.height;o=Math.max(o,n),r=Math.min(r,i)}return{y:o,height:Math.max(r-o,0)}}(i,o),{x:l,width:c,left:p}=i.getBoundingClientRect();n(4,r={width:c+2*t,height:a+2*t,x:(l||p)-t,y:s-t,r:e})}else l()}function u(){n(1,s=!0)}const f=t=>{t.preventDefault()};function d(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",f,{passive:!1})}return t.$$set=(t=>{"element"in t&&n(0,o=t.element),"openingProperties"in t&&n(4,r=t.openingProperties)}),t.$$.update=(()=>{16&t.$$.dirty&&n(2,i=function({width:t,height:e,x:n=0,y:o=0,r:r=0}){const{innerWidth:i,innerHeight:s}=window;return`M${i},${s}H0V0H${i}V${s}ZM${n+r},${o}a${r},${r},0,0,0-${r},${r}V${e+o-r}a${r},${r},0,0,0,${r},${r}H${t+n-r}a${r},${r},0,0,0,${r}-${r}V${o+r}a${r},${r},0,0,0-${r}-${r}Z`}(r))}),[o,s,i,t=>{t.stopPropagation()},r,()=>o,l,c,p,function(t){d(),t.tour.options.useModalOverlay?(function(t){const{modalOverlayOpeningPadding:e,modalOverlayOpeningRadius:n}=t.options,o=function t(e){if(!e)return null;const n=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return"hidden"!==n&&"visible"!==n&&e.scrollHeight>=e.clientHeight?e:t(e.parentElement)}(t.target),r=()=>{a=void 0,p(e,n,o,t.target),a=requestAnimationFrame(r)};r(),window.addEventListener("touchmove",f,{passive:!1})}(t),u()):c()},u,function(t){oe[t?"unshift":"push"](()=>{n(0,o=t)})}]}class mn extends Ee{constructor(t){super(),Oe(this,t,hn,dn,Wt,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}const gn=new d;return Object.assign(gn,{Tour:class extends d{constructor(t={}){return super(t),h(this),this.options=Object.assign({},{exitOnEsc:!0,keyboardNavigation:!0},t),this.classPrefix=_t(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(t=>{(t=>{this.on(t,e=>{(e=e||{}).tour=this,gn.trigger(t,e)})})(t)}),this._setTourID(),this}addStep(t,e){let n=t;return n instanceof fn?n.tour=this:n=new fn(this,n),f(e)?this.steps.push(n):this.steps.splice(e,0,n),n}addSteps(t){return Array.isArray(t)&&t.forEach(t=>{this.addStep(t)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";window.confirm(t)&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(t){return this.steps.find(e=>e.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return gn.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const e=this.getCurrentStep();this.steps.some((e,n)=>{if(e.id===t)return e.isOpen()&&e.hide(),e.destroy(),this.steps.splice(n,1),!0}),e&&e.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,e=!0){const n=u(t)?this.getById(t):this.steps[t];n&&(this._updateStateBeforeShow(),p(n.options.showOn)&&!n.options.showOn()?this._skipStep(n,e):(this.trigger("show",{step:n,previous:this.currentStep}),this.currentStep=n,n.show()))}start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this._setupModal(),this._setupActiveTour(),this.next()}_done(t){const e=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(t=>t.destroy()),function(t){if(t){const{steps:e}=t;e.forEach(t=>{t.options&&!1===t.options.canClickTarget&&t.options.attachTo&&t.target instanceof HTMLElement&&t.target.classList.remove("shepherd-target-click-disabled")})}}(this),this.trigger(t,{index:e}),gn.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),("cancel"===t||"complete"===t)&&this.modal){const t=document.querySelector(".shepherd-modal-overlay-container");t&&t.remove()}c(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),gn.activeTour=this}_setupModal(){this.modal=new mn({target:this.options.modalContainer||document.body,props:{classPrefix:this.classPrefix,styles:this.styles}})}_skipStep(t,e){const n=this.steps.indexOf(t),o=e?n+1:n-1;this.show(o,e)}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(){const t=this.options.tourName||"tour";this.id=`${t}--${Mt()}`}},Step:fn}),gn});
2
+ //# sourceMappingURL=shepherd.js.map
3
+
4
+ let myTour = new Shepherd.Tour({
5
+ // options here
6
+ });
7
+
8
+
9
+ var mycred_tour_data = [
10
+ [
11
+ {
12
+ title: 'Singular'+ '<span class=num>1 of 6</span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
13
+ text: 'Admin can set the "Singular" point type label here.',
14
+ attachTo: {
15
+ element: '#mycred-setup-name-singular',
16
+ on: 'bottom'
17
+ },
18
+ buttons: [
19
+ {
20
+ text: 'Next',
21
+ action:myTour.next
22
+ }
23
+ ]},
24
+ {
25
+ title: 'Plural'+ '<span class=num>2 of 6</span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
26
+ text: 'Admin can set the "Plural" points type label here.',
27
+ attachTo: {
28
+ element: '#mycred-setup-name-plural',
29
+ on: 'bottom'
30
+ },
31
+ buttons: [
32
+ {
33
+ text: 'Back',
34
+ action: myTour.back,
35
+ classes: 'shepherd-button-secondary',
36
+ },
37
+ {
38
+ text: 'Next',
39
+ action: myTour.next
40
+ }
41
+ ]},
42
+ {
43
+ title: 'Create Point-type'+ '<span class=num>3 of 6</span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
44
+ text: 'Click on the "Create Point Type" button to create the first point type.',
45
+ attachTo: {
46
+ element: '.button-large',
47
+ on: 'bottom'
48
+ },
49
+ buttons: [
50
+ {
51
+ text: 'Back',
52
+ action: myTour.back,
53
+ classes: 'shepherd-button-secondary',
54
+ },
55
+ {
56
+ text: 'Next',
57
+ action: myTour.complete
58
+ }
59
+ ]},
60
+ ],
61
+ [
62
+ {
63
+ title: 'Log' + '<span class=num>4 of 6</span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
64
+ text: 'Each time you reward or deduct points from a user, the transaction is documented here in the log table.',
65
+ attachTo: {
66
+ element: '#toplevel_page_mycred .current',
67
+ on: 'left'
68
+ },
69
+ buttons: [
70
+ {
71
+ text: 'Next',
72
+ action: function () {
73
+ if (mycred_tour_guide.step == 2 || mycred_tour_guide.step == 3) {
74
+ window.location.href = mycred_tour_guide.redirect_url;
75
+ }
76
+ }
77
+ }
78
+ ]},
79
+ ],
80
+ [
81
+ {
82
+ title: 'Hooks' + '<span class=num>5 of 6</span><span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
83
+ text: 'myCred "Hooks" are managed just like WordPress widgets. You have one "sidebar" called "Active Hooks" where you drag hooks you want to use. Hooks dragged out of the sidebar are disabled',
84
+ attachTo: {
85
+ element: '#toplevel_page_mycred .current',
86
+ on: 'left'
87
+ },
88
+ buttons: [
89
+ {
90
+ text: 'Next',
91
+ action: function () {
92
+ if (mycred_tour_guide.step == 2 || mycred_tour_guide.step == 3) {
93
+ window.location.href = mycred_tour_guide.redirect_url;
94
+ }
95
+ }
96
+ }
97
+ ]},
98
+ ],
99
+ [
100
+ {
101
+ title: 'Add-ons' + '<span class=num>6 of 6</span><span class="dashicons dashicons-dismiss cancel" onclick="myTour.cancel()"></span>',
102
+ text: 'myCred comes with multiple built-in add-ons for expanding installation with additional features, such as transfers, notifications, statistics, buyCred, cashCred, and much more.',
103
+ attachTo: {
104
+ element: '#toplevel_page_mycred .current',
105
+ on: 'left'
106
+ },
107
+ buttons: [
108
+ {
109
+ text: 'Finish',
110
+ action: myTour.complete
111
+ }
112
+ ]},
113
+ ],
114
+ ];
115
+ if (typeof mycred_tour_guide !== 'undefined' && typeof mycred_tour_guide.step !== 'undefined') {
116
+ myTour.addSteps( mycred_tour_data[ mycred_tour_guide.step - 1 ] );
117
+ myTour.start();
118
+ }
119
+
120
+
121
+ // Attach the touruide start evene to the button press
includes/classes/class.query-log.php CHANGED
@@ -63,6 +63,7 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
63
  $this->results = $cached_results['results'];
64
  $this->num_rows = $cached_results['num_rows'];
65
  $this->total_rows = $cached_results['total_rows'];
 
66
 
67
  if ( $this->args['number'] !== NULL && $this->args['number'] < 0 )
68
  $this->max_num_pages = ceil( $this->num_rows / $this->args['number'] );
@@ -237,10 +238,11 @@ if ( ! class_exists( 'myCRED_Query_Log' ) ) :
237
  if ( $cache_results ) {
238
 
239
  $new_cache = array(
240
- 'request' => $this->request,
241
- 'results' => $this->results,
242
- 'num_rows' => $this->num_rows,
243
- 'total_rows' => $this->total_rows
 
244
  );
245
 
246
  $this->cache_result( $new_cache );
@@ -2355,7 +2357,8 @@ if ( ! function_exists( 'mycred_get_all_references' ) ) :
2355
  'link_click' => __( 'Link Click', 'mycred' ),
2356
  'watching_video' => __( 'Watching Video', 'mycred' ),
2357
  'visitor_referral' => __( 'Visitor Referral', 'mycred' ),
2358
- 'signup_referral' => __( 'Signup Referral', 'mycred' )
 
2359
  );
2360
 
2361
  if ( class_exists( 'BuddyPress' ) ) {
@@ -2381,7 +2384,7 @@ if ( ! function_exists( 'mycred_get_all_references' ) ) :
2381
  $hooks['leaving_group'] = __( 'Leaving Group', 'mycred' );
2382
  $hooks['upload_group_avatar'] = __( 'New Group Avatar', 'mycred' );
2383
  $hooks['upload_group_cover'] = __( 'New Group Cover', 'mycred' );
2384
- $hooks['new_group_comment'] = __( 'New Group Comment', 'mycred' );
2385
  }
2386
 
2387
  if ( function_exists( 'bpa_init' ) || function_exists( 'bpgpls_init' ) ) {
63
  $this->results = $cached_results['results'];
64
  $this->num_rows = $cached_results['num_rows'];
65
  $this->total_rows = $cached_results['total_rows'];
66
+ $this->max_num_pages = (int)$cached_results['max_num_pages'];
67
 
68
  if ( $this->args['number'] !== NULL && $this->args['number'] < 0 )
69
  $this->max_num_pages = ceil( $this->num_rows / $this->args['number'] );
238
  if ( $cache_results ) {
239
 
240
  $new_cache = array(
241
+ 'request' => $this->request,
242
+ 'results' => $this->results,
243
+ 'num_rows' => $this->num_rows,
244
+ 'total_rows' => $this->total_rows,
245
+ 'max_num_pages' => $this->max_num_pages
246
  );
247
 
248
  $this->cache_result( $new_cache );
2357
  'link_click' => __( 'Link Click', 'mycred' ),
2358
  'watching_video' => __( 'Watching Video', 'mycred' ),
2359
  'visitor_referral' => __( 'Visitor Referral', 'mycred' ),
2360
+ 'signup_referral' => __( 'Signup Referral', 'mycred' ),
2361
+ 'anniversary' => __( 'Anniversary', 'mycred' ),
2362
  );
2363
 
2364
  if ( class_exists( 'BuddyPress' ) ) {
2384
  $hooks['leaving_group'] = __( 'Leaving Group', 'mycred' );
2385
  $hooks['upload_group_avatar'] = __( 'New Group Avatar', 'mycred' );
2386
  $hooks['upload_group_cover'] = __( 'New Group Cover', 'mycred' );
2387
+ $hooks['new_group_comment'] = __( 'New Group Post', 'mycred' );
2388
  }
2389
 
2390
  if ( function_exists( 'bpa_init' ) || function_exists( 'bpgpls_init' ) ) {
includes/hooks/external/mycred-hook-buddypress.php CHANGED
@@ -1053,7 +1053,7 @@ function mycred_load_buddypress_groups_hook() {
1053
  ),
1054
  'comments' => array(
1055
  'creds' => 1,
1056
- 'log' => '%plural% for new group comment',
1057
  'limit' => '0/x'
1058
  )
1059
  )
@@ -1738,7 +1738,7 @@ function mycred_load_buddypress_groups_hook() {
1738
  </div>
1739
  </div>
1740
  <div class="hook-instance">
1741
- <h3><?php _e( 'New Group Comments', 'mycred' ); ?></h3>
1742
  <div class="row">
1743
  <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
1744
  <div class="form-group">
1053
  ),
1054
  'comments' => array(
1055
  'creds' => 1,
1056
+ 'log' => '%plural% for new group post',
1057
  'limit' => '0/x'
1058
  )
1059
  )
1738
  </div>
1739
  </div>
1740
  <div class="hook-instance">
1741
+ <h3><?php _e( 'New Group Post', 'mycred' ); ?></h3>
1742
  <div class="row">
1743
  <div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
1744
  <div class="form-group">
includes/hooks/external/mycred-hook-woocommerce.php CHANGED
@@ -262,6 +262,19 @@ if ( ! function_exists( 'mycred_woo_save_product_variation_detail' ) ) :
262
  }
263
  endif;
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  /**
266
  * Payout Rewards
267
  * @since 1.5
262
  }
263
  endif;
264
 
265
+ /**
266
+ * Register WooCommerce Purchase Reward refrence
267
+ * @since 2.1
268
+ * @version 1.0
269
+ */
270
+ function mycred_register_woo_reward_ref( $list ) {
271
+
272
+ $list['reward'] = 'WooCommerce Purchase reaward';
273
+ return $list;
274
+
275
+ }
276
+ add_filter( 'mycred_all_references', 'mycred_register_woo_reward_ref' );
277
+
278
  /**
279
  * Payout Rewards
280
  * @since 1.5
includes/mycred-about.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'myCRED_VERSION' ) ) exit;
4
  /**
5
  * myCRED About Page Header
6
  * @since 1.3.2
7
- * @version 1.3
8
  */
9
  function mycred_about_header() {
10
 
@@ -12,150 +12,324 @@ function mycred_about_header() {
12
 
13
  ?>
14
  <style type="text/css">
15
- .mycred_about_container {
16
- max-width: 1000px;
17
- margin: 24px auto;
18
- clear: both;
19
- }
20
- .mycred_about_header {
21
- padding-top: 32px;
22
- margin-bottom: 32px;
23
- background-color: #9852f1;
24
- color: #322d2b;
25
- color: #f1f1f1;
26
- }
27
-
28
- .mycred_about_header-title {
29
- display: flex;
30
- align-items: center;
31
- justify-content: center;
32
- height: 20vh;
33
- max-height: 16em;
34
- padding: 0px 32px 32px 32px;
35
- margin-bottom: 2em;
36
- text-align: center;
37
  }
38
-
39
- .mycred_about_header-title p {
40
- margin: 0;
41
  padding: 0;
42
- font-size: 4em;
43
- line-height: 1;
44
- font-weight: 500;
45
  }
46
-
47
- .mycred_about_header-title p span {
48
- display: block;
49
- font-size: 2em;
 
 
 
50
  }
51
-
52
- #mycred-badge {
53
  background: url('<?php echo plugins_url( 'assets/images/mycred-icon.png', myCRED_THIS ); ?>') no-repeat center center;
54
- background-size: cover;
55
  display: block;
56
  margin: auto;
57
  box-shadow: none;
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
- .dashboard_page_mycred-about #wpwrap {
60
- background-color: white;
 
61
  }
62
- #wpwrap #mycred-about a {
63
- color: #666;
64
- background-color: #EBEBEB;
65
- padding: 10px;
66
- text-decoration: none;
67
- border-radius: 5px;
68
  }
69
-
70
- .mycred_about_section.is-feature {
71
- font-size: 1.6em;
72
- font-weight: 600;
73
  text-align: center;
 
74
  }
75
-
76
- .mycred_about_section p {
77
- font-size: 15px !important;
78
- line-height: 1.5;
79
- margin: 1em 0;
80
- text-align: justify;
81
  }
82
-
83
- .mycred_about_section.is-feature {
84
- padding: 32px;
85
  }
86
 
87
- .mycred_about_container .has-background-color {
88
- background-color: #f1e6ff;
89
- color: #322d2b;
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
- .mycred_about_container h1 {
93
- margin: 0 0 1em;
94
- padding: 0;
95
  font-weight: 600;
96
- color: inherit;
97
  }
98
-
99
- .mycred_about_container h1, .mycred_about_container h2 {
100
- margin-top: 0;
101
- font-size: 1.4em;
102
- line-height: 1.4;
103
  }
104
-
105
- .mycred_about_section p {
106
- font-size: inherit;
107
- line-height: inherit;
108
- font-size: 15px;
 
 
 
 
 
 
 
109
  }
110
-
111
- .mycred_about_section.has-1-column {
112
- margin-left: auto;
113
- margin-right: auto;
114
- max-width: 50em;
115
  }
116
-
117
- .mycred_about_section .column {
118
- padding: 32px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
-
122
- .mycred_about_container ul {
123
- list-style: inside;
 
 
 
 
 
124
  }
125
 
126
- .mycred_about_container .has-accent-background-color {
127
- background-color: #9852f1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
  color: #fff;
129
  }
130
-
131
- .mycred_about_container .has-accent-background-color h2 {
 
 
 
 
132
  color: #fff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
 
135
- .mycred_about_section.has-2-columns, .mycred_about_section.has-3-columns, .mycred_about_section.has-4-columns {
136
- display: -ms-grid;
137
- display: grid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  }
139
- .mycred_about_section .has-accent-background-color .column {
140
- padding: 32px;
 
141
  }
142
- .mycred-txt-center {
143
- text-align: center !important;
 
144
  }
145
- .mycred-change-log {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  padding: 32px;
147
  margin-top: 32px;
 
 
 
 
 
 
 
 
 
 
148
  }
149
 
150
  </style>
 
 
151
 
 
152
 
153
- <div class="mycred_about_header">
154
- <div class="wp-badge" id="mycred-badge"></div>
155
- <div class="mycred_about_header-title">
156
- <p><?php printf( '%s <span>%s</span>', $name, myCRED_VERSION ); ?></span></p>
157
- </div>
158
- </div>
 
 
 
 
159
  <?php
160
 
161
  }
@@ -163,12 +337,34 @@ function mycred_about_header() {
163
  /**
164
  * myCRED About Page Footer
165
  * @since 1.3.2
166
- * @version 1.1
167
  */
168
  function mycred_about_footer() {
169
 
170
  ?>
171
- <p style="text-align: center;">A big Thank You to everyone who helped support myCred!</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
 
173
  <?php
174
 
@@ -177,85 +373,215 @@ function mycred_about_footer() {
177
  /**
178
  * About myCRED Page
179
  * @since 1.3.2
180
- * @version 1.3
181
  */
182
  function mycred_about_page() {
183
 
184
  ?>
185
- <div class="wrap mycred_about_container" id="mycred-about-wrap">
186
-
187
- <?php
188
-
189
- $name = mycred_label();
190
-
191
- mycred_about_header();
192
-
193
- ?>
194
-
195
- <div class="mycred_about_section is-feature has-background-color">
196
- <h1><?php printf( __( 'Welcome to %s %s', 'mycred' ), $name, myCRED_VERSION ); ?></h1>
197
- <p class="mycred-txt-center">Introducing cashCred - An intelligent way to convert myCred points into real money.</p>
198
- </div>
199
 
200
- <div class="mycred_about_section has-1-column">
201
- <div class="column">
202
- <h2>cashCred</h2>
203
- <p><strong>We are introducing cashCred to the core of myCred as functionality that allows users to redeem myCred points for money. Moreover, cashCred can also perform the following actions:</strong></p>
204
- <ul>
205
- <li>Users can redeem myCred points for money.</li>
206
- <li>Allow multiple custom point types.</li>
207
- <li>Define exchange rates for each point type.</li>
208
- <li>Users can send a request to the admin for cash withdrawal.</li>
209
- <li>Approve or deny user requests for cash withdrawal.</li>
210
- <li>Write additional notes for users which will be displayed on the payment form.</li>
211
- <li>Define the currency code (USD, GBP, AUD, etc.) for the payment form.</li>
212
- <li>Display the cashCred module on the website using a shortcode.</li>
213
- <li>Set minimum or maximum restriction limits on point conversion requests.</li>
214
- </ul>
215
- <p>Allow users to create something that they can sell on your website and charge people with myCred points. It can be anything from adoptables to tutorials. Later, they can convert their earned myCred points into real money using cashCred.</p>
216
-
217
- <p>Similarly, users who earn points with actions or specific hooks can also exchange them for money.</p>
218
-
219
- <p>cashCred works perfectly with a reward system that engages users to perform activities that require user interaction (watching a video, filling out a survey, etc.) but instead of giving them cash, you reward them with points that can be encashed at any point in time.</p>
220
 
 
221
 
222
- </div>
223
- </div>
224
-
225
-
226
- <div class="mycred_about_section has-2-columns has-accent-background-color is-wider-right">
227
- <div class="column">
228
- <h2>myCred Central Deposit</h2>
229
- <p>myCred’s Central Deposit feature enables the admin to nominate any user account to become a ‘Central Deposit’ account, which then allows the selected user account to manage all transactions related to myCred points.</p>
230
-
231
- <p><strong>How does the Central Deposit feature work?</strong></p>
232
- <p>The Admin can assign the Central Deposit account functionality to any existing user so that it can control all in-out transactions. In the case the account balance reaches ZERO, no points will be paid out.</p>
233
-
234
- <p>Instead of creating points out of thin air, all payouts are made from a Central Deposit account. Any point a user spends or loses is deposited back into the Central Deposit account.</p>
235
- </div>
236
- </div>
237
-
238
- <div class="mycred_about_section has-background-color mycred-change-log">
239
- <h2>Change Log</h2>
240
- <ul>
241
- <li><strong>NEW</strong> - myCred CashCred.</li>
242
- <li><strong>NEW</strong> - Added filter 'mycred_link_click_amount'.</li>
243
- <li><strong>NEW</strong> - Added exclude attribute in myCred leaderboard.</li>
244
- <li><strong>FIX</strong> - PHP notices in rank addon.</li>
245
- <li><strong>FIX</strong> - Rewards points option not visible for other product type in woocommerce.</li>
246
- <li><strong>FIX</strong> - Erros in mycred_total_balance shortcode.</li>
247
- <li><strong>FIX</strong> - myCred logs export issue.</li>
248
- <li><strong>FIX</strong> - Fixed mycred admin dashboard overview widget showing incorrect or same amount of points.</li>
249
- <li><strong>FIX</strong> - buyCred gift_to attribute not working.</li>
250
- <li><strong>TWEAK</strong> - myCred Central Deposit.</li>
251
- <li><strong>TWEAK</strong> - Removed mycred review dialog.</li>
252
- </ul>
253
- </div>
254
-
255
-
256
- <?php mycred_about_footer(); ?>
257
-
258
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
259
  <?php
260
 
261
  }
4
  /**
5
  * myCRED About Page Header
6
  * @since 1.3.2
7
+ * @version 1.4
8
  */
9
  function mycred_about_header() {
10
 
12
 
13
  ?>
14
  <style type="text/css">
15
+ #mycred-welcome {
16
+ color: #555;
17
+ padding-top: 110px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  }
19
+ #mycred-welcome .container {
20
+ margin: 0 auto;
21
+ max-width: 720px;
22
  padding: 0;
 
 
 
23
  }
24
+ #mycred-welcome .intro {
25
+ background-color: #fff;
26
+ border: 2px solid #e1e1e1;
27
+ border-radius: 2px;
28
+ margin-bottom: 30px;
29
+ position: relative;
30
+ padding-top: 40px;
31
  }
32
+ #mycred-welcome .intro .mycred-logo {
 
33
  background: url('<?php echo plugins_url( 'assets/images/mycred-icon.png', myCRED_THIS ); ?>') no-repeat center center;
34
+ background-size: 95px;
35
  display: block;
36
  margin: auto;
37
  box-shadow: none;
38
+
39
+ background-color: #fff;
40
+ border: 2px solid #e1e1e1;
41
+ border-radius: 50%;
42
+ height: 110px;
43
+ width: 110px;
44
+ padding: 18px 14px 0 14px;
45
+ position: absolute;
46
+ top: -58px;
47
+ left: 50%;
48
+ margin-left: -55px;
49
  }
50
+ #mycred-welcome img {
51
+ max-width: 100%;
52
+ height: auto;
53
  }
54
+ #mycred-welcome .block {
55
+ padding: 40px;
 
 
 
 
56
  }
57
+ #mycred-welcome h1 {
58
+ color: #222;
59
+ font-size: 24px;
 
60
  text-align: center;
61
+ margin: 0 0 16px 0;
62
  }
63
+ #mycred-welcome h6 {
64
+ font-size: 16px;
65
+ font-weight: 400;
66
+ line-height: 1.6;
67
+ text-align: center;
68
+ margin: 0;
69
  }
70
+ #mycred-welcome .intro .button-wrap {
71
+ margin-top: 25px;
 
72
  }
73
 
74
+ #mycred-welcome .button-wrap {
75
+ max-width: 590px;
76
+ margin: 0 auto 0 auto;
77
+ }
78
+ .mycred-clear:before {
79
+ content: " ";
80
+ display: table;
81
+ }
82
+ #mycred-welcome .button-wrap .left {
83
+ float: left;
84
+ width: 50%;
85
+ padding-right: 20px;
86
+ }
87
+ .mycred-admin-page .mycred-btn-orange {
88
+ background-color: #9852f1;
89
+ color: #fff;
90
  }
91
 
92
+ .mycred-admin-page .mycred-btn-lg {
93
+ font-size: 16px;
 
94
  font-weight: 600;
95
+ padding: 16px 28px;
96
  }
97
+ .mycred-admin-page .mycred-btn-block {
98
+ display: block;
99
+ width: 100%;
 
 
100
  }
101
+ .mycred-admin-page .mycred-btn {
102
+ border: 1px;
103
+ border-style: solid;
104
+ border-radius: 3px;
105
+ cursor: pointer;
106
+ display: inline-block;
107
+ margin: 0;
108
+ text-decoration: none;
109
+ text-align: center;
110
+ vertical-align: middle;
111
+ white-space: nowrap;
112
+ box-shadow: none;
113
  }
114
+ #mycred-welcome .button-wrap .right {
115
+ float: right;
116
+ width: 50%;
117
+ padding-left: 20px;
 
118
  }
119
+ .mycred-admin-page .mycred-btn-grey {
120
+ background-color: #eee;
121
+ border-color: #ccc;
122
+ color: #666;
123
+ }
124
+ .mycred-clear:after {
125
+ clear: both;
126
+ content: " ";
127
+ display: table;
128
+ }
129
+ #mycred-welcome .features {
130
+ background-color: #fff;
131
+ border: 2px solid #e1e1e1;
132
+ border-bottom: 0;
133
+ border-radius: 2px 2px 0 0;
134
+ position: relative;
135
+ padding-top: 20px;
136
+ padding-bottom: 20px;
137
+ }
138
+ #mycred-welcome .features .feature-list {
139
+ margin-top: 60px;
140
+ }
141
+ #mycred-welcome .features .feature-block.first {
142
+ padding-right: 20px;
143
+ clear: both;
144
+ }
145
+ #mycred-welcome .features .feature-block {
146
+ float: left;
147
+ width: 50%;
148
+ padding-bottom: 35px;
149
+ overflow: auto;
150
+ }
151
+ #mycred-welcome *, #mycred-welcome *::before, #mycred-welcome *::after {
152
+ /* -webkit-box-sizing: border-box; */
153
+ -moz-box-sizing: border-box;
154
+ box-sizing: border-box;
155
+ }
156
+ #mycred-welcome .features .feature-block img {
157
+ float: left;
158
+ max-width: 46px;
159
+ }
160
+ #mycred-welcome .features .feature-block h5 {
161
+ margin-left: 68px;
162
  }
163
 
164
+ #mycred-welcome h5 {
165
+ color: #222;
166
+ font-size: 16px;
167
+ margin: 0 0 8px 0;
168
+ }
169
+ #mycred-welcome .features .feature-block p {
170
+ margin: 0;
171
+ margin-left: 68px;
172
  }
173
 
174
+ #mycred-welcome p {
175
+ font-size: 14px;
176
+ margin: 0 0 20px 0;
177
+ }
178
+ #mycred-welcome .features .feature-block.last {
179
+ padding-left: 20px;
180
+ }
181
+ #mycred-welcome .features .button-wrap {
182
+ margin-top: 25px;
183
+ text-align: center;
184
+ }
185
+ #mycred-welcome .upgrade-cta {
186
+ background-color: #000;
187
+ border: 2px solid #e1e1e1;
188
+ border-top: 0;
189
+ border-bottom: 0;
190
  color: #fff;
191
  }
192
+ #mycred-welcome .upgrade-cta .left {
193
+ float: left;
194
+ width: 66.666666%;
195
+ padding-right: 20px;
196
+ }
197
+ #mycred-welcome .upgrade-cta h2 {
198
  color: #fff;
199
+ font-size: 20px;
200
+ margin: 0 0 30px 0;
201
+ }
202
+ #mycred-welcome .upgrade-cta ul {
203
+ display: -ms-flex;
204
+ display: -webkit-flex;
205
+ display: flex;
206
+ -webkit-flex-wrap: wrap;
207
+ flex-wrap: wrap;
208
+ font-size: 15px;
209
+ margin: 0;
210
+ padding: 0;
211
+ }
212
+ #mycred-welcome .upgrade-cta ul li {
213
+ display: block;
214
+ width: 50%;
215
+ margin: 0 0 8px 0;
216
+ padding: 0;
217
+ }
218
+ #mycred-welcome .upgrade-cta ul li .dashicons {
219
+ color: #2a9b39;
220
+ margin-right: 5px;
221
+ }
222
+ .dashicons-yes:before {
223
+ content: "\f147";
224
+ }
225
+ #mycred-welcome .upgrade-cta .right {
226
+ float: right;
227
+ width: 33.333333%;
228
+ padding: 20px 0 0 20px;
229
+ text-align: center;
230
+ }
231
+ #mycred-welcome .upgrade-cta .right h2 {
232
+ text-align: center;
233
+ margin: 0;
234
  }
235
 
236
+ #mycred-welcome .upgrade-cta h2 {
237
+ color: #fff;
238
+ font-size: 20px;
239
+ margin: 0 0 30px 0;
240
+ }
241
+ #mycred-welcome .upgrade-cta .right h2 span {
242
+ display: inline-block;
243
+ border-bottom: 1px solid #555;
244
+ padding: 0 15px 12px;
245
+ }
246
+ #mycred-welcome .upgrade-cta .right .price {
247
+ padding: 26px 0;
248
+ }
249
+ #mycred-welcome .upgrade-cta .right .price .amount {
250
+ font-size: 48px;
251
+ font-weight: 600;
252
+ position: relative;
253
+ display: inline-block;
254
+ }
255
+ #mycred-welcome .upgrade-cta .right .price .amount:before {
256
+ content: '$';
257
+ position: absolute;
258
+ top: -8px;
259
+ left: -16px;
260
+ font-size: 18px;
261
+ }
262
+ #mycred-welcome .upgrade-cta .right .price .term {
263
+ font-size: 12px;
264
+ display: inline-block;
265
+ }
266
+ #mycred-welcome .testimonials {
267
+ background-color: #fff;
268
+ border: 2px solid #e1e1e1;
269
+ border-top: 0;
270
+ padding: 20px 0;
271
+ }
272
+ #mycred-welcome .testimonials .testimonial-block {
273
+ margin: 50px 0 0 0;
274
  }
275
+ #mycred-welcome .testimonials .testimonial-block img {
276
+ float: left;
277
+ max-width: 50px;
278
  }
279
+ #mycred-welcome .testimonials .testimonial-block p {
280
+ font-size: 14px;
281
+ margin: 0 0 12px 95px;
282
  }
283
+ #mycred-welcome .testimonials .testimonial-block p:last-of-type {
284
+ margin-bottom: 0;
285
+ }
286
+ b, strong {
287
+ font-weight: 600;
288
+ font-style: italic;
289
+ }
290
+ #mycred-welcome .footer {
291
+ background-color: #f9f9f9;
292
+ border: 2px solid #e1e1e1;
293
+ border-top: 0;
294
+ border-radius: 0 0 2px 2px;
295
+ }
296
+ .mycred-admin-page .mycred-footer-btn {
297
+ margin-left: 60%;
298
+ }
299
+ .clear {
300
+ clear: both;
301
+ }
302
+ #mycred-welcome .mycred-change-log {
303
  padding: 32px;
304
  margin-top: 32px;
305
+ background-color: #fff;
306
+ border: 2px solid #e1e1e1;
307
+ border-top: 0;
308
+ padding: 20px 0;
309
+ }
310
+ #mycred-welcome .mycred-change-log ul{
311
+ list-style: inside;
312
+ }
313
+ .members {
314
+ padding-bottom: 25px;
315
  }
316
 
317
  </style>
318
+ <div class="mycred-admin-page">
319
+ <div id="mycred-welcome" class="lite">
320
 
321
+ <div class="container">
322
 
323
+ <div class="intro">
324
+
325
+ <div class="mycred-logo">
326
+ </div>
327
+
328
+ <div class="block">
329
+ <h1><?php printf( __( 'Welcome to %s %s', 'mycred' ), $name, myCRED_VERSION ); ?></h1>
330
+ <h6>Thank you for choosing myCred - the most powerful points management system for WordPress. Build and manage a broad range of digital rewards, including points, ranks, and badges on your WordPress-powered website.
331
+ </h6>
332
+ </div>
333
  <?php
334
 
335
  }
337
  /**
338
  * myCRED About Page Footer
339
  * @since 1.3.2
340
+ * @version 1.2
341
  */
342
  function mycred_about_footer() {
343
 
344
  ?>
345
+ <?php
346
+ if ( !is_mycred_ready() ) {
347
+ ?>
348
+ <div class="footer">
349
+
350
+ <div class="block mycred-clear">
351
+
352
+ <div class="button-wrap mycred-clear">
353
+ <div class="left">
354
+ <a href="<?php echo admin_url( 'plugins.php?page=' . MYCRED_SLUG . '-setup&mycred_tour_guide=1' ) ?>" id="first_setup" onclick="startTour()" class="mycred-btn mycred-btn-block mycred-btn-lg mycred-btn-orange mycred-footer-btn">
355
+ Setup myCred
356
+ </a>
357
+
358
+ </div>
359
+ </div>
360
+
361
+ </div>
362
+
363
+ </div><!-- /.footer -->
364
+ <?php
365
+ }
366
+ ?>
367
+ <p style="margin: 15px; text-align: center;">A big Thank You to everyone who helped support myCred!</p>
368
 
369
  <?php
370
 
373
  /**
374
  * About myCRED Page
375
  * @since 1.3.2
376
+ * @version 1.4
377
  */
378
  function mycred_about_page() {
379
 
380
  ?>
381
+ <div class="mycred-welcome">
382
+ <div class="wrap mycred_about_container" id="mycred-about-wrap">
383
+ <div class="mycred-intro">
384
+ <?php
 
 
 
 
 
 
 
 
 
 
385
 
386
+ $name = mycred_label();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
 
388
+ mycred_about_header();
389
 
390
+ ?>
391
+
392
+ <img src="<?php echo plugins_url( 'assets/images/about/welcome.png', myCRED_THIS ); ?>" alt="Welcome" class="video-thumbnail">
393
+
394
+ <div class="block">
395
+
396
+ <div class="button-wrap mycred-clear">
397
+ <div class="left">
398
+ <?php
399
+ if ( !is_mycred_ready() ) {
400
+ ?>
401
+ <a href="<?php echo admin_url( 'plugins.php?page=' . MYCRED_SLUG . '-setup&mycred_tour_guide=1' ) ?>" id="first_setup" onclick="startTour()" class="mycred-btn mycred-btn-block mycred-btn-lg mycred-btn-orange">
402
+ Setup myCred
403
+ </a>
404
+ <?php
405
+ }
406
+ ?>
407
+ </div>
408
+ <div class="right">
409
+ <a href="https://codex.mycred.me/" class="mycred-btn mycred-btn-block mycred-btn-lg mycred-btn-grey" target="_blank" rel="noopener noreferrer">
410
+ Documentation
411
+ </a>
412
+ </div>
413
+ </div>
414
+ </div>
415
+
416
+ </div><!-- /.intro -->
417
+
418
+ <div class="features">
419
+
420
+ <div class="block">
421
+
422
+ <h1>myCred Features &amp; Addons</h1>
423
+
424
+ <div class="feature-list mycred-clear">
425
+
426
+ <div class="feature-block first">
427
+ <img src="<?php echo plugins_url( 'assets/images/about/account.png', myCRED_THIS ); ?>">
428
+ <h5>Account History</h5>
429
+ <p>A central log records your user's points whenever they perform an action.</p>
430
+ </div>
431
+
432
+ <div class="feature-block last">
433
+ <img src="<?php echo plugins_url( 'assets/images/about/points-management.png', myCRED_THIS ); ?>">
434
+ <h5>Points Management</h5>
435
+ <p>Adjust your user's balance by adding or removing points with or without a log entry.</p>
436
+ </div>
437
+
438
+ <div class="feature-block first">
439
+ <img src="<?php echo plugins_url( 'assets/images/about/automatic-points.png', myCRED_THIS ); ?>">
440
+ <h5>Automatic Points</h5>
441
+ <p>Automatically award or deduct points from your user’s balance.</p>
442
+ </div>
443
+
444
+ <div class="feature-block last">
445
+ <img src="<?php echo plugins_url( 'assets/images/about/multi-points.png', myCRED_THIS ); ?>">
446
+ <h5>Multiple Point Types</h5>
447
+ <p>Create multiple point types through the admin area to manage things easily.</p>
448
+ </div>
449
+
450
+ <div class="feature-block first">
451
+ <img src="<?php echo plugins_url( 'assets/images/about/convert-points.png', myCRED_THIS ); ?>">
452
+ <h5>Convert Points to Cash</h5>
453
+ <p>Users can redeem myCred points for real money.</p>
454
+ </div>
455
+
456
+ <div class="feature-block last">
457
+ <img src="<?php echo plugins_url( 'assets/images/about/multi-site-support.png', myCRED_THIS ); ?>">
458
+ <h5>Multi-Site Support</h5>
459
+ <p>Choose between using a unique myCred installation or centralize balances across your network.</p>
460
+ </div>
461
+
462
+ <div class="feature-block first">
463
+ <img src="<?php echo plugins_url( 'assets/images/about/leaderboards.png', myCRED_THIS ); ?>">
464
+ <h5>Leaderboards</h5>
465
+ <p>Generate leaderboards based on your user’s balance or points history.</p>
466
+ </div>
467
+
468
+ <div class="feature-block last">
469
+ <img src="<?php echo plugins_url( 'assets/images/about/badges.png', myCRED_THIS ); ?>">
470
+ <h5>Badges</h5>
471
+ <p>Award badges to your users based on their points history.</p>
472
+ </div>
473
+
474
+ <div class="feature-block first">
475
+ <img src="<?php echo plugins_url( 'assets/images/about/buy-points.png', myCRED_THIS ); ?>">
476
+ <h5>Buy Points</h5>
477
+ <p>Users can purchase points using real money using popular payment gateways.</p>
478
+ </div>
479
+
480
+ <div class="feature-block last">
481
+ <img src="<?php echo plugins_url( 'assets/images/about/sell-content.png', myCRED_THIS ); ?>">
482
+ <h5>Sell Content</h5>
483
+ <p>Sell access to the content field of posts/pages or custom post types on your website.</p>
484
+ </div>
485
+
486
+ </div>
487
+
488
+ <div class="button-wrap">
489
+ <a href="https://mycred.me/store/" class="mycred-btn mycred-btn-lg mycred-btn-grey" rel="noopener noreferrer" target="_blank">
490
+ More Addons
491
+ </a>
492
+ </div>
493
+
494
+ </div>
495
+
496
+ </div><!-- /.features -->
497
+
498
+ <div class="upgrade-cta upgrade">
499
+
500
+ <div class="block mycred-clear">
501
+
502
+ <div class="left">
503
+ <h2>Join the myCred Membership Club</h2>
504
+ <div class="members">Join the myCred membership club today and take advantage of premium services that include priority customer support and hundreds of add-ons at a super-saver price – Save 30% on all 3-year plans!</div>
505
+ <ul>
506
+ <li><span class="dashicons dashicons-yes"></span> Bundle Addons</li>
507
+ <li><span class="dashicons dashicons-yes"></span> Master License Key</li>
508
+ <li><span class="dashicons dashicons-yes"></span> Instant Access</li>
509
+ <li><span class="dashicons dashicons-yes"></span> Priority Support</li>
510
+ <li><span class="dashicons dashicons-yes"></span> Multiple Sites Support</li>
511
+ <li><span class="dashicons dashicons-yes"></span> Annually Billed Packages</li>
512
+ <li><span class="dashicons dashicons-yes"></span> Bulk Discounted Prices</li>
513
+ <li><span class="dashicons dashicons-yes"></span> One-click Activation</li>
514
+ </ul>
515
+ </div>
516
+
517
+ <div class="right">
518
+ <h2><span>STARTER</span></h2>
519
+ <div class="price">
520
+ <span class="amount">149</span><br>
521
+ <span class="term">per year</span>
522
+ </div>
523
+ <a href="https://mycred.me/membership/" rel="noopener noreferrer" target="_blank" class="mycred-btn mycred-btn-block mycred-btn-lg mycred-btn-orange mycred-upgrade-modal">
524
+ Membership Plans
525
+ </a>
526
+ </div>
527
+ </div>
528
+ </div><!-- upgrade-cta -->
529
+ <div class="mycred-change-log">
530
+ <div class="block">
531
+ <h2>Change Log</h2>
532
+ <ul>
533
+ <li><strong>NEW</strong> - Open badge functionality in myCred Badge addon.</li>
534
+ <li><strong>NEW</strong> - Introduce Achievement Types.</li>
535
+ <li><strong>NEW</strong> - Introduce a new shortcode mycred_badges_list.</li>
536
+ <li><strong>NEW</strong> - Single badge page.</li>
537
+ <li><strong>NEW</strong> - Added support into Badges for Anniversary hook.</li>
538
+ <li><strong>NEW</strong> - Added support into Badges for wooCommerce purchase reward.</li>
539
+ <li><strong>NEW</strong> - Added %rank_title% template tag support in Email Notifications.</li>
540
+ <li><strong>NEW</strong> - Added attributes in mycred_transfer shortcode.</li>
541
+
542
+ <li><strong>FIX</strong> - mycred_history shortcode pagination not working properly when cache enabled.</li>
543
+ <li><strong>FIX</strong> - Ranks weren't working properly on the current balance.</li>
544
+ <li><strong>FIX</strong> - mycred_sell_this shortcode not working in the bbPress topic</li>
545
+ <li><strong>FIX</strong> - The central deposit missing log entry in some cases.</li>
546
+
547
+ <li><strong>TWEAK</strong> - Removed deprecated functions.</li>
548
+ <li><strong>TWEAK</strong> - Code Improvement.</li>
549
+ <li><strong>TWEAK</strong> - Improve styling of mycred_transfer shortcode.</li>
550
+ </ul>
551
+ </div>
552
+ </div><!-- /.mycred-change-log -->
553
+ <div class="testimonials upgrade">
554
+
555
+ <div class="block">
556
+
557
+ <h1>Testimonials</h1>
558
+
559
+ <div class="testimonial-block mycred-clear">
560
+ <img src="<?php echo plugins_url( 'assets/images/about/56826.png', myCRED_THIS ); ?>">
561
+ <p>myCred is pretty solid WordPress plugin. You can do almost anything with it. myCred offers a great developer codex along with hooks, and filters. The versatile collection of addons is just amazing.</p>
562
+ <p><strong>Wooegg</strong></p>
563
+ </div>
564
+
565
+ <div class="testimonial-block mycred-clear">
566
+ <img src="<?php echo plugins_url( 'assets/images/about/56826.png', myCRED_THIS ); ?>">
567
+ <p>MyCred might be free but the add-ons it offers are absolutely incredible! myCred is the best points system for WordPress, period.</p>
568
+ <p><strong>Rongenius</strong></p>
569
+ </div>
570
+ <div class="testimonial-block mycred-clear">
571
+ <img src="<?php echo plugins_url( 'assets/images/about/56826.png', myCRED_THIS ); ?>">
572
+ <p>myCred is highly optimized and there are a lot of functions and short codes available to customize its structure. Special congratulations to its creators!</p>
573
+ <p><strong>Miladesmaili</strong></p>
574
+ </div>
575
+
576
+ </div>
577
+
578
+ </div><!-- /.testimonials -->
579
+
580
+
581
+ <?php mycred_about_footer(); ?>
582
+
583
+ </div><!-- /.container -->
584
+ </div><!-- /#mycred-welcome -->
585
  <?php
586
 
587
  }
includes/mycred-functions.php CHANGED
@@ -1171,7 +1171,7 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
1171
  if ( $point_type === NULL || ! array_key_exists( $point_type, $mycred_types ) )
1172
  $point_type = $this->get_point_type_key();
1173
 
1174
- if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
1175
  $balance = $mycred_current_account->balance[ $point_type ]->get( 'current' );
1176
 
1177
  else
@@ -3648,4 +3648,87 @@ if ( ! function_exists( 'mycred_leaderboard_exclude_role' ) ) :
3648
  // Return what we found.
3649
  return apply_filters( 'mycred_leaderboard_exclude_role', $exclude );
3650
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3651
  endif;
1171
  if ( $point_type === NULL || ! array_key_exists( $point_type, $mycred_types ) )
1172
  $point_type = $this->get_point_type_key();
1173
 
1174
+ if ( mycred_is_current_account( $user_id ) && ! empty( $mycred_current_account->balance[ $point_type ] ) )
1175
  $balance = $mycred_current_account->balance[ $point_type ]->get( 'current' );
1176
 
1177
  else
3648
  // Return what we found.
3649
  return apply_filters( 'mycred_leaderboard_exclude_role', $exclude );
3650
  }
3651
+ endif;
3652
+
3653
+ /**
3654
+ * Level Requirements
3655
+ * @since 2.1
3656
+ * @version 1.0
3657
+ */
3658
+ if ( !function_exists( 'mycred_badge_level_req_check' ) ):
3659
+ function mycred_badge_level_req_check( $badge_id, $level_index = 0 )
3660
+ {
3661
+ $content = '';
3662
+ global $wpdb;
3663
+ $user_id = get_current_user_id();
3664
+ $badge_requirements = mycred_show_badge_requirements( $badge_id );
3665
+ $require_levels = mycred_get_badge_levels( $badge_id );
3666
+ $total_levels = count( $require_levels );
3667
+ $level = 0;
3668
+ $base_requirements = $require_levels[$level]['requires'];
3669
+ $results = array();
3670
+ $levels_list = array();
3671
+ $starting_index = 0;
3672
+
3673
+ if ( $level_index == 0 )
3674
+ $starting_index = 0;
3675
+ if ( $level_index == 1 )
3676
+ $starting_index = 1;
3677
+ if ( $level_index > 1 )
3678
+ $starting_index = $level_index - 1;
3679
+
3680
+ // Based on the base requirements, we first get the users log entry results
3681
+
3682
+ //Gathering Base requirement's log of current user
3683
+ foreach ( $base_requirements as $requirement ) {
3684
+ if ( $requirement['type'] == '' )
3685
+ $requirement['type'] = MYCRED_DEFAULT_TYPE_KEY;
3686
+
3687
+ $mycred = mycred( $requirement['type'] );
3688
+ if ( $mycred->exclude_user( $user_id ) ) continue;
3689
+
3690
+ $having = 'COUNT(*)';
3691
+ if ( $requirement['by'] != 'count' )
3692
+ $having = 'SUM(creds)';
3693
+
3694
+ $query = $wpdb->get_var( $wpdb->prepare( "SELECT {$having} FROM {$mycred->log_table} WHERE ctype = %s AND ref = %s AND user_id = %d;", $requirement['type'], $requirement['reference'], $user_id ) );
3695
+ if ( $query === NULL ) $query = 0;
3696
+
3697
+ $results[ $requirement['reference'] ] = $query;
3698
+ }
3699
+
3700
+ //Checking requirements has been achieved
3701
+ for ( $i = $starting_index; $i <= $level_index; $i++ )
3702
+ {
3703
+ foreach ($require_levels[$i]['requires'] as $requirement) {
3704
+ $ref = $requirement['reference'];
3705
+ $amount = $requirement['amount'];
3706
+
3707
+ if (!empty($results[$ref]) && $results[$ref] >= $amount)
3708
+ $levels_list[$i][] = "achieved";
3709
+ else
3710
+ $levels_list[$i][] = "notAchieved";
3711
+ }
3712
+ }
3713
+
3714
+ //Rendering Level requirements
3715
+ $content .= '<ul>';
3716
+ for( $i = $starting_index; $i <= $level_index; $i++ )
3717
+ {
3718
+ $counter = 0;
3719
+
3720
+ foreach ($badge_requirements[$i]["requirements"] as $id => $requirement)
3721
+ {
3722
+ if( $levels_list[$i][$counter] == 'achieved' )
3723
+ $content .= "<li class='mycred-level-requirement mycred-strike-off'>{$requirement}</li>";
3724
+ else
3725
+ $content .= "<li class='mycred-level-requirement'>{$requirement}</li>";
3726
+
3727
+ $counter++;
3728
+ }
3729
+ }
3730
+ $content .= '</ul>';
3731
+
3732
+ return $content;
3733
+ }
3734
  endif;
includes/mycred-remote.php CHANGED
@@ -49,32 +49,50 @@ if ( ! class_exists( 'myCRED_Remote' ) ) :
49
  /**
50
  * Handle Magic Quotes
51
  * @since 1.3
52
- * @version 1.0
53
  */
54
  public function handle_magic() {
55
 
56
- if ( get_magic_quotes_gpc() ) {
57
-
58
- $process = array( &$_GET, &$_POST, &$_COOKIE, &$_REQUEST );
59
- while ( list( $key, $val ) = each( $process ) ) {
60
- foreach ( $val as $k => $v ) {
61
- unset( $process[ $key ][ $k ] );
62
- if ( is_array( $v ) ) {
63
- $process[ $key ][ stripslashes( $k ) ] = $v;
64
- $process[] = &$process[ $key ][ stripslashes( $k ) ];
65
- } else {
66
- $process[ $key ][ stripslashes( $k ) ] = stripslashes( $v );
67
- }
68
- }
69
- }
70
- unset( $process );
71
-
72
- }
73
-
74
- // Let others play
75
- do_action_ref_array( 'mycred_remote_magic', array( &$this ) );
76
-
77
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  /**
80
  * Set Headers
49
  /**
50
  * Handle Magic Quotes
51
  * @since 1.3
52
+ * @version 1.1
53
  */
54
  public function handle_magic() {
55
 
56
+ if ( function_exists( 'get_magic_quotes_gpc' ) )
57
+ {
58
+ if ( get_magic_quotes_gpc() ) {
59
+ $process = array( &$_GET, &$_POST, &$_COOKIE, &$_REQUEST );
60
+
61
+ foreach ( $process as $key => $val ) {
62
+ foreach ( $val as $k => $v ) {
63
+ unset( $process[ $key ][ $k ] );
64
+ if ( is_array( $v ) ) {
65
+ $process[ $key ][ stripslashes( $k ) ] = $v;
66
+ $process[] = &$process[ $key ][ stripslashes( $k ) ];
67
+ } else {
68
+ $process[ $key ][ stripslashes( $k ) ] = stripslashes( $v );
69
+ }
70
+ }
71
+ }
72
+
73
+ unset( $process );
74
+ }
75
+ }
76
+ else
77
+ {
78
+ $process = array( &$_GET, &$_POST, &$_COOKIE, &$_REQUEST );
79
+
80
+ foreach ( $process as $key => $val ) {
81
+ foreach ( $val as $k => $v ) {
82
+ unset( $process[ $key ][ $k ] );
83
+ if ( is_array( $v ) ) {
84
+ $process[ $key ][ $k ] = $v;
85
+ $process[] = &$process[ $key ][ $k ];
86
+ } else {
87
+ $process[ $key ][ $k ] = $v ;
88
+ }
89
+ }
90
+ }
91
+ unset( $process );
92
+ }
93
+ // Let others play
94
+ do_action_ref_array( 'mycred_remote_magic', array( &$this ) );
95
+ }
96
 
97
  /**
98
  * Set Headers
includes/mycred-setup.php CHANGED
@@ -32,9 +32,16 @@ if ( ! class_exists( 'myCRED_Setup' ) ) :
32
 
33
  add_action( 'admin_notices', array( $this, 'admin_notice' ) );
34
  add_action( 'admin_menu', array( $this, 'setup_menu' ) );
 
 
35
 
36
  add_action( 'wp_ajax_mycred-setup', array( $this, 'ajax_setup' ) );
37
 
 
 
 
 
 
38
  }
39
 
40
  /**
@@ -45,7 +52,7 @@ if ( ! class_exists( 'myCRED_Setup' ) ) :
45
  public function admin_notice() {
46
 
47
  $screen = get_current_screen();
48
- if ( $screen->id == 'plugins_page_' . MYCRED_SLUG . '-setup' || ( isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) || ! mycred_is_admin() ) return;
49
 
50
  echo '<div class="info notice notice-info"><p>' . sprintf( __( '%s needs your attention.', 'mycred' ), mycred_label() ) . ' <a href="' . admin_url( 'plugins.php?page=' . MYCRED_SLUG . '-setup' ) . '">' . __( 'Run Setup', 'mycred' ) . '</a></p></div>';
51
 
@@ -60,8 +67,8 @@ if ( ! class_exists( 'myCRED_Setup' ) ) :
60
 
61
  $page = add_submenu_page(
62
  'plugins.php',
63
- __( 'myCRED Setup', 'mycred' ),
64
- __( 'myCRED Setup', 'mycred' ),
65
  'manage_options',
66
  MYCRED_SLUG . '-setup',
67
  array( $this, 'setup_page' )
@@ -81,7 +88,7 @@ if ( ! class_exists( 'myCRED_Setup' ) ) :
81
  wp_enqueue_style( 'mycred-admin' );
82
  wp_enqueue_style( 'mycred-bootstrap-grid' );
83
  wp_enqueue_style( 'mycred-forms' );
84
-
85
  }
86
 
87
  /**
@@ -146,7 +153,7 @@ pre { margin: 0 0 12px 0; padding: 10px; background-color: #dedede; }
146
 
147
  <div class="row">
148
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
149
- <p><input type="submit" class="button button-primary button-large" value="<?php _e( 'Create Point Type', 'mycred' ); ?>" /><button type="button" id="toggle-advanced-options" class="button button-secondary pull-right" data-hide="<?php _e( 'Hide', 'mycred' ); ?>" data-show="<?php _e( 'Advanced', 'mycred' ); ?>"><?php _e( 'Advanced', 'mycred' ); ?></button></p>
150
  </div>
151
  </div>
152
 
@@ -183,6 +190,8 @@ pre { margin: 0 0 12px 0; padding: 10px; background-color: #dedede; }
183
  <script type="text/javascript">
184
  jQuery(function($) {
185
 
 
 
186
  $( '#toggle-advanced-options' ).click(function(){
187
 
188
  var hidelabel = $(this).data( 'hide' );
@@ -238,7 +247,8 @@ jQuery(function($) {
238
  progressbox.hide();
239
 
240
  if ( response.success ) {
241
- completedbox.slideDown();
 
242
  setupform.remove();
243
  }
244
  else {
@@ -255,6 +265,7 @@ jQuery(function($) {
255
 
256
  });
257
  </script>
 
258
  <?php
259
 
260
  }
@@ -270,6 +281,7 @@ jQuery(function($) {
270
  $posted = wp_parse_args( $posted, $mycred->defaults() );
271
 
272
  ?>
 
273
  <div class="row">
274
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
275
  <h3><?php _e( 'Labels', 'mycred' ); ?></h3>
@@ -476,6 +488,18 @@ jQuery(function($) {
476
  wp_send_json_success();
477
 
478
  }
 
 
 
 
 
 
 
 
 
 
 
 
479
 
480
  }
481
  endif;
32
 
33
  add_action( 'admin_notices', array( $this, 'admin_notice' ) );
34
  add_action( 'admin_menu', array( $this, 'setup_menu' ) );
35
+ add_action('current_screen', array( $this, 'menu_setup' ));
36
+
37
 
38
  add_action( 'wp_ajax_mycred-setup', array( $this, 'ajax_setup' ) );
39
 
40
+ global $pagenow;
41
+
42
+ if ( $pagenow == 'index.php' && isset( $_GET['page'] ) && $_GET['page'] == 'mycred-about' ) {
43
+ remove_all_actions( 'admin_notices' );
44
+ }
45
  }
46
 
47
  /**
52
  public function admin_notice() {
53
 
54
  $screen = get_current_screen();
55
+ if ( $screen->id == 'plugins_page_' . MYCRED_SLUG . '-setup&mycred_tour_guide=1' || ( isset( $_GET['action'] ) && $_GET['action'] === 'edit' ) || ! mycred_is_admin() ) return;
56
 
57
  echo '<div class="info notice notice-info"><p>' . sprintf( __( '%s needs your attention.', 'mycred' ), mycred_label() ) . ' <a href="' . admin_url( 'plugins.php?page=' . MYCRED_SLUG . '-setup' ) . '">' . __( 'Run Setup', 'mycred' ) . '</a></p></div>';
58
 
67
 
68
  $page = add_submenu_page(
69
  'plugins.php',
70
+ __( 'myCred Setup', 'mycred' ),
71
+ __( 'myCred Setup', 'mycred' ),
72
  'manage_options',
73
  MYCRED_SLUG . '-setup',
74
  array( $this, 'setup_page' )
88
  wp_enqueue_style( 'mycred-admin' );
89
  wp_enqueue_style( 'mycred-bootstrap-grid' );
90
  wp_enqueue_style( 'mycred-forms' );
91
+
92
  }
93
 
94
  /**
153
 
154
  <div class="row">
155
  <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
156
+ <p><input type="submit" onclick="startTour()" id="mycred-tour" class="button button-primary button-large" value="<?php _e( 'Create Point Type', 'mycred' ); ?>" /><button type="button" id="toggle-advanced-options" class="button button-secondary pull-right" data-hide="<?php _e( 'Hide', 'mycred' ); ?>" data-show="<?php _e( 'Advanced', 'mycred' ); ?>"><?php _e( 'Advanced', 'mycred' ); ?></button></p>
157
  </div>
158
  </div>
159
 
190
  <script type="text/javascript">
191
  jQuery(function($) {
192
 
193
+ var mycred_tour_guide = {};
194
+
195
  $( '#toggle-advanced-options' ).click(function(){
196
 
197
  var hidelabel = $(this).data( 'hide' );
247
  progressbox.hide();
248
 
249
  if ( response.success ) {
250
+ window.location.href = '<?php echo admin_url('admin.php?page=mycred&mycred_tour_guide=2'); ?>';
251
+ //completedbox.slideDown();
252
  setupform.remove();
253
  }
254
  else {
265
 
266
  });
267
  </script>
268
+
269
  <?php
270
 
271
  }
281
  $posted = wp_parse_args( $posted, $mycred->defaults() );
282
 
283
  ?>
284
+
285
  <div class="row">
286
  <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
287
  <h3><?php _e( 'Labels', 'mycred' ); ?></h3>
488
  wp_send_json_success();
489
 
490
  }
491
+ public function menu_setup( $current_screen ){
492
+
493
+ if ( $current_screen->id == 'plugins_page_mycred-setup' && ! isset( $_GET['mycred_tour_guide'] ) ){
494
+ wp_redirect(
495
+ add_query_arg(
496
+ array('page'=>'mycred-setup', 'mycred_tour_guide' => 1),
497
+ admin_url('plugins.php')
498
+ )
499
+ );
500
+ exit;
501
+ }
502
+ }
503
 
504
  }
505
  endif;
includes/mycred-walkthrough.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'myCRED_VERSION' ) ) exit;
3
+
4
+ /**
5
+ * myCRED_walkthrough class
6
+ * Used when the plugin has been activated for the first time. Handles the walkthrough
7
+ * wizard along with temporary admin menus.
8
+ * @since 2.1
9
+ * @version 1.0
10
+ */
11
+ if ( ! class_exists( 'myCRED_walkthroug' ) ) :
12
+ class myCRED_walkthroug {
13
+ /**
14
+ * Construct
15
+ */
16
+ public function __construct() {
17
+
18
+ $this->core = mycred();
19
+ }
20
+ /**
21
+ * Load Class
22
+ * @since 1.7
23
+ * @version 1.0
24
+ */
25
+ public function load() {
26
+
27
+ wp_register_style( 'mycred-tourguide-style', plugins_url( 'assets/css/tourguide.css', myCRED_THIS ), array(), myCRED_VERSION , 'all' );
28
+ wp_register_script( 'mycred-tourguide-script', plugins_url( 'assets/js/tourguide.min.js',myCRED_THIS ), array( 'jquery' ), myCRED_VERSION , true );
29
+
30
+ $step = intval($_GET['mycred_tour_guide']);
31
+
32
+ $redirect_url = '';
33
+
34
+ if( $step == 2 ) {
35
+
36
+ $redirect_url = admin_url('admin.php?page=mycred-hooks&mycred_tour_guide=3');
37
+
38
+ }
39
+ else if( $step == 3 ){
40
+
41
+ $redirect_url = admin_url('admin.php?page=mycred-addons&mycred_tour_guide=4');
42
+
43
+ }
44
+
45
+ wp_localize_script(
46
+ 'mycred-tourguide-script',
47
+ 'mycred_tour_guide',
48
+ array(
49
+ 'step' => $step,
50
+ 'redirect_url' => $redirect_url
51
+ ),
52
+ );
53
+ wp_enqueue_script( 'mycred-tourguide-script' );
54
+ wp_enqueue_style( 'mycred-tourguide-style' );
55
+ }
56
+ }
57
+ endif;
membership/mycred-connect-membership.php CHANGED
@@ -20,7 +20,6 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
20
  public function __construct() {
21
  add_action( 'admin_menu', array( $this, 'mycred_membership_menu' ) );
22
  add_action( 'admin_init', array( $this, 'add_styles' ) );
23
- add_action( 'mycred_admin_init', array( $this, 'mycred_review_notice' ) );
24
  add_action( 'mycred_admin_init', array( $this, 'membership_addon_actions' ) );
25
  }
26
 
@@ -103,117 +102,6 @@ if ( ! class_exists( 'myCRED_Connect_Membership' ) ) :
103
  }
104
  }
105
 
106
- /**
107
- * myCred Review Dialog
108
- */
109
- public function mycred_review_notice() {
110
-
111
- $this->mycred_review_dismissal();
112
- $this->mycred_review_prending();
113
-
114
- $review_dismissal = get_site_option( 'mycred_review_dismiss' );
115
- if ( 'yes' == $review_dismissal ) {
116
- return;
117
- }
118
-
119
- $activation_time = get_site_option( 'mycred_active_time' );
120
- if ( ! $activation_time ) {
121
-
122
- $activation_time = time();
123
- add_site_option( 'mycred_active_time', $activation_time );
124
- }
125
-
126
- // Show notice after 7 Days.
127
- if ( ( time() - $activation_time ) > 604800 ) {
128
- add_action( 'admin_notices', array( $this, 'mycred_review_notice_content' ) );
129
- }
130
-
131
- }
132
-
133
- public function mycred_review_dismissal() {
134
-
135
- if ( ! is_admin() ||
136
- ! current_user_can( 'manage_options' ) ||
137
- ! isset( $_GET['_wpnonce'] ) ||
138
- ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'mycred-review-nonce' ) ||
139
- ! isset( $_GET['mycred_review_dismiss'] ) ) {
140
-
141
- return;
142
- }
143
-
144
- update_site_option( 'mycred_review_dismiss', 'yes' );
145
- }
146
-
147
- public function mycred_review_prending() {
148
-
149
- if ( ! is_admin() ||
150
- ! current_user_can( 'manage_options' ) ||
151
- ! isset( $_GET['_wpnonce'] ) ||
152
- ! wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_wpnonce'] ) ), 'mycred-review-nonce' ) ||
153
- ! isset( $_GET['mycred_review_later'] ) ) {
154
-
155
- return;
156
- }
157
-
158
- // Reset Time
159
- update_site_option( 'mycred_active_time', time() );
160
-
161
- }
162
-
163
- public function mycred_review_notice_content() {
164
-
165
- $scheme = ( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_QUERY ) ) ? '&' : '?';
166
- $url = $_SERVER['REQUEST_URI'] . $scheme . 'mycred_review_dismiss=yes';
167
- $dismiss_url = wp_nonce_url( $url, 'mycred-review-nonce' );
168
-
169
- $later = $_SERVER['REQUEST_URI'] . $scheme . 'mycred_review_later=yes';
170
- $later_url = wp_nonce_url( $later, 'mycred-review-nonce' );
171
-
172
- ?>
173
- <div class="mycred-review-notice">
174
- <div class="mycred-review-thumbnail">
175
- <img src="<?php echo plugins_url( 'assets/images/about/badge.png', myCRED_THIS ); ?>" alt="">
176
- </div>
177
- <div class="mycred-review-text">
178
- <h3><?php _e( 'Your Feedback Please?', 'mycred' ); ?></h3>
179
- <p><?php _e( 'We hope you had a pleasant experience of using myCred points management system. It will be highly appreciated if you leave us your valuable feedback on Wordpress.org.', 'mycred' ); ?></p>
180
- <ul class="mycred-review-ul">
181
- <li>
182
- <a href="https://wordpress.org/support/plugin/mycred/reviews/?filter=5" target="_blank">
183
- <span class="dashicons dashicons-external"></span>
184
- <?php _e( 'Sure, why not?', 'mycred' ); ?>
185
- </a>
186
- </li>
187
- <li>
188
- <a href="<?php echo $dismiss_url; ?>">
189
- <span class="dashicons dashicons-smiley"></span>
190
- <?php _e( 'I have already provided my feedback', 'mycred' ); ?>
191
- </a>
192
- </li>
193
- <li>
194
- <a href="<?php echo $later_url; ?>">
195
- <span class="dashicons dashicons-calendar-alt"></span>
196
- <?php _e( 'Ummm, maybe later!', 'mycred' ); ?>
197
- </a>
198
- </li>
199
- <li>
200
- <a href="<?php echo $dismiss_url; ?>">
201
- <span class="dashicons dashicons-dismiss"></span>
202
- <?php _e( 'Never show again', 'mycred' ); ?>
203
- </a>
204
- </li>
205
- <li>
206
- <a href="https://mycred.me/membership/">
207
- <span class="dashicons dashicons-businessman"></span>
208
- <?php _e( 'Explore Membership Plans', 'mycred' ); ?>
209
- </a>
210
- </li>
211
- </ul>
212
- </div>
213
- </div>
214
- <?php
215
- }
216
-
217
  public function mycred_display_membership_table(){
218
 
219
 
20
  public function __construct() {
21
  add_action( 'admin_menu', array( $this, 'mycred_membership_menu' ) );
22
  add_action( 'admin_init', array( $this, 'add_styles' ) );
 
23
  add_action( 'mycred_admin_init', array( $this, 'membership_addon_actions' ) );
24
  }
25
 
102
  }
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  public function mycred_display_membership_table(){
106
 
107
 
membership/subscription-functions.php CHANGED
@@ -217,7 +217,7 @@ if( !function_exists('mycred_is_membership_active') ) {
217
 
218
  $user_license_key = mycred_get_membership_key();
219
 
220
- $mycred_version = (int) str_replace( '.', '', myCRED_VERSION );
221
 
222
  $url = rtrim( get_bloginfo( 'url' ), '/' );
223
  if( $mycred_version >= 188 && !empty( $user_license_key ) &&
217
 
218
  $user_license_key = mycred_get_membership_key();
219
 
220
+ $mycred_version = str_pad( (int) str_replace( '.', '', myCRED_VERSION ), 3, '0' );
221
 
222
  $url = rtrim( get_bloginfo( 'url' ), '/' );
223
  if( $mycred_version >= 188 && !empty( $user_license_key ) &&
modules/mycred-module-addons.php CHANGED
@@ -76,7 +76,7 @@ if ( ! class_exists( 'myCRED_Addons_Module' ) ) :
76
 
77
  mycred_update_option( 'mycred_pref_addons', $new_settings );
78
 
79
- $url = add_query_arg( array( 'page' => MYCRED_SLUG . '-addons', 'activated' => $result ), admin_url( 'admin.php' ) );
80
 
81
  wp_safe_redirect( $url );
82
  exit;
76
 
77
  mycred_update_option( 'mycred_pref_addons', $new_settings );
78
 
79
+ $url = add_query_arg( array( 'page' => MYCRED_SLUG . '-addons', 'activated' => $result, $addon_id => $action ), admin_url( 'admin.php' ) );
80
 
81
  wp_safe_redirect( $url );
82
  exit;
modules/mycred-module-management.php CHANGED
@@ -60,7 +60,7 @@ if ( ! class_exists( 'myCRED_Management_Module' ) ) :
60
  /**
61
  * AJAX: Update Balance
62
  * @since 1.7
63
- * @version 1.0
64
  */
65
  public function ajax_editor_balance_update() {
66
 
@@ -190,8 +190,9 @@ if ( ! class_exists( 'myCRED_Management_Module' ) ) :
190
 
191
  }
192
 
193
- wp_send_json_success( $result );
194
 
 
195
  }
196
 
197
  /**
60
  /**
61
  * AJAX: Update Balance
62
  * @since 1.7
63
+ * @version 1.1
64
  */
65
  public function ajax_editor_balance_update() {
66
 
190
 
191
  }
192
 
193
+ do_action( 'mycred_finish_without_log_entry', $result );
194
 
195
+ wp_send_json_success( $result );
196
  }
197
 
198
  /**
mycred.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: myCred
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
- * Version: 2.0.2
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCred
9
  * Author URI: https://mycred.me
@@ -20,7 +20,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
- public $version = '2.0.2';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
@@ -54,14 +54,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
54
  * @since 1.7
55
  * @version 1.0
56
  */
57
- public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.0.2' ); }
58
 
59
  /**
60
  * Not allowed
61
  * @since 1.7
62
  * @version 1.0
63
  */
64
- public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.0.2' ); }
65
 
66
  /**
67
  * Get
@@ -82,7 +82,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
82
  if ( ! defined( $name ) )
83
  define( $name, $value );
84
  elseif ( ! $definable && defined( $name ) )
85
- _doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.0.2' );
86
  }
87
 
88
  /**
@@ -94,7 +94,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
94
  if ( file_exists( $required_file ) )
95
  require_once $required_file;
96
  else
97
- _doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.0.2' );
98
  }
99
 
100
  /**
@@ -259,6 +259,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
259
  $this->file( myCRED_INCLUDES_DIR . 'mycred-about.php' );
260
  $this->file( myCRED_INCLUDES_DIR . 'mycred-nav-menu.php' );
261
 
 
 
 
 
 
 
 
 
262
  // If myCRED has been setup and is ready to begin
263
  if ( mycred_is_installed() ) {
264
 
3
  * Plugin Name: myCred
4
  * Plugin URI: https://mycred.me
5
  * Description: An adaptive points management system for WordPress powered websites.
6
+ * Version: 2.1
7
  * Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
8
  * Author: myCred
9
  * Author URI: https://mycred.me
20
  final class myCRED_Core {
21
 
22
  // Plugin Version
23
+ public $version = '2.1';
24
 
25
  // Instnace
26
  protected static $_instance = NULL;
54
  * @since 1.7
55
  * @version 1.0
56
  */
57
+ public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.1' ); }
58
 
59
  /**
60
  * Not allowed
61
  * @since 1.7
62
  * @version 1.0
63
  */
64
+ public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin&#8217; huh?', '2.1' ); }
65
 
66
  /**
67
  * Get
82
  if ( ! defined( $name ) )
83
  define( $name, $value );
84
  elseif ( ! $definable && defined( $name ) )
85
+ _doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.1' );
86
  }
87
 
88
  /**
94
  if ( file_exists( $required_file ) )
95
  require_once $required_file;
96
  else
97
+ _doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.1' );
98
  }
99
 
100
  /**
259
  $this->file( myCRED_INCLUDES_DIR . 'mycred-about.php' );
260
  $this->file( myCRED_INCLUDES_DIR . 'mycred-nav-menu.php' );
261
 
262
+ if( isset ( $_GET['mycred_tour_guide'] ) ){
263
+
264
+ $this->file( myCRED_INCLUDES_DIR . 'mycred-walkthrough.php' );
265
+ $walkthrough = new myCRED_walkthroug();
266
+ $walkthrough->load();
267
+
268
+ }
269
+
270
  // If myCRED has been setup and is ready to begin
271
  if ( mycred_is_installed() ) {
272
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
- Tested up to: 5.6
6
- Stable tag: 2.0.2
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -60,7 +60,33 @@ Join the myCred membership club today and take advantage of premium services tha
60
  * **Pay Through PayPal -** cashCred supports payment through PayPal.
61
  * **Pay Through Stripe -** cashCred supports payment through Stripe.
62
 
63
- **Important Announcement** You have to update your myCred plugin to version 2.0 in order to use the myCred cashCred services.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  = Features =
66
 
@@ -335,6 +361,23 @@ Bug fixes release.
335
 
336
  == Changelog ==
337
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
338
  = 2.0.2 =
339
  New - Added compatibility for multiple currencies in CashCred Paypal addon
340
  Fix - Php erros in myCred woocommerce gateway
2
  Contributors: mycred,wpexpertsio
3
  Tags: badges, gamification, loyalty, points, rewards
4
  Requires at least: 4.8
5
+ Tested up to: 5.7.1
6
+ Stable tag: 2.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
60
  * **Pay Through PayPal -** cashCred supports payment through PayPal.
61
  * **Pay Through Stripe -** cashCred supports payment through Stripe.
62
 
63
+ myCred v2.1 - Open Badge Features.
64
+
65
+ **Open badges: new opportunities to recognize and validate achievements digitally.**
66
+
67
+ The most prominent feature in myCred 2.1 is the **Single Badge Page** which creates an exclusive page for each badge and its information (badge name, image, badge description, achievements, and benefits).
68
+
69
+ **Open Badge Functionality**
70
+
71
+ - Create professional-looking badge/point/rank.
72
+ - Add badge details (name, achievement, website details, etc.).
73
+ - Badge recognition and validation through different badge verification websites.
74
+
75
+ **Achievements**
76
+
77
+ - Issue badges for any combination of achievements.
78
+ - Detailed badge categorization.
79
+ - Industry-related achievement.
80
+
81
+ **Achievement list Shortcode**
82
+
83
+ - Thorough myCred badge listing in tabs.
84
+ - Category wise display in tabs.
85
+ - Different color variants when a lock or unlock.
86
+
87
+ **Evidence Shortcode**
88
+
89
+ - Technical support for badge verification purpose.
90
 
91
  = Features =
92
 
361
 
362
  == Changelog ==
363
 
364
+ = 2.1 =
365
+ NEW - Open badge functionality in myCred Badge addon.
366
+ NEW - Introduce Achievement Types.
367
+ NEW - Introduce a new shortcode mycred_badges_list.
368
+ NEW - Single badge page.
369
+ NEW - Added support into Badges for Anniversary hook.
370
+ NEW - Added support into Badges for wooCommerce purchase reward.
371
+ NEW - Added %rank_title% template tag support in Email Notifications.
372
+ NEW - Added attributes in mycred_transfer shortcode.
373
+ TWEAK - Removed deprecated functions.
374
+ TWEAK - Code Improvement.
375
+ TWEAK - Improve styling of mycred_transfer shortcode.
376
+ FIX - mycred_history shortcode pagination not working properly when cache enabled.
377
+ FIX - Ranks weren't working properly on the current balance.
378
+ FIX - mycred_sell_this shortcode not working in the bbPress topic
379
+ FIX - The central deposit missing log entry in some cases.
380
+
381
  = 2.0.2 =
382
  New - Added compatibility for multiple currencies in CashCred Paypal addon
383
  Fix - Php erros in myCred woocommerce gateway