import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { p as parts, d as defineCustomElement$a } from './klevu-product2.js';
import { p as post, a as KlevuConfig, K as KlevuInit } from './klevu-init2.js';
import { g as getTranslation } from './getTranslation.js';
import { g as getKMCSettings } from './getKMCSettings.js';
import { d as defineCustomElement$n } from './klevu-accordion2.js';
import { d as defineCustomElement$m } from './klevu-banner2.js';
import { d as defineCustomElement$l } from './klevu-button2.js';
import { d as defineCustomElement$k } from './klevu-checkbox2.js';
import { d as defineCustomElement$j } from './klevu-color-swatch2.js';
import { d as defineCustomElement$i } from './klevu-drawer2.js';
import { d as defineCustomElement$h } from './klevu-dropdown2.js';
import { d as defineCustomElement$g } from './klevu-facet2.js';
import { d as defineCustomElement$f } from './klevu-facet-list2.js';
import { d as defineCustomElement$e } from './klevu-icon2.js';
import { d as defineCustomElement$d } from './klevu-layout-results2.js';
import { d as defineCustomElement$c } from './klevu-loading-indicator2.js';
import { d as defineCustomElement$b } from './klevu-pagination2.js';
import { d as defineCustomElement$9 } from './klevu-product-grid2.js';
import { d as defineCustomElement$8 } from './klevu-rating2.js';
import { d as defineCustomElement$7 } from './klevu-slider2.js';
import { d as defineCustomElement$6 } from './klevu-sort2.js';
import { d as defineCustomElement$5 } from './klevu-typography2.js';
import { d as defineCustomElement$4 } from './klevu-util-infinite-scroll2.js';
import { d as defineCustomElement$3 } from './klevu-util-scrollbars2.js';
import { d as defineCustomElement$2 } from './klevu-util-viewport2.js';
import { F as FilterManager } from './filterManager.js';
import { s as sendMerchandisingViewEvent, c as categoryMerchandising } from './categoryMerchandising.js';
import { l as listFilters } from './listFilters.js';
import { K as KlevuTypeOfRequest, a as applyFilterWithManager, p as personalisation, b as KlevuFetch } from './klevuFetch.js';
import { i as isBrowser } from './isBrowser.js';

var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
const STORAGE_TS_KEY = "abtest-data-ts";
const STORAGE_KEY = "abtest-data";
const STORAGE_PERMANENT_KEY = "abtest-permanent-data";
const HALF_HOUR = 1800000;
/**
 * Enables AB test functionality. This will make extra request to Klevu servers and it is recommended only if you wish to use A/B testing feature.
 *
 * Currently not supported in server side rendering.
 *
 * @category Modifier
 * @returns
 */
