{"version":3,"file":"CatalogFilterGuard.DCMGwtZf.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/1C9bsn5Ge43mMglnkoPW/YlRRxRbNO2l8QJZttHt2/CatalogFilterGuard.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";export function withFilterReset(Component){return /*#__PURE__*/forwardRef(function FilterReset(props,ref){return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onChangeCapture:event=>{props.onTap?.(event);props.onChangeCapture?.(event);},onFocusCapture:event=>{props.onTap?.(event);props.onFocusCapture?.(event);}});});}export function withNavigationClose(Component){return /*#__PURE__*/forwardRef(function NavigationClose(props,ref){return /*#__PURE__*/_jsx(Component,{...props,ref:ref,onClickCapture:event=>{props.onTap?.(event);props.onClickCapture?.(event);}});});}import{RenderTarget}from\"framer\";// Keep the server's default category out of view until Framer restores URL filters.\nexport function withCatalogNavigation(Component){return /*#__PURE__*/forwardRef(function CatalogNavigation(props,forwardedRef){const root=useRef(null);const[ready,setReady]=useState(false);const frames=useRef([]);const canvas=RenderTarget.current()===RenderTarget.canvas;function afterPaint(callback){frames.current.push(requestAnimationFrame(()=>{frames.current.push(requestAnimationFrame(callback));}));}useEffect(()=>{const labels={construction:\"Строительство\",production:\"Производство\",logistics:\"Логистика\",warehouses:\"Склады\",cleaning:\"Клининг\"};const expected=labels[new URLSearchParams(window.location.search).get(\"job-category\")||\"construction\"];let attempts=0;function revealWhenReady(){const select=root.current?.querySelector(\"select\");const selected=select?.selectedOptions[0]?.textContent;if(!expected||selected===expected||attempts++>=120)afterPaint(()=>setReady(true));else frames.current.push(requestAnimationFrame(revealWhenReady));}revealWhenReady();return()=>frames.current.forEach(cancelAnimationFrame);},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{root.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;},style:{...props.style,visibility:ready||canvas?props.style?.visibility:\"hidden\"},onClickCapture:event=>{props.onClickCapture?.(event);const button=event.target instanceof Element?event.target.closest(\"button\"):null;if(button&&root.current?.contains(button)&&/^[1-3]$/.test(button.textContent?.trim()||\"\")){afterPaint(()=>root.current?.scrollIntoView({block:\"start\",behavior:\"instant\"}));}}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withNavigationClose\":{\"type\":\"reactHoc\",\"name\":\"withNavigationClose\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFilterReset\":{\"type\":\"reactHoc\",\"name\":\"withFilterReset\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCatalogNavigation\":{\"type\":\"reactHoc\",\"name\":\"withCatalogNavigation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CatalogFilterGuard.map"],"mappings":"iMAAmG,SAAgB,EAAgB,EAAU,CAAC,OAAoB,EAAW,SAAqB,EAAM,EAAI,CAAC,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,gBAAgB,GAAO,CAAC,EAAM,QAAQ,CAAK,EAAE,EAAM,kBAAkB,CAAK,CAAE,EAAE,eAAe,GAAO,CAAC,EAAM,QAAQ,CAAK,EAAE,EAAM,iBAAiB,CAAK,CAAE,CAAC,CAAC,CAAE,CAAC,CAAE,CAAC,SAAgB,EAAoB,EAAU,CAAC,OAAoB,EAAW,SAAyB,EAAM,EAAI,CAAC,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAU,MAAI,eAAe,GAAO,CAAC,EAAM,QAAQ,CAAK,EAAE,EAAM,iBAAiB,CAAK,CAAE,CAAC,CAAC,CAAE,CAAC,CAAE,CAC1pB,SAAgB,EAAsB,EAAU,CAAC,OAAoB,EAAW,SAA2B,EAAM,EAAa,CAAC,IAAM,EAAKA,EAAO,IAAI,EAAO,CAAC,EAAM,GAAUC,EAAS,EAAK,EAAQ,EAAOD,EAAO,CAAC,CAAC,EAAQ,EAAO,EAAa,QAAQ,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