'use client';
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useEditorMode as s,usePageType as o}from"@gem-sdk/core";import{createStyle as r,createClass as m,createAttr as l,If as a}from"@gem-sdk/system";import{handleClickLink as i}from"../../helpers.js";import{getButtonAttributes as n}from"../common/attrs.js";import{getButtonStyles as c,getTypoStyles as d,getButtonIconStyles as f,getButtonWrapperStyles as p}from"../common/styles.js";import{getButtonClasses as g,getButtonIconClasses as u,getButtonLabelClasses as h,getButtonWrapperClasses as y,getButtonContentWrapperClasses as j,getButtonContainerClasses as b}from"../common/classes.js";import v from"./ButtonIcon.js";import B from"./ButtonLabel.js";import L from"./ButtonLoadingIndicator.js";import{getData as N,getInsertLinkData as k}from"../common/helpers.js";let Button=I=>{let{children:T,advanced:x,className:H,nodePrice:C,customAttrs:M,styles:S={},setting:_={},builderProps:E,builderAttrs:q,wrapClassName:w="",onClick:z}=I,{iconSvg:A,btnLink:D,htmlType:F,loading:G,disabled:J,shouldClearSpace:K,enableBtnLink:O}=_,{enableTextStyle:P=!0}=S,Q=s(),R=o(),{customCss:U,wrapStyle:V,restStyle:W,dataState:X,dataIdAttr:Y,isShowIcon:Z,isScrollToElement:$,getArialLabel:tt,getLabelToDisplay:te,checkIsShowLabel:ts,checkIsEditableLabel:to}=N(I),{HTMLTag:tr,urlData:tm,shouldRenderLink:tl}=k({enableBtnLink:O,htmlType:F,setting:D,defaultTag:"button",pageType:R}),ta=r({...c(S,_.enableHoverEffect)}),ti=r({...d(S)}),tn=r({...d(S),...f(S,_)}),tc=r({...p(W,S)}),td=m({...g({styles:S,className:H,shouldRenderLink:tl,uid:E?.uid,advanced:x})}),tf=m({...u(te(),K,P)}),tp=m({...h(S,to({mode:Q}))}),tg=m({...y(w,H,x?.cssClass)}),tu=m({...j(_)}),th=m({...b()}),ty=l({...n({disabled:J,dataState:X,dataId:Y,arialLabel:tt()})}),tj=t=>{z?.(t),i(D,Q)};return t("div",{style:V,className:th,children:e("div",{...q,style:tc,className:tg,children:[t("style",{type:"text/css",dangerouslySetInnerHTML:{__html:U}}),a($,t("a",{className:"gp-trigger-button-link gp-hidden",href:tm.href,target:tm.target})),e(tr,{...ty,...M,..."button"!==tr&&{setting:tm},style:ta,className:td,onClick:tj,children:[a(G,t(L,{})),e("div",{className:tu,children:[a(Z,t(v,{iconSvg:A??"",styles:tn,classes:tf})),a(P&&ts(),t(B,{label:te(),styles:ti,classes:tp}))]}),a(!!C,C??"")]}),T]})})};export{Button as default};
