1import{l as D,S as h,m as B,n as U,o as $,P as k}from"./BbJ6DWQs.js";import{e as T,a as m,ab as G,g as y,V as L,aH as V,h as C,T as K,H as j,aD as z,K as H,o as Y,a0 as R,O as Z,P as b,Z as J}from"./nsohPCHa.js";import{g as _}from"./FUKBWQwh.js";function M(){const e=m(),o=T(()=>["#text","#comment"].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:D(e));return{primitiveElement:e,currentElement:o}}const x="data-reka-collection-item";function Q(e={}){const{key:o="",isProvider:l=!1}=e,t=`${o}CollectionProvider`;let r;if(l){const a=m(new Map);r={collectionRef:m(),itemMap:a},j(t,r)}else r=G(t);const w=(a=!1)=>{const n=r.collectionRef.value;if(!n)return[];const s=Array.from(n.querySelectorAll(`[${x}]`)),d=Array.from(r.itemMap.value.values()).sort((f,p)=>s.indexOf(f.ref)-s.indexOf(p.ref));return a?d:d.filter(f=>f.ref.dataset.disabled!=="")},S=y({name:"CollectionSlot",setup(a,{slots:n}){const{primitiveElement:s,currentElement:c}=M();return K(c,()=>{r.collectionRef.value=c.value}),()=>C(h,{ref:s},n)}}),F=y({name:"CollectionItem",inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(a,{slots:n,attrs:s}){const{primitiveElement:c,currentElement:d}=M();return L(f=>{if(d.value){const p=V(d.value);r.itemMap.value.set(p,{ref:d.value,value:a.value}),f(()=>r.itemMap.value.delete(p))}}),()=>C(h,{...s,[x]:"",ref:c},n)}}),A=T(()=>
1Array.from(r.itemMap.value.values())),g=T(()=>r.itemMap.value.size);return{getItems:w,reactiveItems:A,itemMapSize:g,CollectionSlot:S,CollectionItem:F}}const W="rovingFocusGroup.onEntryFocus",X={bubbles:!1,cancelable:!0},ee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function te(e,o){return o!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function le(e,o,l){const t=te(e.key,l);if(!(o==="vertical"&&["ArrowLeft","ArrowRight"].includes(t))&&!(o==="horizontal"&&["ArrowUp","ArrowDown"].includes(t)))return ee[t]}function oe(e,o=!1){const l=_();for(const t of e)if(t===l||(t.focus({preventScroll:o}),_()!==l))return}function ue(e,o){return e.map((l,t)=>e[(o+t)%e.length])}const[ce,re]=$("RovingFocusGroup");var ne=y({__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(e,{expose:o,emit:l}){const t=e,r=l,{loop:w,orientation:S,dir:F}=z(t),A=B(F),g=U(t,"currentTabStopId",r,{defaultValue:t.defaultCurrentTabStopId,passive:t.currentTabStopId===void 0}),a=m(!1),n=m(!1),s=m(0),{getItems:c,CollectionSlot:d}=Q({isProvider:!0});function f(i){const v=!n.value;if(i.currentTarget&&i.target===i.currentTarget&&v&&!a.value){const E=new CustomEvent(W,X);if(i.currentTarget.dispatchEvent(E),r("entryFocus",E),!E.defaultPrevented){const I=c().map(u=>u.ref).filter(u=>u.dataset.disabled!==""),O=I.find(u=>u.getAttribute("data-active")===""),P=I.find(u=>u.getAttribute("data-highlighted")===""),N=I.find(u=>u.id===g.value),q=[O,P,N,...I].filter(Boolean);oe(q,t.preventScrollOnEntryFocus)}}n.value=!1}function p(){setTimeout(()=>{n.value=!1},1)}return o({getItems:c}),re({loop:w,dir:A,orientation:S,currentTabStopId:g,onItemFocus:i=>{g.value=i},onItemShiftTab:()=>{a.value=!0},onFocusableItemAdd:()=>{s.value++},onFocusableItemRemove:()=>{s.value--}}),(i,v)=>(Y(),H(b(d),null,{default:R(()=>[Z(b(k),{tabindex:a.value||s.value===0?-1:0,"data-orientation":b(S),as:i.as,"as-child":i.asChild,dir:b(A),style:{outline:"none"},onMousedown:v[0]||(v[0]=E=>n.value=!0),onMouseup:p,onFocus:f,onBlur:v[1]||(v[1]=E=>a.value=!1)},{default:R(()=>[J(i.$slots,"default")]),_:3},8,["tabindex","data-orientation","as","as-child","dir"])]),_:3}))}}),de=ne;export{de as R,Q as a,oe as f,le as g,ce as i,M as u,ue as w};
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.