"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    buildCommonLayout: ()=>buildCommonLayout
});
const external_atomic_layout_section_utils_cjs_namespaceObject = require("./atomic-layout-section-utils.cjs");
function makeDesktopQuery(mobileBreakpoint) {
    return `only screen and (min-width: ${mobileBreakpoint})`;
}
function buildCommonLayout(element, mobileBreakpoint, layoutWebComponentTagName, containerWebComponentTagName, noItemsSelector, errorSelector, refineToggleSelector, sortDropdownSelector) {
    const id = element.id;
    const layoutSelector = `${layoutWebComponentTagName}#${id}`;
    const cleanStatusSelector = `${containerWebComponentTagName}:not(.${noItemsSelector}, .${errorSelector})`;
    const mediaQuerySelector = `@media ${makeDesktopQuery(mobileBreakpoint)}`;
    const display = `${layoutSelector} { display: grid }`;
    const search = `${mediaQuerySelector} {
    ${layoutSelector} ${(0, external_atomic_layout_section_utils_cjs_namespaceObject.sectionSelector)('search')} {
      justify-self: start;
      width: 80%;
    }
  }`;
    const facets = ()=>{
        const facetsSection = (0, external_atomic_layout_section_utils_cjs_namespaceObject.findSection)(element, 'facets');
        const mainSection = (0, external_atomic_layout_section_utils_cjs_namespaceObject.findSection)(element, 'main');
        if (!facetsSection || !mainSection) return '';
        const facetsMin = facetsSection.minWidth || '17rem';
        const facetsMax = facetsSection.maxWidth || '22rem';
        const mainMin = mainSection.minWidth || '50%';
        const mainMax = mainSection.maxWidth || '70rem';
        return `${mediaQuerySelector} {
      ${layoutSelector} {
        grid-template-areas:
        '. .                     atomic-section-search .'
        '. atomic-section-main   atomic-section-main   .';
        grid-template-columns:
          1fr minmax(${facetsMin}, ${facetsMax}) minmax(${mainMin}, ${mainMax}) 1fr;
        column-gap: var(--atomic-layout-spacing-x);
      }

      ${cleanStatusSelector} ${layoutSelector} {
        grid-template-areas:
          '. .                     atomic-section-search .'
          '. atomic-section-facets atomic-section-main   .'
          '. atomic-section-facets .                     .';
      }

      ${cleanStatusSelector} ${layoutSelector} ${(0, external_atomic_layout_section_utils_cjs_namespaceObject.sectionSelector)('facets')} {
        display: block;
      }
    }`;
    };
    const refine = ()=>{
        const statusSection = (0, external_atomic_layout_section_utils_cjs_namespaceObject.findSection)(element, 'status');
        if (!statusSection) return '';
        const refineToggle = statusSection.querySelector(refineToggleSelector);
        if (!refineToggle) return '';
        const statusSelector = `${layoutSelector} ${(0, external_atomic_layout_section_utils_cjs_namespaceObject.sectionSelector)('status')}`;
        return `${statusSelector} ${sortDropdownSelector} {
      display: none;
    }

    ${mediaQuerySelector} {
     ${statusSelector} ${sortDropdownSelector} {
       display: block;
      }

      ${statusSelector} ${refineToggleSelector} {
        display: none;
       }
    }`;
    };
    const horizontalFacets = ()=>`${mediaQuerySelector} {
      ${layoutSelector} ${(0, external_atomic_layout_section_utils_cjs_namespaceObject.sectionSelector)('horizontal-facets')} > atomic-popover:not(.atomic-hidden) {
        display: block;
      }
    }`;
    return [
        display,
        search,
        facets(),
        refine(),
        horizontalFacets()
    ].filter((declaration)=>'' !== declaration).join('\n\n');
}
exports.buildCommonLayout = __webpack_exports__.buildCommonLayout;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "buildCommonLayout"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
