@appbaseio/reactivesearch-vue 1.29.0 → 2.0.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +11162 -762
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +21 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-e0b7c1f6.js → Button-446f819e.js} +1 -1
  6. package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-9f258f4f.js} +1 -1
  7. package/dist/cjs/{Card-fd94ef07.js → Card-642547a8.js} +2 -2
  8. package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-ad3dad02.js} +2 -2
  9. package/dist/cjs/{Container-526efa6a.js → Container-daf30918.js} +1 -1
  10. package/dist/cjs/{DataSearch-eec21890.js → DataSearch-6cf29cf0.js} +236 -84
  11. package/dist/cjs/DataSearch.js +10 -10
  12. package/dist/cjs/{DropDown-e4381fcc.js → DropDown-c479bbb0.js} +5 -5
  13. package/dist/cjs/DynamicRangeSlider.js +8 -7
  14. package/dist/cjs/{Flex-f146cdad.js → Flex-aa517a13.js} +1 -1
  15. package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-c195a592.js} +1 -1
  16. package/dist/cjs/{Input-0d7b25ad.js → Input-e6603a7e.js} +1 -1
  17. package/dist/cjs/{ListItem-b40adb04.js → ListItem-8c9e0d68.js} +2 -2
  18. package/dist/cjs/MultiDropdownList.js +13 -12
  19. package/dist/cjs/MultiList.js +11 -10
  20. package/dist/cjs/MultiRange.js +9 -8
  21. package/dist/cjs/Pagination-71e85fa9.js +182 -0
  22. package/dist/cjs/RangeInput.js +11 -10
  23. package/dist/cjs/RangeSlider.js +9 -8
  24. package/dist/cjs/ReactiveBase.js +69 -35
  25. package/dist/cjs/ReactiveComponent.js +6 -5
  26. package/dist/cjs/ReactiveGoogleMap.js +2336 -0
  27. package/dist/cjs/ReactiveList.js +22 -185
  28. package/dist/cjs/ResultCard.js +4 -4
  29. package/dist/cjs/ResultList.js +4 -4
  30. package/dist/cjs/SelectedFilters.js +45 -28
  31. package/dist/cjs/SingleDropdownList.js +13 -12
  32. package/dist/cjs/SingleList.js +11 -10
  33. package/dist/cjs/SingleRange.js +10 -9
  34. package/dist/cjs/StateProvider.js +30 -5
  35. package/dist/cjs/{Title-584a8cc8.js → Title-1de7d0f4.js} +1 -1
  36. package/dist/cjs/ToggleButton.js +10 -8
  37. package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-c705cbe6.js} +17 -2
  38. package/dist/cjs/{index-4509aa45.js → index-6a167fe0.js} +13 -1
  39. package/dist/cjs/index.js +24 -18
  40. package/dist/cjs/initReactivesearch.js +40 -8
  41. package/dist/cjs/{install-4886582d.js → install-99716d95.js} +252 -87
  42. package/dist/cjs/install.js +20 -18
  43. package/dist/cjs/{ssr-0ee35a09.js → ssr-3027b848.js} +1 -1
  44. package/dist/cjs/{utils-1219e1fe.js → utils-d6a52588.js} +1 -1
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-727b7c63.js} +30 -13
  47. package/dist/es/{Button-33de88e6.js → Button-d8bc15ea.js} +1 -1
  48. package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4cfae5fd.js} +1 -1
  49. package/dist/es/{Card-6446f1b7.js → Card-450683f1.js} +2 -2
  50. package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-424e86fd.js} +2 -2
  51. package/dist/es/{Container-18b03fde.js → Container-ba826e96.js} +1 -1
  52. package/dist/es/{DataSearch-42f547cd.js → DataSearch-4888aa43.js} +236 -86
  53. package/dist/es/DataSearch.js +10 -10
  54. package/dist/es/{DropDown-ff6ad982.js → DropDown-05a644a5.js} +5 -5
  55. package/dist/es/DynamicRangeSlider.js +8 -7
  56. package/dist/es/{Flex-8770345d.js → Flex-1f0795c3.js} +1 -1
  57. package/dist/es/{FormControlList-704f8dee.js → FormControlList-c22d64f6.js} +1 -1
  58. package/dist/es/{Input-e339e63a.js → Input-7a2a9fac.js} +1 -1
  59. package/dist/es/{ListItem-8e8fb535.js → ListItem-cad14c5e.js} +2 -2
  60. package/dist/es/MultiDropdownList.js +13 -12
  61. package/dist/es/MultiList.js +11 -10
  62. package/dist/es/MultiRange.js +9 -8
  63. package/dist/es/Pagination-784bf143.js +177 -0
  64. package/dist/es/RangeInput.js +11 -10
  65. package/dist/es/RangeSlider.js +9 -8
  66. package/dist/es/ReactiveBase.js +70 -36
  67. package/dist/es/ReactiveComponent.js +6 -5
  68. package/dist/es/ReactiveGoogleMap.js +2327 -0
  69. package/dist/es/ReactiveList.js +21 -184
  70. package/dist/es/ResultCard.js +4 -4
  71. package/dist/es/ResultList.js +4 -4
  72. package/dist/es/SelectedFilters.js +45 -28
  73. package/dist/es/SingleDropdownList.js +13 -12
  74. package/dist/es/SingleList.js +11 -10
  75. package/dist/es/SingleRange.js +10 -9
  76. package/dist/es/StateProvider.js +30 -5
  77. package/dist/es/{Title-3522ff56.js → Title-3342664a.js} +1 -1
  78. package/dist/es/ToggleButton.js +10 -8
  79. package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-76660dab.js} +17 -3
  80. package/dist/es/{index-78920565.js → index-7788a843.js} +13 -2
  81. package/dist/es/index.js +24 -19
  82. package/dist/es/initReactivesearch.js +41 -9
  83. package/dist/es/{install-54ebd72e.js → install-87984085.js} +252 -87
  84. package/dist/es/install.js +20 -18
  85. package/dist/es/{ssr-a41dfea9.js → ssr-b2c0b401.js} +1 -1
  86. package/dist/es/{utils-64a2e5f0.js → utils-9e68acee.js} +1 -1
  87. package/dist/es/version.js +1 -1
  88. package/dist/es/{vueTypes-687b2304.js → vueTypes-b8146772.js} +30 -13
  89. package/package.json +11 -5
