1import{c as B}from"./createContext-DotT5HnY.js";import{u as x}from"./useDirection-BajPvpr3.js";import{P as G}from"./Primitive-Df2ZtYIB.js";import{u as O}from"./Collection-Cy86eJQv.js";import{f as M,E as P,a as k}from"./utils-CC-pqV_U.js";import{a as w}from"./index-CKGhAOWA.js";import{d as N,M as V,o as A,a as $,w as g,f as j,u as i,l as D,j as c}from"./runtime-core.esm-bundler-BUvReHWE.js";const[X,U]=B("RovingFocusGroup");var K=N({__name:"RovingFocusGroup",props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["entryFocus","update:currentTabStopId"],setup(F,{expose:b,emit:I}){const a=F,f=I,{loop:S,orientation:p,dir:y}=V(a),v=x(y),l=w(a,"currentTabStopId",f,{defaultValue:a.defaultCurrentTabStopId,passive:a.currentTabStopId===void 0}),s=c(!1),n=c(!1),d=c(0),{getItems:m,CollectionSlot:T}=O({isProvider:!0});function C(e){const o=!n.value;if(e.currentTarget&&e.target===e.currentTarget&&o&&!s.value){const r=new CustomEvent(P,k);if(e.currentTarget.dispatchEvent(r),f("entryFocus",r),!r.defaultPrevented){const u=m().map(t=>t.ref).filter(t=>t.dataset.disabled!==""),R=u.find(t=>t.getAttribute("data-active")===""),_=u.find(t=>t.getAttribute("data-highlighted")===""),E=u.find(t=>
1t.id===l.value),q=[R,_,E,...u].filter(Boolean);M(q,a.preventScrollOnEntryFocus)}}n.value=!1}function h(){setTimeout(()=>{n.value=!1},1)}return b({getItems:m}),U({loop:S,dir:v,orientation:p,currentTabStopId:l,onItemFocus:e=>{l.value=e},onItemShiftTab:()=>{s.value=!0},onFocusableItemAdd:()=>{d.value++},onFocusableItemRemove:()=>{d.value--}}),(e,o)=>(A(),$(i(T),null,{default:g(()=>[j(i(G),{tabindex:s.value||d.value===0?-1:0,"data-orientation":i(p),as:e.as,"as-child":e.asChild,dir:i(v),style:{outline:"none"},onMousedown:o[0]||(o[0]=r=>n.value=!0),onMouseup:h,onFocus:C,onBlur:o[1]||(o[1]=r=>s.value=!1)},{default:g(()=>[D(e.$slots,"default")]),_:3},8,["tabindex","data-orientation","as","as-child","dir"])]),_:3}))}}),Z=K;export{Z as R,X as i};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.