"use strict";const r=require("./main-BnSpWlaf.cjs"),u=require("react"),C=require("./useKeysData-Do63LaI0.cjs"),f=require("./css-B0VZnJIa.cjs");require("./jsx-runtime-Dszzpdy0.cjs");require("./provider-Fw6FIHoE.cjs");require("react-dom");const d=({first:n,second:s})=>{const c=u.useMemo(()=>[...n.data,...s.data],[n.data,s.data]),i=u.useCallback(a=>{if(Array.isArray(a)){const o=n.getItem?.(a)??[],l=s.getItem?.(a)??[];return[...o,...l]}return n.getItem?.(a)??s.getItem?.(a)},[n.getItem,s.getItem]),b=u.useCallback((a,o)=>{const l=n.subscribe?.(a,o),g=s.subscribe?.(a,o);return()=>{l?.(),g?.()}},[n.subscribe,s.subscribe]);return u.useMemo(()=>({data:c,getItem:i,subscribe:b}),[c,i,b])},h=({initialData:n}={})=>{const s=r.useInitializerRef(()=>{const e=new Map;return n==null||n.forEach(t=>e.set(t.key,t)),e}),c=r.useInitializerRef(()=>new Map),i=u.useCallback(e=>{const t=new Set(e);c.current.forEach((I,m)=>{t.has(I)&&m()})},[]),b=u.useCallback(e=>{const t=f.a.toArray(e),I=t.map(m=>m.key);t.forEach(m=>s.current.set(m.key,m)),i(I)},[]),a=u.useCallback(e=>{const t=f.a.toArray(e);t.forEach(I=>s.current.delete(I)),i(t)},[]),o=u.useCallback((e,t)=>t==null?()=>{}:(c.current.set(e,t),()=>{c.current.delete(e)}),[c]),l=u.useCallback((e=>{if(e!=null)return Array.isArray(e)?e.map(t=>s.current.get(t)).filter(t=>t!=null):s.current.get(e)}),[]),g=u.useCallback(e=>s.current.has(e),[]);return u.useMemo(()=>({setItem:b,deleteItem:a,subscribe:o,getItem:l,hasItem:g}),[b,a,o,l,g])},p=Object.freeze(Object.defineProperty({__proto__:null,CoreFrame:r.CoreFrame,Frame:r.Frame$2,Item:r.Item,Items:r.Items,createGetItem:r.createGetItem,page:r.page,search:r.search,useCombinedData:d,useData:r.useData,useItem:r.useItem,useKeysData:C.useKeysData,useMapData:h,usePager:r.usePager,useScroller:r.useScroller,useStaticData:r.useStaticData,useUtilContext:r.useUtilContext},Symbol.toStringTag,{value:"Module"}));exports.external=p;
