@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,1443 +0,0 @@
1
- import { jsx as f, jsxs as N, Fragment as it } from "react/jsx-runtime";
2
- import { forwardRef as at, useRef as M, useMemo as P, useId as Re, useState as $, useEffect as C, useCallback as D, useImperativeHandle as ct, useLayoutEffect as Ve } from "react";
3
- import { createPortal as Ae } from "react-dom";
4
- import { c as X } from "./index-D2ZczOXr.js";
5
- import { useTranslation as q } from "react-i18next";
6
- import { M as lt, A as dt, a as ut, b as mt, u as Oe, c as W, d as Pe, e as Ge, P as Se } from "./maps-core-gate-C4dyo1ic.js";
7
- import { B as Ze } from "./button-DohK_Ak_.js";
8
- import { S as pt } from "./skeleton-tTWJpvAq.js";
9
- import { V as De } from "./visually-hidden-BHxEUGyT.js";
10
- import { E as ft } from "./error-boundary-tAn_GuCu.js";
11
- import { u as gt } from "./registry-DvAUVLHh.js";
12
- import { l as me } from "./length-token-DwMnGEYT.js";
13
- import { M as ht } from "./map-pin-BaY37-Km.js";
14
- import { E as je } from "./external-link-CY6zAXXU.js";
15
- const vt = {
16
- id: "map-view",
17
- // pan → scroll (viewport move); set_zoom → set_value; select_marker → pick
18
- // (NON-persisting marker focus, no value state slot).
19
- capabilities: ["scroll", "set_value", "pick"],
20
- // Every action routes through the imperative bridge, which only exists
21
- // once the map has loaded: consent granted (the default is
22
- // `consentGranted={false}`) and Google Maps finished loading. Until then
23
- // all three actions are silent no-ops. `consentGranted` says whether the
24
- // gate is passed, and a null `center` after it means the map is still
25
- // loading. `center` / `zoom` are read off the live
26
- // map because Google clamps zoom and animates pans, so requested is not
27
- // applied; `selectedMarkerId` is the only confirmation the host accepted
28
- // a `select_marker` proposal.
29
- //
30
- // A9: marker ids only (`MapMarker.id` is a stable opaque id). Never
31
- // `MapMarker.label`, never the `address` prop (consumer-supplied free
32
- // text, PII in any patient-address deployment), never `apiKey`.
33
- state: {
34
- consentGranted: {
35
- type: "boolean",
36
- descriptionKey: "ui.agent.mapView.state.consentGranted",
37
- description: "True when the GDPR consent gate has been passed. Read this FIRST: while it is false every action is a silent no-op against a placeholder, and nothing else in the surface says so. When it is true but `center` is still null, Google Maps is loading; wait for `center` before acting.",
38
- read: (e) => e.isConsentGranted()
39
- },
40
- markerCount: {
41
- type: "number",
42
- descriptionKey: "ui.agent.mapView.state.markerCount",
43
- description: "Number of markers the consumer passed. Zero means there is nothing for `select_marker` to select. A count only — no ids, labels or positions.",
44
- read: (e) => e.getMarkerCount()
45
- },
46
- selectedMarkerId: {
47
- type: "string | null",
48
- descriptionKey: "ui.agent.mapView.state.selectedMarkerId",
49
- description: "Id of the marker the host currently holds as selected, or null. Selection is fully controlled by the consumer, so `select_marker` only proposes — this slot is the only way to see whether the proposal was accepted.",
50
- read: (e) => e.getSelectedMarkerId()
51
- },
52
- center: {
53
- type: "{ lat: number; lng: number } | null",
54
- descriptionKey: "ui.agent.mapView.state.center",
55
- description: "Live map centre in lat/lng, or null until the map has loaded (consent not granted, or Google Maps still loading). The read-back for `pan_to`, and the sign that the map is ready.",
56
- read: (e) => e.getCenter()
57
- },
58
- zoom: {
59
- type: "number | null",
60
- descriptionKey: "ui.agent.mapView.state.zoom",
61
- description: "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
62
- read: (e) => e.getZoom()
63
- }
64
- },
65
- actions: {
66
- pan_to: {
67
- // Ephemeral viewport move, no data loss → read.
68
- safety: "read",
69
- argsType: "{ position: { lat: number; lng: number } }",
70
- argsSchema: {
71
- type: "object",
72
- properties: {
73
- position: {
74
- type: "object",
75
- properties: {
76
- lat: { type: "number", description: "Latitude in degrees." },
77
- lng: { type: "number", description: "Longitude in degrees." }
78
- },
79
- required: ["lat", "lng"]
80
- }
81
- },
82
- required: ["position"]
83
- },
84
- idempotent: !0,
85
- descriptionKey: "ui.agent.mapView.actions.panTo",
86
- description: "Pan the map to a new centre without changing zoom. Read the `center` slot back to confirm — Google animates the pan, so the applied centre settles after the call.",
87
- errors: [
88
- "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading)."
89
- ],
90
- invoke: (e, t) => {
91
- e.panTo(t.position);
92
- }
93
- },
94
- set_zoom: {
95
- // Ephemeral viewport zoom, no data loss → read.
96
- safety: "read",
97
- argsType: "{ zoom: number }",
98
- argsSchema: {
99
- type: "object",
100
- properties: {
101
- zoom: {
102
- type: "number",
103
- description: "Zoom level, typical range 1–20."
104
- }
105
- },
106
- required: ["zoom"]
107
- },
108
- idempotent: !0,
109
- descriptionKey: "ui.agent.mapView.actions.setZoom",
110
- description: "Set the map zoom level (typical range 1–20). Read the `zoom` slot back — Google clamps the request to the map type’s supported range, so requested and applied can differ.",
111
- errors: [
112
- "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
113
- "Requested zoom is clamped to the map type's range; `zoom` reports what was actually applied."
114
- ],
115
- invoke: (e, t) => {
116
- e.setZoom(t.zoom);
117
- }
118
- },
119
- select_marker: {
120
- // Ephemeral marker focus, no data loss → read.
121
- safety: "read",
122
- argsType: "{ id: string | null }",
123
- argsSchema: {
124
- type: "object",
125
- properties: {
126
- id: {
127
- type: ["string", "null"],
128
- description: "Marker id to select, or null to clear the selection."
129
- }
130
- },
131
- required: ["id"]
132
- },
133
- idempotent: !0,
134
- descriptionKey: "ui.agent.mapView.actions.selectMarker",
135
- description: "Propose a marker selection by id, or pass null to clear it. Fires the host's `onMarkerClick`; selection is controlled by the host, so read the `selectedMarkerId` slot back to see whether it accepted.",
136
- errors: [
137
- "Silent no-op until the map has loaded: while `consentGranted` is false (only the consent placeholder shows) or while `center` is still null (Google Maps is loading).",
138
- "The host owns `selectedMarkerId` and may ignore the proposal; `selectedMarkerId` is unchanged when it does."
139
- ],
140
- invoke: (e, t) => {
141
- e.selectMarker(t.id);
142
- }
143
- }
144
- },
145
- domHooks: {
146
- root: {
147
- attr: "data-component",
148
- value: "map-view",
149
- description: "Marks the element as a kit MapView."
150
- },
151
- instanceId: {
152
- attr: "data-component-id",
153
- sourceProp: "id",
154
- description: "Sourced from the id prop."
155
- }
156
- }
157
- }, bt = 30, yt = 56, ue = 17, wt = 256, kt = (e) => e * Math.PI / 180;
158
- function Mt(e, t, o) {
159
- const a = wt * 2 ** o, n = Math.min(Math.max(Math.sin(kt(e)), -0.9999), 0.9999), r = Math.log((1 + n) / (1 - n)) / 2;
160
- return {
161
- x: (t + 180) / 360 * a,
162
- y: (0.5 - r / (2 * Math.PI)) * a
163
- };
164
- }
165
- function xt(e, t) {
166
- return e === "auto" ? t > bt : e && t > 1;
167
- }
168
- function Et(e, t, o = yt) {
169
- if (t >= ue || e.length < 2)
170
- return { singles: [...e], clusters: [] };
171
- const a = e.map((s) => ({
172
- marker: s,
173
- ...Mt(s.position.lat, s.position.lng, t)
174
- })).sort(
175
- (s, l) => s.x - l.x || s.y - l.y || (s.marker.id < l.marker.id ? -1 : 1)
176
- ), n = [], r = /* @__PURE__ */ new Map(), c = (s) => Math.floor(s / o), p = o * o;
177
- for (const s of a) {
178
- const l = c(s.x), v = c(s.y);
179
- let h = null, i = p;
180
- for (let d = -1; d <= 1; d += 1)
181
- for (let y = -1; y <= 1; y += 1)
182
- for (const b of r.get(`${l + d}:${v + y}`) ?? []) {
183
- const x = (b.x - s.x) ** 2 + (b.y - s.y) ** 2;
184
- x <= i && (h = b, i = x);
185
- }
186
- if (h) {
187
- const d = h.members.length, y = `${c(h.x)}:${c(h.y)}`;
188
- h.x = (h.x * d + s.x) / (d + 1), h.y = (h.y * d + s.y) / (d + 1), h.lat = (h.lat * d + s.marker.position.lat) / (d + 1), h.lng = (h.lng * d + s.marker.position.lng) / (d + 1), h.members.push(s.marker);
189
- const b = `${c(h.x)}:${c(h.y)}`;
190
- if (y !== b) {
191
- const x = r.get(y);
192
- x && x.splice(x.indexOf(h), 1);
193
- const T = r.get(b);
194
- T ? T.push(h) : r.set(b, [h]);
195
- }
196
- } else {
197
- const d = {
198
- x: s.x,
199
- y: s.y,
200
- members: [s.marker],
201
- lat: s.marker.position.lat,
202
- lng: s.marker.position.lng
203
- };
204
- n.push(d);
205
- const y = `${l}:${v}`, b = r.get(y);
206
- b ? b.push(d) : r.set(y, [d]);
207
- }
208
- }
209
- const g = [], m = [];
210
- for (const s of n)
211
- s.members.length === 1 ? g.push(s.members[0]) : m.push({
212
- id: s.members[0].id,
213
- position: { lat: s.lat, lng: s.lng },
214
- members: s.members
215
- });
216
- return { singles: g, clusters: m };
217
- }
218
- function Ce(e) {
219
- if (!(e instanceof Element)) return !1;
220
- try {
221
- return e.matches(":focus-visible");
222
- } catch {
223
- return !0;
224
- }
225
- }
226
- const zt = X(
227
- [
228
- "ds:relative ds:overflow-hidden ds:block",
229
- "ds:bg-[var(--muted)]",
230
- // Focus lands on the region when the interactive map replaces its button.
231
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
232
- ].join(" "),
233
- {
234
- variants: {
235
- size: {
236
- sm: "ds:[--map-block-size:14rem]",
237
- md: "ds:[--map-block-size:20rem]",
238
- lg: "ds:[--map-block-size:28rem]",
239
- // `fill` defers sizing to the parent. The outer takes
240
- // `block-size: 100%` so the inner (also 100%) has something
241
- // to inherit from. Use inside a viewport-locked column —
242
- // `<PracticeResults variant="map-first">` wires this through
243
- // automatically; standalone consumers must give the parent
244
- // a constrained block-size or the map collapses to 0.
245
- fill: "ds:[block-size:100%]"
246
- },
247
- surface: {
248
- bordered: "ds:rounded-[var(--radius-md)] ds:border ds:border-[color:var(--border)]",
249
- elevated: "ds:rounded-[var(--radius-md)] ds:shadow-[var(--shadow-card)] ds:[:where(&)]:border-[length:var(--surface-border-width,var(--border-width-sm))] ds:border-[color:var(--card-border)]",
250
- bare: "ds:rounded-none ds:border-0"
251
- }
252
- },
253
- defaultVariants: { size: "md", surface: "bordered" }
254
- }
255
- ), Lt = X("ds:block ds:w-full", {
256
- variants: {
257
- size: {
258
- sm: "ds:[block-size:var(--map-block-size)]",
259
- md: "ds:[block-size:var(--map-block-size)]",
260
- lg: "ds:[block-size:var(--map-block-size)]",
261
- fill: "ds:[block-size:100%]"
262
- }
263
- },
264
- defaultVariants: { size: "md" }
265
- }), St = X(
266
- [
267
- "ds:absolute ds:inset-0",
268
- "ds:flex ds:flex-col ds:items-center ds:justify-center",
269
- "ds:gap-[var(--spacing-sm)]",
270
- "ds:p-[var(--spacing-md)]",
271
- "ds:bg-[var(--muted)] ds:text-[var(--foreground)]",
272
- "ds:text-center"
273
- ].join(" ")
274
- ), Ct = X("type-heading-3 ds:m-0"), _e = X(
275
- "type-body-sm ds:text-[var(--muted-foreground)] ds:[max-inline-size:28rem] ds:m-0"
276
- );
277
- function _t({
278
- onHandleReady: e,
279
- onMarkerSelect: t,
280
- onCameraMove: o
281
- }) {
282
- const a = W();
283
- return C(() => {
284
- if (a)
285
- return e({
286
- panTo: (n) => {
287
- o(), a.panTo(n);
288
- },
289
- setZoom: (n) => {
290
- o(), a.setZoom(n);
291
- },
292
- jumpTo: (n, r) => {
293
- o(), a.moveCamera({ center: n, zoom: r });
294
- },
295
- selectMarker: (n) => t(n),
296
- // Read straight off the live map: Google clamps `setZoom` to the
297
- // map type's range and animates `panTo`, so requested and applied
298
- // are not the same value.
299
- getCenter: () => {
300
- var n;
301
- return ((n = a.getCenter()) == null ? void 0 : n.toJSON()) ?? null;
302
- },
303
- getZoom: () => a.getZoom() ?? null
304
- }), () => e(null);
305
- }, [a, e, t, o]), null;
306
- }
307
- function Tt({
308
- onBoundsChange: e,
309
- userInteraction: t
310
- }) {
311
- const o = W(), a = M(e);
312
- return a.current = e, C(() => {
313
- if (!o) return;
314
- const n = o.getDiv();
315
- let r = null;
316
- const c = () => {
317
- t.current = {
318
- pendingInput: !1,
319
- moved: !1,
320
- programmatic: !1
321
- };
322
- };
323
- c();
324
- let p;
325
- const g = /* @__PURE__ */ new Set(), m = (i) => {
326
- if (i instanceof PointerEvent && i.pointerType === "touch" && (i.type === "pointerdown" && g.add(i.pointerId), i.type === "pointerup" || i.type === "pointercancel")) {
327
- g.delete(i.pointerId);
328
- return;
329
- }
330
- if (i instanceof PointerEvent && i.type === "pointermove" && i.buttons === 0 && i.pointerType !== "touch" || i instanceof KeyboardEvent && ![
331
- "ArrowUp",
332
- "ArrowDown",
333
- "ArrowLeft",
334
- "ArrowRight",
335
- "+",
336
- "=",
337
- "-",
338
- "_",
339
- "Enter",
340
- " ",
341
- "PageUp",
342
- "PageDown"
343
- ].includes(i.key))
344
- return;
345
- const d = document.fullscreenElement, y = !!(d && (d.contains(n) || n.contains(d)));
346
- let b = i.type === "dblclick";
347
- i instanceof PointerEvent && i.type === "pointermove" && (b = i.pointerType !== "touch" || g.size >= 2 || y), i.type === "touchmove" && (b = i.touches.length >= 2 || y), i instanceof KeyboardEvent && (b = i.key !== "Enter" && i.key !== " "), i instanceof WheelEvent && (b = i.ctrlKey || i.metaKey || y), i.type === "click" && (b = i.target instanceof Element && i.target.closest('button, [role="button"]') != null), b && (t.current.programmatic = !1), t.current.pendingInput = !0, clearTimeout(p), p = setTimeout(() => {
348
- t.current.pendingInput = !1;
349
- }, 250);
350
- }, s = () => {
351
- t.current.pendingInput && !t.current.programmatic && (t.current.moved = !0);
352
- }, l = () => {
353
- var V, G;
354
- const i = (V = o.getBounds()) == null ? void 0 : V.toJSON(), d = (G = o.getCenter()) == null ? void 0 : G.toJSON(), y = o.getZoom(), b = t.current.moved;
355
- if (c(), clearTimeout(p), !i || !d || y == null) return;
356
- const x = !r || Object.keys(i).some(
357
- (Z) => i[Z] !== r.bounds[Z]
358
- ), T = r != null && (y !== r.zoom || d.lat !== r.center.lat || d.lng !== r.center.lng);
359
- r = { bounds: i, center: d, zoom: y }, x && a.current(i, { userInteraction: b && T });
360
- }, v = [
361
- "pointerdown",
362
- "pointermove",
363
- "pointerup",
364
- "pointercancel",
365
- "touchstart",
366
- "touchmove",
367
- "click",
368
- "dblclick",
369
- "wheel",
370
- "keydown"
371
- ];
372
- v.forEach(
373
- (i) => n.addEventListener(i, m, { capture: !0, passive: !0 })
374
- );
375
- const h = [
376
- o.addListener("dragstart", () => {
377
- t.current.programmatic = !1, t.current.moved = !0;
378
- }),
379
- o.addListener("center_changed", s),
380
- o.addListener("zoom_changed", s),
381
- o.addListener("idle", l)
382
- ];
383
- return l(), () => {
384
- h.forEach((i) => i.remove()), v.forEach(
385
- (i) => n.removeEventListener(i, m, !0)
386
- ), clearTimeout(p), c();
387
- };
388
- }, [o, t]), null;
389
- }
390
- function It(e, t) {
391
- const o = W(), [a, n] = $(null), { lat: r, lng: c } = t;
392
- return C(() => {
393
- if (!o || typeof o.getCenter != "function") return;
394
- const p = () => {
395
- var d, y;
396
- const m = (d = o.getCenter()) == null ? void 0 : d.toJSON(), s = o.getZoom(), l = (y = o.getDiv) == null ? void 0 : y.call(o);
397
- if (!m || s == null || !l) {
398
- n(null);
399
- return;
400
- }
401
- const v = l.clientWidth, h = l.clientHeight, i = Fe * 2 ** s;
402
- n({
403
- id: e,
404
- width: v,
405
- height: h,
406
- x: v / 2 + (c - m.lng) / 360 * i,
407
- y: h / 2 - (oe(r) - oe(m.lat)) * i / (2 * Math.PI)
408
- });
409
- };
410
- p();
411
- const g = ["bounds_changed", "zoom_changed", "center_changed", "idle"].flatMap(
412
- (m) => typeof o.addListener == "function" ? [o.addListener(m, p)] : []
413
- );
414
- return () => g.forEach((m) => m.remove());
415
- }, [o, e, r, c]), (a == null ? void 0 : a.id) === e ? a : null;
416
- }
417
- function Nt({
418
- marker: e,
419
- frame: t,
420
- direction: o,
421
- children: a
422
- }) {
423
- const n = It(e.id, e.position);
424
- return !n || !t ? null : Ae(
425
- /* @__PURE__ */ f(Vt, { anchor: n, direction: o, children: a }),
426
- t
427
- );
428
- }
429
- const $t = 52, Rt = 12, te = 8;
430
- function Vt({
431
- anchor: e,
432
- children: t,
433
- direction: o
434
- }) {
435
- const a = M(null), [n, r] = $(
436
- null
437
- );
438
- if (Ve(() => {
439
- const i = a.current;
440
- i && r(
441
- (d) => (d == null ? void 0 : d.width) === i.offsetWidth && d.height === i.offsetHeight ? d : { width: i.offsetWidth, height: i.offsetHeight }
442
- );
443
- }, [t, e.id]), !(e.x >= 0 && e.x <= e.width && e.y >= 0 && e.y <= e.height)) return null;
444
- const p = (n == null ? void 0 : n.width) ?? 0, g = (n == null ? void 0 : n.height) ?? 0, m = Math.max(te, e.width - p - te), s = Math.min(Math.max(e.x - p / 2, te), m), l = e.y - $t - g, v = l < te, h = v ? e.y + Rt : l;
445
- return (
446
- // The layer is `ltr` because the map is geographic: x is always measured
447
- // from the physical left. The card inside takes the page direction.
448
- /* @__PURE__ */ f(
449
- "div",
450
- {
451
- dir: "ltr",
452
- "aria-hidden": "true",
453
- "data-component": "map-view-marker-card-layer",
454
- className: "ds:pointer-events-none ds:absolute ds:inset-0 ds:overflow-hidden",
455
- children: /* @__PURE__ */ f(
456
- "div",
457
- {
458
- ref: a,
459
- "data-component": "map-view-marker-card",
460
- "data-marker-id": e.id,
461
- "data-placement": v ? "below" : "above",
462
- style: {
463
- "--marker-card-x": `${s}px`,
464
- "--marker-card-y": `${h}px`
465
- },
466
- "data-measured": n ? "true" : "false",
467
- className: "ds:absolute ds:[inset-inline-start:var(--marker-card-x)] ds:[inset-block-start:var(--marker-card-y)] ds:[inline-size:max-content] ds:[max-inline-size:calc(100%-var(--spacing-md))] ds:data-[measured=false]:invisible",
468
- children: /* @__PURE__ */ f("div", { dir: o, children: t })
469
- }
470
- )
471
- }
472
- )
473
- );
474
- }
475
- function ne(e) {
476
- if (!e) return null;
477
- if (e instanceof HTMLElement) return e;
478
- const t = e.element;
479
- return t instanceof HTMLElement ? t : null;
480
- }
481
- function At({
482
- marker: e,
483
- label: t,
484
- isSelected: o,
485
- isHovered: a,
486
- onSelect: n,
487
- onHover: r,
488
- elements: c
489
- }) {
490
- const [p, g] = $(null), { id: m } = e, s = M(!1);
491
- return C(() => {
492
- const l = ne(p);
493
- if (!l || !c) return;
494
- const v = c.current;
495
- return v.set(`pin:${e.id}`, l), () => {
496
- v.delete(`pin:${e.id}`);
497
- };
498
- }, [p, c, e.id]), C(() => {
499
- const l = ne(p);
500
- if (!l || !r) return;
501
- const v = (d) => {
502
- Ce(d.target) && r(m, !0, "focus");
503
- }, h = (d) => {
504
- l.contains(d.relatedTarget) || s.current || r(m, !1, "focus");
505
- }, i = (d) => {
506
- d.key === "Escape" && r(m, !1, "focus");
507
- };
508
- return l.addEventListener("focusin", v), l.addEventListener("focusout", h), l.addEventListener("keydown", i), () => {
509
- l.removeEventListener("focusin", v), l.removeEventListener("focusout", h), l.removeEventListener("keydown", i);
510
- };
511
- }, [p, m, r]), /* @__PURE__ */ f(
512
- Ge,
513
- {
514
- ref: g,
515
- position: e.position,
516
- title: t,
517
- "aria-label": t,
518
- "data-selected": o ? "true" : "false",
519
- "data-hovered": a ? "true" : "false",
520
- zIndex: a ? 1e3 : o ? 500 : void 0,
521
- onClick: () => n(m),
522
- onMouseEnter: r ? () => {
523
- s.current = !0, r(m, !0, "pointer");
524
- } : void 0,
525
- onMouseLeave: r ? () => {
526
- s.current = !1;
527
- const l = ne(p), v = document.activeElement;
528
- l && v && l.contains(v) && Ce(v) || r(m, !1, "pointer");
529
- } : void 0,
530
- children: a ? (
531
- // Hovered pin: larger, deep ink body with a white ring.
532
- // Theme-invariant, because the tiles do not follow the kit theme: one
533
- // of body and ring clears 3:1 on any map style. Not `--accent`, which
534
- // failed contrast.
535
- /* @__PURE__ */ f(
536
- Se,
537
- {
538
- scale: 1.4,
539
- background: "var(--map-marker-hover-color)",
540
- borderColor: "var(--map-marker-hover-ring)",
541
- glyphColor: "var(--map-marker-hover-ring)"
542
- }
543
- )
544
- ) : (
545
- // The theme-stable map marker violet with a white ring and glyph, in
546
- // every theme: the map tiles do not follow the kit theme, and
547
- // `--primary` is light in the dark themes (about 1.5 to 2.9:1 on the
548
- // tiles). The static map image uses the same colour.
549
- /* @__PURE__ */ f(
550
- Se,
551
- {
552
- background: "var(--map-marker-color)",
553
- borderColor: "var(--map-marker-hover-ring)",
554
- glyphColor: "var(--map-marker-hover-ring)"
555
- }
556
- )
557
- )
558
- }
559
- );
560
- }
561
- const Fe = 256, Ot = (e) => e * Math.PI / 180;
562
- function oe(e) {
563
- const t = Math.min(Math.max(Math.sin(Ot(e)), -0.9999), 0.9999);
564
- return Math.log((1 + t) / (1 - t)) / 2;
565
- }
566
- const Pt = (e) => Math.atan(Math.sinh(e)) * 180 / Math.PI;
567
- function Gt(e) {
568
- let t = -90, o = 90, a = -180, n = 180;
569
- for (const { lat: r, lng: c } of e)
570
- t = Math.max(t, r), o = Math.min(o, r), a = Math.max(a, c), n = Math.min(n, c);
571
- return { north: t, south: o, east: a, west: n };
572
- }
573
- function Ue(e, t, o, a, n) {
574
- const { north: r, south: c, east: p, west: g } = Gt(e);
575
- if (r === c && p === g)
576
- return { center: { lat: r, lng: p }, zoom: n };
577
- const m = oe(r), s = oe(c), l = {
578
- lat: Pt((m + s) / 2),
579
- lng: (p + g) / 2
580
- }, v = (i, d) => d > 0 ? Math.log2(Math.max(i, 1) / Fe / d) : n, h = Math.min(
581
- v(t - 2 * a, (p - g) / 360),
582
- v(o - 2 * a, (m - s) / (2 * Math.PI)),
583
- n
584
- );
585
- return { center: l, zoom: Math.max(0, Math.floor(h)) };
586
- }
587
- const We = ({ id: e, lat: t, lng: o }) => e != null ? `id:${e}` : `at:${t},${o}`;
588
- function Zt({
589
- points: e,
590
- fitKey: t,
591
- maxZoom: o,
592
- onCameraMove: a
593
- }) {
594
- const n = W(), r = M(null), c = M(!1), p = M(null);
595
- return C(() => {
596
- if (!n) return;
597
- const g = () => {
598
- var i;
599
- const s = p.current, l = (i = n.getCenter()) == null ? void 0 : i.toJSON(), v = n.getZoom();
600
- s != null && v === s.zoom && l != null && Math.abs(l.lat - s.center.lat) < 1e-6 && Math.abs(l.lng - s.center.lng) < 1e-6 || (c.current = !0);
601
- }, m = [
602
- n.addListener("dragstart", () => {
603
- c.current = !0;
604
- }),
605
- n.addListener("center_changed", g),
606
- n.addListener("zoom_changed", g)
607
- ];
608
- return () => m.forEach((s) => s.remove());
609
- }, [n]), C(() => {
610
- var y;
611
- if (!n) return;
612
- const g = ((y = r.current) == null ? void 0 : y.map) === n ? r.current : null;
613
- if ((g == null ? void 0 : g.key) === t) return;
614
- const m = new Set(e.map(We)), s = (b, x) => {
615
- p.current = { center: b, zoom: x }, a(), n.moveCamera({ center: b, zoom: x }), c.current = !1;
616
- };
617
- if (e.length === 0) {
618
- r.current = { map: n, key: t, points: m };
619
- return;
620
- }
621
- if (g != null && g.points.size > 0 && [...g.points].every((b) => m.has(b)) && c.current) {
622
- r.current = { map: n, key: t, points: m };
623
- return;
624
- }
625
- const v = n.getDiv();
626
- if (!(v instanceof Element)) return;
627
- const h = () => {
628
- r.current = { map: n, key: t, points: m };
629
- const b = Math.min(
630
- me("--spacing-2xl", v, 48),
631
- v.clientWidth / 4,
632
- v.clientHeight / 4
633
- ), { center: x, zoom: T } = Ue(
634
- e,
635
- v.clientWidth,
636
- v.clientHeight,
637
- b,
638
- o
639
- );
640
- s(x, T);
641
- }, i = () => v.clientWidth > 0 && v.clientHeight > 0;
642
- if (i() || typeof ResizeObserver > "u") {
643
- h();
644
- return;
645
- }
646
- const d = new ResizeObserver(() => {
647
- i() && (d.disconnect(), h());
648
- });
649
- return d.observe(v), () => d.disconnect();
650
- }, [n, t, e, o, a]), null;
651
- }
652
- const Te = 10;
653
- function Dt(e) {
654
- const t = W(), [o, a] = $(e);
655
- return C(() => {
656
- if (!t || typeof t.addListener != "function" || typeof t.getZoom != "function")
657
- return;
658
- const n = () => {
659
- const c = t.getZoom();
660
- c != null && a(Math.round(c * 4) / 4);
661
- };
662
- n();
663
- const r = ["zoom_changed", "idle"].map(
664
- (c) => t.addListener(c, n)
665
- );
666
- return () => r.forEach((c) => c.remove());
667
- }, [t]), o;
668
- }
669
- const jt = [
670
- "ds:inline-flex ds:items-center ds:justify-center",
671
- // 44 px, 48 px in the accessible themes, with room for a long count.
672
- "ds:[min-inline-size:var(--min-target-size)] ds:[min-block-size:var(--min-target-size)]",
673
- "ds:px-[var(--spacing-xs)] ds:rounded-full",
674
- "ds:border-2 ds:border-solid ds:border-[color:var(--map-marker-hover-ring)]",
675
- // The theme-stable map marker colour, as the pins (see KitAdvancedMarker).
676
- "ds:bg-[var(--map-marker-color)] ds:text-[var(--map-marker-hover-ring)]",
677
- "ds:shadow-[var(--shadow-md)] ds:tabular-nums ds:select-none type-label",
678
- "ds:forced-colors:border-[ButtonText]",
679
- // Google's marker element takes the focus; the ring is drawn on the badge,
680
- // and the element's own outline is removed (see KitClusterMarker). The ring
681
- // is the theme-stable deep ink, not `--ring`, which is light in the dark
682
- // themes: the tiles do not follow the kit theme. `--focus-ring-width` is
683
- // thicker in the accessible themes.
684
- "ds:[gmp-advanced-marker:focus-visible_&]:outline-[length:var(--focus-ring-width)] ds:[gmp-advanced-marker:focus-visible_&]:outline-solid ds:[gmp-advanced-marker:focus-visible_&]:outline-[color:var(--map-marker-hover-color)] ds:[gmp-advanced-marker:focus-visible_&]:outline-offset-[length:var(--focus-ring-offset)]",
685
- "ds:[gmp-advanced-marker:focus-visible_&]:forced-colors:outline-[CanvasText]"
686
- ].join(" ");
687
- function Ft({ count: e }) {
688
- return /* @__PURE__ */ f(
689
- "span",
690
- {
691
- "aria-hidden": "true",
692
- "data-component": "map-view-cluster",
693
- "data-count": e,
694
- className: jt,
695
- children: e
696
- }
697
- );
698
- }
699
- function de(e, t) {
700
- const o = document.createElement("span");
701
- o.style.color = `var(${e})`, o.style.display = "none", (t.isConnected ? t : document.documentElement).append(o);
702
- const a = getComputedStyle(o).color;
703
- return o.remove(), a || "currentColor";
704
- }
705
- function Ut(e) {
706
- const t = W(), [o, a] = $(null);
707
- return C(() => {
708
- var m;
709
- const n = e ? (m = t == null ? void 0 : t.getDiv) == null ? void 0 : m.call(t) : null;
710
- if (!(n instanceof Element)) return;
711
- const r = () => {
712
- const s = {
713
- fill: de("--map-marker-color", n),
714
- ink: de("--map-marker-hover-ring", n),
715
- ring: de("--map-marker-hover-ring", n),
716
- target: me("--min-target-size", n, 44)
717
- };
718
- a(
719
- (l) => l && l.fill === s.fill && l.ink === s.ink && l.ring === s.ring && l.target === s.target ? l : s
720
- );
721
- };
722
- r();
723
- const c = new MutationObserver(r), p = {
724
- attributes: !0,
725
- attributeFilter: ["class", "data-theme"]
726
- };
727
- c.observe(document.documentElement, p);
728
- const g = n.closest('[data-component="theme-root"]');
729
- return g && c.observe(g, p), () => c.disconnect();
730
- }, [t, e]), o;
731
- }
732
- function Wt(e, { fill: t, ink: o, ring: a, target: n }) {
733
- var m;
734
- const r = Math.max(n, 20 + String(e).length * 12), c = `<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}"><rect x="1" y="1" width="${r - 2}" height="${n - 2}" rx="${n / 2}" fill="${t}" stroke="${a}" stroke-width="2"/></svg>`, p = (m = globalThis.google) == null ? void 0 : m.maps;
735
- return {
736
- icon: {
737
- url: `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(c)}`,
738
- scaledSize: p ? new p.Size(r, n) : void 0,
739
- anchor: p ? new p.Point(r / 2, n / 2) : void 0
740
- },
741
- label: { text: String(e), color: o, fontWeight: "600" }
742
- };
743
- }
744
- function qt({
745
- cluster: e,
746
- label: t,
747
- mapId: o,
748
- iconTheme: a,
749
- elements: n,
750
- onActivate: r
751
- }) {
752
- const [c, p] = $(null), g = `cluster:${e.id}`;
753
- C(() => {
754
- const l = ne(c);
755
- if (!l) return;
756
- const v = n.current;
757
- return v.set(g, l), l.style.outline = "none", () => {
758
- v.delete(g);
759
- };
760
- }, [c, n, g]);
761
- const m = e.members.length, s = P(
762
- () => o || !a ? null : Wt(m, a),
763
- [o, m, a]
764
- );
765
- return o ? /* @__PURE__ */ f(
766
- Ge,
767
- {
768
- ref: p,
769
- position: e.position,
770
- title: t,
771
- "aria-label": t,
772
- zIndex: Te,
773
- anchorPoint: ["50%", "50%"],
774
- onClick: () => r(e),
775
- children: /* @__PURE__ */ f(Ft, { count: m })
776
- }
777
- ) : /* @__PURE__ */ f(
778
- Pe,
779
- {
780
- position: e.position,
781
- title: t,
782
- zIndex: Te,
783
- icon: s == null ? void 0 : s.icon,
784
- label: s == null ? void 0 : s.label,
785
- onClick: () => r(e)
786
- }
787
- );
788
- }
789
- const Bt = 100, Kt = 30;
790
- function Xt({
791
- markers: e,
792
- fallbackZoom: t,
793
- selectedMarkerId: o,
794
- hoveredMarkerId: a,
795
- renderMarker: n,
796
- mapId: r,
797
- frame: c,
798
- elements: p,
799
- labelFor: g,
800
- onCameraMove: m,
801
- onClusterClick: s
802
- }) {
803
- const l = W(), { t: v } = q("ui"), h = Dt(t), i = Ut(!r), d = P(
804
- () => Et(e, h),
805
- [e, h]
806
- ), { singles: y, clusters: b } = P(() => {
807
- const w = (E) => E.id === o || E.id === a, z = d.singles.slice(), A = [];
808
- for (const E of d.clusters) {
809
- const R = E.members.filter((_) => !w(_));
810
- z.push(...E.members.filter(w)), R.length > 1 ? A.push({ ...E, members: R }) : z.push(...R);
811
- }
812
- return { singles: z, clusters: A };
813
- }, [d, o, a]), [x, T] = $(""), V = M(null), G = M(void 0);
814
- C(() => () => clearTimeout(G.current), []);
815
- const Z = (w) => {
816
- var L;
817
- const z = (L = l == null ? void 0 : l.getDiv) == null ? void 0 : L.call(l);
818
- if (!l || !(z instanceof Element)) return;
819
- const A = Math.min(
820
- me("--spacing-2xl", z, 48),
821
- z.clientWidth / 4,
822
- z.clientHeight / 4
823
- ), E = Ue(
824
- w.members.map((S) => S.position),
825
- z.clientWidth,
826
- z.clientHeight,
827
- A,
828
- ue
829
- ), R = l.getZoom() ?? h, _ = Math.min(
830
- ue,
831
- Math.max(E.zoom, Math.ceil(R + 1))
832
- ), I = w.members.length;
833
- V.current = {
834
- ids: new Set(w.members.map((S) => S.id)),
835
- centre: w.position
836
- }, T(""), clearTimeout(G.current), G.current = setTimeout(
837
- () => T(v("mapView.clusterZoomed", { label: g(I) })),
838
- Bt
839
- ), m(), s == null || s({
840
- count: I,
841
- markerIds: w.members.map((S) => S.id)
842
- }), l.moveCamera({ center: E.center, zoom: _ });
843
- };
844
- return C(() => {
845
- const w = V.current;
846
- if (!w) return;
847
- let z = 0, A = 0;
848
- const E = () => {
849
- let _ = null;
850
- for (const L of b) {
851
- if (!L.members.some((H) => w.ids.has(H.id)))
852
- continue;
853
- const S = (L.position.lat - w.centre.lat) ** 2 + (L.position.lng - w.centre.lng) ** 2;
854
- (!_ || S < _.distance) && (_ = { key: `cluster:${L.id}`, distance: S });
855
- }
856
- if (_) return _.key;
857
- const I = y.find((L) => w.ids.has(L.id));
858
- return I ? `pin:${I.id}` : null;
859
- }, R = () => {
860
- const _ = E(), I = _ ? p.current.get(_) : null;
861
- if (I && (I.focus({ preventScroll: !0 }), I.contains(document.activeElement))) {
862
- V.current = null;
863
- return;
864
- }
865
- if (A += 1, A < Kt && r) {
866
- z = requestAnimationFrame(R);
867
- return;
868
- }
869
- V.current = null;
870
- const L = c == null ? void 0 : c.closest('[data-component="map-view"]');
871
- L && (L.hasAttribute("tabindex") || L.setAttribute("tabindex", "-1"), L.focus({ preventScroll: !0 }));
872
- };
873
- return z = requestAnimationFrame(R), () => cancelAnimationFrame(z);
874
- }, [b, y, p, c, r]), /* @__PURE__ */ N(it, { children: [
875
- y.map(n),
876
- b.map((w) => /* @__PURE__ */ f(
877
- qt,
878
- {
879
- cluster: w,
880
- label: g(w.members.length),
881
- mapId: r,
882
- iconTheme: i,
883
- elements: p,
884
- onActivate: Z
885
- },
886
- `${Math.floor(h)}:${w.id}`
887
- )),
888
- c ? Ae(
889
- /* @__PURE__ */ f("div", { role: "status", "aria-live": "polite", className: "ds:sr-only", children: x }),
890
- c
891
- ) : null
892
- ] });
893
- }
894
- const qe = (e) => {
895
- var t, o;
896
- return typeof ((o = (t = globalThis.google) == null ? void 0 : t.maps) == null ? void 0 : o[e]) == "function";
897
- };
898
- function Ie() {
899
- const { t: e } = q("ui");
900
- return /* @__PURE__ */ N(
901
- "div",
902
- {
903
- role: "status",
904
- "data-testid": "map-view-loading",
905
- className: "ds:[inline-size:100%] ds:[block-size:100%]",
906
- children: [
907
- /* @__PURE__ */ f(pt, { variant: "rectangular", width: "100%", height: "100%" }),
908
- /* @__PURE__ */ f(De, { children: e("common.loading") })
909
- ]
910
- }
911
- );
912
- }
913
- function Ne({
914
- preview: e,
915
- onError: t
916
- }) {
917
- const { t: o } = q("ui");
918
- return /* @__PURE__ */ N(
919
- "div",
920
- {
921
- "data-testid": "map-view-loading",
922
- className: "ds:relative ds:[inline-size:100%] ds:[block-size:100%]",
923
- children: [
924
- /* @__PURE__ */ f(Be, { preview: e, onError: t }),
925
- /* @__PURE__ */ f("div", { role: "status", children: /* @__PURE__ */ f(De, { children: o("common.loading") }) })
926
- ]
927
- }
928
- );
929
- }
930
- function Be({
931
- preview: e,
932
- onError: t
933
- }) {
934
- return /* @__PURE__ */ f(
935
- "img",
936
- {
937
- src: e.src,
938
- srcSet: e.srcSet,
939
- alt: e.alt,
940
- width: e.width,
941
- height: e.height,
942
- loading: "lazy",
943
- decoding: "async",
944
- onError: t,
945
- "data-testid": "map-view-preview-image",
946
- className: "ds:block ds:[inline-size:100%] ds:[block-size:100%] ds:[object-fit:contain]"
947
- }
948
- );
949
- }
950
- function Ht({
951
- children: e,
952
- pending: t,
953
- holdUntilLoaded: o = !1
954
- }) {
955
- const a = mt();
956
- return Oe("maps") || qe("Map") || !a && !o ? e : t;
957
- }
958
- function Jt({ children: e }) {
959
- return Oe("marker") || qe("Marker") ? e : null;
960
- }
961
- function Ke(e, t) {
962
- Ve(() => {
963
- const o = e.current;
964
- return () => {
965
- t == null || t(!!(o && o.contains(document.activeElement)));
966
- };
967
- }, [e, t]);
968
- }
969
- function Yt({
970
- preview: e,
971
- onLoadMap: t,
972
- consentCta: o,
973
- onImageError: a,
974
- description: n,
975
- openInGoogleMapsHref: r,
976
- onUnmount: c
977
- }) {
978
- const { t: p } = q("ui"), g = Re(), m = M(null);
979
- return Ke(m, c), /* @__PURE__ */ N(
980
- "div",
981
- {
982
- ref: m,
983
- className: "ds:absolute ds:inset-0 ds:bg-[var(--muted)]",
984
- "data-testid": "map-view-preview",
985
- children: [
986
- /* @__PURE__ */ f(Be, { preview: e, onError: a }),
987
- /* @__PURE__ */ f("div", { className: "ds:absolute ds:start-0 ds:end-0 ds:top-[var(--map-preview-inset-block-start,var(--spacing-md))] ds:flex ds:justify-center ds:px-[var(--spacing-md)]", children: /* @__PURE__ */ N(
988
- "div",
989
- {
990
- "data-testid": "map-view-preview-plate",
991
- className: "ds:flex ds:max-w-[24rem] ds:flex-col ds:items-center ds:gap-[var(--spacing-xs)] ds:rounded-[var(--radius-lg)] ds:bg-[var(--background)] ds:p-[var(--spacing-sm)] ds:text-center ds:shadow-[var(--shadow-lg)]",
992
- children: [
993
- /* @__PURE__ */ f(
994
- "p",
995
- {
996
- id: g,
997
- className: "type-meta ds:m-0 ds:text-[var(--muted-foreground)]",
998
- children: n
999
- }
1000
- ),
1001
- /* @__PURE__ */ N("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:justify-center ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)]", children: [
1002
- o ?? /* @__PURE__ */ f(
1003
- Ze,
1004
- {
1005
- type: "button",
1006
- intent: "primary",
1007
- size: "lg",
1008
- onClick: t,
1009
- "aria-describedby": g,
1010
- "data-testid": "map-view-load-cta",
1011
- children: p("mapView.consentTitle")
1012
- }
1013
- ),
1014
- /* @__PURE__ */ N(
1015
- "a",
1016
- {
1017
- href: r,
1018
- target: "_blank",
1019
- rel: "noopener noreferrer",
1020
- className: "ds:inline-flex ds:min-h-[var(--min-target-size)] ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary-readable)] ds:underline ds:underline-offset-2",
1021
- children: [
1022
- p("mapView.openInGoogleMaps"),
1023
- /* @__PURE__ */ f(je, { "aria-hidden": "true", className: "ds:size-3" })
1024
- ]
1025
- }
1026
- )
1027
- ] })
1028
- ]
1029
- }
1030
- ) })
1031
- ]
1032
- }
1033
- );
1034
- }
1035
- function $e({
1036
- address: e,
1037
- contentLang: t,
1038
- description: o,
1039
- onLoadMap: a,
1040
- openInGoogleMapsHref: n,
1041
- consentCta: r,
1042
- onUnmount: c
1043
- }) {
1044
- const { t: p } = q("ui"), g = M(null);
1045
- return Ke(g, c), /* @__PURE__ */ N(
1046
- "div",
1047
- {
1048
- ref: g,
1049
- className: St(),
1050
- "data-testid": "map-view-consent",
1051
- children: [
1052
- /* @__PURE__ */ f(
1053
- ht,
1054
- {
1055
- "aria-hidden": "true",
1056
- className: "ds:size-6 ds:text-[var(--muted-foreground)]"
1057
- }
1058
- ),
1059
- /* @__PURE__ */ f("p", { className: Ct(), children: p("mapView.consentTitle") }),
1060
- e ? /* @__PURE__ */ f(
1061
- "p",
1062
- {
1063
- className: _e(),
1064
- "data-testid": "map-view-address",
1065
- lang: t,
1066
- children: e
1067
- }
1068
- ) : null,
1069
- /* @__PURE__ */ f("p", { className: _e(), children: o }),
1070
- /* @__PURE__ */ N(
1071
- "div",
1072
- {
1073
- className: "ds:flex ds:gap-[var(--spacing-sm)] ds:flex-wrap ds:items-center ds:justify-center",
1074
- "data-testid": "map-view-consent-actions",
1075
- children: [
1076
- r ?? /* @__PURE__ */ f(
1077
- Ze,
1078
- {
1079
- type: "button",
1080
- intent: "primary",
1081
- size: "sm",
1082
- onClick: a,
1083
- "data-testid": "map-view-load-cta",
1084
- children: p("mapView.consentCta")
1085
- }
1086
- ),
1087
- /* @__PURE__ */ N(
1088
- "a",
1089
- {
1090
- href: n,
1091
- target: "_blank",
1092
- rel: "noopener noreferrer",
1093
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-2xs)] ds:text-[var(--primary-readable)] ds:underline ds:underline-offset-2",
1094
- children: [
1095
- p("mapView.openInGoogleMaps"),
1096
- /* @__PURE__ */ f(je, { "aria-hidden": "true", className: "ds:size-3" })
1097
- ]
1098
- }
1099
- )
1100
- ]
1101
- }
1102
- )
1103
- ]
1104
- }
1105
- );
1106
- }
1107
- const Qt = at(
1108
- ({
1109
- id: e,
1110
- apiKey: t,
1111
- center: o,
1112
- zoom: a = 15,
1113
- markers: n,
1114
- selectedMarkerId: r,
1115
- hoveredMarkerId: c,
1116
- renderMarkerCard: p,
1117
- onMarkerHover: g,
1118
- onMarkerClick: m,
1119
- onBoundsChange: s,
1120
- consentGranted: l = !1,
1121
- onConsentRequest: v,
1122
- staticPreview: h,
1123
- address: i,
1124
- contentLang: d,
1125
- consentDescription: y,
1126
- consentCta: b,
1127
- mapId: x,
1128
- size: T,
1129
- surface: V,
1130
- ariaLabel: G,
1131
- fitToPoints: Z,
1132
- fitKey: w,
1133
- fitMaxZoom: z = 15,
1134
- clusterMarkers: A = "auto",
1135
- clusterLabel: E,
1136
- onClusterClick: R,
1137
- className: _,
1138
- ...I
1139
- }, L) => {
1140
- const { t: S, i18n: H } = q("ui"), pe = M(/* @__PURE__ */ new Map()), J = P(() => Z ?? [], [Z]), Xe = P(
1141
- () => w ?? J.map((u) => `${We(u)}@${u.lat},${u.lng}`).sort().join("|"),
1142
- [w, J]
1143
- ), j = J.length > 0, fe = M(j), ge = Re(), He = P(
1144
- () => `map-${ge.replace(/[^a-zA-Z0-9-_]/g, "")}`,
1145
- [ge]
1146
- ), [he, Je] = $(!1);
1147
- C(() => {
1148
- if (typeof window > "u") return;
1149
- const u = window.matchMedia("(prefers-reduced-motion: reduce)"), k = () => Je(u.matches);
1150
- return k(), u.addEventListener("change", k), () => u.removeEventListener("change", k);
1151
- }, []);
1152
- const se = P(() => `https://www.google.com/maps/search/?api=1&query=${i ? encodeURIComponent(i) : `${o.lat},${o.lng}`}`, [i, o.lat, o.lng]), O = M(null), ve = M({
1153
- pendingInput: !1,
1154
- moved: !1,
1155
- programmatic: !1
1156
- }), B = D(() => {
1157
- ve.current = {
1158
- pendingInput: !1,
1159
- moved: !1,
1160
- programmatic: !0
1161
- };
1162
- }, []), Y = D(
1163
- (u) => {
1164
- B(), m == null || m(u);
1165
- },
1166
- [B, m]
1167
- ), [be, Ye] = $(null), re = P(
1168
- () => c != null && p ? (n ?? []).find((u) => u.id === c) ?? null : null,
1169
- [c, p, n]
1170
- ), Qe = D((u) => {
1171
- O.current = u;
1172
- }, []), ye = M(!1), we = M(null), ke = M(0), Q = D(
1173
- () => ({
1174
- panTo: (u) => {
1175
- var k;
1176
- return (k = O.current) == null ? void 0 : k.panTo(u);
1177
- },
1178
- setZoom: (u) => {
1179
- var k;
1180
- return (k = O.current) == null ? void 0 : k.setZoom(u);
1181
- },
1182
- selectMarker: (u) => {
1183
- var k;
1184
- return (k = O.current) == null ? void 0 : k.selectMarker(u);
1185
- },
1186
- // Without `isConsentGranted` an agent has no way to learn that
1187
- // its pan / zoom / select was swallowed by the GDPR gate rather
1188
- // than applied: under the default (`consentGranted={false}`) the
1189
- // whole Maps subtree is unmounted and every action optional-chains
1190
- // into nothing.
1191
- isConsentGranted: () => ye.current,
1192
- getCenter: () => {
1193
- var u;
1194
- return ((u = O.current) == null ? void 0 : u.getCenter()) ?? null;
1195
- },
1196
- getZoom: () => {
1197
- var u;
1198
- return ((u = O.current) == null ? void 0 : u.getZoom()) ?? null;
1199
- },
1200
- getSelectedMarkerId: () => we.current,
1201
- getMarkerCount: () => ke.current
1202
- }),
1203
- []
1204
- );
1205
- ct(L, Q, [Q]);
1206
- const et = P(
1207
- () => Q(),
1208
- [Q]
1209
- );
1210
- gt(vt, et, e), C(() => {
1211
- var k, U;
1212
- const u = fe.current && !j;
1213
- if (fe.current = j, !j) {
1214
- if (u) {
1215
- (k = O.current) == null || k.jumpTo(o, a);
1216
- return;
1217
- }
1218
- he || (U = O.current) == null || U.panTo(o);
1219
- }
1220
- }, [o.lat, o.lng, he, j]), C(() => {
1221
- var u;
1222
- j || (u = O.current) == null || u.setZoom(a);
1223
- }, [a, j]);
1224
- const [tt, Me] = $(!1), ee = l || tt;
1225
- ye.current = ee, we.current = r ?? null, ke.current = (n ?? []).length;
1226
- const [nt, ot] = $(null), F = h && h.src !== nt ? h : void 0, ie = h == null ? void 0 : h.src, ae = D(() => {
1227
- ie && ot(ie);
1228
- }, [ie]), xe = M(null), ce = M(!1), le = M(!1), Ee = D((u) => {
1229
- le.current = u;
1230
- }, []);
1231
- C(() => {
1232
- var K;
1233
- if (!ee) return;
1234
- const u = document.activeElement, k = !u || u === document.body, U = ce.current || le.current && k;
1235
- ce.current = !1, le.current = !1, U && ((K = xe.current) == null || K.focus({ preventScroll: !0 }));
1236
- }, [ee]);
1237
- const ze = D(() => {
1238
- if (ce.current = !0, v) {
1239
- v(), Me(!0);
1240
- return;
1241
- }
1242
- Me(!0);
1243
- }, [v]), Le = (u) => {
1244
- const k = r != null && r === u.id, U = c != null && c === u.id, K = S("mapView.markerLabel", {
1245
- label: u.label ?? u.id
1246
- });
1247
- return x ? /* @__PURE__ */ f(
1248
- At,
1249
- {
1250
- marker: u,
1251
- label: K,
1252
- isSelected: k,
1253
- isHovered: U,
1254
- onSelect: Y,
1255
- onHover: g,
1256
- elements: pe
1257
- },
1258
- u.id
1259
- ) : /* @__PURE__ */ f(
1260
- Pe,
1261
- {
1262
- position: u.position,
1263
- title: K,
1264
- zIndex: U ? 1e3 : k ? 500 : void 0,
1265
- onClick: () => Y(u.id),
1266
- onMouseOver: g ? () => g(u.id, !0, "pointer") : void 0,
1267
- onMouseOut: g ? () => g(u.id, !1, "pointer") : void 0
1268
- },
1269
- u.id
1270
- );
1271
- }, st = D(
1272
- (u) => typeof E == "function" ? E(u) : typeof E == "string" ? E.replaceAll("{count}", String(u)) : S("mapView.clusterLabel", { count: u }),
1273
- [E, S]
1274
- ), rt = xt(A, (n ?? []).length);
1275
- return /* @__PURE__ */ f(
1276
- "div",
1277
- {
1278
- ref: xe,
1279
- className: zt({ size: T, surface: V, className: _ }),
1280
- "data-component": "map-view",
1281
- "data-component-id": e ?? He,
1282
- role: "region",
1283
- "aria-label": G ?? S("mapView.label"),
1284
- tabIndex: -1,
1285
- ...I,
1286
- children: /* @__PURE__ */ f(
1287
- "div",
1288
- {
1289
- ref: Ye,
1290
- className: Lt({ size: T, className: "ds:relative" }),
1291
- children: ee ? (
1292
- // A provider failure shows the consent placeholder (its "Open in
1293
- // Google Maps" link needs no script) with "Load map" as the
1294
- // retry, instead of unmounting the host's React tree. The gate
1295
- // starts the provider only once Google's `core` and `maps`
1296
- // libraries have arrived.
1297
- /* @__PURE__ */ f(
1298
- ft,
1299
- {
1300
- fallback: ({ reset: u }) => /* @__PURE__ */ f(
1301
- $e,
1302
- {
1303
- address: i,
1304
- contentLang: d,
1305
- description: y ?? S("mapView.consentDescription"),
1306
- onLoadMap: u,
1307
- consentCta: void 0,
1308
- openInGoogleMapsHref: se
1309
- }
1310
- ),
1311
- children: /* @__PURE__ */ f(
1312
- lt,
1313
- {
1314
- libraries: ["maps"],
1315
- pending: F ? /* @__PURE__ */ f(
1316
- Ne,
1317
- {
1318
- preview: F,
1319
- onError: ae
1320
- }
1321
- ) : /* @__PURE__ */ f(Ie, {}),
1322
- children: /* @__PURE__ */ f(
1323
- dt,
1324
- {
1325
- apiKey: t,
1326
- language: H.language,
1327
- children: /* @__PURE__ */ f(
1328
- Ht,
1329
- {
1330
- holdUntilLoaded: !!F,
1331
- pending: F ? /* @__PURE__ */ f(
1332
- Ne,
1333
- {
1334
- preview: F,
1335
- onError: ae
1336
- }
1337
- ) : /* @__PURE__ */ f(Ie, {}),
1338
- children: /* @__PURE__ */ N(
1339
- ut,
1340
- {
1341
- defaultCenter: o,
1342
- defaultZoom: a,
1343
- mapId: x,
1344
- gestureHandling: "cooperative",
1345
- disableDefaultUI: !1,
1346
- onClick: () => Y(null),
1347
- className: "ds:[inline-size:100%] ds:[block-size:100%]",
1348
- children: [
1349
- /* @__PURE__ */ f(
1350
- _t,
1351
- {
1352
- onHandleReady: Qe,
1353
- onMarkerSelect: Y,
1354
- onCameraMove: B
1355
- }
1356
- ),
1357
- s ? /* @__PURE__ */ f(
1358
- Tt,
1359
- {
1360
- onBoundsChange: s,
1361
- userInteraction: ve
1362
- }
1363
- ) : null,
1364
- Z ? /* @__PURE__ */ f(
1365
- Zt,
1366
- {
1367
- points: J,
1368
- fitKey: Xe,
1369
- maxZoom: z,
1370
- onCameraMove: B
1371
- }
1372
- ) : null,
1373
- re && p ? /* @__PURE__ */ f(
1374
- Nt,
1375
- {
1376
- marker: re,
1377
- frame: be,
1378
- direction: H.dir(),
1379
- children: p(re.id)
1380
- }
1381
- ) : null,
1382
- /* @__PURE__ */ f(Jt, { children: rt ? /* @__PURE__ */ f(
1383
- Xt,
1384
- {
1385
- markers: n ?? [],
1386
- fallbackZoom: a,
1387
- selectedMarkerId: r ?? null,
1388
- hoveredMarkerId: c ?? null,
1389
- renderMarker: Le,
1390
- mapId: !!x,
1391
- frame: be,
1392
- elements: pe,
1393
- labelFor: st,
1394
- onCameraMove: B,
1395
- onClusterClick: R
1396
- }
1397
- ) : (n ?? []).map(Le) })
1398
- ]
1399
- }
1400
- )
1401
- }
1402
- )
1403
- }
1404
- )
1405
- }
1406
- )
1407
- }
1408
- )
1409
- ) : F ? /* @__PURE__ */ f(
1410
- Yt,
1411
- {
1412
- preview: F,
1413
- onLoadMap: ze,
1414
- consentCta: b,
1415
- onImageError: ae,
1416
- description: y ?? S("mapView.consentDescription"),
1417
- openInGoogleMapsHref: se,
1418
- onUnmount: Ee
1419
- }
1420
- ) : /* @__PURE__ */ f(
1421
- $e,
1422
- {
1423
- address: i,
1424
- contentLang: d,
1425
- description: y ?? S("mapView.consentDescription"),
1426
- onLoadMap: ze,
1427
- consentCta: b,
1428
- openInGoogleMapsHref: se,
1429
- onUnmount: Ee
1430
- }
1431
- )
1432
- }
1433
- )
1434
- }
1435
- );
1436
- }
1437
- );
1438
- Qt.displayName = "MapView";
1439
- export {
1440
- Qt as M,
1441
- Ce as i
1442
- };
1443
- //# sourceMappingURL=map-view-CHeGd94F.js.map