@alfadocs/ui-kit-debug 1.119.0 → 1.121.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 (138) hide show
  1. package/assets/map-pin@2x.png +0 -0
  2. package/assets/map-pin@2x.source.json +5 -0
  3. package/dist/_chunks/{address-autocomplete-zLygkxFc.js → address-autocomplete-D2uNpxcE.js} +2 -2
  4. package/dist/_chunks/{address-autocomplete-zLygkxFc.js.map → address-autocomplete-D2uNpxcE.js.map} +1 -1
  5. package/dist/_chunks/{address-fields-Dl1ALKhP.js → address-fields-BU65pA-V.js} +2 -2
  6. package/dist/_chunks/{address-fields-Dl1ALKhP.js.map → address-fields-BU65pA-V.js.map} +1 -1
  7. package/dist/_chunks/map-view-h6ngp2xi.js +1578 -0
  8. package/dist/_chunks/map-view-h6ngp2xi.js.map +1 -0
  9. package/dist/_chunks/maps-core-gate-DKx96CC_.js +1492 -0
  10. package/dist/_chunks/{maps-core-gate-C4dyo1ic.js.map → maps-core-gate-DKx96CC_.js.map} +1 -1
  11. package/dist/_chunks/{practice-results-b3uchdBn.js → practice-results-yCresv86.js} +759 -750
  12. package/dist/_chunks/practice-results-yCresv86.js.map +1 -0
  13. package/dist/_chunks/{registration-form-CMXefBnC.js → registration-form-CwbhtKcy.js} +180 -165
  14. package/dist/_chunks/registration-form-CwbhtKcy.js.map +1 -0
  15. package/dist/_chunks/{reserved.agent-V2Eqoabh.js → reserved.agent-DRSZ8UcL.js} +2 -2
  16. package/dist/_chunks/{reserved.agent-V2Eqoabh.js.map → reserved.agent-DRSZ8UcL.js.map} +1 -1
  17. package/dist/_chunks/{workflow-webhook-action-dgUjv9T7.js → workflow-webhook-action-Cae02r_4.js} +264 -289
  18. package/dist/_chunks/workflow-webhook-action-Cae02r_4.js.map +1 -0
  19. package/dist/agent-catalog.json +1 -9
  20. package/dist/agent-i18n/en.json +0 -1
  21. package/dist/browser-support.js +1 -1
  22. package/dist/components/address-autocomplete/index.js +1 -1
  23. package/dist/components/address-fields/index.js +1 -1
  24. package/dist/components/booking/index.js +1 -1
  25. package/dist/components/map-view/index.js +1 -1
  26. package/dist/components/map-view/map-view-pin-geometry.d.ts +39 -0
  27. package/dist/components/map-view/map-view-pin-geometry.d.ts.map +1 -0
  28. package/dist/components/map-view/map-view-pin.d.ts +15 -0
  29. package/dist/components/map-view/map-view-pin.d.ts.map +1 -0
  30. package/dist/components/map-view/map-view.d.ts.map +1 -1
  31. package/dist/components/practice-results/index.js +1 -1
  32. package/dist/components/practice-results/practice-results.d.ts +8 -0
  33. package/dist/components/practice-results/practice-results.d.ts.map +1 -1
  34. package/dist/core.css +1 -1
  35. package/dist/i18n/locales/ar.d.ts +2 -5
  36. package/dist/i18n/locales/ar.d.ts.map +1 -1
  37. package/dist/i18n/locales/ar.js +2 -5
  38. package/dist/i18n/locales/ar.js.map +1 -1
  39. package/dist/i18n/locales/de.d.ts +2 -5
  40. package/dist/i18n/locales/de.d.ts.map +1 -1
  41. package/dist/i18n/locales/de.js +2 -5
  42. package/dist/i18n/locales/de.js.map +1 -1
  43. package/dist/i18n/locales/el.d.ts +2 -5
  44. package/dist/i18n/locales/el.d.ts.map +1 -1
  45. package/dist/i18n/locales/el.js +2 -5
  46. package/dist/i18n/locales/el.js.map +1 -1
  47. package/dist/i18n/locales/en.d.ts +2 -5
  48. package/dist/i18n/locales/en.d.ts.map +1 -1
  49. package/dist/i18n/locales/en.js +2 -5
  50. package/dist/i18n/locales/en.js.map +1 -1
  51. package/dist/i18n/locales/es.d.ts +2 -5
  52. package/dist/i18n/locales/es.d.ts.map +1 -1
  53. package/dist/i18n/locales/es.js +2 -5
  54. package/dist/i18n/locales/es.js.map +1 -1
  55. package/dist/i18n/locales/fr.d.ts +2 -5
  56. package/dist/i18n/locales/fr.d.ts.map +1 -1
  57. package/dist/i18n/locales/fr.js +2 -5
  58. package/dist/i18n/locales/fr.js.map +1 -1
  59. package/dist/i18n/locales/hi.d.ts +2 -5
  60. package/dist/i18n/locales/hi.d.ts.map +1 -1
  61. package/dist/i18n/locales/hi.js +2 -5
  62. package/dist/i18n/locales/hi.js.map +1 -1
  63. package/dist/i18n/locales/it.d.ts +2 -5
  64. package/dist/i18n/locales/it.d.ts.map +1 -1
  65. package/dist/i18n/locales/it.js +2 -5
  66. package/dist/i18n/locales/it.js.map +1 -1
  67. package/dist/i18n/locales/ja.d.ts +2 -5
  68. package/dist/i18n/locales/ja.d.ts.map +1 -1
  69. package/dist/i18n/locales/ja.js +2 -5
  70. package/dist/i18n/locales/ja.js.map +1 -1
  71. package/dist/i18n/locales/nl.d.ts +2 -5
  72. package/dist/i18n/locales/nl.d.ts.map +1 -1
  73. package/dist/i18n/locales/nl.js +2 -5
  74. package/dist/i18n/locales/nl.js.map +1 -1
  75. package/dist/i18n/locales/pl.d.ts +2 -5
  76. package/dist/i18n/locales/pl.d.ts.map +1 -1
  77. package/dist/i18n/locales/pl.js +2 -5
  78. package/dist/i18n/locales/pl.js.map +1 -1
  79. package/dist/i18n/locales/pt.d.ts +2 -5
  80. package/dist/i18n/locales/pt.d.ts.map +1 -1
  81. package/dist/i18n/locales/pt.js +2 -5
  82. package/dist/i18n/locales/pt.js.map +1 -1
  83. package/dist/i18n/locales/ro.d.ts +2 -5
  84. package/dist/i18n/locales/ro.d.ts.map +1 -1
  85. package/dist/i18n/locales/ro.js +2 -5
  86. package/dist/i18n/locales/ro.js.map +1 -1
  87. package/dist/i18n/locales/ru.d.ts +2 -5
  88. package/dist/i18n/locales/ru.d.ts.map +1 -1
  89. package/dist/i18n/locales/ru.js +2 -5
  90. package/dist/i18n/locales/ru.js.map +1 -1
  91. package/dist/i18n/locales/sq.d.ts +2 -5
  92. package/dist/i18n/locales/sq.d.ts.map +1 -1
  93. package/dist/i18n/locales/sq.js +2 -5
  94. package/dist/i18n/locales/sq.js.map +1 -1
  95. package/dist/i18n/locales/sv.d.ts +2 -5
  96. package/dist/i18n/locales/sv.d.ts.map +1 -1
  97. package/dist/i18n/locales/sv.js +2 -5
  98. package/dist/i18n/locales/sv.js.map +1 -1
  99. package/dist/i18n/locales/tr.d.ts +2 -5
  100. package/dist/i18n/locales/tr.d.ts.map +1 -1
  101. package/dist/i18n/locales/tr.js +2 -5
  102. package/dist/i18n/locales/tr.js.map +1 -1
  103. package/dist/i18n/locales/zh.d.ts +2 -5
  104. package/dist/i18n/locales/zh.d.ts.map +1 -1
  105. package/dist/i18n/locales/zh.js +2 -5
  106. package/dist/i18n/locales/zh.js.map +1 -1
  107. package/dist/index.js +7 -7
  108. package/dist/locales/ar.json +2 -5
  109. package/dist/locales/de.json +2 -5
  110. package/dist/locales/el.json +2 -5
  111. package/dist/locales/en.json +2 -5
  112. package/dist/locales/es.json +2 -5
  113. package/dist/locales/fr.json +2 -5
  114. package/dist/locales/hi.json +2 -5
  115. package/dist/locales/it.json +2 -5
  116. package/dist/locales/ja.json +2 -5
  117. package/dist/locales/nl.json +2 -5
  118. package/dist/locales/pl.json +2 -5
  119. package/dist/locales/pt.json +2 -5
  120. package/dist/locales/ro.json +2 -5
  121. package/dist/locales/ru.json +2 -5
  122. package/dist/locales/sq.json +2 -5
  123. package/dist/locales/sv.json +2 -5
  124. package/dist/locales/tr.json +2 -5
  125. package/dist/locales/zh.json +2 -5
  126. package/dist/patterns/registration-form/index.js +1 -1
  127. package/dist/patterns/workflow-webhook-action/index.js +1 -1
  128. package/dist/patterns/workflow-webhook-action/workflow-webhook-action.d.ts.map +1 -1
  129. package/dist/tokens.css +1 -1
  130. package/package.json +4 -1
  131. package/dist/_chunks/key-round-DIgsnJSg.js +0 -21
  132. package/dist/_chunks/key-round-DIgsnJSg.js.map +0 -1
  133. package/dist/_chunks/map-view-CHeGd94F.js +0 -1443
  134. package/dist/_chunks/map-view-CHeGd94F.js.map +0 -1
  135. package/dist/_chunks/maps-core-gate-C4dyo1ic.js +0 -1571
  136. package/dist/_chunks/practice-results-b3uchdBn.js.map +0 -1
  137. package/dist/_chunks/registration-form-CMXefBnC.js.map +0 -1
  138. package/dist/_chunks/workflow-webhook-action-dgUjv9T7.js.map +0 -1
