{"version":3,"file":"SideNavigation.mjs","names":["PinIcon"],"sources":["../../../src/side-navigation/SideNavigation.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n  autoUpdate,\n  Composite,\n  CompositeItem,\n  flip,\n  FloatingFocusManager,\n  FloatingList,\n  FloatingPortal,\n  offset,\n  safePolygon,\n  shift,\n  useDismiss,\n  useFloating,\n  useFocus,\n  useHover,\n  useInteractions,\n  useListItem,\n  useListNavigation,\n  useMergeRefs,\n  useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { IconIndicatorWrapper } from '../_common/IconIndicatorWrapper';\nimport {\n  type CommonProps,\n  type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { Divider } from '../divider';\nimport PinIcon from '../icons/generated/custom/Pin';\nimport { ChevronRightIconOutline } from '../icons/generated/heroIcons/ChevronRightIconOutline';\nimport { Tooltip } from '../tooltip';\nimport { Typography } from '../typography';\nimport {\n  SideNavCategoryContext,\n  SideNavContext,\n  useSideNavCategoryContext,\n  useSideNavContext,\n} from './side-navigation-context';\nimport {\n  type CategoryHeaderProps,\n  type CategoryItemProps,\n  type ItemBadgeProps,\n  type NavItemProps,\n  type SideNavListItemProps,\n  type SideNavProps,\n} from './side-navigation-types';\n\n/**\n * SideNav\n */\nconst SideNavComponent = ({\n  children,\n  className,\n  style,\n  htmlAttributes,\n  isExpanded = false,\n  shouldOverlayOnInteraction = true,\n  ariaLabel,\n  onPinButtonClick,\n  expandedWidth,\n  ref,\n  ...restProps\n}: CommonProps<'div', SideNavProps>) => {\n  const [isHovered, setIsHovered] = useState(false);\n  const [hasFocusVisible, setHasFocusVisible] = useState(false);\n  const [isCollapseTransitioning, setIsCollapseTransitioning] = useState(false);\n  const collapseTransitionTimeoutRef = useRef<ReturnType<\n    typeof setTimeout\n  > | null>(null);\n\n  const rootRef = useRef<HTMLDivElement>(null);\n\n  const isFloatingExpanded =\n    shouldOverlayOnInteraction && (!isHovered ? hasFocusVisible : true);\n\n  const classes = classNames('ndl-side-nav', 'ndl-side-nav-root', className, {\n    'ndl-side-nav-collapsed':\n      isExpanded !== true && shouldOverlayOnInteraction !== true,\n    'ndl-side-nav-expanded': isExpanded,\n  });\n\n  const innerClasses = classNames('ndl-side-nav-inner', {\n    'ndl-side-nav-collapsing': isCollapseTransitioning,\n    'ndl-side-nav-hover': isFloatingExpanded === true && isExpanded !== true,\n  });\n\n  const customStyle = {\n    ...style,\n    ...(Boolean(expandedWidth) && {\n      '--side-nav-width-expanded':\n        typeof expandedWidth === 'string'\n          ? expandedWidth\n          : `${expandedWidth}px`,\n    }),\n  };\n\n  const mergedRef = useMergeRefs([ref, rootRef]);\n\n  const collapseTransitionDuration = Number.parseInt(\n    tokens.motion.duration.quick,\n    10,\n  );\n\n  useEffect(() => {\n    return () => {\n      if (collapseTransitionTimeoutRef.current !== null) {\n        clearTimeout(collapseTransitionTimeoutRef.current);\n        collapseTransitionTimeoutRef.current = null;\n      }\n    };\n  }, []);\n\n  return (\n    <SideNavContext.Provider\n      value={{\n        isExpanded,\n        isHovered: isFloatingExpanded, // needs refactoring\n        onPinButtonClick,\n        shouldOverlayOnInteraction,\n      }}\n    >\n      <div\n        className={classes}\n        ref={mergedRef}\n        style={customStyle}\n        onMouseEnter={() => {\n          if (collapseTransitionTimeoutRef.current !== null) {\n            clearTimeout(collapseTransitionTimeoutRef.current);\n            collapseTransitionTimeoutRef.current = null;\n          }\n          setIsCollapseTransitioning(false);\n          setIsHovered(true);\n        }}\n        onMouseLeave={() => {\n          const shouldDelayZIndexRemoval =\n            shouldOverlayOnInteraction &&\n            !isExpanded &&\n            (isHovered || hasFocusVisible);\n          setIsHovered(false);\n          if (shouldDelayZIndexRemoval) {\n            if (collapseTransitionTimeoutRef.current !== null) {\n              clearTimeout(collapseTransitionTimeoutRef.current);\n            }\n            setIsCollapseTransitioning(true);\n            collapseTransitionTimeoutRef.current = setTimeout(() => {\n              collapseTransitionTimeoutRef.current = null;\n              setIsCollapseTransitioning(false);\n            }, collapseTransitionDuration);\n          }\n        }}\n        onFocusCapture={() => {\n          // Delay slightly to let Composite's focus management settle\n          requestAnimationFrame(() => {\n            const activeElement = document.activeElement;\n            // Check if focus is inside and visible (using :focus-visible on the active element)\n            if (\n              activeElement instanceof HTMLElement &&\n              rootRef.current !== null &&\n              rootRef.current.contains(activeElement) &&\n              activeElement.matches(':focus-visible')\n            ) {\n              // Update state after another frame to let focus fully settle\n              // This updates the context for consumers without disrupting focus\n              requestAnimationFrame(() => {\n                setHasFocusVisible(true);\n              });\n            }\n          });\n        }}\n        onBlurCapture={() => {\n          // Small delay to check if focus moved to another element inside\n          requestAnimationFrame(() => {\n            const activeElement = document.activeElement;\n            const isInsideNav =\n              activeElement instanceof HTMLElement &&\n              rootRef.current !== null &&\n              rootRef.current.contains(activeElement);\n            // Check if focus is in a portaled floating menu\n            const isInsideFloatingMenu =\n              activeElement instanceof HTMLElement &&\n              activeElement.closest('.ndl-side-nav-popover') !== null;\n\n            if (\n              (isInsideNav || isInsideFloatingMenu) &&\n              activeElement instanceof HTMLElement &&\n              activeElement.matches(':focus-visible')\n            ) {\n              // Focus stayed inside with focus-visible\n              setHasFocusVisible(true);\n            } else {\n              // Focus left - collapse\n              setHasFocusVisible(false);\n            }\n          });\n        }}\n        {...restProps}\n        {...htmlAttributes}\n      >\n        <div className={innerClasses}>\n          {/* Both the nav landmark and the Menubar get the same label following the\n             WAI-ARIA pattern for Menubar:\n             https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-navigation */}\n          <nav className=\"ndl-side-nav-nav\" aria-label={ariaLabel}>\n            <Composite\n              render={<ul />}\n              aria-label={ariaLabel}\n              role=\"menubar\"\n              orientation=\"vertical\"\n              aria-orientation=\"vertical\"\n              className=\"ndl-side-nav-list\"\n              loop={true}\n            >\n              {children}\n            </Composite>\n          </nav>\n          {shouldOverlayOnInteraction === true && (\n            <div className=\"ndl-side-nav-footer\">\n              <PinButton />\n            </div>\n          )}\n        </div>\n      </div>\n    </SideNavContext.Provider>\n  );\n};\n\n/**\n * SideNavListItem\n */\nconst SideNavListItem = ({\n  children,\n  className,\n  style,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: CommonProps<'li', SideNavListItemProps>) => {\n  const classes = classNames('ndl-side-nav-list-item', className, {});\n\n  return (\n    <li\n      role=\"none\"\n      className={classes}\n      style={style}\n      ref={ref}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      <SelectedIndicator />\n      {children}\n    </li>\n  );\n};\n\n/**\n * NavItem\n */\nconst NavItem = <T extends React.ElementType = 'button'>({\n  icon,\n  label,\n  trailingElement,\n  isActive,\n  className,\n  style,\n  htmlAttributes,\n  as,\n  badge,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, NavItemProps>) => {\n  const { isExpanded, isHovered, shouldOverlayOnInteraction } =\n    useSideNavContext();\n  const categoryContext = useSideNavCategoryContext();\n  const isInCategory = categoryContext !== null;\n\n  const item = useListItem();\n  const mergedRef = useMergeRefs([item.ref, ref]);\n\n  const isActiveIndex = item.index === categoryContext?.activeIndex;\n\n  const Component: React.ElementType = as ?? 'button';\n  const classes = classNames('ndl-side-nav-nav-item', className, {\n    'ndl-active': isActive === true,\n  });\n\n  const Wrapper = isInCategory ? Component : CompositeItem;\n  const componentProps = {\n    className: classes,\n    ref: mergedRef,\n    role: 'menuitem',\n    style: style,\n    ...(isInCategory && {\n      ...categoryContext?.getItemProps(),\n      tabIndex: isActiveIndex ? 0 : -1,\n    }),\n    ...restProps,\n    ...htmlAttributes,\n  };\n  const wrapperProps = isInCategory\n    ? componentProps\n    : {\n        render: <Component {...componentProps} />,\n      };\n\n  return (\n    <ConditionalWrap\n      shouldWrap={\n        isExpanded === false &&\n        !shouldOverlayOnInteraction &&\n        !isInCategory &&\n        Boolean(label)\n      }\n      wrap={(children) => (\n        <Tooltip\n          type=\"simple\"\n          placement=\"right\"\n          hoverDelay={{ close: 0, open: shouldOverlayOnInteraction ? 100 : 0 }}\n        >\n          <Tooltip.Trigger hasButtonWrapper={true}>{children}</Tooltip.Trigger>\n          <Tooltip.Content>{label}</Tooltip.Content>\n        </Tooltip>\n      )}\n    >\n      <Wrapper {...wrapperProps}>\n        <div className=\"ndl-side-nav-item-inner\">\n          {Boolean(icon) && (\n            <div className=\"ndl-side-nav-item-leading-element\">\n              <ConditionalWrap\n                shouldWrap={Boolean(badge) && !isHovered && !isExpanded}\n                wrap={(children) => (\n                  <IconIndicatorWrapper type={badge?.type ?? 'info'}>\n                    {children}\n                  </IconIndicatorWrapper>\n                )}\n              >\n                {icon}\n              </ConditionalWrap>\n            </div>\n          )}\n          {Boolean(label) && (\n            <Typography\n              variant=\"body-medium\"\n              as=\"div\"\n              className=\"ndl-side-nav-item-label\"\n            >\n              {label}\n            </Typography>\n          )}\n          {(Boolean(trailingElement) || Boolean(badge)) && (\n            <div className=\"ndl-side-nav-item-trailing-element\">\n              {trailingElement}\n              {badge !== undefined && (\n                <ItemBadge type={badge.type} number={badge.number} />\n              )}\n            </div>\n          )}\n        </div>\n      </Wrapper>\n    </ConditionalWrap>\n  );\n};\n\n/**\n * CategoryItem\n */\nconst CategoryItem = ({\n  children,\n  icon,\n  label,\n  isActive,\n  className,\n  style,\n  htmlAttributes,\n  badge,\n  isMenuOpen = false,\n  ref,\n  ...restProps\n}: CommonProps<'button', CategoryItemProps>) => {\n  const floatingId = useId();\n  const { isExpanded, isHovered, shouldOverlayOnInteraction } =\n    useSideNavContext();\n  const anchorRef = useRef<HTMLLIElement>(null);\n  const [isOpen, setIsOpen] = useState(false);\n  const [activeIndex, setActiveIndex] = useState<number | null>(null);\n  const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n  const elementsRef = useRef<\n    Array<HTMLButtonElement | HTMLAnchorElement | null>\n  >([]);\n\n  const classes = classNames('ndl-side-nav-category-item', className, {\n    'ndl-active': isActive === true,\n  });\n\n  // Floating UI setup\n  const { refs, context } = useFloating({\n    elements: {\n      reference: anchorRef.current,\n    },\n    middleware: [\n      offset(5),\n      flip({ crossAxis: true, fallbackAxisSideDirection: 'end', padding: 5 }),\n      shift({ padding: 5 }),\n    ],\n    onOpenChange: setIsOpen,\n    open: isOpen || isMenuOpen,\n    placement: 'right-start',\n    strategy: 'fixed',\n    whileElementsMounted: autoUpdate,\n  });\n\n  const dismiss = useDismiss(context, {\n    referencePress: false,\n  });\n  const hover = useHover(context, {\n    delay: { close: 130, open: 130 },\n    handleClose: safePolygon({\n      blockPointerEvents: false,\n      requireIntent: false,\n    }),\n  });\n  const focus = useFocus(context);\n  const listNavigation = useListNavigation(context, {\n    activeIndex: activeIndex,\n    focusItemOnHover: false,\n    focusItemOnOpen: false,\n    listRef: elementsRef,\n    loop: true,\n    nested: true,\n    onNavigate: setActiveIndex,\n    openOnArrowKeyDown: false,\n  });\n\n  // Separate interactions: reference (no listNavigation), floating (with listNavigation)\n  const refInteractions = useInteractions([dismiss, hover, focus]);\n  const floatInteractions = useInteractions([dismiss, hover, listNavigation]);\n  const { styles: transitionStyles } = useTransitionStyles(context, {\n    duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n  });\n\n  // Reset activeIndex when menu closes\n  useEffect(() => {\n    if (!context.open) {\n      setActiveIndex(null);\n    }\n  }, [context.open]);\n\n  const mergedRef = useMergeRefs([refs.setReference, ref]);\n\n  return (\n    <SideNavCategoryContext.Provider\n      value={{\n        activeIndex,\n        getItemProps: floatInteractions.getItemProps,\n      }}\n    >\n      <ConditionalWrap\n        shouldWrap={\n          isExpanded === false && !shouldOverlayOnInteraction && Boolean(label)\n        }\n        wrap={(children) => (\n          <Tooltip\n            type=\"simple\"\n            placement=\"top\"\n            hoverDelay={{\n              close: 0,\n              open: shouldOverlayOnInteraction ? 100 : 0,\n            }}\n            isOpen={isTooltipOpen}\n            onOpenChange={setIsTooltipOpen}\n          >\n            <Tooltip.Trigger hasButtonWrapper={true}>\n              {children}\n            </Tooltip.Trigger>\n            <Tooltip.Content className=\"ndl-side-nav ndl-side-nav-category-menu-tooltip-content\">\n              {label}\n            </Tooltip.Content>\n          </Tooltip>\n        )}\n      >\n        <CompositeItem\n          render={\n            <button\n              type=\"button\"\n              {...refInteractions.getReferenceProps({\n                className: classes,\n                ref: mergedRef,\n                style,\n                ...restProps,\n                ...htmlAttributes,\n              })}\n              // {...restProps}\n              // {...htmlAttributes}\n              role=\"menuitem\"\n              aria-haspopup=\"menu\"\n              aria-expanded={context.open}\n              aria-controls={floatingId}\n              onFocus={(event) => {\n                // Only show tooltip on focus-visible (keyboard navigation)\n                if (\n                  event.target instanceof HTMLElement &&\n                  event.target.matches(':focus-visible')\n                ) {\n                  setIsTooltipOpen(true);\n                }\n                // Call original handler if exists\n                const originalOnFocus = refInteractions.getReferenceProps({})\n                  .onFocus as\n                  | ((event: React.FocusEvent<HTMLButtonElement>) => void)\n                  | undefined;\n                originalOnFocus?.(event);\n              }}\n              onBlur={(event) => {\n                setIsTooltipOpen(false);\n                // Call original handler if exists\n                const originalOnBlur = refInteractions.getReferenceProps({})\n                  .onBlur as\n                  | ((event: React.FocusEvent<HTMLButtonElement>) => void)\n                  | undefined;\n                originalOnBlur?.(event);\n              }}\n              onKeyDown={(event) => {\n                if (event.key === 'ArrowRight') {\n                  // open and move focus into submenu\n                  setIsOpen(true);\n                  setActiveIndex(0);\n                  // Defer focusing first item (if needed) to next tick\n                  requestAnimationFrame(() => {\n                    const el = elementsRef.current[0];\n                    el?.focus();\n                  });\n                  event.preventDefault();\n                }\n                // ArrowDown/ArrowUp: let Composite handle top-level roving focus.\n              }}\n            />\n          }\n        >\n          <div className=\"ndl-side-nav-item-inner\">\n            {Boolean(icon) && (\n              <div className=\"ndl-side-nav-item-leading-element\">\n                <ConditionalWrap\n                  shouldWrap={Boolean(badge) && !isHovered && !isExpanded}\n                  wrap={(children) => (\n                    <IconIndicatorWrapper type={badge?.type ?? 'info'}>\n                      {children}\n                    </IconIndicatorWrapper>\n                  )}\n                >\n                  {icon}\n                </ConditionalWrap>\n              </div>\n            )}\n            {Boolean(label) && (\n              <Typography\n                variant=\"body-medium\"\n                as=\"div\"\n                className=\"ndl-side-nav-item-label\"\n              >\n                {label}\n              </Typography>\n            )}\n            <div className=\"ndl-side-nav-item-trailing-element\">\n              {badge && <ItemBadge type={badge.type} number={badge.number} />}\n              <ChevronRightIconOutline className=\"ndl-side-nav-item-chevron\" />\n            </div>\n          </div>\n          {context.open && (\n            <FloatingList elementsRef={elementsRef}>\n              <FloatingPortal>\n                <FloatingFocusManager\n                  context={context}\n                  modal={false}\n                  initialFocus={-1}\n                  returnFocus={true}\n                  closeOnFocusOut={true}\n                  guards={true}\n                >\n                  <ul\n                    id={floatingId}\n                    ref={refs.setFloating}\n                    className=\"ndl-side-nav ndl-side-nav-popover ndl-side-nav-popover-list\"\n                    style={{\n                      ...context.floatingStyles,\n                      ...transitionStyles,\n                    }}\n                    {...floatInteractions.getFloatingProps()}\n                    role=\"menu\"\n                  >\n                    {children}\n                  </ul>\n                </FloatingFocusManager>\n              </FloatingPortal>\n            </FloatingList>\n          )}\n        </CompositeItem>\n      </ConditionalWrap>\n    </SideNavCategoryContext.Provider>\n  );\n};\n\n/**\n * CategoryHeader\n */\nconst CategoryHeader = ({\n  children,\n  className,\n  ref,\n  style,\n  htmlAttributes,\n  ...restProps\n}: CommonProps<'li', CategoryHeaderProps>) => {\n  const { isExpanded, isHovered } = useSideNavContext();\n\n  const classes = classNames('ndl-side-nav-category-header', className, {\n    'ndl-side-nav-category-header-expanded': isExpanded || isHovered,\n  });\n\n  return (\n    <Typography\n      ref={ref}\n      variant=\"label\"\n      as=\"li\"\n      className={classes}\n      htmlAttributes={{\n        ...htmlAttributes,\n        role: 'separator',\n      }}\n      style={style}\n      {...restProps}\n    >\n      {isExpanded || isHovered ? children : <Divider />}\n    </Typography>\n  );\n};\n\n/**\n * SelectedIndicator\n */\nconst SelectedIndicator = () => {\n  return <div className=\"ndl-side-nav-selected-indicator\" />;\n};\n\n/**\n * SideNavDivider\n */\nconst SideNavDivider = () => {\n  return (\n    <Divider\n      orientation=\"horizontal\"\n      className=\"ndl-side-nav-divider\"\n      as=\"li\"\n    />\n  );\n};\n\n/**\n * ItemBadge\n */\nconst ItemBadge = ({\n  number,\n  type,\n  ref,\n  htmlAttributes,\n  style,\n  className,\n  ...restProps\n}: CommonProps<'span', ItemBadgeProps>) => {\n  useSideNavContext();\n\n  const badgeClasses = classNames('ndl-side-nav-item-badge', className, {\n    'ndl-danger': type === 'danger',\n    'ndl-info': type === 'info',\n    'ndl-warning': type === 'warning',\n  });\n\n  return (\n    <Typography\n      as=\"span\"\n      className={badgeClasses}\n      variant=\"subheading-small\"\n      htmlAttributes={{\n        'aria-label': `${number} notifications of type ${type}`,\n        ...htmlAttributes,\n      }}\n      style={style}\n      ref={ref}\n      {...restProps}\n    >\n      {number}\n    </Typography>\n  );\n};\n\n/**\n * PinButton\n */\nconst PinButton = () => {\n  const { isExpanded, shouldOverlayOnInteraction, onPinButtonClick } =\n    useSideNavContext();\n\n  const classes = classNames('ndl-side-nav-pin-button');\n\n  if (!shouldOverlayOnInteraction) {\n    return null;\n  }\n\n  return (\n    <CleanIconButton\n      onClick={onPinButtonClick}\n      className={classes}\n      description=\"Pin\"\n      size=\"medium\"\n      isActive={isExpanded}\n      tooltipProps={{\n        root: {\n          autoUpdateOptions: {\n            animationFrame: true,\n          },\n          placement: 'right',\n        },\n      }}\n    >\n      <PinIcon />\n    </CleanIconButton>\n  );\n};\n\nconst SideNavigation = Object.assign(SideNavComponent, {\n  CategoryHeader: CategoryHeader,\n  CategoryItem: CategoryItem,\n  Divider: SideNavDivider,\n  ItemBadge: ItemBadge,\n  ListItem: SideNavListItem,\n  NavItem,\n});\n\nexport { SideNavigation };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA0KA;CACA;CACA;CACA;CACA;;;CAwBA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAmGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAqOA;CACA;CACA;CACA;CACA;;;CAmDA;CACA;CACA;CACA;CACA;CACA;;;;;AAtmBF,MAAM,oBAAoB,SAYc;CAZd,IAAA,EACxB,UACA,WACA,OACA,gBACA,aAAa,OACb,6BAA6B,MAC7B,WACA,kBACA,eACA,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAChD,MAAM,CAAC,iBAAiB,sBAAsB,SAAS,KAAK;CAC5D,MAAM,CAAC,yBAAyB,8BAA8B,SAAS,KAAK;CAC5E,MAAM,+BAA+B,OAE3B,IAAI;CAEd,MAAM,UAAU,OAAuB,IAAI;CAE3C,MAAM,qBACJ,+BAA+B,CAAC,YAAY,kBAAkB;CAEhE,MAAM,UAAU,WAAW,gBAAgB,qBAAqB,WAAW;EACzE,0BACE,eAAe,QAAQ,+BAA+B;EACxD,yBAAyB;CAC3B,CAAC;CAED,MAAM,eAAe,WAAW,sBAAsB;EACpD,2BAA2B;EAC3B,sBAAsB,uBAAuB,QAAQ,eAAe;CACtE,CAAC;CAED,MAAM,cAAA,eAAA,eAAA,CA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