@partbot/stockist-map 0.1.2 → 0.1.3

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,7 +1,7 @@
1
1
  var ae = Object.defineProperty;
2
2
  var ie = (e, t, r) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
3
  var O = (e, t, r) => ie(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { jsxs as y, jsx as l } from "react/jsx-runtime";
4
+ import { jsxs as y, jsx as c } from "react/jsx-runtime";
5
5
  import { createRoot as Y } from "react-dom/client";
6
6
  import * as s from "react";
7
7
  import { createContext as le } from "react";
@@ -15,10 +15,10 @@ const ce = le({
15
15
  const {
16
16
  alt: r,
17
17
  color: n,
18
- size: c,
18
+ size: i,
19
19
  weight: M,
20
- mirrored: z,
21
- children: i,
20
+ mirrored: D,
21
+ children: l,
22
22
  weights: R,
23
23
  ...w
24
24
  } = e, {
@@ -33,16 +33,16 @@ const ce = le({
33
33
  {
34
34
  ref: t,
35
35
  xmlns: "http://www.w3.org/2000/svg",
36
- width: c ?? A,
37
- height: c ?? A,
36
+ width: i ?? A,
37
+ height: i ?? A,
38
38
  fill: n ?? S,
39
39
  viewBox: "0 0 256 256",
40
- transform: z || N ? "scale(-1, 1)" : void 0,
40
+ transform: D || N ? "scale(-1, 1)" : void 0,
41
41
  ...v,
42
42
  ...w
43
43
  },
44
44
  !!r && /* @__PURE__ */ s.createElement("title", null, r),
45
- i,
45
+ l,
46
46
  R.get(M ?? m)
47
47
  );
48
48
  }
@@ -81,7 +81,7 @@ const ue = /* @__PURE__ */ new Map([
81
81
  ]
82
82
  ]), W = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(Q, { ref: t, ...e, weights: ue }));
83
83
  W.displayName = "NavigationArrowIcon";
84
- const de = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", J = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", X = "OpenStreetMap contributors, CARTO", ee = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", F = {
84
+ const de = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", J = "https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}@2x.png", X = "OpenStreetMap contributors, CARTO", ee = "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json", q = {
85
85
  primaryColor: "#111111",
86
86
  markerColor: "#111111",
87
87
  borderRadius: 8,
@@ -96,15 +96,15 @@ const de = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", J = "https://basema
96
96
  };
97
97
  function pe(e = {}) {
98
98
  return {
99
- ...F,
99
+ ...q,
100
100
  ...e,
101
101
  defaultCenter: {
102
- ...F.defaultCenter,
102
+ ...q.defaultCenter,
103
103
  ...e.defaultCenter || {}
104
104
  },
105
105
  styleUrl: e.styleUrl || ee,
106
106
  mapPalette: e.mapPalette || "monotone",
107
- borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : F.borderRadius,
107
+ borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : q.borderRadius,
108
108
  tileUrl: !e.tileUrl || e.tileUrl === de ? J : e.tileUrl,
109
109
  tileAttribution: e.tileAttribution || X,
110
110
  radiusUnit: "km"
@@ -138,8 +138,8 @@ function H(e) {
138
138
  return e * Math.PI / 180;
139
139
  }
140
140
  function xe(e, t) {
141
- const r = H(t.lat - e.lat), n = H(t.lng - e.lng), c = Math.sin(r / 2) ** 2 + Math.cos(H(e.lat)) * Math.cos(H(t.lat)) * Math.sin(n / 2) ** 2;
142
- return 2 * ge * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c));
141
+ const r = H(t.lat - e.lat), n = H(t.lng - e.lng), i = Math.sin(r / 2) ** 2 + Math.cos(H(e.lat)) * Math.cos(H(t.lat)) * Math.sin(n / 2) ** 2;
142
+ return 2 * ge * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i));
143
143
  }
