@partbot/stockist-map 0.1.8 → 0.1.10
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.
- package/dist/stockist-map.js +6 -1
- package/dist/stockist-map.umd.js +1 -1
- package/dist/stockist-search.js +290 -241
- package/dist/stockist-search.umd.js +9 -9
- package/package.json +1 -1
package/dist/stockist-search.js
CHANGED
|
@@ -1,87 +1,120 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as
|
|
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 H = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
5
5
|
import { createRoot as J } from "react-dom/client";
|
|
6
|
-
import * as
|
|
7
|
-
import { createContext as
|
|
8
|
-
const
|
|
6
|
+
import * as s from "react";
|
|
7
|
+
import { createContext as pe } from "react";
|
|
8
|
+
const be = pe({
|
|
9
9
|
color: "currentColor",
|
|
10
10
|
size: "1em",
|
|
11
11
|
weight: "regular",
|
|
12
12
|
mirrored: !1
|
|
13
|
-
}),
|
|
13
|
+
}), q = s.forwardRef(
|
|
14
14
|
(e, t) => {
|
|
15
15
|
const {
|
|
16
|
-
alt:
|
|
17
|
-
color:
|
|
18
|
-
size:
|
|
19
|
-
weight:
|
|
20
|
-
mirrored:
|
|
16
|
+
alt: r,
|
|
17
|
+
color: n,
|
|
18
|
+
size: l,
|
|
19
|
+
weight: p,
|
|
20
|
+
mirrored: Z,
|
|
21
21
|
children: c,
|
|
22
22
|
weights: N,
|
|
23
23
|
...v
|
|
24
24
|
} = e, {
|
|
25
|
-
color:
|
|
26
|
-
size:
|
|
25
|
+
color: L = "currentColor",
|
|
26
|
+
size: A,
|
|
27
27
|
weight: x = "regular",
|
|
28
|
-
mirrored:
|
|
29
|
-
...
|
|
30
|
-
} =
|
|
31
|
-
return /* @__PURE__ */
|
|
28
|
+
mirrored: T = !1,
|
|
29
|
+
...E
|
|
30
|
+
} = s.useContext(be);
|
|
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:
|
|
37
|
-
height:
|
|
38
|
-
fill:
|
|
36
|
+
width: l ?? A,
|
|
37
|
+
height: l ?? A,
|
|
38
|
+
fill: n ?? L,
|
|
39
39
|
viewBox: "0 0 256 256",
|
|
40
|
-
transform:
|
|
41
|
-
...
|
|
40
|
+
transform: Z || T ? "scale(-1, 1)" : void 0,
|
|
41
|
+
...E,
|
|
42
42
|
...v
|
|
43
43
|
},
|
|
44
|
-
!!
|
|
44
|
+
!!r && /* @__PURE__ */ s.createElement("title", null, r),
|
|
45
45
|
c,
|
|
46
|
-
N.get(
|
|
46
|
+
N.get(p ?? x)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
|
|
51
|
-
const
|
|
50
|
+
q.displayName = "IconBase";
|
|
51
|
+
const fe = /* @__PURE__ */ new Map([
|
|
52
52
|
[
|
|
53
53
|
"bold",
|
|
54
|
-
/* @__PURE__ */
|
|
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" }))
|
|
55
55
|
],
|
|
56
56
|
[
|
|
57
57
|
"duotone",
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
59
59
|
"path",
|
|
60
60
|
{
|
|
61
61
|
d: "M234.35,129,152,152,129,234.35a8,8,0,0,1-15.21.27l-65.28-176A8,8,0,0,1,58.63,48.46l176,65.28A8,8,0,0,1,234.35,129Z",
|
|
62
62
|
opacity: "0.2"
|
|
63
63
|
}
|
|
64
|
-
), /* @__PURE__ */
|
|
64
|
+
), /* @__PURE__ */ s.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
|
|
65
65
|
],
|
|
66
66
|
[
|
|
67
67
|
"fill",
|
|
68
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M248,121.58a15.76,15.76,0,0,1-11.29,15l-.2.06-78,21.84-21.84,78-.06.2a15.77,15.77,0,0,1-15,11.29h-.3a15.77,15.77,0,0,1-15.07-10.67L41,61.41a1,1,0,0,1-.05-.16A16,16,0,0,1,61.25,40.9l.16.05,175.92,65.26A15.78,15.78,0,0,1,248,121.58Z" }))
|
|
69
69
|
],
|
|
70
70
|
[
|
|
71
71
|
"light",
|
|
72
|
-
/* @__PURE__ */
|
|
72
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M236.65,108.1,60.72,42.83l-.13,0A14,14,0,0,0,42.78,60.59s0,.09,0,.13L108.1,236.65A13.77,13.77,0,0,0,121.28,246h.26a13.8,13.8,0,0,0,13.14-9.88l0-.15,22.14-79.1L236,134.73l.15,0a14,14,0,0,0,.53-26.58Zm-4,15.1-82.26,23a6,6,0,0,0-4.16,4.16l-23,82.26a1.85,1.85,0,0,1-1.86,1.36,1.82,1.82,0,0,1-1.92-1.35.61.61,0,0,0,0-.12L54.11,56.62a2,2,0,0,1,2.51-2.51l175.91,65.26.12,0a2,2,0,0,1,0,3.79Z" }))
|
|
73
73
|
],
|
|
74
74
|
[
|
|
75
75
|
"regular",
|
|
76
|
-
/* @__PURE__ */
|
|
76
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M237.33,106.21,61.41,41l-.16-.05A16,16,0,0,0,40.9,61.25a1,1,0,0,0,.05.16l65.26,175.92A15.77,15.77,0,0,0,121.28,248h.3a15.77,15.77,0,0,0,15-11.29l.06-.2,21.84-78,78-21.84.2-.06a16,16,0,0,0,.62-30.38ZM149.84,144.3a8,8,0,0,0-5.54,5.54L121.3,232l-.06-.17L56,56l175.82,65.22.16.06Z" }))
|
|
77
77
|
],
|
|
78
78
|
[
|
|
79
79
|
"thin",
|
|
80
|
-
/* @__PURE__ */
|
|
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 =
|
|
82
|
+
]), ee = s.forwardRef((e, t) => /* @__PURE__ */ s.createElement(q, { ref: t, ...e, weights: fe }));
|
|
83
83
|
ee.displayName = "NavigationArrowIcon";
|
|
84
|
-
const
|
|
84
|
+
const he = /* @__PURE__ */ new Map([
|
|
85
|
+
[
|
|
86
|
+
"bold",
|
|
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" }))
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"duotone",
|
|
91
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement(
|
|
92
|
+
"path",
|
|
93
|
+
{
|
|
94
|
+
d: "M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",
|
|
95
|
+
opacity: "0.2"
|
|
96
|
+
}
|
|
97
|
+
), /* @__PURE__ */ s.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
"fill",
|
|
101
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
"light",
|
|
105
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z" }))
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
"regular",
|
|
109
|
+
/* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z" }))
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"thin",
|
|
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
|
+
]
|
|
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", D = {
|
|
85
118
|
primaryColor: "#111111",
|
|
86
119
|
markerColor: "#111111",
|
|
87
120
|
borderRadius: 8,
|
|
@@ -89,95 +122,95 @@ const fe = "https://tile.openstreetmap.org/{z}/{x}/{y}.png", te = "https://basem
|
|
|
89
122
|
defaultZoom: 5,
|
|
90
123
|
defaultCenter: { lat: -25.2744, lng: 133.7751 },
|
|
91
124
|
darkMode: !1,
|
|
92
|
-
styleUrl:
|
|
125
|
+
styleUrl: ne,
|
|
93
126
|
mapPalette: "monotone",
|
|
94
|
-
tileUrl:
|
|
95
|
-
tileAttribution:
|
|
127
|
+
tileUrl: se,
|
|
128
|
+
tileAttribution: re
|
|
96
129
|
};
|
|
97
|
-
function
|
|
98
|
-
const t = e.trim().replace(/^#/, ""),
|
|
99
|
-
return /^[0-9a-f]{6}$/i.test(
|
|
100
|
-
r: Number.parseInt(
|
|
101
|
-
g: Number.parseInt(
|
|
102
|
-
b: Number.parseInt(
|
|
130
|
+
function B(e) {
|
|
131
|
+
const t = e.trim().replace(/^#/, ""), r = t.length === 3 ? t.split("").map((n) => `${n}${n}`).join("") : t;
|
|
132
|
+
return /^[0-9a-f]{6}$/i.test(r) ? {
|
|
133
|
+
r: Number.parseInt(r.slice(0, 2), 16),
|
|
134
|
+
g: Number.parseInt(r.slice(2, 4), 16),
|
|
135
|
+
b: Number.parseInt(r.slice(4, 6), 16)
|
|
103
136
|
} : null;
|
|
104
137
|
}
|
|
105
|
-
function
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
return
|
|
138
|
+
function P({ r: e, g: t, b: r }) {
|
|
139
|
+
const n = [e, t, r].map((l) => {
|
|
140
|
+
const p = l / 255;
|
|
141
|
+
return p <= 0.03928 ? p / 12.92 : ((p + 0.055) / 1.055) ** 2.4;
|
|
109
142
|
});
|
|
110
|
-
return 0.2126 *
|
|
143
|
+
return 0.2126 * n[0] + 0.7152 * n[1] + 0.0722 * n[2];
|
|
111
144
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
return (
|
|
145
|
+
function V(e, t) {
|
|
146
|
+
const r = Math.max(P(e), P(t)), n = Math.min(P(e), P(t));
|
|
147
|
+
return (r + 0.05) / (n + 0.05);
|
|
115
148
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
return !
|
|
149
|
+
function ge(e, t = "#111111", r = "#ffffff") {
|
|
150
|
+
const n = B(e), l = B(t), p = B(r);
|
|
151
|
+
return !n || !l || !p ? r : V(n, l) >= V(n, p) ? t : r;
|
|
119
152
|
}
|
|
120
|
-
function
|
|
153
|
+
function xe(e = {}) {
|
|
121
154
|
return {
|
|
122
|
-
...
|
|
155
|
+
...D,
|
|
123
156
|
...e,
|
|
124
157
|
defaultCenter: {
|
|
125
|
-
...
|
|
158
|
+
...D.defaultCenter,
|
|
126
159
|
...e.defaultCenter || {}
|
|
127
160
|
},
|
|
128
|
-
styleUrl: e.styleUrl ||
|
|
161
|
+
styleUrl: e.styleUrl || ne,
|
|
129
162
|
mapPalette: e.mapPalette || "monotone",
|
|
130
|
-
borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) :
|
|
131
|
-
tileUrl: !e.tileUrl || e.tileUrl ===
|
|
132
|
-
tileAttribution: e.tileAttribution ||
|
|
163
|
+
borderRadius: Number.isFinite(Number(e.borderRadius)) ? Number(e.borderRadius) : D.borderRadius,
|
|
164
|
+
tileUrl: !e.tileUrl || e.tileUrl === me ? se : e.tileUrl,
|
|
165
|
+
tileAttribution: e.tileAttribution || re,
|
|
133
166
|
radiusUnit: "km"
|
|
134
167
|
};
|
|
135
168
|
}
|
|
136
|
-
function
|
|
169
|
+
function ye(e, t) {
|
|
137
170
|
return `/v1/stockist_maps/${encodeURIComponent(e)}/config`;
|
|
138
171
|
}
|
|
139
|
-
function
|
|
140
|
-
const
|
|
141
|
-
return t.query &&
|
|
172
|
+
function we(e, t = {}) {
|
|
173
|
+
const r = typeof window > "u" ? "http://localhost" : window.location.href, n = new URL(e, r);
|
|
174
|
+
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();
|
|
142
175
|
}
|
|
143
|
-
async function
|
|
176
|
+
async function ve(e) {
|
|
144
177
|
const t = await fetch(e, { headers: { Accept: "application/json" } });
|
|
145
178
|
if (!t.ok) throw new Error(`Could not load stockist map config (${t.status})`);
|
|
146
179
|
return t.json();
|
|
147
180
|
}
|
|
148
|
-
async function
|
|
149
|
-
const
|
|
150
|
-
if (!
|
|
151
|
-
const
|
|
181
|
+
async function Ee(e, t = {}) {
|
|
182
|
+
const r = await fetch(we(e, t), { headers: { Accept: "application/json" } });
|
|
183
|
+
if (!r.ok) throw new Error(`Could not search stockists (${r.status})`);
|
|
184
|
+
const n = await r.json();
|
|
152
185
|
return {
|
|
153
|
-
hits: Array.isArray(
|
|
154
|
-
estimatedTotalHits: Number(
|
|
155
|
-
center:
|
|
156
|
-
resolvedQuery:
|
|
186
|
+
hits: Array.isArray(n.hits) ? n.hits : [],
|
|
187
|
+
estimatedTotalHits: Number(n.estimatedTotalHits || 0),
|
|
188
|
+
center: n.center || null,
|
|
189
|
+
resolvedQuery: n.resolvedQuery || null
|
|
157
190
|
};
|
|
158
191
|
}
|
|
159
|
-
const
|
|
160
|
-
function
|
|
192
|
+
const ke = 6371;
|
|
193
|
+
function $(e) {
|
|
161
194
|
return e * Math.PI / 180;
|
|
162
195
|
}
|
|
163
|
-
function
|
|
164
|
-
const
|
|
165
|
-
return 2 *
|
|
196
|
+
function Se(e, t) {
|
|
197
|
+
const r = $(t.lat - e.lat), n = $(t.lng - e.lng), l = Math.sin(r / 2) ** 2 + Math.cos($(e.lat)) * Math.cos($(t.lat)) * Math.sin(n / 2) ** 2;
|
|
198
|
+
return 2 * ke * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l));
|
|
166
199
|
}
|
|
167
|
-
function
|
|
200
|
+
function Le(e) {
|
|
168
201
|
return `${e.toFixed(1)} km`;
|
|
169
202
|
}
|
|
170
|
-
function
|
|
203
|
+
function Ae(e) {
|
|
171
204
|
const t = ["localhost", "127.0.0.1", "::1"].includes(window.location.hostname);
|
|
172
205
|
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.`;
|
|
173
206
|
}
|
|
174
|
-
function
|
|
207
|
+
function Me(e) {
|
|
175
208
|
const t = e == null ? void 0 : e.trim();
|
|
176
209
|
if (!t || t.startsWith("/") && !t.startsWith("//")) return null;
|
|
177
|
-
const
|
|
210
|
+
const r = t.startsWith("//") ? `https:${t}` : /^[a-z][a-z\d+.-]*:/i.test(t) ? t : `https://${t}`;
|
|
178
211
|
try {
|
|
179
|
-
const
|
|
180
|
-
return
|
|
212
|
+
const n = new URL(r);
|
|
213
|
+
return n.protocol === "http:" || n.protocol === "https:" ? n.toString() : null;
|
|
181
214
|
} catch {
|
|
182
215
|
return null;
|
|
183
216
|
}
|
|
@@ -185,158 +218,158 @@ function Ae(e) {
|
|
|
185
218
|
function Ce(e) {
|
|
186
219
|
return `https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(`${e.lat},${e.lng}`)}`;
|
|
187
220
|
}
|
|
188
|
-
function
|
|
221
|
+
function Ne(e) {
|
|
189
222
|
return e.stockist_id ?? e.id;
|
|
190
223
|
}
|
|
191
|
-
function
|
|
224
|
+
function Te(e) {
|
|
192
225
|
const t = /* @__PURE__ */ new Set();
|
|
193
|
-
return e.filter((
|
|
194
|
-
const
|
|
195
|
-
return t.has(
|
|
226
|
+
return e.filter((r) => {
|
|
227
|
+
const n = Ne(r);
|
|
228
|
+
return t.has(n) ? !1 : (t.add(n), !0);
|
|
196
229
|
});
|
|
197
230
|
}
|
|
198
|
-
const
|
|
231
|
+
const Re = 3, Ie = 100, W = 50, _e = 350;
|
|
199
232
|
function G(e) {
|
|
200
233
|
return e.display_address || e.address;
|
|
201
234
|
}
|
|
202
|
-
function
|
|
235
|
+
function Ue(e) {
|
|
203
236
|
var t;
|
|
204
237
|
return (t = e.categories) != null && t.length ? e.categories : e.category ? [e.category] : [];
|
|
205
238
|
}
|
|
206
|
-
function
|
|
207
|
-
const
|
|
208
|
-
return
|
|
209
|
-
"--pbss-category-color":
|
|
210
|
-
"--pbss-category-contrast":
|
|
239
|
+
function ze(e, t) {
|
|
240
|
+
const r = t == null ? void 0 : t[e];
|
|
241
|
+
return r ? {
|
|
242
|
+
"--pbss-category-color": r,
|
|
243
|
+
"--pbss-category-contrast": ge(r)
|
|
211
244
|
} : void 0;
|
|
212
245
|
}
|
|
213
|
-
function
|
|
214
|
-
const
|
|
215
|
-
return
|
|
246
|
+
function He(e, t) {
|
|
247
|
+
const r = t ? e.map((n) => ({ ...n, distanceKm: Se(t, n._geo) })).sort((n, l) => (n.distanceKm || 0) - (l.distanceKm || 0)) : e;
|
|
248
|
+
return Te(r).slice(0, Re);
|
|
216
249
|
}
|
|
217
|
-
function
|
|
250
|
+
function ae({
|
|
218
251
|
token: e,
|
|
219
252
|
configUrl: t,
|
|
220
|
-
config:
|
|
221
|
-
theme:
|
|
222
|
-
initialQuery:
|
|
223
|
-
viewAllUrl:
|
|
224
|
-
className:
|
|
253
|
+
config: r,
|
|
254
|
+
theme: n,
|
|
255
|
+
initialQuery: l = "",
|
|
256
|
+
viewAllUrl: p = "/pages/stockists",
|
|
257
|
+
className: Z = ""
|
|
225
258
|
}) {
|
|
226
|
-
const [c, N] =
|
|
227
|
-
|
|
228
|
-
), [
|
|
229
|
-
() =>
|
|
230
|
-
[c == null ? void 0 : c.theme,
|
|
231
|
-
), b =
|
|
232
|
-
|
|
233
|
-
}, []), U =
|
|
234
|
-
|
|
235
|
-
}, [b]), z =
|
|
236
|
-
async ({ activeQuery:
|
|
259
|
+
const [c, N] = s.useState(r || null), [v, L] = s.useState(l), [A, x] = s.useState(
|
|
260
|
+
l.trim() ? "typed" : null
|
|
261
|
+
), [T, E] = s.useState([]), [R, I] = s.useState(!1), [k, S] = s.useState(!1), [ie, d] = s.useState(!1), [K, y] = s.useState(!1), [_, h] = s.useState(null), M = s.useRef(null), m = s.useRef(0), w = s.useRef(0), C = s.useRef(null), j = s.useId(), F = s.useMemo(
|
|
262
|
+
() => xe({ ...(c == null ? void 0 : c.theme) || {}, ...n || {} }),
|
|
263
|
+
[c == null ? void 0 : c.theme, n]
|
|
264
|
+
), b = s.useCallback(() => {
|
|
265
|
+
C.current && (clearTimeout(C.current), C.current = null);
|
|
266
|
+
}, []), U = s.useCallback(() => {
|
|
267
|
+
m.current += 1, b(), E([]), I(!1), y(!1), h(null), d(!1);
|
|
268
|
+
}, [b]), z = s.useCallback(
|
|
269
|
+
async ({ activeQuery: a, center: o }) => {
|
|
237
270
|
if (!c) return;
|
|
238
|
-
const u =
|
|
239
|
-
|
|
271
|
+
const u = m.current + 1;
|
|
272
|
+
m.current = u, b(), I(!0), y(!0), h(null), d(!0);
|
|
240
273
|
try {
|
|
241
|
-
const
|
|
242
|
-
query:
|
|
243
|
-
center:
|
|
274
|
+
const g = await Ee(c.search.url, {
|
|
275
|
+
query: a,
|
|
276
|
+
center: o,
|
|
244
277
|
radiusKm: W,
|
|
245
|
-
limit:
|
|
246
|
-
locationSearch: !
|
|
278
|
+
limit: Ie,
|
|
279
|
+
locationSearch: !o && !!a
|
|
247
280
|
});
|
|
248
|
-
if (u !==
|
|
249
|
-
|
|
250
|
-
} catch (
|
|
251
|
-
if (u !==
|
|
252
|
-
|
|
281
|
+
if (u !== m.current) return;
|
|
282
|
+
E(He(g.hits, g.center || o));
|
|
283
|
+
} catch (g) {
|
|
284
|
+
if (u !== m.current) return;
|
|
285
|
+
E([]), h(g instanceof Error ? g.message : "Could not search stockists");
|
|
253
286
|
} finally {
|
|
254
|
-
u ===
|
|
287
|
+
u === m.current && I(!1);
|
|
255
288
|
}
|
|
256
289
|
},
|
|
257
290
|
[b, c]
|
|
258
291
|
);
|
|
259
|
-
|
|
260
|
-
if (w.current += 1,
|
|
261
|
-
const
|
|
262
|
-
if (!
|
|
263
|
-
let
|
|
264
|
-
return
|
|
265
|
-
|
|
292
|
+
s.useEffect(() => {
|
|
293
|
+
if (w.current += 1, m.current += 1, b(), N(r || null), L(l), x(l.trim() ? "typed" : null), E([]), I(!1), S(!1), y(!1), d(!1), h(null), r) return;
|
|
294
|
+
const a = t || (e ? ye(e) : null);
|
|
295
|
+
if (!a) return;
|
|
296
|
+
let o = !1;
|
|
297
|
+
return ve(a).then((u) => {
|
|
298
|
+
o || N(u);
|
|
266
299
|
}).catch((u) => {
|
|
267
|
-
|
|
300
|
+
o || (h(u instanceof Error ? u.message : "Could not load stockist search"), y(!0), d(!0));
|
|
268
301
|
}), () => {
|
|
269
|
-
|
|
302
|
+
o = !0;
|
|
270
303
|
};
|
|
271
|
-
}, [b, t,
|
|
272
|
-
if (!c ||
|
|
273
|
-
const
|
|
274
|
-
if (!
|
|
304
|
+
}, [b, t, l, r, e]), s.useEffect(() => {
|
|
305
|
+
if (!c || A !== "typed") return;
|
|
306
|
+
const a = v.trim();
|
|
307
|
+
if (!a) {
|
|
275
308
|
U();
|
|
276
309
|
return;
|
|
277
310
|
}
|
|
278
|
-
return b(),
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
}, [b, c, v, U, z,
|
|
282
|
-
const
|
|
283
|
-
const u = typeof
|
|
284
|
-
|
|
311
|
+
return b(), C.current = setTimeout(() => {
|
|
312
|
+
C.current = null, z({ activeQuery: a, center: null });
|
|
313
|
+
}, _e), b;
|
|
314
|
+
}, [b, c, v, U, z, A]), s.useEffect(() => {
|
|
315
|
+
const a = (o) => {
|
|
316
|
+
const u = typeof o.composedPath == "function" ? o.composedPath() : [], g = o.target instanceof Node ? o.target : null;
|
|
317
|
+
M.current && u.includes(M.current) || M.current && g && M.current.contains(g) || d(!1);
|
|
285
318
|
};
|
|
286
|
-
return document.addEventListener("pointerdown",
|
|
287
|
-
}, []),
|
|
319
|
+
return document.addEventListener("pointerdown", a), () => document.removeEventListener("pointerdown", a);
|
|
320
|
+
}, []), s.useEffect(
|
|
288
321
|
() => () => {
|
|
289
|
-
w.current += 1,
|
|
322
|
+
w.current += 1, m.current += 1, b();
|
|
290
323
|
},
|
|
291
324
|
[b]
|
|
292
325
|
);
|
|
293
|
-
const
|
|
326
|
+
const le = () => {
|
|
294
327
|
if (w.current += 1, U(), x(null), S(!1), typeof window < "u" && window.isSecureContext === !1) {
|
|
295
|
-
|
|
328
|
+
h("Browser location is blocked on this site. Search by suburb or postcode instead."), y(!0), d(!0);
|
|
296
329
|
return;
|
|
297
330
|
}
|
|
298
331
|
if (!navigator.geolocation) {
|
|
299
|
-
|
|
332
|
+
h(
|
|
300
333
|
"This browser does not support location search. Search by suburb or postcode instead."
|
|
301
|
-
), y(!0),
|
|
334
|
+
), y(!0), d(!0);
|
|
302
335
|
return;
|
|
303
336
|
}
|
|
304
|
-
x("location"), S(!0),
|
|
305
|
-
const
|
|
337
|
+
x("location"), S(!0), h(null), d(!0);
|
|
338
|
+
const a = w.current;
|
|
306
339
|
navigator.geolocation.getCurrentPosition(
|
|
307
|
-
(
|
|
308
|
-
if (
|
|
309
|
-
const u = { lat:
|
|
310
|
-
|
|
340
|
+
(o) => {
|
|
341
|
+
if (a !== w.current) return;
|
|
342
|
+
const u = { lat: o.coords.latitude, lng: o.coords.longitude };
|
|
343
|
+
L(""), S(!1), z({ activeQuery: "", center: u });
|
|
311
344
|
},
|
|
312
|
-
(
|
|
313
|
-
|
|
345
|
+
(o) => {
|
|
346
|
+
a === w.current && (S(!1), y(!0), h(Ae(o)), d(!0));
|
|
314
347
|
},
|
|
315
348
|
{ enableHighAccuracy: !1, timeout: 8e3 }
|
|
316
349
|
);
|
|
317
|
-
},
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
return /* @__PURE__ */
|
|
350
|
+
}, ce = () => {
|
|
351
|
+
const a = v.trim();
|
|
352
|
+
a && (x("typed"), z({ activeQuery: a, center: null }));
|
|
353
|
+
}, O = ie && (R || k || K || !!_);
|
|
354
|
+
return /* @__PURE__ */ f(
|
|
322
355
|
"div",
|
|
323
356
|
{
|
|
324
|
-
ref:
|
|
325
|
-
className: `pbss-root ${
|
|
357
|
+
ref: M,
|
|
358
|
+
className: `pbss-root ${F.darkMode ? "is-dark" : ""} ${Z}`.trim(),
|
|
326
359
|
style: {
|
|
327
|
-
"--pbss-primary":
|
|
328
|
-
"--pbss-radius": `${Math.max(0,
|
|
360
|
+
"--pbss-primary": F.primaryColor,
|
|
361
|
+
"--pbss-radius": `${Math.max(0, F.borderRadius)}px`
|
|
329
362
|
},
|
|
330
|
-
onKeyDown: (
|
|
331
|
-
|
|
363
|
+
onKeyDown: (a) => {
|
|
364
|
+
a.key === "Escape" && d(!1);
|
|
332
365
|
},
|
|
333
366
|
children: [
|
|
334
|
-
/* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
367
|
+
/* @__PURE__ */ f("div", { className: "pbss-search-control", children: [
|
|
368
|
+
/* @__PURE__ */ i(
|
|
336
369
|
"input",
|
|
337
370
|
{
|
|
338
|
-
"aria-controls":
|
|
339
|
-
"aria-expanded":
|
|
371
|
+
"aria-controls": O ? j : void 0,
|
|
372
|
+
"aria-expanded": O,
|
|
340
373
|
"aria-label": "Search stockists",
|
|
341
374
|
autoComplete: "postal-code",
|
|
342
375
|
className: "pbss-input",
|
|
@@ -344,79 +377,95 @@ function ne({
|
|
|
344
377
|
placeholder: "Search suburb or postcode",
|
|
345
378
|
type: "search",
|
|
346
379
|
value: v,
|
|
347
|
-
onChange: (
|
|
348
|
-
const
|
|
349
|
-
w.current += 1, U(), S(!1),
|
|
380
|
+
onChange: (a) => {
|
|
381
|
+
const o = a.target.value;
|
|
382
|
+
w.current += 1, U(), S(!1), L(o), x(o.trim() ? "typed" : null);
|
|
350
383
|
},
|
|
351
384
|
onFocus: () => {
|
|
352
|
-
(
|
|
385
|
+
(R || k || K || _) && d(!0);
|
|
353
386
|
},
|
|
354
|
-
onKeyDown: (
|
|
355
|
-
|
|
387
|
+
onKeyDown: (a) => {
|
|
388
|
+
a.key === "Enter" && (a.preventDefault(), ce());
|
|
356
389
|
}
|
|
357
390
|
}
|
|
358
391
|
),
|
|
359
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ f(
|
|
360
393
|
"button",
|
|
361
394
|
{
|
|
362
|
-
"aria-label":
|
|
395
|
+
"aria-label": k ? "Finding your location" : "Use my location",
|
|
363
396
|
className: "pbss-location-button",
|
|
364
|
-
disabled:
|
|
397
|
+
disabled: k || R || !c,
|
|
365
398
|
type: "button",
|
|
366
|
-
onClick:
|
|
399
|
+
onClick: le,
|
|
367
400
|
children: [
|
|
368
|
-
|
|
369
|
-
/* @__PURE__ */
|
|
401
|
+
k ? /* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-spinner" }) : /* @__PURE__ */ i(ee, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
402
|
+
/* @__PURE__ */ i("span", { "aria-hidden": "true", className: "pbss-touch-target" })
|
|
370
403
|
]
|
|
371
404
|
}
|
|
372
405
|
)
|
|
373
406
|
] }),
|
|
374
|
-
|
|
407
|
+
O && /* @__PURE__ */ f(
|
|
375
408
|
"div",
|
|
376
409
|
{
|
|
377
410
|
"aria-label": "Nearest stockists",
|
|
378
411
|
className: "pbss-results-panel",
|
|
379
|
-
id:
|
|
412
|
+
id: j,
|
|
380
413
|
role: "region",
|
|
381
414
|
children: [
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
415
|
+
/* @__PURE__ */ f("div", { className: "pbss-mobile-results-header", children: [
|
|
416
|
+
/* @__PURE__ */ i("span", { children: "Nearest stockists" }),
|
|
417
|
+
/* @__PURE__ */ f(
|
|
418
|
+
"button",
|
|
419
|
+
{
|
|
420
|
+
"aria-label": "Close stockist results",
|
|
421
|
+
className: "pbss-results-close",
|
|
422
|
+
type: "button",
|
|
423
|
+
onClick: () => d(!1),
|
|
424
|
+
children: [
|
|
425
|
+
/* @__PURE__ */ i(te, { "aria-hidden": "true", "data-slot": "icon", weight: "bold" }),
|
|
426
|
+
/* @__PURE__ */ i("span", { children: "Close" })
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] }),
|
|
431
|
+
/* @__PURE__ */ i("div", { "aria-live": "polite", className: "pbss-results-status", children: R || k ? /* @__PURE__ */ i("div", { className: "pbss-loading", children: "Finding nearby stockists." }) : _ ? /* @__PURE__ */ i("div", { className: "pbss-error", children: _ }) : T.length > 0 ? /* @__PURE__ */ i("ul", { className: "pbss-results", role: "list", children: T.map((a) => {
|
|
432
|
+
const o = Me(a.website);
|
|
433
|
+
return /* @__PURE__ */ f("li", { className: "pbss-result", children: [
|
|
434
|
+
/* @__PURE__ */ f("div", { className: "pbss-result-heading", children: [
|
|
435
|
+
/* @__PURE__ */ i("div", { className: "pbss-result-name", children: a.name }),
|
|
436
|
+
/* @__PURE__ */ i("div", { className: "pbss-result-categories", children: Ue(a).map((u) => /* @__PURE__ */ i(
|
|
388
437
|
"span",
|
|
389
438
|
{
|
|
390
439
|
className: "pbss-result-category",
|
|
391
|
-
style:
|
|
440
|
+
style: ze(u, c == null ? void 0 : c.search.categoryColors),
|
|
392
441
|
children: u
|
|
393
442
|
},
|
|
394
443
|
u
|
|
395
444
|
)) })
|
|
396
445
|
] }),
|
|
397
|
-
G(
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
446
|
+
G(a) && /* @__PURE__ */ i("div", { className: "pbss-result-address", children: G(a) }),
|
|
447
|
+
/* @__PURE__ */ f("div", { className: "pbss-result-actions", children: [
|
|
448
|
+
a.phone && /* @__PURE__ */ i("a", { href: `tel:${a.phone}`, children: "Call now" }),
|
|
449
|
+
o && /* @__PURE__ */ i("a", { href: o, rel: "noreferrer", target: "_blank", children: "Website" }),
|
|
450
|
+
a.email && /* @__PURE__ */ i("a", { href: `mailto:${a.email}`, children: "Email" }),
|
|
451
|
+
a.directions_available !== !1 && /* @__PURE__ */ i(
|
|
403
452
|
"a",
|
|
404
453
|
{
|
|
405
|
-
href: Ce(
|
|
454
|
+
href: Ce(a._geo),
|
|
406
455
|
rel: "noreferrer",
|
|
407
456
|
target: "_blank",
|
|
408
457
|
children: "Get directions"
|
|
409
458
|
}
|
|
410
459
|
),
|
|
411
|
-
typeof
|
|
460
|
+
typeof a.distanceKm == "number" && /* @__PURE__ */ i("span", { className: "pbss-result-distance", children: Le(a.distanceKm) })
|
|
412
461
|
] })
|
|
413
|
-
] },
|
|
414
|
-
}) }) : /* @__PURE__ */
|
|
462
|
+
] }, a.id);
|
|
463
|
+
}) }) : /* @__PURE__ */ f("div", { className: "pbss-empty", children: [
|
|
415
464
|
"No stockists found within ",
|
|
416
465
|
W,
|
|
417
466
|
" km. Try another location."
|
|
418
467
|
] }) }),
|
|
419
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ i("a", { className: "pbss-view-all", href: p || "/pages/stockists", children: "View All Stockists" })
|
|
420
469
|
]
|
|
421
470
|
}
|
|
422
471
|
)
|
|
@@ -424,49 +473,49 @@ function ne({
|
|
|
424
473
|
}
|
|
425
474
|
);
|
|
426
475
|
}
|
|
427
|
-
const
|
|
428
|
-
function
|
|
429
|
-
const
|
|
430
|
-
return
|
|
476
|
+
const Pe = ":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)}}";
|
|
477
|
+
function $e(e, t) {
|
|
478
|
+
const r = J(e);
|
|
479
|
+
return r.render(/* @__PURE__ */ i(ae, { ...t })), r;
|
|
431
480
|
}
|
|
432
|
-
const
|
|
433
|
-
function
|
|
481
|
+
const Y = "data-partbot-stockist-search-styles", Q = "data-partbot-stockist-search-root";
|
|
482
|
+
function Ze(e) {
|
|
434
483
|
return e.shadowRoot || e.attachShadow({ mode: "open" });
|
|
435
484
|
}
|
|
436
|
-
function
|
|
437
|
-
if (e.querySelector(`style[${
|
|
485
|
+
function Fe(e) {
|
|
486
|
+
if (e.querySelector(`style[${Y}]`)) return;
|
|
438
487
|
const t = document.createElement("style");
|
|
439
|
-
t.setAttribute(
|
|
488
|
+
t.setAttribute(Y, ""), t.textContent = Pe, e.prepend(t);
|
|
440
489
|
}
|
|
441
490
|
function Oe(e) {
|
|
442
491
|
const t = e.querySelector(
|
|
443
|
-
`div[${
|
|
492
|
+
`div[${Q}]`
|
|
444
493
|
);
|
|
445
494
|
if (t) return t;
|
|
446
|
-
const
|
|
447
|
-
return
|
|
495
|
+
const r = document.createElement("div");
|
|
496
|
+
return r.setAttribute(Q, ""), e.appendChild(r), r;
|
|
448
497
|
}
|
|
449
498
|
const De = typeof HTMLElement > "u" ? class {
|
|
450
499
|
} : HTMLElement;
|
|
451
500
|
class oe extends De {
|
|
452
501
|
constructor() {
|
|
453
502
|
super(...arguments);
|
|
454
|
-
|
|
455
|
-
|
|
503
|
+
H(this, "root");
|
|
504
|
+
H(this, "mountElement");
|
|
456
505
|
}
|
|
457
506
|
connectedCallback() {
|
|
458
507
|
this.renderStockistSearch();
|
|
459
508
|
}
|
|
460
509
|
disconnectedCallback() {
|
|
461
|
-
var
|
|
462
|
-
(
|
|
510
|
+
var r;
|
|
511
|
+
(r = this.root) == null || r.unmount(), this.root = void 0;
|
|
463
512
|
}
|
|
464
513
|
attributeChangedCallback() {
|
|
465
514
|
this.isConnected && this.renderStockistSearch();
|
|
466
515
|
}
|
|
467
516
|
renderStockistSearch() {
|
|
468
|
-
const
|
|
469
|
-
|
|
517
|
+
const r = Ze(this);
|
|
518
|
+
Fe(r), this.mountElement || (this.mountElement = Oe(r)), this.root || (this.root = J(this.mountElement)), this.root.render(/* @__PURE__ */ i(ae, { ...this.stockistSearchProps() }));
|
|
470
519
|
}
|
|
471
520
|
stockistSearchProps() {
|
|
472
521
|
return {
|
|
@@ -477,17 +526,17 @@ class oe extends De {
|
|
|
477
526
|
};
|
|
478
527
|
}
|
|
479
528
|
}
|
|
480
|
-
|
|
481
|
-
function
|
|
529
|
+
H(oe, "observedAttributes", ["token", "config-url", "initial-query", "view-all-url"]);
|
|
530
|
+
function X() {
|
|
482
531
|
typeof window > "u" || !window.customElements || window.customElements.get("partbot-stockist-search") || window.customElements.define("partbot-stockist-search", oe);
|
|
483
532
|
}
|
|
484
|
-
typeof window < "u" && (
|
|
485
|
-
defineCustomElement:
|
|
486
|
-
mount:
|
|
533
|
+
typeof window < "u" && (X(), window.PartbotStockistSearch = {
|
|
534
|
+
defineCustomElement: X,
|
|
535
|
+
mount: $e
|
|
487
536
|
});
|
|
488
537
|
export {
|
|
489
538
|
oe as PartbotStockistSearchElement,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
539
|
+
ae as StockistSearch,
|
|
540
|
+
X as defineStockistSearchElement,
|
|
541
|
+
$e as mountStockistSearch
|
|
493
542
|
};
|