{"version":3,"file":"WithSequentialImageIndicators.BeR4zO_U.mjs","names":["useRef","useCallback","__esmMin","window","init_ssg_sandbox_shims","init_npm_react_18_3_1","de","ne","J","init_jsx_runtime","ce","isElementVisible","current","element","style","rect","getNormalizedText","isInsideInteractiveElement","INTERACTIVE_ANCESTOR_SELECTOR","withSequentialImageIndicators","containerRef","frameRef","assignRef","node","ref","renumberIndicators","container","matched","INDICATOR_PATTERN","candidate","aRect","a","bRect","b","label","index","scheduleRenumber","mutationObserver","resizeObserver","onResize","Component","props","init_WithSequentialImageIndicators"],"sources":["https:/framerusercontent.com/modules/qbTMNqcMwY0aH54cvzdF/SKystClLXOc2FKdiAaJF/WithSequentialImageIndicators.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";const INDICATOR_PATTERN=/^\\[\\s*\\d{1,2}\\s*\\]$/;const INTERACTIVE_ANCESTOR_SELECTOR='a[href], button, [role=\"button\"], [tabindex]:not([tabindex=\"-1\"])';function isElementVisible(element){if(typeof window===\"undefined\")return false;let current=element;while(current){const style=window.getComputedStyle(current);if(style.display===\"none\"||style.visibility===\"hidden\"||style.opacity===\"0\"||current.hidden){return false;}current=current.parentElement;}const rect=element.getBoundingClientRect();return rect.width>0&&rect.height>0;}function getNormalizedText(element){return(element.innerText||element.textContent||\"\").trim();}function isInsideInteractiveElement(element){return Boolean(element.closest(INTERACTIVE_ANCESTOR_SELECTOR));}export function withSequentialImageIndicators(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const containerRef=useRef(null);const frameRef=useRef(null);const assignRef=useCallback(node=>{containerRef.current=node;if(typeof ref===\"function\"){ref(node);return;}if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const renumberIndicators=useCallback(()=>{if(typeof window===\"undefined\")return;const container=containerRef.current;if(!container)return;const allElements=Array.from(container.querySelectorAll(\"*\"));const matched=allElements.filter(element=>{if(isInsideInteractiveElement(element))return false;if(!isElementVisible(element))return false;return INDICATOR_PATTERN.test(getNormalizedText(element));});const deepestOnly=matched.filter(element=>{return!matched.some(candidate=>candidate!==element&&element.contains(candidate));});const sorted=[...deepestOnly].sort((a,b)=>{const aRect=a.getBoundingClientRect();const bRect=b.getBoundingClientRect();if(aRect.top!==bRect.top)return aRect.top-bRect.top;return aRect.left-bRect.left;});sorted.forEach((element,index)=>{const label=`[ ${String(index+1).padStart(2,\"0\")} ]`;if(getNormalizedText(element)===label)return;element.textContent=label;});},[]);const scheduleRenumber=useCallback(()=>{if(typeof window===\"undefined\")return;if(frameRef.current!==null)return;frameRef.current=window.requestAnimationFrame(()=>{frameRef.current=null;renumberIndicators();});},[renumberIndicators]);useEffect(()=>{if(typeof window===\"undefined\")return;const container=containerRef.current;if(!container)return;scheduleRenumber();const mutationObserver=new MutationObserver(()=>{scheduleRenumber();});mutationObserver.observe(container,{childList:true,subtree:true,characterData:true,attributes:true,attributeFilter:[\"style\",\"class\",\"hidden\"]});const resizeObserver=typeof ResizeObserver!==\"undefined\"?new ResizeObserver(()=>{scheduleRenumber();}):null;if(resizeObserver){resizeObserver.observe(container);}const onResize=()=>{scheduleRenumber();};window.addEventListener(\"resize\",onResize);return()=>{mutationObserver.disconnect();if(resizeObserver)resizeObserver.disconnect();window.removeEventListener(\"resize\",onResize);if(frameRef.current!==null){window.cancelAnimationFrame(frameRef.current);frameRef.current=null;}};},[scheduleRenumber]);return /*#__PURE__*/_jsx(Component,{ref:assignRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withSequentialImageIndicators\":{\"type\":\"reactHoc\",\"name\":\"withSequentialImageIndicators\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithSequentialImageIndicators.map"],"mappings":"A,gJAA4P,SAASW,EAAiB,EAAQ,CAAC,GAAUR,IAAS,OAAY,MAAO,GAAM,IAAIS,EAAQC,EAAQ,KAAMD,GAAQ,CAAC,IAAME,EAAMX,EAAO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