@alfadocs/ui-kit-debug 1.99.0 → 1.100.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.
@@ -1,34 +1,34 @@
1
1
  import { jsx as t, jsxs as x } from "react/jsx-runtime";
2
- import { forwardRef as Ae, useRef as E, useState as J, useEffect as q, useLayoutEffect as We, useMemo as le, useImperativeHandle as Pe, createContext as Qe, useCallback as Z, useId as Se, useContext as Fe } from "react";
3
- import { c as H } from "./index-D2ZczOXr.js";
4
- import { useTranslation as D } from "react-i18next";
2
+ import { forwardRef as Ae, useRef as C, useState as Z, useEffect as H, useLayoutEffect as We, useMemo as ue, useImperativeHandle as Pe, createContext as Qe, useCallback as ee, useId as Se, useContext as Fe } from "react";
3
+ import { c as $ } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as B } from "react-i18next";
5
5
  import { A as ke } from "./autocomplete-D10ydpgi.js";
6
6
  import { B as Ie } from "./button-DohK_Ak_.js";
7
- import { C as ee } from "./card-C85_Ndhb.js";
8
- import { S as De } from "./slider-pZ95bEm7.js";
9
- import { A as ye } from "./alert-9kEwDza3.js";
10
- import { D as Y } from "./dropdown-menu-CqxBthww.js";
11
- import { u as Ve } from "./registry-DvAUVLHh.js";
7
+ import { C as te } from "./card-C85_Ndhb.js";
8
+ import { S as Ve } from "./slider-pZ95bEm7.js";
9
+ import { a as Oe } from "./toast-BNoN8Qjh.js";
10
+ import { D as J } from "./dropdown-menu-CqxBthww.js";
11
+ import { u as Be } from "./registry-DvAUVLHh.js";
12
12
  import { S as Ne } from "./search-QbWPlY5f.js";
13
13
  import { X as Ce } from "./x-B5YnXwCz.js";
14
- import { c as Oe } from "./createLucideIcon-DhHxpK9K.js";
15
- import { M as Be } from "./map-pin-BaY37-Km.js";
16
- import { S as Ke } from "./stethoscope-sZXGC43m.js";
17
- import { C as ze } from "./chevron-down-DWE7GSq9.js";
14
+ import { c as De } from "./createLucideIcon-DhHxpK9K.js";
15
+ import { M as Ke } from "./map-pin-BaY37-Km.js";
16
+ import { S as ze } from "./stethoscope-sZXGC43m.js";
17
+ import { C as Me } from "./chevron-down-DWE7GSq9.js";
18
18
  /**
19
19
  * @license lucide-react v1.22.0 - ISC
20
20
  *
21
21
  * This source code is licensed under the ISC license.
22
22
  * See the LICENSE file in the root directory of this source tree.
23
23
  */
