@cartbot/vehicle-search-beta 3.0.21 → 3.0.23
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/js/vehicle-search.es.js +192 -178
- package/dist/js/vehicle-search.js +15 -15
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as a, jsxs as E, Fragment as $e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as A, useEffect as B, useRef as Z, useCallback as N, useMemo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { useState as A, useEffect as B, useRef as Z, useCallback as N, useMemo as mt } from "react";
|
|
3
|
+
import ft from "react-dom";
|
|
4
|
+
import Ke from "js-cookie";
|
|
5
5
|
import { Combobox as gt, ComboboxInput as bt, ComboboxButton as wt, ComboboxOptions as yt, ComboboxOption as xt } from "@headlessui/react";
|
|
6
6
|
import kt from "fuzzysearch";
|
|
7
|
-
import
|
|
7
|
+
import Qe from "pluralize";
|
|
8
8
|
import ne from "clsx";
|
|
9
|
-
import { MeiliSearch as
|
|
9
|
+
import { MeiliSearch as We } from "meilisearch";
|
|
10
10
|
import Ct from "lodash/debounce.js";
|
|
11
11
|
import _t from "tinycolor2";
|
|
12
12
|
import Be from "posthog-js";
|
|
@@ -117,43 +117,43 @@ function X({
|
|
|
117
117
|
label: b,
|
|
118
118
|
items: v,
|
|
119
119
|
selected: p,
|
|
120
|
-
refine:
|
|
120
|
+
refine: F,
|
|
121
121
|
showPopular: I,
|
|
122
122
|
bgDark: R,
|
|
123
123
|
sortOptions: P = !0,
|
|
124
|
-
showLabel:
|
|
124
|
+
showLabel: T = !1,
|
|
125
125
|
isMobile: _ = !1,
|
|
126
126
|
loading: V = !1,
|
|
127
|
-
shouldBeActive:
|
|
127
|
+
shouldBeActive: O = !1
|
|
128
128
|
// True when parent fields are selected and this field tried to load
|
|
129
129
|
}) {
|
|
130
|
-
const [
|
|
131
|
-
C(
|
|
132
|
-
},
|
|
133
|
-
|
|
130
|
+
const [ee, u] = A(""), [y, C] = A(p || null), q = (l) => {
|
|
131
|
+
C(l), u(""), !(l && l.value === (p == null ? void 0 : p.value)) && F(l);
|
|
132
|
+
}, te = (l) => {
|
|
133
|
+
l.preventDefault(), l.stopPropagation(), u(""), C(null), F("");
|
|
134
134
|
};
|
|
135
135
|
B(() => {
|
|
136
136
|
u(""), C(p || null);
|
|
137
137
|
}, [p, v]);
|
|
138
138
|
let G = /* @__PURE__ */ new Set(), f = [];
|
|
139
|
-
v && (v.forEach((
|
|
140
|
-
String(
|
|
141
|
-
z = z.trim(), z && kt(
|
|
142
|
-
...
|
|
139
|
+
v && (v.forEach((l) => {
|
|
140
|
+
String(l.value).split(/,(?![^(]*\))/).forEach((z) => {
|
|
141
|
+
z = z.trim(), z && kt(ee, z.toLowerCase()) && !G.has(z.toLowerCase()) && (G.add(z.toLowerCase()), f.push({
|
|
142
|
+
...l,
|
|
143
143
|
value: z,
|
|
144
|
-
refinement:
|
|
144
|
+
refinement: l.value
|
|
145
145
|
}));
|
|
146
146
|
});
|
|
147
147
|
}), f.length === 0 && (f = v));
|
|
148
|
-
const D = f.filter((
|
|
148
|
+
const D = f.filter((l) => l.popularity > 0).slice(0, 11);
|
|
149
149
|
P && (f = f.filter(
|
|
150
|
-
(
|
|
150
|
+
(l) => !D.includes(l)
|
|
151
151
|
), f.sort(
|
|
152
|
-
(
|
|
152
|
+
(l, U) => l.value.localeCompare(U.value, "en", { numeric: !0 })
|
|
153
153
|
), f = D.concat(f));
|
|
154
154
|
const g = !f || f.length === 0;
|
|
155
155
|
return /* @__PURE__ */ E("div", { className: "vs:relative vs:flex vs:flex-col", children: [
|
|
156
|
-
|
|
156
|
+
T && /* @__PURE__ */ a(
|
|
157
157
|
"span",
|
|
158
158
|
{
|
|
159
159
|
className: `${R ? "vs:text-white" : "vs:text-black"} vs:mb-1 vs:block vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:font-(family-name:--partbot-font-family)`,
|
|
@@ -164,11 +164,11 @@ function X({
|
|
|
164
164
|
/* @__PURE__ */ E(
|
|
165
165
|
"select",
|
|
166
166
|
{
|
|
167
|
-
onChange: (
|
|
168
|
-
const
|
|
169
|
-
(z) => z.value.toString() ===
|
|
167
|
+
onChange: (l) => {
|
|
168
|
+
const U = f.find(
|
|
169
|
+
(z) => z.value.toString() === l.target.value.toString()
|
|
170
170
|
);
|
|
171
|
-
|
|
171
|
+
U && q(U);
|
|
172
172
|
},
|
|
173
173
|
className: "vehicle-search-select vs:relative vs:w-full vs:cursor-default vs:overflow-hidden vs:rounded-(--partbot-button-border-radius) partbot-input-border vs:bg-white vs:py-(--partbot-padding) vs:pl-[calc(var(--partbot-padding)*1.3)] vs:pr-10 vs:text-left vs:shadow-(--partbot-input-shadow) vs:focus:border-[rgb(var(--partbot-theme))] vs:focus:outline-none vs:focus:ring-1 vs:focus:ring-[rgb(var(--partbot-theme))] vs:disabled:opacity-100! vs:disabled:text-stone-400! vs:sm:text-(length:--partbot-font-size) vs:font-(family-name:--partbot-font-family) vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)]",
|
|
174
174
|
tabIndex: -1,
|
|
@@ -177,13 +177,13 @@ function X({
|
|
|
177
177
|
children: [
|
|
178
178
|
/* @__PURE__ */ a("option", { value: "", disabled: !0, children: b }),
|
|
179
179
|
D.length > 0 ? /* @__PURE__ */ E($e, { children: [
|
|
180
|
-
/* @__PURE__ */ a("optgroup", { label: `Popular ${
|
|
181
|
-
/* @__PURE__ */ a("optgroup", { label: `All ${
|
|
182
|
-
(
|
|
183
|
-
(
|
|
180
|
+
/* @__PURE__ */ a("optgroup", { label: `Popular ${Qe(b)}`, children: D.map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value)) }),
|
|
181
|
+
/* @__PURE__ */ a("optgroup", { label: `All ${Qe(b)}`, children: f.filter(
|
|
182
|
+
(l) => !D.some(
|
|
183
|
+
(U) => U.value === l.value
|
|
184
184
|
)
|
|
185
|
-
).map((
|
|
186
|
-
] }) : f.map((
|
|
185
|
+
).map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value)) })
|
|
186
|
+
] }) : f.map((l) => /* @__PURE__ */ a("option", { value: l.refinement, children: l.value }, l.value))
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
),
|
|
@@ -191,7 +191,7 @@ function X({
|
|
|
191
191
|
!V && (y == null ? void 0 : y.value) && /* @__PURE__ */ a(
|
|
192
192
|
"button",
|
|
193
193
|
{
|
|
194
|
-
onClick:
|
|
194
|
+
onClick: te,
|
|
195
195
|
tabIndex: -1,
|
|
196
196
|
className: "vs:absolute vs:inset-y-0 vs:right-[calc(var(--partbot-font-size)*1.95)] vs:items-center vs:pr-(--partbot-padding) vs:text-red-300 vs:hover:text-red-500 vs:bg-transparent vs:border-none vs:outline-none vs:p-(--partbot-padding) vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:transition vs:pointer-events-auto vs:flex vs:justify-center",
|
|
197
197
|
children: /* @__PURE__ */ a(
|
|
@@ -224,10 +224,10 @@ function X({
|
|
|
224
224
|
{
|
|
225
225
|
autoComplete: "off",
|
|
226
226
|
spellCheck: "false",
|
|
227
|
-
placeholder: g &&
|
|
227
|
+
placeholder: g && O && !V ? "N/A" : b,
|
|
228
228
|
className: "vs:w-full vs:cursor-default vs:rounded-(--partbot-button-border-radius) partbot-input-border vs:bg-white vs:py-(--partbot-padding) vs:pl-[calc(var(--partbot-padding)*1.3)] vs:pr-10 vs:text-left vs:shadow-(--partbot-input-shadow) vs:focus:border-[rgb(var(--partbot-theme))] vs:focus:outline-none vs:focus:ring-1 vs:focus:ring-[rgb(var(--partbot-theme))] vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-(family-name:--partbot-font-family) vs:text-stone-900 vs:placeholder:text-stone-600 vs:disabled:placeholder:text-stone-400 vs:disabled:cursor-not-allowed",
|
|
229
|
-
displayValue: (
|
|
230
|
-
onChange: (
|
|
229
|
+
displayValue: (l) => (l == null ? void 0 : l.value) || "",
|
|
230
|
+
onChange: (l) => u(l.target.value),
|
|
231
231
|
title: b
|
|
232
232
|
}
|
|
233
233
|
),
|
|
@@ -235,7 +235,7 @@ function X({
|
|
|
235
235
|
(y == null ? void 0 : y.value) && /* @__PURE__ */ a(
|
|
236
236
|
"button",
|
|
237
237
|
{
|
|
238
|
-
onClick:
|
|
238
|
+
onClick: te,
|
|
239
239
|
tabIndex: -1,
|
|
240
240
|
className: "vs:inset-y-0 vs:pr-2 vs:text-red-300 vs:hover:text-red-500 vs:bg-transparent vs:border-none vs:outline-none vs:p-2 vs:text-(length:--partbot-font-size) vs:leading-[calc(var(--partbot-font-size)*1.5)] vs:font-medium vs:transition vs:pointer-events-auto vs:flex vs:items-center vs:justify-center vs:cursor-pointer",
|
|
241
241
|
children: /* @__PURE__ */ a(
|
|
@@ -272,31 +272,31 @@ function X({
|
|
|
272
272
|
portal: !0,
|
|
273
273
|
anchor: "bottom start",
|
|
274
274
|
className: "vs:w-(--input-width) vs:z-99999! vs:max-h-60! vs:overflow-auto vs:rounded-[min(var(--partbot-button-border-radius),0.89rem)] vs:bg-white vs:py-1 vs:text-base vs:shadow-lg vs:ring-1 vs:ring-stone-200 vs:focus:outline-none vs:sm:text-(length:--partbot-font-size) empty:vs:invisible vs:mt-2",
|
|
275
|
-
children: ({ option:
|
|
276
|
-
const
|
|
277
|
-
(z) => z.value ===
|
|
275
|
+
children: ({ option: l }) => {
|
|
276
|
+
const U = l && D.some(
|
|
277
|
+
(z) => z.value === l.value
|
|
278
278
|
);
|
|
279
279
|
return /* @__PURE__ */ a(
|
|
280
280
|
xt,
|
|
281
281
|
{
|
|
282
|
-
value:
|
|
282
|
+
value: l,
|
|
283
283
|
className: ({ focus: z }) => ne(
|
|
284
284
|
"vs:group vs:relative vs:w-full vs:cursor-default vs:py-(--partbot-padding) vs:px-[calc(var(--partbot-padding)*1.3)] vs:text-left vs:border-none",
|
|
285
285
|
z ? "vs:bg-[rgb(var(--partbot-theme))] vs:text-[rgb(var(--partbot-button-label-color))]" : "vs:bg-white vs:text-stone-900 vs:hover:bg-theme vs:hover:text-button-label",
|
|
286
|
-
|
|
286
|
+
U && "vs:font-bold!"
|
|
287
287
|
),
|
|
288
288
|
children: ({ selected: z }) => /* @__PURE__ */ E("div", { className: "vs:flex vs:w-full vs:items-center vs:justify-between", children: [
|
|
289
289
|
/* @__PURE__ */ a(
|
|
290
290
|
"span",
|
|
291
291
|
{
|
|
292
292
|
className: ne(
|
|
293
|
-
|
|
293
|
+
l.value === (p == null ? void 0 : p.value) ? "vs:font-semibold" : "vs:font-normal",
|
|
294
294
|
"vs:block vs:font-(family-name:--partbot-font-family) vs:whitespace-pre-wrap vs:text-left vs:text-(length:--partbot-font-size) vs:leading-none"
|
|
295
295
|
),
|
|
296
|
-
children:
|
|
296
|
+
children: l.value
|
|
297
297
|
}
|
|
298
298
|
),
|
|
299
|
-
|
|
299
|
+
l.value === (p == null ? void 0 : p.value) && /* @__PURE__ */ a(
|
|
300
300
|
"span",
|
|
301
301
|
{
|
|
302
302
|
className: ne(
|
|
@@ -328,45 +328,45 @@ function X({
|
|
|
328
328
|
)
|
|
329
329
|
] });
|
|
330
330
|
}
|
|
331
|
-
const $t = "3.0.
|
|
331
|
+
const $t = "3.0.23";
|
|
332
332
|
console.info(
|
|
333
333
|
`Vehicle Search v${$t} powered by Partbot https://mmyvs.partbot.io`
|
|
334
334
|
);
|
|
335
335
|
function Se(b = [], v = []) {
|
|
336
336
|
const p = [];
|
|
337
|
-
return b.forEach((
|
|
338
|
-
const [I, ...R] =
|
|
337
|
+
return b.forEach((F) => {
|
|
338
|
+
const [I, ...R] = F.split(":"), P = R.join(":");
|
|
339
339
|
if (P.includes(" > ")) {
|
|
340
|
-
const
|
|
341
|
-
if (I !== "make" &&
|
|
342
|
-
const V =
|
|
340
|
+
const T = P.split(" > "), _ = T[T.length - 1].trim();
|
|
341
|
+
if (I !== "make" && T.length >= 2) {
|
|
342
|
+
const V = T[0].trim();
|
|
343
343
|
p.push(`make = "${V}"`);
|
|
344
344
|
}
|
|
345
345
|
p.push(`${I} = "${_}"`);
|
|
346
346
|
} else
|
|
347
347
|
p.push(`${I} = "${P}"`);
|
|
348
|
-
}), v.forEach((
|
|
349
|
-
p.push(
|
|
348
|
+
}), v.forEach((F) => {
|
|
349
|
+
p.push(F);
|
|
350
350
|
}), p.length > 0 ? p.join(" AND ") : null;
|
|
351
351
|
}
|
|
352
352
|
function Mt({
|
|
353
353
|
apiKey: b,
|
|
354
354
|
makes: v = "",
|
|
355
355
|
models: p = "",
|
|
356
|
-
callbackUrl:
|
|
356
|
+
callbackUrl: F = "",
|
|
357
357
|
layout: I = "row",
|
|
358
358
|
fields: R,
|
|
359
359
|
fieldPrefix: P = "",
|
|
360
|
-
showBranding:
|
|
360
|
+
showBranding: T = !0,
|
|
361
361
|
showLabels: _ = !1,
|
|
362
362
|
mobileFullWidthButton: V = !0,
|
|
363
|
-
mobileDrawer:
|
|
364
|
-
modifyQueryString:
|
|
363
|
+
mobileDrawer: O = !0,
|
|
364
|
+
modifyQueryString: ee = !0,
|
|
365
365
|
onChange: u,
|
|
366
366
|
buttonLabel: y = "Search",
|
|
367
367
|
showButton: C = !0,
|
|
368
368
|
onSubmit: q,
|
|
369
|
-
store:
|
|
369
|
+
store: te,
|
|
370
370
|
useStoreVehicles: G = !0,
|
|
371
371
|
fieldOrder: f = "MMY",
|
|
372
372
|
// "MMY" (Make→Model→Year) or "YMM" (Year→Make→Model)
|
|
@@ -374,10 +374,10 @@ function Mt({
|
|
|
374
374
|
// Use api.cartbot.io instead of api.partbot.io
|
|
375
375
|
yearOptional: g = !1,
|
|
376
376
|
// Make year selection optional, only requiring make + model
|
|
377
|
-
mobileButtonLabel:
|
|
377
|
+
mobileButtonLabel: l = "Select Vehicle"
|
|
378
378
|
// Label for mobile drawer trigger button
|
|
379
379
|
}) {
|
|
380
|
-
const
|
|
380
|
+
const U = Z(null), z = Z(null), ie = Z(null), S = Z(null), K = Z(null), j = Z(null), Q = Z(null), w = Z(null), W = Z(null), M = Z(!1), x = f === "YMM", [le, ve] = A([]), [fe, ce] = A([]), [de, he] = A([]), [Le, ge] = A([]), [Ie, be] = A([]), [Ve, we] = A([]), [De, ye] = A([]), [Ue, xe] = A([]), Xe = Z([]), [se, ke] = A([]), [e, Y] = A({
|
|
381
381
|
make: null,
|
|
382
382
|
model: null,
|
|
383
383
|
year: null,
|
|
@@ -386,21 +386,21 @@ function Mt({
|
|
|
386
386
|
variant: null,
|
|
387
387
|
engine: null,
|
|
388
388
|
engine_capacity: null
|
|
389
|
-
}), [
|
|
389
|
+
}), [Ge, Me] = A(!1), Fe = Z([
|
|
390
390
|
"body",
|
|
391
391
|
"series",
|
|
392
392
|
"variant",
|
|
393
393
|
"engine",
|
|
394
394
|
"engine_capacity"
|
|
395
395
|
]), Ce = Z(
|
|
396
|
-
R && R.length &&
|
|
396
|
+
R && R.length && Fe.current ? R.split(",").filter((t) => {
|
|
397
397
|
var r;
|
|
398
|
-
return (r =
|
|
398
|
+
return (r = Fe.current) == null ? void 0 : r.includes(t);
|
|
399
399
|
}) : null
|
|
400
|
-
), [J,
|
|
400
|
+
), [J, et] = A(!1);
|
|
401
401
|
B(() => {
|
|
402
402
|
const t = navigator.userAgent;
|
|
403
|
-
|
|
403
|
+
et(
|
|
404
404
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
405
405
|
t
|
|
406
406
|
)
|
|
@@ -412,7 +412,7 @@ function Mt({
|
|
|
412
412
|
disable_session_recording: !1
|
|
413
413
|
});
|
|
414
414
|
}, []);
|
|
415
|
-
const [oe,
|
|
415
|
+
const [oe, tt] = A({}), [Nt, rt] = A(""), Re = N(async () => {
|
|
416
416
|
if (!b)
|
|
417
417
|
return;
|
|
418
418
|
const r = `${D ? "https://api.cartbot.io" : "https://api.partbot.io"}/v1/vehicles/auth`;
|
|
@@ -427,7 +427,7 @@ function Mt({
|
|
|
427
427
|
body: JSON.stringify(
|
|
428
428
|
(() => {
|
|
429
429
|
const m = { use_store_vehicles: G };
|
|
430
|
-
return
|
|
430
|
+
return te && (m.store = te), m;
|
|
431
431
|
})()
|
|
432
432
|
)
|
|
433
433
|
});
|
|
@@ -435,13 +435,13 @@ function Mt({
|
|
|
435
435
|
throw new Error(`Error: ${i.status} ${i.statusText}`);
|
|
436
436
|
const {
|
|
437
437
|
merchant: o,
|
|
438
|
-
vehicle_makes:
|
|
438
|
+
vehicle_makes: s,
|
|
439
439
|
vehicle_models: n,
|
|
440
440
|
meilisearch_search_key: c,
|
|
441
441
|
meilisearch_index_name: d,
|
|
442
442
|
algolia_search_key: $,
|
|
443
443
|
// Fallback for backward compatibility
|
|
444
|
-
algolia_index_name:
|
|
444
|
+
algolia_index_name: re,
|
|
445
445
|
// Fallback for backward compatibility
|
|
446
446
|
store_index_name: pe,
|
|
447
447
|
store_popular_makes: ae,
|
|
@@ -449,27 +449,27 @@ function Mt({
|
|
|
449
449
|
store_popular_models: h
|
|
450
450
|
// Object mapping makes to popular models: { "TOYOTA": ["HILUX", "LANDCRUISER"], ... }
|
|
451
451
|
} = await i.json();
|
|
452
|
-
z.current = o, ie.current = (
|
|
452
|
+
z.current = o, ie.current = (s || []).map((m) => ({
|
|
453
453
|
...m,
|
|
454
454
|
refinement: m.value
|
|
455
|
-
})), G && n ? typeof n == "object" && !Array.isArray(n) ? S.current = n : Array.isArray(n) ? S.current = n.map((m) => m && m.value ? String(m.value).trim() : "").filter(Boolean) : S.current = [] : S.current = [], K.current = Array.isArray(ae) ? ae.map((m) => String(m).trim().toUpperCase()) : null, j.current = h || null,
|
|
455
|
+
})), G && n ? typeof n == "object" && !Array.isArray(n) ? S.current = n : Array.isArray(n) ? S.current = n.map((m) => m && m.value ? String(m.value).trim() : "").filter(Boolean) : S.current = [] : S.current = [], K.current = Array.isArray(ae) ? ae.map((m) => String(m).trim().toUpperCase()) : null, j.current = h || null, tt({
|
|
456
456
|
searchKey: "eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",
|
|
457
457
|
indexName: "otto_v1_vehicles_production"
|
|
458
458
|
});
|
|
459
459
|
} catch (i) {
|
|
460
|
-
console.error("[VehicleSearch] Auth failed:", i),
|
|
460
|
+
console.error("[VehicleSearch] Auth failed:", i), rt(i);
|
|
461
461
|
}
|
|
462
|
-
}, [b,
|
|
462
|
+
}, [b, te, G, D]);
|
|
463
463
|
B(() => {
|
|
464
464
|
Re();
|
|
465
465
|
}, [Re]), B(() => {
|
|
466
466
|
if (oe.searchKey) {
|
|
467
467
|
try {
|
|
468
|
-
Q.current = new
|
|
468
|
+
Q.current = new We({
|
|
469
469
|
host: "https://search.partbot.io",
|
|
470
470
|
apiKey: oe.searchKey
|
|
471
471
|
}), w.current = Q.current.index(oe.indexName);
|
|
472
|
-
const t = new
|
|
472
|
+
const t = new We({
|
|
473
473
|
host: "https://partbot-meilisearch-cache.partbot.workers.dev",
|
|
474
474
|
// Cloudflare Worker endpoint
|
|
475
475
|
apiKey: oe.searchKey
|
|
@@ -483,7 +483,7 @@ function Mt({
|
|
|
483
483
|
};
|
|
484
484
|
}
|
|
485
485
|
}, [oe.searchKey, b]);
|
|
486
|
-
const [H,
|
|
486
|
+
const [H, ot] = A(!1), Te = N(() => {
|
|
487
487
|
function t(n) {
|
|
488
488
|
if (!n) return "rgba(0,0,0,1)";
|
|
489
489
|
var c = r(), d = window.getComputedStyle(n).backgroundColor;
|
|
@@ -497,9 +497,9 @@ function Mt({
|
|
|
497
497
|
}
|
|
498
498
|
const i = document.querySelector("vehicle-search");
|
|
499
499
|
let o;
|
|
500
|
-
i ? o = t(i) : o = t(
|
|
501
|
-
const
|
|
502
|
-
|
|
500
|
+
i ? o = t(i) : o = t(U.current);
|
|
501
|
+
const s = _t(o).isDark();
|
|
502
|
+
ot(s);
|
|
503
503
|
}, []);
|
|
504
504
|
B(() => {
|
|
505
505
|
async function t() {
|
|
@@ -516,13 +516,13 @@ function Mt({
|
|
|
516
516
|
), e.series && r.push(`series:${e.series.refinement}`), e.engine && r.push(`engine:${e.engine.refinement}`), e.engine_capacity && r.push(
|
|
517
517
|
`engine_capacity:${e.engine_capacity.refinement}`
|
|
518
518
|
);
|
|
519
|
-
let
|
|
519
|
+
let s = (await w.current.search("", {
|
|
520
520
|
filter: Se(r, i),
|
|
521
521
|
attributesToRetrieve: ["otto_id"],
|
|
522
522
|
limit: 500
|
|
523
523
|
// Reduced from 1000 for faster queries
|
|
524
524
|
})).hits.map((d) => d.otto_id);
|
|
525
|
-
ke(
|
|
525
|
+
ke(s);
|
|
526
526
|
let c = {
|
|
527
527
|
...Object.fromEntries(
|
|
528
528
|
Object.entries(e || {}).map(([d, $]) => [d, $ && $.value || null]).filter(([d, $]) => $ !== null)
|
|
@@ -533,7 +533,7 @@ function Mt({
|
|
|
533
533
|
}
|
|
534
534
|
t();
|
|
535
535
|
}, [e, w, g]);
|
|
536
|
-
const Ae = (t) => P ? `${P}${t}` : t,
|
|
536
|
+
const Ae = (t) => P ? `${P}${t}` : t, at = (t) => P ? t.replace(new RegExp(`^${P}`), "") : t, nt = N(() => {
|
|
537
537
|
const t = new URL(window.location.href).searchParams, r = [
|
|
538
538
|
"make",
|
|
539
539
|
"model",
|
|
@@ -543,19 +543,19 @@ function Mt({
|
|
|
543
543
|
"engine",
|
|
544
544
|
"engine_capacity"
|
|
545
545
|
].map(Ae), i = Object.fromEntries(
|
|
546
|
-
[...t.entries()].filter(([o]) => r.includes(o)).map(([o,
|
|
546
|
+
[...t.entries()].filter(([o]) => r.includes(o)).map(([o, s]) => [at(o), { value: s, refinement: s }])
|
|
547
547
|
);
|
|
548
548
|
Y(i);
|
|
549
549
|
}, []), L = N(({ query: t, value: r, remove: i }) => {
|
|
550
|
-
if (
|
|
550
|
+
if (ee && "URLSearchParams" in window) {
|
|
551
551
|
let o = new URLSearchParams(window.location.search);
|
|
552
552
|
t = Ae(t), t && r && o.set(t, r), t && !r && o.delete(t), i && i.forEach((n) => {
|
|
553
553
|
n = Ae(n), o.delete(n);
|
|
554
554
|
});
|
|
555
|
-
const
|
|
556
|
-
window.history.pushState(null, "",
|
|
555
|
+
const s = window.location.pathname + "?" + o.toString();
|
|
556
|
+
window.history.pushState(null, "", s);
|
|
557
557
|
}
|
|
558
|
-
}, []),
|
|
558
|
+
}, []), it = N(() => {
|
|
559
559
|
var i;
|
|
560
560
|
const t = {
|
|
561
561
|
vehicle_ids: se,
|
|
@@ -568,8 +568,8 @@ function Mt({
|
|
|
568
568
|
window.dispatchEvent(r), document.dispatchEvent(r), setTimeout(() => {
|
|
569
569
|
Me(!1);
|
|
570
570
|
}, 900);
|
|
571
|
-
}, [se, q]),
|
|
572
|
-
var i, o,
|
|
571
|
+
}, [se, q]), Oe = N(() => {
|
|
572
|
+
var i, o, s, n, c, d, $, re, pe;
|
|
573
573
|
const t = {
|
|
574
574
|
vehicle_ids: se,
|
|
575
575
|
vehicle: (i = e == null ? void 0 : e.make) != null && i.value ? e : {},
|
|
@@ -583,23 +583,23 @@ function Mt({
|
|
|
583
583
|
if (M.current === !0) {
|
|
584
584
|
localStorage.removeItem("partbot_plate_details");
|
|
585
585
|
const ae = JSON.stringify({
|
|
586
|
-
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((
|
|
586
|
+
description: `${((o = e.make) == null ? void 0 : o.value) || ""} ${((s = e.model) == null ? void 0 : s.value) || ""} ${((n = e.year) == null ? void 0 : n.value) || ""} ${((c = e.body) == null ? void 0 : c.value) || ""} ${((d = e.series) == null ? void 0 : d.value) || ""} ${(($ = e.variant) == null ? void 0 : $.value) || ""} ${((re = e.engine) == null ? void 0 : re.value) || ""} ${((pe = e.engine_capacity) == null ? void 0 : pe.value) || ""}`.trim(),
|
|
587
587
|
vehicle_ids: se,
|
|
588
588
|
vehicle: e ? Object.entries(e).reduce((h, [m, k]) => (h[m] = k != null && k.value ? k.value : {}, h), {}) : {}
|
|
589
589
|
});
|
|
590
590
|
localStorage.setItem(
|
|
591
591
|
"partbot_selected_vehicle",
|
|
592
592
|
ae
|
|
593
|
-
),
|
|
593
|
+
), Ke.set("partbot_selected_vehicle", ae, {
|
|
594
594
|
secure: !0
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
|
-
window.dispatchEvent(r), document.dispatchEvent(r),
|
|
597
|
+
window.dispatchEvent(r), document.dispatchEvent(r), Xe.current = se, setTimeout(() => {
|
|
598
598
|
Me(!1);
|
|
599
599
|
}, 900);
|
|
600
|
-
}, [se, u]), _e =
|
|
601
|
-
() => Ct(
|
|
602
|
-
[
|
|
600
|
+
}, [se, u]), _e = mt(
|
|
601
|
+
() => Ct(Oe, 100),
|
|
602
|
+
[Oe]
|
|
603
603
|
);
|
|
604
604
|
B(() => {
|
|
605
605
|
_e();
|
|
@@ -607,7 +607,21 @@ function Mt({
|
|
|
607
607
|
_e.cancel();
|
|
608
608
|
}, [_e]), B(() => {
|
|
609
609
|
const t = () => {
|
|
610
|
-
M.current = !1,
|
|
610
|
+
M.current = !1, localStorage.removeItem("partbot_selected_vehicle"), Ke.remove("partbot_selected_vehicle"), ee && setTimeout(() => {
|
|
611
|
+
const r = new URL(window.location.href), i = [
|
|
612
|
+
"make",
|
|
613
|
+
"model",
|
|
614
|
+
"year",
|
|
615
|
+
"body",
|
|
616
|
+
"series",
|
|
617
|
+
"variant",
|
|
618
|
+
"engine"
|
|
619
|
+
];
|
|
620
|
+
let o = !1;
|
|
621
|
+
i.forEach((s) => {
|
|
622
|
+
r.searchParams.has(s) && (r.searchParams.delete(s), o = !0);
|
|
623
|
+
}), o && window.history.replaceState(null, "", r.toString());
|
|
624
|
+
}, 100), Y({
|
|
611
625
|
make: null,
|
|
612
626
|
model: null,
|
|
613
627
|
year: null,
|
|
@@ -625,14 +639,14 @@ function Mt({
|
|
|
625
639
|
);
|
|
626
640
|
};
|
|
627
641
|
}, []), B(() => {
|
|
628
|
-
oe.searchKey && (x ||
|
|
642
|
+
oe.searchKey && (x || vt(), nt());
|
|
629
643
|
}, [oe.searchKey, x]), B(() => {
|
|
630
644
|
x && w.current && de.length === 0 && !e.year && w.current.search("", {
|
|
631
645
|
attributesToRetrieve: ["year_from", "year_to"],
|
|
632
646
|
limit: 1e4
|
|
633
647
|
}).then(({ hits: t }) => {
|
|
634
|
-
const r = t.map((c) => c.year_from).filter(Boolean), i = t.map((c) => c.year_to).filter(Boolean), o = Math.min(...r),
|
|
635
|
-
{ length:
|
|
648
|
+
const r = t.map((c) => c.year_from).filter(Boolean), i = t.map((c) => c.year_to).filter(Boolean), o = Math.min(...r), s = Math.max(...i), n = Array.from(
|
|
649
|
+
{ length: s - o + 1 },
|
|
636
650
|
(c, d) => ({ value: o + d, refinement: o + d })
|
|
637
651
|
).reverse();
|
|
638
652
|
he(n);
|
|
@@ -640,8 +654,8 @@ function Mt({
|
|
|
640
654
|
console.error("[VehicleSearch] Error loading year range:", t);
|
|
641
655
|
});
|
|
642
656
|
}, [x, oe.searchKey, de.length, e.year]), B(() => {
|
|
643
|
-
typeof document > "u" ||
|
|
644
|
-
}, [
|
|
657
|
+
typeof document > "u" || Te();
|
|
658
|
+
}, [Te]);
|
|
645
659
|
const Ze = N(
|
|
646
660
|
(t) => {
|
|
647
661
|
M.current = !0, ce([]), !x && !g && he([]), ge([]), be([]), we([]), xe([]), ye([]), Y((r) => ({
|
|
@@ -725,7 +739,7 @@ function Mt({
|
|
|
725
739
|
}), !g && (!t || t === "") && ke([]);
|
|
726
740
|
},
|
|
727
741
|
[L, x, g]
|
|
728
|
-
),
|
|
742
|
+
), st = N(
|
|
729
743
|
(t) => {
|
|
730
744
|
M.current = !0, Y((r) => ({
|
|
731
745
|
...r,
|
|
@@ -736,7 +750,7 @@ function Mt({
|
|
|
736
750
|
});
|
|
737
751
|
},
|
|
738
752
|
[L]
|
|
739
|
-
),
|
|
753
|
+
), lt = N(
|
|
740
754
|
(t) => {
|
|
741
755
|
M.current = !0, Y((r) => ({
|
|
742
756
|
...r,
|
|
@@ -747,7 +761,7 @@ function Mt({
|
|
|
747
761
|
});
|
|
748
762
|
},
|
|
749
763
|
[L]
|
|
750
|
-
),
|
|
764
|
+
), ct = N(
|
|
751
765
|
(t) => {
|
|
752
766
|
M.current = !0, Y((r) => ({
|
|
753
767
|
...r,
|
|
@@ -758,7 +772,7 @@ function Mt({
|
|
|
758
772
|
});
|
|
759
773
|
},
|
|
760
774
|
[L]
|
|
761
|
-
),
|
|
775
|
+
), dt = N(
|
|
762
776
|
(t) => {
|
|
763
777
|
M.current = !0, Y((r) => ({
|
|
764
778
|
...r,
|
|
@@ -769,7 +783,7 @@ function Mt({
|
|
|
769
783
|
});
|
|
770
784
|
},
|
|
771
785
|
[L]
|
|
772
|
-
),
|
|
786
|
+
), pt = N(
|
|
773
787
|
(t) => {
|
|
774
788
|
M.current = !0, Y((r) => ({
|
|
775
789
|
...r,
|
|
@@ -797,9 +811,9 @@ function Mt({
|
|
|
797
811
|
});
|
|
798
812
|
});
|
|
799
813
|
let o = Array.from(i.values());
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
const d =
|
|
814
|
+
const s = new Set(K.current || []);
|
|
815
|
+
s.size > 0 ? o.sort((n, c) => {
|
|
816
|
+
const d = s.has(n.value), $ = s.has(c.value);
|
|
803
817
|
return d && !$ ? -1 : !d && $ ? 1 : d && $ ? K.current.indexOf(n.value) - K.current.indexOf(c.value) : n.value.localeCompare(c.value);
|
|
804
818
|
}) : o.sort(
|
|
805
819
|
(n, c) => c.popularity === n.popularity ? n.value.localeCompare(c.value) : c.popularity - n.popularity
|
|
@@ -809,7 +823,7 @@ function Mt({
|
|
|
809
823
|
}
|
|
810
824
|
})();
|
|
811
825
|
}, [x, e.year]);
|
|
812
|
-
const
|
|
826
|
+
const vt = N(() => {
|
|
813
827
|
(async () => {
|
|
814
828
|
let r = [];
|
|
815
829
|
if (ie.current && ie.current.length)
|
|
@@ -820,11 +834,11 @@ function Mt({
|
|
|
820
834
|
attributesToRetrieve: ["make", "make_popularity"],
|
|
821
835
|
limit: 1e3
|
|
822
836
|
}), o = /* @__PURE__ */ new Map();
|
|
823
|
-
i.hits.forEach((
|
|
824
|
-
|
|
825
|
-
value:
|
|
826
|
-
refinement:
|
|
827
|
-
popularity:
|
|
837
|
+
i.hits.forEach((s) => {
|
|
838
|
+
s.make && !o.has(s.make) && o.set(s.make, {
|
|
839
|
+
value: s.make.toUpperCase(),
|
|
840
|
+
refinement: s.make.toUpperCase(),
|
|
841
|
+
popularity: s.make_popularity || 0
|
|
828
842
|
});
|
|
829
843
|
}), r = Array.from(o.values());
|
|
830
844
|
} catch (i) {
|
|
@@ -838,9 +852,9 @@ function Mt({
|
|
|
838
852
|
}
|
|
839
853
|
if (K.current && K.current.length > 0) {
|
|
840
854
|
const i = new Set(K.current);
|
|
841
|
-
r.sort((o,
|
|
842
|
-
const n = i.has(o.value), c = i.has(
|
|
843
|
-
return n && !c ? -1 : !n && c ? 1 : n && c ? K.current.indexOf(o.value) - K.current.indexOf(
|
|
855
|
+
r.sort((o, s) => {
|
|
856
|
+
const n = i.has(o.value), c = i.has(s.value);
|
|
857
|
+
return n && !c ? -1 : !n && c ? 1 : n && c ? K.current.indexOf(o.value) - K.current.indexOf(s.value) : o.value.localeCompare(s.value);
|
|
844
858
|
});
|
|
845
859
|
} else
|
|
846
860
|
r.sort((i, o) => i.popularity === o.popularity ? i.value.localeCompare(o.value) : o.popularity - i.popularity);
|
|
@@ -853,26 +867,26 @@ function Mt({
|
|
|
853
867
|
const r = e.make.refinement;
|
|
854
868
|
if (G && typeof S.current == "object" && !Array.isArray(S.current) && S.current[r]) {
|
|
855
869
|
const i = S.current[r].map(
|
|
856
|
-
(
|
|
857
|
-
value:
|
|
858
|
-
refinement:
|
|
870
|
+
(s) => ({
|
|
871
|
+
value: s,
|
|
872
|
+
refinement: s,
|
|
859
873
|
popularity: 0
|
|
860
874
|
// Popularity will be used from PostHog for sorting
|
|
861
875
|
})
|
|
862
876
|
), o = (t = j.current) == null ? void 0 : t[r];
|
|
863
877
|
if (o && Array.isArray(o)) {
|
|
864
|
-
const
|
|
878
|
+
const s = new Map(
|
|
865
879
|
o.map((n, c) => [
|
|
866
880
|
n.toUpperCase(),
|
|
867
881
|
o.length - c
|
|
868
882
|
])
|
|
869
883
|
);
|
|
870
884
|
i.sort((n, c) => {
|
|
871
|
-
const d =
|
|
885
|
+
const d = s.get(n.value.toUpperCase()) || 0, $ = s.get(c.value.toUpperCase()) || 0;
|
|
872
886
|
return d !== $ ? $ - d : n.value.localeCompare(c.value);
|
|
873
887
|
});
|
|
874
888
|
} else
|
|
875
|
-
i.sort((
|
|
889
|
+
i.sort((s, n) => s.value.localeCompare(n.value));
|
|
876
890
|
ce(i);
|
|
877
891
|
return;
|
|
878
892
|
}
|
|
@@ -885,9 +899,9 @@ function Mt({
|
|
|
885
899
|
}).then((i) => {
|
|
886
900
|
var pe, ae;
|
|
887
901
|
const { hits: o } = i;
|
|
888
|
-
let
|
|
889
|
-
o.length > 0 && o[0].models && (
|
|
890
|
-
let n =
|
|
902
|
+
let s = [];
|
|
903
|
+
o.length > 0 && o[0].models && (s = o[0].models);
|
|
904
|
+
let n = s.map((h) => ({
|
|
891
905
|
model: `${e.make.refinement} > ${h.name}`,
|
|
892
906
|
model_popularity: h.popularity || 0
|
|
893
907
|
})), c = [];
|
|
@@ -924,18 +938,18 @@ function Mt({
|
|
|
924
938
|
refinement: h.model.match(/[^>]*$/)[0].trim(),
|
|
925
939
|
popularity: h.model_popularity
|
|
926
940
|
}));
|
|
927
|
-
const $ = (pe = e.make) == null ? void 0 : pe.refinement,
|
|
928
|
-
if (
|
|
941
|
+
const $ = (pe = e.make) == null ? void 0 : pe.refinement, re = (ae = j.current) == null ? void 0 : ae[$];
|
|
942
|
+
if (re && Array.isArray(re) && re.length > 0) {
|
|
929
943
|
const h = new Set(
|
|
930
|
-
|
|
944
|
+
re.map((m) => String(m).trim().toUpperCase())
|
|
931
945
|
);
|
|
932
946
|
n.sort((m, k) => {
|
|
933
947
|
const je = h.has(m.value), Ne = h.has(k.value);
|
|
934
948
|
if (je && !Ne) return -1;
|
|
935
949
|
if (!je && Ne) return 1;
|
|
936
950
|
if (je && Ne) {
|
|
937
|
-
const qe =
|
|
938
|
-
(
|
|
951
|
+
const qe = re.map(
|
|
952
|
+
(ut) => String(ut).trim().toUpperCase()
|
|
939
953
|
);
|
|
940
954
|
return qe.indexOf(m.value) - qe.indexOf(k.value);
|
|
941
955
|
}
|
|
@@ -971,7 +985,7 @@ function Mt({
|
|
|
971
985
|
limit: 200
|
|
972
986
|
// Reduced from 1000 for faster queries
|
|
973
987
|
}).then(({ hits: r }) => {
|
|
974
|
-
const i = r.map((d) => d.year_from), o = Math.min(...i),
|
|
988
|
+
const i = r.map((d) => d.year_from), o = Math.min(...i), s = r.map((d) => d.year_to), n = Math.max(...s);
|
|
975
989
|
let c = Array.apply(null, {
|
|
976
990
|
length: n + 1 - o
|
|
977
991
|
}).map(function(d, $) {
|
|
@@ -1015,13 +1029,13 @@ function Mt({
|
|
|
1015
1029
|
}, [e.year, e.make, e.model, g]);
|
|
1016
1030
|
const ue = N(({ hits: t, attribute: r, stateCallback: i }) => {
|
|
1017
1031
|
let o = [
|
|
1018
|
-
...new Map(t.map((
|
|
1019
|
-
].map((
|
|
1020
|
-
value:
|
|
1021
|
-
refinement:
|
|
1022
|
-
})).filter((
|
|
1032
|
+
...new Map(t.map((s) => [s[r], s])).values()
|
|
1033
|
+
].map((s) => ({
|
|
1034
|
+
value: s[r].match(/[^|]*$/)[0].trim(),
|
|
1035
|
+
refinement: s[r].match(/[^|]*$/)[0].trim()
|
|
1036
|
+
})).filter((s) => s.refinement);
|
|
1023
1037
|
i(o);
|
|
1024
|
-
}, []),
|
|
1038
|
+
}, []), ht = N(() => {
|
|
1025
1039
|
const t = Ce.current ? Ce.current.length + 3 : 3, r = C ? t + 1 : t;
|
|
1026
1040
|
return `vs:lg:grid-cols-${r > 8 ? 8 : r}`;
|
|
1027
1041
|
}, [C]);
|
|
@@ -1086,12 +1100,12 @@ function Mt({
|
|
|
1086
1100
|
]);
|
|
1087
1101
|
const [ze, Ee] = A(!1);
|
|
1088
1102
|
return B(() => {
|
|
1089
|
-
if (
|
|
1103
|
+
if (O)
|
|
1090
1104
|
return ze ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
1091
1105
|
document.body.style.overflow = "";
|
|
1092
1106
|
};
|
|
1093
|
-
}, [ze,
|
|
1094
|
-
|
|
1107
|
+
}, [ze, O]), /* @__PURE__ */ E($e, { children: [
|
|
1108
|
+
O && /* @__PURE__ */ a(
|
|
1095
1109
|
"button",
|
|
1096
1110
|
{
|
|
1097
1111
|
onClick: () => Ee(!0),
|
|
@@ -1100,10 +1114,10 @@ function Mt({
|
|
|
1100
1114
|
"vehicle-search-btn vs:md:hidden!",
|
|
1101
1115
|
V ? "vs:w-full! vs:flex! vs:shrink-0!" : "vs:w-auto! vs:inline-flex! vs:shrink!"
|
|
1102
1116
|
),
|
|
1103
|
-
children: /* @__PURE__ */ a("span", { children:
|
|
1117
|
+
children: /* @__PURE__ */ a("span", { children: l })
|
|
1104
1118
|
}
|
|
1105
1119
|
),
|
|
1106
|
-
|
|
1120
|
+
O && /* @__PURE__ */ a(
|
|
1107
1121
|
"div",
|
|
1108
1122
|
{
|
|
1109
1123
|
onClick: () => Ee(!1),
|
|
@@ -1118,11 +1132,11 @@ function Mt({
|
|
|
1118
1132
|
{
|
|
1119
1133
|
className: ne(
|
|
1120
1134
|
"partbot-mmyvs-container",
|
|
1121
|
-
|
|
1135
|
+
O && ze && "active",
|
|
1122
1136
|
"w-full"
|
|
1123
1137
|
),
|
|
1124
1138
|
children: [
|
|
1125
|
-
|
|
1139
|
+
O && /* @__PURE__ */ E("div", { className: "vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden", children: [
|
|
1126
1140
|
/* @__PURE__ */ a("span", { children: "Select Vehicle" }),
|
|
1127
1141
|
/* @__PURE__ */ E(
|
|
1128
1142
|
"button",
|
|
@@ -1149,10 +1163,10 @@ function Mt({
|
|
|
1149
1163
|
/* @__PURE__ */ E(
|
|
1150
1164
|
"div",
|
|
1151
1165
|
{
|
|
1152
|
-
ref:
|
|
1166
|
+
ref: U,
|
|
1153
1167
|
className: ne(
|
|
1154
1168
|
"vs:grid vs:gap-3",
|
|
1155
|
-
I === "row" ? `${
|
|
1169
|
+
I === "row" ? `${ht()} vs:grid-cols-1 vs:md:grid-cols-3` : "vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5",
|
|
1156
1170
|
"vs:w-full vs:transition vs:lg:mx-auto"
|
|
1157
1171
|
),
|
|
1158
1172
|
children: [
|
|
@@ -1262,7 +1276,7 @@ function Mt({
|
|
|
1262
1276
|
{
|
|
1263
1277
|
label: "Body",
|
|
1264
1278
|
items: Le,
|
|
1265
|
-
refine:
|
|
1279
|
+
refine: st,
|
|
1266
1280
|
selected: e.body,
|
|
1267
1281
|
bgDark: H,
|
|
1268
1282
|
showLabel: _,
|
|
@@ -1279,7 +1293,7 @@ function Mt({
|
|
|
1279
1293
|
{
|
|
1280
1294
|
label: "Series",
|
|
1281
1295
|
items: Ie,
|
|
1282
|
-
refine:
|
|
1296
|
+
refine: lt,
|
|
1283
1297
|
selected: e.series,
|
|
1284
1298
|
bgDark: H,
|
|
1285
1299
|
showLabel: _,
|
|
@@ -1296,7 +1310,7 @@ function Mt({
|
|
|
1296
1310
|
{
|
|
1297
1311
|
label: "Variant",
|
|
1298
1312
|
items: Ve,
|
|
1299
|
-
refine:
|
|
1313
|
+
refine: ct,
|
|
1300
1314
|
selected: e.variant,
|
|
1301
1315
|
bgDark: H,
|
|
1302
1316
|
showLabel: _,
|
|
@@ -1312,13 +1326,13 @@ function Mt({
|
|
|
1312
1326
|
X,
|
|
1313
1327
|
{
|
|
1314
1328
|
label: "Engine Capacity",
|
|
1315
|
-
items:
|
|
1316
|
-
refine:
|
|
1329
|
+
items: Ue,
|
|
1330
|
+
refine: pt,
|
|
1317
1331
|
selected: e.engine_capacity,
|
|
1318
1332
|
bgDark: H,
|
|
1319
1333
|
showLabel: _,
|
|
1320
1334
|
isMobile: J,
|
|
1321
|
-
loading: !!(e.make && e.model && e.year) &&
|
|
1335
|
+
loading: !!(e.make && e.model && e.year) && Ue.length === 0,
|
|
1322
1336
|
shouldBeActive: !!(e.make && e.model && e.year)
|
|
1323
1337
|
},
|
|
1324
1338
|
"engine_capacity"
|
|
@@ -1330,7 +1344,7 @@ function Mt({
|
|
|
1330
1344
|
{
|
|
1331
1345
|
label: "Engine",
|
|
1332
1346
|
items: De,
|
|
1333
|
-
refine:
|
|
1347
|
+
refine: dt,
|
|
1334
1348
|
selected: e.engine,
|
|
1335
1349
|
bgDark: H,
|
|
1336
1350
|
showLabel: _,
|
|
@@ -1349,18 +1363,18 @@ function Mt({
|
|
|
1349
1363
|
{
|
|
1350
1364
|
className: "vehicle-search-btn",
|
|
1351
1365
|
onClick: () => {
|
|
1352
|
-
Me(!0),
|
|
1366
|
+
Me(!0), F && !q ? window.location.href = F + window.location.search : it();
|
|
1353
1367
|
},
|
|
1354
1368
|
children: [
|
|
1355
1369
|
/* @__PURE__ */ a("span", { children: y }),
|
|
1356
|
-
|
|
1370
|
+
Ge && /* @__PURE__ */ a(Pe, { className: "vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin" })
|
|
1357
1371
|
]
|
|
1358
1372
|
}
|
|
1359
1373
|
) })
|
|
1360
1374
|
]
|
|
1361
1375
|
}
|
|
1362
1376
|
),
|
|
1363
|
-
|
|
1377
|
+
T && /* @__PURE__ */ a(
|
|
1364
1378
|
"div",
|
|
1365
1379
|
{
|
|
1366
1380
|
className: ne(
|
|
@@ -1389,9 +1403,9 @@ function Mt({
|
|
|
1389
1403
|
)
|
|
1390
1404
|
] });
|
|
1391
1405
|
}
|
|
1392
|
-
let
|
|
1406
|
+
let Je = !1, me = !1;
|
|
1393
1407
|
function At(b) {
|
|
1394
|
-
var
|
|
1408
|
+
var O, ee;
|
|
1395
1409
|
const v = b.shadowRoot;
|
|
1396
1410
|
if (!v) {
|
|
1397
1411
|
console.error("[ShadowDOMPatch] No shadow root found");
|
|
@@ -1425,29 +1439,29 @@ function At(b) {
|
|
|
1425
1439
|
}).observe(p, {
|
|
1426
1440
|
childList: !0,
|
|
1427
1441
|
subtree: !0
|
|
1428
|
-
}),
|
|
1442
|
+
}), Je)
|
|
1429
1443
|
return;
|
|
1430
|
-
const R = (
|
|
1444
|
+
const R = (O = Object.getOwnPropertyDescriptor(
|
|
1431
1445
|
Document.prototype,
|
|
1432
1446
|
"activeElement"
|
|
1433
|
-
)) == null ? void 0 :
|
|
1447
|
+
)) == null ? void 0 : O.get;
|
|
1434
1448
|
Object.defineProperty(Document.prototype, "activeElement", {
|
|
1435
1449
|
get: function() {
|
|
1436
1450
|
const u = R == null ? void 0 : R.call(this);
|
|
1437
1451
|
return u === b ? v.activeElement : u;
|
|
1438
1452
|
}
|
|
1439
1453
|
});
|
|
1440
|
-
const P = (
|
|
1454
|
+
const P = (ee = Object.getOwnPropertyDescriptor(
|
|
1441
1455
|
Event.prototype,
|
|
1442
1456
|
"target"
|
|
1443
|
-
)) == null ? void 0 :
|
|
1457
|
+
)) == null ? void 0 : ee.get;
|
|
1444
1458
|
Object.defineProperty(Event.prototype, "target", {
|
|
1445
1459
|
get: function() {
|
|
1446
1460
|
const u = P == null ? void 0 : P.call(this);
|
|
1447
1461
|
return u === b ? this.composedPath()[0] : u;
|
|
1448
1462
|
}
|
|
1449
1463
|
});
|
|
1450
|
-
const
|
|
1464
|
+
const T = (u) => {
|
|
1451
1465
|
try {
|
|
1452
1466
|
return document.body && u === document.body.style;
|
|
1453
1467
|
} catch {
|
|
@@ -1455,7 +1469,7 @@ function At(b) {
|
|
|
1455
1469
|
}
|
|
1456
1470
|
}, _ = CSSStyleDeclaration.prototype.setProperty;
|
|
1457
1471
|
CSSStyleDeclaration.prototype.setProperty = function(u, y, C) {
|
|
1458
|
-
if (!(
|
|
1472
|
+
if (!(T(this) && u === "overflow" && y === "hidden" && me))
|
|
1459
1473
|
return _.call(this, u, y, C);
|
|
1460
1474
|
};
|
|
1461
1475
|
const V = Object.getOwnPropertyDescriptor(
|
|
@@ -1467,10 +1481,10 @@ function At(b) {
|
|
|
1467
1481
|
return V.get.call(this);
|
|
1468
1482
|
},
|
|
1469
1483
|
set: function(u) {
|
|
1470
|
-
if (!(
|
|
1484
|
+
if (!(T(this) && u === "hidden" && me))
|
|
1471
1485
|
return V.set.call(this, u);
|
|
1472
1486
|
}
|
|
1473
|
-
}),
|
|
1487
|
+
}), Je = !0;
|
|
1474
1488
|
}
|
|
1475
1489
|
const Et = "/css/vehicle-search.css", Yt = Et;
|
|
1476
1490
|
class jt extends HTMLElement {
|
|
@@ -1481,7 +1495,7 @@ class jt extends HTMLElement {
|
|
|
1481
1495
|
}
|
|
1482
1496
|
let v = document.createElement("style");
|
|
1483
1497
|
v.textContent = zt;
|
|
1484
|
-
const p = document.createElement("div"),
|
|
1498
|
+
const p = document.createElement("div"), F = this.attachShadow({ mode: "open" }), I = (j, Q, w) => {
|
|
1485
1499
|
let W;
|
|
1486
1500
|
if (this.hasAttribute(Q)) {
|
|
1487
1501
|
const M = this.getAttribute(Q);
|
|
@@ -1500,7 +1514,7 @@ class jt extends HTMLElement {
|
|
|
1500
1514
|
"partbot-button-color",
|
|
1501
1515
|
"data-button-color",
|
|
1502
1516
|
"0 0 0"
|
|
1503
|
-
),
|
|
1517
|
+
), T = I(
|
|
1504
1518
|
"partbot-button-hover-color",
|
|
1505
1519
|
"data-button-hover-color",
|
|
1506
1520
|
"0 0 0"
|
|
@@ -1512,13 +1526,13 @@ class jt extends HTMLElement {
|
|
|
1512
1526
|
"partbot-button-hover-label-color",
|
|
1513
1527
|
"data-button-hover-label-color",
|
|
1514
1528
|
"255 255 255"
|
|
1515
|
-
),
|
|
1529
|
+
), O = I(
|
|
1516
1530
|
"partbot-mobile-background-color",
|
|
1517
1531
|
"data-mobile-background-color",
|
|
1518
1532
|
"0 0 0"
|
|
1519
|
-
),
|
|
1520
|
-
const q = this.getAttribute("data-input-shadow"),
|
|
1521
|
-
let G = `:host { --partbot-input-shadow: ${
|
|
1533
|
+
), ee = `:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius") || "0.375rem"}; }`, u = `:host { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size") || "0.875rem"}; }`, y = `:host { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family") || this.getAttribute("data-font")) && (this.getAttribute("data-font-family") || this.getAttribute("data-font")).trim() !== "" ? this.getAttribute("data-font-family") || this.getAttribute("data-font") : '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`, C = `:host { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding") || "0.5rem"}; }`;
|
|
1534
|
+
const q = this.getAttribute("data-input-shadow"), te = q === "none" ? "none" : q || "0 1px 2px 0 rgb(0 0 0 / 0.05)";
|
|
1535
|
+
let G = `:host { --partbot-input-shadow: ${te}; } .partbot-mmyvs-container { --partbot-input-shadow: ${te}; }`;
|
|
1522
1536
|
const f = this.getAttribute("data-input-border-color");
|
|
1523
1537
|
let D = "229 231 235";
|
|
1524
1538
|
if (f)
|
|
@@ -1527,9 +1541,9 @@ class jt extends HTMLElement {
|
|
|
1527
1541
|
D = `${j} ${Q} ${w}`;
|
|
1528
1542
|
} else /^\d+\s+\d+\s+\d+$/.test(f) && (D = f);
|
|
1529
1543
|
let g = `:host { --partbot-input-border-color: ${D}; } .partbot-mmyvs-container { --partbot-input-border-color: ${D}; }`;
|
|
1530
|
-
const
|
|
1531
|
-
let
|
|
1532
|
-
v.textContent += R, v.textContent += P, v.textContent +=
|
|
1544
|
+
const l = this.getAttribute("data-input-border-width") || "1px";
|
|
1545
|
+
let U = `:host { --partbot-input-border-width: ${l}; } .partbot-mmyvs-container { --partbot-input-border-width: ${l}; }`;
|
|
1546
|
+
v.textContent += R, v.textContent += P, v.textContent += T, v.textContent += _, v.textContent += V, v.textContent += O, v.textContent += ee, v.textContent += u, v.textContent += y, v.textContent += C, v.textContent += G, v.textContent += g, v.textContent += U, F.appendChild(v), F.appendChild(p);
|
|
1533
1547
|
const z = this.getAttribute("data-api-key");
|
|
1534
1548
|
if (!z) {
|
|
1535
1549
|
console.warn("Missing attributes: " + (z ? "" : "data-api-key "));
|
|
@@ -1545,7 +1559,7 @@ class jt extends HTMLElement {
|
|
|
1545
1559
|
}
|
|
1546
1560
|
At(this);
|
|
1547
1561
|
const K = /* @__PURE__ */ a(Mt, { ...S });
|
|
1548
|
-
|
|
1562
|
+
ft.render(K, p);
|
|
1549
1563
|
}
|
|
1550
1564
|
}
|
|
1551
1565
|
customElements.define("vehicle-search", jt);
|