{
  "version": 3,
  "sources": ["ssg:https://framer.com/m/Utils-1fqp.js@WCW8B3bCzTF346i8bzJV"],
  "sourcesContent": ["import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{useEffect,useRef,useCallback}from\"react\";import{useScroll,useMotionValueEvent}from\"framer-motion\";export const useResourceCollectionListStore=createStore({totalItems:null,initialLimit:null,limit:null,filterSite:\"\",filter3D:\"\",filterScroll:\"\",filterCode:\"\",filterCopy:\"\",filterInteg:\"\",filterTuto:\"\",filterButton:\"\",filterAnimation:false,filterEffect:false,filterComponent:false,filterInteraction:false,filterWebsite:false,query:\"\"});export const useBlogCollectionListStore=createStore({totalItems:null,initialLimit:null,limit:null,filterGuide:false,filterTip:false,filterTopList:false,query:\"\"});export const useLessonCollectionListStore=createStore({totalItems:null,initialLimit:null,limit:null,filterBeginner:false,filterIntermediate:false,filterAdvanced:false,query:\"\"});export const findQueryInProps=obj=>{if(obj==null)return null;// Check if `query` exists in the current level\nif(obj.hasOwnProperty(\"query\"))return obj.query;// Iterate over the properties\nfor(let key in obj){if(obj.hasOwnProperty(key)&&typeof obj[key]===\"object\"){let result=findQueryInProps(obj[key]);if(result!==null)return result;}}// If `query` is not found\nreturn null;};export const updateQueryInProps=(obj,newQuery)=>{if(obj==null)return obj;// Check if `query` exists in the current level\nif(obj.hasOwnProperty(\"query\"))return{...obj,query:newQuery};// Iterate over the properties\nfor(let key in obj){if(obj.hasOwnProperty(key)&&typeof obj[key]===\"object\"){const updatedChild=updateQueryInProps(obj[key],newQuery);if(updatedChild!==obj[key]){return{...obj,[key]:updatedChild};}}}return obj;};export const useDebounceQuery=(query,store,setStore,delay=50)=>{const lastCallTimeRef=useRef(0);const timeoutIdRef=useRef(null);const updateStore=useCallback(()=>{setStore({query,limit:store.initialLimit});lastCallTimeRef.current=Date.now();},[query,store.initialLimit]);useEffect(()=>{if(store.totalItems!==null&&store.query!==query){const now=Date.now();const timeSinceLastCall=now-lastCallTimeRef.current;if(timeSinceLastCall>=delay){updateStore();}else{if(timeoutIdRef.current){clearTimeout(timeoutIdRef.current);}timeoutIdRef.current=setTimeout(updateStore,delay);}}// Cleanup function\nreturn()=>{if(timeoutIdRef.current){clearTimeout(timeoutIdRef.current);}};},[query,store.initialLimit]);};export const useInfiniteScroll=(store,setStore)=>{const{scrollY}=useScroll();useMotionValueEvent(scrollY,\"change\",latest=>{if(latest>=document.documentElement.offsetHeight-window.innerHeight*1.2){setStore({limit:store.limit+store.initialLimit});}});};\nexport const __FramerMetadata__ = {\"exports\":{\"useLessonCollectionListStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"findQueryInProps\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useDebounceQuery\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useResourceCollectionListStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useBlogCollectionListStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useInfiniteScroll\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"updateQueryInProps\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Utils.map"],
  "mappings": "6HAAqL,IAAMA,EAA+BC,EAAY,CAAC,WAAW,KAAK,aAAa,KAAK,MAAM,KAAK,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAM,aAAa,GAAM,gBAAgB,GAAM,kBAAkB,GAAM,cAAc,GAAM,MAAM,EAAE,CAAC,EAAeC,EAA2BD,EAAY,CAAC,WAAW,KAAK,aAAa,KAAK,MAAM,KAAK,YAAY,GAAM,UAAU,GAAM,cAAc,GAAM,MAAM,EAAE,CAAC,EAAeE,EAA6BF,EAAY,CAAC,WAAW,KAAK,aAAa,KAAK,MAAM,KAAK,eAAe,GAAM,mBAAmB,GAAM,eAAe,GAAM,MAAM,EAAE,CAAC,EAM/tB,IAAMG,EAAkB,CAACC,EAAMC,IAAW,CAAC,GAAK,CAAC,QAAAC,CAAO,EAAEC,EAAU,EAAEC,EAAoBF,EAAQ,SAASG,GAAQ,CAAIA,GAAQ,SAAS,gBAAgB,aAAaC,EAAO,YAAY,KAAKL,EAAS,CAAC,MAAMD,EAAM,MAAMA,EAAM,YAAY,CAAC,CAAG,CAAC,CAAE",
  "names": ["useResourceCollectionListStore", "createStore", "useBlogCollectionListStore", "useLessonCollectionListStore", "useInfiniteScroll", "store", "setStore", "scrollY", "useScroll", "useMotionValueEvent", "latest", "window"]
}
