{"version":3,"sources":["jsdelivr-header.js","/npm/@radix-ui/react-popover@1.3.1/src/index.ts","/npm/@radix-ui/react-popover@1.3.1/src/popover.tsx"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,kzBCNA,cAAA,GAAA,SAAA,cAAA,CAAA,OAAA,IAAA,cAAA,MAAA,IAAA,aAAA,MAAA,IAAA,aAAA,QAAA,IAAA,eAAA,YAAA,IAAA,mBAAA,QAAA,IAAA,QAAA,cAAA,IAAA,cAAA,aAAA,IAAA,aAAA,aAAA,IAAA,aAAA,eAAA,IAAA,eAAA,mBAAA,IAAA,mBAAA,cAAA,IAAA,cAAA,aAAA,IAAA,aAAA,eAAA,IAAA,eAAA,OAAA,IAAA,cAAA,KAAA,IAAA,QAAA,MAAA,IAAA,aAAA,QAAA,IAAA,eAAA,mBAAA,IAAA,qBAAA,OAAA,QAAA,aAAA,eCAA,IAAA,MAAuB,QAAA,QAAA,UACvB,+BAAgC,QAAA,qCAChC,iBAAqC,QAAA,uBACrC,0BAAgC,QAAA,gCAChC,qBAAmC,QAAA,2BACnC,+BAAiC,QAAA,qCACjC,0BAA+B,QAAA,gCAC/B,yBAKO,QAAA,+BAEP,gBAAsB,QAAA,sBACtB,gBAAiC,QAAA,QAAA,2BACjC,oBAAkC,QAAA,0BAClC,oBAA0C,QAAA,0BAC1C,sBAAyB,QAAA,4BACzB,uBAA0B,QAAA,6BAC1B,kBAA2B,QAAA,wBAC3B,oCAAqC,QAAA,0CACrC,mBAA2B,QAAA,eAC3B,2BAA6B,QAAA,uBAoEvB,mBAAA,QAAA,qBA5DA,aAAe,WAGd,qBAAsB,qBAAkB,EAAI,qBAAA,oBAAmB,aAAc,CAClF,oBAAA,oBAEI,gBAAA,EAAiB,oBAAA,sBAoBhB,gBAAiB,mBACtB,qBAA0C,cAUtC,QAAkC,OAAC,IACvC,MAAM,eACJ,EAAA,SACA,EACA,KAAM,EAAA,YACN,EAAA,aACA,EAAA,MACA,GAAQ,GACN,EAC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,EAClB,GAAqB,iBAAV,EACX,UAAW,KAAM,OAAO,GAAO,OAAO,MAAM,OACtC,GAAI,EAAI,IAAI,GAIpB,OAAO,EAAI,KAAO,EAAI,MAAM,KAAK,GAAK,KAAK,UAAO,CACpD,CAfS,OAAA,SAAA,YAKA,OAAA,sBAAA","file":"/npm/@radix-ui/react-popover@1.3.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.48.0.\n * Original file: /npm/@radix-ui/react-popover@1.3.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use client';\nexport {\n  createPopoverScope,\n  //\n  Popover,\n  PopoverAnchor,\n  PopoverTrigger,\n  PopoverPortal,\n  PopoverContent,\n  PopoverTitle,\n  PopoverDescription,\n  PopoverClose,\n  PopoverArrow,\n  //\n  Root,\n  Anchor,\n  Trigger,\n  Portal,\n  Content,\n  Title,\n  Description,\n  Close,\n  Arrow,\n} from './popover';\nexport type {\n  PopoverProps,\n  PopoverAnchorProps,\n  PopoverTriggerProps,\n  PopoverPortalProps,\n  PopoverContentProps,\n  PopoverTitleProps,\n  PopoverDescriptionProps,\n  PopoverCloseProps,\n  PopoverArrowProps,\n} from './popover';\n","import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport {\n  FocusScope,\n  FocusScopeBranchProvider,\n  useFocusScopeBranch,\n  useFocusScopeBranchRegistry,\n} from '@radix-ui/react-focus-scope';\nimport type { FocusScopeBranchRegistry } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { createSlot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { hideOthers } from 'aria-hidden';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * Popover\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPOVER_NAME = 'Popover';\n\ntype ScopedProps<P> = P & { __scopePopover?: Scope | undefined };\nconst [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n  createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface PopoverContextValue {\n  triggerRef: React.RefObject<HTMLButtonElement | null>;\n  contentId: string;\n  titleId: string;\n  descriptionId: string;\n  titlePresent: boolean;\n  descriptionPresent: boolean;\n  setTitleCount: React.Dispatch<React.SetStateAction<number>>;\n  setDescriptionCount: React.Dispatch<React.SetStateAction<number>>;\n  open: boolean;\n  onOpenChange(open: boolean): void;\n  onOpenToggle(): void;\n  hasCustomAnchor: boolean;\n  onCustomAnchorAdd(): void;\n  onCustomAnchorRemove(): void;\n  modal: boolean;\n}\n\nconst [PopoverProvider, usePopoverContext] =\n  createPopoverContext<PopoverContextValue>(POPOVER_NAME);\n\ninterface PopoverProps {\n  children?: React.ReactNode | undefined;\n  open?: boolean | undefined;\n  defaultOpen?: boolean | undefined;\n  onOpenChange?: { bivarianceHack(open: boolean): void }['bivarianceHack'] | undefined;\n  modal?: boolean | undefined;\n}\n\nconst Popover: React.FC<PopoverProps> = (props: ScopedProps<PopoverProps>) => {\n  const {\n    __scopePopover,\n    children,\n    open: openProp,\n    defaultOpen,\n    onOpenChange,\n    modal = false,\n  } = props;\n  const popperScope = usePopperScope(__scopePopover);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n  const [titleCount, setTitleCount] = React.useState(0);\n  const [descriptionCount, setDescriptionCount] = React.useState(0);\n  const [open, setOpen] = useControllableState({\n    prop: openProp,\n    defaultProp: defaultOpen ?? false,\n    onChange: onOpenChange,\n    caller: POPOVER_NAME,\n  });\n\n  return (\n    <PopperPrimitive.Root {...popperScope}>\n      <PopoverProvider\n        scope={__scopePopover}\n        contentId={useId()}\n        titleId={useId()}\n        descriptionId={useId()}\n        titlePresent={titleCount > 0}\n        descriptionPresent={descriptionCount > 0}\n        setTitleCount={setTitleCount}\n        setDescriptionCount={setDescriptionCount}\n        triggerRef={triggerRef}\n        open={open}\n        onOpenChange={setOpen}\n        onOpenToggle={React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen])}\n        hasCustomAnchor={hasCustomAnchor}\n        onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n        onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n        modal={modal}\n      >\n        {children}\n      </PopoverProvider>\n    </PopperPrimitive.Root>\n  );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverAnchor\n * -----------------------------------------------------------------------------------------------*/\n\nconst ANCHOR_NAME = 'PopoverAnchor';\n\ntype PopoverAnchorElement = React.ComponentRef<typeof PopperPrimitive.Anchor>;\ntype PopperAnchorProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Anchor>;\ninterface PopoverAnchorProps extends PopperAnchorProps {}\n\nconst PopoverAnchor = /* @__PURE__ */ React.forwardRef<PopoverAnchorElement, PopoverAnchorProps>(\n  function PopoverAnchor(props: ScopedProps<PopoverAnchorProps>, forwardedRef) {\n    const { __scopePopover, ...anchorProps } = props;\n    const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n    const popperScope = usePopperScope(__scopePopover);\n    const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n\n    React.useEffect(() => {\n      onCustomAnchorAdd();\n      return () => onCustomAnchorRemove();\n    }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\n    return <PopperPrimitive.Anchor {...popperScope} {...anchorProps} ref={forwardedRef} />;\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'PopoverTrigger';\n\ntype PopoverTriggerElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface PopoverTriggerProps extends PrimitiveButtonProps {}\n\nconst PopoverTrigger = /* @__PURE__ */ React.forwardRef<PopoverTriggerElement, PopoverTriggerProps>(\n  function PopoverTrigger(props: ScopedProps<PopoverTriggerProps>, forwardedRef) {\n    const { __scopePopover, ...triggerProps } = props;\n    const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n    const popperScope = usePopperScope(__scopePopover);\n    const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n\n    const trigger = (\n      <Primitive.button\n        type=\"button\"\n        aria-haspopup=\"dialog\"\n        aria-expanded={context.open}\n        aria-controls={context.open ? context.contentId : undefined}\n        data-state={getState(context.open)}\n        {...triggerProps}\n        ref={composedTriggerRef}\n        onClick={composeEventHandlers(props.onClick, context.onOpenToggle)}\n      />\n    );\n\n    return context.hasCustomAnchor ? (\n      trigger\n    ) : (\n      <PopperPrimitive.Anchor asChild {...popperScope}>\n        {trigger}\n      </PopperPrimitive.Anchor>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'PopoverPortal';\n\ntype PortalContextValue = { forceMount?: true | undefined };\nconst [PortalProvider, usePortalContext] = createPopoverContext<PortalContextValue>(PORTAL_NAME, {\n  forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PopoverPortalProps {\n  children?: React.ReactNode | undefined;\n  /**\n   * Specify a container element to portal the content into.\n   */\n  container?: PortalProps['container'] | undefined;\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true | undefined;\n}\n\nconst PopoverPortal: React.FC<PopoverPortalProps> = (props: ScopedProps<PopoverPortalProps>) => {\n  const { __scopePopover, forceMount, children, container } = props;\n  const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n  return (\n    <PortalProvider scope={__scopePopover} forceMount={forceMount}>\n      <Presence present={forceMount || context.open}>\n        <PortalPrimitive asChild container={container}>\n          {children}\n        </PortalPrimitive>\n      </Presence>\n    </PortalProvider>\n  );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'PopoverContent';\n\ninterface PopoverContentProps extends PopoverContentTypeProps {\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true | undefined;\n}\n\nconst PopoverContent = /* @__PURE__ */ React.forwardRef<\n  PopoverContentTypeElement,\n  PopoverContentProps\n>(\n  // blank line to reduce diff noise\n  function PopoverContent(props: ScopedProps<PopoverContentProps>, forwardedRef) {\n    const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n    const { forceMount = portalContext.forceMount, ...contentProps } = props;\n    const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n    return (\n      <Presence present={forceMount || context.open}>\n        {context.modal ? (\n          <PopoverContentModal {...contentProps} ref={forwardedRef} />\n        ) : (\n          <PopoverContentNonModal {...contentProps} ref={forwardedRef} />\n        )}\n      </Presence>\n    );\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Slot = createSlot('PopoverContent.RemoveScroll');\n\ntype PopoverContentTypeElement = PopoverContentImplElement;\ninterface PopoverContentTypeProps extends Omit<\n  PopoverContentImplProps,\n  'trapFocus' | 'disableOutsidePointerEvents' | 'branchRegistry' | 'branchNodes'\n> {}\n\nconst PopoverContentModal = /* @__PURE__ */ React.forwardRef<\n  PopoverContentTypeElement,\n  PopoverContentTypeProps\n>(\n  // blank line to reduce diff noise\n  function PopoverContentModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n    const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n    const contentRef = React.useRef<HTMLDivElement>(null);\n    const composedRefs = useComposedRefs(forwardedRef, contentRef);\n    const isRightClickOutsideRef = React.useRef(false);\n\n    // Allows nested portalled layers to register themselves as branches of this\n    // modal `Popover` so focus isn't reclaimed and scroll isn't locked for\n    // them. See: https://github.com/radix-ui/primitives/issues/3423\n    const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();\n\n    // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n    React.useEffect(() => {\n      const content = contentRef.current;\n      if (content) return hideOthers(content);\n    }, []);\n\n    return (\n      <RemoveScroll\n        as={Slot}\n        allowPinchZoom\n        shards={React.useMemo(\n          () => [contentRef, ...branchNodes.map((node) => ({ current: node }))],\n          [contentRef, branchNodes],\n        )}\n      >\n        <PopoverContentImpl\n          {...props}\n          ref={composedRefs}\n          branchNodes={branchNodes}\n          branchRegistry={branchRegistry}\n          // we make sure we're not trapping once it's been closed\n          // (closed !== unmounted when animating out)\n          trapFocus={context.open}\n          disableOutsidePointerEvents\n          onCloseAutoFocus={composeEventHandlers(props.onCloseAutoFocus, (event) => {\n            event.preventDefault();\n            if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n          })}\n          onPointerDownOutside={composeEventHandlers(\n            props.onPointerDownOutside,\n            (event) => {\n              const originalEvent = event.detail.originalEvent;\n              const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n              const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n\n              isRightClickOutsideRef.current = isRightClick;\n            },\n            { checkForDefaultPrevented: false },\n          )}\n          // When focus is trapped, a `focusout` event may still happen.\n          // We make sure we don't trigger our `onDismiss` in such case.\n          onFocusOutside={composeEventHandlers(\n            props.onFocusOutside,\n            (event) => event.preventDefault(),\n            { checkForDefaultPrevented: false },\n          )}\n        />\n      </RemoveScroll>\n    );\n  },\n);\n\nconst PopoverContentNonModal = /* @__PURE__ */ React.forwardRef<\n  PopoverContentTypeElement,\n  PopoverContentTypeProps\n>(\n  // blank line to reduce diff noise\n  function PopoverContentNonModal(props: ScopedProps<PopoverContentTypeProps>, forwardedRef) {\n    const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n    const hasInteractedOutsideRef = React.useRef(false);\n    const hasPointerDownOutsideRef = React.useRef(false);\n\n    return (\n      <PopoverContentImpl\n        {...props}\n        ref={forwardedRef}\n        trapFocus={false}\n        disableOutsidePointerEvents={false}\n        onCloseAutoFocus={(event) => {\n          props.onCloseAutoFocus?.(event);\n\n          if (!event.defaultPrevented) {\n            if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n            // Always prevent auto focus because we either focus manually or want user agent focus\n            event.preventDefault();\n          }\n\n          hasInteractedOutsideRef.current = false;\n          hasPointerDownOutsideRef.current = false;\n        }}\n        onInteractOutside={(event) => {\n          props.onInteractOutside?.(event);\n\n          if (!event.defaultPrevented) {\n            hasInteractedOutsideRef.current = true;\n            if (event.detail.originalEvent.type === 'pointerdown') {\n              hasPointerDownOutsideRef.current = true;\n            }\n          }\n\n          // Prevent dismissing when clicking the trigger.\n          // As the trigger is already setup to close, without doing so would\n          // cause it to close and immediately open.\n          const target = event.target as HTMLElement;\n          const targetIsTrigger = context.triggerRef.current?.contains(target);\n          if (targetIsTrigger) event.preventDefault();\n\n          // On Safari if the trigger is inside a container with tabIndex={0}, when clicked\n          // we will get the pointer down outside event on the trigger, but then a subsequent\n          // focus outside event on the container, we ignore any focus outside event when we've\n          // already had a pointer down outside event.\n          if (event.detail.originalEvent.type === 'focusin' && hasPointerDownOutsideRef.current) {\n            event.preventDefault();\n          }\n        }}\n      />\n    );\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\ntype PopoverContentImplElement = React.ComponentRef<typeof PopperPrimitive.Content>;\ntype FocusScopeProps = React.ComponentPropsWithoutRef<typeof FocusScope>;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface PopoverContentImplProps\n  extends Omit<PopperContentProps, 'onPlaced'>, Omit<DismissableLayerProps, 'onDismiss'> {\n  /**\n   * Whether focus should be trapped within the `Popover`\n   * (default: false)\n   */\n  trapFocus?: FocusScopeProps['trapped'] | undefined;\n\n  /**\n   * Event handler called when auto-focusing on open.\n   * Can be prevented.\n   */\n  onOpenAutoFocus?: FocusScopeProps['onMountAutoFocus'] | undefined;\n\n  /**\n   * Event handler called when auto-focusing on close.\n   * Can be prevented.\n   */\n  onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'] | undefined;\n\n  /**\n   * Branch nodes registered by nested, portalled layers. Passed to the trapped\n   * `FocusScope` so focus isn't reclaimed from them. Only provided by the modal\n   * variant.\n   * @internal\n   */\n  branchNodes?: HTMLElement[] | undefined;\n\n  /**\n   * Registry that nested, portalled layers use to register themselves as branches of this modal\n   * `Popover`. Only provided by the modal variant.\n   * @internal\n   */\n  branchRegistry?: FocusScopeBranchRegistry | undefined;\n}\n\nconst PopoverContentImpl = /* @__PURE__ */ React.forwardRef<\n  PopoverContentImplElement,\n  PopoverContentImplProps\n>(\n  // blank line to reduce diff noise\n  function PopoverContentImpl(props: ScopedProps<PopoverContentImplProps>, forwardedRef) {\n    const {\n      __scopePopover,\n      trapFocus,\n      onOpenAutoFocus,\n      onCloseAutoFocus,\n      disableOutsidePointerEvents,\n      onEscapeKeyDown,\n      onPointerDownOutside,\n      onFocusOutside,\n      onInteractOutside,\n      'aria-describedby': ariaDescribedby,\n      branchNodes,\n      branchRegistry,\n      ...contentProps\n    } = props;\n    const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n    const popperScope = usePopperScope(__scopePopover);\n\n    // When this `Popover` is nested inside a modal layer (eg. a `Dialog`) but\n    // portalled outside of it, register its content with the ancestor layer so\n    // focus isn't reclaimed and scroll isn't locked for it. No-ops when there\n    // is no ancestor layer. See:\n    // https://github.com/radix-ui/primitives/issues/3423\n    const [contentNode, setContentNode] = React.useState<PopoverContentImplElement | null>(null);\n    const composedRefs = useComposedRefs(forwardedRef, setContentNode);\n    useFocusScopeBranch(contentNode);\n\n    // Make sure the whole tree has focus guards as our `Popover` may be\n    // the last element in the DOM (because of the `Portal`)\n    useFocusGuards();\n\n    return (\n      <FocusScopeBranchProvider registry={branchRegistry}>\n        <FocusScope\n          asChild\n          loop\n          trapped={trapFocus}\n          branches={branchNodes}\n          onMountAutoFocus={onOpenAutoFocus}\n          onUnmountAutoFocus={onCloseAutoFocus}\n        >\n          <DismissableLayer\n            asChild\n            disableOutsidePointerEvents={disableOutsidePointerEvents}\n            onInteractOutside={onInteractOutside}\n            onEscapeKeyDown={onEscapeKeyDown}\n            onPointerDownOutside={onPointerDownOutside}\n            onFocusOutside={onFocusOutside}\n            onDismiss={() => context.onOpenChange(false)}\n            deferPointerDownOutside\n          >\n            <PopperPrimitive.Content\n              data-state={getState(context.open)}\n              role=\"dialog\"\n              id={context.contentId}\n              aria-labelledby={context.titlePresent ? context.titleId : undefined}\n              aria-describedby={\n                context.descriptionPresent\n                  ? concatAriaDescribedby(ariaDescribedby, context.descriptionId)\n                  : ariaDescribedby\n              }\n              {...popperScope}\n              {...contentProps}\n              ref={composedRefs}\n              style={{\n                ...contentProps.style,\n                // re-namespace exposed content custom properties\n                ...{\n                  '--radix-popover-content-transform-origin':\n                    'var(--radix-popper-transform-origin)',\n                  '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n                  '--radix-popover-content-available-height':\n                    'var(--radix-popper-available-height)',\n                  '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n                  '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)',\n                },\n              }}\n            />\n          </DismissableLayer>\n        </FocusScope>\n      </FocusScopeBranchProvider>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverTitle\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverTitleElement = React.ComponentRef<typeof Primitive.h2>;\ntype PrimitiveHeading2Props = React.ComponentPropsWithoutRef<typeof Primitive.h2>;\ninterface PopoverTitleProps extends PrimitiveHeading2Props {}\n\nconst PopoverTitle = /* @__PURE__ */ React.forwardRef<PopoverTitleElement, PopoverTitleProps>(\n  function PopoverTitle(props: ScopedProps<PopoverTitleProps>, forwardedRef) {\n    const { __scopePopover, ...titleProps } = props;\n    const context = usePopoverContext('PopoverTitle', __scopePopover);\n    const { setTitleCount } = context;\n    useLayoutEffect(() => {\n      setTitleCount((count) => count + 1);\n      return () => setTitleCount((count) => count - 1);\n    }, [setTitleCount]);\n\n    return <Primitive.h2 id={context.titleId} {...titleProps} ref={forwardedRef} />;\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverDescription\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverDescriptionElement = React.ComponentRef<typeof Primitive.p>;\ntype PrimitiveParagraphProps = React.ComponentPropsWithoutRef<typeof Primitive.p>;\ninterface PopoverDescriptionProps extends PrimitiveParagraphProps {}\n\nconst PopoverDescription = /* @__PURE__ */ React.forwardRef<\n  PopoverDescriptionElement,\n  PopoverDescriptionProps\n>(function PopoverDescription(props: ScopedProps<PopoverDescriptionProps>, forwardedRef) {\n  const { __scopePopover, ...descriptionProps } = props;\n  const context = usePopoverContext('PopoverDescription', __scopePopover);\n  const { setDescriptionCount } = context;\n  useLayoutEffect(() => {\n    setDescriptionCount((count) => count + 1);\n    return () => setDescriptionCount((count) => count - 1);\n  }, [setDescriptionCount]);\n\n  return <Primitive.p id={context.descriptionId} {...descriptionProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverClose\n * -----------------------------------------------------------------------------------------------*/\n\nconst CLOSE_NAME = 'PopoverClose';\n\ntype PopoverCloseElement = React.ComponentRef<typeof Primitive.button>;\ninterface PopoverCloseProps extends PrimitiveButtonProps {}\n\nconst PopoverClose = /* @__PURE__ */ React.forwardRef<PopoverCloseElement, PopoverCloseProps>(\n  function PopoverClose(props: ScopedProps<PopoverCloseProps>, forwardedRef) {\n    const { __scopePopover, ...closeProps } = props;\n    const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n    return (\n      <Primitive.button\n        type=\"button\"\n        {...closeProps}\n        ref={forwardedRef}\n        onClick={composeEventHandlers(props.onClick, () => context.onOpenChange(false))}\n      />\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * PopoverArrow\n * -----------------------------------------------------------------------------------------------*/\n\ntype PopoverArrowElement = React.ComponentRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface PopoverArrowProps extends PopperArrowProps {}\n\nconst PopoverArrow = /* @__PURE__ */ React.forwardRef<PopoverArrowElement, PopoverArrowProps>(\n  function PopoverArrow(props: ScopedProps<PopoverArrowProps>, forwardedRef) {\n    const { __scopePopover, ...arrowProps } = props;\n    const popperScope = usePopperScope(__scopePopover);\n    return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n  },\n);\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction getState(open: boolean) {\n  return open ? 'open' : 'closed';\n}\n\n// TODO: Move to primitive once that package exposed individual sub-modules\nfunction concatAriaDescribedby(...values: unknown[]): string | undefined {\n  const ids = new Set<string>();\n  for (const value of values) {\n    if (typeof value !== 'string') continue;\n    for (const id of String(value).trim().split(/\\s+/)) {\n      if (id) ids.add(id);\n    }\n  }\n\n  return ids.size > 0 ? Array.from(ids).join(' ') : undefined;\n}\n\nexport {\n  createPopoverScope,\n  //\n  Popover,\n  PopoverAnchor,\n  PopoverTrigger,\n  PopoverPortal,\n  PopoverContent,\n  PopoverTitle,\n  PopoverDescription,\n  PopoverClose,\n  PopoverArrow,\n  //\n  Popover as Root,\n  PopoverAnchor as Anchor,\n  PopoverTrigger as Trigger,\n  PopoverPortal as Portal,\n  PopoverContent as Content,\n  PopoverTitle as Title,\n  PopoverDescription as Description,\n  PopoverClose as Close,\n  PopoverArrow as Arrow,\n};\nexport type {\n  PopoverProps,\n  PopoverAnchorProps,\n  PopoverTriggerProps,\n  PopoverPortalProps,\n  PopoverContentProps,\n  PopoverTitleProps,\n  PopoverDescriptionProps,\n  PopoverCloseProps,\n  PopoverArrowProps,\n};\n"]}