@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,22 +1,42 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
1
+ var __defProp2 = Object.defineProperty;
2
+ var __defProps2 = Object.defineProperties;
3
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues2 = (a, b) => {
9
9
  for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
10
+ if (__hasOwnProp2.call(b, prop))
11
+ __defNormalProp2(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols2)
13
+ for (var prop of __getOwnPropSymbols2(b)) {
14
+ if (__propIsEnum2.call(b, prop))
15
+ __defNormalProp2(a, prop, b[prop]);
16
16
  }
17
17
  return a;
18
18
  };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
19
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
20
+ var __async2 = (__this, __arguments, generator) => {
21
+ return new Promise((resolve2, reject) => {
22
+ var fulfilled = (value) => {
23
+ try {
24
+ step(generator.next(value));
25
+ } catch (e2) {
26
+ reject(e2);
27
+ }
28
+ };
29
+ var rejected = (value) => {
30
+ try {
31
+ step(generator.throw(value));
32
+ } catch (e2) {
33
+ reject(e2);
34
+ }
35
+ };
36
+ var step = (x) => x.done ? resolve2(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
+ step((generator = generator.apply(__this, __arguments)).next());
38
+ });
39
+ };
20
40
  function makeMap(str, expectsLowerCase) {
21
41
  const map = /* @__PURE__ */ Object.create(null);
22
42
  const list = str.split(",");
@@ -6301,7 +6321,7 @@ function ensureRenderer() {
6301
6321
  }
6302
6322
  const createApp = (...args) => {
6303
6323
  const app2 = ensureRenderer().createApp(...args);
6304
- const { mount } = app2;
6324
+ const { mount: mount2 } = app2;
6305
6325
  app2.mount = (containerOrSelector) => {
6306
6326
  const container = normalizeContainer(containerOrSelector);
6307
6327
  if (!container)
@@ -6311,7 +6331,7 @@ const createApp = (...args) => {
6311
6331
  component.template = container.innerHTML;
6312
6332
  }
6313
6333
  container.innerHTML = "";
6314
- const proxy = mount(container, false, container instanceof SVGElement);
6334
+ const proxy = mount2(container, false, container instanceof SVGElement);
6315
6335
  if (container instanceof Element) {
6316
6336
  container.removeAttribute("v-cloak");
6317
6337
  container.setAttribute("data-v-app", "");
@@ -6327,25 +6347,25 @@ function normalizeContainer(container) {
6327
6347
  }
6328
6348
  return container;
6329
6349
  }
6330
- var __defProp2 = Object.defineProperty;
6331
- var __defProps2 = Object.defineProperties;
6332
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
6333
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
6334
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
6335
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
6336
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6337
- var __spreadValues2 = (a, b) => {
6350
+ var __defProp = Object.defineProperty;
6351
+ var __defProps = Object.defineProperties;
6352
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6353
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6354
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6355
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
6356
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6357
+ var __spreadValues = (a, b) => {
6338
6358
  for (var prop in b || (b = {}))
6339
- if (__hasOwnProp2.call(b, prop))
6340
- __defNormalProp2(a, prop, b[prop]);
6341
- if (__getOwnPropSymbols2)
6342
- for (var prop of __getOwnPropSymbols2(b)) {
6343
- if (__propIsEnum2.call(b, prop))
6344
- __defNormalProp2(a, prop, b[prop]);
6359
+ if (__hasOwnProp.call(b, prop))
6360
+ __defNormalProp(a, prop, b[prop]);
6361
+ if (__getOwnPropSymbols)
6362
+ for (var prop of __getOwnPropSymbols(b)) {
6363
+ if (__propIsEnum.call(b, prop))
6364
+ __defNormalProp(a, prop, b[prop]);
6345
6365
  }
6346
6366
  return a;
6347
6367
  };
6348
- var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
6368
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6349
6369
  var __async = (__this, __arguments, generator) => {
6350
6370
  return new Promise((resolve2, reject) => {
6351
6371
  var fulfilled = (value) => {
@@ -6811,14 +6831,14 @@ var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _argumen
6811
6831
  step((generator = generator.apply(thisArg, _arguments || [])).next());
6812
6832
  });
6813
6833
  };
6814
- const defaultConfig$1 = {
6834
+ const defaultConfig = {
6815
6835
  method: "POST",
6816
6836
  headers: { "Content-Type": "application/json" }
6817
6837
  };
6818
6838
  const customRequestConfig = ({ customHeaders }) => {
6819
6839
  return {
6820
- method: defaultConfig$1.method,
6821
- headers: Object.assign(Object.assign({}, defaultConfig$1.headers), customHeaders !== null && customHeaders !== void 0 ? customHeaders : {})
6840
+ method: defaultConfig.method,
6841
+ headers: Object.assign(Object.assign({}, defaultConfig.headers), customHeaders !== null && customHeaders !== void 0 ? customHeaders : {})
6822
6842
  };
6823
6843
  };
6824
6844
  const searchCustom = (query, options) => __awaiter(void 0, void 0, void 0, function* () {
@@ -6842,7 +6862,7 @@ const suggestCustom = (query, options) => __awaiter(void 0, void 0, void 0, func
6842
6862
  return { success: false, errors };
6843
6863
  });
6844
6864
  const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6845
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
6865
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
6846
6866
  if (res.status < 400) {
6847
6867
  const data = yield res.json();
6848
6868
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6852,7 +6872,7 @@ const search = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0
6852
6872
  });
6853
6873
  const queryByIds = (queryKey, ids, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6854
6874
  const idParam = ids.map((id) => `ids=${id}`).join("&");
6855
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6875
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}/ids?${idParam}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6856
6876
  if (res.status < 400) {
6857
6877
  const data = yield res.json();
6858
6878
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6865,7 +6885,7 @@ const recommendForSingleId = (queryKey, recommendForId, filters, environment, cu
6865
6885
  if (filters) {
6866
6886
  url += `&${e({ filters })}`;
6867
6887
  }
6868
- const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6888
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6869
6889
  if (res.status < 400) {
6870
6890
  const data = yield res.json();
6871
6891
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6879,7 +6899,7 @@ const recommendForMultipleIds = (queryKey, recommendForIds, filters, environment
6879
6899
  if (filters) {
6880
6900
  url += `&${e({ filters })}`;
6881
6901
  }
6882
- const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6902
+ const res = yield fetch(url, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6883
6903
  if (res.status < 400) {
6884
6904
  const data = yield res.json();
6885
6905
  return Object.assign(Object.assign({}, data), { success: true });
@@ -6891,7 +6911,7 @@ const recommend = (queryKey, recommendForId, filters, environment, customBaseUrl
6891
6911
  return Array.isArray(recommendForId) ? yield recommendForMultipleIds(queryKey, recommendForId, filters, environment, customBaseUrl) : yield recommendForSingleId(queryKey, recommendForId, filters, environment, customBaseUrl);
6892
6912
  });
6893
6913
  const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6894
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(query) }));
6914
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}query/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(query) }));
6895
6915
  if (res.status < 400) {
6896
6916
  const items = yield res.json();
6897
6917
  return { items, success: true };
@@ -6901,7 +6921,7 @@ const suggest = (queryKey, query, environment, customBaseUrl) => __awaiter(void
6901
6921
  });
6902
6922
  const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6903
6923
  try {
6904
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig$1), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
6924
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}events`, Object.assign(Object.assign({}, defaultConfig), { body: JSON.stringify(Object.assign({ queryKey }, event)) }));
6905
6925
  if (res.status < 400) {
6906
6926
  return { success: false };
6907
6927
  }
@@ -6911,7 +6931,7 @@ const track$1 = (queryKey, event, environment, customBaseUrl) => __awaiter(void
6911
6931
  }
6912
6932
  });
6913
6933
  const loadRedirectionRules = (queryKey, environment, customBaseUrl) => __awaiter(void 0, void 0, void 0, function* () {
6914
- const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}redirections/${queryKey}`, Object.assign(Object.assign({}, defaultConfig$1), { method: "GET" }));
6934
+ const res = yield fetch(`${getApiUrl$1(environment, customBaseUrl)}redirections/${queryKey}`, Object.assign(Object.assign({}, defaultConfig), { method: "GET" }));
6915
6935
  if (res.status < 400) {
6916
6936
  return res.json();
6917
6937
  }
@@ -7243,13 +7263,13 @@ const sendGa4AnalyticsEvent = (data, options) => {
7243
7263
  }
7244
7264
  const sendItemTitle = data.searchQuery !== ((_a = data.analytics) == null ? void 0 : _a.label);
7245
7265
  const title = sendItemTitle ? (_b = data.analytics) == null ? void 0 : _b.label : void 0;
7246
- const params = __spreadValues2({
7266
+ const params = __spreadValues({
7247
7267
  search_text: data.searchQuery,
7248
7268
  item_title: title,
7249
7269
  item_id: data.itemId,
7250
7270
  ecommerce: parseEcommerceData(data, (_c = data.analytics) == null ? void 0 : _c.listLabel)
7251
7271
  }, (_e = (_d = data.analytics) == null ? void 0 : _d.additionalParams) != null ? _e : {});
7252
- window.dataLayer.push(__spreadValues2({
7272
+ window.dataLayer.push(__spreadValues({
7253
7273
  event: (_g = (_f = data.analytics) == null ? void 0 : _f.type) != null ? _g : options.parentEventName
7254
7274
  }, params));
7255
7275
  };
@@ -7427,15 +7447,21 @@ const DEFAULT_OPTIONS_RESULTS$1 = {
7427
7447
  breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
7428
7448
  };
7429
7449
  const useScreenStore = defineStore("screen", () => {
7430
- const screenWidth = ref(1e3);
7450
+ const measuredScreenWidth = ref(1e3);
7431
7451
  const optionsStore = useOptionsStore();
7452
+ const screenWidth = computed(() => {
7453
+ var _a, _b;
7454
+ const { searchResultOptions } = storeToRefs(optionsStore);
7455
+ return (_b = (_a = searchResultOptions.value.grid) == null ? void 0 : _a.forcedScreenWidth) != null ? _b : measuredScreenWidth.value;
7456
+ });
7432
7457
  const configuredGridSizes = computed(() => {
7433
7458
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
7459
+ const { searchResultOptions } = storeToRefs(optionsStore);
7434
7460
  return {
7435
- 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,
7436
- 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,
7437
- 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,
7438
- 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
7461
+ 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,
7462
+ 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,
7463
+ 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,
7464
+ 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
7439
7465
  };
7440
7466
  });
7441
7467
  const currentScreenWidth = computed(() => {
@@ -7457,7 +7483,7 @@ const useScreenStore = defineStore("screen", () => {
7457
7483
  return (_a = ["xs", "sm"]) == null ? void 0 : _a.includes(currentScreenWidth.value);
7458
7484
  });
7459
7485
  const setScreenWidth = ({ width }) => {
7460
- screenWidth.value = width;
7486
+ measuredScreenWidth.value = width;
7461
7487
  };
7462
7488
  return { screenWidth, currentScreenWidth, isMobileWidth, setScreenWidth };
7463
7489
  });
@@ -7737,7 +7763,7 @@ const unfoldFilters = (filters, price = {}) => {
7737
7763
  const getLabeledFilters = (filters, facets) => {
7738
7764
  return filters.map((f2) => {
7739
7765
  var _a, _b;
7740
- return __spreadProps2(__spreadValues2({}, f2), {
7766
+ return __spreadProps(__spreadValues({}, f2), {
7741
7767
  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)
7742
7768
  });
7743
7769
  });
@@ -7765,7 +7791,7 @@ const recursiveFilterItem = (item, query = "") => {
7765
7791
  }
7766
7792
  const children = recursiveFilter(item.children, query).filter(Boolean);
7767
7793
  const include = children.length > 0 || filterable;
7768
- return include ? __spreadProps2(__spreadValues2({}, item), {
7794
+ return include ? __spreadProps(__spreadValues({}, item), {
7769
7795
  children
7770
7796
  }) : void 0;
7771
7797
  };
@@ -7847,7 +7873,7 @@ const parseFacetKeys = (facetKeys, searchParams) => {
7847
7873
  params.filters = {};
7848
7874
  for (const key of facetKeys) {
7849
7875
  const parsedKey = key.slice(key.indexOf(FACET_KEY_SEPARATOR) + 1);
7850
- params.filters = __spreadProps2(__spreadValues2({}, params.filters), {
7876
+ params.filters = __spreadProps(__spreadValues({}, params.filters), {
7851
7877
  [parsedKey]: parseFacetKey(key, searchParams)
7852
7878
  });
7853
7879
  }
@@ -7860,7 +7886,7 @@ const parseParams = (getQueryParamName, searchParams) => {
7860
7886
  const paramKeys = Array.from(searchParams.keys());
7861
7887
  const facetKeys = paramKeys.filter((k) => isFacetKey(k));
7862
7888
  const regularKeys = paramKeys.filter((k) => !isFacetKey(k));
7863
- const r = __spreadValues2(__spreadValues2({
7889
+ const r = __spreadValues(__spreadValues({
7864
7890
  [QUERY_PARAMS_PARSED.QUERY]: ""
7865
7891
  }, parseRegularKeys(regularKeys, searchParams, getQueryParamName)), parseFacetKeys(facetKeys, searchParams));
7866
7892
  return r;
@@ -7910,7 +7936,7 @@ const encodeParam = (param) => {
7910
7936
  const encoded = encodeURIComponent(param);
7911
7937
  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, " ");
7912
7938
  };
7913
- const getQueryParam = (name) => {
7939
+ const getQueryParam$1 = (name) => {
7914
7940
  try {
7915
7941
  const urlParams = new URLSearchParams(window.location.search);
7916
7942
  return urlParams.get(name);
@@ -8050,7 +8076,7 @@ const CACHE_KEY = "lupasearch-client-redirections";
8050
8076
  const useRedirectionStore = defineStore("redirections", () => {
8051
8077
  const redirections = ref({ rules: [] });
8052
8078
  const redirectionOptions = ref({ enabled: false, queryKey: "" });
8053
- const saveToLocalStorage = () => {
8079
+ const saveToLocalStorage2 = () => {
8054
8080
  try {
8055
8081
  localStorage.setItem(
8056
8082
  CACHE_KEY,
@@ -8059,7 +8085,7 @@ const useRedirectionStore = defineStore("redirections", () => {
8059
8085
  } catch (e2) {
8060
8086
  }
8061
8087
  };
8062
- const tryLoadFromLocalStorage = (config) => {
8088
+ const tryLoadFromLocalStorage2 = (config) => {
8063
8089
  var _a;
8064
8090
  if (!config.cacheSeconds)
8065
8091
  return false;
@@ -8082,7 +8108,7 @@ const useRedirectionStore = defineStore("redirections", () => {
8082
8108
  if (!(config == null ? void 0 : config.enabled)) {
8083
8109
  return;
8084
8110
  }
8085
- const loaded = tryLoadFromLocalStorage(config);
8111
+ const loaded = tryLoadFromLocalStorage2(config);
8086
8112
  if (loaded || ((_c = (_b = redirections.value) == null ? void 0 : _b.rules) == null ? void 0 : _c.length) > 0) {
8087
8113
  return;
8088
8114
  }
@@ -8092,7 +8118,7 @@ const useRedirectionStore = defineStore("redirections", () => {
8092
8118
  return;
8093
8119
  }
8094
8120
  redirections.value = result;
8095
- saveToLocalStorage();
8121
+ saveToLocalStorage2();
8096
8122
  } catch (e2) {
8097
8123
  }
8098
8124
  });
@@ -8218,12 +8244,12 @@ const useParamsStore = defineStore("params", () => {
8218
8244
  return;
8219
8245
  }
8220
8246
  const forceFullReload = (_a = optionsStore.searchBoxOptions.forceFullReloadOnParams) == null ? void 0 : _a.some(
8221
- (p2) => getQueryParam(p2)
8247
+ (p2) => getQueryParam$1(p2)
8222
8248
  );
8223
8249
  if ((!searchResultsLink.value || linksMatch(searchResultsLink.value, window.location.pathname)) && !forceFullReload) {
8224
8250
  const singleFacetParam = facet ? getFacetParam(facet.key, [facet.title]) : void 0;
8225
8251
  const facetParam = singleFacetParam ? [
8226
- __spreadProps2(__spreadValues2({}, singleFacetParam), {
8252
+ __spreadProps(__spreadValues({}, singleFacetParam), {
8227
8253
  value: Array.isArray(singleFacetParam.value) ? singleFacetParam.value[0] : singleFacetParam.value
8228
8254
  })
8229
8255
  ] : [];
@@ -8312,7 +8338,7 @@ const flattenFacet = (key, facets, suggestion, inputValue) => {
8312
8338
  displayHighlight: getHint(suggestion.suggestion, inputValue != null ? inputValue : ""),
8313
8339
  display: suggestion.suggestion,
8314
8340
  suggestion,
8315
- facet: __spreadValues2({
8341
+ facet: __spreadValues({
8316
8342
  key
8317
8343
  }, f2)
8318
8344
  }));
@@ -8419,14 +8445,14 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8419
8445
  const context = getLupaTrackingContext();
8420
8446
  const result = yield LupaSearchSdk.suggestions(
8421
8447
  queryKey,
8422
- __spreadValues2(__spreadValues2({}, publicQuery), context),
8448
+ __spreadValues(__spreadValues({}, publicQuery), context),
8423
8449
  options2
8424
8450
  );
8425
8451
  if (!result.success) {
8426
8452
  return { suggestions: void 0 };
8427
8453
  }
8428
8454
  highlightChange({ action: "clear" });
8429
- suggestionResults.value = __spreadProps2(__spreadValues2({}, suggestionResults.value), {
8455
+ suggestionResults.value = __spreadProps(__spreadValues({}, suggestionResults.value), {
8430
8456
  [queryKey]: flattenSuggestions(result.items, (_a = publicQuery.searchText) != null ? _a : "")
8431
8457
  });
8432
8458
  inputValue.value = publicQuery.searchText;
@@ -8463,12 +8489,12 @@ const useSearchBoxStore = defineStore("searchBox", () => {
8463
8489
  }) {
8464
8490
  try {
8465
8491
  const context = getLupaTrackingContext();
8466
- const result = yield LupaSearchSdk.query(queryKey, __spreadValues2(__spreadValues2({}, publicQuery), context), options2);
8492
+ const result = yield LupaSearchSdk.query(queryKey, __spreadValues(__spreadValues({}, publicQuery), context), options2);
8467
8493
  if (!result.success) {
8468
8494
  return { queryKey, result: { items: [] } };
8469
8495
  }
8470
8496
  highlightChange({ action: "clear" });
8471
- docResults.value = __spreadProps2(__spreadValues2({}, docResults.value), { [queryKey]: result });
8497
+ docResults.value = __spreadProps(__spreadValues({}, docResults.value), { [queryKey]: result });
8472
8498
  emitSearchResultsCallback();
8473
8499
  return { queryKey, result };
8474
8500
  } catch (err) {
@@ -8570,7 +8596,7 @@ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8570
8596
  );
8571
8597
  const inputAttributes = computed(() => {
8572
8598
  var _a;
8573
- return __spreadValues2({}, (_a = props.options.inputAttributes) != null ? _a : {});
8599
+ return __spreadValues({}, (_a = props.options.inputAttributes) != null ? _a : {});
8574
8600
  });
8575
8601
  const ariaLabel = computed(() => {
8576
8602
  var _a;
@@ -9058,7 +9084,7 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
9058
9084
  if (!requestedIds.length) {
9059
9085
  return;
9060
9086
  }
9061
- loadingIds.value = requestedIds.reduce((a, c2) => __spreadProps2(__spreadValues2({}, a), { [c2]: true }), {});
9087
+ loadingIds.value = requestedIds.reduce((a, c2) => __spreadProps(__spreadValues({}, a), { [c2]: true }), {});
9062
9088
  loading.value = true;
9063
9089
  try {
9064
9090
  const dynamicData = dynamicSearchResultData.value || dynamicSearchBoxData.value;
@@ -9068,10 +9094,10 @@ const useDynamicDataStore = defineStore("dynamicData", () => {
9068
9094
  const dynamicDataResult = (_h = yield dynamicData == null ? void 0 : dynamicData.handler(requestedIds)) != null ? _h : [];
9069
9095
  const seed = {};
9070
9096
  const dynamicDataIdMapValue = dynamicDataResult.reduce(
9071
- (a, c2) => __spreadProps2(__spreadValues2({}, a), { [`${c2.id}`]: c2 }),
9097
+ (a, c2) => __spreadProps(__spreadValues({}, a), { [`${c2.id}`]: c2 }),
9072
9098
  seed
9073
9099
  );
9074
- dynamicDataIdMap.value = __spreadValues2(__spreadValues2({}, dynamicDataIdMap.value), dynamicDataIdMapValue);
9100
+ dynamicDataIdMap.value = __spreadValues(__spreadValues({}, dynamicDataIdMap.value), dynamicDataIdMapValue);
9075
9101
  } finally {
9076
9102
  loading.value = false;
9077
9103
  loadingIds.value = {};
@@ -9537,17 +9563,17 @@ const useSearchResultStore = defineStore("searchResult", () => {
9537
9563
  return hasResults.value && ((_a = searchResult.value.offset) != null ? _a : 0) >= totalItems.value;
9538
9564
  }
9539
9565
  );
9540
- const setSidebarState = ({ visible }) => {
9541
- if (visible) {
9566
+ const setSidebarState = ({ visible: visible2 }) => {
9567
+ if (visible2) {
9542
9568
  disableBodyScroll();
9543
9569
  } else {
9544
9570
  enableBodyScroll();
9545
9571
  }
9546
- isMobileSidebarVisible.value = visible;
9572
+ isMobileSidebarVisible.value = visible2;
9547
9573
  };
9548
9574
  const queryFacet = (_0) => __async(void 0, [_0], function* ({ queryKey, facetKey }) {
9549
9575
  var _a, _b, _c, _d;
9550
- const query = { searchText: "", filters: __spreadValues2({}, filters.value) };
9576
+ const query = { searchText: "", filters: __spreadValues({}, filters.value) };
9551
9577
  const options = (_a = optionsStore.envOptions) != null ? _a : { environment: "production" };
9552
9578
  const result = yield LupaSearchSdk.query(queryKey, query, options);
9553
9579
  if (!result.success) {
@@ -9555,8 +9581,8 @@ const useSearchResultStore = defineStore("searchResult", () => {
9555
9581
  }
9556
9582
  const facet = (_b = result.facets) == null ? void 0 : _b.find((f2) => f2.key === facetKey);
9557
9583
  const facetItems = (_c = facet == null ? void 0 : facet.items) != null ? _c : [];
9558
- const updatedResult = __spreadProps2(__spreadValues2({}, searchResult.value), {
9559
- facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps2(__spreadValues2({}, f2), { items: facetItems }) : f2)
9584
+ const updatedResult = __spreadProps(__spreadValues({}, searchResult.value), {
9585
+ facets: (_d = facets.value) == null ? void 0 : _d.map((f2) => f2.key === facetKey ? __spreadProps(__spreadValues({}, f2), { items: facetItems }) : f2)
9560
9586
  });
9561
9587
  searchResult.value = updatedResult;
9562
9588
  });
@@ -9705,7 +9731,7 @@ const __default__$4 = {
9705
9731
  SearchBoxProductAddToCart: _sfc_main$17
9706
9732
  }
9707
9733
  };
9708
- const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
9734
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
9709
9735
  __name: "SearchBoxProductElement",
9710
9736
  props: {
9711
9737
  item: {},
@@ -9747,7 +9773,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
9747
9773
  return props.item;
9748
9774
  }
9749
9775
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
9750
- return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
9776
+ return __spreadValues(__spreadValues({}, props.item), enhancementData);
9751
9777
  });
9752
9778
  const isLoadingDynamicData = (id) => {
9753
9779
  return Boolean(props.element.dynamic && id && loading.value && (loadingIds == null ? void 0 : loadingIds.value[id]));
@@ -9964,7 +9990,7 @@ const __default__$3 = {
9964
9990
  ImageBadge: _sfc_main$11
9965
9991
  }
9966
9992
  };
9967
- const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
9993
+ const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
9968
9994
  __name: "SearchResultsBadgeWrapper",
9969
9995
  props: {
9970
9996
  position: {},
@@ -9987,7 +10013,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
9987
10013
  return props.options.product;
9988
10014
  }
9989
10015
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.options.product) == null ? void 0 : _b.id]) != null ? _d : {};
9990
- return __spreadValues2(__spreadValues2({}, props.options.product), enhancementData);
10016
+ return __spreadValues(__spreadValues({}, props.options.product), enhancementData);
9991
10017
  });
9992
10018
  const badges = computed(() => {
9993
10019
  if (!props.options.elements) {
@@ -9998,7 +10024,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
9998
10024
  return !e2.display || e2.display((_a = props.options.product) != null ? _a : {});
9999
10025
  }).map((x) => {
10000
10026
  var _a;
10001
- return __spreadProps2(__spreadValues2({}, x), {
10027
+ return __spreadProps(__spreadValues({}, x), {
10002
10028
  value: ((_a = enhancedProduct.value) == null ? void 0 : _a[x.key]) || "badge",
10003
10029
  product: enhancedProduct.value
10004
10030
  });
@@ -10065,7 +10091,7 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
10065
10091
  return generateLink((_b = (_a = props.panelOptions.links) == null ? void 0 : _a.details) != null ? _b : "", props.item);
10066
10092
  });
10067
10093
  const badgeOptions = computed(() => {
10068
- return __spreadProps2(__spreadValues2({}, props.panelOptions.badges), { product: props.item });
10094
+ return __spreadProps(__spreadValues({}, props.panelOptions.badges), { product: props.item });
10069
10095
  });
10070
10096
  const imageElements = computed(() => {
10071
10097
  var _a, _b;
@@ -10204,8 +10230,8 @@ const useTrackingStore = defineStore("tracking", () => {
10204
10230
  const mappedItems = ((_e = trackingOptions.analytics) == null ? void 0 : _e.itemMap) ? items.map(trackingOptions.analytics.itemMap) : items;
10205
10231
  track(
10206
10232
  queryKey,
10207
- __spreadProps2(__spreadValues2({}, data), {
10208
- analytics: data.analytics ? __spreadProps2(__spreadValues2({}, data.analytics), { items: mappedItems }) : void 0,
10233
+ __spreadProps(__spreadValues({}, data), {
10234
+ analytics: data.analytics ? __spreadProps(__spreadValues({}, data.analytics), { items: mappedItems }) : void 0,
10209
10235
  filters: searchResultStore.hasAnyFilter ? searchResultStore.filters : void 0
10210
10236
  }),
10211
10237
  options
@@ -10499,7 +10525,7 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
10499
10525
  });
10500
10526
  const getItemsDebounced = debounce$1(getItems, props.debounce);
10501
10527
  const documentPanelOptions = computed(() => {
10502
- return __spreadProps2(__spreadValues2({}, props.panel), {
10528
+ return __spreadProps(__spreadValues({}, props.panel), {
10503
10529
  type: SearchBoxPanelType.DOCUMENT
10504
10530
  });
10505
10531
  });
@@ -10547,7 +10573,7 @@ const __default__$2 = {
10547
10573
  SearchBoxRelatedSourceWrapper: _sfc_main$X
10548
10574
  }
10549
10575
  };
10550
- const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$2), {
10576
+ const _sfc_main$W = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
10551
10577
  __name: "SearchBoxMainPanel",
10552
10578
  props: {
10553
10579
  options: {},
@@ -10859,7 +10885,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
10859
10885
  const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
10860
10886
  const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
10861
10887
  const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
10862
- if (!isOutsideElement) {
10888
+ if (!isOutsideElement || props.options.keepOpen) {
10863
10889
  return;
10864
10890
  }
10865
10891
  opened.value = false;
@@ -10878,7 +10904,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
10878
10904
  case "Tab":
10879
10905
  if ((_b = (_a2 = suggestedValue == null ? void 0 : suggestedValue.value) == null ? void 0 : _a2.item) == null ? void 0 : _b.suggestion) {
10880
10906
  e2.preventDefault();
10881
- selectSuggestion(__spreadProps2(__spreadValues2({}, suggestedValue.value), { override: true }));
10907
+ selectSuggestion(__spreadProps(__spreadValues({}, suggestedValue.value), { override: true }));
10882
10908
  }
10883
10909
  break;
10884
10910
  case "Enter":
@@ -10927,7 +10953,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
10927
10953
  };
10928
10954
  const selectSuggestion = (inputSuggestion, shouldSearch = false) => {
10929
10955
  if (inputSuggestion.item.suggestion) {
10930
- suggestedValue.value = __spreadProps2(__spreadValues2({}, inputSuggestion), {
10956
+ suggestedValue.value = __spreadProps(__spreadValues({}, inputSuggestion), {
10931
10957
  override: true
10932
10958
  });
10933
10959
  if (inputSuggestion.override) {
@@ -11025,7 +11051,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
11025
11051
  opened.value = false;
11026
11052
  };
11027
11053
  const slotProps = (props2) => {
11028
- return __spreadValues2({}, props2);
11054
+ return __spreadValues({}, props2);
11029
11055
  };
11030
11056
  return (_ctx, _cache) => {
11031
11057
  var _a2;
@@ -11113,8 +11139,8 @@ const getOffset = (page, limit = 10) => {
11113
11139
  return (page - 1) * limit;
11114
11140
  };
11115
11141
  const getPublicQuery = (publicQuery, initialFilters, isProductList) => {
11116
- return __spreadProps2(__spreadValues2({}, publicQuery), {
11117
- filters: __spreadValues2(__spreadValues2({}, initialFilters), publicQuery.filters),
11142
+ return __spreadProps(__spreadValues({}, publicQuery), {
11143
+ filters: __spreadValues(__spreadValues({}, initialFilters), publicQuery.filters),
11118
11144
  searchText: isProductList ? "" : publicQuery.searchText
11119
11145
  });
11120
11146
  };
@@ -11665,7 +11691,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
11665
11691
  return searchResultStore.filterVisibleFilterValues(facet.value.key, (_b = (_a = facet.value) == null ? void 0 : _a.items) != null ? _b : []);
11666
11692
  });
11667
11693
  const displayValues = computed(() => {
11668
- return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps2(__spreadValues2({}, v), { title: getDisplayValue(v.title) }));
11694
+ return filteredValues.value.slice(0, itemLimit.value).map((v) => __spreadProps(__spreadValues({}, v), { title: getDisplayValue(v.title) }));
11669
11695
  });
11670
11696
  const filteredValues = computed(() => {
11671
11697
  var _a, _b;
@@ -12606,7 +12632,7 @@ function h(e2, t) {
12606
12632
  return e3 === r[t2];
12607
12633
  });
12608
12634
  }
12609
- var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide", "drag", "update", "change", "set", "end"], props: __spreadProps2(__spreadValues2({}, { value: { validator: function(e2) {
12635
+ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide", "drag", "update", "change", "set", "end"], props: __spreadProps(__spreadValues({}, { value: { validator: function(e2) {
12610
12636
  return (e3) => "number" == typeof e3 || e3 instanceof Array || null == e3 || false === e3;
12611
12637
  }, required: false }, modelValue: { validator: function(e2) {
12612
12638
  return (e3) => "number" == typeof e3 || e3 instanceof Array || null == e3 || false === e3;
@@ -12619,15 +12645,15 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
12619
12645
  throw new Error("Slider v-model must not be an empty array");
12620
12646
  return { value: l2, initialValue: c3 };
12621
12647
  }(a), c2 = function(t, i, n) {
12622
- 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));
12648
+ 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));
12623
12649
  return { classList: computed(() => {
12624
- const e2 = __spreadValues2({}, u2.value);
12650
+ const e2 = __spreadValues({}, u2.value);
12625
12651
  return Object.keys(e2).forEach((t2) => {
12626
12652
  e2[t2] = Array.isArray(e2[t2]) ? e2[t2].filter((e3) => null !== e3).join(" ") : e2[t2];
12627
12653
  }), "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;
12628
12654
  }) };
12629
12655
  }(a), p2 = function(t, i, n) {
12630
- 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);
12656
+ 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);
12631
12657
  return { tooltipFormat: u2, tooltipsFormat: c3, tooltipsMerge: (e2, t2, r) => {
12632
12658
  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();
12633
12659
  a3.forEach(function(e3, t3) {
@@ -12720,7 +12746,7 @@ var m = { name: "Slider", emits: ["input", "update:modelValue", "start", "slide"
12720
12746
  R(V.value);
12721
12747
  } };
12722
12748
  }(a, s, { value: l.value, initialValue: l.initialValue, tooltipFormat: p2.tooltipFormat, tooltipsFormat: p2.tooltipsFormat, tooltipsMerge: p2.tooltipsMerge, classList: c2.classList });
12723
- return __spreadValues2(__spreadValues2(__spreadValues2({}, c2), p2), m2);
12749
+ return __spreadValues(__spreadValues(__spreadValues({}, c2), p2), m2);
12724
12750
  } };
12725
12751
  m.render = function(e2, t, r, i, n, o) {
12726
12752
  return openBlock(), createElementBlock("div", mergeProps(e2.sliderProps, { ref: "slider" }), null, 16);
@@ -13177,7 +13203,7 @@ const __default__$1 = {
13177
13203
  HierarchyFacet: _sfc_main$K
13178
13204
  }
13179
13205
  };
13180
- const _sfc_main$J = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$1), {
13206
+ const _sfc_main$J = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
13181
13207
  __name: "FacetDisplay",
13182
13208
  props: {
13183
13209
  options: {},
@@ -13940,6 +13966,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
13940
13966
  var _a, _b;
13941
13967
  return (_b = (_a = props.labels) == null ? void 0 : _a.pageSize) != null ? _b : "";
13942
13968
  });
13969
+ const sizes = computed(() => props.options.sizes);
13943
13970
  const handleSelect = (e2) => {
13944
13971
  const value = e2.target.value;
13945
13972
  paramsStore.appendParams({
@@ -13959,7 +13986,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
13959
13986
  ref_key: "select",
13960
13987
  ref: select
13961
13988
  }, [
13962
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options.sizes, (option) => {
13989
+ (openBlock(true), createElementBlock(Fragment, null, renderList(sizes.value, (option) => {
13963
13990
  return openBlock(), createElementBlock("option", {
13964
13991
  key: option,
13965
13992
  value: option
@@ -14637,7 +14664,7 @@ const __default__ = {
14637
14664
  SearchResultsProductSingleStarRating: _sfc_main$m
14638
14665
  }
14639
14666
  };
14640
- const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__), {
14667
+ const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
14641
14668
  __name: "SearchResultsProductCardElement",
14642
14669
  props: {
14643
14670
  item: {},
@@ -14682,7 +14709,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
14682
14709
  return props.item;
14683
14710
  }
14684
14711
  const enhancementData = (_d = (_c = dynamicDataIdMap.value) == null ? void 0 : _c[(_b = props.item) == null ? void 0 : _b.id]) != null ? _d : {};
14685
- return __spreadValues2(__spreadValues2({}, props.item), enhancementData);
14712
+ return __spreadValues(__spreadValues({}, props.item), enhancementData);
14686
14713
  });
14687
14714
  const displayElement = computed(() => {
14688
14715
  return props.element.display ? props.element.display(enhancedItem.value) : true;
@@ -14741,7 +14768,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
14741
14768
  return layout.value === ResultsLayoutEnum.LIST && !props.isAdditionalPanel ? "lupa-search-result-product-contents-list" : "";
14742
14769
  });
14743
14770
  const badgesOptions = computed(() => {
14744
- return __spreadProps2(__spreadValues2({}, props.options.badges), { product: props.product });
14771
+ return __spreadProps(__spreadValues({}, props.options.badges), { product: props.product });
14745
14772
  });
14746
14773
  const imageElements = computed(() => {
14747
14774
  var _a, _b;
@@ -15064,7 +15091,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
15064
15091
  };
15065
15092
  const handleQueryChange = () => {
15066
15093
  const context = getLupaTrackingContext();
15067
- const queryBody = __spreadProps2(__spreadValues2({}, context), {
15094
+ const queryBody = __spreadProps(__spreadValues({}, context), {
15068
15095
  limit: props.panel.totalCountLimit,
15069
15096
  searchText: query.value
15070
15097
  });
@@ -15545,7 +15572,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15545
15572
  window.addEventListener("resize", handleResize);
15546
15573
  yield redirectionStore.initiate(props.options.redirections, props.options.options);
15547
15574
  if (props.initialData) {
15548
- searchResultStore.add(__spreadValues2({}, props.initialData));
15575
+ searchResultStore.add(__spreadValues({}, props.initialData));
15549
15576
  }
15550
15577
  handleMounted();
15551
15578
  (_b = (_a = props.options.callbacks) == null ? void 0 : _a.onMounted) == null ? void 0 : _b.call(_a);
@@ -15598,7 +15625,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15598
15625
  });
15599
15626
  const context = getLupaTrackingContext();
15600
15627
  const limit = publicQuery.limit || defaultSearchResultPageSize.value;
15601
- const query2 = __spreadProps2(__spreadValues2(__spreadValues2({}, publicQuery), context), { limit });
15628
+ const query2 = __spreadProps(__spreadValues(__spreadValues({}, publicQuery), context), { limit });
15602
15629
  const redirectionApplied = redirectionStore.redirectOnKeywordIfConfigured(
15603
15630
  publicQuery.searchText,
15604
15631
  optionStore.searchResultsRoutingBehavior
@@ -15613,7 +15640,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15613
15640
  var _a, _b;
15614
15641
  if (res.success) {
15615
15642
  handleResults({ queryKey: props.options.queryKey, results: res });
15616
- searchResultStore.add(__spreadValues2({}, res));
15643
+ searchResultStore.add(__spreadValues({}, res));
15617
15644
  } else if ((_b = (_a = props.options) == null ? void 0 : _a.options) == null ? void 0 : _b.onError) {
15618
15645
  props.options.options.onError(res);
15619
15646
  }
@@ -15682,7 +15709,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15682
15709
  if (typeof window !== "undefined") {
15683
15710
  optionStore.setSearchResultOptions({ options: props.options });
15684
15711
  if (props.initialData) {
15685
- searchResultStore.add(__spreadValues2({}, props.initialData));
15712
+ searchResultStore.add(__spreadValues({}, props.initialData));
15686
15713
  }
15687
15714
  handleMounted();
15688
15715
  return;
@@ -15693,7 +15720,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
15693
15720
  (_b = props.options.ssr) == null ? void 0 : _b.baseUrl
15694
15721
  );
15695
15722
  optionStore.setSearchResultOptions({ options: props.options });
15696
- searchResultStore.add(__spreadValues2({}, initialData));
15723
+ searchResultStore.add(__spreadValues({}, initialData));
15697
15724
  paramStore.add(parseParams(optionStore.getQueryParamName, searchParams), props.options.ssr);
15698
15725
  paramStore.setDefaultLimit(defaultSearchResultPageSize.value);
15699
15726
  handleResults({ queryKey: props.options.queryKey, results: initialData });
@@ -15831,8 +15858,8 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
15831
15858
  const props = __props;
15832
15859
  const searchResults2 = ref(null);
15833
15860
  const componentOptions = computed(() => {
15834
- return __spreadProps2(__spreadValues2({}, props.options), {
15835
- filters: __spreadProps2(__spreadValues2({}, props.options.filters), {
15861
+ return __spreadProps(__spreadValues({}, props.options), {
15862
+ filters: __spreadProps(__spreadValues({}, props.options.filters), {
15836
15863
  categories: props.options.categories
15837
15864
  })
15838
15865
  });
@@ -22108,7 +22135,10 @@ var Slide = defineComponent({
22108
22135
  };
22109
22136
  }
22110
22137
  });
22111
- const _hoisted_1$8 = { class: "lupa-search-product-recommendations-wrapper" };
22138
+ const _hoisted_1$8 = {
22139
+ key: 0,
22140
+ class: "lupa-search-product-recommendations-wrapper"
22141
+ };
22112
22142
  const _hoisted_2$6 = {
22113
22143
  key: 0,
22114
22144
  class: "lupa-recommendation-section-title"
@@ -22159,6 +22189,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
22159
22189
  var _a, _b;
22160
22190
  return (_b = (_a = props.options.recommendationLabels) == null ? void 0 : _a.title) != null ? _b : "";
22161
22191
  });
22192
+ const hasRecommendations = computed(() => {
22193
+ return recommendations2.value.length > 0;
22194
+ });
22162
22195
  onMounted(() => {
22163
22196
  loadRecommendations();
22164
22197
  window.addEventListener("resize", handleResize);
@@ -22233,7 +22266,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
22233
22266
  });
22234
22267
  __expose({ fetch: fetch2 });
22235
22268
  return (_ctx, _cache) => {
22236
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
22269
+ return hasRecommendations.value ? (openBlock(), createElementBlock("div", _hoisted_1$8, [
22237
22270
  title.value ? (openBlock(), createElementBlock("h2", _hoisted_2$6, toDisplayString(title.value), 1)) : createCommentVNode("", true),
22238
22271
  !loading.value ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
22239
22272
  layoutType.value === "carousel" ? (openBlock(), createBlock(unref(Carousel), mergeProps({ key: 0 }, carouselOptions.value, { "wrap-around": true }), {
@@ -22269,7 +22302,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
22269
22302
  }), 128))
22270
22303
  ]))
22271
22304
  ])) : createCommentVNode("", true)
22272
- ]);
22305
+ ])) : createCommentVNode("", true);
22273
22306
  };
22274
22307
  }
22275
22308
  });
@@ -22353,11 +22386,11 @@ const Env = {
22353
22386
  production: "https://api.lupasearch.com/v1/",
22354
22387
  staging: "https://api.staging.lupasearch.com/v1/"
22355
22388
  };
22356
- const defaultConfig = {
22389
+ const DEFAULT_REQUEST_CONFIG = {
22357
22390
  method: "POST",
22358
22391
  headers: { "Content-Type": "application/json" }
22359
22392
  };
22360
- const headers = defaultConfig.headers;
22393
+ const DEFAULT_HEADERS = DEFAULT_REQUEST_CONFIG.headers;
22361
22394
  const getApiUrl = (environment, customBaseUrl) => {
22362
22395
  if (customBaseUrl) {
22363
22396
  return customBaseUrl;
@@ -22369,13 +22402,13 @@ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(voi
22369
22402
  const { environment, customBaseUrl } = options;
22370
22403
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22371
22404
  try {
22372
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22405
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22373
22406
  body: JSON.stringify(request),
22374
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22407
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22375
22408
  }));
22376
22409
  if (res.status < 400) {
22377
22410
  const data = yield res.json();
22378
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22411
+ return __spreadProps(__spreadValues({}, data), { success: true });
22379
22412
  }
22380
22413
  const errors = yield res.json();
22381
22414
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22392,14 +22425,14 @@ const suggestPhraseAlternatives = (options, request, chatSettings) => __async(vo
22392
22425
  try {
22393
22426
  const res = yield fetch(
22394
22427
  `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
22395
- __spreadProps2(__spreadValues2({}, defaultConfig), {
22428
+ __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22396
22429
  body: JSON.stringify(request),
22397
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22430
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22398
22431
  })
22399
22432
  );
22400
22433
  if (res.status < 400) {
22401
22434
  const data = yield res.json();
22402
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22435
+ return __spreadProps(__spreadValues({}, data), { success: true });
22403
22436
  }
22404
22437
  const errors = yield res.json();
22405
22438
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22414,13 +22447,13 @@ const suggestBestProductMatches = (options, request, chatSettings) => __async(vo
22414
22447
  const { environment, customBaseUrl } = options;
22415
22448
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22416
22449
  try {
22417
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22450
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22418
22451
  body: JSON.stringify(request),
22419
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22452
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22420
22453
  }));
22421
22454
  if (res.status < 400) {
22422
22455
  const data = yield res.json();
22423
- return __spreadProps2(__spreadValues2({}, data), { success: true });
22456
+ return __spreadProps(__spreadValues({}, data), { success: true });
22424
22457
  }
22425
22458
  const errors = yield res.json();
22426
22459
  (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
@@ -22454,9 +22487,9 @@ const prepareChatHistory = (chatLog) => {
22454
22487
  const getTextResponseChunkStream = (options, request, onChunkReceived, chatSettings) => {
22455
22488
  var _a;
22456
22489
  const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
22457
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
22490
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22458
22491
  body: JSON.stringify(request),
22459
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
22492
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22460
22493
  })).then((response) => {
22461
22494
  const reader = response.body.getReader();
22462
22495
  return reader.read().then(function processStream({ done, value }) {
@@ -22848,7 +22881,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
22848
22881
  }
22849
22882
  const validPhrases = phrases.filter((p2) => (p2 == null ? void 0 : p2.trim().length) > 0);
22850
22883
  chatContent.value = chatContent.value.map(
22851
- (c2) => c2.key === key ? __spreadProps2(__spreadValues2({}, c2), {
22884
+ (c2) => c2.key === key ? __spreadProps(__spreadValues({}, c2), {
22852
22885
  allPhrases: [...validPhrases],
22853
22886
  suggestedPhrases: phrases
22854
22887
  }) : c2
@@ -22885,6 +22918,29 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
22885
22918
  };
22886
22919
  }
22887
22920
  });
22921
+ const fetchPluginConfiguration = (options, configurationKey) => __async(void 0, null, function* () {
22922
+ var _a, _b, _c;
22923
+ const { environment, customBaseUrl } = options;
22924
+ try {
22925
+ const res = yield fetch(
22926
+ `${getApiUrl(environment, customBaseUrl)}plugin/configurations/${configurationKey}`,
22927
+ __spreadProps(__spreadValues({}, DEFAULT_REQUEST_CONFIG), {
22928
+ method: "GET",
22929
+ headers: __spreadValues(__spreadValues({}, DEFAULT_HEADERS), (_a = options.customHeaders) != null ? _a : {})
22930
+ })
22931
+ );
22932
+ if (res.status < 400) {
22933
+ const data = yield res.json();
22934
+ return __spreadValues({}, data);
22935
+ }
22936
+ const errors = yield res.json();
22937
+ (_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
22938
+ return null;
22939
+ } catch (e2) {
22940
+ (_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e2);
22941
+ return null;
22942
+ }
22943
+ });
22888
22944
  let piniaInstance = null;
22889
22945
  const initPinia = () => {
22890
22946
  if (piniaInstance) {
@@ -22900,154 +22956,499 @@ const setupTracking = (options) => {
22900
22956
  initTracking(options);
22901
22957
  store.setTrackingOptions({ options });
22902
22958
  };
22903
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
22904
- var lodash = { exports: {} };
22905
- /**
22906
- * @license
22907
- * Lodash <https://lodash.com/>
22908
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
22909
- * Released under MIT license <https://lodash.com/license>
22910
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
22911
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
22912
- */
22913
- lodash.exports;
22914
- (function(module, exports) {
22915
- (function() {
22916
- var undefined$1;
22917
- var VERSION = "4.17.21";
22918
- var LARGE_ARRAY_SIZE = 200;
22919
- 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`";
22920
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
22921
- var MAX_MEMOIZE_SIZE = 500;
22922
- var PLACEHOLDER = "__lodash_placeholder__";
22923
- var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
22924
- var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
22925
- 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;
22926
- var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
22927
- var HOT_COUNT = 800, HOT_SPAN = 16;
22928
- var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
22929
- var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
22930
- var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
22931
- var wrapFlags = [
22932
- ["ary", WRAP_ARY_FLAG],
22933
- ["bind", WRAP_BIND_FLAG],
22934
- ["bindKey", WRAP_BIND_KEY_FLAG],
22935
- ["curry", WRAP_CURRY_FLAG],
22936
- ["curryRight", WRAP_CURRY_RIGHT_FLAG],
22937
- ["flip", WRAP_FLIP_FLAG],
22938
- ["partial", WRAP_PARTIAL_FLAG],
22939
- ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
22940
- ["rearg", WRAP_REARG_FLAG]
22941
- ];
22942
- 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]";
22943
- 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]";
22944
- var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
22945
- var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
22946
- var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
22947
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
22948
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
22949
- var reTrimStart = /^\s+/;
22950
- var reWhitespace = /\s/;
22951
- var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
22952
- var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
22953
- var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
22954
- var reEscapeChar = /\\(\\)?/g;
22955
- var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
22956
- var reFlags = /\w*$/;
22957
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
22958
- var reIsBinary = /^0b[01]+$/i;
22959
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
22960
- var reIsOctal = /^0o[0-7]+$/i;
22961
- var reIsUint = /^(?:0|[1-9]\d*)$/;
22962
- var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
22963
- var reNoMatch = /($^)/;
22964
- var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
22965
- 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;
22966
- 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";
22967
- 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("|") + ")";
22968
- var reApos = RegExp(rsApos, "g");
22969
- var reComboMark = RegExp(rsCombo, "g");
22970
- var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
22971
- var reUnicodeWord = RegExp([
22972
- rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
22973
- rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
22974
- rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
22975
- rsUpper + "+" + rsOptContrUpper,
22976
- rsOrdUpper,
22977
- rsOrdLower,
22978
- rsDigits,
22979
- rsEmoji
22980
- ].join("|"), "g");
22981
- var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
22982
- 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 ]/;
22983
- var contextProps = [
22984
- "Array",
22985
- "Buffer",
22986
- "DataView",
22987
- "Date",
22988
- "Error",
22989
- "Float32Array",
22990
- "Float64Array",
22991
- "Function",
22992
- "Int8Array",
22993
- "Int16Array",
22994
- "Int32Array",
22995
- "Map",
22996
- "Math",
22997
- "Object",
22998
- "Promise",
22999
- "RegExp",
23000
- "Set",
23001
- "String",
23002
- "Symbol",
23003
- "TypeError",
23004
- "Uint8Array",
23005
- "Uint8ClampedArray",
23006
- "Uint16Array",
23007
- "Uint32Array",
23008
- "WeakMap",
23009
- "_",
23010
- "clearTimeout",
23011
- "isFinite",
23012
- "parseInt",
23013
- "setTimeout"
23014
- ];
23015
- var templateCounter = -1;
23016
- var typedArrayTags = {};
23017
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
23018
- 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;
23019
- var cloneableTags = {};
23020
- 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;
23021
- cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
23022
- var deburredLetters = {
23023
- // Latin-1 Supplement block.
23024
- "À": "A",
23025
- "Á": "A",
23026
- "Â": "A",
23027
- "Ã": "A",
23028
- "Ä": "A",
23029
- "Å": "A",
23030
- "à": "a",
23031
- "á": "a",
23032
- "â": "a",
23033
- "ã": "a",
23034
- "ä": "a",
23035
- "å": "a",
23036
- "Ç": "C",
23037
- "ç": "c",
23038
- "Ð": "D",
23039
- "ð": "d",
23040
- "È": "E",
23041
- "É": "E",
23042
- "Ê": "E",
23043
- "Ë": "E",
23044
- "è": "e",
23045
- "é": "e",
23046
- "ê": "e",
23047
- "ë": "e",
23048
- "Ì": "I",
23049
- "Í": "I",
23050
- "Î": "I",
22959
+ const displayDiscountedPriceSection = (doc2, options) => {
22960
+ var _a, _b;
22961
+ const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
22962
+ const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
22963
+ return discountPrice && regularPrice && discountPrice < regularPrice;
22964
+ };
22965
+ const displayRegularPriceSection = (doc2, options) => {
22966
+ var _a, _b;
22967
+ const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
22968
+ const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
22969
+ const anyPrice = discountPrice || regularPrice;
22970
+ return anyPrice && !displayDiscountedPriceSection(doc2, options);
22971
+ };
22972
+ const escapeHtml = (source) => {
22973
+ if (!source) {
22974
+ return source;
22975
+ }
22976
+ return `${source}`.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
22977
+ };
22978
+ const toMaxDecimalPlaces = (value, maxDecimal = 2) => {
22979
+ if (!value) {
22980
+ return 0;
22981
+ }
22982
+ try {
22983
+ return +parseFloat(`${value}`).toFixed(maxDecimal);
22984
+ } catch (e2) {
22985
+ return `${value}`;
22986
+ }
22987
+ };
22988
+ const capitalize = (value) => {
22989
+ if (!value) {
22990
+ return "";
22991
+ }
22992
+ return value.charAt(0).toLocaleUpperCase() + value.slice(1);
22993
+ };
22994
+ const getAlphanumeric = (value) => {
22995
+ if (!value) {
22996
+ return "";
22997
+ }
22998
+ return value.replace(/[\W_]/g, " ");
22999
+ };
23000
+ const getAdditionalElements = (fields) => {
23001
+ return fields.map((key) => ({
23002
+ type: "custom",
23003
+ key,
23004
+ label: capitalize(getAlphanumeric(key)),
23005
+ className: "lupa-custom",
23006
+ display: (doc2) => Boolean(doc2[key])
23007
+ }));
23008
+ };
23009
+ const addFieldIfKeyExists = (field, key, config) => {
23010
+ if (key) {
23011
+ return config;
23012
+ }
23013
+ return { key: field, type: "customHtml", display: () => false };
23014
+ };
23015
+ const getSearchBoxComponent = ({
23016
+ searchBoxOptions,
23017
+ labels,
23018
+ panelOptions,
23019
+ redirections,
23020
+ placeholderImage
23021
+ }) => {
23022
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
23023
+ const panels = [
23024
+ ...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
23025
+ {
23026
+ type: SearchBoxPanelType.SUGGESTION,
23027
+ queryKey: searchBoxOptions.suggestionQueryKey,
23028
+ highlight: true,
23029
+ limit: 8,
23030
+ labels: {
23031
+ topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
23032
+ }
23033
+ }
23034
+ ] : [],
23035
+ ...(panelOptions == null ? void 0 : panelOptions.docPanel) ? [
23036
+ {
23037
+ type: SearchBoxPanelType.DOCUMENT,
23038
+ queryKey: searchBoxOptions.documentQueryKey,
23039
+ limit: 5,
23040
+ elements: [
23041
+ {
23042
+ type: "image",
23043
+ placeholder: placeholderImage,
23044
+ key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
23045
+ baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
23046
+ },
23047
+ {
23048
+ type: "title",
23049
+ key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
23050
+ maxLines: 2
23051
+ },
23052
+ {
23053
+ type: "regularPrice",
23054
+ key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
23055
+ display: (doc2) => {
23056
+ var _a2, _b2, _c2, _d2;
23057
+ 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]);
23058
+ }
23059
+ },
23060
+ {
23061
+ type: "price",
23062
+ key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
23063
+ }
23064
+ ]
23065
+ }
23066
+ ] : []
23067
+ ];
23068
+ return {
23069
+ inputSelector: searchBoxOptions.inputSelector,
23070
+ options: {
23071
+ environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
23072
+ customUrl: searchBoxOptions.customUrl,
23073
+ customBaseUrl: searchBoxOptions.customBaseUrl,
23074
+ customPayload: searchBoxOptions.customPayload,
23075
+ customHeaders: searchBoxOptions.customHeaders
23076
+ },
23077
+ showTotalCount: true,
23078
+ expandOnSinglePanel: true,
23079
+ minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
23080
+ debounce: 250,
23081
+ labels: labels == null ? void 0 : labels.searchBox,
23082
+ links: {
23083
+ searchResults: ""
23084
+ },
23085
+ panels,
23086
+ redirections,
23087
+ history: {
23088
+ labels: {
23089
+ clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
23090
+ }
23091
+ }
23092
+ };
23093
+ };
23094
+ const getSearchResultsComponent = ({
23095
+ searchResultOptions,
23096
+ labels,
23097
+ redirections,
23098
+ placeholderImage,
23099
+ configuratorOverrides,
23100
+ callbacks,
23101
+ additionalFields
23102
+ }) => {
23103
+ 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;
23104
+ const filters = searchResultOptions.showFacets ? {
23105
+ currentFilters: {
23106
+ visibility: {
23107
+ mobileSidebar: true,
23108
+ mobileToolbar: true
23109
+ },
23110
+ labels: {
23111
+ title: "",
23112
+ clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
23113
+ }
23114
+ },
23115
+ facets: {
23116
+ labels: {
23117
+ title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
23118
+ showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
23119
+ facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
23120
+ facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
23121
+ },
23122
+ filterable: {
23123
+ minValues: 5
23124
+ },
23125
+ hierarchy: {
23126
+ maxInitialLevel: 2,
23127
+ topLevelValueCountLimit: 5,
23128
+ filterable: true
23129
+ },
23130
+ stats: {
23131
+ slider: true,
23132
+ inputs: true,
23133
+ labels: {
23134
+ from: "",
23135
+ to: ""
23136
+ }
23137
+ },
23138
+ facetValueCountLimit: 8,
23139
+ showDocumentCount: true,
23140
+ style: {
23141
+ type: "sidebar"
23142
+ }
23143
+ }
23144
+ } : {};
23145
+ const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
23146
+ xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
23147
+ l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
23148
+ md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
23149
+ sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
23150
+ xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
23151
+ };
23152
+ const badges = {
23153
+ badges: {
23154
+ anchor: "tr",
23155
+ elements: [
23156
+ ...searchResultOptions.showRelevance ? [
23157
+ {
23158
+ key: "",
23159
+ type: "customHtml",
23160
+ className: "relevance",
23161
+ html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
23162
+ display: (doc2) => Boolean(doc2._relevance !== void 0)
23163
+ }
23164
+ ] : [],
23165
+ ...((_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) ? [
23166
+ {
23167
+ key: "",
23168
+ type: "customHtml",
23169
+ className: "boosted-marker",
23170
+ html: () => {
23171
+ var _a2;
23172
+ return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
23173
+ },
23174
+ display: (doc2) => doc2._boosted === true
23175
+ }
23176
+ ] : []
23177
+ ]
23178
+ }
23179
+ };
23180
+ return __spreadValues2(__spreadProps2(__spreadValues2({
23181
+ options: {
23182
+ environment: (_m = searchResultOptions.environment) != null ? _m : "production",
23183
+ customUrl: searchResultOptions.customUrl,
23184
+ customBaseUrl: searchResultOptions.customBaseUrl,
23185
+ customPayload: searchResultOptions.customPayload,
23186
+ customHeaders: searchResultOptions.customHeaders,
23187
+ onError: searchResultOptions.errorHandler
23188
+ },
23189
+ queryKey: searchResultOptions.queryKey,
23190
+ containerSelector: searchResultOptions.containerSelector,
23191
+ searchTitlePosition: "search-results-top",
23192
+ titleKey: (_n = searchResultOptions.fields) == null ? void 0 : _n.titleKey,
23193
+ labels: labels == null ? void 0 : labels.searchResults,
23194
+ grid: {
23195
+ columns
23196
+ },
23197
+ pagination: {
23198
+ sizeSelection: {
23199
+ position: {
23200
+ top: true,
23201
+ bottom: false
23202
+ },
23203
+ sizes: [12, 24, 36, 48]
23204
+ },
23205
+ pageSelection: {
23206
+ position: {
23207
+ top: false,
23208
+ bottom: true
23209
+ },
23210
+ displayMobile: 3,
23211
+ display: 5
23212
+ }
23213
+ },
23214
+ filters,
23215
+ toolbar: {
23216
+ layoutSelector: false,
23217
+ itemSummary: true,
23218
+ clearFilters: false
23219
+ },
23220
+ isInStock: () => {
23221
+ return true;
23222
+ }
23223
+ }, badges), {
23224
+ links: {
23225
+ details: ((_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl) ? `{${(_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl}}` : void 0
23226
+ },
23227
+ callbacks,
23228
+ routingBehavior: callbacks ? "event" : "direct-link",
23229
+ idKey: "id",
23230
+ elements: [
23231
+ {
23232
+ type: "image",
23233
+ placeholder: placeholderImage,
23234
+ key: (_q = searchResultOptions.fields) == null ? void 0 : _q.imageKey,
23235
+ baseUrl: (_r = searchResultOptions.fields) == null ? void 0 : _r.baseImageUrl,
23236
+ display: () => {
23237
+ var _a2;
23238
+ return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
23239
+ }
23240
+ },
23241
+ addFieldIfKeyExists("_emphasis", (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField, {
23242
+ type: "custom",
23243
+ className: "lupa-custom-emphasis",
23244
+ key: (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField,
23245
+ display: () => true
23246
+ }),
23247
+ {
23248
+ type: "title",
23249
+ key: (_u = searchResultOptions.fields) == null ? void 0 : _u.titleKey,
23250
+ maxLines: (_v = searchResultOptions.maxLines) != null ? _v : 2,
23251
+ display: (doc2) => {
23252
+ var _a2, _b2;
23253
+ return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
23254
+ }
23255
+ },
23256
+ ...getAdditionalElements(additionalFields),
23257
+ addFieldIfKeyExists("_discountPrice", (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey, {
23258
+ key: (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey,
23259
+ type: "customHtml",
23260
+ className: "lupa-price lupa-price-discounted",
23261
+ display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
23262
+ html: (doc2) => {
23263
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
23264
+ const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
23265
+ const discountPrice = (_d2 = parseFloat(
23266
+ doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
23267
+ )) == null ? void 0 : _d2.toFixed(2);
23268
+ const regularPrice = (_g2 = parseFloat(
23269
+ doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
23270
+ )) == null ? void 0 : _g2.toFixed(2);
23271
+ const discount = `<span class="lupa-discount">${escapeHtml(
23272
+ discountPrice
23273
+ )} ${currency}</span>`;
23274
+ const regular = `<span class="lupa-regular">${escapeHtml(
23275
+ regularPrice
23276
+ )} ${currency}</span>`;
23277
+ return discount + regular;
23278
+ }
23279
+ }),
23280
+ addFieldIfKeyExists("_regularPrice", (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey, {
23281
+ key: (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey,
23282
+ type: "customHtml",
23283
+ className: "lupa-price lupa-price-single",
23284
+ display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
23285
+ html: (doc2) => {
23286
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
23287
+ const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
23288
+ const price = (_g2 = parseFloat(
23289
+ (_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 : ""]
23290
+ )) == null ? void 0 : _g2.toFixed(2);
23291
+ return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
23292
+ }
23293
+ })
23294
+ ],
23295
+ breadcrumbs: [],
23296
+ sort: [],
23297
+ redirections
23298
+ }), configuratorOverrides);
23299
+ };
23300
+ const SearchContainerConfigurationService = {
23301
+ getSearchBoxComponent,
23302
+ getSearchResultsComponent
23303
+ };
23304
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
23305
+ var lodash = { exports: {} };
23306
+ /**
23307
+ * @license
23308
+ * Lodash <https://lodash.com/>
23309
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
23310
+ * Released under MIT license <https://lodash.com/license>
23311
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
23312
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
23313
+ */
23314
+ lodash.exports;
23315
+ (function(module, exports) {
23316
+ (function() {
23317
+ var undefined$1;
23318
+ var VERSION = "4.17.21";
23319
+ var LARGE_ARRAY_SIZE = 200;
23320
+ 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`";
23321
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
23322
+ var MAX_MEMOIZE_SIZE = 500;
23323
+ var PLACEHOLDER = "__lodash_placeholder__";
23324
+ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
23325
+ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
23326
+ 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;
23327
+ var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
23328
+ var HOT_COUNT = 800, HOT_SPAN = 16;
23329
+ var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
23330
+ var INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = 0 / 0;
23331
+ var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
23332
+ var wrapFlags = [
23333
+ ["ary", WRAP_ARY_FLAG],
23334
+ ["bind", WRAP_BIND_FLAG],
23335
+ ["bindKey", WRAP_BIND_KEY_FLAG],
23336
+ ["curry", WRAP_CURRY_FLAG],
23337
+ ["curryRight", WRAP_CURRY_RIGHT_FLAG],
23338
+ ["flip", WRAP_FLIP_FLAG],
23339
+ ["partial", WRAP_PARTIAL_FLAG],
23340
+ ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
23341
+ ["rearg", WRAP_REARG_FLAG]
23342
+ ];
23343
+ 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]";
23344
+ 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]";
23345
+ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
23346
+ var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
23347
+ var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
23348
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
23349
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
23350
+ var reTrimStart = /^\s+/;
23351
+ var reWhitespace = /\s/;
23352
+ var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
23353
+ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
23354
+ var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
23355
+ var reEscapeChar = /\\(\\)?/g;
23356
+ var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
23357
+ var reFlags = /\w*$/;
23358
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
23359
+ var reIsBinary = /^0b[01]+$/i;
23360
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
23361
+ var reIsOctal = /^0o[0-7]+$/i;
23362
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
23363
+ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
23364
+ var reNoMatch = /($^)/;
23365
+ var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
23366
+ 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;
23367
+ 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";
23368
+ 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("|") + ")";
23369
+ var reApos = RegExp(rsApos, "g");
23370
+ var reComboMark = RegExp(rsCombo, "g");
23371
+ var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
23372
+ var reUnicodeWord = RegExp([
23373
+ rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
23374
+ rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
23375
+ rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
23376
+ rsUpper + "+" + rsOptContrUpper,
23377
+ rsOrdUpper,
23378
+ rsOrdLower,
23379
+ rsDigits,
23380
+ rsEmoji
23381
+ ].join("|"), "g");
23382
+ var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
23383
+ 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 ]/;
23384
+ var contextProps = [
23385
+ "Array",
23386
+ "Buffer",
23387
+ "DataView",
23388
+ "Date",
23389
+ "Error",
23390
+ "Float32Array",
23391
+ "Float64Array",
23392
+ "Function",
23393
+ "Int8Array",
23394
+ "Int16Array",
23395
+ "Int32Array",
23396
+ "Map",
23397
+ "Math",
23398
+ "Object",
23399
+ "Promise",
23400
+ "RegExp",
23401
+ "Set",
23402
+ "String",
23403
+ "Symbol",
23404
+ "TypeError",
23405
+ "Uint8Array",
23406
+ "Uint8ClampedArray",
23407
+ "Uint16Array",
23408
+ "Uint32Array",
23409
+ "WeakMap",
23410
+ "_",
23411
+ "clearTimeout",
23412
+ "isFinite",
23413
+ "parseInt",
23414
+ "setTimeout"
23415
+ ];
23416
+ var templateCounter = -1;
23417
+ var typedArrayTags = {};
23418
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
23419
+ 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;
23420
+ var cloneableTags = {};
23421
+ 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;
23422
+ cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
23423
+ var deburredLetters = {
23424
+ // Latin-1 Supplement block.
23425
+ "À": "A",
23426
+ "Á": "A",
23427
+ "Â": "A",
23428
+ "Ã": "A",
23429
+ "Ä": "A",
23430
+ "Å": "A",
23431
+ "à": "a",
23432
+ "á": "a",
23433
+ "â": "a",
23434
+ "ã": "a",
23435
+ "ä": "a",
23436
+ "å": "a",
23437
+ "Ç": "C",
23438
+ "ç": "c",
23439
+ "Ð": "D",
23440
+ "ð": "d",
23441
+ "È": "E",
23442
+ "É": "E",
23443
+ "Ê": "E",
23444
+ "Ë": "E",
23445
+ "è": "e",
23446
+ "é": "e",
23447
+ "ê": "e",
23448
+ "ë": "e",
23449
+ "Ì": "I",
23450
+ "Í": "I",
23451
+ "Î": "I",
23051
23452
  "Ï": "I",
23052
23453
  "ì": "i",
23053
23454
  "í": "i",
@@ -28378,546 +28779,150 @@ lodash.exports;
28378
28779
  (freeModule.exports = _)._ = _;
28379
28780
  freeExports._ = _;
28380
28781
  } else {
28381
- root._ = _;
28382
- }
28383
- }).call(commonjsGlobal);
28384
- })(lodash, lodash.exports);
28385
- var lodashExports = lodash.exports;
28386
- const DEFAULT_SEARCH_BOX_OPTIONS = {
28387
- inputSelector: "#searchBox",
28388
- options: {
28389
- environment: "production"
28390
- },
28391
- showTotalCount: false,
28392
- minInputLength: 1,
28393
- inputAttributes: {
28394
- name: "q"
28395
- },
28396
- debounce: 0,
28397
- labels: {
28398
- placeholder: "Search for products...",
28399
- noResults: "There are no results found.",
28400
- moreResults: "Show more results",
28401
- currency: "€",
28402
- defaultFacetLabel: "Category:"
28403
- },
28404
- links: {
28405
- searchResults: "/search"
28406
- },
28407
- panels: [
28408
- {
28409
- type: "suggestion",
28410
- queryKey: "",
28411
- highlight: true,
28412
- limit: 5
28413
- },
28414
- {
28415
- type: "document",
28416
- queryKey: "",
28417
- limit: 5,
28418
- searchBySuggestion: false,
28419
- links: {
28420
- details: "{url}"
28421
- },
28422
- titleKey: "name",
28423
- elements: []
28424
- }
28425
- ],
28426
- history: {
28427
- labels: {
28428
- clear: "Clear History"
28429
- }
28430
- }
28431
- };
28432
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
28433
- __name: "SearchBoxEntry",
28434
- props: {
28435
- searchBoxOptions: {}
28436
- },
28437
- setup(__props, { expose: __expose }) {
28438
- const props = __props;
28439
- const searchBox2 = ref(null);
28440
- const fullSearchBoxOptions = computed(() => {
28441
- const options = lodashExports.cloneDeep(props.searchBoxOptions);
28442
- return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS), options);
28443
- });
28444
- const fetch2 = () => {
28445
- var _a;
28446
- (_a = searchBox2.value) == null ? void 0 : _a.handleCurrentValueSearch();
28447
- };
28448
- __expose({ fetch: fetch2 });
28449
- return (_ctx, _cache) => {
28450
- return openBlock(), createBlock(unref(_sfc_main$V), {
28451
- options: fullSearchBoxOptions.value,
28452
- ref_key: "searchBox",
28453
- ref: searchBox2
28454
- }, null, 8, ["options"]);
28455
- };
28456
- }
28457
- });
28458
- const DEFAULT_OPTIONS_RESULTS = {
28782
+ root._ = _;
28783
+ }
28784
+ }).call(commonjsGlobal);
28785
+ })(lodash, lodash.exports);
28786
+ var lodashExports = lodash.exports;
28787
+ const DEFAULT_SEARCH_BOX_OPTIONS = {
28788
+ inputSelector: "#searchBox",
28459
28789
  options: {
28460
28790
  environment: "production"
28461
28791
  },
28462
- queryKey: "",
28463
- containerSelector: "#searchResultsContainer",
28464
- searchTitlePosition: "page-top",
28792
+ showTotalCount: false,
28793
+ minInputLength: 1,
28794
+ inputAttributes: {
28795
+ name: "q"
28796
+ },
28797
+ debounce: 0,
28465
28798
  labels: {
28466
- pageSize: "Page size:",
28467
- sortBy: "Sort by:",
28468
- itemCount: "Items {1} of {2}",
28469
- filteredItemCount: "",
28799
+ placeholder: "Search for products...",
28800
+ noResults: "There are no results found.",
28801
+ moreResults: "Show more results",
28470
28802
  currency: "€",
28471
- showMore: "Show more",
28472
- searchResults: "Search Query: ",
28473
- emptyResults: "There are no results for the query:",
28474
- mobileFilterButton: "Filter",
28475
- htmlTitleTemplate: "Search Query: '{1}'",
28476
- noResultsSuggestion: "No results found for this query: {1}",
28477
- didYouMean: "Did you mean to search: {1}",
28478
- similarQuery: "Search results for phrase {1}",
28479
- similarQueries: "Similar queries:"
28480
- },
28481
- grid: {
28482
- columns: {
28483
- xl: 4,
28484
- l: 3,
28485
- md: 2,
28486
- sm: 2,
28487
- xs: 1
28488
- }
28803
+ defaultFacetLabel: "Category:"
28489
28804
  },
28490
- pagination: {
28491
- sizeSelection: {
28492
- position: {
28493
- top: false,
28494
- bottom: true
28495
- },
28496
- sizes: [12, 24, 36]
28497
- },
28498
- pageSelection: {
28499
- position: {
28500
- top: false,
28501
- bottom: true
28502
- },
28503
- display: 5,
28504
- displayMobile: 3
28505
- }
28805
+ links: {
28806
+ searchResults: "/search"
28506
28807
  },
28507
- sort: [],
28508
- filters: {
28509
- currentFilters: {
28510
- visibility: {
28511
- mobileSidebar: true,
28512
- mobileToolbar: true
28513
- },
28514
- labels: {
28515
- title: "Current filters:",
28516
- clearAll: "Clear all"
28517
- }
28808
+ panels: [
28809
+ {
28810
+ type: "suggestion",
28811
+ queryKey: "",
28812
+ highlight: true,
28813
+ limit: 5
28518
28814
  },
28519
- facets: {
28520
- labels: {
28521
- title: "Filters:",
28522
- showAll: "Show more",
28523
- facetFilter: "Filter...",
28524
- facetClear: "Clear"
28525
- },
28526
- filterable: {
28527
- minValues: 5
28528
- },
28529
- hierarchy: {
28530
- maxInitialLevel: 2,
28531
- topLevelValueCountLimit: 5,
28532
- filterable: true
28815
+ {
28816
+ type: "document",
28817
+ queryKey: "",
28818
+ limit: 5,
28819
+ searchBySuggestion: false,
28820
+ links: {
28821
+ details: "{url}"
28533
28822
  },
28534
- facetValueCountLimit: 20,
28535
- showDocumentCount: true,
28536
- style: {
28537
- type: "sidebar"
28538
- }
28539
- }
28540
- },
28541
- toolbar: {
28542
- layoutSelector: true,
28543
- itemSummary: true,
28544
- clearFilters: false
28545
- },
28546
- isInStock: () => {
28547
- return true;
28548
- },
28549
- badges: {
28550
- anchor: "tr",
28551
- elements: []
28552
- },
28553
- links: {
28554
- details: "/{id}"
28555
- },
28556
- elements: [],
28557
- breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
28558
- };
28559
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
28560
- __name: "SearchResultsEntry",
28561
- props: {
28562
- searchResultsOptions: {}
28563
- },
28564
- setup(__props, { expose: __expose }) {
28565
- const props = __props;
28566
- const searchResults2 = ref(null);
28567
- const fullSearchResultsOptions = computed(() => {
28568
- const options = lodashExports.cloneDeep(props.searchResultsOptions);
28569
- return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS), options);
28570
- });
28571
- const fetch2 = () => {
28572
- var _a;
28573
- (_a = searchResults2.value) == null ? void 0 : _a.handleUrlChange();
28574
- };
28575
- __expose({ fetch: fetch2 });
28576
- return (_ctx, _cache) => {
28577
- return openBlock(), createBlock(unref(_sfc_main$c), {
28578
- options: fullSearchResultsOptions.value,
28579
- ref_key: "searchResults",
28580
- ref: searchResults2
28581
- }, null, 8, ["options"]);
28582
- };
28583
- }
28584
- });
28585
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
28586
- __name: "ProductListEntry",
28587
- props: {
28588
- productListOptions: {}
28589
- },
28590
- setup(__props, { expose: __expose }) {
28591
- const props = __props;
28592
- const productList2 = ref(null);
28593
- const fullProductListOptions = computed(() => {
28594
- return lodashExports.cloneDeep(props.productListOptions);
28595
- });
28596
- const fetch2 = () => {
28597
- var _a;
28598
- (_a = productList2.value) == null ? void 0 : _a.fetch();
28599
- };
28600
- __expose({ fetch: fetch2 });
28601
- return (_ctx, _cache) => {
28602
- return openBlock(), createBlock(unref(_sfc_main$a), {
28603
- options: fullProductListOptions.value,
28604
- ref_key: "productList",
28605
- ref: productList2
28606
- }, null, 8, ["options"]);
28607
- };
28608
- }
28609
- });
28610
- const QUERY_PARAMS = {
28611
- QUERY: "q",
28612
- PAGE: "p",
28613
- LIMIT: "l",
28614
- SORT: "s"
28615
- };
28616
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
28617
- __name: "SearchContainerEntry",
28618
- props: {
28619
- searchContainerOptions: {}
28620
- },
28621
- setup(__props, { expose: __expose }) {
28622
- const props = __props;
28623
- const isOpen = ref(false);
28624
- const triggerElement = ref(null);
28625
- const productList2 = ref(null);
28626
- const containerOptions = computed(() => {
28627
- return lodashExports.cloneDeep(props.searchContainerOptions);
28628
- });
28629
- const focus = () => {
28630
- const el = document.querySelector("#lupa-search-box-input .lupa-search-box-input-field");
28631
- el == null ? void 0 : el.focus();
28632
- };
28633
- const close = () => {
28634
- isOpen.value = false;
28635
- };
28636
- const openSearchContainer = () => {
28637
- isOpen.value = true;
28638
- };
28639
- const checkCloseOnEscape = (e2) => {
28640
- var _a;
28641
- if (!["Escape", "Esc"].includes((_a = e2.key) != null ? _a : "")) {
28642
- return;
28643
- }
28644
- isOpen.value = false;
28645
- };
28646
- const checkExistingQuery = () => {
28647
- const url = new URL(window.location.href);
28648
- const param = url.searchParams.get(QUERY_PARAMS.QUERY);
28649
- if (!param) {
28650
- return;
28651
- }
28652
- isOpen.value = true;
28653
- };
28654
- const mountOpenListeners = () => {
28655
- var _a, _b;
28656
- triggerElement.value = document.querySelector((_a = props.searchContainerOptions) == null ? void 0 : _a.trigger);
28657
- (_b = triggerElement.value) == null ? void 0 : _b.addEventListener("focus", openSearchContainer);
28658
- window.addEventListener("keydown", checkCloseOnEscape);
28659
- };
28660
- onMounted(() => {
28661
- var _a, _b;
28662
- mountOpenListeners();
28663
- checkExistingQuery();
28664
- isOpen.value = Boolean((_b = (_a = containerOptions.value) == null ? void 0 : _a.options) == null ? void 0 : _b.isOpenInitially);
28665
- });
28666
- onBeforeUnmount(() => {
28667
- var _a;
28668
- (_a = triggerElement.value) == null ? void 0 : _a.removeEventListener("focus", openSearchContainer);
28669
- window.removeEventListener("keydown", checkCloseOnEscape);
28670
- });
28671
- const fetch2 = () => {
28672
- var _a;
28673
- (_a = productList2.value) == null ? void 0 : _a.fetch();
28674
- };
28675
- const reloadOptions = () => {
28676
- var _a;
28677
- (_a = productList2.value) == null ? void 0 : _a.reloadOptions();
28678
- };
28679
- __expose({ fetch: fetch2, reloadOptions });
28680
- return (_ctx, _cache) => {
28681
- return openBlock(), createElementBlock("div", null, [
28682
- containerOptions.value && isOpen.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
28683
- key: 0,
28684
- options: containerOptions.value,
28685
- ref_key: "productList",
28686
- ref: productList2,
28687
- "onHook:mounted": focus,
28688
- onClose: close
28689
- }, null, 8, ["options"])) : createCommentVNode("", true)
28690
- ]);
28691
- };
28823
+ titleKey: "name",
28824
+ elements: []
28825
+ }
28826
+ ],
28827
+ history: {
28828
+ labels: {
28829
+ clear: "Clear History"
28830
+ }
28692
28831
  }
28693
- });
28694
- const _sfc_main = /* @__PURE__ */ defineComponent({
28695
- __name: "RecommendationsEntry",
28832
+ };
28833
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
28834
+ __name: "SearchBoxEntry",
28696
28835
  props: {
28697
- recommendationOptions: {}
28836
+ searchBoxOptions: {}
28698
28837
  },
28699
28838
  setup(__props, { expose: __expose }) {
28700
- const productRecommendations = ref(null);
28839
+ const props = __props;
28840
+ const searchBox2 = ref(null);
28841
+ const fullSearchBoxOptions = computed(() => {
28842
+ const options = lodashExports.cloneDeep(props.searchBoxOptions);
28843
+ return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_SEARCH_BOX_OPTIONS), options);
28844
+ });
28701
28845
  const fetch2 = () => {
28702
- productRecommendations == null ? void 0 : productRecommendations.fetch();
28846
+ var _a;
28847
+ (_a = searchBox2.value) == null ? void 0 : _a.handleCurrentValueSearch();
28703
28848
  };
28704
28849
  __expose({ fetch: fetch2 });
28705
28850
  return (_ctx, _cache) => {
28706
- return openBlock(), createBlock(unref(_sfc_main$8), {
28707
- options: _ctx.recommendationOptions,
28708
- ref_key: "productRecommendations",
28709
- ref: productRecommendations
28851
+ return openBlock(), createBlock(unref(_sfc_main$V), {
28852
+ options: fullSearchBoxOptions.value,
28853
+ ref_key: "searchBox",
28854
+ ref: searchBox2
28710
28855
  }, null, 8, ["options"]);
28711
28856
  };
28712
28857
  }
28713
28858
  });
28714
- const DEFAULT_CONTAINER_STYLE = "/containerStyle.css";
28715
- const createShadowDom = (shadowId, managerId) => {
28716
- let host = document.getElementById(shadowId);
28717
- if (host) {
28718
- host.remove();
28719
- }
28720
- host = document.createElement("div");
28721
- const manager = document.createElement("div");
28722
- host.setAttribute("id", shadowId);
28723
- manager == null ? void 0 : manager.setAttribute("id", managerId);
28724
- return { host, manager };
28725
- };
28726
- const attatchShadowDom = ({
28727
- host,
28728
- manager,
28729
- styleUrl,
28730
- options
28731
- }) => {
28732
- var _a;
28733
- if (host.shadowRoot) {
28734
- return;
28735
- }
28736
- const link = document.createElement("link");
28737
- link.type = "text/css";
28738
- link.rel = "stylesheet";
28739
- link.href = styleUrl;
28740
- const fontLink = document.createElement("link");
28741
- fontLink.type = "text/css";
28742
- fontLink.rel = "stylesheet";
28743
- fontLink.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap";
28744
- document.head.appendChild(fontLink);
28745
- const materialIconLink = document.createElement("link");
28746
- materialIconLink.type = "text/css";
28747
- materialIconLink.rel = "stylesheet";
28748
- materialIconLink.href = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,1,-50..200";
28749
- document.head.appendChild(materialIconLink);
28750
- const shadow = host.attachShadow({ mode: "open" });
28751
- shadow.appendChild(manager);
28752
- shadow.appendChild(link);
28753
- if ((_a = options == null ? void 0 : options.layout) == null ? void 0 : _a.marginLeft) {
28754
- const style = document.createElement("style");
28755
- style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${options.layout.marginLeft}px); margin-left: ${options.layout.marginLeft}px; }`;
28756
- shadow.appendChild(style);
28757
- }
28758
- };
28759
- const displayDiscountedPriceSection = (doc2, options) => {
28760
- var _a, _b;
28761
- const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
28762
- const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
28763
- return discountPrice && regularPrice && discountPrice < regularPrice;
28764
- };
28765
- const displayRegularPriceSection = (doc2, options) => {
28766
- var _a, _b;
28767
- const discountPrice = doc2[(_a = options.fields.discountPriceKey) != null ? _a : ""];
28768
- const regularPrice = doc2[(_b = options.fields.regularPriceKey) != null ? _b : ""];
28769
- const anyPrice = discountPrice || regularPrice;
28770
- return anyPrice && !displayDiscountedPriceSection(doc2, options);
28771
- };
28772
- const escapeHtml = (source) => {
28773
- if (!source) {
28774
- return source;
28775
- }
28776
- return `${source}`.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
28777
- };
28778
- const toMaxDecimalPlaces = (value, maxDecimal = 2) => {
28779
- if (!value) {
28780
- return 0;
28781
- }
28782
- try {
28783
- return +parseFloat(`${value}`).toFixed(maxDecimal);
28784
- } catch (e2) {
28785
- return `${value}`;
28786
- }
28787
- };
28788
- const capitalize = (value) => {
28789
- if (!value) {
28790
- return "";
28791
- }
28792
- return value.charAt(0).toLocaleUpperCase() + value.slice(1);
28793
- };
28794
- const getAlphanumeric = (value) => {
28795
- if (!value) {
28796
- return "";
28797
- }
28798
- return value.replace(/[\W_]/g, " ");
28799
- };
28800
- const getAdditionalElements = (fields) => {
28801
- return fields.map((key) => ({
28802
- type: "custom",
28803
- key,
28804
- label: capitalize(getAlphanumeric(key)),
28805
- className: "lupa-custom",
28806
- display: (doc2) => Boolean(doc2[key])
28807
- }));
28808
- };
28809
- const addFieldIfKeyExists = (field, key, config) => {
28810
- if (key) {
28811
- return config;
28812
- }
28813
- return { key: field, type: "customHtml", display: () => false };
28814
- };
28815
- const getSearchBoxComponent = ({
28816
- searchBoxOptions,
28817
- labels,
28818
- panelOptions,
28819
- redirections,
28820
- placeholderImage
28821
- }) => {
28822
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
28823
- const panels = [
28824
- ...(panelOptions == null ? void 0 : panelOptions.suggestionPanel) ? [
28825
- {
28826
- type: SearchBoxPanelType.SUGGESTION,
28827
- queryKey: searchBoxOptions.suggestionQueryKey,
28828
- highlight: true,
28829
- limit: 8,
28830
- labels: {
28831
- topResultsTitle: (_a = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _a.topSuggestionsTitle
28832
- }
28833
- }
28834
- ] : [],
28835
- ...(panelOptions == null ? void 0 : panelOptions.docPanel) ? [
28836
- {
28837
- type: SearchBoxPanelType.DOCUMENT,
28838
- queryKey: searchBoxOptions.documentQueryKey,
28839
- limit: 5,
28840
- elements: [
28841
- {
28842
- type: "image",
28843
- placeholder: placeholderImage,
28844
- key: (_b = searchBoxOptions.fields) == null ? void 0 : _b.imageKey,
28845
- baseUrl: (_c = searchBoxOptions.fields) == null ? void 0 : _c.baseImageUrl
28846
- },
28847
- {
28848
- type: "title",
28849
- key: (_d = searchBoxOptions.fields) == null ? void 0 : _d.titleKey,
28850
- maxLines: 2
28851
- },
28852
- {
28853
- type: "regularPrice",
28854
- key: (_e = searchBoxOptions.fields) == null ? void 0 : _e.regularPriceKey,
28855
- display: (doc2) => {
28856
- var _a2, _b2, _c2, _d2;
28857
- 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]);
28858
- }
28859
- },
28860
- {
28861
- type: "price",
28862
- key: (_f = searchBoxOptions.fields) == null ? void 0 : _f.discountPriceKey
28863
- }
28864
- ]
28865
- }
28866
- ] : []
28867
- ];
28868
- return {
28869
- inputSelector: searchBoxOptions.inputSelector,
28870
- options: {
28871
- environment: (_g = searchBoxOptions.environment) != null ? _g : "production",
28872
- customUrl: searchBoxOptions.customUrl,
28873
- customBaseUrl: searchBoxOptions.customBaseUrl,
28874
- customPayload: searchBoxOptions.customPayload,
28875
- customHeaders: searchBoxOptions.customHeaders
28876
- },
28877
- showTotalCount: true,
28878
- expandOnSinglePanel: true,
28879
- minInputLength: (_i = (_h = searchBoxOptions.fields) == null ? void 0 : _h.minInputLength) != null ? _i : 0,
28880
- debounce: 250,
28881
- labels: labels == null ? void 0 : labels.searchBox,
28882
- links: {
28883
- searchResults: ""
28859
+ const DEFAULT_OPTIONS_RESULTS = {
28860
+ options: {
28861
+ environment: "production"
28862
+ },
28863
+ queryKey: "",
28864
+ containerSelector: "#searchResultsContainer",
28865
+ searchTitlePosition: "page-top",
28866
+ labels: {
28867
+ pageSize: "Page size:",
28868
+ sortBy: "Sort by:",
28869
+ itemCount: "Items {1} of {2}",
28870
+ filteredItemCount: "",
28871
+ currency: "€",
28872
+ showMore: "Show more",
28873
+ searchResults: "Search Query: ",
28874
+ emptyResults: "There are no results for the query:",
28875
+ mobileFilterButton: "Filter",
28876
+ htmlTitleTemplate: "Search Query: '{1}'",
28877
+ noResultsSuggestion: "No results found for this query: {1}",
28878
+ didYouMean: "Did you mean to search: {1}",
28879
+ similarQuery: "Search results for phrase {1}",
28880
+ similarQueries: "Similar queries:"
28881
+ },
28882
+ grid: {
28883
+ columns: {
28884
+ xl: 4,
28885
+ l: 3,
28886
+ md: 2,
28887
+ sm: 2,
28888
+ xs: 1
28889
+ }
28890
+ },
28891
+ pagination: {
28892
+ sizeSelection: {
28893
+ position: {
28894
+ top: false,
28895
+ bottom: true
28896
+ },
28897
+ sizes: [12, 24, 36]
28884
28898
  },
28885
- panels,
28886
- redirections,
28887
- history: {
28888
- labels: {
28889
- clear: (_j = labels == null ? void 0 : labels.searchBox) == null ? void 0 : _j.clearHistory
28890
- }
28899
+ pageSelection: {
28900
+ position: {
28901
+ top: false,
28902
+ bottom: true
28903
+ },
28904
+ display: 5,
28905
+ displayMobile: 3
28891
28906
  }
28892
- };
28893
- };
28894
- const getSearchResultsComponent = ({
28895
- searchResultOptions,
28896
- labels,
28897
- redirections,
28898
- placeholderImage,
28899
- configuratorOverrides,
28900
- callbacks,
28901
- additionalFields
28902
- }) => {
28903
- 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;
28904
- const filters = searchResultOptions.showFacets ? {
28907
+ },
28908
+ sort: [],
28909
+ filters: {
28905
28910
  currentFilters: {
28906
28911
  visibility: {
28907
28912
  mobileSidebar: true,
28908
28913
  mobileToolbar: true
28909
28914
  },
28910
28915
  labels: {
28911
- title: "",
28912
- clearAll: (_a = labels == null ? void 0 : labels.facets) == null ? void 0 : _a.clearAll
28916
+ title: "Current filters:",
28917
+ clearAll: "Clear all"
28913
28918
  }
28914
28919
  },
28915
28920
  facets: {
28916
28921
  labels: {
28917
- title: (_b = labels == null ? void 0 : labels.facets) == null ? void 0 : _b.facetTitle,
28918
- showAll: (_c = labels == null ? void 0 : labels.facets) == null ? void 0 : _c.showAll,
28919
- facetFilter: (_d = labels == null ? void 0 : labels.facets) == null ? void 0 : _d.facetFilter,
28920
- facetClear: (_e = labels == null ? void 0 : labels.facets) == null ? void 0 : _e.facetClear
28922
+ title: "Filters:",
28923
+ showAll: "Show more",
28924
+ facetFilter: "Filter...",
28925
+ facetClear: "Clear"
28921
28926
  },
28922
28927
  filterable: {
28923
28928
  minValues: 5
@@ -28927,179 +28932,230 @@ const getSearchResultsComponent = ({
28927
28932
  topLevelValueCountLimit: 5,
28928
28933
  filterable: true
28929
28934
  },
28930
- stats: {
28931
- slider: true,
28932
- inputs: true,
28933
- labels: {
28934
- from: "",
28935
- to: ""
28936
- }
28937
- },
28938
- facetValueCountLimit: 8,
28935
+ facetValueCountLimit: 20,
28939
28936
  showDocumentCount: true,
28940
28937
  style: {
28941
28938
  type: "sidebar"
28942
28939
  }
28943
28940
  }
28944
- } : {};
28945
- const columns = (_k = searchResultOptions.gridConfiguration) != null ? _k : {
28946
- xl: (_f = searchResultOptions.maxColumns) != null ? _f : 4,
28947
- l: (_g = searchResultOptions.maxColumns) != null ? _g : 3,
28948
- md: (_h = searchResultOptions.maxColumns) != null ? _h : 3,
28949
- sm: (_i = searchResultOptions.maxColumns) != null ? _i : 2,
28950
- xs: (_j = searchResultOptions.maxColumns) != null ? _j : 1
28951
- };
28952
- const badges = {
28953
- badges: {
28954
- anchor: "tr",
28955
- elements: [
28956
- ...searchResultOptions.showRelevance ? [
28957
- {
28958
- key: "",
28959
- type: "customHtml",
28960
- className: "relevance",
28961
- html: (doc2) => `${toMaxDecimalPlaces(escapeHtml(doc2._relevance), 3)}`,
28962
- display: (doc2) => Boolean(doc2._relevance !== void 0)
28963
- }
28964
- ] : [],
28965
- ...((_l = searchResultOptions.boostedMarker) == null ? void 0 : _l.enabled) ? [
28966
- {
28967
- key: "",
28968
- type: "customHtml",
28969
- className: "boosted-marker",
28970
- html: () => {
28971
- var _a2;
28972
- return `${escapeHtml((_a2 = searchResultOptions.boostedMarker) == null ? void 0 : _a2.label)}`;
28973
- },
28974
- display: (doc2) => doc2._boosted === true
28975
- }
28976
- ] : []
28977
- ]
28978
- }
28979
- };
28980
- return __spreadValues(__spreadProps(__spreadValues({
28981
- options: {
28982
- environment: (_m = searchResultOptions.environment) != null ? _m : "production",
28983
- customUrl: searchResultOptions.customUrl,
28984
- customBaseUrl: searchResultOptions.customBaseUrl,
28985
- customPayload: searchResultOptions.customPayload,
28986
- customHeaders: searchResultOptions.customHeaders,
28987
- onError: searchResultOptions.errorHandler
28988
- },
28989
- queryKey: searchResultOptions.queryKey,
28990
- containerSelector: searchResultOptions.containerSelector,
28991
- searchTitlePosition: "search-results-top",
28992
- titleKey: (_n = searchResultOptions.fields) == null ? void 0 : _n.titleKey,
28993
- labels: labels == null ? void 0 : labels.searchResults,
28994
- grid: {
28995
- columns
28996
- },
28997
- pagination: {
28998
- sizeSelection: {
28999
- position: {
29000
- top: true,
29001
- bottom: false
29002
- },
29003
- sizes: [12, 24, 36, 48]
29004
- },
29005
- pageSelection: {
29006
- position: {
29007
- top: false,
29008
- bottom: true
29009
- },
29010
- displayMobile: 3,
29011
- display: 5
29012
- }
29013
- },
29014
- filters,
29015
- toolbar: {
29016
- layoutSelector: false,
29017
- itemSummary: true,
29018
- clearFilters: false
29019
- },
29020
- isInStock: () => {
29021
- return true;
29022
- }
29023
- }, badges), {
29024
- links: {
29025
- details: ((_o = searchResultOptions.fields) == null ? void 0 : _o.productUrl) ? `{${(_p = searchResultOptions.fields) == null ? void 0 : _p.productUrl}}` : void 0
29026
- },
29027
- callbacks,
29028
- routingBehavior: callbacks ? "event" : "direct-link",
29029
- idKey: "id",
29030
- elements: [
29031
- {
29032
- type: "image",
29033
- placeholder: placeholderImage,
29034
- key: (_q = searchResultOptions.fields) == null ? void 0 : _q.imageKey,
29035
- baseUrl: (_r = searchResultOptions.fields) == null ? void 0 : _r.baseImageUrl,
29036
- display: () => {
29037
- var _a2;
29038
- return (_a2 = searchResultOptions.fields) == null ? void 0 : _a2.imageKey;
29039
- }
29040
- },
29041
- addFieldIfKeyExists("_emphasis", (_s = searchResultOptions.fields) == null ? void 0 : _s.emphasizedField, {
29042
- type: "custom",
29043
- className: "lupa-custom-emphasis",
29044
- key: (_t = searchResultOptions.fields) == null ? void 0 : _t.emphasizedField,
29045
- display: () => true
29046
- }),
29047
- {
29048
- type: "title",
29049
- key: (_u = searchResultOptions.fields) == null ? void 0 : _u.titleKey,
29050
- maxLines: (_v = searchResultOptions.maxLines) != null ? _v : 2,
29051
- display: (doc2) => {
29052
- var _a2, _b2;
29053
- return ((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.titleKey) && Boolean(doc2[(_b2 = searchResultOptions.fields) == null ? void 0 : _b2.titleKey]);
29054
- }
29055
- },
29056
- ...getAdditionalElements(additionalFields),
29057
- addFieldIfKeyExists("_discountPrice", (_w = searchResultOptions.fields) == null ? void 0 : _w.discountPriceKey, {
29058
- key: (_x = searchResultOptions.fields) == null ? void 0 : _x.discountPriceKey,
29059
- type: "customHtml",
29060
- className: "lupa-price lupa-price-discounted",
29061
- display: (doc2) => displayDiscountedPriceSection(doc2, searchResultOptions),
29062
- html: (doc2) => {
29063
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
29064
- const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
29065
- const discountPrice = (_d2 = parseFloat(
29066
- doc2[(_c2 = (_b2 = searchResultOptions.fields) == null ? void 0 : _b2.discountPriceKey) != null ? _c2 : ""]
29067
- )) == null ? void 0 : _d2.toFixed(2);
29068
- const regularPrice = (_g2 = parseFloat(
29069
- doc2[(_f2 = (_e2 = searchResultOptions.fields) == null ? void 0 : _e2.regularPriceKey) != null ? _f2 : ""]
29070
- )) == null ? void 0 : _g2.toFixed(2);
29071
- const discount = `<span class="lupa-discount">${escapeHtml(
29072
- discountPrice
29073
- )} ${currency}</span>`;
29074
- const regular = `<span class="lupa-regular">${escapeHtml(
29075
- regularPrice
29076
- )} ${currency}</span>`;
29077
- return discount + regular;
29078
- }
29079
- }),
29080
- addFieldIfKeyExists("_regularPrice", (_y = searchResultOptions.fields) == null ? void 0 : _y.regularPriceKey, {
29081
- key: (_z = searchResultOptions.fields) == null ? void 0 : _z.regularPriceKey,
29082
- type: "customHtml",
29083
- className: "lupa-price lupa-price-single",
29084
- display: (doc2) => displayRegularPriceSection(doc2, searchResultOptions),
29085
- html: (doc2) => {
29086
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
29087
- const currency = escapeHtml(((_a2 = searchResultOptions.fields) == null ? void 0 : _a2.currency) || "€");
29088
- const price = (_g2 = parseFloat(
29089
- (_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 : ""]
29090
- )) == null ? void 0 : _g2.toFixed(2);
29091
- return `<span class="lupa-final">${escapeHtml(price)} ${currency}</span>`;
29092
- }
29093
- })
29094
- ],
29095
- breadcrumbs: [],
29096
- sort: [],
29097
- redirections
29098
- }), configuratorOverrides);
28941
+ },
28942
+ toolbar: {
28943
+ layoutSelector: true,
28944
+ itemSummary: true,
28945
+ clearFilters: false
28946
+ },
28947
+ isInStock: () => {
28948
+ return true;
28949
+ },
28950
+ badges: {
28951
+ anchor: "tr",
28952
+ elements: []
28953
+ },
28954
+ links: {
28955
+ details: "/{id}"
28956
+ },
28957
+ elements: [],
28958
+ breadcrumbs: [{ label: "Main Page", link: "/" }, { label: "Search: {1}" }]
28959
+ };
28960
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
28961
+ __name: "SearchResultsEntry",
28962
+ props: {
28963
+ searchResultsOptions: {}
28964
+ },
28965
+ setup(__props, { expose: __expose }) {
28966
+ const props = __props;
28967
+ const searchResults2 = ref(null);
28968
+ const fullSearchResultsOptions = computed(() => {
28969
+ const options = lodashExports.cloneDeep(props.searchResultsOptions);
28970
+ return lodashExports.merge(lodashExports.cloneDeep(DEFAULT_OPTIONS_RESULTS), options);
28971
+ });
28972
+ const fetch2 = () => {
28973
+ var _a;
28974
+ (_a = searchResults2.value) == null ? void 0 : _a.handleUrlChange();
28975
+ };
28976
+ __expose({ fetch: fetch2 });
28977
+ return (_ctx, _cache) => {
28978
+ return openBlock(), createBlock(unref(_sfc_main$c), {
28979
+ options: fullSearchResultsOptions.value,
28980
+ ref_key: "searchResults",
28981
+ ref: searchResults2
28982
+ }, null, 8, ["options"]);
28983
+ };
28984
+ }
28985
+ });
28986
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
28987
+ __name: "ProductListEntry",
28988
+ props: {
28989
+ productListOptions: {}
28990
+ },
28991
+ setup(__props, { expose: __expose }) {
28992
+ const props = __props;
28993
+ const productList2 = ref(null);
28994
+ const fullProductListOptions = computed(() => {
28995
+ return lodashExports.cloneDeep(props.productListOptions);
28996
+ });
28997
+ const fetch2 = () => {
28998
+ var _a;
28999
+ (_a = productList2.value) == null ? void 0 : _a.fetch();
29000
+ };
29001
+ __expose({ fetch: fetch2 });
29002
+ return (_ctx, _cache) => {
29003
+ return openBlock(), createBlock(unref(_sfc_main$a), {
29004
+ options: fullProductListOptions.value,
29005
+ ref_key: "productList",
29006
+ ref: productList2
29007
+ }, null, 8, ["options"]);
29008
+ };
29009
+ }
29010
+ });
29011
+ const QUERY_PARAMS = {
29012
+ QUERY: "q",
29013
+ PAGE: "p",
29014
+ LIMIT: "l",
29015
+ SORT: "s"
29099
29016
  };
29100
- const SearchContainerConfigurationService = {
29101
- getSearchBoxComponent,
29102
- getSearchResultsComponent
29017
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
29018
+ __name: "SearchContainerEntry",
29019
+ props: {
29020
+ searchContainerOptions: {}
29021
+ },
29022
+ setup(__props, { expose: __expose }) {
29023
+ const props = __props;
29024
+ const isOpen = ref(false);
29025
+ const triggerElement = ref(null);
29026
+ const productList2 = ref(null);
29027
+ const containerOptions = computed(() => {
29028
+ return lodashExports.cloneDeep(props.searchContainerOptions);
29029
+ });
29030
+ const focus = () => {
29031
+ const el = document.querySelector("#lupa-search-box-input .lupa-search-box-input-field");
29032
+ el == null ? void 0 : el.focus();
29033
+ };
29034
+ const close = () => {
29035
+ isOpen.value = false;
29036
+ };
29037
+ const openSearchContainer = () => {
29038
+ isOpen.value = true;
29039
+ };
29040
+ const checkCloseOnEscape = (e2) => {
29041
+ var _a;
29042
+ if (!["Escape", "Esc"].includes((_a = e2.key) != null ? _a : "")) {
29043
+ return;
29044
+ }
29045
+ isOpen.value = false;
29046
+ };
29047
+ const checkExistingQuery = () => {
29048
+ const url = new URL(window.location.href);
29049
+ const param = url.searchParams.get(QUERY_PARAMS.QUERY);
29050
+ if (!param) {
29051
+ return;
29052
+ }
29053
+ isOpen.value = true;
29054
+ };
29055
+ const mountOpenListeners = () => {
29056
+ var _a, _b;
29057
+ triggerElement.value = document.querySelector((_a = props.searchContainerOptions) == null ? void 0 : _a.trigger);
29058
+ (_b = triggerElement.value) == null ? void 0 : _b.addEventListener("focus", openSearchContainer);
29059
+ window.addEventListener("keydown", checkCloseOnEscape);
29060
+ };
29061
+ onMounted(() => {
29062
+ var _a, _b;
29063
+ mountOpenListeners();
29064
+ checkExistingQuery();
29065
+ isOpen.value = Boolean((_b = (_a = containerOptions.value) == null ? void 0 : _a.options) == null ? void 0 : _b.isOpenInitially);
29066
+ });
29067
+ onBeforeUnmount(() => {
29068
+ var _a;
29069
+ (_a = triggerElement.value) == null ? void 0 : _a.removeEventListener("focus", openSearchContainer);
29070
+ window.removeEventListener("keydown", checkCloseOnEscape);
29071
+ });
29072
+ const fetch2 = () => {
29073
+ var _a;
29074
+ (_a = productList2.value) == null ? void 0 : _a.fetch();
29075
+ };
29076
+ const reloadOptions = () => {
29077
+ var _a;
29078
+ (_a = productList2.value) == null ? void 0 : _a.reloadOptions();
29079
+ };
29080
+ __expose({ fetch: fetch2, reloadOptions });
29081
+ return (_ctx, _cache) => {
29082
+ return openBlock(), createElementBlock("div", null, [
29083
+ containerOptions.value && isOpen.value ? (openBlock(), createBlock(unref(_sfc_main$9), {
29084
+ key: 0,
29085
+ options: containerOptions.value,
29086
+ ref_key: "productList",
29087
+ ref: productList2,
29088
+ "onHook:mounted": focus,
29089
+ onClose: close
29090
+ }, null, 8, ["options"])) : createCommentVNode("", true)
29091
+ ]);
29092
+ };
29093
+ }
29094
+ });
29095
+ const _sfc_main = /* @__PURE__ */ defineComponent({
29096
+ __name: "RecommendationsEntry",
29097
+ props: {
29098
+ recommendationOptions: {}
29099
+ },
29100
+ setup(__props, { expose: __expose }) {
29101
+ const productRecommendations = ref(null);
29102
+ const fetch2 = () => {
29103
+ productRecommendations == null ? void 0 : productRecommendations.fetch();
29104
+ };
29105
+ __expose({ fetch: fetch2 });
29106
+ return (_ctx, _cache) => {
29107
+ return openBlock(), createBlock(unref(_sfc_main$8), {
29108
+ options: _ctx.recommendationOptions,
29109
+ ref_key: "productRecommendations",
29110
+ ref: productRecommendations
29111
+ }, null, 8, ["options"]);
29112
+ };
29113
+ }
29114
+ });
29115
+ const DEFAULT_CONTAINER_STYLE = "/containerStyle.css";
29116
+ const createShadowDom = (shadowId, managerId) => {
29117
+ let host = document.getElementById(shadowId);
29118
+ if (host) {
29119
+ host.remove();
29120
+ }
29121
+ host = document.createElement("div");
29122
+ const manager = document.createElement("div");
29123
+ host.setAttribute("id", shadowId);
29124
+ manager == null ? void 0 : manager.setAttribute("id", managerId);
29125
+ return { host, manager };
29126
+ };
29127
+ const attatchShadowDom = ({
29128
+ host,
29129
+ manager,
29130
+ styleUrl,
29131
+ options
29132
+ }) => {
29133
+ var _a;
29134
+ if (host.shadowRoot) {
29135
+ return;
29136
+ }
29137
+ const link = document.createElement("link");
29138
+ link.type = "text/css";
29139
+ link.rel = "stylesheet";
29140
+ link.href = styleUrl;
29141
+ const fontLink = document.createElement("link");
29142
+ fontLink.type = "text/css";
29143
+ fontLink.rel = "stylesheet";
29144
+ fontLink.href = "https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap";
29145
+ document.head.appendChild(fontLink);
29146
+ const materialIconLink = document.createElement("link");
29147
+ materialIconLink.type = "text/css";
29148
+ materialIconLink.rel = "stylesheet";
29149
+ materialIconLink.href = "https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,1,-50..200";
29150
+ document.head.appendChild(materialIconLink);
29151
+ const shadow = host.attachShadow({ mode: "open" });
29152
+ shadow.appendChild(manager);
29153
+ shadow.appendChild(link);
29154
+ if ((_a = options == null ? void 0 : options.layout) == null ? void 0 : _a.marginLeft) {
29155
+ const style = document.createElement("style");
29156
+ style.innerHTML = `.lupa-search-container-overlay { width: calc(100% - ${options.layout.marginLeft}px); margin-left: ${options.layout.marginLeft}px; }`;
29157
+ shadow.appendChild(style);
29158
+ }
29103
29159
  };
29104
29160
  const getMountElement = (element, mountingBehavior = "replace", mountToParent) => {
29105
29161
  const parent = element == null ? void 0 : element.parentElement;
@@ -29130,7 +29186,7 @@ const createVue = (selector, mountingBehavior = "replace", rootComponent, option
29130
29186
  return;
29131
29187
  }
29132
29188
  let mountedComponent = null;
29133
- const props = reactive(__spreadValues({}, options));
29189
+ const props = reactive(__spreadValues2({}, options));
29134
29190
  const app2 = createApp({
29135
29191
  render: () => mountedComponent = h$1(rootComponent, props)
29136
29192
  });
@@ -29149,9 +29205,6 @@ const app = {
29149
29205
  recommendations: {},
29150
29206
  chat: {}
29151
29207
  };
29152
- const tracking = (options) => {
29153
- setupTracking(options);
29154
- };
29155
29208
  const applySearchBox = (options, mountOptions) => {
29156
29209
  const existingInstance = app.box[options.inputSelector];
29157
29210
  if (existingInstance) {
@@ -29180,7 +29233,7 @@ const searchBox = (options, mountOptions) => {
29180
29233
  var _a;
29181
29234
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
29182
29235
  for (const input of inputs) {
29183
- applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input.trim() }), mountOptions);
29236
+ applySearchBox(__spreadProps2(__spreadValues2({}, options), { inputSelector: input.trim() }), mountOptions);
29184
29237
  }
29185
29238
  };
29186
29239
  const searchResults = (options, mountOptions) => {
@@ -29416,7 +29469,237 @@ const clearChat = (selector) => {
29416
29469
  } catch (e2) {
29417
29470
  }
29418
29471
  };
29472
+ const saveToLocalStorage = (key, value) => {
29473
+ try {
29474
+ localStorage.setItem(key, JSON.stringify(value));
29475
+ } catch (e2) {
29476
+ }
29477
+ };
29478
+ const tryLoadFromLocalStorage = (key) => {
29479
+ try {
29480
+ const item = localStorage.getItem(key);
29481
+ return item ? JSON.parse(item) : null;
29482
+ } catch (e2) {
29483
+ return null;
29484
+ }
29485
+ };
29486
+ const saveToSessionStorage = (key, value) => {
29487
+ try {
29488
+ sessionStorage.setItem(key, JSON.stringify(value));
29489
+ } catch (e2) {
29490
+ }
29491
+ };
29492
+ const tryLoadFromSessionStorage = (key) => {
29493
+ try {
29494
+ const item = sessionStorage.getItem(key);
29495
+ return item ? JSON.parse(item) : null;
29496
+ } catch (e2) {
29497
+ return null;
29498
+ }
29499
+ };
29500
+ const getQueryParam = (name) => {
29501
+ try {
29502
+ const urlParams = new URLSearchParams(window.location.search);
29503
+ return urlParams.get(name);
29504
+ } catch (e2) {
29505
+ return null;
29506
+ }
29507
+ };
29508
+ const PREVIEW_PARAMETER = "lupaSearchPreview";
29509
+ let styleElement = null;
29510
+ const waitForElementToBeVisible = (element, retries = 0, maxRetries = 10, interval = 10) => __async2(void 0, null, function* () {
29511
+ if (retries > maxRetries) {
29512
+ return false;
29513
+ }
29514
+ if (typeof element === "string") {
29515
+ element = document.querySelector(element);
29516
+ }
29517
+ if (element) {
29518
+ return true;
29519
+ } else {
29520
+ setTimeout(() => {
29521
+ waitForElementToBeVisible(element, retries + 1, maxRetries, interval + 10);
29522
+ }, interval);
29523
+ }
29524
+ });
29525
+ const loadAndSaveConfigurationFromServer = (configurationKey, options) => __async2(void 0, null, function* () {
29526
+ const configuration2 = yield fetchPluginConfiguration(
29527
+ options,
29528
+ configurationKey
29529
+ );
29530
+ if (!configuration2) {
29531
+ console.error(`Failed to fetch LupaSearch plugin configuration for key ${configurationKey}`);
29532
+ return null;
29533
+ }
29534
+ saveToLocalStorage(configurationKey, configuration2);
29535
+ return configuration2;
29536
+ });
29537
+ const checkIsPreviewMode = () => {
29538
+ const isPreviewModeSaved = tryLoadFromSessionStorage(PREVIEW_PARAMETER);
29539
+ if (isPreviewModeSaved) {
29540
+ return isPreviewModeSaved;
29541
+ }
29542
+ const isPreviewMode = getQueryParam(PREVIEW_PARAMETER) === "true";
29543
+ if (isPreviewMode) {
29544
+ saveToSessionStorage(PREVIEW_PARAMETER, isPreviewMode);
29545
+ } else {
29546
+ saveToSessionStorage(PREVIEW_PARAMETER, false);
29547
+ }
29548
+ return isPreviewMode;
29549
+ };
29550
+ const loadConfigurations = (configurationKey, isPreviewMode, options) => __async2(void 0, null, function* () {
29551
+ if (isPreviewMode) {
29552
+ return loadAndSaveConfigurationFromServer(configurationKey, options);
29553
+ }
29554
+ const existingConfiguration = tryLoadFromLocalStorage(configurationKey);
29555
+ if (existingConfiguration) {
29556
+ setTimeout(() => __async2(void 0, null, function* () {
29557
+ var _a;
29558
+ const newestConfiguration = yield loadAndSaveConfigurationFromServer(
29559
+ configurationKey,
29560
+ options
29561
+ );
29562
+ if (existingConfiguration.updatedAt === newestConfiguration.updatedAt) {
29563
+ return;
29564
+ }
29565
+ const isPreviewMode2 = checkIsPreviewMode();
29566
+ const configuration2 = isPreviewMode2 ? (_a = newestConfiguration.previewConfiguration) != null ? _a : newestConfiguration.configuration : newestConfiguration.configuration;
29567
+ yield mount(configuration2, false);
29568
+ }), 5e3);
29569
+ return existingConfiguration;
29570
+ }
29571
+ return loadAndSaveConfigurationFromServer(configurationKey, options);
29572
+ });
29573
+ const applyStyles = (configuration2) => __async2(void 0, null, function* () {
29574
+ var _a;
29575
+ const visible2 = yield waitForElementToBeVisible(document.head);
29576
+ if (!visible2) {
29577
+ console.error("Failed to apply custom LupaSearch styles, head element not found");
29578
+ return;
29579
+ }
29580
+ const baseStyleLink = configuration2.baseStyleLink;
29581
+ if (styleElement) {
29582
+ styleElement.remove();
29583
+ }
29584
+ styleElement = document.createElement("style");
29585
+ if (baseStyleLink) {
29586
+ styleElement.innerHTML = `
29587
+ @import url('${baseStyleLink}');
29588
+ @import url('https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css')
29589
+ ${(_a = configuration2.customStyles) != null ? _a : ""}`;
29590
+ }
29591
+ document.head.appendChild(styleElement);
29592
+ });
29593
+ const mountSearchBox = (configuration, fetch = true) => __async2(void 0, null, function* () {
29594
+ if (!configuration.searchBox) {
29595
+ return;
29596
+ }
29597
+ const resolvedConfiguration = eval(`(${configuration.searchBox})`);
29598
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.inputSelector);
29599
+ if (!visible) {
29600
+ console.error(
29601
+ `Failed to mount LupaSearch search box, input element ${resolvedConfiguration.inputSelector} not found`
29602
+ );
29603
+ return;
29604
+ }
29605
+ searchBox(resolvedConfiguration, { fetch });
29606
+ });
29607
+ const mountSearchResults = (configuration, fetch = true) => __async2(void 0, null, function* () {
29608
+ if (!configuration.searchResults) {
29609
+ return;
29610
+ }
29611
+ const resolvedConfiguration = eval(`(${configuration.searchResults})`);
29612
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29613
+ if (!visible) {
29614
+ console.error(
29615
+ `Failed to mount LupaSearch search results, element ${resolvedConfiguration.containerSelector} not found`
29616
+ );
29617
+ return;
29618
+ }
29619
+ searchResults(resolvedConfiguration, { fetch });
29620
+ });
29621
+ const mountProductList = (configuration, fetch = true) => __async2(void 0, null, function* () {
29622
+ if (!configuration.productList) {
29623
+ return;
29624
+ }
29625
+ const resolvedSearchResultsConfiguration = eval(
29626
+ `(${configuration.searchResults})`
29627
+ );
29628
+ const resolvedConfiguration = eval(`(${configuration.productList})`);
29629
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29630
+ if (!visible) {
29631
+ console.error(
29632
+ `Failed to mount LupaSearch product list, element ${resolvedConfiguration.containerSelector} not found`
29633
+ );
29634
+ return;
29635
+ }
29636
+ productList(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29637
+ });
29638
+ const mountRecommendations = (configuration, fetch = true) => __async2(void 0, null, function* () {
29639
+ if (!configuration.recommendations) {
29640
+ return;
29641
+ }
29642
+ const resolvedSearchResultsConfiguration = eval(
29643
+ `(${configuration.searchResults})`
29644
+ );
29645
+ const resolvedConfiguration = eval(
29646
+ `(${configuration.recommendations})`
29647
+ );
29648
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29649
+ if (!visible) {
29650
+ console.error(
29651
+ `Failed to mount LupaSearch recommendations, element ${resolvedConfiguration.containerSelector} not found`
29652
+ );
29653
+ return;
29654
+ }
29655
+ recommendations(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29656
+ });
29657
+ const mountChat = (configuration, fetch = true) => __async2(void 0, null, function* () {
29658
+ if (!configuration.genAiChat) {
29659
+ return;
29660
+ }
29661
+ const resolvedSearchResultsConfiguration = eval(
29662
+ `(${configuration.searchResults})`
29663
+ );
29664
+ const resolvedConfiguration = eval(`(${configuration.genAiChat})`);
29665
+ const visible = yield waitForElementToBeVisible(resolvedConfiguration.containerSelector);
29666
+ if (!visible) {
29667
+ console.error(
29668
+ `Failed to mount LupaSearch chat, element ${resolvedConfiguration.containerSelector} not found`
29669
+ );
29670
+ return;
29671
+ }
29672
+ chat(__spreadValues2(__spreadValues2({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { fetch });
29673
+ });
29674
+ const mount = (configuration2, fetch2 = true) => __async2(void 0, null, function* () {
29675
+ yield applyStyles(configuration2);
29676
+ const mountPromises = [
29677
+ mountSearchBox(configuration2, fetch2),
29678
+ mountSearchResults(configuration2, fetch2),
29679
+ mountProductList(configuration2, fetch2),
29680
+ mountRecommendations(configuration2, fetch2),
29681
+ mountChat(configuration2, fetch2)
29682
+ ];
29683
+ yield Promise.all(mountPromises);
29684
+ });
29685
+ const init$1 = (configurationKey, options) => __async2(void 0, null, function* () {
29686
+ var _a;
29687
+ const isPreviewMode = checkIsPreviewMode();
29688
+ const plugin = yield loadConfigurations(configurationKey, isPreviewMode, options);
29689
+ const configuration2 = isPreviewMode ? (_a = plugin.previewConfiguration) != null ? _a : plugin.configuration : plugin.configuration;
29690
+ yield mount(configuration2);
29691
+ });
29692
+ const PluginConfigurationManager = {
29693
+ init: init$1
29694
+ };
29695
+ const tracking = (options) => {
29696
+ setupTracking(options);
29697
+ };
29698
+ const init = (configurationKey, options) => {
29699
+ return PluginConfigurationManager.init(configurationKey, options);
29700
+ };
29419
29701
  const lupaSearch = {
29702
+ init,
29420
29703
  searchBox,
29421
29704
  searchResults,
29422
29705
  tracking,