Liferay.Loader.define("style-book-web@2.0.76/js/fragment-collection-preview/FragmentPreview",["module","exports","require","liferay!frontend-js-react-web$react","./VariationPreview","./combine"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.FragmentPreview=function FragmentPreview({fragment:e,namespace:t}){const r=(0,a.useMemo)((()=>function getFragmentVariations(e){var t;const r=(null===(t=e.configuration.fieldSets)||void 0===t?void 0:t.flatMap((e=>e.fields.filter((e=>{var t;return"select"===e.type&&Array.isArray(null===(t=e.typeOptions)||void 0===t?void 0:t.validValues)})).map((e=>e.typeOptions.validValues.map((t=>({label:t.label||t.value,name:e.name,value:t.value}))))))))||[];return(0,i.combine)(...r)}(e)),[e]);return a.default.createElement("section",{className:"fragment-preview p-5"},a.default.createElement("div",{className:"cadmin"},a.default.createElement("h3",{className:"mb-3"},e.label)),a.default.createElement("div",{className:"fragment-preview__list",style:{"--variation-count":r.length}},r.length?r.map((i=>{const l="".concat(e.label," ").concat(i.map((e=>e.label)).join(" "));return a.default.createElement(n.VariationPreview,{fragmentEntryKey:e.fragmentEntryKey,key:l,label:l,namespace:t,previewURL:e.previewURL,showLabel:r.length>1,variation:i})})):a.default.createElement(n.VariationPreview,{fragmentEntryKey:e.fragmentEntryKey,key:e.label,label:e.label,namespace:t,previewURL:e.previewURL,showLabel:!1,variation:[]})))};var a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=a?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),n=r("./VariationPreview"),i=r("./combine");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}}}));
//# sourceMappingURL=FragmentPreview.js.map