@getlupa/client 1.12.9 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,45 @@
1
1
  (function(global2, factory) {
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.LupaSearch = {}));
3
- })(this, function(exports2) {
4
- "use strict";var __defProp = Object.defineProperty;
5
- var __defProps = Object.defineProperties;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
3
+ })(this, function(exports) {
4
+ "use strict";var __defProp2 = Object.defineProperty;
5
+ var __defProps2 = Object.defineProperties;
6
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues2 = (a, b) => {
12
12
  for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
13
+ if (__hasOwnProp2.call(b, prop))
14
+ __defNormalProp2(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols2)
16
+ for (var prop of __getOwnPropSymbols2(b)) {
17
+ if (__propIsEnum2.call(b, prop))
18
+ __defNormalProp2(a, prop, b[prop]);
19
19
  }
20
20
  return a;
21
21
  };
22
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
23
+ var __async2 = (__this, __arguments, generator) => {
24
+ return new Promise((resolve2, reject) => {
25
+ var fulfilled = (value) => {
26
+ try {
27
+ step(generator.next(value));
28
+ } catch (e2) {
29
+ reject(e2);
30
+ }
31
+ };
32
+ var rejected = (value) => {
33
+ try {
34
+ step(generator.throw(value));
35
+ } catch (e2) {
36
+ reject(e2);
37
+ }
38
+ };
39
+ var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
40
+ step((generator = generator.apply(__this, __arguments)).next());
41
+ });
42
+ };
23
43
 
24
44
  function makeMap(str, expectsLowerCase) {
25
45
  const map = /* @__PURE__ */ Object.create(null);
@@ -6305,7 +6325,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6305
6325
  }
6306
6326
  const createApp = (...args) => {
6307
6327
  const app2 = ensureRenderer().createApp(...args);
6308
- const { mount } = app2;
6328
+ const { mount: mount2 } = app2;
6309
6329
  app2.mount = (containerOrSelector) => {
6310
6330
  const container = normalizeContainer(containerOrSelector);
6311
6331
  if (!container)
@@ -6315,7 +6335,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6315
6335
  component.template = container.innerHTML;
6316
6336
  }
6317
6337
  container.innerHTML = "";
6318
- const proxy = mount(container, false, container instanceof SVGElement);
6338
+ const proxy = mount2(container, false, container instanceof SVGElement);
6319
6339
  if (container instanceof Element) {
6320
6340
  container.removeAttribute("v-cloak");
6321
6341
  container.setAttribute("data-v-app", "");
@@ -6331,25 +6351,25 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6331
6351
  }
6332
6352
  return container;
6333
6353
  }
6334
- var __defProp2 = Object.defineProperty;
6335
- var __defProps2 = Object.defineProperties;
6336
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
6337
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
6338
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
6339
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
6340
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6341
- var __spreadValues2 = (a, b) => {
6354
+ var __defProp = Object.defineProperty;
6355
+ var __defProps = Object.defineProperties;
6356
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6357
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6358
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6359
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6360
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6361
+ var __spreadValues = (a, b) => {
6342
6362
  for (var prop in b || (b = {}))
6343
- if (__hasOwnProp2.call(b, prop))
6344
- __defNormalProp2(a, prop, b[prop]);
6345
- if (__getOwnPropSymbols2)
6346
- for (var prop of __getOwnPropSymbols2(b)) {
6347
- if (__propIsEnum2.call(b, prop))
6348
- __defNormalProp2(a, prop, b[prop]);
6363
+ if (__hasOwnProp.call(b, prop))
6364
+ __defNormalProp(a, prop, b[prop]);
6365
+ if (__getOwnPropSymbols)
6366
+ for (var prop of __getOwnPropSymbols(b)) {
6367
+ if (__propIsEnum.call(b, prop))
6368
+ __defNormalProp(a, prop, b[prop]);
6349
6369
  }
6350
6370
  return a;
6351
6371
  };
6352
- var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6372
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6353
6373
  var __async = (__this, __arguments, generator) => {
6354
6374
  return new Promise((resolve2, reject) => {
6355
6375
  var fulfilled = (value) => {
@@ -6815,14 +6835,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6815
6835
  step((generator = generator.apply(thisArg, _arguments || [])).next());
6816
6836
  });
6817
6837
  };
6818
- const defaultConfig$1 = {
6838
+ const defaultConfig = {
6819
6839
  method: "POST",
6820
6840
  headers: { "Content-Type": "application/json" }
6821
6841
  };
6822
6842
  const customRequestConfig = ({ customHeaders }) => {
6823
6843
  return {
6824
- method: defaultConfig$1.method,
6825
- headers: Object.assign(Object.assign({}, defaultConfig$1.headers), customHeaders !== null && customHeaders !== void 0 ? customHeaders : {})
6844
+ method: defaultConfig.method,
6845
+ headers: Object.assign(Object.assign({}, defaultConfig.headers), customHeaders !== null && customHeaders !== void 0 ? customHeaders : {})
6826
6846
  };
6827
6847
  };
6828
6848
  const searchCustom = (query, options) => __awaiter(void 0, void 0, void 0, function* () {
@@ -6846,7 +6866,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6846
6866
  return { success: false, errors };
6847
6867
  });
6848
6868
  const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6849
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
6869
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
6850
6870
  if (res.status < 400) {
6851
6871
  const data = yield res.json();
6852
6872
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6856,7 +6876,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6856
6876
  });
6857
6877
  const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6858
6878
  const idParam = ids.map((id) => `ids=${id}`).join("&");
6859
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6879
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6860
6880
  if (res.status < 400) {
6861
6881
  const data = yield res.json();
6862
6882
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6869,7 +6889,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6869
6889
  if (filters) {
6870
6890
  url += `&${e({ filters })}`;
6871
6891
  }
6872
- const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6892
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6873
6893
  if (res.status < 400) {
6874
6894
  const data = yield res.json();
6875
6895
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6883,7 +6903,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6883
6903
  if (filters) {
6884
6904
  url += `&${e({ filters })}`;
6885
6905
  }
6886
- const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6906
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6887
6907
  if (res.status < 400) {
6888
6908
  const data = yield res.json();
6889
6909
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6895,7 +6915,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6895
6915
  return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
6896
6916
  });
6897
6917
  const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6898
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
6918
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
6899
6919
  if (res.status < 400) {
6900
6920
  const items = yield res.json();
6901
6921
  return { items, success: true };
@@ -6905,7 +6925,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6905
6925
  });
6906
6926
  const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6907
6927
  try {
6908
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
6928
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
6909
6929
  if (res.status < 400) {
6910
6930
  return { success: false };
6911
6931
  }
@@ -6915,7 +6935,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6915
6935
  }
6916
6936
  });
6917
6937
  const loadRedirectionRules = (queryKey, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6918
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}redirections/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6938
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}redirections/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6919
6939
  if (res.status < 400) {
6920
6940
  return res.json();
6921
6941
  }
@@ -7247,13 +7267,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7247
7267
  }
7248
7268
  const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7249
7269
  const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7250
- const params = __spreadValues2({
7270
+ const params = __spreadValues({
7251
7271
  search_text: data.searchQuery,
7252
7272
  item_title: title,
7253
7273
  item_id: data.itemId,
7254
7274
  ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7255
7275
  }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7256
- window.dataLayer.push(__spreadValues2({
7276
+ window.dataLayer.push(__spreadValues({
7257
7277
  event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7258
7278
  }, params));
7259
7279
  };
@@ -7431,15 +7451,21 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7431
7451
  breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
7432
7452
  };
7433
7453
  const useScreenStore = defineStore("screen", () => {
7434
- const screenWidth = ref(1e3);
7454
+ const measuredScreenWidth = ref(1e3);
7435
7455
  const optionsStore = useOptionsStore();
7456
+ const screenWidth = computed(() => {
7457
+ var _a, _b;
7458
+ const { searchResultOptions } = storeToRefs(optionsStore);
7459
+ return (_b = (_a = searchResultOptions.value.grid) == null ? void 0 : _a.forcedScreenWidth) != null ? _b : measuredScreenWidth.value;
7460
+ });
7436
7461
  const configuredGridSizes = computed(() => {
7437
7462
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7463
+ const { searchResultOptions } = storeToRefs(optionsStore);
7438
7464
  return {
7439
- smMin: (_d = (_c = (_b = (_a = optionsStore.searchResultOptions) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7440
- mdMin: (_h = (_g = (_f = (_e = optionsStore.searchResultOptions) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7441
- lMin: (_l = (_k = (_j = (_i = optionsStore.searchResultOptions) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7442
- xlMin: (_p = (_o = (_n = (_m = optionsStore.searchResultOptions) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7465
+ smMin: (_d = (_c = (_b = (_a = searchResultOptions == null ? void 0 : searchResultOptions.value) == null ? void 0 : _a.grid) == null ? void 0 : _b.sizes) == null ? void 0 : _c.sm) != null ? _d : S_MIN_WIDTH,
7466
+ mdMin: (_h = (_g = (_f = (_e = searchResultOptions == null ? void 0 : searchResultOptions.value) == null ? void 0 : _e.grid) == null ? void 0 : _f.sizes) == null ? void 0 : _g.md) != null ? _h : MD_MIN_WIDTH,
7467
+ lMin: (_l = (_k = (_j = (_i = searchResultOptions == null ? void 0 : searchResultOptions.value) == null ? void 0 : _i.grid) == null ? void 0 : _j.sizes) == null ? void 0 : _k.l) != null ? _l : L_MIN_WIDTH,
7468
+ xlMin: (_p = (_o = (_n = (_m = searchResultOptions == null ? void 0 : searchResultOptions.value) == null ? void 0 : _m.grid) == null ? void 0 : _n.sizes) == null ? void 0 : _o.xl) != null ? _p : XL_MIN_WIDTH
7443
7469
  };
7444
7470
  });
7445
7471
  const currentScreenWidth = computed(() => {
@@ -7461,7 +7487,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7461
7487
  return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7462
7488
  });
7463
7489
  const setScreenWidth = ({ width }) => {
7464
- screenWidth.value = width;
7490
+ measuredScreenWidth.value = width;
7465
7491
  };
7466
7492
  return { screenWidth, currentScreenWidth, isMobileWidth, setScreenWidth };
7467
7493
  });
@@ -7741,7 +7767,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7741
7767
  const getLabeledFilters = (filters, facets) => {
7742
7768
  return filters.map((f2) => {
7743
7769
  var _a, _b;
7744
- return __spreadProps2(__spreadValues2({}, f2), {
7770
+ return __spreadProps(__spreadValues({}, f2), {
7745
7771
  label: (_b = (_a = facets == null ? void 0 : facets.find((ft) => ft.key === f2.key)) == null ? void 0 : _a.label) != null ? _b : capitalize$1(f2.key)
7746
7772
  });
7747
7773
  });
@@ -7769,7 +7795,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7769
7795
  }
7770
7796
  const children = recursiveFilter(item.children, query).filter(Boolean);
7771
7797
  const include = children.length > 0 || filterable;
7772
- return include ? __spreadProps2(__spreadValues2({}, item), {
7798
+ return include ? __spreadProps(__spreadValues({}, item), {
7773
7799
  children
7774
7800
  }) : void 0;
7775
7801
  };
@@ -7851,7 +7877,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7851
7877
  params.filters = {};
7852
7878
  for (const key of facetKeys) {
7853
7879
  const parsedKey = key.slice(key.indexOf(FACET_KEY_SEPARATOR) + 1);
7854
- params.filters = __spreadProps2(__spreadValues2({}, params.filters), {
7880
+ params.filters = __spreadProps(__spreadValues({}, params.filters), {
7855
7881
  [parsedKey]: parseFacetKey(key, searchParams)
7856
7882
  });
7857
7883
  }
@@ -7864,7 +7890,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7864
7890
  const paramKeys = Array.from(searchParams.keys());
7865
7891
  const facetKeys = paramKeys.filter((k) => isFacetKey(k));
7866
7892
  const regularKeys = paramKeys.filter((k) => !isFacetKey(k));
7867
- const r = __spreadValues2(__spreadValues2({
7893
+ const r = __spreadValues(__spreadValues({
7868
7894
  [QUERY_PARAMS_PARSED.QUERY]: ""
7869
7895
  }, parseRegularKeys(regularKeys, searchParams, getQueryParamName)), parseFacetKeys(facetKeys, searchParams));
7870
7896
  return r;
@@ -7914,7 +7940,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
7914
7940
  const encoded = encodeURIComponent(param);
7915
7941
  return encoded.replace(/%C4%85/g, "ą").replace(/%C4%8D/g, "č").replace(/%C4%99/g, "ę").replace(/%C4%97/g, "ė").replace(/%C4%AF/g, "į").replace(/%C5%A1/g, "š").replace(/%C5%B3/g, "ų").replace(/%C5%AB/g, "ū").replace(/%C5%BE/g, "ž").replace(/%20/g, " ");
7916
7942
  };
7917
- const getQueryParam = (name) => {
7943
+ const getQueryParam$1 = (name) => {
7918
7944
  try {
7919
7945
  const urlParams = new URLSearchParams(window.location.search);
7920
7946
  return urlParams.get(name);
@@ -8054,7 +8080,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8054
8080
  const useRedirectionStore = defineStore("redirections", () => {
8055
8081
  const redirections = ref({ rules: [] });
8056
8082
  const redirectionOptions = ref({ enabled: false, queryKey: "" });
8057
- const saveToLocalStorage = () => {
8083
+ const saveToLocalStorage2 = () => {
8058
8084
  try {
8059
8085
  localStorage.setItem(
8060
8086
  CACHE_KEY,
@@ -8063,7 +8089,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8063
8089
  } catch (e2) {
8064
8090
  }
8065
8091
  };
8066
- const tryLoadFromLocalStorage = (config) => {
8092
+ const tryLoadFromLocalStorage2 = (config) => {
8067
8093
  var _a;
8068
8094
  if (!config.cacheSeconds)
8069
8095
  return false;
@@ -8086,7 +8112,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8086
8112
  if (!(config == null ? void 0 : config.enabled)) {
8087
8113
  return;
8088
8114
  }
8089
- const loaded = tryLoadFromLocalStorage(config);
8115
+ const loaded = tryLoadFromLocalStorage2(config);
8090
8116
  if (loaded || ((_c = (_b = redirections.value) == null ? void 0 : _b.rules) == null ? void 0 : _c.length) > 0) {
8091
8117
  return;
8092
8118
  }
@@ -8096,7 +8122,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8096
8122
  return;
8097
8123
  }
8098
8124
  redirections.value = result;
8099
- saveToLocalStorage();
8125
+ saveToLocalStorage2();
8100
8126
  } catch (e2) {
8101
8127
  }
8102
8128
  });
@@ -8222,12 +8248,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8222
8248
  return;
8223
8249
  }
8224
8250
  const forceFullReload = (_a = optionsStore.searchBoxOptions.forceFullReloadOnParams) == null ? void 0 : _a.some(
8225
- (p2) => getQueryParam(p2)
8251
+ (p2) => getQueryParam$1(p2)
8226
8252
  );
8227
8253
  if ((!searchResultsLink.value || linksMatch(searchResultsLink.value, window.location.pathname)) && !forceFullReload) {
8228
8254
  const singleFacetParam = facet ? getFacetParam(facet.key, [facet.title]) : void 0;
8229
8255
  const facetParam = singleFacetParam ? [
8230
- __spreadProps2(__spreadValues2({}, singleFacetParam), {
8256
+ __spreadProps(__spreadValues({}, singleFacetParam), {
8231
8257
  value: Array.isArray(singleFacetParam.value) ? singleFacetParam.value[0] : singleFacetParam.value
8232
8258
  })
8233
8259
  ] : [];
@@ -8316,7 +8342,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8316
8342
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
8317
8343
  display: suggestion.suggestion,
8318
8344
  suggestion,
8319
- facet: __spreadValues2({
8345
+ facet: __spreadValues({
8320
8346
  key
8321
8347
  }, f2)
8322
8348
  }));
@@ -8423,14 +8449,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8423
8449
  const context = getLupaTrackingContext();
8424
8450
  const result = yield LupaSearchSdk.suggestions(
8425
8451
  queryKey,
8426
- __spreadValues2(__spreadValues2({}, publicQuery), context),
8452
+ __spreadValues(__spreadValues({}, publicQuery), context),
8427
8453
  options2
8428
8454
  );
8429
8455
  if (!result.success) {
8430
8456
  return { suggestions: void 0 };
8431
8457
  }
8432
8458
  highlightChange({ action: "clear" });
8433
- suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
8459
+ suggestionResults.value = __spreadProps(__spreadValues({}, suggestionResults.value), {
8434
8460
  [queryKey]: flattenSuggestions(result.items, (_a = publicQuery.searchText) != null ? _a : "")
8435
8461
  });
8436
8462
  inputValue.value = publicQuery.searchText;
@@ -8467,12 +8493,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8467
8493
  }) {
8468
8494
  try {
8469
8495
  const context = getLupaTrackingContext();
8470
- const result = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
8496
+ const result = yield LupaSearchSdk.query(queryKey, __spreadValues(__spreadValues({}, publicQuery), context), options2);
8471
8497
  if (!result.success) {
8472
8498
  return { queryKey, result: { items: [] } };
8473
8499
  }
8474
8500
  highlightChange({ action: "clear" });
8475
- docResults.value = __spreadProps2(__spreadValues2({}, docResults.value), { [queryKey]: result });
8501
+ docResults.value = __spreadProps(__spreadValues({}, docResults.value), { [queryKey]: result });
8476
8502
  emitSearchResultsCallback();
8477
8503
  return { queryKey, result };
8478
8504
  } catch (err) {
@@ -8574,7 +8600,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
8574
8600
  );
8575
8601
  const inputAttributes = computed(() => {
8576
8602
  var _a;
8577
- return __spreadValues2({}, (_a = props.options.inputAttributes) != null ? _a : {});
8603
+ return __spreadValues({}, (_a = props.options.inputAttributes) != null ? _a : {});
8578
8604
  });
8579
8605
  const ariaLabel = computed(() => {
8580
8606
  var _a;
@@ -9062,7 +9088,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9062
9088
  if (!requestedIds.length) {
9063
9089
  return;
9064
9090
  }
9065
- loadingIds.value = requestedIds.reduce((a, c2) => __spreadProps2(__spreadValues2({}, a), { [c2]: true }), {});
9091
+ loadingIds.value = requestedIds.reduce((a, c2) => __spreadProps(__spreadValues({}, a), { [c2]: true }), {});
9066
9092
  loading.value = true;
9067
9093
  try {
9068
9094
  const dynamicData = dynamicSearchResultData.value || dynamicSearchBoxData.value;
@@ -9072,10 +9098,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9072
9098
  const dynamicDataResult = (_h = yield dynamicData == null ? void 0 : dynamicData.handler(requestedIds)) != null ? _h : [];
9073
9099
  const seed = {};
9074
9100
  const dynamicDataIdMapValue = dynamicDataResult.reduce(
9075
- (a, c2) => __spreadProps2(__spreadValues2({}, a), { [`${c2.id}`]: c2 }),
9101
+ (a, c2) => __spreadProps(__spreadValues({}, a), { [`${c2.id}`]: c2 }),
9076
9102
  seed
9077
9103
  );
9078
- dynamicDataIdMap.value = __spreadValues2(__spreadValues2({}, dynamicDataIdMap.value), dynamicDataIdMapValue);
9104
+ dynamicDataIdMap.value = __spreadValues(__spreadValues({}, dynamicDataIdMap.value), dynamicDataIdMapValue);
9079
9105
  } finally {
9080
9106
  loading.value = false;
9081
9107
  loadingIds.value = {};
@@ -9541,17 +9567,17 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9541
9567
  return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
9542
9568
  }
9543
9569
  );
9544
- const setSidebarState = ({ visible }) => {
9545
- if (visible) {
9570
+ const setSidebarState = ({ visible: visible2 }) => {
9571
+ if (visible2) {
9546
9572
  disableBodyScroll();
9547
9573
  } else {
9548
9574
  enableBodyScroll();
9549
9575
  }
9550
- isMobileSidebarVisible.value = visible;
9576
+ isMobileSidebarVisible.value = visible2;
9551
9577
  };
9552
9578
  const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
9553
9579
  var _a, _b, _c, _d;
9554
- const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
9580
+ const query = { searchText: "", filters: __spreadValues({}, filters.value) };
9555
9581
  const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
9556
9582
  const result = yield LupaSearchSdk.query(queryKey, query, options);
9557
9583
  if (!result.success) {
@@ -9559,8 +9585,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9559
9585
  }
9560
9586
  const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
9561
9587
  const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
9562
- const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
9563
- facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
9588
+ const updatedResult = __spreadProps(__spreadValues({}, searchResult.value), {
9589
+ facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps(__spreadValues({}, f2), { items: facetItems }) : f2)
9564
9590
  });
9565
9591
  searchResult.value = updatedResult;
9566
9592
  });
@@ -9709,7 +9735,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9709
9735
  SearchBoxProductAddToCart: _sfc_main$17
9710
9736
  }
9711
9737
  };
9712
- const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
9738
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
9713
9739
  __name: "SearchBoxProductElement",
9714
9740
  props: {
9715
9741
  item: {},
@@ -9751,7 +9777,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9751
9777
  return props.item;
9752
9778
  }
9753
9779
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
9754
- return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
9780
+ return __spreadValues(__spreadValues({}, props.item), enhancementData);
9755
9781
  });
9756
9782
  const isLoadingDynamicData = (id) => {
9757
9783
  return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
@@ -9968,7 +9994,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9968
9994
  ImageBadge: _sfc_main$11
9969
9995
  }
9970
9996
  };
9971
- const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
9997
+ const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
9972
9998
  __name: "SearchResultsBadgeWrapper",
9973
9999
  props: {
9974
10000
  position: {},
@@ -9991,7 +10017,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
9991
10017
  return props.options.product;
9992
10018
  }
9993
10019
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.options.product) == null ? void 0 : _b.id]) != null ? _d : {};
9994
- return __spreadValues2(__spreadValues2({}, props.options.product), enhancementData);
10020
+ return __spreadValues(__spreadValues({}, props.options.product), enhancementData);
9995
10021
  });
9996
10022
  const badges = computed(() => {
9997
10023
  if (!props.options.elements) {
@@ -10002,7 +10028,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10002
10028
  return !e2.display || e2.display((_a = props.options.product) != null ? _a : {});
10003
10029
  }).map((x) => {
10004
10030
  var _a;
10005
- return __spreadProps2(__spreadValues2({}, x), {
10031
+ return __spreadProps(__spreadValues({}, x), {
10006
10032
  value: ((_a = enhancedProduct.value) == null ? void 0 : _a[x.key]) || "badge",
10007
10033
  product: enhancedProduct.value
10008
10034
  });
@@ -10069,7 +10095,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10069
10095
  return generateLink((_b = (_a = props.panelOptions.links) == null ? void 0 : _a.details) != null ? _b : "", props.item);
10070
10096
  });
10071
10097
  const badgeOptions = computed(() => {
10072
- return __spreadProps2(__spreadValues2({}, props.panelOptions.badges), { product: props.item });
10098
+ return __spreadProps(__spreadValues({}, props.panelOptions.badges), { product: props.item });
10073
10099
  });
10074
10100
  const imageElements = computed(() => {
10075
10101
  var _a, _b;
@@ -10208,8 +10234,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10208
10234
  const mappedItems = ((_e = trackingOptions.analytics) == null ? void 0 : _e.itemMap) ? items.map(trackingOptions.analytics.itemMap) : items;
10209
10235
  track(
10210
10236
  queryKey,
10211
- __spreadProps2(__spreadValues2({}, data), {
10212
- analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
10237
+ __spreadProps(__spreadValues({}, data), {
10238
+ analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0,
10213
10239
  filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
10214
10240
  }),
10215
10241
  options
@@ -10503,7 +10529,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10503
10529
  });
10504
10530
  const getItemsDebounced = debounce$1(getItems, props.debounce);
10505
10531
  const documentPanelOptions = computed(() => {
10506
- return __spreadProps2(__spreadValues2({}, props.panel), {
10532
+ return __spreadProps(__spreadValues({}, props.panel), {
10507
10533
  type: SearchBoxPanelType.DOCUMENT
10508
10534
  });
10509
10535
  });
@@ -10551,7 +10577,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10551
10577
  SearchBoxRelatedSourceWrapper: _sfc_main$X
10552
10578
  }
10553
10579
  };
10554
- const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$2), {
10580
+ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
10555
10581
  __name: "SearchBoxMainPanel",
10556
10582
  props: {
10557
10583
  options: {},
@@ -10863,7 +10889,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10863
10889
  const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
10864
10890
  const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
10865
10891
  const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
10866
- if (!isOutsideElement) {
10892
+ if (!isOutsideElement || props.options.keepOpen) {
10867
10893
  return;
10868
10894
  }
10869
10895
  opened.value = false;
@@ -10882,7 +10908,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10882
10908
  case "Tab":
10883
10909
  if ((_b = (_a2 = suggestedValue == null ? void 0 : suggestedValue.value) == null ? void 0 : _a2.item) == null ? void 0 : _b.suggestion) {
10884
10910
  e2.preventDefault();
10885
- selectSuggestion(__spreadProps2(__spreadValues2({}, suggestedValue.value), { override: true }));
10911
+ selectSuggestion(__spreadProps(__spreadValues({}, suggestedValue.value), { override: true }));
10886
10912
  }
10887
10913
  break;
10888
10914
  case "Enter":
@@ -10931,7 +10957,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
10931
10957
  };
10932
10958
  const selectSuggestion = (inputSuggestion, shouldSearch = false) => {
10933
10959
  if (inputSuggestion.item.suggestion) {
10934
- suggestedValue.value = __spreadProps2(__spreadValues2({}, inputSuggestion), {
10960
+ suggestedValue.value = __spreadProps(__spreadValues({}, inputSuggestion), {
10935
10961
  override: true
10936
10962
  });
10937
10963
  if (inputSuggestion.override) {
@@ -11029,7 +11055,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11029
11055
  opened.value = false;
11030
11056
  };
11031
11057
  const slotProps = (props2) => {
11032
- return __spreadValues2({}, props2);
11058
+ return __spreadValues({}, props2);
11033
11059
  };
11034
11060
  return (_ctx, _cache) => {
11035
11061
  var _a2;
@@ -11117,8 +11143,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11117
11143
  return (page - 1) * limit;
11118
11144
  };
11119
11145
  const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
11120
- return __spreadProps2(__spreadValues2({}, publicQuery), {
11121
- filters: __spreadValues2(__spreadValues2({}, initialFilters), publicQuery.filters),
11146
+ return __spreadProps(__spreadValues({}, publicQuery), {
11147
+ filters: __spreadValues(__spreadValues({}, initialFilters), publicQuery.filters),
11122
11148
  searchText: isProductList ? "" : publicQuery.searchText
11123
11149
  });
11124
11150
  };
@@ -11669,7 +11695,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
11669
11695
  return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11670
11696
  });
11671
11697
  const displayValues = computed(() => {
11672
- return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11698
+ return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps(__spreadValues({}, v), { title: getDisplayValue(v.title) }));
11673
11699
  });
11674
11700
  const filteredValues = computed(() => {
11675
11701
  var _a, _b;
@@ -12610,7 +12636,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12610
12636
  return e3 === r[t2];
12611
12637
  });
12612
12638
  }
12613
- var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide", "drag", "update", "change", "set", "end"], props: __spreadProps2(__spreadValues2({}, { value: { validator: function(e2) {
12639
+ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide", "drag", "update", "change", "set", "end"], props: __spreadProps(__spreadValues({}, { value: { validator: function(e2) {
12614
12640
  return (e3) => "number" == typeof e3 || e3 instanceof Array || null == e3 || false === e3;
12615
12641
  }, required: false }, modelValue: { validator: function(e2) {
12616
12642
  return (e3) => "number" == typeof e3 || e3 instanceof Array || null == e3 || false === e3;
@@ -12623,15 +12649,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12623
12649
  throw new Error("Slider v-model must not be an empty array");
12624
12650
  return { value: l2, initialValue: c3 };
12625
12651
  }(a), c2 = function(t, i, n) {
12626
- const { classes: o, showTooltip: a2, tooltipPosition: s2, orientation: l2 } = toRefs(t), u2 = computed(() => __spreadValues2({ target: "slider-target", focused: "slider-focused", tooltipFocus: "slider-tooltip-focus", tooltipDrag: "slider-tooltip-drag", ltr: "slider-ltr", rtl: "slider-rtl", horizontal: "slider-horizontal", vertical: "slider-vertical", textDirectionRtl: "slider-txt-dir-rtl", textDirectionLtr: "slider-txt-dir-ltr", base: "slider-base", connects: "slider-connects", connect: "slider-connect", origin: "slider-origin", handle: "slider-handle", handleLower: "slider-handle-lower", handleUpper: "slider-handle-upper", touchArea: "slider-touch-area", tooltip: "slider-tooltip", tooltipTop: "slider-tooltip-top", tooltipBottom: "slider-tooltip-bottom", tooltipLeft: "slider-tooltip-left", tooltipRight: "slider-tooltip-right", tooltipHidden: "slider-tooltip-hidden", active: "slider-active", draggable: "slider-draggable", tap: "slider-state-tap", drag: "slider-state-drag", pips: "slider-pips", pipsHorizontal: "slider-pips-horizontal", pipsVertical: "slider-pips-vertical", marker: "slider-marker", markerHorizontal: "slider-marker-horizontal", markerVertical: "slider-marker-vertical", markerNormal: "slider-marker-normal", markerLarge: "slider-marker-large", markerSub: "slider-marker-sub", value: "slider-value", valueHorizontal: "slider-value-horizontal", valueVertical: "slider-value-vertical", valueNormal: "slider-value-normal", valueLarge: "slider-value-large", valueSub: "slider-value-sub" }, o.value));
12652
+ const { classes: o, showTooltip: a2, tooltipPosition: s2, orientation: l2 } = toRefs(t), u2 = computed(() => __spreadValues({ target: "slider-target", focused: "slider-focused", tooltipFocus: "slider-tooltip-focus", tooltipDrag: "slider-tooltip-drag", ltr: "slider-ltr", rtl: "slider-rtl", horizontal: "slider-horizontal", vertical: "slider-vertical", textDirectionRtl: "slider-txt-dir-rtl", textDirectionLtr: "slider-txt-dir-ltr", base: "slider-base", connects: "slider-connects", connect: "slider-connect", origin: "slider-origin", handle: "slider-handle", handleLower: "slider-handle-lower", handleUpper: "slider-handle-upper", touchArea: "slider-touch-area", tooltip: "slider-tooltip", tooltipTop: "slider-tooltip-top", tooltipBottom: "slider-tooltip-bottom", tooltipLeft: "slider-tooltip-left", tooltipRight: "slider-tooltip-right", tooltipHidden: "slider-tooltip-hidden", active: "slider-active", draggable: "slider-draggable", tap: "slider-state-tap", drag: "slider-state-drag", pips: "slider-pips", pipsHorizontal: "slider-pips-horizontal", pipsVertical: "slider-pips-vertical", marker: "slider-marker", markerHorizontal: "slider-marker-horizontal", markerVertical: "slider-marker-vertical", markerNormal: "slider-marker-normal", markerLarge: "slider-marker-large", markerSub: "slider-marker-sub", value: "slider-value", valueHorizontal: "slider-value-horizontal", valueVertical: "slider-value-vertical", valueNormal: "slider-value-normal", valueLarge: "slider-value-large", valueSub: "slider-value-sub" }, o.value));
12627
12653
  return { classList: computed(() => {
12628
- const e2 = __spreadValues2({}, u2.value);
12654
+ const e2 = __spreadValues({}, u2.value);
12629
12655
  return Object.keys(e2).forEach((t2) => {
12630
12656
  e2[t2] = Array.isArray(e2[t2]) ? e2[t2].filter((e3) => null !== e3).join(" ") : e2[t2];
12631
12657
  }), "always" !== a2.value && (e2.target += ` ${"drag" === a2.value ? e2.tooltipDrag : e2.tooltipFocus}`), "horizontal" === l2.value && (e2.tooltip += "bottom" === s2.value ? ` ${e2.tooltipBottom}` : ` ${e2.tooltipTop}`), "vertical" === l2.value && (e2.tooltip += "right" === s2.value ? ` ${e2.tooltipRight}` : ` ${e2.tooltipLeft}`), e2;
12632
12658
  }) };
12633
12659
  }(a), p2 = function(t, i, n) {
12634
- const { format: o, step: a2 } = toRefs(t), s2 = n.value, l2 = n.classList, u2 = computed(() => o && o.value ? "function" == typeof o.value ? { to: o.value } : d(__spreadValues2({}, o.value)) : d({ decimals: a2.value >= 0 ? 0 : 2 })), c3 = computed(() => Array.isArray(s2.value) ? s2.value.map((e2) => u2.value) : u2.value);
12660
+ const { format: o, step: a2 } = toRefs(t), s2 = n.value, l2 = n.classList, u2 = computed(() => o && o.value ? "function" == typeof o.value ? { to: o.value } : d(__spreadValues({}, o.value)) : d({ decimals: a2.value >= 0 ? 0 : 2 })), c3 = computed(() => Array.isArray(s2.value) ? s2.value.map((e2) => u2.value) : u2.value);
12635
12661
  return { tooltipFormat: u2, tooltipsFormat: c3, tooltipsMerge: (e2, t2, r) => {
12636
12662
  var i2 = "rtl" === getComputedStyle(e2).direction, n2 = "rtl" === e2.noUiSlider.options.direction, o2 = "vertical" === e2.noUiSlider.options.orientation, a3 = e2.noUiSlider.getTooltips(), s3 = e2.noUiSlider.getOrigins();
12637
12663
  a3.forEach(function(e3, t3) {
@@ -12724,7 +12750,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
12724
12750
  R(V.value);
12725
12751
  } };
12726
12752
  }(a, s, { value: l.value, initialValue: l.initialValue, tooltipFormat: p2.tooltipFormat, tooltipsFormat: p2.tooltipsFormat, tooltipsMerge: p2.tooltipsMerge, classList: c2.classList });
12727
- return __spreadValues2(__spreadValues2(__spreadValues2({}, c2), p2), m2);
12753
+ return __spreadValues(__spreadValues(__spreadValues({}, c2), p2), m2);
12728
12754
  } };
12729
12755
  m.render = function(e2, t, r, i, n, o) {
12730
12756
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
@@ -13181,7 +13207,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13181
13207
  HierarchyFacet: _sfc_main$K
13182
13208
  }
13183
13209
  };
13184
- const _sfc_main$J = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$1), {
13210
+ const _sfc_main$J = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
13185
13211
  __name: "FacetDisplay",
13186
13212
  props: {
13187
13213
  options: {},
@@ -13944,6 +13970,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13944
13970
  var _a, _b;
13945
13971
  return (_b = (_a = props.labels) == null ? void 0 : _a.pageSize) != null ? _b : "";
13946
13972
  });
13973
+ const sizes = computed(() => props.options.sizes);
13947
13974
  const handleSelect = (e2) => {
13948
13975
  const value = e2.target.value;
13949
13976
  paramsStore.appendParams({
@@ -13963,7 +13990,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
13963
13990
  ref_key: "select",
13964
13991
  ref: select
13965
13992
  }, [
13966
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options.sizes, (option) => {
13993
+ (openBlock(true), createElementBlock(Fragment, null, renderList(sizes.value, (option) => {
13967
13994
  return openBlock(), createElementBlock("option", {
13968
13995
  key: option,
13969
13996
  value: option
@@ -14641,7 +14668,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14641
14668
  SearchResultsProductSingleStarRating: _sfc_main$m
14642
14669
  }
14643
14670
  };
14644
- const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__), {
14671
+ const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
14645
14672
  __name: "SearchResultsProductCardElement",
14646
14673
  props: {
14647
14674
  item: {},
@@ -14686,7 +14713,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14686
14713
  return props.item;
14687
14714
  }
14688
14715
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
14689
- return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
14716
+ return __spreadValues(__spreadValues({}, props.item), enhancementData);
14690
14717
  });
14691
14718
  const displayElement = computed(() => {
14692
14719
  return props.element.display ? props.element.display(enhancedItem.value) : true;
@@ -14745,7 +14772,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
14745
14772
  return layout.value === ResultsLayoutEnum.LIST && !props.isAdditionalPanel ? "lupa-search-result-product-contents-list" : "";
14746
14773
  });
14747
14774
  const badgesOptions = computed(() => {
14748
- return __spreadProps2(__spreadValues2({}, props.options.badges), { product: props.product });
14775
+ return __spreadProps(__spreadValues({}, props.options.badges), { product: props.product });
14749
14776
  });
14750
14777
  const imageElements = computed(() => {
14751
14778
  var _a, _b;
@@ -15068,7 +15095,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15068
15095
  };
15069
15096
  const handleQueryChange = () => {
15070
15097
  const context = getLupaTrackingContext();
15071
- const queryBody = __spreadProps2(__spreadValues2({}, context), {
15098
+ const queryBody = __spreadProps(__spreadValues({}, context), {
15072
15099
  limit: props.panel.totalCountLimit,
15073
15100
  searchText: query.value
15074
15101
  });
@@ -15549,7 +15576,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15549
15576
  window.addEventListener("resize", handleResize);
15550
15577
  yield redirectionStore.initiate(props.options.redirections, props.options.options);
15551
15578
  if (props.initialData) {
15552
- searchResultStore.add(__spreadValues2({}, props.initialData));
15579
+ searchResultStore.add(__spreadValues({}, props.initialData));
15553
15580
  }
15554
15581
  handleMounted();
15555
15582
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
@@ -15602,7 +15629,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15602
15629
  });
15603
15630
  const context = getLupaTrackingContext();
15604
15631
  const limit = publicQuery.limit || defaultSearchResultPageSize.value;
15605
- const query2 = __spreadProps2(__spreadValues2(__spreadValues2({}, publicQuery), context), { limit });
15632
+ const query2 = __spreadProps(__spreadValues(__spreadValues({}, publicQuery), context), { limit });
15606
15633
  const redirectionApplied = redirectionStore.redirectOnKeywordIfConfigured(
15607
15634
  publicQuery.searchText,
15608
15635
  optionStore.searchResultsRoutingBehavior
@@ -15617,7 +15644,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15617
15644
  var _a, _b;
15618
15645
  if (res.success) {
15619
15646
  handleResults({ queryKey: props.options.queryKey, results: res });
15620
- searchResultStore.add(__spreadValues2({}, res));
15647
+ searchResultStore.add(__spreadValues({}, res));
15621
15648
  } else if ((_b = (_a = props.options) == null ? void 0 : _a.options) == null ? void 0 : _b.onError) {
15622
15649
  props.options.options.onError(res);
15623
15650
  }
@@ -15686,7 +15713,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15686
15713
  if (typeof window !== "undefined") {
15687
15714
  optionStore.setSearchResultOptions({ options: props.options });
15688
15715
  if (props.initialData) {
15689
- searchResultStore.add(__spreadValues2({}, props.initialData));
15716
+ searchResultStore.add(__spreadValues({}, props.initialData));
15690
15717
  }
15691
15718
  handleMounted();
15692
15719
  return;
@@ -15697,7 +15724,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15697
15724
  (_b = props.options.ssr) == null ? void 0 : _b.baseUrl
15698
15725
  );
15699
15726
  optionStore.setSearchResultOptions({ options: props.options });
15700
- searchResultStore.add(__spreadValues2({}, initialData));
15727
+ searchResultStore.add(__spreadValues({}, initialData));
15701
15728
  paramStore.add(parseParams(optionStore.getQueryParamName, searchParams), props.options.ssr);
15702
15729
  paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
15703
15730
  handleResults({ queryKey: props.options.queryKey, results: initialData });
@@ -15835,8 +15862,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15835
15862
  const props = __props;
15836
15863
  const searchResults2 = ref(null);
15837
15864
  const componentOptions = computed(() => {
15838
- return __spreadProps2(__spreadValues2({}, props.options), {
15839
- filters: __spreadProps2(__spreadValues2({}, props.options.filters), {
15865
+ return __spreadProps(__spreadValues({}, props.options), {
15866
+ filters: __spreadProps(__spreadValues({}, props.options.filters), {
15840
15867
  categories: props.options.categories
15841
15868
  })
15842
15869
  });
@@ -15875,7 +15902,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
15875
15902
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
15876
15903
  */
15877
15904
  lodash$1.exports;
15878
- (function(module2, exports3) {
15905
+ (function(module2, exports2) {
15879
15906
  (function() {
15880
15907
  var undefined$1;
15881
15908
  var VERSION = "4.17.21";
@@ -16203,7 +16230,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
16203
16230
  var freeGlobal = typeof commonjsGlobal$1 == "object" && commonjsGlobal$1 && commonjsGlobal$1.Object === Object && commonjsGlobal$1;
16204
16231
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
16205
16232
  var root = freeGlobal || freeSelf || Function("return this")();
16206
- var freeExports = exports3 && !exports3.nodeType && exports3;
16233
+ var freeExports = exports2 && !exports2.nodeType && exports2;
16207
16234
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
16208
16235
  var moduleExports = freeModule && freeModule.exports === freeExports;
16209
16236
  var freeProcess = moduleExports && freeGlobal.process;
@@ -22112,7 +22139,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22112
22139
  };
22113
22140
  }
22114
22141
  });
22115
- const _hoisted_1$8 = { class: "lupa-search-product-recommendations-wrapper" };
22142
+ const _hoisted_1$8 = {
22143
+ key: 0,
22144
+ class: "lupa-search-product-recommendations-wrapper"
22145
+ };
22116
22146
  const _hoisted_2$6 = {
22117
22147
  key: 0,
22118
22148
  class: "lupa-recommendation-section-title"
@@ -22163,6 +22193,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22163
22193
  var _a, _b;
22164
22194
  return (_b = (_a = props.options.recommendationLabels) == null ? void 0 : _a.title) != null ? _b : "";
22165
22195
  });
22196
+ const hasRecommendations = computed(() => {
22197
+ return recommendations2.value.length > 0;
22198
+ });
22166
22199
  onMounted(() => {
22167
22200
  loadRecommendations();
22168
22201
  window.addEventListener("resize", handleResize);
@@ -22237,7 +22270,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22237
22270
  });
22238
22271
  __expose({ fetch: fetch2 });
22239
22272
  return (_ctx, _cache) => {
22240
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
22273
+ return hasRecommendations.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
22241
22274
  title.value ? (openBlock(), createElementBlock("h2", _hoisted_2$6, toDisplayString(title.value), 1)) : createCommentVNode("", true),
22242
22275
  !loading.value ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
22243
22276
  layoutType.value === "carousel" ? (openBlock(), createBlock(unref(Carousel), mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around": true }), {
@@ -22273,7 +22306,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22273
22306
  }), 128))
22274
22307
  ]))
22275
22308
  ])) : createCommentVNode("", true)
22276
- ]);
22309
+ ])) : createCommentVNode("", true);
22277
22310
  };
22278
22311
  }
22279
22312
  });
@@ -22357,11 +22390,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22357
22390
  production: "https://api.lupasearch.com/v1/",
22358
22391
  staging: "https://api.staging.lupasearch.com/v1/"
22359
22392
  };
22360
- const defaultConfig = {
22393
+ const DEFAULT_REQUEST_CONFIG = {
22361
22394
  method: "POST",
22362
22395
  headers: { "Content-Type": "application/json" }
22363
22396
  };
22364
- const headers = defaultConfig.headers;
22397
+ const DEFAULT_HEADERS = DEFAULT_REQUEST_CONFIG.headers;
22365
22398
  const getApiUrl = (environment, customBaseUrl) => {
22366
22399
  if (customBaseUrl) {
22367
22400
  return customBaseUrl;
@@ -22373,13 +22406,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22373
22406
  const { environment, customBaseUrl } = options;
22374
22407
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22375
22408
  try {
22376
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22409
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22377
22410
  body: JSON.stringify(request),
22378
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22411
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22379
22412
  }));
22380
22413
  if (res.status < 400) {
22381
22414
  const data = yield res.json();
22382
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22415
+ return __spreadProps(__spreadValues({}, data), { success: true });
22383
22416
  }
22384
22417
  const errors = yield res.json();
22385
22418
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22396,14 +22429,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22396
22429
  try {
22397
22430
  const res = yield fetch(
22398
22431
  `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
22399
- __spreadProps2(__spreadValues2({}, defaultConfig), {
22432
+ __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22400
22433
  body: JSON.stringify(request),
22401
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22434
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22402
22435
  })
22403
22436
  );
22404
22437
  if (res.status < 400) {
22405
22438
  const data = yield res.json();
22406
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22439
+ return __spreadProps(__spreadValues({}, data), { success: true });
22407
22440
  }
22408
22441
  const errors = yield res.json();
22409
22442
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22418,13 +22451,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22418
22451
  const { environment, customBaseUrl } = options;
22419
22452
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22420
22453
  try {
22421
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22454
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22422
22455
  body: JSON.stringify(request),
22423
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22456
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22424
22457
  }));
22425
22458
  if (res.status < 400) {
22426
22459
  const data = yield res.json();
22427
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22460
+ return __spreadProps(__spreadValues({}, data), { success: true });
22428
22461
  }
22429
22462
  const errors = yield res.json();
22430
22463
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22458,9 +22491,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22458
22491
  const getTextResponseChunkStream = (options, request, onChunkReceived, chatSettings) => {
22459
22492
  var _a;
22460
22493
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22461
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22494
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22462
22495
  body: JSON.stringify(request),
22463
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22496
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22464
22497
  })).then((response) => {
22465
22498
  const reader = response.body.getReader();
22466
22499
  return reader.read().then(function processStream({ done, value }) {
@@ -22852,7 +22885,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22852
22885
  }
22853
22886
  const validPhrases = phrases.filter((p2) => (p2 == null ? void 0 : p2.trim().length) > 0);
22854
22887
  chatContent.value = chatContent.value.map(
22855
- (c2) => c2.key === key ? __spreadProps2(__spreadValues2({}, c2), {
22888
+ (c2) => c2.key === key ? __spreadProps(__spreadValues({}, c2), {
22856
22889
  allPhrases: [...validPhrases],
22857
22890
  suggestedPhrases: phrases
22858
22891
  }) : c2
@@ -22889,6 +22922,29 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22889
22922
  };
22890
22923
  }
22891
22924
  });
22925
+ const fetchPluginConfiguration = (options, configurationKey) => __async(void 0, null, function* () {
22926
+ var _a, _b, _c;
22927
+ const { environment, customBaseUrl } = options;
22928
+ try {
22929
+ const res = yield fetch(
22930
+ `${getApiUrl(environment, customBaseUrl)}plugin/configurations/${configurationKey}`,
22931
+ __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22932
+ method: "GET",
22933
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22934
+ })
22935
+ );
22936
+ if (res.status < 400) {
22937
+ const data = yield res.json();
22938
+ return __spreadValues({}, data);
22939
+ }
22940
+ const errors = yield res.json();
22941
+ (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
22942
+ return null;
22943
+ } catch (e2) {
22944
+ (_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e2);
22945
+ return null;
22946
+ }
22947
+ });
22892
22948
  let piniaInstance = null;
22893
22949
  const initPinia = () => {
22894
22950
  if (piniaInstance) {
@@ -22904,220 +22960,565 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
22904
22960
  initTracking(options);
22905
22961
  store.setTrackingOptions({ options });
22906
22962
  };
22907
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
22908
- var lodash = { exports: {} };
22909
- /**
22910
- * @license
22911
- * Lodash <https://lodash.com/>
22912
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
22913
- * Released under MIT license <https://lodash.com/license>
22914
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
22915
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
22916
- */
22917
- lodash.exports;
22918
- (function(module2, exports3) {
22919
- (function() {
22920
- var undefined$1;
22921
- var VERSION = "4.17.21";
22922
- var LARGE_ARRAY_SIZE = 200;
22923
- var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
22924
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
22925
- var MAX_MEMOIZE_SIZE = 500;
22926
- var PLACEHOLDER = "__lodash_placeholder__";
22927
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
22928
- var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
22929
- var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
22930
- var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
22931
- var HOT_COUNT = 800, HOT_SPAN = 16;
22932
- var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
22933
- var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
22934
- var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
22935
- var wrapFlags = [
22936
- ["ary", WRAP_ARY_FLAG],
22937
- ["bind", WRAP_BIND_FLAG],
22938
- ["bindKey", WRAP_BIND_KEY_FLAG],
22939
- ["curry", WRAP_CURRY_FLAG],
22940
- ["curryRight", WRAP_CURRY_RIGHT_FLAG],
22941
- ["flip", WRAP_FLIP_FLAG],
22942
- ["partial", WRAP_PARTIAL_FLAG],
22943
- ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
22944
- ["rearg", WRAP_REARG_FLAG]
22945
- ];
22946
- var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
22947
- var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
22948
- var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
22949
- var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
22950
- var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
22951
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
22952
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
22953
- var reTrimStart = /^\s+/;
22954
- var reWhitespace = /\s/;
22955
- var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
22956
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
22957
- var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
22958
- var reEscapeChar = /\\(\\)?/g;
22959
- var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
22960
- var reFlags = /\w*$/;
22961
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
22962
- var reIsBinary = /^0b[01]+$/i;
22963
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
22964
- var reIsOctal = /^0o[0-7]+$/i;
22965
- var reIsUint = /^(?:0|[1-9]\d*)$/;
22966
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
22967
- var reNoMatch = /($^)/;
22968
- var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
22969
- var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
22970
- var rsApos = "['’]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
22971
- var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
22972
- var reApos = RegExp(rsApos, "g");
22973
- var reComboMark = RegExp(rsCombo, "g");
22974
- var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
22975
- var reUnicodeWord = RegExp([
22976
- rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
22977
- rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
22978
- rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
22979
- rsUpper + "+" + rsOptContrUpper,
22980
- rsOrdUpper,
22981
- rsOrdLower,
22982
- rsDigits,
22983
- rsEmoji
22984
- ].join("|"), "g");
22985
- var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
22986
- var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
22987
- var contextProps = [
22988
- "Array",
22989
- "Buffer",
22990
- "DataView",
22991
- "Date",
22992
- "Error",
22993
- "Float32Array",
22994
- "Float64Array",
22995
- "Function",
22996
- "Int8Array",
22997
- "Int16Array",
22998
- "Int32Array",
22999
- "Map",
23000
- "Math",
23001
- "Object",
23002
- "Promise",
23003
- "RegExp",
23004
- "Set",
23005
- "String",
23006
- "Symbol",
23007
- "TypeError",
23008
- "Uint8Array",
23009
- "Uint8ClampedArray",
23010
- "Uint16Array",
23011
- "Uint32Array",
23012
- "WeakMap",
23013
- "_",
23014
- "clearTimeout",
23015
- "isFinite",
23016
- "parseInt",
23017
- "setTimeout"
23018
- ];
23019
- var templateCounter = -1;
23020
- var typedArrayTags = {};
23021
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
23022
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
23023
- var cloneableTags = {};
23024
- cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
23025
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
23026
- var deburredLetters = {
23027
- // Latin-1 Supplement block.
23028
- "À": "A",
23029
- "Á": "A",
23030
- "Â": "A",
23031
- "Ã": "A",
23032
- "Ä": "A",
23033
- "Å": "A",
23034
- "à": "a",
23035
- "á": "a",
23036
- "â": "a",
23037
- "ã": "a",
23038
- "ä": "a",
23039
- "å": "a",
23040
- "Ç": "C",
23041
- "ç": "c",
23042
- "Ð": "D",
23043
- "ð": "d",
23044
- "È": "E",
23045
- "É": "E",
23046
- "Ê": "E",
23047
- "Ë": "E",
23048
- "è": "e",
23049
- "é": "e",
23050
- "ê": "e",
23051
- "ë": "e",
23052
- "Ì": "I",
23053
- "Í": "I",
23054
- "Î": "I",
23055
- "Ï": "I",
23056
- "ì": "i",
23057
- "í": "i",
23058
- "î": "i",
23059
- "ï": "i",
23060
- "Ñ": "N",
23061
- "ñ": "n",
23062
- "Ò": "O",
23063
- "Ó": "O",
23064
- "Ô": "O",
23065
- "Õ": "O",
23066
- "Ö": "O",
23067
- "Ø": "O",
23068
- "ò": "o",
23069
- "ó": "o",
23070
- "ô": "o",
23071
- "õ": "o",
23072
- "ö": "o",
23073
- "ø": "o",
23074
- "Ù": "U",
23075
- "Ú": "U",
23076
- "Û": "U",
23077
- "Ü": "U",
23078
- "ù": "u",
23079
- "ú": "u",
23080
- "û": "u",
23081
- "ü": "u",
23082
- "Ý": "Y",
23083
- "ý": "y",
23084
- "ÿ": "y",
23085
- "Æ": "Ae",
23086
- "æ": "ae",
23087
- "Þ": "Th",
23088
- "þ": "th",
23089
- "ß": "ss",
23090
- // Latin Extended-A block.
23091
- "Ā": "A",
23092
- "Ă": "A",
23093
- "Ą": "A",
23094
- "ā": "a",
23095
- "ă": "a",
23096
- "ą": "a",
23097
- "Ć": "C",
23098
- "Ĉ": "C",
23099
- "Ċ": "C",
23100
- "Č": "C",
23101
- "ć": "c",
23102
- "ĉ": "c",
23103
- "ċ": "c",
23104
- "č": "c",
23105
- "Ď": "D",
23106
- "Đ": "D",
23107
- "ď": "d",
23108
- "đ": "d",
23109
- "Ē": "E",
23110
- "Ĕ": "E",
23111
- "Ė": "E",
23112
- "Ę": "E",
23113
- "Ě": "E",
23114
- "ē": "e",
23115
- "ĕ": "e",
23116
- "ė": "e",
23117
- "ę": "e",
23118
- "ě": "e",
23119
- "Ĝ": "G",
23120
- "Ğ": "G",
22963
+ const displayDiscountedPriceSection = (doc2, options) => {
22964
+ var _a, _b;
22965
+ const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
22966
+ const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
22967
+ return discountPrice && regularPrice && discountPrice < regularPrice;
22968
+ };
22969
+ const displayRegularPriceSection = (doc2, options) => {
22970
+ var _a, _b;
22971
+ const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
22972
+ const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
22973
+ const anyPrice = discountPrice || regularPrice;
22974
+ return anyPrice && !displayDiscountedPriceSection(doc2, options);
22975
+ };
22976
+ const escapeHtml = (source) => {
22977
+ if (!source) {
22978
+ return source;
22979
+ }
22980
+ return `${source}`.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
22981
+ };
22982
+ const toMaxDecimalPlaces = (value, maxDecimal = 2) => {
22983
+ if (!value) {
22984
+ return 0;
22985
+ }
22986
+ try {
22987
+ return +parseFloat(`${value}`).toFixed(maxDecimal);
22988
+ } catch (e2) {
22989
+ return `${value}`;
22990
+ }
22991
+ };
22992
+ const capitalize = (value) => {
22993
+ if (!value) {
22994
+ return "";
22995
+ }
22996
+ return value.charAt(0).toLocaleUpperCase() + value.slice(1);
22997
+ };
22998
+ const getAlphanumeric = (value) => {
22999
+ if (!value) {
23000
+ return "";
23001
+ }
23002
+ return value.replace(/[\W_]/g, " ");
23003
+ };
23004
+ const getAdditionalElements = (fields) => {
23005
+ return fields.map((key) => ({
23006
+ type: "custom",
23007
+ key,
23008
+ label: capitalize(getAlphanumeric(key)),
23009
+ className: "lupa-custom",
23010
+ display: (doc2) => Boolean(doc2[key])
23011
+ }));
23012
+ };
23013
+ const addFieldIfKeyExists = (field, key, config) => {
23014
+ if (key) {
23015
+ return config;
23016
+ }
23017
+ return { key: field, type: "customHtml", display: () => false };
23018
+ };
23019
+ const getSearchBoxComponent = ({
23020
+ searchBoxOptions,
23021
+ labels,
23022
+ panelOptions,
23023
+ redirections,
23024
+ placeholderImage
23025
+ }) => {
23026
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
23027
+ const panels = [
23028
+ ...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
23029
+ {
23030
+ type: SearchBoxPanelType.SUGGESTION,
23031
+ queryKey: searchBoxOptions.suggestionQueryKey,
23032
+ highlight: true,
23033
+ limit: 8,
23034
+ labels: {
23035
+ topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
23036
+ }
23037
+ }
23038
+ ] : [],
23039
+ ...(panelOptions == null ? void 0 : panelOptions.docPanel) ? [
23040
+ {
23041
+ type: SearchBoxPanelType.DOCUMENT,
23042
+ queryKey: searchBoxOptions.documentQueryKey,
23043
+ limit: 5,
23044
+ elements: [
23045
+ {
23046
+ type: "image",
23047
+ placeholder: placeholderImage,
23048
+ key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
23049
+ baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
23050
+ },
23051
+ {
23052
+ type: "title",
23053
+ key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
23054
+ maxLines: 2
23055
+ },
23056
+ {
23057
+ type: "regularPrice",
23058
+ key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
23059
+ display: (doc2) => {
23060
+ var _a2, _b2, _c2, _d2;
23061
+ return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
23062
+ }
23063
+ },
23064
+ {
23065
+ type: "price",
23066
+ key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
23067
+ }
23068
+ ]
23069
+ }
23070
+ ] : []
23071
+ ];
23072
+ return {
23073
+ inputSelector: searchBoxOptions.inputSelector,
23074
+ options: {
23075
+ environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
23076
+ customUrl: searchBoxOptions.customUrl,
23077
+ customBaseUrl: searchBoxOptions.customBaseUrl,
23078
+ customPayload: searchBoxOptions.customPayload,
23079
+ customHeaders: searchBoxOptions.customHeaders
23080
+ },
23081
+ showTotalCount: true,
23082
+ expandOnSinglePanel: true,
23083
+ minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
23084
+ debounce: 250,
23085
+ labels: labels == null ? void 0 : labels.searchBox,
23086
+ links: {
23087
+ searchResults: ""
23088
+ },
23089
+ panels,
23090
+ redirections,
23091
+ history: {
23092
+ labels: {
23093
+ clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
23094
+ }
23095
+ }
23096
+ };
23097
+ };
23098
+ const getSearchResultsComponent = ({
23099
+ searchResultOptions,
23100
+ labels,
23101
+ redirections,
23102
+ placeholderImage,
23103
+ configuratorOverrides,
23104
+ callbacks,
23105
+ additionalFields
23106
+ }) => {
23107
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
23108
+ const filters = searchResultOptions.showFacets ? {
23109
+ currentFilters: {
23110
+ visibility: {
23111
+ mobileSidebar: true,
23112
+ mobileToolbar: true
23113
+ },
23114
+ labels: {
23115
+ title: "",
23116
+ clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
23117
+ }
23118
+ },
23119
+ facets: {
23120
+ labels: {
23121
+ title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
23122
+ showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
23123
+ facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
23124
+ facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
23125
+ },
23126
+ filterable: {
23127
+ minValues: 5
23128
+ },
23129
+ hierarchy: {
23130
+ maxInitialLevel: 2,
23131
+ topLevelValueCountLimit: 5,
23132
+ filterable: true
23133
+ },
23134
+ stats: {
23135
+ slider: true,
23136
+ inputs: true,
23137
+ labels: {
23138
+ from: "",
23139
+ to: ""
23140
+ }
23141
+ },
23142
+ facetValueCountLimit: 8,
23143
+ showDocumentCount: true,
23144
+ style: {
23145
+ type: "sidebar"
23146
+ }
23147
+ }
23148
+ } : {};
23149
+ const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
23150
+ xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
23151
+ l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
23152
+ md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
23153
+ sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
23154
+ xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
23155
+ };
23156
+ const badges = {
23157
+ badges: {
23158
+ anchor: "tr",
23159
+ elements: [
23160
+ ...searchResultOptions.showRelevance ? [
23161
+ {
23162
+ key: "",
23163
+ type: "customHtml",
23164
+ className: "relevance",
23165
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
23166
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
23167
+ }
23168
+ ] : [],
23169
+ ...((_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) ? [
23170
+ {
23171
+ key: "",
23172
+ type: "customHtml",
23173
+ className: "boosted-marker",
23174
+ html: () => {
23175
+ var _a2;
23176
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
23177
+ },
23178
+ display: (doc2) => doc2._boosted === true
23179
+ }
23180
+ ] : []
23181
+ ]
23182
+ }
23183
+ };
23184
+ return __spreadValues2(__spreadProps2(__spreadValues2({
23185
+ options: {
23186
+ environment: (_m = searchResultOptions.environment) != null ? _m : "production",
23187
+ customUrl: searchResultOptions.customUrl,
23188
+ customBaseUrl: searchResultOptions.customBaseUrl,
23189
+ customPayload: searchResultOptions.customPayload,
23190
+ customHeaders: searchResultOptions.customHeaders,
23191
+ onError: searchResultOptions.errorHandler
23192
+ },
23193
+ queryKey: searchResultOptions.queryKey,
23194
+ containerSelector: searchResultOptions.containerSelector,
23195
+ searchTitlePosition: "search-results-top",
23196
+ titleKey: (_n = searchResultOptions.fields) == null ? void 0 : _n.titleKey,
23197
+ labels: labels == null ? void 0 : labels.searchResults,
23198
+ grid: {
23199
+ columns
23200
+ },
23201
+ pagination: {
23202
+ sizeSelection: {
23203
+ position: {
23204
+ top: true,
23205
+ bottom: false
23206
+ },
23207
+ sizes: [12, 24, 36, 48]
23208
+ },
23209
+ pageSelection: {
23210
+ position: {
23211
+ top: false,
23212
+ bottom: true
23213
+ },
23214
+ displayMobile: 3,
23215
+ display: 5
23216
+ }
23217
+ },
23218
+ filters,
23219
+ toolbar: {
23220
+ layoutSelector: false,
23221
+ itemSummary: true,
23222
+ clearFilters: false
23223
+ },
23224
+ isInStock: () => {
23225
+ return true;
23226
+ }
23227
+ }, badges), {
23228
+ links: {
23229
+ details: ((_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl) ? `{${(_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl}}` : void 0
23230
+ },
23231
+ callbacks,
23232
+ routingBehavior: callbacks ? "event" : "direct-link",
23233
+ idKey: "id",
23234
+ elements: [
23235
+ {
23236
+ type: "image",
23237
+ placeholder: placeholderImage,
23238
+ key: (_q = searchResultOptions.fields) == null ? void 0 : _q.imageKey,
23239
+ baseUrl: (_r = searchResultOptions.fields) == null ? void 0 : _r.baseImageUrl,
23240
+ display: () => {
23241
+ var _a2;
23242
+ return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
23243
+ }
23244
+ },
23245
+ addFieldIfKeyExists("_emphasis", (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField, {
23246
+ type: "custom",
23247
+ className: "lupa-custom-emphasis",
23248
+ key: (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField,
23249
+ display: () => true
23250
+ }),
23251
+ {
23252
+ type: "title",
23253
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.titleKey,
23254
+ maxLines: (_v = searchResultOptions.maxLines) != null ? _v : 2,
23255
+ display: (doc2) => {
23256
+ var _a2, _b2;
23257
+ return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
23258
+ }
23259
+ },
23260
+ ...getAdditionalElements(additionalFields),
23261
+ addFieldIfKeyExists("_discountPrice", (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey, {
23262
+ key: (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey,
23263
+ type: "customHtml",
23264
+ className: "lupa-price lupa-price-discounted",
23265
+ display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
23266
+ html: (doc2) => {
23267
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
23268
+ const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
23269
+ const discountPrice = (_d2 = parseFloat(
23270
+ doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
23271
+ )) == null ? void 0 : _d2.toFixed(2);
23272
+ const regularPrice = (_g2 = parseFloat(
23273
+ doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
23274
+ )) == null ? void 0 : _g2.toFixed(2);
23275
+ const discount = `<span class="lupa-discount">${escapeHtml(
23276
+ discountPrice
23277
+ )} ${currency}</span>`;
23278
+ const regular = `<span class="lupa-regular">${escapeHtml(
23279
+ regularPrice
23280
+ )} ${currency}</span>`;
23281
+ return discount + regular;
23282
+ }
23283
+ }),
23284
+ addFieldIfKeyExists("_regularPrice", (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey, {
23285
+ key: (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey,
23286
+ type: "customHtml",
23287
+ className: "lupa-price lupa-price-single",
23288
+ display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
23289
+ html: (doc2) => {
23290
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
23291
+ const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
23292
+ const price = (_g2 = parseFloat(
23293
+ (_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
23294
+ )) == null ? void 0 : _g2.toFixed(2);
23295
+ return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
23296
+ }
23297
+ })
23298
+ ],
23299
+ breadcrumbs: [],
23300
+ sort: [],
23301
+ redirections
23302
+ }), configuratorOverrides);
23303
+ };
23304
+ const SearchContainerConfigurationService = {
23305
+ getSearchBoxComponent,
23306
+ getSearchResultsComponent
23307
+ };
23308
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
23309
+ var lodash = { exports: {} };
23310
+ /**
23311
+ * @license
23312
+ * Lodash <https://lodash.com/>
23313
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
23314
+ * Released under MIT license <https://lodash.com/license>
23315
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
23316
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
23317
+ */
23318
+ lodash.exports;
23319
+ (function(module2, exports2) {
23320
+ (function() {
23321
+ var undefined$1;
23322
+ var VERSION = "4.17.21";
23323
+ var LARGE_ARRAY_SIZE = 200;
23324
+ var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
23325
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
23326
+ var MAX_MEMOIZE_SIZE = 500;
23327
+ var PLACEHOLDER = "__lodash_placeholder__";
23328
+ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
23329
+ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
23330
+ var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
23331
+ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
23332
+ var HOT_COUNT = 800, HOT_SPAN = 16;
23333
+ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
23334
+ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
23335
+ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
23336
+ var wrapFlags = [
23337
+ ["ary", WRAP_ARY_FLAG],
23338
+ ["bind", WRAP_BIND_FLAG],
23339
+ ["bindKey", WRAP_BIND_KEY_FLAG],
23340
+ ["curry", WRAP_CURRY_FLAG],
23341
+ ["curryRight", WRAP_CURRY_RIGHT_FLAG],
23342
+ ["flip", WRAP_FLIP_FLAG],
23343
+ ["partial", WRAP_PARTIAL_FLAG],
23344
+ ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
23345
+ ["rearg", WRAP_REARG_FLAG]
23346
+ ];
23347
+ var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]";
23348
+ var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
23349
+ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
23350
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
23351
+ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
23352
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
23353
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
23354
+ var reTrimStart = /^\s+/;
23355
+ var reWhitespace = /\s/;
23356
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
23357
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
23358
+ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
23359
+ var reEscapeChar = /\\(\\)?/g;
23360
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
23361
+ var reFlags = /\w*$/;
23362
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
23363
+ var reIsBinary = /^0b[01]+$/i;
23364
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
23365
+ var reIsOctal = /^0o[0-7]+$/i;
23366
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
23367
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
23368
+ var reNoMatch = /($^)/;
23369
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
23370
+ var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
23371
+ var rsApos = "['’]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
23372
+ var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
23373
+ var reApos = RegExp(rsApos, "g");
23374
+ var reComboMark = RegExp(rsCombo, "g");
23375
+ var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
23376
+ var reUnicodeWord = RegExp([
23377
+ rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
23378
+ rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
23379
+ rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
23380
+ rsUpper + "+" + rsOptContrUpper,
23381
+ rsOrdUpper,
23382
+ rsOrdLower,
23383
+ rsDigits,
23384
+ rsEmoji
23385
+ ].join("|"), "g");
23386
+ var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
23387
+ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
23388
+ var contextProps = [
23389
+ "Array",
23390
+ "Buffer",
23391
+ "DataView",
23392
+ "Date",
23393
+ "Error",
23394
+ "Float32Array",
23395
+ "Float64Array",
23396
+ "Function",
23397
+ "Int8Array",
23398
+ "Int16Array",
23399
+ "Int32Array",
23400
+ "Map",
23401
+ "Math",
23402
+ "Object",
23403
+ "Promise",
23404
+ "RegExp",
23405
+ "Set",
23406
+ "String",
23407
+ "Symbol",
23408
+ "TypeError",
23409
+ "Uint8Array",
23410
+ "Uint8ClampedArray",
23411
+ "Uint16Array",
23412
+ "Uint32Array",
23413
+ "WeakMap",
23414
+ "_",
23415
+ "clearTimeout",
23416
+ "isFinite",
23417
+ "parseInt",
23418
+ "setTimeout"
23419
+ ];
23420
+ var templateCounter = -1;
23421
+ var typedArrayTags = {};
23422
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
23423
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
23424
+ var cloneableTags = {};
23425
+ cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
23426
+ cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
23427
+ var deburredLetters = {
23428
+ // Latin-1 Supplement block.
23429
+ "À": "A",
23430
+ "Á": "A",
23431
+ "Â": "A",
23432
+ "Ã": "A",
23433
+ "Ä": "A",
23434
+ "Å": "A",
23435
+ "à": "a",
23436
+ "á": "a",
23437
+ "â": "a",
23438
+ "ã": "a",
23439
+ "ä": "a",
23440
+ "å": "a",
23441
+ "Ç": "C",
23442
+ "ç": "c",
23443
+ "Ð": "D",
23444
+ "ð": "d",
23445
+ "È": "E",
23446
+ "É": "E",
23447
+ "Ê": "E",
23448
+ "Ë": "E",
23449
+ "è": "e",
23450
+ "é": "e",
23451
+ "ê": "e",
23452
+ "ë": "e",
23453
+ "Ì": "I",
23454
+ "Í": "I",
23455
+ "Î": "I",
23456
+ "Ï": "I",
23457
+ "ì": "i",
23458
+ "í": "i",
23459
+ "î": "i",
23460
+ "ï": "i",
23461
+ "Ñ": "N",
23462
+ "ñ": "n",
23463
+ "Ò": "O",
23464
+ "Ó": "O",
23465
+ "Ô": "O",
23466
+ "Õ": "O",
23467
+ "Ö": "O",
23468
+ "Ø": "O",
23469
+ "ò": "o",
23470
+ "ó": "o",
23471
+ "ô": "o",
23472
+ "õ": "o",
23473
+ "ö": "o",
23474
+ "ø": "o",
23475
+ "Ù": "U",
23476
+ "Ú": "U",
23477
+ "Û": "U",
23478
+ "Ü": "U",
23479
+ "ù": "u",
23480
+ "ú": "u",
23481
+ "û": "u",
23482
+ "ü": "u",
23483
+ "Ý": "Y",
23484
+ "ý": "y",
23485
+ "ÿ": "y",
23486
+ "Æ": "Ae",
23487
+ "æ": "ae",
23488
+ "Þ": "Th",
23489
+ "þ": "th",
23490
+ "ß": "ss",
23491
+ // Latin Extended-A block.
23492
+ "Ā": "A",
23493
+ "Ă": "A",
23494
+ "Ą": "A",
23495
+ "ā": "a",
23496
+ "ă": "a",
23497
+ "ą": "a",
23498
+ "Ć": "C",
23499
+ "Ĉ": "C",
23500
+ "Ċ": "C",
23501
+ "Č": "C",
23502
+ "ć": "c",
23503
+ "ĉ": "c",
23504
+ "ċ": "c",
23505
+ "č": "c",
23506
+ "Ď": "D",
23507
+ "Đ": "D",
23508
+ "ď": "d",
23509
+ "đ": "d",
23510
+ "Ē": "E",
23511
+ "Ĕ": "E",
23512
+ "Ė": "E",
23513
+ "Ę": "E",
23514
+ "Ě": "E",
23515
+ "ē": "e",
23516
+ "ĕ": "e",
23517
+ "ė": "e",
23518
+ "ę": "e",
23519
+ "ě": "e",
23520
+ "Ĝ": "G",
23521
+ "Ğ": "G",
23121
23522
  "Ġ": "G",
23122
23523
  "Ģ": "G",
23123
23524
  "ĝ": "g",
@@ -23243,7 +23644,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23243
23644
  var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
23244
23645
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
23245
23646
  var root = freeGlobal || freeSelf || Function("return this")();
23246
- var freeExports = exports3 && !exports3.nodeType && exports3;
23647
+ var freeExports = exports2 && !exports2.nodeType && exports2;
23247
23648
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
23248
23649
  var moduleExports = freeModule && freeModule.exports === freeExports;
23249
23650
  var freeProcess = moduleExports && freeGlobal.process;
@@ -28382,546 +28783,150 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28382
28783
  (freeModule.exports = _)._ = _;
28383
28784
  freeExports._ = _;
28384
28785
  } else {
28385
- root._ = _;
28386
- }
28387
- }).call(commonjsGlobal);
28388
- })(lodash, lodash.exports);
28389
- var lodashExports = lodash.exports;
28390
- const DEFAULT_SEARCH_BOX_OPTIONS = {
28391
- inputSelector: "#searchBox",
28392
- options: {
28393
- environment: "production"
28394
- },
28395
- showTotalCount: false,
28396
- minInputLength: 1,
28397
- inputAttributes: {
28398
- name: "q"
28399
- },
28400
- debounce: 0,
28401
- labels: {
28402
- placeholder: "Search for products...",
28403
- noResults: "There are no results found.",
28404
- moreResults: "Show more results",
28405
- currency: "€",
28406
- defaultFacetLabel: "Category:"
28407
- },
28408
- links: {
28409
- searchResults: "/search"
28410
- },
28411
- panels: [
28412
- {
28413
- type: "suggestion",
28414
- queryKey: "",
28415
- highlight: true,
28416
- limit: 5
28417
- },
28418
- {
28419
- type: "document",
28420
- queryKey: "",
28421
- limit: 5,
28422
- searchBySuggestion: false,
28423
- links: {
28424
- details: "{url}"
28425
- },
28426
- titleKey: "name",
28427
- elements: []
28428
- }
28429
- ],
28430
- history: {
28431
- labels: {
28432
- clear: "Clear History"
28433
- }
28434
- }
28435
- };
28436
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
28437
- __name: "SearchBoxEntry",
28438
- props: {
28439
- searchBoxOptions: {}
28440
- },
28441
- setup(__props, { expose: __expose }) {
28442
- const props = __props;
28443
- const searchBox2 = ref(null);
28444
- const fullSearchBoxOptions = computed(() => {
28445
- const options = lodashExports.cloneDeep(props.searchBoxOptions);
28446
- return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS), options);
28447
- });
28448
- const fetch2 = () => {
28449
- var _a;
28450
- (_a = searchBox2.value) == null ? void 0 : _a.handleCurrentValueSearch();
28451
- };
28452
- __expose({ fetch: fetch2 });
28453
- return (_ctx, _cache) => {
28454
- return openBlock(), createBlock(unref(_sfc_main$V), {
28455
- options: fullSearchBoxOptions.value,
28456
- ref_key: "searchBox",
28457
- ref: searchBox2
28458
- }, null, 8, ["options"]);
28459
- };
28460
- }
28461
- });
28462
- const DEFAULT_OPTIONS_RESULTS = {
28786
+ root._ = _;
28787
+ }
28788
+ }).call(commonjsGlobal);
28789
+ })(lodash, lodash.exports);
28790
+ var lodashExports = lodash.exports;
28791
+ const DEFAULT_SEARCH_BOX_OPTIONS = {
28792
+ inputSelector: "#searchBox",
28463
28793
  options: {
28464
28794
  environment: "production"
28465
28795
  },
28466
- queryKey: "",
28467
- containerSelector: "#searchResultsContainer",
28468
- searchTitlePosition: "page-top",
28796
+ showTotalCount: false,
28797
+ minInputLength: 1,
28798
+ inputAttributes: {
28799
+ name: "q"
28800
+ },
28801
+ debounce: 0,
28469
28802
  labels: {
28470
- pageSize: "Page size:",
28471
- sortBy: "Sort by:",
28472
- itemCount: "Items {1} of {2}",
28473
- filteredItemCount: "",
28803
+ placeholder: "Search for products...",
28804
+ noResults: "There are no results found.",
28805
+ moreResults: "Show more results",
28474
28806
  currency: "€",
28475
- showMore: "Show more",
28476
- searchResults: "Search Query: ",
28477
- emptyResults: "There are no results for the query:",
28478
- mobileFilterButton: "Filter",
28479
- htmlTitleTemplate: "Search Query: '{1}'",
28480
- noResultsSuggestion: "No results found for this query: {1}",
28481
- didYouMean: "Did you mean to search: {1}",
28482
- similarQuery: "Search results for phrase {1}",
28483
- similarQueries: "Similar queries:"
28484
- },
28485
- grid: {
28486
- columns: {
28487
- xl: 4,
28488
- l: 3,
28489
- md: 2,
28490
- sm: 2,
28491
- xs: 1
28492
- }
28807
+ defaultFacetLabel: "Category:"
28493
28808
  },
28494
- pagination: {
28495
- sizeSelection: {
28496
- position: {
28497
- top: false,
28498
- bottom: true
28499
- },
28500
- sizes: [12, 24, 36]
28501
- },
28502
- pageSelection: {
28503
- position: {
28504
- top: false,
28505
- bottom: true
28506
- },
28507
- display: 5,
28508
- displayMobile: 3
28509
- }
28809
+ links: {
28810
+ searchResults: "/search"
28510
28811
  },
28511
- sort: [],
28512
- filters: {
28513
- currentFilters: {
28514
- visibility: {
28515
- mobileSidebar: true,
28516
- mobileToolbar: true
28517
- },
28518
- labels: {
28519
- title: "Current filters:",
28520
- clearAll: "Clear all"
28521
- }
28812
+ panels: [
28813
+ {
28814
+ type: "suggestion",
28815
+ queryKey: "",
28816
+ highlight: true,
28817
+ limit: 5
28522
28818
  },
28523
- facets: {
28524
- labels: {
28525
- title: "Filters:",
28526
- showAll: "Show more",
28527
- facetFilter: "Filter...",
28528
- facetClear: "Clear"
28529
- },
28530
- filterable: {
28531
- minValues: 5
28532
- },
28533
- hierarchy: {
28534
- maxInitialLevel: 2,
28535
- topLevelValueCountLimit: 5,
28536
- filterable: true
28819
+ {
28820
+ type: "document",
28821
+ queryKey: "",
28822
+ limit: 5,
28823
+ searchBySuggestion: false,
28824
+ links: {
28825
+ details: "{url}"
28537
28826
  },
28538
- facetValueCountLimit: 20,
28539
- showDocumentCount: true,
28540
- style: {
28541
- type: "sidebar"
28542
- }
28543
- }
28544
- },
28545
- toolbar: {
28546
- layoutSelector: true,
28547
- itemSummary: true,
28548
- clearFilters: false
28549
- },
28550
- isInStock: () => {
28551
- return true;
28552
- },
28553
- badges: {
28554
- anchor: "tr",
28555
- elements: []
28556
- },
28557
- links: {
28558
- details: "/{id}"
28559
- },
28560
- elements: [],
28561
- breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
28562
- };
28563
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
28564
- __name: "SearchResultsEntry",
28565
- props: {
28566
- searchResultsOptions: {}
28567
- },
28568
- setup(__props, { expose: __expose }) {
28569
- const props = __props;
28570
- const searchResults2 = ref(null);
28571
- const fullSearchResultsOptions = computed(() => {
28572
- const options = lodashExports.cloneDeep(props.searchResultsOptions);
28573
- return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS), options);
28574
- });
28575
- const fetch2 = () => {
28576
- var _a;
28577
- (_a = searchResults2.value) == null ? void 0 : _a.handleUrlChange();
28578
- };
28579
- __expose({ fetch: fetch2 });
28580
- return (_ctx, _cache) => {
28581
- return openBlock(), createBlock(unref(_sfc_main$c), {
28582
- options: fullSearchResultsOptions.value,
28583
- ref_key: "searchResults",
28584
- ref: searchResults2
28585
- }, null, 8, ["options"]);
28586
- };
28587
- }
28588
- });
28589
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
28590
- __name: "ProductListEntry",
28591
- props: {
28592
- productListOptions: {}
28593
- },
28594
- setup(__props, { expose: __expose }) {
28595
- const props = __props;
28596
- const productList2 = ref(null);
28597
- const fullProductListOptions = computed(() => {
28598
- return lodashExports.cloneDeep(props.productListOptions);
28599
- });
28600
- const fetch2 = () => {
28601
- var _a;
28602
- (_a = productList2.value) == null ? void 0 : _a.fetch();
28603
- };
28604
- __expose({ fetch: fetch2 });
28605
- return (_ctx, _cache) => {
28606
- return openBlock(), createBlock(unref(_sfc_main$a), {
28607
- options: fullProductListOptions.value,
28608
- ref_key: "productList",
28609
- ref: productList2
28610
- }, null, 8, ["options"]);
28611
- };
28612
- }
28613
- });
28614
- const QUERY_PARAMS = {
28615
- QUERY: "q",
28616
- PAGE: "p",
28617
- LIMIT: "l",
28618
- SORT: "s"
28619
- };
28620
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
28621
- __name: "SearchContainerEntry",
28622
- props: {
28623
- searchContainerOptions: {}
28624
- },
28625
- setup(__props, { expose: __expose }) {
28626
- const props = __props;
28627
- const isOpen = ref(false);
28628
- const triggerElement = ref(null);
28629
- const productList2 = ref(null);
28630
- const containerOptions = computed(() => {
28631
- return lodashExports.cloneDeep(props.searchContainerOptions);
28632
- });
28633
- const focus = () => {
28634
- const el = document.querySelector("#lupa-search-box-input .lupa-search-box-input-field");
28635
- el == null ? void 0 : el.focus();
28636
- };
28637
- const close = () => {
28638
- isOpen.value = false;
28639
- };
28640
- const openSearchContainer = () => {
28641
- isOpen.value = true;
28642
- };
28643
- const checkCloseOnEscape = (e2) => {
28644
- var _a;
28645
- if (!["Escape", "Esc"].includes((_a = e2.key) != null ? _a : "")) {
28646
- return;
28647
- }
28648
- isOpen.value = false;
28649
- };
28650
- const checkExistingQuery = () => {
28651
- const url = new URL(window.location.href);
28652
- const param = url.searchParams.get(QUERY_PARAMS.QUERY);
28653
- if (!param) {
28654
- return;
28655
- }
28656
- isOpen.value = true;
28657
- };
28658
- const mountOpenListeners = () => {
28659
- var _a, _b;
28660
- triggerElement.value = document.querySelector((_a = props.searchContainerOptions) == null ? void 0 : _a.trigger);
28661
- (_b = triggerElement.value) == null ? void 0 : _b.addEventListener("focus", openSearchContainer);
28662
- window.addEventListener("keydown", checkCloseOnEscape);
28663
- };
28664
- onMounted(() => {
28665
- var _a, _b;
28666
- mountOpenListeners();
28667
- checkExistingQuery();
28668
- isOpen.value = Boolean((_b = (_a = containerOptions.value) == null ? void 0 : _a.options) == null ? void 0 : _b.isOpenInitially);
28669
- });
28670
- onBeforeUnmount(() => {
28671
- var _a;
28672
- (_a = triggerElement.value) == null ? void 0 : _a.removeEventListener("focus", openSearchContainer);
28673
- window.removeEventListener("keydown", checkCloseOnEscape);
28674
- });
28675
- const fetch2 = () => {
28676
- var _a;
28677
- (_a = productList2.value) == null ? void 0 : _a.fetch();
28678
- };
28679
- const reloadOptions = () => {
28680
- var _a;
28681
- (_a = productList2.value) == null ? void 0 : _a.reloadOptions();
28682
- };
28683
- __expose({ fetch: fetch2, reloadOptions });
28684
- return (_ctx, _cache) => {
28685
- return openBlock(), createElementBlock("div", null, [
28686
- containerOptions.value && isOpen.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
28687
- key: 0,
28688
- options: containerOptions.value,
28689
- ref_key: "productList",
28690
- ref: productList2,
28691
- "onHook:mounted": focus,
28692
- onClose: close
28693
- }, null, 8, ["options"])) : createCommentVNode("", true)
28694
- ]);
28695
- };
28827
+ titleKey: "name",
28828
+ elements: []
28829
+ }
28830
+ ],
28831
+ history: {
28832
+ labels: {
28833
+ clear: "Clear History"
28834
+ }
28696
28835
  }
28697
- });
28698
- const _sfc_main = /* @__PURE__ */ defineComponent({
28699
- __name: "RecommendationsEntry",
28836
+ };
28837
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
28838
+ __name: "SearchBoxEntry",
28700
28839
  props: {
28701
- recommendationOptions: {}
28840
+ searchBoxOptions: {}
28702
28841
  },
28703
28842
  setup(__props, { expose: __expose }) {
28704
- const productRecommendations = ref(null);
28843
+ const props = __props;
28844
+ const searchBox2 = ref(null);
28845
+ const fullSearchBoxOptions = computed(() => {
28846
+ const options = lodashExports.cloneDeep(props.searchBoxOptions);
28847
+ return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS), options);
28848
+ });
28705
28849
  const fetch2 = () => {
28706
- productRecommendations == null ? void 0 : productRecommendations.fetch();
28850
+ var _a;
28851
+ (_a = searchBox2.value) == null ? void 0 : _a.handleCurrentValueSearch();
28707
28852
  };
28708
28853
  __expose({ fetch: fetch2 });
28709
28854
  return (_ctx, _cache) => {
28710
- return openBlock(), createBlock(unref(_sfc_main$8), {
28711
- options: _ctx.recommendationOptions,
28712
- ref_key: "productRecommendations",
28713
- ref: productRecommendations
28855
+ return openBlock(), createBlock(unref(_sfc_main$V), {
28856
+ options: fullSearchBoxOptions.value,
28857
+ ref_key: "searchBox",
28858
+ ref: searchBox2
28714
28859
  }, null, 8, ["options"]);
28715
28860
  };
28716
28861
  }
28717
28862
  });
28718
- const DEFAULT_CONTAINER_STYLE = "/containerStyle.css";
28719
- const createShadowDom = (shadowId, managerId) => {
28720
- let host = document.getElementById(shadowId);
28721
- if (host) {
28722
- host.remove();
28723
- }
28724
- host = document.createElement("div");
28725
- const manager = document.createElement("div");
28726
- host.setAttribute("id", shadowId);
28727
- manager == null ? void 0 : manager.setAttribute("id", managerId);
28728
- return { host, manager };
28729
- };
28730
- const attatchShadowDom = ({
28731
- host,
28732
- manager,
28733
- styleUrl,
28734
- options
28735
- }) => {
28736
- var _a;
28737
- if (host.shadowRoot) {
28738
- return;
28739
- }
28740
- const link = document.createElement("link");
28741
- link.type = "text/css";
28742
- link.rel = "stylesheet";
28743
- link.href = styleUrl;
28744
- const fontLink = document.createElement("link");
28745
- fontLink.type = "text/css";
28746
- fontLink.rel = "stylesheet";
28747
- fontLink.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap";
28748
- document.head.appendChild(fontLink);
28749
- const materialIconLink = document.createElement("link");
28750
- materialIconLink.type = "text/css";
28751
- materialIconLink.rel = "stylesheet";
28752
- materialIconLink.href = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,1,-50..200";
28753
- document.head.appendChild(materialIconLink);
28754
- const shadow = host.attachShadow({ mode: "open" });
28755
- shadow.appendChild(manager);
28756
- shadow.appendChild(link);
28757
- if ((_a = options == null ? void 0 : options.layout) == null ? void 0 : _a.marginLeft) {
28758
- const style = document.createElement("style");
28759
- style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${options.layout.marginLeft}px); margin-left: ${options.layout.marginLeft}px; }`;
28760
- shadow.appendChild(style);
28761
- }
28762
- };
28763
- const displayDiscountedPriceSection = (doc2, options) => {
28764
- var _a, _b;
28765
- const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
28766
- const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
28767
- return discountPrice && regularPrice && discountPrice < regularPrice;
28768
- };
28769
- const displayRegularPriceSection = (doc2, options) => {
28770
- var _a, _b;
28771
- const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
28772
- const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
28773
- const anyPrice = discountPrice || regularPrice;
28774
- return anyPrice && !displayDiscountedPriceSection(doc2, options);
28775
- };
28776
- const escapeHtml = (source) => {
28777
- if (!source) {
28778
- return source;
28779
- }
28780
- return `${source}`.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
28781
- };
28782
- const toMaxDecimalPlaces = (value, maxDecimal = 2) => {
28783
- if (!value) {
28784
- return 0;
28785
- }
28786
- try {
28787
- return +parseFloat(`${value}`).toFixed(maxDecimal);
28788
- } catch (e2) {
28789
- return `${value}`;
28790
- }
28791
- };
28792
- const capitalize = (value) => {
28793
- if (!value) {
28794
- return "";
28795
- }
28796
- return value.charAt(0).toLocaleUpperCase() + value.slice(1);
28797
- };
28798
- const getAlphanumeric = (value) => {
28799
- if (!value) {
28800
- return "";
28801
- }
28802
- return value.replace(/[\W_]/g, " ");
28803
- };
28804
- const getAdditionalElements = (fields) => {
28805
- return fields.map((key) => ({
28806
- type: "custom",
28807
- key,
28808
- label: capitalize(getAlphanumeric(key)),
28809
- className: "lupa-custom",
28810
- display: (doc2) => Boolean(doc2[key])
28811
- }));
28812
- };
28813
- const addFieldIfKeyExists = (field, key, config) => {
28814
- if (key) {
28815
- return config;
28816
- }
28817
- return { key: field, type: "customHtml", display: () => false };
28818
- };
28819
- const getSearchBoxComponent = ({
28820
- searchBoxOptions,
28821
- labels,
28822
- panelOptions,
28823
- redirections,
28824
- placeholderImage
28825
- }) => {
28826
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
28827
- const panels = [
28828
- ...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
28829
- {
28830
- type: SearchBoxPanelType.SUGGESTION,
28831
- queryKey: searchBoxOptions.suggestionQueryKey,
28832
- highlight: true,
28833
- limit: 8,
28834
- labels: {
28835
- topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
28836
- }
28837
- }
28838
- ] : [],
28839
- ...(panelOptions == null ? void 0 : panelOptions.docPanel) ? [
28840
- {
28841
- type: SearchBoxPanelType.DOCUMENT,
28842
- queryKey: searchBoxOptions.documentQueryKey,
28843
- limit: 5,
28844
- elements: [
28845
- {
28846
- type: "image",
28847
- placeholder: placeholderImage,
28848
- key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
28849
- baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
28850
- },
28851
- {
28852
- type: "title",
28853
- key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
28854
- maxLines: 2
28855
- },
28856
- {
28857
- type: "regularPrice",
28858
- key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
28859
- display: (doc2) => {
28860
- var _a2, _b2, _c2, _d2;
28861
- return ((_a2 = searchBoxOptions.fields) == null ? void 0 : _a2.regularPriceKey) && ((_b2 = searchBoxOptions.fields) == null ? void 0 : _b2.discountPriceKey) && parseFloat(doc2[(_c2 = searchBoxOptions.fields) == null ? void 0 : _c2.regularPriceKey]) > parseFloat(doc2[(_d2 = searchBoxOptions.fields) == null ? void 0 : _d2.discountPriceKey]);
28862
- }
28863
- },
28864
- {
28865
- type: "price",
28866
- key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
28867
- }
28868
- ]
28869
- }
28870
- ] : []
28871
- ];
28872
- return {
28873
- inputSelector: searchBoxOptions.inputSelector,
28874
- options: {
28875
- environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
28876
- customUrl: searchBoxOptions.customUrl,
28877
- customBaseUrl: searchBoxOptions.customBaseUrl,
28878
- customPayload: searchBoxOptions.customPayload,
28879
- customHeaders: searchBoxOptions.customHeaders
28880
- },
28881
- showTotalCount: true,
28882
- expandOnSinglePanel: true,
28883
- minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
28884
- debounce: 250,
28885
- labels: labels == null ? void 0 : labels.searchBox,
28886
- links: {
28887
- searchResults: ""
28863
+ const DEFAULT_OPTIONS_RESULTS = {
28864
+ options: {
28865
+ environment: "production"
28866
+ },
28867
+ queryKey: "",
28868
+ containerSelector: "#searchResultsContainer",
28869
+ searchTitlePosition: "page-top",
28870
+ labels: {
28871
+ pageSize: "Page size:",
28872
+ sortBy: "Sort by:",
28873
+ itemCount: "Items {1} of {2}",
28874
+ filteredItemCount: "",
28875
+ currency: "€",
28876
+ showMore: "Show more",
28877
+ searchResults: "Search Query: ",
28878
+ emptyResults: "There are no results for the query:",
28879
+ mobileFilterButton: "Filter",
28880
+ htmlTitleTemplate: "Search Query: '{1}'",
28881
+ noResultsSuggestion: "No results found for this query: {1}",
28882
+ didYouMean: "Did you mean to search: {1}",
28883
+ similarQuery: "Search results for phrase {1}",
28884
+ similarQueries: "Similar queries:"
28885
+ },
28886
+ grid: {
28887
+ columns: {
28888
+ xl: 4,
28889
+ l: 3,
28890
+ md: 2,
28891
+ sm: 2,
28892
+ xs: 1
28893
+ }
28894
+ },
28895
+ pagination: {
28896
+ sizeSelection: {
28897
+ position: {
28898
+ top: false,
28899
+ bottom: true
28900
+ },
28901
+ sizes: [12, 24, 36]
28888
28902
  },
28889
- panels,
28890
- redirections,
28891
- history: {
28892
- labels: {
28893
- clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
28894
- }
28903
+ pageSelection: {
28904
+ position: {
28905
+ top: false,
28906
+ bottom: true
28907
+ },
28908
+ display: 5,
28909
+ displayMobile: 3
28895
28910
  }
28896
- };
28897
- };
28898
- const getSearchResultsComponent = ({
28899
- searchResultOptions,
28900
- labels,
28901
- redirections,
28902
- placeholderImage,
28903
- configuratorOverrides,
28904
- callbacks,
28905
- additionalFields
28906
- }) => {
28907
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
28908
- const filters = searchResultOptions.showFacets ? {
28911
+ },
28912
+ sort: [],
28913
+ filters: {
28909
28914
  currentFilters: {
28910
28915
  visibility: {
28911
28916
  mobileSidebar: true,
28912
28917
  mobileToolbar: true
28913
28918
  },
28914
28919
  labels: {
28915
- title: "",
28916
- clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
28920
+ title: "Current filters:",
28921
+ clearAll: "Clear all"
28917
28922
  }
28918
28923
  },
28919
28924
  facets: {
28920
28925
  labels: {
28921
- title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
28922
- showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
28923
- facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
28924
- facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
28926
+ title: "Filters:",
28927
+ showAll: "Show more",
28928
+ facetFilter: "Filter...",
28929
+ facetClear: "Clear"
28925
28930
  },
28926
28931
  filterable: {
28927
28932
  minValues: 5
@@ -28931,179 +28936,230 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
28931
28936
  topLevelValueCountLimit: 5,
28932
28937
  filterable: true
28933
28938
  },
28934
- stats: {
28935
- slider: true,
28936
- inputs: true,
28937
- labels: {
28938
- from: "",
28939
- to: ""
28940
- }
28941
- },
28942
- facetValueCountLimit: 8,
28939
+ facetValueCountLimit: 20,
28943
28940
  showDocumentCount: true,
28944
28941
  style: {
28945
28942
  type: "sidebar"
28946
28943
  }
28947
28944
  }
28948
- } : {};
28949
- const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
28950
- xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
28951
- l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
28952
- md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
28953
- sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
28954
- xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
28955
- };
28956
- const badges = {
28957
- badges: {
28958
- anchor: "tr",
28959
- elements: [
28960
- ...searchResultOptions.showRelevance ? [
28961
- {
28962
- key: "",
28963
- type: "customHtml",
28964
- className: "relevance",
28965
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
28966
- display: (doc2) => Boolean(doc2._relevance !== void 0)
28967
- }
28968
- ] : [],
28969
- ...((_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) ? [
28970
- {
28971
- key: "",
28972
- type: "customHtml",
28973
- className: "boosted-marker",
28974
- html: () => {
28975
- var _a2;
28976
- return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
28977
- },
28978
- display: (doc2) => doc2._boosted === true
28979
- }
28980
- ] : []
28981
- ]
28982
- }
28983
- };
28984
- return __spreadValues(__spreadProps(__spreadValues({
28985
- options: {
28986
- environment: (_m = searchResultOptions.environment) != null ? _m : "production",
28987
- customUrl: searchResultOptions.customUrl,
28988
- customBaseUrl: searchResultOptions.customBaseUrl,
28989
- customPayload: searchResultOptions.customPayload,
28990
- customHeaders: searchResultOptions.customHeaders,
28991
- onError: searchResultOptions.errorHandler
28992
- },
28993
- queryKey: searchResultOptions.queryKey,
28994
- containerSelector: searchResultOptions.containerSelector,
28995
- searchTitlePosition: "search-results-top",
28996
- titleKey: (_n = searchResultOptions.fields) == null ? void 0 : _n.titleKey,
28997
- labels: labels == null ? void 0 : labels.searchResults,
28998
- grid: {
28999
- columns
29000
- },
29001
- pagination: {
29002
- sizeSelection: {
29003
- position: {
29004
- top: true,
29005
- bottom: false
29006
- },
29007
- sizes: [12, 24, 36, 48]
29008
- },
29009
- pageSelection: {
29010
- position: {
29011
- top: false,
29012
- bottom: true
29013
- },
29014
- displayMobile: 3,
29015
- display: 5
29016
- }
29017
- },
29018
- filters,
29019
- toolbar: {
29020
- layoutSelector: false,
29021
- itemSummary: true,
29022
- clearFilters: false
29023
- },
29024
- isInStock: () => {
29025
- return true;
29026
- }
29027
- }, badges), {
29028
- links: {
29029
- details: ((_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl) ? `{${(_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl}}` : void 0
29030
- },
29031
- callbacks,
29032
- routingBehavior: callbacks ? "event" : "direct-link",
29033
- idKey: "id",
29034
- elements: [
29035
- {
29036
- type: "image",
29037
- placeholder: placeholderImage,
29038
- key: (_q = searchResultOptions.fields) == null ? void 0 : _q.imageKey,
29039
- baseUrl: (_r = searchResultOptions.fields) == null ? void 0 : _r.baseImageUrl,
29040
- display: () => {
29041
- var _a2;
29042
- return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
29043
- }
29044
- },
29045
- addFieldIfKeyExists("_emphasis", (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField, {
29046
- type: "custom",
29047
- className: "lupa-custom-emphasis",
29048
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField,
29049
- display: () => true
29050
- }),
29051
- {
29052
- type: "title",
29053
- key: (_u = searchResultOptions.fields) == null ? void 0 : _u.titleKey,
29054
- maxLines: (_v = searchResultOptions.maxLines) != null ? _v : 2,
29055
- display: (doc2) => {
29056
- var _a2, _b2;
29057
- return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
29058
- }
29059
- },
29060
- ...getAdditionalElements(additionalFields),
29061
- addFieldIfKeyExists("_discountPrice", (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey, {
29062
- key: (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey,
29063
- type: "customHtml",
29064
- className: "lupa-price lupa-price-discounted",
29065
- display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
29066
- html: (doc2) => {
29067
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
29068
- const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
29069
- const discountPrice = (_d2 = parseFloat(
29070
- doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
29071
- )) == null ? void 0 : _d2.toFixed(2);
29072
- const regularPrice = (_g2 = parseFloat(
29073
- doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
29074
- )) == null ? void 0 : _g2.toFixed(2);
29075
- const discount = `<span class="lupa-discount">${escapeHtml(
29076
- discountPrice
29077
- )} ${currency}</span>`;
29078
- const regular = `<span class="lupa-regular">${escapeHtml(
29079
- regularPrice
29080
- )} ${currency}</span>`;
29081
- return discount + regular;
29082
- }
29083
- }),
29084
- addFieldIfKeyExists("_regularPrice", (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey, {
29085
- key: (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey,
29086
- type: "customHtml",
29087
- className: "lupa-price lupa-price-single",
29088
- display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
29089
- html: (doc2) => {
29090
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
29091
- const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
29092
- const price = (_g2 = parseFloat(
29093
- (_f2 = doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.regularPriceKey) != null ? _c2 : ""]) != null ? _f2 : doc2[(_e2 = (_d2 = searchResultOptions.fields) == null ? void 0 : _d2.discountPriceKey) != null ? _e2 : ""]
29094
- )) == null ? void 0 : _g2.toFixed(2);
29095
- return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
29096
- }
29097
- })
29098
- ],
29099
- breadcrumbs: [],
29100
- sort: [],
29101
- redirections
29102
- }), configuratorOverrides);
28945
+ },
28946
+ toolbar: {
28947
+ layoutSelector: true,
28948
+ itemSummary: true,
28949
+ clearFilters: false
28950
+ },
28951
+ isInStock: () => {
28952
+ return true;
28953
+ },
28954
+ badges: {
28955
+ anchor: "tr",
28956
+ elements: []
28957
+ },
28958
+ links: {
28959
+ details: "/{id}"
28960
+ },
28961
+ elements: [],
28962
+ breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
28963
+ };
28964
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
28965
+ __name: "SearchResultsEntry",
28966
+ props: {
28967
+ searchResultsOptions: {}
28968
+ },
28969
+ setup(__props, { expose: __expose }) {
28970
+ const props = __props;
28971
+ const searchResults2 = ref(null);
28972
+ const fullSearchResultsOptions = computed(() => {
28973
+ const options = lodashExports.cloneDeep(props.searchResultsOptions);
28974
+ return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS), options);
28975
+ });
28976
+ const fetch2 = () => {
28977
+ var _a;
28978
+ (_a = searchResults2.value) == null ? void 0 : _a.handleUrlChange();
28979
+ };
28980
+ __expose({ fetch: fetch2 });
28981
+ return (_ctx, _cache) => {
28982
+ return openBlock(), createBlock(unref(_sfc_main$c), {
28983
+ options: fullSearchResultsOptions.value,
28984
+ ref_key: "searchResults",
28985
+ ref: searchResults2
28986
+ }, null, 8, ["options"]);
28987
+ };
28988
+ }
28989
+ });
28990
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
28991
+ __name: "ProductListEntry",
28992
+ props: {
28993
+ productListOptions: {}
28994
+ },
28995
+ setup(__props, { expose: __expose }) {
28996
+ const props = __props;
28997
+ const productList2 = ref(null);
28998
+ const fullProductListOptions = computed(() => {
28999
+ return lodashExports.cloneDeep(props.productListOptions);
29000
+ });
29001
+ const fetch2 = () => {
29002
+ var _a;
29003
+ (_a = productList2.value) == null ? void 0 : _a.fetch();
29004
+ };
29005
+ __expose({ fetch: fetch2 });
29006
+ return (_ctx, _cache) => {
29007
+ return openBlock(), createBlock(unref(_sfc_main$a), {
29008
+ options: fullProductListOptions.value,
29009
+ ref_key: "productList",
29010
+ ref: productList2
29011
+ }, null, 8, ["options"]);
29012
+ };
29013
+ }
29014
+ });
29015
+ const QUERY_PARAMS = {
29016
+ QUERY: "q",
29017
+ PAGE: "p",
29018
+ LIMIT: "l",
29019
+ SORT: "s"
29103
29020
  };
29104
- const SearchContainerConfigurationService = {
29105
- getSearchBoxComponent,
29106
- getSearchResultsComponent
29021
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29022
+ __name: "SearchContainerEntry",
29023
+ props: {
29024
+ searchContainerOptions: {}
29025
+ },
29026
+ setup(__props, { expose: __expose }) {
29027
+ const props = __props;
29028
+ const isOpen = ref(false);
29029
+ const triggerElement = ref(null);
29030
+ const productList2 = ref(null);
29031
+ const containerOptions = computed(() => {
29032
+ return lodashExports.cloneDeep(props.searchContainerOptions);
29033
+ });
29034
+ const focus = () => {
29035
+ const el = document.querySelector("#lupa-search-box-input .lupa-search-box-input-field");
29036
+ el == null ? void 0 : el.focus();
29037
+ };
29038
+ const close = () => {
29039
+ isOpen.value = false;
29040
+ };
29041
+ const openSearchContainer = () => {
29042
+ isOpen.value = true;
29043
+ };
29044
+ const checkCloseOnEscape = (e2) => {
29045
+ var _a;
29046
+ if (!["Escape", "Esc"].includes((_a = e2.key) != null ? _a : "")) {
29047
+ return;
29048
+ }
29049
+ isOpen.value = false;
29050
+ };
29051
+ const checkExistingQuery = () => {
29052
+ const url = new URL(window.location.href);
29053
+ const param = url.searchParams.get(QUERY_PARAMS.QUERY);
29054
+ if (!param) {
29055
+ return;
29056
+ }
29057
+ isOpen.value = true;
29058
+ };
29059
+ const mountOpenListeners = () => {
29060
+ var _a, _b;
29061
+ triggerElement.value = document.querySelector((_a = props.searchContainerOptions) == null ? void 0 : _a.trigger);
29062
+ (_b = triggerElement.value) == null ? void 0 : _b.addEventListener("focus", openSearchContainer);
29063
+ window.addEventListener("keydown", checkCloseOnEscape);
29064
+ };
29065
+ onMounted(() => {
29066
+ var _a, _b;
29067
+ mountOpenListeners();
29068
+ checkExistingQuery();
29069
+ isOpen.value = Boolean((_b = (_a = containerOptions.value) == null ? void 0 : _a.options) == null ? void 0 : _b.isOpenInitially);
29070
+ });
29071
+ onBeforeUnmount(() => {
29072
+ var _a;
29073
+ (_a = triggerElement.value) == null ? void 0 : _a.removeEventListener("focus", openSearchContainer);
29074
+ window.removeEventListener("keydown", checkCloseOnEscape);
29075
+ });
29076
+ const fetch2 = () => {
29077
+ var _a;
29078
+ (_a = productList2.value) == null ? void 0 : _a.fetch();
29079
+ };
29080
+ const reloadOptions = () => {
29081
+ var _a;
29082
+ (_a = productList2.value) == null ? void 0 : _a.reloadOptions();
29083
+ };
29084
+ __expose({ fetch: fetch2, reloadOptions });
29085
+ return (_ctx, _cache) => {
29086
+ return openBlock(), createElementBlock("div", null, [
29087
+ containerOptions.value && isOpen.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
29088
+ key: 0,
29089
+ options: containerOptions.value,
29090
+ ref_key: "productList",
29091
+ ref: productList2,
29092
+ "onHook:mounted": focus,
29093
+ onClose: close
29094
+ }, null, 8, ["options"])) : createCommentVNode("", true)
29095
+ ]);
29096
+ };
29097
+ }
29098
+ });
29099
+ const _sfc_main = /* @__PURE__ */ defineComponent({
29100
+ __name: "RecommendationsEntry",
29101
+ props: {
29102
+ recommendationOptions: {}
29103
+ },
29104
+ setup(__props, { expose: __expose }) {
29105
+ const productRecommendations = ref(null);
29106
+ const fetch2 = () => {
29107
+ productRecommendations == null ? void 0 : productRecommendations.fetch();
29108
+ };
29109
+ __expose({ fetch: fetch2 });
29110
+ return (_ctx, _cache) => {
29111
+ return openBlock(), createBlock(unref(_sfc_main$8), {
29112
+ options: _ctx.recommendationOptions,
29113
+ ref_key: "productRecommendations",
29114
+ ref: productRecommendations
29115
+ }, null, 8, ["options"]);
29116
+ };
29117
+ }
29118
+ });
29119
+ const DEFAULT_CONTAINER_STYLE = "/containerStyle.css";
29120
+ const createShadowDom = (shadowId, managerId) => {
29121
+ let host = document.getElementById(shadowId);
29122
+ if (host) {
29123
+ host.remove();
29124
+ }
29125
+ host = document.createElement("div");
29126
+ const manager = document.createElement("div");
29127
+ host.setAttribute("id", shadowId);
29128
+ manager == null ? void 0 : manager.setAttribute("id", managerId);
29129
+ return { host, manager };
29130
+ };
29131
+ const attatchShadowDom = ({
29132
+ host,
29133
+ manager,
29134
+ styleUrl,
29135
+ options
29136
+ }) => {
29137
+ var _a;
29138
+ if (host.shadowRoot) {
29139
+ return;
29140
+ }
29141
+ const link = document.createElement("link");
29142
+ link.type = "text/css";
29143
+ link.rel = "stylesheet";
29144
+ link.href = styleUrl;
29145
+ const fontLink = document.createElement("link");
29146
+ fontLink.type = "text/css";
29147
+ fontLink.rel = "stylesheet";
29148
+ fontLink.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap";
29149
+ document.head.appendChild(fontLink);
29150
+ const materialIconLink = document.createElement("link");
29151
+ materialIconLink.type = "text/css";
29152
+ materialIconLink.rel = "stylesheet";
29153
+ materialIconLink.href = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,1,-50..200";
29154
+ document.head.appendChild(materialIconLink);
29155
+ const shadow = host.attachShadow({ mode: "open" });
29156
+ shadow.appendChild(manager);
29157
+ shadow.appendChild(link);
29158
+ if ((_a = options == null ? void 0 : options.layout) == null ? void 0 : _a.marginLeft) {
29159
+ const style = document.createElement("style");
29160
+ style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${options.layout.marginLeft}px); margin-left: ${options.layout.marginLeft}px; }`;
29161
+ shadow.appendChild(style);
29162
+ }
29107
29163
  };
29108
29164
  const getMountElement = (element, mountingBehavior = "replace", mountToParent) => {
29109
29165
  const parent = element == null ? void 0 : element.parentElement;
@@ -29134,7 +29190,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29134
29190
  return;
29135
29191
  }
29136
29192
  let mountedComponent = null;
29137
- const props = reactive(__spreadValues({}, options));
29193
+ const props = reactive(__spreadValues2({}, options));
29138
29194
  const app2 = createApp({
29139
29195
  render: () => mountedComponent = h$1(rootComponent, props)
29140
29196
  });
@@ -29153,9 +29209,6 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29153
29209
  recommendations: {},
29154
29210
  chat: {}
29155
29211
  };
29156
- const tracking = (options) => {
29157
- setupTracking(options);
29158
- };
29159
29212
  const applySearchBox = (options, mountOptions) => {
29160
29213
  const existingInstance = app.box[options.inputSelector];
29161
29214
  if (existingInstance) {
@@ -29184,7 +29237,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29184
29237
  var _a;
29185
29238
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
29186
29239
  for (const input of inputs) {
29187
- applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input.trim() }), mountOptions);
29240
+ applySearchBox(__spreadProps2(__spreadValues2({}, options), { inputSelector: input.trim() }), mountOptions);
29188
29241
  }
29189
29242
  };
29190
29243
  const searchResults = (options, mountOptions) => {
@@ -29420,7 +29473,237 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29420
29473
  } catch (e2) {
29421
29474
  }
29422
29475
  };
29476
+ const saveToLocalStorage = (key, value) => {
29477
+ try {
29478
+ localStorage.setItem(key, JSON.stringify(value));
29479
+ } catch (e2) {
29480
+ }
29481
+ };
29482
+ const tryLoadFromLocalStorage = (key) => {
29483
+ try {
29484
+ const item = localStorage.getItem(key);
29485
+ return item ? JSON.parse(item) : null;
29486
+ } catch (e2) {
29487
+ return null;
29488
+ }
29489
+ };
29490
+ const saveToSessionStorage = (key, value) => {
29491
+ try {
29492
+ sessionStorage.setItem(key, JSON.stringify(value));
29493
+ } catch (e2) {
29494
+ }
29495
+ };
29496
+ const tryLoadFromSessionStorage = (key) => {
29497
+ try {
29498
+ const item = sessionStorage.getItem(key);
29499
+ return item ? JSON.parse(item) : null;
29500
+ } catch (e2) {
29501
+ return null;
29502
+ }
29503
+ };
29504
+ const getQueryParam = (name) => {
29505
+ try {
29506
+ const urlParams = new URLSearchParams(window.location.search);
29507
+ return urlParams.get(name);
29508
+ } catch (e2) {
29509
+ return null;
29510
+ }
29511
+ };
29512
+ const PREVIEW_PARAMETER = "lupaSearchPreview";
29513
+ let styleElement = null;
29514
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 10, interval = 10) => __async2(this, null, function* () {
29515
+ if (retries > maxRetries) {
29516
+ return false;
29517
+ }
29518
+ if (typeof element === "string") {
29519
+ element = document.querySelector(element);
29520
+ }
29521
+ if (element) {
29522
+ return true;
29523
+ } else {
29524
+ setTimeout(() => {
29525
+ waitForElementToBeVisible(element, retries + 1, maxRetries, interval + 10);
29526
+ }, interval);
29527
+ }
29528
+ });
29529
+ const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async2(this, null, function* () {
29530
+ const configuration2 = yield fetchPluginConfiguration(
29531
+ options,
29532
+ configurationKey
29533
+ );
29534
+ if (!configuration2) {
29535
+ console.error(`Failed to fetch LupaSearch plugin configuration for key ${configurationKey}`);
29536
+ return null;
29537
+ }
29538
+ saveToLocalStorage(configurationKey, configuration2);
29539
+ return configuration2;
29540
+ });
29541
+ const checkIsPreviewMode = () => {
29542
+ const isPreviewModeSaved = tryLoadFromSessionStorage(PREVIEW_PARAMETER);
29543
+ if (isPreviewModeSaved) {
29544
+ return isPreviewModeSaved;
29545
+ }
29546
+ const isPreviewMode = getQueryParam(PREVIEW_PARAMETER) === "true";
29547
+ if (isPreviewMode) {
29548
+ saveToSessionStorage(PREVIEW_PARAMETER, isPreviewMode);
29549
+ } else {
29550
+ saveToSessionStorage(PREVIEW_PARAMETER, false);
29551
+ }
29552
+ return isPreviewMode;
29553
+ };
29554
+ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async2(this, null, function* () {
29555
+ if (isPreviewMode) {
29556
+ return loadAndSaveConfigurationFromServer(configurationKey, options);
29557
+ }
29558
+ const existingConfiguration = tryLoadFromLocalStorage(configurationKey);
29559
+ if (existingConfiguration) {
29560
+ setTimeout(() => __async2(this, null, function* () {
29561
+ var _a;
29562
+ const newestConfiguration = yield loadAndSaveConfigurationFromServer(
29563
+ configurationKey,
29564
+ options
29565
+ );
29566
+ if (existingConfiguration.updatedAt === newestConfiguration.updatedAt) {
29567
+ return;
29568
+ }
29569
+ const isPreviewMode2 = checkIsPreviewMode();
29570
+ const configuration2 = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
29571
+ yield mount(configuration2, false);
29572
+ }), 5e3);
29573
+ return existingConfiguration;
29574
+ }
29575
+ return loadAndSaveConfigurationFromServer(configurationKey, options);
29576
+ });
29577
+ const applyStyles = (configuration2) => __async2(this, null, function* () {
29578
+ var _a;
29579
+ const visible2 = yield waitForElementToBeVisible(document.head);
29580
+ if (!visible2) {
29581
+ console.error("Failed to apply custom LupaSearch styles, head element not found");
29582
+ return;
29583
+ }
29584
+ const baseStyleLink = configuration2.baseStyleLink;
29585
+ if (styleElement) {
29586
+ styleElement.remove();
29587
+ }
29588
+ styleElement = document.createElement("style");
29589
+ if (baseStyleLink) {
29590
+ styleElement.innerHTML = `
29591
+ @import url('${baseStyleLink}');
29592
+ @import url('https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css')
29593
+ ${(_a = configuration2.customStyles) != null ? _a : ""}`;
29594
+ }
29595
+ document.head.appendChild(styleElement);
29596
+ });
29597
+ const mountSearchBox = (configuration, fetch = true) => __async2(this, null, function* () {
29598
+ if (!configuration.searchBox) {
29599
+ return;
29600
+ }
29601
+ const resolvedConfiguration = eval(`(${configuration.searchBox})`);
29602
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.inputSelector);
29603
+ if (!visible) {
29604
+ console.error(
29605
+ `Failed to mount LupaSearch search box, input element ${resolvedConfiguration.inputSelector} not found`
29606
+ );
29607
+ return;
29608
+ }
29609
+ searchBox(resolvedConfiguration, { fetch });
29610
+ });
29611
+ const mountSearchResults = (configuration, fetch = true) => __async2(this, null, function* () {
29612
+ if (!configuration.searchResults) {
29613
+ return;
29614
+ }
29615
+ const resolvedConfiguration = eval(`(${configuration.searchResults})`);
29616
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29617
+ if (!visible) {
29618
+ console.error(
29619
+ `Failed to mount LupaSearch search results, element ${resolvedConfiguration.containerSelector} not found`
29620
+ );
29621
+ return;
29622
+ }
29623
+ searchResults(resolvedConfiguration, { fetch });
29624
+ });
29625
+ const mountProductList = (configuration, fetch = true) => __async2(this, null, function* () {
29626
+ if (!configuration.productList) {
29627
+ return;
29628
+ }
29629
+ const resolvedSearchResultsConfiguration = eval(
29630
+ `(${configuration.searchResults})`
29631
+ );
29632
+ const resolvedConfiguration = eval(`(${configuration.productList})`);
29633
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29634
+ if (!visible) {
29635
+ console.error(
29636
+ `Failed to mount LupaSearch product list, element ${resolvedConfiguration.containerSelector} not found`
29637
+ );
29638
+ return;
29639
+ }
29640
+ productList(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29641
+ });
29642
+ const mountRecommendations = (configuration, fetch = true) => __async2(this, null, function* () {
29643
+ if (!configuration.recommendations) {
29644
+ return;
29645
+ }
29646
+ const resolvedSearchResultsConfiguration = eval(
29647
+ `(${configuration.searchResults})`
29648
+ );
29649
+ const resolvedConfiguration = eval(
29650
+ `(${configuration.recommendations})`
29651
+ );
29652
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29653
+ if (!visible) {
29654
+ console.error(
29655
+ `Failed to mount LupaSearch recommendations, element ${resolvedConfiguration.containerSelector} not found`
29656
+ );
29657
+ return;
29658
+ }
29659
+ recommendations(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29660
+ });
29661
+ const mountChat = (configuration, fetch = true) => __async2(this, null, function* () {
29662
+ if (!configuration.genAiChat) {
29663
+ return;
29664
+ }
29665
+ const resolvedSearchResultsConfiguration = eval(
29666
+ `(${configuration.searchResults})`
29667
+ );
29668
+ const resolvedConfiguration = eval(`(${configuration.genAiChat})`);
29669
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29670
+ if (!visible) {
29671
+ console.error(
29672
+ `Failed to mount LupaSearch chat, element ${resolvedConfiguration.containerSelector} not found`
29673
+ );
29674
+ return;
29675
+ }
29676
+ chat(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29677
+ });
29678
+ const mount = (configuration2, fetch2 = true) => __async2(this, null, function* () {
29679
+ yield applyStyles(configuration2);
29680
+ const mountPromises = [
29681
+ mountSearchBox(configuration2, fetch2),
29682
+ mountSearchResults(configuration2, fetch2),
29683
+ mountProductList(configuration2, fetch2),
29684
+ mountRecommendations(configuration2, fetch2),
29685
+ mountChat(configuration2, fetch2)
29686
+ ];
29687
+ yield Promise.all(mountPromises);
29688
+ });
29689
+ const init$1 = (configurationKey, options) => __async2(this, null, function* () {
29690
+ var _a;
29691
+ const isPreviewMode = checkIsPreviewMode();
29692
+ const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options);
29693
+ const configuration2 = isPreviewMode ? (_a = plugin.previewConfiguration) != null ? _a : plugin.configuration : plugin.configuration;
29694
+ yield mount(configuration2);
29695
+ });
29696
+ const PluginConfigurationManager = {
29697
+ init: init$1
29698
+ };
29699
+ const tracking = (options) => {
29700
+ setupTracking(options);
29701
+ };
29702
+ const init = (configurationKey, options) => {
29703
+ return PluginConfigurationManager.init(configurationKey, options);
29704
+ };
29423
29705
  const lupaSearch = {
29706
+ init,
29424
29707
  searchBox,
29425
29708
  searchResults,
29426
29709
  tracking,
@@ -29442,9 +29725,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
29442
29725
  window.getLupa = lupaSearch;
29443
29726
  window.lupaSearch = lupaSearch;
29444
29727
  }
29445
- exports2.BadgeType = BadgeType;
29446
- exports2.DocumentElementType = DocumentElementType;
29447
- exports2.SearchBoxPanelType = SearchBoxPanelType;
29448
- exports2.default = lupaSearch;
29449
- Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
29728
+ exports.BadgeType = BadgeType;
29729
+ exports.DocumentElementType = DocumentElementType;
29730
+ exports.SearchBoxPanelType = SearchBoxPanelType;
29731
+ exports.default = lupaSearch;
29732
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
29450
29733
  });