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