function abTest() {
    return {
        klevuModifierId: "abtest",
        modifyAfter: (queries, func) => __awaiter(this, void 0, void 0, function* () {
            var _a, _b, _c;
            // A/B test is not supported in the serverside
            if (!isBrowser()) {
                return Array.from(queries);
            }
            const data = yield fetchAbTestInfo();
            const permanent = JSON.parse((_a = window.localStorage.getItem(STORAGE_PERMANENT_KEY)) !== null && _a !== void 0 ? _a : "[]");
            if (!data) {
                throw new Error("Failed to fetch AB test data");
            }
            // clean permanent data
            const newpermanent = [];
            for (const perm of permanent) {
                if (data.assigned.some((a) => a.abTestId === perm.abTestId && a.sourceId === perm.sourceId)) {
                    newpermanent.push(perm);
                }
            }
            const copy = Array.from(queries);
            for (const q of copy) {
                if (q.typeOfRequest !== KlevuTypeOfRequest.CategoryNavigation) {
                    throw new Error("abtest can only be applied to category navigation");
                }
                const path = (_c = (_b = q.settings) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.categoryPath;
                if (!path) {
                    throw new Error("missing category path from abtest");
                }
                const perm = newpermanent.find((a) => a.sourceId.toLocaleLowerCase() === path.toLocaleLowerCase());
                if (!func.params) {
                    func.params = {};
                }
                if (perm) {
                    q.abTestId = perm.abTestId;
                    q.abTestVariantId = perm.abTestVariantId;
                    func.params.abtest = perm;
                    continue;
                }
                const test = data.assigned.find((a) => a.sourceId.toLocaleLowerCase() === path.toLocaleLowerCase());
                if (!test) {
                    continue;
                }
                if (!newpermanent.some((a) => a.abTestId === test.abTestId && a.sourceId === test.sourceId)) {
                    newpermanent.push(test);
                    post(`https://config-cdn.ksearchnet.com/abtest/public/usage/${KlevuConfig.getDefault().apiKey}`, test, true);
                }
                q.abTestId = test.abTestId;
                q.abTestVariantId = test.abTestVariantId;
                func.params.abtest = test;
            }
            window.localStorage.setItem(STORAGE_PERMANENT_KEY, JSON.stringify(newpermanent));
            return copy;
        }),
    };
}
/**
 * This function never wait for result if there is one in cache. Returns new results on next time.
 *
 * @returns
 */
function fetchAbTestInfo() {
    return __awaiter(this, void 0, void 0, function* () {
        const ts = window.localStorage.getItem(STORAGE_TS_KEY);
        const res = window.localStorage.getItem(STORAGE_KEY);
        const fetch = () => __awaiter(this, void 0, void 0, function* () {
            const data = yield post(`https://config-cdn.ksearchnet.com/abtest/public/allocation/${KlevuConfig.getDefault().apiKey}/`, {});
            window.localStorage.setItem(STORAGE_TS_KEY, new Date().getTime().toString());
            window.localStorage.setItem(STORAGE_KEY, JSON.stringify(data));
            return data;
        });
        if (res && ts) {
            if (new Date().getTime() - parseInt(ts, 10) > HALF_HOUR) {
                // do not wait
                fetch();
            }
            return JSON.parse(res);
        }
        return fetch();
    });
}

const klevuMerchandisingCss = ".header{display:flex;justify-content:space-between;width:100%}.footer{display:flex;justify-content:center}.footer .klevu-pagination{padding:var(--klevu-spacing-03) 0}";

var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
  if (kind === "m")
    throw new TypeError("Private method is not writable");
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a setter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _KlevuMerchandising_instances, _KlevuMerchandising_viewportUtil, _KlevuMerchandising_layoutElement, _KlevuMerchandising_facetListElement, _KlevuMerchandising_resultObject, _KlevuMerchandising_fetchData, _KlevuMerchandising_loadMore, _KlevuMerchandising_paginationChange, _KlevuMerchandising_emitChanges, _KlevuMerchandising_sortChanged, _KlevuMerchandising_sizeChange, _KlevuMerchandising_applyFilters, _KlevuMerchandising_isMobile, _KlevuMerchandising_mobileDrawerOpened;
const KlevuMerchandising$1 = /*@__PURE__*/ proxyCustomElement(class KlevuMerchandising extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.klevuData = createEvent(this, "klevuData", 7);
    _KlevuMerchandising_instances.add(this);
    _KlevuMerchandising_viewportUtil.set(this, void 0);
    _KlevuMerchandising_layoutElement.set(this, void 0);
    _KlevuMerchandising_facetListElement.set(this, void 0);
    _KlevuMerchandising_resultObject.set(this, void 0);
    this.usePagination = undefined;
    this.useInfiniteScroll = undefined;
    this.limit = 24;
    this.category = undefined;
    this.categoryTitle = undefined;
    this.tLoadMore = getTranslation("merchandising.tLoadMore");
    this.sort = undefined;
    this.filterCount = undefined;
    this.options = undefined;
    this.filterCustomOrder = undefined;
    this.sortOptions = undefined;
    this.showRatings = undefined;
    this.showRatingsCount = undefined;
    this.usePersonalisation = undefined;
    this.useABTest = undefined;
    this.currentViewPortSize = undefined;
    this.results = [];
    this.manager = new FilterManager();
    this.loading = false;
    this.infiniteScrollingPaused = false;
    this.searchResultTopBanners = [];
    this.searchResultBottomBanners = [];
  }
  async connectedCallback() {
    var _a, _b;
    await KlevuInit.ready();
    const settings = getKMCSettings();
    if (settings) {
      if (this.showRatings === undefined) {
        this.showRatings = ((_a = settings.klevu_uc_userOptions) === null || _a === void 0 ? void 0 : _a.showRatingsOnCategoryPage) || false;
      }
      if (this.showRatingsCount === undefined) {
        this.showRatingsCount = ((_b = settings.klevu_uc_userOptions) === null || _b === void 0 ? void 0 : _b.showRatingsCountOnCategoryPage) || false;
      }
      if (this.usePersonalisation === undefined && (settings === null || settings === void 0 ? void 0 : settings.klevu_uc_userOptions.enablePersonalisationInCatNav)) {
        this.usePersonalisation = true;
      }
      if (this.useABTest === undefined) {
        this.useABTest = settings.klevu_abTestActive;
      }
    }
    await __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_fetchData).call(this);
  }
  async watchPropHandler(newValue, oldValue) {
    if (newValue !== oldValue) {
      this.manager.clear();
      await __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_fetchData).call(this);
    }
  }
  infiniteScrollLoadMoreHandler() {
    __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_loadMore).call(this);
  }
  infiniteLoadPausedHandler() {
    this.infiniteScrollingPaused = true;
  }
  productClickHandler(event) {
    var _a, _b;
    if (!event.detail.product.id || !event.detail.product.itemGroupId) {
      return;
    }
    if ((_a = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _a === void 0 ? void 0 : _a.categoryMerchandisingClickEvent) {
      (_b = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _b === void 0 ? void 0 : _b.categoryMerchandisingClickEvent({
        productId: event.detail.product.id,
        variantId: event.detail.product.itemGroupId,
        categoryTitle: this.categoryTitle,
      });
    }
  }
  async componentDidLoad() {
    this.currentViewPortSize = await __classPrivateFieldGet(this, _KlevuMerchandising_viewportUtil, "f").getCurrentSize();
  }
  filterManagerFiltersUpdated() {
    if (__classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_isMobile).call(this)) {
      return;
    }
    __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_fetchData).call(this);
  }
  render() {
    var _a, _b, _c;
    const showInfiniteScroll = this.useInfiniteScroll &&
      !this.infiniteScrollingPaused &&
      this.results.length > 0 &&
      ((_a = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _a === void 0 ? void 0 : _a.hasNextPage());
    return (h(Host, null, h("klevu-util-viewport", { onKlevuSizeChanged: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_sizeChange).bind(this), ref: (el) => (__classPrivateFieldSet(this, _KlevuMerchandising_viewportUtil, el, "f")) }), h("klevu-layout-results", { onKlevuDrawerOpened: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_mobileDrawerOpened).bind(this), ref: (el) => (__classPrivateFieldSet(this, _KlevuMerchandising_layoutElement, el, "f")) }, h("slot", { name: "facets", slot: "sidebar" }, h("klevu-facet-list", { ref: (el) => (__classPrivateFieldSet(this, _KlevuMerchandising_facetListElement, el, "f")), accordion: true, customOrder: this.filterCustomOrder, manager: this.manager, useApplyButton: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_isMobile).call(this), onKlevuApplyFilters: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_applyFilters).bind(this) })), h("div", { slot: "header", class: "header" }, h("klevu-typography", { variant: "h1" }, this.categoryTitle), h("klevu-sort", { variant: "inline", onKlevuSortChanged: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_sortChanged).bind(this), options: this.sortOptions })), h("slot", { name: "content", slot: "content" }, h("slot", { name: "topbanners" }, this.searchResultTopBanners.map((b) => (h("klevu-banner", { imageUrl: b.bannerImg, linkUrl: b.redirectUrl, altText: b.bannerAltTag })))), h("klevu-product-grid", null, this.results.map((p) => (h("klevu-product", { product: p, fixedWidth: true, exportparts: parts["klevu-product"], showRatings: this.showRatings, showRatingsCount: this.showRatingsCount })))), this.loading && !this.infiniteScrollingPaused && h("klevu-loading-indicator", null), h("slot", { name: "bottombanners" }, this.searchResultBottomBanners.map((b) => (h("klevu-banner", { imageUrl: b.bannerImg, linkUrl: b.redirectUrl, altText: b.bannerAltTag }))))), h("div", { slot: "footer", class: "footer" }, showInfiniteScroll ? (h("klevu-util-infinite-scroll", { infiniteScrollPauseThreshold: 3, enabled: !!((_b = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _b === void 0 ? void 0 : _b.hasNextPage()) && !this.loading })) : this.usePagination && __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f") ? (h("klevu-pagination", { queryResult: __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f"), onKlevuPaginationChange: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_paginationChange).bind(this) })) : ((_c = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _c === void 0 ? void 0 : _c.hasNextPage()) ? (h("klevu-button", { onClick: __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_loadMore).bind(this) }, this.tLoadMore)) : null))));
  }
  get el() { return this; }
  static get watchers() { return {
    "category": ["watchPropHandler"]
  }; }
  static get style() { return klevuMerchandisingCss; }
}, [1, "klevu-merchandising", {
    "usePagination": [4, "use-pagination"],
    "useInfiniteScroll": [4, "use-infinite-scroll"],
    "limit": [2],
    "category": [1],
    "categoryTitle": [1, "category-title"],
    "tLoadMore": [8, "t-load-more"],
    "sort": [1],
    "filterCount": [2, "filter-count"],
    "options": [16],
    "filterCustomOrder": [16],
    "sortOptions": [16],
    "showRatings": [4, "show-ratings"],
    "showRatingsCount": [4, "show-ratings-count"],
    "usePersonalisation": [4, "use-personalisation"],
    "useABTest": [4, "use-a-b-test"],
    "currentViewPortSize": [32],
    "results": [32],
    "manager": [32],
    "loading": [32],
    "infiniteScrollingPaused": [32],
    "searchResultTopBanners": [32],
    "searchResultBottomBanners": [32]
  }, [[0, "klevuLoadMore", "infiniteScrollLoadMoreHandler"], [0, "klevuInfiniteScrollingPaused", "infiniteLoadPausedHandler"], [0, "klevuProductClick", "productClickHandler"], [4, "klevu-filter-selection-updates", "filterManagerFiltersUpdated"]], {
    "category": ["watchPropHandler"]
  }]);
