{"version":3,"sources":["../src/components/TeachingPopover/useTeachingPopoverContextValues.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { usePopoverContextValues } from '../Popover/usePopover';\nimport type {\n  TeachingPopoverContextValues,\n  TeachingPopoverState,\n  TeachingPopoverBaseBridgedContextValue,\n} from './TeachingPopover.types';\n\ntype BaseSetOpen = TeachingPopoverBaseBridgedContextValue['setOpen'];\ntype BaseToggleOpen = TeachingPopoverBaseBridgedContextValue['toggleOpen'];\n\n/**\n * Builds both the headless `PopoverContext` value and a\n * `@fluentui/react-popover`-compatible `PopoverContext` value. The bridge\n * lets sub-components consume base hooks from\n * `@fluentui/react-teaching-popover` (e.g. `useTeachingPopoverHeaderBase_unstable`),\n * which read `toggleOpen` / `setOpen` / `triggerRef` from that context.\n *\n * The `@fluentui/react-popover` `OpenPopoverEvents` union is wider than the\n * headless one (it accepts `FocusEvent`). Base hooks never fire focus-driven\n * dismisses, so casting `state.setOpen` / `state.toggleOpen` to those\n * signatures is safe — no extra event types reach them in practice.\n */\nexport const useTeachingPopoverContextValues = (state: TeachingPopoverState): TeachingPopoverContextValues => {\n  const { popover } = usePopoverContextValues(state);\n\n  const basePopover = React.useMemo<TeachingPopoverBaseBridgedContextValue>(\n    () => ({\n      open: state.open,\n      setOpen: state.setOpen as unknown as BaseSetOpen,\n      toggleOpen: state.toggleOpen as unknown as BaseToggleOpen,\n      triggerRef: state.triggerRef,\n      contentRef: state.contentRef,\n      arrowRef: state.arrowRef,\n      openOnHover: state.openOnHover,\n      openOnContext: state.openOnContext,\n      withArrow: state.withArrow,\n    }),\n    [\n      state.open,\n      state.setOpen,\n      state.toggleOpen,\n      state.triggerRef,\n      state.contentRef,\n      state.arrowRef,\n      state.openOnHover,\n      state.openOnContext,\n      state.withArrow,\n    ],\n  );\n\n  return { popover, basePopover };\n};\n"],"names":["useTeachingPopoverContextValues","state","popover","usePopoverContextValues","basePopover","React","useMemo","open","setOpen","toggleOpen","triggerRef","contentRef","arrowRef","openOnHover","openOnContext","withArrow"],"mappings":"AAAA;;;;;+BAyBaA;;;eAAAA;;;;iEAvBU;4BACiB;AAsBjC,MAAMA,kCAAkC,CAACC;IAC9C,MAAM,EAAEC,OAAO,EAAE,GAAGC,IAAAA,mCAAuB,EAACF;IAE5C,MAAMG,cAAcC,OAAMC,OAAO,CAC/B,IAAO,CAAA;YACLC,MAAMN,MAAMM,IAAI;YAChBC,SAASP,MAAMO,OAAO;YACtBC,YAAYR,MAAMQ,UAAU;YAC5BC,YAAYT,MAAMS,UAAU;YAC5BC,YAAYV,MAAMU,UAAU;YAC5BC,UAAUX,MAAMW,QAAQ;YACxBC,aAAaZ,MAAMY,WAAW;YAC9BC,eAAeb,MAAMa,aAAa;YAClCC,WAAWd,MAAMc,SAAS;QAC5B,CAAA,GACA;QACEd,MAAMM,IAAI;QACVN,MAAMO,OAAO;QACbP,MAAMQ,UAAU;QAChBR,MAAMS,UAAU;QAChBT,MAAMU,UAAU;QAChBV,MAAMW,QAAQ;QACdX,MAAMY,WAAW;QACjBZ,MAAMa,aAAa;QACnBb,MAAMc,SAAS;KAChB;IAGH,OAAO;QAAEb;QAASE;IAAY;AAChC"}