24
- const Me = [
24
+ const qe = [
25
25
  ["line", { x1: "2", x2: "5", y1: "12", y2: "12", key: "bvdh0s" }],
26
26
  ["line", { x1: "19", x2: "22", y1: "12", y2: "12", key: "1tbv5k" }],
27
27
  ["line", { x1: "12", x2: "12", y1: "2", y2: "5", key: "11lu5j" }],
28
28
  ["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }],
29
29
  ["circle", { cx: "12", cy: "12", r: "7", key: "fim9np" }],
30
30
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
31
- ], qe = Oe("locate-fixed", Me), He = {
31
+ ], He = De("locate-fixed", qe), $e = {
32
32
  id: "patient-search",
33
33
  // `filter` is the conceptual capability of this search widget. Building the
34
34
  // actual query (WHO/WHERE/WHEN/facets/geo) is host-delegated: selection is
@@ -87,20 +87,20 @@ function S(e, r) {
87
87
  } catch {
88
88
  }
89
89
  }
90
- const K = [
90
+ const M = [
91
91
  "today",
92
92
  "tomorrow",
93
93
  "this_week",
94
94
  "anytime"
95
- ], $ = [1, 5, 10, 25, 50], ue = 5, Re = 200;
96
- function $e(e) {
95
+ ], U = [1, 5, 10, 25, 50], fe = 5, Re = 200;
96
+ function Ue(e) {
97
97
  let r = 0, a = Number.POSITIVE_INFINITY;
98
- return $.forEach((o, p) => {
99
- const i = Math.abs(o - e);
100
- i < a && (a = i, r = p);
98
+ return U.forEach((i, p) => {
99
+ const c = Math.abs(i - e);
100
+ c < a && (a = c, r = p);
101
101
  }), r;
102
102
  }
103
- const Ue = H(
103
+ const Ge = $(
104
104
  "ds:flex ds:w-full ds:flex-col ds:text-[var(--foreground)]",
105
105
  {
106
106
  variants: {
@@ -115,61 +115,61 @@ const Ue = H(
115
115
  }
116
116
  ), Ee = Qe(null);
117
117
  function Le(e) {
118
- const r = Fe(Ee), a = E(!1);
118
+ const r = Fe(Ee), a = C(!1);
119
119
  return r ? r[e] : a;
120
120
  }
121
- function te({
121
+ function re({
122
122
  value: e,
123
123
  onChange: r,
124
124
  loadObjects: a,
125
- onObjectSelect: o,
125
+ onObjectSelect: i,
126
126
  inputRef: p,
127
- query: i,
128
- onQueryChange: v
127
+ query: c,
128
+ onQueryChange: g
129
129
  }) {
130
- var m, u, c;
131
- const { t: h } = D("ui"), d = E((m = e.object) == null ? void 0 : m.value);
132
- q(() => {
133
- var l, y, g;
134
- ((l = e.object) == null ? void 0 : l.value) !== d.current && (d.current = (y = e.object) == null ? void 0 : y.value, v(((g = e.object) == null ? void 0 : g.label) ?? ""));
135
- }, [(u = e.object) == null ? void 0 : u.value, (c = e.object) == null ? void 0 : c.label, v]);
136
- const s = Z(
137
- async (l, { signal: y }) => await a(l, { signal: y }),
130
+ var f, b, l;
131
+ const { t: h } = B("ui"), d = C((f = e.object) == null ? void 0 : f.value);
132
+ H(() => {
133
+ var o, y, m;
134
+ ((o = e.object) == null ? void 0 : o.value) !== d.current && (d.current = (y = e.object) == null ? void 0 : y.value, g(((m = e.object) == null ? void 0 : m.label) ?? ""));
135
+ }, [(b = e.object) == null ? void 0 : b.value, (l = e.object) == null ? void 0 : l.label, g]);
136
+ const n = ee(
137
+ async (o, { signal: y }) => await a(o, { signal: y }),
138
138
  [a]
139
- ), f = (l) => {
139
+ ), u = (o) => {
140
140
  const y = {
141
- value: l.value,
142
- label: l.label,
143
- description: l.description,
144
- __payload: l.__payload
141
+ value: o.value,
142
+ label: o.label,
143
+ description: o.description,
144
+ __payload: o.__payload
145
145
  };
146
- v(y.label), d.current = y.value, r({ ...e, object: y }), S("patient_search_object_selected", {
146
+ g(y.label), d.current = y.value, r({ ...e, object: y }), S("patient_search_object_selected", {
147
147
  value: y.value,
148
148
  type: y.__payload && typeof y.__payload == "object" ? y.__payload.type : void 0
149
- }), o == null || o(y);
150
- }, n = Le("who");
149
+ }), i == null || i(y);
150
+ }, s = Le("who");
151
151
  return /* @__PURE__ */ t(
152
152
  "div",
153
153
  {
154
154
  "data-component": "patient-search-field",
155
155
  "data-field": "who",
156
156
  onFocus: () => {
157
- n.current || (n.current = !0, S("patient_search_object_focused"));
157
+ s.current || (s.current = !0, S("patient_search_object_focused"));
158
158
  },
159
- onBlur: (l) => {
160
- l.currentTarget && !l.currentTarget.contains(l.relatedTarget) && (n.current = !1);
159
+ onBlur: (o) => {
160
+ o.currentTarget && !o.currentTarget.contains(o.relatedTarget) && (s.current = !1);
161
161
  },
162
162
  children: /* @__PURE__ */ t(
163
163
  ke,
164
164
  {
165
165
  ref: p,
166
166
  size: "lg",
167
- value: i,
168
- onChange: (l) => {
169
- v(l), e.object && l !== e.object.label && (d.current = void 0, r({ ...e, object: void 0 }));
167
+ value: c,
168
+ onChange: (o) => {
169
+ g(o), e.object && o !== e.object.label && (d.current = void 0, r({ ...e, object: void 0 }));
170
170
  },
171
- onSelect: f,
172
- loadOptions: s,
171
+ onSelect: u,
172
+ loadOptions: n,
173
173
  debounceMs: Re,
174
174
  placeholder: h("patientSearch.who.placeholder"),
175
175
  "aria-label": h("patientSearch.who.label"),
@@ -191,80 +191,81 @@ const we = [
191
191
  "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
192
192
  "ds:forced-colors:focus-visible:outline-[CanvasText]"
193
193
  ].join(" ");
194
- function re({
194
+ function ae({
195
195
  value: e,
196
196
  onChange: r,
197
197
  loadPlaces: a,
198
- onPlaceSelect: o,
198
+ onPlaceSelect: i,
199
199
  allowTypedPlace: p,
200
- inputRef: i,
201
- defaultRadiusKm: v = ue,
200
+ inputRef: c,
201
+ defaultRadiusKm: g = fe,
202
202
  reverseGeocode: h,
203
- query: d,
204
- onQueryChange: s
203
+ geoHint: d,
204
+ query: n,
205
+ onQueryChange: u
205
206
  }) {
206
- var M, I, V;
207
- const { t: f } = D("ui"), n = E((M = e.place) == null ? void 0 : M.value), m = e.geo ? "granted" : "pristine", [u, c] = J(m);
208
- q(() => {
207
+ var q, O, D;
208
+ const { t: s } = B("ui"), f = C((q = e.place) == null ? void 0 : q.value), b = e.geo ? "granted" : "pristine", [l, o] = Z(b);
209
+ H(() => {
209
210
  var w, _, T;
210
- ((w = e.place) == null ? void 0 : w.value) !== n.current && (n.current = (_ = e.place) == null ? void 0 : _.value, s(((T = e.place) == null ? void 0 : T.label) ?? ""));
211
- }, [(I = e.place) == null ? void 0 : I.value, (V = e.place) == null ? void 0 : V.label, s]);
212
- const l = Z(
211
+ ((w = e.place) == null ? void 0 : w.value) !== f.current && (f.current = (_ = e.place) == null ? void 0 : _.value, u(((T = e.place) == null ? void 0 : T.label) ?? ""));
212
+ }, [(O = e.place) == null ? void 0 : O.value, (D = e.place) == null ? void 0 : D.label, u]);
213
+ const y = ee(
213
214
  async (w, { signal: _ }) => await a(w, { signal: _ }),
214
215
  [a]
215
- ), y = (w) => {
216
+ ), m = (w) => {
216
217
  const _ = {
217
218
  value: w.value,
218
219
  label: w.label,
219
220
  lat: w.lat,
220
221
  lng: w.lng
221
222
  };
222
- s(_.label), n.current = _.value, r({ ...e, place: _, geo: void 0 }), u === "granted" && c("pristine"), S("patient_search_place_selected", { value: _.value }), o == null || o(_);
223
- }, g = () => {
223
+ u(_.label), f.current = _.value, r({ ...e, place: _, geo: void 0 }), l === "granted" && o("pristine"), S("patient_search_place_selected", { value: _.value }), i == null || i(_);
224
+ }, j = (w) => {
225
+ o("pristine"), Oe(s("patientSearch.geo.denied")), S("patient_search_geo_denied", { reason: w });
226
+ }, R = () => {
224
227
  if (typeof window > "u" || !(navigator != null && navigator.geolocation)) {
225
- c("denied"), S("patient_search_geo_denied", { reason: "unsupported" });
228
+ j("unsupported");
226
229
  return;
227
230
  }
228
- c("requesting"), S("patient_search_place_focused"), navigator.geolocation.getCurrentPosition(
231
+ o("requesting"), S("patient_search_place_focused"), navigator.geolocation.getCurrentPosition(
229
232
  async (w) => {
230
233
  const { latitude: _, longitude: T } = w.coords;
231
- let Q;
234
+ let F;
232
235
  try {
233
- Q = await (h == null ? void 0 : h(_, T));
236
+ F = await (h == null ? void 0 : h(_, T));
234
237
  } catch {
235
- Q = void 0;
238
+ F = void 0;
236
239
  }
237
- const N = v, U = Q ?? f("patientSearch.geo.fallbackLabel"), G = {
240
+ const N = g, G = F ?? s("patientSearch.geo.fallbackLabel"), X = {
238
241
  value: `geo:${_.toFixed(4)},${T.toFixed(4)}`,
239
- label: U,
242
+ label: G,
240
243
  lat: _,
241
244
  lng: T
242
245
  };
243
246
  r({
244
247
  ...e,
245
- place: G,
248
+ place: X,
246
249
  geo: {
247
250
  lat: _,
248
251
  lng: T,
249
252
  radiusKm: N,
250
- label: U
253
+ label: G
251
254
  }
252
- }), c("granted"), S("patient_search_geo_granted", { radiusKm: N });
253
- },
254
- () => {
255
- c("denied"), S("patient_search_geo_denied", { reason: "user" });
255
+ }), o("granted"), S("patient_search_geo_granted", { radiusKm: N });
256
256
  },
257
+ () => j("user"),
257
258
  { enableHighAccuracy: !1, maximumAge: 6e4, timeout: 1e4 }
258
259
  );
259
- }, j = () => {
260
- r({ ...e, geo: void 0, place: void 0 }), s(""), n.current = void 0, c("pristine");
261
- }, k = u === "granted" && !!e.geo, C = u === "requesting", R = u === "denied", W = Le("where"), ne = R || !!!h ? null : /* @__PURE__ */ x("span", { className: "ds:absolute ds:end-[var(--spacing-xs)] ds:top-1/2 ds:-translate-y-1/2 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
260
+ }, E = () => {
261
+ r({ ...e, geo: void 0, place: void 0 }), u(""), f.current = void 0, o("pristine");
262
+ }, k = l === "granted" && !!e.geo, W = l === "requesting", P = Le("where"), V = !!h, oe = V ? /* @__PURE__ */ x("span", { className: "ds:absolute ds:end-[var(--spacing-xs)] ds:top-1/2 ds:-translate-y-1/2 ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]", children: [
262
263
  k ? /* @__PURE__ */ t(
263
264
  "button",
264
265
  {
265
266
  type: "button",
266
- "aria-label": f("patientSearch.geo.clear"),
267
- onClick: j,
267
+ "aria-label": s("patientSearch.geo.clear"),
268
+ onClick: E,
268
269
  className: we,
269
270
  children: /* @__PURE__ */ t(Ce, { "aria-hidden": "true", className: "ds:size-4" })
270
271
  }
@@ -273,25 +274,25 @@ function re({
273
274
  "button",
274
275
  {
275
276
  type: "button",
276
- "aria-label": f("patientSearch.geo.cta"),
277
+ "aria-label": s("patientSearch.geo.cta"),
277
278
  "aria-pressed": k || void 0,
278
- disabled: C,
279
- onClick: k ? j : g,
279
+ disabled: W,
280
+ onClick: k ? E : R,
280
281
  className: we,
281
- children: /* @__PURE__ */ t(qe, { "aria-hidden": "true", className: "ds:size-4" })
282
+ children: /* @__PURE__ */ t(He, { "aria-hidden": "true", className: "ds:size-4" })
282
283
  }
283
284
  )
284
- ] });
285
+ ] }) : null;
285
286
  return /* @__PURE__ */ x(
286
287
  "div",
287
288
  {
288
289
  "data-component": "patient-search-field",
289
290
  "data-field": "where",
290
291
  onFocus: () => {
291
- W.current || (W.current = !0, S("patient_search_place_focused"));
292
+ P.current || (P.current = !0, S("patient_search_place_focused"));
292
293
  },
293
294
  onBlur: (w) => {
294
- w.currentTarget && !w.currentTarget.contains(w.relatedTarget) && (W.current = !1);
295
+ w.currentTarget && !w.currentTarget.contains(w.relatedTarget) && (P.current = !1);
295
296
  },
296
297
  className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
297
298
  children: [
@@ -299,24 +300,24 @@ function re({
299
300
  /* @__PURE__ */ t(
300
301
  ke,
301
302
  {
302
- ref: i,
303
+ ref: c,
303
304
  size: "lg",
304
- value: d,
305
+ value: n,
305
306
  onChange: (w) => {
306
307
  var _, T;
307
- if (s(w), (p || e.place) && w !== ((_ = e.place) == null ? void 0 : _.label)) {
308
- const Q = w.trim(), N = p && Q ? { value: `text:${Q}`, label: Q } : void 0;
309
- if (n.current = N == null ? void 0 : N.value, (N == null ? void 0 : N.value) === ((T = e.place) == null ? void 0 : T.value) && !e.geo) return;
310
- r({ ...e, place: N, geo: void 0 }), u === "granted" && c("pristine");
308
+ if (u(w), (p || e.place) && w !== ((_ = e.place) == null ? void 0 : _.label)) {
309
+ const F = w.trim(), N = p && F ? { value: `text:${F}`, label: F } : void 0;
310
+ if (f.current = N == null ? void 0 : N.value, (N == null ? void 0 : N.value) === ((T = e.place) == null ? void 0 : T.value) && !e.geo) return;
311
+ r({ ...e, place: N, geo: void 0 }), l === "granted" && o("pristine");
311
312
  }
312
313
  },
313
- onSelect: y,
314
- loadOptions: l,
314
+ onSelect: m,
315
+ loadOptions: y,
315
316
  debounceMs: Re,
316
- placeholder: f("patientSearch.where.placeholder"),
317
- "aria-label": f("patientSearch.where.label"),
318
- startAdornment: /* @__PURE__ */ t(Be, { "aria-hidden": "true" }),
319
- endAdornment: R ? void 0 : (
317
+ placeholder: s("patientSearch.where.placeholder"),
318
+ "aria-label": s("patientSearch.where.label"),
319
+ startAdornment: /* @__PURE__ */ t(Ke, { "aria-hidden": "true" }),
320
+ endAdornment: (
320
321
  // Decorative spacer — reserves inline-end room so the typed
321
322
  // text doesn't run under the absolutely-positioned overlay.
322
323
  // Autocomplete wraps endAdornment in `aria-hidden`, which is
@@ -332,36 +333,38 @@ function re({
332
333
  )
333
334
  }
334
335
  ),
335
- ne
336
+ oe
336
337
  ] }),
337
- R ? (
338
- // Alert defaults to `role="status"` + `aria-live="polite"` for the
339
- // `info` variant — the user hears why the field reverted to plain
340
- // text when their browser blocked the geolocation prompt.
341
- /* @__PURE__ */ t(ye, { variant: "info", children: /* @__PURE__ */ t(ye.Description, { children: f("patientSearch.geo.denied") }) })
338
+ V && d ? /* @__PURE__ */ t(
339
+ "p",
340
+ {
341
+ "data-component": "patient-search-geo-hint",
342
+ className: "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]",
343
+ children: d
344
+ }
342
345
  ) : null
343
346
  ]
344
347
  }
345
348
  );
346
349
  }
347
- function ae({
350
+ function se({
348
351
  value: e,
349
352
  onChange: r,
350
- defaultRadiusKm: a = ue
353
+ defaultRadiusKm: a = fe
351
354
  }) {
352
- const { t: o } = D("ui"), [p, i] = J(
355
+ const { t: i } = B("ui"), [p, c] = Z(
353
356
  () => {
354
357
  var d;
355
- return $e(((d = e.geo) == null ? void 0 : d.radiusKm) ?? a);
358
+ return Ue(((d = e.geo) == null ? void 0 : d.radiusKm) ?? a);
356
359
  }
357
360
  );
358
361
  if (!e.geo) return null;
359
- const v = (d) => {
360
- const s = $[d] ?? a;
361
- r({ ...e, geo: { ...e.geo, radiusKm: s } }), S("patient_search_radius_changed", { radiusKm: s });
362
+ const g = (d) => {
363
+ const n = U[d] ?? a;
364
+ r({ ...e, geo: { ...e.geo, radiusKm: n } }), S("patient_search_radius_changed", { radiusKm: n });
362
365
  }, h = (d) => {
363
- const s = $[Math.round(d)] ?? a;
364
- return o("patientSearch.geo.radiusFormat", { km: s });
366
+ const n = U[Math.round(d)] ?? a;
367
+ return i("patientSearch.geo.radiusFormat", { km: n });
365
368
  };
366
369
  return /* @__PURE__ */ x(
367
370
  "div",
@@ -374,32 +377,32 @@ function ae({
374
377
  {
375
378
  id: "patient-search-radius-label",
376
379
  className: "type-meta ds:text-[color:var(--muted-foreground)]",
377
- children: o("patientSearch.geo.radius")
380
+ children: i("patientSearch.geo.radius")
378
381
  }
379
382
  ),
380
383
  /* @__PURE__ */ t(
381
- De,
384
+ Ve,
382
385
  {
383
386
  value: [p],
384
387
  min: 0,
385
- max: $.length - 1,
388
+ max: U.length - 1,
386
389
  step: 1,
387
- marks: $.map((d, s) => ({
388
- value: s,
390
+ marks: U.map((d, n) => ({
391
+ value: n,
389
392
  label: `${d}`
390
393
  })),
391
394
  formatValue: h,
392
395
  alwaysShowValue: !0,
393
396
  "aria-labelledby": "patient-search-radius-label",
394
- onValueChange: (d) => i(d[0] ?? 0),
395
- onValueCommit: (d) => v(d[0] ?? 0)
397
+ onValueChange: (d) => c(d[0] ?? 0),
398
+ onValueCommit: (d) => g(d[0] ?? 0)
396
399
  }
397
400
  )
398
401
  ]
399
402
  }
400
403
  );
401
404
  }
402
- const Ge = H(
405
+ const Xe = $(
403
406
  [
404
407
  "ds:inline-flex ds:items-center ds:justify-center",
405
408
  "ds:min-h-[var(--min-target-size)]",
@@ -422,44 +425,44 @@ const Ge = H(
422
425
  defaultVariants: { state: "idle" }
423
426
  }
424
427
  );
425
- function Xe({ value: e, onChange: r }) {
426
- const { t: a, i18n: o } = D("ui"), p = Se(), i = o.dir() === "rtl", v = E(/* @__PURE__ */ new Map()), h = Z((n) => {
427
- var m;
428
- (m = v.current.get(n)) == null || m.focus();
429
- }, []), d = Z(
430
- (n, m) => {
431
- const u = K.indexOf(m), c = K.length, l = i ? "ArrowLeft" : "ArrowRight", y = i ? "ArrowRight" : "ArrowLeft";
432
- switch (n.key) {
433
- case l:
428
+ function Ye({ value: e, onChange: r }) {
429
+ const { t: a, i18n: i } = B("ui"), p = Se(), c = i.dir() === "rtl", g = C(/* @__PURE__ */ new Map()), h = ee((s) => {
430
+ var f;
431
+ (f = g.current.get(s)) == null || f.focus();
432
+ }, []), d = ee(
433
+ (s, f) => {
434
+ const b = M.indexOf(f), l = M.length, o = c ? "ArrowLeft" : "ArrowRight", y = c ? "ArrowRight" : "ArrowLeft";
435
+ switch (s.key) {
436
+ case o:
434
437
  case "ArrowDown": {
435
- n.preventDefault();
436
- const g = K[(u + 1) % c];
437
- r(g), S("patient_search_when_selected", { when: g }), h(g);
438
+ s.preventDefault();
439
+ const m = M[(b + 1) % l];
440
+ r(m), S("patient_search_when_selected", { when: m }), h(m);
438
441
  break;
439
442
  }
440
443
  case y:
441
444
  case "ArrowUp": {
442
- n.preventDefault();
443
- const g = K[(u - 1 + c) % c];
444
- r(g), S("patient_search_when_selected", { when: g }), h(g);
445
+ s.preventDefault();
446
+ const m = M[(b - 1 + l) % l];
447
+ r(m), S("patient_search_when_selected", { when: m }), h(m);
445
448
  break;
446
449
  }
447
450
  case "Home": {
448
- n.preventDefault();
449
- const g = K[0];
450
- r(g), S("patient_search_when_selected", { when: g }), h(g);
451
+ s.preventDefault();
452
+ const m = M[0];
453
+ r(m), S("patient_search_when_selected", { when: m }), h(m);
451
454
  break;
452
455
  }
453
456
  case "End": {
454
- n.preventDefault();
455
- const g = K[c - 1];
456
- r(g), S("patient_search_when_selected", { when: g }), h(g);
457
+ s.preventDefault();
458
+ const m = M[l - 1];
459
+ r(m), S("patient_search_when_selected", { when: m }), h(m);
457
460
  break;
458
461
  }
459
462
  }
460
463
  },
461
- [h, i, r]
462
- ), s = e ?? "anytime", f = {
464
+ [h, c, r]
465
+ ), n = e ?? "anytime", u = {
463
466
  today: "patientSearch.when.today",
464
467
  tomorrow: "patientSearch.when.tomorrow",
465
468
  this_week: "patientSearch.when.thisWeek",
@@ -472,35 +475,35 @@ function Xe({ value: e, onChange: r }) {
472
475
  "aria-label": a("patientSearch.when.label"),
473
476
  id: p,
474
477
  className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
475
- children: K.map((n) => {
476
- const m = e === n, u = s === n, c = a(f[n]);
478
+ children: M.map((s) => {
479
+ const f = e === s, b = n === s, l = a(u[s]);
477
480
  return /* @__PURE__ */ t(
478
481
  "button",
479
482
  {
480
483
  type: "button",
481
484
  role: "radio",
482
- "aria-checked": m,
483
- "aria-label": c,
484
- tabIndex: u ? 0 : -1,
485
- ref: (l) => {
486
- l ? v.current.set(n, l) : v.current.delete(n);
485
+ "aria-checked": f,
486
+ "aria-label": l,
487
+ tabIndex: b ? 0 : -1,
488
+ ref: (o) => {
489
+ o ? g.current.set(s, o) : g.current.delete(s);
487
490
  },
488
491
  onClick: () => {
489
- r(n), S("patient_search_when_selected", { when: n });
492
+ r(s), S("patient_search_when_selected", { when: s });
490
493
  },
491
- onKeyDown: (l) => d(l, n),
492
- className: Ge({
493
- state: m ? "selected" : "idle"
494
+ onKeyDown: (o) => d(o, s),
495
+ className: Xe({
496
+ state: f ? "selected" : "idle"
494
497
  }),
495
- children: c
498
+ children: l
496
499
  },
497
- n
500
+ s
498
501
  );
499
502
  })
500
503
  }
501
504
  );
502
505
  }
503
- const xe = H(
506
+ const xe = $(
504
507
  [
505
508
  "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
506
509
  "ds:min-h-[var(--min-target-size)]",
@@ -530,63 +533,63 @@ const xe = H(
530
533
  defaultVariants: { state: "idle" }
531
534
  }
532
535
  );
533
- function Ye({ facets: e, value: r, onChange: a }) {
534
- const { t: o } = D("ui"), p = le(() => r ?? {}, [r]), i = le(
535
- () => Object.values(p).some((s) => s && s.length > 0),
536
+ function Je({ facets: e, value: r, onChange: a }) {
537
+ const { t: i } = B("ui"), p = ue(() => r ?? {}, [r]), c = ue(
538
+ () => Object.values(p).some((n) => n && n.length > 0),
536
539
  [p]
537
- ), v = (s, f) => {
538
- const n = { ...p };
539
- f.length === 0 ? delete n[s] : n[s] = f, a(n), S("patient_search_facet_changed", { key: s, values: f });
540
- }, h = (s) => {
541
- var n;
542
- const f = (((n = p[s]) == null ? void 0 : n.length) ?? 0) > 0;
543
- v(s, f ? [] : ["true"]);
544
- }, d = (s, f) => {
545
- const n = p[s.key] ?? [], m = n.includes(f);
546
- let u;
547
- s.multi ? u = m ? n.filter((c) => c !== f) : [...n, f] : u = m ? [] : [f], v(s.key, u);
540
+ ), g = (n, u) => {
541
+ const s = { ...p };
542
+ u.length === 0 ? delete s[n] : s[n] = u, a(s), S("patient_search_facet_changed", { key: n, values: u });
543
+ }, h = (n) => {
544
+ var s;
545
+ const u = (((s = p[n]) == null ? void 0 : s.length) ?? 0) > 0;
546
+ g(n, u ? [] : ["true"]);
547
+ }, d = (n, u) => {
548
+ const s = p[n.key] ?? [], f = s.includes(u);
549
+ let b;
550
+ n.multi ? b = f ? s.filter((l) => l !== u) : [...s, u] : b = f ? [] : [u], g(n.key, b);
548
551
  };
549
552
  return /* @__PURE__ */ x(
550
553
  "div",
551
554
  {
552
555
  role: "group",
553
- "aria-label": o("patientSearch.facets.label"),
556
+ "aria-label": i("patientSearch.facets.label"),
554
557
  className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-xs)]",
555
558
  children: [
556
- e.map((s) => {
557
- const f = s.options.length === 0, n = p[s.key] ?? [], m = n.length > 0;
558
- if (f)
559
+ e.map((n) => {
560
+ const u = n.options.length === 0, s = p[n.key] ?? [], f = s.length > 0;
561
+ if (u)
559
562
  return /* @__PURE__ */ t(
560
563
  "button",
561
564
  {
562
565
  type: "button",
563
- "aria-pressed": m,
564
- "aria-label": s.label,
565
- onClick: () => h(s.key),
566
+ "aria-pressed": f,
567
+ "aria-label": n.label,
568
+ onClick: () => h(n.key),
566
569
  className: xe({
567
- state: m ? "active" : "idle"
570
+ state: f ? "active" : "idle"
568
571
  }),
569
- children: /* @__PURE__ */ t("span", { children: s.label })
572
+ children: /* @__PURE__ */ t("span", { children: n.label })
570
573
  },
571
- s.key
574
+ n.key
572
575
  );
573
- const u = m ? ` (${n.length})` : "";
574
- return /* @__PURE__ */ x(Y.Root, { children: [
575
- /* @__PURE__ */ t(Y.Trigger, { asChild: !0, children: /* @__PURE__ */ x(
576
+ const b = f ? ` (${s.length})` : "";
577
+ return /* @__PURE__ */ x(J.Root, { children: [
578
+ /* @__PURE__ */ t(J.Trigger, { asChild: !0, children: /* @__PURE__ */ x(
576
579
  "button",
577
580
  {
578
581
  type: "button",
579
- "aria-label": `${s.label}${u}`,
582
+ "aria-label": `${n.label}${b}`,
580
583
  className: xe({
581
- state: m ? "active" : "idle"
584
+ state: f ? "active" : "idle"
582
585
  }),
583
586
  children: [
584
587
  /* @__PURE__ */ x("span", { children: [
585
- s.label,
586
- u
588
+ n.label,
589
+ b
587
590
  ] }),
588
591
  /* @__PURE__ */ t(
589
- ze,
592
+ Me,
590
593
  {
591
594
  "aria-hidden": "true",
592
595
  className: "ds:size-3.5 ds:shrink-0"
@@ -595,20 +598,20 @@ function Ye({ facets: e, value: r, onChange: a }) {
595
598
  ]
596
599
  }
597
600
  ) }),
598
- /* @__PURE__ */ t(Y.Content, { sideOffset: 8, align: "start", children: s.options.map((c) => /* @__PURE__ */ t(
599
- Y.CheckboxItem,
601
+ /* @__PURE__ */ t(J.Content, { sideOffset: 8, align: "start", children: n.options.map((l) => /* @__PURE__ */ t(
602
+ J.CheckboxItem,
600
603
  {
601
- checked: n.includes(c.value),
602
- onSelect: (l) => {
603
- s.multi && l.preventDefault(), d(s, c.value);
604
+ checked: s.includes(l.value),
605
+ onSelect: (o) => {
606
+ n.multi && o.preventDefault(), d(n, l.value);
604
607
  },
605
- children: c.label
608
+ children: l.label
606
609
  },
607
- c.value
610
+ l.value
608
611
  )) })
609
- ] }, s.key);
612
+ ] }, n.key);
610
613
  }),
611
- i ? /* @__PURE__ */ x(
614
+ c ? /* @__PURE__ */ x(
612
615
  "button",
613
616
  {
614
617
  type: "button",
@@ -626,7 +629,7 @@ function Ye({ facets: e, value: r, onChange: a }) {
626
629
  ].join(" "),
627
630
  children: [
628
631
  /* @__PURE__ */ t(Ce, { "aria-hidden": "true", className: "ds:size-3.5" }),
629
- o("patientSearch.facets.clear")
632
+ i("patientSearch.facets.clear")
630
633
  ]
631
634
  }
632
635
  ) : null
@@ -634,7 +637,7 @@ function Ye({ facets: e, value: r, onChange: a }) {
634
637
  }
635
638
  );
636
639
  }
637
- const _e = ["violet", "purple", "magenta", "blue"], Je = H(
640
+ const _e = ["violet", "purple", "magenta", "blue"], Ze = $(
638
641
  [
639
642
  "ds:relative ds:flex ds:h-full ds:flex-col ds:gap-[var(--spacing-sm)]",
640
643
  "ds:rounded-[var(--radius-lg)] ds:overflow-hidden",
@@ -650,7 +653,7 @@ const _e = ["violet", "purple", "magenta", "blue"], Je = H(
650
653
  "ds:focus-visible:outline-[color:var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
651
654
  "ds:no-underline"
652
655
  ].join(" ")
653
- ), Ze = H(
656
+ ), et = $(
654
657
  // `inset-x-0` compiles to logical `inset-inline`; the `inset-inline-0`
655
658
  // spelling is not a Tailwind utility and compiled to nothing.
656
659
  "ds:absolute ds:inset-x-0 ds:top-0 ds:h-[3px] ds:pointer-events-none",
@@ -665,7 +668,7 @@ const _e = ["violet", "purple", "magenta", "blue"], Je = H(
665
668
  },
666
669
  defaultVariants: { accent: "violet" }
667
670
  }
668
- ), et = H(
671
+ ), tt = $(
669
672
  "ds:inline-flex ds:size-9 ds:items-center ds:justify-center ds:rounded-[var(--radius-md)]",
670
673
  {
671
674
  variants: {
@@ -679,13 +682,13 @@ const _e = ["violet", "purple", "magenta", "blue"], Je = H(
679
682
  defaultVariants: { accent: "violet" }
680
683
  }
681
684
  );
682
- function tt(e, r) {
685
+ function rt(e, r) {
683
686
  return e && e !== "auto" ? e : _e[r % _e.length];
684
687
  }
685
- function rt({ cards: e, headingLevel: r }) {
686
- const { t: a } = D("ui"), o = `h${r}`, p = Se();
688
+ function at({ cards: e, headingLevel: r }) {
689
+ const { t: a } = B("ui"), i = `h${r}`, p = Se();
687
690
  return e.length === 0 ? /* @__PURE__ */ t("p", { className: "type-body-sm ds:text-[color:var(--muted-foreground)] ds:m-0", children: a("patientSearch.discovery.empty") }) : /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", children: [
688
- /* @__PURE__ */ t(o, { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: a("patientSearch.discovery.heading") }),
691
+ /* @__PURE__ */ t(i, { className: "type-title-card ds:text-[var(--foreground)] ds:m-0", children: a("patientSearch.discovery.heading") }),
689
692
  /* @__PURE__ */ t(
690
693
  "ul",
691
694
  {
@@ -694,26 +697,26 @@ function rt({ cards: e, headingLevel: r }) {
694
697
  "ds:md:grid-cols-2 ds:lg:grid-cols-3",
695
698
  "ds:m-0 ds:p-0 ds:list-none"
696
699
  ].join(" "),
697
- children: e.map((i, v) => {
698
- const h = tt(i.accent, v), d = i.description ? `${p}-${i.id}-description` : void 0;
700
+ children: e.map((c, g) => {
701
+ const h = rt(c.accent, g), d = c.description ? `${p}-${c.id}-description` : void 0;
699
702
  return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ x(
700
703
  "a",
701
704
  {
702
- href: i.href,
705
+ href: c.href,
703
706
  "data-component": "patient-search-card",
704
- "data-card-id": i.id,
705
- "aria-label": i.label,
707
+ "data-card-id": c.id,
708
+ "aria-label": c.label,
706
709
  "aria-describedby": d,
707
710
  onClick: () => S("patient_search_discovery_card_clicked", {
708
- cardId: i.id
711
+ cardId: c.id
709
712
  }),
710
- className: Je(),
713
+ className: Ze(),
711
714
  children: [
712
715
  /* @__PURE__ */ t(
713
716
  "span",
714
717
  {
715
718
  "aria-hidden": "true",
716
- className: Ze({ accent: h })
719
+ className: et({ accent: h })
717
720
  }
718
721
  ),
719
722
  /* @__PURE__ */ x("span", { className: "ds:flex ds:items-center ds:gap-[var(--spacing-sm)]", children: [
@@ -721,11 +724,11 @@ function rt({ cards: e, headingLevel: r }) {
721
724
  "span",
722
725
  {
723
726
  "aria-hidden": "true",
724
- className: et({ accent: h }),
725
- children: i.icon ?? /* @__PURE__ */ t(Ke, { className: "ds:size-4", "aria-hidden": "true" })
727
+ className: tt({ accent: h }),
728
+ children: c.icon ?? /* @__PURE__ */ t(ze, { className: "ds:size-4", "aria-hidden": "true" })
726
729
  }
727
730
  ),
728
- i.badge ? (
731
+ c.badge ? (
729
732
  // The badge sits inside a softly-tinted accent bubble
730
733
  // (15% accent + 85% background). The text colour must
731
734
  // contrast with that mix, not with the accent's canonical
@@ -733,27 +736,27 @@ function rt({ cards: e, headingLevel: r }) {
733
736
  // the 100% accent surface and fails AA on the 15% tint.
734
737
  // Use `--foreground` which contrasts with the
735
738
  // mostly-background mix in both light and dark themes.
736
- /* @__PURE__ */ t("span", { className: "type-meta ds:ms-auto ds:inline-flex ds:items-center ds:rounded-[var(--radius-full)] ds:border ds:border-[color:var(--foreground)] ds:bg-[color-mix(in_srgb,var(--accent)_15%,var(--background))] ds:text-[color:var(--foreground)] ds:font-[var(--font-weight-semibold)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]", children: i.badge })
739
+ /* @__PURE__ */ t("span", { className: "type-meta ds:ms-auto ds:inline-flex ds:items-center ds:rounded-[var(--radius-full)] ds:border ds:border-[color:var(--foreground)] ds:bg-[color-mix(in_srgb,var(--accent)_15%,var(--background))] ds:text-[color:var(--foreground)] ds:font-[var(--font-weight-semibold)] ds:ps-[var(--spacing-sm)] ds:pe-[var(--spacing-sm)] ds:pt-[var(--spacing-xs)] ds:pb-[var(--spacing-xs)]", children: c.badge })
737
740
  ) : null
738
741
  ] }),
739
- /* @__PURE__ */ t("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: i.label }),
740
- i.description ? /* @__PURE__ */ t(
742
+ /* @__PURE__ */ t("span", { className: "type-label ds:font-[var(--font-weight-semibold)] ds:text-[var(--foreground)]", children: c.label }),
743
+ c.description ? /* @__PURE__ */ t(
741
744
  "span",
742
745
  {
743
746
  id: d,
744
747
  className: "type-body-sm ds:text-[color:var(--muted-foreground)]",
745
- children: i.description
748
+ children: c.description
746
749
  }
747
750
  ) : null
748
751
  ]
749
752
  }
750
- ) }, i.id);
753
+ ) }, c.id);
751
754
  })
752
755
  }
753
756
  )
754
757
  ] });
755
758
  }
756
- function at(e) {
759
+ function st(e) {
757
760
  if (e.object || e.place || e.geo || e.when && e.when !== "anytime") return !0;
758
761
  if (e.facets) {
759
762
  for (const r of Object.values(e.facets))
@@ -761,15 +764,15 @@ function at(e) {
761
764
  }
762
765
  return !1;
763
766
  }
764
- function se({
767
+ function ne({
765
768
  value: e,
766
769
  variant: r,
767
770
  submitting: a,
768
- submitLabel: o,
771
+ submitLabel: i,
769
772
  allowEmptySubmit: p,
770
- onSubmit: i
773
+ onSubmit: c
771
774
  }) {
772
- const { t: v } = D("ui"), h = !a && !p && !at(e), d = o ?? v("patientSearch.submit.cta");
775
+ const { t: g } = B("ui"), h = !a && !p && !st(e), d = i ?? g("patientSearch.submit.cta");
773
776
  return /* @__PURE__ */ t(
774
777
  Ie,
775
778
  {
@@ -787,520 +790,530 @@ function se({
787
790
  hasGeo: !!e.geo,
788
791
  when: e.when,
789
792
  facetKeys: e.facets ? Object.keys(e.facets) : []
790
- }), i(e);
793
+ }), c(e);
791
794
  },
792
795
  children: d
793
796
  }
794
797
  );
795
798
  }
796
- function st(e) {
799
+ function nt(e) {
797
800
  const {
798
801
  variant: r,
799
802
  value: a,
800
- onChange: o,
803
+ onChange: i,
801
804
  onSubmit: p,
802
- loadObjects: i,
803
- loadPlaces: v,
805
+ loadObjects: c,
806
+ loadPlaces: g,
804
807
  onObjectSelect: h,
805
808
  onPlaceSelect: d,
806
- allowTypedPlace: s,
807
- submitting: f,
808
- submitLabel: n,
809
- allowEmptySubmit: m,
810
- whoRef: u,
811
- whereRef: c,
812
- whoQuery: l,
809
+ allowTypedPlace: n,
810
+ submitting: u,
811
+ submitLabel: s,
812
+ allowEmptySubmit: f,
813
+ whoRef: b,
814
+ whereRef: l,
815
+ whoQuery: o,
813
816
  onWhoQueryChange: y,
814
- whereQuery: g,
817
+ whereQuery: m,
815
818
  onWhereQueryChange: j,
816
- defaultRadiusKm: k,
817
- reverseGeocode: C,
818
- cardLabel: R
819
+ defaultRadiusKm: R,
820
+ reverseGeocode: E,
821
+ geoHint: k,
822
+ cardLabel: W
819
823
  } = e;
820
- return /* @__PURE__ */ t(ee, { variant: "elevated", "aria-label": R, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
824
+ return /* @__PURE__ */ t(te, { variant: "elevated", "aria-label": W, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)]", children: [
821
825
  /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:md:flex-row ds:md:items-start", children: [
822
826
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
823
- te,
827
+ re,
824
828
  {
825
829
  value: a,
826
- onChange: o,
827
- loadObjects: i,
830
+ onChange: i,
831
+ loadObjects: c,
828
832
  onObjectSelect: h,
829
- inputRef: u,
830
- query: l,
833
+ inputRef: b,
834
+ query: o,
831
835
  onQueryChange: y
832
836
  }
833
837
  ) }),
834
838
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
835
- re,
839
+ ae,
836
840
  {
837
841
  value: a,
838
- onChange: o,
839
- loadPlaces: v,
842
+ onChange: i,
843
+ loadPlaces: g,
840
844
  onPlaceSelect: d,
841
- allowTypedPlace: s,
842
- defaultRadiusKm: k,
843
- reverseGeocode: C,
844
- inputRef: c,
845
- query: g,
845
+ allowTypedPlace: n,
846
+ defaultRadiusKm: R,
847
+ reverseGeocode: E,
848
+ geoHint: k,
849
+ inputRef: l,
850
+ query: m,
846
851
  onQueryChange: j
847
852
  }
848
853
  ) }),
849
854
  /* @__PURE__ */ t(
850
- se,
855
+ ne,
851
856
  {
852
857
  value: a,
853
858
  variant: r,
854
- submitting: f,
855
- submitLabel: n,
856
- allowEmptySubmit: m,
859
+ submitting: u,
860
+ submitLabel: s,
861
+ allowEmptySubmit: f,
857
862
  onSubmit: p
858
863
  }
859
864
  )
860
865
  ] }),
861
866
  /* @__PURE__ */ t(
862
- ae,
867
+ se,
863
868
  {
864
869
  value: a,
865
- onChange: o,
866
- defaultRadiusKm: k
870
+ onChange: i,
871
+ defaultRadiusKm: R
867
872
  }
868
873
  )
869
874
  ] }) });
870
875
  }
871
- function nt(e) {
876
+ function ot(e) {
872
877
  const {
873
878
  variant: r,
874
879
  value: a,
875
- onChange: o,
880
+ onChange: i,
876
881
  onSubmit: p,
877
- loadObjects: i,
878
- loadPlaces: v,
882
+ loadObjects: c,
883
+ loadPlaces: g,
879
884
  onObjectSelect: h,
880
885
  onPlaceSelect: d,
881
- allowTypedPlace: s,
882
- submitting: f,
883
- submitLabel: n,
884
- allowEmptySubmit: m,
885
- whoRef: u,
886
- whereRef: c,
887
- whoQuery: l,
886
+ allowTypedPlace: n,
887
+ submitting: u,
888
+ submitLabel: s,
889
+ allowEmptySubmit: f,
890
+ whoRef: b,
891
+ whereRef: l,
892
+ whoQuery: o,
888
893
  onWhoQueryChange: y,
889
- whereQuery: g,
894
+ whereQuery: m,
890
895
  onWhereQueryChange: j,
891
- defaultRadiusKm: k,
892
- reverseGeocode: C,
893
- cardLabel: R
896
+ defaultRadiusKm: R,
897
+ reverseGeocode: E,
898
+ geoHint: k,
899
+ cardLabel: W
894
900
  } = e;
895
- return /* @__PURE__ */ t(ee, { variant: "elevated", "aria-label": R, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
901
+ return /* @__PURE__ */ t(te, { variant: "elevated", "aria-label": W, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
896
902
  /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:md:flex-row ds:md:items-start", children: [
897
903
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
898
- te,
904
+ re,
899
905
  {
900
906
  value: a,
901
- onChange: o,
902
- loadObjects: i,
907
+ onChange: i,
908
+ loadObjects: c,
903
909
  onObjectSelect: h,
904
- inputRef: u,
905
- query: l,
910
+ inputRef: b,
911
+ query: o,
906
912
  onQueryChange: y
907
913
  }
908
914
  ) }),
909
915
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
910
- re,
916
+ ae,
911
917
  {
912
918
  value: a,
913
- onChange: o,
914
- loadPlaces: v,
919
+ onChange: i,
920
+ loadPlaces: g,
915
921
  onPlaceSelect: d,
916
- allowTypedPlace: s,
917
- defaultRadiusKm: k,
918
- reverseGeocode: C,
919
- inputRef: c,
920
- query: g,
922
+ allowTypedPlace: n,
923
+ defaultRadiusKm: R,
924
+ reverseGeocode: E,
925
+ geoHint: k,
926
+ inputRef: l,
927
+ query: m,
921
928
  onQueryChange: j
922
929
  }
923
930
  ) }),
924
931
  /* @__PURE__ */ t(
925
- se,
932
+ ne,
926
933
  {
927
934
  value: a,
928
935
  variant: r,
929
- submitting: f,
930
- submitLabel: n,
931
- allowEmptySubmit: m,
936
+ submitting: u,
937
+ submitLabel: s,
938
+ allowEmptySubmit: f,
932
939
  onSubmit: p
933
940
  }
934
941
  )
935
942
  ] }),
936
943
  /* @__PURE__ */ t(
937
- ae,
944
+ se,
938
945
  {
939
946
  value: a,
940
- onChange: o,
941
- defaultRadiusKm: k
947
+ onChange: i,
948
+ defaultRadiusKm: R
942
949
  }
943
950
  ),
944
951
  /* @__PURE__ */ t(
945
- Xe,
952
+ Ye,
946
953
  {
947
954
  value: a.when,
948
- onChange: (W) => o({ ...a, when: W })
955
+ onChange: (P) => i({ ...a, when: P })
949
956
  }
950
957
  )
951
958
  ] }) });
952
959
  }
953
- function ot(e) {
960
+ function it(e) {
954
961
  const {
955
962
  variant: r,
956
963
  value: a,
957
- onChange: o,
964
+ onChange: i,
958
965
  onSubmit: p,
959
- loadObjects: i,
960
- loadPlaces: v,
966
+ loadObjects: c,
967
+ loadPlaces: g,
961
968
  onObjectSelect: h,
962
969
  onPlaceSelect: d,
963
- allowTypedPlace: s,
964
- facets: f,
965
- submitting: n,
966
- submitLabel: m,
967
- allowEmptySubmit: u,
968
- whoRef: c,
969
- whereRef: l,
970
+ allowTypedPlace: n,
971
+ facets: u,
972
+ submitting: s,
973
+ submitLabel: f,
974
+ allowEmptySubmit: b,
975
+ whoRef: l,
976
+ whereRef: o,
970
977
  whoQuery: y,
971
- onWhoQueryChange: g,
978
+ onWhoQueryChange: m,
972
979
  whereQuery: j,
973
- onWhereQueryChange: k,
974
- defaultRadiusKm: C,
975
- reverseGeocode: R,
976
- cardLabel: W
980
+ onWhereQueryChange: R,
981
+ defaultRadiusKm: E,
982
+ reverseGeocode: k,
983
+ geoHint: W,
984
+ cardLabel: P
977
985
  } = e;
978
- return /* @__PURE__ */ t(ee, { variant: "elevated", "aria-label": W, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
986
+ return /* @__PURE__ */ t(te, { variant: "elevated", "aria-label": P, children: /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
979
987
  /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:md:flex-row ds:md:items-start", children: [
980
988
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
981
- te,
989
+ re,
982
990
  {
983
991
  value: a,
984
- onChange: o,
985
- loadObjects: i,
992
+ onChange: i,
993
+ loadObjects: c,
986
994
  onObjectSelect: h,
987
- inputRef: c,
995
+ inputRef: l,
988
996
  query: y,
989
- onQueryChange: g
997
+ onQueryChange: m
990
998
  }
991
999
  ) }),
992
1000
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
993
- re,
1001
+ ae,
994
1002
  {
995
1003
  value: a,
996
- onChange: o,
997
- loadPlaces: v,
1004
+ onChange: i,
1005
+ loadPlaces: g,
998
1006
  onPlaceSelect: d,
999
- allowTypedPlace: s,
1000
- defaultRadiusKm: C,
1001
- reverseGeocode: R,
1002
- inputRef: l,
1007
+ allowTypedPlace: n,
1008
+ defaultRadiusKm: E,
1009
+ reverseGeocode: k,
1010
+ geoHint: W,
1011
+ inputRef: o,
1003
1012
  query: j,
1004
- onQueryChange: k
1013
+ onQueryChange: R
1005
1014
  }
1006
1015
  ) }),
1007
1016
  /* @__PURE__ */ t(
1008
- se,
1017
+ ne,
1009
1018
  {
1010
1019
  value: a,
1011
1020
  variant: r,
1012
- submitting: n,
1013
- submitLabel: m,
1014
- allowEmptySubmit: u,
1021
+ submitting: s,
1022
+ submitLabel: f,
1023
+ allowEmptySubmit: b,
1015
1024
  onSubmit: p
1016
1025
  }
1017
1026
  )
1018
1027
  ] }),
1019
1028
  /* @__PURE__ */ t(
1020
- ae,
1029
+ se,
1021
1030
  {
1022
1031
  value: a,
1023
- onChange: o,
1024
- defaultRadiusKm: C
1032
+ onChange: i,
1033
+ defaultRadiusKm: E
1025
1034
  }
1026
1035
  ),
1027
- f && f.length > 0 ? /* @__PURE__ */ t(
1028
- Ye,
1036
+ u && u.length > 0 ? /* @__PURE__ */ t(
1037
+ Je,
1029
1038
  {
1030
- facets: f,
1039
+ facets: u,
1031
1040
  value: a.facets,
1032
- onChange: (z) => o({ ...a, facets: z })
1041
+ onChange: (V) => i({ ...a, facets: V })
1033
1042
  }
1034
1043
  ) : null
1035
1044
  ] }) });
1036
1045
  }
1037
- function it(e) {
1046
+ function ct(e) {
1038
1047
  const {
1039
1048
  variant: r,
1040
1049
  value: a,
1041
- onChange: o,
1050
+ onChange: i,
1042
1051
  onSubmit: p,
1043
- loadObjects: i,
1044
- loadPlaces: v,
1052
+ loadObjects: c,
1053
+ loadPlaces: g,
1045
1054
  onObjectSelect: h,
1046
1055
  onPlaceSelect: d,
1047
- allowTypedPlace: s,
1048
- discoveryCards: f,
1049
- discoveryHeadingLevel: n,
1050
- submitting: m,
1051
- submitLabel: u,
1052
- allowEmptySubmit: c,
1053
- whoRef: l,
1056
+ allowTypedPlace: n,
1057
+ discoveryCards: u,
1058
+ discoveryHeadingLevel: s,
1059
+ submitting: f,
1060
+ submitLabel: b,
1061
+ allowEmptySubmit: l,
1062
+ whoRef: o,
1054
1063
  whereRef: y,
1055
- whoQuery: g,
1064
+ whoQuery: m,
1056
1065
  onWhoQueryChange: j,
1057
- whereQuery: k,
1058
- onWhereQueryChange: C,
1059
- defaultRadiusKm: R,
1066
+ whereQuery: R,
1067
+ onWhereQueryChange: E,
1068
+ defaultRadiusKm: k,
1060
1069
  reverseGeocode: W,
1061
- cardLabel: z
1070
+ geoHint: P,
1071
+ cardLabel: V
1062
1072
  } = e;
1063
1073
  return /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
1064
- /* @__PURE__ */ x(ee, { variant: "elevated", "aria-label": z, children: [
1074
+ /* @__PURE__ */ x(te, { variant: "elevated", "aria-label": V, children: [
1065
1075
  /* @__PURE__ */ x("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)] ds:p-[var(--spacing-md)] ds:md:flex-row ds:md:items-stretch", children: [
1066
1076
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
1067
- te,
1077
+ re,
1068
1078
  {
1069
1079
  value: a,
1070
- onChange: o,
1071
- loadObjects: i,
1080
+ onChange: i,
1081
+ loadObjects: c,
1072
1082
  onObjectSelect: h,
1073
- inputRef: l,
1074
- query: g,
1083
+ inputRef: o,
1084
+ query: m,
1075
1085
  onQueryChange: j
1076
1086
  }
1077
1087
  ) }),
1078
1088
  /* @__PURE__ */ t("div", { className: "ds:flex-1 ds:min-w-0", children: /* @__PURE__ */ t(
1079
- re,
1089
+ ae,
1080
1090
  {
1081
1091
  value: a,
1082
- onChange: o,
1083
- loadPlaces: v,
1092
+ onChange: i,
1093
+ loadPlaces: g,
1084
1094
  onPlaceSelect: d,
1085
- allowTypedPlace: s,
1086
- defaultRadiusKm: R,
1095
+ allowTypedPlace: n,
1096
+ defaultRadiusKm: k,
1087
1097
  reverseGeocode: W,
1098
+ geoHint: P,
1088
1099
  inputRef: y,
1089
- query: k,
1090
- onQueryChange: C
1100
+ query: R,
1101
+ onQueryChange: E
1091
1102
  }
1092
1103
  ) }),
1093
1104
  /* @__PURE__ */ t(
1094
- se,
1105
+ ne,
1095
1106
  {
1096
1107
  value: a,
1097
1108
  variant: r,
1098
- submitting: m,
1099
- submitLabel: u,
1100
- allowEmptySubmit: c,
1109
+ submitting: f,
1110
+ submitLabel: b,
1111
+ allowEmptySubmit: l,
1101
1112
  onSubmit: p
1102
1113
  }
1103
1114
  )
1104
1115
  ] }),
1105
1116
  /* @__PURE__ */ t(
1106
- ae,
1117
+ se,
1107
1118
  {
1108
1119
  value: a,
1109
- onChange: o,
1110
- defaultRadiusKm: R
1120
+ onChange: i,
1121
+ defaultRadiusKm: k
1111
1122
  }
1112
1123
  )
1113
1124
  ] }),
1114
1125
  /* @__PURE__ */ t(
1115
- rt,
1126
+ at,
1116
1127
  {
1117
- cards: f,
1118
- headingLevel: n
1128
+ cards: u,
1129
+ headingLevel: s
1119
1130
  }
1120
1131
  )
1121
1132
  ] });
1122
1133
  }
1123
- const ct = Ae(function({
1134
+ const dt = Ae(function({
1124
1135
  variant: r,
1125
1136
  loadObjects: a,
1126
- loadPlaces: o,
1137
+ loadPlaces: i,
1127
1138
  onObjectSelect: p,
1128
- onPlaceSelect: i,
1129
- allowTypedPlace: v = !1,
1139
+ onPlaceSelect: c,
1140
+ allowTypedPlace: g = !1,
1130
1141
  facets: h,
1131
- defaultRadiusKm: d = ue,
1132
- reverseGeocode: s,
1133
- discoveryCards: f,
1134
- discoveryHeadingLevel: n = 3,
1135
- countryCode: m,
1136
- value: u,
1137
- onChange: c,
1138
- onSubmit: l,
1139
- submitting: y,
1140
- submitLabel: g,
1141
- allowEmptySubmit: j,
1142
- "aria-label": k,
1143
- id: C,
1144
- className: R,
1145
- ...W
1146
- }, z) {
1147
- var ge, ve;
1148
- const { t: ne } = D("ui"), M = E(null), I = E(null), V = E(null), [w, _] = J(((ge = u.object) == null ? void 0 : ge.label) ?? ""), [T, Q] = J(
1149
- ((ve = u.place) == null ? void 0 : ve.label) ?? ""
1150
- ), N = E(null), U = E(
1142
+ defaultRadiusKm: d = fe,
1143
+ reverseGeocode: n,
1144
+ geoHint: u,
1145
+ discoveryCards: s,
1146
+ discoveryHeadingLevel: f = 3,
1147
+ countryCode: b,
1148
+ value: l,
1149
+ onChange: o,
1150
+ onSubmit: y,
1151
+ submitting: m,
1152
+ submitLabel: j,
1153
+ allowEmptySubmit: R,
1154
+ "aria-label": E,
1155
+ id: k,
1156
+ className: W,
1157
+ ...P
1158
+ }, V) {
1159
+ var ve, be;
1160
+ const { t: oe } = B("ui"), q = C(null), O = C(null), D = C(null), [w, _] = Z(((ve = l.object) == null ? void 0 : ve.label) ?? ""), [T, F] = Z(
1161
+ ((be = l.place) == null ? void 0 : be.label) ?? ""
1162
+ ), N = C(null), G = C(
1151
1163
  { who: { current: !1 }, where: { current: !1 } }
1152
- ), G = (b) => {
1153
- const L = b === I.current ? "who" : b === V.current ? "where" : null;
1164
+ ), X = (v) => {
1165
+ const L = v === O.current ? "who" : v === D.current ? "where" : null;
1154
1166
  if (!L) {
1155
1167
  N.current = null;
1156
1168
  return;
1157
1169
  }
1158
- const P = b;
1170
+ const Q = v;
1159
1171
  N.current = {
1160
1172
  field: L,
1161
- start: P.selectionStart,
1162
- end: P.selectionEnd
1173
+ start: Q.selectionStart,
1174
+ end: Q.selectionEnd
1163
1175
  };
1164
- }, je = (b, L) => {
1165
- var P;
1166
- L && ((P = M.current) != null && P.contains(L)) || setTimeout(() => {
1167
- b.isConnected && (N.current = null);
1176
+ }, je = (v, L) => {
1177
+ var Q;
1178
+ L && ((Q = q.current) != null && Q.contains(L)) || setTimeout(() => {
1179
+ v.isConnected && (N.current = null);
1168
1180
  }, 0);
1169
- }, oe = E(null), fe = (b, L, P) => {
1170
- const F = (b === "who" ? I : V).current;
1171
- if (!F) return;
1172
- F.focus();
1173
- const O = F.value.length;
1174
- F.setSelectionRange(
1175
- Math.min(L ?? O, O),
1176
- Math.min(P ?? O, O)
1181
+ }, ie = C(null), he = (v, L, Q) => {
1182
+ const I = (v === "who" ? O : D).current;
1183
+ if (!I) return;
1184
+ I.focus();
1185
+ const K = I.value.length;
1186
+ I.setSelectionRange(
1187
+ Math.min(L ?? K, K),
1188
+ Math.min(Q ?? K, K)
1177
1189
  );
1178
1190
  };
1179
- q(() => {
1180
- const b = M.current;
1181
- if (!b) return;
1191
+ H(() => {
1192
+ const v = q.current;
1193
+ if (!v) return;
1182
1194
  const L = (A) => {
1183
- const B = oe.current;
1184
- if (B && performance.now() < B.until && (A.target === I.current && B.field === "where" || A.target === V.current && B.field === "who")) {
1185
- fe(B.field, B.start, B.end);
1195
+ const z = ie.current;
1196
+ if (z && performance.now() < z.until && (A.target === O.current && z.field === "where" || A.target === D.current && z.field === "who")) {
1197
+ he(z.field, z.start, z.end);
1186
1198
  return;
1187
1199
  }
1188
- G(A.target);
1189
- }, P = (A) => G(A.target), F = () => {
1190
- oe.current = null;
1191
- }, O = (A) => je(A.target, A.relatedTarget), be = ["select", "keyup", "input"];
1192
- return b.addEventListener("focusin", L), be.forEach((A) => b.addEventListener(A, P)), b.addEventListener("pointerdown", F), b.addEventListener("keydown", F), b.addEventListener("focusout", O), () => {
1193
- b.removeEventListener("focusin", L), be.forEach((A) => b.removeEventListener(A, P)), b.removeEventListener("pointerdown", F), b.removeEventListener("keydown", F), b.removeEventListener("focusout", O);
1200
+ X(A.target);
1201
+ }, Q = (A) => X(A.target), I = () => {
1202
+ ie.current = null;
1203
+ }, K = (A) => je(A.target, A.relatedTarget), ye = ["select", "keyup", "input"];
1204
+ return v.addEventListener("focusin", L), ye.forEach((A) => v.addEventListener(A, Q)), v.addEventListener("pointerdown", I), v.addEventListener("keydown", I), v.addEventListener("focusout", K), () => {
1205
+ v.removeEventListener("focusin", L), ye.forEach((A) => v.removeEventListener(A, Q)), v.removeEventListener("pointerdown", I), v.removeEventListener("keydown", I), v.removeEventListener("focusout", K);
1194
1206
  };
1195
1207
  }, []);
1196
- const he = E(r);
1208
+ const pe = C(r);
1197
1209
  We(() => {
1198
- if (he.current === r) return;
1199
- he.current = r;
1200
- const b = N.current;
1201
- if (!b) return;
1210
+ if (pe.current === r) return;
1211
+ pe.current = r;
1212
+ const v = N.current;
1213
+ if (!v) return;
1202
1214
  const L = document.activeElement;
1203
- L && L !== document.body || (oe.current = { ...b, until: performance.now() + 500 }, fe(b.field, b.start, b.end));
1215
+ L && L !== document.body || (ie.current = { ...v, until: performance.now() + 500 }, he(v.field, v.start, v.end));
1204
1216
  }, [r]);
1205
- const ie = E(!1);
1206
- q(() => {
1207
- if (!ie.current && r === "who-where-when") {
1208
- if (u.when !== void 0) {
1209
- ie.current = !0;
1217
+ const ce = C(!1);
1218
+ H(() => {
1219
+ if (!ce.current && r === "who-where-when") {
1220
+ if (l.when !== void 0) {
1221
+ ce.current = !0;
1210
1222
  return;
1211
1223
  }
1212
- ie.current = !0, c({ ...u, when: "anytime" });
1224
+ ce.current = !0, o({ ...l, when: "anytime" });
1213
1225
  }
1214
1226
  }, [r]);
1215
- const ce = E(!1);
1216
- q(() => {
1217
- if (!ce.current && r === "faceted") {
1218
- if (u.facets !== void 0) {
1219
- ce.current = !0;
1227
+ const de = C(!1);
1228
+ H(() => {
1229
+ if (!de.current && r === "faceted") {
1230
+ if (l.facets !== void 0) {
1231
+ de.current = !0;
1220
1232
  return;
1221
1233
  }
1222
- ce.current = !0, c({ ...u, facets: {} });
1234
+ de.current = !0, o({ ...l, facets: {} });
1223
1235
  }
1224
1236
  }, [r]);
1225
- const pe = E(null);
1226
- q(() => {
1227
- pe.current !== r && (pe.current = r, S("patient_search_variant_exposed", { variant: r, country: m }));
1228
- }, [r, m]);
1229
- const de = le(
1237
+ const me = C(null);
1238
+ H(() => {
1239
+ me.current !== r && (me.current = r, S("patient_search_variant_exposed", { variant: r, country: b }));
1240
+ }, [r, b]);
1241
+ const le = ue(
1230
1242
  () => ({
1231
1243
  getVariant: () => r,
1232
1244
  reset: () => {
1233
- c({});
1245
+ o({});
1234
1246
  },
1235
1247
  focusPrimary: () => {
1236
1248
  requestAnimationFrame(() => {
1237
- var b;
1238
- (b = I.current) == null || b.focus();
1249
+ var v;
1250
+ (v = O.current) == null || v.focus();
1239
1251
  });
1240
1252
  }
1241
1253
  }),
1242
- [r, c]
1254
+ [r, o]
1243
1255
  );
1244
- Pe(z, () => de, [de]), Ve(He, de, C);
1245
- const me = k ?? ne("patientSearch.regionLabel"), X = {
1256
+ Pe(V, () => le, [le]), Be($e, le, k);
1257
+ const ge = E ?? oe("patientSearch.regionLabel"), Y = {
1246
1258
  variant: r,
1247
- value: u,
1248
- onChange: c,
1249
- onSubmit: l,
1259
+ value: l,
1260
+ onChange: o,
1261
+ onSubmit: y,
1250
1262
  loadObjects: a,
1251
- loadPlaces: o,
1263
+ loadPlaces: i,
1252
1264
  onObjectSelect: p,
1253
- onPlaceSelect: i,
1254
- allowTypedPlace: v,
1265
+ onPlaceSelect: c,
1266
+ allowTypedPlace: g,
1255
1267
  facets: h,
1256
1268
  defaultRadiusKm: d,
1257
- reverseGeocode: s,
1258
- discoveryCards: f ?? [],
1259
- discoveryHeadingLevel: n,
1260
- submitting: y,
1261
- submitLabel: g,
1262
- allowEmptySubmit: j,
1263
- whoRef: I,
1264
- whereRef: V,
1269
+ reverseGeocode: n,
1270
+ geoHint: u,
1271
+ discoveryCards: s ?? [],
1272
+ discoveryHeadingLevel: f,
1273
+ submitting: m,
1274
+ submitLabel: j,
1275
+ allowEmptySubmit: R,
1276
+ whoRef: O,
1277
+ whereRef: D,
1265
1278
  whoQuery: w,
1266
1279
  onWhoQueryChange: _,
1267
1280
  whereQuery: T,
1268
- onWhereQueryChange: Q,
1269
- cardLabel: me
1281
+ onWhereQueryChange: F,
1282
+ cardLabel: ge
1270
1283
  }, Te = (() => {
1271
1284
  switch (r) {
1272
1285
  case "who-where":
1273
- return /* @__PURE__ */ t(st, { ...X });
1286
+ return /* @__PURE__ */ t(nt, { ...Y });
1274
1287
  case "who-where-when":
1275
- return /* @__PURE__ */ t(nt, { ...X });
1288
+ return /* @__PURE__ */ t(ot, { ...Y });
1276
1289
  case "faceted":
1277
- return /* @__PURE__ */ t(ot, { ...X });
1290
+ return /* @__PURE__ */ t(it, { ...Y });
1278
1291
  case "discovery":
1279
- return /* @__PURE__ */ t(it, { ...X });
1292
+ return /* @__PURE__ */ t(ct, { ...Y });
1280
1293
  /* c8 ignore next 2 */
1281
1294
  default:
1282
1295
  return null;
1283
1296
  }
1284
1297
  })();
1285
- return /* @__PURE__ */ t(Ee.Provider, { value: U.current, children: /* @__PURE__ */ t(
1298
+ return /* @__PURE__ */ t(Ee.Provider, { value: G.current, children: /* @__PURE__ */ t(
1286
1299
  "div",
1287
1300
  {
1288
- ref: M,
1301
+ ref: q,
1289
1302
  role: "region",
1290
- "aria-label": me,
1291
- id: C,
1303
+ "aria-label": ge,
1304
+ id: k,
1292
1305
  "data-component": "patient-search",
1293
- "data-component-id": C,
1306
+ "data-component-id": k,
1294
1307
  "data-variant": r,
1295
- className: Ue({ variant: r, className: R }),
1296
- ...W,
1308
+ className: Ge({ variant: r, className: W }),
1309
+ ...P,
1297
1310
  children: Te
1298
1311
  }
1299
1312
  ) });
1300
1313
  });
1301
- ct.displayName = "PatientSearch";
1314
+ dt.displayName = "PatientSearch";
1302
1315
  export {
1303
- ct as P,
1304
- He as p
1316
+ dt as P,
1317
+ $e as p
1305
1318
  };
1306
- //# sourceMappingURL=patient-search-DJy0IZSx.js.map
1319
+ //# sourceMappingURL=patient-search-CxuqVUTB.js.map