@@ -1,1571 +0,0 @@
1
- import * as Se from "react";
2
- import M, { useMemo as w, useContext as R, useEffect as b, useLayoutEffect as V, useState as I, useReducer as _e, useCallback as ue, useRef as j, forwardRef as B, useImperativeHandle as z, Children as ge, createContext as Ge } from "react";
3
- import { createPortal as oe } from "react-dom";
4
- import { g as He } from "./_commonjsHelpers-DaMA6jEr.js";
5
- var re, Ee;
6
- function Je() {
7
- return Ee || (Ee = 1, re = function e(n, t) {
8
- if (n === t) return !0;
9
- if (n && t && typeof n == "object" && typeof t == "object") {
10
- if (n.constructor !== t.constructor) return !1;
11
- var o, r, i;
12
- if (Array.isArray(n)) {
13
- if (o = n.length, o != t.length) return !1;
14
- for (r = o; r-- !== 0; )
15
- if (!e(n[r], t[r])) return !1;
16
- return !0;
17
- }
18
- if (n.constructor === RegExp) return n.source === t.source && n.flags === t.flags;
19
- if (n.valueOf !== Object.prototype.valueOf) return n.valueOf() === t.valueOf();
20
- if (n.toString !== Object.prototype.toString) return n.toString() === t.toString();
21
- if (i = Object.keys(n), o = i.length, o !== Object.keys(t).length) return !1;
22
- for (r = o; r-- !== 0; )
23
- if (!Object.prototype.hasOwnProperty.call(t, i[r])) return !1;
24
- for (r = o; r-- !== 0; ) {
25
- var a = i[r];
26
- if (!e(n[a], t[a])) return !1;
27
- }
28
- return !0;
29
- }
30
- return n !== n && t !== t;
31
- }), re;
32
- }
33
- var Ve = Je();
34
- const W = /* @__PURE__ */ He(Ve), $e = "1.8.3";
35
- function N(e, n) {
36
- var t = {};
37
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && n.indexOf(o) < 0 && (t[o] = e[o]);
38
- if (e != null && typeof Object.getOwnPropertySymbols == "function")
39
- for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
40
- n.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (t[o[r]] = e[o[r]]);
41
- return t;
42
- }
43
- function Oe(e, n, t, o) {
44
- function r(i) {
45
- return i instanceof t ? i : new t(function(a) {
46
- a(i);
47
- });
48
- }
49
- return new (t || (t = Promise))(function(i, a) {
50
- function s(l) {
51
- try {
52
- c(o.next(l));
53
- } catch (h) {
54
- a(h);
55
- }
56
- }
57
- function g(l) {
58
- try {
59
- c(o.throw(l));
60
- } catch (h) {
61
- a(h);
62
- }
63
- }
64
- function c(l) {
65
- l.done ? i(l.value) : r(l.value).then(s, g);
66
- }
67
- c((o = o.apply(e, [])).next());
68
- });
69
- }
70
- function qe(e, n) {
71
- e.src = n;
72
- }
73
- const Ze = (e) => {
74
- var n, t, o, r = "The Google Maps JavaScript API", i = "google", a = "importLibrary", s = "__ib__", g = document, c = window, l = c[i] || (c[i] = {}), h = l.maps || (l.maps = {}), f = /* @__PURE__ */ new Set(), u = new URLSearchParams(), p = () => n || (n = new Promise(async (y, d) => {
75
- var m;
76
- await (t = g.createElement("script")), u.set("libraries", [...f] + "");
77
- for (o in e)
78
- u.set(o.replace(/[A-Z]/g, (C) => "_" + C[0].toLowerCase()), e[o]);
79
- u.set("callback", i + ".maps." + s), qe(t, "https://maps.googleapis.com/maps/api/js?" + u), h[s] = y, t.onerror = () => n = d(Error(r + " could not load.")), t.nonce = ((m = g.querySelector("script[nonce]")) == null ? void 0 : m.nonce) || "", g.head.append(t);
80
- }));
81
- h[a] ? console.warn(r + " only loads once. Ignoring:", e) : h[a] = (y, ...d) => f.add(y) && p().then(() => h[a](y, ...d));
82
- }, We = (e) => `The setOptions() function should only be called once. The options passed to the additional call (${JSON.stringify(e)}) will be ignored.`, Ke = (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.`, Ye = "No options were set before calling importLibrary. Make sure to configure the loader using setOptions().", Xe = "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.", Ie = process.env.NODE_ENV !== "production", fe = Ie ? (e) => {
83
- console.warn(`[@googlemaps/js-api-loader] ${e}`);
84
- } : () => {
85
- }, Qe = Ie ? (e) => {
86
- console.info(`[@googlemaps/js-api-loader] ${e}`);
87
- } : () => {
88
- }, en = process.env.NODE_ENV !== "production";
89
- let ae = !1;
90
- function nn(e) {
91
- if (ae) {
92
- fe(We(e));
93
- return;
94
- }
95
- on(e), ae = !0;
96
- }
97
- async function tn(e) {
98
- var n, t;
99
- if (ae || fe(Ye), !((t = (n = window == null ? void 0 : window.google) == null ? void 0 : n.maps) != null && t.importLibrary))
100
- throw new Error("google.maps.importLibrary is not installed.");
101
- return await google.maps.importLibrary(e);
102
- }
103
- function on(e) {
104
- var t, o;
105
- const n = !!((o = (t = window.google) == null ? void 0 : t.maps) != null && o.importLibrary);
106
- n ? Qe(Ke(e)) : en && document.querySelector('script[src*="maps.googleapis.com/maps/api/js"]') && fe(Xe), n || Ze(e);
107
- }
108
- const x = {
109
- NOT_LOADED: "NOT_LOADED",
110
- LOADING: "LOADING",
111
- LOADED: "LOADED",
112
- FAILED: "FAILED",
113
- AUTH_FAILURE: "AUTH_FAILURE"
114
- }, rn = "GMP_visgl_rgmlibrary_v1_default", an = [
115
- `gmp_visgl_reactgooglemaps_v${$e}`
116
- ], $ = M.createContext(null);
117
- let F = x.NOT_LOADED, Q;
118
- const se = /* @__PURE__ */ new Set();
119
- function ee(e) {
120
- e !== F && (F = e, se.forEach((n) => n(F)));
121
- }
122
- function sn() {
123
- const [e, n] = I({});
124
- return { mapInstances: e, addMapInstance: (i, a = "default") => {
125
- n((s) => Object.assign(Object.assign({}, s), { [a]: i }));
126
- }, removeMapInstance: (i = "default") => {
127
- n((a) => {
128
- var s = i;
129
- a[s];
130
- var g = N(a, [typeof s == "symbol" ? s : s + ""]);
131
- return g;
132
- });
133
- }, clearMapInstances: () => {
134
- n({});
135
- } };
136
- }
137
- function ln() {
138
- const [e, n] = I({});
139
- return {
140
- map3dInstances: e,
141
- addMap3DInstance: (i, a = "default") => {
142
- n((s) => Object.assign(Object.assign({}, s), { [a]: i }));
143
- },
144
- removeMap3DInstance: (i = "default") => {
145
- n((a) => {
146
- var s = i;
147
- a[s];
148
- var g = N(a, [typeof s == "symbol" ? s : s + ""]);
149
- return g;
150
- });
151
- },
152
- clearMap3DInstances: () => {
153
- n({});
154
- }
155
- };
156
- }
157
- function cn(e) {
158
- const { onLoad: n, onError: t, apiKey: o, version: r, libraries: i = [], region: a, language: s, authReferrerPolicy: g, channel: c, solutionChannel: l, fetchAppCheckToken: h } = e, [f, u] = I(F), [p, y] = _e((C, E) => C[E.name] ? C : Object.assign(Object.assign({}, C), { [E.name]: E.value }), {}), d = w(() => {
159
- const C = {
160
- apiKey: o,
161
- version: r,
162
- libraries: i.join(","),
163
- region: a,
164
- language: s,
165
- authReferrerPolicy: g,
166
- channel: c,
167
- solutionChannel: l
168
- };
169
- return JSON.stringify(C);
170
- }, [
171
- o,
172
- r,
173
- i,
174
- a,
175
- s,
176
- g,
177
- c,
178
- l
179
- ]), m = ue((C) => Oe(this, void 0, void 0, function* () {
180
- if (p[C])
181
- return p[C];
182
- const E = yield tn(C);
183
- return y({ name: C, value: E }), E;
184
- }), [p]);
185
- return b(() => (se.add(u), u(F), () => {
186
- se.delete(u);
187
- }), []), b(
188
- () => {
189
- Oe(this, void 0, void 0, function* () {
190
- var C, E;
191
- try {
192
- Q && Q !== 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.");
193
- const P = ["core", "maps", ...i];
194
- if (!((E = (C = window.google) === null || C === void 0 ? void 0 : C.maps) === null || E === void 0) && E.importLibrary) {
195
- Q || ee(x.LOADED), yield Promise.all(P.map((v) => m(v))), n && n();
196
- return;
197
- }
198
- if (F === x.LOADING || F === x.LOADED) {
199
- F === x.LOADED && n && n();
200
- return;
201
- }
202
- Q = d, ee(x.LOADING);
203
- const A = Object.fromEntries(Object.entries({
204
- key: o,
205
- v: r,
206
- libraries: i,
207
- region: a,
208
- language: s,
209
- authReferrerPolicy: g
210
- }).filter(([, v]) => v !== void 0));
211
- c !== void 0 && c >= 0 && c <= 999 && (A.channel = String(c)), l === void 0 ? A.solutionChannel = rn : l !== "" && (A.solutionChannel = l), nn(A), yield Promise.all(P.map((v) => m(v))), ee(x.LOADED), n && n();
212
- } catch (P) {
213
- ee(x.FAILED), t ? t(P) : console.error("The Google Maps JavaScript API failed to load.", P);
214
- }
215
- });
216
- },
217
- // eslint-disable-next-line react-hooks/exhaustive-deps
218
- [d, n, t, m, i]
219
- ), b(() => {
220
- if (f !== x.LOADED)
221
- return;
222
- const C = google.maps.Settings.getInstance();
223
- h ? C.fetchAppCheckToken = h : C.fetchAppCheckToken && (C.fetchAppCheckToken = null);
224
- }, [f, h]), {
225
- status: f,
226
- loadedLibraries: p,
227
- importLibrary: m
228
- };
229
- }
230
- function dn(e) {
231
- return w(() => e.disableUsageAttribution ? null : an, [e.disableUsageAttribution]);
232
- }
233
- const wt = (e) => {
234
- const { children: n } = e, t = N(e, ["children"]), { mapInstances: o, addMapInstance: r, removeMapInstance: i, clearMapInstances: a } = sn(), { map3dInstances: s, addMap3DInstance: g, removeMap3DInstance: c, clearMap3DInstances: l } = ln(), { status: h, loadedLibraries: f, importLibrary: u } = cn(t), p = dn(t), y = w(() => ({
235
- mapInstances: o,
236
- addMapInstance: r,
237
- removeMapInstance: i,
238
- clearMapInstances: a,
239
- map3dInstances: s,
240
- addMap3DInstance: g,
241
- removeMap3DInstance: c,
242
- clearMap3DInstances: l,
243
- status: h,
244
- loadedLibraries: f,
245
- importLibrary: u,
246
- internalUsageAttributionIds: p
247
- }), [
248
- o,
249
- r,
250
- i,
251
- a,
252
- s,
253
- g,
254
- c,
255
- l,
256
- h,
257
- f,
258
- u,
259
- p
260
- ]);
261
- return M.createElement($.Provider, { value: y }, n);
262
- };
263
- function un(e, n) {
264
- for (const t of mn) {
265
- const o = n[t], r = we[t];
266
- b(() => {
267
- if (!e || !o)
268
- return;
269
- const i = google.maps.event.addListener(e, r, (a) => {
270
- o(gn(r, e, a));
271
- });
272
- return () => i.remove();
273
- }, [e, r, o]);
274
- }
275
- }
276
- function gn(e, n, t) {
277
- var o;
278
- const r = {
279
- type: e,
280
- map: n,
281
- detail: {},
282
- stoppable: !1,
283
- stop: () => {
284
- }
285
- };
286
- if (fn.includes(e)) {
287
- const i = r, a = n.getCenter(), s = n.getZoom(), g = n.getHeading() || 0, c = n.getTilt() || 0, l = n.getBounds();
288
- return (!a || !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"), i.detail = {
289
- center: (a == null ? void 0 : a.toJSON()) || { lat: 0, lng: 0 },
290
- zoom: s || 0,
291
- heading: g,
292
- tilt: c,
293
- bounds: (l == null ? void 0 : l.toJSON()) || {
294
- north: 90,
295
- east: 180,
296
- south: -90,
297
- west: -180
298
- }
299
- }, i;
300
- } else if (hn.includes(e)) {
301
- if (!t)
302
- throw new Error("[createEvent] mouse events must provide a srcEvent");
303
- const i = r;
304
- return i.domEvent = t.domEvent, i.stoppable = !0, i.stop = () => t.stop(), i.detail = {
305
- latLng: ((o = t.latLng) === null || o === void 0 ? void 0 : o.toJSON()) || null,
306
- placeId: t.placeId
307
- }, i;
308
- }
309
- return r;
310
- }
311
- const we = {
312
- onBoundsChanged: "bounds_changed",
313
- onCenterChanged: "center_changed",
314
- onClick: "click",
315
- onContextmenu: "contextmenu",
316
- onDblclick: "dblclick",
317
- onDrag: "drag",
318
- onDragend: "dragend",
319
- onDragstart: "dragstart",
320
- onHeadingChanged: "heading_changed",
321
- onIdle: "idle",
322
- onIsFractionalZoomEnabledChanged: "isfractionalzoomenabled_changed",
323
- onMapCapabilitiesChanged: "mapcapabilities_changed",
324
- onMapTypeIdChanged: "maptypeid_changed",
325
- onMousemove: "mousemove",
326
- onMouseout: "mouseout",
327
- onMouseover: "mouseover",
328
- onProjectionChanged: "projection_changed",
329
- onRenderingTypeChanged: "renderingtype_changed",
330
- onTilesLoaded: "tilesloaded",
331
- onTiltChanged: "tilt_changed",
332
- onZoomChanged: "zoom_changed",
333
- // note: onCameraChanged is an alias for the bounds_changed event,
334
- // since that is going to be fired in every situation where the camera is
335
- // updated.
336
- onCameraChanged: "bounds_changed"
337
- }, fn = [
338
- "bounds_changed",
339
- "center_changed",
340
- "heading_changed",
341
- "tilt_changed",
342
- "zoom_changed"
343
- ], hn = [
344
- "click",
345
- "contextmenu",
346
- "dblclick",
347
- "mousemove",
348
- "mouseout",
349
- "mouseover"
350
- ], mn = Object.keys(we);
351
- function K(e, n) {
352
- const t = j(e);
353
- return n(e, t.current) || (t.current = e), t.current;
354
- }
355
- function pn(e, n, t) {
356
- b(e, [K(n, t)]);
357
- }
358
- function Te(e, n) {
359
- pn(e, n, W);
360
- }
361
- const vn = /* @__PURE__ */ new Set([
362
- "backgroundColor",
363
- "clickableIcons",
364
- "controlSize",
365
- "disableDefaultUI",
366
- "disableDoubleClickZoom",
367
- "draggable",
368
- "draggableCursor",
369
- "draggingCursor",
370
- "fullscreenControl",
371
- "fullscreenControlOptions",
372
- "gestureHandling",
373
- "headingInteractionEnabled",
374
- "isFractionalZoomEnabled",
375
- "keyboardShortcuts",
376
- "mapTypeControl",
377
- "mapTypeControlOptions",
378
- "mapTypeId",
379
- "maxZoom",
380
- "minZoom",
381
- "noClear",
382
- "panControl",
383
- "panControlOptions",
384
- "restriction",
385
- "rotateControl",
386
- "rotateControlOptions",
387
- "scaleControl",
388
- "scaleControlOptions",
389
- "scrollwheel",
390
- "streetView",
391
- "streetViewControl",
392
- "streetViewControlOptions",
393
- "styles",
394
- "tiltInteractionEnabled",
395
- "zoomControl",
396
- "zoomControlOptions"
397
- ]);
398
- function yn(e, n) {
399
- const t = {}, o = Object.keys(n);
400
- for (const r of o)
401
- vn.has(r) && (t[r] = n[r]);
402
- Te(() => {
403
- e && e.setOptions(t);
404
- }, [t]);
405
- }
406
- function Ne() {
407
- var e;
408
- return ((e = R($)) === null || e === void 0 ? void 0 : e.status) || x.NOT_LOADED;
409
- }
410
- function Cn(e, n) {
411
- const { viewport: t, viewState: o } = n, r = !!t;
412
- return V(() => {
413
- if (!e || !o)
414
- return;
415
- const { latitude: i, longitude: a, bearing: s, pitch: g, zoom: c } = o;
416
- e.moveCamera({
417
- center: { lat: i, lng: a },
418
- heading: s,
419
- tilt: g,
420
- zoom: c + 1
421
- });
422
- }, [e, o]), r;
423
- }
424
- function bn(e) {
425
- return !e || typeof e != "object" || !("lat" in e && "lng" in e) ? !1 : Number.isFinite(e.lat) && Number.isFinite(e.lng);
426
- }
427
- function xe(e, n) {
428
- if (!e || !n)
429
- return !1;
430
- const t = te(e), o = te(n);
431
- return !(t.lat !== o.lat || t.lng !== o.lng);
432
- }
433
- function te(e) {
434
- return bn(e) ? e : e.toJSON();
435
- }
436
- function Me(e) {
437
- if ("north" in e && "south" in e && "east" in e && "west" in e)
438
- return e;
439
- const n = e.getNorthEast().toJSON(), t = e.getSouthWest().toJSON();
440
- return {
441
- north: n.lat,
442
- east: n.lng,
443
- south: t.lat,
444
- west: t.lng
445
- };
446
- }
447
- function En(e, n) {
448
- if (!e || !n)
449
- return !1;
450
- const t = Me(e), o = Me(n);
451
- return t.north === o.north && t.south === o.south && t.east === o.east && t.west === o.west;
452
- }
453
- function Re(e, n) {
454
- if (!e || !n)
455
- return e === n;
456
- const t = "getArray" in n ? n.getArray() : n;
457
- if (e.length !== t.length)
458
- return !1;
459
- for (let o = 0; o < e.length; o++)
460
- if (!xe(e[o], t[o]))
461
- return !1;
462
- return !0;
463
- }
464
- function On(e, n) {
465
- if (!e || !n)
466
- return e === n;
467
- const t = "getArray" in n ? n.getArray().map((o) => o.getArray()) : n;
468
- if (e.length !== t.length)
469
- return !1;
470
- for (let o = 0; o < e.length; o++)
471
- if (!Re(e[o], t[o]))
472
- return !1;
473
- return !0;
474
- }
475
- function Mn(e, n, t) {
476
- const o = t.center ? te(t.center) : null;
477
- let r = null, i = null;
478
- o && Number.isFinite(o.lat) && Number.isFinite(o.lng) && (r = o.lat, i = o.lng);
479
- const a = Number.isFinite(t.zoom) ? t.zoom : null, s = Number.isFinite(t.heading) ? t.heading : null, g = Number.isFinite(t.tilt) ? t.tilt : null;
480
- V(() => {
481
- if (!e)
482
- return;
483
- const c = {};
484
- let l = !1;
485
- r !== null && i !== null && (n.current.center.lat !== r || n.current.center.lng !== i) && (c.center = { lat: r, lng: i }, l = !0), a !== null && n.current.zoom !== a && (c.zoom = a, 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);
486
- });
487
- }
488
- const Pn = () => {
489
- const e = {
490
- position: "absolute",
491
- top: 0,
492
- left: 0,
493
- bottom: 0,
494
- right: 0,
495
- zIndex: 999,
496
- display: "flex",
497
- flexFlow: "column nowrap",
498
- textAlign: "center",
499
- justifyContent: "center",
500
- fontSize: ".8rem",
501
- color: "rgba(0,0,0,0.6)",
502
- background: "#dddddd",
503
- padding: "1rem 1.5rem"
504
- };
505
- return M.createElement(
506
- "div",
507
- { style: e },
508
- M.createElement("h2", null, "Error: AuthFailure"),
509
- M.createElement(
510
- "p",
511
- null,
512
- "A problem with your API key prevents the map from rendering correctly. Please make sure the value of the ",
513
- M.createElement("code", null, "APIProvider.apiKey"),
514
- " prop is correct. Check the error-message in the console for further details."
515
- )
516
- );
517
- };
518
- function le() {
519
- const [e, n] = I(null), t = ue((o) => n(o), [n]);
520
- return [e, t];
521
- }
522
- function je() {
523
- return Ne() === x.LOADED;
524
- }
525
- function Be() {
526
- const [, e] = _e((n) => n + 1, 0);
527
- return e;
528
- }
529
- function An(e, n) {
530
- const t = e.getCenter(), o = e.getZoom(), r = e.getHeading() || 0, i = e.getTilt() || 0, a = e.getBounds();
531
- (!t || !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(n.current, {
532
- center: (t == null ? void 0 : t.toJSON()) || { lat: 0, lng: 0 },
533
- zoom: o || 0,
534
- heading: r,
535
- tilt: i
536
- });
537
- }
538
- function Ln(e) {
539
- const n = Be(), t = j({
540
- center: { lat: 0, lng: 0 },
541
- heading: 0,
542
- tilt: 0,
543
- zoom: 0
544
- });
545
- return b(() => {
546
- if (!e)
547
- return;
548
- const o = google.maps.event.addListener(e, "bounds_changed", () => {
549
- An(e, t), n();
550
- });
551
- return () => o.remove();
552
- }, [e, n]), t;
553
- }
554
- class ne {
555
- static has(n) {
556
- return this.entries[n] && this.entries[n].length > 0;
557
- }
558
- static pop(n) {
559
- return this.entries[n] && this.entries[n].pop() || null;
560
- }
561
- static push(n, t) {
562
- this.entries[n] || (this.entries[n] = []), this.entries[n].push(t);
563
- }
564
- }
565
- ne.entries = {};
566
- function kn(e, n) {
567
- const t = je(), [o, r] = I(null), [i, a] = le(), s = Ln(o), { id: g, defaultBounds: c, defaultCenter: l, defaultZoom: h, defaultHeading: f, defaultTilt: u, reuseMaps: p, renderingType: y, colorScheme: d } = e, m = N(e, ["id", "defaultBounds", "defaultCenter", "defaultZoom", "defaultHeading", "defaultTilt", "reuseMaps", "renderingType", "colorScheme"]), C = e.zoom !== void 0 || e.defaultZoom !== void 0, E = e.center !== void 0 || e.defaultCenter !== void 0;
568
- !c && (!C || !E) && 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"), !m.center && l && (m.center = l), !m.zoom && Number.isFinite(h) && (m.zoom = h), !m.heading && Number.isFinite(f) && (m.heading = f), !m.tilt && Number.isFinite(u) && (m.tilt = u);
569
- const P = m.internalUsageAttributionIds;
570
- P == null ? m.internalUsageAttributionIds = n.internalUsageAttributionIds : m.internalUsageAttributionIds = [
571
- ...n.internalUsageAttributionIds || [],
572
- ...P
573
- ];
574
- for (const v of Object.keys(m))
575
- m[v] === void 0 && delete m[v];
576
- const A = j(void 0);
577
- return b(
578
- () => {
579
- if (!i || !t)
580
- return;
581
- const { addMapInstance: v, removeMapInstance: O } = n, { mapId: k } = e, S = `${k || "default"}:${y || "default"}:${d || "LIGHT"}`;
582
- let L, T;
583
- if (p && ne.has(S) ? (T = ne.pop(S), L = T.getDiv(), i.appendChild(L), T.setOptions(m), setTimeout(() => T.moveCamera({}), 0)) : (L = document.createElement("div"), L.style.height = "100%", i.appendChild(L), T = new google.maps.Map(L, Object.assign(Object.assign(Object.assign({}, m), y ? { renderingType: y } : {}), d ? { colorScheme: d } : {}))), r(T), v(T, g), c) {
584
- const { padding: Y } = c, X = N(c, ["padding"]);
585
- T.fitBounds(X, Y);
586
- } else (!C || !E) && T.fitBounds({ east: 180, west: -180, south: -90, north: 90 });
587
- if (A.current) {
588
- const { mapId: Y, cameraState: X } = A.current;
589
- Y !== k && T.moveCamera(X);
590
- }
591
- return () => {
592
- A.current = {
593
- mapId: k,
594
- // eslint-disable-next-line react-hooks/exhaustive-deps
595
- cameraState: s.current
596
- }, L.remove(), p ? ne.push(S, T) : google.maps.event.clearInstanceListeners(T), r(null), O(g);
597
- };
598
- },
599
- // some dependencies are ignored in the list below:
600
- // - defaultBounds and the default* camera props will only be used once, and
601
- // changes should be ignored
602
- // - mapOptions has special hooks that take care of updating the options
603
- // eslint-disable-next-line react-hooks/exhaustive-deps
604
- [
605
- i,
606
- t,
607
- g,
608
- // these props can't be changed after initialization and require a new
609
- // instance to be created
610
- e.mapId,
611
- e.renderingType,
612
- e.colorScheme
613
- ]
614
- ), [o, a, s];
615
- }
616
- const Fe = M.createContext(null), Dn = (e) => {
617
- const { children: n, id: t, className: o, style: r } = e, i = R($), a = Ne();
618
- if (!i)
619
- throw new Error("<Map> can only be used inside an <ApiProvider> component.");
620
- const [s, g, c] = kn(e, i);
621
- Mn(s, c, e), un(s, e), yn(s, e);
622
- const l = Cn(s, e), h = !!e.controlled;
623
- b(() => {
624
- if (s)
625
- return l && s.setOptions({ disableDefaultUI: !0 }), (l || h) && s.setOptions({
626
- gestureHandling: "none",
627
- keyboardShortcuts: !1
628
- }), () => {
629
- s.setOptions({
630
- gestureHandling: e.gestureHandling,
631
- keyboardShortcuts: e.keyboardShortcuts
632
- });
633
- };
634
- }, [
635
- s,
636
- l,
637
- h,
638
- e.gestureHandling,
639
- e.keyboardShortcuts
640
- ]);
641
- const f = e.center ? te(e.center) : null;
642
- let u = null, p = null;
643
- f && Number.isFinite(f.lat) && Number.isFinite(f.lng) && (u = f.lat, p = f.lng);
644
- const y = w(() => {
645
- var C, E, P;
646
- return {
647
- center: { lat: u ?? 0, lng: p ?? 0 },
648
- zoom: (C = e.zoom) !== null && C !== void 0 ? C : 0,
649
- heading: (E = e.heading) !== null && E !== void 0 ? E : 0,
650
- tilt: (P = e.tilt) !== null && P !== void 0 ? P : 0
651
- };
652
- }, [u, p, e.zoom, e.heading, e.tilt]);
653
- V(() => {
654
- if (!s || !h)
655
- return;
656
- s.moveCamera(y);
657
- const C = s.addListener("bounds_changed", () => {
658
- s.moveCamera(y);
659
- });
660
- return () => C.remove();
661
- }, [s, h, y]);
662
- const d = w(() => Object.assign({
663
- width: "100%",
664
- height: "100%",
665
- position: "relative",
666
- // when using deckgl, the map should be sent to the back
667
- zIndex: l ? -1 : 0
668
- }, r), [r, l]), m = w(() => ({ map: s }), [s]);
669
- return a === x.AUTH_FAILURE ? M.createElement(
670
- "div",
671
- { style: Object.assign({ position: "relative" }, o ? {} : d), className: o },
672
- M.createElement(Pn, null)
673
- ) : M.createElement("div", Object.assign({ ref: g, "data-testid": "map", style: o ? void 0 : d, className: o }, t ? { id: t } : {}), s ? M.createElement(Fe.Provider, { value: m }, n) : null);
674
- };
675
- Dn.deckGLViewProps = !0;
676
- const Pe = /* @__PURE__ */ new Set();
677
- function Z(...e) {
678
- const n = JSON.stringify(e);
679
- Pe.has(n) || (Pe.add(n), console.error(...e));
680
- }
681
- const q = (e = null) => {
682
- const n = R($), { map: t } = R(Fe) || {};
683
- if (n === null)
684
- return Z("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;
685
- const { mapInstances: o } = n;
686
- return e !== null ? o[e] || null : t || o.default || null;
687
- };
688
- function G(e) {
689
- const n = je(), t = R($);
690
- return b(() => {
691
- !n || !t || t.importLibrary(e);
692
- }, [n, t, e]), (t == null ? void 0 : t.loadedLibraries[e]) || null;
693
- }
694
- var ie;
695
- const { useLayoutEffect: Sn, useRef: _n } = Se, In = (ie = Se.useInsertionEffect) !== null && ie !== void 0 ? ie : Sn;
696
- function wn() {
697
- throw new Error("useEffectEvent: invalid call during rendering.");
698
- }
699
- function Tn(e) {
700
- const n = _n(wn);
701
- return In(() => {
702
- n.current = e;
703
- }, [e]), ((...t) => n.current(...t));
704
- }
705
- const ze = Tn, Nn = () => {
706
- };
707
- function D(e, n, t) {
708
- const o = ze(t ?? Nn), r = !!t;
709
- b(() => {
710
- if (!e || !n || !r)
711
- return;
712
- const i = google.maps.event.addListener(e, n, o);
713
- return () => i.remove();
714
- }, [e, n, r]);
715
- }
716
- function _(e, n, t) {
717
- b(() => {
718
- e && (e[n] = t);
719
- }, [e, n, t]);
720
- }
721
- const xn = () => {
722
- };
723
- function ce(e, n, t) {
724
- const o = ze(t ?? xn), r = !!t;
725
- b(() => {
726
- if (!e || !n || !r)
727
- return;
728
- const i = o;
729
- return e.addEventListener(n, i), () => e.removeEventListener(n, i);
730
- }, [e, n, r]);
731
- }
732
- class Rn {
733
- constructor() {
734
- this.renderedStyles = /* @__PURE__ */ new Set(), this.styleElement = null;
735
- }
736
- getStyleElement() {
737
- return this.styleElement || (this.styleElement = document.createElement("style"), this.styleElement.setAttribute("data-rgm-anchor-styles", ""), document.head.appendChild(this.styleElement)), this.styleElement;
738
- }
739
- addAdvancedMarkerPointerEventsOverwrite() {
740
- if (this.renderedStyles.has("marker-pointer-events"))
741
- return;
742
- const n = this.getStyleElement();
743
- n.textContent += `
744
- gmp-advanced-marker[data-origin='rgm'] {
745
- pointer-events: none !important;
746
- }
747
- `, this.renderedStyles.add("marker-pointer-events");
748
- }
749
- cleanup() {
750
- this.styleElement && (this.styleElement.remove(), this.styleElement = null, this.renderedStyles.clear());
751
- }
752
- }
753
- const jn = new Rn();
754
- function Bn(e, n) {
755
- var t;
756
- if (!(!((t = google == null ? void 0 : google.maps) === null || t === void 0) && t.version))
757
- return;
758
- const o = google.maps.version.split("."), r = parseInt(o[0], 10), i = parseInt(o[1], 10);
759
- return r > e || r === e && i >= n;
760
- }
761
- const he = M.createContext(null), Fn = {
762
- BOTTOM: ["50%", "100%"]
763
- }, zn = B((e, n) => {
764
- const { children: t, style: o, className: r, anchorPoint: i } = e, [a, s] = Gn(e), g = w(() => a ? { marker: a } : null, [a]);
765
- return z(n, () => a, [a]), s ? M.createElement(he.Provider, { value: g }, oe(M.createElement(Un, { anchorPoint: i, styles: o, className: r }, t), s)) : null;
766
- });
767
- zn.displayName = "AdvancedMarker";
768
- function de(e) {
769
- return e.nodeType === Node.ELEMENT_NODE;
770
- }
771
- const Un = ({ children: e, styles: n, className: t }) => M.createElement("div", { className: t, style: n }, e);
772
- function Gn(e) {
773
- const [n, t] = I(null), [o, r] = I(null), i = q(), a = G("marker"), { children: s, onClick: g, className: c, onMouseEnter: l, onMouseLeave: h, onDrag: f, onDragStart: u, onDragEnd: p, collisionBehavior: y, clickable: d, draggable: m, position: C, title: E, zIndex: P, anchorPoint: A, anchorLeft: v, anchorTop: O } = e, k = ge.count(s);
774
- return b(() => {
775
- if (!i || !a)
776
- return;
777
- const S = new a.AdvancedMarkerElement();
778
- S.map = i, t(S);
779
- let L = null;
780
- return k > 0 && (L = document.createElement("div"), S.content = L, r(L)), () => {
781
- S.map = null, L == null || L.remove(), t(null), r(null);
782
- };
783
- }, [i, a, k]), b(() => {
784
- !(n != null && n.content) || !de(n.content) || k > 0 || (n.content.className = c ?? "");
785
- }, [n, c, k]), Hn(n, A, v, O, k > 0), _(n, "position", C), _(n, "title", E ?? ""), _(n, "zIndex", P), _(n, "collisionBehavior", y), b(() => {
786
- n && (m !== void 0 ? n.gmpDraggable = m : f || u || p ? n.gmpDraggable = !0 : n.gmpDraggable = !1);
787
- }, [n, m, f, p, u]), b(() => {
788
- if (!n)
789
- return;
790
- const S = d !== void 0 ? d : !!g || !!l || !!h;
791
- n.gmpClickable = S, S && (n != null && n.content) && de(n.content) && (n.content.style.pointerEvents = "all", g && (n.content.style.cursor = "pointer"));
792
- }, [n, d, g, l, h]), D(n, "click", g), D(n, "drag", f), D(n, "dragstart", u), D(n, "dragend", p), ce(n == null ? void 0 : n.element, "mouseenter", l), ce(n == null ? void 0 : n.element, "mouseleave", h), [n, o];
793
- }
794
- function Hn(e, n, t, o, r) {
795
- b(() => {
796
- if (!e || !r)
797
- return;
798
- const i = Bn(3, 62), a = e.content;
799
- if (!(!a || !de(a))) {
800
- if (t !== void 0 || o !== void 0) {
801
- i || 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.");
802
- return;
803
- }
804
- if (n !== void 0) {
805
- const [s, g] = n ?? Fn.BOTTOM, c = `calc(-1 * ${s})`, l = `calc(-1 * ${g})`;
806
- i ? (e.anchorLeft = c, e.anchorTop = l, a.style.transform = "") : (a.style.transform = `translate(50%, 100%) translate(${c}, ${l})`, e.dataset.origin = "rgm", jn.addAdvancedMarkerPointerEventsOverwrite());
807
- }
808
- }
809
- }, [e, n, t, o, r]);
810
- }
811
- function Jn(e) {
812
- var n, t, o;
813
- const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onRadiusChanged: l, onCenterChanged: h, center: f, defaultCenter: u, radius: p, defaultRadius: y } = e, d = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onRadiusChanged", "onCenterChanged", "center", "defaultCenter", "radius", "defaultRadius"]), [m, C] = I(null), E = q(), P = K(Object.assign(Object.assign({}, d), { clickable: (n = d.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = d.draggable) !== null && t !== void 0 ? t : !!(i || a || s || h), editable: (o = d.editable) !== null && o !== void 0 ? o : !!l }), W);
814
- return b(() => {
815
- if (!E) {
816
- E === void 0 && console.error("<Circle> has to be inside a Map component.");
817
- return;
818
- }
819
- const A = new google.maps.Circle(Object.assign(Object.assign({}, P), { center: f ?? u, radius: p ?? y }));
820
- return A.setMap(E), C(A), () => {
821
- A.setMap(null), C(null);
822
- };
823
- }, [E]), D(m, "click", r), D(m, "drag", i), D(m, "dragstart", a), D(m, "dragend", s), D(m, "mouseover", g), D(m, "mouseout", c), D(m, "radius_changed", l ? () => {
824
- const A = m == null ? void 0 : m.getRadius();
825
- A !== void 0 && l(A);
826
- } : null), D(m, "center_changed", h ? () => {
827
- h(m == null ? void 0 : m.getCenter());
828
- } : null), b(() => {
829
- m && m.setOptions(P);
830
- }, [m, P]), b(() => {
831
- !m || !f || xe(f, m.getCenter()) || m.setCenter(f);
832
- }, [m, f]), b(() => {
833
- !m || p === void 0 || p !== m.getRadius() && m.setRadius(p);
834
- }, [m, p]), m;
835
- }
836
- const Vn = B((e, n) => {
837
- const t = Jn(e);
838
- return z(n, () => t, [t]), M.createElement(M.Fragment, null);
839
- });
840
- Vn.displayName = "Circle";
841
- function $n(e, n, t) {
842
- if (n != null && typeof n != "object")
843
- 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.");
844
- const o = e.style;
845
- if (t == null) {
846
- if (n == null)
847
- return;
848
- for (const r in n)
849
- n.hasOwnProperty(r) && Ae(o, r, n[r]);
850
- return;
851
- }
852
- for (const r in t)
853
- t.hasOwnProperty(r) && (n == null || !n.hasOwnProperty(r)) && (r.indexOf("--") === 0 ? o.setProperty(r, "") : r === "float" ? o.cssFloat = "" : o[r] = "");
854
- if (n != null)
855
- for (const r in n) {
856
- const i = n[r];
857
- n.hasOwnProperty(r) && t[r] !== i && Ae(o, r, i);
858
- }
859
- }
860
- function Ae(e, n, t) {
861
- const o = n.indexOf("--") === 0;
862
- 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 && !Zn(n) ? e[n] = t + "px" : n === "float" ? e.cssFloat = t : e[n] = ("" + t).trim();
863
- }
864
- const qn = /* @__PURE__ */ new Set([
865
- "animationIterationCount",
866
- "aspectRatio",
867
- "borderImageOutset",
868
- "borderImageSlice",
869
- "borderImageWidth",
870
- "boxFlex",
871
- "boxFlexGroup",
872
- "boxOrdinalGroup",
873
- "columnCount",
874
- "columns",
875
- "flex",
876
- "flexGrow",
877
- "flexPositive",
878
- "flexShrink",
879
- "flexNegative",
880
- "flexOrder",
881
- "gridArea",
882
- "gridRow",
883
- "gridRowEnd",
884
- "gridRowSpan",
885
- "gridRowStart",
886
- "gridColumn",
887
- "gridColumnEnd",
888
- "gridColumnSpan",
889
- "gridColumnStart",
890
- "fontWeight",
891
- "lineClamp",
892
- "lineHeight",
893
- "opacity",
894
- "order",
895
- "orphans",
896
- "scale",
897
- "tabSize",
898
- "widows",
899
- "zIndex",
900
- "zoom",
901
- "fillOpacity",
902
- // SVG-related properties
903
- "floodOpacity",
904
- "stopOpacity",
905
- "strokeDasharray",
906
- "strokeDashoffset",
907
- "strokeMiterlimit",
908
- "strokeOpacity",
909
- "strokeWidth"
910
- ]);
911
- function Zn(e) {
912
- return qn.has(e);
913
- }
914
- function Le(e) {
915
- const n = e.getPaths(), t = [];
916
- for (let o = 0; o < n.getLength(); o++)
917
- t.push(n.getAt(o).getArray());
918
- return t;
919
- }
920
- function Wn(e) {
921
- var n, t, o;
922
- const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathsChanged: l, polygon: h, encodedPaths: f, paths: u, defaultPaths: p } = e, y = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathsChanged", "polygon", "encodedPaths", "paths", "defaultPaths"]), [d, m] = I(null), C = q(), E = G("geometry"), P = j(!1), A = K(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), W);
923
- return b(() => {
924
- if (!C) {
925
- C === void 0 && console.error("<Polygon> has to be inside a Map component.");
926
- return;
927
- }
928
- let v;
929
- if (h) {
930
- v = h;
931
- const O = u ?? p;
932
- O && Array.isArray(O) && v.setPaths(O), v.setOptions(A);
933
- } else {
934
- const O = u ?? p, k = Object.assign({}, A);
935
- O && Array.isArray(O) && (k.paths = O), v = new google.maps.Polygon(k);
936
- }
937
- return v.setMap(C), m(v), () => {
938
- v.setMap(null), m(null);
939
- };
940
- }, [C, h]), D(d, "click", r), D(d, "drag", i), D(d, "dragstart", a), D(d, "mouseover", g), D(d, "mouseout", c), D(d, "dragend", (v) => {
941
- s == null || s(v), l && d && !P.current && l(Le(d));
942
- }), b(() => {
943
- if (!d || !l)
944
- return;
945
- const v = [], O = d.getPaths();
946
- if (typeof O.getLength != "function" || typeof O.getAt != "function")
947
- return;
948
- const k = () => {
949
- P.current || l(Le(d));
950
- }, S = (L) => {
951
- v.push(google.maps.event.addListener(L, "insert_at", k)), v.push(google.maps.event.addListener(L, "remove_at", k)), v.push(google.maps.event.addListener(L, "set_at", k));
952
- };
953
- for (let L = 0; L < O.getLength(); L++)
954
- S(O.getAt(L));
955
- return v.push(google.maps.event.addListener(O, "insert_at", (L) => {
956
- S(O.getAt(L)), k();
957
- })), v.push(google.maps.event.addListener(O, "set_at", (L) => {
958
- S(O.getAt(L)), k();
959
- })), v.push(google.maps.event.addListener(O, "remove_at", k)), () => {
960
- v.forEach((L) => L.remove());
961
- };
962
- }, [
963
- d,
964
- l,
965
- u,
966
- f,
967
- A.editable,
968
- A.draggable
969
- ]), b(() => {
970
- d && d.setOptions(A);
971
- }, [d, A]), b(() => {
972
- if (!d || !u || !Array.isArray(u))
973
- return;
974
- const v = u[0], O = Array.isArray(v) ? u : [u], k = d.getPaths();
975
- On(O, k) || (P.current = !0, d.setPaths(u), P.current = !1);
976
- }, [d, u]), b(() => {
977
- if (!d || !f || !E)
978
- return;
979
- P.current = !0;
980
- const v = f.map((O) => E.encoding.decodePath(O));
981
- d.setPaths(v), P.current = !1;
982
- }, [d, f, E]), d;
983
- }
984
- const Kn = B((e, n) => {
985
- const t = Wn(e);
986
- return z(n, () => t, [t]), M.createElement(M.Fragment, null);
987
- });
988
- Kn.displayName = "Polygon";
989
- function Yn(e) {
990
- var n, t, o;
991
- const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onPathChanged: l, polyline: h, encodedPath: f, path: u, defaultPath: p } = e, y = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onPathChanged", "polyline", "encodedPath", "path", "defaultPath"]), [d, m] = I(null), C = q(), E = G("geometry"), P = j(!1), A = K(Object.assign(Object.assign({}, y), { clickable: (n = y.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = y.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = y.editable) !== null && o !== void 0 ? o : !!l }), W);
992
- return b(() => {
993
- if (!C) {
994
- C === void 0 && console.error("<Polyline> has to be inside a Map component.");
995
- return;
996
- }
997
- let v;
998
- if (h) {
999
- v = h;
1000
- const O = u ?? p;
1001
- O && Array.isArray(O) && v.setPath(O), v.setOptions(A);
1002
- } else {
1003
- const O = u ?? p, k = Object.assign({}, A);
1004
- O && Array.isArray(O) && (k.path = O), v = new google.maps.Polyline(k);
1005
- }
1006
- return v.setMap(C), m(v), () => {
1007
- v.setMap(null), m(null);
1008
- };
1009
- }, [C, h]), D(d, "click", r), D(d, "drag", i), D(d, "dragstart", a), D(d, "mouseover", g), D(d, "mouseout", c), D(d, "dragend", (v) => {
1010
- s == null || s(v), l && d && !P.current && l(d.getPath().getArray());
1011
- }), b(() => {
1012
- if (!d || !l)
1013
- return;
1014
- const v = d.getPath();
1015
- if (!v)
1016
- return;
1017
- const O = () => {
1018
- P.current || l(v.getArray());
1019
- }, k = [
1020
- google.maps.event.addListener(v, "insert_at", O),
1021
- google.maps.event.addListener(v, "remove_at", O),
1022
- google.maps.event.addListener(v, "set_at", O)
1023
- ];
1024
- return () => {
1025
- k.forEach((S) => S.remove());
1026
- };
1027
- }, [
1028
- d,
1029
- l,
1030
- u,
1031
- f,
1032
- A.editable,
1033
- A.draggable
1034
- ]), b(() => {
1035
- d && d.setOptions(A);
1036
- }, [d, A]), b(() => {
1037
- if (!d || !u)
1038
- return;
1039
- const v = d.getPath();
1040
- Re(u, v) || (P.current = !0, d.setPath(u), P.current = !1);
1041
- }, [d, u]), b(() => {
1042
- if (!d || !f || !E)
1043
- return;
1044
- P.current = !0;
1045
- const v = E.encoding.decodePath(f);
1046
- d.setPath(v), P.current = !1;
1047
- }, [d, f, E]), d;
1048
- }
1049
- const Xn = B((e, n) => {
1050
- const t = Yn(e);
1051
- return z(n, () => t, [t]), M.createElement(M.Fragment, null);
1052
- });
1053
- Xn.displayName = "Polyline";
1054
- const Qn = {
1055
- center: { lat: 0, lng: 0, altitude: 0 },
1056
- range: 0,
1057
- heading: 0,
1058
- tilt: 0,
1059
- roll: 0
1060
- }, et = ["center", "range", "heading", "tilt", "roll"];
1061
- function nt(e, n, t) {
1062
- const o = e[t];
1063
- if (o != null)
1064
- if (t === "center") {
1065
- const r = o;
1066
- n.current.center = r.toJSON ? r.toJSON() : r;
1067
- } else
1068
- n.current[t] = o;
1069
- }
1070
- function tt(e) {
1071
- const n = Be(), t = j(Object.assign({}, Qn));
1072
- return b(() => {
1073
- if (!e)
1074
- return;
1075
- const o = [];
1076
- for (const r of et) {
1077
- const i = `gmp-${r}change`, a = () => {
1078
- nt(e, t, r), n();
1079
- };
1080
- e.addEventListener(i, a), o.push(() => e.removeEventListener(i, a));
1081
- }
1082
- return () => {
1083
- for (const r of o)
1084
- r();
1085
- };
1086
- }, [e, n]), t;
1087
- }
1088
- function ot(e) {
1089
- const n = G("maps3d"), [t, o] = I(!1), [, r] = le(), [i, a] = le(), s = tt(i);
1090
- return b(() => {
1091
- customElements.whenDefined("gmp-map-3d").then(() => {
1092
- o(!0);
1093
- });
1094
- }, []), b(
1095
- () => {
1096
- if (!i)
1097
- return;
1098
- const {
1099
- center: c,
1100
- heading: l,
1101
- tilt: h,
1102
- range: f,
1103
- roll: u,
1104
- defaultCenter: p,
1105
- defaultHeading: y,
1106
- defaultTilt: d,
1107
- defaultRange: m,
1108
- defaultRoll: C,
1109
- // Non-element props to exclude
1110
- id: E,
1111
- style: P,
1112
- className: A,
1113
- children: v,
1114
- onCenterChanged: O,
1115
- onHeadingChanged: k,
1116
- onTiltChanged: S,
1117
- onRangeChanged: L,
1118
- onRollChanged: T,
1119
- onCameraChanged: Y,
1120
- onClick: X,
1121
- onSteadyChange: Pt,
1122
- onAnimationEnd: At,
1123
- onError: Lt,
1124
- mode: kt,
1125
- gestureHandling: Dt
1126
- } = e, Ue = N(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"]), pe = c ?? p, ve = l ?? y, ye = h ?? d, Ce = f ?? m, be = u ?? C, H = Object.assign({}, Ue);
1127
- pe && (H.center = pe), ve !== void 0 && (H.heading = ve), ye !== void 0 && (H.tilt = ye), Ce !== void 0 && (H.range = Ce), be !== void 0 && (H.roll = be), Object.assign(i, H);
1128
- },
1129
- // this effect should only run when the map3d element first becomes
1130
- // available, so we skip re-running it when other props change.
1131
- // eslint-disable-next-line react-hooks/exhaustive-deps
1132
- [i]
1133
- ), [i, r, a, s, !!n && t];
1134
- }
1135
- function rt(e) {
1136
- return e ? "toJSON" in e && typeof e.toJSON == "function" ? e.toJSON() : e : null;
1137
- }
1138
- function it(e, n, t) {
1139
- var o, r, i, a, s, g, c;
1140
- const l = rt(t.center), h = (o = l == null ? void 0 : l.lat) !== null && o !== void 0 ? o : null, f = (r = l == null ? void 0 : l.lng) !== null && r !== void 0 ? r : null, u = (i = l == null ? void 0 : l.altitude) !== null && i !== void 0 ? i : null, p = (a = t.range) !== null && a !== void 0 ? a : null, y = (s = t.heading) !== null && s !== void 0 ? s : null, d = (g = t.tilt) !== null && g !== void 0 ? g : null, m = (c = t.roll) !== null && c !== void 0 ? c : null;
1141
- V(() => {
1142
- var C;
1143
- if (!e)
1144
- return;
1145
- const E = n.current;
1146
- h !== null && f !== null && (E.center.lat !== h || E.center.lng !== f || u !== null && E.center.altitude !== u) && (e.center = {
1147
- lat: h,
1148
- lng: f,
1149
- altitude: (C = u ?? E.center.altitude) !== null && C !== void 0 ? C : 0
1150
- }), p !== null && E.range !== p && (e.range = p), y !== null && E.heading !== y && (e.heading = y), d !== null && E.tilt !== d && (e.tilt = d), m !== null && E.roll !== m && (e.roll = m);
1151
- });
1152
- }
1153
- const ke = [
1154
- "gmp-centerchange",
1155
- "gmp-headingchange",
1156
- "gmp-tiltchange",
1157
- "gmp-rangechange",
1158
- "gmp-rollchange"
1159
- ];
1160
- function J(e, n) {
1161
- const t = e.center;
1162
- let o;
1163
- return t && "toJSON" in t && typeof t.toJSON == "function" ? o = t.toJSON() : t ? o = t : o = { lat: 0, lng: 0, altitude: 0 }, {
1164
- type: n,
1165
- map3d: e,
1166
- detail: {
1167
- center: o,
1168
- range: e.range || 0,
1169
- heading: e.heading || 0,
1170
- tilt: e.tilt || 0,
1171
- roll: e.roll || 0
1172
- }
1173
- };
1174
- }
1175
- function at(e, n) {
1176
- const t = n;
1177
- return {
1178
- type: "gmp-click",
1179
- map3d: e,
1180
- detail: {
1181
- position: n.position || null,
1182
- placeId: t.placeId
1183
- }
1184
- };
1185
- }
1186
- function st(e, n) {
1187
- return {
1188
- type: "gmp-steadychange",
1189
- map3d: e,
1190
- detail: {
1191
- isSteady: n.isSteady
1192
- }
1193
- };
1194
- }
1195
- function lt(e, n) {
1196
- const { onCenterChanged: t, onHeadingChanged: o, onTiltChanged: r, onRangeChanged: i, onRollChanged: a, onCameraChanged: s, onClick: g, onSteadyChange: c, onAnimationEnd: l, onError: h } = n;
1197
- U(e, "gmp-centerchange", t, J), U(e, "gmp-headingchange", o, J), U(e, "gmp-tiltchange", r, J), U(e, "gmp-rangechange", i, J), U(e, "gmp-rollchange", a, J), b(() => {
1198
- if (!e || !s)
1199
- return;
1200
- const f = () => {
1201
- s(J(e, "camerachange"));
1202
- };
1203
- for (const u of ke)
1204
- e.addEventListener(u, f);
1205
- return () => {
1206
- for (const u of ke)
1207
- e.removeEventListener(u, f);
1208
- };
1209
- }, [e, s]), b(() => {
1210
- if (!e || !g)
1211
- return;
1212
- const f = (u) => {
1213
- g(at(e, u));
1214
- };
1215
- return e.addEventListener("gmp-click", f), () => e.removeEventListener("gmp-click", f);
1216
- }, [e, g]), b(() => {
1217
- if (!e || !c)
1218
- return;
1219
- const f = (u) => {
1220
- c(st(e, u));
1221
- };
1222
- return e.addEventListener("gmp-steadychange", f), () => e.removeEventListener("gmp-steadychange", f);
1223
- }, [e, c]), U(e, "gmp-animationend", l, (f, u) => ({
1224
- type: u,
1225
- map3d: f
1226
- })), U(e, "gmp-error", h, (f, u) => ({
1227
- type: u,
1228
- map3d: f
1229
- }));
1230
- }
1231
- function U(e, n, t, o) {
1232
- b(() => {
1233
- if (!e || !t)
1234
- return;
1235
- const r = () => {
1236
- t(o(e, n));
1237
- };
1238
- return e.addEventListener(n, r), () => e.removeEventListener(n, r);
1239
- }, [e, n, t, o]);
1240
- }
1241
- const ct = /* @__PURE__ */ new Set([
1242
- "bounds",
1243
- "defaultUIHidden",
1244
- "gestureHandling",
1245
- "internalUsageAttributionIds",
1246
- "maxAltitude",
1247
- "maxHeading",
1248
- "maxTilt",
1249
- "minAltitude",
1250
- "minHeading",
1251
- "minTilt",
1252
- "mode"
1253
- ]);
1254
- function dt(e, n) {
1255
- const t = w(() => {
1256
- const o = {}, r = Object.keys(n);
1257
- for (const i of r) {
1258
- if (!ct.has(i))
1259
- continue;
1260
- const a = n[i];
1261
- a !== void 0 && (o[i] = a);
1262
- }
1263
- return o;
1264
- }, [n]);
1265
- Te(() => {
1266
- e && Object.assign(e, t);
1267
- }, [e, t]);
1268
- }
1269
- const ut = M.createContext(null), gt = {
1270
- width: "100%",
1271
- height: "100%",
1272
- position: "relative"
1273
- }, ft = B((e, n) => {
1274
- const { children: t, id: o, className: r, style: i } = e, a = R($);
1275
- if (!a)
1276
- throw new Error("<Map3D> can only be used inside an <APIProvider> component.");
1277
- const { addMap3DInstance: s, removeMap3DInstance: g } = a, [c, l, h, f, u] = ot(e);
1278
- it(c, f, e), lt(c, e), dt(c, e), b(() => {
1279
- if (!c)
1280
- return;
1281
- const d = o ?? "default";
1282
- return s(c, d), () => {
1283
- g(d);
1284
- };
1285
- }, [c, o]), z(n, () => ({
1286
- map3d: c,
1287
- flyCameraAround: (d) => {
1288
- c == null || c.flyCameraAround(d);
1289
- },
1290
- flyCameraTo: (d) => {
1291
- c == null || c.flyCameraTo(d);
1292
- },
1293
- stopCameraAnimation: () => {
1294
- c == null || c.stopCameraAnimation();
1295
- }
1296
- }), [c]);
1297
- const p = w(() => Object.assign(Object.assign({}, gt), i), [i]), y = w(() => ({ map3d: c }), [c]);
1298
- return u ? M.createElement(
1299
- "div",
1300
- Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : p, className: r }, o ? { id: o } : {}),
1301
- M.createElement("gmp-map-3d", { ref: h, style: { width: "100%", height: "100%" } }, c && M.createElement(ut.Provider, { value: y }, t))
1302
- ) : M.createElement("div", Object.assign({ ref: l, "data-testid": "map-3d", style: r ? void 0 : p, className: r }, o ? { id: o } : {}));
1303
- });
1304
- ft.displayName = "Map3D";
1305
- const me = Ge(null), ht = B(function(n, t) {
1306
- const { children: o, onClick: r, position: i, altitudeMode: a, collisionBehavior: s, drawsWhenOccluded: g, extruded: c, label: l, sizePreserved: h, zIndex: f, title: u } = n, p = !!r, [y, d] = I(null), [m, C] = I(!1), E = w(() => {
1307
- const v = document.createElement("div");
1308
- return v.style.display = "none", document.body.appendChild(v), v;
1309
- }, []);
1310
- b(() => () => E.remove(), [E]);
1311
- const P = ue((v) => {
1312
- d(v), typeof t == "function" ? t(v) : t && (t.current = v);
1313
- }, [t]);
1314
- ce(y, "gmp-click", r), V(() => {
1315
- if (m || !y || !E)
1316
- return;
1317
- for (; y.firstChild; )
1318
- y.removeChild(y.firstChild);
1319
- const v = Array.from(E.childNodes);
1320
- for (const O of v) {
1321
- if (O.nodeType !== Node.ELEMENT_NODE)
1322
- continue;
1323
- const k = O, S = k.tagName.toLowerCase();
1324
- if (S === "img" || S === "svg") {
1325
- const L = document.createElement("template");
1326
- L.content.appendChild(k.cloneNode(!0)), y.appendChild(L);
1327
- } else
1328
- y.appendChild(k.cloneNode(!0));
1329
- }
1330
- }, [y, E, o, m]);
1331
- const A = w(() => ({ marker: y, setContentHandledExternally: C }), [y]);
1332
- return _(y, "position", i), _(y, "altitudeMode", a), _(y, "collisionBehavior", s), _(y, "drawsWhenOccluded", g), _(y, "extruded", c), _(y, "label", l), _(y, "sizePreserved", h), _(y, "zIndex", f), _(y, "title", u ?? ""), M.createElement(
1333
- me.Provider,
1334
- { value: A },
1335
- p ? M.createElement("gmp-marker-3d-interactive", { ref: P }) : M.createElement("gmp-marker-3d", { ref: P }),
1336
- oe(o, E)
1337
- );
1338
- });
1339
- ht.displayName = "Marker3D";
1340
- const mt = B(function(n, t) {
1341
- var o;
1342
- const { children: r, headerContent: i, style: a, className: s, open: g = !0, position: c, anchor: l, anchorId: h, altitudeMode: f, lightDismissDisabled: u, autoPanDisabled: p, onClose: y } = n, [d, m] = I(null), C = j(null);
1343
- z(t, () => d, [d]), pt(d, g, y), _(d, "open", g ?? !1), _(d, "altitudeMode", f), _(d, "lightDismissDisabled", u), _(d, "autoPanDisabled", p);
1344
- const E = (o = l ?? h) !== null && o !== void 0 ? o : c;
1345
- return _(d, "positionAnchor", E), V(() => {
1346
- d && ($n(d, a || null, C.current), C.current = a || null);
1347
- }, [d, a]), M.createElement(
1348
- "gmp-popover",
1349
- { ref: m, className: s },
1350
- i && M.createElement("div", { slot: "header" }, i),
1351
- r
1352
- );
1353
- });
1354
- mt.displayName = "Popover";
1355
- function pt(e, n, t) {
1356
- const o = j(void 0), r = j(n);
1357
- b(() => {
1358
- r.current = n;
1359
- }, [n]), b(() => {
1360
- if (!e || !t)
1361
- return;
1362
- const i = new MutationObserver((a) => {
1363
- for (const s of a)
1364
- if (s.type === "attributes" && s.attributeName === "open") {
1365
- const g = e.hasAttribute("open");
1366
- o.current === !0 && !g && r.current !== !1 && t(), o.current = g;
1367
- }
1368
- });
1369
- return i.observe(e, {
1370
- attributes: !0,
1371
- attributeFilter: ["open"]
1372
- }), o.current = e.hasAttribute("open"), () => {
1373
- i.disconnect();
1374
- };
1375
- }, [e, t]);
1376
- }
1377
- function vt(e) {
1378
- const [n, t] = I(null), o = q(), { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c } = e, l = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut"]), { position: h, draggable: f } = l;
1379
- return b(() => {
1380
- if (!o) {
1381
- o === void 0 && console.error("<Marker> has to be inside a Map component.");
1382
- return;
1383
- }
1384
- const u = new google.maps.Marker(l);
1385
- return u.setMap(o), t(u), () => {
1386
- u.setMap(null), t(null);
1387
- };
1388
- }, [o]), b(() => {
1389
- if (!n)
1390
- return;
1391
- const u = n, p = google.maps.event;
1392
- return r && p.addListener(u, "click", r), i && p.addListener(u, "drag", i), a && p.addListener(u, "dragstart", a), s && p.addListener(u, "dragend", s), g && p.addListener(u, "mouseover", g), c && p.addListener(u, "mouseout", c), n.setDraggable(!!f), () => {
1393
- p.clearInstanceListeners(u);
1394
- };
1395
- }, [
1396
- n,
1397
- f,
1398
- r,
1399
- i,
1400
- a,
1401
- s,
1402
- g,
1403
- c
1404
- ]), b(() => {
1405
- n && l && n.setOptions(l);
1406
- }, [n, l]), b(() => {
1407
- f || !h || !n || n.setPosition(h);
1408
- }, [f, h, n]), n;
1409
- }
1410
- const yt = B((e, n) => {
1411
- const t = vt(e);
1412
- return z(n, () => t, [t]), M.createElement(M.Fragment, null);
1413
- });
1414
- yt.displayName = "Marker";
1415
- const Ct = (e) => {
1416
- const n = R(he), t = R(me), o = n == null ? void 0 : n.marker, r = t == null ? void 0 : t.marker, i = t == null ? void 0 : t.setContentHandledExternally, a = w(() => document.createElement("div"), []), s = G("marker");
1417
- return b(() => {
1418
- if (r && i)
1419
- return i(!0), () => i(!1);
1420
- }, [r, i]), b(() => {
1421
- if (!r || !s)
1422
- return;
1423
- const g = Object.assign({}, e), c = new s.PinElement(g);
1424
- for (e.children && (c.glyph = a); r.firstChild; )
1425
- r.removeChild(r.firstChild);
1426
- return r.append(c), () => {
1427
- };
1428
- }, [r, s, a, e]), b(() => {
1429
- var g;
1430
- if (r)
1431
- return;
1432
- if (!o) {
1433
- o === void 0 && r === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
1434
- return;
1435
- }
1436
- e.glyph && e.children && Z("The <Pin> component only uses children to render the glyph if both the glyph property and children are present."), ge.count(e.children) > 1 && Z("Passing multiple children to the <Pin> component might lead to unexpected results.");
1437
- const c = Object.assign({}, e), l = new google.maps.marker.PinElement(c);
1438
- e.children && (l.glyph = a);
1439
- const h = (g = o.content) === null || g === void 0 ? void 0 : g.firstChild;
1440
- for (; h != null && h.firstChild; )
1441
- h.removeChild(h.firstChild);
1442
- h && h.appendChild(l.element);
1443
- }, [o, a, r, e]), oe(e.children, a);
1444
- }, bt = (e) => {
1445
- const { children: n } = e, t = R(he), o = R(me), r = t == null ? void 0 : t.marker, i = o == null ? void 0 : o.marker, a = o == null ? void 0 : o.setContentHandledExternally, s = w(() => document.createElement("div"), []), g = G("marker");
1446
- return b(() => {
1447
- if (i && a)
1448
- return a(!0), () => a(!1);
1449
- }, [i, a]), b(() => {
1450
- if (!i || !g)
1451
- return;
1452
- const c = Object.assign({}, e), l = new g.PinElement(c);
1453
- for (n && l.appendChild(s); i.firstChild; )
1454
- i.removeChild(i.firstChild);
1455
- return i.appendChild(l), () => {
1456
- };
1457
- }, [i, g, s, n, e]), b(() => {
1458
- var c;
1459
- if (i)
1460
- return;
1461
- if (!r || !g) {
1462
- r === void 0 && i === void 0 && console.error("The <Pin> component can only be used inside <AdvancedMarker> or <Marker3D>.");
1463
- return;
1464
- }
1465
- (e.glyphSrc || e.glyphText) && n && Z("The <Pin> component only uses children to render the glyph if both glyphSrc/glyphText and children are present."), ge.count(n) > 1 && Z("Passing multiple children to the <Pin> component might lead to unexpected results.");
1466
- const l = Object.assign({}, e), h = new g.PinElement(l);
1467
- n && h.appendChild(s);
1468
- const f = (c = r.content) === null || c === void 0 ? void 0 : c.firstChild;
1469
- for (; f != null && f.firstChild; )
1470
- f.removeChild(f.firstChild);
1471
- f && f.appendChild(h);
1472
- }, [
1473
- r,
1474
- g,
1475
- s,
1476
- i,
1477
- n,
1478
- e
1479
- ]), oe(n, s);
1480
- }, Tt = (e) => {
1481
- var n;
1482
- const t = G("marker"), o = w(() => t ? typeof customElements < "u" && customElements.get("gmp-pin") !== void 0 : !1, [t]);
1483
- if (!t)
1484
- return null;
1485
- if (o) {
1486
- const { glyph: r, glyphSrc: i, glyphText: a } = e, s = N(e, ["glyph", "glyphSrc", "glyphText"]), g = r instanceof URL || typeof r == "string" && r.startsWith("http"), c = a ?? (typeof r == "string" && !g ? r : void 0), l = i ?? (g ? String(r) : void 0);
1487
- return M.createElement(bt, Object.assign({}, s, { glyphText: c, glyphSrc: l }));
1488
- } else {
1489
- const { glyph: r, glyphSrc: i, glyphText: a } = e, s = N(e, ["glyph", "glyphSrc", "glyphText"]), g = (n = r ?? i) !== null && n !== void 0 ? n : a;
1490
- return M.createElement(Ct, Object.assign({}, s, { glyph: g }));
1491
- }
1492
- };
1493
- function Et(e) {
1494
- var n, t, o;
1495
- const { onClick: r, onDrag: i, onDragStart: a, onDragEnd: s, onMouseOver: g, onMouseOut: c, onBoundsChanged: l, bounds: h, defaultBounds: f } = e, u = N(e, ["onClick", "onDrag", "onDragStart", "onDragEnd", "onMouseOver", "onMouseOut", "onBoundsChanged", "bounds", "defaultBounds"]), [p, y] = I(null), d = q(), m = K(Object.assign(Object.assign({}, u), { clickable: (n = u.clickable) !== null && n !== void 0 ? n : !!r, draggable: (t = u.draggable) !== null && t !== void 0 ? t : !!(i || a || s || l), editable: (o = u.editable) !== null && o !== void 0 ? o : !!l }), W);
1496
- return b(() => {
1497
- if (!d) {
1498
- d === void 0 && console.error("<Rectangle> has to be inside a Map component.");
1499
- return;
1500
- }
1501
- const C = new google.maps.Rectangle(Object.assign(Object.assign({}, m), { bounds: h ?? f }));
1502
- return C.setMap(d), y(C), () => {
1503
- C.setMap(null), y(null);
1504
- };
1505
- }, [d]), D(p, "click", r), D(p, "drag", i), D(p, "dragstart", a), D(p, "dragend", s), D(p, "mouseover", g), D(p, "mouseout", c), D(p, "bounds_changed", l ? () => {
1506
- l(p == null ? void 0 : p.getBounds());
1507
- } : null), b(() => {
1508
- p && p.setOptions(m);
1509
- }, [p, m]), b(() => {
1510
- !p || !h || En(h, p.getBounds()) || p.setBounds(h);
1511
- }, [p, h]), p;
1512
- }
1513
- const Ot = B((e, n) => {
1514
- const t = Et(e);
1515
- return z(n, () => t, [
1516
- t
1517
- ]), M.createElement(M.Fragment, null);
1518
- });
1519
- Ot.displayName = "Rectangle";
1520
- const Mt = {
1521
- core: "Settings",
1522
- maps: "Map"
1523
- }, De = (e) => {
1524
- var t;
1525
- const n = (t = globalThis.google) == null ? void 0 : t.maps;
1526
- return !n || typeof n.importLibrary != "function" ? !0 : e.every((o) => {
1527
- const r = Mt[o];
1528
- return r !== void 0 && typeof n[r] == "function";
1529
- });
1530
- };
1531
- function Nt({
1532
- libraries: e = [],
1533
- pending: n,
1534
- children: t
1535
- }) {
1536
- const o = ["core", ...e.filter((s) => s !== "core")], r = o.join(","), [i, a] = I(() => ({
1537
- status: De(o) ? "ready" : "pending"
1538
- }));
1539
- if (b(() => {
1540
- var c;
1541
- const s = (c = globalThis.google) == null ? void 0 : c.maps;
1542
- if (!s || De(r.split(","))) {
1543
- a({ status: "ready" });
1544
- return;
1545
- }
1546
- let g = !1;
1547
- return Promise.all(r.split(",").map((l) => {
1548
- var h;
1549
- return (h = s.importLibrary) == null ? void 0 : h.call(s, l);
1550
- })).then(() => {
1551
- g || a({ status: "ready" });
1552
- }).catch((l) => {
1553
- g || a({ status: "failed", error: l });
1554
- }), () => {
1555
- g = !0;
1556
- };
1557
- }, [r]), i.status === "failed") throw i.error;
1558
- return i.status === "ready" ? t : n;
1559
- }
1560
- export {
1561
- wt as A,
1562
- Nt as M,
1563
- Tt as P,
1564
- Dn as a,
1565
- je as b,
1566
- q as c,
1567
- yt as d,
1568
- zn as e,
1569
- G as u
1570
- };
1571
- //# sourceMappingURL=maps-core-gate-C4dyo1ic.js.map