import{getResponsiveValueByScreen as e,makeAspectRatio as t,DEVICES as i,makeStyleResponsive as o,removeNullUndefined as l}from"@gem-sdk/core";let r=e=>{let t=e?.desktop,i=e?.tablet===void 0?t:e?.tablet,o=e?.mobile===void 0?i:e?.mobile;return{desktop:t,tablet:i,mobile:o}},a=(e,t)=>{if(!e)return t;if("number"==typeof e)return e;let i=e.replaceAll("px","").replaceAll("%","").replaceAll("rem","").replaceAll("em","");return isNaN(Number(i))?t:Number(i)},n=e=>e?{desktop:a(e.desktop,5),tablet:a(e.tablet,5),mobile:a(e.mobile,5)}:{desktop:5},s=(e,t)=>{let i={};return["desktop","mobile","tablet"].forEach(o=>{i={...i,[`--d${"desktop"===o?"":`-${o}`}`]:`${e(o)?"none":t}`}}),i},d=e=>{let t=e?.["--radius"],i=e?.["--bblr"]||"0px",o=e?.["--bbrr"]||"0px",l=e?.["--btlr"]||"0px",r=e?.["--btrr"]||"0px";return t&&!t.toString().includes("none")&&"0"!==t.toString()||"0px"!==i||"0px"!==o||"0px"!==l||"0px"!==r},b=i=>{let o={};return["desktop","mobile","tablet"].forEach(t=>{let l=e(i,t)?.shapeValue;if(l)o={...o,[t]:l};else{let l=e(i,t)?.shape;switch(l){case"square":o={...o,[t]:"1/1"};break;case"vertical":o={...o,[t]:"3/4"};break;case"horizontal":o={...o,[t]:"4/3"};break;case"original":o={...o,[t]:""}}}}),t(o)},u=t=>{let o={"--gtc":"minmax(0, 12fr)","--gtc-tablet":"minmax(0, 12fr)","--gtc-mobile":"minmax(0, 12fr)"};if(!t.isHiddenGalleryImages){let l=!1;i.forEach(i=>{let r=e(t.position,i),a=e(t.ratioLayout,i),n=e(t.ratioLayoutRight,i),s="desktop"===i?"--gtc":`--gtc-${i}`,d="desktop"===i?"--gtr":`--gtr-${i}`,b="left"===r?a:n,u=["left","right"].includes(r||"");u&&b?(l=!0,Object.assign(o={...o,[s]:`minmax(0, ${b[0]}fr) minmax(0, ${b[1]}fr)`},{[d]:"fit-content(0)"})):l&&Object.assign(o,{[d]:"unset"})})}return o},c=t=>{let i={"--o":"0","--o-tablet":"0","--o-mobile":"0"};return["desktop","mobile","tablet"].forEach(o=>{let l=e(t.position,o),r="desktop"===o?"--o":`--o-${o}`;i={...i,[r]:"left"===l?"1":"0"}}),i},m=t=>{let i={"--o":"1","--o-tablet":"1","--o-mobile":"1"};return["desktop","mobile","tablet"].forEach(o=>{let l=e(t.position,o),r="desktop"===o?"--o":`--o-${o}`;i={...i,[r]:"left"===l?"0":"1"}}),i},p=e=>`{{${e} | image_url: width: 480}} 480w, {{${e} | image_url: width: 768}} 768w, {{${e} | image_url: width: 1024}} 1024w, {{${e} | image_url: width: 1440}} 1440w`,g=e=>{let t=parseInt(e)?`${2*parseInt(e)}px`:`${e} * 2`;return t},f=(t,i,r)=>{let a={},n={},s={},d={},b={},u={};return["desktop","mobile","tablet"].forEach(o=>{let l=e(t,o),c=e(i,o)?.width,m=e(r,o);if(a={...a,[o]:["inside-bottom","inside-left","inside-right"].includes(l)?"absolute":"static"},["inside-bottom"].includes(l)){let e=g(m);c=`calc(100% - ${e})`}["bottom-center","two-col","one-col"].includes(l)&&(c="100%"),s={...s,[o]:"inside-bottom"===l?`${m}`:"auto"},d={...d,[o]:["inside-left","inside-right"].includes(l)?`${m}`:"auto"},u={...u,[o]:["inside-bottom","inside-left"].includes(l)?`${m}`:"auto"},b={...b,[o]:"inside-right"===l?`${m}`:"auto"},n={...n,[o]:c}}),{...o("pos",a),...o("w",l(n)),...o("bottom",l(s)),...o("top",l(d)),...o("left",l(u)),...o("right",l(b))}},h=(t,i)=>{let o=!0,l=!1;return["desktop","mobile","tablet"].forEach(r=>{let a=e(t,r),n=e(i,r);a&&"only-feature"!==a&&(o=!1),(["two-col","one-col"].includes(a)||"images"===n)&&(l=!0)}),{isOnlyFeatureAllDevices:o,isRenderGalleryGrid:l}},k=e=>({...e,setting:{...e.setting}}),$=e=>{let t=e.match(/\d+/g);return t?t[0]:e},y=t=>{let i=b(t),o={desktop:"auto",mobile:"auto",tablet:"auto"};return["desktop","mobile","tablet"].forEach(l=>{let r=e(t,l),a=r?.height,n=r?.width||"",s=$(a||""),d=n.toString().match(/px/g)?$(n):n;if(a&&n&&!isNaN(Number(s))&&!isNaN(Number(d))){o={...o,[l]:`${Number(s)/Number(d)*100}%`};return}if(a&&!isNaN(Number(s))){o={...o,[l]:a};return}let b=i?.[l]!=="auto"&&i?.[l]?i?.[l]?.split("/").reverse().join("/"):"{%if largestRatio == 0%} 100 / 100 {%else%} {{largestRatio}} {%endif%}";o={...o,[l]:`calc((${b})*100%)`}}),o};export{d as checkAddOverFlowClass,n as convertSpacing,g as convertSpacingForIndisdeLayout,a as convertUnitToNumber,b as getAspectRatio,h as getConditionRenderGalleryImages,s as getDisplayStyle,y as getPaddingBottomByShapeSetting,p as getSrcImage,u as getStyleGridLayout,c as getStyleGridOrderForFeature,m as getStyleGridOrderForGallery,f as getStyleInsideLayout,r as getTypeWidthDevice,k as setDefaultWhenUndefineSetting};
