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,getButtonStyle as c,getButtonStyles as m,getInnerActiveStyles as f}from"../common/styles.js";import{getButtonSetting as g}from"../common/helpers.js";import{Coupon as $}from"../settings/configs/translate.js";let Coupon=({setting:b,builderProps:y,builderAttrs:j,style:v,styles:S,advanced:k,pageContext:C})=>{let{backgroundColorV2:L,textColor:h,enableTextStyle:A}=S??{},{defaultLabel:E,clickedLabel:I,copyContent:x}=b??{},G=l({val:I,uid:y?.uid,settingId:r({id:$?.defaultLabel?.id}),pageContext:C??{}}),N=l({val:I,uid:y?.uid,settingId:r({id:$?.clickedLabel?.id}),pageContext:C??{}}),O=a({defaultLabel:G,clickedLabel:N,copyContent:x,uid:y?.uid,enableTextStyle:A}),P=p(n(L,h)),T=u({uid:y?.uid,styles:S}),_=f(S),q=()=>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>`);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:{...c(v,S)},styles:{...m(S)},advanced:k,pageContext:C})}
    </gp-coupon>
    ${q()}
  `};export{Coupon as default};
