{"version":3,"file":"watchRepositions.helper.cjs","sources":["../../../../src/hooks/use-viewport-shift/helpers/watchRepositions.helper.ts"],"sourcesContent":["/**\r\n * Re-runs `correct` on every event that can change the panel's box:\r\n * - the wrapper's `style` mutations → floating-ui (re)positioning, incl. the\r\n *   async transition from the off-screen sentinel to the final coordinates;\r\n * - the content resizing (dynamic item lists) — also fires once on observe,\r\n *   covering a wrapper already positioned when the ref attached;\r\n * - viewport resize.\r\n * Returns a cleanup that detaches everything.\r\n */\r\nexport const watchRepositions = (content: HTMLElement, wrapper: HTMLElement, correct: () => void) => {\r\n    const mutation = new MutationObserver(correct)\r\n    mutation.observe(wrapper, { attributes: true, attributeFilter: ['style'] })\r\n\r\n    const resize = new ResizeObserver(correct)\r\n    resize.observe(content)\r\n\r\n    window.addEventListener('resize', correct)\r\n\r\n    return () => {\r\n        mutation.disconnect()\r\n        resize.disconnect()\r\n        window.removeEventListener('resize', correct)\r\n    }\r\n}\r\n"],"names":["watchRepositions","content","wrapper","correct","mutation","resize"],"mappings":"gFASO,MAAMA,EAAmB,CAACC,EAAsBC,EAAsBC,IAAwB,CACjG,MAAMC,EAAW,IAAI,iBAAiBD,CAAO,EAC7CC,EAAS,QAAQF,EAAS,CAAE,WAAY,GAAM,gBAAiB,CAAC,OAAO,EAAG,EAE1E,MAAMG,EAAS,IAAI,eAAeF,CAAO,EACzC,OAAAE,EAAO,QAAQJ,CAAO,EAEtB,OAAO,iBAAiB,SAAUE,CAAO,EAElC,IAAM,CACTC,EAAS,WAAA,EACTC,EAAO,WAAA,EACP,OAAO,oBAAoB,SAAUF,CAAO,CAChD,CACJ"}