{"version":3,"file":"ColorSwitcher.BXKZdhfd.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/glCyWzQpm0HZDmv6488a/QQuYgxvaT3nLXmNWyfq0/ColorSwitcher.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{forwardRef,createElement,startTransition}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";// ============================================\n// FARBEN DEFINIEREN\n// Reihenfolge: Index 0, 1, 2, 3\n// Die erste Farbe (Index 0) ist die SSR-/Fallback-Farbe\n// ============================================\nconst colors=[\"#FFE500\",\"#00CCFF\",\"#FF8000\",\"#FFFFFF\"];//               Gelb       Blau       Orange     Weiß\n// ============================================\n// STARTFARBE BESTIMMEN\n// Immer Farbe 0 (Gelb) bei jedem frischen Seitenaufruf.\n// ============================================\nfunction getInitialIndex(){return 0// Fallback: 0=Gelb, 1=Blau, 2=Orange, 3=Weiß\n;}const useStore=createStore({activeIndex:getInitialIndex()});// ============================================\n// OVERRIDE 1: ActiveBackground\n// Wende dieses Override auf jeden Frame an, der die\n// aktive Hintergrundfarbe bekommen soll.\n// Kann auf beliebig viele Frames gleichzeitig angewendet werden.\n// ============================================\nexport function ActiveBackground(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style,backgroundColor:colors[store.activeIndex],transition:\"background-color 0.3s ease\"}});});}// ============================================\n// OVERRIDE 2: ColorButtons\n// Wende dieses Override auf einen leeren Frame an.\n// Er zeigt automatisch 3 Kreise mit den nicht-aktiven Farben.\n// Beim Klick auf einen Kreis wird dessen Farbe zum neuen Hintergrund.\n// ============================================\nexport function ColorButtons(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();// Filtere die aktive Farbe raus – zeige nur die 3 inaktiven\nconst inactive=colors.map((c,i)=>({color:c,index:i})).filter(item=>item.index!==store.activeIndex);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style,display:\"flex\",gap:6,alignItems:\"center\"},children:inactive.map(({color,index})=>/*#__PURE__*/createElement(\"button\",{key:index,onClick:()=>{startTransition(()=>{setStore({activeIndex:index});});},style:{width:14,height:14,borderRadius:\"50%\",backgroundColor:color,border:\"none\",cursor:\"pointer\",padding:0}}))});});}// ============================================\n// OVERRIDE 3: MultiplyImage\n// Wende dieses Override auf ein Frame mit Bildfüllung an.\n// Erzwingt Graustufen + Multiply-Blending, ohne Inhalte/Sizing zu verändern.\n// ============================================\nexport function MultiplyImage(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store]=useStore();const incomingFilter=props?.style?.filter;const mergedFilter=typeof incomingFilter===\"string\"&&incomingFilter.trim().length>0?`${incomingFilter} grayscale(1)`:\"grayscale(1)\";return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:{...props.style,backgroundColor:colors[store.activeIndex],filter:mergedFilter,backgroundBlendMode:\"multiply\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"ActiveBackground\":{\"type\":\"reactHoc\",\"name\":\"ActiveBackground\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"MultiplyImage\":{\"type\":\"reactHoc\",\"name\":\"MultiplyImage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ColorButtons\":{\"type\":\"reactHoc\",\"name\":\"ColorButtons\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ColorSwitcher.map"],"mappings":"uMAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,CAAC,CAAC,EACjD,EAAa,GAAU,CAC1B,OAAO,GAAW,aAAY,EAAS,EAAS,EAAU,KAAK,GAAG,EAAU,MAAM,OAAO,OAAO,CAAC,GAAG,EAAU,MAAM,GAAG,CAAQ,CAAC,CAAE,EACjI,EAAW,OAAO,GAAS,SAAS,OAAO,OAAO,CAAC,GAAG,CAAM,CAAC,EAAE,EAC7D,EAAa,IAAI,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