@alfadocs/ui-kit 0.10.0 → 0.12.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.
Files changed (35) hide show
  1. package/dist/_chunks/_commonjsHelpers-C6fGbg64.js +7 -0
  2. package/dist/_chunks/{ai-prompt-input-bAJwYu84.js → ai-prompt-input-noh-N3cf.js} +2 -2
  3. package/dist/_chunks/{contact-card-VJIUqKB2.js → contact-card-DTQUMetD.js} +22 -38
  4. package/dist/_chunks/external-link-C6F25E6k.js +16 -0
  5. package/dist/_chunks/{file-upload-DIecAfC-.js → file-upload-nMh-1jDD.js} +2 -2
  6. package/dist/_chunks/{index-CeY1nNvd.js → index-CFoBa86t.js} +61 -63
  7. package/dist/_chunks/{link-BGpwaFik.js → link-DmM5IevO.js} +16 -26
  8. package/dist/_chunks/map-pin-B8STOPMJ.js +21 -0
  9. package/dist/_chunks/map-view-Dd48BxVB.js +1941 -0
  10. package/dist/_chunks/{pdf-viewer-CNETPubN.js → pdf-viewer-CnEJvmXC.js} +407 -382
  11. package/dist/_chunks/whatsapp-button-Bj5FIhpC.js +175 -0
  12. package/dist/agent-catalog.json +53 -1
  13. package/dist/components/ai-prompt-input/index.js +1 -1
  14. package/dist/components/contact-card/index.js +1 -1
  15. package/dist/components/file-upload/index.js +1 -1
  16. package/dist/components/index.d.ts +2 -0
  17. package/dist/components/link/index.js +1 -1
  18. package/dist/components/map-view/index.d.ts +3 -0
  19. package/dist/components/map-view/index.js +5 -0
  20. package/dist/components/map-view/map-view.agent.d.ts +4 -0
  21. package/dist/components/map-view/map-view.d.ts +78 -0
  22. package/dist/components/pdf-viewer/index.js +1 -1
  23. package/dist/components/pdf-viewer/pdf-viewer.d.ts +62 -0
  24. package/dist/components/whatsapp-button/index.d.ts +3 -0
  25. package/dist/components/whatsapp-button/index.js +5 -0
  26. package/dist/components/whatsapp-button/whatsapp-button.d.ts +32 -0
  27. package/dist/i18n/config.js +47 -5
  28. package/dist/i18n/resources.d.ts +42 -0
  29. package/dist/index.js +348 -344
  30. package/dist/locales/de.json +15 -1
  31. package/dist/locales/en.json +15 -1
  32. package/dist/locales/it.json +15 -1
  33. package/dist/tokens/google-maps-theme.d.ts +15 -0
  34. package/dist/tokens.css +1 -1
  35. package/package.json +15 -1
