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C;kBAAC;sBAAM;QAAQ;IACnC,OAAO;QACL,IAAI,SAAS,WAAW,MAAM,iBAAiB,KAAK;QACpD,IAAI,OACF,WAAW,KAAK,GAAG,aAAa,IAAI,GAAG,SAAS,UAAU,GAAG,SAAS,SAAS,WAAW;QAC5F,SAAS,QAAQ,CAAC;kBAAC;sBAAM;QAAQ;IACnC;AAEJ;AAEA,SAAS,+BAAS,IAAY;IAC5B,IAAI,CAAC,KAAK,UAAU,CAAC,UACnB,OAAO;IAGT,IAAI,UAAU,SAAS,aAAa,CAAC;IACrC,QAAQ,KAAK,GAAG;IAChB,QAAQ,KAAK,CAAC,QAAQ,GAAG;IACzB,QAAQ,KAAK,CAAC,GAAG,GAAG;IACpB,QAAQ,KAAK,CAAC,IAAI,GAAG;IACrB,QAAQ,KAAK,CAAC,OAAO,GAAG;IACxB,QAAQ,KAAK,CAAC,MAAM,GAAG;IACvB,SAAS,IAAI,CAAC,WAAW,CAAC;IAC1B,IAAI,SAAS,OAAO,gBAAgB,CAAC,SAAS,MAAM;IACpD,QAAQ,MAAM;IACd,OAAO;AACT","sources":["packages/react-aria-components/src/Sheet.tsx"],"sourcesContent":["/*\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {ClassNameOrFunction, RenderProps, useRenderProps} from './utils';\nimport {Dialog, DialogProps, DialogTrigger, DialogTriggerProps} from './Dialog';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {GlobalDOMAttributes} from '@react-types/shared';\nimport {\n  InternalModalContext,\n  Modal,\n  ModalOverlay,\n  ModalOverlayProps,\n  ModalRenderProps\n} from './Modal';\nimport {isIOS, isSafari} from 'react-aria/private/utils/platform';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PressResponder} from 'react-aria/private/interactions/PressResponder';\nimport React, {\n  createContext,\n  CSSProperties,\n  ForwardedRef,\n  forwardRef,\n  useCallback,\n  useContext,\n  useMemo,\n  useRef,\n  useState\n} from 'react';\nimport {useEffectEvent} from 'react-aria/private/utils/useEffectEvent';\nimport {useId} from 'react-aria/useId';\nimport {useLayoutEffect} from 'react-aria/private/utils/useLayoutEffect';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useObjectRef} from 'react-aria/useObjectRef';\nimport {useOverlayTriggerState} from 'react-stately/useOverlayTriggerState';\nimport {useSyncExternalStore} from 'use-sync-external-store/shim/index.js';\n\ntype SheetPosition = 'bottom' | 'top' | 'left' | 'right' | 'center';\ntype SheetSwipeDirection = 'bottom' | 'top' | 'vertical' | 'left' | 'right' | 'horizontal';\n\nexport interface SheetRenderProps extends ModalRenderProps {\n  /**\n   * The placement of the sheet on the screen. `start` and `end` are resolved to `left` or `right`\n   * based on the locale direction.\n   *\n   * @selector [data-position=\"bottom | top | left | right | center\"]\n   */\n  position: SheetPosition;\n  /**\n   * The direction the sheet can be swiped. `start` and `end` are resolved to `left` or `right`\n   * based on the locale direction.\n   *\n   * @selector [data-swipe-direction=\"bottom | top | vertical | left | right | horizontal\"]\n   */\n  swipeDirection: SheetSwipeDirection;\n  /**\n   * The index of the sheet in the stack.\n   *\n   * @selector [data-stack-index=\"0 | 1 | 2 | ...\"]\n   */\n  stackIndex: number;\n  /**\n   * Whether the sheet has descendants.\n   *\n   * @selector [data-has-descendants]\n   */\n  hasDescendants: boolean;\n  /**\n   * Whether the sheet is fully expanded to its last snap point.\n   *\n   * @selector [data-expanded]\n   */\n  isExpanded: boolean;\n}\n\nexport interface SheetOverlayProps\n  extends\n    Omit<\n      ModalOverlayProps,\n      | 'className'\n      | 'style'\n      | 'children'\n      | 'render'\n      | 'onEnter'\n      | 'onExit'\n      | 'isEntering'\n      | 'isExiting'\n      | 'isDismissable'\n      | 'isKeyboardDismissDisabled'\n    >,\n    RenderProps<SheetRenderProps> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-SheetOverlay'\n   */\n  className?: ClassNameOrFunction<SheetRenderProps>;\n  /**\n   * The placement of the sheet on the screen. `start` and `end` are mirrored in right-to-left\n   * locales.\n   *\n   * @default 'bottom'\n   */\n  position?: 'bottom' | 'top' | 'left' | 'right' | 'start' | 'end' | 'center';\n  /**\n   * The direction the sheet can be swiped. `start` and `end` are mirrored in right-to-left locales.\n   * Defaults to the same direction as `position`.\n   */\n  swipeDirection?:\n    | 'bottom'\n    | 'top'\n    | 'vertical'\n    | 'left'\n    | 'right'\n    | 'start'\n    | 'end'\n    | 'horizontal';\n  /**\n   * Snap points the sheet will stop at, expressed as the amount of the sheet that is visible.\n   * Numbers are pixels, and percentages are relative to the size of the sheet. Sheets initially\n   * open to the first snap point.\n   */\n  snapPoints?: Array<number | string>;\n  /**\n   * Whether to prevent the user from closing the sheet by swiping, pressing Escape, or interacting\n   * outside it.\n   *\n   * @default false\n   */\n  preventDismissal?: boolean;\n}\n\ntype SheetValues = Omit<SheetRenderProps, keyof ModalRenderProps>;\n\ninterface InternalSheetContextValue extends Omit<SheetOverlayProps, 'position' | 'swipeDirection'> {\n  position: SheetPosition;\n  swipeDirection: SheetSwipeDirection;\n  index: number;\n  descendants: SheetStackEntry[];\n  isEntering: boolean;\n  isExiting: boolean;\n  values: SheetValues;\n}\n\nconst InternalSheetContext = createContext<InternalSheetContextValue | null>(null);\n\ninterface SheetStackEntry {\n  id: string;\n  range: string;\n  direction: string;\n  iterations: number;\n}\n\nlet sheetStack: SheetStackEntry[] = [];\nlet stackListeners = new Set<() => void>();\n\nfunction emitStackChange() {\n  // Hoist every mounted sheet's timeline name to the root so a parent\n  // can still resolve the child's timeline by name.\n  // TODO: don't override existing timelines declared in CSS or inline styles.\n  let names = Array.from({length: sheetStack.length})\n    .map((_, i) => `--sheet-timeline-${i}`)\n    .join(', ');\n  document.documentElement.style.setProperty('timeline-scope', names);\n  stackListeners.forEach(listener => listener());\n}\n\nfunction subscribeStack(listener: () => void) {\n  stackListeners.add(listener);\n  return () => {\n    stackListeners.delete(listener);\n  };\n}\n\nfunction registerSheet(config: SheetStackEntry) {\n  sheetStack = [...sheetStack, config];\n  emitStackChange();\n  return () => {\n    sheetStack = sheetStack.filter(e => e.id !== config.id);\n    emitStackChange();\n  };\n}\n\nfunction getSheetStack() {\n  return sheetStack;\n}\n\nconst supportsViewTimeline =\n  typeof CSS !== 'undefined' &&\n  typeof CSS.supports === 'function' &&\n  CSS.supports('animation-timeline: view()');\n\nexport interface SheetTriggerProps extends DialogTriggerProps {}\n\n/**\n * A SheetTrigger opens a sheet when a trigger element is pressed.\n */\nexport function SheetTrigger(props: SheetTriggerProps) {\n  return (\n    <DialogTrigger {...props}>\n      {/* Prevent the trigger element from appearing stuck while the sheet is open. */}\n      <PressResponder isPressed={false}>{props.children}</PressResponder>\n    </DialogTrigger>\n  );\n}\n\n// Additional padding added to the viewport to account for browser toolbar.\n// More content than 100lvh is actually visible on iOS, even when the toolbar is collapsed.\nconst VIEWPORT_PADDING = isIOS() && isSafari() ? 'calc(100lvh - 100svh + 58px)' : '0px';\nconst viewportPadding = (after: boolean, axis: Axis) =>\n  after && axis === 'y' ? VIEWPORT_PADDING : '0px';\n\n/**\n * A SheetOverlay is a container for a SheetBackdrop and a Sheet.\n */\nexport const SheetOverlay = forwardRef(function SheetOverlay(\n  props: SheetOverlayProps,\n  domRef: ForwardedRef<HTMLDivElement>\n) {\n  let {children, preventDismissal = false} = props;\n  let {direction} = useLocale();\n  let position = resolveDirection(props.position ?? 'bottom', direction);\n  let swipeDirection = props.swipeDirection\n    ? resolveDirection(props.swipeDirection, direction)\n    : position === 'center'\n      ? 'vertical'\n      : position;\n  // Resolve the state the same way ModalOverlay does, so that swiping to close works\n  // both inside a SheetTrigger and when the open state is passed directly to SheetOverlay.\n  let contextState = useContext(OverlayTriggerStateContext);\n  let localState = useOverlayTriggerState(props);\n  let state =\n    props.isOpen != null || props.defaultOpen != null || !contextState ? localState : contextState;\n  let onCloseEvent = useEffectEvent(() => {\n    state.close();\n  });\n\n  let {axis, before, after, maxScroll, enteredScroll, viewRange, viewDirection, viewIterations} =\n    getSwipeConfig(swipeDirection);\n\n  let id = useId();\n  let stackItem = useMemo(\n    () => ({\n      id,\n      range: viewRange,\n      direction: viewDirection,\n      iterations: viewIterations\n    }),\n    [id, viewRange, viewDirection, viewIterations]\n  );\n\n  let [isExpanded, setExpanded] = useState(false);\n  let isVisible = useRef(false);\n  let ref = useCallback(\n    (element: HTMLDivElement) => {\n      if (!element) {\n        return;\n      }\n\n      // Sheets that rest at scroll 0 (top/left) mount already entered. Move them to the exit position\n      // before observing, since onEnter may be deferred (e.g. while waiting for the software keyboard),\n      // and the observer would otherwise see the sheet as entered and then close it once onEnter\n      // jumps to the exit position.\n      if (enteredScroll === 0) {\n        let scroller = element.querySelector<HTMLElement>('[data-sheet-scroll]');\n        if (scroller) {\n          let vp = axis === 'y' ? window.innerHeight : window.innerWidth;\n          scrollAlongAxis(scroller, axis, (maxScroll / 100) * vp);\n        }\n      }\n\n      // iOS displays content outside the reported viewport, e.g. behind the browser toolbar.\n      // Add additional margin to account for that so that the sheet disappears only when it is entirely invisible.\n      let rootMargin = `0px 0px ${calcToPx(viewportPadding(after, axis))} 0px`;\n\n      let hasEntered = false;\n      let observer = new IntersectionObserver(\n        entries => {\n          let entry = entries[0];\n\n          // Expose whether the sheet is resting at its fully-entered detent (all of it revealed). Apps\n          // can use `[data-expanded]` to only make the sheet's inner content scrollable once expanded,\n          // so that at a partial detent a swipe on the content expands the sheet instead (like iOS).\n          setExpanded(entry.intersectionRatio >= 1);\n          isVisible.current = entry.intersectionRatio > 0;\n\n          hasEntered ||= entry.intersectionRatio > 0;\n          if (hasEntered && entry.intersectionRatio <= 0) {\n            // eslint-disable-next-line react/react-compiler\n            onCloseEvent();\n            element.dispatchEvent(new CustomEvent('react-aria-sheet-close'));\n          }\n        },\n        {threshold: [0, 1], rootMargin}\n      );\n\n      let el = element.querySelector('[data-sheet-content]');\n      if (el) {\n        observer.observe(el);\n      }\n\n      let removeSheet = registerSheet(stackItem);\n\n      return () => {\n        observer.disconnect();\n        removeSheet();\n      };\n    },\n    [stackItem, axis, maxScroll, enteredScroll, after]\n  );\n\n  let mergedRefs = useMemo(() => mergeRefs(ref, domRef), [ref, domRef]);\n\n  let sheetStack = useSyncExternalStore(subscribeStack, getSheetStack, getSheetStack);\n  let index = Math.max(\n    0,\n    sheetStack.findIndex(e => e.id === id)\n  );\n  let descendants = sheetStack.slice(index + 1);\n  let values: SheetValues = {\n    position,\n    swipeDirection,\n    isExpanded,\n    stackIndex: index,\n    hasDescendants: descendants.length > 0\n  };\n  let sheetProps = useSheetRenderProps(props, values, 'react-aria-SheetOverlay', {\n    // absolute rather than fixed so the modal is not clipped by iOS Safari.\n    position: 'absolute',\n    top: 0,\n    left: 0,\n    width: 'max(var(--page-width), 100vw)',\n    height: 'max(var(--page-height), 100dvh)',\n    overflow: 'clip',\n    // @ts-ignore\n    '--sheet-scroll-padding-x': 'calc(100vw - var(--visual-viewport-width))',\n    '--sheet-scroll-padding-y': 'calc(100dvh - var(--visual-viewport-height))'\n  });\n\n  return (\n    <ModalOverlay\n      {...props}\n      isOpen={state.isOpen}\n      defaultOpen={undefined}\n      onOpenChange={state.setOpen}\n      ref={mergedRefs}\n      isDismissable={!preventDismissal}\n      isKeyboardDismissDisabled={preventDismissal}\n      // Moving the VoiceOver cursor into the sheet (via focus, or by making the content behind it\n      // inert) scrolls, which interrupts the enter scroll animation on iOS. Wait until it has entered.\n      UNSTABLE_deferUntilEntered\n      UNSTABLE_overrideFocus\n      {...sheetProps}\n      onEnter={element => {\n        // The overlay is the document-anchored wrapper; the swipe gesture scrolls the inner container.\n        let scroller = element.querySelector<HTMLElement>('[data-sheet-scroll]')!;\n        let vp =\n          axis === 'y'\n            ? window.innerHeight + parseFloat(calcToPx(viewportPadding(after, axis)))\n            : window.innerWidth;\n        // Open at the first custom detent when provided, otherwise the fully-entered position.\n        let initial = element.querySelector<HTMLElement>('[data-sheet-initial]');\n        let scrollToRest = (smooth: boolean) => {\n          if (initial) {\n            scrollDetentIntoView(scroller, initial, axis, after ? 'start' : 'end', smooth);\n          } else {\n            scrollAlongAxis(scroller, axis, (enteredScroll / 100) * vp, smooth);\n          }\n        };\n        if (enteredScroll === 0) {\n          // The rest position is at scroll 0, so the sheet mounts already entered. Jump to the exit\n          // first, then animate back in on the next frame — doing both in the same task can leave\n          // the browser stuck at the jumped-to position instead of running the smooth scroll.\n          scrollAlongAxis(scroller, axis, (maxScroll / 100) * vp);\n          requestAnimationFrame(() => scrollToRest(true));\n        } else {\n          scrollToRest(true);\n        }\n\n        return new Promise<void>(resolve => {\n          // eslint-disable-next-line rsp-rules/no-non-composing-event-listener\n          scroller.addEventListener('scrollend', () => resolve(), {once: true});\n        });\n      }}\n      onExit={element => {\n        let scroller = element.querySelector<HTMLElement>('[data-sheet-scroll]')!;\n        if (!isVisible.current) {\n          // Wait for the end of the scroll gesture in Safari to avoid momentum scrolling re-targeting to the sheet behind.\n          if (isSafari() && !isIOS()) {\n            return new Promise<void>(resolve => {\n              // eslint-disable-next-line rsp-rules/no-non-composing-event-listener\n              scroller.addEventListener(\n                'scrollend',\n                () => {\n                  setTimeout(() => resolve(), 50);\n                },\n                {once: true}\n              );\n            });\n          }\n          return;\n        }\n\n        let vp =\n          axis === 'y'\n            ? window.innerHeight + parseFloat(calcToPx(viewportPadding(after, axis)))\n            : window.innerWidth;\n        let maxScrollPx = (maxScroll / 100) * vp;\n        let current = axis === 'y' ? scroller.scrollTop : scroller.scrollLeft;\n        let target: number;\n        if (after && !before) {\n          target = 0;\n        } else if (before && !after) {\n          target = maxScrollPx;\n        } else {\n          // Dual direction: exit toward whichever edge is nearest the current position.\n          target = current > (enteredScroll / 100) * vp ? maxScrollPx : 0;\n        }\n        scrollAlongAxis(scroller, axis, target, true);\n\n        // The close event is dispatched on the overlay wrapper by the IntersectionObserver below.\n        return new Promise<void>(resolve => {\n          element.addEventListener('react-aria-sheet-close', () => resolve(), {once: true});\n        });\n      }}>\n      {renderProps => (\n        <InternalSheetContext.Provider\n          value={{\n            ...props,\n            position,\n            swipeDirection,\n            index,\n            descendants,\n            isEntering: renderProps.isEntering,\n            isExiting: renderProps.isExiting,\n            values\n          }}>\n          {typeof children === 'function' ? children({...renderProps, ...values}) : children}\n        </InternalSheetContext.Provider>\n      )}\n    </ModalOverlay>\n  );\n});\n\nfunction getDataAttributes(values: SheetValues) {\n  return {\n    'data-position': values.position,\n    'data-swipe-direction': values.swipeDirection,\n    'data-expanded': values.isExpanded || undefined,\n    'data-stack-index': values.stackIndex,\n    'data-has-descendants': values.hasDescendants || undefined\n  };\n}\n\n// Merges the sheet-specific values into the render props, className, and style of a Modal or ModalOverlay.\nfunction useSheetRenderProps(\n  props: RenderProps<SheetRenderProps>,\n  values: SheetValues,\n  defaultClassName: string,\n  defaultStyle: CSSProperties,\n  overrideStyle?: CSSProperties\n) {\n  return {\n    ...getDataAttributes(values),\n    render: props.render\n      ? (domProps: React.JSX.IntrinsicElements['div'], renderProps: ModalRenderProps) =>\n          props.render!(domProps, {...renderProps, ...values})\n      : undefined,\n    className: (renderProps: ModalRenderProps & {defaultClassName: string | undefined}) =>\n      typeof props.className === 'function'\n        ? props.className({...renderProps, ...values})\n        : props.className || defaultClassName,\n    style: (renderProps: ModalRenderProps & {defaultStyle: CSSProperties}) => ({\n      ...defaultStyle,\n      ...(typeof props.style === 'function'\n        ? props.style({...renderProps, ...values})\n        : props.style),\n      ...overrideStyle\n    })\n  };\n}\n\nfunction resolveDirection<T extends string>(\n  value: T | 'start' | 'end',\n  direction: 'ltr' | 'rtl'\n): T | 'left' | 'right' {\n  if (value === 'start') {\n    return direction === 'rtl' ? 'right' : 'left';\n  }\n  if (value === 'end') {\n    return direction === 'rtl' ? 'left' : 'right';\n  }\n  return value as T;\n}\n\ntype Axis = 'x' | 'y';\n\ninterface SwipeConfig {\n  /** Scroll axis: 'y' for top/bottom/vertical, 'x' for left/right/horizontal. */\n  axis: Axis;\n  /** Whether the sheet may be swiped off the start edge (top/left). */\n  before: boolean;\n  /** Whether the sheet may be swiped off the end edge (bottom/right). */\n  after: boolean;\n  /** Distance in viewport percent between the two extreme scroll positions. */\n  maxScroll: number;\n  /** Scroll position (viewport percent) at which the sheet is fully entered. */\n  enteredScroll: number;\n  /** Offset of the scroll container along the swipe axis, in viewport percent. */\n  containerOffset: number;\n  /** CSS animation range. */\n  viewRange: 'cover' | 'exit' | 'entry';\n  /** CSS animation direction. */\n  viewDirection: 'normal' | 'reverse' | 'alternate';\n  /** CSS animation iteration count. */\n  viewIterations: number;\n}\n\n// The sheet lives inside an oversized scroll container. Scrolling slides a viewport-sized \"stage\"\n// (which holds the sheet) on and off screen along the swipe axis, so the browser drives the swipe\n// gesture natively. The container is always 2 viewports along the axis; a fixed 1-viewport window\n// (the actual browser viewport) looks onto it. The stage always sits 1 viewport into the content,\n// and snap markers at the content extremes define the entered/exited resting positions.\nfunction getSwipeConfig(swipeDirection: SheetSwipeDirection): SwipeConfig {\n  let axis: Axis =\n    swipeDirection === 'top' || swipeDirection === 'bottom' || swipeDirection === 'vertical'\n      ? 'y'\n      : 'x';\n  let before =\n    swipeDirection === 'top' ||\n    swipeDirection === 'left' ||\n    swipeDirection === 'vertical' ||\n    swipeDirection === 'horizontal';\n  let after =\n    swipeDirection === 'bottom' ||\n    swipeDirection === 'right' ||\n    swipeDirection === 'vertical' ||\n    swipeDirection === 'horizontal';\n  // Each exitable side adds a viewport of scroll travel.\n  let maxScroll = (Number(before) + Number(after)) * 100;\n  // When the sheet can only exit toward the start edge (top/left), it rests at scroll 0 and is\n  // swiped toward maxScroll to dismiss. Otherwise it rests 1 viewport in.\n  let enteredScroll = before && !after ? 0 : 100;\n  // Position the container so the rest position lands in the real viewport.\n  let containerOffset = before && !after ? -100 : 0;\n\n  // The sheet crosses a single viewport edge (the swipe edge), so map the animation to just that\n  // crossing. In view-timeline terms `entry` is the scrollport's end edge (bottom/right, where the\n  // sheet appears from) and `exit` is the start edge (top/left). Direction is chosen so progress 0\n  // is the exited state and 1 is entered, matching keyframes authored from exited -> entered:\n  // `entry` already runs gone -> entered, while `exit` runs entered -> gone and is reversed.\n  //\n  // Dual directions cross both edges, so run the same keyframe over the full `cover` range twice\n  // (iteration count 2) with `alternate`: the view timeline splits its progress across the two\n  // iterations, so it plays exited -> entered -> exited around the centered rest position. This\n  // reuses a single exited -> entered keyframe rather than requiring an author to also write a\n  // symmetric (0%/50%/100%) variant.\n  const viewRange = before && after ? 'cover' : before ? 'exit' : 'entry';\n  const viewDirection = before && after ? 'alternate' : before ? 'reverse' : 'normal';\n  const viewIterations = before && after ? 2 : 1;\n\n  return {\n    axis,\n    before,\n    after,\n    maxScroll,\n    enteredScroll,\n    containerOffset,\n    viewRange,\n    viewDirection,\n    viewIterations\n  };\n}\n\n// The resting [x, y] flex alignment for each sheet position, independent of the swipe direction.\nconst POSITION_ALIGNMENT: Record<SheetPosition, [string, string]> = {\n  top: ['center', 'flex-start'],\n  bottom: ['center', 'flex-end'],\n  left: ['flex-start', 'center'],\n  right: ['flex-end', 'center'],\n  center: ['center', 'center']\n};\n\ninterface SnapPointProps {\n  point: number | string;\n  align: 'start' | 'end' | 'none';\n  axis: Axis;\n}\n\n// Converts a snap point value to a CSS length: numbers are pixels.\nfunction toLength(point: number | string): string {\n  return typeof point === 'number' ? `${point}px` : point;\n}\n\nfunction SnapPoint({point, align, axis}: SnapPointProps) {\n  let mainUnit = axis === 'y' ? 'dvh' : 'dvw';\n  let offset = toLength(point);\n  return (\n    <div\n      style={{\n        position: 'absolute',\n        top: axis === 'y' ? offset : 0,\n        left: axis === 'x' ? offset : 0,\n        scrollSnapAlign: align,\n        // A full viewport along the swipe axis so its start/end edge lands at the snap position.\n        width: axis === 'x' ? `100${mainUnit}` : 1,\n        height: axis === 'y' ? `100${mainUnit}` : 1\n      }}\n    />\n  );\n}\n\ninterface DetentPointProps {\n  point: number | string;\n  axis: Axis;\n  after: boolean;\n  isInitial?: boolean;\n}\n\n// A snap marker placed inside the sheet, `point` in from its leading edge. Because it moves with\n// the sheet, snapping it with a `scroll-margin` of one viewport rests the marker at the edge of the\n// visible viewport, leaving exactly `point` of the sheet on screen. Since `point` is an inset rather\n// than part of the margin, percentages resolve relative to the sheet's size.\nfunction DetentPoint({point, axis, after, isInitial}: DetentPointProps) {\n  let viewport = axis === 'y' ? '100dvh' : '100dvw';\n  let offset = toLength(point);\n  let common: React.CSSProperties = {\n    position: 'absolute',\n    width: 1,\n    height: 1,\n    scrollSnapAlign: after ? 'start' : 'end'\n  };\n  let edge: React.CSSProperties =\n    axis === 'y'\n      ? after\n        ? {top: offset, left: 0, scrollMarginTop: viewport}\n        : {bottom: offset, left: 0, scrollMarginBottom: viewport}\n      : after\n        ? {top: 0, left: offset, scrollMarginLeft: viewport}\n        : {top: 0, right: offset, scrollMarginRight: viewport};\n  return (\n    <div\n      data-sheet-detent\n      data-sheet-initial={isInitial || undefined}\n      style={{...common, ...edge}}\n    />\n  );\n}\n\nexport interface SheetProps\n  extends\n    Omit<\n      ModalOverlayProps,\n      | 'className'\n      | 'style'\n      | 'children'\n      | 'render'\n      | 'onEnter'\n      | 'onExit'\n      | 'isEntering'\n      | 'isExiting'\n      | 'isDismissable'\n      | 'isOpen'\n      | 'defaultOpen'\n      | 'onOpenChange'\n      | 'isKeyboardDismissDisabled'\n      | 'shouldCloseOnInteractOutside'\n    >,\n    RenderProps<SheetRenderProps> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-Sheet'\n   */\n  className?: ClassNameOrFunction<SheetRenderProps>;\n  /** CSS `@keyframes` name for the animation that occurs while the user swipes. */\n  swipeAnimation?: string;\n  /**\n   * The snap point indices between which the swipe animation occurs. If omitted, the animation will\n   * occur over the full range of the sheet's movement.\n   */\n  swipeAnimationRange?: {start?: number; end?: number};\n  /** CSS `@keyframes` name for the animation that occurs when a sheet has descendants. */\n  stackAnimation?: string;\n  /** Whether to add padding to the sheet so that it appears to continue outside the viewport. */\n  overscrollPadding?: boolean;\n}\n\n/**\n * A Sheet is a swipeable overlay that slides in from the edge of the viewport.\n */\nexport const Sheet = forwardRef(function Sheet(\n  props: SheetProps,\n  domRef: ForwardedRef<HTMLDivElement>\n) {\n  let ref = useObjectRef(domRef);\n  let scrollRef = useRef<HTMLDivElement>(null);\n  let stageRef = useRef<HTMLDivElement>(null);\n  let {\n    position,\n    swipeDirection,\n    snapPoints,\n    index,\n    descendants,\n    isEntering,\n    isExiting,\n    preventDismissal = false,\n    values\n  } = useContext(InternalSheetContext)!;\n  // The ModalOverlay may defer its enter animation (e.g. until the software keyboard opens), during\n  // which isEntering is false. The sheet is not settled until it has opened, so treat it as entering.\n  let isOpen = useContext(InternalModalContext)?.isOpen ?? true;\n  let isTransitioning = !isOpen || isEntering || isExiting;\n  let {direction} = useLocale();\n  let {axis, after, before, containerOffset} = getSwipeConfig(swipeDirection);\n  let viewport = axis === 'y' ? '100dvh' : '100dvw';\n\n  // A non-dismissable sheet can still be swiped between its snap points, but not past the smallest\n  // one. Enter/exit animations still need the exit space, so only clamp while settled.\n  let hasSnapPoints = !!snapPoints?.length && before !== after;\n  let isClamped = preventDismissal && !isTransitioning;\n  let snapTravel = useSnapPointTravel(\n    stageRef,\n    ref,\n    axis,\n    after,\n    preventDismissal && hasSnapPoints ? snapPoints!.join(' ') : null\n  );\n\n  // Scroll travel between the smallest snap point and the fully revealed sheet. It is at least 1px\n  // so the scroll container remains scrollable, which lets the browser show its native overscroll\n  // bounce even when there is nowhere to snap to.\n  let clampedTravel = `${hasSnapPoints ? Math.max(1, snapTravel) : 1}px`;\n\n  // The stage normally sits 1 viewport in so the sheet can scroll fully off screen toward the start\n  // edge. When clamped, sheets exiting toward the end edge move it so scroll 0 rests at the smallest\n  // snap point. Sheets exiting toward the start edge rest at scroll 0 already, so only the end of\n  // the scroll content (the smallest snap point) moves. Dual direction sheets get 1px either side.\n  // viewportPadding pushes bottom sheets down so that they can scroll beyond the viewport behind the iOS toolbar.\n  let stageStart =\n    isClamped && after ? clampedTravel : `calc(${viewport} + ${viewportPadding(after, axis)})`;\n  let endMarker: string;\n  if (isClamped && before && after) {\n    endMarker = `calc(${stageStart} + ${viewport} + 1px)`;\n  } else if (isClamped && before) {\n    endMarker = `calc(${clampedTravel} + ${viewport})`;\n  } else {\n    endMarker = `calc(${stageStart} + ${viewport}${before && after ? ` + ${viewport}` : ''})`;\n  }\n\n  // Keep the sheet visually in place when switching between the clamped and unclamped geometry.\n  // Scroll snapping is disabled while a non-dismissable sheet enters and exits so the browser\n  // doesn't re-snap when the geometry changes, which would otherwise differ between browsers.\n  let prevStageOffset = useRef<number | null>(null);\n  let prevClamped = useRef(isClamped);\n  useLayoutEffect(() => {\n    let stage = stageRef.current;\n    let scroller = scrollRef.current;\n    if (!stage || !scroller) {\n      return;\n    }\n    let offset = axis === 'y' ? stage.offsetTop : stage.offsetLeft;\n    if (prevClamped.current !== isClamped && prevStageOffset.current != null) {\n      let delta = offset - prevStageOffset.current;\n      if (delta !== 0) {\n        if (axis === 'y') {\n          scroller.scrollTop += delta;\n        } else {\n          scroller.scrollLeft += delta;\n        }\n      }\n    }\n    prevClamped.current = isClamped;\n    prevStageOffset.current = offset;\n  });\n\n  let swipeAnimation = useSwipeAnimation(props);\n  let style: Record<string, string | number | undefined> = {\n    // Positioned so the detent markers below anchor to the sheet's own box.\n    position: 'relative',\n    ...swipeAnimation\n  };\n\n  let overscrollInset: string | undefined;\n  if (props.overscrollPadding && position === swipeDirection) {\n    overscrollInset = axis === 'y' ? '100vh' : '100vw';\n    // Extra padding to allow overscrolling, and a negative margin to offset it.\n    switch (position) {\n      case 'top':\n        style.paddingTop = '100vh';\n        style.marginTop = '-100vh';\n        break;\n      case 'bottom':\n        style.paddingBottom = '100vh';\n        style.marginBottom = '-100vh';\n        break;\n      case 'left':\n        style.paddingLeft = '100vw';\n        style.marginLeft = '-100vw';\n        break;\n      case 'right':\n        style.paddingRight = '100vw';\n        style.marginRight = '-100vw';\n        break;\n    }\n  }\n\n  if (props.stackAnimation && descendants.length > 0 && supportsViewTimeline) {\n    // Append one animation per descendant sheet, driven by that descendant's view timeline.\n    let stackStyle: Record<string, (d: SheetStackEntry, i: number) => string> = {\n      animationName: () => props.stackAnimation!,\n      animationTimeline: (_, i) => `--sheet-timeline-${index + 1 + i}`,\n      animationDirection: d => d.direction,\n      animationIterationCount: d => String(d.iterations),\n      animationFillMode: () => 'both',\n      animationRange: d => d.range,\n      animationComposition: () => 'accumulate',\n      animationTimingFunction: () => 'linear'\n    };\n    for (let [key, value] of Object.entries(stackStyle)) {\n      style[key] = [style[key], ...descendants.map(value)].filter(Boolean).join(', ');\n    }\n  }\n\n  let sheetProps = useSheetRenderProps(props, values, 'react-aria-Sheet', {direction}, style);\n  let [x, y] = POSITION_ALIGNMENT[position];\n  let justifyContent = axis === 'y' ? y : x;\n  let alignItems = axis === 'y' ? x : y;\n  let {scrollX, scrollY} = typeof window !== 'undefined' ? window : {scrollX: 0, scrollY: 0};\n\n  return (\n    <div\n      ref={scrollRef}\n      data-sheet-scroll\n      style={{\n        position: 'absolute',\n        top: axis === 'y' ? `calc(${scrollY}px + ${containerOffset}dvh)` : scrollY,\n        left: axis === 'x' ? `calc(${scrollX}px + ${containerOffset}dvw)` : scrollX,\n        // The container is 2 viewports along the swipe axis and 1 viewport on the cross axis.\n        height: axis === 'y' ? '200dvh' : '100dvh',\n        width: axis === 'x' ? '200dvw' : '100dvw',\n        overflowX: axis === 'x' ? 'auto' : 'hidden',\n        overflowY: axis === 'y' ? 'auto' : 'hidden',\n        // Snapping is only disabled when the geometry changes. Changing it during a swipe to dismiss\n        // cancels the momentum scroll in Safari without firing scrollend, which onExit waits for.\n        scrollSnapType: preventDismissal && isTransitioning ? 'none' : `${axis} mandatory`,\n        overscrollBehaviorY: axis === 'y' ? 'contain' : 'none',\n        overscrollBehaviorX: axis === 'x' ? 'contain' : 'none',\n        scrollbarWidth: 'none',\n        // The scroll geometry is physical, so keep the scroll origin and flex alignment\n        // left-to-right regardless of the document direction.\n        direction: 'ltr'\n      }}>\n      {/* Snap marker for the exit at scroll 0 (also the rest position for top/left).\n        When clamped, the exit positions are unreachable so they are not snap targets. */}\n      <SnapPoint point={0} align={isClamped && after ? 'none' : 'start'} axis={axis} />\n      {/* When the sheet can exit both ways, add a center snap for the rest position. */}\n      {before && after && <SnapPoint point={stageStart} align=\"start\" axis={axis} />}\n      <div\n        ref={stageRef}\n        style={{\n          position: 'absolute',\n          // The stage normally sits 1 viewport into the content along the swipe axis.\n          top: axis === 'y' ? stageStart : 0,\n          left: axis === 'x' ? stageStart : 0,\n          height: '100dvh',\n          width: '100dvw',\n          display: 'flex',\n          flexDirection: axis === 'y' ? 'column' : 'row',\n          alignItems,\n          justifyContent\n        }}>\n        <Modal {...props} ref={ref} {...sheetProps}>\n          {renderProps => (\n            <>\n              {snapPoints && (\n                // Excludes the overscroll padding so percentages are relative to the visible sheet.\n                <div\n                  style={{\n                    position: 'absolute',\n                    inset: 0,\n                    ...(overscrollInset ? {[position]: overscrollInset} : null),\n                    pointerEvents: 'none'\n                  }}>\n                  {snapPoints.map((point, i) => (\n                    <DetentPoint\n                      key={i}\n                      point={point}\n                      axis={axis}\n                      after={after}\n                      isInitial={i === 0}\n                    />\n                  ))}\n                </div>\n              )}\n              {typeof props.children === 'function'\n                ? props.children({...renderProps, ...values})\n                : props.children}\n            </>\n          )}\n        </Modal>\n      </div>\n      {/* Snap marker for the exit at the far end of the scroll content. */}\n      <SnapPoint point={endMarker} align={isClamped && before ? 'none' : 'end'} axis={axis} />\n    </div>\n  );\n});\n\n// Measures how far the sheet must scroll from its smallest snap point to be fully revealed, i.e. the\n// distance from that snap point's marker to the stage's exit edge. Measuring the rendered markers\n// means snap points can use any CSS length, including percentages of the sheet. Uses layout offsets\n// rather than bounding rects so swipe/stack animation transforms don't affect it.\nfunction useSnapPointTravel(\n  stageRef: React.RefObject<HTMLDivElement | null>,\n  sheetRef: React.RefObject<HTMLDivElement | null>,\n  axis: Axis,\n  after: boolean,\n  // Space-separated snap points, so markers are re-measured when they change. Null to disable.\n  snapPointsKey: string | null\n): number {\n  let [travel, setTravel] = useState(0);\n  useLayoutEffect(() => {\n    let stage = stageRef.current;\n    let sheet = sheetRef.current;\n    if (snapPointsKey == null || !stage || !sheet) {\n      return;\n    }\n\n    let measure = () => {\n      let stageSize = axis === 'y' ? stage.clientHeight : stage.clientWidth;\n      let max = 0;\n      for (let marker of sheet.querySelectorAll<HTMLElement>('[data-sheet-detent]')) {\n        let offset = 0;\n        let el: HTMLElement | null = marker;\n        while (el && el !== stage) {\n          offset += axis === 'y' ? el.offsetTop : el.offsetLeft;\n          el = el.offsetParent as HTMLElement | null;\n        }\n        // Markers sit at the snap point's start edge for sheets exiting toward the end edge, and at\n        // its end edge for sheets exiting toward the start edge. The smallest snap point travels most.\n        let size = axis === 'y' ? marker.offsetHeight : marker.offsetWidth;\n        max = Math.max(max, after ? stageSize - offset : offset + size);\n      }\n      setTravel(max);\n    };\n\n    measure();\n    let observer = new ResizeObserver(measure);\n    observer.observe(stage);\n    observer.observe(sheet);\n    return () => observer.disconnect();\n  }, [stageRef, sheetRef, axis, after, snapPointsKey]);\n\n  return travel;\n}\n\nexport interface SheetBackdropProps\n  extends RenderProps<SheetRenderProps>, GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for\n   * the element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-SheetBackdrop'\n   */\n  className?: ClassNameOrFunction<SheetRenderProps>;\n  /** CSS `@keyframes` name for the animation that occurs while the user swipes. */\n  swipeAnimation?: string;\n  /**\n   * The snap point indices between which the swipe animation occurs. If omitted, the animation will\n   * occur over the full range of the sheet's movement.\n   */\n  swipeAnimationRange?: {start?: number; end?: number};\n}\n\n/**\n * The backdrop behind a sheet.\n */\nexport const SheetBackdrop = forwardRef(function SheetBackdrop(\n  props: SheetBackdropProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  let style = useSwipeAnimation(props);\n  let {values, isEntering, isExiting} = useContext(InternalSheetContext)!;\n  let state = useContext(OverlayTriggerStateContext)!;\n  let renderProps = useRenderProps({\n    ...props,\n    defaultClassName: 'react-aria-SheetBackdrop',\n    defaultStyle: {...style, position: 'absolute', inset: 0},\n    values: {...values, isEntering, isExiting, state}\n  });\n\n  return (\n    <div\n      ref={ref}\n      {...filterDOMProps(props, {global: true})}\n      {...renderProps}\n      {...getDataAttributes(values)}\n      data-entering={isEntering || undefined}\n      data-exiting={isExiting || undefined}\n    />\n  );\n});\n\nfunction useSwipeAnimation(props: SheetBackdropProps) {\n  let {swipeDirection, snapPoints, index, isEntering, isExiting} =\n    useContext(InternalSheetContext)!;\n  let {viewRange, viewDirection, viewIterations} = getSwipeConfig(swipeDirection);\n\n  if (props.swipeAnimation) {\n    let rangeStart =\n      props.swipeAnimationRange?.start != null\n        ? toLength(snapPoints?.[props.swipeAnimationRange.start] ?? '0%')\n        : '0%';\n    let rangeEnd =\n      props.swipeAnimationRange?.end != null\n        ? toLength(snapPoints?.[props.swipeAnimationRange.end] ?? '100%')\n        : '100%';\n    if (swipeDirection === 'top' || swipeDirection === 'left') {\n      rangeStart = `calc(100% - ${rangeStart})`;\n      rangeEnd = `calc(100% - ${rangeEnd})`;\n      [rangeStart, rangeEnd] = [rangeEnd, rangeStart];\n    }\n\n    // TODO: fix cover with range\n\n    if (supportsViewTimeline) {\n      return {\n        animationName: props.swipeAnimation,\n        animationTimeline: `--sheet-timeline-${index}`,\n        animationDirection: viewDirection,\n        animationIterationCount: viewIterations,\n        animationFillMode: 'both',\n        animationRange: `${viewRange} ${rangeStart} ${viewRange} ${rangeEnd}`,\n        animationTimingFunction: 'linear',\n        animationComposition: 'replace'\n      };\n    } else if (isEntering || isExiting) {\n      // Fallback for Firefox, which doesn't support view timelines.\n      return {\n        animationName: props.swipeAnimation,\n        animationDirection: isExiting ? 'reverse' : 'normal',\n        animationDuration: '300ms',\n        animationIterationCount: '1',\n        animationFillMode: 'both',\n        animationTimingFunction: 'linear',\n        animationComposition: 'replace'\n      };\n    }\n  }\n\n  return {};\n}\n\nexport interface SheetContentProps extends Omit<DialogProps, 'className' | 'isEntering'> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element.\n   *\n   * @default 'react-aria-SheetContent'\n   */\n  className?: string;\n}\n\n/**\n * The scrollable content area of a sheet.\n */\nexport const SheetContent = forwardRef(function SheetContent(\n  props: SheetContentProps,\n  ref: ForwardedRef<HTMLDivElement>\n) {\n  let {swipeDirection, index} = useContext(InternalSheetContext)!;\n  let {axis, before, after} = getSwipeConfig(swipeDirection);\n  let viewportLength = axis === 'y' ? '100dvh' : '100dvw';\n\n  return (\n    <Dialog\n      {...props}\n      ref={ref}\n      className={props.className || 'react-aria-SheetContent'}\n      data-sheet-content\n      style={{\n        ...props.style,\n        width: '100%',\n        height: '100%',\n        // The dialog is the subject of the view-progress timeline that drives all sheet animations.\n        // It is _not_ the Modal because that may have additional padding for overscroll and therefore never be entirely visible.\n        // The inset crops the scroll container's scrollport down to the visible viewport.\n        // @ts-ignore\n        viewTimelineName: `--sheet-timeline-${index}`,\n        viewTimelineAxis: axis,\n        viewTimelineInset: before && !after ? `${viewportLength} 0` : `0 ${viewportLength}`\n      }}\n    />\n  );\n});\n\nfunction reduceMotion() {\n  return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nfunction scrollAlongAxis(element: HTMLElement, axis: Axis, value: number, smooth = false) {\n  let behavior: ScrollBehavior | undefined = smooth && !reduceMotion() ? 'smooth' : undefined;\n  element.scrollTo(axis === 'y' ? {top: value, behavior} : {left: value, behavior});\n}\n\nfunction scrollDetentIntoView(\n  scroller: HTMLElement,\n  marker: HTMLElement,\n  axis: Axis,\n  align: 'start' | 'end',\n  smooth = false\n) {\n  let behavior: ScrollBehavior = smooth && !reduceMotion() ? 'smooth' : 'auto';\n  let markerRect = marker.getBoundingClientRect();\n  let scrollerRect = scroller.getBoundingClientRect();\n  let style = getComputedStyle(marker);\n  if (axis === 'y') {\n    if (align === 'start') {\n      let margin = parseFloat(style.scrollMarginTop) || 0;\n      // Rest the marker's start edge (less its scroll-margin) at the scrollport's start.\n      let top = markerRect.top - scrollerRect.top + scroller.scrollTop - margin;\n      scroller.scrollTo({top, behavior});\n    } else {\n      let margin = parseFloat(style.scrollMarginBottom) || 0;\n      // Rest the marker's end edge (plus its scroll-margin) at the scrollport's end.\n      let top =\n        markerRect.bottom - scrollerRect.top + scroller.scrollTop + margin - scroller.clientHeight;\n      scroller.scrollTo({top, behavior});\n    }\n  } else {\n    if (align === 'start') {\n      let margin = parseFloat(style.scrollMarginLeft) || 0;\n      let left = markerRect.left - scrollerRect.left + scroller.scrollLeft - margin;\n      scroller.scrollTo({left, behavior});\n    } else {\n      let margin = parseFloat(style.scrollMarginRight) || 0;\n      let left =\n        markerRect.right - scrollerRect.left + scroller.scrollLeft + margin - scroller.clientWidth;\n      scroller.scrollTo({left, behavior});\n    }\n  }\n}\n\nfunction calcToPx(calc: string) {\n  if (!calc.startsWith('calc(')) {\n    return calc;\n  }\n\n  let measure = document.createElement('div');\n  measure.inert = true;\n  measure.style.position = 'absolute';\n  measure.style.top = '0px';\n  measure.style.left = '0px';\n  measure.style.contain = 'strict';\n  measure.style.height = calc;\n  document.body.appendChild(measure);\n  let height = window.getComputedStyle(measure).height;\n  measure.remove();\n  return height;\n}\n"],"names":[],"version":3,"file":"Sheet.cjs.map"}