@@ -0,0 +1,2336 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var configureStore = require('@appbaseio/reactivecore');
8
+ var configureStore__default = _interopDefault(configureStore);
9
+ var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
10
+ var VueTypes = _interopDefault(require('vue-types'));
11
+ var constants = require('@appbaseio/reactivecore/lib/utils/constants');
12
+ require('emotion');
13
+ var styled = require('@appbaseio/vue-emotion');
14
+ var styled__default = _interopDefault(styled);
15
+ require('polished');
16
+ require('./Button-446f819e.js');
17
+ var vueTypes = require('./vueTypes-727b7c63.js');
18
+ var Pagination = require('./Pagination-71e85fa9.js');
19
+ require('@appbaseio/reactivecore/lib/utils/transform');
20
+ require('redux');
21
+ var index = require('./index-6a167fe0.js');
22
+ var ComponentWrapper = require('./ComponentWrapper-ad3dad02.js');
23
+ var _mergeJSXProps = _interopDefault(require('@vue/babel-helper-vue-jsx-merge-props'));
24
+ var FormControlList = require('./FormControlList-c195a592.js');
25
+ var GmapVue = require('gmap-vue');
26
+ var GmapVue__default = _interopDefault(GmapVue);
27
+ var geohash = _interopDefault(require('ngeohash'));
28
+
29
+ var setStreaming = configureStore.Actions.setStreaming,
30
+ setQueryOptions = configureStore.Actions.setQueryOptions,
31
+ updateQuery = configureStore.Actions.updateQuery,
32
+ loadMore = configureStore.Actions.loadMore,
33
+ setValue = configureStore.Actions.setValue,
34
+ updateComponentProps = configureStore.Actions.updateComponentProps,
35
+ setDefaultQuery = configureStore.Actions.setDefaultQuery,
36
+ recordResultClick = configureStore.Actions.recordResultClick,
37
+ setMapData = configureStore.Actions.setMapData;
38
+ var isEqual = configureStore.helper.isEqual,
39
+ getQueryOptions = configureStore.helper.getQueryOptions,
40
+ getClassName = configureStore.helper.getClassName,
41
+ parseHits = configureStore.helper.parseHits,
42
+ getOptionsFromQuery = configureStore.helper.getOptionsFromQuery,
43
+ getResultStats = configureStore.helper.getResultStats; // default map center
44
+
45
+ var MAP_CENTER = {
46
+ lat: 37.7749,
47
+ lng: 122.4194
48
+ };
49
+ var style = {
50
+ width: '100%',
51
+ height: '100vh',
52
+ position: 'relative'
53
+ };
54
+
55
+ function getPrecision(a) {
56
+ if (isNaN(a)) return 0; // eslint-disable-line
57
+
58
+ var e = 1;
59
+ var p = 0;
60
+
61
+ while (Math.round(a * e) / e !== a) {
62
+ e *= 10;
63
+ p += 1;
64
+ }
65
+
66
+ return p;
67
+ }
68
+
69
+ function withDistinctLat(loc, count) {
70
+ var length = getPrecision(loc.lat);
71
+ var noiseFactor = length >= 6 ? 4 : length - 2; // eslint-disable-next-line
72
+
73
+ var suffix = 1 / Math.pow(10, noiseFactor) * count;
74
+
75
+ var location = _rollupPluginBabelHelpers._extends({}, loc, {
76
+ lat: parseFloat((loc.lat + suffix).toFixed(length))
77
+ });
78
+
79
+ return location;
80
+ }
81
+
82
+ function getLocationObject(location) {
83
+ var resultType = Array.isArray(location) ? 'array' : typeof location;
84
+
85
+ switch (resultType) {
86
+ case 'string':
87
+ {
88
+ if (location.indexOf(',') > -1) {
89
+ var locationSplit = location.split(',');
90
+ return {
91
+ lat: parseFloat(locationSplit[0]),
92
+ lng: parseFloat(locationSplit[1])
93
+ };
94
+ }
95
+
96
+ var locationDecode = geohash.decode(location);
97
+ return {
98
+ lat: locationDecode.latitude,
99
+ lng: locationDecode.longitude
100
+ };
101
+ }
102
+
103
+ case 'array':
104
+ {
105
+ return {
106
+ lat: location[1],
107
+ lng: location[0]
108
+ };
109
+ }
110
+
111
+ default:
112
+ {
113
+ return location;
114
+ }
115
+ }
116
+ }
117
+
118
+ var ReactiveMap = {
119
+ name: 'ReactiveMap',
120
+ props: {
121
+ className: vueTypes.types.string,
122
+ componentId: vueTypes.types.stringRequired,
123
+ dataField: vueTypes.types.stringRequired,
124
+ react: vueTypes.types.react,
125
+ size: vueTypes.types.number,
126
+ sortBy: vueTypes.types.sortBy,
127
+ URLParams: VueTypes.bool,
128
+ autoCenter: VueTypes.bool,
129
+ getMapRef: VueTypes.func.isRequired,
130
+ center: vueTypes.types.location,
131
+ defaultCenter: vueTypes.types.location,
132
+ defaultPin: vueTypes.types.string,
133
+ defaultZoom: VueTypes.number.def(13),
134
+ defaultQuery: vueTypes.types.func,
135
+ innerClass: vueTypes.types.style,
136
+ loader: vueTypes.types.title,
137
+ render: vueTypes.types.func,
138
+ renderItem: vueTypes.types.func,
139
+ renderError: vueTypes.types.title,
140
+ pages: VueTypes.number.def(5),
141
+ currentPage: VueTypes.number.def(0),
142
+ pagination: VueTypes.bool,
143
+ showMarkers: VueTypes.bool,
144
+ defaultSearchAsMove: VueTypes.bool,
145
+ showSearchAsMove: VueTypes.bool,
146
+ defaultRadius: vueTypes.types.number,
147
+ unit: vueTypes.types.string,
148
+ autoClosePopover: VueTypes.bool,
149
+ renderMap: VueTypes.func.isRequired,
150
+ renderPopover: VueTypes.func,
151
+ calculateMarkers: VueTypes.func,
152
+ searchAsMoveLabel: VueTypes.string.def('Search as I move the map')
153
+ },
154
+ preserveCenter: false,
155
+ data: function data() {
156
+ var props = this.$props;
157
+ var currentPageState = 0;
158
+
159
+ if (props.currentPage) {
160
+ currentPageState = Math.max(props.currentPage - 1, 0);
161
+ }
162
+
163
+ this.__state = {
164
+ from: currentPageState * props.size,
165
+ zoom: props.defaultZoom,
166
+ searchAsMove: props.defaultSearchAsMove,
167
+ currentPageState: currentPageState,
168
+ mapBoxBounds: null,
169
+ markersData: null
170
+ };
171
+ return this.__state;
172
+ },
173
+ computed: {
174
+ totalPages: function totalPages() {
175
+ return Math.ceil(this.total / this.$props.size) || 0;
176
+ },
177
+ stats: function stats() {
178
+ var _this$getAllData = this.getAllData(),
179
+ resultsToRender = _this$getAllData.resultsToRender;
180
+
181
+ return _rollupPluginBabelHelpers._extends({}, getResultStats(this), {
182
+ currentPage: this.currentPageState,
183
+ displayedResults: resultsToRender.length
184
+ });
185
+ },
186
+ hasCustomRender: function hasCustomRender() {
187
+ return index.hasCustomRenderer(this);
188
+ }
189
+ },
190
+ watch: {
191
+ defaultZoom: function defaultZoom(newVal) {
192
+ this.zoom = newVal;
193
+ },
194
+ currentPage: function currentPage(newVal, oldVal) {
195
+ if (oldVal !== newVal && newVal > 0 && newVal <= this.totalPages) {
196
+ this.setPage(newVal - 1);
197
+ }
198
+ },
199
+ defaultQuery: function defaultQuery(newVal, oldVal) {
200
+ if (!index.isQueryIdentical(newVal, oldVal, null, this.$props)) {
201
+ var options = getQueryOptions(this.$props);
202
+ options.from = 0;
203
+ this.$defaultQuery = newVal(null, this.$props);
204
+
205
+ var _ref = this.$defaultQuery || {},
206
+ sort = _ref.sort,
207
+ query = _ref.query;
208
+
209
+ if (sort) {
210
+ options.sort = this.$defaultQuery.sort;
211
+ }
212
+
213
+ var queryOptions = getOptionsFromQuery(this.$defaultQuery);
214
+
215
+ if (queryOptions) {
216
+ options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery));
217
+ } // Update calculated default query in store
218
+
219
+
220
+ this.setQueryOptions(this.$props.componentId, options, false);
221
+ var persistMapQuery = true;
222
+ var forceExecute = true; // Update default query to include the geo bounding box query
223
+
224
+ this.setDefaultQueryForRSAPI();
225
+ var meta = {
226
+ mapBoxBounds: this.mapBoxBounds
227
+ };
228
+ this.setMapData(this.componentId, query, persistMapQuery, forceExecute, meta);
229
+ this.currentPageState = 0;
230
+ this.from = 0;
231
+ }
232
+ },
233
+ promotedResults: function promotedResults(newVal, oldVal) {
234
+ if (!isEqual(newVal, oldVal)) {
235
+ this.$emit('data', this.getData());
236
+ }
237
+ },
238
+ hidden: function hidden(newVal, oldVal) {
239
+ if (!isEqual(newVal, oldVal)) {
240
+ this.$emit('data', this.getData());
241
+ }
242
+ },
243
+ time: function time(newVal, oldVal) {
244
+ if (!isEqual(newVal, oldVal)) {
245
+ this.$emit('data', this.getData());
246
+ }
247
+ },
248
+ hits: function hits(newVal, oldVal) {
249
+ this.$emit('data', this.getData());
250
+
251
+ if (this.pagination) {
252
+ // called when page is changed
253
+ if (this.isLoading && (oldVal || newVal)) {
254
+ this.$emit('page-change', this.currentPageState + 1, this.totalPages);
255
+ }
256
+ }
257
+ },
258
+ rawData: function rawData(newVal, oldVal) {
259
+ var _this = this;
260
+
261
+ if (!isEqual(newVal, oldVal)) {
262
+ var promotedResults = this.promotedResults,
263
+ hits = this.hits;
264
+ var results = parseHits(hits) || [];
265
+ var parsedPromotedResults = parseHits(promotedResults) || [];
266
+ var filteredResults = results;
267
+
268
+ if (parsedPromotedResults.length) {
269
+ var ids = parsedPromotedResults.map(function (item) {
270
+ return item._id;
271
+ }).filter(Boolean);
272
+
273
+ if (ids) {
274
+ filteredResults = filteredResults.filter(function (item) {
275
+ return !ids.includes(item._id);
276
+ });
277
+ }
278
+
279
+ filteredResults = [].concat(parsedPromotedResults, filteredResults);
280
+ }
281
+
282
+ filteredResults = filteredResults.filter(function (item) {
283
+ return !!item[_this.dataField];
284
+ }).map(function (item) {
285
+ var _extends2;
286
+
287
+ return _rollupPluginBabelHelpers._extends({}, item, (_extends2 = {}, _extends2[_this.dataField] = getLocationObject(item[_this.dataField]), _extends2));
288
+ });
289
+ this.filteredResults = this.addNoise(filteredResults);
290
+
291
+ if (this.calculateMarkers) {
292
+ this.markersData = this.calculateMarkers({
293
+ data: this.filteredResults,
294
+ rawData: this.rawData
295
+ }) || [];
296
+ }
297
+
298
+ this.$emit('data', this.getData());
299
+ }
300
+ },
301
+ center: function center(newVal, oldVal) {
302
+ if (!isEqual(newVal, oldVal)) {
303
+ var persistMapQuery = !!this.center; // we need to forceExecute the query because the center has changed
304
+
305
+ var forceExecute = true;
306
+ var geoQuery = this.getGeoQuery(this.$props); // Update default query for RS API
307
+
308
+ this.setDefaultQueryForRSAPI();
309
+ var meta = {
310
+ mapBoxBounds: this.mapBoxBounds
311
+ };
312
+ this.setMapData(this.componentId, geoQuery, persistMapQuery, forceExecute, meta);
313
+ }
314
+ }
315
+ },
316
+ methods: {
317
+ parseLocation: function parseLocation(location) {
318
+ if (Array.isArray(location)) {
319
+ return {
320
+ lat: Number(location[0]),
321
+ lng: Number(location[1])
322
+ };
323
+ }
324
+
325
+ return {
326
+ lat: location ? Number(location.lat) : this.defaultCenter.lat,
327
+ lng: location ? Number(location.lon === undefined ? location.lng : location.lon) : this.defaultCenter.lng
328
+ };
329
+ },
330
+ getDefaultCenter: function getDefaultCenter() {
331
+ if (this.defaultCenter) return this.parseLocation(this.defaultCenter);
332
+ return this.parseLocation(MAP_CENTER);
333
+ },
334
+ addNoise: function addNoise(hits) {
335
+ var _this2 = this;
336
+
337
+ var hitMap = {};
338
+ var updatedHits = [];
339
+ hits.forEach(function (item) {
340
+ var updatedItem = _rollupPluginBabelHelpers._extends({}, item);
341
+
342
+ var location = _this2.parseLocation(item[_this2.dataField]);
343
+
344
+ var key = JSON.stringify(location);
345
+ var count = hitMap[key] || 0;
346
+ updatedItem[_this2.dataField] = count ? withDistinctLat(location, count) : location;
347
+ updatedHits = [].concat(updatedHits, [updatedItem]);
348
+ hitMap[key] = count + 1;
349
+ });
350
+ return updatedHits;
351
+ },
352
+ getPosition: function getPosition(result) {
353
+ if (result) {
354
+ return this.parseLocation(result[this.dataField]);
355
+ }
356
+
357
+ return null;
358
+ },
359
+ getHitsCenter: function getHitsCenter(hits) {
360
+ var _this3 = this;
361
+
362
+ var data = hits.map(function (hit) {
363
+ return hit[_this3.dataField];
364
+ });
365
+
366
+ if (data.length) {
367
+ var numCoords = data.length;
368
+ var X = 0.0;
369
+ var Y = 0.0;
370
+ var Z = 0.0;
371
+ data.forEach(function (location) {
372
+ if (location) {
373
+ var _lat = 0.0;
374
+ var _lng = 0.0;
375
+ var locationObj = getLocationObject(location);
376
+ _lat = locationObj.lat * Math.PI / 180;
377
+ _lng = (locationObj.lng !== undefined ? locationObj.lng : locationObj.lon) * Math.PI / 180;
378
+ var a = Math.cos(_lat) * Math.cos(_lng);
379
+ var b = Math.cos(_lat) * Math.sin(_lng);
380
+ var c = Math.sin(_lat);
381
+ X += a;
382
+ Y += b;
383
+ Z += c;
384
+ }
385
+ });
386
+ X /= numCoords;
387
+ Y /= numCoords;
388
+ Z /= numCoords;
389
+ var lng = Math.atan2(Y, X); // eslint-disable-next-line
390
+
391
+ var hyp = Math.sqrt(X * X + Y * Y);
392
+ var lat = Math.atan2(Z, hyp);
393
+ var newX = lat * 180 / Math.PI;
394
+ var newY = lng * 180 / Math.PI;
395
+ return {
396
+ lat: newX,
397
+ lng: newY
398
+ };
399
+ }
400
+
401
+ return false;
402
+ },
403
+ getCenter: function getCenter(hits) {
404
+ var _this4 = this;
405
+
406
+ if (this.center) {
407
+ return this.parseLocation(this.center);
408
+ }
409
+
410
+ var mapRef = this.getMapRef();
411
+
412
+ if (mapRef && typeof mapRef.getCenter === 'function' && this.$options.preserveCenter) {
413
+ var currentCenter = mapRef.getCenter();
414
+ setTimeout(function () {
415
+ _this4.$options.preserveCenter = false;
416
+ }, 100);
417
+ return this.parseLocation({
418
+ lat: currentCenter.lat(),
419
+ lng: currentCenter.lng()
420
+ });
421
+ }
422
+
423
+ if (hits && hits.length) {
424
+ if (this.autoCenter) {
425
+ return this.getHitsCenter(hits) || this.getDefaultCenter();
426
+ }
427
+
428
+ return hits[0] && hits[0][this.dataField] ? this.getPosition(hits[0]) : this.getDefaultCenter();
429
+ }
430
+
431
+ return this.getDefaultCenter();
432
+ },
433
+ handleZoomChange: function handleZoomChange(zoom) {
434
+ if (zoom) {
435
+ var prevZoom = this.zoom;
436
+
437
+ if (this.searchAsMove) {
438
+ this.zoom = zoom;
439
+ this.$options.preserveCenter = true;
440
+ this.setGeoQuery(true);
441
+ } else {
442
+ this.zoom = zoom;
443
+ }
444
+
445
+ if (prevZoom !== zoom) {
446
+ this.$emit('zoom-changed', zoom);
447
+ }
448
+ }
449
+ },
450
+ handleOnDragEnd: function handleOnDragEnd() {
451
+ if (this.searchAsMove) {
452
+ this.$options.preserveCenter = true;
453
+ this.setGeoQuery(true);
454
+ }
455
+
456
+ this.$emit('drag-end');
457
+ },
458
+ handlePreserveCenter: function handlePreserveCenter(preserveCenter) {
459
+ this.$options.preserveCenter = preserveCenter;
460
+ },
461
+ handleOnIdle: function handleOnIdle() {
462
+ // only make the geo_bounding query if we have hits data
463
+ if (this.hits && this.hits.length && this.searchAsMove) {
464
+ // always execute geo-bounds query when center is set
465
+ // to improve the specificity of search results
466
+ var executeUpdate = !!this.center;
467
+ this.setGeoQuery(executeUpdate);
468
+ }
469
+
470
+ this.$emit('idle');
471
+ },
472
+ setGeoQuery: function setGeoQuery(executeUpdate) {
473
+ if (executeUpdate === void 0) {
474
+ executeUpdate = false;
475
+ }
476
+
477
+ // execute a new query on the initial mount
478
+ // or whenever searchAsMove is true and the map is dragged
479
+ if (executeUpdate || !this.skipBoundingBox && !this.mapBoxBounds) {
480
+ this.$defaultQuery = this.getGeoQuery();
481
+ var persistMapQuery = !!this.center;
482
+ var forceExecute = this.searchAsMove;
483
+ var meta = {
484
+ mapBoxBounds: this.mapBoxBounds
485
+ };
486
+ this.setMapData(this.componentId, this.$defaultQuery, persistMapQuery, forceExecute, meta);
487
+ }
488
+
489
+ this.skipBoundingBox = false;
490
+ },
491
+ getMapParams: function getMapParams() {
492
+ var _this$getData = this.getData(),
493
+ data = _this$getData.data;
494
+
495
+ var showMarkers = this.showMarkers,
496
+ defaultPin = this.defaultPin,
497
+ renderPopover = this.renderPopover,
498
+ autoClosePopover = this.autoClosePopover,
499
+ renderItem = this.renderItem;
500
+ return {
501
+ resultsToRender: data,
502
+ center: this.getCenter(data),
503
+ getPosition: this.getPosition,
504
+ zoom: this.zoom,
505
+ renderItem: renderItem,
506
+ showMarkers: showMarkers,
507
+ defaultPin: defaultPin,
508
+ renderPopover: renderPopover,
509
+ autoClosePopover: autoClosePopover,
510
+ renderSearchAsMove: this.renderSearchAsMove,
511
+ handlePreserveCenter: this.handlePreserveCenter,
512
+ preserveCenter: this.$options.preserveCenter,
513
+ handleOnDragEnd: this.handleOnDragEnd,
514
+ handleOnIdle: this.handleOnIdle,
515
+ handleZoomChange: this.handleZoomChange
516
+ };
517
+ },
518
+ getAllData: function getAllData() {
519
+ var size = this.size,
520
+ promotedResults = this.promotedResults,
521
+ customData = this.customData,
522
+ currentPage = this.currentPage,
523
+ hits = this.hits;
524
+ var results = parseHits(hits) || [];
525
+ var parsedPromotedResults = parseHits(promotedResults) || [];
526
+ var base = currentPage * size;
527
+ var resultsToRender = this.filteredResults || [];
528
+
529
+ if (this.markersData) {
530
+ resultsToRender = this.markersData;
531
+ }
532
+
533
+ return {
534
+ results: results,
535
+ resultsToRender: resultsToRender,
536
+ customData: customData || {},
537
+ promotedResults: parsedPromotedResults,
538
+ loadMore: this.loadMore,
539
+ base: base,
540
+ triggerClickAnalytics: this.triggerClickAnalytics
541
+ };
542
+ },
543
+ getData: function getData() {
544
+ var _this$getAllData2 = this.getAllData(),
545
+ promotedResults = _this$getAllData2.promotedResults,
546
+ aggregationData = _this$getAllData2.aggregationData,
547
+ customData = _this$getAllData2.customData,
548
+ resultsToRender = _this$getAllData2.resultsToRender;
549
+
550
+ return {
551
+ data: this.withClickIds(resultsToRender),
552
+ aggregationData: this.withClickIds(aggregationData || []),
553
+ promotedData: this.withClickIds(promotedResults),
554
+ rawData: this.rawData,
555
+ resultStats: this.stats,
556
+ customData: customData
557
+ };
558
+ },
559
+ getComponent: function getComponent() {
560
+ var error = this.error,
561
+ isLoading = this.isLoading;
562
+
563
+ var data = _rollupPluginBabelHelpers._extends({
564
+ error: error,
565
+ loading: isLoading,
566
+ loadMore: this.loadMore,
567
+ triggerClickAnalytics: this.triggerClickAnalytics,
568
+ setPage: this.setPage
569
+ }, this.getData());
570
+
571
+ return index.getComponent(data, this);
572
+ },
573
+ setPage: function setPage(page) {
574
+ // pageClick will be called every time a pagination button is clicked
575
+ if (page !== this.currentPageState) {
576
+ this.$emit('pageClick', page + 1);
577
+ this.$emit('page-click', page + 1);
578
+ var value = this.size * page;
579
+ var options = getQueryOptions(this.$props);
580
+ options.from = this.$data.from;
581
+ this.from = value;
582
+ this.currentPageState = page;
583
+ this.loadMoreAction(this.componentId, _rollupPluginBabelHelpers._extends({}, options, {
584
+ from: value
585
+ }), false);
586
+
587
+ if (this.URLParams) {
588
+ this.setPageURL(this.componentId, page + 1, this.componentId, false, true);
589
+ }
590
+ }
591
+ },
592
+ setDefaultQueryForRSAPI: function setDefaultQueryForRSAPI() {
593
+ if (this.defaultQuery && typeof this.defaultQuery === 'function') {
594
+ var defaultQuery = this.defaultQuery();
595
+ this.setDefaultQuery(this.componentId, defaultQuery);
596
+ }
597
+ },
598
+ getArrPosition: function getArrPosition(location) {
599
+ return {
600
+ lat: location.lat,
601
+ lon: location.lon || location.lng
602
+ };
603
+ },
604
+ getGeoQuery: function getGeoQuery(props) {
605
+ if (props === void 0) {
606
+ props = this.$props;
607
+ }
608
+
609
+ this.$defaultQuery = props.defaultQuery ? props.defaultQuery() : null;
610
+ var mapRef = this.getMapRef();
611
+ var mapBounds = mapRef && typeof mapRef.getBounds === 'function' ? mapRef.getBounds() : false;
612
+ var north;
613
+ var south;
614
+ var east;
615
+ var west;
616
+
617
+ if (mapBounds) {
618
+ var _geo_bounding_box;
619
+
620
+ north = mapBounds.getNorthEast().lat();
621
+ south = mapBounds.getSouthWest().lat();
622
+ east = mapBounds.getNorthEast().lng();
623
+ west = mapBounds.getSouthWest().lng();
624
+ var boundingBoxCoordinates = {
625
+ top_left: [west, north],
626
+ bottom_right: [east, south]
627
+ };
628
+ this.mapBoxBounds = boundingBoxCoordinates;
629
+ var geoQuery = {
630
+ geo_bounding_box: (_geo_bounding_box = {}, _geo_bounding_box[this.dataField] = boundingBoxCoordinates, _geo_bounding_box)
631
+ };
632
+
633
+ if (this.$defaultQuery) {
634
+ var query = this.$defaultQuery.query;
635
+
636
+ if (query) {
637
+ // adds defaultQuery's query to geo-query
638
+ // to generate a map query
639
+ return {
640
+ must: [geoQuery, query]
641
+ };
642
+ }
643
+ }
644
+
645
+ return geoQuery;
646
+ } // return the defaultQuery (if set) or null when map query not available
647
+
648
+
649
+ return this.$defaultQuery ? this.$defaultQuery.query : null;
650
+ },
651
+ getGeoDistanceQuery: function getGeoDistanceQuery() {
652
+ var center = this.center || this.defaultCenter;
653
+
654
+ if (center && this.defaultRadius) {
655
+ var _geo_distance;
656
+
657
+ // skips geo bounding box query on initial load
658
+ this.skipBoundingBox = true;
659
+ return {
660
+ geo_distance: (_geo_distance = {
661
+ distance: "" + this.defaultRadius + this.unit
662
+ }, _geo_distance[this.dataField] = this.getArrPosition(center), _geo_distance)
663
+ };
664
+ }
665
+
666
+ return null;
667
+ },
668
+ loadMore: function loadMore() {
669
+ if (this.hits && !this.pagination && this.total !== this.hits.length) {
670
+ var value = this.from + this.size;
671
+ var options = getQueryOptions(this.$props);
672
+ this.from = value;
673
+ this.loadMoreAction(this.componentId, _rollupPluginBabelHelpers._extends({}, options, {
674
+ from: value
675
+ }), true);
676
+ }
677
+ },
678
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
679
+ var docId = documentId;
680
+
681
+ if (!docId) {
682
+ var _this$getData2 = this.getData(),
683
+ data = _this$getData2.data;
684
+
685
+ var hitData = data.find(function (hit) {
686
+ return hit._click_id === searchPosition;
687
+ });
688
+
689
+ if (hitData && hitData._id) {
690
+ docId = hitData._id;
691
+ }
692
+ }
693
+
694
+ this.recordResultClick(searchPosition, docId);
695
+ },
696
+ withClickIds: function withClickIds(results) {
697
+ var _this$getAllData3 = this.getAllData(),
698
+ base = _this$getAllData3.base;
699
+
700
+ return results.map(function (result, index) {
701
+ return _rollupPluginBabelHelpers._extends({}, result, {
702
+ _click_id: base + index
703
+ });
704
+ });
705
+ },
706
+ toggleSearchAsMove: function toggleSearchAsMove() {
707
+ this.searchAsMove = !this.searchAsMove;
708
+ this.$emit('search-as-move', this.searchAsMove);
709
+ },
710
+ renderErrorComponent: function renderErrorComponent() {
711
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
712
+
713
+ if (renderError && this.error && !this.isLoading) {
714
+ return index.isFunction(renderError) ? renderError(this.error) : renderError;
715
+ }
716
+
717
+ return null;
718
+ },
719
+ renderSearchAsMove: function renderSearchAsMove() {
720
+ var h = this.$createElement;
721
+
722
+ if (this.showSearchAsMove) {
723
+ return h("div", {
724
+ "style": {
725
+ position: 'absolute',
726
+ bottom: '30px',
727
+ left: '10px',
728
+ width: '240px',
729
+ backgroundColor: '#fff',
730
+ padding: '8px 10px',
731
+ boxShadow: 'rgba(0,0,0,0.3) 0px 1px 4px -1px',
732
+ borderRadius: 2,
733
+ zIndex: 10000
734
+ },
735
+ "attrs": {
736
+ "className": getClassName(this.innerClass, 'checkboxContainer') || null
737
+ }
738
+ }, [h(FormControlList.Checkbox, {
739
+ "attrs": {
740
+ "type": "checkbox",
741
+ "id": this.$props.componentId + "-searchasmove",
742
+ "checked": this.searchAsMove,
743
+ "show": true
744
+ },
745
+ "class": getClassName(this.$props.innerClass, 'checkbox'),
746
+ "on": {
747
+ "click": this.toggleSearchAsMove
748
+ }
749
+ }), h("label", {
750
+ "attrs": {
751
+ "className": getClassName(this.innerClass, 'label') || null,
752
+ "for": this.$props.componentId + "-searchasmove"
753
+ }
754
+ }, [this.searchAsMoveLabel])]);
755
+ }
756
+
757
+ return null;
758
+ },
759
+ renderPagination: function renderPagination() {
760
+ var h = this.$createElement;
761
+ return h(Pagination.Pagination, {
762
+ "attrs": {
763
+ "pages": this.pages,
764
+ "totalPages": this.totalPages,
765
+ "currentPage": this.currentPageState,
766
+ "setPage": this.setPage,
767
+ "innerClass": this.innerClass
768
+ }
769
+ });
770
+ }
771
+ },
772
+ created: function created() {
773
+ if (this.defaultPage >= 0) {
774
+ this.currentPageState = this.defaultPage;
775
+ this.from = this.currentPageState * this.$props.size;
776
+ }
777
+
778
+ this.internalComponent = this.$props.componentId + "__internal";
779
+ this.updateComponentProps(this.componentId, {
780
+ from: this.from
781
+ }, constants.componentTypes.reactiveMap);
782
+ this.updateComponentProps(this.internalComponent, {
783
+ from: this.from
784
+ }, constants.componentTypes.reactiveMap);
785
+ },
786
+ mounted: function mounted() {
787
+ if (this.defaultPage < 0 && this.currentPage > 0) {
788
+ if (this.$props.URLParams) {
789
+ this.setPageURL(this.$props.componentId, this.currentPage, this.$props.componentId, false, true);
790
+ }
791
+ }
792
+
793
+ var options = getQueryOptions(this.$props);
794
+ options.from = this.$data.from;
795
+
796
+ if (this.$props.sortBy) {
797
+ var _ref2;
798
+
799
+ options.sort = [(_ref2 = {}, _ref2[this.$props.dataField] = {
800
+ order: this.$props.sortBy
801
+ }, _ref2)];
802
+ }
803
+
804
+ this.$defaultQuery = null;
805
+
806
+ if (this.$props.defaultQuery) {
807
+ this.$defaultQuery = this.$props.defaultQuery();
808
+ options = _rollupPluginBabelHelpers._extends({}, options, getOptionsFromQuery(this.$defaultQuery)); // Override sort query with defaultQuery's sort if defined
809
+
810
+ if (this.$defaultQuery.sort) {
811
+ options.sort = this.$defaultQuery.sort;
812
+ } // since we want defaultQuery to be executed anytime
813
+ // map component's query is being executed
814
+
815
+
816
+ var persistMapQuery = true; // no need to forceExecute because setReact() will capture the main query
817
+ // and execute the defaultQuery along with it
818
+
819
+ var forceExecute = false; // Update default query for RS API
820
+
821
+ this.setDefaultQueryForRSAPI();
822
+ var meta = {
823
+ mapBoxBounds: this.mapBoxBounds
824
+ };
825
+ this.setMapData(this.componentId, this.$defaultQuery.query, persistMapQuery, forceExecute, meta);
826
+ } else {
827
+ // only apply geo-distance when defaultQuery prop is not set
828
+ var query = this.getGeoDistanceQuery();
829
+
830
+ if (query) {
831
+ // - only persist the map query if center prop is set
832
+ // - ideally, persist the map query if you want to keep executing it
833
+ // whenever there is a change (due to subscription) in the component query
834
+ var _persistMapQuery = !!this.center; // - forceExecute will make sure that the component query + Map query gets executed
835
+ // irrespective of the changes in the component query
836
+ // - forceExecute will only come into play when searchAsMove is true
837
+ // - kindly note that forceExecute may result in one additional network request
838
+ // since it bypasses the gatekeeping
839
+
840
+
841
+ var _forceExecute = this.searchAsMove; // Set meta for `distance` and `coordinates` in selected value
842
+
843
+ var center = this.center || this.defaultCenter;
844
+ var coordinatesObject = this.getArrPosition(center);
845
+ var _meta = {
846
+ distance: this.defaultRadius,
847
+ coordinates: coordinatesObject.lat + ", " + coordinatesObject.lon
848
+ };
849
+ this.setMapData(this.componentId, query, _persistMapQuery, _forceExecute, _meta);
850
+ }
851
+ }
852
+
853
+ this.setQueryOptions(this.componentId, options, !(this.$defaultQuery && this.$defaultQuery.query));
854
+ },
855
+ render: function render() {
856
+ var h = arguments[0];
857
+ var loader = this.$scopedSlots.loader || this.$props.loader;
858
+ return h("div", {
859
+ "style": _rollupPluginBabelHelpers._extends({}, style, this.$props.style),
860
+ "class": this.$props.className
861
+ }, [this.renderErrorComponent(), this.isLoading && loader, this.hasCustomRender ? this.getComponent() : null, this.renderMap(this.getMapParams()), this.pagination ? this.renderPagination() : null]);
862
+ }
863
+ };
864
+
865
+ var mapStateToProps = function mapStateToProps(state, props) {
866
+ return {
867
+ defaultPage: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value - 1 || -1,
868
+ error: state.error[props.componentId],
869
+ isLoading: state.isLoading[props.componentId],
870
+ hits: state.hits[props.componentId] && state.hits[props.componentId].hits,
871
+ promotedResults: state.promotedResults[props.componentId],
872
+ customData: state.customData[props.componentId],
873
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
874
+ time: state.hits[props.componentId] && state.hits[props.componentId].time,
875
+ rawData: state.rawData[props.componentId],
876
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden
877
+ };
878
+ };
879
+
880
+ var mapDispatchToProps = {
881
+ loadMoreAction: loadMore,
882
+ setPageURL: setValue,
883
+ setQueryOptions: setQueryOptions,
884
+ setStreaming: setStreaming,
885
+ updateQuery: updateQuery,
886
+ updateComponentProps: updateComponentProps,
887
+ setDefaultQuery: setDefaultQuery,
888
+ recordResultClick: recordResultClick,
889
+ setMapData: setMapData
890
+ };
891
+ var RMConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(ReactiveMap), {
892
+ componentType: constants.componentTypes.reactiveMap,
893
+ internalComponent: true
894
+ });
895
+
896
+ ReactiveMap.install = function (Vue) {
897
+ Vue.component(ReactiveMap.name, RMConnected);
898
+ }; // Add componentType for SSR
899
+
900
+
901
+ ReactiveMap.componentType = constants.componentTypes.reactiveMap;
902
+
903
+ var infoWindowMappedProps = {
904
+ content: {
905
+ type: Object,
906
+ twoWay: true
907
+ },
908
+ options: {
909
+ type: Object,
910
+ required: false,
911
+ "default": function _default() {
912
+ return {};
913
+ }
914
+ },
915
+ position: {
916
+ type: Object,
917
+ twoWay: true
918
+ },
919
+ zIndex: {
920
+ type: Number,
921
+ twoWay: true
922
+ }
923
+ };
924
+ /**
925
+ * This function helps you to bind events from Google Maps API to Vue events
926
+ *
927
+ * @param {Object} vueInst the Vue instance
928
+ * @param {Object} googleMapsInst the Google Maps instance
929
+ * @param {string[]} events an array of string with all events that you want to bind
930
+ * @returns {void}
931
+ */
932
+
933
+ function bindEvents(vueInst, googleMapsInst, events) {
934
+ events.forEach(function (eventName) {
935
+ if (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName]) {
936
+ googleMapsInst.addListener(eventName, function (ev) {
937
+ vueInst.$emit(eventName, ev);
938
+ });
939
+ }
940
+ });
941
+ }
942
+ /**
943
+ * Function that helps you to capitalize the first letter on a word
944
+ *
945
+ * @param {string} text the text that you want to capitalize
946
+ * @returns {string}
947
+ */
948
+
949
+ function capitalizeFirstLetter(text) {
950
+ return text.charAt(0).toUpperCase() + text.slice(1);
951
+ }
952
+ /**
953
+ * Function that helps you to get all non nullable props from a component
954
+ *
955
+ * @param {Object} vueInst the Vue component instance
956
+ * @param {Object} props the props object
957
+ * @returns {Object}
958
+ */
959
+
960
+ function getPropsValues(vueInst, props) {
961
+ return Object.keys(props).reduce(function (acc, prop) {
962
+ if (vueInst[prop] !== undefined) {
963
+ acc[prop] = vueInst[prop];
964
+ }
965
+
966
+ return acc;
967
+ }, {});
968
+ }
969
+ /**
970
+ * Watch the individual properties of a PoD object, instead of the object
971
+ * per se. This is different from a deep watch where both the reference
972
+ * and the individual values are watched.
973
+ *
974
+ * In effect, it throttles the multiple $watch to execute at most once per tick.
975
+ *
976
+ * @param {Object} vueInst the component instance
977
+ * @param {string[]} propertiesToTrack string array with all properties that you want to track
978
+ * @param {Function} handler function to be fired when the prop change
979
+ * @param {boolean} immediate=false
980
+ * @returns {void}
981
+ */
982
+
983
+ function watchPrimitiveProperties(vueInst, propertiesToTrack, handler, immediate) {
984
+ if (immediate === void 0) {
985
+ immediate = false;
986
+ }
987
+
988
+ var isHandled = false;
989
+ /**
990
+ * Function in charge to execute the handler function if it was not fired
991
+ *
992
+ * @returns void
993
+ */
994
+
995
+ function requestHandle() {
996
+ if (!isHandled) {
997
+ isHandled = true;
998
+ vueInst.$nextTick(function () {
999
+ isHandled = false;
1000
+ handler();
1001
+ });
1002
+ }
1003
+ }
1004
+
1005
+ propertiesToTrack.forEach(function (prop) {
1006
+ vueInst.$watch(prop, requestHandle, {
1007
+ immediate: immediate
1008
+ });
1009
+ });
1010
+ }
1011
+ /**
1012
+ * Binds the properties defined in props to the google maps instance.
1013
+ * If the prop is an Object type, and we wish to track the properties
1014
+ * of the object (e.g. the lat and lng of a LatLng), then we do a deep
1015
+ * watch. For deep watch, we also prevent the _changed event from being
1016
+ * emitted if the data source was external.
1017
+ *
1018
+ * @param {Object} vueInst the component instance
1019
+ * @param {Object} googleMapsInst the Google Maps instance
1020
+ * @param {Object} props object with the component props tha should be synched with the Google Maps instances props
1021
+ * @returns {void}
1022
+ */
1023
+
1024
+ function bindProps(vueInst, googleMapsInst, props) {
1025
+ Object.keys(props).forEach(function (attribute) {
1026
+ var _props$attribute = props[attribute],
1027
+ twoWay = _props$attribute.twoWay,
1028
+ type = _props$attribute.type,
1029
+ trackProperties = _props$attribute.trackProperties,
1030
+ noBind = _props$attribute.noBind;
1031
+
1032
+ if (!noBind) {
1033
+ var setMethodName = "set" + capitalizeFirstLetter(attribute);
1034
+ var getMethodName = "get" + capitalizeFirstLetter(attribute);
1035
+ var eventName = attribute.toLowerCase() + "_changed";
1036
+ var initialValue = vueInst[attribute];
1037
+
1038
+ if (typeof googleMapsInst[setMethodName] === 'undefined') {
1039
+ throw new Error( // TODO: Analyze all disabled rules in the file
1040
+ // eslint-disable-next-line no-underscore-dangle -- old code should be analyzed
1041
+ setMethodName + " is not a method of (the Maps object corresponding to) " + vueInst.$options._componentTag);
1042
+ } // We need to avoid an endless
1043
+ // propChanged -> event emitted -> propChanged -> event emitted loop
1044
+ // although this may really be the user's responsibility
1045
+
1046
+
1047
+ if (type !== Object || !trackProperties) {
1048
+ // Track the object deeply
1049
+ vueInst.$watch(attribute, function () {
1050
+ var attributeValue = vueInst[attribute];
1051
+ googleMapsInst[setMethodName](attributeValue);
1052
+ }, {
1053
+ immediate: typeof initialValue !== 'undefined',
1054
+ deep: type === Object
1055
+ });
1056
+ } else {
1057
+ watchPrimitiveProperties(vueInst, trackProperties.map(function (prop) {
1058
+ return attribute + "." + prop;
1059
+ }), function () {
1060
+ googleMapsInst[setMethodName](vueInst[attribute]);
1061
+ }, vueInst[attribute] !== undefined);
1062
+ }
1063
+
1064
+ if (twoWay && (vueInst.$gmapOptions.autoBindAllEvents || vueInst.$listeners[eventName])) {
1065
+ googleMapsInst.addListener(eventName, function () {
1066
+ vueInst.$emit(eventName, googleMapsInst[getMethodName]());
1067
+ });
1068
+ }
1069
+ }
1070
+ });
1071
+ }
1072
+
1073
+ var _excluded = ["options", "position"];
1074
+ var InfoWindowClusterManager = {
1075
+ name: 'InfoWindowClusterManager',
1076
+ inject: {
1077
+ $markerPromise: {
1078
+ "default": null
1079
+ },
1080
+ $mapPromise: {}
1081
+ },
1082
+ provide: function provide() {
1083
+ var _this = this;
1084
+
1085
+ var events = ['domready', 'closeclick', 'content_changed']; // Infowindow needs this to be immediately available
1086
+
1087
+ var promise = this.$mapPromise.then(function (map) {
1088
+ _this.$map = map; // Initialize the maps with the given options
1089
+
1090
+ var initialOptions = _rollupPluginBabelHelpers._extends({}, _this.options, {
1091
+ map: map
1092
+ }, getPropsValues(_this, infoWindowMappedProps));
1093
+
1094
+ var extraOptions = initialOptions.options,
1095
+ position = initialOptions.position,
1096
+ finalOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(initialOptions, _excluded);
1097
+
1098
+ finalOptions.content = _this.$refs.flyaway;
1099
+
1100
+ if (_this.$markerPromise) {
1101
+ _this.$markerPromise.then(function (markerObject) {
1102
+ _this.$markerObject = markerObject; // eslint-disable-next-line
1103
+
1104
+ _this.$infoWindowObject = new google.maps.InfoWindow(finalOptions);
1105
+ bindProps(_this, _this.$infoWindowObject, infoWindowMappedProps);
1106
+ bindEvents(_this, _this.$infoWindowObject, events); // TODO: This function names should be analyzed
1107
+
1108
+ /* eslint-disable no-underscore-dangle -- old style */
1109
+
1110
+ _this._openInfoWindow();
1111
+
1112
+ _this.$watch('opened', function () {
1113
+ _this._openInfoWindow();
1114
+ });
1115
+ /* eslint-enable no-underscore-dangle */
1116
+
1117
+
1118
+ return _this.$infoWindowObject;
1119
+ });
1120
+ }
1121
+ })["catch"](function (error) {
1122
+ throw error;
1123
+ }); // TODO: analyze the efects of only returns the instance and remove completely the promise
1124
+
1125
+ this.$infoWindowPromise = promise;
1126
+ return {
1127
+ $infoWindowPromise: promise
1128
+ };
1129
+ },
1130
+ props: {
1131
+ /**
1132
+ * NOTE: This prop overrides the content of the default slot, use only one of them, not both at the same time
1133
+ * Content to display in the InfoWindow. This can be an HTML element, a plain-text string, or a string containing HTML. The InfoWindow will be sized according to the content. To set an explicit size for the content, set content to be a HTML element with that size.
1134
+ * @value undefined
1135
+ * @see [InfoWindow content](https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions.content)
1136
+ */
1137
+ content: {
1138
+ type: [String, Object],
1139
+ "default": undefined
1140
+ },
1141
+
1142
+ /**
1143
+ * Determines if the info-window is open or not
1144
+ */
1145
+ opened: {
1146
+ type: Boolean,
1147
+ "default": true
1148
+ },
1149
+
1150
+ /**
1151
+ * Contains the LatLng at which this info window is anchored.
1152
+ * Note: An InfoWindow may be attached either to a Marker object
1153
+ * (in which case its position is based on the marker's location)
1154
+ * or on the map itself at a specified LatLng.
1155
+ *
1156
+ * The LatLng at which to display this InfoWindow. If the InfoWindow is opened with an anchor, the anchor's position will be used instead.
1157
+ * @value undefined
1158
+ * @type LatLng|LatLngLiteral
1159
+ * @see [InfoWindow position](https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions.position)
1160
+ */
1161
+ position: {
1162
+ type: Object,
1163
+ "default": undefined
1164
+ },
1165
+
1166
+ /**
1167
+ * All InfoWindows are displayed on the map in order of their zIndex, with higher values displaying in front of InfoWindows with lower values. By default, InfoWindows are displayed according to their latitude, with InfoWindows of lower latitudes appearing in front of InfoWindows at higher latitudes. InfoWindows are always displayed in front of markers.
1168
+ * @value 0
1169
+ * @see [InfoWindow position](https://developers.google.com/maps/documentation/javascript/reference/info-window#InfoWindowOptions.zIndex)
1170
+ */
1171
+ zIndex: {
1172
+ type: Number,
1173
+ "default": 0
1174
+ },
1175
+
1176
+ /**
1177
+ * Extra options that you want to pass to the component
1178
+ */
1179
+ options: {
1180
+ type: Object,
1181
+ required: false,
1182
+ "default": undefined
1183
+ }
1184
+ },
1185
+ mounted: function mounted() {
1186
+ var el = this.$refs.flyaway;
1187
+ el.parentNode.removeChild(el);
1188
+ },
1189
+ destroyed: function destroyed() {
1190
+ // Note: not all Google Maps components support maps
1191
+ if (this.$infoWindowObject && this.$infoWindowObject.setMap) {
1192
+ this.$infoWindowObject.setMap(null);
1193
+ }
1194
+ },
1195
+ methods: {
1196
+ // TODO: we need to analyze the following method name
1197
+ // eslint-disable-next-line no-underscore-dangle -- old code
1198
+ _openInfoWindow: function _openInfoWindow() {
1199
+ if (this.opened) {
1200
+ if (this.$markerObject !== null) {
1201
+ this.$infoWindowObject.open(this.$map, this.$markerObject);
1202
+ } else {
1203
+ this.$infoWindowObject.open(this.$map);
1204
+ }
1205
+ } else {
1206
+ this.$infoWindowObject.close();
1207
+ }
1208
+ }
1209
+ },
1210
+ render: function render() {
1211
+ var h = arguments[0];
1212
+ return h("div", [h("div", {
1213
+ "ref": "flyaway"
1214
+ }, [this.$scopedSlots["default"]()])]);
1215
+ }
1216
+ };
1217
+
1218
+ var InfoWindowWrapper = {
1219
+ name: 'InfoWindowWrapperClusterManager',
1220
+ props: {
1221
+ id: VueTypes.string,
1222
+ renderPopover: VueTypes.func,
1223
+ infoWindowProps: VueTypes.object,
1224
+ events: VueTypes.object,
1225
+ marker: VueTypes.Object
1226
+ },
1227
+ data: function data() {
1228
+ return {
1229
+ infoWindowRef: null
1230
+ };
1231
+ },
1232
+ provide: function provide() {
1233
+ return {
1234
+ $markerPromise: Promise.resolve(this.marker)
1235
+ };
1236
+ },
1237
+ mounted: function mounted() {
1238
+ this.infoWindowRef = this.$refs[this.id + "-Info-Window"];
1239
+ },
1240
+ methods: {
1241
+ handleClose: function handleClose() {
1242
+ this.infoWindowRef.$infoWindowObject.close();
1243
+ }
1244
+ },
1245
+ render: function render() {
1246
+ var h = arguments[0];
1247
+ var renderPopover = this.renderPopover,
1248
+ events = this.events;
1249
+ return h(InfoWindowClusterManager, {
1250
+ "ref": this.id + "-Info-Window",
1251
+ "props": _rollupPluginBabelHelpers._extends({}, this.infoWindowProps),
1252
+ "on": _rollupPluginBabelHelpers._extends({}, events)
1253
+ }, [h("div", [renderPopover(this.handleClose)])]);
1254
+ }
1255
+ };
1256
+
1257
+ var _excluded$1 = ["options"];
1258
+ var isEqual$1 = configureStore.helper.isEqual;
1259
+ var recordResultClick$1 = configureStore.Actions.recordResultClick;
1260
+ var ClusterMarkers = {
1261
+ name: 'ClusterMarkers',
1262
+ props: {
1263
+ markers: VueTypes.array,
1264
+ getPosition: VueTypes.func,
1265
+ defaultPin: VueTypes.string,
1266
+ renderItem: VueTypes.func,
1267
+ markerProps: VueTypes.object,
1268
+ handlePreserveCenter: VueTypes.func.isRequired,
1269
+ autoClosePopover: VueTypes.bool,
1270
+ renderPopover: VueTypes.func,
1271
+ highlightMarkerOnHover: VueTypes.bool
1272
+ },
1273
+ inject: {
1274
+ $clusterPromise: {
1275
+ "default": null
1276
+ },
1277
+ $mapPromise: {}
1278
+ },
1279
+ data: function data() {
1280
+ return {
1281
+ openMarkers: {}
1282
+ };
1283
+ },
1284
+ mounted: function mounted() {
1285
+ this.buildMarkers(this.markers);
1286
+ },
1287
+ destroy: function destroy() {
1288
+ // Remove active markers
1289
+ this.buildMarkers([]);
1290
+ },
1291
+ watch: {
1292
+ markers: function markers(newVal, oldVal) {
1293
+ if (!isEqual$1(oldVal, newVal)) {
1294
+ this.buildMarkers(newVal);
1295
+ }
1296
+ }
1297
+ },
1298
+ methods: {
1299
+ triggerAnalytics: function triggerAnalytics(clickPosition, markerId) {
1300
+ this.recordResultClick(clickPosition, markerId);
1301
+ },
1302
+ setOpenMarkers: function setOpenMarkers(openMarkers) {
1303
+ this.openMarkers = openMarkers;
1304
+ },
1305
+ closeMarker: function closeMarker(marker) {
1306
+ var _this$$props = this.$props,
1307
+ autoClosePopover = _this$$props.autoClosePopover,
1308
+ handlePreserveCenter = _this$$props.handlePreserveCenter;
1309
+ var id = marker.metaData && marker.metaData._id;
1310
+
1311
+ var _this$openMarkers = this.openMarkers,
1312
+ del = _this$openMarkers[id],
1313
+ activeMarkers = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_this$openMarkers, [id].map(_rollupPluginBabelHelpers._toPropertyKey));
1314
+
1315
+ var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
1316
+ this.setOpenMarkers(newOpenMarkers);
1317
+ handlePreserveCenter(true);
1318
+ this.$emit('close-marker-popover', marker);
1319
+ },
1320
+ openMarker: function openMarker(marker, index) {
1321
+ var _ref, _extends2;
1322
+
1323
+ var autoClosePopover = this.autoClosePopover,
1324
+ handlePreserveCenter = this.handlePreserveCenter;
1325
+ var id = marker.metaData && marker.metaData._id;
1326
+ var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = marker, _ref) : _rollupPluginBabelHelpers._extends({}, this.openMarkers, (_extends2 = {}, _extends2[id] = marker, _extends2));
1327
+ this.setOpenMarkers(newOpenMarkers);
1328
+ handlePreserveCenter(true);
1329
+ this.triggerAnalytics(id, index);
1330
+ this.$emit('open-marker-popover', marker.metaData);
1331
+ },
1332
+ buildMarkers: function buildMarkers(markersToRender) {
1333
+ var _this = this;
1334
+
1335
+ this.$mapPromise.then(function (map) {
1336
+ if (_this.$clusterPromise) {
1337
+ _this.$clusterPromise.then(function (clusterObject) {
1338
+ // Detect changed markers
1339
+ var markersToAdd = [];
1340
+ var markersToRemove = []; // A map of marker id to active status, `true` means marker is active
1341
+ // `false` means marker is stale and should be removed
1342
+
1343
+ var oldMarkersIdMap = {};
1344
+ (_this.$markers || []).forEach(function (marker) {
1345
+ if (marker.metaData && marker.metaData._id) {
1346
+ // mark all old markers as stale
1347
+ oldMarkersIdMap[marker.metaData._id] = false;
1348
+ }
1349
+ }); // build map markers
1350
+
1351
+ markersToRender.forEach(function (marker, index) {
1352
+ // Avoid if a marker is already rendered
1353
+ if (marker._id && oldMarkersIdMap[marker._id] !== undefined) {
1354
+ // Set old marker as active
1355
+ oldMarkersIdMap[marker._id] = true;
1356
+ } else {
1357
+ // Initialize the maps with the given options
1358
+ var initialOptions = _rollupPluginBabelHelpers._extends({}, _this.markerProps, {
1359
+ metaData: marker,
1360
+ map: map,
1361
+ position: _this.getPosition(marker)
1362
+ });
1363
+
1364
+ if (_this.renderItem) {
1365
+ var data = _this.renderItem(marker);
1366
+
1367
+ if ('label' in data) {
1368
+ initialOptions.label = data.label;
1369
+ }
1370
+
1371
+ if ('icon' in data) {
1372
+ initialOptions.icon = data.icon;
1373
+ }
1374
+ } else if (_this.defaultPin) {
1375
+ initialOptions.icon = {
1376
+ url: _this.defaultPin
1377
+ };
1378
+ }
1379
+
1380
+ var extraOptions = initialOptions.options,
1381
+ finalOptions = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(initialOptions, _excluded$1);
1382
+
1383
+ if (_this.$clusterPromise) {
1384
+ finalOptions.map = null;
1385
+ } // eslint-disable-next-line
1386
+
1387
+
1388
+ var markerObject = new google.maps.Marker(finalOptions);
1389
+ markerObject.addListener('click', function () {
1390
+ _this.openMarker(markerObject, index);
1391
+ });
1392
+ markersToAdd.push(markerObject);
1393
+ }
1394
+ }); // Current active markers
1395
+
1396
+ var currentMarkers = [];
1397
+ markersToAdd.forEach(function (marker) {
1398
+ currentMarkers.push(marker);
1399
+ });
1400
+ (_this.$markers || []).forEach(function (marker) {
1401
+ if (marker.metaData && marker.metaData._id) {
1402
+ // if maker is not active then add to remove list
1403
+ if (!oldMarkersIdMap[marker.metaData._id]) {
1404
+ markersToRemove.push(marker);
1405
+ } else {
1406
+ currentMarkers.push(marker);
1407
+ }
1408
+ }
1409
+ }); // Remove old markers
1410
+
1411
+ clusterObject.removeMarkers(markersToRemove); // Add inital markers at once
1412
+
1413
+ clusterObject.addMarkers(markersToAdd);
1414
+ _this.$clusterObject = clusterObject;
1415
+ _this.$map = map;
1416
+ _this.$markers = currentMarkers;
1417
+ });
1418
+ }
1419
+ })["catch"](function (error) {
1420
+ throw error;
1421
+ });
1422
+ }
1423
+ },
1424
+ render: function render() {
1425
+ var _this2 = this;
1426
+
1427
+ var h = arguments[0];
1428
+
1429
+ if (!this.renderPopover) {
1430
+ return null;
1431
+ }
1432
+
1433
+ return h("div", [Object.keys(this.openMarkers).map(function (markerId) {
1434
+ var marker = _this2.openMarkers[markerId];
1435
+ var item = marker.metaData;
1436
+ return h(InfoWindowWrapper, {
1437
+ "key": markerId + "-InfoWindow",
1438
+ "attrs": {
1439
+ "id": markerId,
1440
+ "renderPopover": function renderPopover(_handleClose) {
1441
+ return _this2.renderPopover({
1442
+ item: item,
1443
+ handleClose: function handleClose() {
1444
+ _handleClose();
1445
+
1446
+ _this2.closeMarker(item);
1447
+ }
1448
+ });
1449
+ },
1450
+ "marker": marker,
1451
+ "infoWindowProps": {
1452
+ zIndex: 500
1453
+ },
1454
+ "events": {
1455
+ closeclick: function closeclick() {
1456
+ return _this2.closeMarker(marker);
1457
+ }
1458
+ }
1459
+ }
1460
+ });
1461
+ })]);
1462
+ }
1463
+ };
1464
+ var mapDispatchToProps$1 = {
1465
+ recordResultClick: recordResultClick$1
1466
+ };
1467
+ var ClusterManager = index.connect(function () {
1468
+ return null;
1469
+ }, mapDispatchToProps$1)(ClusterMarkers);
1470
+
1471
+ var InfoWindow = GmapVue.components.InfoWindow;
1472
+ var InfoWindowWrapper$1 = {
1473
+ name: 'InfoWindowWrapper',
1474
+ props: {
1475
+ id: VueTypes.string,
1476
+ renderPopover: VueTypes.func,
1477
+ infoWindowProps: VueTypes.object,
1478
+ events: VueTypes.object
1479
+ },
1480
+ data: function data() {
1481
+ return {
1482
+ infoWindowRef: null
1483
+ };
1484
+ },
1485
+ mounted: function mounted() {
1486
+ this.infoWindowRef = this.$refs[this.id + "-Info-Window"];
1487
+ },
1488
+ methods: {
1489
+ handleClose: function handleClose() {
1490
+ this.infoWindowRef.$infoWindowObject.close();
1491
+ }
1492
+ },
1493
+ render: function render() {
1494
+ var h = arguments[0];
1495
+ var renderPopover = this.renderPopover,
1496
+ events = this.events;
1497
+ return h(InfoWindow, {
1498
+ "ref": this.id + "-Info-Window",
1499
+ "props": _rollupPluginBabelHelpers._extends({}, this.infoWindowProps),
1500
+ "on": _rollupPluginBabelHelpers._extends({}, events)
1501
+ }, [h("div", [renderPopover(this.handleClose)])]);
1502
+ }
1503
+ };
1504
+
1505
+ var MapElementMixin = GmapVue.components.MapElementMixin; // Note: This file has been taken from https://github.com/eregnier/vue2-gmap-custom-marker/blob/master/gmap-custom-marker.vue
1506
+
1507
+ var MarkerWithLabel = {
1508
+ name: 'MarkerWithLabel',
1509
+ props: {
1510
+ metaData: {
1511
+ type: Object,
1512
+ "default": undefined
1513
+ },
1514
+ marker: {
1515
+ type: Object,
1516
+ "default": undefined
1517
+ },
1518
+ offsetX: {
1519
+ type: Number,
1520
+ "default": 0
1521
+ },
1522
+ offsetY: {
1523
+ type: Number,
1524
+ "default": 0
1525
+ },
1526
+ alignment: {
1527
+ type: String,
1528
+ "default": 'top'
1529
+ },
1530
+ zIndex: {
1531
+ type: Number,
1532
+ "default": 50
1533
+ },
1534
+ cssPosition: {
1535
+ type: Boolean,
1536
+ "default": false
1537
+ },
1538
+ renderMarker: VueTypes.func.isRequired,
1539
+ handleMouseOver: VueTypes.func,
1540
+ handleFocus: VueTypes.func,
1541
+ handleMouseOut: VueTypes.func,
1542
+ handleBlur: VueTypes.func,
1543
+ handleClick: VueTypes.func
1544
+ },
1545
+ data: function data() {
1546
+ return {
1547
+ opacity: 0.01
1548
+ };
1549
+ },
1550
+ mixins: [MapElementMixin],
1551
+ inject: {
1552
+ $clusterPromise: {
1553
+ "default": null
1554
+ }
1555
+ },
1556
+ computed: {
1557
+ lat: function lat() {
1558
+ return parseFloat(Number.isNaN(this.marker.lat) ? this.marker.latitude : this.marker.lat);
1559
+ },
1560
+ lng: function lng() {
1561
+ return parseFloat(Number.isNaN(this.marker.lng) ? this.marker.longitude : this.marker.lng);
1562
+ },
1563
+ latLng: function latLng() {
1564
+ if (this.marker instanceof window.google.maps.LatLng) {
1565
+ return this.marker;
1566
+ }
1567
+
1568
+ return new window.google.maps.LatLng(this.lat, this.lng);
1569
+ }
1570
+ },
1571
+ watch: {
1572
+ marker: function marker() {
1573
+ var _this = this;
1574
+
1575
+ this.$mapPromise.then(function () {
1576
+ return _this.$overlay.setPosition();
1577
+ });
1578
+ },
1579
+ zIndex: function zIndex() {
1580
+ if (this.$overlay) {
1581
+ this.$overlay.repaint();
1582
+ }
1583
+ }
1584
+ },
1585
+ beforeCreate: function beforeCreate(options) {
1586
+ if (this.$clusterPromise) {
1587
+ // eslint-disable-next-line
1588
+ options.map = null;
1589
+ }
1590
+
1591
+ return this.$clusterPromise;
1592
+ },
1593
+ destroyed: function destroyed() {
1594
+ if (this.$clusterObject) {
1595
+ this.$clusterObject.removeMarker(this.$overlay, true);
1596
+ } else if (this.$overlay) {
1597
+ this.$overlay.setMap(null);
1598
+ this.$overlay = undefined;
1599
+ }
1600
+ },
1601
+ provide: function provide() {
1602
+ var _this2 = this;
1603
+
1604
+ var self = this;
1605
+ return this.$mapPromise.then(function (map) {
1606
+ var Overlay = /*#__PURE__*/function (_window$google$maps$O) {
1607
+ _rollupPluginBabelHelpers._inheritsLoose(Overlay, _window$google$maps$O);
1608
+
1609
+ function Overlay(map2) {
1610
+ var _this3;
1611
+
1612
+ _this3 = _window$google$maps$O.call(this) || this;
1613
+ _this3.metaData = self.metaData;
1614
+
1615
+ _this3.setMap(map2);
1616
+
1617
+ _this3.draw = function () {
1618
+ return _this3.repaint();
1619
+ };
1620
+
1621
+ _this3.setPosition = function () {
1622
+ return _this3.repaint();
1623
+ };
1624
+
1625
+ _this3.getVisible = function () {
1626
+ return true;
1627
+ };
1628
+
1629
+ return _this3;
1630
+ }
1631
+
1632
+ var _proto = Overlay.prototype;
1633
+
1634
+ _proto.repaint = function repaint() {
1635
+ var div = self.$el;
1636
+ var projection = this.getProjection();
1637
+
1638
+ if (projection && div) {
1639
+ var posPixel = projection.fromLatLngToDivPixel(self.latLng);
1640
+ var x;
1641
+ var y;
1642
+
1643
+ switch (self.alignment) {
1644
+ case 'top':
1645
+ x = posPixel.x - div.offsetWidth / 2;
1646
+ y = posPixel.y - div.offsetHeight;
1647
+ break;
1648
+
1649
+ case 'bottom':
1650
+ x = posPixel.x - div.offsetWidth / 2;
1651
+ y = posPixel.y;
1652
+ break;
1653
+
1654
+ case 'left':
1655
+ x = posPixel.x - div.offsetWidth;
1656
+ y = posPixel.y - div.offsetHeight / 2;
1657
+ break;
1658
+
1659
+ case 'right':
1660
+ x = posPixel.x;
1661
+ y = posPixel.y - div.offsetHeight / 2;
1662
+ break;
1663
+
1664
+ case 'center':
1665
+ x = posPixel.x - div.offsetWidth / 2;
1666
+ y = posPixel.y - div.offsetHeight / 2;
1667
+ break;
1668
+
1669
+ case 'topleft':
1670
+ case 'lefttop':
1671
+ x = posPixel.x - div.offsetWidth;
1672
+ y = posPixel.y - div.offsetHeight;
1673
+ break;
1674
+
1675
+ case 'topright':
1676
+ case 'righttop':
1677
+ x = posPixel.x;
1678
+ y = posPixel.y - div.offsetHeight;
1679
+ break;
1680
+
1681
+ case 'bottomleft':
1682
+ case 'leftop':
1683
+ x = posPixel.x - div.offsetWidth;
1684
+ y = posPixel.y;
1685
+ break;
1686
+
1687
+ case 'bottomright':
1688
+ case 'rightbottom':
1689
+ x = posPixel.x;
1690
+ y = posPixel.y;
1691
+ break;
1692
+
1693
+ default:
1694
+ throw new Error('Invalid alignment type of custom marker!');
1695
+ }
1696
+
1697
+ if (self.cssPosition) {
1698
+ div.style.transform = "translate(" + (x + self.offsetX) + "px, " + (y + self.offsetY) + "px)";
1699
+ } else {
1700
+ div.style.left = x + self.offsetX + "px";
1701
+ div.style.top = y + self.offsetY + "px";
1702
+ }
1703
+
1704
+ div.style['z-index'] = self.zIndex;
1705
+ }
1706
+ };
1707
+
1708
+ _proto.onAdd = function onAdd() {
1709
+ if (this.$clusterObject) {
1710
+ this.$clusterObject.removeMarker(this.$overlay, true);
1711
+ } else if (this.$overlay) {
1712
+ this.$overlay.setMap(null);
1713
+ this.$overlay = undefined;
1714
+ }
1715
+
1716
+ var div = self.$el;
1717
+ var panes = this.getPanes();
1718
+ div.style.position = 'absolute';
1719
+ div.style.display = 'inline-block';
1720
+ div.style.zIndex = self.zIndex;
1721
+ panes.overlayLayer.appendChild(div);
1722
+ panes.overlayMouseTarget.appendChild(div);
1723
+
1724
+ this.getDraggable = function () {
1725
+ return false;
1726
+ };
1727
+
1728
+ this.getPosition = function () {
1729
+ return new window.google.maps.LatLng(self.lat, self.lng);
1730
+ };
1731
+
1732
+ self.afterCreate(this);
1733
+ } // eslint-disable-next-line
1734
+ ;
1735
+
1736
+ _proto.onRemove = function onRemove() {
1737
+ if (self.$el) {
1738
+ var ua = window.navigator.userAgent;
1739
+ var msie = ua.indexOf('MSIE '); // eslint-disable-next-line
1740
+
1741
+ if (msie > 0 || !!ua.match(/Trident.*rv\:11\./)) {
1742
+ self.$el.parentNode.removeChild(self.$el);
1743
+ } else {
1744
+ self.$el.remove();
1745
+ }
1746
+ }
1747
+ };
1748
+
1749
+ return Overlay;
1750
+ }(window.google.maps.OverlayView);
1751
+
1752
+ _this2.$overlay = new Overlay(map);
1753
+ setTimeout(function () {
1754
+ if (_this2.$overlay) {
1755
+ _this2.$overlay.repaint();
1756
+
1757
+ _this2.opacity = 1;
1758
+ }
1759
+ }, 100);
1760
+ });
1761
+ },
1762
+ methods: {
1763
+ afterCreate: function afterCreate(inst) {
1764
+ var _this4 = this;
1765
+
1766
+ if (this.$clusterPromise && !this.isMarkerAdded) {
1767
+ this.$clusterPromise.then(function (co) {
1768
+ co.addMarker(inst);
1769
+ _this4.$clusterObject = co;
1770
+ _this4.isMarkerAdded = true;
1771
+ });
1772
+ }
1773
+ }
1774
+ },
1775
+ render: function render() {
1776
+ var h = arguments[0];
1777
+ return h("div", {
1778
+ "style": {
1779
+ opacity: this.opacity
1780
+ },
1781
+ "on": {
1782
+ "mouseover": this.handleMouseOver,
1783
+ "mouseout": this.handleMouseOut,
1784
+ "click": this.handleClick
1785
+ }
1786
+ }, [this.renderMarker()]);
1787
+ }
1788
+ };
1789
+
1790
+ var _templateObject, _templateObject2, _templateObject3;
1791
+ var MapPin = styled__default('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\theight: 24px;\n\twidth: auto;\n\tbackground-color: #fff;\n\tborder-radius: 2px;\n\tcolor: #222;\n\tbox-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.15);\n\tpadding: 3px 6px;\n\tfont-size: 15px;\n"])));
1792
+ var MapPinArrow = styled__default('div')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tborder-color: rgba(0, 0, 0, 0.2);\n\tborder-style: solid;\n\tborder-width: 0 1px 1px 0;\n\tmargin-left: -6px;\n\tbackground-color: #fff;\n\tmargin-top: -6px;\n\twidth: 12px;\n\theight: 12px;\n\t-webkit-transform: rotate(45deg);\n\t-ms-transform: rotate(45deg);\n\ttransform: rotate(45deg);\n"])));
1793
+ var mapPinWrapper = styled.css(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t&:hover,\n\t&:focus {\n\t\tz-index: 200;\n\t}\n"])));
1794
+
1795
+ var Marker = GmapVue.components.Marker;
1796
+ var recordResultClick$2 = configureStore.Actions.recordResultClick;
1797
+ var GoogleMapMarker = {
1798
+ name: 'GoogleMapMarker',
1799
+ props: {
1800
+ index: VueTypes.number,
1801
+ marker: VueTypes.object.isRequired,
1802
+ getPosition: VueTypes.func.isRequired,
1803
+ defaultPin: VueTypes.string,
1804
+ renderItem: VueTypes.func,
1805
+ setOpenMarkers: VueTypes.func.isRequired,
1806
+ handlePreserveCenter: VueTypes.func.isRequired,
1807
+ autoClosePopover: VueTypes.bool,
1808
+ openMarkers: VueTypes.object,
1809
+ renderPopover: VueTypes.func,
1810
+ highlightMarkerOnHover: VueTypes.bool
1811
+ },
1812
+ data: function data() {
1813
+ return {
1814
+ zIndex: 0,
1815
+ markerIcon: null
1816
+ };
1817
+ },
1818
+ methods: {
1819
+ increaseMarkerZIndex: function increaseMarkerZIndex() {
1820
+ var handlePreserveCenter = this.$props.handlePreserveCenter;
1821
+
1822
+ if (this.highlightMarkerOnHover) {
1823
+ this.zIndex += 1;
1824
+ }
1825
+
1826
+ handlePreserveCenter(true);
1827
+ },
1828
+ removeMarkerZIndex: function removeMarkerZIndex() {
1829
+ var handlePreserveCenter = this.$props.handlePreserveCenter;
1830
+
1831
+ if (this.highlightMarkerOnHover) {
1832
+ this.zIndex -= 1;
1833
+ }
1834
+
1835
+ handlePreserveCenter(true);
1836
+ },
1837
+ openMarker: function openMarker() {
1838
+ var _ref, _extends2;
1839
+
1840
+ var _this$$props = this.$props,
1841
+ handleOpenMarkers = _this$$props.setOpenMarkers,
1842
+ openMarkers = _this$$props.openMarkers,
1843
+ marker = _this$$props.marker,
1844
+ autoClosePopover = _this$$props.autoClosePopover,
1845
+ handlePreserveCenter = _this$$props.handlePreserveCenter;
1846
+ var id = marker._id;
1847
+ var newOpenMarkers = autoClosePopover ? (_ref = {}, _ref[id] = true, _ref) : _rollupPluginBabelHelpers._extends({}, openMarkers, (_extends2 = {}, _extends2[id] = true, _extends2));
1848
+ handleOpenMarkers(newOpenMarkers);
1849
+ handlePreserveCenter(true);
1850
+ this.triggerAnalytics();
1851
+ this.$emit('open-marker-popover', marker);
1852
+ },
1853
+ closeMarker: function closeMarker() {
1854
+ var _this$$props2 = this.$props,
1855
+ handleOpenMarkers = _this$$props2.setOpenMarkers,
1856
+ marker = _this$$props2.marker,
1857
+ autoClosePopover = _this$$props2.autoClosePopover,
1858
+ handlePreserveCenter = _this$$props2.handlePreserveCenter,
1859
+ openMarkers = _this$$props2.openMarkers;
1860
+ var id = marker._id;
1861
+
1862
+ var del = openMarkers[id],
1863
+ activeMarkers = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(openMarkers, [id].map(_rollupPluginBabelHelpers._toPropertyKey));
1864
+
1865
+ var newOpenMarkers = autoClosePopover ? {} : activeMarkers;
1866
+ handleOpenMarkers(newOpenMarkers);
1867
+ handlePreserveCenter(true);
1868
+ this.$emit('close-marker-popover', marker);
1869
+ },
1870
+ triggerAnalytics: function triggerAnalytics() {
1871
+ this.recordResultClick(this.index, this.marker._id);
1872
+ },
1873
+ renderPopoverClick: function renderPopoverClick(item, includeExternalSettings) {
1874
+ var _this = this;
1875
+
1876
+ if (includeExternalSettings === void 0) {
1877
+ includeExternalSettings = false;
1878
+ }
1879
+
1880
+ var h = this.$createElement;
1881
+ var additionalProps = {};
1882
+ var _this$$props3 = this.$props,
1883
+ getPosition = _this$$props3.getPosition,
1884
+ _renderPopover = _this$$props3.renderPopover,
1885
+ openMarkers = _this$$props3.openMarkers;
1886
+
1887
+ if (includeExternalSettings) {
1888
+ // to render pop-over correctly with MarkerWithLabel
1889
+ additionalProps = {
1890
+ position: getPosition(item),
1891
+ defaultOptions: {
1892
+ pixelOffset: new window.google.maps.Size(0, -30)
1893
+ }
1894
+ };
1895
+ }
1896
+
1897
+ if (item._id in openMarkers) {
1898
+ return h(InfoWindowWrapper$1, {
1899
+ "key": item._id + "-InfoWindow",
1900
+ "attrs": {
1901
+ "id": item._id,
1902
+ "renderPopover": function renderPopover(_handleClose) {
1903
+ return _renderPopover({
1904
+ item: item,
1905
+ handleClose: function handleClose() {
1906
+ _handleClose();
1907
+
1908
+ _this.closeMarker();
1909
+ }
1910
+ });
1911
+ },
1912
+ "infoWindowProps": {
1913
+ zIndex: 500,
1914
+ position: additionalProps.position,
1915
+ options: additionalProps.defaultOptions
1916
+ },
1917
+ "events": {
1918
+ closeclick: function closeclick() {
1919
+ return _this.closeMarker();
1920
+ }
1921
+ }
1922
+ }
1923
+ });
1924
+ }
1925
+
1926
+ return null;
1927
+ }
1928
+ },
1929
+ render: function render() {
1930
+ var _this2 = this;
1931
+
1932
+ var h = arguments[0];
1933
+ var _this$$props4 = this.$props,
1934
+ getPosition = _this$$props4.getPosition,
1935
+ renderItem = _this$$props4.renderItem,
1936
+ defaultPin = _this$$props4.defaultPin,
1937
+ renderPopover = _this$$props4.renderPopover,
1938
+ customMarkerProps = _this$$props4.markerProps,
1939
+ marker = _this$$props4.marker;
1940
+ var markerProps = {};
1941
+
1942
+ if (this.zIndex) {
1943
+ markerProps.zIndex = window.google.maps.Marker.MAX_ZINDEX + this.zIndex;
1944
+ }
1945
+
1946
+ if (renderItem) {
1947
+ marker.setIcon = function (icon) {
1948
+ _this2.markerIcon = icon;
1949
+ };
1950
+
1951
+ var data = renderItem(marker);
1952
+
1953
+ if ('label' in data) {
1954
+ return h(MarkerWithLabel, {
1955
+ "key": marker._id,
1956
+ "attrs": {
1957
+ "metaData": marker,
1958
+ "marker": getPosition(marker),
1959
+ "labelAnchor": new window.google.maps.Point(0, 30),
1960
+ "handleMouseOver": this.increaseMarkerZIndex,
1961
+ "handleMouseOut": this.removeMarkerZIndex,
1962
+ "handleClick": this.openMarker,
1963
+ "zIndex": markerProps.zIndex,
1964
+ "renderMarker": function renderMarker() {
1965
+ return h("div", {
1966
+ "attrs": {
1967
+ "css": mapPinWrapper
1968
+ }
1969
+ }, [h(MapPin, [data.label]), h(MapPinArrow), renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
1970
+ }
1971
+ },
1972
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
1973
+ });
1974
+ }
1975
+
1976
+ if ('icon' in data) {
1977
+ markerProps.icon = data.icon;
1978
+ } else {
1979
+ return h(MarkerWithLabel, {
1980
+ "key": marker._id,
1981
+ "attrs": {
1982
+ "metaData": marker,
1983
+ "marker": getPosition(marker),
1984
+ "handleClick": this.openMarker,
1985
+ "handleMouseOver": this.increaseMarkerZIndex,
1986
+ "handleMouseOut": this.removeMarkerZIndex,
1987
+ "zIndex": markerProps.zIndex,
1988
+ "renderMarker": function renderMarker() {
1989
+ return h("div", {
1990
+ "attrs": {
1991
+ "css": mapPinWrapper
1992
+ }
1993
+ }, [typeof data.custom === 'function' ? data.custom(marker) : data.custom, renderPopover ? _this2.renderPopoverClick(marker, true) : null]);
1994
+ }
1995
+ },
1996
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
1997
+ });
1998
+ }
1999
+ } else if (defaultPin) {
2000
+ markerProps.icon = {
2001
+ url: defaultPin
2002
+ };
2003
+ }
2004
+
2005
+ return h(Marker, {
2006
+ "key": marker._id,
2007
+ "attrs": {
2008
+ "zIndex": markerProps.zIndex,
2009
+ "position": getPosition(marker),
2010
+ "options": {
2011
+ metaData: marker
2012
+ },
2013
+ "icon": this.markerIcon || markerProps.icon
2014
+ },
2015
+ "on": {
2016
+ "click": function click() {
2017
+ return _this2.openMarker();
2018
+ },
2019
+ "mouseover": this.increaseMarkerZIndex,
2020
+ "mouseout": this.removeMarkerZIndex
2021
+ },
2022
+ "props": _rollupPluginBabelHelpers._extends({}, customMarkerProps)
2023
+ }, [renderPopover ? this.renderPopoverClick(marker) : null]);
2024
+ }
2025
+ };
2026
+ var mapDispatchToProps$2 = {
2027
+ recordResultClick: recordResultClick$2
2028
+ };
2029
+ var GoogleMapMarker$1 = index.connect(function () {
2030
+ return null;
2031
+ }, mapDispatchToProps$2)(GoogleMapMarker);
2032
+
2033
+ var Cluster = GmapVue.components.Cluster;
2034
+ var GoogleMapMarkers = {
2035
+ name: 'GoogleMapMarkers',
2036
+ props: {
2037
+ resultsToRender: VueTypes.array,
2038
+ getPosition: VueTypes.func,
2039
+ renderItem: VueTypes.func,
2040
+ renderClusterPopover: VueTypes.func,
2041
+ defaultPin: VueTypes.string,
2042
+ autoClosePopover: VueTypes.bool,
2043
+ handlePreserveCenter: VueTypes.func,
2044
+ renderPopover: VueTypes.func,
2045
+ markerProps: VueTypes.object,
2046
+ clusterProps: VueTypes.object,
2047
+ showMarkerClusters: VueTypes.bool,
2048
+ highlightMarkerOnHover: VueTypes.bool
2049
+ },
2050
+ data: function data() {
2051
+ return {
2052
+ openMarkers: {},
2053
+ clickedCluster: null,
2054
+ clusterMarkers: []
2055
+ };
2056
+ },
2057
+ methods: {
2058
+ setOpenMarkers: function setOpenMarkers(openMarkers) {
2059
+ this.openMarkers = openMarkers;
2060
+ },
2061
+ getAdditionalProps: function getAdditionalProps() {
2062
+ return {
2063
+ position: {
2064
+ lat: this.clickedCluster.getCenter().lat(),
2065
+ lng: this.clickedCluster.getCenter().lng()
2066
+ },
2067
+ defaultOptions: {
2068
+ pixelOffset: new window.google.maps.Size(0, -30)
2069
+ }
2070
+ };
2071
+ },
2072
+ closeMarker: function closeMarker() {
2073
+ this.clickedCluster = null;
2074
+ this.clusterMarkers = [];
2075
+ this.$emit('close-cluster-popover');
2076
+ }
2077
+ },
2078
+ render: function render() {
2079
+ var _this = this;
2080
+
2081
+ var h = arguments[0];
2082
+ var resultsToRender = this.$props.resultsToRender;
2083
+ var openMarkers = this.openMarkers;
2084
+ var markerProps = {
2085
+ openMarkers: openMarkers,
2086
+ setMarkerOnTop: this.setMarkerOnTop,
2087
+ setOpenMarkers: this.setOpenMarkers,
2088
+ getPosition: this.getPosition,
2089
+ renderItem: this.renderItem,
2090
+ defaultPin: this.defaultPin,
2091
+ autoClosePopover: this.autoClosePopover,
2092
+ handlePreserveCenter: this.handlePreserveCenter,
2093
+ renderPopover: this.renderPopover,
2094
+ markerProps: this.markerProps,
2095
+ showMarkerClusters: this.showMarkerClusters,
2096
+ highlightMarkerOnHover: this.highlightMarkerOnHover
2097
+ };
2098
+
2099
+ if (this.showMarkerClusters) {
2100
+ return h("div", [h(Cluster, {
2101
+ "props": _rollupPluginBabelHelpers._extends({}, this.clusterProps),
2102
+ "on": {
2103
+ "click": function click(cluster) {
2104
+ var markers = cluster.markers.map(function (i) {
2105
+ return i.metaData;
2106
+ });
2107
+ _this.clickedCluster = cluster;
2108
+ _this.clusterMarkers = markers;
2109
+
2110
+ _this.$emit('open-cluster-popover', _this.clusterMarkers);
2111
+ }
2112
+ },
2113
+ "ref": "clusterRef"
2114
+ }, [h(ClusterManager, {
2115
+ "attrs": {
2116
+ "getPosition": markerProps.getPosition,
2117
+ "markers": resultsToRender,
2118
+ "defaultPin": markerProps.defaultPin,
2119
+ "renderItem": markerProps.renderItem,
2120
+ "markerProps": markerProps.markerProps,
2121
+ "handlePreserveCenter": markerProps.handlePreserveCenter,
2122
+ "autoClosePopover": markerProps.autoClosePopover,
2123
+ "renderPopover": markerProps.renderPopover,
2124
+ "highlightMarkerOnHover": markerProps.highlightMarkerOnHover
2125
+ },
2126
+ "on": _rollupPluginBabelHelpers._extends({}, this.$listeners)
2127
+ })]), this.clickedCluster && this.renderClusterPopover ? h(InfoWindowWrapper$1, {
2128
+ "attrs": {
2129
+ "id": "cluster",
2130
+ "infoWindowProps": {
2131
+ zIndex: 500,
2132
+ position: this.getAdditionalProps().position,
2133
+ options: this.getAdditionalProps().defaultOptions
2134
+ },
2135
+ "renderPopover": function renderPopover(_handleClose) {
2136
+ return _this.renderClusterPopover({
2137
+ markers: _this.clusterMarkers,
2138
+ cluster: _this.clickedCluster,
2139
+ handleClose: function handleClose() {
2140
+ _handleClose();
2141
+
2142
+ _this.closeMarker();
2143
+ }
2144
+ });
2145
+ },
2146
+ "events": {
2147
+ closeclick: this.closeMarker
2148
+ }
2149
+ }
2150
+ }) : null]);
2151
+ }
2152
+
2153
+ return h("div", [resultsToRender.map(function (marker, index) {
2154
+ return h(GoogleMapMarker$1, {
2155
+ "attrs": {
2156
+ "index": index,
2157
+ "marker": marker
2158
+ },
2159
+ "props": _rollupPluginBabelHelpers._extends({}, markerProps),
2160
+ "on": _rollupPluginBabelHelpers._extends({}, _this.$listeners)
2161
+ });
2162
+ })]);
2163
+ }
2164
+ };
2165
+
2166
+ var Map = GmapVue.components.MapLayer;
2167
+ var ReactiveGoogleMap = {
2168
+ name: 'ReactiveGoogleMap',
2169
+ props: {
2170
+ className: vueTypes.types.string,
2171
+ componentId: vueTypes.types.stringRequired,
2172
+ dataField: vueTypes.types.stringRequired,
2173
+ defaultQuery: VueTypes.func,
2174
+ loader: vueTypes.types.title,
2175
+ defaultZoom: VueTypes.number.def(13),
2176
+ react: vueTypes.types.react,
2177
+ size: vueTypes.types.number,
2178
+ sortBy: vueTypes.types.sortBy,
2179
+ URLParams: VueTypes.bool,
2180
+ mapProps: VueTypes.object,
2181
+ showMarkers: VueTypes.bool.def(true),
2182
+ showMarkerClusters: VueTypes.bool.def(false),
2183
+ searchAsMove: VueTypes.bool.def(false),
2184
+ searchAsMoveLabel: VueTypes.string,
2185
+ markerProps: VueTypes.object,
2186
+ clusterProps: VueTypes.object,
2187
+ renderItem: VueTypes.func,
2188
+ showSearchAsMove: VueTypes.bool.def(true),
2189
+ autoClosePopover: VueTypes.bool,
2190
+ pagination: VueTypes.bool,
2191
+ defaultPin: VueTypes.string,
2192
+ autoCenter: VueTypes.bool,
2193
+ defaultCenter: vueTypes.types.location,
2194
+ center: vueTypes.types.location,
2195
+ defaultRadius: vueTypes.types.number,
2196
+ unit: vueTypes.types.string,
2197
+ pages: VueTypes.number.def(5),
2198
+ calculateMarkers: VueTypes.func,
2199
+ highlightMarkerOnHover: VueTypes.bool.def(true)
2200
+ },
2201
+ methods: {
2202
+ renderMap: function renderMap(_ref) {
2203
+ var _this = this;
2204
+
2205
+ var resultsToRender = _ref.resultsToRender,
2206
+ center = _ref.center,
2207
+ zoom = _ref.zoom,
2208
+ handleZoomChange = _ref.handleZoomChange,
2209
+ handleOnDragEnd = _ref.handleOnDragEnd,
2210
+ handleOnIdle = _ref.handleOnIdle,
2211
+ renderSearchAsMove = _ref.renderSearchAsMove,
2212
+ handlePreserveCenter = _ref.handlePreserveCenter,
2213
+ getPosition = _ref.getPosition,
2214
+ autoClosePopover = _ref.autoClosePopover,
2215
+ defaultPin = _ref.defaultPin;
2216
+ var h = this.$createElement;
2217
+ var style = {
2218
+ width: '100%',
2219
+ height: '100%',
2220
+ position: 'relative'
2221
+ };
2222
+ return h("div", {
2223
+ "style": style
2224
+ }, [h(Map, {
2225
+ "ref": "mapRef",
2226
+ "attrs": {
2227
+ "map-type-id": "terrain",
2228
+ "options": {
2229
+ zoomControl: true
2230
+ },
2231
+ "center": center,
2232
+ "zoom": zoom
2233
+ },
2234
+ "style": {
2235
+ height: '100%'
2236
+ },
2237
+ "props": _rollupPluginBabelHelpers._extends({}, this.mapProps),
2238
+ "on": {
2239
+ "zoom_changed": handleZoomChange,
2240
+ "dragend": handleOnDragEnd,
2241
+ "idle": handleOnIdle
2242
+ }
2243
+ }, [this.showMarkers ? h(GoogleMapMarkers, {
2244
+ "attrs": {
2245
+ "resultsToRender": resultsToRender,
2246
+ "getPosition": getPosition,
2247
+ "markerProps": this.markerProps,
2248
+ "clusterProps": this.clusterProps,
2249
+ "handlePreserveCenter": handlePreserveCenter,
2250
+ "highlightMarkerOnHover": this.highlightMarkerOnHover,
2251
+ "renderItem": this.$scopedSlots.renderItem ? function () {
2252
+ return {
2253
+ custom: _this.$scopedSlots.renderItem
2254
+ };
2255
+ } : this.renderItem,
2256
+ "defaultPin": defaultPin,
2257
+ "autoClosePopover": autoClosePopover,
2258
+ "renderPopover": this.$scopedSlots.renderPopover,
2259
+ "renderClusterPopover": this.$scopedSlots.renderClusterPopover,
2260
+ "showMarkerClusters": this.showMarkerClusters
2261
+ },
2262
+ "on": _rollupPluginBabelHelpers._extends({}, this.$listeners)
2263
+ }) : null]), renderSearchAsMove()]);
2264
+ },
2265
+ getMapRef: function getMapRef() {
2266
+ return this.mapRef;
2267
+ }
2268
+ },
2269
+ mounted: function mounted() {
2270
+ var _this2 = this;
2271
+
2272
+ if (this.$refs.mapRef) {
2273
+ this.$refs.mapRef.$mapPromise.then(function (map) {
2274
+ _this2.mapRef = map;
2275
+ });
2276
+ }
2277
+ },
2278
+ render: function render() {
2279
+ var h = arguments[0];
2280
+ return h(RMConnected, _mergeJSXProps([{
2281
+ "attrs": {
2282
+ "getMapRef": this.getMapRef,
2283
+ "renderMap": this.renderMap,
2284
+ "componentId": this.componentId,
2285
+ "className": this.className,
2286
+ "dataField": this.dataField,
2287
+ "defaultZoom": this.defaultZoom,
2288
+ "react": this.react,
2289
+ "size": this.size,
2290
+ "sortBy": this.sortBy,
2291
+ "pagination": this.pagination,
2292
+ "uRLParams": this.URLParams,
2293
+ "defaultSearchAsMove": this.searchAsMove,
2294
+ "showSearchAsMove": this.showSearchAsMove,
2295
+ "searchAsMoveLabel": this.searchAsMoveLabel,
2296
+ "showMarkers": this.showMarkers,
2297
+ "markerProps": this.markerProps,
2298
+ "autoClosePopover": this.autoClosePopover,
2299
+ "defaultPin": this.defaultPin,
2300
+ "defaultQuery": this.defaultQuery,
2301
+ "autoCenter": this.autoCenter,
2302
+ "defaultCenter": this.defaultCenter,
2303
+ "defaultRadius": this.defaultRadius,
2304
+ "unit": this.unit,
2305
+ "pages": this.pages,
2306
+ "center": this.center,
2307
+ "loader": this.loader,
2308
+ "calculateMarkers": this.calculateMarkers
2309
+ }
2310
+ }, {
2311
+ scopedSlots: this.$scopedSlots,
2312
+ on: this.$listeners
2313
+ }]));
2314
+ }
2315
+ };
2316
+
2317
+ ReactiveGoogleMap.install = function (Vue, options) {
2318
+ Vue.component(ReactiveGoogleMap.name, ReactiveGoogleMap);
2319
+
2320
+ if (!options || !options.key) {
2321
+ console.error('ReactiveSearch: map key is required to use ReactiveGoogleMap component');
2322
+ }
2323
+
2324
+ Vue.use(GmapVue__default, {
2325
+ load: {
2326
+ key: options.key,
2327
+ libraries: 'places'
2328
+ },
2329
+ installComponents: false
2330
+ });
2331
+ }; // Add componentType for SSR
2332
+
2333
+
2334
+ ReactiveGoogleMap.componentType = constants.componentTypes.reactiveMap;
2335
+
2336
+ exports.default = ReactiveGoogleMap;