_KlevuMerchandising_viewportUtil = new WeakMap(), _KlevuMerchandising_layoutElement = new WeakMap(), _KlevuMerchandising_facetListElement = new WeakMap(), _KlevuMerchandising_resultObject = new WeakMap(), _KlevuMerchandising_instances = new WeakSet(), _KlevuMerchandising_fetchData = async function _KlevuMerchandising_fetchData() {
  var _a, _b;
  this.loading = true;
  const modifiers = [
    sendMerchandisingViewEvent(this.categoryTitle),
    listFilters({
      filterManager: this.manager,
      limit: this.filterCount,
      rangeFilterSettings: [
        {
          key: "klevu_price",
          minMax: true,
        },
      ],
    }),
    applyFilterWithManager(this.manager),
  ];
  if (this.usePersonalisation) {
    modifiers.push(personalisation());
  }
  if (this.useABTest) {
    modifiers.push(abTest());
  }
  const result = await KlevuFetch(categoryMerchandising(this.category, Object.assign({ limit: this.limit, sort: this.sort }, this.options), ...modifiers));
  __classPrivateFieldSet(this, _KlevuMerchandising_resultObject, result.queriesById("categoryMerchandising"), "f");
  this.results = (_b = (_a = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _a === void 0 ? void 0 : _a.records) !== null && _b !== void 0 ? _b : [];
  const allBanners = await __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f").getBanners();
  this.searchResultTopBanners = allBanners.filter((b) => b.position === "top");
  this.searchResultBottomBanners = allBanners.filter((b) => b.position === "bottom");
  __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_emitChanges).call(this);
  this.loading = false;
}, _KlevuMerchandising_loadMore = async function _KlevuMerchandising_loadMore() {
  var _a, _b, _c;
  if (!((_a = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _a === void 0 ? void 0 : _a.getPage)) {
    return;
  }
  this.loading = true;
  const nextResultObject = await __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f").getPage();
  __classPrivateFieldSet(this, _KlevuMerchandising_resultObject, nextResultObject === null || nextResultObject === void 0 ? void 0 : nextResultObject.queriesById("categoryMerchandising"), "f");
  this.results = [...this.results, ...((_c = (_b = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _b === void 0 ? void 0 : _b.records) !== null && _c !== void 0 ? _c : [])];
  __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_emitChanges).call(this);
  this.loading = false;
}, _KlevuMerchandising_paginationChange = async function _KlevuMerchandising_paginationChange(event) {
  var _a, _b, _c;
  if (!((_a = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _a === void 0 ? void 0 : _a.getPage)) {
    return;
  }
  this.loading = true;
  const nextResultObject = await __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f").getPage({ pageIndex: event.detail - 1 });
  __classPrivateFieldSet(this, _KlevuMerchandising_resultObject, nextResultObject === null || nextResultObject === void 0 ? void 0 : nextResultObject.queriesById("categoryMerchandising"), "f");
  this.results = (_c = (_b = __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) === null || _b === void 0 ? void 0 : _b.records) !== null && _c !== void 0 ? _c : [];
  __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_emitChanges).call(this);
  this.loading = false;
}, _KlevuMerchandising_emitChanges = function _KlevuMerchandising_emitChanges() {
  if (!__classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f")) {
    return;
  }
  this.klevuData.emit({
    resultObject: __classPrivateFieldGet(this, _KlevuMerchandising_resultObject, "f"),
    records: this.results,
    manager: this.manager,
  });
  this.infiniteScrollingPaused = false;
}, _KlevuMerchandising_sortChanged = async function _KlevuMerchandising_sortChanged(event) {
  this.sort = event.detail;
  await __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_fetchData).call(this);
}, _KlevuMerchandising_sizeChange = function _KlevuMerchandising_sizeChange(event) {
  this.currentViewPortSize = event.detail;
}, _KlevuMerchandising_applyFilters = function _KlevuMerchandising_applyFilters() {
  __classPrivateFieldGet(this, _KlevuMerchandising_instances, "m", _KlevuMerchandising_fetchData).call(this);
  __classPrivateFieldGet(this, _KlevuMerchandising_layoutElement, "f").closeDrawer();
}, _KlevuMerchandising_isMobile = function _KlevuMerchandising_isMobile() {
  var _a, _b;
  return ((_a = this.currentViewPortSize) === null || _a === void 0 ? void 0 : _a.name) === "xs" || ((_b = this.currentViewPortSize) === null || _b === void 0 ? void 0 : _b.name) === "sm";
}, _KlevuMerchandising_mobileDrawerOpened = function _KlevuMerchandising_mobileDrawerOpened() {
  __classPrivateFieldGet(this, _KlevuMerchandising_facetListElement, "f").updateApplyFilterState();
};
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-merchandising", "klevu-accordion", "klevu-banner", "klevu-button", "klevu-checkbox", "klevu-color-swatch", "klevu-drawer", "klevu-dropdown", "klevu-facet", "klevu-facet-list", "klevu-icon", "klevu-layout-results", "klevu-loading-indicator", "klevu-pagination", "klevu-product", "klevu-product-grid", "klevu-rating", "klevu-slider", "klevu-sort", "klevu-typography", "klevu-util-infinite-scroll", "klevu-util-scrollbars", "klevu-util-viewport"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-merchandising":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuMerchandising$1);
      }
      break;
    case "klevu-accordion":
      if (!customElements.get(tagName)) {
        defineCustomElement$n();
      }
      break;
    case "klevu-banner":
      if (!customElements.get(tagName)) {
        defineCustomElement$m();
      }
      break;
    case "klevu-button":
      if (!customElements.get(tagName)) {
        defineCustomElement$l();
      }
      break;
    case "klevu-checkbox":
      if (!customElements.get(tagName)) {
        defineCustomElement$k();
      }
      break;
    case "klevu-color-swatch":
      if (!customElements.get(tagName)) {
        defineCustomElement$j();
      }
      break;
    case "klevu-drawer":
      if (!customElements.get(tagName)) {
        defineCustomElement$i();
      }
      break;
    case "klevu-dropdown":
      if (!customElements.get(tagName)) {
        defineCustomElement$h();
      }
      break;
    case "klevu-facet":
      if (!customElements.get(tagName)) {
        defineCustomElement$g();
      }
      break;
    case "klevu-facet-list":
      if (!customElements.get(tagName)) {
        defineCustomElement$f();
      }
      break;
    case "klevu-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$e();
      }
      break;
    case "klevu-layout-results":
      if (!customElements.get(tagName)) {
        defineCustomElement$d();
      }
      break;
    case "klevu-loading-indicator":
      if (!customElements.get(tagName)) {
        defineCustomElement$c();
      }
      break;
    case "klevu-pagination":
      if (!customElements.get(tagName)) {
        defineCustomElement$b();
      }
      break;
    case "klevu-product":
      if (!customElements.get(tagName)) {
        defineCustomElement$a();
      }
      break;
    case "klevu-product-grid":
      if (!customElements.get(tagName)) {
        defineCustomElement$9();
      }
      break;
    case "klevu-rating":
      if (!customElements.get(tagName)) {
        defineCustomElement$8();
      }
      break;
    case "klevu-slider":
      if (!customElements.get(tagName)) {
        defineCustomElement$7();
      }
      break;
    case "klevu-sort":
      if (!customElements.get(tagName)) {
        defineCustomElement$6();
      }
      break;
    case "klevu-typography":
      if (!customElements.get(tagName)) {
        defineCustomElement$5();
      }
      break;
    case "klevu-util-infinite-scroll":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "klevu-util-scrollbars":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "klevu-util-viewport":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}
defineCustomElement$1();

const KlevuMerchandising = KlevuMerchandising$1;
const defineCustomElement = defineCustomElement$1;

export { KlevuMerchandising, defineCustomElement };

//# sourceMappingURL=klevu-merchandising.js.map