@@ -0,0 +1,1941 @@
1
+ import { jsx as R, jsxs as ae } from "react/jsx-runtime";
2
+ import * as Re from "react";
3
+ import T, { useMemo as I, useContext as B, useEffect as E, useLayoutEffect as Y, forwardRef as U, useImperativeHandle as H, useState as N, useReducer as je, useCallback as le, useRef as F, Children as be, createContext as Xe, useId as Qe } from "react";
4
+ import { c as ee } from "./index-D2ZczOXr.js";
5
+ import { useTranslation as ze } from "react-i18next";
6
+ import { createPortal as ce } from "react-dom";
7
+ import { g as en } from "./_commonjsHelpers-C6fGbg64.js";
8
+ import { B as nn } from "./button-DD_0Xdmr.js";
9
+ import { u as tn } from "./registry-C9nwlNyL.js";
10
+ import { M as on } from "./map-pin-B8STOPMJ.js";
11
+ import { E as rn } from "./external-link-C6F25E6k.js";
12
+ var ue, Le;
13
+ function an() {
14
+ return Le || (Le = 1, ue = function e(n, t) {
15
+ if (n === t) return !0;
16
+ if (n && t && typeof n == "object" && typeof t == "object") {
17
+ if (n.constructor !== t.constructor) return !1;
18
+ var o, r, a;
19
+ if (Array.isArray(n)) {
20
+ if (o = n.length, o != t.length) return !1;
21
+ for (r = o; r-- !== 0; )
22
+ if (!e(n[r], t[r])) return !1;
23
+ return !0;
24
+ }
25
+ if (n.constructor === RegExp) return n.source === t.source && n.flags === t.flags;
26
+ if (n.valueOf !== Object.prototype.valueOf) return n.valueOf() === t.valueOf();
27
+ if (n.toString !== Object.prototype.toString) return n.toString() === t.toString();
28
+ if (a = Object.keys(n), o = a.length, o !== Object.keys(t).length) return !1;
29
+ for (r = o; r-- !== 0; )
30
+ if (!Object.prototype.hasOwnProperty.call(t, a[r])) return !1;
31
+ for (r = o; r-- !== 0; ) {
32
+ var i = a[r];
33
+ if (!e(n[i], t[i])) return !1;
34
+ }
35
+ return !0;
36
+ }
37
+ return n !== n && t !== t;
38
+ }), ue;
39
+ }
40
+ var sn = an();
41
+ const ne = /* @__PURE__ */ en(sn), ln = "1.8.3";
42
+ function j(e, n) {
43
+ var t = {};
44
+ for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
45
+ if (e != null && typeof Object.getOwnPropertySymbols == "function")
46
+ for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
47
+ n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (t[o[r]] = e[o[r]]);
48
+ return t;
49
+ }
50
+ function De(e, n, t, o) {
51
+ function r(a) {
52
+ return a instanceof t ? a : new t(function(i) {
53
+ i(a);
54
+ });
55
+ }
56
+ return new (t || (t = Promise))(function(a, i) {
57
+ function s(l) {
58
+ try {
59
+ c(o.next(l));
60
+ } catch (f) {
61
+ i(f);
62
+ }
63
+ }
64
+ function g(l) {
65
+ try {
66
+ c(o.throw(l));
67
+ } catch (f) {
68
+ i(f);
69
+ }
70
+ }
71
+ function c(l) {
72
+ l.done ? a(l.value) : r(l.value).then(s, g);
73
+ }
74
+ c((o = o.apply(e, [])).next());
75
+ });
76
+ }
77
+ function cn(e, n) {
78
+ e.src = n;
79
+ }
80
+ const dn = (e) => {
81
+ var n, t, o, r = "The Google Maps JavaScript API", a = "google", i = "importLibrary", s = "__ib__", g = document, c = window, l = c[a] || (c[a] = {}), f = l.maps || (l.maps = {}), m = /* @__PURE__ */ new Set(), u = new URLSearchParams(), h = () => n || (n = new Promise(async (y, d) => {
82
+ var p;
83
+ await (t = g.createElement("script")), u.set("libraries", [...m] + "");
84
+ for (o in e)
85
+ u.set(o.replace(/[A-Z]/g, (b) => "_" + b[0].toLowerCase()), e[o]);
86
+ u.set("callback", a + ".maps." + s), cn(t, "https://maps.googleapis.com/maps/api/js?" + u), f[s] = y, t.onerror = () => n = d(Error(r + " could not load.")), t.nonce = ((p = g.querySelector("script[nonce]")) == null ? void 0 : p.nonce) || "", g.head.append(t);
87
+ }));
88
+ f[i] ? console.warn(r + " only loads once. Ignoring:", e) : f[i] = (y, ...d) => m.add(y) && h().then(() => f[i](y, ...d));
89
+ }, un = (e) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(e)}) will be ignored.`, gn = (e) => `The google.maps.importLibrary() function is already defined, and @googlemaps/js-api-loader will use the existing function instead of overwriting it. The options passed to setOptions (${JSON.stringify(e)}) will be ignored.`, fn = "No options were set before calling importLibrary. Make sure to configure the loader using setOptions().", mn = "There already is a script loading the Google Maps JavaScript API, and no google.maps.importLibrary function is defined. @googlemaps/js-api-loader will proceed to bootstrap the API with the specified options, but the existing script might cause problems using the API. Make sure to remove the script loading the API.", Be = process.env.NODE_ENV !== "production", Ee = Be ? (e) => {
90
+ console.warn(`[@googlemaps/js-api-loader] ${e}`);
91
+ } : () => {
92
+ }, pn = Be ? (e) => {
93
+ console.info(`[@googlemaps/js-api-loader] ${e}`);
94
+ } : () => {
95
+ }, hn = process.env.NODE_ENV !== "production";
96
+ let me = !1;
97
+ function vn(e) {
98
+ if (me) {
99
+ Ee(un(e));
100
+ return;
101
+ }
102
+ bn(e), me = !0;
103
+ }
104
+ async function yn(e) {
105
+ var n, t;
106
+ if (me || Ee(fn), !((t = (n = window == null ? void 0 : window.google) == null ? void 0 : n.maps) != null && t.importLibrary))
107
+ throw new Error("google.maps.importLibrary is not installed.");
108
+ return await google.maps.importLibrary(e);
109
+ }
110
+ function bn(e) {
111
+ var t, o;
112
+ const n = !!((o = (t = window.google) == null ? void 0 : t.maps) != null && o.importLibrary);
113
+ n ? pn(gn(e)) : hn && document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]') && Ee(mn), n || dn(e);
114
+ }
115
+ const z = {
116
+ NOT_LOADED: "NOT_LOADED",
117
+ LOADING: "LOADING",
118
+ LOADED: "LOADED",
119
+ FAILED: "FAILED",
120
+ AUTH_FAILURE: "AUTH_FAILURE"
121
+ }, En = "GMP_visgl_rgmlibrary_v1_default", Cn = [
122
+ `gmp_visgl_reactgooglemaps_v${ln}`
123
+ ], X = T.createContext(null);
124
+ let V = z.NOT_LOADED, oe;
125
+ const pe = /* @__PURE__ */ new Set();
126
+ function re(e) {
127
+ e !== V && (V = e, pe.forEach((n) => n(V)));
128
+ }
129
+ function On() {
130
+ const [e, n] = N({});
131
+ return { mapInstances: e, addMapInstance: (a, i = "default") => {
132
+ n((s) => Object.assign(Object.assign({}, s), { [i]: a }));
133
+ }, removeMapInstance: (a = "default") => {
134
+ n((i) => {
135
+ var s = a;
136
+ i[s];
137
+ var g = j(i, [typeof s == "symbol" ? s : s + ""]);
138
+ return g;
139
+ });
140
+ }, clearMapInstances: () => {
141
+ n({});
142
+ } };
143
+ }
144
+ function Mn() {
145
+ const [e, n] = N({});
146
+ return {
147
+ map3dInstances: e,
148
+ addMap3DInstance: (a, i = "default") => {
149
+ n((s) => Object.assign(Object.assign({}, s), { [i]: a }));
150
+ },
151
+ removeMap3DInstance: (a = "default") => {
152
+ n((i) => {
153
+ var s = a;
154
+ i[s];
155
+ var g = j(i, [typeof s == "symbol" ? s : s + ""]);
156
+ return g;
157
+ });
158
+ },
159
+ clearMap3DInstances: () => {
160
+ n({});
161
+ }
162
+ };
163
+ }
164
+ function Pn(e) {
165
+ const { onLoad: n, onError: t, apiKey: o, version: r, libraries: a = [], region: i, language: s, authReferrerPolicy: g, channel: c, solutionChannel: l, fetchAppCheckToken: f } = e, [m, u] = N(V), [h, y] = je((b, C) => b[C.name] ? b : Object.assign(Object.assign({}, b), { [C.name]: C.value }), {}), d = I(() => {
166
+ const b = {
167
+ apiKey: o,
168
+ version: r,
169
+ libraries: a.join(","),
170
+ region: i,
171
+ language: s,
172
+ authReferrerPolicy: g,
173
+ channel: c,
174
+ solutionChannel: l
175
+ };
176
+ return JSON.stringify(b);
177
+ }, [
178
+ o,
179
+ r,
180
+ a,
181
+ i,
182
+ s,
183
+ g,
184
+ c,
185
+ l
186
+ ]), p = le((b) => De(this, void 0, void 0, function* () {
187
+ if (h[b])
188
+ return h[b];
189
+ const C = yield yn(b);
190
+ return y({ name: b, value: C }), C;
191
+ }), [h]);
192
+ return E(() => (pe.add(u), u(V), () => {
193
+ pe.delete(u);
194
+ }), []), E(
195
+ () => {
196
+ De(this, void 0, void 0, function* () {
197
+ var b, C;
198
+ try {
199
+ oe && oe !== d && console.warn("The Google Maps JavaScript API has already been loaded with different parameters. The new parameters will be ignored. If you need to use different parameters, please refresh the page.");
200
+ const w = ["core", "maps", ...a];
201
+ if (!((C = (b = window.google) === null || b === void 0 ? void 0 : b.maps) === null || C === void 0) && C.importLibrary) {
202
+ oe || re(z.LOADED), yield Promise.all(w.map((v) => p(v))), n && n();
203
+ return;
204
+ }
205
+ if (V === z.LOADING || V === z.LOADED) {
206
+ V === z.LOADED && n && n();
207
+ return;
208
+ }
209
+ oe = d, re(z.LOADING);
210
+ const A = Object.fromEntries(Object.entries({
211
+ key: o,
212
+ v: r,
213
+ libraries: a,
214
+ region: i,
215
+ language: s,
216
+ authReferrerPolicy: g
217
+ }).filter(([, v]) => v !== void 0));
218
+ c !== void 0 && c >= 0 && c <= 999 && (A.channel = String(c)), l === void 0 ? A.solutionChannel = En : l !== "" && (A.solutionChannel = l), vn(A), yield Promise.all(w.map((v) => p(v))), re(z.LOADED), n && n();
219
+ } catch (w) {
220
+ re(z.FAILED), t ? t(w) : console.error("The Google Maps JavaScript API failed to load.", w);
221
+ }
222
+ });
223
+ },
224
+ // eslint-disable-next-line react-hooks/exhaustive-deps
225
+ [d, n, t, p, a]
226
+ ), E(() => {
227
+ if (m !== z.LOADED)
228
+ return;
229
+ const b = google.maps.Settings.getInstance();
230
+ f ? b.fetchAppCheckToken = f : b.fetchAppCheckToken && (b.fetchAppCheckToken = null);
231
+ }, [m, f]), {
232
+ status: m,
233
+ loadedLibraries: h,
234
+ importLibrary: p
235
+ };
236
+ }
237
+ function wn(e) {
238
+ return I(() => e.disableUsageAttribution ? null : Cn, [e.disableUsageAttribution]);
239
+ }
240
+ const An = (e) => {
241
+ const { children: n } = e, t = j(e, ["children"]), { mapInstances: o, addMapInstance: r, removeMapInstance: a, clearMapInstances: i } = On(), { map3dInstances: s, addMap3DInstance: g, removeMap3DInstance: c, clearMap3DInstances: l } = Mn(), { status: f, loadedLibraries: m, importLibrary: u } = Pn(t), h = wn(t), y = I(() => ({
242
+ mapInstances: o,
243
+ addMapInstance: r,
244
+ removeMapInstance: a,
245
+ clearMapInstances: i,
246
+ map3dInstances: s,
247
+ addMap3DInstance: g,
248
+ removeMap3DInstance: c,
249
+ clearMap3DInstances: l,
250
+ status: f,
251
+ loadedLibraries: m,
252
+ importLibrary: u,
253
+ internalUsageAttributionIds: h
254
+ }), [
255
+ o,
256
+ r,
257
+ a,
258
+ i,
259
+ s,
260
+ g,
261
+ c,
262
+ l,
263
+ f,
264
+ m,
265
+ u,
266
+ h
267
+ ]);
268
+ return T.createElement(X.Provider, { value: y }, n);
269
+ };
270
+ function Tn(e, n) {
271
+ for (const t of kn) {
272
+ const o = n[t], r = Fe[t];
273
+ E(() => {
274
+ if (!e || !o)
275
+ return;
276
+ const a = google.maps.event.addListener(e, r, (i) => {
277
+ o(Ln(r, e, i));
278
+ });
279
+ return () => a.remove();
280
+ }, [e, r, o]);
281
+ }
282
+ }
283
+ function Ln(e, n, t) {
284
+ var o;
285
+ const r = {
286
+ type: e,
287
+ map: n,
288
+ detail: {},
289
+ stoppable: !1,
290
+ stop: () => {
291
+ }
292
+ };
293
+ if (Dn.includes(e)) {
294
+ const a = r, i = n.getCenter(), s = n.getZoom(), g = n.getHeading() || 0, c = n.getTilt() || 0, l = n.getBounds();
295
+ return (!i || !l || !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"), a.detail = {
296
+ center: (i == null ? void 0 : i.toJSON()) || { lat: 0, lng: 0 },
297
+ zoom: s || 0,
298
+ heading: g,
299
+ tilt: c,
300
+ bounds: (l == null ? void 0 : l.toJSON()) || {
301
+ north: 90,
302
+ east: 180,
303
+ south: -90,
304
+ west: -180
305
+ }
306
+ }, a;
307
+ } else if (Sn.includes(e)) {
308
+ if (!t)
309
+ throw new Error("[createEvent] mouse events must provide a srcEvent");
310
+ const a = r;
311
+ return a.domEvent = t.domEvent, a.stoppable = !0, a.stop = () => t.stop(), a.detail = {
312
+ latLng: ((o = t.latLng) === null || o === void 0 ? void 0 : o.toJSON()) || null,
313
+ placeId: t.placeId
314
+ }, a;
315
+ }
316
+ return r;
317
+ }
318
+ const Fe = {
319
+ onBoundsChanged: "bounds_changed",
320
+ onCenterChanged: "center_changed",
321
+ onClick: "click",
322
+ onContextmenu: "contextmenu",
323
+ onDblclick: "dblclick",
324
+ onDrag: "drag",
325
+ onDragend: "dragend",
326
+ onDragstart: "dragstart",
327
+ onHeadingChanged: "heading_changed",
328
+ onIdle: "idle",
329
+ onIsFractionalZoomEnabledChanged: "isfractionalzoomenabled_changed",
330
+ onMapCapabilitiesChanged: "mapcapabilities_changed",
331
+ onMapTypeIdChanged: "maptypeid_changed",
332
+ onMousemove: "mousemove",
333
+ onMouseout: "mouseout",
334
+ onMouseover: "mouseover",
335
+ onProjectionChanged: "projection_changed",
336
+ onRenderingTypeChanged: "renderingtype_changed",
337
+ onTilesLoaded: "tilesloaded",
338
+ onTiltChanged: "tilt_changed",
339
+ onZoomChanged: "zoom_changed",
340
+ // note: onCameraChanged is an alias for the bounds_changed event,
341
+ // since that is going to be fired in every situation where the camera is
342
+ // updated.
343
+ onCameraChanged: "bounds_changed"
344
+ }, Dn = [
345
+ "bounds_changed",
346
+ "center_changed",
347
+ "heading_changed",
348
+ "tilt_changed",
349
+ "zoom_changed"
350
+ ], Sn = [
351
+ "click",
352
+ "contextmenu",
353
+ "dblclick",
354
+ "mousemove",
355
+ "mouseout",
356
+ "mouseover"
357
+ ], kn = Object.keys(Fe);
358
+ function te(e, n) {
359
+ const t = F(e);
360
+ return n(e, t.current) || (t.current = e), t.current;
361
+ }
362
+ function _n(e, n, t) {
363
+ E(e, [te(n, t)]);
364
+ }
365
+ function Ue(e, n) {
366
+ _n(e, n, ne);
367
+ }
368
+ const In = /* @__PURE__ */ new Set([
369
+ "backgroundColor",
370
+ "clickableIcons",
371
+ "controlSize",
372
+ "disableDefaultUI",
373
+ "disableDoubleClickZoom",
374
+ "draggable",
375
+ "draggableCursor",
376
+ "draggingCursor",
377
+ "fullscreenControl",
378
+ "fullscreenControlOptions",
379
+ "gestureHandling",
380
+ "headingInteractionEnabled",
381
+ "isFractionalZoomEnabled",
382
+ "keyboardShortcuts",
383
+ "mapTypeControl",
384
+ "mapTypeControlOptions",
385
+ "mapTypeId",
386
+ "maxZoom",
387
+ "minZoom",
388
+ "noClear",
389
+ "panControl",
390
+ "panControlOptions",
391
+ "restriction",
392
+ "rotateControl",
393
+ "rotateControlOptions",
394
+ "scaleControl",
395
+ "scaleControlOptions",
396
+ "scrollwheel",
397
+ "streetView",
398
+ "streetViewControl",
399
+ "streetViewControlOptions",
400
+ "styles",
401
+ "tiltInteractionEnabled",
402
+ "zoomControl",
403
+ "zoomControlOptions"
404
+ ]);
405
+ function Nn(e, n) {
406
+ const t = {}, o = Object.keys(n);
407
+ for (const r of o)
408
+ In.has(r) && (t[r] = n[r]);
409
+ Ue(() => {
410
+ e && e.setOptions(t);
411
+ }, [t]);
412
+ }
413
+ function He() {
414
+ var e;
415
+ return ((e = B(X)) === null || e === void 0 ? void 0 : e.status) || z.NOT_LOADED;
416
+ }
417
+ function xn(e, n) {
418
+ const { viewport: t, viewState: o } = n, r = !!t;
419
+ return Y(() => {
420
+ if (!e || !o)
421
+ return;
422
+ const { latitude: a, longitude: i, bearing: s, pitch: g, zoom: c } = o;
423
+ e.moveCamera({
424
+ center: { lat: a, lng: i },
425
+ heading: s,
426
+ tilt: g,
427
+ zoom: c + 1
428
+ });
429
+ }, [e, o]), r;
430
+ }
431
+ function Rn(e) {
432
+ return !e || typeof e != "object" || !("lat" in e && "lng" in e) ? !1 : Number.isFinite(e.lat) && Number.isFinite(e.lng);
433
+ }
434
+ function Ve(e, n) {
435
+ if (!e || !n)
436
+ return !1;
437
+ const t = se(e), o = se(n);
438
+ return !(t.lat !== o.lat || t.lng !== o.lng);
439
+ }
440
+ function se(e) {
441
+ return Rn(e) ? e : e.toJSON();
442
+ }
443
+ function Se(e) {
444
+ if ("north" in e && "south" in e && "east" in e && "west" in e)
445
+ return e;
446
+ const n = e.getNorthEast().toJSON(), t = e.getSouthWest().toJSON();
447
+ return {
448
+ north: n.lat,
449
+ east: n.lng,
450
+ south: t.lat,
451
+ west: t.lng
452
+ };
453
+ }
454
+ function jn(e, n) {
455
+ if (!e || !n)
456
+ return !1;
457
+ const t = Se(e), o = Se(n);
458
+ return t.north === o.north && t.south === o.south && t.east === o.east && t.west === o.west;
459
+ }
460
+ function Ge(e, n) {
461
+ if (!e || !n)
462
+ return e === n;
463
+ const t = "getArray" in n ? n.getArray() : n;
464
+ if (e.length !== t.length)
465
+ return !1;
466
+ for (let o = 0; o < e.length; o++)
467
+ if (!Ve(e[o], t[o]))
468
+ return !1;
469
+ return !0;
470
+ }
471
+ function zn(e, n) {
472
+ if (!e || !n)
473
+ return e === n;
474
+ const t = "getArray" in n ? n.getArray().map((o) => o.getArray()) : n;
475
+ if (e.length !== t.length)
476
+ return !1;
477
+ for (let o = 0; o < e.length; o++)
478
+ if (!Ge(e[o], t[o]))
479
+ return !1;
480
+ return !0;
481
+ }
482
+ function Bn(e, n, t) {
483
+ const o = t.center ? se(t.center) : null;
484
+ let r = null, a = null;
485
+ o && Number.isFinite(o.lat) && Number.isFinite(o.lng) && (r = o.lat, a = o.lng);
486
+ const i = Number.isFinite(t.zoom) ? t.zoom : null, s = Number.isFinite(t.heading) ? t.heading : null, g = Number.isFinite(t.tilt) ? t.tilt : null;
487
+ Y(() => {
488
+ if (!e)
489
+ return;
490
+ const c = {};
491
+ let l = !1;
492
+ r !== null && a !== null && (n.current.center.lat !== r || n.current.center.lng !== a) && (c.center = { lat: r, lng: a }, l = !0), i !== null && n.current.zoom !== i && (c.zoom = i, l = !0), s !== null && n.current.heading !== s && (c.heading = s, l = !0), g !== null && n.current.tilt !== g && (c.tilt = g, l = !0), l && e.moveCamera(c);
493
+ });
494
+ }
495
+ const Fn = () => {
496
+ const e = {
497
+ position: "absolute",
498
+ top: 0,
499
+ left: 0,
500
+ bottom: 0,
501
+ right: 0,
502
+ zIndex: 999,
503
+ display: "flex",
504
+ flexFlow: "column nowrap",
505
+ textAlign: "center",
506
+ justifyContent: "center",
507
+ fontSize: ".8rem",
508
+ color: "rgba(0,0,0,0.6)",
509
+ background: "#dddddd",
510
+ padding: "1rem 1.5rem"
511
+ };
512
+ return T.createElement(
513
+ "div",
514
+ { style: e },
515
+ T.createElement("h2", null, "Error: AuthFailure"),
516
+ T.createElement(
517
+ "p",
518
+ null,
519
+ "A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",
520
+ T.createElement("code", null, "APIProvider.apiKey"),
521
+ " prop is correct. Check the error-message in the console for further details."
522
+ )
523
+ );
524
+ };
525
+ function he() {
526
+ const [e, n] = N(null), t = le((o) => n(o), [n]);
527
+ return [e, t];
528
+ }
529
+ function Je() {
530
+ return He() === z.LOADED;
531
+ }
532
+ function Ze() {
533
+ const [, e] = je((n) => n + 1, 0);
534
+ return e;
535
+ }
536
+ function Un(e, n) {
537
+ const t = e.getCenter(), o = e.getZoom(), r = e.getHeading() || 0, a = e.getTilt() || 0, i = e.getBounds();
538
+ (!t || !i || !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(n.current, {
539
+ center: (t == null ? void 0 : t.toJSON()) || { lat: 0, lng: 0 },
540
+ zoom: o || 0,
541
+ heading: r,
542
+ tilt: a
543
+ });
544
+ }
545
+ function Hn(e) {
546
+ const n = Ze(), t = F({
547
+ center: { lat: 0, lng: 0 },
548
+ heading: 0,
549
+ tilt: 0,
550
+ zoom: 0
551
+ });
552
+ return E(() => {
553
+ if (!e)
554
+ return;
555
+ const o = google.maps.event.addListener(e, "bounds_changed", () => {
556
+ Un(e, t), n();
557
+ });
558
+ return () => o.remove();
559
+ }, [e, n]), t;
560
+ }
561
+ class ie {
562
+ static has(n) {
563
+ return this.entries[n] && this.entries[n].length > 0;
564
+ }
565
+ static pop(n) {
566
+ return this.entries[n] && this.entries[n].pop() || null;
567
+ }
568
+ static push(n, t) {
569
+ this.entries[n] || (this.entries[n] = []), this.entries[n].push(t);
570
+ }
571
+ }
572
+ ie.entries = {};
573
+ function Vn(e, n) {
574
+ const t = Je(), [o, r] = N(null), [a, i] = he(), s = Hn(o), { id: g, defaultBounds: c, defaultCenter: l, defaultZoom: f, defaultHeading: m, defaultTilt: u, reuseMaps: h, renderingType: y, colorScheme: d } = e, p = j(e, ["id", "defaultBounds", "defaultCenter", "defaultZoom", "defaultHeading", "defaultTilt", "reuseMaps", "renderingType", "colorScheme"]), b = e.zoom !== void 0 || e.defaultZoom !== void 0, C = e.center !== void 0 || e.defaultCenter !== void 0;
575
+ !c && (!b || !C) && 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"), !p.center && l && (p.center = l), !p.zoom && Number.isFinite(f) && (p.zoom = f), !p.heading && Number.isFinite(m) && (p.heading = m), !p.tilt && Number.isFinite(u) && (p.tilt = u);
576
+ const w = p.internalUsageAttributionIds;
577
+ w == null ? p.internalUsageAttributionIds = n.internalUsageAttributionIds : p.internalUsageAttributionIds = [
578
+ ...n.internalUsageAttributionIds || [],
579
+ ...w
580
+ ];
581
+ for (const v of Object.keys(p))
582
+ p[v] === void 0 && delete p[v];
583
+ const A = F(void 0);
584
+ return E(
585
+ () => {
586
+ if (!a || !t)
587
+ return;
588
+ const { addMapInstance: v, removeMapInstance: O } = n, { mapId: L } = e, S = `${L || "default"}:${y || "default"}:${d || "LIGHT"}`;
589
+ let M, x;
590
+ if (h && ie.has(S) ? (x = ie.pop(S), M = x.getDiv(), a.appendChild(M), x.setOptions(p), setTimeout(() => x.moveCamera({}), 0)) : (M = document.createElement("div"), M.style.height = "100%", a.appendChild(M), x = new google.maps.Map(M, Object.assign(Object.assign(Object.assign({}, p), y ? { renderingType: y } : {}), d ? { colorScheme: d } : {}))), r(x), v(x, g), c) {
591
+ const { padding: $ } = c, P = j(c, ["padding"]);
592
+ x.fitBounds(P, $);
593
+ } else (!b || !C) && x.fitBounds({ east: 180, west: -180, south: -90, north: 90 });
594
+ if (A.current) {
595
+ const { mapId: $, cameraState: P } = A.current;
596
+ $ !== L && x.moveCamera(P);
597
+ }
598
+ return () => {
599
+ A.current = {
600
+ mapId: L,
601
+ // eslint-disable-next-line react-hooks/exhaustive-deps
602
+ cameraState: s.current
603
+ }, M.remove(), h ? ie.push(S, x) : google.maps.event.clearInstanceListeners(x), r(null), O(g);
604
+ };
605
+ },
606
+ // some dependencies are ignored in the list below:
607
+ // - defaultBounds and the default* camera props will only be used once, and
608
+ // changes should be ignored
609
+ // - mapOptions has special hooks that take care of updating the options
610
+ // eslint-disable-next-line react-hooks/exhaustive-deps
611
+ [
612
+ a,
613
+ t,
614
+ g,
615
+ // these props can't be changed after initialization and require a new
616
+ // instance to be created
617
+ e.mapId,
618
+ e.renderingType,
619
+ e.colorScheme
620
+ ]
621
+ ), [o, i, s];
622
+ }
623
+ const $e = T.createContext(null), qe = (e) => {
624
+ const { children: n, id: t, className: o, style: r } = e, a = B(X), i = He();
625
+ if (!a)
626
+ throw new Error("<Map> can only be used inside an <ApiProvider> component.");
627
+ const [s, g, c] = Vn(e, a);
628
+ Bn(s, c, e), Tn(s, e), Nn(s, e);
629
+ const l = xn(s, e), f = !!e.controlled;
630
+ E(() => {
631
+ if (s)
632
+ return l && s.setOptions({ disableDefaultUI: !0 }), (l || f) && s.setOptions({
633
+ gestureHandling: "none",
634
+ keyboardShortcuts: !1
635
+ }), () => {
636
+ s.setOptions({
637
+ gestureHandling: e.gestureHandling,
638
+ keyboardShortcuts: e.keyboardShortcuts
639
+ });
640
+ };
641
+ }, [
642
+ s,
643
+ l,
644
+ f,
645
+ e.gestureHandling,
646
+ e.keyboardShortcuts
647
+ ]);
648
+ const m = e.center ? se(e.center) : null;
649
+ let u = null, h = null;
650
+ m && Number.isFinite(m.lat) && Number.isFinite(m.lng) && (u = m.lat, h = m.lng);
651
+ const y = I(() => {
652
+ var b, C, w;
653
+ return {
654
+ center: { lat: u ?? 0, lng: h ?? 0 },
655
+ zoom: (b = e.zoom) !== null && b !== void 0 ? b : 0,
656
+ heading: (C = e.heading) !== null && C !== void 0 ? C : 0,
657
+ tilt: (w = e.tilt) !== null && w !== void 0 ? w : 0
658
+ };
659
+ }, [u, h, e.zoom, e.heading, e.tilt]);
660
+ Y(() => {
661
+ if (!s || !f)
662
+ return;
663
+ s.moveCamera(y);
664
+ const b = s.addListener("bounds_changed", () => {
665
+ s.moveCamera(y);
666
+ });
667
+ return () => b.remove();
668
+ }, [s, f, y]);
669
+ const d = I(() => Object.assign({
670
+ width: "100%",
671
+ height: "100%",
672
+ position: "relative",
673
+ // when using deckgl, the map should be sent to the back
674
+ zIndex: l ? -1 : 0
675
+ }, r), [r, l]), p = I(() => ({ map: s }), [s]);
676
+ return i === z.AUTH_FAILURE ? T.createElement(
677
+ "div",
678
+ { style: Object.assign({ position: "relative" }, o ? {} : d), className: o },
679
+ T.createElement(Fn, null)
680
+ ) : T.createElement("div", Object.assign({ ref: g, "data-testid": "map", style: o ? void 0 : d, className: o }, t ? { id: t } : {}), s ? T.createElement($e.Provider, { value: p }, n) : null);
681
+ };
682
+ qe.deckGLViewProps = !0;
683
+ const ke = /* @__PURE__ */ new Set();
684
+ function Q(...e) {
685
+ const n = JSON.stringify(e);
686
+ ke.has(n) || (ke.add(n), console.error(...e));
687
+ }
688
+ const J = (e = null) => {
689
+ const n = B(X), { map: t } = B($e) || {};
690
+ if (n === null)
691
+ return Q("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;
692
+ const { mapInstances: o } = n;
693
+ return e !== null ? o[e] || null : t || o.default || null;
694
+ };
695
+ function Z(e) {
696
+ const n = Je(), t = B(X);
697
+ return E(() => {
698
+ !n || !t || t.importLibrary(e);
699
+ }, [n, t, e]), (t == null ? void 0 : t.loadedLibraries[e]) || null;
700
+ }
701
+ var ge;
702
+ const { useLayoutEffect: Gn, useRef: Jn } = Re, Zn = (ge = Re.useInsertionEffect) !== null && ge !== void 0 ? ge : Gn;
703
+ function $n() {
704
+ throw new Error("useEffectEvent: invalid call during rendering.");
705
+ }
706
+ function qn(e) {
707
+ const n = Jn($n);
708
+ return Zn(() => {
709
+ n.current = e;
710
+ }, [e]), ((...t) => n.current(...t));
711
+ }
712
+ const We = qn, Wn = () => {
713
+ };
714
+ function D(e, n, t) {
715
+ const o = We(t ?? Wn), r = !!t;
716
+ E(() => {
717
+ if (!e || !n || !r)
718
+ return;
719
+ const a = google.maps.event.addListener(e, n, o);
720
+ return () => a.remove();
721
+ }, [e, n, r]);
722
+ }
723
+ function _(e, n, t) {
724
+ E(() => {
725
+ e && (e[n] = t);
726
+ }, [e, n, t]);
727
+ }
728
+ const Kn = () => {
729
+ };
730
+ function ve(e, n, t) {
731
+ const o = We(t ?? Kn), r = !!t;
732
+ E(() => {
733
+ if (!e || !n || !r)
734
+ return;
735
+ const a = o;
736
+ return e.addEventListener(n, a), () => e.removeEventListener(n, a);
737
+ }, [e, n, r]);
738
+ }
739
+ class Yn {
740
+ constructor() {
741
+ this.renderedStyles = /* @__PURE__ */ new Set(), this.styleElement = null;
742
+ }
743
+ getStyleElement() {
744
+ return this.styleElement || (this.styleElement = document.createElement("style"), this.styleElement.setAttribute("data-rgm-anchor-styles", ""), document.head.appendChild(this.styleElement)), this.styleElement;
745
+ }
746
+ addAdvancedMarkerPointerEventsOverwrite() {
747
+ if (this.renderedStyles.has("marker-pointer-events"))
748
+ return;
749
+ const n = this.getStyleElement();
750
+ n.textContent += `
751
+ gmp-advanced-marker[data-origin='rgm'] {
752
+ pointer-events: none !important;
753
+ }
754
+ `, this.renderedStyles.add("marker-pointer-events");
755
+ }
756
+ cleanup() {
757
+ this.styleElement && (this.styleElement.remove(), this.styleElement = null, this.renderedStyles.clear());
758
+ }
759
+ }
760
+ const Xn = new Yn();
761
+ function Qn(e, n) {
762
+ var t;
763
+ if (!(!((t = google == null ? void 0 : google.maps) === null || t === void 0) && t.version))
764
+ return;
765
+ const o = google.maps.version.split("."), r = parseInt(o[0], 10), a = parseInt(o[1], 10);
766
+ return r > e || r === e && a >= n;
767
+ }
768
+ const Ce = T.createContext(null), et = {
769
+ BOTTOM: ["50%", "100%"]
770
+ }, Ke = U((e, n) => {
771
+ const { children: t, style: o, className: r, anchorPoint: a } = e, [i, s] = tt(e), g = I(() => i ? { marker: i } : null, [i]);
772
+ return H(n, () => i, [i]), s ? T.createElement(Ce.Provider, { value: g }, ce(T.createElement(nt, { anchorPoint: a, styles: o, className: r }, t), s)) : null;
773
+ });
774
+ Ke.displayName = "AdvancedMarker";
775
+ function ye(e) {
776
+ return e.nodeType === Node.ELEMENT_NODE;
777
+ }
778
+ const nt = ({ children: e, styles: n, className: t }) => T.createElement("div", { className: t, style: n }, e);
779
+ function tt(e) {
780
+ const [n, t] = N(null), [o, r] = N(null), a = J(), i = Z("marker"), { children: s, onClick: g, className: c, onMouseEnter: l, onMouseLeave: f, onDrag: m, onDragStart: u, onDragEnd: h, collisionBehavior: y, clickable: d, draggable: p, position: b, title: C, zIndex: w, anchorPoint: A, anchorLeft: v, anchorTop: O } = e, L = be.count(s);
781
+ return E(() => {
782
+ if (!a || !i)
783
+ return;
784
+ const S = new i.AdvancedMarkerElement();
785
+ S.map = a, t(S);
786
+ let M = null;
787
+ return L > 0 && (M = document.createElement("div"), S.content = M, r(M)), () => {
788
+ S.map = null, M == null || M.remove(), t(null), r(null);
789
+ };
790
+ }, [a, i, L]), E(() => {
791
+ !(n != null && n.content) || !ye(n.content) || L > 0 || (n.content.className = c ?? "");
792
+ }, [n, c, L]), ot(n, A, v, O, L > 0), _(n, "position", b), _(n, "title", C ?? ""), _(n, "zIndex", w), _(n, "collisionBehavior", y), E(() => {
793
+ n && (p !== void 0 ? n.gmpDraggable = p : m || u || h ? n.gmpDraggable = !0 : n.gmpDraggable = !1);
794
+ }, [n, p, m, h, u]), E(() => {
795
+ if (!n)
796
+ return;
797
+ const S = d !== void 0 ? d : !!g || !!l || !!f;
798
+ n.gmpClickable = S, S && (n != null && n.content) && ye(n.content) && (n.content.style.pointerEvents = "all", g && (n.content.style.cursor = "pointer"));
799
+ }, [n, d, g, l, f]), D(n, "click", g), D(n, "drag", m), D(n, "dragstart", u), D(n, "dragend", h), ve(n == null ? void 0 : n.element, "mouseenter", l), ve(n == null ? void 0 : n.element, "mouseleave", f), [n, o];
800
+ }
801
+ function ot(e, n, t, o, r) {
802
+ E(() => {
803
+ if (!e || !r)
804
+ return;
805
+ const a = Qn(3, 62), i = e.content;
806
+ if (!(!i || !ye(i))) {
807
+ if (t !== void 0 || o !== void 0) {
808
+ a || console.warn(`AdvancedMarker: The anchorLeft and anchorTop props are only supported in Google Maps API version 3.62 and above. The current version is ${google.maps.version}.`), e.anchorLeft = t, e.anchorTop = o, n !== void 0 && console.warn("AdvancedMarker: the anchorPoint prop is ignored when anchorLeft and/or anchorTop are set.");
809
+ return;
810
+ }
811
+ if (n !== void 0) {
812
+ const [s, g] = n ?? et.BOTTOM, c = `calc(-1 * ${s})`, l = `calc(-1 * ${g})`;
813
+ a ? (e.anchorLeft = c, e.anchorTop = l, i.style.transform = "") : (i.style.transform = `translate(50%, 100%) translate(${c}, ${l})`, e.dataset.origin = "rgm", Xn.addAdvancedMarkerPointerEventsOverwrite());
814
+ }
815
+ }
816
+ }, [e, n, t, o, r]);
817
+ }
818
+ function rt(e) {
819
+ var n, t, o;
820
+ const { onClick: r, onDrag: a, onDragStart: i, onDragEnd: s, onMouseOver: g, onMouseOut: c, onRadiusChanged: l, onCenterChanged: f, center: m, defaultCenter: u, radius: h, defaultRadius: y } = e, d = j(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onRadiusChanged", "onCenterChanged", "center", "defaultCenter", "radius", "defaultRadius"]), [p, b] = N(null), C = J(), w = te(Object.assign(Object.assign({}, d), { clickable: (n = d.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = d.draggable) !== null && t !== void 0 ? t : !!(a || i || s || f), editable: (o = d.editable) !== null && o !== void 0 ? o : !!l }), ne);
821
+ return E(() => {
822
+ if (!C) {
823
+ C === void 0 && console.error("<Circle> has to be inside a Map component.");
824
+ return;
825
+ }
826
+ const A = new google.maps.Circle(Object.assign(Object.assign({}, w), { center: m ?? u, radius: h ?? y }));
827
+ return A.setMap(C), b(A), () => {
828
+ A.setMap(null), b(null);
829
+ };
830
+ }, [C]), D(p, "click", r), D(p, "drag", a), D(p, "dragstart", i), D(p, "dragend", s), D(p, "mouseover", g), D(p, "mouseout", c), D(p, "radius_changed", l ? () => {
831
+ const A = p == null ? void 0 : p.getRadius();
832
+ A !== void 0 && l(A);
833
+ } : null), D(p, "center_changed", f ? () => {
834
+ f(p == null ? void 0 : p.getCenter());
835
+ } : null), E(() => {
836
+ p && p.setOptions(w);
837
+ }, [p, w]), E(() => {
838
+ !p || !m || Ve(m, p.getCenter()) || p.setCenter(m);
839
+ }, [p, m]), E(() => {
840
+ !p || h === void 0 || h !== p.getRadius() && p.setRadius(h);
841
+ }, [p, h]), p;
842
+ }
843
+ const at = U((e, n) => {
844
+ const t = rt(e);
845
+ return H(n, () => t, [t]), T.createElement(T.Fragment, null);
846
+ });
847
+ at.displayName = "Circle";
848
+ function it(e, n, t) {
849
+ if (n != null && typeof n != "object")
850
+ 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.");
851
+ const o = e.style;
852
+ if (t == null) {
853
+ if (n == null)
854
+ return;
855
+ for (const r in n)
856
+ n.hasOwnProperty(r) && _e(o, r, n[r]);
857
+ return;
858
+ }
859
+ for (const r in t)
860
+ t.hasOwnProperty(r) && (n == null || !n.hasOwnProperty(r)) && (r.indexOf("--") === 0 ? o.setProperty(r, "") : r === "float" ? o.cssFloat = "" : o[r] = "");
861
+ if (n != null)
862
+ for (const r in n) {
863
+ const a = n[r];
864
+ n.hasOwnProperty(r) && t[r] !== a && _e(o, r, a);
865
+ }
866
+ }
867
+ function _e(e, n, t) {
868
+ const o = n.indexOf("--") === 0;
869
+ t == null || typeof t == "boolean" || t === "" ? o ? e.setProperty(n, "") : n === "float" ? e.cssFloat = "" : e[n] = "" : o ? e.setProperty(n, t) : typeof t == "number" && t !== 0 && !lt(n) ? e[n] = t + "px" : n === "float" ? e.cssFloat = t : e[n] = ("" + t).trim();
870
+ }
871
+ const st = /* @__PURE__ */ new Set([
872
+ "animationIterationCount",
873
+ "aspectRatio",
874
+ "borderImageOutset",
875
+ "borderImageSlice",
876
+ "borderImageWidth",
877
+ "boxFlex",
878
+ "boxFlexGroup",
879
+ "boxOrdinalGroup",
880
+ "columnCount",
881
+ "columns",
882
+ "flex",
883
+ "flexGrow",
884
+ "flexPositive",
885
+ "flexShrink",
886
+ "flexNegative",
887
+ "flexOrder",
888
+ "gridArea",
889
+ "gridRow",
890
+ "gridRowEnd",
891
+ "gridRowSpan",
892
+ "gridRowStart",
893
+ "gridColumn",
894
+ "gridColumnEnd",
895
+ "gridColumnSpan",
896
+ "gridColumnStart",
897
+ "fontWeight",
898
+ "lineClamp",
899
+ "lineHeight",
900
+ "opacity",
901
+ "order",
902
+ "orphans",
903
+ "scale",
904
+ "tabSize",
905
+ "widows",
906
+ "zIndex",
907
+ "zoom",
908
+ "fillOpacity",
909
+ // SVG-related properties
910
+ "floodOpacity",
911
+ "stopOpacity",
912
+ "strokeDasharray",
913
+ "strokeDashoffset",
914
+ "strokeMiterlimit",
915
+ "strokeOpacity",
916
+ "strokeWidth"
917
+ ]);
918
+ function lt(e) {
919
+ return st.has(e);
920
+ }
921
+ function Ie(e) {
922
+ const n = e.getPaths(), t = [];
923
+ for (let o = 0; o < n.getLength(); o++)
924
+ t.push(n.getAt(o).getArray());
925
+ return t;
926
+ }
927
+ function ct(e) {
928
+ var n, t, o;
929
+ const { onClick: r, onDrag: a, onDragStart: i, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathsChanged: l, polygon: f, encodedPaths: m, paths: u, defaultPaths: h } = e, y = j(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathsChanged", "polygon", "encodedPaths", "paths", "defaultPaths"]), [d, p] = N(null), b = J(), C = Z("geometry"), w = F(!1), A = te(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(a || i || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), ne);
930
+ return E(() => {
931
+ if (!b) {
932
+ b === void 0 && console.error("<Polygon> has to be inside a Map component.");
933
+ return;
934
+ }
935
+ let v;
936
+ if (f) {
937
+ v = f;
938
+ const O = u ?? h;
939
+ O && Array.isArray(O) && v.setPaths(O), v.setOptions(A);
940
+ } else {
941
+ const O = u ?? h, L = Object.assign({}, A);
942
+ O && Array.isArray(O) && (L.paths = O), v = new google.maps.Polygon(L);
943
+ }
944
+ return v.setMap(b), p(v), () => {
945
+ v.setMap(null), p(null);
946
+ };
947
+ }, [b, f]), D(d, "click", r), D(d, "drag", a), D(d, "dragstart", i), D(d, "mouseover", g), D(d, "mouseout", c), D(d, "dragend", (v) => {
948
+ s == null || s(v), l && d && !w.current && l(Ie(d));
949
+ }), E(() => {
950
+ if (!d || !l)
951
+ return;
952
+ const v = [], O = d.getPaths();
953
+ if (typeof O.getLength != "function" || typeof O.getAt != "function")
954
+ return;
955
+ const L = () => {
956
+ w.current || l(Ie(d));
957
+ }, S = (M) => {
958
+ v.push(google.maps.event.addListener(M, "insert_at", L)), v.push(google.maps.event.addListener(M, "remove_at", L)), v.push(google.maps.event.addListener(M, "set_at", L));
959
+ };
960
+ for (let M = 0; M < O.getLength(); M++)
961
+ S(O.getAt(M));
962
+ return v.push(google.maps.event.addListener(O, "insert_at", (M) => {
963
+ S(O.getAt(M)), L();
964
+ })), v.push(google.maps.event.addListener(O, "set_at", (M) => {
965
+ S(O.getAt(M)), L();
966
+ })), v.push(google.maps.event.addListener(O, "remove_at", L)), () => {
967
+ v.forEach((M) => M.remove());
968
+ };
969
+ }, [
970
+ d,
971
+ l,
972
+ u,
973
+ m,
974
+ A.editable,
975
+ A.draggable
976
+ ]), E(() => {
977
+ d && d.setOptions(A);
978
+ }, [d, A]), E(() => {
979
+ if (!d || !u || !Array.isArray(u))
980
+ return;
981
+ const v = u[0], O = Array.isArray(v) ? u : [u], L = d.getPaths();
982
+ zn(O, L) || (w.current = !0, d.setPaths(u), w.current = !1);
983
+ }, [d, u]), E(() => {
984
+ if (!d || !m || !C)
985
+ return;
986
+ w.current = !0;
987
+ const v = m.map((O) => C.encoding.decodePath(O));
988
+ d.setPaths(v), w.current = !1;
989
+ }, [d, m, C]), d;
990
+ }
991
+ const dt = U((e, n) => {
992
+ const t = ct(e);
993
+ return H(n, () => t, [t]), T.createElement(T.Fragment, null);
994
+ });
995
+ dt.displayName = "Polygon";
996
+ function ut(e) {
997
+ var n, t, o;
998
+ const { onClick: r, onDrag: a, onDragStart: i, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathChanged: l, polyline: f, encodedPath: m, path: u, defaultPath: h } = e, y = j(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathChanged", "polyline", "encodedPath", "path", "defaultPath"]), [d, p] = N(null), b = J(), C = Z("geometry"), w = F(!1), A = te(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(a || i || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), ne);
999
+ return E(() => {
1000
+ if (!b) {
1001
+ b === void 0 && console.error("<Polyline> has to be inside a Map component.");
1002
+ return;
1003
+ }
1004
+ let v;
1005
+ if (f) {
1006
+ v = f;
1007
+ const O = u ?? h;
1008
+ O && Array.isArray(O) && v.setPath(O), v.setOptions(A);
1009
+ } else {
1010
+ const O = u ?? h, L = Object.assign({}, A);
1011
+ O && Array.isArray(O) && (L.path = O), v = new google.maps.Polyline(L);
1012
+ }
1013
+ return v.setMap(b), p(v), () => {
1014
+ v.setMap(null), p(null);
1015
+ };
1016
+ }, [b, f]), D(d, "click", r), D(d, "drag", a), D(d, "dragstart", i), D(d, "mouseover", g), D(d, "mouseout", c), D(d, "dragend", (v) => {
1017
+ s == null || s(v), l && d && !w.current && l(d.getPath().getArray());
1018
+ }), E(() => {
1019
+ if (!d || !l)
1020
+ return;
1021
+ const v = d.getPath();
1022
+ if (!v)
1023
+ return;
1024
+ const O = () => {
1025
+ w.current || l(v.getArray());
1026
+ }, L = [
1027
+ google.maps.event.addListener(v, "insert_at", O),
1028
+ google.maps.event.addListener(v, "remove_at", O),
1029
+ google.maps.event.addListener(v, "set_at", O)
1030
+ ];
1031
+ return () => {
1032
+ L.forEach((S) => S.remove());
1033
+ };
1034
+ }, [
1035
+ d,
1036
+ l,
1037
+ u,
1038
+ m,
1039
+ A.editable,
1040
+ A.draggable
1041
+ ]), E(() => {
1042
+ d && d.setOptions(A);
1043
+ }, [d, A]), E(() => {
1044
+ if (!d || !u)
1045
+ return;
1046
+ const v = d.getPath();
1047
+ Ge(u, v) || (w.current = !0, d.setPath(u), w.current = !1);
1048
+ }, [d, u]), E(() => {
1049
+ if (!d || !m || !C)
1050
+ return;
1051
+ w.current = !0;
1052
+ const v = C.encoding.decodePath(m);
1053
+ d.setPath(v), w.current = !1;
1054
+ }, [d, m, C]), d;
1055
+ }
1056
+ const gt = U((e, n) => {
1057
+ const t = ut(e);
1058
+ return H(n, () => t, [t]), T.createElement(T.Fragment, null);
1059
+ });
1060
+ gt.displayName = "Polyline";
1061
+ const ft = {
1062
+ center: { lat: 0, lng: 0, altitude: 0 },
1063
+ range: 0,
1064
+ heading: 0,
1065
+ tilt: 0,
1066
+ roll: 0
1067
+ }, mt = ["center", "range", "heading", "tilt", "roll"];
1068
+ function pt(e, n, t) {
1069
+ const o = e[t];
1070
+ if (o != null)
1071
+ if (t === "center") {
1072
+ const r = o;
1073
+ n.current.center = r.toJSON ? r.toJSON() : r;
1074
+ } else
1075
+ n.current[t] = o;
1076
+ }
1077
+ function ht(e) {
1078
+ const n = Ze(), t = F(Object.assign({}, ft));
1079
+ return E(() => {
1080
+ if (!e)
1081
+ return;
1082
+ const o = [];
1083
+ for (const r of mt) {
1084
+ const a = `gmp-${r}change`, i = () => {
1085
+ pt(e, t, r), n();
1086
+ };
1087
+ e.addEventListener(a, i), o.push(() => e.removeEventListener(a, i));
1088
+ }
1089
+ return () => {
1090
+ for (const r of o)
1091
+ r();
1092
+ };
1093
+ }, [e, n]), t;
1094
+ }
1095
+ function vt(e) {
1096
+ const n = Z("maps3d"), [t, o] = N(!1), [, r] = he(), [a, i] = he(), s = ht(a);
1097
+ return E(() => {
1098
+ customElements.whenDefined("gmp-map-3d").then(() => {
1099
+ o(!0);
1100
+ });
1101
+ }, []), E(
1102
+ () => {
1103
+ if (!a)
1104
+ return;
1105
+ const {
1106
+ center: c,
1107
+ heading: l,
1108
+ tilt: f,
1109
+ range: m,
1110
+ roll: u,
1111
+ defaultCenter: h,
1112
+ defaultHeading: y,
1113
+ defaultTilt: d,
1114
+ defaultRange: p,
1115
+ defaultRoll: b,
1116
+ // Non-element props to exclude
1117
+ id: C,
1118
+ style: w,
1119
+ className: A,
1120
+ children: v,
1121
+ onCenterChanged: O,
1122
+ onHeadingChanged: L,
1123
+ onTiltChanged: S,
1124
+ onRangeChanged: M,
1125
+ onRollChanged: x,
1126
+ onCameraChanged: $,
1127
+ onClick: P,
1128
+ onSteadyChange: k,
1129
+ onAnimationEnd: de,
1130
+ onError: Zt,
1131
+ mode: $t,
1132
+ gestureHandling: qt
1133
+ } = e, Ye = j(e, ["center", "heading", "tilt", "range", "roll", "defaultCenter", "defaultHeading", "defaultTilt", "defaultRange", "defaultRoll", "id", "style", "className", "children", "onCenterChanged", "onHeadingChanged", "onTiltChanged", "onRangeChanged", "onRollChanged", "onCameraChanged", "onClick", "onSteadyChange", "onAnimationEnd", "onError", "mode", "gestureHandling"]), Me = c ?? h, Pe = l ?? y, we = f ?? d, Ae = m ?? p, Te = u ?? b, q = Object.assign({}, Ye);
1134
+ Me && (q.center = Me), Pe !== void 0 && (q.heading = Pe), we !== void 0 && (q.tilt = we), Ae !== void 0 && (q.range = Ae), Te !== void 0 && (q.roll = Te), Object.assign(a, q);
1135
+ },
1136
+ // this effect should only run when the map3d element first becomes
1137
+ // available, so we skip re-running it when other props change.
1138
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1139
+ [a]
1140
+ ), [a, r, i, s, !!n && t];
1141
+ }
1142
+ function yt(e) {
1143
+ return e ? "toJSON" in e && typeof e.toJSON == "function" ? e.toJSON() : e : null;
1144
+ }
1145
+ function bt(e, n, t) {
1146
+ var o, r, a, i, s, g, c;
1147
+ const l = yt(t.center), f = (o = l == null ? void 0 : l.lat) !== null && o !== void 0 ? o : null, m = (r = l == null ? void 0 : l.lng) !== null && r !== void 0 ? r : null, u = (a = l == null ? void 0 : l.altitude) !== null && a !== void 0 ? a : null, h = (i = t.range) !== null && i !== void 0 ? i : null, y = (s = t.heading) !== null && s !== void 0 ? s : null, d = (g = t.tilt) !== null && g !== void 0 ? g : null, p = (c = t.roll) !== null && c !== void 0 ? c : null;
1148
+ Y(() => {
1149
+ var b;
1150
+ if (!e)
1151
+ return;
1152
+ const C = n.current;
1153
+ f !== null && m !== null && (C.center.lat !== f || C.center.lng !== m || u !== null && C.center.altitude !== u) && (e.center = {
1154
+ lat: f,
1155
+ lng: m,
1156
+ altitude: (b = u ?? C.center.altitude) !== null && b !== void 0 ? b : 0
1157
+ }), h !== null && C.range !== h && (e.range = h), y !== null && C.heading !== y && (e.heading = y), d !== null && C.tilt !== d && (e.tilt = d), p !== null && C.roll !== p && (e.roll = p);
1158
+ });
1159
+ }
1160
+ const Ne = [
1161
+ "gmp-centerchange",
1162
+ "gmp-headingchange",
1163
+ "gmp-tiltchange",
1164
+ "gmp-rangechange",
1165
+ "gmp-rollchange"
1166
+ ];
1167
+ function W(e, n) {
1168
+ const t = e.center;
1169
+ let o;
1170
+ return t && "toJSON" in t && typeof t.toJSON == "function" ? o = t.toJSON() : t ? o = t : o = { lat: 0, lng: 0, altitude: 0 }, {
1171
+ type: n,
1172
+ map3d: e,
1173
+ detail: {
1174
+ center: o,
1175
+ range: e.range || 0,
1176
+ heading: e.heading || 0,
1177
+ tilt: e.tilt || 0,
1178
+ roll: e.roll || 0
1179
+ }
1180
+ };
1181
+ }
1182
+ function Et(e, n) {
1183
+ const t = n;
1184
+ return {
1185
+ type: "gmp-click",
1186
+ map3d: e,
1187
+ detail: {
1188
+ position: n.position || null,
1189
+ placeId: t.placeId
1190
+ }
1191
+ };
1192
+ }
1193
+ function Ct(e, n) {
1194
+ return {
1195
+ type: "gmp-steadychange",
1196
+ map3d: e,
1197
+ detail: {
1198
+ isSteady: n.isSteady
1199
+ }
1200
+ };
1201
+ }
1202
+ function Ot(e, n) {
1203
+ const { onCenterChanged: t, onHeadingChanged: o, onTiltChanged: r, onRangeChanged: a, onRollChanged: i, onCameraChanged: s, onClick: g, onSteadyChange: c, onAnimationEnd: l, onError: f } = n;
1204
+ G(e, "gmp-centerchange", t, W), G(e, "gmp-headingchange", o, W), G(e, "gmp-tiltchange", r, W), G(e, "gmp-rangechange", a, W), G(e, "gmp-rollchange", i, W), E(() => {
1205
+ if (!e || !s)
1206
+ return;
1207
+ const m = () => {
1208
+ s(W(e, "camerachange"));
1209
+ };
1210
+ for (const u of Ne)
1211
+ e.addEventListener(u, m);
1212
+ return () => {
1213
+ for (const u of Ne)
1214
+ e.removeEventListener(u, m);
1215
+ };
1216
+ }, [e, s]), E(() => {
1217
+ if (!e || !g)
1218
+ return;
1219
+ const m = (u) => {
1220
+ g(Et(e, u));
1221
+ };
1222
+ return e.addEventListener("gmp-click", m), () => e.removeEventListener("gmp-click", m);
1223
+ }, [e, g]), E(() => {
1224
+ if (!e || !c)
1225
+ return;
1226
+ const m = (u) => {
1227
+ c(Ct(e, u));
1228
+ };
1229
+ return e.addEventListener("gmp-steadychange", m), () => e.removeEventListener("gmp-steadychange", m);
1230
+ }, [e, c]), G(e, "gmp-animationend", l, (m, u) => ({
1231
+ type: u,
1232
+ map3d: m
1233
+ })), G(e, "gmp-error", f, (m, u) => ({
1234
+ type: u,
1235
+ map3d: m
1236
+ }));
1237
+ }
1238
+ function G(e, n, t, o) {
1239
+ E(() => {
1240
+ if (!e || !t)
1241
+ return;
1242
+ const r = () => {
1243
+ t(o(e, n));
1244
+ };
1245
+ return e.addEventListener(n, r), () => e.removeEventListener(n, r);
1246
+ }, [e, n, t, o]);
1247
+ }
1248
+ const Mt = /* @__PURE__ */ new Set([
1249
+ "bounds",
1250
+ "defaultUIHidden",
1251
+ "gestureHandling",
1252
+ "internalUsageAttributionIds",
1253
+ "maxAltitude",
1254
+ "maxHeading",
1255
+ "maxTilt",
1256
+ "minAltitude",
1257
+ "minHeading",
1258
+ "minTilt",
1259
+ "mode"
1260
+ ]);
1261
+ function Pt(e, n) {
1262
+ const t = I(() => {
1263
+ const o = {}, r = Object.keys(n);
1264
+ for (const a of r) {
1265
+ if (!Mt.has(a))
1266
+ continue;
1267
+ const i = n[a];
1268
+ i !== void 0 && (o[a] = i);
1269
+ }
1270
+ return o;
1271
+ }, [n]);
1272
+ Ue(() => {
1273
+ e && Object.assign(e, t);
1274
+ }, [e, t]);
1275
+ }
1276
+ const wt = T.createContext(null), At = {
1277
+ width: "100%",
1278
+ height: "100%",
1279
+ position: "relative"
1280
+ }, Tt = U((e, n) => {
1281
+ const { children: t, id: o, className: r, style: a } = e, i = B(X);
1282
+ if (!i)
1283
+ throw new Error("<Map3D> can only be used inside an <APIProvider> component.");
1284
+ const { addMap3DInstance: s, removeMap3DInstance: g } = i, [c, l, f, m, u] = vt(e);
1285
+ bt(c, m, e), Ot(c, e), Pt(c, e), E(() => {
1286
+ if (!c)
1287
+ return;
1288
+ const d = o ?? "default";
1289
+ return s(c, d), () => {
1290
+ g(d);
1291
+ };
1292
+ }, [c, o]), H(n, () => ({
1293
+ map3d: c,
1294
+ flyCameraAround: (d) => {
1295
+ c == null || c.flyCameraAround(d);
1296
+ },
1297
+ flyCameraTo: (d) => {
1298
+ c == null || c.flyCameraTo(d);
1299
+ },
1300
+ stopCameraAnimation: () => {
1301
+ c == null || c.stopCameraAnimation();
1302
+ }
1303
+ }), [c]);
1304
+ const h = I(() => Object.assign(Object.assign({}, At), a), [a]), y = I(() => ({ map3d: c }), [c]);
1305
+ return u ? T.createElement(
1306
+ "div",
1307
+ Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : h, className: r }, o ? { id: o } : {}),
1308
+ T.createElement("gmp-map-3d", { ref: f, style: { width: "100%", height: "100%" } }, c && T.createElement(wt.Provider, { value: y }, t))
1309
+ ) : T.createElement("div", Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : h, className: r }, o ? { id: o } : {}));
1310
+ });
1311
+ Tt.displayName = "Map3D";
1312
+ const Oe = Xe(null), Lt = U(function(n, t) {
1313
+ const { children: o, onClick: r, position: a, altitudeMode: i, collisionBehavior: s, drawsWhenOccluded: g, extruded: c, label: l, sizePreserved: f, zIndex: m, title: u } = n, h = !!r, [y, d] = N(null), [p, b] = N(!1), C = I(() => {
1314
+ const v = document.createElement("div");
1315
+ return v.style.display = "none", document.body.appendChild(v), v;
1316
+ }, []);
1317
+ E(() => () => C.remove(), [C]);
1318
+ const w = le((v) => {
1319
+ d(v), typeof t == "function" ? t(v) : t && (t.current = v);
1320
+ }, [t]);
1321
+ ve(y, "gmp-click", r), Y(() => {
1322
+ if (p || !y || !C)
1323
+ return;
1324
+ for (; y.firstChild; )
1325
+ y.removeChild(y.firstChild);
1326
+ const v = Array.from(C.childNodes);
1327
+ for (const O of v) {
1328
+ if (O.nodeType !== Node.ELEMENT_NODE)
1329
+ continue;
1330
+ const L = O, S = L.tagName.toLowerCase();
1331
+ if (S === "img" || S === "svg") {
1332
+ const M = document.createElement("template");
1333
+ M.content.appendChild(L.cloneNode(!0)), y.appendChild(M);
1334
+ } else
1335
+ y.appendChild(L.cloneNode(!0));
1336
+ }
1337
+ }, [y, C, o, p]);
1338
+ const A = I(() => ({ marker: y, setContentHandledExternally: b }), [y]);
1339
+ return _(y, "position", a), _(y, "altitudeMode", i), _(y, "collisionBehavior", s), _(y, "drawsWhenOccluded", g), _(y, "extruded", c), _(y, "label", l), _(y, "sizePreserved", f), _(y, "zIndex", m), _(y, "title", u ?? ""), T.createElement(
1340
+ Oe.Provider,
1341
+ { value: A },
1342
+ h ? T.createElement("gmp-marker-3d-interactive", { ref: w }) : T.createElement("gmp-marker-3d", { ref: w }),
1343
+ ce(o, C)
1344
+ );
1345
+ });
1346
+ Lt.displayName = "Marker3D";
1347
+ const Dt = U(function(n, t) {
1348
+ var o;
1349
+ const { children: r, headerContent: a, style: i, className: s, open: g = !0, position: c, anchor: l, anchorId: f, altitudeMode: m, lightDismissDisabled: u, autoPanDisabled: h, onClose: y } = n, [d, p] = N(null), b = F(null);
1350
+ H(t, () => d, [d]), St(d, g, y), _(d, "open", g ?? !1), _(d, "altitudeMode", m), _(d, "lightDismissDisabled", u), _(d, "autoPanDisabled", h);
1351
+ const C = (o = l ?? f) !== null && o !== void 0 ? o : c;
1352
+ return _(d, "positionAnchor", C), Y(() => {
1353
+ d && (it(d, i || null, b.current), b.current = i || null);
1354
+ }, [d, i]), T.createElement(
1355
+ "gmp-popover",
1356
+ { ref: p, className: s },
1357
+ a && T.createElement("div", { slot: "header" }, a),
1358
+ r
1359
+ );
1360
+ });
1361
+ Dt.displayName = "Popover";
1362
+ function St(e, n, t) {
1363
+ const o = F(void 0), r = F(n);
1364
+ E(() => {
1365
+ r.current = n;
1366
+ }, [n]), E(() => {
1367
+ if (!e || !t)
1368
+ return;
1369
+ const a = new MutationObserver((i) => {
1370
+ for (const s of i)
1371
+ if (s.type === "attributes" && s.attributeName === "open") {
1372
+ const g = e.hasAttribute("open");
1373
+ o.current === !0 && !g && r.current !== !1 && t(), o.current = g;
1374
+ }
1375
+ });
1376
+ return a.observe(e, {
1377
+ attributes: !0,
1378
+ attributeFilter: ["open"]
1379
+ }), o.current = e.hasAttribute("open"), () => {
1380
+ a.disconnect();
1381
+ };
1382
+ }, [e, t]);
1383
+ }
1384
+ function kt(e) {
1385
+ const [n, t] = N(null), o = J(), { onClick: r, onDrag: a, onDragStart: i, onDragEnd: s, onMouseOver: g, onMouseOut: c } = e, l = j(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut"]), { position: f, draggable: m } = l;
1386
+ return E(() => {
1387
+ if (!o) {
1388
+ o === void 0 && console.error("<Marker> has to be inside a Map component.");
1389
+ return;
1390
+ }
1391
+ const u = new google.maps.Marker(l);
1392
+ return u.setMap(o), t(u), () => {
1393
+ u.setMap(null), t(null);
1394
+ };
1395
+ }, [o]), E(() => {
1396
+ if (!n)
1397
+ return;
1398
+ const u = n, h = google.maps.event;
1399
+ return r && h.addListener(u, "click", r), a && h.addListener(u, "drag", a), i && h.addListener(u, "dragstart", i), s && h.addListener(u, "dragend", s), g && h.addListener(u, "mouseover", g), c && h.addListener(u, "mouseout", c), n.setDraggable(!!m), () => {
1400
+ h.clearInstanceListeners(u);
1401
+ };
1402
+ }, [
1403
+ n,
1404
+ m,
1405
+ r,
1406
+ a,
1407
+ i,
1408
+ s,
1409
+ g,
1410
+ c
1411
+ ]), E(() => {
1412
+ n && l && n.setOptions(l);
1413
+ }, [n, l]), E(() => {
1414
+ m || !f || !n || n.setPosition(f);
1415
+ }, [m, f, n]), n;
1416
+ }
1417
+ const _t = U((e, n) => {
1418
+ const t = kt(e);
1419
+ return H(n, () => t, [t]), T.createElement(T.Fragment, null);
1420
+ });
1421
+ _t.displayName = "Marker";
1422
+ const It = (e) => {
1423
+ const n = B(Ce), t = B(Oe), o = n == null ? void 0 : n.marker, r = t == null ? void 0 : t.marker, a = t == null ? void 0 : t.setContentHandledExternally, i = I(() => document.createElement("div"), []), s = Z("marker");
1424
+ return E(() => {
1425
+ if (r && a)
1426
+ return a(!0), () => a(!1);
1427
+ }, [r, a]), E(() => {
1428
+ if (!r || !s)
1429
+ return;
1430
+ const g = Object.assign({}, e), c = new s.PinElement(g);
1431
+ for (e.children && (c.glyph = i); r.firstChild; )
1432
+ r.removeChild(r.firstChild);
1433
+ return r.append(c), () => {
1434
+ };
1435
+ }, [r, s, i, e]), E(() => {
1436
+ var g;
1437
+ if (r)
1438
+ return;
1439
+ if (!o) {
1440
+ o === void 0 && r === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
1441
+ return;
1442
+ }
1443
+ e.glyph && e.children && Q("The <Pin> component only uses children to render the glyph if both the glyph property and children are present."), be.count(e.children) > 1 && Q("Passing multiple children to the <Pin> component might lead to unexpected results.");
1444
+ const c = Object.assign({}, e), l = new google.maps.marker.PinElement(c);
1445
+ e.children && (l.glyph = i);
1446
+ const f = (g = o.content) === null || g === void 0 ? void 0 : g.firstChild;
1447
+ for (; f != null && f.firstChild; )
1448
+ f.removeChild(f.firstChild);
1449
+ f && f.appendChild(l.element);
1450
+ }, [o, i, r, e]), ce(e.children, i);
1451
+ }, Nt = (e) => {
1452
+ const { children: n } = e, t = B(Ce), o = B(Oe), r = t == null ? void 0 : t.marker, a = o == null ? void 0 : o.marker, i = o == null ? void 0 : o.setContentHandledExternally, s = I(() => document.createElement("div"), []), g = Z("marker");
1453
+ return E(() => {
1454
+ if (a && i)
1455
+ return i(!0), () => i(!1);
1456
+ }, [a, i]), E(() => {
1457
+ if (!a || !g)
1458
+ return;
1459
+ const c = Object.assign({}, e), l = new g.PinElement(c);
1460
+ for (n && l.appendChild(s); a.firstChild; )
1461
+ a.removeChild(a.firstChild);
1462
+ return a.appendChild(l), () => {
1463
+ };
1464
+ }, [a, g, s, n, e]), E(() => {
1465
+ var c;
1466
+ if (a)
1467
+ return;
1468
+ if (!r || !g) {
1469
+ r === void 0 && a === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
1470
+ return;
1471
+ }
1472
+ (e.glyphSrc || e.glyphText) && n && Q("The <Pin> component only uses children to render the glyph if both glyphSrc/glyphText and children are present."), be.count(n) > 1 && Q("Passing multiple children to the <Pin> component might lead to unexpected results.");
1473
+ const l = Object.assign({}, e), f = new g.PinElement(l);
1474
+ n && f.appendChild(s);
1475
+ const m = (c = r.content) === null || c === void 0 ? void 0 : c.firstChild;
1476
+ for (; m != null && m.firstChild; )
1477
+ m.removeChild(m.firstChild);
1478
+ m && m.appendChild(f);
1479
+ }, [
1480
+ r,
1481
+ g,
1482
+ s,
1483
+ a,
1484
+ n,
1485
+ e
1486
+ ]), ce(n, s);
1487
+ }, xt = (e) => {
1488
+ var n;
1489
+ const t = Z("marker"), o = I(() => t ? typeof customElements < "u" && customElements.get("gmp-pin") !== void 0 : !1, [t]);
1490
+ if (!t)
1491
+ return null;
1492
+ if (o) {
1493
+ const { glyph: r, glyphSrc: a, glyphText: i } = e, s = j(e, ["glyph", "glyphSrc", "glyphText"]), g = r instanceof URL || typeof r == "string" && r.startsWith("http"), c = i ?? (typeof r == "string" && !g ? r : void 0), l = a ?? (g ? String(r) : void 0);
1494
+ return T.createElement(Nt, Object.assign({}, s, { glyphText: c, glyphSrc: l }));
1495
+ } else {
1496
+ const { glyph: r, glyphSrc: a, glyphText: i } = e, s = j(e, ["glyph", "glyphSrc", "glyphText"]), g = (n = r ?? a) !== null && n !== void 0 ? n : i;
1497
+ return T.createElement(It, Object.assign({}, s, { glyph: g }));
1498
+ }
1499
+ };
1500
+ function Rt(e) {
1501
+ var n, t, o;
1502
+ const { onClick: r, onDrag: a, onDragStart: i, onDragEnd: s, onMouseOver: g, onMouseOut: c, onBoundsChanged: l, bounds: f, defaultBounds: m } = e, u = j(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onBoundsChanged", "bounds", "defaultBounds"]), [h, y] = N(null), d = J(), p = te(Object.assign(Object.assign({}, u), { clickable: (n = u.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = u.draggable) !== null && t !== void 0 ? t : !!(a || i || s || l), editable: (o = u.editable) !== null && o !== void 0 ? o : !!l }), ne);
1503
+ return E(() => {
1504
+ if (!d) {
1505
+ d === void 0 && console.error("<Rectangle> has to be inside a Map component.");
1506
+ return;
1507
+ }
1508
+ const b = new google.maps.Rectangle(Object.assign(Object.assign({}, p), { bounds: f ?? m }));
1509
+ return b.setMap(d), y(b), () => {
1510
+ b.setMap(null), y(null);
1511
+ };
1512
+ }, [d]), D(h, "click", r), D(h, "drag", a), D(h, "dragstart", i), D(h, "dragend", s), D(h, "mouseover", g), D(h, "mouseout", c), D(h, "bounds_changed", l ? () => {
1513
+ l(h == null ? void 0 : h.getBounds());
1514
+ } : null), E(() => {
1515
+ h && h.setOptions(p);
1516
+ }, [h, p]), E(() => {
1517
+ !h || !f || jn(f, h.getBounds()) || h.setBounds(f);
1518
+ }, [h, f]), h;
1519
+ }
1520
+ const jt = U((e, n) => {
1521
+ const t = Rt(e);
1522
+ return H(n, () => t, [
1523
+ t
1524
+ ]), T.createElement(T.Fragment, null);
1525
+ });
1526
+ jt.displayName = "Rectangle";
1527
+ function K(e) {
1528
+ return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(e).trim();
1529
+ }
1530
+ function fe() {
1531
+ const e = K("--background"), n = K("--foreground"), t = K("--border"), o = K("--muted"), r = K("--muted-foreground"), a = K("--primary");
1532
+ return [
1533
+ // Hide business POIs — clinical-listing UIs don't want Google's
1534
+ // restaurants / shops bleeding into the practice-location card.
1535
+ {
1536
+ featureType: "poi.business",
1537
+ stylers: [{ visibility: "off" }]
1538
+ },
1539
+ // Canvas / paper colour. `--background` is the surface the kit
1540
+ // itself paints on, so the map blends with the card chrome.
1541
+ {
1542
+ elementType: "geometry",
1543
+ stylers: [{ color: e || "#ffffff" }]
1544
+ },
1545
+ // All label text → kit foreground.
1546
+ {
1547
+ elementType: "labels.text.fill",
1548
+ stylers: [{ color: n || "#000000" }]
1549
+ },
1550
+ // Label outlines / strokes pulled from the muted surface so text
1551
+ // stays legible without painting solid white halos in dark themes.
1552
+ {
1553
+ elementType: "labels.text.stroke",
1554
+ stylers: [{ color: o || "#f0f0f0" }]
1555
+ },
1556
+ // Roads + administrative boundaries → border token. This is the
1557
+ // strongest visual cue tying map geometry to kit chrome.
1558
+ {
1559
+ featureType: "administrative",
1560
+ elementType: "geometry",
1561
+ stylers: [{ color: t || "#d0d0d0" }]
1562
+ },
1563
+ {
1564
+ featureType: "road",
1565
+ elementType: "geometry",
1566
+ stylers: [{ color: r || "#999999" }]
1567
+ },
1568
+ {
1569
+ featureType: "road",
1570
+ elementType: "labels.text.fill",
1571
+ stylers: [{ color: n || "#000000" }]
1572
+ },
1573
+ // Highways get a slight emphasis via the primary accent — a
1574
+ // single-pixel cue that helps the eye when zoomed out.
1575
+ {
1576
+ featureType: "road.highway",
1577
+ elementType: "geometry.stroke",
1578
+ // Empty-string fallback (consistent with the other rules) so a
1579
+ // consumer with a non-violet brand doesn't get violet bleeding
1580
+ // into highway / transit strokes. Google Maps treats empty as
1581
+ // "use the default".
1582
+ stylers: [{ color: a || "" }]
1583
+ },
1584
+ // Water → muted surface (subtle, doesn't overpower the marker).
1585
+ {
1586
+ featureType: "water",
1587
+ elementType: "geometry",
1588
+ stylers: [{ color: o || "#e8e8e8" }]
1589
+ },
1590
+ // Parks → muted-foreground at low opacity feel via a softer
1591
+ // tint; same family as the border so the palette stays tight.
1592
+ {
1593
+ featureType: "poi.park",
1594
+ elementType: "geometry",
1595
+ stylers: [{ color: t || "#d0d0d0" }]
1596
+ },
1597
+ // Transit lines (rail, bus) — kit primary, subtle.
1598
+ {
1599
+ featureType: "transit",
1600
+ elementType: "geometry",
1601
+ // Empty-string fallback (consistent with the other rules) so a
1602
+ // consumer with a non-violet brand doesn't get violet bleeding
1603
+ // into highway / transit strokes. Google Maps treats empty as
1604
+ // "use the default".
1605
+ stylers: [{ color: a || "" }]
1606
+ },
1607
+ // Landscape geometry — Google's default is a pale tan that fights
1608
+ // kit dark themes hard. Painting it `--muted` keeps the canvas
1609
+ // tonally coherent in all four themes.
1610
+ {
1611
+ featureType: "landscape",
1612
+ elementType: "geometry",
1613
+ stylers: [{ color: o || "" }]
1614
+ },
1615
+ // Highway fill — without this, Google's default pale-yellow
1616
+ // highway shells clash with kit dark backgrounds. `--muted` keeps
1617
+ // them subdued; the highway STROKE rule above is what does the
1618
+ // brand-accent emphasis.
1619
+ {
1620
+ featureType: "road.highway",
1621
+ elementType: "geometry.fill",
1622
+ stylers: [{ color: o || "" }]
1623
+ },
1624
+ // POI label fills — scoped to `--muted-foreground` so business /
1625
+ // POI labels (the few that survive after `poi.business` is
1626
+ // hidden — schools, hospitals, transit stations) stay readable
1627
+ // against the geometry tint without overriding the road-label
1628
+ // rule above.
1629
+ {
1630
+ featureType: "poi",
1631
+ elementType: "labels.text.fill",
1632
+ stylers: [{ color: r || "" }]
1633
+ }
1634
+ ];
1635
+ }
1636
+ const zt = {
1637
+ id: "map-view",
1638
+ capabilities: [],
1639
+ state: {},
1640
+ actions: {
1641
+ pan_to: {
1642
+ safety: "read",
1643
+ argsType: "{ position: { lat: number; lng: number } }",
1644
+ description: "Pan the map to a new centre without changing zoom.",
1645
+ invoke: (e, n) => {
1646
+ e.panTo(n.position);
1647
+ }
1648
+ },
1649
+ set_zoom: {
1650
+ safety: "read",
1651
+ argsType: "{ zoom: number }",
1652
+ description: "Set the map zoom level (typical range 1–20).",
1653
+ invoke: (e, n) => {
1654
+ e.setZoom(n.zoom);
1655
+ }
1656
+ },
1657
+ select_marker: {
1658
+ safety: "read",
1659
+ argsType: "{ id: string | null }",
1660
+ description: "Select a marker by id, or pass null to clear the selection.",
1661
+ invoke: (e, n) => {
1662
+ e.selectMarker(n.id);
1663
+ }
1664
+ }
1665
+ },
1666
+ domHooks: {
1667
+ root: {
1668
+ attr: "data-component",
1669
+ value: "map-view",
1670
+ description: "Marks the element as a kit MapView."
1671
+ },
1672
+ instanceId: {
1673
+ attr: "data-component-id",
1674
+ sourceProp: "id",
1675
+ description: "Sourced from the id prop."
1676
+ }
1677
+ }
1678
+ }, Bt = ee(
1679
+ [
1680
+ "ds:relative ds:overflow-hidden ds:block",
1681
+ "ds:rounded-[var(--radius-md)] ds:border",
1682
+ "ds:border-[color:var(--border)]",
1683
+ "ds:bg-[var(--muted)]"
1684
+ ].join(" "),
1685
+ {
1686
+ variants: {
1687
+ size: {
1688
+ sm: "ds:[--map-block-size:14rem]",
1689
+ md: "ds:[--map-block-size:20rem]",
1690
+ lg: "ds:[--map-block-size:28rem]"
1691
+ }
1692
+ },
1693
+ defaultVariants: { size: "md" }
1694
+ }
1695
+ ), Ft = ee(
1696
+ [
1697
+ "ds:block ds:inline-size-full",
1698
+ "ds:[block-size:var(--map-block-size)]"
1699
+ ].join(" ")
1700
+ ), Ut = ee(
1701
+ [
1702
+ "ds:absolute ds:inset-0",
1703
+ "ds:flex ds:flex-col ds:items-center ds:justify-center",
1704
+ "ds:gap-[var(--spacing-sm)]",
1705
+ "ds:p-[var(--spacing-md)]",
1706
+ "ds:bg-[var(--muted)] ds:text-[var(--foreground)]",
1707
+ "ds:text-center"
1708
+ ].join(" ")
1709
+ ), Ht = ee("type-heading-3 ds:m-0"), xe = ee(
1710
+ "type-body-sm ds:text-[var(--muted-foreground)] ds:max-inline-size-[28rem] ds:m-0"
1711
+ );
1712
+ function Vt({
1713
+ onHandleReady: e,
1714
+ onMarkerSelect: n
1715
+ }) {
1716
+ const t = J();
1717
+ return E(() => {
1718
+ t && e({
1719
+ panTo: (o) => t.panTo(o),
1720
+ setZoom: (o) => t.setZoom(o),
1721
+ selectMarker: (o) => n(o)
1722
+ });
1723
+ }, [t, e, n]), null;
1724
+ }
1725
+ function Gt({
1726
+ address: e,
1727
+ description: n,
1728
+ onConsentRequest: t,
1729
+ openInGoogleMapsHref: o
1730
+ }) {
1731
+ const { t: r } = ze();
1732
+ return /* @__PURE__ */ ae("div", { className: Ut(), "data-testid": "map-view-consent", children: [
1733
+ /* @__PURE__ */ R(
1734
+ on,
1735
+ {
1736
+ "aria-hidden": "true",
1737
+ className: "ds:size-6 ds:text-[var(--muted-foreground)]"
1738
+ }
1739
+ ),
1740
+ /* @__PURE__ */ R("p", { className: Ht(), children: r("mapView.consentTitle") }),
1741
+ e ? /* @__PURE__ */ R(
1742
+ "p",
1743
+ {
1744
+ className: xe(),
1745
+ "data-testid": "map-view-address",
1746
+ children: e
1747
+ }
1748
+ ) : null,
1749
+ /* @__PURE__ */ R("p", { className: xe(), children: n }),
1750
+ /* @__PURE__ */ ae("div", { className: "ds:flex ds:gap-[var(--spacing-sm)] ds:flex-wrap ds:items-center ds:justify-center", children: [
1751
+ t ? /* @__PURE__ */ R(
1752
+ nn,
1753
+ {
1754
+ type: "button",
1755
+ intent: "primary",
1756
+ size: "sm",
1757
+ onClick: t,
1758
+ children: r("mapView.consentCta")
1759
+ }
1760
+ ) : null,
1761
+ /* @__PURE__ */ ae(
1762
+ "a",
1763
+ {
1764
+ href: o,
1765
+ target: "_blank",
1766
+ rel: "noopener noreferrer",
1767
+ className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary)] ds:underline ds:underline-offset-2",
1768
+ children: [
1769
+ r("mapView.openInGoogleMaps"),
1770
+ /* @__PURE__ */ R(rn, { "aria-hidden": "true", className: "ds:size-3" })
1771
+ ]
1772
+ }
1773
+ )
1774
+ ] })
1775
+ ] });
1776
+ }
1777
+ const Jt = U(
1778
+ ({
1779
+ id: e,
1780
+ apiKey: n,
1781
+ center: t,
1782
+ zoom: o = 15,
1783
+ markers: r,
1784
+ selectedMarkerId: a,
1785
+ onMarkerClick: i,
1786
+ consentGranted: s = !1,
1787
+ onConsentRequest: g,
1788
+ address: c,
1789
+ consentDescription: l,
1790
+ mapId: f,
1791
+ size: m,
1792
+ ariaLabel: u,
1793
+ className: h,
1794
+ ...y
1795
+ }, d) => {
1796
+ const { t: p, i18n: b } = ze(), C = Qe(), w = I(
1797
+ () => `map-${C.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1798
+ [C]
1799
+ ), [A, v] = N(!1);
1800
+ E(() => {
1801
+ if (typeof window > "u") return;
1802
+ const P = window.matchMedia("(prefers-reduced-motion: reduce)"), k = () => v(P.matches);
1803
+ return k(), P.addEventListener("change", k), () => P.removeEventListener("change", k);
1804
+ }, []);
1805
+ const O = I(() => `https://www.google.com/maps/search/?api=1&query=${c ? encodeURIComponent(c) : `${t.lat},${t.lng}`}`, [c, t.lat, t.lng]), [L, S] = N(
1806
+ () => f ? [] : fe()
1807
+ );
1808
+ E(() => {
1809
+ if (f || typeof document > "u") return;
1810
+ S(fe());
1811
+ const P = new MutationObserver(() => {
1812
+ S(fe());
1813
+ });
1814
+ return P.observe(document.documentElement, {
1815
+ attributes: !0,
1816
+ attributeFilter: ["class"]
1817
+ }), () => P.disconnect();
1818
+ }, [f]);
1819
+ const M = F(null), x = le((P) => {
1820
+ M.current = P;
1821
+ }, []);
1822
+ H(
1823
+ d,
1824
+ () => ({
1825
+ panTo: (P) => {
1826
+ var k;
1827
+ return (k = M.current) == null ? void 0 : k.panTo(P);
1828
+ },
1829
+ setZoom: (P) => {
1830
+ var k;
1831
+ return (k = M.current) == null ? void 0 : k.setZoom(P);
1832
+ },
1833
+ selectMarker: (P) => {
1834
+ var k;
1835
+ return (k = M.current) == null ? void 0 : k.selectMarker(P);
1836
+ }
1837
+ }),
1838
+ []
1839
+ );
1840
+ const $ = I(
1841
+ () => ({
1842
+ panTo: (P) => {
1843
+ var k;
1844
+ return (k = M.current) == null ? void 0 : k.panTo(P);
1845
+ },
1846
+ setZoom: (P) => {
1847
+ var k;
1848
+ return (k = M.current) == null ? void 0 : k.setZoom(P);
1849
+ },
1850
+ selectMarker: (P) => {
1851
+ var k;
1852
+ return (k = M.current) == null ? void 0 : k.selectMarker(P);
1853
+ }
1854
+ }),
1855
+ []
1856
+ );
1857
+ return tn(zt, $, e), E(() => {
1858
+ var P;
1859
+ A || (P = M.current) == null || P.panTo(t);
1860
+ }, [t.lat, t.lng, A]), E(() => {
1861
+ var P;
1862
+ (P = M.current) == null || P.setZoom(o);
1863
+ }, [o]), /* @__PURE__ */ R(
1864
+ "div",
1865
+ {
1866
+ className: Bt({ size: m, className: h }),
1867
+ "data-component": "map-view",
1868
+ "data-component-id": e ?? w,
1869
+ role: "region",
1870
+ "aria-label": u ?? p("mapView.label"),
1871
+ ...y,
1872
+ children: /* @__PURE__ */ R("div", { className: Ft(), children: s ? /* @__PURE__ */ R(
1873
+ An,
1874
+ {
1875
+ apiKey: n,
1876
+ language: b.language,
1877
+ children: /* @__PURE__ */ ae(
1878
+ qe,
1879
+ {
1880
+ defaultCenter: t,
1881
+ defaultZoom: o,
1882
+ mapId: f,
1883
+ styles: f ? void 0 : L,
1884
+ gestureHandling: "cooperative",
1885
+ disableDefaultUI: !1,
1886
+ onClick: () => i == null ? void 0 : i(null),
1887
+ className: "ds:[inline-size:100%] ds:[block-size:100%]",
1888
+ children: [
1889
+ /* @__PURE__ */ R(
1890
+ Vt,
1891
+ {
1892
+ onHandleReady: x,
1893
+ onMarkerSelect: (P) => i == null ? void 0 : i(P)
1894
+ }
1895
+ ),
1896
+ (r ?? []).map((P) => {
1897
+ const k = a != null && a === P.id, de = p("mapView.markerLabel", {
1898
+ label: P.label ?? P.id
1899
+ });
1900
+ return /* @__PURE__ */ R(
1901
+ Ke,
1902
+ {
1903
+ position: P.position,
1904
+ title: de,
1905
+ "aria-label": de,
1906
+ "data-selected": k ? "true" : "false",
1907
+ onClick: () => i == null ? void 0 : i(P.id),
1908
+ children: /* @__PURE__ */ R(
1909
+ xt,
1910
+ {
1911
+ background: "var(--primary)",
1912
+ borderColor: "var(--primary)",
1913
+ glyphColor: "var(--primary-foreground)"
1914
+ }
1915
+ )
1916
+ },
1917
+ P.id
1918
+ );
1919
+ })
1920
+ ]
1921
+ }
1922
+ )
1923
+ }
1924
+ ) : /* @__PURE__ */ R(
1925
+ Gt,
1926
+ {
1927
+ address: c,
1928
+ description: l ?? p("mapView.consentDescription"),
1929
+ onConsentRequest: g,
1930
+ openInGoogleMapsHref: O
1931
+ }
1932
+ ) })
1933
+ }
1934
+ );
1935
+ }
1936
+ );
1937
+ Jt.displayName = "MapView";
1938
+ export {
1939
+ Jt as M
1940
+ };
1941
+ //# sourceMappingURL=map-view-Dd48BxVB.js.map