WordPress Page Builder – Beaver Builder - Version 2.1.2.2

Version Description

Download this release

Release Info

Developer pross
Plugin Icon 128x128 WordPress Page Builder – Beaver Builder
Version 2.1.2.2
Comparing to
See all releases

Code changes from version 2.1.1.3 to 2.1.2.2

Files changed (42) hide show
  1. changelog.txt +39 -0
  2. classes/class-fl-builder-debug.php +9 -4
  3. classes/class-fl-builder-filesystem.php +12 -2
  4. classes/class-fl-builder-icons.php +1 -1
  5. classes/class-fl-builder-loader.php +4 -3
  6. classes/class-fl-builder-model.php +6 -1
  7. classes/class-fl-builder-privacy.php +80 -0
  8. classes/class-fl-builder-revisions.php +3 -1
  9. classes/class-fl-builder-service-mailerlite.php +3 -3
  10. classes/class-fl-builder-service-ontraport.php +255 -0
  11. classes/class-fl-builder-services.php +6 -0
  12. classes/class-fl-builder-ui-content-panel.php +1 -21
  13. classes/class-fl-builder-update.php +1 -1
  14. classes/class-fl-builder.php +6 -2
  15. css/fl-builder.css +3 -0
  16. css/fl-builder.min.css +1 -1
  17. fl-builder.php +1 -1
  18. includes/compatibility.php +11 -0
  19. includes/updater-config.php +1 -1
  20. includes/vendor/infusionsoft/xmlrpc-3.0/lib/xmlrpc.inc +1362 -848
  21. includes/vendor/mailerlite/{ML_Rest.php → FL_ML_Rest.php} +4 -4
  22. includes/vendor/mailerlite/{ML_Rest_Base.php → FL_ML_Rest_Base.php} +3 -3
  23. includes/vendor/ontraport/APIAutoloader.php +36 -0
  24. includes/vendor/ontraport/BaseApi.php +222 -0
  25. includes/vendor/ontraport/CampaignBuilderItems.php +97 -0
  26. includes/vendor/ontraport/Contacts.php +185 -0
  27. includes/vendor/ontraport/CreditCards.php +114 -0
  28. includes/vendor/ontraport/Criteria.php +125 -0
  29. includes/vendor/ontraport/CurlClient.php +293 -0
  30. includes/vendor/ontraport/CustomObjects.php +131 -0
  31. includes/vendor/ontraport/Exceptions/OntraportAPIException.php +110 -0
  32. includes/vendor/ontraport/Forms.php +147 -0
  33. includes/vendor/ontraport/LandingPages.php +119 -0
  34. includes/vendor/ontraport/Messages.php +146 -0
  35. includes/vendor/ontraport/ObjectType.php +85 -0
  36. includes/vendor/ontraport/Objects.php +493 -0
  37. includes/vendor/ontraport/Ontraport.php +270 -0
  38. includes/vendor/ontraport/Tasks.php +186 -0
  39. includes/vendor/ontraport/Transactions.php +306 -0
  40. includes/vendor/ontraport/Webhooks.php +106 -0
  41. js/fl-builder.js +19 -2
  42. js/fl-builder.min.js +9 -9
changelog.txt CHANGED
@@ -1,3 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>2.1.1.3 - 05/10/2018</h4>
2
  <p><strong>Hot Fix</strong></p>
3
  <ul>
1
+ <h4>2.1.2.2 - 05/17/2018</h4>
2
+ <strong>Bug Fixes</strong>
3
+ <ul>
4
+ <li>Reverted menu accessibility code added in 2.1.2.</li>
5
+ </ul>
6
+
7
+ <h4>2.1.2.1 - 05/16/2018</h4>
8
+ <strong>Bug Fixes</strong>
9
+ <ul>
10
+ <li>Fixed a JS error preventing settings from opening.</li>
11
+ </ul>
12
+
13
+ <h4>2.1.2 - 05/16/2018</h4>
14
+ <strong>Enhancements</strong>
15
+ <ul>
16
+ <li>Updated Font Awesome 5 icons</li>
17
+ <li>Added support for new WP 4.9.6 Privacy Page and data exporter.</li>
18
+ <li>Added Themer support to Audio module</li>
19
+ <li>Added is_writable method to filesystem class</li>
20
+ <li>Added Ontraport support to Subscribe Module</li>
21
+ <li>Settings lightbox will now resize height when first opening if they are taller than the window</li>
22
+ <li>Improved accessibility in Menu Module</li>
23
+ <li>Limit revisions in Builder UI to 25 for performance reasons <code>fl_builder_revisions_number</code> also added</li>
24
+ <li>Hide overlays when right clicked so the underlying node can be inspected.</li>
25
+ <li>Remove panel caret when less than 500px</li>
26
+ </ul>
27
+ <strong>Bug Fixes</strong>
28
+ <ul>
29
+ <li>Fixed a compatibility issues with Enjoy Plugin for Instagram and MailerLite plugin</li>
30
+ <li>Fixed gap underneath menu items on Themer menu module</li>
31
+ <li>Fixed Builder permissions appearing blank if Themer plugin is enabled first</li>
32
+ <li>Fixed a JS error thrown while resizing rows</li>
33
+ <li>Fixed a PHP warning if no default icon sets are available</li>
34
+ <li>Fixed a PHP warning on debug page if there are no deactivated plugins installed</li>
35
+ <li>Fixed an issue where archive pages would enqueue a layout css/js file for every post in the archive</li>
36
+ <li>Fixed saved columns still showing if Enable Core Templates Only is selected</li>
37
+ <li>Fixed PHP warnings in Subscribe Module when using Infusionsoft</li>
38
+ </ul>
39
+
40
  <h4>2.1.1.3 - 05/10/2018</h4>
41
  <p><strong>Hot Fix</strong></p>
42
  <ul>
classes/class-fl-builder-debug.php CHANGED
@@ -179,7 +179,12 @@ final class FL_Debug {
179
  );
180
  self::register( 'wp_plugins', $args );
181
 
182
- $plugins = self::get_plugins();
 
 
 
 
 
183
  $args = array(
184
  'name' => 'Active Plugins',
185
  'data' => $plugins['active'],
@@ -305,7 +310,7 @@ final class FL_Debug {
305
 
306
  $args = array(
307
  'name' => 'Beaver Builder Path writable',
308
- 'data' => ( is_writable( $cache['path'] ) ) ? 'Yes' : 'No',
309
  );
310
  self::register( 'bb_cache_path_writable', $args );
311
 
@@ -320,7 +325,7 @@ final class FL_Debug {
320
 
321
  $args = array(
322
  'name' => 'Beaver Theme Path writable',
323
- 'data' => ( is_writable( $cache['path'] ) ) ? 'Yes' : 'No',
324
  );
325
  self::register( 'bb_theme_cache_path_writable', $args );
326
  }
@@ -388,7 +393,7 @@ final class FL_Debug {
388
  self::register( 'up_htaccess', $args );
389
 
390
  // detect uploads folder .htaccess file and display it if found.
391
- $uploads = wp_upload_dir();
392
  $uploads_htaccess = trailingslashit( $uploads['basedir'] ) . '.htaccess';
393
  $root_htaccess = trailingslashit( ABSPATH ) . '.htaccess';
394
 
179
  );
180
  self::register( 'wp_plugins', $args );
181
 
182
+ $defaults = array(
183
+ 'active' => array(),
184
+ 'deactive' => array(),
185
+ );
186
+
187
+ $plugins = wp_parse_args( self::get_plugins(), $defaults );
188
  $args = array(
189
  'name' => 'Active Plugins',
190
  'data' => $plugins['active'],
310
 
311
  $args = array(
312
  'name' => 'Beaver Builder Path writable',
313
+ 'data' => ( fl_builder_filesystem()->is_writable( $cache['path'] ) ) ? 'Yes' : 'No',
314
  );
315
  self::register( 'bb_cache_path_writable', $args );
316
 
325
 
326
  $args = array(
327
  'name' => 'Beaver Theme Path writable',
328
+ 'data' => ( fl_builder_filesystem()->is_writable( $cache['path'] ) ) ? 'Yes' : 'No',
329
  );
330
  self::register( 'bb_theme_cache_path_writable', $args );
331
  }
393
  self::register( 'up_htaccess', $args );
394
 
395
  // detect uploads folder .htaccess file and display it if found.
396
+ $uploads = wp_upload_dir( null, false );
397
  $uploads_htaccess = trailingslashit( $uploads['basedir'] ) . '.htaccess';
398
  $root_htaccess = trailingslashit( ABSPATH ) . '.htaccess';
399
 
classes/class-fl-builder-filesystem.php CHANGED
@@ -25,6 +25,16 @@ class FL_Filesystem {
25
  return $wp_filesystem->get_contents( $path );
26
  }
27
 
 
 
 
 
 
 
 
 
 
 
28
  /**
29
  * file_put_contents using wp_filesystem.
30
  * @since 2.0.6
@@ -66,7 +76,7 @@ class FL_Filesystem {
66
  }
67
 
68
  /**
69
- * dirlist using wp_filesystem.
70
  * @since 2.0.6
71
  */
72
  function move( $old, $new ) {
@@ -120,7 +130,7 @@ class FL_Filesystem {
120
 
121
  global $wp_filesystem;
122
 
123
- if ( ! $wp_filesystem ) {
124
  require_once ABSPATH . '/wp-admin/includes/file.php';
125
 
126
  add_filter( 'filesystem_method', array( $this, 'filesystem_method' ) );
25
  return $wp_filesystem->get_contents( $path );
26
  }
27
 
28
+ /**
29
+ * is_writable using wp_filesystem.
30
+ * @since 2.1.2
31
+ */
32
+ function is_writable( $path ) {
33
+
34
+ $wp_filesystem = $this->get_filesystem();
35
+ return $wp_filesystem->is_writable( $path );
36
+ }
37
+
38
  /**
39
  * file_put_contents using wp_filesystem.
40
  * @since 2.0.6
76
  }
77
 
78
  /**
79
+ * move using wp_filesystem.
80
  * @since 2.0.6
81
  */
82
  function move( $old, $new ) {
130
 
131
  global $wp_filesystem;
132
 
133
+ if ( ! $wp_filesystem || 'direct' != $wp_filesystem->method ) {
134
  require_once ABSPATH . '/wp-admin/includes/file.php';
135
 
136
  add_filter( 'filesystem_method', array( $this, 'filesystem_method' ) );
classes/class-fl-builder-icons.php CHANGED
@@ -407,7 +407,7 @@ final class FLBuilderIcons {
407
 
408
  $sets = self::get_sets();
409
 
410
- foreach ( $sets as $key => $data ) {
411
  if ( in_array( $icon, $data['icons'] ) ) {
412
  self::enqueue_custom_styles_by_key( $key );
413
  }
407
 
408
  $sets = self::get_sets();
409
 
410
+ foreach ( (array) $sets as $key => $data ) {
411
  if ( in_array( $icon, $data['icons'] ) ) {
412
  self::enqueue_custom_styles_by_key( $key );
413
  }
classes/class-fl-builder-loader.php CHANGED
@@ -46,7 +46,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
46
  * @return void
47
  */
48
  static private function define_constants() {
49
- define( 'FL_BUILDER_VERSION', '2.1.1.3' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
@@ -101,6 +101,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
101
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-user-settings.php';
102
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-utils.php';
103
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-wpml.php';
 
104
 
105
  /* WP CLI Commands */
106
  if ( defined( 'WP_CLI' ) ) {
@@ -130,10 +131,10 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
130
  static private function check_permissions() {
131
  if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], array( 'fl-builder-settings', 'fl-builder-multisite-settings' ) ) ) {
132
 
133
- $wp_upload_dir = wp_upload_dir();
134
  $bb_upload_dir = FLBuilderModel::get_upload_dir();
135
 
136
- if ( ! is_writable( $wp_upload_dir['basedir'] ) || ! is_writable( $bb_upload_dir['path'] ) ) {
137
  add_action( 'admin_notices', __CLASS__ . '::permissions_admin_notice' );
138
  add_action( 'network_admin_notices', __CLASS__ . '::permissions_admin_notice' );
139
  }
46
  * @return void
47
  */
48
  static private function define_constants() {
49
+ define( 'FL_BUILDER_VERSION', '2.1.2.2' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
101
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-user-settings.php';
102
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-utils.php';
103
  require_once FL_BUILDER_DIR . 'classes/class-fl-builder-wpml.php';
104
+ require_once FL_BUILDER_DIR . 'classes/class-fl-builder-privacy.php';
105
 
106
  /* WP CLI Commands */
107
  if ( defined( 'WP_CLI' ) ) {
131
  static private function check_permissions() {
132
  if ( isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], array( 'fl-builder-settings', 'fl-builder-multisite-settings' ) ) ) {
133
 
134
+ $wp_upload_dir = wp_upload_dir( null, false );
135
  $bb_upload_dir = FLBuilderModel::get_upload_dir();
136
 
137
+ if ( ! fl_builder_filesystem()->is_writable( $wp_upload_dir['basedir'] ) || ! fl_builder_filesystem()->is_writable( $bb_upload_dir['path'] ) ) {
138
  add_action( 'admin_notices', __CLASS__ . '::permissions_admin_notice' );
139
  add_action( 'network_admin_notices', __CLASS__ . '::permissions_admin_notice' );
140
  }
classes/class-fl-builder-model.php CHANGED
@@ -641,7 +641,7 @@ final class FLBuilderModel {
641
  * @return array
642
  */
643
  static public function get_upload_dir() {
644
- $wp_info = wp_upload_dir();
645
  $dir_name = basename( FL_BUILDER_DIR );
646
 
647
  // We use bb-plugin for the lite version as well.
@@ -1898,6 +1898,11 @@ final class FLBuilderModel {
1898
  $row->settings->ss_photo_data = new StdClass();
1899
  }
1900
 
 
 
 
 
 
1901
  // Hijack the slideshow module to get the source.
1902
  $ss = new FLSlideshowModule();
1903
  $ss->settings = new StdClass();
641
  * @return array
642
  */
643
  static public function get_upload_dir() {
644
+ $wp_info = wp_upload_dir( null, false );
645
  $dir_name = basename( FL_BUILDER_DIR );
646
 
647
  // We use bb-plugin for the lite version as well.
1898
  $row->settings->ss_photo_data = new StdClass();
1899
  }
1900
 
1901
+ // This class does not exist in Lite version.
1902
+ if ( ! class_exists( 'FLSlideshowModule' ) ) {
1903
+ return false;
1904
+ }
1905
+
1906
  // Hijack the slideshow module to get the source.
1907
  $ss = new FLSlideshowModule();
1908
  $ss->settings = new StdClass();
classes/class-fl-builder-privacy.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Helper class for working with privacy.
4
+ *
5
+ * @since 2.1
6
+ */
7
+ final class FLBuilderPrivacy {
8
+ static public function init() {
9
+ add_action( 'admin_init', array( 'FLBuilderPrivacy', 'admin_init' ) );
10
+ }
11
+
12
+ static public function admin_init() {
13
+ if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
14
+ return false;
15
+ }
16
+ add_filter( 'wp_privacy_personal_data_exporters', array( 'FLBuilderPrivacy', 'register_exporter' ) );
17
+ self::register_policy();
18
+ }
19
+
20
+ static public function register_exporter( $exporters ) {
21
+ $exporters[] = array(
22
+ 'exporter_friendly_name' => __( 'Beaver Builder Plugin' ),
23
+ 'callback' => array( 'FLBuilderPrivacy', 'exporter' ),
24
+ );
25
+ return $exporters;
26
+ }
27
+
28
+ static public function exporter( $email, $page = 1 ) {
29
+
30
+ $export_items = array();
31
+ $data = array();
32
+
33
+ $user = get_user_by( 'email', $email );
34
+ $meta = get_user_meta( $user->ID, 'fl_builder_user_settings', true );
35
+
36
+ $result = (array) self::array_flatten( $meta );
37
+
38
+ foreach ( $result as $key => $setting ) {
39
+ if ( ! is_array( $setting ) ) {
40
+ if ( '' == $setting ) {
41
+ $setting = 'false';
42
+ }
43
+ $data[] = array(
44
+ 'name' => $key,
45
+ 'value' => $setting,
46
+ );
47
+ }
48
+ }
49
+
50
+ $export_items[] = array(
51
+ 'group_id' => 'bb-settings',
52
+ 'group_label' => 'Beaver Builder Settings',
53
+ 'item_id' => 'bb-settings',
54
+ 'data' => $data,
55
+ );
56
+
57
+ return array(
58
+ 'data' => $export_items,
59
+ 'done' => true,
60
+ );
61
+ }
62
+
63
+ static public function array_flatten( $array ) {
64
+
65
+ $return = array();
66
+ foreach ( $array as $key => $value ) {
67
+ if ( is_array( $value ) ) {
68
+ $return = array_merge( $return, self::array_flatten( $value ) );
69
+ } else {
70
+ $return[ $key ] = $value;
71
+ }
72
+ }
73
+ return $return;
74
+ }
75
+
76
+ static public function register_policy() {
77
+ wp_add_privacy_policy_content( 'Beaver Builder', __( '<p>In terms of GDPR, Beaver Builder products do not collect any personal information from your users. However some modules such as videos and maps might need you to update your privacy policy accordingly.</p>', 'fl-builder' ) );
78
+ }
79
+ }
80
+ FLBuilderPrivacy::init();
classes/class-fl-builder-revisions.php CHANGED
@@ -39,7 +39,9 @@ final class FLBuilderRevisions {
39
  * @return array
40
  */
41
  static public function get_config( $post_id ) {
42
- $revisions = wp_get_post_revisions( $post_id );
 
 
43
  $current_time = current_time( 'timestamp' );
44
  $config = array(
45
  'posts' => array(),
39
  * @return array
40
  */
41
  static public function get_config( $post_id ) {
42
+ $revisions = wp_get_post_revisions( $post_id, array(
43
+ 'numberposts' => apply_filters( 'fl_builder_revisions_number', 25 ),
44
+ ) );
45
  $current_time = current_time( 'timestamp' );
46
  $config = array(
47
  'posts' => array(),
classes/class-fl-builder-service-mailerlite.php CHANGED
@@ -41,11 +41,11 @@ final class FLBuilderServiceMailerLite extends FLBuilderService {
41
  if ( $this->api_instance ) {
42
  return $this->api_instance;
43
  }
44
- if ( ! class_exists( 'ML_Rest' ) ) {
45
- require_once FL_BUILDER_DIR . 'includes/vendor/mailerlite/ML_Rest.php';
46
  }
47
 
48
- $this->api_instance = new ML_Rest( $api_key );
49
  $this->api_instance->setUrl( $this->api_url );
50
 
51
  return $this->api_instance;
41
  if ( $this->api_instance ) {
42
  return $this->api_instance;
43
  }
44
+ if ( ! class_exists( 'FL_ML_Rest' ) ) {
45
+ require_once FL_BUILDER_DIR . 'includes/vendor/mailerlite/FL_ML_Rest.php';
46
  }
47
 
48
+ $this->api_instance = new FL_ML_Rest( $api_key );
49
  $this->api_instance->setUrl( $this->api_url );
50
 
51
  return $this->api_instance;
classes/class-fl-builder-service-ontraport.php ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Helper class for the Ontraport API.
5
+ *
6
+ * @since 2.1
7
+ */
8
+ final class FLBuilderServiceOntraport extends FLBuilderService {
9
+
10
+ /**
11
+ * The ID for this service.
12
+ *
13
+ * @since 2.1
14
+ * @var string $id
15
+ */
16
+ public $id = 'ontraport';
17
+
18
+ /**
19
+ * @since 2.1
20
+ * @var object $api_instance
21
+ * @access private
22
+ */
23
+ private $api_instance = null;
24
+
25
+ /**
26
+ * Get an instance of the API.
27
+ *
28
+ * @since 2.1
29
+ * @param string $app_id A valid APP ID.
30
+ * @param string $api_key A valid API key.
31
+ * @return object The API instance.
32
+ */
33
+ public function get_api( $app_id, $api_key ) {
34
+
35
+ if ( $this->api_instance ) {
36
+ return $this->api_instance;
37
+ }
38
+
39
+ if ( ! class_exists( '\\OntraportAPI\\Ontraport' ) ) {
40
+ require_once FL_BUILDER_DIR . 'includes/vendor/ontraport/Ontraport.php';
41
+ }
42
+
43
+ $this->api_instance = new \OntraportAPI\Ontraport( $app_id, $api_key );
44
+
45
+ return $this->api_instance;
46
+ }
47
+
48
+ /**
49
+ * Test the API connection.
50
+ *
51
+ * @since 2.1
52
+ * @param array $fields {
53
+ * @type string $api_key A valid API key.
54
+ * }
55
+ * @return array{
56
+ * @type bool|string $error The error message or false if no error.
57
+ * @type array $data An array of data used to make the connection.
58
+ * }
59
+ */
60
+ public function connect( $fields = array() ) {
61
+ $response = array(
62
+ 'error' => false,
63
+ 'data' => array(),
64
+ );
65
+
66
+ // Make sure we have an API token.
67
+ if ( ! isset( $fields['app_id'] ) || empty( $fields['app_id'] ) ) {
68
+ $response['error'] = __( 'Error: You must provide an APP ID.', 'fl-builder' );
69
+ } // Make sure we have an Account ID.
70
+ elseif ( ! isset( $fields['api_key'] ) || empty( $fields['api_key'] ) ) {
71
+ $response['error'] = __( 'Error: You must provide an API key.', 'fl-builder' );
72
+ } // Try to connect and store the connection data.
73
+ else {
74
+
75
+ $api = $this->get_api( $fields['app_id'], $fields['api_key'] );
76
+
77
+ // Try to request something to authenticate the validity of APP ID and API Key
78
+ $search = json_decode( $api->contact()->retrieveMultiple( array(
79
+ 'range' => 1,
80
+ )));
81
+
82
+ $status_code = $api->getLastStatusCode();
83
+
84
+ if ( 200 === $status_code ) {
85
+ $response['data'] = array(
86
+ 'api_key' => $fields['api_key'],
87
+ 'app_id' => $fields['app_id'],
88
+ );
89
+ } else {
90
+ $response['error'] = sprintf(
91
+ __( 'Error: Please check your API token. Code: %s', 'fl-builder' ),
92
+ $status_code
93
+ );
94
+ }
95
+ }
96
+
97
+ return $response;
98
+ }
99
+
100
+ /**
101
+ * Renders the markup for the connection settings.
102
+ *
103
+ * @since 2.1
104
+ * @return string The connection settings markup.
105
+ */
106
+ public function render_connect_settings() {
107
+ ob_start();
108
+
109
+ FLBuilder::render_settings_field( 'app_id', array(
110
+ 'row_class' => 'fl-builder-service-connect-row',
111
+ 'class' => 'fl-builder-service-connect-input',
112
+ 'type' => 'text',
113
+ 'label' => __( 'APP ID', 'fl-builder' ),
114
+ 'help' => __( 'Your APP ID can be found in your Ontraport account.', 'fl-builder' ),
115
+ 'preview' => array(
116
+ 'type' => 'none',
117
+ ),
118
+ ));
119
+
120
+ FLBuilder::render_settings_field( 'api_key', array(
121
+ 'row_class' => 'fl-builder-service-connect-row',
122
+ 'class' => 'fl-builder-service-connect-input',
123
+ 'type' => 'text',
124
+ 'label' => __( 'API Key', 'fl-builder' ),
125
+ 'help' => __( 'Your API key can be found in your Ontraport account.', 'fl-builder' ),
126
+ 'preview' => array(
127
+ 'type' => 'none',
128
+ ),
129
+ ));
130
+
131
+ return ob_get_clean();
132
+ }
133
+
134
+ /**
135
+ * Render the markup for service specific fields.
136
+ *
137
+ * @since 2.1
138
+ * @param string $account The name of the saved account.
139
+ * @param object $settings Saved module settings.
140
+ * @return array {
141
+ * @type bool|string $error The error message or false if no error.
142
+ * @type string $html The field markup.
143
+ * }
144
+ */
145
+ public function render_fields( $account, $settings ) {
146
+ $account_data = $this->get_account_data( $account );
147
+ $api = $this->get_api( $account_data['app_id'], $account_data['api_key'] );
148
+ $campaigns = json_decode( $api->campaignbuilder()->retrieveMultiple( array(
149
+ 'listFields' => 'id, name',
150
+ )));
151
+
152
+ $campaigns_list = array();
153
+
154
+ if ( $campaigns && count( $campaigns->data ) > 0 ) {
155
+ $campaigns_list = $campaigns->data;
156
+ }
157
+
158
+ $response = array(
159
+ 'error' => false,
160
+ 'html' => $this->render_campaigns_field( $campaigns_list, $settings ),
161
+ );
162
+
163
+ return $response;
164
+ }
165
+
166
+ /**
167
+ * Render markup for the campaign field.
168
+ *
169
+ * @since 2.1
170
+ * @param array $campaigns Campaigns data from the API.
171
+ * @param object $settings Saved module settings.
172
+ * @return string The markup for the campaign field.
173
+ * @access private
174
+ */
175
+ private function render_campaigns_field( $campaigns, $settings ) {
176
+ ob_start();
177
+
178
+ $options = array(
179
+ '0' => __( 'Choose...', 'fl-builder' ),
180
+ );
181
+
182
+ if ( $campaigns > 0 ) {
183
+ foreach ( $campaigns as $campaign ) {
184
+ $options[ $campaign->id ] = $campaign->name;
185
+ }
186
+ }
187
+
188
+ FLBuilder::render_settings_field( 'campaign_id', array(
189
+ 'row_class' => 'fl-builder-service-field-row',
190
+ 'class' => 'fl-builder-service-list-select',
191
+ 'type' => 'select',
192
+ 'label' => _x( 'Campaign', 'An email campaign from your Ontraport account.', 'fl-builder' ),
193
+ 'options' => $options,
194
+ 'default' => 0,
195
+ 'preview' => array(
196
+ 'type' => 'none',
197
+ ),
198
+ ), $settings);
199
+
200
+ return ob_get_clean();
201
+ }
202
+
203
+ /**
204
+ * Subscribe an email address to Ontraport.
205
+ *
206
+ * @since 2.1
207
+ * @param object $settings A module settings object.
208
+ * @param string $email The email to subscribe.
209
+ * @param string $name Optional. The full name of the person subscribing.
210
+ * @return array {
211
+ * @type bool|string $error The error message or false if no error.
212
+ * }
213
+ */
214
+ public function subscribe( $settings, $email, $name = '' ) {
215
+ $account_data = $this->get_account_data( $settings->service_account );
216
+ $response = array(
217
+ 'error' => false,
218
+ );
219
+
220
+ if ( ! $account_data ) {
221
+ $response['error'] = __( 'There was an error subscribing to Ontraport. The account is no longer connected.', 'fl-builder' );
222
+ } else {
223
+
224
+ $api = $this->get_api( $account_data['app_id'], $account_data['api_key'] );
225
+ $args = array(
226
+ 'email' => $email,
227
+ 'updateCampaign' => $settings->campaign_id,
228
+ );
229
+
230
+ // Add the name to the data array if we have one.
231
+ if ( $name ) {
232
+ $names = explode( ' ', $name );
233
+
234
+ if ( isset( $names[0] ) ) {
235
+ $args['firstname'] = $names[0];
236
+ }
237
+ if ( isset( $names[1] ) ) {
238
+ $args['lastname'] = $names[1];
239
+ }
240
+ }
241
+
242
+ // Save or update subscriber.
243
+ $result = $api->contact()->saveOrUpdate( $args );
244
+
245
+ if ( 200 !== $api->getLastStatusCode() ) {
246
+ $response['error'] = sprintf(
247
+ __( 'There was an error subscribing to Ontraport. Code: %s', 'fl-builder' ),
248
+ $api->getLastStatusCode()
249
+ );
250
+ }
251
+ }
252
+
253
+ return $response;
254
+ }
255
+ }
classes/class-fl-builder-services.php CHANGED
@@ -120,6 +120,12 @@ final class FLBuilderServices {
120
  'name' => 'Mautic',
121
  'class' => 'FLBuilderServiceMautic',
122
  ),
 
 
 
 
 
 
123
  'sendinblue' => array(
124
  'type' => 'autoresponder',
125
  'name' => 'SendinBlue',
120
  'name' => 'Mautic',
121
  'class' => 'FLBuilderServiceMautic',
122
  ),
123
+ 'ontraport' => array(
124
+ 'type' => 'autoresponder',
125
+ 'name' => 'Ontraport',
126
+ 'class' => 'FLBuilderServiceOntraport',
127
+ 'namespace' => true,
128
+ ),
129
  'sendinblue' => array(
130
  'type' => 'autoresponder',
131
  'name' => 'SendinBlue',
classes/class-fl-builder-ui-content-panel.php CHANGED
@@ -142,30 +142,10 @@ class FLBuilderUIContentPanel {
142
  'templateName' => 'fl-content-panel-col-groups-view',
143
  );
144
 
145
- $is_column_template = FLBuilderModel::is_post_user_template( 'column' );
146
-
147
- if ( ! $is_column_template ) {
148
- $data['views'][] = array(
149
- 'type' => 'separator',
150
- );
151
-
152
- // Columns View
153
- $data['views'][] = array(
154
- 'handle' => 'savedColumns',
155
- 'name' => __( 'Saved Columns', 'fl-builder' ),
156
- 'query' => array(
157
- 'kind' => 'template',
158
- 'type' => 'user',
159
- 'content' => 'column',
160
- 'categorized' => true,
161
- ),
162
- 'templateName' => 'fl-content-panel-saved-columns',
163
- );
164
- }
165
-
166
  // Row Templates View
167
  $templates = FLBuilderModel::get_row_templates_data();
168
  $is_row_template = FLBuilderModel::is_post_user_template( 'row' );
 
169
 
170
  if ( ! $is_row_template && ! $is_column_template && isset( $templates['groups'] ) && ! empty( $templates['groups'] ) ) {
171
 
142
  'templateName' => 'fl-content-panel-col-groups-view',
143
  );
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  // Row Templates View
146
  $templates = FLBuilderModel::get_row_templates_data();
147
  $is_row_template = FLBuilderModel::is_post_user_template( 'row' );
148
+ $is_column_template = FLBuilderModel::is_post_user_template( 'column' );
149
 
150
  if ( ! $is_row_template && ! $is_column_template && isset( $templates['groups'] ) && ! empty( $templates['groups'] ) ) {
151
 
classes/class-fl-builder-update.php CHANGED
@@ -410,7 +410,7 @@ final class FLBuilderUpdate {
410
  */
411
  static private function v_1_4_6() {
412
  // Remove the old fl-builder uploads folder.
413
- $upload_dir = wp_upload_dir();
414
  $path = trailingslashit( $upload_dir['basedir'] ) . 'fl-builder';
415
 
416
  if ( file_exists( $path ) ) {
410
  */
411
  static private function v_1_4_6() {
412
  // Remove the old fl-builder uploads folder.
413
+ $upload_dir = wp_upload_dir( null, false );
414
  $path = trailingslashit( $upload_dir['basedir'] ) . 'fl-builder';
415
 
416
  if ( file_exists( $path ) ) {
classes/class-fl-builder.php CHANGED
@@ -62,7 +62,7 @@ final class FLBuilder {
62
  * @since 2.1
63
  */
64
  static public $fa4_url = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
65
- static public $fa5_url = 'https://use.fontawesome.com/releases/v5.0.12/css/all.css';
66
 
67
  /**
68
  * Initializes hooks.
@@ -420,9 +420,10 @@ final class FLBuilder {
420
  global $post;
421
 
422
  $original_post = $post;
 
423
 
424
  // Enqueue assets for posts in the main query.
425
- if ( isset( $wp_query->posts ) ) {
426
  foreach ( $wp_query->posts as $post ) {
427
  self::enqueue_layout_styles_scripts();
428
  }
@@ -1519,6 +1520,9 @@ final class FLBuilder {
1519
  // Set the post rendering ID.
1520
  self::$post_rendering = $post_id;
1521
 
 
 
 
1522
  // Render the content.
1523
  ob_start();
1524
  self::render_content_by_id( $post_id );
62
  * @since 2.1
63
  */
64
  static public $fa4_url = 'https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css';
65
+ static public $fa5_url = 'https://use.fontawesome.com/releases/v5.0.13/css/all.css';
66
 
67
  /**
68
  * Initializes hooks.
420
  global $post;
421
 
422
  $original_post = $post;
423
+ $is_archive = is_archive() || is_home() || is_search();
424
 
425
  // Enqueue assets for posts in the main query.
426
+ if ( ! $is_archive && isset( $wp_query->posts ) ) {
427
  foreach ( $wp_query->posts as $post ) {
428
  self::enqueue_layout_styles_scripts();
429
  }
1520
  // Set the post rendering ID.
1521
  self::$post_rendering = $post_id;
1522
 
1523
+ // Try to enqueue here in case it didn't happen in the head for this layout.
1524
+ self::enqueue_layout_styles_scripts();
1525
+
1526
  // Render the content.
1527
  ob_start();
1528
  self::render_content_by_id( $post_id );
css/fl-builder.css CHANGED
@@ -713,6 +713,9 @@ body .fl-theme-builder-preview-select-item-child:hover {
713
  border-bottom: transparent !important;
714
  max-height: calc(100% - 44px) !important;
715
  }
 
 
 
716
  .fl-builder-bar-title {
717
  flex: 0 0 100px !important;
718
  }
713
  border-bottom: transparent !important;
714
  max-height: calc(100% - 44px) !important;
715
  }
716
+ .fl-builder--panel-arrow {
717
+ display:none;
718
+ }
719
  .fl-builder-bar-title {
720
  flex: 0 0 100px !important;
721
  }
css/fl-builder.min.css CHANGED
@@ -1 +1 @@
1
- #wpadminbar,html{transition-duration:.35s}.fl-builder-badge,.fl-builder-bar-title span{vertical-align:middle}.fl-theme-builder-preview-select-title i:before,body .fl-theme-builder-preview-select .fa-caret-down i:before,body .fl-theme-builder-preview-select-item-title i:before{content:"\f078"}html{transition-property:margin}html.fl-builder-is-showing-toolbar{margin-top:46px!important}.fl-builder-edit body{position:static!important}.fl-builder-edit:after,.fl-builder-edit:before{z-index:0!important}.fl-builder-edit .fl-builder-content{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none}.fl-builder-bar,.fl-builder-button{-webkit-user-select:none;-moz-user-select:none;-webkit-touch-callout:none}#wpadminbar{transition-property:transform,opacity;transform-origin:bottom;transform-style:preserve-3d;transform:rotateX(89deg) translateY(46px);opacity:0;pointer-events:none;will-change:transform}html.fl-builder-show-admin-bar{margin-top:32px}html.fl-builder-show-admin-bar #wpadminbar{transform:rotateX(0) translateY(0);pointer-events:auto;opacity:1}@media screen and (max-width:782px){html.fl-builder-show-admin-bar{margin-top:46px}}.fl-clear{clear:both}.screen-reader-text{position:absolute;left:-1000em;top:-1000em;height:1px;width:1px;overflow:hidden}.fl-builder-loading{background:url(../img/ajax-loader.svg) center center no-repeat rgba(240,240,240,.8);bottom:0;display:none;left:0;position:fixed;right:0;text-align:center;top:0;z-index:12000000}.fl-builder-settings .fl-builder-loading{background:url(../img/ajax-loader.svg) center center no-repeat rgba(255,255,255,.8);display:block;position:absolute}.fl-field-loader{color:#B3B3B3!important;font-style:italic}.fl-builder-node-loading{opacity:.35}.fl-builder-node-loading-placeholder{background:url(../img/ajax-loader.svg) center center no-repeat;height:50px}.fl-col-group-has-child-loading{display:-ms-flexbox;display:flex}.fl-col-group-has-child-loading>.fl-builder-node-loading-placeholder{width:50px}html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-desktop,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-desktop-medium,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-medium,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-medium-mobile,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-mobile{display:block!important}.fl-responsive-preview-mask{background:#F7F7F7;bottom:0;left:0;position:fixed;right:0;top:0;z-index:99999}.fl-responsive-preview{bottom:0;left:0;position:absolute;right:0;top:0;margin-top:50px;z-index:100000}#fl-builder-preview-frame,#fl-builder-preview-mask{bottom:0;height:100%;position:fixed;top:0;width:100%;right:0}.fl-builder-preview .fl-responsive-preview{margin:0!important}.fl-responsive-preview-content{background:#F5F7F9;padding:20px 20px 45px}.fl-responsive-preview-message{color:#b3b3b3;font-family:Helvetica,Arial,Verdana,sans-serif;font-size:14px;font-weight:400;padding:0 20px 20px;text-align:center}.fl-builder-button,body .fl-builder-bar .fl-builder-bar-content{display:-ms-flexbox;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important}.fl-responsive-preview-message i{cursor:pointer;margin-left:3px}.fl-responsive-preview .fl-builder-content{box-shadow:0 0 8px rgba(0,0,0,.2);margin-left:auto;margin-right:auto;max-width:100%}#fl-builder-preview-mask{background:url(../img/ajax-loader.svg) center center no-repeat #F7F7F7;left:0;z-index:99999}#fl-builder-preview-frame{left:50%;transform:translateX(-50%);-moz-transform:translateX(-50%);-webkit-transform:translateX(-50%);z-index:100000}.fl-builder-button{color:#676F7A!important;fill:#676F7A!important;background:#E4E7EA;-ms-flex-align:center;align-items:center;display:flex;text-decoration:none;font-size:14px!important;font-weight:500!important;line-height:1!important;height:33px;margin:0;padding:0 12px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border:2px solid transparent;border-radius:3px;letter-spacing:normal!important;white-space:nowrap;box-sizing:border-box!important;transition-property:background-color,width;transition-duration:.2s;-ms-user-select:none;user-select:none}.fl-builder-button:hover{background:#dadfe5;color:#222;border:2px solid transparent!important}.fl-builder-button:active{background:#DCDCDC}button.fl-builder-button:focus{position:static;top:auto;outline:0;background:#E4E7EA;border:2px solid #00A0D0!important}.fl-builder-bar .fl-builder-button{height:auto}.fl-builder-button-primary,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button{background:#00A0D2;color:#fff!important;text-decoration:none;border:2px solid transparent!important}.fl-builder-button.fl-builder-button-primary:focus,body.fl-builder--layout-has-drafted-changes .fl-builder-button.fl-builder-done-button:focus{background:#00A0D2;border:2px solid #ffc217!important}.fl-builder-button-primary:hover,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button:hover{background:#0197C6;color:#fff!important}.fl-builder-button-primary:active,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button:active{background:#0484AC}.fl-builder-button-large{height:30px}.fl-builder-button-small{font-size:11px!important;line-height:1!important}.fl-builder-help-button{color:#b3b3b3;font-size:16px!important}.fl-builder-help-button i{position:relative;top:-1px}.fl-builder-help-button:hover{color:#666}.fl-builder-publish-button{line-height:45px!important}.fl-builder-content-panel-button,.fl-builder-content-panel-button:hover{fill:#00A0D2!important;font-size:30px!important;padding-bottom:4px}.fl-builder-button-silent,.fl-builder-button-silent:hover{padding:0 12px;background:0 0!important;border:2px solid transparent!important;box-shadow:none!important}.fl-builder-done-button,.fl-builder-done-button:hover{font-weight:600}.fl-field .fl-builder-button{display:inline-block;height:auto;padding:11px 12px;vertical-align:middle;box-shadow:0 2px 4px 0 rgba(0,0,0,.12)}.fl-builder-badge{background:#333;border-radius:2px;color:#fff!important;display:inline;font-size:11px!important;font-weight:400;letter-spacing:1px;margin-left:2px;padding:2px 4px}.fl-builder-badge-global{background:#ff9600;transform:translateY(0);transition-duration:.25s;transition-property:transform}.fl-builder-blocks-node-template .fl-builder-badge-global{position:absolute;right:0;top:0}.fl-builder-block:hover .fl-builder-badge-global{display:none}.fl-builder-bar{left:0;position:fixed;right:0;top:0;z-index:999999;-ms-user-select:none;user-select:none;transition-property:transform opacity;transition-duration:.35s;transform-style:preserve-3d;perspective:1100px}.fl-builder-bar.is-hidden{pointer-events:none}.fl-builder-bar.is-hidden .fl-builder-bar-content{transform:translateY(-100%) rotateX(90deg)}body .fl-builder-bar .fl-builder-bar-content{display:flex;box-sizing:border-box;background:#fff;border-bottom:2px solid #D5DADD;color:#999;font-size:14px!important;height:48px;transition-property:background-color,opacity,transform;transition-duration:.35s;pointer-events:auto}.fl-builder-draggable-is-dragging .fl-builder-content,.fl-builder-draggable-is-dragging .fl-builder-panel .fl-lightbox,.fl-builder-resizable-is-resizing .fl-builder-content,.fl-builder-resizable-is-resizing .fl-builder-panel .fl-lightbox,body .fl-builder-bar .fl-builder-bar-content.is-muted{pointer-events:none}body .fl-builder-bar .fl-builder-bar-content.is-muted>:not(.fl-builder-publish-actions){-webkit-filter:saturate(20%) blur(1px);filter:saturate(20%) blur(1px);opacity:.4}.fl-builder-bar-title{box-sizing:border-box;color:#333;display:-ms-flexbox;display:flex;-ms-flex:0 0 380px;flex:0 0 380px;max-width:380px;border-right:2px solid #D5DADD;cursor:pointer}.fl-builder-bar-title:hover{background:#fff}.fl-builder-bar-title.is-showing-menu .fl-builder-bar-title-caret>svg{transform:rotate(180deg)}.fl-builder-simple .fl-builder-bar-title{cursor:auto}.fl-builder-simple .fl-builder-bar-title:hover{cursor:auto;background:0 0}.fl-builder-bar-title-icon{box-sizing:border-box;background:0 0;-ms-flex:0 0 46px;flex:0 0 46px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:4px}.fl-builder-bar-title-icon img{max-width:100%!important;height:auto!important}.fl-builder-bar-title.fl-builder-bar-title-no-icon{padding-left:12px}.fl-builder-bar-title-area{box-sizing:border-box;-ms-flex:1 1 100%;flex:1 1 100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding:4px}.fl-builder-layout-title,.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{font-size:17px;font-weight:400;line-height:1.3;color:#161B20;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.fl-builder-bar-title-caret,.fl-builder-layout-pretitle,.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{font-size:12px;font-weight:500;line-height:1.3;color:#656d77;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.fl-builder-bar-title-caret i,.fl-theme-builder-preview-select-title i{color:inherit!important;font-size:14px}.fl-builder-bar-title-caret{margin-left:auto!important;-ms-flex:0 0 46px;flex:0 0 46px}.fl-theme-builder-preview-select-title i{padding:12px}.fl-theme-builder-preview-select.fl-builder-button{position:relative;border-radius:0;background:0 0;min-width:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 360px;flex:0 0 360px;max-width:360px;margin:0!important;padding:4px 10px;border:none!important;border-right:2px solid #d5dadd!important;box-shadow:none}.fl-theme-builder-preview-select.fl-builder-button:hover{border:none!important;border-right:2px solid #d5dadd!important}.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.fl-theme-builder-preview-select-title div{-ms-flex:1;flex:1}.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{display:block}.fl-theme-builder-preview-select-open .fl-theme-builder-preview-select-items{position:absolute;top:calc(48px + 10px);left:10px;width:calc(100% - 20px)!important;background:#fff;border-radius:4px;border:2px solid #D5DADD;border-top:3px solid #00a0d2;box-shadow:0 15px 45px 8px rgba(0,0,0,.04);margin:0!important;padding:0;z-index:-1;font-size:16px;overflow:visible;height:auto!important;max-height:calc(100vh - 66px);min-height:300px;display:-ms-flexbox!important;display:flex!important;-ms-flex-direction:column;flex-direction:column}.fl-theme-builder-preview-select-item{padding:4px 0!important;border-bottom:none!important;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.fl-theme-builder-preview-select-item:hover{text-decoration:none;color:#111;background:0 0!important}body .fl-theme-builder-preview-select .fa-caret-down{float:none}body .fl-theme-builder-preview-select-item-title{padding:10px 15px;color:#222;font-size:14px}body .fl-theme-builder-preview-select-item-children{overflow:auto}body .fl-theme-builder-preview-select-item-child{overflow:hidden;text-overflow:ellipsis;line-height:1.1;margin:0 10px;border:2px solid transparent;border-radius:4px;padding:8px 10px 10px;font-size:14px;font-weight:400;color:#222}body .fl-theme-builder-preview-select-item-child:hover{background:#e6eaed!important}.fl-theme-builder-preview-select-item .fa-caret-down{color:#606D77}.fl-builder-bar-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex:1 1 100%;flex:1 1 100%;padding:4px}.fl-builder-bar .fl-builder-button{margin:0 0 0 4px}.fl-builder-bar-actions .fl-builder-button:last-child{margin:0}.fl-builder-bar-actions:after{clear:both}.fl-builder-bar .fl-builder-content-panel-button{-ms-flex-align:baseline!important;align-items:baseline!important;padding-top:1px;font-weight:400}.fl-builder-content-panel-button svg{transition-property:transform;transition-duration:.25s;transform:rotate(0) scale(1);transform-origin:center}.fl-builder-content-panel-is-showing .fl-builder-content-panel-button svg{transform:rotate(135deg) scale(1.1) translate(.5px,-.5px)}.fl-builder--saving-indicator{cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;padding:0 16px;font-size:1em;font-style:italic;color:#676f7a;-ms-flex-align:center;align-items:center;line-height:1.2;min-width:180px;-ms-flex-pack:end;justify-content:flex-end}.fl-builder--saving-indicator:hover{color:#676f7a}.fl-builder--saving-indicator .fa-question-circle{font-size:13px;margin:3px 0 3px 8px}.fl-builder-buy-button,.fl-builder-upgrade-button{background:#F7A407;color:#fff!important;text-decoration:none}.fl-builder-buy-button i.fa-external-link-alt,.fl-builder-upgrade-button i.fa-external-link-alt{color:#FFC733;margin:0 0 0 6px}.fl-builder-buy-button:hover,.fl-builder-upgrade-button:hover{background:#EE8E0D;color:#fff!important}@media (max-width:980px){.fl-builder--main-menu-panel{width:calc(100% - 20px)!important}.fl-builder--main-menu-panel:before{right:auto;left:20px}.fl-builder-bar-title,.fl-theme-builder-preview-select{-ms-flex:1 .5 380px!important;flex:1 .5 380px!important}}@media (max-width:620px){.fl-theme-builder-preview-select.fl-builder-button{display:none}}@media (max-width:500px){.fl-builder--main-menu-panel:before,.fl-builder-bar-title-area,.fl-builder-panel-drag-handle,.fl-builder-panel:before{display:none}.fl-builder--main-menu-panel,.fl-builder-panel{width:auto!important;top:44px!important;left:0!important;right:0!important;bottom:0!important;border-radius:0!important;box-shadow:none!important}.fl-builder--main-menu-panel{border-left:transparent!important;border-right:transparent!important;border-bottom:transparent!important;max-height:calc(100% - 44px)!important}.fl-builder-bar-title{-ms-flex:0 0 100px!important;flex:0 0 100px!important}.fl-builder--panel-header{border-radius:0!important;cursor:default!important}.fl-builder--panel-header .fl-builder--tabs{cursor:default!important}.fl-builder-publish-actions{width:100%!important}.fl-builder-bar-actions .fl-builder-button{padding:0 8px!important}}.fl-builder--preview-actions{display:none;position:fixed;top:4px;left:4px;z-index:100008;padding:4px;-ms-flex-pack:center;justify-content:center;background:#fff;border-radius:4px}.fl-builder-preview .fl-builder--preview-actions{display:-ms-flexbox;display:flex}.fl-builder--preview-actions .device-icons{color:#555;background:#e4e4e4;border:none!important;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;text-decoration:none;font-size:14px!important;line-height:1!important;margin:0 4px 0 0;padding:0 6px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px}.fl-builder--preview-actions .device-icons i{margin:0 6px}@keyframes fl-builder-ui-pin-zone-pulse{0%,100%{opacity:1;filter:alpha( opacity=1 )}50%{opacity:.5;filter:alpha( opacity=35 )}}.fl-builder-ui-pin-zone{animation:fl-builder-ui-pin-zone-pulse 2s infinite;transition:width .3s ease;background:rgba(0,160,210,.5);bottom:0;top:0;position:fixed;width:35px;z-index:100001}.fl-builder-ui-show-pin-zone-left .fl-builder-ui-pin-zone-left,.fl-builder-ui-show-pin-zone-right .fl-builder-ui-pin-zone-right{width:75px}.fl-builder-ui-pin-zone-left{left:0}.fl-builder-ui-pin-zone-right{right:0}.fl-builder-content-panel-pin-zone .fl-builder-content-panel-button{display:-ms-flexbox!important;display:flex!important;background:rgba(0,160,210,.5)!important;padding:2px 4px;width:80px;animation:fl-builder-ui-pin-zone-pulse 2s infinite}.fl-builder-content-panel-pin-zone .fl-builder-content-panel-button svg{display:none}.fl-builder-content-panel-pin-zone-hover .fl-builder-content-panel-button{width:120px}.fl-builder-content-panel-pin-zone-hover .fl-builder-content-panel-button svg{display:none!important;width:100%;transform:none!important;fill:#00A0D2!important;border-radius:3px}.fl-builder-ui-is-pinned .fl-builder-content-panel-button,.fl-builder-ui-pinned-container .fl-lightbox-controls{display:none}.fl-builder-content-panel-pin-zone .fl-builder-done-button{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.fl-builder-panel.fl-builder-ui-pinned{top:48px!important;bottom:0!important;height:auto!important;border-radius:0;border:none;box-shadow:none;animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s;z-index:9}.fl-builder-panel.fl-builder-ui-pinned-right{left:auto!important;right:0;border-left:2px solid #d5dadd}.fl-builder-panel.fl-builder-ui-pinned-left{left:0;right:auto;border-right:2px solid #d5dadd}.fl-builder-panel.fl-builder-ui-pinned .fl-builder--panel-header{border-radius:0!important}.fl-builder-ui-pinned-container .fl-lightbox-wrap{position:absolute;z-index:9}.fl-builder-ui-pinned-container .fl-lightbox{position:absolute;top:0;bottom:0;left:0;right:0;width:auto!important;height:auto;border-radius:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s}.fl-builder-ui-pinned-container .fl-lightbox-header-wrap{border-radius:0}.fl-builder-ui-pinned-container .fl-lightbox.ui-draggable .fl-lightbox-header{cursor:auto}.fl-builder-ui-pinned-container .fl-lightbox-header h1{padding:12px 20px 10px!important}.fl-builder-ui-pinned-content-transform{transform:scale(1);transform-origin:center top 0}.fl-builder-ui-pinned-collapse{cursor:pointer;display:none;position:absolute!important;bottom:2px;padding:5px;border:2px solid transparent;background:0 0;width:36px;height:36px;border-radius:4px;fill:#778794;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}.fl-builder-ui-pinned-collapse:focus,.fl-builder-ui-pinned-collapse:hover{top:auto!important;background:0 0;border:2px solid transparent;outline:0;fill:#00A0D2}.fl-builder-ui-pinned-collapse:focus{background:#E4E7EA}.fl-builder-ui-pinned-collapse>*{margin:auto;line-height:1}.fl-builder-ui-pinned-collapse svg g{fill:inherit}.fl-builder-ui-is-pinned-right .fl-builder-ui-pinned-right-collapse{display:-ms-flexbox;display:flex;left:-40px}.fl-builder-ui-is-pinned-left .fl-builder-ui-pinned-left-collapse{display:-ms-flexbox;display:flex;right:-40px}.fl-builder-ui-pinned-collapse i[data-toggle=show],.fl-builder-ui-pinned-is-collapsed i[data-toggle=hide]{display:none}.fl-builder-ui-pinned-is-collapsed i[data-toggle=show]{display:block}.fl-builder--panel-no-settings,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-content,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-controls,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--tab-wrap,.fl-builder-ui-pinned-is-collapsed .fl-builder--panel-header{display:none}.fl-builder-ui-is-pinned-left [data-toggle=hide],.fl-builder-ui-is-pinned-right [data-toggle=show]{transform:rotateY(180deg)}.fl-builder-ui-pinned-is-collapsed .fl-lightbox{box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-header{background:0 0;border:none;z-index:10}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-lightbox-wrap{top:0}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-lightbox-header h1{padding:14px 28px 15px!important}.fl-builder-simple-pinned .fl-builder--panel-no-settings{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;position:absolute;top:0;left:0;right:0;bottom:0}@keyframes fl-builder-show-panel{from{transform:scale(.8)}to{transform:scale(1)}}.fl-builder--search-results-panel,.fl-builder-panel{box-sizing:border-box;position:fixed!important;right:20px;top:calc(48px + 10px);width:380px;bottom:20px;background:#F5F7F9;color:#676F7A;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:14px;border-radius:4px;box-shadow:0 8px 40px 4px rgba(0,0,0,.3);z-index:10000007;will-change:transform;display:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fl-builder-panel{transform-origin:top right;animation-name:fl-builder-show-panel;animation-duration:.15s;animation-fill-mode:both}.fl-builder--search-results-panel{position:absolute;right:0;top:93px;left:0;bottom:0;width:auto!important;border:none;border-radius:0;box-shadow:none;min-height:100px;max-height:calc(100vh - 54px);overflow:auto;z-index:1}.fl-builder-content-panel-is-showing .fl-builder-panel,.fl-builder-search-results-panel-is-showing .fl-builder--search-results-panel{display:block}.fl-builder-panel .fl-lightbox .fl-builder-panel-drag-handle,.fl-builder-ui-is-pinned .fl-builder--panel-arrow,.fl-lightbox-width-full .fl-builder-panel-drag-handle,body.fl-builder-draggable-is-dragging .fl-builder--panel-arrow{display:none}.fl-builder-content-panel-is-showing .fl-builder-panel.fl-builder--current-view-templates{width:520px}.fl-builder--search-results-panel .fl-builder--no-results{text-align:center;padding:50px 20px}.fl-builder--panel-arrow{position:absolute;top:-13px;right:10px}.fl-builder--panel-arrow polygon{fill:#00a0d2}.fl-builder--panel-header{background:#fff;border-top:3px solid #00a0d2;border-bottom:2px solid #e6eaed;border-top-right-radius:4px;border-top-left-radius:4px}.fl-builder-ui-is-pinned .fl-builder--panel-header{border-top-color:transparent}.fl-builder-panel-drag-handle{position:absolute;top:7px;left:10px;fill:#ccd4da;width:6px}.fl-builder-ui-is-pinned-left .fl-builder-panel-drag-handle{left:auto;right:10px}.fl-builder--panel-header .fl-builder--panel-controls{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative}.fl-builder--panel-header .fl-builder--panel-controls .fl-builder-content-group-select{-ms-flex:1 1;flex:1 1}.fl-builder--panel-header .fl-builder--panel-controls .fl-builder-panel-search{-ms-flex:0 0;flex:0 0;padding:0 10px 6px 0;margin-left:-4px}.fl-builder--panel-controls .fl-builder-panel-search button{width:38px;background:0 0!important;border:2px solid transparent!important;font-size:inherit;height:38px;padding:0}.fl-builder--panel-controls .fl-builder-panel-search button:active,.fl-builder--panel-controls .fl-builder-panel-search button:focus{top:0;outline:0}.fl-builder-panel-search button svg{height:auto;width:20px}.fl-builder-panel-search button.fl-builder-dismiss-panel-search svg{width:16px}.fl-builder-panel-search button svg .filled-shape{fill:#000}.fl-builder--panel-controls .fl-builder-panel-search button:active svg .filled-shape,.fl-builder--panel-controls .fl-builder-panel-search button:focus svg .filled-shape{fill:#00A0D2}.fl-builder-panel-search .fl-builder-panel-search-input{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:#fff}.fl-builder-panel-search.is-showing-input .fl-builder-panel-search-input{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:0 10px 6px}.fl-builder-panel-search-input input{-ms-flex:1 1 100%;flex:1 1 100%;border:2px solid #e6eaed;background:#fff;border-radius:4px;margin-right:4px;padding:10px;color:#333}.fl-builder-panel-search-input input:focus{border-color:#0197C6;outline:0}.fl-builder-panel-search-input button{-ms-flex:0 0 38px;flex:0 0 38px}.fl-builder-panel-content-wrap{bottom:0;height:auto;left:0;overflow:hidden;position:absolute;right:0;top:43px}.fl-builder-panel-content{padding-bottom:60px}.fl-builder-blocks-section{border-top:2px solid #e6eaed}.fl-builder--panel-view .fl-builder-blocks-section:first-child{border-top:none}.fl-builder-blocks-group:first-child{padding:20px 0 0}.fl-builder-blocks-group .fl-builder-blocks-section-group-name{display:block;padding:0 30px 15px;color:#000;font-size:20px;font-weight:600;line-height:1.4}.fl-builder-blocks-section .fl-builder-block,.fl-builder-blocks-section .fl-builder-blocks-section-title{display:block;line-height:1.1;padding:15px 20px}.fl-builder--template-collection-section-name,.fl-builder-blocks-section .fl-builder-blocks-section-title{display:inline-block;font-weight:700;font-size:12px;line-height:1.2;text-transform:uppercase;color:#333;padding:4px 10px 4px 15px;margin:0!important;background:#e6eaed;border-bottom-right-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top}.fl-builder-blocks-section .fl-builder-blocks-section-title i{color:#bfbfbf;float:right}.fl-builder-blocks-section-content{overflow:auto;padding:10px 10px 20px}.fl-builder-blocks-section-content:after{float:none;clear:both}.fl-builder-blocks-section-content.fl-builder-modules,.fl-builder-blocks-section-content.fl-builder-rows,.fl-builder-blocks-section-content.fl-builder-widgets{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.fl-builder-blocks-section-content .fl-builder-block-module,.fl-builder-blocks-section-content .fl-builder-block-row{-ms-flex:1 1 50%;flex:1 1 50%;width:50%;box-sizing:border-box}.fl-builder--search-results-panel .fl-builder-blocks-section-content .fl-builder-block-module{-ms-flex:1 1 100%;flex:1 1 100%;width:100%}.fl-builder-blocks-section.fl-active .fl-builder-blocks-section-content{display:block}.fl-builder-blocks-section-content .fl-builder-block{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:4px;font-size:14px;line-height:1.1;font-weight:500;color:#727272}.fl-builder-block{position:relative;height:47px}.fl-builder-block.fl-builder-block-col-group{height:84px}.fl-builder-block.fl-builder-block-module-template.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-row-template.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-column.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-module.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-row.fl-builder-block-has-thumbnail{padding:10px;height:auto}.fl-builder-block:hover{overflow:visible;z-index:1}.fl-builder-block:hover .fl-builder-block-content{display:block;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;padding:15px 20px;border-radius:4px;background:#fff;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);text-decoration:none;color:#111;cursor:move;overflow:hidden}.fl-builder-block.fl-builder-block-module-template.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-row-template.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-column.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-module.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-row.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-blocks-node-template .fl-builder-block,.fl-builder-blocks-section-content .fl-builder-block .fl-builder-block-details{position:relative}.fl-builder-block-module:hover .fl-builder-block-content{width:auto;min-width:100%}.fl-builder-block .fl-builder-block-content .fl-builder-block-visual{display:block;margin-bottom:7px}.fl-builder-block-drag-helper .fl-builder-block-content .fl-builder-block-visual{display:none!important}.fl-builder-block .fl-builder-block-content .fl-builder-block-visual.fl-cols-visual{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:30px}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{-ms-flex:1 100%;flex:1 100%;background:#464a4c;height:30px;margin:0 2px;border-radius:2px}.fl-builder-block:hover .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{background:#000}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col:first-child{margin-left:0!important}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col:last-child{margin-right:0!important}.fl-cols-visual.left-right-sidebar .fl-cols-visual-col:first-child,.fl-cols-visual.left-right-sidebar .fl-cols-visual-col:last-child,.fl-cols-visual.left-sidebar .fl-cols-visual-col:first-child,.fl-cols-visual.right-sidebar .fl-cols-visual-col:last-child{-ms-flex-preferred-size:60px;flex-basis:60px}.fl-builder-block-saved-column.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-column:hover .fl-builder-block-title,.fl-builder-block-saved-module.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-module:hover .fl-builder-block-title,.fl-builder-block-saved-row.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-row:hover .fl-builder-block-title{margin-right:70px}.fl-builder-block-module:nth-child(even):hover .fl-builder-block-content{left:auto;right:0}.fl-builder-block-thumbnail{border-radius:4px;background-size:contain;background-repeat:no-repeat;background-position:center;background-color:rgba(0,0,0,.06);margin-bottom:10px;transform-origin:bottom;transition-property:transform,box-shadow;transition-duration:.15s}.fl-builder-block:hover .fl-builder-block-thumbnail{transform:scale(1.05);box-shadow:0 20px 40px rgba(0,0,0,.08)}.fl-builder-block .fl-builder-block-icon{margin-right:7px;fill:#000;display:inline-block;width:20px;height:20px;vertical-align:middle}.fl-builder-block-thumbnail:before{content:"";display:block;padding-top:50%}.fl-builder-block-thumbnail img{max-width:100%;max-height:160px;margin:0;-o-object-fit:cover;object-fit:cover}.fl-builder-blocks-section-content .fl-builder-block{box-shadow:0 0 0 transparent;transition-property:box-shadow;transition-duration:.15s}.fl-builder-blocks-section-content .fl-builder-block i,.fl-user-template-actions i{color:#000;margin-right:10px}.fl-builder-blocks-separator{background:#f1f1f1;height:6px}.fl-builder-block:hover .fl-builder-badge{background:#2ea2cc}.ui-sortable-helper .fl-builder-badge{display:none!important}.fl-builder-modules-cta a{color:#999!important;display:block!important;font-size:12px!important;font-style:italic!important;padding:15px 20px!important;line-height:16px!important}.fl-builder-modules-cta a:hover{background:#e5e5e5!important;color:#666!important;text-decoration:none!important}.fl-builder-modules-cta a:focus{text-decoration:none!important}.fl-builder-modules-cta .fa{float:right!important;font-size:14px!important;margin:3px 0 0 9px!important}.fl-builder--panel-message{text-align:center;padding:40px 20px;font-size:16px}.fl-builder--panel-message .fl-builder-button{display:inline-block;padding:10px}.fl-builder--panel-cta{padding:20px 30px;font-size:16px;text-align:center}.fl-builder--panel-cta a{color:inherit;text-decoration:none}.fl-builder--panel-cta a:hover{text-decoration:none}.fl-builder-block-template-image{margin:5px 0 10px;max-width:100%;border:1px solid #dfdfdf}.fl-builder-block .fl-builder-block-title{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;line-height:1.3}.ui-sortable-helper .fl-builder-block-template-image{display:none!important}@keyframes fl-builder-template-item-enter{from{transform:translateY(100px) scale(.3);opacity:0}to{transform:scale(1);opacity:1}}.fl-builder--template-collection{clear:both;padding:10px 0}.fl-builder--template-collection-section-content{padding:0 10px}.fl-builder--template-collection-item{box-sizing:border-box;width:50%;float:left;padding:10px;cursor:pointer;font-size:13px;transform-origin:center;opacity:1}.fl-builder--template-thumbnail{background-size:cover;background-clip:content-box;background-position:center top;background-color:#fff;border:2px solid transparent;transform-origin:bottom;transition-property:transform,box-shadow;transition-duration:.15s}.fl-builder--template-collection-item[data-id="0"] .fl-builder--template-thumbnail,.fl-user-template .fl-builder--template-thumbnail{border-color:#e4e7ea}.fl-builder--template-thumbnail:before{display:block;content:"";padding-top:120%}.fl-builder--template-thumbnail:hover{transform:scale(1.05);box-shadow:0 20px 40px rgba(0,0,0,.08)}.fl-builder--template-name{text-align:center;padding:4px 0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.fl-builder--template-collection-section{padding-bottom:10px;border-bottom:1px solid #dfdfdf}.fl-builder--template-collection-section:after,.fl-builder--template-collection-section:before{content:"";display:block;clear:both}.fl-builder--template-collection-section-name{padding:15px 10px 10px}span.fl-builder-block-no-node-templates{display:block;padding:15px 20px;text-align:center}span.fl-builder-block-no-node-templates:hover{cursor:default}.fl-builder-blocks-section-content .fl-builder-node-template-actions{bottom:0;cursor:default;display:none;position:absolute;right:0;top:0}.fl-builder-blocks-section-content .fl-builder-node-template-delete,.fl-builder-blocks-section-content .fl-builder-node-template-edit{display:inline;cursor:pointer;margin:0;padding:15px 10px;text-align:center;width:30px}.fl-builder-block-details .fl-builder-node-template-delete,.fl-builder-block-details .fl-builder-node-template-edit{padding-top:0!important}.fl-builder-blocks-section-content .fl-builder-node-template-delete i,.fl-builder-blocks-section-content .fl-builder-node-template-edit i{margin:0}.fl-builder-blocks-section-content .fl-builder-node-template-delete:hover i,.fl-builder-blocks-section-content .fl-builder-node-template-edit:hover i{color:#444}.fl-builder-blocks-node-template .fl-builder-block:hover .fl-builder-node-template-actions{display:block}.ui-sortable-helper .fl-builder-node-template-delete,.ui-sortable-helper .fl-builder-node-template-edit{display:none!important}.fl-builder--tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:center;align-items:center}.fl-builder-panel .fl-builder--panel-header{cursor:move;position:absolute;top:0;left:0;right:0;z-index:9}.fl-builder-panel .fl-builder--tabs{-ms-flex-pack:distribute;justify-content:space-around;padding:0 24px;min-height:46px;cursor:pointer}.fl-builder--tab-wrap{-ms-flex:1 1 100%;flex:1 1 100%;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:justify;justify-content:space-between}.fl-builder--tabs button,.fl-builder--tabs button:active,.fl-builder--tabs button:focus,.fl-builder--tabs button:hover{-ms-flex:1 1 100%;flex:1 1 100%;display:inline-block;text-decoration:none;color:inherit;text-align:center;letter-spacing:normal!important;padding:5px;cursor:pointer;font-size:14px!important;font-weight:600!important;line-height:1.4!important;background:0 0!important;outline:0!important;border:2px solid transparent;border-radius:4px;margin:7px 0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important;top:0;transition-property:background,color;transition-duration:.25s}.fl-builder--current-view-name,.fl-builder-drop-zone{text-align:left;text-overflow:ellipsis;white-space:nowrap}.fl-builder--tabs button:focus{background:#e6eaed!important}.fl-builder--tabs button.is-showing{color:#0086b0}.fl-builder--panel-view{display:none;overflow:hidden}.fl-builder--panel-view.is-showing{display:block}.fl-builder--content-library-panel .fl-builder--panel-view.is-showing{position:absolute;top:96px;bottom:0;left:0;right:0;width:auto;height:auto}.fl-builder--content-library-panel.single-view .fl-builder--panel-view.is-showing{top:52px}.fl-builder--content-library-panel.ui-draggable-dragging{height:500px!important}.fl-builder--content-library-panel .fl-builder-drop-zone{display:none!important}.fl-builder--panel-header .fl-builder--tabs{cursor:move}.fl-builder--category-select{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.fl-builder--selector-display{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;color:#161B20;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;cursor:pointer;font-size:13px;font-weight:700;line-height:16px;border-radius:4px}.fl-builder--selector-display-label{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-size:inherit;line-height:inherit;width:100%;padding:0!important;color:#6D6D6D;background:0 0;border:2px solid #e4e7ea;border-radius:4px;font-family:inherit}.fl-builder--selector-display-label:active,.fl-builder--selector-display-label:hover{top:0;color:inherit;background:0 0;border:2px solid #e4e7ea;border-radius:4px}.fl-builder--selector-display-label:focus{top:0;color:inherit;background:0 0;border:2px solid #00A0D2;outline:0}.fl-builder--group-label{color:inherit;-ms-flex:0 0 0%;flex:0 0 0%;padding:9px 12px 9px 10px;background:#e6eaed;border-top-left-radius:2px;border-bottom-left-radius:2px}.fl-builder--current-view-name{-ms-flex:1 1 100%;flex:1 1 100%;color:inherit;overflow:hidden;font-weight:600;padding:9px 10px}.fl-builder--selector-menu{display:none;color:#293138;position:absolute;top:46px;left:0;width:100%;background:#fff;border-radius:4px;box-shadow:0 0 20px 2px rgba(0,0,0,.2);overflow:visible}.fl-builder--selector-menu:before{bottom:100%;right:8px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}.fl-builder--category-select.is-showing .fl-builder--selector-menu{display:-ms-flexbox;display:flex;max-height:calc(100vh - 150px)}.fl-builder--category-select.is-showing .fl-builder--selector-menu .fl-builder--menu{margin:10px 0;-ms-flex:1 100%;flex:1 100%;overflow:auto}button.fl-builder-button.fl-builder-bar-title-caret{margin:4px}button.fl-builder-button.fl-builder-bar-title-caret:focus{background-color:#e6eaed!important;border-color:transparent!important}.fl-builder--category-select.is-showing .fl-builder-bar-title-caret i{transform:rotate(180deg)}.fl-builder--menu{margin-bottom:2px}.fl-builder--menu>a,.fl-builder--menu>button,.fl-builder--menu>span{display:block;padding:8px 10px 10px;border-radius:4px;color:inherit;text-decoration:none;background:0 0!important;border:2px solid transparent!important;font-weight:400;font-family:inherit}.fl-builder--menu>a:active,.fl-builder--menu>a:focus,.fl-builder--menu>a:hover,.fl-builder--menu>button:active,.fl-builder--menu>button:focus,.fl-builder--menu>button:hover{background:#e6eaed!important;border:2px solid transparent!important;top:0}.fl-block-col-resize-feedback,.fl-block-overlay-title,.fl-builder-block-drag-helper,.fl-builder-block.ui-draggable-dragging,.fl-builder-drop-zone,.fl-builder-empty,.fl-builder-has-submenu>ul.fl-builder-submenu li a{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.fl-builder--menu>a:focus,.fl-builder--menu>button:focus{outline:0;color:inherit;text-decoration:none}.fl-builder--menu .fl-inset{padding-left:35px;font-size:14px;line-height:1.25}.fl-builder--menu a.fl-template-collection{color:#161B20}.fl-builder--menu>:after{clear:both}.fl-builder--menu * .fl-builder--menu-item-accessory{float:right;color:#000;text-transform:uppercase;text-align:center;min-width:20px;letter-spacing:2px}.fl-builder--menu * .fl-builder--menu-item-accessory i{font-size:1em;margin-top:2px}.fl-builder--menu .fl-builder-video-wrap iframe{display:block;margin:4px 0;width:100%}.fl-builder-publish-actions{display:-ms-flexbox;display:flex;box-sizing:border-box;position:absolute;top:0;right:0;width:380px;max-width:100%;height:46px;padding:4px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;opacity:1;pointer-events:auto;transform:scaleX(1) translateX(0);transform-origin:right;transition-property:transform,opacity;transition-duration:.15s}.fl-builder-publish-actions.is-hidden{transform:scaleX(.23) translateX(68px);opacity:0;pointer-events:none}.fl-builder-bar .fl-builder-button-group{display:-ms-flexbox;display:flex;-ms-flex-preferred-size:100%;flex-basis:100%}.fl-builder-bar .fl-builder-button-group>.fl-builder-button{border-radius:0;margin-left:0;-ms-flex-preferred-size:100%;flex-basis:100%;text-align:center;-ms-flex-pack:distribute;justify-content:space-around;box-shadow:none}.fl-builder-bar .fl-builder-button-group>.fl-builder-button:first-child{margin-left:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.fl-builder-bar .fl-builder-button-group>.fl-builder-button:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.fl-builder-publish-actions-click-away-mask{display:none;position:fixed;top:0;left:0;right:0;height:100vh;background:0 0}.fl-builder-dragging .fl-builder-content:not(.fl-builder-empty){padding:16px 0}.fl-builder-empty{display:none;border:2px dashed #969696;border-radius:8px;color:#909090;font-size:20px;font-weight:700;margin:10px;padding:250px 20px;position:relative;text-align:center;text-transform:uppercase}.fl-builder-edit .fl-builder-empty{display:block}.fl-builder-block-drag-helper,.fl-builder-block.ui-draggable-dragging{background:rgba(255,255,255,.95)!important;border:2px solid #000;border-radius:4px;box-shadow:0 0 8px rgba(0,0,0,.2);-moz-box-shadow:0 0 8px rgba(0,0,0,.2);-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);color:#333!important;font-size:13px!important;height:47px!important;line-height:40px!important;overflow:hidden;padding:0 20px;position:fixed!important;text-overflow:ellipsis;white-space:nowrap;width:180px!important;z-index:100010!important;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-line-pack:center;align-content:center;-ms-flex-pack:start;justify-content:flex-start}.fl-builder-block.fl-builder-block-drag-helper:hover{padding:0;box-shadow:none}.fl-builder-block-drag-helper:hover .fl-builder-block-content{position:static;padding:0 20px}.fl-col-has-highlight-guide .fl-col-content,.fl-col-highlight,.fl-row-highlight .fl-col-group{position:relative}.fl-builder-block-saved-column.fl-builder-block-drag-helper:hover .fl-builder-block-content,.fl-builder-block-saved-module.fl-builder-block-drag-helper:hover .fl-builder-block-content,.fl-builder-block-saved-row.fl-builder-block-drag-helper:hover .fl-builder-block-content{padding:14px 20px}.fl-builder-block-drag-helper .fl-builder-block-icon{fill:#000;margin-top:-10px}.fl-builder-drop-zone{animation:fl-builder-drop-zone-pulse 2s infinite;background:#00A2D7;border-radius:4px;color:#fff!important;display:block;font-weight:400;font-size:12px;letter-spacing:1px;line-height:14px;margin:10px;padding:6px 8px 5px;position:relative;text-shadow:none;text-transform:none;overflow:hidden;z-index:10}@keyframes fl-builder-drop-zone-pulse{0%,100%{background-color:#00A2D7}50%{background-color:#79DEFF}}.fl-builder-drop-zone-global{animation:fl-builder-drop-zone-global-pulse 2s infinite;background:#ff9600}.fl-field,.fl-lightbox{animation-duration:.25s}@keyframes fl-builder-drop-zone-global-pulse{0%,100%{background-color:#FFBC5C}50%{background-color:#ff9600}}.fl-builder-content>.fl-builder-drop-zone{margin:10px 20px}.fl-row-content>.fl-builder-drop-zone{margin:3px 7px}.fl-col-has-cols>.fl-col-content>.fl-builder-drop-zone{margin:3px 10px}.fl-sortable-disabled>.fl-builder-drop-zone{display:none!important}.fl-col-group-equal-height.fl-col-group-align-center .fl-col-content>.fl-builder-drop-zone{width:100%}.fl-row-highlight{padding:16px 0}.fl-row-highlight .fl-row-content{border:2px dashed rgba(203,205,206,.5);padding:8px;border-radius:6px}.fl-row-highlight.fl-node-global .fl-row-content{border-color:#ff9600}.fl-col-highlight{padding:8px}.fl-col-highlight .fl-col-content{border-style:dashed!important;border-color:#00a0d2!important;border-radius:4px;min-height:100px;overflow-x:hidden;width:100%;border-width:2px!important}.fl-col-has-cols.fl-col-highlight>.fl-col-content{padding:8px}.fl-col-highlight.fl-node-global .fl-col-content{border-color:#ff9600!important}.fl-builder-simple .fl-col-highlight .fl-col-content{border:none!important}.fl-col-highlight-guide{background:rgba(0,160,210,.05);border:2px solid #00A0D2;border-radius:4px;bottom:4px;left:4px;position:absolute;right:4px;top:4px;z-index:1}.fl-node-global .fl-col-highlight-guide{border-color:#ff9600!important;background-color:rgba(255,150,0,.06)!important}.fl-col-has-highlight-guide .fl-block-overlay{background:0 0;border-color:transparent}.fl-col-has-highlight-guide .fl-block-col-resize{display:none}.fl-col-has-highlight-guide .fl-col-highlight .fl-col-content{border-color:transparent!important}.fl-col-drop-target{bottom:8px;display:none;left:-9px;position:absolute;top:8px;width:18px;z-index:1}.fl-col-highlight .fl-col-drop-target{display:block}.fl-col-drop-target-last{left:auto;right:-9px}.fl-col-drop-target .fl-builder-drop-zone{bottom:0;left:2px;margin:0;padding:0;position:absolute;right:2px;top:0}.fl-col-group-drop-target{display:none;left:8px;height:18px;position:absolute;right:8px;top:-9px;z-index:1}.fl-row-highlight .fl-col-group-drop-target{display:block}.fl-col-group-drop-target-last{top:auto;bottom:-9px}.fl-col-group-drop-target .fl-builder-drop-zone{bottom:2px;left:0;margin:0;padding:0;position:absolute;right:0;top:2px}.fl-row-content>.fl-col-group-drop-target{position:static}.fl-row-content>.fl-col-group-drop-target .fl-builder-drop-zone{height:18px;position:static}.fl-row-drop-target{display:none;left:0;height:24px;margin-top:-28px;position:absolute;right:0;z-index:1}.fl-row-highlight .fl-row-drop-target{display:block}.fl-row-drop-target-last{margin-top:4px}.fl-row .fl-row-drop-target .fl-builder-drop-zone{bottom:0;left:4px;margin:0;position:absolute;right:4px;top:0}.fl-builder-content>.fl-row-drop-target{margin:0;position:static}.fl-builder-dragging .fl-builder-content.fl-builder-empty>.fl-row-drop-target{bottom:10px;display:block;height:auto;left:0;position:absolute;right:0;top:10px}.fl-builder-content .fl-row-drop-target .fl-builder-drop-zone{margin-bottom:0;margin-top:0}.fl-col-group:focus,.fl-col:focus,.fl-module:focus,.fl-row:focus{outline:0}.fl-sortable-proxy{display:none}.fl-block-overlay,.fl-block-overlay *{text-shadow:none;-webkit-touch-callout:none}.fl-block-overlay-active{position:relative}.fl-block-overlay-actions{background:#00A0D2;float:left;height:30px;margin:-1px -1px 0;padding:0 4px;text-shadow:none;border-bottom-right-radius:5px;border-top-left-radius:3px}.fl-row-overlay-header-bottom .fl-block-overlay-actions{border-radius:0 5px 0 3px}.fl-builder-col-resizing .fl-block-overlay-actions,.fl-builder-row-resizing .fl-block-overlay-actions{overflow:hidden}.fl-block-overlay-actions>span{display:block;float:left}.fl-block-overlay-actions i{color:#fff!important;cursor:pointer;display:block!important;float:left;font-size:16px!important;height:28px!important;line-height:28px!important;opacity:.8;filter:alpha(opacity=80);text-align:center;width:32px!important}.fl-block-overlay-actions i:hover{opacity:1;filter:alpha(opacity=100)}.fl-block-overlay-actions>i:first-child{padding-left:4px}.fl-block-overlay-actions>i:last-child{padding-right:2px}.fl-block-overlay-actions .fl-block-move{cursor:move}.fl-block-overlay-title{color:#fff!important;float:left;font-size:14px;height:30px;line-height:29px;margin-right:2px;padding:0 12px 0 8px}.fl-col-overlay,.fl-module-overlay,.fl-row-overlay{background:rgba(190,239,255,0);color:#fff}.fl-row-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:0;box-sizing:border-box!important;-moz-box-sizing:border-box!important;-webkit-box-sizing:border-box!important;left:0;position:absolute;top:-33px;right:0;z-index:100006}.fl-row-overlay.fl-row-menu-active,.fl-row-overlay.fl-row-menu-active.fl-block-overlay.fl-block-overlay-global{z-index:100007}.fl-row-full-width .fl-row-overlay{left:2px;right:2px;bottom:2px}.fl-row-overlay-header-bottom{bottom:-32px!important;top:0}.fl-row-overlay-header-bottom .fl-block-overlay-header{position:absolute;bottom:0}.fl-block-overlay-active .fl-row-content-wrap{position:relative}.fl-block-overlay-active .fl-row-content{position:relative;z-index:100007!important}.fl-builder-row-resizing .fl-col.fl-block-overlay-active,.fl-builder-row-resizing .fl-module.fl-block-overlay-active{position:static}.fl-col-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:8px;cursor:pointer;left:8px;position:absolute;right:8px;top:8px;z-index:100008}.fl-module-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:4px;cursor:pointer;left:4px;min-height:32px;position:absolute;right:4px;top:4px;z-index:100007}.fl-builder-global-templates-locked .fl-block-overlay-global.fl-module-overlay{cursor:default}.fl-module-adjust-height{padding-bottom:15px;padding-top:15px}.fl-block-overlay-global{background:rgba(255,150,0,0);border:2px solid #F7A407;border-radius:4px}.fl-block-overlay-global .fl-block-overlay-actions{background:#F7A407}.fl-block-overlay-title-global{background:#fff;color:#ff9600!important;font-size:11px;letter-spacing:1px;margin-left:4px;padding:2px 4px;vertical-align:top}.fl-block-overlay-global.fl-row-overlay{background:rgba(255,150,0,0);cursor:pointer;z-index:100007}.fl-builder-global-templates-locked .fl-block-overlay-global.fl-row-overlay{cursor:default}.fl-builder-row-template .fl-block-overlay-global.fl-row-overlay{background:rgba(255,150,0,0);cursor:default;z-index:100006}.fl-block-overlay-global.fl-row-overlay .fl-block-col-resize{display:none}.fl-block-overlay-muted .fl-row-overlay{background:rgba(85,93,102,0);border:2px solid #555D66}.fl-block-overlay-muted .fl-row-overlay .fl-block-overlay-actions{background:#555D66}.fl-block-overlay-muted .fl-row-overlay .fl-block-col-resize{display:none}.fl-node-disabled .fl-row-content-wrap,.fl-node-disabled>.fl-col-content{opacity:.3}.fl-block-col-resize{bottom:0!important;position:absolute;top:0!important;width:6px}.fl-block-col-resize-e{cursor:ew-resize;left:auto!important;right:-2px!important}.fl-block-col-resize-w{cursor:ew-resize;left:-7px!important}.fl-block-col-resize-handle-wrap{margin:-4px 0 0 -5px;padding:0 5px;position:absolute;top:50%!important}.fl-block-col-resize-e .fl-block-col-resize-handle-wrap{margin-left:-6px}.fl-block-col-resize-handle{background:#fff;border:2px solid #00A0D2;border-radius:50%;height:12px;width:12px}.fl-node-global .fl-block-col-resize-handle{border-color:#ff9600}.fl-block-col-resize-feedback{color:#333!important;display:none;font-size:11px!important;position:absolute}.fl-block-col-resize-feedback-left,.fl-block-col-resize-feedback-right{background:#fff;border:1px solid #3ba0ff;padding:2px 4px}.fl-block-col-resize-feedback-left{right:20px;top:-7px}.fl-block-col-resize-feedback-right{left:20px;top:-7px}.fl-builder-has-submenu{position:relative}.fl-builder-has-submenu>ul.fl-builder-submenu{background:#00A0D2;box-shadow:0 0 20px rgba(0,0,0,.2);border-radius:0 4px 4px;display:none;left:0;list-style:none;margin:0;padding:6px 0;position:absolute;text-align:left;top:100%;width:165px;z-index:100008}.fl-builder-has-submenu>ul.fl-builder-submenu li{list-style:none;margin:0;padding:0}.fl-builder-submenu-right ul.fl-builder-submenu{left:auto;right:0}.fl-builder-has-submenu.fl-builder-submenu-open>ul.fl-builder-submenu{display:block}.fl-builder-has-submenu>ul.fl-builder-submenu li a{border-bottom:0 none;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;color:#fff!important;display:block;line-height:13px;font-size:13px;font-weight:400;opacity:.8;filter:alpha(opacity=80);overflow:hidden;padding:6px 12px;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.fl-builder-has-submenu>ul.fl-builder-submenu li a:hover{background:#0197C6;color:#fff;opacity:1;filter:alpha(opacity=100);text-decoration:none}.fl-builder-actions-title,.fl-builder-alert-lightbox .fl-lightbox-message{color:#333!important;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px!important}.fl-builder-has-submenu .fl-builder-submenu .fa,.fl-builder-has-submenu .fl-builder-submenu .far,.fl-builder-has-submenu .fl-builder-submenu .fas{float:right;height:12px!important;line-height:12px!important;position:relative;right:-5px;width:14px!important}.fl-builder-has-submenu .fl-builder-has-submenu .fl-builder-submenu{display:none;left:100%;top:0}.fl-builder-has-submenu .fl-builder-submenu-right.fl-builder-has-submenu .fl-builder-submenu{left:auto;right:100%}.fl-builder-has-submenu .fl-builder-has-submenu:hover .fl-builder-submenu{display:block}.fl-builder-submenu-sep{padding:7px 0!important}.fl-builder-submenu-sep div{border-bottom:1px solid rgba(255,255,255,.4)}.fl-block-col-move,.fl-block-col-move-parent{cursor:move;position:relative}.fl-builder-submenu .fa-arrows-alt{cursor:move;display:none!important}.fl-builder-submenu a:hover .fa-arrows-alt{display:block!important;float:right;line-height:12px!important;height:12px!important}.fl-block-overlay-global ul.fl-builder-submenu{background:#ff9600!important}.fl-block-overlay-global ul.fl-builder-submenu li a:hover{background:#fa3}.fl-builder-actions-lightbox .fl-lightbox{display:block;width:300px;border-radius:4px}.fl-builder-actions-lightbox .fl-lightbox-content-wrap{display:block}.fl-builder-actions-lightbox .fl-builder-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:25px;text-align:center}.fl-builder-actions-title{display:block;margin-bottom:20px}.fl-builder-actions .fl-builder-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin-bottom:7px;min-height:36px}.fl-builder-alert-lightbox{padding:20px;z-index:30000000;top:0;pointer-events:auto}.fl-builder-alert-lightbox .fl-lightbox{max-width:440px;width:auto}.fl-builder-alert-lightbox .fl-lightbox-content-wrap{display:block}.fl-builder-alert-lightbox .fl-lightbox-message{line-height:24px;padding:30px}@keyframes fl-builder-content-section-entry{from{transform:translateY(150px) translateX(100px) scale(.3);opacity:0}to{transform:translateY(0) translateX(0) scale(1);opacity:1}}.fl-template-category-select{width:180px!important}.fl-template-selector .fl-builder-settings-section{margin:0 0 10px}.fl-template-selector .fl-builder-settings-fields{height:470px}.fl-template-selector .fl-builder-settings-tab{width:560px}.fl-template-selector .fl-builder-settings-tab-description{font-size:15px!important;margin:0!important;padding:10px 0 25px;text-align:center}.fl-template-preview{float:left;margin:0 25px 30px 0;position:relative;text-align:center;width:170px}.fl-template-preview.fl-last{margin-right:0}.fl-template-image{border:1px solid #d9d9d9;cursor:pointer;margin-bottom:12px;height:164px;overflow:hidden}.fl-template-image:hover{border-color:red}.fl-template-image img{max-height:none;width:100%}.fl-template-preview span{display:block;text-align:center}.fl-user-template-category-name{background:#f2f2f2;border-bottom:3px solid #dfdfdf;border-top:2px solid #dfdfdf;font-weight:700;padding:8px 15px}.fl-user-templates{border-bottom:1px solid #dfdfdf;padding:10px 0 20px}.fl-builder--user-templates-section-content{border-bottom:2px solid #e6eaed;padding:10px}.fl-builder--user-templates-section-content:first-child{padding-top:0}.fl-builder--user-templates-section-content:last-child,.fl-user-templates:last-child{border-bottom:none}.fl-builder--user-templates-section-name{font-weight:700;font-size:16px;color:#333;z-index:9999;padding:15px 10px;margin:0 10px}@keyframes fl-list-item-entry{from{opacity:0;transform:scale(.5) translateY(100px)}to{opacity:1;transform:scale(1) translateY(0)}}.fl-builder--save-new-user-template,.fl-user-template{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:4px;font-size:16px;font-weight:200;line-height:1.1;padding:10px 20px;color:#6d6d6d}.fl-user-template:hover{cursor:pointer;background:#fff;box-shadow:0 6px 20px rgba(0,0,0,.08);text-decoration:none;color:#111;padding-right:68px}.fl-user-template-name{overflow:hidden;text-overflow:ellipsis;-ms-flex:1;flex:1}.fl-user-template-actions{display:none;bottom:0;position:absolute;right:0;top:0}.fl-user-template:hover .fl-user-template-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.fl-user-template-actions a{display:inline-block;padding:15px 0;width:30px}.fl-user-template:hover a:hover i{color:#444!important}.fl-user-templates-message{display:none}.fl-user-template-thumbnail{-ms-flex:0;flex:0;margin-right:20px}.fl-user-template-thumbnail .fl-builder--template-thumbnail{background-size:cover;background-position:center top;width:45px}.fl-user-template-thumbnail .fl-builder--template-thumbnail:hover{box-shadow:none;transform:scale(1);transition-property:none}.fl-builder--save-new-user-template .fl-user-template-thumbnail .fl-builder--template-thumbnail{border-style:dashed;border-width:2px;border-color:#ccd4da}.fl-builder--save-new-user-template .fl-save-control{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex:1;flex:1}.fl-builder--save-new-user-template .fl-save-control input{background:0 0;border:none!important;-ms-flex:1;flex:1;font-size:16px;margin-right:10px;margin-left:-12px;color:#000}.fl-builder--save-new-user-template .fl-save-control input::-webkit-input-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input::-moz-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input:-ms-input-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input:-moz-placeholder{color:#777}@keyframes fl-slide-in-right{from{transform:translateX(50px)}to{transform:translateX(0)}}.fl-builder--save-new-user-template .fl-save-control button{display:none;animation-name:fl-slide-in-right;animation-duration:.25s;background-color:#00a0d2;border:none;padding:0 15px}.fl-save-control-mask{display:none;background:0 0;position:absolute;top:-50px;left:0;bottom:0;right:0;z-index:-1;min-height:80vh}.fl-builder-templates-cta{margin-bottom:20px}.fl-builder-templates-cta p{display:inline-block!important;width:75%!important;font-size:14px!important;line-height:1.5!important;margin-bottom:0!important}.fl-builder-templates-cta .fl-builder-upgrade-button{font-size:13px!important;line-height:13px!important;position:relative;top:8px;left:15px;padding:1px 12px}.fl-builder-settings-message,.fl-builder-settings-message *{font-size:15px!important;line-height:23px!important}.single-fl-builder-template .fl-content{width:100%!important}form.fl-builder-settings{height:100%;margin:0;padding:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.fl-builder-settings-message{padding:20px 25px!important;background:#f2f2f2!important}.fl-builder-preview-loader{position:relative;top:-2px;margin-left:3px}.fl-lightbox-header .fl-builder-preview-loader{margin:0;position:absolute;right:40px;top:15px}@keyframes fl-grab-attention{0%,100%{transform:scale(1)}50%{transform:scale(1.05)}}.fl-lightbox-width-slim .fl-form-table{margin:20px 25px 10px 15px!important;width:calc(100% - 60px)}.fl-lightbox-width-slim .fl-form-table th{display:block;padding:10px 0 0 12px!important}.fl-lightbox-width-slim .fl-form-table td{display:block}.fl-lightbox-width-slim .fl-form-table td:first-child{padding-left:10px!important}.fl-lightbox-width-slim .fl-form-table .fl-field[data-type=editor] td:first-child{padding-left:0!important}.fl-field-label .fl-field-responsive-toggle,.fl-lightbox-width-slim .fl-field-control-wrapper .fl-field-responsive-toggle{display:none}.fl-lightbox-width-slim .fl-field-label .fl-field-responsive-toggle{display:inline-block;padding:0 5px!important}.fl-lightbox-width-slim .fl-builder-settings-fields select{width:100%}.fl-lightbox-width-slim .fl-color-picker{display:-ms-flexbox;display:flex;width:auto}.fl-lightbox-width-slim .fl-color-picker-clear{-ms-flex:0 0 50px;flex:0 0 50px}.fl-lightbox-width-slim .mce-menubtn.mce-fixed-width button{width:28px!important}.fl-lightbox-width-slim .mce-btn[aria-label=Blockquote],.fl-lightbox-width-slim .mce-btn[aria-label=Fullscreen]{display:none}.fl-lightbox-width-slim .fl-builder-field-multiple{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;position:relative}.fl-lightbox-width-slim .fl-builder-field-multiple .fl-field-control,.fl-lightbox-width-slim .fl-builder-field-multiple .fl-field-label{width:100%!important}.fl-lightbox-width-slim .fl-builder-field-multiple .fl-builder-field-actions{position:absolute!important;top:0;right:0;width:70px}.fl-lightbox-width-slim .fl-field[data-type=time] select{width:auto}.fl-builder-settings-tabs{margin:6px;border:2px solid #e6eaed;border-radius:4px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;overflow:hidden}.fl-builder-content-group-select{padding:0 10px 6px;display:none}.fl-builder-content-group-select select{display:block;width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;padding:8px 10px;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;border:2px solid #e4e7ea;color:#161B20}select:focus{border-width:2px!important;border-style:solid!important;border-color:#00a0d2!important;outline:0!important}.fl-legacy-settings-tab{background:url(../img/ajax-loader.svg) center center no-repeat;height:100px}.fl-builder-settings-tab:first-child .fl-legacy-settings-tab{background:0 0;height:auto}body .fl-builder-settings-tabs>*{box-sizing:border-box;color:#676F7A!important;fill:#676F7A!important;background:0 0;border:2px solid transparent;border-radius:0;margin:0;outline:0;padding:6px 15px;text-decoration:none!important;font-size:14px;font-weight:400!important;-ms-flex:0 0 auto;flex:0 0 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;text-align:center}.fl-builder-settings-tabs-more g,.fl-builder-settings-tabs-more path,.fl-builder-settings-tabs-more svg,.fl-color-picker-color.fl-color-picker-empty svg.fl-color-picker-icon path{fill:inherit}body .fl-builder-settings-tabs>:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px}body .fl-builder-settings-tabs>:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}body .fl-lightbox-width-slim .fl-builder-settings-tabs>*{-ms-flex:1 1 auto;flex:1 1 auto;padding:6px 8px}body .fl-builder-settings-tabs>.fl-builder-settings-tabs-more{-ms-flex:0 0 60px;flex:0 0 60px;display:none;margin-left:auto;-ms-flex-pack:center;justify-content:center}.fl-builder-settings-tabs-more svg{width:16px;height:auto;margin:auto}body .fl-lightbox-has-tab-overflow .fl-builder-settings-tabs-more{display:-ms-flexbox;display:flex}.fl-builder-settings-tabs>:active,.fl-builder-settings-tabs>:hover{top:0;color:#333;background:0 0;border:2px solid transparent}.fl-builder-settings-tabs>:focus{top:0;outline:0;border:2px solid transparent;background:0 0;color:#0086b0;fill:#0086b0}.fl-builder-settings-tabs .fl-active,.fl-builder-settings-tabs-more.fl-contains-active,.fl-builder-settings-tabs-overflow-menu .fl-active{color:#0086b0!important;fill:#0086b0!important;position:relative;background:#e6eaed}.fl-builder-settings-tabs .fl-active.fl-overflowed,.fl-builder-settings-tabs .fl-overflowed{display:none!important}.fl-builder-settings-tabs .error{color:#d03436;padding-right:10px}.fl-builder-settings-tabs .error .fl-error-icon,.fl-builder-settings-tabs-overflow-menu .error .fl-error-icon{background:url(../img/sprite.png) -148px -5px no-repeat;display:inline-block;height:16px;margin-left:7px;position:relative;top:3px;width:16px}.fl-builder-settings-tabs-more.fl-contains-errors{fill:#d03436!important}.fl-builder-settings-tab{display:none;width:auto!important}.fl-builder-settings-tab.fl-active{display:block}.fl-builder-settings-tab-description{background:#e4e7ea;padding:10px 15px;border-radius:4px;margin:20px}.fl-builder-settings-tab-description a{text-decoration:underline!important}.fl-builder-settings-tab-description a:hover{color:#333}.fl-builder-settings-tabs-overflow-menu{display:none;position:absolute;left:0;right:0;border:2px solid #e6eaed;border-top:3px solid #00a0d2;border-radius:4px;background:#fff;z-index:9999;margin:0 6px;padding:10px;-ms-flex-direction:column;flex-direction:column;box-shadow:0 0 20px 2px rgba(0,0,0,.2)}.fl-builder-settings-tabs-overflow-menu:before{bottom:100%;right:20px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#00a0d2;border-width:10px;margin-left:-10px}.fl-builder-settings-tabs-overflow-menu>a{display:block;padding:10px 15px;font-size:14px;font-weight:600!important;border:2px solid transparent;border-radius:4px;outline:0}.fl-builder-settings-tabs-overflow-menu>a:hover{background:#e6eaed;text-decoration:none}.fl-builder-settings-tabs-overflow-click-mask{display:none;position:fixed;top:0;bottom:0;left:0;right:0;background:0 0;z-index:9}.fl-form-table{background:none;border:none;width:calc(100% - 35px)}.fl-form-table tbody{border:none}.fl-form-table tr,.fl-form-table tr:nth-child(even){background:0 0}.fl-form-table td,.fl-form-table th{background:0 0!important;border:none!important;font-weight:400!important;text-align:left!important}.fl-form-table th{padding:10px 10px 10px 30px!important;vertical-align:top!important;width:200px!important}.fl-form-table td:first-child{padding-left:30px!important}.fl-form-table th label{color:#333;width:auto;max-width:100%}.fl-photo-field .fl-photo-preview-img img,.fl-video-field .fl-video-preview-img img{max-width:60px}.fl-form-table td{padding:8px 10px}.fl-lightbox-width-slim .fl-form-table td{padding:4px 0 10px}.fl-builder-settings-fields{margin:0;overflow:hidden;position:relative;-ms-flex:1 100%;flex:1 100%;visibility:hidden}.fl-lightbox-header .fl-builder-settings-fields{height:auto;margin:0;position:absolute;right:10px;top:10px}.fl-builder-settings-fields .fl-nanoscroller-content{padding:0}.fl-builder-settings-fields .fl-field-control-wrapper{position:relative}.fl-field{animation-delay:.1s}.fl-builder-settings-fields input[type=email],.fl-builder-settings-fields input[type=file],.fl-builder-settings-fields input[type=number],.fl-builder-settings-fields input[type=password],.fl-builder-settings-fields input[type=search],.fl-builder-settings-fields input[type=tel],.fl-builder-settings-fields input[type=text],.fl-builder-settings-fields input[type=url],.fl-builder-settings-fields select,.fl-builder-settings-fields textarea{background:#fff!important;border-color:transparent!important;border-style:solid;border-width:2px;border-radius:4px!important;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);color:#333!important;display:inline;font-size:13px;height:auto;line-height:15px;margin:1px;outline:0;padding:3px 9px;width:auto;box-sizing:border-box}.fl-builder-settings-fields input[type=email],.fl-builder-settings-fields input[type=file],.fl-builder-settings-fields input[type=number],.fl-builder-settings-fields input[type=password],.fl-builder-settings-fields input[type=search],.fl-builder-settings-fields input[type=tel],.fl-builder-settings-fields input[type=text],.fl-builder-settings-fields input[type=url],.fl-builder-settings-fields select{height:36px!important}.fl-builder-settings-fields input[type=number]{width:70px}.fl-builder-lightbox .fl-builder-settings-fields input[type=email]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=file]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=number]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=password]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=search]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=tel]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=text]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=url]:focus,.fl-builder-lightbox .fl-builder-settings-fields select:focus,.fl-builder-lightbox .fl-builder-settings-fields textarea:focus{border-width:2px!important;border-style:solid!important;border-color:#00a0d2!important;box-shadow:0 2px 4px 0 rgba(0,0,0,.12)!important}.fl-builder-settings-fields ::-webkit-input-placeholder{color:#999!important;font-size:13px}.fl-builder-settings-fields input:-moz-placeholder{color:#999;font-size:13px}.fl-builder-settings-fields ::-moz-placeholder{color:#999!important;font-size:13px}.fl-builder-settings-fields input:-ms-input-placeholder{color:#999;font-size:13px}.fl-builder-settings-fields label{display:inline-block;font-weight:400;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-bottom:3px}.fl-builder-settings-fields select{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;color:#000;margin:0 0 2px;padding:2px 10px;padding-right:30px!important;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important}.fl-builder-settings-fields select[multiple]{height:60px;background-image:none!important}.fl-builder-custom-field select,.fl-photo-field select{-webkit-box-shadow:none;border-color:#e6eaed!important}.fl-font-field .fl-font-field-font{margin-bottom:4px;width:calc(70% - 5px)!important}.fl-font-field .fl-font-field-weight{width:30%!important}.fl-lightbox-width-slim input.text-full+.fl-field-description,.fl-lightbox-width-slim select+.fl-field-description{display:block;padding:8px 10px;margin:0}.fl-field[data-type=dimension] .fl-field-control-wrapper{display:-ms-flexbox;display:flex}.fl-field[data-type=dimension] .fl-field-description{padding-top:9px}.fl-field[data-type=dimension] .fl-field-responsive-toggle{padding:9px 9px 0 0}.fl-dimension-field-units{display:-ms-flexbox;display:flex}.fl-dimension-field-unit{padding-right:5px}.fl-dimension-field-unit input{max-width:60px;width:auto!important}.fl-dimension-field-unit label{padding:5px 0 0;font-size:12px;color:inherit!important;display:block;text-align:center}.fl-link-field-search input{box-shadow:none!important;width:100%!important;padding:3px 9px!important}.fl-link-field-search #as-original-link-search{width:100%}.fl-builder-settings-section{border-top:2px solid #E6EAED}.fl-builder-settings-section:first-child{border-top:none!important}.fl-custom-query .fl-builder-settings-section{border-top:2px solid #E6EAED!important}.fl-builder-settings-description{padding:0 10px 10px;margin:0;font-style:italic;opacity:.75}.fl-builder-settings-fields table{margin:20px 0}.fl-builder-settings-fields h3.fl-builder-settings-title{display:inline-block;background:#E6EAED;padding:4px 10px 4px 15px;margin:0;text-transform:uppercase!important;border-bottom-right-radius:4px;font-size:12px!important;font-weight:700;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wp-core-ui h1,.wp-core-ui h2,.wp-core-ui h3,.wp-core-ui h4,.wp-core-ui h5,.wp-core-ui h6{color:#333}.wp-core-ui .submitbox .submitdelete{color:#a00}.wp-core-ui button{font-weight:400}.wp-core-ui input[type=email],.wp-core-ui input[type=file],.wp-core-ui input[type=number],.wp-core-ui input[type=password],.wp-core-ui input[type=search],.wp-core-ui input[type=tel],.wp-core-ui input[type=text],.wp-core-ui input[type=url],.wp-core-ui select,.wp-core-ui textarea{background-color:#fff;border-color:#dfdfdf;border-style:solid;border-width:1px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;color:#333;font-weight:400}.wp-core-ui input[type=email]:focus,.wp-core-ui input[type=file]:focus,.wp-core-ui input[type=number]:focus,.wp-core-ui input[type=password]:focus,.wp-core-ui input[type=search]:focus,.wp-core-ui input[type=tel]:focus,.wp-core-ui input[type=text]:focus,.wp-core-ui input[type=url]:focus,.wp-core-ui select:focus,.wp-core-ui textarea:focus{background:0 0;border-color:#aaa}.wp-core-ui input[type=search]{background-image:none;padding:6px}.fl-field-responsive-setting{display:inline-block}.fl-field-responsive-setting-medium,.fl-field-responsive-setting-responsive{display:none}i.fl-field-responsive-toggle{color:grey;cursor:pointer;display:inline-block;font-size:15px!important;height:auto;line-height:18px!important;text-align:left;vertical-align:middle;width:20px}i.fl-field-responsive-toggle:hover{color:#000}.fl-builder-settings-fields input.text-full,.fl-builder-settings-fields textarea{width:100%}.fl-color-picker{cursor:pointer}.fl-color-picker .fl-color-picker-clear{box-sizing:border-box}.fl-color-picker .fl-color-picker-clear:hover{background-color:#ededed}.colorpicker input{padding:0!important;font-size:11px!important;color:#fff!important;width:29px!important;height:auto!important;background:0 0!important;border:none!important}.colorpicker .colorpicker_hex input{width:45px!important}.fl-builder-custom-field{background:#fff;border:2px solid transparent;border-radius:4px;padding:7px 10px;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);min-height:36px;box-sizing:border-box}.fl-builder-field-multiple .fl-builder-custom-field{cursor:move}.fl-builder-custom-field a{color:#21759b!important;text-decoration:underline!important}.fl-builder-custom-field a:hover{color:#d54e21!important}.fl-builder-custom-field label.error{margin-top:5px}.fl-photo-field .fl-photo-preview{display:-ms-flexbox;display:flex}.fl-photo-field .fl-photo-select,.fl-photo-field.fl-photo-empty .fl-photo-preview{display:none}.fl-photo-field.fl-photo-empty .fl-photo-select{display:block}.fl-photo-field .fl-photo-preview-img{line-height:0;margin:5px 0}.fl-photo-field .fl-photo-preview select{margin:8px 0 8px 10px;width:200px}.fl-photo-field.fl-photo-no-attachment .fl-photo-preview select{display:none}.fl-photo-field .fl-photo-preview-filename{display:none;font-size:14px;font-weight:700;margin:7px 0 5px 11px}.fl-photo-field.fl-photo-no-attachment .fl-photo-preview-filename{display:inline-block;word-break:break-all}.fl-multiple-photos-field .fl-multiple-photos-select,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-add,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-count,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-edit,.fl-multiple-photos-lightbox .gallery-settings,.fl-photo-field.fl-photo-no-attachment .fl-photo-edit{display:none}.fl-photo-field .fl-photo-edit{margin:0 0 0 11px}.fl-multiple-photos-field .fl-multiple-photos-add,.fl-photo-field .fl-photo-remove,.fl-photo-field .fl-photo-replace{margin:0 0 0 8px}.fl-builder-edit .media-modal{z-index:9999991}.fl-builder-edit .media-modal-backdrop{z-index:999999}.fl-builder-edit .media-frame{-webkit-backface-visibility:hidden}.fl-builder-edit .media-modal-content h1{font-family:inherit}.fl-builder-edit .media-modal-content .thumbnail{padding:0;border:none;border-radius:0}.fl-builder-edit button.button-link.media-modal-close{position:absolute;box-shadow:none;-webkit-box-shadow:none}.fl-builder-edit .media-frame.hide-menu{visibility:visible}span.select2-container.select2-container--open{z-index:9999999}.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-select{display:inline}.fl-multiple-photos-count{font-weight:700;margin-bottom:3px}.fl-video-field .fl-video-select,.fl-video-field.fl-video-empty .fl-video-preview{display:none}.fl-video-field.fl-video-empty .fl-video-select{display:block}.fl-video-field .fl-video-preview-img{float:left;line-height:0;margin:5px 0}.fl-video-field .fl-video-preview-img .dashicons.dashicons-media-video{display:block;font-size:60px;height:60px;line-height:60px;width:60px}.fl-video-field .fl-video-preview-filename{display:inline-block;font-size:14px;font-weight:700;margin:7px 0 5px 11px}.fl-video-field .fl-video-remove,.fl-video-field .fl-video-replace{margin:0 0 0 11px}.fl-multiple-audios-field .fl-multiple-audios-select,.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-add,.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-edit{display:none}.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-select{display:block}.fl-multiple-audios-field .fl-multiple-audios-add{margin:0 0 0 8px}.fl-icon-field .fl-icon-select,.fl-icon-field.fl-icon-empty .fl-icon-preview{display:none}.fl-icon-field.fl-icon-empty .fl-icon-select{display:block}.fl-icon-field .fl-icon-preview i{display:inline-block;font-size:28px;margin:10px 10px 9px;vertical-align:middle}.fl-icon-field .fl-icon-remove{margin:0 0 0 8px}.fl-builder-hidden-editor{display:none}.fl-builder-settings .wp-switch-editor{background:#ebebeb;border:1px solid #e5e5e5;border-radius:0;color:#333}.fl-builder-settings .wp-editor-container{border:1px solid #e5e5e5}.fl-builder-settings .mce-toolbar .mce-btn-group .mce-btn{margin:2px 0}.fl-builder-settings .mce-menubtn.mce-fixed-width button{width:100px}.fl-builder-settings .mce-menubtn.mce-fixed-width span{width:100%}.mce-close:active,.mce-close:hover,.mce-toolbar .mce-btn button:active,.mce-toolbar .mce-btn button:hover,.mce-window .mce-btn button:active,.mce-window .mce-btn button:hover{background:0 0;border:none}.mce-ico{font-family:tinymce,Arial!important}.mce-toolbar i.mce-ico{font:400 20px/1 dashicons!important}.fl-builder-edit form#wp-link,.popover[class*=tour-],ul.as-list{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.wp-core-ui .quicktags-toolbar input.button.button-small{margin:1px!important}.wp-editor-container textarea.wp-editor-area{background:0 0;border:none;padding:10px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.fl-builder-edit form#wp-link{color:#000;font-size:13px}.fl-builder-edit form#wp-link #link-options label{display:block;margin-bottom:2px}.fl-builder-edit form#wp-link #link-options label span{padding-right:10px;vertical-align:middle}.fl-builder-edit form#wp-link #link-options input[type=text]{display:inline-block;height:auto;margin:5px 0 0;padding:3px 5px;width:80%}.fl-builder-edit form#wp-link .query-results{top:225px}.fl-code-field{border:1px solid #E6E6E6;border-left:none}.ace_editor,.ace_editor *{font-family:Monaco,Menlo,"Ubuntu Mono","Droid Sans Mono",Consolas,monospace!important;font-size:12px!important;font-weight:400!important;letter-spacing:0!important}.fl-layout-field-option{border:2px solid #d9d9d9;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;box-sizing:border-box!important;-moz-box-sizing:border-box!important;-webkit-box-sizing:border-box!important;cursor:pointer;float:left;line-height:0;max-width:23%;margin:0 1% 2%;padding:5px}.fl-layout-field-option-selected,.fl-layout-field-option:hover{border-color:red}.fl-layout-field-option img{max-width:100%}.fl-link-field .fl-link-field-input-wrap{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-link-field-input{width:auto!important;-ms-flex:1 1 100%;flex:1 1 100%}.fl-link-field .fl-link-field-input-wrap button{-ms-flex:0 0 0%;flex:0 0 0%;margin-left:5px}.fl-link-field-search{display:none;border:2px solid #e6eaed;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;margin:4px 0 0;padding:10px}.fl-link-field-search-title{display:block;margin:0 0 3px 2px}.fl-link-field-search-cancel{margin-top:6px}.fl-help-tooltip{display:inline-block;position:relative}.fl-help-tooltip-icon{color:#999!important;cursor:pointer;font-size:15px!important;padding:5px;vertical-align:middle}.fl-help-tooltip-text{background:#fff;border:1px solid #ccc;box-shadow:0 0 5px #ccc;-moz-box-shadow:0 0 5px #ccc;-webkit-box-shadow:0 0 5px #ccc;display:none;font-weight:400;left:23px;padding:10px 13px;position:absolute;top:-6px;width:250px;z-index:1000;border-radius:4px}.fl-lightbox-width-slim .fl-help-tooltip-text{top:26px;left:-30px}.fl-field-control .fl-form-field{margin-bottom:0}.fl-form-field-preview-text i{display:inline-block;font-size:18px;line-height:22px;margin-bottom:5px}.fl-builder-field-actions{padding-left:0!important;padding-right:0!important;text-align:center;width:85px}.fl-builder-field-actions i{color:#999!important;cursor:pointer;font-size:13px!important;line-height:29px!important;width:16px}.fl-builder-field-actions i:hover{color:#000!important}.fl-builder-field-actions i.fl-builder-field-copy,.fl-builder-field-actions i.fl-builder-field-delete{margin-left:5px}.fl-builder-field-actions i.fl-builder-field-move{cursor:move}.fl-builder-field-dd-helper{background:#ccc;height:30px!important;float:left;width:130px!important}.fl-builder-field-dd-zone{border:1px dashed #ccc;height:30px}.fl-builder-field-actions-single .fl-builder-field-delete,.fl-builder-field-actions-single .fl-builder-field-move{display:none!important}.fl-lightbox-width-slim .fl-builder-field-actions-single .fl-builder-field-copy{float:right!important}.fl-builder-field-multiple .fl-builder-field-actions,.fl-builder-field-multiple .fl-field-control,.fl-builder-field-multiple .fl-field-label{padding-top:2px!important;padding-bottom:2px!important}.fl-builder-field-multiple .fl-builder-field-actions{min-width:70px!important}.fl-builder-field-multiple[data-field=icons] .fl-builder-field-actions{width:70px!important}.fl-builder-field-multiple.ui-sortable-helper .fl-field-control{width:60%}.fl-builder-field-multiple.ui-sortable-helper .fl-builder-field-actions{display:none}.fl-builder-widget-settings input{display:inline-block!important;margin:5px 10px 8px!important}.fl-builder-lightbox-loading{background:url(../img/ajax-loader.svg) center center no-repeat;height:100px}.fl-builder-settings .error,.fl-builder-settings input.error{color:#d03436!important}.fl-builder-settings label.error,.fl-builder-settings p.error{color:#d03436;display:block;margin-top:5px}.fl-builder-settings .fl-form-table .fl-field-description{color:#464646;font-style:normal;margin-left:2px}.fl-lightbox .fl-field-connection{right:-1px}.fl-lightbox .fl-field-connection-content{border:2px solid transparent!important;background:#e4e7ea!important}.fl-field-connection-content .fl-field-connection-label{color:#676f7a!important}ul.as-selections{background-color:#fff;border:none;border-radius:4px;box-shadow:none;color:#333;font-size:12px;height:auto;line-height:15px;margin:1px;outline:0;padding:3px;width:auto}ul.as-selections.loading{background:url(../img/ajax-loader-small.svg) 98% center no-repeat}ul.as-selections li.as-selection-item{background:#d4eaf6;border:none;font-size:11px;line-height:14px;padding:8px 15px;border-radius:4px;margin:2px}ul.as-selections li.as-selection-item.blur{background:#f4f4f4}ul.as-selections li.as-selection-item a.as-close{line-height:12px}ul.as-selections li.as-original{margin:0}ul.as-selections li.as-original input{height:auto;font-size:12px;margin:0;padding:0;box-shadow:none}ul.as-list{margin:0;font-size:13px;color:#000;background-color:#fff;background-color:rgba(255,255,255,.95);z-index:2;box-shadow:0 0 10px rgba(0,0,0,.1);border:none;border:1px solid #dfdfdf;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}li.as-message,li.as-result-item{border:none}li.as-result-item.active{background:#e5e5e5;border-radius:0;color:#333;text-shadow:none}li.as-result-item em{background:0 0!important;color:#333!important;font-size:12px;padding:0!important;font-weight:700}.fl-custom-query-filter{display:none}.fl-custom-query .fl-field[data-type=suggest] select{margin-bottom:5px;width:100%}.fl-builder-service-settings{position:relative}.fl-builder-service-error{color:red!important;padding:15px 0 0}.fl-builder-service-account-delete{color:red!important;margin-left:10px;position:relative;top:2px}#fl-field-visibility_user_capability .fl-field-description,.fl-builder-service-connect-row .fl-field-description{background:#f0f0f0;color:#333!important;display:block;float:none;margin:10px 0 0;padding:10px}#fl-field-visibility_user_capability .fl-field-description a,.fl-builder-service-connect-row .fl-field-description a{color:#21759b!important;text-decoration:underline!important}.fl-ordering-field-option{background:#fff;border:1px solid #dfdfdf;border-radius:3px;cursor:move;margin-bottom:5px;padding:5px 10px}.fl-ordering-field-option .fa{color:#ccc;float:right;line-height:16px}#tiptip_holder{z-index:1000000}#tiptip_holder.tip_top #tiptip_arrow_inner{border-top-color:#333}#tiptip_holder.tip_bottom #tiptip_arrow_inner{border-bottom-color:#333}#tiptip_holder.tip_right #tiptip_arrow_inner{border-right-color:#333}#tiptip_holder.tip_left #tiptip_arrow_inner{border-left-color:#333}#tiptip_content{background:#333;box-shadow:none}.fl-builder-getting-started-video{line-height:0!important;padding:10px}.fl-builder-getting-started-video iframe{border:none;height:326px;width:100%}.fl-builder-tour-actions .fl-builder-actions-title{font-size:14px!important;line-height:19px}.fl-builder-tour-mask{bottom:0;left:0;position:fixed;right:0;top:0;z-index:100000000}.fl-builder-tour-dimmed{background:rgba(0,0,0,.7);bottom:0;left:0;position:absolute;right:0;top:0}body>.fl-builder-tour-dimmed{position:fixed}.tour-backdrop{z-index:110000}.popover[class*=tour-]{border:1px solid #ccc;border-radius:0;box-shadow:0 0 40px rgba(0,0,0,.3);color:#666;font-size:13px;font-weight:400;line-height:18px;max-width:none;padding:0;width:300px;z-index:100000001}.popover[class*=tour-].bottom>.arrow{border-bottom-color:#ccc}.popover[class*=tour-].bottom>.arrow:after{border-bottom-color:#f7f7f7}.popover[class*=tour-] .popover-title{border-radius:0;color:#333;letter-spacing:normal;text-transform:none}.popover[class*=tour-] .fa-times{color:#b3b3b3;cursor:pointer;font-size:16px;padding:5px;position:absolute;right:3px;top:2px}.popover[class*=tour-] .fa-times:hover{color:#666}.popover[class*=tour-] .popover-content{border-bottom:1px solid #d9d9d9;padding:13px 15px}.popover[class*=tour-] .fl-builder-tour-next{display:block;float:none;width:100%}.popover-navigation button{min-height:36px}.fl-builder-shortcode-mask-wrap{position:relative}.fl-builder-shortcode-mask{bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fl-builder--search{border:2px solid transparent;position:relative;padding:0;width:54px;transition-property:width;transition-delay:.1s;transition-duration:.15s}.fl-builder--search.is-expanded{border:2px solid #00A0D0}.fl-builder--search input[type=text],.fl-builder--search input[type=text]:focus{background-color:transparent;border:none!important;box-sizing:border-box;width:100%;font-size:16px;text-align:center}.fl-builder--search:before{display:-ms-flexbox;display:flex;top:0;left:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;content:"\f002";font:normal normal normal 14px/1 Font Awesome\ 5 Free;text-align:center;width:100%;height:100%;position:absolute;pointer-events:none;color:rgba(128,128,128,.6);font-size:17px;opacity:1;transition-property:opacity;transition-duration:.15s}.fl-builder--main-menu-panel,.fl-builder-ui-keyboard-shortcuts{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important}.fl-builder--search.has-text:before,.fl-builder--search.is-expanded:before{opacity:0}.fl-builder--search input::-webkit-input-placeholder{color:rgba(128,128,128,0)!important;transition:color .25s}.fl-builder--search input:focus::-webkit-input-placeholder{color:rgba(128,128,128,.4)!important}.fl-builder--search .search-label{cursor:text}.fl-builder--search .search-clear{display:none;padding:10px 10px 10px 30px;color:#a7a7a7;font-size:12px;position:absolute;right:0;top:0;background-color:#eff1f2;background:linear-gradient(to left,#e4e7ea,#e4e7ea 75%,rgba(228,231,234,0))}.fl-builder--search.has-text .search-clear,.fl-builder--search.is-expanded input{display:inline-block}.fl-builder--search:hover .search-clear{color:#888;background-color:#eff1f2;background:linear-gradient(to left,#dadfe5,#dadfe5 75%,rgba(218,223,229,0))}.fl-builder--search.is-expanded{width:246px}@keyframes fl-builder-show-menu-item{from{transform:translateY(10px) scale(.8);opacity:0}to{transform:translateX(0) translateY(0) scale(1);opacity:1}}.fl-builder--main-menu-panel{display:none;box-sizing:border-box;position:fixed;top:calc(48px + 10px);left:10px;width:360px;color:#222;max-height:calc(100% - 66px);border-radius:4px;background:#fff;border:2px solid #D5DADD;border-top:3px solid #00a0d2;box-shadow:0 15px 45px 8px rgba(0,0,0,.04);font-size:14px!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10000009;pointer-events:auto}.fl-builder--main-menu-panel.is-showing{display:-ms-flexbox;display:flex}.fl-builder--main-menu-panel:before,.fl-theme-builder-preview-select-open .fl-theme-builder-preview-select-items:before{bottom:100%;right:6px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#00a0d2;border-width:13px;margin-left:-13px}.fl-builder--main-menu-panel-views{-ms-flex:1 1 100%;flex:1 1 100%;overflow:auto}.fl-builder--main-menu-panel-mask{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000119}.fl-builder--main-menu-panel .fl-builder--tabs{padding-left:20px;padding-top:15px}.fl-builder--main-menu-panel-view{display:none}.fl-builder--main-menu-panel-view.is-showing{display:block}.fl-builder--main-menu-panel-view-title{font-size:24px;font-weight:600;padding:25px 22px 0;line-height:1;white-space:nowrap}.fl-builder--main-menu-panel-view-title .title-accessory{float:right;color:#b1b1b1}.fl-builder--main-menu-panel-view-title .title-accessory>i{font-size:20px!important;width:25px!important}.fl-builder--main-menu-panel-view-title .title-accessory>i:hover{color:#222}.fl-builder--main-menu-panel-view-title .pop-view{padding:10px;margin-left:-10px;opacity:.5;font-size:25px;font-weight:400;cursor:pointer;background:0 0;outline:0;border:none;color:inherit}.fl-builder--main-menu-panel-view-title .pop-view:focus{outline:0;top:0;background:#E5EAED!important}.fl-builder--menu-item:before{display:block;content:"";float:none;clear:both}.fl-builder--menu-item{color:inherit;text-align:left;box-sizing:border-box;display:block;padding:10px 15px;margin:0 10px;width:calc(100% - 20px);background:0 0;border:none;border-radius:4px;font-size:14px;line-height:1.1;cursor:pointer;opacity:1}.fl-builder--menu-item:hover{background:#eaf1f8;border:none;text-decoration:none;color:#000}.fl-builder--selector-menu .fl-builder--menu-item:hover{background:#fff}.fl-builder--menu-item-accessory{float:right;text-align:center;display:inline-block;min-width:40px;font-size:14px}.fl-builder--menu-item-accessory.view-arrow{font-size:18px}.fl-builder--menu{padding:0;margin:20px 0}.fl-builder--menu hr{margin:8px 0;background-color:#e6eaed!important;height:2px;border:none}.fl-builder--menu .fl-builder-video-wrap{padding:0 10px 10px}.fl-revision-list-item{display:-ms-flexbox;display:flex}.fl-revision-list-item-text{padding-left:15px}.fl-revision-list-item-date{padding-bottom:5px}.fl-builder--revision-actions{display:none;position:fixed;top:4px;left:4px;z-index:100008;padding:4px 4px 6px;-ms-flex-pack:center;justify-content:center;background:#fff;border-radius:4px}.fl-builder--revision-actions *{margin-right:5px}.fl-builder--revision-actions :last-child{margin:0}.fl-builder--menu-item[data-event=noRevisionsMessage]:hover{background:0 0;box-shadow:none;cursor:default}.fl-no-revisions-message-title{font-weight:700;margin-bottom:10px}.fl-no-revisions-message-text{line-height:22px}.fl-builder-module-placeholder-message{border:1px dashed #ccc;overflow:hidden;padding:20px;text-align:center;text-overflow:ellipsis;white-space:nowrap}.fl-field-connections-menu{z-index:999999}.fl-field-connections-toggle{right:-30px!important}.fl-builder-add-ultimate-presets-button,.fl-builder-add-ultimate-rows-button,.fl-builder-pp-add-template-button,.pp-preview-button,.uabb-live-preview-button{display:none!important}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;background:0 0;transition-property:background;transition-duration:.15s}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-ne,.ui-resizable-nw,.ui-resizable-se,.ui-resizable-sw{width:12px;height:12px}.ui-resizable-se{cursor:se-resize;right:-4px;bottom:-4px}.ui-resizable-sw{cursor:sw-resize;left:-4px;bottom:-4px}.ui-resizable-nw{cursor:nw-resize;left:-4px;top:-4px}.ui-resizable-ne{cursor:ne-resize;right:-4px;top:-4px}.fl-builder-resizable-iframe-fix{position:absolute;top:0;right:0;bottom:0;left:0;z-index:100000000}.fl-builder-panel .ui-resizable-handle:active,.fl-builder-panel .ui-resizable-handle:hover,.fl-lightbox .ui-resizable-handle:active,.fl-lightbox .ui-resizable-handle:hover{background:#00a0d2}.fl-builder-panel .ui-resizable-n,.fl-builder-panel .ui-resizable-s,.fl-lightbox .ui-resizable-n,.fl-lightbox .ui-resizable-s{height:6px}.fl-builder-panel .ui-resizable-n,.fl-lightbox .ui-resizable-n{top:-3px}.fl-builder-panel .ui-resizable-s,.fl-lightbox .ui-resizable-s{bottom:-3px}.fl-builder-panel .ui-resizable-e,.fl-builder-panel .ui-resizable-w,.fl-lightbox .ui-resizable-e,.fl-lightbox .ui-resizable-w{width:6px}.fl-builder-panel .ui-resizable-e,.fl-lightbox .ui-resizable-e{right:-3px}.fl-builder-panel .ui-resizable-w,.fl-lightbox .ui-resizable-w{left:-3px}.fl-lightbox .ui-resizable-ne,.fl-lightbox .ui-resizable-nw,.fl-lightbox .ui-resizable-se,.fl-lightbox .ui-resizable-sw{background:0 0;border:6px solid transparent}.fl-lightbox .ui-resizable-ne:active,.fl-lightbox .ui-resizable-ne:hover,.fl-lightbox .ui-resizable-nw:active,.fl-lightbox .ui-resizable-nw:hover,.fl-lightbox .ui-resizable-se:active,.fl-lightbox .ui-resizable-se:hover,.fl-lightbox .ui-resizable-sw:active,.fl-lightbox .ui-resizable-sw:hover{background:0 0;border-color:#00a0d2}.fl-lightbox .ui-resizable-ne{border-bottom:none;border-left:none;border-top-right-radius:4px}.fl-lightbox .ui-resizable-nw{border-bottom:none;border-right:none;border-top-left-radius:4px}.fl-lightbox .ui-resizable-se{border-top:none;border-left:none;border-bottom-right-radius:4px}.fl-lightbox .ui-resizable-sw{border-top:none;border-right:none;border-bottom-left-radius:4px}.fl-builder-ui-keyboard-shortcuts{display:none;position:fixed;top:0;left:0;bottom:0;right:0;z-index:999999;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;background:rgba(50,50,50,.88);font-size:15px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fl-builder-ui-keyboard-shortcuts.is-showing{display:-ms-flexbox;display:flex}.fl-builder-ui-keyboard-shortcuts-content{box-sizing:border-box;width:500px;background:#f5f7f9;border-radius:4px;padding:30px 0 0;box-shadow:0 10px 30px rgba(0,0,0,.15)}.fl-builder-ui-keyboard-shortcut-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:12px 40px}.fl-builder-ui-keyboard-shortcut-item:nth-child(even){background:#eef2f5}.fl-builder-ui-shortcut-keycode{margin-left:auto;text-transform:uppercase;letter-spacing:2px}.fl-builder-ui-keyboard-shortcust-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;padding:10px}.dismiss-shortcut-ui{padding:10px;border-radius:4px;background:#fff;color:#000;font-size:14px;border:2px solid #fff}.dismiss-shortcut-ui:focus,.dismiss-shortcut-ui:hover{top:0;color:#000;background:#eef2f5;border:2px solid #eef2f5}.fl-color-picker-ui{width:300px}.fl-color-picker-ui.fl-color-alpha-enabled{width:238px}.fl-color-picker-ui .iris-picker{float:left;width:100%;height:224px;display:block;position:relative;border-top:1px solid rgba(0,0,0,.1)}.fl-color-picker-ui .iris-picker .iris-square-inner,.fl-color-picker-ui .iris-picker-inner{position:absolute;left:0;top:0;bottom:0;right:0}.fl-color-picker-ui .iris-picker,.iris-picker *{box-sizing:content-box}.fl-color-picker-ui .iris-error{background-color:#ffafaf}.fl-color-picker-ui .iris-picker .iris-square{width:300px;height:200px}.fl-color-picker-ui .iris-picker .iris-palette,.fl-color-picker-ui .iris-picker .iris-slider,.fl-color-picker-ui .iris-picker .iris-square-inner{height:100%;width:12.5%}.fl-color-picker-ui .iris-picker .iris-placeholder,.fl-color-picker-ui .iris-picker .iris-square{position:relative}.fl-color-picker-ui .iris-picker .iris-square-inner{width:auto;margin:0}.fl-color-picker-ui .iris-ie-9 .iris-palette,.fl-color-picker-ui .iris-ie-9 .iris-slider,.fl-color-picker-ui .iris-ie-9 .iris-square,.fl-color-picker-ui .iris-ie-9 .iris-square-inner{box-shadow:none;border-radius:0}.fl-color-picker-ui .iris-ie-9 .iris-palette,.fl-color-picker-ui .iris-ie-9 .iris-slider,.fl-color-picker-ui .iris-ie-9 .iris-square{outline:rgba(0,0,0,.1) solid 1px}.fl-color-picker-ui .iris-ie-lt9 .iris-palette,.fl-color-picker-ui .iris-ie-lt9 .iris-slider,.fl-color-picker-ui .iris-ie-lt9 .iris-square,.fl-color-picker-ui .iris-ie-lt9 .iris-square-inner{outline:#999 solid 1px}.fl-color-picker-ui .iris-ie-lt9 .iris-square .ui-slider-handle{outline:#999 solid 1px;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.fl-color-picker-ui .iris-ie-lt9 .iris-square .iris-square-handle{background:0 0;border:3px solid #fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.fl-color-picker-ui .iris-picker .iris-strip{box-sizing:border-box;width:calc(300px - 12px);margin:5px 6px 6px;border-radius:4px;position:relative;height:22px;transform:rotate(180deg)}.fl-color-picker-ui .iris-picker .iris-strip .ui-slider-handle{width:6px;position:absolute;right:0;top:-2px;bottom:-2px;margin:0;border-radius:3px;background:#fff;box-shadow:0 0 2px rgba(0,0,0,.5);z-index:5;cursor:ew-resize}.fl-color-picker-ui .iris-picker .iris-strip .ui-slider-handle:focus{outline:#00a0d2 solid 2px}.fl-color-picker-ui .iris-picker .iris-slider-offset{position:absolute;top:0;left:6px;right:0;bottom:0;width:auto;height:auto;background:0 0;border:none;border-radius:0;transform:rotate(180deg)}.fl-color-picker-ui .iris-picker .iris-square-handle{background:0 0;border:5px solid #999;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.fl-color-picker-ui .iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.fl-color-picker-ui .iris-picker .iris-square-handle:hover{border-color:#999}.fl-color-picker-ui .iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.fl-color-picker-ui .iris-picker .iris-square-handle:hover::after{border-color:#fff}.fl-color-picker-ui .iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.fl-color-picker-ui .iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.fl-color-picker-wrapper{position:relative;width:48px;height:32px}.fl-color-picker{box-shadow:0 2px 4px 0 rgba(0,0,0,.12);background:#fff;border-radius:4px;width:120px;height:36px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-color-picker-color{-ms-flex:1 1 100%;flex:1 1 100%;box-sizing:border-box!important;position:relative;border-radius:4px;background-color:transparent;cursor:pointer;border:2px solid transparent;border-right:2px solid rgba(0,0,0,.1);padding:0;-ms-flex-pack:center;justify-content:center;display:-ms-flexbox;display:flex}.fl-color-picker-clear:hover,.fl-color-picker-color:hover{background:0 0;border:2px solid transparent}.fl-color-picker-clear:focus,.fl-color-picker-color.fl-color-picker-empty:focus,.fl-color-picker-color:focus{outline:0;top:0;border:2px solid #00a0d2;background:0 0}.fl-color-picker.fl-color-picker-has-reset .fl-color-picker-color:not(.fl-color-picker-empty){border-top-right-radius:0;border-bottom-right-radius:0}.fl-color-picker-icon{display:none;margin:auto}.fl-color-picker-color.fl-color-picker-empty{border-color:transparent}.fl-color-picker-color.fl-color-picker-empty svg.fl-color-picker-icon{display:block}.fl-color-picker-clear{box-sizing:border-box;position:relative;display:-ms-flexbox;display:flex;-ms-flex:0 0 36px;flex:0 0 36px;-ms-flex-pack:center;justify-content:center;padding:0;border:2px solid transparent;border-top-right-radius:4px;border-bottom-right-radius:4px;background-color:#fff;cursor:pointer}.fl-color-picker-color.fl-color-picker-empty+.fl-color-picker-clear{display:none}.fl-color-picker-ui{display:inline-block;font-family:Helvetica,Verdana,sans-serif;z-index:999999;position:fixed;overflow:hidden;padding-bottom:45px;border:1px solid rgba(0,0,0,.1);color:#999;background-color:#FAFAFA;border-radius:3px;box-shadow:0 9px 20px rgba(0,0,0,.17);transition:opacity .2s,visibility .2s;visibility:hidden;opacity:0;-webkit-transform:translate3d(0,0,0)}.fl-color-picker-ui.fl-color-picker-active{visibility:visible;opacity:1}.fl-color-picker-ui .fl-color-picker-input,.fl-color-picker-ui .fl-color-picker-input:focus{width:100%;height:30px;border:none!important;font-size:14px!important;padding:0 8px;vertical-align:middle;color:#656c6e;background-color:#fff;border-radius:0;box-shadow:none}.fl-color-picker-ui .iris-square-value{transition:none}.fl-color-picker-preset-add{position:absolute;top:8px;right:8px;width:14px;height:14px;background-color:#656c6e;border-radius:50%;cursor:pointer;transition:all .2s}.fl-color-picker-preset-add:hover{background-color:#333}.fl-color-picker-preset-add:after,.fl-color-picker-preset-add:before{content:'';display:block;position:relative;background-color:#fff}.fl-color-picker-preset-add:before{top:6px;left:3px;width:8px;height:2px}.fl-color-picker-preset-add:after{left:6px;top:1px;width:2px;height:8px}.fl-color-picker-presets{position:absolute;left:0;bottom:0;width:100%;z-index:15;overflow:auto;border-top:1px solid rgba(0,0,0,.1);background-color:#FAFAFA}.fl-color-picker-presets-list .fl-color-picker-preset:hover,.fl-color-picker-presets-toggle:hover{background-color:#EDEDED}.fl-color-picker-presets-toggle{position:relative;overflow:hidden;width:100%;height:35px;text-align:center;line-height:35px;font-size:12px;font-weight:700;cursor:pointer;transition:all .1s}.fl-color-picker-presets-close-label,.fl-color-picker-presets-open-label{position:absolute;top:50%;left:50%;visibility:hidden;color:#999;transition:all .5s;transform:translate(-50%,-50%);opacity:0;width:100%}.fl-color-picker-presets-close-label.fl-color-picker-active,.fl-color-picker-presets-open-label.fl-color-picker-active{color:#656c6e;visibility:visible;opacity:1}.fl-color-picker-presets-list{width:100%;list-style:none;margin:0;padding:0;overflow:auto}.fl-color-picker-presets-list .fl-color-picker-no-preset,.fl-color-picker-presets-list .fl-color-picker-preset{position:relative;padding:5px;font-size:12px;border-top:1px solid rgba(0,0,0,.1);transition:all .1s}.fl-color-picker-presets-list .fl-color-picker-no-preset{padding:18px 5px;text-align:center}.fl-color-picker-presets-list .fl-color-picker-preset-color{display:inline-block;width:40px;height:20px;margin-right:3px;vertical-align:middle;border:1px solid rgba(0,0,0,.1);border-radius:2px;cursor:pointer}.fl-color-picker-presets-list .fl-color-picker-preset-label{vertical-align:middle;color:#333;cursor:pointer}.fl-color-picker-presets-list .fl-color-picker-preset-remove{position:absolute;top:50%;cursor:pointer;transform:translateY(-50%)}.fl-color-picker-clear .fl-color-picker-icon-remove{right:auto;top:auto;margin:auto}.fl-color-picker-presets-list .fl-color-picker-preset-remove{right:5px}.fl-color-picker-presets-list .fl-color-picker-preset-remove:hover:after,.fl-color-picker-presets-list .fl-color-picker-preset-remove:hover:before{background-color:#333}.fl-color-picker-added{position:absolute;width:100%;top:0;left:0;right:0;bottom:35px;z-index:10;color:#fff;text-align:center;background-color:rgba(0,0,0,.8)}.fl-color-picker-added-text{position:absolute;top:50%;left:50%;width:80%;font-size:14px;color:#fff!important;transform:translate(-50%,-50%)}.fl-color-picker-icon-check{position:relative;width:50px;height:50px;margin:5px auto}.fl-color-picker-icon-check:before{content:'';display:block;position:relative;width:15px;height:30px;margin-left:14px;border:7px solid #fff;border-left:none;border-top:none;transform:rotate(45deg)}.fl-color-picker-icon-arrow-down,.fl-color-picker-icon-arrow-up{display:inline-block;position:relative;width:10px;height:10px;margin-left:5px}.fl-color-picker-icon-arrow-down:before,.fl-color-picker-icon-arrow-up:before{content:'';display:block;position:relative;width:6px;height:6px;border:2px solid #999;border-left:none;border-top:none;transform:rotate(45deg)}.fl-color-picker-icon-arrow-up{top:2px;transform:rotate(180deg)}.fl-color-picker-icon-remove{width:15px;height:15px}.fl-color-picker-icon-remove:after,.fl-color-picker-icon-remove:before{content:'';display:block;position:relative;background-color:#6f7881}.fl-color-picker-icon-remove:before{left:6px;width:2px;height:10px;margin-top:3px;transform:rotate(-45deg)}.fl-color-picker-icon-remove:after{left:6px;width:2px;height:10px;margin-top:-10px;transform:rotate(45deg)}.fl-alpha-wrap{position:absolute;width:35px;height:215px;padding:0 5px;right:4px;border-top:none}.fl-alpha-slider{height:190px;position:absolute;top:12px;width:28px}.fl-alpha-slider .ui-slider-handle{background:rgba(0,0,0,0);border-color:#aaa;border-radius:4px;border-style:solid;border-width:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);-moz-box-shadow:0 1px 2px rgba(0,0,0,.2);-webkit-box-shadow:0 1px 2px rgba(0,0,0,.2);cursor:ns-resize;height:12px;left:0;opacity:.9;position:absolute;right:0;width:30px;z-index:14}.fl-alpha-slider .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.fl-alpha-slider-offset{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAASCAYAAAAe/ZHXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NkNEQUQ0ODM4RUE0MTFFNEExOEJFN0E5M0VFOTg0QUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NkNEQUQ0ODQ4RUE0MTFFNEExOEJFN0E5M0VFOTg0QUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo2Q0RBRDQ4MThFQTQxMUU0QTE4QkU3QTkzRUU5ODRBRCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo2Q0RBRDQ4MjhFQTQxMUU0QTE4QkU3QTkzRUU5ODRBRCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/r/N8AAAWYSURBVHjarFvvR3VBEN45JZGIPkREHyIiIhJJf3qUSERE9CGiDxERkcg9z9u92uucvTszz5z7xnHPj93Z2d359cxscn5+jpTS+EoiMr3/+51cZ2dn4+e29i2/u7y8RKf/pO3vc+o+n5ycoNK31+f6+jrfZ37yuG2mf3R01H3fa5N/b29vU6dP5qft0G4PDg5MGuPr/v4+jz1t27mfvN/b21P75+fHx8eZfiV/Ozs7rUJnSu/5+RlFv+m6ZJpbW1s1PnrvXl9fZ/qX89zY2LB4mfy+v7/nsdV1XltbK/dr5vnz87OcV5bJabuVlRVLBifjfX9/l/xkGtM+S0tLNXnu0szfU/P3IMn/k0678h6ddqjQFGccVL6hoCsVfsq+NZ5QtCv5rfFS41sq37W+UPhMyhxEWTetvce3NR8oewqD39qalXuGAK/WPltjajIC4x2c9Ye1f43SGcqGwRBeTZjhMNntL4pCWZMQYhE05RVl02EovRgC4RkCbUNSQAGhGB/GsKG4h6FQoigDa2i8fRBy3uLMXYIG3Vr3aZvRaCRdBYlYIMZywhBGCVhgzzOlgRuUSOvC0GMEWxOM/+EtQFh1OIIXtfwg1tRaayGjg5px0jyZKEaTle3e+AsLCygVRAh3FlEgKbReE3oYGj9EgIR00QiEgKw3ZBQbRGjBeAMtDETQmHiKDsezJNLgCTFGItZXlAgCSiQggblP+9c8SDI0lXWlFv5g3K63KZ51FOcZzthQ3LomoNHwJmKIQISI3vqzSpwIQ8liSjGMFQjDpoVgaQ6cWgvLhOC7qiAwiHrWbEg4JMSmeUrBuHoYwioOQNXmhmAcrs096s1gJCGi3hSEVU8DQxYElYHhKwUUGAa+NqOBMsSSAQJuhQhCAH4vxozExsxiihPuaIrjCVYKWlYEsjSM52G8Kxxryngl5j0j+EyGTIiED4s1Itm0ZGWxMFCLJaBAcEI6OBkmFgNBoc8Cait2ZnENE/6wQN8LJSJeSMNAjKVm+LUMAIt3PR5AQgIGp1Z5zxhE8PtXUYReYeXi4mKmOPNXBMzt2tPT07LIUtJqr66uusXEbkFnWiQ6Pj72ikrtzc1NKopuvbbj58PDwxqNHp27u7tuYWumUDV+v7+/Xyu6pc59+/DwUCsC9ujt7u6qRbt8//T01C3elbyN70fb29uZ/1FSincvLy/lPGb42tzc9IqJeHt7q61Pr2C6vr7u7tfHx8fMPhV0sLq6WhZtU0n36+uru8elPE7aLi8v1wqJPXn++fmZKYgX8ozFxcXJb0NaQTHClZT8+gBjsYdaFc+zWcUkGTCWENY66ta92oSVzo3WI6IZKGtukeyfBLFKBNAj6bUOBgaoe9wE4n04IBNkLMoC7+Skj630ZlTJMYdyMsU2T8AwpzALkVFilZgJcT2l9PCWDDSAMBSjVlJgZNk0lE1AIby0qCiCnBQNj6aBGQslZIZJ5hB6D/AzQHto5Z9Nk8tARdN4q2ExBnsyIJ311EymShyjan2rKk0zh1Ay1oQVWAZQRnkUA8RFw7TahjBnmNgMVMQrsCGZJezRtGlU0cUZ1zuaxGZPpbhApM+ZpFQqQ6xadoMtBrEKpBVo4GRXvNSxpaRixKiR+TChCYhsDwZkfFj8IkErjAHejcUI0XQrgwehhNSMHAz21E0wZ23FcCAmj8Sd/PXy2xLYLAuwRw4IMsqjFaWYOpMEhDySAPFCWyFkgAHrEcA+BNeJ4UE8HCzJPpCrerUmQIx1pWJkjqxJD8EikUo2c5aI8ZYgsAkM4WQtnHd0ns0ORgVTBghy5ISy928SGsbTMqYg523RUY8oNYG4FIYiyRyZCnFCJC87IoRAIMVOqQ7BKexxCS2hYVl9JhvlpYjnAe4MhmRPMWhhvLfXINaI9WKM0Zu0+SfAAFLE1EgfVSv7AAAAAElFTkSuQmCC) center;box-shadow:0 0 5px rgba(0,0,0,.4) inset;-moz-box-shadow:0 0 5px rgba(0,0,0,.4) inset;-webkit-box-shadow:0 0 5px rgba(0,0,0,.4) inset;width:200px;height:22px;transform:rotate(-90deg);bottom:48%;left:-80px;position:absolute}.fl-alpha-text{width:30px;font-size:12px;text-align:center;color:#999;position:absolute;bottom:-5px}.fl-lightbox-wrap.fl-icon-selector{z-index:1000111}.fl-icon-selector .fl-lightbox{height:100%}.fl-icons-filter{height:auto!important;margin:0!important;position:absolute!important;right:0;top:0;padding:10px 16px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-icons-filter select{vertical-align:middle;width:195px;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;color:#000;border:2px solid #e4e7ea!important;border-right:none!important;margin:0;padding:2px 10px;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;-ms-flex:1 1 195px;flex:1 1 195px;border-radius:0}.fl-icons-filter input[type=text]{line-height:18px;vertical-align:middle;width:160px;-ms-flex:1 1 160px;flex:1 1 160px;border:2px solid #e4e7ea!important;border-radius:0!important;padding:2px 10px!important}.fl-icons-filter input[type=text]:focus,.fl-icons-filter select:focus{border:2px solid #00A0D2!important}.fl-icons-list{bottom:52px;left:0;overflow:auto;padding:20px;position:absolute;right:0;top:48px}.fl-icons-list::-webkit-scrollbar{background-color:#ccc;-webkit-appearance:none;width:10px}.fl-icons-list::-webkit-scrollbar-thumb{background-color:#666;border:1px solid #ccc}.fl-icons-section{text-align:center}.fl-icons-section h2{border-bottom:1px solid #dfdfdf;color:#333!important;font-family:Helvetica,Verdana,sans-serif!important;font-size:16px!important;font-weight:700!important;margin:0 0 20px!important;padding:0 0 10px!important;text-align:left}.fl-icons-list i,.fl-icons-list i:before{cursor:pointer;display:inline-block;font-size:40px;height:100px;line-height:100px;width:100px;background:0 0}.fl-icons-list i:hover{background:#fff;box-shadow:0 10px 20px rgba(0,0,0,.15);border-radius:4px}.fl-icon-selector-footer{bottom:0;left:0;position:absolute;right:0}.fl-lightbox-mask,.fl-lightbox-wrap{bottom:0;left:0;position:fixed;right:0;z-index:100010}@keyframes fl-lightbox-zoom{from{transform:scale(.4)}to{transform:scale(1)}}.fl-lightbox-wrap{display:none;overflow:auto;padding:4px;top:46px;-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);pointer-events:none}.fl-builder-draggable-is-dragging .fl-lightbox-wrap,.fl-builder-resizable-is-resizing .fl-lightbox-wrap,.fl-lightbox,.fl-lightbox-mask{pointer-events:auto}.fl-lightbox-mask{background:#000;opacity:.7;filter:alpha(opacity=70);top:0}.fl-lightbox{background:#F5F7F9;border-radius:4px;box-shadow:rgba(0,0,0,1) 0 4px 30px;-moz-box-shadow:rgba(0,0,0,1) 0 4px 30px;-webkit-box-shadow:rgba(0,0,0,1) 0 4px 30px;position:relative;display:-ms-flexbox;display:flex;z-index:100011;transform-origin:center;animation-name:fl-lightbox-zoom}.fl-lightbox.fl-lightbox-prevent-animation{animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s}.fl-lightbox :not(i){color:#333;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px;line-height:16px;text-decoration:none;text-transform:none}.fl-lightbox *,.fl-lightbox :after,.fl-lightbox :before{box-sizing:content-box}.fl-lightbox .fl-nanoscroller-pane{bottom:4px;right:4px;width:8px}.fl-lightbox .fa{font-family:FontAwesome}.fl-lightbox .dashicons{font-family:dashicons}.fl-lightbox.ui-draggable{box-shadow:rgba(0,0,0,.2) 0 7px 30px;-moz-box-shadow:rgba(0,0,0,.2) 0 7px 30px;-webkit-box-shadow:rgba(0,0,0,.2) 0 7px 30px}.fl-lightbox-resizable{height:500px;width:380px}@media (max-width:500px){.fl-lightbox-resizable{left:0!important;right:0!important;top:0!important;height:100%!important;width:100%!important}.fl-lightbox-resizable .ui-resizable-handle{display:none!important}.fl-lightbox.ui-draggable .fl-lightbox-header{cursor:default!important}.fl-lightbox-controls{display:none}}.fl-lightbox-width-full{left:0!important;right:0!important;top:0!important;height:100%!important;width:100%!important}.fl-lightbox-width-full .fl-lightbox-header{cursor:inherit!important}.fl-lightbox-controls{position:absolute;right:10px;top:10px;z-index:5}.fl-lightbox-controls .fa{color:#bdbdbd;font-size:14px;padding:5px}.fl-lightbox-controls .fa:hover{color:#aaa;cursor:pointer}.fl-lightbox-header-wrap{background:#fff;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:2px solid #eaeaea}.fl-lightbox-header{position:relative}.fl-lightbox-header h1{color:#333!important;font-size:20px!important;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important;font-weight:600!important;margin:0!important;padding:14px 34px 15px 28px!important;text-align:left!important;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;line-height:1.1}.fl-lightbox.ui-draggable .fl-lightbox-header{cursor:move}.fl-lightbox-header h1 .fl-builder-badge{margin-left:10px}.fl-lightbox-content,.fl-lightbox-content-wrap{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1 100%;flex:1 100%;height:100%;max-width:100%}.fl-lightbox-footer{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex:0 0;flex:0 0;-ms-flex-preferred-size:44px;flex-basis:44px;padding:4px;text-align:right}.fl-lightbox-footer .fl-builder-button{height:36px;margin-left:5px!important;-ms-flex:0 0 0%;flex:0 0 0%;-ms-flex-pack:center;justify-content:center}.fl-lightbox-width-slim .fl-lightbox-footer{-ms-flex-pack:stretch;justify-content:stretch;padding:4px 5px}.fl-lightbox-width-slim .fl-lightbox-footer .fl-builder-button{-ms-flex:1 1 100%;flex:1 1 100%;display:block;text-align:center}.fl-lightbox-width-slim .fl-lightbox-footer .fl-builder-button:first-child{margin-left:0!important}.fl-lightbox table,.fl-lightbox td,.fl-lightbox th,.fl-lightbox tr{border:none}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel,.fl-builder-ui-skin--dark .fl-builder--preview-actions,.fl-builder-ui-skin--dark .fl-builder--search-results-panel,.fl-builder-ui-skin--dark .fl-builder-panel,.fl-builder-ui-skin--dark .fl-lightbox,body.fl-builder-ui-skin--dark .fl-builder-bar .fl-builder-bar-content{background:#23282d;color:#b4b9be;border-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder--panel-header{background:#1d2227;color:#b4b9be;border-bottom-color:#1d1d1d;border-top-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder-panel.fl-builder-ui-pinned .fl-builder--panel-header{border-top-color:#1d2227}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel:before{border-bottom-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder--panel-arrow polygon{fill:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder-panel-search .fl-builder-panel-search-input{background:#1e2228}.fl-builder-ui-skin--dark .fl-responsive-preview-content{background:#131619}.fl-builder-ui-skin--dark .fl-form-table th{background:#23282d!important;color:#7d8690}.fl-builder-ui-skin--dark .fl-builder--preview-actions .device-icons,.fl-builder-ui-skin--dark .fl-builder-button{background:#383f46}.fl-builder-ui-skin--dark .fl-builder-button:focus{background:#131a22}.fl-builder-ui-skin--dark .fl-builder-button.fl-builder-button-primary{color:#fff!important;fill:#fff!important;background:#00A0D2}.fl-builder-ui-skin--dark .fl-builder-button.fl-builder-button-silent:focus{border:2px solid #00a0d2!important}.fl-builder-ui-skin--dark .fl-builder-content-panel--button:hover,.fl-builder-ui-skin--dark .fl-builder-content-panel-button{color:#00A0D2!important}.fl-builder-ui-skin--dark .fl-builder--menu>a:hover,.fl-builder-ui-skin--dark .fl-builder--menu>button:hover{background:#101215!important}.fl-builder-ui-skin--dark .fl-builder--menu>a:focus,.fl-builder-ui-skin--dark .fl-builder--menu>button:focus{background:#101215!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder-bar-title{border-color:#101215}.fl-builder-ui-skin--dark .fl-builder-bar-title:hover{background-color:#181b1f}.fl-builder-simple.fl-builder-ui-skin--dark .fl-builder-bar-title:hover{background-color:transparent}.fl-builder-ui-skin--dark .fl-builder-layout-title{color:#c6cdd6}.fl-builder-ui-skin--dark .fl-builder-bar-title-caret i,.fl-builder-ui-skin--dark .fl-builder-layout-pretitle,.fl-builder-ui-skin--dark .fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{color:#7d8690}.fl-builder-ui-skin--dark button.fl-builder-button.fl-builder-bar-title-caret:focus{background-color:#101215!important}.fl-builder-ui-skin--dark .fl-builder--search:before{color:rgba(162,173,184,.73)}.fl-builder-ui-skin--dark .fl-builder--search input:focus::-webkit-input-placeholder{color:rgba(162,173,184,.73)!important}.fl-builder-ui-skin--dark .fl-builder--search .search-clear{color:rgba(162,173,184,.5);background-color:#e4e4e4;background:linear-gradient(to left,#383f46,#383f46 75%,rgba(56,63,70,0))}.fl-builder-ui-skin--dark .fl-builder--menu hr{background-color:#23282d!important;border:none}.fl-builder-ui-skin--dark .fl-builder--tabs{border-color:#383f46!important}.fl-builder-ui-skin--dark .fl-builder--tabs>.is-showing,.fl-builder-ui-skin--dark .fl-builder-settings-tabs a.fl-active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-more.fl-contains-active{color:#fff!important;fill:#fff!important;background:#383f46}.fl-builder-ui-skin--dark .fl-builder--tabs>:focus{background-color:#101215!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder--tabs>.is-showing:focus{color:#00a0d2!important}.fl-builder-ui-skin--dark .fl-builder--menu-item:hover{background:#383f46;color:#a8b3bf}.fl-builder-ui-skin--dark .fl-builder--menu * .fl-builder--menu-item-accessory,.fl-builder-ui-skin--dark .fl-builder-blocks-section-group-name{color:#7d8690}.fl-builder-ui-skin--dark .fl-builder--category-select{background:#171b1f}.fl-builder-ui-skin--dark .fl-builder--selector-display{color:#c6cdd6;background:url(../img/svg/select-arrow-down-alt2-light.svg) center right 10px no-repeat #171b1f!important}.fl-builder-ui-skin--dark .fl-builder--selector-display-label,.fl-builder-ui-skin--dark .fl-builder-panel-search-input input{border-color:#5b656f;color:#b5becb}.fl-builder-ui-skin--dark .fl-builder-panel-search-input input{background:#171b1f!important}.fl-builder-ui-skin--dark .fl-builder--selector-display-label:focus,.fl-builder-ui-skin--dark .fl-builder-panel-search-input input:focus{border-color:#00a0d2}.fl-builder-ui-skin--dark .fl-builder--group-label{color:#171b1f!important;background:#5b656f}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu{border-color:#101215!important;color:#7c858e;background-color:#101215}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu:before{border-bottom-color:#101215}.fl-builder-ui-skin--dark .fl-builder--menu>a,.fl-builder-ui-skin--dark .fl-builder--menu>button,.fl-builder-ui-skin--dark .fl-builder--menu>span{color:#a1adb9}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu .fl-builder--menu-item:hover{background:#23282d!important;color:#a1adb9}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu .fl-builder--menu-item:focus{background:#23282d!important;color:#00a0d2!important}.fl-builder-ui-skin--dark .fl-builder-panel-drag-handle{fill:#5b656f}.fl-builder-ui-skin--dark .fl-builder--template-collection-section-name,.fl-builder-ui-skin--dark .fl-builder--user-templates-section-name,.fl-builder-ui-skin--dark .fl-builder-blocks-section .fl-builder-blocks-section-title{color:#969ea7;background:#171b1f}.fl-builder-ui-skin--dark .fl-builder-blocks-section-content .fl-builder-block,.fl-builder-ui-skin--dark .fl-user-template{color:#b8c2ce}.fl-builder-ui-skin--dark .fl-builder-block:hover .fl-builder-block-content,.fl-builder-ui-skin--dark .fl-user-template:hover{background:#171b1f;color:#fff}.fl-builder-ui-skin--dark .fl-builder-block:hover i,.fl-builder-ui-skin--dark .fl-user-template:hover i{color:#6d7782!important}.fl-builder-ui-skin--dark .fl-builder-block:hover a:hover i,.fl-builder-ui-skin--dark .fl-user-template:hover a:hover i{color:#9eacbb!important}.fl-builder-ui-skin--dark .fl-builder-block .fl-builder-block-icon{fill:#b5becb}.fl-builder-ui-skin--dark .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col,.fl-builder-ui-skin--dark .fl-builder-block:hover .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{background:#7d8690}.fl-builder-ui-skin--dark .fl-builder-blocks-section,.fl-builder-ui-skin--dark .fl-builder-settings-section{border-top:2px solid #171b1f}.fl-builder-ui-skin--dark .fl-user-templates{border-color:#101215}.fl-builder-ui-skin--dark .fl-builder--template-thumbnail{border-color:#393f44}.fl-builder-ui-skin--dark .fl-builder--menu a.fl-template-collection{color:#a8b3bf}.fl-builder-ui-skin--dark .fl-lightbox-header-wrap{background:#1d2227;border-bottom-color:#131a22}.fl-builder-ui-skin--dark .fl-lightbox .fl-lightbox-header h1{color:#fff!important}.fl-builder-ui-skin--dark .fl-form-table th label{color:#a8b3bf!important}.fl-builder-ui-skin--dark .fl-builder-settings-tabs{border-color:#383f46!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields h3.fl-builder-settings-title{background:#1b2025}.fl-builder-ui-skin--dark h3.fl-builder-settings-title .fl-builder-settings-title-text-wrap{color:#a8b3bf;background-color:#1b2025}.fl-builder-ui-skin--dark .fl-lightbox :not(i){color:#7d8690!important}.fl-builder-ui-skin--dark .fl-builder-button{color:#c6cdd6!important;fill:#c6cdd6!important}.fl-builder-ui-skin--dark .fl-builder-content-panel--button:hover,.fl-builder-ui-skin--dark .fl-builder-content-panel-button{fill:#00A0D2!important}.fl-builder-ui-skin--dark .fl-lightbox .fl-builder-button.fl-builder-button-primary{color:#fff!important}.fl-builder-ui-skin--dark .fl-color-picker{background:#131a22}.fl-color-picker-color.fl-color-picker-empty .fl-color-picker-icon{fill:#6f7881}.fl-builder-ui-skin--dark .fl-color-picker-clear{background-color:#191d21}.fl-builder-ui-skin--dark .fl-color-picker-clear:hover{background-color:#373f46}.fl-builder-ui-skin--dark span.fl-builder-block-no-node-templates:hover{background:#1d2025}.fl-builder-ui-skin--dark .fl-builder-settings-tab-description{background:#1d2227}.fl-builder-ui-skin--dark .fl-builder-panel-search button svg .filled-shape{fill:#b5becb}.fl-builder-ui-skin--dark .fl-builder-custom-field,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=email],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=file],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=number],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=password],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=search],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=tel],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=text],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=url],.fl-builder-ui-skin--dark .fl-builder-settings-fields select,.fl-builder-ui-skin--dark .fl-builder-settings-fields textarea{background-color:#131a22!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=email]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=file]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=number]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=password]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=search]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=tel]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=text]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=url]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields select:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields textarea:focus{border-color:#00a0d2!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields select{background-image:url(../img/svg/select-arrow-down-alt2-light.svg)!important}.fl-builder-ui-skin--dark .fl-builder-custom-field select,.fl-builder-ui-skin--dark .fl-photo-field select{border-color:#7d8690!important}.fl-builder-ui-skin--dark .fl-field i.fl-field-responsive-toggle{color:#6b747d}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel-view-title,.fl-builder-ui-skin--dark .fl-field i.fl-field-responsive-toggle:hover{color:#a8b3bf}.fl-builder-ui-skin--dark .fl-builder--saving-indicator{color:#858f99}.fl-builder-ui-skin--dark .fl-icons-list i:hover{background-color:#16191d;color:#fff}.fl-builder-ui-skin--dark .fl-color-picker-clear .fl-color-picker-icon-remove:after,.fl-builder-ui-skin--dark .fl-color-picker-clear .fl-color-picker-icon-remove:before{background:#6f7881}.fl-builder-ui-skin--dark .fl-builder--user-templates-section-content{border-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select.fl-builder-button{background:0 0;border-right-color:#101215!important}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select.fl-builder-button:hover{background:#181b1f}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{color:#c6cdd6}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu{background:#131a22;border-color:#353c43 #131a22 #131a22}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu:before{border-bottom-color:#353c43}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:focus,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:hover{background:#383f46}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a.fl-active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:hover.fl-active{color:#fff!important;background:#383f46}.fl-builder-ui-skin--dark ul.as-selections{background-color:#121a23}.fl-builder-ui-skin--dark .fl-custom-query .fl-builder-settings-section{border-top:2px solid #1b2026!important}.fl-builder-ui-skin--dark .pp-preview-button{background:#23282d;border:2px solid #101215}.fl-builder-ui-skin--dark .pp-preview-button .pp-preview-button-wrap .fa{color:#b8bfc7}
1
+ #wpadminbar,html{transition-duration:.35s}.fl-builder-badge,.fl-builder-bar-title span{vertical-align:middle}.fl-theme-builder-preview-select-title i:before,body .fl-theme-builder-preview-select .fa-caret-down i:before,body .fl-theme-builder-preview-select-item-title i:before{content:"\f078"}html{transition-property:margin}html.fl-builder-is-showing-toolbar{margin-top:46px!important}.fl-builder-edit body{position:static!important}.fl-builder-edit:after,.fl-builder-edit:before{z-index:0!important}.fl-builder-edit .fl-builder-content{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-touch-callout:none}.fl-builder-bar,.fl-builder-button{-webkit-user-select:none;-moz-user-select:none;-webkit-touch-callout:none}#wpadminbar{transition-property:transform,opacity;transform-origin:bottom;transform-style:preserve-3d;transform:rotateX(89deg) translateY(46px);opacity:0;pointer-events:none;will-change:transform}html.fl-builder-show-admin-bar{margin-top:32px}html.fl-builder-show-admin-bar #wpadminbar{transform:rotateX(0) translateY(0);pointer-events:auto;opacity:1}@media screen and (max-width:782px){html.fl-builder-show-admin-bar{margin-top:46px}}.fl-clear{clear:both}.screen-reader-text{position:absolute;left:-1000em;top:-1000em;height:1px;width:1px;overflow:hidden}.fl-builder-loading{background:url(../img/ajax-loader.svg) center center no-repeat rgba(240,240,240,.8);bottom:0;display:none;left:0;position:fixed;right:0;text-align:center;top:0;z-index:12000000}.fl-builder-settings .fl-builder-loading{background:url(../img/ajax-loader.svg) center center no-repeat rgba(255,255,255,.8);display:block;position:absolute}.fl-field-loader{color:#B3B3B3!important;font-style:italic}.fl-builder-node-loading{opacity:.35}.fl-builder-node-loading-placeholder{background:url(../img/ajax-loader.svg) center center no-repeat;height:50px}.fl-col-group-has-child-loading{display:-ms-flexbox;display:flex}.fl-col-group-has-child-loading>.fl-builder-node-loading-placeholder{width:50px}html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-desktop,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-desktop-medium,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-medium,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-medium-mobile,html:not(.fl-responsive-preview-enabled) .fl-builder-content-editing .fl-visible-mobile{display:block!important}.fl-responsive-preview-mask{background:#F7F7F7;bottom:0;left:0;position:fixed;right:0;top:0;z-index:99999}.fl-responsive-preview{bottom:0;left:0;position:absolute;right:0;top:0;margin-top:50px;z-index:100000}#fl-builder-preview-frame,#fl-builder-preview-mask{bottom:0;height:100%;position:fixed;top:0;width:100%;right:0}.fl-builder-preview .fl-responsive-preview{margin:0!important}.fl-responsive-preview-content{background:#F5F7F9;padding:20px 20px 45px}.fl-responsive-preview-message{color:#b3b3b3;font-family:Helvetica,Arial,Verdana,sans-serif;font-size:14px;font-weight:400;padding:0 20px 20px;text-align:center}.fl-builder-button,body .fl-builder-bar .fl-builder-bar-content{display:-ms-flexbox;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important}.fl-responsive-preview-message i{cursor:pointer;margin-left:3px}.fl-responsive-preview .fl-builder-content{box-shadow:0 0 8px rgba(0,0,0,.2);margin-left:auto;margin-right:auto;max-width:100%}#fl-builder-preview-mask{background:url(../img/ajax-loader.svg) center center no-repeat #F7F7F7;left:0;z-index:99999}#fl-builder-preview-frame{left:50%;transform:translateX(-50%);-moz-transform:translateX(-50%);-webkit-transform:translateX(-50%);z-index:100000}.fl-builder-button{color:#676F7A!important;fill:#676F7A!important;background:#E4E7EA;-ms-flex-align:center;align-items:center;display:flex;text-decoration:none;font-size:14px!important;font-weight:500!important;line-height:1!important;height:33px;margin:0;padding:0 12px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border:2px solid transparent;border-radius:3px;letter-spacing:normal!important;white-space:nowrap;box-sizing:border-box!important;transition-property:background-color,width;transition-duration:.2s;-ms-user-select:none;user-select:none}.fl-builder-button:hover{background:#dadfe5;color:#222;border:2px solid transparent!important}.fl-builder-button:active{background:#DCDCDC}button.fl-builder-button:focus{position:static;top:auto;outline:0;background:#E4E7EA;border:2px solid #00A0D0!important}.fl-builder-bar .fl-builder-button{height:auto}.fl-builder-button-primary,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button{background:#00A0D2;color:#fff!important;text-decoration:none;border:2px solid transparent!important}.fl-builder-button.fl-builder-button-primary:focus,body.fl-builder--layout-has-drafted-changes .fl-builder-button.fl-builder-done-button:focus{background:#00A0D2;border:2px solid #ffc217!important}.fl-builder-button-primary:hover,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button:hover{background:#0197C6;color:#fff!important}.fl-builder-button-primary:active,body.fl-builder--layout-has-drafted-changes .fl-builder-done-button:active{background:#0484AC}.fl-builder-button-large{height:30px}.fl-builder-button-small{font-size:11px!important;line-height:1!important}.fl-builder-help-button{color:#b3b3b3;font-size:16px!important}.fl-builder-help-button i{position:relative;top:-1px}.fl-builder-help-button:hover{color:#666}.fl-builder-publish-button{line-height:45px!important}.fl-builder-content-panel-button,.fl-builder-content-panel-button:hover{fill:#00A0D2!important;font-size:30px!important;padding-bottom:4px}.fl-builder-button-silent,.fl-builder-button-silent:hover{padding:0 12px;background:0 0!important;border:2px solid transparent!important;box-shadow:none!important}.fl-builder-done-button,.fl-builder-done-button:hover{font-weight:600}.fl-field .fl-builder-button{display:inline-block;height:auto;padding:11px 12px;vertical-align:middle;box-shadow:0 2px 4px 0 rgba(0,0,0,.12)}.fl-builder-badge{background:#333;border-radius:2px;color:#fff!important;display:inline;font-size:11px!important;font-weight:400;letter-spacing:1px;margin-left:2px;padding:2px 4px}.fl-builder-badge-global{background:#ff9600;transform:translateY(0);transition-duration:.25s;transition-property:transform}.fl-builder-blocks-node-template .fl-builder-badge-global{position:absolute;right:0;top:0}.fl-builder-block:hover .fl-builder-badge-global{display:none}.fl-builder-bar{left:0;position:fixed;right:0;top:0;z-index:999999;-ms-user-select:none;user-select:none;transition-property:transform opacity;transition-duration:.35s;transform-style:preserve-3d;perspective:1100px}.fl-builder-bar.is-hidden{pointer-events:none}.fl-builder-bar.is-hidden .fl-builder-bar-content{transform:translateY(-100%) rotateX(90deg)}body .fl-builder-bar .fl-builder-bar-content{display:flex;box-sizing:border-box;background:#fff;border-bottom:2px solid #D5DADD;color:#999;font-size:14px!important;height:48px;transition-property:background-color,opacity,transform;transition-duration:.35s;pointer-events:auto}.fl-builder-draggable-is-dragging .fl-builder-content,.fl-builder-draggable-is-dragging .fl-builder-panel .fl-lightbox,.fl-builder-resizable-is-resizing .fl-builder-content,.fl-builder-resizable-is-resizing .fl-builder-panel .fl-lightbox,body .fl-builder-bar .fl-builder-bar-content.is-muted{pointer-events:none}body .fl-builder-bar .fl-builder-bar-content.is-muted>:not(.fl-builder-publish-actions){-webkit-filter:saturate(20%) blur(1px);filter:saturate(20%) blur(1px);opacity:.4}.fl-builder-bar-title{box-sizing:border-box;color:#333;display:-ms-flexbox;display:flex;-ms-flex:0 0 380px;flex:0 0 380px;max-width:380px;border-right:2px solid #D5DADD;cursor:pointer}.fl-builder-bar-title:hover{background:#fff}.fl-builder-bar-title.is-showing-menu .fl-builder-bar-title-caret>svg{transform:rotate(180deg)}.fl-builder-simple .fl-builder-bar-title{cursor:auto}.fl-builder-simple .fl-builder-bar-title:hover{cursor:auto;background:0 0}.fl-builder-bar-title-icon{box-sizing:border-box;background:0 0;-ms-flex:0 0 46px;flex:0 0 46px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:4px}.fl-builder-bar-title-icon img{max-width:100%!important;height:auto!important}.fl-builder-bar-title.fl-builder-bar-title-no-icon{padding-left:12px}.fl-builder-bar-title-area{box-sizing:border-box;-ms-flex:1 1 100%;flex:1 1 100%;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding:4px}.fl-builder-layout-title,.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{font-size:17px;font-weight:400;line-height:1.3;color:#161B20;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.fl-builder-bar-title-caret,.fl-builder-layout-pretitle,.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{font-size:12px;font-weight:500;line-height:1.3;color:#656d77;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.fl-builder-bar-title-caret i,.fl-theme-builder-preview-select-title i{color:inherit!important;font-size:14px}.fl-builder-bar-title-caret{margin-left:auto!important;-ms-flex:0 0 46px;flex:0 0 46px}.fl-theme-builder-preview-select-title i{padding:12px}.fl-theme-builder-preview-select.fl-builder-button{position:relative;border-radius:0;background:0 0;min-width:0;display:-ms-flexbox;display:flex;-ms-flex:0 0 360px;flex:0 0 360px;max-width:360px;margin:0!important;padding:4px 10px;border:none!important;border-right:2px solid #d5dadd!important;box-shadow:none}.fl-theme-builder-preview-select.fl-builder-button:hover{border:none!important;border-right:2px solid #d5dadd!important}.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.fl-theme-builder-preview-select-title div{-ms-flex:1;flex:1}.fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{display:block}.fl-theme-builder-preview-select-open .fl-theme-builder-preview-select-items{position:absolute;top:calc(48px + 10px);left:10px;width:calc(100% - 20px)!important;background:#fff;border-radius:4px;border:2px solid #D5DADD;border-top:3px solid #00a0d2;box-shadow:0 15px 45px 8px rgba(0,0,0,.04);margin:0!important;padding:0;z-index:-1;font-size:16px;overflow:visible;height:auto!important;max-height:calc(100vh - 66px);min-height:300px;display:-ms-flexbox!important;display:flex!important;-ms-flex-direction:column;flex-direction:column}.fl-theme-builder-preview-select-item{padding:4px 0!important;border-bottom:none!important;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.fl-theme-builder-preview-select-item:hover{text-decoration:none;color:#111;background:0 0!important}body .fl-theme-builder-preview-select .fa-caret-down{float:none}body .fl-theme-builder-preview-select-item-title{padding:10px 15px;color:#222;font-size:14px}body .fl-theme-builder-preview-select-item-children{overflow:auto}body .fl-theme-builder-preview-select-item-child{overflow:hidden;text-overflow:ellipsis;line-height:1.1;margin:0 10px;border:2px solid transparent;border-radius:4px;padding:8px 10px 10px;font-size:14px;font-weight:400;color:#222}body .fl-theme-builder-preview-select-item-child:hover{background:#e6eaed!important}.fl-theme-builder-preview-select-item .fa-caret-down{color:#606D77}.fl-builder-bar-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row-reverse;flex-direction:row-reverse;-ms-flex:1 1 100%;flex:1 1 100%;padding:4px}.fl-builder-bar .fl-builder-button{margin:0 0 0 4px}.fl-builder-bar-actions .fl-builder-button:last-child{margin:0}.fl-builder-bar-actions:after{clear:both}.fl-builder-bar .fl-builder-content-panel-button{-ms-flex-align:baseline!important;align-items:baseline!important;padding-top:1px;font-weight:400}.fl-builder-content-panel-button svg{transition-property:transform;transition-duration:.25s;transform:rotate(0) scale(1);transform-origin:center}.fl-builder-content-panel-is-showing .fl-builder-content-panel-button svg{transform:rotate(135deg) scale(1.1) translate(.5px,-.5px)}.fl-builder--saving-indicator{cursor:pointer;display:-ms-flexbox;display:flex;-ms-flex-item-align:center;align-self:center;padding:0 16px;font-size:1em;font-style:italic;color:#676f7a;-ms-flex-align:center;align-items:center;line-height:1.2;min-width:180px;-ms-flex-pack:end;justify-content:flex-end}.fl-builder--saving-indicator:hover{color:#676f7a}.fl-builder--saving-indicator .fa-question-circle{font-size:13px;margin:3px 0 3px 8px}.fl-builder-buy-button,.fl-builder-upgrade-button{background:#F7A407;color:#fff!important;text-decoration:none}.fl-builder-buy-button i.fa-external-link-alt,.fl-builder-upgrade-button i.fa-external-link-alt{color:#FFC733;margin:0 0 0 6px}.fl-builder-buy-button:hover,.fl-builder-upgrade-button:hover{background:#EE8E0D;color:#fff!important}@media (max-width:980px){.fl-builder--main-menu-panel{width:calc(100% - 20px)!important}.fl-builder--main-menu-panel:before{right:auto;left:20px}.fl-builder-bar-title,.fl-theme-builder-preview-select{-ms-flex:1 .5 380px!important;flex:1 .5 380px!important}}@media (max-width:620px){.fl-theme-builder-preview-select.fl-builder-button{display:none}}@media (max-width:500px){.fl-builder--main-menu-panel:before,.fl-builder--panel-arrow,.fl-builder-bar-title-area,.fl-builder-panel-drag-handle,.fl-builder-panel:before{display:none}.fl-builder--main-menu-panel,.fl-builder-panel{width:auto!important;top:44px!important;left:0!important;right:0!important;bottom:0!important;border-radius:0!important;box-shadow:none!important}.fl-builder--main-menu-panel{border-left:transparent!important;border-right:transparent!important;border-bottom:transparent!important;max-height:calc(100% - 44px)!important}.fl-builder-bar-title{-ms-flex:0 0 100px!important;flex:0 0 100px!important}.fl-builder--panel-header{border-radius:0!important;cursor:default!important}.fl-builder--panel-header .fl-builder--tabs{cursor:default!important}.fl-builder-publish-actions{width:100%!important}.fl-builder-bar-actions .fl-builder-button{padding:0 8px!important}}.fl-builder--preview-actions{display:none;position:fixed;top:4px;left:4px;z-index:100008;padding:4px;-ms-flex-pack:center;justify-content:center;background:#fff;border-radius:4px}.fl-builder-preview .fl-builder--preview-actions{display:-ms-flexbox;display:flex}.fl-builder--preview-actions .device-icons{color:#555;background:#e4e4e4;border:none!important;-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;text-decoration:none;font-size:14px!important;line-height:1!important;margin:0 4px 0 0;padding:0 6px;cursor:pointer;-webkit-border-radius:3px;-webkit-appearance:none;border-radius:3px}.fl-builder--preview-actions .device-icons i{margin:0 6px}@keyframes fl-builder-ui-pin-zone-pulse{0%,100%{opacity:1;filter:alpha( opacity=1 )}50%{opacity:.5;filter:alpha( opacity=35 )}}.fl-builder-ui-pin-zone{animation:fl-builder-ui-pin-zone-pulse 2s infinite;transition:width .3s ease;background:rgba(0,160,210,.5);bottom:0;top:0;position:fixed;width:35px;z-index:100001}.fl-builder-ui-show-pin-zone-left .fl-builder-ui-pin-zone-left,.fl-builder-ui-show-pin-zone-right .fl-builder-ui-pin-zone-right{width:75px}.fl-builder-ui-pin-zone-left{left:0}.fl-builder-ui-pin-zone-right{right:0}.fl-builder-content-panel-pin-zone .fl-builder-content-panel-button{display:-ms-flexbox!important;display:flex!important;background:rgba(0,160,210,.5)!important;padding:2px 4px;width:80px;animation:fl-builder-ui-pin-zone-pulse 2s infinite}.fl-builder-content-panel-pin-zone .fl-builder-content-panel-button svg{display:none}.fl-builder-content-panel-pin-zone-hover .fl-builder-content-panel-button{width:120px}.fl-builder-content-panel-pin-zone-hover .fl-builder-content-panel-button svg{display:none!important;width:100%;transform:none!important;fill:#00A0D2!important;border-radius:3px}.fl-builder-ui-is-pinned .fl-builder-content-panel-button,.fl-builder-ui-pinned-container .fl-lightbox-controls{display:none}.fl-builder-content-panel-pin-zone .fl-builder-done-button{-webkit-filter:grayscale(100%);filter:grayscale(100%)}.fl-builder-panel.fl-builder-ui-pinned{top:48px!important;bottom:0!important;height:auto!important;border-radius:0;border:none;box-shadow:none;animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s;z-index:9}.fl-builder-panel.fl-builder-ui-pinned-right{left:auto!important;right:0;border-left:2px solid #d5dadd}.fl-builder-panel.fl-builder-ui-pinned-left{left:0;right:auto;border-right:2px solid #d5dadd}.fl-builder-panel.fl-builder-ui-pinned .fl-builder--panel-header{border-radius:0!important}.fl-builder-ui-pinned-container .fl-lightbox-wrap{position:absolute;z-index:9}.fl-builder-ui-pinned-container .fl-lightbox{position:absolute;top:0;bottom:0;left:0;right:0;width:auto!important;height:auto;border-radius:0;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s}.fl-builder-ui-pinned-container .fl-lightbox-header-wrap{border-radius:0}.fl-builder-ui-pinned-container .fl-lightbox.ui-draggable .fl-lightbox-header{cursor:auto}.fl-builder-ui-pinned-container .fl-lightbox-header h1{padding:12px 20px 10px!important}.fl-builder-ui-pinned-content-transform{transform:scale(1);transform-origin:center top 0}.fl-builder-ui-pinned-collapse{cursor:pointer;display:none;position:absolute!important;bottom:2px;padding:5px;border:2px solid transparent;background:0 0;width:36px;height:36px;border-radius:4px;fill:#778794;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center}.fl-builder-ui-pinned-collapse:focus,.fl-builder-ui-pinned-collapse:hover{top:auto!important;background:0 0;border:2px solid transparent;outline:0;fill:#00A0D2}.fl-builder-ui-pinned-collapse:focus{background:#E4E7EA}.fl-builder-ui-pinned-collapse>*{margin:auto;line-height:1}.fl-builder-ui-pinned-collapse svg g{fill:inherit}.fl-builder-ui-is-pinned-right .fl-builder-ui-pinned-right-collapse{display:-ms-flexbox;display:flex;left:-40px}.fl-builder-ui-is-pinned-left .fl-builder-ui-pinned-left-collapse{display:-ms-flexbox;display:flex;right:-40px}.fl-builder-ui-pinned-collapse i[data-toggle=show],.fl-builder-ui-pinned-is-collapsed i[data-toggle=hide]{display:none}.fl-builder-ui-pinned-is-collapsed i[data-toggle=show]{display:block}.fl-builder--panel-no-settings,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-content,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-controls,.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--tab-wrap,.fl-builder-ui-pinned-is-collapsed .fl-builder--panel-header{display:none}.fl-builder-ui-is-pinned-left [data-toggle=hide],.fl-builder-ui-is-pinned-right [data-toggle=show]{transform:rotateY(180deg)}.fl-builder-ui-pinned-is-collapsed .fl-lightbox{box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-builder--panel-header{background:0 0;border:none;z-index:10}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-lightbox-wrap{top:0}.fl-builder-simple-pinned .fl-builder--content-library-panel .fl-lightbox-header h1{padding:14px 28px 15px!important}.fl-builder-simple-pinned .fl-builder--panel-no-settings{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;position:absolute;top:0;left:0;right:0;bottom:0}@keyframes fl-builder-show-panel{from{transform:scale(.8)}to{transform:scale(1)}}.fl-builder--search-results-panel,.fl-builder-panel{box-sizing:border-box;position:fixed!important;right:20px;top:calc(48px + 10px);width:380px;bottom:20px;background:#F5F7F9;color:#676F7A;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:14px;border-radius:4px;box-shadow:0 8px 40px 4px rgba(0,0,0,.3);z-index:10000007;will-change:transform;display:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fl-builder-panel{transform-origin:top right;animation-name:fl-builder-show-panel;animation-duration:.15s;animation-fill-mode:both}.fl-builder--search-results-panel{position:absolute;right:0;top:93px;left:0;bottom:0;width:auto!important;border:none;border-radius:0;box-shadow:none;min-height:100px;max-height:calc(100vh - 54px);overflow:auto;z-index:1}.fl-builder-content-panel-is-showing .fl-builder-panel,.fl-builder-search-results-panel-is-showing .fl-builder--search-results-panel{display:block}.fl-builder-panel .fl-lightbox .fl-builder-panel-drag-handle,.fl-builder-ui-is-pinned .fl-builder--panel-arrow,.fl-lightbox-width-full .fl-builder-panel-drag-handle,body.fl-builder-draggable-is-dragging .fl-builder--panel-arrow{display:none}.fl-builder-content-panel-is-showing .fl-builder-panel.fl-builder--current-view-templates{width:520px}.fl-builder--search-results-panel .fl-builder--no-results{text-align:center;padding:50px 20px}.fl-builder--panel-arrow{position:absolute;top:-13px;right:10px}.fl-builder--panel-arrow polygon{fill:#00a0d2}.fl-builder--panel-header{background:#fff;border-top:3px solid #00a0d2;border-bottom:2px solid #e6eaed;border-top-right-radius:4px;border-top-left-radius:4px}.fl-builder-ui-is-pinned .fl-builder--panel-header{border-top-color:transparent}.fl-builder-panel-drag-handle{position:absolute;top:7px;left:10px;fill:#ccd4da;width:6px}.fl-builder-ui-is-pinned-left .fl-builder-panel-drag-handle{left:auto;right:10px}.fl-builder--panel-header .fl-builder--panel-controls{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative}.fl-builder--panel-header .fl-builder--panel-controls .fl-builder-content-group-select{-ms-flex:1 1;flex:1 1}.fl-builder--panel-header .fl-builder--panel-controls .fl-builder-panel-search{-ms-flex:0 0;flex:0 0;padding:0 10px 6px 0;margin-left:-4px}.fl-builder--panel-controls .fl-builder-panel-search button{width:38px;background:0 0!important;border:2px solid transparent!important;font-size:inherit;height:38px;padding:0}.fl-builder--panel-controls .fl-builder-panel-search button:active,.fl-builder--panel-controls .fl-builder-panel-search button:focus{top:0;outline:0}.fl-builder-panel-search button svg{height:auto;width:20px}.fl-builder-panel-search button.fl-builder-dismiss-panel-search svg{width:16px}.fl-builder-panel-search button svg .filled-shape{fill:#000}.fl-builder--panel-controls .fl-builder-panel-search button:active svg .filled-shape,.fl-builder--panel-controls .fl-builder-panel-search button:focus svg .filled-shape{fill:#00A0D2}.fl-builder-panel-search .fl-builder-panel-search-input{display:none;position:absolute;top:0;left:0;right:0;bottom:0;background:#fff}.fl-builder-panel-search.is-showing-input .fl-builder-panel-search-input{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;padding:0 10px 6px}.fl-builder-panel-search-input input{-ms-flex:1 1 100%;flex:1 1 100%;border:2px solid #e6eaed;background:#fff;border-radius:4px;margin-right:4px;padding:10px;color:#333}.fl-builder-panel-search-input input:focus{border-color:#0197C6;outline:0}.fl-builder-panel-search-input button{-ms-flex:0 0 38px;flex:0 0 38px}.fl-builder-panel-content-wrap{bottom:0;height:auto;left:0;overflow:hidden;position:absolute;right:0;top:43px}.fl-builder-panel-content{padding-bottom:60px}.fl-builder-blocks-section{border-top:2px solid #e6eaed}.fl-builder--panel-view .fl-builder-blocks-section:first-child{border-top:none}.fl-builder-blocks-group:first-child{padding:20px 0 0}.fl-builder-blocks-group .fl-builder-blocks-section-group-name{display:block;padding:0 30px 15px;color:#000;font-size:20px;font-weight:600;line-height:1.4}.fl-builder-blocks-section .fl-builder-block,.fl-builder-blocks-section .fl-builder-blocks-section-title{display:block;line-height:1.1;padding:15px 20px}.fl-builder--template-collection-section-name,.fl-builder-blocks-section .fl-builder-blocks-section-title{display:inline-block;font-weight:700;font-size:12px;line-height:1.2;text-transform:uppercase;color:#333;padding:4px 10px 4px 15px;margin:0!important;background:#e6eaed;border-bottom-right-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top}.fl-builder-blocks-section .fl-builder-blocks-section-title i{color:#bfbfbf;float:right}.fl-builder-blocks-section-content{overflow:auto;padding:10px 10px 20px}.fl-builder-blocks-section-content:after{float:none;clear:both}.fl-builder-blocks-section-content.fl-builder-modules,.fl-builder-blocks-section-content.fl-builder-rows,.fl-builder-blocks-section-content.fl-builder-widgets{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.fl-builder-blocks-section-content .fl-builder-block-module,.fl-builder-blocks-section-content .fl-builder-block-row{-ms-flex:1 1 50%;flex:1 1 50%;width:50%;box-sizing:border-box}.fl-builder--search-results-panel .fl-builder-blocks-section-content .fl-builder-block-module{-ms-flex:1 1 100%;flex:1 1 100%;width:100%}.fl-builder-blocks-section.fl-active .fl-builder-blocks-section-content{display:block}.fl-builder-blocks-section-content .fl-builder-block{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:4px;font-size:14px;line-height:1.1;font-weight:500;color:#727272}.fl-builder-block{position:relative;height:47px}.fl-builder-block.fl-builder-block-col-group{height:84px}.fl-builder-block.fl-builder-block-module-template.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-row-template.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-column.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-module.fl-builder-block-has-thumbnail,.fl-builder-block.fl-builder-block-saved-row.fl-builder-block-has-thumbnail{padding:10px;height:auto}.fl-builder-block:hover{overflow:visible;z-index:1}.fl-builder-block:hover .fl-builder-block-content{display:block;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;padding:15px 20px;border-radius:4px;background:#fff;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);text-decoration:none;color:#111;cursor:move;overflow:hidden}.fl-builder-block.fl-builder-block-module-template.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-row-template.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-column.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-module.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-block.fl-builder-block-saved-row.fl-builder-block-has-thumbnail .fl-builder-block-content,.fl-builder-blocks-node-template .fl-builder-block,.fl-builder-blocks-section-content .fl-builder-block .fl-builder-block-details{position:relative}.fl-builder-block-module:hover .fl-builder-block-content{width:auto;min-width:100%}.fl-builder-block .fl-builder-block-content .fl-builder-block-visual{display:block;margin-bottom:7px}.fl-builder-block-drag-helper .fl-builder-block-content .fl-builder-block-visual{display:none!important}.fl-builder-block .fl-builder-block-content .fl-builder-block-visual.fl-cols-visual{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:30px}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{-ms-flex:1 100%;flex:1 100%;background:#464a4c;height:30px;margin:0 2px;border-radius:2px}.fl-builder-block:hover .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{background:#000}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col:first-child{margin-left:0!important}.fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col:last-child{margin-right:0!important}.fl-cols-visual.left-right-sidebar .fl-cols-visual-col:first-child,.fl-cols-visual.left-right-sidebar .fl-cols-visual-col:last-child,.fl-cols-visual.left-sidebar .fl-cols-visual-col:first-child,.fl-cols-visual.right-sidebar .fl-cols-visual-col:last-child{-ms-flex-preferred-size:60px;flex-basis:60px}.fl-builder-block-saved-column.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-column:hover .fl-builder-block-title,.fl-builder-block-saved-module.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-module:hover .fl-builder-block-title,.fl-builder-block-saved-row.fl-builder-block-global .fl-builder-block-title,.fl-builder-block-saved-row:hover .fl-builder-block-title{margin-right:70px}.fl-builder-block-module:nth-child(even):hover .fl-builder-block-content{left:auto;right:0}.fl-builder-block-thumbnail{border-radius:4px;background-size:contain;background-repeat:no-repeat;background-position:center;background-color:rgba(0,0,0,.06);margin-bottom:10px;transform-origin:bottom;transition-property:transform,box-shadow;transition-duration:.15s}.fl-builder-block:hover .fl-builder-block-thumbnail{transform:scale(1.05);box-shadow:0 20px 40px rgba(0,0,0,.08)}.fl-builder-block .fl-builder-block-icon{margin-right:7px;fill:#000;display:inline-block;width:20px;height:20px;vertical-align:middle}.fl-builder-block-thumbnail:before{content:"";display:block;padding-top:50%}.fl-builder-block-thumbnail img{max-width:100%;max-height:160px;margin:0;-o-object-fit:cover;object-fit:cover}.fl-builder-blocks-section-content .fl-builder-block{box-shadow:0 0 0 transparent;transition-property:box-shadow;transition-duration:.15s}.fl-builder-blocks-section-content .fl-builder-block i,.fl-user-template-actions i{color:#000;margin-right:10px}.fl-builder-blocks-separator{background:#f1f1f1;height:6px}.fl-builder-block:hover .fl-builder-badge{background:#2ea2cc}.ui-sortable-helper .fl-builder-badge{display:none!important}.fl-builder-modules-cta a{color:#999!important;display:block!important;font-size:12px!important;font-style:italic!important;padding:15px 20px!important;line-height:16px!important}.fl-builder-modules-cta a:hover{background:#e5e5e5!important;color:#666!important;text-decoration:none!important}.fl-builder-modules-cta a:focus{text-decoration:none!important}.fl-builder-modules-cta .fa{float:right!important;font-size:14px!important;margin:3px 0 0 9px!important}.fl-builder--panel-message{text-align:center;padding:40px 20px;font-size:16px}.fl-builder--panel-message .fl-builder-button{display:inline-block;padding:10px}.fl-builder--panel-cta{padding:20px 30px;font-size:16px;text-align:center}.fl-builder--panel-cta a{color:inherit;text-decoration:none}.fl-builder--panel-cta a:hover{text-decoration:none}.fl-builder-block-template-image{margin:5px 0 10px;max-width:100%;border:1px solid #dfdfdf}.fl-builder-block .fl-builder-block-title{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;line-height:1.3}.ui-sortable-helper .fl-builder-block-template-image{display:none!important}@keyframes fl-builder-template-item-enter{from{transform:translateY(100px) scale(.3);opacity:0}to{transform:scale(1);opacity:1}}.fl-builder--template-collection{clear:both;padding:10px 0}.fl-builder--template-collection-section-content{padding:0 10px}.fl-builder--template-collection-item{box-sizing:border-box;width:50%;float:left;padding:10px;cursor:pointer;font-size:13px;transform-origin:center;opacity:1}.fl-builder--template-thumbnail{background-size:cover;background-clip:content-box;background-position:center top;background-color:#fff;border:2px solid transparent;transform-origin:bottom;transition-property:transform,box-shadow;transition-duration:.15s}.fl-builder--template-collection-item[data-id="0"] .fl-builder--template-thumbnail,.fl-user-template .fl-builder--template-thumbnail{border-color:#e4e7ea}.fl-builder--template-thumbnail:before{display:block;content:"";padding-top:120%}.fl-builder--template-thumbnail:hover{transform:scale(1.05);box-shadow:0 20px 40px rgba(0,0,0,.08)}.fl-builder--template-name{text-align:center;padding:4px 0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.fl-builder--template-collection-section{padding-bottom:10px;border-bottom:1px solid #dfdfdf}.fl-builder--template-collection-section:after,.fl-builder--template-collection-section:before{content:"";display:block;clear:both}.fl-builder--template-collection-section-name{padding:15px 10px 10px}span.fl-builder-block-no-node-templates{display:block;padding:15px 20px;text-align:center}span.fl-builder-block-no-node-templates:hover{cursor:default}.fl-builder-blocks-section-content .fl-builder-node-template-actions{bottom:0;cursor:default;display:none;position:absolute;right:0;top:0}.fl-builder-blocks-section-content .fl-builder-node-template-delete,.fl-builder-blocks-section-content .fl-builder-node-template-edit{display:inline;cursor:pointer;margin:0;padding:15px 10px;text-align:center;width:30px}.fl-builder-block-details .fl-builder-node-template-delete,.fl-builder-block-details .fl-builder-node-template-edit{padding-top:0!important}.fl-builder-blocks-section-content .fl-builder-node-template-delete i,.fl-builder-blocks-section-content .fl-builder-node-template-edit i{margin:0}.fl-builder-blocks-section-content .fl-builder-node-template-delete:hover i,.fl-builder-blocks-section-content .fl-builder-node-template-edit:hover i{color:#444}.fl-builder-blocks-node-template .fl-builder-block:hover .fl-builder-node-template-actions{display:block}.ui-sortable-helper .fl-builder-node-template-delete,.ui-sortable-helper .fl-builder-node-template-edit{display:none!important}.fl-builder--tabs{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-align:center;align-items:center}.fl-builder-panel .fl-builder--panel-header{cursor:move;position:absolute;top:0;left:0;right:0;z-index:9}.fl-builder-panel .fl-builder--tabs{-ms-flex-pack:distribute;justify-content:space-around;padding:0 24px;min-height:46px;cursor:pointer}.fl-builder--tab-wrap{-ms-flex:1 1 100%;flex:1 1 100%;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:justify;justify-content:space-between}.fl-builder--tabs button,.fl-builder--tabs button:active,.fl-builder--tabs button:focus,.fl-builder--tabs button:hover{-ms-flex:1 1 100%;flex:1 1 100%;display:inline-block;text-decoration:none;color:inherit;text-align:center;letter-spacing:normal!important;padding:5px;cursor:pointer;font-size:14px!important;font-weight:600!important;line-height:1.4!important;background:0 0!important;outline:0!important;border:2px solid transparent;border-radius:4px;margin:7px 0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important;top:0;transition-property:background,color;transition-duration:.25s}.fl-builder--current-view-name,.fl-builder-drop-zone{text-align:left;text-overflow:ellipsis;white-space:nowrap}.fl-builder--tabs button:focus{background:#e6eaed!important}.fl-builder--tabs button.is-showing{color:#0086b0}.fl-builder--panel-view{display:none;overflow:hidden}.fl-builder--panel-view.is-showing{display:block}.fl-builder--content-library-panel .fl-builder--panel-view.is-showing{position:absolute;top:96px;bottom:0;left:0;right:0;width:auto;height:auto}.fl-builder--content-library-panel.single-view .fl-builder--panel-view.is-showing{top:52px}.fl-builder--content-library-panel.ui-draggable-dragging{height:500px!important}.fl-builder--content-library-panel .fl-builder-drop-zone{display:none!important}.fl-builder--panel-header .fl-builder--tabs{cursor:move}.fl-builder--category-select{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative}.fl-builder--selector-display{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;position:relative;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;color:#161B20;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;cursor:pointer;font-size:13px;font-weight:700;line-height:16px;border-radius:4px}.fl-builder--selector-display-label{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-size:inherit;line-height:inherit;width:100%;padding:0!important;color:#6D6D6D;background:0 0;border:2px solid #e4e7ea;border-radius:4px;font-family:inherit}.fl-builder--selector-display-label:active,.fl-builder--selector-display-label:hover{top:0;color:inherit;background:0 0;border:2px solid #e4e7ea;border-radius:4px}.fl-builder--selector-display-label:focus{top:0;color:inherit;background:0 0;border:2px solid #00A0D2;outline:0}.fl-builder--group-label{color:inherit;-ms-flex:0 0 0%;flex:0 0 0%;padding:9px 12px 9px 10px;background:#e6eaed;border-top-left-radius:2px;border-bottom-left-radius:2px}.fl-builder--current-view-name{-ms-flex:1 1 100%;flex:1 1 100%;color:inherit;overflow:hidden;font-weight:600;padding:9px 10px}.fl-builder--selector-menu{display:none;color:#293138;position:absolute;top:46px;left:0;width:100%;background:#fff;border-radius:4px;box-shadow:0 0 20px 2px rgba(0,0,0,.2);overflow:visible}.fl-builder--selector-menu:before{bottom:100%;right:8px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}.fl-builder--category-select.is-showing .fl-builder--selector-menu{display:-ms-flexbox;display:flex;max-height:calc(100vh - 150px)}.fl-builder--category-select.is-showing .fl-builder--selector-menu .fl-builder--menu{margin:10px 0;-ms-flex:1 100%;flex:1 100%;overflow:auto}button.fl-builder-button.fl-builder-bar-title-caret{margin:4px}button.fl-builder-button.fl-builder-bar-title-caret:focus{background-color:#e6eaed!important;border-color:transparent!important}.fl-builder--category-select.is-showing .fl-builder-bar-title-caret i{transform:rotate(180deg)}.fl-builder--menu{margin-bottom:2px}.fl-builder--menu>a,.fl-builder--menu>button,.fl-builder--menu>span{display:block;padding:8px 10px 10px;border-radius:4px;color:inherit;text-decoration:none;background:0 0!important;border:2px solid transparent!important;font-weight:400;font-family:inherit}.fl-builder--menu>a:active,.fl-builder--menu>a:focus,.fl-builder--menu>a:hover,.fl-builder--menu>button:active,.fl-builder--menu>button:focus,.fl-builder--menu>button:hover{background:#e6eaed!important;border:2px solid transparent!important;top:0}.fl-block-col-resize-feedback,.fl-block-overlay-title,.fl-builder-block-drag-helper,.fl-builder-block.ui-draggable-dragging,.fl-builder-drop-zone,.fl-builder-empty,.fl-builder-has-submenu>ul.fl-builder-submenu li a{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.fl-builder--menu>a:focus,.fl-builder--menu>button:focus{outline:0;color:inherit;text-decoration:none}.fl-builder--menu .fl-inset{padding-left:35px;font-size:14px;line-height:1.25}.fl-builder--menu a.fl-template-collection{color:#161B20}.fl-builder--menu>:after{clear:both}.fl-builder--menu * .fl-builder--menu-item-accessory{float:right;color:#000;text-transform:uppercase;text-align:center;min-width:20px;letter-spacing:2px}.fl-builder--menu * .fl-builder--menu-item-accessory i{font-size:1em;margin-top:2px}.fl-builder--menu .fl-builder-video-wrap iframe{display:block;margin:4px 0;width:100%}.fl-builder-publish-actions{display:-ms-flexbox;display:flex;box-sizing:border-box;position:absolute;top:0;right:0;width:380px;max-width:100%;height:46px;padding:4px;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;opacity:1;pointer-events:auto;transform:scaleX(1) translateX(0);transform-origin:right;transition-property:transform,opacity;transition-duration:.15s}.fl-builder-publish-actions.is-hidden{transform:scaleX(.23) translateX(68px);opacity:0;pointer-events:none}.fl-builder-bar .fl-builder-button-group{display:-ms-flexbox;display:flex;-ms-flex-preferred-size:100%;flex-basis:100%}.fl-builder-bar .fl-builder-button-group>.fl-builder-button{border-radius:0;margin-left:0;-ms-flex-preferred-size:100%;flex-basis:100%;text-align:center;-ms-flex-pack:distribute;justify-content:space-around;box-shadow:none}.fl-builder-bar .fl-builder-button-group>.fl-builder-button:first-child{margin-left:0;border-top-left-radius:3px;border-bottom-left-radius:3px}.fl-builder-bar .fl-builder-button-group>.fl-builder-button:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}.fl-builder-publish-actions-click-away-mask{display:none;position:fixed;top:0;left:0;right:0;height:100vh;background:0 0}.fl-builder-dragging .fl-builder-content:not(.fl-builder-empty){padding:16px 0}.fl-builder-empty{display:none;border:2px dashed #969696;border-radius:8px;color:#909090;font-size:20px;font-weight:700;margin:10px;padding:250px 20px;position:relative;text-align:center;text-transform:uppercase}.fl-builder-edit .fl-builder-empty{display:block}.fl-builder-block-drag-helper,.fl-builder-block.ui-draggable-dragging{background:rgba(255,255,255,.95)!important;border:2px solid #000;border-radius:4px;box-shadow:0 0 8px rgba(0,0,0,.2);-moz-box-shadow:0 0 8px rgba(0,0,0,.2);-webkit-box-shadow:0 0 8px rgba(0,0,0,.2);color:#333!important;font-size:13px!important;height:47px!important;line-height:40px!important;overflow:hidden;padding:0 20px;position:fixed!important;text-overflow:ellipsis;white-space:nowrap;width:180px!important;z-index:100010!important;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-line-pack:center;align-content:center;-ms-flex-pack:start;justify-content:flex-start}.fl-builder-block.fl-builder-block-drag-helper:hover{padding:0;box-shadow:none}.fl-builder-block-drag-helper:hover .fl-builder-block-content{position:static;padding:0 20px}.fl-col-has-highlight-guide .fl-col-content,.fl-col-highlight,.fl-row-highlight .fl-col-group{position:relative}.fl-builder-block-saved-column.fl-builder-block-drag-helper:hover .fl-builder-block-content,.fl-builder-block-saved-module.fl-builder-block-drag-helper:hover .fl-builder-block-content,.fl-builder-block-saved-row.fl-builder-block-drag-helper:hover .fl-builder-block-content{padding:14px 20px}.fl-builder-block-drag-helper .fl-builder-block-icon{fill:#000;margin-top:-10px}.fl-builder-drop-zone{animation:fl-builder-drop-zone-pulse 2s infinite;background:#00A2D7;border-radius:4px;color:#fff!important;display:block;font-weight:400;font-size:12px;letter-spacing:1px;line-height:14px;margin:10px;padding:6px 8px 5px;position:relative;text-shadow:none;text-transform:none;overflow:hidden;z-index:10}@keyframes fl-builder-drop-zone-pulse{0%,100%{background-color:#00A2D7}50%{background-color:#79DEFF}}.fl-builder-drop-zone-global{animation:fl-builder-drop-zone-global-pulse 2s infinite;background:#ff9600}.fl-field,.fl-lightbox{animation-duration:.25s}@keyframes fl-builder-drop-zone-global-pulse{0%,100%{background-color:#FFBC5C}50%{background-color:#ff9600}}.fl-builder-content>.fl-builder-drop-zone{margin:10px 20px}.fl-row-content>.fl-builder-drop-zone{margin:3px 7px}.fl-col-has-cols>.fl-col-content>.fl-builder-drop-zone{margin:3px 10px}.fl-sortable-disabled>.fl-builder-drop-zone{display:none!important}.fl-col-group-equal-height.fl-col-group-align-center .fl-col-content>.fl-builder-drop-zone{width:100%}.fl-row-highlight{padding:16px 0}.fl-row-highlight .fl-row-content{border:2px dashed rgba(203,205,206,.5);padding:8px;border-radius:6px}.fl-row-highlight.fl-node-global .fl-row-content{border-color:#ff9600}.fl-col-highlight{padding:8px}.fl-col-highlight .fl-col-content{border-style:dashed!important;border-color:#00a0d2!important;border-radius:4px;min-height:100px;overflow-x:hidden;width:100%;border-width:2px!important}.fl-col-has-cols.fl-col-highlight>.fl-col-content{padding:8px}.fl-col-highlight.fl-node-global .fl-col-content{border-color:#ff9600!important}.fl-builder-simple .fl-col-highlight .fl-col-content{border:none!important}.fl-col-highlight-guide{background:rgba(0,160,210,.05);border:2px solid #00A0D2;border-radius:4px;bottom:4px;left:4px;position:absolute;right:4px;top:4px;z-index:1}.fl-node-global .fl-col-highlight-guide{border-color:#ff9600!important;background-color:rgba(255,150,0,.06)!important}.fl-col-has-highlight-guide .fl-block-overlay{background:0 0;border-color:transparent}.fl-col-has-highlight-guide .fl-block-col-resize{display:none}.fl-col-has-highlight-guide .fl-col-highlight .fl-col-content{border-color:transparent!important}.fl-col-drop-target{bottom:8px;display:none;left:-9px;position:absolute;top:8px;width:18px;z-index:1}.fl-col-highlight .fl-col-drop-target{display:block}.fl-col-drop-target-last{left:auto;right:-9px}.fl-col-drop-target .fl-builder-drop-zone{bottom:0;left:2px;margin:0;padding:0;position:absolute;right:2px;top:0}.fl-col-group-drop-target{display:none;left:8px;height:18px;position:absolute;right:8px;top:-9px;z-index:1}.fl-row-highlight .fl-col-group-drop-target{display:block}.fl-col-group-drop-target-last{top:auto;bottom:-9px}.fl-col-group-drop-target .fl-builder-drop-zone{bottom:2px;left:0;margin:0;padding:0;position:absolute;right:0;top:2px}.fl-row-content>.fl-col-group-drop-target{position:static}.fl-row-content>.fl-col-group-drop-target .fl-builder-drop-zone{height:18px;position:static}.fl-row-drop-target{display:none;left:0;height:24px;margin-top:-28px;position:absolute;right:0;z-index:1}.fl-row-highlight .fl-row-drop-target{display:block}.fl-row-drop-target-last{margin-top:4px}.fl-row .fl-row-drop-target .fl-builder-drop-zone{bottom:0;left:4px;margin:0;position:absolute;right:4px;top:0}.fl-builder-content>.fl-row-drop-target{margin:0;position:static}.fl-builder-dragging .fl-builder-content.fl-builder-empty>.fl-row-drop-target{bottom:10px;display:block;height:auto;left:0;position:absolute;right:0;top:10px}.fl-builder-content .fl-row-drop-target .fl-builder-drop-zone{margin-bottom:0;margin-top:0}.fl-col-group:focus,.fl-col:focus,.fl-module:focus,.fl-row:focus{outline:0}.fl-sortable-proxy{display:none}.fl-block-overlay,.fl-block-overlay *{text-shadow:none;-webkit-touch-callout:none}.fl-block-overlay-active{position:relative}.fl-block-overlay-actions{background:#00A0D2;float:left;height:30px;margin:-1px -1px 0;padding:0 4px;text-shadow:none;border-bottom-right-radius:5px;border-top-left-radius:3px}.fl-row-overlay-header-bottom .fl-block-overlay-actions{border-radius:0 5px 0 3px}.fl-builder-col-resizing .fl-block-overlay-actions,.fl-builder-row-resizing .fl-block-overlay-actions{overflow:hidden}.fl-block-overlay-actions>span{display:block;float:left}.fl-block-overlay-actions i{color:#fff!important;cursor:pointer;display:block!important;float:left;font-size:16px!important;height:28px!important;line-height:28px!important;opacity:.8;filter:alpha(opacity=80);text-align:center;width:32px!important}.fl-block-overlay-actions i:hover{opacity:1;filter:alpha(opacity=100)}.fl-block-overlay-actions>i:first-child{padding-left:4px}.fl-block-overlay-actions>i:last-child{padding-right:2px}.fl-block-overlay-actions .fl-block-move{cursor:move}.fl-block-overlay-title{color:#fff!important;float:left;font-size:14px;height:30px;line-height:29px;margin-right:2px;padding:0 12px 0 8px}.fl-col-overlay,.fl-module-overlay,.fl-row-overlay{background:rgba(190,239,255,0);color:#fff}.fl-row-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:0;box-sizing:border-box!important;-moz-box-sizing:border-box!important;-webkit-box-sizing:border-box!important;left:0;position:absolute;top:-33px;right:0;z-index:100006}.fl-row-overlay.fl-row-menu-active,.fl-row-overlay.fl-row-menu-active.fl-block-overlay.fl-block-overlay-global{z-index:100007}.fl-row-full-width .fl-row-overlay{left:2px;right:2px;bottom:2px}.fl-row-overlay-header-bottom{bottom:-32px!important;top:0}.fl-row-overlay-header-bottom .fl-block-overlay-header{position:absolute;bottom:0}.fl-block-overlay-active .fl-row-content-wrap{position:relative}.fl-block-overlay-active .fl-row-content{position:relative;z-index:100007!important}.fl-builder-row-resizing .fl-col.fl-block-overlay-active,.fl-builder-row-resizing .fl-module.fl-block-overlay-active{position:static}.fl-col-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:8px;cursor:pointer;left:8px;position:absolute;right:8px;top:8px;z-index:100008}.fl-module-overlay{border:2px solid #00A0D2;border-radius:4px;bottom:4px;cursor:pointer;left:4px;min-height:32px;position:absolute;right:4px;top:4px;z-index:100007}.fl-builder-global-templates-locked .fl-block-overlay-global.fl-module-overlay{cursor:default}.fl-module-adjust-height{padding-bottom:15px;padding-top:15px}.fl-block-overlay-global{background:rgba(255,150,0,0);border:2px solid #F7A407;border-radius:4px}.fl-block-overlay-global .fl-block-overlay-actions{background:#F7A407}.fl-block-overlay-title-global{background:#fff;color:#ff9600!important;font-size:11px;letter-spacing:1px;margin-left:4px;padding:2px 4px;vertical-align:top}.fl-block-overlay-global.fl-row-overlay{background:rgba(255,150,0,0);cursor:pointer;z-index:100007}.fl-builder-global-templates-locked .fl-block-overlay-global.fl-row-overlay{cursor:default}.fl-builder-row-template .fl-block-overlay-global.fl-row-overlay{background:rgba(255,150,0,0);cursor:default;z-index:100006}.fl-block-overlay-global.fl-row-overlay .fl-block-col-resize{display:none}.fl-block-overlay-muted .fl-row-overlay{background:rgba(85,93,102,0);border:2px solid #555D66}.fl-block-overlay-muted .fl-row-overlay .fl-block-overlay-actions{background:#555D66}.fl-block-overlay-muted .fl-row-overlay .fl-block-col-resize{display:none}.fl-node-disabled .fl-row-content-wrap,.fl-node-disabled>.fl-col-content{opacity:.3}.fl-block-col-resize{bottom:0!important;position:absolute;top:0!important;width:6px}.fl-block-col-resize-e{cursor:ew-resize;left:auto!important;right:-2px!important}.fl-block-col-resize-w{cursor:ew-resize;left:-7px!important}.fl-block-col-resize-handle-wrap{margin:-4px 0 0 -5px;padding:0 5px;position:absolute;top:50%!important}.fl-block-col-resize-e .fl-block-col-resize-handle-wrap{margin-left:-6px}.fl-block-col-resize-handle{background:#fff;border:2px solid #00A0D2;border-radius:50%;height:12px;width:12px}.fl-node-global .fl-block-col-resize-handle{border-color:#ff9600}.fl-block-col-resize-feedback{color:#333!important;display:none;font-size:11px!important;position:absolute}.fl-block-col-resize-feedback-left,.fl-block-col-resize-feedback-right{background:#fff;border:1px solid #3ba0ff;padding:2px 4px}.fl-block-col-resize-feedback-left{right:20px;top:-7px}.fl-block-col-resize-feedback-right{left:20px;top:-7px}.fl-builder-has-submenu{position:relative}.fl-builder-has-submenu>ul.fl-builder-submenu{background:#00A0D2;box-shadow:0 0 20px rgba(0,0,0,.2);border-radius:0 4px 4px;display:none;left:0;list-style:none;margin:0;padding:6px 0;position:absolute;text-align:left;top:100%;width:165px;z-index:100008}.fl-builder-has-submenu>ul.fl-builder-submenu li{list-style:none;margin:0;padding:0}.fl-builder-submenu-right ul.fl-builder-submenu{left:auto;right:0}.fl-builder-has-submenu.fl-builder-submenu-open>ul.fl-builder-submenu{display:block}.fl-builder-has-submenu>ul.fl-builder-submenu li a{border-bottom:0 none;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;color:#fff!important;display:block;line-height:13px;font-size:13px;font-weight:400;opacity:.8;filter:alpha(opacity=80);overflow:hidden;padding:6px 12px;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.fl-builder-has-submenu>ul.fl-builder-submenu li a:hover{background:#0197C6;color:#fff;opacity:1;filter:alpha(opacity=100);text-decoration:none}.fl-builder-actions-title,.fl-builder-alert-lightbox .fl-lightbox-message{color:#333!important;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:16px!important}.fl-builder-has-submenu .fl-builder-submenu .fa,.fl-builder-has-submenu .fl-builder-submenu .far,.fl-builder-has-submenu .fl-builder-submenu .fas{float:right;height:12px!important;line-height:12px!important;position:relative;right:-5px;width:14px!important}.fl-builder-has-submenu .fl-builder-has-submenu .fl-builder-submenu{display:none;left:100%;top:0}.fl-builder-has-submenu .fl-builder-submenu-right.fl-builder-has-submenu .fl-builder-submenu{left:auto;right:100%}.fl-builder-has-submenu .fl-builder-has-submenu:hover .fl-builder-submenu{display:block}.fl-builder-submenu-sep{padding:7px 0!important}.fl-builder-submenu-sep div{border-bottom:1px solid rgba(255,255,255,.4)}.fl-block-col-move,.fl-block-col-move-parent{cursor:move;position:relative}.fl-builder-submenu .fa-arrows-alt{cursor:move;display:none!important}.fl-builder-submenu a:hover .fa-arrows-alt{display:block!important;float:right;line-height:12px!important;height:12px!important}.fl-block-overlay-global ul.fl-builder-submenu{background:#ff9600!important}.fl-block-overlay-global ul.fl-builder-submenu li a:hover{background:#fa3}.fl-builder-actions-lightbox .fl-lightbox{display:block;width:300px;border-radius:4px}.fl-builder-actions-lightbox .fl-lightbox-content-wrap{display:block}.fl-builder-actions-lightbox .fl-builder-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;padding:25px;text-align:center}.fl-builder-actions-title{display:block;margin-bottom:20px}.fl-builder-actions .fl-builder-button{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;margin-bottom:7px;min-height:36px}.fl-builder-alert-lightbox{padding:20px;z-index:30000000;top:0;pointer-events:auto}.fl-builder-alert-lightbox .fl-lightbox{max-width:440px;width:auto}.fl-builder-alert-lightbox .fl-lightbox-content-wrap{display:block}.fl-builder-alert-lightbox .fl-lightbox-message{line-height:24px;padding:30px}@keyframes fl-builder-content-section-entry{from{transform:translateY(150px) translateX(100px) scale(.3);opacity:0}to{transform:translateY(0) translateX(0) scale(1);opacity:1}}.fl-template-category-select{width:180px!important}.fl-template-selector .fl-builder-settings-section{margin:0 0 10px}.fl-template-selector .fl-builder-settings-fields{height:470px}.fl-template-selector .fl-builder-settings-tab{width:560px}.fl-template-selector .fl-builder-settings-tab-description{font-size:15px!important;margin:0!important;padding:10px 0 25px;text-align:center}.fl-template-preview{float:left;margin:0 25px 30px 0;position:relative;text-align:center;width:170px}.fl-template-preview.fl-last{margin-right:0}.fl-template-image{border:1px solid #d9d9d9;cursor:pointer;margin-bottom:12px;height:164px;overflow:hidden}.fl-template-image:hover{border-color:red}.fl-template-image img{max-height:none;width:100%}.fl-template-preview span{display:block;text-align:center}.fl-user-template-category-name{background:#f2f2f2;border-bottom:3px solid #dfdfdf;border-top:2px solid #dfdfdf;font-weight:700;padding:8px 15px}.fl-user-templates{border-bottom:1px solid #dfdfdf;padding:10px 0 20px}.fl-builder--user-templates-section-content{border-bottom:2px solid #e6eaed;padding:10px}.fl-builder--user-templates-section-content:first-child{padding-top:0}.fl-builder--user-templates-section-content:last-child,.fl-user-templates:last-child{border-bottom:none}.fl-builder--user-templates-section-name{font-weight:700;font-size:16px;color:#333;z-index:9999;padding:15px 10px;margin:0 10px}@keyframes fl-list-item-entry{from{opacity:0;transform:scale(.5) translateY(100px)}to{opacity:1;transform:scale(1) translateY(0)}}.fl-builder--save-new-user-template,.fl-user-template{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:4px;font-size:16px;font-weight:200;line-height:1.1;padding:10px 20px;color:#6d6d6d}.fl-user-template:hover{cursor:pointer;background:#fff;box-shadow:0 6px 20px rgba(0,0,0,.08);text-decoration:none;color:#111;padding-right:68px}.fl-user-template-name{overflow:hidden;text-overflow:ellipsis;-ms-flex:1;flex:1}.fl-user-template-actions{display:none;bottom:0;position:absolute;right:0;top:0}.fl-user-template:hover .fl-user-template-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center}.fl-user-template-actions a{display:inline-block;padding:15px 0;width:30px}.fl-user-template:hover a:hover i{color:#444!important}.fl-user-templates-message{display:none}.fl-user-template-thumbnail{-ms-flex:0;flex:0;margin-right:20px}.fl-user-template-thumbnail .fl-builder--template-thumbnail{background-size:cover;background-position:center top;width:45px}.fl-user-template-thumbnail .fl-builder--template-thumbnail:hover{box-shadow:none;transform:scale(1);transition-property:none}.fl-builder--save-new-user-template .fl-user-template-thumbnail .fl-builder--template-thumbnail{border-style:dashed;border-width:2px;border-color:#ccd4da}.fl-builder--save-new-user-template .fl-save-control{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex:1;flex:1}.fl-builder--save-new-user-template .fl-save-control input{background:0 0;border:none!important;-ms-flex:1;flex:1;font-size:16px;margin-right:10px;margin-left:-12px;color:#000}.fl-builder--save-new-user-template .fl-save-control input::-webkit-input-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input::-moz-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input:-ms-input-placeholder{color:#777}.fl-builder--save-new-user-template .fl-save-control input:-moz-placeholder{color:#777}@keyframes fl-slide-in-right{from{transform:translateX(50px)}to{transform:translateX(0)}}.fl-builder--save-new-user-template .fl-save-control button{display:none;animation-name:fl-slide-in-right;animation-duration:.25s;background-color:#00a0d2;border:none;padding:0 15px}.fl-save-control-mask{display:none;background:0 0;position:absolute;top:-50px;left:0;bottom:0;right:0;z-index:-1;min-height:80vh}.fl-builder-templates-cta{margin-bottom:20px}.fl-builder-templates-cta p{display:inline-block!important;width:75%!important;font-size:14px!important;line-height:1.5!important;margin-bottom:0!important}.fl-builder-templates-cta .fl-builder-upgrade-button{font-size:13px!important;line-height:13px!important;position:relative;top:8px;left:15px;padding:1px 12px}.fl-builder-settings-message,.fl-builder-settings-message *{font-size:15px!important;line-height:23px!important}.single-fl-builder-template .fl-content{width:100%!important}form.fl-builder-settings{height:100%;margin:0;padding:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.fl-builder-settings-message{padding:20px 25px!important;background:#f2f2f2!important}.fl-builder-preview-loader{position:relative;top:-2px;margin-left:3px}.fl-lightbox-header .fl-builder-preview-loader{margin:0;position:absolute;right:40px;top:15px}@keyframes fl-grab-attention{0%,100%{transform:scale(1)}50%{transform:scale(1.05)}}.fl-lightbox-width-slim .fl-form-table{margin:20px 25px 10px 15px!important;width:calc(100% - 60px)}.fl-lightbox-width-slim .fl-form-table th{display:block;padding:10px 0 0 12px!important}.fl-lightbox-width-slim .fl-form-table td{display:block}.fl-lightbox-width-slim .fl-form-table td:first-child{padding-left:10px!important}.fl-lightbox-width-slim .fl-form-table .fl-field[data-type=editor] td:first-child{padding-left:0!important}.fl-field-label .fl-field-responsive-toggle,.fl-lightbox-width-slim .fl-field-control-wrapper .fl-field-responsive-toggle{display:none}.fl-lightbox-width-slim .fl-field-label .fl-field-responsive-toggle{display:inline-block;padding:0 5px!important}.fl-lightbox-width-slim .fl-builder-settings-fields select{width:100%}.fl-lightbox-width-slim .fl-color-picker{display:-ms-flexbox;display:flex;width:auto}.fl-lightbox-width-slim .fl-color-picker-clear{-ms-flex:0 0 50px;flex:0 0 50px}.fl-lightbox-width-slim .mce-menubtn.mce-fixed-width button{width:28px!important}.fl-lightbox-width-slim .mce-btn[aria-label=Blockquote],.fl-lightbox-width-slim .mce-btn[aria-label=Fullscreen]{display:none}.fl-lightbox-width-slim .fl-builder-field-multiple{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;position:relative}.fl-lightbox-width-slim .fl-builder-field-multiple .fl-field-control,.fl-lightbox-width-slim .fl-builder-field-multiple .fl-field-label{width:100%!important}.fl-lightbox-width-slim .fl-builder-field-multiple .fl-builder-field-actions{position:absolute!important;top:0;right:0;width:70px}.fl-lightbox-width-slim .fl-field[data-type=time] select{width:auto}.fl-builder-settings-tabs{margin:6px;border:2px solid #e6eaed;border-radius:4px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;overflow:hidden}.fl-builder-content-group-select{padding:0 10px 6px;display:none}.fl-builder-content-group-select select{display:block;width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;padding:8px 10px;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;border:2px solid #e4e7ea;color:#161B20}select:focus{border-width:2px!important;border-style:solid!important;border-color:#00a0d2!important;outline:0!important}.fl-legacy-settings-tab{background:url(../img/ajax-loader.svg) center center no-repeat;height:100px}.fl-builder-settings-tab:first-child .fl-legacy-settings-tab{background:0 0;height:auto}body .fl-builder-settings-tabs>*{box-sizing:border-box;color:#676F7A!important;fill:#676F7A!important;background:0 0;border:2px solid transparent;border-radius:0;margin:0;outline:0;padding:6px 15px;text-decoration:none!important;font-size:14px;font-weight:400!important;-ms-flex:0 0 auto;flex:0 0 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;text-align:center}.fl-builder-settings-tabs-more g,.fl-builder-settings-tabs-more path,.fl-builder-settings-tabs-more svg,.fl-color-picker-color.fl-color-picker-empty svg.fl-color-picker-icon path{fill:inherit}body .fl-builder-settings-tabs>:first-child{border-top-left-radius:3px;border-bottom-left-radius:3px}body .fl-builder-settings-tabs>:last-child{border-top-right-radius:3px;border-bottom-right-radius:3px}body .fl-lightbox-width-slim .fl-builder-settings-tabs>*{-ms-flex:1 1 auto;flex:1 1 auto;padding:6px 8px}body .fl-builder-settings-tabs>.fl-builder-settings-tabs-more{-ms-flex:0 0 60px;flex:0 0 60px;display:none;margin-left:auto;-ms-flex-pack:center;justify-content:center}.fl-builder-settings-tabs-more svg{width:16px;height:auto;margin:auto}body .fl-lightbox-has-tab-overflow .fl-builder-settings-tabs-more{display:-ms-flexbox;display:flex}.fl-builder-settings-tabs>:active,.fl-builder-settings-tabs>:hover{top:0;color:#333;background:0 0;border:2px solid transparent}.fl-builder-settings-tabs>:focus{top:0;outline:0;border:2px solid transparent;background:0 0;color:#0086b0;fill:#0086b0}.fl-builder-settings-tabs .fl-active,.fl-builder-settings-tabs-more.fl-contains-active,.fl-builder-settings-tabs-overflow-menu .fl-active{color:#0086b0!important;fill:#0086b0!important;position:relative;background:#e6eaed}.fl-builder-settings-tabs .fl-active.fl-overflowed,.fl-builder-settings-tabs .fl-overflowed{display:none!important}.fl-builder-settings-tabs .error{color:#d03436;padding-right:10px}.fl-builder-settings-tabs .error .fl-error-icon,.fl-builder-settings-tabs-overflow-menu .error .fl-error-icon{background:url(../img/sprite.png) -148px -5px no-repeat;display:inline-block;height:16px;margin-left:7px;position:relative;top:3px;width:16px}.fl-builder-settings-tabs-more.fl-contains-errors{fill:#d03436!important}.fl-builder-settings-tab{display:none;width:auto!important}.fl-builder-settings-tab.fl-active{display:block}.fl-builder-settings-tab-description{background:#e4e7ea;padding:10px 15px;border-radius:4px;margin:20px}.fl-builder-settings-tab-description a{text-decoration:underline!important}.fl-builder-settings-tab-description a:hover{color:#333}.fl-builder-settings-tabs-overflow-menu{display:none;position:absolute;left:0;right:0;border:2px solid #e6eaed;border-top:3px solid #00a0d2;border-radius:4px;background:#fff;z-index:9999;margin:0 6px;padding:10px;-ms-flex-direction:column;flex-direction:column;box-shadow:0 0 20px 2px rgba(0,0,0,.2)}.fl-builder-settings-tabs-overflow-menu:before{bottom:100%;right:20px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#00a0d2;border-width:10px;margin-left:-10px}.fl-builder-settings-tabs-overflow-menu>a{display:block;padding:10px 15px;font-size:14px;font-weight:600!important;border:2px solid transparent;border-radius:4px;outline:0}.fl-builder-settings-tabs-overflow-menu>a:hover{background:#e6eaed;text-decoration:none}.fl-builder-settings-tabs-overflow-click-mask{display:none;position:fixed;top:0;bottom:0;left:0;right:0;background:0 0;z-index:9}.fl-form-table{background:none;border:none;width:calc(100% - 35px)}.fl-form-table tbody{border:none}.fl-form-table tr,.fl-form-table tr:nth-child(even){background:0 0}.fl-form-table td,.fl-form-table th{background:0 0!important;border:none!important;font-weight:400!important;text-align:left!important}.fl-form-table th{padding:10px 10px 10px 30px!important;vertical-align:top!important;width:200px!important}.fl-form-table td:first-child{padding-left:30px!important}.fl-form-table th label{color:#333;width:auto;max-width:100%}.fl-photo-field .fl-photo-preview-img img,.fl-video-field .fl-video-preview-img img{max-width:60px}.fl-form-table td{padding:8px 10px}.fl-lightbox-width-slim .fl-form-table td{padding:4px 0 10px}.fl-builder-settings-fields{margin:0;overflow:hidden;position:relative;-ms-flex:1 100%;flex:1 100%;visibility:hidden}.fl-lightbox-header .fl-builder-settings-fields{height:auto;margin:0;position:absolute;right:10px;top:10px}.fl-builder-settings-fields .fl-nanoscroller-content{padding:0}.fl-builder-settings-fields .fl-field-control-wrapper{position:relative}.fl-field{animation-delay:.1s}.fl-builder-settings-fields input[type=email],.fl-builder-settings-fields input[type=file],.fl-builder-settings-fields input[type=number],.fl-builder-settings-fields input[type=password],.fl-builder-settings-fields input[type=search],.fl-builder-settings-fields input[type=tel],.fl-builder-settings-fields input[type=text],.fl-builder-settings-fields input[type=url],.fl-builder-settings-fields select,.fl-builder-settings-fields textarea{background:#fff!important;border-color:transparent!important;border-style:solid;border-width:2px;border-radius:4px!important;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);color:#333!important;display:inline;font-size:13px;height:auto;line-height:15px;margin:1px;outline:0;padding:3px 9px;width:auto;box-sizing:border-box}.fl-builder-settings-fields input[type=email],.fl-builder-settings-fields input[type=file],.fl-builder-settings-fields input[type=number],.fl-builder-settings-fields input[type=password],.fl-builder-settings-fields input[type=search],.fl-builder-settings-fields input[type=tel],.fl-builder-settings-fields input[type=text],.fl-builder-settings-fields input[type=url],.fl-builder-settings-fields select{height:36px!important}.fl-builder-settings-fields input[type=number]{width:70px}.fl-builder-lightbox .fl-builder-settings-fields input[type=email]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=file]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=number]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=password]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=search]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=tel]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=text]:focus,.fl-builder-lightbox .fl-builder-settings-fields input[type=url]:focus,.fl-builder-lightbox .fl-builder-settings-fields select:focus,.fl-builder-lightbox .fl-builder-settings-fields textarea:focus{border-width:2px!important;border-style:solid!important;border-color:#00a0d2!important;box-shadow:0 2px 4px 0 rgba(0,0,0,.12)!important}.fl-builder-settings-fields ::-webkit-input-placeholder{color:#999!important;font-size:13px}.fl-builder-settings-fields input:-moz-placeholder{color:#999;font-size:13px}.fl-builder-settings-fields ::-moz-placeholder{color:#999!important;font-size:13px}.fl-builder-settings-fields input:-ms-input-placeholder{color:#999;font-size:13px}.fl-builder-settings-fields label{display:inline-block;font-weight:400;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-bottom:3px}.fl-builder-settings-fields select{-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;color:#000;margin:0 0 2px;padding:2px 10px;padding-right:30px!important;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important}.fl-builder-settings-fields select[multiple]{height:60px;background-image:none!important}.fl-builder-custom-field select,.fl-photo-field select{-webkit-box-shadow:none;border-color:#e6eaed!important}.fl-font-field .fl-font-field-font{margin-bottom:4px;width:calc(70% - 5px)!important}.fl-font-field .fl-font-field-weight{width:30%!important}.fl-lightbox-width-slim input.text-full+.fl-field-description,.fl-lightbox-width-slim select+.fl-field-description{display:block;padding:8px 10px;margin:0}.fl-field[data-type=dimension] .fl-field-control-wrapper{display:-ms-flexbox;display:flex}.fl-field[data-type=dimension] .fl-field-description{padding-top:9px}.fl-field[data-type=dimension] .fl-field-responsive-toggle{padding:9px 9px 0 0}.fl-dimension-field-units{display:-ms-flexbox;display:flex}.fl-dimension-field-unit{padding-right:5px}.fl-dimension-field-unit input{max-width:60px;width:auto!important}.fl-dimension-field-unit label{padding:5px 0 0;font-size:12px;color:inherit!important;display:block;text-align:center}.fl-link-field-search input{box-shadow:none!important;width:100%!important;padding:3px 9px!important}.fl-link-field-search #as-original-link-search{width:100%}.fl-builder-settings-section{border-top:2px solid #E6EAED}.fl-builder-settings-section:first-child{border-top:none!important}.fl-custom-query .fl-builder-settings-section{border-top:2px solid #E6EAED!important}.fl-builder-settings-description{padding:0 10px 10px;margin:0;font-style:italic;opacity:.75}.fl-builder-settings-fields table{margin:20px 0}.fl-builder-settings-fields h3.fl-builder-settings-title{display:inline-block;background:#E6EAED;padding:4px 10px 4px 15px;margin:0;text-transform:uppercase!important;border-bottom-right-radius:4px;font-size:12px!important;font-weight:700;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.wp-core-ui h1,.wp-core-ui h2,.wp-core-ui h3,.wp-core-ui h4,.wp-core-ui h5,.wp-core-ui h6{color:#333}.wp-core-ui .submitbox .submitdelete{color:#a00}.wp-core-ui button{font-weight:400}.wp-core-ui input[type=email],.wp-core-ui input[type=file],.wp-core-ui input[type=number],.wp-core-ui input[type=password],.wp-core-ui input[type=search],.wp-core-ui input[type=tel],.wp-core-ui input[type=text],.wp-core-ui input[type=url],.wp-core-ui select,.wp-core-ui textarea{background-color:#fff;border-color:#dfdfdf;border-style:solid;border-width:1px;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;box-shadow:none;-moz-box-shadow:none;-webkit-box-shadow:none;color:#333;font-weight:400}.wp-core-ui input[type=email]:focus,.wp-core-ui input[type=file]:focus,.wp-core-ui input[type=number]:focus,.wp-core-ui input[type=password]:focus,.wp-core-ui input[type=search]:focus,.wp-core-ui input[type=tel]:focus,.wp-core-ui input[type=text]:focus,.wp-core-ui input[type=url]:focus,.wp-core-ui select:focus,.wp-core-ui textarea:focus{background:0 0;border-color:#aaa}.wp-core-ui input[type=search]{background-image:none;padding:6px}.fl-field-responsive-setting{display:inline-block}.fl-field-responsive-setting-medium,.fl-field-responsive-setting-responsive{display:none}i.fl-field-responsive-toggle{color:grey;cursor:pointer;display:inline-block;font-size:15px!important;height:auto;line-height:18px!important;text-align:left;vertical-align:middle;width:20px}i.fl-field-responsive-toggle:hover{color:#000}.fl-builder-settings-fields input.text-full,.fl-builder-settings-fields textarea{width:100%}.fl-color-picker{cursor:pointer}.fl-color-picker .fl-color-picker-clear{box-sizing:border-box}.fl-color-picker .fl-color-picker-clear:hover{background-color:#ededed}.colorpicker input{padding:0!important;font-size:11px!important;color:#fff!important;width:29px!important;height:auto!important;background:0 0!important;border:none!important}.colorpicker .colorpicker_hex input{width:45px!important}.fl-builder-custom-field{background:#fff;border:2px solid transparent;border-radius:4px;padding:7px 10px;box-shadow:0 2px 4px 0 rgba(0,0,0,.12);min-height:36px;box-sizing:border-box}.fl-builder-field-multiple .fl-builder-custom-field{cursor:move}.fl-builder-custom-field a{color:#21759b!important;text-decoration:underline!important}.fl-builder-custom-field a:hover{color:#d54e21!important}.fl-builder-custom-field label.error{margin-top:5px}.fl-photo-field .fl-photo-preview{display:-ms-flexbox;display:flex}.fl-photo-field .fl-photo-select,.fl-photo-field.fl-photo-empty .fl-photo-preview{display:none}.fl-photo-field.fl-photo-empty .fl-photo-select{display:block}.fl-photo-field .fl-photo-preview-img{line-height:0;margin:5px 0}.fl-photo-field .fl-photo-preview select{margin:8px 0 8px 10px;width:200px}.fl-photo-field.fl-photo-no-attachment .fl-photo-preview select{display:none}.fl-photo-field .fl-photo-preview-filename{display:none;font-size:14px;font-weight:700;margin:7px 0 5px 11px}.fl-photo-field.fl-photo-no-attachment .fl-photo-preview-filename{display:inline-block;word-break:break-all}.fl-multiple-photos-field .fl-multiple-photos-select,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-add,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-count,.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-edit,.fl-multiple-photos-lightbox .gallery-settings,.fl-photo-field.fl-photo-no-attachment .fl-photo-edit{display:none}.fl-photo-field .fl-photo-edit{margin:0 0 0 11px}.fl-multiple-photos-field .fl-multiple-photos-add,.fl-photo-field .fl-photo-remove,.fl-photo-field .fl-photo-replace{margin:0 0 0 8px}.fl-builder-edit .media-modal{z-index:9999991}.fl-builder-edit .media-modal-backdrop{z-index:999999}.fl-builder-edit .media-frame{-webkit-backface-visibility:hidden}.fl-builder-edit .media-modal-content h1{font-family:inherit}.fl-builder-edit .media-modal-content .thumbnail{padding:0;border:none;border-radius:0}.fl-builder-edit button.button-link.media-modal-close{position:absolute;box-shadow:none;-webkit-box-shadow:none}.fl-builder-edit .media-frame.hide-menu{visibility:visible}span.select2-container.select2-container--open{z-index:9999999}.fl-multiple-photos-field.fl-multiple-photos-empty .fl-multiple-photos-select{display:inline}.fl-multiple-photos-count{font-weight:700;margin-bottom:3px}.fl-video-field .fl-video-select,.fl-video-field.fl-video-empty .fl-video-preview{display:none}.fl-video-field.fl-video-empty .fl-video-select{display:block}.fl-video-field .fl-video-preview-img{float:left;line-height:0;margin:5px 0}.fl-video-field .fl-video-preview-img .dashicons.dashicons-media-video{display:block;font-size:60px;height:60px;line-height:60px;width:60px}.fl-video-field .fl-video-preview-filename{display:inline-block;font-size:14px;font-weight:700;margin:7px 0 5px 11px}.fl-video-field .fl-video-remove,.fl-video-field .fl-video-replace{margin:0 0 0 11px}.fl-multiple-audios-field .fl-multiple-audios-select,.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-add,.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-edit{display:none}.fl-multiple-audios-field.fl-multiple-audios-empty .fl-multiple-audios-select{display:block}.fl-multiple-audios-field .fl-multiple-audios-add{margin:0 0 0 8px}.fl-icon-field .fl-icon-select,.fl-icon-field.fl-icon-empty .fl-icon-preview{display:none}.fl-icon-field.fl-icon-empty .fl-icon-select{display:block}.fl-icon-field .fl-icon-preview i{display:inline-block;font-size:28px;margin:10px 10px 9px;vertical-align:middle}.fl-icon-field .fl-icon-remove{margin:0 0 0 8px}.fl-builder-hidden-editor{display:none}.fl-builder-settings .wp-switch-editor{background:#ebebeb;border:1px solid #e5e5e5;border-radius:0;color:#333}.fl-builder-settings .wp-editor-container{border:1px solid #e5e5e5}.fl-builder-settings .mce-toolbar .mce-btn-group .mce-btn{margin:2px 0}.fl-builder-settings .mce-menubtn.mce-fixed-width button{width:100px}.fl-builder-settings .mce-menubtn.mce-fixed-width span{width:100%}.mce-close:active,.mce-close:hover,.mce-toolbar .mce-btn button:active,.mce-toolbar .mce-btn button:hover,.mce-window .mce-btn button:active,.mce-window .mce-btn button:hover{background:0 0;border:none}.mce-ico{font-family:tinymce,Arial!important}.mce-toolbar i.mce-ico{font:400 20px/1 dashicons!important}.fl-builder-edit form#wp-link,.popover[class*=tour-],ul.as-list{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}.wp-core-ui .quicktags-toolbar input.button.button-small{margin:1px!important}.wp-editor-container textarea.wp-editor-area{background:0 0;border:none;padding:10px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}.fl-builder-edit form#wp-link{color:#000;font-size:13px}.fl-builder-edit form#wp-link #link-options label{display:block;margin-bottom:2px}.fl-builder-edit form#wp-link #link-options label span{padding-right:10px;vertical-align:middle}.fl-builder-edit form#wp-link #link-options input[type=text]{display:inline-block;height:auto;margin:5px 0 0;padding:3px 5px;width:80%}.fl-builder-edit form#wp-link .query-results{top:225px}.fl-code-field{border:1px solid #E6E6E6;border-left:none}.ace_editor,.ace_editor *{font-family:Monaco,Menlo,"Ubuntu Mono","Droid Sans Mono",Consolas,monospace!important;font-size:12px!important;font-weight:400!important;letter-spacing:0!important}.fl-layout-field-option{border:2px solid #d9d9d9;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;box-sizing:border-box!important;-moz-box-sizing:border-box!important;-webkit-box-sizing:border-box!important;cursor:pointer;float:left;line-height:0;max-width:23%;margin:0 1% 2%;padding:5px}.fl-layout-field-option-selected,.fl-layout-field-option:hover{border-color:red}.fl-layout-field-option img{max-width:100%}.fl-link-field .fl-link-field-input-wrap{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-link-field-input{width:auto!important;-ms-flex:1 1 100%;flex:1 1 100%}.fl-link-field .fl-link-field-input-wrap button{-ms-flex:0 0 0%;flex:0 0 0%;margin-left:5px}.fl-link-field-search{display:none;border:2px solid #e6eaed;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;margin:4px 0 0;padding:10px}.fl-link-field-search-title{display:block;margin:0 0 3px 2px}.fl-link-field-search-cancel{margin-top:6px}.fl-help-tooltip{display:inline-block;position:relative}.fl-help-tooltip-icon{color:#999!important;cursor:pointer;font-size:15px!important;padding:5px;vertical-align:middle}.fl-help-tooltip-text{background:#fff;border:1px solid #ccc;box-shadow:0 0 5px #ccc;-moz-box-shadow:0 0 5px #ccc;-webkit-box-shadow:0 0 5px #ccc;display:none;font-weight:400;left:23px;padding:10px 13px;position:absolute;top:-6px;width:250px;z-index:1000;border-radius:4px}.fl-lightbox-width-slim .fl-help-tooltip-text{top:26px;left:-30px}.fl-field-control .fl-form-field{margin-bottom:0}.fl-form-field-preview-text i{display:inline-block;font-size:18px;line-height:22px;margin-bottom:5px}.fl-builder-field-actions{padding-left:0!important;padding-right:0!important;text-align:center;width:85px}.fl-builder-field-actions i{color:#999!important;cursor:pointer;font-size:13px!important;line-height:29px!important;width:16px}.fl-builder-field-actions i:hover{color:#000!important}.fl-builder-field-actions i.fl-builder-field-copy,.fl-builder-field-actions i.fl-builder-field-delete{margin-left:5px}.fl-builder-field-actions i.fl-builder-field-move{cursor:move}.fl-builder-field-dd-helper{background:#ccc;height:30px!important;float:left;width:130px!important}.fl-builder-field-dd-zone{border:1px dashed #ccc;height:30px}.fl-builder-field-actions-single .fl-builder-field-delete,.fl-builder-field-actions-single .fl-builder-field-move{display:none!important}.fl-lightbox-width-slim .fl-builder-field-actions-single .fl-builder-field-copy{float:right!important}.fl-builder-field-multiple .fl-builder-field-actions,.fl-builder-field-multiple .fl-field-control,.fl-builder-field-multiple .fl-field-label{padding-top:2px!important;padding-bottom:2px!important}.fl-builder-field-multiple .fl-builder-field-actions{min-width:70px!important}.fl-builder-field-multiple[data-field=icons] .fl-builder-field-actions{width:70px!important}.fl-builder-field-multiple.ui-sortable-helper .fl-field-control{width:60%}.fl-builder-field-multiple.ui-sortable-helper .fl-builder-field-actions{display:none}.fl-builder-widget-settings input{display:inline-block!important;margin:5px 10px 8px!important}.fl-builder-lightbox-loading{background:url(../img/ajax-loader.svg) center center no-repeat;height:100px}.fl-builder-settings .error,.fl-builder-settings input.error{color:#d03436!important}.fl-builder-settings label.error,.fl-builder-settings p.error{color:#d03436;display:block;margin-top:5px}.fl-builder-settings .fl-form-table .fl-field-description{color:#464646;font-style:normal;margin-left:2px}.fl-lightbox .fl-field-connection{right:-1px}.fl-lightbox .fl-field-connection-content{border:2px solid transparent!important;background:#e4e7ea!important}.fl-field-connection-content .fl-field-connection-label{color:#676f7a!important}ul.as-selections{background-color:#fff;border:none;border-radius:4px;box-shadow:none;color:#333;font-size:12px;height:auto;line-height:15px;margin:1px;outline:0;padding:3px;width:auto}ul.as-selections.loading{background:url(../img/ajax-loader-small.svg) 98% center no-repeat}ul.as-selections li.as-selection-item{background:#d4eaf6;border:none;font-size:11px;line-height:14px;padding:8px 15px;border-radius:4px;margin:2px}ul.as-selections li.as-selection-item.blur{background:#f4f4f4}ul.as-selections li.as-selection-item a.as-close{line-height:12px}ul.as-selections li.as-original{margin:0}ul.as-selections li.as-original input{height:auto;font-size:12px;margin:0;padding:0;box-shadow:none}ul.as-list{margin:0;font-size:13px;color:#000;background-color:#fff;background-color:rgba(255,255,255,.95);z-index:2;box-shadow:0 0 10px rgba(0,0,0,.1);border:none;border:1px solid #dfdfdf;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}li.as-message,li.as-result-item{border:none}li.as-result-item.active{background:#e5e5e5;border-radius:0;color:#333;text-shadow:none}li.as-result-item em{background:0 0!important;color:#333!important;font-size:12px;padding:0!important;font-weight:700}.fl-custom-query-filter{display:none}.fl-custom-query .fl-field[data-type=suggest] select{margin-bottom:5px;width:100%}.fl-builder-service-settings{position:relative}.fl-builder-service-error{color:red!important;padding:15px 0 0}.fl-builder-service-account-delete{color:red!important;margin-left:10px;position:relative;top:2px}#fl-field-visibility_user_capability .fl-field-description,.fl-builder-service-connect-row .fl-field-description{background:#f0f0f0;color:#333!important;display:block;float:none;margin:10px 0 0;padding:10px}#fl-field-visibility_user_capability .fl-field-description a,.fl-builder-service-connect-row .fl-field-description a{color:#21759b!important;text-decoration:underline!important}.fl-ordering-field-option{background:#fff;border:1px solid #dfdfdf;border-radius:3px;cursor:move;margin-bottom:5px;padding:5px 10px}.fl-ordering-field-option .fa{color:#ccc;float:right;line-height:16px}#tiptip_holder{z-index:1000000}#tiptip_holder.tip_top #tiptip_arrow_inner{border-top-color:#333}#tiptip_holder.tip_bottom #tiptip_arrow_inner{border-bottom-color:#333}#tiptip_holder.tip_right #tiptip_arrow_inner{border-right-color:#333}#tiptip_holder.tip_left #tiptip_arrow_inner{border-left-color:#333}#tiptip_content{background:#333;box-shadow:none}.fl-builder-getting-started-video{line-height:0!important;padding:10px}.fl-builder-getting-started-video iframe{border:none;height:326px;width:100%}.fl-builder-tour-actions .fl-builder-actions-title{font-size:14px!important;line-height:19px}.fl-builder-tour-mask{bottom:0;left:0;position:fixed;right:0;top:0;z-index:100000000}.fl-builder-tour-dimmed{background:rgba(0,0,0,.7);bottom:0;left:0;position:absolute;right:0;top:0}body>.fl-builder-tour-dimmed{position:fixed}.tour-backdrop{z-index:110000}.popover[class*=tour-]{border:1px solid #ccc;border-radius:0;box-shadow:0 0 40px rgba(0,0,0,.3);color:#666;font-size:13px;font-weight:400;line-height:18px;max-width:none;padding:0;width:300px;z-index:100000001}.popover[class*=tour-].bottom>.arrow{border-bottom-color:#ccc}.popover[class*=tour-].bottom>.arrow:after{border-bottom-color:#f7f7f7}.popover[class*=tour-] .popover-title{border-radius:0;color:#333;letter-spacing:normal;text-transform:none}.popover[class*=tour-] .fa-times{color:#b3b3b3;cursor:pointer;font-size:16px;padding:5px;position:absolute;right:3px;top:2px}.popover[class*=tour-] .fa-times:hover{color:#666}.popover[class*=tour-] .popover-content{border-bottom:1px solid #d9d9d9;padding:13px 15px}.popover[class*=tour-] .fl-builder-tour-next{display:block;float:none;width:100%}.popover-navigation button{min-height:36px}.fl-builder-shortcode-mask-wrap{position:relative}.fl-builder-shortcode-mask{bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px;z-index:1}.fl-builder--search{border:2px solid transparent;position:relative;padding:0;width:54px;transition-property:width;transition-delay:.1s;transition-duration:.15s}.fl-builder--search.is-expanded{border:2px solid #00A0D0}.fl-builder--search input[type=text],.fl-builder--search input[type=text]:focus{background-color:transparent;border:none!important;box-sizing:border-box;width:100%;font-size:16px;text-align:center}.fl-builder--search:before{display:-ms-flexbox;display:flex;top:0;left:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;content:"\f002";font:normal normal normal 14px/1 Font Awesome\ 5 Free;text-align:center;width:100%;height:100%;position:absolute;pointer-events:none;color:rgba(128,128,128,.6);font-size:17px;opacity:1;transition-property:opacity;transition-duration:.15s}.fl-builder--main-menu-panel,.fl-builder-ui-keyboard-shortcuts{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important}.fl-builder--search.has-text:before,.fl-builder--search.is-expanded:before{opacity:0}.fl-builder--search input::-webkit-input-placeholder{color:rgba(128,128,128,0)!important;transition:color .25s}.fl-builder--search input:focus::-webkit-input-placeholder{color:rgba(128,128,128,.4)!important}.fl-builder--search .search-label{cursor:text}.fl-builder--search .search-clear{display:none;padding:10px 10px 10px 30px;color:#a7a7a7;font-size:12px;position:absolute;right:0;top:0;background-color:#eff1f2;background:linear-gradient(to left,#e4e7ea,#e4e7ea 75%,rgba(228,231,234,0))}.fl-builder--search.has-text .search-clear,.fl-builder--search.is-expanded input{display:inline-block}.fl-builder--search:hover .search-clear{color:#888;background-color:#eff1f2;background:linear-gradient(to left,#dadfe5,#dadfe5 75%,rgba(218,223,229,0))}.fl-builder--search.is-expanded{width:246px}@keyframes fl-builder-show-menu-item{from{transform:translateY(10px) scale(.8);opacity:0}to{transform:translateX(0) translateY(0) scale(1);opacity:1}}.fl-builder--main-menu-panel{display:none;box-sizing:border-box;position:fixed;top:calc(48px + 10px);left:10px;width:360px;color:#222;max-height:calc(100% - 66px);border-radius:4px;background:#fff;border:2px solid #D5DADD;border-top:3px solid #00a0d2;box-shadow:0 15px 45px 8px rgba(0,0,0,.04);font-size:14px!important;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10000009;pointer-events:auto}.fl-builder--main-menu-panel.is-showing{display:-ms-flexbox;display:flex}.fl-builder--main-menu-panel:before,.fl-theme-builder-preview-select-open .fl-theme-builder-preview-select-items:before{bottom:100%;right:6px;content:" ";height:0;width:0;position:absolute;pointer-events:none;border:solid;border-color:rgba(255,255,255,0);border-bottom-color:#00a0d2;border-width:13px;margin-left:-13px}.fl-builder--main-menu-panel-views{-ms-flex:1 1 100%;flex:1 1 100%;overflow:auto}.fl-builder--main-menu-panel-mask{display:none;position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000119}.fl-builder--main-menu-panel .fl-builder--tabs{padding-left:20px;padding-top:15px}.fl-builder--main-menu-panel-view{display:none}.fl-builder--main-menu-panel-view.is-showing{display:block}.fl-builder--main-menu-panel-view-title{font-size:24px;font-weight:600;padding:25px 22px 0;line-height:1;white-space:nowrap}.fl-builder--main-menu-panel-view-title .title-accessory{float:right;color:#b1b1b1}.fl-builder--main-menu-panel-view-title .title-accessory>i{font-size:20px!important;width:25px!important}.fl-builder--main-menu-panel-view-title .title-accessory>i:hover{color:#222}.fl-builder--main-menu-panel-view-title .pop-view{padding:10px;margin-left:-10px;opacity:.5;font-size:25px;font-weight:400;cursor:pointer;background:0 0;outline:0;border:none;color:inherit}.fl-builder--main-menu-panel-view-title .pop-view:focus{outline:0;top:0;background:#E5EAED!important}.fl-builder--menu-item:before{display:block;content:"";float:none;clear:both}.fl-builder--menu-item{color:inherit;text-align:left;box-sizing:border-box;display:block;padding:10px 15px;margin:0 10px;width:calc(100% - 20px);background:0 0;border:none;border-radius:4px;font-size:14px;line-height:1.1;cursor:pointer;opacity:1}.fl-builder--menu-item:hover{background:#eaf1f8;border:none;text-decoration:none;color:#000}.fl-builder--selector-menu .fl-builder--menu-item:hover{background:#fff}.fl-builder--menu-item-accessory{float:right;text-align:center;display:inline-block;min-width:40px;font-size:14px}.fl-builder--menu-item-accessory.view-arrow{font-size:18px}.fl-builder--menu{padding:0;margin:20px 0}.fl-builder--menu hr{margin:8px 0;background-color:#e6eaed!important;height:2px;border:none}.fl-builder--menu .fl-builder-video-wrap{padding:0 10px 10px}.fl-revision-list-item{display:-ms-flexbox;display:flex}.fl-revision-list-item-text{padding-left:15px}.fl-revision-list-item-date{padding-bottom:5px}.fl-builder--revision-actions{display:none;position:fixed;top:4px;left:4px;z-index:100008;padding:4px 4px 6px;-ms-flex-pack:center;justify-content:center;background:#fff;border-radius:4px}.fl-builder--revision-actions *{margin-right:5px}.fl-builder--revision-actions :last-child{margin:0}.fl-builder--menu-item[data-event=noRevisionsMessage]:hover{background:0 0;box-shadow:none;cursor:default}.fl-no-revisions-message-title{font-weight:700;margin-bottom:10px}.fl-no-revisions-message-text{line-height:22px}.fl-builder-module-placeholder-message{border:1px dashed #ccc;overflow:hidden;padding:20px;text-align:center;text-overflow:ellipsis;white-space:nowrap}.fl-field-connections-menu{z-index:999999}.fl-field-connections-toggle{right:-30px!important}.fl-builder-add-ultimate-presets-button,.fl-builder-add-ultimate-rows-button,.fl-builder-pp-add-template-button,.pp-preview-button,.uabb-live-preview-button{display:none!important}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none;background:0 0;transition-property:background;transition-duration:.15s}.ui-resizable-autohide .ui-resizable-handle,.ui-resizable-disabled .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-ne,.ui-resizable-nw,.ui-resizable-se,.ui-resizable-sw{width:12px;height:12px}.ui-resizable-se{cursor:se-resize;right:-4px;bottom:-4px}.ui-resizable-sw{cursor:sw-resize;left:-4px;bottom:-4px}.ui-resizable-nw{cursor:nw-resize;left:-4px;top:-4px}.ui-resizable-ne{cursor:ne-resize;right:-4px;top:-4px}.fl-builder-resizable-iframe-fix{position:absolute;top:0;right:0;bottom:0;left:0;z-index:100000000}.fl-builder-panel .ui-resizable-handle:active,.fl-builder-panel .ui-resizable-handle:hover,.fl-lightbox .ui-resizable-handle:active,.fl-lightbox .ui-resizable-handle:hover{background:#00a0d2}.fl-builder-panel .ui-resizable-n,.fl-builder-panel .ui-resizable-s,.fl-lightbox .ui-resizable-n,.fl-lightbox .ui-resizable-s{height:6px}.fl-builder-panel .ui-resizable-n,.fl-lightbox .ui-resizable-n{top:-3px}.fl-builder-panel .ui-resizable-s,.fl-lightbox .ui-resizable-s{bottom:-3px}.fl-builder-panel .ui-resizable-e,.fl-builder-panel .ui-resizable-w,.fl-lightbox .ui-resizable-e,.fl-lightbox .ui-resizable-w{width:6px}.fl-builder-panel .ui-resizable-e,.fl-lightbox .ui-resizable-e{right:-3px}.fl-builder-panel .ui-resizable-w,.fl-lightbox .ui-resizable-w{left:-3px}.fl-lightbox .ui-resizable-ne,.fl-lightbox .ui-resizable-nw,.fl-lightbox .ui-resizable-se,.fl-lightbox .ui-resizable-sw{background:0 0;border:6px solid transparent}.fl-lightbox .ui-resizable-ne:active,.fl-lightbox .ui-resizable-ne:hover,.fl-lightbox .ui-resizable-nw:active,.fl-lightbox .ui-resizable-nw:hover,.fl-lightbox .ui-resizable-se:active,.fl-lightbox .ui-resizable-se:hover,.fl-lightbox .ui-resizable-sw:active,.fl-lightbox .ui-resizable-sw:hover{background:0 0;border-color:#00a0d2}.fl-lightbox .ui-resizable-ne{border-bottom:none;border-left:none;border-top-right-radius:4px}.fl-lightbox .ui-resizable-nw{border-bottom:none;border-right:none;border-top-left-radius:4px}.fl-lightbox .ui-resizable-se{border-top:none;border-left:none;border-bottom-right-radius:4px}.fl-lightbox .ui-resizable-sw{border-top:none;border-right:none;border-bottom-left-radius:4px}.fl-builder-ui-keyboard-shortcuts{display:none;position:fixed;top:0;left:0;bottom:0;right:0;z-index:999999;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;background:rgba(50,50,50,.88);font-size:15px;line-height:1.3;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fl-builder-ui-keyboard-shortcuts.is-showing{display:-ms-flexbox;display:flex}.fl-builder-ui-keyboard-shortcuts-content{box-sizing:border-box;width:500px;background:#f5f7f9;border-radius:4px;padding:30px 0 0;box-shadow:0 10px 30px rgba(0,0,0,.15)}.fl-builder-ui-keyboard-shortcut-item{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:12px 40px}.fl-builder-ui-keyboard-shortcut-item:nth-child(even){background:#eef2f5}.fl-builder-ui-shortcut-keycode{margin-left:auto;text-transform:uppercase;letter-spacing:2px}.fl-builder-ui-keyboard-shortcust-footer{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:center;justify-content:center;padding:10px}.dismiss-shortcut-ui{padding:10px;border-radius:4px;background:#fff;color:#000;font-size:14px;border:2px solid #fff}.dismiss-shortcut-ui:focus,.dismiss-shortcut-ui:hover{top:0;color:#000;background:#eef2f5;border:2px solid #eef2f5}.fl-color-picker-ui{width:300px}.fl-color-picker-ui.fl-color-alpha-enabled{width:238px}.fl-color-picker-ui .iris-picker{float:left;width:100%;height:224px;display:block;position:relative;border-top:1px solid rgba(0,0,0,.1)}.fl-color-picker-ui .iris-picker .iris-square-inner,.fl-color-picker-ui .iris-picker-inner{position:absolute;left:0;top:0;bottom:0;right:0}.fl-color-picker-ui .iris-picker,.iris-picker *{box-sizing:content-box}.fl-color-picker-ui .iris-error{background-color:#ffafaf}.fl-color-picker-ui .iris-picker .iris-square{width:300px;height:200px}.fl-color-picker-ui .iris-picker .iris-palette,.fl-color-picker-ui .iris-picker .iris-slider,.fl-color-picker-ui .iris-picker .iris-square-inner{height:100%;width:12.5%}.fl-color-picker-ui .iris-picker .iris-placeholder,.fl-color-picker-ui .iris-picker .iris-square{position:relative}.fl-color-picker-ui .iris-picker .iris-square-inner{width:auto;margin:0}.fl-color-picker-ui .iris-ie-9 .iris-palette,.fl-color-picker-ui .iris-ie-9 .iris-slider,.fl-color-picker-ui .iris-ie-9 .iris-square,.fl-color-picker-ui .iris-ie-9 .iris-square-inner{box-shadow:none;border-radius:0}.fl-color-picker-ui .iris-ie-9 .iris-palette,.fl-color-picker-ui .iris-ie-9 .iris-slider,.fl-color-picker-ui .iris-ie-9 .iris-square{outline:rgba(0,0,0,.1) solid 1px}.fl-color-picker-ui .iris-ie-lt9 .iris-palette,.fl-color-picker-ui .iris-ie-lt9 .iris-slider,.fl-color-picker-ui .iris-ie-lt9 .iris-square,.fl-color-picker-ui .iris-ie-lt9 .iris-square-inner{outline:#999 solid 1px}.fl-color-picker-ui .iris-ie-lt9 .iris-square .ui-slider-handle{outline:#999 solid 1px;background-color:#fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"}.fl-color-picker-ui .iris-ie-lt9 .iris-square .iris-square-handle{background:0 0;border:3px solid #fff;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.fl-color-picker-ui .iris-picker .iris-strip{box-sizing:border-box;width:calc(300px - 12px);margin:5px 6px 6px;border-radius:4px;position:relative;height:22px;transform:rotate(180deg)}.fl-color-picker-ui .iris-picker .iris-strip .ui-slider-handle{width:6px;position:absolute;right:0;top:-2px;bottom:-2px;margin:0;border-radius:3px;background:#fff;box-shadow:0 0 2px rgba(0,0,0,.5);z-index:5;cursor:ew-resize}.fl-color-picker-ui .iris-picker .iris-strip .ui-slider-handle:focus{outline:#00a0d2 solid 2px}.fl-color-picker-ui .iris-picker .iris-slider-offset{position:absolute;top:0;left:6px;right:0;bottom:0;width:auto;height:auto;background:0 0;border:none;border-radius:0;transform:rotate(180deg)}.fl-color-picker-ui .iris-picker .iris-square-handle{background:0 0;border:5px solid #999;border-radius:50%;border-color:rgba(128,128,128,.5);box-shadow:none;width:12px;height:12px;position:absolute;left:-10px;top:-10px;cursor:move;opacity:1;z-index:10}.fl-color-picker-ui .iris-picker .ui-state-focus .iris-square-handle{opacity:.8}.fl-color-picker-ui .iris-picker .iris-square-handle:hover{border-color:#999}.fl-color-picker-ui .iris-picker .iris-square-value:focus .iris-square-handle{box-shadow:0 0 2px rgba(0,0,0,.75);opacity:.8}.fl-color-picker-ui .iris-picker .iris-square-handle:hover::after{border-color:#fff}.fl-color-picker-ui .iris-picker .iris-square-handle::after{position:absolute;bottom:-4px;right:-4px;left:-4px;top:-4px;border:3px solid #f9f9f9;border-color:rgba(255,255,255,.8);border-radius:50%;content:" "}.fl-color-picker-ui .iris-picker .iris-square-value{width:8px;height:8px;position:absolute}.iris-ie-lt9 .iris-square-value,.iris-mozilla .iris-square-value{width:1px;height:1px}.fl-color-picker-wrapper{position:relative;width:48px;height:32px}.fl-color-picker{box-shadow:0 2px 4px 0 rgba(0,0,0,.12);background:#fff;border-radius:4px;width:120px;height:36px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-color-picker-color{-ms-flex:1 1 100%;flex:1 1 100%;box-sizing:border-box!important;position:relative;border-radius:4px;background-color:transparent;cursor:pointer;border:2px solid transparent;border-right:2px solid rgba(0,0,0,.1);padding:0;-ms-flex-pack:center;justify-content:center;display:-ms-flexbox;display:flex}.fl-color-picker-clear:hover,.fl-color-picker-color:hover{background:0 0;border:2px solid transparent}.fl-color-picker-clear:focus,.fl-color-picker-color.fl-color-picker-empty:focus,.fl-color-picker-color:focus{outline:0;top:0;border:2px solid #00a0d2;background:0 0}.fl-color-picker.fl-color-picker-has-reset .fl-color-picker-color:not(.fl-color-picker-empty){border-top-right-radius:0;border-bottom-right-radius:0}.fl-color-picker-icon{display:none;margin:auto}.fl-color-picker-color.fl-color-picker-empty{border-color:transparent}.fl-color-picker-color.fl-color-picker-empty svg.fl-color-picker-icon{display:block}.fl-color-picker-clear{box-sizing:border-box;position:relative;display:-ms-flexbox;display:flex;-ms-flex:0 0 36px;flex:0 0 36px;-ms-flex-pack:center;justify-content:center;padding:0;border:2px solid transparent;border-top-right-radius:4px;border-bottom-right-radius:4px;background-color:#fff;cursor:pointer}.fl-color-picker-color.fl-color-picker-empty+.fl-color-picker-clear{display:none}.fl-color-picker-ui{display:inline-block;font-family:Helvetica,Verdana,sans-serif;z-index:999999;position:fixed;overflow:hidden;padding-bottom:45px;border:1px solid rgba(0,0,0,.1);color:#999;background-color:#FAFAFA;border-radius:3px;box-shadow:0 9px 20px rgba(0,0,0,.17);transition:opacity .2s,visibility .2s;visibility:hidden;opacity:0;-webkit-transform:translate3d(0,0,0)}.fl-color-picker-ui.fl-color-picker-active{visibility:visible;opacity:1}.fl-color-picker-ui .fl-color-picker-input,.fl-color-picker-ui .fl-color-picker-input:focus{width:100%;height:30px;border:none!important;font-size:14px!important;padding:0 8px;vertical-align:middle;color:#656c6e;background-color:#fff;border-radius:0;box-shadow:none}.fl-color-picker-ui .iris-square-value{transition:none}.fl-color-picker-preset-add{position:absolute;top:8px;right:8px;width:14px;height:14px;background-color:#656c6e;border-radius:50%;cursor:pointer;transition:all .2s}.fl-color-picker-preset-add:hover{background-color:#333}.fl-color-picker-preset-add:after,.fl-color-picker-preset-add:before{content:'';display:block;position:relative;background-color:#fff}.fl-color-picker-preset-add:before{top:6px;left:3px;width:8px;height:2px}.fl-color-picker-preset-add:after{left:6px;top:1px;width:2px;height:8px}.fl-color-picker-presets{position:absolute;left:0;bottom:0;width:100%;z-index:15;overflow:auto;border-top:1px solid rgba(0,0,0,.1);background-color:#FAFAFA}.fl-color-picker-presets-list .fl-color-picker-preset:hover,.fl-color-picker-presets-toggle:hover{background-color:#EDEDED}.fl-color-picker-presets-toggle{position:relative;overflow:hidden;width:100%;height:35px;text-align:center;line-height:35px;font-size:12px;font-weight:700;cursor:pointer;transition:all .1s}.fl-color-picker-presets-close-label,.fl-color-picker-presets-open-label{position:absolute;top:50%;left:50%;visibility:hidden;color:#999;transition:all .5s;transform:translate(-50%,-50%);opacity:0;width:100%}.fl-color-picker-presets-close-label.fl-color-picker-active,.fl-color-picker-presets-open-label.fl-color-picker-active{color:#656c6e;visibility:visible;opacity:1}.fl-color-picker-presets-list{width:100%;list-style:none;margin:0;padding:0;overflow:auto}.fl-color-picker-presets-list .fl-color-picker-no-preset,.fl-color-picker-presets-list .fl-color-picker-preset{position:relative;padding:5px;font-size:12px;border-top:1px solid rgba(0,0,0,.1);transition:all .1s}.fl-color-picker-presets-list .fl-color-picker-no-preset{padding:18px 5px;text-align:center}.fl-color-picker-presets-list .fl-color-picker-preset-color{display:inline-block;width:40px;height:20px;margin-right:3px;vertical-align:middle;border:1px solid rgba(0,0,0,.1);border-radius:2px;cursor:pointer}.fl-color-picker-presets-list .fl-color-picker-preset-label{vertical-align:middle;color:#333;cursor:pointer}.fl-color-picker-presets-list .fl-color-picker-preset-remove{position:absolute;top:50%;cursor:pointer;transform:translateY(-50%)}.fl-color-picker-clear .fl-color-picker-icon-remove{right:auto;top:auto;margin:auto}.fl-color-picker-presets-list .fl-color-picker-preset-remove{right:5px}.fl-color-picker-presets-list .fl-color-picker-preset-remove:hover:after,.fl-color-picker-presets-list .fl-color-picker-preset-remove:hover:before{background-color:#333}.fl-color-picker-added{position:absolute;width:100%;top:0;left:0;right:0;bottom:35px;z-index:10;color:#fff;text-align:center;background-color:rgba(0,0,0,.8)}.fl-color-picker-added-text{position:absolute;top:50%;left:50%;width:80%;font-size:14px;color:#fff!important;transform:translate(-50%,-50%)}.fl-color-picker-icon-check{position:relative;width:50px;height:50px;margin:5px auto}.fl-color-picker-icon-check:before{content:'';display:block;position:relative;width:15px;height:30px;margin-left:14px;border:7px solid #fff;border-left:none;border-top:none;transform:rotate(45deg)}.fl-color-picker-icon-arrow-down,.fl-color-picker-icon-arrow-up{display:inline-block;position:relative;width:10px;height:10px;margin-left:5px}.fl-color-picker-icon-arrow-down:before,.fl-color-picker-icon-arrow-up:before{content:'';display:block;position:relative;width:6px;height:6px;border:2px solid #999;border-left:none;border-top:none;transform:rotate(45deg)}.fl-color-picker-icon-arrow-up{top:2px;transform:rotate(180deg)}.fl-color-picker-icon-remove{width:15px;height:15px}.fl-color-picker-icon-remove:after,.fl-color-picker-icon-remove:before{content:'';display:block;position:relative;background-color:#6f7881}.fl-color-picker-icon-remove:before{left:6px;width:2px;height:10px;margin-top:3px;transform:rotate(-45deg)}.fl-color-picker-icon-remove:after{left:6px;width:2px;height:10px;margin-top:-10px;transform:rotate(45deg)}.fl-alpha-wrap{position:absolute;width:35px;height:215px;padding:0 5px;right:4px;border-top:none}.fl-alpha-slider{height:190px;position:absolute;top:12px;width:28px}.fl-alpha-slider .ui-slider-handle{background:rgba(0,0,0,0);border-color:#aaa;border-radius:4px;border-style:solid;border-width:4px;box-shadow:0 1px 2px rgba(0,0,0,.2);-moz-box-shadow:0 1px 2px rgba(0,0,0,.2);-webkit-box-shadow:0 1px 2px rgba(0,0,0,.2);cursor:ns-resize;height:12px;left:0;opacity:.9;position:absolute;right:0;width:30px;z-index:14}.fl-alpha-slider .ui-slider-handle:before{content:" ";position:absolute;left:-2px;right:-2px;top:-3px;bottom:-3px;border:2px solid #fff;border-radius:3px}.fl-alpha-slider-offset{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAASCAYAAAAe/ZHXAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NkNEQUQ0ODM4RUE0MTFFNEExOEJFN0E5M0VFOTg0QUQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NkNEQUQ0ODQ4RUE0MTFFNEExOEJFN0E5M0VFOTg0QUQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo2Q0RBRDQ4MThFQTQxMUU0QTE4QkU3QTkzRUU5ODRBRCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo2Q0RBRDQ4MjhFQTQxMUU0QTE4QkU3QTkzRUU5ODRBRCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/r/N8AAAWYSURBVHjarFvvR3VBEN45JZGIPkREHyIiIhJJf3qUSERE9CGiDxERkcg9z9u92uucvTszz5z7xnHPj93Z2d359cxscn5+jpTS+EoiMr3/+51cZ2dn4+e29i2/u7y8RKf/pO3vc+o+n5ycoNK31+f6+jrfZ37yuG2mf3R01H3fa5N/b29vU6dP5qft0G4PDg5MGuPr/v4+jz1t27mfvN/b21P75+fHx8eZfiV/Ozs7rUJnSu/5+RlFv+m6ZJpbW1s1PnrvXl9fZ/qX89zY2LB4mfy+v7/nsdV1XltbK/dr5vnz87OcV5bJabuVlRVLBifjfX9/l/xkGtM+S0tLNXnu0szfU/P3IMn/k0678h6ddqjQFGccVL6hoCsVfsq+NZ5QtCv5rfFS41sq37W+UPhMyhxEWTetvce3NR8oewqD39qalXuGAK/WPltjajIC4x2c9Ye1f43SGcqGwRBeTZjhMNntL4pCWZMQYhE05RVl02EovRgC4RkCbUNSQAGhGB/GsKG4h6FQoigDa2i8fRBy3uLMXYIG3Vr3aZvRaCRdBYlYIMZywhBGCVhgzzOlgRuUSOvC0GMEWxOM/+EtQFh1OIIXtfwg1tRaayGjg5px0jyZKEaTle3e+AsLCygVRAh3FlEgKbReE3oYGj9EgIR00QiEgKw3ZBQbRGjBeAMtDETQmHiKDsezJNLgCTFGItZXlAgCSiQggblP+9c8SDI0lXWlFv5g3K63KZ51FOcZzthQ3LomoNHwJmKIQISI3vqzSpwIQ8liSjGMFQjDpoVgaQ6cWgvLhOC7qiAwiHrWbEg4JMSmeUrBuHoYwioOQNXmhmAcrs096s1gJCGi3hSEVU8DQxYElYHhKwUUGAa+NqOBMsSSAQJuhQhCAH4vxozExsxiihPuaIrjCVYKWlYEsjSM52G8Kxxryngl5j0j+EyGTIiED4s1Itm0ZGWxMFCLJaBAcEI6OBkmFgNBoc8Cait2ZnENE/6wQN8LJSJeSMNAjKVm+LUMAIt3PR5AQgIGp1Z5zxhE8PtXUYReYeXi4mKmOPNXBMzt2tPT07LIUtJqr66uusXEbkFnWiQ6Pj72ikrtzc1NKopuvbbj58PDwxqNHp27u7tuYWumUDV+v7+/Xyu6pc59+/DwUCsC9ujt7u6qRbt8//T01C3elbyN70fb29uZ/1FSincvLy/lPGb42tzc9IqJeHt7q61Pr2C6vr7u7tfHx8fMPhV0sLq6WhZtU0n36+uru8elPE7aLi8v1wqJPXn++fmZKYgX8ozFxcXJb0NaQTHClZT8+gBjsYdaFc+zWcUkGTCWENY66ta92oSVzo3WI6IZKGtukeyfBLFKBNAj6bUOBgaoe9wE4n04IBNkLMoC7+Skj630ZlTJMYdyMsU2T8AwpzALkVFilZgJcT2l9PCWDDSAMBSjVlJgZNk0lE1AIby0qCiCnBQNj6aBGQslZIZJ5hB6D/AzQHto5Z9Nk8tARdN4q2ExBnsyIJ311EymShyjan2rKk0zh1Ay1oQVWAZQRnkUA8RFw7TahjBnmNgMVMQrsCGZJezRtGlU0cUZ1zuaxGZPpbhApM+ZpFQqQ6xadoMtBrEKpBVo4GRXvNSxpaRixKiR+TChCYhsDwZkfFj8IkErjAHejcUI0XQrgwehhNSMHAz21E0wZ23FcCAmj8Sd/PXy2xLYLAuwRw4IMsqjFaWYOpMEhDySAPFCWyFkgAHrEcA+BNeJ4UE8HCzJPpCrerUmQIx1pWJkjqxJD8EikUo2c5aI8ZYgsAkM4WQtnHd0ns0ORgVTBghy5ISy928SGsbTMqYg523RUY8oNYG4FIYiyRyZCnFCJC87IoRAIMVOqQ7BKexxCS2hYVl9JhvlpYjnAe4MhmRPMWhhvLfXINaI9WKM0Zu0+SfAAFLE1EgfVSv7AAAAAElFTkSuQmCC) center;box-shadow:0 0 5px rgba(0,0,0,.4) inset;-moz-box-shadow:0 0 5px rgba(0,0,0,.4) inset;-webkit-box-shadow:0 0 5px rgba(0,0,0,.4) inset;width:200px;height:22px;transform:rotate(-90deg);bottom:48%;left:-80px;position:absolute}.fl-alpha-text{width:30px;font-size:12px;text-align:center;color:#999;position:absolute;bottom:-5px}.fl-lightbox-wrap.fl-icon-selector{z-index:1000111}.fl-icon-selector .fl-lightbox{height:100%}.fl-icons-filter{height:auto!important;margin:0!important;position:absolute!important;right:0;top:0;padding:10px 16px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row}.fl-icons-filter select{vertical-align:middle;width:195px;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box;color:#000;border:2px solid #e4e7ea!important;border-right:none!important;margin:0;padding:2px 10px;background:url(../img/svg/select-arrow-down-alt2.svg) center right 10px no-repeat #fff!important;-ms-flex:1 1 195px;flex:1 1 195px;border-radius:0}.fl-icons-filter input[type=text]{line-height:18px;vertical-align:middle;width:160px;-ms-flex:1 1 160px;flex:1 1 160px;border:2px solid #e4e7ea!important;border-radius:0!important;padding:2px 10px!important}.fl-icons-filter input[type=text]:focus,.fl-icons-filter select:focus{border:2px solid #00A0D2!important}.fl-icons-list{bottom:52px;left:0;overflow:auto;padding:20px;position:absolute;right:0;top:48px}.fl-icons-list::-webkit-scrollbar{background-color:#ccc;-webkit-appearance:none;width:10px}.fl-icons-list::-webkit-scrollbar-thumb{background-color:#666;border:1px solid #ccc}.fl-icons-section{text-align:center}.fl-icons-section h2{border-bottom:1px solid #dfdfdf;color:#333!important;font-family:Helvetica,Verdana,sans-serif!important;font-size:16px!important;font-weight:700!important;margin:0 0 20px!important;padding:0 0 10px!important;text-align:left}.fl-icons-list i,.fl-icons-list i:before{cursor:pointer;display:inline-block;font-size:40px;height:100px;line-height:100px;width:100px;background:0 0}.fl-icons-list i:hover{background:#fff;box-shadow:0 10px 20px rgba(0,0,0,.15);border-radius:4px}.fl-icon-selector-footer{bottom:0;left:0;position:absolute;right:0}.fl-lightbox-mask,.fl-lightbox-wrap{bottom:0;left:0;position:fixed;right:0;z-index:100010}@keyframes fl-lightbox-zoom{from{transform:scale(.4)}to{transform:scale(1)}}.fl-lightbox-wrap{display:none;overflow:auto;padding:4px;top:46px;-webkit-backface-visibility:hidden;-webkit-transform:translateZ(0);pointer-events:none}.fl-builder-draggable-is-dragging .fl-lightbox-wrap,.fl-builder-resizable-is-resizing .fl-lightbox-wrap,.fl-lightbox,.fl-lightbox-mask{pointer-events:auto}.fl-lightbox-mask{background:#000;opacity:.7;filter:alpha(opacity=70);top:0}.fl-lightbox{background:#F5F7F9;border-radius:4px;box-shadow:rgba(0,0,0,1) 0 4px 30px;-moz-box-shadow:rgba(0,0,0,1) 0 4px 30px;-webkit-box-shadow:rgba(0,0,0,1) 0 4px 30px;position:relative;display:-ms-flexbox;display:flex;z-index:100011;transform-origin:center;animation-name:fl-lightbox-zoom}.fl-lightbox.fl-lightbox-prevent-animation{animation-duration:0s;-moz-animation-duration:0s;-webkit-animation-duration:0s;-o-animation-duration:0s}.fl-lightbox :not(i){color:#333;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:13px;line-height:16px;text-decoration:none;text-transform:none}.fl-lightbox *,.fl-lightbox :after,.fl-lightbox :before{box-sizing:content-box}.fl-lightbox .fl-nanoscroller-pane{bottom:4px;right:4px;width:8px}.fl-lightbox .fa{font-family:FontAwesome}.fl-lightbox .dashicons{font-family:dashicons}.fl-lightbox.ui-draggable{box-shadow:rgba(0,0,0,.2) 0 7px 30px;-moz-box-shadow:rgba(0,0,0,.2) 0 7px 30px;-webkit-box-shadow:rgba(0,0,0,.2) 0 7px 30px}.fl-lightbox-resizable{height:500px;width:380px}@media (max-width:500px){.fl-lightbox-resizable{left:0!important;right:0!important;top:0!important;height:100%!important;width:100%!important}.fl-lightbox-resizable .ui-resizable-handle{display:none!important}.fl-lightbox.ui-draggable .fl-lightbox-header{cursor:default!important}.fl-lightbox-controls{display:none}}.fl-lightbox-width-full{left:0!important;right:0!important;top:0!important;height:100%!important;width:100%!important}.fl-lightbox-width-full .fl-lightbox-header{cursor:inherit!important}.fl-lightbox-controls{position:absolute;right:10px;top:10px;z-index:5}.fl-lightbox-controls .fa{color:#bdbdbd;font-size:14px;padding:5px}.fl-lightbox-controls .fa:hover{color:#aaa;cursor:pointer}.fl-lightbox-header-wrap{background:#fff;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom:2px solid #eaeaea}.fl-lightbox-header{position:relative}.fl-lightbox-header h1{color:#333!important;font-size:20px!important;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif!important;font-weight:600!important;margin:0!important;padding:14px 34px 15px 28px!important;text-align:left!important;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;line-height:1.1}.fl-lightbox.ui-draggable .fl-lightbox-header{cursor:move}.fl-lightbox-header h1 .fl-builder-badge{margin-left:10px}.fl-lightbox-content,.fl-lightbox-content-wrap{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex:1 100%;flex:1 100%;height:100%;max-width:100%}.fl-lightbox-footer{box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end;-ms-flex:0 0;flex:0 0;-ms-flex-preferred-size:44px;flex-basis:44px;padding:4px;text-align:right}.fl-lightbox-footer .fl-builder-button{height:36px;margin-left:5px!important;-ms-flex:0 0 0%;flex:0 0 0%;-ms-flex-pack:center;justify-content:center}.fl-lightbox-width-slim .fl-lightbox-footer{-ms-flex-pack:stretch;justify-content:stretch;padding:4px 5px}.fl-lightbox-width-slim .fl-lightbox-footer .fl-builder-button{-ms-flex:1 1 100%;flex:1 1 100%;display:block;text-align:center}.fl-lightbox-width-slim .fl-lightbox-footer .fl-builder-button:first-child{margin-left:0!important}.fl-lightbox table,.fl-lightbox td,.fl-lightbox th,.fl-lightbox tr{border:none}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel,.fl-builder-ui-skin--dark .fl-builder--preview-actions,.fl-builder-ui-skin--dark .fl-builder--search-results-panel,.fl-builder-ui-skin--dark .fl-builder-panel,.fl-builder-ui-skin--dark .fl-lightbox,body.fl-builder-ui-skin--dark .fl-builder-bar .fl-builder-bar-content{background:#23282d;color:#b4b9be;border-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder--panel-header{background:#1d2227;color:#b4b9be;border-bottom-color:#1d1d1d;border-top-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder-panel.fl-builder-ui-pinned .fl-builder--panel-header{border-top-color:#1d2227}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel:before{border-bottom-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder--panel-arrow polygon{fill:#1d1d1d}.fl-builder-ui-skin--dark .fl-builder-panel-search .fl-builder-panel-search-input{background:#1e2228}.fl-builder-ui-skin--dark .fl-responsive-preview-content{background:#131619}.fl-builder-ui-skin--dark .fl-form-table th{background:#23282d!important;color:#7d8690}.fl-builder-ui-skin--dark .fl-builder--preview-actions .device-icons,.fl-builder-ui-skin--dark .fl-builder-button{background:#383f46}.fl-builder-ui-skin--dark .fl-builder-button:focus{background:#131a22}.fl-builder-ui-skin--dark .fl-builder-button.fl-builder-button-primary{color:#fff!important;fill:#fff!important;background:#00A0D2}.fl-builder-ui-skin--dark .fl-builder-button.fl-builder-button-silent:focus{border:2px solid #00a0d2!important}.fl-builder-ui-skin--dark .fl-builder-content-panel--button:hover,.fl-builder-ui-skin--dark .fl-builder-content-panel-button{color:#00A0D2!important}.fl-builder-ui-skin--dark .fl-builder--menu>a:hover,.fl-builder-ui-skin--dark .fl-builder--menu>button:hover{background:#101215!important}.fl-builder-ui-skin--dark .fl-builder--menu>a:focus,.fl-builder-ui-skin--dark .fl-builder--menu>button:focus{background:#101215!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder-bar-title{border-color:#101215}.fl-builder-ui-skin--dark .fl-builder-bar-title:hover{background-color:#181b1f}.fl-builder-simple.fl-builder-ui-skin--dark .fl-builder-bar-title:hover{background-color:transparent}.fl-builder-ui-skin--dark .fl-builder-layout-title{color:#c6cdd6}.fl-builder-ui-skin--dark .fl-builder-bar-title-caret i,.fl-builder-ui-skin--dark .fl-builder-layout-pretitle,.fl-builder-ui-skin--dark .fl-theme-builder-preview-select .fl-theme-builder-preview-select-title{color:#7d8690}.fl-builder-ui-skin--dark button.fl-builder-button.fl-builder-bar-title-caret:focus{background-color:#101215!important}.fl-builder-ui-skin--dark .fl-builder--search:before{color:rgba(162,173,184,.73)}.fl-builder-ui-skin--dark .fl-builder--search input:focus::-webkit-input-placeholder{color:rgba(162,173,184,.73)!important}.fl-builder-ui-skin--dark .fl-builder--search .search-clear{color:rgba(162,173,184,.5);background-color:#e4e4e4;background:linear-gradient(to left,#383f46,#383f46 75%,rgba(56,63,70,0))}.fl-builder-ui-skin--dark .fl-builder--menu hr{background-color:#23282d!important;border:none}.fl-builder-ui-skin--dark .fl-builder--tabs{border-color:#383f46!important}.fl-builder-ui-skin--dark .fl-builder--tabs>.is-showing,.fl-builder-ui-skin--dark .fl-builder-settings-tabs a.fl-active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-more.fl-contains-active{color:#fff!important;fill:#fff!important;background:#383f46}.fl-builder-ui-skin--dark .fl-builder--tabs>:focus{background-color:#101215!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder--tabs>.is-showing:focus{color:#00a0d2!important}.fl-builder-ui-skin--dark .fl-builder--menu-item:hover{background:#383f46;color:#a8b3bf}.fl-builder-ui-skin--dark .fl-builder--menu * .fl-builder--menu-item-accessory,.fl-builder-ui-skin--dark .fl-builder-blocks-section-group-name{color:#7d8690}.fl-builder-ui-skin--dark .fl-builder--category-select{background:#171b1f}.fl-builder-ui-skin--dark .fl-builder--selector-display{color:#c6cdd6;background:url(../img/svg/select-arrow-down-alt2-light.svg) center right 10px no-repeat #171b1f!important}.fl-builder-ui-skin--dark .fl-builder--selector-display-label,.fl-builder-ui-skin--dark .fl-builder-panel-search-input input{border-color:#5b656f;color:#b5becb}.fl-builder-ui-skin--dark .fl-builder-panel-search-input input{background:#171b1f!important}.fl-builder-ui-skin--dark .fl-builder--selector-display-label:focus,.fl-builder-ui-skin--dark .fl-builder-panel-search-input input:focus{border-color:#00a0d2}.fl-builder-ui-skin--dark .fl-builder--group-label{color:#171b1f!important;background:#5b656f}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu{border-color:#101215!important;color:#7c858e;background-color:#101215}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu:before{border-bottom-color:#101215}.fl-builder-ui-skin--dark .fl-builder--menu>a,.fl-builder-ui-skin--dark .fl-builder--menu>button,.fl-builder-ui-skin--dark .fl-builder--menu>span{color:#a1adb9}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu .fl-builder--menu-item:hover{background:#23282d!important;color:#a1adb9}.fl-builder-ui-skin--dark .fl-builder--category-select .fl-builder--selector-menu .fl-builder--menu-item:focus{background:#23282d!important;color:#00a0d2!important}.fl-builder-ui-skin--dark .fl-builder-panel-drag-handle{fill:#5b656f}.fl-builder-ui-skin--dark .fl-builder--template-collection-section-name,.fl-builder-ui-skin--dark .fl-builder--user-templates-section-name,.fl-builder-ui-skin--dark .fl-builder-blocks-section .fl-builder-blocks-section-title{color:#969ea7;background:#171b1f}.fl-builder-ui-skin--dark .fl-builder-blocks-section-content .fl-builder-block,.fl-builder-ui-skin--dark .fl-user-template{color:#b8c2ce}.fl-builder-ui-skin--dark .fl-builder-block:hover .fl-builder-block-content,.fl-builder-ui-skin--dark .fl-user-template:hover{background:#171b1f;color:#fff}.fl-builder-ui-skin--dark .fl-builder-block:hover i,.fl-builder-ui-skin--dark .fl-user-template:hover i{color:#6d7782!important}.fl-builder-ui-skin--dark .fl-builder-block:hover a:hover i,.fl-builder-ui-skin--dark .fl-user-template:hover a:hover i{color:#9eacbb!important}.fl-builder-ui-skin--dark .fl-builder-block .fl-builder-block-icon{fill:#b5becb}.fl-builder-ui-skin--dark .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col,.fl-builder-ui-skin--dark .fl-builder-block:hover .fl-builder-block-visual.fl-cols-visual .fl-cols-visual-col{background:#7d8690}.fl-builder-ui-skin--dark .fl-builder-blocks-section,.fl-builder-ui-skin--dark .fl-builder-settings-section{border-top:2px solid #171b1f}.fl-builder-ui-skin--dark .fl-user-templates{border-color:#101215}.fl-builder-ui-skin--dark .fl-builder--template-thumbnail{border-color:#393f44}.fl-builder-ui-skin--dark .fl-builder--menu a.fl-template-collection{color:#a8b3bf}.fl-builder-ui-skin--dark .fl-lightbox-header-wrap{background:#1d2227;border-bottom-color:#131a22}.fl-builder-ui-skin--dark .fl-lightbox .fl-lightbox-header h1{color:#fff!important}.fl-builder-ui-skin--dark .fl-form-table th label{color:#a8b3bf!important}.fl-builder-ui-skin--dark .fl-builder-settings-tabs{border-color:#383f46!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields h3.fl-builder-settings-title{background:#1b2025}.fl-builder-ui-skin--dark h3.fl-builder-settings-title .fl-builder-settings-title-text-wrap{color:#a8b3bf;background-color:#1b2025}.fl-builder-ui-skin--dark .fl-lightbox :not(i){color:#7d8690!important}.fl-builder-ui-skin--dark .fl-builder-button{color:#c6cdd6!important;fill:#c6cdd6!important}.fl-builder-ui-skin--dark .fl-builder-content-panel--button:hover,.fl-builder-ui-skin--dark .fl-builder-content-panel-button{fill:#00A0D2!important}.fl-builder-ui-skin--dark .fl-lightbox .fl-builder-button.fl-builder-button-primary{color:#fff!important}.fl-builder-ui-skin--dark .fl-color-picker{background:#131a22}.fl-color-picker-color.fl-color-picker-empty .fl-color-picker-icon{fill:#6f7881}.fl-builder-ui-skin--dark .fl-color-picker-clear{background-color:#191d21}.fl-builder-ui-skin--dark .fl-color-picker-clear:hover{background-color:#373f46}.fl-builder-ui-skin--dark span.fl-builder-block-no-node-templates:hover{background:#1d2025}.fl-builder-ui-skin--dark .fl-builder-settings-tab-description{background:#1d2227}.fl-builder-ui-skin--dark .fl-builder-panel-search button svg .filled-shape{fill:#b5becb}.fl-builder-ui-skin--dark .fl-builder-custom-field,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=email],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=file],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=number],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=password],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=search],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=tel],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=text],.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=url],.fl-builder-ui-skin--dark .fl-builder-settings-fields select,.fl-builder-ui-skin--dark .fl-builder-settings-fields textarea{background-color:#131a22!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=email]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=file]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=number]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=password]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=search]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=tel]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=text]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields input[type=url]:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields select:focus,.fl-builder-ui-skin--dark .fl-builder-settings-fields textarea:focus{border-color:#00a0d2!important;color:#fff!important}.fl-builder-ui-skin--dark .fl-builder-settings-fields select{background-image:url(../img/svg/select-arrow-down-alt2-light.svg)!important}.fl-builder-ui-skin--dark .fl-builder-custom-field select,.fl-builder-ui-skin--dark .fl-photo-field select{border-color:#7d8690!important}.fl-builder-ui-skin--dark .fl-field i.fl-field-responsive-toggle{color:#6b747d}.fl-builder-ui-skin--dark .fl-builder--main-menu-panel-view-title,.fl-builder-ui-skin--dark .fl-field i.fl-field-responsive-toggle:hover{color:#a8b3bf}.fl-builder-ui-skin--dark .fl-builder--saving-indicator{color:#858f99}.fl-builder-ui-skin--dark .fl-icons-list i:hover{background-color:#16191d;color:#fff}.fl-builder-ui-skin--dark .fl-color-picker-clear .fl-color-picker-icon-remove:after,.fl-builder-ui-skin--dark .fl-color-picker-clear .fl-color-picker-icon-remove:before{background:#6f7881}.fl-builder-ui-skin--dark .fl-builder--user-templates-section-content{border-color:#1d1d1d}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select.fl-builder-button{background:0 0;border-right-color:#101215!important}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select.fl-builder-button:hover{background:#181b1f}.fl-builder-ui-skin--dark .fl-theme-builder-preview-select .fl-theme-builder-preview-select-title span{color:#c6cdd6}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu{background:#131a22;border-color:#353c43 #131a22 #131a22}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu:before{border-bottom-color:#353c43}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:focus,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:hover{background:#383f46}.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a.fl-active,.fl-builder-ui-skin--dark .fl-builder-settings-tabs-overflow-menu>a:hover.fl-active{color:#fff!important;background:#383f46}.fl-builder-ui-skin--dark ul.as-selections{background-color:#121a23}.fl-builder-ui-skin--dark .fl-custom-query .fl-builder-settings-section{border-top:2px solid #1b2026!important}.fl-builder-ui-skin--dark .pp-preview-button{background:#23282d;border:2px solid #101215}.fl-builder-ui-skin--dark .pp-preview-button .pp-preview-button-wrap .fa{color:#b8bfc7}
fl-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
- * Version: 2.1.1.3
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
+ * Version: 2.1.2.2
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
includes/compatibility.php CHANGED
@@ -443,3 +443,14 @@ function fl_fix_hummingbird() {
443
  add_filter( 'wp_hummingbird_is_active_module_minify', '__return_false', 500 );
444
  }
445
  }
 
 
 
 
 
 
 
 
 
 
 
443
  add_filter( 'wp_hummingbird_is_active_module_minify', '__return_false', 500 );
444
  }
445
  }
446
+
447
+ /**
448
+ * Fix Enjoy Instagram feed on website with WordPress Widget and Shortcode issues with the builder.
449
+ * @since 2.0.6
450
+ */
451
+ add_action( 'template_redirect', 'fl_fix_enjoy_instagram' );
452
+ function fl_fix_enjoy_instagram() {
453
+ if ( FLBuilderModel::is_builder_active() ) {
454
+ remove_action( 'wp_head', 'funzioni_in_head' );
455
+ }
456
+ }
includes/updater-config.php CHANGED
@@ -3,7 +3,7 @@
3
  if ( class_exists( 'FLUpdater' ) ) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
- 'version' => '2.1.1.3',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin',
9
  ));
3
  if ( class_exists( 'FLUpdater' ) ) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
+ 'version' => '2.1.2.2',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin',
9
  ));
includes/vendor/infusionsoft/xmlrpc-3.0/lib/xmlrpc.inc CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
  // by Edd Dumbill (C) 1999-2002
3
  // <edd@usefulinc.com>
4
- // $Id: xmlrpc.inc,v 1.174 2009/03/16 19:36:38 ggiunta Exp $
5
 
6
  // Copyright (c) 1999,2000,2002 Edd Dumbill.
7
  // All rights reserved.
@@ -35,13 +34,12 @@
35
  // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
36
  // OF THE POSSIBILITY OF SUCH DAMAGE.
37
 
38
- $GLOBALS['xmlrpcName'] = 'Infusionsoft PHP iSDK 1.29.x ' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
39
- $GLOBALS['xmlrpcVersion'] = '3.0.0.beta';
40
-
41
- if (!function_exists('xml_parser_create')) {
42
  // For PHP 4 onward, XML functionality is always compiled-in on windows:
43
  // no more need to dl-open it. It might have been compiled out on *nix...
44
- if (strtoupper(substr(PHP_OS, 0, 3) != 'WIN')) {
 
45
  dl('xml.so');
46
  }
47
  }
@@ -49,27 +47,27 @@ if (!function_exists('xml_parser_create')) {
49
  // G. Giunta 2005/01/29: declare global these variables,
50
  // so that xmlrpc.inc will work even if included from within a function
51
  // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
52
- $GLOBALS['xmlrpcI4'] = 'i4';
53
- $GLOBALS['xmlrpcInt'] = 'int';
54
- $GLOBALS['xmlrpcBoolean'] = 'boolean';
55
- $GLOBALS['xmlrpcDouble'] = 'double';
56
- $GLOBALS['xmlrpcString'] = 'string';
57
- $GLOBALS['xmlrpcDateTime'] = 'dateTime.iso8601';
58
- $GLOBALS['xmlrpcBase64'] = 'base64';
59
- $GLOBALS['xmlrpcArray'] = 'array';
60
- $GLOBALS['xmlrpcStruct'] = 'struct';
61
- $GLOBALS['xmlrpcValue'] = 'undefined';
62
-
63
- $GLOBALS['xmlrpcTypes'] = array(
64
- $GLOBALS['xmlrpcI4'] => 1,
65
- $GLOBALS['xmlrpcInt'] => 1,
66
- $GLOBALS['xmlrpcBoolean'] => 1,
67
- $GLOBALS['xmlrpcString'] => 1,
68
- $GLOBALS['xmlrpcDouble'] => 1,
69
  $GLOBALS['xmlrpcDateTime'] => 1,
70
- $GLOBALS['xmlrpcBase64'] => 1,
71
- $GLOBALS['xmlrpcArray'] => 2,
72
- $GLOBALS['xmlrpcStruct'] => 3
73
  );
74
 
75
  $GLOBALS['xmlrpc_valid_parents'] = array(
@@ -95,133 +93,139 @@ $GLOBALS['xmlrpc_valid_parents'] = array(
95
  );
96
 
97
  // define extra types for supporting NULL (useful for json or <NIL/>)
98
- $GLOBALS['xmlrpcNull'] = 'null';
99
- $GLOBALS['xmlrpcTypes']['null'] = 1;
100
 
101
  // Not in use anymore since 2.0. Shall we remove it?
102
  /// @deprecated
103
- $GLOBALS['xmlEntities'] = array(
104
- 'amp' => '&',
105
  'quot' => '"',
106
- 'lt' => '<',
107
- 'gt' => '>',
108
  'apos' => "'"
109
  );
110
 
111
  // tables used for transcoding different charsets into us-ascii xml
112
 
113
- $GLOBALS['xml_iso88591_Entities'] = array();
114
  $GLOBALS['xml_iso88591_Entities']['in'] = array();
115
  $GLOBALS['xml_iso88591_Entities']['out'] = array();
116
- for ($i = 0; $i < 32; $i++) {
 
117
  $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
118
- $GLOBALS['xml_iso88591_Entities']['out'][] = '&#' . $i . ';';
119
  }
120
- for ($i = 160; $i < 256; $i++) {
 
121
  $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
122
- $GLOBALS['xml_iso88591_Entities']['out'][] = '&#' . $i . ';';
123
  }
124
 
125
  /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159?
126
  /// These will NOT be present in true ISO-8859-1, but will save the unwary
127
  /// windows user from sending junk (though no luck when reciving them...)
128
  /*
129
- $GLOBALS['xml_cp1252_Entities']=array();
130
- for ($i = 128; $i < 160; $i++)
131
- {
132
- $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i);
133
- }
134
- $GLOBALS['xml_cp1252_Entities']['out'] = array(
135
- '&#x20AC;', '?', '&#x201A;', '&#x0192;',
136
- '&#x201E;', '&#x2026;', '&#x2020;', '&#x2021;',
137
- '&#x02C6;', '&#x2030;', '&#x0160;', '&#x2039;',
138
- '&#x0152;', '?', '&#x017D;', '?',
139
- '?', '&#x2018;', '&#x2019;', '&#x201C;',
140
- '&#x201D;', '&#x2022;', '&#x2013;', '&#x2014;',
141
- '&#x02DC;', '&#x2122;', '&#x0161;', '&#x203A;',
142
- '&#x0153;', '?', '&#x017E;', '&#x0178;'
143
- );
144
- */
145
 
146
  $GLOBALS['xmlrpcerr'] = array(
147
- 'unknown_method' => 1,
148
- 'invalid_return' => 2,
149
- 'incorrect_params' => 3,
150
- 'introspect_unknown' => 4,
151
- 'http_error' => 5,
152
- 'no_data' => 6,
153
- 'no_ssl' => 7,
154
- 'curl_fail' => 8,
155
- 'invalid_request' => 15,
156
- 'no_curl' => 16,
157
- 'server_error' => 17,
158
- 'multicall_error' => 18,
159
- 'multicall_notstruct' => 9,
160
- 'multicall_nomethod' => 10,
161
- 'multicall_notstring' => 11,
162
- 'multicall_recursion' => 12,
163
- 'multicall_noparams' => 13,
164
- 'multicall_notarray' => 14,
165
-
166
- 'cannot_decompress' => 103,
167
- 'decompress_fail' => 104,
168
- 'dechunk_fail' => 105,
169
- 'server_cannot_decompress' => 106,
170
- 'server_decompress_fail' => 107
171
  );
172
 
173
  $GLOBALS['xmlrpcstr'] = array(
174
- 'unknown_method' => 'Unknown method',
175
- 'invalid_return' => 'Invalid return payload: enable debugging to examine incoming payload',
176
- 'incorrect_params' => 'Incorrect parameters passed to method',
177
- 'introspect_unknown' => "Can't introspect: method unknown",
178
- 'http_error' => "Didn't receive 200 OK from remote server.",
179
- 'no_data' => 'No data received from server.',
180
- 'no_ssl' => 'No SSL support compiled in.',
181
- 'curl_fail' => 'CURL error',
182
- 'invalid_request' => 'Invalid request payload',
183
- 'no_curl' => 'No CURL support compiled in.',
184
- 'server_error' => 'Internal server error',
185
- 'multicall_error' => 'Received from server invalid multicall response',
186
- 'multicall_notstruct' => 'system.multicall expected struct',
187
- 'multicall_nomethod' => 'missing methodName',
188
- 'multicall_notstring' => 'methodName is not a string',
189
- 'multicall_recursion' => 'recursive system.multicall forbidden',
190
- 'multicall_noparams' => 'missing params',
191
- 'multicall_notarray' => 'params is not an array',
192
-
193
- 'cannot_decompress' => 'Received from server compressed HTTP and cannot decompress',
194
- 'decompress_fail' => 'Received from server invalid compressed HTTP',
195
- 'dechunk_fail' => 'Received from server invalid chunked HTTP',
196
- 'server_cannot_decompress' => 'Received from client compressed HTTP request and cannot decompress',
197
- 'server_decompress_fail' => 'Received from client invalid compressed HTTP request'
198
  );
199
 
200
  // The charset encoding used by the server for received messages and
201
  // by the client for received responses when received charset cannot be determined
202
  // or is not supported
203
- $GLOBALS['xmlrpc_defencoding'] = 'UTF-8';
204
 
205
  // The encoding used internally by PHP.
206
  // String values received as xml will be converted to this, and php strings will be converted to xml
207
  // as if having been coded with this
208
- $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8';
 
 
 
209
 
210
  // let user errors start at 800
211
- $GLOBALS['xmlrpcerruser'] = 800;
212
  // let XML parse errors start at 100
213
- $GLOBALS['xmlrpcerrxml'] = 100;
214
 
215
  // formulate backslashes for escaping regexp
216
  // Not in use anymore since 2.0. Shall we remove it?
217
  /// @deprecated
218
- $GLOBALS['xmlrpc_backslash'] = chr(92) . chr(92);
219
 
220
  // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values
221
- $GLOBALS['xmlrpc_null_extension'] = false;
222
 
223
  // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>
224
- $GLOBALS['xmlrpc_null_apache_encoding'] = false;
 
225
 
226
  // used to store state during parsing
227
  // quick explanation of components:
@@ -234,7 +238,7 @@ $GLOBALS['xmlrpc_null_apache_encoding'] = false;
234
  // method - used to store method name
235
  // stack - array with genealogy of xml elements names:
236
  // used to validate nesting of xmlrpc elements
237
- $GLOBALS['_xh'] = null;
238
 
239
  /**
240
  * Convert a string to the correct XML representation in a target charset
@@ -248,16 +252,25 @@ $GLOBALS['_xh'] = null;
248
  * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
249
  *
250
  * @todo do a bit of basic benchmarking (strtr vs. str_replace)
251
- * @todo make usage of iconv() or recode_string() or mb_string() where available
252
  */
253
- function xmlrpc_encode_entitites($data, $src_encoding = '', $dest_encoding = '')
254
  {
255
- if ($src_encoding == '') {
 
 
 
 
 
 
 
 
256
  // lame, but we know no better...
257
  $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
258
  }
259
 
260
- switch (strtoupper($src_encoding . '_' . $dest_encoding)) {
 
261
  case 'ISO-8859-1_':
262
  case 'ISO-8859-1_US-ASCII':
263
  $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
@@ -279,18 +292,20 @@ function xmlrpc_encode_entitites($data, $src_encoding = '', $dest_encoding = '')
279
  case 'UTF-8_':
280
  case 'UTF-8_US-ASCII':
281
  case 'UTF-8_ISO-8859-1':
282
- // NB: this will choke on invalid UTF-8, going most likely beyond EOF
283
  $escaped_data = '';
284
- // be kind to users creating string xmlrpcvals out of different php types
285
- $data = (string)$data;
286
- $ns = strlen($data);
287
- for ($nn = 0; $nn < $ns; $nn++) {
 
288
  $ch = $data[$nn];
289
  $ii = ord($ch);
290
  //1 7 0bbbbbbb (127)
291
- if ($ii < 128) {
 
292
  /// @todo shall we replace this with a (supposedly) faster str_replace?
293
- switch ($ii) {
294
  case 34:
295
  $escaped_data .= '&quot;';
296
  break;
@@ -309,61 +324,67 @@ function xmlrpc_encode_entitites($data, $src_encoding = '', $dest_encoding = '')
309
  default:
310
  $escaped_data .= $ch;
311
  } // switch
312
- } //2 11 110bbbbb 10bbbbbb (2047)
313
- else if ($ii >> 5 == 6) {
 
 
314
  $b1 = ($ii & 31);
315
- $ii = ord($data[$nn + 1]);
316
  $b2 = ($ii & 63);
317
  $ii = ($b1 * 64) + $b2;
318
- $ent = sprintf('&#%d;', $ii);
319
  $escaped_data .= $ent;
320
  $nn += 1;
321
- } //3 16 1110bbbb 10bbbbbb 10bbbbbb
322
- else if ($ii >> 4 == 14) {
 
 
323
  $b1 = ($ii & 15);
324
- $ii = ord($data[$nn + 1]);
325
  $b2 = ($ii & 63);
326
- $ii = ord($data[$nn + 2]);
327
  $b3 = ($ii & 63);
328
  $ii = ((($b1 * 64) + $b2) * 64) + $b3;
329
- $ent = sprintf('&#%d;', $ii);
330
  $escaped_data .= $ent;
331
  $nn += 2;
332
- } //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
333
- else if ($ii >> 3 == 30) {
 
 
334
  $b1 = ($ii & 7);
335
- $ii = ord($data[$nn + 1]);
336
  $b2 = ($ii & 63);
337
- $ii = ord($data[$nn + 2]);
338
  $b3 = ($ii & 63);
339
- $ii = ord($data[$nn + 3]);
340
  $b4 = ($ii & 63);
341
  $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
342
- $ent = sprintf('&#%d;', $ii);
343
  $escaped_data .= $ent;
344
  $nn += 3;
345
  }
346
  }
347
  break;
348
  /*
349
- case 'CP1252_':
350
- case 'CP1252_US-ASCII':
351
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
352
- $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
353
- $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
354
- break;
355
- case 'CP1252_UTF-8':
356
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
357
- /// @todo we could use real UTF8 chars here instead of xml entities... (note that utf_8 encode all allone will NOT convert them)
358
- $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
359
- $escaped_data = utf8_encode($escaped_data);
360
- break;
361
- case 'CP1252_ISO-8859-1':
362
- $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
363
- // we might as well replave all funky chars with a '?' here, but we are kind and leave it to the receiving application layer to decide what to do with these weird entities...
364
- $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
365
- break;
366
- */
367
  default:
368
  $escaped_data = '';
369
  error_log("Converting from $src_encoding to $dest_encoding: not supported...");
@@ -372,43 +393,51 @@ function xmlrpc_encode_entitites($data, $src_encoding = '', $dest_encoding = '')
372
  }
373
 
374
  /// xml parser handler function for opening element tags
375
- function xmlrpc_se($parser, $name, $attrs, $accept_single_vals = false)
376
  {
377
  // if invalid xmlrpc already detected, skip all processing
378
- if ($GLOBALS['_xh']['isf'] < 2) {
 
379
  // check for correct element nesting
380
  // top level element can only be of 2 types
381
  /// @todo optimization creep: save this check into a bool variable, instead of using count() every time:
382
  /// there is only a single top level element in xml anyway
383
- if (count($GLOBALS['_xh']['stack']) == 0) {
 
384
  if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (
385
- $name != 'VALUE' && !$accept_single_vals)
386
- ) {
387
  $GLOBALS['_xh']['isf'] = 2;
388
  $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
389
  return;
390
- } else {
 
 
391
  $GLOBALS['_xh']['rt'] = strtolower($name);
392
  $GLOBALS['_xh']['rt'] = strtolower($name);
393
  }
394
- } else {
 
 
395
  // not top level element: see if parent is OK
396
  $parent = end($GLOBALS['_xh']['stack']);
397
- if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name])) {
 
398
  $GLOBALS['_xh']['isf'] = 2;
399
  $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
400
  return;
401
  }
402
  }
403
 
404
- switch ($name) {
 
405
  // optimize for speed switch cases: most common cases first
406
  case 'VALUE':
407
  /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element
408
- $GLOBALS['_xh']['vt'] = 'value'; // indicator: no value found yet
409
- $GLOBALS['_xh']['ac'] = '';
410
- $GLOBALS['_xh']['lv'] = 1;
411
- $GLOBALS['_xh']['php_class'] = null;
412
  break;
413
  case 'I4':
414
  case 'INT':
@@ -417,17 +446,19 @@ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals = false)
417
  case 'DOUBLE':
418
  case 'DATETIME.ISO8601':
419
  case 'BASE64':
420
- if ($GLOBALS['_xh']['vt'] != 'value') {
 
421
  //two data elements inside a value: an error occurred!
422
  $GLOBALS['_xh']['isf'] = 2;
423
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
424
  return;
425
  }
426
- $GLOBALS['_xh']['ac'] = ''; // reset the accumulator
427
  break;
428
  case 'STRUCT':
429
  case 'ARRAY':
430
- if ($GLOBALS['_xh']['vt'] != 'value') {
 
431
  //two data elements inside a value: an error occurred!
432
  $GLOBALS['_xh']['isf'] = 2;
433
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
@@ -439,14 +470,16 @@ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals = false)
439
  $cur_val['type'] = $name;
440
  // check for out-of-band information to rebuild php objs
441
  // and in case it is found, save it
442
- if (@isset($attrs['PHP_CLASS'])) {
 
443
  $cur_val['php_class'] = $attrs['PHP_CLASS'];
444
  }
445
  $GLOBALS['_xh']['valuestack'][] = $cur_val;
446
- $GLOBALS['_xh']['vt'] = 'data'; // be prepared for a data element next
447
  break;
448
  case 'DATA':
449
- if ($GLOBALS['_xh']['vt'] != 'data') {
 
450
  //two data elements inside a value: an error occurred!
451
  $GLOBALS['_xh']['isf'] = 2;
452
  $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";
@@ -460,30 +493,32 @@ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals = false)
460
  case 'METHODNAME':
461
  case 'NAME':
462
  /// @todo we could check for 2 NAME elements inside a MEMBER element
463
- $GLOBALS['_xh']['ac'] = '';
464
  break;
465
  case 'FAULT':
466
- $GLOBALS['_xh']['isf'] = 1;
467
  break;
468
  case 'MEMBER':
469
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack']) - 1]['name'] = ''; // set member name to null, in case we do not find in the xml later on
470
  //$GLOBALS['_xh']['ac']='';
471
  // Drop trough intentionally
472
  case 'PARAM':
473
  // clear value type, so we can check later if no value has been passed for this param/member
474
- $GLOBALS['_xh']['vt'] = null;
475
  break;
476
  case 'NIL':
477
  break;
478
  case 'EX:NIL':
479
- if ($GLOBALS['xmlrpc_null_extension']) {
480
- if ($GLOBALS['_xh']['vt'] != 'value') {
 
 
481
  //two data elements inside a value: an error occurred!
482
  $GLOBALS['_xh']['isf'] = 2;
483
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
484
  return;
485
  }
486
- $GLOBALS['_xh']['ac'] = ''; // reset the accumulator
487
  break;
488
  }
489
  // we do not support the <NIL/> extension, so
@@ -499,8 +534,9 @@ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals = false)
499
  $GLOBALS['_xh']['stack'][] = $name;
500
 
501
  /// @todo optimization creep: move this inside the big switch() above
502
- if ($name != 'VALUE') {
503
- $GLOBALS['_xh']['lv'] = 0;
 
504
  }
505
  }
506
  }
@@ -514,22 +550,26 @@ function xmlrpc_se_any($parser, $name, $attrs)
514
  /// xml parser handler function for close element tags
515
  function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
516
  {
517
- if ($GLOBALS['_xh']['isf'] < 2) {
 
518
  // push this element name from stack
519
  // NB: if XML validates, correct opening/closing is guaranteed and
520
  // we do not have to check for $name == $curr_elem.
521
  // we also checked for proper nesting at start of elements...
522
  $curr_elem = array_pop($GLOBALS['_xh']['stack']);
523
 
524
- switch ($name) {
 
525
  case 'VALUE':
526
  // This if() detects if no scalar was inside <VALUE></VALUE>
527
- if ($GLOBALS['_xh']['vt'] == 'value') {
528
- $GLOBALS['_xh']['value'] = $GLOBALS['_xh']['ac'];
529
- $GLOBALS['_xh']['vt'] = $GLOBALS['xmlrpcString'];
 
530
  }
531
 
532
- if ($rebuild_xmlrpcvals) {
 
533
  // build the xmlrpc val out of the data received, and substitute it
534
  $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
535
  // in case we got info about underlying php class, save it
@@ -539,23 +579,30 @@ function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
539
  // check if we are inside an array or struct:
540
  // if value just built is inside an array, let's move it into array on the stack
541
  $vscount = count($GLOBALS['_xh']['valuestack']);
542
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
543
- $GLOBALS['_xh']['valuestack'][$vscount - 1]['values'][] = $temp;
544
- } else {
 
 
 
545
  $GLOBALS['_xh']['value'] = $temp;
546
  }
547
- } else {
 
 
548
  /// @todo this needs to treat correctly php-serialized objects,
549
  /// since std deserializing is done by php_xmlrpc_decode,
550
  /// which we will not be calling...
551
- if (isset($GLOBALS['_xh']['php_class'])) {
 
552
  }
553
 
554
  // check if we are inside an array or struct:
555
  // if value just built is inside an array, let's move it into array on the stack
556
  $vscount = count($GLOBALS['_xh']['valuestack']);
557
- if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount - 1]['type'] == 'ARRAY') {
558
- $GLOBALS['_xh']['valuestack'][$vscount - 1]['values'][] = $GLOBALS['_xh']['value'];
 
559
  }
560
  }
561
  break;
@@ -566,107 +613,133 @@ function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
566
  case 'DOUBLE':
567
  case 'DATETIME.ISO8601':
568
  case 'BASE64':
569
- $GLOBALS['_xh']['vt'] = strtolower($name);
570
  /// @todo: optimization creep - remove the if/elseif cycle below
571
  /// since the case() in which we are already did that
572
- if ($name == 'STRING') {
573
- $GLOBALS['_xh']['value'] = $GLOBALS['_xh']['ac'];
574
- } elseif ($name == 'DATETIME.ISO8601') {
575
- if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac'])) {
576
- error_log('XML-RPC: invalid value received in DATETIME: ' . $GLOBALS['_xh']['ac']);
 
 
 
 
577
  }
578
- $GLOBALS['_xh']['vt'] = $GLOBALS['xmlrpcDateTime'];
579
- $GLOBALS['_xh']['value'] = $GLOBALS['_xh']['ac'];
580
- } elseif ($name == 'BASE64') {
 
 
581
  /// @todo check for failure of base64 decoding / catch warnings
582
- $GLOBALS['_xh']['value'] = base64_decode($GLOBALS['_xh']['ac']);
583
- } elseif ($name == 'BOOLEAN') {
 
 
584
  // special case here: we translate boolean 1 or 0 into PHP
585
  // constants true or false.
586
  // Strings 'true' and 'false' are accepted, even though the
587
  // spec never mentions them (see eg. Blogger api docs)
588
  // NB: this simple checks helps a lot sanitizing input, ie no
589
  // security problems around here
590
- if ($GLOBALS['_xh']['ac'] == '1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0) {
591
- $GLOBALS['_xh']['value'] = true;
592
- } else {
 
 
 
593
  // log if receiveing something strange, even though we set the value to false anyway
594
- if ($GLOBALS['_xh']['ac'] != '0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0)
595
- error_log('XML-RPC: invalid value received in BOOLEAN: ' . $GLOBALS['_xh']['ac']);
596
- $GLOBALS['_xh']['value'] = false;
597
  }
598
- } elseif ($name == 'DOUBLE') {
 
 
599
  // we have a DOUBLE
600
  // we must check that only 0123456789-.<space> are characters here
601
  // NOTE: regexp could be much stricter than this...
602
- if (!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac'])) {
 
603
  /// @todo: find a better way of throwing an error than this!
604
- error_log('XML-RPC: non numeric value received in DOUBLE: ' . $GLOBALS['_xh']['ac']);
605
- $GLOBALS['_xh']['value'] = 'ERROR_NON_NUMERIC_FOUND';
606
- } else {
 
 
607
  // it's ok, add it on
608
- $GLOBALS['_xh']['value'] = (double)$GLOBALS['_xh']['ac'];
609
  }
610
- } else {
 
 
611
  // we have an I4/INT
612
  // we must check that only 0123456789-<space> are characters here
613
- if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac'])) {
 
614
  /// @todo find a better way of throwing an error than this!
615
- error_log('XML-RPC: non numeric value received in INT: ' . $GLOBALS['_xh']['ac']);
616
- $GLOBALS['_xh']['value'] = 'ERROR_NON_NUMERIC_FOUND';
617
- } else {
 
 
618
  // it's ok, add it on
619
- $GLOBALS['_xh']['value'] = (int)$GLOBALS['_xh']['ac'];
620
  }
621
  }
622
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
623
- $GLOBALS['_xh']['lv'] = 3; // indicate we've found a value
624
  break;
625
  case 'NAME':
626
- $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack']) - 1]['name'] = $GLOBALS['_xh']['ac'];
627
  break;
628
  case 'MEMBER':
629
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
630
  // add to array in the stack the last element built,
631
  // unless no VALUE was found
632
- if ($GLOBALS['_xh']['vt']) {
 
633
  $vscount = count($GLOBALS['_xh']['valuestack']);
634
- $GLOBALS['_xh']['valuestack'][$vscount - 1]['values'][$GLOBALS['_xh']['valuestack'][$vscount - 1]['name']] = $GLOBALS['_xh']['value'];
635
  } else
636
  error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
637
  break;
638
  case 'DATA':
639
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
640
- $GLOBALS['_xh']['vt'] = null; // reset this to check for 2 data elements in a row - even if they're empty
641
  break;
642
  case 'STRUCT':
643
  case 'ARRAY':
644
  // fetch out of stack array of values, and promote it to current value
645
  $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
646
  $GLOBALS['_xh']['value'] = $curr_val['values'];
647
- $GLOBALS['_xh']['vt'] = strtolower($name);
648
- if (isset($curr_val['php_class'])) {
 
649
  $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
650
  }
651
  break;
652
  case 'PARAM':
653
  // add to array of params the current value,
654
  // unless no VALUE was found
655
- if ($GLOBALS['_xh']['vt']) {
656
- $GLOBALS['_xh']['params'][] = $GLOBALS['_xh']['value'];
657
- $GLOBALS['_xh']['pt'][] = $GLOBALS['_xh']['vt'];
658
- } else
 
 
659
  error_log('XML-RPC: missing VALUE inside PARAM in received xml');
660
  break;
661
  case 'METHODNAME':
662
- $GLOBALS['_xh']['method'] = preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
663
  break;
664
  case 'NIL':
665
  case 'EX:NIL':
666
- if ($GLOBALS['xmlrpc_null_extension']) {
667
- $GLOBALS['_xh']['vt'] = 'null';
668
- $GLOBALS['_xh']['value'] = null;
669
- $GLOBALS['_xh']['lv'] = 3;
 
670
  break;
671
  }
672
  // drop through intentionally if nil extension not enabled
@@ -693,10 +766,12 @@ function xmlrpc_ee_fast($parser, $name)
693
  function xmlrpc_cd($parser, $data)
694
  {
695
  // skip processing if xml fault already detected
696
- if ($GLOBALS['_xh']['isf'] < 2) {
 
697
  // "lookforvalue==3" means that we've found an entire value
698
  // and should discard any further character data
699
- if ($GLOBALS['_xh']['lv'] != 3) {
 
700
  // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2
701
  //if($GLOBALS['_xh']['lv']==1)
702
  //{
@@ -709,7 +784,7 @@ function xmlrpc_cd($parser, $data)
709
  //{
710
  // $GLOBALS['_xh']['ac'] = '';
711
  //}
712
- $GLOBALS['_xh']['ac'] .= $data;
713
  }
714
  }
715
  }
@@ -719,47 +794,54 @@ function xmlrpc_cd($parser, $data)
719
  function xmlrpc_dh($parser, $data)
720
  {
721
  // skip processing if xml fault already detected
722
- if ($GLOBALS['_xh']['isf'] < 2) {
723
- if (substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';') {
 
 
724
  // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
725
  //if($GLOBALS['_xh']['lv']==1)
726
  //{
727
  // $GLOBALS['_xh']['lv']=2;
728
  //}
729
- $GLOBALS['_xh']['ac'] .= $data;
730
  }
731
  }
732
  return true;
733
  }
734
 
 
735
  class xmlrpc_client
736
  {
737
  var $path;
738
  var $server;
739
- var $port = 0;
740
- var $method = 'http';
741
  var $errno;
742
  var $errstr;
743
- var $debug = 0;
744
- var $username = '';
745
- var $password = '';
746
- var $authtype = 1;
747
- var $cert = '';
748
- var $certpass = '';
749
- var $cacert = '';
750
- var $cacertdir = '';
751
- var $key = '';
752
- var $keypass = '';
753
- var $verifypeer = true;
754
- var $verifyhost = 2;
755
- var $no_multicall = false;
756
- var $proxy = '';
757
- var $proxyport = 0;
758
- var $proxy_user = '';
759
- var $proxy_pass = '';
760
- var $proxy_authtype = 1;
761
- var $cookies = array();
762
- var $extracurlopts = array();
 
 
 
 
763
 
764
  /**
765
  * List of http compression methods accepted by the client for responses.
@@ -781,7 +863,7 @@ class xmlrpc_client
781
  * http://curl.haxx.se/docs/faq.html#7.3)
782
  */
783
  var $xmlrpc_curl_handle = null;
784
- /// Wheter to use persistent connections for http 1.1 and https
785
  var $keepalive = false;
786
  /// Charset encodings that can be decoded without problems by the client
787
  var $accepted_charset_encodings = array();
@@ -803,51 +885,63 @@ class xmlrpc_client
803
  * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
804
  * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
805
  */
806
- function xmlrpc_client($path, $server = '', $port = '', $method = '')
807
  {
808
  // allow user to specify all params in $path
809
- if ($server == '' and $port == '' and $method == '') {
 
810
  $parts = parse_url($path);
811
  $server = $parts['host'];
812
  $path = isset($parts['path']) ? $parts['path'] : '';
813
- if (isset($parts['query'])) {
814
- $path .= '?' . $parts['query'];
 
815
  }
816
- if (isset($parts['fragment'])) {
817
- $path .= '#' . $parts['fragment'];
 
818
  }
819
- if (isset($parts['port'])) {
 
820
  $port = $parts['port'];
821
  }
822
- if (isset($parts['scheme'])) {
 
823
  $method = $parts['scheme'];
824
  }
825
- if (isset($parts['user'])) {
 
826
  $this->username = $parts['user'];
827
  }
828
- if (isset($parts['pass'])) {
 
829
  $this->password = $parts['pass'];
830
  }
831
  }
832
- if ($path == '' || $path[0] != '/') {
833
- $this->path = '/' . $path;
834
- } else {
835
- $this->path = $path;
 
 
 
836
  }
837
- $this->server = $server;
838
- if ($port != '') {
839
- $this->port = $port;
 
840
  }
841
- if ($method != '') {
842
- $this->method = $method;
 
843
  }
844
 
845
  // if ZLIB is enabled, let the client by default accept compressed responses
846
- if (function_exists('gzinflate') || (
847
  function_exists('curl_init') && (($info = curl_version()) &&
848
  ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
849
- )
850
- ) {
851
  $this->accepted_compression = array('gzip', 'deflate');
852
  }
853
 
@@ -863,12 +957,12 @@ class xmlrpc_client
863
 
864
  /**
865
  * Enables/disables the echoing to screen of the xmlrpc responses received
866
- * @param integer $debug values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
867
  * @access public
868
  */
869
  function setDebug($in)
870
  {
871
- $this->debug = $in;
872
  }
873
 
874
  /**
@@ -878,11 +972,11 @@ class xmlrpc_client
878
  * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
879
  * @access public
880
  */
881
- function setCredentials($u, $p, $t = 1)
882
  {
883
- $this->username = $u;
884
- $this->password = $p;
885
- $this->authtype = $t;
886
  }
887
 
888
  /**
@@ -899,16 +993,19 @@ class xmlrpc_client
899
 
900
  /**
901
  * Add a CA certificate to verify server with (see man page about
902
- * CURLOPT_CAINFO for more details
903
  * @param string $cacert certificate file name (or dir holding certificates)
904
  * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false
905
  * @access public
906
  */
907
- function setCaCertificate($cacert, $is_dir = false)
908
  {
909
- if ($is_dir) {
 
910
  $this->cacertdir = $cacert;
911
- } else {
 
 
912
  $this->cacert = $cacert;
913
  }
914
  }
@@ -978,7 +1075,10 @@ class xmlrpc_client
978
  if ($compmethod == 'any')
979
  $this->accepted_compression = array('gzip', 'deflate');
980
  else
981
- $this->accepted_compression = array($compmethod);
 
 
 
982
  }
983
 
984
  /**
@@ -1006,15 +1106,18 @@ class xmlrpc_client
1006
  *
1007
  * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
1008
  */
1009
- function setCookie($name, $value = '', $path = '', $domain = '', $port = null)
1010
  {
1011
  $this->cookies[$name]['value'] = urlencode($value);
1012
- if ($path || $domain || $port) {
 
1013
  $this->cookies[$name]['path'] = $path;
1014
  $this->cookies[$name]['domain'] = $domain;
1015
  $this->cookies[$name]['port'] = $port;
1016
  $this->cookies[$name]['version'] = 1;
1017
- } else {
 
 
1018
  $this->cookies[$name]['version'] = 0;
1019
  }
1020
  }
@@ -1022,9 +1125,9 @@ class xmlrpc_client
1022
  /**
1023
  * Directly set cURL options, for extra flexibility
1024
  * It allows eg. to bind client to a specific IP interface / address
1025
- * @param $options array
1026
  */
1027
- function SetCurlOptions($options)
1028
  {
1029
  $this->extracurlopts = $options;
1030
  }
@@ -1033,7 +1136,7 @@ class xmlrpc_client
1033
  * Set user-agent string that will be used by this client instance
1034
  * in http headers sent to the server
1035
  */
1036
- function SetUserAgent($agentstring)
1037
  {
1038
  $this->user_agent = $agentstring;
1039
  }
@@ -1046,28 +1149,33 @@ class xmlrpc_client
1046
  * @return xmlrpcresp
1047
  * @access public
1048
  */
1049
- function& send($msg, $timeout = 0, $method = '')
1050
  {
1051
  // if user deos not specify http protocol, use native method of this client
1052
  // (i.e. method set during call to constructor)
1053
- if ($method == '') {
 
1054
  $method = $this->method;
1055
  }
1056
 
1057
- if (is_array($msg)) {
 
1058
  // $msg is an array of xmlrpcmsg's
1059
  $r = $this->multicall($msg, $timeout, $method);
1060
  return $r;
1061
- } elseif (is_string($msg)) {
 
 
1062
  $n = new xmlrpcmsg('');
1063
  $n->payload = $msg;
1064
  $msg = $n;
1065
  }
1066
 
1067
  // where msg is an xmlrpcmsg
1068
- $msg->debug = $this->debug;
1069
 
1070
- if ($method == 'https') {
 
1071
  $r =& $this->sendPayloadHTTPS(
1072
  $msg,
1073
  $this->server,
@@ -1089,7 +1197,9 @@ class xmlrpc_client
1089
  $this->key,
1090
  $this->keypass
1091
  );
1092
- } elseif ($method == 'http11') {
 
 
1093
  $r =& $this->sendPayloadCURL(
1094
  $msg,
1095
  $this->server,
@@ -1110,7 +1220,9 @@ class xmlrpc_client
1110
  'http',
1111
  $this->keepalive
1112
  );
1113
- } else {
 
 
1114
  $r =& $this->sendPayloadHTTP10(
1115
  $msg,
1116
  $this->server,
@@ -1133,68 +1245,87 @@ class xmlrpc_client
1133
  /**
1134
  * @access private
1135
  */
1136
- function &sendPayloadHTTP10($msg, $server, $port, $timeout = 0,
1137
- $username = '', $password = '', $authtype = 1, $proxyhost = '',
1138
- $proxyport = 0, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1)
1139
  {
1140
- if ($port == 0) {
1141
- $port = 80;
 
1142
  }
1143
 
1144
  // Only create the payload if it was not created previously
1145
- if (empty($msg->payload)) {
 
1146
  $msg->createPayload($this->request_charset_encoding);
1147
  }
1148
 
1149
  $payload = $msg->payload;
1150
  // Deflate request body and set appropriate request headers
1151
- if (function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) {
1152
- if ($this->request_compression == 'gzip') {
 
 
1153
  $a = @gzencode($payload);
1154
- if ($a) {
 
1155
  $payload = $a;
1156
  $encoding_hdr = "Content-Encoding: gzip\r\n";
1157
  }
1158
- } else {
 
 
1159
  $a = @gzcompress($payload);
1160
- if ($a) {
 
1161
  $payload = $a;
1162
  $encoding_hdr = "Content-Encoding: deflate\r\n";
1163
  }
1164
  }
1165
- } else {
 
 
1166
  $encoding_hdr = '';
1167
  }
1168
 
1169
  // thanks to Grant Rauscher <grant7@firstworld.net> for this
1170
- $credentials = '';
1171
- if ($username != '') {
1172
- $credentials = 'Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
1173
- if ($authtype != 1) {
1174
- error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported with HTTP 1.0');
 
 
1175
  }
1176
  }
1177
 
1178
  $accepted_encoding = '';
1179
- if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
 
1180
  $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
1181
  }
1182
 
1183
  $proxy_credentials = '';
1184
- if ($proxyhost) {
1185
- if ($proxyport == 0) {
 
 
1186
  $proxyport = 8080;
1187
  }
1188
  $connectserver = $proxyhost;
1189
  $connectport = $proxyport;
1190
- $uri = 'http://' . $server . ':' . $port . $this->path;
1191
- if ($proxyusername != '') {
1192
- if ($proxyauthtype != 1) {
1193
- error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported with HTTP 1.0');
 
 
1194
  }
1195
- $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername . ':' . $proxypassword) . "\r\n";
1196
  }
1197
- } else {
 
 
1198
  $connectserver = $server;
1199
  $connectport = $port;
1200
  $uri = $this->path;
@@ -1202,11 +1333,14 @@ class xmlrpc_client
1202
 
1203
  // Cookie generation, as per rfc2965 (version 1 cookies) or
1204
  // netscape's rules (version 0 cookies)
1205
- $cookieheader = '';
1206
- if (count($this->cookies)) {
 
1207
  $version = '';
1208
- foreach ($this->cookies as $name => $cookie) {
1209
- if ($cookie['version']) {
 
 
1210
  $version = ' $Version="' . $cookie['version'] . '";';
1211
  $cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";';
1212
  if ($cookie['path'])
@@ -1215,16 +1349,21 @@ class xmlrpc_client
1215
  $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
1216
  if ($cookie['port'])
1217
  $cookieheader .= ' $Port="' . $cookie['port'] . '";';
1218
- } else {
 
 
1219
  $cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";";
1220
  }
1221
  }
1222
  $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n";
1223
  }
1224
 
1225
- $op = 'POST ' . $uri . " HTTP/1.0\r\n" .
 
 
 
1226
  'User-Agent: ' . $this->user_agent . "\r\n" .
1227
- 'Host: ' . $server . ':' . $port . "\r\n" .
1228
  $credentials .
1229
  $proxy_credentials .
1230
  $accepted_encoding .
@@ -1235,44 +1374,56 @@ class xmlrpc_client
1235
  strlen($payload) . "\r\n\r\n" .
1236
  $payload;
1237
 
1238
- if ($this->debug > 1) {
 
1239
  print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
1240
  // let the client see this now in case http times out...
1241
  flush();
1242
  }
1243
 
1244
- if ($timeout > 0) {
1245
- $fp = @fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
1246
- } else {
1247
- $fp = @fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
 
 
 
1248
  }
1249
- if ($fp) {
1250
- if ($timeout > 0 && function_exists('stream_set_timeout')) {
 
 
1251
  stream_set_timeout($fp, $timeout);
1252
  }
1253
- } else {
1254
- $this->errstr = 'Connect error: ' . $this->errstr;
1255
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
 
 
1256
  return $r;
1257
  }
1258
 
1259
- if (!fputs($fp, $op, strlen($op))) {
 
1260
  fclose($fp);
1261
- $this->errstr = 'Write error';
1262
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
1263
  return $r;
1264
- } else {
1265
- // reset errno and errstr on succesful socket connection
 
 
1266
  $this->errstr = '';
1267
  }
1268
  // G. Giunta 2005/10/24: close socket before parsing.
1269
- // should yeld slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
1270
- $ipd = '';
1271
- do {
 
1272
  // shall we check for $data === FALSE?
1273
  // as per the manual, it signals an error
1274
- $ipd .= fread($fp, 32768);
1275
- } while (!feof($fp));
1276
  fclose($fp);
1277
  $r =& $msg->parseResponse($ipd, false, $this->return_type);
1278
  return $r;
@@ -1282,10 +1433,10 @@ class xmlrpc_client
1282
  /**
1283
  * @access private
1284
  */
1285
- function &sendPayloadHTTPS($msg, $server, $port, $timeout = 0, $username = '',
1286
- $password = '', $authtype = 1, $cert = '', $certpass = '', $cacert = '', $cacertdir = '',
1287
- $proxyhost = '', $proxyport = 0, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1,
1288
- $keepalive = false, $key = '', $keypass = '')
1289
  {
1290
  $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
1291
  $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
@@ -1299,78 +1450,99 @@ class xmlrpc_client
1299
  * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
1300
  * @access private
1301
  */
1302
- function &sendPayloadCURL($msg, $server, $port, $timeout = 0, $username = '',
1303
- $password = '', $authtype = 1, $cert = '', $certpass = '', $cacert = '', $cacertdir = '',
1304
- $proxyhost = '', $proxyport = 0, $proxyusername = '', $proxypassword = '', $proxyauthtype = 1, $method = 'https',
1305
- $keepalive = false, $key = '', $keypass = '')
1306
- {
1307
- if (!function_exists('curl_init')) {
1308
- $this->errstr = 'CURL unavailable on this install';
1309
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
 
1310
  return $r;
1311
  }
1312
- if ($method == 'https') {
1313
- if (($info = curl_version()) &&
1314
- ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version'])))
1315
- ) {
1316
- $this->errstr = 'SSL unavailable on this install';
1317
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
 
1318
  return $r;
1319
  }
1320
  }
1321
 
1322
- if ($port == 0) {
1323
- if ($method == 'http') {
 
 
1324
  $port = 80;
1325
- } else {
 
 
1326
  $port = 443;
1327
  }
1328
  }
1329
 
1330
  // Only create the payload if it was not created previously
1331
- if (empty($msg->payload)) {
 
1332
  $msg->createPayload($this->request_charset_encoding);
1333
  }
1334
 
1335
  // Deflate request body and set appropriate request headers
1336
  $payload = $msg->payload;
1337
- if (function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate')) {
1338
- if ($this->request_compression == 'gzip') {
 
 
1339
  $a = @gzencode($payload);
1340
- if ($a) {
 
1341
  $payload = $a;
1342
  $encoding_hdr = 'Content-Encoding: gzip';
1343
  }
1344
- } else {
 
 
1345
  $a = @gzcompress($payload);
1346
- if ($a) {
 
1347
  $payload = $a;
1348
  $encoding_hdr = 'Content-Encoding: deflate';
1349
  }
1350
  }
1351
- } else {
 
 
1352
  $encoding_hdr = '';
1353
  }
1354
 
1355
- if ($this->debug > 1) {
 
1356
  print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
1357
  // let the client see this now in case http times out...
1358
  flush();
1359
  }
1360
 
1361
- if (!$keepalive || !$this->xmlrpc_curl_handle) {
1362
- $curl = curl_init($method . '://' . $server . ':' . $port . $this->path);
1363
- if ($keepalive) {
 
 
1364
  $this->xmlrpc_curl_handle = $curl;
1365
  }
1366
- } else {
 
 
1367
  $curl = $this->xmlrpc_curl_handle;
1368
  }
1369
 
1370
  // results into variable
1371
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
1372
 
1373
- if ($this->debug) {
 
1374
  curl_setopt($curl, CURLOPT_VERBOSE, 1);
1375
  }
1376
  curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
@@ -1382,68 +1554,84 @@ class xmlrpc_client
1382
  // return the header too
1383
  curl_setopt($curl, CURLOPT_HEADER, 1);
1384
 
1385
- // will only work with PHP >= 5.0
1386
  // NB: if we set an empty string, CURL will add http header indicating
1387
  // ALL methods it is supporting. This is possibly a better option than
1388
  // letting the user tell what curl can / cannot do...
1389
- if (is_array($this->accepted_compression) && count($this->accepted_compression)) {
 
1390
  //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
1391
  // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1392
- if (count($this->accepted_compression) == 1) {
 
1393
  curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
1394
- } else
 
1395
  curl_setopt($curl, CURLOPT_ENCODING, '');
1396
  }
1397
  // extra headers
1398
- $headers = array('Content-Type: ' . $msg->content_type, 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1399
  // if no keepalive is wanted, let the server know it in advance
1400
- if (!$keepalive) {
 
1401
  $headers[] = 'Connection: close';
1402
  }
1403
  // request compression header
1404
- if ($encoding_hdr) {
 
1405
  $headers[] = $encoding_hdr;
1406
  }
1407
 
1408
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1409
  // timeout is borked
1410
- if ($timeout) {
 
1411
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1412
  }
1413
 
1414
- if ($username && $password) {
1415
- curl_setopt($curl, CURLOPT_USERPWD, $username . ':' . $password);
1416
- if (defined('CURLOPT_HTTPAUTH')) {
 
 
1417
  curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
1418
- } else if ($authtype != 1) {
1419
- error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth is supported by the current PHP/curl install');
 
 
1420
  }
1421
  }
1422
 
1423
- if ($method == 'https') {
 
1424
  // set cert file
1425
- if ($cert) {
 
1426
  curl_setopt($curl, CURLOPT_SSLCERT, $cert);
1427
  }
1428
  // set cert password
1429
- if ($certpass) {
 
1430
  curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
1431
  }
1432
  // whether to verify remote host's cert
1433
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
1434
  // set ca certificates file/dir
1435
- if ($cacert) {
 
1436
  curl_setopt($curl, CURLOPT_CAINFO, $cacert);
1437
  }
1438
- if ($cacertdir) {
 
1439
  curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);
1440
  }
1441
  // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1442
- if ($key) {
 
1443
  curl_setopt($curl, CURLOPT_SSLKEY, $key);
1444
  }
1445
  // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1446
- if ($keypass) {
 
1447
  curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
1448
  }
1449
  // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
@@ -1451,18 +1639,24 @@ class xmlrpc_client
1451
  }
1452
 
1453
  // proxy info
1454
- if ($proxyhost) {
1455
- if ($proxyport == 0) {
 
 
1456
  $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
1457
  }
1458
- curl_setopt($curl, CURLOPT_PROXY, $proxyhost . ':' . $proxyport);
1459
  //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
1460
- if ($proxyusername) {
1461
- curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername . ':' . $proxypassword);
1462
- if (defined('CURLOPT_PROXYAUTH')) {
 
 
1463
  curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
1464
- } else if ($proxyauthtype != 1) {
1465
- error_log('XML-RPC: ' . __METHOD__ . ': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
 
 
1466
  }
1467
  }
1468
  }
@@ -1470,40 +1664,67 @@ class xmlrpc_client
1470
  // NB: should we build cookie http headers by hand rather than let CURL do it?
1471
  // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
1472
  // set to client obj the the user...
1473
- if (count($this->cookies)) {
 
1474
  $cookieheader = '';
1475
- foreach ($this->cookies as $name => $cookie) {
 
1476
  $cookieheader .= $name . '=' . $cookie['value'] . '; ';
1477
  }
1478
  curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
1479
  }
1480
 
1481
- foreach ($this->extracurlopts as $opt => $val) {
 
1482
  curl_setopt($curl, $opt, $val);
1483
  }
1484
 
1485
  $result = curl_exec($curl);
1486
 
1487
- if ($this->debug > 1) {
 
1488
  print "<PRE>\n---CURL INFO---\n";
1489
- foreach (curl_getinfo($curl) as $name => $val)
 
 
 
 
 
1490
  print $name . ': ' . htmlentities($val) . "\n";
 
 
1491
  print "---END---\n</PRE>";
1492
  }
1493
 
1494
- if (!$result) /// @todo we should use a better check here - what if we get back '' or '0'?
 
 
 
 
 
 
1495
  {
1496
- $this->errstr = 'no response';
1497
- $resp = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail'] . ': ' . curl_error($curl));
1498
  curl_close($curl);
1499
- if ($keepalive) {
 
1500
  $this->xmlrpc_curl_handle = null;
1501
  }
1502
- } else {
1503
- if (!$keepalive) {
 
 
 
1504
  curl_close($curl);
1505
  }
1506
  $resp =& $msg->parseResponse($result, true, $this->return_type);
 
 
 
 
 
 
1507
  }
1508
  return $resp;
1509
  }
@@ -1526,52 +1747,70 @@ class xmlrpc_client
1526
  * @param array $msgs an array of xmlrpcmsg objects
1527
  * @param integer $timeout connection timeout (in seconds)
1528
  * @param string $method the http protocol variant to be used
1529
- * @param boolean fallback When true, upon receiveing an error during multicall, multiple single calls will be attempted
1530
  * @return array
1531
  * @access public
1532
  */
1533
- function multicall($msgs, $timeout = 0, $method = '', $fallback = true)
1534
  {
1535
- if ($method == '') {
 
1536
  $method = $this->method;
1537
  }
1538
- if (!$this->no_multicall) {
 
1539
  $results = $this->_try_multicall($msgs, $timeout, $method);
1540
- if (is_array($results)) {
 
1541
  // System.multicall succeeded
1542
  return $results;
1543
- } else {
 
 
1544
  // either system.multicall is unsupported by server,
1545
  // or call failed for some other reason.
1546
- if ($fallback) {
 
1547
  // Don't try it next time...
1548
  $this->no_multicall = true;
1549
- } else {
1550
- if (is_a($results, 'xmlrpcresp')) {
 
 
 
1551
  $result = $results;
1552
- } else {
 
 
1553
  $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
1554
  }
1555
  }
1556
  }
1557
- } else {
 
 
1558
  // override fallback, in case careless user tries to do two
1559
  // opposite things at the same time
1560
  $fallback = true;
1561
  }
1562
 
1563
  $results = array();
1564
- if ($fallback) {
 
1565
  // system.multicall is (probably) unsupported by server:
1566
  // emulate multicall via multiple requests
1567
- foreach ($msgs as $msg) {
 
1568
  $results[] =& $this->send($msg, $timeout, $method);
1569
  }
1570
- } else {
 
 
1571
  // user does NOT want to fallback on many single calls:
1572
  // since we should always return an array of responses,
1573
  // return an array with the same error repeated n times
1574
- foreach ($msgs as $msg) {
 
1575
  $results[] = $result;
1576
  }
1577
  }
@@ -1588,11 +1827,13 @@ class xmlrpc_client
1588
  {
1589
  // Construct multicall message
1590
  $calls = array();
1591
- foreach ($msgs as $msg) {
1592
- $call['methodName'] = new xmlrpcval($msg->method(), 'string');
 
1593
  $numParams = $msg->getNumParams();
1594
  $params = array();
1595
- for ($i = 0; $i < $numParams; $i++) {
 
1596
  $params[$i] = $msg->getParam($i);
1597
  }
1598
  $call['params'] = new xmlrpcval($params, 'array');
@@ -1604,7 +1845,8 @@ class xmlrpc_client
1604
  // Attempt RPC call
1605
  $result =& $this->send($multicall, $timeout, $method);
1606
 
1607
- if ($result->faultCode() != 0) {
 
1608
  // call to system.multicall failed
1609
  return $result;
1610
  }
@@ -1612,29 +1854,37 @@ class xmlrpc_client
1612
  // Unpack responses.
1613
  $rets = $result->value();
1614
 
1615
- if ($this->return_type == 'xml') {
 
1616
  return $rets;
1617
- } else if ($this->return_type == 'phpvals') {
 
 
1618
  ///@todo test this code branch...
1619
  $rets = $result->value();
1620
- if (!is_array($rets)) {
1621
- return false; // bad return type from system.multicall
 
1622
  }
1623
  $numRets = count($rets);
1624
- if ($numRets != count($msgs)) {
1625
- return false; // wrong number of return values.
 
1626
  }
1627
 
1628
  $response = array();
1629
- for ($i = 0; $i < $numRets; $i++) {
 
1630
  $val = $rets[$i];
1631
  if (!is_array($val)) {
1632
  return false;
1633
  }
1634
- switch (count($val)) {
 
1635
  case 1:
1636
- if (!isset($val[0])) {
1637
- return false; // Bad value
 
1638
  }
1639
  // Normal return value
1640
  $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');
@@ -1642,11 +1892,13 @@ class xmlrpc_client
1642
  case 2:
1643
  /// @todo remove usage of @: it is apparently quite slow
1644
  $code = @$val['faultCode'];
1645
- if (!is_int($code)) {
 
1646
  return false;
1647
  }
1648
  $str = @$val['faultString'];
1649
- if (!is_string($str)) {
 
1650
  return false;
1651
  }
1652
  $response[$i] = new xmlrpcresp(0, $code, $str);
@@ -1656,35 +1908,43 @@ class xmlrpc_client
1656
  }
1657
  }
1658
  return $response;
1659
- } else // return type == 'xmlrpcvals'
 
1660
  {
1661
  $rets = $result->value();
1662
- if ($rets->kindOf() != 'array') {
1663
- return false; // bad return type from system.multicall
 
1664
  }
1665
  $numRets = $rets->arraysize();
1666
- if ($numRets != count($msgs)) {
1667
- return false; // wrong number of return values.
 
1668
  }
1669
 
1670
  $response = array();
1671
- for ($i = 0; $i < $numRets; $i++) {
 
1672
  $val = $rets->arraymem($i);
1673
- switch ($val->kindOf()) {
 
1674
  case 'array':
1675
- if ($val->arraysize() != 1) {
1676
- return false; // Bad value
 
1677
  }
1678
  // Normal return value
1679
  $response[$i] = new xmlrpcresp($val->arraymem(0));
1680
  break;
1681
  case 'struct':
1682
  $code = $val->structmem('faultCode');
1683
- if ($code->kindOf() != 'scalar' || $code->scalartyp() != 'int') {
 
1684
  return false;
1685
  }
1686
  $str = $val->structmem('faultString');
1687
- if ($str->kindOf() != 'scalar' || $str->scalartyp() != 'string') {
 
1688
  return false;
1689
  }
1690
  $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
@@ -1720,27 +1980,38 @@ class xmlrpcresp
1720
  * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
1721
  * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
1722
  */
1723
- function xmlrpcresp($val, $fcode = 0, $fstr = '', $valtyp = '')
1724
  {
1725
- if ($fcode != 0) {
 
1726
  // error response
1727
  $this->errno = $fcode;
1728
  $this->errstr = $fstr;
1729
  //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
1730
- } else {
 
 
1731
  // successful response
1732
  $this->val = $val;
1733
- if ($valtyp == '') {
 
1734
  // user did not declare type of response value: try to guess it
1735
- if (is_object($this->val) && is_a($this->val, 'xmlrpcval')) {
 
1736
  $this->valtyp = 'xmlrpcvals';
1737
- } else if (is_string($this->val)) {
 
 
1738
  $this->valtyp = 'xml';
1739
 
1740
- } else {
 
 
1741
  $this->valtyp = 'phpvals';
1742
  }
1743
- } else {
 
 
1744
  // user declares type of resp value: believe him
1745
  $this->valtyp = $valtyp;
1746
  }
@@ -1783,7 +2054,7 @@ class xmlrpcresp
1783
  * with attributes being e.g. 'expires', 'path', domain'.
1784
  * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
1785
  * are still present in the array. It is up to the user-defined code to decide
1786
- * how to use the received cookies, and wheter they have to be sent back with the next
1787
  * request to the server (using xmlrpc_client::setCookie) or not
1788
  * @return array array of cookies received from the server
1789
  * @access public
@@ -1799,14 +2070,22 @@ class xmlrpcresp
1799
  * @return string the xml representation of the response
1800
  * @access public
1801
  */
1802
- function serialize($charset_encoding = '')
1803
  {
1804
  if ($charset_encoding != '')
1805
  $this->content_type = 'text/xml; charset=' . $charset_encoding;
1806
  else
1807
  $this->content_type = 'text/xml';
1808
- $result = "<methodResponse>\n";
1809
- if ($this->errno) {
 
 
 
 
 
 
 
 
1810
  // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
1811
  // by xml-encoding non ascii chars
1812
  $result .= "<fault>\n" .
@@ -1814,17 +2093,25 @@ class xmlrpcresp
1814
  "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
1815
  xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
1816
  "</struct>\n</value>\n</fault>";
1817
- } else {
1818
- if (!is_object($this->val) || !is_a($this->val, 'xmlrpcval')) {
1819
- if (is_string($this->val) && $this->valtyp == 'xml') {
 
 
 
 
1820
  $result .= "<params>\n<param>\n" .
1821
  $this->val .
1822
  "</param>\n</params>";
1823
- } else {
 
 
1824
  /// @todo try to build something serializable?
1825
  die('cannot serialize xmlrpcresp objects whose content is native php values');
1826
  }
1827
- } else {
 
 
1828
  $result .= "<params>\n<param>\n" .
1829
  $this->val->serialize($charset_encoding) .
1830
  "</param>\n</params>";
@@ -1840,19 +2127,21 @@ class xmlrpcmsg
1840
  {
1841
  var $payload;
1842
  var $methodname;
1843
- var $params = array();
1844
- var $debug = 0;
1845
  var $content_type = 'text/xml';
1846
 
1847
  /**
1848
  * @param string $meth the name of the method to invoke
1849
- * @param array $pars array of parameters to be paased to the method (xmlrpcval objects)
1850
  */
1851
- function xmlrpcmsg($meth, $pars = 0)
1852
  {
1853
- $this->methodname = $meth;
1854
- if (is_array($pars) && count($pars) > 0) {
1855
- for ($i = 0; $i < count($pars); $i++) {
 
 
1856
  $this->addParam($pars[$i]);
1857
  }
1858
  }
@@ -1861,11 +2150,14 @@ class xmlrpcmsg
1861
  /**
1862
  * @access private
1863
  */
1864
- function xml_header($charset_encoding = '')
1865
  {
1866
- if ($charset_encoding != '') {
 
1867
  return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
1868
- } else {
 
 
1869
  return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
1870
  }
1871
  }
@@ -1889,22 +2181,23 @@ class xmlrpcmsg
1889
  /**
1890
  * @access private
1891
  */
1892
- function createPayload($charset_encoding = '')
1893
  {
1894
  if ($charset_encoding != '')
1895
  $this->content_type = 'text/xml; charset=' . $charset_encoding;
1896
  else
1897
  $this->content_type = 'text/xml';
1898
- $this->payload = $this->xml_header($charset_encoding);
1899
- $this->payload .= '<methodName>' . $this->methodname . "</methodName>\n";
1900
- $this->payload .= "<params>\n";
1901
- for ($i = 0; $i < count($this->params); $i++) {
1902
- $p = $this->params[$i];
1903
- $this->payload .= "<param>\n" . $p->serialize($charset_encoding) .
 
1904
  "</param>\n";
1905
  }
1906
- $this->payload .= "</params>\n";
1907
- $this->payload .= $this->xml_footer();
1908
  }
1909
 
1910
  /**
@@ -1913,20 +2206,22 @@ class xmlrpcmsg
1913
  * @return string the method that will be invoked
1914
  * @access public
1915
  */
1916
- function method($meth = '')
1917
  {
1918
- if ($meth != '') {
1919
- $this->methodname = $meth;
 
1920
  }
1921
  return $this->methodname;
1922
  }
1923
 
1924
  /**
1925
  * Returns xml representation of the message. XML prologue included
 
1926
  * @return string the xml representation of the message, xml prologue included
1927
  * @access public
1928
  */
1929
- function serialize($charset_encoding = '')
1930
  {
1931
  $this->createPayload($charset_encoding);
1932
  return $this->payload;
@@ -1941,10 +2236,13 @@ class xmlrpcmsg
1941
  function addParam($par)
1942
  {
1943
  // add check: do not add to self params which are not xmlrpcvals
1944
- if (is_object($par) && is_a($par, 'xmlrpcval')) {
1945
- $this->params[] = $par;
 
1946
  return true;
1947
- } else {
 
 
1948
  return false;
1949
  }
1950
  }
@@ -1955,20 +2253,14 @@ class xmlrpcmsg
1955
  * @return xmlrpcval the i-th parameter
1956
  * @access public
1957
  */
1958
- function getParam($i)
1959
- {
1960
- return $this->params[$i];
1961
- }
1962
 
1963
  /**
1964
  * Returns the number of parameters in the messge.
1965
  * @return integer the number of parameters currently set
1966
  * @access public
1967
  */
1968
- function getNumParams()
1969
- {
1970
- return count($this->params);
1971
- }
1972
 
1973
  /**
1974
  * Given an open file handle, read all data available and parse it as axmlrpc response.
@@ -1979,14 +2271,16 @@ class xmlrpcmsg
1979
  * infinite loop in that case, because we cannot trust the caller
1980
  * to give us a valid pointer to an open file...
1981
  * @access public
 
1982
  * @return xmlrpcresp
1983
  * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
1984
  */
1985
  function &parseResponseFile($fp)
1986
  {
1987
- $ipd = '';
1988
- while ($data = fread($fp, 32768)) {
1989
- $ipd .= $data;
 
1990
  }
1991
  //fclose($fp);
1992
  $r =& $this->parseResponse($ipd);
@@ -1997,50 +2291,62 @@ class xmlrpcmsg
1997
  * Parses HTTP headers and separates them from data.
1998
  * @access private
1999
  */
2000
- function &parseResponseHeaders(&$data, $headers_processed = false)
2001
  {
2002
  // Support "web-proxy-tunelling" connections for https through proxies
2003
- if (preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data)) {
 
2004
  // Look for CR/LF or simple LF as line separator,
2005
  // (even though it is not valid http)
2006
- $pos = strpos($data, "\r\n\r\n");
2007
- if ($pos || is_int($pos)) {
2008
- $bd = $pos + 4;
2009
- } else {
2010
- $pos = strpos($data, "\n\n");
2011
- if ($pos || is_int($pos)) {
2012
- $bd = $pos + 2;
2013
- } else {
 
 
 
 
 
 
2014
  // No separation between response headers and body: fault?
2015
  $bd = 0;
2016
  }
2017
  }
2018
- if ($bd) {
 
2019
  // this filters out all http headers from proxy.
2020
  // maybe we could take them into account, too?
2021
  $data = substr($data, $bd);
2022
- } else {
2023
- error_log('XML-RPC: ' . __METHOD__ . ': HTTPS via proxy error, tunnel connection possibly failed');
2024
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error'] . ' (HTTPS via proxy error, tunnel connection possibly failed)');
 
 
2025
  return $r;
2026
  }
2027
  }
2028
 
2029
  // Strip HTTP 1.1 100 Continue header if present
2030
- while (preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data)) {
 
2031
  $pos = strpos($data, 'HTTP', 12);
2032
  // server sent a Continue header without any (valid) content following...
2033
  // give the client a chance to know it
2034
- if (!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
2035
  {
2036
  break;
2037
  }
2038
  $data = substr($data, $pos);
2039
  }
2040
- if (!preg_match('/^HTTP\/[0-9.]+ 200 /', $data)) {
2041
- $errstr = substr($data, 0, strpos($data, "\n") - 1);
2042
- error_log('XML-RPC: ' . __METHOD__ . ': HTTP error, got response: ' . $errstr);
2043
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error'] . ' (' . $errstr . ')');
 
2044
  return $r;
2045
  }
2046
 
@@ -2049,14 +2355,20 @@ class xmlrpcmsg
2049
 
2050
  // be tolerant to usage of \n instead of \r\n to separate headers and data
2051
  // (even though it is not valid http)
2052
- $pos = strpos($data, "\r\n\r\n");
2053
- if ($pos || is_int($pos)) {
2054
- $bd = $pos + 4;
2055
- } else {
2056
- $pos = strpos($data, "\n\n");
2057
- if ($pos || is_int($pos)) {
2058
- $bd = $pos + 2;
2059
- } else {
 
 
 
 
 
 
2060
  // No separation between response headers and body: fault?
2061
  // we could take some action here instead of going on...
2062
  $bd = 0;
@@ -2064,24 +2376,31 @@ class xmlrpcmsg
2064
  }
2065
  // be tolerant to line endings, and extra empty lines
2066
  $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));
2067
- while (list(, $line) = @each($ar)) {
 
2068
  // take care of multi-line headers and cookies
2069
- $arr = explode(':', $line, 2);
2070
- if (count($arr) > 1) {
 
2071
  $header_name = strtolower(trim($arr[0]));
2072
  /// @todo some other headers (the ones that allow a CSV list of values)
2073
  /// do allow many values to be passed using multiple header lines.
2074
  /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
2075
  /// instead of replacing it for those...
2076
- if ($header_name == 'set-cookie' || $header_name == 'set-cookie2') {
2077
- if ($header_name == 'set-cookie2') {
 
 
2078
  // version 2 cookies:
2079
  // there could be many cookies on one line, comma separated
2080
  $cookies = explode(',', $arr[1]);
2081
- } else {
 
 
2082
  $cookies = array($arr[1]);
2083
  }
2084
- foreach ($cookies as $cookie) {
 
2085
  // glue together all received cookies, using a comma to separate them
2086
  // (same as php does with getallheaders())
2087
  if (isset($GLOBALS['_xh']['headers'][$header_name]))
@@ -2092,26 +2411,35 @@ class xmlrpcmsg
2092
  // feature creep: only allow rfc-compliant cookie attributes?
2093
  // @todo support for server sending multiple time cookie with same name, but using different PATHs
2094
  $cookie = explode(';', $cookie);
2095
- foreach ($cookie as $pos => $val) {
 
2096
  $val = explode('=', $val, 2);
2097
  $tag = trim($val[0]);
2098
  $val = trim(@$val[1]);
2099
  /// @todo with version 1 cookies, we should strip leading and trailing " chars
2100
- if ($pos == 0) {
 
2101
  $cookiename = $tag;
2102
  $GLOBALS['_xh']['cookies'][$tag] = array();
2103
  $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
2104
- } else {
2105
- if ($tag != 'value') {
 
 
 
2106
  $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
2107
  }
2108
  }
2109
  }
2110
  }
2111
- } else {
 
 
2112
  $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
2113
  }
2114
- } elseif (isset($header_name)) {
 
 
2115
  /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
2116
  $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
2117
  }
@@ -2119,12 +2447,15 @@ class xmlrpcmsg
2119
 
2120
  $data = substr($data, $bd);
2121
 
2122
- if ($this->debug && count($GLOBALS['_xh']['headers'])) {
 
2123
  print '<PRE>';
2124
- foreach ($GLOBALS['_xh']['headers'] as $header => $value) {
 
2125
  print htmlentities("HEADER: $header: $value\n");
2126
  }
2127
- foreach ($GLOBALS['_xh']['cookies'] as $header => $value) {
 
2128
  print htmlentities("COOKIE: $header={$value['value']}\n");
2129
  }
2130
  print "</PRE>\n";
@@ -2132,11 +2463,14 @@ class xmlrpcmsg
2132
 
2133
  // if CURL was used for the call, http headers have been processed,
2134
  // and dechunking + reinflating have been carried out
2135
- if (!$headers_processed) {
 
2136
  // Decode chunked encoding sent by http 1.1 servers
2137
- if (isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked') {
2138
- if (!$data = decode_chunked($data)) {
2139
- error_log('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to rebuild the chunked data received from server');
 
 
2140
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
2141
  return $r;
2142
  }
@@ -2144,26 +2478,36 @@ class xmlrpcmsg
2144
 
2145
  // Decode gzip-compressed stuff
2146
  // code shamelessly inspired from nusoap library by Dietrich Ayala
2147
- if (isset($GLOBALS['_xh']['headers']['content-encoding'])) {
 
2148
  $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);
2149
- if ($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip') {
 
2150
  // if decoding works, use it. else assume data wasn't gzencoded
2151
- if (function_exists('gzinflate')) {
2152
- if ($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data)) {
 
 
2153
  $data = $degzdata;
2154
- if ($this->debug)
2155
- print "<PRE>---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2156
- } elseif ($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
 
 
2157
  $data = $degzdata;
2158
- if ($this->debug)
2159
- print "<PRE>---INFLATED RESPONSE---[" . strlen($data) . " chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2160
- } else {
2161
- error_log('XML-RPC: ' . __METHOD__ . ': errors occurred when trying to decode the deflated data received from server');
 
 
2162
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
2163
  return $r;
2164
  }
2165
- } else {
2166
- error_log('XML-RPC: ' . __METHOD__ . ': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
 
 
2167
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
2168
  return $r;
2169
  }
@@ -2185,43 +2529,51 @@ class xmlrpcmsg
2185
  * @return xmlrpcresp
2186
  * @access public
2187
  */
2188
- function &parseResponse($data = '', $headers_processed = false, $return_type = 'xmlrpcvals')
2189
  {
2190
- if ($this->debug) {
 
2191
  //by maHo, replaced htmlspecialchars with htmlentities
2192
  print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
2193
  }
2194
 
2195
- if ($data == '') {
2196
- error_log('XML-RPC: ' . __METHOD__ . ': no response received from server.');
 
2197
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
2198
  return $r;
2199
  }
2200
 
2201
- $GLOBALS['_xh'] = array();
2202
 
2203
  $raw_data = $data;
2204
  // parse the HTTP headers of the response, if present, and separate them from data
2205
- if (substr($data, 0, 4) == 'HTTP') {
 
2206
  $r =& $this->parseResponseHeaders($data, $headers_processed);
2207
- if ($r) {
 
2208
  // failed processing of HTTP response headers
2209
  // save into response obj the full payload received, for debugging
2210
  $r->raw_data = $data;
2211
  return $r;
2212
  }
2213
- } else {
 
 
2214
  $GLOBALS['_xh']['headers'] = array();
2215
  $GLOBALS['_xh']['cookies'] = array();
2216
  }
2217
 
2218
- if ($this->debug) {
 
2219
  $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
2220
- if ($start) {
 
2221
  $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
2222
  $end = strpos($data, '-->', $start);
2223
- $comments = substr($data, $start, $end - $start);
2224
- print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t" . htmlentities(str_replace("\n", "\n\t", base64_decode($comments))) . "\n---END---\n</PRE>";
2225
  }
2226
  }
2227
 
@@ -2233,12 +2585,14 @@ class xmlrpcmsg
2233
  // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
2234
  // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
2235
  $pos = strrpos($data, '</methodResponse>');
2236
- if ($pos !== false) {
2237
- $data = substr($data, 0, $pos + 17);
 
2238
  }
2239
 
2240
  // if user wants back raw xml, give it to him
2241
- if ($return_type == 'xml') {
 
2242
  $r = new xmlrpcresp($data, 0, '', 'xml');
2243
  $r->hdrs = $GLOBALS['_xh']['headers'];
2244
  $r->_cookies = $GLOBALS['_xh']['cookies'];
@@ -2249,21 +2603,22 @@ class xmlrpcmsg
2249
  // try to 'guestimate' the character encoding of the received response
2250
  $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
2251
 
2252
- $GLOBALS['_xh']['ac'] = '';
2253
  //$GLOBALS['_xh']['qt']=''; //unused...
2254
  $GLOBALS['_xh']['stack'] = array();
2255
  $GLOBALS['_xh']['valuestack'] = array();
2256
- $GLOBALS['_xh']['isf'] = 0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc
2257
- $GLOBALS['_xh']['isf_reason'] = '';
2258
- $GLOBALS['_xh']['rt'] = ''; // 'methodcall or 'methodresponse'
2259
 
2260
  // if response charset encoding is not known / supported, try to use
2261
  // the default encoding and parse the xml anyway, but log a warning...
2262
- if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) // the following code might be better for mb_string enabled installs, but
 
2263
  // makes the lib about 200% slower...
2264
  //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2265
  {
2266
- error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $resp_encoding);
2267
  $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
2268
  }
2269
  $parser = xml_parser_create($resp_encoding);
@@ -2274,35 +2629,61 @@ class xmlrpcmsg
2274
  // we use the broadest one, ie. utf8
2275
  // This allows to send data which is native in various charset,
2276
  // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding
2277
- if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
 
2278
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
2279
- } else {
 
 
2280
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
2281
  }
2282
 
2283
- if ($return_type == 'phpvals') {
 
2284
  xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
2285
- } else {
 
 
2286
  xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
2287
  }
2288
 
2289
  xml_set_character_data_handler($parser, 'xmlrpc_cd');
2290
  xml_set_default_handler($parser, 'xmlrpc_dh');
2291
 
 
 
 
 
 
 
 
 
2292
  // first error check: xml not well formed
2293
- if (!xml_parse($parser, $data, count($data))) {
 
 
 
 
 
 
2294
  // thanks to Peter Kocks <peter.kocks@baygate.com>
2295
- if ((xml_get_current_line_number($parser)) == 1) {
2296
- $errstr = 'XML error at line 1, check URL';
2297
- } else {
2298
- $errstr = sprintf('XML error: %s at line %d, column %d',
2299
- xml_error_string(xml_get_error_code($parser)),
2300
- xml_get_current_line_number($parser), xml_get_current_column_number($parser));
2301
- }
 
 
 
 
 
2302
  error_log($errstr);
2303
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'] . ' (' . $errstr . ')');
2304
  xml_parser_free($parser);
2305
- if ($this->debug) {
 
2306
  print $errstr;
2307
  }
2308
  $r->hdrs = $GLOBALS['_xh']['headers'];
@@ -2312,23 +2693,30 @@ class xmlrpcmsg
2312
  }
2313
  xml_parser_free($parser);
2314
  // second error check: xml well formed but not xml-rpc compliant
2315
- if ($GLOBALS['_xh']['isf'] > 1) {
2316
- if ($this->debug) {
 
 
2317
  /// @todo echo something for user?
2318
  }
2319
 
2320
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
2321
  $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
2322
- } // third error check: parsing of the response has somehow gone boink.
 
2323
  // NB: shall we omit this check, since we trust the parsing code?
2324
- elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value'])) {
 
2325
  // something odd has happened
2326
  // and it's time to generate a client side error
2327
  // indicating something odd went on
2328
- $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
2329
  $GLOBALS['xmlrpcstr']['invalid_return']);
2330
- } else {
2331
- if ($this->debug) {
 
 
 
2332
  print "<PRE>---PARSED---\n";
2333
  // somehow htmlentities chokes on var_export, and some full html string...
2334
  //print htmlentitites(var_export($GLOBALS['_xh']['value'], true));
@@ -2339,27 +2727,34 @@ class xmlrpcmsg
2339
  // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
2340
  $v =& $GLOBALS['_xh']['value'];
2341
 
2342
- if ($GLOBALS['_xh']['isf']) {
 
2343
  /// @todo we should test here if server sent an int and a string,
2344
  /// and/or coerce them into such...
2345
- if ($return_type == 'xmlrpcvals') {
 
2346
  $errno_v = $v->structmem('faultCode');
2347
  $errstr_v = $v->structmem('faultString');
2348
  $errno = $errno_v->scalarval();
2349
  $errstr = $errstr_v->scalarval();
2350
- } else {
 
 
2351
  $errno = $v['faultCode'];
2352
  $errstr = $v['faultString'];
2353
  }
2354
 
2355
- if ($errno == 0) {
 
2356
  // FAULT returned, errno needs to reflect that
2357
  $errno = -1;
2358
  }
2359
 
2360
  $r = new xmlrpcresp(0, $errno, $errstr);
2361
- } else {
2362
- $r = new xmlrpcresp($v, 0, '', $return_type);
 
 
2363
  }
2364
  }
2365
 
@@ -2372,24 +2767,26 @@ class xmlrpcmsg
2372
 
2373
  class xmlrpcval
2374
  {
2375
- var $me = array();
2376
- var $mytype = 0;
2377
- var $_php_class = null;
2378
 
2379
  /**
2380
  * @param mixed $val
2381
  * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
2382
  */
2383
- function xmlrpcval($val = -1, $type = '')
2384
  {
2385
  /// @todo: optimization creep - do not call addXX, do it all inline.
2386
  /// downside: booleans will not be coerced anymore
2387
- if ($val !== -1 || $type != '') {
 
2388
  // optimization creep: inlined all work done by constructor
2389
- switch ($type) {
 
2390
  case '':
2391
- $this->mytype = 1;
2392
- $this->me['string'] = $val;
2393
  break;
2394
  case 'i4':
2395
  case 'int':
@@ -2399,36 +2796,36 @@ class xmlrpcval
2399
  case 'dateTime.iso8601':
2400
  case 'base64':
2401
  case 'null':
2402
- $this->mytype = 1;
2403
- $this->me[$type] = $val;
2404
  break;
2405
  case 'array':
2406
- $this->mytype = 2;
2407
- $this->me['array'] = $val;
2408
  break;
2409
  case 'struct':
2410
- $this->mytype = 3;
2411
- $this->me['struct'] = $val;
2412
  break;
2413
  default:
2414
- error_log("XML-RPC: " . __METHOD__ . ": not a known type ($type)");
2415
  }
2416
  /*if($type=='')
2417
- {
2418
- $type='string';
2419
- }
2420
- if($GLOBALS['xmlrpcTypes'][$type]==1)
2421
- {
2422
- $this->addScalar($val,$type);
2423
- }
2424
- elseif($GLOBALS['xmlrpcTypes'][$type]==2)
2425
- {
2426
- $this->addArray($val);
2427
- }
2428
- elseif($GLOBALS['xmlrpcTypes'][$type]==3)
2429
- {
2430
- $this->addStruct($val);
2431
- }*/
2432
  }
2433
  }
2434
 
@@ -2438,31 +2835,37 @@ class xmlrpcval
2438
  * @param string $type
2439
  * @return int 1 or 0 on failure
2440
  */
2441
- function addScalar($val, $type = 'string')
2442
  {
2443
- $typeof = @$GLOBALS['xmlrpcTypes'][$type];
2444
- if ($typeof != 1) {
2445
- error_log("XML-RPC: " . __METHOD__ . ": not a scalar type ($type)");
 
2446
  return 0;
2447
  }
2448
 
2449
  // coerce booleans into correct values
2450
  // NB: we should either do it for datetimes, integers and doubles, too,
2451
  // or just plain remove this check, implemented on booleans only...
2452
- if ($type == $GLOBALS['xmlrpcBoolean']) {
2453
- if (strcasecmp($val, 'true') == 0 || $val == 1 || ($val == true && strcasecmp($val, 'false'))) {
2454
- $val = true;
2455
- } else {
2456
- $val = false;
 
 
 
 
2457
  }
2458
  }
2459
 
2460
- switch ($this->mytype) {
 
2461
  case 1:
2462
- error_log('XML-RPC: ' . __METHOD__ . ': scalar xmlrpcval can have only one value');
2463
  return 0;
2464
  case 3:
2465
- error_log('XML-RPC: ' . __METHOD__ . ': cannot add anonymous scalar to struct xmlrpcval');
2466
  return 0;
2467
  case 2:
2468
  // we're adding a scalar value to an array here
@@ -2470,12 +2873,12 @@ class xmlrpcval
2470
  //$ar[]=new xmlrpcval($val, $type);
2471
  //$this->me['array']=$ar;
2472
  // Faster (?) avoid all the costly array-copy-by-val done here...
2473
- $this->me['array'][] = new xmlrpcval($val, $type);
2474
  return 1;
2475
  default:
2476
  // a scalar, so set the value and remember we're scalar
2477
- $this->me[$type] = $val;
2478
- $this->mytype = $typeof;
2479
  return 1;
2480
  }
2481
  }
@@ -2490,16 +2893,21 @@ class xmlrpcval
2490
  */
2491
  function addArray($vals)
2492
  {
2493
- if ($this->mytype == 0) {
2494
- $this->mytype = $GLOBALS['xmlrpcTypes']['array'];
2495
- $this->me['array'] = $vals;
 
2496
  return 1;
2497
- } elseif ($this->mytype == 2) {
 
 
2498
  // we're adding to an array here
2499
  $this->me['array'] = array_merge($this->me['array'], $vals);
2500
  return 1;
2501
- } else {
2502
- error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
 
 
2503
  return 0;
2504
  }
2505
  }
@@ -2514,16 +2922,21 @@ class xmlrpcval
2514
  */
2515
  function addStruct($vals)
2516
  {
2517
- if ($this->mytype == 0) {
2518
- $this->mytype = $GLOBALS['xmlrpcTypes']['struct'];
2519
- $this->me['struct'] = $vals;
 
2520
  return 1;
2521
- } elseif ($this->mytype == 3) {
 
 
2522
  // we're adding to a struct here
2523
  $this->me['struct'] = array_merge($this->me['struct'], $vals);
2524
  return 1;
2525
- } else {
2526
- error_log('XML-RPC: ' . __METHOD__ . ': already initialized as a [' . $this->kindOf() . ']');
 
 
2527
  return 0;
2528
  }
2529
  }
@@ -2532,10 +2945,13 @@ class xmlrpcval
2532
  // DEPRECATED!
2533
  function dump($ar)
2534
  {
2535
- foreach ($ar as $key => $val) {
 
2536
  echo "$key => $val<br />";
2537
- if ($key == 'array') {
2538
- while (list($key2, $val2) = each($val)) {
 
 
2539
  echo "-- $key2 => $val2<br />";
2540
  }
2541
  }
@@ -2549,7 +2965,8 @@ class xmlrpcval
2549
  */
2550
  function kindOf()
2551
  {
2552
- switch ($this->mytype) {
 
2553
  case 3:
2554
  return 'struct';
2555
  break;
@@ -2567,26 +2984,28 @@ class xmlrpcval
2567
  /**
2568
  * @access private
2569
  */
2570
- function serializedata($typ, $val, $charset_encoding = '')
2571
  {
2572
- $rs = '';
2573
- switch (@$GLOBALS['xmlrpcTypes'][$typ]) {
 
2574
  case 1:
2575
- switch ($typ) {
 
2576
  case $GLOBALS['xmlrpcBase64']:
2577
- $rs .= "<${typ}>" . base64_encode($val) . "</${typ}>";
2578
  break;
2579
  case $GLOBALS['xmlrpcBoolean']:
2580
- $rs .= "<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
2581
  break;
2582
  case $GLOBALS['xmlrpcString']:
2583
  // G. Giunta 2005/2/13: do NOT use htmlentities, since
2584
  // it will produce named html entities, which are invalid xml
2585
- $rs .= "<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</${typ}>";
2586
  break;
2587
  case $GLOBALS['xmlrpcInt']:
2588
  case $GLOBALS['xmlrpcI4']:
2589
- $rs .= "<${typ}>" . (int)$val . "</${typ}>";
2590
  break;
2591
  case $GLOBALS['xmlrpcDouble']:
2592
  // avoid using standard conversion of float to string because it is locale-dependent,
@@ -2594,56 +3013,71 @@ class xmlrpcval
2594
  // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
2595
  // The code below tries its best at keeping max precision while avoiding exp notation,
2596
  // but there is of course no limit in the number of decimal places to be used...
2597
- $rs .= "<${typ}>" . preg_replace('/\\.?0+$/', '', number_format((double)$val, 128, '.', '')) . "</${typ}>";
2598
  break;
2599
  case $GLOBALS['xmlrpcDateTime']:
2600
- if (is_string($val)) {
2601
- $rs .= "<${typ}>${val}</${typ}>";
2602
- } else if (is_a($val, 'DateTime')) {
2603
- $rs .= "<${typ}>" . $val->format('Ymd\TH:i:s') . "</${typ}>";
2604
- } else if (is_int($val)) {
2605
- $rs .= "<${typ}>" . strftime("%Y%m%dT%H:%M:%S", $val) . "</${typ}>";
2606
- } else {
 
 
 
 
 
 
 
2607
  // not really a good idea here: but what shall we output anyway? left for backward compat...
2608
- $rs .= "<${typ}>${val}</${typ}>";
2609
  }
2610
  break;
2611
  case $GLOBALS['xmlrpcNull']:
2612
- if ($GLOBALS['xmlrpc_null_apache_encoding']) {
2613
- $rs .= "<ex:nil/>";
2614
- } else {
2615
- $rs .= "<nil/>";
 
 
 
2616
  }
2617
  break;
2618
  default:
2619
  // no standard type value should arrive here, but provide a possibility
2620
  // for xmlrpcvals of unknown type...
2621
- $rs .= "<${typ}>${val}</${typ}>";
2622
  }
2623
  break;
2624
  case 3:
2625
  // struct
2626
- if ($this->_php_class) {
2627
- $rs .= '<struct php_class="' . $this->_php_class . "\">\n";
2628
- } else {
2629
- $rs .= "<struct>\n";
 
 
 
2630
  }
2631
- foreach ($val as $key2 => $val2) {
2632
- $rs .= '<member><name>' . xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</name>\n";
 
2633
  //$rs.=$this->serializeval($val2);
2634
- $rs .= $val2->serialize($charset_encoding);
2635
- $rs .= "</member>\n";
2636
  }
2637
- $rs .= '</struct>';
2638
  break;
2639
  case 2:
2640
  // array
2641
- $rs .= "<array>\n<data>\n";
2642
- for ($i = 0; $i < count($val); $i++) {
 
2643
  //$rs.=$this->serializeval($val[$i]);
2644
- $rs .= $val[$i]->serialize($charset_encoding);
2645
  }
2646
- $rs .= "</data>\n</array>";
2647
  break;
2648
  default:
2649
  break;
@@ -2657,7 +3091,7 @@ class xmlrpcval
2657
  * @return string
2658
  * @access public
2659
  */
2660
- function serialize($charset_encoding = '')
2661
  {
2662
  // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
2663
  //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
@@ -2674,7 +3108,7 @@ class xmlrpcval
2674
  // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
2675
  //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
2676
  //{
2677
- $ar = $o->me;
2678
  reset($ar);
2679
  list($typ, $val) = each($ar);
2680
  return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
@@ -2682,7 +3116,7 @@ class xmlrpcval
2682
  }
2683
 
2684
  /**
2685
- * Checks wheter a struct member with a given name is present.
2686
  * Works only on xmlrpcvals of type struct.
2687
  * @param string $m the name of the struct member to be looked up
2688
  * @return boolean
@@ -2730,28 +3164,33 @@ class xmlrpcval
2730
  {
2731
  // UNSTABLE
2732
  reset($this->me);
2733
- list($a, $b) = each($this->me);
2734
  // contributed by I Sofer, 2001-03-24
2735
  // add support for nested arrays to scalarval
2736
  // i've created a new method here, so as to
2737
  // preserve back compatibility
2738
 
2739
- if (is_array($b)) {
 
2740
  @reset($b);
2741
- while (list($id, $cont) = @each($b)) {
 
2742
  $b[$id] = $cont->scalarval();
2743
  }
2744
  }
2745
 
2746
  // add support for structures directly encoding php objects
2747
- if (is_object($b)) {
 
2748
  $t = get_object_vars($b);
2749
  @reset($t);
2750
- while (list($id, $cont) = @each($t)) {
 
2751
  $t[$id] = $cont->scalarval();
2752
  }
2753
  @reset($t);
2754
- while (list($id, $cont) = @each($t)) {
 
2755
  @$b->$id = $cont;
2756
  }
2757
  }
@@ -2767,7 +3206,7 @@ class xmlrpcval
2767
  function scalarval()
2768
  {
2769
  reset($this->me);
2770
- list(, $b) = each($this->me);
2771
  return $b;
2772
  }
2773
 
@@ -2780,9 +3219,10 @@ class xmlrpcval
2780
  function scalartyp()
2781
  {
2782
  reset($this->me);
2783
- list($a,) = each($this->me);
2784
- if ($a == $GLOBALS['xmlrpcI4']) {
2785
- $a = $GLOBALS['xmlrpcInt'];
 
2786
  }
2787
  return $a;
2788
  }
@@ -2839,17 +3279,23 @@ class xmlrpcval
2839
  * @param int $utc (0 or 1)
2840
  * @return string
2841
  */
2842
- function iso8601_encode($timet, $utc = 0)
2843
  {
2844
- if (!$utc) {
2845
- $t = strftime("%Y%m%dT%H:%M:%S", $timet);
2846
- } else {
2847
- if (function_exists('gmstrftime')) {
 
 
 
 
2848
  // gmstrftime doesn't exist in some versions
2849
  // of PHP
2850
- $t = gmstrftime("%Y%m%dT%H:%M:%S", $timet);
2851
- } else {
2852
- $t = strftime("%Y%m%dT%H:%M:%S", $timet - date('Z'));
 
 
2853
  }
2854
  }
2855
  return $t;
@@ -2861,14 +3307,18 @@ function iso8601_encode($timet, $utc = 0)
2861
  * @param int $utc either 0 or 1
2862
  * @return int (datetime)
2863
  */
2864
- function iso8601_decode($idate, $utc = 0)
2865
  {
2866
- $t = 0;
2867
- if (preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs)) {
2868
- if ($utc) {
2869
- $t = gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
2870
- } else {
2871
- $t = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
 
 
 
 
2872
  }
2873
  }
2874
  return $t;
@@ -2895,14 +3345,17 @@ function iso8601_decode($idate, $utc = 0)
2895
  * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects (standard is
2896
  * @return mixed
2897
  */
2898
- function php_xmlrpc_decode($xmlrpc_val, $options = array())
2899
  {
2900
- switch ($xmlrpc_val->kindOf()) {
 
2901
  case 'scalar':
2902
- if (in_array('extension_api', $options)) {
 
2903
  reset($xmlrpc_val->me);
2904
- list($typ, $val) = each($xmlrpc_val->me);
2905
- switch ($typ) {
 
2906
  case 'dateTime.iso8601':
2907
  $xmlrpc_val->scalar = $val;
2908
  $xmlrpc_val->xmlrpc_type = 'datetime';
@@ -2916,19 +3369,24 @@ function php_xmlrpc_decode($xmlrpc_val, $options = array())
2916
  return $xmlrpc_val->scalarval();
2917
  }
2918
  }
2919
- if (in_array('dates_as_objects', $options) && $xmlrpc_val->scalartyp() == 'dateTime.iso8601') {
 
2920
  // we return a Datetime object instead of a string
2921
  // since now the constructor of xmlrpcval accepts safely strings, ints and datetimes,
2922
  // we cater to all 3 cases here
2923
  $out = $xmlrpc_val->scalarval();
2924
- if (is_string($out)) {
 
2925
  $out = strtotime($out);
2926
  }
2927
- if (is_int($out)) {
 
2928
  $result = new Datetime();
2929
  $result->setTimestamp($out);
2930
  return $result;
2931
- } elseif (is_a($out, 'Datetime')) {
 
 
2932
  return $out;
2933
  }
2934
  }
@@ -2936,7 +3394,8 @@ function php_xmlrpc_decode($xmlrpc_val, $options = array())
2936
  case 'array':
2937
  $size = $xmlrpc_val->arraysize();
2938
  $arr = array();
2939
- for ($i = 0; $i < $size; $i++) {
 
2940
  $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
2941
  }
2942
  return $arr;
@@ -2947,16 +3406,20 @@ function php_xmlrpc_decode($xmlrpc_val, $options = array())
2947
  // shall we check for proper subclass of xmlrpcval instead of
2948
  // presence of _php_class to detect what we can do?
2949
  if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
2950
- && class_exists($xmlrpc_val->_php_class)
2951
- ) {
2952
  $obj = @new $xmlrpc_val->_php_class;
2953
- while (list($key, $value) = $xmlrpc_val->structeach()) {
 
2954
  $obj->$key = php_xmlrpc_decode($value, $options);
2955
  }
2956
  return $obj;
2957
- } else {
 
 
2958
  $arr = array();
2959
- while (list($key, $value) = $xmlrpc_val->structeach()) {
 
2960
  $arr[$key] = php_xmlrpc_decode($value, $options);
2961
  }
2962
  return $arr;
@@ -2964,7 +3427,8 @@ function php_xmlrpc_decode($xmlrpc_val, $options = array())
2964
  case 'msg':
2965
  $paramcount = $xmlrpc_val->getNumParams();
2966
  $arr = array();
2967
- for ($i = 0; $i < $paramcount; $i++) {
 
2968
  $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
2969
  }
2970
  return $arr;
@@ -2974,10 +3438,13 @@ function php_xmlrpc_decode($xmlrpc_val, $options = array())
2974
  // This constant left here only for historical reasons...
2975
  // it was used to decide if we have to define xmlrpc_encode on our own, but
2976
  // we do not do it anymore
2977
- if (function_exists('xmlrpc_decode')) {
2978
- define('XMLRPC_EPI_ENABLED', '1');
2979
- } else {
2980
- define('XMLRPC_EPI_ENABLED', '0');
 
 
 
2981
  }
2982
 
2983
  /**
@@ -2994,19 +3461,20 @@ if (function_exists('xmlrpc_decode')) {
2994
  * @author Dan Libby (dan@libby.com)
2995
  *
2996
  * @param mixed $php_val the value to be converted into an xmlrpcval object
2997
- * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
2998
  * @return xmlrpcval
2999
  */
3000
- function php_xmlrpc_encode($php_val, $options = array())
3001
  {
3002
  $type = gettype($php_val);
3003
- switch ($type) {
 
3004
  case 'string':
3005
- if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val)) {
3006
  $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
3007
- } else if (in_array('auto_base64', $options) && strpos($php_val, 'BASE64:') === 0) {
3008
  $xmlrpc_val = new xmlrpcval(substr($php_val, 7), $GLOBALS['xmlrpcBase64']);
3009
- } else {
3010
  $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
3011
  }
3012
  break;
@@ -3031,32 +3499,44 @@ function php_xmlrpc_encode($php_val, $options = array())
3031
  $j = 0;
3032
  $arr = array();
3033
  $ko = false;
3034
- foreach ($php_val as $key => $val) {
 
3035
  $arr[$key] = php_xmlrpc_encode($val, $options);
3036
- if (!$ko && $key !== $j) {
 
3037
  $ko = true;
3038
  }
3039
  $j++;
3040
  }
3041
- if ($ko) {
 
3042
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
3043
- } else {
 
 
3044
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
3045
  }
3046
  break;
3047
  case 'object':
3048
- if (is_a($php_val, 'xmlrpcval')) {
 
3049
  $xmlrpc_val = $php_val;
3050
- } else if (is_a($php_val, 'DateTime')) {
 
 
3051
  $xmlrpc_val = new xmlrpcval($php_val->format('Ymd\TH:i:s'), $GLOBALS['xmlrpcStruct']);
3052
- } else {
 
 
3053
  $arr = array();
3054
  reset($php_val);
3055
- while (list($k, $v) = each($php_val)) {
 
3056
  $arr[$k] = php_xmlrpc_encode($v, $options);
3057
  }
3058
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
3059
- if (in_array('encode_php_objs', $options)) {
 
3060
  // let's save original class name into xmlrpcval:
3061
  // might be useful later on...
3062
  $xmlrpc_val->_php_class = get_class($php_val);
@@ -3064,18 +3544,26 @@ function php_xmlrpc_encode($php_val, $options = array())
3064
  }
3065
  break;
3066
  case 'NULL':
3067
- if (in_array('extension_api', $options)) {
 
3068
  $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);
3069
- } else if (in_array('null_extension', $options)) {
 
 
3070
  $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);
3071
- } else {
 
 
3072
  $xmlrpc_val = new xmlrpcval();
3073
  }
3074
  break;
3075
  case 'resource':
3076
- if (in_array('extension_api', $options)) {
 
3077
  $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
3078
- } else {
 
 
3079
  $xmlrpc_val = new xmlrpcval();
3080
  }
3081
  // catch "user function", "unknown type"
@@ -3096,7 +3584,7 @@ function php_xmlrpc_encode($php_val, $options = array())
3096
  * @param array $options
3097
  * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
3098
  */
3099
- function php_xmlrpc_decode_xml($xml_val, $options = array())
3100
  {
3101
  $GLOBALS['_xh'] = array();
3102
  $GLOBALS['_xh']['ac'] = '';
@@ -3113,15 +3601,19 @@ function php_xmlrpc_decode_xml($xml_val, $options = array())
3113
  xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
3114
  // What if internal encoding is not in one of the 3 allowed?
3115
  // we use the broadest one, ie. utf8!
3116
- if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
 
3117
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
3118
- } else {
 
 
3119
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
3120
  }
3121
  xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
3122
  xml_set_character_data_handler($parser, 'xmlrpc_cd');
3123
  xml_set_default_handler($parser, 'xmlrpc_dh');
3124
- if (!xml_parse($parser, $xml_val, 1)) {
 
3125
  $errstr = sprintf('XML error: %s at line %d, column %d',
3126
  xml_error_string(xml_get_error_code($parser)),
3127
  xml_get_current_line_number($parser), xml_get_current_column_number($parser));
@@ -3135,20 +3627,25 @@ function php_xmlrpc_decode_xml($xml_val, $options = array())
3135
  error_log($GLOBALS['_xh']['isf_reason']);
3136
  return false;
3137
  }
3138
- switch ($GLOBALS['_xh']['rt']) {
 
3139
  case 'methodresponse':
3140
  $v =& $GLOBALS['_xh']['value'];
3141
- if ($GLOBALS['_xh']['isf'] == 1) {
 
3142
  $vc = $v->structmem('faultCode');
3143
  $vs = $v->structmem('faultString');
3144
  $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
3145
- } else {
 
 
3146
  $r = new xmlrpcresp($v);
3147
  }
3148
  return $r;
3149
  case 'methodcall':
3150
  $m = new xmlrpcmsg($GLOBALS['_xh']['method']);
3151
- for ($i = 0; $i < count($GLOBALS['_xh']['params']); $i++) {
 
3152
  $m->addParam($GLOBALS['_xh']['params'][$i]);
3153
  }
3154
  return $m;
@@ -3175,16 +3672,18 @@ function decode_chunked($buffer)
3175
 
3176
  // read chunk-size, chunk-extension (if any) and crlf
3177
  // get the position of the linebreak
3178
- $chunkend = strpos($buffer, "\r\n") + 2;
3179
- $temp = substr($buffer, 0, $chunkend);
3180
- $chunk_size = hexdec(trim($temp));
3181
  $chunkstart = $chunkend;
3182
- while ($chunk_size > 0) {
 
3183
  $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
3184
 
3185
  // just in case we got a broken connection
3186
- if ($chunkend == false) {
3187
- $chunk = substr($buffer, $chunkstart);
 
3188
  // append chunk-data to entity-body
3189
  $new .= $chunk;
3190
  $length += strlen($chunk);
@@ -3192,7 +3691,7 @@ function decode_chunked($buffer)
3192
  }
3193
 
3194
  // read chunk-data and crlf
3195
- $chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart);
3196
  // append chunk-data to entity-body
3197
  $new .= $chunk;
3198
  // length := length + chunk-size
@@ -3200,12 +3699,13 @@ function decode_chunked($buffer)
3200
  // read chunk-size and crlf
3201
  $chunkstart = $chunkend + 2;
3202
 
3203
- $chunkend = strpos($buffer, "\r\n", $chunkstart) + 2;
3204
- if ($chunkend == false) {
 
3205
  break; //just in case we got a broken connection
3206
  }
3207
- $temp = substr($buffer, $chunkstart, $chunkend - $chunkstart);
3208
- $chunk_size = hexdec(trim($temp));
3209
  $chunkstart = $chunkend;
3210
  }
3211
  return $new;
@@ -3218,13 +3718,14 @@ function decode_chunked($buffer)
3218
  * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
3219
  * which will be most probably using UTF-8 anyway...
3220
  *
3221
- * @param string $httpheaders the http Content-type header
3222
  * @param string $xmlchunk xml content buffer
3223
  * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
 
3224
  *
3225
  * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
3226
  */
3227
- function guess_encoding($httpheader = '', $xmlchunk = '', $encoding_prefs = null)
3228
  {
3229
  // discussion: see http://www.yale.edu/pclt/encoding/
3230
  // 1 - test if encoding is specified in HTTP HEADERS
@@ -3242,7 +3743,8 @@ function guess_encoding($httpheader = '', $xmlchunk = '', $encoding_prefs = null
3242
 
3243
  /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
3244
  $matches = array();
3245
- if (preg_match('/;\s*charset\s*=([^;]+)/i', $httpheader, $matches)) {
 
3246
  return strtoupper(trim($matches[1], " \t\""));
3247
  }
3248
 
@@ -3253,11 +3755,16 @@ function guess_encoding($httpheader = '', $xmlchunk = '', $encoding_prefs = null
3253
  // in the xml declaration, and verify if they match.
3254
  /// @todo implement check as described above?
3255
  /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
3256
- if (preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk)) {
 
3257
  return 'UCS-4';
3258
- } elseif (preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk)) {
 
 
3259
  return 'UTF-16';
3260
- } elseif (preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk)) {
 
 
3261
  return 'UTF-8';
3262
  }
3263
 
@@ -3265,28 +3772,35 @@ function guess_encoding($httpheader = '', $xmlchunk = '', $encoding_prefs = null
3265
  // Details:
3266
  // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
3267
  // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
3268
- if (preg_match('/^<\?xml\s+version\s*=\s*' . "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))" .
3269
  '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
3270
- $xmlchunk, $matches)
3271
- ) {
3272
  return strtoupper(substr($matches[2], 1, -1));
3273
  }
3274
 
3275
  // 4 - if mbstring is available, let it do the guesswork
3276
  // NB: we favour finding an encoding that is compatible with what we can process
3277
- if (extension_loaded('mbstring')) {
3278
- if ($encoding_prefs) {
 
 
3279
  $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
3280
- } else {
 
 
3281
  $enc = mb_detect_encoding($xmlchunk);
3282
  }
3283
  // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
3284
  // IANA also likes better US-ASCII, so go with it
3285
- if ($enc == 'ASCII') {
3286
- $enc = 'US-' . $enc;
 
3287
  }
3288
  return $enc;
3289
- } else {
 
 
3290
  // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
3291
  // Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly state that for text/xxx content types
3292
  // this should be the standard. And we should be getting text/xml as request and response.
@@ -3300,11 +3814,12 @@ function guess_encoding($httpheader = '', $xmlchunk = '', $encoding_prefs = null
3300
  * if it is a valid subset of any encoding in the list
3301
  * @param string $encoding charset to be tested
3302
  * @param mixed $validlist comma separated list of valid charsets (or array of charsets)
 
3303
  */
3304
  function is_valid_charset($encoding, $validlist)
3305
  {
3306
  $charset_supersets = array(
3307
- 'US-ASCII' => array('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
3308
  'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
3309
  'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
3310
  'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
@@ -3314,7 +3829,8 @@ function is_valid_charset($encoding, $validlist)
3314
  $validlist = explode(',', $validlist);
3315
  if (@in_array(strtoupper($encoding), $validlist))
3316
  return true;
3317
- else {
 
3318
  if (array_key_exists($encoding, $charset_supersets))
3319
  foreach ($validlist as $allowed)
3320
  if (in_array($allowed, $charset_supersets[$encoding]))
@@ -3322,5 +3838,3 @@ function is_valid_charset($encoding, $validlist)
3322
  return false;
3323
  }
3324
  }
3325
-
3326
- ?>
1
  <?php
2
  // by Edd Dumbill (C) 1999-2002
3
  // <edd@usefulinc.com>
 
4
 
5
  // Copyright (c) 1999,2000,2002 Edd Dumbill.
6
  // All rights reserved.
34
  // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
35
  // OF THE POSSIBILITY OF SUCH DAMAGE.
36
 
37
+ if(!function_exists('xml_parser_create'))
38
+ {
 
 
39
  // For PHP 4 onward, XML functionality is always compiled-in on windows:
40
  // no more need to dl-open it. It might have been compiled out on *nix...
41
+ if(strtoupper(substr(PHP_OS, 0, 3) != 'WIN'))
42
+ {
43
  dl('xml.so');
44
  }
45
  }
47
  // G. Giunta 2005/01/29: declare global these variables,
48
  // so that xmlrpc.inc will work even if included from within a function
49
  // Milosch: 2005/08/07 - explicitly request these via $GLOBALS where used.
50
+ $GLOBALS['xmlrpcI4']='i4';
51
+ $GLOBALS['xmlrpcInt']='int';
52
+ $GLOBALS['xmlrpcBoolean']='boolean';
53
+ $GLOBALS['xmlrpcDouble']='double';
54
+ $GLOBALS['xmlrpcString']='string';
55
+ $GLOBALS['xmlrpcDateTime']='dateTime.iso8601';
56
+ $GLOBALS['xmlrpcBase64']='base64';
57
+ $GLOBALS['xmlrpcArray']='array';
58
+ $GLOBALS['xmlrpcStruct']='struct';
59
+ $GLOBALS['xmlrpcValue']='undefined';
60
+
61
+ $GLOBALS['xmlrpcTypes']=array(
62
+ $GLOBALS['xmlrpcI4'] => 1,
63
+ $GLOBALS['xmlrpcInt'] => 1,
64
+ $GLOBALS['xmlrpcBoolean'] => 1,
65
+ $GLOBALS['xmlrpcString'] => 1,
66
+ $GLOBALS['xmlrpcDouble'] => 1,
67
  $GLOBALS['xmlrpcDateTime'] => 1,
68
+ $GLOBALS['xmlrpcBase64'] => 1,
69
+ $GLOBALS['xmlrpcArray'] => 2,
70
+ $GLOBALS['xmlrpcStruct'] => 3
71
  );
72
 
73
  $GLOBALS['xmlrpc_valid_parents'] = array(
93
  );
94
 
95
  // define extra types for supporting NULL (useful for json or <NIL/>)
96
+ $GLOBALS['xmlrpcNull']='null';
97
+ $GLOBALS['xmlrpcTypes']['null']=1;
98
 
99
  // Not in use anymore since 2.0. Shall we remove it?
100
  /// @deprecated
101
+ $GLOBALS['xmlEntities']=array(
102
+ 'amp' => '&',
103
  'quot' => '"',
104
+ 'lt' => '<',
105
+ 'gt' => '>',
106
  'apos' => "'"
107
  );
108
 
109
  // tables used for transcoding different charsets into us-ascii xml
110
 
111
+ $GLOBALS['xml_iso88591_Entities']=array();
112
  $GLOBALS['xml_iso88591_Entities']['in'] = array();
113
  $GLOBALS['xml_iso88591_Entities']['out'] = array();
114
+ for ($i = 0; $i < 32; $i++)
115
+ {
116
  $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
117
+ $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
118
  }
119
+ for ($i = 160; $i < 256; $i++)
120
+ {
121
  $GLOBALS['xml_iso88591_Entities']['in'][] = chr($i);
122
+ $GLOBALS['xml_iso88591_Entities']['out'][] = '&#'.$i.';';
123
  }
124
 
125
  /// @todo add to iso table the characters from cp_1252 range, i.e. 128 to 159?
126
  /// These will NOT be present in true ISO-8859-1, but will save the unwary
127
  /// windows user from sending junk (though no luck when reciving them...)
128
  /*
129
+ $GLOBALS['xml_cp1252_Entities']=array();
130
+ for ($i = 128; $i < 160; $i++)
131
+ {
132
+ $GLOBALS['xml_cp1252_Entities']['in'][] = chr($i);
133
+ }
134
+ $GLOBALS['xml_cp1252_Entities']['out'] = array(
135
+ '&#x20AC;', '?', '&#x201A;', '&#x0192;',
136
+ '&#x201E;', '&#x2026;', '&#x2020;', '&#x2021;',
137
+ '&#x02C6;', '&#x2030;', '&#x0160;', '&#x2039;',
138
+ '&#x0152;', '?', '&#x017D;', '?',
139
+ '?', '&#x2018;', '&#x2019;', '&#x201C;',
140
+ '&#x201D;', '&#x2022;', '&#x2013;', '&#x2014;',
141
+ '&#x02DC;', '&#x2122;', '&#x0161;', '&#x203A;',
142
+ '&#x0153;', '?', '&#x017E;', '&#x0178;'
143
+ );
144
+ */
145
 
146
  $GLOBALS['xmlrpcerr'] = array(
147
+ 'unknown_method'=>1,
148
+ 'invalid_return'=>2,
149
+ 'incorrect_params'=>3,
150
+ 'introspect_unknown'=>4,
151
+ 'http_error'=>5,
152
+ 'no_data'=>6,
153
+ 'no_ssl'=>7,
154
+ 'curl_fail'=>8,
155
+ 'invalid_request'=>15,
156
+ 'no_curl'=>16,
157
+ 'server_error'=>17,
158
+ 'multicall_error'=>18,
159
+ 'multicall_notstruct'=>9,
160
+ 'multicall_nomethod'=>10,
161
+ 'multicall_notstring'=>11,
162
+ 'multicall_recursion'=>12,
163
+ 'multicall_noparams'=>13,
164
+ 'multicall_notarray'=>14,
165
+
166
+ 'cannot_decompress'=>103,
167
+ 'decompress_fail'=>104,
168
+ 'dechunk_fail'=>105,
169
+ 'server_cannot_decompress'=>106,
170
+ 'server_decompress_fail'=>107
171
  );
172
 
173
  $GLOBALS['xmlrpcstr'] = array(
174
+ 'unknown_method'=>'Unknown method',
175
+ 'invalid_return'=>'Invalid return payload: enable debugging to examine incoming payload',
176
+ 'incorrect_params'=>'Incorrect parameters passed to method',
177
+ 'introspect_unknown'=>"Can't introspect: method unknown",
178
+ 'http_error'=>"Didn't receive 200 OK from remote server.",
179
+ 'no_data'=>'No data received from server.',
180
+ 'no_ssl'=>'No SSL support compiled in.',
181
+ 'curl_fail'=>'CURL error',
182
+ 'invalid_request'=>'Invalid request payload',
183
+ 'no_curl'=>'No CURL support compiled in.',
184
+ 'server_error'=>'Internal server error',
185
+ 'multicall_error'=>'Received from server invalid multicall response',
186
+ 'multicall_notstruct'=>'system.multicall expected struct',
187
+ 'multicall_nomethod'=>'missing methodName',
188
+ 'multicall_notstring'=>'methodName is not a string',
189
+ 'multicall_recursion'=>'recursive system.multicall forbidden',
190
+ 'multicall_noparams'=>'missing params',
191
+ 'multicall_notarray'=>'params is not an array',
192
+
193
+ 'cannot_decompress'=>'Received from server compressed HTTP and cannot decompress',
194
+ 'decompress_fail'=>'Received from server invalid compressed HTTP',
195
+ 'dechunk_fail'=>'Received from server invalid chunked HTTP',
196
+ 'server_cannot_decompress'=>'Received from client compressed HTTP request and cannot decompress',
197
+ 'server_decompress_fail'=>'Received from client invalid compressed HTTP request'
198
  );
199
 
200
  // The charset encoding used by the server for received messages and
201
  // by the client for received responses when received charset cannot be determined
202
  // or is not supported
203
+ $GLOBALS['xmlrpc_defencoding']='UTF-8';
204
 
205
  // The encoding used internally by PHP.
206
  // String values received as xml will be converted to this, and php strings will be converted to xml
207
  // as if having been coded with this
208
+ $GLOBALS['xmlrpc_internalencoding']='UTF-8';
209
+
210
+ $GLOBALS['xmlrpcName']='XML-RPC for PHP';
211
+ $GLOBALS['xmlrpcVersion']='3.0.0.beta';
212
 
213
  // let user errors start at 800
214
+ $GLOBALS['xmlrpcerruser']=800;
215
  // let XML parse errors start at 100
216
+ $GLOBALS['xmlrpcerrxml']=100;
217
 
218
  // formulate backslashes for escaping regexp
219
  // Not in use anymore since 2.0. Shall we remove it?
220
  /// @deprecated
221
+ $GLOBALS['xmlrpc_backslash']=chr(92).chr(92);
222
 
223
  // set to TRUE to enable correct decoding of <NIL/> and <EX:NIL/> values
224
+ $GLOBALS['xmlrpc_null_extension']=false;
225
 
226
  // set to TRUE to enable encoding of php NULL values to <EX:NIL/> instead of <NIL/>
227
+ $GLOBALS['xmlrpc_null_apache_encoding']=false;
228
+ $GLOBALS['xmlrpc_null_apache_encoding_ns']='http://ws.apache.org/xmlrpc/namespaces/extensions';
229
 
230
  // used to store state during parsing
231
  // quick explanation of components:
238
  // method - used to store method name
239
  // stack - array with genealogy of xml elements names:
240
  // used to validate nesting of xmlrpc elements
241
+ $GLOBALS['_xh']=null;
242
 
243
  /**
244
  * Convert a string to the correct XML representation in a target charset
252
  * along with http headers, so we are bound by RFC 3023 to emit strict us-ascii.
253
  *
254
  * @todo do a bit of basic benchmarking (strtr vs. str_replace)
255
+ * @todo make usage of iconv() or recode_string() or mb_string() where available
256
  */
257
+ function xmlrpc_encode_entitites($data, $src_encoding='', $dest_encoding='')
258
  {
259
+ /* Jordan Novak edit
260
+ * clean out invalid characters before sending
261
+ */
262
+ $data = str_replace(array("&#11;", "&#0;", "&#20;", "’", "“", "”"), "", $data);
263
+ /*
264
+ * End Jordan Novak edit
265
+ */
266
+ if ($src_encoding == '')
267
+ {
268
  // lame, but we know no better...
269
  $src_encoding = $GLOBALS['xmlrpc_internalencoding'];
270
  }
271
 
272
+ switch(strtoupper($src_encoding.'_'.$dest_encoding))
273
+ {
274
  case 'ISO-8859-1_':
275
  case 'ISO-8859-1_US-ASCII':
276
  $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
292
  case 'UTF-8_':
293
  case 'UTF-8_US-ASCII':
294
  case 'UTF-8_ISO-8859-1':
295
+ // NB: this will choke on invalid UTF-8, going most likely beyond EOF
296
  $escaped_data = '';
297
+ // be kind to users creating string xmlrpcvals out of different php types
298
+ $data = (string) $data;
299
+ $ns = strlen ($data);
300
+ for ($nn = 0; $nn < $ns; $nn++)
301
+ {
302
  $ch = $data[$nn];
303
  $ii = ord($ch);
304
  //1 7 0bbbbbbb (127)
305
+ if ($ii < 128)
306
+ {
307
  /// @todo shall we replace this with a (supposedly) faster str_replace?
308
+ switch($ii){
309
  case 34:
310
  $escaped_data .= '&quot;';
311
  break;
324
  default:
325
  $escaped_data .= $ch;
326
  } // switch
327
+ }
328
+ //2 11 110bbbbb 10bbbbbb (2047)
329
+ else if ($ii>>5 == 6)
330
+ {
331
  $b1 = ($ii & 31);
332
+ $ii = ord($data[$nn+1]);
333
  $b2 = ($ii & 63);
334
  $ii = ($b1 * 64) + $b2;
335
+ $ent = sprintf ('&#%d;', $ii);
336
  $escaped_data .= $ent;
337
  $nn += 1;
338
+ }
339
+ //3 16 1110bbbb 10bbbbbb 10bbbbbb
340
+ else if ($ii>>4 == 14)
341
+ {
342
  $b1 = ($ii & 15);
343
+ $ii = ord($data[$nn+1]);
344
  $b2 = ($ii & 63);
345
+ $ii = ord($data[$nn+2]);
346
  $b3 = ($ii & 63);
347
  $ii = ((($b1 * 64) + $b2) * 64) + $b3;
348
+ $ent = sprintf ('&#%d;', $ii);
349
  $escaped_data .= $ent;
350
  $nn += 2;
351
+ }
352
+ //4 21 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb
353
+ else if ($ii>>3 == 30)
354
+ {
355
  $b1 = ($ii & 7);
356
+ $ii = ord($data[$nn+1]);
357
  $b2 = ($ii & 63);
358
+ $ii = ord($data[$nn+2]);
359
  $b3 = ($ii & 63);
360
+ $ii = ord($data[$nn+3]);
361
  $b4 = ($ii & 63);
362
  $ii = ((((($b1 * 64) + $b2) * 64) + $b3) * 64) + $b4;
363
+ $ent = sprintf ('&#%d;', $ii);
364
  $escaped_data .= $ent;
365
  $nn += 3;
366
  }
367
  }
368
  break;
369
  /*
370
+ case 'CP1252_':
371
+ case 'CP1252_US-ASCII':
372
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
373
+ $escaped_data = str_replace($GLOBALS['xml_iso88591_Entities']['in'], $GLOBALS['xml_iso88591_Entities']['out'], $escaped_data);
374
+ $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
375
+ break;
376
+ case 'CP1252_UTF-8':
377
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
378
+ /// @todo we could use real UTF8 chars here instead of xml entities... (note that utf_8 encode all allone will NOT convert them)
379
+ $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
380
+ $escaped_data = utf8_encode($escaped_data);
381
+ break;
382
+ case 'CP1252_ISO-8859-1':
383
+ $escaped_data = str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $data);
384
+ // we might as well replave all funky chars with a '?' here, but we are kind and leave it to the receiving application layer to decide what to do with these weird entities...
385
+ $escaped_data = str_replace($GLOBALS['xml_cp1252_Entities']['in'], $GLOBALS['xml_cp1252_Entities']['out'], $escaped_data);
386
+ break;
387
+ */
388
  default:
389
  $escaped_data = '';
390
  error_log("Converting from $src_encoding to $dest_encoding: not supported...");
393
  }
394
 
395
  /// xml parser handler function for opening element tags
396
+ function xmlrpc_se($parser, $name, $attrs, $accept_single_vals=false)
397
  {
398
  // if invalid xmlrpc already detected, skip all processing
399
+ if ($GLOBALS['_xh']['isf'] < 2)
400
+ {
401
  // check for correct element nesting
402
  // top level element can only be of 2 types
403
  /// @todo optimization creep: save this check into a bool variable, instead of using count() every time:
404
  /// there is only a single top level element in xml anyway
405
+ if (count($GLOBALS['_xh']['stack']) == 0)
406
+ {
407
  if ($name != 'METHODRESPONSE' && $name != 'METHODCALL' && (
408
+ $name != 'VALUE' && !$accept_single_vals))
409
+ {
410
  $GLOBALS['_xh']['isf'] = 2;
411
  $GLOBALS['_xh']['isf_reason'] = 'missing top level xmlrpc element';
412
  return;
413
+ }
414
+ else
415
+ {
416
  $GLOBALS['_xh']['rt'] = strtolower($name);
417
  $GLOBALS['_xh']['rt'] = strtolower($name);
418
  }
419
+ }
420
+ else
421
+ {
422
  // not top level element: see if parent is OK
423
  $parent = end($GLOBALS['_xh']['stack']);
424
+ if (!array_key_exists($name, $GLOBALS['xmlrpc_valid_parents']) || !in_array($parent, $GLOBALS['xmlrpc_valid_parents'][$name]))
425
+ {
426
  $GLOBALS['_xh']['isf'] = 2;
427
  $GLOBALS['_xh']['isf_reason'] = "xmlrpc element $name cannot be child of $parent";
428
  return;
429
  }
430
  }
431
 
432
+ switch($name)
433
+ {
434
  // optimize for speed switch cases: most common cases first
435
  case 'VALUE':
436
  /// @todo we could check for 2 VALUE elements inside a MEMBER or PARAM element
437
+ $GLOBALS['_xh']['vt']='value'; // indicator: no value found yet
438
+ $GLOBALS['_xh']['ac']='';
439
+ $GLOBALS['_xh']['lv']=1;
440
+ $GLOBALS['_xh']['php_class']=null;
441
  break;
442
  case 'I4':
443
  case 'INT':
446
  case 'DOUBLE':
447
  case 'DATETIME.ISO8601':
448
  case 'BASE64':
449
+ if ($GLOBALS['_xh']['vt']!='value')
450
+ {
451
  //two data elements inside a value: an error occurred!
452
  $GLOBALS['_xh']['isf'] = 2;
453
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
454
  return;
455
  }
456
+ $GLOBALS['_xh']['ac']=''; // reset the accumulator
457
  break;
458
  case 'STRUCT':
459
  case 'ARRAY':
460
+ if ($GLOBALS['_xh']['vt']!='value')
461
+ {
462
  //two data elements inside a value: an error occurred!
463
  $GLOBALS['_xh']['isf'] = 2;
464
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
470
  $cur_val['type'] = $name;
471
  // check for out-of-band information to rebuild php objs
472
  // and in case it is found, save it
473
+ if (@isset($attrs['PHP_CLASS']))
474
+ {
475
  $cur_val['php_class'] = $attrs['PHP_CLASS'];
476
  }
477
  $GLOBALS['_xh']['valuestack'][] = $cur_val;
478
+ $GLOBALS['_xh']['vt']='data'; // be prepared for a data element next
479
  break;
480
  case 'DATA':
481
+ if ($GLOBALS['_xh']['vt']!='data')
482
+ {
483
  //two data elements inside a value: an error occurred!
484
  $GLOBALS['_xh']['isf'] = 2;
485
  $GLOBALS['_xh']['isf_reason'] = "found two data elements inside an array element";
493
  case 'METHODNAME':
494
  case 'NAME':
495
  /// @todo we could check for 2 NAME elements inside a MEMBER element
496
+ $GLOBALS['_xh']['ac']='';
497
  break;
498
  case 'FAULT':
499
+ $GLOBALS['_xh']['isf']=1;
500
  break;
501
  case 'MEMBER':
502
+ $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name']=''; // set member name to null, in case we do not find in the xml later on
503
  //$GLOBALS['_xh']['ac']='';
504
  // Drop trough intentionally
505
  case 'PARAM':
506
  // clear value type, so we can check later if no value has been passed for this param/member
507
+ $GLOBALS['_xh']['vt']=null;
508
  break;
509
  case 'NIL':
510
  break;
511
  case 'EX:NIL':
512
+ if ($GLOBALS['xmlrpc_null_extension'])
513
+ {
514
+ if ($GLOBALS['_xh']['vt']!='value')
515
+ {
516
  //two data elements inside a value: an error occurred!
517
  $GLOBALS['_xh']['isf'] = 2;
518
  $GLOBALS['_xh']['isf_reason'] = "$name element following a {$GLOBALS['_xh']['vt']} element inside a single value";
519
  return;
520
  }
521
+ $GLOBALS['_xh']['ac']=''; // reset the accumulator
522
  break;
523
  }
524
  // we do not support the <NIL/> extension, so
534
  $GLOBALS['_xh']['stack'][] = $name;
535
 
536
  /// @todo optimization creep: move this inside the big switch() above
537
+ if($name!='VALUE')
538
+ {
539
+ $GLOBALS['_xh']['lv']=0;
540
  }
541
  }
542
  }
550
  /// xml parser handler function for close element tags
551
  function xmlrpc_ee($parser, $name, $rebuild_xmlrpcvals = true)
552
  {
553
+ if ($GLOBALS['_xh']['isf'] < 2)
554
+ {
555
  // push this element name from stack
556
  // NB: if XML validates, correct opening/closing is guaranteed and
557
  // we do not have to check for $name == $curr_elem.
558
  // we also checked for proper nesting at start of elements...
559
  $curr_elem = array_pop($GLOBALS['_xh']['stack']);
560
 
561
+ switch($name)
562
+ {
563
  case 'VALUE':
564
  // This if() detects if no scalar was inside <VALUE></VALUE>
565
+ if ($GLOBALS['_xh']['vt']=='value')
566
+ {
567
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
568
+ $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcString'];
569
  }
570
 
571
+ if ($rebuild_xmlrpcvals)
572
+ {
573
  // build the xmlrpc val out of the data received, and substitute it
574
  $temp = new xmlrpcval($GLOBALS['_xh']['value'], $GLOBALS['_xh']['vt']);
575
  // in case we got info about underlying php class, save it
579
  // check if we are inside an array or struct:
580
  // if value just built is inside an array, let's move it into array on the stack
581
  $vscount = count($GLOBALS['_xh']['valuestack']);
582
+ if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
583
+ {
584
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $temp;
585
+ }
586
+ else
587
+ {
588
  $GLOBALS['_xh']['value'] = $temp;
589
  }
590
+ }
591
+ else
592
+ {
593
  /// @todo this needs to treat correctly php-serialized objects,
594
  /// since std deserializing is done by php_xmlrpc_decode,
595
  /// which we will not be calling...
596
+ if (isset($GLOBALS['_xh']['php_class']))
597
+ {
598
  }
599
 
600
  // check if we are inside an array or struct:
601
  // if value just built is inside an array, let's move it into array on the stack
602
  $vscount = count($GLOBALS['_xh']['valuestack']);
603
+ if ($vscount && $GLOBALS['_xh']['valuestack'][$vscount-1]['type']=='ARRAY')
604
+ {
605
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][] = $GLOBALS['_xh']['value'];
606
  }
607
  }
608
  break;
613
  case 'DOUBLE':
614
  case 'DATETIME.ISO8601':
615
  case 'BASE64':
616
+ $GLOBALS['_xh']['vt']=strtolower($name);
617
  /// @todo: optimization creep - remove the if/elseif cycle below
618
  /// since the case() in which we are already did that
619
+ if ($name=='STRING')
620
+ {
621
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
622
+ }
623
+ elseif ($name=='DATETIME.ISO8601')
624
+ {
625
+ if (!preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $GLOBALS['_xh']['ac']))
626
+ {
627
+ error_log('XML-RPC: invalid value received in DATETIME: '.$GLOBALS['_xh']['ac']);
628
  }
629
+ $GLOBALS['_xh']['vt']=$GLOBALS['xmlrpcDateTime'];
630
+ $GLOBALS['_xh']['value']=$GLOBALS['_xh']['ac'];
631
+ }
632
+ elseif ($name=='BASE64')
633
+ {
634
  /// @todo check for failure of base64 decoding / catch warnings
635
+ $GLOBALS['_xh']['value']=base64_decode($GLOBALS['_xh']['ac']);
636
+ }
637
+ elseif ($name=='BOOLEAN')
638
+ {
639
  // special case here: we translate boolean 1 or 0 into PHP
640
  // constants true or false.
641
  // Strings 'true' and 'false' are accepted, even though the
642
  // spec never mentions them (see eg. Blogger api docs)
643
  // NB: this simple checks helps a lot sanitizing input, ie no
644
  // security problems around here
645
+ if ($GLOBALS['_xh']['ac']=='1' || strcasecmp($GLOBALS['_xh']['ac'], 'true') == 0)
646
+ {
647
+ $GLOBALS['_xh']['value']=true;
648
+ }
649
+ else
650
+ {
651
  // log if receiveing something strange, even though we set the value to false anyway
652
+ if ($GLOBALS['_xh']['ac']!='0' && strcasecmp($GLOBALS['_xh']['ac'], 'false') != 0)
653
+ error_log('XML-RPC: invalid value received in BOOLEAN: '.$GLOBALS['_xh']['ac']);
654
+ $GLOBALS['_xh']['value']=false;
655
  }
656
+ }
657
+ elseif ($name=='DOUBLE')
658
+ {
659
  // we have a DOUBLE
660
  // we must check that only 0123456789-.<space> are characters here
661
  // NOTE: regexp could be much stricter than this...
662
+ if (!preg_match('/^[+-eE0123456789 \t.]+$/', $GLOBALS['_xh']['ac']))
663
+ {
664
  /// @todo: find a better way of throwing an error than this!
665
+ error_log('XML-RPC: non numeric value received in DOUBLE: '.$GLOBALS['_xh']['ac']);
666
+ $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
667
+ }
668
+ else
669
+ {
670
  // it's ok, add it on
671
+ $GLOBALS['_xh']['value']=(double)$GLOBALS['_xh']['ac'];
672
  }
673
+ }
674
+ else
675
+ {
676
  // we have an I4/INT
677
  // we must check that only 0123456789-<space> are characters here
678
+ if (!preg_match('/^[+-]?[0123456789 \t]+$/', $GLOBALS['_xh']['ac']))
679
+ {
680
  /// @todo find a better way of throwing an error than this!
681
+ error_log('XML-RPC: non numeric value received in INT: '.$GLOBALS['_xh']['ac']);
682
+ $GLOBALS['_xh']['value']='ERROR_NON_NUMERIC_FOUND';
683
+ }
684
+ else
685
+ {
686
  // it's ok, add it on
687
+ $GLOBALS['_xh']['value']=(int)$GLOBALS['_xh']['ac'];
688
  }
689
  }
690
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
691
+ $GLOBALS['_xh']['lv']=3; // indicate we've found a value
692
  break;
693
  case 'NAME':
694
+ $GLOBALS['_xh']['valuestack'][count($GLOBALS['_xh']['valuestack'])-1]['name'] = $GLOBALS['_xh']['ac'];
695
  break;
696
  case 'MEMBER':
697
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
698
  // add to array in the stack the last element built,
699
  // unless no VALUE was found
700
+ if ($GLOBALS['_xh']['vt'])
701
+ {
702
  $vscount = count($GLOBALS['_xh']['valuestack']);
703
+ $GLOBALS['_xh']['valuestack'][$vscount-1]['values'][$GLOBALS['_xh']['valuestack'][$vscount-1]['name']] = $GLOBALS['_xh']['value'];
704
  } else
705
  error_log('XML-RPC: missing VALUE inside STRUCT in received xml');
706
  break;
707
  case 'DATA':
708
  //$GLOBALS['_xh']['ac']=''; // is this necessary?
709
+ $GLOBALS['_xh']['vt']=null; // reset this to check for 2 data elements in a row - even if they're empty
710
  break;
711
  case 'STRUCT':
712
  case 'ARRAY':
713
  // fetch out of stack array of values, and promote it to current value
714
  $curr_val = array_pop($GLOBALS['_xh']['valuestack']);
715
  $GLOBALS['_xh']['value'] = $curr_val['values'];
716
+ $GLOBALS['_xh']['vt']=strtolower($name);
717
+ if (isset($curr_val['php_class']))
718
+ {
719
  $GLOBALS['_xh']['php_class'] = $curr_val['php_class'];
720
  }
721
  break;
722
  case 'PARAM':
723
  // add to array of params the current value,
724
  // unless no VALUE was found
725
+ if ($GLOBALS['_xh']['vt'])
726
+ {
727
+ $GLOBALS['_xh']['params'][]=$GLOBALS['_xh']['value'];
728
+ $GLOBALS['_xh']['pt'][]=$GLOBALS['_xh']['vt'];
729
+ }
730
+ else
731
  error_log('XML-RPC: missing VALUE inside PARAM in received xml');
732
  break;
733
  case 'METHODNAME':
734
+ $GLOBALS['_xh']['method']=preg_replace('/^[\n\r\t ]+/', '', $GLOBALS['_xh']['ac']);
735
  break;
736
  case 'NIL':
737
  case 'EX:NIL':
738
+ if ($GLOBALS['xmlrpc_null_extension'])
739
+ {
740
+ $GLOBALS['_xh']['vt']='null';
741
+ $GLOBALS['_xh']['value']=null;
742
+ $GLOBALS['_xh']['lv']=3;
743
  break;
744
  }
745
  // drop through intentionally if nil extension not enabled
766
  function xmlrpc_cd($parser, $data)
767
  {
768
  // skip processing if xml fault already detected
769
+ if ($GLOBALS['_xh']['isf'] < 2)
770
+ {
771
  // "lookforvalue==3" means that we've found an entire value
772
  // and should discard any further character data
773
+ if($GLOBALS['_xh']['lv']!=3)
774
+ {
775
  // G. Giunta 2006-08-23: useless change of 'lv' from 1 to 2
776
  //if($GLOBALS['_xh']['lv']==1)
777
  //{
784
  //{
785
  // $GLOBALS['_xh']['ac'] = '';
786
  //}
787
+ $GLOBALS['_xh']['ac'].=$data;
788
  }
789
  }
790
  }
794
  function xmlrpc_dh($parser, $data)
795
  {
796
  // skip processing if xml fault already detected
797
+ if ($GLOBALS['_xh']['isf'] < 2)
798
+ {
799
+ if(substr($data, 0, 1) == '&' && substr($data, -1, 1) == ';')
800
+ {
801
  // G. Giunta 2006-08-25: useless change of 'lv' from 1 to 2
802
  //if($GLOBALS['_xh']['lv']==1)
803
  //{
804
  // $GLOBALS['_xh']['lv']=2;
805
  //}
806
+ $GLOBALS['_xh']['ac'].=$data;
807
  }
808
  }
809
  return true;
810
  }
811
 
812
+
813
  class xmlrpc_client
814
  {
815
  var $path;
816
  var $server;
817
+ var $port=0;
818
+ var $method='http';
819
  var $errno;
820
  var $errstr;
821
+ var $debug=0;
822
+ var $username='';
823
+ var $password='';
824
+ var $authtype=1;
825
+ var $cert='';
826
+ var $certpass='';
827
+ var $cacert='';
828
+ var $cacertdir='';
829
+ var $key='';
830
+ var $keypass='';
831
+ var $verifypeer=true;
832
+ var $verifyhost=2;
833
+ var $no_multicall=false;
834
+ var $proxy='';
835
+ var $proxyport=0;
836
+ var $proxy_user='';
837
+ var $proxy_pass='';
838
+ var $proxy_authtype=1;
839
+ var $cookies=array();
840
+ var $extracurlopts=array();
841
+ var $extraUrlParams = null;
842
+ var $curlError = null;
843
+ var $curlInfo = null;
844
+ var $curlErrorNo = null;
845
 
846
  /**
847
  * List of http compression methods accepted by the client for responses.
863
  * http://curl.haxx.se/docs/faq.html#7.3)
864
  */
865
  var $xmlrpc_curl_handle = null;
866
+ /// Whether to use persistent connections for http 1.1 and https
867
  var $keepalive = false;
868
  /// Charset encodings that can be decoded without problems by the client
869
  var $accepted_charset_encodings = array();
885
  * @param integer $port the port the server is listening on, defaults to 80 or 443 depending on protocol used
886
  * @param string $method the http protocol variant: defaults to 'http', 'https' and 'http11' can be used if CURL is installed
887
  */
888
+ function __construct($path, $server='', $port='', $method='')
889
  {
890
  // allow user to specify all params in $path
891
+ if($server == '' and $port == '' and $method == '')
892
+ {
893
  $parts = parse_url($path);
894
  $server = $parts['host'];
895
  $path = isset($parts['path']) ? $parts['path'] : '';
896
+ if(isset($parts['query']))
897
+ {
898
+ $path .= '?'.$parts['query'];
899
  }
900
+ if(isset($parts['fragment']))
901
+ {
902
+ $path .= '#'.$parts['fragment'];
903
  }
904
+ if(isset($parts['port']))
905
+ {
906
  $port = $parts['port'];
907
  }
908
+ if(isset($parts['scheme']))
909
+ {
910
  $method = $parts['scheme'];
911
  }
912
+ if(isset($parts['user']))
913
+ {
914
  $this->username = $parts['user'];
915
  }
916
+ if(isset($parts['pass']))
917
+ {
918
  $this->password = $parts['pass'];
919
  }
920
  }
921
+ if($path == '' || $path[0] != '/')
922
+ {
923
+ $this->path='/'.$path;
924
+ }
925
+ else
926
+ {
927
+ $this->path=$path;
928
  }
929
+ $this->server=$server;
930
+ if($port != '')
931
+ {
932
+ $this->port=$port;
933
  }
934
+ if($method != '')
935
+ {
936
+ $this->method=$method;
937
  }
938
 
939
  // if ZLIB is enabled, let the client by default accept compressed responses
940
+ if(function_exists('gzinflate') || (
941
  function_exists('curl_init') && (($info = curl_version()) &&
942
  ((is_string($info) && strpos($info, 'zlib') !== null) || isset($info['libz_version'])))
943
+ ))
944
+ {
945
  $this->accepted_compression = array('gzip', 'deflate');
946
  }
947
 
957
 
958
  /**
959
  * Enables/disables the echoing to screen of the xmlrpc responses received
960
+ * @param integer $in values 0, 1 and 2 are supported (2 = echo sent msg too, before received response)
961
  * @access public
962
  */
963
  function setDebug($in)
964
  {
965
+ $this->debug=$in;
966
  }
967
 
968
  /**
972
  * @param integer $t auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC (basic auth)
973
  * @access public
974
  */
975
+ function setCredentials($u, $p, $t=1)
976
  {
977
+ $this->username=$u;
978
+ $this->password=$p;
979
+ $this->authtype=$t;
980
  }
981
 
982
  /**
993
 
994
  /**
995
  * Add a CA certificate to verify server with (see man page about
996
+ * CURLOPT_CAINFO for more details)
997
  * @param string $cacert certificate file name (or dir holding certificates)
998
  * @param bool $is_dir set to true to indicate cacert is a dir. defaults to false
999
  * @access public
1000
  */
1001
+ function setCaCertificate($cacert, $is_dir=false)
1002
  {
1003
+ if ($is_dir)
1004
+ {
1005
  $this->cacertdir = $cacert;
1006
+ }
1007
+ else
1008
+ {
1009
  $this->cacert = $cacert;
1010
  }
1011
  }
1075
  if ($compmethod == 'any')
1076
  $this->accepted_compression = array('gzip', 'deflate');
1077
  else
1078
+ if ($compmethod == false )
1079
+ $this->accepted_compression = array();
1080
+ else
1081
+ $this->accepted_compression = array($compmethod);
1082
  }
1083
 
1084
  /**
1106
  *
1107
  * @todo check correctness of urlencoding cookie value (copied from php way of doing it...)
1108
  */
1109
+ function setCookie($name, $value='', $path='', $domain='', $port=null)
1110
  {
1111
  $this->cookies[$name]['value'] = urlencode($value);
1112
+ if ($path || $domain || $port)
1113
+ {
1114
  $this->cookies[$name]['path'] = $path;
1115
  $this->cookies[$name]['domain'] = $domain;
1116
  $this->cookies[$name]['port'] = $port;
1117
  $this->cookies[$name]['version'] = 1;
1118
+ }
1119
+ else
1120
+ {
1121
  $this->cookies[$name]['version'] = 0;
1122
  }
1123
  }
1125
  /**
1126
  * Directly set cURL options, for extra flexibility
1127
  * It allows eg. to bind client to a specific IP interface / address
1128
+ * @param array $options
1129
  */
1130
+ function SetCurlOptions( $options )
1131
  {
1132
  $this->extracurlopts = $options;
1133
  }
1136
  * Set user-agent string that will be used by this client instance
1137
  * in http headers sent to the server
1138
  */
1139
+ function SetUserAgent( $agentstring )
1140
  {
1141
  $this->user_agent = $agentstring;
1142
  }
1149
  * @return xmlrpcresp
1150
  * @access public
1151
  */
1152
+ function& send($msg, $timeout=0, $method='')
1153
  {
1154
  // if user deos not specify http protocol, use native method of this client
1155
  // (i.e. method set during call to constructor)
1156
+ if($method == '')
1157
+ {
1158
  $method = $this->method;
1159
  }
1160
 
1161
+ if(is_array($msg))
1162
+ {
1163
  // $msg is an array of xmlrpcmsg's
1164
  $r = $this->multicall($msg, $timeout, $method);
1165
  return $r;
1166
+ }
1167
+ elseif(is_string($msg))
1168
+ {
1169
  $n = new xmlrpcmsg('');
1170
  $n->payload = $msg;
1171
  $msg = $n;
1172
  }
1173
 
1174
  // where msg is an xmlrpcmsg
1175
+ $msg->debug=$this->debug;
1176
 
1177
+ if($method == 'https')
1178
+ {
1179
  $r =& $this->sendPayloadHTTPS(
1180
  $msg,
1181
  $this->server,
1197
  $this->key,
1198
  $this->keypass
1199
  );
1200
+ }
1201
+ elseif($method == 'http11')
1202
+ {
1203
  $r =& $this->sendPayloadCURL(
1204
  $msg,
1205
  $this->server,
1220
  'http',
1221
  $this->keepalive
1222
  );
1223
+ }
1224
+ else
1225
+ {
1226
  $r =& $this->sendPayloadHTTP10(
1227
  $msg,
1228
  $this->server,
1245
  /**
1246
  * @access private
1247
  */
1248
+ function &sendPayloadHTTP10($msg, $server, $port, $timeout=0,
1249
+ $username='', $password='', $authtype=1, $proxyhost='',
1250
+ $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1)
1251
  {
1252
+ if($port==0)
1253
+ {
1254
+ $port=80;
1255
  }
1256
 
1257
  // Only create the payload if it was not created previously
1258
+ if(empty($msg->payload))
1259
+ {
1260
  $msg->createPayload($this->request_charset_encoding);
1261
  }
1262
 
1263
  $payload = $msg->payload;
1264
  // Deflate request body and set appropriate request headers
1265
+ if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
1266
+ {
1267
+ if($this->request_compression == 'gzip')
1268
+ {
1269
  $a = @gzencode($payload);
1270
+ if($a)
1271
+ {
1272
  $payload = $a;
1273
  $encoding_hdr = "Content-Encoding: gzip\r\n";
1274
  }
1275
+ }
1276
+ else
1277
+ {
1278
  $a = @gzcompress($payload);
1279
+ if($a)
1280
+ {
1281
  $payload = $a;
1282
  $encoding_hdr = "Content-Encoding: deflate\r\n";
1283
  }
1284
  }
1285
+ }
1286
+ else
1287
+ {
1288
  $encoding_hdr = '';
1289
  }
1290
 
1291
  // thanks to Grant Rauscher <grant7@firstworld.net> for this
1292
+ $credentials='';
1293
+ if($username!='')
1294
+ {
1295
+ $credentials='Authorization: Basic ' . base64_encode($username . ':' . $password) . "\r\n";
1296
+ if ($authtype != 1)
1297
+ {
1298
+ error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported with HTTP 1.0');
1299
  }
1300
  }
1301
 
1302
  $accepted_encoding = '';
1303
+ if(is_array($this->accepted_compression) && count($this->accepted_compression))
1304
+ {
1305
  $accepted_encoding = 'Accept-Encoding: ' . implode(', ', $this->accepted_compression) . "\r\n";
1306
  }
1307
 
1308
  $proxy_credentials = '';
1309
+ if($proxyhost)
1310
+ {
1311
+ if($proxyport == 0)
1312
+ {
1313
  $proxyport = 8080;
1314
  }
1315
  $connectserver = $proxyhost;
1316
  $connectport = $proxyport;
1317
+ $uri = 'http://'.$server.':'.$port.$this->path;
1318
+ if($proxyusername != '')
1319
+ {
1320
+ if ($proxyauthtype != 1)
1321
+ {
1322
+ error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported with HTTP 1.0');
1323
  }
1324
+ $proxy_credentials = 'Proxy-Authorization: Basic ' . base64_encode($proxyusername.':'.$proxypassword) . "\r\n";
1325
  }
1326
+ }
1327
+ else
1328
+ {
1329
  $connectserver = $server;
1330
  $connectport = $port;
1331
  $uri = $this->path;
1333
 
1334
  // Cookie generation, as per rfc2965 (version 1 cookies) or
1335
  // netscape's rules (version 0 cookies)
1336
+ $cookieheader='';
1337
+ if (count($this->cookies))
1338
+ {
1339
  $version = '';
1340
+ foreach ($this->cookies as $name => $cookie)
1341
+ {
1342
+ if ($cookie['version'])
1343
+ {
1344
  $version = ' $Version="' . $cookie['version'] . '";';
1345
  $cookieheader .= ' ' . $name . '="' . $cookie['value'] . '";';
1346
  if ($cookie['path'])
1349
  $cookieheader .= ' $Domain="' . $cookie['domain'] . '";';
1350
  if ($cookie['port'])
1351
  $cookieheader .= ' $Port="' . $cookie['port'] . '";';
1352
+ }
1353
+ else
1354
+ {
1355
  $cookieheader .= ' ' . $name . '=' . $cookie['value'] . ";";
1356
  }
1357
  }
1358
  $cookieheader = 'Cookie:' . $version . substr($cookieheader, 0, -1) . "\r\n";
1359
  }
1360
 
1361
+ // omit port if 80
1362
+ $port = ($port == 80) ? '' : (':' . $port);
1363
+
1364
+ $op= 'POST ' . $uri. " HTTP/1.0\r\n" .
1365
  'User-Agent: ' . $this->user_agent . "\r\n" .
1366
+ 'Host: '. $server . $port . "\r\n" .
1367
  $credentials .
1368
  $proxy_credentials .
1369
  $accepted_encoding .
1374
  strlen($payload) . "\r\n\r\n" .
1375
  $payload;
1376
 
1377
+ if($this->debug > 1)
1378
+ {
1379
  print "<PRE>\n---SENDING---\n" . htmlentities($op) . "\n---END---\n</PRE>";
1380
  // let the client see this now in case http times out...
1381
  flush();
1382
  }
1383
 
1384
+ if($timeout>0)
1385
+ {
1386
+ $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr, $timeout);
1387
+ }
1388
+ else
1389
+ {
1390
+ $fp=@fsockopen($connectserver, $connectport, $this->errno, $this->errstr);
1391
  }
1392
+ if($fp)
1393
+ {
1394
+ if($timeout>0 && function_exists('stream_set_timeout'))
1395
+ {
1396
  stream_set_timeout($fp, $timeout);
1397
  }
1398
+ }
1399
+ else
1400
+ {
1401
+ $this->errstr='Connect error: '.$this->errstr;
1402
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr . ' (' . $this->errno . ')');
1403
  return $r;
1404
  }
1405
 
1406
+ if(!fputs($fp, $op, strlen($op)))
1407
+ {
1408
  fclose($fp);
1409
+ $this->errstr='Write error';
1410
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $this->errstr);
1411
  return $r;
1412
+ }
1413
+ else
1414
+ {
1415
+ // reset errno and errstr on successful socket connection
1416
  $this->errstr = '';
1417
  }
1418
  // G. Giunta 2005/10/24: close socket before parsing.
1419
+ // should yield slightly better execution times, and make easier recursive calls (e.g. to follow http redirects)
1420
+ $ipd='';
1421
+ do
1422
+ {
1423
  // shall we check for $data === FALSE?
1424
  // as per the manual, it signals an error
1425
+ $ipd.=fread($fp, 32768);
1426
+ } while(!feof($fp));
1427
  fclose($fp);
1428
  $r =& $msg->parseResponse($ipd, false, $this->return_type);
1429
  return $r;
1433
  /**
1434
  * @access private
1435
  */
1436
+ function &sendPayloadHTTPS($msg, $server, $port, $timeout=0, $username='',
1437
+ $password='', $authtype=1, $cert='',$certpass='', $cacert='', $cacertdir='',
1438
+ $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1,
1439
+ $keepalive=false, $key='', $keypass='')
1440
  {
1441
  $r =& $this->sendPayloadCURL($msg, $server, $port, $timeout, $username,
1442
  $password, $authtype, $cert, $certpass, $cacert, $cacertdir, $proxyhost, $proxyport,
1450
  * NB: CURL versions before 7.11.10 cannot use proxy to talk to https servers!
1451
  * @access private
1452
  */
1453
+ function &sendPayloadCURL($msg, $server, $port, $timeout=0, $username='',
1454
+ $password='', $authtype=1, $cert='', $certpass='', $cacert='', $cacertdir='',
1455
+ $proxyhost='', $proxyport=0, $proxyusername='', $proxypassword='', $proxyauthtype=1, $method='https',
1456
+ $keepalive=false, $key='', $keypass='')
1457
+ {
1458
+ if(!function_exists('curl_init'))
1459
+ {
1460
+ $this->errstr='CURL unavailable on this install';
1461
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_curl'], $GLOBALS['xmlrpcstr']['no_curl']);
1462
  return $r;
1463
  }
1464
+ if($method == 'https')
1465
+ {
1466
+ if(($info = curl_version()) &&
1467
+ ((is_string($info) && strpos($info, 'OpenSSL') === null) || (is_array($info) && !isset($info['ssl_version']))))
1468
+ {
1469
+ $this->errstr='SSL unavailable on this install';
1470
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_ssl'], $GLOBALS['xmlrpcstr']['no_ssl']);
1471
  return $r;
1472
  }
1473
  }
1474
 
1475
+ if($port == 0)
1476
+ {
1477
+ if($method == 'http')
1478
+ {
1479
  $port = 80;
1480
+ }
1481
+ else
1482
+ {
1483
  $port = 443;
1484
  }
1485
  }
1486
 
1487
  // Only create the payload if it was not created previously
1488
+ if(empty($msg->payload))
1489
+ {
1490
  $msg->createPayload($this->request_charset_encoding);
1491
  }
1492
 
1493
  // Deflate request body and set appropriate request headers
1494
  $payload = $msg->payload;
1495
+ if(function_exists('gzdeflate') && ($this->request_compression == 'gzip' || $this->request_compression == 'deflate'))
1496
+ {
1497
+ if($this->request_compression == 'gzip')
1498
+ {
1499
  $a = @gzencode($payload);
1500
+ if($a)
1501
+ {
1502
  $payload = $a;
1503
  $encoding_hdr = 'Content-Encoding: gzip';
1504
  }
1505
+ }
1506
+ else
1507
+ {
1508
  $a = @gzcompress($payload);
1509
+ if($a)
1510
+ {
1511
  $payload = $a;
1512
  $encoding_hdr = 'Content-Encoding: deflate';
1513
  }
1514
  }
1515
+ }
1516
+ else
1517
+ {
1518
  $encoding_hdr = '';
1519
  }
1520
 
1521
+ if($this->debug > 1)
1522
+ {
1523
  print "<PRE>\n---SENDING---\n" . htmlentities($payload) . "\n---END---\n</PRE>";
1524
  // let the client see this now in case http times out...
1525
  flush();
1526
  }
1527
 
1528
+ if(!$keepalive || !$this->xmlrpc_curl_handle)
1529
+ {
1530
+ $curl = curl_init($method . '://' . $server . ':' . $port . $this->path . ($this->extraUrlParams != null ? '?' . http_build_query($this->extraUrlParams) : ''));
1531
+ if($keepalive)
1532
+ {
1533
  $this->xmlrpc_curl_handle = $curl;
1534
  }
1535
+ }
1536
+ else
1537
+ {
1538
  $curl = $this->xmlrpc_curl_handle;
1539
  }
1540
 
1541
  // results into variable
1542
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
1543
 
1544
+ if($this->debug)
1545
+ {
1546
  curl_setopt($curl, CURLOPT_VERBOSE, 1);
1547
  }
1548
  curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
1554
  // return the header too
1555
  curl_setopt($curl, CURLOPT_HEADER, 1);
1556
 
 
1557
  // NB: if we set an empty string, CURL will add http header indicating
1558
  // ALL methods it is supporting. This is possibly a better option than
1559
  // letting the user tell what curl can / cannot do...
1560
+ if(is_array($this->accepted_compression) && count($this->accepted_compression))
1561
+ {
1562
  //curl_setopt($curl, CURLOPT_ENCODING, implode(',', $this->accepted_compression));
1563
  // empty string means 'any supported by CURL' (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1564
+ if (count($this->accepted_compression) == 1)
1565
+ {
1566
  curl_setopt($curl, CURLOPT_ENCODING, $this->accepted_compression[0]);
1567
+ }
1568
+ else
1569
  curl_setopt($curl, CURLOPT_ENCODING, '');
1570
  }
1571
  // extra headers
1572
+ $headers = array('Content-Type: ' . $msg->content_type , 'Accept-Charset: ' . implode(',', $this->accepted_charset_encodings));
1573
  // if no keepalive is wanted, let the server know it in advance
1574
+ if(!$keepalive)
1575
+ {
1576
  $headers[] = 'Connection: close';
1577
  }
1578
  // request compression header
1579
+ if($encoding_hdr)
1580
+ {
1581
  $headers[] = $encoding_hdr;
1582
  }
1583
 
1584
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
1585
  // timeout is borked
1586
+ if($timeout)
1587
+ {
1588
  curl_setopt($curl, CURLOPT_TIMEOUT, $timeout == 1 ? 1 : $timeout - 1);
1589
  }
1590
 
1591
+ if($username && $password)
1592
+ {
1593
+ curl_setopt($curl, CURLOPT_USERPWD, $username.':'.$password);
1594
+ if (defined('CURLOPT_HTTPAUTH'))
1595
+ {
1596
  curl_setopt($curl, CURLOPT_HTTPAUTH, $authtype);
1597
+ }
1598
+ else if ($authtype != 1)
1599
+ {
1600
+ error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth is supported by the current PHP/curl install');
1601
  }
1602
  }
1603
 
1604
+ if($method == 'https')
1605
+ {
1606
  // set cert file
1607
+ if($cert)
1608
+ {
1609
  curl_setopt($curl, CURLOPT_SSLCERT, $cert);
1610
  }
1611
  // set cert password
1612
+ if($certpass)
1613
+ {
1614
  curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $certpass);
1615
  }
1616
  // whether to verify remote host's cert
1617
  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verifypeer);
1618
  // set ca certificates file/dir
1619
+ if($cacert)
1620
+ {
1621
  curl_setopt($curl, CURLOPT_CAINFO, $cacert);
1622
  }
1623
+ if($cacertdir)
1624
+ {
1625
  curl_setopt($curl, CURLOPT_CAPATH, $cacertdir);
1626
  }
1627
  // set key file (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1628
+ if($key)
1629
+ {
1630
  curl_setopt($curl, CURLOPT_SSLKEY, $key);
1631
  }
1632
  // set key password (shall we catch errors in case CURLOPT_SSLKEY undefined ?)
1633
+ if($keypass)
1634
+ {
1635
  curl_setopt($curl, CURLOPT_SSLKEYPASSWD, $keypass);
1636
  }
1637
  // whether to verify cert's common name (CN); 0 for no, 1 to verify that it exists, and 2 to verify that it matches the hostname used
1639
  }
1640
 
1641
  // proxy info
1642
+ if($proxyhost)
1643
+ {
1644
+ if($proxyport == 0)
1645
+ {
1646
  $proxyport = 8080; // NB: even for HTTPS, local connection is on port 8080
1647
  }
1648
+ curl_setopt($curl, CURLOPT_PROXY, $proxyhost.':'.$proxyport);
1649
  //curl_setopt($curl, CURLOPT_PROXYPORT,$proxyport);
1650
+ if($proxyusername)
1651
+ {
1652
+ curl_setopt($curl, CURLOPT_PROXYUSERPWD, $proxyusername.':'.$proxypassword);
1653
+ if (defined('CURLOPT_PROXYAUTH'))
1654
+ {
1655
  curl_setopt($curl, CURLOPT_PROXYAUTH, $proxyauthtype);
1656
+ }
1657
+ else if ($proxyauthtype != 1)
1658
+ {
1659
+ error_log('XML-RPC: '.__METHOD__.': warning. Only Basic auth to proxy is supported by the current PHP/curl install');
1660
  }
1661
  }
1662
  }
1664
  // NB: should we build cookie http headers by hand rather than let CURL do it?
1665
  // the following code does not honour 'expires', 'path' and 'domain' cookie attributes
1666
  // set to client obj the the user...
1667
+ if (count($this->cookies))
1668
+ {
1669
  $cookieheader = '';
1670
+ foreach ($this->cookies as $name => $cookie)
1671
+ {
1672
  $cookieheader .= $name . '=' . $cookie['value'] . '; ';
1673
  }
1674
  curl_setopt($curl, CURLOPT_COOKIE, substr($cookieheader, 0, -2));
1675
  }
1676
 
1677
+ foreach ($this->extracurlopts as $opt => $val)
1678
+ {
1679
  curl_setopt($curl, $opt, $val);
1680
  }
1681
 
1682
  $result = curl_exec($curl);
1683
 
1684
+ if ($this->debug > 1)
1685
+ {
1686
  print "<PRE>\n---CURL INFO---\n";
1687
+ foreach(curl_getinfo($curl) as $name => $val)
1688
+ {
1689
+ if (is_array($val))
1690
+ {
1691
+ $val = implode("\n", $val);
1692
+ }
1693
  print $name . ': ' . htmlentities($val) . "\n";
1694
+ }
1695
+
1696
  print "---END---\n</PRE>";
1697
  }
1698
 
1699
+ $this->curlError = curl_error($curl);
1700
+ if ($this->curlError){
1701
+ $this->curlInfo = curl_getinfo($curl);
1702
+ $this->curlErrorNo = curl_errno($curl);
1703
+ }
1704
+
1705
+ if(!$result) /// @todo we should use a better check here - what if we get back '' or '0'?
1706
  {
1707
+ $this->errstr='no response';
1708
+ $resp=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['curl_fail'], $GLOBALS['xmlrpcstr']['curl_fail']. ': '. curl_error($curl));
1709
  curl_close($curl);
1710
+ if($keepalive)
1711
+ {
1712
  $this->xmlrpc_curl_handle = null;
1713
  }
1714
+ }
1715
+ else
1716
+ {
1717
+ if(!$keepalive)
1718
+ {
1719
  curl_close($curl);
1720
  }
1721
  $resp =& $msg->parseResponse($result, true, $this->return_type);
1722
+ // if we got back a 302, we can not reuse the curl handle for later calls
1723
+ if($resp->faultCode() == $GLOBALS['xmlrpcerr']['http_error'] && $keepalive)
1724
+ {
1725
+ curl_close($curl);
1726
+ $this->xmlrpc_curl_handle = null;
1727
+ }
1728
  }
1729
  return $resp;
1730
  }
1747
  * @param array $msgs an array of xmlrpcmsg objects
1748
  * @param integer $timeout connection timeout (in seconds)
1749
  * @param string $method the http protocol variant to be used
1750
+ * @param boolean fallback When true, upon receiving an error during multicall, multiple single calls will be attempted
1751
  * @return array
1752
  * @access public
1753
  */
1754
+ function multicall($msgs, $timeout=0, $method='', $fallback=true)
1755
  {
1756
+ if ($method == '')
1757
+ {
1758
  $method = $this->method;
1759
  }
1760
+ if(!$this->no_multicall)
1761
+ {
1762
  $results = $this->_try_multicall($msgs, $timeout, $method);
1763
+ if(is_array($results))
1764
+ {
1765
  // System.multicall succeeded
1766
  return $results;
1767
+ }
1768
+ else
1769
+ {
1770
  // either system.multicall is unsupported by server,
1771
  // or call failed for some other reason.
1772
+ if ($fallback)
1773
+ {
1774
  // Don't try it next time...
1775
  $this->no_multicall = true;
1776
+ }
1777
+ else
1778
+ {
1779
+ if (is_a($results, 'xmlrpcresp'))
1780
+ {
1781
  $result = $results;
1782
+ }
1783
+ else
1784
+ {
1785
  $result = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['multicall_error'], $GLOBALS['xmlrpcstr']['multicall_error']);
1786
  }
1787
  }
1788
  }
1789
+ }
1790
+ else
1791
+ {
1792
  // override fallback, in case careless user tries to do two
1793
  // opposite things at the same time
1794
  $fallback = true;
1795
  }
1796
 
1797
  $results = array();
1798
+ if ($fallback)
1799
+ {
1800
  // system.multicall is (probably) unsupported by server:
1801
  // emulate multicall via multiple requests
1802
+ foreach($msgs as $msg)
1803
+ {
1804
  $results[] =& $this->send($msg, $timeout, $method);
1805
  }
1806
+ }
1807
+ else
1808
+ {
1809
  // user does NOT want to fallback on many single calls:
1810
  // since we should always return an array of responses,
1811
  // return an array with the same error repeated n times
1812
+ foreach($msgs as $msg)
1813
+ {
1814
  $results[] = $result;
1815
  }
1816
  }
1827
  {
1828
  // Construct multicall message
1829
  $calls = array();
1830
+ foreach($msgs as $msg)
1831
+ {
1832
+ $call['methodName'] = new xmlrpcval($msg->method(),'string');
1833
  $numParams = $msg->getNumParams();
1834
  $params = array();
1835
+ for($i = 0; $i < $numParams; $i++)
1836
+ {
1837
  $params[$i] = $msg->getParam($i);
1838
  }
1839
  $call['params'] = new xmlrpcval($params, 'array');
1845
  // Attempt RPC call
1846
  $result =& $this->send($multicall, $timeout, $method);
1847
 
1848
+ if($result->faultCode() != 0)
1849
+ {
1850
  // call to system.multicall failed
1851
  return $result;
1852
  }
1854
  // Unpack responses.
1855
  $rets = $result->value();
1856
 
1857
+ if ($this->return_type == 'xml')
1858
+ {
1859
  return $rets;
1860
+ }
1861
+ else if ($this->return_type == 'phpvals')
1862
+ {
1863
  ///@todo test this code branch...
1864
  $rets = $result->value();
1865
+ if(!is_array($rets))
1866
+ {
1867
+ return false; // bad return type from system.multicall
1868
  }
1869
  $numRets = count($rets);
1870
+ if($numRets != count($msgs))
1871
+ {
1872
+ return false; // wrong number of return values.
1873
  }
1874
 
1875
  $response = array();
1876
+ for($i = 0; $i < $numRets; $i++)
1877
+ {
1878
  $val = $rets[$i];
1879
  if (!is_array($val)) {
1880
  return false;
1881
  }
1882
+ switch(count($val))
1883
+ {
1884
  case 1:
1885
+ if(!isset($val[0]))
1886
+ {
1887
+ return false; // Bad value
1888
  }
1889
  // Normal return value
1890
  $response[$i] = new xmlrpcresp($val[0], 0, '', 'phpvals');
1892
  case 2:
1893
  /// @todo remove usage of @: it is apparently quite slow
1894
  $code = @$val['faultCode'];
1895
+ if(!is_int($code))
1896
+ {
1897
  return false;
1898
  }
1899
  $str = @$val['faultString'];
1900
+ if(!is_string($str))
1901
+ {
1902
  return false;
1903
  }
1904
  $response[$i] = new xmlrpcresp(0, $code, $str);
1908
  }
1909
  }
1910
  return $response;
1911
+ }
1912
+ else // return type == 'xmlrpcvals'
1913
  {
1914
  $rets = $result->value();
1915
+ if($rets->kindOf() != 'array')
1916
+ {
1917
+ return false; // bad return type from system.multicall
1918
  }
1919
  $numRets = $rets->arraysize();
1920
+ if($numRets != count($msgs))
1921
+ {
1922
+ return false; // wrong number of return values.
1923
  }
1924
 
1925
  $response = array();
1926
+ for($i = 0; $i < $numRets; $i++)
1927
+ {
1928
  $val = $rets->arraymem($i);
1929
+ switch($val->kindOf())
1930
+ {
1931
  case 'array':
1932
+ if($val->arraysize() != 1)
1933
+ {
1934
+ return false; // Bad value
1935
  }
1936
  // Normal return value
1937
  $response[$i] = new xmlrpcresp($val->arraymem(0));
1938
  break;
1939
  case 'struct':
1940
  $code = $val->structmem('faultCode');
1941
+ if($code->kindOf() != 'scalar' || $code->scalartyp() != 'int')
1942
+ {
1943
  return false;
1944
  }
1945
  $str = $val->structmem('faultString');
1946
+ if($str->kindOf() != 'scalar' || $str->scalartyp() != 'string')
1947
+ {
1948
  return false;
1949
  }
1950
  $response[$i] = new xmlrpcresp(0, $code->scalarval(), $str->scalarval());
1980
  * NB: as of now we do not do it, since it might be either an xmlrpcval or a plain
1981
  * php val, or a complete xml chunk, depending on usage of xmlrpc_client::send() inside which creator is called...
1982
  */
1983
+ function __construct($val, $fcode = 0, $fstr = '', $valtyp='')
1984
  {
1985
+ if($fcode != 0)
1986
+ {
1987
  // error response
1988
  $this->errno = $fcode;
1989
  $this->errstr = $fstr;
1990
  //$this->errstr = htmlspecialchars($fstr); // XXX: encoding probably shouldn't be done here; fix later.
1991
+ }
1992
+ else
1993
+ {
1994
  // successful response
1995
  $this->val = $val;
1996
+ if ($valtyp == '')
1997
+ {
1998
  // user did not declare type of response value: try to guess it
1999
+ if (is_object($this->val) && is_a($this->val, 'xmlrpcval'))
2000
+ {
2001
  $this->valtyp = 'xmlrpcvals';
2002
+ }
2003
+ else if (is_string($this->val))
2004
+ {
2005
  $this->valtyp = 'xml';
2006
 
2007
+ }
2008
+ else
2009
+ {
2010
  $this->valtyp = 'phpvals';
2011
  }
2012
+ }
2013
+ else
2014
+ {
2015
  // user declares type of resp value: believe him
2016
  $this->valtyp = $valtyp;
2017
  }
2054
  * with attributes being e.g. 'expires', 'path', domain'.
2055
  * NB: cookies sent as 'expired' by the server (i.e. with an expiry date in the past)
2056
  * are still present in the array. It is up to the user-defined code to decide
2057
+ * how to use the received cookies, and whether they have to be sent back with the next
2058
  * request to the server (using xmlrpc_client::setCookie) or not
2059
  * @return array array of cookies received from the server
2060
  * @access public
2070
  * @return string the xml representation of the response
2071
  * @access public
2072
  */
2073
+ function serialize($charset_encoding='')
2074
  {
2075
  if ($charset_encoding != '')
2076
  $this->content_type = 'text/xml; charset=' . $charset_encoding;
2077
  else
2078
  $this->content_type = 'text/xml';
2079
+ if ($GLOBALS['xmlrpc_null_apache_encoding'])
2080
+ {
2081
+ $result = "<methodResponse xmlns:ex=\"".$GLOBALS['xmlrpc_null_apache_encoding_ns']."\">\n";
2082
+ }
2083
+ else
2084
+ {
2085
+ $result = "<methodResponse>\n";
2086
+ }
2087
+ if($this->errno)
2088
+ {
2089
  // G. Giunta 2005/2/13: let non-ASCII response messages be tolerated by clients
2090
  // by xml-encoding non ascii chars
2091
  $result .= "<fault>\n" .
2093
  "</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>" .
2094
  xmlrpc_encode_entitites($this->errstr, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding) . "</string></value>\n</member>\n" .
2095
  "</struct>\n</value>\n</fault>";
2096
+ }
2097
+ else
2098
+ {
2099
+ if(!is_object($this->val) || !is_a($this->val, 'xmlrpcval'))
2100
+ {
2101
+ if (is_string($this->val) && $this->valtyp == 'xml')
2102
+ {
2103
  $result .= "<params>\n<param>\n" .
2104
  $this->val .
2105
  "</param>\n</params>";
2106
+ }
2107
+ else
2108
+ {
2109
  /// @todo try to build something serializable?
2110
  die('cannot serialize xmlrpcresp objects whose content is native php values');
2111
  }
2112
+ }
2113
+ else
2114
+ {
2115
  $result .= "<params>\n<param>\n" .
2116
  $this->val->serialize($charset_encoding) .
2117
  "</param>\n</params>";
2127
  {
2128
  var $payload;
2129
  var $methodname;
2130
+ var $params=array();
2131
+ var $debug=0;
2132
  var $content_type = 'text/xml';
2133
 
2134
  /**
2135
  * @param string $meth the name of the method to invoke
2136
+ * @param array $pars array of parameters to be passed to the method (xmlrpcval objects)
2137
  */
2138
+ function __construct($meth, $pars=0)
2139
  {
2140
+ $this->methodname=$meth;
2141
+ if(is_array($pars) && count($pars)>0)
2142
+ {
2143
+ for($i=0; $i<count($pars); $i++)
2144
+ {
2145
  $this->addParam($pars[$i]);
2146
  }
2147
  }
2150
  /**
2151
  * @access private
2152
  */
2153
+ function xml_header($charset_encoding='')
2154
  {
2155
+ if ($charset_encoding != '')
2156
+ {
2157
  return "<?xml version=\"1.0\" encoding=\"$charset_encoding\" ?" . ">\n<methodCall>\n";
2158
+ }
2159
+ else
2160
+ {
2161
  return "<?xml version=\"1.0\"?" . ">\n<methodCall>\n";
2162
  }
2163
  }
2181
  /**
2182
  * @access private
2183
  */
2184
+ function createPayload($charset_encoding='')
2185
  {
2186
  if ($charset_encoding != '')
2187
  $this->content_type = 'text/xml; charset=' . $charset_encoding;
2188
  else
2189
  $this->content_type = 'text/xml';
2190
+ $this->payload=$this->xml_header($charset_encoding);
2191
+ $this->payload.='<methodName>' . $this->methodname . "</methodName>\n";
2192
+ $this->payload.="<params>\n";
2193
+ for($i=0; $i<count($this->params); $i++)
2194
+ {
2195
+ $p=$this->params[$i];
2196
+ $this->payload.="<param>\n" . $p->serialize($charset_encoding) .
2197
  "</param>\n";
2198
  }
2199
+ $this->payload.="</params>\n";
2200
+ $this->payload.=$this->xml_footer();
2201
  }
2202
 
2203
  /**
2206
  * @return string the method that will be invoked
2207
  * @access public
2208
  */
2209
+ function method($meth='')
2210
  {
2211
+ if($meth!='')
2212
+ {
2213
+ $this->methodname=$meth;
2214
  }
2215
  return $this->methodname;
2216
  }
2217
 
2218
  /**
2219
  * Returns xml representation of the message. XML prologue included
2220
+ * @param string $charset_encoding
2221
  * @return string the xml representation of the message, xml prologue included
2222
  * @access public
2223
  */
2224
+ function serialize($charset_encoding='')
2225
  {
2226
  $this->createPayload($charset_encoding);
2227
  return $this->payload;
2236
  function addParam($par)
2237
  {
2238
  // add check: do not add to self params which are not xmlrpcvals
2239
+ if(is_object($par) && is_a($par, 'xmlrpcval'))
2240
+ {
2241
+ $this->params[]=$par;
2242
  return true;
2243
+ }
2244
+ else
2245
+ {
2246
  return false;
2247
  }
2248
  }
2253
  * @return xmlrpcval the i-th parameter
2254
  * @access public
2255
  */
2256
+ function getParam($i) { return $this->params[$i]; }
 
 
 
2257
 
2258
  /**
2259
  * Returns the number of parameters in the messge.
2260
  * @return integer the number of parameters currently set
2261
  * @access public
2262
  */
2263
+ function getNumParams() { return count($this->params); }
 
 
 
2264
 
2265
  /**
2266
  * Given an open file handle, read all data available and parse it as axmlrpc response.
2271
  * infinite loop in that case, because we cannot trust the caller
2272
  * to give us a valid pointer to an open file...
2273
  * @access public
2274
+ * @param resource $fp stream pointer
2275
  * @return xmlrpcresp
2276
  * @todo add 2nd & 3rd param to be passed to ParseResponse() ???
2277
  */
2278
  function &parseResponseFile($fp)
2279
  {
2280
+ $ipd='';
2281
+ while($data=fread($fp, 32768))
2282
+ {
2283
+ $ipd.=$data;
2284
  }
2285
  //fclose($fp);
2286
  $r =& $this->parseResponse($ipd);
2291
  * Parses HTTP headers and separates them from data.
2292
  * @access private
2293
  */
2294
+ function &parseResponseHeaders(&$data, $headers_processed=false)
2295
  {
2296
  // Support "web-proxy-tunelling" connections for https through proxies
2297
+ if(preg_match('/^HTTP\/1\.[0-1] 200 Connection established/', $data))
2298
+ {
2299
  // Look for CR/LF or simple LF as line separator,
2300
  // (even though it is not valid http)
2301
+ $pos = strpos($data,"\r\n\r\n");
2302
+ if($pos || is_int($pos))
2303
+ {
2304
+ $bd = $pos+4;
2305
+ }
2306
+ else
2307
+ {
2308
+ $pos = strpos($data,"\n\n");
2309
+ if($pos || is_int($pos))
2310
+ {
2311
+ $bd = $pos+2;
2312
+ }
2313
+ else
2314
+ {
2315
  // No separation between response headers and body: fault?
2316
  $bd = 0;
2317
  }
2318
  }
2319
+ if ($bd)
2320
+ {
2321
  // this filters out all http headers from proxy.
2322
  // maybe we could take them into account, too?
2323
  $data = substr($data, $bd);
2324
+ }
2325
+ else
2326
+ {
2327
+ error_log('XML-RPC: '.__METHOD__.': HTTPS via proxy error, tunnel connection possibly failed');
2328
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (HTTPS via proxy error, tunnel connection possibly failed)');
2329
  return $r;
2330
  }
2331
  }
2332
 
2333
  // Strip HTTP 1.1 100 Continue header if present
2334
+ while(preg_match('/^HTTP\/1\.1 1[0-9]{2} /', $data))
2335
+ {
2336
  $pos = strpos($data, 'HTTP', 12);
2337
  // server sent a Continue header without any (valid) content following...
2338
  // give the client a chance to know it
2339
+ if(!$pos && !is_int($pos)) // works fine in php 3, 4 and 5
2340
  {
2341
  break;
2342
  }
2343
  $data = substr($data, $pos);
2344
  }
2345
+ if(!preg_match('/^HTTP\/[0-9.]+ 200 /', $data))
2346
+ {
2347
+ $errstr= substr($data, 0, strpos($data, "\n")-1);
2348
+ error_log('XML-RPC: '.__METHOD__.': HTTP error, got response: ' .$errstr);
2349
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['http_error'], $GLOBALS['xmlrpcstr']['http_error']. ' (' . $errstr . ')');
2350
  return $r;
2351
  }
2352
 
2355
 
2356
  // be tolerant to usage of \n instead of \r\n to separate headers and data
2357
  // (even though it is not valid http)
2358
+ $pos = strpos($data,"\r\n\r\n");
2359
+ if($pos || is_int($pos))
2360
+ {
2361
+ $bd = $pos+4;
2362
+ }
2363
+ else
2364
+ {
2365
+ $pos = strpos($data,"\n\n");
2366
+ if($pos || is_int($pos))
2367
+ {
2368
+ $bd = $pos+2;
2369
+ }
2370
+ else
2371
+ {
2372
  // No separation between response headers and body: fault?
2373
  // we could take some action here instead of going on...
2374
  $bd = 0;
2376
  }
2377
  // be tolerant to line endings, and extra empty lines
2378
  $ar = preg_split("/\r?\n/", trim(substr($data, 0, $pos)));
2379
+ while(list(,$line) = @each($ar))
2380
+ {
2381
  // take care of multi-line headers and cookies
2382
+ $arr = explode(':',$line,2);
2383
+ if(count($arr) > 1)
2384
+ {
2385
  $header_name = strtolower(trim($arr[0]));
2386
  /// @todo some other headers (the ones that allow a CSV list of values)
2387
  /// do allow many values to be passed using multiple header lines.
2388
  /// We should add content to $GLOBALS['_xh']['headers'][$header_name]
2389
  /// instead of replacing it for those...
2390
+ if ($header_name == 'set-cookie' || $header_name == 'set-cookie2')
2391
+ {
2392
+ if ($header_name == 'set-cookie2')
2393
+ {
2394
  // version 2 cookies:
2395
  // there could be many cookies on one line, comma separated
2396
  $cookies = explode(',', $arr[1]);
2397
+ }
2398
+ else
2399
+ {
2400
  $cookies = array($arr[1]);
2401
  }
2402
+ foreach ($cookies as $cookie)
2403
+ {
2404
  // glue together all received cookies, using a comma to separate them
2405
  // (same as php does with getallheaders())
2406
  if (isset($GLOBALS['_xh']['headers'][$header_name]))
2411
  // feature creep: only allow rfc-compliant cookie attributes?
2412
  // @todo support for server sending multiple time cookie with same name, but using different PATHs
2413
  $cookie = explode(';', $cookie);
2414
+ foreach ($cookie as $pos => $val)
2415
+ {
2416
  $val = explode('=', $val, 2);
2417
  $tag = trim($val[0]);
2418
  $val = trim(@$val[1]);
2419
  /// @todo with version 1 cookies, we should strip leading and trailing " chars
2420
+ if ($pos == 0)
2421
+ {
2422
  $cookiename = $tag;
2423
  $GLOBALS['_xh']['cookies'][$tag] = array();
2424
  $GLOBALS['_xh']['cookies'][$cookiename]['value'] = urldecode($val);
2425
+ }
2426
+ else
2427
+ {
2428
+ if ($tag != 'value')
2429
+ {
2430
  $GLOBALS['_xh']['cookies'][$cookiename][$tag] = $val;
2431
  }
2432
  }
2433
  }
2434
  }
2435
+ }
2436
+ else
2437
+ {
2438
  $GLOBALS['_xh']['headers'][$header_name] = trim($arr[1]);
2439
  }
2440
+ }
2441
+ elseif(isset($header_name))
2442
+ {
2443
  /// @todo version1 cookies might span multiple lines, thus breaking the parsing above
2444
  $GLOBALS['_xh']['headers'][$header_name] .= ' ' . trim($line);
2445
  }
2447
 
2448
  $data = substr($data, $bd);
2449
 
2450
+ if($this->debug && count($GLOBALS['_xh']['headers']))
2451
+ {
2452
  print '<PRE>';
2453
+ foreach($GLOBALS['_xh']['headers'] as $header => $value)
2454
+ {
2455
  print htmlentities("HEADER: $header: $value\n");
2456
  }
2457
+ foreach($GLOBALS['_xh']['cookies'] as $header => $value)
2458
+ {
2459
  print htmlentities("COOKIE: $header={$value['value']}\n");
2460
  }
2461
  print "</PRE>\n";
2463
 
2464
  // if CURL was used for the call, http headers have been processed,
2465
  // and dechunking + reinflating have been carried out
2466
+ if(!$headers_processed)
2467
+ {
2468
  // Decode chunked encoding sent by http 1.1 servers
2469
+ if(isset($GLOBALS['_xh']['headers']['transfer-encoding']) && $GLOBALS['_xh']['headers']['transfer-encoding'] == 'chunked')
2470
+ {
2471
+ if(!$data = decode_chunked($data))
2472
+ {
2473
+ error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to rebuild the chunked data received from server');
2474
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['dechunk_fail'], $GLOBALS['xmlrpcstr']['dechunk_fail']);
2475
  return $r;
2476
  }
2478
 
2479
  // Decode gzip-compressed stuff
2480
  // code shamelessly inspired from nusoap library by Dietrich Ayala
2481
+ if(isset($GLOBALS['_xh']['headers']['content-encoding']))
2482
+ {
2483
  $GLOBALS['_xh']['headers']['content-encoding'] = str_replace('x-', '', $GLOBALS['_xh']['headers']['content-encoding']);
2484
+ if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' || $GLOBALS['_xh']['headers']['content-encoding'] == 'gzip')
2485
+ {
2486
  // if decoding works, use it. else assume data wasn't gzencoded
2487
+ if(function_exists('gzinflate'))
2488
+ {
2489
+ if($GLOBALS['_xh']['headers']['content-encoding'] == 'deflate' && $degzdata = @gzuncompress($data))
2490
+ {
2491
  $data = $degzdata;
2492
+ if($this->debug)
2493
+ print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2494
+ }
2495
+ elseif($GLOBALS['_xh']['headers']['content-encoding'] == 'gzip' && $degzdata = @gzinflate(substr($data, 10)))
2496
+ {
2497
  $data = $degzdata;
2498
+ if($this->debug)
2499
+ print "<PRE>---INFLATED RESPONSE---[".strlen($data)." chars]---\n" . htmlentities($data) . "\n---END---</PRE>";
2500
+ }
2501
+ else
2502
+ {
2503
+ error_log('XML-RPC: '.__METHOD__.': errors occurred when trying to decode the deflated data received from server');
2504
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['decompress_fail'], $GLOBALS['xmlrpcstr']['decompress_fail']);
2505
  return $r;
2506
  }
2507
+ }
2508
+ else
2509
+ {
2510
+ error_log('XML-RPC: '.__METHOD__.': the server sent deflated data. Your php install must have the Zlib extension compiled in to support this.');
2511
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['cannot_decompress'], $GLOBALS['xmlrpcstr']['cannot_decompress']);
2512
  return $r;
2513
  }
2529
  * @return xmlrpcresp
2530
  * @access public
2531
  */
2532
+ function &parseResponse($data='', $headers_processed=false, $return_type='xmlrpcvals')
2533
  {
2534
+ if($this->debug)
2535
+ {
2536
  //by maHo, replaced htmlspecialchars with htmlentities
2537
  print "<PRE>---GOT---\n" . htmlentities($data) . "\n---END---\n</PRE>";
2538
  }
2539
 
2540
+ if($data == '')
2541
+ {
2542
+ error_log('XML-RPC: '.__METHOD__.': no response received from server.');
2543
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['no_data'], $GLOBALS['xmlrpcstr']['no_data']);
2544
  return $r;
2545
  }
2546
 
2547
+ $GLOBALS['_xh']=array();
2548
 
2549
  $raw_data = $data;
2550
  // parse the HTTP headers of the response, if present, and separate them from data
2551
+ if(substr($data, 0, 4) == 'HTTP')
2552
+ {
2553
  $r =& $this->parseResponseHeaders($data, $headers_processed);
2554
+ if ($r)
2555
+ {
2556
  // failed processing of HTTP response headers
2557
  // save into response obj the full payload received, for debugging
2558
  $r->raw_data = $data;
2559
  return $r;
2560
  }
2561
+ }
2562
+ else
2563
+ {
2564
  $GLOBALS['_xh']['headers'] = array();
2565
  $GLOBALS['_xh']['cookies'] = array();
2566
  }
2567
 
2568
+ if($this->debug)
2569
+ {
2570
  $start = strpos($data, '<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
2571
+ if ($start)
2572
+ {
2573
  $start += strlen('<!-- SERVER DEBUG INFO (BASE64 ENCODED):');
2574
  $end = strpos($data, '-->', $start);
2575
+ $comments = substr($data, $start, $end-$start);
2576
+ print "<PRE>---SERVER DEBUG INFO (DECODED) ---\n\t".htmlentities(str_replace("\n", "\n\t", base64_decode($comments)))."\n---END---\n</PRE>";
2577
  }
2578
  }
2579
 
2585
  // be tolerant of junk after methodResponse (e.g. javascript ads automatically inserted by free hosts)
2586
  // idea from Luca Mariano <luca.mariano@email.it> originally in PEARified version of the lib
2587
  $pos = strrpos($data, '</methodResponse>');
2588
+ if($pos !== false)
2589
+ {
2590
+ $data = substr($data, 0, $pos+17);
2591
  }
2592
 
2593
  // if user wants back raw xml, give it to him
2594
+ if ($return_type == 'xml')
2595
+ {
2596
  $r = new xmlrpcresp($data, 0, '', 'xml');
2597
  $r->hdrs = $GLOBALS['_xh']['headers'];
2598
  $r->_cookies = $GLOBALS['_xh']['cookies'];
2603
  // try to 'guestimate' the character encoding of the received response
2604
  $resp_encoding = guess_encoding(@$GLOBALS['_xh']['headers']['content-type'], $data);
2605
 
2606
+ $GLOBALS['_xh']['ac']='';
2607
  //$GLOBALS['_xh']['qt']=''; //unused...
2608
  $GLOBALS['_xh']['stack'] = array();
2609
  $GLOBALS['_xh']['valuestack'] = array();
2610
+ $GLOBALS['_xh']['isf']=0; // 0 = OK, 1 for xmlrpc fault responses, 2 = invalid xmlrpc
2611
+ $GLOBALS['_xh']['isf_reason']='';
2612
+ $GLOBALS['_xh']['rt']=''; // 'methodcall or 'methodresponse'
2613
 
2614
  // if response charset encoding is not known / supported, try to use
2615
  // the default encoding and parse the xml anyway, but log a warning...
2616
+ if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2617
+ // the following code might be better for mb_string enabled installs, but
2618
  // makes the lib about 200% slower...
2619
  //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2620
  {
2621
+ error_log('XML-RPC: '.__METHOD__.': invalid charset encoding of received response: '.$resp_encoding);
2622
  $resp_encoding = $GLOBALS['xmlrpc_defencoding'];
2623
  }
2624
  $parser = xml_parser_create($resp_encoding);
2629
  // we use the broadest one, ie. utf8
2630
  // This allows to send data which is native in various charset,
2631
  // by extending xmlrpc_encode_entitites() and setting xmlrpc_internalencoding
2632
+ if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
2633
+ {
2634
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
2635
+ }
2636
+ else
2637
+ {
2638
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
2639
  }
2640
 
2641
+ if ($return_type == 'phpvals')
2642
+ {
2643
  xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee_fast');
2644
+ }
2645
+ else
2646
+ {
2647
  xml_set_element_handler($parser, 'xmlrpc_se', 'xmlrpc_ee');
2648
  }
2649
 
2650
  xml_set_character_data_handler($parser, 'xmlrpc_cd');
2651
  xml_set_default_handler($parser, 'xmlrpc_dh');
2652
 
2653
+ // **BEGIN JORDAN NOVAK EDIT**
2654
+ // Sometimes customer data has these random characters in it, and it breaks the XML parsing
2655
+ // $test = preg_match('/\&#[0-9]{1,3}/', $data, $matches);
2656
+ $data = preg_replace(array('/\&#[0-9]{1,4}(?![0-9]{0,3};)/'),'', $data);
2657
+ $data = str_replace(array("&#11;", "&#0;", "&#20;", "&#12", "&#7;", "&#6;", "&#3;"), "", $data);
2658
+ // **END JORDAN NOVAK EDIT**
2659
+
2660
+
2661
  // first error check: xml not well formed
2662
+ if(!xml_parse($parser, $data, count($data)))
2663
+ {
2664
+ try{
2665
+ $bad_return = fopen("bad_return.xml.php", "w");
2666
+ fwrite($bad_return, $data);
2667
+ fclose($bad_return);
2668
+ } catch(Exception $e){}
2669
  // thanks to Peter Kocks <peter.kocks@baygate.com>
2670
+ // if((xml_get_current_line_number($parser)) == 1)
2671
+ // {
2672
+ // $errstr = 'XML error at line 1, check URL';
2673
+ // }
2674
+ // else
2675
+ // {
2676
+ $errstr = sprintf('XML error: %s at line %d, column %d, byte %d, text in context: %s',
2677
+ xml_error_string(xml_get_error_code($parser)),
2678
+ xml_get_current_line_number($parser), xml_get_current_column_number($parser), xml_get_current_byte_index($parser),
2679
+ substr($data, (xml_get_current_byte_index($parser) - 100), 200)
2680
+ );
2681
+ // }
2682
  error_log($errstr);
2683
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcstr']['invalid_return'].' ('.$errstr.')');
2684
  xml_parser_free($parser);
2685
+ if($this->debug)
2686
+ {
2687
  print $errstr;
2688
  }
2689
  $r->hdrs = $GLOBALS['_xh']['headers'];
2693
  }
2694
  xml_parser_free($parser);
2695
  // second error check: xml well formed but not xml-rpc compliant
2696
+ if ($GLOBALS['_xh']['isf'] > 1)
2697
+ {
2698
+ if ($this->debug)
2699
+ {
2700
  /// @todo echo something for user?
2701
  }
2702
 
2703
  $r = new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
2704
  $GLOBALS['xmlrpcstr']['invalid_return'] . ' ' . $GLOBALS['_xh']['isf_reason']);
2705
+ }
2706
+ // third error check: parsing of the response has somehow gone boink.
2707
  // NB: shall we omit this check, since we trust the parsing code?
2708
+ elseif ($return_type == 'xmlrpcvals' && !is_object($GLOBALS['_xh']['value']))
2709
+ {
2710
  // something odd has happened
2711
  // and it's time to generate a client side error
2712
  // indicating something odd went on
2713
+ $r=new xmlrpcresp(0, $GLOBALS['xmlrpcerr']['invalid_return'],
2714
  $GLOBALS['xmlrpcstr']['invalid_return']);
2715
+ }
2716
+ else
2717
+ {
2718
+ if ($this->debug)
2719
+ {
2720
  print "<PRE>---PARSED---\n";
2721
  // somehow htmlentities chokes on var_export, and some full html string...
2722
  //print htmlentitites(var_export($GLOBALS['_xh']['value'], true));
2727
  // note that using =& will raise an error if $GLOBALS['_xh']['st'] does not generate an object.
2728
  $v =& $GLOBALS['_xh']['value'];
2729
 
2730
+ if($GLOBALS['_xh']['isf'])
2731
+ {
2732
  /// @todo we should test here if server sent an int and a string,
2733
  /// and/or coerce them into such...
2734
+ if ($return_type == 'xmlrpcvals')
2735
+ {
2736
  $errno_v = $v->structmem('faultCode');
2737
  $errstr_v = $v->structmem('faultString');
2738
  $errno = $errno_v->scalarval();
2739
  $errstr = $errstr_v->scalarval();
2740
+ }
2741
+ else
2742
+ {
2743
  $errno = $v['faultCode'];
2744
  $errstr = $v['faultString'];
2745
  }
2746
 
2747
+ if($errno == 0)
2748
+ {
2749
  // FAULT returned, errno needs to reflect that
2750
  $errno = -1;
2751
  }
2752
 
2753
  $r = new xmlrpcresp(0, $errno, $errstr);
2754
+ }
2755
+ else
2756
+ {
2757
+ $r=new xmlrpcresp($v, 0, '', $return_type);
2758
  }
2759
  }
2760
 
2767
 
2768
  class xmlrpcval
2769
  {
2770
+ var $me=array();
2771
+ var $mytype=0;
2772
+ var $_php_class=null;
2773
 
2774
  /**
2775
  * @param mixed $val
2776
  * @param string $type any valid xmlrpc type name (lowercase). If null, 'string' is assumed
2777
  */
2778
+ function __construct($val=-1, $type='')
2779
  {
2780
  /// @todo: optimization creep - do not call addXX, do it all inline.
2781
  /// downside: booleans will not be coerced anymore
2782
+ if($val!==-1 || $type!='')
2783
+ {
2784
  // optimization creep: inlined all work done by constructor
2785
+ switch($type)
2786
+ {
2787
  case '':
2788
+ $this->mytype=1;
2789
+ $this->me['string']=$val;
2790
  break;
2791
  case 'i4':
2792
  case 'int':
2796
  case 'dateTime.iso8601':
2797
  case 'base64':
2798
  case 'null':
2799
+ $this->mytype=1;
2800
+ $this->me[$type]=$val;
2801
  break;
2802
  case 'array':
2803
+ $this->mytype=2;
2804
+ $this->me['array']=$val;
2805
  break;
2806
  case 'struct':
2807
+ $this->mytype=3;
2808
+ $this->me['struct']=$val;
2809
  break;
2810
  default:
2811
+ error_log("XML-RPC: ".__METHOD__.": not a known type ($type)");
2812
  }
2813
  /*if($type=='')
2814
+ {
2815
+ $type='string';
2816
+ }
2817
+ if($GLOBALS['xmlrpcTypes'][$type]==1)
2818
+ {
2819
+ $this->addScalar($val,$type);
2820
+ }
2821
+ elseif($GLOBALS['xmlrpcTypes'][$type]==2)
2822
+ {
2823
+ $this->addArray($val);
2824
+ }
2825
+ elseif($GLOBALS['xmlrpcTypes'][$type]==3)
2826
+ {
2827
+ $this->addStruct($val);
2828
+ }*/
2829
  }
2830
  }
2831
 
2835
  * @param string $type
2836
  * @return int 1 or 0 on failure
2837
  */
2838
+ function addScalar($val, $type='string')
2839
  {
2840
+ $typeof=@$GLOBALS['xmlrpcTypes'][$type];
2841
+ if($typeof!=1)
2842
+ {
2843
+ error_log("XML-RPC: ".__METHOD__.": not a scalar type ($type)");
2844
  return 0;
2845
  }
2846
 
2847
  // coerce booleans into correct values
2848
  // NB: we should either do it for datetimes, integers and doubles, too,
2849
  // or just plain remove this check, implemented on booleans only...
2850
+ if($type==$GLOBALS['xmlrpcBoolean'])
2851
+ {
2852
+ if(strcasecmp($val,'true')==0 || $val==1 || ($val==true && strcasecmp($val,'false')))
2853
+ {
2854
+ $val=true;
2855
+ }
2856
+ else
2857
+ {
2858
+ $val=false;
2859
  }
2860
  }
2861
 
2862
+ switch($this->mytype)
2863
+ {
2864
  case 1:
2865
+ error_log('XML-RPC: '.__METHOD__.': scalar xmlrpcval can have only one value');
2866
  return 0;
2867
  case 3:
2868
+ error_log('XML-RPC: '.__METHOD__.': cannot add anonymous scalar to struct xmlrpcval');
2869
  return 0;
2870
  case 2:
2871
  // we're adding a scalar value to an array here
2873
  //$ar[]=new xmlrpcval($val, $type);
2874
  //$this->me['array']=$ar;
2875
  // Faster (?) avoid all the costly array-copy-by-val done here...
2876
+ $this->me['array'][]=new xmlrpcval($val, $type);
2877
  return 1;
2878
  default:
2879
  // a scalar, so set the value and remember we're scalar
2880
+ $this->me[$type]=$val;
2881
+ $this->mytype=$typeof;
2882
  return 1;
2883
  }
2884
  }
2893
  */
2894
  function addArray($vals)
2895
  {
2896
+ if($this->mytype==0)
2897
+ {
2898
+ $this->mytype=$GLOBALS['xmlrpcTypes']['array'];
2899
+ $this->me['array']=$vals;
2900
  return 1;
2901
+ }
2902
+ elseif($this->mytype==2)
2903
+ {
2904
  // we're adding to an array here
2905
  $this->me['array'] = array_merge($this->me['array'], $vals);
2906
  return 1;
2907
+ }
2908
+ else
2909
+ {
2910
+ error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
2911
  return 0;
2912
  }
2913
  }
2922
  */
2923
  function addStruct($vals)
2924
  {
2925
+ if($this->mytype==0)
2926
+ {
2927
+ $this->mytype=$GLOBALS['xmlrpcTypes']['struct'];
2928
+ $this->me['struct']=$vals;
2929
  return 1;
2930
+ }
2931
+ elseif($this->mytype==3)
2932
+ {
2933
  // we're adding to a struct here
2934
  $this->me['struct'] = array_merge($this->me['struct'], $vals);
2935
  return 1;
2936
+ }
2937
+ else
2938
+ {
2939
+ error_log('XML-RPC: '.__METHOD__.': already initialized as a [' . $this->kindOf() . ']');
2940
  return 0;
2941
  }
2942
  }
2945
  // DEPRECATED!
2946
  function dump($ar)
2947
  {
2948
+ foreach($ar as $key => $val)
2949
+ {
2950
  echo "$key => $val<br />";
2951
+ if($key == 'array')
2952
+ {
2953
+ while(list($key2, $val2) = each($val))
2954
+ {
2955
  echo "-- $key2 => $val2<br />";
2956
  }
2957
  }
2965
  */
2966
  function kindOf()
2967
  {
2968
+ switch($this->mytype)
2969
+ {
2970
  case 3:
2971
  return 'struct';
2972
  break;
2984
  /**
2985
  * @access private
2986
  */
2987
+ function serializedata($typ, $val, $charset_encoding='')
2988
  {
2989
+ $rs='';
2990
+ switch(@$GLOBALS['xmlrpcTypes'][$typ])
2991
+ {
2992
  case 1:
2993
+ switch($typ)
2994
+ {
2995
  case $GLOBALS['xmlrpcBase64']:
2996
+ $rs.="<${typ}>" . base64_encode($val) . "</${typ}>";
2997
  break;
2998
  case $GLOBALS['xmlrpcBoolean']:
2999
+ $rs.="<${typ}>" . ($val ? '1' : '0') . "</${typ}>";
3000
  break;
3001
  case $GLOBALS['xmlrpcString']:
3002
  // G. Giunta 2005/2/13: do NOT use htmlentities, since
3003
  // it will produce named html entities, which are invalid xml
3004
+ $rs.="<${typ}>" . xmlrpc_encode_entitites($val, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding). "</${typ}>";
3005
  break;
3006
  case $GLOBALS['xmlrpcInt']:
3007
  case $GLOBALS['xmlrpcI4']:
3008
+ $rs.="<${typ}>".(int)$val."</${typ}>";
3009
  break;
3010
  case $GLOBALS['xmlrpcDouble']:
3011
  // avoid using standard conversion of float to string because it is locale-dependent,
3013
  // sprintf('%F') could be most likely ok but it fails eg. on 2e-14.
3014
  // The code below tries its best at keeping max precision while avoiding exp notation,
3015
  // but there is of course no limit in the number of decimal places to be used...
3016
+ $rs.="<${typ}>".preg_replace('/\\.?0+$/','',number_format((double)$val, 128, '.', ''))."</${typ}>";
3017
  break;
3018
  case $GLOBALS['xmlrpcDateTime']:
3019
+ if (is_string($val))
3020
+ {
3021
+ $rs.="<${typ}>${val}</${typ}>";
3022
+ }
3023
+ else if(is_a($val, 'DateTime'))
3024
+ {
3025
+ $rs.="<${typ}>".$val->format('Ymd\TH:i:s')."</${typ}>";
3026
+ }
3027
+ else if(is_int($val))
3028
+ {
3029
+ $rs.="<${typ}>".strftime("%Y%m%dT%H:%M:%S", $val)."</${typ}>";
3030
+ }
3031
+ else
3032
+ {
3033
  // not really a good idea here: but what shall we output anyway? left for backward compat...
3034
+ $rs.="<${typ}>${val}</${typ}>";
3035
  }
3036
  break;
3037
  case $GLOBALS['xmlrpcNull']:
3038
+ if ($GLOBALS['xmlrpc_null_apache_encoding'])
3039
+ {
3040
+ $rs.="<ex:nil/>";
3041
+ }
3042
+ else
3043
+ {
3044
+ $rs.="<nil/>";
3045
  }
3046
  break;
3047
  default:
3048
  // no standard type value should arrive here, but provide a possibility
3049
  // for xmlrpcvals of unknown type...
3050
+ $rs.="<${typ}>${val}</${typ}>";
3051
  }
3052
  break;
3053
  case 3:
3054
  // struct
3055
+ if ($this->_php_class)
3056
+ {
3057
+ $rs.='<struct php_class="' . $this->_php_class . "\">\n";
3058
+ }
3059
+ else
3060
+ {
3061
+ $rs.="<struct>\n";
3062
  }
3063
+ foreach($val as $key2 => $val2)
3064
+ {
3065
+ $rs.='<member><name>'.xmlrpc_encode_entitites($key2, $GLOBALS['xmlrpc_internalencoding'], $charset_encoding)."</name>\n";
3066
  //$rs.=$this->serializeval($val2);
3067
+ $rs.=$val2->serialize($charset_encoding);
3068
+ $rs.="</member>\n";
3069
  }
3070
+ $rs.='</struct>';
3071
  break;
3072
  case 2:
3073
  // array
3074
+ $rs.="<array>\n<data>\n";
3075
+ for($i=0; $i<count($val); $i++)
3076
+ {
3077
  //$rs.=$this->serializeval($val[$i]);
3078
+ $rs.=$val[$i]->serialize($charset_encoding);
3079
  }
3080
+ $rs.="</data>\n</array>";
3081
  break;
3082
  default:
3083
  break;
3091
  * @return string
3092
  * @access public
3093
  */
3094
+ function serialize($charset_encoding='')
3095
  {
3096
  // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
3097
  //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
3108
  // add check? slower, but helps to avoid recursion in serializing broken xmlrpcvals...
3109
  //if (is_object($o) && (get_class($o) == 'xmlrpcval' || is_subclass_of($o, 'xmlrpcval')))
3110
  //{
3111
+ $ar=$o->me;
3112
  reset($ar);
3113
  list($typ, $val) = each($ar);
3114
  return '<value>' . $this->serializedata($typ, $val) . "</value>\n";
3116
  }
3117
 
3118
  /**
3119
+ * Checks whether a struct member with a given name is present.
3120
  * Works only on xmlrpcvals of type struct.
3121
  * @param string $m the name of the struct member to be looked up
3122
  * @return boolean
3164
  {
3165
  // UNSTABLE
3166
  reset($this->me);
3167
+ list($a,$b)=each($this->me);
3168
  // contributed by I Sofer, 2001-03-24
3169
  // add support for nested arrays to scalarval
3170
  // i've created a new method here, so as to
3171
  // preserve back compatibility
3172
 
3173
+ if(is_array($b))
3174
+ {
3175
  @reset($b);
3176
+ while(list($id,$cont) = @each($b))
3177
+ {
3178
  $b[$id] = $cont->scalarval();
3179
  }
3180
  }
3181
 
3182
  // add support for structures directly encoding php objects
3183
+ if(is_object($b))
3184
+ {
3185
  $t = get_object_vars($b);
3186
  @reset($t);
3187
+ while(list($id,$cont) = @each($t))
3188
+ {
3189
  $t[$id] = $cont->scalarval();
3190
  }
3191
  @reset($t);
3192
+ while(list($id,$cont) = @each($t))
3193
+ {
3194
  @$b->$id = $cont;
3195
  }
3196
  }
3206
  function scalarval()
3207
  {
3208
  reset($this->me);
3209
+ list(,$b)=each($this->me);
3210
  return $b;
3211
  }
3212
 
3219
  function scalartyp()
3220
  {
3221
  reset($this->me);
3222
+ list($a,)=each($this->me);
3223
+ if($a==$GLOBALS['xmlrpcI4'])
3224
+ {
3225
+ $a=$GLOBALS['xmlrpcInt'];
3226
  }
3227
  return $a;
3228
  }
3279
  * @param int $utc (0 or 1)
3280
  * @return string
3281
  */
3282
+ function iso8601_encode($timet, $utc=0)
3283
  {
3284
+ if(!$utc)
3285
+ {
3286
+ $t=strftime("%Y%m%dT%H:%M:%S", $timet);
3287
+ }
3288
+ else
3289
+ {
3290
+ if(function_exists('gmstrftime'))
3291
+ {
3292
  // gmstrftime doesn't exist in some versions
3293
  // of PHP
3294
+ $t=gmstrftime("%Y%m%dT%H:%M:%S", $timet);
3295
+ }
3296
+ else
3297
+ {
3298
+ $t=strftime("%Y%m%dT%H:%M:%S", $timet-date('Z'));
3299
  }
3300
  }
3301
  return $t;
3307
  * @param int $utc either 0 or 1
3308
  * @return int (datetime)
3309
  */
3310
+ function iso8601_decode($idate, $utc=0)
3311
  {
3312
+ $t=0;
3313
+ if(preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})/', $idate, $regs))
3314
+ {
3315
+ if($utc)
3316
+ {
3317
+ $t=gmmktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
3318
+ }
3319
+ else
3320
+ {
3321
+ $t=mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
3322
  }
3323
  }
3324
  return $t;
3345
  * @param array $options if 'decode_php_objs' is set in the options array, xmlrpc structs can be decoded into php objects; if 'dates_as_objects' is set xmlrpc datetimes are decoded as php DateTime objects (standard is
3346
  * @return mixed
3347
  */
3348
+ function php_xmlrpc_decode($xmlrpc_val, $options=array())
3349
  {
3350
+ switch($xmlrpc_val->kindOf())
3351
+ {
3352
  case 'scalar':
3353
+ if (in_array('extension_api', $options))
3354
+ {
3355
  reset($xmlrpc_val->me);
3356
+ list($typ,$val) = each($xmlrpc_val->me);
3357
+ switch ($typ)
3358
+ {
3359
  case 'dateTime.iso8601':
3360
  $xmlrpc_val->scalar = $val;
3361
  $xmlrpc_val->xmlrpc_type = 'datetime';
3369
  return $xmlrpc_val->scalarval();
3370
  }
3371
  }
3372
+ if (in_array('dates_as_objects', $options) && $xmlrpc_val->scalartyp() == 'dateTime.iso8601')
3373
+ {
3374
  // we return a Datetime object instead of a string
3375
  // since now the constructor of xmlrpcval accepts safely strings, ints and datetimes,
3376
  // we cater to all 3 cases here
3377
  $out = $xmlrpc_val->scalarval();
3378
+ if (is_string($out))
3379
+ {
3380
  $out = strtotime($out);
3381
  }
3382
+ if (is_int($out))
3383
+ {
3384
  $result = new Datetime();
3385
  $result->setTimestamp($out);
3386
  return $result;
3387
+ }
3388
+ elseif (is_a($out, 'Datetime'))
3389
+ {
3390
  return $out;
3391
  }
3392
  }
3394
  case 'array':
3395
  $size = $xmlrpc_val->arraysize();
3396
  $arr = array();
3397
+ for($i = 0; $i < $size; $i++)
3398
+ {
3399
  $arr[] = php_xmlrpc_decode($xmlrpc_val->arraymem($i), $options);
3400
  }
3401
  return $arr;
3406
  // shall we check for proper subclass of xmlrpcval instead of
3407
  // presence of _php_class to detect what we can do?
3408
  if (in_array('decode_php_objs', $options) && $xmlrpc_val->_php_class != ''
3409
+ && class_exists($xmlrpc_val->_php_class))
3410
+ {
3411
  $obj = @new $xmlrpc_val->_php_class;
3412
+ while(list($key,$value)=$xmlrpc_val->structeach())
3413
+ {
3414
  $obj->$key = php_xmlrpc_decode($value, $options);
3415
  }
3416
  return $obj;
3417
+ }
3418
+ else
3419
+ {
3420
  $arr = array();
3421
+ while(list($key,$value)=$xmlrpc_val->structeach())
3422
+ {
3423
  $arr[$key] = php_xmlrpc_decode($value, $options);
3424
  }
3425
  return $arr;
3427
  case 'msg':
3428
  $paramcount = $xmlrpc_val->getNumParams();
3429
  $arr = array();
3430
+ for($i = 0; $i < $paramcount; $i++)
3431
+ {
3432
  $arr[] = php_xmlrpc_decode($xmlrpc_val->getParam($i));
3433
  }
3434
  return $arr;
3438
  // This constant left here only for historical reasons...
3439
  // it was used to decide if we have to define xmlrpc_encode on our own, but
3440
  // we do not do it anymore
3441
+ if(function_exists('xmlrpc_decode'))
3442
+ {
3443
+ define('XMLRPC_EPI_ENABLED','1');
3444
+ }
3445
+ else
3446
+ {
3447
+ define('XMLRPC_EPI_ENABLED','0');
3448
  }
3449
 
3450
  /**
3461
  * @author Dan Libby (dan@libby.com)
3462
  *
3463
  * @param mixed $php_val the value to be converted into an xmlrpcval object
3464
+ * @param array $options can include 'encode_php_objs', 'auto_dates', 'null_extension' or 'extension_api'
3465
  * @return xmlrpcval
3466
  */
3467
+ function php_xmlrpc_encode($php_val, $options=array())
3468
  {
3469
  $type = gettype($php_val);
3470
+ switch($type)
3471
+ {
3472
  case 'string':
3473
+ if (in_array('auto_dates', $options) && preg_match('/^[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}$/', $php_val)){
3474
  $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcDateTime']);
3475
+ } else if(in_array('auto_base64', $options) && strpos($php_val, 'BASE64:') === 0){
3476
  $xmlrpc_val = new xmlrpcval(substr($php_val, 7), $GLOBALS['xmlrpcBase64']);
3477
+ } else{
3478
  $xmlrpc_val = new xmlrpcval($php_val, $GLOBALS['xmlrpcString']);
3479
  }
3480
  break;
3499
  $j = 0;
3500
  $arr = array();
3501
  $ko = false;
3502
+ foreach($php_val as $key => $val)
3503
+ {
3504
  $arr[$key] = php_xmlrpc_encode($val, $options);
3505
+ if(!$ko && $key !== $j)
3506
+ {
3507
  $ko = true;
3508
  }
3509
  $j++;
3510
  }
3511
+ if($ko)
3512
+ {
3513
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
3514
+ }
3515
+ else
3516
+ {
3517
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcArray']);
3518
  }
3519
  break;
3520
  case 'object':
3521
+ if(is_a($php_val, 'xmlrpcval'))
3522
+ {
3523
  $xmlrpc_val = $php_val;
3524
+ }
3525
+ else if(is_a($php_val, 'DateTime'))
3526
+ {
3527
  $xmlrpc_val = new xmlrpcval($php_val->format('Ymd\TH:i:s'), $GLOBALS['xmlrpcStruct']);
3528
+ }
3529
+ else
3530
+ {
3531
  $arr = array();
3532
  reset($php_val);
3533
+ while(list($k,$v) = each($php_val))
3534
+ {
3535
  $arr[$k] = php_xmlrpc_encode($v, $options);
3536
  }
3537
  $xmlrpc_val = new xmlrpcval($arr, $GLOBALS['xmlrpcStruct']);
3538
+ if (in_array('encode_php_objs', $options))
3539
+ {
3540
  // let's save original class name into xmlrpcval:
3541
  // might be useful later on...
3542
  $xmlrpc_val->_php_class = get_class($php_val);
3544
  }
3545
  break;
3546
  case 'NULL':
3547
+ if (in_array('extension_api', $options))
3548
+ {
3549
  $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcString']);
3550
+ }
3551
+ else if (in_array('null_extension', $options))
3552
+ {
3553
  $xmlrpc_val = new xmlrpcval('', $GLOBALS['xmlrpcNull']);
3554
+ }
3555
+ else
3556
+ {
3557
  $xmlrpc_val = new xmlrpcval();
3558
  }
3559
  break;
3560
  case 'resource':
3561
+ if (in_array('extension_api', $options))
3562
+ {
3563
  $xmlrpc_val = new xmlrpcval((int)$php_val, $GLOBALS['xmlrpcInt']);
3564
+ }
3565
+ else
3566
+ {
3567
  $xmlrpc_val = new xmlrpcval();
3568
  }
3569
  // catch "user function", "unknown type"
3584
  * @param array $options
3585
  * @return mixed false on error, or an instance of either xmlrpcval, xmlrpcmsg or xmlrpcresp
3586
  */
3587
+ function php_xmlrpc_decode_xml($xml_val, $options=array())
3588
  {
3589
  $GLOBALS['_xh'] = array();
3590
  $GLOBALS['_xh']['ac'] = '';
3601
  xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
3602
  // What if internal encoding is not in one of the 3 allowed?
3603
  // we use the broadest one, ie. utf8!
3604
+ if (!in_array($GLOBALS['xmlrpc_internalencoding'], array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
3605
+ {
3606
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
3607
+ }
3608
+ else
3609
+ {
3610
  xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $GLOBALS['xmlrpc_internalencoding']);
3611
  }
3612
  xml_set_element_handler($parser, 'xmlrpc_se_any', 'xmlrpc_ee');
3613
  xml_set_character_data_handler($parser, 'xmlrpc_cd');
3614
  xml_set_default_handler($parser, 'xmlrpc_dh');
3615
+ if(!xml_parse($parser, $xml_val, 1))
3616
+ {
3617
  $errstr = sprintf('XML error: %s at line %d, column %d',
3618
  xml_error_string(xml_get_error_code($parser)),
3619
  xml_get_current_line_number($parser), xml_get_current_column_number($parser));
3627
  error_log($GLOBALS['_xh']['isf_reason']);
3628
  return false;
3629
  }
3630
+ switch ($GLOBALS['_xh']['rt'])
3631
+ {
3632
  case 'methodresponse':
3633
  $v =& $GLOBALS['_xh']['value'];
3634
+ if ($GLOBALS['_xh']['isf'] == 1)
3635
+ {
3636
  $vc = $v->structmem('faultCode');
3637
  $vs = $v->structmem('faultString');
3638
  $r = new xmlrpcresp(0, $vc->scalarval(), $vs->scalarval());
3639
+ }
3640
+ else
3641
+ {
3642
  $r = new xmlrpcresp($v);
3643
  }
3644
  return $r;
3645
  case 'methodcall':
3646
  $m = new xmlrpcmsg($GLOBALS['_xh']['method']);
3647
+ for($i=0; $i < count($GLOBALS['_xh']['params']); $i++)
3648
+ {
3649
  $m->addParam($GLOBALS['_xh']['params'][$i]);
3650
  }
3651
  return $m;
3672
 
3673
  // read chunk-size, chunk-extension (if any) and crlf
3674
  // get the position of the linebreak
3675
+ $chunkend = strpos($buffer,"\r\n") + 2;
3676
+ $temp = substr($buffer,0,$chunkend);
3677
+ $chunk_size = hexdec( trim($temp) );
3678
  $chunkstart = $chunkend;
3679
+ while($chunk_size > 0)
3680
+ {
3681
  $chunkend = strpos($buffer, "\r\n", $chunkstart + $chunk_size);
3682
 
3683
  // just in case we got a broken connection
3684
+ if($chunkend == false)
3685
+ {
3686
+ $chunk = substr($buffer,$chunkstart);
3687
  // append chunk-data to entity-body
3688
  $new .= $chunk;
3689
  $length += strlen($chunk);
3691
  }
3692
 
3693
  // read chunk-data and crlf
3694
+ $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart);
3695
  // append chunk-data to entity-body
3696
  $new .= $chunk;
3697
  // length := length + chunk-size
3699
  // read chunk-size and crlf
3700
  $chunkstart = $chunkend + 2;
3701
 
3702
+ $chunkend = strpos($buffer,"\r\n",$chunkstart)+2;
3703
+ if($chunkend == false)
3704
+ {
3705
  break; //just in case we got a broken connection
3706
  }
3707
+ $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart);
3708
+ $chunk_size = hexdec( trim($temp) );
3709
  $chunkstart = $chunkend;
3710
  }
3711
  return $new;
3718
  * we SHOULD assume it is strictly US-ASCII. But we try to be more tolerant of unconforming (legacy?) clients/servers,
3719
  * which will be most probably using UTF-8 anyway...
3720
  *
3721
+ * @param string $httpheader the http Content-type header
3722
  * @param string $xmlchunk xml content buffer
3723
  * @param string $encoding_prefs comma separated list of character encodings to be used as default (when mb extension is enabled)
3724
+ * @return string
3725
  *
3726
  * @todo explore usage of mb_http_input(): does it detect http headers + post data? if so, use it instead of hand-detection!!!
3727
  */
3728
+ function guess_encoding($httpheader='', $xmlchunk='', $encoding_prefs=null)
3729
  {
3730
  // discussion: see http://www.yale.edu/pclt/encoding/
3731
  // 1 - test if encoding is specified in HTTP HEADERS
3743
 
3744
  /// @todo this test will pass if ANY header has charset specification, not only Content-Type. Fix it?
3745
  $matches = array();
3746
+ if(preg_match('/;\s*charset\s*=([^;]+)/i', $httpheader, $matches))
3747
+ {
3748
  return strtoupper(trim($matches[1], " \t\""));
3749
  }
3750
 
3755
  // in the xml declaration, and verify if they match.
3756
  /// @todo implement check as described above?
3757
  /// @todo implement check for first bytes of string even without a BOM? (It sure looks harder than for cases WITH a BOM)
3758
+ if(preg_match('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\x00\x00\xFF\xFE|\xFE\xFF\x00\x00)/', $xmlchunk))
3759
+ {
3760
  return 'UCS-4';
3761
+ }
3762
+ elseif(preg_match('/^(\xFE\xFF|\xFF\xFE)/', $xmlchunk))
3763
+ {
3764
  return 'UTF-16';
3765
+ }
3766
+ elseif(preg_match('/^(\xEF\xBB\xBF)/', $xmlchunk))
3767
+ {
3768
  return 'UTF-8';
3769
  }
3770
 
3772
  // Details:
3773
  // SPACE: (#x20 | #x9 | #xD | #xA)+ === [ \x9\xD\xA]+
3774
  // EQ: SPACE?=SPACE? === [ \x9\xD\xA]*=[ \x9\xD\xA]*
3775
+ if (preg_match('/^<\?xml\s+version\s*=\s*'. "((?:\"[a-zA-Z0-9_.:-]+\")|(?:'[a-zA-Z0-9_.:-]+'))".
3776
  '\s+encoding\s*=\s*' . "((?:\"[A-Za-z][A-Za-z0-9._-]*\")|(?:'[A-Za-z][A-Za-z0-9._-]*'))/",
3777
+ $xmlchunk, $matches))
3778
+ {
3779
  return strtoupper(substr($matches[2], 1, -1));
3780
  }
3781
 
3782
  // 4 - if mbstring is available, let it do the guesswork
3783
  // NB: we favour finding an encoding that is compatible with what we can process
3784
+ if(extension_loaded('mbstring'))
3785
+ {
3786
+ if($encoding_prefs)
3787
+ {
3788
  $enc = mb_detect_encoding($xmlchunk, $encoding_prefs);
3789
+ }
3790
+ else
3791
+ {
3792
  $enc = mb_detect_encoding($xmlchunk);
3793
  }
3794
  // NB: mb_detect likes to call it ascii, xml parser likes to call it US_ASCII...
3795
  // IANA also likes better US-ASCII, so go with it
3796
+ if($enc == 'ASCII')
3797
+ {
3798
+ $enc = 'US-'.$enc;
3799
  }
3800
  return $enc;
3801
+ }
3802
+ else
3803
+ {
3804
  // no encoding specified: as per HTTP1.1 assume it is iso-8859-1?
3805
  // Both RFC 2616 (HTTP 1.1) and 1945 (HTTP 1.0) clearly state that for text/xxx content types
3806
  // this should be the standard. And we should be getting text/xml as request and response.
3814
  * if it is a valid subset of any encoding in the list
3815
  * @param string $encoding charset to be tested
3816
  * @param mixed $validlist comma separated list of valid charsets (or array of charsets)
3817
+ * @return bool
3818
  */
3819
  function is_valid_charset($encoding, $validlist)
3820
  {
3821
  $charset_supersets = array(
3822
+ 'US-ASCII' => array ('ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3', 'ISO-8859-4',
3823
  'ISO-8859-5', 'ISO-8859-6', 'ISO-8859-7', 'ISO-8859-8',
3824
  'ISO-8859-9', 'ISO-8859-10', 'ISO-8859-11', 'ISO-8859-12',
3825
  'ISO-8859-13', 'ISO-8859-14', 'ISO-8859-15', 'UTF-8',
3829
  $validlist = explode(',', $validlist);
3830
  if (@in_array(strtoupper($encoding), $validlist))
3831
  return true;
3832
+ else
3833
+ {
3834
  if (array_key_exists($encoding, $charset_supersets))
3835
  foreach ($validlist as $allowed)
3836
  if (in_array($allowed, $charset_supersets[$encoding]))
3838
  return false;
3839
  }
3840
  }
 
 
includes/vendor/mailerlite/{ML_Rest.php → FL_ML_Rest.php} RENAMED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
- require_once dirname(__FILE__) . '/ML_Rest_Base.php';
4
 
5
- class ML_Rest extends ML_Rest_Base
6
  {
7
- var $name = '';
8
  var $id = null;
9
 
10
  function __construct($api_key){
@@ -62,4 +62,4 @@ class ML_Rest extends ML_Rest_Base
62
  function remove($data = null){
63
  return $this->execute('DELETE');
64
  }
65
- }
1
  <?php
2
 
3
+ require_once dirname(__FILE__) . '/FL_ML_Rest_Base.php';
4
 
5
+ class FL_ML_Rest extends FL_ML_Rest_Base
6
  {
7
+ var $name = '';
8
  var $id = null;
9
 
10
  function __construct($api_key){
62
  function remove($data = null){
63
  return $this->execute('DELETE');
64
  }
65
+ }
includes/vendor/mailerlite/{ML_Rest_Base.php → FL_ML_Rest_Base.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- class ML_Rest_Base
4
  {
5
  protected $url;
6
  protected $verb;
@@ -152,7 +152,7 @@ class ML_Rest_Base
152
 
153
  curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, false);
154
  curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
155
- curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, true);
156
  }
157
 
158
  protected function setAuth(&$curlHandle)
@@ -222,4 +222,4 @@ class ML_Rest_Base
222
  {
223
  $this->verb = $verb;
224
  }
225
- }
1
  <?php
2
 
3
+ class FL_ML_Rest_Base
4
  {
5
  protected $url;
6
  protected $verb;
152
 
153
  curl_setopt($curlHandle, CURLOPT_SSL_VERIFYHOST, false);
154
  curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false);
155
+ curl_setopt($curlHandle, CURLOPT_FOLLOWLOCATION, true);
156
  }
157
 
158
  protected function setAuth(&$curlHandle)
222
  {
223
  $this->verb = $verb;
224
  }
225
+ }
includes/vendor/ontraport/APIAutoloader.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class APIAutoloader
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class APIAutoloader
13
+ {
14
+ public static function loader($className)
15
+ {
16
+ // Ensure correct path
17
+ if (strpos($className, "\\"))
18
+ {
19
+ $tmp = explode("\\", $className);
20
+ $className = array_pop($tmp);
21
+ }
22
+
23
+ $file = dirname(__FILE__) . "/" . $className . '.php';
24
+
25
+ if (file_exists($file))
26
+ {
27
+ require_once($file);
28
+ }
29
+ else if (strpos($file, "Exception") !== false)
30
+ {
31
+ require_once(dirname(__FILE__) . '/Exceptions/OntraportAPIException.php');
32
+ }
33
+ }
34
+ }
35
+
36
+ spl_autoload_register('\OntraportAPI\APIAutoloader::loader');
includes/vendor/ontraport/BaseApi.php ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class BaseApi
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ abstract class BaseApi
13
+ {
14
+ /**
15
+ * @var Ontraport instance
16
+ */
17
+ protected $client;
18
+
19
+ /**
20
+ * @var string endpoint for all objects retrieve meta functions
21
+ */
22
+ const META = "meta";
23
+
24
+ /**
25
+ * @var string endpoint for all objects saveorupdate functions
26
+ */
27
+ const SAVE_OR_UPDATE = "saveorupdate";
28
+
29
+ /**
30
+ * @var string endpoint for all objects getInfo functions
31
+ */
32
+ const GET_INFO = "getInfo";
33
+
34
+ /**
35
+ * @var string constant for Content-Type header value type JSON-encoded
36
+ */
37
+ const CONTENT_TYPE_JSON = "json";
38
+
39
+ /**
40
+ * @var string constant for Content-Type header value type form-encoded
41
+ */
42
+ const CONTENT_TYPE_FORM = "form";
43
+
44
+ /**
45
+ * @var string endpoint for object
46
+ */
47
+ protected $_endpoint = NULL;
48
+
49
+ /**
50
+ * @var string plural endpoint for object
51
+ */
52
+ protected $_endpointPlural = NULL;
53
+
54
+ /**
55
+ * @param Ontraport $client
56
+ */
57
+ public function __construct(Ontraport $client)
58
+ {
59
+ $this->client = $client;
60
+ }
61
+
62
+ /**
63
+ * @brief Retrieve a single specified object
64
+ *
65
+ * @param mixed[] $requestParams The parameters to submit with GET request.
66
+ * Varies by object.
67
+ *
68
+ * @return string JSON formatted HTTP response or error message
69
+ */
70
+ protected function _retrieveSingle($requestParams)
71
+ {
72
+ $requiredParams = array("id");
73
+ return $this->client->request($requestParams, $this->_endpoint, "get", $requiredParams, $options = NULL);
74
+ }
75
+
76
+ /**
77
+ * @brief Retrieve multiple objects according to specific criteria, handle pagination
78
+ *
79
+ * @param $requestParams mixed[] Array of parameters to submit with GET request. If "ids"
80
+ * are not specified, all will be selected.
81
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
82
+ * "condition","search","searchNotes","group_ids","performAll",
83
+ * "externs","listFields"
84
+ *
85
+ * @return string JSON formatted array of paginated response data: each page of data will be an element in that array
86
+ */
87
+ protected function _retrieveMultiplePaginated($requestParams)
88
+ {
89
+ $collection = json_decode($this->_retrieveCollectionInfo($requestParams), true);
90
+ $requestParams["start"] = $requestParams["start"] ?: 0;
91
+ $requestParams["range"] = $requestParams["range"] ?: 50;
92
+
93
+ $object_data = array();
94
+ while ($requestParams["start"] < $collection["data"]["count"])
95
+ {
96
+ $object_data[] = json_decode($this->_retrieveMultiple($requestParams), true);
97
+ $requestParams["start"] += $requestParams["range"];
98
+ }
99
+ return json_encode($object_data);
100
+ }
101
+
102
+ /**
103
+ * @brief Retrieve multiple objects according to specific criteria
104
+ *
105
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
106
+ * Varies by object.
107
+ *
108
+ * @return string JSON formatted HTTP response or error message.
109
+ */
110
+ protected function _retrieveMultiple($requestParams)
111
+ {
112
+ return $this->client->request($requestParams, $this->_endpointPlural, "get", $requiredParams = NULL, $options = NULL);
113
+ }
114
+
115
+ /**
116
+ * @brief Create an object
117
+ *
118
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
119
+ * Varies by object.
120
+ *
121
+ * @return string JSON formatted HTTP response or error message
122
+ */
123
+ protected function _create($requestParams)
124
+ {
125
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
126
+ return $this->client->request($requestParams, $this->_endpointPlural, "post", $requiredParams = NULL, $options);
127
+ }
128
+
129
+ /**
130
+ * @brief Delete a single specified object
131
+ *
132
+ * @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
133
+ * Varies by object.
134
+ *
135
+ * @return string JSON formatted HTTP response or error message
136
+ */
137
+ protected function _deleteSingle($requestParams)
138
+ {
139
+ $requiredParams = array("id");
140
+ return $this->client->request($requestParams, $this->_endpoint, "delete", $requiredParams, $options = NULL);
141
+ }
142
+
143
+ /**
144
+ * @brief Delete multiple objects according to specific criteria
145
+ *
146
+ * @param mixed[] $requestParams The parameters to submit with DELETE request.
147
+ * Varies by object.
148
+ *
149
+ * @return string JSON formatted HTTP response or error message
150
+ */
151
+ protected function _deleteMultiple($requestParams)
152
+ {
153
+ return $this->client->request($requestParams, $this->_endpointPlural, "delete", $requiredParams = NULL, $options = NULL);
154
+ }
155
+
156
+ /**
157
+ * @brief Update an object's data
158
+ *
159
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
160
+ * Varies by object.
161
+ *
162
+ * @return string JSON formatted HTTP response or error message
163
+ */
164
+ protected function _update($requestParams)
165
+ {
166
+ $requiredParams = array("id");
167
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
168
+ return $this->client->request($requestParams, $this->_endpointPlural, "put", $requiredParams, $options);
169
+ }
170
+
171
+ /**
172
+ * @brief Retrieve meta for an object
173
+ *
174
+ * @param mixed[] $requestParams The parameters to submit with GET request. Ignored if not sent.
175
+ *
176
+ * @return string JSON formatted meta for an object
177
+ */
178
+ protected function _retrieveMeta()
179
+ {
180
+ return $this->client->request($requestParams = NULL, $this->_endpointPlural . "/" . self::META, "get", $requiredParams = NULL, $options = NULL);
181
+ }
182
+
183
+ /**
184
+ * @brief Either create an object or merge with an existing object on unique field
185
+ *
186
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
187
+ * Varies by object.
188
+ *
189
+ * @return string JSON formatted HTTP response or error message
190
+ */
191
+ protected function _saveOrUpdate($requestParams)
192
+ {
193
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
194
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SAVE_OR_UPDATE, "post", $requiredParams = NULL, $options);
195
+ }
196
+
197
+ /**
198
+ * @brief Retrieve information (such as number of objects) about a collection
199
+ *
200
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
201
+ * Varies by object.
202
+ *
203
+ * @return string JSON formatted HTTP response or error message
204
+ */
205
+ protected function _retrieveCollectionInfo($requestParams)
206
+ {
207
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::GET_INFO, "get", $requiredParams = NULL, $options = NULL);
208
+ }
209
+
210
+ protected static function retrieveContentTypeHeader($encoding)
211
+ {
212
+ if ($encoding == self::CONTENT_TYPE_FORM)
213
+ {
214
+ return array("Content-Type" => "application/x-www-form-urlencoded");
215
+ }
216
+
217
+ else if ($encoding == self::CONTENT_TYPE_JSON)
218
+ {
219
+ return array("Content-Type" => "application/json");
220
+ }
221
+ }
222
+ }
includes/vendor/ontraport/CampaignBuilderItems.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class CampaignBuilderItems
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class CampaignBuilderItems extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single campaign
16
+ */
17
+ protected $_endpoint = "CampaignBuilderItem";
18
+
19
+ /**
20
+ * $var string endpoint for plural campaigns
21
+ */
22
+ protected $_endpointPlural = "CampaignBuilderItems";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /**
33
+ * @brief Retrieve a single specified campaign
34
+ *
35
+ * @param mixed[] $requestParams The parameters to submit with GET request.
36
+ * Possible array keys: "id" (required)
37
+ *
38
+ * @return string JSON formatted response
39
+ */
40
+ public function retrieveSingle($requestParams)
41
+ {
42
+ return parent::_retrieveSingle($requestParams);
43
+ }
44
+
45
+ /**
46
+ * @brief Retrieve a list of campaigns, handle pagination
47
+ *
48
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
49
+ * are not specified, all will be selected.
50
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
51
+ * "searchNotes","group_ids","performAll","externs","listFields"
52
+ *
53
+ * @return string JSON formatted array of paginated response data: each page of data will be an element in that array
54
+ */
55
+ public function retrieveMultiplePaginated($requestParams)
56
+ {
57
+ return parent::_retrieveMultiplePaginated($requestParams);
58
+ }
59
+
60
+ /**
61
+ * @brief Retrieve a list of campaigns
62
+ *
63
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
64
+ * are not specified, all will be selected.
65
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
66
+ * "searchNotes","group_ids","performAll","externs","listFields"
67
+ *
68
+ * @return string JSON formatted response
69
+ */
70
+ public function retrieveMultiple($requestParams)
71
+ {
72
+ return parent::_retrieveMultiple($requestParams);
73
+ }
74
+
75
+ /**
76
+ * @brief Retrieve information (such as number of campaigns) about campaign collection
77
+ *
78
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
79
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
80
+ *
81
+ * @return string JSON formatted response
82
+ */
83
+ public function retrieveCollectionInfo($requestParams)
84
+ {
85
+ return parent::_retrieveCollectionInfo($requestParams);
86
+ }
87
+
88
+ /**
89
+ * @brief Retrieve meta for a campaign object
90
+ *
91
+ * @return string JSON formatted response
92
+ */
93
+ public function retrieveMeta()
94
+ {
95
+ return parent::_retrieveMeta();
96
+ }
97
+ }
includes/vendor/ontraport/Contacts.php ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Contacts
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Contacts extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single contact
16
+ */
17
+ protected $_endpoint = "Contact";
18
+
19
+ /**
20
+ * $var string endpoint for plural contacts
21
+ */
22
+ protected $_endpointPlural = "Contacts";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /**
33
+ * @brief Retrieve a single specified contact
34
+ *
35
+ * @param mixed[] $requestParams The parameters to submit with GET request.
36
+ * Possible array keys: "id" (required)
37
+ *
38
+ * @return string JSON formatted response
39
+ */
40
+ public function retrieveSingle($requestParams)
41
+ {
42
+ return parent::_retrieveSingle($requestParams);
43
+ }
44
+
45
+ /**
46
+ * @brief Retrieve multiple contacts according to specific criteria, handle pagination
47
+ *
48
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
49
+ * are not specified, all will be selected.
50
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
51
+ * "searchNotes","group_ids","performAll","externs","listFields"
52
+ *
53
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
54
+ */
55
+ public function retrieveMultiplePaginated($requestParams)
56
+ {
57
+ return parent::_retrieveMultiplePaginated($requestParams);
58
+ }
59
+
60
+ /**
61
+ * @brief Retrieve multiple contacts according to specific criteria
62
+ *
63
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
64
+ * are not specified, all will be selected.
65
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
66
+ * "searchNotes","group_ids","performAll","externs","listFields"
67
+ *
68
+ * @return string JSON formatted response
69
+ */
70
+ public function retrieveMultiple($requestParams)
71
+ {
72
+ return parent::_retrieveMultiple($requestParams);
73
+ }
74
+
75
+ /**
76
+ * @brief Create a contact
77
+ *
78
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
79
+ * Possible array keys: "firstname","lastname","email","freferrer","lreferrer","address",
80
+ * "city","state","zip","birthday","aff_paypal","program_id",
81
+ * "bulk_mail","office_phone","fax","company","address2","website",
82
+ * "title","country","n_lead_source","n_campaign","n_content",
83
+ * "n_content","n_medium","referral_page","num_purchased","owner",
84
+ * "bulk_sms","sms_number",{customFields}(if you have custom contact
85
+ * fields in your account, these can be included in the array keys)
86
+ *
87
+ * @return string JSON formatted response
88
+ */
89
+ public function create($requestParams)
90
+ {
91
+ return parent::_create($requestParams);
92
+ }
93
+
94
+ /**
95
+ * @brief Delete a single specified contact
96
+ *
97
+ * @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
98
+ * Possible array keys: "id" (required)
99
+ *
100
+ * @return string JSON formatted response
101
+ */
102
+ public function deleteSingle($requestParams)
103
+ {
104
+ return parent::_deleteSingle($requestParams);
105
+ }
106
+
107
+ /**
108
+ * @brief Delete multiple contacts according to specific criteria
109
+ *
110
+ * @param mixed[] $requestParams The parameters to submit with DELETE request. All parameters are optional but if "ids"
111
+ * are not specified, all will be deleted.
112
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
113
+ * "searchNotes","group_ids","performAll","externs","listFields"
114
+ *
115
+ * @return string JSON formatted response
116
+ */
117
+ public function deleteMultiple($requestParams)
118
+ {
119
+ return parent::_deleteMultiple($requestParams);
120
+ }
121
+
122
+ /**
123
+ * @brief Update a contact's data
124
+ *
125
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
126
+ * Possible array keys: "id" (required),"firstname","lastname","email","freferrer",
127
+ * "lreferrer","address","city","state","zip","birthday","aff_paypal",
128
+ * "program_id","bulk_mail","office_phone","fax","company","address2",
129
+ * "website","title","country","n_lead_source","n_campaign","n_content",
130
+ * "n_content","n_medium","referral_page","num_purchased","owner",
131
+ * "bulk_sms","sms_number",{customFields}(if you have custom contact
132
+ * fields in your account, these can be included in the array keys)
133
+ *
134
+ * @return string JSON formatted response
135
+ */
136
+ public function update($requestParams)
137
+ {
138
+ return parent::_update($requestParams);
139
+ }
140
+
141
+ /**
142
+ * @brief Retrieve meta for a contact object
143
+ *
144
+ * @return string JSON formatted meta for contact object
145
+ */
146
+ public function retrieveMeta()
147
+ {
148
+ return parent::_retrieveMeta();
149
+ }
150
+
151
+ /**
152
+ * @brief Either create a contact or merge with an existing contact on unique field
153
+ *
154
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
155
+ * Possible array keys: "firstname","lastname","email","freferrer","lreferrer","address",
156
+ * "city","state","zip","birthday","aff_paypal","program_id",
157
+ * "contact_cat","bulk_mail","office_phone","fax","company",
158
+ * "address2","website","title","country","spent","n_lead_source",
159
+ * "n_campaign","n_content","n_medium","referral_page","aff_sales",
160
+ * "aff_amount","mriInvoiceNum","mriInvoiceTotal","mrcAmount",
161
+ * "mrcUnpaid","mrcResult","grade","num_purchased","owner",
162
+ * "bulk_sms","sms_number","updateSequence","n_term",{customFields}
163
+ * (if you have custom contact fields in your account, these can be
164
+ * included in the array keys)
165
+ *
166
+ * @return string JSON formatted response
167
+ */
168
+ public function saveOrUpdate($requestParams)
169
+ {
170
+ return parent::_saveOrUpdate($requestParams);
171
+ }
172
+
173
+ /**
174
+ * @brief Retrieve information (such as number of contacts) about contact collection
175
+ *
176
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
177
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
178
+ *
179
+ * @return string JSON formatted response
180
+ */
181
+ public function retrieveCollectionInfo($requestParams)
182
+ {
183
+ return parent::_retrieveCollectionInfo($requestParams);
184
+ }
185
+ }
includes/vendor/ontraport/CreditCards.php ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class CreditCards
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class CreditCards extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single credit card
16
+ */
17
+ protected $_endpoint = "CreditCard";
18
+
19
+ /**
20
+ * $var string endpoint for plural forms
21
+ */
22
+ protected $_endpointPlural = "CreditCards";
23
+
24
+ // Credit card-specific function endpoints
25
+ const DEFAULT_CARD = "default";
26
+
27
+ /**
28
+ * @param Ontraport $client
29
+ */
30
+ public function __construct(Ontraport $client)
31
+ {
32
+ parent::__construct($client);
33
+ }
34
+
35
+ /**
36
+ * @brief Retrieve a single specified credit card.
37
+ *
38
+ * @param mixed[] $requestParams The parameters to submit with GET request.
39
+ * Possible array keys: "id" (required)
40
+ *
41
+ * @return string JSON formatted response
42
+ */
43
+ public function retrieveSingle($requestParams)
44
+ {
45
+ return parent::_retrieveSingle($requestParams);
46
+ }
47
+
48
+ /**
49
+ * @brief Retrieve multiple credit cards according to specific criteria, handle pagination
50
+ *
51
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
52
+ * are not specified, all will be selected.
53
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
54
+ * "searchNotes","group_ids","performAll","externs","listFields"
55
+ *
56
+ * @return string JSON formatted array of response data: each page of data will be an element in that array
57
+ */
58
+ public function retrieveMultiplePaginated($requestParams)
59
+ {
60
+ return parent::_retrieveMultiplePaginated($requestParams);
61
+ }
62
+
63
+ /**
64
+ * @brief Retrieve multiple credit cards according to specific criteria
65
+ *
66
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
67
+ * are not specified, all will be selected.
68
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
69
+ * "searchNotes","group_ids","performAll","externs","listFields"
70
+ *
71
+ * @return string JSON formatted response
72
+ */
73
+ public function retrieveMultiple($requestParams)
74
+ {
75
+ return parent::_retrieveMultiple($requestParams);
76
+ }
77
+
78
+ /**
79
+ * @brief Retrieve information (such as number of credit cards) about credit card collection
80
+ *
81
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
82
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
83
+ *
84
+ * @return string JSON formatted response
85
+ */
86
+ public function retrieveCollectionInfo($requestParams)
87
+ {
88
+ return parent::_retrieveCollectionInfo($requestParams);
89
+ }
90
+
91
+ /**
92
+ * @brief Retrieve meta for a credit card object
93
+ *
94
+ * @return string JSON formatted response
95
+ */
96
+ public function retrieveMeta()
97
+ {
98
+ return parent::_retrieveMeta();
99
+ }
100
+
101
+ /**
102
+ * @brief Set a specifed credit card as the default.
103
+ *
104
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
105
+ * Possible array keys: "id" (required)
106
+ *
107
+ * @return string JSON formatted response
108
+ */
109
+ public function setDefault($requestParams)
110
+ {
111
+ $requiredParams = array("id");
112
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::DEFAULT_CARD, "put", $requiredParams, $options = NULL);
113
+ }
114
+ }
includes/vendor/ontraport/Criteria.php ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Criteria
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Criteria
13
+ {
14
+ /**
15
+ * @var array of condition data
16
+ */
17
+ protected $_condition = array();
18
+
19
+ public function __construct($field, $relational_operator, $value)
20
+ {
21
+ $this->_condition[] = $this->buildCondition($field, $relational_operator, $value);
22
+ }
23
+
24
+ /**
25
+ * @brief Add another condition that must be met in addition to existing condition(s)
26
+ *
27
+ * @param string $field The field subject to the condition.
28
+ * @param string $relational_operator The comparison operator. May be "=","<>",">","<",">=","<=","IN","NOT IN", or "IS".
29
+ * @param string|int|null $value The value to compare the field against.
30
+ */
31
+ public function andCondition($field, $relational_operator, $value)
32
+ {
33
+ if ($this->_condition)
34
+ {
35
+ $this->_condition[] = "AND";
36
+ }
37
+ $this->_condition[] = $this->buildCondition($field, $relational_operator, $value);
38
+ }
39
+
40
+ /**
41
+ * @brief Add another condition that may be met in addition to existing condition(s)
42
+ *
43
+ * @param string $field The field subject to the condition.
44
+ * @param string $relational_operator The comparison operator. May be "=","<>",">","<",">=","<=","IN","NOT IN", or "IS".
45
+ * @param string|int|null $value The value to compare the field against.
46
+ */
47
+ public function orCondition($field, $relational_operator, $value)
48
+ {
49
+ if ($this->_condition)
50
+ {
51
+ $this->_condition[] = "OR";
52
+ }
53
+ $this->_condition[] = $this->buildCondition($field, $relational_operator, $value);
54
+ }
55
+
56
+ /**
57
+ * @brief Return JSON-encoded criteria object from conditions array
58
+ *
59
+ * @return string JSON
60
+ */
61
+ public function fromArray()
62
+ {
63
+ return json_encode($this->_condition);
64
+ }
65
+
66
+ /**
67
+ * @brief Assembles a single condition
68
+ *
69
+ * @param string $field
70
+ * @param string $relational_operator
71
+ * @param string|int|null $value
72
+ *
73
+ * @return array
74
+ */
75
+ private function buildCondition($field, $relational_operator, $value)
76
+ {
77
+ $this->_validateCondition($relational_operator, $value);
78
+
79
+ $condition["field"] = array("field" => $field);
80
+ $condition["op"] = $relational_operator;
81
+
82
+ if (is_array($value))
83
+ {
84
+ $list = array();
85
+ foreach ($value as $item)
86
+ {
87
+ $list[] = array("value" => $item);
88
+ }
89
+ $condition["value"] = array("list" => $list);
90
+ }
91
+ else
92
+ {
93
+ $condition["value"] = array("value" => $value);
94
+ }
95
+
96
+ return $condition;
97
+ }
98
+
99
+ /**
100
+ * @brief Validate condition data
101
+ *
102
+ * @param string $relational_operator
103
+ * @param string|int|null $value
104
+ *
105
+ * @throws Exceptions\ArrayOperatorException
106
+ * @throws Exceptions\ConditionOperatorException
107
+ */
108
+ private function _validateCondition($relational_operator, $value)
109
+ {
110
+ $relational_operators = array("=","<>",">","<",">=","<=","IN","NOT IN","IS","LIKE");
111
+
112
+ if (!in_array($relational_operator, $relational_operators))
113
+ {
114
+ throw new Exceptions\ConditionOperatorException($relational_operator);
115
+ }
116
+
117
+ if (is_array($value))
118
+ {
119
+ if ($relational_operator !== "IN")
120
+ {
121
+ throw new Exceptions\ArrayOperatorException();
122
+ }
123
+ }
124
+ }
125
+ }
includes/vendor/ontraport/CurlClient.php ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class CurlClient
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class CurlClient
13
+ {
14
+ const HTTP_OK = 200;
15
+ const HTTP_BAD_REQUEST = 400;
16
+ const HTTP_UNAUTHORIZED = 401;
17
+ const HTTP_FORBIDDEN = 403;
18
+ const HTTP_NOT_FOUND = 404;
19
+ const HTTP_RATE_LIMIT = 429;
20
+ const HTTP_ERROR = 500;
21
+
22
+ const RATE_LIMIT_RESET = "x-rate-limit-reset";
23
+
24
+ /**
25
+ * @var array of headers sent with HTTP requests
26
+ */
27
+ private $_requestHeaders = array();
28
+
29
+ /**
30
+ * @var int the last HTTP status code received
31
+ */
32
+ private $_lastStatusCode = null;
33
+
34
+ public function __construct($apiKey,$siteID)
35
+ {
36
+ $this->_setRequestHeader("Api-key", $apiKey);
37
+ $this->_setRequestHeader("Api-Appid", $siteID);
38
+ }
39
+
40
+ /**
41
+ * @brief sets an element in an array of headers to be sent with HTTP requests
42
+ *
43
+ * @param string $header
44
+ * @param string $value
45
+ */
46
+ private function _setRequestHeader($header, $value)
47
+ {
48
+ $this->_requestHeaders[$header] = $header . ": " . $value;
49
+ }
50
+
51
+ /**
52
+ * @brief retrieves current request headers
53
+ *
54
+ * @return array
55
+ */
56
+ public function getRequestHeaders()
57
+ {
58
+ return $this->_requestHeaders;
59
+ }
60
+
61
+ /**
62
+ * @brief gets an array of supported cURL methods
63
+ *
64
+ * @return array
65
+ */
66
+ private function _getWhitelistedRequestTypes()
67
+ {
68
+ return array(
69
+ "get",
70
+ "post",
71
+ "put",
72
+ "delete"
73
+ );
74
+ }
75
+
76
+ /**
77
+ * @brief checks that HTTP request is formed properly before sending
78
+ *
79
+ * @param array $requestParams
80
+ * @param array $requiredParams
81
+ * @param int $method
82
+ *
83
+ * @return boolean
84
+ *
85
+ * @throws Exceptions\HttpMethodException
86
+ * @throws Exceptions\RequiredParamsException
87
+ * @throws Exceptions\TypeException
88
+ */
89
+ private function _validateRequest($requestParams, $requiredParams, $method)
90
+ {
91
+ $allowedMethods = $this->_getWhitelistedRequestTypes();
92
+
93
+ if (!in_array($method, $allowedMethods))
94
+ {
95
+ throw new Exceptions\HttpMethodException($method);
96
+ }
97
+
98
+ if ($requestParams && (!is_array($requestParams)))
99
+ {
100
+ $dataType = gettype($requestParams);
101
+ throw new Exceptions\TypeException($dataType);
102
+ }
103
+
104
+ if ($missingParams = $this->_checkRequiredParams($requestParams, $requiredParams))
105
+ {
106
+ $missingParams = implode(",",$missingParams);
107
+ throw new Exceptions\RequiredParamsException($missingParams);
108
+ }
109
+
110
+ return true;
111
+ }
112
+
113
+ /**
114
+ * @brief checks that all required parameters were included with HTTP request
115
+ *
116
+ * @param array $requestParams
117
+ * @param array $requiredParams
118
+ * @param string $url
119
+ *
120
+ * @return array $missingParams
121
+ */
122
+ private function _checkRequiredParams($requestParams, $requiredParams)
123
+ {
124
+ $missingParams = array();
125
+
126
+ if ($requiredParams && is_array($requiredParams))
127
+ {
128
+ foreach ($requiredParams as $requiredParam)
129
+ {
130
+ if (!array_key_exists($requiredParam, $requestParams))
131
+ {
132
+ // Covers special case: when ids is required, group_ids can be substituted
133
+ if ($requiredParam == "ids")
134
+ {
135
+ if (!array_key_exists("group_ids", $requestParams))
136
+ {
137
+ $missingParams[] = $requiredParam;
138
+ }
139
+ }
140
+ else
141
+ {
142
+ $missingParams[] = $requiredParam;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ return $missingParams;
149
+ }
150
+
151
+ /**
152
+ * @brief makes an HTTP request
153
+ *
154
+ * @param array $requestParams
155
+ * @param string $url
156
+ * @param int $method
157
+ * @param array $requiredParams
158
+ * @param array $options
159
+ *
160
+ * @return string|boolean
161
+ */
162
+ public function httpRequest($requestParams, $url, $method, $requiredParams, $options)
163
+ {
164
+ if (!$this->_validateRequest($requestParams, $requiredParams, $method))
165
+ {
166
+ return false;
167
+ }
168
+
169
+ if ($options && is_array($options))
170
+ {
171
+ if (array_key_exists("headers", $options))
172
+ {
173
+ foreach ($options["headers"] as $header => $value)
174
+ {
175
+ $this->_setRequestHeader($header, $value);
176
+ }
177
+ }
178
+ }
179
+
180
+ if (array_key_exists("Content-Type", $this->_requestHeaders) && $this->_requestHeaders["Content-Type"] == "Content-Type: application/json")
181
+ {
182
+ $requestParams = json_encode($requestParams);
183
+ }
184
+
185
+ if (is_array($requestParams))
186
+ {
187
+ $requestParams = http_build_query($requestParams);
188
+ }
189
+
190
+ $curlHandle = curl_init();
191
+ $headers = array();
192
+ switch(strtolower($method))
193
+ {
194
+ case "post":
195
+ curl_setopt($curlHandle, CURLOPT_POST, 1);
196
+ curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $requestParams);
197
+ break;
198
+
199
+ case "get":
200
+ curl_setopt($curlHandle, CURLOPT_HTTPGET, 1);
201
+ $url = $url."?".$requestParams;
202
+ break;
203
+
204
+ case "put":
205
+ curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, "PUT");
206
+ curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $requestParams);
207
+ break;
208
+
209
+ case "delete":
210
+ curl_setopt($curlHandle, CURLOPT_CUSTOMREQUEST, "DELETE");
211
+ if (array_key_exists("Content-Type", $this->_requestHeaders) && $this->_requestHeaders["Content-Type"] == "Content-Type: application/json")
212
+ {
213
+ curl_setopt($curlHandle, CURLOPT_POSTFIELDS, $requestParams);
214
+ }
215
+ else
216
+ {
217
+ $url = $url."?".$requestParams;
218
+ }
219
+ break;
220
+ }
221
+
222
+ curl_setopt($curlHandle, CURLOPT_URL, $url);
223
+ curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $this->_requestHeaders);
224
+ curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
225
+ curl_setopt($curlHandle, CURLOPT_HEADER, false);
226
+ curl_setopt($curlHandle, CURLOPT_HEADERFUNCTION,
227
+ function($curl, $header) use (&$headers)
228
+ {
229
+ $len = strlen($header);
230
+ $header = explode(":", $header, 2);
231
+ if (count($header) < 2)
232
+ {
233
+ return $len;
234
+ }
235
+
236
+ $name = strtolower(trim($header[0]));
237
+ $headers[$name] = trim($header[1]);
238
+
239
+ return $len;
240
+ }
241
+ );
242
+ curl_setopt($curlHandle, CURLOPT_TIMEOUT, 60);
243
+
244
+ $result = curl_exec($curlHandle);
245
+
246
+ $this->_lastStatusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
247
+ if ($this->_lastStatusCode == self::HTTP_RATE_LIMIT)
248
+ {
249
+ $result = $this->retry($headers[self::RATE_LIMIT_RESET], $curlHandle);
250
+ }
251
+
252
+ curl_close($curlHandle);
253
+
254
+ unset($this->_requestHeaders["Content-Type"]);
255
+ return $result;
256
+ }
257
+
258
+ /**
259
+ * @brief get the last HTTP status code received
260
+ *
261
+ * @return int
262
+ */
263
+ public function getLastStatusCode()
264
+ {
265
+ return $this->_lastStatusCode;
266
+ }
267
+
268
+ /**
269
+ * @brief set the last HTTP status code received
270
+ *
271
+ * @param int $statusCode The code that was received
272
+ */
273
+ public function setLastStatusCode($statusCode)
274
+ {
275
+ $this->_lastStatusCode = $statusCode;
276
+ }
277
+
278
+ /**
279
+ * @brief Retry the request after waiting for the rate limit to roll over
280
+ *
281
+ * @param int $wait
282
+ * @param $curlHandle
283
+ *
284
+ * @return mixed
285
+ */
286
+ public function retry($wait, $curlHandle)
287
+ {
288
+ sleep($wait);
289
+ $result = curl_exec($curlHandle);
290
+ $this->_lastStatusCode = curl_getinfo($curlHandle, CURLINFO_HTTP_CODE);
291
+ return $result;
292
+ }
293
+ }
includes/vendor/ontraport/CustomObjects.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class CustomObjects
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class CustomObjects extends Objects
13
+ {
14
+ public function __construct(Ontraport $client, $object)
15
+ {
16
+ parent::__construct($client);
17
+
18
+ $this->_objectID = $object;
19
+ }
20
+
21
+ private $_objectID = NULL;
22
+
23
+ /**
24
+ * @brief Retrieve a single specified object
25
+ *
26
+ * @param mixed[] $requestParams The parameters to submit with GET request.
27
+ * Varies by object.
28
+ *
29
+ * @return string JSON formatted response
30
+ */
31
+ public function retrieveSingle($requestParams)
32
+ {
33
+ $requestParams["objectID"] = $this->_objectID;
34
+ return parent::retrieveSingle($requestParams);
35
+ }
36
+
37
+ /**
38
+ * @brief Retrieve multiple objects according to specific criteria
39
+ *
40
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
41
+ * Varies by object.
42
+ *
43
+ * @return string JSON formatted response.
44
+ */
45
+ public function retrieveMultiple($requestParams)
46
+ {
47
+ $requestParams["objectID"] = $this->_objectID;
48
+ return parent::retrieveMultiple($requestParams);
49
+ }
50
+
51
+ /**
52
+ * @brief Create an object
53
+ *
54
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
55
+ * Varies by object.
56
+ *
57
+ * @return string JSON formatted response
58
+ */
59
+ public function create($requestParams)
60
+ {
61
+ $requestParams["objectID"] = $this->_objectID;
62
+ return parent::create($requestParams);
63
+ }
64
+
65
+ /**
66
+ * @brief Delete a single specified object
67
+ *
68
+ * @param mixed[] $requestParams Array of the parameters to submit with DELETE request.
69
+ * Varies by object.
70
+ *
71
+ * @return string JSON formatted response
72
+ */
73
+ public function deleteSingle($requestParams)
74
+ {
75
+ $requestParams["objectID"] = $this->_objectID;
76
+ return parent::deleteSingle($requestParams);
77
+ }
78
+
79
+ /**
80
+ * @brief Delete multiple objects according to specific criteria
81
+ *
82
+ * @param mixed[] $requestParams The parameters to submit with DELETE request.
83
+ * Varies by object.
84
+ *
85
+ * @return string JSON formatted response
86
+ */
87
+ public function deleteMultiple($requestParams)
88
+ {
89
+ $requestParams["objectID"] = $this->_objectID;
90
+ return parent::deleteMultiple($requestParams);
91
+ }
92
+
93
+ /**
94
+ * @brief Update an object's data
95
+ *
96
+ * @param mixed[] $requestParams The parameters to submit with PUT request.
97
+ * Varies by object.
98
+ *
99
+ * @return string JSON formatted response
100
+ */
101
+ public function update($requestParams)
102
+ {
103
+ $requestParams["objectID"] = $this->_objectID;
104
+ return parent::update($requestParams);
105
+ }
106
+
107
+ /**
108
+ * @brief Retrieve meta for a contact object
109
+ *
110
+ * @return string JSON formatted meta for contact object
111
+ */
112
+ public function retrieveMeta($requestParams = NULL)
113
+ {
114
+ $requestParams["objectID"] = $this->_objectID;
115
+ return parent::retrieveMeta($requestParams);
116
+ }
117
+
118
+ /**
119
+ * @brief Retrieve information (such as number of objects) about a collection
120
+ *
121
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
122
+ * Varies by object.
123
+ *
124
+ * @return string JSON formatted response
125
+ */
126
+ public function retrieveCollectionInfo($requestParams)
127
+ {
128
+ $requestParams["objectID"] = $this->_objectID;
129
+ return parent::retrieveCollectionInfo($requestParams);
130
+ }
131
+ }
includes/vendor/ontraport/Exceptions/OntraportAPIException.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI\Exceptions;
4
+
5
+ /**
6
+ * Class OntraportAPIException
7
+ *
8
+ * @brief Base class of custom exceptions for the ONTRAPORT API wrapper.
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class OntraportAPIException extends \Exception
13
+ {
14
+ public function __construct($message, $code = 0, \Exception $previous = null)
15
+ {
16
+ parent::__construct($message, $code, $previous);
17
+ }
18
+ }
19
+
20
+ /**
21
+ * Class ArrayOperatorException
22
+ *
23
+ * @brief Thrown when using addCondition() to build a condition object comparing a value to an array with a relational
24
+ * operator other than IN.
25
+ *
26
+ * @package OntraportAPI
27
+ */
28
+ class ArrayOperatorException extends OntraportAPIException
29
+ {
30
+ public function __construct()
31
+ {
32
+ parent::__construct("Operator must be \"IN\" if condition object value is an array", 400);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Class ConditionOperatorException
38
+ *
39
+ * @brief Thrown when using addCondition() to build a condition object with a relational operator other than =, <>, >, <,
40
+ * >=, <=, IN, NOT IN, IS, or LIKE
41
+ *
42
+ * @package OntraportAPI
43
+ */
44
+ class ConditionOperatorException extends OntraportAPIException
45
+ {
46
+ public function __construct($operator)
47
+ {
48
+ parent::__construct($operator . " is not a supported logical operator for a condition object.", 400);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Class CustomObjectException
54
+ *
55
+ * @brief Thrown when attempting to create an instance of custom object API with an invalid object type ID.
56
+ *
57
+ * @package OntraportAPI
58
+ */
59
+ class CustomObjectException extends OntraportAPIException
60
+ {
61
+ public function __construct()
62
+ {
63
+ parent::__construct("Invalid object type ID passed to custom object API.", 400);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Class HttpMethodException
69
+ *
70
+ * @brief Thrown when using an HTTP method other than GET, POST, PUT, or DELETE
71
+ *
72
+ * @package OntraportAPI
73
+ */
74
+ class HttpMethodException extends OntraportAPIException
75
+ {
76
+ public function __construct($method)
77
+ {
78
+ parent::__construct($method . " is not a supported HTTP method.", 400);
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Class RequiredParamsException
84
+ *
85
+ * @brief Thrown when attempting to make an HTTP request that is missing parameters required for that request.
86
+ *
87
+ * @package OntraportAPI
88
+ */
89
+ class RequiredParamsException extends OntraportAPIException
90
+ {
91
+ public function __construct($params)
92
+ {
93
+ parent::__construct("Invalid input: missing required parameter(s): $params", 400);
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Class TypeException
99
+ *
100
+ * @brief Thrown when attempting to make an HTTP request passing a data type other than an array.
101
+ *
102
+ * @package OntraportAPI
103
+ */
104
+ class TypeException extends OntraportAPIException
105
+ {
106
+ public function __construct($type)
107
+ {
108
+ parent::__construct("Invalid input: expected array, received $type", 400);
109
+ }
110
+ }
includes/vendor/ontraport/Forms.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Forms
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Forms extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single form
16
+ */
17
+ protected $_endpoint = "Form";
18
+
19
+ /**
20
+ * $var string endpoint for plural forms
21
+ */
22
+ protected $_endpointPlural = "Forms";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /*
33
+ * @TODO: This is just a placeholder, the API needs to be fixed to only use the new endpoint standards
34
+ */
35
+ private $_mainFormEndpoint = "form";
36
+
37
+ // Form specific function endpoint
38
+ const FORM_BLOCKS = "getAllFormBlocks";
39
+ const FORM_BLOCKS_BY_NAME = "getBlocksByFormName";
40
+
41
+ /**
42
+ * @brief Retrieve a single specified form
43
+ *
44
+ * @param mixed[] $requestParams The parameters to submit with GET request.
45
+ * Possible array keys: "id" (required)
46
+ *
47
+ * @return string JSON formatted response
48
+ */
49
+ public function retrieveSingle($requestParams)
50
+ {
51
+ return parent::_retrieveSingle($requestParams);
52
+ }
53
+
54
+ /**
55
+ * @brief Retrieve multiple forms according to specific criteria, handle pagination
56
+ *
57
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
58
+ * are not specified, all will be selected.
59
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
60
+ * "searchNotes","group_ids","performAll","externs","listFields"
61
+ *
62
+ * @return string JSON formatted array of response data: each page of data will be an element in that array
63
+ */
64
+ public function retrieveMultiplePaginated($requestParams)
65
+ {
66
+ return parent::_retrieveMultiplePaginated($requestParams);
67
+ }
68
+
69
+ /**
70
+ * @brief Retrieve multiple forms according to specific criteria
71
+ *
72
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
73
+ * are not specified, all will be selected.
74
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
75
+ * "searchNotes","group_ids","performAll","externs","listFields"
76
+ *
77
+ * @return string JSON formatted response
78
+ */
79
+ public function retrieveMultiple($requestParams)
80
+ {
81
+ return parent::_retrieveMultiple($requestParams);
82
+ }
83
+
84
+ /**
85
+ * @brief Retrieve information (such as number of forms) about form collection
86
+ *
87
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
88
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
89
+ *
90
+ * @return string JSON formatted response
91
+ */
92
+ public function retrieveCollectionInfo($requestParams)
93
+ {
94
+ return parent::_retrieveCollectionInfo($requestParams);
95
+ }
96
+
97
+ /**
98
+ * @brief Retrieve meta for a form object
99
+ *
100
+ * @return string JSON formatted response
101
+ */
102
+ public function retrieveMeta()
103
+ {
104
+ return parent::_retrieveMeta();
105
+ }
106
+
107
+ /**
108
+ * @brief Retrieve HTML for a Smart Form
109
+ *
110
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
111
+ * Possible array keys: "id" (required)
112
+ *
113
+ * @return string JSON formatted response
114
+ */
115
+ public function retrieveSmartFormHTML($requestParams)
116
+ {
117
+ $requiredParams = array("id");
118
+ return $this->client->request($requestParams, $this->_mainFormEndpoint, "get", $requiredParams, $options = NULL);
119
+ }
120
+
121
+ /**
122
+ * @brief Retrieve name and ID pairs for form blocks
123
+ *
124
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
125
+ * Possible array keys: "page"
126
+ *
127
+ * @return string JSON formatted response
128
+ */
129
+ public function retrieveFormBlocks($requestParams = NULL)
130
+ {
131
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::FORM_BLOCKS, "get", NULL, $options = NULL);
132
+ }
133
+
134
+ /**
135
+ * @brief Retrieve name and ID pairs for form blocks
136
+ *
137
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
138
+ * Possible array keys: "page"
139
+ *
140
+ * @return string JSON formatted response
141
+ */
142
+ public function retrieveBlocksByForm($requestParams)
143
+ {
144
+ $requiredParams = array("name");
145
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::FORM_BLOCKS_BY_NAME, "get", $requiredParams, $options = NULL);
146
+ }
147
+ }
includes/vendor/ontraport/LandingPages.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class LandingPages
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class LandingPages extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single landing page
16
+ */
17
+ protected $_endpoint = "LandingPage";
18
+
19
+ /**
20
+ * $var string endpoint for plural landing page
21
+ */
22
+ protected $_endpointPlural = "LandingPages";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /*
33
+ * @TODO This is a placeholder, API needs to be revised to follow one standard for endpoint naming
34
+ */
35
+ private $_mainLandingPageEndpoint = "landingPage";
36
+
37
+ // Landing Page specific function endpoint
38
+ const HOSTED_URL = "getHostedURL";
39
+
40
+ /**
41
+ * @brief Retrieve a single specified landing page
42
+ *
43
+ * @param mixed[] $requestParams The parameters to submit with GET request.
44
+ * Possible array keys: "id" (required)
45
+ *
46
+ * @return string JSON formatted response
47
+ */
48
+ public function retrieveSingle($requestParams)
49
+ {
50
+ return parent::_retrieveSingle($requestParams);
51
+ }
52
+
53
+ /**
54
+ * @brief Retrieve multiple landing pages according to specific criteria, handle pagination
55
+ *
56
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
57
+ * are not specified, all will be selected.
58
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
59
+ * "searchNotes","group_ids","performAll","externs","listFields"
60
+ *
61
+ * @return string JSON formatted array of paginated response data: each page of data will be an element in that array
62
+ */
63
+ public function retrieveMultiplePaginated($requestParams)
64
+ {
65
+ return parent::_retrieveMultiplePaginated($requestParams);
66
+ }
67
+
68
+ /**
69
+ * @brief Retrieve multiple landing pages according to specific criteria
70
+ *
71
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
72
+ * are not specified, all will be selected.
73
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
74
+ * "searchNotes","group_ids","performAll","externs","listFields"
75
+ *
76
+ * @return string JSON formatted response
77
+ */
78
+ public function retrieveMultiple($requestParams)
79
+ {
80
+ return parent::_retrieveMultiple($requestParams);
81
+ }
82
+
83
+ /**
84
+ * @brief Retrieve information (such as number of landing pages) about landing page collection
85
+ *
86
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
87
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
88
+ *
89
+ * @return string JSON formatted response
90
+ */
91
+ public function retrieveCollectionInfo($requestParams)
92
+ {
93
+ return parent::_retrieveCollectionInfo($requestParams);
94
+ }
95
+
96
+ /**
97
+ * @brief Retrieve meta for a landing page object
98
+ *
99
+ * @return string JSON formatted meta for landing page object
100
+ */
101
+ public function retrieveMeta()
102
+ {
103
+ return parent::_retrieveMeta();
104
+ }
105
+
106
+ /**
107
+ * @brief Retrieve the permanent URL for a landing page.
108
+ *
109
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
110
+ * Possible array keys: "id" (required)
111
+ *
112
+ * @return string JSON formatted response
113
+ */
114
+ public function getHostedURL($requestParams)
115
+ {
116
+ $requiredParams = array("id");
117
+ return $this->client->request($requestParams, $this->_mainLandingPageEndpoint . "/" . self::HOSTED_URL, "get", $requiredParams, $options = NULL);
118
+ }
119
+ }
includes/vendor/ontraport/Messages.php ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Messages
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Messages extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single message
16
+ */
17
+ protected $_endpoint = "Message";
18
+
19
+ /**
20
+ * $var string endpoint for plural messages
21
+ */
22
+ protected $_endpointPlural = "Messages";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /*
33
+ * @TODO This is a placeholder, API needs to be revised to follow one standard for endpoint naming
34
+ */
35
+ private $_mainMessageEndpoint = "message";
36
+
37
+ /**
38
+ * @brief Retrieve a single specified message
39
+ *
40
+ * @param mixed[] $requestParams The parameters to submit with GET request.
41
+ * Possible array keys: "id" (required)
42
+ *
43
+ * @return string JSON formatted response
44
+ */
45
+ public function retrieveSingle($requestParams)
46
+ {
47
+ return parent::_retrieveSingle($requestParams);
48
+ }
49
+
50
+ /**
51
+ * @brief Retrieve multiple messages according to specific criteria, handle pagination
52
+ *
53
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
54
+ * are not specified, all will be selected.
55
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
56
+ * "searchNotes","group_ids","performAll","externs","listFields"
57
+ *
58
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
59
+ */
60
+ public function retrieveMultiplePaginated($requestParams)
61
+ {
62
+ return parent::_retrieveMultiplePaginated($requestParams);
63
+ }
64
+
65
+ /**
66
+ * @brief Retrieve multiple messages according to specific criteria
67
+ *
68
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
69
+ * are not specified, all will be selected.
70
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
71
+ * "searchNotes","group_ids","performAll","externs","listFields"
72
+ *
73
+ * @return string JSON formatted response
74
+ */
75
+ public function retrieveMultiple($requestParams)
76
+ {
77
+ return parent::_retrieveMultiple($requestParams);
78
+ }
79
+
80
+ /**
81
+ * @brief Retrieve information (such as number of messages) about message collection
82
+ *
83
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
84
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
85
+ *
86
+ * @return string JSON formatted response
87
+ */
88
+ public function retrieveCollectionInfo($requestParams)
89
+ {
90
+ return parent::_retrieveCollectionInfo($requestParams);
91
+ }
92
+
93
+ /**
94
+ * @brief Retrieve meta for a message object
95
+ *
96
+ * @return string JSON formatted meta for message object
97
+ */
98
+ public function retrieveMeta()
99
+ {
100
+ return parent::_retrieveMeta();
101
+ }
102
+
103
+ /**
104
+ * @brief Create a new message
105
+ *
106
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
107
+ * Possible array keys: "alias","name","subject","type" (must be "template","email",
108
+ * "sms", or "task), "object_type_id" (default 0 for contacts),
109
+ * "from" (can be "owner","custom", or a staff ID), "send_out_name"
110
+ * "reply_to_email","plaintext","send_from","message_body",
111
+ * "email_title"
112
+ * Legacy email only: "message_body"
113
+ * ONTRAmail only: "resource" (use with caution)
114
+ * SMS only: "send_to" (default sms_number)
115
+ * Task only: "task_data","due_date","task_owner","task_form"
116
+ *
117
+ * @return string JSON formatted response
118
+ */
119
+ public function create($requestParams)
120
+ {
121
+ $requiredParams = array("type");
122
+ return $this->client->request($requestParams, $this->_mainMessageEndpoint, "post", $requiredParams, $options = NULL);
123
+ }
124
+
125
+ /**
126
+ * @brief Update an existing message
127
+ *
128
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
129
+ * Possible array keys: "id" (required),"alias","name","subject","type" (must be
130
+ * "template","email", "sms", or "task),"object_type_id"
131
+ * (default 0 for contacts),"from" (can be "owner","custom", or a
132
+ * staff ID), "send_out_name","reply_to_email","plaintext",
133
+ * "send_from","message_body","email_title"
134
+ * Legacy email only: "message_body"
135
+ * ONTRAmail only: "resource" (use with caution)
136
+ * SMS only: "send_to" (default sms_number)
137
+ * Task only: "task_data","due_date","task_owner","task_form"
138
+ *
139
+ * @return string JSON formatted response
140
+ */
141
+ public function update($requestParams)
142
+ {
143
+ $requiredParams = array("id","type");
144
+ return $this->client->request($requestParams, $this->_mainMessageEndpoint, "put", $requiredParams, $options = NULL);
145
+ }
146
+ }
includes/vendor/ontraport/ObjectType.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class ObjectType
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class ObjectType
13
+ {
14
+ const CONTACT = 0;
15
+ const TASK = 1;
16
+ const USER = 2;
17
+ const GROUP = 3;
18
+ const LOG = 4;
19
+ const SEQUENCE = 5;
20
+ const RULE = 6;
21
+ const MESSAGE = 7;
22
+ const SEQUENCE_SUBSCRIBER = 8;
23
+ const NOTE = 12;
24
+ const BLAST = 13;
25
+ const TAG = 14;
26
+ const PRODUCT = 16;
27
+ const PURCHASE = 17;
28
+ const FULFILLMENT = 19;
29
+ const LANDINGPAGE = 20;
30
+ const LEGACY_FORM = 22;
31
+ const QUEUED_MESSAGE = 23;
32
+ const PENDING_MAIL = 27;
33
+ const PURCHASE_LOG = 30;
34
+ const PARTNER_PROGRAM = 35;
35
+ const PARTNER = 36;
36
+ const REFERRAL = 37;
37
+ const COMMISSION = 38;
38
+ const PARTNER_PROMOTIONAL = 40;
39
+ const UPSELL_FORM = 42;
40
+ const WORDPRESS_MEMBERSHIP = 43;
41
+ const OPEN_ORDER = 44;
42
+ const CREDIT_CARD = 45;
43
+ const TRANSACTION = 46;
44
+ const SHIPPED_PACKAGE = 47;
45
+ const SHIPPING_FULFILLMENT = 49;
46
+ const ORDER = 52;
47
+ const FACEBOOK = 53;
48
+ const CUSTOM_DOMAIN = 58;
49
+ const ROLE = 61;
50
+ const TAX = 63;
51
+ const SHIPPING_METHOD = 64;
52
+ const OFFER = 65;
53
+ const TASK_OUTCOME = 66;
54
+ const WORDPRESS = 67;
55
+ const MESSAGE_TEMPLATE = 68;
56
+ const LEAD_ROUTER = 69;
57
+ const GATEWAY = 70;
58
+ const MARKETING_CAMPAIGN = 75;
59
+ const LEAD_SOURCE = 76;
60
+ const MEDIUM = 77;
61
+ const CONTENT = 78;
62
+ const TERM = 79;
63
+ const TRACKED_LINK = 80;
64
+ const PARTNER_PROGRAM_PRODUCT = 87;
65
+ const URL_HISTORY = 88;
66
+ const TASK_NOTE = 89;
67
+ const TASK_HISTORY = 90;
68
+ const SUBSCRIBER_RETENTION_REPORT = 92;
69
+ const SUBSCRIPTION_SALES_REPORT = 93;
70
+ const SALES_REPORT = 94;
71
+ const PRODUCT_SALES_LOG_REPORT = 95;
72
+ const CUSTOMER_VALUE_REPORT = 96;
73
+ const SHIPPING_COLLECTED_REPORT = 97;
74
+ const TAX_REPORT = 98;
75
+ const CUSTOM_OBJECT = 99;
76
+ const AUTOMATION_LOG = 100;
77
+ const CUSTOM_OBJECT_RELATIONSHIP = 102;
78
+ const FORM = 122;
79
+ const COUPON = 123;
80
+ const COUPON_CODE = 124;
81
+ const COUPON_PRODUCTS = 125;
82
+ const TAG_SUBSCRIBER = 138;
83
+ const CAMPAIGN_BUILDER = 140;
84
+ const DELETED_ORDER = 146;
85
+ }
includes/vendor/ontraport/Objects.php ADDED
@@ -0,0 +1,493 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Objects
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Objects extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single object
16
+ */
17
+ protected $_endpoint = "object";
18
+
19
+ /**
20
+ * $var string endpoint for plural object
21
+ */
22
+ protected $_endpointPlural = "objects";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ // Object-specific function endpoints
33
+ const TAG = "tag";
34
+ const TAG_BY_NAME = "tagByName";
35
+ const SEQUENCE = "sequence";
36
+ const PAUSE = "pause";
37
+ const UNPAUSE = "unpause";
38
+ const SUBSCRIBE = "subscribe";
39
+ const GET_BY_EMAIL = "getByEmail";
40
+
41
+ /**
42
+ * @brief Retrieve a single specified object
43
+ *
44
+ * @param $requestParams mixed[] The parameters to submit with GET request.
45
+ * Possible array keys: "id" (required), "objectID" (required)
46
+ *
47
+ * @return string JSON formatted response
48
+ */
49
+ public function retrieveSingle($requestParams)
50
+ {
51
+ $requiredParams = array(
52
+ "id",
53
+ "objectID"
54
+ );
55
+ return $this->client->request($requestParams, $this->_endpoint, "get", $requiredParams, $options = NULL);
56
+ }
57
+
58
+ /**
59
+ * @brief Retrieve multiple objects according to specific criteria, handle pagination
60
+ *
61
+ * @param $requestParams mixed[] Array of parameters to submit with GET request. If "ids"
62
+ * are not specified, all will be selected.
63
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
64
+ * "condition","search","searchNotes","group_ids","performAll",
65
+ * "externs","listFields"
66
+ *
67
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
68
+ */
69
+ public function retrieveMultiplePaginated($requestParams)
70
+ {
71
+ $collection = json_decode($this->retrieveCollectionInfo($requestParams), true);
72
+ $requestParams["start"] = $requestParams["start"] ?: 0;
73
+ $requestParams["range"] = $requestParams["range"] ?: 50;
74
+
75
+ $object_data = array();
76
+ while ($requestParams["start"] < $collection["data"]["count"])
77
+ {
78
+ $object_data[] = json_decode($this->retrieveMultiple($requestParams), true);
79
+ $requestParams["start"] += $requestParams["range"];
80
+ }
81
+ return json_encode($object_data);
82
+ }
83
+
84
+ /**
85
+ * @brief Retrieve multiple objects according to specific criteria
86
+ *
87
+ * @param $requestParams mixed[] Array of parameters to submit with GET request. If "ids"
88
+ * are not specified, all will be selected.
89
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
90
+ * "condition","search","searchNotes","group_ids","performAll",
91
+ * "externs","listFields"
92
+ *
93
+ * @return string JSON formatted response
94
+ */
95
+ public function retrieveMultiple($requestParams)
96
+ {
97
+ $requiredParams = array(
98
+ "objectID"
99
+ );
100
+ return $this->client->request($requestParams, $this->_endpointPlural, "get", $requiredParams , $options = NULL);
101
+ }
102
+
103
+ /**
104
+ * @brief Retrieve all objects of type having a particular tag
105
+ *
106
+ * @param $requestParams mixed[] Array of parameters to submit with GET request. Either "tag_id" or "tag_name" is required.
107
+ * Possible array keys: "objectID" (required),"tag_id","tag_name","start","range","sort","sortDir",
108
+ * "condition","search","searchNotes","group_ids","performAll",
109
+ * "externs","listFields"
110
+ *
111
+ * @return string JSON formatted response
112
+ */
113
+ public function retrieveAllWithTag($requestParams)
114
+ {
115
+ $requiredParams = array(
116
+ "objectID"
117
+ );
118
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::TAG, "get", $requiredParams , $options = NULL);
119
+ }
120
+
121
+ /**
122
+ * @brief Retrieves object ID by email.
123
+ *
124
+ * @param $requestParams mixed[] Array of parameters to submit with GET request.
125
+ * Possible array keys: "objectID" (required),"email" (required)
126
+ *
127
+ * @return string JSON formatted response
128
+ */
129
+ public function retrieveIdByEmail($requestParams)
130
+ {
131
+ $requiredParams = array(
132
+ "objectID",
133
+ "email"
134
+ );
135
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::GET_BY_EMAIL, "get", $requiredParams , $options = NULL);
136
+ }
137
+
138
+ /**
139
+ * @brief Create an object
140
+ *
141
+ * @param $requestParams mixed[] Array of parameters to submit with POST request.
142
+ * Possible array keys: "objectID" (required), other parameters will vary by object type.
143
+ * If you do not know what parameters to use, you may wish to consult our API Reference
144
+ * or make a call to getMeta for the object in question. Invalid parameters passed in
145
+ * will be ignored.
146
+ *
147
+ * @return string JSON formatted response
148
+ */
149
+ public function create($requestParams)
150
+ {
151
+ $requiredParams = array(
152
+ "objectID"
153
+ );
154
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
155
+ return $this->client->request($requestParams, $this->_endpointPlural, "post", $requiredParams, $options);
156
+ }
157
+
158
+ /**
159
+ * @brief Delete a single specified object
160
+ *
161
+ * @param $requestParams mixed[] Array of the parameters to submit with DELETE request.
162
+ * Possible array keys: "id" (required),"objectID" (required)
163
+ *
164
+ * @return string JSON formatted response
165
+ */
166
+ public function deleteSingle($requestParams)
167
+ {
168
+ $requiredParams = array(
169
+ "id",
170
+ "objectID"
171
+ );
172
+ return $this->client->request($requestParams, $this->_endpoint, "delete", $requiredParams, $options = NULL);
173
+ }
174
+
175
+ /**
176
+ * @brief Delete multiple objects according to specific criteria
177
+ *
178
+ * @param $requestParams mixed[] Array of parameters to submit with DELETE request. If "ids"
179
+ * are not specified, all will be selected.
180
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
181
+ * "condition","search","searchNotes","group_ids","performAll",
182
+ * "externs","listFields"
183
+ *
184
+ * @return string JSON formatted response
185
+ */
186
+ public function deleteMultiple($requestParams)
187
+ {
188
+ $requiredParams = array(
189
+ "objectID"
190
+ );
191
+ return $this->client->request($requestParams, $this->_endpointPlural, "delete", $requiredParams, $options = NULL);
192
+ }
193
+
194
+ /**
195
+ * @brief Update an object's data
196
+ *
197
+ * @param $requestParams mixed[] Array of parameters to submit with PUT request.
198
+ * Possible array keys: "objectID" (required), other parameters will vary by object type.
199
+ * If you do not know what parameters to use, you may wish to consult our API Reference
200
+ * or make a call to getMeta for the object in question. Invalid parameters passed in
201
+ * will be ignored.
202
+ *
203
+ * @return string JSON formatted response
204
+ */
205
+ public function update($requestParams)
206
+ {
207
+ $requiredParams = array(
208
+ "objectID"
209
+ );
210
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
211
+ return $this->client->request($requestParams, $this->_endpointPlural, "put", $requiredParams, $options);
212
+ }
213
+
214
+ /**
215
+ * @brief Retrieve meta for objects
216
+ *
217
+ * @param $requestParams mixed[] The parameters to submit with GET request.
218
+ * ObjectID is optional but query will return all objects if not included.
219
+ * Possible array keys: "format","objectID"
220
+ *
221
+ * @return string JSON formatted response
222
+ */
223
+ public function retrieveMeta($requestParams = NULL)
224
+ {
225
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::META, "get", $requiredParams = NULL, $options = NULL);
226
+ }
227
+
228
+ /**
229
+ * @brief Either create an object or merge with an existing object on unique field
230
+ *
231
+ * @param $requestParams mixed[] The parameters to submit with PUT request.
232
+ * Possible array keys: "objectID" (required), other parameters will vary by object type.
233
+ * If you do not know what parameters to use, you may wish to consult our API Reference
234
+ * or make a call to getMeta for the object in question. Invalid parameters passed in
235
+ * will be ignored.
236
+ *
237
+ * @return string JSON formatted response
238
+ */
239
+ public function saveOrUpdate($requestParams)
240
+ {
241
+ $requiredParams = array(
242
+ "objectID"
243
+ );
244
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
245
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SAVE_OR_UPDATE, "post", $requiredParams, $options);
246
+ }
247
+
248
+ /**
249
+ * @brief Retrieve information (such as number of objects) about object collection
250
+ *
251
+ * @param $requestParams mixed[] Array of parameters to submit with GET request.
252
+ * Possible array keys: "objectID" (required),"condition","search","searchNotes",
253
+ * "group_ids","performAll"
254
+ *
255
+ * @return string JSON formatted response
256
+ */
257
+ public function retrieveCollectionInfo($requestParams)
258
+ {
259
+ $requiredParams = array(
260
+ "objectID"
261
+ );
262
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::GET_INFO, "get", $requiredParams, $options = NULL);
263
+ }
264
+
265
+ /**
266
+ * @brief get an array of all custom objects in the account's database.
267
+ *
268
+ * @return array
269
+ */
270
+ public function retrieveCustomObjects()
271
+ {
272
+ $objects = $this->retrieveMeta($requestParams = NULL);
273
+ $objects = json_decode($objects, true);
274
+ $objects = $objects["data"];
275
+
276
+ $customObjects = array();
277
+ foreach ($objects as $id => $data)
278
+ {
279
+ if ($id >= 10000)
280
+ {
281
+ $customObjects[$id] = $data;
282
+ }
283
+ }
284
+
285
+ return $customObjects;
286
+ }
287
+
288
+ /**
289
+ * @brief Pause rules, sequences, and sequence subscribers for one or more objects.
290
+ *
291
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
292
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
293
+ * "condition","search","group_ids","performAll","externs","listFields".
294
+ * Either "ids" or "group_ids" is required.
295
+ *
296
+ * @return string JSON formatted HTTP response
297
+ */
298
+ public function pause($requestParams)
299
+ {
300
+ $requiredParams = array(
301
+ "ids"
302
+ );
303
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
304
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::PAUSE, "post", $requiredParams, $options);
305
+ }
306
+
307
+ /**
308
+ * @brief Unpause rules, sequences, and sequence subscribers for one or more objects.
309
+ *
310
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
311
+ * Possible array keys: "objectID" (required),"ids","start","range","sort","sortDir",
312
+ * "condition","search","group_ids","performAll","externs","listFields".
313
+ * Either "ids" or "group_ids" is required.
314
+ *
315
+ * @return string JSON formatted HTTP response
316
+ */
317
+ public function unpause($requestParams)
318
+ {
319
+ $requiredParams = array(
320
+ "ids"
321
+ );
322
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
323
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::UNPAUSE, "post", $requiredParams, $options);
324
+ }
325
+
326
+ /**
327
+ * @brief Remove one or more objects from one or more sequences
328
+ *
329
+ * @param mixed[] $requestParams Array of parameters to submit with DELETE request.
330
+ * Possible array keys: "objectID" (required),"remove_list" (required),"ids","start",
331
+ * "range","sort","sortDir","condition","search","searchNotes",
332
+ * "group_ids","performAll","externs","listFields".
333
+ * Either "ids" or "group_ids" is required.
334
+ *
335
+ * @return string JSON formatted HTTP response
336
+ */
337
+ public function removeFromSequence($requestParams)
338
+ {
339
+ $requiredParams = array(
340
+ "remove_list",
341
+ "ids"
342
+ );
343
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
344
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SEQUENCE, "delete", $requiredParams, $options);
345
+ }
346
+
347
+ /**
348
+ * @brief Add one or more objects to one or more sequences
349
+ *
350
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
351
+ * Possible array keys: "objectID" (required),"remove_list" (required),"ids","start",
352
+ * "range","sort","sortDir","condition","search","searchNotes",
353
+ * "group_ids","performAll","externs","listFields".
354
+ * Either "ids" or "group_ids" is required.
355
+ *
356
+ * @return string JSON formatted HTTP response
357
+ */
358
+ public function addToSequence($requestParams)
359
+ {
360
+ $requiredParams = array(
361
+ "add_list",
362
+ "ids"
363
+ );
364
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
365
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SEQUENCE, "put", $requiredParams, $options);
366
+ }
367
+
368
+ /**
369
+ * @brief Add one or more tags to one or more objects
370
+ *
371
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
372
+ * Possible array keys: "objectID" (required),"add_list" (required),"ids","start",
373
+ * "range","sort","sortDir","condition","search","searchNotes",
374
+ * "group_ids","performAll","externs","listFields".
375
+ * Either "ids" or "group_ids" is required.
376
+ *
377
+ * @return string JSON formatted HTTP response
378
+ */
379
+ public function addTag($requestParams)
380
+ {
381
+ $requiredParams = array(
382
+ "add_list",
383
+ "ids"
384
+ );
385
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
386
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::TAG, "put", $requiredParams, $options);
387
+ }
388
+
389
+ /**
390
+ * @brief Remove one or more tags from one or more objects
391
+ *
392
+ * @param mixed[] $requestParams Array of parameters to submit with DELETE request.
393
+ * Possible array keys: "objectID" (required),"remove_list" (required),"ids","start",
394
+ * "range","sort","sortDir","condition","search","searchNotes",
395
+ * "group_ids","performAll","externs","listFields".
396
+ * Either "ids" or "group_ids" is required.
397
+ *
398
+ * @return string JSON formatted HTTP response
399
+ */
400
+ public function removeTag($requestParams)
401
+ {
402
+ $requiredParams = array(
403
+ "remove_list",
404
+ "ids"
405
+ );
406
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
407
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::TAG, "delete", $requiredParams, $options);
408
+ }
409
+
410
+ /**
411
+ * @brief Add one or more tags to one or more objects by tag name (create tag if it doesn't exist)
412
+ *
413
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
414
+ * Possible array keys: "objectID" (required),"add_names" (required),"ids","start",
415
+ * "range","sort","sortDir","condition","search","searchNotes",
416
+ * "group_ids","performAll","externs","listFields".
417
+ * Either "ids" or "group_ids" is required.
418
+ *
419
+ * @return string JSON formatted HTTP response
420
+ */
421
+ public function addTagByName($requestParams)
422
+ {
423
+ $requiredParams = array(
424
+ "add_names",
425
+ "ids"
426
+ );
427
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
428
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::TAG_BY_NAME, "put", $requiredParams, $options);
429
+ }
430
+
431
+ /**
432
+ * @brief Remove one or more tags from one or more objects by tag name
433
+ *
434
+ * @param mixed[] $requestParams Array of parameters to submit with DELETE request.
435
+ * Possible array keys: "objectID" (required),"remove_names" (required),"ids","start",
436
+ * "range","sort","sortDir","condition","search","searchNotes",
437
+ * "group_ids","performAll","externs","listFields".
438
+ * Either "ids" or "group_ids" is required.
439
+ *
440
+ * @return string JSON formatted HTTP response
441
+ */
442
+ public function removeTagByName($requestParams)
443
+ {
444
+ $requiredParams = array(
445
+ "remove_names",
446
+ "ids"
447
+ );
448
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
449
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::TAG_BY_NAME, "delete", $requiredParams, $options);
450
+ }
451
+
452
+ /**
453
+ * @brief Add one or more objects to one or more campaigns or sequences
454
+ *
455
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
456
+ * Possible array keys: "objectID" (required),"add_list" (required),"ids",
457
+ * "sub_type" (default: campaign), "start","range","sort",
458
+ * "sortDir","condition","search","searchNotes","group_ids",
459
+ * "performAll","externs","listFields".
460
+ *
461
+ * @return string JSON formatted HTTP response
462
+ */
463
+ public function subscribe($requestParams)
464
+ {
465
+ $requiredParams = array(
466
+ "add_list",
467
+ "ids"
468
+ );
469
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
470
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SUBSCRIBE, "put", $requiredParams, $options);
471
+ }
472
+
473
+ /**
474
+ * @brief Remove one or more objects from one or more campaigns or sequences
475
+ *
476
+ * @param mixed[] $requestParams Array of parameters to submit with DELETE request.
477
+ * Possible array keys: "objectID" (required),"remove_list" (required),"ids",
478
+ * "sub_type" (default: campaign), "start","range","sort",
479
+ * "sortDir","condition","search","searchNotes","group_ids",
480
+ * "performAll","externs","listFields".
481
+ *
482
+ * @return string JSON formatted HTTP response
483
+ */
484
+ public function unsubscribe($requestParams)
485
+ {
486
+ $requiredParams = array(
487
+ "remove_list",
488
+ "ids"
489
+ );
490
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
491
+ return $this->client->request($requestParams, $this->_endpointPlural . "/" . self::SUBSCRIBE, "delete", $requiredParams, $options);
492
+ }
493
+ }
includes/vendor/ontraport/Ontraport.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ require_once("APIAutoloader.php");
6
+
7
+ /**
8
+ * Class Ontraport
9
+ *
10
+ * @author ONTRAPORT
11
+ *
12
+ * @package OntraportAPI
13
+ */
14
+ class Ontraport
15
+ {
16
+ /**
17
+ * @var string the base URL HTTP requests are made to
18
+ */
19
+ const REQUEST_URL = "https://api.ontraport.com";
20
+
21
+ /**
22
+ * @var int the API version number for this wrapper
23
+ */
24
+ const API_VERSION = 1;
25
+
26
+ /**
27
+ * @var string unique site id for API
28
+ */
29
+ private $_siteID;
30
+
31
+ /**
32
+ * @var int unique API key
33
+ */
34
+ private $_apiKey;
35
+
36
+ /**
37
+ * @var array contains all instantiated object APIs so multiple instances can be avoided
38
+ */
39
+ protected $_apiInstances = array();
40
+
41
+ /**
42
+ * @var array contains list of current custom objects so they don't need to be searched for more than once
43
+ */
44
+ protected $_customObjects = array();
45
+
46
+ /**
47
+ * @var CurlClient instance
48
+ */
49
+ protected $_httpClient = NULL;
50
+
51
+ /**
52
+ * @brief constructs an instance of OntraportAPI
53
+ *
54
+ * @param string $siteID
55
+ * @param string $apiKey
56
+ */
57
+ public function __construct($siteID, $apiKey, $httpClient = null)
58
+ {
59
+ $this->setCredentials($apiKey, $siteID);
60
+ $this->setHttpClient($httpClient);
61
+ }
62
+
63
+ /**
64
+ * @brief sets API key credential
65
+ *
66
+ * @param string $apiKey
67
+ */
68
+ public function setCredentials($apiKey, $siteID)
69
+ {
70
+ $this->_apiKey = $apiKey;
71
+ $this->_siteID = $siteID;
72
+ }
73
+
74
+ /**
75
+ * @brief sets HTTP client
76
+ */
77
+ public function setHttpClient($httpClient = null)
78
+ {
79
+ if ($httpClient === null)
80
+ {
81
+ $this->_httpClient = new CurlClient($this->_apiKey, $this->_siteID);
82
+ return;
83
+ }
84
+ $this->_httpClient = $httpClient;
85
+ }
86
+
87
+ /**
88
+ * @brief gets HTTP client
89
+ */
90
+ public function getHttpClient()
91
+ {
92
+ return $this->_httpClient;
93
+ }
94
+
95
+ /**
96
+ * @brief Make an HTTP request
97
+ *
98
+ * @param $requestParams
99
+ * @param string $url
100
+ * @param string $method
101
+ * @param array $requiredParams
102
+ * @param array $options
103
+ *
104
+ * @return mixed
105
+ */
106
+ public function request($requestParams, $url, $method, $requiredParams, $options)
107
+ {
108
+ $client = $this->getHttpClient();
109
+ $url = $this->buildEndpoint($url);
110
+
111
+ return $client->httpRequest($requestParams, $url, $method, $requiredParams, $options);
112
+ }
113
+
114
+ /**
115
+ * @brief gets the last HTTP status code received by the HTTP Client
116
+ *
117
+ * @return int
118
+ */
119
+ public function getLastStatusCode()
120
+ {
121
+ return $this->getHttpClient()->getLastStatusCode();
122
+ }
123
+
124
+ /**
125
+ * @brief constructs an api endpoint
126
+ *
127
+ * @param string $extendURL
128
+ * @param string $function
129
+ *
130
+ * @return string
131
+ */
132
+ public function buildEndpoint($extendURL)
133
+ {
134
+ return self::REQUEST_URL . "/" . self::API_VERSION . "/" . $extendURL;
135
+ }
136
+
137
+ /**
138
+ * @param integer $object
139
+ *
140
+ * @return CustomObjects instance
141
+ *
142
+ * @throws Exceptions\CustomObjectException
143
+ */
144
+ public function custom($object)
145
+ {
146
+ if (empty($this->_customObjects))
147
+ {
148
+ $this->_customObjects = $this->object()->retrieveCustomObjects();
149
+ }
150
+
151
+ if (array_key_exists($object, $this->_customObjects))
152
+ {
153
+ return $this->getApi("CustomObjects", $object);
154
+ }
155
+ throw new Exceptions\CustomObjectException();
156
+ }
157
+
158
+ /**
159
+ * @return CampaignBuilderItems
160
+ */
161
+ public function campaignbuilder()
162
+ {
163
+ return $this->getApi("CampaignBuilderItems");
164
+ }
165
+
166
+ /**
167
+ * @return Contacts
168
+ */
169
+ public function contact()
170
+ {
171
+ return $this->getApi("Contacts");
172
+ }
173
+
174
+ /**
175
+ * @return CreditCards
176
+ */
177
+ public function creditcard()
178
+ {
179
+ return $this->getApi("CreditCards");
180
+ }
181
+
182
+ /**
183
+ * @return Forms
184
+ */
185
+ public function form()
186
+ {
187
+ return $this->getApi("Forms");
188
+ }
189
+
190
+ /**
191
+ * @return LandingPages
192
+ */
193
+ public function landingpage()
194
+ {
195
+ return $this->getApi("LandingPages");
196
+ }
197
+
198
+ /**
199
+ * @return Messages
200
+ */
201
+ public function message()
202
+ {
203
+ return $this->getApi("Messages");
204
+ }
205
+
206
+ /**
207
+ * @return Tasks
208
+ */
209
+ public function task()
210
+ {
211
+ return $this->getApi("Tasks");
212
+ }
213
+
214
+ /**
215
+ * @return Transactions
216
+ */
217
+ public function transaction()
218
+ {
219
+ return $this->getApi("Transactions");
220
+ }
221
+
222
+ /**
223
+ * @return Objects
224
+ */
225
+ public function object()
226
+ {
227
+ return $this->getApi("Objects");
228
+ }
229
+
230
+ /**
231
+ * @return Webhooks
232
+ */
233
+ public function webhook()
234
+ {
235
+ return $this->getApi("Webhooks");
236
+ }
237
+
238
+ /**
239
+ * @brief if requested API is already instantiated, grabs instance from an array, otherwise autoloads an instance of the API
240
+ * @param string $class
241
+ * @param integer|null $object
242
+ *
243
+ * @return mixed
244
+ */
245
+ public function getApi($class, $object = NULL)
246
+ {
247
+ $absoluteClass = "\\OntraportAPI\\" . $class;
248
+
249
+ // For custom objects
250
+ if ($object)
251
+ {
252
+ // Generate a unique name so that wrong object id is not stored with instantiated class
253
+ $class = $class . "." . $object;
254
+ if (!array_key_exists($class, $this->_apiInstances))
255
+ {
256
+ $this->_apiInstances[$class] = new $absoluteClass($this, $object);
257
+ }
258
+ }
259
+
260
+ else
261
+ {
262
+ if (!array_key_exists($class, $this->_apiInstances))
263
+ {
264
+ $this->_apiInstances[$class] = new $absoluteClass($this);
265
+ }
266
+ }
267
+
268
+ return $this->_apiInstances[$class];
269
+ }
270
+ }
includes/vendor/ontraport/Tasks.php ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Tasks
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Tasks extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single task
16
+ */
17
+ protected $_endpoint = "Task";
18
+
19
+ /**
20
+ * $var string endpoint for plural tasks
21
+ */
22
+ protected $_endpointPlural = "Tasks";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ /*
33
+ * @TODO: This is just a placeholder, the API needs to be fixed to only use the new endpoint standards
34
+ */
35
+ private $_mainTaskEndpoint = "task";
36
+
37
+ // Task-specific function endpoints
38
+ const TASK_ASSIGN = "assign";
39
+ const TASK_CANCEL = "cancel";
40
+ const TASK_COMPLETE = "complete";
41
+ const TASK_RESCHEDULE = "reschedule";
42
+
43
+ /**
44
+ * @brief Retrieve a single specified task
45
+ *
46
+ * @param mixed[] $requestParams The parameters to submit with GET request.
47
+ * Possible array keys: "id" (required)
48
+ *
49
+ * @return string JSON formatted response
50
+ */
51
+ public function retrieveSingle($requestParams)
52
+ {
53
+ return parent::_retrieveSingle($requestParams);
54
+ }
55
+
56
+ /**
57
+ * @brief Retrieve multiple tasks according to specific criteria, handle pagination
58
+ *
59
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
60
+ * are not specified, all will be selected.
61
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
62
+ * "searchNotes","group_ids","performAll","externs","listFields"
63
+ *
64
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
65
+ */
66
+ public function retrieveMultiplePaginated($requestParams)
67
+ {
68
+ return parent::_retrieveMultiplePaginated($requestParams);
69
+ }
70
+
71
+ /**
72
+ * @brief Retrieve multiple tasks according to specific criteria
73
+ *
74
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
75
+ * are not specified, all will be selected.
76
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
77
+ * "searchNotes","group_ids","performAll","externs","listFields"
78
+ *
79
+ * @return string JSON formatted response
80
+ */
81
+ public function retrieveMultiple($requestParams)
82
+ {
83
+ return parent::_retrieveMultiple($requestParams);
84
+ }
85
+
86
+ /**
87
+ * @brief Update a task's data
88
+ *
89
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
90
+ * Possible array keys: "id" (required),"owner","date_due","status"
91
+ *
92
+ * @return string JSON formatted response
93
+ */
94
+ public function update($requestParams)
95
+ {
96
+ return parent::_update($requestParams);
97
+ }
98
+
99
+ /**
100
+ * @brief Retrieve information (such as number of tasks) about task collection
101
+ *
102
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
103
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
104
+ *
105
+ * @return string JSON formatted response
106
+ */
107
+ public function retrieveCollectionInfo($requestParams)
108
+ {
109
+ return parent::_retrieveCollectionInfo($requestParams);
110
+ }
111
+
112
+ /**
113
+ * @brief Retrieve meta for a task object
114
+ *
115
+ * @return string JSON formatted meta for task object
116
+ */
117
+ public function retrieveMeta()
118
+ {
119
+ return parent::_retrieveMeta();
120
+ }
121
+
122
+ /**
123
+ * @brief Assign a task to one or more contacts
124
+ *
125
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
126
+ * Possible array keys: "object_type_id" (required),"ids" (required),"group_ids",
127
+ * "performAll","message"
128
+ *
129
+ * @return string JSON formatted response
130
+ */
131
+ public function assign($requestParams)
132
+ {
133
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
134
+ $requiredParams = array(
135
+ "object_type_id",
136
+ "ids"
137
+ );
138
+ return $this->client->request($requestParams, $this->_mainTaskEndpoint . "/" . self::TASK_ASSIGN, "post", $requiredParams, $options);
139
+ }
140
+
141
+ /**
142
+ * @brief Cancel a task or list of tasks
143
+ *
144
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
145
+ * Possible array keys: "objectID" (required),"ids","start","range","condition","search","searchNotes",
146
+ * "group_ids","performAll"
147
+ *
148
+ * @return string JSON formatted response
149
+ */
150
+ public function cancel($requestParams)
151
+ {
152
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
153
+ $requiredParams = array("objectID");
154
+ return $this->client->request($requestParams, $this->_mainTaskEndpoint . "/" . self::TASK_CANCEL, "post", $requiredParams, $options);
155
+ }
156
+
157
+ /**
158
+ * @brief Marks one or more tasks as completed
159
+ *
160
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
161
+ * Possible array keys: "object_type_id" (required),"ids","group_ids","performAll","data"
162
+ *
163
+ * @return string JSON formatted response
164
+ */
165
+ public function complete($requestParams)
166
+ {
167
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
168
+ $requiredParams = array("object_type_id");
169
+ return $this->client->request($requestParams, $this->_mainTaskEndpoint."/". self::TASK_COMPLETE, "post", $requiredParams, $options);
170
+ }
171
+
172
+ /**
173
+ * @brief Reschedules a task
174
+ *
175
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
176
+ * Possible array keys: "id" (required),"newtime"
177
+ *
178
+ * @return string JSON formatted response
179
+ */
180
+ public function reschedule($requestParams)
181
+ {
182
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
183
+ $requiredParams = array("id");
184
+ return $this->client->request($requestParams, $this->_mainTaskEndpoint . "/" . self::TASK_RESCHEDULE, "post", $requiredParams, $options);
185
+ }
186
+ }
includes/vendor/ontraport/Transactions.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Transactions
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Transactions extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single transaction
16
+ */
17
+ protected $_endpoint = "Transaction";
18
+
19
+ /**
20
+ * $var string endpoint for plural transactions
21
+ */
22
+ protected $_endpointPlural = "Transactions";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ // Transaction-specific function endpoints
33
+ const CONVERT_COLLECTIONS = "convertToCollections";
34
+ const CONVERT_DECLINE = "convertToDecline";
35
+ const MARK_PAID = "markPaid";
36
+ const ORDER = "order";
37
+ const PROCESS_MANUAL = "processManual";
38
+ const REFUND = "refund";
39
+ const RERUN = "rerun";
40
+ const RERUN_COMMISSION = "rerunCommission";
41
+ const RESEND_INVOICE = "resendInvoice";
42
+ const VOID = "void";
43
+ const WRITE_OFF = "writeOff";
44
+
45
+ /**
46
+ * @TODO: This is a placeholder, API needs to be changed to follow one standard for naming endpoints
47
+ */
48
+ private $_mainTransactionEndpoint = "transaction";
49
+
50
+ /**
51
+ * @brief Retrieve a single specified transaction
52
+ *
53
+ * @param mixed[] $requestParams The parameters to submit with GET request.
54
+ * Possible array keys: "id" (required)
55
+ *
56
+ * @return string JSON formatted HTTP response
57
+ */
58
+ public function retrieveSingle($requestParams)
59
+ {
60
+ return parent::_retrieveSingle($requestParams);
61
+ }
62
+
63
+ /**
64
+ * @brief Retrieve multiple transactions according to specific criteria, handle pagination
65
+ *
66
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
67
+ * are not specified, all will be selected.
68
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
69
+ * "searchNotes","group_ids","performAll","externs","listFields"
70
+ *
71
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
72
+ */
73
+ public function retrieveMultiplePaginated($requestParams)
74
+ {
75
+ return parent::_retrieveMultiplePaginated($requestParams);
76
+ }
77
+
78
+ /**
79
+ * @brief Retrieve multiple transactions according to specific criteria
80
+ *
81
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
82
+ * are not specified, all will be selected.
83
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
84
+ * "searchNotes","group_ids","performAll","externs","listFields"
85
+ *
86
+ * @return string JSON formatted HTTP response
87
+ */
88
+ public function retrieveMultiple($requestParams)
89
+ {
90
+ return parent::_retrieveMultiple($requestParams);
91
+ }
92
+
93
+ /**
94
+ * @brief Retrieve information (such as number of transactions) about transaction collection
95
+ *
96
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional.
97
+ * Possible array keys: "condition","search","searchNotes","group_ids","performAll"
98
+ *
99
+ * @return string JSON formatted HTTP response
100
+ */
101
+ public function retrieveCollectionInfo($requestParams)
102
+ {
103
+ return parent::_retrieveCollectionInfo($requestParams);
104
+ }
105
+
106
+ /**
107
+ * @brief Retrieve meta for a transaction object
108
+ *
109
+ * @return string JSON formatted meta for transaction object
110
+ */
111
+ public function retrieveMeta()
112
+ {
113
+ return parent::_retrieveMeta();
114
+ }
115
+
116
+ /**
117
+ * @brief Convert the status of one or more transactions to collections
118
+ *
119
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
120
+ * Possible array keys: "id" (required)
121
+ *
122
+ * @return string JSON formatted HTTP response
123
+ */
124
+ public function convertToCollections($requestParams)
125
+ {
126
+ $requiredParams = array("id");
127
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
128
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::CONVERT_COLLECTIONS, "put", $requiredParams, $options);
129
+ }
130
+
131
+ /**
132
+ * @brief Convert the status of one or more transactions to declined
133
+ *
134
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
135
+ * Possible array keys: "id" (required)
136
+ *
137
+ * @return string JSON formatted HTTP response
138
+ */
139
+ public function convertToDeclined($requestParams)
140
+ {
141
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
142
+ $requiredParams = array("id");
143
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::CONVERT_DECLINE, "put", $requiredParams, $options);
144
+ }
145
+
146
+ /**
147
+ * @brief Mark a transaction as paid
148
+ *
149
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
150
+ * Possible array keys: "id" (required)
151
+ *
152
+ * @return string JSON formatted HTTP response
153
+ */
154
+ public function markAsPaid($requestParams)
155
+ {
156
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_FORM);
157
+ $requiredParams = array("id");
158
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::MARK_PAID, "put", $requiredParams, $options);
159
+ }
160
+
161
+ /**
162
+ * @brief Retrieve information about an order
163
+ *
164
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
165
+ * Possible array keys: "id" (required)
166
+ *
167
+ * @return string JSON formatted HTTP response
168
+ */
169
+ public function retrieveOrder($requestParams)
170
+ {
171
+ $requiredParams = array("id");
172
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::ORDER, "get", $requiredParams, $options = NULL);
173
+ }
174
+
175
+ /**
176
+ * @brief Update order information
177
+ *
178
+ * @param mixed[] $requestParams Array of parameters to submit with GET request.
179
+ * Possible array keys: "id" (required)
180
+ *
181
+ * @return string JSON formatted HTTP response
182
+ */
183
+ public function updateOrder($requestParams)
184
+ {
185
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
186
+ $requiredParams = array("offer");
187
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::ORDER, "put", $requiredParams, $options);
188
+ }
189
+
190
+ /**
191
+ * @brief Create a transaction for a contact
192
+ *
193
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
194
+ * Possible array keys: "contact_id" (required),"chargeNow" (required),"trans_date",
195
+ * "invoice_template" (required),"gateway_id (required),"offer" (required),
196
+ * "billing_address","payer"
197
+ *
198
+ * @return string JSON formatted HTTP response
199
+ */
200
+ public function processManual($requestParams)
201
+ {
202
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
203
+ $requiredParams = array(
204
+ "contact_id",
205
+ "chargeNow",
206
+ "offer"
207
+ );
208
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::PROCESS_MANUAL, "post", $requiredParams, $options);
209
+ }
210
+
211
+ /**
212
+ * @brief Refund one or more transactions
213
+ *
214
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
215
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
216
+ * "performAll","search","searchNotes"
217
+ *
218
+ * @return string JSON formatted response
219
+ */
220
+ public function refund($requestParams)
221
+ {
222
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
223
+ $requiredParams = array("objectID");
224
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::REFUND, "put", $requiredParams, $options);
225
+ }
226
+
227
+ /**
228
+ * @brief Rerun a single transaction or a group of transactions in collections
229
+ *
230
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
231
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
232
+ * "performAll","search","searchNotes"
233
+ *
234
+ * @return string JSON formatted response
235
+ */
236
+ public function rerun($requestParams)
237
+ {
238
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
239
+ $requiredParams = array("objectID");
240
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::RERUN, "post", $requiredParams, $options);
241
+ }
242
+
243
+ /**
244
+ * @brief Rerun a partner commission
245
+ *
246
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
247
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
248
+ * "performAll","search","searchNotes"
249
+ *
250
+ * @return string JSON formatted response
251
+ */
252
+ public function rerunCommission($requestParams)
253
+ {
254
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
255
+ $requiredParams = array("objectID");
256
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::RERUN_COMMISSION, "put", $requiredParams, $options);
257
+ }
258
+
259
+ /**
260
+ * @brief Resend a transaction invoice
261
+ *
262
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
263
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
264
+ * "performAll","search","searchNotes"
265
+ *
266
+ * @return string JSON formatted response
267
+ */
268
+ public function resendInvoice($requestParams)
269
+ {
270
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
271
+ $requiredParams = array("objectID");
272
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::RESEND_INVOICE, "post", $requiredParams, $options);
273
+ }
274
+
275
+ /**
276
+ * @brief Void one or more transactions
277
+ *
278
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
279
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
280
+ * "performAll","search","searchNotes"
281
+ *
282
+ * @return string JSON formatted response
283
+ */
284
+ public function void($requestParams)
285
+ {
286
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
287
+ $requiredParams = array("objectID");
288
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::VOID, "put", $requiredParams, $options);
289
+ }
290
+
291
+ /**
292
+ * @brief Write off one or more transactions
293
+ *
294
+ * @param mixed[] $requestParams Array of parameters to submit with PUT request.
295
+ * Possible array keys: "objectID" (required),"ids","condition","start","range","group_ids",
296
+ * "performAll","search","searchNotes"
297
+ *
298
+ * @return string JSON formatted response
299
+ */
300
+ public function writeOff($requestParams)
301
+ {
302
+ $options["headers"] = self::retrieveContentTypeHeader(self::CONTENT_TYPE_JSON);
303
+ $requiredParams = array("objectID");
304
+ return $this->client->request($requestParams, $this->_mainTransactionEndpoint . "/" . self::WRITE_OFF, "put", $requiredParams, $options);
305
+ }
306
+ }
includes/vendor/ontraport/Webhooks.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace OntraportAPI;
4
+
5
+ /**
6
+ * Class Webhooks
7
+ *
8
+ * @author ONTRAPORT
9
+ *
10
+ * @package OntraportAPI
11
+ */
12
+ class Webhooks extends BaseApi
13
+ {
14
+ /**
15
+ * $var string endpoint for single contact
16
+ */
17
+ protected $_endpoint = "Webhook";
18
+
19
+ /**
20
+ * $var string endpoint for plural contacts
21
+ */
22
+ protected $_endpointPlural = "Webhooks";
23
+
24
+ /**
25
+ * @param Ontraport $client
26
+ */
27
+ public function __construct(Ontraport $client)
28
+ {
29
+ parent::__construct($client);
30
+ }
31
+
32
+ // Webhook-specific function endpoints
33
+ const SUBSCRIBE = "subscribe";
34
+ const UNSUBSCRIBE = "unsubscribe";
35
+
36
+ /**
37
+ * @brief Retrieve a single specified webhook
38
+ *
39
+ * @param mixed[] $requestParams The parameters to submit with GET request.
40
+ * Possible array keys: "id" (required)
41
+ *
42
+ * @return string JSON formatted response
43
+ */
44
+ public function retrieveSingle($requestParams)
45
+ {
46
+ return parent::_retrieveSingle($requestParams);
47
+ }
48
+
49
+ /**
50
+ * @brief Retrieve multiple webhooks according to specific criteria, handle pagination
51
+ *
52
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
53
+ * are not specified, all will be selected.
54
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
55
+ * "searchNotes","group_ids","performAll","externs","listFields"
56
+ *
57
+ * @return string JSON formatted array of response data: each page of data will be an element in that array.
58
+ */
59
+ public function retrieveMultiplePaginated($requestParams)
60
+ {
61
+ return parent::_retrieveMultiplePaginated($requestParams);
62
+ }
63
+
64
+ /**
65
+ * @brief Retrieve multiple webhooks according to specific criteria
66
+ *
67
+ * @param mixed[] $requestParams Array of parameters to submit with GET request. All parameters are optional but if "ids"
68
+ * are not specified, all will be selected.
69
+ * Possible array keys: "ids","start","range","sort","sortDir","condition","search",
70
+ * "searchNotes","group_ids","performAll","externs","listFields"
71
+ *
72
+ * @return string JSON formatted response
73
+ */
74
+ public function retrieveMultiple($requestParams)
75
+ {
76
+ return parent::_retrieveMultiple($requestParams);
77
+ }
78
+
79
+ /**
80
+ * @brief Subscribe to a webhook.
81
+ *
82
+ * @param mixed[] $requestParams Array of parameters to submit with POST request.
83
+ * Possible array keys: "event" (required), "url" (required), "data"
84
+ *
85
+ * @return string JSON formatted response
86
+ */
87
+ public function subscribe($requestParams)
88
+ {
89
+ $requiredParams = array("event","url");
90
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::SUBSCRIBE, "post", $requiredParams, $options = NULL);
91
+ }
92
+
93
+ /**
94
+ * @brief Unsubscribe from a webhook.
95
+ *
96
+ * @param mixed[] $requestParams Array of parameters to submit with DELETE request.
97
+ * Possible array keys: "id" (required)
98
+ *
99
+ * @return string JSON formatted response
100
+ */
101
+ public function unsubscribe($requestParams)
102
+ {
103
+ $requiredParams = array("id");
104
+ return $this->client->request($requestParams, $this->_endpoint . "/" . self::UNSUBSCRIBE, "delete", $requiredParams, $options = NULL);
105
+ }
106
+ }
js/fl-builder.js CHANGED
@@ -701,7 +701,7 @@
701
  $('body').delegate('.fl-builder-alert-close', 'click', FLBuilder._alertClose);
702
 
703
  /* General Overlays */
704
- $('body').delegate('.fl-block-overlay', 'contextmenu', FLBuilder._removeAllOverlays);
705
 
706
  /* Rows */
707
  $('body').delegate('.fl-row-overlay .fl-block-remove', 'click', FLBuilder._deleteRowClicked);
@@ -873,6 +873,21 @@
873
  content.undelegate('.fl-module', 'mouseleave', FLBuilder._moduleMouseleave);
874
  },
875
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  /**
877
  * Prevents the default action for an event.
878
  *
@@ -2816,7 +2831,9 @@
2816
  // Build the menu if we have overflow items.
2817
  if ( overflowItems.length > 0 ) {
2818
 
2819
- overflowItems.unshift( visibleItems.pop().remove() );
 
 
2820
 
2821
  for( i = 0; i < overflowItems.length; i++ ) {
2822
 
701
  $('body').delegate('.fl-builder-alert-close', 'click', FLBuilder._alertClose);
702
 
703
  /* General Overlays */
704
+ $('body').delegate('.fl-block-overlay', 'contextmenu', FLBuilder._onContextmenu);
705
 
706
  /* Rows */
707
  $('body').delegate('.fl-row-overlay .fl-block-remove', 'click', FLBuilder._deleteRowClicked);
873
  content.undelegate('.fl-module', 'mouseleave', FLBuilder._moduleMouseleave);
874
  },
875
 
876
+ /**
877
+ * Hides overlays when the contextmenu event is fired on them.
878
+ * This allows us to inspect the actual node in the console
879
+ * instead of getting the overlay.
880
+ *
881
+ * @since 2.2
882
+ * @access private
883
+ * @method _onContextmenu
884
+ * @param {Object} e The event object.
885
+ */
886
+ _onContextmenu: function( e )
887
+ {
888
+ $( this ).hide();
889
+ },
890
+
891
  /**
892
  * Prevents the default action for an event.
893
  *
2831
  // Build the menu if we have overflow items.
2832
  if ( overflowItems.length > 0 ) {
2833
 
2834
+ if( visibleItems.length > 0 ) {
2835
+ overflowItems.unshift( visibleItems.pop().remove() );
2836
+ }
2837
 
2838
  for( i = 0; i < overflowItems.length; i++ ) {
2839
 
js/fl-builder.min.js CHANGED
@@ -1,9 +1,9 @@
1
- var FLBuilderColorPicker;!function(e,t){function i(){var t,i,l="backgroundImage";h?f="filter":(t=e('<div id="iris-gradtest" />'),i="linear-gradient(top,#fff,#000)",e.each(g,function(e,o){if(t.css(l,o+i),t.css(l).match("gradient"))return f=e,!1}),f===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(f="webkit")),t.remove())}function l(t,i){return t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),"webkit"===f?s(t,i):g[f]+"linear-gradient("+t+", "+i.join(", ")+")"}function o(t,i){var l,o,s,r,a,d,u,c,h;t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),l="top"===t?0:1,o=e(this),s=i.length-1,r="filter",a=1===l?"left":"top",d=1===l?"right":"bottom",u=1===l?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+r+':%filter%;" data-color:"%color%"></div>',h="","static"===o.css("position")&&o.css({position:"relative"}),i=n(i),e.each(i,function(e,t){var o,n,r;return e!==s&&(o=i[e+1],void(t.stop!==o.stop&&(n=100-parseFloat(o.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),o.octoHex=new Color(o.color).toIEOctoHex(),r="progid:DXImageTransform.Microsoft.Gradient(GradientType="+l+", StartColorStr='"+t.octoHex+"', EndColorStr='"+o.octoHex+"')",h+=c.replace("%start%",t.stop).replace("%end%",n).replace("%filter%",r))))}),o.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(o)}function s(t,i){var l=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",i=n(i),e.each(i,function(e,t){l.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+l.join(",")+")"}function n(t){var i=[],l=[],o=[],s=t.length-1;return e.each(t,function(e,t){var o=t,s=!1,n=t.match(/1?[0-9]{1,2}%$/);n&&(o=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=n.shift()),i.push(o),l.push(s)}),l[0]===!1&&(l[0]="0%"),l[s]===!1&&(l[s]="100%"),l=r(l),e.each(l,function(e){o[e]={color:i[e],stop:l[e]}}),o}function r(t){var i,l,o,s,n=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(n=d-1,u=!0),d++;for(l=a-n,s=parseInt(t[n].replace("%"),10),i=(parseFloat(t[a].replace("%"))-s)/l,d=n+1,o=1;d<a;)t[d]=s+o*i+"%",o++,d++;return r(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,h=u&&c<10,f=!1,g=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),i=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,l=i<100;return{value:t,alpha:i,rgba:l}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){h?o.apply(this,t):e(this).css("backgroundImage",l.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,i){var l,o,s,n;for(t=t||"top",l=e.extend({},{s:100,l:50},i),o="hsl(%h%,"+l.s+"%,"+l.l+"%)",s=0,n=[];s<=360;)n.push(o.replace("%h%",s)),s+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,n)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="javascript:void(0);"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var i={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},i,t),(h===!1||h===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,f===!1&&i(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var i=e(this),l=i.val(),o=i.parent().find(".fl-color-picker-color"),s=flBuilderParseColorValue(l),n="";if(l){if(o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba)n=i.val().toString();else if(!o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba){var r=l.replace("rgba","rgb");r=r.substr(0,r.lastIndexOf(","))+")",t._color._alpha=1,n=r,i.val(r)}else n="#"+i.val().toString();o.css({backgroundColor:n})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,i){var l=!1;return e.each(i,function(e,i){if(t===i)return l=!0,!1}),l},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,i){t._addPresetView(i)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var i=this._presetsList.find(".fl-color-picker-no-preset");i.length>0&&i.remove();var l=e(this._presetsTpl),o=Color(t);l.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:o.toString()}).end().find(".fl-color-picker-preset-label").html(o.toString()),this._presetsList.append(l)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:i,collision:"flipfit",using:function(e,i){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),i.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("mousedown",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,i=t._ui.find(".fl-color-picker-preset-add"),l=t._ui.find(".fl-color-picker-presets"),o=l.find(".fl-color-picker-presets-open-label"),s=l.find(".fl-color-picker-presets-close-label"),n=l.find(".fl-color-picker-presets-list");i.off("click").on("click",function(){t._addPreset(t.element.val())}),n.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),l.off("click").on("click",".fl-color-picker-presets-toggle",function(){o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset",function(i){var l=new Color(e(this).data("color").toString());t._setColor(l),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:l.toString()}).removeClass("fl-color-picker-empty"),o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(i){i.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var i=t.toString(),l=a.indexOf(i);l>-1&&(a.splice(l,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+i+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var i=t.toString().replace(/^#/,"");""===i?alert(this.options.labels.noneColorSelected):a.indexOf(i)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+i)):(this._addPresetView(i),this._addPresetFeedback(),a.push(i),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var i,l=this,o=l._color,s=l.options.mode,n=l._getHSpaceColor(),r=l.controls[t],a=l.options.controls;if(t!==l.active&&("square"!==l.active||"strip"===t))switch(a[t]){case"h":if("hsv"===s){switch(n=o.clone(),t){case"horiz":n[a.vert](100);break;case"vert":n[a.horiz](100);break;case"strip":n.setHSpace("hsl")}i=n.toHsl()}else i="strip"===t?{s:n.s,l:n.l}:{s:100,l:n.l};r.flBuilderColorPickerRaninbowGradient(e,i);break;case"s":"hsv"===s?"vert"===t?i=[o.clone().a(0).s(0).toCSS("rgba"),o.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?i=[o.clone().s(100).toCSS("hsl"),o.clone().s(0).toCSS("hsl")]:"horiz"===t&&(i=["#fff","hsl("+n.h+",100%,50%)"]):i="vert"===t&&"h"===l.options.controls.horiz?["hsla(0, 0%, "+n.l+"%, 0)","hsla(0, 0%, "+n.l+"%, 1)"]:["hsl("+n.h+",0%,50%)","hsl("+n.h+",100%,50%)"],r.flBuilderColorPickerGradient(e,i);break;case"l":i="strip"===t?["hsl("+n.h+",100%,100%)","hsl("+n.h+", "+n.s+"%,50%)","hsl("+n.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],r.flBuilderColorPickerGradient(e,i);break;case"v":i="strip"===t?[o.clone().v(100).toCSS(),o.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],r.flBuilderColorPickerGradient(e,i)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,i=this,l=i.options,o=i.controls,s=o.square,n=i.picker.find(".iris-strip"),r="77.5%",a="12%",d=20,u=l.border?l.width-d:l.width;if(e&&(s.css("width",""),n.css("width",""),i.picker.css({width:"",height:""})),r=u*(parseFloat(r)/100),a=u*(parseFloat(a)/100),t=l.border?r+d:r,s.width(r).height(r),n.height(r).width(a),i.picker.css({width:l.width,height:t}),!l.palettes)return i.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,i=100,l=function(i){var l=new Color(e.val()),o=e.val().replace(/^#/,""),s=t._currentElement.hasClass("fl-color-picker-empty");if(e.removeClass("iris-error"),l.error)""!==o&&e.addClass("iris-error");else if(l.toString()!==t._color.toString()||""!==t._color.toString()&&s)if("keyup"===i.type){if(o.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(o),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(o).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change")}else if("paste"===i.type)return o=i.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(o).toString(),t._setColor(o),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change"),!1};e.on("change",l).on("keyup",t._debounce(l,i))},_initControls:function(){var t=this,i=t.controls,l=i.square,o=t.options.controls,s=t._scale[o.strip];i.stripSlider.slider({orientation:"horizontal",max:s,slide:function(e,i){t.active="strip","h"===o.strip&&(i.value=s-i.value),t._color[o.strip](i.value),t._change.apply(t,arguments)}}),i.squareDrag.draggable({containment:i.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,i){t._squareDrag(e,i)},start:function(){l.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){l.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(i){var l="ui-state-focus";i.preventDefault(),"mousedown"===i.type?(t.picker.find("."+l).removeClass(l).blur(),e(this).addClass(l).focus()):e(this).removeClass(l)}).on("keydown",function(e){var l=i.square,o=i.squareDrag,s=o.position(),n=2;switch(e.altKey&&(n*=10),e.keyCode){case 37:s.left-=n;break;case 38:s.top-=n;break;case 39:s.left+=n;break;case 40:s.top+=n;break;default:return!0}s.left=Math.max(0,Math.min(s.left,l.width())),s.top=Math.max(0,Math.min(s.top,l.height())),o.css(s),t._squareDrag(e,{position:s}),e.preventDefault()}),l.mousedown(function(i){var l,o;1===i.which&&e(i.target).is("div")&&(l=t.controls.square.offset(),o={top:i.pageY-l.top,left:i.pageX-l.left},i.preventDefault(),t._squareDrag(i,{position:o}),i.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(o).trigger(i))})},_squareDrag:function(e,t){var i=this,l=i.options.controls,o=i._squareDimensions(),s=Math.round((o.h-t.position.top)/o.h*i._scale[l.vert]),n=i._scale[l.horiz]-Math.round((o.w-t.position.left)/o.w*i._scale[l.horiz]);i._color[l.horiz](n)[l.vert](s),i.active="square",i._change.apply(i,arguments)},_setColor:function(e){var t,i,l=this,o=l.options.color;l.options.color=e,e=""+e,t=e.replace(/^#/,""),i=new Color(e).setHSpace(l.options.mode),i.error?l.options.color=o:(l._color=i,l.options.color=l._color.toString(),l.active="external",l._change())},_squareDimensions:function(e){var i,l,o=this.controls.square;return e!==t&&o.data("dimensions")?o.data("dimensions"):(l=this.controls.squareDrag,i={w:o.width(),h:o.height()},o.data("dimensions",i),i)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,i=t.controls,l=t._getHSpaceColor(),o=["square","strip"],s=t.options.controls,n=s[t.active]||"external",r=t.hue;"strip"===t.active?o=[]:"external"!==t.active&&o.pop(),e.each(o,function(e,o){var n,r,a;if(o!==t.active)switch(o){case"strip":n="h"===s.strip?t._scale[s.strip]-l[s.strip]:l[s.strip],i.stripSlider.slider("value",n);break;case"square":r=t._squareDimensions(),a={left:l[s.horiz]/t._scale[s.horiz]*r.w,top:r.h-l[s.vert]/t._scale[s.vert]*r.h},t.controls.squareDrag.css(a)}}),l.h!==r&&t._isNonHueControl(t.active,n)&&t._color.h(r),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,i){var l,o;return function(){var s,n,r=this,a=arguments;return s=function(){l=null,i||(o=e.apply(r,a))},n=i&&!l,clearTimeout(l),l=setTimeout(s,t),n&&(o=e.apply(r,a)),o}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement.val();i.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t.picker.addClass("fl-color-alpha-enabled"),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,i=flBuilderParseColorValue(t.val()),l=parseFloat(i.alpha/100),o=e._wrapper,s=e._ui,n=s.find(".fl-alpha-wrap"),r=n.find(".fl-alpha-slider"),a=n.find(".fl-alpha-text"),d=n.find(".fl-alpha-slider-offset");alphaHandle=n.find(".ui-slider-handle"),a.text(l<1?l:""),r.slider({orientation:"vertical",slide:function(t,i){var l=parseFloat(i.value/100);e._color._alpha=l,a.text(l<1?l:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:i.value}),o.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),r.slider("value",100).trigger("slide")})},value:i.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var i=function(e,t){return this instanceof i?this._init(e,t):new i(e,t)};i.fn=i.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var i="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),i=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":i,this[i](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new i(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],l=t.length-1;l>=0;l--)e[t[l]]=this[t[l]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,i=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(i)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(i,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var l=t.length-1;l>=0;l--)if(t[l]=parseInt(t[l],10),isNaN(t[l]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,i){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),i))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var i,l,o,s,n,r,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",r=e.h/360,a=e.s/100,d=e.l/100,0===a?i=l=o=d:(s=d<.5?d*(1+a):d+a-d*a,n=2*d-s,i=this.hue2rgb(n,s,r+1/3),l=this.hue2rgb(n,s,r),o=this.hue2rgb(n,s,r-1/3)),this.fromRgb({r:255*i,g:255*l,b:255*o},!0))},fromHsv:function(e){var i,l,o,s,n,r,a,d,u,c,h;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",i=e.h/360,l=e.s/100,o=e.v/100,a=Math.floor(6*i),d=6*i-a,u=o*(1-l),c=o*(1-d*l),h=o*(1-(1-d)*l),a%6){case 0:s=o,n=h,r=u;break;case 1:s=c,n=o,r=u;break;case 2:s=u,n=o,r=h;break;case 3:s=u,n=c,r=o;break;case 4:s=h,n=u,r=o;break;case 5:s=o,n=u,r=c}return this.fromRgb({r:255*s,g:255*n,b:255*r},!0)},fromInt:function(e,i){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),i===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var i=this.toRgb();return t<1?"rgba( "+i.r+", "+i.g+", "+i.b+", "+t+" )":"rgb( "+i.r+", "+i.g+", "+i.b+" )";case"hsl":case"hsla":var l=this.toHsl();return t<1?"hsla( "+l.h+", "+l.s+"%, "+l.l+"%, "+t+" )":"hsl( "+l.h+", "+l.s+"%, "+l.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,i=this.toRgb(),l=i.r/255,o=i.g/255,s=i.b/255,n=Math.max(l,o,s),r=Math.min(l,o,s),a=(n+r)/2;if(n===r)e=t=0;else{var d=n-r;switch(t=a>.5?d/(2-n-r):d/(n+r),n){case l:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-l)/d+2;break;case s:e=(l-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,i=this.toRgb(),l=i.r/255,o=i.g/255,s=i.b/255,n=Math.max(l,o,s),r=Math.min(l,o,s),a=n,d=n-r;if(t=0===n?0:d/n,n===r)e=t=0;else{switch(n){case l:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-l)/d+2;break;case s:e=(l-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof i))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),l=e.toLuminosity();return t>l?(t+.05)/(l+.05):(l+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new i(t)},getReadableContrastingColor:function(e,l){if(!(e instanceof i))return this;var o=l===t?5:l,s=e.getDistanceLuminosityFrom(this),n=e.getMaxContrastColor(),r=n.getDistanceLuminosityFrom(e);if(r<=o)return n;if(s>=o)return this;for(var a=0===n.toInt()?-1:1;s<o&&(this.l(a,!0),s=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var i=parseFloat(e);return isNaN(i)?this._error():(this._alpha=i,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var i=l[e];return function(l,o){var s=this._spaceFunc("to",i.space);return l===t?s[e]:(o===!0&&(l=s[e]+l),i.mod&&(l%=i.mod),i.range&&(l=l<i.range[0]?i.range[0]:l>i.range[1]?i.range[1]:l),s[e]=l,this._spaceFunc("from",i.space,s))}},_spaceFunc:function(e,t,i){var l=t||this._hSpace,o=e+l.charAt(0).toUpperCase()+l.substr(1);return this[o](i)}};var l={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var o in l)l.hasOwnProperty(o)&&(i.fn[o]=i.fn._partial(o));"object"==typeof exports?module.exports=i:e.Color=i}(this),function(e){FLLightbox=function(e){this._init(e)},FLLightbox.closeParent=function(t){var i=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");_.isUndefined(i)||FLLightbox._instances[i].close()},FLLightbox.getResizableControlClass=function(){var t=e(".fl-lightbox-resizable").eq(0),i="far fa-window-maximize";return t.length&&t.hasClass("fl-lightbox-width-full")&&(i="far fa-window-minimize"),i},FLLightbox.unbindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._unbind()},FLLightbox.bindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._bind()},FLLightbox.closeAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_allowClosing:!0,_resizeTimer:null,_defaults:{className:"",destroyOnClose:!1,resizable:!1},open:function(e){this._bind(),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open"),FLBuilder.triggerHook("didShowLightbox",this)},close:function(){var e=this._node.data("parent");this._allowClosing&&(this.trigger("beforeCloseLightbox"),this._unbind(),this._node.hide(),this._visible=!1,this.trigger("close"),FLBuilder.triggerHook("didHideLightbox"),this._defaults.resizable&&_.isUndefined(e)&&FLBuilder.triggerHook("didHideAllLightboxes"),this._defaults.destroyOnClose&&this.destroy())},disableClose:function(){this._allowClosing=!1},enableClose:function(){this._allowClosing=!0},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty()},on:function(e,t){this._node.on(e,t)},off:function(e,t){this._node.off(e,t)},trigger:function(e,t){this._node.trigger(e,t)},destroy:function(){this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(e){}},_init:function(t){var i=0,l=null;for(l in FLLightbox._instances)i++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+i,FLLightbox._instances[this._id]=this,this._render(),this._resizable()},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,this._delayedResize.bind(this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_resizable:function(){var t=(e("body"),this._node.find(".fl-lightbox-mask")),i=this._node.find(".fl-lightbox"),l=e(".fl-lightbox-resizable").eq(0);this._defaults.resizable?(t.hide(),i.addClass("fl-lightbox-resizable"),i.delegate(".fl-lightbox-resize-toggle","click",this._resizeClicked.bind(this)),i.draggable({cursor:"move",handle:".fl-lightbox-header"}).resizable({handles:"all",minHeight:500,minWidth:380,start:this._resizeStart.bind(this),stop:this._resizeStop.bind(this)}),l.length&&l.hasClass("fl-lightbox-width-full")?(i.addClass("fl-lightbox-width-full"),i.draggable("disable")):this._restorePosition()):t.show(),this._resize()},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(this._resize.bind(this),250)},_resize:function(){var t=this._node.find(".fl-lightbox"),i=parseInt(this._node.css("padding-top")),l=parseInt(this._node.css("padding-bottom")),o=parseInt(this._node.css("padding-left")),s=parseInt(this._node.css("padding-right")),n=t.height(),r=t.width(),a=e(window),d=a.height()-i-l,u=(a.width()-o-s,"0px");this._defaults.resizable?(r<600?t.addClass("fl-lightbox-width-slim"):t.removeClass("fl-lightbox-width-slim"),this._resizeEditors()):(d>n&&(u=(d-n-46)/2+"px"),t.attr("style","").css("margin",u+" auto 0")),this.trigger("resized")},_resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),e(".fl-builder-lightbox:visible").append('<div class="fl-builder-resizable-iframe-fix"></div>'),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},_resizeStop:function(t,i){var l=e(".fl-lightbox-resizable:visible");parseInt(l.css("top"))<0&&l.css("top","0"),this._savePosition(),e("body").removeClass("fl-builder-resizable-is-resizing"),e(".fl-builder-resizable-iframe-fix").remove(),FLBuilder._bindOverlayEvents()},_resizeClicked:function(){var t=e(".fl-lightbox-resizable"),i=(t.find(".fl-lightbox-resize-toggle"),this._node.find(".fl-lightbox"));i.hasClass("fl-lightbox-width-full")?this._resizeExitFull():this._resizeEnterFull(),this._resize()},_resizeEnterFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-maximize").addClass("fa-window-minimize"),t.addClass("fl-lightbox-width-full"),t.draggable("disable"),t.resizable("disable")},_resizeExitFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-minimize").addClass("fa-window-maximize"),t.removeClass("fl-lightbox-width-full"),t.draggable("enable"),t.resizable("enable")},_resizeEditors:function(){e(".fl-lightbox-resizable").each(function(){var t=e(this),i=t.find(".fl-builder-settings-fields").height(),l=t.find(".mce-edit-area > iframe, textarea.wp-editor-area, .ace_editor"),o=null;i<350&&(i=350),l.each(function(){o=e(this),o.hasClass("ace_editor")?(o.height(i-60),o.closest(".fl-field").data("editor").resize()):o.closest(".mce-container-body").find(".mce-toolbar-grp .mce-toolbar.mce-last").is(":visible")?o.height(i-175):o.height(i-150)})})},_savePosition:function(){var e=this._node.find(".fl-lightbox"),t={width:e.width(),height:e.height(),top:parseInt(e.css("top"))<0?"0px":e.css("top"),left:e.css("left")};e.closest(".fl-builder-ui-pinned").length||(FLBuilderConfig.userSettings.lightbox=t,FLBuilder.ajax({action:"save_lightbox_position",data:t}))},_restorePosition:function(){var e=this._node.find(".fl-lightbox"),t=FLBuilderConfig.userSettings.lightbox;t?e.css(t):e.css({top:25,left:FLBuilderConfig.isRtl?"-25":25})}}}(jQuery),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({
2
- action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,i){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(i)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0,FLBuilder.addHook("endEditingSession",function(){FLIconSelector._lightbox.close()})},_getContentComplete:function(t){var i=JSON.parse(t);FLIconSelector._content=i.html,FLIconSelector._lightbox.setContent(i.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),i=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=i,""!==i?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,i){for(var l=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,o=null,s=0;s<l.length;s++)l[s].selectorText.toLowerCase()==e.toLowerCase()&&(o=l[s]);if(o)if("object"==typeof t)for(s in t)o.style[this._toCamelCase(s)]=t[s];else o.style[this._toCamelCase(t)]=i;else this.addRule(e,t,i)},addRule:function(e,t,i){var l="",o="";if("object"==typeof t)for(o in t)l+=o+":"+t[o]+";";else l=t+":"+i+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+l+" }",this._sheet.cssRules.length):this._sheet.addRule(e,l)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"",i=this.className?' class="'+this.className+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+i+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColParent:null,_newColPosition:0,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._initTinyMCE(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder.addHook("didInitUI",FLBuilder._showTourOrTemplates.bind(FLBuilder)),FLBuilder.triggerHook("init")},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(t){return jQuery.fn.oldReady(function(){try{"function"==typeof t&&t(e)}catch(i){FLBuilder.logError(i)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,i,l,o){return FLBuilder.logGlobalError(e,t,i,l,o),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:FLBuilderConfig.postId}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId,e(FLBuilder._contentClass).addClass("fl-builder-content-editing")},_initMediaUploader:function(){wp.media.model.settings.post.id=FLBuilderConfig.postId},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:85,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},i="",l="",o="";o="row"==FLBuilderConfig.userTemplateType||"column"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col:not(.fl-node-global) .fl-col-content",l="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",i=FLBuilderConfig.nestedColumns?o:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-columns").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:l,items:".fl-builder-block-saved-column",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:o,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:o,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:o,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:o,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:o,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){$excludedLinks=e(".fl-builder-bar a, .fl-builder--content-library-panel a, .fl-page-nav .nav a"),e("a").not($excludedLinks).on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e("body").delegate(".fl-builder-content a","click",FLBuilder._preventDefault),e("body").delegate("button.fl-builder-button","mouseup",this._buttonMouseUp.bind(this)),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-block-overlay","contextmenu",FLBuilder._removeAllOverlays),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-row-reset","click",FLBuilder._resetRowWidthClicked),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-copy","click",FLBuilder._copyColClicked),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay .fl-block-settings","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-col-settings","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-tabs a","show",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-tabs a","hide",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-builder-settings-tabs-overflow-menu > a","click",FLBuilder._settingsTabsToOverflowMenuItemClicked.bind(this)),e("body").delegate(".fl-builder-settings-tabs-more","click",FLBuilder._toggleTabsOverflowMenu.bind(this)),e("body").delegate(".fl-builder-settings-tabs-overflow-click-mask","click",FLBuilder._hideTabsOverflowMenu.bind(this)),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-remove","click",FLBuilder._singleVideoRemoved),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-data-source-select select[name=data_source]","change",FLBuilder._loopDataSourceChange),e("body").delegate(".fl-custom-query select[name=post_type]","change",FLBuilder._customQueryPostTypeChange),e("body").delegate(".fl-field input[type=number]","focus",FLBuilder._onNumberFieldFocus),e("body").delegate(".fl-field input[type=number]","blur",FLBuilder._onNumberFieldBlur),FLBuilder.addHook("didCompleteAJAX",FLBuilder._refreshSettingsPreviewReference),FLBuilder.addHook("didRenderLayoutComplete",FLBuilder._refreshSettingsPreviewReference)},_unbindEvents:function(){e("a").off("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").off("click",FLBuilder._headerLinkClicked),e("body").undelegate(".fl-builder-content a","click",FLBuilder._preventDefault)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var i=e(this),l=i.attr("href");this.hash||(t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=l.indexOf("?")>-1?l:l+"?fl_builder",FLBuilder.triggerHook("triggerDone")))},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,i=e(".fl-builder-col-settings").length>0,l=e(".fl-builder-module-settings").length>0;if(t||i||l)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1e3})},_hideTipTips:function(){e("#tiptip_holder").stop().hide()},_submenuParentClicked:function(t){var i=e("body"),l=e(this),o=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+o.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),i.addClass("fl-builder-submenu-open"),l.addClass("fl-builder-submenu-open")),o.closest(".fl-row-overlay").addClass("fl-row-menu-active"),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var i=e("body"),l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"))},_submenuMouseenter:function(t){var i=e(this),l=i.data("timeout");"undefined"!=typeof l&&clearTimeout(l)},_submenuMouseleave:function(t){var i=e("body"),l=e(this),o=setTimeout(function(){i.removeClass("fl-builder-submenu-open"),l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.closest(".fl-row-overlay").removeClass("fl-row-menu-active"),l.data("timeout",o)},_submenuNestedParentMouseenter:function(t){var i=e(this),l=i.find(".fl-builder-submenu");i.width()+i.offset().left+l.width()>e(window).width()&&i.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_buttonMouseUp:function(t){e(t.currentTarget).blur()},_closePanel:function(){FLBuilder.triggerHook("hideContentPanel")},_showPanel:function(){FLBuilder.triggerHook("showContentPanel")},_togglePanel:function(){FLBuilder.triggerHook("toggleContentPanel")},_blockSectionTitleClicked:function(){var t=e(this),i=t.parent();i.hasClass("fl-active")?i.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),i.addClass("fl-active")),FLBuilder._initScrollbars()},_publishLayout:function(e){if(FLBuilder._triggerSettingsSave(!1,!0)){if(_.isUndefined(e))var e=!0;FLBuilder.ajax({action:"save_layout"},this._onPublishComplete.bind(this,e))}},_publishButtonClicked:function(e){FLBuilder._publishLayout(e)},_onPublishComplete:function(t){t&&(FLBuilderConfig.shouldRefreshOnPublish?FLBuilder._exit():FLBuilder._exitWithoutRefresh()),e("#wp-admin-bar-fl-builder-frontend-edit-link .fl-builder-admin-bar-status-dot").css("color","#6bc373"),FLBuilder.triggerHook("didPublishLayout")},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit)},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e?(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit)):FLBuilder.triggerHook("didCancelDiscard")},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_exitWithoutRefresh:function(){window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):FLBuilder.triggerHook("endEditingSession")},_duplicateLayoutClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(e){var t=FLBuilderConfig.adminUrl;window.location.href=t+"post.php?post="+e+"&action=edit"},_layoutSettingsClicked:function(){FLBuilderSettingsForms.render({id:"layout",className:"fl-builder-layout-settings",settings:FLBuilderSettingsConfig.settings.layout},function(){FLBuilder._layoutSettingsInitCSS()})},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),i=e(this),l=i.parents("#fl-field-css");l.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(i.val()):e("#fl-builder-global-css").html(i.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),i=t.serializeArray(),l={},o=0;o<i.length;o++)l[i[o].name]=i[o].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:l},function(){FLBuilder.triggerHook("didSaveLayoutSettingsComplete",l),FLBuilder._updateLayout()})},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilderSettingsForms.render({id:"global",className:"fl-builder-global-settings",settings:FLBuilderSettingsConfig.settings.global},function(){FLBuilder._layoutSettingsInitCSS()})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:l},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close())},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder.triggerHook("didSaveGlobalSettingsComplete",FLBuilderConfig.global),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row"),i=t.length>0;i||FLBuilder.ContentPanel.show("modules")},_requestTemplateInsert:function(e,t){FLBuilder.layoutHasContent()?0==e?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,t)):(FLBuilder._selectedTemplateId=e,FLBuilder._selectedTemplateType=t,FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(e,!1,t)},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder.triggerHook("showContentPanel")},_applyTemplate:function(e,t,i){t="undefined"!=typeof t&&t?"1":"0",i="undefined"==typeof i?"core":i,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==i?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._applyTemplateComplete):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._applyUserTemplateComplete),FLBuilder.triggerHook("didApplyTemplate")},_applyTemplateComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didApplyTemplateComplete",t.config)},_applyUserTemplateComplete:function(t){var i=JSON.parse(t);null!==i.layout_css&&e("#fl-builder-layout-css").html(i.layout_css),FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didApplyTemplateComplete",i.config)},_saveUserTemplateClicked:function(){FLBuilderSettingsForms.render({id:"user_template",className:"fl-builder-user-template-settings",rules:{name:{required:!0}}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.ajax({action:"save_user_template",settings:l},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(e){if(e){var e=JSON.parse(e);FLBuilderConfig.contentItems.template.push(e),FLBuilder.triggerHook("contentItemsChanged")}},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var i=e(this).closest(".fl-user-template"),l=i.attr("data-id"),o=(e(".fl-user-template[data-id="+l+"]"),null),s=null,n=null;if(confirm(FLBuilderStrings.deleteTemplate)){FLBuilder.ajax({action:"delete_user_template",template_id:l});for(s in FLBuilderConfig.contentItems.template)n=FLBuilderConfig.contentItems.template[s],n.postId==l&&(o=s);_.isNull(o)||(FLBuilderConfig.contentItems.template.splice(o,1),FLBuilder.triggerHook("contentItemsChanged"))}t.stopPropagation()},_viewKnowledgeBaseClicked:function(){
3
- window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||FLBuilderConfig.isUserTemplate&&"column"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),t.find(".fl-row, .fl-builder-block").length||(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=e(FLBuilder._contentClass+" .fl-row"),o=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),n=null,r=null,a="column"==FLBuilderConfig.userTemplateType?e(FLBuilder._contentClass+"> .fl-col").eq(0):null;for(i=0,e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),l.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),l.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');i<l.length;i++)o=l.eq(i),0===o.find(".fl-col-group").length&&o.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(a&&0===s.length&&(s=a.find(".fl-col-group"),a.append('<div class="fl-drop-target fl-col-drop-target"></div>'),a.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')),i=0;i<s.length;i++)n=s.eq(i),r=n.find("> .fl-col"),n.hasClass("fl-col-group-nested")||(n.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),r.append('<div class="fl-drop-target fl-col-drop-target"></div>'),r.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,o=e(window).scrollTop(),s=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=o,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-o>0&&(l=e(this))}),null!==l&&(s=l.offset().top-o),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._disableGlobalCols(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),s>0&&scrollTo(0,l.offset().top-s),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),o=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?o=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?o="":l.hasClass("fl-col-group-drop-target")?o="":l.hasClass("fl-row-drop-target")&&(o=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-column")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(o),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,o=t.hasClass("fl-builder-block-row"),s=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(o||s)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(o&&"1-col"==t.data("cols")?l=!0:s&&(l=!0)),o&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),s&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),o=i.item.parent(),s=null;o.hasClass("fl-drop-target")&&o.closest("[data-node]").length?(o=o.closest("[data-node]"),s=o.offset().top-l):s=o.offset().top-l,o.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._enableGlobalCols(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,o.offset().top-s),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,o=e.hasClass("fl-row"),s=o?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(s.css("margin-top"),10),bottom:parseInt(s.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,o=null,s=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,o=t.find(" > i, > span.fl-builder-has-submenu");r<o.length;r++)n=o.eq(r),s+=Math.floor(n[0].getBoundingClientRect().width),s>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa, .fas, .far").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_disableGlobalCols:function(){"column"!=FLBuilderConfig.userTemplateType&&e(".fl-row:not(.fl-node-global) .fl-col.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_enableGlobalCols:function(){"column"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,o=null,s=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(o=FLBuilder._appendOverlay(t,s({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&o.css("top",l-i-30+"px"),o.offset().top<43&&o.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(o))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),o=i.closest(".fl-row-overlay").length>0,s=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||o||s||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),o=i.closest(".fl-row");o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),o=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),o.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,o=l.parent(),s=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),o.hasClass("fl-builder-rows"))return void l.remove();if(o.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):o.hasClass("fl-col-drop-target")?FLBuilder._addCols(o.closest(".fl-col"),o.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),o.closest(".fl-col-group-nested").length>0):o.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),o.hasClass("fl-drop-target-last")?r+1:r)):(s=l.closest(".fl-row"),r=s.length?e(FLBuilder._contentClass+" > .fl-row").index(s):0,FLBuilder._addRow(l.attr("data-cols"),o.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else s=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o.parent().hasClass("fl-builder-content")||(o.hasClass("fl-drop-target-last")?o.parent().after(s):o.parent().before(s),FLBuilder._reorderNode(s.attr("data-node"),s.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),o=e(i.html).data("node"),s=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==s&&(e(".fl-node-"+o+" .fl-col-content").append(s),FLBuilder._reorderModule(s),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+o)),FLBuilder.triggerHook("didAddRow",o)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),o=e(FLBuilder._contentClass+" > .fl-row").index(i)+1,s=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),e("html, body").animate({scrollTop:s.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=o,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),o=i.closest(".fl-block-overlay-global").length>0,s=null;o&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(s=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),s.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:o||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),o=l.attr("data-node"),s=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),s.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:o,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",o),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType||"column"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";"column"==FLBuilderConfig.userTemplateType&&(i=":not(:first)"),e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i="column"==FLBuilderConfig.userTemplateType?"":".fl-col:not(.fl-node-global) ",l=e(FLBuilder._contentClass),o=l.find(t+".fl-col-group:not(.fl-col-group-nested) > "+i+"> .fl-col-content"),s=l.find(t+".fl-col-group-nested "+i+".fl-col-content"),n=0;for(e(".fl-node-drag-init").hide();n<s.length;n++)FLBuilder._adjustColHeightForDrag(s.eq(n));for(n=0;n<o.length;n++)FLBuilder._adjustColHeightForDrag(o.eq(n));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),o=l.parents(".fl-col"),s=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=o),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(s),l.addClass("fl-col-has-highlight-guide"),n=s.offset().top,n>r&&s.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),o=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.find(".fl-module").length>0,h=t.parents(".fl-col"),f=h.closest(".fl-col-group"),g=h.length>0,p="undefined"!=typeof t.data("template-url"),b="column"==FLBuilderConfig.userTemplateType&&!g;numParentCols=g?f.find("> .fl-col").length:0,parentIndex=f.find("> .fl-col").index(h),parentFirst=!!g&&0===parentIndex,parentLast=!!g&&numParentCols===parentIndex+1,contentWidth=t.find("> .fl-col-content").width(),row=t.closest(".fl-row"),rowIsFixedWidth=!!row.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,userCanResizeRows=FLBuilderConfig.rowResize.userCanResizeRows,template=wp.template("fl-col-overlay"),overlay=null,FLBuilderConfig.simpleUi||o&&s&&c&&!p||o&&"column"==FLBuilderConfig.userTemplateType&&c||!o&&t.find(".fl-module").length>0||t.find(".fl-builder-node-loading-placeholder").length>0||!c&&u||s&&u&&!p||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),overlay=FLBuilder._appendOverlay(t,template({global:o,groupLoading:l,numCols:n,first:a,last:d,isRootCol:b,hasChildCols:u,hasParentCol:g,parentFirst:parentFirst,parentLast:parentLast,numParentCols:numParentCols,contentWidth:contentWidth,rowIsFixedWidth:rowIsFixedWidth,userCanResizeRows:userCanResizeRows})),FLBuilder._buildOverlayOverflowMenu(overlay),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),o=i.find(".fl-module").length>0,s=(i.hasClass("fl-node-global"),"undefined"!=typeof i.data("template-url")),n=l.is("#tiptip_holder"),r=l.closest("#tiptip_holder").length>0;n||r||o&&!s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),o=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(o=o.parents(".fl-col")),o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o=l.attr("data-node"),s=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=s.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=s.closest(".fl-row"),position=0,s.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):s.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):s.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=s.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(s.closest(".fl-col").attr("data-node"),o,position)):s.hasClass("fl-col-drop-target")?(s.hasClass("fl-col-drop-target-last")?s.parent().after(l):s.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:o,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:o,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):s.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),o,position)):s.hasClass("fl-row-drop-target")&&(l.remove(),position=s.closest(".fl-builder-content").find(".fl-row").index(newRow),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(o,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),o=l.find("> .fl-col-content"),s=i.parent().find("ul.fl-builder-submenu").length>0,n=i.closest(".fl-block-overlay-global").length>0,r=i.closest(".fl-block-overlay-global").hasClass("fl-col-overlay"),a="column"!=FLBuilderConfig.userTemplateType&&"undefined"!=typeof l.attr("data-template-url"),d=null;FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||s&&!i.hasClass("fl-col-overlay")||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),d=l.attr("data-node"),n&&r&&a?FLBuilderConfig.userCanEditGlobalTemplates&&(win=window.open(e('.fl-col[data-node="'+d+'"]').attr("data-template-url")),win.FLBuilderGlobalNodeId=d):FLBuilderSettingsForms.render({id:"col",nodeId:d,className:"fl-builder-col-settings",attrs:'data-node="'+d+'"',buttons:n||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:n?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[d],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():o.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),o=i.clone(),s=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=s,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(s),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),o=l.closest(".fl-col-group"),s=l.parents(".fl-col"),n=s.length>0,r=s.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=s:1!==a.length||a.find(".fl-module").length||(l=o)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),o=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType&&"column"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(o=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",o+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:o}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var o=e.closest(".fl-col-group"),s=o.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&s++,FLBuilder._showNodeLoadingPlaceholder(o,s),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColParent,i.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e('.fl-module[data-node="'+o.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+o.colId+'"]'),"after"==o.position?l.next().find(".fl-col-content").append(o.module):l.prev().find(".fl-col-content").append(o.module),FLBuilder._reorderModule(o.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+i.nodeId)),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var o=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,o.hasClass("fl-col")?FLBuilder._newColGroupParent=o.find(" > .fl-col-content"):FLBuilder._newColGroupParent=o.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),o=l.data("node"),s=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+s+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+o)),FLBuilder.triggerHook("didAddColumnGroup",o)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),o="",s=l.hasClass("fl-block-col-resize-parent"),n=s?l.closest(".fl-col").parents(".fl-col"):null,r=s?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=s?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(o="e",h=d.nextAll(".fl-col").first()):(o="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:o,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",o=i.handle.closest(".fl-block-overlay"),s=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-s):100*(i.colWidth+s),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(o),
4
- FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,o=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),s=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:s,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(o),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:s,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,o=null,s=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;s=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),s.each(function(){for(o=e(this),r=o.find(".fl-col-group"),n.push(o.data("node")),FLBuilder._resetColumnWidths(o),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.parents(".fl-col-group").last(),n=s.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b="column"==FLBuilderConfig.userTemplateType&&!h;contentWidth=a.find("> .fl-col-content").width(),row=t.closest(".fl-row"),isGlobalRow=row.hasClass("fl-node-global"),rowIsFixedWidth=!!row.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,userCanResizeRows=FLBuilderConfig.rowResize.userCanResizeRows,template=wp.template("fl-module-overlay"),overlay=null,FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&o&&"row"!=FLBuilderConfig.userTemplateType&&isGlobalRow||l&&o&&"column"!=FLBuilderConfig.userTemplateType&&!isGlobalRow||t.closest(".fl-builder-node-loading").length||t.find(".fl-inline-editor:visible").length||(t.hasClass("fl-block-overlay-active")||(overlay=FLBuilder._appendOverlay(t,template({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,isRootCol:b,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:contentWidth,rowIsFixedWidth:rowIsFixedWidth,userCanResizeRows:userCanResizeRows})),FLBuilder._buildOverlayOverflowMenu(overlay),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),o=i.closest("#tiptip_holder").length>0;l||o||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,o=l.parent(),s=null,n=0,r=0;if(o.hasClass("fl-builder-modules")||o.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=l.closest(".fl-builder-content"),r=0,s=l.closest(".fl-row"),n=o.find(".fl-row").index(s)):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),r=o.closest(".fl-row").attr("data-node"),s=l.closest(".fl-col-group"),n=o.find(" > .fl-col-group").index(s)):o.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col-group"),r=o.attr("data-node"),s=l.closest(".fl-col"),n=o.find(" > .fl-col").index(s)):(n=o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(o,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(o.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();o.hasClass("fl-row-drop-target")?(s=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(s),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):o.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(s),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):o.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:s.data("node"),position:n},FLBuilder._addCols(s,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),o=e.index();t==i?FLBuilder._reorderNode(l,o):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,o))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),o=i.index()+1,s=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),e("html, body").animate({scrollTop:s.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=o,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),o=i.closest(".fl-module").attr("data-node"),s=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:o,parentId:s,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],o=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],s=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&s.append(l.assets.css),""!==l.assets.js&&s.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:o,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),o=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),o=t.validate().form(),o&&(o=l.submit())),o?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,o,s){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof o?"":o,alias:"undefined"==typeof s?"":s},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),i.settings||(i.settings=FLBuilderSettingsConfig.defaults.modules[i.type]),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),o=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")?o=FLBuilderStrings.saveRow:i.hasClass("fl-builder-col-settings")&&(o=FLBuilderStrings.saveColumn),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:o,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),o=l.find(".fl-builder-block"),s=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===o.length)l.append(d(i));else for(;a<o.length;a++){if(s=o.eq(a),n=s.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){s.before(d(i));break}if(o.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,o=l.parent(),s=null,n=0,r=null,a="",d=null;if(o.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=o.hasClass("fl-drop-target-last")?n+1:n,s=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-column")){if(r=l.closest(".fl-col"),colGroup=o.closest(".fl-col-group"),colGroupId=colGroup.attr("data-node"),a="render_new_col_template",d=FLBuilder._addColsComplete,o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(r=l.closest(".fl-row"),s=0,o=e(FLBuilder._contentClass),n=r.length?o.find(".fl-row").index(r):0):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),s=l.closest(".fl-row").attr("data-node"),n=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(l.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")&&(o=l.closest(".fl-col-group"),n=o.children(".fl-col").index(l.closest(".fl-col")),s=o.attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),o.hasClass("fl-col-group")?FLBuilder._newColParent=null:FLBuilder._newColParent=o,FLBuilder._newColPosition=n,FLBuilder._showNodeLoadingPlaceholder(o,n)}else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=l.closest(".fl-builder-content"),s=0,n=o.find(".fl-row").index(l.closest(".fl-row"))):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),s=o.closest(".fl-row").attr("data-node"),n=o.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col-group"),n=o.children(".fl-col").index(l.closest(".fl-col")),s=o.attr("data-node")):(n=o.children(".fl-module, .fl-builder-block").index(l),s=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),o.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=o,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(o,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:s,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),o=l.find(".fl-builder-blocks-section-content"),s=o.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===s.length&&(n.hasClass("fl-builder-block-saved-row")?o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),o=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+o).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+o+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),o=t.find(".fl-builder-settings-tabs"),s=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=o.find("a"),a=!1,d=i-60,u=0,c=l?16:30;s.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),o="";e(this).hasClass("fl-active")&&(o="fl-active"),e(this).hasClass("error")&&(o+=" error"),""!==o&&(o='class="'+o+'"');var n=e('<a href="'+l+'" '+o+">"+i+"</a>");s.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),s.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),s.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),o=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),s=o.find('a[href="'+l+'"]'),n=o.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),s.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),o=null,s=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(o=e(FLBuilder.preview.state.html),s=e(".fl-node-"+l.data("node")),n=s.closest(".fl-col"),r=o.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(s):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=t.data("node"),o=i.find(".fl-field").first(),s=o.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if(!l||!e(".fl-node-"+l+" .fl-inline-editor").length){if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var n=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(n).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);o.css("animation-name","fl-grab-attention"),o.on("animationend",function(){o.css("animation-name","")})}},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,o=null,s=0;s<i.length;s++)l=i.eq(s),o=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),o.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,o=0,s="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(s=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),o=0;o<d.length;o++)"[]"!=d[o]&&a.push(d[o].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=s):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(s)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=s):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(s))}else u[i[l].name]=s;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"&#39;").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),o=t.data("node"),s=FLBuilderSettingsConfig.nodes,n=null,r={};if(o&&s[o]?n=s[o]:l.length&&(n=JSON.parse(l.val().replace(/&#39;/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_getSettingsForChangedCheck:function(t,i){var l=FLBuilder._getSettings(i);if(t){var o=e(".fl-node-"+t);if(o.hasClass("fl-module")){var s=o.data("type"),n=FLBuilderSettingsConfig.editables[s];if(n&&FLBuilderSettingsConfig.nodes[t])for(var r in n)l[r]=FLBuilderSettingsConfig.nodes[t][r]}}return l},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),o=i.attr("data-node"),s=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(o),FLBuilderSettingsConfig.nodes[o]=s,FLBuilder.ajax({action:"save_settings",node_id:o,settings:s},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:o,settings:s}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),o=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,o):o(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var o=FLBuilder._lightbox._node.find("form.fl-builder-settings"),s=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[s],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,o.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!o.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),o.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(o.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),o=new FLLightbox(t),s=o._node,n=s.find(".fl-lightbox");return i.hide(),s.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),o.on("resized",FLBuilder._calculateSettingsTabsOverflow),o.open('<div class="fl-builder-lightbox-loading"></div>'),o},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),o=FLLightbox._instances[l],s=t.attr("data-parent"),n=e('[data-instance-id="'+s+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[s];o.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),o.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,o=null,s=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),s.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),s.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:s},function(i){l=JSON.parse(i);for(o in l)e('.fl-suggest-field[name="'+o+'"]').attr("data-value",l[o]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.find("textarea"),o=(l.attr("id"),l.data("editor")),s=l.data("wrap"),n=e("<div>",{position:"absolute",height:20*parseInt(l.attr("rows"),10)}),r=null;n.insertBefore(l),l.css("display","none"),ace.require("ace/ext/language_tools"),r=ace.edit(n[0]),r.$blockScrolling=1/0,r.getSession().setValue(l.val()),r.getSession().setMode("ace/mode/"+o),s&&r.getSession().setUseWrapMode(!0),r.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),r.getSession().on("change",function(e){l.val(r.getSession().getValue()).trigger("change")}),r.getSession().on("changeAnnotation",function(){for(var e=r.getSession().getAnnotations(),t=i.find(".fl-builder-settings-save"),l=i.find(".fl-builder-settings-error"),o=!1,s=0;s<e.length;s++)if(!(e[s].text.indexOf("DOCTYPE")>-1||e[s].text.indexOf("Named entity expected")>-1||e[s].text.indexOf("@supports")>-1||"error"!==e[s].type)){o=!0;break}o&&!l.length&&FLBuilderConfig.CheckCodeErrors?(t.addClass("fl-builder-settings-error"),t.on("click",FLBuilder._showCodeFieldError)):!o&&l.length&&(l.removeClass("fl-builder-settings-error"),l.off("click",FLBuilder._showCodeFieldError))}),l.closest(".fl-field").data("editor",r)},_showCodeFieldError:function(e){e.stopImmediatePropagation(),FLBuilder.alert(FLBuilderStrings.codeError)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,o=0,s=FLBuilderConfig.isRtl?{left:10}:{right:10};o<t.length;o++)i=t.eq(o),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:s,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),o=l.clone(),s=o.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;o.find("th label span.fl-builder-field-index").html(r),o.find(".fl-form-field-preview-text").html(""),o.find("input, textarea, select").val(""),l.after(o),FLBuilder._initMultipleFields(),s.length&&(n=s.find(".fl-form-field-edit").data("type"),s.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),o=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(o),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),
5
- FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),o=t.attr("data-trigger"),s=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[s]&&(FLBuilder._settingsSelectToggle(i[s].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[s].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[s].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[s]&&(FLBuilder._settingsSelectToggle(l[s].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[s].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[s].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof o&&(o=JSON.parse(o),"undefined"!=typeof o[s]&&"undefined"!=typeof o[s].fields))for(n=0;n<o[s].fields.length;n++)e("#fl-field-"+o[s].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,o){var s=0;if(o="undefined"==typeof o?"":o,"undefined"!=typeof t)for(;s<t.length;s++)e(".fl-builder-settings:visible").find(l+t[s]+o)[i](),e(l+t[s]+o).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),o=l.val(),s=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==o?(s=wp.media.attachment(o),s.fetch(),t.add(s?[s]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),o=i.find(".fl-photo-preview img"),s=i.find("select");l.val(t.id),o.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),s.show(),s.html(FLBuilder._getPhotoSizeOptions(t)),s.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),o=l.find("input[type=hidden]"),s=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),o.val(""),s.html('<option value="" selected></option>'),s.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,o=null,s="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)s="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",o="",t?t===e.sizes[l].url.replace(/https?/,"")&&(o=' selected="selected"'):o="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+o+">"+s+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),o=""===l?"":JSON.parse(l),s=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof o){for(u in o)c.push(o[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(s)&&r.set("id",s),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),o=i.find(".fl-multiple-photos-count"),s=[],n=0;n<t.models.length;n++)s.push(t.models[n].id);1==s.length?o.html("1 "+FLBuilderStrings.photoSelected):o.html(s.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(s)).trigger("change")},_initSingleVideoSelector:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video")},_selectSingleVideo:function(){FLBuilder._initSingleVideoSelector(),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),o=i.find(".fl-video-preview-filename"),s=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),o.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),s.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singleVideoRemoved:function(){FLBuilder._initSingleVideoSelector();var t=FLBuilder._singleVideoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-video-field"),o=l.find(".fl-video-preview-img img"),s=l.find(".fl-video-preview-filename"),n=l.find("input[type=hidden]");i&&i.reset(),o.attr("src",""),s.html(""),l.addClass("fl-video-empty"),n.val("").trigger("change")},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),o=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',s=wp.shortcode.next("playlist",o).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(s.get("id"))&&!_.isUndefined(n)&&s.set("id",n),r=wp.media.playlist.attachments(s),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),o=i.find("input[type=hidden]"),s=[],n=0;n<t.models.length;n++)s.push(t.models[n].id);1==s.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(s.length+" "+FLBuilderStrings.audiosSelected),o.val(JSON.stringify(s)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),o=i.find("i"),s=o.attr("data-icon");l.val(t).trigger("change"),o.removeClass(s),o.addClass(t),o.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),o=t.siblings("input").val(),s=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===o&&(o=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(o.replace(/&#39;/g,"'")),lightbox:n,helper:s,rules:s?s.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),o=FLBuilder._getSettings(t),s={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=o[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+o[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),s=r.siblings("input").val().replace(/&#39;/g,"'"),""!=s&&(o=e.extend(JSON.parse(s),o)),r.siblings("input").val(JSON.stringify(o)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),o=l.find(".fl-link-field-search"),s=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),s.autoSuggest("remove",t.value),o.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),o=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),o.find("option[value="+i.weight+"]").length&&o.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),o={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},s={};i.html(""),s="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(s,function(e,t){i.append('<option value="'+t+'">'+o[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel&&(tinymce.ui.FloatPanel.zIndex=100100),e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),o="flrich"+(new Date).getTime()+"_"+l,s=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;s=s.replace(/flbuildereditor/g,o),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,o)),i.after(s).remove(),e("textarea#"+o).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[o]&&(d=n.mceInit[o],u=tinymce.$("#wp-"+o+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(o)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[o]),window.wpActiveEditor=o},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinymce.editors[t].inline||(i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i));FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinymce.editors[t].inline||tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),o=t.attr("id"),s=i.attr("data-name"),n="undefined"!=typeof tinymce&&tinymce.get(o),r=t.siblings('textarea[name="'+s+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+s+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),o=[];i.find(".fl-ordering-field-option").each(function(){o.push(e(this).attr("data-key"))}),l.val(JSON.stringify(o)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading"),FLBuilder.triggerHook("didStartNodeLoading",i)},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(" > .fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,o){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof o&&"undefined"!=typeof o.stack&&(FLBuilder.log(o.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,o="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(o=e(this).remove(),l+=o[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;if(this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(" > .fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId){var i=e(FLBuilder.preview.classes.node),l=i.closest(".fl-node-"+this._data.nodeId).length;l&&i.html(FLBuilder.preview.elements.node.html())}},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",o=null,s="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),o=e('script[src*="'+l+'"]'),o.length>0&&e(this).remove())}),i.find("link").each(function(){s=e(this).attr("href"),"undefined"!=typeof s&&(s=s.replace(a,""),n=e('link[href*="'+s+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.getFormattedSelector=function(e,t){for(var i="",l=t.split(","),o=0;o<l.length;o++)l[o].indexOf("{node}")>-1?i=l[o].replace("{node}",e):i+=e+" "+l[o],o!=l.length-1&&(i+=", ");return i},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettingsForChangedCheck(this.nodeId,t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null);
6
- },updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,o=255&t;return[i,l,o]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched.preview",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched.preview")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,o="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+o].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),o=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:o}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),o=e(".fl-builder-settings .fl-lightbox-header"),s=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+s+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):o.length>0&&o.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),o=this.elements.hoverColor.val(),s=this.elements.headingColor.val();l=""===l?i:l,o=""===o?i:o,s=""===s?i:s,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===o?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+o),""===s?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+s),this.updateCSSRule(this.classes.node+" h2","color","#"+s),this.updateCSSRule(this.classes.node+" h3","color","#"+s),this.updateCSSRule(this.classes.node+" h4","color","#"+s),this.updateCSSRule(this.classes.node+" h5","color","#"+s),this.updateCSSRule(this.classes.node+" h6","color","#"+s),this.updateCSSRule(this.classes.node+" h1 a","color","#"+s),this.updateCSSRule(this.classes.node+" h2 a","color","#"+s),this.updateCSSRule(this.classes.node+" h3 a","color","#"+s),this.updateCSSRule(this.classes.node+" h4 a","color","#"+s),this.updateCSSRule(this.classes.node+" h5 a","color","#"+s),this.updateCSSRule(this.classes.node+" h6 a","color","#"+s))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,o;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",o)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),o=i.bgVideo.val(),s=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=s?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(s)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(s)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=o&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),o=i.bgSlideshowPhotos.val(),s=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===o||"smugmug"==l&&""===s||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,o;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",o)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,o;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",o)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],o=["","Medium","Responsive"],s=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<o.length;d++)n=t+l[a]+o[d],r=t+"_"+l[a].toLowerCase(),""!=o[d]&&(r+="_"+o[d].toLowerCase()),i[n]=e(s+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),o={},s=0;s<i.length;s++)o[i[s].toLowerCase()]=this.elements[e+i[s]+l].val();return this._normalizeDimensionValues(o,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},o="border"==t;e.each(i,function(e,i){l[t+"-"+e+(o?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,o=FLBuilderResponsiveEditing._mode,s="default"==o?"":o.charAt(0).toUpperCase()+o.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,o){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+o.charAt(0).toUpperCase()+o.slice(1)+i[1]+s,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[o]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,o=null,s={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),o=this._getDimensions("border"),e.map(s,function(e,t){l[t]&&o[t]?s[t]="calc("+l[t]+"+"+o[t]+")":l[t]?s[t]=l[t]:o[t]&&(s[t]=o[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",s),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",s))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),o=this.elements.node.prev(".fl-col"),s=this.elements.node.next(".fl-col"),n=0===s.length?o:s,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),o=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"select":t.find("select").on("change",o);break;case"color":t.find(".fl-color-picker-value").on("change",o);break;case"photo":t.find("select").on("change",o);break;case"multiple-photos":t.find("input").on("change",o);break;case"photo-sizes":t.find("select").on("change",o);break;case"video":t.find("input").on("change",o);break;case"multiple-audios":t.find("input").on("change",o);break;case"icon":t.find("input").on("change",o);break;case"form":t.delegate("input","change",o);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",o);break;case"post-type":t.find("select").on("change",o);break;case"suggest":t.find(".as-values").on("change",o),t.find("select").on("change",o);break;case"unit":case"dimension":t.find("input[type=number]").on("keyup",o);break;case"ordering":t.find("input[type=hidden]").on("change",o);break;default:t.on("change",o)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),o=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",o);break;case"unit":t.find("input[type=number]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"code":t.find("textarea").on("change",o);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=e(l),s=e("<div>"+e(i.target).val()+"</div>");o.length>0?(s.find("script").remove(),o.html(s.html())):this.delayPreview(i)},_previewTextEditor:function(t,i,l){var o=this._getPreviewSelector(this.classes.node,t.selector),s=e(o),n="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,r=e("#"+i),a="";s.length>0&&(a=e(n&&"none"==r.css("display")?"<div>"+n.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+r.val()+"</div>":"<div>"+switchEditors.wpautop(r.val())+"</div>"),a.find("script").remove(),s.html(a.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),o=null;if("refresh"==i.type)o=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;o=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",o),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",o),editor.on("keyup",o))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var o=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",o)},_previewFont:function(t,i){var l=e(i.delegateTarget),o=l.find(".fl-font-field-font"),s=e(o).find(":selected"),n=s.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,o.val(),r.val()),"Default"==o.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",o.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var o=FLBuilderConfig.googleFontsUrl,s="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){s+=e+":"+t.join()+"|"}),s=o+s.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",s).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",s)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"dimension":t.find("input[type=number]").on("keyup",e.proxy(this._previewDimensionCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=t.property,s="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"===s&&"opacity"===o?r=parseInt(r)/100:""!==r&&(r+=s),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,o,r):this.updateCSSRule(l,o,r)},_previewDimensionCSS:function(t,i){var l=e.extend({},t),o=l.property,s=e(i.target).data("unit");"border-width"===o?l.property="border-"+s+"-width":l.property=o+"-"+s,this._previewCSS(l,i)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=e(i.target),s=o.val(),n=""===s?"inherit":"#"+s;/^rgb/.test(s.replace(/\s+/g,""))&&(n=s),o.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){return FLBuilderPreview.getFormattedSelector(e,t)}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,o=null,s=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,o=element.tagName.toLowerCase(),s=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===o||i&&s&&"stylesheet"===s.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:o,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),o=l.match(i.media),s=o&&o.length||0,n=!s&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(o?u=l.replace(i.media,""):n&&"all"!=t.media?s=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<s;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=o[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,o=null,s=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(s in this.sheets)if(i="",l=e("<style></style>"),o=this.sheets[s],o.queries.length&&this.width){for(i+=o.all,r=0;r<o.queries.length;r++)n=o.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),o.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,o=t.createElement("div"),s=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return o.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(o),r&&i.insertBefore(l,i.firstChild),e=parseFloat(o.offsetWidth),r?i.removeChild(l):l.removeChild(o),i.style.fontSize=s,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("settings-form-init",this._initSettingsForms),
7
- FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),o=e("body"),s=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(s),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),s.after('<div class="fl-content-placeholder"></div>'),o.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(s)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,s.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,s.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(s.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),o=l.parents(),s="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<o.length&&(s=o.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==s);n++);t.css("background-color",s)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,o,s){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof s&&e.inArray(d,s)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,o),a.find(".fl-field-responsive-setting-medium "+i).on(l,o),a.find(".fl-field-responsive-setting-responsive "+i).on(l,o),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),o=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==o?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",o)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),o=FLBuilderResponsiveEditing._getFields(this,"input"),s=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(s,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=s[n],a=s[n+"_medium"],d=s[n+"_responsive"],o["default"].each(function(e){var t=o["default"].eq(e).attr("name").split("_").pop(),n=o["default"].eq(e).val(),u=o.medium.eq(e).val(),c=(o.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?o.medium.eq(e).attr("placeholder",n):""!==r&&o.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(s.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?o.responsive.eq(e).attr("placeholder",c):""!==h?o.responsive.eq(e).attr("placeholder",h):o.responsive.eq(e).attr("placeholder",c)):(!Number(s.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?o.responsive.eq(e).attr("placeholder",u):""!==a?o.responsive.eq(e).attr("placeholder",a):""!==n?o.responsive.eq(e).attr("placeholder",n):""!==r&&o.responsive.eq(e).attr("placeholder",r)))})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),o="100%";"responsive"==t?(o=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,l.width(o)):"medium"==t&&(o=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(o)),l.width(o)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),o=e('<div id="fl-builder-preview-mask"></div>'),s=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(o),t.append(s)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),o=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),o.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),o=l.closest("tr"),s=l.val();o.siblings("tr.fl-builder-service-account-row").remove(),o.siblings("tr.fl-builder-service-connect-row").remove(),o.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==s&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:s},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row");s.after(l.html),t._addAccountDelete(o),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:o.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();s.hide(),t._startSettingsLoading(o),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row"),n=o.find(".fl-builder-service-select"),r=o.find(".fl-builder-service-account-row"),a=o.find(".fl-builder-service-account-select"),d=o.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),s.after(l.html)),t._addAccountDelete(o),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=s.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:o.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:o.val(),account:d}),u&&(t._startSettingsLoading(o),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-account-row");s.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),o=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:o.val()},t._accountDeleteComplete),t._startSettingsLoading(o))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-campaign-monitor-client-select");s.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-list-select");s.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-field-row");s.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fas fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fas fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],o=i.split(" ");for(var e in o)o[e].startsWith(t)&&l.push(o[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var o=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,o):Mousetrap.bind(i,o)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return s.isPreviewing?void s.endPreview():o.isShowing?void o.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var o,s,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(o=r.filter("a.fl-active"),s="next"==i?o.is(r.last())?r.first():o.next("a"):o.is(r.first())?r.last():o.prev("a"),s.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},o=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),s.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),s.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),s.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),s.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),s={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var o=e("body"),s=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),s.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=s.find(".fl-block-col-resize-feedback-left")),s.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=s.find(".fl-block-col-resize-feedback-right")),o.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,o=this.drag.originalWidth,s=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",s=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=o+2*s:this.drag.calculatedWidth=o-2*s,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var o={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth},s=e("body");t.ajax(o),t._bindOverlayEvents(),s.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),
8
- setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked),this.$el.find("#fl-builder-toggle-notifications").on("click",this.onNotificationsButtonClicked.bind(this)),t.addHook("notificationsLoaded",this.onNotificationsLoaded.bind(this))},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),s.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})},onNotificationsButtonClicked:function(){t.triggerHook("toggleNotifications")},onNotificationsLoaded:function(){e("body").removeClass("fl-builder-has-new-notifications");var i={action:"fl_builder_notifications",read:!0};t.ajax(i)}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),s.init(),n.init(),r.init(),o.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),o.init(),s.init()},renderPanel:function(t){var l,o,s;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,o=i.create(l),o.init(),s=e(o.render()),o.$el=s,e(".fl-builder--main-menu-panel-views").append(s),o.bindEvents(),o.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),o.isRootView&&(this.rootView=o,this.currentView=o),this.views[t]=o},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),o=l.data("type");switch(o){case"view":var s=l.data("view");this.goToView(s);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var o={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",o="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",o="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+o),t.ajax({action:"save_ui_skin",skin_name:o})}},s={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l)}if(!this.activeView){var o=Object.keys(this.views)[0],l=this.views[o];this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=o;break;case"rows":t=s;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),o=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),s=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),o=i.siblings("button");""!==l?o.show():o.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),o=l.siblings('input[name="template-name"]').val(),s=l.siblings('input[name="template-category"]').val(),n={name:o,category:s};""!==o&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),o=l.data("id"),s=l.data("type");t._requestTemplateInsert(o,s)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","column","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var o=e[l];if(n=i.create(o),n.panel=this,n.views={},n.init(o),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var s=Object.keys(this.tabs)[0],n=this.tabs[s];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,o=null,s=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),o=l[0].getBoundingClientRect(),t=s[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<o.x?20:a-o.x-t.width/2,s.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,o=FLBuilderSettingsConfig.modules,s={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(s,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===o[t.id])return;t=e.extend(!0,t,o[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettingsForChangedCheck(this.config.nodeId,l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),o="",s=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)s=t[n],a=!!s.multiple,supportsResponsive=e.inArray(s.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&s["default"]&&(r=s["default"]),d=s.responsive&&c.responsive_enabled&&!a&&supportsResponsive?s.responsive:null,o+=l({field:s,name:n,rootName:n,value:r,preview:JSON.stringify(s.preview?s.preview:{type:"refresh"}),responsive:d,rowClass:s.row_class?" "+s.row_class:"",isMultiple:a,supportsMultiple:"editor"!==s.type&&"photo"!==s.type&&"service"!==s.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+s.type)});return o},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),o=null,s=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){o=e(this),n.fields.push(o.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(o),s=!0}),l.find(".fl-legacy-settings-section").each(function(){o=e(this),n.sections.push({tab:o.attr("data-tab"),section:o.attr("data-section")}),s=!0}),l.find(".fl-legacy-settings-tab").each(function(){o=e(this),n.tabs.push(o.attr("data-tab")),s=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),s&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),s},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,o=null,s="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),o=l.length?l.find(".fl-builder-settings"):null):(o=e(".fl-builder-settings:visible"),l=o.closest(".fl-builder-lightbox")),o&&o.length){for(s in i.fields)n=e("#fl-field-"+s).attr("id",""),n.after(i.fields[s]).remove();for(s in i.extras)n=e("#fl-field-"+s).find(".fl-field-control-wrapper"),n.prepend(i.extras[s].before),n.append(i.extras[s].after);for(a in i.sections)for(s in i.sections[a])r=e("#fl-builder-settings-section-"+s),r.html(i.sections[a][s]);for(s in i.tabs)a=e("#fl-builder-settings-tab-"+s),a.html(i.tabs[s]);l.data("parent")||(this.settings=FLBuilder._getSettingsForChangedCheck(this.config.nodeId,o),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),o=null,s=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),o=FLBuilder._getSettings(t),s=t.attr("data-node"),s&&(n.node_id=s,n.node_settings=o)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),o=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(o).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),o=l.hasClass("fl-row"),s=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(o?i=e.extend({},this.defaults.row):s?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),o||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),o=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");o.nodes[l].size=parseFloat(t[0].style.width),o.nodes[l].equal_height=i.equal_height,o.nodes[l].content_alignment=i.content_alignment,o.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),o=l.find("[data-node]"),s=e(".fl-node-"+t),n=s.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],o.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){this.initPanel(),this.pinOrUnpin(),this.bind()},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("didPinContentPanel")},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("didUnpinContentPanel")},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),o=t.data("position"),s=e(".fl-builder--content-library-panel"),n=s.outerWidth();"hide"===l?(s.css(o,"-"+n+"px"),i.css("margin-"+o,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(s.css(o,"0px"),i.css("margin-"+o,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"));
9
- },uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),o=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();o.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),o.addClass("fl-builder-content-panel-is-showing"),o.css("margin-"+t,l+"px"),s.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),s=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),o.css("margin-left",""),o.css("margin-right",""),s.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),o=l.find(".fl-lightbox"),s=0,n=0,r=0;o.draggable("enable"),o.resizable("enable"),o.find(".ui-resizable-handle").show(),t.append(l),o.is(":visible")?(s=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),o.css("top",(s<0?0:s)+"px"),o.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),o.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):o.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),o=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",o+"px"),i.css("margin-left",o+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",o+"px"),i.css("margin-right",o+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),o=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||o.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),o=e(".fl-responsive-preview"),s=e(window),n=o.length?o.width():s.width(),r=s.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),o=e(".fl-builder-bar-actions"),s=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),o.removeClass("fl-builder-content-panel-pin-zone"),o.removeClass("fl-builder-content-panel-pin-zone-hover"),s.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?(this.unpin(!0),("module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi)&&n.hide()):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");t.draggable("disable"),t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),o=e(".fl-builder--revision-actions select"),s="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],o.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)s=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),s+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:s,author:n,avatar:i[t[r].author].avatar})}),o.append('<option value="'+t[r].id+'">'+s+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},o=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var s in e.kind)i=e.kind[s],t[i]=FLBuilderConfig.contentItems[i];return o=this.findMatches(e,t),l.library=this.formatResults(o,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,o=null,s=null,n=null,r=null,a=null;for(l in t){o=t[l],i[l]={items:[]};for(a in o)if(s=o[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(s.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,s.content),r=e.content===s.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==s.type)continue;if(!_.isNull(e.group)){var d=e.group,u=s.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&s.group.length>0)continue;if(e.group!==!1&&!_.contains(s.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(s,e.searchTerm))&&i[l].items.push(s)}}return i},matchesCategory:function(e,t){var i,l,o,s,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(o in e)if(s=e[o],s===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,o=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(o))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(o))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(o))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(o))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(o)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(o))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,o={};return _.forEach(e,function(e,s,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(o[i]=o[i]||[],o[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){o[t]=o[t]||[],o[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){o[t]=o[t]||[],o[t].push(e)})))}),o},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var o={};for(var s in i.library.module.items){var n=i.library.module.items[s],r=n.group[0],a=n.category;n.name;_.isUndefined(o[r])&&(o[r]={}),_.isUndefined(o[r][a])&&(o[r][a]=[]),o[r][a].push(n)}l.grouped=o}for(var s in i.library){var d=i.library[s];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[s]={name:FLBuilderStrings.typeLabels[s],handle:s,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--saving-indicator"),t.addHook("didBeginAJAX",this.onLayoutSaving.bind(this)),t.addHook("didCompleteAJAX",this.onLayoutSaved.bind(this)),t.addHook("didPublishLayout",this.onLayoutPublished.bind(this)),t.addHook("publishAndRemain",this.onPublishAndRemain.bind(this)),t.addHook("didShowLightbox",this.setLayoutNeedsPublish.bind(this)),!FLBuilderConfig.layoutHasDraftedChanges&&FLBuilderConfig.builderEnabledd||(this.setLayoutNeedsPublish(),this.resetStatusMessage())},setLayoutNeedsPublish:function(){this.layoutNeedsPublish||(this.layoutNeedsPublish=!0,e("body").addClass("fl-builder--layout-has-drafted-changes"))},onLayoutSaving:function(e,t){this.isPublishingLayout(t.action)?this.showStatusMessage(this.messages.publishing,this.messages.publishingTooltip):this.isUpdatingLayout(t.action)&&(this.setLayoutNeedsPublish(),this.showStatusMessage(this.messages.saving,this.messages.savingTooltip))},isPublishingLayout:function(e){return"save_layout"==e},isUpdatingLayout:function(e){return!this.isPublishingLayout()&&(e.startsWith("render")?!!e.startsWith("render_new"):!e.startsWith("duplicate")&&(!e.startsWith("refresh")&&("save_ui_skin"!=e&&("save_lightbox_position"!=e&&("save_pinned_ui_position"!=e&&"fl_builder_notifications"!=e)))))},onLayoutSaved:function(e,t){if(this.isUpdatingLayout(t.fl_builder_data.action)){this.showStatusMessage(this.messages.saved,this.messages.savedTooltip);var i=this;setTimeout(function(){i.resetStatusMessage()},2e3)}},onLayoutPublished:function(){this.layoutNeedsPublish=!1,e("body").removeClass("fl-builder--layout-has-drafted-changes"),this.resetStatusMessage()},showStatusMessage:function(t,i){this.$savingIndicator.html(t),_.isUndefined(i)||(this.$savingIndicator.attr("title",i),e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}))},resetStatusMessage:function(){this.layoutNeedsPublish?(this.defaultIndicatorMessage=this.messages.edited+'<i class="fas fa-question-circle"></i>',this.defaultTooltipMessage=this.messages.editedTooltip):(this.defaultIndicatorMessage="",this.defaultTooltipMessage=""),this.showStatusMessage(this.defaultIndicatorMessage,this.defaultTooltipMessage)},onPublishAndRemain:function(){if(this.layoutNeedsPublish)t._publishLayout(!1);else{this.showStatusMessage(this.messages.noChanges);var e=this;setTimeout(function(){e.resetStatusMessage()},2e3)}}};t.SaveManager={layoutNeedsPublish:function(){return i.layoutNeedsPublish},showStatusMessage:function(e,t){i.showStatusMessage(e,t)},resetStatusMessage:function(){i.resetStatusMessage()}},e(function(){i.init()})}(jQuery,FLBuilder);
1
+ var FLBuilderColorPicker;!function(e,t){function i(){var t,i,l="backgroundImage";h?f="filter":(t=e('<div id="iris-gradtest" />'),i="linear-gradient(top,#fff,#000)",e.each(g,function(e,o){if(t.css(l,o+i),t.css(l).match("gradient"))return f=e,!1}),f===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(f="webkit")),t.remove())}function l(t,i){return t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),"webkit"===f?s(t,i):g[f]+"linear-gradient("+t+", "+i.join(", ")+")"}function o(t,i){var l,o,s,r,a,d,u,c,h;t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),l="top"===t?0:1,o=e(this),s=i.length-1,r="filter",a=1===l?"left":"top",d=1===l?"right":"bottom",u=1===l?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+r+':%filter%;" data-color:"%color%"></div>',h="","static"===o.css("position")&&o.css({position:"relative"}),i=n(i),e.each(i,function(e,t){var o,n,r;return e!==s&&(o=i[e+1],void(t.stop!==o.stop&&(n=100-parseFloat(o.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),o.octoHex=new Color(o.color).toIEOctoHex(),r="progid:DXImageTransform.Microsoft.Gradient(GradientType="+l+", StartColorStr='"+t.octoHex+"', EndColorStr='"+o.octoHex+"')",h+=c.replace("%start%",t.stop).replace("%end%",n).replace("%filter%",r))))}),o.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(o)}function s(t,i){var l=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",i=n(i),e.each(i,function(e,t){l.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+l.join(",")+")"}function n(t){var i=[],l=[],o=[],s=t.length-1;return e.each(t,function(e,t){var o=t,s=!1,n=t.match(/1?[0-9]{1,2}%$/);n&&(o=t.replace(/\s?1?[0-9]{1,2}%$/,""),s=n.shift()),i.push(o),l.push(s)}),l[0]===!1&&(l[0]="0%"),l[s]===!1&&(l[s]="100%"),l=r(l),e.each(l,function(e){o[e]={color:i[e],stop:l[e]}}),o}function r(t){var i,l,o,s,n=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(n=d-1,u=!0),d++;for(l=a-n,s=parseInt(t[n].replace("%"),10),i=(parseFloat(t[a].replace("%"))-s)/l,d=n+1,o=1;d<a;)t[d]=s+o*i+"%",o++,d++;return r(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,h=u&&c<10,f=!1,g=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),i=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,l=i<100;return{value:t,alpha:i,rgba:l}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){h?o.apply(this,t):e(this).css("backgroundImage",l.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,i){var l,o,s,n;for(t=t||"top",l=e.extend({},{s:100,l:50},i),o="hsl(%h%,"+l.s+"%,"+l.l+"%)",s=0,n=[];s<=360;)n.push(o.replace("%h%",s)),s+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,n)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="javascript:void(0);"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var i={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},i,t),(h===!1||h===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,f===!1&&i(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var i=e(this),l=i.val(),o=i.parent().find(".fl-color-picker-color"),s=flBuilderParseColorValue(l),n="";if(l){if(o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba)n=i.val().toString();else if(!o.hasClass("fl-color-picker-alpha-enabled")&&s.rgba){var r=l.replace("rgba","rgb");r=r.substr(0,r.lastIndexOf(","))+")",t._color._alpha=1,n=r,i.val(r)}else n="#"+i.val().toString();o.css({backgroundColor:n})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,i){var l=!1;return e.each(i,function(e,i){if(t===i)return l=!0,!1}),l},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,i){t._addPresetView(i)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var i=this._presetsList.find(".fl-color-picker-no-preset");i.length>0&&i.remove();var l=e(this._presetsTpl),o=Color(t);l.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:o.toString()}).end().find(".fl-color-picker-preset-label").html(o.toString()),this._presetsList.append(l)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:i,collision:"flipfit",using:function(e,i){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),i.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("mousedown",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,i=t._ui.find(".fl-color-picker-preset-add"),l=t._ui.find(".fl-color-picker-presets"),o=l.find(".fl-color-picker-presets-open-label"),s=l.find(".fl-color-picker-presets-close-label"),n=l.find(".fl-color-picker-presets-list");i.off("click").on("click",function(){t._addPreset(t.element.val())}),n.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),l.off("click").on("click",".fl-color-picker-presets-toggle",function(){o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset",function(i){var l=new Color(e(this).data("color").toString());t._setColor(l),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:l.toString()}).removeClass("fl-color-picker-empty"),o.toggleClass("fl-color-picker-active"),s.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(i){i.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var i=t.toString(),l=a.indexOf(i);l>-1&&(a.splice(l,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+i+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var i=t.toString().replace(/^#/,"");""===i?alert(this.options.labels.noneColorSelected):a.indexOf(i)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+i)):(this._addPresetView(i),this._addPresetFeedback(),a.push(i),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var i,l=this,o=l._color,s=l.options.mode,n=l._getHSpaceColor(),r=l.controls[t],a=l.options.controls;if(t!==l.active&&("square"!==l.active||"strip"===t))switch(a[t]){case"h":if("hsv"===s){switch(n=o.clone(),t){case"horiz":n[a.vert](100);break;case"vert":n[a.horiz](100);break;case"strip":n.setHSpace("hsl")}i=n.toHsl()}else i="strip"===t?{s:n.s,l:n.l}:{s:100,l:n.l};r.flBuilderColorPickerRaninbowGradient(e,i);break;case"s":"hsv"===s?"vert"===t?i=[o.clone().a(0).s(0).toCSS("rgba"),o.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?i=[o.clone().s(100).toCSS("hsl"),o.clone().s(0).toCSS("hsl")]:"horiz"===t&&(i=["#fff","hsl("+n.h+",100%,50%)"]):i="vert"===t&&"h"===l.options.controls.horiz?["hsla(0, 0%, "+n.l+"%, 0)","hsla(0, 0%, "+n.l+"%, 1)"]:["hsl("+n.h+",0%,50%)","hsl("+n.h+",100%,50%)"],r.flBuilderColorPickerGradient(e,i);break;case"l":i="strip"===t?["hsl("+n.h+",100%,100%)","hsl("+n.h+", "+n.s+"%,50%)","hsl("+n.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],r.flBuilderColorPickerGradient(e,i);break;case"v":i="strip"===t?[o.clone().v(100).toCSS(),o.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],r.flBuilderColorPickerGradient(e,i)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,i=this,l=i.options,o=i.controls,s=o.square,n=i.picker.find(".iris-strip"),r="77.5%",a="12%",d=20,u=l.border?l.width-d:l.width;if(e&&(s.css("width",""),n.css("width",""),i.picker.css({width:"",height:""})),r=u*(parseFloat(r)/100),a=u*(parseFloat(a)/100),t=l.border?r+d:r,s.width(r).height(r),n.height(r).width(a),i.picker.css({width:l.width,height:t}),!l.palettes)return i.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,i=100,l=function(i){var l=new Color(e.val()),o=e.val().replace(/^#/,""),s=t._currentElement.hasClass("fl-color-picker-empty");if(e.removeClass("iris-error"),l.error)""!==o&&e.addClass("iris-error");else if(l.toString()!==t._color.toString()||""!==t._color.toString()&&s)if("keyup"===i.type){if(o.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(o),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(o).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change")}else if("paste"===i.type)return o=i.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(o).toString(),t._setColor(o),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(o).trigger("change"),!1};e.on("change",l).on("keyup",t._debounce(l,i))},_initControls:function(){var t=this,i=t.controls,l=i.square,o=t.options.controls,s=t._scale[o.strip];i.stripSlider.slider({orientation:"horizontal",max:s,slide:function(e,i){t.active="strip","h"===o.strip&&(i.value=s-i.value),t._color[o.strip](i.value),t._change.apply(t,arguments)}}),i.squareDrag.draggable({containment:i.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,i){t._squareDrag(e,i)},start:function(){l.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){l.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(i){var l="ui-state-focus";i.preventDefault(),"mousedown"===i.type?(t.picker.find("."+l).removeClass(l).blur(),e(this).addClass(l).focus()):e(this).removeClass(l)}).on("keydown",function(e){var l=i.square,o=i.squareDrag,s=o.position(),n=2;switch(e.altKey&&(n*=10),e.keyCode){case 37:s.left-=n;break;case 38:s.top-=n;break;case 39:s.left+=n;break;case 40:s.top+=n;break;default:return!0}s.left=Math.max(0,Math.min(s.left,l.width())),s.top=Math.max(0,Math.min(s.top,l.height())),o.css(s),t._squareDrag(e,{position:s}),e.preventDefault()}),l.mousedown(function(i){var l,o;1===i.which&&e(i.target).is("div")&&(l=t.controls.square.offset(),o={top:i.pageY-l.top,left:i.pageX-l.left},i.preventDefault(),t._squareDrag(i,{position:o}),i.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(o).trigger(i))})},_squareDrag:function(e,t){var i=this,l=i.options.controls,o=i._squareDimensions(),s=Math.round((o.h-t.position.top)/o.h*i._scale[l.vert]),n=i._scale[l.horiz]-Math.round((o.w-t.position.left)/o.w*i._scale[l.horiz]);i._color[l.horiz](n)[l.vert](s),i.active="square",i._change.apply(i,arguments)},_setColor:function(e){var t,i,l=this,o=l.options.color;l.options.color=e,e=""+e,t=e.replace(/^#/,""),i=new Color(e).setHSpace(l.options.mode),i.error?l.options.color=o:(l._color=i,l.options.color=l._color.toString(),l.active="external",l._change())},_squareDimensions:function(e){var i,l,o=this.controls.square;return e!==t&&o.data("dimensions")?o.data("dimensions"):(l=this.controls.squareDrag,i={w:o.width(),h:o.height()},o.data("dimensions",i),i)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,i=t.controls,l=t._getHSpaceColor(),o=["square","strip"],s=t.options.controls,n=s[t.active]||"external",r=t.hue;"strip"===t.active?o=[]:"external"!==t.active&&o.pop(),e.each(o,function(e,o){var n,r,a;if(o!==t.active)switch(o){case"strip":n="h"===s.strip?t._scale[s.strip]-l[s.strip]:l[s.strip],i.stripSlider.slider("value",n);break;case"square":r=t._squareDimensions(),a={left:l[s.horiz]/t._scale[s.horiz]*r.w,top:r.h-l[s.vert]/t._scale[s.vert]*r.h},t.controls.squareDrag.css(a)}}),l.h!==r&&t._isNonHueControl(t.active,n)&&t._color.h(r),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,i){var l,o;return function(){var s,n,r=this,a=arguments;return s=function(){l=null,i||(o=e.apply(r,a))},n=i&&!l,clearTimeout(l),l=setTimeout(s,t),n&&(o=e.apply(r,a)),o}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement.val();i.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t.picker.addClass("fl-color-alpha-enabled"),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,i=flBuilderParseColorValue(t.val()),l=parseFloat(i.alpha/100),o=e._wrapper,s=e._ui,n=s.find(".fl-alpha-wrap"),r=n.find(".fl-alpha-slider"),a=n.find(".fl-alpha-text"),d=n.find(".fl-alpha-slider-offset");alphaHandle=n.find(".ui-slider-handle"),a.text(l<1?l:""),r.slider({orientation:"vertical",slide:function(t,i){var l=parseFloat(i.value/100);e._color._alpha=l,a.text(l<1?l:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:i.value}),o.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),r.slider("value",100).trigger("slide")})},value:i.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var i=function(e,t){return this instanceof i?this._init(e,t):new i(e,t)};i.fn=i.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var i="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),i=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":i,this[i](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new i(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],l=t.length-1;l>=0;l--)e[t[l]]=this[t[l]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,i=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(i)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(i,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var l=t.length-1;l>=0;l--)if(t[l]=parseInt(t[l],10),isNaN(t[l]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,i){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),i))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var i,l,o,s,n,r,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",r=e.h/360,a=e.s/100,d=e.l/100,0===a?i=l=o=d:(s=d<.5?d*(1+a):d+a-d*a,n=2*d-s,i=this.hue2rgb(n,s,r+1/3),l=this.hue2rgb(n,s,r),o=this.hue2rgb(n,s,r-1/3)),this.fromRgb({r:255*i,g:255*l,b:255*o},!0))},fromHsv:function(e){var i,l,o,s,n,r,a,d,u,c,h;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",i=e.h/360,l=e.s/100,o=e.v/100,a=Math.floor(6*i),d=6*i-a,u=o*(1-l),c=o*(1-d*l),h=o*(1-(1-d)*l),a%6){case 0:s=o,n=h,r=u;break;case 1:s=c,n=o,r=u;break;case 2:s=u,n=o,r=h;break;case 3:s=u,n=c,r=o;break;case 4:s=h,n=u,r=o;break;case 5:s=o,n=u,r=c}return this.fromRgb({r:255*s,g:255*n,b:255*r},!0)},fromInt:function(e,i){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),i===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var i=this.toRgb();return t<1?"rgba( "+i.r+", "+i.g+", "+i.b+", "+t+" )":"rgb( "+i.r+", "+i.g+", "+i.b+" )";case"hsl":case"hsla":var l=this.toHsl();return t<1?"hsla( "+l.h+", "+l.s+"%, "+l.l+"%, "+t+" )":"hsl( "+l.h+", "+l.s+"%, "+l.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,i=this.toRgb(),l=i.r/255,o=i.g/255,s=i.b/255,n=Math.max(l,o,s),r=Math.min(l,o,s),a=(n+r)/2;if(n===r)e=t=0;else{var d=n-r;switch(t=a>.5?d/(2-n-r):d/(n+r),n){case l:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-l)/d+2;break;case s:e=(l-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,i=this.toRgb(),l=i.r/255,o=i.g/255,s=i.b/255,n=Math.max(l,o,s),r=Math.min(l,o,s),a=n,d=n-r;if(t=0===n?0:d/n,n===r)e=t=0;else{switch(n){case l:e=(o-s)/d+(o<s?6:0);break;case o:e=(s-l)/d+2;break;case s:e=(l-o)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof i))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),l=e.toLuminosity();return t>l?(t+.05)/(l+.05):(l+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new i(t)},getReadableContrastingColor:function(e,l){if(!(e instanceof i))return this;var o=l===t?5:l,s=e.getDistanceLuminosityFrom(this),n=e.getMaxContrastColor(),r=n.getDistanceLuminosityFrom(e);if(r<=o)return n;if(s>=o)return this;for(var a=0===n.toInt()?-1:1;s<o&&(this.l(a,!0),s=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var i=parseFloat(e);return isNaN(i)?this._error():(this._alpha=i,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var i=l[e];return function(l,o){var s=this._spaceFunc("to",i.space);return l===t?s[e]:(o===!0&&(l=s[e]+l),i.mod&&(l%=i.mod),i.range&&(l=l<i.range[0]?i.range[0]:l>i.range[1]?i.range[1]:l),s[e]=l,this._spaceFunc("from",i.space,s))}},_spaceFunc:function(e,t,i){var l=t||this._hSpace,o=e+l.charAt(0).toUpperCase()+l.substr(1);return this[o](i)}};var l={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var o in l)l.hasOwnProperty(o)&&(i.fn[o]=i.fn._partial(o));"object"==typeof exports?module.exports=i:e.Color=i}(this),function(e){FLLightbox=function(e){this._init(e)},FLLightbox.closeParent=function(t){var i=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");_.isUndefined(i)||FLLightbox._instances[i].close()},FLLightbox.getResizableControlClass=function(){var t=e(".fl-lightbox-resizable").eq(0),i="far fa-window-maximize";return t.length&&t.hasClass("fl-lightbox-width-full")&&(i="far fa-window-minimize"),i},FLLightbox.unbindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._unbind()},FLLightbox.bindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._bind()},FLLightbox.closeAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_allowClosing:!0,_resizeTimer:null,_defaults:{className:"",destroyOnClose:!1,resizable:!1},open:function(e){var t=this._node.find(".fl-lightbox"),i=t.closest(".fl-builder-ui-pinned").length,l=this._getPositionSettings();!i&&l&&t.css(l),this._bind(),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open"),FLBuilder.triggerHook("didShowLightbox",this)},close:function(){var e=this._node.data("parent");this._allowClosing&&(this.trigger("beforeCloseLightbox"),this._unbind(),this._node.hide(),this._visible=!1,this.trigger("close"),FLBuilder.triggerHook("didHideLightbox"),this._defaults.resizable&&_.isUndefined(e)&&FLBuilder.triggerHook("didHideAllLightboxes"),this._defaults.destroyOnClose&&this.destroy())},disableClose:function(){this._allowClosing=!1},enableClose:function(){this._allowClosing=!0},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty()},on:function(e,t){this._node.on(e,t)},off:function(e,t){this._node.off(e,t)},trigger:function(e,t){this._node.trigger(e,t)},destroy:function(){this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(e){}},_init:function(t){var i=0,l=null;for(l in FLLightbox._instances)i++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+i,FLLightbox._instances[this._id]=this,this._render(),this._resizable()},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,this._delayedResize.bind(this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_resizable:function(){var t=(e("body"),this._node.find(".fl-lightbox-mask")),i=this._node.find(".fl-lightbox"),l=e(".fl-lightbox-resizable").eq(0);this._defaults.resizable?(t.hide(),i.addClass("fl-lightbox-resizable"),i.delegate(".fl-lightbox-resize-toggle","click",this._resizeClicked.bind(this)),i.draggable({cursor:"move",handle:".fl-lightbox-header"}).resizable({handles:"all",minHeight:500,minWidth:380,start:this._resizeStart.bind(this),stop:this._resizeStop.bind(this)}),l.length&&l.hasClass("fl-lightbox-width-full")?(i.addClass("fl-lightbox-width-full"),i.draggable("disable")):this._restorePosition()):t.show(),this._resize()},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(this._resize.bind(this),250)},_resize:function(){var t=this._node.find(".fl-lightbox"),i=parseInt(this._node.css("padding-top")),l=parseInt(this._node.css("padding-bottom")),o=parseInt(this._node.css("padding-left")),s=parseInt(this._node.css("padding-right")),n=t.height(),r=t.width(),a=e(window),d=a.height()-i-l,u=(a.width()-o-s,"0px");this._defaults.resizable?(r<600?t.addClass("fl-lightbox-width-slim"):t.removeClass("fl-lightbox-width-slim"),this._resizeEditors()):(d>n&&(u=(d-n-46)/2+"px"),t.attr("style","").css("margin",u+" auto 0")),this.trigger("resized")},_resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),e(".fl-builder-lightbox:visible").append('<div class="fl-builder-resizable-iframe-fix"></div>'),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},_resizeStop:function(t,i){var l=e(".fl-lightbox-resizable:visible");parseInt(l.css("top"))<0&&l.css("top","0"),this._savePosition(),e("body").removeClass("fl-builder-resizable-is-resizing"),e(".fl-builder-resizable-iframe-fix").remove(),FLBuilder._bindOverlayEvents()},_resizeClicked:function(){var t=e(".fl-lightbox-resizable"),i=(t.find(".fl-lightbox-resize-toggle"),this._node.find(".fl-lightbox"));i.hasClass("fl-lightbox-width-full")?this._resizeExitFull():this._resizeEnterFull(),this._resize()},_resizeEnterFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-maximize").addClass("fa-window-minimize"),t.addClass("fl-lightbox-width-full"),t.draggable("disable"),t.resizable("disable")},_resizeExitFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-minimize").addClass("fa-window-maximize"),t.removeClass("fl-lightbox-width-full"),t.draggable("enable"),t.resizable("enable")},_resizeEditors:function(){e(".fl-lightbox-resizable").each(function(){var t=e(this),i=t.find(".fl-builder-settings-fields").height(),l=t.find(".mce-edit-area > iframe, textarea.wp-editor-area, .ace_editor"),o=null;i<350&&(i=350),l.each(function(){o=e(this),o.hasClass("ace_editor")?(o.height(i-60),o.closest(".fl-field").data("editor").resize()):o.closest(".mce-container-body").find(".mce-toolbar-grp .mce-toolbar.mce-last").is(":visible")?o.height(i-175):o.height(i-150)})})},_savePosition:function(){var e=this._node.find(".fl-lightbox"),t={width:e.width(),height:e.height(),top:parseInt(e.css("top"))<0?"0px":e.css("top"),left:e.css("left")};e.closest(".fl-builder-ui-pinned").length||(FLBuilderConfig.userSettings.lightbox=t,FLBuilder.ajax({action:"save_lightbox_position",data:t}))},_restorePosition:function(){var e=this._node.find(".fl-lightbox"),t=this._getPositionSettings();t?e.css(t):e.css({top:25,left:FLBuilderConfig.isRtl?"-25":25})},_getPositionSettings:function(){var t=FLBuilderConfig.userSettings.lightbox;if(!t)return!1;var i=e(window).height(),l=parseInt(t.height);return l>i&&i>546&&(t.height=i-50,
2
+ t.top=0),t}}}(jQuery),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,i){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(i)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0,FLBuilder.addHook("endEditingSession",function(){FLIconSelector._lightbox.close()})},_getContentComplete:function(t){var i=JSON.parse(t);FLIconSelector._content=i.html,FLIconSelector._lightbox.setContent(i.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),i=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=i,""!==i?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,i){for(var l=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,o=null,s=0;s<l.length;s++)l[s].selectorText.toLowerCase()==e.toLowerCase()&&(o=l[s]);if(o)if("object"==typeof t)for(s in t)o.style[this._toCamelCase(s)]=t[s];else o.style[this._toCamelCase(t)]=i;else this.addRule(e,t,i)},addRule:function(e,t,i){var l="",o="";if("object"==typeof t)for(o in t)l+=o+":"+t[o]+";";else l=t+":"+i+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+l+" }",this._sheet.cssRules.length):this._sheet.addRule(e,l)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"",i=this.className?' class="'+this.className+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+i+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColParent:null,_newColPosition:0,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._initTinyMCE(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder.addHook("didInitUI",FLBuilder._showTourOrTemplates.bind(FLBuilder)),FLBuilder.triggerHook("init")},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(t){return jQuery.fn.oldReady(function(){try{"function"==typeof t&&t(e)}catch(i){FLBuilder.logError(i)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,i,l,o){return FLBuilder.logGlobalError(e,t,i,l,o),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:FLBuilderConfig.postId}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId,e(FLBuilder._contentClass).addClass("fl-builder-content-editing")},_initMediaUploader:function(){wp.media.model.settings.post.id=FLBuilderConfig.postId},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:85,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},i="",l="",o="";o="row"==FLBuilderConfig.userTemplateType||"column"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col:not(.fl-node-global) .fl-col-content",l="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",i=FLBuilderConfig.nestedColumns?o:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-columns").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:l,items:".fl-builder-block-saved-column",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:o,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:o,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:o,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:o,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:o,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){$excludedLinks=e(".fl-builder-bar a, .fl-builder--content-library-panel a, .fl-page-nav .nav a"),e("a").not($excludedLinks).on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e("body").delegate(".fl-builder-content a","click",FLBuilder._preventDefault),e("body").delegate("button.fl-builder-button","mouseup",this._buttonMouseUp.bind(this)),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-block-overlay","contextmenu",FLBuilder._onContextmenu),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-row-reset","click",FLBuilder._resetRowWidthClicked),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-copy","click",FLBuilder._copyColClicked),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay .fl-block-settings","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-col-settings","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-tabs a","show",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-tabs a","hide",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-builder-settings-tabs-overflow-menu > a","click",FLBuilder._settingsTabsToOverflowMenuItemClicked.bind(this)),e("body").delegate(".fl-builder-settings-tabs-more","click",FLBuilder._toggleTabsOverflowMenu.bind(this)),e("body").delegate(".fl-builder-settings-tabs-overflow-click-mask","click",FLBuilder._hideTabsOverflowMenu.bind(this)),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-remove","click",FLBuilder._singleVideoRemoved),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-data-source-select select[name=data_source]","change",FLBuilder._loopDataSourceChange),e("body").delegate(".fl-custom-query select[name=post_type]","change",FLBuilder._customQueryPostTypeChange),e("body").delegate(".fl-field input[type=number]","focus",FLBuilder._onNumberFieldFocus),e("body").delegate(".fl-field input[type=number]","blur",FLBuilder._onNumberFieldBlur),FLBuilder.addHook("didCompleteAJAX",FLBuilder._refreshSettingsPreviewReference),FLBuilder.addHook("didRenderLayoutComplete",FLBuilder._refreshSettingsPreviewReference)},_unbindEvents:function(){e("a").off("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").off("click",FLBuilder._headerLinkClicked),e("body").undelegate(".fl-builder-content a","click",FLBuilder._preventDefault)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_onContextmenu:function(t){e(this).hide()},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var i=e(this),l=i.attr("href");this.hash||(t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=l.indexOf("?")>-1?l:l+"?fl_builder",FLBuilder.triggerHook("triggerDone")))},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,i=e(".fl-builder-col-settings").length>0,l=e(".fl-builder-module-settings").length>0;if(t||i||l)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1e3})},_hideTipTips:function(){e("#tiptip_holder").stop().hide()},_submenuParentClicked:function(t){var i=e("body"),l=e(this),o=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+o.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),i.addClass("fl-builder-submenu-open"),l.addClass("fl-builder-submenu-open")),o.closest(".fl-row-overlay").addClass("fl-row-menu-active"),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var i=e("body"),l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"))},_submenuMouseenter:function(t){var i=e(this),l=i.data("timeout");"undefined"!=typeof l&&clearTimeout(l)},_submenuMouseleave:function(t){var i=e("body"),l=e(this),o=setTimeout(function(){i.removeClass("fl-builder-submenu-open"),l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.closest(".fl-row-overlay").removeClass("fl-row-menu-active"),l.data("timeout",o)},_submenuNestedParentMouseenter:function(t){var i=e(this),l=i.find(".fl-builder-submenu");i.width()+i.offset().left+l.width()>e(window).width()&&i.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_buttonMouseUp:function(t){e(t.currentTarget).blur()},_closePanel:function(){FLBuilder.triggerHook("hideContentPanel")},_showPanel:function(){FLBuilder.triggerHook("showContentPanel")},_togglePanel:function(){FLBuilder.triggerHook("toggleContentPanel")},_blockSectionTitleClicked:function(){var t=e(this),i=t.parent();i.hasClass("fl-active")?i.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),i.addClass("fl-active")),FLBuilder._initScrollbars()},_publishLayout:function(e){if(FLBuilder._triggerSettingsSave(!1,!0)){if(_.isUndefined(e))var e=!0;FLBuilder.ajax({action:"save_layout"},this._onPublishComplete.bind(this,e))}},_publishButtonClicked:function(e){FLBuilder._publishLayout(e)},_onPublishComplete:function(t){t&&(FLBuilderConfig.shouldRefreshOnPublish?FLBuilder._exit():FLBuilder._exitWithoutRefresh()),e("#wp-admin-bar-fl-builder-frontend-edit-link .fl-builder-admin-bar-status-dot").css("color","#6bc373"),FLBuilder.triggerHook("didPublishLayout")},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit)},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e?(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit)):FLBuilder.triggerHook("didCancelDiscard")},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_exitWithoutRefresh:function(){window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):FLBuilder.triggerHook("endEditingSession")},_duplicateLayoutClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(e){var t=FLBuilderConfig.adminUrl;window.location.href=t+"post.php?post="+e+"&action=edit"},_layoutSettingsClicked:function(){FLBuilderSettingsForms.render({id:"layout",className:"fl-builder-layout-settings",settings:FLBuilderSettingsConfig.settings.layout},function(){FLBuilder._layoutSettingsInitCSS()})},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),i=e(this),l=i.parents("#fl-field-css");l.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(i.val()):e("#fl-builder-global-css").html(i.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),i=t.serializeArray(),l={},o=0;o<i.length;o++)l[i[o].name]=i[o].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:l},function(){FLBuilder.triggerHook("didSaveLayoutSettingsComplete",l),FLBuilder._updateLayout()})},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilderSettingsForms.render({id:"global",className:"fl-builder-global-settings",settings:FLBuilderSettingsConfig.settings.global},function(){FLBuilder._layoutSettingsInitCSS()})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:l},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close())},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder.triggerHook("didSaveGlobalSettingsComplete",FLBuilderConfig.global),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row"),i=t.length>0;i||FLBuilder.ContentPanel.show("modules")},_requestTemplateInsert:function(e,t){FLBuilder.layoutHasContent()?0==e?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,t)):(FLBuilder._selectedTemplateId=e,FLBuilder._selectedTemplateType=t,FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(e,!1,t)},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder.triggerHook("showContentPanel")},_applyTemplate:function(e,t,i){t="undefined"!=typeof t&&t?"1":"0",i="undefined"==typeof i?"core":i,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==i?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._applyTemplateComplete):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._applyUserTemplateComplete),FLBuilder.triggerHook("didApplyTemplate")},_applyTemplateComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didApplyTemplateComplete",t.config)},_applyUserTemplateComplete:function(t){var i=JSON.parse(t);null!==i.layout_css&&e("#fl-builder-layout-css").html(i.layout_css),FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didApplyTemplateComplete",i.config)},_saveUserTemplateClicked:function(){FLBuilderSettingsForms.render({id:"user_template",className:"fl-builder-user-template-settings",rules:{name:{required:!0}}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.ajax({action:"save_user_template",settings:l},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(e){if(e){var e=JSON.parse(e);FLBuilderConfig.contentItems.template.push(e),FLBuilder.triggerHook("contentItemsChanged")}},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var i=e(this).closest(".fl-user-template"),l=i.attr("data-id"),o=(e(".fl-user-template[data-id="+l+"]"),null),s=null,n=null;if(confirm(FLBuilderStrings.deleteTemplate)){
3
+ FLBuilder.ajax({action:"delete_user_template",template_id:l});for(s in FLBuilderConfig.contentItems.template)n=FLBuilderConfig.contentItems.template[s],n.postId==l&&(o=s);_.isNull(o)||(FLBuilderConfig.contentItems.template.splice(o,1),FLBuilder.triggerHook("contentItemsChanged"))}t.stopPropagation()},_viewKnowledgeBaseClicked:function(){window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||FLBuilderConfig.isUserTemplate&&"column"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),t.find(".fl-row, .fl-builder-block").length||(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",l=e(FLBuilder._contentClass+" .fl-row"),o=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),n=null,r=null,a="column"==FLBuilderConfig.userTemplateType?e(FLBuilder._contentClass+"> .fl-col").eq(0):null;for(i=0,e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),l.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),l.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');i<l.length;i++)o=l.eq(i),0===o.find(".fl-col-group").length&&o.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(a&&0===s.length&&(s=a.find(".fl-col-group"),a.append('<div class="fl-drop-target fl-col-drop-target"></div>'),a.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')),i=0;i<s.length;i++)n=s.eq(i),r=n.find("> .fl-col"),n.hasClass("fl-col-group-nested")||(n.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),r.append('<div class="fl-drop-target fl-col-drop-target"></div>'),r.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,o=e(window).scrollTop(),s=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=o,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-o>0&&(l=e(this))}),null!==l&&(s=l.offset().top-o),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._disableGlobalCols(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),s>0&&scrollTo(0,l.offset().top-s),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),o=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?o=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?o="":l.hasClass("fl-col-group-drop-target")?o="":l.hasClass("fl-row-drop-target")&&(o=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-column")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(o),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,o=t.hasClass("fl-builder-block-row"),s=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(o||s)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(o&&"1-col"==t.data("cols")?l=!0:s&&(l=!0)),o&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),s&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),o=i.item.parent(),s=null;o.hasClass("fl-drop-target")&&o.closest("[data-node]").length?(o=o.closest("[data-node]"),s=o.offset().top-l):s=o.offset().top-l,o.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._enableGlobalCols(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,o.offset().top-s),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,o=e.hasClass("fl-row"),s=o?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(s.css("margin-top"),10),bottom:parseInt(s.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,o=null,s=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,o=t.find(" > i, > span.fl-builder-has-submenu");r<o.length;r++)n=o.eq(r),s+=Math.floor(n[0].getBoundingClientRect().width),s>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(a.length>0&&d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa, .fas, .far").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_disableGlobalCols:function(){"column"!=FLBuilderConfig.userTemplateType&&e(".fl-row:not(.fl-node-global) .fl-col.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_enableGlobalCols:function(){"column"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,o=null,s=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(o=FLBuilder._appendOverlay(t,s({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&o.css("top",l-i-30+"px"),o.offset().top<43&&o.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(o))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),o=i.closest(".fl-row-overlay").length>0,s=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||o||s||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),o=i.closest(".fl-row");o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),o=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),o.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,o=l.parent(),s=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),o.hasClass("fl-builder-rows"))return void l.remove();if(o.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):o.hasClass("fl-col-drop-target")?FLBuilder._addCols(o.closest(".fl-col"),o.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),o.closest(".fl-col-group-nested").length>0):o.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),o.hasClass("fl-drop-target-last")?r+1:r)):(s=l.closest(".fl-row"),r=s.length?e(FLBuilder._contentClass+" > .fl-row").index(s):0,FLBuilder._addRow(l.attr("data-cols"),o.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else s=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o.parent().hasClass("fl-builder-content")||(o.hasClass("fl-drop-target-last")?o.parent().after(s):o.parent().before(s),FLBuilder._reorderNode(s.attr("data-node"),s.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),o=e(i.html).data("node"),s=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==s&&(e(".fl-node-"+o+" .fl-col-content").append(s),FLBuilder._reorderModule(s),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+o)),FLBuilder.triggerHook("didAddRow",o)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),o=e(FLBuilder._contentClass+" > .fl-row").index(i)+1,s=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),e("html, body").animate({scrollTop:s.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=o,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),o=i.closest(".fl-block-overlay-global").length>0,s=null;o&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(s=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),s.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:o||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),o=l.attr("data-node"),s=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),s.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:o,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",o),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType||"column"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";"column"==FLBuilderConfig.userTemplateType&&(i=":not(:first)"),e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i="column"==FLBuilderConfig.userTemplateType?"":".fl-col:not(.fl-node-global) ",l=e(FLBuilder._contentClass),o=l.find(t+".fl-col-group:not(.fl-col-group-nested) > "+i+"> .fl-col-content"),s=l.find(t+".fl-col-group-nested "+i+".fl-col-content"),n=0;for(e(".fl-node-drag-init").hide();n<s.length;n++)FLBuilder._adjustColHeightForDrag(s.eq(n));for(n=0;n<o.length;n++)FLBuilder._adjustColHeightForDrag(o.eq(n));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),o=l.parents(".fl-col"),s=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=o),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(s),l.addClass("fl-col-has-highlight-guide"),n=s.offset().top,n>r&&s.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),o=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.find(".fl-module").length>0,h=t.parents(".fl-col"),f=h.closest(".fl-col-group"),g=h.length>0,p="undefined"!=typeof t.data("template-url"),b="column"==FLBuilderConfig.userTemplateType&&!g;numParentCols=g?f.find("> .fl-col").length:0,parentIndex=f.find("> .fl-col").index(h),parentFirst=!!g&&0===parentIndex,parentLast=!!g&&numParentCols===parentIndex+1,contentWidth=t.find("> .fl-col-content").width(),row=t.closest(".fl-row"),rowIsFixedWidth=!!row.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,userCanResizeRows=FLBuilderConfig.rowResize.userCanResizeRows,template=wp.template("fl-col-overlay"),overlay=null,FLBuilderConfig.simpleUi||o&&s&&c&&!p||o&&"column"==FLBuilderConfig.userTemplateType&&c||!o&&t.find(".fl-module").length>0||t.find(".fl-builder-node-loading-placeholder").length>0||!c&&u||s&&u&&!p||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),overlay=FLBuilder._appendOverlay(t,template({global:o,groupLoading:l,numCols:n,first:a,last:d,isRootCol:b,hasChildCols:u,hasParentCol:g,parentFirst:parentFirst,parentLast:parentLast,numParentCols:numParentCols,contentWidth:contentWidth,rowIsFixedWidth:rowIsFixedWidth,userCanResizeRows:userCanResizeRows})),FLBuilder._buildOverlayOverflowMenu(overlay),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),o=i.find(".fl-module").length>0,s=(i.hasClass("fl-node-global"),"undefined"!=typeof i.data("template-url")),n=l.is("#tiptip_holder"),r=l.closest("#tiptip_holder").length>0;n||r||o&&!s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),o=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(o=o.parents(".fl-col")),o.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),o=l.attr("data-node"),s=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=s.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=s.closest(".fl-row"),position=0,s.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):s.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):s.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=s.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(s.closest(".fl-col").attr("data-node"),o,position)):s.hasClass("fl-col-drop-target")?(s.hasClass("fl-col-drop-target-last")?s.parent().after(l):s.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:o,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:o,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):s.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),o,position)):s.hasClass("fl-row-drop-target")&&(l.remove(),position=s.closest(".fl-builder-content").find(".fl-row").index(newRow),position=s.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(o,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),o=l.find("> .fl-col-content"),s=i.parent().find("ul.fl-builder-submenu").length>0,n=i.closest(".fl-block-overlay-global").length>0,r=i.closest(".fl-block-overlay-global").hasClass("fl-col-overlay"),a="column"!=FLBuilderConfig.userTemplateType&&"undefined"!=typeof l.attr("data-template-url"),d=null;FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||s&&!i.hasClass("fl-col-overlay")||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),d=l.attr("data-node"),n&&r&&a?FLBuilderConfig.userCanEditGlobalTemplates&&(win=window.open(e('.fl-col[data-node="'+d+'"]').attr("data-template-url")),win.FLBuilderGlobalNodeId=d):FLBuilderSettingsForms.render({id:"col",nodeId:d,className:"fl-builder-col-settings",attrs:'data-node="'+d+'"',buttons:n||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:n?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[d],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():o.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),o=i.clone(),s=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=s,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(s),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),o=l.closest(".fl-col-group"),s=l.parents(".fl-col"),n=s.length>0,r=s.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=s:1!==a.length||a.find(".fl-module").length||(l=o)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),o=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType&&"column"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(o=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",o+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:o}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var o=e.closest(".fl-col-group"),s=o.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&s++,FLBuilder._showNodeLoadingPlaceholder(o,s),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColParent,i.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e('.fl-module[data-node="'+o.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+o.colId+'"]'),"after"==o.position?l.next().find(".fl-col-content").append(o.module):l.prev().find(".fl-col-content").append(o.module),FLBuilder._reorderModule(o.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+i.nodeId)),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var o=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,o.hasClass("fl-col")?FLBuilder._newColGroupParent=o.find(" > .fl-col-content"):FLBuilder._newColGroupParent=o.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),o=l.data("node"),s=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+s+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+o)),FLBuilder.triggerHook("didAddColumnGroup",o)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),o="",s=l.hasClass("fl-block-col-resize-parent"),n=s?l.closest(".fl-col").parents(".fl-col"):null,r=s?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=s?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(o="e",h=d.nextAll(".fl-col").first()):(o="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:o,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",o=i.handle.closest(".fl-block-overlay"),s=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-s):100*(i.colWidth+s),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),
4
+ i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(o),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,o=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),s=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:s,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(o),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:s,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,o=null,s=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;s=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),s.each(function(){for(o=e(this),r=o.find(".fl-col-group"),n.push(o.data("node")),FLBuilder._resetColumnWidths(o),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,s=t.parents(".fl-col-group").last(),n=s.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b="column"==FLBuilderConfig.userTemplateType&&!h;contentWidth=a.find("> .fl-col-content").width(),row=t.closest(".fl-row"),isGlobalRow=row.hasClass("fl-node-global"),rowIsFixedWidth=!!row.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,userCanResizeRows=FLBuilderConfig.rowResize.userCanResizeRows,template=wp.template("fl-module-overlay"),overlay=null,FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&o&&"row"!=FLBuilderConfig.userTemplateType&&isGlobalRow||l&&o&&"column"!=FLBuilderConfig.userTemplateType&&!isGlobalRow||t.closest(".fl-builder-node-loading").length||t.find(".fl-inline-editor:visible").length||(t.hasClass("fl-block-overlay-active")||(overlay=FLBuilder._appendOverlay(t,template({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,isRootCol:b,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:contentWidth,rowIsFixedWidth:rowIsFixedWidth,userCanResizeRows:userCanResizeRows})),FLBuilder._buildOverlayOverflowMenu(overlay),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),o=i.closest("#tiptip_holder").length>0;l||o||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,o=l.parent(),s=null,n=0,r=0;if(o.hasClass("fl-builder-modules")||o.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=l.closest(".fl-builder-content"),r=0,s=l.closest(".fl-row"),n=o.find(".fl-row").index(s)):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),r=o.closest(".fl-row").attr("data-node"),s=l.closest(".fl-col-group"),n=o.find(" > .fl-col-group").index(s)):o.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col-group"),r=o.attr("data-node"),s=l.closest(".fl-col"),n=o.find(" > .fl-col").index(s)):(n=o.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(o,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(o.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();o.hasClass("fl-row-drop-target")?(s=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(s),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):o.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(s),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):o.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:s.data("node"),position:n},FLBuilder._addCols(s,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),o=e.index();t==i?FLBuilder._reorderNode(l,o):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,o))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),o=i.index()+1,s=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),e("html, body").animate({scrollTop:s.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=o,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),o=i.closest(".fl-module").attr("data-node"),s=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:o,parentId:s,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],o=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],s=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&s.append(l.assets.css),""!==l.assets.js&&s.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:o,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),o=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),o=t.validate().form(),o&&(o=l.submit())),o?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,o,s){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof o?"":o,alias:"undefined"==typeof s?"":s},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),i.settings||(i.settings=FLBuilderSettingsConfig.defaults.modules[i.type]),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),o=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")?o=FLBuilderStrings.saveRow:i.hasClass("fl-builder-col-settings")&&(o=FLBuilderStrings.saveColumn),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:o,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),o=l.find(".fl-builder-block"),s=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===o.length)l.append(d(i));else for(;a<o.length;a++){if(s=o.eq(a),n=s.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){s.before(d(i));break}if(o.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,o=l.parent(),s=null,n=0,r=null,a="",d=null;if(o.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=o.hasClass("fl-drop-target-last")?n+1:n,s=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-column")){if(r=l.closest(".fl-col"),colGroup=o.closest(".fl-col-group"),colGroupId=colGroup.attr("data-node"),a="render_new_col_template",d=FLBuilder._addColsComplete,o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(r=l.closest(".fl-row"),s=0,o=e(FLBuilder._contentClass),n=r.length?o.find(".fl-row").index(r):0):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),s=l.closest(".fl-row").attr("data-node"),n=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(l.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")&&(o=l.closest(".fl-col-group"),n=o.children(".fl-col").index(l.closest(".fl-col")),s=o.attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),o.hasClass("fl-col-group")?FLBuilder._newColParent=null:FLBuilder._newColParent=o,FLBuilder._newColPosition=n,FLBuilder._showNodeLoadingPlaceholder(o,n)}else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,o.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();o.hasClass("fl-row-drop-target")?(o=l.closest(".fl-builder-content"),s=0,n=o.find(".fl-row").index(l.closest(".fl-row"))):o.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-row-content"),s=o.closest(".fl-row").attr("data-node"),n=o.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):o.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col-group"),n=o.children(".fl-col").index(l.closest(".fl-col")),s=o.attr("data-node")):(n=o.children(".fl-module, .fl-builder-block").index(l),s=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),o.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=o,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(o,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:s,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),o=l.find(".fl-builder-blocks-section-content"),s=o.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===s.length&&(n.hasClass("fl-builder-block-saved-row")?o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):o.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),o=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+o).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+o+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),o=t.find(".fl-builder-settings-tabs"),s=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=o.find("a"),a=!1,d=i-60,u=0,c=l?16:30;s.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),o="";e(this).hasClass("fl-active")&&(o="fl-active"),e(this).hasClass("error")&&(o+=" error"),""!==o&&(o='class="'+o+'"');var n=e('<a href="'+l+'" '+o+">"+i+"</a>");s.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),s.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),s.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),o=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),s=o.find('a[href="'+l+'"]'),n=o.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),s.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),o=null,s=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(o=e(FLBuilder.preview.state.html),s=e(".fl-node-"+l.data("node")),n=s.closest(".fl-col"),r=o.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(s):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=t.data("node"),o=i.find(".fl-field").first(),s=o.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if(!l||!e(".fl-node-"+l+" .fl-inline-editor").length){if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var n=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(n).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);o.css("animation-name","fl-grab-attention"),o.on("animationend",function(){o.css("animation-name","")})}},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,o=null,s=0;s<i.length;s++)l=i.eq(s),o=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),o.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,o=0,s="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(s=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),o=0;o<d.length;o++)"[]"!=d[o]&&a.push(d[o].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=s):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(s)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=s):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(s))}else u[i[l].name]=s;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"&#39;").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),o=t.data("node"),s=FLBuilderSettingsConfig.nodes,n=null,r={};if(o&&s[o]?n=s[o]:l.length&&(n=JSON.parse(l.val().replace(/&#39;/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_getSettingsForChangedCheck:function(t,i){var l=FLBuilder._getSettings(i);if(t){var o=e(".fl-node-"+t);if(o.hasClass("fl-module")){var s=o.data("type"),n=FLBuilderSettingsConfig.editables[s];if(n&&FLBuilderSettingsConfig.nodes[t])for(var r in n)l[r]=FLBuilderSettingsConfig.nodes[t][r]}}return l},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),o=i.attr("data-node"),s=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(o),FLBuilderSettingsConfig.nodes[o]=s,FLBuilder.ajax({action:"save_settings",node_id:o,settings:s},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:o,settings:s}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),o=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,o):o(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var o=FLBuilder._lightbox._node.find("form.fl-builder-settings"),s=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[s],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,o.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!o.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),o.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(o.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),o=new FLLightbox(t),s=o._node,n=s.find(".fl-lightbox");return i.hide(),s.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),o.on("resized",FLBuilder._calculateSettingsTabsOverflow),o.open('<div class="fl-builder-lightbox-loading"></div>'),o},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),o=FLLightbox._instances[l],s=t.attr("data-parent"),n=e('[data-instance-id="'+s+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[s];o.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),o.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,o=null,s=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),s.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),s.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:s},function(i){l=JSON.parse(i);for(o in l)e('.fl-suggest-field[name="'+o+'"]').attr("data-value",l[o]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.find("textarea"),o=(l.attr("id"),l.data("editor")),s=l.data("wrap"),n=e("<div>",{position:"absolute",height:20*parseInt(l.attr("rows"),10)}),r=null;n.insertBefore(l),l.css("display","none"),ace.require("ace/ext/language_tools"),r=ace.edit(n[0]),r.$blockScrolling=1/0,r.getSession().setValue(l.val()),r.getSession().setMode("ace/mode/"+o),s&&r.getSession().setUseWrapMode(!0),r.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),r.getSession().on("change",function(e){l.val(r.getSession().getValue()).trigger("change")}),r.getSession().on("changeAnnotation",function(){for(var e=r.getSession().getAnnotations(),t=i.find(".fl-builder-settings-save"),l=i.find(".fl-builder-settings-error"),o=!1,s=0;s<e.length;s++)if(!(e[s].text.indexOf("DOCTYPE")>-1||e[s].text.indexOf("Named entity expected")>-1||e[s].text.indexOf("@supports")>-1||"error"!==e[s].type)){o=!0;break}o&&!l.length&&FLBuilderConfig.CheckCodeErrors?(t.addClass("fl-builder-settings-error"),t.on("click",FLBuilder._showCodeFieldError)):!o&&l.length&&(l.removeClass("fl-builder-settings-error"),l.off("click",FLBuilder._showCodeFieldError))}),l.closest(".fl-field").data("editor",r)},_showCodeFieldError:function(e){e.stopImmediatePropagation(),FLBuilder.alert(FLBuilderStrings.codeError)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,o=0,s=FLBuilderConfig.isRtl?{left:10}:{right:10};o<t.length;o++)i=t.eq(o),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:s,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),o=l.clone(),s=o.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;o.find("th label span.fl-builder-field-index").html(r),o.find(".fl-form-field-preview-text").html(""),o.find("input, textarea, select").val(""),l.after(o),FLBuilder._initMultipleFields(),s.length&&(n=s.find(".fl-form-field-edit").data("type"),s.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),o=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(o),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview());
5
+ },_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),o=t.attr("data-trigger"),s=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[s]&&(FLBuilder._settingsSelectToggle(i[s].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[s].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[s].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[s]&&(FLBuilder._settingsSelectToggle(l[s].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[s].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[s].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof o&&(o=JSON.parse(o),"undefined"!=typeof o[s]&&"undefined"!=typeof o[s].fields))for(n=0;n<o[s].fields.length;n++)e("#fl-field-"+o[s].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,o){var s=0;if(o="undefined"==typeof o?"":o,"undefined"!=typeof t)for(;s<t.length;s++)e(".fl-builder-settings:visible").find(l+t[s]+o)[i](),e(l+t[s]+o).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),o=l.val(),s=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==o?(s=wp.media.attachment(o),s.fetch(),t.add(s?[s]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),o=i.find(".fl-photo-preview img"),s=i.find("select");l.val(t.id),o.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),s.show(),s.html(FLBuilder._getPhotoSizeOptions(t)),s.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),o=l.find("input[type=hidden]"),s=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),o.val(""),s.html('<option value="" selected></option>'),s.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,o=null,s="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)s="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",o="",t?t===e.sizes[l].url.replace(/https?/,"")&&(o=' selected="selected"'):o="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+o+">"+s+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),o=""===l?"":JSON.parse(l),s=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof o){for(u in o)c.push(o[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(s)&&r.set("id",s),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),o=i.find(".fl-multiple-photos-count"),s=[],n=0;n<t.models.length;n++)s.push(t.models[n].id);1==s.length?o.html("1 "+FLBuilderStrings.photoSelected):o.html(s.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(s)).trigger("change")},_initSingleVideoSelector:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video")},_selectSingleVideo:function(){FLBuilder._initSingleVideoSelector(),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),o=i.find(".fl-video-preview-filename"),s=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),o.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),s.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singleVideoRemoved:function(){FLBuilder._initSingleVideoSelector();var t=FLBuilder._singleVideoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-video-field"),o=l.find(".fl-video-preview-img img"),s=l.find(".fl-video-preview-filename"),n=l.find("input[type=hidden]");i&&i.reset(),o.attr("src",""),s.html(""),l.addClass("fl-video-empty"),n.val("").trigger("change")},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),o=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',s=wp.shortcode.next("playlist",o).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(s.get("id"))&&!_.isUndefined(n)&&s.set("id",n),r=wp.media.playlist.attachments(s),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),o=i.find("input[type=hidden]"),s=[],n=0;n<t.models.length;n++)s.push(t.models[n].id);1==s.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(s.length+" "+FLBuilderStrings.audiosSelected),o.val(JSON.stringify(s)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),o=i.find("i"),s=o.attr("data-icon");l.val(t).trigger("change"),o.removeClass(s),o.addClass(t),o.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),o=t.siblings("input").val(),s=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===o&&(o=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(o.replace(/&#39;/g,"'")),lightbox:n,helper:s,rules:s?s.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),o=FLBuilder._getSettings(t),s={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=o[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+o[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),s=r.siblings("input").val().replace(/&#39;/g,"'"),""!=s&&(o=e.extend(JSON.parse(s),o)),r.siblings("input").val(JSON.stringify(o)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),o=l.find(".fl-link-field-search"),s=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),s.autoSuggest("remove",t.value),o.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),o=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),o.find("option[value="+i.weight+"]").length&&o.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),o={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},s={};i.html(""),s="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(s,function(e,t){i.append('<option value="'+t+'">'+o[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel&&(tinymce.ui.FloatPanel.zIndex=100100),e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),o="flrich"+(new Date).getTime()+"_"+l,s=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;s=s.replace(/flbuildereditor/g,o),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,o)),i.after(s).remove(),e("textarea#"+o).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[o]&&(d=n.mceInit[o],u=tinymce.$("#wp-"+o+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(o)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[o]),window.wpActiveEditor=o},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinymce.editors[t].inline||(i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i));FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinymce.editors[t].inline||tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),o=t.attr("id"),s=i.attr("data-name"),n="undefined"!=typeof tinymce&&tinymce.get(o),r=t.siblings('textarea[name="'+s+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+s+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),o=[];i.find(".fl-ordering-field-option").each(function(){o.push(e(this).attr("data-key"))}),l.val(JSON.stringify(o)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading"),FLBuilder.triggerHook("didStartNodeLoading",i)},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(" > .fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,o){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof o&&"undefined"!=typeof o.stack&&(FLBuilder.log(o.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,o="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(o=e(this).remove(),l+=o[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;if(this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(" > .fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId){var i=e(FLBuilder.preview.classes.node),l=i.closest(".fl-node-"+this._data.nodeId).length;l&&i.html(FLBuilder.preview.elements.node.html())}},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",o=null,s="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),o=e('script[src*="'+l+'"]'),o.length>0&&e(this).remove())}),i.find("link").each(function(){s=e(this).attr("href"),"undefined"!=typeof s&&(s=s.replace(a,""),n=e('link[href*="'+s+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.getFormattedSelector=function(e,t){for(var i="",l=t.split(","),o=0;o<l.length;o++)l[o].indexOf("{node}")>-1?i=l[o].replace("{node}",e):i+=e+" "+l[o],o!=l.length-1&&(i+=", ");return i},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettingsForChangedCheck(this.nodeId,t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",
6
+ className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,o=255&t;return[i,l,o]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched.preview",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched.preview")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,o="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+o].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),o=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:o}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),o=e(".fl-builder-settings .fl-lightbox-header"),s=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+s+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):o.length>0&&o.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),o=this.elements.hoverColor.val(),s=this.elements.headingColor.val();l=""===l?i:l,o=""===o?i:o,s=""===s?i:s,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===o?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+o),""===s?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+s),this.updateCSSRule(this.classes.node+" h2","color","#"+s),this.updateCSSRule(this.classes.node+" h3","color","#"+s),this.updateCSSRule(this.classes.node+" h4","color","#"+s),this.updateCSSRule(this.classes.node+" h5","color","#"+s),this.updateCSSRule(this.classes.node+" h6","color","#"+s),this.updateCSSRule(this.classes.node+" h1 a","color","#"+s),this.updateCSSRule(this.classes.node+" h2 a","color","#"+s),this.updateCSSRule(this.classes.node+" h3 a","color","#"+s),this.updateCSSRule(this.classes.node+" h4 a","color","#"+s),this.updateCSSRule(this.classes.node+" h5 a","color","#"+s),this.updateCSSRule(this.classes.node+" h6 a","color","#"+s))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,o;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",o)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),o=i.bgVideo.val(),s=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=s?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(s)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(s)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=o&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),o=i.bgSlideshowPhotos.val(),s=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===o||"smugmug"==l&&""===s||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,o;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",o)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,o;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,o="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",o)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],o=["","Medium","Responsive"],s=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<o.length;d++)n=t+l[a]+o[d],r=t+"_"+l[a].toLowerCase(),""!=o[d]&&(r+="_"+o[d].toLowerCase()),i[n]=e(s+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),o={},s=0;s<i.length;s++)o[i[s].toLowerCase()]=this.elements[e+i[s]+l].val();return this._normalizeDimensionValues(o,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},o="border"==t;e.each(i,function(e,i){l[t+"-"+e+(o?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,o=FLBuilderResponsiveEditing._mode,s="default"==o?"":o.charAt(0).toUpperCase()+o.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,o){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+o.charAt(0).toUpperCase()+o.slice(1)+i[1]+s,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[o]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,o=null,s={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),o=this._getDimensions("border"),e.map(s,function(e,t){l[t]&&o[t]?s[t]="calc("+l[t]+"+"+o[t]+")":l[t]?s[t]=l[t]:o[t]&&(s[t]=o[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",s),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",s))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),o=this.elements.node.prev(".fl-col"),s=this.elements.node.next(".fl-col"),n=0===s.length?o:s,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),o=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"select":t.find("select").on("change",o);break;case"color":t.find(".fl-color-picker-value").on("change",o);break;case"photo":t.find("select").on("change",o);break;case"multiple-photos":t.find("input").on("change",o);break;case"photo-sizes":t.find("select").on("change",o);break;case"video":t.find("input").on("change",o);break;case"multiple-audios":t.find("input").on("change",o);break;case"icon":t.find("input").on("change",o);break;case"form":t.delegate("input","change",o);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",o);break;case"post-type":t.find("select").on("change",o);break;case"suggest":t.find(".as-values").on("change",o),t.find("select").on("change",o);break;case"unit":case"dimension":t.find("input[type=number]").on("keyup",o);break;case"ordering":t.find("input[type=hidden]").on("change",o);break;default:t.on("change",o)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),o=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",o);break;case"unit":t.find("input[type=number]").on("keyup",o);break;case"textarea":t.find("textarea").on("keyup",o);break;case"code":t.find("textarea").on("change",o);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=e(l),s=e("<div>"+e(i.target).val()+"</div>");o.length>0?(s.find("script").remove(),o.html(s.html())):this.delayPreview(i)},_previewTextEditor:function(t,i,l){var o=this._getPreviewSelector(this.classes.node,t.selector),s=e(o),n="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,r=e("#"+i),a="";s.length>0&&(a=e(n&&"none"==r.css("display")?"<div>"+n.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+r.val()+"</div>":"<div>"+switchEditors.wpautop(r.val())+"</div>"),a.find("script").remove(),s.html(a.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),o=null;if("refresh"==i.type)o=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;o=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",o),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",o),editor.on("keyup",o))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var o=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",o)},_previewFont:function(t,i){var l=e(i.delegateTarget),o=l.find(".fl-font-field-font"),s=e(o).find(":selected"),n=s.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,o.val(),r.val()),"Default"==o.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",o.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var o=FLBuilderConfig.googleFontsUrl,s="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){s+=e+":"+t.join()+"|"}),s=o+s.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",s).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",s)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"dimension":t.find("input[type=number]").on("keyup",e.proxy(this._previewDimensionCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=t.property,s="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"===s&&"opacity"===o?r=parseInt(r)/100:""!==r&&(r+=s),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,o,r):this.updateCSSRule(l,o,r)},_previewDimensionCSS:function(t,i){var l=e.extend({},t),o=l.property,s=e(i.target).data("unit");"border-width"===o?l.property="border-"+s+"-width":l.property=o+"-"+s,this._previewCSS(l,i)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),o=e(i.target),s=o.val(),n=""===s?"inherit":"#"+s;/^rgb/.test(s.replace(/\s+/g,""))&&(n=s),o.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){return FLBuilderPreview.getFormattedSelector(e,t)}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,o=null,s=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,o=element.tagName.toLowerCase(),s=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===o||i&&s&&"stylesheet"===s.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:o,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),o=l.match(i.media),s=o&&o.length||0,n=!s&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(o?u=l.replace(i.media,""):n&&"all"!=t.media?s=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<s;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=o[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,o=null,s=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(s in this.sheets)if(i="",l=e("<style></style>"),o=this.sheets[s],o.queries.length&&this.width){for(i+=o.all,r=0;r<o.queries.length;r++)n=o.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),o.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,o=t.createElement("div"),s=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return o.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(o),r&&i.insertBefore(l,i.firstChild),e=parseFloat(o.offsetWidth),r?i.removeChild(l):l.removeChild(o),i.style.fontSize=s,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,
7
+ FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),o=e("body"),s=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(s),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),s.after('<div class="fl-content-placeholder"></div>'),o.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(s)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,s.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,s.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(s.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),o=l.parents(),s="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<o.length&&(s=o.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==s);n++);t.css("background-color",s)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,o,s){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof s&&e.inArray(d,s)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,o),a.find(".fl-field-responsive-setting-medium "+i).on(l,o),a.find(".fl-field-responsive-setting-responsive "+i).on(l,o),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),o=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==o?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",o)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),o=FLBuilderResponsiveEditing._getFields(this,"input"),s=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(s,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=s[n],a=s[n+"_medium"],d=s[n+"_responsive"],o["default"].each(function(e){var t=o["default"].eq(e).attr("name").split("_").pop(),n=o["default"].eq(e).val(),u=o.medium.eq(e).val(),c=(o.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?o.medium.eq(e).attr("placeholder",n):""!==r&&o.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(s.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?o.responsive.eq(e).attr("placeholder",c):""!==h?o.responsive.eq(e).attr("placeholder",h):o.responsive.eq(e).attr("placeholder",c)):(!Number(s.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?o.responsive.eq(e).attr("placeholder",u):""!==a?o.responsive.eq(e).attr("placeholder",a):""!==n?o.responsive.eq(e).attr("placeholder",n):""!==r&&o.responsive.eq(e).attr("placeholder",r)))})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),o="100%";"responsive"==t?(o=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,l.width(o)):"medium"==t&&(o=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(o)),l.width(o)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),o=e('<div id="fl-builder-preview-mask"></div>'),s=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(o),t.append(s)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),o=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),o.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),o=l.closest("tr"),s=l.val();o.siblings("tr.fl-builder-service-account-row").remove(),o.siblings("tr.fl-builder-service-connect-row").remove(),o.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==s&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:s},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row");s.after(l.html),t._addAccountDelete(o),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:o.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();s.hide(),t._startSettingsLoading(o),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-select-row"),n=o.find(".fl-builder-service-select"),r=o.find(".fl-builder-service-account-row"),a=o.find(".fl-builder-service-account-select"),d=o.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),s.after(l.html)),t._addAccountDelete(o),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=s.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:o.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:o.val(),account:d}),u&&(t._startSettingsLoading(o),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-account-row");s.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),o=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:o.val()},t._accountDeleteComplete),t._startSettingsLoading(o))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-campaign-monitor-client-select");s.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-list-select");s.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),o=l.find(".fl-builder-service-select"),s=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(o),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:o.val(),account:s.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),o=e(".fl-builder-service-settings-loading"),s=o.find(".fl-builder-service-field-row");s.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fas fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fas fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],o=i.split(" ");for(var e in o)o[e].startsWith(t)&&l.push(o[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var o=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,o):Mousetrap.bind(i,o)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return s.isPreviewing?void s.endPreview():o.isShowing?void o.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var o,s,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(o=r.filter("a.fl-active"),s="next"==i?o.is(r.last())?r.first():o.next("a"):o.is(r.first())?r.last():o.prev("a"),s.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},o=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),s.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),s.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),s.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),s.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),s={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var o=e("body"),s=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),s.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=s.find(".fl-block-col-resize-feedback-left")),s.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=s.find(".fl-block-col-resize-feedback-right")),o.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,o=this.drag.originalWidth,s=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",s=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=o+2*s:this.drag.calculatedWidth=o-2*s,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var o={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth
8
+ },s=e("body");t.ajax(o),t._bindOverlayEvents(),s.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked),this.$el.find("#fl-builder-toggle-notifications").on("click",this.onNotificationsButtonClicked.bind(this)),t.addHook("notificationsLoaded",this.onNotificationsLoaded.bind(this))},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),s.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})},onNotificationsButtonClicked:function(){t.triggerHook("toggleNotifications")},onNotificationsLoaded:function(){e("body").removeClass("fl-builder-has-new-notifications");var i={action:"fl_builder_notifications",read:!0};t.ajax(i)}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),s.init(),n.init(),r.init(),o.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),o.init(),s.init()},renderPanel:function(t){var l,o,s;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,o=i.create(l),o.init(),s=e(o.render()),o.$el=s,e(".fl-builder--main-menu-panel-views").append(s),o.bindEvents(),o.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),o.isRootView&&(this.rootView=o,this.currentView=o),this.views[t]=o},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),o=l.data("type");switch(o){case"view":var s=l.data("view");this.goToView(s);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var o={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",o="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",o="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+o),t.ajax({action:"save_ui_skin",skin_name:o})}},s={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l)}if(!this.activeView){var o=Object.keys(this.views)[0],l=this.views[o];this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=o;break;case"rows":t=s;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),o=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),s=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),o=i.siblings("button");""!==l?o.show():o.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),o=l.siblings('input[name="template-name"]').val(),s=l.siblings('input[name="template-category"]').val(),n={name:o,category:s};""!==o&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),o=l.data("id"),s=l.data("type");t._requestTemplateInsert(o,s)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","column","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var o=e[l];if(n=i.create(o),n.panel=this,n.views={},n.init(o),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var s=Object.keys(this.tabs)[0],n=this.tabs[s];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,o=null,s=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),o=l[0].getBoundingClientRect(),t=s[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<o.x?20:a-o.x-t.width/2,s.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,o=FLBuilderSettingsConfig.modules,s={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(s,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===o[t.id])return;t=e.extend(!0,t,o[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettingsForChangedCheck(this.config.nodeId,l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),o="",s=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)s=t[n],a=!!s.multiple,supportsResponsive=e.inArray(s.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&s["default"]&&(r=s["default"]),d=s.responsive&&c.responsive_enabled&&!a&&supportsResponsive?s.responsive:null,o+=l({field:s,name:n,rootName:n,value:r,preview:JSON.stringify(s.preview?s.preview:{type:"refresh"}),responsive:d,rowClass:s.row_class?" "+s.row_class:"",isMultiple:a,supportsMultiple:"editor"!==s.type&&"photo"!==s.type&&"service"!==s.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+s.type)});return o},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),o=null,s=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){o=e(this),n.fields.push(o.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(o),s=!0}),l.find(".fl-legacy-settings-section").each(function(){o=e(this),n.sections.push({tab:o.attr("data-tab"),section:o.attr("data-section")}),s=!0}),l.find(".fl-legacy-settings-tab").each(function(){o=e(this),n.tabs.push(o.attr("data-tab")),s=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),s&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),s},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,o=null,s="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),o=l.length?l.find(".fl-builder-settings"):null):(o=e(".fl-builder-settings:visible"),l=o.closest(".fl-builder-lightbox")),o&&o.length){for(s in i.fields)n=e("#fl-field-"+s).attr("id",""),n.after(i.fields[s]).remove();for(s in i.extras)n=e("#fl-field-"+s).find(".fl-field-control-wrapper"),n.prepend(i.extras[s].before),n.append(i.extras[s].after);for(a in i.sections)for(s in i.sections[a])r=e("#fl-builder-settings-section-"+s),r.html(i.sections[a][s]);for(s in i.tabs)a=e("#fl-builder-settings-tab-"+s),a.html(i.tabs[s]);l.data("parent")||(this.settings=FLBuilder._getSettingsForChangedCheck(this.config.nodeId,o),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),o=null,s=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),o=FLBuilder._getSettings(t),s=t.attr("data-node"),s&&(n.node_id=s,n.node_settings=o)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),o=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(o).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),o=l.hasClass("fl-row"),s=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(o?i=e.extend({},this.defaults.row):s?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),o||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),o=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");o.nodes[l].size=parseFloat(t[0].style.width),o.nodes[l].equal_height=i.equal_height,o.nodes[l].content_alignment=i.content_alignment,o.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),o=l.find("[data-node]"),s=e(".fl-node-"+t),n=s.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],o.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){this.initPanel(),this.pinOrUnpin(),this.bind()},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("didPinContentPanel")},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("didUnpinContentPanel")},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),o=t.data("position"),s=e(".fl-builder--content-library-panel"),n=s.outerWidth();
9
+ "hide"===l?(s.css(o,"-"+n+"px"),i.css("margin-"+o,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(s.css(o,"0px"),i.css("margin-"+o,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"))},uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),o=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();o.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),o.addClass("fl-builder-content-panel-is-showing"),o.css("margin-"+t,l+"px"),s.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),s=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),o.css("margin-left",""),o.css("margin-right",""),s.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),o=l.find(".fl-lightbox"),s=0,n=0,r=0;o.draggable("enable"),o.resizable("enable"),o.find(".ui-resizable-handle").show(),t.append(l),o.is(":visible")?(s=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),o.css("top",(s<0?0:s)+"px"),o.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),o.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):o.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),o=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",o+"px"),i.css("margin-left",o+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",o+"px"),i.css("margin-right",o+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),o=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||o.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),o=e(".fl-responsive-preview"),s=e(window),n=o.length?o.width():s.width(),r=s.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),o=e(".fl-builder-bar-actions"),s=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),o.removeClass("fl-builder-content-panel-pin-zone"),o.removeClass("fl-builder-content-panel-pin-zone-hover"),s.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?(this.unpin(!0),("module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi)&&n.hide()):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");t.draggable("disable"),t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),o=e(".fl-builder--revision-actions select"),s="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],o.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)s=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),s+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:s,author:n,avatar:i[t[r].author].avatar})}),o.append('<option value="'+t[r].id+'">'+s+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},o=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var s in e.kind)i=e.kind[s],t[i]=FLBuilderConfig.contentItems[i];return o=this.findMatches(e,t),l.library=this.formatResults(o,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,o=null,s=null,n=null,r=null,a=null;for(l in t){o=t[l],i[l]={items:[]};for(a in o)if(s=o[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(s.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,s.content),r=e.content===s.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==s.type)continue;if(!_.isNull(e.group)){var d=e.group,u=s.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&s.group.length>0)continue;if(e.group!==!1&&!_.contains(s.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(s,e.searchTerm))&&i[l].items.push(s)}}return i},matchesCategory:function(e,t){var i,l,o,s,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(o in e)if(s=e[o],s===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,o=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(o))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(o))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(o))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(o))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(o)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(o))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,o={};return _.forEach(e,function(e,s,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(o[i]=o[i]||[],o[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){o[t]=o[t]||[],o[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){o[t]=o[t]||[],o[t].push(e)})))}),o},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var o={};for(var s in i.library.module.items){var n=i.library.module.items[s],r=n.group[0],a=n.category;n.name;_.isUndefined(o[r])&&(o[r]={}),_.isUndefined(o[r][a])&&(o[r][a]=[]),o[r][a].push(n)}l.grouped=o}for(var s in i.library){var d=i.library[s];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[s]={name:FLBuilderStrings.typeLabels[s],handle:s,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--