"use client";
import{c as x,d as B,e as S}from"./chunk-CLTGASR6.js";import{a as k,d as a,m}from"./chunk-3CHPBNY2.js";import{s as c}from"./chunk-KEPQUAOX.js";var M=k("EulButton",["active","destructive","destructiveGhost","disabled","endIcon","focusVisible","fullWidth","ghost","iconOnly","iconSizeLarge","iconSizeMedium","iconSizeSmall","primary","root","secondary","sizeLarge","sizeMedium","sizeSmall","startIcon","stroke","noWrap"]);function w(o){let{children:l,endIcon:e,startIcon:i}=o,$=!l&&!!(!i&&e||i&&!e);return S("EulButton",{endIcon:["endIcon",o.size&&`iconSize${a(o.size)}`],root:["root",o.active&&"active",o.disabled&&"disabled",o.focusVisible&&"focusVisible",o.fullWidth&&"fullWidth",o.noWrap&&"noWrap",o.size&&`size${a(o.size)}`,o.variant,$&&"iconOnly"],startIcon:["startIcon",o.size&&`iconSize${a(o.size)}`]})}var t=M;import{Children as A,forwardRef as H,isValidElement as L,useMemo as R}from"react";import{Slot as U,Slottable as G}from"@radix-ui/react-slot";import u from"clsx";import{css as E}from"@emotion/react";var I=m("button")(({theme:o})=>E`
    position: relative;
    display: inline-flex;
    flex-direction: row;
    gap: ${o.spacing(2)};
    align-items: center;
    justify-content: center;
    height: ${o.spacing(11)};
    padding: ${o.spacing(0,3)};
    font-weight: ${o.typography.fontWeightMedium};
    text-decoration: none;
    background-color: transparent;
    border: none;
    border-radius: 100px;
    outline: 1px solid transparent;
    outline-offset: -1px;
    cursor: pointer;
    transition: ${o.transitions.create(["outline-width"],{duration:300})};

    &.${t.noWrap} {
      white-space: nowrap;
    }

    .${t.active}& {
      outline-width: 2px;
    }

    &.${t.fullWidth} {
      width: 100%;
    }

    &.${t.sizeSmall} {
      height: ${o.spacing(8)};
      font-size: ${o.typography.body2.fontSize};
      line-height: ${o.typography.body2.lineHeight};
    }

    &.${t.sizeMedium} {
      height: ${o.spacing(9)};
      font-size: ${o.typography.body1.fontSize};
      line-height: ${o.typography.body1.lineHeight};
    }

    &.${t.sizeLarge} {
      padding: ${o.spacing(0,4)};
      font-size: ${o.typography.body1.fontSize};
      line-height: ${o.typography.body1.lineHeight};
    }

    &.${t.destructive} {
      color: ${o.palette.red[700]};
      background-color: ${o.palette.redOpaque[300]};
      outline-color: ${o.palette.redOpaque[500]};

      &:hover {
        background-color: ${o.palette.redOpaque[400]};
      }
    }

    &.${t.destructiveGhost} {
      color: ${o.palette.red[700]};

      &.${t.active}, &:hover {
        background-color: ${o.palette.redOpaque[400]};
        outline-color: ${o.palette.redOpaque[500]};
      }
    }

    &.${t.ghost} {
      color: ${o.palette.teal[1e3]};
      outline-width: 0;
      outline-color: ${o.palette.background[600]};
      outline-offset: 0;

      .${t.active}& {
        outline-width: 2px;
      }

      &:hover,
      &.${t.active} {
        background-color: ${o.palette.background[600]};
      }
    }

    &.${t.primary} {
      color: ${o.palette.text.button};
      background-color: ${o.palette.teal[600]};
      outline-width: 0;
      outline-color: ${o.palette.teal[900]};
      outline-offset: 0;

      .${t.active}& {
        outline-width: 2px;
      }

      &:hover,
      &.${t.active} {
        background-color: ${o.palette.teal[900]};
      }
    }

    &.${t.secondary} {
      color: ${o.palette.teal[1e3]};
      background-color: ${o.palette.background[500]};
      outline-color: ${o.palette.background[600]};

      &:hover,
      &.${t.active} {
        background-color: ${o.palette.background[600]};

        outline-color: ${o.palette.background[700]};
      }
    }

    &.${t.stroke} {
      color: ${o.palette.teal[1e3]};
      outline-color: ${o.palette.tealOpaque[300]};

      &:hover,
      &.${t.active} {
        background-color: ${o.palette.tealOpaque[200]};
      }
    }

    &.${t.iconOnly} {
      min-width: ${o.spacing(11)};

      &.${t.sizeSmall} {
        min-width: ${o.spacing(8)};
      }

      &.${t.sizeMedium} {
        min-width: ${o.spacing(9)};
      }

      padding: 0;
    }

    &.${t.focusVisible} {
      outline: ${o.spacing(.5)} solid ${o.palette.yellow[600]};
      outline-offset: ${o.spacing(.5)};
    }

    &.${t.disabled},
      &.${t.disabled}:hover,
      &.${t.disabled}.${t.focusVisible} {
      color: ${o.palette.text.disabled};
      background-color: ${o.palette.background[300]};
      outline: none;
      cursor: not-allowed;
    }
  `);import{jsx as d,jsxs as j}from"react/jsx-runtime";var p=H((o,l)=>{let{asChild:e,endIcon:i,fullWidth:$,noWrap:h,size:D,startIcon:f,variant:F,...r}=o,C=e?U:"button",{children:n,className:W,...g}=r,{getRootProps:b,...O}=x({...r,ref:l}),y=B(r),s=w({...o,...O,noWrap:h}),P=f&&d(c,{className:u(s.startIcon),display:"flex",children:f}),V=i&&d(c,{className:u(s.endIcon),display:"flex",children:i}),q=R(()=>{let z={...b(),...y,...g},v=A.toArray(n)[0];return e&&L(v)&&v.type==="a"?{...z,role:"link"}:z},[b,r,y,g,e,n]);if(e&&!n)throw new Error("Button asChild requires children");return j(I,{...q,as:C,className:u(W,s.root),children:[P,d(G,{children:n}),V]})});p.defaultProps={size:"large",variant:"primary"};p.displayName="Button";var T=p;export{t as a,T as b};
