Pixel Caffeine - Version 1.2.0

Version Description

  • 2017-04-03 =
  • Feature - Full support to Easy Digital Downloads for the dynamic ads events
  • Feature - Introduced new hook to add dynamic placeholders in the value arguments of custom conversions
  • Tweak - Tested with WooCommerce 3.0.0 RC2, so almost fully compatible with the new version will be released soon
  • Tweak - Track "CompleteRegistration" event when a user is registered from woocommerce page
  • Fix - Track custom conversions events created by admin even if you set a full URL for page_visit and link_click
  • Fix - Shipping cost included in the "value" property of checkout events. Anyway, added also an option to activate it again
Download this release

Release Info

Developer antoscarface
Plugin Icon 128x128 Pixel Caffeine
Version 1.2.0
Comparing to
See all releases

Code changes from version 1.1.0 to 1.2.0

assets/js/pixel-events.js CHANGED
@@ -5,7 +5,8 @@
5
  jQuery(document).ready(function($){
6
  'use strict';
7
 
8
- var extendArgs = function( args ) {
 
9
  return aepc_extend_args( args );
10
  },
11
  delayTrack = function( cb, delay ) {
@@ -34,93 +35,18 @@ jQuery(document).ready(function($){
34
  });
35
  }
36
 
37
- // Add to cart from loop
38
- $('ul.products')
39
- .on('click', '.ajax_add_to_cart', function (e) {
40
- if ( 'no' === aepc_pixel.enable_addtocart ) {
41
- return e;
42
- }
43
-
44
- var anchor = $(this),
45
- product = anchor.closest('li.product'),
46
- product_id = anchor.data('product_sku') ? anchor.data('product_sku') : anchor.data('product_id');
47
-
48
- fbq('track', 'AddToCart', extendArgs({
49
- content_ids: [product_id],
50
- content_type: 'product',
51
- content_name: product.find('h3').text(),
52
- content_category: product.find('span[data-content_category]').data('content_category'),
53
- value: parseFloat(product.find('span.amount').clone().children().remove().end().text()), //OPTIONAL, but highly recommended
54
- currency: woocommerce_params.currency
55
- }));
56
- })
57
-
58
- // Add to wishlist.
59
- .on('click', '.add_to_wishlist, .wl-add-to', function(e) {
60
- if ( 'no' === aepc_pixel.enable_wishlist ) {
61
- return e;
62
- }
63
-
64
- var anchor = $(this),
65
- product = anchor.closest('li.product'),
66
- product_id = anchor.data('product_sku') ? anchor.data('product_sku') : anchor.data('product_id');
67
-
68
- fbq('track', 'AddToWishlist', extendArgs({
69
- content_ids: [product_id],
70
- content_type: 'product',
71
- content_name: product.find('h3').text(),
72
- content_category: product.find('span[data-content_category]').data('content_category'),
73
- value: parseFloat(product.find('span.amount').clone().children().remove().end().text()), //OPTIONAL, but highly recommended
74
- currency: woocommerce_params.currency
75
- }));
76
- });
77
-
78
- $('div.product')
79
-
80
- // Add to cart from single product page.
81
- .on( 'click', '.single_add_to_cart_button', function(e) {
82
- if ( aepc_pixel.enable_addtocart === 'yes' && wc_add_to_cart_params.cart_redirect_after_add === 'yes' ) {
83
- fbq('track', 'AddToCart', extendArgs( aepc_pixel_events.ViewContent ));
84
- }
85
- })
86
-
87
- // Add to wishlist from single product
88
- .on('click', '.add_to_wishlist, .wl-add-to', function(e){
89
- if ( 'no' === aepc_pixel.enable_wishlist ) {
90
- return e;
91
- }
92
-
93
- fbq('track', 'AddToWishlist', extendArgs( aepc_pixel_events.ViewContent ));
94
- });
95
-
96
- // AddPaymentInfo on checkout button click
97
- $('form.checkout').on('checkout_place_order', function(e){
98
- if ( 'no' === aepc_pixel.enable_addpaymentinfo ) {
99
- return e;
100
- }
101
-
102
- fbq('track', 'AddPaymentInfo', extendArgs({
103
- content_type: aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,
104
- content_ids: aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,
105
- value: aepc_pixel_events.standard_events.InitiateCheckout[0].value,
106
- currency: aepc_pixel_events.standard_events.InitiateCheckout[0].currency
107
- }));
108
-
109
- return true;
110
- });
111
-
112
  // Custom events.
113
  if ( typeof aepc_pixel_events.custom_events !== 'undefined' ) {
114
  $.each(aepc_pixel_events.custom_events, function (eventName, events) {
115
 
116
- $.each( events, function( index, data ){
117
- var track_cb = function() {
118
  fbq('trackCustom', eventName, extendArgs( data.params ));
119
  };
120
 
121
  // Delay firing
122
  delayTrack( track_cb, data.delay );
123
- });
124
 
125
  });
126
  }
@@ -159,4 +85,140 @@ jQuery(document).ready(function($){
159
  });
160
  }
161
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  });
5
  jQuery(document).ready(function($){
6
  'use strict';
7
 
8
+ var body = $( document.body ),
9
+ extendArgs = function( args ) {
10
  return aepc_extend_args( args );
11
  },
12
  delayTrack = function( cb, delay ) {
35
  });
36
  }
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  // Custom events.
39
  if ( typeof aepc_pixel_events.custom_events !== 'undefined' ) {
40
  $.each(aepc_pixel_events.custom_events, function (eventName, events) {
41
 
42
+ $.each( events, function( index, data ){
43
+ var track_cb = function() {
44
  fbq('trackCustom', eventName, extendArgs( data.params ));
45
  };
46
 
47
  // Delay firing
48
  delayTrack( track_cb, data.delay );
49
+ });
50
 
51
  });
52
  }
85
  });
86
  }
87
 
88
+ // DYNAMIC ADS EVENTS
89
+
90
+ // WooCommerce
91
+ if ( body.hasClass('woocommerce-page') ) {
92
+
93
+ // Add to cart from loop
94
+ $('ul.products')
95
+ .on('click', '.ajax_add_to_cart', function (e) {
96
+ if ( 'no' === aepc_pixel.enable_addtocart ) {
97
+ return e;
98
+ }
99
+
100
+ var anchor = $(this),
101
+ product = anchor.closest('li.product'),
102
+ product_id = anchor.data('product_sku') ? anchor.data('product_sku') : anchor.data('product_id');
103
+
104
+ fbq('track', 'AddToCart', extendArgs({
105
+ content_ids: [product_id],
106
+ content_type: 'product',
107
+ content_name: product.find('h3').text(),
108
+ content_category: product.find('span[data-content_category]').data('content_category'),
109
+ value: parseFloat(product.find('span.amount').clone().children().remove().end().text()), //OPTIONAL, but highly recommended
110
+ currency: woocommerce_params.currency
111
+ }));
112
+ })
113
+
114
+ // Add to wishlist.
115
+ .on('click', '.add_to_wishlist, .wl-add-to', function(e) {
116
+ if ( 'no' === aepc_pixel.enable_wishlist ) {
117
+ return e;
118
+ }
119
+
120
+ var anchor = $(this),
121
+ product = anchor.closest('li.product'),
122
+ product_id = anchor.data('product_sku') ? anchor.data('product_sku') : anchor.data('product_id');
123
+
124
+ fbq('track', 'AddToWishlist', extendArgs({
125
+ content_ids: [product_id],
126
+ content_type: 'product',
127
+ content_name: product.find('h3').text(),
128
+ content_category: product.find('span[data-content_category]').data('content_category'),
129
+ value: parseFloat(product.find('span.amount').clone().children().remove().end().text()), //OPTIONAL, but highly recommended
130
+ currency: woocommerce_params.currency
131
+ }));
132
+ });
133
+
134
+ $('div.product')
135
+
136
+ // Add to cart from single product page.
137
+ .on( 'click', '.single_add_to_cart_button', function(e) {
138
+ if ( aepc_pixel.enable_addtocart === 'yes' && wc_add_to_cart_params.cart_redirect_after_add === 'yes' ) {
139
+ fbq('track', 'AddToCart', extendArgs( aepc_pixel_events.ViewContent ));
140
+ }
141
+ })
142
+
143
+ // Add to wishlist from single product
144
+ .on('click', '.add_to_wishlist, .wl-add-to', function(e){
145
+ if ( 'no' === aepc_pixel.enable_wishlist ) {
146
+ return e;
147
+ }
148
+
149
+ fbq('track', 'AddToWishlist', extendArgs( aepc_pixel_events.ViewContent ));
150
+ });
151
+
152
+ // AddPaymentInfo on checkout button click
153
+ $('form.checkout').on('checkout_place_order', function(e){
154
+ if ( 'no' === aepc_pixel.enable_addpaymentinfo ) {
155
+ return e;
156
+ }
157
+
158
+ fbq('track', 'AddPaymentInfo', extendArgs({
159
+ content_type: aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,
160
+ content_ids: aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,
161
+ value: aepc_pixel_events.standard_events.InitiateCheckout[0].value,
162
+ currency: aepc_pixel_events.standard_events.InitiateCheckout[0].currency
163
+ }));
164
+
165
+ return true;
166
+ });
167
+
168
+ }
169
+
170
+ // Easy Digital Downloads
171
+ if ( body.hasClass('edd-page') ) {
172
+
173
+ // Add to cart from loop and single product page
174
+ $('.edd_download_purchase_form').on( 'click', '.edd-add-to-cart', function(e){
175
+ if ( 'no' === aepc_pixel.enable_addtocart ) {
176
+ return e;
177
+ }
178
+
179
+ var button = $(this),
180
+ product = button.closest('div.edd_download, article.type-download'),
181
+ product_id = button.data('download-sku') ? button.data('download-sku') : button.data('download-id'),
182
+ currency = product.find('meta[itemprop="priceCurrency"]').attr('content'),
183
+ price = button.data('price'),
184
+ is_variable = 'yes' === button.data('variable-price');
185
+
186
+ // Retrieve price if variable
187
+ if ( is_variable ) {
188
+ var optionsWrapper = $('.edd_price_options'),
189
+ checkedOption = optionsWrapper.find('input[type="radio"]:checked'),
190
+ checkedOptionWrapper = checkedOption.closest('li');
191
+
192
+ price = checkedOptionWrapper.find('meta[itemprop="price"]').attr('content');
193
+ currency = checkedOptionWrapper.find('meta[itemprop="priceCurrency"]').attr('content');
194
+ }
195
+
196
+ fbq('track', 'AddToCart', extendArgs({
197
+ content_ids: [product_id],
198
+ content_type: 'product',
199
+ content_name: product.find('[itemprop="name"]').first().text(),
200
+ content_category: button.data('download-categories'),
201
+ value: parseFloat( price ),
202
+ currency: currency
203
+ }));
204
+ });
205
+
206
+ // Checkout
207
+ $('.edd-checkout').on( 'click', 'form#edd_purchase_form input[type="submit"]', function(e){
208
+ if ( 'no' === aepc_pixel.enable_addpaymentinfo ) {
209
+ return e;
210
+ }
211
+
212
+ fbq('track', 'AddPaymentInfo', extendArgs({
213
+ content_type: aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,
214
+ content_ids: aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,
215
+ value: aepc_pixel_events.standard_events.InitiateCheckout[0].value,
216
+ currency: aepc_pixel_events.standard_events.InitiateCheckout[0].currency
217
+ }));
218
+
219
+ return true;
220
+ });
221
+
222
+ }
223
+
224
  });
assets/js/pixel-events.min.js CHANGED
@@ -1,4 +1,4 @@
1
  /*! - v1.1.0
2
  *
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
- jQuery(document).ready(function(a){"use strict";var b=function(a){return aepc_extend_args(a)},c=function(a,b){b?setTimeout(a,1e3*b):a()};aepc_pixel_events.standard_events&&a.each(aepc_pixel_events.standard_events,function(d,e){a.each(e,function(a,e){var f=function(){e.params?fbq("track",d,b(e.params)):fbq("track",d)};c(f,e.delay)})}),a("ul.products").on("click",".ajax_add_to_cart",function(c){if("no"===aepc_pixel.enable_addtocart)return c;var d=a(this),e=d.closest("li.product"),f=d.data("product_sku")?d.data("product_sku"):d.data("product_id");fbq("track","AddToCart",b({content_ids:[f],content_type:"product",content_name:e.find("h3").text(),content_category:e.find("span[data-content_category]").data("content_category"),value:parseFloat(e.find("span.amount").clone().children().remove().end().text()),currency:woocommerce_params.currency}))}).on("click",".add_to_wishlist, .wl-add-to",function(c){if("no"===aepc_pixel.enable_wishlist)return c;var d=a(this),e=d.closest("li.product"),f=d.data("product_sku")?d.data("product_sku"):d.data("product_id");fbq("track","AddToWishlist",b({content_ids:[f],content_type:"product",content_name:e.find("h3").text(),content_category:e.find("span[data-content_category]").data("content_category"),value:parseFloat(e.find("span.amount").clone().children().remove().end().text()),currency:woocommerce_params.currency}))}),a("div.product").on("click",".single_add_to_cart_button",function(a){"yes"===aepc_pixel.enable_addtocart&&"yes"===wc_add_to_cart_params.cart_redirect_after_add&&fbq("track","AddToCart",b(aepc_pixel_events.ViewContent))}).on("click",".add_to_wishlist, .wl-add-to",function(a){return"no"===aepc_pixel.enable_wishlist?a:void fbq("track","AddToWishlist",b(aepc_pixel_events.ViewContent))}),a("form.checkout").on("checkout_place_order",function(a){return"no"===aepc_pixel.enable_addpaymentinfo?a:(fbq("track","AddPaymentInfo",b({content_type:aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,content_ids:aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,value:aepc_pixel_events.standard_events.InitiateCheckout[0].value,currency:aepc_pixel_events.standard_events.InitiateCheckout[0].currency})),!0)}),"undefined"!=typeof aepc_pixel_events.custom_events&&a.each(aepc_pixel_events.custom_events,function(d,e){a.each(e,function(a,e){var f=function(){fbq("trackCustom",d,b(e.params))};c(f,e.delay)})}),"undefined"!=typeof aepc_pixel_events.css_events&&a.each(aepc_pixel_events.css_events,function(c,d){a.each(d,function(d,e){a(c).on("click",function(){fbq(e.trackType,e.trackName,b(e.trackParams))})})}),"undefined"!=typeof aepc_pixel_events.link_clicks&&a.each(aepc_pixel_events.link_clicks,function(c,d){c=c.replace(/\*/g,"[^/]+"),a("a").filter(function(){var b=a(this).attr("href");return"undefined"!=typeof b&&b.match(new RegExp(c))}).on("click",function(c){a.each(d,function(a,c){fbq(c.trackType,c.trackName,b(c.trackParams))})})})});
1
  /*! - v1.1.0
2
  *
3
  * Copyright (c) 2017; * Licensed GPLv2+ */
4
+ jQuery(document).ready(function(a){"use strict";var b=a(document.body),c=function(a){return aepc_extend_args(a)},d=function(a,b){b?setTimeout(a,1e3*b):a()};aepc_pixel_events.standard_events&&a.each(aepc_pixel_events.standard_events,function(b,e){a.each(e,function(a,e){var f=function(){e.params?fbq("track",b,c(e.params)):fbq("track",b)};d(f,e.delay)})}),"undefined"!=typeof aepc_pixel_events.custom_events&&a.each(aepc_pixel_events.custom_events,function(b,e){a.each(e,function(a,e){var f=function(){fbq("trackCustom",b,c(e.params))};d(f,e.delay)})}),"undefined"!=typeof aepc_pixel_events.css_events&&a.each(aepc_pixel_events.css_events,function(b,d){a.each(d,function(d,e){a(b).on("click",function(){fbq(e.trackType,e.trackName,c(e.trackParams))})})}),"undefined"!=typeof aepc_pixel_events.link_clicks&&a.each(aepc_pixel_events.link_clicks,function(b,d){b=b.replace(/\*/g,"[^/]+"),a("a").filter(function(){var c=a(this).attr("href");return"undefined"!=typeof c&&c.match(new RegExp(b))}).on("click",function(b){a.each(d,function(a,b){fbq(b.trackType,b.trackName,c(b.trackParams))})})}),b.hasClass("woocommerce-page")&&(a("ul.products").on("click",".ajax_add_to_cart",function(b){if("no"===aepc_pixel.enable_addtocart)return b;var d=a(this),e=d.closest("li.product"),f=d.data("product_sku")?d.data("product_sku"):d.data("product_id");fbq("track","AddToCart",c({content_ids:[f],content_type:"product",content_name:e.find("h3").text(),content_category:e.find("span[data-content_category]").data("content_category"),value:parseFloat(e.find("span.amount").clone().children().remove().end().text()),currency:woocommerce_params.currency}))}).on("click",".add_to_wishlist, .wl-add-to",function(b){if("no"===aepc_pixel.enable_wishlist)return b;var d=a(this),e=d.closest("li.product"),f=d.data("product_sku")?d.data("product_sku"):d.data("product_id");fbq("track","AddToWishlist",c({content_ids:[f],content_type:"product",content_name:e.find("h3").text(),content_category:e.find("span[data-content_category]").data("content_category"),value:parseFloat(e.find("span.amount").clone().children().remove().end().text()),currency:woocommerce_params.currency}))}),a("div.product").on("click",".single_add_to_cart_button",function(a){"yes"===aepc_pixel.enable_addtocart&&"yes"===wc_add_to_cart_params.cart_redirect_after_add&&fbq("track","AddToCart",c(aepc_pixel_events.ViewContent))}).on("click",".add_to_wishlist, .wl-add-to",function(a){return"no"===aepc_pixel.enable_wishlist?a:void fbq("track","AddToWishlist",c(aepc_pixel_events.ViewContent))}),a("form.checkout").on("checkout_place_order",function(a){return"no"===aepc_pixel.enable_addpaymentinfo?a:(fbq("track","AddPaymentInfo",c({content_type:aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,content_ids:aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,value:aepc_pixel_events.standard_events.InitiateCheckout[0].value,currency:aepc_pixel_events.standard_events.InitiateCheckout[0].currency})),!0)})),b.hasClass("edd-page")&&(a(".edd_download_purchase_form").on("click",".edd-add-to-cart",function(b){if("no"===aepc_pixel.enable_addtocart)return b;var d=a(this),e=d.closest("div.edd_download, article.type-download"),f=d.data("download-sku")?d.data("download-sku"):d.data("download-id"),g=e.find('meta[itemprop="priceCurrency"]').attr("content"),h=d.data("price"),i="yes"===d.data("variable-price");if(i){var j=a(".edd_price_options"),k=j.find('input[type="radio"]:checked'),l=k.closest("li");h=l.find('meta[itemprop="price"]').attr("content"),g=l.find('meta[itemprop="priceCurrency"]').attr("content")}fbq("track","AddToCart",c({content_ids:[f],content_type:"product",content_name:e.find('[itemprop="name"]').first().text(),content_category:d.data("download-categories"),value:parseFloat(h),currency:g}))}),a(".edd-checkout").on("click",'form#edd_purchase_form input[type="submit"]',function(a){return"no"===aepc_pixel.enable_addpaymentinfo?a:(fbq("track","AddPaymentInfo",c({content_type:aepc_pixel_events.standard_events.InitiateCheckout[0].content_type,content_ids:aepc_pixel_events.standard_events.InitiateCheckout[0].content_ids,value:aepc_pixel_events.standard_events.InitiateCheckout[0].value,currency:aepc_pixel_events.standard_events.InitiateCheckout[0].currency})),!0)}))});
includes/admin/assets/img/store-logo/edd.png ADDED
Binary file
includes/admin/assets/js/admin.js CHANGED
@@ -279,8 +279,32 @@ jQuery(document).ready(function($){
279
  tags = [];
280
 
281
  if ( 'content_ids' === key ) {
282
- if ( dropdown_data.hasOwnProperty( 'get_posts' ) && dropdown_data.get_posts.hasOwnProperty( 'product' ) ) {
283
- tags = dropdown_data.get_posts.product;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
  }
286
 
@@ -299,6 +323,11 @@ jQuery(document).ready(function($){
299
  }
300
  }
301
 
 
 
 
 
 
302
  context.find('#dpa_value').select2({
303
  tags: tags
304
  });
279
  tags = [];
280
 
281
  if ( 'content_ids' === key ) {
282
+ if ( dropdown_data.hasOwnProperty( 'get_posts' ) ) {
283
+
284
+ // WooCommerce product ids
285
+ if ( dropdown_data.get_posts.hasOwnProperty( 'product' ) ) {
286
+ tags = dropdown_data.get_posts.product.concat( tags );
287
+ }
288
+
289
+ // EDD product ids
290
+ if ( dropdown_data.get_posts.hasOwnProperty( 'download' ) ) {
291
+ tags = dropdown_data.get_posts.download.concat( tags );
292
+ }
293
+ }
294
+ }
295
+
296
+ else if ( 'content_category' === key ) {
297
+ if ( dropdown_data.hasOwnProperty( 'get_categories' ) ) {
298
+
299
+ // WooCommerce product categories
300
+ if ( dropdown_data.get_categories.hasOwnProperty( 'product_cat' ) ) {
301
+ tags = dropdown_data.get_categories.product_cat.concat( tags );
302
+ }
303
+
304
+ // EDD product categories
305
+ if ( dropdown_data.get_categories.hasOwnProperty( 'download_category' ) ) {
306
+ tags = dropdown_data.get_categories.download_category.concat( tags );
307
+ }
308
  }
309
  }
310
 
323
  }
324
  }
325
 
326
+ // Remove "anything" item repeated
327
+ tags = tags.filter( function( item, index ){
328
+ return ! ( index !== 0 && item.id === '[[any]]' );
329
+ });
330
+
331
  context.find('#dpa_value').select2({
332
  tags: tags
333
  });
includes/admin/class-aepc-admin-ajax.php CHANGED
@@ -484,7 +484,7 @@ class AEPC_Admin_Ajax {
484
 
485
  $currencies = array();
486
 
487
- if ( function_exists( 'WC' ) ) {
488
  foreach ( AEPC_Currency::get_currencies() as $currency => $args ) {
489
  $currencies[] = array(
490
  'id' => esc_attr( $currency ),
484
 
485
  $currencies = array();
486
 
487
+ if ( AEPC_Addons_Support::are_detected_addons() ) {
488
  foreach ( AEPC_Currency::get_currencies() as $currency => $args ) {
489
  $currencies[] = array(
490
  'id' => esc_attr( $currency ),
includes/admin/class-aepc-admin-ca.php CHANGED
@@ -945,8 +945,12 @@ class AEPC_Admin_CA {
945
  }
946
 
947
  // Replace IDs with product title, if a store plugin installed
948
- if ( 'content_ids' == $condition['key'] && function_exists( 'wc_get_product' ) && $product = wc_get_product( intval( $v ) ) ) {
949
- $v = $product->get_title();
 
 
 
 
950
  }
951
  }
952
 
945
  }
946
 
947
  // Replace IDs with product title, if a store plugin installed
948
+ if ( 'content_ids' == $condition['key'] ) {
949
+ foreach ( AEPC_Addons_Support::get_detected_addons() as $addon ) {
950
+ if ( $addon->is_product_of_this_addon( intval( $v ) ) ) {
951
+ $v = $addon->get_product_name( intval( $v ) );
952
+ }
953
+ }
954
  }
955
  }
956
 
includes/admin/class-aepc-admin-menu.php CHANGED
@@ -43,8 +43,14 @@ class AEPC_Admin_Menu {
43
  $titles = self::get_page_titles();
44
  $page = isset( $_GET['tab'] ) ? $_GET['tab'] : 'dashboard';
45
 
 
 
 
 
 
 
46
  self::$hook_page = add_menu_page(
47
- AEPC_Admin::PLUGIN_NAME . ' - ' . $titles[ $page ],
48
  AEPC_Admin::PLUGIN_NAME,
49
  'manage_ads',
50
  self::$page_id,
43
  $titles = self::get_page_titles();
44
  $page = isset( $_GET['tab'] ) ? $_GET['tab'] : 'dashboard';
45
 
46
+ // Detect page title
47
+ $page_title = AEPC_Admin::PLUGIN_NAME;
48
+ if ( isset( $titles[ $page ] ) ) {
49
+ $page_title .= ' - ' . $titles[ $page ];
50
+ }
51
+
52
  self::$hook_page = add_menu_page(
53
+ $page_title,
54
  AEPC_Admin::PLUGIN_NAME,
55
  'manage_ads',
56
  self::$page_id,
includes/admin/class-aepc-admin-view.php CHANGED
@@ -421,145 +421,21 @@ class AEPC_Admin_View {
421
  }
422
 
423
  /**
424
- * Get the complete list of supported store plugins
425
  *
426
- * @return array
427
- */
428
- public function get_supported_store() {
429
- return array(
430
- 'woocommerce' => array(
431
- 'plugin_name' => __( 'WooCommerce', 'pixel-caffeine' ),
432
- 'file' => 'woocommerce/woocommerce.php',
433
- 'exists' => function_exists( 'WC' )
434
- )
435
- );
436
- }
437
-
438
- /**
439
- * Detect if a store plugin is detected
440
- *
441
- * @param string $store If empty, check for all store supported
442
- *
443
- * @return bool
444
- */
445
- public function is_store_detected( $store = '' ) {
446
- $stores = $this->get_supported_store();
447
-
448
- if ( ! empty( $store ) ) {
449
- return isset( $stores[ $store ] ) && $stores[ $store ]['exists'] ? $store : false;
450
- }
451
-
452
- return in_array( true, wp_list_pluck( $stores, 'exists' ) ) ? array_search( true, $stores ) : false;
453
- }
454
-
455
- /**
456
- * Return the store detected on site
457
- *
458
- * @return bool|null
459
- */
460
- public function get_store_detected() {
461
- if ( $store = $this->is_store_detected() ) {
462
- return $store;
463
- }
464
-
465
- return null;
466
- }
467
-
468
- /**
469
- * Return the label of detected store
470
- *
471
- * @return mixed|null
472
- */
473
- public function get_store_detected_name() {
474
- if ( $store = $this->get_store_detected() ) {
475
- return $this->store_name( $store );
476
- }
477
-
478
- return null;
479
- }
480
-
481
- /**
482
- * Return the url for the details of plugin we suggest for the store
483
- *
484
- * @param string $store_slug
485
- *
486
- * @return string
487
- */
488
- public function get_store_plugin_install_link( $store_slug ) {
489
- return self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $store_slug .
490
- '&TB_iframe=true&width=772&height=916' );
491
- }
492
-
493
- /**
494
- * Return the url for the details of plugin we suggest for the store
495
- *
496
- * @param string $store_slug
497
- *
498
- * @return string
499
  */
500
- public function get_store_plugin_activate_link( $store_slug ) {
501
- $stores = $this->get_supported_store();
502
- $plugin_file = $stores[ $store_slug ]['file'];
503
-
504
- return wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=all', 'activate-plugin_' . $plugin_file );
505
  }
506
 
507
  /**
508
- * Return "install" or "active" action with link if user is allowed
509
- *
510
- * @param $store_slug
511
  *
512
- * @return string|void
513
  */
514
- public function store_allowed_action( $store_slug ) {
515
- $stores = $this->get_supported_store();
516
- $store = $stores[ $store_slug ];
517
- $plugin_file = $store['file'];
518
- $is_installed = file_exists( WP_PLUGIN_DIR . '/' . $plugin_file );
519
-
520
- if ( $is_installed ) {
521
- $action = _x( 'active', 'This will be integrated in the statement: "%s the supported plugin "Name"', 'pixel-caffeine' );
522
-
523
- if ( current_user_can( 'activate_plugins' ) ) {
524
- $action = '<a href="' . esc_url( $this->get_store_plugin_activate_link( $store_slug ) ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Activate %s', 'pixel-caffeine' ), $store['plugin_name'] ) ) . '">' . $action . '</a>';
525
- }
526
- }
527
-
528
- else {
529
- $action = _x( 'install', 'This will be integrated in the statement: "%s the supported plugin "Name"', 'pixel-caffeine' );
530
-
531
- if ( current_user_can( 'install_plugins' ) ) {
532
- $action = '<a href="' . esc_url( $this->get_store_plugin_install_link( $store_slug ) ) . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr( sprintf( __( 'More information about %s', 'pixel-caffeine' ), $store['plugin_name'] ) ) . '" data-title="' . esc_attr( $store['plugin_name'] ) . '">' . $action . '</a>';
533
- }
534
- }
535
-
536
- return $action;
537
- }
538
-
539
- public function store_name( $store ) {
540
- $stores = $this->get_supported_store();
541
-
542
- return $stores[ $store ]['plugin_name'];
543
- }
544
-
545
- public function store_logo( $store ) {
546
- $stores = $this->get_supported_store();
547
-
548
- if ( ! empty( $stores[ $store ]['plugin_logo'] ) ) {
549
- return $stores[ $store ]['plugin_logo'];
550
- } else {
551
- return PixelCaffeine()->plugin_url() . '/includes/admin/assets/img/store-logo/' . $store . '.png';
552
- }
553
- }
554
-
555
- public function store_website( $store ) {
556
- $stores = $this->get_supported_store();
557
-
558
- if ( ! empty( $stores[ $store ]['plugin_website'] ) ) {
559
- return $stores[ $store ]['plugin_website'];
560
- }
561
-
562
- return null;
563
  }
564
 
565
  /**
421
  }
422
 
423
  /**
424
+ * Get the list of supported addons
425
  *
426
+ * @return AEPC_Edd_Addon_Support[]|AEPC_Woocommerce_Addon_Support[]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  */
428
+ public function get_addons_supported() {
429
+ return AEPC_Addons_Support::get_supported_addons();
 
 
 
430
  }
431
 
432
  /**
433
+ * Get the supported addon active
 
 
434
  *
435
+ * @return AEPC_Edd_Addon_Support[]|AEPC_Woocommerce_Addon_Support[]
436
  */
437
+ public function get_addons_detected() {
438
+ return AEPC_Addons_Support::get_detected_addons();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
 
441
  /**
includes/admin/class-aepc-facebook-adapter.php CHANGED
@@ -383,17 +383,25 @@ class AEPC_Facebook_Adapter {
383
  // Check if request fails with wp_error response
384
  if ( is_wp_error( $response ) ) {
385
  /** @var WP_Error $response */
 
 
386
 
387
  // Define error messages
388
  $wp_error = array(
389
  'http_request_failed' => __( 'Cannot save on facebook account because of something gone wrong during facebook connection.', 'pixel-caffeine' )
390
  );
391
 
392
- $message = isset( $wp_error[ $response->get_error_code() ] ) ? $wp_error[ $response->get_error_code() ] : $general_error;
 
 
 
 
 
 
393
 
394
  // Debug information
395
  if ( PixelCaffeine()->is_debug_mode() ) {
396
- $message .= '<br /><strong>DEBUG:</strong> ' . $response->get_error_code() . ' - ' . $response->get_error_message();
397
  }
398
  }
399
 
383
  // Check if request fails with wp_error response
384
  if ( is_wp_error( $response ) ) {
385
  /** @var WP_Error $response */
386
+ $error_code = $response->get_error_code();
387
+ $error_message = $response->get_error_message();
388
 
389
  // Define error messages
390
  $wp_error = array(
391
  'http_request_failed' => __( 'Cannot save on facebook account because of something gone wrong during facebook connection.', 'pixel-caffeine' )
392
  );
393
 
394
+ // Particlar case with cUrl version not supported
395
+ if ( false !== strpos( $error_message, 'cURL error 35' ) ) {
396
+ $error_code = 'curl_error';
397
+ $wp_error[ $error_code ] = __( 'The request goes in error from your server due by some oldest version of "cUrl" package. Please, ask to your hosting to upgrade it in order to fix it. HINT: enable the "debug mode" by Advanced Settings on bottom of this page. Then refresh and copy the entire message for your hosting support service, to give their more details about the issue.', 'pixel-caffeine' );
398
+ }
399
+
400
+ $message = isset( $wp_error[ $error_code ] ) ? $wp_error[ $error_code ] : $general_error;
401
 
402
  // Debug information
403
  if ( PixelCaffeine()->is_debug_mode() ) {
404
+ $message .= '<br /><strong>DEBUG:</strong> ' . $error_code . ' - ' . $error_message;
405
  }
406
  }
407
 
includes/admin/dist/img/store-logo/edd.png ADDED
Binary file
includes/admin/dist/js/admin.js CHANGED
@@ -7359,8 +7359,32 @@ jQuery(document).ready(function($){
7359
  tags = [];
7360
 
7361
  if ( 'content_ids' === key ) {
7362
- if ( dropdown_data.hasOwnProperty( 'get_posts' ) && dropdown_data.get_posts.hasOwnProperty( 'product' ) ) {
7363
- tags = dropdown_data.get_posts.product;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7364
  }
7365
  }
7366
 
@@ -7379,6 +7403,11 @@ jQuery(document).ready(function($){
7379
  }
7380
  }
7381
 
 
 
 
 
 
7382
  context.find('#dpa_value').select2({
7383
  tags: tags
7384
  });
7359
  tags = [];
7360
 
7361
  if ( 'content_ids' === key ) {
7362
+ if ( dropdown_data.hasOwnProperty( 'get_posts' ) ) {
7363
+
7364
+ // WooCommerce product ids
7365
+ if ( dropdown_data.get_posts.hasOwnProperty( 'product' ) ) {
7366
+ tags = dropdown_data.get_posts.product.concat( tags );
7367
+ }
7368
+
7369
+ // EDD product ids
7370
+ if ( dropdown_data.get_posts.hasOwnProperty( 'download' ) ) {
7371
+ tags = dropdown_data.get_posts.download.concat( tags );
7372
+ }
7373
+ }
7374
+ }
7375
+
7376
+ else if ( 'content_category' === key ) {
7377
+ if ( dropdown_data.hasOwnProperty( 'get_categories' ) ) {
7378
+
7379
+ // WooCommerce product categories
7380
+ if ( dropdown_data.get_categories.hasOwnProperty( 'product_cat' ) ) {
7381
+ tags = dropdown_data.get_categories.product_cat.concat( tags );
7382
+ }
7383
+
7384
+ // EDD product categories
7385
+ if ( dropdown_data.get_categories.hasOwnProperty( 'download_category' ) ) {
7386
+ tags = dropdown_data.get_categories.download_category.concat( tags );
7387
+ }
7388
  }
7389
  }
7390
 
7403
  }
7404
  }
7405
 
7406
+ // Remove "anything" item repeated
7407
+ tags = tags.filter( function( item, index ){
7408
+ return ! ( index !== 0 && item.id === '[[any]]' );
7409
+ });
7410
+
7411
  context.find('#dpa_value').select2({
7412
  tags: tags
7413
  });
includes/admin/dist/js/admin.min.js CHANGED
@@ -11,5 +11,5 @@ _a(f,{x:g?(2*f.x+a)/3:a,y:g?(f.y+b)/2:b,anchorX:h?K:g?(2*f.anchorX+c)/3:c,anchor
11
  l&&(g?g.animate(s):this.plotBackground=c.rect(o,p,q,r,0).attr({fill:l}).add().shadow(b.plotShadow)),m&&(i?i.animate(s):this.plotBGImage=c.image(m,o,p,q,r).add()),t?t.animate({width:u.width,height:u.height}):this.clipRect=c.clipRect(u),n&&(h?(h.strokeWidth=-n,h.animate(h.crisp({x:o,y:p,width:q,height:r}))):this.plotBorder=c.rect(o,p,q,r,0,-n).attr({stroke:b.plotBorderColor,"stroke-width":n,fill:"none",zIndex:1}).add()),this.isDirtyBox=!1},propFromSeries:function(){var a,b,c,d=this,e=d.options.chart,f=d.options.series;Ra(["inverted","angular","polar"],function(g){for(a=Oa[e.type||e.defaultSeriesType],c=d[g]||e[g]||a&&a.prototype[g],b=f&&f.length;!c&&b--;)(a=Oa[f[b].type])&&a.prototype[g]&&(c=!0);d[g]=c})},linkSeries:function(){var a=this,b=a.series;Ra(b,function(a){a.linkedSeries.length=0}),Ra(b,function(b){var c=b.options.linkedTo;f(c)&&(c=":previous"===c?a.series[b.index-1]:a.get(c))&&(c.linkedSeries.push(b),b.linkedParent=c,b.visible=cb(b.options.visible,c.options.visible,b.visible))})},renderSeries:function(){Ra(this.series,function(a){a.translate(),a.render()})},renderLabels:function(){var a=this,b=a.options.labels;b.items&&Ra(b.items,function(c){var d=_a(b.style,c.style),f=e(d.left)+a.plotLeft,g=e(d.top)+a.plotTop+12;delete d.left,delete d.top,a.renderer.text(c.html,f,g).attr({zIndex:2}).css(d).add()})},render:function(){var a,b,c,d,e=this.axes,f=this.renderer,g=this.options;this.setTitle(),this.legend=new sb(this,g.legend),this.getStacks&&this.getStacks(),this.getMargins(!0),this.setChartSize(),a=this.plotWidth,b=this.plotHeight-=21,Ra(e,function(a){a.setScale()}),this.getAxisMargins(),c=a/this.plotWidth>1.1,d=b/this.plotHeight>1.05,(c||d)&&(this.maxTicks=null,Ra(e,function(a){(a.horiz&&c||!a.horiz&&d)&&a.setTickInterval(!0)}),this.getMargins()),this.drawChartBox(),this.hasCartesianSeries&&Ra(e,function(a){a.visible&&a.render()}),this.seriesGroup||(this.seriesGroup=f.g("series-group").attr({zIndex:3}).add()),this.renderSeries(),this.renderLabels(),this.showCredits(g.credits),this.hasRendered=!0},showCredits:function(b){b.enabled&&!this.credits&&(this.credits=this.renderer.text(b.text,0,0).on("click",function(){b.href&&(a.location.href=b.href)}).attr({align:b.position.align,zIndex:8}).css(b.style).add().align(b.position))},destroy:function(){var a,b=this,c=b.axes,d=b.series,e=b.container,f=e&&e.parentNode;for(Xa(b,"destroy"),Ha[b.index]=K,Ia--,b.renderTo.removeAttribute("data-highcharts-chart"),Wa(b),a=c.length;a--;)c[a]=c[a].destroy();for(a=d.length;a--;)d[a]=d[a].destroy();Ra("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(a){var c=b[a];c&&c.destroy&&(b[a]=c.destroy())}),e&&(e.innerHTML="",Wa(e),f&&y(e));for(a in b)delete b[a]},isReadyToRender:function(){var b=this;return!(!Ba&&a==a.top&&"complete"!==ha.readyState||Da&&!a.canvg)||(Da?jb.push(function(){b.firstRender()},b.options.global.canvasToolsURL):ha.attachEvent("onreadystatechange",function(){ha.detachEvent("onreadystatechange",b.firstRender),"complete"===ha.readyState&&b.firstRender()}),!1)},firstRender:function(){var a=this,b=a.options;a.isReadyToRender()&&(a.getContainer(),Xa(a,"init"),a.resetMargins(),a.setChartSize(),a.propFromSeries(),a.getAxes(),Ra(b.series||[],function(b){a.initSeries(b)}),a.linkSeries(),Xa(a,"beforeRender"),ga.Pointer&&(a.pointer=new nb(a,b)),a.render(),a.renderer.draw(),!a.renderer.imgCount&&a.onload&&a.onload(),a.cloneRenderTo(!0))},onload:function(){var a=this;Ra([this.callback].concat(this.callbacks),function(b){b&&void 0!==a.index&&b.apply(a,[a])}),Xa(a,"load"),this.onload=null},splashArray:function(a,b){var c=b[a],c=ab(c)?c:[c,c,c,c];return[cb(b[a+"Top"],c[0]),cb(b[a+"Right"],c[1]),cb(b[a+"Bottom"],c[2]),cb(b[a+"Left"],c[3])]}};var ub=ga.CenteredSeriesMixin={getCenter:function(){var a,b,c=this.options,d=this.chart,e=2*(c.slicedOffset||0),f=d.plotWidth-2*e,d=d.plotHeight-2*e,g=c.center,g=[cb(g[0],"50%"),cb(g[1],"50%"),c.size||"100%",c.innerSize||0],h=na(f,d);for(a=0;a<4;++a)b=g[a],c=a<2||2===a&&/%$/.test(b),g[a]=(/%$/.test(b)?[f,d,h,g[2]][a]*parseFloat(b)/100:parseFloat(b))+(c?e:0);return g[3]>g[2]&&(g[3]=g[2]),g}},vb=function(){};vb.prototype={init:function(a,b,c){return this.series=a,this.color=a.color,this.applyOptions(b,c),this.pointAttr={},a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length)&&(a.colorCounter=0),a.chart.pointCount++,this},applyOptions:function(a,b){var c=this.series,d=c.options.pointValKey||c.pointValKey,a=vb.prototype.optionsToObject.call(this,a);return _a(this,a),this.options=this.options?_a(this.options,a):a,d&&(this.y=this[d]),this.isNull=null===this.x||!bb(this.y,!0),void 0===this.x&&c&&(this.x=void 0===b?c.autoIncrement(this):b),c.xAxis&&c.xAxis.names&&(c.xAxis.names[this.x]=this.name),this},optionsToObject:function(a){var b={},c=this.series,d=c.options.keys,e=d||c.pointArrayMap||["y"],f=e.length,h=0,i=0;if(bb(a)||null===a)b[e[0]]=a;else if(g(a))for(!d&&a.length>f&&(c=typeof a[0],"string"===c?b.name=a[0]:"number"===c&&(b.x=a[0]),h++);i<f;)d&&void 0===a[h]||(b[e[i]]=a[h]),h++,i++;else"object"==typeof a&&(b=a,a.dataLabels&&(c._hasPointLabels=!0),a.marker&&(c._hasPointMarkers=!0));return b},destroy:function(){var a,b=this.series.chart,c=b.hoverPoints;b.pointCount--,c&&(this.setState(),h(c,this),!c.length)&&(b.hoverPoints=null),this===b.hoverPoint&&this.onMouseOut(),(this.graphic||this.dataLabel)&&(Wa(this),this.destroyElements()),this.legendItem&&b.legend.destroyItem(this);for(a in this)this[a]=null},destroyElements:function(){for(var a,b=["graphic","dataLabel","dataLabelUpper","connector","shadowGroup"],c=6;c--;)a=b[c],this[a]&&(this[a]=this[a].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,color:this.color,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var b=this.series,c=b.tooltipOptions,d=cb(c.valueDecimals,""),e=c.valuePrefix||"",f=c.valueSuffix||"";return Ra(b.pointArrayMap||["y"],function(b){b="{point."+b,(e||f)&&(a=a.replace(b+"}",e+b+"}"+f)),a=a.replace(b+"}",b+":,."+d+"f}")}),r(a,{point:this,series:this.series})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])&&this.importEvents(),"click"===a&&e.allowPointSelect&&(c=function(a){d.select&&d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)}),Xa(this,a,b,c)},visible:!0};var wb=ga.Series=function(){};wb.prototype={isCartesian:!0,type:"line",pointClass:vb,sorted:!0,requireSorting:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},directTouch:!1,axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],init:function(a,b){var c,d,e=this,f=a.series,g=function(a,b){return cb(a.options.index,a._i)-cb(b.options.index,b._i)};e.chart=a,e.options=b=e.setOptions(b),e.linkedSeries=[],e.bindAxes(),_a(e,{name:b.name,state:"",pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0}),Da&&(b.animation=!1),d=b.events;for(c in d)Va(e,c,d[c]);(d&&d.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)&&(a.runTrackerClick=!0),e.getColor(),e.getSymbol(),Ra(e.parallelArrays,function(a){e[a+"Data"]=[]}),e.setData(b.data,!1),e.isCartesian&&(a.hasCartesianSeries=!0),f.push(e),e._i=f.length-1,u(f,g),this.yAxis&&u(this.yAxis.series,g),Ra(f,function(a,b){a.index=b,a.name=a.name||"Series "+(b+1)})},bindAxes:function(){var a,c=this,d=c.options,e=c.chart;Ra(c.axisTypes||[],function(f){Ra(e[f],function(b){a=b.options,(d[f]===a.index||d[f]!==K&&d[f]===a.id||d[f]===K&&0===a.index)&&(b.series.push(c),c[f]=b,b.isDirty=!0)}),!c[f]&&c.optionalAxis!==f&&b(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments,e=bb(b)?function(d){var e="y"===d&&c.toYData?c.toYData(a):a[d];c[d+"Data"][b]=e}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d,2))};Ra(c.parallelArrays,e)},autoIncrement:function(a){var b,c,d=this.options,e=this.xIncrement,f=d.pointIntervalUnit,h=this.xAxis,e=cb(e,d.pointStart,0);return this.pointInterval=d=cb(this.pointInterval,d.pointInterval,1),h&&h.categories&&a.name&&(this.requireSorting=!1,b=(c=g(h.categories))?h.categories:h.names,h=b,a=Qa(a.name,h),a===-1?c||(e=h.length):e=a),f&&(a=new R(e),"day"===f?a=+a[da](a[Y]()+d):"month"===f?a=+a[ea](a[Z]()+d):"year"===f&&(a=+a[fa](a[$]()+d)),d=a-e),this.xIncrement=e+d,e},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},e=b.plotOptions||{},f=c[this.type];return this.userOptions=a,c=d(f,c.series,a),this.tooltipOptions=d(O.tooltip,O.plotOptions[this.type].tooltip,b.tooltip,e.series&&e.series.tooltip,e[this.type]&&e[this.type].tooltip,a.tooltip),null===f.marker&&delete c.marker,this.zoneAxis=c.zoneAxis,a=this.zones=(c.zones||[]).slice(),!c.negativeColor&&!c.negativeFillColor||c.zones||a.push({value:c[this.zoneAxis+"Threshold"]||c.threshold||0,color:c.negativeColor,fillColor:c.negativeFillColor}),a.length&&i(a[a.length-1].value)&&a.push({color:this.color,fillColor:this.fillColor}),c},getCyclic:function(a,b,c){var d=this.userOptions,e="_"+a+"Index",f=a+"Counter";b||(i(d[e])?b=d[e]:(d[e]=b=this.chart[f]%c.length,this.chart[f]+=1),b=c[b]),this[a]=b},getColor:function(){this.options.colorByPoint?this.options.color=null:this.getCyclic("color",this.options.color||eb[this.type].color,this.chart.options.colors)},getSymbol:function(){var a=this.options.marker;this.getCyclic("symbol",a.symbol,this.chart.options.symbols),/^url/.test(this.symbol)&&(a.radius=0)},drawLegendSymbol:ib.drawLineMarker,setData:function(a,c,d,e){var h,i=this,j=i.points,k=j&&j.length||0,l=i.options,m=i.chart,n=null,o=i.xAxis,p=l.turboThreshold,q=this.xData,r=this.yData,s=(h=i.pointArrayMap)&&h.length,a=a||[];if(h=a.length,c=cb(c,!0),e!==!1&&h&&k===h&&!i.cropped&&!i.hasGroupedData&&i.visible)Ra(a,function(a,b){j[b].update&&a!==l.data[b]&&j[b].update(a,!1,null,!1)});else{if(i.xIncrement=null,i.colorCounter=0,Ra(this.parallelArrays,function(a){i[a+"Data"].length=0}),p&&h>p){for(d=0;null===n&&d<h;)n=a[d],d++;if(bb(n)){for(n=cb(l.pointStart,0),s=cb(l.pointInterval,1),d=0;d<h;d++)q[d]=n,r[d]=a[d],n+=s;i.xIncrement=n}else if(g(n))if(s)for(d=0;d<h;d++)n=a[d],q[d]=n[0],r[d]=n.slice(1,s+1);else for(d=0;d<h;d++)n=a[d],q[d]=n[0],r[d]=n[1];else b(12)}else for(d=0;d<h;d++)a[d]!==K&&(n={series:i},i.pointClass.prototype.applyOptions.apply(n,[a[d]]),i.updateParallelArrays(n,d));for(f(r[0])&&b(14,!0),i.data=[],i.options.data=i.userOptions.data=a,d=k;d--;)j[d]&&j[d].destroy&&j[d].destroy();o&&(o.minRange=o.userMinRange),i.isDirty=i.isDirtyData=m.isDirtyBox=!0,d=!1}"point"===l.legendType&&(this.processData(),this.generatePoints()),c&&m.redraw(d)},processData:function(a){var c,d=this.xData,e=this.yData,f=d.length;c=0;var g,h,i,j=this.xAxis,k=this.options;i=k.cropThreshold;var l,m,n=this.getExtremesFromAll||k.getExtremesFromAll,o=this.isCartesian,k=j&&j.val2lin,p=j&&j.isLog;if(o&&!this.isDirty&&!j.isDirty&&!this.yAxis.isDirty&&!a)return!1;for(j&&(a=j.getExtremes(),l=a.min,m=a.max),o&&this.sorted&&!n&&(!i||f>i||this.forceCrop)&&(d[f-1]<l||d[0]>m?(d=[],e=[]):(d[0]<l||d[f-1]>m)&&(c=this.cropData(this.xData,this.yData,l,m),d=c.xData,e=c.yData,c=c.start,g=!0)),i=d.length||1;--i;)f=p?k(d[i])-k(d[i-1]):d[i]-d[i-1],f>0&&(h===K||f<h)?h=f:f<0&&this.requireSorting&&b(15);this.cropped=g,this.cropStart=c,this.processedXData=d,this.processedYData=e,this.closestPointRange=h},cropData:function(a,b,c,d){var e,f=a.length,g=0,h=f,i=cb(this.cropShoulder,1);for(e=0;e<f;e++)if(a[e]>=c){g=ma(0,e-i);break}for(c=e;c<f;c++)if(a[c]>d){h=c+i;break}return{xData:a.slice(g,h),yData:b.slice(g,h),start:g,end:h}},generatePoints:function(){var a,b,c,d,e=this.options.data,f=this.data,g=this.processedXData,h=this.processedYData,i=this.pointClass,j=g.length,l=this.cropStart||0,m=this.hasGroupedData,n=[];for(f||m||(f=[],f.length=e.length,f=this.data=f),d=0;d<j;d++)b=l+d,m?(n[d]=(new i).init(this,[g[d]].concat(k(h[d]))),n[d].dataGroup=this.groupMap[d]):(f[b]?c=f[b]:e[b]!==K&&(f[b]=c=(new i).init(this,e[b],g[d])),n[d]=c),n[d].index=b;if(f&&(j!==(a=f.length)||m))for(d=0;d<a;d++)d===l&&!m&&(d+=j),f[d]&&(f[d].destroyElements(),f[d].plotX=K);this.data=f,this.points=n},getExtremes:function(a){var b,c=this.yAxis,d=this.processedXData,e=[],f=0;b=this.xAxis.getExtremes();var g,h,i,j,k=b.min,l=b.max,a=a||this.stackedYData||this.processedYData||[];for(b=a.length,j=0;j<b;j++)if(h=d[j],i=a[j],g=null!==i&&i!==K&&(!c.isLog||i.length||i>0),h=this.getExtremesFromAll||this.options.getExtremesFromAll||this.cropped||(d[j+1]||h)>=k&&(d[j-1]||h)<=l,g&&h)if(g=i.length)for(;g--;)null!==i[g]&&(e[f++]=i[g]);else e[f++]=i;this.dataMin=v(e),this.dataMax=w(e)},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var a,c,d,e,f=this.options,g=f.stacking,h=this.xAxis,j=h.categories,k=this.yAxis,l=this.points,m=l.length,n=!!this.modifyValue,o=f.pointPlacement,p="between"===o||bb(o),q=f.threshold,r=f.startFromThreshold?q:0,s=Number.MAX_VALUE,f=0;f<m;f++){var t=l[f],u=t.x,v=t.y;c=t.low;var w,x=g&&k.stacks[(this.negStacks&&v<(r?0:q)?"-":"")+this.stackKey];k.isLog&&null!==v&&v<=0&&(t.y=v=null,b(10)),t.plotX=a=z(na(ma(-1e5,h.translate(u,0,0,0,1,o,"flags"===this.type)),1e5)),g&&this.visible&&!t.isNull&&x&&x[u]&&(e=this.getStackIndicator(e,u,this.index),w=x[u],v=w.points[e.key],c=v[0],v=v[1],c===r&&e.key===x[u].base&&(c=cb(q,k.min)),k.isLog&&c<=0&&(c=null),t.total=t.stackTotal=w.total,t.percentage=w.total&&t.y/w.total*100,t.stackY=v,w.setOffset(this.pointXOffset||0,this.barW||0)),t.yBottom=i(c)?k.translate(c,0,1,0,1):null,n&&(v=this.modifyValue(v,t)),t.plotY=c="number"==typeof v&&v!==1/0?na(ma(-1e5,k.translate(v,0,1,0,1)),1e5):K,t.isInside=c!==K&&c>=0&&c<=k.len&&a>=0&&a<=h.len,t.clientX=p?z(h.translate(u,0,0,0,1)):a,t.negative=t.y<(q||0),t.category=j&&j[t.x]!==K?j[t.x]:t.x,t.isNull||(void 0!==d&&(s=na(s,oa(a-d))),d=a)}this.closestPointRangePx=s},getValidPoints:function(a,b){var c=this.chart;return Sa(a||this.points||[],function(a){return!(b&&!c.isInsidePlot(a.plotX,a.plotY,c.inverted))&&!a.isNull})},setClip:function(a){var b=this.chart,c=this.options,d=b.renderer,e=b.inverted,f=this.clipBox,g=f||b.clipBox,h=this.sharedClipKey||["_sharedClip",a&&a.duration,a&&a.easing,g.height,c.xAxis,c.yAxis].join(","),i=b[h],j=b[h+"m"];i||(a&&(g.width=0,b[h+"m"]=j=d.clipRect(-99,e?-b.plotLeft:-b.plotTop,99,e?b.chartWidth:b.chartHeight)),b[h]=i=d.clipRect(g),i.count={length:0}),a&&!i.count[this.index]&&(i.count[this.index]=!0,i.count.length+=1),c.clip!==!1&&(this.group.clip(a||f?i:b.clipRect),this.markerGroup.clip(j),this.sharedClipKey=h),a||(i.count[this.index]&&(delete i.count[this.index],i.count.length-=1),0===i.count.length&&h&&b[h]&&(f||(b[h]=b[h].destroy()),b[h+"m"]&&(b[h+"m"]=b[h+"m"].destroy())))},animate:function(a){var b,c=this.chart,d=this.options.animation;d&&!ab(d)&&(d=eb[this.type].animation),a?this.setClip(d):(b=this.sharedClipKey,(a=c[b])&&a.animate({width:c.plotSizeX},d),c[b+"m"]&&c[b+"m"].animate({width:c.plotSizeX+99},d),this.animate=null)},afterAnimate:function(){this.setClip(),Xa(this,"afterAnimate")},drawPoints:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=this.points,n=this.chart,o=this.options.marker,p=this.pointAttr[""],q=this.markerGroup,r=cb(o.enabled,this.xAxis.isRadial,this.closestPointRangePx>2*o.radius);if(o.enabled!==!1||this._hasPointMarkers)for(d=m.length;d--;)e=m[d],b=ka(e.plotX),c=e.plotY,i=e.graphic,j=e.marker||{},k=!!e.marker,a=r&&j.enabled===K||j.enabled,l=e.isInside,a&&bb(c)&&null!==e.y?(a=e.pointAttr[e.selected?"select":""]||p,f=a.r,g=cb(j.symbol,this.symbol),h=0===g.indexOf("url"),i?i[l?"show":"hide"](!0).attr(a).animate(_a({x:b-f,y:c-f},i.symbolName?{width:2*f,height:2*f}:{})):l&&(f>0||h)&&(e.graphic=n.renderer.symbol(g,b-f,c-f,2*f,2*f,k?j:o).attr(a).add(q))):i&&(e.graphic=i.destroy())},convertAttribs:function(a,b,c,d){var e,f,g=this.pointAttrToOptions,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(e in g)f=g[e],h[e]=cb(a[f],b[e],c[e],d[e]);return h},getAttribs:function(){var a,b,c,d=this,e=d.options,f=eb[d.type].marker?e.marker:e,g=f.states,h=g.hover,j=d.color,k=d.options.negativeColor,l={stroke:j,fill:j},m=d.points||[],n=[],o=d.pointAttrToOptions;a=d.hasPointSpecificOptions;var p=f.lineColor,q=f.fillColor;b=e.turboThreshold;var r,s,t=d.zones,u=d.zoneAxis||"y";if(e.marker?(h.radius=+h.radius||+f.radius+ +h.radiusPlus,h.lineWidth=h.lineWidth||f.lineWidth+h.lineWidthPlus):(h.color=h.color||D(h.color||j).brighten(h.brightness).get(),h.negativeColor=h.negativeColor||D(h.negativeColor||k).brighten(h.brightness).get()),n[""]=d.convertAttribs(f,l),Ra(["hover","select"],function(a){n[a]=d.convertAttribs(g[a],n[""])}),d.pointAttr=n,j=m.length,!b||j<b||a)for(;j--;){if(b=m[j],(f=b.options&&b.options.marker||b.options)&&f.enabled===!1&&(f.radius=0),l=null,t.length){for(a=0,l=t[a];b[u]>=l.value;)l=t[++a];b.color=b.fillColor=l=cb(l.color,d.color)}if(a=e.colorByPoint||b.color,b.options)for(s in o)i(f[o[s]])&&(a=!0);a?(f=f||{},c=[],g=f.states||{},a=g.hover=g.hover||{},e.marker&&(!b.negative||a.fillColor||h.fillColor)||(a[d.pointAttrToOptions.fill]=a.color||!b.options.color&&h[b.negative&&k?"negativeColor":"color"]||D(b.color).brighten(a.brightness||h.brightness).get()),r={color:b.color},q||(r.fillColor=b.color),p||(r.lineColor=b.color),f.hasOwnProperty("color")&&!f.color&&delete f.color,l&&!h.fillColor&&(a.fillColor=l),c[""]=d.convertAttribs(_a(r,f),n[""]),c.hover=d.convertAttribs(g.hover,n.hover,c[""]),c.select=d.convertAttribs(g.select,n.select,c[""])):c=n,b.pointAttr=c}},destroy:function(){var a,b,c,d,e=this,f=e.chart,g=/AppleWebKit\/533/.test(ta),i=e.data||[];for(Xa(e,"destroy"),Wa(e),Ra(e.axisTypes||[],function(a){(d=e[a])&&(h(d.series,e),d.isDirty=d.forceRedraw=!0)}),e.legendItem&&e.chart.legend.destroyItem(e),a=i.length;a--;)(b=i[a])&&b.destroy&&b.destroy();e.points=null,clearTimeout(e.animationTimeout);for(c in e)e[c]instanceof E&&!e[c].survive&&(a=g&&"group"===c?"hide":"destroy",e[c][a]());f.hoverSeries===e&&(f.hoverSeries=null),h(f.series,e);for(c in e)delete e[c]},getGraphPath:function(a,b,c){var d,e,f=this,g=f.options,h=g.step,j=[],k=[],a=a||f.points;return(d=a.reversed)&&a.reverse(),(h={right:1,center:2}[h]||h&&3)&&d&&(h=4-h),g.connectNulls&&!b&&!c&&(a=this.getValidPoints(a)),Ra(a,function(d,l){var m=d.plotX,n=d.plotY,o=a[l-1];(d.leftCliff||o&&o.rightCliff)&&!c&&(e=!0),d.isNull&&!i(b)&&l>0?e=!g.connectNulls:d.isNull&&!b?e=!0:(0===l||e?o=[Ka,d.plotX,d.plotY]:f.getPointSpline?o=f.getPointSpline(a,d,l):h?(o=1===h?[La,o.plotX,n]:2===h?[La,(o.plotX+m)/2,o.plotY,La,(o.plotX+m)/2,n]:[La,m,o.plotY],o.push(La,m,n)):o=[La,m,n],k.push(d.x),h&&k.push(d.x),j.push.apply(j,o),e=!1)}),j.xMap=k,f.graphPath=j},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color,b.dashStyle]],d=b.lineWidth,e="square"!==b.linecap,f=(this.gappedPath||this.getGraphPath).call(this);Ra(this.zones,function(d,e){c.push(["zoneGraph"+e,d.color||a.color,d.dashStyle||b.dashStyle])}),Ra(c,function(c,g){var h=c[0],i=a[h];i?(i.endX=f.xMap,i.animate({d:f})):d&&f.length&&(i={stroke:c[1],"stroke-width":d,fill:"none",zIndex:1},c[2]?i.dashstyle=c[2]:e&&(i["stroke-linecap"]=i["stroke-linejoin"]="round"),i=a[h]=a.chart.renderer.path(f).attr(i).add(a.group).shadow(g<2&&b.shadow)),i&&(i.startX=f.xMap,i.isArea=f.isArea)})},applyZones:function(){var a,b,c,d,e,f,g,h=this,i=this.chart,j=i.renderer,k=this.zones,l=this.clips||[],m=this.graph,n=this.area,o=ma(i.chartWidth,i.chartHeight),p=this[(this.zoneAxis||"y")+"Axis"],q=p.reversed,r=i.inverted,s=p.horiz,t=!1;k.length&&(m||n)&&p.min!==K&&(m&&m.hide(),n&&n.hide(),d=p.getExtremes(),Ra(k,function(k,u){a=q?s?i.plotWidth:0:s?0:p.toPixels(d.min),a=na(ma(cb(b,a),0),o),b=na(ma(ja(p.toPixels(cb(k.value,d.max),!0)),0),o),t&&(a=b=p.toPixels(d.max)),e=Math.abs(a-b),f=na(a,b),g=ma(a,b),p.isXAxis?(c={x:r?g:f,y:0,width:e,height:o},s||(c.x=i.plotHeight-c.x)):(c={x:0,y:r?g:f,width:o,height:e},s&&(c.y=i.plotWidth-c.y)),i.inverted&&j.isVML&&(c=p.isXAxis?{x:0,y:q?f:g,height:c.width,width:i.chartWidth}:{x:c.y-i.plotLeft-i.spacingBox.x,y:0,width:c.height,height:i.chartHeight}),l[u]?l[u].animate(c):(l[u]=j.clipRect(c),m&&h["zoneGraph"+u].clip(l[u]),n&&h["zoneArea"+u].clip(l[u])),t=k.value>d.max}),this.clips=l)},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};Ra(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;b.xAxis&&(Va(c,"resize",a),Va(b,"destroy",function(){Wa(c,"resize",a)}),a(),b.invertGroups=a)},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;return g&&(this[a]=f=this.chart.renderer.g(b).attr({zIndex:d||.1}).add(e),f.addClass("highcharts-series-"+this.index)),f.attr({visibility:c})[g?"attr":"animate"](this.getPlotBox()),f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;return a.inverted&&(b=c,c=this.xAxis),{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a,b=this,c=b.chart,d=b.options,e=!!b.animate&&c.renderer.isSVG&&B(d.animation).duration,f=b.visible?"inherit":"hidden",g=d.zIndex,h=b.hasRendered,i=c.seriesGroup;a=b.plotGroup("group","series",f,g,i),b.markerGroup=b.plotGroup("markerGroup","markers",f,g,i),e&&b.animate(!0),b.getAttribs(),a.inverted=!!b.isCartesian&&c.inverted,b.drawGraph&&(b.drawGraph(),b.applyZones()),Ra(b.points,function(a){a.redraw&&a.redraw()}),b.drawDataLabels&&b.drawDataLabels(),b.visible&&b.drawPoints(),b.drawTracker&&b.options.enableMouseTracking!==!1&&b.drawTracker(),c.inverted&&b.invertGroups(),d.clip!==!1&&!b.sharedClipKey&&!h&&a.clip(c.clipRect),e&&b.animate(),h||(b.animationTimeout=l(function(){b.afterAnimate()},e)),b.isDirty=b.isDirtyData=!1,b.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirty||this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:cb(d&&d.left,a.plotLeft),translateY:cb(e&&e.top,a.plotTop)})),this.translate(),this.render(),b&&delete this.kdTree},kdDimensions:1,kdAxisArray:["clientX","plotY"],searchPoint:function(a,b){var c=this.xAxis,d=this.yAxis,e=this.chart.inverted;return this.searchKDTree({clientX:e?c.len-a.chartY+c.pos:a.chartX-c.pos,plotY:e?d.len-a.chartX+d.pos:a.chartY-d.pos},b)},buildKDTree:function(){function a(c,d,e){var f,g;if(g=c&&c.length)return f=b.kdAxisArray[d%e],c.sort(function(a,b){return a[f]-b[f]}),g=Math.floor(g/2),{point:c[g],left:a(c.slice(0,g),d+1,e),right:a(c.slice(g+1),d+1,e)}}var b=this,c=b.kdDimensions;delete b.kdTree,l(function(){b.kdTree=a(b.getValidPoints(null,!b.directTouch),c,c)},b.options.kdNow?0:1)},searchKDTree:function(a,b){function c(a,b,h,j){var k,l,m=b.point,n=d.kdAxisArray[h%j],o=m;return l=i(a[e])&&i(m[e])?Math.pow(a[e]-m[e],2):null,k=i(a[f])&&i(m[f])?Math.pow(a[f]-m[f],2):null,k=(l||0)+(k||0),m.dist=i(k)?Math.sqrt(k):Number.MAX_VALUE,m.distX=i(l)?Math.sqrt(l):Number.MAX_VALUE,n=a[n]-m[n],k=n<0?"left":"right",l=n<0?"right":"left",b[k]&&(k=c(a,b[k],h+1,j),o=k[g]<o[g]?k:m),b[l]&&Math.sqrt(n*n)<o[g]&&(a=c(a,b[l],h+1,j),o=a[g]<o[g]?a:o),o}var d=this,e=this.kdAxisArray[0],f=this.kdAxisArray[1],g=b?"distX":"dist";if(this.kdTree||this.buildKDTree(),this.kdTree)return c(a,this.kdTree,this.kdDimensions,this.kdDimensions)}},G.prototype={destroy:function(){x(this,this.axis)},render:function(a){var b=this.options,c=b.format,c=c?r(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=c.reversed,f=this.isNegative&&!f||!this.isNegative&&f,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0),c=oa(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};(e=this.label)&&(e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?"show":"hide"](!0))}},tb.prototype.getStacks=function(){var a=this;Ra(a.yAxis,function(a){a.stacks&&a.hasVisibleSeries&&(a.oldStacks=a.stacks)}),Ra(a.series,function(b){!b.options.stacking||b.visible!==!0&&a.options.chart.ignoreHiddenSeries!==!1||(b.stackKey=b.type+cb(b.options.stack,""))})},kb.prototype.buildStacks=function(){var a,b,c=this.series,d=cb(this.options.reversedStacks,!0),e=c.length;if(!this.isXAxis){for(this.usePercentage=!1,b=e;b--;)c[d?b:e-b-1].setStackedPoints();for(b=e;b--;)a=c[d?b:e-b-1],a.setStackCliffs&&a.setStackCliffs();if(this.usePercentage)for(b=0;b<e;b++)c[b].setPercentStacks()}},kb.prototype.renderStackTotals=function(){var a,b,c=this.chart,d=c.renderer,e=this.stacks,f=this.stackTotalGroup;f||(this.stackTotalGroup=f=d.g("stack-labels").attr({visibility:"visible",zIndex:6}).add()),f.translate(c.plotLeft,c.plotTop);for(a in e)for(b in c=e[a])c[b].render(f)},kb.prototype.resetStacks=function(){var a,b,c=this.stacks;if(!this.isXAxis)for(a in c)for(b in c[a])c[a][b].touched<this.stacksTouched?(c[a][b].destroy(),delete c[a][b]):(c[a][b].total=null,c[a][b].cum=0)},kb.prototype.cleanStacks=function(){var a,b,c;if(!this.isXAxis){this.oldStacks&&(a=this.stacks=this.oldStacks);for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total}},wb.prototype.setStackedPoints=function(){if(this.options.stacking&&(this.visible===!0||this.chart.options.chart.ignoreHiddenSeries===!1)){var a,b,c,d,e,f,g,h=this.processedXData,j=this.processedYData,k=[],l=j.length,m=this.options,n=m.threshold,o=m.startFromThreshold?n:0,p=m.stack,m=m.stacking,q=this.stackKey,r="-"+q,s=this.negStacks,t=this.yAxis,u=t.stacks,v=t.oldStacks;for(t.stacksTouched+=1,e=0;e<l;e++)f=h[e],g=j[e],a=this.getStackIndicator(a,f,this.index),d=a.key,c=(b=s&&g<(o?0:n))?r:q,u[c]||(u[c]={}),u[c][f]||(v[c]&&v[c][f]?(u[c][f]=v[c][f],u[c][f].total=null):u[c][f]=new G(t,t.options.stackLabels,b,f,p)),c=u[c][f],null!==g&&(c.points[d]=c.points[this.index]=[cb(c.cum,o)],i(c.cum)||(c.base=d),c.touched=t.stacksTouched,a.index>0&&this.singleStacks===!1&&(c.points[d][0]=c.points[this.index+","+f+",0"][0])),"percent"===m?(b=b?q:r,s&&u[b]&&u[b][f]?(b=u[b][f],c.total=b.total=ma(b.total,c.total)+oa(g)||0):c.total=z(c.total+(oa(g)||0))):c.total=z(c.total+(g||0)),c.cum=cb(c.cum,o)+(g||0),null!==g&&(c.points[d].push(c.cum),k[e]=c.cum);"percent"===m&&(t.usePercentage=!0),this.stackedYData=k,t.oldStacks={}}},wb.prototype.setPercentStacks=function(){var a,b=this,c=b.stackKey,d=b.yAxis.stacks,e=b.processedXData;Ra([c,"-"+c],function(c){for(var f,g,h,i=e.length;i--;)g=e[i],a=b.getStackIndicator(a,g,b.index),f=(h=d[c]&&d[c][g])&&h.points[a.key],(g=f)&&(h=h.total?100/h.total:0,g[0]=z(g[0]*h),g[1]=z(g[1]*h),b.stackedYData[i]=g[1])})},wb.prototype.getStackIndicator=function(a,b,c){return i(a)&&a.x===b?a.index++:a={x:b,index:0},a.key=[c,b,a.index].join(","),a},_a(tb.prototype,{addSeries:function(a,b,c){var d,e=this;return a&&(b=cb(b,!0),Xa(e,"addSeries",{options:a},function(){d=e.initSeries(a),e.isDirtyLegend=!0,e.linkSeries(),b&&e.redraw(c)})),d},addAxis:function(a,b,c,e){var f=b?"xAxis":"yAxis",g=this.options,a=d(a,{index:this[f].length,isX:b});new kb(this,a),g[f]=k(g[f]||{}),g[f].push(a),cb(c,!0)&&this.redraw(e)},showLoading:function(a){var b=this,c=b.options,d=b.loadingDiv,e=c.loading,f=function(){d&&m(d,{left:b.plotLeft+"px",top:b.plotTop+"px",width:b.plotWidth+"px",height:b.plotHeight+"px"})};d||(b.loadingDiv=d=n(Ja,{className:"highcharts-loading"},_a(e.style,{zIndex:10,display:"none"}),b.container),b.loadingSpan=n("span",null,e.labelStyle,d),Va(b,"redraw",f)),b.loadingSpan.innerHTML=a||c.lang.loading,b.loadingShown||(m(d,{opacity:0,display:""}),Ya(d,{opacity:e.style.opacity},{duration:e.showDuration||0}),b.loadingShown=!0),f()},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&Ya(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){m(b,{display:"none"})}}),this.loadingShown=!1}}),_a(vb.prototype,{update:function(a,b,c,d){function e(){g.applyOptions(a),null===g.y&&i&&(g.graphic=i.destroy()),ab(a,!0)&&(g.redraw=function(){i&&i.element&&a&&a.marker&&a.marker.symbol&&(g.graphic=i.destroy()),a&&a.dataLabels&&g.dataLabel&&(g.dataLabel=g.dataLabel.destroy()),g.redraw=null}),f=g.index,h.updateParallelArrays(g,f),l&&g.name&&(l[g.x]=g.name),k.data[f]=ab(k.data[f],!0)?g.options:a,h.isDirty=h.isDirtyData=!0,!h.fixedBox&&h.hasCartesianSeries&&(j.isDirtyBox=!0),"point"===k.legendType&&(j.isDirtyLegend=!0),b&&j.redraw(c)}var f,g=this,h=g.series,i=g.graphic,j=h.chart,k=h.options,l=h.xAxis&&h.xAxis.names,b=cb(b,!0);d===!1?e():g.firePointEvent("update",{options:a},e)},remove:function(a,b){this.series.removePoint(Qa(this,this.series.data),a,b)}}),_a(wb.prototype,{addPoint:function(a,b,c,d){var e,f,g,h=this.options,i=this.data,j=this.chart,k=this.xAxis&&this.xAxis.names,l=h.data,m=this.xData;if(A(d,j),b=cb(b,!0),d={series:this},this.pointClass.prototype.applyOptions.apply(d,[a]),g=d.x,f=m.length,this.requireSorting&&g<m[f-1])for(e=!0;f&&m[f-1]>g;)f--;this.updateParallelArrays(d,"splice",f,0,0),this.updateParallelArrays(d,f),k&&d.name&&(k[g]=d.name),l.splice(f,0,a),e&&(this.data.splice(f,0,null),this.processData()),"point"===h.legendType&&this.generatePoints(),c&&(i[0]&&i[0].remove?i[0].remove(!1):(i.shift(),this.updateParallelArrays(d,"shift"),l.shift())),this.isDirtyData=this.isDirty=!0,b&&(this.getAttribs(),j.redraw())},removePoint:function(a,b,c){var d=this,e=d.data,f=e[a],g=d.points,h=d.chart,i=function(){g&&g.length===e.length&&g.splice(a,1),e.splice(a,1),d.options.data.splice(a,1),d.updateParallelArrays(f||{series:d},"splice",a,1),f&&f.destroy(),d.isDirty=!0,d.isDirtyData=!0,b&&h.redraw()};A(c,h),b=cb(b,!0),f?f.firePointEvent("remove",null,i):i()},remove:function(a,b){var c=this,d=c.chart;Xa(c,"remove",null,function(){c.destroy(),d.isDirtyLegend=d.isDirtyBox=!0,d.linkSeries(),cb(a,!0)&&d.redraw(b)})},update:function(a,b){var c,e=this,f=this.chart,g=this.userOptions,h=this.type,i=Oa[h].prototype,j=["group","markerGroup","dataLabelsGroup"];(a.type&&a.type!==h||void 0!==a.zIndex)&&(j.length=0),Ra(j,function(a){j[a]=e[a],delete e[a]}),a=d(g,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a),this.remove(!1);for(c in i)this[c]=K;_a(this,Oa[a.type||h].prototype),Ra(j,function(a){e[a]=j[a]}),this.init(f,a),f.linkSeries(),cb(b,!0)&&f.redraw(!1)}}),_a(kb.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=d(this.userOptions,a);this.destroy(!0),this.init(c,_a(a,{events:K})),c.isDirtyBox=!0,cb(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);h(b.axes,this),h(b[c],this),b.options[c].splice(this.options.index,1),Ra(b[c],function(a,b){a.options.index=b}),this.destroy(),b.isDirtyBox=!0,cb(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}});var xb=o(wb);Oa.line=xb,eb.area=d(fb,{softThreshold:!1,threshold:0});var yb=o(wb,{type:"area",singleStacks:!1,getStackPoints:function(){var a,b,c,d=[],e=[],f=this.xAxis,g=this.yAxis,h=g.stacks[this.stackKey],i={},j=this.points,k=this.index,l=g.series,m=l.length,n=cb(g.options.reversedStacks,!0)?1:-1;if(this.options.stacking){for(b=0;b<j.length;b++)i[j[b].x]=j[b];for(c in h)null!==h[c].total&&e.push(c);e.sort(function(a,b){return a-b}),a=Ua(l,function(){return this.visible}),Ra(e,function(c,j){var l,o,p=0;if(i[c]&&!i[c].isNull)d.push(i[c]),Ra([-1,1],function(d){var f=1===d?"rightNull":"leftNull",g=0,p=h[e[j+d]];if(p)for(b=k;b>=0&&b<m;)l=p.points[b],l||(b===k?i[c][f]=!0:a[b]&&(o=h[c].points[b])&&(g-=o[1]-o[0])),b+=n;i[c][1===d?"rightCliff":"leftCliff"]=g});else{for(b=k;b>=0&&b<m;){if(l=h[c].points[b]){p=l[1];break}b+=n}p=g.toPixels(p,!0),d.push({isNull:!0,plotX:f.toPixels(c,!0),plotY:p,yBottom:p})}})}return d;
12
  },getGraphPath:function(a){var b,c,d,e,f=wb.prototype.getGraphPath,g=this.options,h=g.stacking,i=this.yAxis,j=[],k=[],l=this.index,m=i.stacks[this.stackKey],n=g.threshold,o=i.getThreshold(g.threshold),g=g.connectNulls||"percent"===h,p=function(b,c,e){var f,g,p=a[b],b=h&&m[p.x].points[l],q=p[e+"Null"]||0,e=p[e+"Cliff"]||0,p=!0;e||q?(f=(q?b[0]:b[1])+e,g=b[0]+e,p=!!q):!h&&a[c]&&a[c].isNull&&(f=g=n),void 0!==f&&(k.push({plotX:d,plotY:null===f?o:i.getThreshold(f),isNull:p}),j.push({plotX:d,plotY:null===g?o:i.getThreshold(g)}))},a=a||this.points;for(h&&(a=this.getStackPoints()),b=0;b<a.length;b++)c=a[b].isNull,d=cb(a[b].rectPlotX,a[b].plotX),e=cb(a[b].yBottom,o),(!c||g)&&(g||p(b,b-1,"left"),c&&!h&&g||(k.push(a[b]),j.push({x:b,plotX:d,plotY:e})),g||p(b,b+1,"right"));return b=f.call(this,k,!0,!0),j.reversed=!0,c=f.call(this,j,!0,!0),c.length&&(c[0]=La),c=b.concat(c),f=f.call(this,k,!1,g),c.xMap=b.xMap,this.areaPath=c,f},drawGraph:function(){this.areaPath=[],wb.prototype.drawGraph.apply(this);var a=this,b=this.areaPath,c=this.options,d=[["area",this.color,c.fillColor]];Ra(this.zones,function(b,e){d.push(["zoneArea"+e,b.color||a.color,b.fillColor||c.fillColor])}),Ra(d,function(d){var e=d[0],f=a[e];f?(f.endX=b.xMap,f.animate({d:b})):(f={fill:d[2]||d[1],zIndex:0},d[2]||(f["fill-opacity"]=cb(c.fillOpacity,.75)),f=a[e]=a.chart.renderer.path(b).attr(f).add(a.group),f.isArea=!0),f.startX=b.xMap,f.shiftUnit=c.step?2:1})},drawLegendSymbol:ib.drawRectangle});Oa.area=yb,eb.spline=d(fb),xb=o(wb,{type:"spline",getPointSpline:function(a,b,c){var d,e,f,g,h=b.plotX,i=b.plotY,j=a[c-1],c=a[c+1];if(j&&!j.isNull&&c&&!c.isNull){a=j.plotY,f=c.plotX;var c=c.plotY,k=0;d=(1.5*h+j.plotX)/2.5,e=(1.5*i+a)/2.5,f=(1.5*h+f)/2.5,g=(1.5*i+c)/2.5,f!==d&&(k=(g-e)*(f-h)/(f-d)+i-g),e+=k,g+=k,e>a&&e>i?(e=ma(a,i),g=2*i-e):e<a&&e<i&&(e=na(a,i),g=2*i-e),g>c&&g>i?(g=ma(c,i),e=2*i-g):g<c&&g<i&&(g=na(c,i),e=2*i-g),b.rightContX=f,b.rightContY=g}return b=["C",cb(j.rightContX,j.plotX),cb(j.rightContY,j.plotY),cb(d,h),cb(e,i),h,i],j.rightContX=j.rightContY=null,b}}),Oa.spline=xb,eb.areaspline=d(eb.area),yb=yb.prototype,xb=o(xb,{type:"areaspline",getStackPoints:yb.getStackPoints,getGraphPath:yb.getGraphPath,setStackCliffs:yb.setStackCliffs,drawGraph:yb.drawGraph,drawLegendSymbol:ib.drawRectangle}),Oa.areaspline=xb,eb.column=d(fb,{borderColor:"#FFFFFF",borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1,halo:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},softThreshold:!1,startFromThreshold:!0,stickyTracking:!1,tooltip:{distance:6},threshold:0}),xb=o(wb,{type:"column",pointAttrToOptions:{stroke:"borderColor",fill:"color",r:"borderRadius"},cropShoulder:0,directTouch:!0,trackerGroups:["group","dataLabelsGroup"],negStacks:!0,init:function(){wb.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasRendered&&Ra(b.series,function(b){b.type===a.type&&(b.isDirty=!0)})},getColumnMetrics:function(){var a,b=this,c=b.options,d=b.xAxis,e=b.yAxis,f=d.reversed,g={},h=0;c.grouping===!1?h=1:Ra(b.chart.series,function(c){var d,f=c.options,i=c.yAxis;c.type===b.type&&c.visible&&e.len===i.len&&e.pos===i.pos&&(f.stacking?(a=c.stackKey,g[a]===K&&(g[a]=h++),d=g[a]):f.grouping!==!1&&(d=h++),c.columnIndex=d)});var i=na(oa(d.transA)*(d.ordinalSlope||c.pointRange||d.closestPointRange||d.tickInterval||1),d.len),j=i*c.groupPadding,k=(i-2*j)/h,c=na(c.maxPointWidth||d.len,cb(c.pointWidth,k*(1-2*c.pointPadding)));return b.columnMetrics={width:c,offset:(k-c)/2+(j+((b.columnIndex||0)+(f?1:0))*k-i/2)*(f?-1:1)},b.columnMetrics},crispCol:function(a,b,c,d){var e=this.chart,f=this.borderWidth,g=-(f%2?.5:0),f=f%2?.5:1;return e.inverted&&e.renderer.isVML&&(f+=1),c=Math.round(a+c)+g,a=Math.round(a)+g,c-=a,d=Math.round(b+d)+f,g=oa(b)<=.5&&d>.5,b=Math.round(b)+f,d-=b,g&&d&&(b-=1,d+=1),{x:a,y:b,width:c,height:d}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=cb(c.borderWidth,a.closestPointRange*a.xAxis.transA<2?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=cb(c.minPointLength,5),h=a.getColumnMetrics(),i=h.width,j=a.barW=ma(i,1+2*d),k=a.pointXOffset=h.offset;b.inverted&&(f-=.5),c.pointPadding&&(j=la(j)),wb.prototype.translate.apply(a),Ra(a.points,function(c){var d,h=na(cb(c.yBottom,f),9e4),l=999+oa(h),l=na(ma(-l,c.plotY),e.len+l),m=c.plotX+k,n=j,o=na(l,h),p=ma(l,h)-o;oa(p)<g&&g&&(p=g,d=!e.reversed&&!c.negative||e.reversed&&c.negative,o=oa(o-f)>g?h-g:f-(d?g:0)),c.barX=m,c.pointWidth=i,c.tooltipPos=b.inverted?[e.len+e.pos-b.plotLeft-l,a.xAxis.len-m-n/2,p]:[m+n/2,l+e.pos-b.plotTop,p],c.shapeType="rect",c.shapeArgs=a.crispCol(m,o,n,p)})},getSymbol:Ga,drawLegendSymbol:ib.drawRectangle,drawGraph:Ga,drawPoints:function(){var a,b,c=this,e=this.chart,f=c.options,g=e.renderer,h=f.animationLimit||250;Ra(c.points,function(j){var k,l=j.graphic;bb(j.plotY)&&null!==j.y?(a=j.shapeArgs,k=i(c.borderWidth)?{"stroke-width":c.borderWidth}:{},b=j.pointAttr[j.selected?"select":""]||c.pointAttr[""],l?(Za(l),l.attr(k).attr(b)[e.pointCount<h?"animate":"attr"](d(a))):j.graphic=g[j.shapeType](a).attr(k).attr(b).add(j.group||c.group).shadow(f.shadow,null,f.stacking&&!f.borderRadius)):l&&(j.graphic=l.destroy())})},animate:function(a){var b=this,c=this.yAxis,d=b.options,e=this.chart.inverted,f={};Ba&&(a?(f.scaleY=.001,a=na(c.pos+c.len,ma(c.pos,c.toPixels(d.threshold))),e?f.translateX=a-c.len:f.translateY=a,b.group.attr(f)):(f[e?"translateX":"translateY"]=c.pos,b.group.animate(f,_a(B(b.options.animation),{step:function(a,c){b.group.attr({scaleY:ma(.001,c.pos)})}})),b.animate=null))},remove:function(){var a=this,b=a.chart;b.hasRendered&&Ra(b.series,function(b){b.type===a.type&&(b.isDirty=!0)}),wb.prototype.remove.apply(a,arguments)}}),Oa.column=xb,eb.bar=d(eb.column),yb=o(xb,{type:"bar",inverted:!0}),Oa.bar=yb,eb.scatter=d(fb,{lineWidth:0,marker:{enabled:!0},tooltip:{headerFormat:'<span style="color:{point.color}">●</span> <span style="font-size: 10px;"> {series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}}),yb=o(wb,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","markerGroup","dataLabelsGroup"],takeOrdinalPosition:!1,kdDimensions:2,drawGraph:function(){this.options.lineWidth&&wb.prototype.drawGraph.call(this)}}),Oa.scatter=yb,eb.pie=d(fb,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return null===this.y?void 0:this.point.name},x:0},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}}),fb={type:"pie",isCartesian:!1,pointClass:o(vb,{init:function(){vb.prototype.init.apply(this,arguments);var a,b=this;return b.name=cb(b.name,"Slice"),a=function(a){b.slice("select"===a.type)},Va(b,"select",a),Va(b,"unselect",a),b},setVisible:function(a,b){var c=this,d=c.series,e=d.chart,f=d.options.ignoreHiddenPoint,b=cb(b,f);a!==c.visible&&(c.visible=c.options.visible=a=a===K?!c.visible:a,d.options.data[Qa(c,d.data)]=c.options,Ra(["graphic","dataLabel","connector","shadowGroup"],function(b){c[b]&&c[b][a?"show":"hide"](!0)}),c.legendItem&&e.legend.colorizeItem(c,a),!a&&"hover"===c.state&&c.setState(""),f&&(d.isDirty=!0),b&&e.redraw())},slice:function(a,b,c){var d=this.series;A(c,d.chart),cb(b,!0),this.sliced=this.options.sliced=a=i(a)?a:!this.sliced,d.options.data[Qa(this,d.data)]=this.options,a=a?this.slicedTranslation:{translateX:0,translateY:0},this.graphic.animate(a),this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,directTouch:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},animate:function(a){var b=this,c=b.points,d=b.startAngleRad;a||(Ra(c,function(a){var c=a.graphic,e=a.shapeArgs;c&&(c.attr({r:a.startR||b.center[3]/2,start:d,end:d}),c.animate({r:e.r,start:e.start,end:e.end},b.options.animation))}),b.animate=null)},updateTotals:function(){var a,b,c=0,d=this.points,e=d.length,f=this.options.ignoreHiddenPoint;for(a=0;a<e;a++)b=d[a],b.y<0&&(b.y=null),c+=f&&!b.visible?0:b.y;for(this.total=c,a=0;a<e;a++)b=d[a],b.percentage=c>0&&(b.visible||!f)?b.y/c*100:0,b.total=c},generatePoints:function(){wb.prototype.generatePoints.call(this),this.updateTotals()},translate:function(a){this.generatePoints();var b,c,d,e,f,g=0,h=this.options,i=h.slicedOffset,j=i+h.borderWidth,k=h.startAngle||0,l=this.startAngleRad=ra/180*(k-90),k=(this.endAngleRad=ra/180*(cb(h.endAngle,k+360)-90))-l,m=this.points,n=h.dataLabels.distance,h=h.ignoreHiddenPoint,o=m.length;for(a||(this.center=a=this.getCenter()),this.getX=function(b,c){return d=ia.asin(na((b-a[1])/(a[2]/2+n),1)),a[0]+(c?-1:1)*pa(d)*(a[2]/2+n)},e=0;e<o;e++)f=m[e],b=l+g*k,h&&!f.visible||(g+=f.percentage/100),c=l+g*k,f.shapeType="arc",f.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:ja(1e3*b)/1e3,end:ja(1e3*c)/1e3},d=(c+b)/2,d>1.5*ra?d-=2*ra:d<-ra/2&&(d+=2*ra),f.slicedTranslation={translateX:ja(pa(d)*i),translateY:ja(qa(d)*i)},b=pa(d)*a[2]/2,c=qa(d)*a[2]/2,f.tooltipPos=[a[0]+.7*b,a[1]+.7*c],f.half=d<-ra/2||d>ra/2?1:0,f.angle=d,j=na(j,n/2),f.labelPos=[a[0]+b+pa(d)*n,a[1]+c+qa(d)*n,a[0]+b+pa(d)*j,a[1]+c+qa(d)*j,a[0]+b,a[1]+c,n<0?"center":f.half?"right":"left",d]},drawGraph:null,drawPoints:function(){var a,b,c,d,e,f,g=this,h=g.chart.renderer,i=g.options.shadow;i&&!g.shadowGroup&&(g.shadowGroup=h.g("shadow").add(g.group)),Ra(g.points,function(j){null!==j.y&&(b=j.graphic,e=j.shapeArgs,c=j.shadowGroup,d=j.pointAttr[j.selected?"select":""],d.stroke||(d.stroke=d.fill),i&&!c&&(c=j.shadowGroup=h.g("shadow").add(g.shadowGroup)),a=j.sliced?j.slicedTranslation:{translateX:0,translateY:0},c&&c.attr(a),b?b.setRadialReference(g.center).attr(d).animate(_a(e,a)):(f={"stroke-linejoin":"round"},j.visible||(f.visibility="hidden"),j.graphic=b=h[j.shapeType](e).setRadialReference(g.center).attr(d).attr(f).attr(a).add(g.group).shadow(i,c)))})},searchPoint:Ga,sortByAngle:function(a,b){a.sort(function(a,c){return void 0!==a.angle&&(c.angle-a.angle)*b})},drawLegendSymbol:ib.drawRectangle,getCenter:ub.getCenter,getSymbol:Ga},fb=o(wb,fb),Oa.pie=fb,wb.prototype.drawDataLabels=function(){var a,b,c,e,f=this,g=f.options,h=g.cursor,j=g.dataLabels,k=f.points,l=f.hasRendered||0,m=cb(j.defer,!0),n=f.chart.renderer;(j.enabled||f._hasPointLabels)&&(f.dlProcessOptions&&f.dlProcessOptions(j),e=f.plotGroup("dataLabelsGroup","data-labels",m&&!l?"hidden":"visible",j.zIndex||6),m&&(e.attr({opacity:+l}),l||Va(f,"afterAnimate",function(){f.visible&&e.show(!0),e[g.animation?"animate":"attr"]({opacity:1},{duration:200})})),b=j,Ra(k,function(k){var l,m,o,p,q=k.dataLabel,s=k.connector,t=!0,u={};if(a=k.dlOptions||k.options&&k.options.dataLabels,l=cb(a&&a.enabled,b.enabled)&&null!==k.y,q&&!l)k.dataLabel=q.destroy();else if(l){if(j=d(b,a),p=j.style,l=j.rotation,m=k.getLabelConfig(),c=j.format?r(j.format,m):j.formatter.call(m,j),p.color=cb(j.color,p.color,f.color,"black"),q)i(c)?(q.attr({text:c}),t=!1):(k.dataLabel=q=q.destroy(),s&&(k.connector=s.destroy()));else if(i(c)){q={fill:j.backgroundColor,stroke:j.borderColor,"stroke-width":j.borderWidth,r:j.borderRadius||0,rotation:l,padding:j.padding,zIndex:1},"contrast"===p.color&&(u.color=j.inside||j.distance<0||g.stacking?n.getContrast(k.color||f.color):"#000000"),h&&(u.cursor=h);for(o in q)q[o]===K&&delete q[o];q=k.dataLabel=n[l?"text":"label"](c,0,-9999,j.shape,null,null,j.useHTML).attr(q).css(_a(p,u)).add(e).shadow(j.shadow)}q&&f.alignDataLabel(k,q,j,null,t)}}))},wb.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=cb(a.plotX,-9999),i=cb(a.plotY,-9999),j=b.getBBox(),k=f.renderer.fontMetrics(c.style.fontSize).b,l=c.rotation,m=c.align,n=this.visible&&(a.series.forceDL||f.isInsidePlot(h,ja(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g)),o="justify"===cb(c.overflow,"justify");n&&(d=_a({x:g?f.plotWidth-i:h,y:ja(g?f.plotHeight-h:i),width:0,height:0},d),_a(c,{width:j.width,height:j.height}),l?(o=!1,g=f.renderer.rotCorr(k,l),g={x:d.x+c.x+d.width/2+g.x,y:d.y+c.y+{top:0,middle:.5,bottom:1}[c.verticalAlign]*d.height},b[e?"attr":"animate"](g).attr({align:m}),h=(l+720)%360,h=h>180&&h<360,"left"===m?g.y-=h?j.height:0:"center"===m?(g.x-=j.width/2,g.y-=j.height/2):"right"===m&&(g.x-=j.width,g.y-=h?0:j.height)):(b.align(c,null,d),g=b.alignAttr),o?this.justifyDataLabel(b,c,g,j,d,e):cb(c.crop,!0)&&(n=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+j.width,g.y+j.height)),c.shape&&!l&&b.attr({anchorX:a.plotX,anchorY:a.plotY})),n||(Za(b),b.attr({y:-9999}),b.placed=!1)},wb.prototype.justifyDataLabel=function(a,b,c,d,e,f){var g,h,i=this.chart,j=b.align,k=b.verticalAlign,l=a.box?0:a.padding||0;g=c.x+l,g<0&&("right"===j?b.align="left":b.x=-g,h=!0),g=c.x+d.width-l,g>i.plotWidth&&("left"===j?b.align="right":b.x=i.plotWidth-g,h=!0),g=c.y+l,g<0&&("bottom"===k?b.verticalAlign="top":b.y=-g,h=!0),g=c.y+d.height-l,g>i.plotHeight&&("top"===k?b.verticalAlign="bottom":b.y=i.plotHeight-g,h=!0),h&&(a.placed=!f,a.align(b,null,e))},Oa.pie&&(Oa.pie.prototype.drawDataLabels=function(){var a,b,c,d,e,f,g,h,i,j,k,l=this,m=l.data,n=l.chart,o=l.options.dataLabels,p=cb(o.connectorPadding,10),q=cb(o.connectorWidth,1),r=n.plotWidth,s=n.plotHeight,t=cb(o.softConnector,!0),u=o.distance,v=l.center,x=v[2]/2,y=v[1],z=u>0,A=[[],[]],B=[0,0,0,0],C=function(a,b){return b.y-a.y};if(l.visible&&(o.enabled||l._hasPointLabels)){for(wb.prototype.drawDataLabels.apply(l),Ra(m,function(a){a.dataLabel&&a.visible&&(A[a.half].push(a),a.dataLabel._pos=null)}),j=2;j--;){var D,E=[],F=[],G=A[j],H=G.length;if(H){for(l.sortByAngle(G,j-.5),k=m=0;!m&&G[k];)m=G[k]&&G[k].dataLabel&&(G[k].dataLabel.getBBox().height||21),k++;if(u>0){for(e=na(y+x+u,n.plotHeight),k=ma(0,y-x-u);k<=e;k+=m)E.push(k);if(e=E.length,H>e){for(a=[].concat(G),a.sort(C),k=H;k--;)a[k].rank=k;for(k=H;k--;)G[k].rank>=e&&G.splice(k,1);H=G.length}for(k=0;k<H;k++){a=G[k],f=a.labelPos,a=9999;var I,J;for(J=0;J<e;J++)I=oa(E[J]-f[1]),I<a&&(a=I,D=J);if(D<k&&null!==E[k])D=k;else for(e<H-k+D&&null!==E[k]&&(D=e-H+k);null===E[D];)D++;F.push({i:D,y:E[D]}),E[D]=null}F.sort(C)}for(k=0;k<H;k++)a=G[k],f=a.labelPos,d=a.dataLabel,i=a.visible===!1?"hidden":"inherit",a=f[1],u>0?(e=F.pop(),D=e.i,h=e.y,(a>h&&null!==E[D+1]||a<h&&null!==E[D-1])&&(h=na(ma(0,a),n.plotHeight))):h=a,g=o.justify?v[0]+(j?-1:1)*(x+u):l.getX(h===y-x-u||h===y+x+u?a:h,j),d._attr={visibility:i,align:f[6]},d._pos={x:g+o.x+({left:p,right:-p}[f[6]]||0),y:h+o.y-10},d.connX=g,d.connY=h,null===this.options.size&&(e=d.width,g-e<p?B[3]=ma(ja(e-g+p),B[3]):g+e>r-p&&(B[1]=ma(ja(g+e-r+p),B[1])),h-m/2<0?B[0]=ma(ja(-h+m/2),B[0]):h+m/2>s&&(B[2]=ma(ja(h+m/2-s),B[2])))}}(0===w(B)||this.verifyDataLabelOverflow(B))&&(this.placeDataLabels(),z&&q&&Ra(this.points,function(a){b=a.connector,f=a.labelPos,(d=a.dataLabel)&&d._pos&&a.visible?(i=d._attr.visibility,g=d.connX,h=d.connY,c=t?[Ka,g+("left"===f[6]?5:-5),h,"C",g,h,2*f[2]-f[4],2*f[3]-f[5],f[2],f[3],La,f[4],f[5]]:[Ka,g+("left"===f[6]?5:-5),h,La,f[2],f[3],La,f[4],f[5]],b?(b.animate({d:c}),b.attr("visibility",i)):a.connector=b=l.chart.renderer.path(c).attr({"stroke-width":q,stroke:o.connectorColor||a.color||"#606060",visibility:i}).add(l.dataLabelsGroup)):b&&(a.connector=b.destroy())}))}},Oa.pie.prototype.placeDataLabels=function(){Ra(this.points,function(a){var b=a.dataLabel;b&&a.visible&&((a=b._pos)?(b.attr(b._attr),b[b.moved?"animate":"attr"](a),b.moved=!0):b&&b.attr({y:-9999}))})},Oa.pie.prototype.alignDataLabel=Ga,Oa.pie.prototype.verifyDataLabelOverflow=function(a){var b,c=this.center,d=this.options,e=d.center,f=d.minSize||80,g=f;return null!==e[0]?g=ma(c[2]-ma(a[1],a[3]),f):(g=ma(c[2]-a[1]-a[3],f),c[0]+=(a[3]-a[1])/2),null!==e[1]?g=ma(na(g,c[2]-ma(a[0],a[2])),f):(g=ma(na(g,c[2]-a[0]-a[2]),f),c[1]+=(a[0]-a[2])/2),g<c[2]?(c[2]=g,c[3]=Math.min(/%$/.test(d.innerSize||0)?g*parseFloat(d.innerSize||0)/100:parseFloat(d.innerSize||0),g),this.translate(c),this.drawDataLabels&&this.drawDataLabels()):b=!0,b}),Oa.column&&(Oa.column.prototype.alignDataLabel=function(a,b,c,e,f){var g=this.chart.inverted,h=a.series,i=a.dlBox||a.shapeArgs,j=cb(a.below,a.plotY>cb(this.translatedThreshold,h.yAxis.len)),k=cb(c.inside,!!this.options.stacking);i&&(e=d(i),e.y<0&&(e.height+=e.y,e.y=0),i=e.y+e.height-h.yAxis.len,i>0&&(e.height-=i),g&&(e={x:h.yAxis.len-e.y-e.height,y:h.xAxis.len-e.x-e.width,width:e.height,height:e.width}),k||(g?(e.x+=j?0:e.width,e.width=0):(e.y+=j?e.height:0,e.height=0))),c.align=cb(c.align,!g||k?"center":j?"right":"left"),c.verticalAlign=cb(c.verticalAlign,g||k?"middle":j?"top":"bottom"),wb.prototype.alignDataLabel.call(this,a,b,c,e,f)}),function(a){var b=a.Chart,c=a.each,d=a.pick,e=a.addEvent;b.prototype.callbacks.push(function(a){function b(){var b=[];c(a.series,function(a){var e=a.options.dataLabels,f=a.dataLabelCollections||["dataLabel"];(e.enabled||a._hasPointLabels)&&!e.allowOverlap&&a.visible&&c(f,function(e){c(a.points,function(a){a[e]&&(a[e].labelrank=d(a.labelrank,a.shapeArgs&&a.shapeArgs.height),b.push(a[e]))})})}),a.hideOverlappingLabels(b)}b(),e(a,"redraw",b)}),b.prototype.hideOverlappingLabels=function(a){var b,d,e,f,g,h,i,j,k,l=a.length;for(d=0;d<l;d++)(b=a[d])&&(b.oldOpacity=b.opacity,b.newOpacity=1);for(a.sort(function(a,b){return(b.labelrank||0)-(a.labelrank||0)}),d=0;d<l;d++)for(e=a[d],b=d+1;b<l;++b)f=a[b],e&&f&&e.placed&&f.placed&&0!==e.newOpacity&&0!==f.newOpacity&&(g=e.alignAttr,h=f.alignAttr,i=e.parentGroup,j=f.parentGroup,k=2*(e.box?0:e.padding),g=!(h.x+j.translateX>g.x+i.translateX+(e.width-k)||h.x+j.translateX+(f.width-k)<g.x+i.translateX||h.y+j.translateY>g.y+i.translateY+(e.height-k)||h.y+j.translateY+(f.height-k)<g.y+i.translateY))&&((e.labelrank<f.labelrank?e:f).newOpacity=0);c(a,function(a){var b,c;a&&(c=a.newOpacity,a.oldOpacity!==c&&a.placed&&(c?a.show(!0):b=function(){a.hide()},a.alignAttr.opacity=c,a[a.isOld?"animate":"attr"](a.alignAttr,null,b)),a.isOld=!0)})}}(ga);var zb=ga.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(a){for(var c,d=a.target;d&&!c;)c=d.point,d=d.parentNode;c!==K&&c!==b.hoverPoint&&c.onMouseOver(a)};Ra(a.points,function(a){a.graphic&&(a.graphic.element.point=a),a.dataLabel&&(a.dataLabel.element.point=a)}),a._hasTracking||(Ra(a.trackerGroups,function(b){a[b]&&(a[b].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",function(a){c.onTrackerMouseOut(a)}).css(e),M)&&a[b].on("touchstart",f)}),a._hasTracking=!0)},drawTrackerGraph:function(){var a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:a.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,j=a.tracker,k=b.cursor,l=k&&{cursor:k},m=function(){f.hoverSeries!==a&&a.onMouseOver()},n="rgba(192,192,192,"+(Ba?1e-4:.002)+")";if(e&&!c)for(k=e+1;k--;)d[k]===Ka&&d.splice(k+1,0,d[k+1]-i,d[k+2],La),(k&&d[k]===Ka||k===e)&&d.splice(k,0,La,d[k-2]+i,d[k-1]);j?j.attr({d:d}):(a.tracker=h.path(d).attr({"stroke-linejoin":"round",visibility:a.visible?"visible":"hidden",stroke:n,fill:c?n:"none","stroke-width":b.lineWidth+(c?0:2*i),zIndex:2}).add(a.group),Ra([a.tracker,a.markerGroup],function(a){a.addClass("highcharts-tracker").on("mouseover",m).on("mouseout",function(a){g.onTrackerMouseOut(a)}).css(l),M&&a.on("touchstart",m)}))}};Oa.column&&(xb.prototype.drawTracker=zb.drawTrackerPoint),Oa.pie&&(Oa.pie.prototype.drawTracker=zb.drawTrackerPoint),Oa.scatter&&(yb.prototype.drawTracker=zb.drawTrackerPoint),_a(sb.prototype,{setItemEvents:function(a,b,c,d,e){var f=this;(c?b:a.legendGroup).on("mouseover",function(){a.setState("hover"),b.css(f.options.itemHoverStyle)}).on("mouseout",function(){b.css(a.visible?d:e),a.setState()}).on("click",function(b){var c=function(){a.setVisible&&a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):Xa(a,"legendItemClick",b,c)})},createCheckboxForItem:function(a){a.checkbox=n("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container),Va(a.checkbox,"click",function(b){Xa(a.series||a,"checkboxClick",{checked:b.target.checked,item:a},function(){a.select()})})}}),O.legend.itemStyle.cursor="pointer",_a(tb.prototype,{showResetZoom:function(){var a=this,b=O.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,f="chart"===c.relativeTo?null:"plotBox";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=this;Xa(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c,d=this.pointer,e=!1;!a||a.resetSelection?Ra(this.axes,function(a){b=a.zoom()}):Ra(a.xAxis.concat(a.yAxis),function(a){var c=a.axis,f=c.isXAxis;(d[f?"zoomX":"zoomY"]||d[f?"pinchX":"pinchY"])&&(b=c.zoom(a.min,a.max),c.displayBtn&&(e=!0))}),c=this.resetZoomButton,e&&!c?this.showResetZoom():!e&&ab(c)&&(this.resetZoomButton=c.destroy()),b&&this.redraw(cb(this.options.chart.animation,a&&a.animation,this.pointCount<100))},pan:function(a,b){var c,d=this,e=d.hoverPoints;e&&Ra(e,function(a){a.setState()}),Ra("xy"===b?[1,0]:[1],function(b){var b=d[b?"xAxis":"yAxis"][0],e=b.horiz,f=a[e?"chartX":"chartY"],e=e?"mouseDownX":"mouseDownY",g=d[e],h=(b.pointRange||0)/2,i=b.getExtremes(),j=b.toValue(g-f,!0)+h,h=b.toValue(g+b.len-f,!0)-h,g=g>f;b.series.length&&(g||j>na(i.dataMin,i.min))&&(!g||h<ma(i.dataMax,i.max))&&(b.setExtremes(j,h,!1,!1,{trigger:"pan"}),c=!0),d[e]=f}),c&&d.redraw(!1),m(d.container,{cursor:"move"})}}),_a(vb.prototype,{select:function(a,b){var c=this,d=c.series,e=d.chart,a=cb(a,!c.selected);c.firePointEvent(a?"select":"unselect",{accumulate:b},function(){c.selected=c.options.selected=a,d.options.data[Qa(c,d.data)]=c.options,c.setState(a&&"select"),b||Ra(e.getSelectedPoints(),function(a){a.selected&&a!==c&&(a.selected=a.options.selected=!1,d.options.data[Qa(a,d.data)]=a.options,a.setState(""),a.firePointEvent("unselect"))})})},onMouseOver:function(a,b){var c=this.series,d=c.chart,e=d.tooltip,f=d.hoverPoint;d.hoverSeries!==c&&c.onMouseOver(),f&&f!==this&&f.onMouseOut(),this.series&&(this.firePointEvent("mouseOver"),e&&(!e.shared||c.noSharedTooltip)&&e.refresh(this,a),this.setState("hover"),!b)&&(d.hoverPoint=this)},onMouseOut:function(){var a=this.series.chart,b=a.hoverPoints;this.firePointEvent("mouseOut"),b&&Qa(this,b)!==-1||(this.setState(),a.hoverPoint=null)},importEvents:function(){if(!this.hasImportedEvents){var a,b=d(this.series.options.point,this.options).events;this.events=b;for(a in b)Va(this,a,b[a]);this.hasImportedEvents=!0}},setState:function(a,b){var c,e=ka(this.plotX),f=this.plotY,g=this.series,h=g.options.states,i=eb[g.type].marker&&g.options.marker,j=i&&!i.enabled,k=i&&i.states[a],l=k&&k.enabled===!1,m=g.stateMarkerGraphic,n=this.marker||{},o=g.chart,p=g.halo,a=a||"";c=this.pointAttr[a]||g.pointAttr[a],a===this.state&&!b||this.selected&&"select"!==a||h[a]&&h[a].enabled===!1||a&&(l||j&&k.enabled===!1)||a&&n.states&&n.states[a]&&n.states[a].enabled===!1||(this.graphic?(i=i&&this.graphic.symbolName&&c.r,this.graphic.attr(d(c,i?{x:e-i,y:f-i,width:2*i,height:2*i}:{})),m&&m.hide()):(a&&k&&(i=k.radius,n=n.symbol||g.symbol,m&&m.currentSymbol!==n&&(m=m.destroy()),m?m[b?"animate":"attr"]({x:e-i,y:f-i}):n&&(g.stateMarkerGraphic=m=o.renderer.symbol(n,e-i,f-i,2*i,2*i).attr(c).add(g.markerGroup),m.currentSymbol=n)),m&&(m[a&&o.isInsidePlot(e,f,o.inverted)?"show":"hide"](),m.element.point=this)),(e=h[a]&&h[a].halo)&&e.size?(p||(g.halo=p=o.renderer.path().add(o.seriesGroup)),p.attr(_a({fill:this.color||g.color,"fill-opacity":e.opacity,zIndex:-1},e.attributes))[b?"animate":"attr"]({d:this.haloPath(e.size)})):p&&p.attr({d:[]}),this.state=a)},haloPath:function(a){var b=this.series,c=b.chart,d=b.getPlotBox(),e=c.inverted,f=Math.floor(this.plotX);return c.renderer.symbols.circle(d.translateX+(e?b.yAxis.len-this.plotY:f)-a,d.translateY+(e?b.xAxis.len-f:this.plotY)-a,2*a,2*a)}}),_a(wb.prototype,{onMouseOver:function(){var a=this.chart,b=a.hoverSeries;b&&b!==this&&b.onMouseOut(),this.options.events.mouseOver&&Xa(this,"mouseOver"),this.setState("hover"),a.hoverSeries=this},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;b.hoverSeries=null,d&&d.onMouseOut(),this&&a.events.mouseOut&&Xa(this,"mouseOut"),c&&!a.stickyTracking&&(!c.shared||this.noSharedTooltip)&&c.hide(),this.setState()},setState:function(a){var b=this.options,c=this.graph,d=b.states,e=b.lineWidth,b=0,a=a||"";if(this.state!==a&&(this.state=a,!(d[a]&&d[a].enabled===!1)&&(a&&(e=d[a].lineWidth||e+(d[a].lineWidthPlus||0)),c&&!c.dashstyle)))for(a={"stroke-width":e},c.attr(a);this["zoneGraph"+b];)this["zoneGraph"+b].attr(a),b+=1},setVisible:function(a,b){var c,d=this,e=d.chart,f=d.legendItem,g=e.options.chart.ignoreHiddenSeries,h=d.visible;c=(d.visible=a=d.userOptions.visible=a===K?!h:a)?"show":"hide",Ra(["group","dataLabelsGroup","markerGroup","tracker"],function(a){d[a]&&d[a][c]()}),e.hoverSeries!==d&&(e.hoverPoint&&e.hoverPoint.series)!==d||d.onMouseOut(),f&&e.legend.colorizeItem(d,a),d.isDirty=!0,d.options.stacking&&Ra(e.series,function(a){a.options.stacking&&a.visible&&(a.isDirty=!0)}),Ra(d.linkedSeries,function(b){b.setVisible(a,!1)}),g&&(e.isDirtyBox=!0),b!==!1&&e.redraw(),Xa(d,c)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===K?!this.selected:a,this.checkbox&&(this.checkbox.checked=a),Xa(this,a?"select":"unselect")},drawTracker:zb.drawTrackerGraph}),db(wb.prototype,"init",function(a){var b;a.apply(this,Array.prototype.slice.call(arguments,1)),(b=this.xAxis)&&b.options.ordinal&&Va(this,"updatedData",function(){delete b.ordinalIndex})}),db(kb.prototype,"getTimeTicks",function(a,b,c,d,e,f,g,h){var j,k,l,m,n,o=0,p={},q=[],r=-Number.MAX_VALUE,s=this.options.tickPixelInterval;if(!this.options.ordinal&&!this.options.breaks||!f||f.length<3||c===K)return a.call(this,b,c,d,e);for(m=f.length,j=0;j<m;j++){if(n=j&&f[j-1]>d,f[j]<c&&(o=j),j===m-1||f[j+1]-f[j]>5*g||n){if(f[j]>r){for(k=a.call(this,b,f[o],f[j],e);k.length&&k[0]<=r;)k.shift();k.length&&(r=k[k.length-1]),q=q.concat(k)}o=j+1}if(n)break}if(a=k.info,h&&a.unitRange<=Q.hour){for(j=q.length-1,o=1;o<j;o++)P("%d",q[o])!==P("%d",q[o-1])&&(p[q[o]]="day",l=!0);l&&(p[q[0]]="day"),a.higherRanks=p}if(q.info=a,h&&i(s)){h=a=q.length,j=[];var t;for(l=[];h--;)o=this.translate(q[h]),t&&(l[h]=t-o),j[h]=t=o;for(l.sort(),l=l[ka(l.length/2)],l<.6*s&&(l=null),h=q[a-1]>d?a-1:a,t=void 0;h--;)o=j[h],d=t-o,t&&d<.8*s&&(null===l||d<.8*l)?(p[q[h]]&&!p[q[h+1]]?(d=h+1,t=o):d=h,q.splice(d,1)):t=o}return q}),_a(kb.prototype,{beforeSetTickPositions:function(){var a,b,c,d=[],e=!1,f=this.getExtremes(),g=f.min,h=f.max,i=this.isXAxis&&!!this.options.breaks;if((f=this.options.ordinal)||i){if(Ra(this.series,function(b,c){if(b.visible!==!1&&(b.takeOrdinalPosition!==!1||i)&&(d=d.concat(b.processedXData),a=d.length,d.sort(function(a,b){return a-b}),a))for(c=a-1;c--;)d[c]===d[c+1]&&d.splice(c,1)}),a=d.length,a>2){for(b=d[1]-d[0],c=a-1;c--&&!e;)d[c+1]-d[c]!==b&&(e=!0);!this.options.keepOrdinalPadding&&(d[0]-g>b||h-d[d.length-1]>b)&&(e=!0)}e?(this.ordinalPositions=d,b=this.val2lin(ma(g,d[0]),!0),c=ma(this.val2lin(na(h,d[d.length-1]),!0),1),this.ordinalSlope=h=(h-g)/(c-b),this.ordinalOffset=g-b*h):this.ordinalPositions=this.ordinalSlope=this.ordinalOffset=K}this.isOrdinal=f&&e,this.groupIntervalFactor=null},val2lin:function(a,b){var c,d=this.ordinalPositions;if(d){var e,f=d.length;for(c=f;c--;)if(d[c]===a){e=c;break}for(c=f-1;c--;)if(a>d[c]||0===c){d=(a-d[c])/(d[c+1]-d[c]),e=c+d;break}c=b?e:this.ordinalSlope*(e||0)+this.ordinalOffset}else c=a;return c},lin2val:function(a,b){var c=this.ordinalPositions;if(c){var d,e,f=this.ordinalSlope,g=this.ordinalOffset,h=c.length-1;if(b)a<0?a=c[0]:a>h?a=c[h]:(h=ka(a),e=a-h);else for(;h--;)if(d=f*h+g,a>=d){f=f*(h+1)+g,e=(a-d)/(f-d);break}c=e!==K&&c[h]!==K?c[h]+(e?e*(c[h+1]-c[h]):0):a}else c=a;return c},getExtendedPositions:function(){var a,b,c=this.chart,d=this.series[0].currentDataGrouping,e=this.ordinalIndex,f=d?d.count+d.unitName:"raw",g=this.getExtremes();return e||(e=this.ordinalIndex={}),e[f]||(a={series:[],getExtremes:function(){return{min:g.dataMin,max:g.dataMax}},options:{ordinal:!0},val2lin:kb.prototype.val2lin},Ra(this.series,function(e){b={xAxis:a,xData:e.xData,chart:c,destroyGroupedData:Ga},b.options={dataGrouping:d?{enabled:!0,forced:!0,approximation:"open",units:[[d.unitName,[d.count]]]}:{enabled:!1}},e.processData.apply(b),a.series.push(b)}),this.beforeSetTickPositions.apply(a),e[f]=a.ordinalPositions),e[f]},getGroupIntervalFactor:function(a,b,c){var d,c=c.processedXData,e=c.length,f=[];if(d=this.groupIntervalFactor,!d){for(d=0;d<e-1;d++)f[d]=c[d+1]-c[d];f.sort(function(a,b){return a-b}),f=f[ka(e/2)],a=ma(a,c[0]),b=na(b,c[e-1]),this.groupIntervalFactor=d=e*f/(b-a)}return d},postProcessTickInterval:function(a){var b=this.ordinalSlope;return b?this.options.breaks?this.closestPointRange:a/(b/this.closestPointRange):a}}),db(tb.prototype,"pan",function(a,b){var c=this.xAxis[0],d=b.chartX,e=!1;if(c.options.ordinal&&c.series.length){var f,g=this.mouseDownX,h=c.getExtremes(),i=h.dataMax,j=h.min,k=h.max,l=this.hoverPoints,n=c.closestPointRange,g=(g-d)/(c.translationSlope*(c.ordinalSlope||n)),o={ordinalPositions:c.getExtendedPositions()},n=c.lin2val,p=c.val2lin;o.ordinalPositions?oa(g)>1&&(l&&Ra(l,function(a){a.setState()}),g<0?(l=o,f=c.ordinalPositions?c:o):(l=c.ordinalPositions?c:o,f=o),o=f.ordinalPositions,i>o[o.length-1]&&o.push(i),this.fixedRange=k-j,g=c.toFixedRange(null,null,n.apply(l,[p.apply(l,[j,!0])+g,!0]),n.apply(f,[p.apply(f,[k,!0])+g,!0])),g.min>=na(h.dataMin,j)&&g.max<=ma(i,k)&&c.setExtremes(g.min,g.max,!0,!1,{trigger:"pan"}),this.mouseDownX=d,m(this.container,{cursor:"move"})):e=!0}else e=!0;e&&a.apply(this,Array.prototype.slice.call(arguments,1))}),wb.prototype.gappedPath=function(){var a=this.options.gapSize,b=this.points.slice(),c=b.length-1;if(a&&c>0)for(;c--;)b[c+1].x-b[c].x>this.closestPointRange*a&&b.splice(c+1,0,{isNull:!0});return this.getGraphPath(b)},function(a){a(ga)}(function(a){function b(){return Array.prototype.slice.call(arguments,1)}function c(a){a.apply(this),this.drawBreaks(this.xAxis,["x"]),this.drawBreaks(this.yAxis,d(this.pointArrayMap,["y"]))}var d=a.pick,e=a.wrap,f=a.each,g=a.extend,h=a.fireEvent,i=a.Axis,j=a.Series;g(i.prototype,{isInBreak:function(a,b){var c=a.repeat||1/0,d=a.from,e=a.to-a.from,c=b>=d?(b-d)%c:c-(d-b)%c;return a.inclusive?c<=e:c<e&&0!==c},isInAnyBreak:function(a,b){var c,e,f,g=this.options.breaks,h=g&&g.length;if(h){for(;h--;)this.isInBreak(g[h],a)&&(c=!0,e||(e=d(g[h].showPoints,!this.isXAxis)));f=c&&b?c&&!e:c}return f}}),e(i.prototype,"setTickPositions",function(a){if(a.apply(this,Array.prototype.slice.call(arguments,1)),this.options.breaks){var b,c=this.tickPositions,d=this.tickPositions.info,e=[];for(b=0;b<c.length;b++)this.isInAnyBreak(c[b])||e.push(c[b]);this.tickPositions=e,this.tickPositions.info=d}}),e(i.prototype,"init",function(a,b,c){if(c.breaks&&c.breaks.length&&(c.ordinal=!1),a.call(this,b,c),this.options.breaks){var d=this;d.isBroken=!0,this.val2lin=function(a){var b,c,e=a;for(c=0;c<d.breakArray.length;c++)if(b=d.breakArray[c],b.to<=a)e-=b.len;else{if(b.from>=a)break;if(d.isInBreak(b,a)){e-=a-b.from;break}}return e},this.lin2val=function(a){var b,c;for(c=0;c<d.breakArray.length&&(b=d.breakArray[c],!(b.from>=a));c++)b.to<a?a+=b.len:d.isInBreak(b,a)&&(a+=b.len);return a},this.setExtremes=function(a,b,c,d,e){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(b);)b-=this.closestPointRange;i.prototype.setExtremes.call(this,a,b,c,d,e);
13
  },this.setAxisTranslation=function(a){i.prototype.setAxisTranslation.call(this,a);var b,c,e,f,g=d.options.breaks,a=[],j=[],k=0,l=d.userMin||d.min,m=d.userMax||d.max;for(f in g)c=g[f],b=c.repeat||1/0,d.isInBreak(c,l)&&(l+=c.to%b-l%b),d.isInBreak(c,m)&&(m-=m%b-c.from%b);for(f in g){for(c=g[f],e=c.from,b=c.repeat||1/0;e-b>l;)e-=b;for(;e<l;)e+=b;for(;e<m;e+=b)a.push({value:e,move:"in"}),a.push({value:e+(c.to-c.from),move:"out",size:c.breakSize})}a.sort(function(a,b){return a.value===b.value?("in"===a.move?0:1)-("in"===b.move?0:1):a.value-b.value}),g=0,e=l;for(f in a)c=a[f],g+="in"===c.move?1:-1,1===g&&"in"===c.move&&(e=c.value),0===g&&(j.push({from:e,to:c.value,len:c.value-e-(c.size||0)}),k+=c.value-e-(c.size||0));d.breakArray=j,h(d,"afterBreaks"),d.transA*=(m-d.min)/(m-l-k),d.min=l,d.max=m}}}),e(j.prototype,"generatePoints",function(a){a.apply(this,b(arguments));var c,d,e=this.xAxis,f=this.yAxis,g=this.points,h=g.length,i=this.options.connectNulls;if(e&&f&&(e.options.breaks||f.options.breaks))for(;h--;)c=g[h],d=null===c.y&&i===!1,d||!e.isInAnyBreak(c.x,!0)&&!f.isInAnyBreak(c.y,!0)||(g.splice(h,1),this.data[h]&&this.data[h].destroyElements())}),a.Series.prototype.drawBreaks=function(a,b){var c,e,g,i,j=this,k=j.points;f(b,function(b){c=a.breakArray||[],e=a.isXAxis?a.min:d(j.options.threshold,a.min),f(k,function(j){i=d(j["stack"+b.toUpperCase()],j[b]),f(c,function(b){g=!1,e<b.from&&i>b.to||e>b.from&&i<b.from?g="pointBreak":(e<b.from&&i>b.from&&i<b.to||e>b.from&&i>b.to&&i<b.from)&&(g="pointInBreak"),g&&h(a,g,{point:j,brk:b})})})})},e(a.seriesTypes.column.prototype,"drawPoints",c),e(a.Series.prototype,"drawPoints",c)});var Ab=wb.prototype,Bb=Ab.processData,Cb=Ab.generatePoints,Db=Ab.destroy,Eb={approximation:"average",groupPixelWidth:2,dateTimeLabelFormats:{millisecond:["%A, %b %e, %H:%M:%S.%L","%A, %b %e, %H:%M:%S.%L","-%H:%M:%S.%L"],second:["%A, %b %e, %H:%M:%S","%A, %b %e, %H:%M:%S","-%H:%M:%S"],minute:["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],hour:["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],day:["%A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],week:["Week from %A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],month:["%B %Y","%B","-%B %Y"],year:["%Y","%Y","-%Y"]}},Fb={line:{},spline:{},area:{},areaspline:{},column:{approximation:"sum",groupPixelWidth:10},arearange:{approximation:"range"},areasplinerange:{approximation:"range"},columnrange:{approximation:"range",groupPixelWidth:10},candlestick:{approximation:"ohlc",groupPixelWidth:10},ohlc:{approximation:"ohlc",groupPixelWidth:5}},Gb=[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1]],["week",[1]],["month",[1,3,6]],["year",null]],Hb={sum:function(a){var b,c=a.length;if(!c&&a.hasNulls)b=null;else if(c)for(b=0;c--;)b+=a[c];return b},average:function(a){var b=a.length,a=Hb.sum(a);return bb(a)&&b&&(a/=b),a},open:function(a){return a.length?a[0]:a.hasNulls?null:K},high:function(a){return a.length?w(a):a.hasNulls?null:K},low:function(a){return a.length?v(a):a.hasNulls?null:K},close:function(a){return a.length?a[a.length-1]:a.hasNulls?null:K},ohlc:function(a,b,c,d){if(a=Hb.open(a),b=Hb.high(b),c=Hb.low(c),d=Hb.close(d),bb(a)||bb(b)||bb(c)||bb(d))return[a,b,c,d]},range:function(a,b){if(a=Hb.low(a),b=Hb.high(b),bb(a)||bb(b))return[a,b]}};Ab.groupData=function(a,b,c,d){var e,f,g,h=this.data,i=this.options.data,j=[],k=[],l=[],m=a.length,n=!!b,o=[[],[],[],[]],d="function"==typeof d?d:Hb[d],p=this.pointArrayMap,q=p&&p.length,r=0,s=0;for(g=0;g<=m&&!(a[g]>=c[0]);g++);for(;g<=m;g++){for(;(void 0!==c[r+1]&&a[g]>=c[r+1]||g===m)&&(e=c[r],f=d.apply(0,o),f!==K&&(j.push(e),k.push(f),l.push({start:s,length:o[0].length})),s=g,o[0]=[],o[1]=[],o[2]=[],o[3]=[],r+=1,g!==m););if(g===m)break;if(p){e=this.cropStart+g,e=h&&h[e]||this.pointClass.prototype.applyOptions.apply({series:this},[i[e]]);var t;for(f=0;f<q;f++)t=e[p[f]],bb(t)?o[f].push(t):null===t&&(o[f].hasNulls=!0)}else e=n?b[g]:null,bb(e)?o[0].push(e):null===e&&(o[0].hasNulls=!0)}return[j,k,l]},Ab.processData=function(){var a,b=this.chart,c=this.options.dataGrouping,d=this.allowDG!==!1&&c&&cb(c.enabled,b.options._stock);if(this.forceCrop=d,this.groupPixelWidth=null,this.hasProcessed=!0,Bb.apply(this,arguments)!==!1&&d){this.destroyGroupedData();var e=this.processedXData,f=this.processedYData,g=b.plotSizeX,b=this.xAxis,h=b.options.ordinal,j=this.groupPixelWidth=b.getGroupPixelWidth&&b.getGroupPixelWidth();if(j){a=!0,this.points=null;var k=b.getExtremes(),d=k.min,k=k.max,h=h&&b.getGroupIntervalFactor(d,k,this)||1,g=j*(k-d)/g*h,j=b.getTimeTicks(b.normalizeTimeTickInterval(g,c.units||Gb),Math.min(d,e[0]),Math.max(k,e[e.length-1]),b.options.startOfWeek,e,this.closestPointRange),e=Ab.groupData.apply(this,[e,f,j,c.approximation]),f=e[0],h=e[1];if(c.smoothed){for(c=f.length-1,f[c]=Math.min(f[c],k);c--&&c>0;)f[c]+=g/2;f[0]=Math.max(f[0],d)}this.currentDataGrouping=j.info,this.closestPointRange=j.info.totalRange,this.groupMap=e[2],i(f[0])&&f[0]<b.dataMin&&(b.min===b.dataMin&&(b.min=f[0]),b.dataMin=f[0]),this.processedXData=f,this.processedYData=h}else this.currentDataGrouping=this.groupMap=null;this.hasGroupedData=a}},Ab.destroyGroupedData=function(){var a=this.groupedData;Ra(a||[],function(b,c){b&&(a[c]=b.destroy?b.destroy():null)}),this.groupedData=null},Ab.generatePoints=function(){Cb.apply(this),this.destroyGroupedData(),this.groupedData=this.hasGroupedData?this.points:null},db(lb.prototype,"tooltipFooterHeaderFormatter",function(a,b,c){var d,e=b.series,f=e.tooltipOptions,g=e.options.dataGrouping,h=f.xDateFormat,i=e.xAxis;return i&&"datetime"===i.options.type&&g&&bb(b.key)?(a=e.currentDataGrouping,g=g.dateTimeLabelFormats,a?(i=g[a.unitName],1===a.count?h=i[0]:(h=i[1],d=i[2])):!h&&g&&(h=this.getXDateFormat(b,f,i)),h=P(h,b.key),d&&(h+=P(d,b.key+a.totalRange-1)),r(f[(c?"footer":"header")+"Format"],{point:_a(b.point,{key:h}),series:e})):a.call(this,b,c)}),Ab.destroy=function(){for(var a=this.groupedData||[],b=a.length;b--;)a[b]&&a[b].destroy();Db.apply(this)},db(Ab,"setOptions",function(a,b){var c=a.call(this,b),e=this.type,f=this.chart.options.plotOptions,g=eb[e].dataGrouping;return Fb[e]&&(g||(g=d(Eb,Fb[e])),c.dataGrouping=d(g,f.series&&f.series.dataGrouping,f[e].dataGrouping,b.dataGrouping)),this.chart.options._stock&&(this.requireSorting=!0),c}),db(kb.prototype,"setScale",function(a){a.call(this),Ra(this.series,function(a){a.hasProcessed=!1})}),kb.prototype.getGroupPixelWidth=function(){var a,b,c=this.series,d=c.length,e=0,f=!1;for(a=d;a--;)(b=c[a].options.dataGrouping)&&(e=ma(e,b.groupPixelWidth));for(a=d;a--;)(b=c[a].options.dataGrouping)&&c[a].hasProcessed&&(d=(c[a].processedXData||c[a].data).length,(c[a].groupPixelWidth||d>this.chart.plotSizeX/e||d&&b.forced)&&(f=!0));return f?e:0},kb.prototype.setDataGrouping=function(a,b){var c,b=cb(b,!0);if(a||(a={forced:!1,units:null}),this instanceof kb)for(c=this.series.length;c--;)this.series[c].update({dataGrouping:a},!1);else Ra(this.chart.options.series,function(b){b.dataGrouping=a},!1);b&&this.chart.redraw()},eb.ohlc=d(eb.column,{lineWidth:1,tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>Open: {point.open}<br/>High: {point.high}<br/>Low: {point.low}<br/>Close: {point.close}<br/>'},states:{hover:{lineWidth:3}},threshold:null}),fb=o(Oa.column,{type:"ohlc",pointArrayMap:["open","high","low","close"],toYData:function(a){return[a.open,a.high,a.low,a.close]},pointValKey:"high",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth"},upColorProp:"stroke",getAttribs:function(){Oa.column.prototype.getAttribs.apply(this,arguments);var a=this.options,b=a.states,a=a.upColor||this.color,c=d(this.pointAttr),e=this.upColorProp;c[""][e]=a,c.hover[e]=b.hover.upColor||a,c.select[e]=b.select.upColor||a,Ra(this.points,function(a){a.open<a.close&&!a.options.color&&(a.pointAttr=c)})},translate:function(){var a=this.yAxis;Oa.column.prototype.translate.apply(this),Ra(this.points,function(b){null!==b.open&&(b.plotOpen=a.translate(b.open,0,1,0,1)),null!==b.close&&(b.plotClose=a.translate(b.close,0,1,0,1))})},drawPoints:function(){var a,b,c,d,e,f,g,h,i=this,j=i.chart;Ra(i.points,function(k){k.plotY!==K&&(g=k.graphic,a=k.pointAttr[k.selected?"selected":""]||i.pointAttr[""],d=a["stroke-width"]%2/2,h=ja(k.plotX)-d,e=ja(k.shapeArgs.width/2),f=["M",h,ja(k.yBottom),"L",h,ja(k.plotY)],null!==k.open&&(b=ja(k.plotOpen)+d,f.push("M",h,b,"L",h-e,b)),null!==k.close&&(c=ja(k.plotClose)+d,f.push("M",h,c,"L",h+e,c)),g?g.attr(a).animate({d:f}):k.graphic=j.renderer.path(f).attr(a).add(i.group))})},animate:null}),Oa.ohlc=fb,eb.candlestick=d(eb.column,{lineColor:"black",lineWidth:1,states:{hover:{lineWidth:2}},tooltip:eb.ohlc.tooltip,threshold:null,upColor:"white"}),fb=o(fb,{type:"candlestick",pointAttrToOptions:{fill:"color",stroke:"lineColor","stroke-width":"lineWidth"},upColorProp:"fill",getAttribs:function(){Oa.ohlc.prototype.getAttribs.apply(this,arguments);var a=this.options,b=a.states,c=a.upLineColor||a.lineColor,e=b.hover.upLineColor||c,f=b.select.upLineColor||c;Ra(this.points,function(a){a.open<a.close&&(a.lineColor&&(a.pointAttr=d(a.pointAttr),c=a.lineColor),a.pointAttr[""].stroke=c,a.pointAttr.hover.stroke=e,a.pointAttr.select.stroke=f)})},drawPoints:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=this,n=m.chart,o=m.pointAttr[""];Ra(m.points,function(p){j=p.graphic,p.plotY!==K&&(a=p.pointAttr[p.selected?"selected":""]||o,h=a["stroke-width"]%2/2,i=ja(p.plotX)-h,b=p.plotOpen,c=p.plotClose,d=ia.min(b,c),e=ia.max(b,c),l=ja(p.shapeArgs.width/2),f=ja(d)!==ja(p.plotY),g=e!==p.yBottom,d=ja(d)+h,e=ja(e)+h,k=[],k.push("M",i-l,e,"L",i-l,d,"L",i+l,d,"L",i+l,e,"Z","M",i,d,"L",i,f?ja(p.plotY):d,"M",i,e,"L",i,g?ja(p.yBottom):e),j?j.attr(a).animate({d:k}):p.graphic=n.renderer.path(k).attr(a).add(m.group).shadow(m.options.shadow))})}}),Oa.candlestick=fb;var Ib=gb.prototype.symbols;eb.flags=d(eb.column,{fillColor:"white",lineWidth:1,pointRange:0,shape:"flag",stackDistance:12,states:{hover:{lineColor:"black",fillColor:"#FCFFC5"}},style:{fontSize:"11px",fontWeight:"bold",textAlign:"center"},tooltip:{pointFormat:"{point.text}<br/>"},threshold:null,y:-30}),Oa.flags=o(Oa.column,{type:"flags",sorted:!1,noSharedTooltip:!0,allowDG:!1,takeOrdinalPosition:!1,trackerGroups:["markerGroup"],forceCrop:!0,init:wb.prototype.init,pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth",r:"radius"},translate:function(){Oa.column.prototype.translate.apply(this);var a,b,c=this.options,d=this.chart,e=this.points,f=e.length-1,g=c.onSeries;a=g&&d.get(g);var h,i,j,c=c.onKey||"y",g=a&&a.options.step,k=a&&a.points,l=k&&k.length,m=this.xAxis,n=m.getExtremes();if(a&&a.visible&&l)for(a=a.currentDataGrouping,i=k[l-1].x+(a?a.totalRange:0),e.sort(function(a,b){return a.x-b.x}),c="plot"+c[0].toUpperCase()+c.substr(1);l--&&e[f]&&(a=e[f],h=k[l],!(h.x<=a.x&&void 0!==h[c]&&(a.x<=i&&(a.plotY=h[c],h.x<a.x&&!g&&(j=k[l+1])&&j[c]!==K&&(a.plotY+=(a.x-h.x)/(j.x-h.x)*(j[c]-h[c]))),f--,l++,f<0))););Ra(e,function(a,c){var f;a.plotY===K&&(a.x>=n.min&&a.x<=n.max?a.plotY=d.chartHeight-m.bottom-(m.opposite?m.height:0)+m.offset-d.plotTop:a.shapeArgs={}),(b=e[c-1])&&b.plotX===a.plotX&&(b.stackIndex===K&&(b.stackIndex=0),f=b.stackIndex+1),a.stackIndex=f})},drawPoints:function(){var a,b,c,e,f,g,h,i,j,k,l=this.pointAttr[""],m=this.points,n=this.chart,o=n.renderer,p=this.options,q=p.y,r=this.yAxis;for(f=m.length;f--;)g=m[f],a=g.plotX>this.xAxis.len,b=g.plotX,b>0&&(b-=cb(g.lineWidth,p.lineWidth)%2),h=g.stackIndex,e=g.options.shape||p.shape,c=g.plotY,c!==K&&(c=g.plotY+q-(h!==K&&h*p.stackDistance)),i=h?K:g.plotX,j=h?K:g.plotY,h=g.graphic,c!==K&&b>=0&&!a?(a=g.pointAttr[g.selected?"select":""]||l,k=cb(g.options.title,p.title,"A"),h?h.attr({text:k}).attr({x:b,y:c,r:a.r,anchorX:i,anchorY:j}):g.graphic=o.label(k,b,c,e,i,j,p.useHTML).css(d(p.style,g.style)).attr(a).attr({align:"flag"===e?"left":"center",width:p.width,height:p.height}).add(this.markerGroup).shadow(p.shadow),g.tooltipPos=n.inverted?[r.len+r.pos-n.plotLeft-c,this.xAxis.len-b]:[b,c]):h&&(g.graphic=h.destroy())},drawTracker:function(){var a=this.points;zb.drawTrackerPoint.apply(this),Ra(a,function(b){var c=b.graphic;c&&Va(c.element,"mouseover",function(){b.stackIndex>0&&!b.raised&&(b._y=c.y,c.attr({y:b._y-8}),b.raised=!0),Ra(a,function(a){a!==b&&a.raised&&a.graphic&&(a.graphic.attr({y:a._y}),a.raised=!1)})})})},animate:Ga,buildKDTree:Ga,setClip:Ga}),Ib.flag=function(a,b,c,d,e){return["M",e&&e.anchorX||a,e&&e.anchorY||b,"L",a,b+d,a,b,a+c,b,a+c,b+d,a,b+d,"Z"]},Ra(["circle","square"],function(a){Ib[a+"pin"]=function(b,c,d,e,f){var g=f&&f.anchorX,f=f&&f.anchorY;return"circle"===a&&e>d&&(b-=ja((e-d)/2),d=e),b=Ib[a](b,c,d,e),g&&f&&b.push("M",g,c>f?c:c+e,"L",g,f),b}}),L===ga.VMLRenderer&&Ra(["flag","circlepin","squarepin"],function(a){hb.prototype.symbols[a]=Ib[a]});var Jb={height:za?20:14,barBackgroundColor:"#bfc8d1",barBorderRadius:0,barBorderWidth:1,barBorderColor:"#bfc8d1",buttonArrowColor:"#666",buttonBackgroundColor:"#ebe7e8",buttonBorderColor:"#bbb",buttonBorderRadius:0,buttonBorderWidth:1,margin:10,minWidth:6,rifleColor:"#666",zIndex:3,step:.2,trackBackgroundColor:"#eeeeee",trackBorderColor:"#eeeeee",trackBorderWidth:1,liveRedraw:Ba&&!za};O.scrollbar=d(!0,Jb,O.scrollbar),H.prototype={render:function(){var a,b=this.renderer,c=this.options,d=c.trackBorderWidth,e=c.barBorderWidth,f=this.size;this.group=a=b.g("highcharts-scrollbar").attr({zIndex:c.zIndex,translateY:-99999}).add(),this.track=b.rect().attr({height:f,width:f,y:-d%2/2,x:-d%2/2,"stroke-width":d,fill:c.trackBackgroundColor,stroke:c.trackBorderColor,r:c.trackBorderRadius||0}).add(a),this.scrollbarGroup=b.g().add(a),this.scrollbar=b.rect().attr({height:f,width:f,y:-e%2/2,x:-e%2/2,"stroke-width":e,fill:c.barBackgroundColor,stroke:c.barBorderColor,r:c.barBorderRadius||0}).add(this.scrollbarGroup),this.scrollbarRifles=b.path(this.swapXY([Ka,-3,f/4,La,-3,2*f/3,Ka,0,f/4,La,0,2*f/3,Ka,3,f/4,La,3,2*f/3],c.vertical)).attr({stroke:c.rifleColor,"stroke-width":1}).add(this.scrollbarGroup),this.drawScrollbarButton(0),this.drawScrollbarButton(1)},position:function(a,b,c,d){var e=this.options,f=e.vertical,g=0,h=this.rendered?"animate":"attr";this.x=a,this.y=b+e.trackBorderWidth,this.width=c,this.xOffset=this.height=d,this.yOffset=g,f?(this.width=this.yOffset=c=g=this.size,this.xOffset=b=0,this.barWidth=d-2*c,this.x=a+=this.options.margin):(this.height=this.xOffset=d=b=this.size,this.barWidth=c-2*d,this.y+=this.options.margin),this.group[h]({translateX:a,translateY:this.y}),this.track[h]({width:c,height:d}),this.scrollbarButtons[1].attr({translateX:f?0:c-b,translateY:f?d-g:0})},drawScrollbarButton:function(a){var b,c=this.renderer,d=this.scrollbarButtons,e=this.options,f=this.size;b=c.g().add(this.group),d.push(b),c.rect(-.5,-.5,f+1,f+1,e.buttonBorderRadius,e.buttonBorderWidth).attr({stroke:e.buttonBorderColor,"stroke-width":e.buttonBorderWidth,fill:e.buttonBackgroundColor}).add(b),c.path(this.swapXY(["M",f/2+(a?-1:1),f/2-3,"L",f/2+(a?-1:1),f/2+3,"L",f/2+(a?2:-2),f/2],e.vertical)).attr({fill:e.buttonArrowColor}).add(b)},swapXY:function(a,b){var c,d,e=a.length;if(b)for(c=0;c<e;c+=3)d=a[c+1],a[c+1]=a[c+2],a[c+2]=d;return a},setRange:function(a,b){var c,d,e,f=this.options,g=f.vertical,h=this.rendered&&!this.hasDragged?"animate":"attr";i(this.barWidth)&&(c=this.barWidth*Math.max(a,0),d=this.barWidth*Math.min(b,1),d=Math.max(z(d-c),f.minWidth),c=Math.floor(c+this.xOffset+this.yOffset),e=d/2-.5,this.from=a,this.to=b,g?(this.scrollbarGroup[h]({translateY:c}),this.scrollbar[h]({height:d}),this.scrollbarRifles[h]({translateY:e}),this.scrollbarTop=c,this.scrollbarLeft=0):(this.scrollbarGroup[h]({translateX:c}),this.scrollbar[h]({width:d}),this.scrollbarRifles[h]({translateX:e}),this.scrollbarLeft=c,this.scrollbarTop=0),d<=12?this.scrollbarRifles.hide():this.scrollbarRifles.show(!0),f.showFull===!1&&(a<=0&&b>=1?this.group.hide():this.group.show()),this.rendered=!0)},initEvents:function(){var a=this;a.mouseMoveHandler=function(b){var c=a.chart.pointer.normalize(b),d=a.options.vertical?"chartY":"chartX",e=a.initPositions;!a.grabbedCenter||b.touches&&0===b.touches[0][d]||(c={chartX:(c.chartX-a.x-a.xOffset)/a.barWidth,chartY:(c.chartY-a.y-a.yOffset)/a.barWidth}[d],d=a[d],d=c-d,a.hasDragged=!0,a.updatePosition(e[0]+d,e[1]+d),a.hasDragged&&Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMType:b.type,DOMEvent:b}))},a.mouseUpHandler=function(b){a.hasDragged&&Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMType:b.type,DOMEvent:b}),a.grabbedCenter=a.hasDragged=a.chartX=a.chartY=null},a.mouseDownHandler=function(b){b=a.chart.pointer.normalize(b),a.chartX=(b.chartX-a.x-a.xOffset)/a.barWidth,a.chartY=(b.chartY-a.y-a.yOffset)/a.barWidth,a.initPositions=[a.from,a.to],a.grabbedCenter=!0},a.buttonToMinClick=function(b){var c=z(a.to-a.from)*a.options.step;a.updatePosition(z(a.from-c),z(a.to-c)),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})},a.buttonToMaxClick=function(b){var c=(a.to-a.from)*a.options.step;a.updatePosition(a.from+c,a.to+c),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})},a.trackClick=function(b){var c=a.chart.pointer.normalize(b),d=a.to-a.from,e=a.y+a.scrollbarTop,f=a.x+a.scrollbarLeft;a.options.vertical&&c.chartY>e||!a.options.vertical&&c.chartX>f?a.updatePosition(a.from+d,a.to+d):a.updatePosition(a.from-d,a.to-d),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})}},updatePosition:function(a,b){b>1&&(a=z(1-z(b-a)),b=1),a<0&&(b=z(b-a),a=0),this.from=a,this.to=b},addEvents:function(){var a=this.options.inverted?[1,0]:[0,1],b=this.scrollbarButtons,c=this.scrollbarGroup.element,d=this.mouseDownHandler,e=this.mouseMoveHandler,f=this.mouseUpHandler,a=[[b[a[0]].element,"click",this.buttonToMinClick],[b[a[1]].element,"click",this.buttonToMaxClick],[this.track.element,"click",this.trackClick],[c,"mousedown",d],[ha,"mousemove",e],[ha,"mouseup",f]];M&&a.push([c,"touchstart",d],[ha,"touchmove",e],[ha,"touchend",f]),Ra(a,function(a){Va.apply(null,a)}),this._events=a},removeEvents:function(){Ra(this._events,function(a){Wa.apply(null,a)}),this._events=K},destroy:function(){this.removeEvents(),Ra([this.track,this.scrollbarRifles,this.scrollbar,this.scrollbarGroup,this.group],function(a){a&&a.destroy&&a.destroy()}),x(this.scrollbarButtons)}},db(kb.prototype,"init",function(a){var b=this;a.apply(b,[].slice.call(arguments,1)),b.options.scrollbar&&b.options.scrollbar.enabled&&(b.options.scrollbar.vertical=!b.horiz,b.options.startOnTick=b.options.endOnTick=!1,b.scrollbar=new H(b.chart.renderer,b.options.scrollbar,b.chart),Va(b.scrollbar,"changed",function(a){var c,d=Math.min(cb(b.options.min,b.min),b.min,b.dataMin),e=Math.max(cb(b.options.max,b.max),b.max,b.dataMax)-d;b.horiz&&!b.reversed||!b.horiz&&b.reversed?(c=d+e*this.to,d+=e*this.from):(c=d+e*(1-this.from),d+=e*(1-this.to)),b.setExtremes(d,c,!0,!1,a)}))}),db(kb.prototype,"render",function(a){var b,c=Math.min(cb(this.options.min,this.min),this.min,this.dataMin),d=Math.max(cb(this.options.max,this.max),this.max,this.dataMax),e=this.scrollbar;a.apply(this,[].slice.call(arguments,1)),e&&(this.horiz?e.position(this.left,this.top+this.height+this.offset+2+(this.opposite?0:this.axisTitleMargin),this.width,this.height):e.position(this.left+this.width+2+this.offset+(this.opposite?this.axisTitleMargin:0),this.top,this.width,this.height),isNaN(c)||isNaN(d)||!i(this.min)||!i(this.max)?e.setRange(0,0):(b=(this.min-c)/(d-c),c=(this.max-c)/(d-c),this.horiz&&!this.reversed||!this.horiz&&this.reversed?e.setRange(b,c):e.setRange(1-c,1-b)))}),db(kb.prototype,"getOffset",function(a){var b=this.horiz?2:1,c=this.scrollbar;a.apply(this,[].slice.call(arguments,1)),c&&(this.chart.axisOffset[b]+=c.size+c.options.margin)}),db(kb.prototype,"destroy",function(a){this.scrollbar&&(this.scrollbar=this.scrollbar.destroy()),a.apply(this,[].slice.call(arguments,1))}),ga.Scrollbar=H;var fb=[].concat(Gb),Kb=function(a){var b=Sa(arguments,bb);if(b.length)return Math[a].apply(0,b)};fb[4]=["day",[1,2,3,4]],fb[5]=["week",[1,2,3]],_a(O,{navigator:{handles:{backgroundColor:"#ebe7e8",borderColor:"#b2b1b6"},height:40,margin:25,maskFill:"rgba(128,179,236,0.3)",maskInside:!0,outlineColor:"#b2b1b6",outlineWidth:1,series:{type:Oa.areaspline===K?"line":"areaspline",color:"#4572A7",compare:null,fillOpacity:.05,dataGrouping:{approximation:"average",enabled:!0,groupPixelWidth:2,smoothed:!0,units:fb},dataLabels:{enabled:!1,zIndex:2},id:"highcharts-navigator-series",lineColor:null,lineWidth:1,marker:{enabled:!1},pointRange:0,shadow:!1,threshold:null},xAxis:{tickWidth:0,lineWidth:0,gridLineColor:"#EEE",gridLineWidth:1,tickPixelInterval:200,labels:{align:"left",style:{color:"#888"},x:3,y:-4},crosshair:!1},yAxis:{gridLineWidth:0,startOnTick:!1,endOnTick:!1,minPadding:.1,maxPadding:.1,labels:{enabled:!1},crosshair:!1,title:{text:null},tickWidth:0}}}),I.prototype={drawHandle:function(a,b){var c,d=this.chart.renderer,e=this.elementsToDestroy,f=this.handles,g=this.navigatorOptions.handles,g={fill:g.backgroundColor,stroke:g.borderColor,"stroke-width":1};this.rendered||(f[b]=d.g("navigator-handle-"+["left","right"][b]).css({cursor:"ew-resize"}).attr({zIndex:10-b}).add(),c=d.rect(-4.5,0,9,16,0,1).attr(g).add(f[b]),e.push(c),c=d.path(["M",-1.5,4,"L",-1.5,12,"M",.5,4,"L",.5,12]).attr(g).add(f[b]),e.push(c)),f[b][this.rendered&&!this.hasDragged?"animate":"attr"]({translateX:this.scrollerLeft+this.scrollbarHeight+parseInt(a,10),translateY:this.top+this.height/2-8})},render:function(a,b,c,d){var e,f,g,h,j=this.chart,k=j.renderer,l=this.navigatorGroup;h=this.scrollbarHeight;var l=this.xAxis,m=this.navigatorOptions,n=this.height,o=this.top,p=this.navigatorEnabled,q=m.outlineWidth,r=q/2,s=this.outlineHeight,t=o+r,u=this.rendered;bb(a)&&bb(b)&&(!this.hasDragged||i(c))&&(this.navigatorLeft=e=cb(l.left,j.plotLeft+h),this.navigatorWidth=f=cb(l.len,j.plotWidth-2*h),this.scrollerLeft=g=e-h,this.scrollerWidth=h=h=f+2*h,c=cb(c,l.translate(a)),d=cb(d,l.translate(b)),bb(c)&&oa(c)!==1/0||(c=0,d=h),l.translate(d,!0)-l.translate(c,!0)<j.xAxis[0].minRange||(this.zoomedMax=na(ma(c,d,0),f),this.zoomedMin=na(ma(this.fixedWidth?this.zoomedMax-this.fixedWidth:na(c,d),0),f),this.range=this.zoomedMax-this.zoomedMin,b=ja(this.zoomedMax),a=ja(this.zoomedMin),!u&&p&&(this.navigatorGroup=l=k.g("navigator").attr({zIndex:3}).add(),this.leftShade=k.rect().attr({fill:m.maskFill}).add(l),m.maskInside?this.leftShade.css({cursor:"ew-resize"}):this.rightShade=k.rect().attr({fill:m.maskFill}).add(l),this.outline=k.path().attr({"stroke-width":q,stroke:m.outlineColor}).add(l)),k=u&&!this.hasDragged?"animate":"attr",p&&(this.leftShade[k](m.maskInside?{x:e+a,y:o,width:b-a,height:n}:{x:e,y:o,width:a,height:n}),this.rightShade&&this.rightShade[k]({x:e+b,y:o,width:f-b,height:n}),this.outline[k]({d:[Ka,g,t,La,e+a-r,t,e+a-r,t+s,La,e+b-r,t+s,La,e+b-r,t,g+h,t].concat(m.maskInside?[Ka,e+a+r,t,La,e+b-r,t]:[])}),this.drawHandle(a+r,0),this.drawHandle(b+r,1)),this.scrollbar&&(this.scrollbar.hasDragged=this.hasDragged,this.scrollbar.position(this.scrollerLeft,this.top+(p?this.height:-this.scrollbarHeight),this.scrollerWidth,this.scrollbarHeight),this.scrollbar.setRange(a/f,b/f)),this.rendered=!0))},addEvents:function(){var a,b=this.chart,c=b.container,d=this.mouseDownHandler,e=this.mouseMoveHandler,f=this.mouseUpHandler;a=[[c,"mousedown",d],[c,"mousemove",e],[ha,"mouseup",f]],M&&a.push([c,"touchstart",d],[c,"touchmove",e],[ha,"touchend",f]),Ra(a,function(a){Va.apply(null,a)}),this._events=a,this.series&&Va(this.series.xAxis,"foundExtremes",function(){b.scroller.modifyNavigatorAxisExtremes()}),Va(b,"redraw",function(){var a=this.scroller,b=a&&a.baseSeries&&a.baseSeries.xAxis;b&&a.render(b.min,b.max)})},removeEvents:function(){Ra(this._events,function(a){Wa.apply(null,a)}),this._events=K,this.removeBaseSeriesEvents()},removeBaseSeriesEvents:function(){this.navigatorEnabled&&this.baseSeries&&this.baseSeries.xAxis&&this.navigatorOptions.adaptToUpdatedData!==!1&&(Wa(this.baseSeries,"updatedData",this.updatedDataHandler),Wa(this.baseSeries.xAxis,"foundExtremes",this.modifyBaseAxisExtremes))},init:function(){var a,b,c,e=this,f=e.chart,g=e.scrollbarHeight,h=e.navigatorOptions,j=e.height,k=e.top,l=e.baseSeries;e.mouseDownHandler=function(b){var d,b=f.pointer.normalize(b),g=e.zoomedMin,h=e.zoomedMax,i=e.top,k=e.scrollerLeft,l=e.scrollerWidth,m=e.navigatorLeft,n=e.navigatorWidth,o=e.scrollbarPad||0,p=e.range,q=b.chartX,r=b.chartY,b=f.xAxis[0],s=za?10:7;r>i&&r<i+j&&(ia.abs(q-g-m)<s?(e.grabbedLeft=!0,e.otherHandlePos=h,e.fixedExtreme=b.max,f.fixedRange=null):ia.abs(q-h-m)<s?(e.grabbedRight=!0,e.otherHandlePos=g,e.fixedExtreme=b.min,f.fixedRange=null):q>m+g-o&&q<m+h+o?(e.grabbedCenter=q,e.fixedWidth=p,c=q-g):q>k&&q<k+l&&(h=q-m-p/2,h<0?h=0:h+p>=n&&(h=n-p,d=e.getUnionExtremes().dataMax),h!==g&&(e.fixedWidth=p,g=a.toFixedRange(h,h+p,null,d),b.setExtremes(g.min,g.max,!0,null,{trigger:"navigator"}))))},e.mouseMoveHandler=function(a){var b,d=e.scrollbarHeight,g=e.navigatorLeft,h=e.navigatorWidth,i=e.scrollerLeft,j=e.scrollerWidth,k=e.range;a.touches&&0===a.touches[0].pageX||(a=f.pointer.normalize(a),b=a.chartX,b<g?b=g:b>i+j-d&&(b=i+j-d),e.grabbedLeft?(e.hasDragged=!0,e.render(0,0,b-g,e.otherHandlePos)):e.grabbedRight?(e.hasDragged=!0,e.render(0,0,e.otherHandlePos,b-g)):e.grabbedCenter&&(e.hasDragged=!0,b<c?b=c:b>h+c-k&&(b=h+c-k),e.render(0,0,b-c,b-c+k)),e.hasDragged&&e.scrollbar&&e.scrollbar.options.liveRedraw&&(a.DOMType=a.type,setTimeout(function(){e.mouseUpHandler(a)},0)))},e.mouseUpHandler=function(b){var d,g,h=b.DOMEvent||b;(e.hasDragged||"scrollbar"===b.trigger)&&(e.zoomedMin===e.otherHandlePos?d=e.fixedExtreme:e.zoomedMax===e.otherHandlePos&&(g=e.fixedExtreme),e.zoomedMax===e.navigatorWidth&&(g=e.getUnionExtremes().dataMax),d=a.toFixedRange(e.zoomedMin,e.zoomedMax,d,g),i(d.min)&&f.xAxis[0].setExtremes(d.min,d.max,!0,!e.hasDragged&&null,{trigger:"navigator",triggerOp:"navigator-drag",DOMEvent:h})),"mousemove"!==b.DOMType&&(e.grabbedLeft=e.grabbedRight=e.grabbedCenter=e.fixedWidth=e.fixedExtreme=e.otherHandlePos=e.hasDragged=c=null)};var m=f.xAxis.length,n=f.yAxis.length;f.extraBottomMargin=e.outlineHeight+h.margin,e.navigatorEnabled?(e.xAxis=a=new kb(f,d({breaks:l&&l.xAxis.options.breaks,ordinal:l&&l.xAxis.options.ordinal},h.xAxis,{id:"navigator-x-axis",isX:!0,type:"datetime",index:m,height:j,offset:0,offsetLeft:g,offsetRight:-g,keepOrdinalPadding:!0,startOnTick:!1,endOnTick:!1,minPadding:0,maxPadding:0,zoomEnabled:!1})),e.yAxis=b=new kb(f,d(h.yAxis,{id:"navigator-y-axis",alignTicks:!1,height:j,offset:0,index:n,zoomEnabled:!1})),l||h.series.data?e.addBaseSeries():0===f.series.length&&db(f,"redraw",function(a,b){f.series.length>0&&!e.series&&(e.setBaseSeries(),f.redraw=a),a.call(f,b)})):e.xAxis=a={translate:function(a,b){var c=f.xAxis[0],d=c.getExtremes(),e=f.plotWidth-2*g,h=Kb("min",c.options.min,d.dataMin),c=Kb("max",c.options.max,d.dataMax)-h;return b?a*c/e+h:e*(a-h)/c},toFixedRange:kb.prototype.toFixedRange},f.options.scrollbar.enabled&&(e.scrollbar=new H(f.renderer,d(f.options.scrollbar,{margin:e.navigatorEnabled?0:10}),f),Va(e.scrollbar,"changed",function(a){var b=e.navigatorWidth,c=b*this.to;b*=this.from,e.hasDragged=e.scrollbar.hasDragged,e.render(0,0,b,c),(f.options.scrollbar.liveRedraw||"mousemove"!==a.DOMType)&&setTimeout(function(){e.mouseUpHandler(a)})})),e.addBaseSeriesEvents(),db(f,"getMargins",function(c){var d=this.legend,f=d.options;c.apply(this,[].slice.call(arguments,1)),e.top=k=e.navigatorOptions.top||this.chartHeight-e.height-e.scrollbarHeight-this.spacing[2]-("bottom"===f.verticalAlign&&f.enabled&&!f.floating?d.legendHeight+cb(f.margin,10):0),a&&b&&(a.options.top=b.options.top=k,a.setAxisSize(),b.setAxisSize())}),e.addEvents()},getUnionExtremes:function(a){var b,c=this.chart.xAxis[0],d=this.xAxis,e=d.options,f=c.options;return a&&null===c.dataMin||(b={dataMin:cb(e&&e.min,Kb("min",f.min,c.dataMin,d.dataMin,d.min)),dataMax:cb(e&&e.max,Kb("max",f.max,c.dataMax,d.dataMax,d.max))}),b},setBaseSeries:function(a){var b=this.chart,a=a||b.options.navigator.baseSeries;this.series&&(this.removeBaseSeriesEvents(),this.series.remove()),this.baseSeries=b.series[a]||"string"==typeof a&&b.get(a)||b.series[0],this.xAxis&&this.addBaseSeries()},addBaseSeries:function(){var a,b=this.baseSeries,c=b?b.options:{},b=c.data,e=this.navigatorOptions.series;a=e.data,this.hasNavigatorData=!!a,c=d(c,e,{enableMouseTracking:!1,group:"nav",padXAxis:!1,xAxis:"navigator-x-axis",yAxis:"navigator-y-axis",name:"Navigator",showInLegend:!1,stacking:!1,isInternal:!0,visible:!0}),c.data=a||b.slice(0),this.series=this.chart.initSeries(c),this.addBaseSeriesEvents()},addBaseSeriesEvents:function(){var a=this.baseSeries;a&&a.xAxis&&this.navigatorOptions.adaptToUpdatedData!==!1&&(Va(a,"updatedData",this.updatedDataHandler),Va(a.xAxis,"foundExtremes",this.modifyBaseAxisExtremes),a.userOptions.events=_a(a.userOptions.event,{updatedData:this.updatedDataHandler}))},modifyNavigatorAxisExtremes:function(){var a,b=this.xAxis;b.getExtremes&&(a=this.getUnionExtremes(!0))&&(a.dataMin!==b.min||a.dataMax!==b.max)&&(b.min=a.dataMin,b.max=a.dataMax)},modifyBaseAxisExtremes:function(){if(this.chart.scroller.baseSeries&&this.chart.scroller.baseSeries.xAxis){var a,b,c=this.chart.scroller,d=this.getExtremes(),e=d.dataMin,f=d.dataMax,d=d.max-d.min,g=c.stickToMin,h=c.stickToMax,i=c.series,j=!!this.setExtremes;this.eventArgs&&"rangeSelectorButton"===this.eventArgs.trigger||(g&&(b=e,a=b+d),h&&(a=f,g||(b=ma(a-d,i&&i.xData?i.xData[0]:-Number.MAX_VALUE))),!j||!g&&!h||!bb(b))||(this.min=this.userMin=b,this.max=this.userMax=a),c.stickToMin=c.stickToMax=null}},updatedDataHandler:function(){var a=this.chart.scroller,b=a.baseSeries,c=a.series;a.stickToMin=bb(b.xAxis.min)&&b.xAxis.min<=b.xData[0],a.stickToMax=Math.round(a.zoomedMax)>=Math.round(a.navigatorWidth),c&&!a.hasNavigatorData&&(c.options.pointStart=b.xData[0],c.setData(b.options.data,!1,null,!1))},destroy:function(){this.removeEvents(),Ra([this.scrollbar,this.xAxis,this.yAxis,this.leftShade,this.rightShade,this.outline],function(a){a&&a.destroy&&a.destroy()}),this.xAxis=this.yAxis=this.leftShade=this.rightShade=this.outline=null,Ra([this.handles,this.elementsToDestroy],function(a){x(a)})}},ga.Navigator=I,db(kb.prototype,"zoom",function(a,b,c){var d,e=this.chart,f=e.options,g=f.chart.zoomType,h=f.navigator,f=f.rangeSelector;return this.isXAxis&&(h&&h.enabled||f&&f.enabled)&&("x"===g?e.resetZoomButton="blocked":"y"===g?d=!1:"xy"===g&&(e=this.previousZoom,i(b)?this.previousZoom=[this.min,this.max]:e&&(b=e[0],c=e[1],delete this.previousZoom))),d!==K?d:a.call(this,b,c)}),db(tb.prototype,"init",function(a,b,c){Va(this,"beforeRender",function(){var a=this.options;(a.navigator.enabled||a.scrollbar.enabled)&&(this.scroller=new I(this))}),a.call(this,b,c)}),db(wb.prototype,"addPoint",function(a,c,d,e,f){var g=this.options.turboThreshold;g&&this.xData.length>g&&ab(c,!0)&&this.chart.scroller&&b(20,!0),a.call(this,c,d,e,f)}),_a(O,{rangeSelector:{buttonTheme:{width:28,height:18,fill:"#f7f7f7",padding:2,r:0,"stroke-width":0,style:{color:"#444",cursor:"pointer",fontWeight:"normal"},zIndex:7,states:{hover:{fill:"#e7e7e7"},select:{fill:"#e7f0f9",style:{color:"black",fontWeight:"bold"}}}},height:35,inputPosition:{align:"right"},labelStyle:{color:"#666"}}}),O.lang=d(O.lang,{rangeSelectorZoom:"Zoom",rangeSelectorFrom:"From",rangeSelectorTo:"To"}),J.prototype={clickButton:function(a,b){var c,d,e,f,g,h=this,i=h.selected,j=h.chart,l=h.buttons,m=h.buttonOptions[a],n=j.xAxis[0],o=j.scroller&&j.scroller.getUnionExtremes()||n||{},p=o.dataMin,q=o.dataMax,r=n&&ja(na(n.max,cb(q,n.max))),s=m.type,o=m._range,t=m.dataGrouping;if(null!==p&&null!==q&&a!==h.selected){if(j.fixedRange=o,t&&(this.forcedDataGrouping=!0,kb.prototype.setDataGrouping.call(n||{chart:this.chart},t,!1)),"month"===s||"year"===s)n?(s={range:m,max:r,dataMin:p,dataMax:q},c=n.minFromRange.call(s),bb(s.newMax)&&(r=s.newMax)):o=m;else if(o)c=ma(r-o,p),r=na(c+o,q);else if("ytd"===s){if(!n)return void Va(j,"beforeRender",function(){
14
- h.clickButton(a)});q===K&&(p=Number.MAX_VALUE,q=Number.MIN_VALUE,Ra(j.series,function(a){a=a.xData,p=na(a[0],p),q=ma(a[a.length-1],q)}),b=!1),r=new R(q),c=r.getFullYear(),c=e=ma(p||0,R.UTC(c,0,1)),r=r.getTime(),r=na(q||r,r)}else"all"===s&&n&&(c=p,r=q);l[i]&&l[i].setState(0),l[a]&&(l[a].setState(2),h.lastSelected=a),n?(n.setExtremes(c,r,cb(b,1),null,{trigger:"rangeSelectorButton",rangeSelectorButton:m}),h.setSelected(a)):(d=k(j.options.xAxis)[0],g=d.range,d.range=o,f=d.min,d.min=e,h.setSelected(a),Va(j,"load",function(){d.range=g,d.min=f}))}},setSelected:function(a){this.selected=this.options.selected=a},defaultButtons:[{type:"month",count:1,text:"1m"},{type:"month",count:3,text:"3m"},{type:"month",count:6,text:"6m"},{type:"ytd",text:"YTD"},{type:"year",count:1,text:"1y"},{type:"all",text:"All"}],init:function(a){var b=this,c=a.options.rangeSelector,d=c.buttons||[].concat(b.defaultButtons),e=c.selected,f=b.blurInputs=function(){var a=b.minInput,c=b.maxInput;a&&a.blur&&Xa(a,"blur"),c&&c.blur&&Xa(c,"blur")};b.chart=a,b.options=c,b.buttons=[],a.extraTopMargin=c.height,b.buttonOptions=d,Va(a.container,"mousedown",f),Va(a,"resize",f),Ra(d,b.computeButtonRange),e!==K&&d[e]&&this.clickButton(e,!1),Va(a,"load",function(){Va(a.xAxis[0],"setExtremes",function(c){this.max-this.min!==a.fixedRange&&"rangeSelectorButton"!==c.trigger&&"updatedData"!==c.trigger&&b.forcedDataGrouping&&this.setDataGrouping(!1,!1)}),Va(a.xAxis[0],"afterSetExtremes",function(){b.updateButtonStates(!0)})})},updateButtonStates:function(a){var b=this,c=this.chart,d=c.xAxis[0],e=c.scroller&&c.scroller.getUnionExtremes()||d,f=e.dataMin,g=e.dataMax,h=b.selected,i=b.options.allButtonsEnabled,j=b.buttons;a&&c.fixedRange!==ja(d.max-d.min)&&(j[h]&&j[h].setState(0),b.setSelected(null)),Ra(b.buttonOptions,function(a,e){var k=ja(d.max-d.min),l=a._range,m=a.type,n=a.count||1,o=l>g-f,p=l<d.minRange,q="all"===a.type&&d.max-d.min>=g-f&&2!==j[e].state,r="ytd"===a.type&&P("%Y",f)===P("%Y",g),s=c.renderer.forExport&&e===h,l=l===k,t=!d.hasVisibleSeries;("month"===m||"year"===m)&&k>=864e5*{month:28,year:365}[m]*n&&k<=864e5*{month:31,year:366}[m]*n&&(l=!0),s||l&&e!==h&&e===b.lastSelected?(b.setSelected(e),j[e].setState(2)):!i&&(o||p||q||r||t)?j[e].setState(3):3===j[e].state&&j[e].setState(0)})},computeButtonRange:function(a){var b=a.type,c=a.count||1,d={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5};d[b]?a._range=d[b]*c:"month"!==b&&"year"!==b||(a._range=864e5*{month:30,year:365}[b]*c)},setInputValue:function(a,b){var c=this.chart.options.rangeSelector;i(b)&&(this[a+"Input"].HCTime=b),this[a+"Input"].value=P(c.inputEditDateFormat||"%Y-%m-%d",this[a+"Input"].HCTime),this[a+"DateBox"].attr({text:P(c.inputDateFormat||"%b %e, %Y",this[a+"Input"].HCTime)})},showInput:function(a){var b=this.inputGroup,c=this[a+"DateBox"];m(this[a+"Input"],{left:b.translateX+c.x+"px",top:b.translateY+"px",width:c.width-2+"px",height:c.height-2+"px",border:"2px solid silver"})},hideInput:function(a){m(this[a+"Input"],{border:0,width:"1px",height:"1px"}),this.setInputValue(a)},drawInput:function(a){function b(){var a=c.value,b=(k.inputDateParser||R.parse)(a),d=h.xAxis[0],f=d.dataMin,i=d.dataMax;b!==c.previousValue&&(c.previousValue=b,bb(b)||(b=a.split("-"),b=R.UTC(e(b[0]),e(b[1])-1,e(b[2]))),bb(b)&&(O.global.useUTC||(b+=6e4*(new R).getTimezoneOffset()),m?b>g.maxInput.HCTime?b=K:b<f&&(b=f):b<g.minInput.HCTime?b=K:b>i&&(b=i),b!==K&&h.xAxis[0].setExtremes(m?b:d.min,m?d.max:b,K,K,{trigger:"rangeSelectorInput"})))}var c,f,g=this,h=g.chart,i=h.renderer.style,j=h.renderer,k=h.options.rangeSelector,l=g.div,m="min"===a,o=this.inputGroup;this[a+"Label"]=f=j.label(O.lang[m?"rangeSelectorFrom":"rangeSelectorTo"],this.inputGroup.offset).attr({padding:2}).css(d(i,k.labelStyle)).add(o),o.offset+=f.width+5,this[a+"DateBox"]=j=j.label("",o.offset).attr({padding:2,width:k.inputBoxWidth||90,height:k.inputBoxHeight||17,stroke:k.inputBoxBorderColor||"silver","stroke-width":1}).css(d({textAlign:"center",color:"#444"},i,k.inputStyle)).on("click",function(){g.showInput(a),g[a+"Input"].focus()}).add(o),o.offset+=j.width+(m?10:0),this[a+"Input"]=c=n("input",{name:a,className:"highcharts-range-selector",type:"text"},_a({position:"absolute",border:0,width:"1px",height:"1px",padding:0,textAlign:"center",fontSize:i.fontSize,fontFamily:i.fontFamily,left:"-9em",top:h.plotTop+"px"},k.inputStyle),l),c.onfocus=function(){g.showInput(a)},c.onblur=function(){g.hideInput(a)},c.onchange=b,c.onkeypress=function(a){13===a.keyCode&&b()}},getPosition:function(){var a=this.chart,b=a.options.rangeSelector,a=cb((b.buttonPosition||{}).y,a.plotTop-a.axisOffset[0]-b.height);return{buttonTop:a,inputTop:a-10}},render:function(a,b){var c,d=this,e=d.chart,f=e.renderer,g=e.container,h=e.options,j=h.exporting&&h.exporting.enabled!==!1&&h.navigation&&h.navigation.buttonOptions,k=h.rangeSelector,l=d.buttons,h=O.lang,m=d.div,m=d.inputGroup,o=k.buttonTheme,p=k.buttonPosition||{},q=k.inputEnabled,r=o&&o.states,s=e.plotLeft,t=this.getPosition(),u=d.group,v=d.rendered;v||(d.group=u=f.g("range-selector-buttons").add(),d.zoomText=f.text(h.rangeSelectorZoom,cb(p.x,s),15).css(k.labelStyle).add(u),c=cb(p.x,s)+d.zoomText.getBBox().width+5,Ra(d.buttonOptions,function(a,b){l[b]=f.button(a.text,c,0,function(){d.clickButton(b),d.isActive=!0},o,r&&r.hover,r&&r.select,r&&r.disabled).css({textAlign:"center"}).add(u),c+=l[b].width+cb(k.buttonSpacing,5),d.selected===b&&l[b].setState(2)}),d.updateButtonStates(),q===!1)||(d.div=m=n("div",null,{position:"relative",height:0,zIndex:1}),g.parentNode.insertBefore(m,g),d.inputGroup=m=f.g("input-group").add(),m.offset=0,d.drawInput("min"),d.drawInput("max")),u[v?"animate":"attr"]({translateY:t.buttonTop}),q!==!1&&(m.align(_a({y:t.inputTop,width:m.offset,x:j&&t.inputTop<(j.y||0)+j.height-e.spacing[0]?-40:0},k.inputPosition),!0,e.spacingBox),i(q)||(e=u.getBBox(),m[m.translateX<e.x+e.width+10?"hide":"show"]()),d.setInputValue("min",a),d.setInputValue("max",b)),d.rendered=!0},destroy:function(){var a,b=this.minInput,c=this.maxInput,d=this.chart,e=this.blurInputs;Wa(d.container,"mousedown",e),Wa(d,"resize",e),x(this.buttons),b&&(b.onfocus=b.onblur=b.onchange=null),c&&(c.onfocus=c.onblur=c.onchange=null);for(a in this)this[a]&&"chart"!==a&&(this[a].destroy?this[a].destroy():this[a].nodeType&&y(this[a])),this[a]=null}},kb.prototype.toFixedRange=function(a,b,c,d){var e=this.chart&&this.chart.fixedRange,a=cb(c,this.translate(a,!0)),b=cb(d,this.translate(b,!0)),c=e&&(b-a)/e;return c>.7&&c<1.3&&(d?a=b-e:b=a+e),bb(a)||(a=b=void 0),{min:a,max:b}},kb.prototype.minFromRange=function(){var a,b,c,d=this.range,e={month:"Month",year:"FullYear"}[d.type],f=this.max,g=function(a,b){var c=new R(a);return c["set"+e](c["get"+e]()+b),c.getTime()-a};return bb(d)?(a=this.max-d,c=d):a=f+g(f,-d.count),b=cb(this.dataMin,Number.MIN_VALUE),bb(a)||(a=b),a<=b&&(a=b,void 0===c&&(c=g(a,d.count)),this.newMax=na(a+c,this.dataMax)),bb(f)||(a=void 0),a},db(tb.prototype,"init",function(a,b,c){Va(this,"init",function(){this.options.rangeSelector.enabled&&(this.rangeSelector=new J(this))}),a.call(this,b,c)}),ga.RangeSelector=J,tb.prototype.callbacks.push(function(a){function b(){d=a.xAxis[0].getExtremes(),bb(d.min)&&f.render(d.min,d.max)}function c(a){f.render(a.min,a.max)}var d,e=a.scroller,f=a.rangeSelector;e&&(d=a.xAxis[0].getExtremes(),e.render(d.min,d.max)),f&&(Va(a.xAxis[0],"afterSetExtremes",c),Va(a,"resize",b),b()),Va(a,"destroy",function(){f&&(Wa(a,"resize",b),Wa(a.xAxis[0],"afterSetExtremes",c))})}),ga.StockChart=ga.stockChart=function(a,b,c){var e,g=f(a)||a.nodeName,h=arguments[g?1:0],i=h.series,j=cb(h.navigator&&h.navigator.enabled,!0)?{startOnTick:!1,endOnTick:!1}:null,l={marker:{enabled:!1,radius:2}},m={shadow:!1,borderWidth:0};return h.xAxis=Ua(k(h.xAxis||{}),function(a){return d({minPadding:0,maxPadding:0,ordinal:!0,title:{text:null},labels:{overflow:"justify"},showLastLabel:!0},a,{type:"datetime",categories:null},j)}),h.yAxis=Ua(k(h.yAxis||{}),function(a){return e=cb(a.opposite,!0),d({labels:{y:-2},opposite:e,showLastLabel:!1,title:{text:null}},a)}),h.series=null,h=d({chart:{panning:!0,pinchType:"x"},navigator:{enabled:!0},scrollbar:{enabled:!0},rangeSelector:{enabled:!0},title:{text:null,style:{fontSize:"16px"}},tooltip:{shared:!0,crosshairs:!0},legend:{enabled:!1},plotOptions:{line:l,spline:l,area:l,areaspline:l,arearange:l,areasplinerange:l,column:m,columnrange:m,candlestick:m,ohlc:m}},h,{_stock:!0,chart:{inverted:!1}}),h.series=i,g?new tb(a,h,c):new tb(h,b)},db(nb.prototype,"init",function(a,b,c){var d=c.chart.pinchType||"";a.call(this,b,c),this.pinchX=this.pinchHor=d.indexOf("x")!==-1,this.pinchY=this.pinchVert=d.indexOf("y")!==-1,this.hasZoom=this.hasZoom||this.pinchHor||this.pinchVert}),db(kb.prototype,"autoLabelAlign",function(a){var b=this.chart,c=this.options,b=b._labelPanes=b._labelPanes||{},d=this.options.labels;return this.chart.options._stock&&"yAxis"===this.coll&&(c=c.top+","+c.height,!b[c]&&d.enabled)?(15===d.x&&(d.x=0),void 0===d.align&&(d.align="right"),b[c]=1,"right"):a.call(this,[].slice.call(arguments,1))}),db(kb.prototype,"getPlotLinePath",function(a,b,c,d,e,f){var g,h,j,k,l,m,n=this,o=this.isLinked&&!this.series?this.linkedParent.series:this.series,p=n.chart,q=p.renderer,r=n.left,s=n.top,t=[],u=[];return"colorAxis"===n.coll?a.apply(this,[].slice.call(arguments,1)):(u=n.isXAxis?i(n.options.yAxis)?[p.yAxis[n.options.yAxis]]:Ua(o,function(a){return a.yAxis}):i(n.options.xAxis)?[p.xAxis[n.options.xAxis]]:Ua(o,function(a){return a.xAxis}),Ra(n.isXAxis?p.yAxis:p.xAxis,function(a){if(i(a.options.id)?a.options.id.indexOf("navigator")===-1:1){var b=a.isXAxis?"yAxis":"xAxis",b=i(a.options[b])?p[b][a.options[b]]:p[b][0];n===b&&u.push(a)}}),l=u.length?[]:[n.isXAxis?p.yAxis[0]:p.xAxis[0]],Ra(u,function(a){Qa(a,l)===-1&&l.push(a)}),m=cb(f,n.translate(b,null,null,d)),bb(m)&&(n.horiz?Ra(l,function(a){var b;h=a.pos,k=h+a.len,g=j=ja(m+n.transB),(g<r||g>r+n.width)&&(e?g=j=na(ma(r,g),r+n.width):b=!0),b||t.push("M",g,h,"L",j,k)}):Ra(l,function(a){var b;g=a.pos,j=g+a.len,h=k=ja(s+n.height-m),(h<s||h>s+n.height)&&(e?h=k=na(ma(s,h),n.top+n.height):b=!0),b||t.push("M",g,h,"L",j,k)})),t.length>0?q.crispPolyLine(t,c||1):null)}),kb.prototype.getPlotBandPath=function(a,b){var c,d=this.getPlotLinePath(b,null,null,!0),e=this.getPlotLinePath(a,null,null,!0),f=[];if(e&&d&&e.toString()!==d.toString())for(c=0;c<e.length;c+=6)f.push("M",e[c+1],e[c+2],"L",e[c+4],e[c+5],d[c+4],d[c+5],d[c+1],d[c+2]);else f=null;return f},gb.prototype.crispPolyLine=function(a,b){var c;for(c=0;c<a.length;c+=6)a[c+1]===a[c+4]&&(a[c+1]=a[c+4]=ja(a[c+1])-b%2/2),a[c+2]===a[c+5]&&(a[c+2]=a[c+5]=ja(a[c+2])+b%2/2);return a},L===ga.VMLRenderer&&(hb.prototype.crispPolyLine=gb.prototype.crispPolyLine),db(kb.prototype,"hideCrosshair",function(a,b){a.call(this,b),this.crossLabel&&(this.crossLabel=this.crossLabel.hide())}),db(kb.prototype,"drawCrosshair",function(a,b,c){var d,e;if(a.call(this,b,c),i(this.crosshair.label)&&this.crosshair.label.enabled&&this.cross){var f,a=this.chart,g=this.options.crosshair.label,h=this.horiz,j=this.opposite,k=this.left,l=this.top,m=this.crossLabel,n=g.format,o="",p="inside"===this.options.tickPosition,q=this.crosshair.snap!==!1;b||(b=this.cross&&this.cross.e),f=h?"center":j?"right"===this.labelAlign?"right":"left":"left"===this.labelAlign?"left":"center",m||(m=this.crossLabel=a.renderer.label(null,null,null,g.shape||"callout").attr({align:g.align||f,zIndex:12,fill:g.backgroundColor||this.series[0]&&this.series[0].color||"gray",padding:cb(g.padding,8),stroke:g.borderColor||"","stroke-width":g.borderWidth||0,r:cb(g.borderRadius,3)}).css(_a({color:"white",fontWeight:"normal",fontSize:"11px",textAlign:"center"},g.style)).add()),h?(f=q?c.plotX+k:b.chartX,l+=j?0:this.height):(f=j?this.width+k:0,l=q?c.plotY+l:b.chartY),!n&&!g.formatter&&(this.isDatetimeAxis&&(o="%b %d, %Y"),n="{value"+(o?":"+o:"")+"}"),b=q?c[this.isXAxis?"x":"y"]:this.toValue(h?b.chartX:b.chartY),m.attr({text:n?r(n,{value:b}):g.formatter.call(this,b),anchorX:h?f:this.opposite?0:a.chartWidth,anchorY:h?this.opposite?a.chartHeight:0:l,x:f,y:l,visibility:"visible"}),b=m.getBBox(),h?(p&&!j||!p&&j)&&(l=m.y-b.height):l=m.y-b.height/2,h?(d=k-b.x,e=k+this.width-b.x):(d="left"===this.labelAlign?k:0,e="right"===this.labelAlign?k+this.width:a.chartWidth),m.translateX<d&&(f+=d-m.translateX),m.translateX+b.width>=e&&(f-=m.translateX+b.width-e),m.attr({x:f,y:l,visibility:"visible"})}});var Lb=Ab.init,Mb=Ab.processData,Nb=vb.prototype.tooltipFormatter;return Ab.init=function(){Lb.apply(this,arguments),this.setCompare(this.options.compare)},Ab.setCompare=function(a){this.modifyValue="value"===a||"percent"===a?function(b,c){var d=this.compareValue;return b!==K&&(b="value"===a?b-d:b=100*(b/d)-100,c)&&(c.change=b),b}:null,this.userOptions.compare=a,this.chart.hasRendered&&(this.isDirty=!0)},Ab.processData=function(){var a,b,c,d,e,f=-1;if(Mb.apply(this,arguments),this.xAxis&&this.processedYData)for(b=this.processedXData,c=this.processedYData,d=c.length,this.pointArrayMap&&(f=Qa(this.pointValKey||"y",this.pointArrayMap)),a=0;a<d-1;a++)if(e=f>-1?c[a][f]:c[a],bb(e)&&b[a+1]>=this.xAxis.min&&0!==e){this.compareValue=e;break}},db(Ab,"getExtremes",function(a){var b;a.apply(this,[].slice.call(arguments,1)),this.modifyValue&&(b=[this.modifyValue(this.dataMin),this.modifyValue(this.dataMax)],this.dataMin=v(b),this.dataMax=w(b))}),kb.prototype.setCompare=function(a,b){this.isXAxis||(Ra(this.series,function(b){b.setCompare(a)}),cb(b,!0)&&this.chart.redraw())},vb.prototype.tooltipFormatter=function(a){return a=a.replace("{point.change}",(this.change>0?"+":"")+ga.numberFormat(this.change,cb(this.series.tooltipOptions.changeDecimals,2))),Nb.apply(this,[a])},db(wb.prototype,"render",function(a){this.chart.options._stock&&this.xAxis&&(!this.clipBox&&this.animate?(this.clipBox=d(this.chart.clipBox),this.clipBox.width=this.xAxis.len,this.clipBox.height=this.yAxis.len):this.chart[this.sharedClipKey]&&(Za(this.chart[this.sharedClipKey]),this.chart[this.sharedClipKey].attr({width:this.xAxis.len,height:this.yAxis.len}))),a.call(this)}),_a(ga,{Color:D,Point:vb,Tick:F,Renderer:L,SVGElement:E,SVGRenderer:gb,arrayMin:v,arrayMax:w,charts:Ha,correctFloat:z,dateFormat:P,error:b,format:r,pathAnim:void 0,getOptions:function(){return O},hasBidiBug:Ca,isTouchDevice:za,setOptions:function(a){return O=d(!0,O,a),C(),O},addEvent:Va,removeEvent:Wa,createElement:n,discardElement:y,css:m,each:Ra,map:Ua,merge:d,splat:k,stableSort:u,extendClass:o,pInt:e,svg:Ba,canvas:Da,vml:!Ba&&!Da,product:"Highstock",version:"4.2.6"}),ga}),jQuery(document).ready(function(a){"use strict";var b=!1,c=[],d={fb_pixel_box:".panel.panel-settings-set-fb-px",ca_list:".panel.panel-ca-list",conversions_list:".panel.panel-ce-tracking",sidebar:".plugin-sidebar"},e=function(){a.fn.select2&&a.extend(a.fn.select2.defaults,{dropdownCssClass:"adespresso-select2",containerCssClass:"adespresso-select2",formatNoMatches:!1})},f=function(a){if("undefined"!=typeof a.data("select2")){var b=a.data("select2"),c=b.container;c.addClass("loading-data")}else a.is("div, form")?a.addClass("loading-data loading-box"):a.is("a")&&a.addClass("loading-data")},g=function(a){if("undefined"!=typeof a.data("select2")){var b=a.data("select2"),c=b.container;c.removeClass("loading-data")}else a.is("div, form")?a.removeClass("loading-data loading-box"):a.is("a")&&a.removeClass("loading-data")},h=function(a,b){"error"===b&&(b="danger"),a.find(".alert-"+b).length&&a.find(".alert-"+b).remove()},i=function(b,c,d){"error"===c&&(c="danger"),h(b,c);var e=a("<div />",{"class":"alert alert-"+c+" alert-dismissable",role:"alert",html:d}).prepend(a("<button />",{type:"button","class":"close","data-dismiss":"alert",text:"×"}));b.prepend(e)},j=function(){b=!0},k=function(){b=!1},l=function(){a(".wrap form").on("change",":input:not(#date-range)",function(){j()}).on("submit",function(){k()}),window.onbeforeunload=function(){if(b)return aepc_admin.unsaved}},m=function(a,b){a.select2({tags:b})},n=function(b){var d=a("undefined"!=typeof b?b.currentTarget:document.body),e=[{action:"get_custom_fields",dropdown:"input.custom-fields"},{action:"get_languages",dropdown:"#conditions_language"},{action:"get_device_types",dropdown:"#conditions_device_types"},{action:"get_categories",dropdown:""},{action:"get_tags",dropdown:""},{action:"get_posts",dropdown:""},{action:"get_dpa_params",dropdown:""},{action:"get_currencies",dropdown:""}];a.each(e,function(b,e){if(aepc_admin.actions.hasOwnProperty(e.action)){if(c.hasOwnProperty(e.action))return void(""!==e.dropdown&&m(d.find(e.dropdown),c[e.action]));c[e.action]=[],a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions[e.action].name,_wpnonce:aepc_admin.actions[e.action].nonce},success:function(a){c[e.action]=a,""!==e.dropdown&&m(d.find(e.dropdown),a)},dataType:"json"})}}),d.find("#taxonomy_key").on("change.data",function(){var b=a(this).val().replace("tax_","");c.hasOwnProperty("get_categories")&&c.get_categories.hasOwnProperty(b)&&m(d.find("#taxonomy_terms"),c.get_categories[b])}),d.find("#tag_key").on("change.data",function(){var b=a(this).val().replace("tax_","");c.hasOwnProperty("get_tags")&&c.get_tags.hasOwnProperty(b)&&m(d.find("#tag_terms"),c.get_tags[b])}),d.find("#pt_key").on("change.data",function(){var b=a(this).val();c.hasOwnProperty("get_posts")&&c.get_posts.hasOwnProperty(b)&&m(d.find("#pt_posts"),c.get_posts[b])}),d.find("#event_categories").on("change.data",function(){d.find("#taxonomy_key").trigger("change.data")}),d.find("#event_tax_post_tag").on("change.data",function(){d.find("#tag_key").trigger("change.data")}),d.find("#event_posts").on("change.data",function(){d.find("#pt_key").trigger("change.data")}),d.find("#event_pages").on("change.data",function(){c.hasOwnProperty("get_posts")&&c.get_posts.hasOwnProperty("page")&&m(d.find("#pages"),c.get_posts.page)}),d.find("#event_custom_fields").on("change.data",function(b){var e=[{id:"[[any]]",text:aepc_admin.filter_any}];e=a.merge(e,c.get_custom_fields),d.find("#custom_field_keys option").remove(),d.find("#custom_field_keys").append(a.map(e,function(b,c){return"[[any]]"===b.id&&(b.text="--- "+b.text+" ---"),a("<option>",{val:b.id,text:b.text})}))}),d.find(".js-ecommerce input").on("change.data",function(){d.find("#dpa_key").select2({placeholder:aepc_admin.filter_custom_field_placeholder,searchInputPlaceholder:aepc_admin.filter_custom_field_placeholder,data:{results:c.get_dpa_params},query:function(b){var d={results:c.get_dpa_params};""!==b.term&&(d.results=a.merge([{id:b.term,text:b.term}],d.results)),d.results=d.results.filter(function(a){return b.matcher(b.term,a.text)}),b.callback(d)}}).select2("data",{id:d.find("#dpa_key").val(),text:d.find("#dpa_key").val()}).on("change",function(){d.find("#dpa_value").val("")}).off("change.dpa").on("change.dpa",function(){var b=a(this).val(),e=[];"content_ids"===b?c.hasOwnProperty("get_posts")&&c.get_posts.hasOwnProperty("product")&&(e=c.get_posts.product):"content_type"===b?e=["product","product_group"]:"currency"===b&&c.hasOwnProperty("get_currencies")&&(e=c.get_currencies.map(function(a){var b=document.createElement("textarea");return b.innerHTML=a.text,a.text=b.value,a})),d.find("#dpa_value").select2({tags:e})}).triggerHandler("change.dpa")})},o=function(){a("select").select2({minimumResultsForSearch:5}),a("input.multi-tags").select2({tags:[]}),a("select.dropdown-width-max").select2({minimumResultsForSearch:5,dropdownCssClass:"dropdown-width-max"})},p=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document);c.find(".collapse").collapse({toggle:!1}),c.find('[data-toggle="tooltip"]').tooltip(),c.find('[data-toggle="popover"]').popover({container:"#wpbody .pixel-caffeine-wrapper"}),a.material.init()},q=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document);c.find("select.js-collapse").on("change.bs",function(){var b=a(this),d=b.find("option:selected");c.find(d.data("target")).hasClass("in")||(c.find(b.data("parent")).find(".collapse").collapse("hide"),c.find(d.data("target")).collapse("show"))}).trigger("change.bs"),c.find("input.js-collapse").on("change.bs",function(){var b=a(this),d=b.filter(":checked");c.find(d.data("target")).hasClass("in")||(c.find(b.data("parent")).find(".collapse").collapse("hide"),c.find(d.data("target")).collapse("show"))}).trigger("change.bs"),c.find("#ca_event_type").on("change.bs",function(){c.find(".collapse-parameters").find(".collapse").collapse("hide"),c.find(".js-collapse-events").find("input:checked").prop("checked",!1)}),p(b)},r=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document.body);c.find("select.js-dep").on("change",function(){var b=a(this),c=b.closest("form"),d=b.val(),e=b.attr("id"),f=c.find('div[class*="'+e+'"]'),g=c.find("."+e+"-"+d);f.hide(),g.length&&g.show()}).trigger("change"),c.find(".control-wrap .checkbox .inline-text").on("focus",function(){a(this).siblings('input[type="checkbox"]').prop("checked",!0).trigger("change")}),c.find('.control-wrap .checkbox input[type="checkbox"]').on("change",function(){var b=a(this),c=b.is(":checked");b.closest("div.checkbox").removeClass("checked unchecked").addClass(c?"checked":"unchecked").find("input.inline-text").prop("disabled",!c)}).trigger("change"),c.find(".js-show-advanced-data").on("change.components",function(){var b=a(this),c=b.closest("form");c.find("div.advanced-data").collapse(b.is(":checked")?"show":"hide")}).trigger("change.components"),c.find("select#event_standard_events").on("change.components",function(){var b=a(this),c=b.closest("form"),d=b.find("option:selected").data("fields");c.find("div.event-field").hide(),a.each(d.split(",").map(function(a){return a.trim()}),function(a,b){c.find("div.event-field."+b+"-field").show()})}).trigger("change.components"),c.find("input.js-switch-labeled-tosave").on("change.components",function(){var b=a(this),c=b.closest(".form-group").find(".text-status"),d=b.is(":checked")?"yes":"no",e=b.closest(".togglebutton"),f=b.data("original-value");"undefined"==typeof c.data("original-status")&&c.data("original-status",c.clone()),f!==d?(c.hasClass("text-status-pending")||e.addClass("pending"),c.addClass("text-status-pending").text(aepc_admin.switch_unsaved)):(a(c.data("original-status")).hasClass("text-status-pending")||e.removeClass("pending"),c.replaceWith(c.data("original-status")))}).trigger("change.components"),c.find("input.js-switch-labeled").on("change.components",function(){var b=a(this),c=b.closest(".form-group").find(".text-status");c.removeClass("hide"),b.is(":checked")?c.filter(".text-status-off").addClass("hide"):c.filter(".text-status-on").addClass("hide")});var d=function(){c.find("div.js-custom-params").children("div").each(function(b){var c=a(this);c.find('input[type="text"]').each(function(){var c=a(this);c.attr("name",c.attr("name").replace(/\[[0-9]+\]/,"["+b+"]")),c.attr("id",c.attr("id").replace(/_[0-9]+$/,"_"+b))})})};c.find(".js-add-custom-param").on("click",function(b){if("undefined"==typeof wp)return b;b.preventDefault();var c=wp.template("custom-params"),d=a(this).closest("div.js-custom-params"),e=parseInt(d.children("div").length);d.find(".js-custom-param:last").length?d.find(".js-custom-param:last").after(c({index:e-1})):d.prepend(c({index:e-1}))}),c.find(".js-custom-params").on("click",".js-delete-custom-param",function(b){b.preventDefault();var c=a(this),e=a("#modal-confirm-delete"),f=c.closest(".js-custom-param"),g=function(){e.modal("hide"),f.remove(),d()};""===f.find('input[id^="event_custom_params_key"]').val()&&""===f.find('input[id^="event_custom_params_value"]').val()?g():e.modal("show").one("click",".btn-ok",g)}),c.find("select[data-selected]").each(function(){var b=a(this),c=b.data("selected");b.data("selected","").val(c).trigger("change")}),c.find("select[data-selected]").each(function(){var b=a(this),c=b.data("selected");b.val(c).trigger("change")})},s=function(a){var b=a.find(".js-include-filters"),c=a.find(".js-exclude-filters"),d=a.find(".js-ca-filters");0===b.find("ul.list-filter").find("li").length?b.addClass("hide"):b.removeClass("hide"),0===c.find("ul.list-filter").find("li").length?c.addClass("hide"):c.removeClass("hide"),b.hasClass("hide")&&c.hasClass("hide")?d.find("div.no-filters-feedback").removeClass("hide"):(d.find("div.no-filters-feedback").addClass("hide"),b.find("ul.list-filter").find("li:first").find(".filter-and").remove(),c.find("ul.list-filter").find("li:first").find(".filter-and").remove())},t=function(b){var c=a(this),d=a(b.relatedTarget),e=d.closest("form");c.find("#ca-filter-form").on("submit",function(b){b.preventDefault();var c=a(this),j=c.data("scope"),k=e.find(".js-ca-filters"),l=wp.template("ca-filter-item"),m=c.find('[name^="ca_rule[][main_condition]"]:checked'),n=c.find('button[type="submit"]'),o=n.text(),p=k.find(".js-"+m.val()+"-filters"),q=m.add(c.find('[name^="ca_rule[][event_type]"]')).add(c.find('[name^="ca_rule[][event]"]:checked')).add(c.find(".collapse-parameters .collapse.in").find('[name^="ca_rule[][conditions]"]')),r=function(b){var f=a("<div />"),h="add"===j?k.find("li").length:d.closest("li").data("filter-id");if(g(c),!b||0===b.length)return i(c.find(".modal-body"),"error",aepc_admin.filter_no_condition_error),void n.text(o);q.each(function(){var b=a(this),c=b.attr("name"),d=b.val();f.append(a("<input />",{type:"hidden",name:c.replace("[]","["+h+"]"),value:d}))});var m=l({nfilters:p.find("li").length-("edit"===j&&a.contains(p.get()[0],d.get()[0])?1:0),statement:b,hidden_inputs:f.html(),index:h});"edit"===j&&a.contains(p.get()[0],d.get()[0])?d.closest("li").html(a(m).html()):(p.find("ul").append(m),"edit"!==j||a.contains(p.get()[0],d.get()[0])||d.closest("li").remove()),s(e),c.closest(".modal").modal("hide"),c.off("submit")};return h(c.find(".modal-body"),"error"),0===c.find(".js-collapse-events input:checked").length?void i(c.find(".modal-body"),"error",aepc_admin.filter_no_data_error):(f(c),n.text(aepc_admin.filter_saving),void a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{filter:q.serializeArray(),action:aepc_admin.actions.get_filter_statement.name,_wpnonce:aepc_admin.actions.get_filter_statement.nonce},success:r,dataType:"html"}))})},u=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document.body);c.find(".list-filter").on("click",".btn-delete",function(b){b.preventDefault();var c=a(this).closest("form"),d=a("#modal-confirm-delete"),e=a(this).closest("li");d.modal("show",a(this)).one("click",".btn-ok",function(){d.modal("hide"),e.remove(),s(c)})}).on("click",".btn-edit",function(b){b.preventDefault();var c=(a(this).closest("form"),a("#modal-ca-edit-filter")),d=a(this).closest("li"),e=d.find(".hidden-fields input");c.on("modal-template-loaded",function(b){var c=a(this).find("form"),d=e.filter('[name*="[main_condition]"]').val();c.find('input[name*="main_condition"][value="'+d+'"]').prop("checked",!0).closest("label").addClass("active").siblings().removeClass("active");var f=e.filter('[name*="[event_type]"]').val(),g=(c.find('select[name*="event_type"]').val(f),e.filter('[name*="[event]"]').val()),h=c.find('input[name*="event"][value="'+g+'"]').prop("checked",!0),i=c.find(h.data("target")),j=e.filter('[name*="[conditions][0][key]"]').val(),k=e.filter('[name*="[conditions][0][operator]"]').val(),l=e.filter('[name*="[conditions][0][value]"]').val();i.find('[name*="[conditions][0][key]"]').is("#custom_field_keys")&&i.find("#custom_field_keys").append(a("<option />",{val:j,text:j})),i.find('[name*="[conditions][0][key]"]').val(j),i.find('[name*="[conditions][0][operator]"]').val(k),i.find('[name*="[conditions][0][value]"]').val(l)}).one("show.bs.modal",function(){var b=a(this).find("form");b.find('[name*="event_type"]:checked').trigger("change.data"),b.find('[name*="event"]:checked').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][key]"]').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][operator]"]').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][value]"]').trigger("change.data")}).modal("show",a(this))})},v=function(b){var c=a(window).scrollTop(),d=a(b).offset().top;return d-c},w=function(){var b=v(".plugin-content"),c=parseFloat(a(".wp-toolbar").css("padding-top")),d=a(".alert-wrap"),e=d.height(),f=a(".alert-wrap-ghost");b<=c?(0===f.length&&d.after('<div class="alert-wrap-ghost"></div>').next(".alert-wrap-ghost").height(e),d.addClass("alert-fixed").css({top:c}).width(a(".plugin-content").width())):(d.removeClass("alert-fixed").width("100%"),f.remove())},x=function(){var b=a("#activity-chart");b.length&&a.getJSON(aepc_admin.ajax_url+"?action="+aepc_admin.actions.get_pixel_stats.name+"&_wpnonce="+aepc_admin.actions.get_pixel_stats.nonce,function(c){if("undefined"!=typeof c.success&&!1===c.success)return void i(b,"info",c.data[0].message);var d=new Date;d.setUTCDate(d.getUTCDate()-7),d.setUTCHours(0,0,0,0),b.highcharts("StockChart",{chart:{type:"line"},title:{text:null},navigator:{enabled:!0},rangeSelector:{enabled:!1},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{min:d.getTime()},yAxis:{gridLineColor:"#F4F4F4"},series:[{name:"Pixel fires",data:c,dataGrouping:{approximation:"sum",forced:!0,units:[["day",[1]]]},pointInterval:36e5}]}),b.closest(".panel").find("select#date-range").select2({minimumResultsForSearch:5,width:"element"}),b.closest(".panel").on("change.chart.range","select#date-range",function(){var c=b.highcharts(),d=a(this).val(),e=new Date,f=new Date;if(f.setDate(e.getUTCDate()-1),"today"===d)c.xAxis[0].setExtremes(e.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["hour",[1]]]});else if("yesterday"===d)c.xAxis[0].setExtremes(f.setUTCHours(0,0,0,0),f.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["hour",[1]]]});else if("last-7-days"===d){var g=f;g.setDate(e.getUTCDate()-7),c.xAxis[0].setExtremes(g.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["day",[1]]]})}else if("last-14-days"===d){var h=f;h.setDate(e.getUTCDate()-14),c.xAxis[0].setExtremes(h.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["day",[1]]]})}})})},y=function(b){var d=a("undefined"!=typeof b?this:document.body),e=d.find("select#aepc_account_id"),h=d.find("select#aepc_pixel_id"),j=a("form#mainform").find("#aepc_account_id").val(),l=a("form#mainform").find("#aepc_pixel_id").val(),m=function(){var b=e.val()?JSON.parse(e.val()).id:"";if(c.hasOwnProperty("get_pixel_ids")&&c.get_pixel_ids.hasOwnProperty(b)){var d=a.merge([{id:"",text:""}],c.get_pixel_ids[b]);1===d.length?(d[0].text=aepc_admin.fb_option_no_pixel,h.prop("disabled",!0)):h.prop("disabled",!1),h.find("option").remove(),h.append(a.map(d,function(b,c){return a("<option>",{val:b.id,text:b.text,selected:b.id===l})})),2===h.find("option").length&&h.find("option:eq(1)").prop("selected",!0),h.val(h.find("option:selected").val()).trigger("change")}},n=function(){var b=e.val()?JSON.parse(e.val()).id:"";f(h),a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions.get_pixel_ids.name,_wpnonce:aepc_admin.actions.get_pixel_ids.nonce,account_id:b},success:function(a){c.hasOwnProperty("get_pixel_ids")||(c.get_pixel_ids={}),c.get_pixel_ids[b]=a,m(),g(h)},dataType:"json"})},o=function(a){if("undefined"!=typeof a&&a.hasOwnProperty("type")&&"change"===a.type&&(h.val("").trigger("change"),h.find("option").remove()),e.val()){var b=e.val()?JSON.parse(e.val()).id:"";c.hasOwnProperty("get_pixel_ids")&&c.get_pixel_ids.hasOwnProperty(b)?m():n()}},p=function(){if(c.hasOwnProperty("get_account_ids")){var b=a.merge([{id:"",text:""}],c.get_account_ids);e.find("option").remove(),e.append(a.map(b,function(b,c){return a("<option>",{val:b.id,text:b.text,selected:b.id===j})})),e.on("change",o).trigger("change")}},q=function(){f(e),a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions.get_account_ids.name,_wpnonce:aepc_admin.actions.get_account_ids.nonce},success:function(b){
15
- !1===b.success?(i(a(".js-options-group"),"error",b.data),k()):(c.get_account_ids=b,p()),g(e)},dataType:"json"})},r=function(){e.length<=0||(c.hasOwnProperty("get_account_ids")?p():q())};if(j&&l){var s=JSON.parse(j),t=JSON.parse(l);e.append(a("<option>",{val:j,text:s.name+" (#"+s.id+")",selected:!0})).trigger("change"),h.append(a("<option>",{val:l,text:t.name+" (#"+t.id+")",selected:!0})).trigger("change")}r(),o()},z=function(b,c){if(d.hasOwnProperty(b)&&aepc_admin.actions.hasOwnProperty("load_"+b)){var e=a(d[b]),g={action:aepc_admin.actions["load_"+b].name,_wpnonce:aepc_admin.actions["load_"+b].nonce};a.inArray(b,["sidebar"])<0&&h(a(".plugin-content"),"success"),f(e),window.location.href.slice(window.location.href.indexOf("?")+1).split("&").forEach(function(b){var c=b.split("=");a.inArray(c[0],["page","tab"])&&(g[c[0]]=c[1])}),"undefined"!=typeof c&&a.extend(g,c),a.ajax({url:aepc_admin.ajax_url,data:g,success:function(c){c.success&&(e.replaceWith(c.data.html),c.data.hasOwnProperty("messages")&&c.data.messages.hasOwnProperty("success")&&c.data.messages.success.hasOwnProperty("main")&&c.data.messages.success.main.forEach(function(b){i(a(".plugin-content .alert-wrap"),"success",b)}),p(),o(),r({currentTarget:d[b]}),w())},dataType:"json"})}};e(),x(),n(),q(),o(),y(),r(),u(),a(".modal-confirm").on("show.bs.modal",function(b){var c=a(this),d=b.hasOwnProperty("relatedTarget")?a(b.relatedTarget).attr("href"):"";a.inArray(d,["","#","#_"])<0&&c.one("click",".btn-ok",function(b){b.preventDefault();var e={"fb-disconnect":"fb_pixel_box","ca-delete":"ca_list","conversion-delete":"conversions_list"},h=d.match(new RegExp("action=("+Object.keys(e).join("|")+")(&|$)"));h?(f(c.find(".modal-content")),a.ajax({url:d+(d.indexOf("?")?"&":"?")+"ajax=1",method:"GET",success:function(b){if(b.success&&(a(".sec-overlay").removeClass("sec-overlay"),a(".sub-panel-fb-connect.bumping").removeClass("bumping"),z(e[h[1]]),c.modal("hide"),g(c.find(".modal-content")),window.history&&window.history.pushState)){var d=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:d},"",d)}},dataType:"json"})):(c.modal("hide"),window.location=d)})}),a(".js-new-filter-modal").on("click",".js-main-condition > .js-condition",function(){var b=a(this),c=b.closest(".js-main-condition"),d=c.find(".js-condition");d.removeClass("active"),b.addClass("active")}),a(".js-form-modal").on("show.bs.modal",function(b){if("undefined"==typeof wp)return b;var c=a(this),d=a(b.relatedTarget),e=d.data("config"),f=wp.template(c.attr("id"));c.find(".modal-content").html(f(e)),c.trigger("modal-template-loaded")}).on("show.bs.modal",q).on("show.bs.modal",o).on("show.bs.modal",n).on("show.bs.modal",r).on("show.bs.modal",t).on("show.bs.modal",u),a(document).on("submit",'form[data-toggle="ajax"]',function(b){b.preventDefault();var c=a(this),d=c,e=c.find('[type="submit"]'),j=e.text(),k=c.offset().top-50;c.find(".modal-body").length?d=c.find(".modal-body").first():c.find(".panel-body").length&&(d=c.find(".panel-body").first()),h(d,"error"),c.find(".has-error").removeClass("has-error"),c.find(".help-block-error").remove(),f(c),a.ajax({url:aepc_admin.ajax_url,method:"POST",data:c.serialize(),success:function(b){if(b.success){var f={"fb-connect-options":"fb_pixel_box","ca-clone":"ca_list","ca-edit":"ca_list","conversion-edit":"conversions_list"},h=Object.keys(f).map(function(a){return"#modal-"+a}).join(","),l={};if(c.closest(".modal").length&&c.closest(".modal").is(h)){if(z(f[c.closest(".modal").attr("id").replace("modal-","")]),c.closest(".modal").modal("hide"),g(c),window.history&&window.history.pushState){var m=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:m},"",m)}}else if(Object.keys(l).indexOf(c.data("action"))>=0)z(l[c.data("action")]),g(c);else{var n=c.attr("action");n?window.location.href=n:window.location.reload(!1)}}else{if(b.data.hasOwnProperty("refresh")&&b.data.refresh)return void(window.location.href=window.location.href.replace(/(\?|\&)ref=fblogin/,""));g(c),a("html, body").animate({scrollTop:k},300),e.text(j),b.data.hasOwnProperty("main")&&i(d,"error",b.data.main.join("<br/>")),c.find("input, select").each(function(){var c=a(this),d=c.attr("id"),e=c.closest(".form-group"),f=c.closest(".control-wrap").find(".field-helper");b.data.hasOwnProperty(d)&&(e.addClass("has-error"),f.append(a("<span />",{"class":"help-block help-block-error",html:b.data[d].join("<br/>")}))),c.on("keyup change",function(){f.find(".help-block-error").remove()})})}},dataType:"json"})}),a(window).on("load",w).on("scroll",w).on("resize",w),a("#modal-fb-connect-options").on("show.bs.modal",function(b){if("undefined"==typeof wp)return b;var c=a(this),d=wp.template("modal-facebook-options");c.find(".modal-content").html(d([])),c.trigger("facebook-options-loaded")}).on("show.bs.modal",q).on("show.bs.modal",o).on("show.bs.modal",y),a(".sub-panel-fb-connect").on("change","#aepc_account_id",function(){var b=a(this).val(),c=a("#aepc_pixel_id").val();b&&c?a(".js-save-facebook-options").removeClass("disabled"):a(".js-save-facebook-options").addClass("disabled")}).on("change","#aepc_pixel_id",function(){var b=a("#aepc_account_id").val(),c=a(this).val();b&&c?a(".js-save-facebook-options").removeClass("disabled"):a(".js-save-facebook-options").addClass("disabled")}).on("click",".js-save-facebook-options:not(.disabled)",function(b){var c=a("#aepc_account_id").val(),d=a("#aepc_pixel_id").val();a(".sec-overlay").removeClass("sec-overlay"),a(".sub-panel-fb-connect.bumping").removeClass("bumping"),f(a(".panel.panel-settings-set-fb-px")),a.ajax({url:aepc_admin.ajax_url,method:"POST",data:{aepc_account_id:c,aepc_pixel_id:d,action:aepc_admin.actions.save_facebook_options.name,_wpnonce:aepc_admin.actions.save_facebook_options.nonce},success:function(a){if(a.success){if(window.history&&window.history.pushState){var b=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:b},"",b)}z("fb_pixel_box"),k()}},dataType:"json"})}),a(".wrap-custom-audiences").on("click",".js-ca-size-sync",function(b){var c=a(this),d=c.data("ca_id");h(a(".plugin-content .alert-wrap"),"error"),f(a(".panel.panel-ca-list")),c.addClass("loading-data"),a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{ca_id:d,action:aepc_admin.actions.refresh_ca_size.name,_wpnonce:aepc_admin.actions.refresh_ca_size.nonce},success:function(b){b.success?z("ca_list"):i(a(".plugin-content .alert-wrap"),"error",b.data.message)},dataType:"json"})}),a(".wrap").on("click",".pagination li a",function(b){b.preventDefault();var c=a(this),d=c.attr("href"),e=d.match(/paged=([0-9]+)/);a(this).closest(".panel-ca-list").length?z("ca_list",{paged:e[1]}):a(this).closest(".panel-ce-tracking").length&&z("conversions_list",{paged:e[1]}),window.history&&window.history.pushState&&window.history.pushState({path:d},"",d)}),a(".plugin-sidebar.loading-sec").length&&z("sidebar");var A=[];a(".modal").on("show.bs.modal",function(a){A.push(a)}).on("hidden.bs.modal",function(b){a(A[A.length-1].relatedTarget).closest(".modal").length&&(a("body").addClass("modal-open"),A.splice(A.length-1,1))}),a("#aepc-clear-transients").on("click",function(b){b.preventDefault();var c=a(this);f(c),a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{action:aepc_admin.actions.clear_transients.name,_wpnonce:aepc_admin.actions.clear_transients.nonce},success:function(b){g(c),b.success&&i(a(".plugin-content .alert-wrap"),"success",b.data.message)},dataType:"json"})}),l()});
11
  l&&(g?g.animate(s):this.plotBackground=c.rect(o,p,q,r,0).attr({fill:l}).add().shadow(b.plotShadow)),m&&(i?i.animate(s):this.plotBGImage=c.image(m,o,p,q,r).add()),t?t.animate({width:u.width,height:u.height}):this.clipRect=c.clipRect(u),n&&(h?(h.strokeWidth=-n,h.animate(h.crisp({x:o,y:p,width:q,height:r}))):this.plotBorder=c.rect(o,p,q,r,0,-n).attr({stroke:b.plotBorderColor,"stroke-width":n,fill:"none",zIndex:1}).add()),this.isDirtyBox=!1},propFromSeries:function(){var a,b,c,d=this,e=d.options.chart,f=d.options.series;Ra(["inverted","angular","polar"],function(g){for(a=Oa[e.type||e.defaultSeriesType],c=d[g]||e[g]||a&&a.prototype[g],b=f&&f.length;!c&&b--;)(a=Oa[f[b].type])&&a.prototype[g]&&(c=!0);d[g]=c})},linkSeries:function(){var a=this,b=a.series;Ra(b,function(a){a.linkedSeries.length=0}),Ra(b,function(b){var c=b.options.linkedTo;f(c)&&(c=":previous"===c?a.series[b.index-1]:a.get(c))&&(c.linkedSeries.push(b),b.linkedParent=c,b.visible=cb(b.options.visible,c.options.visible,b.visible))})},renderSeries:function(){Ra(this.series,function(a){a.translate(),a.render()})},renderLabels:function(){var a=this,b=a.options.labels;b.items&&Ra(b.items,function(c){var d=_a(b.style,c.style),f=e(d.left)+a.plotLeft,g=e(d.top)+a.plotTop+12;delete d.left,delete d.top,a.renderer.text(c.html,f,g).attr({zIndex:2}).css(d).add()})},render:function(){var a,b,c,d,e=this.axes,f=this.renderer,g=this.options;this.setTitle(),this.legend=new sb(this,g.legend),this.getStacks&&this.getStacks(),this.getMargins(!0),this.setChartSize(),a=this.plotWidth,b=this.plotHeight-=21,Ra(e,function(a){a.setScale()}),this.getAxisMargins(),c=a/this.plotWidth>1.1,d=b/this.plotHeight>1.05,(c||d)&&(this.maxTicks=null,Ra(e,function(a){(a.horiz&&c||!a.horiz&&d)&&a.setTickInterval(!0)}),this.getMargins()),this.drawChartBox(),this.hasCartesianSeries&&Ra(e,function(a){a.visible&&a.render()}),this.seriesGroup||(this.seriesGroup=f.g("series-group").attr({zIndex:3}).add()),this.renderSeries(),this.renderLabels(),this.showCredits(g.credits),this.hasRendered=!0},showCredits:function(b){b.enabled&&!this.credits&&(this.credits=this.renderer.text(b.text,0,0).on("click",function(){b.href&&(a.location.href=b.href)}).attr({align:b.position.align,zIndex:8}).css(b.style).add().align(b.position))},destroy:function(){var a,b=this,c=b.axes,d=b.series,e=b.container,f=e&&e.parentNode;for(Xa(b,"destroy"),Ha[b.index]=K,Ia--,b.renderTo.removeAttribute("data-highcharts-chart"),Wa(b),a=c.length;a--;)c[a]=c[a].destroy();for(a=d.length;a--;)d[a]=d[a].destroy();Ra("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,pointer,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(a){var c=b[a];c&&c.destroy&&(b[a]=c.destroy())}),e&&(e.innerHTML="",Wa(e),f&&y(e));for(a in b)delete b[a]},isReadyToRender:function(){var b=this;return!(!Ba&&a==a.top&&"complete"!==ha.readyState||Da&&!a.canvg)||(Da?jb.push(function(){b.firstRender()},b.options.global.canvasToolsURL):ha.attachEvent("onreadystatechange",function(){ha.detachEvent("onreadystatechange",b.firstRender),"complete"===ha.readyState&&b.firstRender()}),!1)},firstRender:function(){var a=this,b=a.options;a.isReadyToRender()&&(a.getContainer(),Xa(a,"init"),a.resetMargins(),a.setChartSize(),a.propFromSeries(),a.getAxes(),Ra(b.series||[],function(b){a.initSeries(b)}),a.linkSeries(),Xa(a,"beforeRender"),ga.Pointer&&(a.pointer=new nb(a,b)),a.render(),a.renderer.draw(),!a.renderer.imgCount&&a.onload&&a.onload(),a.cloneRenderTo(!0))},onload:function(){var a=this;Ra([this.callback].concat(this.callbacks),function(b){b&&void 0!==a.index&&b.apply(a,[a])}),Xa(a,"load"),this.onload=null},splashArray:function(a,b){var c=b[a],c=ab(c)?c:[c,c,c,c];return[cb(b[a+"Top"],c[0]),cb(b[a+"Right"],c[1]),cb(b[a+"Bottom"],c[2]),cb(b[a+"Left"],c[3])]}};var ub=ga.CenteredSeriesMixin={getCenter:function(){var a,b,c=this.options,d=this.chart,e=2*(c.slicedOffset||0),f=d.plotWidth-2*e,d=d.plotHeight-2*e,g=c.center,g=[cb(g[0],"50%"),cb(g[1],"50%"),c.size||"100%",c.innerSize||0],h=na(f,d);for(a=0;a<4;++a)b=g[a],c=a<2||2===a&&/%$/.test(b),g[a]=(/%$/.test(b)?[f,d,h,g[2]][a]*parseFloat(b)/100:parseFloat(b))+(c?e:0);return g[3]>g[2]&&(g[3]=g[2]),g}},vb=function(){};vb.prototype={init:function(a,b,c){return this.series=a,this.color=a.color,this.applyOptions(b,c),this.pointAttr={},a.options.colorByPoint&&(b=a.options.colors||a.chart.options.colors,this.color=this.color||b[a.colorCounter++],a.colorCounter===b.length)&&(a.colorCounter=0),a.chart.pointCount++,this},applyOptions:function(a,b){var c=this.series,d=c.options.pointValKey||c.pointValKey,a=vb.prototype.optionsToObject.call(this,a);return _a(this,a),this.options=this.options?_a(this.options,a):a,d&&(this.y=this[d]),this.isNull=null===this.x||!bb(this.y,!0),void 0===this.x&&c&&(this.x=void 0===b?c.autoIncrement(this):b),c.xAxis&&c.xAxis.names&&(c.xAxis.names[this.x]=this.name),this},optionsToObject:function(a){var b={},c=this.series,d=c.options.keys,e=d||c.pointArrayMap||["y"],f=e.length,h=0,i=0;if(bb(a)||null===a)b[e[0]]=a;else if(g(a))for(!d&&a.length>f&&(c=typeof a[0],"string"===c?b.name=a[0]:"number"===c&&(b.x=a[0]),h++);i<f;)d&&void 0===a[h]||(b[e[i]]=a[h]),h++,i++;else"object"==typeof a&&(b=a,a.dataLabels&&(c._hasPointLabels=!0),a.marker&&(c._hasPointMarkers=!0));return b},destroy:function(){var a,b=this.series.chart,c=b.hoverPoints;b.pointCount--,c&&(this.setState(),h(c,this),!c.length)&&(b.hoverPoints=null),this===b.hoverPoint&&this.onMouseOut(),(this.graphic||this.dataLabel)&&(Wa(this),this.destroyElements()),this.legendItem&&b.legend.destroyItem(this);for(a in this)this[a]=null},destroyElements:function(){for(var a,b=["graphic","dataLabel","dataLabelUpper","connector","shadowGroup"],c=6;c--;)a=b[c],this[a]&&(this[a]=this[a].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,color:this.color,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},tooltipFormatter:function(a){var b=this.series,c=b.tooltipOptions,d=cb(c.valueDecimals,""),e=c.valuePrefix||"",f=c.valueSuffix||"";return Ra(b.pointArrayMap||["y"],function(b){b="{point."+b,(e||f)&&(a=a.replace(b+"}",e+b+"}"+f)),a=a.replace(b+"}",b+":,."+d+"f}")}),r(a,{point:this,series:this.series})},firePointEvent:function(a,b,c){var d=this,e=this.series.options;(e.point.events[a]||d.options&&d.options.events&&d.options.events[a])&&this.importEvents(),"click"===a&&e.allowPointSelect&&(c=function(a){d.select&&d.select(null,a.ctrlKey||a.metaKey||a.shiftKey)}),Xa(this,a,b,c)},visible:!0};var wb=ga.Series=function(){};wb.prototype={isCartesian:!0,type:"line",pointClass:vb,sorted:!0,requireSorting:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},directTouch:!1,axisTypes:["xAxis","yAxis"],colorCounter:0,parallelArrays:["x","y"],init:function(a,b){var c,d,e=this,f=a.series,g=function(a,b){return cb(a.options.index,a._i)-cb(b.options.index,b._i)};e.chart=a,e.options=b=e.setOptions(b),e.linkedSeries=[],e.bindAxes(),_a(e,{name:b.name,state:"",pointAttr:{},visible:b.visible!==!1,selected:b.selected===!0}),Da&&(b.animation=!1),d=b.events;for(c in d)Va(e,c,d[c]);(d&&d.click||b.point&&b.point.events&&b.point.events.click||b.allowPointSelect)&&(a.runTrackerClick=!0),e.getColor(),e.getSymbol(),Ra(e.parallelArrays,function(a){e[a+"Data"]=[]}),e.setData(b.data,!1),e.isCartesian&&(a.hasCartesianSeries=!0),f.push(e),e._i=f.length-1,u(f,g),this.yAxis&&u(this.yAxis.series,g),Ra(f,function(a,b){a.index=b,a.name=a.name||"Series "+(b+1)})},bindAxes:function(){var a,c=this,d=c.options,e=c.chart;Ra(c.axisTypes||[],function(f){Ra(e[f],function(b){a=b.options,(d[f]===a.index||d[f]!==K&&d[f]===a.id||d[f]===K&&0===a.index)&&(b.series.push(c),c[f]=b,b.isDirty=!0)}),!c[f]&&c.optionalAxis!==f&&b(18,!0)})},updateParallelArrays:function(a,b){var c=a.series,d=arguments,e=bb(b)?function(d){var e="y"===d&&c.toYData?c.toYData(a):a[d];c[d+"Data"][b]=e}:function(a){Array.prototype[b].apply(c[a+"Data"],Array.prototype.slice.call(d,2))};Ra(c.parallelArrays,e)},autoIncrement:function(a){var b,c,d=this.options,e=this.xIncrement,f=d.pointIntervalUnit,h=this.xAxis,e=cb(e,d.pointStart,0);return this.pointInterval=d=cb(this.pointInterval,d.pointInterval,1),h&&h.categories&&a.name&&(this.requireSorting=!1,b=(c=g(h.categories))?h.categories:h.names,h=b,a=Qa(a.name,h),a===-1?c||(e=h.length):e=a),f&&(a=new R(e),"day"===f?a=+a[da](a[Y]()+d):"month"===f?a=+a[ea](a[Z]()+d):"year"===f&&(a=+a[fa](a[$]()+d)),d=a-e),this.xIncrement=e+d,e},setOptions:function(a){var b=this.chart,c=b.options.plotOptions,b=b.userOptions||{},e=b.plotOptions||{},f=c[this.type];return this.userOptions=a,c=d(f,c.series,a),this.tooltipOptions=d(O.tooltip,O.plotOptions[this.type].tooltip,b.tooltip,e.series&&e.series.tooltip,e[this.type]&&e[this.type].tooltip,a.tooltip),null===f.marker&&delete c.marker,this.zoneAxis=c.zoneAxis,a=this.zones=(c.zones||[]).slice(),!c.negativeColor&&!c.negativeFillColor||c.zones||a.push({value:c[this.zoneAxis+"Threshold"]||c.threshold||0,color:c.negativeColor,fillColor:c.negativeFillColor}),a.length&&i(a[a.length-1].value)&&a.push({color:this.color,fillColor:this.fillColor}),c},getCyclic:function(a,b,c){var d=this.userOptions,e="_"+a+"Index",f=a+"Counter";b||(i(d[e])?b=d[e]:(d[e]=b=this.chart[f]%c.length,this.chart[f]+=1),b=c[b]),this[a]=b},getColor:function(){this.options.colorByPoint?this.options.color=null:this.getCyclic("color",this.options.color||eb[this.type].color,this.chart.options.colors)},getSymbol:function(){var a=this.options.marker;this.getCyclic("symbol",a.symbol,this.chart.options.symbols),/^url/.test(this.symbol)&&(a.radius=0)},drawLegendSymbol:ib.drawLineMarker,setData:function(a,c,d,e){var h,i=this,j=i.points,k=j&&j.length||0,l=i.options,m=i.chart,n=null,o=i.xAxis,p=l.turboThreshold,q=this.xData,r=this.yData,s=(h=i.pointArrayMap)&&h.length,a=a||[];if(h=a.length,c=cb(c,!0),e!==!1&&h&&k===h&&!i.cropped&&!i.hasGroupedData&&i.visible)Ra(a,function(a,b){j[b].update&&a!==l.data[b]&&j[b].update(a,!1,null,!1)});else{if(i.xIncrement=null,i.colorCounter=0,Ra(this.parallelArrays,function(a){i[a+"Data"].length=0}),p&&h>p){for(d=0;null===n&&d<h;)n=a[d],d++;if(bb(n)){for(n=cb(l.pointStart,0),s=cb(l.pointInterval,1),d=0;d<h;d++)q[d]=n,r[d]=a[d],n+=s;i.xIncrement=n}else if(g(n))if(s)for(d=0;d<h;d++)n=a[d],q[d]=n[0],r[d]=n.slice(1,s+1);else for(d=0;d<h;d++)n=a[d],q[d]=n[0],r[d]=n[1];else b(12)}else for(d=0;d<h;d++)a[d]!==K&&(n={series:i},i.pointClass.prototype.applyOptions.apply(n,[a[d]]),i.updateParallelArrays(n,d));for(f(r[0])&&b(14,!0),i.data=[],i.options.data=i.userOptions.data=a,d=k;d--;)j[d]&&j[d].destroy&&j[d].destroy();o&&(o.minRange=o.userMinRange),i.isDirty=i.isDirtyData=m.isDirtyBox=!0,d=!1}"point"===l.legendType&&(this.processData(),this.generatePoints()),c&&m.redraw(d)},processData:function(a){var c,d=this.xData,e=this.yData,f=d.length;c=0;var g,h,i,j=this.xAxis,k=this.options;i=k.cropThreshold;var l,m,n=this.getExtremesFromAll||k.getExtremesFromAll,o=this.isCartesian,k=j&&j.val2lin,p=j&&j.isLog;if(o&&!this.isDirty&&!j.isDirty&&!this.yAxis.isDirty&&!a)return!1;for(j&&(a=j.getExtremes(),l=a.min,m=a.max),o&&this.sorted&&!n&&(!i||f>i||this.forceCrop)&&(d[f-1]<l||d[0]>m?(d=[],e=[]):(d[0]<l||d[f-1]>m)&&(c=this.cropData(this.xData,this.yData,l,m),d=c.xData,e=c.yData,c=c.start,g=!0)),i=d.length||1;--i;)f=p?k(d[i])-k(d[i-1]):d[i]-d[i-1],f>0&&(h===K||f<h)?h=f:f<0&&this.requireSorting&&b(15);this.cropped=g,this.cropStart=c,this.processedXData=d,this.processedYData=e,this.closestPointRange=h},cropData:function(a,b,c,d){var e,f=a.length,g=0,h=f,i=cb(this.cropShoulder,1);for(e=0;e<f;e++)if(a[e]>=c){g=ma(0,e-i);break}for(c=e;c<f;c++)if(a[c]>d){h=c+i;break}return{xData:a.slice(g,h),yData:b.slice(g,h),start:g,end:h}},generatePoints:function(){var a,b,c,d,e=this.options.data,f=this.data,g=this.processedXData,h=this.processedYData,i=this.pointClass,j=g.length,l=this.cropStart||0,m=this.hasGroupedData,n=[];for(f||m||(f=[],f.length=e.length,f=this.data=f),d=0;d<j;d++)b=l+d,m?(n[d]=(new i).init(this,[g[d]].concat(k(h[d]))),n[d].dataGroup=this.groupMap[d]):(f[b]?c=f[b]:e[b]!==K&&(f[b]=c=(new i).init(this,e[b],g[d])),n[d]=c),n[d].index=b;if(f&&(j!==(a=f.length)||m))for(d=0;d<a;d++)d===l&&!m&&(d+=j),f[d]&&(f[d].destroyElements(),f[d].plotX=K);this.data=f,this.points=n},getExtremes:function(a){var b,c=this.yAxis,d=this.processedXData,e=[],f=0;b=this.xAxis.getExtremes();var g,h,i,j,k=b.min,l=b.max,a=a||this.stackedYData||this.processedYData||[];for(b=a.length,j=0;j<b;j++)if(h=d[j],i=a[j],g=null!==i&&i!==K&&(!c.isLog||i.length||i>0),h=this.getExtremesFromAll||this.options.getExtremesFromAll||this.cropped||(d[j+1]||h)>=k&&(d[j-1]||h)<=l,g&&h)if(g=i.length)for(;g--;)null!==i[g]&&(e[f++]=i[g]);else e[f++]=i;this.dataMin=v(e),this.dataMax=w(e)},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var a,c,d,e,f=this.options,g=f.stacking,h=this.xAxis,j=h.categories,k=this.yAxis,l=this.points,m=l.length,n=!!this.modifyValue,o=f.pointPlacement,p="between"===o||bb(o),q=f.threshold,r=f.startFromThreshold?q:0,s=Number.MAX_VALUE,f=0;f<m;f++){var t=l[f],u=t.x,v=t.y;c=t.low;var w,x=g&&k.stacks[(this.negStacks&&v<(r?0:q)?"-":"")+this.stackKey];k.isLog&&null!==v&&v<=0&&(t.y=v=null,b(10)),t.plotX=a=z(na(ma(-1e5,h.translate(u,0,0,0,1,o,"flags"===this.type)),1e5)),g&&this.visible&&!t.isNull&&x&&x[u]&&(e=this.getStackIndicator(e,u,this.index),w=x[u],v=w.points[e.key],c=v[0],v=v[1],c===r&&e.key===x[u].base&&(c=cb(q,k.min)),k.isLog&&c<=0&&(c=null),t.total=t.stackTotal=w.total,t.percentage=w.total&&t.y/w.total*100,t.stackY=v,w.setOffset(this.pointXOffset||0,this.barW||0)),t.yBottom=i(c)?k.translate(c,0,1,0,1):null,n&&(v=this.modifyValue(v,t)),t.plotY=c="number"==typeof v&&v!==1/0?na(ma(-1e5,k.translate(v,0,1,0,1)),1e5):K,t.isInside=c!==K&&c>=0&&c<=k.len&&a>=0&&a<=h.len,t.clientX=p?z(h.translate(u,0,0,0,1)):a,t.negative=t.y<(q||0),t.category=j&&j[t.x]!==K?j[t.x]:t.x,t.isNull||(void 0!==d&&(s=na(s,oa(a-d))),d=a)}this.closestPointRangePx=s},getValidPoints:function(a,b){var c=this.chart;return Sa(a||this.points||[],function(a){return!(b&&!c.isInsidePlot(a.plotX,a.plotY,c.inverted))&&!a.isNull})},setClip:function(a){var b=this.chart,c=this.options,d=b.renderer,e=b.inverted,f=this.clipBox,g=f||b.clipBox,h=this.sharedClipKey||["_sharedClip",a&&a.duration,a&&a.easing,g.height,c.xAxis,c.yAxis].join(","),i=b[h],j=b[h+"m"];i||(a&&(g.width=0,b[h+"m"]=j=d.clipRect(-99,e?-b.plotLeft:-b.plotTop,99,e?b.chartWidth:b.chartHeight)),b[h]=i=d.clipRect(g),i.count={length:0}),a&&!i.count[this.index]&&(i.count[this.index]=!0,i.count.length+=1),c.clip!==!1&&(this.group.clip(a||f?i:b.clipRect),this.markerGroup.clip(j),this.sharedClipKey=h),a||(i.count[this.index]&&(delete i.count[this.index],i.count.length-=1),0===i.count.length&&h&&b[h]&&(f||(b[h]=b[h].destroy()),b[h+"m"]&&(b[h+"m"]=b[h+"m"].destroy())))},animate:function(a){var b,c=this.chart,d=this.options.animation;d&&!ab(d)&&(d=eb[this.type].animation),a?this.setClip(d):(b=this.sharedClipKey,(a=c[b])&&a.animate({width:c.plotSizeX},d),c[b+"m"]&&c[b+"m"].animate({width:c.plotSizeX+99},d),this.animate=null)},afterAnimate:function(){this.setClip(),Xa(this,"afterAnimate")},drawPoints:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=this.points,n=this.chart,o=this.options.marker,p=this.pointAttr[""],q=this.markerGroup,r=cb(o.enabled,this.xAxis.isRadial,this.closestPointRangePx>2*o.radius);if(o.enabled!==!1||this._hasPointMarkers)for(d=m.length;d--;)e=m[d],b=ka(e.plotX),c=e.plotY,i=e.graphic,j=e.marker||{},k=!!e.marker,a=r&&j.enabled===K||j.enabled,l=e.isInside,a&&bb(c)&&null!==e.y?(a=e.pointAttr[e.selected?"select":""]||p,f=a.r,g=cb(j.symbol,this.symbol),h=0===g.indexOf("url"),i?i[l?"show":"hide"](!0).attr(a).animate(_a({x:b-f,y:c-f},i.symbolName?{width:2*f,height:2*f}:{})):l&&(f>0||h)&&(e.graphic=n.renderer.symbol(g,b-f,c-f,2*f,2*f,k?j:o).attr(a).add(q))):i&&(e.graphic=i.destroy())},convertAttribs:function(a,b,c,d){var e,f,g=this.pointAttrToOptions,h={},a=a||{},b=b||{},c=c||{},d=d||{};for(e in g)f=g[e],h[e]=cb(a[f],b[e],c[e],d[e]);return h},getAttribs:function(){var a,b,c,d=this,e=d.options,f=eb[d.type].marker?e.marker:e,g=f.states,h=g.hover,j=d.color,k=d.options.negativeColor,l={stroke:j,fill:j},m=d.points||[],n=[],o=d.pointAttrToOptions;a=d.hasPointSpecificOptions;var p=f.lineColor,q=f.fillColor;b=e.turboThreshold;var r,s,t=d.zones,u=d.zoneAxis||"y";if(e.marker?(h.radius=+h.radius||+f.radius+ +h.radiusPlus,h.lineWidth=h.lineWidth||f.lineWidth+h.lineWidthPlus):(h.color=h.color||D(h.color||j).brighten(h.brightness).get(),h.negativeColor=h.negativeColor||D(h.negativeColor||k).brighten(h.brightness).get()),n[""]=d.convertAttribs(f,l),Ra(["hover","select"],function(a){n[a]=d.convertAttribs(g[a],n[""])}),d.pointAttr=n,j=m.length,!b||j<b||a)for(;j--;){if(b=m[j],(f=b.options&&b.options.marker||b.options)&&f.enabled===!1&&(f.radius=0),l=null,t.length){for(a=0,l=t[a];b[u]>=l.value;)l=t[++a];b.color=b.fillColor=l=cb(l.color,d.color)}if(a=e.colorByPoint||b.color,b.options)for(s in o)i(f[o[s]])&&(a=!0);a?(f=f||{},c=[],g=f.states||{},a=g.hover=g.hover||{},e.marker&&(!b.negative||a.fillColor||h.fillColor)||(a[d.pointAttrToOptions.fill]=a.color||!b.options.color&&h[b.negative&&k?"negativeColor":"color"]||D(b.color).brighten(a.brightness||h.brightness).get()),r={color:b.color},q||(r.fillColor=b.color),p||(r.lineColor=b.color),f.hasOwnProperty("color")&&!f.color&&delete f.color,l&&!h.fillColor&&(a.fillColor=l),c[""]=d.convertAttribs(_a(r,f),n[""]),c.hover=d.convertAttribs(g.hover,n.hover,c[""]),c.select=d.convertAttribs(g.select,n.select,c[""])):c=n,b.pointAttr=c}},destroy:function(){var a,b,c,d,e=this,f=e.chart,g=/AppleWebKit\/533/.test(ta),i=e.data||[];for(Xa(e,"destroy"),Wa(e),Ra(e.axisTypes||[],function(a){(d=e[a])&&(h(d.series,e),d.isDirty=d.forceRedraw=!0)}),e.legendItem&&e.chart.legend.destroyItem(e),a=i.length;a--;)(b=i[a])&&b.destroy&&b.destroy();e.points=null,clearTimeout(e.animationTimeout);for(c in e)e[c]instanceof E&&!e[c].survive&&(a=g&&"group"===c?"hide":"destroy",e[c][a]());f.hoverSeries===e&&(f.hoverSeries=null),h(f.series,e);for(c in e)delete e[c]},getGraphPath:function(a,b,c){var d,e,f=this,g=f.options,h=g.step,j=[],k=[],a=a||f.points;return(d=a.reversed)&&a.reverse(),(h={right:1,center:2}[h]||h&&3)&&d&&(h=4-h),g.connectNulls&&!b&&!c&&(a=this.getValidPoints(a)),Ra(a,function(d,l){var m=d.plotX,n=d.plotY,o=a[l-1];(d.leftCliff||o&&o.rightCliff)&&!c&&(e=!0),d.isNull&&!i(b)&&l>0?e=!g.connectNulls:d.isNull&&!b?e=!0:(0===l||e?o=[Ka,d.plotX,d.plotY]:f.getPointSpline?o=f.getPointSpline(a,d,l):h?(o=1===h?[La,o.plotX,n]:2===h?[La,(o.plotX+m)/2,o.plotY,La,(o.plotX+m)/2,n]:[La,m,o.plotY],o.push(La,m,n)):o=[La,m,n],k.push(d.x),h&&k.push(d.x),j.push.apply(j,o),e=!1)}),j.xMap=k,f.graphPath=j},drawGraph:function(){var a=this,b=this.options,c=[["graph",b.lineColor||this.color,b.dashStyle]],d=b.lineWidth,e="square"!==b.linecap,f=(this.gappedPath||this.getGraphPath).call(this);Ra(this.zones,function(d,e){c.push(["zoneGraph"+e,d.color||a.color,d.dashStyle||b.dashStyle])}),Ra(c,function(c,g){var h=c[0],i=a[h];i?(i.endX=f.xMap,i.animate({d:f})):d&&f.length&&(i={stroke:c[1],"stroke-width":d,fill:"none",zIndex:1},c[2]?i.dashstyle=c[2]:e&&(i["stroke-linecap"]=i["stroke-linejoin"]="round"),i=a[h]=a.chart.renderer.path(f).attr(i).add(a.group).shadow(g<2&&b.shadow)),i&&(i.startX=f.xMap,i.isArea=f.isArea)})},applyZones:function(){var a,b,c,d,e,f,g,h=this,i=this.chart,j=i.renderer,k=this.zones,l=this.clips||[],m=this.graph,n=this.area,o=ma(i.chartWidth,i.chartHeight),p=this[(this.zoneAxis||"y")+"Axis"],q=p.reversed,r=i.inverted,s=p.horiz,t=!1;k.length&&(m||n)&&p.min!==K&&(m&&m.hide(),n&&n.hide(),d=p.getExtremes(),Ra(k,function(k,u){a=q?s?i.plotWidth:0:s?0:p.toPixels(d.min),a=na(ma(cb(b,a),0),o),b=na(ma(ja(p.toPixels(cb(k.value,d.max),!0)),0),o),t&&(a=b=p.toPixels(d.max)),e=Math.abs(a-b),f=na(a,b),g=ma(a,b),p.isXAxis?(c={x:r?g:f,y:0,width:e,height:o},s||(c.x=i.plotHeight-c.x)):(c={x:0,y:r?g:f,width:o,height:e},s&&(c.y=i.plotWidth-c.y)),i.inverted&&j.isVML&&(c=p.isXAxis?{x:0,y:q?f:g,height:c.width,width:i.chartWidth}:{x:c.y-i.plotLeft-i.spacingBox.x,y:0,width:c.height,height:i.chartHeight}),l[u]?l[u].animate(c):(l[u]=j.clipRect(c),m&&h["zoneGraph"+u].clip(l[u]),n&&h["zoneArea"+u].clip(l[u])),t=k.value>d.max}),this.clips=l)},invertGroups:function(){function a(){var a={width:b.yAxis.len,height:b.xAxis.len};Ra(["group","markerGroup"],function(c){b[c]&&b[c].attr(a).invert()})}var b=this,c=b.chart;b.xAxis&&(Va(c,"resize",a),Va(b,"destroy",function(){Wa(c,"resize",a)}),a(),b.invertGroups=a)},plotGroup:function(a,b,c,d,e){var f=this[a],g=!f;return g&&(this[a]=f=this.chart.renderer.g(b).attr({zIndex:d||.1}).add(e),f.addClass("highcharts-series-"+this.index)),f.attr({visibility:c})[g?"attr":"animate"](this.getPlotBox()),f},getPlotBox:function(){var a=this.chart,b=this.xAxis,c=this.yAxis;return a.inverted&&(b=c,c=this.xAxis),{translateX:b?b.left:a.plotLeft,translateY:c?c.top:a.plotTop,scaleX:1,scaleY:1}},render:function(){var a,b=this,c=b.chart,d=b.options,e=!!b.animate&&c.renderer.isSVG&&B(d.animation).duration,f=b.visible?"inherit":"hidden",g=d.zIndex,h=b.hasRendered,i=c.seriesGroup;a=b.plotGroup("group","series",f,g,i),b.markerGroup=b.plotGroup("markerGroup","markers",f,g,i),e&&b.animate(!0),b.getAttribs(),a.inverted=!!b.isCartesian&&c.inverted,b.drawGraph&&(b.drawGraph(),b.applyZones()),Ra(b.points,function(a){a.redraw&&a.redraw()}),b.drawDataLabels&&b.drawDataLabels(),b.visible&&b.drawPoints(),b.drawTracker&&b.options.enableMouseTracking!==!1&&b.drawTracker(),c.inverted&&b.invertGroups(),d.clip!==!1&&!b.sharedClipKey&&!h&&a.clip(c.clipRect),e&&b.animate(),h||(b.animationTimeout=l(function(){b.afterAnimate()},e)),b.isDirty=b.isDirtyData=!1,b.hasRendered=!0},redraw:function(){var a=this.chart,b=this.isDirty||this.isDirtyData,c=this.group,d=this.xAxis,e=this.yAxis;c&&(a.inverted&&c.attr({width:a.plotWidth,height:a.plotHeight}),c.animate({translateX:cb(d&&d.left,a.plotLeft),translateY:cb(e&&e.top,a.plotTop)})),this.translate(),this.render(),b&&delete this.kdTree},kdDimensions:1,kdAxisArray:["clientX","plotY"],searchPoint:function(a,b){var c=this.xAxis,d=this.yAxis,e=this.chart.inverted;return this.searchKDTree({clientX:e?c.len-a.chartY+c.pos:a.chartX-c.pos,plotY:e?d.len-a.chartX+d.pos:a.chartY-d.pos},b)},buildKDTree:function(){function a(c,d,e){var f,g;if(g=c&&c.length)return f=b.kdAxisArray[d%e],c.sort(function(a,b){return a[f]-b[f]}),g=Math.floor(g/2),{point:c[g],left:a(c.slice(0,g),d+1,e),right:a(c.slice(g+1),d+1,e)}}var b=this,c=b.kdDimensions;delete b.kdTree,l(function(){b.kdTree=a(b.getValidPoints(null,!b.directTouch),c,c)},b.options.kdNow?0:1)},searchKDTree:function(a,b){function c(a,b,h,j){var k,l,m=b.point,n=d.kdAxisArray[h%j],o=m;return l=i(a[e])&&i(m[e])?Math.pow(a[e]-m[e],2):null,k=i(a[f])&&i(m[f])?Math.pow(a[f]-m[f],2):null,k=(l||0)+(k||0),m.dist=i(k)?Math.sqrt(k):Number.MAX_VALUE,m.distX=i(l)?Math.sqrt(l):Number.MAX_VALUE,n=a[n]-m[n],k=n<0?"left":"right",l=n<0?"right":"left",b[k]&&(k=c(a,b[k],h+1,j),o=k[g]<o[g]?k:m),b[l]&&Math.sqrt(n*n)<o[g]&&(a=c(a,b[l],h+1,j),o=a[g]<o[g]?a:o),o}var d=this,e=this.kdAxisArray[0],f=this.kdAxisArray[1],g=b?"distX":"dist";if(this.kdTree||this.buildKDTree(),this.kdTree)return c(a,this.kdTree,this.kdDimensions,this.kdDimensions)}},G.prototype={destroy:function(){x(this,this.axis)},render:function(a){var b=this.options,c=b.format,c=c?r(c,this):b.formatter.call(this);this.label?this.label.attr({text:c,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(c,null,null,b.useHTML).css(b.style).attr({align:this.textAlign,rotation:b.rotation,visibility:"hidden"}).add(a)},setOffset:function(a,b){var c=this.axis,d=c.chart,e=d.inverted,f=c.reversed,f=this.isNegative&&!f||!this.isNegative&&f,g=c.translate(c.usePercentage?100:this.total,0,0,0,1),c=c.translate(0),c=oa(g-c),h=d.xAxis[0].translate(this.x)+a,i=d.plotHeight,f={x:e?f?g:g-c:h,y:e?i-h-b:f?i-g-c:i-g,width:e?c:b,height:e?b:c};(e=this.label)&&(e.align(this.alignOptions,null,f),f=e.alignAttr,e[this.options.crop===!1||d.isInsidePlot(f.x,f.y)?"show":"hide"](!0))}},tb.prototype.getStacks=function(){var a=this;Ra(a.yAxis,function(a){a.stacks&&a.hasVisibleSeries&&(a.oldStacks=a.stacks)}),Ra(a.series,function(b){!b.options.stacking||b.visible!==!0&&a.options.chart.ignoreHiddenSeries!==!1||(b.stackKey=b.type+cb(b.options.stack,""))})},kb.prototype.buildStacks=function(){var a,b,c=this.series,d=cb(this.options.reversedStacks,!0),e=c.length;if(!this.isXAxis){for(this.usePercentage=!1,b=e;b--;)c[d?b:e-b-1].setStackedPoints();for(b=e;b--;)a=c[d?b:e-b-1],a.setStackCliffs&&a.setStackCliffs();if(this.usePercentage)for(b=0;b<e;b++)c[b].setPercentStacks()}},kb.prototype.renderStackTotals=function(){var a,b,c=this.chart,d=c.renderer,e=this.stacks,f=this.stackTotalGroup;f||(this.stackTotalGroup=f=d.g("stack-labels").attr({visibility:"visible",zIndex:6}).add()),f.translate(c.plotLeft,c.plotTop);for(a in e)for(b in c=e[a])c[b].render(f)},kb.prototype.resetStacks=function(){var a,b,c=this.stacks;if(!this.isXAxis)for(a in c)for(b in c[a])c[a][b].touched<this.stacksTouched?(c[a][b].destroy(),delete c[a][b]):(c[a][b].total=null,c[a][b].cum=0)},kb.prototype.cleanStacks=function(){var a,b,c;if(!this.isXAxis){this.oldStacks&&(a=this.stacks=this.oldStacks);for(b in a)for(c in a[b])a[b][c].cum=a[b][c].total}},wb.prototype.setStackedPoints=function(){if(this.options.stacking&&(this.visible===!0||this.chart.options.chart.ignoreHiddenSeries===!1)){var a,b,c,d,e,f,g,h=this.processedXData,j=this.processedYData,k=[],l=j.length,m=this.options,n=m.threshold,o=m.startFromThreshold?n:0,p=m.stack,m=m.stacking,q=this.stackKey,r="-"+q,s=this.negStacks,t=this.yAxis,u=t.stacks,v=t.oldStacks;for(t.stacksTouched+=1,e=0;e<l;e++)f=h[e],g=j[e],a=this.getStackIndicator(a,f,this.index),d=a.key,c=(b=s&&g<(o?0:n))?r:q,u[c]||(u[c]={}),u[c][f]||(v[c]&&v[c][f]?(u[c][f]=v[c][f],u[c][f].total=null):u[c][f]=new G(t,t.options.stackLabels,b,f,p)),c=u[c][f],null!==g&&(c.points[d]=c.points[this.index]=[cb(c.cum,o)],i(c.cum)||(c.base=d),c.touched=t.stacksTouched,a.index>0&&this.singleStacks===!1&&(c.points[d][0]=c.points[this.index+","+f+",0"][0])),"percent"===m?(b=b?q:r,s&&u[b]&&u[b][f]?(b=u[b][f],c.total=b.total=ma(b.total,c.total)+oa(g)||0):c.total=z(c.total+(oa(g)||0))):c.total=z(c.total+(g||0)),c.cum=cb(c.cum,o)+(g||0),null!==g&&(c.points[d].push(c.cum),k[e]=c.cum);"percent"===m&&(t.usePercentage=!0),this.stackedYData=k,t.oldStacks={}}},wb.prototype.setPercentStacks=function(){var a,b=this,c=b.stackKey,d=b.yAxis.stacks,e=b.processedXData;Ra([c,"-"+c],function(c){for(var f,g,h,i=e.length;i--;)g=e[i],a=b.getStackIndicator(a,g,b.index),f=(h=d[c]&&d[c][g])&&h.points[a.key],(g=f)&&(h=h.total?100/h.total:0,g[0]=z(g[0]*h),g[1]=z(g[1]*h),b.stackedYData[i]=g[1])})},wb.prototype.getStackIndicator=function(a,b,c){return i(a)&&a.x===b?a.index++:a={x:b,index:0},a.key=[c,b,a.index].join(","),a},_a(tb.prototype,{addSeries:function(a,b,c){var d,e=this;return a&&(b=cb(b,!0),Xa(e,"addSeries",{options:a},function(){d=e.initSeries(a),e.isDirtyLegend=!0,e.linkSeries(),b&&e.redraw(c)})),d},addAxis:function(a,b,c,e){var f=b?"xAxis":"yAxis",g=this.options,a=d(a,{index:this[f].length,isX:b});new kb(this,a),g[f]=k(g[f]||{}),g[f].push(a),cb(c,!0)&&this.redraw(e)},showLoading:function(a){var b=this,c=b.options,d=b.loadingDiv,e=c.loading,f=function(){d&&m(d,{left:b.plotLeft+"px",top:b.plotTop+"px",width:b.plotWidth+"px",height:b.plotHeight+"px"})};d||(b.loadingDiv=d=n(Ja,{className:"highcharts-loading"},_a(e.style,{zIndex:10,display:"none"}),b.container),b.loadingSpan=n("span",null,e.labelStyle,d),Va(b,"redraw",f)),b.loadingSpan.innerHTML=a||c.lang.loading,b.loadingShown||(m(d,{opacity:0,display:""}),Ya(d,{opacity:e.style.opacity},{duration:e.showDuration||0}),b.loadingShown=!0),f()},hideLoading:function(){var a=this.options,b=this.loadingDiv;b&&Ya(b,{opacity:0},{duration:a.loading.hideDuration||100,complete:function(){m(b,{display:"none"})}}),this.loadingShown=!1}}),_a(vb.prototype,{update:function(a,b,c,d){function e(){g.applyOptions(a),null===g.y&&i&&(g.graphic=i.destroy()),ab(a,!0)&&(g.redraw=function(){i&&i.element&&a&&a.marker&&a.marker.symbol&&(g.graphic=i.destroy()),a&&a.dataLabels&&g.dataLabel&&(g.dataLabel=g.dataLabel.destroy()),g.redraw=null}),f=g.index,h.updateParallelArrays(g,f),l&&g.name&&(l[g.x]=g.name),k.data[f]=ab(k.data[f],!0)?g.options:a,h.isDirty=h.isDirtyData=!0,!h.fixedBox&&h.hasCartesianSeries&&(j.isDirtyBox=!0),"point"===k.legendType&&(j.isDirtyLegend=!0),b&&j.redraw(c)}var f,g=this,h=g.series,i=g.graphic,j=h.chart,k=h.options,l=h.xAxis&&h.xAxis.names,b=cb(b,!0);d===!1?e():g.firePointEvent("update",{options:a},e)},remove:function(a,b){this.series.removePoint(Qa(this,this.series.data),a,b)}}),_a(wb.prototype,{addPoint:function(a,b,c,d){var e,f,g,h=this.options,i=this.data,j=this.chart,k=this.xAxis&&this.xAxis.names,l=h.data,m=this.xData;if(A(d,j),b=cb(b,!0),d={series:this},this.pointClass.prototype.applyOptions.apply(d,[a]),g=d.x,f=m.length,this.requireSorting&&g<m[f-1])for(e=!0;f&&m[f-1]>g;)f--;this.updateParallelArrays(d,"splice",f,0,0),this.updateParallelArrays(d,f),k&&d.name&&(k[g]=d.name),l.splice(f,0,a),e&&(this.data.splice(f,0,null),this.processData()),"point"===h.legendType&&this.generatePoints(),c&&(i[0]&&i[0].remove?i[0].remove(!1):(i.shift(),this.updateParallelArrays(d,"shift"),l.shift())),this.isDirtyData=this.isDirty=!0,b&&(this.getAttribs(),j.redraw())},removePoint:function(a,b,c){var d=this,e=d.data,f=e[a],g=d.points,h=d.chart,i=function(){g&&g.length===e.length&&g.splice(a,1),e.splice(a,1),d.options.data.splice(a,1),d.updateParallelArrays(f||{series:d},"splice",a,1),f&&f.destroy(),d.isDirty=!0,d.isDirtyData=!0,b&&h.redraw()};A(c,h),b=cb(b,!0),f?f.firePointEvent("remove",null,i):i()},remove:function(a,b){var c=this,d=c.chart;Xa(c,"remove",null,function(){c.destroy(),d.isDirtyLegend=d.isDirtyBox=!0,d.linkSeries(),cb(a,!0)&&d.redraw(b)})},update:function(a,b){var c,e=this,f=this.chart,g=this.userOptions,h=this.type,i=Oa[h].prototype,j=["group","markerGroup","dataLabelsGroup"];(a.type&&a.type!==h||void 0!==a.zIndex)&&(j.length=0),Ra(j,function(a){j[a]=e[a],delete e[a]}),a=d(g,{animation:!1,index:this.index,pointStart:this.xData[0]},{data:this.options.data},a),this.remove(!1);for(c in i)this[c]=K;_a(this,Oa[a.type||h].prototype),Ra(j,function(a){e[a]=j[a]}),this.init(f,a),f.linkSeries(),cb(b,!0)&&f.redraw(!1)}}),_a(kb.prototype,{update:function(a,b){var c=this.chart,a=c.options[this.coll][this.options.index]=d(this.userOptions,a);this.destroy(!0),this.init(c,_a(a,{events:K})),c.isDirtyBox=!0,cb(b,!0)&&c.redraw()},remove:function(a){for(var b=this.chart,c=this.coll,d=this.series,e=d.length;e--;)d[e]&&d[e].remove(!1);h(b.axes,this),h(b[c],this),b.options[c].splice(this.options.index,1),Ra(b[c],function(a,b){a.options.index=b}),this.destroy(),b.isDirtyBox=!0,cb(a,!0)&&b.redraw()},setTitle:function(a,b){this.update({title:a},b)},setCategories:function(a,b){this.update({categories:a},b)}});var xb=o(wb);Oa.line=xb,eb.area=d(fb,{softThreshold:!1,threshold:0});var yb=o(wb,{type:"area",singleStacks:!1,getStackPoints:function(){var a,b,c,d=[],e=[],f=this.xAxis,g=this.yAxis,h=g.stacks[this.stackKey],i={},j=this.points,k=this.index,l=g.series,m=l.length,n=cb(g.options.reversedStacks,!0)?1:-1;if(this.options.stacking){for(b=0;b<j.length;b++)i[j[b].x]=j[b];for(c in h)null!==h[c].total&&e.push(c);e.sort(function(a,b){return a-b}),a=Ua(l,function(){return this.visible}),Ra(e,function(c,j){var l,o,p=0;if(i[c]&&!i[c].isNull)d.push(i[c]),Ra([-1,1],function(d){var f=1===d?"rightNull":"leftNull",g=0,p=h[e[j+d]];if(p)for(b=k;b>=0&&b<m;)l=p.points[b],l||(b===k?i[c][f]=!0:a[b]&&(o=h[c].points[b])&&(g-=o[1]-o[0])),b+=n;i[c][1===d?"rightCliff":"leftCliff"]=g});else{for(b=k;b>=0&&b<m;){if(l=h[c].points[b]){p=l[1];break}b+=n}p=g.toPixels(p,!0),d.push({isNull:!0,plotX:f.toPixels(c,!0),plotY:p,yBottom:p})}})}return d;
12
  },getGraphPath:function(a){var b,c,d,e,f=wb.prototype.getGraphPath,g=this.options,h=g.stacking,i=this.yAxis,j=[],k=[],l=this.index,m=i.stacks[this.stackKey],n=g.threshold,o=i.getThreshold(g.threshold),g=g.connectNulls||"percent"===h,p=function(b,c,e){var f,g,p=a[b],b=h&&m[p.x].points[l],q=p[e+"Null"]||0,e=p[e+"Cliff"]||0,p=!0;e||q?(f=(q?b[0]:b[1])+e,g=b[0]+e,p=!!q):!h&&a[c]&&a[c].isNull&&(f=g=n),void 0!==f&&(k.push({plotX:d,plotY:null===f?o:i.getThreshold(f),isNull:p}),j.push({plotX:d,plotY:null===g?o:i.getThreshold(g)}))},a=a||this.points;for(h&&(a=this.getStackPoints()),b=0;b<a.length;b++)c=a[b].isNull,d=cb(a[b].rectPlotX,a[b].plotX),e=cb(a[b].yBottom,o),(!c||g)&&(g||p(b,b-1,"left"),c&&!h&&g||(k.push(a[b]),j.push({x:b,plotX:d,plotY:e})),g||p(b,b+1,"right"));return b=f.call(this,k,!0,!0),j.reversed=!0,c=f.call(this,j,!0,!0),c.length&&(c[0]=La),c=b.concat(c),f=f.call(this,k,!1,g),c.xMap=b.xMap,this.areaPath=c,f},drawGraph:function(){this.areaPath=[],wb.prototype.drawGraph.apply(this);var a=this,b=this.areaPath,c=this.options,d=[["area",this.color,c.fillColor]];Ra(this.zones,function(b,e){d.push(["zoneArea"+e,b.color||a.color,b.fillColor||c.fillColor])}),Ra(d,function(d){var e=d[0],f=a[e];f?(f.endX=b.xMap,f.animate({d:b})):(f={fill:d[2]||d[1],zIndex:0},d[2]||(f["fill-opacity"]=cb(c.fillOpacity,.75)),f=a[e]=a.chart.renderer.path(b).attr(f).add(a.group),f.isArea=!0),f.startX=b.xMap,f.shiftUnit=c.step?2:1})},drawLegendSymbol:ib.drawRectangle});Oa.area=yb,eb.spline=d(fb),xb=o(wb,{type:"spline",getPointSpline:function(a,b,c){var d,e,f,g,h=b.plotX,i=b.plotY,j=a[c-1],c=a[c+1];if(j&&!j.isNull&&c&&!c.isNull){a=j.plotY,f=c.plotX;var c=c.plotY,k=0;d=(1.5*h+j.plotX)/2.5,e=(1.5*i+a)/2.5,f=(1.5*h+f)/2.5,g=(1.5*i+c)/2.5,f!==d&&(k=(g-e)*(f-h)/(f-d)+i-g),e+=k,g+=k,e>a&&e>i?(e=ma(a,i),g=2*i-e):e<a&&e<i&&(e=na(a,i),g=2*i-e),g>c&&g>i?(g=ma(c,i),e=2*i-g):g<c&&g<i&&(g=na(c,i),e=2*i-g),b.rightContX=f,b.rightContY=g}return b=["C",cb(j.rightContX,j.plotX),cb(j.rightContY,j.plotY),cb(d,h),cb(e,i),h,i],j.rightContX=j.rightContY=null,b}}),Oa.spline=xb,eb.areaspline=d(eb.area),yb=yb.prototype,xb=o(xb,{type:"areaspline",getStackPoints:yb.getStackPoints,getGraphPath:yb.getGraphPath,setStackCliffs:yb.setStackCliffs,drawGraph:yb.drawGraph,drawLegendSymbol:ib.drawRectangle}),Oa.areaspline=xb,eb.column=d(fb,{borderColor:"#FFFFFF",borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1,halo:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},softThreshold:!1,startFromThreshold:!0,stickyTracking:!1,tooltip:{distance:6},threshold:0}),xb=o(wb,{type:"column",pointAttrToOptions:{stroke:"borderColor",fill:"color",r:"borderRadius"},cropShoulder:0,directTouch:!0,trackerGroups:["group","dataLabelsGroup"],negStacks:!0,init:function(){wb.prototype.init.apply(this,arguments);var a=this,b=a.chart;b.hasRendered&&Ra(b.series,function(b){b.type===a.type&&(b.isDirty=!0)})},getColumnMetrics:function(){var a,b=this,c=b.options,d=b.xAxis,e=b.yAxis,f=d.reversed,g={},h=0;c.grouping===!1?h=1:Ra(b.chart.series,function(c){var d,f=c.options,i=c.yAxis;c.type===b.type&&c.visible&&e.len===i.len&&e.pos===i.pos&&(f.stacking?(a=c.stackKey,g[a]===K&&(g[a]=h++),d=g[a]):f.grouping!==!1&&(d=h++),c.columnIndex=d)});var i=na(oa(d.transA)*(d.ordinalSlope||c.pointRange||d.closestPointRange||d.tickInterval||1),d.len),j=i*c.groupPadding,k=(i-2*j)/h,c=na(c.maxPointWidth||d.len,cb(c.pointWidth,k*(1-2*c.pointPadding)));return b.columnMetrics={width:c,offset:(k-c)/2+(j+((b.columnIndex||0)+(f?1:0))*k-i/2)*(f?-1:1)},b.columnMetrics},crispCol:function(a,b,c,d){var e=this.chart,f=this.borderWidth,g=-(f%2?.5:0),f=f%2?.5:1;return e.inverted&&e.renderer.isVML&&(f+=1),c=Math.round(a+c)+g,a=Math.round(a)+g,c-=a,d=Math.round(b+d)+f,g=oa(b)<=.5&&d>.5,b=Math.round(b)+f,d-=b,g&&d&&(b-=1,d+=1),{x:a,y:b,width:c,height:d}},translate:function(){var a=this,b=a.chart,c=a.options,d=a.borderWidth=cb(c.borderWidth,a.closestPointRange*a.xAxis.transA<2?0:1),e=a.yAxis,f=a.translatedThreshold=e.getThreshold(c.threshold),g=cb(c.minPointLength,5),h=a.getColumnMetrics(),i=h.width,j=a.barW=ma(i,1+2*d),k=a.pointXOffset=h.offset;b.inverted&&(f-=.5),c.pointPadding&&(j=la(j)),wb.prototype.translate.apply(a),Ra(a.points,function(c){var d,h=na(cb(c.yBottom,f),9e4),l=999+oa(h),l=na(ma(-l,c.plotY),e.len+l),m=c.plotX+k,n=j,o=na(l,h),p=ma(l,h)-o;oa(p)<g&&g&&(p=g,d=!e.reversed&&!c.negative||e.reversed&&c.negative,o=oa(o-f)>g?h-g:f-(d?g:0)),c.barX=m,c.pointWidth=i,c.tooltipPos=b.inverted?[e.len+e.pos-b.plotLeft-l,a.xAxis.len-m-n/2,p]:[m+n/2,l+e.pos-b.plotTop,p],c.shapeType="rect",c.shapeArgs=a.crispCol(m,o,n,p)})},getSymbol:Ga,drawLegendSymbol:ib.drawRectangle,drawGraph:Ga,drawPoints:function(){var a,b,c=this,e=this.chart,f=c.options,g=e.renderer,h=f.animationLimit||250;Ra(c.points,function(j){var k,l=j.graphic;bb(j.plotY)&&null!==j.y?(a=j.shapeArgs,k=i(c.borderWidth)?{"stroke-width":c.borderWidth}:{},b=j.pointAttr[j.selected?"select":""]||c.pointAttr[""],l?(Za(l),l.attr(k).attr(b)[e.pointCount<h?"animate":"attr"](d(a))):j.graphic=g[j.shapeType](a).attr(k).attr(b).add(j.group||c.group).shadow(f.shadow,null,f.stacking&&!f.borderRadius)):l&&(j.graphic=l.destroy())})},animate:function(a){var b=this,c=this.yAxis,d=b.options,e=this.chart.inverted,f={};Ba&&(a?(f.scaleY=.001,a=na(c.pos+c.len,ma(c.pos,c.toPixels(d.threshold))),e?f.translateX=a-c.len:f.translateY=a,b.group.attr(f)):(f[e?"translateX":"translateY"]=c.pos,b.group.animate(f,_a(B(b.options.animation),{step:function(a,c){b.group.attr({scaleY:ma(.001,c.pos)})}})),b.animate=null))},remove:function(){var a=this,b=a.chart;b.hasRendered&&Ra(b.series,function(b){b.type===a.type&&(b.isDirty=!0)}),wb.prototype.remove.apply(a,arguments)}}),Oa.column=xb,eb.bar=d(eb.column),yb=o(xb,{type:"bar",inverted:!0}),Oa.bar=yb,eb.scatter=d(fb,{lineWidth:0,marker:{enabled:!0},tooltip:{headerFormat:'<span style="color:{point.color}">●</span> <span style="font-size: 10px;"> {series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}}),yb=o(wb,{type:"scatter",sorted:!1,requireSorting:!1,noSharedTooltip:!0,trackerGroups:["group","markerGroup","dataLabelsGroup"],takeOrdinalPosition:!1,kdDimensions:2,drawGraph:function(){this.options.lineWidth&&wb.prototype.drawGraph.call(this)}}),Oa.scatter=yb,eb.pie=d(fb,{borderColor:"#FFFFFF",borderWidth:1,center:[null,null],clip:!1,colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return null===this.y?void 0:this.point.name},x:0},ignoreHiddenPoint:!0,legendType:"point",marker:null,size:null,showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}},stickyTracking:!1,tooltip:{followPointer:!0}}),fb={type:"pie",isCartesian:!1,pointClass:o(vb,{init:function(){vb.prototype.init.apply(this,arguments);var a,b=this;return b.name=cb(b.name,"Slice"),a=function(a){b.slice("select"===a.type)},Va(b,"select",a),Va(b,"unselect",a),b},setVisible:function(a,b){var c=this,d=c.series,e=d.chart,f=d.options.ignoreHiddenPoint,b=cb(b,f);a!==c.visible&&(c.visible=c.options.visible=a=a===K?!c.visible:a,d.options.data[Qa(c,d.data)]=c.options,Ra(["graphic","dataLabel","connector","shadowGroup"],function(b){c[b]&&c[b][a?"show":"hide"](!0)}),c.legendItem&&e.legend.colorizeItem(c,a),!a&&"hover"===c.state&&c.setState(""),f&&(d.isDirty=!0),b&&e.redraw())},slice:function(a,b,c){var d=this.series;A(c,d.chart),cb(b,!0),this.sliced=this.options.sliced=a=i(a)?a:!this.sliced,d.options.data[Qa(this,d.data)]=this.options,a=a?this.slicedTranslation:{translateX:0,translateY:0},this.graphic.animate(a),this.shadowGroup&&this.shadowGroup.animate(a)},haloPath:function(a){var b=this.shapeArgs,c=this.series.chart;return this.sliced||!this.visible?[]:this.series.chart.renderer.symbols.arc(c.plotLeft+b.x,c.plotTop+b.y,b.r+a,b.r+a,{innerR:this.shapeArgs.r,start:b.start,end:b.end})}}),requireSorting:!1,directTouch:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],axisTypes:[],pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},animate:function(a){var b=this,c=b.points,d=b.startAngleRad;a||(Ra(c,function(a){var c=a.graphic,e=a.shapeArgs;c&&(c.attr({r:a.startR||b.center[3]/2,start:d,end:d}),c.animate({r:e.r,start:e.start,end:e.end},b.options.animation))}),b.animate=null)},updateTotals:function(){var a,b,c=0,d=this.points,e=d.length,f=this.options.ignoreHiddenPoint;for(a=0;a<e;a++)b=d[a],b.y<0&&(b.y=null),c+=f&&!b.visible?0:b.y;for(this.total=c,a=0;a<e;a++)b=d[a],b.percentage=c>0&&(b.visible||!f)?b.y/c*100:0,b.total=c},generatePoints:function(){wb.prototype.generatePoints.call(this),this.updateTotals()},translate:function(a){this.generatePoints();var b,c,d,e,f,g=0,h=this.options,i=h.slicedOffset,j=i+h.borderWidth,k=h.startAngle||0,l=this.startAngleRad=ra/180*(k-90),k=(this.endAngleRad=ra/180*(cb(h.endAngle,k+360)-90))-l,m=this.points,n=h.dataLabels.distance,h=h.ignoreHiddenPoint,o=m.length;for(a||(this.center=a=this.getCenter()),this.getX=function(b,c){return d=ia.asin(na((b-a[1])/(a[2]/2+n),1)),a[0]+(c?-1:1)*pa(d)*(a[2]/2+n)},e=0;e<o;e++)f=m[e],b=l+g*k,h&&!f.visible||(g+=f.percentage/100),c=l+g*k,f.shapeType="arc",f.shapeArgs={x:a[0],y:a[1],r:a[2]/2,innerR:a[3]/2,start:ja(1e3*b)/1e3,end:ja(1e3*c)/1e3},d=(c+b)/2,d>1.5*ra?d-=2*ra:d<-ra/2&&(d+=2*ra),f.slicedTranslation={translateX:ja(pa(d)*i),translateY:ja(qa(d)*i)},b=pa(d)*a[2]/2,c=qa(d)*a[2]/2,f.tooltipPos=[a[0]+.7*b,a[1]+.7*c],f.half=d<-ra/2||d>ra/2?1:0,f.angle=d,j=na(j,n/2),f.labelPos=[a[0]+b+pa(d)*n,a[1]+c+qa(d)*n,a[0]+b+pa(d)*j,a[1]+c+qa(d)*j,a[0]+b,a[1]+c,n<0?"center":f.half?"right":"left",d]},drawGraph:null,drawPoints:function(){var a,b,c,d,e,f,g=this,h=g.chart.renderer,i=g.options.shadow;i&&!g.shadowGroup&&(g.shadowGroup=h.g("shadow").add(g.group)),Ra(g.points,function(j){null!==j.y&&(b=j.graphic,e=j.shapeArgs,c=j.shadowGroup,d=j.pointAttr[j.selected?"select":""],d.stroke||(d.stroke=d.fill),i&&!c&&(c=j.shadowGroup=h.g("shadow").add(g.shadowGroup)),a=j.sliced?j.slicedTranslation:{translateX:0,translateY:0},c&&c.attr(a),b?b.setRadialReference(g.center).attr(d).animate(_a(e,a)):(f={"stroke-linejoin":"round"},j.visible||(f.visibility="hidden"),j.graphic=b=h[j.shapeType](e).setRadialReference(g.center).attr(d).attr(f).attr(a).add(g.group).shadow(i,c)))})},searchPoint:Ga,sortByAngle:function(a,b){a.sort(function(a,c){return void 0!==a.angle&&(c.angle-a.angle)*b})},drawLegendSymbol:ib.drawRectangle,getCenter:ub.getCenter,getSymbol:Ga},fb=o(wb,fb),Oa.pie=fb,wb.prototype.drawDataLabels=function(){var a,b,c,e,f=this,g=f.options,h=g.cursor,j=g.dataLabels,k=f.points,l=f.hasRendered||0,m=cb(j.defer,!0),n=f.chart.renderer;(j.enabled||f._hasPointLabels)&&(f.dlProcessOptions&&f.dlProcessOptions(j),e=f.plotGroup("dataLabelsGroup","data-labels",m&&!l?"hidden":"visible",j.zIndex||6),m&&(e.attr({opacity:+l}),l||Va(f,"afterAnimate",function(){f.visible&&e.show(!0),e[g.animation?"animate":"attr"]({opacity:1},{duration:200})})),b=j,Ra(k,function(k){var l,m,o,p,q=k.dataLabel,s=k.connector,t=!0,u={};if(a=k.dlOptions||k.options&&k.options.dataLabels,l=cb(a&&a.enabled,b.enabled)&&null!==k.y,q&&!l)k.dataLabel=q.destroy();else if(l){if(j=d(b,a),p=j.style,l=j.rotation,m=k.getLabelConfig(),c=j.format?r(j.format,m):j.formatter.call(m,j),p.color=cb(j.color,p.color,f.color,"black"),q)i(c)?(q.attr({text:c}),t=!1):(k.dataLabel=q=q.destroy(),s&&(k.connector=s.destroy()));else if(i(c)){q={fill:j.backgroundColor,stroke:j.borderColor,"stroke-width":j.borderWidth,r:j.borderRadius||0,rotation:l,padding:j.padding,zIndex:1},"contrast"===p.color&&(u.color=j.inside||j.distance<0||g.stacking?n.getContrast(k.color||f.color):"#000000"),h&&(u.cursor=h);for(o in q)q[o]===K&&delete q[o];q=k.dataLabel=n[l?"text":"label"](c,0,-9999,j.shape,null,null,j.useHTML).attr(q).css(_a(p,u)).add(e).shadow(j.shadow)}q&&f.alignDataLabel(k,q,j,null,t)}}))},wb.prototype.alignDataLabel=function(a,b,c,d,e){var f=this.chart,g=f.inverted,h=cb(a.plotX,-9999),i=cb(a.plotY,-9999),j=b.getBBox(),k=f.renderer.fontMetrics(c.style.fontSize).b,l=c.rotation,m=c.align,n=this.visible&&(a.series.forceDL||f.isInsidePlot(h,ja(i),g)||d&&f.isInsidePlot(h,g?d.x+1:d.y+d.height-1,g)),o="justify"===cb(c.overflow,"justify");n&&(d=_a({x:g?f.plotWidth-i:h,y:ja(g?f.plotHeight-h:i),width:0,height:0},d),_a(c,{width:j.width,height:j.height}),l?(o=!1,g=f.renderer.rotCorr(k,l),g={x:d.x+c.x+d.width/2+g.x,y:d.y+c.y+{top:0,middle:.5,bottom:1}[c.verticalAlign]*d.height},b[e?"attr":"animate"](g).attr({align:m}),h=(l+720)%360,h=h>180&&h<360,"left"===m?g.y-=h?j.height:0:"center"===m?(g.x-=j.width/2,g.y-=j.height/2):"right"===m&&(g.x-=j.width,g.y-=h?0:j.height)):(b.align(c,null,d),g=b.alignAttr),o?this.justifyDataLabel(b,c,g,j,d,e):cb(c.crop,!0)&&(n=f.isInsidePlot(g.x,g.y)&&f.isInsidePlot(g.x+j.width,g.y+j.height)),c.shape&&!l&&b.attr({anchorX:a.plotX,anchorY:a.plotY})),n||(Za(b),b.attr({y:-9999}),b.placed=!1)},wb.prototype.justifyDataLabel=function(a,b,c,d,e,f){var g,h,i=this.chart,j=b.align,k=b.verticalAlign,l=a.box?0:a.padding||0;g=c.x+l,g<0&&("right"===j?b.align="left":b.x=-g,h=!0),g=c.x+d.width-l,g>i.plotWidth&&("left"===j?b.align="right":b.x=i.plotWidth-g,h=!0),g=c.y+l,g<0&&("bottom"===k?b.verticalAlign="top":b.y=-g,h=!0),g=c.y+d.height-l,g>i.plotHeight&&("top"===k?b.verticalAlign="bottom":b.y=i.plotHeight-g,h=!0),h&&(a.placed=!f,a.align(b,null,e))},Oa.pie&&(Oa.pie.prototype.drawDataLabels=function(){var a,b,c,d,e,f,g,h,i,j,k,l=this,m=l.data,n=l.chart,o=l.options.dataLabels,p=cb(o.connectorPadding,10),q=cb(o.connectorWidth,1),r=n.plotWidth,s=n.plotHeight,t=cb(o.softConnector,!0),u=o.distance,v=l.center,x=v[2]/2,y=v[1],z=u>0,A=[[],[]],B=[0,0,0,0],C=function(a,b){return b.y-a.y};if(l.visible&&(o.enabled||l._hasPointLabels)){for(wb.prototype.drawDataLabels.apply(l),Ra(m,function(a){a.dataLabel&&a.visible&&(A[a.half].push(a),a.dataLabel._pos=null)}),j=2;j--;){var D,E=[],F=[],G=A[j],H=G.length;if(H){for(l.sortByAngle(G,j-.5),k=m=0;!m&&G[k];)m=G[k]&&G[k].dataLabel&&(G[k].dataLabel.getBBox().height||21),k++;if(u>0){for(e=na(y+x+u,n.plotHeight),k=ma(0,y-x-u);k<=e;k+=m)E.push(k);if(e=E.length,H>e){for(a=[].concat(G),a.sort(C),k=H;k--;)a[k].rank=k;for(k=H;k--;)G[k].rank>=e&&G.splice(k,1);H=G.length}for(k=0;k<H;k++){a=G[k],f=a.labelPos,a=9999;var I,J;for(J=0;J<e;J++)I=oa(E[J]-f[1]),I<a&&(a=I,D=J);if(D<k&&null!==E[k])D=k;else for(e<H-k+D&&null!==E[k]&&(D=e-H+k);null===E[D];)D++;F.push({i:D,y:E[D]}),E[D]=null}F.sort(C)}for(k=0;k<H;k++)a=G[k],f=a.labelPos,d=a.dataLabel,i=a.visible===!1?"hidden":"inherit",a=f[1],u>0?(e=F.pop(),D=e.i,h=e.y,(a>h&&null!==E[D+1]||a<h&&null!==E[D-1])&&(h=na(ma(0,a),n.plotHeight))):h=a,g=o.justify?v[0]+(j?-1:1)*(x+u):l.getX(h===y-x-u||h===y+x+u?a:h,j),d._attr={visibility:i,align:f[6]},d._pos={x:g+o.x+({left:p,right:-p}[f[6]]||0),y:h+o.y-10},d.connX=g,d.connY=h,null===this.options.size&&(e=d.width,g-e<p?B[3]=ma(ja(e-g+p),B[3]):g+e>r-p&&(B[1]=ma(ja(g+e-r+p),B[1])),h-m/2<0?B[0]=ma(ja(-h+m/2),B[0]):h+m/2>s&&(B[2]=ma(ja(h+m/2-s),B[2])))}}(0===w(B)||this.verifyDataLabelOverflow(B))&&(this.placeDataLabels(),z&&q&&Ra(this.points,function(a){b=a.connector,f=a.labelPos,(d=a.dataLabel)&&d._pos&&a.visible?(i=d._attr.visibility,g=d.connX,h=d.connY,c=t?[Ka,g+("left"===f[6]?5:-5),h,"C",g,h,2*f[2]-f[4],2*f[3]-f[5],f[2],f[3],La,f[4],f[5]]:[Ka,g+("left"===f[6]?5:-5),h,La,f[2],f[3],La,f[4],f[5]],b?(b.animate({d:c}),b.attr("visibility",i)):a.connector=b=l.chart.renderer.path(c).attr({"stroke-width":q,stroke:o.connectorColor||a.color||"#606060",visibility:i}).add(l.dataLabelsGroup)):b&&(a.connector=b.destroy())}))}},Oa.pie.prototype.placeDataLabels=function(){Ra(this.points,function(a){var b=a.dataLabel;b&&a.visible&&((a=b._pos)?(b.attr(b._attr),b[b.moved?"animate":"attr"](a),b.moved=!0):b&&b.attr({y:-9999}))})},Oa.pie.prototype.alignDataLabel=Ga,Oa.pie.prototype.verifyDataLabelOverflow=function(a){var b,c=this.center,d=this.options,e=d.center,f=d.minSize||80,g=f;return null!==e[0]?g=ma(c[2]-ma(a[1],a[3]),f):(g=ma(c[2]-a[1]-a[3],f),c[0]+=(a[3]-a[1])/2),null!==e[1]?g=ma(na(g,c[2]-ma(a[0],a[2])),f):(g=ma(na(g,c[2]-a[0]-a[2]),f),c[1]+=(a[0]-a[2])/2),g<c[2]?(c[2]=g,c[3]=Math.min(/%$/.test(d.innerSize||0)?g*parseFloat(d.innerSize||0)/100:parseFloat(d.innerSize||0),g),this.translate(c),this.drawDataLabels&&this.drawDataLabels()):b=!0,b}),Oa.column&&(Oa.column.prototype.alignDataLabel=function(a,b,c,e,f){var g=this.chart.inverted,h=a.series,i=a.dlBox||a.shapeArgs,j=cb(a.below,a.plotY>cb(this.translatedThreshold,h.yAxis.len)),k=cb(c.inside,!!this.options.stacking);i&&(e=d(i),e.y<0&&(e.height+=e.y,e.y=0),i=e.y+e.height-h.yAxis.len,i>0&&(e.height-=i),g&&(e={x:h.yAxis.len-e.y-e.height,y:h.xAxis.len-e.x-e.width,width:e.height,height:e.width}),k||(g?(e.x+=j?0:e.width,e.width=0):(e.y+=j?e.height:0,e.height=0))),c.align=cb(c.align,!g||k?"center":j?"right":"left"),c.verticalAlign=cb(c.verticalAlign,g||k?"middle":j?"top":"bottom"),wb.prototype.alignDataLabel.call(this,a,b,c,e,f)}),function(a){var b=a.Chart,c=a.each,d=a.pick,e=a.addEvent;b.prototype.callbacks.push(function(a){function b(){var b=[];c(a.series,function(a){var e=a.options.dataLabels,f=a.dataLabelCollections||["dataLabel"];(e.enabled||a._hasPointLabels)&&!e.allowOverlap&&a.visible&&c(f,function(e){c(a.points,function(a){a[e]&&(a[e].labelrank=d(a.labelrank,a.shapeArgs&&a.shapeArgs.height),b.push(a[e]))})})}),a.hideOverlappingLabels(b)}b(),e(a,"redraw",b)}),b.prototype.hideOverlappingLabels=function(a){var b,d,e,f,g,h,i,j,k,l=a.length;for(d=0;d<l;d++)(b=a[d])&&(b.oldOpacity=b.opacity,b.newOpacity=1);for(a.sort(function(a,b){return(b.labelrank||0)-(a.labelrank||0)}),d=0;d<l;d++)for(e=a[d],b=d+1;b<l;++b)f=a[b],e&&f&&e.placed&&f.placed&&0!==e.newOpacity&&0!==f.newOpacity&&(g=e.alignAttr,h=f.alignAttr,i=e.parentGroup,j=f.parentGroup,k=2*(e.box?0:e.padding),g=!(h.x+j.translateX>g.x+i.translateX+(e.width-k)||h.x+j.translateX+(f.width-k)<g.x+i.translateX||h.y+j.translateY>g.y+i.translateY+(e.height-k)||h.y+j.translateY+(f.height-k)<g.y+i.translateY))&&((e.labelrank<f.labelrank?e:f).newOpacity=0);c(a,function(a){var b,c;a&&(c=a.newOpacity,a.oldOpacity!==c&&a.placed&&(c?a.show(!0):b=function(){a.hide()},a.alignAttr.opacity=c,a[a.isOld?"animate":"attr"](a.alignAttr,null,b)),a.isOld=!0)})}}(ga);var zb=ga.TrackerMixin={drawTrackerPoint:function(){var a=this,b=a.chart,c=b.pointer,d=a.options.cursor,e=d&&{cursor:d},f=function(a){for(var c,d=a.target;d&&!c;)c=d.point,d=d.parentNode;c!==K&&c!==b.hoverPoint&&c.onMouseOver(a)};Ra(a.points,function(a){a.graphic&&(a.graphic.element.point=a),a.dataLabel&&(a.dataLabel.element.point=a)}),a._hasTracking||(Ra(a.trackerGroups,function(b){a[b]&&(a[b].addClass("highcharts-tracker").on("mouseover",f).on("mouseout",function(a){c.onTrackerMouseOut(a)}).css(e),M)&&a[b].on("touchstart",f)}),a._hasTracking=!0)},drawTrackerGraph:function(){var a=this,b=a.options,c=b.trackByArea,d=[].concat(c?a.areaPath:a.graphPath),e=d.length,f=a.chart,g=f.pointer,h=f.renderer,i=f.options.tooltip.snap,j=a.tracker,k=b.cursor,l=k&&{cursor:k},m=function(){f.hoverSeries!==a&&a.onMouseOver()},n="rgba(192,192,192,"+(Ba?1e-4:.002)+")";if(e&&!c)for(k=e+1;k--;)d[k]===Ka&&d.splice(k+1,0,d[k+1]-i,d[k+2],La),(k&&d[k]===Ka||k===e)&&d.splice(k,0,La,d[k-2]+i,d[k-1]);j?j.attr({d:d}):(a.tracker=h.path(d).attr({"stroke-linejoin":"round",visibility:a.visible?"visible":"hidden",stroke:n,fill:c?n:"none","stroke-width":b.lineWidth+(c?0:2*i),zIndex:2}).add(a.group),Ra([a.tracker,a.markerGroup],function(a){a.addClass("highcharts-tracker").on("mouseover",m).on("mouseout",function(a){g.onTrackerMouseOut(a)}).css(l),M&&a.on("touchstart",m)}))}};Oa.column&&(xb.prototype.drawTracker=zb.drawTrackerPoint),Oa.pie&&(Oa.pie.prototype.drawTracker=zb.drawTrackerPoint),Oa.scatter&&(yb.prototype.drawTracker=zb.drawTrackerPoint),_a(sb.prototype,{setItemEvents:function(a,b,c,d,e){var f=this;(c?b:a.legendGroup).on("mouseover",function(){a.setState("hover"),b.css(f.options.itemHoverStyle)}).on("mouseout",function(){b.css(a.visible?d:e),a.setState()}).on("click",function(b){var c=function(){a.setVisible&&a.setVisible()},b={browserEvent:b};a.firePointEvent?a.firePointEvent("legendItemClick",b,c):Xa(a,"legendItemClick",b,c)})},createCheckboxForItem:function(a){a.checkbox=n("input",{type:"checkbox",checked:a.selected,defaultChecked:a.selected},this.options.itemCheckboxStyle,this.chart.container),Va(a.checkbox,"click",function(b){Xa(a.series||a,"checkboxClick",{checked:b.target.checked,item:a},function(){a.select()})})}}),O.legend.itemStyle.cursor="pointer",_a(tb.prototype,{showResetZoom:function(){var a=this,b=O.lang,c=a.options.chart.resetZoomButton,d=c.theme,e=d.states,f="chart"===c.relativeTo?null:"plotBox";this.resetZoomButton=a.renderer.button(b.resetZoom,null,null,function(){a.zoomOut()},d,e&&e.hover).attr({align:c.position.align,title:b.resetZoomTitle}).add().align(c.position,!1,f)},zoomOut:function(){var a=this;Xa(a,"selection",{resetSelection:!0},function(){a.zoom()})},zoom:function(a){var b,c,d=this.pointer,e=!1;!a||a.resetSelection?Ra(this.axes,function(a){b=a.zoom()}):Ra(a.xAxis.concat(a.yAxis),function(a){var c=a.axis,f=c.isXAxis;(d[f?"zoomX":"zoomY"]||d[f?"pinchX":"pinchY"])&&(b=c.zoom(a.min,a.max),c.displayBtn&&(e=!0))}),c=this.resetZoomButton,e&&!c?this.showResetZoom():!e&&ab(c)&&(this.resetZoomButton=c.destroy()),b&&this.redraw(cb(this.options.chart.animation,a&&a.animation,this.pointCount<100))},pan:function(a,b){var c,d=this,e=d.hoverPoints;e&&Ra(e,function(a){a.setState()}),Ra("xy"===b?[1,0]:[1],function(b){var b=d[b?"xAxis":"yAxis"][0],e=b.horiz,f=a[e?"chartX":"chartY"],e=e?"mouseDownX":"mouseDownY",g=d[e],h=(b.pointRange||0)/2,i=b.getExtremes(),j=b.toValue(g-f,!0)+h,h=b.toValue(g+b.len-f,!0)-h,g=g>f;b.series.length&&(g||j>na(i.dataMin,i.min))&&(!g||h<ma(i.dataMax,i.max))&&(b.setExtremes(j,h,!1,!1,{trigger:"pan"}),c=!0),d[e]=f}),c&&d.redraw(!1),m(d.container,{cursor:"move"})}}),_a(vb.prototype,{select:function(a,b){var c=this,d=c.series,e=d.chart,a=cb(a,!c.selected);c.firePointEvent(a?"select":"unselect",{accumulate:b},function(){c.selected=c.options.selected=a,d.options.data[Qa(c,d.data)]=c.options,c.setState(a&&"select"),b||Ra(e.getSelectedPoints(),function(a){a.selected&&a!==c&&(a.selected=a.options.selected=!1,d.options.data[Qa(a,d.data)]=a.options,a.setState(""),a.firePointEvent("unselect"))})})},onMouseOver:function(a,b){var c=this.series,d=c.chart,e=d.tooltip,f=d.hoverPoint;d.hoverSeries!==c&&c.onMouseOver(),f&&f!==this&&f.onMouseOut(),this.series&&(this.firePointEvent("mouseOver"),e&&(!e.shared||c.noSharedTooltip)&&e.refresh(this,a),this.setState("hover"),!b)&&(d.hoverPoint=this)},onMouseOut:function(){var a=this.series.chart,b=a.hoverPoints;this.firePointEvent("mouseOut"),b&&Qa(this,b)!==-1||(this.setState(),a.hoverPoint=null)},importEvents:function(){if(!this.hasImportedEvents){var a,b=d(this.series.options.point,this.options).events;this.events=b;for(a in b)Va(this,a,b[a]);this.hasImportedEvents=!0}},setState:function(a,b){var c,e=ka(this.plotX),f=this.plotY,g=this.series,h=g.options.states,i=eb[g.type].marker&&g.options.marker,j=i&&!i.enabled,k=i&&i.states[a],l=k&&k.enabled===!1,m=g.stateMarkerGraphic,n=this.marker||{},o=g.chart,p=g.halo,a=a||"";c=this.pointAttr[a]||g.pointAttr[a],a===this.state&&!b||this.selected&&"select"!==a||h[a]&&h[a].enabled===!1||a&&(l||j&&k.enabled===!1)||a&&n.states&&n.states[a]&&n.states[a].enabled===!1||(this.graphic?(i=i&&this.graphic.symbolName&&c.r,this.graphic.attr(d(c,i?{x:e-i,y:f-i,width:2*i,height:2*i}:{})),m&&m.hide()):(a&&k&&(i=k.radius,n=n.symbol||g.symbol,m&&m.currentSymbol!==n&&(m=m.destroy()),m?m[b?"animate":"attr"]({x:e-i,y:f-i}):n&&(g.stateMarkerGraphic=m=o.renderer.symbol(n,e-i,f-i,2*i,2*i).attr(c).add(g.markerGroup),m.currentSymbol=n)),m&&(m[a&&o.isInsidePlot(e,f,o.inverted)?"show":"hide"](),m.element.point=this)),(e=h[a]&&h[a].halo)&&e.size?(p||(g.halo=p=o.renderer.path().add(o.seriesGroup)),p.attr(_a({fill:this.color||g.color,"fill-opacity":e.opacity,zIndex:-1},e.attributes))[b?"animate":"attr"]({d:this.haloPath(e.size)})):p&&p.attr({d:[]}),this.state=a)},haloPath:function(a){var b=this.series,c=b.chart,d=b.getPlotBox(),e=c.inverted,f=Math.floor(this.plotX);return c.renderer.symbols.circle(d.translateX+(e?b.yAxis.len-this.plotY:f)-a,d.translateY+(e?b.xAxis.len-f:this.plotY)-a,2*a,2*a)}}),_a(wb.prototype,{onMouseOver:function(){var a=this.chart,b=a.hoverSeries;b&&b!==this&&b.onMouseOut(),this.options.events.mouseOver&&Xa(this,"mouseOver"),this.setState("hover"),a.hoverSeries=this},onMouseOut:function(){var a=this.options,b=this.chart,c=b.tooltip,d=b.hoverPoint;b.hoverSeries=null,d&&d.onMouseOut(),this&&a.events.mouseOut&&Xa(this,"mouseOut"),c&&!a.stickyTracking&&(!c.shared||this.noSharedTooltip)&&c.hide(),this.setState()},setState:function(a){var b=this.options,c=this.graph,d=b.states,e=b.lineWidth,b=0,a=a||"";if(this.state!==a&&(this.state=a,!(d[a]&&d[a].enabled===!1)&&(a&&(e=d[a].lineWidth||e+(d[a].lineWidthPlus||0)),c&&!c.dashstyle)))for(a={"stroke-width":e},c.attr(a);this["zoneGraph"+b];)this["zoneGraph"+b].attr(a),b+=1},setVisible:function(a,b){var c,d=this,e=d.chart,f=d.legendItem,g=e.options.chart.ignoreHiddenSeries,h=d.visible;c=(d.visible=a=d.userOptions.visible=a===K?!h:a)?"show":"hide",Ra(["group","dataLabelsGroup","markerGroup","tracker"],function(a){d[a]&&d[a][c]()}),e.hoverSeries!==d&&(e.hoverPoint&&e.hoverPoint.series)!==d||d.onMouseOut(),f&&e.legend.colorizeItem(d,a),d.isDirty=!0,d.options.stacking&&Ra(e.series,function(a){a.options.stacking&&a.visible&&(a.isDirty=!0)}),Ra(d.linkedSeries,function(b){b.setVisible(a,!1)}),g&&(e.isDirtyBox=!0),b!==!1&&e.redraw(),Xa(d,c)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(a){this.selected=a=a===K?!this.selected:a,this.checkbox&&(this.checkbox.checked=a),Xa(this,a?"select":"unselect")},drawTracker:zb.drawTrackerGraph}),db(wb.prototype,"init",function(a){var b;a.apply(this,Array.prototype.slice.call(arguments,1)),(b=this.xAxis)&&b.options.ordinal&&Va(this,"updatedData",function(){delete b.ordinalIndex})}),db(kb.prototype,"getTimeTicks",function(a,b,c,d,e,f,g,h){var j,k,l,m,n,o=0,p={},q=[],r=-Number.MAX_VALUE,s=this.options.tickPixelInterval;if(!this.options.ordinal&&!this.options.breaks||!f||f.length<3||c===K)return a.call(this,b,c,d,e);for(m=f.length,j=0;j<m;j++){if(n=j&&f[j-1]>d,f[j]<c&&(o=j),j===m-1||f[j+1]-f[j]>5*g||n){if(f[j]>r){for(k=a.call(this,b,f[o],f[j],e);k.length&&k[0]<=r;)k.shift();k.length&&(r=k[k.length-1]),q=q.concat(k)}o=j+1}if(n)break}if(a=k.info,h&&a.unitRange<=Q.hour){for(j=q.length-1,o=1;o<j;o++)P("%d",q[o])!==P("%d",q[o-1])&&(p[q[o]]="day",l=!0);l&&(p[q[0]]="day"),a.higherRanks=p}if(q.info=a,h&&i(s)){h=a=q.length,j=[];var t;for(l=[];h--;)o=this.translate(q[h]),t&&(l[h]=t-o),j[h]=t=o;for(l.sort(),l=l[ka(l.length/2)],l<.6*s&&(l=null),h=q[a-1]>d?a-1:a,t=void 0;h--;)o=j[h],d=t-o,t&&d<.8*s&&(null===l||d<.8*l)?(p[q[h]]&&!p[q[h+1]]?(d=h+1,t=o):d=h,q.splice(d,1)):t=o}return q}),_a(kb.prototype,{beforeSetTickPositions:function(){var a,b,c,d=[],e=!1,f=this.getExtremes(),g=f.min,h=f.max,i=this.isXAxis&&!!this.options.breaks;if((f=this.options.ordinal)||i){if(Ra(this.series,function(b,c){if(b.visible!==!1&&(b.takeOrdinalPosition!==!1||i)&&(d=d.concat(b.processedXData),a=d.length,d.sort(function(a,b){return a-b}),a))for(c=a-1;c--;)d[c]===d[c+1]&&d.splice(c,1)}),a=d.length,a>2){for(b=d[1]-d[0],c=a-1;c--&&!e;)d[c+1]-d[c]!==b&&(e=!0);!this.options.keepOrdinalPadding&&(d[0]-g>b||h-d[d.length-1]>b)&&(e=!0)}e?(this.ordinalPositions=d,b=this.val2lin(ma(g,d[0]),!0),c=ma(this.val2lin(na(h,d[d.length-1]),!0),1),this.ordinalSlope=h=(h-g)/(c-b),this.ordinalOffset=g-b*h):this.ordinalPositions=this.ordinalSlope=this.ordinalOffset=K}this.isOrdinal=f&&e,this.groupIntervalFactor=null},val2lin:function(a,b){var c,d=this.ordinalPositions;if(d){var e,f=d.length;for(c=f;c--;)if(d[c]===a){e=c;break}for(c=f-1;c--;)if(a>d[c]||0===c){d=(a-d[c])/(d[c+1]-d[c]),e=c+d;break}c=b?e:this.ordinalSlope*(e||0)+this.ordinalOffset}else c=a;return c},lin2val:function(a,b){var c=this.ordinalPositions;if(c){var d,e,f=this.ordinalSlope,g=this.ordinalOffset,h=c.length-1;if(b)a<0?a=c[0]:a>h?a=c[h]:(h=ka(a),e=a-h);else for(;h--;)if(d=f*h+g,a>=d){f=f*(h+1)+g,e=(a-d)/(f-d);break}c=e!==K&&c[h]!==K?c[h]+(e?e*(c[h+1]-c[h]):0):a}else c=a;return c},getExtendedPositions:function(){var a,b,c=this.chart,d=this.series[0].currentDataGrouping,e=this.ordinalIndex,f=d?d.count+d.unitName:"raw",g=this.getExtremes();return e||(e=this.ordinalIndex={}),e[f]||(a={series:[],getExtremes:function(){return{min:g.dataMin,max:g.dataMax}},options:{ordinal:!0},val2lin:kb.prototype.val2lin},Ra(this.series,function(e){b={xAxis:a,xData:e.xData,chart:c,destroyGroupedData:Ga},b.options={dataGrouping:d?{enabled:!0,forced:!0,approximation:"open",units:[[d.unitName,[d.count]]]}:{enabled:!1}},e.processData.apply(b),a.series.push(b)}),this.beforeSetTickPositions.apply(a),e[f]=a.ordinalPositions),e[f]},getGroupIntervalFactor:function(a,b,c){var d,c=c.processedXData,e=c.length,f=[];if(d=this.groupIntervalFactor,!d){for(d=0;d<e-1;d++)f[d]=c[d+1]-c[d];f.sort(function(a,b){return a-b}),f=f[ka(e/2)],a=ma(a,c[0]),b=na(b,c[e-1]),this.groupIntervalFactor=d=e*f/(b-a)}return d},postProcessTickInterval:function(a){var b=this.ordinalSlope;return b?this.options.breaks?this.closestPointRange:a/(b/this.closestPointRange):a}}),db(tb.prototype,"pan",function(a,b){var c=this.xAxis[0],d=b.chartX,e=!1;if(c.options.ordinal&&c.series.length){var f,g=this.mouseDownX,h=c.getExtremes(),i=h.dataMax,j=h.min,k=h.max,l=this.hoverPoints,n=c.closestPointRange,g=(g-d)/(c.translationSlope*(c.ordinalSlope||n)),o={ordinalPositions:c.getExtendedPositions()},n=c.lin2val,p=c.val2lin;o.ordinalPositions?oa(g)>1&&(l&&Ra(l,function(a){a.setState()}),g<0?(l=o,f=c.ordinalPositions?c:o):(l=c.ordinalPositions?c:o,f=o),o=f.ordinalPositions,i>o[o.length-1]&&o.push(i),this.fixedRange=k-j,g=c.toFixedRange(null,null,n.apply(l,[p.apply(l,[j,!0])+g,!0]),n.apply(f,[p.apply(f,[k,!0])+g,!0])),g.min>=na(h.dataMin,j)&&g.max<=ma(i,k)&&c.setExtremes(g.min,g.max,!0,!1,{trigger:"pan"}),this.mouseDownX=d,m(this.container,{cursor:"move"})):e=!0}else e=!0;e&&a.apply(this,Array.prototype.slice.call(arguments,1))}),wb.prototype.gappedPath=function(){var a=this.options.gapSize,b=this.points.slice(),c=b.length-1;if(a&&c>0)for(;c--;)b[c+1].x-b[c].x>this.closestPointRange*a&&b.splice(c+1,0,{isNull:!0});return this.getGraphPath(b)},function(a){a(ga)}(function(a){function b(){return Array.prototype.slice.call(arguments,1)}function c(a){a.apply(this),this.drawBreaks(this.xAxis,["x"]),this.drawBreaks(this.yAxis,d(this.pointArrayMap,["y"]))}var d=a.pick,e=a.wrap,f=a.each,g=a.extend,h=a.fireEvent,i=a.Axis,j=a.Series;g(i.prototype,{isInBreak:function(a,b){var c=a.repeat||1/0,d=a.from,e=a.to-a.from,c=b>=d?(b-d)%c:c-(d-b)%c;return a.inclusive?c<=e:c<e&&0!==c},isInAnyBreak:function(a,b){var c,e,f,g=this.options.breaks,h=g&&g.length;if(h){for(;h--;)this.isInBreak(g[h],a)&&(c=!0,e||(e=d(g[h].showPoints,!this.isXAxis)));f=c&&b?c&&!e:c}return f}}),e(i.prototype,"setTickPositions",function(a){if(a.apply(this,Array.prototype.slice.call(arguments,1)),this.options.breaks){var b,c=this.tickPositions,d=this.tickPositions.info,e=[];for(b=0;b<c.length;b++)this.isInAnyBreak(c[b])||e.push(c[b]);this.tickPositions=e,this.tickPositions.info=d}}),e(i.prototype,"init",function(a,b,c){if(c.breaks&&c.breaks.length&&(c.ordinal=!1),a.call(this,b,c),this.options.breaks){var d=this;d.isBroken=!0,this.val2lin=function(a){var b,c,e=a;for(c=0;c<d.breakArray.length;c++)if(b=d.breakArray[c],b.to<=a)e-=b.len;else{if(b.from>=a)break;if(d.isInBreak(b,a)){e-=a-b.from;break}}return e},this.lin2val=function(a){var b,c;for(c=0;c<d.breakArray.length&&(b=d.breakArray[c],!(b.from>=a));c++)b.to<a?a+=b.len:d.isInBreak(b,a)&&(a+=b.len);return a},this.setExtremes=function(a,b,c,d,e){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(b);)b-=this.closestPointRange;i.prototype.setExtremes.call(this,a,b,c,d,e);
13
  },this.setAxisTranslation=function(a){i.prototype.setAxisTranslation.call(this,a);var b,c,e,f,g=d.options.breaks,a=[],j=[],k=0,l=d.userMin||d.min,m=d.userMax||d.max;for(f in g)c=g[f],b=c.repeat||1/0,d.isInBreak(c,l)&&(l+=c.to%b-l%b),d.isInBreak(c,m)&&(m-=m%b-c.from%b);for(f in g){for(c=g[f],e=c.from,b=c.repeat||1/0;e-b>l;)e-=b;for(;e<l;)e+=b;for(;e<m;e+=b)a.push({value:e,move:"in"}),a.push({value:e+(c.to-c.from),move:"out",size:c.breakSize})}a.sort(function(a,b){return a.value===b.value?("in"===a.move?0:1)-("in"===b.move?0:1):a.value-b.value}),g=0,e=l;for(f in a)c=a[f],g+="in"===c.move?1:-1,1===g&&"in"===c.move&&(e=c.value),0===g&&(j.push({from:e,to:c.value,len:c.value-e-(c.size||0)}),k+=c.value-e-(c.size||0));d.breakArray=j,h(d,"afterBreaks"),d.transA*=(m-d.min)/(m-l-k),d.min=l,d.max=m}}}),e(j.prototype,"generatePoints",function(a){a.apply(this,b(arguments));var c,d,e=this.xAxis,f=this.yAxis,g=this.points,h=g.length,i=this.options.connectNulls;if(e&&f&&(e.options.breaks||f.options.breaks))for(;h--;)c=g[h],d=null===c.y&&i===!1,d||!e.isInAnyBreak(c.x,!0)&&!f.isInAnyBreak(c.y,!0)||(g.splice(h,1),this.data[h]&&this.data[h].destroyElements())}),a.Series.prototype.drawBreaks=function(a,b){var c,e,g,i,j=this,k=j.points;f(b,function(b){c=a.breakArray||[],e=a.isXAxis?a.min:d(j.options.threshold,a.min),f(k,function(j){i=d(j["stack"+b.toUpperCase()],j[b]),f(c,function(b){g=!1,e<b.from&&i>b.to||e>b.from&&i<b.from?g="pointBreak":(e<b.from&&i>b.from&&i<b.to||e>b.from&&i>b.to&&i<b.from)&&(g="pointInBreak"),g&&h(a,g,{point:j,brk:b})})})})},e(a.seriesTypes.column.prototype,"drawPoints",c),e(a.Series.prototype,"drawPoints",c)});var Ab=wb.prototype,Bb=Ab.processData,Cb=Ab.generatePoints,Db=Ab.destroy,Eb={approximation:"average",groupPixelWidth:2,dateTimeLabelFormats:{millisecond:["%A, %b %e, %H:%M:%S.%L","%A, %b %e, %H:%M:%S.%L","-%H:%M:%S.%L"],second:["%A, %b %e, %H:%M:%S","%A, %b %e, %H:%M:%S","-%H:%M:%S"],minute:["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],hour:["%A, %b %e, %H:%M","%A, %b %e, %H:%M","-%H:%M"],day:["%A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],week:["Week from %A, %b %e, %Y","%A, %b %e","-%A, %b %e, %Y"],month:["%B %Y","%B","-%B %Y"],year:["%Y","%Y","-%Y"]}},Fb={line:{},spline:{},area:{},areaspline:{},column:{approximation:"sum",groupPixelWidth:10},arearange:{approximation:"range"},areasplinerange:{approximation:"range"},columnrange:{approximation:"range",groupPixelWidth:10},candlestick:{approximation:"ohlc",groupPixelWidth:10},ohlc:{approximation:"ohlc",groupPixelWidth:5}},Gb=[["millisecond",[1,2,5,10,20,25,50,100,200,500]],["second",[1,2,5,10,15,30]],["minute",[1,2,5,10,15,30]],["hour",[1,2,3,4,6,8,12]],["day",[1]],["week",[1]],["month",[1,3,6]],["year",null]],Hb={sum:function(a){var b,c=a.length;if(!c&&a.hasNulls)b=null;else if(c)for(b=0;c--;)b+=a[c];return b},average:function(a){var b=a.length,a=Hb.sum(a);return bb(a)&&b&&(a/=b),a},open:function(a){return a.length?a[0]:a.hasNulls?null:K},high:function(a){return a.length?w(a):a.hasNulls?null:K},low:function(a){return a.length?v(a):a.hasNulls?null:K},close:function(a){return a.length?a[a.length-1]:a.hasNulls?null:K},ohlc:function(a,b,c,d){if(a=Hb.open(a),b=Hb.high(b),c=Hb.low(c),d=Hb.close(d),bb(a)||bb(b)||bb(c)||bb(d))return[a,b,c,d]},range:function(a,b){if(a=Hb.low(a),b=Hb.high(b),bb(a)||bb(b))return[a,b]}};Ab.groupData=function(a,b,c,d){var e,f,g,h=this.data,i=this.options.data,j=[],k=[],l=[],m=a.length,n=!!b,o=[[],[],[],[]],d="function"==typeof d?d:Hb[d],p=this.pointArrayMap,q=p&&p.length,r=0,s=0;for(g=0;g<=m&&!(a[g]>=c[0]);g++);for(;g<=m;g++){for(;(void 0!==c[r+1]&&a[g]>=c[r+1]||g===m)&&(e=c[r],f=d.apply(0,o),f!==K&&(j.push(e),k.push(f),l.push({start:s,length:o[0].length})),s=g,o[0]=[],o[1]=[],o[2]=[],o[3]=[],r+=1,g!==m););if(g===m)break;if(p){e=this.cropStart+g,e=h&&h[e]||this.pointClass.prototype.applyOptions.apply({series:this},[i[e]]);var t;for(f=0;f<q;f++)t=e[p[f]],bb(t)?o[f].push(t):null===t&&(o[f].hasNulls=!0)}else e=n?b[g]:null,bb(e)?o[0].push(e):null===e&&(o[0].hasNulls=!0)}return[j,k,l]},Ab.processData=function(){var a,b=this.chart,c=this.options.dataGrouping,d=this.allowDG!==!1&&c&&cb(c.enabled,b.options._stock);if(this.forceCrop=d,this.groupPixelWidth=null,this.hasProcessed=!0,Bb.apply(this,arguments)!==!1&&d){this.destroyGroupedData();var e=this.processedXData,f=this.processedYData,g=b.plotSizeX,b=this.xAxis,h=b.options.ordinal,j=this.groupPixelWidth=b.getGroupPixelWidth&&b.getGroupPixelWidth();if(j){a=!0,this.points=null;var k=b.getExtremes(),d=k.min,k=k.max,h=h&&b.getGroupIntervalFactor(d,k,this)||1,g=j*(k-d)/g*h,j=b.getTimeTicks(b.normalizeTimeTickInterval(g,c.units||Gb),Math.min(d,e[0]),Math.max(k,e[e.length-1]),b.options.startOfWeek,e,this.closestPointRange),e=Ab.groupData.apply(this,[e,f,j,c.approximation]),f=e[0],h=e[1];if(c.smoothed){for(c=f.length-1,f[c]=Math.min(f[c],k);c--&&c>0;)f[c]+=g/2;f[0]=Math.max(f[0],d)}this.currentDataGrouping=j.info,this.closestPointRange=j.info.totalRange,this.groupMap=e[2],i(f[0])&&f[0]<b.dataMin&&(b.min===b.dataMin&&(b.min=f[0]),b.dataMin=f[0]),this.processedXData=f,this.processedYData=h}else this.currentDataGrouping=this.groupMap=null;this.hasGroupedData=a}},Ab.destroyGroupedData=function(){var a=this.groupedData;Ra(a||[],function(b,c){b&&(a[c]=b.destroy?b.destroy():null)}),this.groupedData=null},Ab.generatePoints=function(){Cb.apply(this),this.destroyGroupedData(),this.groupedData=this.hasGroupedData?this.points:null},db(lb.prototype,"tooltipFooterHeaderFormatter",function(a,b,c){var d,e=b.series,f=e.tooltipOptions,g=e.options.dataGrouping,h=f.xDateFormat,i=e.xAxis;return i&&"datetime"===i.options.type&&g&&bb(b.key)?(a=e.currentDataGrouping,g=g.dateTimeLabelFormats,a?(i=g[a.unitName],1===a.count?h=i[0]:(h=i[1],d=i[2])):!h&&g&&(h=this.getXDateFormat(b,f,i)),h=P(h,b.key),d&&(h+=P(d,b.key+a.totalRange-1)),r(f[(c?"footer":"header")+"Format"],{point:_a(b.point,{key:h}),series:e})):a.call(this,b,c)}),Ab.destroy=function(){for(var a=this.groupedData||[],b=a.length;b--;)a[b]&&a[b].destroy();Db.apply(this)},db(Ab,"setOptions",function(a,b){var c=a.call(this,b),e=this.type,f=this.chart.options.plotOptions,g=eb[e].dataGrouping;return Fb[e]&&(g||(g=d(Eb,Fb[e])),c.dataGrouping=d(g,f.series&&f.series.dataGrouping,f[e].dataGrouping,b.dataGrouping)),this.chart.options._stock&&(this.requireSorting=!0),c}),db(kb.prototype,"setScale",function(a){a.call(this),Ra(this.series,function(a){a.hasProcessed=!1})}),kb.prototype.getGroupPixelWidth=function(){var a,b,c=this.series,d=c.length,e=0,f=!1;for(a=d;a--;)(b=c[a].options.dataGrouping)&&(e=ma(e,b.groupPixelWidth));for(a=d;a--;)(b=c[a].options.dataGrouping)&&c[a].hasProcessed&&(d=(c[a].processedXData||c[a].data).length,(c[a].groupPixelWidth||d>this.chart.plotSizeX/e||d&&b.forced)&&(f=!0));return f?e:0},kb.prototype.setDataGrouping=function(a,b){var c,b=cb(b,!0);if(a||(a={forced:!1,units:null}),this instanceof kb)for(c=this.series.length;c--;)this.series[c].update({dataGrouping:a},!1);else Ra(this.chart.options.series,function(b){b.dataGrouping=a},!1);b&&this.chart.redraw()},eb.ohlc=d(eb.column,{lineWidth:1,tooltip:{pointFormat:'<span style="color:{point.color}">●</span> <b> {series.name}</b><br/>Open: {point.open}<br/>High: {point.high}<br/>Low: {point.low}<br/>Close: {point.close}<br/>'},states:{hover:{lineWidth:3}},threshold:null}),fb=o(Oa.column,{type:"ohlc",pointArrayMap:["open","high","low","close"],toYData:function(a){return[a.open,a.high,a.low,a.close]},pointValKey:"high",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth"},upColorProp:"stroke",getAttribs:function(){Oa.column.prototype.getAttribs.apply(this,arguments);var a=this.options,b=a.states,a=a.upColor||this.color,c=d(this.pointAttr),e=this.upColorProp;c[""][e]=a,c.hover[e]=b.hover.upColor||a,c.select[e]=b.select.upColor||a,Ra(this.points,function(a){a.open<a.close&&!a.options.color&&(a.pointAttr=c)})},translate:function(){var a=this.yAxis;Oa.column.prototype.translate.apply(this),Ra(this.points,function(b){null!==b.open&&(b.plotOpen=a.translate(b.open,0,1,0,1)),null!==b.close&&(b.plotClose=a.translate(b.close,0,1,0,1))})},drawPoints:function(){var a,b,c,d,e,f,g,h,i=this,j=i.chart;Ra(i.points,function(k){k.plotY!==K&&(g=k.graphic,a=k.pointAttr[k.selected?"selected":""]||i.pointAttr[""],d=a["stroke-width"]%2/2,h=ja(k.plotX)-d,e=ja(k.shapeArgs.width/2),f=["M",h,ja(k.yBottom),"L",h,ja(k.plotY)],null!==k.open&&(b=ja(k.plotOpen)+d,f.push("M",h,b,"L",h-e,b)),null!==k.close&&(c=ja(k.plotClose)+d,f.push("M",h,c,"L",h+e,c)),g?g.attr(a).animate({d:f}):k.graphic=j.renderer.path(f).attr(a).add(i.group))})},animate:null}),Oa.ohlc=fb,eb.candlestick=d(eb.column,{lineColor:"black",lineWidth:1,states:{hover:{lineWidth:2}},tooltip:eb.ohlc.tooltip,threshold:null,upColor:"white"}),fb=o(fb,{type:"candlestick",pointAttrToOptions:{fill:"color",stroke:"lineColor","stroke-width":"lineWidth"},upColorProp:"fill",getAttribs:function(){Oa.ohlc.prototype.getAttribs.apply(this,arguments);var a=this.options,b=a.states,c=a.upLineColor||a.lineColor,e=b.hover.upLineColor||c,f=b.select.upLineColor||c;Ra(this.points,function(a){a.open<a.close&&(a.lineColor&&(a.pointAttr=d(a.pointAttr),c=a.lineColor),a.pointAttr[""].stroke=c,a.pointAttr.hover.stroke=e,a.pointAttr.select.stroke=f)})},drawPoints:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m=this,n=m.chart,o=m.pointAttr[""];Ra(m.points,function(p){j=p.graphic,p.plotY!==K&&(a=p.pointAttr[p.selected?"selected":""]||o,h=a["stroke-width"]%2/2,i=ja(p.plotX)-h,b=p.plotOpen,c=p.plotClose,d=ia.min(b,c),e=ia.max(b,c),l=ja(p.shapeArgs.width/2),f=ja(d)!==ja(p.plotY),g=e!==p.yBottom,d=ja(d)+h,e=ja(e)+h,k=[],k.push("M",i-l,e,"L",i-l,d,"L",i+l,d,"L",i+l,e,"Z","M",i,d,"L",i,f?ja(p.plotY):d,"M",i,e,"L",i,g?ja(p.yBottom):e),j?j.attr(a).animate({d:k}):p.graphic=n.renderer.path(k).attr(a).add(m.group).shadow(m.options.shadow))})}}),Oa.candlestick=fb;var Ib=gb.prototype.symbols;eb.flags=d(eb.column,{fillColor:"white",lineWidth:1,pointRange:0,shape:"flag",stackDistance:12,states:{hover:{lineColor:"black",fillColor:"#FCFFC5"}},style:{fontSize:"11px",fontWeight:"bold",textAlign:"center"},tooltip:{pointFormat:"{point.text}<br/>"},threshold:null,y:-30}),Oa.flags=o(Oa.column,{type:"flags",sorted:!1,noSharedTooltip:!0,allowDG:!1,takeOrdinalPosition:!1,trackerGroups:["markerGroup"],forceCrop:!0,init:wb.prototype.init,pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth",r:"radius"},translate:function(){Oa.column.prototype.translate.apply(this);var a,b,c=this.options,d=this.chart,e=this.points,f=e.length-1,g=c.onSeries;a=g&&d.get(g);var h,i,j,c=c.onKey||"y",g=a&&a.options.step,k=a&&a.points,l=k&&k.length,m=this.xAxis,n=m.getExtremes();if(a&&a.visible&&l)for(a=a.currentDataGrouping,i=k[l-1].x+(a?a.totalRange:0),e.sort(function(a,b){return a.x-b.x}),c="plot"+c[0].toUpperCase()+c.substr(1);l--&&e[f]&&(a=e[f],h=k[l],!(h.x<=a.x&&void 0!==h[c]&&(a.x<=i&&(a.plotY=h[c],h.x<a.x&&!g&&(j=k[l+1])&&j[c]!==K&&(a.plotY+=(a.x-h.x)/(j.x-h.x)*(j[c]-h[c]))),f--,l++,f<0))););Ra(e,function(a,c){var f;a.plotY===K&&(a.x>=n.min&&a.x<=n.max?a.plotY=d.chartHeight-m.bottom-(m.opposite?m.height:0)+m.offset-d.plotTop:a.shapeArgs={}),(b=e[c-1])&&b.plotX===a.plotX&&(b.stackIndex===K&&(b.stackIndex=0),f=b.stackIndex+1),a.stackIndex=f})},drawPoints:function(){var a,b,c,e,f,g,h,i,j,k,l=this.pointAttr[""],m=this.points,n=this.chart,o=n.renderer,p=this.options,q=p.y,r=this.yAxis;for(f=m.length;f--;)g=m[f],a=g.plotX>this.xAxis.len,b=g.plotX,b>0&&(b-=cb(g.lineWidth,p.lineWidth)%2),h=g.stackIndex,e=g.options.shape||p.shape,c=g.plotY,c!==K&&(c=g.plotY+q-(h!==K&&h*p.stackDistance)),i=h?K:g.plotX,j=h?K:g.plotY,h=g.graphic,c!==K&&b>=0&&!a?(a=g.pointAttr[g.selected?"select":""]||l,k=cb(g.options.title,p.title,"A"),h?h.attr({text:k}).attr({x:b,y:c,r:a.r,anchorX:i,anchorY:j}):g.graphic=o.label(k,b,c,e,i,j,p.useHTML).css(d(p.style,g.style)).attr(a).attr({align:"flag"===e?"left":"center",width:p.width,height:p.height}).add(this.markerGroup).shadow(p.shadow),g.tooltipPos=n.inverted?[r.len+r.pos-n.plotLeft-c,this.xAxis.len-b]:[b,c]):h&&(g.graphic=h.destroy())},drawTracker:function(){var a=this.points;zb.drawTrackerPoint.apply(this),Ra(a,function(b){var c=b.graphic;c&&Va(c.element,"mouseover",function(){b.stackIndex>0&&!b.raised&&(b._y=c.y,c.attr({y:b._y-8}),b.raised=!0),Ra(a,function(a){a!==b&&a.raised&&a.graphic&&(a.graphic.attr({y:a._y}),a.raised=!1)})})})},animate:Ga,buildKDTree:Ga,setClip:Ga}),Ib.flag=function(a,b,c,d,e){return["M",e&&e.anchorX||a,e&&e.anchorY||b,"L",a,b+d,a,b,a+c,b,a+c,b+d,a,b+d,"Z"]},Ra(["circle","square"],function(a){Ib[a+"pin"]=function(b,c,d,e,f){var g=f&&f.anchorX,f=f&&f.anchorY;return"circle"===a&&e>d&&(b-=ja((e-d)/2),d=e),b=Ib[a](b,c,d,e),g&&f&&b.push("M",g,c>f?c:c+e,"L",g,f),b}}),L===ga.VMLRenderer&&Ra(["flag","circlepin","squarepin"],function(a){hb.prototype.symbols[a]=Ib[a]});var Jb={height:za?20:14,barBackgroundColor:"#bfc8d1",barBorderRadius:0,barBorderWidth:1,barBorderColor:"#bfc8d1",buttonArrowColor:"#666",buttonBackgroundColor:"#ebe7e8",buttonBorderColor:"#bbb",buttonBorderRadius:0,buttonBorderWidth:1,margin:10,minWidth:6,rifleColor:"#666",zIndex:3,step:.2,trackBackgroundColor:"#eeeeee",trackBorderColor:"#eeeeee",trackBorderWidth:1,liveRedraw:Ba&&!za};O.scrollbar=d(!0,Jb,O.scrollbar),H.prototype={render:function(){var a,b=this.renderer,c=this.options,d=c.trackBorderWidth,e=c.barBorderWidth,f=this.size;this.group=a=b.g("highcharts-scrollbar").attr({zIndex:c.zIndex,translateY:-99999}).add(),this.track=b.rect().attr({height:f,width:f,y:-d%2/2,x:-d%2/2,"stroke-width":d,fill:c.trackBackgroundColor,stroke:c.trackBorderColor,r:c.trackBorderRadius||0}).add(a),this.scrollbarGroup=b.g().add(a),this.scrollbar=b.rect().attr({height:f,width:f,y:-e%2/2,x:-e%2/2,"stroke-width":e,fill:c.barBackgroundColor,stroke:c.barBorderColor,r:c.barBorderRadius||0}).add(this.scrollbarGroup),this.scrollbarRifles=b.path(this.swapXY([Ka,-3,f/4,La,-3,2*f/3,Ka,0,f/4,La,0,2*f/3,Ka,3,f/4,La,3,2*f/3],c.vertical)).attr({stroke:c.rifleColor,"stroke-width":1}).add(this.scrollbarGroup),this.drawScrollbarButton(0),this.drawScrollbarButton(1)},position:function(a,b,c,d){var e=this.options,f=e.vertical,g=0,h=this.rendered?"animate":"attr";this.x=a,this.y=b+e.trackBorderWidth,this.width=c,this.xOffset=this.height=d,this.yOffset=g,f?(this.width=this.yOffset=c=g=this.size,this.xOffset=b=0,this.barWidth=d-2*c,this.x=a+=this.options.margin):(this.height=this.xOffset=d=b=this.size,this.barWidth=c-2*d,this.y+=this.options.margin),this.group[h]({translateX:a,translateY:this.y}),this.track[h]({width:c,height:d}),this.scrollbarButtons[1].attr({translateX:f?0:c-b,translateY:f?d-g:0})},drawScrollbarButton:function(a){var b,c=this.renderer,d=this.scrollbarButtons,e=this.options,f=this.size;b=c.g().add(this.group),d.push(b),c.rect(-.5,-.5,f+1,f+1,e.buttonBorderRadius,e.buttonBorderWidth).attr({stroke:e.buttonBorderColor,"stroke-width":e.buttonBorderWidth,fill:e.buttonBackgroundColor}).add(b),c.path(this.swapXY(["M",f/2+(a?-1:1),f/2-3,"L",f/2+(a?-1:1),f/2+3,"L",f/2+(a?2:-2),f/2],e.vertical)).attr({fill:e.buttonArrowColor}).add(b)},swapXY:function(a,b){var c,d,e=a.length;if(b)for(c=0;c<e;c+=3)d=a[c+1],a[c+1]=a[c+2],a[c+2]=d;return a},setRange:function(a,b){var c,d,e,f=this.options,g=f.vertical,h=this.rendered&&!this.hasDragged?"animate":"attr";i(this.barWidth)&&(c=this.barWidth*Math.max(a,0),d=this.barWidth*Math.min(b,1),d=Math.max(z(d-c),f.minWidth),c=Math.floor(c+this.xOffset+this.yOffset),e=d/2-.5,this.from=a,this.to=b,g?(this.scrollbarGroup[h]({translateY:c}),this.scrollbar[h]({height:d}),this.scrollbarRifles[h]({translateY:e}),this.scrollbarTop=c,this.scrollbarLeft=0):(this.scrollbarGroup[h]({translateX:c}),this.scrollbar[h]({width:d}),this.scrollbarRifles[h]({translateX:e}),this.scrollbarLeft=c,this.scrollbarTop=0),d<=12?this.scrollbarRifles.hide():this.scrollbarRifles.show(!0),f.showFull===!1&&(a<=0&&b>=1?this.group.hide():this.group.show()),this.rendered=!0)},initEvents:function(){var a=this;a.mouseMoveHandler=function(b){var c=a.chart.pointer.normalize(b),d=a.options.vertical?"chartY":"chartX",e=a.initPositions;!a.grabbedCenter||b.touches&&0===b.touches[0][d]||(c={chartX:(c.chartX-a.x-a.xOffset)/a.barWidth,chartY:(c.chartY-a.y-a.yOffset)/a.barWidth}[d],d=a[d],d=c-d,a.hasDragged=!0,a.updatePosition(e[0]+d,e[1]+d),a.hasDragged&&Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMType:b.type,DOMEvent:b}))},a.mouseUpHandler=function(b){a.hasDragged&&Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMType:b.type,DOMEvent:b}),a.grabbedCenter=a.hasDragged=a.chartX=a.chartY=null},a.mouseDownHandler=function(b){b=a.chart.pointer.normalize(b),a.chartX=(b.chartX-a.x-a.xOffset)/a.barWidth,a.chartY=(b.chartY-a.y-a.yOffset)/a.barWidth,a.initPositions=[a.from,a.to],a.grabbedCenter=!0},a.buttonToMinClick=function(b){var c=z(a.to-a.from)*a.options.step;a.updatePosition(z(a.from-c),z(a.to-c)),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})},a.buttonToMaxClick=function(b){var c=(a.to-a.from)*a.options.step;a.updatePosition(a.from+c,a.to+c),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})},a.trackClick=function(b){var c=a.chart.pointer.normalize(b),d=a.to-a.from,e=a.y+a.scrollbarTop,f=a.x+a.scrollbarLeft;a.options.vertical&&c.chartY>e||!a.options.vertical&&c.chartX>f?a.updatePosition(a.from+d,a.to+d):a.updatePosition(a.from-d,a.to-d),Xa(a,"changed",{from:a.from,to:a.to,trigger:"scrollbar",DOMEvent:b})}},updatePosition:function(a,b){b>1&&(a=z(1-z(b-a)),b=1),a<0&&(b=z(b-a),a=0),this.from=a,this.to=b},addEvents:function(){var a=this.options.inverted?[1,0]:[0,1],b=this.scrollbarButtons,c=this.scrollbarGroup.element,d=this.mouseDownHandler,e=this.mouseMoveHandler,f=this.mouseUpHandler,a=[[b[a[0]].element,"click",this.buttonToMinClick],[b[a[1]].element,"click",this.buttonToMaxClick],[this.track.element,"click",this.trackClick],[c,"mousedown",d],[ha,"mousemove",e],[ha,"mouseup",f]];M&&a.push([c,"touchstart",d],[ha,"touchmove",e],[ha,"touchend",f]),Ra(a,function(a){Va.apply(null,a)}),this._events=a},removeEvents:function(){Ra(this._events,function(a){Wa.apply(null,a)}),this._events=K},destroy:function(){this.removeEvents(),Ra([this.track,this.scrollbarRifles,this.scrollbar,this.scrollbarGroup,this.group],function(a){a&&a.destroy&&a.destroy()}),x(this.scrollbarButtons)}},db(kb.prototype,"init",function(a){var b=this;a.apply(b,[].slice.call(arguments,1)),b.options.scrollbar&&b.options.scrollbar.enabled&&(b.options.scrollbar.vertical=!b.horiz,b.options.startOnTick=b.options.endOnTick=!1,b.scrollbar=new H(b.chart.renderer,b.options.scrollbar,b.chart),Va(b.scrollbar,"changed",function(a){var c,d=Math.min(cb(b.options.min,b.min),b.min,b.dataMin),e=Math.max(cb(b.options.max,b.max),b.max,b.dataMax)-d;b.horiz&&!b.reversed||!b.horiz&&b.reversed?(c=d+e*this.to,d+=e*this.from):(c=d+e*(1-this.from),d+=e*(1-this.to)),b.setExtremes(d,c,!0,!1,a)}))}),db(kb.prototype,"render",function(a){var b,c=Math.min(cb(this.options.min,this.min),this.min,this.dataMin),d=Math.max(cb(this.options.max,this.max),this.max,this.dataMax),e=this.scrollbar;a.apply(this,[].slice.call(arguments,1)),e&&(this.horiz?e.position(this.left,this.top+this.height+this.offset+2+(this.opposite?0:this.axisTitleMargin),this.width,this.height):e.position(this.left+this.width+2+this.offset+(this.opposite?this.axisTitleMargin:0),this.top,this.width,this.height),isNaN(c)||isNaN(d)||!i(this.min)||!i(this.max)?e.setRange(0,0):(b=(this.min-c)/(d-c),c=(this.max-c)/(d-c),this.horiz&&!this.reversed||!this.horiz&&this.reversed?e.setRange(b,c):e.setRange(1-c,1-b)))}),db(kb.prototype,"getOffset",function(a){var b=this.horiz?2:1,c=this.scrollbar;a.apply(this,[].slice.call(arguments,1)),c&&(this.chart.axisOffset[b]+=c.size+c.options.margin)}),db(kb.prototype,"destroy",function(a){this.scrollbar&&(this.scrollbar=this.scrollbar.destroy()),a.apply(this,[].slice.call(arguments,1))}),ga.Scrollbar=H;var fb=[].concat(Gb),Kb=function(a){var b=Sa(arguments,bb);if(b.length)return Math[a].apply(0,b)};fb[4]=["day",[1,2,3,4]],fb[5]=["week",[1,2,3]],_a(O,{navigator:{handles:{backgroundColor:"#ebe7e8",borderColor:"#b2b1b6"},height:40,margin:25,maskFill:"rgba(128,179,236,0.3)",maskInside:!0,outlineColor:"#b2b1b6",outlineWidth:1,series:{type:Oa.areaspline===K?"line":"areaspline",color:"#4572A7",compare:null,fillOpacity:.05,dataGrouping:{approximation:"average",enabled:!0,groupPixelWidth:2,smoothed:!0,units:fb},dataLabels:{enabled:!1,zIndex:2},id:"highcharts-navigator-series",lineColor:null,lineWidth:1,marker:{enabled:!1},pointRange:0,shadow:!1,threshold:null},xAxis:{tickWidth:0,lineWidth:0,gridLineColor:"#EEE",gridLineWidth:1,tickPixelInterval:200,labels:{align:"left",style:{color:"#888"},x:3,y:-4},crosshair:!1},yAxis:{gridLineWidth:0,startOnTick:!1,endOnTick:!1,minPadding:.1,maxPadding:.1,labels:{enabled:!1},crosshair:!1,title:{text:null},tickWidth:0}}}),I.prototype={drawHandle:function(a,b){var c,d=this.chart.renderer,e=this.elementsToDestroy,f=this.handles,g=this.navigatorOptions.handles,g={fill:g.backgroundColor,stroke:g.borderColor,"stroke-width":1};this.rendered||(f[b]=d.g("navigator-handle-"+["left","right"][b]).css({cursor:"ew-resize"}).attr({zIndex:10-b}).add(),c=d.rect(-4.5,0,9,16,0,1).attr(g).add(f[b]),e.push(c),c=d.path(["M",-1.5,4,"L",-1.5,12,"M",.5,4,"L",.5,12]).attr(g).add(f[b]),e.push(c)),f[b][this.rendered&&!this.hasDragged?"animate":"attr"]({translateX:this.scrollerLeft+this.scrollbarHeight+parseInt(a,10),translateY:this.top+this.height/2-8})},render:function(a,b,c,d){var e,f,g,h,j=this.chart,k=j.renderer,l=this.navigatorGroup;h=this.scrollbarHeight;var l=this.xAxis,m=this.navigatorOptions,n=this.height,o=this.top,p=this.navigatorEnabled,q=m.outlineWidth,r=q/2,s=this.outlineHeight,t=o+r,u=this.rendered;bb(a)&&bb(b)&&(!this.hasDragged||i(c))&&(this.navigatorLeft=e=cb(l.left,j.plotLeft+h),this.navigatorWidth=f=cb(l.len,j.plotWidth-2*h),this.scrollerLeft=g=e-h,this.scrollerWidth=h=h=f+2*h,c=cb(c,l.translate(a)),d=cb(d,l.translate(b)),bb(c)&&oa(c)!==1/0||(c=0,d=h),l.translate(d,!0)-l.translate(c,!0)<j.xAxis[0].minRange||(this.zoomedMax=na(ma(c,d,0),f),this.zoomedMin=na(ma(this.fixedWidth?this.zoomedMax-this.fixedWidth:na(c,d),0),f),this.range=this.zoomedMax-this.zoomedMin,b=ja(this.zoomedMax),a=ja(this.zoomedMin),!u&&p&&(this.navigatorGroup=l=k.g("navigator").attr({zIndex:3}).add(),this.leftShade=k.rect().attr({fill:m.maskFill}).add(l),m.maskInside?this.leftShade.css({cursor:"ew-resize"}):this.rightShade=k.rect().attr({fill:m.maskFill}).add(l),this.outline=k.path().attr({"stroke-width":q,stroke:m.outlineColor}).add(l)),k=u&&!this.hasDragged?"animate":"attr",p&&(this.leftShade[k](m.maskInside?{x:e+a,y:o,width:b-a,height:n}:{x:e,y:o,width:a,height:n}),this.rightShade&&this.rightShade[k]({x:e+b,y:o,width:f-b,height:n}),this.outline[k]({d:[Ka,g,t,La,e+a-r,t,e+a-r,t+s,La,e+b-r,t+s,La,e+b-r,t,g+h,t].concat(m.maskInside?[Ka,e+a+r,t,La,e+b-r,t]:[])}),this.drawHandle(a+r,0),this.drawHandle(b+r,1)),this.scrollbar&&(this.scrollbar.hasDragged=this.hasDragged,this.scrollbar.position(this.scrollerLeft,this.top+(p?this.height:-this.scrollbarHeight),this.scrollerWidth,this.scrollbarHeight),this.scrollbar.setRange(a/f,b/f)),this.rendered=!0))},addEvents:function(){var a,b=this.chart,c=b.container,d=this.mouseDownHandler,e=this.mouseMoveHandler,f=this.mouseUpHandler;a=[[c,"mousedown",d],[c,"mousemove",e],[ha,"mouseup",f]],M&&a.push([c,"touchstart",d],[c,"touchmove",e],[ha,"touchend",f]),Ra(a,function(a){Va.apply(null,a)}),this._events=a,this.series&&Va(this.series.xAxis,"foundExtremes",function(){b.scroller.modifyNavigatorAxisExtremes()}),Va(b,"redraw",function(){var a=this.scroller,b=a&&a.baseSeries&&a.baseSeries.xAxis;b&&a.render(b.min,b.max)})},removeEvents:function(){Ra(this._events,function(a){Wa.apply(null,a)}),this._events=K,this.removeBaseSeriesEvents()},removeBaseSeriesEvents:function(){this.navigatorEnabled&&this.baseSeries&&this.baseSeries.xAxis&&this.navigatorOptions.adaptToUpdatedData!==!1&&(Wa(this.baseSeries,"updatedData",this.updatedDataHandler),Wa(this.baseSeries.xAxis,"foundExtremes",this.modifyBaseAxisExtremes))},init:function(){var a,b,c,e=this,f=e.chart,g=e.scrollbarHeight,h=e.navigatorOptions,j=e.height,k=e.top,l=e.baseSeries;e.mouseDownHandler=function(b){var d,b=f.pointer.normalize(b),g=e.zoomedMin,h=e.zoomedMax,i=e.top,k=e.scrollerLeft,l=e.scrollerWidth,m=e.navigatorLeft,n=e.navigatorWidth,o=e.scrollbarPad||0,p=e.range,q=b.chartX,r=b.chartY,b=f.xAxis[0],s=za?10:7;r>i&&r<i+j&&(ia.abs(q-g-m)<s?(e.grabbedLeft=!0,e.otherHandlePos=h,e.fixedExtreme=b.max,f.fixedRange=null):ia.abs(q-h-m)<s?(e.grabbedRight=!0,e.otherHandlePos=g,e.fixedExtreme=b.min,f.fixedRange=null):q>m+g-o&&q<m+h+o?(e.grabbedCenter=q,e.fixedWidth=p,c=q-g):q>k&&q<k+l&&(h=q-m-p/2,h<0?h=0:h+p>=n&&(h=n-p,d=e.getUnionExtremes().dataMax),h!==g&&(e.fixedWidth=p,g=a.toFixedRange(h,h+p,null,d),b.setExtremes(g.min,g.max,!0,null,{trigger:"navigator"}))))},e.mouseMoveHandler=function(a){var b,d=e.scrollbarHeight,g=e.navigatorLeft,h=e.navigatorWidth,i=e.scrollerLeft,j=e.scrollerWidth,k=e.range;a.touches&&0===a.touches[0].pageX||(a=f.pointer.normalize(a),b=a.chartX,b<g?b=g:b>i+j-d&&(b=i+j-d),e.grabbedLeft?(e.hasDragged=!0,e.render(0,0,b-g,e.otherHandlePos)):e.grabbedRight?(e.hasDragged=!0,e.render(0,0,e.otherHandlePos,b-g)):e.grabbedCenter&&(e.hasDragged=!0,b<c?b=c:b>h+c-k&&(b=h+c-k),e.render(0,0,b-c,b-c+k)),e.hasDragged&&e.scrollbar&&e.scrollbar.options.liveRedraw&&(a.DOMType=a.type,setTimeout(function(){e.mouseUpHandler(a)},0)))},e.mouseUpHandler=function(b){var d,g,h=b.DOMEvent||b;(e.hasDragged||"scrollbar"===b.trigger)&&(e.zoomedMin===e.otherHandlePos?d=e.fixedExtreme:e.zoomedMax===e.otherHandlePos&&(g=e.fixedExtreme),e.zoomedMax===e.navigatorWidth&&(g=e.getUnionExtremes().dataMax),d=a.toFixedRange(e.zoomedMin,e.zoomedMax,d,g),i(d.min)&&f.xAxis[0].setExtremes(d.min,d.max,!0,!e.hasDragged&&null,{trigger:"navigator",triggerOp:"navigator-drag",DOMEvent:h})),"mousemove"!==b.DOMType&&(e.grabbedLeft=e.grabbedRight=e.grabbedCenter=e.fixedWidth=e.fixedExtreme=e.otherHandlePos=e.hasDragged=c=null)};var m=f.xAxis.length,n=f.yAxis.length;f.extraBottomMargin=e.outlineHeight+h.margin,e.navigatorEnabled?(e.xAxis=a=new kb(f,d({breaks:l&&l.xAxis.options.breaks,ordinal:l&&l.xAxis.options.ordinal},h.xAxis,{id:"navigator-x-axis",isX:!0,type:"datetime",index:m,height:j,offset:0,offsetLeft:g,offsetRight:-g,keepOrdinalPadding:!0,startOnTick:!1,endOnTick:!1,minPadding:0,maxPadding:0,zoomEnabled:!1})),e.yAxis=b=new kb(f,d(h.yAxis,{id:"navigator-y-axis",alignTicks:!1,height:j,offset:0,index:n,zoomEnabled:!1})),l||h.series.data?e.addBaseSeries():0===f.series.length&&db(f,"redraw",function(a,b){f.series.length>0&&!e.series&&(e.setBaseSeries(),f.redraw=a),a.call(f,b)})):e.xAxis=a={translate:function(a,b){var c=f.xAxis[0],d=c.getExtremes(),e=f.plotWidth-2*g,h=Kb("min",c.options.min,d.dataMin),c=Kb("max",c.options.max,d.dataMax)-h;return b?a*c/e+h:e*(a-h)/c},toFixedRange:kb.prototype.toFixedRange},f.options.scrollbar.enabled&&(e.scrollbar=new H(f.renderer,d(f.options.scrollbar,{margin:e.navigatorEnabled?0:10}),f),Va(e.scrollbar,"changed",function(a){var b=e.navigatorWidth,c=b*this.to;b*=this.from,e.hasDragged=e.scrollbar.hasDragged,e.render(0,0,b,c),(f.options.scrollbar.liveRedraw||"mousemove"!==a.DOMType)&&setTimeout(function(){e.mouseUpHandler(a)})})),e.addBaseSeriesEvents(),db(f,"getMargins",function(c){var d=this.legend,f=d.options;c.apply(this,[].slice.call(arguments,1)),e.top=k=e.navigatorOptions.top||this.chartHeight-e.height-e.scrollbarHeight-this.spacing[2]-("bottom"===f.verticalAlign&&f.enabled&&!f.floating?d.legendHeight+cb(f.margin,10):0),a&&b&&(a.options.top=b.options.top=k,a.setAxisSize(),b.setAxisSize())}),e.addEvents()},getUnionExtremes:function(a){var b,c=this.chart.xAxis[0],d=this.xAxis,e=d.options,f=c.options;return a&&null===c.dataMin||(b={dataMin:cb(e&&e.min,Kb("min",f.min,c.dataMin,d.dataMin,d.min)),dataMax:cb(e&&e.max,Kb("max",f.max,c.dataMax,d.dataMax,d.max))}),b},setBaseSeries:function(a){var b=this.chart,a=a||b.options.navigator.baseSeries;this.series&&(this.removeBaseSeriesEvents(),this.series.remove()),this.baseSeries=b.series[a]||"string"==typeof a&&b.get(a)||b.series[0],this.xAxis&&this.addBaseSeries()},addBaseSeries:function(){var a,b=this.baseSeries,c=b?b.options:{},b=c.data,e=this.navigatorOptions.series;a=e.data,this.hasNavigatorData=!!a,c=d(c,e,{enableMouseTracking:!1,group:"nav",padXAxis:!1,xAxis:"navigator-x-axis",yAxis:"navigator-y-axis",name:"Navigator",showInLegend:!1,stacking:!1,isInternal:!0,visible:!0}),c.data=a||b.slice(0),this.series=this.chart.initSeries(c),this.addBaseSeriesEvents()},addBaseSeriesEvents:function(){var a=this.baseSeries;a&&a.xAxis&&this.navigatorOptions.adaptToUpdatedData!==!1&&(Va(a,"updatedData",this.updatedDataHandler),Va(a.xAxis,"foundExtremes",this.modifyBaseAxisExtremes),a.userOptions.events=_a(a.userOptions.event,{updatedData:this.updatedDataHandler}))},modifyNavigatorAxisExtremes:function(){var a,b=this.xAxis;b.getExtremes&&(a=this.getUnionExtremes(!0))&&(a.dataMin!==b.min||a.dataMax!==b.max)&&(b.min=a.dataMin,b.max=a.dataMax)},modifyBaseAxisExtremes:function(){if(this.chart.scroller.baseSeries&&this.chart.scroller.baseSeries.xAxis){var a,b,c=this.chart.scroller,d=this.getExtremes(),e=d.dataMin,f=d.dataMax,d=d.max-d.min,g=c.stickToMin,h=c.stickToMax,i=c.series,j=!!this.setExtremes;this.eventArgs&&"rangeSelectorButton"===this.eventArgs.trigger||(g&&(b=e,a=b+d),h&&(a=f,g||(b=ma(a-d,i&&i.xData?i.xData[0]:-Number.MAX_VALUE))),!j||!g&&!h||!bb(b))||(this.min=this.userMin=b,this.max=this.userMax=a),c.stickToMin=c.stickToMax=null}},updatedDataHandler:function(){var a=this.chart.scroller,b=a.baseSeries,c=a.series;a.stickToMin=bb(b.xAxis.min)&&b.xAxis.min<=b.xData[0],a.stickToMax=Math.round(a.zoomedMax)>=Math.round(a.navigatorWidth),c&&!a.hasNavigatorData&&(c.options.pointStart=b.xData[0],c.setData(b.options.data,!1,null,!1))},destroy:function(){this.removeEvents(),Ra([this.scrollbar,this.xAxis,this.yAxis,this.leftShade,this.rightShade,this.outline],function(a){a&&a.destroy&&a.destroy()}),this.xAxis=this.yAxis=this.leftShade=this.rightShade=this.outline=null,Ra([this.handles,this.elementsToDestroy],function(a){x(a)})}},ga.Navigator=I,db(kb.prototype,"zoom",function(a,b,c){var d,e=this.chart,f=e.options,g=f.chart.zoomType,h=f.navigator,f=f.rangeSelector;return this.isXAxis&&(h&&h.enabled||f&&f.enabled)&&("x"===g?e.resetZoomButton="blocked":"y"===g?d=!1:"xy"===g&&(e=this.previousZoom,i(b)?this.previousZoom=[this.min,this.max]:e&&(b=e[0],c=e[1],delete this.previousZoom))),d!==K?d:a.call(this,b,c)}),db(tb.prototype,"init",function(a,b,c){Va(this,"beforeRender",function(){var a=this.options;(a.navigator.enabled||a.scrollbar.enabled)&&(this.scroller=new I(this))}),a.call(this,b,c)}),db(wb.prototype,"addPoint",function(a,c,d,e,f){var g=this.options.turboThreshold;g&&this.xData.length>g&&ab(c,!0)&&this.chart.scroller&&b(20,!0),a.call(this,c,d,e,f)}),_a(O,{rangeSelector:{buttonTheme:{width:28,height:18,fill:"#f7f7f7",padding:2,r:0,"stroke-width":0,style:{color:"#444",cursor:"pointer",fontWeight:"normal"},zIndex:7,states:{hover:{fill:"#e7e7e7"},select:{fill:"#e7f0f9",style:{color:"black",fontWeight:"bold"}}}},height:35,inputPosition:{align:"right"},labelStyle:{color:"#666"}}}),O.lang=d(O.lang,{rangeSelectorZoom:"Zoom",rangeSelectorFrom:"From",rangeSelectorTo:"To"}),J.prototype={clickButton:function(a,b){var c,d,e,f,g,h=this,i=h.selected,j=h.chart,l=h.buttons,m=h.buttonOptions[a],n=j.xAxis[0],o=j.scroller&&j.scroller.getUnionExtremes()||n||{},p=o.dataMin,q=o.dataMax,r=n&&ja(na(n.max,cb(q,n.max))),s=m.type,o=m._range,t=m.dataGrouping;if(null!==p&&null!==q&&a!==h.selected){if(j.fixedRange=o,t&&(this.forcedDataGrouping=!0,kb.prototype.setDataGrouping.call(n||{chart:this.chart},t,!1)),"month"===s||"year"===s)n?(s={range:m,max:r,dataMin:p,dataMax:q},c=n.minFromRange.call(s),bb(s.newMax)&&(r=s.newMax)):o=m;else if(o)c=ma(r-o,p),r=na(c+o,q);else if("ytd"===s){if(!n)return void Va(j,"beforeRender",function(){
14
+ h.clickButton(a)});q===K&&(p=Number.MAX_VALUE,q=Number.MIN_VALUE,Ra(j.series,function(a){a=a.xData,p=na(a[0],p),q=ma(a[a.length-1],q)}),b=!1),r=new R(q),c=r.getFullYear(),c=e=ma(p||0,R.UTC(c,0,1)),r=r.getTime(),r=na(q||r,r)}else"all"===s&&n&&(c=p,r=q);l[i]&&l[i].setState(0),l[a]&&(l[a].setState(2),h.lastSelected=a),n?(n.setExtremes(c,r,cb(b,1),null,{trigger:"rangeSelectorButton",rangeSelectorButton:m}),h.setSelected(a)):(d=k(j.options.xAxis)[0],g=d.range,d.range=o,f=d.min,d.min=e,h.setSelected(a),Va(j,"load",function(){d.range=g,d.min=f}))}},setSelected:function(a){this.selected=this.options.selected=a},defaultButtons:[{type:"month",count:1,text:"1m"},{type:"month",count:3,text:"3m"},{type:"month",count:6,text:"6m"},{type:"ytd",text:"YTD"},{type:"year",count:1,text:"1y"},{type:"all",text:"All"}],init:function(a){var b=this,c=a.options.rangeSelector,d=c.buttons||[].concat(b.defaultButtons),e=c.selected,f=b.blurInputs=function(){var a=b.minInput,c=b.maxInput;a&&a.blur&&Xa(a,"blur"),c&&c.blur&&Xa(c,"blur")};b.chart=a,b.options=c,b.buttons=[],a.extraTopMargin=c.height,b.buttonOptions=d,Va(a.container,"mousedown",f),Va(a,"resize",f),Ra(d,b.computeButtonRange),e!==K&&d[e]&&this.clickButton(e,!1),Va(a,"load",function(){Va(a.xAxis[0],"setExtremes",function(c){this.max-this.min!==a.fixedRange&&"rangeSelectorButton"!==c.trigger&&"updatedData"!==c.trigger&&b.forcedDataGrouping&&this.setDataGrouping(!1,!1)}),Va(a.xAxis[0],"afterSetExtremes",function(){b.updateButtonStates(!0)})})},updateButtonStates:function(a){var b=this,c=this.chart,d=c.xAxis[0],e=c.scroller&&c.scroller.getUnionExtremes()||d,f=e.dataMin,g=e.dataMax,h=b.selected,i=b.options.allButtonsEnabled,j=b.buttons;a&&c.fixedRange!==ja(d.max-d.min)&&(j[h]&&j[h].setState(0),b.setSelected(null)),Ra(b.buttonOptions,function(a,e){var k=ja(d.max-d.min),l=a._range,m=a.type,n=a.count||1,o=l>g-f,p=l<d.minRange,q="all"===a.type&&d.max-d.min>=g-f&&2!==j[e].state,r="ytd"===a.type&&P("%Y",f)===P("%Y",g),s=c.renderer.forExport&&e===h,l=l===k,t=!d.hasVisibleSeries;("month"===m||"year"===m)&&k>=864e5*{month:28,year:365}[m]*n&&k<=864e5*{month:31,year:366}[m]*n&&(l=!0),s||l&&e!==h&&e===b.lastSelected?(b.setSelected(e),j[e].setState(2)):!i&&(o||p||q||r||t)?j[e].setState(3):3===j[e].state&&j[e].setState(0)})},computeButtonRange:function(a){var b=a.type,c=a.count||1,d={millisecond:1,second:1e3,minute:6e4,hour:36e5,day:864e5,week:6048e5};d[b]?a._range=d[b]*c:"month"!==b&&"year"!==b||(a._range=864e5*{month:30,year:365}[b]*c)},setInputValue:function(a,b){var c=this.chart.options.rangeSelector;i(b)&&(this[a+"Input"].HCTime=b),this[a+"Input"].value=P(c.inputEditDateFormat||"%Y-%m-%d",this[a+"Input"].HCTime),this[a+"DateBox"].attr({text:P(c.inputDateFormat||"%b %e, %Y",this[a+"Input"].HCTime)})},showInput:function(a){var b=this.inputGroup,c=this[a+"DateBox"];m(this[a+"Input"],{left:b.translateX+c.x+"px",top:b.translateY+"px",width:c.width-2+"px",height:c.height-2+"px",border:"2px solid silver"})},hideInput:function(a){m(this[a+"Input"],{border:0,width:"1px",height:"1px"}),this.setInputValue(a)},drawInput:function(a){function b(){var a=c.value,b=(k.inputDateParser||R.parse)(a),d=h.xAxis[0],f=d.dataMin,i=d.dataMax;b!==c.previousValue&&(c.previousValue=b,bb(b)||(b=a.split("-"),b=R.UTC(e(b[0]),e(b[1])-1,e(b[2]))),bb(b)&&(O.global.useUTC||(b+=6e4*(new R).getTimezoneOffset()),m?b>g.maxInput.HCTime?b=K:b<f&&(b=f):b<g.minInput.HCTime?b=K:b>i&&(b=i),b!==K&&h.xAxis[0].setExtremes(m?b:d.min,m?d.max:b,K,K,{trigger:"rangeSelectorInput"})))}var c,f,g=this,h=g.chart,i=h.renderer.style,j=h.renderer,k=h.options.rangeSelector,l=g.div,m="min"===a,o=this.inputGroup;this[a+"Label"]=f=j.label(O.lang[m?"rangeSelectorFrom":"rangeSelectorTo"],this.inputGroup.offset).attr({padding:2}).css(d(i,k.labelStyle)).add(o),o.offset+=f.width+5,this[a+"DateBox"]=j=j.label("",o.offset).attr({padding:2,width:k.inputBoxWidth||90,height:k.inputBoxHeight||17,stroke:k.inputBoxBorderColor||"silver","stroke-width":1}).css(d({textAlign:"center",color:"#444"},i,k.inputStyle)).on("click",function(){g.showInput(a),g[a+"Input"].focus()}).add(o),o.offset+=j.width+(m?10:0),this[a+"Input"]=c=n("input",{name:a,className:"highcharts-range-selector",type:"text"},_a({position:"absolute",border:0,width:"1px",height:"1px",padding:0,textAlign:"center",fontSize:i.fontSize,fontFamily:i.fontFamily,left:"-9em",top:h.plotTop+"px"},k.inputStyle),l),c.onfocus=function(){g.showInput(a)},c.onblur=function(){g.hideInput(a)},c.onchange=b,c.onkeypress=function(a){13===a.keyCode&&b()}},getPosition:function(){var a=this.chart,b=a.options.rangeSelector,a=cb((b.buttonPosition||{}).y,a.plotTop-a.axisOffset[0]-b.height);return{buttonTop:a,inputTop:a-10}},render:function(a,b){var c,d=this,e=d.chart,f=e.renderer,g=e.container,h=e.options,j=h.exporting&&h.exporting.enabled!==!1&&h.navigation&&h.navigation.buttonOptions,k=h.rangeSelector,l=d.buttons,h=O.lang,m=d.div,m=d.inputGroup,o=k.buttonTheme,p=k.buttonPosition||{},q=k.inputEnabled,r=o&&o.states,s=e.plotLeft,t=this.getPosition(),u=d.group,v=d.rendered;v||(d.group=u=f.g("range-selector-buttons").add(),d.zoomText=f.text(h.rangeSelectorZoom,cb(p.x,s),15).css(k.labelStyle).add(u),c=cb(p.x,s)+d.zoomText.getBBox().width+5,Ra(d.buttonOptions,function(a,b){l[b]=f.button(a.text,c,0,function(){d.clickButton(b),d.isActive=!0},o,r&&r.hover,r&&r.select,r&&r.disabled).css({textAlign:"center"}).add(u),c+=l[b].width+cb(k.buttonSpacing,5),d.selected===b&&l[b].setState(2)}),d.updateButtonStates(),q===!1)||(d.div=m=n("div",null,{position:"relative",height:0,zIndex:1}),g.parentNode.insertBefore(m,g),d.inputGroup=m=f.g("input-group").add(),m.offset=0,d.drawInput("min"),d.drawInput("max")),u[v?"animate":"attr"]({translateY:t.buttonTop}),q!==!1&&(m.align(_a({y:t.inputTop,width:m.offset,x:j&&t.inputTop<(j.y||0)+j.height-e.spacing[0]?-40:0},k.inputPosition),!0,e.spacingBox),i(q)||(e=u.getBBox(),m[m.translateX<e.x+e.width+10?"hide":"show"]()),d.setInputValue("min",a),d.setInputValue("max",b)),d.rendered=!0},destroy:function(){var a,b=this.minInput,c=this.maxInput,d=this.chart,e=this.blurInputs;Wa(d.container,"mousedown",e),Wa(d,"resize",e),x(this.buttons),b&&(b.onfocus=b.onblur=b.onchange=null),c&&(c.onfocus=c.onblur=c.onchange=null);for(a in this)this[a]&&"chart"!==a&&(this[a].destroy?this[a].destroy():this[a].nodeType&&y(this[a])),this[a]=null}},kb.prototype.toFixedRange=function(a,b,c,d){var e=this.chart&&this.chart.fixedRange,a=cb(c,this.translate(a,!0)),b=cb(d,this.translate(b,!0)),c=e&&(b-a)/e;return c>.7&&c<1.3&&(d?a=b-e:b=a+e),bb(a)||(a=b=void 0),{min:a,max:b}},kb.prototype.minFromRange=function(){var a,b,c,d=this.range,e={month:"Month",year:"FullYear"}[d.type],f=this.max,g=function(a,b){var c=new R(a);return c["set"+e](c["get"+e]()+b),c.getTime()-a};return bb(d)?(a=this.max-d,c=d):a=f+g(f,-d.count),b=cb(this.dataMin,Number.MIN_VALUE),bb(a)||(a=b),a<=b&&(a=b,void 0===c&&(c=g(a,d.count)),this.newMax=na(a+c,this.dataMax)),bb(f)||(a=void 0),a},db(tb.prototype,"init",function(a,b,c){Va(this,"init",function(){this.options.rangeSelector.enabled&&(this.rangeSelector=new J(this))}),a.call(this,b,c)}),ga.RangeSelector=J,tb.prototype.callbacks.push(function(a){function b(){d=a.xAxis[0].getExtremes(),bb(d.min)&&f.render(d.min,d.max)}function c(a){f.render(a.min,a.max)}var d,e=a.scroller,f=a.rangeSelector;e&&(d=a.xAxis[0].getExtremes(),e.render(d.min,d.max)),f&&(Va(a.xAxis[0],"afterSetExtremes",c),Va(a,"resize",b),b()),Va(a,"destroy",function(){f&&(Wa(a,"resize",b),Wa(a.xAxis[0],"afterSetExtremes",c))})}),ga.StockChart=ga.stockChart=function(a,b,c){var e,g=f(a)||a.nodeName,h=arguments[g?1:0],i=h.series,j=cb(h.navigator&&h.navigator.enabled,!0)?{startOnTick:!1,endOnTick:!1}:null,l={marker:{enabled:!1,radius:2}},m={shadow:!1,borderWidth:0};return h.xAxis=Ua(k(h.xAxis||{}),function(a){return d({minPadding:0,maxPadding:0,ordinal:!0,title:{text:null},labels:{overflow:"justify"},showLastLabel:!0},a,{type:"datetime",categories:null},j)}),h.yAxis=Ua(k(h.yAxis||{}),function(a){return e=cb(a.opposite,!0),d({labels:{y:-2},opposite:e,showLastLabel:!1,title:{text:null}},a)}),h.series=null,h=d({chart:{panning:!0,pinchType:"x"},navigator:{enabled:!0},scrollbar:{enabled:!0},rangeSelector:{enabled:!0},title:{text:null,style:{fontSize:"16px"}},tooltip:{shared:!0,crosshairs:!0},legend:{enabled:!1},plotOptions:{line:l,spline:l,area:l,areaspline:l,arearange:l,areasplinerange:l,column:m,columnrange:m,candlestick:m,ohlc:m}},h,{_stock:!0,chart:{inverted:!1}}),h.series=i,g?new tb(a,h,c):new tb(h,b)},db(nb.prototype,"init",function(a,b,c){var d=c.chart.pinchType||"";a.call(this,b,c),this.pinchX=this.pinchHor=d.indexOf("x")!==-1,this.pinchY=this.pinchVert=d.indexOf("y")!==-1,this.hasZoom=this.hasZoom||this.pinchHor||this.pinchVert}),db(kb.prototype,"autoLabelAlign",function(a){var b=this.chart,c=this.options,b=b._labelPanes=b._labelPanes||{},d=this.options.labels;return this.chart.options._stock&&"yAxis"===this.coll&&(c=c.top+","+c.height,!b[c]&&d.enabled)?(15===d.x&&(d.x=0),void 0===d.align&&(d.align="right"),b[c]=1,"right"):a.call(this,[].slice.call(arguments,1))}),db(kb.prototype,"getPlotLinePath",function(a,b,c,d,e,f){var g,h,j,k,l,m,n=this,o=this.isLinked&&!this.series?this.linkedParent.series:this.series,p=n.chart,q=p.renderer,r=n.left,s=n.top,t=[],u=[];return"colorAxis"===n.coll?a.apply(this,[].slice.call(arguments,1)):(u=n.isXAxis?i(n.options.yAxis)?[p.yAxis[n.options.yAxis]]:Ua(o,function(a){return a.yAxis}):i(n.options.xAxis)?[p.xAxis[n.options.xAxis]]:Ua(o,function(a){return a.xAxis}),Ra(n.isXAxis?p.yAxis:p.xAxis,function(a){if(i(a.options.id)?a.options.id.indexOf("navigator")===-1:1){var b=a.isXAxis?"yAxis":"xAxis",b=i(a.options[b])?p[b][a.options[b]]:p[b][0];n===b&&u.push(a)}}),l=u.length?[]:[n.isXAxis?p.yAxis[0]:p.xAxis[0]],Ra(u,function(a){Qa(a,l)===-1&&l.push(a)}),m=cb(f,n.translate(b,null,null,d)),bb(m)&&(n.horiz?Ra(l,function(a){var b;h=a.pos,k=h+a.len,g=j=ja(m+n.transB),(g<r||g>r+n.width)&&(e?g=j=na(ma(r,g),r+n.width):b=!0),b||t.push("M",g,h,"L",j,k)}):Ra(l,function(a){var b;g=a.pos,j=g+a.len,h=k=ja(s+n.height-m),(h<s||h>s+n.height)&&(e?h=k=na(ma(s,h),n.top+n.height):b=!0),b||t.push("M",g,h,"L",j,k)})),t.length>0?q.crispPolyLine(t,c||1):null)}),kb.prototype.getPlotBandPath=function(a,b){var c,d=this.getPlotLinePath(b,null,null,!0),e=this.getPlotLinePath(a,null,null,!0),f=[];if(e&&d&&e.toString()!==d.toString())for(c=0;c<e.length;c+=6)f.push("M",e[c+1],e[c+2],"L",e[c+4],e[c+5],d[c+4],d[c+5],d[c+1],d[c+2]);else f=null;return f},gb.prototype.crispPolyLine=function(a,b){var c;for(c=0;c<a.length;c+=6)a[c+1]===a[c+4]&&(a[c+1]=a[c+4]=ja(a[c+1])-b%2/2),a[c+2]===a[c+5]&&(a[c+2]=a[c+5]=ja(a[c+2])+b%2/2);return a},L===ga.VMLRenderer&&(hb.prototype.crispPolyLine=gb.prototype.crispPolyLine),db(kb.prototype,"hideCrosshair",function(a,b){a.call(this,b),this.crossLabel&&(this.crossLabel=this.crossLabel.hide())}),db(kb.prototype,"drawCrosshair",function(a,b,c){var d,e;if(a.call(this,b,c),i(this.crosshair.label)&&this.crosshair.label.enabled&&this.cross){var f,a=this.chart,g=this.options.crosshair.label,h=this.horiz,j=this.opposite,k=this.left,l=this.top,m=this.crossLabel,n=g.format,o="",p="inside"===this.options.tickPosition,q=this.crosshair.snap!==!1;b||(b=this.cross&&this.cross.e),f=h?"center":j?"right"===this.labelAlign?"right":"left":"left"===this.labelAlign?"left":"center",m||(m=this.crossLabel=a.renderer.label(null,null,null,g.shape||"callout").attr({align:g.align||f,zIndex:12,fill:g.backgroundColor||this.series[0]&&this.series[0].color||"gray",padding:cb(g.padding,8),stroke:g.borderColor||"","stroke-width":g.borderWidth||0,r:cb(g.borderRadius,3)}).css(_a({color:"white",fontWeight:"normal",fontSize:"11px",textAlign:"center"},g.style)).add()),h?(f=q?c.plotX+k:b.chartX,l+=j?0:this.height):(f=j?this.width+k:0,l=q?c.plotY+l:b.chartY),!n&&!g.formatter&&(this.isDatetimeAxis&&(o="%b %d, %Y"),n="{value"+(o?":"+o:"")+"}"),b=q?c[this.isXAxis?"x":"y"]:this.toValue(h?b.chartX:b.chartY),m.attr({text:n?r(n,{value:b}):g.formatter.call(this,b),anchorX:h?f:this.opposite?0:a.chartWidth,anchorY:h?this.opposite?a.chartHeight:0:l,x:f,y:l,visibility:"visible"}),b=m.getBBox(),h?(p&&!j||!p&&j)&&(l=m.y-b.height):l=m.y-b.height/2,h?(d=k-b.x,e=k+this.width-b.x):(d="left"===this.labelAlign?k:0,e="right"===this.labelAlign?k+this.width:a.chartWidth),m.translateX<d&&(f+=d-m.translateX),m.translateX+b.width>=e&&(f-=m.translateX+b.width-e),m.attr({x:f,y:l,visibility:"visible"})}});var Lb=Ab.init,Mb=Ab.processData,Nb=vb.prototype.tooltipFormatter;return Ab.init=function(){Lb.apply(this,arguments),this.setCompare(this.options.compare)},Ab.setCompare=function(a){this.modifyValue="value"===a||"percent"===a?function(b,c){var d=this.compareValue;return b!==K&&(b="value"===a?b-d:b=100*(b/d)-100,c)&&(c.change=b),b}:null,this.userOptions.compare=a,this.chart.hasRendered&&(this.isDirty=!0)},Ab.processData=function(){var a,b,c,d,e,f=-1;if(Mb.apply(this,arguments),this.xAxis&&this.processedYData)for(b=this.processedXData,c=this.processedYData,d=c.length,this.pointArrayMap&&(f=Qa(this.pointValKey||"y",this.pointArrayMap)),a=0;a<d-1;a++)if(e=f>-1?c[a][f]:c[a],bb(e)&&b[a+1]>=this.xAxis.min&&0!==e){this.compareValue=e;break}},db(Ab,"getExtremes",function(a){var b;a.apply(this,[].slice.call(arguments,1)),this.modifyValue&&(b=[this.modifyValue(this.dataMin),this.modifyValue(this.dataMax)],this.dataMin=v(b),this.dataMax=w(b))}),kb.prototype.setCompare=function(a,b){this.isXAxis||(Ra(this.series,function(b){b.setCompare(a)}),cb(b,!0)&&this.chart.redraw())},vb.prototype.tooltipFormatter=function(a){return a=a.replace("{point.change}",(this.change>0?"+":"")+ga.numberFormat(this.change,cb(this.series.tooltipOptions.changeDecimals,2))),Nb.apply(this,[a])},db(wb.prototype,"render",function(a){this.chart.options._stock&&this.xAxis&&(!this.clipBox&&this.animate?(this.clipBox=d(this.chart.clipBox),this.clipBox.width=this.xAxis.len,this.clipBox.height=this.yAxis.len):this.chart[this.sharedClipKey]&&(Za(this.chart[this.sharedClipKey]),this.chart[this.sharedClipKey].attr({width:this.xAxis.len,height:this.yAxis.len}))),a.call(this)}),_a(ga,{Color:D,Point:vb,Tick:F,Renderer:L,SVGElement:E,SVGRenderer:gb,arrayMin:v,arrayMax:w,charts:Ha,correctFloat:z,dateFormat:P,error:b,format:r,pathAnim:void 0,getOptions:function(){return O},hasBidiBug:Ca,isTouchDevice:za,setOptions:function(a){return O=d(!0,O,a),C(),O},addEvent:Va,removeEvent:Wa,createElement:n,discardElement:y,css:m,each:Ra,map:Ua,merge:d,splat:k,stableSort:u,extendClass:o,pInt:e,svg:Ba,canvas:Da,vml:!Ba&&!Da,product:"Highstock",version:"4.2.6"}),ga}),jQuery(document).ready(function(a){"use strict";var b=!1,c=[],d={fb_pixel_box:".panel.panel-settings-set-fb-px",ca_list:".panel.panel-ca-list",conversions_list:".panel.panel-ce-tracking",sidebar:".plugin-sidebar"},e=function(){a.fn.select2&&a.extend(a.fn.select2.defaults,{dropdownCssClass:"adespresso-select2",containerCssClass:"adespresso-select2",formatNoMatches:!1})},f=function(a){if("undefined"!=typeof a.data("select2")){var b=a.data("select2"),c=b.container;c.addClass("loading-data")}else a.is("div, form")?a.addClass("loading-data loading-box"):a.is("a")&&a.addClass("loading-data")},g=function(a){if("undefined"!=typeof a.data("select2")){var b=a.data("select2"),c=b.container;c.removeClass("loading-data")}else a.is("div, form")?a.removeClass("loading-data loading-box"):a.is("a")&&a.removeClass("loading-data")},h=function(a,b){"error"===b&&(b="danger"),a.find(".alert-"+b).length&&a.find(".alert-"+b).remove()},i=function(b,c,d){"error"===c&&(c="danger"),h(b,c);var e=a("<div />",{"class":"alert alert-"+c+" alert-dismissable",role:"alert",html:d}).prepend(a("<button />",{type:"button","class":"close","data-dismiss":"alert",text:"×"}));b.prepend(e)},j=function(){b=!0},k=function(){b=!1},l=function(){a(".wrap form").on("change",":input:not(#date-range)",function(){j()}).on("submit",function(){k()}),window.onbeforeunload=function(){if(b)return aepc_admin.unsaved}},m=function(a,b){a.select2({tags:b})},n=function(b){var d=a("undefined"!=typeof b?b.currentTarget:document.body),e=[{action:"get_custom_fields",dropdown:"input.custom-fields"},{action:"get_languages",dropdown:"#conditions_language"},{action:"get_device_types",dropdown:"#conditions_device_types"},{action:"get_categories",dropdown:""},{action:"get_tags",dropdown:""},{action:"get_posts",dropdown:""},{action:"get_dpa_params",dropdown:""},{action:"get_currencies",dropdown:""}];a.each(e,function(b,e){if(aepc_admin.actions.hasOwnProperty(e.action)){if(c.hasOwnProperty(e.action))return void(""!==e.dropdown&&m(d.find(e.dropdown),c[e.action]));c[e.action]=[],a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions[e.action].name,_wpnonce:aepc_admin.actions[e.action].nonce},success:function(a){c[e.action]=a,""!==e.dropdown&&m(d.find(e.dropdown),a)},dataType:"json"})}}),d.find("#taxonomy_key").on("change.data",function(){var b=a(this).val().replace("tax_","");c.hasOwnProperty("get_categories")&&c.get_categories.hasOwnProperty(b)&&m(d.find("#taxonomy_terms"),c.get_categories[b])}),d.find("#tag_key").on("change.data",function(){var b=a(this).val().replace("tax_","");c.hasOwnProperty("get_tags")&&c.get_tags.hasOwnProperty(b)&&m(d.find("#tag_terms"),c.get_tags[b])}),d.find("#pt_key").on("change.data",function(){var b=a(this).val();c.hasOwnProperty("get_posts")&&c.get_posts.hasOwnProperty(b)&&m(d.find("#pt_posts"),c.get_posts[b])}),d.find("#event_categories").on("change.data",function(){d.find("#taxonomy_key").trigger("change.data")}),d.find("#event_tax_post_tag").on("change.data",function(){d.find("#tag_key").trigger("change.data")}),d.find("#event_posts").on("change.data",function(){d.find("#pt_key").trigger("change.data")}),d.find("#event_pages").on("change.data",function(){c.hasOwnProperty("get_posts")&&c.get_posts.hasOwnProperty("page")&&m(d.find("#pages"),c.get_posts.page)}),d.find("#event_custom_fields").on("change.data",function(b){var e=[{id:"[[any]]",text:aepc_admin.filter_any}];e=a.merge(e,c.get_custom_fields),d.find("#custom_field_keys option").remove(),d.find("#custom_field_keys").append(a.map(e,function(b,c){return"[[any]]"===b.id&&(b.text="--- "+b.text+" ---"),a("<option>",{val:b.id,text:b.text})}))}),d.find(".js-ecommerce input").on("change.data",function(){d.find("#dpa_key").select2({placeholder:aepc_admin.filter_custom_field_placeholder,searchInputPlaceholder:aepc_admin.filter_custom_field_placeholder,data:{results:c.get_dpa_params},query:function(b){var d={results:c.get_dpa_params};""!==b.term&&(d.results=a.merge([{id:b.term,text:b.term}],d.results)),d.results=d.results.filter(function(a){return b.matcher(b.term,a.text)}),b.callback(d)}}).select2("data",{id:d.find("#dpa_key").val(),text:d.find("#dpa_key").val()}).on("change",function(){d.find("#dpa_value").val("")}).off("change.dpa").on("change.dpa",function(){var b=a(this).val(),e=[];"content_ids"===b?c.hasOwnProperty("get_posts")&&(c.get_posts.hasOwnProperty("product")&&(e=c.get_posts.product.concat(e)),c.get_posts.hasOwnProperty("download")&&(e=c.get_posts.download.concat(e))):"content_category"===b?c.hasOwnProperty("get_categories")&&(c.get_categories.hasOwnProperty("product_cat")&&(e=c.get_categories.product_cat.concat(e)),c.get_categories.hasOwnProperty("download_category")&&(e=c.get_categories.download_category.concat(e))):"content_type"===b?e=["product","product_group"]:"currency"===b&&c.hasOwnProperty("get_currencies")&&(e=c.get_currencies.map(function(a){var b=document.createElement("textarea");return b.innerHTML=a.text,a.text=b.value,a})),e=e.filter(function(a,b){return!(0!==b&&"[[any]]"===a.id)}),d.find("#dpa_value").select2({tags:e})}).triggerHandler("change.dpa")})},o=function(){a("select").select2({minimumResultsForSearch:5}),a("input.multi-tags").select2({tags:[]}),a("select.dropdown-width-max").select2({minimumResultsForSearch:5,dropdownCssClass:"dropdown-width-max"})},p=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document);c.find(".collapse").collapse({toggle:!1}),c.find('[data-toggle="tooltip"]').tooltip(),c.find('[data-toggle="popover"]').popover({container:"#wpbody .pixel-caffeine-wrapper"}),a.material.init()},q=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document);c.find("select.js-collapse").on("change.bs",function(){var b=a(this),d=b.find("option:selected");c.find(d.data("target")).hasClass("in")||(c.find(b.data("parent")).find(".collapse").collapse("hide"),c.find(d.data("target")).collapse("show"))}).trigger("change.bs"),c.find("input.js-collapse").on("change.bs",function(){var b=a(this),d=b.filter(":checked");c.find(d.data("target")).hasClass("in")||(c.find(b.data("parent")).find(".collapse").collapse("hide"),c.find(d.data("target")).collapse("show"))}).trigger("change.bs"),c.find("#ca_event_type").on("change.bs",function(){c.find(".collapse-parameters").find(".collapse").collapse("hide"),c.find(".js-collapse-events").find("input:checked").prop("checked",!1)}),p(b)},r=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document.body);c.find("select.js-dep").on("change",function(){var b=a(this),c=b.closest("form"),d=b.val(),e=b.attr("id"),f=c.find('div[class*="'+e+'"]'),g=c.find("."+e+"-"+d);f.hide(),g.length&&g.show()}).trigger("change"),c.find(".control-wrap .checkbox .inline-text").on("focus",function(){a(this).siblings('input[type="checkbox"]').prop("checked",!0).trigger("change")}),c.find('.control-wrap .checkbox input[type="checkbox"]').on("change",function(){var b=a(this),c=b.is(":checked");b.closest("div.checkbox").removeClass("checked unchecked").addClass(c?"checked":"unchecked").find("input.inline-text").prop("disabled",!c)}).trigger("change"),c.find(".js-show-advanced-data").on("change.components",function(){var b=a(this),c=b.closest("form");c.find("div.advanced-data").collapse(b.is(":checked")?"show":"hide")}).trigger("change.components"),c.find("select#event_standard_events").on("change.components",function(){var b=a(this),c=b.closest("form"),d=b.find("option:selected").data("fields");c.find("div.event-field").hide(),a.each(d.split(",").map(function(a){return a.trim()}),function(a,b){c.find("div.event-field."+b+"-field").show()})}).trigger("change.components"),c.find("input.js-switch-labeled-tosave").on("change.components",function(){var b=a(this),c=b.closest(".form-group").find(".text-status"),d=b.is(":checked")?"yes":"no",e=b.closest(".togglebutton"),f=b.data("original-value");"undefined"==typeof c.data("original-status")&&c.data("original-status",c.clone()),f!==d?(c.hasClass("text-status-pending")||e.addClass("pending"),c.addClass("text-status-pending").text(aepc_admin.switch_unsaved)):(a(c.data("original-status")).hasClass("text-status-pending")||e.removeClass("pending"),c.replaceWith(c.data("original-status")))}).trigger("change.components"),c.find("input.js-switch-labeled").on("change.components",function(){var b=a(this),c=b.closest(".form-group").find(".text-status");c.removeClass("hide"),b.is(":checked")?c.filter(".text-status-off").addClass("hide"):c.filter(".text-status-on").addClass("hide")});var d=function(){c.find("div.js-custom-params").children("div").each(function(b){var c=a(this);c.find('input[type="text"]').each(function(){var c=a(this);c.attr("name",c.attr("name").replace(/\[[0-9]+\]/,"["+b+"]")),c.attr("id",c.attr("id").replace(/_[0-9]+$/,"_"+b))})})};c.find(".js-add-custom-param").on("click",function(b){if("undefined"==typeof wp)return b;b.preventDefault();var c=wp.template("custom-params"),d=a(this).closest("div.js-custom-params"),e=parseInt(d.children("div").length);d.find(".js-custom-param:last").length?d.find(".js-custom-param:last").after(c({index:e-1})):d.prepend(c({index:e-1}))}),c.find(".js-custom-params").on("click",".js-delete-custom-param",function(b){b.preventDefault();var c=a(this),e=a("#modal-confirm-delete"),f=c.closest(".js-custom-param"),g=function(){e.modal("hide"),f.remove(),d()};""===f.find('input[id^="event_custom_params_key"]').val()&&""===f.find('input[id^="event_custom_params_value"]').val()?g():e.modal("show").one("click",".btn-ok",g)}),c.find("select[data-selected]").each(function(){var b=a(this),c=b.data("selected");b.data("selected","").val(c).trigger("change")}),c.find("select[data-selected]").each(function(){var b=a(this),c=b.data("selected");b.val(c).trigger("change")})},s=function(a){var b=a.find(".js-include-filters"),c=a.find(".js-exclude-filters"),d=a.find(".js-ca-filters");0===b.find("ul.list-filter").find("li").length?b.addClass("hide"):b.removeClass("hide"),0===c.find("ul.list-filter").find("li").length?c.addClass("hide"):c.removeClass("hide"),b.hasClass("hide")&&c.hasClass("hide")?d.find("div.no-filters-feedback").removeClass("hide"):(d.find("div.no-filters-feedback").addClass("hide"),b.find("ul.list-filter").find("li:first").find(".filter-and").remove(),c.find("ul.list-filter").find("li:first").find(".filter-and").remove())},t=function(b){var c=a(this),d=a(b.relatedTarget),e=d.closest("form");c.find("#ca-filter-form").on("submit",function(b){b.preventDefault();var c=a(this),j=c.data("scope"),k=e.find(".js-ca-filters"),l=wp.template("ca-filter-item"),m=c.find('[name^="ca_rule[][main_condition]"]:checked'),n=c.find('button[type="submit"]'),o=n.text(),p=k.find(".js-"+m.val()+"-filters"),q=m.add(c.find('[name^="ca_rule[][event_type]"]')).add(c.find('[name^="ca_rule[][event]"]:checked')).add(c.find(".collapse-parameters .collapse.in").find('[name^="ca_rule[][conditions]"]')),r=function(b){var f=a("<div />"),h="add"===j?k.find("li").length:d.closest("li").data("filter-id");if(g(c),!b||0===b.length)return i(c.find(".modal-body"),"error",aepc_admin.filter_no_condition_error),void n.text(o);q.each(function(){var b=a(this),c=b.attr("name"),d=b.val();f.append(a("<input />",{type:"hidden",name:c.replace("[]","["+h+"]"),value:d}))});var m=l({nfilters:p.find("li").length-("edit"===j&&a.contains(p.get()[0],d.get()[0])?1:0),statement:b,hidden_inputs:f.html(),index:h});"edit"===j&&a.contains(p.get()[0],d.get()[0])?d.closest("li").html(a(m).html()):(p.find("ul").append(m),"edit"!==j||a.contains(p.get()[0],d.get()[0])||d.closest("li").remove()),s(e),c.closest(".modal").modal("hide"),c.off("submit")};return h(c.find(".modal-body"),"error"),0===c.find(".js-collapse-events input:checked").length?void i(c.find(".modal-body"),"error",aepc_admin.filter_no_data_error):(f(c),n.text(aepc_admin.filter_saving),void a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{filter:q.serializeArray(),action:aepc_admin.actions.get_filter_statement.name,_wpnonce:aepc_admin.actions.get_filter_statement.nonce},success:r,dataType:"html"}))})},u=function(b){var c=a("undefined"!=typeof b?b.currentTarget:document.body);c.find(".list-filter").on("click",".btn-delete",function(b){b.preventDefault();var c=a(this).closest("form"),d=a("#modal-confirm-delete"),e=a(this).closest("li");d.modal("show",a(this)).one("click",".btn-ok",function(){d.modal("hide"),e.remove(),s(c)})}).on("click",".btn-edit",function(b){b.preventDefault();var c=(a(this).closest("form"),a("#modal-ca-edit-filter")),d=a(this).closest("li"),e=d.find(".hidden-fields input");c.on("modal-template-loaded",function(b){var c=a(this).find("form"),d=e.filter('[name*="[main_condition]"]').val();c.find('input[name*="main_condition"][value="'+d+'"]').prop("checked",!0).closest("label").addClass("active").siblings().removeClass("active");var f=e.filter('[name*="[event_type]"]').val(),g=(c.find('select[name*="event_type"]').val(f),e.filter('[name*="[event]"]').val()),h=c.find('input[name*="event"][value="'+g+'"]').prop("checked",!0),i=c.find(h.data("target")),j=e.filter('[name*="[conditions][0][key]"]').val(),k=e.filter('[name*="[conditions][0][operator]"]').val(),l=e.filter('[name*="[conditions][0][value]"]').val();i.find('[name*="[conditions][0][key]"]').is("#custom_field_keys")&&i.find("#custom_field_keys").append(a("<option />",{val:j,text:j})),i.find('[name*="[conditions][0][key]"]').val(j),i.find('[name*="[conditions][0][operator]"]').val(k),i.find('[name*="[conditions][0][value]"]').val(l)}).one("show.bs.modal",function(){var b=a(this).find("form");b.find('[name*="event_type"]:checked').trigger("change.data"),b.find('[name*="event"]:checked').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][key]"]').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][operator]"]').trigger("change.data"),b.find('.collapse.in [name*="[conditions][0][value]"]').trigger("change.data")}).modal("show",a(this))})},v=function(b){var c=a(window).scrollTop(),d=a(b).offset().top;return d-c},w=function(){var b=v(".plugin-content"),c=parseFloat(a(".wp-toolbar").css("padding-top")),d=a(".alert-wrap"),e=d.height(),f=a(".alert-wrap-ghost");b<=c?(0===f.length&&d.after('<div class="alert-wrap-ghost"></div>').next(".alert-wrap-ghost").height(e),d.addClass("alert-fixed").css({top:c}).width(a(".plugin-content").width())):(d.removeClass("alert-fixed").width("100%"),f.remove())},x=function(){var b=a("#activity-chart");b.length&&a.getJSON(aepc_admin.ajax_url+"?action="+aepc_admin.actions.get_pixel_stats.name+"&_wpnonce="+aepc_admin.actions.get_pixel_stats.nonce,function(c){if("undefined"!=typeof c.success&&!1===c.success)return void i(b,"info",c.data[0].message);var d=new Date;d.setUTCDate(d.getUTCDate()-7),d.setUTCHours(0,0,0,0),b.highcharts("StockChart",{chart:{type:"line"},title:{text:null},navigator:{enabled:!0},rangeSelector:{enabled:!1},plotOptions:{spline:{marker:{enabled:!0}}},xAxis:{min:d.getTime()},yAxis:{gridLineColor:"#F4F4F4"},series:[{name:"Pixel fires",data:c,dataGrouping:{approximation:"sum",forced:!0,units:[["day",[1]]]},pointInterval:36e5}]}),b.closest(".panel").find("select#date-range").select2({minimumResultsForSearch:5,width:"element"}),b.closest(".panel").on("change.chart.range","select#date-range",function(){var c=b.highcharts(),d=a(this).val(),e=new Date,f=new Date;if(f.setDate(e.getUTCDate()-1),"today"===d)c.xAxis[0].setExtremes(e.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["hour",[1]]]});else if("yesterday"===d)c.xAxis[0].setExtremes(f.setUTCHours(0,0,0,0),f.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["hour",[1]]]});else if("last-7-days"===d){var g=f;g.setDate(e.getUTCDate()-7),c.xAxis[0].setExtremes(g.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["day",[1]]]})}else if("last-14-days"===d){var h=f;h.setDate(e.getUTCDate()-14),c.xAxis[0].setExtremes(h.setUTCHours(0,0,0,0),e.setUTCHours(23,59,59,999)),c.xAxis[0].setDataGrouping({approximation:"sum",forced:!0,units:[["day",[1]]]})}})})},y=function(b){var d=a("undefined"!=typeof b?this:document.body),e=d.find("select#aepc_account_id"),h=d.find("select#aepc_pixel_id"),j=a("form#mainform").find("#aepc_account_id").val(),l=a("form#mainform").find("#aepc_pixel_id").val(),m=function(){var b=e.val()?JSON.parse(e.val()).id:"";if(c.hasOwnProperty("get_pixel_ids")&&c.get_pixel_ids.hasOwnProperty(b)){var d=a.merge([{id:"",text:""}],c.get_pixel_ids[b]);1===d.length?(d[0].text=aepc_admin.fb_option_no_pixel,h.prop("disabled",!0)):h.prop("disabled",!1),h.find("option").remove(),h.append(a.map(d,function(b,c){return a("<option>",{val:b.id,text:b.text,selected:b.id===l})})),2===h.find("option").length&&h.find("option:eq(1)").prop("selected",!0),h.val(h.find("option:selected").val()).trigger("change")}},n=function(){var b=e.val()?JSON.parse(e.val()).id:"";f(h),a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions.get_pixel_ids.name,_wpnonce:aepc_admin.actions.get_pixel_ids.nonce,account_id:b},success:function(a){c.hasOwnProperty("get_pixel_ids")||(c.get_pixel_ids={}),c.get_pixel_ids[b]=a,m(),g(h)},dataType:"json"})},o=function(a){if("undefined"!=typeof a&&a.hasOwnProperty("type")&&"change"===a.type&&(h.val("").trigger("change"),h.find("option").remove()),e.val()){var b=e.val()?JSON.parse(e.val()).id:"";c.hasOwnProperty("get_pixel_ids")&&c.get_pixel_ids.hasOwnProperty(b)?m():n()}},p=function(){if(c.hasOwnProperty("get_account_ids")){
15
+ var b=a.merge([{id:"",text:""}],c.get_account_ids);e.find("option").remove(),e.append(a.map(b,function(b,c){return a("<option>",{val:b.id,text:b.text,selected:b.id===j})})),e.on("change",o).trigger("change")}},q=function(){f(e),a.ajax({url:aepc_admin.ajax_url,data:{action:aepc_admin.actions.get_account_ids.name,_wpnonce:aepc_admin.actions.get_account_ids.nonce},success:function(b){!1===b.success?(i(a(".js-options-group"),"error",b.data),k()):(c.get_account_ids=b,p()),g(e)},dataType:"json"})},r=function(){e.length<=0||(c.hasOwnProperty("get_account_ids")?p():q())};if(j&&l){var s=JSON.parse(j),t=JSON.parse(l);e.append(a("<option>",{val:j,text:s.name+" (#"+s.id+")",selected:!0})).trigger("change"),h.append(a("<option>",{val:l,text:t.name+" (#"+t.id+")",selected:!0})).trigger("change")}r(),o()},z=function(b,c){if(d.hasOwnProperty(b)&&aepc_admin.actions.hasOwnProperty("load_"+b)){var e=a(d[b]),g={action:aepc_admin.actions["load_"+b].name,_wpnonce:aepc_admin.actions["load_"+b].nonce};a.inArray(b,["sidebar"])<0&&h(a(".plugin-content"),"success"),f(e),window.location.href.slice(window.location.href.indexOf("?")+1).split("&").forEach(function(b){var c=b.split("=");a.inArray(c[0],["page","tab"])&&(g[c[0]]=c[1])}),"undefined"!=typeof c&&a.extend(g,c),a.ajax({url:aepc_admin.ajax_url,data:g,success:function(c){c.success&&(e.replaceWith(c.data.html),c.data.hasOwnProperty("messages")&&c.data.messages.hasOwnProperty("success")&&c.data.messages.success.hasOwnProperty("main")&&c.data.messages.success.main.forEach(function(b){i(a(".plugin-content .alert-wrap"),"success",b)}),p(),o(),r({currentTarget:d[b]}),w())},dataType:"json"})}};e(),x(),n(),q(),o(),y(),r(),u(),a(".modal-confirm").on("show.bs.modal",function(b){var c=a(this),d=b.hasOwnProperty("relatedTarget")?a(b.relatedTarget).attr("href"):"";a.inArray(d,["","#","#_"])<0&&c.one("click",".btn-ok",function(b){b.preventDefault();var e={"fb-disconnect":"fb_pixel_box","ca-delete":"ca_list","conversion-delete":"conversions_list"},h=d.match(new RegExp("action=("+Object.keys(e).join("|")+")(&|$)"));h?(f(c.find(".modal-content")),a.ajax({url:d+(d.indexOf("?")?"&":"?")+"ajax=1",method:"GET",success:function(b){if(b.success&&(a(".sec-overlay").removeClass("sec-overlay"),a(".sub-panel-fb-connect.bumping").removeClass("bumping"),z(e[h[1]]),c.modal("hide"),g(c.find(".modal-content")),window.history&&window.history.pushState)){var d=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:d},"",d)}},dataType:"json"})):(c.modal("hide"),window.location=d)})}),a(".js-new-filter-modal").on("click",".js-main-condition > .js-condition",function(){var b=a(this),c=b.closest(".js-main-condition"),d=c.find(".js-condition");d.removeClass("active"),b.addClass("active")}),a(".js-form-modal").on("show.bs.modal",function(b){if("undefined"==typeof wp)return b;var c=a(this),d=a(b.relatedTarget),e=d.data("config"),f=wp.template(c.attr("id"));c.find(".modal-content").html(f(e)),c.trigger("modal-template-loaded")}).on("show.bs.modal",q).on("show.bs.modal",o).on("show.bs.modal",n).on("show.bs.modal",r).on("show.bs.modal",t).on("show.bs.modal",u),a(document).on("submit",'form[data-toggle="ajax"]',function(b){b.preventDefault();var c=a(this),d=c,e=c.find('[type="submit"]'),j=e.text(),k=c.offset().top-50;c.find(".modal-body").length?d=c.find(".modal-body").first():c.find(".panel-body").length&&(d=c.find(".panel-body").first()),h(d,"error"),c.find(".has-error").removeClass("has-error"),c.find(".help-block-error").remove(),f(c),a.ajax({url:aepc_admin.ajax_url,method:"POST",data:c.serialize(),success:function(b){if(b.success){var f={"fb-connect-options":"fb_pixel_box","ca-clone":"ca_list","ca-edit":"ca_list","conversion-edit":"conversions_list"},h=Object.keys(f).map(function(a){return"#modal-"+a}).join(","),l={};if(c.closest(".modal").length&&c.closest(".modal").is(h)){if(z(f[c.closest(".modal").attr("id").replace("modal-","")]),c.closest(".modal").modal("hide"),g(c),window.history&&window.history.pushState){var m=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:m},"",m)}}else if(Object.keys(l).indexOf(c.data("action"))>=0)z(l[c.data("action")]),g(c);else{var n=c.attr("action");n?window.location.href=n:window.location.reload(!1)}}else{if(b.data.hasOwnProperty("refresh")&&b.data.refresh)return void(window.location.href=window.location.href.replace(/(\?|\&)ref=fblogin/,""));g(c),a("html, body").animate({scrollTop:k},300),e.text(j),b.data.hasOwnProperty("main")&&i(d,"error",b.data.main.join("<br/>")),c.find("input, select").each(function(){var c=a(this),d=c.attr("id"),e=c.closest(".form-group"),f=c.closest(".control-wrap").find(".field-helper");b.data.hasOwnProperty(d)&&(e.addClass("has-error"),f.append(a("<span />",{"class":"help-block help-block-error",html:b.data[d].join("<br/>")}))),c.on("keyup change",function(){f.find(".help-block-error").remove()})})}},dataType:"json"})}),a(window).on("load",w).on("scroll",w).on("resize",w),a("#modal-fb-connect-options").on("show.bs.modal",function(b){if("undefined"==typeof wp)return b;var c=a(this),d=wp.template("modal-facebook-options");c.find(".modal-content").html(d([])),c.trigger("facebook-options-loaded")}).on("show.bs.modal",q).on("show.bs.modal",o).on("show.bs.modal",y),a(".sub-panel-fb-connect").on("change","#aepc_account_id",function(){var b=a(this).val(),c=a("#aepc_pixel_id").val();b&&c?a(".js-save-facebook-options").removeClass("disabled"):a(".js-save-facebook-options").addClass("disabled")}).on("change","#aepc_pixel_id",function(){var b=a("#aepc_account_id").val(),c=a(this).val();b&&c?a(".js-save-facebook-options").removeClass("disabled"):a(".js-save-facebook-options").addClass("disabled")}).on("click",".js-save-facebook-options:not(.disabled)",function(b){var c=a("#aepc_account_id").val(),d=a("#aepc_pixel_id").val();a(".sec-overlay").removeClass("sec-overlay"),a(".sub-panel-fb-connect.bumping").removeClass("bumping"),f(a(".panel.panel-settings-set-fb-px")),a.ajax({url:aepc_admin.ajax_url,method:"POST",data:{aepc_account_id:c,aepc_pixel_id:d,action:aepc_admin.actions.save_facebook_options.name,_wpnonce:aepc_admin.actions.save_facebook_options.nonce},success:function(a){if(a.success){if(window.history&&window.history.pushState){var b=window.location.href.replace(/(\?|\&)ref=fblogin/,"");window.history.pushState({path:b},"",b)}z("fb_pixel_box"),k()}},dataType:"json"})}),a(".wrap-custom-audiences").on("click",".js-ca-size-sync",function(b){var c=a(this),d=c.data("ca_id");h(a(".plugin-content .alert-wrap"),"error"),f(a(".panel.panel-ca-list")),c.addClass("loading-data"),a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{ca_id:d,action:aepc_admin.actions.refresh_ca_size.name,_wpnonce:aepc_admin.actions.refresh_ca_size.nonce},success:function(b){b.success?z("ca_list"):i(a(".plugin-content .alert-wrap"),"error",b.data.message)},dataType:"json"})}),a(".wrap").on("click",".pagination li a",function(b){b.preventDefault();var c=a(this),d=c.attr("href"),e=d.match(/paged=([0-9]+)/);a(this).closest(".panel-ca-list").length?z("ca_list",{paged:e[1]}):a(this).closest(".panel-ce-tracking").length&&z("conversions_list",{paged:e[1]}),window.history&&window.history.pushState&&window.history.pushState({path:d},"",d)}),a(".plugin-sidebar.loading-sec").length&&z("sidebar");var A=[];a(".modal").on("show.bs.modal",function(a){A.push(a)}).on("hidden.bs.modal",function(b){a(A[A.length-1].relatedTarget).closest(".modal").length&&(a("body").addClass("modal-open"),A.splice(A.length-1,1))}),a("#aepc-clear-transients").on("click",function(b){b.preventDefault();var c=a(this);f(c),a.ajax({url:aepc_admin.ajax_url,method:"GET",data:{action:aepc_admin.actions.clear_transients.name,_wpnonce:aepc_admin.actions.clear_transients.nonce},success:function(b){g(c),b.success&&i(a(".plugin-content .alert-wrap"),"success",b.data.message)},dataType:"json"})}),l()});
includes/admin/settings/general-settings.php CHANGED
@@ -69,6 +69,11 @@ return array(
69
  'default' => 'no'
70
  ),
71
 
 
 
 
 
 
72
  'aepc_enable_ca_events' => array(
73
  'type' => 'checkbox',
74
  'default' => 'yes'
@@ -104,6 +109,11 @@ return array(
104
  'default' => 'no'
105
  ),
106
 
 
 
 
 
 
107
  'aepc_advanced_pixel_delay_firing' => array(
108
  'type' => 'text',
109
  'default' => 0
69
  'default' => 'no'
70
  ),
71
 
72
+ 'aepc_enable_completeregistration' => array(
73
+ 'type' => 'checkbox',
74
+ 'default' => 'no'
75
+ ),
76
+
77
  'aepc_enable_ca_events' => array(
78
  'type' => 'checkbox',
79
  'default' => 'yes'
109
  'default' => 'no'
110
  ),
111
 
112
+ 'aepc_track_shipping_costs' => array(
113
+ 'type' => 'checkbox',
114
+ 'default' => 'no'
115
+ ),
116
+
117
  'aepc_advanced_pixel_delay_firing' => array(
118
  'type' => 'text',
119
  'default' => 0
includes/admin/templates/dashboard.php CHANGED
@@ -110,7 +110,7 @@ if ( ! defined( 'ABSPATH' ) ) {
110
  <div class="data-group">
111
  <span class="data"><?php _e( 'eCommerce integration', 'pixel-caffeine' ) ?></span>
112
  <div class="value">
113
- <span><?php AEPC_Track::is_dpa_active() && $page->is_store_detected() ? _e( 'Yes', 'pixel-caffeine' ) : _e( 'No', 'pixel-caffeine' ) ?></span>
114
  </div>
115
  </div>
116
 
110
  <div class="data-group">
111
  <span class="data"><?php _e( 'eCommerce integration', 'pixel-caffeine' ) ?></span>
112
  <div class="value">
113
+ <span><?php AEPC_Track::is_dpa_active() && $page->get_addons_detected() ? _e( 'Yes', 'pixel-caffeine' ) : _e( 'No', 'pixel-caffeine' ) ?></span>
114
  </div>
115
  </div>
116
 
includes/admin/templates/general-settings.php CHANGED
@@ -120,7 +120,7 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
120
 
121
 
122
 
123
- <div class="panel panel-settings-conversions<?php echo ! $page->is_store_detected() ? ' not-detected' : ' detected' ?>">
124
  <div class="panel-heading">
125
  <h2 class="tit"><?php _e( 'Conversions', 'pixel-caffeine' ) ?></h2>
126
  <div class="form-group form-toggle">
@@ -144,13 +144,15 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
144
  </div>
145
  </div>
146
  <div class="panel-body">
147
- <?php if ( $page->is_store_detected() ) : ?>
148
  <div class="ecomm-detect">
149
  <h3 class="tit">
150
  <?php _e( 'eCommerce plugin detected', 'pixel-caffeine' ) ?>:
 
151
  <span class="ecomm-plugin-logo">
152
- <img src="<?php echo esc_url( $page->store_logo( 'woocommerce' ) ) ?>" title="<?php echo esc_attr( $page->get_store_detected_name() ) ?>" alt="<?php echo esc_attr( $page->get_store_detected_name() ) ?>">
153
  </span>
 
154
  </h3>
155
  </div>
156
 
@@ -160,6 +162,8 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
160
  </div>
161
 
162
  <div class="control-wrap">
 
 
163
  <div class="checkbox">
164
  <label>
165
  <input
@@ -170,6 +174,7 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
170
  <?php _e( 'View product', 'pixel-caffeine' ) ?>
171
  </label>
172
  </div>
 
173
 
174
  <div class="checkbox">
175
  <label>
@@ -182,6 +187,7 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
182
  </label>
183
  </div>
184
 
 
185
  <div class="checkbox">
186
  <label>
187
  <input
@@ -192,7 +198,9 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
192
  <?php _e( 'Add to cart', 'pixel-caffeine' ) ?>
193
  </label>
194
  </div>
 
195
 
 
196
  <div class="checkbox">
197
  <label>
198
  <input
@@ -203,7 +211,9 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
203
  <?php _e( 'View Checkout', 'pixel-caffeine' ) ?>
204
  </label>
205
  </div>
 
206
 
 
207
  <div class="checkbox">
208
  <label>
209
  <input
@@ -214,7 +224,9 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
214
  <?php _e( 'Add payment info', 'pixel-caffeine' ) ?>
215
  </label>
216
  </div>
 
217
 
 
218
  <div class="checkbox">
219
  <label>
220
  <input
@@ -225,6 +237,33 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
225
  <?php _e( 'Purchase', 'pixel-caffeine' ) ?>
226
  </label>
227
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  </div><!-- ./control-wrap -->
229
  </div>
230
 
@@ -240,11 +279,13 @@ $highlight_fbpixel = isset( $_GET['ref'] ) && 'fblogin' == $_GET['ref'] && $fb->
240
  <div class="sub-panel sub-panel-supported-plugin">
241
  <h4 class="tit"><?php _e( 'Supported plugins', 'pixel-caffeine' ) ?>:</h4>
242
  <ul class="list-supported-plugin">
 
243
  <li class="item">
244
- <a href="<?php echo esc_url( $page->store_website( 'woocommerce' ) ) ?>" class="ecomm-plugin-logo">
245
- <img src="<?php echo esc_url( $page->store_logo( 'woocommerce' ) ) ?>" title="<?php echo esc_attr( $page->get_store_detected_name() ) ?>" alt="<?php echo esc_attr( $page->get_store_detected_name() ) ?>">
246
  </a>
247
  </li>
 
248
  </ul>
249
  </div>
250
 
120
 
121
 
122
 
123
+ <div class="panel panel-settings-conversions<?php echo $page->get_addons_detected() ? ' detected' : ' not-detected' ?>">
124
  <div class="panel-heading">
125
  <h2 class="tit"><?php _e( 'Conversions', 'pixel-caffeine' ) ?></h2>
126
  <div class="form-group form-toggle">
144
  </div>
145
  </div>
146
  <div class="panel-body">
147
+ <?php if ( $page->get_addons_detected() ) : ?>
148
  <div class="ecomm-detect">
149
  <h3 class="tit">
150
  <?php _e( 'eCommerce plugin detected', 'pixel-caffeine' ) ?>:
151
+ <?php foreach ( $page->get_addons_detected() as $addon ) : ?>
152
  <span class="ecomm-plugin-logo">
153
+ <img src="<?php echo esc_url( $addon->get_logo_img() ) ?>" title="<?php echo esc_attr( $addon->get_name() ) ?>" alt="<?php echo esc_attr( $addon->get_name() ) ?>">
154
  </span>
155
+ <?php endforeach; ?>
156
  </h3>
157
  </div>
158
 
162
  </div>
163
 
164
  <div class="control-wrap">
165
+
166
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'ViewContent' ) ) : ?>
167
  <div class="checkbox">
168
  <label>
169
  <input
174
  <?php _e( 'View product', 'pixel-caffeine' ) ?>
175
  </label>
176
  </div>
177
+ <?php endif; ?>
178
 
179
  <div class="checkbox">
180
  <label>
187
  </label>
188
  </div>
189
 
190
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'AddToCart' ) ) : ?>
191
  <div class="checkbox">
192
  <label>
193
  <input
198
  <?php _e( 'Add to cart', 'pixel-caffeine' ) ?>
199
  </label>
200
  </div>
201
+ <?php endif; ?>
202
 
203
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'InitiateCheckout' ) ) : ?>
204
  <div class="checkbox">
205
  <label>
206
  <input
211
  <?php _e( 'View Checkout', 'pixel-caffeine' ) ?>
212
  </label>
213
  </div>
214
+ <?php endif; ?>
215
 
216
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'AddPaymentInfo' ) ) : ?>
217
  <div class="checkbox">
218
  <label>
219
  <input
224
  <?php _e( 'Add payment info', 'pixel-caffeine' ) ?>
225
  </label>
226
  </div>
227
+ <?php endif; ?>
228
 
229
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'Purchase' ) ) : ?>
230
  <div class="checkbox">
231
  <label>
232
  <input
237
  <?php _e( 'Purchase', 'pixel-caffeine' ) ?>
238
  </label>
239
  </div>
240
+ <?php endif; ?>
241
+
242
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'Lead' ) ) : ?>
243
+ <div class="checkbox">
244
+ <label>
245
+ <input
246
+ type="checkbox"
247
+ name="<?php $page->field_name( 'aepc_enable_lead' ) ?>"
248
+ id="<?php $page->field_id( 'aepc_enable_lead' ) ?>"
249
+ <?php checked( $page->get_value( 'aepc_enable_lead' ), 'yes' ) ?>>
250
+ <?php _e( 'Lead', 'pixel-caffeine' ) ?>
251
+ </label>
252
+ </div>
253
+ <?php endif; ?>
254
+
255
+ <?php if ( AEPC_Addons_Support::is_event_supported( 'CompleteRegistration' ) ) : ?>
256
+ <div class="checkbox">
257
+ <label>
258
+ <input
259
+ type="checkbox"
260
+ name="<?php $page->field_name( 'aepc_enable_completeregistration' ) ?>"
261
+ id="<?php $page->field_id( 'aepc_enable_completeregistration' ) ?>"
262
+ <?php checked( $page->get_value( 'aepc_enable_completeregistration' ), 'yes' ) ?>>
263
+ <?php _e( 'CompleteRegistration', 'pixel-caffeine' ) ?>
264
+ </label>
265
+ </div>
266
+ <?php endif; ?>
267
  </div><!-- ./control-wrap -->
268
  </div>
269
 
279
  <div class="sub-panel sub-panel-supported-plugin">
280
  <h4 class="tit"><?php _e( 'Supported plugins', 'pixel-caffeine' ) ?>:</h4>
281
  <ul class="list-supported-plugin">
282
+ <?php foreach ( $page->get_addons_supported() as $addon ) : ?>
283
  <li class="item">
284
+ <a href="<?php echo esc_url( $addon->get_website_url() ) ?>" class="ecomm-plugin-logo">
285
+ <img src="<?php echo esc_url( $addon->get_logo_img() ) ?>" title="<?php echo esc_attr( $addon->get_name() ) ?>" alt="<?php echo esc_attr( $addon->get_name() ) ?>">
286
  </a>
287
  </li>
288
+ <?php endforeach; ?>
289
  </ul>
290
  </div>
291
 
includes/admin/templates/parts/advanced-settings.php CHANGED
@@ -82,6 +82,24 @@ if ( ! PixelCaffeine()->is_php_supported() || ! AEPC_Admin::$api->is_logged_in()
82
  </div><!-- ./control-wrap -->
83
  </div><!-- ./form-group -->
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  </article><!-- ./sub-panel -->
86
 
87
  <article class="sub-panel sub-panel-adv-opt">
82
  </div><!-- ./control-wrap -->
83
  </div><!-- ./form-group -->
84
 
85
+ <div class="form-group">
86
+ <div class="control-wrap">
87
+ <div class="checkbox">
88
+ <label for="<?php $page->field_id( 'aepc_track_shipping_costs' ) ?>">
89
+ <?php printf( esc_html_x( 'Track %1$sshipping costs%2$s into %1$sPurchase%2$s and %1$sInitiateCheckout%2$s events', '%1$s and %2$s are for strong tag', 'pixel-caffeine' ),
90
+ '<strong>',
91
+ '</strong>'
92
+ ) ?>
93
+ <input
94
+ type="checkbox"
95
+ name="<?php $page->field_name( 'aepc_track_shipping_costs' ) ?>"
96
+ id="<?php $page->field_id( 'aepc_track_shipping_costs' ) ?>"
97
+ <?php checked( $page->get_value( 'aepc_track_shipping_costs' ), 'yes' ) ?>>
98
+ </label>
99
+ </div>
100
+ </div><!-- ./control-wrap -->
101
+ </div><!-- ./form-group -->
102
+
103
  </article><!-- ./sub-panel -->
104
 
105
  <article class="sub-panel sub-panel-adv-opt">
includes/class-aepc-addon-factory.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * @class AEPC_Addon_Factory
8
+ */
9
+ class AEPC_Addon_Factory {
10
+
11
+ /**
12
+ * The slug of addon, useful to identify some common resources
13
+ *
14
+ * @var string
15
+ */
16
+ protected $addon_slug = '';
17
+
18
+ /**
19
+ * Store the name of addon. It doesn't need a translate.
20
+ *
21
+ * @var string
22
+ */
23
+ protected $addon_name = '';
24
+
25
+ /**
26
+ * Store the main file of the plugin
27
+ *
28
+ * @var string
29
+ */
30
+ protected $main_file = '';
31
+
32
+ /**
33
+ * Store the URL of plugin website
34
+ *
35
+ * @var string
36
+ */
37
+ protected $website_url = '';
38
+
39
+ /**
40
+ * List of standard events supported
41
+ *
42
+ * @var array
43
+ */
44
+ protected $events_support = array();
45
+
46
+ /**
47
+ * The path for the logo images
48
+ */
49
+ const LOGO_IMG_PATH = 'includes/admin/assets/img/store-logo/';
50
+
51
+ /**
52
+ * Returns the human name of addon to show somewhere
53
+ *
54
+ * @return string
55
+ */
56
+ public function get_name() {
57
+ return $this->addon_name;
58
+ }
59
+
60
+ /**
61
+ * Get the main file of addon
62
+ *
63
+ * @return string
64
+ */
65
+ public function get_main_file() {
66
+ return $this->main_file;
67
+ }
68
+
69
+ /**
70
+ * Returns the website URL, useful on frontend to link the user to the plugin website
71
+ *
72
+ * @return string
73
+ */
74
+ public function get_website_url() {
75
+ return $this->website_url;
76
+ }
77
+
78
+ /**
79
+ * Returns the URI of logo image to show on admin UI
80
+ *
81
+ * @return string
82
+ */
83
+ public function get_logo_img() {
84
+ return PixelCaffeine()->plugin_url() . '/' . self::LOGO_IMG_PATH . $this->addon_slug . '.png';
85
+ }
86
+
87
+ /**
88
+ * Dynamic Ads methods
89
+ */
90
+
91
+ /**
92
+ * Check if the add on supports the event name passed in parameter, useful when the code should know what events
93
+ * must fire
94
+ *
95
+ * @param string $event_name The event name.
96
+ *
97
+ * @return bool
98
+ */
99
+ public function supports_event( $event_name ) {
100
+ return in_array( $event_name, $this->events_support, true );
101
+ }
102
+
103
+ /**
104
+ * Get the events supported by this addon
105
+ *
106
+ * @return array
107
+ */
108
+ public function get_event_supported() {
109
+ return $this->events_support;
110
+ }
111
+
112
+ /**
113
+ * Get the parameters to send with one of standard event
114
+ *
115
+ * @param string $event One of standard events by facebook, such 'ViewContent', 'AddToCart', so on.
116
+ *
117
+ * @return array
118
+ */
119
+ public function get_parameters_for( $event ) {
120
+ $event = strtolower( preg_replace( '/(?<!^)[A-Z]/', '_$0', $event ) );
121
+ return call_user_func( array( $this, 'get_' . $event . '_params' ) );
122
+ }
123
+
124
+ /**
125
+ * Check if we are in a place to fire the event passed in parameter
126
+ *
127
+ * @param string $event One of standard events by facebook, such 'ViewContent', 'AddToCart', so on.
128
+ *
129
+ * @return bool
130
+ */
131
+ public function can_fire( $event ) {
132
+ $event = strtolower( preg_replace( '/(?<!^)[A-Z]/', '_$0', $event ) );
133
+ return call_user_func( array( $this, 'can_fire_' . $event ) );
134
+ }
135
+
136
+ /**
137
+ * Check if we are in a place to fire the ViewContent event
138
+ *
139
+ * @return bool
140
+ */
141
+ protected function can_fire_view_content() {
142
+ return false;
143
+ }
144
+
145
+ /**
146
+ * Check if we are in a place to fire the AddToCart event
147
+ *
148
+ * @return bool
149
+ */
150
+ protected function can_fire_add_to_cart() {
151
+ return false;
152
+ }
153
+
154
+ /**
155
+ * Check if we are in a place to fire the InitiateCheckout event
156
+ *
157
+ * @return bool
158
+ */
159
+ protected function can_fire_initiate_checkout() {
160
+ return false;
161
+ }
162
+
163
+ /**
164
+ * Check if we are in a place to fire the AddPaymentInfo event
165
+ *
166
+ * @return bool
167
+ */
168
+ protected function can_fire_add_payment_info() {
169
+ return false;
170
+ }
171
+
172
+ /**
173
+ * Check if we are in a place to fire the Purchase event
174
+ *
175
+ * @return bool
176
+ */
177
+ protected function can_fire_purchase() {
178
+ return false;
179
+ }
180
+
181
+ /**
182
+ * Check if we are in a place to fire the AddToWishlist event
183
+ *
184
+ * @return bool
185
+ */
186
+ protected function can_fire_add_to_wishlist() {
187
+ return false;
188
+ }
189
+
190
+ /**
191
+ * Check if we are in a place to fire the Lead event
192
+ *
193
+ * @return bool
194
+ */
195
+ protected function can_fire_lead() {
196
+ return false;
197
+ }
198
+
199
+ /**
200
+ * Check if we are in a place to fire the CompleteRegistration event
201
+ *
202
+ * @return bool
203
+ */
204
+ protected function can_fire_complete_registration() {
205
+ return false;
206
+ }
207
+
208
+ /**
209
+ * Check if we are in a place to fire the Search event
210
+ *
211
+ * @return bool
212
+ */
213
+ protected function can_fire_search() {
214
+ return false;
215
+ }
216
+
217
+ /**
218
+ * Get product info from single page for ViewContent event
219
+ *
220
+ * @return array
221
+ */
222
+ protected function get_view_content_params() {
223
+ return array();
224
+ }
225
+
226
+ /**
227
+ * Get info from product when added to cart for AddToCart event
228
+ *
229
+ * @return array
230
+ */
231
+ protected function get_add_to_cart_params() {
232
+ return array();
233
+ }
234
+
235
+ /**
236
+ * Get info from checkout page for InitiateCheckout event
237
+ *
238
+ * @return array
239
+ */
240
+ protected function get_initiate_checkout_params() {
241
+ return array();
242
+ }
243
+
244
+ /**
245
+ * Get info from checkout page for AddPaymentInfo event
246
+ *
247
+ * @return array
248
+ */
249
+ protected function get_add_payment_info_params() {
250
+ return array();
251
+ }
252
+
253
+ /**
254
+ * Get product info from purchase succeeded page for Purchase event
255
+ *
256
+ * @return array
257
+ */
258
+ protected function get_purchase_params() {
259
+ return array();
260
+ }
261
+
262
+ /**
263
+ * Get info from product added to wishlist for AddToWishlist event
264
+ *
265
+ * @return array
266
+ */
267
+ protected function get_add_to_wishlist_params() {
268
+ return array();
269
+ }
270
+
271
+ /**
272
+ * Get info from lead of a sign up action for Lead event
273
+ *
274
+ * @return array
275
+ */
276
+ protected function get_lead_params() {
277
+ return array();
278
+ }
279
+
280
+ /**
281
+ * Get info from when a registration form is completed, such as signup for a service, for CompleteRegistration event
282
+ *
283
+ * @return array
284
+ */
285
+ protected function get_complete_registration_params() {
286
+ return array();
287
+ }
288
+
289
+ /**
290
+ * Get info a search of products is performed for Search event
291
+ *
292
+ * @return array
293
+ */
294
+ protected function get_search_params() {
295
+ return array();
296
+ }
297
+
298
+ /**
299
+ * Get the info about the customer
300
+ *
301
+ * @return array
302
+ */
303
+ public function get_customer_info() {
304
+ return array();
305
+ }
306
+
307
+ /**
308
+ * HELPERS
309
+ */
310
+
311
+ /**
312
+ * Retrieve the product name
313
+ *
314
+ * @param int $product_id The ID of product where get its name.
315
+ *
316
+ * @return string
317
+ */
318
+ public function get_product_name( $product_id ) {
319
+ return $product_id;
320
+ }
321
+
322
+ /**
323
+ * Says if the product is of addon type
324
+ *
325
+ * @param int $product_id The product ID.
326
+ *
327
+ * @return bool
328
+ */
329
+ public function is_product_of_this_addon( $product_id ) {
330
+ return false;
331
+ }
332
+ }
includes/class-aepc-addons-support.php ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * @class AEPC_Addons_Support
8
+ */
9
+ class AEPC_Addons_Support {
10
+
11
+ /**
12
+ * List of eCommerce plugin supported
13
+ *
14
+ * @var array
15
+ */
16
+ protected static $supports = array( 'woocommerce', 'edd' );
17
+
18
+ /**
19
+ * Folder with all classes for each plugin supported
20
+ *
21
+ * @var string
22
+ */
23
+ protected static $addons_dir = 'includes/supports/';
24
+
25
+ /**
26
+ * Save the instances, so you don't need to re-instantiate again
27
+ *
28
+ * @var array
29
+ */
30
+ protected static $instances = array();
31
+
32
+ /**
33
+ * Initialize the class
34
+ */
35
+ public static function init() {
36
+ // Init addon instances.
37
+ self::get_supported_addons();
38
+ }
39
+
40
+ /**
41
+ * Get the instance of object that manage the ecommerce plugin support
42
+ *
43
+ * @param string $plugin_name The plugin slug to identify the object instance to get.
44
+ *
45
+ * @return AEPC_Edd_Addon_Support|AEPC_Woocommerce_Addon_Support
46
+ */
47
+ public static function get_support_instance( $plugin_name ) {
48
+ include_once( PixelCaffeine()->plugin_path() . '/' . self::$addons_dir . 'class-aepc-' . $plugin_name . '-addon-support.php' );
49
+ $classname = sprintf( 'AEPC_%s_Addon_Support', ucfirst( $plugin_name ) );
50
+ return new $classname();
51
+ }
52
+
53
+ /**
54
+ * Get the instances of supported addons
55
+ *
56
+ * @return AEPC_Edd_Addon_Support[]|AEPC_Woocommerce_Addon_Support[]
57
+ */
58
+ public static function get_supported_addons() {
59
+ foreach ( apply_filters( 'aepc_supported_addons', self::$supports ) as $addon ) {
60
+ if ( isset( self::$instances[ $addon ] ) ) {
61
+ continue;
62
+ }
63
+
64
+ self::$instances[ $addon ] = self::get_support_instance( $addon );
65
+ }
66
+
67
+ return self::$instances;
68
+ }
69
+
70
+ /**
71
+ * Get the instances of supported addons detected activated
72
+ *
73
+ * @return AEPC_Edd_Addon_Support[]|AEPC_Woocommerce_Addon_Support[]
74
+ */
75
+ public static function get_detected_addons() {
76
+ $detected = array();
77
+
78
+ foreach ( self::get_supported_addons() as $addon ) {
79
+ if ( $addon->is_active() ) {
80
+ $detected[] = $addon;
81
+ }
82
+ }
83
+
84
+ return $detected;
85
+ }
86
+
87
+ /**
88
+ * Say if there are addon supported active
89
+ *
90
+ * @return bool
91
+ */
92
+ public static function are_detected_addons() {
93
+ return count( self::get_detected_addons() ) > 0;
94
+ }
95
+
96
+ /**
97
+ * Extend the init params with the extra info about the customer of shop
98
+ *
99
+ * @param array $params Params to extend.
100
+ *
101
+ * @return array
102
+ */
103
+ public static function extend_customer_parameters( $params ) {
104
+ foreach ( self::get_detected_addons() as $addon ) {
105
+ $user_info = $addon->get_customer_info();
106
+ if ( ! empty( $user_info ) ) {
107
+ $params = array_merge( $user_info, array_filter( $params ) );
108
+ }
109
+ }
110
+
111
+ return $params;
112
+ }
113
+
114
+ /**
115
+ * Check if the event passe din parameter is supported in one of addon active detected
116
+ *
117
+ * @param string $event One of the standard event
118
+ *
119
+ * @return bool
120
+ */
121
+ public static function is_event_supported( $event ) {
122
+ foreach ( self::get_detected_addons() as $addon ) {
123
+ if ( $addon->supports_event( $event ) ) {
124
+ return true;
125
+ }
126
+ }
127
+
128
+ return false;
129
+ }
130
+ }
includes/class-aepc-pixel-scripts.php CHANGED
@@ -19,8 +19,6 @@ class AEPC_Pixel_Scripts {
19
  add_action( 'wp_footer', array( __CLASS__, 'track_conversions_events' ) );
20
 
21
  add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts' ) );
22
- add_filter( 'woocommerce_params', array( __CLASS__, 'add_currency_param' ) );
23
- add_action( 'woocommerce_after_shop_loop_item', array( __CLASS__, 'add_content_category_meta' ), 99 );
24
 
25
  if ( 'head' == get_option( 'aepc_pixel_position', 'head' ) ) {
26
  add_action( 'wp_head', array( __CLASS__, 'pixel_init' ), 99 );
@@ -49,7 +47,7 @@ class AEPC_Pixel_Scripts {
49
  );
50
 
51
  // eCommerce parameters
52
- if ( function_exists( 'WC' ) ) {
53
  $args = array_merge( $args, array(
54
  'enable_viewcontent' => self::is_event_enabled( 'viewcontent' ) ? 'yes' : 'no',
55
  'enable_search' => self::is_event_enabled( 'search' ) ? 'yes' : 'no',
@@ -71,14 +69,8 @@ class AEPC_Pixel_Scripts {
71
  'ln' => $user->last_name
72
  );
73
 
74
- if ( function_exists( 'WC' ) ) {
75
- $args['user'] += array(
76
- 'ph' => $user->billing_phone,
77
- 'ct' => $user->billing_city,
78
- 'st' => $user->billing_state,
79
- 'zp' => $user->billing_postcode
80
- );
81
- }
82
 
83
  $args['user'] = array_filter( $args['user'] );
84
  $args['user'] = array_map( 'strtolower', $args['user'] ); // It's required by facebook (https://developers.facebook.com/docs/facebook-pixel/pixel-with-ads/conversion-tracking#advanced_match).
@@ -183,31 +175,6 @@ class AEPC_Pixel_Scripts {
183
  return call_user_func( 'AEPC_Track::is_' . strtolower( $event ) . '_active' );
184
  }
185
 
186
- /**
187
- * Return a formatted list of categories as facebook expects
188
- *
189
- * @param $object_id
190
- * @param string $tax
191
- *
192
- * @return string
193
- */
194
- public static function content_category_list( $object_id, $tax = 'product_cat' ) {
195
- $terms = wp_get_object_terms( $object_id, $tax );
196
-
197
- foreach ( $terms as &$term ) {
198
- if ( $term->parent != 0 ) {
199
- $parent_term = $term;
200
-
201
- while( ! empty( $parent_term->parent ) ) {
202
- $parent_term = get_term( $parent_term->parent, $tax );
203
- $term->name = $parent_term->name . ' > ' . $term->name;
204
- };
205
- }
206
- }
207
-
208
- return self::value_format_array( wp_list_pluck( $terms, 'name' ) );
209
- }
210
-
211
  /**
212
  * Standard Events trackable at load page
213
  */
@@ -217,98 +184,13 @@ class AEPC_Pixel_Scripts {
217
  AEPC_Track::track( 'Search', array( 'search_string' => get_search_query( false ) ) );
218
  }
219
 
220
- if ( function_exists( 'WC' ) ) {
221
-
222
- if ( self::is_event_enabled( 'viewcontent' ) && is_product() ) {
223
- $product = wc_get_product();
224
-
225
- if ( $product->is_type( 'variable' ) ) {
226
- /** @var WC_Product_Variable[] $children */
227
- $children = array_map( 'wc_get_product', $product->get_children('visible') );
228
-
229
- foreach ( $children as &$child ) {
230
- $child = $child->sku ? $child->sku : $child->id;
231
- }
232
-
233
- $params = array(
234
- 'content_type' => 'product_group',
235
- 'content_ids' => $children,
236
- );
237
-
238
- } else {
239
- $params = array(
240
- 'content_type' => 'product',
241
- 'content_ids' => array( $product->sku ? $product->sku : $product->id ),
242
- );
243
- }
244
-
245
- $params['content_name'] = $product->get_title();
246
- $params['content_category'] = self::content_category_list( $product->id );
247
- $params['value'] = floatval( $product->get_price() );
248
- $params['currency'] = get_woocommerce_currency();
249
-
250
- AEPC_Track::track( 'ViewContent', $params );
251
-
252
- }
253
-
254
- elseif ( self::is_event_enabled( 'purchase' ) && is_order_received_page() ) {
255
- global $wp;
256
-
257
- $product_ids = array();
258
- $order = wc_get_order( $wp->query_vars['order-received'] );
259
-
260
- foreach ( $order->get_items() as $item_key => $item ) {
261
- $_product = is_object( $item ) ? $item->get_product() : $order->get_product_from_item( $item );
262
-
263
- if ( ! empty( $_product ) ) {
264
- $product_ids[] = $_product->sku ? $_product->sku : $_product->id;
265
- } else {
266
- $product_ids[] = $item['product_id'];
267
- }
268
- }
269
-
270
- AEPC_Track::track( 'Purchase', array(
271
- 'content_ids' => $product_ids,
272
- 'content_type' => 'product',
273
- 'value' => $order->get_total(),
274
- 'currency' => method_exists( $order, 'get_currency' ) ? $order->get_currency() : $order->get_order_currency()
275
- ) );
276
-
277
- }
278
-
279
- elseif ( self::is_event_enabled( 'initiatecheckout' ) && is_checkout() && ! is_order_received_page() ) {
280
- $product_ids = array();
281
- $num_items = 0;
282
-
283
- foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
284
- $_product = $values['data'];
285
- $product_ids[] = ! empty( $_product->sku ) ? $_product->sku : $_product->id;
286
- $num_items += $values['quantity'];
287
  }
288
-
289
- AEPC_Track::track( 'InitiateCheckout', array(
290
- 'content_type' => 'product',
291
- 'content_ids' => $product_ids,
292
- 'num_items' => $num_items,
293
- 'value' => WC()->cart->total,
294
- 'currency' => get_woocommerce_currency()
295
- ) );
296
- }
297
-
298
- // Add to cart from single page product
299
- if ( self::is_event_enabled( 'addtocart' ) && ! empty( $_REQUEST['add-to-cart'] ) ) {
300
- $product = wc_get_product( intval( $_REQUEST['add-to-cart'] ) );
301
-
302
- AEPC_Track::track( 'AddToCart', array(
303
- 'content_type' => 'product',
304
- 'content_ids' => array( ! empty( $product->sku ) ? $product->sku : $product->id ),
305
- 'content_category' => self::content_category_list( $product->id ),
306
- 'value' => floatval( $product->get_price() ),
307
- 'currency' => get_woocommerce_currency()
308
- ) );
309
-
310
  }
311
-
312
  }
313
  }
314
 
@@ -341,7 +223,7 @@ class AEPC_Pixel_Scripts {
341
  foreach ( get_the_taxonomies( $post ) as $taxonomy => $taxonomy_name ) {
342
  $terms = wp_list_pluck( (array) get_the_terms( $post, $taxonomy ), 'name' );
343
  if ( ! empty( $terms ) ) {
344
- $params[ 'tax_' . $taxonomy ] = self::value_format_array( $terms );
345
  }
346
  }
347
  }
@@ -430,7 +312,7 @@ class AEPC_Pixel_Scripts {
430
  continue;
431
  }
432
 
433
- $current_rel_uri = add_query_arg( NULL, NULL );
434
  $url = addcslashes( str_replace( '*', '[^/]+', $track['url'] ), '/' );
435
 
436
  if ( '*' == $track['url'] || preg_match( "/{$url}/", $current_rel_uri ) ) {
@@ -501,40 +383,28 @@ class AEPC_Pixel_Scripts {
501
  }
502
 
503
  /**
504
- * Add currency value on params list on woocommerce localize
505
  *
506
- * @param $data
 
507
  *
508
- * @return array
509
  */
510
- public static function add_currency_param( $data ) {
511
- if ( ! function_exists('get_woocommerce_currency') ) {
512
- return $data;
513
- }
514
 
515
- return array_merge( $data, array(
516
- 'currency' => get_woocommerce_currency()
517
- ) );
518
- }
519
 
520
- /**
521
- * Add a meta info inside each product of loop, to have content_category for each product
522
- */
523
- public static function add_content_category_meta() {
524
- $product = wc_get_product();
525
- ?><span data-content_category="<?php echo esc_attr( wp_json_encode( self::content_category_list( $product->id ) ) ) ?>" style="display:none;"></span><?php
526
- }
527
 
528
- /**
529
- * Format array for the value of parameter
530
- *
531
- * @param array $haystack
532
- *
533
- * @return string
534
- */
535
- public static function value_format_array( $haystack ) {
536
- return $haystack;
537
- //return '|' . implode( '|', $haystack ) . '|';
538
  }
539
 
540
  // INTEGRATIONS
19
  add_action( 'wp_footer', array( __CLASS__, 'track_conversions_events' ) );
20
 
21
  add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts' ) );
 
 
22
 
23
  if ( 'head' == get_option( 'aepc_pixel_position', 'head' ) ) {
24
  add_action( 'wp_head', array( __CLASS__, 'pixel_init' ), 99 );
47
  );
48
 
49
  // eCommerce parameters
50
+ if ( AEPC_Addons_Support::are_detected_addons() ) {
51
  $args = array_merge( $args, array(
52
  'enable_viewcontent' => self::is_event_enabled( 'viewcontent' ) ? 'yes' : 'no',
53
  'enable_search' => self::is_event_enabled( 'search' ) ? 'yes' : 'no',
69
  'ln' => $user->last_name
70
  );
71
 
72
+ // Add some extra information about the customer if an ecommerce addon is detected.
73
+ $args['user'] = AEPC_Addons_Support::extend_customer_parameters( $args['user'] );
 
 
 
 
 
 
74
 
75
  $args['user'] = array_filter( $args['user'] );
76
  $args['user'] = array_map( 'strtolower', $args['user'] ); // It's required by facebook (https://developers.facebook.com/docs/facebook-pixel/pixel-with-ads/conversion-tracking#advanced_match).
175
  return call_user_func( 'AEPC_Track::is_' . strtolower( $event ) . '_active' );
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  /**
179
  * Standard Events trackable at load page
180
  */
184
  AEPC_Track::track( 'Search', array( 'search_string' => get_search_query( false ) ) );
185
  }
186
 
187
+ // Fire the dynamic ads events caught by ecommerce addons supported.
188
+ foreach ( AEPC_Addons_Support::get_detected_addons() as $addon ) {
189
+ foreach ( $addon->get_event_supported() as $event_name ) {
190
+ if ( self::is_event_enabled( $event_name ) && $addon->supports_event( $event_name ) && $addon->can_fire( $event_name ) ) {
191
+ AEPC_Track::track( $event_name, $addon->get_parameters_for( $event_name ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
 
194
  }
195
  }
196
 
223
  foreach ( get_the_taxonomies( $post ) as $taxonomy => $taxonomy_name ) {
224
  $terms = wp_list_pluck( (array) get_the_terms( $post, $taxonomy ), 'name' );
225
  if ( ! empty( $terms ) ) {
226
+ $params[ 'tax_' . $taxonomy ] = $terms;
227
  }
228
  }
229
  }
312
  continue;
313
  }
314
 
315
+ $current_rel_uri = trailingslashit( home_url( add_query_arg( NULL, NULL ) ) );
316
  $url = addcslashes( str_replace( '*', '[^/]+', $track['url'] ), '/' );
317
 
318
  if ( '*' == $track['url'] || preg_match( "/{$url}/", $current_rel_uri ) ) {
383
  }
384
 
385
  /**
386
+ * Return a formatted list of categories as facebook expects
387
  *
388
+ * @param $object_id
389
+ * @param string $tax
390
  *
391
+ * @return string
392
  */
393
+ public static function content_category_list( $object_id, $tax = 'product_cat' ) {
394
+ $terms = wp_get_object_terms( $object_id, $tax );
 
 
395
 
396
+ foreach ( $terms as &$term ) {
397
+ if ( $term->parent != 0 ) {
398
+ $parent_term = $term;
 
399
 
400
+ while( ! empty( $parent_term->parent ) ) {
401
+ $parent_term = get_term( $parent_term->parent, $tax );
402
+ $term->name = $parent_term->name . ' > ' . $term->name;
403
+ };
404
+ }
405
+ }
 
406
 
407
+ return wp_list_pluck( $terms, 'name' );
 
 
 
 
 
 
 
 
 
408
  }
409
 
410
  // INTEGRATIONS
includes/class-aepc-track.php CHANGED
@@ -13,7 +13,7 @@ class AEPC_Track {
13
 
14
  static $standard_events = array(
15
 
16
- 'ViewContent' => 'value, currency, content_name, content_type, content_ids',
17
  'Search' => 'value, currency, content_category, content_ids, search_string',
18
  'AddToCart' => 'value, currency, content_name, content_type, content_ids',
19
  'AddToWishlist' => 'value, currency, content_name, content_category, content_ids',
@@ -81,6 +81,24 @@ class AEPC_Track {
81
  $delay = self::detect_delay_firing( $event );
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  $track_type = self::get_track_type( $event );
85
  $track_data = array( 'params' => $event_params, 'delay' => $delay );
86
 
@@ -349,6 +367,15 @@ class AEPC_Track {
349
  return self::is_dpa_active() && 'yes' === get_option( 'aepc_enable_purchase', 'no' );
350
  }
351
 
 
 
 
 
 
 
 
 
 
352
  /**
353
  * Return if the Custom Audiences events are active
354
  *
@@ -415,4 +442,11 @@ class AEPC_Track {
415
  return $delay;
416
  }
417
 
 
 
 
 
 
 
 
418
  }
13
 
14
  static $standard_events = array(
15
 
16
+ 'ViewContent' => 'value, currency, content_category, content_name, content_type, content_ids',
17
  'Search' => 'value, currency, content_category, content_ids, search_string',
18
  'AddToCart' => 'value, currency, content_name, content_type, content_ids',
19
  'AddToWishlist' => 'value, currency, content_name, content_category, content_ids',
81
  $delay = self::detect_delay_firing( $event );
82
  }
83
 
84
+ /**
85
+ * Define placeholders to set dynamic values
86
+ *
87
+ * Save {{placeholder}} in the field text of the conversions/events form. The "placeholder" key you will use
88
+ * must be defined in a key of this array and then it will be translated in the value you set for that key.
89
+ */
90
+ $placeholder_format = apply_filters( 'aepc_event_placeholder_format', '{{%s}}' );
91
+ $placeholders = apply_filters( 'aepc_event_placeholders', array(), $event, $event_params );
92
+
93
+ // Apply the placeholder format to the keys.
94
+ foreach ( $placeholders as $key => $value ) {
95
+ $placeholders[ sprintf( $placeholder_format, $key ) ] = $value;
96
+ unset( $placeholders[ $key ] );
97
+ }
98
+
99
+ // Translate all placeholders in the params array.
100
+ $event_params = json_decode( str_replace( array_keys( $placeholders ), array_values( $placeholders ), wp_json_encode( $event_params ) ), true );
101
+
102
  $track_type = self::get_track_type( $event );
103
  $track_data = array( 'params' => $event_params, 'delay' => $delay );
104
 
367
  return self::is_dpa_active() && 'yes' === get_option( 'aepc_enable_purchase', 'no' );
368
  }
369
 
370
+ /**
371
+ * Return if Purchase events is active
372
+ *
373
+ * @return mixed|void
374
+ */
375
+ public static function is_completeregistration_active() {
376
+ return self::is_dpa_active() && 'yes' === get_option( 'aepc_enable_completeregistration', 'no' );
377
+ }
378
+
379
  /**
380
  * Return if the Custom Audiences events are active
381
  *
442
  return $delay;
443
  }
444
 
445
+ /**
446
+ * Get if the user wants to track the shipping
447
+ */
448
+ public static function can_track_shipping_costs() {
449
+ return 'yes' === get_option( 'aepc_track_shipping_costs' );
450
+ }
451
+
452
  }
includes/supports/class-aepc-edd-addon-support.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * @class AEPC_Edd_Addon_Support
8
+ */
9
+ class AEPC_Edd_Addon_Support extends AEPC_Addon_Factory {
10
+
11
+ /**
12
+ * The slug of addon, useful to identify some common resources
13
+ *
14
+ * @var string
15
+ */
16
+ protected $addon_slug = 'edd';
17
+
18
+ /**
19
+ * Store the name of addon. It doesn't need a translate.
20
+ *
21
+ * @var string
22
+ */
23
+ protected $addon_name = 'Easy Digital Downloads';
24
+
25
+ /**
26
+ * Store the main file of rthe plugin
27
+ *
28
+ * @var string
29
+ */
30
+ protected $main_file = 'easy-digital-downloads/easy-digital-downloads.php';
31
+
32
+ /**
33
+ * Store the URL of plugin website
34
+ *
35
+ * @var string
36
+ */
37
+ protected $website_url = 'https://wordpress.org/plugins/easy-digital-downloads/';
38
+
39
+ /**
40
+ * List of standard events supported for pixel firing by PHP (it's not included the events managed by JS)
41
+ *
42
+ * @var array
43
+ */
44
+ protected $events_support = array( 'ViewContent', 'AddToCart', 'Purchase', 'AddPaymentInfo', 'InitiateCheckout' );
45
+
46
+ /**
47
+ * AEPC_Edd_Addon_Support constructor.
48
+ */
49
+ public function __construct() {
50
+ add_action( 'edd_post_add_to_cart', array( $this, 'save_to_fire_after_add_to_cart' ), 10, 3 );
51
+ add_filter( 'edd_purchase_download_form', array( $this, 'add_category_and_sku_attributes' ), 10, 2 );
52
+ }
53
+
54
+ /**
55
+ * Check if the plugin is active by checking the main function is existing
56
+ *
57
+ * @return bool
58
+ */
59
+ public function is_active() {
60
+ return function_exists( 'EDD' );
61
+ }
62
+
63
+ /**
64
+ * Check if we are in a place to fire the ViewContent event
65
+ *
66
+ * @return bool
67
+ */
68
+ protected function can_fire_view_content() {
69
+ return is_singular( 'download' ) && is_main_query();
70
+ }
71
+
72
+ /**
73
+ * Check if we are in a place to fire the AddToCart event
74
+ *
75
+ * @return bool
76
+ */
77
+ protected function can_fire_add_to_cart() {
78
+ return false !== EDD()->session->get( 'add_to_cart_data' );
79
+ }
80
+
81
+ /**
82
+ * Check if we are in a place to fire the InitiateCheckout event
83
+ *
84
+ * @return bool
85
+ */
86
+ protected function can_fire_initiate_checkout() {
87
+ return edd_is_checkout();
88
+ }
89
+
90
+ /**
91
+ * Check if we are in a place to fire the Purchase event
92
+ *
93
+ * @return bool
94
+ */
95
+ protected function can_fire_purchase() {
96
+ return edd_is_success_page();
97
+ }
98
+
99
+ /**
100
+ * Get product info from single page for ViewContent event
101
+ *
102
+ * @return array
103
+ */
104
+ protected function get_view_content_params() {
105
+ $product_id = get_the_ID();
106
+
107
+ if ( ! edd_has_variable_prices( $product_id ) ) {
108
+ $price = edd_get_download_price( $product_id );
109
+ } else {
110
+ $price = edd_get_lowest_price_option( $product_id );
111
+ }
112
+
113
+ $params['content_name'] = $this->get_product_name( $product_id );
114
+ $params['content_type'] = 'product';
115
+ $params['content_ids'] = array( $this->maybe_sku( $product_id ) );
116
+ $params['content_category'] = AEPC_Pixel_Scripts::content_category_list( $product_id, 'download_category' );
117
+ $params['value'] = floatval( $price );
118
+ $params['currency'] = edd_get_currency();
119
+
120
+ return $params;
121
+ }
122
+
123
+ /**
124
+ * Save the data in session for the AddToCart pixel to fire.
125
+ *
126
+ * Because EDD after add to cart make a redirect, I cannot fire the pixel in the page are loading. So, the only way
127
+ * to fire the pixel is save the data to fire in the session and then after redirect read the session and fire the
128
+ * pixel if it founds the data saved in session.
129
+ *
130
+ * @param int $download_id
131
+ * @param array $options
132
+ * @param array $items
133
+ */
134
+ public function save_to_fire_after_add_to_cart( $download_id, $options, $items ) {
135
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX || ! AEPC_Track::is_addtocart_active() ) {
136
+ return;
137
+ }
138
+
139
+ $price = 0;
140
+
141
+ // Calculate the total price.
142
+ foreach ( $items as $item ) {
143
+ $price += $this->get_price( $download_id, $item['options'] ) * $item['quantity'];
144
+ }
145
+
146
+ $data = array(
147
+ 'content_type' => 'product',
148
+ 'content_ids' => array_map( array( $this, 'maybe_sku' ), wp_list_pluck( $items, 'id' ) ),
149
+ 'content_category' => AEPC_Pixel_Scripts::content_category_list( $download_id, 'download_category' ),
150
+ 'value' => floatval( $price ),
151
+ 'currency' => edd_get_currency()
152
+ );
153
+
154
+ EDD()->session->set( 'add_to_cart_data', $data );
155
+ }
156
+
157
+ /**
158
+ * Get info from product when added to cart for AddToCart event
159
+ *
160
+ * @return array
161
+ */
162
+ protected function get_add_to_cart_params() {
163
+ $params = EDD()->session->get( 'add_to_cart_data' );
164
+
165
+ // Remove the data to not fire again.
166
+ EDD()->session->set( 'add_to_cart_data', false );
167
+
168
+ return $params;
169
+ }
170
+
171
+ /**
172
+ * Get info from checkout page for InitiateCheckout event
173
+ *
174
+ * @return array
175
+ */
176
+ protected function get_initiate_checkout_params() {
177
+ $product_ids = array();
178
+ $num_items = 0;
179
+ $total = 0;
180
+
181
+ foreach ( edd_get_cart_contents() as $cart_item ) {
182
+ $product_id = $this->maybe_sku( intval( $cart_item['id'] ) );
183
+ $num_items += $cart_item['quantity'];
184
+ $product_ids[] = $product_id;
185
+ $total += $this->get_price( $cart_item['id'], $cart_item['options'] ) * $cart_item['quantity'];
186
+ }
187
+
188
+ return array(
189
+ 'content_type' => 'product',
190
+ 'content_ids' => $product_ids,
191
+ 'num_items' => $num_items,
192
+ 'value' => floatval( $total ),
193
+ 'currency' => edd_get_currency()
194
+ );
195
+ }
196
+
197
+ /**
198
+ * Get product info from purchase succeeded page for Purchase event
199
+ *
200
+ * @return array
201
+ */
202
+ protected function get_purchase_params() {
203
+ global $edd_receipt_args;
204
+
205
+ $payment = get_post( $edd_receipt_args['id'] );
206
+ $payment_id = $payment->ID;
207
+ $product_ids = array();
208
+
209
+ if ( empty( $payment ) ) {
210
+ return array();
211
+ }
212
+
213
+ $cart = edd_get_payment_meta_cart_details( $payment_id, true );
214
+
215
+ foreach ( (array) $cart as $key => $item ) {
216
+ $product_ids[] = $this->maybe_sku( $item['id'] );
217
+ }
218
+
219
+ return array(
220
+ 'content_ids' => $product_ids,
221
+ 'content_type' => 'product',
222
+ 'value' => edd_get_payment_amount( $payment_id ),
223
+ 'currency' => edd_get_payment_currency_code( $payment_id ),
224
+ );
225
+ }
226
+
227
+ /**
228
+ * Get the info about the customer
229
+ *
230
+ * @return array
231
+ */
232
+ public function get_customer_info() {
233
+ $user = wp_get_current_user();
234
+ $address = $user->_edd_user_address;
235
+
236
+ if ( empty( $address ) ) {
237
+ return array();
238
+ }
239
+
240
+ return array(
241
+ 'ct' => $address['city'],
242
+ 'st' => $address['state'],
243
+ 'zp' => $address['zip'],
244
+ );
245
+ }
246
+
247
+ /**
248
+ * Returns SKU if exists, otherwise the product ID
249
+ *
250
+ * @return string|int
251
+ */
252
+ protected function maybe_sku( $product_id ) {
253
+ if ( edd_use_skus() && ( $sku = get_post_meta( $product_id, 'edd_sku', true ) ) && ! empty( $sku ) ) {
254
+ return $sku;
255
+ }
256
+
257
+ return $product_id;
258
+ }
259
+
260
+ /**
261
+ * Retrieve the price
262
+ *
263
+ * @param int $download_id The download ID where get the price.
264
+ * @param array $options When the download have different price options, this array contains the price ID.
265
+ *
266
+ * @return float
267
+ */
268
+ protected function get_price( $download_id, $options = array() ) {
269
+ return isset( $options['price_id'] ) ? edd_get_price_option_amount( $download_id, $options['price_id'] ) : edd_get_download_price( $download_id );
270
+ }
271
+
272
+ /**
273
+ * Add the data attributes for SKU and categories, used for the events fired via javascript
274
+ *
275
+ * @param string $purchase_form HTML of the whole purchase form.
276
+ * @param array $args Download arguments.
277
+ *
278
+ * @return string
279
+ */
280
+ public function add_category_and_sku_attributes( $purchase_form, $args ) {
281
+ $product_id = $args['download_id'];
282
+ $target = 'data-action="edd_add_to_cart" ';
283
+ $atts = '';
284
+
285
+ // SKU.
286
+ if ( edd_use_skus() && $sku = get_post_meta( $product_id, 'edd_sku', true ) ) {
287
+ $atts .= sprintf( 'data-download-sku="%s" ', esc_attr( $sku ) );
288
+ }
289
+
290
+ // Categories.
291
+ $atts .= sprintf( 'data-download-categories="%s" ', esc_attr( wp_json_encode( AEPC_Pixel_Scripts::content_category_list( $product_id, 'download_category' ) ) ) );
292
+
293
+ return str_replace( $target, $target . $atts, $purchase_form );
294
+ }
295
+
296
+ /**
297
+ * HELPERS
298
+ */
299
+
300
+ /**
301
+ * Retrieve the product name
302
+ *
303
+ * @param int $product_id The ID of product where get its name.
304
+ *
305
+ * @return string
306
+ */
307
+ public function get_product_name( $product_id ) {
308
+ return get_post_field( 'post_title', $product_id );
309
+ }
310
+
311
+ /**
312
+ * Says if the product is of addon type
313
+ *
314
+ * @param int $product_id The product ID.
315
+ *
316
+ * @return bool
317
+ */
318
+ public function is_product_of_this_addon( $product_id ) {
319
+ return 'download' === get_post_type( $product_id );
320
+ }
321
+
322
+ }
includes/supports/class-aepc-woocommerce-addon-support.php ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit; // Exit if accessed directly.
4
+ }
5
+
6
+ /**
7
+ * @class AEPC_Woocommerce_Addon_Support
8
+ */
9
+ class AEPC_Woocommerce_Addon_Support extends AEPC_Addon_Factory {
10
+
11
+ /**
12
+ * The slug of addon, useful to identify some common resources
13
+ *
14
+ * @var string
15
+ */
16
+ protected $addon_slug = 'woocommerce';
17
+
18
+ /**
19
+ * Store the name of addon. It doesn't need a translate.
20
+ *
21
+ * @var string
22
+ */
23
+ protected $addon_name = 'WooCommerce';
24
+
25
+ /**
26
+ * Store the main file of rthe plugin
27
+ *
28
+ * @var string
29
+ */
30
+ protected $main_file = 'woocommerce/woocommerce.php';
31
+
32
+ /**
33
+ * Store the URL of plugin website
34
+ *
35
+ * @var string
36
+ */
37
+ protected $website_url = 'https://wordpress.org/plugins/woocommerce/';
38
+
39
+ /**
40
+ * List of standard events supported for pixel firing by PHP (it's not included the events managed by JS)
41
+ *
42
+ * @var array
43
+ */
44
+ protected $events_support = array( 'ViewContent', 'AddToCart', 'Purchase', 'InitiateCheckout', 'AddPaymentInfo', 'CompleteRegistration' );
45
+
46
+ /**
47
+ * AEPC_Edd_Addon_Support constructor.
48
+ */
49
+ public function __construct() {
50
+ add_filter( 'woocommerce_params', array( $this, 'add_currency_param' ) );
51
+ add_action( 'woocommerce_after_shop_loop_item', array( $this, 'add_content_category_meta' ), 99 );
52
+ add_action( 'woocommerce_registration_redirect', array( $this, 'save_registration_data' ), 5 );
53
+ }
54
+
55
+ /**
56
+ * Check if the plugin is active by checking the main function is existing
57
+ *
58
+ * @return bool
59
+ */
60
+ public function is_active() {
61
+ return function_exists( 'WC' );
62
+ }
63
+
64
+ /**
65
+ * Check if we are in a place to fire the ViewContent event
66
+ *
67
+ * @return bool
68
+ */
69
+ protected function can_fire_view_content() {
70
+ return is_product();
71
+ }
72
+
73
+ /**
74
+ * Check if we are in a place to fire the AddToCart event
75
+ *
76
+ * @return bool
77
+ */
78
+ protected function can_fire_add_to_cart() {
79
+ return ! empty( $_REQUEST['add-to-cart'] );
80
+ }
81
+
82
+ /**
83
+ * Check if we are in a place to fire the InitiateCheckout event
84
+ *
85
+ * @return bool
86
+ */
87
+ protected function can_fire_initiate_checkout() {
88
+ return is_checkout() && ! is_order_received_page();
89
+ }
90
+
91
+ /**
92
+ * Check if we are in a place to fire the Purchase event
93
+ *
94
+ * @return bool
95
+ */
96
+ protected function can_fire_purchase() {
97
+ return is_order_received_page();
98
+ }
99
+
100
+ /**
101
+ * Check if we are in a place to fire the CompleteRegistration event
102
+ *
103
+ * @return bool
104
+ */
105
+ protected function can_fire_complete_registration() {
106
+ return get_option( 'woocommerce_enable_myaccount_registration' ) === 'yes' && false !== WC()->session->get( 'aepc_complete_registration_data', false );
107
+ }
108
+
109
+ /**
110
+ * Get product info from single page for ViewContent event
111
+ *
112
+ * @return array
113
+ */
114
+ protected function get_view_content_params() {
115
+ $product = wc_get_product();
116
+ $product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id;
117
+
118
+ if ( $product->is_type( 'variable' ) ) {
119
+ $children_id = method_exists( $product, 'get_visible_children' ) ? $product->get_visible_children() : $product->get_children('visible');
120
+
121
+ foreach ( $children_id as &$child_id ) {
122
+ $child_id = $this->maybe_sku( $child_id );
123
+ }
124
+
125
+ $params = array(
126
+ 'content_type' => 'product_group',
127
+ 'content_ids' => $children_id,
128
+ );
129
+
130
+ } else {
131
+ $params = array(
132
+ 'content_type' => 'product',
133
+ 'content_ids' => array( $this->maybe_sku( $product_id ) ),
134
+ );
135
+ }
136
+
137
+ $params['content_name'] = $this->get_product_name( $product );
138
+ $params['content_category'] = AEPC_Pixel_Scripts::content_category_list( $product_id );
139
+ $params['value'] = floatval( $product->get_price() );
140
+ $params['currency'] = get_woocommerce_currency();
141
+
142
+ return $params;
143
+ }
144
+
145
+ /**
146
+ * Get info from product when added to cart for AddToCart event
147
+ *
148
+ * @return array
149
+ */
150
+ protected function get_add_to_cart_params() {
151
+ $product = wc_get_product( intval( $_REQUEST['add-to-cart'] ) );
152
+ $product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id;
153
+
154
+ return array(
155
+ 'content_type' => 'product',
156
+ 'content_ids' => array( $this->maybe_sku( $product_id ) ),
157
+ 'content_category' => AEPC_Pixel_Scripts::content_category_list( $product_id ),
158
+ 'value' => floatval( $product->get_price() ),
159
+ 'currency' => get_woocommerce_currency()
160
+ );
161
+ }
162
+
163
+ /**
164
+ * Get info from checkout page for InitiateCheckout event
165
+ *
166
+ * @return array
167
+ */
168
+ protected function get_initiate_checkout_params() {
169
+ $product_ids = array();
170
+ $num_items = 0;
171
+
172
+ foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
173
+ $_product = $values['data'];
174
+ $product_ids[] = $this->maybe_sku( method_exists( $_product, 'get_id' ) ? $_product->get_id() : $_product->id );
175
+ $num_items += $values['quantity'];
176
+ }
177
+
178
+ // Order value
179
+ $cart_total = WC()->cart->total;
180
+
181
+ // Remove shipping costs
182
+ if ( ! AEPC_Track::can_track_shipping_costs() ) {
183
+ $cart_total -= WC()->cart->shipping_total;
184
+ }
185
+
186
+ return array(
187
+ 'content_type' => 'product',
188
+ 'content_ids' => $product_ids,
189
+ 'num_items' => $num_items,
190
+ 'value' => $cart_total,
191
+ 'currency' => get_woocommerce_currency()
192
+ );
193
+ }
194
+
195
+ /**
196
+ * Get product info from purchase succeeded page for Purchase event
197
+ *
198
+ * @return array
199
+ */
200
+ protected function get_purchase_params() {
201
+ global $wp;
202
+
203
+ $product_ids = array();
204
+ $order = wc_get_order( $wp->query_vars['order-received'] );
205
+
206
+ foreach ( $order->get_items() as $item_key => $item ) {
207
+ $_product = is_object( $item ) ? $item->get_product() : $order->get_product_from_item( $item );
208
+ $_product_id = method_exists( $_product, 'get_id' ) ? $_product->get_id() : $_product->id;
209
+
210
+ if ( ! empty( $_product ) ) {
211
+ $product_ids[] = $this->maybe_sku( $_product_id );
212
+ } else {
213
+ $product_ids[] = $item['product_id'];
214
+ }
215
+ }
216
+
217
+ // Order value
218
+ $order_value = $order->get_total();
219
+
220
+ // Remove shipping costs
221
+ if ( ! AEPC_Track::can_track_shipping_costs() ) {
222
+ $order_value -= method_exists( $order, 'get_shipping_total' ) ? $order->get_shipping_total() : $order->get_total_shipping();
223
+ }
224
+
225
+ return array(
226
+ 'content_ids' => $product_ids,
227
+ 'content_type' => 'product',
228
+ 'value' => $order_value,
229
+ 'currency' => method_exists( $order, 'get_currency' ) ? $order->get_currency() : $order->get_order_currency()
230
+ );
231
+ }
232
+
233
+ /**
234
+ * Save CompleteRegistration data event in session, becase of redirect after woo registration
235
+ */
236
+ public function save_registration_data( $redirect ) {
237
+ $session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
238
+ WC()->session = new $session_class();
239
+ WC()->session->set( 'aepc_complete_registration_data', apply_filters( 'aepc_complete_registration', array() ) );
240
+
241
+ // I had to hook into the filter for decide what URL use for redirect after registration. I need to pass it.
242
+ return $redirect;
243
+ }
244
+
245
+ /**
246
+ * Get info from when a registration form is completed, such as signup for a service, for CompleteRegistration event
247
+ *
248
+ * @return array
249
+ */
250
+ protected function get_complete_registration_params() {
251
+ $params = WC()->session->get( 'aepc_complete_registration_data', false );
252
+
253
+ // Delete session key
254
+ unset( WC()->session->aepc_complete_registration_data );
255
+
256
+ return $params;
257
+ }
258
+
259
+ /**
260
+ * Add currency value on params list on woocommerce localize
261
+ *
262
+ * @param $data
263
+ *
264
+ * @return array
265
+ */
266
+ public function add_currency_param( $data ) {
267
+ if ( ! function_exists('get_woocommerce_currency') ) {
268
+ return $data;
269
+ }
270
+
271
+ return array_merge( $data, array(
272
+ 'currency' => get_woocommerce_currency()
273
+ ) );
274
+ }
275
+
276
+ /**
277
+ * Add a meta info inside each product of loop, to have content_category for each product
278
+ */
279
+ public function add_content_category_meta() {
280
+ $product = wc_get_product();
281
+ $product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id;
282
+ ?><span data-content_category="<?php echo esc_attr( wp_json_encode( AEPC_Pixel_Scripts::content_category_list( $product_id ) ) ) ?>" style="display:none;"></span><?php
283
+ }
284
+
285
+ /**
286
+ * Get the info about the customer
287
+ *
288
+ * @return array
289
+ */
290
+ public function get_customer_info() {
291
+ $user = wp_get_current_user();
292
+
293
+ return array(
294
+ 'ph' => $user->billing_phone,
295
+ 'ct' => $user->billing_city,
296
+ 'st' => $user->billing_state,
297
+ 'zp' => $user->billing_postcode
298
+ );
299
+ }
300
+
301
+ /**
302
+ * Returns SKU if exists, otherwise the product ID
303
+ *
304
+ * @return string|int
305
+ */
306
+ protected function maybe_sku( $product_id ) {
307
+ if ( $sku = get_post_meta( $product_id, '_sku', true ) ) {
308
+ return $sku;
309
+ }
310
+
311
+ return $product_id;
312
+ }
313
+
314
+ /**
315
+ * Retrieve the product name
316
+ *
317
+ * @param int|WC_Product $product The ID of product or the product woo object where get its name.
318
+ *
319
+ * @return string
320
+ */
321
+ public function get_product_name( $product ) {
322
+ if ( ! is_object( $product ) ) {
323
+ $product = wc_get_product( $product );
324
+ }
325
+
326
+ return $product->get_title();
327
+ }
328
+
329
+ /**
330
+ * Says if the product is of addon type
331
+ *
332
+ * @param int $product_id The product ID.
333
+ *
334
+ * @return bool
335
+ */
336
+ public function is_product_of_this_addon( $product_id ) {
337
+ return 'product' === get_post_type( $product_id );
338
+ }
339
+
340
+ }
languages/pixel-caffeine.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Pixel Caffeine package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Pixel Caffeine 1.1.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pixel-caffeine\n"
7
- "POT-Creation-Date: 2017-03-16 14:03:18+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -211,31 +211,31 @@ msgstr ""
211
  msgid "something"
212
  msgstr ""
213
 
214
- #: includes/admin/class-aepc-admin-ca.php:968
215
  msgid "or"
216
  msgstr ""
217
 
218
- #: includes/admin/class-aepc-admin-ca.php:979
219
  msgid "browser language"
220
  msgstr ""
221
 
222
- #: includes/admin/class-aepc-admin-ca.php:982
223
  msgid "%s custom field"
224
  msgstr ""
225
 
226
- #: includes/admin/class-aepc-admin-ca.php:985
227
  msgid "%s parameter"
228
  msgstr ""
229
 
230
- #: includes/admin/class-aepc-admin-ca.php:1010
231
  msgid "nothing"
232
  msgstr ""
233
 
234
- #: includes/admin/class-aepc-admin-ca.php:1028
235
  msgid "with"
236
  msgstr ""
237
 
238
- #: includes/admin/class-aepc-admin-ca.php:1038
239
  #: includes/admin/templates/parts/forms/custom-audience.php:172
240
  #: includes/admin/templates/parts/forms/custom-audience.php:216
241
  #: includes/admin/templates/parts/forms/custom-audience.php:256
@@ -320,44 +320,32 @@ msgstr ""
320
  msgid "Manual facebook connection"
321
  msgstr ""
322
 
323
- #: includes/admin/class-aepc-admin-view.php:431
324
- msgid "WooCommerce"
325
- msgstr ""
326
-
327
- #: includes/admin/class-aepc-admin-view.php:524
328
- msgid "Activate %s"
329
- msgstr ""
330
-
331
- #: includes/admin/class-aepc-admin-view.php:532
332
- msgid "More information about %s"
333
- msgstr ""
334
-
335
- #: includes/admin/class-aepc-admin-view.php:871
336
  msgid "Contains"
337
  msgstr ""
338
 
339
- #: includes/admin/class-aepc-admin-view.php:872
340
  msgid "Not Contains"
341
  msgstr ""
342
 
343
- #: includes/admin/class-aepc-admin-view.php:873
344
  msgid "Is"
345
  msgstr ""
346
 
347
- #: includes/admin/class-aepc-admin-view.php:874
348
  msgid "Not equal"
349
  msgstr ""
350
 
351
- #: includes/admin/class-aepc-admin-view.php:875
352
  msgid "Less than"
353
  msgstr ""
354
 
355
- #: includes/admin/class-aepc-admin-view.php:876
356
  msgid "Less than or equal to"
357
  msgstr ""
358
 
359
- #: includes/admin/class-aepc-admin-view.php:877
360
- #: includes/admin/class-aepc-admin-view.php:878
361
  msgid "Greater than or equal to"
362
  msgstr ""
363
 
@@ -524,84 +512,93 @@ msgid ""
524
  "to %1$srefresh the page%2$s."
525
  msgstr ""
526
 
527
- #: includes/admin/class-aepc-facebook-adapter.php:389
528
  msgid ""
529
  "Cannot save on facebook account because of something gone wrong during "
530
  "facebook connection."
531
  msgstr ""
532
 
533
- #: includes/admin/class-aepc-facebook-adapter.php:405
 
 
 
 
 
 
 
 
 
534
  msgid "Facebook connection timed out. Please, login again from %shere%s"
535
  msgstr ""
536
 
537
- #: includes/admin/class-aepc-facebook-adapter.php:428
538
  msgid ""
539
  "Facebook connection timed out or you need to authorize again. Please, login "
540
  "again from %shere%s"
541
  msgstr ""
542
 
543
- #: includes/admin/class-aepc-facebook-adapter.php:429
544
  msgid "This Ads action requires the user to be admin of the application."
545
  msgstr ""
546
 
547
- #: includes/admin/class-aepc-facebook-adapter.php:430
548
  msgid "This Ads action requires the user to be admin of the ad account."
549
  msgstr ""
550
 
551
- #: includes/admin/class-aepc-facebook-adapter.php:431
552
  msgid ""
553
  "The ad account is not enabled for usage in Ads API. Please add it in "
554
  "developers.facebook.com/apps -> select your app -> settings -> advanced -> "
555
  "advertising accounts -> Ads API."
556
  msgstr ""
557
 
558
- #: includes/admin/class-aepc-facebook-adapter.php:432
559
  msgid "The facebook object you are trying to use does not exist."
560
  msgstr ""
561
 
562
- #: includes/admin/class-aepc-facebook-adapter.php:433
563
  msgid "You have to extend permission for ads_read to complete the action."
564
  msgstr ""
565
 
566
- #: includes/admin/class-aepc-facebook-adapter.php:434
567
  msgid "You have to extend permission for ads_management to complete the action."
568
  msgstr ""
569
 
570
- #: includes/admin/class-aepc-facebook-adapter.php:435
571
  msgid "Failed to update the custom audience."
572
  msgstr ""
573
 
574
- #: includes/admin/class-aepc-facebook-adapter.php:436
575
  msgid "Failed to create lookalike custom audience."
576
  msgstr ""
577
 
578
- #: includes/admin/class-aepc-facebook-adapter.php:437
579
  msgid "Failed to create custom audience on your facebook account."
580
  msgstr ""
581
 
582
- #: includes/admin/class-aepc-facebook-adapter.php:438
583
  msgid ""
584
  "Terms of service has not been accepted. To accept, go to "
585
  "https://www.facebook.com/ads/manage/customaudiences/tos.php"
586
  msgstr ""
587
 
588
- #: includes/admin/class-aepc-facebook-adapter.php:439
589
  msgid "Failed to delete custom audience because associated lookalikes exist."
590
  msgstr ""
591
 
592
- #: includes/admin/class-aepc-facebook-adapter.php:440
593
  msgid ""
594
  "Terms of service has not been accepted. To accept, go to "
595
  "https://www.facebook.com/customaudiences/app/tos"
596
  msgstr ""
597
 
598
- #: includes/admin/class-aepc-facebook-adapter.php:441
599
  msgid ""
600
  "The corporate terms of service has not been accepted. To accept, go to "
601
  "https://business.facebook.com/ads/manage/customaudiences/tos.php"
602
  msgstr ""
603
 
604
- #: includes/admin/class-aepc-facebook-adapter.php:442
605
  msgid "Specified audience is too small."
606
  msgstr ""
607
 
@@ -877,49 +874,59 @@ msgstr ""
877
  msgid "eCommerce plugin detected"
878
  msgstr ""
879
 
880
- #: includes/admin/templates/general-settings.php:159
881
  msgid "Track this eCommerce Conversions"
882
  msgstr ""
883
 
884
- #: includes/admin/templates/general-settings.php:170
885
  msgid "View product"
886
  msgstr ""
887
 
888
- #: includes/admin/templates/general-settings.php:181
889
  #: includes/admin/templates/parts/forms/ca-filter.php:88
890
  msgid "Search"
891
  msgstr ""
892
 
893
- #: includes/admin/templates/general-settings.php:192
894
  msgid "Add to cart"
895
  msgstr ""
896
 
897
- #: includes/admin/templates/general-settings.php:203
898
  msgid "View Checkout"
899
  msgstr ""
900
 
901
- #: includes/admin/templates/general-settings.php:214
902
  msgid "Add payment info"
903
  msgstr ""
904
 
905
- #: includes/admin/templates/general-settings.php:225
906
  #: includes/admin/templates/parts/forms/ca-filter.php:118
907
  msgid "Purchase"
908
  msgstr ""
909
 
910
- #: includes/admin/templates/general-settings.php:234
 
 
 
 
 
 
 
 
 
 
911
  msgid "eCommerce plugin not detected"
912
  msgstr ""
913
 
914
- #: includes/admin/templates/general-settings.php:236
915
  msgid "You can still track custom conversions %shere%s"
916
  msgstr ""
917
 
918
- #: includes/admin/templates/general-settings.php:241
919
  msgid "Supported plugins"
920
  msgstr ""
921
 
922
- #: includes/admin/templates/general-settings.php:258
923
  #: includes/admin/templates/parts/modals/ca-edit.php:51
924
  #: includes/admin/templates/parts/modals/conversion-edit.php:51
925
  msgid "Save"
@@ -962,35 +969,35 @@ msgid ""
962
  "type, taxonomy, custom fields, so on."
963
  msgstr ""
964
 
965
- #: includes/admin/templates/parts/advanced-settings.php:88
966
  msgid "Developers tools"
967
  msgstr ""
968
 
969
- #: includes/admin/templates/parts/advanced-settings.php:96
970
  msgid "Clear transients"
971
  msgstr ""
972
 
973
- #: includes/admin/templates/parts/advanced-settings.php:97
974
  msgid ""
975
  "Reset all Facebook API cached to better performance. Rarely used, it is "
976
  "useful to fix some data don't fetched from facebook."
977
  msgstr ""
978
 
979
- #: includes/admin/templates/parts/advanced-settings.php:105
980
  msgid "Enable debug mode"
981
  msgstr ""
982
 
983
- #: includes/admin/templates/parts/advanced-settings.php:112
984
  msgid ""
985
  "You will be able to have a details dump of pixels events fired, on "
986
  "javascript console of browser inspector."
987
  msgstr ""
988
 
989
- #: includes/admin/templates/parts/advanced-settings.php:113
990
  msgid "Note:"
991
  msgstr ""
992
 
993
- #: includes/admin/templates/parts/advanced-settings.php:113
994
  msgid ""
995
  "by activating this mode, the pixels won't be sent to facebook, so a warning "
996
  "is shown on Facebook Pixel Helper chrome extension."
@@ -1131,14 +1138,6 @@ msgstr ""
1131
  msgid "AddPaymentInfo"
1132
  msgstr ""
1133
 
1134
- #: includes/admin/templates/parts/forms/ca-filter.php:124
1135
- msgid "Lead"
1136
- msgstr ""
1137
-
1138
- #: includes/admin/templates/parts/forms/ca-filter.php:130
1139
- msgid "CompleteRegistration"
1140
- msgstr ""
1141
-
1142
  #: includes/admin/templates/parts/forms/ca-filter.php:142
1143
  msgid "Include"
1144
  msgstr ""
@@ -1827,16 +1826,6 @@ msgctxt "page title"
1827
  msgid "General Settings"
1828
  msgstr ""
1829
 
1830
- #: includes/admin/class-aepc-admin-view.php:521
1831
- msgctxt "This will be integrated in the statement: \"%s the supported plugin \"Name\""
1832
- msgid "active"
1833
- msgstr ""
1834
-
1835
- #: includes/admin/class-aepc-admin-view.php:529
1836
- msgctxt "This will be integrated in the statement: \"%s the supported plugin \"Name\""
1837
- msgid "install"
1838
- msgstr ""
1839
-
1840
  #: includes/admin/templates/dashboard.php:98
1841
  msgctxt "Plugin status ON"
1842
  msgid "ON"
@@ -1863,4 +1852,11 @@ msgctxt "%1$s is an input text, the other strong tags"
1863
  msgid ""
1864
  "Delay %2$sAdvancedEvents%3$s and %2$sCustom Conversions%3$s pixels firing "
1865
  "of %1$s seconds"
 
 
 
 
 
 
 
1866
  msgstr ""
2
  # This file is distributed under the same license as the Pixel Caffeine package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Pixel Caffeine 1.2.0\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/pixel-caffeine\n"
7
+ "POT-Creation-Date: 2017-04-03 11:52:16+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
211
  msgid "something"
212
  msgstr ""
213
 
214
+ #: includes/admin/class-aepc-admin-ca.php:972
215
  msgid "or"
216
  msgstr ""
217
 
218
+ #: includes/admin/class-aepc-admin-ca.php:983
219
  msgid "browser language"
220
  msgstr ""
221
 
222
+ #: includes/admin/class-aepc-admin-ca.php:986
223
  msgid "%s custom field"
224
  msgstr ""
225
 
226
+ #: includes/admin/class-aepc-admin-ca.php:989
227
  msgid "%s parameter"
228
  msgstr ""
229
 
230
+ #: includes/admin/class-aepc-admin-ca.php:1014
231
  msgid "nothing"
232
  msgstr ""
233
 
234
+ #: includes/admin/class-aepc-admin-ca.php:1032
235
  msgid "with"
236
  msgstr ""
237
 
238
+ #: includes/admin/class-aepc-admin-ca.php:1042
239
  #: includes/admin/templates/parts/forms/custom-audience.php:172
240
  #: includes/admin/templates/parts/forms/custom-audience.php:216
241
  #: includes/admin/templates/parts/forms/custom-audience.php:256
320
  msgid "Manual facebook connection"
321
  msgstr ""
322
 
323
+ #: includes/admin/class-aepc-admin-view.php:747
 
 
 
 
 
 
 
 
 
 
 
 
324
  msgid "Contains"
325
  msgstr ""
326
 
327
+ #: includes/admin/class-aepc-admin-view.php:748
328
  msgid "Not Contains"
329
  msgstr ""
330
 
331
+ #: includes/admin/class-aepc-admin-view.php:749
332
  msgid "Is"
333
  msgstr ""
334
 
335
+ #: includes/admin/class-aepc-admin-view.php:750
336
  msgid "Not equal"
337
  msgstr ""
338
 
339
+ #: includes/admin/class-aepc-admin-view.php:751
340
  msgid "Less than"
341
  msgstr ""
342
 
343
+ #: includes/admin/class-aepc-admin-view.php:752
344
  msgid "Less than or equal to"
345
  msgstr ""
346
 
347
+ #: includes/admin/class-aepc-admin-view.php:753
348
+ #: includes/admin/class-aepc-admin-view.php:754
349
  msgid "Greater than or equal to"
350
  msgstr ""
351
 
512
  "to %1$srefresh the page%2$s."
513
  msgstr ""
514
 
515
+ #: includes/admin/class-aepc-facebook-adapter.php:391
516
  msgid ""
517
  "Cannot save on facebook account because of something gone wrong during "
518
  "facebook connection."
519
  msgstr ""
520
 
521
+ #: includes/admin/class-aepc-facebook-adapter.php:397
522
+ msgid ""
523
+ "The request goes in error from your server due by some oldest version of "
524
+ "\"cUrl\" package. Please, ask to your hosting to upgrade it in order to fix "
525
+ "it. HINT: enable the \"debug mode\" by Advanced Settings on bottom of this "
526
+ "page. Then refresh and copy the entire message for your hosting support "
527
+ "service, to give their more details about the issue."
528
+ msgstr ""
529
+
530
+ #: includes/admin/class-aepc-facebook-adapter.php:413
531
  msgid "Facebook connection timed out. Please, login again from %shere%s"
532
  msgstr ""
533
 
534
+ #: includes/admin/class-aepc-facebook-adapter.php:436
535
  msgid ""
536
  "Facebook connection timed out or you need to authorize again. Please, login "
537
  "again from %shere%s"
538
  msgstr ""
539
 
540
+ #: includes/admin/class-aepc-facebook-adapter.php:437
541
  msgid "This Ads action requires the user to be admin of the application."
542
  msgstr ""
543
 
544
+ #: includes/admin/class-aepc-facebook-adapter.php:438
545
  msgid "This Ads action requires the user to be admin of the ad account."
546
  msgstr ""
547
 
548
+ #: includes/admin/class-aepc-facebook-adapter.php:439
549
  msgid ""
550
  "The ad account is not enabled for usage in Ads API. Please add it in "
551
  "developers.facebook.com/apps -> select your app -> settings -> advanced -> "
552
  "advertising accounts -> Ads API."
553
  msgstr ""
554
 
555
+ #: includes/admin/class-aepc-facebook-adapter.php:440
556
  msgid "The facebook object you are trying to use does not exist."
557
  msgstr ""
558
 
559
+ #: includes/admin/class-aepc-facebook-adapter.php:441
560
  msgid "You have to extend permission for ads_read to complete the action."
561
  msgstr ""
562
 
563
+ #: includes/admin/class-aepc-facebook-adapter.php:442
564
  msgid "You have to extend permission for ads_management to complete the action."
565
  msgstr ""
566
 
567
+ #: includes/admin/class-aepc-facebook-adapter.php:443
568
  msgid "Failed to update the custom audience."
569
  msgstr ""
570
 
571
+ #: includes/admin/class-aepc-facebook-adapter.php:444
572
  msgid "Failed to create lookalike custom audience."
573
  msgstr ""
574
 
575
+ #: includes/admin/class-aepc-facebook-adapter.php:445
576
  msgid "Failed to create custom audience on your facebook account."
577
  msgstr ""
578
 
579
+ #: includes/admin/class-aepc-facebook-adapter.php:446
580
  msgid ""
581
  "Terms of service has not been accepted. To accept, go to "
582
  "https://www.facebook.com/ads/manage/customaudiences/tos.php"
583
  msgstr ""
584
 
585
+ #: includes/admin/class-aepc-facebook-adapter.php:447
586
  msgid "Failed to delete custom audience because associated lookalikes exist."
587
  msgstr ""
588
 
589
+ #: includes/admin/class-aepc-facebook-adapter.php:448
590
  msgid ""
591
  "Terms of service has not been accepted. To accept, go to "
592
  "https://www.facebook.com/customaudiences/app/tos"
593
  msgstr ""
594
 
595
+ #: includes/admin/class-aepc-facebook-adapter.php:449
596
  msgid ""
597
  "The corporate terms of service has not been accepted. To accept, go to "
598
  "https://business.facebook.com/ads/manage/customaudiences/tos.php"
599
  msgstr ""
600
 
601
+ #: includes/admin/class-aepc-facebook-adapter.php:450
602
  msgid "Specified audience is too small."
603
  msgstr ""
604
 
874
  msgid "eCommerce plugin detected"
875
  msgstr ""
876
 
877
+ #: includes/admin/templates/general-settings.php:161
878
  msgid "Track this eCommerce Conversions"
879
  msgstr ""
880
 
881
+ #: includes/admin/templates/general-settings.php:174
882
  msgid "View product"
883
  msgstr ""
884
 
885
+ #: includes/admin/templates/general-settings.php:186
886
  #: includes/admin/templates/parts/forms/ca-filter.php:88
887
  msgid "Search"
888
  msgstr ""
889
 
890
+ #: includes/admin/templates/general-settings.php:198
891
  msgid "Add to cart"
892
  msgstr ""
893
 
894
+ #: includes/admin/templates/general-settings.php:211
895
  msgid "View Checkout"
896
  msgstr ""
897
 
898
+ #: includes/admin/templates/general-settings.php:224
899
  msgid "Add payment info"
900
  msgstr ""
901
 
902
+ #: includes/admin/templates/general-settings.php:237
903
  #: includes/admin/templates/parts/forms/ca-filter.php:118
904
  msgid "Purchase"
905
  msgstr ""
906
 
907
+ #: includes/admin/templates/general-settings.php:250
908
+ #: includes/admin/templates/parts/forms/ca-filter.php:124
909
+ msgid "Lead"
910
+ msgstr ""
911
+
912
+ #: includes/admin/templates/general-settings.php:263
913
+ #: includes/admin/templates/parts/forms/ca-filter.php:130
914
+ msgid "CompleteRegistration"
915
+ msgstr ""
916
+
917
+ #: includes/admin/templates/general-settings.php:273
918
  msgid "eCommerce plugin not detected"
919
  msgstr ""
920
 
921
+ #: includes/admin/templates/general-settings.php:275
922
  msgid "You can still track custom conversions %shere%s"
923
  msgstr ""
924
 
925
+ #: includes/admin/templates/general-settings.php:280
926
  msgid "Supported plugins"
927
  msgstr ""
928
 
929
+ #: includes/admin/templates/general-settings.php:299
930
  #: includes/admin/templates/parts/modals/ca-edit.php:51
931
  #: includes/admin/templates/parts/modals/conversion-edit.php:51
932
  msgid "Save"
969
  "type, taxonomy, custom fields, so on."
970
  msgstr ""
971
 
972
+ #: includes/admin/templates/parts/advanced-settings.php:106
973
  msgid "Developers tools"
974
  msgstr ""
975
 
976
+ #: includes/admin/templates/parts/advanced-settings.php:114
977
  msgid "Clear transients"
978
  msgstr ""
979
 
980
+ #: includes/admin/templates/parts/advanced-settings.php:115
981
  msgid ""
982
  "Reset all Facebook API cached to better performance. Rarely used, it is "
983
  "useful to fix some data don't fetched from facebook."
984
  msgstr ""
985
 
986
+ #: includes/admin/templates/parts/advanced-settings.php:123
987
  msgid "Enable debug mode"
988
  msgstr ""
989
 
990
+ #: includes/admin/templates/parts/advanced-settings.php:130
991
  msgid ""
992
  "You will be able to have a details dump of pixels events fired, on "
993
  "javascript console of browser inspector."
994
  msgstr ""
995
 
996
+ #: includes/admin/templates/parts/advanced-settings.php:131
997
  msgid "Note:"
998
  msgstr ""
999
 
1000
+ #: includes/admin/templates/parts/advanced-settings.php:131
1001
  msgid ""
1002
  "by activating this mode, the pixels won't be sent to facebook, so a warning "
1003
  "is shown on Facebook Pixel Helper chrome extension."
1138
  msgid "AddPaymentInfo"
1139
  msgstr ""
1140
 
 
 
 
 
 
 
 
 
1141
  #: includes/admin/templates/parts/forms/ca-filter.php:142
1142
  msgid "Include"
1143
  msgstr ""
1826
  msgid "General Settings"
1827
  msgstr ""
1828
 
 
 
 
 
 
 
 
 
 
 
1829
  #: includes/admin/templates/dashboard.php:98
1830
  msgctxt "Plugin status ON"
1831
  msgid "ON"
1852
  msgid ""
1853
  "Delay %2$sAdvancedEvents%3$s and %2$sCustom Conversions%3$s pixels firing "
1854
  "of %1$s seconds"
1855
+ msgstr ""
1856
+
1857
+ #: includes/admin/templates/parts/advanced-settings.php:89
1858
+ msgctxt "%1$s and %2$s are for strong tag"
1859
+ msgid ""
1860
+ "Track %1$sshipping costs%2$s into %1$sPurchase%2$s and "
1861
+ "%1$sInitiateCheckout%2$s events"
1862
  msgstr ""
pixel-caffeine.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author URI: https://adespresso.com/
8
  * Text Domain: pixel-caffeine
9
  * Domain Path: /languages
10
- * Version: 1.1.0
11
  *
12
  * @package PixelCaffeine
13
  */
@@ -22,12 +22,12 @@ if ( ! class_exists( 'PixelCaffeine' ) ) :
22
  * Main PixelCaffeine Class.
23
  *
24
  * @class PixelCaffeine
25
- * @version 1.1.0
26
  */
27
  final class PixelCaffeine {
28
 
29
  /** @var string PixelCaffeine version. */
30
- public $version = '1.1.0';
31
 
32
  /** @var PixelCaffeine The single instance of the class. */
33
  protected static $_instance = null;
@@ -86,6 +86,7 @@ if ( ! class_exists( 'PixelCaffeine' ) ) :
86
  */
87
  private function init_hooks() {
88
  add_action( 'init', array( $this, 'init' ) );
 
89
  }
90
 
91
  /**
@@ -103,6 +104,8 @@ if ( ! class_exists( 'PixelCaffeine' ) ) :
103
  public function includes() {
104
  include_once( 'includes/class-aepc-currency.php' );
105
  include_once( 'includes/class-aepc-track.php' );
 
 
106
  include_once( 'includes/functions-helpers.php' );
107
 
108
  // Admin includes.
7
  * Author URI: https://adespresso.com/
8
  * Text Domain: pixel-caffeine
9
  * Domain Path: /languages
10
+ * Version: 1.2.0
11
  *
12
  * @package PixelCaffeine
13
  */
22
  * Main PixelCaffeine Class.
23
  *
24
  * @class PixelCaffeine
25
+ * @version 1.2.0
26
  */
27
  final class PixelCaffeine {
28
 
29
  /** @var string PixelCaffeine version. */
30
+ public $version = '1.2.0';
31
 
32
  /** @var PixelCaffeine The single instance of the class. */
33
  protected static $_instance = null;
86
  */
87
  private function init_hooks() {
88
  add_action( 'init', array( $this, 'init' ) );
89
+ add_action( 'init', array( 'AEPC_Addons_Support', 'init' ), 5 ); // priority 5 is for EDD.
90
  }
91
 
92
  /**
104
  public function includes() {
105
  include_once( 'includes/class-aepc-currency.php' );
106
  include_once( 'includes/class-aepc-track.php' );
107
+ include_once( 'includes/class-aepc-addon-factory.php' );
108
+ include_once( 'includes/class-aepc-addons-support.php' );
109
  include_once( 'includes/functions-helpers.php' );
110
 
111
  // Admin includes.
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://adespresso.com/
4
  Tags: facebook, facebook pixel, facebook ad, facebook insertions, custom audiences, dynamic events, woocommerce
5
  Requires at least: 4.4
6
  Tested up to: 4.7.3
7
- Stable tag: 1.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -12,18 +12,18 @@ The simplest and easiest way to manage your Facebook Pixel needs and create lase
12
 
13
  == Description ==
14
 
15
- Don’t spend money on “pro” plugins while ours is free. Includes full WooCommerce support!
16
 
17
  Created by AdEspresso, a certified Facebook Marketing Partner and #1 Facebook Ads Partner, Pixel Caffeine is the highest
18
  quality Facebook Pixel plug-in available on the WordPress market.
19
 
20
- In just a few simple clicks, you can begin creating custom audiences for almost any parameter you want - whether its web
21
- pages visited, products & content viewed, or custom & dynamic events.
22
-
23
  Watch our video to see the full range of possibilities:
24
 
25
  [youtube http://www.youtube.com/watch?v=zFAszDll_1w]
26
 
 
 
 
27
  Unlike all the other professional plugins available, we have no limitations and no hidden costs or fees.
28
 
29
  Welcome to a whole new world of custom audiences.
@@ -49,6 +49,10 @@ for exactly the products they viewed
49
  * Create audiences of those that submit particular forms, click on certain buttons, or take certain actions while navigating
50
  or searching your website.
51
 
 
 
 
 
52
 
53
  == Installation ==
54
 
@@ -72,6 +76,42 @@ or searching your website.
72
  * Select “Install” after the upload is complete
73
  * Activate It
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  == Screenshots ==
76
 
77
  1. General Settings
@@ -82,6 +122,14 @@ or searching your website.
82
 
83
  == Changelog ==
84
 
 
 
 
 
 
 
 
 
85
  = 1.1.0 - 2017-03-16 =
86
  * Feature - Introduced new *delay* options in general settings and in Conversions/Events tab in order to set a delay for the pixel firing
87
  * Feature - Introduced condition dropdown for the URL fields of CA creation/edit form
4
  Tags: facebook, facebook pixel, facebook ad, facebook insertions, custom audiences, dynamic events, woocommerce
5
  Requires at least: 4.4
6
  Tested up to: 4.7.3
7
+ Stable tag: 1.2.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ Don’t spend money on “pro” plugins while ours is free. Includes full WooCommerce and Easy Digital Downloads support!
16
 
17
  Created by AdEspresso, a certified Facebook Marketing Partner and #1 Facebook Ads Partner, Pixel Caffeine is the highest
18
  quality Facebook Pixel plug-in available on the WordPress market.
19
 
 
 
 
20
  Watch our video to see the full range of possibilities:
21
 
22
  [youtube http://www.youtube.com/watch?v=zFAszDll_1w]
23
 
24
+ In just a few simple clicks, you can begin creating custom audiences for almost any parameter you want - whether its web
25
+ pages visited, products & content viewed, or custom & dynamic events.
26
+
27
  Unlike all the other professional plugins available, we have no limitations and no hidden costs or fees.
28
 
29
  Welcome to a whole new world of custom audiences.
49
  * Create audiences of those that submit particular forms, click on certain buttons, or take certain actions while navigating
50
  or searching your website.
51
 
52
+ ### Videotutorial
53
+
54
+ [youtube https://www.youtube.com/watch?v=DUn1a291-bA]
55
+
56
 
57
  == Installation ==
58
 
76
  * Select “Install” after the upload is complete
77
  * Activate It
78
 
79
+ = Video =
80
+
81
+ Here a brief videotutorial to understand main feature and how their work:
82
+
83
+ [https://www.youtube.com/watch?v=DUn1a291-bA]
84
+
85
+ == Frequently Asked Questions ==
86
+
87
+ = Where do I get my Facebook Pixel ID? =
88
+
89
+ You can get your Facebook Pixel ID from the [Pixel page of Facebook Ads Manager](https://www.facebook.com/ads/manager/pixel/facebook_pixel). If you don't have a Pixel, you can create a new one by following [these instructions](https://www.facebook.com/business/help/952192354843755?helpref=faq_content#createpixel). Remember: there is only ONE Pixel assigned per ad account.
90
+
91
+ = Do I need a new Facebook Pixel? =
92
+
93
+ No, use the pixel from the ad account you want to link to your WordPress website.
94
+
95
+ = I don't want to login to my Facebook account. Can I put the pixel ID manually without connecting my account? =
96
+
97
+ No problem! You can manually add the Pixel ID in the settings page instead of connecting your Facebook Account. However, without the Facebook connect, you won't be able to use some of the most advanced features of Pixel Caffeine like our Custom Audience creation.
98
+
99
+ = Are the custom audiences saved also on my Facebook Ad Account? =
100
+
101
+ Yes, everything you create in Pixel Caffeine is immediately synced with Facebook and all the audiences will be immediately available to use in Facebook Ads Manager/Power Editor ...or [AdEspresso](https://adespresso.com) if you're using it of course :)
102
+
103
+ = Is it compatible with WooCommerce? =
104
+
105
+ YES! We fully support WooCommerce. In the settings page just enable the integration and we'll automatically add all the event tracking! This is also compatible with Dynamic Product Ads and we'll pass Facebook all the advanced settings like product Id, cost, etc.!
106
+
107
+ = Is it compatible with Easy Digital Downloads =
108
+
109
+ Absolutely YES! The same of above.
110
+
111
+ = Can I import my custom audiences I already have in my Ad account into Pixel Caffeine? =
112
+
113
+ Unfortunately there isn’t any way at the moment to import custom audiences _from_ FB, but it is a feature in our long-term roadmap. With the plugin we want to give extended tools for advanced custom audiences - using WordPress data. This plug-in is NOT a replacement for Business Manager, but it does make it all easier!
114
+
115
  == Screenshots ==
116
 
117
  1. General Settings
122
 
123
  == Changelog ==
124
 
125
+ = 1.2.0 - 2017-04-03 =
126
+ * Feature - *Full support to Easy Digital Downloads* for the dynamic ads events
127
+ * Feature - Introduced new hook to add dynamic placeholders in the value arguments of custom conversions
128
+ * Tweak - Tested with WooCommerce 3.0.0 RC2, so almost fully compatible with the new version will be released soon
129
+ * Tweak - Track "CompleteRegistration" event when a user is registered from woocommerce page
130
+ * Fix - Track custom conversions events created by admin even if you set a full URL for page_visit and link_click
131
+ * Fix - Shipping cost included in the "value" property of checkout events. Anyway, added also an option to activate it again
132
+
133
  = 1.1.0 - 2017-03-16 =
134
  * Feature - Introduced new *delay* options in general settings and in Conversions/Events tab in order to set a delay for the pixel firing
135
  * Feature - Introduced condition dropdown for the URL fields of CA creation/edit form
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInita8840c467af9017ddda6861ae4843382::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit6b60e7d42513552dcafe1acd5cdc4e98::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInita8840c467af9017ddda6861ae4843382
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInita8840c467af9017ddda6861ae4843382
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInita8840c467af9017ddda6861ae4843382', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInita8840c467af9017ddda6861ae4843382', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInita8840c467af9017ddda6861ae4843382::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit6b60e7d42513552dcafe1acd5cdc4e98
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit6b60e7d42513552dcafe1acd5cdc4e98', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit6b60e7d42513552dcafe1acd5cdc4e98', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit6b60e7d42513552dcafe1acd5cdc4e98::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInita8840c467af9017ddda6861ae4843382
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'F' =>
@@ -23,8 +23,8 @@ class ComposerStaticInita8840c467af9017ddda6861ae4843382
23
  public static function getInitializer(ClassLoader $loader)
24
  {
25
  return \Closure::bind(function () use ($loader) {
26
- $loader->prefixLengthsPsr4 = ComposerStaticInita8840c467af9017ddda6861ae4843382::$prefixLengthsPsr4;
27
- $loader->prefixDirsPsr4 = ComposerStaticInita8840c467af9017ddda6861ae4843382::$prefixDirsPsr4;
28
 
29
  }, null, ClassLoader::class);
30
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit6b60e7d42513552dcafe1acd5cdc4e98
8
  {
9
  public static $prefixLengthsPsr4 = array (
10
  'F' =>
23
  public static function getInitializer(ClassLoader $loader)
24
  {
25
  return \Closure::bind(function () use ($loader) {
26
+ $loader->prefixLengthsPsr4 = ComposerStaticInit6b60e7d42513552dcafe1acd5cdc4e98::$prefixLengthsPsr4;
27
+ $loader->prefixDirsPsr4 = ComposerStaticInit6b60e7d42513552dcafe1acd5cdc4e98::$prefixDirsPsr4;
28
 
29
  }, null, ClassLoader::class);
30
  }