"use strict";var core=require("@gem-sdk/core"),common=require("./common.js"),productFeaturedImage=require("../../product-images/common/productFeaturedImage.js");const getZoomDisplay=e=>common.getDisplayStyle(t=>!core.getResponsiveValueByScreen(e,t),"flex"),HORIZONTAL_LAYOUT=["right","left","inside-left","inside-right"],sizeSettingDefaultForNewLayout={desktop:{shape:"square",shapeValue:"1/1",width:"20%",height:void 0,shapeLinked:!0}},getCarouselVerticalConfigByPosition=e=>{let t=["desktop","mobile","tablet"],o={};return t.forEach(t=>{let i=core.getResponsiveValueByScreen(e,t),r=HORIZONTAL_LAYOUT.includes(i);o=r?{...o,[t]:!0}:{...o,[t]:!1}}),o},getMinHeightByPosition=(e,t)=>{let o=["desktop","mobile","tablet"],i=getCarouselVerticalConfigByPosition(e),r={};return o.forEach(e=>{let o=core.getResponsiveValueByScreen(t,e),s="desktop"===e?"":`${e}:`;r[`${s}!gp-min-h-0`]=!!i[e]&&"outside"===o,r[`${s}!gp-min-h-full`]=!(i[e]&&"outside"===o)}),core.cls({...r})},getEditorMinHeightClass=(e,t,o)=>{let i=getCarouselVerticalConfigByPosition(t),r=core.getResponsiveValueByScreen(o,e);return i[e]&&"outside"===r?"!gp-min-h-0":"!gp-min-h-full"},getAllowDotConfig=()=>({desktop:!0,tablet:!0,mobile:!0}),getDotStyleConfig=()=>({desktop:"none",tablet:"none",mobile:"none"}),getSettingWidthForGridItem=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let i=core.getResponsiveValueByScreen(e.shapeByLayout,o)?.width,r=core.getResponsiveValueByScreen(e.itemSpacing,o),s=0;i?.includes("%")&&(s=100/parseInt(i)),t={...t,[o]:s?`calc(${i} - ${r} * ${s-1} / ${s})`:i}}),t},getSettingWidthForCarouselItem=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let i=core.getResponsiveValueByScreen(e.position,o),r="bottom-center"===i,s=core.getResponsiveValueByScreen(e.shapeByLayout,o)?.width;t={...t,[o]:r&&s?.includes("px")?s:"100%"}}),t},getSettingMinWidthForCarouselItem=e=>{let t={},o=["desktop","mobile","tablet"];return o.forEach(o=>{let i=core.getResponsiveValueByScreen(e.position,o),r=productFeaturedImage.convertUnitToNumber(core.getResponsiveValueByScreen(e.spacing,o),5),s="bottom-center"===i||"inside-bottom"===i,a=core.getResponsiveValueByScreen(e.shapeByLayout,o)?.width,n="100%";if(s){let e=100/productFeaturedImage.convertUnitToNumber(a,20);n=a?.includes("px")?a:a?.includes("%")?`calc(${a} - ${(e-1)*r/e}px)`:"100%"}t={...t,[o]:n}}),t},checkDisplayGalleryByWidth=e=>{let t={desktop:!0,tablet:!0,mobile:!0},o=["desktop","mobile","tablet"];return o.forEach(o=>{let i=core.getResponsiveValueByScreen(e.shapeByLayout,o)?.width??"100%",r=0!==parseInt(i);t={...t,[o]:r}}),t},getSliderPerShowConfig=(e,t)=>{let o={desktop:"auto",tablet:"auto",mobile:"auto"},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=core.getResponsiveValueByScreen(t,i),s="bottom-center"===r||"inside-bottom"===r,a=core.getResponsiveValueByScreen(e,i)?.width,n="auto";a?.includes("%")&&(n=100>parseInt(a)?100/parseInt(a):"auto"),o={...o,[i]:s?n:"auto"}}),o},getShapeByLayout=(e,t)=>{let o={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let r=core.getResponsiveValueByScreen(t,i);switch(r){case"bottom-center":case"bottom-left":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeForBottom,i)};break;case"inside-bottom":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeForInsideBottom??sizeSettingDefaultForNewLayout,i)};break;case"left":case"right":o={...o,[i]:core.getResponsiveValueByScreen(e.shape,i)};break;case"inside-left":case"inside-right":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeForInside??sizeSettingDefaultForNewLayout,i)};break;case"only-feature":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeForFtOnly,i)};break;case"one-col":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeFor1Col,i)};break;case"two-col":o={...o,[i]:core.getResponsiveValueByScreen(e.shapeFor2Col,i)}}}),o};exports.HORIZONTAL_LAYOUT=HORIZONTAL_LAYOUT,exports.checkDisplayGalleryByWidth=checkDisplayGalleryByWidth,exports.getAllowDotConfig=getAllowDotConfig,exports.getCarouselVerticalConfigByPosition=getCarouselVerticalConfigByPosition,exports.getDotStyleConfig=getDotStyleConfig,exports.getEditorMinHeightClass=getEditorMinHeightClass,exports.getMinHeightByPosition=getMinHeightByPosition,exports.getSettingMinWidthForCarouselItem=getSettingMinWidthForCarouselItem,exports.getSettingWidthForCarouselItem=getSettingWidthForCarouselItem,exports.getSettingWidthForGridItem=getSettingWidthForGridItem,exports.getShapeByLayout=getShapeByLayout,exports.getSliderPerShowConfig=getSliderPerShowConfig,exports.getZoomDisplay=getZoomDisplay,exports.sizeSettingDefaultForNewLayout=sizeSettingDefaultForNewLayout;
