define(['exports', 'preact/jsx-runtime', 'preact/compat', './usePress-949a0d03', './usePressClick-b5bf4243', './useHover-7964884c', './useActive-bb5dc069', './TabbableModeContext-a9c97640', './useTabbableMode-dc440317', './useColorScheme-6b864d5c', './classNames-08d99695', './dimensions-fda85d6b', './mergeInterpolations-9ede4cf7', './clientHints-fff66be9', './mergeProps-bcfa6a92', './UNSAFE_BaseButton/themes/redwood/BaseButtonTheme', './useComponentTheme-5aa41a8f', './useTestId-c286f212'], (function(e,t,o,n,i,s,a,r,d,l,u,c,b,p,h,m,v,S){"use strict";const B=[...Object.values(c.dimensionInterpolations)],y=b.mergeInterpolations(B),f="ios"===p.getClientHints().platform?{ontouchstart:function(){}}:{},E="events"===p.getClientHints().hoverSupport,T=o.forwardRef((({variant:e,isReadOnly:o=!1,isDisabled:r=!1,isRepeat:c=!1,isClick:b,size:p,elementDetails:B={type:"button",buttonType:"button"},styling:T=["default"],edge:g="none","aria-label":A,"aria-hidden":w,"aria-expanded":C,"aria-roledescription":H,"aria-haspopup":N,"aria-describedby":I,"aria-pressed":R,"aria-checked":k,"aria-live":x,testId:M,onBlur:D,onFocus:P,onMouseEnter:F,onMouseLeave:L,onTouchEnd:q,onTouchStart:W,onKeyDown:j,...K},O)=>{const U=e=>{K.onAction&&K.onAction({reason:""==e.pointerType?"keyboard":"pointer"})},{pressProps:z}=n.usePress(U,{isDisabled:r||o,isRepeat:c}),{pressProps:_}=i.usePressClick(U,{isDisabled:r||o}),G=e=>T.indexOf(e)>-1,{hoverProps:J,isHover:Q}=s.useHover({isDisabled:!E}),{activeProps:V,isActive:X}=a.useActive({isDisabled:o}),{class:Y,...Z}=y({...K,onBlur:D,onFocus:P,onMouseEnter:F,onMouseLeave:L,onTouchEnd:q,onTouchStart:W,onKeyDown:j}),{type:$="button",isFocusable:ee=!0,isLabel:te=!1,isSwitch:oe=!1,buttonType:ne="button",...ie}={...B},se="button"===$&&"button"===ne?{type:ne}:{},ae=((e,t,o,n,i)=>{switch(e){case"link":return{role:"link"};case"button":return i?{role:"switch"}:{};case"span":return n?{}:t?{role:"none"}:o?i?{role:"switch"}:{role:"button"}:{role:"img"};default:return t?{role:"none"}:o?{role:"button"}:{role:"img"}}})($,w??!1,ee,te,oe),re=B.type,de="span"==re,le="button"==re,{tabbableModeProps:ue}=d.useTabbableMode(r),ce=l.useColorScheme(),{variantClasses:be}=v.useComponentTheme(m.BaseButtonRedwoodTheme,{size:p,variant:e,unstyled:G("unstyled")?"isUnstyled":"notUnstyled",embedded:G("embedded")?"isEmbedded":"notEmbedded",container:G("container")?"isContainer":"notContainer",noBorderRadiusStart:G("noBorderRadiusStart")?"isNoBorderRadiusStart":"notNoBorderRadiusStart",noBorderRadiusEnd:G("noBorderRadiusEnd")?"isNoBorderRadiusEnd":"notNoBorderRadiusEnd",noBorderStart:G("noBorderStart")?"isNoBorderStart":"notNoBorderStart",noBorderEnd:G("noBorderEnd")?"isNoBorderEnd":"notNoBorderEnd",activeStyle:G("active")?"isActiveStyle":"notActiveStyle",selectedStyle:G("selected")?"isSelectedStyle":"notSelectedStyle",buttonSetItem:G("buttonSetItem")?"isButtonSetItem":"notButtonSetItem",trailingItem:G("trailingItem")?"isTrailingItem":"notTrailingItem",fill:G("fill")?"isFill":"notFill",min:G("min")?"isMin":"notMin",disabled:r?"isDisabled":"notDisabled",edge:g,hybrid:E?"isHybrid":"notHybrid",active:X?"isActive":"notActive",hover:Q?"isHover":"notHover",span:de?"isSpan":"notSpan",widthEqual:G("widthEqual")?"isWidthEqual":"notWidthEqual",widthAuto:G("widthAuto")?"isWidthAuto":"notWidthAuto",hiddenLabel:G("hiddenLabel")?"isHidden":"notHidden",noHoverActive:G("noHoverActive")?"isNoHoverActive":"notNoHoverActive",newStackingContext:G("newStackingContext")?"isNewStackingContext":"notNewStackingContext",colorScheme:ce}),pe={onBlur:D,onFocus:P,onMouseEnter:F,onMouseLeave:L,onTouchEnd:q,onTouchStart:W,onKeyDown:j},he=le?{}:r?{"aria-disabled":r}:o?{"aria-disabled":!0}:{},me=N?{"aria-haspopup":N}:{},ve="none"===ae.role?{}:{"aria-label":A,"aria-describedby":I,"aria-hidden":w,"aria-roledescription":H,"aria-expanded":C,"aria-pressed":R,"aria-checked":k,"aria-live":x,...he,...me},Se=void 0===b?!!le:b,Be=h.mergeProps(ie,K.onAction?c||Se?_:z:{},f,J,G("container")?{}:V,pe),ye=u.classNames([Y,be]),fe=S.useTestId(M);return t.jsx(re,{ref:O,disabled:r,class:ye,style:Z,autofocus:K.autofocus,title:K.title,...ve,...de&&(!1===ee||r)||le&&r?{tabIndex:void 0}:ue,...se,...fe,...Be,...ae,children:K.children})}));T.displayName="BaseButton",e.BaseButton=T}));
//# sourceMappingURL=BaseButton-c86afd54.js.map
