'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../common/helpers.js"),s=require("../../text/components/Text.js"),l=require("@gem-sdk/core"),r=require("@gem-sdk/system"),a=require("../common/attrs.js"),i=require("../common/classes.js"),c=require("../common/styles.js"),n=require("../hooks/useCountDownTimer.js");exports.default=o=>{let{setting:d,styles:u,builderProps:y,advanced:m}=o,{labelTypo:x,numTypo:g,labelTypography:C,numTypography:p,enableLabelTextStyle:f}=u??{},{weekLabel:h,dayLabel:j,hourLabel:T,minuteLabel:q,secondLabel:S,enableWeek:k,enableDay:v,enableHour:I,enableMinute:N,enableSecond:b,redirectUrl:E,autoHideWhenTimeout:F}=d??{},w=l.useEditorMode(),{week:D,day:W,hour:A,minute:B,second:L,timeLeft:M,ref:_}=n.default(d,y),H=!!E?.link&&"edit"!==w,O=r.createClass({...i.getTextExpireClasses()});if(d?.autoHideWhenTimeout&&M<=0)return"edit"!==w?null:e.jsx("div",{className:O,children:e.jsx("span",{children:"Countdown is run out of time (this only visible in the editor)"})});let P=r.createAttr({...a.getAttr({uid:y?.uid||""})}),z=r.createStyle({...c.getWrapperStyle(u)}),G=r.createClass({...i.getWrapperClasses(m?.cssClass)}),J=r.createClass({...i.getContentClasses({isLiquid:!1,autoHideWhenTimeout:F})}),K=r.createStyle({...c.getContainStyle(u)}),Q=r.createStyle({...c.getDateStyle(u)}),R=e=>r.createClass({...i.getDateClasses(e)}),U=r.createClass({...i.getTextFrontClasses(u)}),V=r.createStyle({...c.getTextFrontStyle(u)}),X=r.createStyle({...c.getTextBackStyle(u)}),Y=e=>r.createClass({...i.getTextBackClasses(u,e)}),Z=r.createClass({...i.getLinkClasses()}),$=(l,a)=>{let i=t.formatTime(l);return e.jsxs("div",{style:Q,className:R(a),children:[e.jsx(s.default,{styles:{typography:p,typo:g},setting:{htmlTag:"div",text:i,excludeFlex:!0},className:U,style:V,disableEdit:!0}),r.If(!!f,e.jsx(s.default,{styles:{typography:C,typo:x},setting:{text:a,htmlTag:"p",excludeFlex:!0},style:X,className:Y(a),disableEdit:!0}))]})};return e.jsx("div",{ref:_,...P,className:G,style:z,children:e.jsxs("div",{className:J,style:K,children:[r.If(H,e.jsx("a",{href:E?.link,target:E?.target,"aria-label":"Countdown link",className:Z,children:" "})),r.If(k,$(D,h)),r.If(v,$(W,j)),r.If(I,$(A,T)),r.If(N,$(B,q)),r.If(b,$(L,S))]})})};
