"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../text/components/Text.liquid.js"),helpers=require("../../helpers.js"),system=require("@gem-sdk/system"),attrs=require("../common/attrs.js"),styles=require("../common/styles.js"),classes=require("../common/classes.js"),translate=require("../settings/configs/translate.js");const Countdown=e=>{let{setting:s,styles:t,builderProps:a,advanced:r,pageContext:l}=e,{labelTypo:i,numTypo:c,numTypography:n,labelTypography:o,enableLabelTextStyle:d}=t??{},{weekLabel:y,dayLabel:u,hourLabel:m,minuteLabel:g,secondLabel:p,enableWeek:$,enableDay:f,enableHour:C,enableMinute:x,enableSecond:S,redirectUrl:h,autoHideWhenTimeout:q}=s??{},k=!!h?.link,{urlData:v}=helpers.getInsertLinkData("",h),w=system.createStateOrContext({...s,...a}),I=system.createStyle({...styles.getDateStyle(t)}),b=e=>system.createClass({...classes.getDateClasses(e)}),L=system.createClass({...classes.getTextFrontClasses(t)}),j=system.createStyle({...styles.getTextFrontStyle(t)}),A=system.createStyle({...styles.getTextBackStyle(t)}),T=e=>system.createClass({...classes.getTextBackClasses(t,e)}),_=system.createAttr({...attrs.getAttr({uid:a?.uid||""})}),P=system.createAttr({...attrs.getAttrHref({uid:v.href||""})}),D=system.createStyle({...styles.getWrapperStyle(t)}),E=system.createClass({...classes.getWrapperClasses(r?.cssClass)}),F=system.createClass({...classes.getContentClasses({isLiquid:!0,autoHideWhenTimeout:q})}),N=system.createStyle({...styles.getContainStyle(t)}),O=(e,t,r)=>{let y=r&&r in translate.Countdown?translate.Countdown[r]?.id:void 0;return core.template`
    <div style="${I}" class="${b(t)}">
    ${Text_liquid.default({styles:{typography:n,typo:c},setting:{...s,text:"00",excludeFlex:!0,isForceValue:!0},style:j,className:L,builderAttrs:{id:e},builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-text`}})}
    ${system.If(!!d,core.template`
         ${Text_liquid.default({styles:{typography:o,typo:i},setting:{...s,text:t,excludeFlex:!0},translateSetting:y,style:A,className:T(t),builderProps:{...a,uid:a?.uid,uidInteraction:`${a?.uid}-text`},pageContext:l})}
    `)}
    </div>
    `},R=system.createClass({...classes.getLinkClasses()}),B=()=>core.RenderIf(core.isLocalEnv,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-countdown-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-countdown-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
    <gp-countdown-timer
        ${{..._}}
        ${{...P}}
        class="${E}"
        style="${D}"
        gp-data='${JSON.stringify(w).replaceAll("'","&#039;")}'>
        <div id="section-countdown" class="${F}" style="${N}">
        ${system.If(k,`<a
            href="${v.href}"
            target="${v?.target}"
            aria-label="Countdown link"
            class="${R}"
          > </a>`)}
          ${system.If($,O("week",y,"weekLabel"))}
          ${system.If(f,O("day",u,"dayLabel"))}
          ${system.If(C,O("hour",m,"hourLabel"))}
          ${system.If(x,O("minute",g,"minuteLabel"))}
          ${system.If(S,O("second",p,"secondLabel"))}
      </div>
     </gp-countdown-timer>
    ${B()}
  `};exports.default=Countdown;
