@partbot/stockist-map 0.1.11 → 0.1.12

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,54 +1,54 @@
1
- var ue = Object.defineProperty;
2
- var de = (e, t, r) => t in e ? ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var P = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsxs as f, jsx as i } from "react/jsx-runtime";
5
- import { createRoot as J } from "react-dom/client";
1
+ var _e = Object.defineProperty;
2
+ var Le = (e, t, r) => t in e ? _e(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var W = (e, t, r) => Le(e, typeof t != "symbol" ? t + "" : t, r);
4
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
5
+ import { createRoot as be } from "react-dom/client";
6
6
  import * as s from "react";
7
- import { createContext as pe } from "react";
8
- const be = pe({
7
+ import { createContext as Ae } from "react";
8
+ const Ce = Ae({
9
9
  color: "currentColor",
10
10
  size: "1em",
11
11
  weight: "regular",
12
12
  mirrored: !1
13
- }), q = s.forwardRef(
13
+ }), se = s.forwardRef(
14
14
  (e, t) => {
15
15
  const {
16
16
  alt: r,
17
- color: n,
17
+ color: o,
18
18
  size: l,
19
19
  weight: p,
20
- mirrored: Z,
20
+ mirrored: S,
21
21
  children: c,
22
- weights: N,
23
- ...v
22
+ weights: O,
23
+ ..._
24
24
  } = e, {
25
- color: L = "currentColor",
26
- size: A,
27
- weight: x = "regular",
28
- mirrored: T = !1,
29
- ...k
30
- } = s.useContext(be);
25
+ color: N = "currentColor",
26
+ size: U,
27
+ weight: w = "regular",
28
+ mirrored: L = !1,
29
+ ...A
30
+ } = s.useContext(Ce);
31
31
  return /* @__PURE__ */ s.createElement(
32
32
  "svg",
33
33
  {
34
34
  ref: t,
35
35
  xmlns: "http://www.w3.org/2000/svg",
36
- width: l ?? A,
37
- height: l ?? A,
38
- fill: n ?? L,
36
+ width: l ?? U,
37
+ height: l ?? U,
38
+ fill: o ?? N,
39
39
  viewBox: "0 0 256 256",
40
- transform: Z || T ? "scale(-1, 1)" : void 0,
41
- ...k,
42
- ...v
40
+ transform: S || L ? "scale(-1, 1)" : void 0,
41
+ ...A,
42
+ ..._
43
43
  },
44
44
  !!r && /* @__PURE__ */ s.createElement("title", null, r),
45
45
  c,
46
- N.get(p ?? x)
46
+ O.get(p ?? w)
47
47
  );
48
48
  }
49
49
  );
50
- q.displayName = "IconBase";
51
- const fe = /* @__PURE__ */ new Map([
50
+ se.displayName = "IconBase";
51
+ const Me = /* @__PURE__ */ new Map([
52
52
  [
53
53
  "bold",
54
54
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M238.7,102.46,62.81,37.21l-.25-.09A20,20,0,0,0,37.12,62.56l.09.25L102.46,238.7A20,20,0,0,0,121.3,252h.35a20,20,0,0,0,18.77-14.12l.09-.29,21.23-75.85,75.85-21.23.29-.09a20,20,0,0,0,.82-38Zm-89.93,38a12,12,0,0,0-8.32,8.32l-19.68,70.29L62.8,62.8l156.26,58Z" }))
@@ -79,9 +79,9 @@ const fe = /* @__PURE__ */ new Map([
79
79
  "thin",
80
80
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M236,110,59.93,44.67A12,12,0,0,0,44.69,60L110,235.93A11.83,11.83,0,0,0,121.28,244h.22a11.82,11.82,0,0,0,11.26-8.47l0-.1,22.45-80.19,80.19-22.44.1,0A12,12,0,0,0,236,110Zm-2.79,15.12-82.3,23a4,4,0,0,0-2.78,2.77l-23,82.3a3.88,3.88,0,0,1-3.74,2.78,4,4,0,0,1-3.88-2.77L52.22,57.32a3.93,3.93,0,0,1,1-4.14A4,4,0,0,1,56,52a3.86,3.86,0,0,1,1.25.21l176.08,65.32a4,4,0,0,1-.09,7.59Z" }))
81
81
  ]
82
- ]), ee = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(q, { ref: t, ...e, weights: fe }));
83
- ee.displayName = "NavigationArrowIcon";
84
- const he = /* @__PURE__ */ new Map([
82
+ ]), fe = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(se, { ref: t, ...e, weights: Me }));
83
+ fe.displayName = "NavigationArrowIcon";
84
+ const Re = /* @__PURE__ */ new Map([
85
85
  [
86
86
  "bold",
87
87
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z" }))
@@ -112,9 +112,9 @@ const he = /* @__PURE__ */ new Map([
112
112
  "thin",
113
113
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z" }))
114
114
  ]
115
- ]), te = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(q, { ref: t, ...e, weights: he }));
116
- te.displayName = "XIcon";
117
- const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", re = "OpenStreetMap contributors, CARTO", ne = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", O = {
115
+ ]), he = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(se, { ref: t, ...e, weights: Re }));
116
+ he.displayName = "XIcon";
117
+ const Ie = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", me = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", ge = "OpenStreetMap contributors, CARTO", xe = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", ee = {
118
118
  primaryColor: "#111111",
119
119
  markerColor: "#111111",
120
120
  borderRadius: 8,
@@ -122,355 +122,469 @@ const me = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", se = "https://basem
122
122
  defaultZoom: 5,
123
123
  defaultCenter: { lat: -25.2744, lng: 133.7751 },
124
124
  darkMode: !1,
125
- styleUrl: ne,
125
+ styleUrl: xe,
126
126
  mapPalette: "monotone",
127
- tileUrl: se,
128
- tileAttribution: re,
127
+ tileUrl: me,
128
+ tileAttribution: ge,
129
129
  phoneDisplay: "call_now"
130
130
  };
131
- function B(e) {
132
- const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((n) => `${n}${n}`).join("") : t;
131
+ function te(e) {
132
+ const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((o) => `${o}${o}`).join("") : t;
133
133
  return /^[0-9a-f]{6}$/i.test(r) ? {
134
134
  r: Number.parseInt(r.slice(0, 2), 16),
135
135
  g: Number.parseInt(r.slice(2, 4), 16),
136
136
  b: Number.parseInt(r.slice(4, 6), 16)
137
137
  } : null;
138
138
  }
139
- function $({ r: e, g: t, b: r }) {
140
- const n = [e, t, r].map((l) => {
139
+ function G({ r: e, g: t, b: r }) {
140
+ const o = [e, t, r].map((l) => {
141
141
  const p = l / 255;
142
142
  return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
143
143
  });
144
- return 0.2126 * n[0] + 0.7152 * n[1] + 0.0722 * n[2];
144
+ return 0.2126 * o[0] + 0.7152 * o[1] + 0.0722 * o[2];
145
145
  }
146
- function V(e, t) {
147
- const r = Math.max($(e), $(t)), n = Math.min($(e), $(t));
148
- return (r + 0.05) / (n + 0.05);
146
+ function ae(e, t) {
147
+ const r = Math.max(G(e), G(t)), o = Math.min(G(e), G(t));
148
+ return (r + 0.05) / (o + 0.05);
149
149
  }
150
- function ge(e, t = "#111111", r = "#ffffff") {
151
- const n = B(e), l = B(t), p = B(r);
152
- return !n || !l || !p ? r : V(n, l) >= V(n, p) ? t : r;
150
+ function Te(e, t = "#111111", r = "#ffffff") {
151
+ const o = te(e), l = te(t), p = te(r);
152
+ return !o || !l || !p ? r : ae(o, l) >= ae(o, p) ? t : r;
153
153
  }
154
- function xe(e = {}) {
154
+ function Ne(e = {}) {
155
155
  return {
156
- ...O,
156
+ ...ee,
157
157
  ...e,
158
158
  defaultCenter: {
159
- ...O.defaultCenter,
159
+ ...ee.defaultCenter,
160
160
  ...e.defaultCenter || {}
161
161
  },
162
- styleUrl: e.styleUrl || ne,
162
+ styleUrl: e.styleUrl || xe,
163
163
  mapPalette: e.mapPalette || "monotone",
164
- borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : O.borderRadius,
165
- tileUrl: !e.tileUrl || e.tileUrl === me ? se : e.tileUrl,
166
- tileAttribution: e.tileAttribution || re,
164
+ borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : ee.borderRadius,
165
+ tileUrl: !e.tileUrl || e.tileUrl === Ie ? me : e.tileUrl,
166
+ tileAttribution: e.tileAttribution || ge,
167
167
  phoneDisplay: e.phoneDisplay === "number" ? "number" : "call_now",
168
168
  radiusUnit: "km"
169
169
  };
170
170
  }
171
- function ye(e, t) {
171
+ function Ue(e, t) {
172
172
  return `/v1/stockist_maps/${encodeURIComponent(e)}/config`;
173
173
  }
174
- function we(e, t = {}) {
175
- const r = typeof window > "u" ? "http://localhost" : window.location.href, n = new URL(e, r);
176
- return t.query && n.searchParams.set("q", t.query), t.limit && n.searchParams.set("limit", String(t.limit)), t.center && (n.searchParams.set("lat", String(t.center.lat)), n.searchParams.set("lng", String(t.center.lng))), t.radiusKm && n.searchParams.set("radius_km", String(t.radiusKm)), t.category && n.searchParams.set("category", t.category), t.locationSearch && n.searchParams.set("location_search", "true"), n.toString();
174
+ function De(e, t = {}) {
175
+ const r = typeof window > "u" ? "http://localhost" : window.location.href, o = new URL(e, r);
176
+ return t.query && o.searchParams.set("q", t.query), t.limit && o.searchParams.set("limit", String(t.limit)), t.center && (o.searchParams.set("lat", String(t.center.lat)), o.searchParams.set("lng", String(t.center.lng))), t.radiusKm && o.searchParams.set("radius_km", String(t.radiusKm)), t.category && o.searchParams.set("category", t.category), t.locationSearch && o.searchParams.set("location_search", "true"), o.toString();
177
177
  }
178
- async function ve(e) {
178
+ async function $e(e) {
179
179
  const t = await fetch(e, { headers: { Accept: "application/json" } });
180
180
  if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
181
181
  return t.json();
182
182
  }
183
- async function ke(e, t = {}) {
184
- const r = await fetch(we(e, t), { headers: { Accept: "application/json" } });
183
+ async function He(e, t = {}) {
184
+ const r = await fetch(De(e, t), { headers: { Accept: "application/json" } });
185
185
  if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
186
- const n = await r.json();
186
+ const o = await r.json();
187
187
  return {
188
- hits: Array.isArray(n.hits) ? n.hits : [],
189
- estimatedTotalHits: Number(n.estimatedTotalHits || 0),
190
- center: n.center || null,
191
- resolvedQuery: n.resolvedQuery || null
188
+ hits: Array.isArray(o.hits) ? o.hits : [],
189
+ estimatedTotalHits: Number(o.estimatedTotalHits || 0),
190
+ center: o.center || null,
191
+ resolvedQuery: o.resolvedQuery || null
192
192
  };
193
193
  }
194
- const Ee = 6371;
195
- function D(e) {
194
+ function ie() {
195
+ var e;
196
+ return typeof ((e = globalThis.crypto) == null ? void 0 : e.randomUUID) == "function" ? globalThis.crypto.randomUUID() : `pb-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 14)}`;
197
+ }
198
+ function le(e, t) {
199
+ var r;
200
+ return {
201
+ stockist_id: e.stockist_id,
202
+ stockist_name: e.name,
203
+ categories: (r = e.categories) != null && r.length ? e.categories : e.category ? [e.category] : [],
204
+ result_rank: t,
205
+ distance_km: typeof e.distanceKm == "number" ? Math.round(e.distanceKm * 10) / 10 : void 0
206
+ };
207
+ }
208
+ function Pe(e, t, r, o, l = {}, p = fetch) {
209
+ var c;
210
+ const S = (c = e == null ? void 0 : e.analytics) == null ? void 0 : c.url;
211
+ S && p(S, {
212
+ method: "POST",
213
+ headers: { "Content-Type": "application/json" },
214
+ body: JSON.stringify({
215
+ event: t,
216
+ properties: {
217
+ ...l,
218
+ component: r,
219
+ locator_session_id: o,
220
+ page_path: typeof window > "u" ? void 0 : window.location.pathname
221
+ }
222
+ }),
223
+ keepalive: !0
224
+ }).catch(() => {
225
+ });
226
+ }
227
+ const ze = 6371;
228
+ function Q(e) {
196
229
  return e * Math.PI / 180;
197
230
  }
198
- function Se(e, t) {
199
- const r = D(t.lat - e.lat), n = D(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos(D(e.lat)) * Math.cos(D(t.lat)) * Math.sin(n / 2) ** 2;
200
- return 2 * Ee * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
231
+ function Oe(e, t) {
232
+ const r = Q(t.lat - e.lat), o = Q(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos(Q(e.lat)) * Math.cos(Q(t.lat)) * Math.sin(o / 2) ** 2;
233
+ return 2 * ze * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
201
234
  }
202
- function Le(e) {
235
+ function Ze(e) {
203
236
  return `${e.toFixed(1)} km`;
204
237
  }
205
- function Ae(e) {
238
+ function Fe(e) {
206
239
  const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
207
240
  return window.location.protocol !== "https:" && !t ? "Browser location is blocked on this local Partbot domain. Chrome and Brave only allow location access on HTTPS, localhost, or origins manually trusted in browser flags." : e.code === e.PERMISSION_DENIED ? "Location permission is blocked for this site. Allow location access in your browser settings, then try again." : e.code === e.POSITION_UNAVAILABLE ? "Your browser could not determine your location. Try again, or search by suburb or postcode." : e.code === e.TIMEOUT ? "Finding your location timed out. Try again, or search by suburb or postcode." : `Browser location failed with error code ${e.code}. Try again, or search by suburb or postcode.`;
208
241
  }
209
- function Me(e) {
242
+ function Be(e) {
210
243
  const t = e == null ? void 0 : e.trim();
211
244
  if (!t || t.startsWith("/") && !t.startsWith("//")) return null;
212
245
  const r = t.startsWith("//") ? `https:${t}` : /^[a-z][a-z\d+.-]*:/i.test(t) ? t : `https://${t}`;
213
246
  try {
214
- const n = new URL(r);
215
- return n.protocol === "http:" || n.protocol === "https:" ? n.toString() : null;
247
+ const o = new URL(r);
248
+ return o.protocol === "http:" || o.protocol === "https:" ? o.toString() : null;
216
249
  } catch {
217
250
  return null;
218
251
  }
219
252
  }
220
- function Ce(e) {
253
+ function Ke(e) {
221
254
  return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
222
255
  }
223
- function Ne(e, t = "call_now") {
256
+ function qe(e, t = "call_now") {
224
257
  return t === "number" ? e : "Call now";
225
258
  }
226
- function Te(e) {
259
+ function je(e) {
227
260
  return e.stockist_id ?? e.id;
228
261
  }
229
- function Re(e) {
262
+ function Ve(e) {
230
263
  const t = /* @__PURE__ */ new Set();
231
264
  return e.filter((r) => {
232
- const n = Te(r);
233
- return t.has(n) ? !1 : (t.add(n), !0);
265
+ const o = je(r);
266
+ return t.has(o) ? !1 : (t.add(o), !0);
234
267
  });
235
268
  }
236
- const _e = 3, Ie = 100, W = 50, Ue = 350;
237
- function G(e) {
269
+ const We = 3, Ge = 100, Y = 50, Qe = 350;
270
+ function ce(e) {
238
271
  return e.display_address || e.address;
239
272
  }
240
- function ze(e) {
273
+ function Ye(e) {
241
274
  var t;
242
275
  return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
243
276
  }
244
- function He(e, t) {
277
+ function Je(e, t) {
245
278
  const r = t == null ? void 0 : t[e];
246
279
  return r ? {
247
280
  "--pbss-category-color": r,
248
- "--pbss-category-contrast": ge(r)
281
+ "--pbss-category-contrast": Te(r)
249
282
  } : void 0;
250
283
  }
251
- function Pe(e, t) {
252
- const r = t ? e.map((n) => ({ ...n, distanceKm: Se(t, n._geo) })).sort((n, l) => (n.distanceKm || 0) - (l.distanceKm || 0)) : e;
253
- return Re(r).slice(0, _e);
284
+ function Xe(e, t) {
285
+ const r = t ? e.map((o) => ({ ...o, distanceKm: Oe(t, o._geo) })).sort((o, l) => (o.distanceKm || 0) - (l.distanceKm || 0)) : e;
286
+ return Ve(r).slice(0, We);
254
287
  }
255
- function oe({
288
+ function ye({
256
289
  token: e,
257
290
  configUrl: t,
258
291
  config: r,
259
- theme: n,
292
+ theme: o,
260
293
  initialQuery: l = "",
261
294
  viewAllUrl: p = "/pages/stockists",
262
- className: Z = ""
295
+ className: S = ""
263
296
  }) {
264
- const [c, N] = s.useState(r || null), [v, L] = s.useState(l), [A, x] = s.useState(
297
+ const [c, O] = s.useState(r || null), [_, N] = s.useState(l), [U, w] = s.useState(
265
298
  l.trim() ? "typed" : null
266
- ), [T, k] = s.useState([]), [R, _] = s.useState(!1), [E, S] = s.useState(!1), [ie, d] = s.useState(!1), [K, y] = s.useState(!1), [I, h] = s.useState(null), M = s.useRef(null), m = s.useRef(0), w = s.useRef(0), C = s.useRef(null), j = s.useId(), U = s.useMemo(
267
- () => xe({ ...(c == null ? void 0 : c.theme) || {}, ...n || {} }),
268
- [c == null ? void 0 : c.theme, n]
269
- ), b = s.useCallback(() => {
270
- C.current && (clearTimeout(C.current), C.current = null);
271
- }, []), z = s.useCallback(() => {
272
- m.current += 1, b(), k([]), _(!1), y(!1), h(null), d(!1);
273
- }, [b]), H = s.useCallback(
274
- async ({ activeQuery: o, center: a }) => {
299
+ ), [L, A] = s.useState([]), [Z, F] = s.useState(!1), [C, M] = s.useState(!1), [ve, b] = s.useState(!1), [re, v] = s.useState(!1), [B, g] = s.useState(null), R = s.useRef(null), y = s.useRef(0), k = s.useRef(0), D = s.useRef(null), ne = s.useId(), ke = s.useRef(ie()), $ = s.useRef(null), H = s.useRef(!1), oe = s.useRef(/* @__PURE__ */ new Set()), K = s.useMemo(
300
+ () => Ne({ ...(c == null ? void 0 : c.theme) || {}, ...o || {} }),
301
+ [c == null ? void 0 : c.theme, o]
302
+ ), f = s.useCallback(
303
+ (n, a = {}) => {
304
+ Pe(c, n, "search", ke.current, a);
305
+ },
306
+ [c]
307
+ ), q = s.useCallback(
308
+ (n, a, u) => {
309
+ f("stockist action clicked", {
310
+ ...le(n, a + 1),
311
+ search_id: $.current,
312
+ action_type: u,
313
+ action_placement: "search_result"
314
+ });
315
+ },
316
+ [f]
317
+ ), h = s.useCallback(() => {
318
+ D.current && (clearTimeout(D.current), D.current = null);
319
+ }, []), j = s.useCallback(() => {
320
+ y.current += 1, h(), A([]), F(!1), v(!1), g(null), b(!1), $.current = null;
321
+ }, [h]), V = s.useCallback(
322
+ async ({
323
+ activeQuery: n,
324
+ center: a,
325
+ trigger: u,
326
+ trackInteraction: d
327
+ }) => {
328
+ var z;
275
329
  if (!c) return;
276
- const u = m.current + 1;
277
- m.current = u, b(), _(!0), y(!0), h(null), d(!0);
330
+ const x = ie(), P = a ? "geolocation" : "typed", I = Date.now(), T = y.current + 1;
331
+ y.current = T, h(), F(!0), v(!0), g(null), b(!0);
278
332
  try {
279
- const g = await ke(c.search.url, {
280
- query: o,
333
+ const E = await He(c.search.url, {
334
+ query: n,
281
335
  center: a,
282
- radiusKm: W,
283
- limit: Ie,
284
- locationSearch: !a && !!o
336
+ radiusKm: Y,
337
+ limit: Ge,
338
+ locationSearch: !a && !!n
339
+ });
340
+ if (T !== y.current) return;
341
+ const X = Xe(E.hits, E.center || a);
342
+ A(X), $.current = d ? x : null, d && f("stockist search completed", {
343
+ search_id: x,
344
+ search_method: P,
345
+ search_trigger: u,
346
+ radius_km: Y,
347
+ estimated_result_count: E.estimatedTotalHits,
348
+ displayed_result_count: X.length,
349
+ has_results: X.length > 0,
350
+ resolved_location_source: ((z = E.resolvedQuery) == null ? void 0 : z.source) || void 0,
351
+ duration_ms: Date.now() - I
352
+ });
353
+ } catch (E) {
354
+ if (T !== y.current) return;
355
+ A([]), g(E instanceof Error ? E.message : "Could not search stockists"), d && f("stockist search failed", {
356
+ search_id: x,
357
+ search_method: P,
358
+ search_trigger: u,
359
+ radius_km: Y
285
360
  });
286
- if (u !== m.current) return;
287
- k(Pe(g.hits, g.center || a));
288
- } catch (g) {
289
- if (u !== m.current) return;
290
- k([]), h(g instanceof Error ? g.message : "Could not search stockists");
291
361
  } finally {
292
- u === m.current && _(!1);
362
+ T === y.current && F(!1);
293
363
  }
294
364
  },
295
- [b, c]
365
+ [h, c, f]
296
366
  );
297
367
  s.useEffect(() => {
298
- if (w.current += 1, m.current += 1, b(), N(r || null), L(l), x(l.trim() ? "typed" : null), k([]), _(!1), S(!1), y(!1), d(!1), h(null), r) return;
299
- const o = t || (e ? ye(e) : null);
300
- if (!o) return;
368
+ if (k.current += 1, y.current += 1, h(), O(r || null), N(l), w(l.trim() ? "typed" : null), A([]), F(!1), M(!1), v(!1), b(!1), g(null), H.current = !1, r) return;
369
+ const n = t || (e ? Ue(e) : null);
370
+ if (!n) return;
301
371
  let a = !1;
302
- return ve(o).then((u) => {
303
- a || N(u);
372
+ return $e(n).then((u) => {
373
+ a || O(u);
304
374
  }).catch((u) => {
305
- a || (h(u instanceof Error ? u.message : "Could not load stockist search"), y(!0), d(!0));
375
+ a || (g(u instanceof Error ? u.message : "Could not load stockist search"), v(!0), b(!0));
306
376
  }), () => {
307
377
  a = !0;
308
378
  };
309
- }, [b, t, l, r, e]), s.useEffect(() => {
310
- if (!c || A !== "typed") return;
311
- const o = v.trim();
312
- if (!o) {
313
- z();
379
+ }, [h, t, l, r, e]), s.useEffect(() => {
380
+ if (!c || U !== "typed") return;
381
+ const n = _.trim();
382
+ if (!n) {
383
+ j();
314
384
  return;
315
385
  }
316
- return b(), C.current = setTimeout(() => {
317
- C.current = null, H({ activeQuery: o, center: null });
318
- }, Ue), b;
319
- }, [b, c, v, z, H, A]), s.useEffect(() => {
320
- const o = (a) => {
321
- const u = typeof a.composedPath == "function" ? a.composedPath() : [], g = a.target instanceof Node ? a.target : null;
322
- M.current && u.includes(M.current) || M.current && g && M.current.contains(g) || d(!1);
386
+ return h(), D.current = setTimeout(() => {
387
+ D.current = null, V({
388
+ activeQuery: n,
389
+ center: null,
390
+ trigger: "query",
391
+ trackInteraction: H.current && n.length >= 3
392
+ });
393
+ }, Qe), h;
394
+ }, [h, c, _, j, V, U]), s.useEffect(() => {
395
+ const n = (a) => {
396
+ const u = typeof a.composedPath == "function" ? a.composedPath() : [], d = a.target instanceof Node ? a.target : null;
397
+ R.current && u.includes(R.current) || R.current && d && R.current.contains(d) || b(!1);
323
398
  };
324
- return document.addEventListener("pointerdown", o), () => document.removeEventListener("pointerdown", o);
399
+ return document.addEventListener("pointerdown", n), () => document.removeEventListener("pointerdown", n);
325
400
  }, []), s.useEffect(
326
401
  () => () => {
327
- w.current += 1, m.current += 1, b();
402
+ k.current += 1, y.current += 1, h();
328
403
  },
329
- [b]
404
+ [h]
330
405
  );
331
- const le = () => {
332
- if (w.current += 1, z(), x(null), S(!1), typeof window < "u" && window.isSecureContext === !1) {
333
- h("Browser location is blocked on this site. Search by suburb or postcode instead."), y(!0), d(!0);
406
+ const Ee = () => {
407
+ if (H.current = !0, k.current += 1, j(), w(null), M(!1), typeof window < "u" && window.isSecureContext === !1) {
408
+ g("Browser location is blocked on this site. Search by suburb or postcode instead."), v(!0), b(!0), f("stockist location failed", { failure_reason: "insecure" });
334
409
  return;
335
410
  }
336
411
  if (!navigator.geolocation) {
337
- h(
412
+ g(
338
413
  "This browser does not support location search. Search by suburb or postcode instead."
339
- ), y(!0), d(!0);
414
+ ), v(!0), b(!0), f("stockist location failed", { failure_reason: "unsupported" });
340
415
  return;
341
416
  }
342
- x("location"), S(!0), h(null), d(!0);
343
- const o = w.current;
417
+ w("location"), M(!0), g(null), b(!0);
418
+ const n = k.current;
344
419
  navigator.geolocation.getCurrentPosition(
345
420
  (a) => {
346
- if (o !== w.current) return;
421
+ if (n !== k.current) return;
347
422
  const u = { lat: a.coords.latitude, lng: a.coords.longitude };
348
- L(""), S(!1), H({ activeQuery: "", center: u });
423
+ N(""), M(!1), V({ activeQuery: "", center: u, trigger: "location", trackInteraction: !0 });
349
424
  },
350
425
  (a) => {
351
- o === w.current && (S(!1), y(!0), h(Ae(a)), d(!0));
426
+ n === k.current && (M(!1), v(!0), g(Fe(a)), b(!0), f("stockist location failed", {
427
+ failure_reason: {
428
+ 1: "permission_denied",
429
+ 2: "unavailable",
430
+ 3: "timeout"
431
+ }[a.code] || "unknown"
432
+ }));
352
433
  },
353
434
  { enableHighAccuracy: !1, timeout: 8e3 }
354
435
  );
355
- }, ce = () => {
356
- const o = v.trim();
357
- o && (x("typed"), H({ activeQuery: o, center: null }));
358
- }, F = ie && (R || E || K || !!I);
359
- return /* @__PURE__ */ f(
436
+ }, Se = () => {
437
+ const n = _.trim();
438
+ n && (w("typed"), H.current = !0, V({
439
+ activeQuery: n,
440
+ center: null,
441
+ trigger: "submit",
442
+ trackInteraction: n.length >= 3
443
+ }));
444
+ }, J = ve && (Z || C || re || !!B);
445
+ return s.useEffect(() => {
446
+ const n = R.current, a = $.current;
447
+ if (!n || !a || typeof IntersectionObserver > "u") return;
448
+ const u = new IntersectionObserver(
449
+ (d) => {
450
+ d.forEach((x) => {
451
+ if (!x.isIntersecting || x.intersectionRatio < 0.5) return;
452
+ const P = Number(x.target.dataset.stockistResultIndex), I = L[P];
453
+ if (!I) return;
454
+ const T = I.stockist_id || I.id, z = `${a}:${T}`;
455
+ oe.current.has(z) || (oe.current.add(z), f("stockist result viewed", {
456
+ ...le(I, P + 1),
457
+ search_id: a
458
+ }), u.unobserve(x.target));
459
+ });
460
+ },
461
+ { threshold: 0.5 }
462
+ );
463
+ return n.querySelectorAll("[data-stockist-result-index]").forEach((d) => u.observe(d)), () => u.disconnect();
464
+ }, [L, f]), /* @__PURE__ */ m(
360
465
  "div",
361
466
  {
362
- ref: M,
363
- className: `pbss-root ${U.darkMode ? "is-dark" : ""} ${Z}`.trim(),
467
+ ref: R,
468
+ className: `pbss-root ${K.darkMode ? "is-dark" : ""} ${S}`.trim(),
364
469
  style: {
365
- "--pbss-primary": U.primaryColor,
366
- "--pbss-radius": `${Math.max(0, U.borderRadius)}px`
470
+ "--pbss-primary": K.primaryColor,
471
+ "--pbss-radius": `${Math.max(0, K.borderRadius)}px`
367
472
  },
368
- onKeyDown: (o) => {
369
- o.key === "Escape" && d(!1);
473
+ onKeyDown: (n) => {
474
+ n.key === "Escape" && b(!1);
370
475
  },
371
476
  children: [
372
- /* @__PURE__ */ f("div", { className: "pbss-search-control", children: [
477
+ /* @__PURE__ */ m("div", { className: "pbss-search-control", children: [
373
478
  /* @__PURE__ */ i(
374
479
  "input",
375
480
  {
376
- "aria-controls": F ? j : void 0,
377
- "aria-expanded": F,
481
+ "aria-controls": J ? ne : void 0,
482
+ "aria-expanded": J,
378
483
  "aria-label": "Search stockists",
379
484
  autoComplete: "postal-code",
380
485
  className: "pbss-input",
381
486
  name: "stockist-search",
382
487
  placeholder: "Search suburb or postcode",
383
488
  type: "search",
384
- value: v,
385
- onChange: (o) => {
386
- const a = o.target.value;
387
- w.current += 1, z(), S(!1), L(a), x(a.trim() ? "typed" : null);
489
+ value: _,
490
+ onChange: (n) => {
491
+ const a = n.target.value;
492
+ H.current = !0, k.current += 1, j(), M(!1), N(a), w(a.trim() ? "typed" : null);
388
493
  },
389
494
  onFocus: () => {
390
- (R || E || K || I) && d(!0);
495
+ (Z || C || re || B) && b(!0);
391
496
  },
392
- onKeyDown: (o) => {
393
- o.key === "Enter" && (o.preventDefault(), ce());
497
+ onKeyDown: (n) => {
498
+ n.key === "Enter" && (n.preventDefault(), Se());
394
499
  }
395
500
  }
396
501
  ),
397
- /* @__PURE__ */ f(
502
+ /* @__PURE__ */ m(
398
503
  "button",
399
504
  {
400
- "aria-label": E ? "Finding your location" : "Use my location",
505
+ "aria-label": C ? "Finding your location" : "Use my location",
401
506
  className: "pbss-location-button",
402
- disabled: E || R || !c,
507
+ disabled: C || Z || !c,
403
508
  type: "button",
404
- onClick: le,
509
+ onClick: Ee,
405
510
  children: [
406
- E ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(ee, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
511
+ C ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(fe, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
407
512
  /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-touch-target" })
408
513
  ]
409
514
  }
410
515
  )
411
516
  ] }),
412
- F && /* @__PURE__ */ f(
517
+ J && /* @__PURE__ */ m(
413
518
  "div",
414
519
  {
415
520
  "aria-label": "Nearest stockists",
416
521
  className: "pbss-results-panel",
417
- id: j,
522
+ id: ne,
418
523
  role: "region",
419
524
  children: [
420
- /* @__PURE__ */ f("div", { className: "pbss-mobile-results-header", children: [
525
+ /* @__PURE__ */ m("div", { className: "pbss-mobile-results-header", children: [
421
526
  /* @__PURE__ */ i("span", { children: "Nearest stockists" }),
422
- /* @__PURE__ */ f(
527
+ /* @__PURE__ */ m(
423
528
  "button",
424
529
  {
425
530
  "aria-label": "Close stockist results",
426
531
  className: "pbss-results-close",
427
532
  type: "button",
428
- onClick: () => d(!1),
533
+ onClick: () => b(!1),
429
534
  children: [
430
- /* @__PURE__ */ i(te, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
535
+ /* @__PURE__ */ i(he, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
431
536
  /* @__PURE__ */ i("span", { children: "Close" })
432
537
  ]
433
538
  }
434
539
  )
435
540
  ] }),
436
- /* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: R || E ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : I ? /* @__PURE__ */ i("div", { className: "pbss-error", children: I }) : T.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: T.map((o) => {
437
- const a = Me(o.website);
438
- return /* @__PURE__ */ f("li", { className: "pbss-result", children: [
439
- /* @__PURE__ */ f("div", { className: "pbss-result-heading", children: [
440
- /* @__PURE__ */ i("div", { className: "pbss-result-name", children: o.name }),
441
- /* @__PURE__ */ i("div", { className: "pbss-result-categories", children: ze(o).map((u) => /* @__PURE__ */ i(
541
+ /* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: Z || C ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : B ? /* @__PURE__ */ i("div", { className: "pbss-error", children: B }) : L.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: L.map((n, a) => {
542
+ const u = Be(n.website);
543
+ return /* @__PURE__ */ m("li", { className: "pbss-result", "data-stockist-result-index": a, children: [
544
+ /* @__PURE__ */ m("div", { className: "pbss-result-heading", children: [
545
+ /* @__PURE__ */ i("div", { className: "pbss-result-name", children: n.name }),
546
+ /* @__PURE__ */ i("div", { className: "pbss-result-categories", children: Ye(n).map((d) => /* @__PURE__ */ i(
442
547
  "span",
443
548
  {
444
549
  className: "pbss-result-category",
445
- style: He(u, c == null ? void 0 : c.search.categoryColors),
446
- children: u
550
+ style: Je(d, c == null ? void 0 : c.search.categoryColors),
551
+ children: d
447
552
  },
448
- u
553
+ d
449
554
  )) })
450
555
  ] }),
451
- G(o) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: G(o) }),
452
- /* @__PURE__ */ f("div", { className: "pbss-result-actions", children: [
453
- o.phone && /* @__PURE__ */ i("a", { href: `tel:${o.phone}`, children: Ne(o.phone, U.phoneDisplay) }),
454
- a && /* @__PURE__ */ i("a", { href: a, rel: "noreferrer", target: "_blank", children: "Website" }),
455
- o.email && /* @__PURE__ */ i("a", { href: `mailto:${o.email}`, children: "Email" }),
456
- o.directions_available !== !1 && /* @__PURE__ */ i(
556
+ ce(n) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: ce(n) }),
557
+ /* @__PURE__ */ m("div", { className: "pbss-result-actions", children: [
558
+ n.phone && /* @__PURE__ */ i("a", { href: `tel:${n.phone}`, onClick: () => q(n, a, "phone"), children: qe(n.phone, K.phoneDisplay) }),
559
+ u && /* @__PURE__ */ i("a", { href: u, rel: "noreferrer", target: "_blank", onClick: () => q(n, a, "website"), children: "Website" }),
560
+ n.email && /* @__PURE__ */ i("a", { href: `mailto:${n.email}`, onClick: () => q(n, a, "email"), children: "Email" }),
561
+ n.directions_available !== !1 && /* @__PURE__ */ i(
457
562
  "a",
458
563
  {
459
- href: Ce(o._geo),
564
+ href: Ke(n._geo),
460
565
  rel: "noreferrer",
461
566
  target: "_blank",
567
+ onClick: () => q(n, a, "directions"),
462
568
  children: "Get directions"
463
569
  }
464
570
  ),
465
- typeof o.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Le(o.distanceKm) })
571
+ typeof n.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Ze(n.distanceKm) })
466
572
  ] })
467
- ] }, o.id);
468
- }) }) : /* @__PURE__ */ f("div", { className: "pbss-empty", children: [
573
+ ] }, n.id);
574
+ }) }) : /* @__PURE__ */ m("div", { className: "pbss-empty", children: [
469
575
  "No stockists found within ",
470
- W,
576
+ Y,
471
577
  " km. Try another location."
472
578
  ] }) }),
473
- /* @__PURE__ */ i("a", { className: "pbss-view-all", href: p || "/pages/stockists", children: "View All Stockists" })
579
+ /* @__PURE__ */ i(
580
+ "a",
581
+ {
582
+ className: "pbss-view-all",
583
+ href: p || "/pages/stockists",
584
+ onClick: () => f("stockist view all clicked", { search_id: $.current }),
585
+ children: "View All Stockists"
586
+ }
587
+ )
474
588
  ]
475
589
  }
476
590
  )
@@ -478,35 +592,35 @@ function oe({
478
592
  }
479
593
  );
480
594
  }
481
- const $e = ":host{display:block;position:relative;z-index:11}partbot-stockist-search{display:block}.pbss-root{--pbss-primary: #111111;--pbss-action-color: var(--pbss-primary);--pbss-radius: 8px;--pbss-surface: #ffffff;--pbss-control-surface: #ffffff;--pbss-border: rgb(28 25 23 / .14);--pbss-divider: rgb(28 25 23 / .09);--pbss-text: #1c1917;--pbss-muted-text: #78716c;--pbss-placeholder-text: #57534e;--pbss-danger-surface: #fff1f2;--pbss-danger-text: #9f1239;color:var(--pbss-text);container-type:inline-size;font-family:inherit;isolation:isolate;position:relative;width:100%;-webkit-font-smoothing:antialiased}.pbss-search-control{align-items:center;display:flex;min-width:0;position:relative}.pbss-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbss-control-surface);border:0;border-radius:var(--pbss-radius);box-shadow:inset 0 0 0 1px var(--pbss-border);color:var(--pbss-text);font:inherit;font-size:16px;line-height:1.5;min-height:48px;min-width:0;padding:10px 56px 10px 14px;width:100%}.pbss-input::-webkit-search-cancel-button{margin-right:4px}.pbss-input::placeholder{color:var(--pbss-placeholder-text);opacity:1}.pbss-input:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbss-action-color) 70%,transparent),0 0 0 3px color-mix(in srgb,var(--pbss-action-color) 14%,transparent);outline:none}.pbss-location-button{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;height:40px;justify-content:center;padding:0;position:absolute;right:4px;width:40px}.pbss-location-button [data-slot=icon]{flex:0 0 auto;height:16px;width:16px}.pbss-location-button:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-location-button:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}.pbss-location-button:disabled{cursor:not-allowed;opacity:.5}.pbss-touch-target{height:max(100%,48px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:max(100%,48px)}.pbss-spinner{animation:pbss-spin .7s linear infinite;border:2px solid color-mix(in srgb,var(--pbss-action-color) 22%,transparent);border-radius:999px;border-top-color:var(--pbss-action-color);height:16px;width:16px}.pbss-results-panel{background:var(--pbss-surface);border-radius:var(--pbss-radius);box-shadow:0 16px 36px #1c191729,0 2px 8px #1c191714,0 0 0 1px #1c19170f;display:grid;left:0;margin-top:6px;overflow:hidden;position:absolute;right:0;z-index:20}.pbss-results-status{min-width:0}.pbss-mobile-results-header{display:none}.pbss-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:8px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:center;display:flex;gap:8px;justify-content:space-between;min-width:0}.pbss-result-name{font-size:16px;font-weight:600;line-height:1.35;min-width:0}.pbss-result-categories{display:flex;flex:0 1 auto;flex-wrap:wrap;gap:5px;justify-content:flex-end}.pbss-result-category{background:var( --pbss-category-color, color-mix(in srgb, var(--pbss-action-color) 10%, var(--pbss-control-surface)) );border-radius:999px;color:var(--pbss-category-contrast, var(--pbss-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text);font-size:14px;line-height:1.4}.pbss-result-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px 14px}.pbss-result-actions a{color:var(--pbss-action-color);font-size:14px;font-weight:600;line-height:1.35;text-decoration:none}.pbss-result-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbss-result-actions a:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:2px}.pbss-result-distance{background:color-mix(in srgb,var(--pbss-text) 14%,transparent);border-radius:999px;color:var(--pbss-text);flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.2;padding:4px 8px}.pbss-loading,.pbss-empty,.pbss-error{padding:16px 14px}.pbss-loading,.pbss-empty{color:var(--pbss-muted-text)}.pbss-error{background:var(--pbss-danger-surface);color:var(--pbss-danger-text)}.pbss-view-all{border-top:1px solid var(--pbss-divider);color:var(--pbss-action-color);font-size:16px;font-weight:600;line-height:1.4;padding:13px 14px;text-align:center;text-decoration:none}.pbss-view-all:hover{background:color-mix(in srgb,var(--pbss-action-color) 6%,var(--pbss-surface));text-decoration:underline;text-underline-offset:3px}.pbss-view-all:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-3px}@container (min-width: 480px){.pbss-result-name,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-address,.pbss-result-actions a{font-size:12px}}@container (max-width: 479px){.pbss-mobile-results-header{align-items:center;border-bottom:1px solid var(--pbss-divider);display:flex;font-size:14px;font-weight:600;justify-content:space-between;line-height:1.35;min-height:48px;padding:4px 4px 4px 14px}.pbss-results-close{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;font:inherit;gap:6px;min-height:40px;padding:8px 10px}.pbss-results-close [data-slot=icon]{height:16px;width:16px}.pbss-results-close:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-results-close:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}}.pbss-root.is-dark{--pbss-action-color: #f5f3f0;--pbss-surface: #1c1917;--pbss-control-surface: #292524;--pbss-border: rgb(255 255 255 / .16);--pbss-divider: rgb(255 255 255 / .1);--pbss-text: #f5f3f0;--pbss-muted-text: #d6d3d1;--pbss-placeholder-text: #d6d3d1;--pbss-danger-surface: #4c0519;--pbss-danger-text: #fecdd3}.pbss-root.is-dark .pbss-results-panel{box-shadow:0 18px 38px #0000006b,0 0 0 1px #ffffff1a}@media(prefers-reduced-motion:reduce){.pbss-spinner{animation-duration:1.4s}}@keyframes pbss-spin{to{transform:rotate(360deg)}}";
482
- function De(e, t) {
483
- const r = J(e);
484
- return r.render(/* @__PURE__ */ i(oe, { ...t })), r;
595
+ const et = ":host{display:block;position:relative;z-index:11}partbot-stockist-search{display:block}.pbss-root{--pbss-primary: #111111;--pbss-action-color: var(--pbss-primary);--pbss-radius: 8px;--pbss-surface: #ffffff;--pbss-control-surface: #ffffff;--pbss-border: rgb(28 25 23 / .14);--pbss-divider: rgb(28 25 23 / .09);--pbss-text: #1c1917;--pbss-muted-text: #78716c;--pbss-placeholder-text: #57534e;--pbss-danger-surface: #fff1f2;--pbss-danger-text: #9f1239;color:var(--pbss-text);container-type:inline-size;font-family:inherit;isolation:isolate;position:relative;width:100%;-webkit-font-smoothing:antialiased}.pbss-search-control{align-items:center;display:flex;min-width:0;position:relative}.pbss-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--pbss-control-surface);border:0;border-radius:var(--pbss-radius);box-shadow:inset 0 0 0 1px var(--pbss-border);color:var(--pbss-text);font:inherit;font-size:16px;line-height:1.5;min-height:48px;min-width:0;padding:10px 56px 10px 14px;width:100%}.pbss-input::-webkit-search-cancel-button{margin-right:4px}.pbss-input::placeholder{color:var(--pbss-placeholder-text);opacity:1}.pbss-input:focus{box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--pbss-action-color) 70%,transparent),0 0 0 3px color-mix(in srgb,var(--pbss-action-color) 14%,transparent);outline:none}.pbss-location-button{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;height:40px;justify-content:center;padding:0;position:absolute;right:4px;width:40px}.pbss-location-button [data-slot=icon]{flex:0 0 auto;height:16px;width:16px}.pbss-location-button:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-location-button:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}.pbss-location-button:disabled{cursor:not-allowed;opacity:.5}.pbss-touch-target{height:max(100%,48px);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:max(100%,48px)}.pbss-spinner{animation:pbss-spin .7s linear infinite;border:2px solid color-mix(in srgb,var(--pbss-action-color) 22%,transparent);border-radius:999px;border-top-color:var(--pbss-action-color);height:16px;width:16px}.pbss-results-panel{background:var(--pbss-surface);border-radius:var(--pbss-radius);box-shadow:0 16px 36px #1c191729,0 2px 8px #1c191714,0 0 0 1px #1c19170f;display:grid;left:0;margin-top:6px;overflow:hidden;position:absolute;right:0;z-index:20}.pbss-results-status{min-width:0}.pbss-mobile-results-header{display:none}.pbss-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:8px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:center;display:flex;gap:8px;justify-content:space-between;min-width:0}.pbss-result-name{font-size:16px;font-weight:600;line-height:1.35;min-width:0}.pbss-result-categories{display:flex;flex:0 1 auto;flex-wrap:wrap;gap:5px;justify-content:flex-end}.pbss-result-category{background:var( --pbss-category-color, color-mix(in srgb, var(--pbss-action-color) 10%, var(--pbss-control-surface)) );border-radius:999px;color:var(--pbss-category-contrast, var(--pbss-action-color));font-size:11px;font-weight:700;line-height:1.2;padding:3px 7px;width:fit-content}.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text);font-size:14px;line-height:1.4}.pbss-result-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px 14px}.pbss-result-actions a{color:var(--pbss-action-color);font-size:14px;font-weight:600;line-height:1.35;text-decoration:none}.pbss-result-actions a:hover{text-decoration:underline;text-underline-offset:3px}.pbss-result-actions a:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:2px}.pbss-result-distance{background:color-mix(in srgb,var(--pbss-text) 14%,transparent);border-radius:999px;color:var(--pbss-text);flex:0 0 auto;font-size:12px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.2;padding:4px 8px}.pbss-loading,.pbss-empty,.pbss-error{padding:16px 14px}.pbss-loading,.pbss-empty{color:var(--pbss-muted-text)}.pbss-error{background:var(--pbss-danger-surface);color:var(--pbss-danger-text)}.pbss-view-all{border-top:1px solid var(--pbss-divider);color:var(--pbss-action-color);font-size:16px;font-weight:600;line-height:1.4;padding:13px 14px;text-align:center;text-decoration:none}.pbss-view-all:hover{background:color-mix(in srgb,var(--pbss-action-color) 6%,var(--pbss-surface));text-decoration:underline;text-underline-offset:3px}.pbss-view-all:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-3px}@container (min-width: 480px){.pbss-result-name,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-address,.pbss-result-actions a{font-size:12px}}@container (max-width: 479px){.pbss-mobile-results-header{align-items:center;border-bottom:1px solid var(--pbss-divider);display:flex;font-size:14px;font-weight:600;justify-content:space-between;line-height:1.35;min-height:48px;padding:4px 4px 4px 14px}.pbss-results-close{align-items:center;background:transparent;border:0;border-radius:max(4px,calc(var(--pbss-radius) - 4px));color:var(--pbss-action-color);cursor:pointer;display:inline-flex;font:inherit;gap:6px;min-height:40px;padding:8px 10px}.pbss-results-close [data-slot=icon]{height:16px;width:16px}.pbss-results-close:hover{background:color-mix(in srgb,var(--pbss-action-color) 8%,transparent)}.pbss-results-close:focus-visible{outline:2px solid var(--pbss-action-color);outline-offset:-2px}}.pbss-root.is-dark{--pbss-action-color: #f5f3f0;--pbss-surface: #1c1917;--pbss-control-surface: #292524;--pbss-border: rgb(255 255 255 / .16);--pbss-divider: rgb(255 255 255 / .1);--pbss-text: #f5f3f0;--pbss-muted-text: #d6d3d1;--pbss-placeholder-text: #d6d3d1;--pbss-danger-surface: #4c0519;--pbss-danger-text: #fecdd3}.pbss-root.is-dark .pbss-results-panel{box-shadow:0 18px 38px #0000006b,0 0 0 1px #ffffff1a}@media(prefers-reduced-motion:reduce){.pbss-spinner{animation-duration:1.4s}}@keyframes pbss-spin{to{transform:rotate(360deg)}}";
596
+ function tt(e, t) {
597
+ const r = be(e);
598
+ return r.render(/* @__PURE__ */ i(ye, { ...t })), r;
485
599
  }
486
- const Y = "data-partbot-stockist-search-styles", Q = "data-partbot-stockist-search-root";
487
- function Ze(e) {
600
+ const ue = "data-partbot-stockist-search-styles", de = "data-partbot-stockist-search-root";
601
+ function st(e) {
488
602
  return e.shadowRoot || e.attachShadow({ mode: "open" });
489
603
  }
490
- function Fe(e) {
491
- if (e.querySelector(`style[${Y}]`)) return;
604
+ function rt(e) {
605
+ if (e.querySelector(`style[${ue}]`)) return;
492
606
  const t = document.createElement("style");
493
- t.setAttribute(Y, ""), t.textContent = $e, e.prepend(t);
607
+ t.setAttribute(ue, ""), t.textContent = et, e.prepend(t);
494
608
  }
495
- function Oe(e) {
609
+ function nt(e) {
496
610
  const t = e.querySelector(
497
- `div[${Q}]`
611
+ `div[${de}]`
498
612
  );
499
613
  if (t) return t;
500
614
  const r = document.createElement("div");
501
- return r.setAttribute(Q, ""), e.appendChild(r), r;
615
+ return r.setAttribute(de, ""), e.appendChild(r), r;
502
616
  }
503
- const Be = typeof HTMLElement > "u" ? class {
617
+ const ot = typeof HTMLElement > "u" ? class {
504
618
  } : HTMLElement;
505
- class ae extends Be {
619
+ class we extends ot {
506
620
  constructor() {
507
621
  super(...arguments);
508
- P(this, "root");
509
- P(this, "mountElement");
622
+ W(this, "root");
623
+ W(this, "mountElement");
510
624
  }
511
625
  connectedCallback() {
512
626
  this.renderStockistSearch();
@@ -519,8 +633,8 @@ class ae extends Be {
519
633
  this.isConnected && this.renderStockistSearch();
520
634
  }
521
635
  renderStockistSearch() {
522
- const r = Ze(this);
523
- Fe(r), this.mountElement || (this.mountElement = Oe(r)), this.root || (this.root = J(this.mountElement)), this.root.render(/* @__PURE__ */ i(oe, { ...this.stockistSearchProps() }));
636
+ const r = st(this);
637
+ rt(r), this.mountElement || (this.mountElement = nt(r)), this.root || (this.root = be(this.mountElement)), this.root.render(/* @__PURE__ */ i(ye, { ...this.stockistSearchProps() }));
524
638
  }
525
639
  stockistSearchProps() {
526
640
  return {
@@ -531,17 +645,17 @@ class ae extends Be {
531
645
  };
532
646
  }
533
647
  }
534
- P(ae, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
535
- function X() {
536
- typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", ae);
648
+ W(we, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
649
+ function pe() {
650
+ typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", we);
537
651
  }
538
- typeof window < "u" && (X(), window.PartbotStockistSearch = {
539
- defineCustomElement: X,
540
- mount: De
652
+ typeof window < "u" && (pe(), window.PartbotStockistSearch = {
653
+ defineCustomElement: pe,
654
+ mount: tt
541
655
  });
542
656
  export {
543
- ae as PartbotStockistSearchElement,
544
- oe as StockistSearch,
545
- X as defineStockistSearchElement,
546
- De as mountStockistSearch
657
+ we as PartbotStockistSearchElement,
658
+ ye as StockistSearch,
659
+ pe as defineStockistSearchElement,
660
+ tt as mountStockistSearch
547
661
  };