AMP for WP – Accelerated Mobile Pages - Version 0.9.69

Version Description

(20th November 2017) = * View More details on https://ampforwp.com/0-9-69-released-stability-update-75th-update/ * One Signal Push Notifications bug fixed! #1404 * AMP theme framework Related posts extended so that it can be used as a loop format #1406 * Facebook like Button improvements #1405 * Add layout responsive tag to image module in page builder #1373 * Strip the shortcodes from Structure data area #1389 * Test HTTP API Call From admin panel by redux #1391 * Meta description tag in normal site Unicode character is different from AMP site unicode character. #1369 * Updated the check for ampforwp_is_amp_endpoint this should fix the issue #1372 * Updated the URL for design 3 so it can work with plain permalink #1318 * Updated the option Featured Image from The Content #1367 * If Featured Image From The Content is enabled and Duplicate Featured Image is disable it will remove all the duplicate images from the content. #1375 * Date Format under Homepage improvements #1408 * Warnings due to inline related posts in Homepage #1413 * Plain Permalinks Support improved. #1318 * Allow Homepage title of Bread Crumbs feature to be changed from Translation Panel #1414 * Debug Errors in AMP Theme Framework #1403 * Unnecessary loading of Merriweather fixed, it will only load in the Design 1. * Enter Phone Number is not Appearing when switch to Call now button #1425 * Need excerpt below the title, above the meta #1399 * Remove the Separator piple symbol from the footer when Back to Top link is off #1417 * Display Child or subcategories on Category pages. #1385 * Add Caption in the Gallery Image feature conflicting with Gallery widget #1407 * Youtube Shortcode embed with &rel=0 support #1378 * Filter for Excerpt custom text in the AMP options #1411 * WPML Multilingual CMS plugin flags compatibility #1270 * Compatibility with Tasty Recipes plugin and other page builders with amp page builder #1431

Download this release

Release Info

Developer mohammed_kaludi
Plugin Icon 128x128 AMP for WP – Accelerated Mobile Pages
Version 0.9.69
Comparing to
See all releases

Code changes from version 0.9.68 to 0.9.69

Files changed (69) hide show
  1. accelerated-moblie-pages.php +7 -2
  2. classes/class-ampforwp-youtube-embed.php +3 -3
  3. components/author-box/author-box.php +1 -1
  4. components/categories-tags/categories-tags.php +2 -2
  5. components/comments/comments.php +1 -1
  6. components/components-core.php +2 -2
  7. components/loop/loop.php +13 -7
  8. components/menu/menu.php +1 -55
  9. components/post-navigation/post-navigation.php +2 -2
  10. components/related-posts/related-posts.php +80 -51
  11. components/social-icons/social-icons.php +39 -31
  12. components/theme-loader.php +6 -1
  13. includes/onesignal-integration/OneSignalSDKWorker.js +2 -0
  14. includes/onesignal-integration/amp-helper-frame.html +31 -0
  15. includes/onesignal-integration/amp-permission-dialog.html +158 -0
  16. includes/options/admin-config.php +52 -32
  17. includes/options/redux-core/inc/class.redux_helpers.php +2 -1
  18. pagebuilder/functions.php +3 -3
  19. pagebuilder/inc/admin-amp-page-builder.js +6 -136
  20. pagebuilder/modules/contents.php +3 -3
  21. pagebuilder/modules/image.php +1 -1
  22. readme.txt +32 -2
  23. templates/category-widget.php +8 -10
  24. templates/design-manager/design-1/archive.php +28 -7
  25. templates/design-manager/design-1/elements/bread-crumbs.php +9 -9
  26. templates/design-manager/design-1/elements/content.php +2 -12
  27. templates/design-manager/design-1/elements/featured-image.php +8 -6
  28. templates/design-manager/design-1/elements/meta-info.php +3 -16
  29. templates/design-manager/design-1/elements/meta-taxonomy.php +2 -2
  30. templates/design-manager/design-1/elements/related-posts.php +2 -4
  31. templates/design-manager/design-1/elements/social-icons.php +1 -1
  32. templates/design-manager/design-1/elements/title.php +14 -2
  33. templates/design-manager/design-1/footer.php +13 -6
  34. templates/design-manager/design-1/frontpage.php +9 -25
  35. templates/design-manager/design-1/header-bar.php +15 -11
  36. templates/design-manager/design-1/index.php +14 -6
  37. templates/design-manager/design-1/search.php +15 -8
  38. templates/design-manager/design-1/style.php +1 -7
  39. templates/design-manager/design-2/archive.php +39 -10
  40. templates/design-manager/design-2/elements/bread-crumbs.php +17 -16
  41. templates/design-manager/design-2/elements/content.php +3 -12
  42. templates/design-manager/design-2/elements/featured-image.php +6 -6
  43. templates/design-manager/design-2/elements/meta-info.php +4 -8
  44. templates/design-manager/design-2/elements/related-posts.php +1 -4
  45. templates/design-manager/design-2/elements/social-icons.php +1 -1
  46. templates/design-manager/design-2/elements/title.php +15 -3
  47. templates/design-manager/design-2/footer.php +11 -7
  48. templates/design-manager/design-2/frontpage.php +8 -24
  49. templates/design-manager/design-2/header-bar.php +2 -1
  50. templates/design-manager/design-2/index.php +23 -5
  51. templates/design-manager/design-2/search.php +21 -5
  52. templates/design-manager/design-2/style.php +2 -1
  53. templates/design-manager/design-3/archive.php +37 -6
  54. templates/design-manager/design-3/elements/bread-crumbs.php +8 -8
  55. templates/design-manager/design-3/elements/content.php +3 -11
  56. templates/design-manager/design-3/elements/featured-image.php +9 -6
  57. templates/design-manager/design-3/elements/meta-info.php +2 -2
  58. templates/design-manager/design-3/elements/meta-taxonomy.php +1 -1
  59. templates/design-manager/design-3/elements/related-posts.php +2 -3
  60. templates/design-manager/design-3/elements/social-icons.php +1 -1
  61. templates/design-manager/design-3/elements/title.php +16 -4
  62. templates/design-manager/design-3/footer.php +7 -2
  63. templates/design-manager/design-3/frontpage.php +9 -24
  64. templates/design-manager/design-3/header-bar.php +1 -0
  65. templates/design-manager/design-3/index.php +22 -5
  66. templates/design-manager/design-3/search.php +23 -8
  67. templates/design-manager/design-3/style.php +3 -3
  68. templates/features.php +178 -60
  69. templates/woo-widget.php +1 -1
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 0.9.68
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -18,7 +18,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
- define('AMPFORWP_VERSION','0.9.68');
22
 
23
  // any changes to AMP_QUERY_VAR should be refelected here
24
  function ampforwp_generate_endpoint(){
@@ -80,6 +80,7 @@ function ampforwp_get_the_page_id_blog_page(){
80
 
81
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
82
  function ampforwp_add_custom_rewrite_rules() {
 
83
  // For Homepage
84
  add_rewrite_rule(
85
  'amp/?$',
@@ -176,6 +177,10 @@ function ampforwp_add_custom_rewrite_rules() {
176
  );
177
  }
178
  }
 
 
 
 
179
  }
180
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
181
 
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 0.9.69
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
+ define('AMPFORWP_VERSION','0.9.69');
22
 
23
  // any changes to AMP_QUERY_VAR should be refelected here
24
  function ampforwp_generate_endpoint(){
80
 
81
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
82
  function ampforwp_add_custom_rewrite_rules() {
83
+ global $redux_builder_amp;
84
  // For Homepage
85
  add_rewrite_rule(
86
  'amp/?$',
177
  );
178
  }
179
  }
180
+ // For OneSignal
181
+ if(isset($redux_builder_amp['ampforwp-web-push-onesignal']) && $redux_builder_amp['ampforwp-web-push-onesignal'] ){
182
+ add_rewrite_rule('OneSignalSDKWorker.js','wp-content/plugins/accelerated-mobile-pages/includes/onesignal-integration/OneSignalSDKWorker.js','top');
183
+ }
184
  }
185
  add_action( 'init', 'ampforwp_add_custom_rewrite_rules' );
186
 
classes/class-ampforwp-youtube-embed.php CHANGED
@@ -77,15 +77,15 @@ class AMPforWP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
77
  }
78
 
79
  $this->did_convert_elements = true;
80
-
81
  return AMP_HTML_Utils::build_tag(
82
- 'amp-youtube',
83
  array(
84
  'data-videoid' => $args['video_id'],
85
  'layout' => 'responsive',
86
  'width' => $this->args['width'],
87
  'height' => $this->args['height'],
88
- )
89
  );
90
  }
91
 
77
  }
78
 
79
  $this->did_convert_elements = true;
80
+ // Return it with a filter for the modification purpose #1378
81
  return AMP_HTML_Utils::build_tag(
82
+ 'amp-youtube',apply_filters('amp_youtube_params',
83
  array(
84
  'data-videoid' => $args['video_id'],
85
  'layout' => 'responsive',
86
  'width' => $this->args['width'],
87
  'height' => $this->args['height'],
88
+ ) )
89
  );
90
  }
91
 
components/author-box/author-box.php CHANGED
@@ -61,7 +61,7 @@ $author_avatar_url = get_avatar_url( $post_author->ID, array( 'size' => $avatar_
61
  <?php } ?>
62
  <?php echo '<div class="author-details '. $author_wrapper_class .'">
63
  <span class="author-name">'
64
- .$author_prefix . ' <a href="'. $author_link.AMPFORWP_AMP_QUERY_VAR.'"> ' .esc_html( $post_author->display_name ).'</a>
65
  </span>';
66
 
67
  //to show date and time
61
  <?php } ?>
62
  <?php echo '<div class="author-details '. $author_wrapper_class .'">
63
  <span class="author-name">'
64
+ .$author_prefix . ' <a href="'. ampforwp_url_controller($author_link).'"> ' .esc_html( $post_author->display_name ).'</a>
65
  </span>';
66
 
67
  //to show date and time
components/categories-tags/categories-tags.php CHANGED
@@ -12,7 +12,7 @@ function ampforwp_framework_get_categories_list(){
12
  <span>Categories:</span>
13
  <?php foreach ($ampforwp_categories as $cat ) {
14
  //if($redux_builder_amp['ampforwp-archive-support']){
15
- echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'.user_trailingslashit( trailingslashit( get_category_link( $cat->term_id ) ) . AMPFORWP_AMP_QUERY_VAR ) .'" > '. $cat->name .'</a></span>');//#934
16
  //} else {
17
  // echo '<span>'. $cat->name .'</span>';
18
  //}
@@ -32,7 +32,7 @@ function ampforwp_framework_get_tags_list(){
32
  <span>Tags:</span>
33
  <?php foreach ($ampforwp_tags as $tag) {
34
  //if($redux_builder_amp['ampforwp-archive-support']){
35
- echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. user_trailingslashit( trailingslashit( get_tag_link( $tag->term_id ) ) .'amp' ).'" >'.$tag->name .'</a></span>');//#934
36
  //} else {
37
  // echo ('<span>'.$tag->name.'</span>');
38
  //}
12
  <span>Categories:</span>
13
  <?php foreach ($ampforwp_categories as $cat ) {
14
  //if($redux_builder_amp['ampforwp-archive-support']){
15
+ echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. ampforwp_url_controller( get_category_link( $cat->term_id ) ) .'" > '. $cat->name .'</a></span>');//#934
16
  //} else {
17
  // echo '<span>'. $cat->name .'</span>';
18
  //}
32
  <span>Tags:</span>
33
  <?php foreach ($ampforwp_tags as $tag) {
34
  //if($redux_builder_amp['ampforwp-archive-support']){
35
+ echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. ampforwp_url_controller( get_tag_link( $tag->term_id ) ).'" >'.$tag->name .'</a></span>');//#934
36
  //} else {
37
  // echo ('<span>'.$tag->name.'</span>');
38
  //}
components/comments/comments.php CHANGED
@@ -101,7 +101,7 @@ else {
101
  <?php } ?>
102
  <?php } ?>
103
  </div>
104
- <?php do_action('ampforwp_after_comment_hook',$this);
105
 
106
  }
107
 
101
  <?php } ?>
102
  <?php } ?>
103
  </div>
104
+ <?php do_action('ampforwp_after_comment_hook');
105
 
106
  }
107
 
components/components-core.php CHANGED
@@ -82,13 +82,13 @@ function amp_title(){
82
  else
83
  $ID = $post->ID;
84
  if( $ID!=null ){
85
- do_action('ampforwp_above_the_title',$this); ?>
86
  <h1 class="amp-post-title"> <?php
87
  $ampforwp_title = get_the_title($ID);
88
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
89
  echo wp_kses_data( $ampforwp_title ); ?>
90
  </h1>
91
- <?php do_action('ampforwp_below_the_title',$this); ?>
92
  <?php
93
  }
94
  }
82
  else
83
  $ID = $post->ID;
84
  if( $ID!=null ){
85
+ do_action('ampforwp_above_the_title'); ?>
86
  <h1 class="amp-post-title"> <?php
87
  $ampforwp_title = get_the_title($ID);
88
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
89
  echo wp_kses_data( $ampforwp_title ); ?>
90
  </h1>
91
+ <?php do_action('ampforwp_below_the_title'); ?>
92
  <?php
93
  }
94
  }
components/loop/loop.php CHANGED
@@ -145,7 +145,7 @@ function call_loops_standard($data=array()){
145
  return "";
146
  }
147
 
148
- function amp_pagination(){
149
  global $amp_q, $redux_builder_amp;
150
  if (get_query_var( 'paged' ) ) {
151
  $paged = get_query_var('paged');
@@ -155,12 +155,18 @@ function call_loops_standard($data=array()){
155
  $paged = 1;
156
  }
157
  $pre_link = '';
 
 
 
 
 
 
158
  if ( $paged > 1 ) {
159
- $pre_link = '<div class="left">'.get_previous_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-previous-posts-text'], 'Show previous Posts' ) ) .'</div>';
160
  }
161
 
162
  echo '<div class="loop-pagination">
163
- <div class="right">'. get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-more-posts-text'] , 'Show more Posts'), $amp_q->max_num_pages ) .'</div>
164
  '.$pre_link.'
165
  <div class="clearfix"></div>
166
  </div>';
@@ -220,10 +226,10 @@ function call_loops_standard($data=array()){
220
  }
221
 
222
  function amp_loop_permalink($return,$amp_query_var ='amp'){
223
- if($return){
224
- return user_trailingslashit(trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR) ;
225
  }
226
- echo user_trailingslashit(trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR) ;
227
  }
228
  function amp_loop_image( $data=array() ){
229
  global $ampLoopData,$counterOffset;
@@ -271,7 +277,7 @@ function call_loops_standard($data=array()){
271
  echo ' <ul class="loop-category">';
272
  if(count(get_the_category()) > 0){
273
  foreach((get_the_category()) as $category) {
274
- echo '<li class="amp-cat-'. $category->term_id.'"><a href="'.get_category_link($category->term_id).AMPFORWP_AMP_QUERY_VAR.'">'. $category->cat_name.'</a></li>';
275
  }
276
  }
277
  echo '</ul>';
145
  return "";
146
  }
147
 
148
+ function amp_pagination($args =array()) {
149
  global $amp_q, $redux_builder_amp;
150
  if (get_query_var( 'paged' ) ) {
151
  $paged = get_query_var('paged');
155
  $paged = 1;
156
  }
157
  $pre_link = '';
158
+ if(!isset($args['previous_text']) || $args['previous_text']==''){
159
+ $args['previous_text'] = 'Show previous Posts';
160
+ }
161
+ if(!isset($args['next_text']) || $args['next_text']==''){
162
+ $args['next_text'] = 'Show more Posts';
163
+ }
164
  if ( $paged > 1 ) {
165
+ $pre_link = '<div class="left">'.get_previous_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-previous-posts-text'], $args['previous_text'] ) ) .'</div>';
166
  }
167
 
168
  echo '<div class="loop-pagination">
169
+ <div class="right">'. get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-more-posts-text'] , $args['next_text']), $amp_q->max_num_pages ) .'</div>
170
  '.$pre_link.'
171
  <div class="clearfix"></div>
172
  </div>';
226
  }
227
 
228
  function amp_loop_permalink($return,$amp_query_var ='amp'){
229
+ if( $return ){
230
+ return ampforwp_url_controller( get_permalink() ) ;
231
  }
232
+ echo ampforwp_url_controller( get_permalink() );
233
  }
234
  function amp_loop_image( $data=array() ){
235
  global $ampLoopData,$counterOffset;
277
  echo ' <ul class="loop-category">';
278
  if(count(get_the_category()) > 0){
279
  foreach((get_the_category()) as $category) {
280
+ echo '<li class="amp-cat-'. $category->term_id.'"><a href="'.ampforwp_url_controller( get_category_link( $category->term_id ) ).'">'. $category->cat_name.'</a></li>';
281
  }
282
  }
283
  echo '</ul>';
components/menu/menu.php CHANGED
@@ -13,59 +13,5 @@ if( has_nav_menu( 'amp-menu' ) ) {
13
  //Load styling for Menu
14
  add_action('amp_post_template_css','amp_menu_styles',11);
15
  function amp_menu_styles(){ ?>
16
- aside {
17
- width: 150px;
18
- }
19
- .amp-menu {
20
- list-style-type: none;
21
- margin: 0;
22
- padding: 0;
23
- }
24
- .amp-menu li {
25
- position: relative;
26
- display: block;
27
- }
28
- .amp-menu li.menu-item-has-children ul {
29
- display: none;
30
- }
31
- .amp-menu li.menu-item-has-children:hover > ul {
32
- display: block ;
33
- }
34
- .amp-menu li.menu-item-has-children > ul > li {
35
- padding-left: 10px ;
36
- }
37
- .amp-menu li.menu-item-has-children:after {
38
- content: " > ";
39
- position: absolute;
40
- padding: 10px;
41
- right: 0;
42
- top: 0;
43
- z-index: 10000;
44
- line-height: 1;
45
- background:#ddd
46
- }
47
- .amp-menu > li a {
48
- padding: 7px;
49
- display: block;
50
- margin-bottom: 1px;
51
- }
52
- .amp-menu > li ul {
53
- list-style-type: none;
54
- margin: 0;
55
- padding: 0;
56
- position: relative;
57
- }
58
- .amp-menu > li > li a {
59
- background: #e5e5e5;
60
- }
61
- .amp-menu > li > li a {
62
- background: #e5e5e5;
63
- }
64
-
65
- .amp-menu li:hover a {
66
- background: #fff;
67
- }
68
- .amp-menu li:hover li:hover > a {
69
- background: #fff;
70
- }
71
  <?php }
13
  //Load styling for Menu
14
  add_action('amp_post_template_css','amp_menu_styles',11);
15
  function amp_menu_styles(){ ?>
16
+ aside{width:150px}.amp-menu{list-style-type:none;margin:0;padding:0}.amp-menu li{position:relative;display:block}.amp-menu li.menu-item-has-children ul{display:none}.amp-menu li.menu-item-has-children:hover>ul{display:block}.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}.amp-menu li.menu-item-has-children:after{content:" > ";position:absolute;padding:10px;right:0;top:0;z-index:10000;line-height:1;background:#ddd}.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}.amp-menu>li>li a{background:#e5e5e5}.amp-menu>li>li a{background:#e5e5e5}.amp-menu li:hover a{background:#fff}.amp-menu li:hover li:hover>a{background:#fff}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  <?php }
components/post-navigation/post-navigation.php CHANGED
@@ -8,7 +8,7 @@ function ampforwp_framework_get_post_navigation(){
8
  if (!empty( $next_post )) {
9
  $next_text = $next_post->post_title;
10
  ?>
11
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $next_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
12
  } ?>
13
  </div>
14
 
@@ -17,7 +17,7 @@ function ampforwp_framework_get_post_navigation(){
17
  if (!empty( $prev_post )) {
18
  $prev_text = $prev_post->post_title;
19
  ?>
20
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $prev_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
21
  } ?>
22
  </div>
23
 
8
  if (!empty( $next_post )) {
9
  $next_text = $next_post->post_title;
10
  ?>
11
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
12
  } ?>
13
  </div>
14
 
17
  if (!empty( $prev_post )) {
18
  $prev_text = $prev_post->post_title;
19
  ?>
20
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
21
  } ?>
22
  </div>
23
 
components/related-posts/related-posts.php CHANGED
@@ -5,7 +5,38 @@
5
  */
6
  function ampforwp_framework_get_related_posts($argsdata=array()){
7
  global $post, $redux_builder_amp;
8
- do_action('ampforwp_above_related_post',$this); //Above Related Posts
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts'];
10
  $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
11
  $args = null;
@@ -42,57 +73,55 @@ function ampforwp_framework_get_related_posts($argsdata=array()){
42
  }
43
  }
44
  $my_query = new wp_query( $args );
45
- if( $my_query->have_posts() ) { ?>
46
- <div class="amp-related-posts">
47
- <ul class="clearfix">
48
- <h3 class="amp-related-posts-title"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-related-text'], 'Related Post' ); ?></h3>
49
- <?php
50
- while( $my_query->have_posts() ) {
51
- $my_query->the_post();
52
- $related_post_permalink = get_permalink();
53
- $related_post_permalink = trailingslashit($related_post_permalink);
54
- $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
55
- ?>
56
- <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
57
- <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
58
- <?php
59
- $thumb_id_2 = get_post_thumbnail_id();
60
- $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, 'thumbnail', true);
61
- $thumb_url_2 = $thumb_url_array_2[0];
62
- ?>
63
 
64
- <?php if ( has_post_thumbnail() ) { ?>
65
- <amp-img src="<?php echo esc_url( $thumb_url_2 ); ?>" width="150" height="150" layout="responsive"></amp-img>
66
- <?php } ?>
67
- </a>
68
- <div class="related_link">
69
- <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
70
 
71
- <?php
72
- $show_excerpt = (isset($argsdata['show_excerpt'])? $argsdata['show_excerpt'] : true);
73
- if($show_excerpt){
74
- if(has_excerpt()){
75
- $content = get_the_excerpt();
76
- }else{
77
- $content = get_the_content();
78
- }
79
- ?><p><?php
80
- echo wp_trim_words( strip_shortcodes( $content ) , '15' );
81
- ?></p><?php
82
- }
83
- $show_author = (isset($argsdata['show_author'])? $argsdata['show_author'] : true);
84
- if($show_author){
85
- $author_args = isset($argsdata['author_args'])? $argsdata['author_args'] : array();
86
- ampforwp_framework_get_author_box($author_args);
87
- }
88
- ?></div>
89
- </li>
90
- <?php
91
- }
92
 
93
- } ?>
94
- </ul>
95
- </div>
96
- <?php wp_reset_postdata(); ?>
97
- <?php do_action('ampforwp_below_related_post_hook',$this);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
5
  */
6
  function ampforwp_framework_get_related_posts($argsdata=array()){
7
  global $post, $redux_builder_amp;
8
+ do_action('ampforwp_above_related_post'); //Above Related Posts
9
+ $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts'];
10
+ $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
11
+ $my_query = related_post_loop_query();
12
+ if( $my_query->have_posts() ) { ?>
13
+ <div class="amp-related-posts">
14
+ <ul class="clearfix">
15
+ <?php ampforwp_related_post(); ?>
16
+ <?php
17
+ while( $my_query->have_posts() ) {
18
+ $my_query->the_post();
19
+
20
+ ?>
21
+ <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
22
+ <?php
23
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );
24
+ ampforwp_get_relatedpost_image('thumbnail');
25
+ ampforwp_get_relatedpost_content($argsdata);
26
+ ?>
27
+ </li><?php
28
+ }
29
+
30
+ } ?>
31
+ </ul>
32
+ </div>
33
+ <?php wp_reset_postdata(); ?>
34
+ <?php do_action('ampforwp_below_related_post_hook');
35
+ }
36
+
37
+
38
+ function related_post_loop_query(){
39
+ global $post, $redux_builder_amp;
40
  $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts'];
41
  $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
42
  $args = null;
73
  }
74
  }
75
  $my_query = new wp_query( $args );
76
+ return $my_query;
77
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
+ function ampforwp_related_post(){
80
+ global $redux_builder_amp;
81
+ ?>
82
+ <h3 class="amp-related-posts-title"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-related-text'], 'Related Post' ); ?></h3>
83
+ <?php }
 
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
+ function ampforwp_get_relatedpost_image( $imagetype ='thumbnail'){
87
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );
88
+ ?>
89
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
90
+ <?php
91
+ $thumb_id_2 = get_post_thumbnail_id();
92
+ $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, $imagetype, true);
93
+ $thumb_url_2 = $thumb_url_array_2[0];
94
+
95
+ if ( has_post_thumbnail() ) { ?>
96
+ <amp-img src="<?php echo esc_url( $thumb_url_2 ); ?>" width="<?php echo $thumb_url_array_2[1]; ?>" height="<?php echo $thumb_url_array_2[2]; ?>" layout="responsive"></amp-img>
97
+ <?php } ?>
98
+ </a>
99
+ <?php
100
+ }
101
+ function ampforwp_get_relatedpost_content($argsdata=array()){
102
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );
103
+ ?>
104
+ <div class="related_link">
105
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
106
+
107
+ <?php
108
+ $show_excerpt = (isset($argsdata['show_excerpt'])? $argsdata['show_excerpt'] : true);
109
+ if($show_excerpt){
110
+ if(has_excerpt()){
111
+ $content = get_the_excerpt();
112
+ }else{
113
+ $content = get_the_content();
114
+ }
115
+ ?><p><?php
116
+ echo wp_trim_words( strip_shortcodes( $content ) , '15' );
117
+ ?></p><?php
118
+ }
119
+ $show_author = (isset($argsdata['show_author'])? $argsdata['show_author'] : true);
120
+ if($show_author){
121
+ $author_args = isset($argsdata['author_args'])? $argsdata['author_args'] : array();
122
+ ampforwp_framework_get_author_box($author_args);
123
+ }
124
+ ?>
125
+ </div>
126
+ <?php
127
  }
components/social-icons/social-icons.php CHANGED
@@ -1,12 +1,15 @@
1
  <?php
2
- function ampforwp_framework_get_social_icons($selected_social_icons){
 
3
 
4
  /* TODO:
5
  1: Connect with options panel
6
  2: Add icons for email, line and whatsapp
7
  */
8
  global $post, $redux_builder_amp;
9
- $twitter_url = '';
 
 
10
  $post_id = $post->ID;
11
  $desc = $post->post_excerpt;
12
  if (has_post_thumbnail( $post_id ) ){
@@ -24,85 +27,87 @@ function ampforwp_framework_get_social_icons($selected_social_icons){
24
  foreach ($selected_social_icons as $key => $value) {
25
  $social_icons_names[] = $key;
26
  }
27
- if($selected_social_icons['twitter'] == null){
 
28
  $selected_social_icons['twitter'] = 'https://twitter.com/intent/tweet?url='. $twitter_url.'&text='. $title .' ';
29
  //https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
30
- }
31
- if($selected_social_icons['facebook'] == null){
 
32
  $selected_social_icons['facebook'] = 'https://www.facebook.com/sharer.php?u='. $url. '';
33
  //or https://www.facebook.com/dialog/share?app_id={app_id}&display=page&href={url}&redirect_uri={redirect_url}
34
- }
35
- if($selected_social_icons['pinterest'] == null){
36
  $selected_social_icons['pinterest'] = 'https://pinterest.com/pin/create/bookmarklet/?media='.$image.' &url='. $url.'&description='. $title .'';
37
  //https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
38
- }
39
- if($selected_social_icons['google-plus'] == null){
40
  $selected_social_icons['google-plus'] = 'https://plus.google.com/share?url='. $url. '';
41
  //https://plus.google.com/share?url={url}
42
- }
43
- if($selected_social_icons['linkedin'] == null){
44
  $selected_social_icons['linkedin'] = 'https://www.linkedin.com/shareArticle?url='. $url. '&title='. $title .'';
45
  //https://www.linkedin.com/shareArticle?url={url}&title={title}
46
- }
47
 
48
- if($selected_social_icons['reddit'] == null){
49
  $selected_social_icons['reddit'] = 'https://reddit.com/submit?url='. $url. '&title='. $title .'';
50
  //https://reddit.com/submit?url={url}&title={title}
51
- }
52
- if($selected_social_icons['VKontakte'] == null){
53
  $selected_social_icons['VKontakte'] = 'http://vk.com/share.php?url='. $url. '';
54
  //http://vk.com/share.php?url={url}
55
- }
56
-
57
- if($selected_social_icons['tumblr'] == null){
58
  $selected_social_icons['tumblr'] = 'https://www.tumblr.com/widgets/share/tool?canonicalUrl='. $url. '&title='. $title .'&caption='.$desc.'';
59
  //https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
60
- }
61
 
62
  ?>
63
  <div class="amp-social">
64
  <ul>
65
- <?php if( in_array( 'twitter' , $selected_social_icons,true) || in_array('twitter', $social_icons_names,true) ) { ?>
66
  <a href="<?php echo $selected_social_icons['twitter'] ?>" target ="_blank"><li class="icon-twitter"></li></a>
67
  <?php } ?>
68
 
69
- <?php if( in_array('facebook', $selected_social_icons,true) || in_array('facebook', $social_icons_names,true)) { ?>
70
  <a href="<?php echo $selected_social_icons['facebook'] ?>" target ="_blank"><li class="icon-facebook"></li></a>
71
  <?php } ?>
72
 
73
- <?php if( in_array( 'pinterest' , $selected_social_icons,true ) || in_array( 'pinterest', $social_icons_names,true ) ) { ?>
74
  <a href="<?php echo $selected_social_icons['pinterest'] ?>" target ="_blank"><li class="icon-pinterest"></li></a>
75
  <?php } ?>
76
 
77
- <?php if( in_array( 'google-plus' , $selected_social_icons,true ) || in_array( 'google-plus' , $social_icons_names,true ) ) { ?>
78
  <a href="<?php echo $selected_social_icons['google-plus'] ?>" target ="_blank"><li class="icon-google-plus"></li></a>
79
  <?php } ?>
80
 
81
- <?php if( in_array( 'linkedin' , $selected_social_icons,true ) || in_array( 'linkedin' , $social_icons_names,true ) ) { ?>
82
  <a href="<?php echo $selected_social_icons['linkedin'] ?>" target ="_blank"><li class="icon-linkedin"></li></a>
83
  <?php } ?>
84
 
85
- <?php if( in_array( 'youtube' , $selected_social_icons,true ) || in_array( 'youtube' , $social_icons_names,true ) ) { ?>
86
  <a href="<?php echo $selected_social_icons['youtube'] ?>" target ="_blank"><li class="icon-youtube-play"></li></a>
87
  <?php } ?>
88
 
89
- <?php if( in_array( 'instagram' , $selected_social_icons,true ) || in_array( 'instagram' , $social_icons_names,true ) ) { ?>
90
  <a href="<?php echo $selected_social_icons['instagram'] ?>" target ="_blank"> <li class="icon-instagram"></li></a>
91
  <?php } ?>
92
 
93
- <?php if( in_array( 'reddit' , $selected_social_icons,true ) || in_array( 'reddit' , $social_icons_names,true ) ) { ?>
94
  <a href="<?php echo $selected_social_icons['reddit'] ?>" target ="_blank"><li class="icon-reddit-alien"></li></a>
95
  <?php } ?>
96
 
97
- <?php if( in_array( 'VKontakte' , $selected_social_icons,true ) || in_array( 'VKontakte' , $social_icons_names,true ) ) { ?>
98
  <a href="<?php echo $selected_social_icons['VKontakte'] ?>" target ="_blank"><li class="icon-vk"></li></a>
99
  <?php } ?>
100
 
101
- <?php if( in_array( 'snapchat' , $selected_social_icons,true ) || in_array( 'snapchat' , $social_icons_names,true ) ) { ?>
102
  <a href="<?php echo $selected_social_icons['snapchat'] ?>" target ="_blank"><li class="icon-snapchat-ghost"></li></a>
103
  <?php } ?>
104
 
105
- <?php if( in_array( 'tumblr' , $selected_social_icons,true ) || in_array( 'tumblr' , $social_icons_names,true ) ) { ?>
106
  <a href="<?php echo $selected_social_icons['tumblr'] ?>" target ="_blank"><li class="icon-tumblr"></li></a>
107
  <?php } ?>
108
  </ul>
@@ -110,8 +115,11 @@ function ampforwp_framework_get_social_icons($selected_social_icons){
110
  <?php
111
  }
112
  //Load styling for social icons
 
113
  add_action('amp_post_template_css','amp_social_styles',11);
114
- function amp_social_styles(){ ?>
 
 
115
 
116
  /* Social icons */
117
  @font-face {
1
  <?php
2
+
3
+ function ampforwp_framework_get_social_icons($selected_social_icons){
4
 
5
  /* TODO:
6
  1: Connect with options panel
7
  2: Add icons for email, line and whatsapp
8
  */
9
  global $post, $redux_builder_amp;
10
+ $twitter_url = '';
11
+ $thumb_id = '';
12
+ $image = '';
13
  $post_id = $post->ID;
14
  $desc = $post->post_excerpt;
15
  if (has_post_thumbnail( $post_id ) ){
27
  foreach ($selected_social_icons as $key => $value) {
28
  $social_icons_names[] = $key;
29
  }
30
+
31
+ if( empty($selected_social_icons['twitter'] ) && null == $selected_social_icons['twitter'] ){
32
  $selected_social_icons['twitter'] = 'https://twitter.com/intent/tweet?url='. $twitter_url.'&text='. $title .' ';
33
  //https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
34
+ }
35
+
36
+ if( empty($selected_social_icons['facebook'] ) && null == $selected_social_icons['facebook'] ){
37
  $selected_social_icons['facebook'] = 'https://www.facebook.com/sharer.php?u='. $url. '';
38
  //or https://www.facebook.com/dialog/share?app_id={app_id}&display=page&href={url}&redirect_uri={redirect_url}
39
+ }
40
+ if( empty($selected_social_icons['pinterest'] ) && null == $selected_social_icons['pinterest'] ){
41
  $selected_social_icons['pinterest'] = 'https://pinterest.com/pin/create/bookmarklet/?media='.$image.' &url='. $url.'&description='. $title .'';
42
  //https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
43
+ }
44
+ if( empty($selected_social_icons['google-plus']) && $selected_social_icons['google-plus'] == null){
45
  $selected_social_icons['google-plus'] = 'https://plus.google.com/share?url='. $url. '';
46
  //https://plus.google.com/share?url={url}
47
+ }
48
+ if( empty($selected_social_icons['linkedin']) && $selected_social_icons['linkedin'] == null){
49
  $selected_social_icons['linkedin'] = 'https://www.linkedin.com/shareArticle?url='. $url. '&title='. $title .'';
50
  //https://www.linkedin.com/shareArticle?url={url}&title={title}
51
+ }
52
 
53
+ if( empty($selected_social_icons['reddit']) && $selected_social_icons['reddit'] == null){
54
  $selected_social_icons['reddit'] = 'https://reddit.com/submit?url='. $url. '&title='. $title .'';
55
  //https://reddit.com/submit?url={url}&title={title}
56
+ }
57
+ if( empty($selected_social_icons['VKontakte']) && $selected_social_icons['VKontakte'] == null){
58
  $selected_social_icons['VKontakte'] = 'http://vk.com/share.php?url='. $url. '';
59
  //http://vk.com/share.php?url={url}
60
+ }
61
+
62
+ if( empty($selected_social_icons['tumblr']) && $selected_social_icons['tumblr'] == null){
63
  $selected_social_icons['tumblr'] = 'https://www.tumblr.com/widgets/share/tool?canonicalUrl='. $url. '&title='. $title .'&caption='.$desc.'';
64
  //https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
65
+ }
66
 
67
  ?>
68
  <div class="amp-social">
69
  <ul>
70
+ <?php if( ( in_array( 'twitter' , $selected_social_icons,true) || in_array('twitter', $social_icons_names,true) ) && !empty($selected_social_icons['twitter']) ) { ?>
71
  <a href="<?php echo $selected_social_icons['twitter'] ?>" target ="_blank"><li class="icon-twitter"></li></a>
72
  <?php } ?>
73
 
74
+ <?php if( (in_array('facebook', $selected_social_icons,true) || in_array('facebook', $social_icons_names,true)) && !empty($selected_social_icons['facebook']) ) { ?>
75
  <a href="<?php echo $selected_social_icons['facebook'] ?>" target ="_blank"><li class="icon-facebook"></li></a>
76
  <?php } ?>
77
 
78
+ <?php if( ( in_array( 'pinterest' , $selected_social_icons,true ) || in_array( 'pinterest', $social_icons_names,true )) && !empty($selected_social_icons['pinterest']) ) { ?>
79
  <a href="<?php echo $selected_social_icons['pinterest'] ?>" target ="_blank"><li class="icon-pinterest"></li></a>
80
  <?php } ?>
81
 
82
+ <?php if( (in_array( 'google-plus' , $selected_social_icons,true ) || in_array( 'google-plus' , $social_icons_names,true )) && !empty($selected_social_icons['google-plus']) ) { ?>
83
  <a href="<?php echo $selected_social_icons['google-plus'] ?>" target ="_blank"><li class="icon-google-plus"></li></a>
84
  <?php } ?>
85
 
86
+ <?php if( (in_array( 'linkedin' , $selected_social_icons,true ) || in_array( 'linkedin' , $social_icons_names,true )) && !empty($selected_social_icons['linkedin']) ) { ?>
87
  <a href="<?php echo $selected_social_icons['linkedin'] ?>" target ="_blank"><li class="icon-linkedin"></li></a>
88
  <?php } ?>
89
 
90
+ <?php if( (in_array( 'youtube' , $selected_social_icons,true ) || in_array( 'youtube' , $social_icons_names,true )) && !empty($selected_social_icons['youtube']) ) { ?>
91
  <a href="<?php echo $selected_social_icons['youtube'] ?>" target ="_blank"><li class="icon-youtube-play"></li></a>
92
  <?php } ?>
93
 
94
+ <?php if( (in_array( 'instagram' , $selected_social_icons,true ) || in_array( 'instagram' , $social_icons_names,true )) && !empty($selected_social_icons['instagram']) ) { ?>
95
  <a href="<?php echo $selected_social_icons['instagram'] ?>" target ="_blank"> <li class="icon-instagram"></li></a>
96
  <?php } ?>
97
 
98
+ <?php if( ( in_array( 'reddit' , $selected_social_icons,true ) || in_array( 'reddit' , $social_icons_names,true )) && !empty($selected_social_icons['reddit']) ) { ?>
99
  <a href="<?php echo $selected_social_icons['reddit'] ?>" target ="_blank"><li class="icon-reddit-alien"></li></a>
100
  <?php } ?>
101
 
102
+ <?php if( ( in_array( 'VKontakte' , $selected_social_icons,true ) || in_array( 'VKontakte' , $social_icons_names,true ) ) && !empty($selected_social_icons['VKontakte']) ) { ?>
103
  <a href="<?php echo $selected_social_icons['VKontakte'] ?>" target ="_blank"><li class="icon-vk"></li></a>
104
  <?php } ?>
105
 
106
+ <?php if( (in_array( 'snapchat' , $selected_social_icons,true ) || in_array( 'snapchat' , $social_icons_names,true ) ) && !empty($selected_social_icons['snapchat']) ) { ?>
107
  <a href="<?php echo $selected_social_icons['snapchat'] ?>" target ="_blank"><li class="icon-snapchat-ghost"></li></a>
108
  <?php } ?>
109
 
110
+ <?php if( (in_array( 'tumblr' , $selected_social_icons,true ) || in_array( 'tumblr' , $social_icons_names,true )) && !empty($selected_social_icons['tumblr']) ) { ?>
111
  <a href="<?php echo $selected_social_icons['tumblr'] ?>" target ="_blank"><li class="icon-tumblr"></li></a>
112
  <?php } ?>
113
  </ul>
115
  <?php
116
  }
117
  //Load styling for social icons
118
+
119
  add_action('amp_post_template_css','amp_social_styles',11);
120
+
121
+
122
+ function amp_social_styles(){?>
123
 
124
  /* Social icons */
125
  @font-face {
components/theme-loader.php CHANGED
@@ -22,11 +22,16 @@ if(!defined('AMPFORWP_CUSTOM_THEME')){
22
  function ampforwp_designing_custom_template( $file, $type, $post ) {
23
  global $redux_builder_amp;
24
  // Single file
25
- if ( is_single() || is_page() ) {
26
  if('single' === $type && !('product' === $post->post_type )) {
27
  $file = AMPFORWP_CUSTOM_THEME . '/single.php';
28
  }
29
  }
 
 
 
 
 
30
  // Loop Template
31
  if ( 'loop' === $type ) {
32
  $file = AMPFORWP_CUSTOM_THEME . '/loop.php';
22
  function ampforwp_designing_custom_template( $file, $type, $post ) {
23
  global $redux_builder_amp;
24
  // Single file
25
+ if ( is_single() ) {
26
  if('single' === $type && !('product' === $post->post_type )) {
27
  $file = AMPFORWP_CUSTOM_THEME . '/single.php';
28
  }
29
  }
30
+ if ( is_page() ) {
31
+ if('single' === $type && !('product' === $post->post_type )) {
32
+ $file = AMPFORWP_CUSTOM_THEME . '/page.php';
33
+ }
34
+ }
35
  // Loop Template
36
  if ( 'loop' === $type ) {
37
  $file = AMPFORWP_CUSTOM_THEME . '/loop.php';
includes/onesignal-integration/OneSignalSDKWorker.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=55)}([function(e,t,n){"use strict";function i(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function r(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&(n[i[r]]=e[i[r]]);return n}function o(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function s(e,t){return function(n,i){t(n,i,e)}}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){e.done?r(e.value):new n(function(t){t(e.value)}).then(s,a)}u((i=i.apply(e,t||[])).next())})}function c(e,t){function n(e){return function(t){return i([e,t])}}function i(n){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,o&&(s=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(s=s.call(o,n[1])).done)return s;switch(o=0,s&&(n=[0,s.value]),n[0]){case 0:case 1:s=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(s=u.trys,!(s=s.length>0&&s[s.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!s||n[1]>s[0]&&n[1]<s[3])){u.label=n[1];break}if(6===n[0]&&u.label<s[1]){u.label=s[1],s=n;break}if(s&&u.label<s[2]){u.label=s[2],u.ops.push(n);break}s[2]&&u.ops.pop(),u.trys.pop();continue}n=t.call(e,u)}catch(e){n=[6,e],o=0}finally{r=s=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var r,o,s,a,u={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a}function l(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function d(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-->0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function p(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}function g(e){return this instanceof g?(this.v=e,this):new g(e)}function h(e,t,n){function i(e){l[e]&&(c[e]=function(t){return new Promise(function(n,i){d.push([e,t,n,i])>1||r(e,t)})})}function r(e,t){try{o(l[e](t))}catch(e){u(d[0][3],e)}}function o(e){e.value instanceof g?Promise.resolve(e.value.v).then(s,a):u(d[0][2],e)}function s(e){r("next",e)}function a(e){r("throw",e)}function u(e,t){e(t),d.shift(),d.length&&r(d[0][0],d[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var c,l=n.apply(e,t||[]),d=[];return c={},i("next"),i("throw"),i("return"),c[Symbol.asyncIterator]=function(){return this},c}function v(e){function t(t,r){e[t]&&(n[t]=function(n){return(i=!i)?{value:g(e[t](n)),done:"return"===t}:r?r(n):n})}var n,i;return n={},t("next"),t("throw",function(e){throw e}),t("return"),n[Symbol.iterator]=function(){return this},n}function m(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):"function"==typeof d?d(e):e[Symbol.iterator]()}Object.defineProperty(t,"__esModule",{value:!0}),t.__extends=i,n.d(t,"__assign",function(){return S}),t.__rest=r,t.__decorate=o,t.__param=s,t.__metadata=a,t.__awaiter=u,t.__generator=c,t.__exportStar=l,t.__values=d,t.__read=f,t.__spread=p,t.__await=g,t.__asyncGenerator=h,t.__asyncDelegator=v,t.__asyncValues=m;var b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},S=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}},function(e,t,n){var i,r;!function(o,s){"use strict";i=s,void 0!==(r="function"==typeof i?i.call(t,n,t,e):i)&&(e.exports=r)}(0,function(){"use strict";function e(e){return typeof console!==a&&(void 0!==console[e]?t(console,e):void 0!==console.log?t(console,"log"):s)}function t(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function n(e,t,n){return function(){typeof console!==a&&(i.call(this,t,n),this[e].apply(this,arguments))}}function i(e,t){for(var n=0;n<u.length;n++){var i=u[n];this[i]=n<e?s:this.methodFactory(i,e,t)}}function r(t,i,r){return e(t)||n.apply(this,arguments)}function o(e,t,n){function o(e){var t=(u[e]||"silent").toUpperCase();try{return void(window.localStorage[d]=t)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+t+";"}catch(e){}}function s(){var e;try{e=window.localStorage[d]}catch(e){}if(typeof e===a)try{var t=window.document.cookie,n=t.indexOf(encodeURIComponent(d)+"=");n&&(e=/^([^;]+)/.exec(t.slice(n))[1])}catch(e){}return void 0===l.levels[e]&&(e=void 0),e}var c,l=this,d="loglevel";e&&(d+=":"+e),l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||r,l.getLevel=function(){return c},l.setLevel=function(t,n){if("string"==typeof t&&void 0!==l.levels[t.toUpperCase()]&&(t=l.levels[t.toUpperCase()]),!("number"==typeof t&&t>=0&&t<=l.levels.SILENT))throw"log.setLevel() called with invalid level: "+t;if(c=t,!1!==n&&o(t),i.call(l,t,e),typeof console===a&&t<l.levels.SILENT)return"No console available for logging"},l.setDefaultLevel=function(e){s()||l.setLevel(e,!1)},l.enableAll=function(e){l.setLevel(l.levels.TRACE,e)},l.disableAll=function(e){l.setLevel(l.levels.SILENT,e)};var f=s();null==f&&(f=null==t?"WARN":t),l.setLevel(f,!1)}var s=function(){},a="undefined",u=["trace","debug","info","warn","error"],c=new o,l={};c.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=l[e];return t||(t=l[e]=new o(e,c.getLevel(),c.methodFactory)),t};var d=typeof window!==a?window.log:void 0;return c.noConflict=function(){return typeof window!==a&&window.log===c&&(window.log=d),c},c})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(24),r=n(36),o=n(4),s=n(18),a=function(){function e(){}return e.getBuildEnv=function(){return i.BuildEnvironmentKind.Production},e.getWindowEnv=function(){return"undefined"==typeof window?"undefined"!=typeof self&&void 0!==self.registration?o.WindowEnvironmentKind.ServiceWorker:o.WindowEnvironmentKind.Unknown:window===window.top?-1!==location.href.indexOf("initOneSignal")||"/subscribe"===location.pathname&&""===location.search&&(location.hostname.endsWith(".onesignal.com")||location.hostname.endsWith(".os.tc")||-1!==location.hostname.indexOf(".localhost")&&e.getBuildEnv()===i.BuildEnvironmentKind.Development)?o.WindowEnvironmentKind.OneSignalSubscriptionPopup:o.WindowEnvironmentKind.Host:"/webPushIframe"===location.pathname?o.WindowEnvironmentKind.OneSignalProxyFrame:"/webPushModal"===location.pathname?o.WindowEnvironmentKind.OneSignalSubscriptionModal:o.WindowEnvironmentKind.CustomIframe},e.getTestEnv=function(){return r.TestEnvironmentKind.None},e.getBuildEnvPrefix=function(t){switch(void 0===t&&(t=e.getBuildEnv()),t){case i.BuildEnvironmentKind.Development:return"Dev-";case i.BuildEnvironmentKind.Staging:return"Staging-";case i.BuildEnvironmentKind.Production:return"";default:throw new s.InvalidArgumentError("buildEnv",s.InvalidArgumentReason.EnumOutOfRange)}},e.getOneSignalApiUrl=function(t){switch(void 0===t&&(t=e.getBuildEnv()),t){case i.BuildEnvironmentKind.Development:return new URL("https://localhost:3001/api/v1");case i.BuildEnvironmentKind.Staging:return new URL("https://onesignal-staging.pw/api/v1");case i.BuildEnvironmentKind.Production:return new URL("https://onesignal.com/api/v1");default:throw new s.InvalidArgumentError("buildEnv",s.InvalidArgumentReason.EnumOutOfRange)}},e}();t.default=a},function(e,t,n){"use strict";function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function r(e){return G.default.isBrowser()&&(Z||(Z=document.createElement("textarea"))),Z?(Z.innerHTML=e,Z.value):e}function o(){if(""===V.name&&""===V.version)var e=V._detect(navigator.userAgent);else var e=V;return e}function s(){if(void 0===window.Promise)return!1;var e=o(),t=navigator.userAgent||"";return!(!e.safari&&void 0===navigator.serviceWorker)&&(!(e.ios||e.ipod||e.iphone||e.ipad)&&(!e.msedge&&!e.msie&&(!(t.indexOf("FBAN")>-1||t.indexOf("FBAV")>-1)&&(!navigator.appVersion.match(/ wv/)&&(!(e.firefox&&Number(e.version)<48&&(e.mobile||e.tablet))&&(!!(e.firefox&&Number(e.version)>=44)||(!!(e.safari&&Number(e.version)>=7.1)||(!!(e.samsungBrowser&&Number(e.version)>=4)||(!!((e.chrome||e.chromium)&&Number(e.version)>=42)||(!!(e.yandexbrowser&&Number(e.version)>=15.12)||(!!(e.opera&&(e.mobile||e.tablet)&&Number(e.version)>=37||e.opera&&Number(e.version)>=42)||!!e.vivaldi)))))))))))}function a(){return V.chrome||V.chromium||V.opera||V.yandex}function u(e){var t=document.querySelectorAll(e);if(t.length>0)for(var n=0;n<t.length;n++)t[n].parentNode.removeChild(t[n])}function c(){return new Promise(function(e){OneSignal.initialized?e():OneSignal.once(OneSignal.EVENTS.SDK_INITIALIZED,e)})}function l(e){return JSON.stringify(e,function(e,t){return"function"==typeof t?"[Function]":t},4)}function d(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(e)return e.apply(null,t)}function f(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return K.debug("Called %c"+e+"("+t.map(l).join(", ")+")",w("code"),".")}function p(e){return!!e&&!!e.match(/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}function g(e,t,n){if("string"==typeof e)document.querySelector(e).insertAdjacentHTML(t,n);else{if("object"!=typeof e)throw new Error(e+" must be a CSS selector string or DOM Element object.");e.insertAdjacentHTML(t,n)}}function h(e){if("string"==typeof e)for(var t=document.querySelector(e);t.firstChild;)t.removeChild(t.firstChild);else{if("object"!=typeof e)throw new Error(e+" must be a CSS selector string or DOM Element object.");for(;e.firstChild;)e.removeChild(e.firstChild)}}function v(e,t){if("string"==typeof e)document.querySelector(e).classList.add(t);else{if("object"!=typeof e)throw new Error(e+" must be a CSS selector string or DOM Element object.");e.classList.add(t)}}function m(e,t){if("string"==typeof e)document.querySelector(e).classList.remove(t);else{if("object"!=typeof e)throw new Error(e+" must be a CSS selector string or DOM Element object.");e.classList.remove(t)}}function b(e,t){if("string"==typeof e)return document.querySelector(e).classList.contains(t);if("object"==typeof e)return e.classList.contains(t);throw new Error(e+" must be a CSS selector string or DOM Element object.")}function S(){return V.chrome||V.yandexbrowser||V.opera||V.vivaldi||V.samsungBrowser||V.chromium?Q.CHROME:V.firefox?Q.FIREFOX:V.safari?Q.SAFARI:(K.error("OneSignal: Unable to associate device type for browser "+V.name+" "+V.version),Q.UNKNOWN)}function w(e){return"code"==e?'padding: 0 1px 1px 5px;border: 1px solid #ddd;border-radius: 3px;font-family: Monaco,"DejaVu Sans Mono","Courier New",monospace;color: #444;':"bold"==e?"font-weight: 600;color: rgb(51, 51, 51);":"alert"==e?"font-weight: 600;color: red;":"event"==e?"color: green;":"postmessage"==e?"color: orange;":"serviceworkermessage"==e?"color: purple;":""}function _(e){return new Promise(function(t){setTimeout(t,e)})}function y(){return Promise.resolve()}function O(e,t){var n=new Promise(function(e,n){setTimeout(function(){n(new z.default)},t)});return Promise.race([e,n])}function E(e,t,n){return void 0===t&&(t=y()),void 0===n&&(n=y()),e?t:n}function P(e,t){return!!e&&-1!==e.indexOf(t)}function I(e){for(var t in e)e.hasOwnProperty(t)&&void 0===e[t]&&delete e[t];return e}function C(e){return/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)}function N(e){var t=window.location.href;t=t.toLowerCase(),e=e.replace(/[\[\]]/g,"\\$&").toLowerCase();var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),i=n.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}function T(){return K.warn("OneSignal: Wiping IndexedDB data."),Promise.all([X.default.remove("Ids"),X.default.remove("NotificationOpened"),X.default.remove("Options")])}function A(e){return e.charAt(0).toUpperCase()+e.slice(1)}function M(){return K.warn("OneSignal: Unsubscribing from push."),Y.default.getWindowEnv()!==J.WindowEnvironmentKind.ServiceWorker?self.registration.pushManager.getSubscription().then(function(e){if(e)return e.unsubscribe();throw new Error("Cannot unsubscribe because not subscribed.")}):q.default.isUsingSubscriptionWorkaround()?new Promise(function(e,t){K.debug("Unsubscribe from push got called, and we're going to remotely execute it in HTTPS iFrame."),OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,null,function(n){K.debug("Unsubscribe from push succesfully remotely executed."),n.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t("Failed to remotely unsubscribe from push.")})}):navigator.serviceWorker&&navigator.serviceWorker.controller?navigator.serviceWorker.ready.then(function(e){return e.pushManager}).then(function(e){return e.getSubscription()}).then(function(e){return e?e.unsubscribe():Promise.resolve()}):Promise.resolve()}function k(){return K.warn("OneSignal: Unregistering service worker."),Y.default.getWindowEnv()===J.WindowEnvironmentKind.OneSignalProxyFrame?Promise.resolve():navigator.serviceWorker&&navigator.serviceWorker.controller?navigator.serviceWorker.ready.then(function(e){return e.unregister()}):Promise.resolve()}function R(){return Promise.all([M(),k()])}function x(e){return new Promise(function(t){return setTimeout(t,e)})}function D(e,t){return e.substr(e.indexOf(t)+t.length)}function W(e,t,n,r){if(void 0===r&&(r=!1),t||K.error("Cannot call on() with no event: ",t),n||K.error("Cannot call on() with no task: ",n),"string"==typeof e){var o=document.querySelectorAll(e);if(o.length>0)for(var s=0;s<o.length;s++)W(o[s],t,n)}else if(i(e))for(var s=0;s<e.length;s++)W(e[s],t,n);else{if("object"!=typeof e)throw new Error(e+" must be a CSS selector string or DOM Element object.");var a=function(){return function(t){var i=function(){e.removeEventListener(t.type,a)};r||i(),n(t,i)}}();e.addEventListener(t,a)}}function U(){return window.__oneSignalSdkLoadCount||0}function L(e,t){return H.__awaiter(this,void 0,void 0,function(){return H.__generator(this,function(n){switch(n.label){case 0:return[4,new Promise(function(n){OneSignal.once(e,function(e){if(t){t(e)&&n(e)}else n(e)})})];case 1:return[2,n.sent()]}})})}function B(){window.__oneSignalSdkLoadCount=U()+1}function F(e){return e.replace(/\s/g,"").toLowerCase()}function j(e){for(var t="",n=Object.keys(e),i=0,r=n;i<r.length;i++){var o=r[i],s=e[o];t+=encodeURIComponent(o)+"="+encodeURIComponent(s)}return t}Object.defineProperty(t,"__esModule",{value:!0});var H=n(0),V=n(9),K=n(1),G=n(6),z=n(58),q=n(10),Y=n(2),J=n(4),X=n(11);t.isArray=i;var Z=null;t.decodeHtmlEntities=r,t.redetectBrowserUserAgent=o,t.isPushNotificationsSupported=s,t.isChromeLikeBrowser=a,t.removeDomElement=u,t.awaitOneSignalInitAndSupported=c,t.stringify=l,t.executeCallback=d,t.logMethodCall=f,t.isValidEmail=p,t.addDomElement=g,t.clearDomElementChildren=h,t.addCssClass=v,t.removeCssClass=m,t.hasCssClass=b;var Q={CHROME:5,SAFARI:7,FIREFOX:8,UNKNOWN:-99};t.getDeviceTypeForBrowser=S,t.getConsoleStyle=w,t.delay=_,t.nothing=y,t.timeoutPromise=O,t.when=E,t.contains=P,t.trimUndefined=I,t.isValidUuid=C,t.getUrlQueryParam=N,t.wipeIndexedDb=T,t.capitalize=A,t.unsubscribeFromPush=M,t.wipeServiceWorker=k,t.wipeServiceWorkerAndUnsubscribe=R,t.wait=x,t.substringAfter=D,t.once=W,t.getSdkLoadCount=U,t.awaitSdkEvent=L,t.incrementSdkLoadCount=B,t.prepareEmailForHashing=F,t.encodeHashAsUriComponent=j},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.ServiceWorker="ServiceWorker",e.Host="Host",e.OneSignalSubscriptionPopup="Popup",e.OneSignalSubscriptionModal="Modal",e.OneSignalProxyFrame="ProxyFrame",e.CustomIframe="CustomFrame",e.Unknown="Unknown"}(t.WindowEnvironmentKind||(t.WindowEnvironmentKind={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(6),o=n(2),s=n(4),a=n(3),u=["notifyButtonHovering","notifyButtonHover","notifyButtonButtonClick","notifyButtonLauncherClick","animatedElementHiding","animatedElementHidden","animatedElementShowing","animatedElementShown","activeAnimatedElementActivating","activeAnimatedElementActive","activeAnimatedElementInactivating","activeAnimatedElementInactive","dbRetrieved","dbSet","testEvent"],c=["onesignal.prompt.custom.clicked","onesignal.prompt.native.permissionchanged","onesignal.subscription.changed","onesignal.internal.subscriptionset","dbRebuilt","initialize","subscriptionSet","sendWelcomeNotification","subscriptionChange","notificationPermissionChange","dbSet","register","notificationDisplay","notificationDismiss","notificationClick","permissionPromptDisplay","testWouldDisplay","testInitOptionDisabled","popupWindowTimeout"],l={notificationPermissionChange:"onesignal.prompt.native.permissionchanged",subscriptionChange:"onesignal.subscription.changed",customPromptClick:"onesignal.prompt.custom.clicked"},d=function(){function e(){}return e.trigger=function(t,n,d){if(void 0===d&&(d=null),!a.contains(u,t)){var f=n;if(d)var p=a.capitalize(o.default.getWindowEnv().toString())+" ⬸ "+a.capitalize(d);else var p=a.capitalize(o.default.getWindowEnv().toString());f||!1===f?i.debug("("+p+") » %c"+t+":",a.getConsoleStyle("event"),f):i.debug("("+p+") » %c"+t,a.getConsoleStyle("event"))}if(r.default.isBrowser()){if(t===OneSignal.EVENTS.SDK_INITIALIZED){if(OneSignal.initialized)return;OneSignal.initialized=!0}OneSignal.emit(t,n)}if(l.hasOwnProperty(t)){var g=l[t];e._triggerLegacy(g,n)}if(r.default.isBrowser()&&(o.default.getWindowEnv()===s.WindowEnvironmentKind.OneSignalSubscriptionPopup||o.default.getWindowEnv()===s.WindowEnvironmentKind.OneSignalProxyFrame)){opener||parent?a.contains(c,t)&&(o.default.getWindowEnv()===s.WindowEnvironmentKind.OneSignalSubscriptionPopup?OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,{eventName:t,eventData:n}):OneSignal.proxyFrame.retriggerRemoteEvent(t,n)):i.error("Could not send event '"+t+"' back to host page because no creator (opener or parent) found!")}},e._triggerLegacy=function(e,t){var n=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:t});window.dispatchEvent(n)},e}();t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),r=n(4),o=function(){function e(){}return e.isBrowser=function(){return"undefined"!=typeof window},e.version=function(){return Number("140075")},Object.defineProperty(e,"TRADITIONAL_CHINESE_LANGUAGE_TAG",{get:function(){return["tw","hant"]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"SIMPLIFIED_CHINESE_LANGUAGE_TAG",{get:function(){return["cn","hans"]},enumerable:!0,configurable:!0}),e.getLanguage=function(){var t=navigator.language;if(t){t=t.toLowerCase();var n=t.split("-");if("zh"==n[0]){for(var i=0,r=e.TRADITIONAL_CHINESE_LANGUAGE_TAG;i<r.length;i++){var o=r[i];if(-1!==n.indexOf(o))return"zh-Hant"}for(var s=0,a=e.SIMPLIFIED_CHINESE_LANGUAGE_TAG;s<a.length;s++){var u=a[s];if(-1!==n.indexOf(u))return"zh-Hans"}return"zh-Hant"}return n[0].substring(0,2)}return"en"},e.supportsServiceWorkers=function(){switch(i.default.getWindowEnv()){case r.WindowEnvironmentKind.ServiceWorker:return!0;default:return"undefined"!=typeof navigator&&"serviceWorker"in navigator}},e.getSdkStylesVersionHash=function(){return"f6167d99955e6358ecf2599d34a8514f"},e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(56),o=function(e){function t(t){return e.call(this,t)||this}return i.__extends(t,e),t}(r);t.default=o},function(e,t,n){"use strict";function i(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}var r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,a=i(e),u=1;u<arguments.length;u++){n=Object(arguments[u]);for(var c in n)r.call(n,c)&&(a[c]=n[c]);if(Object.getOwnPropertySymbols){s=Object.getOwnPropertySymbols(n);for(var l=0;l<s.length;l++)o.call(n,s[l])&&(a[s[l]]=n[s[l]])}}return a}},function(e,t,n){!function(t,i,r){void 0!==e&&e.exports?e.exports=r():n(57)("bowser",r)}(0,0,function(){function e(e){function t(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}var n,i=t(/(ipod|iphone|ipad)/i).toLowerCase(),r=/like android/i.test(e),o=!r&&/android/i.test(e),a=/nexus\s*[0-6]\s*/i.test(e),u=!a&&/nexus\s*[0-9]+/i.test(e),c=/CrOS/.test(e),l=/silk/i.test(e),d=/sailfish/i.test(e),f=/tizen/i.test(e),p=/(web|hpw)os/i.test(e),g=/windows phone/i.test(e),h=(/SamsungBrowser/i.test(e),!g&&/windows/i.test(e)),v=!i&&!l&&/macintosh/i.test(e),m=!o&&!d&&!f&&!p&&/linux/i.test(e),b=t(/edge\/(\d+(\.\d+)?)/i),S=t(/version\/(\d+(\.\d+)?)/i),w=/tablet/i.test(e)&&!/tablet pc/i.test(e),_=!w&&/[^-]mobi/i.test(e),y=/xbox/i.test(e);/opera/i.test(e)?n={name:"Opera",opera:s,version:S||t(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(e)?n={name:"Opera",opera:s,version:t(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||S}:/SamsungBrowser/i.test(e)?n={name:"Samsung Internet for Android",samsungBrowser:s,version:S||t(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(e)?n={name:"Opera Coast",coast:s,version:S||t(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(e)?n={name:"Yandex Browser",yandexbrowser:s,version:S||t(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?n={name:"UC Browser",ucbrowser:s,version:t(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?n={name:"Maxthon",maxthon:s,version:t(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?n={name:"Epiphany",epiphany:s,version:t(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?n={name:"Puffin",puffin:s,version:t(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?n={name:"Sleipnir",sleipnir:s,version:t(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?n={name:"K-Meleon",kMeleon:s,version:t(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:g?(n={name:"Windows Phone",windowsphone:s},b?(n.msedge=s,n.version=b):(n.msie=s,n.version=t(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?n={name:"Internet Explorer",msie:s,version:t(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:c?n={name:"Chrome",chromeos:s,chromeBook:s,chrome:s,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(e)?n={name:"Microsoft Edge",msedge:s,version:b}:/vivaldi/i.test(e)?n={name:"Vivaldi",vivaldi:s,version:t(/vivaldi\/(\d+(\.\d+)?)/i)||S}:d?n={name:"Sailfish",sailfish:s,version:t(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?n={name:"SeaMonkey",seamonkey:s,version:t(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(n={name:"Firefox",firefox:s,version:t(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(n.firefoxos=s)):l?n={name:"Amazon Silk",silk:s,version:t(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?n={name:"PhantomJS",phantom:s,version:t(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?n={name:"SlimerJS",slimer:s,version:t(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?n={name:"BlackBerry",blackberry:s,version:S||t(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:p?(n={name:"WebOS",webos:s,version:S||t(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(n.touchpad=s)):/bada/i.test(e)?n={name:"Bada",bada:s,version:t(/dolfin\/(\d+(\.\d+)?)/i)}:f?n={name:"Tizen",tizen:s,version:t(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||S}:/qupzilla/i.test(e)?n={name:"QupZilla",qupzilla:s,version:t(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||S}:/chromium/i.test(e)?n={name:"Chromium",chromium:s,version:t(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||S}:/chrome|crios|crmo/i.test(e)?n={name:"Chrome",chrome:s,version:t(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:o?n={name:"Android",version:S}:/safari|applewebkit/i.test(e)?(n={name:"Safari",safari:s},S&&(n.version=S)):i?(n={name:"iphone"==i?"iPhone":"ipad"==i?"iPad":"iPod"},S&&(n.version=S)):n=/googlebot/i.test(e)?{name:"Googlebot",googlebot:s,version:t(/googlebot\/(\d+(\.\d+))/i)||S}:{name:t(/^(.*)\/(.*) /),version:function(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}(/^(.*)\/(.*) /)},!n.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(n.name=n.name||"Blink",n.blink=s):(n.name=n.name||"Webkit",n.webkit=s),!n.version&&S&&(n.version=S)):!n.opera&&/gecko\//i.test(e)&&(n.name=n.name||"Gecko",n.gecko=s,n.version=n.version||t(/gecko\/(\d+(\.\d+)?)/i)),n.windowsphone||n.msedge||!o&&!n.silk?n.windowsphone||n.msedge||!i?v?n.mac=s:y?n.xbox=s:h?n.windows=s:m&&(n.linux=s):(n[i]=s,n.ios=s):n.android=s;var O="";n.windows?O=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(t(/Windows ((NT|XP)( \d\d?.\d)?)/i)):n.windowsphone?O=t(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):n.mac?(O=t(/Mac OS X (\d+([_\.\s]\d+)*)/i),O=O.replace(/[_\s]/g,".")):i?(O=t(/os (\d+([_\s]\d+)*) like mac os x/i),O=O.replace(/[_\s]/g,".")):o?O=t(/android[ \/-](\d+(\.\d+)*)/i):n.webos?O=t(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):n.blackberry?O=t(/rim\stablet\sos\s(\d+(\.\d+)*)/i):n.bada?O=t(/bada\/(\d+(\.\d+)*)/i):n.tizen&&(O=t(/tizen[\/\s](\d+(\.\d+)*)/i)),O&&(n.osversion=O);var E=!n.windows&&O.split(".")[0];return w||u||"ipad"==i||o&&(3==E||E>=4&&!_)||n.silk?n.tablet=s:(_||"iphone"==i||"ipod"==i||o||a||n.blackberry||n.webos||n.bada)&&(n.mobile=s),n.msedge||n.msie&&n.version>=10||n.yandexbrowser&&n.version>=15||n.vivaldi&&n.version>=1||n.chrome&&n.version>=20||n.samsungBrowser&&n.version>=4||n.firefox&&n.version>=20||n.safari&&n.version>=6||n.opera&&n.version>=10||n.ios&&n.osversion&&n.osversion.split(".")[0]>=6||n.blackberry&&n.version>=10.1||n.chromium&&n.version>=20?n.a=s:n.msie&&n.version<10||n.chrome&&n.version<20||n.firefox&&n.version<20||n.safari&&n.version<6||n.opera&&n.version<10||n.ios&&n.osversion&&n.osversion.split(".")[0]<6||n.chromium&&n.version<20?n.c=s:n.x=s,n}function t(e){return e.split(".").length}function n(e,t){var n,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(n=0;n<e.length;n++)i.push(t(e[n]));return i}function i(e){for(var i=Math.max(t(e[0]),t(e[1])),r=n(e,function(e){var r=i-t(e);return e+=new Array(r+1).join(".0"),n(e.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});--i>=0;){if(r[0][i]>r[1][i])return 1;if(r[0][i]!==r[1][i])return-1;if(0===i)return 0}}function r(t,n,r){var o=a;"string"==typeof n&&(r=n,n=void 0),void 0===n&&(n=!1),r&&(o=e(r));var s=""+o.version;for(var u in t)if(t.hasOwnProperty(u)&&o[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return i([s,t[u]])<0}return n}function o(e,t,n){return!r(e,t,n)}var s=!0,a=e("undefined"!=typeof navigator?navigator.userAgent||"":"");return a.test=function(e){for(var t=0;t<e.length;++t){var n=e[t];if("string"==typeof n&&n in a)return!0}return!1},a.isUnsupportedBrowser=r,a.compareVersions=i,a.check=o,a._detect=e,a})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(1),s=n(14),a=n(14),u=n(2),c=n(4),l=n(15),d=n(16),f=n(20),p=function(){function e(){}return e.registerForPush=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n,r,p,g,h,v,m;return i.__generator(this,function(i){switch(i.label){case 0:return t=OneSignal.context,[4,OneSignal.isPushNotificationsEnabled()];case 1:if((n=i.sent())&&!t.sessionManager.isFirstPageView())return o.debug("Not registering for push because the user is subscribed and this is not the first page view."),[2,null];if("undefined"!=typeof OneSignal){if(OneSignal._isRegisteringForPush)return[2,null];OneSignal._isRegisteringForPush=!0}switch(r=u.default.getWindowEnv()){case c.WindowEnvironmentKind.Host:case c.WindowEnvironmentKind.OneSignalSubscriptionModal:return[3,2];case c.WindowEnvironmentKind.OneSignalSubscriptionPopup:return[3,6]}return[3,18];case 2:return i.trys.push([2,4,,5]),[4,t.subscriptionManager.subscribe()];case 3:return e=i.sent(),t.sessionManager.incrementPageViewCount(),l.default.triggerNotificationPermissionChanged(),l.default.checkAndTriggerSubscriptionChanged(),[3,5];case 4:return p=i.sent(),o.info(p),[3,5];case 5:return[3,19];case 6:return g=opener||parent,h=void 0,[4,t.permissionManager.updateStoredPermission()];case 7:i.sent(),i.label=8;case 8:return i.trys.push([8,11,,17]),[4,t.subscriptionManager.subscribePartially()];case 9:return h=i.sent(),[4,t.permissionManager.updateStoredPermission()];case 10:return i.sent(),[3,17];case 11:return v=i.sent(),[4,t.permissionManager.updateStoredPermission()];case 12:if(i.sent(),!(v instanceof s.default))return[3,16];switch(m=v.reason){case a.PushPermissionNotGrantedErrorReason.Blocked:return[3,13];case a.PushPermissionNotGrantedErrorReason.Dismissed:return[3,15]}return[3,16];case 13:return[4,t.permissionManager.updateStoredPermission()];case 14:return i.sent(),OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,{permission:f.NotificationPermission.Denied,forceUpdatePermission:!1}),[3,16];case 15:return OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,{permission:f.NotificationPermission.Default,forceUpdatePermission:!0}),[3,16];case 16:return g?(window.close(),[2,null]):[3,17];case 17:return OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.FINISH_REMOTE_REGISTRATION,{rawPushSubscription:h.serialize()},function(e){!0===e.data.progress?(o.debug("Got message from host page that remote reg. is in progress, closing popup."),g&&window.close()):o.debug("Got message from host page that remote reg. could not be finished.")}),[3,19];case 18:throw"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),new d.InvalidStateError(d.InvalidStateReason.UnsupportedEnvironment);case 19:return"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),[2,e]}})})},e.isUsingSubscriptionWorkaround=function(){if(!OneSignal.config)throw new Error("("+u.default.getWindowEnv().toString()+") isUsingSubscriptionWorkaround() cannot be called until OneSignal.config exists.");return!r.safari&&(!(e.isLocalhostAllowedAsSecureOrigin()&&"localhost"===location.hostname||"127.0.0.1"===location.hostname)&&(u.default.getWindowEnv()===c.WindowEnvironmentKind.Host&&(!!OneSignal.config.subdomain||"http:"===location.protocol)))},e.hasInsecureParentOrigin=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:if(window===window.top||!("serviceWorker"in navigator)||void 0===navigator.serviceWorker.getRegistration)return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.serviceWorker.getRegistration()];case 2:return t.sent(),[2,!1];case 3:return e=t.sent(),[2,!0];case 4:return[2]}})})},e.isInsecureOrigin=function(){return"http:"===window.location.protocol},e.isLocalhostAllowedAsSecureOrigin=function(){return OneSignal.config&&OneSignal.config.userConfig&&!0===OneSignal.config.userConfig.allowLocalhostAsSecureOrigin},e}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(10),s=n(38),a=n(2),u=n(25),c=n(64),l=n(65),d=n(26),f=n(36),p=n(12),g=n(4),h=n(39);!function(e){e[e.SET=0]="SET"}(i||(i={}));var v=function(){function e(e){this.databaseName=e,this.emitter=new s.default,this.database=new h.default(this.databaseName)}return e.applyDbResultFilter=function(e,t,n){switch(e){case"Options":return n&&t?n.value:n&&!t?n:null;case"Ids":return n&&t?n.id:n&&!t?n:null;case"NotificationOpened":return n&&t?{data:n.data,timestamp:n.timestamp}:n&&!t?n:null;default:return n||null}},e.prototype.get=function(t,n){return r.__awaiter(this,void 0,void 0,function(){var i=this;return r.__generator(this,function(s){switch(s.label){case 0:return[4,new Promise(function(s){return r.__awaiter(i,void 0,void 0,function(){var i,u;return r.__generator(this,function(r){switch(r.label){case 0:return a.default.getWindowEnv()!==g.WindowEnvironmentKind.ServiceWorker&&o.default.isUsingSubscriptionWorkaround()&&a.default.getTestEnv()===f.TestEnvironmentKind.None?(OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,[{table:t,key:n}],function(e){var t=e.data[0];s(t)}),[3,3]):[3,1];case 1:return[4,this.database.get(t,n)];case 2:i=r.sent(),u=e.applyDbResultFilter(t,n,i),s(u),r.label=3;case 3:return[2]}})})})];case 1:return[2,s.sent()]}})})},e.prototype.put=function(t,n){return r.__awaiter(this,void 0,void 0,function(){var i=this;return r.__generator(this,function(s){switch(s.label){case 0:return[4,new Promise(function(e,s){return r.__awaiter(i,void 0,void 0,function(){return r.__generator(this,function(i){switch(i.label){case 0:return a.default.getWindowEnv()!==g.WindowEnvironmentKind.ServiceWorker&&o.default.isUsingSubscriptionWorkaround()&&a.default.getTestEnv()===f.TestEnvironmentKind.None?(OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,[{table:t,keypath:n}],function(i){i.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():s("(Database) Attempted remote IndexedDB put("+t+", "+n+"), but did not get success response.")}),[3,3]):[3,1];case 1:return[4,this.database.put(t,n)];case 2:i.sent(),e(),i.label=3;case 3:return[2]}})})})];case 1:return s.sent(),this.emitter.emit(e.EVENTS.SET,n),[2]}})})},e.prototype.remove=function(e,t){return a.default.getWindowEnv()!==g.WindowEnvironmentKind.ServiceWorker&&o.default.isUsingSubscriptionWorkaround()&&a.default.getTestEnv()===f.TestEnvironmentKind.None?new Promise(function(n,i){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,[{table:e,keypath:t}],function(r){r.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?n():i("(Database) Attempted remote IndexedDB remove("+e+", "+t+"), but did not get success response.")})}):this.database.remove(e,t)},e.prototype.getAppConfig=function(){return r.__awaiter(this,void 0,void 0,function(){var t,n,i,o;return r.__generator(this,function(r){switch(r.label){case 0:return t=new u.AppConfig,[4,this.get("Ids","appId")];case 1:return n=r.sent(),t.appId=new p.Uuid(n),i=t,[4,this.get("Options","subdomain")];case 2:return i.subdomain=r.sent(),o=t,[4,e.get("Options","vapidPublicKey")];case 3:return o.vapidPublicKey=r.sent(),[2,t]}})})},e.prototype.setAppConfig=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){switch(t.label){case 0:return e.appId&&e.appId.value?[4,this.put("Ids",{type:"appId",id:e.appId.value})]:[3,2];case 1:t.sent(),t.label=2;case 2:return e.subdomain?[4,this.put("Options",{key:"subdomain",value:e.subdomain})]:[3,4];case 3:t.sent(),t.label=4;case 4:return e.httpUseOneSignalCom?[4,this.put("Options",{key:"httpUseOneSignalCom",value:!0})]:[3,6];case 5:return t.sent(),[3,8];case 6:return[4,this.put("Options",{key:"httpUseOneSignalCom",value:!1})];case 7:t.sent(),t.label=8;case 8:return e.vapidPublicKey?[4,this.put("Options",{key:"vapidPublicKey",value:e.vapidPublicKey})]:[3,10];case 9:t.sent(),t.label=10;case 10:return[2]}})})},e.prototype.getAppState=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n,i,o;return r.__generator(this,function(r){switch(r.label){case 0:return e=new c.AppState,t=e,[4,this.get("Options","defaultUrl")];case 1:return t.defaultNotificationUrl=r.sent(),n=e,[4,this.get("Options","defaultTitle")];case 2:return n.defaultNotificationTitle=r.sent(),i=e,[4,this.get("Options","isPushEnabled")];case 3:return i.lastKnownPushEnabled=r.sent(),o=e,[4,this.get("NotificationOpened")];case 4:return o.clickedNotifications=r.sent(),[2,e]}})})},e.prototype.setAppState=function(e){return r.__awaiter(this,void 0,void 0,function(){var t,n,i,o,s;return r.__generator(this,function(r){switch(r.label){case 0:return e.defaultNotificationUrl?[4,this.put("Options",{key:"defaultUrl",value:e.defaultNotificationUrl})]:[3,2];case 1:r.sent(),r.label=2;case 2:return e.defaultNotificationTitle||""===e.defaultNotificationTitle?[4,this.put("Options",{key:"defaultTitle",value:e.defaultNotificationTitle})]:[3,4];case 3:r.sent(),r.label=4;case 4:return null==e.lastKnownPushEnabled?[3,6]:[4,this.put("Options",{key:"isPushEnabled",value:e.lastKnownPushEnabled})];case 5:r.sent(),r.label=6;case 6:if(!e.clickedNotifications)return[3,12];t=Object.keys(e.clickedNotifications),n=0,i=t,r.label=7;case 7:return n<i.length?(o=i[n],s=e.clickedNotifications[o],s?[4,this.put("NotificationOpened",{url:o,data:s.data,timestamp:s.timestamp})]:[3,9]):[3,12];case 8:return r.sent(),[3,11];case 9:return null!==s?[3,11]:[4,this.remove("NotificationOpened",o)];case 10:r.sent(),r.label=11;case 11:return n++,[3,7];case 12:return[2]}})})},e.prototype.getServiceWorkerState=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n,i;return r.__generator(this,function(r){switch(r.label){case 0:return e=new l.ServiceWorkerState,t=e,[4,this.get("Ids","WORKER1_ONE_SIGNAL_SW_VERSION")];case 1:return t.workerVersion=r.sent(),n=e,[4,this.get("Ids","WORKER2_ONE_SIGNAL_SW_VERSION")];case 2:return n.updaterWorkerVersion=r.sent(),i=e,[4,this.get("Ids","backupNotification")];case 3:return i.backupNotification=r.sent(),[2,e]}})})},e.prototype.setServiceWorkerState=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){switch(t.label){case 0:return e.workerVersion?[4,this.put("Ids",{type:"WORKER1_ONE_SIGNAL_SW_VERSION",id:e.workerVersion})]:[3,2];case 1:t.sent(),t.label=2;case 2:return e.updaterWorkerVersion?[4,this.put("Ids",{type:"WORKER2_ONE_SIGNAL_SW_VERSION",id:e.updaterWorkerVersion})]:[3,4];case 3:t.sent(),t.label=4;case 4:return e.backupNotification?[4,this.put("Ids",{type:"backupNotification",id:e.backupNotification})]:[3,6];case 5:t.sent(),t.label=6;case 6:return[2]}})})},e.prototype.getSubscription=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n,i,o;return r.__generator(this,function(r){switch(r.label){case 0:return e=new d.Subscription,[4,this.get("Ids","userId")];case 1:return t=r.sent(),e.deviceId=new p.Uuid(t),n=e,[4,this.get("Ids","registrationId")];case 2:return n.subscriptionToken=r.sent(),[4,this.get("Options","optedOut")];case 3:return i=r.sent(),[4,this.get("Options","subscription")];case 4:return o=r.sent(),e.optedOut=null!=i?i:null!=o&&!o,[2,e]}})})},e.prototype.setSubscription=function(e){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){switch(t.label){case 0:return e.deviceId&&e.deviceId.value?[4,this.put("Ids",{type:"userId",id:e.deviceId.value})]:[3,2];case 1:t.sent(),t.label=2;case 2:return e.subscriptionToken?[4,this.put("Ids",{type:"registrationId",id:e.subscriptionToken})]:[3,4];case 3:t.sent(),t.label=4;case 4:return null==e.optedOut?[3,6]:[4,this.put("Options",{key:"optedOut",value:e.optedOut})];case 5:t.sent(),t.label=6;case 6:return[2]}})})},e.rebuild=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return e.ensureSingletonInstance(),[2,Promise.all([e.databaseInstance.remove("Ids"),e.databaseInstance.remove("NotificationOpened"),e.databaseInstance.remove("Options")])]})})},e.ensureSingletonInstance=function(){e.databaseInstanceName||(e.databaseInstanceName="ONE_SIGNAL_SDK_DB"),e.databaseInstance||(e.databaseInstance=new e(e.databaseInstanceName))},e.on=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return e.ensureSingletonInstance(),[2,e.databaseInstance.emitter.on.apply(e.databaseInstance.emitter,t)]})})},e.setSubscription=function(t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return e.ensureSingletonInstance(),[2,e.databaseInstance.setSubscription.call(e.databaseInstance,t)]})})},e.getSubscription=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return e.ensureSingletonInstance(),[2,e.databaseInstance.getSubscription.call(e.databaseInstance)]})})},e.setServiceWorkerState=function(t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return e.ensureSingletonInstance(),[2,e.databaseInstance.setServiceWorkerState.call(e.databaseInstance,t)]})})},e.getServiceWorkerState=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return e.ensureSingletonInstance(),[2,e.databaseInstance.getServiceWorkerState.call(e.databaseInstance)]})})},e.setAppState=function(t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return e.ensureSingletonInstance(),[2,e.databaseInstance.setAppState.call(e.databaseInstance,t)]})})},e.getAppState=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return e.ensureSingletonInstance(),[2,e.databaseInstance.getAppState.call(e.databaseInstance)]})})},e.setAppConfig=function(t){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(n){return e.ensureSingletonInstance(),[2,e.databaseInstance.setAppConfig.call(e.databaseInstance,t)]})})},e.getAppConfig=function(){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(t){return e.ensureSingletonInstance(),[2,e.databaseInstance.getAppConfig.call(e.databaseInstance)]})})},e.remove=function(t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(i){return e.ensureSingletonInstance(),[2,e.databaseInstance.remove.call(e.databaseInstance,t,n)]})})},e.put=function(t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(i){return e.ensureSingletonInstance(),[2,e.databaseInstance.put.call(e.databaseInstance,t,n)]})})},e.get=function(t,n){return r.__awaiter(this,void 0,void 0,function(){return r.__generator(this,function(i){return e.ensureSingletonInstance(),[2,e.databaseInstance.get.call(e.databaseInstance,t,n)]})})},e.EVENTS=i,e}();t.default=v},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(60),r=n(62),o=function(){function t(e){if(e){if(!i(e))throw new r.default(e);this.uuid=e}else this.uuid=null}return Object.defineProperty(t.prototype,"value",{get:function(){return this.uuid},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.uuid},t.generate=function(){var n="",i="undefined"==typeof window?e.crypto:window.crypto||window.msCrypto;return n=i?"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=i.getRandomValues(new Uint8Array(1))[0]%16|0;return("x"==e?t:3&t|8).toString(16)}):"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),new t(n)},t.prototype.serialize=function(){return this.value},t.deserialize=function(e){return new t(e)},t}();t.Uuid=o}).call(t,n(37))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(27),o=n(1),s=n(8),a=n(22),u=n(6),c=n(16),l=n(5),d=n(2),f=n(12),p=n(4),g=n(11),h=n(3),v=n(15),m=n(23),b=function(){function e(){}return e.fixWordpressManifestIfMisplaced=function(){var e=document.querySelectorAll("link[rel=manifest]");if(e&&!(e.length<=1))for(var t=0;t<e.length;t++){var n=e[t],i=n.href;h.contains(i,"gcm_sender_id")&&(document.querySelector("head").insertBefore(n,document.querySelector("head").children[0]),o.info("OneSignal: Moved the WordPress push <manifest> to the first element in <head>."))}},e.getNotificationTypeFromOptIn=function(e){return 1==e||null==e?1:-2},e.wasHttpsNativePromptDismissed=function(){return"dismissed"===r.get("onesignal-notification-prompt")},e.markHttpPopoverShown=function(){sessionStorage.setItem("ONESIGNAL_HTTP_PROMPT_SHOWN","true")},e.isHttpPromptAlreadyShown=function(){return"true"==sessionStorage.getItem("ONESIGNAL_HTTP_PROMPT_SHOWN")},e.checkAndTriggerNotificationPermissionChanged=function(){Promise.all([g.default.get("Options","notificationPermission"),OneSignal.getNotificationPermission()]).then(function(e){var t=e[0],n=e[1];t!==n&&v.default.triggerNotificationPermissionChanged().then(function(){return g.default.put("Options",{key:"notificationPermission",value:n})})})},e.showNotifyButton=function(){if(u.default.isBrowser()&&!OneSignal.notifyButton){OneSignal.config.userConfig.notifyButton=OneSignal.config.userConfig.notifyButton||{},OneSignal.config.userConfig.bell&&(s(OneSignal.config.userConfig.bell,OneSignal.config.userConfig.notifyButton),s(OneSignal.config.userConfig.notifyButton,OneSignal.config.userConfig.bell));var e=OneSignal.config.userConfig.notifyButton.displayPredicate;e&&"function"==typeof e?Promise.resolve(OneSignal.config.userConfig.notifyButton.displayPredicate()).then(function(e){!1!==e?(OneSignal.notifyButton=new a.default(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create()):o.debug("Notify button display predicate returned false so not showing the notify button.")}):(OneSignal.notifyButton=new a.default(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create())}},e.getNotificationIcons=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return[4,e.getAppId()];case 1:if(!(t=i.sent())||!t.value)throw new c.InvalidStateError(c.InvalidStateReason.MissingAppId);return n=d.default.getOneSignalApiUrl().toString()+"/apps/"+t.value+"/icon",[4,fetch(n)];case 2:return r=i.sent(),[4,r.json()];case 3:if(s=i.sent(),s.errors)throw o.error("API call %c"+n,h.getConsoleStyle("code"),"failed with:",s.errors),new Error("Failed to get notification icons.");return[2,s]}})})},e.establishServiceWorkerChannel=function(){var e=this,t=OneSignal.context.workerMessenger;t.off(),t.on(m.WorkerMessengerCommand.NotificationDisplayed,function(e){o.debug(location.origin,"Received notification display event from service worker."),l.default.trigger(OneSignal.EVENTS.NOTIFICATION_DISPLAYED,e)}),t.on(m.WorkerMessengerCommand.NotificationClicked,function(t){return i.__awaiter(e,void 0,void 0,function(){var e,n;return i.__generator(this,function(i){switch(i.label){case 0:return d.default.getWindowEnv()!==p.WindowEnvironmentKind.OneSignalProxyFrame?[3,2]:[4,new Promise(function(e){var t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,OneSignal.EVENTS.NOTIFICATION_CLICKED,function(t){var n=t.data;e(n)})})];case 1:return e=i.sent(),[3,3];case 2:e=OneSignal.getListeners(OneSignal.EVENTS.NOTIFICATION_CLICKED).length,i.label=3;case 3:return 0!==e?[3,5]:(o.debug("notification.clicked event received, but no event listeners; storing event in IndexedDb for later retrieval."),n=t.url,t.url||(n=location.href),[4,g.default.put("NotificationOpened",{url:n,data:t,timestamp:Date.now()})]);case 4:return i.sent(),[3,6];case 5:l.default.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,t),i.label=6;case 6:return[2]}})})}),t.on(m.WorkerMessengerCommand.RedirectPage,function(e){o.debug(d.default.getWindowEnv().toString()+" Picked up command.redirect to "+e+", forwarding to host page.");var t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,e)}),t.on(m.WorkerMessengerCommand.NotificationDismissed,function(e){l.default.trigger(OneSignal.EVENTS.NOTIFICATION_DISMISSED,e)})},e.getPromptOptionsQueryString=function(){var t=OneSignal.config.userConfig.promptOptions,n="";if(t)for(var i=e.getPromptOptionsPostHash(),r=0,o=Object.keys(i);r<o.length;r++){var s=o[r],a=i[s];n+="&"+s+"="+a}return n},e.getPromptOptionsPostHash=function(){var e=OneSignal.config.userConfig.promptOptions;if(e){for(var t={exampleNotificationTitleDesktop:"exampleNotificationTitle",exampleNotificationMessageDesktop:"exampleNotificationMessage",exampleNotificationTitleMobile:"exampleNotificationTitle",exampleNotificationMessageMobile:"exampleNotificationMessage"},n=0,i=Object.keys(t);n<i.length;n++){var r=i[n],o=t[r];e[r]&&(e[o]=e[r])}for(var s=["autoAcceptTitle","siteName","autoAcceptTitle","subscribeText","showGraphic","actionMessage","exampleNotificationTitle","exampleNotificationMessage","exampleNotificationCaption","acceptButtonText","cancelButtonText","timeout"],a={},u=0;u<s.length;u++){var c=s[u],l=e[c],d=encodeURIComponent(l);(l||!1===l||""===l)&&(a[c]=d)}}return a},e.triggerCustomPromptClicked=function(e){l.default.trigger(OneSignal.EVENTS.CUSTOM_PROMPT_CLICKED,{result:e})},e.getAppId=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:return OneSignal.config.appId?[2,Promise.resolve(OneSignal.config.appId)]:[3,1];case 1:return[4,g.default.get("Ids","appId")];case 2:return e=t.sent(),[2,new f.Uuid(e)]}})})},e}();t.default=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.Blocked=0]="Blocked",e[e.Dismissed=1]="Dismissed",e[e.Default=2]="Default"}(i=t.PushPermissionNotGrantedErrorReason||(t.PushPermissionNotGrantedErrorReason={}));var PushPermissionNotGrantedError=function(e){function PushPermissionNotGrantedError(t){var n=this;switch(t){case i.Dismissed:n=e.call(this,"The user dismissed the permission prompt.")||this;break;case i.Blocked:n=e.call(this,"Notification permissions are blocked.")||this;break;case i.Default:n=e.call(this,"Notification permissions have not been granted yet.")||this}return n.reason=t,n}return r.__extends(PushPermissionNotGrantedError,e),PushPermissionNotGrantedError}(o.default);t.default=PushPermissionNotGrantedError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(5),s=n(21),a=n(19),u=n(11),c=n(3),l=n(13),d=function(){function e(){}return e.onNotificationPermissionChange=function(){e.checkAndTriggerSubscriptionChanged()},e.onInternalSubscriptionSet=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){return s.default.put("subscription.optedOut",e),[2]})})},e.checkAndTriggerSubscriptionChanged=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n,o,s;return i.__generator(this,function(i){switch(i.label){case 0:return c.logMethodCall("checkAndTriggerSubscriptionChanged"),[4,OneSignal.isPushNotificationsEnabled()];case 1:return t=i.sent(),[4,u.default.getAppState()];case 2:return n=i.sent(),(o=n.lastKnownPushEnabled,s=null===o||t!==o)?(r.info("The user's subscription state changed from "+(null===o?"(not stored)":o)+" ⟶ "+t),n.lastKnownPushEnabled=t,[4,u.default.setAppState(n)]):[2];case 3:return i.sent(),e.triggerSubscriptionChanged(t),[2]}})})},e._onSubscriptionChanged=function(t){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(n){return e.onSubscriptionChanged_showWelcomeNotification(t),e.onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate(t),[2]})})},e.onSubscriptionChanged_showWelcomeNotification=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,s,d,f,p,g,h;return i.__generator(this,function(i){switch(i.label){case 0:return OneSignal.__doNotShowWelcomeNotification?(r.debug("Not showing welcome notification because user has previously subscribed."),[2]):!0!==e?[3,3]:[4,u.default.getSubscription()];case 1:return t=i.sent().deviceId,[4,l.default.getAppId()];case 2:n=i.sent(),s=OneSignal.config.userConfig.welcomeNotification,d=void 0!==s&&!0===s.disable,f=void 0!==s&&void 0!==s.title&&null!==s.title?s.title:"",p=void 0!==s&&void 0!==s.message&&null!==s.message&&s.message.length>0?s.message:"Thanks for subscribing!",g=new URL(location.href).origin+"?_osp=do_not_open",h=s&&s.url&&s.url.length>0?s.url:g,f=c.decodeHtmlEntities(f),p=c.decodeHtmlEntities(p),d||(r.debug("Sending welcome notification."),a.default.sendNotification(n,[t],{en:f},{en:p},h,null,{__isOneSignalWelcomeNotification:!0},void 0),o.default.trigger(OneSignal.EVENTS.WELCOME_NOTIFICATION_SENT,{title:f,message:p,url:h})),i.label=3;case 3:return[2]}})})},e.onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate=function(e){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return e=OneSignal.config.userConfig.notifyButton.displayPredicate,e&&"function"==typeof e&&OneSignal.notifyButton?[4,e()]:[3,2];case 1:t=n.sent(),!1!==t?(r.debug("Showing notify button because display predicate returned true."),OneSignal.notifyButton.launcher.show()):(r.debug("Hiding notify button because display predicate returned false."),OneSignal.notifyButton.launcher.hide()),n.label=2;case 2:return[2]}})})},e.triggerNotificationPermissionChanged=function(e){void 0===e&&(e=!1);var t,n;return Promise.all([OneSignal.getNotificationPermission(),u.default.get("Options","notificationPermission")]).then(function(i){var r=i[0],o=i[1];return t=r,n=r!==o||e,n?u.default.put("Options",{key:"notificationPermission",value:r}):null}).then(function(){n&&o.default.trigger(OneSignal.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,{to:t})})},e.triggerSubscriptionChanged=function(e){o.default.trigger(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,e)},e.fireStoredNotificationClicks=function(e){return void 0===e&&(e=document.URL),i.__awaiter(this,void 0,void 0,function(){function t(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return[4,u.default.getAppState()];case 1:return t=i.sent(),t.clickedNotifications[e.url]=null,[4,u.default.setAppState(t)];case 2:return i.sent(),(n=e.data,r=e.timestamp,r&&(s=(Date.now()-r)/1e3/60)>5)?[2]:(o.default.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,n),[2])}})})}var n,r,s,a,c,l,d,f;return i.__generator(this,function(i){switch(i.label){case 0:return[4,u.default.getAppState()];case 1:return n=i.sent(),[4,u.default.get("Options","notificationClickHandlerMatch")];case 2:if("origin"!==(r=i.sent()))return[3,7];s=0,a=Object.keys(n.clickedNotifications),i.label=3;case 3:return s<a.length?(c=a[s],new URL(c).origin!==location.origin?[3,5]:(l=n.clickedNotifications[c],[4,t(l)])):[3,6];case 4:i.sent(),i.label=5;case 5:return s++,[3,3];case 6:return[3,11];case 7:return d=n.clickedNotifications[e],d?[4,t(d)]:[3,9];case 8:return i.sent(),[3,11];case 9:return d||!e.endsWith("/")?[3,11]:(f=e.substring(0,e.length-1),d=n.clickedNotifications[f],d?[4,t(d)]:[3,11]);case 10:i.sent(),i.label=11;case 11:return[2]}})})},e}();t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7),s=n(41);!function(e){e[e.MissingAppId=0]="MissingAppId",e[e.RedundantPermissionMessage=1]="RedundantPermissionMessage",e[e.PushPermissionAlreadyGranted=2]="PushPermissionAlreadyGranted",e[e.UnsupportedEnvironment=3]="UnsupportedEnvironment",e[e.MissingDomElement=4]="MissingDomElement",e[e.ServiceWorkerNotActivated=5]="ServiceWorkerNotActivated"}(i=t.InvalidStateReason||(t.InvalidStateReason={}));var InvalidStateError=function(e){function InvalidStateError(t,n){var r=this;switch(t){case i.MissingAppId:r=e.call(this,"Missing required app ID.")||this;break;case i.RedundantPermissionMessage:var o="";n.permissionPromptType&&(o="("+s.PermissionPromptType[n.permissionPromptType]+")"),r=e.call(this,"Another permission message "+o+" is being displayed.")||this;break;case i.PushPermissionAlreadyGranted:r=e.call(this,"Push permission has already been granted.")||this;break;case i.UnsupportedEnvironment:r=e.call(this,"The current environment does not support this operation.")||this;break;case i.ServiceWorkerNotActivated:r=e.call(this,"The service worker must be activated first.")||this}return r.description=i[t],r.reason=t,r}return r.__extends(InvalidStateError,e),InvalidStateError}(o.default);t.InvalidStateError=InvalidStateError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(44),r=n(1),o=n(8),s=n(45),a=n(6),u=n(2),c=n(12),l=n(3),d=function(){function e(e,t,n){if(this.windowReference=e,this.sendToOrigin=t,this.receiveFromOrigin=n,!window||!window.postMessage)throw new Error("Must pass in a valid window reference supporting postMessage():"+e);if(!t||!n)throw new Error("Invalid origin. Must be set.");i.merge(this,new s),this.channel=new MessageChannel,this.messagePort=null,this.isListening=!1,this.isConnected=!1,this.replies={}}return Object.defineProperty(e,"HANDSHAKE_MESSAGE",{get:function(){return"onesignal.postmam.handshake"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"CONNECTED_MESSAGE",{get:function(){return"onesignal.postmam.connected"},enumerable:!0,configurable:!0}),e.prototype.listen=function(){if(r.debug("(Postmam) Called listen()."),this.isListening)return void r.debug("(Postmam) Already listening for Postmam connections.");a.default.isBrowser()&&(this.isListening=!0,r.debug("(Postmam) Listening for Postmam connections.",this),window.addEventListener("message",this.onWindowMessagePostmanConnectReceived.bind(this)))},e.prototype.startPostMessageReceive=function(){window.addEventListener("message",this.onWindowPostMessageReceived.bind(this))},e.prototype.stopPostMessageReceive=function(){window.removeEventListener("message",this.onWindowPostMessageReceived)},e.prototype.destroy=function(){this.stopPostMessageReceive(),this.removeEvent()},e.prototype.onWindowPostMessageReceived=function(t){if(this.isSafeOrigin(t.origin)){var n=t.data,i=n.id,s=n.command,a=n.data,u=n.source;if(s===e.CONNECTED_MESSAGE)return this.emit("connect"),void(this.isConnected=!0);var c={id:i,command:s,data:a,source:u},l=o({reply:this.reply.bind(this,c)},c);if(this.replies.hasOwnProperty(i)){r.info("(Postmam) This message is a reply.");!1===this.replies[i].bind(window)(l)&&delete this.replies[i]}else this.emit(s,l)}},e.prototype.onWindowMessagePostmanConnectReceived=function(t){if(r.debug("(Postmam) ("+u.default.getWindowEnv().toString()+") Window postmessage for Postman connect received:",t),this.isSafeOrigin(t.origin)){if(t.data.handshake!==e.HANDSHAKE_MESSAGE)return void r.info("(Postmam) Got a postmam message, but not our expected handshake:",t.data);r.info("(Postmam) Got our expected Postmam handshake message (and connecting...):",t.data),window.removeEventListener("message",this.onWindowMessagePostmanConnectReceived),this.messagePort=t.ports[0],this.messagePort.addEventListener("message",this.onMessageReceived.bind(this),!1),r.info("(Postmam) Removed previous message event listener for handshakes, replaced with main message listener."),this.messagePort.start(),this.isConnected=!0,r.info("(Postmam) ("+u.default.getWindowEnv().toString()+") Connected."),this.message(e.CONNECTED_MESSAGE),this.emit("connect")}},e.prototype.connect=function(){r.info("(Postmam) ("+u.default.getWindowEnv().toString()+") Establishing a connection to "+this.sendToOrigin+"."),this.messagePort=this.channel.port1,this.messagePort.addEventListener("message",this.onMessageReceived.bind(this),!1),this.messagePort.start(),this.windowReference.postMessage({handshake:e.HANDSHAKE_MESSAGE},this.sendToOrigin,[this.channel.port2])},e.prototype.onMessageReceived=function(t){if(!t.data)return void r.debug("("+u.default.getWindowEnv().toString()+") Received an empty Postmam message:",t);var n=t.data,i=n.id,s=n.command,a=n.data,c=n.source;if(s===e.CONNECTED_MESSAGE)return this.emit("connect"),void(this.isConnected=!0);var l={id:i,command:s,data:a,source:c},d=o({reply:this.reply.bind(this,l)},l);if(this.replies.hasOwnProperty(i)){!1===this.replies[i].bind(window)(d)&&delete this.replies[i]}else this.emit(s,d)},e.prototype.reply=function(e,t,n){var i={id:e.id,command:e.command,data:t,source:u.default.getWindowEnv().toString(),isReply:!0};"function"==typeof n&&(this.replies[i.id]=n),this.messagePort.postMessage(i)},e.prototype.postMessage=function(e,t,n){if(!e||""==e)throw new Error("(Postmam) Postmam command must not be empty.");if("function"==typeof t)return void r.debug("You passed a function to data, did you mean to pass null?");var i={id:c.Uuid.generate().toString(),command:e,data:t,source:u.default.getWindowEnv().toString()};"function"==typeof n&&(this.replies[i.id]=n),this.windowReference.postMessage(i,"*")},e.prototype.message=function(e,t,n){if(!e||""==e)throw new Error("(Postmam) Postmam command must not be empty.");if("function"==typeof t)return void r.debug("You passed a function to data, did you mean to pass null?");var i={id:c.Uuid.generate().toString(),command:e,data:t,source:u.default.getWindowEnv().toString()};"function"==typeof n&&(this.replies[i.id]=n),this.messagePort.postMessage(i)},e.prototype.generateSafeOrigins=function(e){var t=[];try{var n=new URL(e),i=n.host;0===n.host.indexOf("www.")&&(i=n.host.replace("www.","")),"https:"===n.protocol?(t.push("https://"+i),t.push("https://www."+i)):"http:"===n.protocol&&(t.push("http://"+i),t.push("http://www."+i),t.push("https://"+i),t.push("https://www."+i))}catch(e){}return t},e.prototype.isSafeOrigin=function(e){if(OneSignal.config)var t=OneSignal.config.subdomain;else var t="x";var n=this.generateSafeOrigins(this.receiveFromOrigin);return"https://onesignal.com"===e||e==="https://"+(t||"")+".onesignal.com"||e==="https://"+(t||"")+".os.tc"||e==="https://"+(t||"")+".os.tc:3001"||e===u.default.getOneSignalApiUrl().origin||"*"===this.receiveFromOrigin||l.contains(n,e)},e.prototype.on=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},e.prototype.once=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},e}();t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.Empty=0]="Empty",e[e.Malformed=1]="Malformed",e[e.EnumOutOfRange=2]="EnumOutOfRange"}(i=t.InvalidArgumentReason||(t.InvalidArgumentReason={}));var InvalidArgumentError=function(e){function InvalidArgumentError(t,n){var r=this;switch(n){case i.Empty:r=e.call(this,"Supply a non-empty value to '"+t+"'.")||this;break;case i.Malformed:r=e.call(this,"The value for '"+t+"' was malformed.")||this;break;case i.EnumOutOfRange:r=e.call(this,"The value for '"+t+"' was out of range of the expected input enum.")||this}return r.argument=t,r.reason=i[n],r}return r.__extends(InvalidArgumentError,e),InvalidArgumentError}(o.default);t.InvalidArgumentError=InvalidArgumentError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(59),o=n(1),s=n(8),a=n(6),u=n(2),c=n(25),l=n(12),d=n(3),f=n(63),p=n(4),g=function(){function e(){}return e.get=function(t,n,i){return e.call("GET",t,n,i)},e.post=function(t,n,i){return e.call("POST",t,n,i)},e.put=function(t,n,i){return e.call("PUT",t,n,i)},e.delete=function(t,n,i){return e.call("DELETE",t,n,i)},e.call=function(t,n,i,r){var o=new Headers;if(o.append("SDK-Version","onesignal/web/"+a.default.version()),o.append("Content-Type","application/json;charset=UTF-8"),r)for(var s=0,c=Object.keys(r);s<c.length;s++){var l=c[s];o.append(l,r[l])}var d={method:t||"NO_METHOD_SPECIFIED",headers:o,cache:"no-cache"};i&&(d.body=JSON.stringify(i));var f;return fetch(u.default.getOneSignalApiUrl().toString()+"/"+n,d).then(function(e){return f=e.status,e.json()}).then(function(t){return f>=200&&f<300?t:"no-user-id-error"!==e.identifyError(t)?Promise.reject(t):void 0})},e.identifyError=function(e){if(!e||!e.errors)return"no-error";var t=e.errors;return d.contains(t,"No user with this id found")||d.contains(t,"Could not find app_id for given player id.")?"no-user-id-error":"unknown-error"},e.getUserIdFromSubscriptionIdentifier=function(t,n,i){return e.post("players",{app_id:t,device_type:n,identifier:i}).then(function(e){return e&&e.id?e.id:null}).catch(function(e){return o.debug("Error getting user ID from subscription identifier:",e),null})},e.getPlayer=function(t,n){return e.get("players/"+n+"?app_id="+t)},e.updatePlayer=function(t,n,i){return e.put("players/"+n.value,s({app_id:t.value},i))},e.sendNotification=function(t,n,i,r,o,s,a,u){var c={app_id:t.value,contents:r,include_player_ids:n.map(function(e){return e.value}),isAnyWeb:!0,data:a,web_buttons:u};return i&&(c.headings=i),o&&(c.url=o),s&&(c.chrome_web_icon=s,c.firefox_icon=s),d.trimUndefined(c),e.post("notifications",c)},e.getAppConfig=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,o,s;return i.__generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,new Promise(function(n,i){u.default.getWindowEnv()!==p.WindowEnvironmentKind.ServiceWorker?r(u.default.getOneSignalApiUrl().toString()+"/sync/"+t.value+"/web",null,function(e,t){e?i(e):t.success?n(t):i(t)}):n(e.get("sync/"+t.value+"/web",null))})];case 1:return n=i.sent(),o=new c.AppConfig,o.appId=t,n.features&&(n.features.cookie_sync&&n.features.cookie_sync.enable&&(o.cookieSyncEnabled=!0),n.features.metrics&&n.features.metrics.enable&&(o.metrics.enable=!0,o.metrics.mixpanelReportingToken=n.features.metrics.mixpanel_reporting_token)),n.config&&(n.config.http_use_onesignal_com&&(o.httpUseOneSignalCom=!0),n.config.safari_web_id&&(o.safariWebId=n.config.safari_web_id),n.config.subdomain&&(o.subdomain=n.config.subdomain),n.config.vapid_public_key&&(o.vapidPublicKey=n.config.vapid_public_key),n.config.onesignal_vapid_public_key&&(o.onesignalVapidPublicKey=n.config.onesignal_vapid_public_key)),[2,o];case 2:throw s=i.sent();case 3:return[2]}})})},e.createUser=function(t){return i.__awaiter(this,void 0,void 0,function(){var n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,e.post("players",t.serialize())];case 1:return n=i.sent(),n&&n.success?[2,new l.Uuid(n.id)]:[2,null]}})})},e.updateUserSession=function(t,n){return i.__awaiter(this,void 0,void 0,function(){var r,o;return i.__generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e.post("players/"+t.value+"/on_session",n.serialize())];case 1:return r=i.sent(),r.id?[2,new l.Uuid(r.id)]:[2,t];case 2:throw o=i.sent(),o&&Array.isArray(o.errors)&&o.errors.length>0&&d.contains(o.errors[0],"app_id not found")?new f.OneSignalApiError(f.OneSignalApiErrorKind.MissingAppId):o;case 3:return[2]}})})},e}();t.default=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i;!function(e){e.Default="default",e.Granted="granted",e.Denied="denied"}(i||(i={})),t.NotificationPermission=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.put=function(t,n){return void 0===e.store[t]&&(e.store[t]=[null,null]),e.store[t].push(n),e.store[t].length==e.LIMIT+1&&e.store[t].shift(),e.store[t]},e.get=function(t){return void 0===e.store[t]&&(e.store[t]=[null,null]),e.store[t]},e.getFirst=function(t){return e.get(t)[0]},e.getLast=function(t){return e.get(t)[1]},e.remove=function(t){delete e.store[t]},e.isEmpty=function(t){var n=e.get(t);return null===n[0]&&null===n[1]},e.store={},e.LIMIT=2,e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(1),s=n(5),a=n(13),u=n(10),c=n(3),l=n(66),d=n(67),f=n(68),p=n(69),g=n(40),h=function(){function e(t){var n=void 0===t?{}:t,r=n.enable,o=void 0!==r&&r,s=n.size,u=void 0===s?"medium":s,l=n.position,d=void 0===l?"bottom-right":l,f=n.theme,p=void 0===f?"default":f,h=n.showLauncherAfter,v=void 0===h?10:h,m=n.showBadgeAfter,b=void 0===m?300:m,S=n.text,w=void 0===S?{"tip.state.unsubscribed":"Subscribe to notifications","tip.state.subscribed":"You're subscribed to notifications","tip.state.blocked":"You've blocked notifications","message.prenotify":"Click to subscribe to notifications","message.action.subscribing":"Click <strong>{{prompt.native.grant}}</strong> to receive notifications","message.action.subscribed":"Thanks for subscribing!","message.action.resubscribed":"You're subscribed to notifications","message.action.unsubscribed":"You won't receive notifications again","dialog.main.title":"Manage Site Notifications","dialog.main.button.subscribe":"SUBSCRIBE","dialog.main.button.unsubscribe":"UNSUBSCRIBE","dialog.blocked.title":"Unblock Notifications","dialog.blocked.message":"Follow these instructions to allow notifications:"}:S,_=n.prenotify,y=void 0===_||_,O=n.showCredit,E=void 0===O||O,P=n.colors,I=void 0===P?null:P,C=n.offset,N=void 0===C?null:C,T=n.launcher,A=void 0===T?null:T,M=this;if(this.options={enable:o,size:u,position:d,theme:p,showLauncherAfter:v,showBadgeAfter:b,text:w,prenotify:y,showCredit:E,colors:I,offset:N},this.options.enable){if(!c.contains(["small","medium","large"],this.options.size))throw new Error("Invalid size "+this.options.size+" for notify button. Choose among 'small', 'medium', or 'large'.");if(!c.contains(["bottom-left","bottom-right"],this.options.position))throw new Error("Invalid position "+this.options.position+" for notify button. Choose either 'bottom-left', or 'bottom-right'.");if(!c.contains(["default","inverse"],this.options.theme))throw new Error("Invalid theme "+this.options.theme+" for notify button. Choose either 'default', or 'inverse'.");if(this.options.showLauncherAfter<0)throw new Error("Invalid delay duration of "+this.options.showLauncherAfter+" for showing the notify button. Choose a value above 0.");if(this.options.showBadgeAfter<0)throw new Error("Invalid delay duration of "+this.options.showBadgeAfter+" for showing the notify button's badge. Choose a value above 0.");this.size=this.options.size,this.position=this.options.position,this.text=this.options.text,this.text["tip.state.unsubscribed"]||(this.text["tip.state.unsubscribed"]="Subscribe to notifications"),this.text["tip.state.subscribed"]||(this.text["tip.state.subscribed"]="You're subscribed to notifications"),this.text["tip.state.blocked"]||(this.text["tip.state.blocked"]="You've blocked notifications"),this.text["message.prenotify"]||(this.text["message.prenotify"]="Click to subscribe to notifications"),this.text["message.action.subscribed"]||(this.text["message.action.subscribed"]="Thanks for subscribing!"),this.text["message.action.resubscribed"]||(this.text["message.action.resubscribed"]="You're subscribed to notifications"),this.text["message.action.subscribing"]||(this.text["message.action.subscribing"]="Click <strong>{{prompt.native.grant}}</strong> to receive notifications"),this.text["message.action.unsubscribed"]||(this.text["message.action.unsubscribed"]="You won't receive notifications again"),this.text["dialog.main.title"]||(this.text["dialog.main.title"]="Manage Site Notifications"),this.text["dialog.main.button.subscribe"]||(this.text["dialog.main.button.subscribe"]="SUBSCRIBE"),this.text["dialog.main.button.unsubscribe"]||(this.text["dialog.main.button.unsubscribe"]="UNSUBSCRIBE"),this.text["dialog.blocked.title"]||(this.text["dialog.blocked.title"]="Unblock Notifications"),this.text["dialog.blocked.message"]||(this.text["dialog.blocked.message"]="Follow these instructions to allow notifications:"),this._launcher=A,this.substituteText(),this.state=e.STATES.UNINITIALIZED,this._ignoreSubscriptionState=!1,OneSignal.on(e.EVENTS.SUBSCRIBE_CLICK,function(){M.dialog.subscribeButton.disabled=!0,M._ignoreSubscriptionState=!0,OneSignal.setSubscription(!0).then(function(){return M.dialog.subscribeButton.disabled=!1,M.dialog.hide()}).then(function(){return M.message.display(g.default.TYPES.MESSAGE,M.text["message.action.resubscribed"],g.default.TIMEOUT)}).then(function(){return M._ignoreSubscriptionState=!1,M.launcher.clearIfWasInactive(),M.launcher.inactivate()}).then(function(){return M.updateState()})}),OneSignal.on(e.EVENTS.UNSUBSCRIBE_CLICK,function(){M.dialog.unsubscribeButton.disabled=!0,OneSignal.setSubscription(!1).then(function(){return M.dialog.unsubscribeButton.disabled=!1,M.dialog.hide()}).then(function(){return M.launcher.clearIfWasInactive(),M.launcher.activate()}).then(function(){return M.message.display(g.default.TYPES.MESSAGE,M.text["message.action.unsubscribed"],g.default.TIMEOUT)}).then(function(){return M.updateState()})}),OneSignal.on(e.EVENTS.HOVERING,function(){return M.hovering=!0,M.launcher.activateIfInactive(),M.message.shown||M.dialog.shown?void(M.hovering=!1):M.message.contentType===g.default.TYPES.MESSAGE?void(M.hovering=!1):void new Promise(function(e){if(M.message.queued.length>0)return M.message.dequeue().then(function(t){M.message.content=t,M.message.contentType=g.default.TYPES.QUEUED,e()});M.message.content=c.decodeHtmlEntities(M.message.getTipForState()),M.message.contentType=g.default.TYPES.TIP,e()}).then(function(){return M.message.show()}).then(function(){M.hovering=!1})}),OneSignal.on(e.EVENTS.HOVERED,function(){M.message.contentType!==g.default.TYPES.MESSAGE&&M.dialog.hidden&&(M.hovering&&(M.hovering=!1,M.message.waitUntilShown().then(function(){return c.delay(g.default.TIMEOUT)}).then(function(){return M.message.hide()}).then(function(){M.launcher.wasInactive&&M.dialog.hidden&&(M.launcher.inactivate(),M.launcher.wasInactive=null)})),M.message.shown&&M.message.hide().then(function(){M.launcher.wasInactive&&M.dialog.hidden&&(M.launcher.inactivate(),M.launcher.wasInactive=null)}))}),OneSignal.on(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,function(t){return i.__awaiter(M,void 0,void 0,function(){var n,r=this;return i.__generator(this,function(i){switch(i.label){case 0:return 1!=t?[3,2]:(this.badge.shown&&this.options.prenotify&&this.badge.hide(),null!==this.dialog.notificationIcons?[3,2]:[4,a.default.getNotificationIcons()]);case 1:n=i.sent(),this.dialog.notificationIcons=n,i.label=2;case 2:return OneSignal.getNotificationPermission(function(n){r.setState(t?e.STATES.SUBSCRIBED:"denied"===n?e.STATES.BLOCKED:e.STATES.UNSUBSCRIBED,r._ignoreSubscriptionState)}),[2]}})})}),OneSignal.on(e.EVENTS.STATE_CHANGED,function(t){M.launcher.element&&(t.to===e.STATES.SUBSCRIBED?M.launcher.inactivate():(t.to===e.STATES.UNSUBSCRIBED||e.STATES.BLOCKED)&&M.launcher.activate())}),OneSignal.on(OneSignal.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,function(){M.updateState()}),this.updateState()}}return Object.defineProperty(e,"EVENTS",{get:function(){return{STATE_CHANGED:"notifyButtonStateChange",LAUNCHER_CLICK:"notifyButtonLauncherClick",BELL_CLICK:"notifyButtonButtonClick",SUBSCRIBE_CLICK:"notifyButtonSubscribeClick",UNSUBSCRIBE_CLICK:"notifyButtonUnsubscribeClick",HOVERING:"notifyButtonHovering",HOVERED:"notifyButtonHover"}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"STATES",{get:function(){return{UNINITIALIZED:"uninitialized",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",BLOCKED:"blocked"}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"TEXT_SUBS",{get:function(){return{"prompt.native.grant":{default:"Allow",chrome:"Allow",firefox:"Always Receive Notifications",safari:"Allow"}}},enumerable:!0,configurable:!0}),e.prototype.substituteText=function(){for(var t in this.text)if(this.text.hasOwnProperty(t)){var n=this.text[t],i=r.name.toLowerCase();for(var o in e.TEXT_SUBS)if(e.TEXT_SUBS.hasOwnProperty(o)){var s=e.TEXT_SUBS[o],a=s[i];n&&c.contains(n,"{{")&&(this.text[t]=n.replace("{{"+o+"}}",void 0!==a?a:s.default))}}},e.prototype.showDialogProcedure=function(){var e=this;this.dialog.shown||this.dialog.show().then(function(){c.once(document,"click",function(t,n){e.dialog.element.contains(t.target)||(n(),e.dialog.shown&&e.dialog.hide().then(function(){e.launcher.inactivateIfWasInactive()}))},!0)})},e.prototype.create=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n,r,s,l=this;return i.__generator(this,function(i){switch(i.label){case 0:return this.options.enable?[4,OneSignal.context.dynamicResourceLoader.loadSdkStylesheet()]:[2];case 1:return 0!==(e=i.sent())?(o.debug("Not showing notify button because styles failed to load."),[2]):(this.container&&c.removeDomElement("#onesignal-bell-container"),c.addDomElement("body","beforeend",'<div id="onesignal-bell-container" class="onesignal-bell-container onesignal-reset"></div>'),c.addDomElement(this.container,"beforeend",'<div id="onesignal-bell-launcher" class="onesignal-bell-launcher"></div>'),c.addDomElement(this.launcher.selector,"beforeend",'<div class="onesignal-bell-launcher-button"></div>'),c.addDomElement(this.launcher.selector,"beforeend",'<div class="onesignal-bell-launcher-badge"></div>'),c.addDomElement(this.launcher.selector,"beforeend",'<div class="onesignal-bell-launcher-message"></div>'),c.addDomElement(this.message.selector,"beforeend",'<div class="onesignal-bell-launcher-message-body"></div>'),c.addDomElement(this.launcher.selector,"beforeend",'<div class="onesignal-bell-launcher-dialog"></div>'),c.addDomElement(this.dialog.selector,"beforeend",'<div class="onesignal-bell-launcher-dialog-body"></div>'),c.addDomElement(this.button.selector,"beforeEnd",'<svg class="onesignal-bell-svg" xmlns="http://www.w3.org/2000/svg" width="99.7" height="99.7" viewBox="0 0 99.7 99.7"><circle class="background" cx="49.9" cy="49.9" r="49.9"/><path class="foreground" d="M50.1 66.2H27.7s-2-.2-2-2.1c0-1.9 1.7-2 1.7-2s6.7-3.2 6.7-5.5S33 52.7 33 43.3s6-16.6 13.2-16.6c0 0 1-2.4 3.9-2.4 2.8 0 3.8 2.4 3.8 2.4 7.2 0 13.2 7.2 13.2 16.6s-1 11-1 13.3c0 2.3 6.7 5.5 6.7 5.5s1.7.1 1.7 2c0 1.8-2.1 2.1-2.1 2.1H50.1zm-7.2 2.3h14.5s-1 6.3-7.2 6.3-7.3-6.3-7.3-6.3z"/><ellipse class="stroke" cx="49.9" cy="49.9" rx="37.4" ry="36.9"/></svg>'),[4,OneSignal.isPushNotificationsEnabled()]);case 2:return t=i.sent(),[4,OneSignal.getSubscription()];case 3:return n=i.sent(),[4,a.default.wasHttpsNativePromptDismissed()];case 4:return r=i.sent(),s=t?"small":this.options.size,[4,this.launcher.resize(s)];case 5:if(i.sent(),"bottom-left"===this.options.position)c.addCssClass(this.container,"onesignal-bell-container-bottom-left"),c.addCssClass(this.launcher.selector,"onesignal-bell-launcher-bottom-left");else{if("bottom-right"!==this.options.position)throw new Error("Invalid OneSignal notify button position "+this.options.position);c.addCssClass(this.container,"onesignal-bell-container-bottom-right"),c.addCssClass(this.launcher.selector,"onesignal-bell-launcher-bottom-right")}if("default"===this.options.theme)c.addCssClass(this.launcher.selector,"onesignal-bell-launcher-theme-default");else{if("inverse"!==this.options.theme)throw new Error("Invalid OneSignal notify button theme "+this.options.theme);c.addCssClass(this.launcher.selector,"onesignal-bell-launcher-theme-inverse")}return this.applyOffsetIfSpecified(),this.setCustomColorsIfSpecified(),this.patchSafariSvgFilterBug(),o.info("Showing the notify button."),[4,(t?this.launcher.inactivate():c.nothing()).then(function(){return OneSignal.getSubscription()}).then(function(e){return!t&&e||null!==l.dialog.notificationIcons?c.nothing():a.default.getNotificationIcons().then(function(e){l.dialog.notificationIcons=e})}).then(function(){return c.delay(l.options.showLauncherAfter)}).then(function(){return u.default.isUsingSubscriptionWorkaround()&&n&&!0!==r&&!t&&!0===OneSignal.config.userConfig.autoRegister&&!a.default.isHttpPromptAlreadyShown()?(o.debug("Not showing notify button because popover will be shown."),c.nothing()):l.launcher.show()}).then(function(){return c.delay(l.options.showBadgeAfter)}).then(function(){return l.options.prenotify&&!t&&OneSignal._isNewVisitor?l.message.enqueue(l.text["message.prenotify"]).then(function(){return l.badge.show()}):c.nothing()}).then(function(){return l.initialized=!0})];case 6:return i.sent(),[2]}})})},e.prototype.patchSafariSvgFilterBug=function(){if(!(r.safari&&Number(r.version)>=9.1)){var e="drop-shadow(0 2px 4px rgba(34,36,38,0.35));",t="drop-shadow(0 2px 4px rgba(34,36,38,0));",n="drop-shadow(0px 2px 2px rgba(34,36,38,.15));";this.graphic.setAttribute("style","filter: "+e+"; -webkit-filter: "+e+";"),this.badge.element.setAttribute("style","filter: "+t+"; -webkit-filter: "+t+";"),this.dialog.element.setAttribute("style","filter: "+n+"; -webkit-filter: "+n+";")}r.safari&&this.badge.element.setAttribute("style","display: none;")},e.prototype.applyOffsetIfSpecified=function(){var e=this.options.offset;e&&(this.launcher.element.style.cssText="",e.bottom&&(this.launcher.element.style.cssText+="bottom: "+e.bottom+";"),"bottom-right"===this.options.position?e.right&&(this.launcher.element.style.cssText+="right: "+e.right+";"):"bottom-left"===this.options.position&&e.left&&(this.launcher.element.style.cssText+="left: "+e.left+";"))},e.prototype.setCustomColorsIfSpecified=function(){var e=this.dialog.element.querySelector("button.action"),t=this.button.element.querySelector(".pulse-ring");this.graphic.querySelector(".background").style.cssText="";for(var n=this.graphic.querySelectorAll(".foreground"),i=0;i<n.length;i++){var r=n[i];r.style.cssText=""}if(this.graphic.querySelector(".stroke").style.cssText="",this.badge.element.style.cssText="",e&&(e.style.cssText="",e.style.cssText=""),t&&(t.style.cssText=""),this.options.colors){var o=this.options.colors;if(o["circle.background"]&&(this.graphic.querySelector(".background").style.cssText+="fill: "+o["circle.background"]),o["circle.foreground"]){for(var s=this.graphic.querySelectorAll(".foreground"),i=0;i<s.length;i++){var r=s[i];r.style.cssText+="fill: "+o["circle.foreground"]}this.graphic.querySelector(".stroke").style.cssText+="stroke: "+o["circle.foreground"]}o["badge.background"]&&(this.badge.element.style.cssText+="background: "+o["badge.background"]),o["badge.bordercolor"]&&(this.badge.element.style.cssText+="border-color: "+o["badge.bordercolor"]),o["badge.foreground"]&&(this.badge.element.style.cssText+="color: "+o["badge.foreground"]),e&&(o["dialog.button.background"]&&(this.dialog.element.querySelector("button.action").style.cssText+="background: "+o["dialog.button.background"]),o["dialog.button.foreground"]&&(this.dialog.element.querySelector("button.action").style.cssText+="color: "+o["dialog.button.foreground"]),o["dialog.button.background.hovering"]&&this.addCssToHead("onesignal-background-hover-style","#onesignal-bell-container.onesignal-reset .onesignal-bell-launcher .onesignal-bell-launcher-dialog button.action:hover { background: "+o["dialog.button.background.hovering"]+" !important; }"),o["dialog.button.background.active"]&&this.addCssToHead("onesignal-background-active-style","#onesignal-bell-container.onesignal-reset .onesignal-bell-launcher .onesignal-bell-launcher-dialog button.action:active { background: "+o["dialog.button.background.active"]+" !important; }")),t&&o["pulse.color"]&&(this.button.element.querySelector(".pulse-ring").style.cssText="border-color: "+o["pulse.color"])}},e.prototype.addCssToHead=function(e,t){if(!document.getElementById(e)){var n=document.createElement("style");n.id=e,n.type="text/css",n.appendChild(document.createTextNode(t)),document.head.appendChild(n)}},e.prototype.updateState=function(){var t=this;Promise.all([OneSignal.isPushNotificationsEnabled(),OneSignal.getNotificationPermission()]).then(function(n){var i=n[0],r=n[1];t.setState(i?e.STATES.SUBSCRIBED:e.STATES.UNSUBSCRIBED),"denied"===r&&t.setState(e.STATES.BLOCKED)})},e.prototype.setState=function(t,n){void 0===n&&(n=!1);var i=this.state;this.state=t,i===t||n||s.default.trigger(e.EVENTS.STATE_CHANGED,{from:i,to:t})},Object.defineProperty(e.prototype,"container",{get:function(){return document.querySelector("#onesignal-bell-container")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"graphic",{get:function(){return this.button.element.querySelector("svg")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"launcher",{get:function(){return this._launcher||(this._launcher=new p.default(this)),this._launcher},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"button",{get:function(){return this._button||(this._button=new d.default(this)),this._button},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"badge",{get:function(){return this._badge||(this._badge=new l.default),this._badge},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"message",{get:function(){return this._message||(this._message=new g.default(this)),this._message},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialog",{get:function(){return this._dialog||(this._dialog=new f.default(this)),this._dialog},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subscribed",{get:function(){return this.state===e.STATES.SUBSCRIBED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"unsubscribed",{get:function(){return this.state===e.STATES.UNSUBSCRIBED},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blocked",{get:function(){return this.state===e.STATES.BLOCKED},enumerable:!0,configurable:!0}),e}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(18),o=n(2),s=n(30),a=n(4),u=n(1),c=n(6);!function(e){e.WorkerVersion="GetWorkerVersion",e.Subscribe="Subscribe",e.AmpSubscriptionState="amp-web-push-subscription-state",e.AmpSubscribe="amp-web-push-subscribe",e.AmpUnsubscribe="amp-web-push-unsubscribe",e.NotificationDisplayed="notification.displayed",e.NotificationClicked="notification.clicked",e.NotificationDismissed="notification.dismissed",e.RedirectPage="command.redirect"}(t.WorkerMessengerCommand||(t.WorkerMessengerCommand={}));var l=function(){function e(){this.replies={}}return e.prototype.addListener=function(e,t,n){var i={callback:t,onceListenerOnly:n};this.findListenersForMessage(e).length>0?this.replies[e.toString()].push(i):this.replies[e.toString()]=[i]},e.prototype.findListenersForMessage=function(e){return this.replies[e.toString()]||[]},e.prototype.deleteListenerRecords=function(e){this.replies[e.toString()]=null},e.prototype.deleteAllListenerRecords=function(){this.replies={}},e.prototype.deleteListenerRecord=function(e,t){for(var n=this.replies[e.toString()],i=n.length-1;i>=0;i--){n[i]===t&&n.splice(i,1)}},e}();t.WorkerMessengerReplyBuffer=l;var d=function(){function e(e){this.context=e,this.replies=new l,this.debug=!0}return e.prototype.broadcast=function(e,t){return i.__awaiter(this,void 0,void 0,function(){var n,r,s,c,l;return i.__generator(this,function(i){switch(i.label){case 0:return n=o.default.getWindowEnv(),n===a.WindowEnvironmentKind.ServiceWorker?[3,1]:[2];case 1:return[4,self.clients.matchAll({type:"window",includeUncontrolled:!0})];case 2:for(r=i.sent(),s=0,c=r;s<c.length;s++)l=c[s],u.debug("[Worker Messenger] [SW -> Page] Broadcasting '"+e.toString()+"' to window client "+l.url+"."),l.postMessage({command:e,payload:t});i.label=3;case 3:return[2]}})})},e.prototype.unicast=function(e,t,n){return i.__awaiter(this,void 0,void 0,function(){var s;return i.__generator(this,function(i){switch(i.label){case 0:if((s=o.default.getWindowEnv())!==a.WindowEnvironmentKind.ServiceWorker)return[3,1];if(!n)throw new r.InvalidArgumentError("windowClient",r.InvalidArgumentReason.Empty);return u.debug("[Worker Messenger] [SW -> Page] Unicasting '"+e.toString()+"' to window client "+n.url+"."),n.postMessage({command:e,payload:t}),[3,4];case 1:return[4,this.isWorkerControllingPage()];case 2:return i.sent()||u.debug("[Worker Messenger] The page is not controlled by the service worker yet. Waiting...",self.registration),[4,this.waitUntilWorkerControlsPage()];case 3:i.sent(),u.debug("[Worker Messenger] [Page -> SW] Unicasting '"+e.toString()+"' to service worker."),navigator.serviceWorker.controller.postMessage({command:e,payload:t}),i.label=4;case 4:return[2]}})})},e.prototype.listen=function(e){if(c.default.supportsServiceWorkers()){o.default.getWindowEnv()===a.WindowEnvironmentKind.ServiceWorker?(self.addEventListener("message",this.onWorkerMessageReceivedFromPage.bind(this)),u.debug("[Worker Messenger] Service worker is now listening for messages.")):this.listenForPage(e)}},e.prototype.listenForPage=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){switch(t.label){case 0:return e?[3,3]:[4,this.isWorkerControllingPage()];case 1:return t.sent()||u.debug("("+location.origin+") [Worker Messenger] The page is not controlled by the service worker yet. Waiting...",self.registration),[4,this.waitUntilWorkerControlsPage()];case 2:t.sent(),u.debug("("+location.origin+") [Worker Messenger] The page is now controlled by the service worker."),t.label=3;case 3:return navigator.serviceWorker.addEventListener("message",this.onPageMessageReceivedFromServiceWorker.bind(this)),u.debug("("+location.origin+") [Worker Messenger] Page is now listening for messages."),[2]}})})},e.prototype.onWorkerMessageReceivedFromPage=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s,a,c,l,c,d,f,c;return i.__generator(this,function(i){for(t=e.data,n=this.replies.findListenersForMessage(t.command),r=[],o=[],u.debug("[Worker Messenger] Service worker received message:",e.data),s=0,a=n;s<a.length;s++)c=a[s],c.onceListenerOnly&&r.push(c),o.push(c);for(l=r.length-1;l>=0;l--)c=r[l],this.replies.deleteListenerRecord(t.command,c);for(d=0,f=o;d<f.length;d++)c=f[d],c.callback.apply(null,[t.payload]);return[2]})})},e.prototype.onPageMessageReceivedFromServiceWorker=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s,a,c,l,c,d,f,c;return i.__generator(this,function(i){for(t=e.data,n=this.replies.findListenersForMessage(t.command),r=[],o=[],u.debug("[Worker Messenger] Page received message:",e.data),s=0,a=n;s<a.length;s++)c=a[s],c.onceListenerOnly&&r.push(c),o.push(c);for(l=r.length-1;l>=0;l--)c=r[l],this.replies.deleteListenerRecord(t.command,c);for(d=0,f=o;d<f.length;d++)c=f[d],c.callback.apply(null,[t.payload]);return[2]})})},e.prototype.on=function(e,t){this.replies.addListener(e,t,!1)},e.prototype.once=function(e,t){this.replies.addListener(e,t,!0)},e.prototype.off=function(e){e?this.replies.deleteListenerRecords(e):this.replies.deleteAllListenerRecords()},e.prototype.isWorkerControllingPage=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return e=o.default.getWindowEnv(),e!==a.WindowEnvironmentKind.ServiceWorker?[3,1]:[2,!!self.registration.active];case 1:return[4,this.context.serviceWorkerManager.getActiveState()];case 2:return t=n.sent(),[2,t===s.ServiceWorkerActiveState.WorkerA||t===s.ServiceWorkerActiveState.WorkerB]}})})},e.prototype.waitUntilWorkerControlsPage=function(){return i.__awaiter(this,void 0,void 0,function(){var e=this;return i.__generator(this,function(t){return[2,new Promise(function(t){return i.__awaiter(e,void 0,void 0,function(){var e,n=this;return i.__generator(this,function(r){switch(r.label){case 0:return[4,this.isWorkerControllingPage()];case 1:return r.sent()?t():(e=o.default.getWindowEnv(),e===a.WindowEnvironmentKind.ServiceWorker?self.addEventListener("activate",function(e){return i.__awaiter(n,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return[4,this.isWorkerControllingPage()];case 1:return e.sent()&&t(),[2]}})})}):navigator.serviceWorker.addEventListener("controllerchange",function(e){return i.__awaiter(n,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return[4,this.isWorkerControllingPage()];case 1:return e.sent()&&t(),[2]}})})})),[2]}})})})]})})},e}();t.WorkerMessenger=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.Development="Development",e.Staging="Staging",e.Production="Production"}(t.BuildEnvironmentKind||(t.BuildEnvironmentKind={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=function(){function e(){this.metrics={enable:!1,mixpanelReportingToken:""}}return e.prototype.serialize=function(){return{appId:this.appId.serialize(),subdomain:this.subdomain,httpUseOneSignalCom:this.httpUseOneSignalCom,cookieSyncEnabled:this.cookieSyncEnabled,safariWebId:this.safariWebId,vapidPublicKey:this.vapidPublicKey,userConfig:this.userConfig}},e.deserialize=function(t){var n=new e;return n.appId=i.Uuid.deserialize(t.appId),n.subdomain=t.subdomain,n.httpUseOneSignalCom=t.httpUseOneSignalCom,n.cookieSyncEnabled=t.cookieSyncEnabled,n.safariWebId=t.safariWebId,n.vapidPublicKey=t.vapidPublicKey,n.userConfig=t.userConfig,n},e}();t.AppConfig=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=function(){function e(){}return e.prototype.serialize=function(){return{deviceId:this.deviceId.serialize(),subscriptionToken:this.subscriptionToken,optedOut:this.optedOut}},e.deserialize=function(t){var n=new e;return n.deviceId=i.Uuid.deserialize(t.deviceId),n.subscriptionToken=t.subscriptionToken,n.optedOut=t.optedOut,n},e}();t.Subscription=r},function(e,t,n){var i,r;!function(o){var s=!1;if(i=o,void 0!==(r="function"==typeof i?i.call(t,n,t,e):i)&&(e.exports=r),s=!0,e.exports=o(),s=!0,!s){var a=window.Cookies,u=window.Cookies=o();u.noConflict=function(){return window.Cookies=a,u}}}(function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var i in n)t[i]=n[i]}return t}function t(n){function i(t,r,o){var s;if("undefined"!=typeof document){if(arguments.length>1){if(o=e({path:"/"},i.defaults,o),"number"==typeof o.expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*o.expires),o.expires=a}try{s=JSON.stringify(r),/^[\{\[]/.test(s)&&(r=s)}catch(e){}return r=n.write?n.write(r,t):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)),t=t.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),t=t.replace(/[\(\)]/g,escape),document.cookie=[t,"=",r,o.expires?"; expires="+o.expires.toUTCString():"",o.path?"; path="+o.path:"",o.domain?"; domain="+o.domain:"",o.secure?"; secure":""].join("")}t||(s={});for(var u=document.cookie?document.cookie.split("; "):[],c=/(%[0-9A-Z]{2})+/g,l=0;l<u.length;l++){var d=u[l].split("="),f=d.slice(1).join("=");'"'===f.charAt(0)&&(f=f.slice(1,-1));try{var p=d[0].replace(c,decodeURIComponent);if(f=n.read?n.read(f,p):n(f,p)||f.replace(c,decodeURIComponent),this.json)try{f=JSON.parse(f)}catch(e){}if(t===p){s=f;break}t||(s[p]=f)}catch(e){}}return s}}return i.set=i,i.get=function(e){return i.call(i,e)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(t,n){i(t,"",e(n,{expires:-1}))},i.withConverter=t,i}return t(function(){})})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(8),s=n(5),a=n(3),u=n(29),c=function(e){function t(t,n,i,r,o,s,a,u,c){void 0===s&&(s="shown"),void 0===a&&(a="active"),void 0===u&&(u=["opacity","transform"]);var l=e.call(this,t,n,i,s,u)||this;return l.selector=t,l.showClass=n,l.hideClass=i,l.activeClass=r,l.inactiveClass=o,l.state=s,l.activeState=a,l.targetTransitionEvents=u,l.nestedContentSelector=c,l}return i.__extends(t,e),t.prototype.activate=function(){var e=this;return this.inactive&&this.shown?new Promise(function(n){if(e.activeState="activating",s.default.trigger(t.EVENTS.ACTIVATING,e),e.inactiveClass&&a.removeCssClass(e.element,e.inactiveClass),e.activeClass&&a.addCssClass(e.element,e.activeClass),!e.shown)return r.debug("Ending activate() transition (alternative)."),e.activeState="active",s.default.trigger(t.EVENTS.ACTIVE,e),n(e);if(0==e.targetTransitionEvents.length)return n(e);var i=setTimeout(function(){r.debug("Element did not completely activate (state: "+e.state+", activeState: "+e.activeState+").")},e.transitionCheckTimeout);a.once(e.element,"transitionend",function(r,o){if(r.target===e.element&&a.contains(e.targetTransitionEvents,r.propertyName))return clearTimeout(i),o(),e.activeState="active",s.default.trigger(t.EVENTS.ACTIVE,e),n(e)},!0)}):Promise.resolve(this)},t.prototype.inactivate=function(){var e=this;return this.active?new Promise(function(n){if(e.activeState="inactivating",s.default.trigger(t.EVENTS.INACTIVATING,e),e.activeClass&&a.removeCssClass(e.element,e.activeClass),e.inactiveClass&&a.addCssClass(e.element,e.inactiveClass),!e.shown)return e.activeState="inactive",s.default.trigger(t.EVENTS.INACTIVE,e),n(e);if(0==e.targetTransitionEvents.length)return n(e);var i=setTimeout(function(){r.debug("Element did not completely inactivate (state: "+e.state+", activeState: "+e.activeState+").")},e.transitionCheckTimeout);a.once(e.element,"transitionend",function(r,o){if(r.target===e.element&&a.contains(e.targetTransitionEvents,r.propertyName))return clearTimeout(i),o(),e.activeState="inactive",s.default.trigger(t.EVENTS.INACTIVE,e),n(e)},!0)}):Promise.resolve(this)},t.prototype.waitUntilActive=function(){var e=this;return this.active?Promise.resolve(this):new Promise(function(n){OneSignal.once(t.EVENTS.ACTIVE,function(t){if(t===e)return n(e)},!0)})},t.prototype.waitUntilInactive=function(){var e=this;return this.inactive?Promise.resolve(this):new Promise(function(n){OneSignal.once(t.EVENTS.INACTIVE,function(t){if(t===e)return n(e)},!0)})},Object.defineProperty(t,"EVENTS",{get:function(){return o({},u.default.EVENTS,{ACTIVATING:"activeAnimatedElementActivating",ACTIVE:"activeAnimatedElementActive",INACTIVATING:"activeAnimatedElementInactivating",INACTIVE:"activeAnimatedElementInactive"})},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"activating",{get:function(){return"activating"===this.activeState},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return"active"===this.activeState},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inactivating",{get:function(){return"inactivating"===this.activeState},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inactive",{get:function(){return"inactive"===this.activeState},enumerable:!0,configurable:!0}),t}(u.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),r=n(1),o=n(5),s=function(){function e(e,t,n,i,r,o,s){void 0===i&&(i="shown"),void 0===r&&(r=["opacity","transform"]),void 0===s&&(s=500),this.selector=e,this.showClass=t,this.hideClass=n,this.state=i,this.targetTransitionEvents=r,this.nestedContentSelector=o,this.transitionCheckTimeout=s}return e.prototype.show=function(){var t=this;return this.hidden?new Promise(function(n){if(t.state="showing",o.default.trigger(e.EVENTS.SHOWING,t),t.hideClass&&i.removeCssClass(t.element,t.hideClass),t.showClass&&i.addCssClass(t.element,t.showClass),0==t.targetTransitionEvents.length)return n(t);var s=setTimeout(function(){r.debug("Element did not completely show (state: "+t.state+").")},t.transitionCheckTimeout);i.once(t.element,"transitionend",function(r,a){if(r.target===t.element&&i.contains(t.targetTransitionEvents,r.propertyName))return clearTimeout(s),a(),t.state="shown",o.default.trigger(e.EVENTS.SHOWN,t),n(t)},!0)}):Promise.resolve(this)},e.prototype.hide=function(){var t=this;return this.shown?new Promise(function(n){if(t.state="hiding",o.default.trigger(e.EVENTS.HIDING,t),t.showClass&&i.removeCssClass(t.element,t.showClass),t.hideClass&&i.addCssClass(t.element,t.hideClass),0==t.targetTransitionEvents.length)return n(t);i.once(t.element,"transitionend",function(s,a){var u=setTimeout(function(){r.debug("Element did not completely hide (state: "+t.state+").")},t.transitionCheckTimeout);if(s.target===t.element&&i.contains(t.targetTransitionEvents,s.propertyName))return clearTimeout(u),a(),t.state="hidden",o.default.trigger(e.EVENTS.HIDDEN,t),n(t)},!0)}):Promise.resolve(this)},e.prototype.waitUntilShown=function(){var t=this;return"shown"===this.state?Promise.resolve(this):new Promise(function(n){OneSignal.once(e.EVENTS.SHOWN,function(e){if(e===t)return n(t)},!0)})},e.prototype.waitUntilHidden=function(){var t=this;return"hidden"===this.state?Promise.resolve(this):new Promise(function(n){OneSignal.once(e.EVENTS.HIDDEN,function(e){if(e===t)return n(t)},!0)})},Object.defineProperty(e,"EVENTS",{get:function(){return{SHOWING:"animatedElementShowing",SHOWN:"animatedElementShown",HIDING:"animatedElementHiding",HIDDEN:"animatedElementHidden"}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this.nestedContentSelector?this.element.querySelector(this.nestedContentSelector).innerHTML:this.element.innerHTML},set:function(e){this.nestedContentSelector?this.element.querySelector(this.nestedContentSelector).innerHTML=e:this.element.innerHTML=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return document.querySelector(this.selector)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showing",{get:function(){return"showing"===this.state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shown",{get:function(){return"shown"===this.state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hiding",{get:function(){return"hiding"===this.state},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hidden",{get:function(){return"hidden"===this.state},enumerable:!0,configurable:!0}),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(1),s=n(6),a=n(16),u=n(23),c=n(42),l=n(26),d=n(3),f=n(10),p=n(13);!function(e){e.WorkerA="Worker A (Main)",e.WorkerB="Worker B (Updater)",e.ThirdParty="3rd Party",e.Installing="Installing",e.None="None",e.Bypassed="Bypassed",e.Indeterminate="Indeterminate"}(i=t.ServiceWorkerActiveState||(t.ServiceWorkerActiveState={}));var g=function(){function e(e,t){this.context=e,this.config=t}return e.prototype.getActiveState=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n;return r.__generator(this,function(r){switch(r.label){case 0:return"undefined"!=typeof OneSignal&&OneSignal.subscriptionHelper.isUsingSubscriptionWorkaround()?[2,i.Indeterminate]:[4,navigator.serviceWorker.getRegistration()];case 1:return(e=r.sent())?e.installing?[2,i.Installing]:e.active?(t=new URL(e.active.scriptURL).pathname,n=new c.default(t).getFileName()==this.config.workerAPath.getFileName()?i.WorkerA:new c.default(t).getFileName()==this.config.workerBPath.getFileName()?i.WorkerB:i.ThirdParty,navigator.serviceWorker.controller||n!==i.WorkerA&&n!==i.WorkerB?[2,n]:[2,i.Bypassed]):[2,i.ThirdParty]:[2,i.None]}})})},e.prototype.getWorkerVersion=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t=this;return r.__generator(this,function(n){switch(n.label){case 0:return[4,this.getActiveState()];case 1:return e=n.sent(),[2,new Promise(function(e){return r.__awaiter(t,void 0,void 0,function(){return r.__generator(this,function(t){return f.default.isUsingSubscriptionWorkaround()?e(NaN):(this.context.workerMessenger.once(u.WorkerMessengerCommand.WorkerVersion,function(t){e(t)}),this.context.workerMessenger.unicast(u.WorkerMessengerCommand.WorkerVersion)),[2]})})})]}})})},e.prototype.shouldInstallWorker=function(){return r.__awaiter(this,void 0,void 0,function(){var e;return r.__generator(this,function(t){switch(t.label){case 0:return[4,this.getActiveState()];case 1:return e=t.sent(),e!==i.WorkerA&&e!==i.WorkerB?[2,!0]:[2,!1]}})})},e.prototype.subscribeForPushNotifications=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t=this;return r.__generator(this,function(n){switch(n.label){case 0:return[4,this.getActiveState()];case 1:if((e=n.sent())!==i.WorkerA&&e!==i.WorkerB)throw new a.InvalidStateError(a.InvalidStateReason.ServiceWorkerNotActivated);return[2,new Promise(function(e){t.context.workerMessenger.once(u.WorkerMessengerCommand.Subscribe,function(t){e(l.Subscription.deserialize(t))}),t.context.workerMessenger.unicast(u.WorkerMessengerCommand.Subscribe,t.context.appConfig.serialize())})]}})})},e.prototype.updateWorker=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n;return r.__generator(this,function(r){switch(r.label){case 0:return s.default.supportsServiceWorkers()?[4,this.getActiveState()]:[2];case 1:e=r.sent(),o.info("[Service Worker Update] Checking service worker version..."),r.label=2;case 2:return r.trys.push([2,4,,5]),[4,d.timeoutPromise(this.getWorkerVersion(),2e3)];case 3:return t=r.sent(),[3,5];case 4:return n=r.sent(),o.info("[Service Worker Update] Worker did not reply to version query; assuming older version."),t=1,[3,5];case 5:return e!==i.WorkerA&&e!==i.WorkerB?(o.debug("[Service Worker Update] Not updating service worker, current active worker state is "+e+"."),[2]):(t!==s.default.version()?(o.info("[Service Worker Update] Updating service worker from v"+t+" --\x3e v"+s.default.version()+"."),this.installWorker()):o.info("[Service Worker Update] Service worker version is current at v"+t+" (no update required)."),[2])}})})},e.prototype.installWorker=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t=this;return r.__generator(this,function(n){switch(n.label){case 0:return s.default.supportsServiceWorkers()?[4,this.getActiveState()]:[2];case 1:return e=n.sent(),[4,this.installAlternatingWorker()];case 2:return n.sent(),[4,new Promise(function(n){return r.__awaiter(t,void 0,void 0,function(){var t,o=this;return r.__generator(this,function(s){switch(s.label){case 0:return[4,this.getActiveState()];case 1:return t=s.sent(),e!==t&&t!==i.Installing?n():navigator.serviceWorker.addEventListener("controllerchange",function(t){return r.__awaiter(o,void 0,void 0,function(){var t;return r.__generator(this,function(r){switch(r.label){case 0:return[4,this.getActiveState()];case 1:return t=r.sent(),t!==e&&t!==i.Installing&&n(),[2]}})})}),[2]}})})})];case 3:return n.sent(),[4,this.getActiveState()];case 4:return n.sent()!==i.WorkerB?[3,6]:[4,this.installAlternatingWorker()];case 5:n.sent(),n.label=6;case 6:return p.default.establishServiceWorkerChannel(),[2]}})})},e.prototype.installAlternatingWorker=function(){return r.__awaiter(this,void 0,void 0,function(){var e,t,n,s,u,c;return r.__generator(this,function(r){switch(r.label){case 0:return[4,this.getActiveState()];case 1:return e=r.sent(),e!==i.ThirdParty?[3,4]:[4,navigator.serviceWorker.getRegistration()];case 2:return t=r.sent(),[4,t.unregister()];case 3:r.sent(),r.label=4;case 4:if(e===i.WorkerA)n=this.config.workerBPath.getPathWithoutFileName(),s=this.config.workerBPath.getFileName();else if(e===i.WorkerB||e===i.ThirdParty||e===i.None)n=this.config.workerAPath.getPathWithoutFileName(),s=this.config.workerAPath.getFileName();else if(e===i.Bypassed)throw new a.InvalidStateError(a.InvalidStateReason.UnsupportedEnvironment);return c={appId:this.context.appConfig.appId.toString()},u=n+"/"+s+"?"+d.encodeHashAsUriComponent(c),o.info("[Service Worker Installation] Installing service worker "+u+"."),[4,navigator.serviceWorker.register(u,this.config.registrationOptions)];case 5:return r.sent(),o.debug("[Service Worker Installation] Service worker installed."),[2]}})})},e}();t.ServiceWorkerManager=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.InvalidAppId=0]="InvalidAppId",e[e.AppNotConfiguredForWebPush=1]="AppNotConfiguredForWebPush",e[e.MissingSubdomain=2]="MissingSubdomain",e[e.MultipleInitialization=3]="MultipleInitialization",e[e.MissingSafariWebId=4]="MissingSafariWebId",e[e.Unknown=5]="Unknown"}(i=t.SdkInitErrorKind||(t.SdkInitErrorKind={}));var SdkInitError=function(e){function SdkInitError(t){var n=this;switch(t){case i.InvalidAppId:n=e.call(this,"OneSignal: This app ID does match any existing app. Double check your app ID.")||this;break;case i.AppNotConfiguredForWebPush:n=e.call(this,"OneSignal: This app ID does not have any web platforms enabled. Double check your app ID, or see step 1 on our setup guide (https://goo.gl/01h7fZ).")||this;break;case i.MissingSubdomain:n=e.call(this,"OneSignal: Non-HTTPS pages require a subdomain of OneSignal to be chosen on your dashboard. See step 1.4 on our setup guide (https://goo.gl/xip6JB).")||this;break;case i.MultipleInitialization:n=e.call(this,"OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.")||this;break;case i.MissingSafariWebId:n=e.call(this,"OneSignal: Safari browser support on Mac OS X requires the Safari web platform to be enabled. Please see the Safari Support steps in our web setup guide.")||this;break;case i.Unknown:n=e.call(this,"OneSignal: An unknown initialization error occurred.")||this}return n.reason=i[t],n}return r.__extends(SdkInitError,e),SdkInitError}(o.default);t.SdkInitError=SdkInitError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(1),s=n(8),a=n(46),u=n(16),c=n(47),l=n(5),d=n(21),f=n(20),p=n(2),g=n(4),h=n(73),v=n(11),m=n(3),b=n(15),S=n(13),w=n(10),_=n(31),y=n(19),O=n(12),E=n(49),P=n(33),I=n(14),C=function(){function e(){}return e.storeInitialValues=function(){return Promise.all([OneSignal.isPushNotificationsEnabled(),OneSignal.getNotificationPermission(),OneSignal.isOptedOut()]).then(function(e){var t=e[0],n=e[1],i=e[2];return d.default.put("subscription.optedOut",i),Promise.all([v.default.put("Options",{key:"isPushEnabled",value:t}),v.default.put("Options",{key:"notificationPermission",value:n})])})},e.onSdkInitialized=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n,s,a,u;return i.__generator(this,function(i){switch(i.label){case 0:return e.storeInitialValues(),e.installNativePromptPermissionChangedHook(),t=OneSignal.context,[4,OneSignal.getNotificationPermission()];case 1:return i.sent()===f.NotificationPermission.Granted&&(OneSignal.__doNotShowWelcomeNotification=!0),n=navigator.serviceWorker&&"https:"===window.location.protocol,n?[4,w.default.hasInsecureParentOrigin()]:[3,3];case 2:n=!i.sent(),i.label=3;case 3:return n&&navigator.serviceWorker.getRegistration().then(function(e){e&&e.active&&S.default.establishServiceWorkerChannel()}).catch(function(e){9===e.code?"http:"!==location.protocol&&p.default.getWindowEnv()!==g.WindowEnvironmentKind.OneSignalProxyFrame||o.debug("Expected error getting service worker registration on "+location.href+":",e):o.error("Error getting Service Worker registration on "+location.href+":",e)}),(S.default.showNotifyButton(),r.safari&&!1===OneSignal.config.userConfig.autoRegister&&OneSignal.isPushNotificationsEnabled(function(t){t&&e.sessionInit({__sdkCall:!0})}),w.default.isUsingSubscriptionWorkaround()&&t.sessionManager.isFirstPageView())?(o.debug("("+p.default.getWindowEnv().toString()+") Updating session info for HTTP site."),[4,OneSignal.isPushNotificationsEnabled()]):[3,6];case 4:return(s=i.sent())?(a=OneSignal.context,[4,v.default.getSubscription()]):[3,6];case 5:u=i.sent().deviceId,y.default.updateUserSession(u,new P.PushRegistration),i.label=6;case 6:return OneSignal.context.cookieSyncer.install(),[2]}})})},e.installNativePromptPermissionChangedHook=function(){!navigator.permissions||r.firefox&&Number(r.version)<=45||(OneSignal._usingNativePermissionHook=!0,navigator.permissions.query({name:"notifications"}).then(function(e){e.onchange=function(){b.default.triggerNotificationPermissionChanged()}}))},e.saveInitOptions=function(){var e=[];!1===OneSignal.config.userConfig.persistNotification?e.push(v.default.put("Options",{key:"persistNotification",value:!1})):!0===OneSignal.config.userConfig.persistNotification?e.push(v.default.put("Options",{key:"persistNotification",value:"force"})):e.push(v.default.put("Options",{key:"persistNotification",value:!0}));var t=OneSignal.config.userConfig.webhooks;return["notification.displayed","notification.clicked","notification.dismissed"].forEach(function(n){t&&t[n]?e.push(v.default.put("Options",{key:"webhooks."+n,value:t[n]})):e.push(v.default.put("Options",{key:"webhooks."+n,value:!1}))}),t&&t.cors?e.push(v.default.put("Options",{key:"webhooks.cors",value:!0})):e.push(v.default.put("Options",{key:"webhooks.cors",value:!1})),OneSignal.config.userConfig.notificationClickHandlerMatch?e.push(v.default.put("Options",{key:"notificationClickHandlerMatch",value:OneSignal.config.userConfig.notificationClickHandlerMatch})):e.push(v.default.put("Options",{key:"notificationClickHandlerMatch",value:"exact"})),OneSignal.config.userConfig.notificationClickHandlerAction?e.push(v.default.put("Options",{key:"notificationClickHandlerAction",value:OneSignal.config.userConfig.notificationClickHandlerAction})):e.push(v.default.put("Options",{key:"notificationClickHandlerAction",value:"navigate"})),Promise.all(e)},e.internalInit=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("Called %cinternalInit()",m.getConsoleStyle("code")),(t=OneSignal.context,t.serviceWorkerManager.updateWorker(),t.sessionManager.incrementPageViewCount(),!sessionStorage.getItem("ONE_SIGNAL_SESSION")||w.default.isUsingSubscriptionWorkaround()||"denied"!=window.Notification.permission&&sessionStorage.getItem("ONE_SIGNAL_NOTIFICATION_PERMISSION")!=window.Notification.permission)?(sessionStorage.setItem("ONE_SIGNAL_NOTIFICATION_PERMISSION",window.Notification.permission),r.safari&&!1===OneSignal.config.userConfig.autoRegister?(o.debug("On Safari and autoregister is false, skipping sessionInit()."),w.default.isUsingSubscriptionWorkaround()||l.default.trigger(OneSignal.EVENTS.SDK_INITIALIZED),[2]):!1!==OneSignal.config.userConfig.autoRegister||OneSignal.config.subdomain?[3,2]:(o.debug("Skipping internal init. Not auto-registering and no subdomain."),l.default.trigger(OneSignal.EVENTS.SDK_INITIALIZED),[4,OneSignal.isPushNotificationsEnabled()])):(l.default.trigger(OneSignal.EVENTS.SDK_INITIALIZED),[2]);case 1:return n=i.sent(),n&&!w.default.isUsingSubscriptionWorkaround()&&(o.info("Because the user is already subscribed and has enabled notifications, we will re-register their GCM token."),w.default.registerForPush()),[2];case 2:return"visible"!==document.visibilityState?(m.once(document,"visibilitychange",function(t,n){"visible"===document.visibilityState&&(n(),e.sessionInit({__sdkCall:!0}))},!0),[2]):(e.sessionInit({__sdkCall:!0}),[2])}})})},e.initSaveState=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,S.default.getAppId()];case 1:return t=i.sent(),[4,v.default.put("Ids",{type:"appId",id:t.value})];case 2:return i.sent(),n=e||document.title||"Notification",[4,v.default.put("Options",{key:"pageTitle",value:n})];case 3:return i.sent(),o.info("OneSignal: Set pageTitle to be '"+n+"'."),[2]}})})},e.sessionInit=function(e){var t=OneSignal.context.appConfig;if(o.debug("Called %csessionInit("+JSON.stringify(e)+")",m.getConsoleStyle("code")),OneSignal._sessionInitAlreadyRunning)return void o.debug("Returning from sessionInit because it has already been called.");OneSignal._sessionInitAlreadyRunning=!0,e.modalPrompt&&e.fromRegisterFor?(OneSignal.subscriptionModalHost=new h.default(t.appId,e),OneSignal.subscriptionModalHost.load()):w.default.isUsingSubscriptionWorkaround()?(!0!==OneSignal.config.userConfig.autoRegister&&o.debug("OneSignal: Not automatically showing popover because autoRegister is not specifically true."),S.default.isHttpPromptAlreadyShown()&&o.debug("OneSignal: Not automatically showing popover because it was previously shown in the same session."),!0!==OneSignal.config.userConfig.autoRegister||S.default.isHttpPromptAlreadyShown()||OneSignal.showHttpPrompt().catch(function(e){e instanceof u.InvalidStateError&&e.reason===u.InvalidStateReason[u.InvalidStateReason.RedundantPermissionMessage]||e instanceof c.default||e instanceof a.default||e instanceof I.default?o.debug("[Prompt Not Showing]",e):o.info(e)}),OneSignal._sessionInitAlreadyRunning=!1):e.__sdkCall&&S.default.wasHttpsNativePromptDismissed()?(o.debug("OneSignal: Not automatically showing native HTTPS prompt because the user previously dismissed it."),OneSignal._sessionInitAlreadyRunning=!1):w.default.registerForPush(),l.default.trigger(OneSignal.EVENTS.SDK_INITIALIZED)},e.ponyfillSafariFetch=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:if(!r.safari||void 0!==window.fetch)return[3,4];o.debug("Loading fetch polyfill for Safari.."),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,(new E.DynamicResourceLoader).loadFetchPolyfill()];case 2:return t.sent(),o.debug("Done loading fetch polyfill."),[3,4];case 3:return e=t.sent(),o.debug("Error loading fetch polyfill:",e),[3,4];case 4:return[2]}})})},e.errorIfInitAlreadyCalled=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){if(OneSignal._initCalled)throw new _.SdkInitError(_.SdkInitErrorKind.MultipleInitialization);return OneSignal._initCalled=!0,[2]})})},e.downloadAndMergeAppConfig=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,r,o;return i.__generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,y.default.getAppConfig(new O.Uuid(t.appId))];case 1:return n=i.sent(),r=e.getMergedUserServerAppConfig(t,n),[2,r];case 2:if(o=i.sent()){if(1===o.code)throw new _.SdkInitError(_.SdkInitErrorKind.InvalidAppId);if(2===o.code)throw new _.SdkInitError(_.SdkInitErrorKind.AppNotConfiguredForWebPush)}throw o;case 3:return[2]}})})},e.getMergedUserServerAppConfig=function(t,n){var i=s({},n);return i.appId=new O.Uuid(t.appId),i.userConfig=s({},t),i.userConfig.serviceWorkerParam="undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_PARAM?OneSignal.SERVICE_WORKER_PARAM:{scope:"/"},i.userConfig.serviceWorkerPath="undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_PATH?OneSignal.SERVICE_WORKER_PATH:"OneSignalSDKWorker.js",i.userConfig.serviceWorkerUpdaterPath="undefined"!=typeof OneSignal&&OneSignal.SERVICE_WORKER_UPDATER_PATH?OneSignal.SERVICE_WORKER_UPDATER_PATH:"OneSignalSDUpdaterKWorker.js",i.userConfig.path=t.path?t.path:"/",i.subdomain&&!e.shouldUseServerConfigSubdomain(i)&&delete i.subdomain,i},e.shouldUseServerConfigSubdomain=function(e){switch(window.location.protocol){case"https:":return e&&e.userConfig&&!!e.userConfig.subdomainName;case"http:":return!0;default:return!1}},e}();t.default=C},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(9),r=n(6),o=n(50),s=n(74),a=function(){function e(){this.language=r.default.getLanguage(),this.timezone=-60*(new Date).getTimezoneOffset(),this.browserName=i.name,this.browserVersion=NaN!==parseInt(String(i.version))?parseInt(String(i.version)):-1,this.operatingSystem=this.getBrowserOperatingSystem(),this.operatingSystemVersion=String(i.osversion),this.devicePlatform=this.getDevicePlatformKind(),this.deviceModel=navigator.platform,this.sdkVersion=r.default.version().toString()}return e.prototype.getDevicePlatformKind=function(){var e=i.mobile,t=i.tablet;return e?s.DevicePlatformKind.Mobile:t?s.DevicePlatformKind.Tablet:s.DevicePlatformKind.Desktop},e.prototype.getBrowserOperatingSystem=function(){return i.mac?"Mac OS X":i.windows?"Microsoft Windows":i.windowsphone?"Microsoft Windows Phone":i.linux?"Linux":i.chromeos?"Google Chrome OS":i.android?"Google Android":i.ios?"Apple iOS":i.blackberry?"Blackberry":i.firefoxos?"Mozilla Firefox OS":i.webos?"WebOS":i.tizen?"Tizen":i.sailfish?"Sailfish OS":"Unknown"},e.prototype.serialize=function(){var e={device_type:this.deliveryPlatform,language:this.language,timezone:this.timezone,device_os:this.browserVersion,sdk:this.sdkVersion,notification_types:this.subscriptionState,delivery_platform:this.deliveryPlatform,browser_name:this.browserName,browser_version:this.browserVersion,operating_system:this.operatingSystem,operating_system_version:this.operatingSystemVersion,device_platform:this.devicePlatform,device_model:this.deviceModel};return this.appId&&(e.app_id=this.appId.value),this.subscription&&(e.identifier=i.safari?this.subscription.safariDeviceToken:this.subscription.w3cEndpoint.toString(),e.web_auth=this.subscription.w3cAuth,e.web_p256=this.subscription.w3cP256dh),e},e.prototype.deserialize=function(e){throw new o.default},e}();t.PushRegistration=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(8),o=n(10),s=n(12),a=n(35),u=n(32),c=function(){function e(e){this.options={appId:new s.Uuid(e.appId),subdomain:e.subdomainName,origin:e.origin,serialize:void 0,metrics:{enable:!1,mixpanelReportingToken:null}}}return e.prototype.initialize=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n,o=this;return i.__generator(this,function(i){switch(i.label){case 0:return(e=window.opener||window.parent)==window?(document.write("<span style='font-size: 14px; color: red; font-family: sans-serif;'>OneSignal: This page cannot be directly opened, and must be opened as a result of a subscription call.</span>"),[2,Promise.resolve()]):(t=r(this.options),t.appId=t.appId.value,t.origin=t.origin,OneSignal.config=t||{},[4,u.default.downloadAndMergeAppConfig(t)]);case 1:return n=i.sent(),OneSignal.context=new a.default(n),OneSignal.context.workerMessenger.listen(!0),OneSignal.initialized=!0,this.loadPromise={},this.loadPromise.promise=new Promise(function(e,t){o.loadPromise.resolver=e,o.loadPromise.rejector=t}),this.establishCrossOriginMessaging(),[2,this.loadPromise.promise]}})})},e.prototype.establishCrossOriginMessaging=function(){},e.prototype.dispose=function(){this.messenger.destroy()},e.prototype.finishInitialization=function(){this.loadPromise.resolver()},e.prototype.subscribe=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,OneSignal.isPushNotificationsEnabled()];case 1:return e=n.sent(),t=opener||parent,e?t&&window.close():o.default.registerForPush(),[2]}})})},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(23),r=n(30),o=n(75),s=n(49),a=n(79),u=n(42),c=n(2),l=n(80),d=n(81),f=n(54),p=function(){function e(e){this.appConfig=e,this.cookieSyncer=new a.default(e.cookieSyncEnabled),this.subscriptionManager=new o.SubscriptionManager(this,{safariWebId:e.safariWebId,appId:e.appId,vapidPublicKey:e.vapidPublicKey,onesignalVapidPublicKey:e.onesignalVapidPublicKey});var t={workerAPath:new u.default("/"+c.default.getBuildEnvPrefix()+"OneSignalSDKWorker.js"),workerBPath:new u.default("/"+c.default.getBuildEnvPrefix()+"OneSignalSDKUpdaterWorker.js"),registrationOptions:{scope:"/"}};e.userConfig&&(e.userConfig.path&&(t.workerAPath=new u.default(e.userConfig.path+c.default.getBuildEnvPrefix()+e.userConfig.serviceWorkerPath),t.workerBPath=new u.default(e.userConfig.path+c.default.getBuildEnvPrefix()+e.userConfig.serviceWorkerUpdaterPath)),e.userConfig.serviceWorkerParam&&(t.registrationOptions=e.userConfig.serviceWorkerParam)),this.serviceWorkerManager=new r.ServiceWorkerManager(this,t),this.workerMessenger=new i.WorkerMessenger(this),this.dynamicResourceLoader=new s.DynamicResourceLoader,this.sessionManager=new l.SessionManager,this.permissionManager=new d.default,this.metricsManager=new f.default(e.metrics.enable,e.metrics.mixpanelReportingToken)}return e}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.None="None",e.UnitTesting="Unit Testing"}(t.TestEnvironmentKind||(t.TestEnvironmentKind={}))},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){this._events={}}return e.prototype.on=function(e,t){return this._events[e]=this._events[e]||[],this._events[e].push(t),this},e.prototype.once=function(e,t){function n(){i.off(e,n),t.apply(this,arguments)}var i=this;return n.listener=t,this.on(e,n),this},e.prototype.off=function(e,t){var n=this._events[e];if(void 0!==n){for(var i=0;i<n.length;i+=1)if(n[i]===t||n[i].listener===t){n.splice(i,1);break}0===n.length&&this.removeAllListeners(e)}return this},e.prototype.removeAllListeners=function(e){try{delete this._events[e]}catch(e){}return this},e.prototype.listeners=function(e){try{return this._events[e]}catch(e){return}},e.prototype.emit=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=[].slice.call(arguments,0),i=n.shift(),r=this._events[i];if(void 0!==r){r=r.slice(0);for(var o=r.length,s=0;s<o;s+=1)r[s].apply(this,n)}return this},e}();t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(38),s=n(3),a=function(){function e(e){this.databaseName=e,this.emitter=new o.default}return e.prototype.open=function(e){var t=this;return new Promise(function(n){try{var i=indexedDB.open(e,1)}catch(e){}i.onerror=t.onDatabaseOpenError,i.onblocked=t.onDatabaseOpenBlocked,i.onupgradeneeded=t.onDatabaseUpgradeNeeded,i.onsuccess=function(){t.database=i.result,t.database.onerror=t.onDatabaseError,t.database.onversionchange=t.onDatabaseVersionChange,n(t.database)}})},e.prototype.ensureDatabaseOpen=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return this.openLock||(this.openLock=this.open(this.databaseName)),[4,this.openLock];case 1:return e.sent(),[2,this.database]}})})},e.prototype.onDatabaseOpenError=function(e){e.preventDefault();var t=e.target.error;s.contains(t.message,"The operation failed for reasons unrelated to the database itself and not covered by any other error code")||s.contains(t.message,"A mutation operation was attempted on a database that did not allow mutations")?r.warn("OneSignal: IndexedDb web storage is not available on this origin since this profile's IndexedDb schema has been upgraded in a newer version of Firefox. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1236557#c6"):r.warn("OneSignal: Fatal error opening IndexedDb database:",t)},e.prototype.onDatabaseError=function(e){r.debug("IndexedDb: Generic database error",e.target.errorCode)},e.prototype.onDatabaseOpenBlocked=function(){r.debug("IndexedDb: Blocked event")},e.prototype.onDatabaseVersionChange=function(e){r.debug("IndexedDb: versionchange event")},e.prototype.onDatabaseUpgradeNeeded=function(e){r.debug("IndexedDb: Database is being rebuilt or upgraded (upgradeneeded event).");var t=e.target.result;t.createObjectStore("Ids",{keyPath:"type"}),t.createObjectStore("NotificationOpened",{keyPath:"url"}),t.createObjectStore("Options",{keyPath:"key"}),"undefined"!=typeof OneSignal&&(OneSignal._isNewVisitor=!0)},e.prototype.get=function(e,t){return i.__awaiter(this,void 0,void 0,function(){var n=this;return i.__generator(this,function(i){switch(i.label){case 0:return[4,this.ensureDatabaseOpen()];case 1:return i.sent(),t?[4,new Promise(function(i,r){var o=n.database.transaction(e).objectStore(e).get(t);o.onsuccess=function(){i(o.result)},o.onerror=function(){r(o.error)}})]:[3,3];case 2:return[2,i.sent()];case 3:return[4,new Promise(function(t,i){var r={},o=n.database.transaction(e).objectStore(e).openCursor();o.onsuccess=function(e){var n=e.target.result;if(n){var i=n.key;r[i]=n.value,n.continue()}else t(r)},o.onerror=function(){i(o.error)}})];case 4:return[2,i.sent()]}})})},e.prototype.put=function(e,t){return i.__awaiter(this,void 0,void 0,function(){var n=this;return i.__generator(this,function(i){switch(i.label){case 0:return[4,this.ensureDatabaseOpen()];case 1:return i.sent(),[4,new Promise(function(i,o){try{var s=n.database.transaction([e],"readwrite").objectStore(e).put(t);s.onsuccess=function(){i(t)},s.onerror=function(e){r.error("Database PUT Transaction Error:",e),o(e)}}catch(e){r.error("Database PUT Error:",e),o(e)}})];case 2:return[2,i.sent()]}})})},e.prototype.remove=function(e,t){var n=this;if(t)var i="delete";else var i="clear";return new Promise(function(o,s){try{var a=n.database.transaction([e],"readwrite").objectStore(e)[i](t);a.onsuccess=function(){o(t)},a.onerror=function(e){r.error("Database REMOVE Transaction Error:",e),s(e)}}catch(e){r.error("Database REMOVE Error:",e),s(e)}})},e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(3),s=n(29),a=n(22),u=function(e){function t(t){var n=e.call(this,".onesignal-bell-launcher-message","onesignal-bell-launcher-message-opened",null,"hidden",["opacity","transform"],".onesignal-bell-launcher-message-body")||this;return n.bell=t,n.contentType="",n.queued=[],n}return i.__extends(t,e),Object.defineProperty(t,"TIMEOUT",{get:function(){return 2500},enumerable:!0,configurable:!0}),Object.defineProperty(t,"TYPES",{get:function(){return{TIP:"tip",MESSAGE:"message",QUEUED:"queued"}},enumerable:!0,configurable:!0}),t.prototype.display=function(e,t,n){var i=this;return void 0===n&&(n=0),r.debug("Calling %cdisplay("+e+", "+t+", "+n+").",o.getConsoleStyle("code")),(this.shown?this.hide():o.nothing()).then(function(){i.content=o.decodeHtmlEntities(t),i.contentType=e}).then(function(){return i.show()}).then(function(){return o.delay(n)}).then(function(){return i.hide()}).then(function(){i.content=i.getTipForState(),i.contentType="tip"})},t.prototype.getTipForState=function(){return this.bell.state===a.default.STATES.UNSUBSCRIBED?this.bell.text["tip.state.unsubscribed"]:this.bell.state===a.default.STATES.SUBSCRIBED?this.bell.text["tip.state.subscribed"]:this.bell.state===a.default.STATES.BLOCKED?this.bell.text["tip.state.blocked"]:void 0},t.prototype.enqueue=function(e){var t=this;return this.queued.push(o.decodeHtmlEntities(e)),new Promise(function(e){t.bell.badge.shown?t.bell.badge.hide().then(function(){return t.bell.badge.increment()}).then(function(){return t.bell.badge.show()}).then(e):(t.bell.badge.increment(),t.bell.initialized?t.bell.badge.show().then(e):e())})},t.prototype.dequeue=function(e){var t=this,n=this.queued.pop(e);return new Promise(function(e){t.bell.badge.shown?t.bell.badge.hide().then(function(){return t.bell.badge.decrement()}).then(function(e){return e>0?t.bell.badge.show():Promise.resolve(t)}).then(e(n)):(t.bell.badge.decrement(),e(n))})},t}(s.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.HttpsPermissionRequest="HTTPS permission request"]="HttpsPermissionRequest",e[e.FullscreenHttpPermissionMessage="fullscreen HTTP permission message"]="FullscreenHttpPermissionMessage",e[e.FullscreenHttpsPermissionMessage="fullscreen HTTPS permission message"]="FullscreenHttpsPermissionMessage",e[e.SlidedownPermissionMessage="slidedown permission message"]="SlidedownPermissionMessage",e[e.SubscriptionBell="subscription bell"]="SubscriptionBell"}(t.PermissionPromptType||(t.PermissionPromptType={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(18),r=function(){function e(e){if(!e)throw new i.InvalidArgumentError("path",i.InvalidArgumentReason.Empty);this.path=e.trim()}return e.prototype.getQueryString=function(){var e=this.path.indexOf("?");return-1===e?null:this.path.length>e?this.path.substring(e+1):null},e.prototype.getWithoutQueryString=function(){return this.path.split(e.QUERY_STRING)[0]},e.prototype.getFileName=function(){return this.getWithoutQueryString().split("\\").pop().split("/").pop()},e.prototype.getFileNameWithQuery=function(){return this.path.split("\\").pop().split("/").pop()},e.prototype.getFullPath=function(){return this.path},e.prototype.getPathWithoutFileName=function(){var e=this.getWithoutQueryString(),t=e.lastIndexOf(this.getFileName()),n=e.substring(0,t);return n=n.replace(/[\\\/]$/,"")},e.QUERY_STRING="?",e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(44),s=n(27),a=n(1),u=n(8),c=n(45),l=n(6),d=n(46),f=n(18),p=n(16),g=n(70),h=n(47),v=n(14),m=n(14),b=n(31),S=n(5),w=n(15),_=n(71),y=n(32),O=n(13),E=n(10),P=n(51),I=n(21),C=n(84),N=n(48),T=n(2),A=n(30),M=n(35),k=n(20),R=n(41),x=n(4),D=n(86),W=n(19),U=n(87),L=n(88),B=n(11),F=n(39),j=n(3),H=n(89),V=n(33),K=n(90),G=function(){function e(){}return e.setDefaultNotificationUrl=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:if(!H.ValidatorUtils.isValidUrl(e,{allowNull:!0}))throw new f.InvalidArgumentError("url",f.InvalidArgumentReason.Malformed);return[4,j.awaitOneSignalInitAndSupported()];case 1:return n.sent(),j.logMethodCall("setDefaultNotificationUrl",e),[4,B.default.getAppState()];case 2:return t=n.sent(),t.defaultNotificationUrl=e,[4,B.default.setAppState(t)];case 3:return n.sent(),[2]}})})},e.setDefaultTitle=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return n.sent(),j.logMethodCall("setDefaultTitle",e),[4,B.default.getAppState()];case 2:return t=n.sent(),t.defaultNotificationTitle=e,[4,B.default.setAppState(t)];case 3:return n.sent(),[2]}})})},e.syncHashedEmail=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o;return i.__generator(this,function(i){switch(i.label){case 0:if(!e)throw new f.InvalidArgumentError("email",f.InvalidArgumentReason.Empty);if(t=j.prepareEmailForHashing(e),!j.isValidEmail(t))throw new f.InvalidArgumentError("email",f.InvalidArgumentReason.Malformed);return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("syncHashedEmail",e),[4,B.default.getAppConfig()];case 2:return n=i.sent().appId,[4,B.default.getSubscription()];case 3:if(!(r=i.sent().deviceId)||!r.value)throw new g.NotSubscribedError(g.NotSubscribedReason.NoDeviceId);return[4,W.default.updatePlayer(n,r,{em_m:L.default.md5(t),em_s:L.default.sha1(t),em_s256:L.default.sha256(t)})];case 4:if((o=i.sent())&&o.success)return[2,!0];throw o}})})},e.isPushNotificationsSupported=function(){return j.logMethodCall("isPushNotificationsSupported"),!0},e.init=function(t){return i.__awaiter(this,void 0,void 0,function(){function n(){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:if(e.__initAlreadyCalled)return[2];if(e.__initAlreadyCalled=!0,O.default.fixWordpressManifestIfMisplaced(),e.on(e.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,w.default.onNotificationPermissionChange),e.on(e.EVENTS.SUBSCRIPTION_CHANGED,w.default._onSubscriptionChanged),e.on(e.EVENTS.SDK_INITIALIZED,y.default.onSdkInitialized),!E.default.isUsingSubscriptionWorkaround())return[3,2];if(e.appConfig=o,!o.subdomain)throw new b.SdkInitError(b.SdkInitErrorKind.MissingSubdomain);return t=e,[4,C.default.discoverAltOrigin(o)];case 1:t.proxyFrameHost=n.sent(),n.label=2;case 2:return window.addEventListener("focus",function(){O.default.checkAndTriggerNotificationPermissionChanged()}),y.default.initSaveState(document.title).then(function(){return y.default.saveInitOptions()}).then(function(){T.default.getWindowEnv()===x.WindowEnvironmentKind.CustomIframe?S.default.trigger(e.EVENTS.SDK_INITIALIZED):y.default.internalInit()}),[2]}})})}var o;return i.__generator(this,function(i){switch(i.label){case 0:return j.logMethodCall("init"),y.default.ponyfillSafariFetch(),y.default.errorIfInitAlreadyCalled(),[4,y.default.downloadAndMergeAppConfig(t)];case 1:return o=i.sent(),(a.debug("OneSignal: Final web app config: %c"+JSON.stringify(o,null,4),j.getConsoleStyle("code")),e.context=new M.default(o),e.config=e.context.appConfig,e.context.workerMessenger.listen(),r.safari&&!e.config.safariWebId)?(a.warn(new b.SdkInitError(b.SdkInitErrorKind.MissingSafariWebId)),[2]):("complete"===document.readyState||"interactive"===document.readyState?n():(a.debug("OneSignal: Waiting for DOMContentLoaded or readyStateChange event before continuing initialization..."),window.addEventListener("DOMContentLoaded",function(){n()}),document.onreadystatechange=function(){"complete"!==document.readyState&&"interactive"!==document.readyState||n()}),[2])}})})},e.showHttpPermissionRequest=function(t){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){return a.debug("Called showHttpPermissionRequest(), redirecting to HTTP prompt."),e.showHttpPrompt().catch(function(e){return a.info(e)}),[2]})})},e.showHttpPrompt=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,r,o,s,u;return i.__generator(this,function(i){switch(i.label){case 0:return t||(t={}),[4,j.awaitOneSignalInitAndSupported()];case 1:if(i.sent(),e.__isPopoverShowing)throw new p.InvalidStateError(p.InvalidStateReason.RedundantPermissionMessage,{permissionPromptType:R.PermissionPromptType.SlidedownPermissionMessage});return[4,e.getNotificationPermission()];case 2:return n=i.sent(),[4,e.isPushNotificationsEnabled()];case 3:return r=i.sent(),[4,e.getSubscription()];case 4:return o=i.sent(),[4,O.default.wasHttpsNativePromptDismissed()];case 5:if((s=i.sent())&&!t.force)return a.info(new h.default),[2];if(n===k.NotificationPermission.Denied)return a.info(new v.default(m.PushPermissionNotGrantedErrorReason.Blocked)),[2];if(r)throw new d.default;if(!o)throw new g.NotSubscribedError(g.NotSubscribedReason.OptedOut);return O.default.markHttpPopoverShown(),[4,e.context.dynamicResourceLoader.loadSdkStylesheet()];case 6:return 0!==(u=i.sent())?(a.debug("Not showing slidedown permission message because styles failed to load."),[2]):(e.popover=new U.default(e.config.userConfig.promptOptions),e.popover.create(),a.debug("Showing the HTTP popover."),e.notifyButton&&e.notifyButton.options.enable&&"hidden"!==e.notifyButton.launcher.state&&e.notifyButton.launcher.waitUntilShown().then(function(){e.notifyButton.launcher.hide()}),e.once(U.default.EVENTS.SHOWN,function(){e.__isPopoverShowing=!0}),e.once(U.default.EVENTS.CLOSED,function(){e.__isPopoverShowing=!1,e.notifyButton&&e.notifyButton.options.enable&&e.notifyButton.launcher.show()}),e.once(U.default.EVENTS.ALLOW_CLICK,function(){e.popover.close(),a.debug("Setting flag to not show the popover to the user again."),P.default.markHttpsNativePromptDismissed(),e.registerForPushNotifications({autoAccept:!0})}),e.once(U.default.EVENTS.CANCEL_CLICK,function(){a.debug("Setting flag to not show the popover to the user again."),P.default.markHttpsNativePromptDismissed()}),[2])}})})},e.registerForPushNotifications=function(t){function n(){if(t&&t.httpPermissionRequest&&E.default.isUsingSubscriptionWorkaround())return void a.error(new K.DeprecatedApiError(K.DeprecatedApiReason.HttpPermissionRequest));E.default.isUsingSubscriptionWorkaround()?(e.subscriptionPopupHost=new D.default(e.proxyFrameHost.url,t),e.subscriptionPopupHost.load()):(t||(t={}),t.fromRegisterFor=!0,y.default.sessionInit(t))}if(e.initialized)return n();e.once(e.EVENTS.SDK_INITIALIZED,function(){return n()})},e.getNotificationPermission=function(t){return i.__awaiter(this,void 0,void 0,function(){var n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),[4,e.context.permissionManager.getNotificationPermission(e.config.safariWebId)];case 2:return n=i.sent(),t&&t(n),[2,n]}})})},e.getTags=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("getTags",e),[4,B.default.getAppConfig()];case 2:return t=i.sent().appId,[4,B.default.getSubscription()];case 3:return n=i.sent().deviceId,n&&n.value?[4,W.default.getPlayer(t,n)]:(a.info(new g.NotSubscribedError(g.NotSubscribedReason.NoDeviceId)),[2,null]);case 4:return r=i.sent().tags,j.executeCallback(e,r),[2,r]}})})},e.sendTag=function(t,n,r){return i.__awaiter(this,void 0,void 0,function(){var o;return i.__generator(this,function(i){switch(i.label){case 0:return o={},o[t]=n,[4,e.sendTags(o,r)];case 1:return[2,i.sent()]}})})},e.sendTags=function(t,n){return i.__awaiter(this,void 0,void 0,function(){var r,o,s;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),(j.logMethodCall("sendTags",t,n),t&&0!==Object.keys(t).length)?(Object.keys(t).forEach(function(e){!1===t[e]&&(t[e]="false")}),[4,B.default.getAppConfig()]):(a.info(new f.InvalidArgumentError("tags",f.InvalidArgumentReason.Empty)),[2,null]);case 2:return r=i.sent().appId,[4,B.default.getSubscription()];case 3:return o=i.sent().deviceId,o&&o.value?[3,5]:[4,j.awaitSdkEvent(e.EVENTS.REGISTERED)];case 4:i.sent(),i.label=5;case 5:return[4,B.default.getSubscription()];case 6:return s=i.sent().deviceId,[4,W.default.updatePlayer(r,s,{tags:t})];case 7:return i.sent(),j.executeCallback(n,t),[2,t]}})})},e.deleteTag=function(t){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(n){switch(n.label){case 0:return[4,e.deleteTags([t])];case 1:return[2,n.sent()]}})})},e.deleteTags=function(t,n){return i.__awaiter(this,void 0,void 0,function(){var r,o,s,u,c,l;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:if(i.sent(),j.logMethodCall("deleteTags",t,n),!H.ValidatorUtils.isValidArray(t))throw new f.InvalidArgumentError("tags",f.InvalidArgumentReason.Malformed);for(0===t.length&&a.info(new f.InvalidArgumentError("tags",f.InvalidArgumentReason.Empty)),r={},o=0,s=t;o<s.length;o++)u=s[o],r[u]="";return[4,e.sendTags(r)];case 2:return c=i.sent(),l=Object.keys(c),j.executeCallback(n,l),[2,l]}})})},e.addListenerForNotificationOpened=function(t){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(n){switch(n.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return n.sent(),j.logMethodCall("addListenerForNotificationOpened",t),e.once(e.EVENTS.NOTIFICATION_CLICKED,function(e){j.executeCallback(t,e)}),w.default.fireStoredNotificationClicks(e.config.pageUrl||e.config.userConfig.pageUrl),[2]}})})},e.getIdsAvailable=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("getIdsAvailable",e),[4,B.default.getSubscription()];case 2:return t=i.sent(),n=t.deviceId,r=t.subscriptionToken,o={userId:n.value,registrationId:r},j.executeCallback(e,o),[2,o]}})})},e.isPushNotificationsEnabled=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,r,o,s,a,u,c,d,f,p,g;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("isPushNotificationsEnabled",t),[4,E.default.hasInsecureParentOrigin()];case 2:return n=i.sent(),[4,B.default.getSubscription()];case 3:return r=i.sent(),o=r.deviceId,s=r.subscriptionToken,a=r.optedOut,[4,e.getNotificationPermission()];case 4:return u=i.sent(),c=!1,!l.default.supportsServiceWorkers()||E.default.isUsingSubscriptionWorkaround()||T.default.getWindowEnv()===x.WindowEnvironmentKind.OneSignalProxyFrame||n?[3,9]:[4,e.context.serviceWorkerManager.getActiveState()];case 5:return d=i.sent(),f=d===A.ServiceWorkerActiveState.WorkerA||d===A.ServiceWorkerActiveState.WorkerB,c=!(!o||!s||u!==k.NotificationPermission.Granted||a||!f),[4,navigator.serviceWorker.getRegistration()];case 6:return p=i.sent(),p?[4,p.pushManager.getSubscription()]:[3,8];case 7:g=i.sent(),g||(c=!1),i.label=8;case 8:return[3,10];case 9:c=!(!o||!s||u!==k.NotificationPermission.Granted||a),i.label=10;case 10:return j.executeCallback(t,c),[2,c]}})})},e.setSubscription=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("setSubscription",e),[4,B.default.getAppConfig()];case 2:return t=i.sent(),n=t.appId,[4,B.default.getSubscription()];case 3:if(r=i.sent(),o=r.deviceId,!t.appId)throw new p.InvalidStateError(p.InvalidStateReason.MissingAppId);if(!H.ValidatorUtils.isValidBoolean(e))throw new f.InvalidArgumentError("newSubscription",f.InvalidArgumentReason.Malformed);return o&&o.value?(r.optedOut=!e,[4,W.default.updatePlayer(n,o,{notification_types:O.default.getNotificationTypeFromOptIn(e)})]):(a.info(new g.NotSubscribedError(g.NotSubscribedReason.NoDeviceId)),[2]);case 4:return i.sent(),[4,B.default.setSubscription(r)];case 5:return i.sent(),w.default.onInternalSubscriptionSet(r.optedOut),w.default.checkAndTriggerSubscriptionChanged(),[2]}})})},e.isOptedOut=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return n.sent(),j.logMethodCall("isOptedOut",e),[4,B.default.getSubscription()];case 2:return t=n.sent().optedOut,j.executeCallback(e,t),[2,t]}})})},e.optOut=function(t,n){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:if(i.sent(),j.logMethodCall("optOut",t,n),!H.ValidatorUtils.isValidBoolean(t))throw new f.InvalidArgumentError("doOptOut",f.InvalidArgumentReason.Malformed);return[4,e.setSubscription(!t)];case 2:return i.sent(),j.executeCallback(n),[2]}})})},e.getUserId=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("getUserId",e),[4,B.default.getSubscription()];case 2:return t=i.sent(),n=t.deviceId,j.executeCallback(e,n.value),[2,n.value]}})})},e.getRegistrationId=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("getRegistrationId",e),[4,B.default.getSubscription()];case 2:return t=i.sent(),n=t.subscriptionToken,j.executeCallback(e,n),[2,n]}})})},e.getSubscription=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("getSubscription",e),[4,B.default.getSubscription()];case 2:return t=i.sent(),n=!t.optedOut,j.executeCallback(e,n),[2,n]}})})},e.sendSelfNotification=function(t,n,r,o,s,a){return void 0===t&&(t="OneSignal Test Message"),void 0===n&&(n="This is an example notification."),void 0===r&&(r=new URL(location.href).origin+"?_osp=do_not_open"),i.__awaiter(this,void 0,void 0,function(){var u,c;return i.__generator(this,function(i){switch(i.label){case 0:return[4,j.awaitOneSignalInitAndSupported()];case 1:return i.sent(),j.logMethodCall("sendSelfNotification",t,n,r,o,s,a),[4,B.default.getAppConfig()];case 2:return u=i.sent(),[4,B.default.getSubscription()];case 3:if(c=i.sent(),!u.appId)throw new p.InvalidStateError(p.InvalidStateReason.MissingAppId);return[4,e.isPushNotificationsEnabled()];case 4:if(!i.sent())throw new g.NotSubscribedError(g.NotSubscribedReason.NoDeviceId);if(!H.ValidatorUtils.isValidUrl(r))throw new f.InvalidArgumentError("url",f.InvalidArgumentReason.Malformed);if(!H.ValidatorUtils.isValidUrl(o,{allowEmpty:!0,requireHttps:!0}))throw new f.InvalidArgumentError("icon",f.InvalidArgumentReason.Malformed);return[4,W.default.sendNotification(u.appId,[c.deviceId],{en:t},{en:n},r,o,s,a)];case 5:return[2,i.sent()]}})})},e.push=function(t){if("function"==typeof t)t();else{e[t.shift()].apply(null,t)}},e.on=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},e.off=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},e.once=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},e.VERSION=l.default.version(),e._VERSION=l.default.version(),e.sdkEnvironment=T.default,e._notificationOpenedCallbacks=[],e._idsAvailable_callback=[],e._defaultLaunchURL=null,e.config=null,e.__isPopoverShowing=!1,e._sessionInitAlreadyRunning=!1,e._isNotificationEnabledCallback=[],e._subscriptionSet=!0,e.modalUrl=null,e._windowWidth=650,e._windowHeight=568,e._isNewVisitor=!1,e._channel=null,e.cookie=s,e.initialized=!1,e.notifyButton=null,e.store=I.default,e.environment=l.default,e.database=B.default,e.event=S.default,e.browser=r,e.popover=null,e.log=a,e.api=W.default,e.indexedDb=F.default,e.mainHelper=O.default,e.subscriptionHelper=E.default,e.httpHelper=_.default,e.eventHelper=w.default,e.initHelper=y.default,e.testHelper=P.default,e.objectAssign=u,e.appConfig=null,e.SERVICE_WORKER_UPDATER_PATH="OneSignalSDKUpdaterWorker.js",e.SERVICE_WORKER_PATH="OneSignalSDKWorker.js",e.SERVICE_WORKER_PARAM={scope:"/"},e._LOGGING=!1,e.LOGGING=!1,e._usingNativePermissionHook=!1,e._initCalled=!1,e.__initAlreadyCalled=!1,e.checkAndWipeUserSubscription=function(){},e.crypto=L.default,e.PushRegistration=V.PushRegistration,e.notificationPermission=k.NotificationPermission,e._initHttp=_.default.initHttp,e._initPopup=function(){return e.subscriptionPopup.subscribe()},e.POSTMAM_COMMANDS={CONNECTED:"connect",REMOTE_NOTIFICATION_PERMISSION:"postmam.remoteNotificationPermission",REMOTE_DATABASE_GET:"postmam.remoteDatabaseGet",REMOTE_DATABASE_PUT:"postmam.remoteDatabasePut",REMOTE_DATABASE_REMOVE:"postmam.remoteDatabaseRemove",REMOTE_OPERATION_COMPLETE:"postman.operationComplete",REMOTE_RETRIGGER_EVENT:"postmam.remoteRetriggerEvent",MODAL_LOADED:"postmam.modalPrompt.loaded",MODAL_PROMPT_ACCEPTED:"postmam.modalPrompt.accepted",MODAL_PROMPT_REJECTED:"postmam.modalPrompt.canceled",POPUP_LOADED:"postmam.popup.loaded",POPUP_ACCEPTED:"postmam.popup.accepted",POPUP_REJECTED:"postmam.popup.canceled",POPUP_CLOSING:"postman.popup.closing",REMOTE_NOTIFICATION_PERMISSION_CHANGED:"postmam.remoteNotificationPermissionChanged",IFRAME_POPUP_INITIALIZE:"postmam.iframePopupInitialize",UNSUBSCRIBE_FROM_PUSH:"postmam.unsubscribeFromPush",SET_SESSION_COUNT:"postmam.setSessionCount",REQUEST_HOST_URL:"postmam.requestHostUrl",WINDOW_TIMEOUT:"postmam.windowTimeout",FINISH_REMOTE_REGISTRATION:"postmam.finishRemoteRegistration",FINISH_REMOTE_REGISTRATION_IN_PROGRESS:"postmam.finishRemoteRegistrationInProgress",POPUP_BEGIN_MESSAGEPORT_COMMS:"postmam.beginMessagePortComms",SERVICEWORKER_COMMAND_REDIRECT:"postmam.command.redirect",MARK_PROMPT_DISMISSED:"postmam.markPromptDismissed",IS_SUBSCRIBED:"postmam.isSubscribed",UNSUBSCRIBE_PROXY_FRAME:"postman.unsubscribeProxyFrame",GET_EVENT_LISTENER_COUNT:"postmam.getEventListenerCount"},e.EVENTS={CUSTOM_PROMPT_CLICKED:"customPromptClick",NATIVE_PROMPT_PERMISSIONCHANGED:"notificationPermissionChange",SUBSCRIPTION_CHANGED:"subscriptionChange",WELCOME_NOTIFICATION_SENT:"sendWelcomeNotification",NOTIFICATION_DISPLAYED:"notificationDisplay",NOTIFICATION_DISMISSED:"notificationDismiss",NOTIFICATION_CLICKED:"notificationClick",SDK_INITIALIZED:"initialize",REGISTERED:"register",POPUP_CLOSING:"popupClose",PERMISSION_PROMPT_DISPLAYED:"permissionPromptDisplay",TEST_INIT_OPTION_DISABLED:"testInitOptionDisabled",TEST_WOULD_DISPLAY:"testWouldDisplay",POPUP_WINDOW_TIMEOUT:"popupWindowTimeout"},e.NOTIFICATION_TYPES={SUBSCRIBED:1,UNSUBSCRIBED:-2},e}();t.default=G,Object.defineProperty(G,"LOGGING",{get:function(){return G._LOGGING},set:function(e){e?(a.setDefaultLevel(a.levels.TRACE),G._LOGGING=!0):(a.setDefaultLevel(a.levels.WARN),G._LOGGING=!1)},enumerable:!0,configurable:!0}),o.merge(G,new c),G.LOGGING?a.setDefaultLevel(a.levels.TRACE):a.setDefaultLevel(a.levels.WARN),N.default.ensureBackwardsCompatibility(G),a.info("%cOneSignal Web SDK loaded (version "+G._VERSION+", "+T.default.getWindowEnv().toString()+" environment).",j.getConsoleStyle("bold")),a.debug("Current Page URL: "+("undefined"==typeof location?"NodeJS":location.href)),a.debug("Browser Environment: "+r.name+" "+r.version)},function(e,t,n){var i,r;!function(o,s,a){i=a,void 0!==(r="function"==typeof i?i.call(t,n,t,e):i)&&(e.exports=r)}(0,0,function(){"use strict";var e={inherit:function(t,n,i){(t.prototype=e.createObject(n.prototype)).constructor=t,(i||void 0===i)&&(t._super=n.prototype)},createObject:Object.create||function(e){var t=function(){};return t.prototype=e,new t},mixin:function(t,n){return e.merge(t.prototype,n)},merge:function(e,t){var n;for(n in t)e[n]=t[n]},hasOwn:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}};return e})},function(e,t,n){var i;!function(t){"use strict";function r(){}function o(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function s(e){return function(){return this[e].apply(this,arguments)}}function a(e){return"function"==typeof e||e instanceof RegExp||!(!e||"object"!=typeof e)&&a(e.listener)}var u=r.prototype,c=t.EventEmitter;u.getListeners=function(e){var t,n,i=this._getEvents();if(e instanceof RegExp){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},u.flattenListeners=function(e){var t,n=[];for(t=0;t<e.length;t+=1)n.push(e[t].listener);return n},u.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},u.addListener=function(e,t){if(!a(t))throw new TypeError("listener must be a function");var n,i=this.getListenersAsObject(e),r="object"==typeof t;for(n in i)i.hasOwnProperty(n)&&-1===o(i[n],t)&&i[n].push(r?t:{listener:t,once:!1});return this},u.on=s("addListener"),u.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},u.once=s("addOnceListener"),u.defineEvent=function(e){return this.getListeners(e),this},u.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},u.removeListener=function(e,t){var n,i,r=this.getListenersAsObject(e);for(i in r)r.hasOwnProperty(i)&&-1!==(n=o(r[i],t))&&r[i].splice(n,1);return this},u.off=s("removeListener"),u.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},u.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},u.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},u.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if(e instanceof RegExp)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},u.removeAllListeners=s("removeEvent"),u.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].slice(0),r=0;r<n.length;r++)i=n[r],!0===i.once&&this.removeListener(e,i.listener),i.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,i.listener);return this},u.trigger=s("emitEvent"),u.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},u.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},u._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},u._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return t.EventEmitter=c,r},void 0!==(i=function(){return r}.call(t,n,t,e))&&(e.exports=i)}(this||{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(7),AlreadySubscribedError=function(e){function AlreadySubscribedError(){return e.call(this,"This operation can only be performed when the user is not subscribed.")||this}return i.__extends(AlreadySubscribedError,e),AlreadySubscribedError}(r.default);t.default=AlreadySubscribedError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(7),PermissionMessageDismissedError=function(e){function PermissionMessageDismissedError(){return e.call(this,"The permission message was previously dismissed.")||this}return i.__extends(PermissionMessageDismissedError,e),PermissionMessageDismissedError}(r.default);t.default=PermissionMessageDismissedError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(4),r=n(2),o=function(){function e(){}return e.ensureBackwardsCompatibility=function(t){e.environmentPolyfill(t),e.postmams(t)},e.environmentPolyfill=function(e){e.environment={},e.environment.getEnv=function(){return""},e.environment.isPopup=function(){return r.default.getWindowEnv()===i.WindowEnvironmentKind.OneSignalSubscriptionPopup},e.environment.isIframe=function(){return r.default.getWindowEnv()===i.WindowEnvironmentKind.OneSignalProxyFrame}},e.postmams=function(e){function t(e){e.message=n,e.postMessage=i}var n=function(){this.messenger.message.apply(this.messenger,arguments)},i=function(){this.messenger.postMessage.apply(this.messenger,arguments)};e.proxyFrame&&(e.iframePostmam=e.proxyFrame,t(e.iframePostmam)),e.subscriptionPopup&&(e.popupPostmam=e.subscriptionPopup,t(e.popupPostmam)),e.subscriptionModal&&(e.modalPostmam=e.subscriptionModal,t(e.modalPostmam))},e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(8),o=n(2),s=n(6),a=function(){function e(){this.cache={}}return e.prototype.getCache=function(){return r({},this.cache)},e.prototype.loadSdkStylesheet=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:return e=o.default.getOneSignalApiUrl().origin,[4,this.loadIfNew(0,new URL(e+"/sdks/OneSignalSDKStyles.css?v="+s.default.getSdkStylesVersionHash()))];case 1:return[2,t.sent()]}})})},e.prototype.loadFetchPolyfill=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return[4,this.loadIfNew(1,new URL("https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js"))];case 1:return[2,e.sent()]}})})},e.prototype.loadIfNew=function(t,n){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(i){switch(i.label){case 0:return this.cache[n.toString()]||(this.cache[n.toString()]=e.load(t,n)),[4,this.cache[n.toString()]];case 1:return[2,i.sent()]}})})},e.load=function(e,t){return i.__awaiter(this,void 0,void 0,function(){var n;return i.__generator(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,new Promise(function(n,i){switch(e){case 1:var r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("async","async"),r.setAttribute("src",t.toString());break;case 0:var r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href",t.toString())}r.onerror=i,r.onload=n,document.querySelector("head").appendChild(r)})];case 1:return i.sent(),[2,0];case 2:return n=i.sent(),[2,1];case 3:return[2]}})})},e}();t.DynamicResourceLoader=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(7),o=function(e){function t(){return e.call(this,"This code is not implemented yet.")||this}return i.__extends(t,e),t}(r.default);t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(27),o=n(1),s=n(2),a=n(11),u=n(10),c=function(){function e(){}return e.unmarkHttpsNativePromptDismissed=function(){r.remove("onesignal-notification-prompt")?o.debug("OneSignal: Removed the native notification prompt dismissed cookie."):o.debug("OneSignal: Cookie not marked.")},e.markHttpsNativePromptDismissed=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return u.default.isUsingSubscriptionWorkaround()?[4,new Promise(function(e,t){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,{},function(n){n.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t()})})]:[3,2];case 1:n.sent(),n.label=2;case 2:return[4,a.default.get("Options","promptDismissCount")];case 3:return e=n.sent(),e||(e=0),u.default.isUsingSubscriptionWorkaround()||(e+=1),t=3,2==e?t=7:e>2&&(t=30),o.debug("("+s.default.getWindowEnv().toString()+") OneSignal: User dismissed the native notification prompt; reprompt after "+t+" days."),[4,a.default.put("Options",{key:"promptDismissCount",value:e})];case 4:return n.sent(),[2,r.set("onesignal-notification-prompt","dismissed",{expires:t})]}})})},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.InvalidSafariSetup=0]="InvalidSafariSetup",e[e.Blocked=1]="Blocked",e[e.Dismissed=2]="Dismissed"}(i=t.SubscriptionErrorReason||(t.SubscriptionErrorReason={}));var s=function(e){function t(t){var n=this;switch(t){case i.InvalidSafariSetup:n=e.call(this,"The Safari site URL, icon size, or push certificate is invalid, or Safari is in a private session.")||this;break;case i.Blocked:n=e.call(this,"Notification permissions are blocked.")||this;break;case i.Dismissed:n=e.call(this,"The notification permission prompt was dismissed.")||this}return n}return r.__extends(t,e),t}(o.default);t.default=s},function(e,t,n){"use strict";function i(e){for(var t="=".repeat((4-e.length%4)%4),n=(e+t).replace(/\-/g,"+").replace(/_/g,"/"),i=atob(n),r=new Uint8Array(i.length),o=0;o<i.length;++o)r[o]=i.charCodeAt(o);return r}function r(e){for(var t,n,i,r,o,s="",a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=new Uint8Array(e),c=u.byteLength,l=c%3,d=c-l,f=0;f<d;f+=3)o=u[f]<<16|u[f+1]<<8|u[f+2],t=(16515072&o)>>18,n=(258048&o)>>12,i=(4032&o)>>6,r=63&o,s+=a[t]+a[n]+a[i]+a[r];return 1==l?(o=u[d],t=(252&o)>>2,n=(3&o)<<4,s+=a[t]+a[n]+"=="):2==l&&(o=u[d]<<8|u[d+1],t=(64512&o)>>10,n=(1008&o)>>4,i=(15&o)<<2,s+=a[t]+a[n]+a[i]+"="),s}function o(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}function s(e){return decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""))}Object.defineProperty(t,"__esModule",{value:!0}),t.base64ToUint8Array=i,t.arrayBufferToBase64=r,t.base64Encode=o,t.base64Decode=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(8),o=n(53),s=n(6),a=function(){function e(){}return e.prototype.getPropertiesAsJson=function(){return{origin:location.origin,url:location.href,sdkVersion:s.default.version()}},e}();!function(e){e.HttpPermissionRequest="HttpPermissionRequest"}(t.ApiUsageMetricKind||(t.ApiUsageMetricKind={}));var u=function(e){function t(t){var n=e.call(this)||this;return n.apiName=t,n}return i.__extends(t,e),t.prototype.getEventName=function(){return"api-usage"},t.prototype.getPropertiesAsJson=function(){return r({},{api:this.apiName.toString()},e.prototype.getPropertiesAsJson.call(this))},t}(a);t.ApiUsageMetricEvent=u;var c=function(){function e(e,t){this.isFeatureEnabled=e,this.mixpanelReportingToken=t}return Object.defineProperty(e,"MIXPANEL_REPORTING_URL",{get:function(){return"https://api.mixpanel.com"},enumerable:!0,configurable:!0}),e.prototype.isEnabled=function(){return this.isFeatureEnabled&&!!this.mixpanelReportingToken},e.prototype.reportEvent=function(t){if(!this.isEnabled())return Promise.resolve(null);var n={event:t.getEventName(),properties:r({},{token:this.mixpanelReportingToken},t.getPropertiesAsJson())},i=o.base64Encode(JSON.stringify(n)),s={method:"GET",headers:new Headers,cache:"no-cache"};return fetch(e.MIXPANEL_REPORTING_URL+"/track/?data="+i,s)},e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),r=n(3),o=n(1),s=n(2),a=n(4);if(i.default.isBrowser())if(r.incrementSdkLoadCount(),r.getSdkLoadCount()>1)o.warn("OneSignal: The web push SDK is included more than once. For optimal performance, please include our SDK only once on your page."),o.debug("OneSignal: Exiting from SDK initialization to prevent double-initialization errors. Occurred "+r.getSdkLoadCount()+" times.");else{if("undefined"!=typeof OneSignal)var u=OneSignal;if(r.isPushNotificationsSupported()?window.OneSignal=n(43).default:(o.debug("OneSignal: Push notifications are not supported. A stubbed version of the SDK will be initialized."),window.OneSignal=n(91).default),u)for(var c=0;c<u.length;c++)OneSignal.push(u[c])}else s.default.getWindowEnv()===a.WindowEnvironmentKind.ServiceWorker&&(self.OneSignal=n(92).default)},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Object.defineProperty(n,"message",{configurable:!0,enumerable:!1,value:e,writable:!0}),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:n.constructor.name,writable:!0}),Error.hasOwnProperty("captureStackTrace")?(Error.captureStackTrace(n,n.constructor),r(n)):(Object.defineProperty(n,"stack",{configurable:!0,enumerable:!1,value:new Error(e).stack,writable:!0}),n)}return o(t,e),t}(function(e){function t(){e.apply(this,arguments)}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}(Error));t.default=s,e.exports=t.default},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(7),TimeoutError=function(e){function TimeoutError(t){void 0===t&&(t="The asynchronous operation has timed out.");var n=e.call(this,t)||this;return n.message=t,n}return i.__extends(TimeoutError,e),TimeoutError}(r.default);t.default=TimeoutError},function(e,t){function n(){}function i(e,t,i){function o(){a.parentNode&&a.parentNode.removeChild(a),window[l]=n,u&&clearTimeout(u)}function s(){window[l]&&o()}"function"==typeof t&&(i=t,t={}),t||(t={});var a,u,c=t.prefix||"__jp",l=t.name||c+r++,d=t.param||"callback",f=null!=t.timeout?t.timeout:6e4,p=encodeURIComponent,g=document.getElementsByTagName("script")[0]||document.head;return f&&(u=setTimeout(function(){o(),i&&i(new Error("Timeout"))},f)),window[l]=function(e){o(),i&&i(null,e)},e+=(~e.indexOf("?")?"&":"?")+d+"="+p(l),e=e.replace("?&","?"),a=document.createElement("script"),a.src=e,g.parentNode.insertBefore(a,g),s}e.exports=i;var r=0},function(e,t,n){"use strict";function i(e){var t=arguments.length<=1||void 0===arguments[1]?"all":arguments[1];(0,o.default)(e);var n=s[t];return n&&n.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var r=n(61),o=function(e){return e&&e.__esModule?e:{default:e}}(r),s={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};e.exports=t.default},function(e,t,n){"use strict";function i(e){if("string"!=typeof e)throw new TypeError("This library (validator.js) validates strings only")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(7),PushNotSupportedError=function(e){function PushNotSupportedError(t){return e.call(this,"'"+t+"' is not a valid UUID")||this}return i.__extends(PushNotSupportedError,e),PushNotSupportedError}(r.default);t.default=PushNotSupportedError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.MissingAppId=0]="MissingAppId"}(i=t.OneSignalApiErrorKind||(t.OneSignalApiErrorKind={}));var s=function(e){function t(t){var n=this;switch(t){case i.MissingAppId:n=e.call(this,"The API call is missing an app ID.")||this}return n}return r.__extends(t,e),t}(o.default);t.OneSignalApiError=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e}();t.AppState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e}();t.ServiceWorkerState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(28),o=function(e){function t(){return e.call(this,".onesignal-bell-launcher-badge","onesignal-bell-launcher-badge-opened",null,"onesignal-bell-launcher-badge-active",null,"hidden")||this}return i.__extends(t,e),t.prototype.increment=function(){if(!isNaN(this.content)){var e=+this.content;e+=1,this.content=e.toString()}},t.prototype.show=function(){var t=e.prototype.show.call(this);return OneSignal.notifyButton.setCustomColorsIfSpecified(),t},t.prototype.decrement=function(){if(!isNaN(this.content)){var e=+this.content;e-=1,this.content=e>0?e.toString():""}},t}(r.default);t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(3),o=n(5),s=n(28),a=n(22),u=n(21),c=n(40),l=n(10),d=function(e){function t(t){var n=e.call(this,".onesignal-bell-launcher-button",null,null,"onesignal-bell-launcher-button-active",null,"shown","")||this;return n.bell=t,n.events={mouse:"bell.launcher.button.mouse"},n.element.addEventListener("touchstart",function(){n.onHovering(),n.onTap()},{passive:!0}),n.element.addEventListener("mouseenter",function(){n.onHovering()}),n.element.addEventListener("mouseleave",function(){n.onHovered()}),n.element.addEventListener("touchmove",function(){n.onHovered()},{passive:!0}),n.element.addEventListener("mousedown",function(){n.onTap()}),n.element.addEventListener("mouseup",function(){n.onEndTap()}),n.element.addEventListener("click",function(){n.onHovered(),n.onClick()}),n}return i.__extends(t,e),t.prototype.onHovering=function(){(u.default.isEmpty(this.events.mouse)||"out"===u.default.getLast(this.events.mouse))&&o.default.trigger(a.default.EVENTS.HOVERING),u.default.put(this.events.mouse,"over")},t.prototype.onHovered=function(){u.default.put(this.events.mouse,"out"),o.default.trigger(a.default.EVENTS.HOVERED)},t.prototype.onTap=function(){this.pulse(),this.activate(),this.bell.badge.activate()},t.prototype.onEndTap=function(){this.inactivate(),this.bell.badge.inactivate()},t.prototype.onClick=function(){var e=this;if(o.default.trigger(a.default.EVENTS.BELL_CLICK),o.default.trigger(a.default.EVENTS.LAUNCHER_CLICK),!this.bell.message.shown||this.bell.message.contentType!=c.default.TYPES.MESSAGE){var t=u.default.getLast("subscription.optedOut");return this.bell.unsubscribed?t?this.bell.launcher.activateIfInactive().then(function(){e.bell.showDialogProcedure()}):(OneSignal.registerForPushNotifications(),this.bell._ignoreSubscriptionState=!0,OneSignal.once(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,function(){e.bell.message.display(c.default.TYPES.MESSAGE,e.bell.text["message.action.subscribed"],c.default.TIMEOUT).then(function(){e.bell._ignoreSubscriptionState=!1,e.bell.launcher.inactivate()})})):this.bell.subscribed?this.bell.launcher.activateIfInactive().then(function(){e.bell.showDialogProcedure()}):this.bell.blocked&&(l.default.isUsingSubscriptionWorkaround()?OneSignal.registerForPushNotifications():this.bell.launcher.activateIfInactive().then(function(){e.bell.showDialogProcedure()})),this.bell.message.hide()}},t.prototype.pulse=function(){r.removeDomElement(".pulse-ring"),r.addDomElement(this.element,"beforeend",'<div class="pulse-ring"></div>'),this.bell.setCustomColorsIfSpecified()},t}(s.default);t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(5),s=n(2),a=n(3),u=n(29),c=n(22),l=function(e){function t(t){var n=e.call(this,".onesignal-bell-launcher-dialog","onesignal-bell-launcher-dialog-opened",null,"hidden",["opacity","transform"],".onesignal-bell-launcher-dialog-body")||this;return n.bell=t,n.subscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #subscribe-button",n.unsubscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #unsubscribe-button",n.notificationIcons=null,n}return i.__extends(t,e),t.prototype.getPlatformNotificationIcon=function(){return this.notificationIcons?a.isChromeLikeBrowser()||r.firefox?this.notificationIcons.chrome||this.notificationIcons.safari:r.safari?this.notificationIcons.safari||this.notificationIcons.chrome:void 0:null},t.prototype.show=function(){var t=this;return this.updateBellLauncherDialogBody().then(function(){return e.prototype.show.call(t)})},Object.defineProperty(t.prototype,"subscribeButtonSelectorId",{get:function(){return"subscribe-button"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"unsubscribeButtonSelectorId",{get:function(){return"unsubscribe-button"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"subscribeButton",{get:function(){return this.element.querySelector("#"+this.subscribeButtonSelectorId)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"unsubscribeButton",{get:function(){return this.element.querySelector("#"+this.unsubscribeButtonSelectorId)},enumerable:!0,configurable:!0}),t.prototype.updateBellLauncherDialogBody=function(){var e=this;return OneSignal.getSubscription().then(function(t){a.clearDomElementChildren(document.querySelector(e.nestedContentSelector));var n="Nothing to show.",i="";if(e.bell.options.showCredit&&(i='<div class="divider"></div><div class="kickback">Powered by <a href="https://onesignal.com" class="kickback" target="_blank">OneSignal</a></div>'),e.bell.state===c.default.STATES.SUBSCRIBED&&!0===t||e.bell.state===c.default.STATES.UNSUBSCRIBED&&!1===t){var u="",l=e.getPlatformNotificationIcon();u=l?'<div class="push-notification-icon"><img src="'+l+'"></div>':'<div class="push-notification-icon push-notification-icon-default"></div>';var d="";d=e.bell.state!==c.default.STATES.SUBSCRIBED?'<button type="button" class="action" id="'+e.subscribeButtonSelectorId+'">'+e.bell.text["dialog.main.button.subscribe"]+"</button>":'<button type="button" class="action" id="'+e.unsubscribeButtonSelectorId+'">'+e.bell.text["dialog.main.button.unsubscribe"]+"</button>",n="<h1>"+e.bell.text["dialog.main.title"]+'</h1><div class="divider"></div><div class="push-notification">'+u+'<div class="push-notification-text-container"><div class="push-notification-text push-notification-text-short"></div><div class="push-notification-text"></div><div class="push-notification-text push-notification-text-medium"></div><div class="push-notification-text"></div><div class="push-notification-text push-notification-text-medium"></div></div></div><div class="action-container">'+d+"</div>"+i}else if(e.bell.state===c.default.STATES.BLOCKED){var l=null;r.chrome?r.mobile||r.tablet||(l=s.default.getOneSignalApiUrl().origin+"/bell/chrome-unblock.jpg"):r.firefox?l=s.default.getOneSignalApiUrl().origin+"/bell/firefox-unblock.jpg":r.safari&&(l=s.default.getOneSignalApiUrl().origin+"/bell/safari-unblock.jpg");var f="";l&&(f='<a href="'+l+'" target="_blank"><img src="'+l+'"></a></div>'),(r.mobile||r.tablet)&&r.chrome&&(f="<ol><li>Access <strong>Settings</strong> by tapping the three menu dots <strong>⋮</strong></li><li>Click <strong>Site settings</strong> under Advanced.</li><li>Click <strong>Notifications</strong>.</li><li>Find and click this entry for this website.</li><li>Click <strong>Notifications</strong> and set it to <strong>Allow</strong>.</li></ol>"),n="<h1>"+e.bell.text["dialog.blocked.title"]+'</h1><div class="divider"></div><div class="instructions"><p>'+e.bell.text["dialog.blocked.message"]+"</p>"+f+"</div>"+i}a.addDomElement(document.querySelector(e.nestedContentSelector),"beforeend",n),e.subscribeButton&&e.subscribeButton.addEventListener("click",function(){OneSignal.__doNotShowWelcomeNotification=!1,o.default.trigger(c.default.EVENTS.SUBSCRIBE_CLICK)}),e.unsubscribeButton&&e.unsubscribeButton.addEventListener("click",function(){return o.default.trigger(c.default.EVENTS.UNSUBSCRIBE_CLICK)}),e.bell.setCustomColorsIfSpecified()})},t}(u.default);t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(16),s=n(3),a=n(28),u=function(e){function t(t){var n=e.call(this,".onesignal-bell-launcher","onesignal-bell-launcher-active",null,null,"onesignal-bell-launcher-inactive","hidden","active")||this;return n.bell=t,n.wasInactive=!1,n}return i.__extends(t,e),t.prototype.resize=function(e){return i.__awaiter(this,void 0,void 0,function(){var t=this;return i.__generator(this,function(n){switch(n.label){case 0:if(!this.element)throw new o.InvalidStateError(o.InvalidStateReason.MissingDomElement);if("small"===e&&s.hasCssClass(this.element,"onesignal-bell-launcher-sm")||"medium"===e&&s.hasCssClass(this.element,"onesignal-bell-launcher-md")||"large"===e&&s.hasCssClass(this.element,"onesignal-bell-launcher-lg"))return[2,Promise.resolve(this)];if(s.removeCssClass(this.element,"onesignal-bell-launcher-sm"),s.removeCssClass(this.element,"onesignal-bell-launcher-md"),s.removeCssClass(this.element,"onesignal-bell-launcher-lg"),"small"===e)s.addCssClass(this.element,"onesignal-bell-launcher-sm");else if("medium"===e)s.addCssClass(this.element,"onesignal-bell-launcher-md");else{if("large"!==e)throw new Error("Invalid OneSignal bell size "+e);s.addCssClass(this.element,"onesignal-bell-launcher-lg")}return this.shown?[3,1]:[2,this];case 1:return[4,new Promise(function(e){if(0==t.targetTransitionEvents.length)return e(t);var n=setTimeout(function(){r.debug("Launcher did not completely resize (state: "+t.state+", activeState: "+t.activeState+").")},t.transitionCheckTimeout);s.once(t.element,"transitionend",function(i,r){if(i.target===t.element&&s.contains(t.targetTransitionEvents,i.propertyName))return clearTimeout(n),r(),e(t)},!0)})];case 2:return[2,n.sent()]}})})},t.prototype.activateIfInactive=function(){return this.inactive?(this.wasInactive=!0,this.activate()):s.nothing()},t.prototype.inactivateIfWasInactive=function(){return this.wasInactive?(this.wasInactive=!1,this.inactivate()):s.nothing()},t.prototype.clearIfWasInactive=function(){this.wasInactive=!1},t.prototype.inactivate=function(){var t=this;return this.bell.message.hide().then(function(){return t.bell.badge.content.length>0?t.bell.badge.hide().then(function(){return Promise.all([e.prototype.inactivate.call(t),t.resize("small")])}).then(function(){return t.bell.badge.show()}):Promise.all([e.prototype.inactivate.call(t),t.resize("small")])})},t.prototype.activate=function(){var t=this;return this.bell.badge.content.length>0?this.bell.badge.hide().then(function(){return Promise.all([e.prototype.activate.call(t),t.resize(t.bell.options.size)])}):Promise.all([e.prototype.activate.call(this),this.resize(this.bell.options.size)])},t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7);!function(e){e[e.Unknown=0]="Unknown",e[e.NoDeviceId=1]="NoDeviceId",e[e.OptedOut=2]="OptedOut"}(i=t.NotSubscribedReason||(t.NotSubscribedReason={}));var NotSubscribedError=function(e){function NotSubscribedError(t){var n=this;switch(t){case i.Unknown||i.NoDeviceId:n=e.call(this,"This operation can only be performed after the user is subscribed.")||this;break;case i.OptedOut:n=e.call(this,"The user has manually opted out of receiving of notifications. This operation can only be performed after the user is fully resubscribed.")||this}return n.reason=i[t],n}return r.__extends(NotSubscribedError,e),NotSubscribedError}(o.default);t.NotSubscribedError=NotSubscribedError},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(5),s=n(48),a=n(2),u=n(4),c=n(72),l=n(82),d=n(83),f=n(3),p=function(){function e(){}return e.initHttp=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:switch(r.debug("Called %cinitHttp("+JSON.stringify(e,null,4)+")",f.getConsoleStyle("code")),t=a.default.getWindowEnv()){case u.WindowEnvironmentKind.OneSignalProxyFrame:return[3,1];case u.WindowEnvironmentKind.OneSignalSubscriptionPopup:return[3,3];case u.WindowEnvironmentKind.OneSignalSubscriptionModal:return[3,5]}return[3,6];case 1:return OneSignal.proxyFrame=new c.default(e),[4,OneSignal.proxyFrame.initialize()];case 2:return n.sent(),s.default.ensureBackwardsCompatibility(OneSignal),[3,7];case 3:return OneSignal.subscriptionPopup=new d.default(e),[4,OneSignal.subscriptionPopup.initialize()];case 4:return n.sent(),s.default.ensureBackwardsCompatibility(OneSignal),o.default.trigger("httpInitialize"),[3,7];case 5:return OneSignal.subscriptionModal=new l.default(e),OneSignal.subscriptionModal.establishCrossOriginMessaging(),OneSignal.subscriptionModal.initialize(),s.default.ensureBackwardsCompatibility(OneSignal),o.default.trigger("httpInitialize"),[3,7];case 6:return r.error("Unsupported HTTP initialization branch."),[3,7];case 7:return[2]}})})},e}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(8),s=n(5),a=n(32),u=n(13),c=n(51),l=n(2),d=n(17),f=n(11),p=n(3),g=n(34),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),t.prototype.initialize=function(){var t=e.prototype.initialize.call(this);return s.default.trigger("httpInitialize"),t},t.prototype.establishCrossOriginMessaging=function(){this.messenger&&this.messenger.destroy(),this.messenger=new d.default(window,this.options.origin,this.options.origin),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,this.onProxyFrameInitializing.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,this.onRemoteNotificationPermission.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,this.onRemoteDatabaseGet.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,this.onRemoteDatabasePut.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,this.onRemoteDatabaseRemove.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,this.onUnsubscribeFromPush.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,this.onMarkPromptDismissed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,this.onIsSubscribed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,this.onUnsubscribeProxyFrame.bind(this)),this.messenger.listen()},t.prototype.retriggerRemoteEvent=function(e,t){this.messenger.message(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,{eventName:e,eventData:t})},t.prototype.onMessengerConnect=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return r.debug("("+l.default.getWindowEnv().toString()+") Successfully established cross-origin communication."),this.finishInitialization(),[2,!1]})})},t.prototype.onProxyFrameInitializing=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return r.info("("+l.default.getWindowEnv().toString()+") The iFrame has just received initOptions from the host page!"),OneSignal.config=o(e.data.hostInitOptions,OneSignal.config,{pageUrl:e.data.pageUrl,pageTitle:e.data.pageTitle}),a.default.installNativePromptPermissionChangedHook(),[4,f.default.get("Options","defaultUrl")];case 1:return t=n.sent(),t?[3,3]:[4,f.default.put("Options",{key:"defaultUrl",value:new URL(OneSignal.config.pageUrl).origin})];case 2:n.sent(),n.label=3;case 3:return[4,f.default.put("Options",{key:"lastKnownHostUrl",value:OneSignal.config.pageUrl})];case 4:return n.sent(),[4,a.default.initSaveState(OneSignal.config.pageTitle)];case 5:return n.sent(),[4,a.default.storeInitialValues()];case 6:return n.sent(),[4,a.default.saveInitOptions()];case 7:if(n.sent(),navigator.serviceWorker&&"https:"===window.location.protocol)try{u.default.establishServiceWorkerChannel()}catch(e){r.error("Error interacting with Service Worker inside an HTTP-hosted iFrame:",e)}return e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[2]}})})},t.prototype.onRemoteNotificationPermission=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:return t=OneSignal.context,[4,t.permissionManager.getReportedNotificationPermission(t.appConfig.safariWebId)];case 1:return n=i.sent(),e.reply(n),[2,!1]}})})},t.prototype.onRemoteDatabaseGet=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s,a,u,c;return i.__generator(this,function(i){switch(i.label){case 0:for(t=e.data,n=[],r=0,o=t;r<o.length;r++)s=o[r],a=s.table,u=s.key,n.push(f.default.get(a,u));return[4,Promise.all(n)];case 1:return c=i.sent(),e.reply(c),[2,!1]}})})},t.prototype.onRemoteDatabasePut=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s,a,u;return i.__generator(this,function(i){switch(i.label){case 0:for(t=e.data,n=[],r=0,o=t;r<o.length;r++)s=o[r],a=s.table,u=s.keypath,n.push(f.default.put(a,u));return[4,Promise.all(n)];case 1:return i.sent(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[2,!1]}})})},t.prototype.onRemoteDatabaseRemove=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s,a,u;return i.__generator(this,function(i){switch(i.label){case 0:for(t=e.data,n=[],r=0,o=t;r<o.length;r++)s=o[r],a=s.table,u=s.keypath,n.push(f.default.remove(a,u));return[4,Promise.all(n)];case 1:return i.sent(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[2,!1]}})})},t.prototype.onUnsubscribeFromPush=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:r.debug("(Reposted from iFrame -> Host) User unsubscribed but permission granted. Re-prompting the user for push."),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,p.unsubscribeFromPush()];case 2:return n.sent(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[3,4];case 3:return t=n.sent(),r.debug("Failed to unsubscribe from push remotely:",t),[3,4];case 4:return[2]}})})},t.prototype.onMarkPromptDismissed=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){return r.debug("(Reposted from iFrame -> Host) Marking prompt as dismissed."),c.default.markHttpsNativePromptDismissed(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[2,!1]})})},t.prototype.onIsSubscribed=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,OneSignal.isPushNotificationsEnabled()];case 1:return t=n.sent(),e.reply(t),[2,!1]}})})},t.prototype.onUnsubscribeProxyFrame=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,OneSignal.isPushNotificationsEnabled()];case 1:return t=n.sent(),t?[4,OneSignal.setSubscription(!1)]:[3,4];case 2:return n.sent(),[4,OneSignal.database.rebuild()];case 3:n.sent(),n.label=4;case 4:return e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),[2,!1]}})})},t}(g.default);t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(5),s=n(13),a=n(10),u=n(2),c=n(17),l=function(){function e(e,t){this.appId=e,this.registrationOptions=t}return e.prototype.load=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,OneSignal.isPushNotificationsEnabled()];case 1:return e=n.sent(),[4,OneSignal.getNotificationPermission()];case 2:return t=n.sent(),this.url=u.default.getOneSignalApiUrl(),this.url.pathname="webPushModal",this.url.search=s.default.getPromptOptionsQueryString()+"&id="+this.appId.value+"&httpsPrompt=true&pushEnabled="+e+"&permissionBlocked="+("denied"===t)+"&promptType=modal",r.info("Loading iFrame for HTTPS subscription modal at "+this.url.toString()),this.modal=this.createHiddenSubscriptionDomModal(this.url.toString()),this.establishCrossOriginMessaging(),[2]}})})},e.prototype.createHiddenSubscriptionDomModal=function(e){var t=document.createElement("div");t.setAttribute("id","OneSignal-iframe-modal"),t.setAttribute("style","display:none !important"),t.innerHTML='<div id="notif-permission" style="background: rgba(0, 0, 0, 0.7); position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 3000000000; display: flex; align-items: center; justify-content: center;"></div>',document.body.appendChild(t);var n=document.createElement("style");n.innerHTML="@media (max-width: 560px) { .OneSignal-permission-iframe { width: 100%; height: 100%;} }",document.getElementsByTagName("head")[0].appendChild(n);var i=document.createElement("iframe");return i.className="OneSignal-permission-iframe",i.setAttribute("frameborder","0"),i.width=OneSignal._windowWidth.toString(),i.height=OneSignal._windowHeight.toString(),i.src=e,document.getElementById("notif-permission").appendChild(i),i},e.prototype.removeFrame=function(){var e=document.querySelector("#OneSignal-iframe-modal");e&&e.remove()},e.prototype.showSubscriptionDomModal=function(){document.getElementById("OneSignal-iframe-modal").setAttribute("style","")},e.prototype.establishCrossOriginMessaging=function(){this.messenger=new c.default(this.modal,this.url.origin,this.url.origin),this.messenger.startPostMessageReceive(),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_LOADED,this.onModalLoaded.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_PROMPT_ACCEPTED,this.onModalAccepted.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.MODAL_PROMPT_REJECTED,this.onModalRejected.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_CLOSING,this.onModalClosing.bind(this))},e.prototype.onModalLoaded=function(e){this.showSubscriptionDomModal(),o.default.trigger("modalLoaded")},e.prototype.onModalAccepted=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return r.debug("User accepted the HTTPS modal prompt.",location.origin),OneSignal._sessionInitAlreadyRunning=!1,this.dispose(),s.default.triggerCustomPromptClicked("granted"),r.debug("Calling setSubscription(true)"),[4,a.default.registerForPush()];case 1:return e.sent(),[4,OneSignal.setSubscription(!0)];case 2:return e.sent(),[2]}})})},e.prototype.onModalRejected=function(e){r.debug("User rejected the HTTPS modal prompt."),OneSignal._sessionInitAlreadyRunning=!1,this.dispose(),s.default.triggerCustomPromptClicked("denied")},e.prototype.onModalClosing=function(e){r.info("Detected modal is closing."),this.dispose()},e.prototype.dispose=function(){this.messenger&&this.messenger.destroy(),this.removeFrame()},e.prototype.message=function(){this.messenger.message.apply(this.messenger,arguments)},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e.Mobile="mobile",e.Tablet="tablet",e.Desktop="desktop"}(t.DevicePlatformKind||(t.DevicePlatformKind={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(1),s=n(16),a=n(14),u=n(14),c=n(31),l=n(52),d=n(52),f=n(5),p=n(15),g=n(76),h=n(20),v=n(33),m=n(77),b=n(78),S=n(4),w=n(19),_=n(11),y=n(2),O=n(26),E=n(50),P=n(53),I=function(){function e(e,t){this.context=e,this.config=t}return e.prototype.isSafari=function(){return r.safari&&void 0!==window.safari&&void 0!==window.safari.pushNotification},e.prototype.subscribe=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n;return i.__generator(this,function(i){switch(i.label){case 0:switch(e=y.default.getWindowEnv()){case S.WindowEnvironmentKind.CustomIframe:case S.WindowEnvironmentKind.Unknown:case S.WindowEnvironmentKind.OneSignalSubscriptionModal:case S.WindowEnvironmentKind.OneSignalSubscriptionPopup:case S.WindowEnvironmentKind.OneSignalProxyFrame:throw new s.InvalidStateError(s.InvalidStateReason.UnsupportedEnvironment)}switch(n=e){case S.WindowEnvironmentKind.ServiceWorker:return[3,1];case S.WindowEnvironmentKind.Host:return[3,3]}return[3,9];case 1:return[4,this.subscribeFcmFromWorker()];case 2:return t=i.sent(),[3,9];case 3:return[4,OneSignal.getNotificationPermission()];case 4:if(i.sent()===h.NotificationPermission.Denied)throw new a.default(u.PushPermissionNotGrantedErrorReason.Blocked);return this.isSafari()?[4,this.subscribeSafari()]:[3,6];case 5:return t=i.sent(),[3,8];case 6:return[4,this.subscribeFcmFromPage()];case 7:t=i.sent(),i.label=8;case 8:return[3,9];case 9:return[2,this.registerSubscriptionWithOneSignal(t)]}})})},e.prototype.subscribePartially=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){switch(e.label){case 0:return[4,this.subscribeFcmFromPage()];case 1:return[2,e.sent()]}})})},e.prototype.requestPresubscribeNotificationPermission=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){return[2,e.requestNotificationPermission()]})})},e.prototype.unsubscribe=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:if(0!==e)return[3,1];throw new E.default;case 1:return 1!==e?[3,7]:y.default.getWindowEnv()!==S.WindowEnvironmentKind.ServiceWorker?[3,5]:[4,_.default.getSubscription()];case 2:return t=n.sent().deviceId,[4,w.default.updatePlayer(this.context.appConfig.appId,t,{notification_types:b.SubscriptionStateKind.MutedByApi})];case 3:return n.sent(),[4,_.default.put("Options",{key:"optedOut",value:!0})];case 4:return n.sent(),[3,6];case 5:throw new E.default;case 6:return[3,8];case 7:throw new E.default;case 8:return[2]}})})},e.requestNotificationPermission=function(){return new Promise(function(e){return window.Notification.requestPermission(e)})},e.prototype.registerSubscriptionWithOneSignal=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,s,a,u;return i.__generator(this,function(i){switch(i.label){case 0:return t=new v.PushRegistration,t.appId=this.config.appId,this.isSafari()?t.deliveryPlatform=g.DeliveryPlatformKind.Safari:r.firefox?t.deliveryPlatform=g.DeliveryPlatformKind.Firefox:t.deliveryPlatform=g.DeliveryPlatformKind.ChromeLike,t.subscriptionState=b.SubscriptionStateKind.Subscribed,e=m.RawPushSubscription.deserialize(e),t.subscription=e,[4,this.isAlreadyRegisteredWithOneSignal()];case 1:return i.sent()?[4,_.default.getSubscription()]:[3,6];case 2:return s=i.sent().deviceId,e.isNewSubscription()?[4,w.default.updateUserSession(s,t)]:[3,4];case 3:return n=i.sent(),o.info("Updated the subscriber's OneSignal session:",t),[3,5];case 4:n=s,o.debug("The existing push subscription was resubscribed, but not registering with OneSignal because the new subscription is identical."),i.label=5;case 5:return[3,8];case 6:return[4,w.default.createUser(t)];case 7:a=i.sent(),n=a,o.info("Subscribed to web push and registered with OneSignal:",t),i.label=8;case 8:return y.default.getWindowEnv()!==S.WindowEnvironmentKind.ServiceWorker&&f.default.trigger(OneSignal.EVENTS.REGISTERED),u=new O.Subscription,u.deviceId=n,u.optedOut=!1,this.isSafari()?u.subscriptionToken=e.safariDeviceToken:u.subscriptionToken=e.w3cEndpoint.toString(),[4,_.default.setSubscription(u)];case 9:return i.sent(),[2,u]}})})},e.prototype.isAlreadyRegisteredWithOneSignal=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:return[4,_.default.getSubscription()];case 1:return e=t.sent().deviceId,[2,!!e.value]}})})},e.prototype.subscribeSafariPromptPermission=function(){var e=this;return new Promise(function(t){window.safari.pushNotification.requestPermission(y.default.getOneSignalApiUrl().toString()+"/safari",e.config.safariWebId,{app_id:e.config.appId.value},function(e){t(e.deviceToken?e.deviceToken.toLowerCase():null)})})},e.prototype.subscribeSafari=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n;return i.__generator(this,function(i){switch(i.label){case 0:if(e=new m.RawPushSubscription,!this.config.safariWebId)throw new c.SdkInitError(c.SdkInitErrorKind.MissingSafariWebId);return t=window.safari.pushNotification.permission(this.config.safariWebId).deviceToken,e.existingSafariDeviceToken=t,t||f.default.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED),[4,this.subscribeSafariPromptPermission()];case 1:if(n=i.sent(),p.default.triggerNotificationPermissionChanged(),!n)throw new l.default(d.SubscriptionErrorReason.InvalidSafariSetup);return e.setFromSafariSubscription(n),[2,e]}})})},e.prototype.subscribeFcmFromPage=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t;return i.__generator(this,function(n){switch(n.label){case 0:return y.default.getWindowEnv()===S.WindowEnvironmentKind.ServiceWorker||window.Notification.permission!==h.NotificationPermission.Default?[3,2]:(f.default.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED),[4,this.requestPresubscribeNotificationPermission()]);case 1:switch(e=n.sent(),e===h.NotificationPermission.Default&&p.default.triggerNotificationPermissionChanged(!0),e){case h.NotificationPermission.Default:throw o.debug("Exiting subscription and not registering worker because the permission was dismissed."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new a.default(u.PushPermissionNotGrantedErrorReason.Dismissed);case h.NotificationPermission.Denied:throw o.debug("Exiting subscription and not registering worker because the permission was blocked."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new a.default(u.PushPermissionNotGrantedErrorReason.Blocked)}n.label=2;case 2:return[4,this.context.serviceWorkerManager.shouldInstallWorker()];case 3:return n.sent()?[4,this.context.serviceWorkerManager.installWorker()]:[3,5];case 4:n.sent(),n.label=5;case 5:return o.debug("Waiting for the service worker to activate..."),[4,navigator.serviceWorker.ready];case 6:return t=n.sent(),o.debug("Service worker is ready to continue subscribing."),[4,this.subscribeFcmVapidOrLegacyKey(t)];case 7:return[2,n.sent()]}})})},e.prototype.subscribeFcmFromWorker=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:if(!self.registration.active&&!r.firefox)throw new s.InvalidStateError(s.InvalidStateReason.ServiceWorkerNotActivated);return[4,self.registration.pushManager.permissionState({userVisibleOnly:!0})];case 1:if("denied"===(e=t.sent()))throw OneSignal._sessionInitAlreadyRunning=!1,new a.default(u.PushPermissionNotGrantedErrorReason.Blocked);if("prompt"===e)throw OneSignal._sessionInitAlreadyRunning=!1,new a.default(u.PushPermissionNotGrantedErrorReason.Default);return[4,this.subscribeFcmVapidOrLegacyKey(self.registration)];case 2:return[2,t.sent()]}})})},e.prototype.getVapidKeyForBrowser=function(){var e=void 0;return e=r.firefox?this.config.onesignalVapidPublicKey:this.config.vapidPublicKey,e?P.base64ToUint8Array(e).buffer:void 0},e.prototype.subscribeFcmVapidOrLegacyKey=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return t={userVisibleOnly:!0,applicationServerKey:this.getVapidKeyForBrowser()?this.getVapidKeyForBrowser():void 0},[4,e.pushManager.getSubscription()];case 1:return(r=i.sent())&&r.options?(o.debug("[Subscription Manager] An existing push subscription exists and options is not null. Using existing options to resubscribe."),t=r.options,[3,4]):[3,2];case 2:return!r||r.options?[3,4]:(o.debug("[Subscription Manager] An existing push subscription exists and options is null. Unsubscribing from push first now."),[4,r.unsubscribe()]);case 3:i.sent(),i.label=4;case 4:return o.debug("[Subscription Manager] Subscribing to web push with these options:",t),[4,e.pushManager.subscribe(t)];case 5:return n=i.sent(),s=new m.RawPushSubscription,s.setFromW3cSubscription(n),r&&(s.existingW3cPushSubscription=new m.RawPushSubscription,s.existingW3cPushSubscription.setFromW3cSubscription(r)),[2,s]}})})},e}();t.SubscriptionManager=I},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.ChromeLike=5]="ChromeLike",e[e.Safari=7]="Safari",e[e.Firefox=8]="Firefox"}(t.DeliveryPlatformKind||(t.DeliveryPlatformKind={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.prototype.isNewSubscription=function(){return this.existingW3cPushSubscription?this.existingW3cPushSubscription.w3cEndpoint.toString()!==this.w3cEndpoint.toString()||this.existingW3cPushSubscription.w3cP256dh!==this.w3cP256dh||this.existingW3cPushSubscription.w3cAuth!==this.w3cAuth:!this.existingSafariDeviceToken||this.existingSafariDeviceToken!==this.safariDeviceToken},e.prototype.setFromW3cSubscription=function(e){if(e&&(this.w3cEndpoint=new URL(e.endpoint),e.getKey)){var t=null;try{t=e.getKey("p256dh")}catch(e){}var n=null;try{n=e.getKey("auth")}catch(e){}if(t){var i=btoa(String.fromCharCode.apply(null,new Uint8Array(t)));this.w3cP256dh=i}if(n){var r=btoa(String.fromCharCode.apply(null,new Uint8Array(n)));this.w3cAuth=r}}},e.prototype.setFromSafariSubscription=function(e){this.safariDeviceToken=e},e.prototype.serialize=function(){return{w3cEndpoint:this.w3cEndpoint.toString(),w3cP256dh:this.w3cP256dh,w3cAuth:this.w3cAuth,safariDeviceToken:this.safariDeviceToken,existingPushSubscription:this.existingW3cPushSubscription?this.existingW3cPushSubscription.serialize():null,existingSafariDeviceToken:this.existingSafariDeviceToken}},e.deserialize=function(t){var n=new e;try{n.w3cEndpoint=new URL(t.w3cEndpoint)}catch(e){}return n.w3cP256dh=t.w3cP256dh,n.w3cAuth=t.w3cAuth,n.existingW3cPushSubscription=t.existingPushSubscription?e.deserialize(t.existingPushSubscription):null,n.safariDeviceToken=t.safariDeviceToken,n.existingSafariDeviceToken=t.existingSafariDeviceToken,n},e}();t.RawPushSubscription=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});!function(e){e[e.Subscribed=1]="Subscribed",e[e.MutedByApi=-2]="MutedByApi",e[e.MutedByUser=-3]="MutedByUser"}(t.SubscriptionStateKind||(t.SubscriptionStateKind={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=function(){function e(e){this.isFeatureEnabled=e}return Object.defineProperty(e,"SYNC_URL",{get:function(){return"https://rc.rlcdn.com/463096.gif?n=5"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DOM_ID",{get:function(){return"onesignal-cookie-sync"},enumerable:!0,configurable:!0}),e.prototype.getElement=function(){return document.getElementById(e.DOM_ID)},e.prototype.uninstall=function(){this.getElement()&&this.getElement().remove()},e.prototype.install=function(){if(!this.isFeatureEnabled)return void i.debug("Cookie sync feature is disabled.");this.uninstall();var t=document.createElement("img");t.setAttribute("id",e.DOM_ID),t.setAttribute("border","0"),t.setAttribute("hspace","0"),t.setAttribute("vspace","0"),t.setAttribute("width","1"),t.setAttribute("height","1"),t.setAttribute("src",e.SYNC_URL),document.querySelector("body").appendChild(t),i.debug("Enabled cookie sync feature.")},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=n(2),o=n(4),s=function(){function e(){}return e.prototype.getPageViewCount=function(){try{var t=sessionStorage.getItem(e.SESSION_STORAGE_KEY_NAME),n=parseInt(t);return isNaN(n)?0:n}catch(e){return 0}},e.prototype.setPageViewCount=function(t){try{sessionStorage.setItem(e.SESSION_STORAGE_KEY_NAME,t.toString()),r.default.getWindowEnv()===o.WindowEnvironmentKind.OneSignalSubscriptionPopup&&OneSignal.subscriptionPopup&&OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT)}catch(e){}},e.prototype.incrementPageViewCount=function(){if(!this.incrementedPageViewCount){var e=this.getPageViewCount()+1;this.setPageViewCount(e),i.debug("Incremented page view count to "+e+"."),this.incrementedPageViewCount=!0}},e.prototype.simulatePageNavigationOrRefresh=function(){this.incrementedPageViewCount=!1},e.prototype.isFirstPageView=function(){return 1===this.getPageViewCount()},e.SESSION_STORAGE_KEY_NAME="onesignal-pageview-count",e}();t.SessionManager=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(3),o=n(10),s=n(9),a=n(18),u=n(11),c=n(20),l=function(){function e(){}return Object.defineProperty(e,"STORED_PERMISSION_KEY",{get:function(){return"storedNotificationPermission"},enumerable:!0,configurable:!0}),e.prototype.getNotificationPermission=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return[4,this.getReportedNotificationPermission(e)];case 1:return t=n.sent(),[4,this.isPermissionEnvironmentAmbiguous(t)];case 2:return n.sent()?[2,this.getInterpretedAmbiguousPermission(t)]:[2,t]}})})},e.prototype.getReportedNotificationPermission=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return s.safari?[2,this.getSafariNotificationPermission(e)]:[3,1];case 1:return[4,o.default.isUsingSubscriptionWorkaround()];case 2:return t=n.sent(),t?[4,r.awaitOneSignalInitAndSupported()]:[3,4];case 3:return n.sent(),[2,this.getOneSignalSubdomainNotificationPermission(e)];case 4:return[2,this.getW3cNotificationPermission()]}})})},e.prototype.getSafariNotificationPermission=function(e){if(e)return window.safari.pushNotification.permission(e).permission;throw new a.InvalidArgumentError("safariWebId",a.InvalidArgumentReason.Empty)},e.prototype.getW3cNotificationPermission=function(){return window.Notification.permission},e.prototype.getOneSignalSubdomainNotificationPermission=function(e){return new Promise(function(t){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,{safariWebId:e},function(e){var n=e.data;t(n)})})},e.prototype.isPermissionEnvironmentAmbiguous=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,s;return i.__generator(this,function(i){switch(i.label){case 0:return t=r.redetectBrowserUserAgent(),(n=!t.safari&&!t.firefox&&e===c.NotificationPermission.Denied)?(s=this.isCurrentFrameContextCrossOrigin(),s?[3,2]:[4,o.default.hasInsecureParentOrigin()]):[3,3];case 1:s=i.sent(),i.label=2;case 2:n=s||o.default.isInsecureOrigin(),i.label=3;case 3:return[2,n]}})})},e.prototype.isCurrentFrameContextCrossOrigin=function(){var e;try{e=window.top.location.origin}catch(e){return!0}return window.top!==window&&e!==window.location.origin},e.prototype.getInterpretedAmbiguousPermission=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){switch(i.label){case 0:switch(t=e){case c.NotificationPermission.Denied:return[3,1]}return[3,3];case 1:return[4,this.getStoredPermission()];case 2:return n=i.sent(),n?[2,n]:[2,c.NotificationPermission.Default];case 3:return[2,e]}})})},e.prototype.getStoredPermission=function(){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(t){switch(t.label){case 0:return[4,u.default.get("Options",e.STORED_PERMISSION_KEY)];case 1:return[2,t.sent()]}})})},e.prototype.setStoredPermission=function(t){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(n){switch(n.label){case 0:return[4,u.default.put("Options",{key:e.STORED_PERMISSION_KEY,value:t})];case 1:return n.sent(),[2]}})})},e.prototype.updateStoredPermission=function(){return i.__awaiter(this,void 0,void 0,function(){var e;return i.__generator(this,function(t){switch(t.label){case 0:return[4,this.getNotificationPermission(null)];case 1:return e=t.sent(),[4,this.setStoredPermission(e)];case 2:return[2,t.sent()]}})})},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(17),o=n(34),s=function(e){function t(t){return e.call(this,t)||this}return i.__extends(t,e),t.prototype.establishCrossOriginMessaging=function(){this.messenger&&this.messenger.destroy(),this.messenger=new r.default(window.parent,this.options.origin,this.options.origin)},t}(o.default);t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(2),s=n(17),a=n(34),u=function(e){function t(t){return e.call(this,t)||this}return i.__extends(t,e),t.prototype.establishCrossOriginMessaging=function(){this.messenger=new s.default(window.opener,this.options.origin,this.options.origin),this.messenger.once(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnected.bind(this)),this.messenger.postMessage(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,null),this.messenger.listen()},t.prototype.onMessengerConnected=function(e){r.debug("("+o.default.getWindowEnv().toString()+") The host page is now ready to receive commands from the HTTP popup."),this.finishInitialization()},t}(a.default);t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(24),o=n(85),s=n(3),a=n(2),u=function(){function e(){}return e.discoverAltOrigin=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,r,a,u,c,l,d,f,p,g,d;return i.__generator(this,function(i){switch(i.label){case 0:n=e.getOneSignalProxyIframeUrls(t),r=[],u=0,c=n,i.label=1;case 1:return u<c.length?(l=c[u],d=new o.default(l),[4,d.load()]):[3,4];case 2:i.sent(),r.push(d),i.label=3;case 3:return u++,[3,1];case 4:return[4,e.removeDuplicatedAltOriginSubscription(r)];case 5:return(f=i.sent())?(a=f[0],[3,10]):[3,6];case 6:p=0,g=r,i.label=7;case 7:return p<g.length?(d=g[p],[4,d.isSubscribed()]):[3,10];case 8:if(i.sent())a=d;else{if(!s.contains(d.url.host,".os.tc"))return d.dispose(),[3,9];a?d.dispose():a=d}i.label=9;case 9:return p++,[3,7];case 10:return[2,a]}})})},e.removeDuplicatedAltOriginSubscription=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,o,u,c,c,l,d;return i.__generator(this,function(i){switch(i.label){case 0:t=[],n=0,o=e,i.label=1;case 1:return n<o.length?(u=o[n],[4,u.isSubscribed()]):[3,4];case 2:i.sent()&&t.push(u),i.label=3;case 3:return n++,[3,1];case 4:return t.length<2?[2,null]:(a.default.getBuildEnv()==r.BuildEnvironmentKind.Development?c=".localhost:3001":a.default.getBuildEnv()==r.BuildEnvironmentKind.Production&&(c=".onesignal.com"),l=t.find(function(e){return s.contains(e.url.host,c)}),l?[3,5]:[2,null]);case 5:return[4,l.unsubscribeFromPush()];case 6:return i.sent(),l.dispose(),d=e.indexOf(l),e.splice(d,1),[2,e]}})})},e.getCanonicalSubscriptionUrls=function(e,t){void 0===t&&(t=a.default.getBuildEnv());var n=[];if(e.httpUseOneSignalCom){var i=a.default.getOneSignalApiUrl(t);i.host=[e.subdomain,i.host].join("."),n.push(i)}var r=a.default.getOneSignalApiUrl(t);r.host=[e.subdomain,"os.tc"].join("."),n.push(r);for(var o=0,s=n;o<s.length;o++){s[o].pathname=""}return n},e.getOneSignalProxyIframeUrls=function(t){for(var n=e.getCanonicalSubscriptionUrls(t),i=0,r=n;i<r.length;i++){r[i].pathname="webPushIframe"}return n},e.getOneSignalSubscriptionPopupUrls=function(t){for(var n=e.getCanonicalSubscriptionUrls(t),i=0,r=n;i<r.length;i++){r[i].pathname="subscribe"}return n},e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(6),s=n(5),a=n(15),u=n(17),c=n(3),l=function(){function e(e){this.url=e,this.url.pathname="webPushIframe"}return Object.defineProperty(e,"LOAD_TIMEOUT_MS",{get:function(){return 15e3},enumerable:!0,configurable:!0}),e.prototype.load=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n=this;return i.__generator(this,function(i){return r.debug("Opening an iFrame to",this.url.toString()),this.removeFrame(),t=document.createElement("iframe"),t.style.display="none",t.src=this.url.toString(),t.sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation",this.loadPromise={},this.loadPromise.promise=new Promise(function(e,t){n.loadPromise.resolver=e,n.loadPromise.rejector=t}),document.body.appendChild(t),t.onload=this.onFrameLoad.bind(this),this.element=t,c.timeoutPromise(this.loadPromise.promise,e.LOAD_TIMEOUT_MS).catch(function(){window===window.top&&r.warn("OneSignal: Loading the required iFrame "+n.url.toString()+" timed out. Check that the Site URL onesignal.com dashboard web config is "+location.origin+". Only the Site URL specified there is allowed to use load the iFrame.")}),[2,this.loadPromise.promise]})})},e.prototype.removeFrame=function(){if(o.default.isBrowser()){var e=document.querySelector("iFrame[src='"+this.url.toString()+"'");e&&e.remove()}},e.prototype.onFrameLoad=function(e){this.establishCrossOriginMessaging()},e.prototype.establishCrossOriginMessaging=function(){this.messenger&&this.messenger.destroy(),this.messenger=new u.default(this.element.contentWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,this.onRemoteNotificationPermissionChanged.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REQUEST_HOST_URL,this.onRequestHostUrl.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,this.onServiceWorkerCommandRedirect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,this.onGetEventListenerCount.bind(this)),this.messenger.connect()},e.prototype.dispose=function(){this.messenger&&this.messenger.destroy(),this.removeFrame()},e.prototype.onMessengerConnect=function(e){return i.__awaiter(this,void 0,void 0,function(){var e=this;return i.__generator(this,function(t){return r.debug("Successfully established cross-origin communication for iFrame at "+this.url.toString()),this.messenger.message(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,{hostInitOptions:JSON.parse(JSON.stringify(OneSignal.config)),pageUrl:window.location.href,pageTitle:document.title},function(t){return t.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE&&e.loadPromise.resolver(),!1}),[2]})})},e.prototype.onRemoteRetriggerEvent=function(e){var t=e.data,n=t.eventName,i=t.eventData;return s.default.trigger(n,i,e.source),!1},e.prototype.onRemoteNotificationPermissionChanged=function(e){var t=e.data.forceUpdatePermission;return a.default.triggerNotificationPermissionChanged(t),!1},e.prototype.onRequestHostUrl=function(e){return e.reply(location.href),!1},e.prototype.onServiceWorkerCommandRedirect=function(e){return window.location.href=e.data,!1},e.prototype.onGetEventListenerCount=function(e){var t=e.data;r.debug("(Reposted from iFrame -> Host) Getting event listener count for ",t);var n=OneSignal.getListeners(t).length;return e.reply(n),!1},e.prototype.isSubscribed=function(){var e=this;return new Promise(function(t){e.messenger.message(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,null,function(e){t(e.data)})})},e.prototype.unsubscribeFromPush=function(){var e=this;return new Promise(function(t){e.messenger.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,null,function(e){t()})})},e.prototype.message=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.messenger.message.apply(this.messenger,arguments)},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(1),o=n(8),s=n(5),a=n(15),u=n(13),c=n(2),l=n(17),d=function(){function e(e,t){this.url=e,this.url.pathname="subscribe",this.options=t||{autoAccept:!1}}return e.prototype.load=function(){var e=this,t=o({},u.default.getPromptOptionsPostHash(),{promptType:"popup",parentHostname:encodeURIComponent(location.hostname)});return this.options.autoAccept&&(t.autoAccept=!0),r.info("Opening a popup to "+this.url.toString()+" with POST data:",t),this.popupWindow=this.openWindowViaPost(this.url.toString(),t,null),this.establishCrossOriginMessaging(),this.loadPromise={},this.loadPromise.promise=new Promise(function(t,n){e.loadPromise.resolver=t,e.loadPromise.rejector=n}),this.loadPromise.promise},e.prototype.openWindowViaPost=function(e,t,n){var i=document.createElement("form");i.action=e,i.method="POST",i.target="onesignal-http-popup";var r=void 0!=window.screenLeft?window.screenLeft:screen.left,o=void 0!=window.screenTop?window.screenTop:screen.top,s=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,u=OneSignal._windowWidth,c=OneSignal._windowHeight,l=s/2-u/2+r,d=a/2-c/2+o;n&&(n.childWidth&&(u=n.childWidth),n.childHeight&&(c=n.childHeight),n.left&&(l=n.left),n.top&&(d=n.top));var f=window.open("about:blank","onesignal-http-popup","'scrollbars=yes, width="+u+", height="+c+", top="+d+", left="+l);if(t)for(var p in t){var g=document.createElement("textarea");g.name=p,g.value="object"==typeof t[p]?JSON.stringify(t[p]):t[p],i.appendChild(g)}return i.style.display="none",document.body.appendChild(i),i.submit(),document.body.removeChild(i),f},e.prototype.establishCrossOriginMessaging=function(){this.messenger=new l.default(this.popupWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,this.onBeginMessagePortCommunications.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_LOADED,this.onPopupLoaded.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_ACCEPTED,this.onPopupAccepted.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_REJECTED,this.onPopupRejected.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_CLOSING,this.onPopupClosing.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT,this.onSetSessionCount.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.WINDOW_TIMEOUT,this.onWindowTimeout.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.FINISH_REMOTE_REGISTRATION,this.onFinishingRegistrationRemotely.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.startPostMessageReceive()},e.prototype.dispose=function(){this.messenger.destroy()},e.prototype.onBeginMessagePortCommunications=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return r.debug("("+c.default.getWindowEnv().toString()+") Successfully established cross-origin messaging with the popup window."),this.messenger.connect(),[2,!1]})})},e.prototype.onPopupLoaded=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return this.loadPromise.resolver(),s.default.trigger("popupLoad"),[2]})})},e.prototype.onPopupAccepted=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return u.default.triggerCustomPromptClicked("granted"),[2]})})},e.prototype.onPopupRejected=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return u.default.triggerCustomPromptClicked("denied"),[2]})})},e.prototype.onPopupClosing=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return r.info("Popup window is closing, running cleanup events."),s.default.trigger(OneSignal.EVENTS.POPUP_CLOSING),this.dispose(),[2]})})},e.prototype.onSetSessionCount=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n;return i.__generator(this,function(i){return r.debug(c.default.getWindowEnv().toString()+" Marking current session as a continuing browsing session."),t=e.data.sessionCount,n=OneSignal.context,n.sessionManager.setPageViewCount(t),[2]})})},e.prototype.onWindowTimeout=function(e){return i.__awaiter(this,void 0,void 0,function(){return i.__generator(this,function(e){return r.debug(c.default.getWindowEnv().toString()+" Popup window timed out and was closed."),s.default.trigger(OneSignal.EVENTS.POPUP_WINDOW_TIMEOUT),[2]})})},e.prototype.onFinishingRegistrationRemotely=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,o,s;return i.__generator(this,function(i){switch(i.label){case 0:return r.debug(location.origin,c.default.getWindowEnv().toString()+" Finishing HTTP popup registration inside the iFrame, sent from popup."),e.reply({progress:!0}),t=e.data.rawPushSubscription,[4,u.default.getAppId()];case 1:return n=i.sent(),this.messenger.stopPostMessageReceive(),o=OneSignal.context.subscriptionManager,[4,o.registerSubscriptionWithOneSignal(t)];case 2:return s=i.sent(),a.default.checkAndTriggerSubscriptionChanged(),u.default.checkAndTriggerNotificationPermissionChanged(),[2]}})})},e.prototype.onRemoteRetriggerEvent=function(e){var t=e.data,n=t.eventName,i=t.eventData;return s.default.trigger(n,i,e.source),!1},e.prototype.message=function(){this.messenger.message.apply(this.messenger,arguments)},e}();t.default=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(8),s=n(5),a=n(13),u=n(3),c=function(){function e(e){this.options=e?o({},e):{},this.options.actionMessage&&"string"==typeof this.options.actionMessage||(this.options.actionMessage="We'd like to show you notifications for the latest news and updates."),this.options.acceptButtonText&&"string"==typeof this.options.acceptButtonText||(this.options.acceptButtonText="Allow"),this.options.cancelButtonText&&"string"==typeof this.options.cancelButtonText||(this.options.cancelButtonText="No Thanks"),this.options.actionMessage=this.options.actionMessage.substring(0,90),this.options.acceptButtonText=this.options.acceptButtonText.substring(0,15),this.options.cancelButtonText=this.options.cancelButtonText.substring(0,15),this.notificationIcons=null}return Object.defineProperty(e,"EVENTS",{get:function(){return{ALLOW_CLICK:"popoverAllowClick",CANCEL_CLICK:"popoverCancelClick",SHOWN:"popoverShown",CLOSED:"popoverClosed"}},enumerable:!0,configurable:!0}),e.prototype.create=function(){return i.__awaiter(this,void 0,void 0,function(){var t,n,o,c;return i.__generator(this,function(i){switch(i.label){case 0:return null!==this.notificationIcons?[3,2]:[4,a.default.getNotificationIcons()];case 1:t=i.sent(),this.notificationIcons=t,this.container&&u.removeDomElement("#onesignal-popover-container"),n=this.getPlatformNotificationIcon(),o="data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%2239.5%22%20height%3D%2240.5%22%20viewBox%3D%220%200%2079%2081%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ctitle%3EOneSignal-Bell%3C%2Ftitle%3E%3Cg%20fill%3D%22%23BBB%22%20fill-rule%3D%22evenodd%22%3E%3Cpath%20d%3D%22M39.96%2067.12H4.12s-3.2-.32-3.2-3.36%202.72-3.2%202.72-3.2%2010.72-5.12%2010.72-8.8c0-3.68-1.76-6.24-1.76-21.28%200-15.04%209.6-26.56%2021.12-26.56%200%200%201.6-3.84%206.24-3.84%204.48%200%206.08%203.84%206.08%203.84%2011.52%200%2021.12%2011.52%2021.12%2026.56s-1.6%2017.6-1.6%2021.28c0%203.68%2010.72%208.8%2010.72%208.8s2.72.16%202.72%203.2c0%202.88-3.36%203.36-3.36%203.36H39.96zM27%2070.8h24s-1.655%2010.08-11.917%2010.08S27%2070.8%2027%2070.8z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E",c='<div id="normal-popover"><div class="popover-body"><div class="popover-body-icon"><img class="'+("default-icon"===n?"default-icon":"")+'" src="'+("default-icon"===n?o:n)+'"></div><div class="popover-body-message">'+this.options.actionMessage+'</div><div class="clearfix"></div></div><div class="popover-footer"><button id="onesignal-popover-allow-button" class="align-right primary popover-button">'+this.options.acceptButtonText+'</button><button id="onesignal-popover-cancel-button" class="align-right secondary popover-button">'+this.options.cancelButtonText+'</button><div class="clearfix"></div></div></div>',u.addDomElement("body","beforeend",'<div id="onesignal-popover-container" class="onesignal-popover-container onesignal-reset"></div>'),u.addDomElement(this.container,"beforeend",'<div id="onesignal-popover-dialog" class="onesignal-popover-dialog">'+c+"</div>"),u.addCssClass(this.container,r.mobile?"slide-up":"slide-down"),this.allowButton.addEventListener("click",this.onPopoverAllowed.bind(this)),this.cancelButton.addEventListener("click",this.onPopoverCanceled.bind(this)),s.default.trigger(e.EVENTS.SHOWN),i.label=2;case 2:return[2]}})})},e.prototype.onPopoverAllowed=function(t){s.default.trigger(e.EVENTS.ALLOW_CLICK)},e.prototype.onPopoverCanceled=function(t){s.default.trigger(e.EVENTS.CANCEL_CLICK),this.close()},e.prototype.close=function(){var t=this;u.addCssClass(this.container,"close-popover"),u.once(this.dialog,"animationend",function(n,i){n.target!==t.dialog||"slideDownExit"!==n.animationName&&"slideUpExit"!==n.animationName||(u.removeDomElement("#onesignal-popover-container"),i(),s.default.trigger(e.EVENTS.CLOSED))},!0)},e.prototype.getPlatformNotificationIcon=function(){return this.notificationIcons?u.isChromeLikeBrowser()||r.firefox?this.notificationIcons.chrome?this.notificationIcons.chrome:this.notificationIcons.firefox?this.notificationIcons.firefox:"default-icon":r.safari?this.notificationIcons.safari?this.notificationIcons.safari:this.notificationIcons.chrome?this.notificationIcons.chrome:"default-icon":void 0:"default-icon"},Object.defineProperty(e.prototype,"container",{get:function(){return document.querySelector("#onesignal-popover-container")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialog",{get:function(){return document.querySelector("#onesignal-popover-dialog")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowButton",{get:function(){return document.querySelector("#onesignal-popover-allow-button")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cancelButton",{get:function(){return document.querySelector("#onesignal-popover-cancel-button")},enumerable:!0,configurable:!0}),e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=null;i={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(e){this.toString=function(){return"CORRUPT: "+this.message},this.message=e},invalid:function(e){this.toString=function(){return"INVALID: "+this.message},this.message=e},bug:function(e){this.toString=function(){return"BUG: "+this.message},this.message=e},notReady:function(e){this.toString=function(){return"NOT READY: "+this.message},this.message=e}}},i.bitArray={bitSlice:function(e,t,n){return e=i.bitArray._shiftRight(e.slice(t/32),32-(31&t)).slice(1),void 0===n?e:i.bitArray.clamp(e,n-t)},extract:function(e,t,n){var i=Math.floor(-t-n&31);return(-32&(t+n-1^t)?e[t/32|0]<<32-i^e[t/32+1|0]>>>i:e[t/32|0]>>>i)&(1<<n)-1},concat:function(e,t){if(0===e.length||0===t.length)return e.concat(t);var n=e[e.length-1],r=i.bitArray.getPartial(n);return 32===r?e.concat(t):i.bitArray._shiftRight(t,r,0|n,e.slice(0,e.length-1))},bitLength:function(e){var t,n=e.length;return 0===n?0:(t=e[n-1],32*(n-1)+i.bitArray.getPartial(t))},clamp:function(e,t){if(32*e.length<t)return e;e=e.slice(0,Math.ceil(t/32));var n=e.length;return t&=31,n>0&&t&&(e[n-1]=i.bitArray.partial(t,e[n-1]&2147483648>>t-1,1)),e},partial:function(e,t,n){return 32===e?t:(n?0|t:t<<32-e)+1099511627776*e},getPartial:function(e){return Math.round(e/1099511627776)||32},equal:function(e,t){if(i.bitArray.bitLength(e)!==i.bitArray.bitLength(t))return!1;var n,r=0;for(n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r},_shiftRight:function(e,t,n,r){var o,s,a=0;for(void 0===r&&(r=[]);t>=32;t-=32)r.push(n),n=0;if(0===t)return r.concat(e);for(o=0;o<e.length;o++)r.push(n|e[o]>>>t),n=e[o]<<32-t;return a=e.length?e[e.length-1]:0,s=i.bitArray.getPartial(a),r.push(i.bitArray.partial(t+s&31,t+s>32?n:r.pop(),1)),r},_xor4:function(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]},byteswapM:function(e){var t,n;for(t=0;t<e.length;++t)n=e[t],e[t]=n>>>24|n>>>8&65280|(65280&n)<<8|n<<24;return e}},i.codec.utf8String={fromBits:function(e){var t,n,r="",o=i.bitArray.bitLength(e);for(t=0;t<o/8;t++)0==(3&t)&&(n=e[t/4]),r+=String.fromCharCode(n>>>24),n<<=8;return decodeURIComponent(window.escape(r))},toBits:function(e){e=window.unescape(encodeURIComponent(e));var t,n=[],r=0;for(t=0;t<e.length;t++)r=r<<8|e.charCodeAt(t),3==(3&t)&&(n.push(r),r=0);return 3&t&&n.push(i.bitArray.partial(8*(3&t),r)),n}},i.codec.hex={fromBits:function(e){var t,n="";for(t=0;t<e.length;t++)n+=(0xf00000000000+(0|e[t])).toString(16).substr(4);return n.substr(0,i.bitArray.bitLength(e)/4)},toBits:function(e){var t,n,r=[];for(e=e.replace(/\s|0x/g,""),n=e.length,e+="00000000",t=0;t<e.length;t+=8)r.push(0^parseInt(e.substr(t,8),16));return i.bitArray.clamp(r,4*n)}},i.hash.md5=function(e){this._T[0]||this._precompute(),e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()},i.hash.md5.hash=function(e){return(new i.hash.md5).update(e).finalize()},i.hash.md5.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(e){"string"==typeof e&&(e=i.codec.utf8String.toBits(e));var t,n=this._buffer=i.bitArray.concat(this._buffer,e),r=this._length,o=this._length=r+i.bitArray.bitLength(e);for(t=this.blockSize+r&-this.blockSize;t<=o;t+=this.blockSize)this._block(n.splice(0,16),!0);return this},finalize:function(){var e,t=this._buffer,n=this._h;for(t=i.bitArray.concat(t,[i.bitArray.partial(1,1)]),e=t.length+2;15&e;e++)t.push(0);for(t.push(0|this._length),t.push(this._length/4294967296|0);t.length;)this._block(t.splice(0,16),t.length);return this.reset(),this._BS(n,4),n},_init:[1732584193,4023233417,2562383102,271733878],_BS:function(e,t){var n,i;for(n=0;n<t;n++)i=e[n],e[n]=i>>>24|i>>8&65280|(65280&i)<<8|(255&i)<<24},_T:[],_precompute:function(){var e;for(e=0;e<64;e++)this._T[e]=4294967296*Math.abs(Math.sin(e+1))|0},_block:function(e,t){var n,i,r,o,s,a=e.slice(0),u=this._h,c=this._T;for(i=u[0],r=u[1],o=u[2],s=u[3],this._BS(a,t?16:14),n=0;n<64;n++){var l,d,f,p;n<32?n<16?(l=r&o|~r&s,d=n,f=[7,12,17,22]):(l=s&r|~s&o,d=(5*n+1)%16,f=[5,9,14,20]):n<48?(l=r^o^s,d=(3*n+5)%16,f=[4,11,16,23]):(l=o^(r|~s),d=7*n%16,f=[6,10,15,21]),p=i+l+a[d]+c[n],i=s,s=o,o=r,r=(p<<f[n%4]|p>>>32-f[n%4])+r|0}u[0]+=i,u[1]+=r,u[2]+=o,u[3]+=s}},i.hash.sha256=function(e){this._key[0]||this._precompute(),e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()},i.hash.sha256.hash=function(e){return(new i.hash.sha256).update(e).finalize()},i.hash.sha256.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(e){"string"==typeof e&&(e=i.codec.utf8String.toBits(e));var t,n=this._buffer=i.bitArray.concat(this._buffer,e),r=this._length,o=this._length=r+i.bitArray.bitLength(e);if(o>9007199254740991)throw new i.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var s=new Uint32Array(n),a=0;for(t=512+r-(512+r&511);t<=o;t+=512)this._block(s.subarray(16*a,16*(a+1))),a+=1;n.splice(0,16*a)}else for(t=512+r-(512+r&511);t<=o;t+=512)this._block(n.splice(0,16));return this},finalize:function(){var e,t=this._buffer,n=this._h;for(t=i.bitArray.concat(t,[i.bitArray.partial(1,1)]),e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(this._length/4294967296)),t.push(0|this._length);t.length;)this._block(t.splice(0,16));return this.reset(),n},_init:[],_key:[],_precompute:function(){function e(e){return 4294967296*(e-Math.floor(e))|0}for(var t,n,i=0,r=2;i<64;r++){for(n=!0,t=2;t*t<=r;t++)if(r%t==0){n=!1;break}n&&(i<8&&(this._init[i]=e(Math.pow(r,.5))),this._key[i]=e(Math.pow(r,1/3)),i++)}},_block:function(e){var t,n,i,r,o=this._h,s=this._key,a=o[0],u=o[1],c=o[2],l=o[3],d=o[4],f=o[5],p=o[6],g=o[7];for(t=0;t<64;t++)t<16?n=e[t]:(i=e[t+1&15],r=e[t+14&15],n=e[15&t]=(i>>>7^i>>>18^i>>>3^i<<25^i<<14)+(r>>>17^r>>>19^r>>>10^r<<15^r<<13)+e[15&t]+e[t+9&15]|0),n=n+g+(d>>>6^d>>>11^d>>>25^d<<26^d<<21^d<<7)+(p^d&(f^p))+s[t],g=p,p=f,f=d,d=l+n|0,l=c,c=u,u=a,a=n+(u&c^l&(u^c))+(u>>>2^u>>>13^u>>>22^u<<30^u<<19^u<<10)|0;o[0]=o[0]+a|0,o[1]=o[1]+u|0,o[2]=o[2]+c|0,o[3]=o[3]+l|0,o[4]=o[4]+d|0,o[5]=o[5]+f|0,o[6]=o[6]+p|0,o[7]=o[7]+g|0}},i.hash.sha1=function(e){e?(this._h=e._h.slice(0),this._buffer=e._buffer.slice(0),this._length=e._length):this.reset()},i.hash.sha1.hash=function(e){return(new i.hash.sha1).update(e).finalize()},i.hash.sha1.prototype={blockSize:512,reset:function(){return this._h=this._init.slice(0),this._buffer=[],this._length=0,this},update:function(e){"string"==typeof e&&(e=i.codec.utf8String.toBits(e));var t,n=this._buffer=i.bitArray.concat(this._buffer,e),r=this._length,o=this._length=r+i.bitArray.bitLength(e);if(o>9007199254740991)throw new i.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!=typeof Uint32Array){var s=new Uint32Array(n),a=0;for(t=this.blockSize+r-(this.blockSize+r&this.blockSize-1);t<=o;t+=this.blockSize)this._block(s.subarray(16*a,16*(a+1))),a+=1;n.splice(0,16*a)}else for(t=this.blockSize+r-(this.blockSize+r&this.blockSize-1);t<=o;t+=this.blockSize)this._block(n.splice(0,16));return this},finalize:function(){var e,t=this._buffer,n=this._h;for(t=i.bitArray.concat(t,[i.bitArray.partial(1,1)]),e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(this._length/4294967296)),t.push(0|this._length);t.length;)this._block(t.splice(0,16));return this.reset(),n},_init:[1732584193,4023233417,2562383102,271733878,3285377520],_key:[1518500249,1859775393,2400959708,3395469782],_f:function(e,t,n,i){return e<=19?t&n|~t&i:e<=39?t^n^i:e<=59?t&n|t&i|n&i:e<=79?t^n^i:void 0},_S:function(e,t){return t<<e|t>>>32-e},_block:function(e){var t,n,i,r,o,s,a,u,c=this._h;if("undefined"!=typeof Uint32Array){u=Array(80);for(var l=0;l<16;l++)u[l]=e[l]}else u=e;for(i=c[0],r=c[1],o=c[2],s=c[3],a=c[4],t=0;t<=79;t++)t>=16&&(u[t]=this._S(1,u[t-3]^u[t-8]^u[t-14]^u[t-16])),n=this._S(5,i)+this._f(t,r,o,s)+a+u[t]+this._key[Math.floor(t/20)]|0,a=s,s=o,o=this._S(30,r),r=i,i=n;c[0]=c[0]+i|0,c[1]=c[1]+r|0,c[2]=c[2]+o|0,c[3]=c[3]+s|0,c[4]=c[4]+a|0}};var r=function(){function e(){}return e.md5=function(e){return i.codec.hex.fromBits(i.hash.md5.hash(e))},e.sha1=function(e){return i.codec.hex.fromBits(i.hash.sha1.hash(e))},e.sha256=function(e){return i.codec.hex.fromBits(i.hash.sha256.hash(e))},e}();t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.isValidUrl=function(e,t){if(t&&t.allowNull&&null===e)return!0;if(t&&t.allowEmpty&&(null===e||void 0===e))return!0;try{var n=new URL(e);return!t||!t.requireHttps||"https:"===n.protocol}catch(e){return!1}},e.isValidBoolean=function(e,t){return!(!t||!t.allowNull||null!==e)||(!0===e||!1===e)},e.isValidArray=function(e,t){return!(!t||!t.allowNull||null!==e)||(!(!t||!t.allowEmpty||null!==e&&void 0!==e)||e instanceof Array)},e}();t.ValidatorUtils=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,r=n(0),o=n(7),s=n(43),a=n(54);!function(e){e[e.HttpPermissionRequest=0]="HttpPermissionRequest"}(i=t.DeprecatedApiReason||(t.DeprecatedApiReason={}));var u=function(e){function t(t){var n=this;switch(t){case i.HttpPermissionRequest:n=e.call(this,"The HTTP permission request has been deprecated. Please remove any custom popups from your code.")||this,n.reportUsage()}return n}return r.__extends(t,e),t.prototype.reportUsage=function(){void 0!==s.default&&s.default.context&&s.default.context.metricsManager&&s.default.context.metricsManager.reportEvent(new a.ApiUsageMetricEvent(a.ApiUsageMetricKind.HttpPermissionRequest))},t}(o.default);t.DeprecatedApiError=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.promiseStub=function(){return{then:e.promiseStub,catch:e.promiseStub}},Object.defineProperty(e,"log",{get:function(){return{setLevel:function(){}}},enumerable:!0,configurable:!0}),e.isPushNotificationsSupported=function(){return!1},e.push=function(e){if("function"==typeof e)e();else{var t=e.shift();OneSignal[t].apply(null,e)}},e}();t.default=i;var r=i;r.init=r.showHttpPrompt=r.registerForPushNotifications=r.showHttpPermissionRequest=r.getNotificationPermission=r.on=r.off=r.once=r.config=r.SERVICE_WORKER_PATH=r.SERVICE_WORKER_UPDATER_PATH=r.checkAndWipeUserSubscription=r.subscriptionBell=r.notifyButton=function(){},r.setDefaultNotificationUrl=r.setDefaultTitle=r.syncHashedEmail=r.getTags=r.sendTag=r.sendTags=r.deleteTag=r.deleteTags=r.addListenerForNotificationOpened=r.getIdsAvailable=r.isPushNotificationsEnabled=r.setSubscription=r.getUserId=r.getRegistrationId=r.getSubscription=r.sendSelfNotification=r.promiseStub},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(9),o=n(1),s=n(8),a=n(6),u=n(23),c=n(2),l=n(24),d=n(35),f=n(19),p=n(11),g=n(3),h=n(12),v=n(25),m=function(){function e(){}return Object.defineProperty(e,"VERSION",{get:function(){return a.default.version()},enumerable:!0,configurable:!0}),Object.defineProperty(e,"environment",{get:function(){return a.default},enumerable:!0,configurable:!0}),Object.defineProperty(e,"log",{get:function(){return o},enumerable:!0,configurable:!0}),Object.defineProperty(e,"database",{get:function(){return p.default},enumerable:!0,configurable:!0}),Object.defineProperty(e,"sdkEnvironment",{get:function(){return c.default},enumerable:!0,configurable:!0}),Object.defineProperty(e,"browser",{get:function(){return r},enumerable:!0,configurable:!0}),Object.defineProperty(e,"workerMessenger",{get:function(){return self.workerMessenger||(self.workerMessenger=new u.WorkerMessenger(null)),self.workerMessenger},enumerable:!0,configurable:!0}),e.run=function(){self.addEventListener("push",e.onPushReceived),self.addEventListener("notificationclose",e.onNotificationClosed),self.addEventListener("notificationclick",function(t){return t.waitUntil(e.onNotificationClicked(t))}),self.addEventListener("install",e.onServiceWorkerInstalled),self.addEventListener("activate",e.onServiceWorkerActivated),self.addEventListener("pushsubscriptionchange",e.onPushSubscriptionChange),o.debug("Setting up message listeners."),e.workerMessenger.listen(),e.setupMessageListeners()},e.getAppId=function(){return i.__awaiter(this,void 0,void 0,function(){var e,e;return i.__generator(this,function(t){switch(t.label){case 0:return self.location.search?(e=self.location.search.match(/appId=([0-9a-z-]+)&?/i)[1],[2,new h.Uuid(e)]):[3,1];case 1:return[4,p.default.getAppConfig()];case 2:return e=t.sent().appId,[2,e]}})})},e.setupMessageListeners=function(){return i.__awaiter(this,void 0,void 0,function(){var t=this;return i.__generator(this,function(n){return e.workerMessenger.on(u.WorkerMessengerCommand.WorkerVersion,function(t){o.debug("[Service Worker] Received worker version message."),e.workerMessenger.broadcast(u.WorkerMessengerCommand.WorkerVersion,a.default.version())}),e.workerMessenger.on(u.WorkerMessengerCommand.Subscribe,function(n){return i.__awaiter(t,void 0,void 0,function(){var t,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return t=v.AppConfig.deserialize(n),o.debug("[Service Worker] Received subscribe message."),r=new d.default(t),[4,r.subscriptionManager.subscribe()];case 1:return s=i.sent(),e.workerMessenger.broadcast(u.WorkerMessengerCommand.Subscribe,s.serialize()),[2]}})})}),e.workerMessenger.on(u.WorkerMessengerCommand.AmpSubscriptionState,function(n){return i.__awaiter(t,void 0,void 0,function(){var t,n,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("[Service Worker] Received AMP subscription state message."),[4,self.registration.pushManager.getSubscription()];case 1:return(t=i.sent())?[3,2]:(e.workerMessenger.broadcast(u.WorkerMessengerCommand.AmpSubscriptionState,!1),[3,5]);case 2:return[4,self.registration.pushManager.permissionState(t.options)];case 3:return n=i.sent(),[4,p.default.getSubscription()];case 4:r=i.sent().optedOut,s=!!t&&"granted"===n&&!0!==r,e.workerMessenger.broadcast(u.WorkerMessengerCommand.AmpSubscriptionState,s),i.label=5;case 5:return[2]}})})}),e.workerMessenger.on(u.WorkerMessengerCommand.AmpSubscribe,function(){return i.__awaiter(t,void 0,void 0,function(){var t,n,r,s;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("[Service Worker] Received AMP subscribe message."),[4,e.getAppId()];case 1:return t=i.sent(),[4,f.default.getAppConfig(t)];case 2:return n=i.sent(),r=new d.default(n),[4,r.subscriptionManager.subscribe()];case 3:return s=i.sent(),e.workerMessenger.broadcast(u.WorkerMessengerCommand.AmpSubscribe,s.deviceId),[2]}})})}),e.workerMessenger.on(u.WorkerMessengerCommand.AmpUnsubscribe,function(){return i.__awaiter(t,void 0,void 0,function(){var t,n,r;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("[Service Worker] Received AMP unsubscribe message."),[4,e.getAppId()];case 1:return t=i.sent(),[4,f.default.getAppConfig(t)];case 2:return n=i.sent(),r=new d.default(n),[4,r.subscriptionManager.unsubscribe(1)];case 3:return i.sent(),e.workerMessenger.broadcast(u.WorkerMessengerCommand.AmpUnsubscribe,null),[2]}})})}),[2]})})},e.onPushReceived=function(t){o.debug("Called %conPushReceived("+JSON.stringify(t,null,4)+"):",g.getConsoleStyle("code"),t),t.waitUntil(e.parseOrFetchNotifications(t).then(function(t){if(!t||0==t.length)return o.debug("Because no notifications were retrieved, we'll display the last known notification, so long as it isn't the welcome notification."),e.displayBackupNotification();for(var n=[],i=0,r=t;i<r.length;i++){var s=r[i];o.debug("Raw Notification from OneSignal:",s);var a=e.buildStructuredNotificationObject(s);n.push(function(t){return e.displayNotification(t).then(function(){return e.updateBackupNotification(t).catch(function(e){return o.error(e)})}).then(function(){return e.workerMessenger.broadcast(u.WorkerMessengerCommand.NotificationDisplayed,t).catch(function(e){return o.error(e)})}).then(function(){return e.executeWebhooks("notification.displayed",t).catch(function(e){return o.error(e)})})}.bind(null,a))}return n.reduce(function(e,t){return e=e.then(t)},Promise.resolve())}).catch(function(t){return o.debug("Failed to display a notification:",t),e.UNSUBSCRIBED_FROM_NOTIFICATIONS?void o.debug("Because we have just unsubscribed from notifications, we will not show anything."):(o.debug("Because a notification failed to display, we'll display the last known notification, so long as it isn't the welcome notification."),e.displayBackupNotification())}))},e.executeWebhooks=function(e,t){return i.__awaiter(this,void 0,void 0,function(){var n,r,s,a,u;return i.__generator(this,function(i){switch(i.label){case 0:return[4,p.default.getSubscription()];case 1:return n=i.sent().deviceId,[4,p.default.get("Options","webhooks.cors")];case 2:return r=i.sent(),[4,p.default.get("Options","webhooks."+e)];case 3:return(s=i.sent())?(a={event:e,id:t.id,userId:n,action:t.action,buttons:t.buttons,heading:t.heading,content:t.content,url:t.url,icon:t.icon,data:t.data},u={method:"post",mode:"no-cors",body:JSON.stringify(a)},r&&(u.mode="cors",u.headers={"X-OneSignal-Event":e,"Content-Type":"application/json"}),o.debug("Executing "+e+" webhook "+(r?"with":"without")+" CORS %cPOST "+s,g.getConsoleStyle("code"),":",a),[4,fetch(s,u)]):[3,5];case 4:return[2,i.sent()];case 5:return[2]}})})},e.getActiveClients=function(){return i.__awaiter(this,void 0,void 0,function(){var e,t,n,r,o;return i.__generator(this,function(i){switch(i.label){case 0:return[4,self.clients.matchAll({type:"window",includeUncontrolled:!0})];case 1:for(e=i.sent(),t=[],n=0,r=e;n<r.length;n++){if(o=r[n],o.frameType&&"nested"===o.frameType){if(!g.contains(o.url,c.default.getOneSignalApiUrl().host)&&!g.contains(o.url,".os.tc"))continue;o.isSubdomainIframe=!0}t.push(o)}return[2,t]}})})},e.buildStructuredNotificationObject=function(e){var t={id:e.custom.i,heading:e.title,content:e.alert,data:e.custom.a,url:e.custom.u,icon:e.icon,image:e.image,tag:e.tag,badge:e.badge,vibrate:e.vibrate};if(e.o){t.buttons=[];for(var n=0,i=e.o;n<i.length;n++){var r=i[n];t.buttons.push({action:r.i,title:r.n,icon:r.p,url:r.u})}}return g.trimUndefined(t)},e.ensureImageResourceHttps=function(e){if(!e)return null;try{var t=new URL(e);if("localhost"===t.hostname||-1!==t.hostname.indexOf("192.168")||"127.0.0.1"===t.hostname||"https:"===t.protocol)return e;if("i0.wp.com"===t.hostname||"i1.wp.com"===t.hostname||"i2.wp.com"===t.hostname||"i3.wp.com"===t.hostname)return"https://"+t.hostname+t.pathname;return"https://i0.wp.com/"+(t.host+t.pathname)}catch(e){}},e.ensureNotificationResourcesHttps=function(t){if(t&&(t.icon&&(t.icon=e.ensureImageResourceHttps(t.icon)),t.image&&(t.image=e.ensureImageResourceHttps(t.image)),t.buttons&&t.buttons.length>0))for(var n=0,i=t.buttons;n<i.length;n++){var r=i[n];r.icon&&(r.icon=e.ensureImageResourceHttps(r.icon))}},e.displayNotification=function(t,n){return i.__awaiter(this,void 0,void 0,function(){var r,a,u,c,l,d;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("Called %cdisplayNotification("+JSON.stringify(t,null,4)+"):",g.getConsoleStyle("code"),t),[4,e._getTitle()];case 1:return r=i.sent(),[4,p.default.get("Options","defaultIcon")];case 2:return a=i.sent(),[4,p.default.get("Options","persistNotification")];case 3:return u=i.sent(),[4,e.getAppId()];case 4:return c=i.sent(),t.heading=t.heading?t.heading:r,t.icon=t.icon?t.icon:a||void 0,l={},l.tag=t.tag||c.toString(),l.persistNotification="force"===u||u,n||(n={}),t=s(t,n),e.ensureNotificationResourcesHttps(t),d={body:t.content,icon:t.icon,image:t.image,data:t,actions:t.buttons,tag:l.tag,requireInteraction:l.persistNotification,renotify:!0,badge:t.badge,vibrate:t.vibrate},d=e.filterNotificationOptions(d,"force"===u),[2,self.registration.showNotification(t.heading,d)]}})})},e.filterNotificationOptions=function(e,t){if("object"!=typeof e)return e;var n=s({},e);if(""===r.name&&""===r.version)var i=r._detect(navigator.userAgent);else var i=r;return i.chrome&&i.mac&&n&&(n.requireInteraction=!1),t&&(n.requireInteraction=!0),n},e.updateBackupNotification=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:return t=e.data&&e.data.__isOneSignalWelcomeNotification,t?[2]:[4,p.default.put("Ids",{type:"backupNotification",id:e})];case 1:return n.sent(),[2]}})})},e.displayBackupNotification=function(){return p.default.get("Ids","backupNotification").then(function(t){var n={persistNotification:!1,data:{__isOneSignalBackupNotification:!0}};return t?e.displayNotification(t,n):e.displayNotification({content:"You have new updates."},n)})},e.shouldOpenNotificationUrl=function(e){return"javascript:void(0);"!==e&&"do_not_open"!==e&&!g.contains(e,"_osp=do_not_open")},e.onNotificationClosed=function(t){o.debug("Called %conNotificationClosed("+JSON.stringify(t,null,4)+"):",g.getConsoleStyle("code"),t);var n=t.notification.data;e.workerMessenger.broadcast(u.WorkerMessengerCommand.NotificationDismissed,n).catch(function(e){return o.error(e)}),t.waitUntil(e.executeWebhooks("notification.dismissed",n))},e.getNotificationUrlToOpen=function(e){return i.__awaiter(this,void 0,void 0,function(){var t,n,r,o,s;return i.__generator(this,function(i){switch(i.label){case 0:return t=self.registration.scope,[4,p.default.getAppState()];case 1:if(n=i.sent().defaultNotificationUrl,n&&(t=n),e.action)for(r=0,o=e.buttons;r<o.length;r++)s=o[r],s.action===e.action&&s.url&&""!==s.url&&(t=s.url);else e.url&&""!==e.url&&(t=e.url);return[2,t]}})})},e.onNotificationClicked=function(t){return i.__awaiter(this,void 0,void 0,function(){var n,r,s,a,c,l,d,h,v,m,b,S,w,_,y,O,E,P,I,C,N,T;return i.__generator(this,function(i){switch(i.label){case 0:return o.debug("Called %conNotificationClicked("+JSON.stringify(t,null,4)+"):",g.getConsoleStyle("code"),t),t.notification.close(),n=t.notification.data,t.action&&(n.action=t.action),r="exact",s="navigate",[4,p.default.get("Options","notificationClickHandlerMatch")];case 1:return a=i.sent(),a&&(r=a),[4,this.database.get("Options","notificationClickHandlerAction")];case 2:return c=i.sent(),c&&(s=c),[4,e.getActiveClients()];case 3:return l=i.sent(),[4,e.getNotificationUrlToOpen(n)];case 4:d=i.sent(),h=e.shouldOpenNotificationUrl(d),v=!1,m=0,b=l,i.label=5;case 5:return m<b.length?(S=b[m],w=S.url,S.isSubdomainIframe?[4,p.default.get("Options","lastKnownHostUrl")]:[3,8]):[3,37];case 6:return _=i.sent(),w=_,_?[3,8]:[4,p.default.get("Options","defaultUrl")];case 7:w=i.sent(),i.label=8;case 8:y="";try{y=new URL(w).origin}catch(e){o.error("Failed to get the HTTP site's actual origin:",e)}O=null;try{O=new URL(d).origin}catch(e){}if(!("exact"===r&&w===d||"origin"===r&&y===O))return[3,36];if(!(S.isSubdomainIframe&&w===d||!S.isSubdomainIframe&&S.url===d||"focus"===s&&y===O))return[3,13];e.workerMessenger.unicast(u.WorkerMessengerCommand.NotificationClicked,n,S),i.label=9;case 9:return i.trys.push([9,11,,12]),[4,S.focus()];case 10:return i.sent(),[3,12];case 11:return E=i.sent(),o.error("Failed to focus:",S,E),[3,12];case 12:return[3,35];case 13:if(!S.isSubdomainIframe)return[3,21];i.label=14;case 14:return i.trys.push([14,16,,17]),o.debug("Client is subdomain iFrame. Attempting to focus() client."),[4,S.focus()];case 15:return i.sent(),[3,17];case 16:return P=i.sent(),o.error("Failed to focus:",S,P),[3,17];case 17:return h?(o.debug("Redirecting HTTP site to "+d+"."),[4,p.default.put("NotificationOpened",{url:d,data:n,timestamp:Date.now()})]):[3,19];case 18:return i.sent(),e.workerMessenger.unicast(u.WorkerMessengerCommand.RedirectPage,d,S),[3,20];case 19:o.debug("Not navigating because link is special."),i.label=20;case 20:return[3,35];case 21:if(!S.navigate)return[3,32];i.label=22;case 22:return i.trys.push([22,24,,25]),o.debug("Client is standard HTTPS site. Attempting to focus() client."),[4,S.focus()];case 23:return i.sent(),[3,25];case 24:return I=i.sent(),o.error("Failed to focus:",S,I),[3,25];case 25:return i.trys.push([25,30,,31]),h?(o.debug("Redirecting HTTPS site to ("+d+")."),[4,p.default.put("NotificationOpened",{url:d,data:n,timestamp:Date.now()})]):[3,28];case 26:return i.sent(),[4,S.navigate(d)];case 27:return i.sent(),[3,29];case 28:o.debug("Not navigating because link is special."),i.label=29;case 29:return[3,31];case 30:return C=i.sent(),console.error("Failed to navigate."),console.error("Failed to navigate because:",C),console.error("Failed to navigate to "+d+" because:",C),o.error("Failed to navigate:",S,d,C),[3,31];case 31:return[3,35];case 32:return[4,p.default.put("NotificationOpened",{url:d,data:n,timestamp:Date.now()})];case 33:return i.sent(),[4,e.openUrl(d)];case 34:i.sent(),i.label=35;case 35:return v=!0,[3,37];case 36:return m++,[3,5];case 37:return!h||v?[3,40]:[4,p.default.put("NotificationOpened",{url:d,data:n,timestamp:Date.now()})];case 38:return i.sent(),[4,e.openUrl(d)];case 39:i.sent(),i.label=40;case 40:return[4,p.default.getAppConfig()];case 41:return N=i.sent().appId,[4,p.default.getSubscription()];case 42:return T=i.sent().deviceId,N&&T?[4,f.default.put("notifications/"+n.id,{app_id:N.toString(),player_id:T.toString(),opened:!0})]:[3,44];case 43:i.sent(),i.label=44;case 44:return[4,e.executeWebhooks("notification.clicked",n)];case 45:return[2,i.sent()]}})})},e.openUrl=function(e){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(n){switch(n.label){case 0:o.debug("Opening notification URL:",e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,self.clients.openWindow(e)];case 2:return[2,n.sent()];case 3:return t=n.sent(),o.warn("Failed to open the URL '"+e+"':",t),[2,void 0];case 4:return[2]}})})},e.onServiceWorkerInstalled=function(e){e.waitUntil(self.skipWaiting())},e.onServiceWorkerActivated=function(e){o.info("%cOneSignal Service Worker activated (version "+a.default.version()+", "+c.default.getWindowEnv().toString()+" environment).",g.getConsoleStyle("bold")),e.waitUntil(self.clients.claim())},e.onPushSubscriptionChange=function(e){o.debug("Called %conPushSubscriptionChange("+JSON.stringify(e,null,4)+"):",g.getConsoleStyle("code"),e)},e.simulateEvent=function(e){self.dispatchEvent(new ExtendableEvent(e))},e._getTitle=function(){return new Promise(function(e){Promise.all([p.default.get("Options","defaultTitle"),p.default.get("Options","pageTitle")]).then(function(t){var n=t[0],i=t[1];e(null!==n?n:null!=i?i:"")})})},e.parseOrFetchNotifications=function(t){if(t.data){return e.isValidPushPayload(t.data)?(o.debug("Received a valid encrypted push payload."),Promise.resolve([t.data.json()])):Promise.reject("Unexpected push message payload received: "+t.data.text())}return e.retrieveNotifications()},e.isValidPushPayload=function(e){try{var t=e.json();return!!(t&&t.custom&&t.custom.i&&g.isValidUuid(t.custom.i))||(o.debug("isValidPushPayload: Valid JSON but missing notification UUID:",t),!1)}catch(e){return o.debug("isValidPushPayload: Parsing to JSON failed with:",e),!1}},e.retrieveNotifications=function(){return new Promise(function(t){var n=[];p.default.get("Ids","userId").then(function(t){return t?(o.debug("Legacy push signal received, retrieving contents from players/"+t+"/chromeweb_notification"),f.default.get("players/"+t+"/chromeweb_notification")):(o.debug("Tried to get notification contents, but IndexedDB is missing user ID info."),Promise.all([e.getAppId(),self.registration.pushManager.getSubscription().then(function(e){return e.endpoint})]).then(function(e){var t=e[0],n=e[1],i=g.getDeviceTypeForBrowser();return f.default.getUserIdFromSubscriptionIdentifier(t.toString(),i,n).then(function(e){return e?(o.debug("Recovered OneSignal user ID:",e),Promise.all([p.default.put("Ids",{type:"userId",id:e}),p.default.put("Ids",{type:"registrationId",id:n.replace(new RegExp("^(https://android.googleapis.com/gcm/send/|https://updates.push.services.mozilla.com/push/)"),"")})]).then(function(){return o.debug("Attempting to retrieve the notification again now with a recovered user ID."),f.default.get("players/"+e+"/chromeweb_notification")})):Promise.reject("Recovered user ID was null. Unsubscribing from push notifications.")})}).catch(function(t){return o.debug("Unsuccessfully attempted to recover OneSignal user ID:",t),self.registration.pushManager.getSubscription().then(function(e){return e.unsubscribe()}).then(function(t){o.debug("Unsubscribed from push notifications result:",t),e.UNSUBSCRIBED_FROM_NOTIFICATIONS=!0})}))}).then(function(e){for(var i=0;i<e.length;i++)n.push(JSON.parse(e[i]));0==n.length&&o.warn("OneSignal Worker: Received a GCM push signal, but there were no messages to retrieve. Are you using the wrong API URL?",c.default.getOneSignalApiUrl().toString()),t(n)})})},e}();t.ServiceWorker=m,"undefined"==typeof self&&void 0!==e?e.OneSignalWorker=m:self.OneSignalWorker=m,o.setDefaultLevel(c.default.getBuildEnv()===l.BuildEnvironmentKind.Development?o.levels.TRACE:o.levels.ERROR),"undefined"!=typeof self&&m.run()}).call(t,n(37))}]);
2
+ //# sourceMappingURL=OneSignalSDK.js.map
includes/onesignal-integration/amp-helper-frame.html ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html>
3
+ <!-- AMP Web Push Helper IFrame -->
4
+
5
+ <head>
6
+ <meta charset="utf-8">
7
+ <script>(function(){var f,g=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a}(this);function h(a,b){b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(c){return b}};var m=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;Date.now();self.log=self.log||{user:null,dev:null,userForEmbed:null};var n=self.log;var p,r;
8
+ function t(a){var b;p||(p=self.document.createElement("a"),r=self.UrlCache||(self.UrlCache=Object.create(null)));var c=r[a];if(c)return c;var d=p;d.href=a;d.protocol||(d.href=d.href);var e={href:d.href,protocol:d.protocol,host:d.host,hostname:d.hostname,port:"0"==d.port?"":d.port,pathname:d.pathname,search:d.search,hash:d.hash,origin:null};"/"!==e.pathname[0]&&(e.pathname="/"+e.pathname);if("http:"==e.protocol&&80==e.port||"https:"==e.protocol&&443==e.port)e.port="",e.host=e.hostname;e.origin=d.origin&&
9
+ "null"!=d.origin?d.origin:"data:"!=e.protocol&&e.host?e.protocol+"//"+e.host:e.href;var k=e,l=k;return b?l:r[a]=l};function u(a){a||(a={debug:!1,windowContext:window});this.h={};this.c={};this.u=a.debug;this.i=this.B=this.C=!1;this.j=this.o=this.s=this.b=this.m=null;this.a=a.windowContext||window}f=u.prototype;
10
+ f.listen=function(a){var b=this;return(new Promise(function(c,d){b.i?d(Error("Already connected.")):b.C?d(Error("Already listening for connections.")):Array.isArray(a)?(b.s=b.K.bind(b,a,c,d),b.a.addEventListener("message",b.s)):d(Error("allowedOrigins should be a string array of allowed origins to accept messages from. Got:",a))})).then(function(){b.send(u.Topics.CONNECT_HANDSHAKE,null);b.i=!0})};
11
+ f.K=function(a,b,c,d){var e=d.data,k=d,l=k.ports;a:{for(var k=t(k.origin).origin,q=0;q<a.length;q++)if(t(a[q]).origin===k){a=!0;break a}a=!1}a&&e&&e.topic===u.Topics.CONNECT_HANDSHAKE&&(this.a.removeEventListener("message",this.s),this.b=l[0],this.j=this.w.bind(this),this.b.addEventListener("message",this.j,!1),this.b.start(),b())};
12
+ f.connect=function(a,b){var c=this;return new Promise(function(d,e){a||e(Error("Provide a valid Window context to connect to."));b||e(Error("Provide an expected origin for the remote Window or provide the wildcard *."));c.i?e(Error("Already connected.")):c.B?e(Error("Already connecting.")):(c.m=new MessageChannel,c.b=c.m.port1,c.o=c.J.bind(c,c.b,b,d),c.b.addEventListener("message",c.o),c.b.start(),a.postMessage({topic:u.Topics.CONNECT_HANDSHAKE},"*"===b?"*":t(b).origin,[c.m.port2]))})};
13
+ f.J=function(a,b,c){this.i=!0;a.removeEventListener("message",this.o);this.j=this.w.bind(this);a.addEventListener("message",this.j,!1);c()};f.w=function(a){a=a.data;if(this.h[a.id]&&a.isReply){var b=this.h[a.id];delete this.h[a.id];var c=b.promiseResolver;b.message=a.data;c([a.data,this.A.bind(this,a.id,b.topic)])}else{var d=this.c[a.topic];if(d)for(var e=0;e<d.length;e++)(0,d[e])(a.data,this.A.bind(this,a.id,a.topic))}};f.on=function(a,b){this.c[a]?this.c[a].push(b):this.c[a]=[b]};
14
+ f.off=function(a,b){if(b){var c=this.c[a].indexOf(b);-1!==c&&this.c[a].splice(c,1)}else this.c[a]&&delete this.c[a]};f.A=function(a,b,c){var d=this,e={id:a,topic:b,data:c,isReply:!0};this.b.postMessage(e);return new Promise(function(a){d.h[e.id]={message:c,topic:b,promiseResolver:a}})};f.send=function(a,b){var c=this,d={id:crypto.getRandomValues(new Uint8Array(10)).join(""),topic:a,data:b};this.b.postMessage(d);return new Promise(function(e){c.h[d.id]={message:b,topic:a,promiseResolver:e}})};
15
+ g.Object.defineProperties(u,{Topics:{configurable:!0,enumerable:!0,get:function(){return{CONNECT_HANDSHAKE:"topic-connect-handshake",NOTIFICATION_PERMISSION_STATE:"topic-notification-permission-state",SERVICE_WORKER_STATE:"topic-service-worker-state",SERVICE_WORKER_REGISTRATION:"topic-service-worker-registration",SERVICE_WORKER_QUERY:"topic-service-worker-query",STORAGE_GET:"topic-storage-get"}}}});function v(a){this.u=a&&a.debug;this.a=a.windowContext||window;this.g=new u({debug:this.u,windowContext:this.a});this.l={}}function w(a,b){var c=!0,d=null;a({success:c,error:c?void 0:d,result:c?b:void 0})}f=v.prototype;f.D=function(a,b){if(a&&a.isQueryTopicSupported){var c=!1,d;for(d in u.Topics)a.isQueryTopicSupported===u.Topics[d]&&(c=!0);w(b,c)}else w(b,Notification.permission)};
16
+ f.I=function(a,b){var c=null;try{if(a&&a.key&&this.a.localStorage)c=this.a.localStorage.getItem(a.key);else{if(!n.user)throw Error("failed to call initLogConstructor");n.user.warn("amp-web-push","LocalStorage retrieval failed.")}}catch(d){}w(b,c)};
17
+ f.H=function(a,b){var c={isControllingFrame:!!this.a.navigator.serviceWorker.controller,url:this.a.navigator.serviceWorker.controller?this.a.navigator.serviceWorker.controller.scriptURL:null,state:this.a.navigator.serviceWorker.controller?this.a.navigator.serviceWorker.controller.state:null};w(b,c)};
18
+ f.G=function(a,b){if(!a||!a.workerUrl||!a.registrationOptions)throw Error("Expected arguments workerUrl and registrationOptions in message, got:",a);this.a.navigator.serviceWorker.register(a.workerUrl,a.registrationOptions).then(function(){w(b,null)}).catch(function(a){w(b,a?a.message||a.toString():null)})};f.messageServiceWorker=function(a){this.a.navigator.serviceWorker.controller.postMessage({command:a.topic,payload:a.payload})};
19
+ f.F=function(a,b){var c=this;if(!a||!a.topic)throw Error("Expected argument topic in message, got:",a);(new Promise(function(b){c.l[a.topic]=b;c.waitUntilWorkerControlsPage().then(function(){c.messageServiceWorker(a)})})).then(function(d){delete c.l[a.topic];return w(b,d)})};
20
+ function x(a){a=a.a.location.search;var b=Object.create(null);if(a)for(var c;c=m.exec(a);){var d=h(c[1],c[1]).trim();c=c[2]?h(c[2],c[2]).trim():"";b[d]=c}var e=b;if(!e.parentOrigin)throw Error("Expecting parentOrigin URL query parameter.");return e.parentOrigin}f.L=function(a){a=a.data;var b=a.command;a=a.payload;var c=this.l[b];"function"===typeof c&&c(a)};
21
+ function y(a){return a.a.navigator.serviceWorker&&a.a.navigator.serviceWorker.controller&&"activated"===a.a.navigator.serviceWorker.controller.state}f.waitUntilWorkerControlsPage=function(){var a=this;return new Promise(function(b){y(a)?b():a.a.navigator.serviceWorker.addEventListener("controllerchange",function(){y(a)?b():a.a.navigator.serviceWorker.controller.addEventListener("statechange",function(){y(a)&&b()})})})};
22
+ f.run=function(a){var b=this;this.g.on(u.Topics.NOTIFICATION_PERMISSION_STATE,this.D.bind(this));this.g.on(u.Topics.SERVICE_WORKER_STATE,this.H.bind(this));this.g.on(u.Topics.SERVICE_WORKER_REGISTRATION,this.G.bind(this));this.g.on(u.Topics.SERVICE_WORKER_QUERY,this.F.bind(this));this.g.on(u.Topics.STORAGE_GET,this.I.bind(this));this.waitUntilWorkerControlsPage().then(function(){b.a.navigator.serviceWorker.addEventListener("message",b.L.bind(b))});this.g.listen([a||x(this)])};
23
+ window._ampWebPushHelperFrame=new v({debug:!1});window._ampWebPushHelperFrame.run();})();
24
+ //# sourceMappingURL=amp-web-push-helper-frame.js.map
25
+
26
+ </script>
27
+ <script src="https://cdn.onesignal.com/sdks/amp-helper-frame.js"></script>
28
+ </head>
29
+ <body>
30
+ </body>
31
+ </html>
includes/onesignal-integration/amp-permission-dialog.html ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html>
3
+ <!-- AMP Web Push Permission Dialog -->
4
+
5
+ <head>
6
+ <meta charset="utf-8">
7
+
8
+ <!-- Do not edit styles in this section -->
9
+ <style builtin>
10
+ /* Do not edit styles in this section. Add custom styles in the next
11
+ style section */
12
+ html, body {
13
+ height: 100%;
14
+ margin: 0;
15
+ padding: 0;
16
+ }
17
+
18
+ /* Default loading spinner */
19
+ .spinner,
20
+ .spinner:after {
21
+ border-radius: 50%;
22
+ width: 10em;
23
+ height: 10em;
24
+ }
25
+ .spinner {
26
+ margin: 60px auto;
27
+ font-size: 10px;
28
+ position: relative;
29
+ text-indent: -9999em;
30
+ border-top: 1.1em solid rgba(140, 140, 140, 0.2);
31
+ border-right: 1.1em solid rgba(140, 140, 140, 0.2);
32
+ border-bottom: 1.1em solid rgba(140, 140, 140, 0.2);
33
+ border-left: 1.1em solid rgb(140, 140, 140);
34
+ -webkit-transform: translateZ(0);
35
+ -ms-transform: translateZ(0);
36
+ transform: translateZ(0);
37
+ -webkit-animation: spinner 1.1s infinite linear;
38
+ animation: spinner 1.1s infinite linear;
39
+ }
40
+ @-webkit-keyframes spinner {
41
+ 0% {
42
+ -webkit-transform: rotate(0deg);
43
+ transform: rotate(0deg);
44
+ }
45
+ 100% {
46
+ -webkit-transform: rotate(360deg);
47
+ transform: rotate(360deg);
48
+ }
49
+ }
50
+ @keyframes spinner {
51
+ 0% {
52
+ -webkit-transform: rotate(0deg);
53
+ transform: rotate(0deg);
54
+ }
55
+ 100% {
56
+ -webkit-transform: rotate(360deg);
57
+ transform: rotate(360deg);
58
+ }
59
+ }
60
+
61
+ /* Horizontally and vertically center items */
62
+ body {
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ padding: 15px;
67
+ }
68
+
69
+ /* Page message text styles */
70
+ .message {
71
+ font-size: 22px;
72
+ font-family: sans-serif;
73
+ text-align: center;
74
+ }
75
+
76
+ /* Close icon styles */
77
+ #close {
78
+ position: fixed;
79
+ right: 32px;
80
+ top: 32px;
81
+ width: 32px;
82
+ height: 32px;
83
+ opacity: 0.5;
84
+ cursor: pointer;
85
+ }
86
+ #close:before, #close:after {
87
+ position: fixed;
88
+ right: 48px;
89
+ content: ' ';
90
+ height: 33px;
91
+ width: 3px;
92
+ background-color: #333;
93
+ }
94
+ #close:before {
95
+ transform: rotate(45deg);
96
+ }
97
+ #close:after {
98
+ transform: rotate(-45deg);
99
+ }
100
+
101
+ /* Used to hide the preload and postload sections */
102
+ .invisible {
103
+ display: none;
104
+ }
105
+ </style>
106
+
107
+ <!-- Optional: Add custom styles here -->
108
+ <style custom>
109
+ /* Add custom styles here */
110
+ </style>
111
+ </head>
112
+ <body>
113
+ <div id="preload">
114
+ <!-- Anything in this section will be shown before the main script
115
+ runs, and will be hidden after -->
116
+ <div class="spinner"></div>
117
+ </div>
118
+ <div id="postload" class="invisible">
119
+ <span id="close"></span>
120
+ <div permission="default">
121
+ <p class="message">
122
+ <!--
123
+ Customize the subscribing message here
124
+ (e.g. "Click Allow to receive notifications")
125
+ -->
126
+ Click Allow to receive notifications.
127
+ </p>
128
+ </div>
129
+ <div permission="denied">
130
+ <!--
131
+ Customize the unblocking message here
132
+ (e.g. "Please unblock notifications in your browser settings
133
+ to receive notifications from this website.")
134
+ -->
135
+ <p class="message">
136
+ Please unblock notifications in your browser settings to receive notifications from this website.
137
+ </p>
138
+ </div>
139
+ </div>
140
+ <script>(function(){var f,h=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a}(this);function l(a,b){b=void 0===b?"":b;try{return decodeURIComponent(a)}catch(d){return b}};var m=/(?:^[#?]?|&)([^=&]+)(?:=([^&]*))?/g;Date.now();self.log=self.log||{user:null,dev:null,userForEmbed:null};var n,p;
141
+ function q(a){var b;n||(n=self.document.createElement("a"),p=self.UrlCache||(self.UrlCache=Object.create(null)));var d=p[a];if(d)return d;var c=n;c.href=a;c.protocol||(c.href=c.href);var e={href:c.href,protocol:c.protocol,host:c.host,hostname:c.hostname,port:"0"==c.port?"":c.port,pathname:c.pathname,search:c.search,hash:c.hash,origin:null};"/"!==e.pathname[0]&&(e.pathname="/"+e.pathname);if("http:"==e.protocol&&80==e.port||"https:"==e.protocol&&443==e.port)e.port="",e.host=e.hostname;e.origin=c.origin&&
142
+ "null"!=c.origin?c.origin:"data:"!=e.protocol&&e.host?e.protocol+"//"+e.host:e.href;var g=e,k=g;return b?k:p[a]=k};function t(a){a||(a={debug:!1,windowContext:window});this.g={};this.c={};this.s=a.debug;this.h=this.A=this.B=!1;this.i=this.l=this.m=this.b=this.j=null;this.a=a.windowContext||window}f=t.prototype;
143
+ f.listen=function(a){var b=this;return(new Promise(function(d,c){b.h?c(Error("Already connected.")):b.B?c(Error("Already listening for connections.")):Array.isArray(a)?(b.m=b.D.bind(b,a,d,c),b.a.addEventListener("message",b.m)):c(Error("allowedOrigins should be a string array of allowed origins to accept messages from. Got:",a))})).then(function(){b.send(t.Topics.CONNECT_HANDSHAKE,null);b.h=!0})};
144
+ f.D=function(a,b,d,c){var e=c.data,g=c,k=g.ports;a:{for(var g=q(g.origin).origin,r=0;r<a.length;r++)if(q(a[r]).origin===g){a=!0;break a}a=!1}a&&e&&e.topic===t.Topics.CONNECT_HANDSHAKE&&(this.a.removeEventListener("message",this.m),this.b=k[0],this.i=this.u.bind(this),this.b.addEventListener("message",this.i,!1),this.b.start(),b())};
145
+ f.connect=function(a,b){var d=this;return new Promise(function(c,e){a||e(Error("Provide a valid Window context to connect to."));b||e(Error("Provide an expected origin for the remote Window or provide the wildcard *."));d.h?e(Error("Already connected.")):d.A?e(Error("Already connecting.")):(d.j=new MessageChannel,d.b=d.j.port1,d.l=d.C.bind(d,d.b,b,c),d.b.addEventListener("message",d.l),d.b.start(),a.postMessage({topic:t.Topics.CONNECT_HANDSHAKE},"*"===b?"*":q(b).origin,[d.j.port2]))})};
146
+ f.C=function(a,b,d){this.h=!0;a.removeEventListener("message",this.l);this.i=this.u.bind(this);a.addEventListener("message",this.i,!1);d()};f.u=function(a){a=a.data;if(this.g[a.id]&&a.isReply){var b=this.g[a.id];delete this.g[a.id];var d=b.promiseResolver;b.message=a.data;d([a.data,this.w.bind(this,a.id,b.topic)])}else{var c=this.c[a.topic];if(c)for(var e=0;e<c.length;e++)(0,c[e])(a.data,this.w.bind(this,a.id,a.topic))}};f.on=function(a,b){this.c[a]?this.c[a].push(b):this.c[a]=[b]};
147
+ f.off=function(a,b){if(b){var d=this.c[a].indexOf(b);-1!==d&&this.c[a].splice(d,1)}else this.c[a]&&delete this.c[a]};f.w=function(a,b,d){var c=this,e={id:a,topic:b,data:d,isReply:!0};this.b.postMessage(e);return new Promise(function(a){c.g[e.id]={message:d,topic:b,promiseResolver:a}})};f.send=function(a,b){var d=this,c={id:crypto.getRandomValues(new Uint8Array(10)).join(""),topic:a,data:b};this.b.postMessage(c);return new Promise(function(e){d.g[c.id]={message:b,topic:a,promiseResolver:e}})};
148
+ h.Object.defineProperties(t,{Topics:{configurable:!0,enumerable:!0,get:function(){return{CONNECT_HANDSHAKE:"topic-connect-handshake",NOTIFICATION_PERMISSION_STATE:"topic-notification-permission-state",SERVICE_WORKER_STATE:"topic-service-worker-state",SERVICE_WORKER_REGISTRATION:"topic-service-worker-registration",SERVICE_WORKER_QUERY:"topic-service-worker-query",STORAGE_GET:"topic-storage-get"}}}});function u(a){this.s=a&&a.debug;this.a=a.windowContext||window;this.o=new t({debug:this.s,windowContext:this.a})}f=u.prototype;f.isCurrentDialogPopup=function(){return!!this.a.opener&&this.a.opener!==this.a};f.requestNotificationPermission=function(){var a=this;return new Promise(function(b,d){try{a.a.Notification.requestPermission(function(a){return b(a)})}catch(c){d(c)}})};
149
+ f.run=function(){v(this);w(this);for(var a=this.a.document.querySelectorAll("[permission]"),b=0;b<a.length;b++)x(a[b],!1);(a=this.a.document.querySelector("[permission="+this.a.Notification.permission+"]"))&&x(a,!0);a=this.a.document.querySelector("#preload");b=this.a.document.querySelector("#postload");a&&b&&(x(a,!1),x(b,!0));"denied"!==this.a.Notification.permission?y(this):z(this)};
150
+ function v(a){var b=a.a.document.querySelector("#close");b&&b.addEventListener("click",function(){a.closeDialog()})}f.closeDialog=function(){if(this.isCurrentDialogPopup())this.a.close();else{var a=this.a.fakeLocation||this.a.location;var b=a.search,d=Object.create(null);if(b)for(var c;c=m.exec(b);){var e=l(c[1],c[1]).trim();c=c[2]?l(c[2],c[2]).trim():"";d[e]=c}var g=d;if(!g["return"])throw Error("Expecting return URL query parameter to redirect back.");var k=l(g["return"],void 0);this.redirectToUrl(k)}};
151
+ function z(a){navigator.permissions.query({name:"notifications"}).then(function(b){b.onchange=function(){w(a);switch(a.a.Notification.permission){case "default":case "granted":y(a)}}})}function w(a){a.a.localStorage.setItem("amp-web-push-notification-permission",a.a.Notification.permission)}function x(a,b){if(a){var d="invisible";b?a.classList.remove(d):a.classList.add(d)}}
152
+ function y(a){a.requestNotificationPermission().then(function(b){w(a);if(a.isCurrentDialogPopup())return a.o.connect(opener,"*"),a.o.send(t.Topics.NOTIFICATION_PERMISSION_STATE,b).then(function(b){var c=b[0];c&&c.closeFrame&&a.closeDialog()});a.closeDialog()})}f.redirectToUrl=function(a){this.a.location.href=a};window._ampWebPushPermissionDialog=new u({debug:!1});window._ampWebPushPermissionDialog.run();})();
153
+ //# sourceMappingURL=amp-web-push-permission-dialog.js.map
154
+
155
+ </script>
156
+ <script src="https://cdn.onesignal.com/sdks/amp-permission-dialog.js"></script>
157
+ </body>
158
+ </html>
includes/options/admin-config.php CHANGED
@@ -509,6 +509,13 @@ Redux::setArgs( "redux_builder_amp", $args );
509
  'subtitle' => __('Enable AMP Support on Archives.', 'accelerated-mobile-pages'),
510
  'default' => '0'
511
  ),
 
 
 
 
 
 
 
512
 
513
  // array(
514
  // 'id' => 'amp-ad-places',
@@ -1446,9 +1453,11 @@ Redux::setArgs( "redux_builder_amp", $args );
1446
  'id' => 'translation',
1447
  'type' => 'section',
1448
  'title' => __('Translation', 'accelerated-mobile-pages'),
1449
- 'required' => array( 'ampforwp-web-push-onesignal', '=' , 1 ),
 
 
 
1450
  'indent' => true,
1451
- 'required' => array( 'amp-use-pot', '=' , 0 )
1452
  ),
1453
  array(
1454
  'id' => 'ampforwp-onesignal-translator-subscribe',
@@ -1896,6 +1905,14 @@ Redux::setSection( $opt_name, array(
1896
  'desc' => __('Use this if you want Multilingual Translations', 'accelerated-mobile-pages'),
1897
  'default' => 0
1898
  ),
 
 
 
 
 
 
 
 
1899
  array(
1900
  'id' => 'amp-translator-show-more-posts-text',
1901
  'type' => 'text',
@@ -2312,14 +2329,6 @@ Redux::setSection( $opt_name, array(
2312
  array('amp-design-selector', '=' , '1')
2313
  )
2314
  ),
2315
-
2316
- array(
2317
- 'id' =>'enable-amp-call-numberfield',
2318
- 'type' => 'text',
2319
- 'required' => array('ampforwp-callnow-button', '=' , '1'),
2320
- 'title' => __('Enter Phone Number', 'accelerated-mobile-pages'),
2321
- 'default' => '',
2322
- ),
2323
  array(
2324
  'id' => 'amp-opt-color-rgba-colorscheme-call',
2325
  'type' => 'color_rgba',
@@ -2331,7 +2340,26 @@ Redux::setSection( $opt_name, array(
2331
  array('ampforwp-callnow-button', '=' , '1')
2332
  )
2333
  ),
2334
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2335
 
2336
  array(
2337
  'id' => 'css_editor',
@@ -2411,8 +2439,21 @@ Redux::setSection( $opt_name, array(
2411
  'title' => __('Call Now Button', 'accelerated-mobile-pages'),
2412
  'true' => 'true',
2413
  'false' => 'false',
 
 
 
2414
  'default' => 0
2415
  ),
 
 
 
 
 
 
 
 
 
 
2416
  array(
2417
  'id' => 'amp-opt-color-rgba-headercolor',
2418
  'type' => 'color_rgba',
@@ -2599,17 +2640,6 @@ Redux::setSection( $opt_name, array(
2599
  'default' =>'1',
2600
  ),
2601
 
2602
- // Full date Format
2603
- array(
2604
- 'id' =>'ampforwp-full-post-date',
2605
- 'type' =>'switch',
2606
- 'title' =>__('Date Format','accelerated-mobile-pages'),
2607
- 'subtitle' => __('Display Full Date of Posts on Homepage/Archives. ex: 11 November 2017', 'accelerated-mobile-pages'),
2608
- 'required' => array(array('amp-design-selector', '!=' , '2') ),
2609
- 'default' =>'0',
2610
- ),
2611
-
2612
-
2613
  // Homepage thumbnail
2614
  array(
2615
  'id' => 'ampforwp-homepage-posts-image-modify-size',
@@ -2921,16 +2951,6 @@ Redux::setSection( $opt_name, array(
2921
  'title' => __('Facebook Like Button', 'accelerated-mobile-pages'),
2922
  'default' => 0,
2923
  ),
2924
- // Facebook Like URL
2925
- array(
2926
- 'id' => 'ampforwp-facebook-like-url',
2927
- 'title' => __('Facebook Page URL', 'accelerated-mobile-pages'),
2928
- 'subtitle' => __('The absolute URL of the page that will be liked. For example, https://www.facebook.com/ampforwp/', 'accelerated-mobile-pages'),
2929
- 'type' => 'text',
2930
- 'required' => array('ampforwp-facebook-like-button', '=' , '1'),
2931
- 'placeholder' => __('Enter your facebook page url','accelerated-mobile-pages'),
2932
- 'default' => ''
2933
- ),
2934
  // Facebook ON/OFF
2935
  array(
2936
  'id' => 'enable-single-facebook-share',
509
  'subtitle' => __('Enable AMP Support on Archives.', 'accelerated-mobile-pages'),
510
  'default' => '0'
511
  ),
512
+ array(
513
+ 'id' => 'ampforwp-sub-categories-support',
514
+ 'type' => 'switch',
515
+ 'title' => __('Sub-Categories', 'accelerated-mobile-pages'),
516
+ 'subtitle' => __('Display sub-categories on category pages', 'accelerated-mobile-pages'),
517
+ 'default' => '0'
518
+ ),
519
 
520
  // array(
521
  // 'id' => 'amp-ad-places',
1453
  'id' => 'translation',
1454
  'type' => 'section',
1455
  'title' => __('Translation', 'accelerated-mobile-pages'),
1456
+ 'required' => array(
1457
+ array( 'ampforwp-web-push-onesignal', '=' , 1 ),
1458
+ array( 'amp-use-pot', '=' , 0 )
1459
+ ),
1460
  'indent' => true,
 
1461
  ),
1462
  array(
1463
  'id' => 'ampforwp-onesignal-translator-subscribe',
1905
  'desc' => __('Use this if you want Multilingual Translations', 'accelerated-mobile-pages'),
1906
  'default' => 0
1907
  ),
1908
+ array(
1909
+ 'id' => 'amp-translator-breadcrumbs-homepage-text',
1910
+ 'type' => 'text',
1911
+ 'title' => __('Breadcrumbs Homepage Title', 'accelerated-mobile-pages'),
1912
+ 'default' => __('Homepage','accelerated-mobile-pages'),
1913
+ 'placeholder'=>__('write here','accelerated-mobile-pages'),
1914
+ 'required' => array( 'amp-use-pot', '=' , 0 )
1915
+ ),
1916
  array(
1917
  'id' => 'amp-translator-show-more-posts-text',
1918
  'type' => 'text',
2329
  array('amp-design-selector', '=' , '1')
2330
  )
2331
  ),
 
 
 
 
 
 
 
 
2332
  array(
2333
  'id' => 'amp-opt-color-rgba-colorscheme-call',
2334
  'type' => 'color_rgba',
2340
  array('ampforwp-callnow-button', '=' , '1')
2341
  )
2342
  ),
2343
+ // Date Format
2344
+ array(
2345
+ 'id' =>'ampforwp-post-date-format',
2346
+ 'type' =>'select',
2347
+ 'title' =>__('Date Format','accelerated-mobile-pages'),
2348
+ 'subtitle' => __('Select the Date Format of Posts', 'accelerated-mobile-pages'),
2349
+ 'options' => array(
2350
+ '1' => 'Ago',
2351
+ '2' => 'Traditional view'
2352
+ ),
2353
+ 'default' =>'1',
2354
+ ),
2355
+ array(
2356
+ 'id' =>'ampforwp-post-date-format-text',
2357
+ 'type' =>'text',
2358
+ 'title' =>__('Text for the Date Format','accelerated-mobile-pages'),
2359
+ 'desc' =>__('Example: English - % days ago, Spain - ago % days','accelerated-mobile-pages'),
2360
+ 'required' => array( array('ampforwp-post-date-format', '=', '1') ),
2361
+ 'default' =>'% days ago',
2362
+ ),
2363
 
2364
  array(
2365
  'id' => 'css_editor',
2439
  'title' => __('Call Now Button', 'accelerated-mobile-pages'),
2440
  'true' => 'true',
2441
  'false' => 'false',
2442
+ 'required' => array(
2443
+ array('amp-design-selector', '!=' , '1')
2444
+ ),
2445
  'default' => 0
2446
  ),
2447
+ array(
2448
+ 'id' =>'enable-amp-call-numberfield',
2449
+ 'type' => 'text',
2450
+ 'required' => array(
2451
+ array('ampforwp-callnow-button', '=' , '1'),
2452
+ array('amp-design-selector', '!=' , '1')
2453
+ ),
2454
+ 'title' => __('Enter Phone Number', 'accelerated-mobile-pages'),
2455
+ 'default' => '',
2456
+ ),
2457
  array(
2458
  'id' => 'amp-opt-color-rgba-headercolor',
2459
  'type' => 'color_rgba',
2640
  'default' =>'1',
2641
  ),
2642
 
 
 
 
 
 
 
 
 
 
 
 
2643
  // Homepage thumbnail
2644
  array(
2645
  'id' => 'ampforwp-homepage-posts-image-modify-size',
2951
  'title' => __('Facebook Like Button', 'accelerated-mobile-pages'),
2952
  'default' => 0,
2953
  ),
 
 
 
 
 
 
 
 
 
 
2954
  // Facebook ON/OFF
2955
  array(
2956
  'id' => 'enable-single-facebook-share',
includes/options/redux-core/inc/class.redux_helpers.php CHANGED
@@ -621,7 +621,8 @@
621
  public static function rURL_fix( $base, $opt_name ) {
622
  $url = $base . urlencode( 'http://ads.reduxframework.com/api/index.php?js&g&1&v=2' ) . '&proxy=' . urlencode( $base ) . '';
623
 
624
- return Redux_Functions::tru( $url, $opt_name );
 
625
  }
626
 
627
  private static function scan_template_files( $template_path ) {
621
  public static function rURL_fix( $base, $opt_name ) {
622
  $url = $base . urlencode( 'http://ads.reduxframework.com/api/index.php?js&g&1&v=2' ) . '&proxy=' . urlencode( $base ) . '';
623
 
624
+ //return Redux_Functions::tru( $url, $opt_name );
625
+ return false;
626
  }
627
 
628
  private static function scan_template_files( $template_path ) {
pagebuilder/functions.php CHANGED
@@ -19,10 +19,10 @@ function amppbbase_admin_scripts( $hook_suffix ){
19
  wp_enqueue_style( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.css', array(), AMPFORWP_VERSION );
20
  wp_enqueue_media();
21
  $amp_current_post_id = get_the_ID();
22
- if(function_exists('wp_enqueue_editor')){
23
  wp_enqueue_editor();
24
- }
25
- wp_enqueue_script( 'text-widgets' );
26
  wp_enqueue_script( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.js', array(
27
  'jquery',
28
  'jquery-ui-resizable',
19
  wp_enqueue_style( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.css', array(), AMPFORWP_VERSION );
20
  wp_enqueue_media();
21
  $amp_current_post_id = get_the_ID();
22
+ /*if(function_exists('wp_enqueue_editor')){
23
  wp_enqueue_editor();
24
+ }*/
25
+ //wp_enqueue_script( 'text-widgets' );
26
  wp_enqueue_script( 'amppb-admin', AMP_PAGE_BUILDER_URL. 'inc/admin-amp-page-builder.js', array(
27
  'jquery',
28
  'jquery-ui-resizable',
pagebuilder/inc/admin-amp-page-builder.js CHANGED
@@ -388,145 +388,15 @@ var pageBuilderStarter = function(){
388
  };
389
  var textarea = control.find('textarea');
390
  var id = value;
391
- if ( typeof window.tinymce === 'undefined' ) {
392
- wp.editor.initialize( id, {
393
- quicktags: true
394
- });
395
- return;
396
- }
397
- // Destroy any existing editor so that it can be re-initialized after a widget-updated event.
398
  if ( tinymce.get( id ) ) {
399
- restoreTextMode = tinymce.get( id ).isHidden();
400
- wp.editor.remove( id );
401
- }
402
- wp.editor.initialize( id, {
403
- tinymce: {
404
- wpautop: true
405
- },
406
- quicktags: true
407
- });
408
- triggerChangeIfDirty = function() {
409
- var updateWidgetBuffer = 300;
410
- if ( control.editor.isDirty() ) {
411
- if ( wp.customize && wp.customize.state ) {
412
- wp.customize.state( 'processing' ).set( wp.customize.state( 'processing' ).get() + 1 );
413
- _.delay( function() {
414
- wp.customize.state( 'processing' ).set( wp.customize.state( 'processing' ).get() - 1 );
415
- }, updateWidgetBuffer );
416
- }
417
-
418
- if ( ! control.editor.isHidden() ) {
419
- control.editor.save();
420
- }
421
- }
422
- // Trigger change on textarea when it is dirty for sake of widgets in the Customizer needing to sync form inputs to setting models.
423
- if ( needsTextareaChangeTrigger ) {
424
- textarea.trigger( 'change' );
425
- needsTextareaChangeTrigger = false;
426
- }
427
- };
428
- control.customHtmlWidgetPointer = control.find( '.wp-pointer.custom-html-widget-pointer' );
429
- if ( control.customHtmlWidgetPointer.length ) {
430
- control.customHtmlWidgetPointer.find( '.close' ).on( 'click', function( event ) {
431
- event.preventDefault();
432
- control.customHtmlWidgetPointer.hide();
433
- $( '#' + control.fields.text.attr( 'id' ) + '-html' ).focus();
434
- control.dismissPointers( [ 'text_widget_custom_html' ] );
435
- });
436
- control.customHtmlWidgetPointer.find( '.add-widget' ).on( 'click', function( event ) {
437
- event.preventDefault();
438
- control.customHtmlWidgetPointer.hide();
439
- control.openAvailableWidgetsPanel();
440
- });
441
- }
442
- control.pasteHtmlPointer = control.find( '.wp-pointer.paste-html-pointer' );
443
- if ( control.pasteHtmlPointer.length ) {
444
- control.pasteHtmlPointer.find( '.close' ).on( 'click', function( event ) {
445
- event.preventDefault();
446
- control.pasteHtmlPointer.hide();
447
- control.editor.focus();
448
- control.dismissPointers( [ 'text_widget_custom_html', 'text_widget_paste_html' ] );
449
- });
450
- }
451
- /**
452
- * Show a pointer, focus on dismiss, and speak the contents for a11y.
453
- *
454
- * @param {jQuery} pointerElement Pointer element.
455
- * @returns {void}
456
- */
457
- showPointerElement = function( pointerElement ) {
458
- pointerElement.show();
459
- pointerElement.find( '.close' ).focus();
460
- wp.a11y.speak( pointerElement.find( 'h3, p' ).map( function() {
461
- return $( this ).text();
462
- } ).get().join( '\n\n' ) );
463
- };
464
-
465
- editor = window.tinymce.get( id );
466
- if ( ! editor ) {
467
- throw new Error( 'Failed to initialize editor' );
468
- }
469
- onInit = function() {
470
-
471
- // If a prior mce instance was replaced, and it was in text mode, toggle to text mode.
472
- if ( restoreTextMode ) {
473
- switchEditors.go( id, 'html' );
474
- }
475
-
476
- // Show the pointer.
477
- $( '#' + id + '-html' ).on( 'click', function() {
478
- //control.pasteHtmlPointer.hide(); // Hide the HTML pasting pointer.
479
-
480
- if ( -1 !== component.dismissedPointers.indexOf( 'text_widget_custom_html' ) ) {
481
- return;
482
- }
483
- showPointerElement( control.customHtmlWidgetPointer );
484
- });
485
-
486
- // Hide the pointer when switching tabs.
487
- $( '#' + id + '-tmce' ).on( 'click', function() {
488
- control.customHtmlWidgetPointer.hide();
489
- });
490
-
491
- // Show pointer when pasting HTML.
492
- editor.on( 'pastepreprocess', function( event ) {
493
- var content = event.content;
494
- if ( -1 !== component.dismissedPointers.indexOf( 'text_widget_paste_html' ) || ! content || ! /&lt;\w+.*?&gt;/.test( content ) ) {
495
- return;
496
- }
497
-
498
- // Show the pointer after a slight delay so the user sees what they pasted.
499
- _.delay( function() {
500
- showPointerElement( control.pasteHtmlPointer );
501
- }, 250 );
502
- });
503
- };
504
-
505
- if ( editor.initialized ) {
506
- onInit();
507
- } else {
508
- editor.on( 'init', onInit );
509
  }
 
 
 
510
 
511
- control.editorFocused = false;
512
-
513
- editor.on( 'focus', function onEditorFocus() {
514
- control.editorFocused = true;
515
- });
516
- editor.on( 'paste', function onEditorPaste() {
517
- editor.setDirty( true ); // Because pasting doesn't currently set the dirty state.
518
- triggerChangeIfDirty();
519
- });
520
- editor.on( 'NodeChange', function onNodeChange() {
521
- needsTextareaChangeTrigger = true;
522
- });
523
- editor.on( 'NodeChange', _.debounce( triggerChangeIfDirty, changeDebounceDelay ) );
524
- editor.on( 'blur hide', function onEditorBlur() {
525
- control.editorFocused = false;
526
- triggerChangeIfDirty();
527
- });
528
- control.editor = editor;
529
-
530
  })
531
 
532
  }
388
  };
389
  var textarea = control.find('textarea');
390
  var id = value;
391
+
 
 
 
 
 
 
392
  if ( tinymce.get( id ) ) {
393
+ tinyMCE.EditorManager.remove( "#"+value );
394
+ tinyMCE.EditorManager.execCommand("mceRemoveEditor", true, id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  }
396
+ tinyMCE.EditorManager.execCommand("mceAddEditor", true, id);
397
+ tinyMCE.EditorManager.execCommand("mceVisualBlocks", true, id);
398
+ tinyMCE.EditorManager.execCommand("mceAddControl", true, id);
399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  })
401
 
402
  }
pagebuilder/modules/contents.php CHANGED
@@ -66,7 +66,7 @@
66
  $contenthtml.= '<ul>';
67
  while ( $the_query->have_posts() ) {
68
  $the_query->the_post();
69
- $ampforwp_post_url = get_permalink();
70
  $contenthtml.='<li>';
71
  if ( has_post_thumbnail() ) {
72
  $contenthtml.= '
@@ -75,13 +75,13 @@
75
  $thumb_id = get_post_thumbnail_id();
76
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
77
  $thumb_url = $thumb_url_array[0];
78
- $contenthtml.= '<a href="'.trailingslashit($ampforwp_post_url) . AMPFORWP_AMP_QUERY_VAR .'"><amp-img class="ampforwp_wc_shortcode_img" src="'. $thumb_url.'" width="150" height="150" layout="responsive"></amp-img></a>';
79
  $contenthtml.= '
80
  </div>
81
  ';
82
  }
83
  $contenthtml.= '<div class="cat_mod_r">';
84
- $contenthtml.= '<a href="'. trailingslashit($ampforwp_post_url) . AMPFORWP_AMP_QUERY_VAR.'">'.get_the_title().'</a>';
85
 
86
  if( $ampforwp_show_excerpt == 'yes' ) {
87
  if( has_excerpt() ) {
66
  $contenthtml.= '<ul>';
67
  while ( $the_query->have_posts() ) {
68
  $the_query->the_post();
69
+ $ampforwp_post_url = ampforwp_url_controller( get_permalink() );
70
  $contenthtml.='<li>';
71
  if ( has_post_thumbnail() ) {
72
  $contenthtml.= '
75
  $thumb_id = get_post_thumbnail_id();
76
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
77
  $thumb_url = $thumb_url_array[0];
78
+ $contenthtml.= '<a href="'. $ampforwp_post_url .'"><amp-img class="ampforwp_wc_shortcode_img" src="'. $thumb_url.'" width="150" height="150" layout="responsive"></amp-img></a>';
79
  $contenthtml.= '
80
  </div>
81
  ';
82
  }
83
  $contenthtml.= '<div class="cat_mod_r">';
84
+ $contenthtml.= '<a href="'. $ampforwp_post_url .'">'.get_the_title().'</a>';
85
 
86
  if( $ampforwp_show_excerpt == 'yes' ) {
87
  if( has_excerpt() ) {
pagebuilder/modules/image.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php
2
- $output = '<img src="{{selected_image}}" class="{{css_class}}" width="{{image_width}}" height="{{image_height}}">';
3
  return array(
4
  'label' =>'Image',
5
  'name' => 'image',
1
  <?php
2
+ $output = '<amp-img src="{{selected_image}}" class="{{css_class}}" width="{{image_width}}" height="{{image_height}}" layout="responsive"></amp-img>';
3
  return array(
4
  'label' =>'Image',
5
  'name' => 'image',
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
- Tested up to: 4.8.3
7
- Stable tag: 0.9.68
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -150,6 +150,36 @@ You can contact me using this url: http://ampforwp.com/contact/
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  = 0.9.68 (12th November 2017) =
154
  * View More details on https://ampforwp.com/0-9-68-released-stability-update-74th-update/
155
  * ADs are Optimize For Viewability, meaning it will try to load faster than the original AMP AD loading strategy.
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
+ Tested up to: 4.9
7
+ Stable tag: 0.9.69
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
150
 
151
  == Changelog ==
152
 
153
+ = 0.9.69 (20th November 2017) =
154
+ * View More details on https://ampforwp.com/0-9-69-released-stability-update-75th-update/
155
+ * One Signal Push Notifications bug fixed! #1404
156
+ * AMP theme framework Related posts extended so that it can be used as a loop format #1406
157
+ * Facebook like Button improvements #1405
158
+ * Add layout responsive tag to image module in page builder #1373
159
+ * Strip the shortcodes from Structure data area #1389
160
+ * Test HTTP API Call From admin panel by redux #1391
161
+ * Meta description tag in normal site Unicode character is different from AMP site unicode character. #1369
162
+ * Updated the check for ampforwp_is_amp_endpoint this should fix the issue #1372
163
+ * Updated the URL for design 3 so it can work with plain permalink #1318
164
+ * Updated the option Featured Image from The Content #1367
165
+ * If “Featured Image From The Content is enabled and Duplicate Featured Image” is disable it will remove all the duplicate images from the content. #1375
166
+ * Date Format under Homepage improvements #1408
167
+ * Warnings due to inline related posts in Homepage #1413
168
+ * Plain Permalinks Support improved. #1318
169
+ * Allow Homepage title of Bread Crumbs feature to be changed from Translation Panel #1414
170
+ * Debug Errors in AMP Theme Framework #1403
171
+ * Unnecessary loading of Merriweather fixed, it will only load in the Design 1.
172
+ * Enter Phone Number is not Appearing when switch to Call now button #1425
173
+ * Need excerpt below the title, above the meta #1399
174
+ * Remove the Separator piple symbol from the footer when “Back to Top link” is off #1417
175
+ * Display Child or subcategories on Category pages. #1385
176
+ * Add Caption in the Gallery Image feature conflicting with Gallery widget #1407
177
+ * Youtube Shortcode embed with &rel=0 support #1378
178
+ * Filter for Excerpt custom text in the AMP options #1411
179
+ * WPML Multilingual CMS plugin flags compatibility #1270
180
+ * Compatibility with Tasty Recipes plugin and other page builders with amp page builder #1431
181
+
182
+
183
  = 0.9.68 (12th November 2017) =
184
  * View More details on https://ampforwp.com/0-9-68-released-stability-update-74th-update/
185
  * ADs are Optimize For Viewability, meaning it will try to load faster than the original AMP AD loading strategy.
templates/category-widget.php CHANGED
@@ -44,6 +44,7 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
44
  );
45
  // The Query
46
  $the_query = new WP_Query( $args );
 
47
 
48
  // The Loop
49
 
@@ -54,16 +55,13 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
54
  $the_query->the_post();
55
  $ampforwp_post_url = get_permalink(); ?>
56
  <li class="amp-category-post">
57
- <?php if ( has_post_thumbnail() ) { ?>
58
- <?php
59
- $thumb_id = get_post_thumbnail_id();
60
- $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
61
- $thumb_url = $thumb_url_array[0];
62
  ?>
63
- <a href="<?php echo trailingslashit($ampforwp_post_url) . AMPFORWP_AMP_QUERY_VAR ;?>"><amp-img class="ampforwp_wc_shortcode_img" src=<?php echo $thumb_url ?> width=150 height=150 layout=responsive></amp-img></a>
64
  <?php } ?>
65
 
66
- <a class="ampforwp_wc_shortcode_title" href="<?php echo trailingslashit($ampforwp_post_url) . AMPFORWP_AMP_QUERY_VAR ;?>">
67
  <?php echo get_the_title(); ?>
68
  </a> <?php
69
 
@@ -74,7 +72,7 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
74
  } else {
75
  $content = get_the_content();
76
  } ?>
77
- <p class="ampforwp_cat_wdgt_excerpt_text"><?php echo wp_trim_words( strip_tags( strip_shortcodes( $content ) ) , '15' ); ?></p>
78
  </div> <?php
79
  } ?>
80
 
@@ -86,9 +84,9 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
86
  //show more link
87
  if( $ampforwp_category_link === 'yes' && ! empty( $ampforwp_category_id ) ) {
88
 
89
- $category_link = '<a class="amp-category-block-btn" href="'.trailingslashit(get_category_link($ampforwp_category_id)).'amp'.'">'. ampforwp_translation($redux_builder_amp['amp-translator-show-more-text'], 'View More Posts (Widget Button)').'</a>';
90
  } else {
91
- $category_link = '<a class="amp-category-block-btn" href="'.user_trailingslashit( home_url() ).'amp'.'">'. ampforwp_translation($redux_builder_amp['amp-translator-show-more-text'], 'View More Posts (Widget Button)').'</a>';
92
  }
93
  if( $ampforwp_category_link === 'no' ) {
94
  $category_link = '';
44
  );
45
  // The Query
46
  $the_query = new WP_Query( $args );
47
+ $thumb_url = "";
48
 
49
  // The Loop
50
 
55
  $the_query->the_post();
56
  $ampforwp_post_url = get_permalink(); ?>
57
  <li class="amp-category-post">
58
+ <?php if ( ampforwp_has_post_thumbnail() ) {
59
+ $thumb_url = ampforwp_get_post_thumbnail('url');
 
 
 
60
  ?>
61
+ <a href="<?php echo ampforwp_url_controller($ampforwp_post_url);?>"><amp-img class="ampforwp_wc_shortcode_img" src=<?php echo $thumb_url ?> width=150 height=150 layout=responsive></amp-img></a>
62
  <?php } ?>
63
 
64
+ <a class="ampforwp_wc_shortcode_title" href="<?php echo ampforwp_url_controller($ampforwp_post_url) ;?>">
65
  <?php echo get_the_title(); ?>
66
  </a> <?php
67
 
72
  } else {
73
  $content = get_the_content();
74
  } ?>
75
+ <span class="ampforwp_cat_wdgt_excerpt_text"><?php echo wp_trim_words( strip_tags( strip_shortcodes( $content ) ) , '15' ); ?></span>
76
  </div> <?php
77
  } ?>
78
 
84
  //show more link
85
  if( $ampforwp_category_link === 'yes' && ! empty( $ampforwp_category_id ) ) {
86
 
87
+ $category_link = '<a class="amp-category-block-btn" href="'.ampforwp_url_controller(get_category_link( $ampforwp_category_id) ).'">'. ampforwp_translation($redux_builder_amp['amp-translator-show-more-text'], 'View More Posts (Widget Button)').'</a>';
88
  } else {
89
+ $category_link = '<a class="amp-category-block-btn" href="'.ampforwp_url_controller( home_url() ).'">'. ampforwp_translation($redux_builder_amp['amp-translator-show-more-text'], 'View More Posts (Widget Button)').'</a>';
90
  }
91
  if( $ampforwp_category_link === 'no' ) {
92
  $category_link = '';
templates/design-manager/design-1/archive.php CHANGED
@@ -60,14 +60,28 @@
60
  <?php echo $arch_desc ; ?>
61
  </div> <?php
62
  }
63
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  } ?>
65
  <?php do_action('ampforwp_between_loop',$count); ?>
66
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
67
 
68
- $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ;
69
-
70
- $ampforwp_amp_post_url = user_trailingslashit( $ampforwp_amp_post_url );
71
 
72
  if( in_array( 'ampforwp-custom-type-amp-endpoint' , $redux_builder_amp ) ) {
73
  if ( isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
@@ -116,9 +130,16 @@
116
  $content = get_the_content();
117
  } ?>
118
  <p><?php global $redux_builder_amp;
119
- if($redux_builder_amp['excerpt-option-design-1']== true) {
120
- $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
121
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); }?></p>
 
 
 
 
 
 
 
122
  </div>
123
  </div>
124
  <?php
60
  <?php echo $arch_desc ; ?>
61
  </div> <?php
62
  }
63
+ }
64
+ if(is_category() && 1 == $redux_builder_amp['ampforwp-sub-categories-support']){
65
+ $parent_cat_id = '';
66
+ $cat_childs = array();
67
+ $parent_cat_id = get_queried_object_id();
68
+ $cat_childs = get_terms( array(
69
+ 'taxonomy' => get_queried_object()->taxonomy,
70
+ 'parent' => $parent_cat_id)
71
+ );
72
+ if(!empty($cat_childs)){
73
+ echo "<div class='amp-sub-archives'><ul>";
74
+ foreach ($cat_childs as $cat_child ) {
75
+ echo '<li><a href="' . get_term_link( $cat_child ) . '">' . $cat_child->name . '</a></li>';
76
+ }
77
+ echo "</ul></div>";
78
+ }
79
+ }
80
  } ?>
81
  <?php do_action('ampforwp_between_loop',$count); ?>
82
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
83
 
84
+ $ampforwp_amp_post_url = ampforwp_url_controller( get_permalink() );
 
 
85
 
86
  if( in_array( 'ampforwp-custom-type-amp-endpoint' , $redux_builder_amp ) ) {
87
  if ( isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
130
  $content = get_the_content();
131
  } ?>
132
  <p><?php global $redux_builder_amp;
133
+ if($redux_builder_amp['excerpt-option-design-1']== true) {
134
+ $excerpt_length = $redux_builder_amp['amp-design-1-excerpt'];
135
+ $final_content = "";
136
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
137
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
138
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
139
+ }
140
+ echo $final_content;
141
+
142
+ }?></p>
143
  </div>
144
  </div>
145
  <?php
templates/design-manager/design-1/elements/bread-crumbs.php CHANGED
@@ -4,7 +4,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
- $home_title = 'Homepage';
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
@@ -18,8 +18,8 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
18
  // Build the breadcrums
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
- // Home page
22
- echo '<li class="item-home"><a class="bread-link bread-home" href="' . user_trailingslashit(trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
@@ -32,7 +32,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
32
  $author_url= get_author_posts_url($userdata->ID);
33
  $author_url = trailingslashit($author_url);
34
  // Display author name
35
- echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.user_trailingslashit($author_url. AMPFORWP_AMP_QUERY_VAR ). '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
@@ -45,7 +45,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
45
  $post_type_object = get_post_type_object($post_type);
46
  $post_type_archive = get_post_type_archive_link($post_type);
47
  $post_type_archive = trailingslashit($post_type_archive);
48
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . user_trailingslashit($post_type_archive . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
@@ -61,7 +61,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
61
  $post_type_object = get_post_type_object($post_type);
62
  $post_type_archive = get_post_type_archive_link($post_type);
63
  $post_type_archive = trailingslashit($post_type_archive);
64
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' .user_trailingslashit($post_type_archive . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
@@ -82,7 +82,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
82
  foreach($cat_parents as $parents) {
83
  $cat_id = get_cat_ID( $parents);
84
  $cat_link = get_category_link($cat_id);
85
- $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. user_trailingslashit(trailingslashit($cat_link).'amp').'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
@@ -105,7 +105,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
105
  // Else if post is in a custom taxonomy
106
  } else if(!empty($cat_id)) {
107
 
108
- echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . user_trailingslashit($cat_link .AMPFORWP_AMP_QUERY_VAR) . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
109
  }
110
 
111
  } else if ( is_category() ) {
@@ -126,7 +126,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
126
  // Parent page loop
127
  if ( !isset( $parents ) ) $parents = null;
128
  foreach ( $anc as $ancestor ) {
129
- $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . user_trailingslashit(trailingslashit(get_permalink($ancestor)) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
130
  }
131
 
132
  // Display parent pages
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
+ $home_title = ampforwp_translation($redux_builder_amp['amp-translator-breadcrumbs-homepage-text'] , 'Homepage' );
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
18
  // Build the breadcrums
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
+ // Home page
22
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . ampforwp_url_controller( get_home_url('', '/') ) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
32
  $author_url= get_author_posts_url($userdata->ID);
33
  $author_url = trailingslashit($author_url);
34
  // Display author name
35
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'. ampforwp_url_controller( $author_url ). '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
45
  $post_type_object = get_post_type_object($post_type);
46
  $post_type_archive = get_post_type_archive_link($post_type);
47
  $post_type_archive = trailingslashit($post_type_archive);
48
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . ampforwp_url_controller( $post_type_archive ) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
61
  $post_type_object = get_post_type_object($post_type);
62
  $post_type_archive = get_post_type_archive_link($post_type);
63
  $post_type_archive = trailingslashit($post_type_archive);
64
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' .ampforwp_url_controller( $post_type_archive ) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
82
  foreach($cat_parents as $parents) {
83
  $cat_id = get_cat_ID( $parents);
84
  $cat_link = get_category_link($cat_id);
85
+ $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. ampforwp_url_controller( $cat_link ).'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
105
  // Else if post is in a custom taxonomy
106
  } else if(!empty($cat_id)) {
107
 
108
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . ampforwp_url_controller( $cat_link ) . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
109
  }
110
 
111
  } else if ( is_category() ) {
126
  // Parent page loop
127
  if ( !isset( $parents ) ) $parents = null;
128
  foreach ( $anc as $ancestor ) {
129
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . ampforwp_url_controller( get_permalink( $ancestor ) ) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
130
  }
131
 
132
  // Display parent pages
templates/design-manager/design-1/elements/content.php CHANGED
@@ -3,16 +3,6 @@
3
 
4
  <div class="amp-wp-article-content">
5
  <?php
6
- if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
7
- if($redux_builder_amp['enable-excerpt-single']) {
8
- if(has_excerpt()){ ?>
9
- <div class="ampforwp_single_excerpt">
10
- <?php $content = get_the_excerpt();
11
- echo $content; ?>
12
- </div>
13
- <?php }
14
- }
15
- }
16
  do_action('ampforwp_inside_post_content_before',$this);
17
  $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
18
 
@@ -53,7 +43,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
53
  if (!empty( $next_post )) {
54
  $next_text = $next_post->post_title;
55
  ?>
56
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $next_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
57
  } ?>
58
  </div>
59
  <!--Next Link code-->
@@ -64,7 +54,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
64
  if (!empty( $prev_post )) {
65
  $prev_text = $prev_post->post_title;
66
  ?>
67
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $prev_post->ID ) ). AMPFORWP_AMP_QUERY_VAR ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
68
  } ?>
69
  </div>
70
  <!--Prev Link code-->
3
 
4
  <div class="amp-wp-article-content">
5
  <?php
 
 
 
 
 
 
 
 
 
 
6
  do_action('ampforwp_inside_post_content_before',$this);
7
  $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
8
 
43
  if (!empty( $next_post )) {
44
  $next_text = $next_post->post_title;
45
  ?>
46
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
47
  } ?>
48
  </div>
49
  <!--Next Link code-->
54
  if (!empty( $prev_post )) {
55
  $prev_text = $prev_post->post_title;
56
  ?>
57
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
58
  } ?>
59
  </div>
60
  <!--Prev Link code-->
templates/design-manager/design-1/elements/featured-image.php CHANGED
@@ -1,19 +1,21 @@
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
3
- $amp_html = "";
4
- $caption = "";
5
  $featured_image = "";
6
  $featured_image = $this->get( 'featured_image' );
7
- if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || $redux_builder_amp['ampforwp-featured-image-from-content'] == true ){
8
  if ( $featured_image ) {
9
  $amp_html = $featured_image['amp_html'];
10
  $caption = $featured_image['caption'];
11
  }
12
- elseif ( ampforwp_is_custom_field_featured_image() ) {
13
  $amp_img_src = ampforwp_cf_featured_image_src();
14
- $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
 
 
15
  }
16
- elseif($redux_builder_amp['ampforwp-featured-image-from-content'] == true){
17
  $amp_html = ampforwp_get_featured_image_from_content();
18
  }
19
  if( $amp_html ) {
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
3
+ $amp_html = "";
4
+ $caption = "";
5
  $featured_image = "";
6
  $featured_image = $this->get( 'featured_image' );
7
+ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || true == $redux_builder_amp['ampforwp-featured-image-from-content'] ){
8
  if ( $featured_image ) {
9
  $amp_html = $featured_image['amp_html'];
10
  $caption = $featured_image['caption'];
11
  }
12
+ if ( ampforwp_is_custom_field_featured_image() ) {
13
  $amp_img_src = ampforwp_cf_featured_image_src();
14
+ if( $amp_img_src ){
15
+ $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
16
+ }
17
  }
18
+ if( true == $redux_builder_amp['ampforwp-featured-image-from-content'] && ampforwp_get_featured_image_from_content()) {
19
  $amp_html = ampforwp_get_featured_image_from_content();
20
  }
21
  if( $amp_html ) {
templates/design-manager/design-1/elements/meta-info.php CHANGED
@@ -24,23 +24,10 @@
24
  <?php endif; ?>
25
 
26
  <div class="amp-wp-meta amp-wp-posted-on">
27
- <time datetime="<?php echo esc_attr( date( 'c', $this->get( 'post_modified_timestamp' ) ) ); ?>">
28
- <?php if( is_single()) {
29
  global $redux_builder_amp;
30
- echo esc_html(
31
- sprintf(
32
- _x( '%s '.ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' ), '%s = human-readable time difference', 'accelerated-mobile-pages' ),
33
- human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
34
- )
35
- );
36
- }?>
37
- <?php if( is_page() && $redux_builder_amp['meta_page'] ) {
38
- echo esc_html(
39
- sprintf(
40
- _x( '%s '.ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' ), '%s = human-readable time difference', 'accelerated-mobile-pages' ),
41
- human_time_diff( $this->get( 'post_publish_timestamp' ), current_time( 'timestamp' ) )
42
- )
43
- );
44
  }?>
45
  </time>
46
  </div>
24
  <?php endif; ?>
25
 
26
  <div class="amp-wp-meta amp-wp-posted-on">
27
+ <time datetime="<?php echo esc_attr( date( 'c', $this->get( 'post_publish_timestamp' ) ) ); ?>">
28
+ <?php if( is_single() || ( is_page() && $redux_builder_amp['meta_page'] ) ) {
29
  global $redux_builder_amp;
30
+ echo apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text']. ' ', 'On') . get_the_date( get_option( 'date_format' )) );
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }?>
32
  </time>
33
  </div>
templates/design-manager/design-1/elements/meta-taxonomy.php CHANGED
@@ -13,7 +13,7 @@
13
  <span><?php global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-categories-text'] .' ', 'accelerated-mobile-pages' )); ?></span>
14
  <?php foreach ($ampforwp_categories as $cat ) {
15
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
16
- echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. user_trailingslashit( trailingslashit( get_category_link( $cat->term_id ) ) . AMPFORWP_AMP_QUERY_VAR ) .'" > '. $cat->name .'</a></span>');//#934
17
  } else {
18
  echo '<span>'. $cat->name .'</span>';
19
  }
@@ -33,7 +33,7 @@
33
  }
34
  foreach ($ampforwp_tags as $tag) {
35
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
36
- echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. user_trailingslashit( trailingslashit( get_tag_link( $tag->term_id ) ) .'amp' ).'" >'.$tag->name .'</a></span>');//#934
37
  } else {
38
  echo ('<span>'.$tag->name.'</span>');
39
  }
13
  <span><?php global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-categories-text'] .' ', 'accelerated-mobile-pages' )); ?></span>
14
  <?php foreach ($ampforwp_categories as $cat ) {
15
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
16
+ echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. ampforwp_url_controller( get_category_link( $cat->term_id ) ) .'" > '. $cat->name .'</a></span>');//#934
17
  } else {
18
  echo '<span>'. $cat->name .'</span>';
19
  }
33
  }
34
  foreach ($ampforwp_tags as $tag) {
35
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
36
+ echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. ampforwp_url_controller( get_tag_link( $tag->term_id ) ).'" >'.$tag->name .'</a></span>');//#934
37
  } else {
38
  echo ('<span>'.$tag->name.'</span>');
39
  }
templates/design-manager/design-1/elements/related-posts.php CHANGED
@@ -70,10 +70,8 @@
70
  <span><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-related-text'], 'Related Post' ); ?></span>
71
  <?php
72
  while( $my_query->have_posts() ) {
73
- $my_query->the_post();
74
- $related_post_permalink = get_permalink();
75
- $related_post_permalink = trailingslashit( $related_post_permalink );
76
- $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
77
  ?>
78
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
79
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
70
  <span><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-related-text'], 'Related Post' ); ?></span>
71
  <?php
72
  while( $my_query->have_posts() ) {
73
+ $my_query->the_post();
74
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );
 
 
75
  ?>
76
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
77
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
templates/design-manager/design-1/elements/social-icons.php CHANGED
@@ -11,7 +11,7 @@
11
  <div class="ampforwp-social-icons">
12
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
13
  $facebook_like_url = '';
14
- $facebook_like_url = $redux_builder_amp['ampforwp-facebook-like-url'];
15
  if( $facebook_like_url ){ ?>
16
  <amp-facebook-like width=90 height=28
17
  layout="fixed"
11
  <div class="ampforwp-social-icons">
12
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
13
  $facebook_like_url = '';
14
+ $facebook_like_url = get_the_permalink();
15
  if( $facebook_like_url ){ ?>
16
  <amp-facebook-like width=90 height=28
17
  layout="fixed"
templates/design-manager/design-1/elements/title.php CHANGED
@@ -1,8 +1,20 @@
1
- <?php do_action('ampforwp_above_the_title',$this); ?>
 
2
  <header class="amp-wp-article-header ampforwp-title">
3
  <h1 class="amp-wp-title"> <?php
4
  $ampforwp_title = $this->get( 'post_title' ) ;
5
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
6
  echo wp_kses_data( $ampforwp_title );?></h1>
 
 
 
 
 
 
 
 
 
 
 
7
  </header>
8
- <?php do_action('ampforwp_below_the_title',$this);
1
+ <?php global $redux_builder_amp;
2
+ do_action('ampforwp_above_the_title',$this); ?>
3
  <header class="amp-wp-article-header ampforwp-title">
4
  <h1 class="amp-wp-title"> <?php
5
  $ampforwp_title = $this->get( 'post_title' ) ;
6
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
7
  echo wp_kses_data( $ampforwp_title );?></h1>
8
+ <?php
9
+ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
10
+ if($redux_builder_amp['enable-excerpt-single']) {
11
+ if(has_excerpt()){ ?>
12
+ <div class="ampforwp_single_excerpt">
13
+ <?php $content = get_the_excerpt();
14
+ echo $content; ?>
15
+ </div>
16
+ <?php }
17
+ }
18
+ } ?>
19
  </header>
20
+ <?php do_action('ampforwp_below_the_title',$this); ?>
templates/design-manager/design-1/footer.php CHANGED
@@ -14,6 +14,7 @@ wp_reset_postdata(); ?>
14
  'link_after' => '</span>',
15
  'echo' => false
16
  ) );
 
17
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
18
  $sanitized_menu = $sanitizer_obj->get_amp_content();
19
  echo $sanitized_menu; ?>
@@ -30,13 +31,19 @@ wp_reset_postdata(); ?>
30
 
31
 
32
  <p class="back-to-top">
33
- <?php if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
34
- <a href="#top"> <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top' ); ?>
35
- </a> <?php }
36
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp();
37
- } ?>
 
 
 
 
 
 
 
38
  </p>
39
-
40
  </div>
41
  </footer>
42
  <?php do_action('ampforwp_global_after_footer'); ?>
14
  'link_after' => '</span>',
15
  'echo' => false
16
  ) );
17
+ $menu = apply_filters('ampforwp_menu_content', $menu);
18
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
19
  $sanitized_menu = $sanitizer_obj->get_amp_content();
20
  echo $sanitized_menu; ?>
31
 
32
 
33
  <p class="back-to-top">
34
+ <?php
35
+ if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
36
+ <a href="#top"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?> </a>
37
+ <?php }
38
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
39
+ if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
40
+ | <?php ampforwp_view_nonamp();
41
+ }
42
+ else{
43
+ ampforwp_view_nonamp();
44
+ }
45
+ } ?>
46
  </p>
 
47
  </div>
48
  </footer>
49
  <?php do_action('ampforwp_global_after_footer'); ?>
templates/design-manager/design-1/frontpage.php CHANGED
@@ -1,45 +1,29 @@
1
  <?php global $redux_builder_amp,$wp;
2
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
- $post_id = get_option('page_on_front');
5
-
6
  }
7
  else{
8
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
9
  }
10
  $template = new AMP_Post_Template( $post_id );?>
11
  <!doctype html>
12
- <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
13
  <head>
14
  <meta charset="utf-8">
15
- <?php do_action( 'amp_post_template_head', $this ); ?>
16
- <?php
17
- $amp_custom_content_enable = get_post_meta($template->data['post_id'], 'ampforwp_custom_content_editor_checkbox', true);
18
- if ( ! $amp_custom_content_enable ) {
19
- $amp_component_scripts = $template->data['amp_component_scripts'];
20
- foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) {
21
- if ( $ampforwp_service == 'amp-sidebar' || $ampforwp_service == 'amp-analytics' ) {
22
- continue;
23
- }
24
- ?>
25
- <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
26
- }
27
- } ?>
28
  <style amp-custom>
29
  <?php do_action( 'amp_post_template_css', $template ); ?>
30
  </style>
31
  </head>
32
-
33
  <body <?php ampforwp_body_class('single-post amp-wp-frontpage design_1_wrapper');?>>
34
- <?php do_action('ampforwp_body_beginning', $this); ?>
35
- <?php $this->load_parts( array( 'header-bar' ) ); ?>
36
- <?php do_action( 'below_the_header_design_1', $this ); ?>
37
-
38
- <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
39
-
40
  <?php do_action('ampforwp_frontpage_below_loop',$template, $post_id) ?>
41
  <?php do_action( 'amp_post_template_above_footer', $template ); ?>
42
- <?php $this->load_parts( array( 'footer' ) ); ?>
43
  <?php do_action( 'amp_post_template_footer', $template ); ?>
44
  </body>
45
- </html>
1
  <?php global $redux_builder_amp,$wp;
2
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
+ $post_id = get_option('page_on_front');
 
5
  }
6
  else{
7
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
8
  }
9
  $template = new AMP_Post_Template( $post_id );?>
10
  <!doctype html>
11
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $template->get( 'html_tag_attributes' ) ); ?>>
12
  <head>
13
  <meta charset="utf-8">
14
+ <?php do_action( 'amp_post_template_head', $template ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
15
  <style amp-custom>
16
  <?php do_action( 'amp_post_template_css', $template ); ?>
17
  </style>
18
  </head>
 
19
  <body <?php ampforwp_body_class('single-post amp-wp-frontpage design_1_wrapper');?>>
20
+ <?php do_action('ampforwp_body_beginning', $template); ?>
21
+ <?php $template->load_parts( array( 'header-bar' ) ); ?>
22
+ <?php do_action( 'below_the_header_design_1', $template ); ?>
23
+ <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
 
 
24
  <?php do_action('ampforwp_frontpage_below_loop',$template, $post_id) ?>
25
  <?php do_action( 'amp_post_template_above_footer', $template ); ?>
26
+ <?php $template->load_parts( array( 'footer' ) ); ?>
27
  <?php do_action( 'amp_post_template_footer', $template ); ?>
28
  </body>
29
+ </html>
templates/design-manager/design-1/header-bar.php CHANGED
@@ -3,18 +3,21 @@
3
  <div class="ampforwp-logo-area" >
4
  <?php
5
  do_action('ampforwp_header_top_design1');
 
 
 
6
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
7
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
8
- <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ).'?nonamp=1'); ?>" rel="nofollow">
9
  <?php } else { ?>
10
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ) ); ?>">
11
  <?php }
12
  } else { ?>
13
  <?php if($redux_builder_amp['ampforwp-homepage-on-off-support']) { ?>
14
- <a href="<?php echo esc_url( trailingslashit( trailingslashit( $this->get( 'home_url' ) ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>">
15
  <?php } else {
16
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
17
- <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ).'?nonamp=1'); ?>" rel="nofollow">
18
  <?php } else { ?>
19
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ) ); ?>" >
20
  <?php }
@@ -45,20 +48,20 @@
45
  </a>
46
 
47
  <?php
48
- if($redux_builder_amp['amp-on-off-support-for-non-amp-home-page']){
49
- ?>
50
- <a href="<?php echo esc_url( $this->get( 'home_url' ) ); ?>">
51
  <?php }else{ ?>
52
 
53
- <?php if($redux_builder_amp['ampforwp-homepage-on-off-support']) { ?>
54
 
55
- <a href="<?php echo esc_url( trailingslashit( trailingslashit( $this->get( 'home_url' ) ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>">
56
 
57
- <?php } else {?>
58
 
59
- <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ) .'?nonamp=1'); ?>" rel="nofollow">
60
 
61
- <?php }
62
  } ?>
63
  <?php $site_icon_url = $this->get( 'site_icon_url' );
64
  if ( $site_icon_url ) : ?>
@@ -98,6 +101,7 @@
98
  'echo' => false,
99
  'menu_class' => 'menu amp-menu'
100
  ) );
 
101
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
102
  $sanitized_menu = $sanitizer_obj->get_amp_content();
103
  echo $sanitized_menu;
3
  <div class="ampforwp-logo-area" >
4
  <?php
5
  do_action('ampforwp_header_top_design1');
6
+ $nonamp_home_url = "";
7
+ $nonamp_home_url = add_query_arg( array( 'nonamp' => '1' ), $this->get( 'home_url' ) );
8
+
9
  if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
10
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
11
+ <a href="<?php echo esc_url( $nonamp_home_url ); ?>" rel="nofollow">
12
  <?php } else { ?>
13
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ) ); ?>">
14
  <?php }
15
  } else { ?>
16
  <?php if($redux_builder_amp['ampforwp-homepage-on-off-support']) { ?>
17
+ <a href="<?php echo ampforwp_url_controller( $this->get( 'home_url' ) ) ; ?>">
18
  <?php } else {
19
  if( $redux_builder_amp['amp-mobile-redirection'] ) { ?>
20
+ <a href="<?php echo esc_url( $nonamp_home_url ); ?>" rel="nofollow">
21
  <?php } else { ?>
22
  <a href="<?php echo esc_url( trailingslashit( $this->get( 'home_url' ) ) ); ?>" >
23
  <?php }
48
  </a>
49
 
50
  <?php
51
+
52
+ if($redux_builder_amp['amp-on-off-support-for-non-amp-home-page']){ ?>
53
+ <a href="<?php echo esc_url( $nonamp_home_url ); ?>">
54
  <?php }else{ ?>
55
 
56
+ <?php if($redux_builder_amp['ampforwp-homepage-on-off-support']) { ?>
57
 
58
+ <a href="<?php echo ampforwp_url_controller( $this->get( 'home_url' ) ); ?>">
59
 
60
+ <?php } else {?>
61
 
62
+ <a href="<?php echo esc_url( $nonamp_home_url ); ?>" rel="nofollow">
63
 
64
+ <?php }
65
  } ?>
66
  <?php $site_icon_url = $this->get( 'site_icon_url' );
67
  if ( $site_icon_url ) : ?>
101
  'echo' => false,
102
  'menu_class' => 'menu amp-menu'
103
  ) );
104
+ $menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
105
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
106
  $sanitized_menu = $sanitizer_obj->get_amp_content();
107
  echo $sanitized_menu;
templates/design-manager/design-1/index.php CHANGED
@@ -54,8 +54,9 @@
54
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
55
 
56
  <h1 class="amp-wp-title">
57
- <?php $ampforwp_post_url = get_permalink(); ?>
58
- <a href="<?php echo user_trailingslashit( trailingslashit( $ampforwp_post_url ) . AMPFORWP_AMP_QUERY_VAR );?>"><?php the_title() ?></a>
 
59
  </h1>
60
 
61
  <div class="amp-wp-content-loop">
@@ -82,7 +83,7 @@
82
  $thumb_url = ampforwp_get_post_thumbnail();
83
  if($thumb_url){ ?>
84
  <div class="home-post-image">
85
- <a href="<?php echo user_trailingslashit( trailingslashit( $ampforwp_post_url ) . AMPFORWP_AMP_QUERY_VAR );?>">
86
  <amp-img
87
  src=<?php echo esc_url($thumb_url); ?>
88
  <?php ampforwp_thumbnail_alt(); ?>
@@ -105,9 +106,16 @@
105
  $content = get_the_content();
106
  } ?>
107
  <p><?php global $redux_builder_amp;
108
- if($redux_builder_amp['excerpt-option-design-1']== true) {
109
- $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
110
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); }?></p>
 
 
 
 
 
 
 
111
  </div>
112
  </div>
113
  <?php
54
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
55
 
56
  <h1 class="amp-wp-title">
57
+ <?php $ampforwp_post_url = get_permalink(); ?>
58
+
59
+ <a href="<?php echo ampforwp_url_controller( $ampforwp_post_url ); ?>"><?php the_title() ?></a>
60
  </h1>
61
 
62
  <div class="amp-wp-content-loop">
83
  $thumb_url = ampforwp_get_post_thumbnail();
84
  if($thumb_url){ ?>
85
  <div class="home-post-image">
86
+ <a href="<?php echo ampforwp_url_controller( $ampforwp_post_url );?>">
87
  <amp-img
88
  src=<?php echo esc_url($thumb_url); ?>
89
  <?php ampforwp_thumbnail_alt(); ?>
106
  $content = get_the_content();
107
  } ?>
108
  <p><?php global $redux_builder_amp;
109
+ if($redux_builder_amp['excerpt-option-design-1']== true) {
110
+ $excerpt_length = $redux_builder_amp['amp-design-1-excerpt'];
111
+ $final_content = "";
112
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
113
+
114
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
115
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
116
+ }
117
+ echo $final_content;
118
+ }?></p>
119
  </div>
120
  </div>
121
  <?php
templates/design-manager/design-1/search.php CHANGED
@@ -52,14 +52,12 @@
52
 
53
  <h1 class="amp-wp-content page-title"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:' ) . ' ' . get_search_query();?> </h1>
54
 
55
- <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
56
- $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ; ?>
57
 
58
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
59
 
60
  <h1 class="amp-wp-title">
61
- <?php $ampforwp_post_url = get_permalink(); ?>
62
- <a href="<?php echo trailingslashit( trailingslashit( $ampforwp_post_url ) . AMPFORWP_AMP_QUERY_VAR );?>"><?php the_title() ?></a>
63
  </h1>
64
 
65
  <div class="amp-wp-content-loop">
@@ -74,9 +72,10 @@
74
 
75
  <?php if ( ampforwp_has_post_thumbnail() ) {
76
  $thumb_url = ampforwp_get_post_thumbnail();
 
77
  if($thumb_url){ ?>
78
  <div class="home-post-image">
79
- <a href="<?php echo trailingslashit( trailingslashit($ampforwp_post_url) . AMPFORWP_AMP_QUERY_VAR );?>">
80
  <amp-img src=<?php echo esc_url($thumb_url); ?> width=100 height=75></amp-img>
81
  </a>
82
  </div>
@@ -88,9 +87,17 @@
88
  $content = get_the_content();
89
  } ?>
90
  <p><?php global $redux_builder_amp;
91
- if($redux_builder_amp['excerpt-option-design-1']== true) {
92
- $excertp_length = $redux_builder_amp['amp-design-1-excerpt'];
93
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); }?></p>
 
 
 
 
 
 
 
 
94
  </div>
95
  </div>
96
  <?php
52
 
53
  <h1 class="amp-wp-content page-title"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:' ) . ' ' . get_search_query();?> </h1>
54
 
55
+ <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();?>
 
56
 
57
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
58
 
59
  <h1 class="amp-wp-title">
60
+ <a href="<?php echo ampforwp_url_controller( get_permalink() );?>"><?php the_title() ?></a>
 
61
  </h1>
62
 
63
  <div class="amp-wp-content-loop">
72
 
73
  <?php if ( ampforwp_has_post_thumbnail() ) {
74
  $thumb_url = ampforwp_get_post_thumbnail();
75
+
76
  if($thumb_url){ ?>
77
  <div class="home-post-image">
78
+ <a href="<?php echo ampforwp_url_controller( get_permalink() );?>">
79
  <amp-img src=<?php echo esc_url($thumb_url); ?> width=100 height=75></amp-img>
80
  </a>
81
  </div>
87
  $content = get_the_content();
88
  } ?>
89
  <p><?php global $redux_builder_amp;
90
+ if($redux_builder_amp['excerpt-option-design-1']== true) {
91
+ $excerpt_length = $redux_builder_amp['amp-design-1-excerpt'];
92
+ $final_content = "";
93
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
94
+
95
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
96
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
97
+ }
98
+ echo $final_content;
99
+
100
+ }?></p>
101
  </div>
102
  </div>
103
  <?php
templates/design-manager/design-1/style.php CHANGED
@@ -1,10 +1,4 @@
1
  <?php
2
- add_filter( 'amp_post_template_data', 'ampforwp_add_design1_remove_googlefonts' );
3
- function ampforwp_add_design1_remove_googlefonts( $data ) {
4
- unset($data['font_urls']['merriweather']);
5
- return $data;
6
- }
7
-
8
  add_action('amp_post_template_css', 'ampforwp_additional_style_input');
9
  function ampforwp_additional_style_input( $amp_template ) {
10
  global $redux_builder_amp;
@@ -64,7 +58,7 @@ blockquote {color: <?php echo sanitize_hex_color( $text_color ); ?>;background:
64
  .amp-wp-title {color: <?php echo sanitize_hex_color( $text_color ); ?>;display: block;flex: 1 0 100%;font-weight: 900;margin: 0;width: 100%;}.amp-wp-meta {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;display: inline-block;flex: 2 1 50%;font-size: .875em;line-height: 1.7em;margin: 0;padding: 0;}.ampforwp-meta-info{margin-top: 0px;}.amp-wp-article-header .amp-wp-meta:last-of-type {text-align: right;}.amp-wp-article-header .amp-wp-meta:first-of-type {text-align: left;}.amp-wp-byline amp-img,.amp-wp-byline .amp-wp-author {display: inline-block;vertical-align: middle;}.amp-wp-byline amp-img {border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;border-radius: 50%;position: relative;margin-right: 6px;}.amp-wp-posted-on {text-align: right;}.hide-meta-info{ display: none; }
65
  .amp-wp-article-featured-image {margin: 1.5em 16px 1.5em;}.amp-wp-article-featured-image amp-img {margin: 0 auto;}.amp-wp-article-featured-image.wp-caption .wp-caption-text, .ampforwp-gallery-item .wp-caption-text {margin: 0 18px;}.amp-wp-frontpage .the_content {padding: 10px;}
66
  .ampforwp-gallery-item.amp-carousel-slide { padding-bottom: 20px;}
67
- .amp-wp-frontpage .ampforwp-title {margin-left:10px;}.amp-wp-article a{text-decoration:none}.amp-wp-article-content {margin: 0 16px;}.amp-wp-article-content ul,.amp-wp-article-content ol {margin-left: 1em;}.amp-wp-article-content amp-img {margin: 0 auto;}.amp-wp-article-content amp-img.alignright {margin: 0 0 1em 16px;}.amp-wp-article-content amp-img.alignleft {margin: 0 16px 1em 0;} .amp-disqus-comments {padding: 15px;}.amp-disqus-comments amp-iframe{background: none;}.wp-caption {padding: 0;}.wp-caption.alignleft {margin-right: 16px;}.wp-caption.alignright { margin-left: 16px;}.wp-caption-text {border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 0;padding: .66em 10px .75em;text-align: center;} amp-carousel {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em;} amp-iframe,amp-youtube,amp-instagram,amp-vine {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em; } .amp-wp-article-content amp-carousel amp-img {border: none;} amp-carousel > amp-img > img {object-fit: contain; } .amp-wp-iframe-placeholder { background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;background-size: 48px 48px;min-height: 48px;} .amp-wp-article-footer .amp-wp-meta {display: block;} .amp-wp-tags{ list-style-type: none; padding: 0; margin: 0 0 9px 0; display: inline-flex; } .amp-wp-tags li{display:inline; padding-left: 5px; } .amp-wp-tax-category span{margin-right:5px;} .amp-wp-tax-category, .amp-wp-tax-tag { color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 1.5em 16px;}.ampforwp-comment-button {margin-bottom:20px;} .amp-wp-comments-link {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;text-align: center;margin: 2.25em 0 1.5em;} .amp-wp-comments-link a { border-style: solid;border-color: <?php echo sanitize_hex_color( $border_color ); ?>;border-width: 1px 1px 2px;border-radius: 4px;background-color: transparent;color: <?php echo sanitize_hex_color( $link_color ); ?>;cursor: pointer; display: block;font-size: 14px;font-weight: 600;line-height: 18px;margin: 0 auto;max-width: 200px;padding: 11px 16px;text-decoration: none;width: 50%;-webkit-transition: background-color 0.2s ease;transition: background-color 0.2s ease;} .page-title {margin: 0 15px; font-size: 1.17em; } .amp-wp-footer {border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;margin: calc(1.5em - 1px) 0 0;padding-bottom:25px;}
68
  .amp-wp-footer div{margin:0 auto;max-width:calc(840px - 32px);padding:1.25em 16px;position:relative}.amp-wp-footer h2{font-size:1em;line-height:1.375em;margin:0 0 .5em}
69
  .amp-wp-footer p {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .8em;line-height: 1.5em;margin: 0 15px 0 0;}
70
  .amp-wp-footer a{text-decoration:none}.copyright_txt{float:left}.back-to-top{float:right}.amp-wp-header .nav_container{float: right;top: 16px;line-height: 1; right: 65px; position: absolute}.toggle-text{position:absolute;right:0;height:22px;width:28px}.toggle-text span{display:block;position:absolute;height:2px;width:25px;background:#fff;border-radius:19px;opacity:1;left:0}.toggle-text span:nth-child(2){top:9px}.toggle-text span:nth-child(3){top:18px}.amp-wp-home .amp-wp-meta{margin:5px 0}.amp-wp-home .amp-wp-content p{display:inline-block;width:100%}.ampforwp-custom-index .amp-wp-title a {text-decoration: none;color: <?php echo sanitize_hex_color( $text_color ); ?>;}.comment-button-wrapper a,.related_posts ol{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.amp-wp-meta{display:flex}.amp-wp-posted-on{display:initial}#pagination .next,#pagination .prev{display:inline-block}.ampforwp-custom-index .amp-wp-content{margin-bottom:30px}.pagination-holder{margin:1.5em 16px}#pagination .next{float:right}.amp-wp-home .amp-wp-content p{display:inline}.home-post-image{float:right;margin:0 0 10px 20px}.amp-wp-article-content amp-img{max-width:100%}.amp-wp-meta.amp-wp-tax-category,.amp-wp-meta.amp-wp-tax-tag{margin:0}.amp-wp-meta.amp-wp-tax-tag{display:initial}.ampforwp-social-icons{margin:1.5em 16px}.custom-amp-socialsharing-icon{ width: 50px; height: 28px; display: inline-block; background: #5cbe4a;position: relative; top: -8px; padding-top: 0px; }
1
  <?php
 
 
 
 
 
 
2
  add_action('amp_post_template_css', 'ampforwp_additional_style_input');
3
  function ampforwp_additional_style_input( $amp_template ) {
4
  global $redux_builder_amp;
58
  .amp-wp-title {color: <?php echo sanitize_hex_color( $text_color ); ?>;display: block;flex: 1 0 100%;font-weight: 900;margin: 0;width: 100%;}.amp-wp-meta {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;display: inline-block;flex: 2 1 50%;font-size: .875em;line-height: 1.7em;margin: 0;padding: 0;}.ampforwp-meta-info{margin-top: 0px;}.amp-wp-article-header .amp-wp-meta:last-of-type {text-align: right;}.amp-wp-article-header .amp-wp-meta:first-of-type {text-align: left;}.amp-wp-byline amp-img,.amp-wp-byline .amp-wp-author {display: inline-block;vertical-align: middle;}.amp-wp-byline amp-img {border: 1px solid <?php echo sanitize_hex_color( $link_color ); ?>;border-radius: 50%;position: relative;margin-right: 6px;}.amp-wp-posted-on {text-align: right;}.hide-meta-info{ display: none; }
59
  .amp-wp-article-featured-image {margin: 1.5em 16px 1.5em;}.amp-wp-article-featured-image amp-img {margin: 0 auto;}.amp-wp-article-featured-image.wp-caption .wp-caption-text, .ampforwp-gallery-item .wp-caption-text {margin: 0 18px;}.amp-wp-frontpage .the_content {padding: 10px;}
60
  .ampforwp-gallery-item.amp-carousel-slide { padding-bottom: 20px;}
61
+ .amp-wp-frontpage .ampforwp-title {margin-left:10px;}.amp-wp-article a{text-decoration:none}.amp-wp-article-content {margin: 0 16px;}.amp-wp-article-content ul,.amp-wp-article-content ol {margin-left: 1em;}.amp-wp-article-content amp-img {margin: 0 auto;}.amp-wp-article-content amp-img.alignright {margin: 0 0 1em 16px;}.amp-wp-article-content amp-img.alignleft {margin: 0 16px 1em 0;} .amp-disqus-comments {padding: 15px;}.amp-disqus-comments amp-iframe{background: none;}.wp-caption {padding: 0;}.wp-caption.alignleft {margin-right: 16px;}.wp-caption.alignright { margin-left: 16px;}.wp-caption-text {border-bottom: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 0;padding: .66em 10px .75em;text-align: center;} amp-carousel {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em;} amp-iframe,amp-youtube,amp-instagram,amp-vine {background: <?php echo sanitize_hex_color( $border_color ); ?>;margin: 0 -16px 1.5em; } .amp-wp-article-content amp-carousel amp-img {border: none;} amp-carousel > amp-img > img {object-fit: contain; } .amp-wp-iframe-placeholder { background: <?php echo sanitize_hex_color( $border_color ); ?> url( <?php echo esc_url( $get_customizer->get( 'placeholder_image_url' ) ); ?> ) no-repeat center 40%;background-size: 48px 48px;min-height: 48px;} .amp-wp-article-footer .amp-wp-meta {display: block;} .amp-wp-tags{ list-style-type: none; padding: 0; margin: 0 0 9px 0; display: inline-flex; } .amp-wp-tags li{display:inline; padding-left: 5px; } .amp-wp-tax-category span{margin-right:5px;} .amp-wp-tax-category, .amp-wp-tax-tag { color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;margin: 1.5em 16px;}.ampforwp-comment-button {margin-bottom:20px;} .amp-wp-comments-link {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .875em;line-height: 1.5em;text-align: center;margin: 2.25em 0 1.5em;} .amp-wp-comments-link a { border-style: solid;border-color: <?php echo sanitize_hex_color( $border_color ); ?>;border-width: 1px 1px 2px;border-radius: 4px;background-color: transparent;color: <?php echo sanitize_hex_color( $link_color ); ?>;cursor: pointer; display: block;font-size: 14px;font-weight: 600;line-height: 18px;margin: 0 auto;max-width: 200px;padding: 11px 16px;text-decoration: none;width: 50%;-webkit-transition: background-color 0.2s ease;transition: background-color 0.2s ease;} .page-title {margin: 0 15px; font-size: 1.17em; }.amp-sub-archives li{width: 50%;} .amp-sub-archives ul{padding: 0;list-style: none;display: flex;font-size: 12px;line-height: 1.2;margin: 5px 1.5em 10px 1.5em;} .amp-wp-footer {border-top: 1px solid <?php echo sanitize_hex_color( $border_color ); ?>;margin: calc(1.5em - 1px) 0 0;padding-bottom:25px;}
62
  .amp-wp-footer div{margin:0 auto;max-width:calc(840px - 32px);padding:1.25em 16px;position:relative}.amp-wp-footer h2{font-size:1em;line-height:1.375em;margin:0 0 .5em}
63
  .amp-wp-footer p {color: <?php echo sanitize_hex_color( $muted_text_color ); ?>;font-size: .8em;line-height: 1.5em;margin: 0 15px 0 0;}
64
  .amp-wp-footer a{text-decoration:none}.copyright_txt{float:left}.back-to-top{float:right}.amp-wp-header .nav_container{float: right;top: 16px;line-height: 1; right: 65px; position: absolute}.toggle-text{position:absolute;right:0;height:22px;width:28px}.toggle-text span{display:block;position:absolute;height:2px;width:25px;background:#fff;border-radius:19px;opacity:1;left:0}.toggle-text span:nth-child(2){top:9px}.toggle-text span:nth-child(3){top:18px}.amp-wp-home .amp-wp-meta{margin:5px 0}.amp-wp-home .amp-wp-content p{display:inline-block;width:100%}.ampforwp-custom-index .amp-wp-title a {text-decoration: none;color: <?php echo sanitize_hex_color( $text_color ); ?>;}.comment-button-wrapper a,.related_posts ol{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.amp-wp-meta{display:flex}.amp-wp-posted-on{display:initial}#pagination .next,#pagination .prev{display:inline-block}.ampforwp-custom-index .amp-wp-content{margin-bottom:30px}.pagination-holder{margin:1.5em 16px}#pagination .next{float:right}.amp-wp-home .amp-wp-content p{display:inline}.home-post-image{float:right;margin:0 0 10px 20px}.amp-wp-article-content amp-img{max-width:100%}.amp-wp-meta.amp-wp-tax-category,.amp-wp-meta.amp-wp-tax-tag{margin:0}.amp-wp-meta.amp-wp-tax-tag{display:initial}.ampforwp-social-icons{margin:1.5em 16px}.custom-amp-socialsharing-icon{ width: 50px; height: 28px; display: inline-block; background: #5cbe4a;position: relative; top: -8px; padding-top: 0px; }
templates/design-manager/design-2/archive.php CHANGED
@@ -45,9 +45,8 @@
45
 
46
  <?php if ( is_archive() ) { ?>
47
  <div class="amp-wp-content amp-archive-heading">
48
- <?php
49
  the_archive_title( '<h1 class="page-title">', '</h1>' );
50
-
51
  $arch_desc = $sanitizer->get_amp_content();
52
  if( $arch_desc ) {
53
  if ( get_query_var( 'paged' ) ) {
@@ -62,7 +61,23 @@
62
  <?php echo $arch_desc ; ?>
63
  </div> <?php
64
  }
65
- } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  </div>
67
  <?php
68
  } ?>
@@ -70,9 +85,7 @@
70
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
71
  $count = "";
72
  $count = 1;
73
- $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ;
74
-
75
- $ampforwp_amp_post_url = user_trailingslashit( $ampforwp_amp_post_url );
76
 
77
  if( in_array( "ampforwp-custom-type-amp-endpoint" , $redux_builder_amp ) ) {
78
  if (isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
@@ -114,12 +127,28 @@
114
  }
115
  ?>
116
  <p class="large-screen-excerpt">
117
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15'); ?> </p>
 
 
 
 
 
 
 
 
 
118
  <p class="small-screen-excerpt" > <?php
119
  if($redux_builder_amp['excerpt-option-design-2']== true) {
120
- $excertp_length='';
121
- $excertp_length = $redux_builder_amp['amp-design-2-excerpt'];
122
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
 
123
  </p>
124
  </div>
125
  <div class="cb"></div>
45
 
46
  <?php if ( is_archive() ) { ?>
47
  <div class="amp-wp-content amp-archive-heading">
48
+ <?php
49
  the_archive_title( '<h1 class="page-title">', '</h1>' );
 
50
  $arch_desc = $sanitizer->get_amp_content();
51
  if( $arch_desc ) {
52
  if ( get_query_var( 'paged' ) ) {
61
  <?php echo $arch_desc ; ?>
62
  </div> <?php
63
  }
64
+ }
65
+ if(is_category() && 1 == $redux_builder_amp['ampforwp-sub-categories-support'] ){
66
+ $parent_cat_id = '';
67
+ $cat_childs = array();
68
+ $parent_cat_id = get_queried_object_id();
69
+ $cat_childs = get_terms( array(
70
+ 'taxonomy' => get_queried_object()->taxonomy,
71
+ 'parent' => $parent_cat_id)
72
+ );
73
+ if(!empty($cat_childs)){
74
+ echo "<div class='amp-sub-archives'><ul>";
75
+ foreach ($cat_childs as $cat_child ) {
76
+ echo '<li><a href="' . get_term_link( $cat_child ) . '">' . $cat_child->name . '</a></li>';
77
+ }
78
+ echo "</ul></div>";
79
+ }
80
+ } ?>
81
  </div>
82
  <?php
83
  } ?>
85
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
86
  $count = "";
87
  $count = 1;
88
+ $ampforwp_amp_post_url = ampforwp_url_controller( get_permalink() );
 
 
89
 
90
  if( in_array( "ampforwp-custom-type-amp-endpoint" , $redux_builder_amp ) ) {
91
  if (isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
127
  }
128
  ?>
129
  <p class="large-screen-excerpt">
130
+ <?php
131
+ $excerpt_length = "";
132
+ $excerpt_length = 15;
133
+ $final_content = "";
134
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
135
+
136
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
137
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
138
+ }
139
+ echo $final_content; ?> </p>
140
  <p class="small-screen-excerpt" > <?php
141
  if($redux_builder_amp['excerpt-option-design-2']== true) {
142
+ $excerpt_length='';
143
+ $excerpt_length = $redux_builder_amp['amp-design-2-excerpt'];
144
+ $final_content = "";
145
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
146
+
147
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
148
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
149
+ }
150
+ echo $final_content;
151
+ } ?>
152
  </p>
153
  </div>
154
  <div class="cb"></div>
templates/design-manager/design-2/elements/bread-crumbs.php CHANGED
@@ -4,7 +4,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
- $home_title = 'Homepage';
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
@@ -19,7 +19,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
  // Home page
22
- echo '<li class="item-home"><a class="bread-link bread-home" href="' . user_trailingslashit(trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
@@ -28,11 +28,11 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
28
  } else if ( is_author() ) {
29
  global $author;
30
 
31
- $userdata = get_userdata( $author );
32
- $author_url= get_author_posts_url($userdata->ID);
33
 
34
  // Display author name
35
- echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.$author_url. AMPFORWP_AMP_QUERY_VAR . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
@@ -42,10 +42,10 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
42
  // If it is a custom post type display name and link
43
  if($post_type != 'post') {
44
 
45
- $post_type_object = get_post_type_object($post_type);
46
- $post_type_archive = get_post_type_archive_link($post_type);
47
 
48
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
@@ -58,10 +58,10 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
58
  // If it is a custom post type display name and link
59
  if($post_type != 'post') {
60
 
61
- $post_type_object = get_post_type_object($post_type);
62
- $post_type_archive = get_post_type_archive_link($post_type);
63
 
64
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
@@ -80,9 +80,9 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
80
  // Loop through parent categories and store in variable $cat_display
81
  $cat_display = '';
82
  foreach($cat_parents as $parents) {
83
- $cat_id = get_cat_ID( $parents);
84
- $cat_link = get_category_link($cat_id);
85
- $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. user_trailingslashit(trailingslashit($cat_link).'amp').'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
@@ -95,6 +95,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
95
  $cat_nicename = $taxonomy_terms[0]->slug;
96
  $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
97
  $cat_name = $taxonomy_terms[0]->name;
 
98
  }
99
 
100
  // Check if the post is in a category
@@ -104,7 +105,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
104
  // Else if post is in a custom taxonomy
105
  } else if(!empty($cat_id)) {
106
 
107
- echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link .AMPFORWP_AMP_QUERY_VAR . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
108
  }
109
 
110
  } else if ( is_category() ) {
@@ -125,7 +126,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
125
  // Parent page loop
126
  if ( !isset( $parents ) ) $parents = null;
127
  foreach ( $anc as $ancestor ) {
128
- $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . AMPFORWP_AMP_QUERY_VAR . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
129
  }
130
 
131
  // Display parent pages
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
+ $home_title = ampforwp_translation($redux_builder_amp['amp-translator-breadcrumbs-homepage-text'] , 'Homepage' );
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
  // Home page
22
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . ampforwp_url_controller( get_home_url() ) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
28
  } else if ( is_author() ) {
29
  global $author;
30
 
31
+ $userdata = get_userdata( $author );
32
+ $author_url = ampforwp_url_controller( get_author_posts_url( $userdata->ID ) );
33
 
34
  // Display author name
35
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.$author_url . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
42
  // If it is a custom post type display name and link
43
  if($post_type != 'post') {
44
 
45
+ $post_type_object = get_post_type_object($post_type);
46
+ $post_type_archive = ampforwp_url_controller( get_post_type_archive_link($post_type) );
47
 
48
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
58
  // If it is a custom post type display name and link
59
  if($post_type != 'post') {
60
 
61
+ $post_type_object = get_post_type_object($post_type);
62
+ $post_type_archive = ampforwp_url_controller( get_post_type_archive_link($post_type) );
63
 
64
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
80
  // Loop through parent categories and store in variable $cat_display
81
  $cat_display = '';
82
  foreach($cat_parents as $parents) {
83
+ $cat_id = get_cat_ID( $parents);
84
+ $cat_link = ampforwp_url_controller( get_category_link($cat_id) );
85
+ $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. $cat_link .'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
95
  $cat_nicename = $taxonomy_terms[0]->slug;
96
  $cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
97
  $cat_name = $taxonomy_terms[0]->name;
98
+ $cat_link = ampforwp_url_controller( $cat_link );
99
  }
100
 
101
  // Check if the post is in a category
105
  // Else if post is in a custom taxonomy
106
  } else if(!empty($cat_id)) {
107
 
108
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
109
  }
110
 
111
  } else if ( is_category() ) {
126
  // Parent page loop
127
  if ( !isset( $parents ) ) $parents = null;
128
  foreach ( $anc as $ancestor ) {
129
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . ampforwp_url_controller( get_permalink($ancestor) ) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
130
  }
131
 
132
  // Display parent pages
templates/design-manager/design-2/elements/content.php CHANGED
@@ -2,16 +2,6 @@
2
  <!--Post Content here-->
3
  <div class="amp-wp-content the_content">
4
  <?php global $redux_builder_amp;
5
- if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
6
- if($redux_builder_amp['enable-excerpt-single']) {
7
- if(has_excerpt()){ ?>
8
- <div class="ampforwp_single_excerpt">
9
- <?php $content = get_the_excerpt();
10
- echo $content; ?>
11
- </div>
12
- <?php }
13
- }
14
- }
15
  do_action('ampforwp_before_post_content',$this) //Post before Content here ?>
16
 
17
  <?php
@@ -25,6 +15,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
25
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
26
  }
27
  //Filter to modify the Content
 
28
  if($redux_builder_amp['amp-pagination']) {
29
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
30
  $queried_var = get_query_var('page');
@@ -57,7 +48,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
57
  if (!empty( $next_post )) {
58
  $next_text = $next_post->post_title;
59
  ?>
60
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $next_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
61
  } ?>
62
  </div>
63
  <!--Next Link code-->
@@ -68,7 +59,7 @@ if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
68
  if (!empty( $prev_post )) {
69
  $prev_text = $prev_post->post_title;
70
  ?>
71
- <a href="<?php echo user_trailingslashit( trailingslashit( get_permalink( $prev_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
72
  } ?>
73
  </div>
74
  <!--Prev Link code-->
2
  <!--Post Content here-->
3
  <div class="amp-wp-content the_content">
4
  <?php global $redux_builder_amp;
 
 
 
 
 
 
 
 
 
 
5
  do_action('ampforwp_before_post_content',$this) //Post before Content here ?>
6
 
7
  <?php
15
  $ampforwp_the_content = $this->get( 'ampforwp_amp_content' );
16
  }
17
  //Filter to modify the Content
18
+ $ampforwp_the_content = apply_filters('ampforwp_modify_the_content', $ampforwp_the_content);
19
  if($redux_builder_amp['amp-pagination']) {
20
  $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
21
  $queried_var = get_query_var('page');
48
  if (!empty( $next_post )) {
49
  $next_text = $next_post->post_title;
50
  ?>
51
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
52
  } ?>
53
  </div>
54
  <!--Next Link code-->
59
  if (!empty( $prev_post )) {
60
  $prev_text = $prev_post->post_title;
61
  ?>
62
+ <a href="<?php echo ampforwp_url_controller( get_permalink( $prev_post->ID ) ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
63
  } ?>
64
  </div>
65
  <!--Prev Link code-->
templates/design-manager/design-2/elements/featured-image.php CHANGED
@@ -1,21 +1,21 @@
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
3
-
4
  $amp_html = "";
5
  $caption = "";
6
  $featured_image = "";
7
-
8
  $featured_image = $this->get( 'featured_image' );
9
- if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || $redux_builder_amp['ampforwp-featured-image-from-content'] == true ) {
10
  if ( $featured_image ) {
11
  $amp_html = $featured_image['amp_html'];
12
  $caption = $featured_image['caption'];
13
  }
14
- elseif ( ampforwp_is_custom_field_featured_image() ) {
15
  $amp_img_src = ampforwp_cf_featured_image_src();
16
- $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
 
 
17
  }
18
- elseif($redux_builder_amp['ampforwp-featured-image-from-content'] == true){
19
  $amp_html = ampforwp_get_featured_image_from_content();
20
  }
21
  if( $amp_html ) {
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
 
3
  $amp_html = "";
4
  $caption = "";
5
  $featured_image = "";
 
6
  $featured_image = $this->get( 'featured_image' );
7
+ if( $featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || true == $redux_builder_amp['ampforwp-featured-image-from-content'] ) {
8
  if ( $featured_image ) {
9
  $amp_html = $featured_image['amp_html'];
10
  $caption = $featured_image['caption'];
11
  }
12
+ if ( ampforwp_is_custom_field_featured_image() ) {
13
  $amp_img_src = ampforwp_cf_featured_image_src();
14
+ if( $amp_img_src ){
15
+ $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
16
+ }
17
  }
18
+ if( true == $redux_builder_amp['ampforwp-featured-image-from-content'] && ampforwp_get_featured_image_from_content() ){
19
  $amp_html = ampforwp_get_featured_image_from_content();
20
  }
21
  if( $amp_html ) {
templates/design-manager/design-2/elements/meta-info.php CHANGED
@@ -9,14 +9,10 @@
9
  <?php $author_avatar_url = get_avatar_url( $post_author->user_email, array( 'size' => 24 ) ); ?>
10
  <div class="amp-wp-meta amp-wp-byline">
11
  <?php
12
- if(is_single() ) {
13
  echo ampforwp_get_author_details( $post_author , 'meta-info' ); ?>
14
- <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'] . ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></li>
15
- <?php }
16
- if( is_page() && $redux_builder_amp['meta_page'] ) {
17
- echo ampforwp_get_author_details( $post_author , 'meta-info' ); ?>
18
- <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'] . ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></li>
19
- <?php } ?>
20
  </div>
21
  <?php endif; ?>
22
 
@@ -34,7 +30,7 @@ if( isset($redux_builder_amp['ampforwp-cats-single']) && $redux_builder_amp['amp
34
  </span>
35
  <?php foreach ($ampforwp_categories as $cat ) {
36
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
37
- echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. user_trailingslashit( trailingslashit( get_category_link( $cat->term_id ) ) .'amp' ) . '" >'.$cat->name .'</a></span>');//#934
38
  } else {
39
  echo ('<span>'.$cat->name .'</span>');
40
  }
9
  <?php $author_avatar_url = get_avatar_url( $post_author->user_email, array( 'size' => 24 ) ); ?>
10
  <div class="amp-wp-meta amp-wp-byline">
11
  <?php
12
+ if(is_single() || ( is_page() && $redux_builder_amp['meta_page'] ) ) {
13
  echo ampforwp_get_author_details( $post_author , 'meta-info' ); ?>
14
+ <li class="amp-wp-meta-date"> <?php global $redux_builder_amp; echo apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text']. ' ', 'On') . get_the_date( get_option( 'date_format' ) ) ) ?></li>
15
+ <?php } ?>
 
 
 
 
16
  </div>
17
  <?php endif; ?>
18
 
30
  </span>
31
  <?php foreach ($ampforwp_categories as $cat ) {
32
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
33
+ echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. ampforwp_url_controller( get_category_link( $cat->term_id ) ) . '" >'.$cat->name .'</a></span>');//#934
34
  } else {
35
  echo ('<span>'.$cat->name .'</span>');
36
  }
templates/design-manager/design-2/elements/related-posts.php CHANGED
@@ -67,10 +67,7 @@
67
  <?php
68
  while( $my_query->have_posts() ) {
69
  $my_query->the_post();
70
- $related_post_permalink = get_permalink();
71
- $related_post_permalink = trailingslashit( $related_post_permalink );
72
- $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR ) ;
73
- ?>
74
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
75
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
76
  <?php if ( ampforwp_has_post_thumbnail() ) {
67
  <?php
68
  while( $my_query->have_posts() ) {
69
  $my_query->the_post();
70
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );?>
 
 
 
71
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
72
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
73
  <?php if ( ampforwp_has_post_thumbnail() ) {
templates/design-manager/design-2/elements/social-icons.php CHANGED
@@ -11,7 +11,7 @@ if ( is_single() ) {
11
  <div class="amp-wp-content post-pagination-meta ampforwp-social-icons-wrapper ampforwp-social-icons">
12
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
13
  $facebook_like_url = '';
14
- $facebook_like_url = $redux_builder_amp['ampforwp-facebook-like-url'];
15
  if( $facebook_like_url ){ ?>
16
  <amp-facebook-like width=90 height=28
17
  layout="fixed"
11
  <div class="amp-wp-content post-pagination-meta ampforwp-social-icons-wrapper ampforwp-social-icons">
12
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
13
  $facebook_like_url = '';
14
+ $facebook_like_url = get_the_permalink();
15
  if( $facebook_like_url ){ ?>
16
  <amp-facebook-like width=90 height=28
17
  layout="fixed"
templates/design-manager/design-2/elements/title.php CHANGED
@@ -1,8 +1,20 @@
1
- <?php do_action('ampforwp_above_the_title',$this); ?>
 
2
  <header class="amp-wp-article-header ampforwp-title">
3
  <h1 class="amp-wp-title"><?php
4
  $ampforwp_title = $this->get( 'post_title' );
5
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
6
- echo wp_kses_data( $ampforwp_title );?></h1>
 
 
 
 
 
 
 
 
 
 
 
7
  </header>
8
- <?php do_action('ampforwp_below_the_title',$this);
1
+ <?php global $redux_builder_amp;
2
+ do_action('ampforwp_above_the_title',$this); ?>
3
  <header class="amp-wp-article-header ampforwp-title">
4
  <h1 class="amp-wp-title"><?php
5
  $ampforwp_title = $this->get( 'post_title' );
6
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
7
+ echo wp_kses_data( $ampforwp_title );?>
8
+ </h1>
9
+ <?php if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
10
+ if($redux_builder_amp['enable-excerpt-single']) {
11
+ if(has_excerpt()){ ?>
12
+ <div class="ampforwp_single_excerpt">
13
+ <?php $content = get_the_excerpt();
14
+ echo $content; ?>
15
+ </div>
16
+ <?php }
17
+ }
18
+ } ?>
19
  </header>
20
+ <?php do_action('ampforwp_below_the_title',$this); ?>
templates/design-manager/design-2/footer.php CHANGED
@@ -13,20 +13,24 @@
13
  'link_after' => '</span>',
14
  'echo' => false
15
  ) );
 
16
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
17
  $sanitized_menu = $sanitizer_obj->get_amp_content();
18
  echo $sanitized_menu; ?>
19
  </nav>
20
  </div>
21
  <?php } ?>
22
-
23
  <p> <?php if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
24
- <a href="#header">
25
- <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?> </a> <?php }
26
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp();
27
- } ?>
28
-
29
- <?php
 
 
 
 
30
  global $allowed_html;
31
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer'),$allowed_html);
32
  ?>
13
  'link_after' => '</span>',
14
  'echo' => false
15
  ) );
16
+ $menu = apply_filters('ampforwp_menu_content', $menu);
17
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
18
  $sanitized_menu = $sanitizer_obj->get_amp_content();
19
  echo $sanitized_menu; ?>
20
  </nav>
21
  </div>
22
  <?php } ?>
 
23
  <p> <?php if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
24
+ <a href="#header"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?> </a>
25
+ <?php }
26
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
27
+ if($redux_builder_amp['ampforwp-footer-top']=='1') { ?>
28
+ | <?php ampforwp_view_nonamp();
29
+ }
30
+ else{
31
+ ampforwp_view_nonamp();
32
+ }
33
+ }
34
  global $allowed_html;
35
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer'),$allowed_html);
36
  ?>
templates/design-manager/design-2/frontpage.php CHANGED
@@ -1,49 +1,33 @@
1
  <?php global $redux_builder_amp , $wp;
2
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
- $post_id = get_option('page_on_front');
5
-
6
  }
7
  else{
8
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
9
  }
10
  $template = new AMP_Post_Template( $post_id );?>
11
  <!doctype html>
12
- <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
13
  <head>
14
  <meta charset="utf-8">
15
- <?php do_action( 'amp_post_template_head', $this ); ?>
16
- <?php
17
- $amp_custom_content_enable = get_post_meta($template->data['post_id'], 'ampforwp_custom_content_editor_checkbox', true);
18
- if ( ! $amp_custom_content_enable ) {
19
- $amp_component_scripts = $template->data['amp_component_scripts'];
20
- foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) {
21
- if ( $ampforwp_service == 'amp-sidebar' || $ampforwp_service == 'amp-analytics' ) {
22
- continue;
23
- } ?>
24
- <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
25
- }
26
- } ?>
27
  <style amp-custom>
28
- <?php do_action( 'amp_post_template_css', $this ); ?>
29
  </style>
30
  </head>
31
  <body <?php ampforwp_body_class('single-post design_2_wrapper');?> >
32
- <?php do_action('ampforwp_body_beginning', $this); ?>
33
- <?php $this->load_parts( array( 'header-bar' ) ); ?>
34
-
35
  <?php do_action( 'ampforwp_after_header', $template ); ?>
36
  <main>
37
  <article class="amp-wp-article">
38
-
39
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
40
-
41
  <?php do_action('ampforwp_frontpage_below_loop',$template, $post_id) ?>
42
  </article>
43
  </main>
44
  <?php do_action( 'amp_post_template_above_footer', $template ); ?>
45
- <?php $this->load_parts( array( 'footer' ) ); ?>
46
  <?php do_action( 'amp_post_template_footer', $template ); ?>
47
-
48
  </body>
49
- </html>
1
  <?php global $redux_builder_amp , $wp;
2
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
+ $post_id = get_option('page_on_front');
 
5
  }
6
  else{
7
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
8
  }
9
  $template = new AMP_Post_Template( $post_id );?>
10
  <!doctype html>
11
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $template->get( 'html_tag_attributes' ) ); ?>>
12
  <head>
13
  <meta charset="utf-8">
14
+ <?php do_action( 'amp_post_template_head', $template ); ?>
 
 
 
 
 
 
 
 
 
 
 
15
  <style amp-custom>
16
+ <?php do_action( 'amp_post_template_css', $template ); ?>
17
  </style>
18
  </head>
19
  <body <?php ampforwp_body_class('single-post design_2_wrapper');?> >
20
+ <?php do_action('ampforwp_body_beginning', $template); ?>
21
+ <?php $template->load_parts( array( 'header-bar' ) ); ?>
 
22
  <?php do_action( 'ampforwp_after_header', $template ); ?>
23
  <main>
24
  <article class="amp-wp-article">
 
25
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
 
26
  <?php do_action('ampforwp_frontpage_below_loop',$template, $post_id) ?>
27
  </article>
28
  </main>
29
  <?php do_action( 'amp_post_template_above_footer', $template ); ?>
30
+ <?php $template->load_parts( array( 'footer' ) ); ?>
31
  <?php do_action( 'amp_post_template_footer', $template ); ?>
 
32
  </body>
33
+ </html>
templates/design-manager/design-2/header-bar.php CHANGED
@@ -14,7 +14,7 @@
14
  }
15
  } else {
16
  if($redux_builder_amp['ampforwp-homepage-on-off-support']) {
17
- $ampforwp_home_url = user_trailingslashit( trailingslashit( get_bloginfo('url') ) . AMPFORWP_AMP_QUERY_VAR );
18
  } else {
19
  if( $redux_builder_amp['amp-mobile-redirection'] ) {
20
  $ampforwp_home_url = trailingslashit( get_bloginfo('url') ).'?nonamp=1';
@@ -79,6 +79,7 @@
79
  'echo' => false,
80
  'menu_class' => 'menu amp-menu'
81
  ) );
 
82
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
83
  $sanitized_menu = $sanitizer_obj->get_amp_content();
84
  echo $sanitized_menu; ?>
14
  }
15
  } else {
16
  if($redux_builder_amp['ampforwp-homepage-on-off-support']) {
17
+ $ampforwp_home_url = ampforwp_url_controller( get_bloginfo('url') ) ;
18
  } else {
19
  if( $redux_builder_amp['amp-mobile-redirection'] ) {
20
  $ampforwp_home_url = trailingslashit( get_bloginfo('url') ).'?nonamp=1';
79
  'echo' => false,
80
  'menu_class' => 'menu amp-menu'
81
  ) );
82
+ $menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
83
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
84
  $sanitized_menu = $sanitizer_obj->get_amp_content();
85
  echo $sanitized_menu; ?>
templates/design-manager/design-2/index.php CHANGED
@@ -50,7 +50,7 @@
50
  <h1 class="page-title"><?php echo $blog_title ?> </h1>
51
  <?php }
52
  if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
53
- $ampforwp_amp_post_url = user_trailingslashit( trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ) ; ?>
54
 
55
  <div class="amp-wp-content amp-loop-list">
56
  <?php if ( ampforwp_has_post_thumbnail() ) {
@@ -85,13 +85,31 @@
85
  }
86
  ?>
87
  <p class="large-screen-excerpt">
88
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15');
 
 
 
 
 
 
 
 
 
 
 
89
  ?></p>
90
  <p class="small-screen-excerpt" > <?php
91
  if($redux_builder_amp['excerpt-option-design-2']== true) {
92
- $excertp_length='';
93
- $excertp_length = $redux_builder_amp['amp-design-2-excerpt'];
94
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
 
95
  </p>
96
  </div>
97
  <div class="amp-wp-meta">
50
  <h1 class="page-title"><?php echo $blog_title ?> </h1>
51
  <?php }
52
  if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
53
+ $ampforwp_amp_post_url = ampforwp_url_controller( get_permalink() ); ?>
54
 
55
  <div class="amp-wp-content amp-loop-list">
56
  <?php if ( ampforwp_has_post_thumbnail() ) {
85
  }
86
  ?>
87
  <p class="large-screen-excerpt">
88
+ <?php
89
+ $excerpt_length = "";
90
+ $excerpt_length = 15;
91
+ $final_content = "";
92
+
93
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
94
+
95
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
96
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
97
+ }
98
+
99
+ echo $final_content;
100
  ?></p>
101
  <p class="small-screen-excerpt" > <?php
102
  if($redux_builder_amp['excerpt-option-design-2']== true) {
103
+ $excerpt_length_2 ='';
104
+ $excerpt_length_2 = $redux_builder_amp['amp-design-2-excerpt'];
105
+ $final_content = "";
106
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
107
+
108
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
109
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
110
+ }
111
+ echo $final_content;
112
+ } ?>
113
  </p>
114
  </div>
115
  <div class="amp-wp-meta">
templates/design-manager/design-2/search.php CHANGED
@@ -50,7 +50,7 @@
50
  <h1 class="page-title"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:' ) . ' ' . get_search_query();?> </h1>
51
  </div>
52
  <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
53
- $ampforwp_amp_post_url = trailingslashit( trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ); ?>
54
  <div class="amp-wp-content amp-loop-list">
55
  <?php if ( ampforwp_has_post_thumbnail() ) {
56
  $thumb_url = ampforwp_get_post_thumbnail();
@@ -67,13 +67,29 @@
67
  $content = get_the_content();
68
  } ?>
69
  <p class="large-screen-excerpt">
70
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15');
 
 
 
 
 
 
 
 
 
71
  ?></p>
72
  <p class="small-screen-excerpt" > <?php
73
  if($redux_builder_amp['excerpt-option-design-2']== true) {
74
- $excertp_length='';
75
- $excertp_length = $redux_builder_amp['amp-design-2-excerpt'];
76
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
 
77
  </p>
78
  </div>
79
  <div class="cb"></div>
50
  <h1 class="page-title"><?php echo ampforwp_translation($redux_builder_amp['amp-translator-search-text'], 'You searched for:' ) . ' ' . get_search_query();?> </h1>
51
  </div>
52
  <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
53
+ $ampforwp_amp_post_url = ampforwp_url_controller( get_permalink() ); ?>
54
  <div class="amp-wp-content amp-loop-list">
55
  <?php if ( ampforwp_has_post_thumbnail() ) {
56
  $thumb_url = ampforwp_get_post_thumbnail();
67
  $content = get_the_content();
68
  } ?>
69
  <p class="large-screen-excerpt">
70
+ <?php
71
+ $excerpt_length = "";
72
+ $excerpt_length = 15;
73
+ $final_content = "";
74
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
75
+
76
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
77
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
78
+ }
79
+ echo $final_content;
80
  ?></p>
81
  <p class="small-screen-excerpt" > <?php
82
  if($redux_builder_amp['excerpt-option-design-2']== true) {
83
+ $excerpt_length='';
84
+ $excerpt_length = $redux_builder_amp['amp-design-2-excerpt'];
85
+ $final_content = "";
86
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
87
+
88
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
89
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
90
+ }
91
+ echo $final_content;
92
+ } ?>
93
  </p>
94
  </div>
95
  <div class="cb"></div>
templates/design-manager/design-2/style.php CHANGED
@@ -126,6 +126,7 @@ h2.amp-wp-title , .amp-wp-post-content p{ margin: 0 0 0 5px; }
126
  }
127
  .amp-wp-post-content p{ font-size: 12px; color: #999; line-height: 20px; margin: 3px 0 0 5px; }
128
  main .amp-archive-heading{ background : none; box-shadow: none; padding: 5px; }
 
129
  .page-title{
130
  font-size: 1.17em;
131
  padding: 6px 0;
@@ -173,7 +174,7 @@ main .amp-wp-content.featured-image-content{ padding: 0px; border: 0; margin-bot
173
  .ampforwp-gallery-item.amp-carousel-slide { padding-bottom: 20px;}
174
  .amp-wp-content.post-pagination-meta{ max-width: 1030px; }
175
  .single-post .ampforwp-social-icons.ampforwp-social-icons-wrapper{ display: block; margin: 0.9em auto 0.9em auto ; max-width: 1030px; }
176
- .amp-wp-article-header.amp-wp-article-category.ampforwp-meta-taxonomy{ margin: 10px auto; max-width: 1030px; } .ampforwp_single_excerpt { margin-bottom:15px; font-size: 15px;}
177
  .single-post .amp_author_area amp-img{ margin: 0; float: left; margin-right: 12px; border-radius: 60px; }
178
  .single-post .amp_author_area .amp_author_area_wrapper{ display: inline-block; width: 100%; line-height: 1.4; margin-top: 2px; font-size: 13px; color:#333; font-family: sans-serif; }
179
  <?php if(is_single()){?>
126
  }
127
  .amp-wp-post-content p{ font-size: 12px; color: #999; line-height: 20px; margin: 3px 0 0 5px; }
128
  main .amp-archive-heading{ background : none; box-shadow: none; padding: 5px; }
129
+ .amp-sub-archives li{width: 50%;} .amp-sub-archives ul{padding: 0;list-style: none;display: flex;font-size: 12px;line-height: 1.2;margin: 5px 0 10px 0px;}
130
  .page-title{
131
  font-size: 1.17em;
132
  padding: 6px 0;
174
  .ampforwp-gallery-item.amp-carousel-slide { padding-bottom: 20px;}
175
  .amp-wp-content.post-pagination-meta{ max-width: 1030px; }
176
  .single-post .ampforwp-social-icons.ampforwp-social-icons-wrapper{ display: block; margin: 0.9em auto 0.9em auto ; max-width: 1030px; }
177
+ .amp-wp-article-header.amp-wp-article-category.ampforwp-meta-taxonomy{ margin: 10px auto; max-width: 1030px; } .ampforwp_single_excerpt { margin-bottom:15px; font-size: 15px; text-align:center}
178
  .single-post .amp_author_area amp-img{ margin: 0; float: left; margin-right: 12px; border-radius: 60px; }
179
  .single-post .amp_author_area .amp_author_area_wrapper{ display: inline-block; width: 100%; line-height: 1.4; margin-top: 2px; font-size: 13px; color:#333; font-family: sans-serif; }
180
  <?php if(is_single()){?>
templates/design-manager/design-3/archive.php CHANGED
@@ -77,11 +77,26 @@ if ( get_query_var( 'paged' ) ) {
77
  </div> <?php
78
  }
79
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  } ?>
81
 
82
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
83
- $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ;
84
- $ampforwp_amp_post_url = user_trailingslashit( $ampforwp_amp_post_url );
85
 
86
  if( in_array( 'ampforwp-custom-type-amp-endpoint' , $redux_builder_amp ) ) {
87
  if (isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
@@ -125,12 +140,28 @@ if ( get_query_var( 'paged' ) ) {
125
  }
126
  ?>
127
  <p class="large-screen-excerpt-design-3">
128
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15'); ?> </p>
 
 
 
 
 
 
 
 
 
129
  <p class="small-screen-excerpt-design-3" > <?php
130
  if($redux_builder_amp['excerpt-option-design-3']== true) {
131
- $excertp_length='';
132
- $excertp_length = $redux_builder_amp['amp-design-3-excerpt'];
133
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
 
134
  </p>
135
  <div class="featured_time">
136
  <?php
77
  </div> <?php
78
  }
79
  }
80
+ if(is_category() && 1 == $redux_builder_amp['ampforwp-sub-categories-support']){
81
+ $parent_cat_id = '';
82
+ $cat_childs = array();
83
+ $parent_cat_id = get_queried_object_id();
84
+ $cat_childs = get_terms( array(
85
+ 'taxonomy' => get_queried_object()->taxonomy,
86
+ 'parent' => $parent_cat_id)
87
+ );
88
+ if(!empty($cat_childs)){
89
+ echo "<div class='amp-sub-archives'><ul>";
90
+ foreach ($cat_childs as $cat_child ) {
91
+ echo '<li><a href="' . get_term_link( $cat_child ) . '">' . $cat_child->name . '</a></li>';
92
+ }
93
+ echo "</ul></div>";
94
+ }
95
+ }
96
  } ?>
97
 
98
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
99
+ $ampforwp_amp_post_url = ampforwp_url_controller( get_permalink() );
 
100
 
101
  if( in_array( 'ampforwp-custom-type-amp-endpoint' , $redux_builder_amp ) ) {
102
  if (isset($redux_builder_amp['ampforwp-custom-type-amp-endpoint']) && $redux_builder_amp['ampforwp-custom-type-amp-endpoint']) {
140
  }
141
  ?>
142
  <p class="large-screen-excerpt-design-3">
143
+ <?php
144
+ $excerpt_length ='';
145
+ $excerpt_length = 15;
146
+ $final_content = "";
147
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
148
+
149
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
150
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
151
+ }
152
+ echo $final_content; ?> </p>
153
  <p class="small-screen-excerpt-design-3" > <?php
154
  if($redux_builder_amp['excerpt-option-design-3']== true) {
155
+ $excerpt_length='';
156
+ $excerpt_length = $redux_builder_amp['amp-design-3-excerpt'];
157
+ $final_content = "";
158
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
159
+
160
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
161
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
162
+ }
163
+ echo $final_content;
164
+ } ?>
165
  </p>
166
  <div class="featured_time">
167
  <?php
templates/design-manager/design-3/elements/bread-crumbs.php CHANGED
@@ -4,7 +4,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
- $home_title = 'Homepage';
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
@@ -19,7 +19,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
  // Home page
22
- echo '<li class="item-home"><a class="bread-link bread-home" href="' . user_trailingslashit(trailingslashit( get_home_url() ) . AMPFORWP_AMP_QUERY_VAR) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
@@ -32,7 +32,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
32
  $author_url= get_author_posts_url($userdata->ID);
33
 
34
  // Display author name
35
- echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'.$author_url. AMPFORWP_AMP_QUERY_VAR . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
@@ -45,7 +45,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
45
  $post_type_object = get_post_type_object($post_type);
46
  $post_type_archive = get_post_type_archive_link($post_type);
47
 
48
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
@@ -61,7 +61,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
61
  $post_type_object = get_post_type_object($post_type);
62
  $post_type_archive = get_post_type_archive_link($post_type);
63
 
64
- echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . $post_type_archive . AMPFORWP_AMP_QUERY_VAR . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
@@ -82,7 +82,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
82
  foreach($cat_parents as $parents) {
83
  $cat_id = get_cat_ID( $parents);
84
  $cat_link = get_category_link($cat_id);
85
- $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. user_trailingslashit(trailingslashit($cat_link).AMPFORWP_AMP_QUERY_VAR).'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
@@ -104,7 +104,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
104
  // Else if post is in a custom taxonomy
105
  } else if(!empty($cat_id)) {
106
 
107
- echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . $cat_link .AMPFORWP_AMP_QUERY_VAR . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
108
  }
109
 
110
  } else if ( is_category() ) {
@@ -125,7 +125,7 @@ if(isset($redux_builder_amp['ampforwp-bread-crumb']) && $redux_builder_amp['ampf
125
  // Parent page loop
126
  if ( !isset( $parents ) ) $parents = null;
127
  foreach ( $anc as $ancestor ) {
128
- $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . get_permalink($ancestor) . AMPFORWP_AMP_QUERY_VAR . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
129
  }
130
 
131
  // Display parent pages
4
  // Settings
5
  $breadcrums_id = 'breadcrumbs';
6
  $breadcrums_class = 'breadcrumbs';
7
+ $home_title = ampforwp_translation($redux_builder_amp['amp-translator-breadcrumbs-homepage-text'] , 'Homepage' );
8
 
9
  // If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
10
  $custom_taxonomy = 'product_cat';
19
  echo '<ul id="' . $breadcrums_id . '" class="' . $breadcrums_class . '">';
20
 
21
  // Home page
22
+ echo '<li class="item-home"><a class="bread-link bread-home" href="' . ampforwp_url_controller (get_home_url() ) . '" title="' . $home_title . '">' . $home_title . '</a></li>';
23
 
24
  if ( is_archive() && !is_tax() && !is_category() && !is_tag() && !is_author() ) {
25
 
32
  $author_url= get_author_posts_url($userdata->ID);
33
 
34
  // Display author name
35
+ echo '<li class="item-current item-current-' . $userdata->user_nicename . '"><a class="bread-current bread-current-' . $userdata->user_nicename . '" title="' . $userdata->display_name . '" href="'. ampforwp_url_controller( $author_url ) . '">' . 'Author: ' . $userdata->display_name . '</a></li>';
36
 
37
  } else if ( is_archive() && is_tax() && !is_category() && !is_tag() ) {
38
 
45
  $post_type_object = get_post_type_object($post_type);
46
  $post_type_archive = get_post_type_archive_link($post_type);
47
 
48
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . ampforwp_url_controller($post_type_archive ) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
49
  }
50
 
51
  $custom_tax_name = get_queried_object()->name;
61
  $post_type_object = get_post_type_object($post_type);
62
  $post_type_archive = get_post_type_archive_link($post_type);
63
 
64
+ echo '<li class="item-cat item-custom-post-type-' . $post_type . '"><a class="bread-cat bread-custom-post-type-' . $post_type . '" href="' . ampforwp_url_controller( $post_type_archive ) . '" title="' . $post_type_object->labels->name . '">' . $post_type_object->labels->name . '</a></li>';
65
  }
66
 
67
  // Get post category info
82
  foreach($cat_parents as $parents) {
83
  $cat_id = get_cat_ID( $parents);
84
  $cat_link = get_category_link($cat_id);
85
+ $cat_display .= '<li class="item-cat item-cat-' . $cat_id . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $parents. '" href="'. ampforwp_url_controller( $cat_link ).'" title="' . $parents . '">' . $parents . '</a></li>';
86
  }
87
  }
88
 
104
  // Else if post is in a custom taxonomy
105
  } else if(!empty($cat_id)) {
106
 
107
+ echo '<li class="item-cat item-cat-' . $cat_id . ' item-cat-' . $cat_nicename . '"><a class="bread-cat bread-cat-' . $cat_id . ' bread-cat-' . $cat_nicename . '" href="' . ampforwp_url_controller( $cat_link ) . '" title="' . $cat_name . '">' . $cat_name . '</a></li>';
108
  }
109
 
110
  } else if ( is_category() ) {
125
  // Parent page loop
126
  if ( !isset( $parents ) ) $parents = null;
127
  foreach ( $anc as $ancestor ) {
128
+ $parents .= '<li class="item-parent item-parent-' . $ancestor . '"><a class="bread-parent bread-parent-' . $ancestor . '" href="' . ampforwp_url_controller( get_permalink($ancestor) ) . '" title="' . get_the_title($ancestor) . '">' . get_the_title($ancestor) . '</a></li>';
129
  }
130
 
131
  // Display parent pages
templates/design-manager/design-3/elements/content.php CHANGED
@@ -3,16 +3,7 @@
3
  <!--Post Content here-->
4
  <div class="amp-wp-content the_content">
5
  <?php global $redux_builder_amp;
6
- if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
7
- if($redux_builder_amp['enable-excerpt-single']) {
8
- if( has_excerpt() ){ ?>
9
- <div class="ampforwp_single_excerpt">
10
- <?php $content = get_the_excerpt();
11
- echo $content; ?>
12
- </div> <?php
13
- }
14
- }
15
- }
16
  do_action('ampforwp_before_post_content',$this); //Post before Content here
17
 
18
  $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
@@ -50,7 +41,8 @@
50
  <div id="pagination">
51
  <?php $next_post = get_next_post();
52
  if (!empty( $next_post )) { ?>
53
- <span><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-next-read-text'], 'Next Read' ); ?></span> <a href="<?php echo user_trailingslashit( trailingslashit(get_permalink( $next_post->ID )) . AMPFORWP_AMP_QUERY_VAR) ; ?>"><?php echo $next_post->post_title; ?> &raquo;</a> <?php
 
54
  } ?>
55
  </div>
56
  </div>
3
  <!--Post Content here-->
4
  <div class="amp-wp-content the_content">
5
  <?php global $redux_builder_amp;
6
+
 
 
 
 
 
 
 
 
 
7
  do_action('ampforwp_before_post_content',$this); //Post before Content here
8
 
9
  $amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
41
  <div id="pagination">
42
  <?php $next_post = get_next_post();
43
  if (!empty( $next_post )) { ?>
44
+ <span><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-next-read-text'], 'Next Read' ); ?></span> <a href="<?php echo
45
+ ampforwp_url_controller( get_permalink( $next_post->ID ) ); ?>"><?php echo $next_post->post_title; ?> &raquo;</a> <?php
46
  } ?>
47
  </div>
48
  </div>
templates/design-manager/design-3/elements/featured-image.php CHANGED
@@ -1,18 +1,21 @@
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
 
 
 
3
  $featured_image = $this->get( 'featured_image' );
4
- $amp_html = "";
5
- $caption = "";
6
- if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || $redux_builder_amp['ampforwp-featured-image-from-content'] == true){
7
  if ( $featured_image ) {
8
  $amp_html = $featured_image['amp_html'];
9
  $caption = $featured_image['caption'];
10
  }
11
- elseif ( ampforwp_is_custom_field_featured_image() ) {
12
  $amp_img_src = ampforwp_cf_featured_image_src();
13
- $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
 
 
14
  }
15
- elseif($redux_builder_amp['ampforwp-featured-image-from-content'] == true){
16
  $amp_html = ampforwp_get_featured_image_from_content();
17
  }
18
  if( $amp_html ) {
1
  <?php do_action('ampforwp_before_featured_image_hook',$this);
2
  global $redux_builder_amp, $post;
3
+ $featured_image = "";
4
+ $amp_html = "";
5
+ $caption = "";
6
  $featured_image = $this->get( 'featured_image' );
7
+ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src() ) || true == $redux_builder_amp['ampforwp-featured-image-from-content'] ){
 
 
8
  if ( $featured_image ) {
9
  $amp_html = $featured_image['amp_html'];
10
  $caption = $featured_image['caption'];
11
  }
12
+ if ( ampforwp_is_custom_field_featured_image() ) {
13
  $amp_img_src = ampforwp_cf_featured_image_src();
14
+ if( $amp_img_src ){
15
+ $amp_html = "<amp-img src='$amp_img_src' width=300 height=250 layout=responsive ></amp-img>";
16
+ }
17
  }
18
+ if( true == $redux_builder_amp['ampforwp-featured-image-from-content'] && ampforwp_get_featured_image_from_content() ){
19
  $amp_html = ampforwp_get_featured_image_from_content();
20
  }
21
  if( $amp_html ) {
templates/design-manager/design-3/elements/meta-info.php CHANGED
@@ -23,7 +23,7 @@ if( isset($redux_builder_amp['ampforwp-cats-single']) && $redux_builder_amp['amp
23
  global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-in-designthree'] .' ', 'accelerated-mobile-pages' ));
24
  foreach ($ampforwp_categories as $cat ) {
25
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
26
- echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. user_trailingslashit( trailingslashit(get_category_link($cat->term_id)).'amp') . '" >'.$cat->name .'</a></span>');
27
  }
28
  else {
29
  echo ('<span>'.$cat->name .'</span>');
@@ -34,7 +34,7 @@ if( isset($redux_builder_amp['ampforwp-cats-single']) && $redux_builder_amp['amp
34
  <?php endif; } ?>
35
 
36
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
37
- <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text']. ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></span>
38
  <?php endif; ?>
39
 
40
  </div>
23
  global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-in-designthree'] .' ', 'accelerated-mobile-pages' ));
24
  foreach ($ampforwp_categories as $cat ) {
25
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single']) {
26
+ echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'. ampforwp_url_controller( get_category_link( $cat->term_id ) ) . '" >'.$cat->name .'</a></span>');
27
  }
28
  else {
29
  echo ('<span>'.$cat->name .'</span>');
34
  <?php endif; } ?>
35
 
36
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
37
+ <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp; echo apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text']. ' ', 'On') . get_the_date( get_option( 'date_format' ) ) ) ?></span>
38
  <?php endif; ?>
39
 
40
  </div>
templates/design-manager/design-3/elements/meta-taxonomy.php CHANGED
@@ -8,7 +8,7 @@
8
  <div class="amp-wp-meta amp-wp-content ampforwp-tax-tag">
9
  <?php foreach ($ampforwp_tags as $tag) {
10
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single'] ) {
11
- echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. user_trailingslashit( trailingslashit(get_tag_link($tag->term_id)).'amp') .'" >'. $tag->name .'</a></span>');//#934
12
  }
13
  else {
14
  echo '<span>'. $tag->name .'</span>';
8
  <div class="amp-wp-meta amp-wp-content ampforwp-tax-tag">
9
  <?php foreach ($ampforwp_tags as $tag) {
10
  if( isset($redux_builder_amp['ampforwp-archive-support']) && $redux_builder_amp['ampforwp-archive-support'] && isset($redux_builder_amp['ampforwp-cats-tags-links-single']) && $redux_builder_amp['ampforwp-cats-tags-links-single'] ) {
11
+ echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'. ampforwp_url_controller( get_tag_link( $tag->term_id ) ) .'" >'. $tag->name .'</a></span>');//#934
12
  }
13
  else {
14
  echo '<span>'. $tag->name .'</span>';
templates/design-manager/design-3/elements/related-posts.php CHANGED
@@ -69,9 +69,8 @@
69
  <?php
70
  while( $my_query->have_posts() ) {
71
  $my_query->the_post();
72
- $related_post_permalink = get_permalink();
73
- $related_post_permalink = trailingslashit($related_post_permalink);
74
- $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
75
  ?>
76
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
77
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
69
  <?php
70
  while( $my_query->have_posts() ) {
71
  $my_query->the_post();
72
+ $related_post_permalink = "";
73
+ $related_post_permalink = ampforwp_url_controller( get_permalink() );
 
74
  ?>
75
  <li class="<?php if ( ampforwp_has_post_thumbnail() ) { echo'has_related_thumbnail'; } else { echo 'no_related_thumbnail'; } ?>">
76
  <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
templates/design-manager/design-3/elements/social-icons.php CHANGED
@@ -12,7 +12,7 @@
12
  <i class="icono-share"></i>
13
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
14
  $facebook_like_url = '';
15
- $facebook_like_url = $redux_builder_amp['ampforwp-facebook-like-url'];
16
  if( $facebook_like_url ){ ?>
17
  <amp-facebook-like width=90 height=28
18
  layout="fixed"
12
  <i class="icono-share"></i>
13
  <?php if( true == $redux_builder_amp['ampforwp-facebook-like-button'] ) {
14
  $facebook_like_url = '';
15
+ $facebook_like_url = get_the_permalink();
16
  if( $facebook_like_url ){ ?>
17
  <amp-facebook-like width=90 height=28
18
  layout="fixed"
templates/design-manager/design-3/elements/title.php CHANGED
@@ -1,8 +1,20 @@
1
- <?php do_action('ampforwp_above_the_title',$this); ?>
 
2
  <header class="amp-wp-content amp-wp-article-header ampforwp-title">
3
  <h1 class="amp-wp-title"> <?php
4
  $ampforwp_title = $this->get( 'post_title' ) ;
5
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
6
- echo wp_kses_data( $ampforwp_title );?></h1>
7
- <?php do_action('ampforwp_below_the_title',$this); ?>
8
- </header>
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php global $redux_builder_amp;
2
+ do_action('ampforwp_above_the_title',$this); ?>
3
  <header class="amp-wp-content amp-wp-article-header ampforwp-title">
4
  <h1 class="amp-wp-title"> <?php
5
  $ampforwp_title = $this->get( 'post_title' ) ;
6
  $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
7
+ echo wp_kses_data( $ampforwp_title );?>
8
+ </h1>
9
+ <?php if( array_key_exists( 'enable-excerpt-single' , $redux_builder_amp ) ) {
10
+ if($redux_builder_amp['enable-excerpt-single']) {
11
+ if( has_excerpt() ){ ?>
12
+ <div class="ampforwp_single_excerpt">
13
+ <?php $content = get_the_excerpt();
14
+ echo $content; ?>
15
+ </div> <?php
16
+ }
17
+ }
18
+ } ?>
19
+ </header>
20
+ <?php do_action('ampforwp_below_the_title',$this); ?>
templates/design-manager/design-3/footer.php CHANGED
@@ -14,6 +14,7 @@
14
  'link_after' => '</span>',
15
  'echo' => false
16
  ) );
 
17
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
18
  $sanitized_menu = $sanitizer_obj->get_amp_content();
19
  echo $sanitized_menu; ?>
@@ -83,7 +84,7 @@
83
  </ul>
84
  </div>
85
  <?php }
86
- if( isset( $redux_builder_amp['ampforwp-footer-top-design3'] ) =='1' ){ ?>
87
  <p class="rightslink back-to-top">
88
  <a href="#">
89
  <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?>
@@ -92,7 +93,11 @@
92
  <?php
93
  global $allowed_html;
94
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_html ) ;
95
- if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ?> | <?php ampforwp_view_nonamp(); } ?>
 
 
 
 
96
  </p>
97
  <?php global $redux_builder_amp; if( $redux_builder_amp['amp-design-3-credit-link'] ) { ?>
98
  <p class="poweredby">
14
  'link_after' => '</span>',
15
  'echo' => false
16
  ) );
17
+ $menu = apply_filters('ampforwp_menu_content', $menu);
18
  $sanitizer_obj = new AMPFORWP_Content( $menu, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
19
  $sanitized_menu = $sanitizer_obj->get_amp_content();
20
  echo $sanitized_menu; ?>
84
  </ul>
85
  </div>
86
  <?php }
87
+ if( $redux_builder_amp['ampforwp-footer-top-design3'] == '1' ){ ?>
88
  <p class="rightslink back-to-top">
89
  <a href="#">
90
  <?php echo ampforwp_translation( $redux_builder_amp['amp-translator-top-text'], 'Top'); ?>
93
  <?php
94
  global $allowed_html;
95
  echo wp_kses( ampforwp_translation($redux_builder_amp['amp-translator-footer-text'], 'Footer') ,$allowed_html ) ;
96
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') {
97
+ if($redux_builder_amp['amp-translator-footer-text']){ ?> | <?php ampforwp_view_nonamp(); }
98
+ else{
99
+ ampforwp_view_nonamp();
100
+ } } ?>
101
  </p>
102
  <?php global $redux_builder_amp; if( $redux_builder_amp['amp-design-3-credit-link'] ) { ?>
103
  <p class="poweredby">
templates/design-manager/design-3/frontpage.php CHANGED
@@ -3,44 +3,29 @@
3
  //WPML Static Front Page Support #1111
4
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
5
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
6
- $post_id = get_option('page_on_front');
7
-
8
  }
9
  else{
10
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
11
  }
12
  $template = new AMP_Post_Template( $post_id );?>
13
  <!doctype html>
14
- <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
15
  <head>
16
  <meta charset="utf-8">
17
- <?php do_action( 'amp_post_template_head', $this ); ?>
18
- <?php
19
- $amp_custom_content_enable = get_post_meta($template->data['post_id'], 'ampforwp_custom_content_editor_checkbox', true);
20
- if ( ! $amp_custom_content_enable ) {
21
- $amp_component_scripts = $template->data['amp_component_scripts'];
22
- foreach ($amp_component_scripts as $ampforwp_service => $ampforwp_js_file) {
23
- if ( $ampforwp_service == 'amp-sidebar' || $ampforwp_service == 'amp-analytics') {
24
- continue;
25
- } ?>
26
- <script custom-element="<?php echo $ampforwp_service; ?>" src="<?php echo $ampforwp_js_file; ?>" async></script> <?php
27
- }
28
- } ?>
29
  <style amp-custom>
30
- <?php do_action( 'amp_post_template_css', $this ); ?>
31
  </style>
32
  </head>
33
-
34
  <body <?php ampforwp_body_class('single-post design_3_wrapper');?>>
35
- <?php do_action('ampforwp_body_beginning', $this); ?>
36
- <?php $this->load_parts( array( 'header-bar' ) ); ?>
37
-
38
  <?php do_action( 'ampforwp_after_header', $template ); ?>
39
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
40
-
41
  <?php do_action('ampforwp_frontpage_below_loop') ?>
42
- <?php do_action( 'amp_post_template_above_footer', $this ); ?>
43
- <?php $this->load_parts( array( 'footer' ) ); ?>
44
- <?php do_action( 'amp_post_template_footer', $this ); ?>
45
  </body>
46
  </html>
3
  //WPML Static Front Page Support #1111
4
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
5
  if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
6
+ $post_id = get_option('page_on_front');
 
7
  }
8
  else{
9
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
10
  }
11
  $template = new AMP_Post_Template( $post_id );?>
12
  <!doctype html>
13
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $template->get( 'html_tag_attributes' ) ); ?>>
14
  <head>
15
  <meta charset="utf-8">
16
+ <?php do_action( 'amp_post_template_head', $template ); ?>
 
 
 
 
 
 
 
 
 
 
 
17
  <style amp-custom>
18
+ <?php do_action( 'amp_post_template_css', $template ); ?>
19
  </style>
20
  </head>
 
21
  <body <?php ampforwp_body_class('single-post design_3_wrapper');?>>
22
+ <?php do_action('ampforwp_body_beginning', $template); ?>
23
+ <?php $template->load_parts( array( 'header-bar' ) ); ?>
 
24
  <?php do_action( 'ampforwp_after_header', $template ); ?>
25
  <?php do_action('ampforwp_frontpage_above_loop',$template, $post_id) ?>
 
26
  <?php do_action('ampforwp_frontpage_below_loop') ?>
27
+ <?php do_action( 'amp_post_template_above_footer', $template ); ?>
28
+ <?php $template->load_parts( array( 'footer' ) ); ?>
29
+ <?php do_action( 'amp_post_template_footer', $template ); ?>
30
  </body>
31
  </html>
templates/design-manager/design-3/header-bar.php CHANGED
@@ -22,6 +22,7 @@ if(isset($redux_builder_amp['ampforwp-amp-menu']) && $redux_builder_amp['ampforw
22
  'menu_class'=>'amp-menu',
23
  'echo'=>false
24
  ) );
 
25
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
26
  $sanitized_menu = $sanitizer_obj->get_amp_content();
27
  echo $sanitized_menu;
22
  'menu_class'=>'amp-menu',
23
  'echo'=>false
24
  ) );
25
+ $menu_html_content = apply_filters('ampforwp_menu_content', $menu_html_content);
26
  $sanitizer_obj = new AMPFORWP_Content( $menu_html_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(), 'AMP_Style_Sanitizer' => array(), ) ) );
27
  $sanitized_menu = $sanitizer_obj->get_amp_content();
28
  echo $sanitized_menu;
templates/design-manager/design-3/index.php CHANGED
@@ -40,7 +40,7 @@ if ( get_query_var( 'paged' ) ) {
40
  delay="4000">
41
  <?php
42
  global $redux_builder_amp;
43
- if( $redux_builder_amp['amp-design-3-category-selector'] ){
44
  $args = array(
45
  'cat' => $redux_builder_amp['amp-design-3-category-selector'],
46
  'posts_per_page' => 4,
@@ -146,12 +146,29 @@ if ( get_query_var( 'paged' ) ) {
146
  }
147
  ?>
148
  <p class="large-screen-excerpt-design-3">
149
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15'); ?> </p>
 
 
 
 
 
 
 
 
 
 
 
150
  <p class="small-screen-excerpt-design-3"> <?php
151
  if($redux_builder_amp['excerpt-option-design-3']== true) {
152
- $excertp_length='';
153
- $excertp_length = $redux_builder_amp['amp-design-3-excerpt'];
154
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
155
  </p>
156
  <?php
157
  global $redux_builder_amp;
40
  delay="4000">
41
  <?php
42
  global $redux_builder_amp;
43
+ if( isset($redux_builder_amp['amp-design-3-category-selector']) && $redux_builder_amp['amp-design-3-category-selector'] ){
44
  $args = array(
45
  'cat' => $redux_builder_amp['amp-design-3-category-selector'],
46
  'posts_per_page' => 4,
146
  }
147
  ?>
148
  <p class="large-screen-excerpt-design-3">
149
+ <?php
150
+ $excerpt_length ='';
151
+ $excerpt_length = 15;
152
+ $final_content_1 = "";
153
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
154
+
155
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
156
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
157
+ }
158
+ echo $final_content;
159
+
160
+ ?> </p>
161
  <p class="small-screen-excerpt-design-3"> <?php
162
  if($redux_builder_amp['excerpt-option-design-3']== true) {
163
+ $excerpt_length = '';
164
+ $excerpt_length = $redux_builder_amp['amp-design-3-excerpt'];
165
+ $final_content = "";
166
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
167
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
168
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
169
+ }
170
+ echo $final_content;
171
+ } ?>
172
  </p>
173
  <?php
174
  global $redux_builder_amp;
templates/design-manager/design-3/search.php CHANGED
@@ -57,15 +57,14 @@
57
  <?php global $redux_builder_amp; ?>
58
  <h1 class="amp-wp-content page-title"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-search-text'], 'You searched for:') . ' ' . get_search_query();?> </h1>
59
 
60
- <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();
61
- $ampforwp_amp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ; ?>
62
 
63
  <div class="amp-wp-content amp-loop-list">
64
  <?php if ( ampforwp_has_post_thumbnail() ) {
65
  $thumb_url = ampforwp_get_post_thumbnail();
66
  if($thumb_url){
67
  ?>
68
- <div class="home-post_image"><a href="<?php echo esc_url( trailingslashit( $ampforwp_amp_post_url ) ); ?>"><amp-img layout="responsive" src=<?php echo esc_url($thumb_url); ?> width=450 height=270 ></amp-img></a></div>
69
  <?php }
70
  } ?>
71
 
@@ -75,7 +74,7 @@
75
  <li class="amp-cat-<?php echo $category->term_id;?>"><?php echo $category->cat_name ?></li>
76
  <?php } ?>
77
  </ul>
78
- <h2 class="amp-wp-title"> <a href="<?php echo esc_url( trailingslashit( $ampforwp_amp_post_url ) ); ?>"> <?php the_title(); ?></a></h2>
79
 
80
 
81
  <?php
@@ -86,13 +85,29 @@
86
  }
87
  ?>
88
  <p class="large-screen-excerpt-design-3">
89
- <?php echo wp_trim_words( strip_shortcodes( $content ) , '15');
 
 
 
 
 
 
 
 
 
90
  ?></p>
91
  <p class="small-screen-excerpt-design-3" > <?php
92
  if($redux_builder_amp['excerpt-option-design-3']== true) {
93
- $excertp_length='';
94
- $excertp_length = $redux_builder_amp['amp-design-3-excerpt'];
95
- echo wp_trim_words( strip_shortcodes( $content ) , $excertp_length ); } ?>
 
 
 
 
 
 
 
96
  </p>
97
  <div class="featured_time"><?php
98
  $post_date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' );
57
  <?php global $redux_builder_amp; ?>
58
  <h1 class="amp-wp-content page-title"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-search-text'], 'You searched for:') . ' ' . get_search_query();?> </h1>
59
 
60
+ <?php if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post();?>
 
61
 
62
  <div class="amp-wp-content amp-loop-list">
63
  <?php if ( ampforwp_has_post_thumbnail() ) {
64
  $thumb_url = ampforwp_get_post_thumbnail();
65
  if($thumb_url){
66
  ?>
67
+ <div class="home-post_image"><a href="<?php echo ampforwp_url_controller( get_permalink() ); ?>"><amp-img layout="responsive" src=<?php echo esc_url($thumb_url); ?> width=450 height=270 ></amp-img></a></div>
68
  <?php }
69
  } ?>
70
 
74
  <li class="amp-cat-<?php echo $category->term_id;?>"><?php echo $category->cat_name ?></li>
75
  <?php } ?>
76
  </ul>
77
+ <h2 class="amp-wp-title"> <a href="<?php echo ampforwp_url_controller( get_permalink() ); ?>"> <?php the_title(); ?></a></h2>
78
 
79
 
80
  <?php
85
  }
86
  ?>
87
  <p class="large-screen-excerpt-design-3">
88
+ <?php
89
+ $excerpt_length ='';
90
+ $excerpt_length = 15;
91
+ $final_content = "";
92
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
93
+
94
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
95
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
96
+ }
97
+ echo $final_content;
98
  ?></p>
99
  <p class="small-screen-excerpt-design-3" > <?php
100
  if($redux_builder_amp['excerpt-option-design-3']== true) {
101
+ $excerpt_length ='';
102
+ $excerpt_length = $redux_builder_amp['amp-design-3-excerpt'];
103
+ $final_content = "";
104
+ $final_content = apply_filters('ampforwp_modify_index_content', $content, $excerpt_length );
105
+
106
+ if ( false === has_filter('ampforwp_modify_index_content' ) ) {
107
+ $final_content = wp_trim_words( strip_shortcodes( $content ) , $excerpt_length );
108
+ }
109
+ echo $final_content;
110
+ } ?>
111
  </p>
112
  <div class="featured_time"><?php
113
  $post_date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' );
templates/design-manager/design-3/style.php CHANGED
@@ -164,7 +164,6 @@ h1.amp-wp-title{ margin: 0; color: #333333; font-size: 48px; line-height: 58px;
164
  .custom-amp-socialsharing-line{background:#00b900}
165
  .custom-amp-social-sharing-vk{background:#45668e}
166
  .custom-amp-social-sharing-odnoklassniki{background:#ed812b}
167
- .ampforwp-social-icons amp-facebook-like{border-radius: 60px;position: relative;top: -6px;}
168
  .amp-wp-tax-tag { list-style: none; display: inline-block; }
169
  figure{ margin: 0 0 20px 0; }
170
  figure amp-img{ max-width:100%; }
@@ -189,7 +188,7 @@ main .amp-wp-content.relatedpost{ background: none; box-shadow: none; padding:0p
189
  .related_posts ol li amp-img{ width:100px; float:left; margin-right:15px }
190
  .related_posts ol li p{ font-size: 12px; color: #999; line-height: 1.2; margin: 12px 0 0 0; }
191
  .no_related_thumbnail{ padding: 15px 18px; }
192
- .no_related_thumbnail .related_link{ margin: 16px 18px 20px 19px; } .ampforwp_single_excerpt{ margin-bottom: 15px; }
193
  <?php }
194
  if( $redux_builder_amp['wordpress-comments-support'] ==1) { ?>
195
  /* Comments */
@@ -282,8 +281,9 @@ amp-lightbox{ background: rgba(0, 0, 0,0.85); }
282
  #searchsubmit{opacity:0}
283
  .featured_time{ font-size: 12px; color: #fff; opacity: 0.8; padding-left: 20px; }
284
  .archives_body main{ margin-top:30px }
285
- .archives_body .page-title, .taxonomy-description{padding: 0 15px}
286
  .taxonomy-description p{margin-top: 5px;font-size: 14px;line-height: 1.5;}
 
287
  <?php if(is_home() && $redux_builder_amp['amp-frontpage-select-option']==0){?>
288
  /* AMP carousel */
289
  .amp-carousel-button-prev, .amp-carousel-button-next{ top:30px;border-radius:60px; }
164
  .custom-amp-socialsharing-line{background:#00b900}
165
  .custom-amp-social-sharing-vk{background:#45668e}
166
  .custom-amp-social-sharing-odnoklassniki{background:#ed812b}
 
167
  .amp-wp-tax-tag { list-style: none; display: inline-block; }
168
  figure{ margin: 0 0 20px 0; }
169
  figure amp-img{ max-width:100%; }
188
  .related_posts ol li amp-img{ width:100px; float:left; margin-right:15px }
189
  .related_posts ol li p{ font-size: 12px; color: #999; line-height: 1.2; margin: 12px 0 0 0; }
190
  .no_related_thumbnail{ padding: 15px 18px; }
191
+ .no_related_thumbnail .related_link{ margin: 16px 18px 20px 19px; }
192
  <?php }
193
  if( $redux_builder_amp['wordpress-comments-support'] ==1) { ?>
194
  /* Comments */
281
  #searchsubmit{opacity:0}
282
  .featured_time{ font-size: 12px; color: #fff; opacity: 0.8; padding-left: 20px; }
283
  .archives_body main{ margin-top:30px }
284
+ .archives_body .page-title, .taxonomy-description, .amp-sub-archives{padding: 0 15px}
285
  .taxonomy-description p{margin-top: 5px;font-size: 14px;line-height: 1.5;}
286
+ .amp-sub-archives li{width: 50%;} .amp-sub-archives ul{padding: 0;list-style: none;display: flex;font-size: 12px;line-height: 1.2;margin: 5px 0 10px 0px;}
287
  <?php if(is_home() && $redux_builder_amp['amp-frontpage-select-option']==0){?>
288
  /* AMP carousel */
289
  .amp-carousel-button-prev, .amp-carousel-button-next{ top:30px;border-radius:60px; }
templates/features.php CHANGED
@@ -106,6 +106,8 @@
106
  96. ampforwp_is_front_page() ampforwp_is_home() and ampforwp_is_blog is created
107
  97. Change the format of the post date on Loops #1384
108
  98. Create Dynamic url of amp according to the permalink structure #1318
 
 
109
  */
110
  // Adding AMP-related things to the main theme
111
  global $redux_builder_amp;
@@ -1038,6 +1040,10 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
1038
  $content = preg_replace('/<span(.*?)(color=".*?")(.*?)>/', '<span$1$3>', $content);
1039
  // removing sl-processed attribute
1040
  $content = preg_replace('/(<[^>]+) sl-processed=".*?"/', '$1', $content);
 
 
 
 
1041
 
1042
  return $content;
1043
  }
@@ -1966,8 +1972,7 @@ function ampforwp_frontpage_title_markup () {
1966
  // 27. Clean the Defer issue
1967
  // TODO : Get back to this issue. #407
1968
  function ampforwp_the_content_filter_full( $content_buffer ) {
1969
- $ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
1970
- if ( $ampforwp_is_amp_endpoint ) {
1971
  $content_buffer = preg_replace("/' defer='defer/", "", $content_buffer);
1972
  $content_buffer = preg_replace("/' defer onload='/", "", $content_buffer);
1973
  $content_buffer = preg_replace("/' defer /", "", $content_buffer);
@@ -2478,7 +2483,8 @@ function ampforwp_output_widget_content_above_loop() {
2478
  $sidebar_output = "";
2479
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
2480
  if ( $sanitized_sidebar) {
2481
- $sidebar_output = $sanitized_sidebar->get_amp_content();
 
2482
  }
2483
  if ( $sidebar_output) { echo $sidebar_output ; }
2484
  }
@@ -2490,7 +2496,8 @@ function ampforwp_output_widget_content_below_loop() {
2490
  $sidebar_output = "";
2491
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
2492
  if ( $sanitized_sidebar) {
2493
- $sidebar_output = $sanitized_sidebar->get_amp_content();
 
2494
  }
2495
  if ( $sidebar_output) : echo $sidebar_output; endif;
2496
  }
@@ -2503,6 +2510,7 @@ function ampforwp_output_widget_content_below_the_header() {
2503
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
2504
  if ( $sanitized_sidebar) {
2505
  $sidebar_output = $sanitized_sidebar->get_amp_content();
 
2506
  }?>
2507
  <div class="amp-wp-content widget-wrapper">
2508
  <div class="amp_widget_below_the_header">
@@ -2517,7 +2525,8 @@ function ampforwp_output_widget_content_above_the_footer() {
2517
  $sidebar_output = "";
2518
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
2519
  if ( $sanitized_sidebar) {
2520
- $sidebar_output = $sanitized_sidebar->get_amp_content();
 
2521
  }?>
2522
  <div class="amp-wp-content widget-wrapper">
2523
  <div class="amp_widget_above_the_footer">
@@ -2525,6 +2534,12 @@ function ampforwp_output_widget_content_above_the_footer() {
2525
  </div>
2526
 
2527
  <?php }
 
 
 
 
 
 
2528
  // Sidebar Content Sanitizer
2529
  function ampforwp_sidebar_content_sanitizer($sidebar){
2530
  $sanitized_sidebar = "";
@@ -2763,7 +2778,7 @@ function ampforwp_search_or_homepage_or_staticpage_metadata( $metadata, $post )
2763
  $metadata['headline'] = $headline; // proper headline added
2764
  }
2765
  // Description for Structured Data
2766
- $desc = esc_attr( convert_chars( wptexturize ( ampforwp_generate_meta_desc() ) ) );
2767
  $metadata['description'] = $desc;
2768
  return $metadata;
2769
  }
@@ -2953,12 +2968,8 @@ function ampforwp_meta_description() {
2953
  $desc = "" ;
2954
  $desc = ampforwp_generate_meta_desc();
2955
 
2956
- // strip_shortcodes strategy not working here so had to do this way
2957
- // strips shortcodes
2958
- $desc= preg_replace('/\[(.*)?\]/','',$desc);
2959
-
2960
  if( $desc ) {
2961
- echo '<meta name="description" content="'. esc_html( convert_chars( wptexturize ( $desc ) ) ) .'"/>';
2962
  }
2963
  }
2964
 
@@ -3041,7 +3052,30 @@ if ( ! function_exists( 'ampforwp_youtube_shortcode') ) {
3041
  return str_replace( array( '&amp;', '&#038;' ), '&', $str );
3042
  }
3043
  }
3044
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3045
  // 59. Comment Button URL
3046
  function ampforwp_comment_button_url(){
3047
  global $redux_builder_amp;
@@ -3052,7 +3086,10 @@ function ampforwp_comment_button_url(){
3052
  else
3053
  $ampforwp_nonamp = '';
3054
 
3055
- $button_url = trailingslashit( get_permalink() ) .$ampforwp_nonamp. '#commentform';
 
 
 
3056
 
3057
  return $button_url;
3058
  }
@@ -3235,9 +3272,10 @@ function ampforwp_frontpage_comments() {
3235
  <?php
3236
 
3237
  }
3238
- if ( comments_open($postID) ) { ?>
 
3239
  <div class="comment-button-wrapper">
3240
- <a href="<?php echo esc_url( trailingslashit( $comment_button_url ) ) .'?nonamp=1'.'#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
3241
  </div><?php
3242
  }?>
3243
  </div> <?php
@@ -3879,6 +3917,9 @@ function ampforwp_generate_meta_desc(){
3879
  $desc = $genesis_description;
3880
  }
3881
  }
 
 
 
3882
  return $desc;
3883
  }
3884
 
@@ -4241,6 +4282,9 @@ function ampforwp_get_featured_image_from_content($featured_image = "") {
4241
  // Sanitize it
4242
  $amp_html_sanitizer = new AMPFORWP_Content( $image_html, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array() ) ) );
4243
  $amp_html = $amp_html_sanitizer->get_amp_content();
 
 
 
4244
  }
4245
  switch ($featured_image) {
4246
  case 'image':
@@ -4254,9 +4298,27 @@ function ampforwp_get_featured_image_from_content($featured_image = "") {
4254
  default:
4255
  $featured_image_output = $amp_html;
4256
  break;
4257
- }
4258
  return $featured_image_output;
4259
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4260
 
4261
  // 83. Advance Analytics(Google Analytics)
4262
  add_filter('ampforwp_advance_google_analytics','ampforwp_add_advance_ga_fields');
@@ -4336,44 +4398,40 @@ function ampforwp_inline_related_posts(){
4336
 
4337
  while( $my_query->have_posts() ) {
4338
  $my_query->the_post();
4339
- $related_post_permalink = get_permalink();
4340
- $related_post_permalink = trailingslashit($related_post_permalink);
4341
- $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
4342
- if ( has_post_thumbnail() ) {
4343
  $title_class = 'has_related_thumbnail';
4344
- } else {
4345
- $title_class = 'no_related_thumbnail';
4346
- }
4347
 
4348
- $inline_related_posts .= '<li class="'.$title_class.'">
4349
  <a href="'.esc_url( $related_post_permalink ).'" rel="bookmark" title="'.get_the_title().'">';
4350
 
4351
- $thumb_id_2 = get_post_thumbnail_id();
4352
- $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, 'thumbnail', true);
4353
- $thumb_url_2 = $thumb_url_array_2[0];
4354
 
4355
-
4356
- if ( has_post_thumbnail() ) {
4357
- $inline_related_posts .= '<amp-img src="'.esc_url( $thumb_url_2 ).'" width="150" height="150" layout="responsive"></amp-img>';
4358
- }
4359
- $inline_related_posts .='</a>';
4360
- $inline_related_posts .='<div class="related_link">';
4361
- $inline_related_posts .='<a href="'.esc_url( $related_post_permalink ).'">'.get_the_title().'</a>';
4362
- if(has_excerpt()){
4363
- $content ='<p>'.get_the_excerpt().'</p>';
4364
- }else{
4365
- $content ='<p>'.get_the_content().'</p>';
4366
- }
4367
- $inline_related_posts .= '<p>'. wp_trim_words( strip_shortcodes( $content ) , '15' ).'</p>
4368
- </div>
4369
- </li>';
4370
 
4371
- }
4372
-
4373
- }
4374
- $inline_related_posts .= '</</ol>
4375
  </div>
4376
  </div>';
 
4377
  wp_reset_postdata();
4378
  return $inline_related_posts;
4379
  //related posts code ends here
@@ -4382,13 +4440,13 @@ function ampforwp_inline_related_posts(){
4382
  add_action('pre_amp_render_post','ampforwp_add_inline_related_posts');
4383
  function ampforwp_add_inline_related_posts(){
4384
  global $redux_builder_amp;
4385
- if($redux_builder_amp['ampforwp-inline-related-posts'] == 1){
4386
- add_filter('the_content','ampforwp_generate_inline_related_posts');
4387
  }
4388
  }
4389
  function ampforwp_generate_inline_related_posts($content){
4390
  global $post;
4391
-
4392
  $break_point = '</p>';
4393
  $content_parts = explode($break_point, $content);
4394
  $no_of_parts = count($content_parts);
@@ -4396,6 +4454,7 @@ function ampforwp_generate_inline_related_posts($content){
4396
  $half_content = array_chunk($content_parts, $half_index);
4397
 
4398
  $html[] ='<div class="ampforwp-inline-related-post">'.ampforwp_inline_related_posts().'</div>';
 
4399
  $firs_content = $half_content[0];
4400
  $second_content = $half_content[1];
4401
  $final_content = array_merge($firs_content,$html,$second_content);
@@ -4562,7 +4621,7 @@ function ampforwp_minify_html_output($content_buffer){
4562
  $asis = '';
4563
  }
4564
 
4565
- $process = preg_replace(array ('/\>[^\S ]+' . $mod, '/[^\S ]+\<' . $mod, '/\s+/' ), array('>', '<', ' '), $process);
4566
 
4567
  if ( $minify_html_comments != 'no' )
4568
  $process = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->).)*-->' . $mod, '', $process);
@@ -4615,10 +4674,10 @@ if( !function_exists('ampforwp_get_post_thumbnail')){
4615
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'medium', true);
4616
  $thumb_url = $thumb_url_array[0];
4617
  }
4618
- elseif(ampforwp_is_custom_field_featured_image()){
4619
  $thumb_url = ampforwp_cf_featured_image_src();
4620
  }
4621
- elseif($redux_builder_amp['ampforwp-featured-image-from-content'] == true){
4622
  $thumb_url = ampforwp_get_featured_image_from_content('url');
4623
  }
4624
  return $thumb_url;
@@ -4636,7 +4695,7 @@ if( ! function_exists( 'ampforwp_get_author_page_url' ) ){
4636
  $author_page_url = get_author_posts_url( $author_id );
4637
  // If Archive support is enabled
4638
  if( isset($redux_builder_amp['ampforwp-archive-support'] ) && $redux_builder_amp['ampforwp-archive-support'] ){
4639
- $author_page_url = user_trailingslashit( $author_page_url . AMPFORWP_AMP_QUERY_VAR );
4640
  }
4641
  return $author_page_url;
4642
  }
@@ -4812,19 +4871,21 @@ if( ! function_exists( ' ampforwp_onesignal_notifications ' ) ){
4812
  global $redux_builder_amp;
4813
  if(isset($redux_builder_amp['ampforwp-web-push-onesignal']) && $redux_builder_amp['ampforwp-web-push-onesignal'] ){
4814
  $onesignal_domain = '';
 
4815
  $onesignal_subdomain = '';
4816
  $onesignal_app_id = '';
4817
  $helper_iframe_url = '';
4818
  $permission_dialog_url = '';
4819
  $service_worker_url = '';
4820
  // HTTPS sites
4821
- $onesignal_domain = trailingslashit( esc_url( home_url() ) ) ;
 
4822
  $onesignal_app_id = $redux_builder_amp['ampforwp-one-signal-app-id'];
4823
  $helper_iframe_url = $onesignal_domain .'amp-helper-frame.html?appId=' . $onesignal_app_id;
4824
 
4825
  $permission_dialog_url = $onesignal_domain .'amp-permission-dialog.html?appId=' . $onesignal_app_id;
4826
 
4827
- $service_worker_url = $onesignal_domain .'OneSignalSDKWorker.js?appId=' . $onesignal_app_id;
4828
  // HTTP sites
4829
  if(isset($redux_builder_amp['ampforwp-onesignal-http-site'] ) && $redux_builder_amp['ampforwp-onesignal-http-site'] ){
4830
  $onesignal_subdomain = $redux_builder_amp['ampforwp-onesignal-subdomain'];
@@ -4964,12 +5025,31 @@ function ampforwp_is_blog(){
4964
  // 97. Change the format of the post date on Loops #1384
4965
  add_filter('ampforwp_modify_post_date', 'ampforwp_full_post_date_loops');
4966
  if( ! function_exists( 'ampforwp_full_post_date_loops' ) ){
4967
- function ampforwp_full_post_date_loops($date){
4968
- global $redux_builder_amp;
4969
- if(isset($redux_builder_amp['ampforwp-full-post-date']) && true == $redux_builder_amp['ampforwp-full-post-date'] ){
4970
- $date = get_the_date();
 
 
 
 
 
 
 
 
 
4971
  }
4972
- return $date;
 
 
 
 
 
 
 
 
 
 
4973
  }
4974
  }
4975
 
@@ -4986,4 +5066,42 @@ function ampforwp_url_controller($url){
4986
  }
4987
 
4988
  return esc_url( $new_url );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4989
  }
106
  96. ampforwp_is_front_page() ampforwp_is_home() and ampforwp_is_blog is created
107
  97. Change the format of the post date on Loops #1384
108
  98. Create Dynamic url of amp according to the permalink structure #1318
109
+ 99. Merriweather Font Management
110
+ 100. Flags compatibility in Menu
111
  */
112
  // Adding AMP-related things to the main theme
113
  global $redux_builder_amp;
1040
  $content = preg_replace('/<span(.*?)(color=".*?")(.*?)>/', '<span$1$3>', $content);
1041
  // removing sl-processed attribute
1042
  $content = preg_replace('/(<[^>]+) sl-processed=".*?"/', '$1', $content);
1043
+ // ga-on
1044
+ $content = preg_replace('/(<[^>]+) ga-on=".*?"/', '$1', $content);
1045
+ // ga-event-category
1046
+ $content = preg_replace('/(<[^>]+) ga-event-category=".*?"/', '$1', $content);
1047
 
1048
  return $content;
1049
  }
1972
  // 27. Clean the Defer issue
1973
  // TODO : Get back to this issue. #407
1974
  function ampforwp_the_content_filter_full( $content_buffer ) {
1975
+ if ( function_exists( 'ampforwp_is_amp_endpoint' ) && ampforwp_is_amp_endpoint() ) {
 
1976
  $content_buffer = preg_replace("/' defer='defer/", "", $content_buffer);
1977
  $content_buffer = preg_replace("/' defer onload='/", "", $content_buffer);
1978
  $content_buffer = preg_replace("/' defer /", "", $content_buffer);
2483
  $sidebar_output = "";
2484
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-loop');
2485
  if ( $sanitized_sidebar) {
2486
+ $sidebar_output = $sanitized_sidebar->get_amp_content();
2487
+ $sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
2488
  }
2489
  if ( $sidebar_output) { echo $sidebar_output ; }
2490
  }
2496
  $sidebar_output = "";
2497
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-loop');
2498
  if ( $sanitized_sidebar) {
2499
+ $sidebar_output = $sanitized_sidebar->get_amp_content();
2500
+ $sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
2501
  }
2502
  if ( $sidebar_output) : echo $sidebar_output; endif;
2503
  }
2510
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-below-header');
2511
  if ( $sanitized_sidebar) {
2512
  $sidebar_output = $sanitized_sidebar->get_amp_content();
2513
+ $sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
2514
  }?>
2515
  <div class="amp-wp-content widget-wrapper">
2516
  <div class="amp_widget_below_the_header">
2525
  $sidebar_output = "";
2526
  $sanitized_sidebar = ampforwp_sidebar_content_sanitizer('ampforwp-above-footer');
2527
  if ( $sanitized_sidebar) {
2528
+ $sidebar_output = $sanitized_sidebar->get_amp_content();
2529
+ $sidebar_output = apply_filters('ampforwp_modify_sidebars_content',$sidebar_output);
2530
  }?>
2531
  <div class="amp-wp-content widget-wrapper">
2532
  <div class="amp_widget_above_the_footer">
2534
  </div>
2535
 
2536
  <?php }
2537
+ // Filter the sidebars content to make it work properly with carousels
2538
+ add_filter('ampforwp_modify_sidebars_content','ampforwp_sidebars_carousel_content');
2539
+ function ampforwp_sidebars_carousel_content($content){
2540
+ $content = str_replace(array(':openbrack:',':closebrack:'), array('[',']'), $content);
2541
+ return $content;
2542
+ }
2543
  // Sidebar Content Sanitizer
2544
  function ampforwp_sidebar_content_sanitizer($sidebar){
2545
  $sanitized_sidebar = "";
2778
  $metadata['headline'] = $headline; // proper headline added
2779
  }
2780
  // Description for Structured Data
2781
+ $desc = esc_attr( convert_chars( stripslashes( ampforwp_generate_meta_desc())) );
2782
  $metadata['description'] = $desc;
2783
  return $metadata;
2784
  }
2968
  $desc = "" ;
2969
  $desc = ampforwp_generate_meta_desc();
2970
 
 
 
 
 
2971
  if( $desc ) {
2972
+ echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $desc ) ) ) .'"/>';
2973
  }
2974
  }
2975
 
3052
  return str_replace( array( '&amp;', '&#038;' ), '&', $str );
3053
  }
3054
  }
3055
+ // Add extra params in amp-youtube
3056
+ add_filter('amp_youtube_params', 'ampforwp_youtube_modified_params');
3057
+ if( ! function_exists(' ampforwp_youtube_modified_params ') ){
3058
+ function ampforwp_youtube_modified_params($amp_youtube){
3059
+ $check = '';
3060
+ $param = '';
3061
+ // Check for extra params
3062
+ $check = preg_match('/(.*?)&(.*)/', $amp_youtube['data-videoid']);
3063
+ if(1 === $check){
3064
+ // Grab the extra param
3065
+ $param = preg_replace('/(.*?)&(.*)/', '$2', $amp_youtube['data-videoid']);
3066
+ // Parse the string into variables
3067
+ parse_str($param, $query_args);
3068
+ // Check for rel param
3069
+ if(isset($query_args['rel'])){
3070
+ // Add the rel param in amp-youtube's data-param
3071
+ $amp_youtube['data-param-rel'] = $query_args['rel'];
3072
+ }
3073
+ // Remove that param from URL
3074
+ $amp_youtube['data-videoid'] = preg_replace('/&(.*)/', '', $amp_youtube['data-videoid']);
3075
+ }
3076
+ return $amp_youtube;
3077
+ }
3078
+ }
3079
  // 59. Comment Button URL
3080
  function ampforwp_comment_button_url(){
3081
  global $redux_builder_amp;
3086
  else
3087
  $ampforwp_nonamp = '';
3088
 
3089
+
3090
+ $button_url = add_query_arg( array( 'nonamp' => '1' ), get_permalink() );
3091
+
3092
+ $button_url = $button_url. '#commentform';
3093
 
3094
  return $button_url;
3095
  }
3272
  <?php
3273
 
3274
  }
3275
+ if ( comments_open($postID) ) {
3276
+ $comment_button_url = add_query_arg( array( 'nonamp' => '1' ), $comment_button_url );?>
3277
  <div class="comment-button-wrapper">
3278
+ <a href="<?php echo esc_url( $comment_button_url ) . '#commentform' ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
3279
  </div><?php
3280
  }?>
3281
  </div> <?php
3917
  $desc = $genesis_description;
3918
  }
3919
  }
3920
+ // strip_shortcodes strategy not working here so had to do this way
3921
+ // strips shortcodes
3922
+ $desc= preg_replace('/\[(.*)?\]/','', $desc);
3923
  return $desc;
3924
  }
3925
 
4282
  // Sanitize it
4283
  $amp_html_sanitizer = new AMPFORWP_Content( $image_html, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array() ) ) );
4284
  $amp_html = $amp_html_sanitizer->get_amp_content();
4285
+ // Filter to remove that image from the content
4286
+ add_filter('ampforwp_modify_the_content','featured_image_content_filter');
4287
+
4288
  }
4289
  switch ($featured_image) {
4290
  case 'image':
4298
  default:
4299
  $featured_image_output = $amp_html;
4300
  break;
4301
+ }
4302
  return $featured_image_output;
4303
  }
4304
+ // Remove 1st image from the content if Featured image from the content option is enabled
4305
+ if( ! function_exists( 'featured_image_content_filter' ) ){
4306
+ function featured_image_content_filter($content){
4307
+ global $redux_builder_amp;
4308
+ $featured_image = "";
4309
+ $featured_image = ampforwp_get_featured_image_from_content('url');
4310
+ if( $featured_image && false == $redux_builder_amp['ampforwp-duplicate-featured-image']){
4311
+ // Change the src to use it in the pattern
4312
+ $featured_image = str_replace('/', '\/', $featured_image);
4313
+ // Remove the amp-img
4314
+ $content = preg_replace('/<amp-img(.*)src="'.$featured_image.'"(.*)<\/amp-img>/', '', $content);
4315
+ // Remove the figure (due to caption)
4316
+ $content = preg_replace('/<figure(.*)href="'.$featured_image.'"(.*)<\/figure>/', '', $content);
4317
+ }
4318
+ return $content;
4319
+ }
4320
+ }
4321
+
4322
 
4323
  // 83. Advance Analytics(Google Analytics)
4324
  add_filter('ampforwp_advance_google_analytics','ampforwp_add_advance_ga_fields');
4398
 
4399
  while( $my_query->have_posts() ) {
4400
  $my_query->the_post();
4401
+ $related_post_permalink = get_permalink();
4402
+ $related_post_permalink = trailingslashit($related_post_permalink);
4403
+ $related_post_permalink = user_trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
4404
+ if ( ampforwp_has_post_thumbnail() ) {
4405
  $title_class = 'has_related_thumbnail';
4406
+ } else {
4407
+ $title_class = 'no_related_thumbnail';
4408
+ }
4409
 
4410
+ $inline_related_posts .= '<li class="'.$title_class.'">
4411
  <a href="'.esc_url( $related_post_permalink ).'" rel="bookmark" title="'.get_the_title().'">';
4412
 
4413
+ $thumb_url_2 = ampforwp_get_post_thumbnail('url');
 
 
4414
 
4415
+ if ( ampforwp_has_post_thumbnail() ) {
4416
+ $inline_related_posts .= '<amp-img src="'.esc_url( $thumb_url_2 ).'" width="150" height="150" layout="responsive"></amp-img>';
4417
+ }
4418
+ $inline_related_posts .='</a>';
4419
+ $inline_related_posts .='<div class="related_link">';
4420
+ $inline_related_posts .='<a href="'.esc_url( $related_post_permalink ).'">'.get_the_title().'</a>';
4421
+ if( has_excerpt() ){
4422
+ $content ='<p>'.get_the_excerpt().'</p>';
4423
+ }else{
4424
+ $content ='<p>'.get_the_content().'</p>';
4425
+ }
4426
+ $inline_related_posts .= '<p>'. wp_trim_words( strip_shortcodes( $content ) , '15' ).'</p>
4427
+ </div>
4428
+ </li>';
 
4429
 
4430
+ }
4431
+ $inline_related_posts .= '</ol>
 
 
4432
  </div>
4433
  </div>';
4434
+ }
4435
  wp_reset_postdata();
4436
  return $inline_related_posts;
4437
  //related posts code ends here
4440
  add_action('pre_amp_render_post','ampforwp_add_inline_related_posts');
4441
  function ampforwp_add_inline_related_posts(){
4442
  global $redux_builder_amp;
4443
+ if($redux_builder_amp['ampforwp-inline-related-posts'] == 1 && is_single() && ampforwp_inline_related_posts() ){
4444
+ add_filter('ampforwp_modify_the_content','ampforwp_generate_inline_related_posts');
4445
  }
4446
  }
4447
  function ampforwp_generate_inline_related_posts($content){
4448
  global $post;
4449
+
4450
  $break_point = '</p>';
4451
  $content_parts = explode($break_point, $content);
4452
  $no_of_parts = count($content_parts);
4454
  $half_content = array_chunk($content_parts, $half_index);
4455
 
4456
  $html[] ='<div class="ampforwp-inline-related-post">'.ampforwp_inline_related_posts().'</div>';
4457
+
4458
  $firs_content = $half_content[0];
4459
  $second_content = $half_content[1];
4460
  $final_content = array_merge($firs_content,$html,$second_content);
4621
  $asis = '';
4622
  }
4623
 
4624
+ $process = preg_replace(array ('/\>[^\S ]+' . $mod, '/[^\S ]+\<' . $mod, '/\s+/' ), array('> ', ' <', ' '), $process);
4625
 
4626
  if ( $minify_html_comments != 'no' )
4627
  $process = preg_replace('/<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->).)*-->' . $mod, '', $process);
4674
  $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'medium', true);
4675
  $thumb_url = $thumb_url_array[0];
4676
  }
4677
+ if(ampforwp_is_custom_field_featured_image() && ampforwp_cf_featured_image_src()){
4678
  $thumb_url = ampforwp_cf_featured_image_src();
4679
  }
4680
+ if( true == $redux_builder_amp['ampforwp-featured-image-from-content'] && ampforwp_get_featured_image_from_content('url') ){
4681
  $thumb_url = ampforwp_get_featured_image_from_content('url');
4682
  }
4683
  return $thumb_url;
4695
  $author_page_url = get_author_posts_url( $author_id );
4696
  // If Archive support is enabled
4697
  if( isset($redux_builder_amp['ampforwp-archive-support'] ) && $redux_builder_amp['ampforwp-archive-support'] ){
4698
+ $author_page_url = ampforwp_url_controller( $author_page_url );
4699
  }
4700
  return $author_page_url;
4701
  }
4871
  global $redux_builder_amp;
4872
  if(isset($redux_builder_amp['ampforwp-web-push-onesignal']) && $redux_builder_amp['ampforwp-web-push-onesignal'] ){
4873
  $onesignal_domain = '';
4874
+ $onesignal_domain_sw = '';
4875
  $onesignal_subdomain = '';
4876
  $onesignal_app_id = '';
4877
  $helper_iframe_url = '';
4878
  $permission_dialog_url = '';
4879
  $service_worker_url = '';
4880
  // HTTPS sites
4881
+ $onesignal_domain = AMPFORWP_PLUGIN_DIR_URI.'includes/onesignal-integration/';
4882
+ $onesignal_domain_sw = trailingslashit( home_url() );
4883
  $onesignal_app_id = $redux_builder_amp['ampforwp-one-signal-app-id'];
4884
  $helper_iframe_url = $onesignal_domain .'amp-helper-frame.html?appId=' . $onesignal_app_id;
4885
 
4886
  $permission_dialog_url = $onesignal_domain .'amp-permission-dialog.html?appId=' . $onesignal_app_id;
4887
 
4888
+ $service_worker_url = $onesignal_domain_sw .'OneSignalSDKWorker.js?appId=' . $onesignal_app_id;
4889
  // HTTP sites
4890
  if(isset($redux_builder_amp['ampforwp-onesignal-http-site'] ) && $redux_builder_amp['ampforwp-onesignal-http-site'] ){
4891
  $onesignal_subdomain = $redux_builder_amp['ampforwp-onesignal-subdomain'];
5025
  // 97. Change the format of the post date on Loops #1384
5026
  add_filter('ampforwp_modify_post_date', 'ampforwp_full_post_date_loops');
5027
  if( ! function_exists( 'ampforwp_full_post_date_loops' ) ){
5028
+ function ampforwp_full_post_date_loops($full_date){
5029
+ global $redux_builder_amp;
5030
+ if( is_home() || is_archive() ){
5031
+ if( 2 == $redux_builder_amp['ampforwp-post-date-format'] ){
5032
+ $full_date = get_the_date();
5033
+ }
5034
+ if( 1 == $redux_builder_amp['ampforwp-post-date-format'] ){
5035
+ $date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') );
5036
+ if( $redux_builder_amp['ampforwp-post-date-format-text'] ){
5037
+ $full_date = $redux_builder_amp['ampforwp-post-date-format-text'];
5038
+ // Change the % days into the actual number of days
5039
+ $full_date = str_replace('% days', $date, $full_date);
5040
+ }
5041
  }
5042
+ }
5043
+ if(is_single() && 1 == $redux_builder_amp['ampforwp-post-date-format']){
5044
+ $date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') );
5045
+ $full_date = human_time_diff( get_the_time('U', get_the_ID() ), current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],'ago' );
5046
+ if( $redux_builder_amp['ampforwp-post-date-format-text'] ){
5047
+ $full_date = $redux_builder_amp['ampforwp-post-date-format-text'];
5048
+ // Change the % days into the actual number of days
5049
+ $full_date = str_replace('% days', $date, $full_date);
5050
+ }
5051
+ }
5052
+ return $full_date;
5053
  }
5054
  }
5055
 
5066
  }
5067
 
5068
  return esc_url( $new_url );
5069
+ }
5070
+ // 99. Merriweather Font Management
5071
+ add_filter( 'amp_post_template_data', 'ampforwp_merriweather_font_management' );
5072
+ function ampforwp_merriweather_font_management( $data ) {
5073
+ global $redux_builder_amp;
5074
+
5075
+ if ( isset($redux_builder_amp['amp-design-selector']) && $redux_builder_amp['amp-design-selector'] != 1) {
5076
+ unset($data['font_urls']['merriweather']);
5077
+ }
5078
+
5079
+ return $data;
5080
+ }
5081
+ // 100. Flags compatibility in Menu
5082
+ add_filter('ampforwp_menu_content','ampforwp_modify_menu_content');
5083
+ if( ! function_exists(' ampforwp_modify_menu_content ') ){
5084
+ function ampforwp_modify_menu_content($menu){
5085
+ $dom = '';
5086
+ $nodes = '';
5087
+ $num_nodes = '';
5088
+ // Create a new document
5089
+ $dom = new DOMDocument;
5090
+ $dom->loadHTML($menu);
5091
+ // get all the img's
5092
+ $nodes = $dom->getElementsByTagName( 'img' );
5093
+ $num_nodes = $nodes->length;
5094
+ for ( $i = $num_nodes - 1; $i >= 0; $i-- ) {
5095
+ $node = $nodes->item( $i );
5096
+ // Set The Width and Height if there in none
5097
+ if ( '' === $node->getAttribute( 'width' ) ) {
5098
+ $node->setAttribute('width', 15);
5099
+ }
5100
+ if( '' === $node->getAttribute( 'height' ) ){
5101
+ $node->setAttribute('height', 15);
5102
+ }
5103
+ }
5104
+ $menu = $dom->saveHTML();
5105
+ return $menu;
5106
+ }
5107
  }
templates/woo-widget.php CHANGED
@@ -54,7 +54,7 @@
54
  global $post;
55
  global $product;
56
  if( $ampforwp_procts_page_link === 'amp' ) {
57
- $ampforwp_post_url = trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR ;
58
  } else {
59
  $ampforwp_post_url = trailingslashit( get_permalink() ) ;
60
  } ?>
54
  global $post;
55
  global $product;
56
  if( $ampforwp_procts_page_link === 'amp' ) {
57
+ $ampforwp_post_url = ampforwp_url_controller( get_permalink() );
58
  } else {
59
  $ampforwp_post_url = trailingslashit( get_permalink() ) ;
60
  } ?>