144
144
  function ye(e) {
145
145
  return `${e.toFixed(1)} km`;
@@ -148,43 +148,57 @@ function we(e) {
148
148
  const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
149
149
  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.`;
150
150
  }
151
- const q = 3, $ = 50, ve = 350;
152
- function Ee(e, t) {
153
- return t ? e.map((r) => ({ ...r, distanceKm: xe(t, r._geo) })).sort((r, n) => (r.distanceKm || 0) - (n.distanceKm || 0)).slice(0, q) : e.slice(0, q);
151
+ function ve(e) {
152
+ return e.stockist_id ?? e.id;
153
+ }
154
+ function ke(e) {
155
+ const t = /* @__PURE__ */ new Set();
156
+ return e.filter((r) => {
157
+ const n = ve(r);
158
+ return t.has(n) ? !1 : (t.add(n), !0);
159
+ });
160
+ }
161
+ const Ee = 3, Se = 100, Z = 50, Ae = 350;
162
+ function $(e) {
163
+ return e.display_address || e.address;
164
+ }
165
+ function Te(e, t) {
166
+ const r = t ? e.map((n) => ({ ...n, distanceKm: xe(t, n._geo) })).sort((n, i) => (n.distanceKm || 0) - (i.distanceKm || 0)) : e;
167
+ return ke(r).slice(0, Ee);
154
168
  }
155
169
  function te({
156
170
  token: e,
157
171
  configUrl: t,
158
172
  config: r,
159
173
  theme: n,
160
- initialQuery: c = "",
174
+ initialQuery: i = "",
161
175
  viewAllUrl: M = "/pages/stockists",
162
- className: z = ""
176
+ className: D = ""
163
177
  }) {
164
- const [i, R] = s.useState(r || null), [w, S] = s.useState(c), [A, m] = s.useState(
165
- c.trim() ? "typed" : null
166
- ), [N, v] = s.useState([]), [L, I] = s.useState(!1), [E, k] = s.useState(!1), [re, d] = s.useState(!1), [K, g] = s.useState(!1), [_, b] = s.useState(null), T = s.useRef(null), f = s.useRef(0), x = s.useRef(0), C = s.useRef(null), Z = s.useId(), B = s.useMemo(
167
- () => pe({ ...(i == null ? void 0 : i.theme) || {}, ...n || {} }),
168
- [i == null ? void 0 : i.theme, n]
178
+ const [l, R] = s.useState(r || null), [w, S] = s.useState(i), [A, m] = s.useState(
179
+ i.trim() ? "typed" : null
180
+ ), [N, v] = s.useState([]), [L, I] = s.useState(!1), [k, E] = s.useState(!1), [re, d] = s.useState(!1), [F, g] = s.useState(!1), [_, b] = s.useState(null), T = s.useRef(null), f = s.useRef(0), x = s.useRef(0), C = s.useRef(null), K = s.useId(), z = s.useMemo(
181
+ () => pe({ ...(l == null ? void 0 : l.theme) || {}, ...n || {} }),
182
+ [l == null ? void 0 : l.theme, n]
169
183
  ), p = s.useCallback(() => {
170
184
  C.current && (clearTimeout(C.current), C.current = null);
171
185
  }, []), U = s.useCallback(() => {
172
186
  f.current += 1, p(), v([]), I(!1), g(!1), b(null), d(!1);
173
187
  }, [p]), P = s.useCallback(
174
188
  async ({ activeQuery: o, center: a }) => {
175
- if (!i) return;
189
+ if (!l) return;
176
190
  const u = f.current + 1;
177
191
  f.current = u, p(), I(!0), g(!0), b(null), d(!0);
178
192
  try {
179
- const h = await me(i.search.url, {
193
+ const h = await me(l.search.url, {
180
194
  query: o,
181
195
  center: a,
182
- radiusKm: $,
183
- limit: q,
196
+ radiusKm: Z,
197
+ limit: Se,
184
198
  locationSearch: !a && !!o
185
199
  });
186
200
  if (u !== f.current) return;
187
- v(Ee(h.hits, h.center || a));
201
+ v(Te(h.hits, h.center || a));
188
202
  } catch (h) {
189
203
  if (u !== f.current) return;
190
204
  v([]), b(h instanceof Error ? h.message : "Could not search stockists");
@@ -192,10 +206,10 @@ function te({
192
206
  u === f.current && I(!1);
193
207
  }
194
208
  },
195
- [p, i]
209
+ [p, l]
196
210
  );
197
211
  s.useEffect(() => {
198
- if (x.current += 1, f.current += 1, p(), R(r || null), S(c), m(c.trim() ? "typed" : null), v([]), I(!1), k(!1), g(!1), d(!1), b(null), r) return;
212
+ if (x.current += 1, f.current += 1, p(), R(r || null), S(i), m(i.trim() ? "typed" : null), v([]), I(!1), E(!1), g(!1), d(!1), b(null), r) return;
199
213
  const o = t || (e ? be(e) : null);
200
214
  if (!o) return;
201
215
  let a = !1;
@@ -206,8 +220,8 @@ function te({
206
220
  }), () => {
207
221
  a = !0;
208
222
  };
209
- }, [p, t, c, r, e]), s.useEffect(() => {
210
- if (!i || A !== "typed") return;
223
+ }, [p, t, i, r, e]), s.useEffect(() => {
224
+ if (!l || A !== "typed") return;
211
225
  const o = w.trim();
212
226
  if (!o) {
213
227
  U();
@@ -215,8 +229,8 @@ function te({
215
229
  }
216
230
  return p(), C.current = setTimeout(() => {
217
231
  C.current = null, P({ activeQuery: o, center: null });
218
- }, ve), p;
219
- }, [p, i, w, U, P, A]), s.useEffect(() => {
232
+ }, Ae), p;
233
+ }, [p, l, w, U, P, A]), s.useEffect(() => {
220
234
  const o = (a) => {
221
235
  const u = typeof a.composedPath == "function" ? a.composedPath() : [], h = a.target instanceof Node ? a.target : null;
222
236
  T.current && u.includes(T.current) || T.current && h && T.current.contains(h) || d(!1);
@@ -229,7 +243,7 @@ function te({
229
243
  [p]
230
244
  );
231
245
  const oe = () => {
232
- if (x.current += 1, U(), m(null), k(!1), typeof window < "u" && window.isSecureContext === !1) {
246
+ if (x.current += 1, U(), m(null), E(!1), typeof window < "u" && window.isSecureContext === !1) {
233
247
  b("Browser location is blocked on this site. Search by suburb or postcode instead."), g(!0), d(!0);
234
248
  return;
235
249
  }
@@ -239,42 +253,42 @@ function te({
239
253
  ), g(!0), d(!0);
240
254
  return;
241
255
  }
242
- m("location"), k(!0), b(null), d(!0);
256
+ m("location"), E(!0), b(null), d(!0);
243
257
  const o = x.current;
244
258
  navigator.geolocation.getCurrentPosition(
245
259
  (a) => {
246
260
  if (o !== x.current) return;
247
261
  const u = { lat: a.coords.latitude, lng: a.coords.longitude };
248
- S(""), k(!1), P({ activeQuery: "", center: u });
262
+ S(""), E(!1), P({ activeQuery: "", center: u });
249
263
  },
250
264
  (a) => {
251
- o === x.current && (k(!1), g(!0), b(we(a)), d(!0));
265
+ o === x.current && (E(!1), g(!0), b(we(a)), d(!0));
252
266
  },
253
267
  { enableHighAccuracy: !1, timeout: 8e3 }
254
268
  );
255
269
  }, ne = () => {
256
270
  const o = w.trim();
257
271
  o && (m("typed"), P({ activeQuery: o, center: null }));
258
- }, D = re && (L || E || K || !!_);
272
+ }, B = re && (L || k || F || !!_);
259
273
  return /* @__PURE__ */ y(
260
274
  "div",
261
275
  {
262
276
  ref: T,
263
- className: `pbss-root ${B.darkMode ? "is-dark" : ""} ${z}`.trim(),
277
+ className: `pbss-root ${z.darkMode ? "is-dark" : ""} ${D}`.trim(),
264
278
  style: {
265
- "--pbss-primary": B.primaryColor,
266
- "--pbss-radius": `${Math.max(0, B.borderRadius)}px`
279
+ "--pbss-primary": z.primaryColor,
280
+ "--pbss-radius": `${Math.max(0, z.borderRadius)}px`
267
281
  },
268
282
  onKeyDown: (o) => {
269
283
  o.key === "Escape" && d(!1);
270
284
  },
271
285
  children: [
272
286
  /* @__PURE__ */ y("div", { className: "pbss-search-control", children: [
273
- /* @__PURE__ */ l(
287
+ /* @__PURE__ */ c(
274
288
  "input",
275
289
  {
276
- "aria-controls": D ? Z : void 0,
277
- "aria-expanded": D,
290
+ "aria-controls": B ? K : void 0,
291
+ "aria-expanded": B,
278
292
  "aria-label": "Search stockists",
279
293
  autoComplete: "postal-code",
280
294
  className: "pbss-input",
@@ -284,10 +298,10 @@ function te({
284
298
  value: w,
285
299
  onChange: (o) => {
286
300
  const a = o.target.value;
287
- x.current += 1, U(), k(!1), S(a), m(a.trim() ? "typed" : null);
301
+ x.current += 1, U(), E(!1), S(a), m(a.trim() ? "typed" : null);
288
302
  },
289
303
  onFocus: () => {
290
- (L || E || K || _) && d(!0);
304
+ (L || k || F || _) && d(!0);
291
305
  },
292
306
  onKeyDown: (o) => {
293
307
  o.key === "Enter" && (o.preventDefault(), ne());
@@ -297,38 +311,38 @@ function te({
297
311
  /* @__PURE__ */ y(
298
312
  "button",
299
313
  {
300
- "aria-label": E ? "Finding your location" : "Use my location",
314
+ "aria-label": k ? "Finding your location" : "Use my location",
301
315
  className: "pbss-location-button",
302
- disabled: E || L || !i,
316
+ disabled: k || L || !l,
303
317
  type: "button",
304
318
  onClick: oe,
305
319
  children: [
306
- E ? /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ l(W, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
307
- /* @__PURE__ */ l("span", { "aria-hidden": "true", className: "pbss-touch-target" })
320
+ k ? /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ c(W, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
321
+ /* @__PURE__ */ c("span", { "aria-hidden": "true", className: "pbss-touch-target" })
308
322
  ]
309
323
  }
310
324
  )
311
325
  ] }),
312
- D && /* @__PURE__ */ y(
326
+ B && /* @__PURE__ */ y(
313
327
  "div",
314
328
  {
315
329
  "aria-label": "Nearest stockists",
316
330
  className: "pbss-results-panel",
317
- id: Z,
331
+ id: K,
318
332
  role: "region",
319
333
  children: [
320
- /* @__PURE__ */ l("div", { "aria-live": "polite", className: "pbss-results-status", children: L || E ? /* @__PURE__ */ l("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ l("div", { className: "pbss-error", children: _ }) : N.length > 0 ? /* @__PURE__ */ l("ul", { className: "pbss-results", role: "list", children: N.map((o) => /* @__PURE__ */ y("li", { className: "pbss-result", children: [
334
+ /* @__PURE__ */ c("div", { "aria-live": "polite", className: "pbss-results-status", children: L || k ? /* @__PURE__ */ c("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ c("div", { className: "pbss-error", children: _ }) : N.length > 0 ? /* @__PURE__ */ c("ul", { className: "pbss-results", role: "list", children: N.map((o) => /* @__PURE__ */ y("li", { className: "pbss-result", children: [
321
335
  /* @__PURE__ */ y("div", { className: "pbss-result-heading", children: [
322
- /* @__PURE__ */ l("div", { className: "pbss-result-name", children: o.name }),
323
- typeof o.distanceKm == "number" && /* @__PURE__ */ l("div", { className: "pbss-result-distance", children: ye(o.distanceKm) })
336
+ /* @__PURE__ */ c("div", { className: "pbss-result-name", children: o.name }),
337
+ typeof o.distanceKm == "number" && /* @__PURE__ */ c("div", { className: "pbss-result-distance", children: ye(o.distanceKm) })
324
338
  ] }),
325
- o.address && /* @__PURE__ */ l("div", { className: "pbss-result-address", children: o.address })
339
+ $(o) && /* @__PURE__ */ c("div", { className: "pbss-result-address", children: $(o) })
326
340
  ] }, o.id)) }) : /* @__PURE__ */ y("div", { className: "pbss-empty", children: [
327
341
  "No stockists found within ",
328
- $,
342
+ Z,
329
343
  " km. Try another location."
330
344
  ] }) }),
331
- /* @__PURE__ */ l("a", { className: "pbss-view-all", href: M || "/pages/stockists", children: "View All Stockists" })
345
+ /* @__PURE__ */ c("a", { className: "pbss-view-all", href: M || "/pages/stockists", children: "View All Stockists" })
332
346
  ]
333
347
  }
334
348
  )
@@ -336,21 +350,21 @@ function te({
336
350
  }
337
351
  );
338
352
  }
339
- const ke = ":host{display:block}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-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:4px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:baseline;display:flex;gap:12px;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-distance{color:var(--pbss-action-color);flex:0 0 auto;font-size:14px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.35}.pbss-result-address,.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text)}.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-result-address,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-distance{font-size:12px}}.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)}}";
340
- function Se(e, t) {
353
+ const Ce = ":host{display:block}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-results{list-style:none;margin:0;padding:0}.pbss-result{display:grid;gap:4px;padding:14px}.pbss-result+.pbss-result{border-top:1px solid var(--pbss-divider)}.pbss-result-heading{align-items:baseline;display:flex;gap:12px;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-distance{color:var(--pbss-action-color);flex:0 0 auto;font-size:14px;font-variant-numeric:tabular-nums;font-weight:600;line-height:1.35}.pbss-result-address,.pbss-loading,.pbss-empty,.pbss-error{font-size:16px;line-height:1.45}.pbss-result-address{color:var(--pbss-muted-text)}.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-result-address,.pbss-loading,.pbss-empty,.pbss-error,.pbss-view-all{font-size:14px}.pbss-result-distance{font-size:12px}}.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)}}";
354
+ function Me(e, t) {
341
355
  const r = Y(e);
342
- return r.render(/* @__PURE__ */ l(te, { ...t })), r;
356
+ return r.render(/* @__PURE__ */ c(te, { ...t })), r;
343
357
  }
344
358
  const j = "data-partbot-stockist-search-styles", G = "data-partbot-stockist-search-root";
345
- function Ae(e) {
359
+ function Re(e) {
346
360
  return e.shadowRoot || e.attachShadow({ mode: "open" });
347
361
  }
348
- function Te(e) {
362
+ function Ne(e) {
349
363
  if (e.querySelector(`style[${j}]`)) return;
350
364
  const t = document.createElement("style");
351
- t.setAttribute(j, ""), t.textContent = ke, e.prepend(t);
365
+ t.setAttribute(j, ""), t.textContent = Ce, e.prepend(t);
352
366
  }
353
- function Ce(e) {
367
+ function Le(e) {
354
368
  const t = e.querySelector(
355
369
  `div[${G}]`
356
370
  );
@@ -358,9 +372,9 @@ function Ce(e) {
358
372
  const r = document.createElement("div");
359
373
  return r.setAttribute(G, ""), e.appendChild(r), r;
360
374
  }
361
- const Me = typeof HTMLElement > "u" ? class {
375
+ const Ie = typeof HTMLElement > "u" ? class {
362
376
  } : HTMLElement;
363
- class se extends Me {
377
+ class se extends Ie {
364
378
  constructor() {
365
379
  super(...arguments);
366
380
  O(this, "root");
@@ -377,8 +391,8 @@ class se extends Me {
377
391
  this.isConnected && this.renderStockistSearch();
378
392
  }
379
393
  renderStockistSearch() {
380
- const r = Ae(this);
381
- Te(r), this.mountElement || (this.mountElement = Ce(r)), this.root || (this.root = Y(this.mountElement)), this.root.render(/* @__PURE__ */ l(te, { ...this.stockistSearchProps() }));
394
+ const r = Re(this);
395
+ Ne(r), this.mountElement || (this.mountElement = Le(r)), this.root || (this.root = Y(this.mountElement)), this.root.render(/* @__PURE__ */ c(te, { ...this.stockistSearchProps() }));
382
396
  }
383
397
  stockistSearchProps() {
384
398
  return {
@@ -395,11 +409,11 @@ function V() {
395
409
  }
396
410
  typeof window < "u" && (V(), window.PartbotStockistSearch = {
397
411
  defineCustomElement: V,
398
- mount: Se
412
+ mount: Me
399
413
  });
400
414
  export {
401
415
  se as PartbotStockistSearchElement,
402
416
  te as StockistSearch,
403
417
  V as defineStockistSearchElement,
404
- Se as mountStockistSearch
418
+ Me as mountStockistSearch
405
419
  };