{"version":3,"sources":["../../src/middleware/intersecting.ts"],"sourcesContent":["import type { Middleware } from '@floating-ui/dom';\nimport { detectOverflow } from '@floating-ui/dom';\n\nexport function intersecting(): Middleware {\n  return {\n    name: 'intersectionObserver',\n    fn: async middlewareArguments => {\n      const floatingRect = middlewareArguments.rects.floating;\n      const altOverflow = await detectOverflow(middlewareArguments, { altBoundary: true });\n\n      const isIntersectingTop = altOverflow.top < floatingRect.height && altOverflow.top > 0;\n      const isIntersectingBottom = altOverflow.bottom < floatingRect.height && altOverflow.bottom > 0;\n\n      const isIntersecting = isIntersectingTop || isIntersectingBottom;\n\n      return {\n        data: {\n          intersecting: isIntersecting,\n        },\n      };\n    },\n  };\n}\n"],"names":["detectOverflow","intersecting","name","fn","middlewareArguments","floatingRect","rects","floating","altOverflow","altBoundary","isIntersectingTop","top","height","isIntersectingBottom","bottom","isIntersecting","data"],"mappings":";;;;+BAGgBC;;;;;;qBAFe,mBAAmB;AAE3C;IACL,OAAO;QACLC,MAAM;QACNC,IAAI,OAAMC;YACR,MAAMC,eAAeD,oBAAoBE,KAAK,CAACC,QAAQ;YACvD,MAAMC,cAAc,UAAMR,mBAAAA,EAAeI,qBAAqB;gBAAEK,aAAa;YAAK;YAElF,MAAMC,oBAAoBF,YAAYG,GAAG,GAAGN,aAAaO,MAAM,IAAIJ,YAAYG,GAAG,GAAG;YACrF,MAAME,uBAAuBL,YAAYM,MAAM,GAAGT,aAAaO,MAAM,IAAIJ,YAAYM,MAAM,GAAG;YAE9F,MAAMC,iBAAiBL,qBAAqBG;YAE5C,OAAO;gBACLG,MAAM;oBACJf,cAAcc;gBAChB;YACF;QACF;IACF;AACF"}