"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("@gem-sdk/system"),s=require("../common/attrs.js"),a=require("../common/styles.js"),r=require("../common/classes.js"),l=require("../../helpers.js"),i=require("./ButtonIcon.liquid.js"),n=require("./ButtonLabel.liquid.js"),o=require("./ButtonLoadingIndicator.liquid.js"),u=require("../common/helpers.js");exports.default=c=>{let{advanced:g,className:d,nodePrice:p,customAttrs:y,styles:$={},setting:f={},builderProps:q,wrapClassName:S="",translateSetting:C,isForceValue:L,pageContext:b}=c,{iconSvg:m,btnLink:v,htmlType:B,disabled:I,enableBtnLink:j,shouldClearSpace:k,disabledLoading:h=!0}=f,{enableTextStyle:x=!0}=$,{customCss:E,wrapStyle:T,restStyle:A,dataState:D,dataIdAttr:P,isShowIcon:_,isScrollToElement:M,getArialLabel:O,getLabelToDisplay:W,checkIsShowLabel:G,checkIsEditableLabel:H}=u.getData(c),{HTMLTag:R,urlData:N,shouldRenderLink:U}=u.getInsertLinkData({enableBtnLink:j,htmlType:B,setting:v,defaultTag:"button",isLiquid:!0}),V=t.createStyle({...a.getButtonStyles($,f?.enableHoverEffect)}),w=t.createStyle({...a.getTypoStyles($)}),z=t.createStyle({...a.getTypoStyles($),...a.getButtonIconStyles($,f)}),F=t.createStyle({...a.getButtonWrapperStyles(A,$)}),J=t.createClass({...r.getButtonClasses({styles:$,className:d,shouldRenderLink:U,uid:q?.uid,advanced:g})}),K=t.createClass({...r.getButtonIconClasses(W({isLiquid:!0,translateSetting:C,isForceValue:L,pageContext:b??{}}),k,x)}),Q=t.createClass({...r.getButtonLabelClasses($,H({isLiquid:!0}))}),X=t.createClass({...r.getButtonWrapperClasses(S,d,g?.cssClass)}),Y=t.createClass({...r.getButtonContentWrapperClasses(f)}),Z=t.createClass({...r.getButtonContainerClasses()}),ee=t.createAttr({...s.getButtonAttributes({disabled:I,dataState:D,dataId:P,arialLabel:O({isLiquid:!0})})}),et=t.createStateOrContext({btnLink:f?.btnLink});return t.Liquid(e.template`
    <gp-button
      gp-data='${e.dataStringify(et)}'
      style="${{...T}}"
      class="${Z}"
    >
      <div style="${F}" class="${X}">
        <style>${E}</style>
        ${t.If(M,`<a
            class="gp-trigger-button-link gp-hidden"
            href=${N.href}
            target=${N.target}
          ></a>`)}
        <${R}
          ${{...ee}}
          ${{...y}}
          ${{...N}}
          style="${V}"
          class="${J}"
        >
        ${t.If(!h,o.default(),"")}
        <div class="${Y}">
          ${t.If(_,i.default({iconSvg:m??"",styles:z,classes:K}))}
          ${t.If(x&&G({isLiquid:!0,translateSetting:C,isForceValue:L,pageContext:b??{}}),n.default({label:W({isLiquid:!0,translateSetting:C,isForceValue:L,pageContext:b??{}}),styles:w,classes:Q}))}
        </div>
        ${t.If(!!p,p?.toString()??"","")}
        </${R}>
      </div>
      ${t.If(e.isLocalEnv,`<script ${l.getSettingPreloadData('class="gps-link" delay',"src")}="{{ 'gp-button-v7-5.js' | asset_url }}" defer="defer"></script>`,`<script ${l.getSettingPreloadData('class="gps-link" delay',"src")}="${e.baseAssetURL}/assets-v2/gp-button-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
    </gp-button>
  `)};
