{"version":3,"file":"Examples.D7IILtr1.mjs","names":["useState","useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js","https:/framer.com/m/framer/utils.js@^0.9.0","https:/framerusercontent.com/modules/ItBFBem6uz2dQBWZscTI/wHFzyTKF6fKpSEXRQvRU/Examples.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","export const centerContent = {\n    display: \"flex\",\n    justifyContent: \"center\",\n    alignItems: \"center\"\n};\nexport const autoSizingText = {\n    width: \"max-content\",\n    wordBreak: \"break-word\",\n    overflowWrap: \"break-word\",\n    overflow: \"hidden\",\n    whiteSpace: \"pre-wrap\",\n    flexShrink: 0\n};\nexport const defaultContainerStyles = {\n    ...centerContent,\n    overflow: \"hidden\"\n};\nexport const containerStyles = defaultContainerStyles;\nexport const randomColor = ()=>\"#\" + Math.floor(Math.random() * 16777215).toString(16)\n;\n\nexport const __FramerMetadata__ = {\"exports\":{\"centerContent\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"containerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"autoSizingText\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"defaultContainerStyles\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"randomColor\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}}}}\n//# sourceMappingURL=./Utils.map","/*\n * Utils (framer/utils@0.9.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/28rXvpPsrum7FH6cMELS/1jCAazZw1EGHjrG5Nu5D/Utils.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";import{useIsStaticRenderer}from\"framer\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{randomColor}from\"https://framer.com/m/framer/utils.js@^0.9.0\";// Learn more: https://www.framer.com/developers/overrides/\nconst useStore=createStore({background:\"#0099FF\"});export function withRotate(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{rotate:90},transition:{duration:2}});});}export function withHover(Component){return /*#__PURE__*/forwardRef((props,ref)=>{return /*#__PURE__*/_jsx(Component,{ref:ref,...props,whileHover:{scale:1.05}});});}export function withRandomColor(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,animate:{background:store.background},onClick:()=>{setStore({background:randomColor()});}});});}export function VerticalNoticeRotator(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const isStatic=useIsStaticRenderer();const hostRef=useRef(null);const trackRef=useRef(null);const itemsRef=useRef([]);const resizeObserverRef=useRef(null);const mutationObserverRef=useRef(null);const cycleTimeoutRef=useRef(null);const retryTimeoutRef=useRef(null);const reducedMotionMediaQueryRef=useRef(null);const reducedMotionRef=useRef(false);const currentIndexRef=useRef(0);const itemHeightRef=useRef(0);const isDisposedRef=useRef(false);const holdDuration=1e3;const transitionDuration=240;const setRefs=useCallback(node=>{hostRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const clearTimers=useCallback(()=>{if(typeof window===\"undefined\")return;if(cycleTimeoutRef.current!==null){window.clearTimeout(cycleTimeoutRef.current);cycleTimeoutRef.current=null;}if(retryTimeoutRef.current!==null){window.clearTimeout(retryTimeoutRef.current);retryTimeoutRef.current=null;}},[]);const isNoticeLabelText=useCallback(value=>{const normalized=value.replace(/\\s+/g,\" \").trim().toUpperCase();return normalized===\"NOTICE\";},[]);const isVisibleElement=useCallback(el=>{const rect=el.getBoundingClientRect();if(rect.height<=0||rect.width<=0)return false;const style=window.getComputedStyle(el);if(style.display===\"none\")return false;if(style.visibility===\"hidden\")return false;return true;},[]);const hasMeaningfulText=useCallback(el=>{const text=(el.textContent??\"\").replace(/\\s+/g,\" \").trim();if(!text)return false;if(isNoticeLabelText(text))return false;return true;},[isNoticeLabelText]);const collectCandidates=useCallback(hostNode=>{const all=Array.from(hostNode.querySelectorAll(\"*\"));return all.filter(el=>{if(!el.isConnected)return false;if(!hostNode.contains(el))return false;if(!isVisibleElement(el))return false;if(!hasMeaningfulText(el))return false;if(el.getAttribute(\"aria-hidden\")===\"true\")return false;if(el.closest(\"[hidden]\"))return false;return true;});},[hasMeaningfulText,isVisibleElement]);const getDepthFromHost=useCallback((hostNode,el)=>{let depth=0;let cursor=el;while(cursor&&cursor!==hostNode){depth+=1;cursor=cursor.parentElement;}return depth;},[]);const findTrackAndItems=useCallback(hostNode=>{const candidates=collectCandidates(hostNode);if(candidates.length===0){return{track:null,items:[]};}const parentSet=new Set;for(const candidate of candidates){let cursor=candidate.parentElement;while(cursor&&cursor!==hostNode){parentSet.add(cursor);cursor=cursor.parentElement;}}parentSet.add(hostNode);let bestParent=null;let bestItems=[];let bestScore=-1;let bestDepth=Number.POSITIVE_INFINITY;for(const parent of Array.from(parentSet)){const children=Array.from(parent.children);if(children.length===0)continue;const grouped=children.filter(child=>{if(!isVisibleElement(child))return false;if(hasMeaningfulText(child))return true;return candidates.some(candidate=>child.contains(candidate));});if(grouped.length===0)continue;const score=grouped.length;const depth=getDepthFromHost(hostNode,parent);if(score>bestScore||score===bestScore&&depth<bestDepth){bestScore=score;bestDepth=depth;bestParent=parent;bestItems=grouped;}}if(!bestParent||bestItems.length===0){const fallbackItem=candidates[0];return{track:fallbackItem?.parentElement,items:fallbackItem?[fallbackItem]:[]};}if(bestParent===hostNode){const firstChild=hostNode.children[0];if(hostNode.children.length===1&&firstChild){const nested=Array.from(firstChild.children);const nestedItems=nested.filter(child=>{if(!isVisibleElement(child))return false;if(hasMeaningfulText(child))return true;return candidates.some(candidate=>child.contains(candidate));});if(nestedItems.length>0){return{track:firstChild,items:nestedItems};}}}return{track:bestParent,items:bestItems};},[collectCandidates,getDepthFromHost,hasMeaningfulText,isVisibleElement]);const applyTransform=useCallback(animated=>{const track=trackRef.current;if(!track)return;const y=currentIndexRef.current*itemHeightRef.current;track.style.transition=animated?`transform ${transitionDuration}ms ease`:\"none\";track.style.transform=`translateY(-${y}px)`;track.style.willChange=animated?\"transform\":\"auto\";},[transitionDuration]);const resetToFirst=useCallback(()=>{currentIndexRef.current=0;applyTransform(false);},[applyTransform]);const runCycle=useCallback(()=>{if(typeof window===\"undefined\")return;if(isDisposedRef.current)return;const count=itemsRef.current.length;const height=itemHeightRef.current;if(count<2||height<=0||reducedMotionRef.current){resetToFirst();return;}currentIndexRef.current=(currentIndexRef.current+1)%count;applyTransform(true);cycleTimeoutRef.current=window.setTimeout(runCycle,holdDuration+transitionDuration);},[applyTransform,holdDuration,resetToFirst,transitionDuration]);const measureAndUpdate=useCallback(()=>{const hostNode=hostRef.current;if(!hostNode)return;const result=findTrackAndItems(hostNode);trackRef.current=result.track;itemsRef.current=result.items;const firstVisible=result.items.find(item=>isVisibleElement(item))??null;const nextHeight=firstVisible?firstVisible.getBoundingClientRect().height:0;itemHeightRef.current=nextHeight;hostNode.style.overflow=\"hidden\";if(nextHeight>0){hostNode.style.height=`${nextHeight}px`;}else{hostNode.style.height=\"\";}if(trackRef.current){const computedDisplay=window.getComputedStyle(trackRef.current).display;if(computedDisplay===\"flex\"){trackRef.current.style.flexDirection=\"column\";}}clearTimers();if(itemsRef.current.length<2||nextHeight<=0||reducedMotionRef.current){resetToFirst();return;}currentIndexRef.current=0;applyTransform(false);cycleTimeoutRef.current=window.setTimeout(runCycle,holdDuration);},[clearTimers,findTrackAndItems,holdDuration,isVisibleElement,resetToFirst,runCycle]);const scheduleRetryMeasurements=useCallback(()=>{if(typeof window===\"undefined\")return;const started=Date.now();const maxDuration=4e3;const step=()=>{if(isDisposedRef.current)return;measureAndUpdate();const hasVisible=itemHeightRef.current>0&&itemsRef.current.length>0;if(hasVisible)return;if(Date.now()-started>=maxDuration)return;retryTimeoutRef.current=window.setTimeout(step,140);};step();},[measureAndUpdate]);useEffect(()=>{if(isStatic)return;if(typeof window===\"undefined\")return;const hostNode=hostRef.current;if(!hostNode)return;isDisposedRef.current=false;reducedMotionMediaQueryRef.current=window.matchMedia(\"(prefers-reduced-motion: reduce)\");reducedMotionRef.current=reducedMotionMediaQueryRef.current.matches;const onReducedMotionChange=()=>{if(!reducedMotionMediaQueryRef.current)return;reducedMotionRef.current=reducedMotionMediaQueryRef.current.matches;measureAndUpdate();};reducedMotionMediaQueryRef.current.addEventListener(\"change\",onReducedMotionChange);resizeObserverRef.current=new ResizeObserver(()=>measureAndUpdate());resizeObserverRef.current.observe(hostNode);for(const child of Array.from(hostNode.querySelectorAll(\"*\"))){resizeObserverRef.current.observe(child);}mutationObserverRef.current=new MutationObserver(()=>{if(!resizeObserverRef.current)return;for(const child of Array.from(hostNode.querySelectorAll(\"*\"))){resizeObserverRef.current.observe(child);}measureAndUpdate();});mutationObserverRef.current.observe(hostNode,{childList:true,subtree:true,characterData:true});window.addEventListener(\"resize\",measureAndUpdate);measureAndUpdate();scheduleRetryMeasurements();return()=>{isDisposedRef.current=true;clearTimers();if(mutationObserverRef.current){mutationObserverRef.current.disconnect();mutationObserverRef.current=null;}if(resizeObserverRef.current){resizeObserverRef.current.disconnect();resizeObserverRef.current=null;}if(reducedMotionMediaQueryRef.current){reducedMotionMediaQueryRef.current.removeEventListener(\"change\",onReducedMotionChange);reducedMotionMediaQueryRef.current=null;}window.removeEventListener(\"resize\",measureAndUpdate);};},[clearTimers,isStatic,measureAndUpdate,scheduleRetryMeasurements]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,style:{...props.style,overflow:\"hidden\"},children:props.children});});}export function CenterNoticeRichTextImages(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const hostRef=useRef(null);const scopeAttribute=\"data-center-notice-media\";const scopeValue=\"true\";const styleId=\"center-notice-richtext-media-style\";const setRefs=useCallback(node=>{hostRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);useEffect(()=>{if(typeof document===\"undefined\")return;const hostNode=hostRef.current;if(!hostNode)return;hostNode.setAttribute(scopeAttribute,scopeValue);if(!document.getElementById(styleId)){const styleElement=document.createElement(\"style\");styleElement.id=styleId;styleElement.textContent=`\n[${scopeAttribute}=\"${scopeValue}\"] img,\n[${scopeAttribute}=\"${scopeValue}\"] picture,\n[${scopeAttribute}=\"${scopeValue}\"] video {\n    display: block;\n    margin-left: auto;\n    margin-right: auto;\n    max-width: 100%;\n    height: auto;\n}\n\n[${scopeAttribute}=\"${scopeValue}\"] figure,\n[${scopeAttribute}=\"${scopeValue}\"] [data-framer-rich-text-media],\n[${scopeAttribute}=\"${scopeValue}\"] [data-framer-rich-text-image],\n[${scopeAttribute}=\"${scopeValue}\"] [class*=\"rich-text-media\"],\n[${scopeAttribute}=\"${scopeValue}\"] [class*=\"rich-text-image\"],\n[${scopeAttribute}=\"${scopeValue}\"] [class*=\"media-wrapper\"] {\n    margin-left: auto;\n    margin-right: auto;\n    text-align: center;\n}\n`;document.head.appendChild(styleElement);}},[]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,style:{...props.style}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"CenterNoticeRichTextImages\":{\"type\":\"reactHoc\",\"name\":\"CenterNoticeRichTextImages\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"VerticalNoticeRotator\":{\"type\":\"reactHoc\",\"name\":\"VerticalNoticeRotator\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRotate\":{\"type\":\"reactHoc\",\"name\":\"withRotate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHover\":{\"type\":\"reactHoc\",\"name\":\"withHover\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRandomColor\":{\"type\":\"reactHoc\",\"name\":\"withRandomColor\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Examples.map"],"mappings":"8MAA8E,SAAgB,EAAY,EAAO,CACjH,IAAM,EAAU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