Version Description
:- 2018-10-15 :- High priority = * Fixed JS error when Gutenberg framework not loaded
Download this release
Release Info
Developer | perryrylance |
Plugin | WP Google Maps |
Version | 7.10.39 |
Comparing to | |
See all releases |
Code changes from version 7.10.36 to 7.10.39
- cache/index.html +0 -0
- css/gutenberg.css +9 -0
- includes/3rd-party-integration/class.gutenberg.php +69 -0
- includes/build.log +146 -136
- includes/class.factory.php +32 -0
- includes/class.plugin.php +20 -17
- includes/class.script-loader.php +37 -7
- includes/class.script-loader.php.bak +452 -0
- js/test.html +0 -16
- js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js +100 -0
- js/v8/3rd-party-integration/gutenberg/src/gutenberg.jsx +118 -0
- js/v8/3rd-party-integration/integration.js +11 -0
- js/v8/rest-api.js +3 -0
- js/v8/scripts.json +18 -0
- js/v8/wp-google-maps.combined.js +118 -0
- js/v8/wp-google-maps.min.js +1 -1
- js/wpgmaps.js +8 -6
- readme.txt +17 -0
- wpGoogleMaps.php +30 -8
cache/index.html
DELETED
File without changes
|
css/gutenberg.css
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wpgmza-gutenberg-block
|
2 |
+
{
|
3 |
+
padding: 1em;
|
4 |
+
}
|
5 |
+
|
6 |
+
.wpgmza-gutenberg-block-title
|
7 |
+
{
|
8 |
+
padding-left: 0.5em;
|
9 |
+
}
|
includes/3rd-party-integration/class.gutenberg.php
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGMZA\Integration;
|
4 |
+
|
5 |
+
class Gutenberg extends \WPGMZA\Factory
|
6 |
+
{
|
7 |
+
public function __construct()
|
8 |
+
{
|
9 |
+
global $wpgmza;
|
10 |
+
|
11 |
+
add_action('enqueue_block_assets', array(
|
12 |
+
$this,
|
13 |
+
'onEnqueueBlockAssets'
|
14 |
+
));
|
15 |
+
|
16 |
+
add_action('init', array(
|
17 |
+
$this,
|
18 |
+
'onInit'
|
19 |
+
));
|
20 |
+
|
21 |
+
if(function_exists('register_block_type'))
|
22 |
+
register_block_type('gutenberg-wpgmza/block', array(
|
23 |
+
'render_callback' => array(
|
24 |
+
$this,
|
25 |
+
'onRender'
|
26 |
+
)
|
27 |
+
));
|
28 |
+
}
|
29 |
+
|
30 |
+
public function onEnqueueBlockAssets()
|
31 |
+
{
|
32 |
+
global $wpgmza;
|
33 |
+
|
34 |
+
$wpgmza->loadScripts();
|
35 |
+
|
36 |
+
wp_enqueue_style(
|
37 |
+
'wpgmza-gutenberg-integration',
|
38 |
+
plugin_dir_url(WPGMZA_FILE) . 'css/gutenberg.css',
|
39 |
+
'',
|
40 |
+
WPGMZA_VERSION
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
public function onInit()
|
45 |
+
{
|
46 |
+
global $wpgmza;
|
47 |
+
|
48 |
+
if(empty($wpgmza->settings->developer_mode))
|
49 |
+
return;
|
50 |
+
|
51 |
+
// Strip out JS module code for browser compatibility
|
52 |
+
$filename = plugin_dir_path(WPGMZA_FILE) . 'js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js';
|
53 |
+
|
54 |
+
$contents = file_get_contents($filename);
|
55 |
+
|
56 |
+
$contents = preg_replace('/Object\.defineProperty\(exports.+?;/s', '', $contents);
|
57 |
+
|
58 |
+
$contents = preg_replace('/exports\.default = /', '', $contents);
|
59 |
+
|
60 |
+
file_put_contents($filename, $contents);
|
61 |
+
}
|
62 |
+
|
63 |
+
public function onRender($attr)
|
64 |
+
{
|
65 |
+
extract($attr);
|
66 |
+
|
67 |
+
return '[wpgmza id="1"]';
|
68 |
+
}
|
69 |
+
}
|
includes/build.log
CHANGED
@@ -1,136 +1,146 @@
|
|
1 |
-
2018-
|
2 |
-
2018-
|
3 |
-
2018-
|
4 |
-
2018-
|
5 |
-
2018-
|
6 |
-
2018-
|
7 |
-
2018-
|
8 |
-
2018-
|
9 |
-
2018-
|
10 |
-
2018-
|
11 |
-
2018-
|
12 |
-
2018-
|
13 |
-
2018-
|
14 |
-
2018-
|
15 |
-
2018-
|
16 |
-
2018-
|
17 |
-
2018-
|
18 |
-
2018-
|
19 |
-
2018-
|
20 |
-
2018-
|
21 |
-
2018-
|
22 |
-
2018-
|
23 |
-
2018-
|
24 |
-
2018-
|
25 |
-
2018-
|
26 |
-
2018-
|
27 |
-
2018-
|
28 |
-
2018-
|
29 |
-
2018-
|
30 |
-
2018-
|
31 |
-
2018-
|
32 |
-
2018-
|
33 |
-
2018-
|
34 |
-
2018-
|
35 |
-
2018-
|
36 |
-
2018-
|
37 |
-
2018-
|
38 |
-
2018-
|
39 |
-
2018-
|
40 |
-
2018-
|
41 |
-
2018-
|
42 |
-
2018-
|
43 |
-
2018-
|
44 |
-
2018-
|
45 |
-
2018-
|
46 |
-
2018-
|
47 |
-
2018-
|
48 |
-
2018-
|
49 |
-
2018-
|
50 |
-
2018-
|
51 |
-
2018-
|
52 |
-
2018-
|
53 |
-
2018-
|
54 |
-
2018-
|
55 |
-
2018-
|
56 |
-
2018-
|
57 |
-
2018-
|
58 |
-
2018-
|
59 |
-
2018-
|
60 |
-
2018-
|
61 |
-
2018-
|
62 |
-
2018-
|
63 |
-
2018-
|
64 |
-
2018-
|
65 |
-
2018-
|
66 |
-
2018-
|
67 |
-
2018-
|
68 |
-
2018-
|
69 |
-
2018-
|
70 |
-
2018-
|
71 |
-
2018-
|
72 |
-
2018-
|
73 |
-
2018-
|
74 |
-
2018-
|
75 |
-
2018-
|
76 |
-
2018-
|
77 |
-
2018-
|
78 |
-
2018-
|
79 |
-
2018-
|
80 |
-
2018-
|
81 |
-
2018-
|
82 |
-
2018-
|
83 |
-
2018-
|
84 |
-
2018-
|
85 |
-
2018-
|
86 |
-
2018-
|
87 |
-
2018-
|
88 |
-
2018-
|
89 |
-
2018-
|
90 |
-
2018-
|
91 |
-
2018-
|
92 |
-
2018-
|
93 |
-
2018-
|
94 |
-
2018-
|
95 |
-
2018-
|
96 |
-
2018-
|
97 |
-
2018-
|
98 |
-
2018-
|
99 |
-
2018-
|
100 |
-
2018-
|
101 |
-
2018-
|
102 |
-
2018-
|
103 |
-
2018-
|
104 |
-
2018-
|
105 |
-
2018-
|
106 |
-
2018-
|
107 |
-
2018-
|
108 |
-
2018-
|
109 |
-
2018-
|
110 |
-
2018-
|
111 |
-
2018-
|
112 |
-
2018-
|
113 |
-
2018-
|
114 |
-
2018-
|
115 |
-
2018-
|
116 |
-
2018-
|
117 |
-
2018-
|
118 |
-
2018-
|
119 |
-
2018-
|
120 |
-
2018-
|
121 |
-
2018-
|
122 |
-
2018-
|
123 |
-
2018-
|
124 |
-
2018-
|
125 |
-
2018-
|
126 |
-
2018-
|
127 |
-
2018-
|
128 |
-
2018-
|
129 |
-
2018-
|
130 |
-
2018-
|
131 |
-
2018-
|
132 |
-
2018-
|
133 |
-
2018-
|
134 |
-
2018-
|
135 |
-
2018-
|
136 |
-
2018-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
2018-10-15 19:24:28 :- Scanning dependencies
|
2 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/circle.js
|
3 |
+
2018-10-15 19:24:28 :- Found wpgmza-circle
|
4 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-map-object
|
5 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/compatibility.js
|
6 |
+
2018-10-15 19:24:28 :- Found wpgmza-compatibility
|
7 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
8 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/core.js
|
9 |
+
2018-10-15 19:24:28 :- Found wpgmza
|
10 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/css-escape.js
|
11 |
+
2018-10-15 19:24:28 :- Found wpgmza-wpgmza-css
|
12 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
13 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/distance.js
|
14 |
+
2018-10-15 19:24:28 :- Found wpgmza-distance
|
15 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
16 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/event-dispatcher.js
|
17 |
+
2018-10-15 19:24:28 :- Found wpgmza-event-dispatcher
|
18 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
19 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/event.js
|
20 |
+
2018-10-15 19:24:28 :- Found wpgmza-event
|
21 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
22 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/friendly-error.js
|
23 |
+
2018-10-15 19:24:28 :- Found wpgmza-friendly-error
|
24 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
25 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/geocoder.js
|
26 |
+
2018-10-15 19:24:28 :- Found wpgmza-geocoder
|
27 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
28 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-api-error-handler.js
|
29 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-api-error-handler
|
30 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
31 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/info-window.js
|
32 |
+
2018-10-15 19:24:28 :- Found wpgmza-info-window
|
33 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-event-dispatcher
|
34 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/latlng.js
|
35 |
+
2018-10-15 19:24:28 :- Found wpgmza-lat-lng
|
36 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
37 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/latlngbounds.js
|
38 |
+
2018-10-15 19:24:28 :- Found wpgmza-lat-lng-bounds
|
39 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
40 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-object.js
|
41 |
+
2018-10-15 19:24:28 :- Found wpgmza-map-object
|
42 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-event-dispatcher
|
43 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-settings-page.js
|
44 |
+
2018-10-15 19:24:28 :- Found wpgmza-map-settings-page
|
45 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
46 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map-settings.js
|
47 |
+
2018-10-15 19:24:28 :- Found wpgmza-map-settings
|
48 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
49 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/map.js
|
50 |
+
2018-10-15 19:24:28 :- Found wpgmza-map
|
51 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-event-dispatcher
|
52 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/maps-engine-dialog.js
|
53 |
+
2018-10-15 19:24:28 :- Found wpgmza-maps-engine-dialog
|
54 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
55 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/marker.js
|
56 |
+
2018-10-15 19:24:28 :- Found wpgmza-marker
|
57 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
58 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/modern-store-locator-circle.js
|
59 |
+
2018-10-15 19:24:28 :- Found wpgmza-modern-store-locator-circle
|
60 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
61 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/modern-store-locator.js
|
62 |
+
2018-10-15 19:24:28 :- Found wpgmza-modern-store-locator
|
63 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
64 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/polygon.js
|
65 |
+
2018-10-15 19:24:28 :- Found wpgmza-polygon
|
66 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-map-object
|
67 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/polyline.js
|
68 |
+
2018-10-15 19:24:28 :- Found wpgmza-polyline
|
69 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-map-object
|
70 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/rest-api.js
|
71 |
+
2018-10-15 19:24:28 :- Found wpgmza-wpgmza-rest-api
|
72 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
73 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/v7-custom-script.js
|
74 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/version.js
|
75 |
+
2018-10-15 19:24:28 :- Found wpgmza-version
|
76 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
77 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/3rd-party-integration/integration.js
|
78 |
+
2018-10-15 19:24:28 :- Found wpgmza-integration
|
79 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
80 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js
|
81 |
+
2018-10-15 19:24:28 :- Found wpgmza-gutenberg
|
82 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-integration
|
83 |
+
2018-10-15 19:24:28 :- Adding dependency wp-i18n
|
84 |
+
2018-10-15 19:24:28 :- Adding dependency wp-blocks
|
85 |
+
2018-10-15 19:24:28 :- Adding dependency wp-editor
|
86 |
+
2018-10-15 19:24:28 :- Adding dependency wp-components
|
87 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/compatibility/google-ui-compatibility.js
|
88 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-ui-compatibility
|
89 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza
|
90 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-circle.js
|
91 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-circle
|
92 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-circle
|
93 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-geocoder.js
|
94 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-geocoder
|
95 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-geocoder
|
96 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-info-window.js
|
97 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-info-window
|
98 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-info-window
|
99 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-map.js
|
100 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-map
|
101 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-map
|
102 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-marker.js
|
103 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-marker
|
104 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-marker
|
105 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-modern-store-locator-circle.js
|
106 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-modern-store-locator-circle
|
107 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-modern-store-locator-circle
|
108 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-modern-store-locator.js
|
109 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-modern-store-locator
|
110 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-modern-store-locator
|
111 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-polygon.js
|
112 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-polygon
|
113 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-polygon
|
114 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-polyline.js
|
115 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-polyline
|
116 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-polyline
|
117 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/google-maps/google-vertex-context-menu.js
|
118 |
+
2018-10-15 19:24:28 :- Found wpgmza-google-vertex-context-menu
|
119 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza_api_call
|
120 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-circle.js
|
121 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-circle
|
122 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-circle
|
123 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-geocoder.js
|
124 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-geocoder
|
125 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-geocoder
|
126 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-info-window.js
|
127 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-info-window
|
128 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-info-window
|
129 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-map.js
|
130 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-map
|
131 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-map
|
132 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-marker.js
|
133 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-marker
|
134 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-marker
|
135 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-modern-store-locator-circle.js
|
136 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-modern-store-locator-circle
|
137 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-modern-store-locator-circle
|
138 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-modern-store-locator.js
|
139 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-modern-store-locator
|
140 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-modern-store-locator
|
141 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-polygon.js
|
142 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-polygon
|
143 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-polygon
|
144 |
+
2018-10-15 19:24:28 :- Reading F:\Code Cabin\htdocs-7.10.x\wp-content\plugins\wp-google-maps/js/v8/open-layers/ol-polyline.js
|
145 |
+
2018-10-15 19:24:28 :- Found wpgmza-ol-polyline
|
146 |
+
2018-10-15 19:24:28 :- Adding dependency wpgmza-polyline
|
includes/class.factory.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGMZA;
|
4 |
+
|
5 |
+
class Factory
|
6 |
+
{
|
7 |
+
public static function createInstance()
|
8 |
+
{
|
9 |
+
$class = get_called_class();
|
10 |
+
$args = func_get_args();
|
11 |
+
$count = count($args);
|
12 |
+
$filter = "wpgmza_create_$class";
|
13 |
+
|
14 |
+
if($class == 'WPGMZA\Factory')
|
15 |
+
throw new \Exception('Factory createInstance would return abstract Factory');
|
16 |
+
|
17 |
+
if(empty($args))
|
18 |
+
$filter_args = array($filter, null);
|
19 |
+
else
|
20 |
+
$filter_args = array_merge(array($filter), $args);
|
21 |
+
|
22 |
+
$override = call_user_func_array('apply_filters', $filter_args);
|
23 |
+
|
24 |
+
if($override instanceof \WPGMZA\Factory)
|
25 |
+
return $override;
|
26 |
+
|
27 |
+
$reflect = new \ReflectionClass($class);
|
28 |
+
$instance = $reflect->newInstanceArgs($args);
|
29 |
+
|
30 |
+
return $instance;
|
31 |
+
}
|
32 |
+
}
|
includes/class.plugin.php
CHANGED
@@ -13,6 +13,11 @@ class Plugin
|
|
13 |
const PAGE_ADVANCED = "advanced";
|
14 |
const PAGE_CUSTOM_FIELDS = "custom-fields";
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
public static $enqueueScriptsFired = false;
|
17 |
|
18 |
public $settings;
|
@@ -66,6 +71,7 @@ class Plugin
|
|
66 |
$this->settings = (object)array_merge($this->legacySettings, $settings);
|
67 |
|
68 |
$this->restAPI = new RestAPI();
|
|
|
69 |
|
70 |
if(!empty($this->settings->wpgmza_maps_engine))
|
71 |
$this->settings->engine = $this->settings->wpgmza_maps_engine;
|
@@ -73,14 +79,13 @@ class Plugin
|
|
73 |
if(!empty($_COOKIE['wpgmza-developer-mode']))
|
74 |
$this->settings->developer_mode = true;
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
if($this->settings->engine == 'open-layers')
|
85 |
require_once(plugin_dir_path(__FILE__) . 'open-layers/class.nominatim-geocode-cache.php');
|
86 |
}
|
@@ -123,15 +128,13 @@ class Plugin
|
|
123 |
}
|
124 |
else
|
125 |
{
|
126 |
-
|
127 |
-
|
128 |
-
$
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
$this->scriptLoader->enqueueStyles();
|
134 |
-
});
|
135 |
}
|
136 |
}
|
137 |
|
13 |
const PAGE_ADVANCED = "advanced";
|
14 |
const PAGE_CUSTOM_FIELDS = "custom-fields";
|
15 |
|
16 |
+
private static $enqueueScriptActions = array(
|
17 |
+
'wp_enqueue_scripts',
|
18 |
+
'admin_enqueue_scripts',
|
19 |
+
'enqueue_block_assets'
|
20 |
+
);
|
21 |
public static $enqueueScriptsFired = false;
|
22 |
|
23 |
public $settings;
|
71 |
$this->settings = (object)array_merge($this->legacySettings, $settings);
|
72 |
|
73 |
$this->restAPI = new RestAPI();
|
74 |
+
$this->gutenbergIntegration = Integration\Gutenberg::createInstance();
|
75 |
|
76 |
if(!empty($this->settings->wpgmza_maps_engine))
|
77 |
$this->settings->engine = $this->settings->wpgmza_maps_engine;
|
79 |
if(!empty($_COOKIE['wpgmza-developer-mode']))
|
80 |
$this->settings->developer_mode = true;
|
81 |
|
82 |
+
foreach(Plugin::$enqueueScriptActions as $action)
|
83 |
+
{
|
84 |
+
add_action($action, function() use ($action) {
|
85 |
+
Plugin::$enqueueScriptsFired = true;
|
86 |
+
}, 1);
|
87 |
+
}
|
88 |
+
|
|
|
89 |
if($this->settings->engine == 'open-layers')
|
90 |
require_once(plugin_dir_path(__FILE__) . 'open-layers/class.nominatim-geocode-cache.php');
|
91 |
}
|
128 |
}
|
129 |
else
|
130 |
{
|
131 |
+
foreach(Plugin::$enqueueScriptActions as $action)
|
132 |
+
{
|
133 |
+
add_action($action, function() {
|
134 |
+
$this->scriptLoader->enqueueScripts();
|
135 |
+
$this->scriptLoader->enqueueStyles();
|
136 |
+
});
|
137 |
+
}
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
|
includes/class.script-loader.php
CHANGED
@@ -134,7 +134,7 @@ class ScriptLoader
|
|
134 |
|
135 |
$contents = file_get_contents($file);
|
136 |
|
137 |
-
if(!preg_match('
|
138 |
continue;
|
139 |
|
140 |
$header = $m[0];
|
@@ -208,6 +208,10 @@ class ScriptLoader
|
|
208 |
$scripts = (array)(clone (object)$this->scripts);
|
209 |
$includedHandles = array();
|
210 |
$combineOrder = array();
|
|
|
|
|
|
|
|
|
211 |
$unresolvedDependencyHandles = array();
|
212 |
|
213 |
while(!empty($scripts))
|
@@ -236,18 +240,38 @@ class ScriptLoader
|
|
236 |
|
237 |
foreach($scripts as $handle => $script)
|
238 |
{
|
239 |
-
// echo "
|
240 |
|
241 |
foreach($script->dependencies as $dependency)
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
{
|
244 |
-
//
|
245 |
-
|
246 |
-
continue 2;
|
247 |
}
|
248 |
|
249 |
-
|
|
|
|
|
|
|
|
|
250 |
|
|
|
251 |
|
252 |
$combineOrder[] = $script->src;
|
253 |
$includedHandles[] = $handle;
|
@@ -267,6 +291,7 @@ class ScriptLoader
|
|
267 |
global $wpgmza;
|
268 |
|
269 |
$order = $this->getCombineOrder();
|
|
|
270 |
$combined = array();
|
271 |
$dest = plugin_dir_path(($this->proMode ? WPGMZA_PRO_FILE : __DIR__)) . 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
|
272 |
|
@@ -334,6 +359,9 @@ class ScriptLoader
|
|
334 |
if(!$minified_file_exists || $delta > 0)
|
335 |
$src = $combined;
|
336 |
|
|
|
|
|
|
|
337 |
$scripts = array('wpgmza' =>
|
338 |
(object)array(
|
339 |
'src' => $src,
|
@@ -388,6 +416,7 @@ class ScriptLoader
|
|
388 |
case '5.*':
|
389 |
wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.0.9/css/all.css');
|
390 |
|
|
|
391 |
if(!is_admin())
|
392 |
break;
|
393 |
|
@@ -417,6 +446,7 @@ class ScriptLoader
|
|
417 |
foreach($this->scripts as $handle => $script)
|
418 |
{
|
419 |
$fullpath = plugin_dir_url(($script->pro ? WPGMZA_PRO_FILE : __DIR__)) . $script->src;
|
|
|
420 |
wp_enqueue_script($handle, $fullpath, $script->dependencies, $version_string);
|
421 |
}
|
422 |
|
134 |
|
135 |
$contents = file_get_contents($file);
|
136 |
|
137 |
+
if(!preg_match('/\/\*\*.+?\*\//s', $contents, $m))
|
138 |
continue;
|
139 |
|
140 |
$header = $m[0];
|
208 |
$scripts = (array)(clone (object)$this->scripts);
|
209 |
$includedHandles = array();
|
210 |
$combineOrder = array();
|
211 |
+
|
212 |
+
$ignoreDependencyHandles = array(
|
213 |
+
'wpgmza_api_call'
|
214 |
+
);
|
215 |
$unresolvedDependencyHandles = array();
|
216 |
|
217 |
while(!empty($scripts))
|
240 |
|
241 |
foreach($scripts as $handle => $script)
|
242 |
{
|
243 |
+
// echo "\r\nLooking at $handle\r\n";
|
244 |
|
245 |
foreach($script->dependencies as $dependency)
|
246 |
+
{
|
247 |
+
// Ignored handles (eg API call)
|
248 |
+
if(array_search($dependency, $ignoreDependencyHandles) !== false)
|
249 |
+
{
|
250 |
+
//echo "Ignoring dependency $dependency\r\n";
|
251 |
+
continue;
|
252 |
+
}
|
253 |
+
|
254 |
+
// Already included handles
|
255 |
+
if(array_search($dependency, $includedHandles) !== false)
|
256 |
+
{
|
257 |
+
//echo "Already included $dependency\r\n";
|
258 |
+
continue;
|
259 |
+
}
|
260 |
+
|
261 |
+
// External handles not handled by us. This module only handles internal dependencies
|
262 |
+
if(!preg_match('/^wpgmza-/i', $dependency) && $dependency != 'wpgmza')
|
263 |
{
|
264 |
+
//echo "Ignoring external handle $dependency\r\n";
|
265 |
+
continue;
|
|
|
266 |
}
|
267 |
|
268 |
+
$unresolvedDependencyHandles[$handle] = true;
|
269 |
+
|
270 |
+
//echo "$dependency not yet included, skipping\r\n";
|
271 |
+
continue 2;
|
272 |
+
}
|
273 |
|
274 |
+
//echo "Adding $handle ({$script->src})\r\n";
|
275 |
|
276 |
$combineOrder[] = $script->src;
|
277 |
$includedHandles[] = $handle;
|
291 |
global $wpgmza;
|
292 |
|
293 |
$order = $this->getCombineOrder();
|
294 |
+
|
295 |
$combined = array();
|
296 |
$dest = plugin_dir_path(($this->proMode ? WPGMZA_PRO_FILE : __DIR__)) . 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
|
297 |
|
359 |
if(!$minified_file_exists || $delta > 0)
|
360 |
$src = $combined;
|
361 |
|
362 |
+
// TODO: Remove this, fix errors
|
363 |
+
$src = $combined;
|
364 |
+
|
365 |
$scripts = array('wpgmza' =>
|
366 |
(object)array(
|
367 |
'src' => $src,
|
416 |
case '5.*':
|
417 |
wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.0.9/css/all.css');
|
418 |
|
419 |
+
// If we're not in admin, break. If we are, continue and enqueue FA 4 which is used by the map edit page
|
420 |
if(!is_admin())
|
421 |
break;
|
422 |
|
446 |
foreach($this->scripts as $handle => $script)
|
447 |
{
|
448 |
$fullpath = plugin_dir_url(($script->pro ? WPGMZA_PRO_FILE : __DIR__)) . $script->src;
|
449 |
+
|
450 |
wp_enqueue_script($handle, $fullpath, $script->dependencies, $version_string);
|
451 |
}
|
452 |
|
includes/class.script-loader.php.bak
ADDED
@@ -0,0 +1,452 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace WPGMZA;
|
4 |
+
|
5 |
+
require_once(plugin_dir_path(__FILE__) . 'google-maps/class.google-maps-loader.php');
|
6 |
+
require_once(plugin_dir_path(__FILE__) . 'open-layers/class.ol-loader.php');
|
7 |
+
|
8 |
+
class ScriptLoader
|
9 |
+
{
|
10 |
+
private $proMode = false;
|
11 |
+
private $logStarted = false;
|
12 |
+
|
13 |
+
public $scripts;
|
14 |
+
|
15 |
+
public function __construct($proMode)
|
16 |
+
{
|
17 |
+
$this->proMode = $proMode;
|
18 |
+
|
19 |
+
if($this->proMode)
|
20 |
+
$this->scriptsFileLocation = plugin_dir_path(WPGMZA_PRO_FILE) . 'js/v8/pro-scripts.json';
|
21 |
+
else
|
22 |
+
$this->scriptsFileLocation = plugin_dir_path(__DIR__) . 'js/v8/scripts.json';
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function log($str)
|
26 |
+
{
|
27 |
+
$dest = __DIR__ . '/build.log';
|
28 |
+
|
29 |
+
if(!$this->logStarted)
|
30 |
+
file_put_contents($dest, "");
|
31 |
+
|
32 |
+
$this->logStarted = true;
|
33 |
+
file_put_contents($dest, date("Y-m-d H:i:s :-\t") . $str . "\r\n", FILE_APPEND);
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function rglob($pattern, $flags = 0)
|
37 |
+
{
|
38 |
+
$files = glob($pattern, $flags);
|
39 |
+
|
40 |
+
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
|
41 |
+
|
42 |
+
$files = array_merge($files, $this->rglob($dir.'/'.basename($pattern), $flags));
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
return $files;
|
47 |
+
}
|
48 |
+
|
49 |
+
protected function getHandleFromModuleName($module)
|
50 |
+
{
|
51 |
+
return trim(preg_replace('/^wpgmza\./', 'wpgmza-',
|
52 |
+
strtolower(
|
53 |
+
preg_replace('/(?<=[A-Za-z])(?=[A-Z][a-z])|(?<=[a-z0-9])(?=[0-9]?[A-Z])/', '-', $module)
|
54 |
+
)
|
55 |
+
));
|
56 |
+
}
|
57 |
+
|
58 |
+
protected function getLibraryScripts()
|
59 |
+
{
|
60 |
+
global $wpgmza;
|
61 |
+
|
62 |
+
$plugin_dir_url = plugin_dir_url(__DIR__);
|
63 |
+
|
64 |
+
$libraryDependencies = array(
|
65 |
+
'datatables' => $plugin_dir_url . 'js/jquery.dataTables.min.js',
|
66 |
+
'jquery-cookie' => $plugin_dir_url . 'lib/jquery-cookie.js',
|
67 |
+
// 'modernizr-custom' => $plugin_dir_url . 'lib/modernizr-custom.js',
|
68 |
+
'remodal' => $plugin_dir_url . 'lib/' . ($wpgmza->isUsingMinifiedScripts() ? 'remodal.min.js' : 'remodal.js'),
|
69 |
+
// 'resize-sensor' => $plugin_dir_url . 'lib/ResizeSensor.js',
|
70 |
+
'spectrum' => $plugin_dir_url . 'lib/spectrum.js'
|
71 |
+
);
|
72 |
+
|
73 |
+
/*if($wpgmza->isProVersion())
|
74 |
+
{
|
75 |
+
$pro_dir = plugin_dir_url(WPGMZA_PRO_FILE);
|
76 |
+
|
77 |
+
$libraryDependencies = array_merge($libraryDependencies, array(
|
78 |
+
'jstree' => $pro_dir . ($wpgmza->isUsingMinifiedScripts() ? 'lib/jstree.min.js' : 'lib/jstree.js'),
|
79 |
+
'jszip' => $pro_dir . 'lib/jszip.min.js',
|
80 |
+
'jquery-multiselect' => $pro_dir . 'lib/jquery.multiselect.js',
|
81 |
+
'owl-carousel' => $pro_dir . 'lib/owl.carousel.min.js'
|
82 |
+
));
|
83 |
+
}*/
|
84 |
+
|
85 |
+
if($wpgmza->getCurrentPage() && is_admin())
|
86 |
+
{
|
87 |
+
wp_enqueue_script('jquery-ui-core');
|
88 |
+
wp_enqueue_script('jquery-ui-dialog');
|
89 |
+
wp_enqueue_script('jquery-ui-slider');
|
90 |
+
wp_enqueue_script('jquery-ui-tabs');
|
91 |
+
wp_enqueue_script('jquery-ui-progressbar');
|
92 |
+
wp_enqueue_script('jquery-ui-accordion');
|
93 |
+
wp_enqueue_script('jquery-ui-sortable');
|
94 |
+
wp_enqueue_script('jquery-ui-draggable');
|
95 |
+
}
|
96 |
+
|
97 |
+
return apply_filters('wpgmza-get-library-dependencies', $libraryDependencies);
|
98 |
+
}
|
99 |
+
|
100 |
+
protected function getScanDirectories()
|
101 |
+
{
|
102 |
+
$result = array(
|
103 |
+
plugin_dir_path(__DIR__) . 'js/v8' => plugin_dir_url(__DIR__) . 'js/v8'
|
104 |
+
);
|
105 |
+
|
106 |
+
if($this->proMode)
|
107 |
+
$result[plugin_dir_path(WPGMZA_PRO_FILE) . 'js/v8'] = plugin_dir_url(WPGMZA_PRO_FILE) . 'js/v8';
|
108 |
+
|
109 |
+
return $result;
|
110 |
+
}
|
111 |
+
|
112 |
+
protected function scanDependencies()
|
113 |
+
{
|
114 |
+
$this->scripts = array();
|
115 |
+
|
116 |
+
$directories = $this->getScanDirectories();
|
117 |
+
|
118 |
+
$files = array();
|
119 |
+
$this->dependenciesByHandle = array();
|
120 |
+
|
121 |
+
$this->log("Scanning dependencies");
|
122 |
+
|
123 |
+
foreach($directories as $dir => $path)
|
124 |
+
{
|
125 |
+
$pro_directory = (preg_match('/-pro/', $dir) ? true : false);
|
126 |
+
$files = $this->rglob("$dir/*.js");
|
127 |
+
|
128 |
+
foreach($files as $file)
|
129 |
+
{
|
130 |
+
if(preg_match('/combined\.js|min\.js$/', $file))
|
131 |
+
continue;
|
132 |
+
|
133 |
+
$this->log("Reading $file");
|
134 |
+
|
135 |
+
$contents = file_get_contents($file);
|
136 |
+
|
137 |
+
if(!preg_match('/\/\*\*.+?\*\//s', $contents, $m))
|
138 |
+
continue;
|
139 |
+
|
140 |
+
$header = $m[0];
|
141 |
+
|
142 |
+
// Read module name
|
143 |
+
if(!preg_match('/@module\s+(.+)/', $header, $m))
|
144 |
+
continue;
|
145 |
+
|
146 |
+
$module = trim($m[1]);
|
147 |
+
|
148 |
+
$handle = $this->getHandleFromModuleName($module);
|
149 |
+
if($handle != 'wpgmza')
|
150 |
+
$handle = 'wpgmza-' . $handle;
|
151 |
+
|
152 |
+
$dependencies = array();
|
153 |
+
|
154 |
+
$this->log("Found $handle");
|
155 |
+
|
156 |
+
if(preg_match_all('/@(pro-)?requires (.+)/', $header, $m))
|
157 |
+
{
|
158 |
+
$len = count($m[0]);
|
159 |
+
|
160 |
+
for($i = 0; $i < $len; $i++)
|
161 |
+
{
|
162 |
+
$pro = !empty($m[1][$i]);
|
163 |
+
|
164 |
+
$dependencyModule = $m[2][$i];
|
165 |
+
|
166 |
+
$dependencyHandle = preg_replace('/^wpgmza\./',
|
167 |
+
'wpgmza-',
|
168 |
+
$this->getHandleFromModuleName($dependencyModule)
|
169 |
+
);
|
170 |
+
|
171 |
+
if(!$pro)
|
172 |
+
{
|
173 |
+
$this->log("Adding dependency $dependencyHandle");
|
174 |
+
$dependencies[] = $dependencyHandle;
|
175 |
+
}
|
176 |
+
else if($this->proMode)
|
177 |
+
{
|
178 |
+
$this->log("Adding Pro dependency $dependencyHandle");
|
179 |
+
$dependencies[] = $dependencyHandle;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
$src = str_replace($dir, 'js/v8', $file);
|
185 |
+
|
186 |
+
if(empty($this->dependenciesByHandle[$handle]))
|
187 |
+
$this->dependenciesByHandle[$handle] = array();
|
188 |
+
|
189 |
+
$this->dependenciesByHandle[$handle][] = $file;
|
190 |
+
|
191 |
+
$this->scripts[$handle] = (object)array(
|
192 |
+
'src' => $src,
|
193 |
+
'pro' => $pro_directory,
|
194 |
+
'dependencies' => $dependencies
|
195 |
+
);
|
196 |
+
}
|
197 |
+
}
|
198 |
+
|
199 |
+
file_put_contents($this->scriptsFileLocation, json_encode($this->scripts, JSON_PRETTY_PRINT));
|
200 |
+
}
|
201 |
+
|
202 |
+
public function getCombineOrder()
|
203 |
+
{
|
204 |
+
if(!$this->scripts)
|
205 |
+
$this->scanDependencies();
|
206 |
+
|
207 |
+
$iterations = 0;
|
208 |
+
$scripts = (array)(clone (object)$this->scripts);
|
209 |
+
$includedHandles = array();
|
210 |
+
$combineOrder = array();
|
211 |
+
|
212 |
+
$ignoreDependencyHandles = array(
|
213 |
+
'wpgmza_api_call'
|
214 |
+
);
|
215 |
+
$unresolvedDependencyHandles = array();
|
216 |
+
|
217 |
+
while(!empty($scripts))
|
218 |
+
{
|
219 |
+
if(++$iterations > 100000)
|
220 |
+
{
|
221 |
+
//echo "Dumping included handles\r\n";
|
222 |
+
//var_dump($includedHandles);
|
223 |
+
|
224 |
+
//echo "Dumping remaining scripts\r\n\r\n";
|
225 |
+
//var_dump($scripts);
|
226 |
+
|
227 |
+
echo "<pre>";
|
228 |
+
echo "Dumping unresolved dependencies\r\n\r\n";
|
229 |
+
//var_dump(array_keys($unresolvedDependencyHandles));
|
230 |
+
|
231 |
+
foreach($unresolvedDependencyHandles as $handle => $unused)
|
232 |
+
{
|
233 |
+
echo "$handle (in " . implode(', ', $this->dependenciesByHandle[$handle]) . ")\r\n";
|
234 |
+
}
|
235 |
+
|
236 |
+
echo "</pre>";
|
237 |
+
|
238 |
+
throw new \Exception('Iteration limit hit possibly due to dependency recusion or unresolved dependencies');
|
239 |
+
}
|
240 |
+
|
241 |
+
foreach($scripts as $handle => $script)
|
242 |
+
{
|
243 |
+
// echo "Looking at $handle\r\n";
|
244 |
+
|
245 |
+
foreach($script->dependencies as $dependency)
|
246 |
+
{
|
247 |
+
// Ignored handles (eg API call)
|
248 |
+
if(array_search($dependency, $ignoreDependencyHandles) !== false)
|
249 |
+
continue;
|
250 |
+
|
251 |
+
// Already included handles
|
252 |
+
if(array_search($dependency, $includedHandles) !== false)
|
253 |
+
continue;
|
254 |
+
|
255 |
+
// External handles not handled by us. This module only handles internal dependencies
|
256 |
+
if(!preg_match('/^wpgmza-/i', $dependency))
|
257 |
+
continue;
|
258 |
+
|
259 |
+
$unresolvedDependencyHandles[$handle] = true;
|
260 |
+
continue 2;
|
261 |
+
}
|
262 |
+
|
263 |
+
// echo "Adding $handle ({$script->src})\r\n";
|
264 |
+
|
265 |
+
|
266 |
+
$combineOrder[] = $script->src;
|
267 |
+
$includedHandles[] = $handle;
|
268 |
+
|
269 |
+
unset($scripts[$handle]);
|
270 |
+
unset($unresolvedDependencyHandles[$handle]);
|
271 |
+
|
272 |
+
break;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
return $combineOrder;
|
277 |
+
}
|
278 |
+
|
279 |
+
public function buildCombinedFile()
|
280 |
+
{
|
281 |
+
global $wpgmza;
|
282 |
+
|
283 |
+
$order = $this->getCombineOrder();
|
284 |
+
$combined = array();
|
285 |
+
$dest = plugin_dir_path(($this->proMode ? WPGMZA_PRO_FILE : __DIR__)) . 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
|
286 |
+
|
287 |
+
foreach($order as $file)
|
288 |
+
{
|
289 |
+
if(preg_match('/\.(combined|min)\.js$/', $file))
|
290 |
+
continue;
|
291 |
+
|
292 |
+
$src = plugin_dir_path(__DIR__) . $file;
|
293 |
+
|
294 |
+
if(!file_exists($src))
|
295 |
+
$src = plugin_dir_path(WPGMZA_PRO_FILE) . $file;
|
296 |
+
|
297 |
+
$contents = "\r\n// $file\r\n" . file_get_contents($src);
|
298 |
+
$combined[] = $contents;
|
299 |
+
}
|
300 |
+
|
301 |
+
$combined = implode("\r\n", $combined);
|
302 |
+
|
303 |
+
if(file_exists($dest) && md5(file_get_contents($dest)) == md5($combined))
|
304 |
+
return; // No changes, no need to build
|
305 |
+
|
306 |
+
file_put_contents($dest, $combined);
|
307 |
+
}
|
308 |
+
|
309 |
+
public function build()
|
310 |
+
{
|
311 |
+
$this->scanDependencies();
|
312 |
+
$this->buildCombinedFile();
|
313 |
+
}
|
314 |
+
|
315 |
+
public function enqueueStyles()
|
316 |
+
{
|
317 |
+
global $wpgmza;
|
318 |
+
|
319 |
+
// wp_enqueue_style('wpgmza-color-picker', plugin_dir_url(__DIR__) . 'lib/spectrum.css');
|
320 |
+
// wp_enqueue_style('datatables', '//cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css');
|
321 |
+
|
322 |
+
wp_enqueue_style('remodal', plugin_dir_url(__DIR__) . 'lib/remodal.css');
|
323 |
+
wp_enqueue_style('remodal-default-theme', plugin_dir_url(__DIR__) . 'lib/remodal-default-theme.css');
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Returns an array of objects representing all scripts used by the plugin
|
328 |
+
* @return array
|
329 |
+
*/
|
330 |
+
public function getPluginScripts()
|
331 |
+
{
|
332 |
+
global $wpgmza;
|
333 |
+
|
334 |
+
if($wpgmza->isUsingMinifiedScripts())
|
335 |
+
{
|
336 |
+
$dir = ($this->proMode ? plugin_dir_path(WPGMZA_PRO_FILE) : plugin_dir_path(__DIR__));
|
337 |
+
|
338 |
+
$combined = 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.combined.js';
|
339 |
+
$minified = 'js/v8/wp-google-maps' . ($this->proMode ? '-pro' : '') . '.min.js';
|
340 |
+
|
341 |
+
$src = $minified;
|
342 |
+
|
343 |
+
$minified_file_exists = file_exists($dir . $minified);
|
344 |
+
|
345 |
+
if($minified_file_exists)
|
346 |
+
$delta = filemtime($dir . $combined) - filemtime($dir . $minified);
|
347 |
+
|
348 |
+
if(!$minified_file_exists || $delta > 0)
|
349 |
+
$src = $combined;
|
350 |
+
|
351 |
+
$scripts = array('wpgmza' =>
|
352 |
+
(object)array(
|
353 |
+
'src' => $src,
|
354 |
+
'pro' => $this->proMode
|
355 |
+
)
|
356 |
+
);
|
357 |
+
}
|
358 |
+
else
|
359 |
+
{
|
360 |
+
// Enqueue core object with library dependencies
|
361 |
+
$scripts = (array)json_decode(file_get_contents($this->scriptsFileLocation));
|
362 |
+
}
|
363 |
+
|
364 |
+
return $scripts;
|
365 |
+
}
|
366 |
+
|
367 |
+
public function enqueueScripts()
|
368 |
+
{
|
369 |
+
global $wpgmza;
|
370 |
+
|
371 |
+
// Get library scripts
|
372 |
+
$libraries = $this->getLibraryScripts();
|
373 |
+
|
374 |
+
// Enqueue Google API call if necessary
|
375 |
+
switch($wpgmza->settings->engine)
|
376 |
+
{
|
377 |
+
case 'google-maps':
|
378 |
+
$loader = ($wpgmza->isProVersion() ? new GoogleProMapsLoader() : new GoogleMapsLoader());
|
379 |
+
$loader->loadGoogleMaps();
|
380 |
+
break;
|
381 |
+
|
382 |
+
default:
|
383 |
+
$loader = new OLLoader();
|
384 |
+
$loader->loadOpenLayers();
|
385 |
+
break;
|
386 |
+
}
|
387 |
+
|
388 |
+
// Enqueue library scripts first
|
389 |
+
foreach($libraries as $handle => $src)
|
390 |
+
{
|
391 |
+
wp_enqueue_script($handle, $src, array('jquery'));
|
392 |
+
}
|
393 |
+
|
394 |
+
// FontAwesome?
|
395 |
+
$version = (empty($wpgmza->settings->use_fontawesome) ? '4.*' : $wpgmza->settings->use_fontawesome);
|
396 |
+
|
397 |
+
switch($version)
|
398 |
+
{
|
399 |
+
case 'none':
|
400 |
+
break;
|
401 |
+
|
402 |
+
case '5.*':
|
403 |
+
wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v5.0.9/css/all.css');
|
404 |
+
|
405 |
+
if(!is_admin())
|
406 |
+
break;
|
407 |
+
|
408 |
+
default:
|
409 |
+
wp_enqueue_style('fontawesome', plugin_dir_url(__DIR__) . 'css/font-awesome.min.css');
|
410 |
+
break;
|
411 |
+
}
|
412 |
+
|
413 |
+
// Scripts
|
414 |
+
$this->scripts = $this->getPluginScripts();
|
415 |
+
|
416 |
+
// Give the core script library dependencies
|
417 |
+
$dependencies = array_keys($libraries);
|
418 |
+
|
419 |
+
// Sometimes we need to load the plugin JS files but not the maps API. The following code stops the API being loaded as a dependency of the plugin JS files when that is the case.
|
420 |
+
$apiLoader = new GoogleMapsAPILoader();
|
421 |
+
if($apiLoader->isIncludeAllowed())
|
422 |
+
$dependencies[] = 'wpgmza_api_call';
|
423 |
+
|
424 |
+
$this->scripts['wpgmza']->dependencies = $dependencies;
|
425 |
+
|
426 |
+
$version_string = $wpgmza->getBasicVersion();
|
427 |
+
if(method_exists($wpgmza, 'getProVersion'))
|
428 |
+
$version_string .= '+pro-' . $wpgmza->getProVersion();
|
429 |
+
|
430 |
+
// Enqueue other scripts
|
431 |
+
foreach($this->scripts as $handle => $script)
|
432 |
+
{
|
433 |
+
$fullpath = plugin_dir_url(($script->pro ? WPGMZA_PRO_FILE : __DIR__)) . $script->src;
|
434 |
+
|
435 |
+
wp_enqueue_script($handle, $fullpath, $script->dependencies, $version_string);
|
436 |
+
}
|
437 |
+
|
438 |
+
// Enqueue localized data
|
439 |
+
$this->enqueueLocalizedData();
|
440 |
+
//$this->enqueueTourData();
|
441 |
+
//$this->enqueueCustomJavascript();
|
442 |
+
}
|
443 |
+
|
444 |
+
public function enqueueLocalizedData()
|
445 |
+
{
|
446 |
+
global $wpgmza;
|
447 |
+
|
448 |
+
$data = $wpgmza->getLocalizedData();
|
449 |
+
|
450 |
+
wp_localize_script('wpgmza', 'WPGMZA_localized_data', (array)$data);
|
451 |
+
}
|
452 |
+
}
|
js/test.html
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
<head>
|
4 |
-
<script
|
5 |
-
src="https://code.jquery.com/jquery-1.12.4.js"
|
6 |
-
integrity="sha256-Qw82+bXyGq6MydymqBxNPYTaUXXq7c8v3CwiYwLLNXU="
|
7 |
-
crossorigin="anonymous"></script>
|
8 |
-
<script>
|
9 |
-
|
10 |
-
console.log($);
|
11 |
-
|
12 |
-
</script>
|
13 |
-
</head>
|
14 |
-
<body>
|
15 |
-
</body>
|
16 |
-
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @namespace WPGMZA.Integration
|
5 |
+
* @module Gutenberg
|
6 |
+
* @requires WPGMZA.Integration
|
7 |
+
* @requires wp-i18n
|
8 |
+
* @requires wp-blocks
|
9 |
+
* @requires wp-editor
|
10 |
+
* @requires wp-components
|
11 |
+
*/
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Internal block libraries
|
15 |
+
*/
|
16 |
+
jQuery(function ($) {
|
17 |
+
|
18 |
+
if (!wp || !wp.i18n || !wp.blocks) return;
|
19 |
+
|
20 |
+
var __ = wp.i18n.__;
|
21 |
+
var registerBlockType = wp.blocks.registerBlockType;
|
22 |
+
var _wp$editor = wp.editor,
|
23 |
+
InspectorControls = _wp$editor.InspectorControls,
|
24 |
+
BlockControls = _wp$editor.BlockControls;
|
25 |
+
var _wp$components = wp.components,
|
26 |
+
Dashicon = _wp$components.Dashicon,
|
27 |
+
Toolbar = _wp$components.Toolbar,
|
28 |
+
Button = _wp$components.Button,
|
29 |
+
Tooltip = _wp$components.Tooltip,
|
30 |
+
PanelBody = _wp$components.PanelBody,
|
31 |
+
TextareaControl = _wp$components.TextareaControl,
|
32 |
+
TextControl = _wp$components.TextControl,
|
33 |
+
RichText = _wp$components.RichText;
|
34 |
+
|
35 |
+
|
36 |
+
WPGMZA.Integration.Gutenberg = function () {
|
37 |
+
registerBlockType('gutenberg-wpgmza/block', this.getBlockDefinition());
|
38 |
+
};
|
39 |
+
|
40 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockTitle = function () {
|
41 |
+
return __("WP Google Maps");
|
42 |
+
};
|
43 |
+
|
44 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls = function (props) {
|
45 |
+
return React.createElement(
|
46 |
+
InspectorControls,
|
47 |
+
{ key: "inspector" },
|
48 |
+
React.createElement(PanelBody, { title: __('Map Settings') })
|
49 |
+
);
|
50 |
+
};
|
51 |
+
|
52 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes = function () {
|
53 |
+
return {};
|
54 |
+
};
|
55 |
+
|
56 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition = function (props) {
|
57 |
+
var _this = this;
|
58 |
+
|
59 |
+
return {
|
60 |
+
|
61 |
+
title: __("WP Google Maps"),
|
62 |
+
description: __('The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.'),
|
63 |
+
category: 'common',
|
64 |
+
icon: 'location-alt',
|
65 |
+
keywords: [__('Map'), __('Maps'), __('Google')],
|
66 |
+
attributes: this.getBlockAttributes(),
|
67 |
+
|
68 |
+
edit: function edit(props) {
|
69 |
+
return [!!props.isSelected && _this.getBlockInspectorControls(props), React.createElement(
|
70 |
+
"div",
|
71 |
+
{ className: props.className + " wpgmza-gutenberg-block" },
|
72 |
+
React.createElement(Dashicon, { icon: "location-alt" }),
|
73 |
+
React.createElement(
|
74 |
+
"span",
|
75 |
+
{ "class": "wpgmza-gutenberg-block-title" },
|
76 |
+
__("WP Google Maps")
|
77 |
+
)
|
78 |
+
)];
|
79 |
+
},
|
80 |
+
// Defining the front-end interface
|
81 |
+
save: function save(props) {
|
82 |
+
// Rendering in PHP
|
83 |
+
return null;
|
84 |
+
}
|
85 |
+
|
86 |
+
};
|
87 |
+
};
|
88 |
+
|
89 |
+
WPGMZA.Integration.Gutenberg.getConstructor = function () {
|
90 |
+
return WPGMZA.Integration.Gutenberg;
|
91 |
+
};
|
92 |
+
|
93 |
+
WPGMZA.Integration.Gutenberg.createInstance = function () {
|
94 |
+
var constructor = WPGMZA.Integration.Gutenberg.getConstructor();
|
95 |
+
return new constructor();
|
96 |
+
};
|
97 |
+
|
98 |
+
// Allow the Pro module to extend and create the module, only create here when Pro isn't loaded
|
99 |
+
if (!WPGMZA.isProVersion()) WPGMZA.integrationModules.gutenberg = WPGMZA.Integration.Gutenberg.createInstance();
|
100 |
+
});
|
js/v8/3rd-party-integration/gutenberg/src/gutenberg.jsx
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @namespace WPGMZA.Integration
|
3 |
+
* @module Gutenberg
|
4 |
+
* @requires WPGMZA.Integration
|
5 |
+
* @requires wp-i18n
|
6 |
+
* @requires wp-blocks
|
7 |
+
* @requires wp-editor
|
8 |
+
* @requires wp-components
|
9 |
+
*/
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Internal block libraries
|
13 |
+
*/
|
14 |
+
jQuery(function($) {
|
15 |
+
|
16 |
+
if(!wp || !wp.i18n || !wp.blocks)
|
17 |
+
return;
|
18 |
+
|
19 |
+
const { __ } = wp.i18n;
|
20 |
+
|
21 |
+
const { registerBlockType } = wp.blocks;
|
22 |
+
|
23 |
+
const {
|
24 |
+
InspectorControls,
|
25 |
+
BlockControls
|
26 |
+
} = wp.editor;
|
27 |
+
|
28 |
+
const {
|
29 |
+
Dashicon,
|
30 |
+
Toolbar,
|
31 |
+
Button,
|
32 |
+
Tooltip,
|
33 |
+
PanelBody,
|
34 |
+
TextareaControl,
|
35 |
+
TextControl,
|
36 |
+
RichText
|
37 |
+
} = wp.components;
|
38 |
+
|
39 |
+
WPGMZA.Integration.Gutenberg = function()
|
40 |
+
{
|
41 |
+
registerBlockType( 'gutenberg-wpgmza/block', this.getBlockDefinition() );
|
42 |
+
}
|
43 |
+
|
44 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockTitle = function()
|
45 |
+
{
|
46 |
+
return __("WP Google Maps");
|
47 |
+
}
|
48 |
+
|
49 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls = function(props)
|
50 |
+
{
|
51 |
+
return (
|
52 |
+
<InspectorControls key="inspector">
|
53 |
+
<PanelBody title={ __( 'Map Settings' ) } >
|
54 |
+
|
55 |
+
</PanelBody>
|
56 |
+
</InspectorControls>
|
57 |
+
);
|
58 |
+
}
|
59 |
+
|
60 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes = function()
|
61 |
+
{
|
62 |
+
return {};
|
63 |
+
}
|
64 |
+
|
65 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition = function(props)
|
66 |
+
{
|
67 |
+
return {
|
68 |
+
|
69 |
+
title: __("WP Google Maps"),
|
70 |
+
description: __( 'The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.' ),
|
71 |
+
category: 'common',
|
72 |
+
icon: 'location-alt',
|
73 |
+
keywords: [
|
74 |
+
__( 'Map' ),
|
75 |
+
__( 'Maps' ),
|
76 |
+
__( 'Google' ),
|
77 |
+
],
|
78 |
+
attributes: this.getBlockAttributes(),
|
79 |
+
|
80 |
+
edit: props => {
|
81 |
+
return [
|
82 |
+
!! props.isSelected && (
|
83 |
+
this.getBlockInspectorControls(props)
|
84 |
+
),
|
85 |
+
<div className={ props.className + " wpgmza-gutenberg-block" }>
|
86 |
+
|
87 |
+
<Dashicon icon="location-alt"/>
|
88 |
+
<span class="wpgmza-gutenberg-block-title">
|
89 |
+
{ __("WP Google Maps") }
|
90 |
+
</span>
|
91 |
+
</div>
|
92 |
+
];
|
93 |
+
},
|
94 |
+
// Defining the front-end interface
|
95 |
+
save: props => {
|
96 |
+
// Rendering in PHP
|
97 |
+
return null;
|
98 |
+
}
|
99 |
+
|
100 |
+
};
|
101 |
+
}
|
102 |
+
|
103 |
+
WPGMZA.Integration.Gutenberg.getConstructor = function()
|
104 |
+
{
|
105 |
+
return WPGMZA.Integration.Gutenberg;
|
106 |
+
}
|
107 |
+
|
108 |
+
WPGMZA.Integration.Gutenberg.createInstance = function()
|
109 |
+
{
|
110 |
+
var constructor = WPGMZA.Integration.Gutenberg.getConstructor();
|
111 |
+
return new constructor();
|
112 |
+
}
|
113 |
+
|
114 |
+
// Allow the Pro module to extend and create the module, only create here when Pro isn't loaded
|
115 |
+
if(!WPGMZA.isProVersion())
|
116 |
+
WPGMZA.integrationModules.gutenberg = WPGMZA.Integration.Gutenberg.createInstance();
|
117 |
+
|
118 |
+
});
|
js/v8/3rd-party-integration/integration.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @namespace WPGMZA
|
3 |
+
* @module Integration
|
4 |
+
* @requires WPGMZA
|
5 |
+
*/
|
6 |
+
jQuery(function($) {
|
7 |
+
|
8 |
+
WPGMZA.Integration = {};
|
9 |
+
WPGMZA.integrationModules = {};
|
10 |
+
|
11 |
+
});
|
js/v8/rest-api.js
CHANGED
@@ -21,6 +21,9 @@ jQuery(function($) {
|
|
21 |
if(typeof route != "string" || !route.match(/^\//))
|
22 |
throw new Error("Invalid route");
|
23 |
|
|
|
|
|
|
|
24 |
$.ajax(WPGMZA.RestAPI.URL + route, params);
|
25 |
}
|
26 |
|
21 |
if(typeof route != "string" || !route.match(/^\//))
|
22 |
throw new Error("Invalid route");
|
23 |
|
24 |
+
if(WPGMZA.RestAPI.URL.match(/\/$/))
|
25 |
+
route = route.replace(/^\//, "");
|
26 |
+
|
27 |
$.ajax(WPGMZA.RestAPI.URL + route, params);
|
28 |
}
|
29 |
|
js/v8/scripts.json
CHANGED
@@ -172,6 +172,24 @@
|
|
172 |
"wpgmza"
|
173 |
]
|
174 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
"wpgmza-google-ui-compatibility": {
|
176 |
"src": "js\/v8\/compatibility\/google-ui-compatibility.js",
|
177 |
"pro": false,
|
172 |
"wpgmza"
|
173 |
]
|
174 |
},
|
175 |
+
"wpgmza-integration": {
|
176 |
+
"src": "js\/v8\/3rd-party-integration\/integration.js",
|
177 |
+
"pro": false,
|
178 |
+
"dependencies": [
|
179 |
+
"wpgmza"
|
180 |
+
]
|
181 |
+
},
|
182 |
+
"wpgmza-gutenberg": {
|
183 |
+
"src": "js\/v8\/3rd-party-integration\/gutenberg\/dist\/gutenberg.js",
|
184 |
+
"pro": false,
|
185 |
+
"dependencies": [
|
186 |
+
"wpgmza-integration",
|
187 |
+
"wp-i18n",
|
188 |
+
"wp-blocks",
|
189 |
+
"wp-editor",
|
190 |
+
"wp-components"
|
191 |
+
]
|
192 |
+
},
|
193 |
"wpgmza-google-ui-compatibility": {
|
194 |
"src": "js\/v8\/compatibility\/google-ui-compatibility.js",
|
195 |
"pro": false,
|
js/v8/wp-google-maps.combined.js
CHANGED
@@ -3343,6 +3343,9 @@ jQuery(function($) {
|
|
3343 |
if(typeof route != "string" || !route.match(/^\//))
|
3344 |
throw new Error("Invalid route");
|
3345 |
|
|
|
|
|
|
|
3346 |
$.ajax(WPGMZA.RestAPI.URL + route, params);
|
3347 |
}
|
3348 |
|
@@ -3421,6 +3424,121 @@ jQuery(function($) {
|
|
3421 |
|
3422 |
});
|
3423 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3424 |
// js/v8/compatibility/google-ui-compatibility.js
|
3425 |
/**
|
3426 |
* @namespace WPGMZA
|
3343 |
if(typeof route != "string" || !route.match(/^\//))
|
3344 |
throw new Error("Invalid route");
|
3345 |
|
3346 |
+
if(WPGMZA.RestAPI.URL.match(/\/$/))
|
3347 |
+
route = route.replace(/^\//, "");
|
3348 |
+
|
3349 |
$.ajax(WPGMZA.RestAPI.URL + route, params);
|
3350 |
}
|
3351 |
|
3424 |
|
3425 |
});
|
3426 |
|
3427 |
+
// js/v8/3rd-party-integration/integration.js
|
3428 |
+
/**
|
3429 |
+
* @namespace WPGMZA
|
3430 |
+
* @module Integration
|
3431 |
+
* @requires WPGMZA
|
3432 |
+
*/
|
3433 |
+
jQuery(function($) {
|
3434 |
+
|
3435 |
+
WPGMZA.Integration = {};
|
3436 |
+
WPGMZA.integrationModules = {};
|
3437 |
+
|
3438 |
+
});
|
3439 |
+
|
3440 |
+
// js/v8/3rd-party-integration/gutenberg/dist/gutenberg.js
|
3441 |
+
"use strict";
|
3442 |
+
|
3443 |
+
/**
|
3444 |
+
* @namespace WPGMZA.Integration
|
3445 |
+
* @module Gutenberg
|
3446 |
+
* @requires WPGMZA.Integration
|
3447 |
+
* @requires wp-i18n
|
3448 |
+
* @requires wp-blocks
|
3449 |
+
* @requires wp-editor
|
3450 |
+
* @requires wp-components
|
3451 |
+
*/
|
3452 |
+
|
3453 |
+
/**
|
3454 |
+
* Internal block libraries
|
3455 |
+
*/
|
3456 |
+
jQuery(function ($) {
|
3457 |
+
|
3458 |
+
if (!wp || !wp.i18n || !wp.blocks) return;
|
3459 |
+
|
3460 |
+
var __ = wp.i18n.__;
|
3461 |
+
var registerBlockType = wp.blocks.registerBlockType;
|
3462 |
+
var _wp$editor = wp.editor,
|
3463 |
+
InspectorControls = _wp$editor.InspectorControls,
|
3464 |
+
BlockControls = _wp$editor.BlockControls;
|
3465 |
+
var _wp$components = wp.components,
|
3466 |
+
Dashicon = _wp$components.Dashicon,
|
3467 |
+
Toolbar = _wp$components.Toolbar,
|
3468 |
+
Button = _wp$components.Button,
|
3469 |
+
Tooltip = _wp$components.Tooltip,
|
3470 |
+
PanelBody = _wp$components.PanelBody,
|
3471 |
+
TextareaControl = _wp$components.TextareaControl,
|
3472 |
+
TextControl = _wp$components.TextControl,
|
3473 |
+
RichText = _wp$components.RichText;
|
3474 |
+
|
3475 |
+
|
3476 |
+
WPGMZA.Integration.Gutenberg = function () {
|
3477 |
+
registerBlockType('gutenberg-wpgmza/block', this.getBlockDefinition());
|
3478 |
+
};
|
3479 |
+
|
3480 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockTitle = function () {
|
3481 |
+
return __("WP Google Maps");
|
3482 |
+
};
|
3483 |
+
|
3484 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls = function (props) {
|
3485 |
+
return React.createElement(
|
3486 |
+
InspectorControls,
|
3487 |
+
{ key: "inspector" },
|
3488 |
+
React.createElement(PanelBody, { title: __('Map Settings') })
|
3489 |
+
);
|
3490 |
+
};
|
3491 |
+
|
3492 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes = function () {
|
3493 |
+
return {};
|
3494 |
+
};
|
3495 |
+
|
3496 |
+
WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition = function (props) {
|
3497 |
+
var _this = this;
|
3498 |
+
|
3499 |
+
return {
|
3500 |
+
|
3501 |
+
title: __("WP Google Maps"),
|
3502 |
+
description: __('The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.'),
|
3503 |
+
category: 'common',
|
3504 |
+
icon: 'location-alt',
|
3505 |
+
keywords: [__('Map'), __('Maps'), __('Google')],
|
3506 |
+
attributes: this.getBlockAttributes(),
|
3507 |
+
|
3508 |
+
edit: function edit(props) {
|
3509 |
+
return [!!props.isSelected && _this.getBlockInspectorControls(props), React.createElement(
|
3510 |
+
"div",
|
3511 |
+
{ className: props.className + " wpgmza-gutenberg-block" },
|
3512 |
+
React.createElement(Dashicon, { icon: "location-alt" }),
|
3513 |
+
React.createElement(
|
3514 |
+
"span",
|
3515 |
+
{ "class": "wpgmza-gutenberg-block-title" },
|
3516 |
+
__("WP Google Maps")
|
3517 |
+
)
|
3518 |
+
)];
|
3519 |
+
},
|
3520 |
+
// Defining the front-end interface
|
3521 |
+
save: function save(props) {
|
3522 |
+
// Rendering in PHP
|
3523 |
+
return null;
|
3524 |
+
}
|
3525 |
+
|
3526 |
+
};
|
3527 |
+
};
|
3528 |
+
|
3529 |
+
WPGMZA.Integration.Gutenberg.getConstructor = function () {
|
3530 |
+
return WPGMZA.Integration.Gutenberg;
|
3531 |
+
};
|
3532 |
+
|
3533 |
+
WPGMZA.Integration.Gutenberg.createInstance = function () {
|
3534 |
+
var constructor = WPGMZA.Integration.Gutenberg.getConstructor();
|
3535 |
+
return new constructor();
|
3536 |
+
};
|
3537 |
+
|
3538 |
+
// Allow the Pro module to extend and create the module, only create here when Pro isn't loaded
|
3539 |
+
if (!WPGMZA.isProVersion()) WPGMZA.integrationModules.gutenberg = WPGMZA.Integration.Gutenberg.createInstance();
|
3540 |
+
});
|
3541 |
+
|
3542 |
// js/v8/compatibility/google-ui-compatibility.js
|
3543 |
/**
|
3544 |
* @namespace WPGMZA
|
js/v8/wp-google-maps.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function($){var core={maps:[],events:null,settings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',getScrollAnimationOffset:function(){return WPGMZA.settings.scroll_animation_offset||0},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds||(milliseconds=WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){return hex=parseInt(colour.replace(/^#/,""),16),[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?{lat:parseFloat(m[1]),lng:parseFloat(m[3])}:null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:image.width,height:image.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},isDeveloperMode:function(){return this.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback){if(navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){options.enableHighAccuracy=!1,navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){console.warn(error.code,error.message)},options)},options)}else console.warn("No geolocation available on this device")},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?engine+instanceName:instanceName,!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return"object"==typeof google&&"object"==typeof google.maps&&"object"==typeof google.maps.places&&"function"==typeof google.maps.places.Autocomplete},googleAPIStatus:window.wpgmza_google_api_status,isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}};window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core;for(var key in WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}jQuery(function($){$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});elements.length>1&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),$(document).on("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})}),$(window).on("load",function(event){if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").each(function(index,el){$(el).after($(warning))})}})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;var cssEscape=function(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=codeUnit>=1&&codeUnit<=31||127==codeUnit||0==index&&codeUnit>=48&&codeUnit<=57||1==index&&codeUnit>=48&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(codeUnit>=128||45==codeUnit||95==codeUnit||codeUnit>=48&&codeUnit<=57||codeUnit>=65&&codeUnit<=90||codeUnit>=97&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result};return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape,cssEscape}),jQuery(function($){WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km}}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType=[]},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var arr,types=type.split(/\s+/);if(types.length>1)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");(arr=this._listenersByType[type])||(arr=this._listenersByType[type]=[]);var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};arr.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject||(thisObject=this),useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if((obj=arr[i]).listener==listener&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;event=new WPGMZA.Event;for(var name in src)event[name]=src[name]}event.target=this;for(var path=[],obj=this.parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;i>=0&&!event._cancelled;i--)path[i]._triggerListeners(event);if(this.element){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(this.element).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],(event.phase!=WPGMZA.Event.CAPTURING_PHASE||obj.useCapture)&&obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/);callback([new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])})],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)&&(this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find("#wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={},!WPGMZA.settings.developer_mode)){var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)}}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){var url=urls[i],button=buttonTemplate.clone(),icon="fa-external-link",text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),url.match(/google.+documentation/)?icon="fa-google":url.match(/maps-no-account/)?(icon="fa-wrench",text=WPGMZA.localized_strings.verify_project):url.match(/console\.developers\.google/)&&(icon="fa-wrench",text=WPGMZA.localized_strings.api_dashboard),$(button).find("i").addClass(icon),$(button).append(text)}buttonContainer.append(button)}switch($(this.errorMessageList).append(li),this.dialog||(this.dialog=$(this.element).remodal()),this.dialog.getState()){case"open":case"opened":case"opening":break;default:this.dialog.open()}this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),mapObject&&(this.mapObject=mapObject,mapObject.map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows},WPGMZA.InfoWindow.prototype.close=function(){},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onMapObjectAdded=function(){1==this.mapObject.settings.infoopen&&this.open()}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,this._lng=0,0!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return void 0==this.north&&void 0==this.south&&void 0==this.west&&void 0==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){this.isInInitialState()?this.north=this.south=this.west=this.east=new WPGMZA.LatLng(latLng):(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng))}}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){return new("google-maps"==WPGMZA.settings.engine?WPGMZA.GoogleCircle:WPGMZA.OLCircle)(options)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.MapSettingsPage=function(){var self=this;this.updateEngineSpecificControls(),this.updateGDPRControls(),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()})},WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.MapSettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=new WPGMZA.MapSettingsPage)})}),jQuery(function($){WPGMZA.MapSettings=function(element){var str=element.getAttribute("data-settings"),json=JSON.parse(str);WPGMZA.assertInstanceOf(this,"MapSettings");for(var key in WPGMZA.settings){value=WPGMZA.settings[key];this[key]=value}for(var key in json){var value=json[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),this[key]=value}},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}var options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179],latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom));var options={zoom:zoom,center:latLng};switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=!("yes"==this.wpgmza_settings_map_clickzoom),options.scrollwheel=!("yes"==this.wpgmza_settings_map_scroll),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures?options.gestureHandling="greedy":options.gestureHandling="cooperative",parseInt(this.map_type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}if(this.theme_data&&this.theme_data.length>0)try{options.styles=JSON.parse(this.theme_data)}catch(e){alert("Your theme data is not valid JSON and has been ignored")}return options}}),jQuery(function($){function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map=function(element,options){if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(this.id=element.getAttribute("data-map-id"),!/\d+/.test(this.id))throw new Error("Map ID must be an integer");WPGMZA.maps.push(this),this.element=element,this.element.wpgmzaMap=this,this.engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.loadSettings(options)},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element),other_settings=settings.other_settings;if(delete settings.other_settings,other_settings)for(var key in other_settings)settings[key]=other_settings[key];if(options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};Math.PI;WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,marker.parent=this,this.markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");polygon.map=this,this.polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.deletePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.deletePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.deletePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");polyline.map=this,this.polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.deletePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.deletePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.deletePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");circle.map=this,this.circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.deleteCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.deleteCircle(circle)},WPGMZA.Map.prototype.nudge=function(x,y){var pixels=this.latLngToPixels(this.getCenter());if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");var latLng=this.pixelsToLatLng(pixels);this.setCenter(latLng)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){$(this.element).trigger("idle")}}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1)}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val()},success:function(response,status,xhr){window.location.reload()}})},$(window).on("load",function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,WPGMZA.MapObject.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}))},WPGMZA.Marker.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select")},WPGMZA.Marker.prototype.hidePreviousInteractedInfoWindow=function(){this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close()},WPGMZA.Marker.prototype.openInfoWindow=function(){},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){this.map.settings.info_window_open_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){return function(url){return"string"!=typeof url?url:url.replace(/^http(s?):/,"")}(WPGMZA.settings.default_marker_icon)},WPGMZA.Marker.prototype.getPosition=function(){return{lat:parseFloat(this.lat),lng:parseFloat(this.lng)}},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.getAnimation=function(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=animation},WPGMZA.Marker.prototype.getVisible=function(visible){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this)},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=MYMAP[map_id].map:this.map=MYMAP.map,this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#63AFF2",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(visible){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#63AFF2")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,spokeAngle,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),rgba=WPGMZA.hexToRgba(settings.color),start=WPGMZA.rgbaToString(rgba);rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(var radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(settings.numRadiusLabels>0){var m,x,y,radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1])/2*1.1/scale,context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;Math.sin(spokeAngle)>0&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this;if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"']").closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var inner=$(this.element).find(".wpgmza-inner"),titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}var addressInput;addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show())}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show()})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),numCategories=($(container).children("ul"),0),icons=[];$(container).find("li").each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fas fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocator(map_id):new WPGMZA.OLModernStoreLocator(map_id)}}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl},WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},WPGMZA.RestAPI.prototype.call=function(route,params){if("string"!=typeof route||!route.match(/^\//))throw new Error("Invalid route");$.ajax(WPGMZA.RestAPI.URL+route,params)}}),jQuery(function($){function isPositiveInteger(x){return/^\d+$/.test(x)}function validateParts(parts){for(var i=0;i<parts.length;++i)if(!isPositiveInteger(parts[i]))return!1;return!0}WPGMZA.Version=function(){},WPGMZA.Version.compare=function(v1,v2){var v1parts=v1.split("."),v2parts=v2.split(".");if(!validateParts(v1parts)||!validateParts(v2parts))return NaN;for(var i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;if(WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:options.center.lat,lng:options.center.lng})),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()};callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow)},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){return!!Parent.prototype.open.call(this,map,mapObject)&&(this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject),this.content&&this.googleInfoWindow.setContent(this.content),!0)},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.show_points_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.googleMap.setOptions(this.settings.toGoogleMapsOptions());var clone=$.extend({},options);(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.googleMap.setOptions(clone)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(value)},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest();return{topLeft:{lat:northEast.lat(),lng:southWest.lng()},bottomRight:{lat:southWest.lat(),lng:northEast.lng()}}},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng&&(northEast={lat:northEast.lat,lng:northEast.lng}),this.googleMap.fitBounds(southWest,northEast)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(row){var self=this;Parent.call(this,row);var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),this.googleMarker.wpgmzaMarker=this,this.googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.googleMarker.setLabel(this.settings.label),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()})}),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.setOffset=function(x,y){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image;params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor={x:img.width/2,y:img.height};params.anchor=new google.maps.Point(defaultAnchor.x-x,defaultAnchor.y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(visible)},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id);(WPGMZA.isProVersion()?MYMAP[map_id].map.googleMap:MYMAP.map.googleMap).controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(row,googlePolygon){var self=this;if(Parent.call(this,row,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon(this.settings),row&&row.points){var paths=this.parseGeometry(row.points);this.googlePolygon.setOptions({paths:paths})}this.googlePolygon.wpgmzaPolygon=this,google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(row,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,row,googlePolyline),googlePolyline)this.googlePolyline=googlePolyline;else if(this.googlePolyline=new google.maps.Polyline(this.settings),this.googlePolyline.wpgmzaPolyline=this,row&&row.points){var path=this.parseGeometry(row.points);this.setPoints(path)}google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&void 0!=vertex?(path.removeAt(vertex),this.close()):this.close()}))}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,Parent.call(this,options,olFeature),this.settings.fillColor||(this.settings.fillColor="#ff0000",this.settings.fillOpacity=.6),this.olStyle=new ol.style.Style(this.getStyleFromSettings());var vectorLayer3857=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle});if(olFeature)this.olFeature=olFeature;else{var x,y,wgs84Sphere=new ol.Sphere(6378137),radius=this.radius;x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular(wgs84Sphere,[x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");vectorLayer3857.getSource().addFeature(new ol.Feature(circle3857))}this.layer=vectorLayer3857,options.map.olMap.addLayer(vectorLayer3857)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(address,callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_query_nominatim_cache",query:address},success:function(response,xhr,status){response.lng=response.lon,callback(response)}})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(address,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:address,response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var self=this;if(!options)throw new Error("Invalid options");options.location&&(options.latLng=new WPGMZA.LatLng(options.location));var finish,location;if(options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}this.getResponseFromCache(location,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(location,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(mapObject){var self=this;Parent.call(this,mapObject),this.element=$("<div class='ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,WPGMZA.OLInfoWindow.prototype.open=function(map,mapObject){var self=this,latLng=mapObject.getPosition();if(!WPGMZA.InfoWindow.prototype.open.call(this,map,mapObject))return!1;this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),self.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.dispatchEvent("infowindowopen")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){WPGMZA.settings.developer_mode&&console.log(options),options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var viewOptions=this.settings.toOLViewOptions();$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive("yes"!=this.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!this.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=this.settings.wpgmza_settings_map_scroll)},this),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&this.olMap.removeControl(control)},this),"yes"!=WPGMZA.settings.wpgmza_settings_map_full_screen_control&&this.olMap.addControl(new ol.control.FullScreen),this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),self.onIdle()}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged();var marker;this.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!1)),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){return new ol.layer.Tile({source:new ol.source.OSM})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var center=this.getCenter();center.lng>=-180&¢er.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),center.lng>180&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return{topLeft:{lat:topLeft[1],lng:topLeft[0]},bottomRight:{lat:bottomRight[1],lng:bottomRight[0]}}},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){this.olMap.getView().fitExtent([southWest.lng,southWest.lat,northEast.lng,northEast.lat],this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng){this.olMap.getView().animate({center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500})},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())+1},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){this.olMap.addOverlay(marker.overlay),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){this.olMap.removeOverlay(marker.overlay),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){void 0==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(row){var self=this;Parent.call(this,row);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.element=$("<div class='ol-marker'><img src='"+WPGMZA.settings.default_marker_icon+"'/></div>")[0],this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(origin),this.animation&&this.setAnimation(this.animation),this.setLabel(this.settings.label),row&&row.draggable&&this.setDraggable(!0),this.rebindClickListener(),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove()},WPGMZA.OLMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible(visible),this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.setOffset=function(x,y){this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"},WPGMZA.OLMarker.prototype.setAnimation=function(anim){switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0})},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset={top:parseFloat($(this.element).css("top").match(/-?\d+/)[0]),left:parseFloat($(this.element).css("left").match(/-?\d+/)[0])};$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset.left,y:pixelsBeforeDrag.y+offset.top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),$(WPGMZA.isProVersion()?".wpgmza_map[data-map-id='"+map_id+"']":"#wpgmza_map").append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(row,olFeature){if(Parent.call(this,row,olFeature),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(row&&row.points){for(var paths=this.parseGeometry(row.points),i=0;i<paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(row,olFeature){if(WPGMZA.Polyline.call(this,row),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(row&&row.points)for(var path=this.parseGeometry(row.points),i=0;i<path.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]));var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyling:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}});
|
1 |
+
jQuery(function($){var core={maps:[],events:null,settings:null,loadingHTML:'<div class="wpgmza-preloader"><div class="wpgmza-loader">...</div></div>',getScrollAnimationOffset:function(){return WPGMZA.settings.scroll_animation_offset||0},animateScroll:function(element,milliseconds){var offset=WPGMZA.getScrollAnimationOffset();milliseconds||(milliseconds=WPGMZA.settings.scroll_animation_milliseconds?WPGMZA.settings.scroll_animation_milliseconds:500),$("html, body").animate({scrollTop:$(element).offset().top-offset},milliseconds)},guid:function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})},hexOpacityToRGBA:function(colour,opacity){return hex=parseInt(colour.replace(/^#/,""),16),[(16711680&hex)>>16,(65280&hex)>>8,255&hex,parseFloat(opacity)]},latLngRegexp:/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,isLatLngString:function(str){if("string"!=typeof str)return null;str.match(/^\(.+\)$/)&&(str=str.replace(/^\(|\)$/,""));var m=str.match(WPGMZA.latLngRegexp);return m?{lat:parseFloat(m[1]),lng:parseFloat(m[3])}:null},stringToLatLng:function(str){var result=WPGMZA.isLatLngString(str);if(!result)throw new Error("Not a valid latLng");return result},isHexColorString:function(str){return"string"==typeof str&&!!str.match(/#[0-9A-F]{6}/i)},imageDimensionsCache:{},getImageDimensions:function(src,callback){if(WPGMZA.imageDimensionsCache[src])callback(WPGMZA.imageDimensionsCache[src]);else{var img=document.createElement("img");img.onload=function(event){var result={width:image.width,height:image.height};WPGMZA.imageDimensionsCache[src]=result,callback(result)},img.src=src}},isDeveloperMode:function(){return this.developer_mode||window.Cookies&&window.Cookies.get("wpgmza-developer-mode")},isProVersion:function(){return"1"==this._isProVersion},openMediaDialog:function(callback){var file_frame;if(file_frame)return file_frame.uploader.uploader.param("post_id",set_to_post_id),void file_frame.open();(file_frame=wp.media.frames.file_frame=wp.media({title:"Select a image to upload",button:{text:"Use this image"},multiple:!1})).on("select",function(){attachment=file_frame.state().get("selection").first().toJSON(),callback(attachment.id,attachment.url)}),file_frame.open()},getCurrentPosition:function(callback){if(navigator.geolocation){var options={enableHighAccuracy:!0};navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){options.enableHighAccuracy=!1,navigator.geolocation.getCurrentPosition(function(position){callback&&callback(position),WPGMZA.events.trigger("userlocationfound")},function(error){console.warn(error.code,error.message)},options)},options)}else console.warn("No geolocation available on this device")},runCatchableTask:function(callback,friendlyErrorContainer){if(WPGMZA.isDeveloperMode())callback();else try{callback()}catch(e){var friendlyError=new WPGMZA.FriendlyError(e);$(friendlyErrorContainer).html(""),$(friendlyErrorContainer).append(friendlyError.element),$(friendlyErrorContainer).show()}},assertInstanceOf:function(instance,instanceName){var engine,fullInstanceName,pro=WPGMZA.isProVersion()?"Pro":"";switch(WPGMZA.settings.engine){case"open-layers":engine="OL";break;default:engine="Google"}if(fullInstanceName=WPGMZA[engine+pro+instanceName]?engine+pro+instanceName:WPGMZA[pro+instanceName]?pro+instanceName:WPGMZA[engine+instanceName]?engine+instanceName:instanceName,!(instance instanceof WPGMZA[fullInstanceName]))throw new Error("Object must be an instance of "+fullInstanceName+" (did you call a constructor directly, rather than createInstance?)")},getMapByID:function(id){for(var i=0;i<WPGMZA.maps.length;i++)if(WPGMZA.maps[i].id==id)return WPGMZA.maps[i];return null},isGoogleAutocompleteSupported:function(){return"object"==typeof google&&"object"==typeof google.maps&&"object"==typeof google.maps.places&&"function"==typeof google.maps.places.Autocomplete},googleAPIStatus:window.wpgmza_google_api_status,isDeviceiOS:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}};for(var key in window.WPGMZA?window.WPGMZA=$.extend(window.WPGMZA,core):window.WPGMZA=core,WPGMZA_localized_data){var value=WPGMZA_localized_data[key];WPGMZA[key]=value}jQuery(function($){$("script[src*='wp-google-maps.combined.js'], script[src*='wp-google-maps-pro.combined.js']").length&&console.warn("Minified script is out of date, using combined script instead.");var elements=$("script").filter(function(){return this.src.match(/(^|\/)jquery\.(min\.)?js(\?|$)/i)});1<elements.length&&console.warn("Multiple jQuery versions detected: ",elements),WPGMZA.restAPI=WPGMZA.RestAPI.createInstance(),$(document).on("click",".wpgmza_edit_btn",function(){WPGMZA.animateScroll("#wpgmaps_tabs_markers")})}),$(window).on("load",function(event){if("https:"!=window.location.protocol){var warning='<div class="notice notice-warning"><p>'+WPGMZA.localized_strings.unsecure_geolocation+"</p></div>";$(".wpgmza-geolocation-setting").each(function(index,el){$(el).after($(warning))})}})}),jQuery(function($){WPGMZA.Compatibility=function(){this.preventDocumentWriteGoogleMapsAPI()},WPGMZA.Compatibility.prototype.preventDocumentWriteGoogleMapsAPI=function(){var old=document.write;document.write=function(content){content.match&&content.match(/maps\.google/)||old.call(document,content)}},WPGMZA.compatiblityModule=new WPGMZA.Compatibility}),function(root,factory){"object"==typeof exports?module.exports=factory(root):"function"==typeof define&&define.amd?define([],factory.bind(root,root)):factory(root)}("undefined"!=typeof global?global:this,function(root){if(root.CSS&&root.CSS.escape)return root.CSS.escape;var cssEscape=function(value){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var codeUnit,string=String(value),length=string.length,index=-1,result="",firstCodeUnit=string.charCodeAt(0);++index<length;)0!=(codeUnit=string.charCodeAt(index))?result+=1<=codeUnit&&codeUnit<=31||127==codeUnit||0==index&&48<=codeUnit&&codeUnit<=57||1==index&&48<=codeUnit&&codeUnit<=57&&45==firstCodeUnit?"\\"+codeUnit.toString(16)+" ":(0!=index||1!=length||45!=codeUnit)&&(128<=codeUnit||45==codeUnit||95==codeUnit||48<=codeUnit&&codeUnit<=57||65<=codeUnit&&codeUnit<=90||97<=codeUnit&&codeUnit<=122)?string.charAt(index):"\\"+string.charAt(index):result+="�";return result};return root.CSS||(root.CSS={}),root.CSS.escape=cssEscape}),jQuery(function($){WPGMZA.Distance={MILES:!0,KILOMETERS:!1,MILES_PER_KILOMETER:.621371,KILOMETERS_PER_MILE:1.60934,uiToMeters:function(uiDistance){return parseFloat(uiDistance)/(WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?WPGMZA.Distance.MILES_PER_KILOMETER:1)*1e3},uiToKilometers:function(uiDistance){return.001*WPGMZA.Distance.uiToMeters(uiDistance)},uiToMiles:function(uiDistance){return WPGMZA.Distance.uiToKilometers(uiDistance)*WPGMZA.Distance.MILES_PER_KILOMETER},kilometersToUI:function(km){return WPGMZA.settings.distance_units==WPGMZA.Distance.MILES?km*WPGMZA.Distance.MILES_PER_KILOMETER:km}}}),jQuery(function($){WPGMZA.EventDispatcher=function(){WPGMZA.assertInstanceOf(this,"EventDispatcher"),this._listenersByType=[]},WPGMZA.EventDispatcher.prototype.addEventListener=function(type,listener,thisObject,useCapture){var arr,types=type.split(/\s+/);if(1<types.length)for(var i=0;i<types.length;i++)this.addEventListener(types[i],listener,thisObject,useCapture);else{if(!(listener instanceof Function))throw new Error("Listener must be a function");(arr=this._listenersByType[type])||(arr=this._listenersByType[type]=[]);var obj={listener:listener,thisObject:thisObject||this,useCapture:!!useCapture};arr.push(obj)}},WPGMZA.EventDispatcher.prototype.on=WPGMZA.EventDispatcher.prototype.addEventListener,WPGMZA.EventDispatcher.prototype.removeEventListener=function(type,listener,thisObject,useCapture){var arr,obj;if(arr=this._listenersByType[type]){thisObject||(thisObject=this),useCapture=!!useCapture;for(var i=0;i<arr.length;i++)if((obj=arr[i]).listener==listener&&obj.thisObject==thisObject&&obj.useCapture==useCapture)return void arr.splice(i,1)}},WPGMZA.EventDispatcher.prototype.off=WPGMZA.EventDispatcher.prototype.removeEventListener,WPGMZA.EventDispatcher.prototype.hasEventListener=function(type){return!!_listenersByType[type]},WPGMZA.EventDispatcher.prototype.dispatchEvent=function(event){if(!(event instanceof WPGMZA.Event))if("string"==typeof event)event=new WPGMZA.Event(event);else{var src=event;for(var name in event=new WPGMZA.Event,src)event[name]=src[name]}for(var path=[],obj=(event.target=this).parent;null!=obj;obj=obj.parent)path.unshift(obj);event.phase=WPGMZA.Event.CAPTURING_PHASE;for(var i=0;i<path.length&&!event._cancelled;i++)path[i]._triggerListeners(event);if(!event._cancelled){for(event.phase=WPGMZA.Event.AT_TARGET,this._triggerListeners(event),event.phase=WPGMZA.Event.BUBBLING_PHASE,i=path.length-1;0<=i&&!event._cancelled;i--)path[i]._triggerListeners(event);if(this.element){var customEvent={};for(var key in event){var value=event[key];"type"==key&&(value+=".wpgmza"),customEvent[key]=value}$(this.element).trigger(customEvent)}}},WPGMZA.EventDispatcher.prototype.trigger=WPGMZA.EventDispatcher.prototype.dispatchEvent,WPGMZA.EventDispatcher.prototype._triggerListeners=function(event){var arr,obj;if(arr=this._listenersByType[event.type])for(var i=0;i<arr.length;i++)obj=arr[i],(event.phase!=WPGMZA.Event.CAPTURING_PHASE||obj.useCapture)&&obj.listener.call(arr[i].thisObject,event)},WPGMZA.events=new WPGMZA.EventDispatcher}),jQuery(function($){WPGMZA.Event=function(options){if("string"==typeof options&&(this.type=options),this.bubbles=!0,this.cancelable=!0,this.phase=WPGMZA.Event.PHASE_CAPTURE,this.target=null,this._cancelled=!1,"object"==typeof options)for(var name in options)this[name]=options[name]},WPGMZA.Event.CAPTURING_PHASE=0,WPGMZA.Event.AT_TARGET=1,WPGMZA.Event.BUBBLING_PHASE=2,WPGMZA.Event.prototype.stopPropagation=function(){this._cancelled=!0}}),jQuery(function($){}),jQuery(function($){WPGMZA.Geocoder=function(){WPGMZA.assertInstanceOf(this,"Geocoder")},WPGMZA.Geocoder.SUCCESS="success",WPGMZA.Geocoder.ZERO_RESULTS="zero-results",WPGMZA.Geocoder.FAIL="fail",WPGMZA.Geocoder.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLGeocoder;default:return WPGMZA.GoogleGeocoder}},WPGMZA.Geocoder.createInstance=function(){return new(WPGMZA.Geocoder.getConstructor())},WPGMZA.Geocoder.prototype.getLatLngFromAddress=function(options,callback){if(WPGMZA.isLatLngString(options.address)){var parts=options.address.split(/,\s*/);callback([new WPGMZA.LatLng({lat:parseFloat(parts[0]),lng:parseFloat(parts[1])})],WPGMZA.Geocoder.SUCCESS)}},WPGMZA.Geocoder.prototype.getAddressFromLatLng=function(options,callback){callback([new WPGMZA.LatLng(options.latLng).toString()],WPGMZA.Geocoder.SUCCESS)},WPGMZA.Geocoder.prototype.geocode=function(options,callback){if("address"in options)return this.getLatLngFromAddress(options,callback);if("latLng"in options)return this.getAddressFromLatLng(options,callback);throw new Error("You must supply either a latLng or address")}}),jQuery(function($){WPGMZA.GoogleAPIErrorHandler=function(){var self=this;if("google-maps"==WPGMZA.settings.engine&&("map-edit"==WPGMZA.currentPage||0==WPGMZA.is_admin&&1==WPGMZA.userCanAdministrator)&&(this.element=$(WPGMZA.html.googleMapsAPIErrorDialog),1==WPGMZA.is_admin&&this.element.find(".wpgmza-front-end-only").remove(),this.errorMessageList=this.element.find("#wpgmza-google-api-error-list"),this.templateListItem=this.element.find("li.template").remove(),this.messagesAlreadyDisplayed={},!WPGMZA.settings.developer_mode)){var _error=console.error;console.error=function(message){self.onErrorMessage(message),_error.apply(this,arguments)}}},WPGMZA.GoogleAPIErrorHandler.prototype.onErrorMessage=function(message){var m;if((m=message.match(/You have exceeded your (daily )?request quota for this API/))||(m=message.match(/This API project is not authorized to use this API/))){var urls=message.match(/http(s)?:\/\/[^\s]+/gm);this.addErrorMessage(m[0],urls)}else(m=message.match(/^Google Maps.+error: (.+)\s+(http(s?):\/\/.+)/m))&&this.addErrorMessage(m[1].replace(/([A-Z])/g," $1"),[m[2]])},WPGMZA.GoogleAPIErrorHandler.prototype.addErrorMessage=function(message,urls){if(!this.messagesAlreadyDisplayed[message]){var li=this.templateListItem.clone();$(li).find(".wpgmza-message").html(message);var buttonContainer=$(li).find(".wpgmza-documentation-buttons"),buttonTemplate=$(li).find(".wpgmza-documentation-buttons>a");if(buttonTemplate.remove(),urls&&urls.length){for(var i=0;i<urls.length;i++){var url=urls[i],button=buttonTemplate.clone(),icon="fa-external-link",text=WPGMZA.localized_strings.documentation;button.attr("href",urls[i]),url.match(/google.+documentation/)?icon="fa-google":url.match(/maps-no-account/)?(icon="fa-wrench",text=WPGMZA.localized_strings.verify_project):url.match(/console\.developers\.google/)&&(icon="fa-wrench",text=WPGMZA.localized_strings.api_dashboard),$(button).find("i").addClass(icon),$(button).append(text)}buttonContainer.append(button)}switch($(this.errorMessageList).append(li),this.dialog||(this.dialog=$(this.element).remodal()),this.dialog.getState()){case"open":case"opened":case"opening":break;default:this.dialog.open()}this.messagesAlreadyDisplayed[message]=!0}},WPGMZA.googleAPIErrorHandler=new WPGMZA.GoogleAPIErrorHandler}),jQuery(function($){WPGMZA.InfoWindow=function(mapObject){var self=this;WPGMZA.EventDispatcher.call(this),WPGMZA.assertInstanceOf(this,"InfoWindow"),mapObject&&((this.mapObject=mapObject).map?setTimeout(function(){self.onMapObjectAdded(event)},100):mapObject.addEventListener("added",function(event){self.onMapObjectAdded(event)}))},WPGMZA.InfoWindow.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.InfoWindow.prototype.constructor=WPGMZA.InfoWindow,WPGMZA.InfoWindow.OPEN_BY_CLICK=1,WPGMZA.InfoWindow.OPEN_BY_HOVER=2,WPGMZA.InfoWindow.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProInfoWindow:WPGMZA.OLInfoWindow;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProInfoWindow:WPGMZA.GoogleInfoWindow}},WPGMZA.InfoWindow.createInstance=function(mapObject){return new(this.getConstructor())(mapObject)},WPGMZA.InfoWindow.prototype.getContent=function(callback){var html="";this.mapObject instanceof WPGMZA.Marker&&(html=this.mapObject.address),callback(html)},WPGMZA.InfoWindow.prototype.open=function(map,mapObject){return this.mapObject=mapObject,!WPGMZA.settings.disable_infowindows},WPGMZA.InfoWindow.prototype.close=function(){},WPGMZA.InfoWindow.prototype.setContent=function(options){},WPGMZA.InfoWindow.prototype.setOptions=function(options){},WPGMZA.InfoWindow.prototype.onMapObjectAdded=function(){1==this.mapObject.settings.infoopen&&this.open()}}),jQuery(function($){WPGMZA.LatLng=function(arg,lng){if(this._lat=0,(this._lng=0)!=arguments.length)if(1==arguments.length){if("string"==typeof arg){var m;if(!(m=arg.match(WPGMZA.LatLng.REGEXP)))throw new Error("Invalid LatLng string");arg={lat:m[1],lng:m[3]}}if("object"!=typeof arg||!("lat"in arg&&"lng"in arg))throw new Error("Argument must be a LatLng literal");this.lat=arg.lat,this.lng=arg.lng}else this.lat=arg,this.lng=lng},WPGMZA.LatLng.REGEXP=/^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$/,WPGMZA.LatLng.isValid=function(obj){return"object"==typeof obj&&("lat"in obj&&"lng"in obj)},Object.defineProperty(WPGMZA.LatLng.prototype,"lat",{get:function(){return this._lat},set:function(val){if(!$.isNumeric(val))throw new Error("Latitude must be numeric");this._lat=parseFloat(val)}}),Object.defineProperty(WPGMZA.LatLng.prototype,"lng",{get:function(){return this._lng},set:function(val){if(!$.isNumeric(val))throw new Error("Longitude must be numeric");this._lng=parseFloat(val)}}),WPGMZA.LatLng.prototype.toString=function(){return this._lat+", "+this._lng},WPGMZA.LatLng.fromGoogleLatLng=function(googleLatLng){return new WPGMZA.LatLng(googleLatLng.lat(),googleLatLng.lng())},WPGMZA.LatLng.prototype.toGoogleLatLng=function(){return new google.maps.LatLng({lat:this.lat,lng:this.lng})},WPGMZA.LatLng.prototype.moveByDistance=function(kilometers,heading){var delta=parseFloat(kilometers)/6371,theta=parseFloat(heading)/180*Math.PI,phi1=this.lat/180*Math.PI,lambda1=this.lng/180*Math.PI,sinPhi1=Math.sin(phi1),cosPhi1=Math.cos(phi1),sinDelta=Math.sin(delta),cosDelta=Math.cos(delta),sinTheta=Math.sin(theta),sinPhi2=sinPhi1*cosDelta+cosPhi1*sinDelta*Math.cos(theta),phi2=Math.asin(sinPhi2),y=sinTheta*sinDelta*cosPhi1,x=cosDelta-sinPhi1*sinPhi2,lambda2=lambda1+Math.atan2(y,x);this.lat=180*phi2/Math.PI,this.lng=180*lambda2/Math.PI}}),jQuery(function($){WPGMZA.LatLngBounds=function(southWest,northEast){},WPGMZA.LatLngBounds.prototype.isInInitialState=function(){return null==this.north&&null==this.south&&null==this.west&&null==this.east},WPGMZA.LatLngBounds.prototype.extend=function(latLng){this.isInInitialState()?this.north=this.south=this.west=this.east=new WPGMZA.LatLng(latLng):(latLng instanceof WPGMZA.LatLng||(latLng=new WPGMZA.LatLng(latLng)),latLng.lat<this.north&&(this.north=latLng.lat),latLng.lat>this.south&&(this.south=latLng.lat),latLng.lng<this.west&&(this.west=latLng.lng),latLng.lng>this.east&&(this.east=latLng.lng))}}),jQuery(function($){WPGMZA.MapObject=function(row){if(WPGMZA.assertInstanceOf(this,"MapObject"),WPGMZA.EventDispatcher.call(this),this.id=-1,this.guid=WPGMZA.guid(),this.modified=!0,this.settings={},row)for(var name in row)if("settings"==name){if(null==row.settings)this.settings={};else switch(typeof row.settings){case"string":this.settings=JSON.parse(row[name]);break;case"object":this.settings=row[name];break;default:throw new Error("Don't know how to interpret settings")}for(var name in this.settings){var value=this.settings[name];String(value).match(/^-?\d+$/)&&(this.settings[name]=parseInt(value))}}else this[name]=row[name]},WPGMZA.MapObject.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.MapObject.prototype.constructor=WPGMZA.MapObject,WPGMZA.MapObject.prototype.parseGeometry=function(string){var pairs,coords,results=[];pairs=string.replace(/[^ ,\d\.\-+e]/g,"").split(",");for(var i=0;i<pairs.length;i++)coords=pairs[i].split(" "),results.push({lat:parseFloat(coords[1]),lng:parseFloat(coords[0])});return results},WPGMZA.MapObject.prototype.toJSON=function(){return{id:this.id,guid:this.guid,settings:this.settings}}}),jQuery(function($){var Parent=WPGMZA.MapObject;WPGMZA.Circle=function(options,engineCircle){WPGMZA.assertInstanceOf(this,"Circle"),this.center=new WPGMZA.LatLng,this.radius=100,Parent.apply(this,arguments)},WPGMZA.Circle.prototype=Object.create(Parent.prototype),WPGMZA.Circle.prototype.constructor=WPGMZA.Circle,WPGMZA.Circle.createInstance=function(options){return new("google-maps"==WPGMZA.settings.engine?WPGMZA.GoogleCircle:WPGMZA.OLCircle)(options)},WPGMZA.Circle.prototype.getCenter=function(){return this.center.clone()},WPGMZA.Circle.prototype.setCenter=function(latLng){this.center.lat=latLng.lat,this.center.lng=latLng.lng},WPGMZA.Circle.prototype.getRadius=function(){return this.radius},WPGMZA.Circle.prototype.setRadius=function(radius){this.radius=radius},WPGMZA.Circle.prototype.getMap=function(){return this.map},WPGMZA.Circle.prototype.setMap=function(map){this.map&&this.map.removeCircle(this),map&&map.addCircle(this)}}),jQuery(function($){WPGMZA.MapSettingsPage=function(){var self=this;this.updateEngineSpecificControls(),this.updateGDPRControls(),$("select[name='wpgmza_maps_engine']").on("change",function(event){self.updateEngineSpecificControls()}),$("input[name='wpgmza_gdpr_require_consent_before_load'], input[name='wpgmza_gdpr_require_consent_before_vgm_submit'], input[name='wpgmza_gdpr_override_notice']").on("change",function(event){self.updateGDPRControls()})},WPGMZA.MapSettingsPage.prototype.updateEngineSpecificControls=function(){var engine=$("select[name='wpgmza_maps_engine']").val();$("[data-required-maps-engine][data-required-maps-engine!='"+engine+"']").hide(),$("[data-required-maps-engine='"+engine+"']").show()},WPGMZA.MapSettingsPage.prototype.updateGDPRControls=function(){var showNoticeControls=$("input[name='wpgmza_gdpr_require_consent_before_load']").prop("checked"),vgmCheckbox=$("input[name='wpgmza_gdpr_require_consent_before_vgm_submit']");vgmCheckbox.length&&(showNoticeControls=showNoticeControls||vgmCheckbox.prop("checked"));var showOverrideTextarea=showNoticeControls&&$("input[name='wpgmza_gdpr_override_notice']").prop("checked");showNoticeControls?$("#wpgmza-gdpr-compliance-notice").show("slow"):$("#wpgmza-gdpr-compliance-notice").hide("slow"),showOverrideTextarea?$("#wpgmza_gdpr_override_notice_text").show("slow"):$("#wpgmza_gdpr_override_notice_text").hide("slow")},jQuery(function($){window.location.href.match(/wp-google-maps-menu-settings/)&&(WPGMZA.mapSettingsPage=new WPGMZA.MapSettingsPage)})}),jQuery(function($){WPGMZA.MapSettings=function(element){var str=element.getAttribute("data-settings"),json=JSON.parse(str);for(var key in WPGMZA.assertInstanceOf(this,"MapSettings"),WPGMZA.settings){var value=WPGMZA.settings[key];this[key]=value}for(var key in json){value=json[key];String(value).match(/^-?\d+$/)&&(value=parseInt(value)),this[key]=value}},WPGMZA.MapSettings.prototype.toOLViewOptions=function(){var options={center:ol.proj.fromLonLat([-119.4179,36.7783]),zoom:4};function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}if("string"==typeof this.start_location){var coords=this.start_location.replace(/^\(|\)$/g,"").split(",");WPGMZA.isLatLngString(this.start_location)?options.center=ol.proj.fromLonLat([parseFloat(coords[1]),parseFloat(coords[0])]):console.warn("Invalid start location")}return this.center&&(options.center=ol.proj.fromLonLat([parseFloat(this.center.lng),parseFloat(this.center.lat)])),this.zoom&&(options.zoom=parseInt(this.zoom)),this.start_zoom&&(options.zoom=parseInt(this.start_zoom)),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options},WPGMZA.MapSettings.prototype.toGoogleMapsOptions=function(){var self=this,latLngCoords=this.start_location&&this.start_location.length?this.start_location.split(","):[36.7783,-119.4179];function empty(name){return"object"!=typeof self[name]&&(!self[name]||!self[name].length)}function formatCoord(coord){return $.isNumeric(coord)?coord:parseFloat(String(coord).replace(/[\(\)\s]/,""))}var latLng=new google.maps.LatLng(formatCoord(latLngCoords[0]),formatCoord(latLngCoords[1])),zoom=this.start_zoom?parseInt(this.start_zoom):4;!this.start_zoom&&this.zoom&&(zoom=parseInt(this.zoom));var options={zoom:zoom,center:latLng};switch(empty("center")||(options.center=new google.maps.LatLng({lat:parseFloat(this.center.lat),lng:parseFloat(this.center.lng)})),empty("min_zoom")||(options.minZoom=parseInt(this.min_zoom)),empty("max_zoom")||(options.maxZoom=parseInt(this.max_zoom)),options.zoomControl=!("yes"==this.wpgmza_settings_map_zoom),options.panControl=!("yes"==this.wpgmza_settings_map_pan),options.mapTypeControl=!("yes"==this.wpgmza_settings_map_type),options.streetViewControl=!("yes"==this.wpgmza_settings_map_streetview),options.fullscreenControl=!("yes"==this.wpgmza_settings_map_full_screen_control),options.draggable=!("yes"==this.wpgmza_settings_map_draggable),options.disableDoubleClickZoom=!("yes"==this.wpgmza_settings_map_clickzoom),options.scrollwheel=!("yes"==this.wpgmza_settings_map_scroll),"greedy"==this.wpgmza_force_greedy_gestures||"yes"==this.wpgmza_force_greedy_gestures?options.gestureHandling="greedy":options.gestureHandling="cooperative",parseInt(this.map_type)){case 2:options.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case 3:options.mapTypeId=google.maps.MapTypeId.HYBRID;break;case 4:options.mapTypeId=google.maps.MapTypeId.TERRAIN;break;default:options.mapTypeId=google.maps.MapTypeId.ROADMAP}if(this.theme_data&&0<this.theme_data.length)try{options.styles=JSON.parse(this.theme_data)}catch(e){alert("Your theme data is not valid JSON and has been ignored")}return options}}),jQuery(function($){WPGMZA.Map=function(element,options){if(WPGMZA.assertInstanceOf(this,"Map"),WPGMZA.EventDispatcher.call(this),!(element instanceof HTMLElement))throw new Error("Argument must be a HTMLElement");if(this.id=element.getAttribute("data-map-id"),!/\d+/.test(this.id))throw new Error("Map ID must be an integer");WPGMZA.maps.push(this),this.element=element,(this.element.wpgmzaMap=this).engineElement=element,this.markers=[],this.polygons=[],this.polylines=[],this.circles=[],this.loadSettings(options)},WPGMZA.Map.prototype=Object.create(WPGMZA.EventDispatcher.prototype),WPGMZA.Map.prototype.constructor=WPGMZA.Map,WPGMZA.Map.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMap:WPGMZA.OLMap;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMap:WPGMZA.GoogleMap}},WPGMZA.Map.createInstance=function(element,options){return new(WPGMZA.Map.getConstructor())(element,options)},WPGMZA.Map.prototype.loadSettings=function(options){var settings=new WPGMZA.MapSettings(this.element),other_settings=settings.other_settings;if(delete settings.other_settings,other_settings)for(var key in other_settings)settings[key]=other_settings[key];if(options)for(var key in options)settings[key]=options[key];this.settings=settings},WPGMZA.Map.prototype.setOptions=function(options){for(var name in options)this.settings[name]=options[name]};Math.PI;function deg2rad(deg){return deg*(Math.PI/180)}WPGMZA.Map.getGeographicDistance=function(lat1,lon1,lat2,lon2){var dLat=deg2rad(lat2-lat1),dLon=deg2rad(lon2-lon1),a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(deg2rad(lat1))*Math.cos(deg2rad(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);return 6371*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))},WPGMZA.Map.prototype.setCenter=function(latLng){if(!("lat"in latLng&&"lng"in latLng))throw new Error("Argument is not an object with lat and lng")},WPGMZA.Map.prototype.setDimensions=function(width,height){$(this.element).css({width:width}),$(this.engineElement).css({width:"100%",height:height})},WPGMZA.Map.prototype.addMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");marker.map=this,(marker.parent=this).markers.push(marker),this.dispatchEvent({type:"markeradded",marker:marker}),marker.dispatchEvent({type:"added"})},WPGMZA.Map.prototype.removeMarker=function(marker){if(!(marker instanceof WPGMZA.Marker))throw new Error("Argument must be an instance of WPGMZA.Marker");if(marker.map!==this)throw new Error("Wrong map error");marker.map=null,marker.parent=null,this.markers.splice(this.markers.indexOf(marker),1),this.dispatchEvent({type:"markerremoved",marker:marker}),marker.dispatchEvent({type:"removed"})},WPGMZA.Map.prototype.getMarkerByID=function(id){for(var i=0;i<this.markers.length;i++)if(this.markers[i].id==id)return this.markers[i];return null},WPGMZA.Map.prototype.removeMarkerByID=function(id){var marker=this.getMarkerByID(id);marker&&this.removeMarker(marker)},WPGMZA.Map.prototype.addPolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");(polygon.map=this).polygons.push(polygon),this.dispatchEvent({type:"polygonadded",polygon:polygon})},WPGMZA.Map.prototype.deletePolygon=function(polygon){if(!(polygon instanceof WPGMZA.Polygon))throw new Error("Argument must be an instance of WPGMZA.Polygon");if(polygon.map!==this)throw new Error("Wrong map error");polygon.map=null,this.polygons.splice(this.polygons.indexOf(polygon),1),this.dispatchEvent({type:"polygonremoved",polygon:polygon})},WPGMZA.Map.prototype.getPolygonByID=function(id){for(var i=0;i<this.polygons.length;i++)if(this.polygons[i].id==id)return this.polygons[i];return null},WPGMZA.Map.prototype.deletePolygonByID=function(id){var polygon=this.getPolygonByID(id);polygon&&this.deletePolygon(polygon)},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.addPolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");(polyline.map=this).polylines.push(polyline),this.dispatchEvent({type:"polylineadded",polyline:polyline})},WPGMZA.Map.prototype.deletePolyline=function(polyline){if(!(polyline instanceof WPGMZA.Polyline))throw new Error("Argument must be an instance of WPGMZA.Polyline");if(polyline.map!==this)throw new Error("Wrong map error");polyline.map=null,this.polylines.splice(this.polylines.indexOf(polyline),1),this.dispatchEvent({type:"polylineremoved",polyline:polyline})},WPGMZA.Map.prototype.getPolylineByID=function(id){for(var i=0;i<this.polylines.length;i++)if(this.polylines[i].id==id)return this.polylines[i];return null},WPGMZA.Map.prototype.deletePolylineByID=function(id){var polyline=this.getPolylineByID(id);polyline&&this.deletePolyline(polyline)},WPGMZA.Map.prototype.addCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");(circle.map=this).circles.push(circle),this.dispatchEvent({type:"circleadded",circle:circle})},WPGMZA.Map.prototype.removeCircle=function(circle){if(!(circle instanceof WPGMZA.Circle))throw new Error("Argument must be an instance of WPGMZA.Circle");if(circle.map!==this)throw new Error("Wrong map error");circle.map=null,this.circles.splice(this.circles.indexOf(circle),1),this.dispatchEvent({type:"circleremoved",circle:circle})},WPGMZA.Map.prototype.getCircleByID=function(id){for(var i=0;i<this.circles.length;i++)if(this.circles[i].id==id)return this.circles[i];return null},WPGMZA.Map.prototype.deleteCircleByID=function(id){var circle=this.getCircleByID(id);circle&&this.deleteCircle(circle)},WPGMZA.Map.prototype.nudge=function(x,y){var pixels=this.latLngToPixels(this.getCenter());if(pixels.x+=parseFloat(x),pixels.y+=parseFloat(y),isNaN(pixels.x)||isNaN(pixels.y))throw new Error("Invalid coordinates supplied");var latLng=this.pixelsToLatLng(pixels);this.setCenter(latLng)},WPGMZA.Map.prototype.onWindowResize=function(event){},WPGMZA.Map.prototype.onElementResized=function(event){},WPGMZA.Map.prototype.onBoundsChanged=function(event){this.trigger("boundschanged"),this.trigger("bounds_changed")},WPGMZA.Map.prototype.onIdle=function(event){$(this.element).trigger("idle")}}),jQuery(function($){WPGMZA.MapsEngineDialog=function(element){var self=this;this.element=element,window.wpgmzaUnbindSaveReminder&&window.wpgmzaUnbindSaveReminder(),$(element).show(),$(element).remodal().open(),$(element).find("input:radio").on("change",function(event){$("#wpgmza-confirm-engine").prop("disabled",!1)}),$("#wpgmza-confirm-engine").on("click",function(event){self.onButtonClicked(event)})},WPGMZA.MapsEngineDialog.prototype.onButtonClicked=function(event){$(event.target).prop("disabled",!0),$.ajax(WPGMZA.ajaxurl,{method:"POST",data:{action:"wpgmza_maps_engine_dialog_set_engine",engine:$("[name='wpgmza_maps_engine']:checked").val()},success:function(response,status,xhr){window.location.reload()}})},$(window).on("load",function(event){var element=$("#wpgmza-maps-engine-dialog");element.length&&(WPGMZA.settings.wpgmza_maps_engine_dialog_done||(WPGMZA.mapsEngineDialog=new WPGMZA.MapsEngineDialog(element)))})}),jQuery(function($){WPGMZA.Marker=function(row){var self=this;WPGMZA.assertInstanceOf(this,"Marker"),this.lat="36.778261",this.lng="-119.4179323999",this.address="California",this.title=null,this.description="",this.link="",this.icon="",this.approved=1,this.pic=null,WPGMZA.MapObject.apply(this,arguments),row&&row.heatmap||(row&&this.on("init",function(event){row.position&&this.setPosition(row.position),row.map&&row.map.addMarker(this)}),this.addEventListener("added",function(event){self.onAdded(event)}))},WPGMZA.Marker.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Marker.prototype.constructor=WPGMZA.Marker,WPGMZA.Marker.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProMarker:WPGMZA.OLMarker;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProMarker:WPGMZA.GoogleMarker}},WPGMZA.Marker.createInstance=function(row){return new(WPGMZA.Marker.getConstructor())(row)},WPGMZA.Marker.ANIMATION_NONE="0",WPGMZA.Marker.ANIMATION_BOUNCE="1",WPGMZA.Marker.ANIMATION_DROP="2",WPGMZA.Marker.prototype.onAdded=function(event){var self=this;this.addEventListener("click",function(event){self.onClick(event)}),this.addEventListener("mouseover",function(event){self.onMouseOver(event)}),this.addEventListener("select",function(event){self.onSelect(event)}),this.map.settings.marker==this.id&&self.trigger("select")},WPGMZA.Marker.prototype.hidePreviousInteractedInfoWindow=function(){this.map.lastInteractedMarker&&this.map.lastInteractedMarker.infoWindow.close()},WPGMZA.Marker.prototype.openInfoWindow=function(){},WPGMZA.Marker.prototype.onClick=function(event){},WPGMZA.Marker.prototype.onSelect=function(event){this.openInfoWindow()},WPGMZA.Marker.prototype.onMouseOver=function(event){this.map.settings.info_window_open_by==WPGMZA.InfoWindow.OPEN_BY_HOVER&&this.openInfoWindow()},WPGMZA.Marker.prototype.getIcon=function(){return"string"!=typeof(url=WPGMZA.settings.default_marker_icon)?url:url.replace(/^http(s?):/,"");var url},WPGMZA.Marker.prototype.getPosition=function(){return{lat:parseFloat(this.lat),lng:parseFloat(this.lng)}},WPGMZA.Marker.prototype.setPosition=function(latLng){latLng instanceof WPGMZA.LatLng?(this.lat=latLng.lat,this.lng=latLng.lng):(this.lat=parseFloat(latLng.lat),this.lng=parseFloat(latLng.lng))},WPGMZA.Marker.prototype.getAnimation=function(animation){return this.settings.animation},WPGMZA.Marker.prototype.setAnimation=function(animation){this.settings.animation=animation},WPGMZA.Marker.prototype.getVisible=function(visible){},WPGMZA.Marker.prototype.setVisible=function(visible){!visible&&this.infoWindow&&this.infoWindow.close()},WPGMZA.Marker.prototype.setMap=function(map){map?map.addMarker(this):this.map&&this.map.removeMarker(this)},WPGMZA.Marker.prototype.getDraggable=function(){},WPGMZA.Marker.prototype.setDraggable=function(draggable){},WPGMZA.Marker.prototype.setOptions=function(){},WPGMZA.Marker.prototype.panIntoView=function(){if(!this.map)throw new Error("Marker hasn't been added to a map");this.map.setCenter(this.getPosition())},WPGMZA.Marker.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this),position=this.getPosition();return $.extend(result,{lat:position.lat,lng:position.lng,address:this.address,title:this.title,description:this.description,link:this.link,icon:this.icon,pic:this.pic,approved:this.approved}),result}}),jQuery(function($){WPGMZA.ModernStoreLocatorCircle=function(map_id,settings){var map;map=WPGMZA.isProVersion()?this.map=MYMAP[map_id].map:this.map=MYMAP.map,this.map_id=map_id,this.mapElement=map.element,this.mapSize={width:$(this.mapElement).width(),height:$(this.mapElement).height()},this.initCanvasLayer(),this.settings={center:new WPGMZA.LatLng(0,0),radius:1,color:"#63AFF2",shadowColor:"white",shadowBlur:4,centerRingRadius:10,centerRingLineWidth:3,numInnerRings:9,innerRingLineWidth:1,innerRingFade:!0,numOuterRings:7,ringLineWidth:1,mainRingLineWidth:2,numSpokes:6,spokesStartAngle:Math.PI/2,numRadiusLabels:6,radiusLabelsStartAngle:Math.PI/2,radiusLabelFont:"13px sans-serif",visible:!1},settings&&this.setOptions(settings)},WPGMZA.ModernStoreLocatorCircle.createInstance=function(map,settings){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocatorCircle(map,settings):new WPGMZA.OLModernStoreLocatorCircle(map,settings)},WPGMZA.ModernStoreLocatorCircle.prototype.initCanvasLayer=function(){},WPGMZA.ModernStoreLocatorCircle.prototype.onResize=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.onUpdate=function(event){this.draw()},WPGMZA.ModernStoreLocatorCircle.prototype.setOptions=function(options){for(var name in options){var functionName="set"+name.substr(0,1).toUpperCase()+name.substr(1);"function"==typeof this[functionName]?this[functionName](options[name]):this.settings[name]=options[name]}},WPGMZA.ModernStoreLocatorCircle.prototype.getResolutionScale=function(){return window.devicePixelRatio||1},WPGMZA.ModernStoreLocatorCircle.prototype.getCenter=function(){return this.getPosition()},WPGMZA.ModernStoreLocatorCircle.prototype.setCenter=function(value){this.setPosition(value)},WPGMZA.ModernStoreLocatorCircle.prototype.getPosition=function(){return this.settings.center},WPGMZA.ModernStoreLocatorCircle.prototype.setPosition=function(position){this.settings.center=position},WPGMZA.ModernStoreLocatorCircle.prototype.getRadius=function(){return this.settings.radius},WPGMZA.ModernStoreLocatorCircle.prototype.setRadius=function(radius){if(isNaN(radius))throw new Error("Invalid radius");this.settings.radius=radius},WPGMZA.ModernStoreLocatorCircle.prototype.getVisible=function(visible){return this.settings.visible},WPGMZA.ModernStoreLocatorCircle.prototype.setVisible=function(visible){this.settings.visible=visible},WPGMZA.ModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getContext=function(type){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){throw new Error("Abstract function called")},WPGMZA.ModernStoreLocatorCircle.prototype.validateSettings=function(){WPGMZA.isHexColorString(this.settings.color)||(this.settings.color="#63AFF2")},WPGMZA.ModernStoreLocatorCircle.prototype.draw=function(){this.validateSettings();var settings=this.settings,canvasDimensions=this.getCanvasDimensions(),canvasWidth=canvasDimensions.width,canvasHeight=canvasDimensions.height;this.map,this.getResolutionScale();if(context=this.getContext("2d"),context.clearRect(0,0,canvasWidth,canvasHeight),settings.visible){context.shadowColor=settings.shadowColor,context.shadowBlur=settings.shadowBlur,context.setTransform(1,0,0,1,0,0);var scale=this.getScale();context.scale(scale,scale);var offset=this.getWorldOriginOffset();context.translate(offset.x,offset.y);new WPGMZA.LatLng(this.settings.center);var worldPoint=this.getCenterPixels(),rgba=WPGMZA.hexToRgba(settings.color),ringSpacing=this.getTransformedRadius(settings.radius)/(settings.numInnerRings+1);context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.centerRingRadius)/scale,0,2*Math.PI),context.stroke(),context.closePath();var end,radius=this.getTransformedRadius(settings.radius)+ringSpacing*settings.numOuterRings+1,grad=context.createRadialGradient(0,0,0,0,0,radius),start=(rgba=WPGMZA.hexToRgba(settings.color),WPGMZA.rgbaToString(rgba));rgba.a=0,end=WPGMZA.rgbaToString(rgba),grad.addColorStop(0,start),grad.addColorStop(1,end),context.save(),context.translate(worldPoint.x,worldPoint.y),context.strokeStyle=grad,context.lineWidth=2/scale;for(var i=0;i<settings.numSpokes;i++)spokeAngle=settings.spokesStartAngle+2*Math.PI*(i/settings.numSpokes),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.setLineDash([2/scale,15/scale]),context.beginPath(),context.moveTo(0,0),context.lineTo(x,y),context.stroke();context.setLineDash([]),context.restore(),context.lineWidth=1/scale*settings.innerRingLineWidth;for(i=1;i<=settings.numInnerRings;i++){radius=i*ringSpacing;settings.innerRingFade&&(rgba.a=1-(i-1)/settings.numInnerRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath()}context.strokeStyle=settings.color,context.lineWidth=1/scale*settings.centerRingLineWidth,context.beginPath(),context.arc(worldPoint.x,worldPoint.y,this.getTransformedRadius(settings.radius),0,2*Math.PI),context.stroke(),context.closePath();for(radius=radius+ringSpacing,i=0;i<settings.numOuterRings;i++)settings.innerRingFade&&(rgba.a=1-i/settings.numOuterRings),context.strokeStyle=WPGMZA.rgbaToString(rgba),context.beginPath(),context.arc(worldPoint.x,worldPoint.y,radius,0,2*Math.PI),context.stroke(),context.closePath(),radius+=ringSpacing;if(0<settings.numRadiusLabels){var m,x,y;radius=this.getTransformedRadius(settings.radius);(m=settings.radiusLabelFont.match(/(\d+)px/))&&parseInt(m[1])/2*1.1/scale,context.font=settings.radiusLabelFont,context.textAlign="center",context.textBaseline="middle",context.fillStyle=settings.color,context.save(),context.translate(worldPoint.x,worldPoint.y);for(i=0;i<settings.numRadiusLabels;i++){var spokeAngle,width,textAngle=(spokeAngle=settings.radiusLabelsStartAngle+2*Math.PI*(i/settings.numRadiusLabels))+Math.PI/2,text=settings.radiusString;0<Math.sin(spokeAngle)&&(textAngle-=Math.PI),x=Math.cos(spokeAngle)*radius,y=Math.sin(spokeAngle)*radius,context.save(),context.translate(x,y),context.rotate(textAngle),context.scale(1/scale,1/scale),width=context.measureText(text).width,height=width/2,context.clearRect(-width,-height,2*width,2*height),context.fillText(settings.radiusString,0,0),context.restore()}context.restore()}}}}),jQuery(function($){WPGMZA.ModernStoreLocator=function(map_id){var original,self=this;if(WPGMZA.assertInstanceOf(this,"ModernStoreLocator"),(original=WPGMZA.isProVersion()?$(".wpgmza_sl_search_button[mid='"+map_id+"']").closest(".wpgmza_sl_main_div"):$(".wpgmza_sl_search_button").closest(".wpgmza_sl_main_div")).length){this.element=$("<div class='wpgmza-modern-store-locator'><div class='wpgmza-inner wpgmza-modern-hover-opaque'/></div>")[0];var addressInput,inner=$(this.element).find(".wpgmza-inner"),titleSearch=$(original).find("[id='nameInput_"+map_id+"']");if(titleSearch.length){var placeholder=wpgmaps_localize[map_id].other_settings.store_locator_name_string;placeholder&&placeholder.length&&titleSearch.attr("placeholder",placeholder),inner.append(titleSearch)}addressInput=WPGMZA.isProVersion()?$(original).find(".addressInput"):$(original).find("#addressInput"),wpgmaps_localize[map_id].other_settings.store_locator_query_string&&wpgmaps_localize[map_id].other_settings.store_locator_query_string.length&&addressInput.attr("placeholder",wpgmaps_localize[map_id].other_settings.store_locator_query_string),inner.append(addressInput),inner.append($(original).find("select.wpgmza_sl_radius_select")),this.searchButton=$(original).find(".wpgmza_sl_search_button"),inner.append(this.searchButton),this.resetButton=$(original).find(".wpgmza_sl_reset_button_div"),inner.append(this.resetButton),this.resetButton.on("click",function(event){resetLocations(map_id)}),this.resetButton.hide(),WPGMZA.isProVersion()&&(this.searchButton.on("click",function(event){0!=$("addressInput_"+map_id).val()&&(self.searchButton.hide(),self.resetButton.show())}),this.resetButton.on("click",function(event){self.resetButton.hide(),self.searchButton.show()})),inner.append($("#wpgmza_distance_type_"+map_id));var container=$(original).find(".wpgmza_cat_checkbox_holder"),items=($(container).children("ul"),$(container).find("li")),numCategories=0,icons=[];items.each(function(index,el){var id=$(el).attr("class").match(/\d+/);for(var category_id in wpgmza_category_data)if(id==category_id){var src=wpgmza_category_data[category_id].image,icon=$('<div class="wpgmza-chip-icon"/>');icon.css({"background-image":"url('"+src+"')",width:$("#wpgmza_cat_checkbox_"+category_id+" + label").height()+"px"}),icons.push(icon),null!=src&&""!=src&&$("#wpgmza_cat_checkbox_"+category_id+" + label").prepend(icon),numCategories++;break}}),$(this.element).append(container),numCategories&&(this.optionsButton=$('<span class="wpgmza_store_locator_options_button"><i class="fas fa-list"></i></span>'),$(this.searchButton).before(this.optionsButton)),setInterval(function(){icons.forEach(function(icon){var height=$(icon).height();$(icon).css({width:height+"px"}),$(icon).closest("label").css({"padding-left":height+8+"px"})}),$(container).css("width",$(self.element).find(".wpgmza-inner").outerWidth()+"px")},1e3),$(this.element).find(".wpgmza_store_locator_options_button").on("click",function(event){container.hasClass("wpgmza-open")?container.removeClass("wpgmza-open"):container.addClass("wpgmza-open")}),$(original).remove(),$(this.element).find("input, select").on("focus",function(){$(inner).addClass("active")}),$(this.element).find("input, select").on("blur",function(){$(inner).removeClass("active")})}},WPGMZA.ModernStoreLocator.createInstance=function(map_id){return"google-maps"==WPGMZA.settings.engine?new WPGMZA.GoogleModernStoreLocator(map_id):new WPGMZA.OLModernStoreLocator(map_id)}}),jQuery(function($){WPGMZA.Polygon=function(row,enginePolygon){WPGMZA.assertInstanceOf(this,"Polygon"),this.paths=null,this.title=null,this.name=null,this.link=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polygon.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polygon.prototype.constructor=WPGMZA.Polygon,WPGMZA.Polygon.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.isProVersion()?WPGMZA.OLProPolygon:WPGMZA.OLPolygon;default:return WPGMZA.isProVersion()?WPGMZA.GoogleProPolygon:WPGMZA.GooglePolygon}},WPGMZA.Polygon.createInstance=function(row,engineObject){return new(WPGMZA.Polygon.getConstructor())(row,engineObject)},WPGMZA.Polygon.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return $.extend(result,{name:this.name,title:this.title,link:this.link}),result}}),jQuery(function($){WPGMZA.Polyline=function(row,googlePolyline){WPGMZA.assertInstanceOf(this,"Polyline"),this.title=null,WPGMZA.MapObject.apply(this,arguments)},WPGMZA.Polyline.prototype=Object.create(WPGMZA.MapObject.prototype),WPGMZA.Polyline.prototype.constructor=WPGMZA.Polyline,WPGMZA.Polyline.getConstructor=function(){switch(WPGMZA.settings.engine){case"open-layers":return WPGMZA.OLPolyline;default:return WPGMZA.GooglePolyline}},WPGMZA.Polyline.createInstance=function(row,engineObject){return new(WPGMZA.Polyline.getConstructor())(row,engineObject)},WPGMZA.Polyline.prototype.getPoints=function(){return this.toJSON().points},WPGMZA.Polyline.prototype.toJSON=function(){var result=WPGMZA.MapObject.prototype.toJSON.call(this);return result.title=this.title,result}}),jQuery(function($){WPGMZA.RestAPI=function(){WPGMZA.RestAPI.URL=WPGMZA.resturl},WPGMZA.RestAPI.createInstance=function(){return new WPGMZA.RestAPI},WPGMZA.RestAPI.prototype.call=function(route,params){if("string"!=typeof route||!route.match(/^\//))throw new Error("Invalid route");WPGMZA.RestAPI.URL.match(/\/$/)&&(route=route.replace(/^\//,"")),$.ajax(WPGMZA.RestAPI.URL+route,params)}}),jQuery(function($){function validateParts(parts){for(var i=0;i<parts.length;++i)if(x=parts[i],!/^\d+$/.test(x))return!1;var x;return!0}WPGMZA.Version=function(){},WPGMZA.Version.compare=function(v1,v2){var v1parts=v1.split("."),v2parts=v2.split(".");if(!validateParts(v1parts)||!validateParts(v2parts))return NaN;for(var i=0;i<v1parts.length;++i){if(v2parts.length===i)return 1;if(v1parts[i]!==v2parts[i])return v1parts[i]>v2parts[i]?1:-1}return v1parts.length!=v2parts.length?-1:0}}),jQuery(function($){WPGMZA.Integration={},WPGMZA.integrationModules={}}),jQuery(function($){if(wp&&wp.i18n&&wp.blocks){var __=wp.i18n.__,registerBlockType=wp.blocks.registerBlockType,_wp$editor=wp.editor,InspectorControls=_wp$editor.InspectorControls,_wp$components=(_wp$editor.BlockControls,wp.components),Dashicon=_wp$components.Dashicon,PanelBody=(_wp$components.Toolbar,_wp$components.Button,_wp$components.Tooltip,_wp$components.PanelBody);_wp$components.TextareaControl,_wp$components.TextControl,_wp$components.RichText;WPGMZA.Integration.Gutenberg=function(){registerBlockType("gutenberg-wpgmza/block",this.getBlockDefinition())},WPGMZA.Integration.Gutenberg.prototype.getBlockTitle=function(){return __("WP Google Maps")},WPGMZA.Integration.Gutenberg.prototype.getBlockInspectorControls=function(props){return React.createElement(InspectorControls,{key:"inspector"},React.createElement(PanelBody,{title:__("Map Settings")}))},WPGMZA.Integration.Gutenberg.prototype.getBlockAttributes=function(){return{}},WPGMZA.Integration.Gutenberg.prototype.getBlockDefinition=function(props){var _this=this;return{title:__("WP Google Maps"),description:__("The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss."),category:"common",icon:"location-alt",keywords:[__("Map"),__("Maps"),__("Google")],attributes:this.getBlockAttributes(),edit:function(props){return[!!props.isSelected&&_this.getBlockInspectorControls(props),React.createElement("div",{className:props.className+" wpgmza-gutenberg-block"},React.createElement(Dashicon,{icon:"location-alt"}),React.createElement("span",{class:"wpgmza-gutenberg-block-title"},__("WP Google Maps")))]},save:function(props){return null}}},WPGMZA.Integration.Gutenberg.getConstructor=function(){return WPGMZA.Integration.Gutenberg},WPGMZA.Integration.Gutenberg.createInstance=function(){return new(WPGMZA.Integration.Gutenberg.getConstructor())},WPGMZA.isProVersion()||(WPGMZA.integrationModules.gutenberg=WPGMZA.Integration.Gutenberg.createInstance())}}),jQuery(function($){WPGMZA.GoogleUICompatibility=function(){if(!(navigator.vendor&&-1<navigator.vendor.indexOf("Apple")&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"))){var style=$("<style id='wpgmza-google-ui-compatiblity-fix'/>");style.html(".wpgmza_map img:not(button img) { padding:0 !important; }"),$(document.head).append(style)}},WPGMZA.googleUICompatibility=new WPGMZA.GoogleUICompatibility}),jQuery(function($){WPGMZA.GoogleCircle=function(options,googleCircle){var self=this;if(WPGMZA.Circle.call(this,options,googleCircle),googleCircle?this.googleCircle=googleCircle:(this.googleCircle=new google.maps.Circle,this.googleCircle.wpgmzaCircle=this),google.maps.event.addListener(this.googleCircle,"click",function(){self.dispatchEvent({type:"click"})}),options){var googleOptions={};delete(googleOptions=$.extend({},options)).map,delete googleOptions.center,options.center&&(googleOptions.center=new google.maps.LatLng({lat:options.center.lat,lng:options.center.lng})),this.googleCircle.setOptions(googleOptions),options.map&&options.map.addCircle(this)}},WPGMZA.GoogleCircle.prototype=Object.create(WPGMZA.Circle.prototype),WPGMZA.GoogleCircle.prototype.constructor=WPGMZA.GoogleCircle}),jQuery(function($){WPGMZA.GoogleGeocoder=function(){},WPGMZA.GoogleGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.GoogleGeocoder.prototype.constructor=WPGMZA.GoogleGeocoder,WPGMZA.GoogleGeocoder.prototype.getLatLngFromAddress=function(options,callback){if(!options||!options.address)throw new Error("No address specified");if(WPGMZA.isLatLngString(options.address))return WPGMZA.Geocoder.prototype.getLatLngFromAddress.call(this,options,callback);options.country&&(options.componentRestrictions={country:options.country}),(new google.maps.Geocoder).geocode(options,function(results,status){if(status==google.maps.GeocoderStatus.OK){var location=results[0].geometry.location,latLng={lat:location.lat(),lng:location.lng()};callback(results=[{geometry:{location:latLng},latLng:latLng,lat:latLng.lat,lng:latLng.lng}],WPGMZA.Geocoder.SUCCESS)}else{var nativeStatus=WPGMZA.Geocoder.FAIL;status==google.maps.GeocoderStatus.ZERO_RESULTS&&(nativeStatus=WPGMZA.Geocoder.ZERO_RESULTS),callback(null,nativeStatus)}})},WPGMZA.GoogleGeocoder.prototype.getAddressFromLatLng=function(options,callback){if(!options||!options.latLng)throw new Error("No latLng specified");var latLng=new WPGMZA.LatLng(options.latLng),geocoder=new google.maps.Geocoder;delete(options=$.extend(options,{location:{lat:latLng.lat,lng:latLng.lng}})).latLng,geocoder.geocode(options,function(results,status){"OK"!==status&&callback(null,WPGMZA.Geocoder.FAIL),results&&results.length||callback([],WPGMZA.Geocoder.NO_RESULTS),callback([results[0].formatted_address],WPGMZA.Geocoder.SUCCESS)})}}),jQuery(function($){var Parent;WPGMZA.GoogleInfoWindow=function(mapObject){Parent.call(this,mapObject),this.setMapObject(mapObject)},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.GoogleInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.GoogleInfoWindow.prototype.constructor=WPGMZA.GoogleInfoWindow,WPGMZA.GoogleInfoWindow.prototype.setMapObject=function(mapObject){mapObject instanceof WPGMZA.Marker?this.googleObject=mapObject.googleMarker:mapObject instanceof WPGMZA.Polygon?this.googleObject=mapObject.googlePolygon:mapObject instanceof WPGMZA.Polyline&&(this.googleObject=mapObject.googlePolyline)},WPGMZA.GoogleInfoWindow.prototype.createGoogleInfoWindow=function(){this.googleInfoWindow||(this.googleInfoWindow=new google.maps.InfoWindow)},WPGMZA.GoogleInfoWindow.prototype.open=function(map,mapObject){return!!Parent.prototype.open.call(this,map,mapObject)&&(this.createGoogleInfoWindow(),this.setMapObject(mapObject),this.googleInfoWindow.open(this.mapObject.map.googleMap,this.googleObject),this.content&&this.googleInfoWindow.setContent(this.content),!0)},WPGMZA.GoogleInfoWindow.prototype.close=function(){this.googleInfoWindow&&(WPGMZA.InfoWindow.prototype.close.call(this),this.googleInfoWindow.close())},WPGMZA.GoogleInfoWindow.prototype.setContent=function(html){Parent.prototype.setContent.call(this,html),this.content=html,this.createGoogleInfoWindow(),this.googleInfoWindow.setContent(html)},WPGMZA.GoogleInfoWindow.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.createGoogleInfoWindow(),this.googleInfoWindow.setOptions(options)}}),jQuery(function($){var Parent;WPGMZA.GoogleMap=function(element,options){var self=this;if(Parent.call(this,element,options),!window.google){var status=WPGMZA.googleAPIStatus,message="Google API not loaded";if(status&&status.message&&(message+=" - "+status.message),"USER_CONSENT_NOT_GIVEN"==status.code)return;throw $(element).html("<div class='notice notice-error'><p>"+WPGMZA.localized_strings.google_api_not_loaded+"<pre>"+message+"</pre></p></div>"),new Error(message)}this.loadGoogleMap(),options&&this.setOptions(options),google.maps.event.addListener(this.googleMap,"click",function(event){var wpgmzaEvent=new WPGMZA.Event("click");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"rightclick",function(event){var wpgmzaEvent=new WPGMZA.Event("rightclick");wpgmzaEvent.latLng={lat:event.latLng.lat(),lng:event.latLng.lng()},self.dispatchEvent(wpgmzaEvent)}),google.maps.event.addListener(this.googleMap,"dragend",function(event){self.dispatchEvent("dragend")}),google.maps.event.addListener(this.googleMap,"zoom_changed",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged")}),google.maps.event.addListener(this.googleMap,"idle",function(event){self.onIdle(event)}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},WPGMZA.isProVersion()?(Parent=WPGMZA.ProMap,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.ProMap.prototype)):(Parent=WPGMZA.Map,WPGMZA.GoogleMap.prototype=Object.create(WPGMZA.Map.prototype)),WPGMZA.GoogleMap.prototype.constructor=WPGMZA.GoogleMap,WPGMZA.GoogleMap.prototype.loadGoogleMap=function(){var self=this,options=this.settings.toGoogleMapsOptions();this.googleMap=new google.maps.Map(this.engineElement,options),google.maps.event.addListener(this.googleMap,"bounds_changed",function(){self.onBoundsChanged()}),1==this.settings.bicycle&&this.enableBicycleLayer(!0),1==this.settings.traffic&&this.enableTrafficLayer(!0),1==this.settings.transport&&this.enablePublicTransportLayer(!0),this.showPointsOfInterest(this.settings.show_points_of_interest),$(this.engineElement).append($(this.element).find(".wpgmza-loader"))},WPGMZA.GoogleMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.googleMap.setOptions(this.settings.toGoogleMapsOptions());var clone=$.extend({},options);(clone.center instanceof WPGMZA.LatLng||"object"==typeof clone.center)&&(clone.center={lat:parseFloat(clone.center.lat),lng:parseFloat(clone.center.lng)}),this.googleMap.setOptions(clone)},WPGMZA.GoogleMap.prototype.addMarker=function(marker){marker.googleMarker.setMap(this.googleMap),Parent.prototype.addMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.removeMarker=function(marker){marker.googleMarker.setMap(null),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.GoogleMap.prototype.addPolygon=function(polygon){polygon.googlePolygon.setMap(this.googleMap),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.removePolygon=function(polygon){polygon.googlePolygon.setMap(null),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.GoogleMap.prototype.addPolyline=function(polyline){polyline.googlePolyline.setMap(this.googleMap),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.removePolyline=function(polyline){polyline.googlePolyline.setMap(null),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.GoogleMap.prototype.addCircle=function(circle){circle.googleCircle.setMap(this.googleMap),Parent.prototype.addCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.removeCircle=function(circle){circle.googleCircle.setMap(null),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.GoogleMap.prototype.getCenter=function(){var latLng=this.googleMap.getCenter();return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.setCenter=function(latLng){WPGMZA.Map.prototype.setCenter.call(this,latLng),latLng instanceof WPGMZA.LatLng?this.googleMap.setCenter({lat:latLng.lat,lng:latLng.lng}):this.googleMap.setCenter(latLng)},WPGMZA.GoogleMap.prototype.panTo=function(latLng){latLng instanceof WPGMZA.LatLng?this.googleMap.panTo({lat:latLng.lat,lng:latLng.lng}):this.googleMap.panTo(latLng)},WPGMZA.GoogleMap.prototype.getZoom=function(){return this.googleMap.getZoom()},WPGMZA.GoogleMap.prototype.setZoom=function(value){if(isNaN(value))throw new Error("Value must not be NaN");return this.googleMap.setZoom(value)},WPGMZA.GoogleMap.prototype.getBounds=function(){var bounds=this.googleMap.getBounds(),northEast=bounds.getNorthEast(),southWest=bounds.getSouthWest();return{topLeft:{lat:northEast.lat(),lng:southWest.lng()},bottomRight:{lat:southWest.lat(),lng:northEast.lng()}}},WPGMZA.GoogleMap.prototype.fitBounds=function(southWest,northEast){southWest instanceof WPGMZA.LatLng&&(southWest={lat:southWest.lat,lng:southWest.lng}),northEast instanceof WPGMZA.LatLng&&(northEast={lat:northEast.lat,lng:northEast.lng}),this.googleMap.fitBounds(southWest,northEast)},WPGMZA.GoogleMap.prototype.fitBoundsToVisibleMarkers=function(){for(var bounds=new google.maps.LatLngBounds,i=0;i<this.markers.length;i++)markers[i].getVisible()&&bounds.extend(markers[i].getPosition());this.googleMap.fitBounds(bounds)},WPGMZA.GoogleMap.prototype.enableBicycleLayer=function(enable){this.bicycleLayer||(this.bicycleLayer=new google.maps.BicyclingLayer),this.bicycleLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enableTrafficLayer=function(enable){this.trafficLayer||(this.trafficLayer=new google.maps.TrafficLayer),this.trafficLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.enablePublicTransportLayer=function(enable){this.publicTransportLayer||(this.publicTransportLayer=new google.maps.TransitLayer),this.publicTransportLayer.setMap(enable?this.googleMap:null)},WPGMZA.GoogleMap.prototype.showPointsOfInterest=function(show){var text=$("textarea[name='theme_data']").val();if(text){var styles=JSON.parse(text);styles.push({featureType:"poi",stylers:[{visibility:show?"on":"off"}]}),this.googleMap.setOptions({styles:styles})}},WPGMZA.GoogleMap.prototype.getMinZoom=function(){return parseInt(this.settings.min_zoom)},WPGMZA.GoogleMap.prototype.setMinZoom=function(value){this.googleMap.setOptions({minZoom:value,maxZoom:this.getMaxZoom()})},WPGMZA.GoogleMap.prototype.getMaxZoom=function(){return parseInt(this.settings.max_zoom)},WPGMZA.GoogleMap.prototype.setMaxZoom=function(value){this.googleMap.setOptions({minZoom:this.getMinZoom(),maxZoom:value})},WPGMZA.GoogleMap.prototype.latLngToPixels=function(latLng){var map=this.googleMap,nativeLatLng=new google.maps.LatLng({lat:parseFloat(latLng.lat),lng:parseFloat(latLng.lng)}),topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=map.getProjection().fromLatLngToPoint(nativeLatLng);return{x:(worldPoint.x-bottomLeft.x)*scale,y:(worldPoint.y-topRight.y)*scale}},WPGMZA.GoogleMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var map=this.googleMap,topRight=map.getProjection().fromLatLngToPoint(map.getBounds().getNorthEast()),bottomLeft=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest()),scale=Math.pow(2,map.getZoom()),worldPoint=new google.maps.Point(x/scale+bottomLeft.x,y/scale+topRight.y),latLng=map.getProjection().fromPointToLatLng(worldPoint);return{lat:latLng.lat(),lng:latLng.lng()}},WPGMZA.GoogleMap.prototype.onElementResized=function(event){this.googleMap&&google.maps.event.trigger(this.googleMap,"resize")}}),jQuery(function($){var Parent;WPGMZA.GoogleMarker=function(row){var self=this;Parent.call(this,row);var settings={};if(row)for(var name in row)row[name]instanceof WPGMZA.LatLng?settings[name]=row[name].toGoogleLatLng():row[name]instanceof WPGMZA.Map||(settings[name]=row[name]);this.googleMarker=new google.maps.Marker(settings),(this.googleMarker.wpgmzaMarker=this).googleMarker.setPosition(new google.maps.LatLng({lat:parseFloat(this.lat),lng:parseFloat(this.lng)})),this.googleMarker.setLabel(this.settings.label),this.animation&&this.googleMarker.setAnimation(this.animation),google.maps.event.addListener(this.googleMarker,"click",function(){self.dispatchEvent("click"),self.dispatchEvent("select")}),google.maps.event.addListener(this.googleMarker,"mouseover",function(){self.dispatchEvent("mouseover")}),google.maps.event.addListener(this.googleMarker,"dragend",function(){var googleMarkerPosition=self.googleMarker.getPosition();self.setPosition({lat:googleMarkerPosition.lat(),lng:googleMarkerPosition.lng()}),self.dispatchEvent({type:"dragend",latLng:self.getPosition()})}),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.GoogleMarker.prototype=Object.create(Parent.prototype),WPGMZA.GoogleMarker.prototype.constructor=WPGMZA.GoogleMarker,WPGMZA.GoogleMarker.prototype.setLabel=function(label){label?(this.googleMarker.setLabel({text:label}),this.googleMarker.getIcon()||this.googleMarker.setIcon(WPGMZA.settings.default_marker_icon)):this.googleMarker.setLabel(null)},WPGMZA.GoogleMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng),this.googleMarker.setPosition({lat:this.lat,lng:this.lng})},WPGMZA.GoogleMarker.prototype.setOffset=function(x,y){var params,self=this,icon=this.googleMarker.getIcon(),img=new Image;params="string"==typeof icon?{url:icon}:icon,img.onload=function(){var defaultAnchor_x=img.width/2,defaultAnchor_y=img.height;params.anchor=new google.maps.Point(defaultAnchor_x-x,defaultAnchor_y-y),self.googleMarker.setIcon(params)},img.src=params.url},WPGMZA.GoogleMarker.prototype.setOptions=function(options){this.googleMarker.setOptions(options)},WPGMZA.GoogleMarker.prototype.setAnimation=function(animation){Parent.prototype.setAnimation.call(this,animation),this.googleMarker.setAnimation(animation)},WPGMZA.GoogleMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible.call(this,visible),this.googleMarker.setVisible(visible)},WPGMZA.GoogleMarker.prototype.setDraggable=function(draggable){this.googleMarker.setDraggable(draggable)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocatorCircle=function(map,settings){var self=this;WPGMZA.ModernStoreLocatorCircle.call(this,map,settings),this.intervalID=setInterval(function(){var mapSize={width:$(self.mapElement).width(),height:$(self.mapElement).height()};mapSize.width==self.mapSize.width&&mapSize.height==self.mapSize.height||(self.canvasLayer.resize_(),self.canvasLayer.draw(),self.mapSize=mapSize)},1e3),$(document).bind("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){self.canvasLayer.resize_(),self.canvasLayer.draw()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.GoogleModernStoreLocatorCircle.prototype.constructor=WPGMZA.GoogleModernStoreLocatorCircle,WPGMZA.GoogleModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this;this.canvasLayer&&(this.canvasLayer.setMap(null),this.canvasLayer.setAnimate(!1)),this.canvasLayer=new CanvasLayer({map:this.map.googleMap,resizeHandler:function(event){self.onResize(event)},updateHandler:function(event){self.onUpdate(event)},animate:!0,resolutionScale:this.getResolutionScale()})},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setOptions=function(options){WPGMZA.ModernStoreLocatorCircle.prototype.setOptions.call(this,options),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setPosition=function(position){WPGMZA.ModernStoreLocatorCircle.prototype.setPosition.call(this,position),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setRadius=function(radius){WPGMZA.ModernStoreLocatorCircle.prototype.setRadius.call(this,radius),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var spherical=google.maps.geometry.spherical,center=this.settings.center,equator=new WPGMZA.LatLng({lat:0,lng:0}),latitude=new WPGMZA.LatLng({lat:center.lat,lng:0}),offsetAtEquator=spherical.computeOffset(equator.toGoogleLatLng(),1e3*km,90),result=.006395*km*(spherical.computeOffset(latitude.toGoogleLatLng(),1e3*km,90).lng()/offsetAtEquator.lng());if(isNaN(result))throw new Error("here");return result},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvasLayer.canvas.width,height:this.canvasLayer.canvas.height}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){var position=this.map.googleMap.getProjection().fromLatLngToPoint(this.canvasLayer.getTopLeft());return{x:-position.x,y:-position.y}},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getCenterPixels=function(){var center=new WPGMZA.LatLng(this.settings.center);return this.map.googleMap.getProjection().fromLatLngToPoint(center.toGoogleLatLng())},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvasLayer.canvas.getContext("2d")},WPGMZA.GoogleModernStoreLocatorCircle.prototype.getScale=function(){return Math.pow(2,this.map.getZoom())*this.getResolutionScale()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.setVisible=function(visible){WPGMZA.ModernStoreLocatorCircle.prototype.setVisible.call(this,visible),this.canvasLayer.scheduleUpdate()},WPGMZA.GoogleModernStoreLocatorCircle.prototype.destroy=function(){this.canvasLayer.setMap(null),this.canvasLayer=null,clearInterval(this.intervalID)}}),jQuery(function($){WPGMZA.GoogleModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?MYMAP[map_id].map.googleMap:MYMAP.map.googleMap).controls[google.maps.ControlPosition.TOP_CENTER].push(this.element)},WPGMZA.GoogleModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator.prototype),WPGMZA.GoogleModernStoreLocator.prototype.constructor=WPGMZA.GoogleModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.GooglePolygon=function(row,googlePolygon){var self=this;if(Parent.call(this,row,googlePolygon),googlePolygon)this.googlePolygon=googlePolygon;else if(this.googlePolygon=new google.maps.Polygon(this.settings),row&&row.points){var paths=this.parseGeometry(row.points);this.googlePolygon.setOptions({paths:paths})}this.googlePolygon.wpgmzaPolygon=this,google.maps.event.addListener(this.googlePolygon,"click",function(){self.dispatchEvent({type:"click"})})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.GooglePolygon.prototype=Object.create(Parent.prototype),WPGMZA.GooglePolygon.prototype.constructor=WPGMZA.GooglePolygon,WPGMZA.GooglePolygon.prototype.getEditable=function(){return this.googlePolygon.getOptions().editable},WPGMZA.GooglePolygon.prototype.setEditable=function(value){this.googlePolygon.setOptions({editable:value})},WPGMZA.GooglePolygon.prototype.toJSON=function(){var result=WPGMZA.Polygon.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolygon.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){WPGMZA.GooglePolyline=function(row,googlePolyline){var self=this;if(WPGMZA.Polyline.call(this,row,googlePolyline),googlePolyline)this.googlePolyline=googlePolyline;else if(this.googlePolyline=new google.maps.Polyline(this.settings),this.googlePolyline.wpgmzaPolyline=this,row&&row.points){var path=this.parseGeometry(row.points);this.setPoints(path)}google.maps.event.addListener(this.googlePolyline,"click",function(){self.dispatchEvent({type:"click"})})},WPGMZA.GooglePolyline.prototype=Object.create(WPGMZA.Polyline.prototype),WPGMZA.GooglePolyline.prototype.constructor=WPGMZA.GooglePolyline,WPGMZA.GooglePolyline.prototype.setEditable=function(value){this.googlePolyline.setOptions({editable:value})},WPGMZA.GooglePolyline.prototype.setPoints=function(points){this.googlePolyline.setOptions({path:points})},WPGMZA.GooglePolyline.prototype.toJSON=function(){var result=WPGMZA.Polyline.prototype.toJSON.call(this);result.points=[];for(var path=this.googlePolyline.getPath(),i=0;i<path.getLength();i++){var latLng=path.getAt(i);result.points.push({lat:latLng.lat(),lng:latLng.lng()})}return result}}),jQuery(function($){"google-maps"==WPGMZA.settings.engine&&(WPGMZA.googleAPIStatus&&"USER_CONSENT_NOT_GIVEN"==WPGMZA.googleAPIStatus.code||(WPGMZA.GoogleVertexContextMenu=function(mapEditPage){var self=this;this.mapEditPage=mapEditPage,this.element=document.createElement("div"),this.element.className="wpgmza-vertex-context-menu",this.element.innerHTML="Delete",google.maps.event.addDomListener(this.element,"click",function(event){return self.removeVertex(),event.preventDefault(),event.stopPropagation(),!1})},WPGMZA.GoogleVertexContextMenu.prototype=new google.maps.OverlayView,WPGMZA.GoogleVertexContextMenu.prototype.onAdd=function(){var self=this,map=this.getMap();this.getPanes().floatPane.appendChild(this.element),this.divListener=google.maps.event.addDomListener(map.getDiv(),"mousedown",function(e){e.target!=self.element&&self.close()},!0)},WPGMZA.GoogleVertexContextMenu.prototype.onRemove=function(){google.maps.event.removeListener(this.divListener),this.element.parentNode.removeChild(this.element),this.set("position"),this.set("path"),this.set("vertex")},WPGMZA.GoogleVertexContextMenu.prototype.open=function(map,path,vertex){this.set("position",path.getAt(vertex)),this.set("path",path),this.set("vertex",vertex),this.setMap(map),this.draw()},WPGMZA.GoogleVertexContextMenu.prototype.close=function(){this.setMap(null)},WPGMZA.GoogleVertexContextMenu.prototype.draw=function(){var position=this.get("position"),projection=this.getProjection();if(position&&projection){var point=projection.fromLatLngToDivPixel(position);this.element.style.top=point.y+"px",this.element.style.left=point.x+"px"}},WPGMZA.GoogleVertexContextMenu.prototype.removeVertex=function(){var path=this.get("path"),vertex=this.get("vertex");path&&null!=vertex&&path.removeAt(vertex),this.close()}))}),jQuery(function($){var Parent=WPGMZA.Circle;WPGMZA.OLCircle=function(options,olFeature){this.center={lat:0,lng:0},this.radius=0,Parent.call(this,options,olFeature),this.settings.fillColor||(this.settings.fillColor="#ff0000",this.settings.fillOpacity=.6),this.olStyle=new ol.style.Style(this.getStyleFromSettings());var vectorLayer3857=new ol.layer.Vector({source:new ol.source.Vector,style:this.olStyle});if(olFeature)this.olFeature=olFeature;else{var x,y,wgs84Sphere=new ol.Sphere(6378137),radius=this.radius;x=this.center.lng,y=this.center.lat;var circle3857=ol.geom.Polygon.circular(wgs84Sphere,[x,y],radius,64).clone().transform("EPSG:4326","EPSG:3857");vectorLayer3857.getSource().addFeature(new ol.Feature(circle3857))}this.layer=vectorLayer3857,options.map.olMap.addLayer(vectorLayer3857)},WPGMZA.OLCircle.prototype=Object.create(Parent.prototype),WPGMZA.OLCircle.prototype.constructor=WPGMZA.OLCircle,WPGMZA.OLCircle.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLCircle.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)}}),jQuery(function($){WPGMZA.OLGeocoder=function(){},WPGMZA.OLGeocoder.prototype=Object.create(WPGMZA.Geocoder.prototype),WPGMZA.OLGeocoder.prototype.constructor=WPGMZA.OLGeocoder,WPGMZA.OLGeocoder.prototype.getResponseFromCache=function(address,callback){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_query_nominatim_cache",query:address},success:function(response,xhr,status){response.lng=response.lon,callback(response)}})},WPGMZA.OLGeocoder.prototype.getResponseFromNominatim=function(options,callback){var data={q:options.address,format:"json"};options.country&&(data.countrycodes=options.country),$.ajax("https://nominatim.openstreetmap.org/search/",{data:data,success:function(response,xhr,status){callback(response)},error:function(response,xhr,status){callback(null,WPGMZA.Geocoder.FAIL)}})},WPGMZA.OLGeocoder.prototype.cacheResponse=function(address,response){$.ajax(WPGMZA.ajaxurl,{data:{action:"wpgmza_store_nominatim_cache",query:address,response:JSON.stringify(response)},method:"POST"})},WPGMZA.OLGeocoder.prototype.getLatLngFromAddress=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.getAddressFromLatLng=function(options,callback){return WPGMZA.OLGeocoder.prototype.geocode(options,callback)},WPGMZA.OLGeocoder.prototype.geocode=function(options,callback){var finish,location,self=this;if(!options)throw new Error("Invalid options");if(options.location&&(options.latLng=new WPGMZA.LatLng(options.location)),options.address)location=options.address,finish=function(response,status){for(var i=0;i<response.length;i++)response[i].geometry={location:new WPGMZA.LatLng({lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)})},response[i].latLng={lat:parseFloat(response[i].lat),lng:parseFloat(response[i].lon)},response[i].lng=response[i].lon;callback(response,status)};else{if(!options.latLng)throw new Error("You must supply either a latLng or address");location=options.latLng.toString(),finish=function(response,status){var address=response[0].display_name;callback([address],status)}}this.getResponseFromCache(location,function(response){response.length?finish(response,WPGMZA.Geocoder.SUCCESS):self.getResponseFromNominatim($.extend(options,{address:location}),function(response,status){status!=WPGMZA.Geocoder.FAIL?0!=response.length?(finish(response,WPGMZA.Geocoder.SUCCESS),self.cacheResponse(location,response)):callback([],WPGMZA.Geocoder.ZERO_RESULTS):callback(null,WPGMZA.Geocoder.FAIL)})})}}),jQuery(function($){var Parent;WPGMZA.OLInfoWindow=function(mapObject){var self=this;Parent.call(this,mapObject),this.element=$("<div class='ol-info-window-container ol-info-window-plain'></div>")[0],$(this.element).on("click",".ol-info-window-close",function(event){self.close()})},Parent=WPGMZA.isProVersion()?WPGMZA.ProInfoWindow:WPGMZA.InfoWindow,WPGMZA.OLInfoWindow.prototype=Object.create(Parent.prototype),WPGMZA.OLInfoWindow.prototype.constructor=WPGMZA.OLInfoWindow,WPGMZA.OLInfoWindow.prototype.open=function(map,mapObject){var latLng=mapObject.getPosition();if(!WPGMZA.InfoWindow.prototype.open.call(this,map,mapObject))return!1;this.overlay&&this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.mapObject.map.olMap.addOverlay(this.overlay),$(this.element).show(),this.dispatchEvent("infowindowopen")},WPGMZA.OLInfoWindow.prototype.close=function(event){$(this.element).hide(),this.overlay&&(WPGMZA.InfoWindow.prototype.close.call(this),this.mapObject.map.olMap.removeOverlay(this.overlay),this.overlay=null)},WPGMZA.OLInfoWindow.prototype.setContent=function(html){$(this.element).html("<i class='fa fa-times ol-info-window-close' aria-hidden='true'></i>"+html)},WPGMZA.OLInfoWindow.prototype.setOptions=function(options){WPGMZA.settings.developer_mode&&console.log(options),options.maxWidth&&$(this.element).css({"max-width":options.maxWidth+"px"})}}),jQuery(function($){var Parent;WPGMZA.OLMap=function(element,options){var self=this;Parent.call(this,element),this.setOptions(options);var marker,viewOptions=this.settings.toOLViewOptions();$(this.element).html(""),this.olMap=new ol.Map({target:$(element)[0],layers:[this.getTileLayer()],view:new ol.View(viewOptions)}),this.olMap.getInteractions().forEach(function(interaction){interaction instanceof ol.interaction.DragPan?interaction.setActive("yes"!=this.settings.wpgmza_settings_map_draggable):interaction instanceof ol.interaction.DoubleClickZoom?interaction.setActive(!this.settings.wpgmza_settings_map_clickzoom):interaction instanceof ol.interaction.MouseWheelZoom&&interaction.setActive("yes"!=this.settings.wpgmza_settings_map_scroll)},this),this.olMap.getControls().forEach(function(control){control instanceof ol.control.Zoom&&"yes"==WPGMZA.settings.wpgmza_settings_map_zoom&&this.olMap.removeControl(control)},this),"yes"!=WPGMZA.settings.wpgmza_settings_map_full_screen_control&&this.olMap.addControl(new ol.control.FullScreen),this.markerLayer=new ol.layer.Vector({source:new ol.source.Vector({features:[]})}),this.olMap.addLayer(this.markerLayer),this.olMap.on("movestart",function(event){self.isBeingDragged=!0}),this.olMap.on("moveend",function(event){self.wrapLongitude(),self.isBeingDragged=!1,self.dispatchEvent("dragend"),self.onIdle()}),this.olMap.getView().on("change:resolution",function(event){self.dispatchEvent("zoom_changed"),self.dispatchEvent("zoomchanged"),self.onIdle()}),this.olMap.getView().on("change",function(){self.onBoundsChanged()}),self.onBoundsChanged(),this.storeLocator&&(marker=this.storeLocator.centerPointMarker)&&(this.olMap.addOverlay(marker.overlay),marker.setVisible(!1)),$(this.element).on("click contextmenu",function(event){var isRight;event=event||window.event;var latLng=self.pixelsToLatLng(event.offsetX,event.offsetY);if("which"in event?isRight=3==event.which:"button"in event&&(isRight=2==event.button),1!=event.which&&1!=event.button){if(isRight)return self.onRightClick(event)}else{if(self.isBeingDragged)return;self.trigger({type:"click",latLng:latLng})}}),WPGMZA.isProVersion()||(this.dispatchEvent("created"),WPGMZA.events.dispatchEvent({type:"mapcreated",map:this}))},Parent=WPGMZA.isProVersion()?WPGMZA.ProMap:WPGMZA.Map,WPGMZA.OLMap.prototype=Object.create(Parent.prototype),WPGMZA.OLMap.prototype.constructor=WPGMZA.OLMap,WPGMZA.OLMap.prototype.getTileLayer=function(){return new ol.layer.Tile({source:new ol.source.OSM})},WPGMZA.OLMap.prototype.wrapLongitude=function(){var center=this.getCenter();-180<=center.lng&¢er.lng<=180||(center.lng=center.lng-360*Math.floor(center.lng/360),180<center.lng&&(center.lng-=360),this.setCenter(center))},WPGMZA.OLMap.prototype.getCenter=function(){var lonLat=ol.proj.toLonLat(this.olMap.getView().getCenter());return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.setCenter=function(latLng){var view=this.olMap.getView();WPGMZA.Map.prototype.setCenter.call(this,latLng),view.setCenter(ol.proj.fromLonLat([latLng.lng,latLng.lat])),this.wrapLongitude(),this.onBoundsChanged()},WPGMZA.OLMap.prototype.getBounds=function(){var bounds=this.olMap.getView().calculateExtent(this.olMap.getSize()),topLeft=ol.proj.toLonLat([bounds[0],bounds[1]]),bottomRight=ol.proj.toLonLat([bounds[2],bounds[3]]);return{topLeft:{lat:topLeft[1],lng:topLeft[0]},bottomRight:{lat:bottomRight[1],lng:bottomRight[0]}}},WPGMZA.OLMap.prototype.fitBounds=function(southWest,northEast){this.olMap.getView().fitExtent([southWest.lng,southWest.lat,northEast.lng,northEast.lat],this.olMap.getSize())},WPGMZA.OLMap.prototype.panTo=function(latLng){this.olMap.getView().animate({center:ol.proj.fromLonLat([parseFloat(latLng.lng),parseFloat(latLng.lat)]),duration:500})},WPGMZA.OLMap.prototype.getZoom=function(){return Math.round(this.olMap.getView().getZoom())+1},WPGMZA.OLMap.prototype.setZoom=function(value){this.olMap.getView().setZoom(value)},WPGMZA.OLMap.prototype.getMinZoom=function(){return this.olMap.getView().getMinZoom()},WPGMZA.OLMap.prototype.setMinZoom=function(value){this.olMap.getView().setMinZoom(value)},WPGMZA.OLMap.prototype.getMaxZoom=function(){return this.olMap.getView().getMaxZoom()},WPGMZA.OLMap.prototype.setMaxZoom=function(value){this.olMap.getView().setMaxZoom(value)},WPGMZA.OLMap.prototype.setOptions=function(options){Parent.prototype.setOptions.call(this,options),this.olMap&&this.olMap.getView().setProperties(this.settings.toOLViewOptions())},WPGMZA.OLMap.prototype.addMarker=function(marker){this.olMap.addOverlay(marker.overlay),Parent.prototype.addMarker.call(this,marker)},WPGMZA.OLMap.prototype.removeMarker=function(marker){this.olMap.removeOverlay(marker.overlay),Parent.prototype.removeMarker.call(this,marker)},WPGMZA.OLMap.prototype.addPolygon=function(polygon){this.olMap.addLayer(polygon.layer),Parent.prototype.addPolygon.call(this,polygon)},WPGMZA.OLMap.prototype.removePolygon=function(polygon){this.olMap.removeLayer(polygon.layer),Parent.prototype.removePolygon.call(this,polygon)},WPGMZA.OLMap.prototype.addPolyline=function(polyline){this.olMap.addLayer(polyline.layer),Parent.prototype.addPolyline.call(this,polyline)},WPGMZA.OLMap.prototype.removePolyline=function(polyline){this.olMap.removeLayer(polyline.layer),Parent.prototype.removePolyline.call(this,polyline)},WPGMZA.OLMap.prototype.addCircle=function(circle){this.olMap.addLayer(circle.layer),Parent.prototype.addCircle.call(this,circle)},WPGMZA.OLMap.prototype.removeCircle=function(circle){this.olMap.removeLayer(circle.layer),Parent.prototype.removeCircle.call(this,circle)},WPGMZA.OLMap.prototype.pixelsToLatLng=function(x,y){null==y&&("x"in x&&"y"in x?(y=x.y,x=x.x):console.warn("Y coordinate undefined in pixelsToLatLng (did you mean to pass 2 arguments?)"));var coord=this.olMap.getCoordinateFromPixel([x,y]);if(!coord)return{x:null,y:null};var lonLat=ol.proj.toLonLat(coord);return{lat:lonLat[1],lng:lonLat[0]}},WPGMZA.OLMap.prototype.latLngToPixels=function(latLng){var coord=ol.proj.fromLonLat([latLng.lng,latLng.lat]),pixel=this.olMap.getPixelFromCoordinate(coord);return pixel?{x:pixel[0],y:pixel[1]}:{x:null,y:null}},WPGMZA.OLMap.prototype.enableBicycleLayer=function(value){if(value)this.bicycleLayer||(this.bicycleLayer=new ol.layer.Tile({source:new ol.source.OSM({url:"http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png"})})),this.olMap.addLayer(this.bicycleLayer);else{if(!this.bicycleLayer)return;this.olMap.removeLayer(this.bicycleLayer)}},WPGMZA.OLMap.prototype.onElementResized=function(event){this.olMap.updateSize()},WPGMZA.OLMap.prototype.onRightClick=function(event){if($(event.target).closest(".ol-marker, .wpgmza_modern_infowindow, .wpgmza-modern-store-locator").length)return!0;var parentOffset=$(this.element).offset(),relX=event.pageX-parentOffset.left,relY=event.pageY-parentOffset.top,latLng=this.pixelsToLatLng(relX,relY);return this.trigger({type:"rightclick",latLng:latLng}),$(this.element).trigger({type:"rightclick",latLng:latLng}),event.preventDefault(),!1}}),jQuery(function($){var Parent;WPGMZA.OLMarker=function(row){var self=this;Parent.call(this,row);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.element=$("<div class='ol-marker'><img src='"+WPGMZA.settings.default_marker_icon+"'/></div>")[0],this.element.wpgmzaMarker=this,$(this.element).on("mouseover",function(event){self.dispatchEvent("mouseover")}),this.overlay=new ol.Overlay({element:this.element}),this.overlay.setPosition(origin),this.animation&&this.setAnimation(this.animation),this.setLabel(this.settings.label),row&&row.draggable&&this.setDraggable(!0),this.rebindClickListener(),this.trigger("init")},Parent=WPGMZA.isProVersion()?WPGMZA.ProMarker:WPGMZA.Marker,WPGMZA.OLMarker.prototype=Object.create(Parent.prototype),WPGMZA.OLMarker.prototype.constructor=WPGMZA.OLMarker,WPGMZA.OLMarker.prototype.addLabel=function(){this.setLabel(this.getLabelText())},WPGMZA.OLMarker.prototype.setLabel=function(label){label?(this.label||(this.label=$("<div class='ol-marker-label'/>"),$(this.element).append(this.label)),this.label.html(label)):this.label&&$(this.element).find(".ol-marker-label").remove()},WPGMZA.OLMarker.prototype.setVisible=function(visible){Parent.prototype.setVisible(visible),this.overlay.getElement().style.display=visible?"block":"none"},WPGMZA.OLMarker.prototype.setPosition=function(latLng){Parent.prototype.setPosition.call(this,latLng);var origin=ol.proj.fromLonLat([parseFloat(this.lng),parseFloat(this.lat)]);this.overlay.setPosition(origin)},WPGMZA.OLMarker.prototype.setOffset=function(x,y){this.element.style.position="relative",this.element.style.left=x+"px",this.element.style.top=y+"px"},WPGMZA.OLMarker.prototype.setAnimation=function(anim){switch(Parent.prototype.setAnimation.call(this,anim),anim){case WPGMZA.Marker.ANIMATION_NONE:$(this.element).removeAttr("data-anim");break;case WPGMZA.Marker.ANIMATION_BOUNCE:$(this.element).attr("data-anim","bounce");break;case WPGMZA.Marker.ANIMATION_DROP:$(this.element).attr("data-anim","drop")}},WPGMZA.OLMarker.prototype.setDraggable=function(draggable){var self=this;if(draggable){var options={disabled:!1};this.jQueryDraggableInitialized||(options.start=function(event){self.onDragStart(event)},options.stop=function(event){self.onDragEnd(event)}),$(this.element).draggable(options),this.jQueryDraggableInitialized=!0,this.rebindClickListener()}else $(this.element).draggable({disabled:!0})},WPGMZA.OLMarker.prototype.onDragStart=function(event){this.isBeingDragged=!0},WPGMZA.OLMarker.prototype.onDragEnd=function(event){var offset_top=parseFloat($(this.element).css("top").match(/-?\d+/)[0]),offset_left=parseFloat($(this.element).css("left").match(/-?\d+/)[0]);$(this.element).css({top:"0px",left:"0px"});var currentLatLng=this.getPosition(),pixelsBeforeDrag=this.map.latLngToPixels(currentLatLng),pixelsAfterDrag={x:pixelsBeforeDrag.x+offset_left,y:pixelsBeforeDrag.y+offset_top},latLngAfterDrag=this.map.pixelsToLatLng(pixelsAfterDrag);this.setPosition(latLngAfterDrag),this.isBeingDragged=!1,this.trigger({type:"dragend",latLng:latLngAfterDrag})},WPGMZA.OLMarker.prototype.onElementClick=function(event){var self=event.currentTarget.wpgmzaMarker;self.isBeingDragged||(self.dispatchEvent("click"),self.dispatchEvent("select"))},WPGMZA.OLMarker.prototype.rebindClickListener=function(){$(this.element).off("click",this.onElementClick),$(this.element).on("click",this.onElementClick)}}),jQuery(function($){WPGMZA.OLModernStoreLocatorCircle=function(map,settings){WPGMZA.ModernStoreLocatorCircle.call(this,map,settings)},WPGMZA.OLModernStoreLocatorCircle.prototype=Object.create(WPGMZA.ModernStoreLocatorCircle.prototype),WPGMZA.OLModernStoreLocatorCircle.prototype.constructor=WPGMZA.OLModernStoreLocatorCircle,WPGMZA.OLModernStoreLocatorCircle.prototype.initCanvasLayer=function(){var self=this,mapElement=$(this.map.element),olViewportElement=mapElement.children(".ol-viewport");this.canvas=document.createElement("canvas"),this.canvas.className="wpgmza-ol-canvas-overlay",mapElement.append(this.canvas),this.renderFunction=function(event){self.canvas.width==olViewportElement.width()&&self.canvas.height==olViewportElement.height()||(self.canvas.width=olViewportElement.width(),self.canvas.height=olViewportElement.height(),$(this.canvas).css({width:olViewportElement.width()+"px",height:olViewportElement.height()+"px"})),self.draw()},this.map.olMap.on("postrender",this.renderFunction)},WPGMZA.OLModernStoreLocatorCircle.prototype.getContext=function(type){return this.canvas.getContext(type)},WPGMZA.OLModernStoreLocatorCircle.prototype.getCanvasDimensions=function(){return{width:this.canvas.width,height:this.canvas.height}},WPGMZA.OLModernStoreLocatorCircle.prototype.getCenterPixels=function(){return this.map.latLngToPixels(this.settings.center)},WPGMZA.OLModernStoreLocatorCircle.prototype.getWorldOriginOffset=function(){return{x:0,y:0}},WPGMZA.OLModernStoreLocatorCircle.prototype.getTransformedRadius=function(km){var center=new WPGMZA.LatLng(this.settings.center),outer=new WPGMZA.LatLng(center);outer.moveByDistance(km,90);var centerPixels=this.map.latLngToPixels(center),outerPixels=this.map.latLngToPixels(outer);return Math.abs(outerPixels.x-centerPixels.x)},WPGMZA.OLModernStoreLocatorCircle.prototype.getScale=function(){return 1},WPGMZA.OLModernStoreLocatorCircle.prototype.destroy=function(){$(this.canvas).remove(),this.map.olMap.un("postrender",this.renderFunction),this.map=null,this.canvas=null}}),jQuery(function($){WPGMZA.OLModernStoreLocator=function(map_id){WPGMZA.ModernStoreLocator.call(this,map_id),(WPGMZA.isProVersion()?$(".wpgmza_map[data-map-id='"+map_id+"']"):$("#wpgmza_map")).append(this.element)},WPGMZA.OLModernStoreLocator.prototype=Object.create(WPGMZA.ModernStoreLocator),WPGMZA.OLModernStoreLocator.prototype.constructor=WPGMZA.OLModernStoreLocator}),jQuery(function($){var Parent;WPGMZA.OLPolygon=function(row,olFeature){if(Parent.call(this,row,olFeature),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[[]];if(row&&row.points){for(var paths=this.parseGeometry(row.points),i=0;i<paths.length;i++)coordinates[0].push(ol.proj.fromLonLat([parseFloat(paths[i].lng),parseFloat(paths[i].lat)]));this.olStyle=new ol.style.Style(this.getStyleFromSettings())}this.olFeature=new ol.Feature({geometry:new ol.geom.Polygon(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolygon:this})},Parent=WPGMZA.isProVersion()?WPGMZA.ProPolygon:WPGMZA.Polygon,WPGMZA.OLPolygon.prototype=Object.create(Parent.prototype),WPGMZA.OLPolygon.prototype.constructor=WPGMZA.OLPolygon,WPGMZA.OLPolygon.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity)})),this.settings.fillOpacity&&(params.fill=new ol.style.Fill({color:WPGMZA.hexOpacityToRGBA(this.settings.fillColor,this.settings.fillOpacity)})),params},WPGMZA.OLPolygon.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolygon.prototype.setEditable=function(editable){},WPGMZA.OLPolygon.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates()[0];result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}}),jQuery(function($){var Parent;WPGMZA.OLPolyline=function(row,olFeature){if(WPGMZA.Polyline.call(this,row),this.olStyle=new ol.style.Style,olFeature)this.olFeature=olFeature;else{var coordinates=[];if(row&&row.points)for(var path=this.parseGeometry(row.points),i=0;i<path.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(path[i].lng),parseFloat(path[i].lat)]));var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)})}this.layer=new ol.layer.Vector({source:new ol.source.Vector({features:[this.olFeature]}),style:this.olStyle}),this.layer.getSource().getFeatures()[0].setProperties({wpgmzaPolyling:this})},Parent=WPGMZA.Polyline,WPGMZA.OLPolyline.prototype=Object.create(Parent.prototype),WPGMZA.OLPolyline.prototype.constructor=WPGMZA.OLPolyline,WPGMZA.OLPolyline.prototype.getStyleFromSettings=function(){var params={};return this.settings.strokeOpacity&&(params.stroke=new ol.style.Stroke({color:WPGMZA.hexOpacityToRGBA(this.settings.strokeColor,this.settings.strokeOpacity),width:parseInt(this.settings.strokeWeight)})),params},WPGMZA.OLPolyline.prototype.updateStyleFromSettings=function(){var params=this.getStyleFromSettings();this.olStyle=new ol.style.Style(params),this.layer.setStyle(this.olStyle)},WPGMZA.OLPolyline.prototype.setEditable=function(editable){},WPGMZA.OLPolyline.prototype.setPoints=function(points){this.olFeature&&this.layer.getSource().removeFeature(this.olFeature);for(var coordinates=[],i=0;i<points.length;i++)coordinates.push(ol.proj.fromLonLat([parseFloat(points[i].lng),parseFloat(points[i].lat)]));this.olFeature=new ol.Feature({geometry:new ol.geom.LineString(coordinates)}),this.layer.getSource().addFeature(this.olFeature)},WPGMZA.OLPolyline.prototype.toJSON=function(){var result=Parent.prototype.toJSON.call(this),coordinates=this.olFeature.getGeometry().getCoordinates();result.points=[];for(var i=0;i<coordinates.length;i++){var lonLat=ol.proj.toLonLat(coordinates[i]),latLng={lat:lonLat[1],lng:lonLat[0]};result.points.push(latLng)}return result}});
|
js/wpgmaps.js
CHANGED
@@ -261,6 +261,10 @@ MYMAP.init = function(selector, latLng, zoom) {
|
|
261 |
|
262 |
var element = jQuery(selector)[0];
|
263 |
|
|
|
|
|
|
|
|
|
264 |
element.setAttribute("data-map-id", 1);
|
265 |
element.setAttribute("data-maps-engine", WPGMZA.settings.engine);
|
266 |
this.map = WPGMZA.Map.createInstance(element, myOptions);
|
@@ -385,13 +389,7 @@ function wpgmza_show_store_locator_radius(map_id, center, radius, distance_type)
|
|
385 |
|
386 |
// Force legacy style on iOS, it appears CanvasLayer crashes some iOS devices
|
387 |
if(WPGMZA.isDeviceiOS())
|
388 |
-
{
|
389 |
style = "legacy";
|
390 |
-
|
391 |
-
// Workaround for legacy settings not saved when modern style selected
|
392 |
-
options.fillOpacity = 0.15;
|
393 |
-
options.fillColor = "#ff0000";
|
394 |
-
}
|
395 |
|
396 |
switch(style)
|
397 |
{
|
@@ -611,6 +609,10 @@ MYMAP.placeMarkers = function(filename,map_id,radius,searched_center,distance_ty
|
|
611 |
lat: parseFloat(lat),
|
612 |
lng: parseFloat(lng)
|
613 |
};
|
|
|
|
|
|
|
|
|
614 |
|
615 |
MYMAP.bounds.extend(point);
|
616 |
|
261 |
|
262 |
var element = jQuery(selector)[0];
|
263 |
|
264 |
+
// DIVI compatibility fix
|
265 |
+
if(!element)
|
266 |
+
return;
|
267 |
+
|
268 |
element.setAttribute("data-map-id", 1);
|
269 |
element.setAttribute("data-maps-engine", WPGMZA.settings.engine);
|
270 |
this.map = WPGMZA.Map.createInstance(element, myOptions);
|
389 |
|
390 |
// Force legacy style on iOS, it appears CanvasLayer crashes some iOS devices
|
391 |
if(WPGMZA.isDeviceiOS())
|
|
|
392 |
style = "legacy";
|
|
|
|
|
|
|
|
|
|
|
393 |
|
394 |
switch(style)
|
395 |
{
|
609 |
lat: parseFloat(lat),
|
610 |
lng: parseFloat(lng)
|
611 |
};
|
612 |
+
|
613 |
+
// Prevent JS error in Gutenberg editor (Temporary fix)
|
614 |
+
if(WPGMZA.is_admin == "1")
|
615 |
+
return;
|
616 |
|
617 |
MYMAP.bounds.extend(point);
|
618 |
|
readme.txt
CHANGED
@@ -216,6 +216,23 @@ Please upgrade your version of WP Google Maps to version 6.0.27 as it includes m
|
|
216 |
|
217 |
== Changelog ==
|
218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
= 7.10.36 :- 2018-09-25 :- Medium Priority =
|
220 |
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
221 |
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
216 |
|
217 |
== Changelog ==
|
218 |
|
219 |
+
= 7.10.39 :- 2018-10-15 :- High priority =
|
220 |
+
* Fixed JS error when Gutenberg framework not loaded
|
221 |
+
|
222 |
+
= 7.10.38 :- 2018-10-15 :- Medium priority =
|
223 |
+
* Added factory class
|
224 |
+
* Added DIVI compatibility fix
|
225 |
+
* Added new table name constants
|
226 |
+
* Modules added to pave the way for Gutenberg integration
|
227 |
+
* Adjusted script loader to support external dependencies
|
228 |
+
* Fixed trailing slash breaking rest API routes on some setups
|
229 |
+
* Fixed wpgmza_basic_get_admin_path causing URL wrapper not supported
|
230 |
+
*
|
231 |
+
= 7.10.37 :- 2018-09-27 :- Medium priority =
|
232 |
+
* Fixed undefined variable on iOS breaking store locator
|
233 |
+
* Fixed edit marker using REST API not working when API route has two slashes
|
234 |
+
* Fixed map not appearing with particular versions of dataTables where the packaged version is not used
|
235 |
+
|
236 |
= 7.10.36 :- 2018-09-25 :- Medium Priority =
|
237 |
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
238 |
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
wpGoogleMaps.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
-
Version: 7.10.
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
@@ -11,6 +11,23 @@ Domain Path: /languages
|
|
11 |
*/
|
12 |
|
13 |
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
* 7.10.36 :- 2018-09-25 :- Medium Priority
|
15 |
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
16 |
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
@@ -599,13 +616,13 @@ $debug = false;
|
|
599 |
$debug_step = 0;
|
600 |
$wpgmza_p = false;
|
601 |
$wpgmza_g = false;
|
602 |
-
$wpgmza_tblname = $wpdb->prefix . "wpgmza";
|
603 |
-
$wpgmza_tblname_maps = $wpdb->prefix . "wpgmza_maps";
|
604 |
-
$wpgmza_tblname_poly = $wpdb->prefix . "wpgmza_polygon";
|
605 |
-
$wpgmza_tblname_polylines = $wpdb->prefix . "wpgmza_polylines";
|
606 |
-
$wpgmza_tblname_circles = $wpdb->prefix . "wpgmza_circles";
|
607 |
-
$wpgmza_tblname_rectangles = $wpdb->prefix . "wpgmza_rectangles";
|
608 |
-
$wpgmza_tblname_categories = $wpdb->prefix. "wpgmza_categories";
|
609 |
$wpgmza_tblname_category_maps = $wpdb->prefix. "wpgmza_category_maps";
|
610 |
|
611 |
$subject = file_get_contents(__FILE__);
|
@@ -8680,6 +8697,11 @@ if(!function_exists('wpgmza_get_rectangle_data'))
|
|
8680 |
// Get admin path
|
8681 |
function wpgmza_basic_get_admin_path()
|
8682 |
{
|
|
|
|
|
|
|
|
|
|
|
8683 |
return $admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() );
|
8684 |
}
|
8685 |
|
3 |
Plugin Name: WP Google Maps
|
4 |
Plugin URI: https://www.wpgmaps.com
|
5 |
Description: The easiest to use Google Maps plugin! Create custom Google Maps with high quality markers containing locations, descriptions, images and links. Add your customized map to your WordPress posts and/or pages quickly and easily with the supplied shortcode. No fuss.
|
6 |
+
Version: 7.10.39
|
7 |
Author: WP Google Maps
|
8 |
Author URI: https://www.wpgmaps.com
|
9 |
Text Domain: wp-google-maps
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
* 7.10.39 :- 2018-10-15 :- High priority
|
15 |
+
* Fixed JS error when Gutenberg framework not loaded
|
16 |
+
*
|
17 |
+
* 7.10.38 :- 2018-10-15 :- Medium priority
|
18 |
+
* Added factory class
|
19 |
+
* Added DIVI compatibility fix
|
20 |
+
* Added new table name constants
|
21 |
+
* Modules added to pave the way for Gutenberg integration
|
22 |
+
* Adjusted script loader to support external dependencies
|
23 |
+
* Fixed trailing slash breaking rest API routes on some setups
|
24 |
+
* Fixed wpgmza_basic_get_admin_path causing URL wrapper not supported
|
25 |
+
*
|
26 |
+
* 7.10.37 :- 2018-09-27 :- Medium priority
|
27 |
+
* Fixed undefined variable on iOS breaking store locator
|
28 |
+
* Fixed edit marker using REST API not working when API route has two slashes
|
29 |
+
* Fixed map not appearing with particular versions of dataTables where the packaged version is not used
|
30 |
+
*
|
31 |
* 7.10.36 :- 2018-09-25 :- Medium Priority
|
32 |
* Fixed change in 7.10.35 causing problems with OLMarker click event, preventing infowindow opening
|
33 |
* Dropped .gitignore which was causing deployment issues, now using .gitattributes to ignore minified files
|
616 |
$debug_step = 0;
|
617 |
$wpgmza_p = false;
|
618 |
$wpgmza_g = false;
|
619 |
+
$WPGMZA_TABLE_NAME_MARKERS = $wpgmza_tblname = $wpdb->prefix . "wpgmza";
|
620 |
+
$WPGMZA_TABLE_NAME_MAPS = $wpgmza_tblname_maps = $wpdb->prefix . "wpgmza_maps";
|
621 |
+
$WPGMZA_TABLE_NAME_POLYGONS = $wpgmza_tblname_poly = $wpdb->prefix . "wpgmza_polygon";
|
622 |
+
$WPGMZA_TABLE_NAME_POLYLINES = $wpgmza_tblname_polylines = $wpdb->prefix . "wpgmza_polylines";
|
623 |
+
$WPGMZA_TABLE_NAME_CIRCLES = $wpgmza_tblname_circles = $wpdb->prefix . "wpgmza_circles";
|
624 |
+
$WPGMZA_TABLE_NAME_RECTANGLES = $wpgmza_tblname_rectangles = $wpdb->prefix . "wpgmza_rectangles";
|
625 |
+
$WPGMZA_TABLE_NAME_CATEGORIES = $wpgmza_tblname_categories = $wpdb->prefix. "wpgmza_categories";
|
626 |
$wpgmza_tblname_category_maps = $wpdb->prefix. "wpgmza_category_maps";
|
627 |
|
628 |
$subject = file_get_contents(__FILE__);
|
8697 |
// Get admin path
|
8698 |
function wpgmza_basic_get_admin_path()
|
8699 |
{
|
8700 |
+
$default = ABSPATH . 'wp-admin/';
|
8701 |
+
|
8702 |
+
if(file_exists($default))
|
8703 |
+
return $default;
|
8704 |
+
|
8705 |
return $admin_path = str_replace( get_bloginfo( 'url' ) . '/', ABSPATH, get_admin_url() );
|
8706 |
}
|
8707 |
|