import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{it as n}from"./Tooltip.DJg7muty.js";import{i as r,n as i,r as a}from"./useFocusRing.Ct2U5AmE.js";function o(e){if(!e)return;let t=!0;return n=>{e({...n,preventDefault(){n.preventDefault()},isDefaultPrevented(){return n.isDefaultPrevented()},stopPropagation(){t=!0},continuePropagation(){t=!1,typeof n.continuePropagation==`function`&&n.continuePropagation()},isPropagationStopped(){return t}}),t&&n.stopPropagation()}}function s(e){return{keyboardProps:e.isDisabled?{}:{onKeyDown:o(e.onKeyDown),onKeyUp:o(e.onKeyUp)}}}var c=e(t(),1),l=c.createContext(null);function u(e){let t=(0,c.useContext)(l)||{};i(t,e);let{ref:n,...r}=t;return r}function d(e,t){let{focusProps:i}=a(e),{keyboardProps:o}=s(e),l=n(i,o),d=u(t),f=e.isDisabled?{}:d,p=(0,c.useRef)(e.autoFocus);(0,c.useEffect)(()=>{p.current&&t.current&&r(t.current),p.current=!1},[t]);let m=e.excludeFromTabOrder?-1:0;return e.isDisabled&&(m=void 0),{focusableProps:n({...l,tabIndex:m},f)}}export{l as n,s as r,d as t};