@local-logic/maps 0.0.23 → 0.0.24
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/dist/index-BOZt1-DO.js +69 -0
- package/dist/{index-BrxP9NHZ.js → index-Buv9_Jj9.js} +3 -3
- package/dist/index-C3Tj3r2u.js +24 -0
- package/dist/index-C6a0FCIX.js +92 -0
- package/dist/index-CCS3Ef2w.js +92 -0
- package/dist/{index-CSVsF1EQ.js → index-CEDpofgZ.js} +1 -1
- package/dist/{index-BRD3rjLE.js → index-CIE9YlvM.js} +12 -12
- package/dist/index-CUUravWc.js +25 -0
- package/dist/index-CUvZ7gVt.js +98 -0
- package/dist/{index-CN_dNOir.js → index-Ct-3yYUx.js} +245 -217
- package/dist/index-DJx0avMT.js +75 -0
- package/dist/{index-B85VZGVP.js → index-DOkeQ2e4.js} +3 -3
- package/dist/{index-ufLC1PLO.js → index-DbyYOXrb.js} +16 -16
- package/dist/index-DntG4mBo.js +75 -0
- package/dist/{index-CFomI3Il.js → index-DscDx7HE.js} +14 -13
- package/dist/{index-DfhwDiOS.js → index-GGtrKiJn.js} +22 -22
- package/dist/index-Y5T20C1G.js +92 -0
- package/dist/{index-CiWKwaC4.js → index-eWv3le07.js} +7 -6
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +8 -3615
- package/dist/{logo-control-VgN6MEKI.js → logo-control-CHapR1Dt.js} +11 -11
- package/dist/{scale-control-jBKptTbw.js → scale-control-Dsir9fWY.js} +21 -21
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts +1 -1
- package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/BaseMap/types.d.ts +1 -10
- package/dist/src/components/Map/Root/BaseMap/types.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Google/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/Popup/utils/index.d.ts +2 -0
- package/dist/src/components/Map/Root/Popup/utils/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/Popup/utils/moveIntoView/index.d.ts +21 -0
- package/dist/src/components/Map/Root/Popup/utils/moveIntoView/index.d.ts.map +1 -0
- package/dist/src/components/Map/Root/constants.d.ts +11 -2
- package/dist/src/components/Map/Root/constants.d.ts.map +1 -1
- package/dist/src/components/Map/Root/context.d.ts +6 -6
- package/dist/src/components/Map/Root/context.d.ts.map +1 -1
- package/dist/src/components/Map/Root/index.d.ts.map +1 -1
- package/dist/src/components/Map/Root/types.d.ts +9 -0
- package/dist/src/components/Map/Root/types.d.ts.map +1 -1
- package/dist/src/components/Map/index.stories.d.ts +9 -3
- package/dist/src/components/Map/index.stories.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/styles-BNaT0cTi.js +36 -0
- package/dist/{styles-BR85tnqI.js → styles-BhmqUA5C.js} +231 -266
- package/package.json +30 -10
- package/dist/IconBase.es-rM5tt24D.js +0 -48
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/index-BpFpg_5A.js +0 -78
- package/dist/index-CRdDPWou.js +0 -34
- package/dist/index-CceEGv05.js +0 -104
- package/dist/index-CmajMf1d.js +0 -109
- package/dist/index-D5kHxP9H.js +0 -43
- package/dist/index-DNNz78Rc.js +0 -24
- package/dist/index-Db33Ugg9.js +0 -34
- package/dist/index-arkRlpaR.js +0 -80
- package/dist/index-vHMPqmOL.js +0 -23
- package/dist/index.modern-B-ChKejQ.js +0 -914
- package/dist/mapbox-gl-C6frO4Gl.js +0 -34625
- package/dist/maplibre-gl-DkDrZ6rP.js +0 -21669
- package/dist/styles-ChFj97uV.js +0 -7
|
@@ -1,914 +0,0 @@
|
|
|
1
|
-
import b, { forwardRef as Y, useMemo as P, useContext as R, useEffect as v, useLayoutEffect as W, useImperativeHandle as Q, useState as A, useRef as z, useReducer as ee, useCallback as te, Children as ue } from "react";
|
|
2
|
-
import { createPortal as $ } from "react-dom";
|
|
3
|
-
import { g as de } from "./_commonjsHelpers-C6fGbg64.js";
|
|
4
|
-
var j, q;
|
|
5
|
-
function fe() {
|
|
6
|
-
return q || (q = 1, j = function t(e, n) {
|
|
7
|
-
if (e === n) return !0;
|
|
8
|
-
if (e && n && typeof e == "object" && typeof n == "object") {
|
|
9
|
-
if (e.constructor !== n.constructor) return !1;
|
|
10
|
-
var o, r, i;
|
|
11
|
-
if (Array.isArray(e)) {
|
|
12
|
-
if (o = e.length, o != n.length) return !1;
|
|
13
|
-
for (r = o; r-- !== 0; )
|
|
14
|
-
if (!t(e[r], n[r])) return !1;
|
|
15
|
-
return !0;
|
|
16
|
-
}
|
|
17
|
-
if (e.constructor === RegExp) return e.source === n.source && e.flags === n.flags;
|
|
18
|
-
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === n.valueOf();
|
|
19
|
-
if (e.toString !== Object.prototype.toString) return e.toString() === n.toString();
|
|
20
|
-
if (i = Object.keys(e), o = i.length, o !== Object.keys(n).length) return !1;
|
|
21
|
-
for (r = o; r-- !== 0; )
|
|
22
|
-
if (!Object.prototype.hasOwnProperty.call(n, i[r])) return !1;
|
|
23
|
-
for (r = o; r-- !== 0; ) {
|
|
24
|
-
var a = i[r];
|
|
25
|
-
if (!t(e[a], n[a])) return !1;
|
|
26
|
-
}
|
|
27
|
-
return !0;
|
|
28
|
-
}
|
|
29
|
-
return e !== e && n !== n;
|
|
30
|
-
}), j;
|
|
31
|
-
}
|
|
32
|
-
var ge = fe();
|
|
33
|
-
const ne = /* @__PURE__ */ de(ge);
|
|
34
|
-
function _() {
|
|
35
|
-
return _ = Object.assign ? Object.assign.bind() : function(t) {
|
|
36
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
37
|
-
var n = arguments[e];
|
|
38
|
-
for (var o in n) ({}).hasOwnProperty.call(n, o) && (t[o] = n[o]);
|
|
39
|
-
}
|
|
40
|
-
return t;
|
|
41
|
-
}, _.apply(null, arguments);
|
|
42
|
-
}
|
|
43
|
-
function D(t, e) {
|
|
44
|
-
if (t == null) return {};
|
|
45
|
-
var n = {};
|
|
46
|
-
for (var o in t) if ({}.hasOwnProperty.call(t, o)) {
|
|
47
|
-
if (e.indexOf(o) !== -1) continue;
|
|
48
|
-
n[o] = t[o];
|
|
49
|
-
}
|
|
50
|
-
return n;
|
|
51
|
-
}
|
|
52
|
-
function me(t, e) {
|
|
53
|
-
if (typeof t != "object" || !t) return t;
|
|
54
|
-
var n = t[Symbol.toPrimitive];
|
|
55
|
-
if (n !== void 0) {
|
|
56
|
-
var o = n.call(t, e);
|
|
57
|
-
if (typeof o != "object") return o;
|
|
58
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
59
|
-
}
|
|
60
|
-
return String(t);
|
|
61
|
-
}
|
|
62
|
-
function pe(t) {
|
|
63
|
-
var e = me(t, "string");
|
|
64
|
-
return typeof e == "symbol" ? e : e + "";
|
|
65
|
-
}
|
|
66
|
-
const x = {
|
|
67
|
-
NOT_LOADED: "NOT_LOADED",
|
|
68
|
-
LOADING: "LOADING",
|
|
69
|
-
LOADED: "LOADED",
|
|
70
|
-
FAILED: "FAILED",
|
|
71
|
-
AUTH_FAILURE: "AUTH_FAILURE"
|
|
72
|
-
}, he = "https://maps.googleapis.com/maps/api/js";
|
|
73
|
-
class B {
|
|
74
|
-
/**
|
|
75
|
-
* Loads the Maps JavaScript API with the specified parameters.
|
|
76
|
-
* Since the Maps library can only be loaded once per page, this will
|
|
77
|
-
* produce a warning when called multiple times with different
|
|
78
|
-
* parameters.
|
|
79
|
-
*
|
|
80
|
-
* The returned promise resolves when loading completes
|
|
81
|
-
* and rejects in case of an error or when the loading was aborted.
|
|
82
|
-
*/
|
|
83
|
-
static async load(e, n) {
|
|
84
|
-
var o;
|
|
85
|
-
const r = e.libraries ? e.libraries.split(",") : [], i = this.serializeParams(e);
|
|
86
|
-
this.listeners.push(n), (o = window.google) != null && (o = o.maps) != null && o.importLibrary ? (this.serializedApiParams || (this.loadingStatus = x.LOADED), this.notifyLoadingStatusListeners()) : (this.serializedApiParams = i, this.initImportLibrary(e)), this.serializedApiParams && this.serializedApiParams !== i && console.warn("[google-maps-api-loader] The maps API has already been loaded with different parameters and will not be loaded again. Refresh the page for new values to have effect.");
|
|
87
|
-
const a = ["maps", ...r];
|
|
88
|
-
await Promise.all(a.map((s) => google.maps.importLibrary(s)));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Serialize the parameters used to load the library for easier comparison.
|
|
92
|
-
*/
|
|
93
|
-
static serializeParams(e) {
|
|
94
|
-
return [e.v, e.key, e.language, e.region, e.authReferrerPolicy, e.solutionChannel].join("/");
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Creates the global `google.maps.importLibrary` function for bootstrapping.
|
|
98
|
-
* This is essentially a formatted version of the dynamic loading script
|
|
99
|
-
* from the official documentation with some minor adjustments.
|
|
100
|
-
*
|
|
101
|
-
* The created importLibrary function will load the Google Maps JavaScript API,
|
|
102
|
-
* which will then replace the `google.maps.importLibrary` function with the full
|
|
103
|
-
* implementation.
|
|
104
|
-
*
|
|
105
|
-
* @see https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import
|
|
106
|
-
*/
|
|
107
|
-
static initImportLibrary(e) {
|
|
108
|
-
if (window.google || (window.google = {}), window.google.maps || (window.google.maps = {}), window.google.maps.importLibrary) {
|
|
109
|
-
console.error("[google-maps-api-loader-internal]: initImportLibrary must only be called once");
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
let n = null;
|
|
113
|
-
const o = () => n || (n = new Promise((r, i) => {
|
|
114
|
-
var a;
|
|
115
|
-
const s = document.createElement("script"), c = new URLSearchParams();
|
|
116
|
-
for (const [u, d] of Object.entries(e)) {
|
|
117
|
-
const p = u.replace(/[A-Z]/g, (f) => "_" + f[0].toLowerCase());
|
|
118
|
-
c.set(p, String(d));
|
|
119
|
-
}
|
|
120
|
-
c.set("loading", "async"), c.set("callback", "__googleMapsCallback__"), s.async = !0, s.src = he + "?" + c.toString(), s.nonce = ((a = document.querySelector("script[nonce]")) == null ? void 0 : a.nonce) || "", s.onerror = () => {
|
|
121
|
-
this.loadingStatus = x.FAILED, this.notifyLoadingStatusListeners(), i(new Error("The Google Maps JavaScript API could not load."));
|
|
122
|
-
}, window.__googleMapsCallback__ = () => {
|
|
123
|
-
this.loadingStatus = x.LOADED, this.notifyLoadingStatusListeners(), r();
|
|
124
|
-
}, window.gm_authFailure = () => {
|
|
125
|
-
this.loadingStatus = x.AUTH_FAILURE, this.notifyLoadingStatusListeners();
|
|
126
|
-
}, this.loadingStatus = x.LOADING, this.notifyLoadingStatusListeners(), document.head.append(s);
|
|
127
|
-
}), n);
|
|
128
|
-
google.maps.importLibrary = (r) => o().then(() => google.maps.importLibrary(r));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Calls all registered loadingStatusListeners after a status update.
|
|
132
|
-
*/
|
|
133
|
-
static notifyLoadingStatusListeners() {
|
|
134
|
-
for (const e of this.listeners)
|
|
135
|
-
e(this.loadingStatus);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
B.loadingStatus = x.NOT_LOADED;
|
|
139
|
-
B.serializedApiParams = void 0;
|
|
140
|
-
B.listeners = [];
|
|
141
|
-
const ve = ["onLoad", "onError", "apiKey", "version", "libraries"], Ce = ["children"], ye = "GMP_visgl_rgmlibrary_v1_default", G = b.createContext(null);
|
|
142
|
-
function be() {
|
|
143
|
-
const [t, e] = A({});
|
|
144
|
-
return {
|
|
145
|
-
mapInstances: t,
|
|
146
|
-
addMapInstance: (i, a = "default") => {
|
|
147
|
-
e((s) => _({}, s, {
|
|
148
|
-
[a]: i
|
|
149
|
-
}));
|
|
150
|
-
},
|
|
151
|
-
removeMapInstance: (i = "default") => {
|
|
152
|
-
e((a) => D(a, [i].map(pe)));
|
|
153
|
-
},
|
|
154
|
-
clearMapInstances: () => {
|
|
155
|
-
e({});
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function Oe(t) {
|
|
160
|
-
const {
|
|
161
|
-
onLoad: e,
|
|
162
|
-
onError: n,
|
|
163
|
-
apiKey: o,
|
|
164
|
-
version: r,
|
|
165
|
-
libraries: i = []
|
|
166
|
-
} = t, a = D(t, ve), [s, c] = A(B.loadingStatus), [u, d] = ee((l, g) => l[g.name] ? l : _({}, l, {
|
|
167
|
-
[g.name]: g.value
|
|
168
|
-
}), {}), p = P(() => i?.join(","), [i]), f = P(() => JSON.stringify(_({
|
|
169
|
-
apiKey: o,
|
|
170
|
-
version: r
|
|
171
|
-
}, a)), [o, r, a]), m = te(async (l) => {
|
|
172
|
-
var g;
|
|
173
|
-
if (u[l])
|
|
174
|
-
return u[l];
|
|
175
|
-
if (!((g = google) != null && (g = g.maps) != null && g.importLibrary))
|
|
176
|
-
throw new Error("[api-provider-internal] importLibrary was called before google.maps.importLibrary was defined.");
|
|
177
|
-
const C = await window.google.maps.importLibrary(l);
|
|
178
|
-
return d({
|
|
179
|
-
name: l,
|
|
180
|
-
value: C
|
|
181
|
-
}), C;
|
|
182
|
-
}, [u]);
|
|
183
|
-
return v(
|
|
184
|
-
() => {
|
|
185
|
-
(async () => {
|
|
186
|
-
try {
|
|
187
|
-
const l = _({
|
|
188
|
-
key: o
|
|
189
|
-
}, a);
|
|
190
|
-
r && (l.v = r), p?.length > 0 && (l.libraries = p), (l.channel === void 0 || l.channel < 0 || l.channel > 999) && delete l.channel, l.solutionChannel === void 0 ? l.solutionChannel = ye : l.solutionChannel === "" && delete l.solutionChannel, await B.load(l, (g) => c(g));
|
|
191
|
-
for (const g of ["core", "maps", ...i])
|
|
192
|
-
await m(g);
|
|
193
|
-
e && e();
|
|
194
|
-
} catch (l) {
|
|
195
|
-
n ? n(l) : console.error("<ApiProvider> failed to load the Google Maps JavaScript API", l);
|
|
196
|
-
}
|
|
197
|
-
})();
|
|
198
|
-
},
|
|
199
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
200
|
-
[o, p, f]
|
|
201
|
-
), {
|
|
202
|
-
status: s,
|
|
203
|
-
loadedLibraries: u,
|
|
204
|
-
importLibrary: m
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
const rt = (t) => {
|
|
208
|
-
const {
|
|
209
|
-
children: e
|
|
210
|
-
} = t, n = D(t, Ce), {
|
|
211
|
-
mapInstances: o,
|
|
212
|
-
addMapInstance: r,
|
|
213
|
-
removeMapInstance: i,
|
|
214
|
-
clearMapInstances: a
|
|
215
|
-
} = be(), {
|
|
216
|
-
status: s,
|
|
217
|
-
loadedLibraries: c,
|
|
218
|
-
importLibrary: u
|
|
219
|
-
} = Oe(n), d = P(() => ({
|
|
220
|
-
mapInstances: o,
|
|
221
|
-
addMapInstance: r,
|
|
222
|
-
removeMapInstance: i,
|
|
223
|
-
clearMapInstances: a,
|
|
224
|
-
status: s,
|
|
225
|
-
loadedLibraries: c,
|
|
226
|
-
importLibrary: u
|
|
227
|
-
}), [o, r, i, a, s, c, u]);
|
|
228
|
-
return /* @__PURE__ */ b.createElement(G.Provider, {
|
|
229
|
-
value: d
|
|
230
|
-
}, e);
|
|
231
|
-
};
|
|
232
|
-
function we(t, e) {
|
|
233
|
-
for (const n of Ie) {
|
|
234
|
-
const o = e[n], r = oe[n];
|
|
235
|
-
v(() => {
|
|
236
|
-
if (!t || !o) return;
|
|
237
|
-
const i = google.maps.event.addListener(t, r, (a) => {
|
|
238
|
-
o(Ee(r, t, a));
|
|
239
|
-
});
|
|
240
|
-
return () => i.remove();
|
|
241
|
-
}, [t, r, o]);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function Ee(t, e, n) {
|
|
245
|
-
const o = {
|
|
246
|
-
type: t,
|
|
247
|
-
map: e,
|
|
248
|
-
detail: {},
|
|
249
|
-
stoppable: !1,
|
|
250
|
-
stop: () => {
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
if (Le.includes(t)) {
|
|
254
|
-
const i = o, a = e.getCenter(), s = e.getZoom(), c = e.getHeading() || 0, u = e.getTilt() || 0, d = e.getBounds();
|
|
255
|
-
return (!a || !d || !Number.isFinite(s)) && console.warn("[createEvent] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), i.detail = {
|
|
256
|
-
center: a?.toJSON() || {
|
|
257
|
-
lat: 0,
|
|
258
|
-
lng: 0
|
|
259
|
-
},
|
|
260
|
-
zoom: s || 0,
|
|
261
|
-
heading: c,
|
|
262
|
-
tilt: u,
|
|
263
|
-
bounds: d?.toJSON() || {
|
|
264
|
-
north: 90,
|
|
265
|
-
east: 180,
|
|
266
|
-
south: -90,
|
|
267
|
-
west: -180
|
|
268
|
-
}
|
|
269
|
-
}, i;
|
|
270
|
-
} else if (Me.includes(t)) {
|
|
271
|
-
var r;
|
|
272
|
-
if (!n) throw new Error("[createEvent] mouse events must provide a srcEvent");
|
|
273
|
-
const i = o;
|
|
274
|
-
return i.domEvent = n.domEvent, i.stoppable = !0, i.stop = () => n.stop(), i.detail = {
|
|
275
|
-
latLng: ((r = n.latLng) == null ? void 0 : r.toJSON()) || null,
|
|
276
|
-
placeId: n.placeId
|
|
277
|
-
}, i;
|
|
278
|
-
}
|
|
279
|
-
return o;
|
|
280
|
-
}
|
|
281
|
-
const oe = {
|
|
282
|
-
onBoundsChanged: "bounds_changed",
|
|
283
|
-
onCenterChanged: "center_changed",
|
|
284
|
-
onClick: "click",
|
|
285
|
-
onContextmenu: "contextmenu",
|
|
286
|
-
onDblclick: "dblclick",
|
|
287
|
-
onDrag: "drag",
|
|
288
|
-
onDragend: "dragend",
|
|
289
|
-
onDragstart: "dragstart",
|
|
290
|
-
onHeadingChanged: "heading_changed",
|
|
291
|
-
onIdle: "idle",
|
|
292
|
-
onIsFractionalZoomEnabledChanged: "isfractionalzoomenabled_changed",
|
|
293
|
-
onMapCapabilitiesChanged: "mapcapabilities_changed",
|
|
294
|
-
onMapTypeIdChanged: "maptypeid_changed",
|
|
295
|
-
onMousemove: "mousemove",
|
|
296
|
-
onMouseout: "mouseout",
|
|
297
|
-
onMouseover: "mouseover",
|
|
298
|
-
onProjectionChanged: "projection_changed",
|
|
299
|
-
onRenderingTypeChanged: "renderingtype_changed",
|
|
300
|
-
onTilesLoaded: "tilesloaded",
|
|
301
|
-
onTiltChanged: "tilt_changed",
|
|
302
|
-
onZoomChanged: "zoom_changed",
|
|
303
|
-
// note: onCameraChanged is an alias for the bounds_changed event,
|
|
304
|
-
// since that is going to be fired in every situation where the camera is
|
|
305
|
-
// updated.
|
|
306
|
-
onCameraChanged: "bounds_changed"
|
|
307
|
-
}, Le = ["bounds_changed", "center_changed", "heading_changed", "tilt_changed", "zoom_changed"], Me = ["click", "contextmenu", "dblclick", "mousemove", "mouseout", "mouseover"], Ie = Object.keys(oe);
|
|
308
|
-
function re(t, e) {
|
|
309
|
-
const n = z(t);
|
|
310
|
-
return e(t, n.current) || (n.current = t), n.current;
|
|
311
|
-
}
|
|
312
|
-
function Se(t, e, n) {
|
|
313
|
-
v(t, [re(e, n)]);
|
|
314
|
-
}
|
|
315
|
-
function _e(t, e) {
|
|
316
|
-
Se(t, e, ne);
|
|
317
|
-
}
|
|
318
|
-
const ke = /* @__PURE__ */ new Set(["backgroundColor", "clickableIcons", "controlSize", "disableDefaultUI", "disableDoubleClickZoom", "draggable", "draggableCursor", "draggingCursor", "fullscreenControl", "fullscreenControlOptions", "gestureHandling", "headingInteractionEnabled", "isFractionalZoomEnabled", "keyboardShortcuts", "mapTypeControl", "mapTypeControlOptions", "mapTypeId", "maxZoom", "minZoom", "noClear", "panControl", "panControlOptions", "restriction", "rotateControl", "rotateControlOptions", "scaleControl", "scaleControlOptions", "scrollwheel", "streetView", "streetViewControl", "streetViewControlOptions", "styles", "tiltInteractionEnabled", "zoomControl", "zoomControlOptions"]);
|
|
319
|
-
function xe(t, e) {
|
|
320
|
-
const n = {}, o = Object.keys(e);
|
|
321
|
-
for (const r of o)
|
|
322
|
-
ke.has(r) && (n[r] = e[r]);
|
|
323
|
-
_e(() => {
|
|
324
|
-
t && t.setOptions(n);
|
|
325
|
-
}, [n]);
|
|
326
|
-
}
|
|
327
|
-
function ie() {
|
|
328
|
-
var t;
|
|
329
|
-
return ((t = R(G)) == null ? void 0 : t.status) || x.NOT_LOADED;
|
|
330
|
-
}
|
|
331
|
-
function Ae(t, e) {
|
|
332
|
-
const {
|
|
333
|
-
viewport: n,
|
|
334
|
-
viewState: o
|
|
335
|
-
} = e, r = !!n;
|
|
336
|
-
return W(() => {
|
|
337
|
-
if (!t || !o) return;
|
|
338
|
-
const {
|
|
339
|
-
latitude: i,
|
|
340
|
-
longitude: a,
|
|
341
|
-
bearing: s,
|
|
342
|
-
pitch: c,
|
|
343
|
-
zoom: u
|
|
344
|
-
} = o;
|
|
345
|
-
t.moveCamera({
|
|
346
|
-
center: {
|
|
347
|
-
lat: i,
|
|
348
|
-
lng: a
|
|
349
|
-
},
|
|
350
|
-
heading: s,
|
|
351
|
-
tilt: c,
|
|
352
|
-
zoom: u + 1
|
|
353
|
-
});
|
|
354
|
-
}, [t, o]), r;
|
|
355
|
-
}
|
|
356
|
-
function Pe(t) {
|
|
357
|
-
return !t || typeof t != "object" || !("lat" in t && "lng" in t) ? !1 : Number.isFinite(t.lat) && Number.isFinite(t.lng);
|
|
358
|
-
}
|
|
359
|
-
function ae(t) {
|
|
360
|
-
return Pe(t) ? t : t.toJSON();
|
|
361
|
-
}
|
|
362
|
-
function De(t, e, n) {
|
|
363
|
-
const o = n.center ? ae(n.center) : null;
|
|
364
|
-
let r = null, i = null;
|
|
365
|
-
o && Number.isFinite(o.lat) && Number.isFinite(o.lng) && (r = o.lat, i = o.lng);
|
|
366
|
-
const a = Number.isFinite(n.zoom) ? n.zoom : null, s = Number.isFinite(n.heading) ? n.heading : null, c = Number.isFinite(n.tilt) ? n.tilt : null;
|
|
367
|
-
W(() => {
|
|
368
|
-
if (!t) return;
|
|
369
|
-
const u = {};
|
|
370
|
-
let d = !1;
|
|
371
|
-
r !== null && i !== null && (e.current.center.lat !== r || e.current.center.lng !== i) && (u.center = {
|
|
372
|
-
lat: r,
|
|
373
|
-
lng: i
|
|
374
|
-
}, d = !0), a !== null && e.current.zoom !== a && (u.zoom = a, d = !0), s !== null && e.current.heading !== s && (u.heading = s, d = !0), c !== null && e.current.tilt !== c && (u.tilt = c, d = !0), d && t.moveCamera(u);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
const Te = () => {
|
|
378
|
-
const t = {
|
|
379
|
-
position: "absolute",
|
|
380
|
-
top: 0,
|
|
381
|
-
left: 0,
|
|
382
|
-
bottom: 0,
|
|
383
|
-
right: 0,
|
|
384
|
-
zIndex: 999,
|
|
385
|
-
display: "flex",
|
|
386
|
-
flexFlow: "column nowrap",
|
|
387
|
-
textAlign: "center",
|
|
388
|
-
justifyContent: "center",
|
|
389
|
-
fontSize: ".8rem",
|
|
390
|
-
color: "rgba(0,0,0,0.6)",
|
|
391
|
-
background: "#dddddd",
|
|
392
|
-
padding: "1rem 1.5rem"
|
|
393
|
-
};
|
|
394
|
-
return /* @__PURE__ */ b.createElement("div", {
|
|
395
|
-
style: t
|
|
396
|
-
}, /* @__PURE__ */ b.createElement("h2", null, "Error: AuthFailure"), /* @__PURE__ */ b.createElement("p", null, "A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ", /* @__PURE__ */ b.createElement("code", null, "APIProvider.apiKey"), " prop is correct. Check the error-message in the console for further details."));
|
|
397
|
-
};
|
|
398
|
-
function Fe() {
|
|
399
|
-
const [t, e] = A(null), n = te((o) => e(o), [e]);
|
|
400
|
-
return [t, n];
|
|
401
|
-
}
|
|
402
|
-
function se() {
|
|
403
|
-
return ie() === x.LOADED;
|
|
404
|
-
}
|
|
405
|
-
function Ne() {
|
|
406
|
-
const [, t] = ee((e) => e + 1, 0);
|
|
407
|
-
return t;
|
|
408
|
-
}
|
|
409
|
-
function ze(t, e) {
|
|
410
|
-
const n = t.getCenter(), o = t.getZoom(), r = t.getHeading() || 0, i = t.getTilt() || 0, a = t.getBounds();
|
|
411
|
-
(!n || !a || !Number.isFinite(o)) && console.warn("[useTrackedCameraState] at least one of the values from the map returned undefined. This is not expected to happen. Please report an issue at https://github.com/visgl/react-google-maps/issues/new"), Object.assign(e.current, {
|
|
412
|
-
center: n?.toJSON() || {
|
|
413
|
-
lat: 0,
|
|
414
|
-
lng: 0
|
|
415
|
-
},
|
|
416
|
-
zoom: o || 0,
|
|
417
|
-
heading: r,
|
|
418
|
-
tilt: i
|
|
419
|
-
});
|
|
420
|
-
}
|
|
421
|
-
function Re(t) {
|
|
422
|
-
const e = Ne(), n = z({
|
|
423
|
-
center: {
|
|
424
|
-
lat: 0,
|
|
425
|
-
lng: 0
|
|
426
|
-
},
|
|
427
|
-
heading: 0,
|
|
428
|
-
tilt: 0,
|
|
429
|
-
zoom: 0
|
|
430
|
-
});
|
|
431
|
-
return v(() => {
|
|
432
|
-
if (!t) return;
|
|
433
|
-
const o = google.maps.event.addListener(t, "bounds_changed", () => {
|
|
434
|
-
ze(t, n), e();
|
|
435
|
-
});
|
|
436
|
-
return () => o.remove();
|
|
437
|
-
}, [t, e]), n;
|
|
438
|
-
}
|
|
439
|
-
const Be = ["id", "defaultBounds", "defaultCenter", "defaultZoom", "defaultHeading", "defaultTilt", "reuseMaps", "renderingType", "colorScheme"], Ge = ["padding"];
|
|
440
|
-
class U {
|
|
441
|
-
static has(e) {
|
|
442
|
-
return this.entries[e] && this.entries[e].length > 0;
|
|
443
|
-
}
|
|
444
|
-
static pop(e) {
|
|
445
|
-
return this.entries[e] && this.entries[e].pop() || null;
|
|
446
|
-
}
|
|
447
|
-
static push(e, n) {
|
|
448
|
-
this.entries[e] || (this.entries[e] = []), this.entries[e].push(n);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
U.entries = {};
|
|
452
|
-
function He(t, e) {
|
|
453
|
-
const n = se(), [o, r] = A(null), [i, a] = Fe(), s = Re(o), {
|
|
454
|
-
id: c,
|
|
455
|
-
defaultBounds: u,
|
|
456
|
-
defaultCenter: d,
|
|
457
|
-
defaultZoom: p,
|
|
458
|
-
defaultHeading: f,
|
|
459
|
-
defaultTilt: m,
|
|
460
|
-
reuseMaps: l,
|
|
461
|
-
renderingType: g,
|
|
462
|
-
colorScheme: C
|
|
463
|
-
} = t, h = D(t, Be), I = t.zoom !== void 0 || t.defaultZoom !== void 0, O = t.center !== void 0 || t.defaultCenter !== void 0;
|
|
464
|
-
!u && (!I || !O) && console.warn("<Map> component is missing configuration. You have to provide zoom and center (via the `zoom`/`defaultZoom` and `center`/`defaultCenter` props) or specify the region to show using `defaultBounds`. See https://visgl.github.io/react-google-maps/docs/api-reference/components/map#required"), !h.center && d && (h.center = d), !h.zoom && Number.isFinite(p) && (h.zoom = p), !h.heading && Number.isFinite(f) && (h.heading = f), !h.tilt && Number.isFinite(m) && (h.tilt = m);
|
|
465
|
-
for (const w of Object.keys(h)) h[w] === void 0 && delete h[w];
|
|
466
|
-
const E = z(void 0);
|
|
467
|
-
return v(
|
|
468
|
-
() => {
|
|
469
|
-
if (!i || !n) return;
|
|
470
|
-
const {
|
|
471
|
-
addMapInstance: w,
|
|
472
|
-
removeMapInstance: y
|
|
473
|
-
} = e, {
|
|
474
|
-
mapId: M
|
|
475
|
-
} = t, k = `${M || "default"}:${g || "default"}:${C || "LIGHT"}`;
|
|
476
|
-
let S, L;
|
|
477
|
-
if (l && U.has(k) ? (L = U.pop(k), S = L.getDiv(), i.appendChild(S), L.setOptions(h), setTimeout(() => L.setCenter(L.getCenter()), 0)) : (S = document.createElement("div"), S.style.height = "100%", i.appendChild(S), L = new google.maps.Map(S, _({}, h, g ? {
|
|
478
|
-
renderingType: g
|
|
479
|
-
} : {}, C ? {
|
|
480
|
-
colorScheme: C
|
|
481
|
-
} : {}))), r(L), w(L, c), u) {
|
|
482
|
-
const {
|
|
483
|
-
padding: T
|
|
484
|
-
} = u, F = D(u, Ge);
|
|
485
|
-
L.fitBounds(F, T);
|
|
486
|
-
} else (!I || !O) && L.fitBounds({
|
|
487
|
-
east: 180,
|
|
488
|
-
west: -180,
|
|
489
|
-
south: -90,
|
|
490
|
-
north: 90
|
|
491
|
-
});
|
|
492
|
-
if (E.current) {
|
|
493
|
-
const {
|
|
494
|
-
mapId: T,
|
|
495
|
-
cameraState: F
|
|
496
|
-
} = E.current;
|
|
497
|
-
T !== M && L.setOptions(F);
|
|
498
|
-
}
|
|
499
|
-
return () => {
|
|
500
|
-
E.current = {
|
|
501
|
-
mapId: M,
|
|
502
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
503
|
-
cameraState: s.current
|
|
504
|
-
}, S.remove(), l ? U.push(k, L) : google.maps.event.clearInstanceListeners(L), r(null), y(c);
|
|
505
|
-
};
|
|
506
|
-
},
|
|
507
|
-
// some dependencies are ignored in the list below:
|
|
508
|
-
// - defaultBounds and the default* camera props will only be used once, and
|
|
509
|
-
// changes should be ignored
|
|
510
|
-
// - mapOptions has special hooks that take care of updating the options
|
|
511
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
512
|
-
[
|
|
513
|
-
i,
|
|
514
|
-
n,
|
|
515
|
-
c,
|
|
516
|
-
// these props can't be changed after initialization and require a new
|
|
517
|
-
// instance to be created
|
|
518
|
-
t.mapId,
|
|
519
|
-
t.renderingType,
|
|
520
|
-
t.colorScheme
|
|
521
|
-
]
|
|
522
|
-
), [o, a, s];
|
|
523
|
-
}
|
|
524
|
-
const le = b.createContext(null), Ue = (t) => {
|
|
525
|
-
const {
|
|
526
|
-
children: e,
|
|
527
|
-
id: n,
|
|
528
|
-
className: o,
|
|
529
|
-
style: r
|
|
530
|
-
} = t, i = R(G), a = ie();
|
|
531
|
-
if (!i)
|
|
532
|
-
throw new Error("<Map> can only be used inside an <ApiProvider> component.");
|
|
533
|
-
const [s, c, u] = He(t, i);
|
|
534
|
-
De(s, u, t), we(s, t), xe(s, t);
|
|
535
|
-
const d = Ae(s, t), p = !!t.controlled;
|
|
536
|
-
v(() => {
|
|
537
|
-
if (s)
|
|
538
|
-
return d && s.setOptions({
|
|
539
|
-
disableDefaultUI: !0
|
|
540
|
-
}), (d || p) && s.setOptions({
|
|
541
|
-
gestureHandling: "none",
|
|
542
|
-
keyboardShortcuts: !1
|
|
543
|
-
}), () => {
|
|
544
|
-
s.setOptions({
|
|
545
|
-
gestureHandling: t.gestureHandling,
|
|
546
|
-
keyboardShortcuts: t.keyboardShortcuts
|
|
547
|
-
});
|
|
548
|
-
};
|
|
549
|
-
}, [s, d, p, t.gestureHandling, t.keyboardShortcuts]);
|
|
550
|
-
const f = t.center ? ae(t.center) : null;
|
|
551
|
-
let m = null, l = null;
|
|
552
|
-
f && Number.isFinite(f.lat) && Number.isFinite(f.lng) && (m = f.lat, l = f.lng);
|
|
553
|
-
const g = P(() => {
|
|
554
|
-
var I, O, E, w, y;
|
|
555
|
-
return {
|
|
556
|
-
center: {
|
|
557
|
-
lat: (I = m) != null ? I : 0,
|
|
558
|
-
lng: (O = l) != null ? O : 0
|
|
559
|
-
},
|
|
560
|
-
zoom: (E = t.zoom) != null ? E : 0,
|
|
561
|
-
heading: (w = t.heading) != null ? w : 0,
|
|
562
|
-
tilt: (y = t.tilt) != null ? y : 0
|
|
563
|
-
};
|
|
564
|
-
}, [m, l, t.zoom, t.heading, t.tilt]);
|
|
565
|
-
W(() => {
|
|
566
|
-
if (!s || !p) return;
|
|
567
|
-
s.moveCamera(g);
|
|
568
|
-
const I = s.addListener("bounds_changed", () => {
|
|
569
|
-
s.moveCamera(g);
|
|
570
|
-
});
|
|
571
|
-
return () => I.remove();
|
|
572
|
-
}, [s, p, g]);
|
|
573
|
-
const C = P(() => _({
|
|
574
|
-
width: "100%",
|
|
575
|
-
height: "100%",
|
|
576
|
-
position: "relative",
|
|
577
|
-
// when using deckgl, the map should be sent to the back
|
|
578
|
-
zIndex: d ? -1 : 0
|
|
579
|
-
}, r), [r, d]), h = P(() => ({
|
|
580
|
-
map: s
|
|
581
|
-
}), [s]);
|
|
582
|
-
return a === x.AUTH_FAILURE ? /* @__PURE__ */ b.createElement("div", {
|
|
583
|
-
style: _({
|
|
584
|
-
position: "relative"
|
|
585
|
-
}, o ? {} : C),
|
|
586
|
-
className: o
|
|
587
|
-
}, /* @__PURE__ */ b.createElement(Te, null)) : /* @__PURE__ */ b.createElement("div", _({
|
|
588
|
-
ref: c,
|
|
589
|
-
"data-testid": "map",
|
|
590
|
-
style: o ? void 0 : C,
|
|
591
|
-
className: o
|
|
592
|
-
}, n ? {
|
|
593
|
-
id: n
|
|
594
|
-
} : {}), s ? /* @__PURE__ */ b.createElement(le.Provider, {
|
|
595
|
-
value: h
|
|
596
|
-
}, e) : null);
|
|
597
|
-
};
|
|
598
|
-
Ue.deckGLViewProps = !0;
|
|
599
|
-
const J = /* @__PURE__ */ new Set();
|
|
600
|
-
function je(...t) {
|
|
601
|
-
const e = JSON.stringify(t);
|
|
602
|
-
J.has(e) || (J.add(e), console.error(...t));
|
|
603
|
-
}
|
|
604
|
-
const Z = (t = null) => {
|
|
605
|
-
const e = R(G), {
|
|
606
|
-
map: n
|
|
607
|
-
} = R(le) || {};
|
|
608
|
-
if (e === null)
|
|
609
|
-
return je("useMap(): failed to retrieve APIProviderContext. Make sure that the <APIProvider> component exists and that the component you are calling `useMap()` from is a sibling of the <APIProvider>."), null;
|
|
610
|
-
const {
|
|
611
|
-
mapInstances: o
|
|
612
|
-
} = e;
|
|
613
|
-
return t !== null ? o[t] || null : n || o.default || null;
|
|
614
|
-
};
|
|
615
|
-
function ce(t) {
|
|
616
|
-
const e = se(), n = R(G);
|
|
617
|
-
return v(() => {
|
|
618
|
-
!e || !n || n.importLibrary(t);
|
|
619
|
-
}, [e, n, t]), n?.loadedLibraries[t] || null;
|
|
620
|
-
}
|
|
621
|
-
function N(t, e, n) {
|
|
622
|
-
v(() => {
|
|
623
|
-
if (!t || !e || !n) return;
|
|
624
|
-
const o = google.maps.event.addListener(t, e, n);
|
|
625
|
-
return () => o.remove();
|
|
626
|
-
}, [t, e, n]);
|
|
627
|
-
}
|
|
628
|
-
function H(t, e, n) {
|
|
629
|
-
v(() => {
|
|
630
|
-
t && (t[e] = n);
|
|
631
|
-
}, [t, e, n]);
|
|
632
|
-
}
|
|
633
|
-
function V(t, e, n) {
|
|
634
|
-
v(() => {
|
|
635
|
-
if (!(!t || !e || !n))
|
|
636
|
-
return t.addEventListener(e, n), () => t.removeEventListener(e, n);
|
|
637
|
-
}, [t, e, n]);
|
|
638
|
-
}
|
|
639
|
-
function $e(t) {
|
|
640
|
-
return t.content !== void 0;
|
|
641
|
-
}
|
|
642
|
-
function K(t) {
|
|
643
|
-
return t.nodeType === Node.ELEMENT_NODE;
|
|
644
|
-
}
|
|
645
|
-
const We = b.createContext(null), Ze = {
|
|
646
|
-
BOTTOM: ["50%", "100%"]
|
|
647
|
-
}, qe = ({
|
|
648
|
-
children: t,
|
|
649
|
-
styles: e,
|
|
650
|
-
className: n,
|
|
651
|
-
anchorPoint: o
|
|
652
|
-
}) => {
|
|
653
|
-
const [r, i] = o ?? Ze.BOTTOM;
|
|
654
|
-
let a = `-${r}`, s = `-${i}`;
|
|
655
|
-
r.trimStart().startsWith("-") && (a = r.substring(1)), i.trimStart().startsWith("-") && (s = i.substring(1));
|
|
656
|
-
const c = `translate(50%, 100%) translate(${a}, ${s})`;
|
|
657
|
-
return (
|
|
658
|
-
// anchoring container
|
|
659
|
-
/* @__PURE__ */ b.createElement("div", {
|
|
660
|
-
style: {
|
|
661
|
-
transform: c
|
|
662
|
-
}
|
|
663
|
-
}, /* @__PURE__ */ b.createElement("div", {
|
|
664
|
-
className: n,
|
|
665
|
-
style: e
|
|
666
|
-
}, t))
|
|
667
|
-
);
|
|
668
|
-
};
|
|
669
|
-
function Je(t) {
|
|
670
|
-
const [e, n] = A(null), [o, r] = A(null), i = Z(), a = ce("marker"), {
|
|
671
|
-
children: s,
|
|
672
|
-
onClick: c,
|
|
673
|
-
className: u,
|
|
674
|
-
onMouseEnter: d,
|
|
675
|
-
onMouseLeave: p,
|
|
676
|
-
onDrag: f,
|
|
677
|
-
onDragStart: m,
|
|
678
|
-
onDragEnd: l,
|
|
679
|
-
collisionBehavior: g,
|
|
680
|
-
clickable: C,
|
|
681
|
-
draggable: h,
|
|
682
|
-
position: I,
|
|
683
|
-
title: O,
|
|
684
|
-
zIndex: E
|
|
685
|
-
} = t, w = ue.count(s);
|
|
686
|
-
return v(() => {
|
|
687
|
-
if (!i || !a) return;
|
|
688
|
-
const y = new a.AdvancedMarkerElement();
|
|
689
|
-
y.map = i, n(y);
|
|
690
|
-
let M = null;
|
|
691
|
-
return w > 0 && (M = document.createElement("div"), M.isCustomMarker = !0, y.content = M, r(M)), () => {
|
|
692
|
-
var k;
|
|
693
|
-
y.map = null, (k = M) == null || k.remove(), n(null), r(null);
|
|
694
|
-
};
|
|
695
|
-
}, [i, a, w]), v(() => {
|
|
696
|
-
!(e != null && e.content) || !K(e.content) || w > 0 || (e.content.className = u ?? "");
|
|
697
|
-
}, [e, u, w]), H(e, "position", I), H(e, "title", O ?? ""), H(e, "zIndex", E), H(e, "collisionBehavior", g), v(() => {
|
|
698
|
-
e && (h !== void 0 ? e.gmpDraggable = h : f || m || l ? e.gmpDraggable = !0 : e.gmpDraggable = !1);
|
|
699
|
-
}, [e, h, f, l, m]), v(() => {
|
|
700
|
-
if (!e) return;
|
|
701
|
-
const y = C !== void 0 || !!c || !!d || !!p;
|
|
702
|
-
e.gmpClickable = y, y && e != null && e.content && K(e.content) && (e.content.style.pointerEvents = "none", e.content.firstElementChild && (e.content.firstElementChild.style.pointerEvents = "all"));
|
|
703
|
-
}, [e, C, c, d, p]), N(e, "click", c), N(e, "drag", f), N(e, "dragstart", m), N(e, "dragend", l), V(e?.element, "mouseenter", d), V(e?.element, "mouseleave", p), [e, o];
|
|
704
|
-
}
|
|
705
|
-
const it = Y((t, e) => {
|
|
706
|
-
const {
|
|
707
|
-
children: n,
|
|
708
|
-
style: o,
|
|
709
|
-
className: r,
|
|
710
|
-
anchorPoint: i
|
|
711
|
-
} = t, [a, s] = Je(t), c = P(() => a ? {
|
|
712
|
-
marker: a
|
|
713
|
-
} : null, [a]);
|
|
714
|
-
return Q(e, () => a, [a]), s ? /* @__PURE__ */ b.createElement(We.Provider, {
|
|
715
|
-
value: c
|
|
716
|
-
}, $(/* @__PURE__ */ b.createElement(qe, {
|
|
717
|
-
anchorPoint: i,
|
|
718
|
-
styles: o,
|
|
719
|
-
className: r
|
|
720
|
-
}, n), s)) : null;
|
|
721
|
-
});
|
|
722
|
-
function Ve(t, e, n) {
|
|
723
|
-
if (e != null && typeof e != "object")
|
|
724
|
-
throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
|
|
725
|
-
const o = t.style;
|
|
726
|
-
if (n == null) {
|
|
727
|
-
if (e == null) return;
|
|
728
|
-
for (const r in e)
|
|
729
|
-
e.hasOwnProperty(r) && X(o, r, e[r]);
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
for (const r in n)
|
|
733
|
-
n.hasOwnProperty(r) && (e == null || !e.hasOwnProperty(r)) && (r.indexOf("--") === 0 ? o.setProperty(r, "") : r === "float" ? o.cssFloat = "" : o[r] = "");
|
|
734
|
-
if (e != null)
|
|
735
|
-
for (const r in e) {
|
|
736
|
-
const i = e[r];
|
|
737
|
-
e.hasOwnProperty(r) && n[r] !== i && X(o, r, i);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
function X(t, e, n) {
|
|
741
|
-
const o = e.indexOf("--") === 0;
|
|
742
|
-
n == null || typeof n == "boolean" || n === "" ? o ? t.setProperty(e, "") : e === "float" ? t.cssFloat = "" : t[e] = "" : o ? t.setProperty(e, n) : typeof n == "number" && n !== 0 && !Xe(e) ? t[e] = n + "px" : e === "float" ? t.cssFloat = n : t[e] = ("" + n).trim();
|
|
743
|
-
}
|
|
744
|
-
const Ke = /* @__PURE__ */ new Set([
|
|
745
|
-
"animationIterationCount",
|
|
746
|
-
"aspectRatio",
|
|
747
|
-
"borderImageOutset",
|
|
748
|
-
"borderImageSlice",
|
|
749
|
-
"borderImageWidth",
|
|
750
|
-
"boxFlex",
|
|
751
|
-
"boxFlexGroup",
|
|
752
|
-
"boxOrdinalGroup",
|
|
753
|
-
"columnCount",
|
|
754
|
-
"columns",
|
|
755
|
-
"flex",
|
|
756
|
-
"flexGrow",
|
|
757
|
-
"flexPositive",
|
|
758
|
-
"flexShrink",
|
|
759
|
-
"flexNegative",
|
|
760
|
-
"flexOrder",
|
|
761
|
-
"gridArea",
|
|
762
|
-
"gridRow",
|
|
763
|
-
"gridRowEnd",
|
|
764
|
-
"gridRowSpan",
|
|
765
|
-
"gridRowStart",
|
|
766
|
-
"gridColumn",
|
|
767
|
-
"gridColumnEnd",
|
|
768
|
-
"gridColumnSpan",
|
|
769
|
-
"gridColumnStart",
|
|
770
|
-
"fontWeight",
|
|
771
|
-
"lineClamp",
|
|
772
|
-
"lineHeight",
|
|
773
|
-
"opacity",
|
|
774
|
-
"order",
|
|
775
|
-
"orphans",
|
|
776
|
-
"scale",
|
|
777
|
-
"tabSize",
|
|
778
|
-
"widows",
|
|
779
|
-
"zIndex",
|
|
780
|
-
"zoom",
|
|
781
|
-
"fillOpacity",
|
|
782
|
-
// SVG-related properties
|
|
783
|
-
"floodOpacity",
|
|
784
|
-
"stopOpacity",
|
|
785
|
-
"strokeDasharray",
|
|
786
|
-
"strokeDashoffset",
|
|
787
|
-
"strokeMiterlimit",
|
|
788
|
-
"strokeOpacity",
|
|
789
|
-
"strokeWidth"
|
|
790
|
-
]);
|
|
791
|
-
function Xe(t) {
|
|
792
|
-
return Ke.has(t);
|
|
793
|
-
}
|
|
794
|
-
const Ye = ["children", "headerContent", "style", "className", "pixelOffset", "anchor", "shouldFocus", "onClose", "onCloseClick"], at = (t) => {
|
|
795
|
-
const {
|
|
796
|
-
// content options
|
|
797
|
-
children: e,
|
|
798
|
-
headerContent: n,
|
|
799
|
-
style: o,
|
|
800
|
-
className: r,
|
|
801
|
-
pixelOffset: i,
|
|
802
|
-
// open options
|
|
803
|
-
anchor: a,
|
|
804
|
-
shouldFocus: s,
|
|
805
|
-
// events
|
|
806
|
-
onClose: c,
|
|
807
|
-
onCloseClick: u
|
|
808
|
-
// other options
|
|
809
|
-
} = t, d = D(t, Ye), p = ce("maps"), [f, m] = A(null), l = z(null), g = z(null), C = re(d, ne);
|
|
810
|
-
v(
|
|
811
|
-
() => {
|
|
812
|
-
if (!p) return;
|
|
813
|
-
l.current = document.createElement("div"), g.current = document.createElement("div");
|
|
814
|
-
const O = C;
|
|
815
|
-
i && (O.pixelOffset = new google.maps.Size(i[0], i[1])), n && (O.headerContent = typeof n == "string" ? n : g.current);
|
|
816
|
-
const E = new google.maps.InfoWindow(C);
|
|
817
|
-
return E.setContent(l.current), m(E), () => {
|
|
818
|
-
var w, y;
|
|
819
|
-
E.setContent(null), (w = l.current) == null || w.remove(), (y = g.current) == null || y.remove(), l.current = null, g.current = null, m(null);
|
|
820
|
-
};
|
|
821
|
-
},
|
|
822
|
-
// `infoWindowOptions` and other props are missing from dependencies:
|
|
823
|
-
//
|
|
824
|
-
// We don't want to re-create the infowindow instance
|
|
825
|
-
// when the options change.
|
|
826
|
-
// Updating the options is handled in the useEffect below.
|
|
827
|
-
//
|
|
828
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
829
|
-
[p]
|
|
830
|
-
);
|
|
831
|
-
const h = z(null);
|
|
832
|
-
v(() => {
|
|
833
|
-
!f || !l.current || (Ve(l.current, o || null, h.current), h.current = o || null, r !== l.current.className && (l.current.className = r || ""));
|
|
834
|
-
}, [f, r, o]), v(
|
|
835
|
-
() => {
|
|
836
|
-
if (!f) return;
|
|
837
|
-
const O = C;
|
|
838
|
-
i ? O.pixelOffset = new google.maps.Size(i[0], i[1]) : O.pixelOffset = null, n ? O.headerContent = typeof n == "string" ? n : g.current : O.headerContent = null, f.setOptions(C);
|
|
839
|
-
},
|
|
840
|
-
// dependency `infoWindow` isn't needed since options are also passed
|
|
841
|
-
// to the constructor when a new infoWindow is created.
|
|
842
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
843
|
-
[C, i, n]
|
|
844
|
-
), N(f, "close", c), N(f, "closeclick", u);
|
|
845
|
-
const I = Z();
|
|
846
|
-
return v(() => {
|
|
847
|
-
if (!I || !f || a === null) return;
|
|
848
|
-
const O = !!a, E = {
|
|
849
|
-
map: I
|
|
850
|
-
};
|
|
851
|
-
if (a && (E.anchor = a, $e(a) && a.content instanceof Element)) {
|
|
852
|
-
const y = a.content, M = y?.getBoundingClientRect();
|
|
853
|
-
if (M && y != null && y.isCustomMarker) {
|
|
854
|
-
var w;
|
|
855
|
-
const k = (w = a.content.firstElementChild) == null ? void 0 : w.firstElementChild, S = k?.getBoundingClientRect(), L = S.x - M.x + (S.width - M.width) / 2, T = S.y - M.y, F = C;
|
|
856
|
-
F.pixelOffset = new google.maps.Size(i ? i[0] + L : L, i ? i[1] + T : T), f.setOptions(F);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
return s !== void 0 && (E.shouldFocus = s), f.open(E), () => {
|
|
860
|
-
O && f.set("anchor", null), f.close();
|
|
861
|
-
};
|
|
862
|
-
}, [f, a, I, s, C, i]), /* @__PURE__ */ b.createElement(b.Fragment, null, l.current && $(e, l.current), g.current !== null && $(n, g.current));
|
|
863
|
-
}, st = {
|
|
864
|
-
LEFT_TOP: 5,
|
|
865
|
-
LEFT_BOTTOM: 6,
|
|
866
|
-
RIGHT_TOP: 7,
|
|
867
|
-
RIGHT_BOTTOM: 9
|
|
868
|
-
}, Qe = ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut"];
|
|
869
|
-
function et(t) {
|
|
870
|
-
const [e, n] = A(null), o = Z(), {
|
|
871
|
-
onClick: r,
|
|
872
|
-
onDrag: i,
|
|
873
|
-
onDragStart: a,
|
|
874
|
-
onDragEnd: s,
|
|
875
|
-
onMouseOver: c,
|
|
876
|
-
onMouseOut: u
|
|
877
|
-
} = t, d = D(t, Qe), {
|
|
878
|
-
position: p,
|
|
879
|
-
draggable: f
|
|
880
|
-
} = d;
|
|
881
|
-
return v(() => {
|
|
882
|
-
if (!o) {
|
|
883
|
-
o === void 0 && console.error("<Marker> has to be inside a Map component.");
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
const m = new google.maps.Marker(d);
|
|
887
|
-
return m.setMap(o), n(m), () => {
|
|
888
|
-
m.setMap(null), n(null);
|
|
889
|
-
};
|
|
890
|
-
}, [o]), v(() => {
|
|
891
|
-
if (!e) return;
|
|
892
|
-
const m = e, l = google.maps.event;
|
|
893
|
-
return r && l.addListener(m, "click", r), i && l.addListener(m, "drag", i), a && l.addListener(m, "dragstart", a), s && l.addListener(m, "dragend", s), c && l.addListener(m, "mouseover", c), u && l.addListener(m, "mouseout", u), e.setDraggable(!!f), () => {
|
|
894
|
-
l.clearInstanceListeners(m);
|
|
895
|
-
};
|
|
896
|
-
}, [e, f, r, i, a, s, c, u]), v(() => {
|
|
897
|
-
e && d && e.setOptions(d);
|
|
898
|
-
}, [e, d]), v(() => {
|
|
899
|
-
f || !p || !e || e.setPosition(p);
|
|
900
|
-
}, [f, p, e]), e;
|
|
901
|
-
}
|
|
902
|
-
Y((t, e) => {
|
|
903
|
-
const n = et(t);
|
|
904
|
-
return Q(e, () => n, [n]), /* @__PURE__ */ b.createElement(b.Fragment, null);
|
|
905
|
-
});
|
|
906
|
-
export {
|
|
907
|
-
rt as A,
|
|
908
|
-
st as C,
|
|
909
|
-
le as G,
|
|
910
|
-
at as I,
|
|
911
|
-
Ue as M,
|
|
912
|
-
it as a,
|
|
913
|
-
Z as u
|
|
914
|
-
};
|