"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Button_liquid=require("../../button/components/Button.liquid.js"),helpers$1=require("../../helpers.js"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),helpers=require("../common/helpers.js");const Coupon=({setting:e,builderProps:s,builderAttrs:t,style:r,styles:l,advanced:o,pageContext:i})=>{let{backgroundColorV2:n,textColor:u,enableTextStyle:a}=l??{},{defaultLabel:c,clickedLabel:p,copyContent:d}=e??{},y=system.createStateOrContext({defaultLabel:c,clickedLabel:p,copyContent:d,uid:s?.uid,enableTextStyle:a}),g=system.createClass(classes.getActiveClasses(n,u)),m=styles.getInnerBorderCornerCss({uid:s?.uid,styles:l}),$=styles.getInnerActiveStyles(l),S=()=>core.RenderIf(core.isLocalEnv,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-coupon-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${helpers$1.getSettingPreloadData('class="gps-link" delay',"src")}="${core.baseAssetURL}/assets-v2/gp-coupon-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);return core.template`
    <gp-coupon data-id="${s?.uid}" data-active="false" gp-setting='${JSON.stringify(y).replaceAll("'","&#039;")}' class="${g}">
    <style>${`${m}${$}`}</style>
    ${Button_liquid.default({builderProps:{...s,uidInteraction:`${s?.uid}-interaction`},builderAttrs:t,setting:{...helpers.getButtonSetting({setting:e,label:c,htmlType:"button",styles:l})},style:{...styles.getButtonStyle(r,l)},styles:{...styles.getButtonStyles(l)},advanced:o,pageContext:i})}
    </gp-coupon>
    ${S()}
  `};exports.default=Coupon;
