import{template as t,RenderIf as e,isLocalEnv as s,baseAssetURL as i}from"@gem-sdk/core";import o from"../../button/components/Button.liquid.js";import{getDynamicSourceLocales as l,createSettingId as r,getSettingPreloadData as d}from"../../helpers.js";import{createStateOrContext as a,createClass as p}from"@gem-sdk/system";import{getActiveClasses as n}from"../common/classes.js";import{getInnerBorderCornerCss as u,getInnerActiveStyles as c,getButtonStyles as m,getButtonStyle as f}from"../common/styles.js";import{getButtonSetting as g}from"../common/helpers.js";import{Coupon as $}from"../settings/configs/translate.js";let b=({setting:b,builderProps:y,builderAttrs:j,style:v,styles:S,advanced:k,pageContext:L})=>{let{backgroundColorV2:h,textColor:A,enableTextStyle:C}=S??{},{defaultLabel:E,clickedLabel:I,copyContent:x}=b??{},G=l({val:I,uid:y?.uid,settingId:r({id:$?.defaultLabel?.id}),pageContext:L??{}}),N=l({val:I,uid:y?.uid,settingId:r({id:$?.clickedLabel?.id}),pageContext:L??{}}),O=a({defaultLabel:G,clickedLabel:N,copyContent:x,uid:y?.uid,enableTextStyle:C}),P=p(n(h,A)),T=u({uid:y?.uid,styles:S}),_=c(S);return t`
    <gp-coupon data-id="${y?.uid}" data-active="false" gp-setting='${JSON.stringify(O).replaceAll("'","&#039;")}' class="${P}">
    <style>${`${T}${_}`}</style>
    ${o({builderProps:{...y,uidInteraction:`${y?.uid}-interaction`},builderAttrs:j,setting:{...g({setting:b,label:E,htmlType:"button",styles:S})},translateSetting:$?.defaultLabel?.id,style:{...f(v,S)},styles:{...m(S)},advanced:k,pageContext:L})}
    </gp-coupon>
    ${e(s,`<script ${d('class="gps-link" delay',"src")}="{{ 'gp-coupon-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${d('class="gps-link" delay',"src")}="${i}/assets-v2/gp-coupon-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
  `};export{b as default};
