@local-logic/maps 0.0.5 → 0.0.7

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