{"version":3,"file":"FilterRessources1.CtrtCPGr.mjs","names":["useState","useRef","useState","__esmMin","init_npm_react_18_3_1","e","H","_e","c","init_jsx_runtime","ce","de","useObserveData","init_framer_DKtAEkcX","Data","createStore","dataStore","state1","setDataStore","newState","storeState","storeSetters","setStoreState","setter","useStore","state","setState","init_createStore","init_store_js__1_0","withArticleFilter1","store","useFilterRessources1Store","cardRef","cardData","props","matchesPilier","parent","Component","withPilierTous1","setStore","isActive","withPilierPrevention1","withPilierRecouvrement1","withPilierJuridique1","withEmptyState1","isEmpty","setIsEmpty","timer","cards","visibleCount","card","init_FilterRessources1"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/GIZ6rEWpHHdj8ZqHb38A/QfoH1egCNMBHyRJPx62v/FilterRessources1.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{createElement as _createElement}from\"react\";import React,{useEffect,useRef,useState}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// Store Isolé pour la Section 1\nconst useFilterRessources1Store=createStore({activePilier:null});// OVERRIDE À APPLIQUER SUR LES CARTES DE LA SECTION 1\nexport function withArticleFilter1(Component){return props=>{const[store]=useFilterRessources1Store();const cardRef=useRef(null);const cardData=JSON.stringify(props).toLowerCase();const matchesPilier=!store.activePilier||cardData.includes(store.activePilier.toLowerCase());useEffect(()=>{if(cardRef.current){const parent=cardRef.current.parentElement;if(parent){if(!matchesPilier){parent.style.setProperty(\"display\",\"none\",\"important\");}else{parent.style.removeProperty(\"display\");}}}},[matchesPilier,store.activePilier]);return /*#__PURE__*/React.cloneElement(/*#__PURE__*/_jsx(Component,{...props}),{ref:cardRef,\"data-blog-card-s1\":\"true\",\"data-is-visible\":matchesPilier?\"true\":\"false\"});};}// BOUTONS DE FILTRE SECTION 1\nexport function withPilierTous1(Component){return props=>{const[store,setStore]=useFilterRessources1Store();const isActive=store.activePilier===null;return /*#__PURE__*/_createElement(Component,{...props,key:`tous1-${store.activePilier}`,variant:isActive?\"Tous actif\":\"Tous inactif\",style:{...props.style,cursor:\"pointer\"},onClick:e=>{props.onClick?.(e);setStore({activePilier:null});}});};}export function withPilierPrevention1(Component){return props=>{const[store,setStore]=useFilterRessources1Store();const isActive=store.activePilier===\"Pr\\xe9vention\";return /*#__PURE__*/_jsx(Component,{...props,variant:isActive?\"Pr\\xe9vention actif\":\"Pr\\xe9vention inactif\",style:{...props.style,cursor:\"pointer\"},onClick:e=>{props.onClick?.(e);setStore({activePilier:\"Pr\\xe9vention\"});}});};}export function withPilierRecouvrement1(Component){return props=>{const[store,setStore]=useFilterRessources1Store();const isActive=store.activePilier===\"Recouvrement\";return /*#__PURE__*/_jsx(Component,{...props,variant:isActive?\"Recouvrement actif\":\"Recouvrement inactif\",style:{...props.style,cursor:\"pointer\"},onClick:e=>{props.onClick?.(e);setStore({activePilier:\"Recouvrement\"});}});};}export function withPilierJuridique1(Component){return props=>{const[store,setStore]=useFilterRessources1Store();const isActive=store.activePilier===\"Juridique et confirmit\\xe9\";return /*#__PURE__*/_jsx(Component,{...props,variant:isActive?\"Juridique actif\":\"Juridique inactif\",style:{...props.style,cursor:\"pointer\"},onClick:e=>{props.onClick?.(e);setStore({activePilier:\"Juridique et confirmit\\xe9\"});}});};}// EMPTY STATE DÉDIÉ SECTION 1\nexport function withEmptyState1(Component){return props=>{const[store]=useFilterRessources1Store();const[isEmpty,setIsEmpty]=useState(false);useEffect(()=>{const checkEmpty=()=>{const cards=document.querySelectorAll('[data-blog-card-s1=\"true\"]');let visibleCount=0;cards.forEach(card=>{if(card.getAttribute(\"data-is-visible\")===\"true\"){visibleCount++;}});setIsEmpty(cards.length>0&&visibleCount===0);};const timer=setTimeout(checkEmpty,100);return()=>clearTimeout(timer);},[store.activePilier]);if(!isEmpty){return null;}return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withEmptyState1\":{\"type\":\"reactHoc\",\"name\":\"withEmptyState1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withArticleFilter1\":{\"type\":\"reactHoc\",\"name\":\"withArticleFilter1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPilierTous1\":{\"type\":\"reactHoc\",\"name\":\"withPilierTous1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPilierPrevention1\":{\"type\":\"reactHoc\",\"name\":\"withPilierPrevention1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPilierJuridique1\":{\"type\":\"reactHoc\",\"name\":\"withPilierJuridique1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withPilierRecouvrement1\":{\"type\":\"reactHoc\",\"name\":\"withPilierRecouvrement1\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FilterRessources1.map"],"mappings":"A,uMAA8E,SAAgBe,EAAY,EAAO,CACjH,IAAMC,EAAUF,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAGG,CAAM,CAAC,CAAC,CAAC,EACjDC,EAAa,GAAU,CAC1B,OAAOC,GAAW,aAAY,EAASA,EAASH,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAGA,EAAU,MAAM,GAAGG,CAAQ,CAAC,CAAE,EACjIC,EAAW,OAAOH,GAAS,SAAS,OAAO,OAAO,CAAC,GAAGA,CAAM,CAAC,EAAEA,EAC7DI,kBAAa,IAAI,IACjBC,EAAc,GAAU,CAC3B,OAAOH,GAAW,aAAY,EAASA,EAASC,CAAU,GAAG,EAAW,OAAOD,GAAW,SAAS,OAAO,OAAO,CAAC,GAAGC,EAAW,GAAGD,CAAQ,CAAC,EAAEA,EACjJE,EAAa,QAAQ,GAAQE,EAAOH,CAAU,CAAC,CAAE,EACjD,SAASI,GAAU,CACnB,GAAK,CAACC,EAAMC,GAAU1B,EAASoB,CAAU,EAKzC,OAHAV,OACAW,EAAa,IAAIK,CAAQ,MAAYL,EAAa,OAAOK,CAAQ,GAAI,CAAC,CAAC,EACpEd,EAAe,IAAI,IAAMA,EAAe,EAAQ,CAACI,EAAU,MAAME,C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