vue3-google-map 0.15.0 → 0.17.0
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.
- package/README.md +62 -1
- package/dist/index.cjs.js +20 -0
- package/dist/index.es.js +1767 -0
- package/dist/index.umd.js +20 -0
- package/dist/themes/index.cjs.js +1 -0
- package/dist/themes/index.es.js +1294 -0
- package/dist/types/@types/index.d.ts +4 -4
- package/dist/types/components/Circle.d.ts +18 -13
- package/dist/types/components/CustomControl.vue.d.ts +28 -20
- package/dist/types/components/CustomMarker.vue.d.ts +22 -19
- package/dist/types/components/GoogleMap.vue.d.ts +409 -263
- package/dist/types/components/HeatmapLayer.d.ts +24 -21
- package/dist/types/components/InfoWindow.vue.d.ts +24 -17
- package/dist/types/components/Marker.d.ts +18 -13
- package/dist/types/components/MarkerCluster.d.ts +22 -15
- package/dist/types/components/Polygon.d.ts +18 -13
- package/dist/types/components/Polyline.d.ts +18 -13
- package/dist/types/components/Rectangle.d.ts +18 -13
- package/dist/types/components/index.d.ts +11 -11
- package/dist/types/composables/index.d.ts +1 -1
- package/dist/types/composables/useSetupMapComponent.d.ts +10 -10
- package/dist/types/index.d.ts +1 -3
- package/dist/types/shared/index.d.ts +14 -14
- package/dist/{themes/types → types/themes}/aubergine.d.ts +2 -2
- package/dist/{themes/types → types/themes}/dark.d.ts +6 -6
- package/dist/{themes/types → types/themes}/grey.d.ts +2 -2
- package/dist/{themes/types → types/themes}/index.d.ts +8 -8
- package/dist/{themes/types → types/themes}/minimal.d.ts +2 -2
- package/dist/{themes/types → types/themes}/retro.d.ts +2 -2
- package/dist/{themes/types → types/themes}/roadways.d.ts +2 -2
- package/dist/{themes/types → types/themes}/roadwaysMinimal.d.ts +2 -2
- package/dist/{themes/types → types/themes}/ultraLight.d.ts +2 -2
- package/dist/types/utils/index.d.ts +13 -13
- package/package.json +28 -44
- package/dist/cjs/index.js +0 -93
- package/dist/es/index.js +0 -87
- package/dist/themes/es/index.js +0 -28
- package/dist/types/shims-google-maps-d.d.ts +0 -15
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,1767 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var d=document.createElement("style");d.appendChild(document.createTextNode(".mapdiv[data-v-7d660dd5]{width:100%;height:100%}.info-window-wrapper[data-v-45a4606d]{display:none}.mapdiv .info-window-wrapper[data-v-45a4606d]{display:inline-block}.custom-marker-wrapper[data-v-c7599d50]{display:none}.mapdiv .custom-marker-wrapper[data-v-c7599d50]{display:inline-block}")),document.head.appendChild(d)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
var Be = Object.defineProperty;
|
|
3
|
+
var qe = (o, e, t) => e in o ? Be(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
4
|
+
var te = (o, e, t) => (qe(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
5
|
+
import { defineComponent as M, ref as v, provide as z, watch as O, onMounted as Me, onBeforeUnmount as j, markRaw as E, toRef as B, openBlock as J, createElementBlock as Y, createElementVNode as ie, renderSlot as X, normalizeProps as Re, guardReactiveProps as Ze, inject as _, computed as K, withDirectives as Ne, vShow as Fe, Comment as be, mergeProps as Oe, createCommentVNode as Pe } from "vue";
|
|
6
|
+
const q = Symbol("map"), R = Symbol("api"), xe = Symbol("marker"), Ee = Symbol("markerCluster"), Q = Symbol("CustomMarker"), Le = Symbol("mapTilesLoaded"), $ = [
|
|
7
|
+
"click",
|
|
8
|
+
"dblclick",
|
|
9
|
+
"drag",
|
|
10
|
+
"dragend",
|
|
11
|
+
"dragstart",
|
|
12
|
+
"mousedown",
|
|
13
|
+
"mousemove",
|
|
14
|
+
"mouseout",
|
|
15
|
+
"mouseover",
|
|
16
|
+
"mouseup",
|
|
17
|
+
"rightclick"
|
|
18
|
+
];
|
|
19
|
+
var De = function o(e, t) {
|
|
20
|
+
if (e === t)
|
|
21
|
+
return !0;
|
|
22
|
+
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
23
|
+
if (e.constructor !== t.constructor)
|
|
24
|
+
return !1;
|
|
25
|
+
var s, r, n;
|
|
26
|
+
if (Array.isArray(e)) {
|
|
27
|
+
if (s = e.length, s != t.length)
|
|
28
|
+
return !1;
|
|
29
|
+
for (r = s; r-- !== 0; )
|
|
30
|
+
if (!o(e[r], t[r]))
|
|
31
|
+
return !1;
|
|
32
|
+
return !0;
|
|
33
|
+
}
|
|
34
|
+
if (e.constructor === RegExp)
|
|
35
|
+
return e.source === t.source && e.flags === t.flags;
|
|
36
|
+
if (e.valueOf !== Object.prototype.valueOf)
|
|
37
|
+
return e.valueOf() === t.valueOf();
|
|
38
|
+
if (e.toString !== Object.prototype.toString)
|
|
39
|
+
return e.toString() === t.toString();
|
|
40
|
+
if (n = Object.keys(e), s = n.length, s !== Object.keys(t).length)
|
|
41
|
+
return !1;
|
|
42
|
+
for (r = s; r-- !== 0; )
|
|
43
|
+
if (!Object.prototype.hasOwnProperty.call(t, n[r]))
|
|
44
|
+
return !1;
|
|
45
|
+
for (r = s; r-- !== 0; ) {
|
|
46
|
+
var a = n[r];
|
|
47
|
+
if (!o(e[a], t[a]))
|
|
48
|
+
return !1;
|
|
49
|
+
}
|
|
50
|
+
return !0;
|
|
51
|
+
}
|
|
52
|
+
return e !== e && t !== t;
|
|
53
|
+
};
|
|
54
|
+
const ue = "__googleMapsScriptId";
|
|
55
|
+
class S {
|
|
56
|
+
/**
|
|
57
|
+
* Creates an instance of Loader using [[LoaderOptions]]. No defaults are set
|
|
58
|
+
* using this library, instead the defaults are set by the Google Maps
|
|
59
|
+
* JavaScript API server.
|
|
60
|
+
*
|
|
61
|
+
* ```
|
|
62
|
+
* const loader = Loader({apiKey, version: 'weekly', libraries: ['places']});
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
constructor({ apiKey: e, channel: t, client: s, id: r = ue, libraries: n = [], language: a, region: c, version: i, mapIds: d, nonce: u, retries: l = 3, url: h = "https://maps.googleapis.com/maps/api/js" }) {
|
|
66
|
+
if (this.CALLBACK = "__googleMapsCallback", this.callbacks = [], this.done = !1, this.loading = !1, this.errors = [], this.version = i, this.apiKey = e, this.channel = t, this.client = s, this.id = r || ue, this.libraries = n, this.language = a, this.region = c, this.mapIds = d, this.nonce = u, this.retries = l, this.url = h, S.instance) {
|
|
67
|
+
if (!De(this.options, S.instance.options))
|
|
68
|
+
throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(S.instance.options)}`);
|
|
69
|
+
return S.instance;
|
|
70
|
+
}
|
|
71
|
+
S.instance = this;
|
|
72
|
+
}
|
|
73
|
+
get options() {
|
|
74
|
+
return {
|
|
75
|
+
version: this.version,
|
|
76
|
+
apiKey: this.apiKey,
|
|
77
|
+
channel: this.channel,
|
|
78
|
+
client: this.client,
|
|
79
|
+
id: this.id,
|
|
80
|
+
libraries: this.libraries,
|
|
81
|
+
language: this.language,
|
|
82
|
+
region: this.region,
|
|
83
|
+
mapIds: this.mapIds,
|
|
84
|
+
nonce: this.nonce,
|
|
85
|
+
url: this.url
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
get failed() {
|
|
89
|
+
return this.done && !this.loading && this.errors.length >= this.retries + 1;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* CreateUrl returns the Google Maps JavaScript API script url given the [[LoaderOptions]].
|
|
93
|
+
*
|
|
94
|
+
* @ignore
|
|
95
|
+
*/
|
|
96
|
+
createUrl() {
|
|
97
|
+
let e = this.url;
|
|
98
|
+
return e += `?callback=${this.CALLBACK}`, this.apiKey && (e += `&key=${this.apiKey}`), this.channel && (e += `&channel=${this.channel}`), this.client && (e += `&client=${this.client}`), this.libraries.length > 0 && (e += `&libraries=${this.libraries.join(",")}`), this.language && (e += `&language=${this.language}`), this.region && (e += `®ion=${this.region}`), this.version && (e += `&v=${this.version}`), this.mapIds && (e += `&map_ids=${this.mapIds.join(",")}`), e;
|
|
99
|
+
}
|
|
100
|
+
deleteScript() {
|
|
101
|
+
const e = document.getElementById(this.id);
|
|
102
|
+
e && e.remove();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Load the Google Maps JavaScript API script and return a Promise.
|
|
106
|
+
*/
|
|
107
|
+
load() {
|
|
108
|
+
return this.loadPromise();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Load the Google Maps JavaScript API script and return a Promise.
|
|
112
|
+
*
|
|
113
|
+
* @ignore
|
|
114
|
+
*/
|
|
115
|
+
loadPromise() {
|
|
116
|
+
return new Promise((e, t) => {
|
|
117
|
+
this.loadCallback((s) => {
|
|
118
|
+
s ? t(s.error) : e(window.google);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Load the Google Maps JavaScript API script with a callback.
|
|
124
|
+
*/
|
|
125
|
+
loadCallback(e) {
|
|
126
|
+
this.callbacks.push(e), this.execute();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Set the script on document.
|
|
130
|
+
*/
|
|
131
|
+
setScript() {
|
|
132
|
+
if (document.getElementById(this.id)) {
|
|
133
|
+
this.callback();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const e = this.createUrl(), t = document.createElement("script");
|
|
137
|
+
t.id = this.id, t.type = "text/javascript", t.src = e, t.onerror = this.loadErrorCallback.bind(this), t.defer = !0, t.async = !0, this.nonce && (t.nonce = this.nonce), document.head.appendChild(t);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Reset the loader state.
|
|
141
|
+
*/
|
|
142
|
+
reset() {
|
|
143
|
+
this.deleteScript(), this.done = !1, this.loading = !1, this.errors = [], this.onerrorEvent = null;
|
|
144
|
+
}
|
|
145
|
+
resetIfRetryingFailed() {
|
|
146
|
+
this.failed && this.reset();
|
|
147
|
+
}
|
|
148
|
+
loadErrorCallback(e) {
|
|
149
|
+
if (this.errors.push(e), this.errors.length <= this.retries) {
|
|
150
|
+
const t = this.errors.length * Math.pow(2, this.errors.length);
|
|
151
|
+
console.log(`Failed to load Google Maps script, retrying in ${t} ms.`), setTimeout(() => {
|
|
152
|
+
this.deleteScript(), this.setScript();
|
|
153
|
+
}, t);
|
|
154
|
+
} else
|
|
155
|
+
this.onerrorEvent = e, this.callback();
|
|
156
|
+
}
|
|
157
|
+
setCallback() {
|
|
158
|
+
window.__googleMapsCallback = this.callback.bind(this);
|
|
159
|
+
}
|
|
160
|
+
callback() {
|
|
161
|
+
this.done = !0, this.loading = !1, this.callbacks.forEach((e) => {
|
|
162
|
+
e(this.onerrorEvent);
|
|
163
|
+
}), this.callbacks = [];
|
|
164
|
+
}
|
|
165
|
+
execute() {
|
|
166
|
+
if (this.resetIfRetryingFailed(), this.done)
|
|
167
|
+
this.callback();
|
|
168
|
+
else {
|
|
169
|
+
if (window.google && window.google.maps && window.google.maps.version) {
|
|
170
|
+
console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."), this.callback();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.loading || (this.loading = !0, this.setCallback(), this.setScript());
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function Ue(o) {
|
|
178
|
+
return class extends o.OverlayView {
|
|
179
|
+
constructor(s) {
|
|
180
|
+
super();
|
|
181
|
+
te(this, "element");
|
|
182
|
+
te(this, "opts");
|
|
183
|
+
const { element: r, ...n } = s;
|
|
184
|
+
this.element = r, this.opts = n, this.opts.map && this.setMap(this.opts.map);
|
|
185
|
+
}
|
|
186
|
+
getPosition() {
|
|
187
|
+
return this.opts.position ? this.opts.position instanceof o.LatLng ? this.opts.position : new o.LatLng(this.opts.position) : null;
|
|
188
|
+
}
|
|
189
|
+
getVisible() {
|
|
190
|
+
if (!this.element)
|
|
191
|
+
return !1;
|
|
192
|
+
const s = this.element;
|
|
193
|
+
return s.style.display !== "none" && s.style.visibility !== "hidden" && (s.style.opacity === "" || Number(s.style.opacity) > 0.01);
|
|
194
|
+
}
|
|
195
|
+
onAdd() {
|
|
196
|
+
if (!this.element)
|
|
197
|
+
return;
|
|
198
|
+
const s = this.getPanes();
|
|
199
|
+
s && s.overlayMouseTarget.appendChild(this.element);
|
|
200
|
+
}
|
|
201
|
+
draw() {
|
|
202
|
+
if (!this.element)
|
|
203
|
+
return;
|
|
204
|
+
const r = this.getProjection().fromLatLngToDivPixel(this.getPosition());
|
|
205
|
+
if (r) {
|
|
206
|
+
this.element.style.position = "absolute";
|
|
207
|
+
const n = this.element.offsetHeight, a = this.element.offsetWidth;
|
|
208
|
+
let c, i;
|
|
209
|
+
switch (this.opts.anchorPoint) {
|
|
210
|
+
case "TOP_CENTER":
|
|
211
|
+
c = r.x - a / 2, i = r.y;
|
|
212
|
+
break;
|
|
213
|
+
case "BOTTOM_CENTER":
|
|
214
|
+
c = r.x - a / 2, i = r.y - n;
|
|
215
|
+
break;
|
|
216
|
+
case "LEFT_CENTER":
|
|
217
|
+
c = r.x, i = r.y - n / 2;
|
|
218
|
+
break;
|
|
219
|
+
case "RIGHT_CENTER":
|
|
220
|
+
c = r.x - a, i = r.y - n / 2;
|
|
221
|
+
break;
|
|
222
|
+
case "TOP_LEFT":
|
|
223
|
+
c = r.x, i = r.y;
|
|
224
|
+
break;
|
|
225
|
+
case "TOP_RIGHT":
|
|
226
|
+
c = r.x - a, i = r.y;
|
|
227
|
+
break;
|
|
228
|
+
case "BOTTOM_LEFT":
|
|
229
|
+
c = r.x, i = r.y - n;
|
|
230
|
+
break;
|
|
231
|
+
case "BOTTOM_RIGHT":
|
|
232
|
+
c = r.x - a, i = r.y - n;
|
|
233
|
+
break;
|
|
234
|
+
default:
|
|
235
|
+
c = r.x - a / 2, i = r.y - n / 2;
|
|
236
|
+
}
|
|
237
|
+
this.element.style.left = c + "px", this.element.style.top = i + "px", this.element.style.transform = `translateX(${this.opts.offsetX || 0}px) translateY(${this.opts.offsetY || 0}px)`, this.opts.zIndex && (this.element.style.zIndex = this.opts.zIndex.toString());
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
onRemove() {
|
|
241
|
+
this.element && this.element.remove();
|
|
242
|
+
}
|
|
243
|
+
setOptions(s) {
|
|
244
|
+
this.opts = s, this.draw();
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
let de;
|
|
249
|
+
const he = [
|
|
250
|
+
"bounds_changed",
|
|
251
|
+
"center_changed",
|
|
252
|
+
"click",
|
|
253
|
+
"dblclick",
|
|
254
|
+
"drag",
|
|
255
|
+
"dragend",
|
|
256
|
+
"dragstart",
|
|
257
|
+
"heading_changed",
|
|
258
|
+
"idle",
|
|
259
|
+
"maptypeid_changed",
|
|
260
|
+
"mousemove",
|
|
261
|
+
"mouseout",
|
|
262
|
+
"mouseover",
|
|
263
|
+
"projection_changed",
|
|
264
|
+
"resize",
|
|
265
|
+
"rightclick",
|
|
266
|
+
"tilesloaded",
|
|
267
|
+
"tilt_changed",
|
|
268
|
+
"zoom_changed"
|
|
269
|
+
], ze = M({
|
|
270
|
+
props: {
|
|
271
|
+
apiPromise: {
|
|
272
|
+
type: Promise
|
|
273
|
+
},
|
|
274
|
+
apiKey: {
|
|
275
|
+
type: String,
|
|
276
|
+
default: ""
|
|
277
|
+
},
|
|
278
|
+
version: {
|
|
279
|
+
type: String,
|
|
280
|
+
default: "weekly"
|
|
281
|
+
},
|
|
282
|
+
libraries: {
|
|
283
|
+
type: Array,
|
|
284
|
+
default: () => ["places"]
|
|
285
|
+
},
|
|
286
|
+
region: {
|
|
287
|
+
type: String,
|
|
288
|
+
required: !1
|
|
289
|
+
},
|
|
290
|
+
language: {
|
|
291
|
+
type: String,
|
|
292
|
+
required: !1
|
|
293
|
+
},
|
|
294
|
+
backgroundColor: {
|
|
295
|
+
type: String,
|
|
296
|
+
required: !1
|
|
297
|
+
},
|
|
298
|
+
center: {
|
|
299
|
+
type: Object,
|
|
300
|
+
default: () => ({ lat: 0, lng: 0 })
|
|
301
|
+
},
|
|
302
|
+
clickableIcons: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
required: !1,
|
|
305
|
+
default: void 0
|
|
306
|
+
},
|
|
307
|
+
controlSize: {
|
|
308
|
+
type: Number,
|
|
309
|
+
required: !1
|
|
310
|
+
},
|
|
311
|
+
disableDefaultUi: {
|
|
312
|
+
type: Boolean,
|
|
313
|
+
required: !1,
|
|
314
|
+
default: void 0
|
|
315
|
+
},
|
|
316
|
+
disableDoubleClickZoom: {
|
|
317
|
+
type: Boolean,
|
|
318
|
+
required: !1,
|
|
319
|
+
default: void 0
|
|
320
|
+
},
|
|
321
|
+
draggable: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
required: !1,
|
|
324
|
+
default: void 0
|
|
325
|
+
},
|
|
326
|
+
draggableCursor: {
|
|
327
|
+
type: String,
|
|
328
|
+
required: !1
|
|
329
|
+
},
|
|
330
|
+
draggingCursor: {
|
|
331
|
+
type: String,
|
|
332
|
+
required: !1
|
|
333
|
+
},
|
|
334
|
+
fullscreenControl: {
|
|
335
|
+
type: Boolean,
|
|
336
|
+
required: !1,
|
|
337
|
+
default: void 0
|
|
338
|
+
},
|
|
339
|
+
fullscreenControlPosition: {
|
|
340
|
+
type: String,
|
|
341
|
+
required: !1
|
|
342
|
+
},
|
|
343
|
+
gestureHandling: {
|
|
344
|
+
type: String,
|
|
345
|
+
required: !1
|
|
346
|
+
},
|
|
347
|
+
heading: {
|
|
348
|
+
type: Number,
|
|
349
|
+
required: !1
|
|
350
|
+
},
|
|
351
|
+
keyboardShortcuts: {
|
|
352
|
+
type: Boolean,
|
|
353
|
+
required: !1,
|
|
354
|
+
default: void 0
|
|
355
|
+
},
|
|
356
|
+
mapTypeControl: {
|
|
357
|
+
type: Boolean,
|
|
358
|
+
required: !1,
|
|
359
|
+
default: void 0
|
|
360
|
+
},
|
|
361
|
+
mapTypeControlOptions: {
|
|
362
|
+
type: Object,
|
|
363
|
+
required: !1
|
|
364
|
+
},
|
|
365
|
+
mapTypeId: {
|
|
366
|
+
type: [Number, String],
|
|
367
|
+
required: !1
|
|
368
|
+
},
|
|
369
|
+
mapId: {
|
|
370
|
+
type: String,
|
|
371
|
+
required: !1
|
|
372
|
+
},
|
|
373
|
+
maxZoom: {
|
|
374
|
+
type: Number,
|
|
375
|
+
required: !1
|
|
376
|
+
},
|
|
377
|
+
minZoom: {
|
|
378
|
+
type: Number,
|
|
379
|
+
required: !1
|
|
380
|
+
},
|
|
381
|
+
noClear: {
|
|
382
|
+
type: Boolean,
|
|
383
|
+
required: !1,
|
|
384
|
+
default: void 0
|
|
385
|
+
},
|
|
386
|
+
panControl: {
|
|
387
|
+
type: Boolean,
|
|
388
|
+
required: !1,
|
|
389
|
+
default: void 0
|
|
390
|
+
},
|
|
391
|
+
panControlPosition: {
|
|
392
|
+
type: String,
|
|
393
|
+
required: !1
|
|
394
|
+
},
|
|
395
|
+
restriction: {
|
|
396
|
+
type: Object,
|
|
397
|
+
required: !1
|
|
398
|
+
},
|
|
399
|
+
rotateControl: {
|
|
400
|
+
type: Boolean,
|
|
401
|
+
required: !1,
|
|
402
|
+
default: void 0
|
|
403
|
+
},
|
|
404
|
+
rotateControlPosition: {
|
|
405
|
+
type: String,
|
|
406
|
+
required: !1
|
|
407
|
+
},
|
|
408
|
+
scaleControl: {
|
|
409
|
+
type: Boolean,
|
|
410
|
+
required: !1,
|
|
411
|
+
default: void 0
|
|
412
|
+
},
|
|
413
|
+
scaleControlStyle: {
|
|
414
|
+
type: Number,
|
|
415
|
+
required: !1
|
|
416
|
+
},
|
|
417
|
+
scrollwheel: {
|
|
418
|
+
type: Boolean,
|
|
419
|
+
required: !1,
|
|
420
|
+
default: void 0
|
|
421
|
+
},
|
|
422
|
+
streetView: {
|
|
423
|
+
type: Object,
|
|
424
|
+
required: !1
|
|
425
|
+
},
|
|
426
|
+
streetViewControl: {
|
|
427
|
+
type: Boolean,
|
|
428
|
+
required: !1,
|
|
429
|
+
default: void 0
|
|
430
|
+
},
|
|
431
|
+
streetViewControlPosition: {
|
|
432
|
+
type: String,
|
|
433
|
+
required: !1
|
|
434
|
+
},
|
|
435
|
+
styles: {
|
|
436
|
+
type: Array,
|
|
437
|
+
required: !1
|
|
438
|
+
},
|
|
439
|
+
tilt: {
|
|
440
|
+
type: Number,
|
|
441
|
+
required: !1
|
|
442
|
+
},
|
|
443
|
+
zoom: {
|
|
444
|
+
type: Number,
|
|
445
|
+
required: !1
|
|
446
|
+
},
|
|
447
|
+
zoomControl: {
|
|
448
|
+
type: Boolean,
|
|
449
|
+
required: !1,
|
|
450
|
+
default: void 0
|
|
451
|
+
},
|
|
452
|
+
zoomControlPosition: {
|
|
453
|
+
type: String,
|
|
454
|
+
required: !1
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
emits: he,
|
|
458
|
+
setup(o, { emit: e }) {
|
|
459
|
+
const t = v(), s = v(!1), r = v(), n = v(), a = v(!1);
|
|
460
|
+
z(q, r), z(R, n), z(Le, a);
|
|
461
|
+
const c = () => {
|
|
462
|
+
const l = { ...o };
|
|
463
|
+
Object.keys(l).forEach((m) => {
|
|
464
|
+
l[m] === void 0 && delete l[m];
|
|
465
|
+
});
|
|
466
|
+
const p = (m) => {
|
|
467
|
+
var g;
|
|
468
|
+
return m ? { position: (g = n.value) == null ? void 0 : g.ControlPosition[m] } : {};
|
|
469
|
+
}, f = {
|
|
470
|
+
scaleControlOptions: o.scaleControlStyle ? { style: o.scaleControlStyle } : {},
|
|
471
|
+
panControlOptions: p(o.panControlPosition),
|
|
472
|
+
zoomControlOptions: p(o.zoomControlPosition),
|
|
473
|
+
rotateControlOptions: p(o.rotateControlPosition),
|
|
474
|
+
streetViewControlOptions: p(o.streetViewControlPosition),
|
|
475
|
+
fullscreenControlOptions: p(o.fullscreenControlPosition),
|
|
476
|
+
disableDefaultUI: o.disableDefaultUi
|
|
477
|
+
};
|
|
478
|
+
return { ...l, ...f };
|
|
479
|
+
}, i = O(
|
|
480
|
+
[n, r],
|
|
481
|
+
([l, h]) => {
|
|
482
|
+
const p = l, f = h;
|
|
483
|
+
p && f && (p.event.addListenerOnce(f, "tilesloaded", () => {
|
|
484
|
+
a.value = !0;
|
|
485
|
+
}), setTimeout(i, 0));
|
|
486
|
+
},
|
|
487
|
+
{ immediate: !0 }
|
|
488
|
+
), d = () => {
|
|
489
|
+
try {
|
|
490
|
+
const { apiKey: l, region: h, version: p, language: f, libraries: m } = o;
|
|
491
|
+
de = new S({ apiKey: l, region: h, version: p, language: f, libraries: m });
|
|
492
|
+
} catch (l) {
|
|
493
|
+
console.error(l);
|
|
494
|
+
}
|
|
495
|
+
}, u = (l) => {
|
|
496
|
+
n.value = E(l.maps), r.value = E(new l.maps.Map(t.value, c()));
|
|
497
|
+
const h = Ue(n.value);
|
|
498
|
+
n.value[Q] = h, he.forEach((f) => {
|
|
499
|
+
var m;
|
|
500
|
+
(m = r.value) == null || m.addListener(f, (g) => e(f, g));
|
|
501
|
+
}), s.value = !0;
|
|
502
|
+
const p = Object.keys(o).filter(
|
|
503
|
+
(f) => !["apiPromise", "apiKey", "version", "libraries", "region", "language", "center", "zoom"].includes(f)
|
|
504
|
+
).map((f) => B(o, f));
|
|
505
|
+
O(
|
|
506
|
+
[() => o.center, () => o.zoom, ...p],
|
|
507
|
+
([f, m], [g, y]) => {
|
|
508
|
+
var G, b, F;
|
|
509
|
+
const { center: w, zoom: C, ...T } = c();
|
|
510
|
+
(G = r.value) == null || G.setOptions(T), m !== void 0 && m !== y && ((b = r.value) == null || b.setZoom(m));
|
|
511
|
+
const N = !g || f.lng !== g.lng || f.lat !== g.lat;
|
|
512
|
+
f && N && ((F = r.value) == null || F.panTo(f));
|
|
513
|
+
}
|
|
514
|
+
);
|
|
515
|
+
};
|
|
516
|
+
return Me(() => {
|
|
517
|
+
o.apiPromise && o.apiPromise instanceof Promise ? o.apiPromise.then(u) : (d(), de.load().then(u));
|
|
518
|
+
}), j(() => {
|
|
519
|
+
var l;
|
|
520
|
+
a.value = !1, r.value && ((l = n.value) == null || l.event.clearInstanceListeners(r.value));
|
|
521
|
+
}), { mapRef: t, ready: s, map: r, api: n, mapTilesLoaded: a };
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
const ee = (o, e) => {
|
|
525
|
+
const t = o.__vccOpts || o;
|
|
526
|
+
for (const [s, r] of e)
|
|
527
|
+
t[s] = r;
|
|
528
|
+
return t;
|
|
529
|
+
}, Ve = {
|
|
530
|
+
ref: "mapRef",
|
|
531
|
+
class: "mapdiv"
|
|
532
|
+
};
|
|
533
|
+
function Ge(o, e, t, s, r, n) {
|
|
534
|
+
return J(), Y("div", null, [
|
|
535
|
+
ie("div", Ve, null, 512),
|
|
536
|
+
X(o.$slots, "default", Re(Ze({ ready: o.ready, map: o.map, api: o.api, mapTilesLoaded: o.mapTilesLoaded })), void 0, !0)
|
|
537
|
+
]);
|
|
538
|
+
}
|
|
539
|
+
const Ot = /* @__PURE__ */ ee(ze, [["render", Ge], ["__scopeId", "data-v-7d660dd5"]]);
|
|
540
|
+
function He(o) {
|
|
541
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
542
|
+
}
|
|
543
|
+
var We = function o(e, t) {
|
|
544
|
+
if (e === t)
|
|
545
|
+
return !0;
|
|
546
|
+
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
547
|
+
if (e.constructor !== t.constructor)
|
|
548
|
+
return !1;
|
|
549
|
+
var s, r, n;
|
|
550
|
+
if (Array.isArray(e)) {
|
|
551
|
+
if (s = e.length, s != t.length)
|
|
552
|
+
return !1;
|
|
553
|
+
for (r = s; r-- !== 0; )
|
|
554
|
+
if (!o(e[r], t[r]))
|
|
555
|
+
return !1;
|
|
556
|
+
return !0;
|
|
557
|
+
}
|
|
558
|
+
if (e.constructor === RegExp)
|
|
559
|
+
return e.source === t.source && e.flags === t.flags;
|
|
560
|
+
if (e.valueOf !== Object.prototype.valueOf)
|
|
561
|
+
return e.valueOf() === t.valueOf();
|
|
562
|
+
if (e.toString !== Object.prototype.toString)
|
|
563
|
+
return e.toString() === t.toString();
|
|
564
|
+
if (n = Object.keys(e), s = n.length, s !== Object.keys(t).length)
|
|
565
|
+
return !1;
|
|
566
|
+
for (r = s; r-- !== 0; )
|
|
567
|
+
if (!Object.prototype.hasOwnProperty.call(t, n[r]))
|
|
568
|
+
return !1;
|
|
569
|
+
for (r = s; r-- !== 0; ) {
|
|
570
|
+
var a = n[r];
|
|
571
|
+
if (!o(e[a], t[a]))
|
|
572
|
+
return !1;
|
|
573
|
+
}
|
|
574
|
+
return !0;
|
|
575
|
+
}
|
|
576
|
+
return e !== e && t !== t;
|
|
577
|
+
};
|
|
578
|
+
const A = /* @__PURE__ */ He(We), Ke = (o) => o === "Marker", Je = (o) => o === Q, Z = (o, e, t, s) => {
|
|
579
|
+
const r = v(), n = _(q, v()), a = _(R, v()), c = _(Ee, v()), i = K(
|
|
580
|
+
() => !!(c.value && a.value && (r.value instanceof a.value.Marker || r.value instanceof a.value[Q]))
|
|
581
|
+
);
|
|
582
|
+
return O(
|
|
583
|
+
[n, t],
|
|
584
|
+
(d, [u, l]) => {
|
|
585
|
+
var p, f, m;
|
|
586
|
+
const h = !A(t.value, l) || n.value !== u;
|
|
587
|
+
!n.value || !a.value || !h || (r.value ? (r.value.setOptions(t.value), i.value && ((p = c.value) == null || p.removeMarker(r.value), (f = c.value) == null || f.addMarker(r.value))) : (Ke(o) ? r.value = E(
|
|
588
|
+
new a.value[o](t.value)
|
|
589
|
+
) : Je(o) ? r.value = E(
|
|
590
|
+
new a.value[o](t.value)
|
|
591
|
+
) : r.value = E(
|
|
592
|
+
new a.value[o]({
|
|
593
|
+
...t.value,
|
|
594
|
+
map: n.value
|
|
595
|
+
})
|
|
596
|
+
), i.value ? (m = c.value) == null || m.addMarker(r.value) : r.value.setMap(n.value), e.forEach((g) => {
|
|
597
|
+
var y;
|
|
598
|
+
(y = r.value) == null || y.addListener(g, (w) => s(g, w));
|
|
599
|
+
})));
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
immediate: !0
|
|
603
|
+
}
|
|
604
|
+
), j(() => {
|
|
605
|
+
var d, u;
|
|
606
|
+
r.value && ((d = a.value) == null || d.event.clearInstanceListeners(r.value), i.value ? (u = c.value) == null || u.removeMarker(r.value) : r.value.setMap(null));
|
|
607
|
+
}), r;
|
|
608
|
+
}, pe = [
|
|
609
|
+
"animation_changed",
|
|
610
|
+
"click",
|
|
611
|
+
"dblclick",
|
|
612
|
+
"rightclick",
|
|
613
|
+
"dragstart",
|
|
614
|
+
"dragend",
|
|
615
|
+
"drag",
|
|
616
|
+
"mouseover",
|
|
617
|
+
"mousedown",
|
|
618
|
+
"mouseout",
|
|
619
|
+
"mouseup",
|
|
620
|
+
"draggable_changed",
|
|
621
|
+
"clickable_changed",
|
|
622
|
+
"contextmenu",
|
|
623
|
+
"cursor_changed",
|
|
624
|
+
"flat_changed",
|
|
625
|
+
"rightclick",
|
|
626
|
+
"zindex_changed",
|
|
627
|
+
"icon_changed",
|
|
628
|
+
"position_changed",
|
|
629
|
+
"shape_changed",
|
|
630
|
+
"title_changed",
|
|
631
|
+
"visible_changed"
|
|
632
|
+
], Pt = M({
|
|
633
|
+
name: "Marker",
|
|
634
|
+
props: {
|
|
635
|
+
options: {
|
|
636
|
+
type: Object,
|
|
637
|
+
required: !0
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
emits: pe,
|
|
641
|
+
setup(o, { emit: e, expose: t, slots: s }) {
|
|
642
|
+
const r = B(o, "options"), n = Z("Marker", pe, r, e);
|
|
643
|
+
return z(xe, n), t({ marker: n }), () => {
|
|
644
|
+
var a;
|
|
645
|
+
return (a = s.default) == null ? void 0 : a.call(s);
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
}), xt = M({
|
|
649
|
+
name: "Polyline",
|
|
650
|
+
props: {
|
|
651
|
+
options: {
|
|
652
|
+
type: Object,
|
|
653
|
+
required: !0
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
emits: $,
|
|
657
|
+
setup(o, { emit: e }) {
|
|
658
|
+
const t = B(o, "options");
|
|
659
|
+
return { polyline: Z("Polyline", $, t, e) };
|
|
660
|
+
},
|
|
661
|
+
render: () => null
|
|
662
|
+
}), Et = M({
|
|
663
|
+
name: "Polygon",
|
|
664
|
+
props: {
|
|
665
|
+
options: {
|
|
666
|
+
type: Object,
|
|
667
|
+
required: !0
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
emits: $,
|
|
671
|
+
setup(o, { emit: e }) {
|
|
672
|
+
const t = B(o, "options");
|
|
673
|
+
return { polygon: Z("Polygon", $, t, e) };
|
|
674
|
+
},
|
|
675
|
+
render: () => null
|
|
676
|
+
}), fe = $.concat(["bounds_changed"]), Lt = M({
|
|
677
|
+
name: "Rectangle",
|
|
678
|
+
props: {
|
|
679
|
+
options: {
|
|
680
|
+
type: Object,
|
|
681
|
+
required: !0
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
emits: fe,
|
|
685
|
+
setup(o, { emit: e }) {
|
|
686
|
+
const t = B(o, "options");
|
|
687
|
+
return { rectangle: Z("Rectangle", fe, t, e) };
|
|
688
|
+
},
|
|
689
|
+
render: () => null
|
|
690
|
+
}), me = $.concat(["center_changed", "radius_changed"]), St = M({
|
|
691
|
+
name: "Circle",
|
|
692
|
+
props: {
|
|
693
|
+
options: {
|
|
694
|
+
type: Object,
|
|
695
|
+
required: !0
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
emits: me,
|
|
699
|
+
setup(o, { emit: e }) {
|
|
700
|
+
const t = B(o, "options");
|
|
701
|
+
return { circle: Z("Circle", me, t, e) };
|
|
702
|
+
},
|
|
703
|
+
render: () => null
|
|
704
|
+
}), Ye = M({
|
|
705
|
+
props: {
|
|
706
|
+
position: {
|
|
707
|
+
type: String,
|
|
708
|
+
required: !0
|
|
709
|
+
},
|
|
710
|
+
index: {
|
|
711
|
+
type: Number,
|
|
712
|
+
default: 1
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
emits: ["content:loaded"],
|
|
716
|
+
setup(o, { emit: e }) {
|
|
717
|
+
const t = v(null), s = _(q, v()), r = _(R, v()), n = _(Le, v(!1)), a = v(!1), c = O(
|
|
718
|
+
[n, r, t],
|
|
719
|
+
([u, l, h]) => {
|
|
720
|
+
l && u && h && (i(o.position), a.value = !0, e("content:loaded"), setTimeout(c, 0));
|
|
721
|
+
},
|
|
722
|
+
{ immediate: !0 }
|
|
723
|
+
), i = (u) => {
|
|
724
|
+
if (s.value && r.value && t.value) {
|
|
725
|
+
const l = r.value.ControlPosition[u];
|
|
726
|
+
s.value.controls[l].push(t.value);
|
|
727
|
+
}
|
|
728
|
+
}, d = (u) => {
|
|
729
|
+
if (s.value && r.value) {
|
|
730
|
+
let l = null;
|
|
731
|
+
const h = r.value.ControlPosition[u];
|
|
732
|
+
s.value.controls[h].forEach((p, f) => {
|
|
733
|
+
p === t.value && (l = f);
|
|
734
|
+
}), l !== null && s.value.controls[h].removeAt(l);
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
return j(() => d(o.position)), O(
|
|
738
|
+
() => o.position,
|
|
739
|
+
(u, l) => {
|
|
740
|
+
d(l), i(u);
|
|
741
|
+
}
|
|
742
|
+
), O(
|
|
743
|
+
() => o.index,
|
|
744
|
+
(u) => {
|
|
745
|
+
u && t.value && (t.value.index = o.index);
|
|
746
|
+
}
|
|
747
|
+
), { controlRef: t, showContent: a };
|
|
748
|
+
}
|
|
749
|
+
}), Xe = { ref: "controlRef" };
|
|
750
|
+
function Qe(o, e, t, s, r, n) {
|
|
751
|
+
return Ne((J(), Y("div", Xe, [
|
|
752
|
+
X(o.$slots, "default")
|
|
753
|
+
], 512)), [
|
|
754
|
+
[Fe, o.showContent]
|
|
755
|
+
]);
|
|
756
|
+
}
|
|
757
|
+
const At = /* @__PURE__ */ ee(Ye, [["render", Qe]]), ge = ["closeclick", "content_changed", "domready", "position_changed", "visible", "zindex_changed"], et = M({
|
|
758
|
+
inheritAttrs: !1,
|
|
759
|
+
props: {
|
|
760
|
+
options: {
|
|
761
|
+
type: Object,
|
|
762
|
+
default: () => ({})
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
emits: ge,
|
|
766
|
+
setup(o, { slots: e, emit: t, expose: s }) {
|
|
767
|
+
const r = v(), n = v(), a = _(q, v()), c = _(R, v()), i = _(xe, v());
|
|
768
|
+
let d;
|
|
769
|
+
const u = K(() => {
|
|
770
|
+
var p;
|
|
771
|
+
return (p = e.default) == null ? void 0 : p.call(e).some((f) => f.type !== be);
|
|
772
|
+
}), l = (p) => {
|
|
773
|
+
var f;
|
|
774
|
+
return (f = r.value) == null ? void 0 : f.open({ map: a.value, anchor: i.value, ...p });
|
|
775
|
+
}, h = () => {
|
|
776
|
+
var p;
|
|
777
|
+
return (p = r.value) == null ? void 0 : p.close();
|
|
778
|
+
};
|
|
779
|
+
return Me(() => {
|
|
780
|
+
O(
|
|
781
|
+
[a, () => o.options],
|
|
782
|
+
([p, f], [m, g]) => {
|
|
783
|
+
const y = !A(f, g) || a.value !== m;
|
|
784
|
+
a.value && c.value && y && (r.value ? (r.value.setOptions({
|
|
785
|
+
...f,
|
|
786
|
+
content: u.value ? n.value : f.content
|
|
787
|
+
}), i.value || l()) : (r.value = E(
|
|
788
|
+
new c.value.InfoWindow({
|
|
789
|
+
...f,
|
|
790
|
+
content: u.value ? n.value : f.content
|
|
791
|
+
})
|
|
792
|
+
), i.value ? d = i.value.addListener("click", () => {
|
|
793
|
+
l();
|
|
794
|
+
}) : l(), ge.forEach((w) => {
|
|
795
|
+
var C;
|
|
796
|
+
(C = r.value) == null || C.addListener(w, (T) => t(w, T));
|
|
797
|
+
})));
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
immediate: !0
|
|
801
|
+
}
|
|
802
|
+
);
|
|
803
|
+
}), j(() => {
|
|
804
|
+
var p;
|
|
805
|
+
d && d.remove(), r.value && ((p = c.value) == null || p.event.clearInstanceListeners(r.value), h());
|
|
806
|
+
}), s({ infoWindow: r, open: l, close: h }), { infoWindow: r, infoWindowRef: n, hasSlotContent: u, open: l, close: h };
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
const tt = {
|
|
810
|
+
key: 0,
|
|
811
|
+
class: "info-window-wrapper"
|
|
812
|
+
};
|
|
813
|
+
function st(o, e, t, s, r, n) {
|
|
814
|
+
return o.hasSlotContent ? (J(), Y("div", tt, [
|
|
815
|
+
ie("div", Oe({ ref: "infoWindowRef" }, o.$attrs), [
|
|
816
|
+
X(o.$slots, "default", {}, void 0, !0)
|
|
817
|
+
], 16)
|
|
818
|
+
])) : Pe("", !0);
|
|
819
|
+
}
|
|
820
|
+
const Tt = /* @__PURE__ */ ee(et, [["render", st], ["__scopeId", "data-v-45a4606d"]]), ve = [
|
|
821
|
+
Int8Array,
|
|
822
|
+
Uint8Array,
|
|
823
|
+
Uint8ClampedArray,
|
|
824
|
+
Int16Array,
|
|
825
|
+
Uint16Array,
|
|
826
|
+
Int32Array,
|
|
827
|
+
Uint32Array,
|
|
828
|
+
Float32Array,
|
|
829
|
+
Float64Array
|
|
830
|
+
], se = 1, D = 8;
|
|
831
|
+
class ae {
|
|
832
|
+
/**
|
|
833
|
+
* Creates an index from raw `ArrayBuffer` data.
|
|
834
|
+
* @param {ArrayBuffer} data
|
|
835
|
+
*/
|
|
836
|
+
static from(e) {
|
|
837
|
+
if (!(e instanceof ArrayBuffer))
|
|
838
|
+
throw new Error("Data must be an instance of ArrayBuffer.");
|
|
839
|
+
const [t, s] = new Uint8Array(e, 0, 2);
|
|
840
|
+
if (t !== 219)
|
|
841
|
+
throw new Error("Data does not appear to be in a KDBush format.");
|
|
842
|
+
const r = s >> 4;
|
|
843
|
+
if (r !== se)
|
|
844
|
+
throw new Error(`Got v${r} data when expected v${se}.`);
|
|
845
|
+
const n = ve[s & 15];
|
|
846
|
+
if (!n)
|
|
847
|
+
throw new Error("Unrecognized array type.");
|
|
848
|
+
const [a] = new Uint16Array(e, 2, 1), [c] = new Uint32Array(e, 4, 1);
|
|
849
|
+
return new ae(c, a, n, e);
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Creates an index that will hold a given number of items.
|
|
853
|
+
* @param {number} numItems
|
|
854
|
+
* @param {number} [nodeSize=64] Size of the KD-tree node (64 by default).
|
|
855
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
856
|
+
* @param {ArrayBuffer} [data] (For internal use only)
|
|
857
|
+
*/
|
|
858
|
+
constructor(e, t = 64, s = Float64Array, r) {
|
|
859
|
+
if (isNaN(e) || e < 0)
|
|
860
|
+
throw new Error(`Unpexpected numItems value: ${e}.`);
|
|
861
|
+
this.numItems = +e, this.nodeSize = Math.min(Math.max(+t, 2), 65535), this.ArrayType = s, this.IndexArrayType = e < 65536 ? Uint16Array : Uint32Array;
|
|
862
|
+
const n = ve.indexOf(this.ArrayType), a = e * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = e * this.IndexArrayType.BYTES_PER_ELEMENT, i = (8 - c % 8) % 8;
|
|
863
|
+
if (n < 0)
|
|
864
|
+
throw new Error(`Unexpected typed array class: ${s}.`);
|
|
865
|
+
r && r instanceof ArrayBuffer ? (this.data = r, this.ids = new this.IndexArrayType(this.data, D, e), this.coords = new this.ArrayType(this.data, D + c + i, e * 2), this._pos = e * 2, this._finished = !0) : (this.data = new ArrayBuffer(D + a + c + i), this.ids = new this.IndexArrayType(this.data, D, e), this.coords = new this.ArrayType(this.data, D + c + i, e * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (se << 4) + n]), new Uint16Array(this.data, 2, 1)[0] = t, new Uint32Array(this.data, 4, 1)[0] = e);
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Add a point to the index.
|
|
869
|
+
* @param {number} x
|
|
870
|
+
* @param {number} y
|
|
871
|
+
* @returns {number} An incremental index associated with the added item (starting from `0`).
|
|
872
|
+
*/
|
|
873
|
+
add(e, t) {
|
|
874
|
+
const s = this._pos >> 1;
|
|
875
|
+
return this.ids[s] = s, this.coords[this._pos++] = e, this.coords[this._pos++] = t, s;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Perform indexing of the added points.
|
|
879
|
+
*/
|
|
880
|
+
finish() {
|
|
881
|
+
const e = this._pos >> 1;
|
|
882
|
+
if (e !== this.numItems)
|
|
883
|
+
throw new Error(`Added ${e} items when expected ${this.numItems}.`);
|
|
884
|
+
return ne(this.ids, this.coords, this.nodeSize, 0, this.numItems - 1, 0), this._finished = !0, this;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Search the index for items within a given bounding box.
|
|
888
|
+
* @param {number} minX
|
|
889
|
+
* @param {number} minY
|
|
890
|
+
* @param {number} maxX
|
|
891
|
+
* @param {number} maxY
|
|
892
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
893
|
+
*/
|
|
894
|
+
range(e, t, s, r) {
|
|
895
|
+
if (!this._finished)
|
|
896
|
+
throw new Error("Data not yet indexed - call index.finish().");
|
|
897
|
+
const { ids: n, coords: a, nodeSize: c } = this, i = [0, n.length - 1, 0], d = [];
|
|
898
|
+
for (; i.length; ) {
|
|
899
|
+
const u = i.pop() || 0, l = i.pop() || 0, h = i.pop() || 0;
|
|
900
|
+
if (l - h <= c) {
|
|
901
|
+
for (let g = h; g <= l; g++) {
|
|
902
|
+
const y = a[2 * g], w = a[2 * g + 1];
|
|
903
|
+
y >= e && y <= s && w >= t && w <= r && d.push(n[g]);
|
|
904
|
+
}
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
const p = h + l >> 1, f = a[2 * p], m = a[2 * p + 1];
|
|
908
|
+
f >= e && f <= s && m >= t && m <= r && d.push(n[p]), (u === 0 ? e <= f : t <= m) && (i.push(h), i.push(p - 1), i.push(1 - u)), (u === 0 ? s >= f : r >= m) && (i.push(p + 1), i.push(l), i.push(1 - u));
|
|
909
|
+
}
|
|
910
|
+
return d;
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Search the index for items within a given radius.
|
|
914
|
+
* @param {number} qx
|
|
915
|
+
* @param {number} qy
|
|
916
|
+
* @param {number} r Query radius.
|
|
917
|
+
* @returns {number[]} An array of indices correponding to the found items.
|
|
918
|
+
*/
|
|
919
|
+
within(e, t, s) {
|
|
920
|
+
if (!this._finished)
|
|
921
|
+
throw new Error("Data not yet indexed - call index.finish().");
|
|
922
|
+
const { ids: r, coords: n, nodeSize: a } = this, c = [0, r.length - 1, 0], i = [], d = s * s;
|
|
923
|
+
for (; c.length; ) {
|
|
924
|
+
const u = c.pop() || 0, l = c.pop() || 0, h = c.pop() || 0;
|
|
925
|
+
if (l - h <= a) {
|
|
926
|
+
for (let g = h; g <= l; g++)
|
|
927
|
+
ye(n[2 * g], n[2 * g + 1], e, t) <= d && i.push(r[g]);
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
const p = h + l >> 1, f = n[2 * p], m = n[2 * p + 1];
|
|
931
|
+
ye(f, m, e, t) <= d && i.push(r[p]), (u === 0 ? e - s <= f : t - s <= m) && (c.push(h), c.push(p - 1), c.push(1 - u)), (u === 0 ? e + s >= f : t + s >= m) && (c.push(p + 1), c.push(l), c.push(1 - u));
|
|
932
|
+
}
|
|
933
|
+
return i;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function ne(o, e, t, s, r, n) {
|
|
937
|
+
if (r - s <= t)
|
|
938
|
+
return;
|
|
939
|
+
const a = s + r >> 1;
|
|
940
|
+
Se(o, e, a, s, r, n), ne(o, e, t, s, a - 1, 1 - n), ne(o, e, t, a + 1, r, 1 - n);
|
|
941
|
+
}
|
|
942
|
+
function Se(o, e, t, s, r, n) {
|
|
943
|
+
for (; r > s; ) {
|
|
944
|
+
if (r - s > 600) {
|
|
945
|
+
const d = r - s + 1, u = t - s + 1, l = Math.log(d), h = 0.5 * Math.exp(2 * l / 3), p = 0.5 * Math.sqrt(l * h * (d - h) / d) * (u - d / 2 < 0 ? -1 : 1), f = Math.max(s, Math.floor(t - u * h / d + p)), m = Math.min(r, Math.floor(t + (d - u) * h / d + p));
|
|
946
|
+
Se(o, e, t, f, m, n);
|
|
947
|
+
}
|
|
948
|
+
const a = e[2 * t + n];
|
|
949
|
+
let c = s, i = r;
|
|
950
|
+
for (U(o, e, s, t), e[2 * r + n] > a && U(o, e, s, r); c < i; ) {
|
|
951
|
+
for (U(o, e, c, i), c++, i--; e[2 * c + n] < a; )
|
|
952
|
+
c++;
|
|
953
|
+
for (; e[2 * i + n] > a; )
|
|
954
|
+
i--;
|
|
955
|
+
}
|
|
956
|
+
e[2 * s + n] === a ? U(o, e, s, i) : (i++, U(o, e, i, r)), i <= t && (s = i + 1), t <= i && (r = i - 1);
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
function U(o, e, t, s) {
|
|
960
|
+
re(o, t, s), re(e, 2 * t, 2 * s), re(e, 2 * t + 1, 2 * s + 1);
|
|
961
|
+
}
|
|
962
|
+
function re(o, e, t) {
|
|
963
|
+
const s = o[e];
|
|
964
|
+
o[e] = o[t], o[t] = s;
|
|
965
|
+
}
|
|
966
|
+
function ye(o, e, t, s) {
|
|
967
|
+
const r = o - t, n = e - s;
|
|
968
|
+
return r * r + n * n;
|
|
969
|
+
}
|
|
970
|
+
const rt = {
|
|
971
|
+
minZoom: 0,
|
|
972
|
+
// min zoom to generate clusters on
|
|
973
|
+
maxZoom: 16,
|
|
974
|
+
// max zoom level to cluster the points on
|
|
975
|
+
minPoints: 2,
|
|
976
|
+
// minimum points to form a cluster
|
|
977
|
+
radius: 40,
|
|
978
|
+
// cluster radius in pixels
|
|
979
|
+
extent: 512,
|
|
980
|
+
// tile extent (radius is calculated relative to it)
|
|
981
|
+
nodeSize: 64,
|
|
982
|
+
// size of the KD-tree leaf node, affects performance
|
|
983
|
+
log: !1,
|
|
984
|
+
// whether to log timing info
|
|
985
|
+
// whether to generate numeric ids for input features (in vector tiles)
|
|
986
|
+
generateId: !1,
|
|
987
|
+
// a reduce function for calculating custom cluster properties
|
|
988
|
+
reduce: null,
|
|
989
|
+
// (accumulated, props) => { accumulated.sum += props.sum; }
|
|
990
|
+
// properties to use for individual points when running the reducer
|
|
991
|
+
map: (o) => o
|
|
992
|
+
// props => ({sum: props.my_value})
|
|
993
|
+
}, we = Math.fround || ((o) => (e) => (o[0] = +e, o[0]))(new Float32Array(1)), L = 2, x = 3, oe = 4, P = 5, Ae = 6;
|
|
994
|
+
class Te {
|
|
995
|
+
constructor(e) {
|
|
996
|
+
this.options = Object.assign(Object.create(rt), e), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
997
|
+
}
|
|
998
|
+
load(e) {
|
|
999
|
+
const { log: t, minZoom: s, maxZoom: r } = this.options;
|
|
1000
|
+
t && console.time("total time");
|
|
1001
|
+
const n = `prepare ${e.length} points`;
|
|
1002
|
+
t && console.time(n), this.points = e;
|
|
1003
|
+
const a = [];
|
|
1004
|
+
for (let i = 0; i < e.length; i++) {
|
|
1005
|
+
const d = e[i];
|
|
1006
|
+
if (!d.geometry)
|
|
1007
|
+
continue;
|
|
1008
|
+
const [u, l] = d.geometry.coordinates, h = we(H(u)), p = we(W(l));
|
|
1009
|
+
a.push(
|
|
1010
|
+
h,
|
|
1011
|
+
p,
|
|
1012
|
+
// projected point coordinates
|
|
1013
|
+
1 / 0,
|
|
1014
|
+
// the last zoom the point was processed at
|
|
1015
|
+
i,
|
|
1016
|
+
// index of the source feature in the original input array
|
|
1017
|
+
-1,
|
|
1018
|
+
// parent cluster id
|
|
1019
|
+
1
|
|
1020
|
+
// number of points in a cluster
|
|
1021
|
+
), this.options.reduce && a.push(0);
|
|
1022
|
+
}
|
|
1023
|
+
let c = this.trees[r + 1] = this._createTree(a);
|
|
1024
|
+
t && console.timeEnd(n);
|
|
1025
|
+
for (let i = r; i >= s; i--) {
|
|
1026
|
+
const d = +Date.now();
|
|
1027
|
+
c = this.trees[i] = this._createTree(this._cluster(c, i)), t && console.log("z%d: %d clusters in %dms", i, c.numItems, +Date.now() - d);
|
|
1028
|
+
}
|
|
1029
|
+
return t && console.timeEnd("total time"), this;
|
|
1030
|
+
}
|
|
1031
|
+
getClusters(e, t) {
|
|
1032
|
+
let s = ((e[0] + 180) % 360 + 360) % 360 - 180;
|
|
1033
|
+
const r = Math.max(-90, Math.min(90, e[1]));
|
|
1034
|
+
let n = e[2] === 180 ? 180 : ((e[2] + 180) % 360 + 360) % 360 - 180;
|
|
1035
|
+
const a = Math.max(-90, Math.min(90, e[3]));
|
|
1036
|
+
if (e[2] - e[0] >= 360)
|
|
1037
|
+
s = -180, n = 180;
|
|
1038
|
+
else if (s > n) {
|
|
1039
|
+
const l = this.getClusters([s, r, 180, a], t), h = this.getClusters([-180, r, n, a], t);
|
|
1040
|
+
return l.concat(h);
|
|
1041
|
+
}
|
|
1042
|
+
const c = this.trees[this._limitZoom(t)], i = c.range(H(s), W(a), H(n), W(r)), d = c.data, u = [];
|
|
1043
|
+
for (const l of i) {
|
|
1044
|
+
const h = this.stride * l;
|
|
1045
|
+
u.push(d[h + P] > 1 ? ke(d, h, this.clusterProps) : this.points[d[h + x]]);
|
|
1046
|
+
}
|
|
1047
|
+
return u;
|
|
1048
|
+
}
|
|
1049
|
+
getChildren(e) {
|
|
1050
|
+
const t = this._getOriginId(e), s = this._getOriginZoom(e), r = "No cluster with the specified id.", n = this.trees[s];
|
|
1051
|
+
if (!n)
|
|
1052
|
+
throw new Error(r);
|
|
1053
|
+
const a = n.data;
|
|
1054
|
+
if (t * this.stride >= a.length)
|
|
1055
|
+
throw new Error(r);
|
|
1056
|
+
const c = this.options.radius / (this.options.extent * Math.pow(2, s - 1)), i = a[t * this.stride], d = a[t * this.stride + 1], u = n.within(i, d, c), l = [];
|
|
1057
|
+
for (const h of u) {
|
|
1058
|
+
const p = h * this.stride;
|
|
1059
|
+
a[p + oe] === e && l.push(a[p + P] > 1 ? ke(a, p, this.clusterProps) : this.points[a[p + x]]);
|
|
1060
|
+
}
|
|
1061
|
+
if (l.length === 0)
|
|
1062
|
+
throw new Error(r);
|
|
1063
|
+
return l;
|
|
1064
|
+
}
|
|
1065
|
+
getLeaves(e, t, s) {
|
|
1066
|
+
t = t || 10, s = s || 0;
|
|
1067
|
+
const r = [];
|
|
1068
|
+
return this._appendLeaves(r, e, t, s, 0), r;
|
|
1069
|
+
}
|
|
1070
|
+
getTile(e, t, s) {
|
|
1071
|
+
const r = this.trees[this._limitZoom(e)], n = Math.pow(2, e), { extent: a, radius: c } = this.options, i = c / a, d = (s - i) / n, u = (s + 1 + i) / n, l = {
|
|
1072
|
+
features: []
|
|
1073
|
+
};
|
|
1074
|
+
return this._addTileFeatures(
|
|
1075
|
+
r.range((t - i) / n, d, (t + 1 + i) / n, u),
|
|
1076
|
+
r.data,
|
|
1077
|
+
t,
|
|
1078
|
+
s,
|
|
1079
|
+
n,
|
|
1080
|
+
l
|
|
1081
|
+
), t === 0 && this._addTileFeatures(
|
|
1082
|
+
r.range(1 - i / n, d, 1, u),
|
|
1083
|
+
r.data,
|
|
1084
|
+
n,
|
|
1085
|
+
s,
|
|
1086
|
+
n,
|
|
1087
|
+
l
|
|
1088
|
+
), t === n - 1 && this._addTileFeatures(
|
|
1089
|
+
r.range(0, d, i / n, u),
|
|
1090
|
+
r.data,
|
|
1091
|
+
-1,
|
|
1092
|
+
s,
|
|
1093
|
+
n,
|
|
1094
|
+
l
|
|
1095
|
+
), l.features.length ? l : null;
|
|
1096
|
+
}
|
|
1097
|
+
getClusterExpansionZoom(e) {
|
|
1098
|
+
let t = this._getOriginZoom(e) - 1;
|
|
1099
|
+
for (; t <= this.options.maxZoom; ) {
|
|
1100
|
+
const s = this.getChildren(e);
|
|
1101
|
+
if (t++, s.length !== 1)
|
|
1102
|
+
break;
|
|
1103
|
+
e = s[0].properties.cluster_id;
|
|
1104
|
+
}
|
|
1105
|
+
return t;
|
|
1106
|
+
}
|
|
1107
|
+
_appendLeaves(e, t, s, r, n) {
|
|
1108
|
+
const a = this.getChildren(t);
|
|
1109
|
+
for (const c of a) {
|
|
1110
|
+
const i = c.properties;
|
|
1111
|
+
if (i && i.cluster ? n + i.point_count <= r ? n += i.point_count : n = this._appendLeaves(e, i.cluster_id, s, r, n) : n < r ? n++ : e.push(c), e.length === s)
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1114
|
+
return n;
|
|
1115
|
+
}
|
|
1116
|
+
_createTree(e) {
|
|
1117
|
+
const t = new ae(e.length / this.stride | 0, this.options.nodeSize, Float32Array);
|
|
1118
|
+
for (let s = 0; s < e.length; s += this.stride)
|
|
1119
|
+
t.add(e[s], e[s + 1]);
|
|
1120
|
+
return t.finish(), t.data = e, t;
|
|
1121
|
+
}
|
|
1122
|
+
_addTileFeatures(e, t, s, r, n, a) {
|
|
1123
|
+
for (const c of e) {
|
|
1124
|
+
const i = c * this.stride, d = t[i + P] > 1;
|
|
1125
|
+
let u, l, h;
|
|
1126
|
+
if (d)
|
|
1127
|
+
u = Ie(t, i, this.clusterProps), l = t[i], h = t[i + 1];
|
|
1128
|
+
else {
|
|
1129
|
+
const m = this.points[t[i + x]];
|
|
1130
|
+
u = m.properties;
|
|
1131
|
+
const [g, y] = m.geometry.coordinates;
|
|
1132
|
+
l = H(g), h = W(y);
|
|
1133
|
+
}
|
|
1134
|
+
const p = {
|
|
1135
|
+
type: 1,
|
|
1136
|
+
geometry: [[
|
|
1137
|
+
Math.round(this.options.extent * (l * n - s)),
|
|
1138
|
+
Math.round(this.options.extent * (h * n - r))
|
|
1139
|
+
]],
|
|
1140
|
+
tags: u
|
|
1141
|
+
};
|
|
1142
|
+
let f;
|
|
1143
|
+
d || this.options.generateId ? f = t[i + x] : f = this.points[t[i + x]].id, f !== void 0 && (p.id = f), a.features.push(p);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
_limitZoom(e) {
|
|
1147
|
+
return Math.max(this.options.minZoom, Math.min(Math.floor(+e), this.options.maxZoom + 1));
|
|
1148
|
+
}
|
|
1149
|
+
_cluster(e, t) {
|
|
1150
|
+
const { radius: s, extent: r, reduce: n, minPoints: a } = this.options, c = s / (r * Math.pow(2, t)), i = e.data, d = [], u = this.stride;
|
|
1151
|
+
for (let l = 0; l < i.length; l += u) {
|
|
1152
|
+
if (i[l + L] <= t)
|
|
1153
|
+
continue;
|
|
1154
|
+
i[l + L] = t;
|
|
1155
|
+
const h = i[l], p = i[l + 1], f = e.within(i[l], i[l + 1], c), m = i[l + P];
|
|
1156
|
+
let g = m;
|
|
1157
|
+
for (const y of f) {
|
|
1158
|
+
const w = y * u;
|
|
1159
|
+
i[w + L] > t && (g += i[w + P]);
|
|
1160
|
+
}
|
|
1161
|
+
if (g > m && g >= a) {
|
|
1162
|
+
let y = h * m, w = p * m, C, T = -1;
|
|
1163
|
+
const N = ((l / u | 0) << 5) + (t + 1) + this.points.length;
|
|
1164
|
+
for (const G of f) {
|
|
1165
|
+
const b = G * u;
|
|
1166
|
+
if (i[b + L] <= t)
|
|
1167
|
+
continue;
|
|
1168
|
+
i[b + L] = t;
|
|
1169
|
+
const F = i[b + P];
|
|
1170
|
+
y += i[b] * F, w += i[b + 1] * F, i[b + oe] = N, n && (C || (C = this._map(i, l, !0), T = this.clusterProps.length, this.clusterProps.push(C)), n(C, this._map(i, b)));
|
|
1171
|
+
}
|
|
1172
|
+
i[l + oe] = N, d.push(y / g, w / g, 1 / 0, N, -1, g), n && d.push(T);
|
|
1173
|
+
} else {
|
|
1174
|
+
for (let y = 0; y < u; y++)
|
|
1175
|
+
d.push(i[l + y]);
|
|
1176
|
+
if (g > 1)
|
|
1177
|
+
for (const y of f) {
|
|
1178
|
+
const w = y * u;
|
|
1179
|
+
if (!(i[w + L] <= t)) {
|
|
1180
|
+
i[w + L] = t;
|
|
1181
|
+
for (let C = 0; C < u; C++)
|
|
1182
|
+
d.push(i[w + C]);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
return d;
|
|
1188
|
+
}
|
|
1189
|
+
// get index of the point from which the cluster originated
|
|
1190
|
+
_getOriginId(e) {
|
|
1191
|
+
return e - this.points.length >> 5;
|
|
1192
|
+
}
|
|
1193
|
+
// get zoom of the point from which the cluster originated
|
|
1194
|
+
_getOriginZoom(e) {
|
|
1195
|
+
return (e - this.points.length) % 32;
|
|
1196
|
+
}
|
|
1197
|
+
_map(e, t, s) {
|
|
1198
|
+
if (e[t + P] > 1) {
|
|
1199
|
+
const a = this.clusterProps[e[t + Ae]];
|
|
1200
|
+
return s ? Object.assign({}, a) : a;
|
|
1201
|
+
}
|
|
1202
|
+
const r = this.points[e[t + x]].properties, n = this.options.map(r);
|
|
1203
|
+
return s && n === r ? Object.assign({}, n) : n;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
function ke(o, e, t) {
|
|
1207
|
+
return {
|
|
1208
|
+
type: "Feature",
|
|
1209
|
+
id: o[e + x],
|
|
1210
|
+
properties: Ie(o, e, t),
|
|
1211
|
+
geometry: {
|
|
1212
|
+
type: "Point",
|
|
1213
|
+
coordinates: [ot(o[e]), nt(o[e + 1])]
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function Ie(o, e, t) {
|
|
1218
|
+
const s = o[e + P], r = s >= 1e4 ? `${Math.round(s / 1e3)}k` : s >= 1e3 ? `${Math.round(s / 100) / 10}k` : s, n = o[e + Ae], a = n === -1 ? {} : Object.assign({}, t[n]);
|
|
1219
|
+
return Object.assign(a, {
|
|
1220
|
+
cluster: !0,
|
|
1221
|
+
cluster_id: o[e + x],
|
|
1222
|
+
point_count: s,
|
|
1223
|
+
point_count_abbreviated: r
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
function H(o) {
|
|
1227
|
+
return o / 360 + 0.5;
|
|
1228
|
+
}
|
|
1229
|
+
function W(o) {
|
|
1230
|
+
const e = Math.sin(o * Math.PI / 180), t = 0.5 - 0.25 * Math.log((1 + e) / (1 - e)) / Math.PI;
|
|
1231
|
+
return t < 0 ? 0 : t > 1 ? 1 : t;
|
|
1232
|
+
}
|
|
1233
|
+
function ot(o) {
|
|
1234
|
+
return (o - 0.5) * 360;
|
|
1235
|
+
}
|
|
1236
|
+
function nt(o) {
|
|
1237
|
+
const e = (180 - o * 360) * Math.PI / 180;
|
|
1238
|
+
return 360 * Math.atan(Math.exp(e)) / Math.PI - 90;
|
|
1239
|
+
}
|
|
1240
|
+
/*! *****************************************************************************
|
|
1241
|
+
Copyright (c) Microsoft Corporation.
|
|
1242
|
+
|
|
1243
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1244
|
+
purpose with or without fee is hereby granted.
|
|
1245
|
+
|
|
1246
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1247
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1248
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1249
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1250
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1251
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1252
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1253
|
+
***************************************************************************** */
|
|
1254
|
+
function le(o, e) {
|
|
1255
|
+
var t = {};
|
|
1256
|
+
for (var s in o)
|
|
1257
|
+
Object.prototype.hasOwnProperty.call(o, s) && e.indexOf(s) < 0 && (t[s] = o[s]);
|
|
1258
|
+
if (o != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1259
|
+
for (var r = 0, s = Object.getOwnPropertySymbols(o); r < s.length; r++)
|
|
1260
|
+
e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(o, s[r]) && (t[s[r]] = o[s[r]]);
|
|
1261
|
+
return t;
|
|
1262
|
+
}
|
|
1263
|
+
class k {
|
|
1264
|
+
static isAdvancedMarkerAvailable(e) {
|
|
1265
|
+
return google.maps.marker && e.getMapCapabilities().isAdvancedMarkersAvailable === !0;
|
|
1266
|
+
}
|
|
1267
|
+
static isAdvancedMarker(e) {
|
|
1268
|
+
return google.maps.marker && e instanceof google.maps.marker.AdvancedMarkerElement;
|
|
1269
|
+
}
|
|
1270
|
+
static setMap(e, t) {
|
|
1271
|
+
this.isAdvancedMarker(e) ? e.map = t : e.setMap(t);
|
|
1272
|
+
}
|
|
1273
|
+
static getPosition(e) {
|
|
1274
|
+
if (this.isAdvancedMarker(e)) {
|
|
1275
|
+
if (e.position) {
|
|
1276
|
+
if (e.position instanceof google.maps.LatLng)
|
|
1277
|
+
return e.position;
|
|
1278
|
+
if (e.position.lat && e.position.lng)
|
|
1279
|
+
return new google.maps.LatLng(e.position.lat, e.position.lng);
|
|
1280
|
+
}
|
|
1281
|
+
return new google.maps.LatLng(null);
|
|
1282
|
+
}
|
|
1283
|
+
return e.getPosition();
|
|
1284
|
+
}
|
|
1285
|
+
static getVisible(e) {
|
|
1286
|
+
return this.isAdvancedMarker(e) ? !0 : e.getVisible();
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
class V {
|
|
1290
|
+
constructor({ markers: e, position: t }) {
|
|
1291
|
+
this.markers = e, t && (t instanceof google.maps.LatLng ? this._position = t : this._position = new google.maps.LatLng(t));
|
|
1292
|
+
}
|
|
1293
|
+
get bounds() {
|
|
1294
|
+
if (this.markers.length === 0 && !this._position)
|
|
1295
|
+
return;
|
|
1296
|
+
const e = new google.maps.LatLngBounds(this._position, this._position);
|
|
1297
|
+
for (const t of this.markers)
|
|
1298
|
+
e.extend(k.getPosition(t));
|
|
1299
|
+
return e;
|
|
1300
|
+
}
|
|
1301
|
+
get position() {
|
|
1302
|
+
return this._position || this.bounds.getCenter();
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Get the count of **visible** markers.
|
|
1306
|
+
*/
|
|
1307
|
+
get count() {
|
|
1308
|
+
return this.markers.filter((e) => k.getVisible(e)).length;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Add a marker to the cluster.
|
|
1312
|
+
*/
|
|
1313
|
+
push(e) {
|
|
1314
|
+
this.markers.push(e);
|
|
1315
|
+
}
|
|
1316
|
+
/**
|
|
1317
|
+
* Cleanup references and remove marker from map.
|
|
1318
|
+
*/
|
|
1319
|
+
delete() {
|
|
1320
|
+
this.marker && (k.setMap(this.marker, null), this.marker = void 0), this.markers.length = 0;
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
const it = (o, e, t, s) => {
|
|
1324
|
+
const r = $e(o.getBounds(), e, s);
|
|
1325
|
+
return t.filter((n) => r.contains(k.getPosition(n)));
|
|
1326
|
+
}, $e = (o, e, t) => {
|
|
1327
|
+
const { northEast: s, southWest: r } = at(o, e), n = lt({ northEast: s, southWest: r }, t);
|
|
1328
|
+
return ct(n, e);
|
|
1329
|
+
}, _e = (o, e, t) => {
|
|
1330
|
+
const s = $e(o, e, t), r = s.getNorthEast(), n = s.getSouthWest();
|
|
1331
|
+
return [n.lng(), n.lat(), r.lng(), r.lat()];
|
|
1332
|
+
}, at = (o, e) => ({
|
|
1333
|
+
northEast: e.fromLatLngToDivPixel(o.getNorthEast()),
|
|
1334
|
+
southWest: e.fromLatLngToDivPixel(o.getSouthWest())
|
|
1335
|
+
}), lt = ({ northEast: o, southWest: e }, t) => (o.x += t, o.y -= t, e.x -= t, e.y += t, { northEast: o, southWest: e }), ct = ({ northEast: o, southWest: e }, t) => {
|
|
1336
|
+
const s = t.fromDivPixelToLatLng(e), r = t.fromDivPixelToLatLng(o);
|
|
1337
|
+
return new google.maps.LatLngBounds(s, r);
|
|
1338
|
+
};
|
|
1339
|
+
class je {
|
|
1340
|
+
constructor({ maxZoom: e = 16 }) {
|
|
1341
|
+
this.maxZoom = e;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Helper function to bypass clustering based upon some map state such as
|
|
1345
|
+
* zoom, number of markers, etc.
|
|
1346
|
+
*
|
|
1347
|
+
* ```typescript
|
|
1348
|
+
* cluster({markers, map}: AlgorithmInput): Cluster[] {
|
|
1349
|
+
* if (shouldBypassClustering(map)) {
|
|
1350
|
+
* return this.noop({markers})
|
|
1351
|
+
* }
|
|
1352
|
+
* }
|
|
1353
|
+
* ```
|
|
1354
|
+
*/
|
|
1355
|
+
noop({ markers: e }) {
|
|
1356
|
+
return dt(e);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
class ut extends je {
|
|
1360
|
+
constructor(e) {
|
|
1361
|
+
var { viewportPadding: t = 60 } = e, s = le(e, ["viewportPadding"]);
|
|
1362
|
+
super(s), this.viewportPadding = 60, this.viewportPadding = t;
|
|
1363
|
+
}
|
|
1364
|
+
calculate({ markers: e, map: t, mapCanvasProjection: s }) {
|
|
1365
|
+
return t.getZoom() >= this.maxZoom ? {
|
|
1366
|
+
clusters: this.noop({
|
|
1367
|
+
markers: e
|
|
1368
|
+
}),
|
|
1369
|
+
changed: !1
|
|
1370
|
+
} : {
|
|
1371
|
+
clusters: this.cluster({
|
|
1372
|
+
markers: it(t, s, e, this.viewportPadding),
|
|
1373
|
+
map: t,
|
|
1374
|
+
mapCanvasProjection: s
|
|
1375
|
+
})
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
const dt = (o) => o.map((t) => new V({
|
|
1380
|
+
position: k.getPosition(t),
|
|
1381
|
+
markers: [t]
|
|
1382
|
+
}));
|
|
1383
|
+
class ht extends je {
|
|
1384
|
+
constructor(e) {
|
|
1385
|
+
var { maxZoom: t, radius: s = 60 } = e, r = le(e, ["maxZoom", "radius"]);
|
|
1386
|
+
super({ maxZoom: t }), this.state = { zoom: -1 }, this.superCluster = new Te(Object.assign({ maxZoom: this.maxZoom, radius: s }, r));
|
|
1387
|
+
}
|
|
1388
|
+
calculate(e) {
|
|
1389
|
+
let t = !1;
|
|
1390
|
+
const s = { zoom: e.map.getZoom() };
|
|
1391
|
+
if (!A(e.markers, this.markers)) {
|
|
1392
|
+
t = !0, this.markers = [...e.markers];
|
|
1393
|
+
const r = this.markers.map((n) => {
|
|
1394
|
+
const a = k.getPosition(n);
|
|
1395
|
+
return {
|
|
1396
|
+
type: "Feature",
|
|
1397
|
+
geometry: {
|
|
1398
|
+
type: "Point",
|
|
1399
|
+
coordinates: [a.lng(), a.lat()]
|
|
1400
|
+
},
|
|
1401
|
+
properties: { marker: n }
|
|
1402
|
+
};
|
|
1403
|
+
});
|
|
1404
|
+
this.superCluster.load(r);
|
|
1405
|
+
}
|
|
1406
|
+
return t || (this.state.zoom <= this.maxZoom || s.zoom <= this.maxZoom) && (t = !A(this.state, s)), this.state = s, t && (this.clusters = this.cluster(e)), { clusters: this.clusters, changed: t };
|
|
1407
|
+
}
|
|
1408
|
+
cluster({ map: e }) {
|
|
1409
|
+
return this.superCluster.getClusters([-180, -90, 180, 90], Math.round(e.getZoom())).map((t) => this.transformCluster(t));
|
|
1410
|
+
}
|
|
1411
|
+
transformCluster({ geometry: { coordinates: [e, t] }, properties: s }) {
|
|
1412
|
+
if (s.cluster)
|
|
1413
|
+
return new V({
|
|
1414
|
+
markers: this.superCluster.getLeaves(s.cluster_id, 1 / 0).map((n) => n.properties.marker),
|
|
1415
|
+
position: { lat: t, lng: e }
|
|
1416
|
+
});
|
|
1417
|
+
const r = s.marker;
|
|
1418
|
+
return new V({
|
|
1419
|
+
markers: [r],
|
|
1420
|
+
position: k.getPosition(r)
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
class pt extends ut {
|
|
1425
|
+
constructor(e) {
|
|
1426
|
+
var { maxZoom: t, radius: s = 60, viewportPadding: r = 60 } = e, n = le(e, ["maxZoom", "radius", "viewportPadding"]);
|
|
1427
|
+
super({ maxZoom: t, viewportPadding: r }), this.superCluster = new Te(Object.assign({ maxZoom: this.maxZoom, radius: s }, n)), this.state = { zoom: -1, view: [0, 0, 0, 0] };
|
|
1428
|
+
}
|
|
1429
|
+
calculate(e) {
|
|
1430
|
+
const t = {
|
|
1431
|
+
zoom: Math.round(e.map.getZoom()),
|
|
1432
|
+
view: _e(e.map.getBounds(), e.mapCanvasProjection, this.viewportPadding)
|
|
1433
|
+
};
|
|
1434
|
+
let s = !A(this.state, t);
|
|
1435
|
+
if (!A(e.markers, this.markers)) {
|
|
1436
|
+
s = !0, this.markers = [...e.markers];
|
|
1437
|
+
const r = this.markers.map((n) => {
|
|
1438
|
+
const a = k.getPosition(n);
|
|
1439
|
+
return {
|
|
1440
|
+
type: "Feature",
|
|
1441
|
+
geometry: {
|
|
1442
|
+
type: "Point",
|
|
1443
|
+
coordinates: [a.lng(), a.lat()]
|
|
1444
|
+
},
|
|
1445
|
+
properties: { marker: n }
|
|
1446
|
+
};
|
|
1447
|
+
});
|
|
1448
|
+
this.superCluster.load(r);
|
|
1449
|
+
}
|
|
1450
|
+
return s && (this.clusters = this.cluster(e), this.state = t), { clusters: this.clusters, changed: s };
|
|
1451
|
+
}
|
|
1452
|
+
cluster({ map: e, mapCanvasProjection: t }) {
|
|
1453
|
+
const s = {
|
|
1454
|
+
zoom: Math.round(e.getZoom()),
|
|
1455
|
+
view: _e(e.getBounds(), t, this.viewportPadding)
|
|
1456
|
+
};
|
|
1457
|
+
return this.superCluster.getClusters(s.view, s.zoom).map((r) => this.transformCluster(r));
|
|
1458
|
+
}
|
|
1459
|
+
transformCluster({ geometry: { coordinates: [e, t] }, properties: s }) {
|
|
1460
|
+
if (s.cluster)
|
|
1461
|
+
return new V({
|
|
1462
|
+
markers: this.superCluster.getLeaves(s.cluster_id, 1 / 0).map((n) => n.properties.marker),
|
|
1463
|
+
position: { lat: t, lng: e }
|
|
1464
|
+
});
|
|
1465
|
+
const r = s.marker;
|
|
1466
|
+
return new V({
|
|
1467
|
+
markers: [r],
|
|
1468
|
+
position: k.getPosition(r)
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
class ft {
|
|
1473
|
+
constructor(e, t) {
|
|
1474
|
+
this.markers = { sum: e.length };
|
|
1475
|
+
const s = t.map((n) => n.count), r = s.reduce((n, a) => n + a, 0);
|
|
1476
|
+
this.clusters = {
|
|
1477
|
+
count: t.length,
|
|
1478
|
+
markers: {
|
|
1479
|
+
mean: r / t.length,
|
|
1480
|
+
sum: r,
|
|
1481
|
+
min: Math.min(...s),
|
|
1482
|
+
max: Math.max(...s)
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
class mt {
|
|
1488
|
+
/**
|
|
1489
|
+
* The default render function for the library used by {@link MarkerClusterer}.
|
|
1490
|
+
*
|
|
1491
|
+
* Currently set to use the following:
|
|
1492
|
+
*
|
|
1493
|
+
* ```typescript
|
|
1494
|
+
* // change color if this cluster has more markers than the mean cluster
|
|
1495
|
+
* const color =
|
|
1496
|
+
* count > Math.max(10, stats.clusters.markers.mean)
|
|
1497
|
+
* ? "#ff0000"
|
|
1498
|
+
* : "#0000ff";
|
|
1499
|
+
*
|
|
1500
|
+
* // create svg url with fill color
|
|
1501
|
+
* const svg = window.btoa(`
|
|
1502
|
+
* <svg fill="${color}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240">
|
|
1503
|
+
* <circle cx="120" cy="120" opacity=".6" r="70" />
|
|
1504
|
+
* <circle cx="120" cy="120" opacity=".3" r="90" />
|
|
1505
|
+
* <circle cx="120" cy="120" opacity=".2" r="110" />
|
|
1506
|
+
* <circle cx="120" cy="120" opacity=".1" r="130" />
|
|
1507
|
+
* </svg>`);
|
|
1508
|
+
*
|
|
1509
|
+
* // create marker using svg icon
|
|
1510
|
+
* return new google.maps.Marker({
|
|
1511
|
+
* position,
|
|
1512
|
+
* icon: {
|
|
1513
|
+
* url: `data:image/svg+xml;base64,${svg}`,
|
|
1514
|
+
* scaledSize: new google.maps.Size(45, 45),
|
|
1515
|
+
* },
|
|
1516
|
+
* label: {
|
|
1517
|
+
* text: String(count),
|
|
1518
|
+
* color: "rgba(255,255,255,0.9)",
|
|
1519
|
+
* fontSize: "12px",
|
|
1520
|
+
* },
|
|
1521
|
+
* // adjust zIndex to be above other markers
|
|
1522
|
+
* zIndex: 1000 + count,
|
|
1523
|
+
* });
|
|
1524
|
+
* ```
|
|
1525
|
+
*/
|
|
1526
|
+
render({ count: e, position: t }, s, r) {
|
|
1527
|
+
const a = `<svg fill="${e > Math.max(10, s.clusters.markers.mean) ? "#ff0000" : "#0000ff"}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 240" width="50" height="50">
|
|
1528
|
+
<circle cx="120" cy="120" opacity=".6" r="70" />
|
|
1529
|
+
<circle cx="120" cy="120" opacity=".3" r="90" />
|
|
1530
|
+
<circle cx="120" cy="120" opacity=".2" r="110" />
|
|
1531
|
+
<text x="50%" y="50%" style="fill:#fff" text-anchor="middle" font-size="50" dominant-baseline="middle" font-family="roboto,arial,sans-serif">${e}</text>
|
|
1532
|
+
</svg>`, c = `Cluster of ${e} markers`, i = Number(google.maps.Marker.MAX_ZINDEX) + e;
|
|
1533
|
+
if (k.isAdvancedMarkerAvailable(r)) {
|
|
1534
|
+
const u = document.createElement("div");
|
|
1535
|
+
u.innerHTML = a;
|
|
1536
|
+
const l = u.firstElementChild;
|
|
1537
|
+
l.setAttribute("transform", "translate(0 25)");
|
|
1538
|
+
const h = {
|
|
1539
|
+
map: r,
|
|
1540
|
+
position: t,
|
|
1541
|
+
zIndex: i,
|
|
1542
|
+
title: c,
|
|
1543
|
+
content: l
|
|
1544
|
+
};
|
|
1545
|
+
return new google.maps.marker.AdvancedMarkerElement(h);
|
|
1546
|
+
}
|
|
1547
|
+
const d = {
|
|
1548
|
+
position: t,
|
|
1549
|
+
zIndex: i,
|
|
1550
|
+
title: c,
|
|
1551
|
+
icon: {
|
|
1552
|
+
url: `data:image/svg+xml;base64,${btoa(a)}`,
|
|
1553
|
+
anchor: new google.maps.Point(25, 25)
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
return new google.maps.Marker(d);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
function gt(o, e) {
|
|
1560
|
+
for (let t in e.prototype)
|
|
1561
|
+
o.prototype[t] = e.prototype[t];
|
|
1562
|
+
}
|
|
1563
|
+
class ce {
|
|
1564
|
+
constructor() {
|
|
1565
|
+
gt(ce, google.maps.OverlayView);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
var I;
|
|
1569
|
+
(function(o) {
|
|
1570
|
+
o.CLUSTERING_BEGIN = "clusteringbegin", o.CLUSTERING_END = "clusteringend", o.CLUSTER_CLICK = "click";
|
|
1571
|
+
})(I || (I = {}));
|
|
1572
|
+
const vt = (o, e, t) => {
|
|
1573
|
+
t.fitBounds(e.bounds);
|
|
1574
|
+
};
|
|
1575
|
+
class yt extends ce {
|
|
1576
|
+
constructor({ map: e, markers: t = [], algorithmOptions: s = {}, algorithm: r = new ht(s), renderer: n = new mt(), onClusterClick: a = vt }) {
|
|
1577
|
+
super(), this.markers = [...t], this.clusters = [], this.algorithm = r, this.renderer = n, this.onClusterClick = a, e && this.setMap(e);
|
|
1578
|
+
}
|
|
1579
|
+
addMarker(e, t) {
|
|
1580
|
+
this.markers.includes(e) || (this.markers.push(e), t || this.render());
|
|
1581
|
+
}
|
|
1582
|
+
addMarkers(e, t) {
|
|
1583
|
+
e.forEach((s) => {
|
|
1584
|
+
this.addMarker(s, !0);
|
|
1585
|
+
}), t || this.render();
|
|
1586
|
+
}
|
|
1587
|
+
removeMarker(e, t) {
|
|
1588
|
+
const s = this.markers.indexOf(e);
|
|
1589
|
+
return s === -1 ? !1 : (k.setMap(e, null), this.markers.splice(s, 1), t || this.render(), !0);
|
|
1590
|
+
}
|
|
1591
|
+
removeMarkers(e, t) {
|
|
1592
|
+
let s = !1;
|
|
1593
|
+
return e.forEach((r) => {
|
|
1594
|
+
s = this.removeMarker(r, !0) || s;
|
|
1595
|
+
}), s && !t && this.render(), s;
|
|
1596
|
+
}
|
|
1597
|
+
clearMarkers(e) {
|
|
1598
|
+
this.markers.length = 0, e || this.render();
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Recalculates and draws all the marker clusters.
|
|
1602
|
+
*/
|
|
1603
|
+
render() {
|
|
1604
|
+
const e = this.getMap();
|
|
1605
|
+
if (e instanceof google.maps.Map && e.getProjection()) {
|
|
1606
|
+
google.maps.event.trigger(this, I.CLUSTERING_BEGIN, this);
|
|
1607
|
+
const { clusters: t, changed: s } = this.algorithm.calculate({
|
|
1608
|
+
markers: this.markers,
|
|
1609
|
+
map: e,
|
|
1610
|
+
mapCanvasProjection: this.getProjection()
|
|
1611
|
+
});
|
|
1612
|
+
if (s || s == null) {
|
|
1613
|
+
const r = /* @__PURE__ */ new Set();
|
|
1614
|
+
for (const a of t)
|
|
1615
|
+
a.markers.length == 1 && r.add(a.markers[0]);
|
|
1616
|
+
const n = [];
|
|
1617
|
+
for (const a of this.clusters)
|
|
1618
|
+
a.marker != null && (a.markers.length == 1 ? r.has(a.marker) || k.setMap(a.marker, null) : n.push(a.marker));
|
|
1619
|
+
this.clusters = t, this.renderClusters(), requestAnimationFrame(() => n.forEach((a) => k.setMap(a, null)));
|
|
1620
|
+
}
|
|
1621
|
+
google.maps.event.trigger(this, I.CLUSTERING_END, this);
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
onAdd() {
|
|
1625
|
+
this.idleListener = this.getMap().addListener("idle", this.render.bind(this)), this.render();
|
|
1626
|
+
}
|
|
1627
|
+
onRemove() {
|
|
1628
|
+
google.maps.event.removeListener(this.idleListener), this.reset();
|
|
1629
|
+
}
|
|
1630
|
+
reset() {
|
|
1631
|
+
this.markers.forEach((e) => k.setMap(e, null)), this.clusters.forEach((e) => e.delete()), this.clusters = [];
|
|
1632
|
+
}
|
|
1633
|
+
renderClusters() {
|
|
1634
|
+
const e = new ft(this.markers, this.clusters), t = this.getMap();
|
|
1635
|
+
this.clusters.forEach((s) => {
|
|
1636
|
+
s.markers.length === 1 ? s.marker = s.markers[0] : (s.marker = this.renderer.render(s, e, t), s.markers.forEach((r) => k.setMap(r, null)), this.onClusterClick && s.marker.addListener(
|
|
1637
|
+
"click",
|
|
1638
|
+
/* istanbul ignore next */
|
|
1639
|
+
(r) => {
|
|
1640
|
+
google.maps.event.trigger(this, I.CLUSTER_CLICK, s), this.onClusterClick(r, s, t);
|
|
1641
|
+
}
|
|
1642
|
+
)), k.setMap(s.marker, t);
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
const Ce = Object.values(I), It = M({
|
|
1647
|
+
name: "MarkerCluster",
|
|
1648
|
+
props: {
|
|
1649
|
+
options: {
|
|
1650
|
+
type: Object,
|
|
1651
|
+
default: () => ({})
|
|
1652
|
+
}
|
|
1653
|
+
},
|
|
1654
|
+
emits: Ce,
|
|
1655
|
+
setup(o, { emit: e, expose: t, slots: s }) {
|
|
1656
|
+
const r = v(), n = _(q, v()), a = _(R, v());
|
|
1657
|
+
return z(Ee, r), O(
|
|
1658
|
+
n,
|
|
1659
|
+
() => {
|
|
1660
|
+
n.value && (r.value = E(
|
|
1661
|
+
new yt({
|
|
1662
|
+
map: n.value,
|
|
1663
|
+
// Better perf than the default `SuperClusterAlgorithm`. See:
|
|
1664
|
+
// https://github.com/googlemaps/js-markerclusterer/pull/640
|
|
1665
|
+
algorithm: new pt(o.options.algorithmOptions ?? {}),
|
|
1666
|
+
...o.options
|
|
1667
|
+
})
|
|
1668
|
+
), Ce.forEach((c) => {
|
|
1669
|
+
var i;
|
|
1670
|
+
(i = r.value) == null || i.addListener(c, (d) => e(c, d));
|
|
1671
|
+
}));
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
immediate: !0
|
|
1675
|
+
}
|
|
1676
|
+
), j(() => {
|
|
1677
|
+
var c;
|
|
1678
|
+
r.value && ((c = a.value) == null || c.event.clearInstanceListeners(r.value), r.value.clearMarkers(), r.value.setMap(null));
|
|
1679
|
+
}), t({ markerCluster: r }), () => {
|
|
1680
|
+
var c;
|
|
1681
|
+
return (c = s.default) == null ? void 0 : c.call(s);
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
}), wt = M({
|
|
1685
|
+
inheritAttrs: !1,
|
|
1686
|
+
props: {
|
|
1687
|
+
options: {
|
|
1688
|
+
type: Object,
|
|
1689
|
+
required: !0
|
|
1690
|
+
}
|
|
1691
|
+
},
|
|
1692
|
+
setup(o, { slots: e, emit: t, expose: s }) {
|
|
1693
|
+
const r = v(), n = K(() => {
|
|
1694
|
+
var i;
|
|
1695
|
+
return (i = e.default) == null ? void 0 : i.call(e).some((d) => d.type !== be);
|
|
1696
|
+
}), a = K(() => ({
|
|
1697
|
+
...o.options,
|
|
1698
|
+
element: r.value
|
|
1699
|
+
})), c = Z(Q, [], a, t);
|
|
1700
|
+
return s({
|
|
1701
|
+
customMarker: c
|
|
1702
|
+
}), { customMarkerRef: r, customMarker: c, hasSlotContent: n };
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
const kt = {
|
|
1706
|
+
key: 0,
|
|
1707
|
+
class: "custom-marker-wrapper"
|
|
1708
|
+
};
|
|
1709
|
+
function _t(o, e, t, s, r, n) {
|
|
1710
|
+
return o.hasSlotContent ? (J(), Y("div", kt, [
|
|
1711
|
+
ie("div", Oe({
|
|
1712
|
+
ref: "customMarkerRef",
|
|
1713
|
+
style: { cursor: o.$attrs.onClick ? "pointer" : void 0 }
|
|
1714
|
+
}, o.$attrs), [
|
|
1715
|
+
X(o.$slots, "default", {}, void 0, !0)
|
|
1716
|
+
], 16)
|
|
1717
|
+
])) : Pe("", !0);
|
|
1718
|
+
}
|
|
1719
|
+
const $t = /* @__PURE__ */ ee(wt, [["render", _t], ["__scopeId", "data-v-c7599d50"]]), jt = M({
|
|
1720
|
+
name: "HeatmapLayer",
|
|
1721
|
+
props: {
|
|
1722
|
+
options: {
|
|
1723
|
+
type: Object,
|
|
1724
|
+
default: () => ({})
|
|
1725
|
+
}
|
|
1726
|
+
},
|
|
1727
|
+
setup(o) {
|
|
1728
|
+
const e = v(), t = _(q, v()), s = _(R, v());
|
|
1729
|
+
return O(
|
|
1730
|
+
[t, () => o.options],
|
|
1731
|
+
([r, n], [a, c]) => {
|
|
1732
|
+
var d;
|
|
1733
|
+
const i = !A(n, c) || t.value !== a;
|
|
1734
|
+
if (t.value && s.value && i) {
|
|
1735
|
+
const u = structuredClone(n);
|
|
1736
|
+
if (u.data && !(u.data instanceof s.value.MVCArray)) {
|
|
1737
|
+
const l = s.value.LatLng;
|
|
1738
|
+
u.data = (d = u.data) == null ? void 0 : d.map((h) => h instanceof l || "location" in h && (h.location instanceof l || h.location === null) ? h : "location" in h ? { ...h, location: new l(h.location) } : new l(h));
|
|
1739
|
+
}
|
|
1740
|
+
e.value ? e.value.setOptions(u) : e.value = E(
|
|
1741
|
+
new s.value.visualization.HeatmapLayer({
|
|
1742
|
+
...u,
|
|
1743
|
+
map: t.value
|
|
1744
|
+
})
|
|
1745
|
+
);
|
|
1746
|
+
}
|
|
1747
|
+
},
|
|
1748
|
+
{ immediate: !0 }
|
|
1749
|
+
), j(() => {
|
|
1750
|
+
e.value && e.value.setMap(null);
|
|
1751
|
+
}), { heatmapLayer: e };
|
|
1752
|
+
},
|
|
1753
|
+
render: () => null
|
|
1754
|
+
});
|
|
1755
|
+
export {
|
|
1756
|
+
St as Circle,
|
|
1757
|
+
At as CustomControl,
|
|
1758
|
+
$t as CustomMarker,
|
|
1759
|
+
Ot as GoogleMap,
|
|
1760
|
+
jt as HeatmapLayer,
|
|
1761
|
+
Tt as InfoWindow,
|
|
1762
|
+
Pt as Marker,
|
|
1763
|
+
It as MarkerCluster,
|
|
1764
|
+
Et as Polygon,
|
|
1765
|
+
xt as Polyline,
|
|
1766
|
+
Lt as Rectangle
|
|
1767
|
+
};
|