import{$t as e,ot as t}from"./icon-K_9KhGme.js";import{T as n,X as r,bt as i,ct as a,j as o,ot as s,pt as c}from"./vue.esm-bundler-DcNPjsgv.js";function l(o,{disabled:l,beforeFocus:u,afterFocus:d,beforeBlur:f,afterBlur:p}={}){let{emit:m}=n(),h=a(),g=s(!1),_=e=>{let t=i(u)?u(e):!1;c(l)||g.value||t||(g.value=!0,m(`focus`,e),d?.())},v=e=>{let t=i(f)?f(e):!1;c(l)||e.relatedTarget&&h.value?.contains(e.relatedTarget)||t||(g.value=!1,m(`blur`,e),p?.())};return r([h,()=>c(l)],([e,t])=>{e&&(t?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,`-1`))}),e(h,`focus`,_,!0),e(h,`blur`,v,!0),e(h,`click`,e=>{c(l)||t(e.target)||h.value?.contains(document.activeElement)&&h.value!==document.activeElement||o.value?.focus()},!0),{isFocused:g,wrapperRef:h,handleFocus:_,handleBlur:v}}function u({afterComposition:e,emit:t}){let n=s(!1),r=e=>{t?.(`compositionstart`,e),n.value=!0},i=e=>{t?.(`compositionupdate`,e),n.value=!0},a=r=>{t?.(`compositionend`,r),n.value&&(n.value=!1,o(()=>e(r)))};return{isComposing:n,handleComposition:e=>{e.type===`compositionend`?a(e):i(e)},handleCompositionStart:r,handleCompositionUpdate:i,handleCompositionEnd:a}}export{l as n,u as t};