import{c as z,J as R,K as C,a2 as l,n as I,N,au as w,t as D,p as L,L as p,w as q}from"./index-ae60edf9.js";import{d as O,$ as o}from"./@vue-cb50a1c4.js";const[U,a]=z("button"),_=R({},C,{tag:l("button"),text:String,icon:String,type:l("default"),size:l("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:l("button"),loadingSize:I,loadingText:String,loadingType:String,iconPosition:l("left")});var E=O({name:U,props:_,emits:["click"],setup(e,{emit:g,slots:t}){const f=N(),b=()=>t.loading?t.loading():o(p,{size:e.loadingSize,type:e.loadingType,class:a("loading")},null),c=()=>{if(e.loading)return b();if(t.icon)return o("div",{class:a("icon")},[t.icon()]);if(e.icon)return o(D,{name:e.icon,class:a("icon"),classPrefix:e.iconPrefix},null)},m=()=>{let n;if(e.loading?n=e.loadingText:n=t.default?t.default():e.text,n)return o("span",{class:a("text")},[n])},x=()=>{const{color:n,plain:r}=e;if(n){const i={color:r?n:"white"};return r||(i.background=n),n.includes("gradient")?i.border=0:i.borderColor=n,i}},y=n=>{e.loading?L(n):e.disabled||(g("click",n),f())};return()=>{const{tag:n,type:r,size:i,block:S,round:B,plain:P,square:k,loading:T,disabled:s,hairline:d,nativeType:h,iconPosition:u}=e,v=[a([r,i,{plain:P,block:S,round:B,square:k,loading:T,disabled:s,hairline:d}]),{[w]:d}];return o(n,{type:h,class:v,style:x(),disabled:s,onClick:y},{default:()=>[o("div",{class:a("content")},[u==="left"&&c(),m(),u==="right"&&c()])]})}}});const V=q(E);export{V as B};
