"use strict";const r=require("react"),T=require("./index-DO-atGp-.js"),d=require("./index-1WIgmEZh.js"),R=require("react/jsx-runtime");function b(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const a=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(o,i,a.get?a:{enumerable:!0,get:()=>e[i]})}}return o.default=e,Object.freeze(o)}const N=b(r);function g(e){const o=e+"CollectionProvider",[i,a]=T.createContextScope(o),[_,m]=i(o,{collectionRef:{current:null},itemMap:new Map}),x=l=>{const{scope:t,children:u}=l,n=r.useRef(null),c=r.useRef(new Map).current;return R.jsx(_,{scope:t,itemMap:c,collectionRef:n,children:u})};x.displayName=o;const p=e+"CollectionSlot",v=d.createSlot(p),S=r.forwardRef((l,t)=>{const{scope:u,children:n}=l,c=m(p,u),s=d.useComposedRefs(t,c.collectionRef);return R.jsx(v,{ref:s,children:n})});S.displayName=p;const C=e+"CollectionItemSlot",I="data-radix-collection-item",y=d.createSlot(C),M=r.forwardRef((l,t)=>{const{scope:u,children:n,...c}=l,s=r.useRef(null),O=d.useComposedRefs(t,s),f=m(C,u);return r.useEffect(()=>(f.itemMap.set(s,{ref:s,...c}),()=>void f.itemMap.delete(s))),R.jsx(y,{[I]:"",ref:O,children:n})});M.displayName=C;function A(l){const t=m(e+"CollectionConsumer",l);return r.useCallback(()=>{const n=t.collectionRef.current;if(!n)return[];const c=Array.from(n.querySelectorAll(`[${I}]`));return Array.from(t.itemMap.values()).sort((f,D)=>c.indexOf(f.ref.current)-c.indexOf(D.ref.current))},[t.collectionRef,t.itemMap])}return[{Provider:x,Slot:S,ItemSlot:M},A,a]}var j=N.createContext(void 0);function E(e){const o=N.useContext(j);return e||o||"ltr"}exports.createCollection=g;exports.useDirection=E;
//# sourceMappingURL=index-De-6atSi.js.map
