System.register(["../../../../common/index-legacy.DRKniymH.js","../../../../common/PresetControl.vue_vue_type_style_index_0_scoped_c9e2dd9e_lang-legacy.CBGxOGwC.js","../../../../common/Preview.vue_vue_type_style_index_0_scoped_e226939c_lang-legacy.Ceu-Swp9.js","../../../../common/Notification.vue_vue_type_script_setup_true_lang-legacy.CmKZ4RFn.js","../../../../common/Confirmation.vue_vue_type_script_setup_true_lang-legacy.CIhxBO6H.js","../../../../common/LabelControl.vue_vue_type_script_setup_true_lang-legacy.DL25Ke3f.js","../../../../common/x-legacy.CxaJbVYS.js","../../../../common/createLucideIcon-legacy.BkLhZkR_.js","../../../../common/transition-legacy.DZbCmrRe.js","../../../../common/keyboard-legacy.ItkZdbDJ.js","../../../../common/open-closed-legacy.CWZrlJ6W.js","../../../../common/micro-task-legacy.D9KKWy-6.js"],(function(e,t){"use strict";var l,s,i,o,n,a,w,c,u,r,m,p,_,v,d,y,b,g,f;return{setters:[e=>{l=e.d,s=e.t,i=e.r,o=e.G,n=e.X,a=e.o,w=e.c,c=e.b,u=e.e,r=e.u,m=e.a,p=e.Q,_=e.g,v=e.h,d=e.H,y=e.Y},null,null,e=>{b=e._},e=>{g=e._},e=>{f=e._},null,null,null,null,null,null],execute:function(){const t={key:0},x={class:"stwlite-tw-flex stwlite-tw-items-center stwlite-tw-mb-2 stwlite-tw-gap-2"},k={class:"stwlite-tw-flex stwlite-tw-items-center stwlite-tw-mb-2 stwlite-tw-gap-2"},h={class:"stwlite-tw-flex stwlite-tw-items-center stwlite-tw-space-x-2"},j=["disabled"],C={key:0},T={key:1},L=["disabled"],A={key:0},H={key:1},N=["for"],O=["innerHTML"],q={key:1,class:"stw-button-control"},B=["id","href","target"],M=["id","type"];e("default",l({__name:"ButtonControl",props:{params:{type:Object,required:!0}},setup(e){const l=e,{params:P}=s(l),S=P.value,Y=i(!!S.link),z=i(S.external?"_blank":"_self"),G=i(!0),I=i(S.action),Q=i(!1),X=i(!1),D=i(""),E=i(""),F=i("");"submit"!==I.value&&"button"!==I.value||(G.value=!1),Y.value&&(G.value=!1);const J=o("confirmText",wp.i18n.__("Are you sure?","saveto-wishlist-lite-for-woocommerce")),K=()=>{Q.value=!0},R=async()=>{X.value=!0;try{const e={action:I.value},t=await y(e);t.type,Q.value=!1,X.value=!1,E.value=t.message,D.value=t.title,F.value=t.type}catch(e){console.error(e)}},U=()=>{Q.value=!1,X.value=!1},V=()=>{E.value=""};return(e,l)=>{const s=n("Tooltip");return G.value?(a(),w("div",t,[c("div",x,[u(r(f),{params:r(S)},null,8,["params"])]),c("div",k,[c("div",h,[r(S).confirmation?(a(),w("button",{key:0,class:"stwlite-tw-bg-blue-600 stwlite-tw-text-white stwlite-tw-px-4 stwlite-tw-py-2 stwlite-tw-rounded-md stwlite-tw-font-medium hover:stwlite-tw-bg-blue-700 stwlite-tw-transition-colors stwlite-tw-border-0 stwlite-tw-cursor-pointer stwlite-tw-mb-3 stwlite-tw-bg-blue-600 hover:stwlite-tw-bg-blue-700",type:"button",disabled:X.value,onClick:K},[X.value?(a(),w("span",C,m(r(o)("loading",r(wp.i18n.__)("Loading...","saveto-wishlist-lite-for-woocommerce"))),1)):(a(),w("span",T,m(r(S).button_label),1))],8,j)):(a(),w("button",{key:1,class:"stwlite-tw-bg-blue-600 stwlite-tw-text-white stwlite-tw-px-4 stwlite-tw-py-2 stwlite-tw-rounded-md stwlite-tw-font-medium hover:stwlite-tw-bg-blue-700 stwlite-tw-transition-colors stwlite-tw-border-0 stwlite-tw-cursor-pointer stwlite-tw-mb-3 stwlite-tw-bg-blue-600 hover:stwlite-tw-bg-blue-700",type:"button",disabled:X.value,onClick:R},[X.value?(a(),w("span",A,m(r(o)("loading",r(wp.i18n.__)("Loading...","saveto-wishlist-lite-for-woocommerce"))),1)):(a(),w("span",H,m(r(S).button_label),1))],8,L)),c("label",{for:r(S).id,class:"stwlite-tw-text-sm stwlite-tw-text-gray-700"},m(r(S).input_label),9,N)]),u(s,{params:r(S)},null,8,["params"])]),"undefined"!==r(S).description?(a(),w("p",{key:0,class:"stwlite-tw-text-sm stwlite-tw-text-gray-600 stwlite-tw-mt-2",innerHTML:r(p)(r(S)?.description??"")},null,8,O)):_("",!0),u(g,{isOpen:Q.value,processing:X.value,title:r(o)("confirmation_title",r(wp.i18n.__)("Confirmation","saveto-wishlist-lite-for-woocommerce")),message:r(J),confirmText:r(o)("yes",r(wp.i18n.__)("Yes","saveto-wishlist-lite-for-woocommerce")),cancelText:r(o)("no",r(wp.i18n.__)("No","saveto-wishlist-lite-for-woocommerce")),onCloseAction:U,onConfirmAction:R},null,8,["isOpen","processing","title","message","confirmText","cancelText"]),E.value?(a(),v(b,{key:1,message:E.value,type:F.value,messageTitle:D.value,onCloseNotification:V},null,8,["message","type","messageTitle"])):_("",!0)])):(a(),w("div",q,[c("div",{class:d(r(S).classes)},[Y.value?(a(),w("a",{key:0,id:r(S).id,href:r(S).link,target:z.value},m(r(S).button_label),9,B)):(a(),w("button",{key:1,id:r(S).id,type:r(S).action},m(r(S).button_label),9,M))],2)]))}}}))}}}));
