import{a as e}from"./chunk-BNv3lrIs.js";import{n as t,t as n}from"./jsx-runtime-pmtNMKr4.js";import{a as r,r as i}from"./ThemeProvider-B0jyGdy2.js";var a=e(r()),o=e(t()),s=n(),c=[`as`,`disabled`];function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function u(e){return!e||e.trim()===`#`}function d({tagName:e,disabled:t,href:n,target:r,rel:i,role:a,onClick:o,tabIndex:s=0,type:c}){e||=n!=null||r!=null||i!=null?`a`:`button`;let l={tagName:e};if(e===`button`)return[{type:c||`button`,disabled:t},l];let d=r=>{if((t||e===`a`&&u(n))&&r.preventDefault(),t){r.stopPropagation();return}o?.(r)};return e===`a`&&(n||=`#`,t&&(n=void 0)),[{role:a??`button`,disabled:void 0,tabIndex:t?void 0:s,href:n,target:e===`a`?r:void 0,"aria-disabled":t||void 0,rel:e===`a`?i:void 0,onClick:d,onKeyDown:e=>{e.key===` `&&(e.preventDefault(),d(e))}},l]}var f=o.forwardRef((e,t)=>{let{as:n,disabled:r}=e,i=l(e,c),[a,{tagName:o}]=d(Object.assign({tagName:n,disabled:r},i));return(0,s.jsx)(o,Object.assign({},i,a,{ref:t}))});f.displayName=`Button`;var p=o.forwardRef(({as:e,bsPrefix:t,variant:n=`primary`,size:r,active:o=!1,disabled:c=!1,className:l,...u},f)=>{let p=i(t,`btn`),[m,{tagName:h}]=d({tagName:e,disabled:c,...u});return(0,s.jsx)(h,{...m,...u,ref:f,disabled:c,className:(0,a.default)(l,p,o&&`active`,n&&`${p}-${n}`,r&&`${p}-${r}`,u.href&&c&&`disabled`)})});p.displayName=`Button`;export{f as n,d as r,p as t};