@easygov/web-components 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4YTFOHWE.js +44 -0
- package/dist/chunk-4YTFOHWE.js.map +1 -0
- package/dist/chunk-MPITA5PQ.js +27 -0
- package/dist/chunk-MPITA5PQ.js.map +1 -0
- package/dist/chunk-O3IXHDLE.js +37 -0
- package/dist/chunk-O3IXHDLE.js.map +1 -0
- package/dist/footer.d.ts +2 -0
- package/dist/footer.js +2 -0
- package/dist/footer.js.map +1 -0
- package/dist/header.d.ts +2 -0
- package/dist/header.js +2 -0
- package/dist/header.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +23 -12
- package/dist/easygov.global.js +0 -99
- package/dist/easygov.global.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0/node_modules/use-sync-external-store/shim/index.js","../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js","../../../node_modules/.pnpm/use-sync-external-store@1.6.0_react@19.3.0/node_modules/use-sync-external-store/shim/with-selector.js","../../react-components/src/ui/EasygovHeader/translations/de.ts","../../react-components/src/ui/EasygovHeader/translations/en.ts","../../react-components/src/ui/EasygovHeader/translations/fr.ts","../../react-components/src/ui/EasygovHeader/translations/it.ts","../../react-components/src/ui/EasygovHeader/translations/t.ts","../../react-components/src/ui/EasygovHeader/display-language-cookie.ts","../../react-components/src/ui/EasygovHeader/locale-store.ts","../../react-components/src/ui/EasygovHeader/EasygovHeader.tsx","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/button/Button.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/use-button/useButton.mjs","../../../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/safeReact.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useRefWithInit.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useStableCallback.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useIsoLayoutEffect.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/mergeObjects.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/merge-props/mergeProps.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/formatErrorMessage.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/owner.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useRenderElement.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useMergedRefs.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/getReactElementRef.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/reactVersion.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/empty.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/getStateAttributesProps.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/resolveClassName.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/resolveStyle.mjs","../../react-components/src/ui/Button/Button.tsx","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/index.parts.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/root/SelectRoot.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/visuallyHidden.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useOnFirstRender.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/usePreviousValue.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/isElementDisabled.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useControlled.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useValueAsRef.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/store/useStore.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/fastHooks.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/store/Store.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/store/ReactStore.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/mergeCleanups.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/addEventListener.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useOnMount.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useAnimationFrame.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useTimeout.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/parts.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/os.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/shared.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/engine.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/screen-reader.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/env.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/platform/media-query.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/event.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/shadowDom.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/stateAttributesMapping.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popupStateMapping.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/element.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/reason-parts.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/FocusGuard.mjs","../../../node_modules/.pnpm/@floating-ui+utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useId.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/constants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingTreeStore.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/resolveRef.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs","../../../node_modules/.pnpm/@floating-ui+core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.mjs","../../../node_modules/.pnpm/@floating-ui+dom@1.8.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs","../../../node_modules/.pnpm/@floating-ui+react-dom@2.1.9_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popups/popupHandle.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useTransitionStatus.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useAnimationsFinished.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popups/store.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useFloatingRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/root/SelectRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/field-constants/constants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useBaseUiId.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/areArraysEqual.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/itemEquality.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/resolveValueLabel.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/serializeValue.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/store.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/form-context/FormContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useValueChanged.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/useOpenInteractionType.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useEnhancedClickHandler.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/clamp.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/scrollEdges.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/label/SelectLabel.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/trigger/SelectTriggerDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/value/SelectValue.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/icon/SelectIcon.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/portal/SelectPortal.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/backdrop/SelectBackdrop.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/positioner/SelectPositioner.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/inertValue.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/useAnchorPositioning.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/hideMiddleware.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/positioner/SelectPositionerContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/InternalBackdrop.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/popup/utils.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/usePositioner.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs","../../../node_modules/.pnpm/@base-ui+utils@0.4.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/utils/useScrollLock.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/popup/SelectPopup.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/styles.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/toolbar/root/ToolbarRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/composite.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/csp-context/CSPContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/positioner/SelectPositionerCssVars.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/list/SelectList.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/item/SelectItem.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/item/SelectItemContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/item-indicator/SelectItemIndicator.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/item-text/SelectItemText.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/arrow/SelectArrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/scroll-down-arrow/SelectScrollDownArrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/scroll-arrow/SelectScrollArrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/scroll-up-arrow/SelectScrollUpArrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/group/SelectGroup.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/group/SelectGroupContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/group-label/SelectGroupLabel.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/listbox-separator/ListboxSeparator.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/select/separator/SelectSeparator.mjs","../../react-components/src/icons/icon-base.tsx","../../react-components/src/icons/ChevronDown.tsx","../../react-components/src/ui/Select/Select.tsx","../../react-components/src/ui/ErrorDialog/ErrorDialog.tsx","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/index.parts.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/backdrop/DialogBackdrop.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/root/DialogRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/close/DialogClose.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/description/DialogDescription.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/popup/DialogPopup.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/portal/DialogPortalContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/popup/DialogPopupCssVars.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/popup/DialogPopupDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/utils/stateAttributesMapping.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/portal/DialogPortal.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/root/useRenderDialogRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/root/useDialogRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/store/DialogStore.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/NullStore.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/root/DialogRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/viewport/DialogViewport.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/title/DialogTitle.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/trigger/DialogTrigger.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/dialog/store/DialogHandle.mjs","../../react-components/src/icons/Warning.tsx","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/index.parts.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/root/NavigationMenuRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/root/NavigationMenuRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/positioner/NavigationMenuPositionerCssVars.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/popup/NavigationMenuPopupCssVars.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/utils/setSharedFixedSize.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/list/NavigationMenuList.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/root/CompositeRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/root/useCompositeRoot.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/constants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/utils/constants.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/list/NavigationMenuDismissContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/floating-ui-react/utils/getEmptyRootContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/item/NavigationMenuItem.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/item/NavigationMenuItemContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/content/NavigationMenuContent.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/content/NavigationMenuContentDataAttributes.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/trigger/NavigationMenuTrigger.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/utils/isOutsideMenuEvent.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/internals/composite/item/CompositeItem.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/getCssDimensions.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/portal/NavigationMenuPortal.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/portal/NavigationMenuPortalContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/positioner/NavigationMenuPositioner.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/utils/useNavigationMenuAnchorPositioning.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/positioner/NavigationMenuPositionerContext.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/viewport/NavigationMenuViewport.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/backdrop/NavigationMenuBackdrop.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/popup/NavigationMenuPopup.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/arrow/NavigationMenuArrow.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/link/NavigationMenuLink.mjs","../../../node_modules/.pnpm/@base-ui+react@1.8.0_@types+react@19.3.0_react-dom@19.3.0_react@19.3.0__react@19.3.0/node_modules/@base-ui/react/navigation-menu/icon/NavigationMenuIcon.mjs","../../react-components/src/ui/NavigationMenu/NavigationMenu.tsx","../../react-components/src/icons/Document.tsx","../../react-components/src/icons/Search.tsx","../../react-components/src/icons/Send.tsx","../../react-components/src/icons/Settings.tsx","../../react-components/src/icons/Star.tsx","../../react-components/src/icons/UserAdd.tsx","../../react-components/src/icons/Login.tsx","../../react-components/src/icons/Logout.tsx","../../react-components/src/logos/BrandEasygov.tsx","../../../node_modules/.pnpm/jwt-decode@4.0.0/node_modules/jwt-decode/build/esm/index.js","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/Logger.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/JwtUtils.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/CryptoUtils.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/Event.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/PopupUtils.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/Timer.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/utils/UrlUtils.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/errors/ErrorResponse.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/errors/ErrorTimeout.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/AccessTokenEvents.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/CheckSessionIFrame.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/InMemoryWebStorage.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/errors/ErrorDPoPNonce.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/JsonService.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/MetadataService.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/WebStorageStateStore.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/OidcClientSettings.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/UserInfoService.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/TokenClient.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/ResponseValidator.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/State.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SigninState.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SigninRequest.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SigninResponse.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SignoutRequest.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SignoutResponse.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/ClaimsService.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/DPoPStore.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/OidcClient.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SessionMonitor.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/User.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/AbstractChildWindow.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/UserManagerSettings.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/IFrameWindow.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/IFrameNavigator.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/PopupWindow.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/PopupNavigator.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/navigators/RedirectNavigator.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/UserManagerEvents.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/SilentRenewService.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/RefreshState.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/UserManager.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/package.json","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/Version.ts","../../../node_modules/.pnpm/oidc-client-ts@3.5.0/node_modules/oidc-client-ts/src/IndexedDbDPoPStore.ts","../../react-components/src/ui/EasygovHeader/env.ts","../../react-components/src/ui/EasygovHeader/session.ts","../../react-components/src/ui/EasygovHeader/url-context.ts","../../react-components/src/ui/EasygovHeader/header-context-store.ts","../../react-components/package.json","../../react-components/src/ui/EasygovHeader/version-store.ts","../../react-components/src/ui/EasygovHeader/header-context-error.ts"],"sourcesContent":["/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useState = React.useState,\n useEffect = React.useEffect,\n useLayoutEffect = React.useLayoutEffect,\n useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n var value = getSnapshot(),\n _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n inst = _useState[0].inst,\n forceUpdate = _useState[1];\n useLayoutEffect(\n function () {\n inst.value = value;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n },\n [subscribe, value, getSnapshot]\n );\n useEffect(\n function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n });\n },\n [subscribe]\n );\n useDebugValue(value);\n return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n return getSnapshot();\n}\nvar shim =\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ? useSyncExternalStore$1\n : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","/**\n * @license React\n * use-sync-external-store-shim/with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\"),\n shim = require(\"use-sync-external-store/shim\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = shim.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.production.js');\n} else {\n module.exports = require('../cjs/use-sync-external-store-shim/with-selector.development.js');\n}\n","export default {\n login: 'Anmelden',\n logout: 'Abmelden',\n dashboard: 'Dashboard',\n selectLanguage: 'Sprache wählen',\n loginSuccess: 'Sie sind jetzt angemeldet.',\n logoutSuccess: 'Sie wurden abgemeldet.',\n skipToMain: 'Zum Hauptinhalt springen',\n allGovServices: 'Alle Behördenleistungen',\n register: 'Registrieren',\n myFavorites: 'Meine Favoriten',\n settings: 'Einstellungen',\n myCompanies: 'Meine Unternehmen',\n search: 'Suchen',\n testEnvironment: 'Testumgebung',\n errorTitle: 'Fehler',\n errorFallbackMessage: 'Beim Laden der Kopfzeilendaten ist ein Fehler aufgetreten.',\n errorCustomerAccountNotAccessible: 'Sie haben keinen Zugriff auf das ausgewählte Kundenkonto.',\n errorReference: 'Referenz',\n errorCloseLabel: 'Schliessen',\n errorDetailsLabel: 'Details',\n} as const;\n","export default {\n login: 'Sign In',\n logout: 'Sign Out',\n dashboard: 'Dashboard',\n selectLanguage: 'Select language',\n loginSuccess: 'You are now signed in.',\n logoutSuccess: 'You have been signed out.',\n skipToMain: 'Skip to main content',\n allGovServices: 'All government services',\n register: 'Register',\n myFavorites: 'My favorites',\n settings: 'Settings',\n myCompanies: 'My companies',\n search: 'Search',\n testEnvironment: 'Test environment',\n errorTitle: 'Error',\n errorFallbackMessage: 'An error occurred while loading header data.',\n errorCustomerAccountNotAccessible: 'You do not have access to the selected customer account.',\n errorReference: 'Reference',\n errorCloseLabel: 'Close',\n errorDetailsLabel: 'Details',\n} as const;\n","export default {\n login: 'Se connecter',\n logout: 'Se déconnecter',\n dashboard: 'Tableau de bord',\n selectLanguage: 'Choisir la langue',\n loginSuccess: 'Vous êtes maintenant connecté.',\n logoutSuccess: 'Vous avez été déconnecté.',\n skipToMain: 'Aller au contenu principal',\n allGovServices: 'Toutes les prestations administratives',\n register: \"S'inscrire\",\n myFavorites: 'Mes favoris',\n settings: 'Paramètres',\n myCompanies: 'Mes entreprises',\n search: 'Rechercher',\n testEnvironment: 'Environnement de test',\n errorTitle: 'Erreur',\n errorFallbackMessage: \"Une erreur est survenue lors du chargement des données d'en-tête.\",\n errorCustomerAccountNotAccessible: \"Vous n'avez pas accès au compte client sélectionné.\",\n errorReference: 'Référence',\n errorCloseLabel: 'Fermer',\n errorDetailsLabel: 'Détails',\n} as const;\n","export default {\n login: 'Accedi',\n logout: 'Esci',\n dashboard: 'Dashboard',\n selectLanguage: 'Seleziona la lingua',\n loginSuccess: 'Hai effettuato l\\'accesso.',\n logoutSuccess: 'Hai effettuato il logout.',\n skipToMain: 'Vai al contenuto principale',\n allGovServices: 'Tutte le prestazioni statali',\n register: 'Registrati',\n myFavorites: 'I miei preferiti',\n settings: 'Impostazioni',\n myCompanies: 'Le mie aziende',\n search: 'Cerca',\n testEnvironment: 'Ambiente di test',\n errorTitle: 'Errore',\n errorFallbackMessage: \"Si è verificato un errore durante il caricamento dei dati dell'intestazione.\",\n errorCustomerAccountNotAccessible: 'Non hai accesso al conto cliente selezionato.',\n errorReference: 'Riferimento',\n errorCloseLabel: 'Chiudi',\n errorDetailsLabel: 'Dettagli',\n} as const;\n","import de from './de';\nimport en from './en';\nimport fr from './fr';\nimport it from './it';\n\nconst dictionaries = { de, en, fr, it };\n\nexport type Locale = keyof typeof dictionaries;\nexport type TranslationKey = keyof typeof de;\n\nexport function t(key: TranslationKey, locale: Locale = 'de'): string {\n return dictionaries[locale]?.[key] ?? dictionaries['en']?.[key] ?? key;\n}\n\nexport const LOCALES: Array<{ value: Locale; label: string }> = [\n { value: 'de', label: 'Deutsch' },\n { value: 'en', label: 'English' },\n { value: 'fr', label: 'Français' },\n { value: 'it', label: 'Italiano' },\n];\n","// The DisplayLanguage cookie (EGOV-1451). Split out from locale-store.ts because jsdom stores\n// `document.cookie` but ignores the Domain attribute entirely — it cannot simulate the\n// cross-subdomain sharing that is the whole point of this cookie. Domain derivation is therefore\n// a pure, separately unit-tested function, the same arrangement `buildHref` already uses.\n\nimport { LOCALES, type Locale } from './translations/t';\n\nexport const DISPLAY_LANGUAGE_COOKIE = 'eg-display-language';\n\nconst ONE_YEAR_SECONDS = 60 * 60 * 24 * 365;\n\n/**\n * The parent domain every EasyGov subdomain of this stage shares, so info, core and the\n * Fachmodule read one cookie — derived by stripping the leading hostname label, the same trick\n * `env.ts` uses to build sibling origins. Scoping falls out of the hostname, so IN, VP and\n * production each get their own cookie with no env var.\n *\n * Returns null (meaning: set no Domain attribute, host-only cookie) when a Domain would be\n * invalid: a hostname with no dot (localhost), a bare two-label domain whose remainder is a\n * public suffix (`easygov.swiss` -> `.swiss`, which browsers reject, silently dropping the\n * cookie), or a numeric IP host.\n */\nexport function resolveCookieDomain(hostname: string): string | null {\n if (/^[\\d.]+$/.test(hostname)) return null;\n const dotIndex = hostname.indexOf('.');\n if (dotIndex === -1) return null;\n const remainder = hostname.slice(dotIndex + 1);\n if (!remainder.includes('.')) return null;\n return `.${remainder}`;\n}\n\n/**\n * Every scope whose cookie of this name could be sent *ahead* of the canonical one on `hostname`:\n * the host-only scope (no Domain attribute) and each parent domain above the canonical one, up to\n * the same public-suffix guard `resolveCookieDomain` uses. `null` means host-only.\n *\n * This exists because the stage domains nest. Production writes `Domain=.easygov.swiss`, IN writes\n * `Domain=.in.easygov.swiss` — and `.easygov.swiss` domain-matches `info.in.easygov.swiss`, so a\n * user who picked a language on production and then opens IN sends *two* `eg-display-language`\n * cookies, both `Path=/`. RFC 6265 orders equal-path cookies oldest-first, so the production one\n * comes first and `readDisplayLanguageCookie`'s `.find()` returns it forever, no matter what the\n * IN write does.\n *\n * It has to be fixed on the write side: `document.cookie` exposes no Domain attribute, so a reader\n * physically cannot tell the duplicates apart.\n *\n * Returns `[]` when the canonical scope is already host-only (localhost, an apex domain, an IP).\n * There is nothing above it that this host may safely expire — clearing `.easygov.swiss` from the\n * apex would delete the shared cookie every subdomain depends on.\n *\n * @internal — exported for unit tests only; jsdom ignores Domain, so this is only testable pure.\n */\nexport function shadowingCookieScopes(hostname: string): Array<string | null> {\n const canonical = resolveCookieDomain(hostname);\n if (canonical === null) return [];\n const scopes: Array<string | null> = [null];\n // Walk up one label at a time: `in.easygov.swiss` -> `easygov.swiss` -> stop before `swiss`,\n // whose own remainder has no dot (the public-suffix guard).\n let current = canonical.slice(1);\n for (;;) {\n const dotIndex = current.indexOf('.');\n if (dotIndex === -1) break;\n const parent = current.slice(dotIndex + 1);\n if (!parent.includes('.')) break;\n scopes.push(`.${parent}`);\n current = parent;\n }\n return scopes;\n}\n\n/** A cookie value is attacker-editable — never trust it without checking it against LOCALES. */\nexport function isSupportedLocale(value: string | null | undefined): value is Locale {\n return value != null && LOCALES.some((l) => l.value === value);\n}\n\n/** @internal — exported for unit tests only; jsdom cannot exercise Domain/Secure. */\nexport function buildDisplayLanguageCookie(\n locale: Locale,\n hostname: string,\n protocol: string,\n): string {\n const parts = [\n `${DISPLAY_LANGUAGE_COOKIE}=${locale}`,\n 'Path=/',\n `Max-Age=${ONE_YEAR_SECONDS}`,\n 'SameSite=Lax',\n ];\n const domain = resolveCookieDomain(hostname);\n if (domain !== null) parts.push(`Domain=${domain}`);\n // Omitted on http so local development over plain HTTP still works.\n if (protocol === 'https:') parts.push('Secure');\n return parts.join('; ');\n}\n\n/**\n * Deletes this cookie at one scope. Browsers key a cookie on name + Domain + Path, so the deletion\n * has to repeat all three; `Secure` is mirrored too, because an insecure origin is not allowed to\n * overwrite a Secure cookie.\n *\n * @internal — exported for unit tests only; jsdom cannot exercise Domain/Secure.\n */\nexport function buildExpiredDisplayLanguageCookie(\n domain: string | null,\n protocol: string,\n): string {\n const parts = [`${DISPLAY_LANGUAGE_COOKIE}=`, 'Path=/', 'Max-Age=0', 'SameSite=Lax'];\n if (domain !== null) parts.push(`Domain=${domain}`);\n if (protocol === 'https:') parts.push('Secure');\n return parts.join('; ');\n}\n\nexport function readDisplayLanguageCookie(): Locale | null {\n if (typeof document === 'undefined') return null;\n const prefix = `${DISPLAY_LANGUAGE_COOKIE}=`;\n const match = document.cookie\n .split(';')\n .map((entry) => entry.trim())\n .find((entry) => entry.startsWith(prefix));\n if (match === undefined) return null;\n const value = match.slice(prefix.length);\n return isSupportedLocale(value) ? value : null;\n}\n\nexport function writeDisplayLanguageCookie(locale: Locale): void {\n if (typeof document === 'undefined' || typeof window === 'undefined') return;\n const { hostname, protocol } = window.location;\n // Clear any shadowing duplicate before writing, or the read would keep returning the older\n // cookie from a wider domain and the selection would look like it never happened. See\n // shadowingCookieScopes for why this is only fixable here.\n for (const scope of shadowingCookieScopes(hostname)) {\n document.cookie = buildExpiredDisplayLanguageCookie(scope, protocol);\n }\n document.cookie = buildDisplayLanguageCookie(locale, hostname, protocol);\n}\n","// The DisplayLanguage, published by EasygovHeader and observed by consuming modules through\n// useEasygovDisplayLanguage (EGOV-1451). A module-level store rather than React context, mirroring\n// session.ts and header-context-store.ts: a module must not have to mount a provider around the\n// header to read what the header already knows.\n//\n// Unlike header-context-store, this one self-initialises on first read. That store must return\n// null until a network call lands; this value is derivable from the cookie plus navigator with no\n// I/O, so a module can call getEasygovDisplayLanguage() before any header has mounted and get the\n// right answer — no null-handling, no waiting.\n\nimport {\n isSupportedLocale,\n readDisplayLanguageCookie,\n writeDisplayLanguageCookie,\n} from './display-language-cookie';\nimport type { Locale } from './translations/t';\n\n/**\n * Announces a change to sibling copies of this module on the same page. The web-components\n * drop-in bundles its own (tsup `noExternal`), so a page hosting <eg-easygov-header> alongside a\n * React app that imports the hook has two independent stores; without this they agree at load and\n * then drift the moment the user picks a language.\n *\n * Deliberately NOT named `languagechange`: that is a native window event (fired when the user\n * changes their browser language), and the header's own `languagechange` CustomEvent is\n * `composed: true, bubbles: true` and already reaches window. Reusing the name would make three\n * different things indistinguishable to a window listener.\n */\nexport const DISPLAY_LANGUAGE_SYNC_EVENT = 'eg:displaylanguagechange';\n\nconst FALLBACK_LOCALE: Locale = 'de';\n\nfunction detectBrowserLocale(): Locale | null {\n // Gated on `document`, not `navigator`. Node >= 24 — this repo's floor — defines a global\n // `navigator` on the *server*, whose `language` is the server machine's LANG (verified: `de-CH`\n // here). A `navigator` guard would therefore let the server's own locale become the SSR answer\n // and, since `snapshot` is module-level, cache it for the life of the process across every\n // request. `document` is the browser-only signal.\n if (typeof document === 'undefined') return null;\n const language: unknown = typeof navigator === 'undefined' ? undefined : navigator.language;\n // Not merely defensive typing: a runtime may define `navigator` without `language`, and the\n // unguarded `.slice` was a TypeError waiting there.\n if (typeof language !== 'string') return null;\n const lang = language.slice(0, 2).toLowerCase();\n return isSupportedLocale(lang) ? lang : null;\n}\n\nfunction resolve(): Locale {\n return readDisplayLanguageCookie() ?? detectBrowserLocale() ?? FALLBACK_LOCALE;\n}\n\n// null means \"not resolved yet\" — the lazy initialisation flag, not a language.\nlet snapshot: Locale | null = null;\nconst listeners = new Set<() => void>();\nlet installed = false;\n\nfunction notify(): void {\n for (const listener of [...listeners]) listener();\n}\n\nfunction apply(next: Locale): void {\n if (next === snapshot) return;\n snapshot = next;\n notify();\n}\n\nfunction refresh(): void {\n apply(resolve());\n}\n\n/**\n * The sync-event listener. Applies the locale the event carries rather than re-reading the cookie,\n * because `dispatchEvent` is synchronous: the instance that called `set()` receives its own event\n * inline and a cookie re-read there would overwrite the selection it just made with whatever the\n * cookie happens to return — which is not necessarily what was written (see\n * `shadowingCookieScopes`). Falls back to the cookie when the detail is missing or unusable: the\n * event name is public on `window`, so a foreign dispatch can carry anything.\n */\nfunction onSyncEvent(event: Event): void {\n const detail: unknown = (event as CustomEvent<unknown>).detail;\n const locale =\n typeof detail === 'object' && detail !== null && 'locale' in detail\n ? (detail as { locale: unknown }).locale\n : undefined;\n if (typeof locale === 'string' && isSupportedLocale(locale)) {\n apply(locale);\n return;\n }\n refresh();\n}\n\n// Named rather than an inline arrow so addEventListener can dedupe it — see install().\nfunction onVisibilityChange(): void {\n if (document.visibilityState === 'visible') refresh();\n}\n\n// Installed on first subscribe (never from getSnapshot, which React calls during render) and\n// never uninstalled, matching url-context.ts. A no-op while nobody is subscribed.\n//\n// Every listener is a module-level named function, so re-running install() after a test reset is\n// harmless: the DOM ignores addEventListener for a (type, listener) pair it already holds.\nfunction install(): void {\n if (installed || typeof window === 'undefined') return;\n installed = true;\n window.addEventListener(DISPLAY_LANGUAGE_SYNC_EVENT, onSyncEvent);\n // Cookies fire no change event, so cross-tab sync cannot be push-based the way the old\n // `storage` listener was. Re-resolving when the tab comes back is enough: a background tab is\n // not being read. This also catches a change made on a *different subdomain*, which the\n // `storage` event never could.\n window.addEventListener('focus', refresh);\n document.addEventListener('visibilitychange', onVisibilityChange);\n // The getter resolves fresh while uninstalled and only starts caching from here, so the cache\n // has to be seeded now — otherwise a snapshot left over from a `set()` made before any listener\n // existed could be older than the cookie. No subscriber has been added yet on the first\n // install(), so the notify inside is a no-op.\n refresh();\n}\n\n/**\n * The current DisplayLanguage. Safe to call at any time, including before any EasygovHeader has\n * mounted — it resolves cookie -> browser language -> \"de\" with no I/O. Identity is a plain\n * string, so it is a valid `useSyncExternalStore` snapshot.\n *\n * Caching begins only once listeners are installed, i.e. after the first\n * `subscribeEasygovDisplayLanguage`. Until then every call re-resolves, because nothing would\n * invalidate a cache: a module that imports this getter and polls it without ever subscribing —\n * exactly the second-bundle-instance topology the sync event exists for — would otherwise be\n * pinned to the first value it ever read, for the life of the page. Installing from here is not an\n * option: React calls this during render, which must stay side-effect free.\n */\nexport function getEasygovDisplayLanguage(): Locale {\n // Once installed, `snapshot` is always non-null: install() ends with refresh(), and every\n // listener that can change it assigns a resolved value.\n if (!installed) return resolve();\n return snapshot ?? resolve();\n}\n\n/**\n * Server/hydration snapshot. Always \"de\": the resolution chain is browser-only (no `document`\n * means no cookie and no browser language), so this is the value the client's first read\n * reproduces before any cookie is seen — which is what keeps hydration from mismatching.\n */\nexport function getServerDisplayLanguage(): Locale {\n return FALLBACK_LOCALE;\n}\n\n/**\n * Sets the DisplayLanguage as an explicit user choice: writes the cookie, updates this store, and\n * announces it to sibling bundle instances. Called by the header's language switcher, and\n * available to modules that must set the language themselves (e.g. a deep link into a /fr/… route)\n * — going through the same path is what keeps one source of truth.\n *\n * The cookie is written ONLY here, never when the browser language is auto-detected. That is what\n * keeps \"default is the browser language\" true: baking a detected language into the cookie on\n * first page view would freeze it for a user who later changes their browser.\n */\nexport function setEasygovDisplayLanguage(locale: Locale): void {\n writeDisplayLanguageCookie(locale);\n apply(locale);\n // Dispatched unconditionally: a sibling instance may hold a different snapshot even when ours\n // already matches. The locale rides along on the event so no listener — including our own, which\n // receives this synchronously and inline — has to trust a cookie read-back to learn it.\n if (typeof window !== 'undefined') {\n window.dispatchEvent(new CustomEvent(DISPLAY_LANGUAGE_SYNC_EVENT, { detail: { locale } }));\n }\n}\n\nexport function subscribeEasygovDisplayLanguage(listener: () => void): () => void {\n install();\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * @internal — test-only. Resets `installed` too, so a test can observe install()'s side effects\n * (the legacy-key cleanup). Safe because every listener install() registers is a module-level\n * named function, which addEventListener deduplicates rather than double-registering.\n */\nexport function __resetDisplayLanguageForTests(): void {\n snapshot = null;\n listeners.clear();\n installed = false;\n}\n","\"use client\";\n\nimport type React from \"react\";\nimport {\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Select, SelectContent, SelectItem, SelectTrigger } from \"../Select\";\nimport { Grid, GridItem } from \"../Grid\";\nimport { ErrorDialog } from \"../ErrorDialog\";\nimport {\n NavigationMenu,\n NavigationMenuAnchor,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from \"../NavigationMenu\";\nimport { Document } from \"../../icons/Document\";\nimport { Search } from \"../../icons/Search\";\nimport { Send } from \"../../icons/Send\";\nimport { Settings } from \"../../icons/Settings\";\nimport { Star } from \"../../icons/Star\";\nimport { UserAdd } from \"../../icons/UserAdd\";\nimport { Login } from \"../../icons/Login\";\nimport { Logout } from \"../../icons/Logout\";\nimport { BrandEasygov } from \"../../logos/BrandEasygov\";\nimport { BrandSwiss } from \"../../logos/BrandSwiss\";\nimport {\n type AuthStatus,\n type SessionUser,\n getAccessToken as readToken,\n getAuthStatus,\n getSessionInitialized,\n getUser as readUser,\n initSession,\n onSessionChange,\n requireSession,\n signOut,\n} from \"./session\";\nimport {\n type EnvironmentStage,\n resolveCoreApiOrigin,\n resolveCoreOrigin,\n resolveEnvironmentStage,\n resolveInfoOrigin,\n} from \"./env\";\nimport {\n readContextFromUrl,\n readServerUrlContext,\n readUrlContext,\n subscribeUrlContext,\n type UrlContext,\n} from \"./url-context\";\nimport {\n type EasygovHeaderContext,\n publishHeaderContext,\n readHeaderContext,\n readServerHeaderContext,\n subscribeHeaderContext,\n} from \"./header-context-store\";\nimport {\n ensureBackendVersionFetch,\n readServerVersionInfo,\n readVersionInfo,\n subscribeVersionInfo,\n type EasygovVersionInfo,\n} from \"./version-store\";\nimport {\n getEasygovDisplayLanguage,\n getServerDisplayLanguage,\n setEasygovDisplayLanguage,\n subscribeEasygovDisplayLanguage,\n} from \"./locale-store\";\nimport { type Locale, LOCALES, t } from \"./translations/t\";\nimport type { HeaderContext, HeaderContextClaims } from \"./types\";\nimport {\n type HeaderContextErrorState,\n mapHeaderContextError,\n parseHeaderContextProblem,\n} from \"./header-context-error\";\nimport \"./EasygovHeader.css\";\n\n// ── Generic helpers ────────────────────────────────────────────────────────────\n\n// A store that never changes needs no subscription — shared by every\n// useSyncExternalStore call in this file that only defers a one-time,\n// browser-only read (window.location) past hydration.\nconst NEVER_CHANGES = () => () => {};\n\n// Mirrors `value` into a ref via an effect, so callbacks can read the latest\n// value without listing it as a dependency (which would re-run them on change).\nfunction useLatestRef<T>(value: T): React.RefObject<T> {\n const ref = useRef(value);\n useEffect(() => {\n ref.current = value;\n }, [value]);\n return ref;\n}\n\n// ── Session store (useSyncExternalStore) ─────────────────────────────────────\n\nexport interface EasygovSession {\n user: SessionUser | null;\n accessToken: string | null;\n}\n\nconst EMPTY_SESSION: EasygovSession = { user: null, accessToken: null };\nlet cachedSnapshot: EasygovSession = EMPTY_SESSION;\n\nfunction readSession(): EasygovSession {\n const user = readUser();\n const accessToken = readToken();\n if (\n user === cachedSnapshot.user &&\n accessToken === cachedSnapshot.accessToken\n )\n return cachedSnapshot;\n cachedSnapshot = { user, accessToken };\n return cachedSnapshot;\n}\n\nfunction subscribeSession(listener: () => void): () => void {\n return onSessionChange(() => listener());\n}\n\nexport function useEasygovSession(): EasygovSession {\n return useSyncExternalStore(\n subscribeSession,\n readSession,\n () => EMPTY_SESSION,\n );\n}\n\n// Server/hydration snapshot is 'initializing' so a protected route renders its\n// loading slot on first paint — never the logged-out fallback — until the async\n// OIDC check resolves on the client. This is what prevents a transient fallback\n// (and its redirect) during OIDC callback processing on a static export.\nexport function useEasygovAuthStatus(): AuthStatus {\n return useSyncExternalStore(\n subscribeSession,\n getAuthStatus,\n () => \"initializing\" as AuthStatus,\n );\n}\n\n// ── Header context store (useSyncExternalStore) ──────────────────────────────\n\n/**\n * The header's current context: the raw `contextJwt` and its decoded claims. Reflects the last\n * context an EasygovHeader resolved — the hook never fetches on its own, returns empty values\n * until that first resolution, and is NOT cleared when the header unmounts.\n *\n * Claims track the last context that resolved successfully: if a *re*fetch fails (non-2xx,\n * network error), the previous claims stay in place rather than resetting to null, so they can\n * still describe a previously selected account after the URL has moved on. Only sign-out (or a\n * failed *first* fetch) leaves `claims` at `null`.\n *\n * IMPORTANT — trust boundary: `claims` is decoded, NOT signature-verified. Use it to prefill\n * forms and drive rendering; never to authorize. A backend receiving `contextJwt` MUST verify it\n * against core-backend's published JWKS.\n */\nexport function useEasygovHeaderContext(): EasygovHeaderContext {\n return useSyncExternalStore(\n subscribeHeaderContext,\n readHeaderContext,\n readServerHeaderContext,\n );\n}\n\n// ── DisplayLanguage store (useSyncExternalStore) ─────────────────────────────\n\n/**\n * The current DisplayLanguage (EGOV-1451). Resolved as: the `eg-display-language` cookie shared\n * across every EasyGov subdomain, else the browser language, else \"de\". The cookie is written only\n * on an explicit pick in the header's switcher, so the browser-language default stays live until\n * the user overrides it.\n *\n * Unlike useEasygovHeaderContext this never returns a placeholder: the value needs no network\n * call, so a module can read it before any header has mounted.\n */\nexport function useEasygovDisplayLanguage(): Locale {\n return useSyncExternalStore(\n subscribeEasygovDisplayLanguage,\n getEasygovDisplayLanguage,\n getServerDisplayLanguage,\n );\n}\n\n// ── Version store (useSyncExternalStore) ─────────────────────────────────────\n\n/**\n * The current version info: this package's own version (always known) and the core-backend\n * API version (null until EasygovHeader's mount effect fetches it, or on fetch failure — see\n * version-store.ts). Unlike useEasygovHeaderContext, no header needs to be mounted for\n * `libraryVersion` to resolve; only `backendVersion` requires a mounted EasygovHeader to\n * trigger the fetch.\n */\nexport function useEasygovVersionInfo(): EasygovVersionInfo {\n return useSyncExternalStore(subscribeVersionInfo, readVersionInfo, readServerVersionInfo);\n}\n\n// ── URL context store (useSyncExternalStore) ─────────────────────────────────\n\n// See url-context.ts for why the URL is observed through a store rather than a `popstate`\n// listener: pushState/replaceState — i.e. every client-side router navigation — fire no event.\n// The snapshot's identity is stable while the context is unchanged, so it doubles as the\n// dependency that keys context-derived work.\nfunction useUrlContext(): UrlContext | null {\n return useSyncExternalStore(subscribeUrlContext, readUrlContext, readServerUrlContext);\n}\n\n// ── HeaderContext hook ────────────────────────────────────────────────────────\n\n// Decodes (does NOT verify) a JWT's payload segment. Safe here because the JWT\n// was just fetched over a direct authenticated HTTPS call to core-backend — the\n// call itself is the trust boundary, not the token's signature. Fach applications\n// that receive contextJwt via onContextChange/contextchange MUST verify it\n// themselves against core-backend's published JWKS before trusting any claim.\nfunction decodeJwtPayload<T>(jwt: string): T | null {\n try {\n const payload = jwt.split('.')[1];\n if (!payload) return null;\n const base64 = payload.replace(/-/g, '+').replace(/_/g, '/');\n const padded = base64 + '='.repeat((4 - (base64.length % 4)) % 4);\n const binary = atob(padded);\n const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));\n const json = new TextDecoder().decode(bytes);\n return JSON.parse(json) as T;\n } catch {\n return null;\n }\n}\n\nfunction useHeaderContext(\n session: EasygovSession,\n urlContext: UrlContext | null,\n): {\n claims: HeaderContextClaims | null;\n contextJwt: string | null;\n accessibleAccountCount: number;\n contextError: HeaderContextErrorState | null;\n dismissContextError: () => void;\n} {\n const [contextJwt, setContextJwt] = useState<string | null>(null);\n const [accessibleAccountCount, setAccessibleAccountCount] = useState<number>(0);\n // See header-context-error.ts for why this is `{ problem } | null` rather than a bare\n // `HeaderContextProblemDetail | null` — the wrapper is what lets \"no error\" and \"an error\n // whose body didn't parse\" both exist as distinct states.\n const [contextError, setContextError] = useState<HeaderContextErrorState | null>(null);\n // Key the effect on the user's identity, not the access token: oidc-client-ts\n // issues a fresh token (and a new session.user object) on every silent renew,\n // which would otherwise re-trigger this fetch — and the loading skeleton —\n // every renewal cycle even though the logged-in user hasn't changed.\n const userSub = session.user?.sub ?? null;\n\n useEffect(() => {\n if (userSub === null) {\n setContextJwt(null);\n setAccessibleAccountCount(0);\n setContextError(null);\n return;\n }\n const token = readToken();\n const apiOrigin = resolveCoreApiOrigin();\n if (!token || !apiOrigin) return;\n\n const controller = new AbortController();\n\n void (async () => {\n try {\n const url = new URL(`${apiOrigin}/external/bff/api/header-context`);\n if (urlContext?.type === \"customer\") {\n url.searchParams.set(\"selectedCustomerAccountId\", urlContext.id);\n } else if (urlContext?.type === \"process\") {\n url.searchParams.set(\"selectedProcessId\", urlContext.id);\n } else if (urlContext?.type === \"parentprocess\") {\n url.searchParams.set(\"selectedParentProcessId\", urlContext.id);\n }\n const res = await fetch(url.toString(), {\n headers: {\n Authorization: `Bearer ${token}`,\n Accept: \"application/json\",\n },\n signal: controller.signal,\n });\n // A superseded request (rapid urlContext change) can reach any of the awaits below after\n // its controller has already been aborted by this effect's own cleanup. Every await point\n // that follows is re-checked against controller.signal.aborted before writing state, so a\n // stale response — even one that resolved/settled instead of throwing — never lands.\n if (controller.signal.aborted) return;\n if (!res.ok) {\n console.warn(`[easygov-header] getHeaderContext returned ${res.status}`);\n // This hand-rolled fetch never goes through react-query, so it never reaches the\n // app-wide QueryCache/MutationCache onError wiring that opens the shared ErrorDialog\n // for every $bffApi call (EGOV-1478) — surface it ourselves instead.\n const problem = await parseHeaderContextProblem(res);\n // parseHeaderContextProblem deliberately swallows ALL rejections (including an\n // AbortError from the body read racing this same abort) and returns null for a\n // genuinely malformed body — so an abort that fires while that read is in flight is\n // indistinguishable from a malformed body by the time we get here. Re-check the signal\n // rather than trust the resolved value: without this, a superseded request could still\n // pop a generic error dialog, even after the replacement request already succeeded.\n if (controller.signal.aborted) return;\n setContextError({ problem });\n return;\n }\n const data = (await res.json()) as HeaderContext;\n if (controller.signal.aborted) return;\n const decoded = decodeJwtPayload<HeaderContextClaims>(data.contextJwt);\n if (decoded === null) {\n console.warn(\"[easygov-header] failed to decode contextJwt payload\");\n // No Problem Detail body exists for this branch (the response was 2xx) — generic\n // fallback message only.\n setContextError({ problem: null });\n return;\n }\n setContextJwt(data.contextJwt);\n setAccessibleAccountCount(data.accessibleAccountCount);\n setContextError(null);\n } catch (err) {\n if ((err as Error).name !== \"AbortError\") {\n console.error(\"[easygov-header] getHeaderContext failed\", err);\n setContextError({ problem: null });\n }\n }\n })();\n\n return () => controller.abort();\n // urlContext's identity is stable per context, not per URL — see readUrlContext.\n }, [userSub, urlContext]);\n\n // claims is fully derivable from contextJwt (both are always set together\n // above), so it's computed here rather than kept as a second, redundant\n // piece of state that could drift out of sync.\n const claims = useMemo(\n () => (contextJwt !== null ? decodeJwtPayload<HeaderContextClaims>(contextJwt) : null),\n [contextJwt],\n );\n\n const dismissContextError = useCallback(() => setContextError(null), []);\n\n return { claims, contextJwt, accessibleAccountCount, contextError, dismissContextError };\n}\n\n// ── Navigation helpers (shared by every real-navigation nav item) ───────────\n\n// `path` always starts with \"/\" (every call site below passes a literal like \"/services\").\n// `origin` legitimately may or may not have a trailing slash — env-configured origins\n// (NEXT_PUBLIC_INFO_ORIGIN et al., see env.ts) are free-text and have shipped with one in\n// practice — so strip any trailing slash(es) from origin here rather than relying on every\n// origin resolver/env var to never have one. Exported for unit tests only.\nexport function buildHref(origin: string | null, path: string): string {\n const normalizedOrigin = origin?.replace(/\\/+$/, \"\") ?? \"\";\n return `${normalizedOrigin}${path}`;\n}\n\nfunction makeNavigateHandler(\n onNavigate: (path: string) => boolean,\n path: string,\n): (e: React.MouseEvent) => void {\n return (e) => {\n if (onNavigate(path)) e.preventDefault();\n };\n}\n\n// ── Internal Header (presentational) ─────────────────────────────────────────\n\ninterface HeaderProps {\n initializing: boolean;\n user: { name: string } | null;\n onLogin: () => void;\n onLogout: () => void;\n dashboardPath: string;\n favoritesPath: string;\n companyPath: string;\n /** Path to core's service catalogue: carries the customer context when known, else \"/services\". */\n servicesPath: string;\n /** Path to the user's profile: carries the customer context when known, else \"/profile\". */\n profilePath: string;\n coreOrigin: string | null;\n infoOrigin: string | null;\n /** Path on the info module the logo links to: the customer context when known, else \"/\". */\n infoHomePath: string;\n /** Native tooltip text for the logo, combining the library and (once resolved) backend version. */\n logoTitle: string;\n environmentStage: EnvironmentStage | null;\n userDisplayName: string;\n companyLabel: string | null;\n accessibleAccountCount: number;\n onNavigate: (path: string) => boolean;\n locale: Locale;\n onLocaleChange: (locale: Locale) => void;\n portalContainer: HTMLElement | ShadowRoot | null;\n headerRef: React.RefObject<HTMLElement | null>;\n announcement: string;\n}\n\n/** @internal — exported for unit tests only */\nexport function Header({\n initializing,\n user,\n onLogin,\n onLogout,\n dashboardPath,\n favoritesPath,\n companyPath,\n servicesPath,\n profilePath,\n coreOrigin,\n infoOrigin,\n infoHomePath,\n logoTitle,\n environmentStage,\n userDisplayName,\n companyLabel,\n accessibleAccountCount,\n onNavigate,\n locale,\n onLocaleChange,\n portalContainer,\n headerRef,\n announcement,\n}: Readonly<HeaderProps>): React.JSX.Element {\n const [loginPending, setLoginPending] = useState(false);\n const [logoutPending, setLogoutPending] = useState(false);\n\n // Login/Logout send the user through a full top-level navigation to the OIDC provider (see\n // session.ts requireSession()/signOut()). If they cancel and return via the browser Back\n // button, the page is very likely restored from bfcache rather than reloaded — no JS\n // re-executes on a bfcache restore, so the pending flag set just before the redirect is still\n // `true`, and the button's own click guard below would otherwise swallow every future click\n // permanently. `pageshow` with `persisted: true` is the standard signal for a bfcache restore.\n useEffect(() => {\n const onPageShow = (e: PageTransitionEvent): void => {\n if (!e.persisted) return;\n setLoginPending(false);\n setLogoutPending(false);\n };\n window.addEventListener(\"pageshow\", onPageShow);\n return () => window.removeEventListener(\"pageshow\", onPageShow);\n }, []);\n\n const handleLogin = () => {\n setLoginPending(true);\n onLogin();\n };\n const handleLogout = () => {\n setLogoutPending(true);\n onLogout();\n };\n\n const isLoggedIn = user !== null;\n const AuthIcon = isLoggedIn ? Logout : Login;\n const authLabel = t(isLoggedIn ? \"logout\" : \"login\", locale);\n\n const selectAccountPath = `/select-account?returnTo=${encodeURIComponent(buildHref(coreOrigin, \"/dashboard\"))}`;\n\n return (\n <header ref={headerRef} className=\"eg-header\" role=\"banner\" data-slot=\"header\">\n {/* Skip link — WCAG 2.4.1 */}\n <a href=\"#main-content\" className=\"eg-header__skip-link\">\n {t(\"skipToMain\", locale)}\n </a>\n\n <Grid className=\"eg-header__grid\">\n <GridItem className=\"eg-header__content\">\n {/* Left: Brand + nav */}\n <div className=\"eg-header__left\">\n <div className=\"eg-header__brand-group\">\n <div className=\"eg-header__brand-clip\">\n <a\n href={buildHref(infoOrigin, infoHomePath)}\n className=\"eg-header__brand\"\n aria-label=\"EasyGov\"\n title={logoTitle}\n data-slot=\"header-logo\"\n >\n <BrandEasygov height={24} />\n </a>\n </div>\n {environmentStage !== null && (\n <span\n className=\"eg-header__env-badge\"\n data-slot=\"header-environment-badge\"\n >\n {t(\"testEnvironment\", locale)}: {environmentStage}\n </span>\n )}\n </div>\n\n <nav className=\"eg-header__nav\" aria-label=\"Main navigation\">\n <NavigationMenu container={portalContainer}>\n <NavigationMenuList>\n {isLoggedIn && accessibleAccountCount > 0 && (\n <NavigationMenuItem value=\"dashboard\">\n <NavigationMenuAnchor\n href={buildHref(coreOrigin, dashboardPath)}\n onClick={makeNavigateHandler(onNavigate, dashboardPath)}\n leadingIcon={<Send size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-nav-dashboard\"\n >\n {t(\"dashboard\", locale)}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )}\n {isLoggedIn && accessibleAccountCount > 0 && (\n <NavigationMenuItem value=\"favorites\">\n <NavigationMenuAnchor\n href={buildHref(coreOrigin, favoritesPath)}\n onClick={makeNavigateHandler(onNavigate, favoritesPath)}\n leadingIcon={<Star size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-nav-favorites\"\n >\n {t(\"myFavorites\", locale)}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )}\n {isLoggedIn && (\n <NavigationMenuItem value=\"all-services\">\n <NavigationMenuAnchor\n href={buildHref(coreOrigin, servicesPath)}\n onClick={makeNavigateHandler(onNavigate, servicesPath)}\n leadingIcon={<Document size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-nav-services\"\n >\n {t(\"allGovServices\", locale)}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )}\n </NavigationMenuList>\n </NavigationMenu>\n </nav>\n </div>\n\n {/* Right: account nav + language switcher + Swiss logo */}\n <div className=\"eg-header__right\">\n <nav className=\"eg-header__nav\" aria-label=\"Account navigation\">\n <NavigationMenu container={portalContainer}>\n <NavigationMenuList>\n {isLoggedIn &&\n accessibleAccountCount > 1 &&\n companyLabel !== null && (\n <NavigationMenuItem value=\"company-switcher\">\n <NavigationMenuTrigger data-slot=\"header-company-switcher-trigger\">\n {companyLabel}\n </NavigationMenuTrigger>\n <NavigationMenuContent>\n <NavigationMenuLink\n href={buildHref(coreOrigin, selectAccountPath)}\n onClick={makeNavigateHandler(onNavigate, selectAccountPath)}\n closeOnClick\n data-slot=\"header-company-switcher-select-account\"\n >\n {t(\"myCompanies\", locale)}\n </NavigationMenuLink>\n </NavigationMenuContent>\n </NavigationMenuItem>\n )}\n {initializing ? (\n <div\n className=\"eg-header__skeleton eg-header__skeleton--services\"\n aria-hidden=\"true\"\n />\n ) : (\n !isLoggedIn && (\n <NavigationMenuItem value=\"all-services-logged-out\">\n <NavigationMenuAnchor\n href={buildHref(coreOrigin, \"/services\")}\n onClick={makeNavigateHandler(onNavigate, \"/services\")}\n leadingIcon={<Document size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-nav-services\"\n >\n {t(\"allGovServices\", locale)}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )\n )}\n {initializing ? (\n <div\n className=\"eg-header__skeleton eg-header__skeleton--register\"\n aria-hidden=\"true\"\n />\n ) : (\n !isLoggedIn && (\n <NavigationMenuItem value=\"register\">\n <NavigationMenuAnchor\n href={buildHref(coreOrigin, \"/register\")}\n onClick={makeNavigateHandler(onNavigate, \"/register\")}\n leadingIcon={<UserAdd size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-nav-register\"\n >\n {t(\"register\", locale)}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )\n )}\n {isLoggedIn && (\n <NavigationMenuItem value=\"settings\">\n <NavigationMenuTrigger\n leadingIcon={<Settings size=\"s\" aria-hidden=\"true\" />}\n data-slot=\"header-settings-trigger\"\n >\n {t(\"settings\", locale)}\n </NavigationMenuTrigger>\n <NavigationMenuContent>\n <NavigationMenuLink\n href={buildHref(coreOrigin, profilePath)}\n onClick={makeNavigateHandler(onNavigate, profilePath)}\n closeOnClick\n data-slot=\"header-settings-profile\"\n >\n {userDisplayName}\n </NavigationMenuLink>\n {companyLabel !== null && (\n <NavigationMenuLink\n href={buildHref(coreOrigin, companyPath)}\n onClick={makeNavigateHandler(onNavigate, companyPath)}\n closeOnClick\n data-slot=\"header-settings-company\"\n >\n {companyLabel}\n </NavigationMenuLink>\n )}\n </NavigationMenuContent>\n </NavigationMenuItem>\n )}\n {initializing ? (\n <div\n className=\"eg-header__skeleton eg-header__skeleton--auth\"\n aria-hidden=\"true\"\n />\n ) : (\n <NavigationMenuItem value=\"auth\">\n <NavigationMenuAnchor\n href=\"#\"\n aria-disabled={isLoggedIn ? logoutPending : loginPending}\n onClick={(e) => {\n e.preventDefault();\n if (isLoggedIn ? logoutPending : loginPending) return;\n if (isLoggedIn) handleLogout();\n else handleLogin();\n }}\n leadingIcon={<AuthIcon size=\"s\" aria-hidden=\"true\" />}\n data-slot={isLoggedIn ? \"header-nav-logout\" : \"header-nav-login\"}\n >\n {authLabel}\n </NavigationMenuAnchor>\n </NavigationMenuItem>\n )}\n </NavigationMenuList>\n </NavigationMenu>\n </nav>\n\n <div className=\"eg-header__right-menu\">\n {/* Language switcher */}\n <Select<Locale>\n value={locale}\n onValueChange={(v) => v != null && onLocaleChange(v)}\n >\n <SelectTrigger\n aria-label={t(\"selectLanguage\", locale)}\n renderValue={(v) => (typeof v === \"string\" ? v.toUpperCase() : null)}\n />\n <SelectContent container={portalContainer} alignItemWithTrigger={false}>\n {LOCALES.map((l) => (\n <SelectItem\n key={l.value}\n value={l.value}\n data-slot={`language-option-${l.value}`}\n >\n {l.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <Button\n variant=\"tertiary\"\n size=\"icon-s\"\n onClick={() => console.info(\"[easygov-header] search clicked\")}\n aria-label={t(\"search\", locale)}\n data-slot=\"header-search-button\"\n >\n <Search size=\"s\" aria-hidden=\"true\" />\n </Button>\n </div>\n\n {/* Swiss logo */}\n <BrandSwiss height={31} className=\"eg-header__swiss-logo\" />\n </div>\n </GridItem>\n </Grid>\n\n {/* aria-live region for auth state announcements */}\n <div className=\"eg-header__sr-only\" aria-live=\"polite\" aria-atomic=\"true\">\n {announcement}\n </div>\n </header>\n );\n}\n\n// ── EasygovHeaderProps (public) ───────────────────────────────────────────────\n\nexport interface EasygovHeaderProps {\n readonly onLanguageChange?: (locale: Locale) => void;\n readonly onNavigate?: (path: string) => void;\n /**\n * Called whenever a fresh `contextJwt` is obtained from core-backend's\n * `header-context` endpoint (mirrored by the `contextchange` CustomEvent\n * dispatched on the header element), together with its decoded `claims`.\n *\n * Both are always present when this fires: a payload that fails to decode never produces a\n * `contextJwt`, so a decode failure suppresses the call rather than delivering null claims.\n *\n * This is the push surface — the only one a `<eg-easygov-header>` consumer has, since function\n * props cannot cross the custom-element boundary. React consumers can read the same pair\n * reactively with `useEasygovHeaderContext()`, which re-renders them when the context changes;\n * there `claims` IS nullable, because the store is empty before the first context resolves and\n * again after sign-out.\n *\n * IMPORTANT — trust boundary: this JWT's signature is NOT verified by\n * EasygovHeader. The authenticated HTTPS fetch to core-backend is the\n * trust boundary, not the token itself. Any consumer receiving this JWT\n * (via `onContextChange` or the `contextchange` event) MUST verify it\n * against core-backend's published JWKS before trusting any claim\n * decoded from it.\n */\n readonly onContextChange?: (contextJwt: string, claims: HeaderContextClaims) => void;\n readonly onLogout?: () => void;\n}\n\n// ── EasygovHeader (smart wrapper) ─────────────────────────────────────────────\n\nexport function EasygovHeader({\n onLanguageChange,\n onNavigate,\n onContextChange,\n onLogout,\n}: EasygovHeaderProps): React.JSX.Element {\n // OIDC init — once per mount\n const initRef = useRef(false);\n useEffect(() => {\n if (initRef.current) return;\n initRef.current = true;\n void initSession();\n }, []);\n\n // Backend version fetch — module-level guard in ensureBackendVersionFetch makes this safe\n // to call from every mount, including a second EasygovHeader instance on the same page.\n useEffect(() => {\n ensureBackendVersionFetch();\n }, []);\n const versionInfo = useEasygovVersionInfo();\n\n const initialized = useSyncExternalStore(\n subscribeSession,\n getSessionInitialized,\n () => true,\n );\n const session = useEasygovSession();\n // Single source of truth for \"which context is selected\": the URL. Derived from the store\n // snapshot rather than held in state, so it cannot go stale — every URL change, from any\n // source (back/forward, router.push, router.replace), re-renders with the new value and\n // keeps selectedAccountId (and therefore dashboardPath/favoritesPath/companyPath) in sync.\n const urlContext = useUrlContext();\n const selectedAccountId = urlContext?.type === \"customer\" ? urlContext.id : null;\n\n const { claims, contextJwt, accessibleAccountCount, contextError, dismissContextError } =\n useHeaderContext(session, urlContext);\n\n // sessionchange CustomEvent\n const headerElRef = useRef<HTMLElement | null>(null);\n const prevUserSubRef = useRef<string | null>(null);\n const [announcement, setAnnouncement] = useState(\"\");\n\n // Locale — computed before the sessionchange effect so it can reference it\n const effectiveLocale = useEasygovDisplayLanguage();\n\n const contextErrorContent = useMemo(\n () => (contextError !== null ? mapHeaderContextError(contextError.problem, effectiveLocale) : null),\n [contextError, effectiveLocale],\n );\n\n // So the sessionchange effect can read the current locale without listing\n // effectiveLocale as a dependency (which would re-run it on locale change).\n const effectiveLocaleRef = useLatestRef(effectiveLocale);\n const onLogoutRef = useLatestRef(onLogout);\n\n useEffect(() => {\n const currentSub = session.user?.sub ?? null;\n const previousSub = prevUserSubRef.current;\n prevUserSubRef.current = currentSub;\n\n if (currentSub !== previousSub) {\n headerElRef.current?.dispatchEvent(\n new CustomEvent(\"sessionchange\", {\n bubbles: true,\n composed: true,\n detail: { user: session.user },\n }),\n );\n if (currentSub !== null && previousSub === null) {\n const msg = t(\"loginSuccess\", effectiveLocaleRef.current);\n setAnnouncement(msg);\n setTimeout(() => setAnnouncement(\"\"), 3000);\n } else if (currentSub === null && previousSub !== null) {\n const msg = t(\"logoutSuccess\", effectiveLocaleRef.current);\n setAnnouncement(msg);\n setTimeout(() => setAnnouncement(\"\"), 3000);\n onLogoutRef.current?.();\n }\n }\n }, [session.user, effectiveLocaleRef, onLogoutRef]);\n\n const onLanguageChangeRef = useLatestRef(onLanguageChange);\n\n useEffect(() => {\n onLanguageChangeRef.current?.(effectiveLocale);\n headerElRef.current?.dispatchEvent(\n new CustomEvent(\"languagechange\", {\n bubbles: true,\n composed: true,\n detail: { locale: effectiveLocale },\n }),\n );\n // Update document lang\n if (typeof document !== \"undefined\") {\n document.documentElement.lang = effectiveLocale;\n }\n }, [effectiveLocale, onLanguageChangeRef]);\n\n const onContextChangeRef = useLatestRef(onContextChange);\n\n // Unverified JWT below — see the trust-boundary note on EasygovHeaderProps.onContextChange.\n useEffect(() => {\n // Publishes before the early return, so a logout (contextJwt back to null) clears the store\n // rather than leaving subscribers on the previous session's account.\n publishHeaderContext(contextJwt, claims);\n // Narrowing both is what lets the callback and the event promise a non-null `claims`: a jwt\n // only ever reaches state after it decoded (see useHeaderContext), so `claims === null` here\n // is unreachable today — but if the decode ever moves, this suppresses the delivery instead\n // of handing consumers a jwt with nothing decoded from it.\n if (contextJwt === null || claims === null) return;\n onContextChangeRef.current?.(contextJwt, claims);\n headerElRef.current?.dispatchEvent(\n new CustomEvent(\"contextchange\", {\n bubbles: true,\n composed: true,\n detail: { contextJwt, claims },\n }),\n );\n }, [contextJwt, claims, onContextChangeRef]);\n\n const handleLocaleChange = useCallback((newLocale: Locale) => {\n setEasygovDisplayLanguage(newLocale);\n }, []);\n\n // Shadow DOM portal awareness\n const [portalContainer, setPortalContainer] = useState<\n HTMLElement | ShadowRoot | null\n >(null);\n useLayoutEffect(() => {\n const root = headerElRef.current?.getRootNode();\n if (root instanceof ShadowRoot) setPortalContainer(root);\n }, []);\n\n // All three are deferred to a post-hydration snapshot through NEVER_CHANGES (see its definition\n // at the top of this file): window.location is unavailable during SSR, so the server renders no\n // origin and no badge.\n // Reading them synchronously in render via useMemo makes the client's first paint diverge from\n // that server-rendered markup — confirmed via a real browser console error when the badge was a\n // useMemo.\n //\n // For the two origins that divergence was worse than a console error, because it lands on an\n // *attribute*: React adopts the server's attribute during hydration and never repairs the\n // mismatch, and since the hydration render already put the client value into the fiber's props,\n // every later re-render compares equal and never writes it out either. The logo therefore kept\n // the server's href=\"/\" for the life of the page, resolving to whichever app hosts the header —\n // the \"info → info/, core → core/, fachmodul → fachmodul/\" inconsistency of EGOV-1410. Covered\n // by EasygovHeader.hydration.test.tsx, which is the only place this is observable: a plain\n // client-side render never goes through hydration.\n const coreOrigin = useSyncExternalStore(NEVER_CHANGES, resolveCoreOrigin, () => null);\n const infoOrigin = useSyncExternalStore(NEVER_CHANGES, resolveInfoOrigin, () => null);\n const environmentStage = useSyncExternalStore(\n NEVER_CHANGES,\n resolveEnvironmentStage,\n () => null,\n );\n\n const onNavigateRef = useLatestRef(onNavigate);\n\n // Dispatches the public `navigate` CustomEvent and delegates to onNavigate\n // if the consumer provided one. Returns whether onNavigate handled it, so\n // callers can decide whether to also fall back to a real browser navigation.\n const dispatchNavigate = useCallback(\n (path: string): boolean => {\n headerElRef.current?.dispatchEvent(\n new CustomEvent(\"navigate\", {\n bubbles: true,\n composed: true,\n detail: { path },\n }),\n );\n if (onNavigateRef.current) {\n onNavigateRef.current(path);\n return true;\n }\n return false;\n },\n [onNavigateRef],\n );\n\n\n const displayUser =\n session.user === null ? null : { name: session.user.name };\n\n // Feeds the Einstellungen dropdown's \"user profile\" entry below (userDisplayName),\n // falling back to the session's OIDC name when claims haven't resolved yet.\n const claimsName =\n `${claims?.currentUser.firstName ?? \"\"} ${claims?.currentUser.lastName ?? \"\"}`.trim();\n\n // claims.customerAccount is resolved by the backend independently of the URL whenever it can\n // unambiguously pick one account (accessibleAccountCount === 1) — falling back to the\n // URL-derived id only when the backend hasn't (or can't yet) resolve one itself.\n const effectiveAccountId = claims?.customerAccount?.id ?? selectedAccountId;\n // RequireCustomerAccount redirects any (needs-account) route to /select-account whenever its URL\n // has no /customer/{id} (or /process/{id}, or /parentprocess/{id}) segment. Two independent\n // concerns, kept separate: whether the link exists at all (logged in + we know where \"core\" is)\n // vs. whether we can embed a resolved account id in its href yet. A path must never be null\n // merely because the account hasn't resolved — that would hide the link instead of linking to\n // the bare path, which is a perfectly fine destination: RequireCustomerAccount (mounted at\n // core-frontend's (needs-account) layout) gracefully routes an unresolved visit through\n // /select-account.\n const contextPath = effectiveAccountId !== null ? `/customer/${effectiveAccountId}` : null;\n\n // The context is only ever carried for a signed-in visitor. effectiveAccountId can fall back to\n // an id parsed out of the URL, and a URL outlives a session — so without this gate, a logged-out\n // visitor still sitting on /dashboard/customer/{id} would produce context-carrying hrefs. No\n // link renders in that state today (every core link below is behind isLoggedIn), so this changes\n // nothing observable; it stops the wrong value from existing at all, rather than relying on the\n // render sites to never use it.\n const carriedContext = session.user !== null ? contextPath : null;\n\n // Every core link is a plain string: none of them is hidden on account of its path. Visibility is\n // decided at the render sites by isLoggedIn / accessibleAccountCount / companyLabel, and an\n // unresolved account degrades the href to the bare path rather than removing the link —\n // RequireCustomerAccount (core's (needs-account) layout) routes a context-less visit through\n // /select-account, and /services and /profile are optional catch-alls where the bare path is\n // simply valid.\n const withContext = (base: string): string =>\n carriedContext !== null ? `${base}${carriedContext}` : base;\n const dashboardPath = withContext(\"/dashboard\");\n const favoritesPath = withContext(\"/favorites\");\n const companyPath = withContext(\"/company\");\n const servicesPath = withContext(\"/services\");\n // Person-scoped: core renders the profile the same whichever account is selected, which is why\n // it sits outside (needs-account). The context is carried but never read — it exists so that\n // opening the profile does not clear the selected account. The account is derived from the URL,\n // so a context-free /profile blanked it for anyone holding more than one, degrading the\n // Dashboard/Favoriten links and hiding the Firma entry until it was picked again (EGOV-1409).\n const profilePath = withContext(\"/profile\");\n\n // EGOV-1410: the logo is the one link that must lead to the same place from every app — info's\n // start page — so a visitor hopping between info, core and a Fachmodul does not land somewhere\n // different each time. It carries the customer context (never a process one, which info has no\n // start page for) so the hop does not silently drop it, gated like the links into core above.\n //\n // The infoOrigin !== null half of the gate is the one place an unresolved origin still changes\n // the path, and deliberately so: the core links above degrade to a *relative* /dashboard/... ,\n // which is exactly right when core is the host app, whereas the logo's context path is a bare\n // /customer/{id} — a route no app serves. Falling back to \"/\" keeps the harmless local root.\n const infoHomePath = infoOrigin !== null && carriedContext !== null ? carriedContext : \"/\";\n\n const logoTitle =\n versionInfo.backendVersion !== null\n ? `UI-Version: ${versionInfo.libraryVersion}\\nBackend-Version: ${versionInfo.backendVersion}`\n : `UI-Version: ${versionInfo.libraryVersion}`;\n\n return (\n <>\n <Header\n headerRef={headerElRef}\n initializing={!initialized}\n user={displayUser}\n onLogin={() => requireSession()}\n onLogout={() => signOut()}\n dashboardPath={dashboardPath}\n favoritesPath={favoritesPath}\n companyPath={companyPath}\n servicesPath={servicesPath}\n profilePath={profilePath}\n coreOrigin={coreOrigin}\n infoOrigin={infoOrigin}\n infoHomePath={infoHomePath}\n logoTitle={logoTitle}\n environmentStage={environmentStage}\n userDisplayName={claimsName !== \"\" ? claimsName : (displayUser?.name ?? \"\")}\n companyLabel={claims?.customerAccount?.label ?? null}\n accessibleAccountCount={accessibleAccountCount}\n onNavigate={dispatchNavigate}\n locale={effectiveLocale}\n onLocaleChange={handleLocaleChange}\n portalContainer={portalContainer}\n announcement={announcement}\n />\n <ErrorDialog\n open={contextErrorContent !== null}\n onClose={dismissContextError}\n title={contextErrorContent?.title ?? \"\"}\n message={contextErrorContent?.message ?? \"\"}\n reference={contextErrorContent?.reference}\n details={contextErrorContent?.details}\n closeLabel={t(\"errorCloseLabel\", effectiveLocale)}\n detailsLabel={t(\"errorDetailsLabel\", effectiveLocale)}\n />\n </>\n );\n}\n\n// ── RequireSession ────────────────────────────────────────────────────────────\n\nexport interface RequireSessionProps {\n readonly children: React.ReactNode;\n readonly fallback?: React.ReactNode;\n readonly loading?: React.ReactNode;\n}\n\nexport function RequireSession({\n children,\n fallback = null,\n loading = null,\n}: RequireSessionProps): React.JSX.Element {\n // Gate on the lifecycle status, NOT on `user === null`. A null user is ambiguous\n // (logout, token renew, silent-renew blip) and reacting to it with `fallback`\n // caused competing redirects. Only a settled logged-out state renders `fallback`.\n const status = useEasygovAuthStatus();\n switch (status) {\n case \"authenticated\":\n case \"renewing\":\n return <>{children}</>;\n case \"unauthenticated\":\n case \"no-auth\":\n return <>{fallback}</>;\n default: // 'initializing' | 'signing-in' | 'signing-out' — an operation is pending\n return <>{loading}</>;\n }\n}\n\n// ── RequireCustomerAccount ────────────────────────────────────────────────────\n\n// Redirects to Core's /select-account whenever the current URL gives no explicit\n// customer/process/parentprocess context. Framework-agnostic like EasygovHeader itself: reads the\n// URL via window.location, takes an optional onNavigate for same-app client-side routing, and\n// falls back to a full browser navigation otherwise. Deliberately has NO knowledge of which routes\n// need this — the embedding app decides that by choosing where to mount it, the same way\n// RequireSession gates auth.\nexport function useRequireCustomerAccount(onNavigate?: (path: string) => void): void {\n // Dependency only — the store notifies after the router has committed a URL, so this re-runs\n // the check on every context change without any router-specific input from the consuming app.\n const urlContext = useUrlContext();\n\n useEffect(() => {\n if (typeof window === \"undefined\") return; // SSR / no window yet\n // Both reads happen here rather than during render, and that placement is the whole point: a\n // router commits the newly matched route's URL in a useInsertionEffect, which runs *after*\n // that route has rendered. Anything read from window.location while rendering is therefore\n // still the URL of the page being left — which is how returnTo used to send a user who\n // clicked \"Dashboard\" on /profile back to /profile. By the time this passive effect runs, the\n // insertion effect of the same commit has already updated window.location.\n if (readContextFromUrl() !== null) return; // URL already names a customer/process/parentprocess — never redirect\n const returnTo = encodeURIComponent(\n window.location.origin + window.location.pathname + window.location.search,\n );\n const coreOrigin = resolveCoreOrigin();\n const newPath = buildHref(coreOrigin, `/select-account?returnTo=${returnTo}`);\n if (onNavigate) onNavigate(newPath);\n else window.location.href = newPath;\n }, [urlContext, onNavigate]);\n}\n\nexport interface RequireCustomerAccountProps {\n readonly children: React.ReactNode;\n readonly onNavigate?: (path: string) => void;\n}\n\nexport function RequireCustomerAccount({\n children,\n onNavigate,\n}: RequireCustomerAccountProps): React.JSX.Element {\n useRequireCustomerAccount(onNavigate);\n return <>{children}</>;\n}\n","'use client';\n\nimport * as React from 'react';\nimport { useButton } from \"../internals/use-button/useButton.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\n/**\n * A button component that can be used to trigger actions.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Button](https://base-ui.com/react/components/button)\n */\nexport const Button = /*#__PURE__*/React.forwardRef(function Button(componentProps, forwardedRef) {\n const {\n render,\n className,\n disabled = false,\n focusableWhenDisabled = false,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled,\n native: nativeButton\n });\n const state = {\n disabled\n };\n return useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [elementProps, getButtonProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") Button.displayName = \"Button\";","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { error } from '@base-ui/utils/error';\nimport { SafeReact } from '@base-ui/utils/safeReact';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { makeEventPreventable, mergeProps } from \"../../merge-props/index.mjs\";\nimport { useCompositeRootContext } from \"../composite/root/CompositeRootContext.mjs\";\nimport { useFocusableWhenDisabled } from \"../../utils/useFocusableWhenDisabled.mjs\";\nimport { dispatchClickWithModifiers } from \"../../utils/dispatchClickWithModifiers.mjs\";\nexport function useButton(parameters = {}) {\n const {\n disabled = false,\n focusableWhenDisabled,\n tabIndex = 0,\n native: isNativeButton = true,\n composite: compositeProp\n } = parameters;\n const elementRef = React.useRef(null);\n const compositeRootContext = useCompositeRootContext(true);\n const isCompositeItem = compositeProp ?? compositeRootContext !== undefined;\n const {\n props: focusableWhenDisabledProps\n } = useFocusableWhenDisabled({\n focusableWhenDisabled,\n disabled,\n composite: isCompositeItem,\n tabIndex,\n isNativeButton\n });\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (!elementRef.current) {\n return;\n }\n const isButtonTag = isButtonElement(elementRef.current);\n if (isNativeButton) {\n if (!isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a native <button> because the ' + '`nativeButton` prop is true. Rendering a non-<button> removes native button ' + 'semantics, which can impact forms and accessibility. Use a real <button> in the ' + '`render` prop, or set `nativeButton` to `false`.';\n error(`${message}${ownerStackMessage}`);\n }\n } else if (isButtonTag) {\n const ownerStackMessage = SafeReact.captureOwnerStack?.() || '';\n const message = 'A component that acts as a button expected a non-<button> because the `nativeButton` ' + 'prop is false. Rendering a <button> keeps native behavior while Base UI applies ' + 'non-native attributes and handlers, which can add unintended extra attributes (such ' + 'as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set ' + '`nativeButton` to `true`.';\n error(`${message}${ownerStackMessage}`);\n }\n }, [isNativeButton]);\n }\n\n // handles a disabled composite button rendering another button, e.g.\n // <Toolbar.Button disabled render={<Menu.Trigger />} />\n // the `disabled` prop needs to pass through 2 `useButton`s then finally\n // delete the `disabled` attribute from DOM\n const updateDisabled = React.useCallback(() => {\n const element = elementRef.current;\n if (!isButtonElement(element)) {\n return;\n }\n if (isCompositeItem && disabled && focusableWhenDisabledProps.disabled === undefined && element.disabled) {\n element.disabled = false;\n }\n }, [disabled, focusableWhenDisabledProps.disabled, isCompositeItem]);\n useIsoLayoutEffect(updateDisabled, [updateDisabled]);\n const getButtonProps = React.useCallback((externalProps = {}) => {\n const {\n onClick: externalOnClick,\n onMouseDown: externalOnMouseDown,\n onKeyUp: externalOnKeyUp,\n onKeyDown: externalOnKeyDown,\n onPointerDown: externalOnPointerDown,\n ...otherExternalProps\n } = externalProps;\n return mergeProps({\n onClick(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnClick?.(event);\n },\n onMouseDown(event) {\n if (!disabled) {\n externalOnMouseDown?.(event);\n }\n },\n onKeyDown(event) {\n if (disabled) {\n return;\n }\n makeEventPreventable(event);\n externalOnKeyDown?.(event);\n if (event.baseUIHandlerPrevented) {\n return;\n }\n const isCurrentTarget = event.target === event.currentTarget;\n const currentTarget = event.currentTarget;\n const isButton = isButtonElement(currentTarget);\n const isLink = !isNativeButton && isValidLinkElement(currentTarget);\n const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);\n const isEnterKey = event.key === 'Enter';\n const isSpaceKey = event.key === ' ';\n const role = currentTarget.getAttribute('role');\n const isTextNavigationRole = role?.startsWith('menuitem') || role === 'option' || role === 'gridcell';\n if (isCurrentTarget && isCompositeItem && isSpaceKey) {\n if (event.defaultPrevented && isTextNavigationRole) {\n return;\n }\n event.preventDefault();\n\n // Only a native-mode item that isn't a real <button> is excluded.\n if (!isNativeButton || isButton) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n return;\n }\n\n // Keyboard accessibility for native and non-native elements.\n if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {\n // Space activates links on keyup (`role=\"button\"` semantics, matching the\n // composite path); prevent the page scroll Space would otherwise trigger.\n // Enter is left to the browser's native link activation.\n if (isCurrentTarget && isLink && isSpaceKey) {\n event.preventDefault();\n }\n return;\n }\n\n // Match native buttons: preventing the keydown's default cancels activation.\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n if (isEnterKey) {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(currentTarget, event);\n }\n },\n onKeyUp(event) {\n if (disabled) {\n return;\n }\n\n // calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed\n // https://codesandbox.io/p/sandbox/button-keyup-preventdefault-dn7f0\n makeEventPreventable(event);\n externalOnKeyUp?.(event);\n if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === ' ') {\n event.preventDefault();\n return;\n }\n if (event.baseUIHandlerPrevented) {\n return;\n }\n\n // Keyboard accessibility for non interactive elements.\n // Match native buttons: preventing the keyup's default cancels Space activation.\n // Limitation: unlike a native <button>, a prevented *keydown* cannot cancel the\n // activation — no state is kept between keydown and keyup, so we can't tell\n // whether the keydown was prevented or even happened on this element.\n if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === ' ') {\n event.preventBaseUIHandler();\n dispatchClickWithModifiers(event.currentTarget, event);\n }\n },\n onPointerDown(event) {\n if (disabled) {\n event.preventDefault();\n return;\n }\n externalOnPointerDown?.(event);\n }\n }, isNativeButton ? {\n type: 'button'\n } : {\n role: 'button'\n }, focusableWhenDisabledProps, otherExternalProps);\n }, [disabled, focusableWhenDisabledProps, isCompositeItem, isNativeButton]);\n const buttonRef = useStableCallback(element => {\n elementRef.current = element;\n updateDisabled();\n });\n return {\n getButtonProps,\n buttonRef\n };\n}\nfunction isButtonElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'BUTTON';\n}\nfunction isValidLinkElement(elem) {\n return isHTMLElement(elem) && elem.tagName === 'A' && Boolean(elem.href);\n}","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';\n}\nfunction isTableElement(element) {\n return /^(table|td|th)$/.test(getNodeName(element));\n}\nfunction isTopLayer(element) {\n try {\n if (element.matches(':popover-open')) {\n return true;\n }\n } catch (_e) {\n // no-op\n }\n try {\n return element.matches(':modal');\n } catch (_e) {\n return false;\n }\n}\nconst willChangeRe = /transform|translate|scale|rotate|perspective|filter/;\nconst containRe = /paint|layout|strict|content/;\nconst isNotNone = value => !!value && value !== 'none';\nlet isWebKitValue;\nfunction isContainingBlock(elementOrCss) {\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n // https://drafts.csswg.org/css-transforms-2/#individual-transforms\n return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (isWebKitValue == null) {\n isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');\n }\n return isWebKitValue;\n}\nfunction isLastTraversableNode(node) {\n return /^(html|body|#document)$/.test(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return (node.ownerDocument || node).body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n } else {\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n }\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import * as React from 'react';\n\n/**\n * A clone of the React namespace for reading APIs that may be missing in older\n * supported React versions. Bundlers can rewrite direct `React.someNewApi`\n * reads into named imports, which breaks React 17. Reading from this cloned\n * object keeps those lookups optional.\n *\n * @see https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379\n */\nexport const SafeReact = {\n ...React\n};","'use client';\n\nimport * as React from 'react';\nconst UNINITIALIZED = {};\n\n/**\n * A React.useRef() that is initialized with a function. Note that it accepts an optional\n * initialization argument, so the initialization function doesn't need to be an inline closure.\n *\n * @usage\n * const ref = useRefWithInit(sortColumns, columns)\n */\n\nexport function useRefWithInit(init, initArg) {\n const ref = React.useRef(UNINITIALIZED);\n if (ref.current === UNINITIALIZED) {\n ref.current = init(initArg);\n }\n return ref;\n}","'use client';\n\nimport { SafeReact } from \"./safeReact.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst useInsertionEffect = SafeReact.useInsertionEffect;\nconst useSafeInsertionEffect =\n// React 17 doesn't have useInsertionEffect.\nuseInsertionEffect &&\n// Preact replaces useInsertionEffect with useLayoutEffect and fires too late.\nuseInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : fn => fn();\n/**\n * Stabilizes the function passed so it's always the same between renders.\n *\n * The function becomes non-reactive to any values it captures.\n * It can safely be passed as a dependency of `React.useMemo` and `React.useEffect` without re-triggering them if its captured values change.\n *\n * The function must only be called inside effects and event handlers, never during render (which throws an error).\n *\n * This hook is a more permissive version of React 19.2's `React.useEffectEvent` in that it can be passed through contexts and called in event handler props, not just effects.\n */\nexport function useStableCallback(callback) {\n const stable = useRefWithInit(createStableCallback).current;\n stable.next = callback;\n useSafeInsertionEffect(stable.effect);\n return stable.trampoline;\n}\nfunction createStableCallback() {\n const stable = {\n next: undefined,\n callback: assertNotCalled,\n trampoline: (...args) => stable.callback?.(...args),\n effect: () => {\n stable.callback = stable.next;\n }\n };\n return stable;\n}\nfunction assertNotCalled() {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw /* minify-error-disabled */new Error('Base UI: Cannot call an event handler while rendering.');\n }\n}","'use client';\n\nimport * as React from 'react';\nconst noop = () => {};\nexport const useIsoLayoutEffect = typeof document !== 'undefined' ? React.useLayoutEffect : noop;","export function mergeObjects(a, b) {\n if (a && !b) {\n return a;\n }\n if (!a && b) {\n return b;\n }\n if (a || b) {\n return {\n ...a,\n ...b\n };\n }\n return undefined;\n}","import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}","/**\n * Creates a formatErrorMessage function with a custom URL and prefix.\n * @param baseUrl - The base URL for the error page (e.g., 'https://base-ui.com/production-error')\n * @param prefix - The prefix for the error message (e.g., 'Base UI')\n * @returns A function that formats error messages with the given URL and prefix\n */\nexport function createFormatErrorMessage(baseUrl, prefix) {\n return function formatErrorMessage(code, ...args) {\n const url = new URL(baseUrl);\n url.searchParams.set('code', code.toString());\n args.forEach(arg => url.searchParams.append('args[]', arg));\n return `${prefix} error #${code}; visit ${url} for the full message.`;\n };\n}\n\n/**\n * WARNING: Don't import this directly. It's imported by the code generated by\n * `@mui/internal-babel-plugin-minify-errors`. Make sure to always use string literals in `Error`\n * constructors to ensure the plugin works as expected. Supported patterns include:\n * throw new Error('My message');\n * throw new Error(`My message: ${foo}`);\n * throw new Error(`My message: ${foo}` + 'another string');\n * ...\n */\nconst formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');\nexport default formatErrorMessage;","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const CompositeRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CompositeRootContext.displayName = \"CompositeRootContext\";\nexport function useCompositeRootContext(optional = false) {\n const context = React.useContext(CompositeRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : _formatErrorMessage(16));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nexport function useFocusableWhenDisabled(parameters) {\n const {\n focusableWhenDisabled,\n disabled,\n composite = false,\n tabIndex: tabIndexProp = 0,\n isNativeButton\n } = parameters;\n const isFocusableComposite = composite && focusableWhenDisabled !== false;\n const isNonFocusableComposite = composite && focusableWhenDisabled === false;\n\n // we can't explicitly assign `undefined` to any of these props because it\n // would otherwise prevent subsequently merged props from setting them\n const props = React.useMemo(() => {\n const additionalProps = {\n // allow Tabbing away from focusableWhenDisabled elements\n onKeyDown(event) {\n if (disabled && focusableWhenDisabled && event.key !== 'Tab') {\n event.preventDefault();\n }\n }\n };\n if (!composite) {\n additionalProps.tabIndex = tabIndexProp;\n if (!isNativeButton && disabled) {\n additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;\n }\n }\n if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled) {\n additionalProps['aria-disabled'] = disabled;\n }\n if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) {\n additionalProps.disabled = disabled;\n }\n return additionalProps;\n }, [composite, disabled, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]);\n return {\n props\n };\n}","export { getWindow as ownerWindow } from '@floating-ui/utils/dom';\nexport function ownerDocument(node) {\n return node?.ownerDocument || document;\n}","import { ownerWindow } from '@base-ui/utils/owner';\n/**\n * Dispatches a constructed click on the target so it carries the source event's\n * modifier state, which `click()` always reports as unpressed. Like `click()`,\n * the untrusted click still runs native activation behavior (form submission,\n * link navigation).\n * `detail` defaults to 0 (the native convention for keyboard-generated clicks);\n * pass `detail: 1` when the click represents a mouse gesture so consumers keying\n * off `detail === 0` don't classify it as a keyboard activation.\n */\nexport function dispatchClickWithModifiers(target, sourceEvent, {\n detail = 0\n} = {}) {\n target.dispatchEvent(new (ownerWindow(target).PointerEvent)('click', {\n bubbles: true,\n cancelable: true,\n composed: true,\n detail,\n shiftKey: sourceEvent.shiftKey,\n ctrlKey: sourceEvent.ctrlKey,\n altKey: sourceEvent.altKey,\n metaKey: sourceEvent.metaKey\n }));\n}","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { useMergedRefs, useMergedRefsN } from '@base-ui/utils/useMergedRefs';\nimport { getReactElementRef } from '@base-ui/utils/getReactElementRef';\nimport { mergeObjects } from '@base-ui/utils/mergeObjects';\nimport { warn } from '@base-ui/utils/warn';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getStateAttributesProps } from \"./getStateAttributesProps.mjs\";\nimport { resolveClassName } from \"../utils/resolveClassName.mjs\";\nimport { resolveStyle } from \"../utils/resolveStyle.mjs\";\nimport { mergeProps, mergePropsN, mergeClassNames } from \"../merge-props/index.mjs\";\nimport { createElement as _createElement } from \"react\";\n/**\n * Renders a Base UI element.\n *\n * @param element The default HTML element to render. Can be overridden by the `render` prop.\n * @param componentProps An object containing the `render` and `className` props to be used for element customization. Other props are ignored.\n * @param params Additional parameters for rendering the element.\n */\nexport function useRenderElement(element, componentProps, params = {}) {\n let renderProp = componentProps.render;\n if (params.enabled !== false) {\n // A pending lazy element suspends when unwrapped, so leave it wrapped while disabled.\n renderProp = unwrapLazyRenderProp(renderProp);\n }\n const outProps = useRenderElementProps(componentProps, params, renderProp);\n if (params.enabled === false) {\n return null;\n }\n const state = params.state ?? EMPTY_OBJECT;\n return evaluateRenderProp(element, renderProp, outProps, state);\n}\n\n/**\n * Computes render element final props.\n */\nfunction useRenderElementProps(componentProps, params, renderProp) {\n const {\n className: classNameProp,\n style: styleProp\n } = componentProps;\n const {\n state = EMPTY_OBJECT,\n ref,\n props,\n stateAttributesMapping,\n enabled = true\n } = params;\n const className = enabled ? resolveClassName(classNameProp, state) : undefined;\n const style = enabled ? resolveStyle(styleProp, state) : undefined;\n const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;\n const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : undefined;\n\n // Ensure outProps is always a new mutable object when enabled, never EMPTY_OBJECT.\n // This prevents potential TypeError when setting ref, className, or style properties,\n // since EMPTY_OBJECT is frozen and mutations would fail in strict mode.\n const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT;\n\n // SAFETY: The `useMergedRefs` functions use a single hook to store the same value,\n // switching between them at runtime is safe. If this assertion fails, React will\n // throw at runtime anyway.\n // This also skips the `useMergedRefs` call on the server, which is fine because\n // refs are not used on the server side.\n /* eslint-disable react-hooks/rules-of-hooks */\n if (typeof document !== 'undefined') {\n if (!enabled) {\n // Called only to keep the hook order stable when disabled; the merged ref is unused.\n void useMergedRefs(null, null);\n } else if (Array.isArray(ref)) {\n outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]);\n } else {\n outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);\n }\n }\n if (!enabled) {\n return EMPTY_OBJECT;\n }\n if (className !== undefined) {\n outProps.className = mergeClassNames(outProps.className, className);\n }\n if (style !== undefined) {\n outProps.style = mergeObjects(outProps.style, style);\n }\n return outProps;\n}\nfunction resolveRenderFunctionProps(props) {\n if (Array.isArray(props)) {\n return mergePropsN(props);\n }\n return mergeProps(undefined, props);\n}\n\n// The symbol React uses internally for lazy components\n// https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/shared/ReactSymbols.js#L31\n//\n// TODO delete once https://github.com/react/react/issues/32392 is fixed\nconst REACT_LAZY_TYPE = Symbol.for('react.lazy');\nconst COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;\nconst LOWERCASE_CHARACTER_PATTERN = /[a-z]/;\n\n// Workaround for https://github.com/react/react/issues/32392\n// The Flight client hands over a lazy wrapper in place of a render element created in a\n// Server Component. The wrapper exposes no `.props` or `.ref`, so it must be unwrapped\n// before those are read. This works because the toArray() logic unwraps the lazy\n// element type in\n// https://github.com/react/react/blob/a0566250b210499b4c5677f5ac2eedbd71d51a1b/packages/react/src/ReactChildren.js#L186\nfunction unwrapLazyRenderProp(render) {\n // `$$typeof` is a React internal, absent from the public element types.\n if (render?.$$typeof !== REACT_LAZY_TYPE) {\n return render;\n }\n // Keep the wrapper unless it unwraps to an element, so an invalid render prop is still\n // reported as one instead of silently falling back to the default element.\n const unwrapped = React.Children.toArray(render)[0];\n return /*#__PURE__*/React.isValidElement(unwrapped) ? unwrapped : render;\n}\nfunction evaluateRenderProp(element, render, props, state) {\n if (render) {\n if (typeof render === 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warnIfRenderPropLooksLikeComponent(render);\n }\n return render(props, state);\n }\n const mergedProps = mergeProps(props, render.props);\n mergedProps.ref = props.ref;\n\n // There is a high number of indirections, the error message thrown by React.cloneElement() is\n // hard to use for developers, this logic provides a better context.\n //\n // Our general guideline is to never change the control flow depending on the environment.\n // However, React.cloneElement() throws if React.isValidElement() is false,\n // so we can throw before with custom message.\n if (process.env.NODE_ENV !== 'production') {\n if (! /*#__PURE__*/React.isValidElement(render)) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(['Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.', 'A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.', 'https://base-ui.com/r/invalid-render-prop'].join('\\n'));\n }\n }\n return /*#__PURE__*/React.cloneElement(render, mergedProps);\n }\n if (element) {\n if (typeof element === 'string') {\n return renderTag(element, props);\n }\n }\n // Unreachable, but the typings on `useRenderElement` need to be reworked\n // to annotate it correctly.\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: Render element or function are not defined.' : _formatErrorMessage(8));\n}\nfunction warnIfRenderPropLooksLikeComponent(renderFn) {\n const functionName = renderFn.name;\n if (functionName.length === 0) {\n return;\n }\n if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) {\n return;\n }\n if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) {\n return;\n }\n warn(`The \\`render\\` prop received a function named \\`${functionName}\\` that starts with an uppercase letter.`, 'This usually means a React component was passed directly as `render={Component}`.', 'Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.', 'If this is an intentional render callback, rename it to start with a lowercase letter.', 'Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.', 'https://base-ui.com/r/invalid-render-prop');\n}\nfunction renderTag(Tag, props) {\n if (Tag === 'button') {\n return /*#__PURE__*/_createElement(\"button\", {\n type: \"button\",\n ...props,\n key: props.key\n });\n }\n if (Tag === 'img') {\n return /*#__PURE__*/_createElement(\"img\", {\n alt: \"\",\n ...props,\n key: props.key\n });\n }\n return /*#__PURE__*/React.createElement(Tag, props);\n}","import { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Merges refs into a single memoized callback ref or `null`.\n * This makes sure multiple refs are updated together and have the same value.\n *\n * This function accepts up to four refs. If you need to merge more, or have an unspecified number of refs to merge,\n * use `useMergedRefsN` instead.\n */\n\nexport function useMergedRefs(a, b, c, d) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChange(forkRef, a, b, c, d)) {\n update(forkRef, [a, b, c, d]);\n }\n return forkRef.callback;\n}\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n *\n * If you need to merge a fixed number (up to four) of refs, use `useMergedRefs` instead for better performance.\n */\nexport function useMergedRefsN(refs) {\n const forkRef = useRefWithInit(createForkRef).current;\n if (didChangeN(forkRef, refs)) {\n update(forkRef, refs);\n }\n return forkRef.callback;\n}\nfunction createForkRef() {\n return {\n callback: null,\n cleanup: null,\n refs: []\n };\n}\nfunction didChange(forkRef, a, b, c, d) {\n // prettier-ignore\n return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;\n}\nfunction didChangeN(forkRef, newRefs) {\n return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);\n}\nfunction update(forkRef, refs) {\n forkRef.refs = refs;\n if (refs.every(ref => ref == null)) {\n forkRef.callback = null;\n return;\n }\n forkRef.callback = instance => {\n if (forkRef.cleanup) {\n forkRef.cleanup();\n forkRef.cleanup = null;\n }\n if (instance != null) {\n const cleanupCallbacks = Array(refs.length).fill(null);\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const refCleanup = ref(instance);\n if (typeof refCleanup === 'function') {\n cleanupCallbacks[i] = refCleanup;\n }\n break;\n }\n case 'object':\n {\n ref.current = instance;\n break;\n }\n default:\n }\n }\n forkRef.cleanup = () => {\n for (let i = 0; i < refs.length; i += 1) {\n const ref = refs[i];\n if (ref == null) {\n continue;\n }\n switch (typeof ref) {\n case 'function':\n {\n const cleanupCallback = cleanupCallbacks[i];\n if (typeof cleanupCallback === 'function') {\n cleanupCallback();\n } else {\n // Legacy ref with no attach-time cleanup: detach by calling it with `null`.\n // It returns nothing; React 19 cleanups are handled in the branch above.\n void ref(null);\n }\n break;\n }\n case 'object':\n {\n ref.current = null;\n break;\n }\n default:\n }\n }\n };\n }\n };\n}","import * as React from 'react';\nimport { isReactVersionAtLeast } from \"./reactVersion.mjs\";\n\n/**\n * Extracts the `ref` from a React element, handling different React versions.\n */\nexport function getReactElementRef(element) {\n if (! /*#__PURE__*/React.isValidElement(element)) {\n return null;\n }\n const reactElement = element;\n const propsWithRef = reactElement.props;\n return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;\n}","import * as React from 'react';\nconst majorVersion = parseInt(React.version, 10);\nexport function isReactVersionAtLeast(reactVersionToCheck) {\n return majorVersion >= reactVersionToCheck;\n}","export function NOOP() {}\n\n// Typed as mutable `never[]` so it is assignable to any `T[]` fallback (for example\n// `defaultValue ?? EMPTY_ARRAY` in `useControlled` callers) without widening `T`.\n// Frozen so a write through a widened alias throws instead of mutating the shared singleton.\nexport const EMPTY_ARRAY = Object.freeze([]);\nexport const EMPTY_OBJECT = Object.freeze({});","export function getStateAttributesProps(state, customMapping) {\n const props = {};\n\n /* eslint-disable-next-line guard-for-in */\n for (const key in state) {\n const value = state[key];\n if (customMapping?.hasOwnProperty(key)) {\n const customProps = customMapping[key](value);\n if (customProps != null) {\n Object.assign(props, customProps);\n }\n continue;\n }\n if (value === true) {\n props[`data-${key.toLowerCase()}`] = '';\n } else if (value) {\n props[`data-${key.toLowerCase()}`] = value.toString();\n }\n }\n return props;\n}","/**\n * If the provided className is a string, it will be returned as is.\n * Otherwise, the function will call the className function with the state as the first argument.\n *\n * @param className\n * @param state\n */\nexport function resolveClassName(className, state) {\n return typeof className === 'function' ? className(state) : className;\n}","/**\n * If the provided style is an object, it will be returned as is.\n * Otherwise, the function will call the style function with the state as the first argument.\n *\n * @param style\n * @param state\n */\nexport function resolveStyle(style, state) {\n return typeof style === 'function' ? style(state) : style;\n}","import { Button as ButtonPrimitive } from \"@base-ui/react/button\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport \"./Button.css\";\n\n// Variant set taken from the Figma _C_Button (Type=Primary|Secondary|Critical|Tertiary);\n// sizes from the Figma _M_Button master (Size=S|M|L). Icon sizes are square at the same\n// pixel heights. States (Hover/Focussed/Disabled) are CSS pseudo-classes, not variants.\nconst buttonVariants = cva(\"eg-button\", {\n variants: {\n variant: {\n primary: \"eg-button--primary\",\n secondary: \"eg-button--secondary\",\n critical: \"eg-button--critical\",\n tertiary: \"eg-button--tertiary\",\n },\n size: {\n s: \"eg-button--size-s\",\n m: \"eg-button--size-m\",\n l: \"eg-button--size-l\",\n \"icon-s\": \"eg-button--size-icon-s\",\n \"icon-m\": \"eg-button--size-icon-m\",\n \"icon-l\": \"eg-button--size-icon-l\",\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"l\",\n },\n});\n\ntype IconSize = \"icon-s\" | \"icon-m\" | \"icon-l\";\ntype StandardSize = \"s\" | \"m\" | \"l\";\ntype ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>;\n\ntype ButtonBase = Omit<ButtonPrimitive.Props, \"className\"> & {\n className?: string;\n variant?: ButtonVariant;\n};\n\n// Icon sizes require an accessible label since there is no visible text.\nexport type ButtonProps =\n | (ButtonBase & { size: IconSize; \"aria-label\": string })\n | (ButtonBase & { size?: StandardSize; \"aria-label\"?: string });\n\nexport function Button({ className, variant, size, ...props }: ButtonProps) {\n return (\n <ButtonPrimitive\n data-slot=\"button\"\n className={buttonVariants({ variant, size, className })}\n {...props}\n />\n );\n}\n\nexport { buttonVariants };\n","export { SelectRoot as Root } from \"./root/SelectRoot.mjs\";\nexport { SelectLabel as Label } from \"./label/SelectLabel.mjs\";\nexport { SelectTrigger as Trigger } from \"./trigger/SelectTrigger.mjs\";\nexport { SelectValue as Value } from \"./value/SelectValue.mjs\";\nexport { SelectIcon as Icon } from \"./icon/SelectIcon.mjs\";\nexport { SelectPortal as Portal } from \"./portal/SelectPortal.mjs\";\nexport { SelectBackdrop as Backdrop } from \"./backdrop/SelectBackdrop.mjs\";\nexport { SelectPositioner as Positioner } from \"./positioner/SelectPositioner.mjs\";\nexport { SelectPopup as Popup } from \"./popup/SelectPopup.mjs\";\nexport { SelectList as List } from \"./list/SelectList.mjs\";\nexport { SelectItem as Item } from \"./item/SelectItem.mjs\";\nexport { SelectItemIndicator as ItemIndicator } from \"./item-indicator/SelectItemIndicator.mjs\";\nexport { SelectItemText as ItemText } from \"./item-text/SelectItemText.mjs\";\nexport { SelectArrow as Arrow } from \"./arrow/SelectArrow.mjs\";\nexport { SelectScrollDownArrow as ScrollDownArrow } from \"./scroll-down-arrow/SelectScrollDownArrow.mjs\";\nexport { SelectScrollUpArrow as ScrollUpArrow } from \"./scroll-up-arrow/SelectScrollUpArrow.mjs\";\nexport { SelectGroup as Group } from \"./group/SelectGroup.mjs\";\nexport { SelectGroupLabel as GroupLabel } from \"./group-label/SelectGroupLabel.mjs\";\nexport { SelectSeparator as Separator } from \"./separator/SelectSeparator.mjs\";","'use client';\n\nimport * as React from 'react';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';\nimport { usePreviousValue } from '@base-ui/utils/usePreviousValue';\nimport { isElementDisabled } from '@base-ui/utils/isElementDisabled';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useClick, useDismiss, useFloatingRootContext, useListNavigation, useTypeahead } from \"../../floating-ui-react/index.mjs\";\nimport { SelectFloatingContext, SelectRootContext, SelectRootPropsContext } from \"./SelectRootContext.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { stringifyAsLabel, stringifyAsValue } from \"../../internals/resolveValueLabel.mjs\";\nimport { defaultItemEquality, findSelectionIndex, isSelectedValueDirty } from \"../../internals/itemEquality.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { useOpenInteractionType } from \"../../utils/useOpenInteractionType.mjs\";\nimport { getMaxScrollOffset, normalizeScrollOffset } from \"../../utils/scrollEdges.mjs\";\nimport { FOCUSABLE_POPUP_PROPS } from \"../../utils/popups/index.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { NOOP } from \"../../internals/noop.mjs\";\n\n/**\n * Groups all parts of the select.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function SelectRoot(props) {\n const {\n id,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n name: nameProp,\n form,\n autoComplete,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n modal = true,\n actionsRef,\n inputRef,\n onOpenChangeComplete,\n items,\n multiple = false,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue = defaultItemEquality,\n highlightItemOnHover = true,\n children\n } = props;\n const {\n clearErrors\n } = useFormContext();\n const {\n setDirty,\n setTouched,\n setFocused,\n validityData,\n setFilled,\n name: fieldName,\n disabled: fieldDisabled,\n validation,\n validationMode\n } = useFieldRootContext();\n const generatedId = useLabelableId({\n id\n });\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const [value, setValueUnwrapped] = useControlled({\n controlled: valueProp,\n default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,\n name: 'Select',\n state: 'value'\n });\n const [open, setOpenUnwrapped] = useControlled({\n controlled: openProp,\n default: defaultOpen,\n name: 'Select',\n state: 'open'\n });\n const listRef = React.useRef([]);\n const labelsRef = React.useRef([]);\n const popupRef = React.useRef(null);\n const scrollHandlerRef = React.useRef(null);\n const scrollArrowsMountedCountRef = React.useRef(0);\n const valueRef = React.useRef(null);\n const valuesRef = React.useRef([]);\n const typingRef = React.useRef(false);\n const firstItemTextRef = React.useRef(null);\n const selectedItemTextRef = React.useRef(null);\n const selectionRef = React.useRef({\n allowSelectedMouseUp: false,\n allowUnselectedMouseUp: false,\n dragY: 0\n });\n const alignItemWithTriggerActiveRef = React.useRef(false);\n const initialValueRef = React.useRef(value);\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const {\n openMethod,\n triggerProps: interactionTypeProps\n } = useOpenInteractionType(open);\n const store = useRefWithInit(() => new ReactStore({\n id: generatedId,\n labelId: undefined,\n modal,\n multiple,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue,\n value,\n open,\n mounted,\n transitionStatus,\n items,\n forceMount: false,\n openMethod: null,\n activeIndex: null,\n selectedIndex: null,\n popupProps: EMPTY_OBJECT,\n triggerProps: EMPTY_OBJECT,\n triggerElement: null,\n positionerElement: null,\n listElement: null,\n popupSide: null,\n scrollUpArrowVisible: false,\n scrollDownArrowVisible: false,\n hasScrollArrows: false\n }, {\n setValue: NOOP,\n setOpen: NOOP,\n handleScrollArrowVisibility: NOOP,\n onOpenChangeComplete: NOOP,\n listRef,\n popupRef,\n scrollHandlerRef,\n scrollArrowsMountedCountRef,\n valueRef,\n valuesRef,\n labelsRef,\n typingRef,\n selectionRef,\n firstItemTextRef,\n selectedItemTextRef,\n alignItemWithTriggerActiveRef,\n initialValueRef\n }, selectors)).current;\n const activeIndex = store.useState('activeIndex');\n const selectedIndex = store.useState('selectedIndex');\n const triggerElement = store.useState('triggerElement');\n const positionerElement = store.useState('positionerElement');\n const previousOpenMethod = usePreviousValue(openMethod);\n const renderedOpenMethod = openMethod ?? previousOpenMethod;\n const serializedValue = React.useMemo(() => {\n // In multiple mode the shared input is nameless; per-value entries are submitted via\n // `hiddenInputs`. Its value is therefore irrelevant, and passing the whole array to\n // `stringifyAsValue` would invoke a user `itemToStringValue` with an array it doesn't expect.\n if (multiple) {\n return '';\n }\n return stringifyAsValue(value, itemToStringValue);\n }, [multiple, value, itemToStringValue]);\n const fieldStringValue = React.useMemo(() => {\n if (multiple && Array.isArray(value)) {\n return value.map(currentValue => stringifyAsValue(currentValue, itemToStringValue));\n }\n return stringifyAsValue(value, itemToStringValue);\n }, [multiple, value, itemToStringValue]);\n const controlRef = useValueAsRef(triggerElement);\n const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);\n useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm, !disabled, nameProp);\n\n // Mirror the `hasSelectedValue` store selector so the Field's filled state agrees with the\n // trigger/value placeholder semantics (a value serializing to `''` counts as empty).\n const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null && serializedValue !== '';\n useIsoLayoutEffect(() => {\n setFilled(hasSelectedValue);\n }, [hasSelectedValue, setFilled]);\n useIsoLayoutEffect(function syncSelectedIndex() {\n const nextIndex = findSelectionIndex(valuesRef.current, value, isItemEqualToValue, multiple);\n if (nextIndex === null) {\n selectedItemTextRef.current = null;\n }\n if (open) {\n return;\n }\n store.set('selectedIndex', nextIndex);\n }, [multiple, open, value, isItemEqualToValue, store]);\n useValueChanged(value, () => {\n clearErrors(name);\n setDirty(isSelectedValueDirty(value, validityData.initialValue, isItemEqualToValue));\n validation.change(value);\n });\n const setOpen = useStableCallback((nextOpen, eventDetails) => {\n onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpenUnwrapped(nextOpen);\n if (!nextOpen && (eventDetails.reason === REASONS.focusOut || eventDetails.reason === REASONS.outsidePress)) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(value);\n }\n }\n });\n const handleUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeIndex: null,\n openMethod: null,\n scrollUpArrowVisible: false,\n scrollDownArrowVisible: false\n });\n onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: !actionsRef,\n open,\n ref: popupRef,\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n React.useImperativeHandle(actionsRef, () => ({\n unmount: handleUnmount\n }), [handleUnmount]);\n const setValue = useStableCallback((nextValue, eventDetails) => {\n onValueChange?.(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValueUnwrapped(nextValue);\n });\n const handleScrollArrowVisibility = useStableCallback(scroller => {\n const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);\n const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);\n const shouldShowUp = scrollTop > 0;\n const shouldShowDown = scrollTop < maxScrollTop;\n store.set('scrollUpArrowVisible', shouldShowUp);\n store.set('scrollDownArrowVisible', shouldShowDown);\n });\n const floatingContext = useFloatingRootContext({\n open,\n onOpenChange: setOpen,\n elements: {\n reference: triggerElement,\n floating: positionerElement\n }\n });\n\n // `readOnly` locks the value, not the interaction: the popup can be opened and browsed so the\n // user can see the available options and which one is selected. Committing a value is blocked\n // separately in `SelectItem` and in the hidden input's autofill handler.\n const click = useClick(floatingContext, {\n enabled: !disabled,\n event: 'mousedown'\n });\n const dismiss = useDismiss(floatingContext);\n const listNavigation = useListNavigation(floatingContext, {\n enabled: !disabled,\n listRef,\n activeIndex,\n selectedIndex,\n disabledIndices: EMPTY_ARRAY,\n onNavigate(nextActiveIndex) {\n // Retain the highlight while transitioning out.\n if (nextActiveIndex === null && !open) {\n return;\n }\n store.set('activeIndex', nextActiveIndex);\n },\n focusItemOnHover: highlightItemOnHover\n });\n const typeahead = useTypeahead(floatingContext, {\n // Typeahead on an open popup only moves the highlight, so it remains available while\n // `readOnly`. The closed-trigger variant commits a value instead, so it doesn't.\n enabled: !disabled && (open || !readOnly && !multiple),\n listRef: labelsRef,\n activeIndex,\n selectedIndex,\n // Skip disabled items while matching so typeahead advances to the next selectable item\n // (a click can never select a disabled item and native `<select>` skips them too). Resolve\n // the disabled state from the element via the attribute-only `isElementDisabled` so the\n // hidden, force-mounted items used for closed-trigger typeahead aren't dropped by the\n // `elementsRef`/visibility filter that `disabledIndices` deliberately sidesteps.\n disabledIndices: index => isElementDisabled(listRef.current[index]),\n onMatch(index) {\n if (open) {\n store.set('activeIndex', index);\n } else {\n setValue(valuesRef.current[index], createChangeEventDetails(REASONS.none));\n }\n },\n onTyping(typing) {\n typingRef.current = typing;\n }\n });\n\n // `Select.Trigger` applies the id itself from the store, so it's deliberately not merged here.\n const mergedTriggerProps = React.useMemo(() => mergeProps(typeahead.reference, listNavigation.reference, dismiss.reference, click.reference, interactionTypeProps), [click.reference, typeahead.reference, listNavigation.reference, dismiss.reference, interactionTypeProps]);\n const popupProps = React.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, typeahead.floating, listNavigation.floating, dismiss.floating), [typeahead.floating, listNavigation.floating, dismiss.floating]);\n const itemProps = listNavigation.item ?? EMPTY_OBJECT;\n store.useContextCallback('setValue', setValue);\n store.useContextCallback('setOpen', setOpen);\n store.useContextCallback('handleScrollArrowVisibility', handleScrollArrowVisibility);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);\n\n // The prop bags must be in the store before the parts render. `useSyncedValues` writes in a\n // layout effect, after all descendants have rendered.\n useOnFirstRender(() => {\n store.update({\n popupProps,\n triggerProps: mergedTriggerProps\n });\n });\n store.useSyncedValues({\n id: generatedId,\n modal,\n multiple,\n value,\n open,\n mounted,\n transitionStatus,\n popupProps,\n triggerProps: mergedTriggerProps,\n items,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue,\n openMethod: renderedOpenMethod\n });\n const rootPropsContextValue = React.useMemo(() => ({\n disabled,\n readOnly,\n required,\n multiple,\n highlightItemOnHover,\n itemProps\n }), [disabled, readOnly, required, multiple, highlightItemOnHover, itemProps]);\n const ref = useMergedRefs(inputRef, validation.inputRef);\n const hiddenInputName = multiple ? undefined : name;\n const hiddenInputs = React.useMemo(() => {\n if (!multiple || !Array.isArray(value) || !name) {\n return null;\n }\n return value.map(v => {\n const currentSerializedValue = stringifyAsValue(v, itemToStringValue);\n return /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: currentSerializedValue,\n disabled: disabled\n }, currentSerializedValue);\n });\n }, [multiple, value, form, name, itemToStringValue, disabled]);\n return /*#__PURE__*/_jsxs(SelectRootContext.Provider, {\n value: store,\n children: [/*#__PURE__*/_jsx(SelectRootPropsContext.Provider, {\n value: rootPropsContextValue,\n children: /*#__PURE__*/_jsx(SelectFloatingContext.Provider, {\n value: floatingContext,\n children: children\n })\n }), /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n onFocus() {\n // Move focus to the trigger element when the hidden input is focused.\n store.state.triggerElement?.focus({\n // Supported in Chrome from 144 (January 2026)\n focusVisible: true\n });\n },\n // Handle browser autofill.\n onChange(event) {\n // Workaround for https://github.com/react/react/issues/9023\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const nextValue = event.currentTarget.value;\n const details = createChangeEventDetails(REASONS.none, event.nativeEvent);\n function handleChange() {\n if (multiple) {\n // Browser autofill only writes a single scalar value.\n return;\n }\n\n // Preserve the original serialized matching, then fall back to rendered text,\n // which browsers can autofill for primitive values like\n // `value=\"US\">United States`.\n const nextValueLower = nextValue.toLowerCase();\n let matchingIndex = valuesRef.current.findIndex(candidate => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyAsLabel(candidate, itemToStringLabel).toLowerCase() === nextValueLower);\n if (matchingIndex === -1) {\n matchingIndex = valuesRef.current.findIndex((_, index) => {\n const renderedLabel = labelsRef.current[index];\n return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;\n });\n }\n const matchingValue = valuesRef.current[matchingIndex];\n if (matchingValue != null) {\n // `setValue` may be canceled by `onValueChange`; rely on `useValueChanged` to\n // mark the field dirty and run validation only when the value actually changes.\n setValue(matchingValue, details);\n }\n }\n store.set('forceMount', true);\n queueMicrotask(handleChange);\n }\n }),\n id: generatedId && hiddenInputName == null ? `${generatedId}-hidden-input` : undefined,\n form: form,\n name: hiddenInputName,\n autoComplete: autoComplete,\n value: serializedValue,\n disabled: disabled,\n required: required && !(multiple && hasSelectedValue),\n readOnly: readOnly,\n ref: ref,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n \"aria-hidden\": true,\n suppressHydrationWarning: true\n }), hiddenInputs]\n });\n}","const visuallyHiddenBase = {\n clipPath: 'inset(50%)',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n border: 0,\n padding: 0,\n width: 1,\n height: 1,\n margin: -1\n};\nexport const visuallyHidden = {\n ...visuallyHiddenBase,\n position: 'fixed',\n top: 0,\n left: 0\n};\nexport const visuallyHiddenInput = {\n ...visuallyHiddenBase,\n position: 'absolute'\n};","'use client';\n\nimport * as React from 'react';\nexport function useOnFirstRender(fn) {\n const ref = React.useRef(true);\n if (ref.current) {\n ref.current = false;\n fn();\n }\n}","'use client';\n\nimport * as React from 'react';\n\n/**\n * Returns a previous value of its argument.\n * @param value Current value.\n * @returns Previous value, or null if there is no previous value.\n */\nexport function usePreviousValue(value) {\n const [state, setState] = React.useState({\n current: value,\n previous: null\n });\n if (!Object.is(value, state.current)) {\n setState({\n current: value,\n previous: state.current\n });\n }\n return state.previous;\n}","export function isElementDisabled(element) {\n return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true';\n}","'use client';\n\n// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- process.env never changes, dependency arrays are intentionally ignored\n/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\nimport * as React from 'react';\nimport { error } from \"./error.mjs\";\n\n// A defined default guarantees a defined value. Otherwise, preserve `undefined`,\n// including when callers pass an explicit generic argument.\n\nexport function useControlled({\n controlled,\n default: defaultProp,\n name,\n state = 'value'\n}) {\n // isControlled is ignored in the hook dependency lists as it should never change.\n const {\n current: isControlled\n } = React.useRef(controlled !== undefined);\n const [valueState, setValue] = React.useState(defaultProp);\n // Keep the initial mode, but use the initial default if a controlled value disappears.\n // This preserves the defined-default overload while the mode-switch warning is emitted below.\n const value = isControlled && controlled !== undefined ? controlled : valueState;\n if (process.env.NODE_ENV !== 'production') {\n React.useEffect(() => {\n if (isControlled !== (controlled !== undefined)) {\n error([`A component is changing the ${isControlled ? '' : 'un'}controlled ${state} state of ${name} to be ${isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${name} ` + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [state, name, controlled]);\n const {\n current: defaultValue\n } = React.useRef(defaultProp);\n React.useEffect(() => {\n if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {\n error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join('\\n'));\n }\n }, [defaultProp]);\n }\n const setValueIfUncontrolled = React.useCallback(newValue => {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}\nfunction serializeToDevModeString(input) {\n let nextId = 0;\n const seen = new WeakMap();\n try {\n const result = JSON.stringify(input, function replacer(key, value) {\n if (key === '_owner' && this != null && typeof this === 'object' && '$$typeof' in this) {\n return undefined;\n }\n if (typeof value === 'bigint') {\n return `__bigint__:${value}`;\n }\n if (value !== null && typeof value === 'object') {\n const id = seen.get(value);\n if (id !== undefined) {\n return `__object__:${id}`;\n }\n seen.set(value, nextId);\n nextId += 1;\n }\n return value;\n });\n return result ?? `__top__:${typeof input}`;\n } catch {\n return '__unserializable__';\n }\n}","'use client';\n\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\n\n/**\n * Untracks the provided value by turning it into a ref to remove its reactivity.\n *\n * Used to access the passed value inside `React.useEffect` without causing the effect to re-run when the value changes.\n */\nexport function useValueAsRef(value) {\n const latest = useRefWithInit(createLatestRef, value).current;\n latest.next = value;\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n useIsoLayoutEffect(latest.effect);\n return latest;\n}\nfunction createLatestRef(value) {\n const latest = {\n current: value,\n next: value,\n effect: () => {\n latest.current = latest.next;\n }\n };\n return latest;\n}","import * as React from 'react';\n/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.\n * More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\nimport { isReactVersionAtLeast } from \"../reactVersion.mjs\";\nimport { register, getInstance } from \"../fastHooks.mjs\";\n/* Some tests fail in R18 with the raw useSyncExternalStore. It may be possible to make it work\n * but for now we only enable it for R19+. */\nconst canUseRawUseSyncExternalStore = isReactVersionAtLeast(19);\nconst useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy;\nexport function useStore(store, selector, a1, a2, a3) {\n return useStoreImplementation(store, selector, a1, a2, a3);\n}\nfunction useStoreR19(store, selector, a1, a2, a3) {\n const getSelection = React.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]);\n return useSyncExternalStore(store.subscribe, getSelection, getSelection);\n}\nregister({\n before(instance) {\n instance.syncIndex = 0;\n if (!instance.didInitialize) {\n instance.syncTick = 1;\n instance.syncHooks = [];\n instance.didChangeStore = true;\n instance.getSnapshot = () => {\n let didChange = false;\n for (let i = 0; i < instance.syncHooks.length; i += 1) {\n const hook = instance.syncHooks[i];\n const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3);\n if (!Object.is(hook.value, value)) {\n didChange = true;\n hook.value = value;\n }\n }\n if (didChange) {\n instance.syncTick += 1;\n }\n return instance.syncTick;\n };\n }\n },\n after(instance) {\n if (instance.syncHooks.length > 0) {\n if (instance.didChangeStore) {\n instance.didChangeStore = false;\n instance.subscribe = onStoreChange => {\n const stores = new Set();\n for (const hook of instance.syncHooks) {\n stores.add(hook.store);\n }\n const unsubscribes = [];\n for (const store of stores) {\n unsubscribes.push(store.subscribe(onStoreChange));\n }\n return () => {\n for (const unsubscribe of unsubscribes) {\n unsubscribe();\n }\n };\n };\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useSyncExternalStore(instance.subscribe, instance.getSnapshot, instance.getSnapshot);\n }\n }\n});\nfunction useStoreFast(store, selector, a1, a2, a3) {\n const instance = getInstance();\n if (!instance) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStoreR19(store, selector, a1, a2, a3);\n }\n const index = instance.syncIndex;\n instance.syncIndex += 1;\n let hook;\n if (!instance.didInitialize) {\n hook = {\n store,\n selector,\n a1,\n a2,\n a3,\n value: selector(store.getSnapshot(), a1, a2, a3)\n };\n instance.syncHooks.push(hook);\n } else {\n hook = instance.syncHooks[index];\n if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) {\n if (hook.store !== store) {\n instance.didChangeStore = true;\n }\n hook.store = store;\n hook.selector = selector;\n hook.a1 = a1;\n hook.a2 = a2;\n hook.a3 = a3;\n hook.value = selector(store.getSnapshot(), a1, a2, a3);\n }\n }\n return hook.value;\n}\nfunction useStoreLegacy(store, selector, a1, a2, a3) {\n return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, state => selector(state, a1, a2, a3));\n}","import * as React from 'react';\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nconst hooks = [];\nlet currentInstance = undefined;\nexport function getInstance() {\n return currentInstance;\n}\nexport function setInstance(instance) {\n currentInstance = instance;\n}\nexport function register(hook) {\n hooks.push(hook);\n}\n\n/**\n * Wraps a component function to enable performance optimizations for internal hooks.\n *\n * **Performance Optimization:**\n * Components wrapped with `fastComponent` have access to a shared \"instance\" context that enables\n * specialized hook implementations to batch operations and reduce overhead. The wrapper creates a\n * stable instance object that persists across renders, sets it as the current context, calls\n * registered hooks before and after rendering, then clears the context. The primary benefit is\n * with `useStore`, where multiple store subscriptions within the same component are collapsed into\n * a single `useSyncExternalStore` subscription per store, significantly reducing re-render overhead.\n * This optimization is only active on React 19+; on earlier versions `useStore` falls back to a\n * separate subscription per call.\n *\n * **Requirements:**\n * - The component function should follow standard React component patterns\n * - `useStore` calls must keep a stable order and count across renders, as batched hooks are\n * matched by call index\n * - Do not rely on the instance context outside of specialized hooks\n *\n * @param fn - The component function to wrap\n * @returns A wrapped component with the same signature as the input function\n *\n * @example\n * ```tsx\n * // Wrapping a component to enable optimized useStore batching\n * export const TooltipRoot = fastComponent(function TooltipRoot(props) {\n * // These useStore calls share a single subscription\n * const open = useStore(store, (state) => state.open);\n * const disabled = useStore(store, (state) => state.disabled);\n * const value = useStore(store, (state) => state.value);\n * // ...\n * });\n * ```\n */\nexport function fastComponent(fn) {\n const FastComponent = (props, forwardedRef) => {\n const instance = useRefWithInit(createInstance).current;\n let result;\n try {\n currentInstance = instance;\n for (const hook of hooks) {\n hook.before(instance);\n }\n result = fn(props, forwardedRef);\n for (const hook of hooks) {\n hook.after(instance);\n }\n instance.didInitialize = true;\n } finally {\n currentInstance = undefined;\n }\n return result;\n };\n FastComponent.displayName = fn.displayName || fn.name;\n return FastComponent;\n}\n\n/**\n * Wraps a component function with ref forwarding to enable performance optimizations for internal hooks.\n *\n * This is a convenience wrapper that combines `fastComponent` with `React.forwardRef`, enabling\n * both performance optimizations and proper ref forwarding. See `fastComponent` for details on\n * the performance benefits.\n *\n * @param fn - The component function that accepts props and a forwarded ref\n * @returns A wrapped component with ref forwarding enabled\n *\n * @example\n * ```tsx\n * // Wrapping a component with ref forwarding and optimized hooks\n * export const TooltipTrigger = fastComponentRef(function TooltipTrigger(\n * props,\n * forwardedRef\n * ) {\n * const store = useContext(TooltipContext);\n * const open = useStore(store, (state) => state.open);\n * // ... component logic with ref\n * return <button ref={forwardedRef} {...props} />;\n * });\n * ```\n */\nexport function fastComponentRef(fn) {\n return /*#__PURE__*/React.forwardRef(fastComponent(fn));\n}\nfunction createInstance() {\n return {\n didInitialize: false\n };\n}","import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * Creates a store with the given initial state, constructing the class it is called on.\n * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that\n * class but degrades the inferred instance type to `Store`; use `new` there instead.\n */\n static create(state) {\n return new this(state);\n }\n\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}","/* False positives - ESLint thinks we're calling a hook from a class component. */\n/* eslint-disable react-hooks/rules-of-hooks */\n'use client';\n\nimport * as React from 'react';\nimport { Store } from \"./Store.mjs\";\nimport { useStore } from \"./useStore.mjs\";\nimport { useStableCallback } from \"../useStableCallback.mjs\";\nimport { useIsoLayoutEffect } from \"../useIsoLayoutEffect.mjs\";\nimport { NOOP } from \"../empty.mjs\";\n\n/**\n * A Store that supports controlled state keys, non-reactive values and provides utility methods for React.\n */\nexport class ReactStore extends Store {\n /**\n * Creates a new ReactStore instance.\n *\n * @param state Initial state of the store.\n * @param context Non-reactive context values.\n * @param selectors Optional selectors for use with `useState`.\n */\n constructor(state, context = {}, selectors) {\n super(state);\n this.context = context;\n this.selectors = selectors;\n }\n\n /**\n * Non-reactive values such as refs, callbacks, etc.\n */\n\n /**\n * Synchronizes a single external value into the store.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValue(key, value) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes a single external value into the store and\n * cleans it up (sets to `undefined`) on unmount.\n *\n * Note that the while the value in `state` is updated immediately, the value returned\n * by `useState` is updated before the next render (similarly to React's `useState`).\n */\n useSyncedValueWithCleanup(key, value) {\n // eslint-disable-next-line consistent-this\n const store = this;\n useIsoLayoutEffect(() => {\n if (store.state[key] !== value) {\n store.set(key, value);\n }\n return () => {\n store.set(key, undefined);\n };\n }, [store, key, value]);\n }\n\n /**\n * Synchronizes multiple external values into the store.\n * Each value must match its state key. Pass an exact known subset rather than a broad\n * `Partial<State>`, which may contain `undefined` for required state fields.\n *\n * Note that the while the values in `state` are updated immediately, the values returned\n * by `useState` are updated before the next render (similarly to React's `useState`).\n *\n * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted.\n */\n useSyncedValues(statePart) {\n // eslint-disable-next-line consistent-this\n const store = this;\n if (process.env.NODE_ENV !== 'production') {\n // Check that an object with the same shape is passed on every render\n React.useDebugValue(statePart, p => Object.keys(p));\n const keys = React.useRef(Object.keys(statePart)).current;\n const nextKeys = Object.keys(statePart);\n if (keys.length !== nextKeys.length || keys.some((key, index) => key !== nextKeys[index])) {\n console.error('ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.');\n }\n }\n const dependencies = Object.values(statePart);\n useIsoLayoutEffect(() => {\n store.update(statePart);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [store, ...dependencies]);\n }\n\n /**\n * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled`\n * is non-undefined, the store's state at `key` is updated to match `controlled`.\n */\n useControlledProp(key, controlled) {\n React.useDebugValue(key);\n // eslint-disable-next-line consistent-this\n const store = this;\n const isControlled = controlled !== undefined;\n useIsoLayoutEffect(() => {\n if (isControlled && !Object.is(store.state[key], controlled)) {\n // Set the internal state to match the controlled value.\n store.setState({\n ...store.state,\n [key]: controlled\n });\n }\n }, [store, key, controlled, isControlled]);\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n const cache = this.controlledValues ??= new Map();\n if (!cache.has(key)) {\n cache.set(key, isControlled);\n }\n const previouslyControlled = cache.get(key);\n if (previouslyControlled !== undefined && previouslyControlled !== isControlled) {\n console.error(`A component is changing the ${isControlled ? '' : 'un'}controlled state of ${key.toString()} to be ${isControlled ? 'un' : ''}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);\n }\n }\n }\n\n /** Gets the current value from the store using a selector with the provided key.\n *\n * @param key Key of the selector to use.\n */\n\n select(key, a1, a2, a3) {\n const selector = this.selectors[key];\n return selector(this.state, a1, a2, a3);\n }\n\n /**\n * Returns a value from the store's state using a selector function.\n * Used to subscribe to specific parts of the state.\n * This methods causes a rerender whenever the selected state changes.\n *\n * @param key Key of the selector to use.\n */\n\n useState(key, a1, a2, a3) {\n React.useDebugValue(key);\n return useStore(this, this.selectors[key], a1, a2, a3);\n }\n\n /**\n * Wraps a function with `useStableCallback` to ensure it has a stable reference\n * and assigns it to the context.\n *\n * @param key Key of the event callback. Must be a function in the context.\n * @param fn Function to assign.\n */\n useContextCallback(key, fn) {\n React.useDebugValue(key);\n const stableFunction = useStableCallback(fn ?? NOOP);\n this.context[key] = stableFunction;\n }\n\n /**\n * Returns a stable setter function for a specific key in the store's state.\n * It's commonly used to pass as a ref callback to React elements.\n *\n * @param key Key of the state to set.\n */\n useStateSetter(key) {\n const ref = React.useRef(undefined);\n if (ref.current === undefined) {\n ref.current = value => {\n this.set(key, value);\n };\n }\n return ref.current;\n }\n\n /**\n * Observes changes derived from the store's selectors and calls the listener when the selected value changes.\n *\n * @param key Key of the selector to observe.\n * @param listener Listener function called when the selector result changes.\n */\n\n observe(selector, listener) {\n let selectFn;\n if (typeof selector === 'function') {\n selectFn = selector;\n } else {\n selectFn = this.selectors[selector];\n }\n let prevValue = selectFn(this.state);\n listener(prevValue, prevValue, this);\n return this.subscribe(nextState => {\n const nextValue = selectFn(nextState);\n if (!Object.is(prevValue, nextValue)) {\n const oldValue = prevValue;\n prevValue = nextValue;\n listener(nextValue, oldValue, this);\n }\n });\n }\n}","/**\n * Combines multiple cleanup functions into a single cleanup function.\n */\nexport function mergeCleanups(...cleanups) {\n return () => {\n for (let i = 0; i < cleanups.length; i += 1) {\n const cleanup = cleanups[i];\n if (cleanup) {\n cleanup();\n }\n }\n };\n}","/**\n * Adds an event listener and returns a cleanup function to remove it.\n */\n\nexport function addEventListener(target, type, listener, options) {\n target.addEventListener(type, listener, options);\n return () => {\n target.removeEventListener(type, listener, options);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY } from \"./empty.mjs\";\n\n/**\n * A React.useEffect equivalent that runs once, when the component is mounted.\n */\nexport function useOnMount(fn) {\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler -- no need to put `fn` in the dependency array\n /* eslint-disable react-hooks/exhaustive-deps */\n React.useEffect(fn, EMPTY_ARRAY);\n /* eslint-enable react-hooks/exhaustive-deps */\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\n/** Unlike `setTimeout`, rAF doesn't guarantee a positive integer return value, so we can't have\n * a monomorphic `uint` type with `0` meaning empty.\n * See warning note at:\n * https://developer.mozilla.org/en-US/docs/Web/API/Window/requestAnimationFrame#return_value */\nconst EMPTY = null;\nlet LAST_RAF = globalThis.requestAnimationFrame;\nclass Scheduler {\n /* This implementation uses an array as a backing data-structure for frame callbacks.\n * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it\n * never calls the native `cancelAnimationFrame` if there are no frames left. This can\n * be much more efficient if there is a call pattern that alterns as\n * \"request-cancel-request-cancel-…\".\n * But in the case of \"request-request-…-cancel-cancel-…\", it leaves the final animation\n * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */\n\n callbacks = [];\n callbacksCount = 0;\n nextId = 1;\n startId = 1;\n isScheduled = false;\n tick = timestamp => {\n this.isScheduled = false;\n const currentCallbacks = this.callbacks;\n const currentCallbacksCount = this.callbacksCount;\n\n // Update these before iterating, callbacks could call `requestAnimationFrame` again.\n this.callbacks = [];\n this.callbacksCount = 0;\n this.startId = this.nextId;\n if (currentCallbacksCount > 0) {\n for (let i = 0; i < currentCallbacks.length; i += 1) {\n currentCallbacks[i]?.(timestamp);\n }\n }\n };\n request(fn) {\n const id = this.nextId;\n this.nextId += 1;\n this.callbacks.push(fn);\n this.callbacksCount += 1;\n\n /* In a test environment with fake timers, a fake `requestAnimationFrame` can be called\n * but there's no guarantee that the animation frame will actually run before the fake\n * timers are teared, which leaves `isScheduled` set, but won't run our `tick()`. */\n const didRAFChange = process.env.NODE_ENV !== 'production' && LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true);\n if (!this.isScheduled || didRAFChange) {\n requestAnimationFrame(this.tick);\n this.isScheduled = true;\n }\n return id;\n }\n cancel(id) {\n const index = id - this.startId;\n if (index < 0 || index >= this.callbacks.length) {\n return;\n }\n if (this.callbacks[index] === null) {\n return;\n }\n this.callbacks[index] = null;\n this.callbacksCount -= 1;\n }\n}\nlet scheduler = new Scheduler();\n\n/**\n * Replaces the shared scheduler and drops all pending animation frame callbacks.\n *\n * For test environments only. The scheduler is process-global, so a callback scheduled in one test\n * but never run (e.g. requested under fake timers that were torn down before the frame fired) would\n * otherwise survive into a later test and run there against stale state. Call between tests to drop\n * such leftovers.\n */\nexport function resetAnimationFrameScheduler() {\n const previous = scheduler;\n scheduler = new Scheduler();\n // Continue the id sequence so `cancel()` calls from `AnimationFrame` instances created before the\n // reset cannot cancel callbacks scheduled after it.\n scheduler.nextId = previous.nextId;\n scheduler.startId = previous.nextId;\n // A frame requested before the reset may still be pending and holds the previous scheduler's\n // `tick`; empty its queue in place so that frame runs nothing when it eventually fires.\n previous.callbacks = [];\n previous.callbacksCount = 0;\n}\nexport class AnimationFrame {\n static create() {\n return new AnimationFrame();\n }\n static request(fn) {\n return scheduler.request(fn);\n }\n static cancel(id) {\n return scheduler.cancel(id);\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n request(fn) {\n this.cancel();\n this.currentId = scheduler.request(() => {\n this.currentId = EMPTY;\n fn();\n });\n }\n cancel = () => {\n if (this.currentId !== EMPTY) {\n scheduler.cancel(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.cancel;\n };\n}\n\n/**\n * A `requestAnimationFrame` with automatic cleanup and guard.\n */\nexport function useAnimationFrame() {\n const timeout = useRefWithInit(AnimationFrame.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","'use client';\n\nimport { useRefWithInit } from \"./useRefWithInit.mjs\";\nimport { useOnMount } from \"./useOnMount.mjs\";\nconst EMPTY = 0;\nexport class Timeout {\n static create() {\n return new Timeout();\n }\n currentId = EMPTY;\n\n /**\n * Executes `fn` after `delay`, clearing any previously scheduled call.\n */\n start(delay, fn) {\n this.clear();\n this.currentId = setTimeout(() => {\n this.currentId = EMPTY;\n fn();\n }, delay); /* Node.js types are enabled in development */\n }\n isStarted() {\n return this.currentId !== EMPTY;\n }\n clear = () => {\n if (this.currentId !== EMPTY) {\n clearTimeout(this.currentId);\n this.currentId = EMPTY;\n }\n };\n disposeEffect = () => {\n return this.clear;\n };\n}\n\n/**\n * A `setTimeout` with automatic cleanup and guard.\n */\nexport function useTimeout() {\n const timeout = useRefWithInit(Timeout.create).current;\n useOnMount(timeout.disposeEffect);\n return timeout;\n}","export * as os from \"./os.mjs\";\nexport * as engine from \"./engine.mjs\";\nexport * as screenReader from \"./screen-reader.mjs\";\nexport * as env from \"./env.mjs\";\nexport * as mediaQuery from \"./media-query.mjs\";","import { lowerUserAgent, lowerPlatform, maxTouchPoints } from \"./shared.mjs\";\n\n// iPadOS 13+ reports `MacIntel` for `navigator.platform`; disambiguated via\n// `maxTouchPoints` so iPad is classified as iOS, not macOS.\n// https://github.com/mui/base-ui/issues/1309\n/** iPhone, iPad (including iPadOS 13+ reporting as macOS), iPod. */\nexport const ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === 'macintel' && maxTouchPoints > 1;\n\n/** Android phones, tablets, and embedded Android browsers. */\nconst ANDROID_STRING = 'android';\nexport const android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING);\n\n/** macOS desktop. Excludes iPadOS, which reports as `MacIntel`. */\nexport const mac = !ios && lowerPlatform.startsWith('mac');\n\n/** Windows desktop. */\nexport const windows = lowerPlatform.startsWith('win');\n\n/** Linux desktop (including Chrome OS). */\nexport const linux = !android && /^(linux|chrome os)/.test(lowerPlatform);\n\n/** Any Apple OS (`mac || ios`). */\nexport const apple = mac || ios;","/**\n * Reads `navigator.userAgent` / `navigator.platform` (legacy but universally\n * supported) into a normalized shape. In development, prefers the modern\n * `navigator.userAgentData` API on Chromium to avoid DevTools warnings about\n * the deprecated reads; that branch is dead-code-eliminated in production\n * builds to keep the bundle small.\n *\n * Returns empty/zero values when `navigator` is undefined (SSR), so every\n * derived flag safely evaluates to `false`.\n */\nfunction readRawData() {\n if (typeof navigator === 'undefined') {\n return {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n }\n if (process.env.NODE_ENV !== 'production') {\n const uaData = navigator.userAgentData;\n if (uaData && Array.isArray(uaData.brands)) {\n return {\n userAgent: uaData.brands.map(({\n brand,\n version\n }) => `${brand}/${version}`).join(' '),\n platform: uaData.platform ?? navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n }\n }\n return {\n userAgent: navigator.userAgent,\n platform: navigator.platform ?? '',\n maxTouchPoints: navigator.maxTouchPoints ?? 0\n };\n}\nconst {\n userAgent,\n platform,\n maxTouchPoints\n} = readRawData();\nexport const lowerUserAgent = userAgent.toLowerCase();\nexport const lowerPlatform = platform.toLowerCase();\nexport { maxTouchPoints };","import { lowerUserAgent } from \"./shared.mjs\";\n\n// WebKit (Safari, all iOS browsers, GNOME Web). Distinguished from Blink by\n// the legacy `-webkit-backdrop-filter` name — Blink forked from WebKit in 2013\n// and only ships the unprefixed `backdrop-filter`.\n/** WebKit: Safari, all iOS browsers, GNOME Web. Excludes Blink. */\nexport const webkit = typeof CSS !== 'undefined' && !!CSS.supports?.('-webkit-backdrop-filter:none');\n\n// Anchored to `!webkit` so engines are mutually exclusive by construction.\n// Firefox-on-iOS uses WebKit (its UA marker is `FxiOS/`, not `Firefox/`); the\n// `!webkit` prefix also defends against future iOS-browser UA changes that\n// might inject `Firefox` into a WebKit-based UA.\n/** Gecko: Firefox. */\nexport const gecko = !webkit && lowerUserAgent.includes('firefox');\n\n// All Chromium-based browsers ship `Chrome/` or `Chromium/` in their UA — both\n// share the `chrom` prefix, so a single substring check covers Chrome, Edge,\n// Opera, Brave, etc. Chrome-on-iOS uses `CriOS/` and stays WebKit. The positive\n// UA check also makes this SSR-safe — an empty UA matches nothing.\n/** Blink: Chrome, Edge, Opera, Brave, and other Chromium-based browsers. */\nexport const blink = !webkit && lowerUserAgent.includes('chrom');","import { apple } from \"./os.mjs\";\n\n// Whether a screen reader is *actually* running cannot be detected. These flags\n// identify platforms where a specific screen reader could be active. VoiceOver\n// is the system screen reader on Apple platforms and works with every browser\n// there, so the flag is purely an OS check; engine-specific quirks (e.g. the\n// NSAccessibility virtual-cursor focus path) should be gated at the call site.\n/**\n * The user *may* be using VoiceOver — actual activation is not detectable.\n * True on any Apple platform (macOS, iOS, iPadOS).\n */\nexport const voiceOver = apple;","import { lowerUserAgent } from \"./shared.mjs\";\n\n/** Running in jsdom or HappyDOM (used by unit tests). */\nexport const jsdom = /jsdom|happydom/.test(lowerUserAgent);","// Check support status at:\n// https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariCSSRef/Articles/StandardCSSProperties.html\n/** CSS `@supports` query matching iOS/iPadOS WebKit browsers. */\nexport const iOS = '@supports (-webkit-touch-callout: none)';","import { platform } from '@base-ui/utils/platform';\nexport function stopEvent(event) {\n event.preventDefault();\n event.stopPropagation();\n}\nexport function isReactEvent(event) {\n return 'nativeEvent' in event;\n}\n\n// License: https://github.com/adobe/react-spectrum/blob/main/packages/@react-aria/utils/src/isVirtualEvent.ts\nexport function isVirtualClick(event) {\n if (event.pointerType === '' && event.isTrusted) {\n return true;\n }\n if (platform.os.android && event.pointerType) {\n return event.type === 'click' && event.buttons === 1;\n }\n return event.detail === 0 && !event.pointerType;\n}\nexport function isVirtualPointerEvent(event) {\n if (platform.env.jsdom) {\n return false;\n }\n return !platform.os.android && event.width === 0 && event.height === 0 || platform.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||\n // iOS VoiceOver returns 0.333• for width/height.\n event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';\n}\nexport function isMouseLikePointerType(pointerType, strict) {\n // On some Linux machines with Chromium, mouse inputs return a `pointerType`\n // of \"pen\": https://github.com/floating-ui/floating-ui/issues/2015\n const values = ['mouse', 'pen'];\n if (!strict) {\n values.push('', undefined);\n }\n return values.includes(pointerType);\n}\nexport function isClickLikeEvent(event) {\n const type = event.type;\n return type === 'click' || type === 'mousedown' || type === 'keydown' || type === 'keyup';\n}","import { isShadowRoot } from '@floating-ui/utils/dom';\nexport function activeElement(doc) {\n let element = doc.activeElement;\n while (element?.shadowRoot?.activeElement != null) {\n element = element.shadowRoot.activeElement;\n }\n return element;\n}\nexport function contains(parent, child) {\n if (!parent || !child) {\n return false;\n }\n const rootNode = child.getRootNode?.();\n\n // First, attempt with the faster native method.\n if (parent.contains(child)) {\n return true;\n }\n\n // Then fall back to traversing out of shadow roots when needed.\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child;\n while (next) {\n if (parent === next) {\n return true;\n }\n next = next.parentNode || next.host;\n }\n }\n return false;\n}\nexport function getTarget(event) {\n if ('composedPath' in event) {\n // The composed path is empty once the event is no longer being dispatched,\n // so fall back to `target` for handlers running after dispatch completes.\n return event.composedPath()[0] ?? event.target;\n }\n\n // TS assumes `composedPath()` always exists, but older browsers without\n // shadow DOM support still fall back to `target`.\n return event.target;\n}","export const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';\nexport const ACTIVE_KEY = 'active';\nexport const SELECTED_KEY = 'selected';\nexport const TYPEABLE_SELECTOR = \"input:not([type='hidden']):not([disabled]),\" + \"[contenteditable]:not([contenteditable='false']),textarea:not([disabled])\";\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';","/**\n * Present when the component begins animating in.\n */\nexport const startingStyle = 'data-starting-style';\n\n/**\n * Present when the component is animating out.\n */\nexport const endingStyle = 'data-ending-style';","import * as TransitionStatusDataAttributes from \"./TransitionStatusDataAttributes.mjs\";\nexport { TransitionStatusDataAttributes };\nconst STARTING_HOOK = {\n [TransitionStatusDataAttributes.startingStyle]: ''\n};\nconst ENDING_HOOK = {\n [TransitionStatusDataAttributes.endingStyle]: ''\n};\nexport const transitionStatusMapping = {\n transitionStatus(value) {\n if (value === 'starting') {\n return STARTING_HOOK;\n }\n if (value === 'ending') {\n return ENDING_HOOK;\n }\n return null;\n }\n};","import * as TransitionStatusDataAttributes from \"../internals/TransitionStatusDataAttributes.mjs\";\n\n/**\n * Present when the popup is open.\n */\nexport const open = 'data-open';\n\n/**\n * Present when the popup is closed.\n */\nexport const closed = 'data-closed';\n\n/**\n * Present when the popup begins animating in.\n */\nexport const startingStyle = TransitionStatusDataAttributes.startingStyle;\n\n/**\n * Present when the popup is animating out.\n */\nexport const endingStyle = TransitionStatusDataAttributes.endingStyle;\n\n/**\n * Present when the anchor is hidden.\n */\nexport const anchorHidden = 'data-anchor-hidden';\n\n/**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type { 'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\nexport const side = 'data-side';\n\n/**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\nexport const align = 'data-align';","/**\n * Present when the popup is open.\n */\nexport const popupOpen = 'data-popup-open';\n\n/**\n * Present when a pressable trigger is pressed.\n */\nexport const pressed = 'data-pressed';","import { transitionStatusMapping } from \"../internals/stateAttributesMapping.mjs\";\nimport * as CommonPopupDataAttributes from \"./CommonPopupDataAttributes.mjs\";\nimport * as CommonTriggerDataAttributes from \"./CommonTriggerDataAttributes.mjs\";\nexport { CommonPopupDataAttributes, CommonTriggerDataAttributes };\nconst TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: ''\n};\nconst PRESSABLE_TRIGGER_HOOK = {\n [CommonTriggerDataAttributes.popupOpen]: '',\n [CommonTriggerDataAttributes.pressed]: ''\n};\nconst POPUP_OPEN_HOOK = {\n [CommonPopupDataAttributes.open]: ''\n};\nconst POPUP_CLOSED_HOOK = {\n [CommonPopupDataAttributes.closed]: ''\n};\nconst ANCHOR_HIDDEN_HOOK = {\n [CommonPopupDataAttributes.anchorHidden]: ''\n};\nexport const triggerOpenStateMapping = {\n open(value) {\n if (value) {\n return TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const pressableTriggerOpenStateMapping = {\n open(value) {\n if (value) {\n return PRESSABLE_TRIGGER_HOOK;\n }\n return null;\n }\n};\nexport const popupStateMapping = {\n open(value) {\n if (value) {\n return POPUP_OPEN_HOOK;\n }\n return POPUP_CLOSED_HOOK;\n },\n anchorHidden(value) {\n if (value) {\n return ANCHOR_HIDDEN_HOOK;\n }\n return null;\n }\n};\nexport const popupTransitionStateMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};","import { CommonTriggerDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the corresponding tooltip is open.\n */\nexport const popupOpen = CommonTriggerDataAttributes.popupOpen;\n/**\n * Present when the trigger is disabled, either by the `disabled` prop or by a parent `<Tooltip.Root>` component.\n */\nexport const triggerDisabled = 'data-trigger-disabled';","import { isElement, isHTMLElement } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { activeElement, contains, getTarget } from '@base-ui/utils/shadowDom';\nimport { FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR } from \"./constants.mjs\";\nimport * as TooltipTriggerDataAttributes from \"../../tooltip/trigger/TooltipTriggerDataAttributes.mjs\";\nexport { activeElement, contains, getTarget };\nexport function isTargetInsideEnabledTrigger(target, triggerElements) {\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n if (triggerElements.hasElement(targetElement)) {\n return !targetElement.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n for (const [, trigger] of triggerElements.entries()) {\n if (contains(trigger, targetElement)) {\n return !trigger.hasAttribute(TooltipTriggerDataAttributes.triggerDisabled);\n }\n }\n return false;\n}\nexport function isEventTargetWithin(event, node) {\n if (node == null) {\n return false;\n }\n if ('composedPath' in event) {\n return event.composedPath().includes(node);\n }\n\n // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't\n const eventAgain = event;\n return eventAgain.target != null && node.contains(eventAgain.target);\n}\nexport function isRootElement(element) {\n return element.matches('html,body');\n}\nexport function isTypeableElement(element) {\n return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);\n}\nexport function isInteractiveElement(element) {\n return element?.closest(`button,a[href],[role=\"button\"],select,[tabindex]:not([tabindex=\"-1\"]),${TYPEABLE_SELECTOR}`) != null;\n}\nexport function isTypeableCombobox(element) {\n if (!element) {\n return false;\n }\n return element.getAttribute('role') === 'combobox' && isTypeableElement(element);\n}\nexport function matchesFocusVisible(element) {\n // We don't want to block focus from working with `visibleOnly`\n // (JSDOM doesn't match `:focus-visible` when the element has `:focus`)\n if (!element || platform.env.jsdom) {\n return true;\n }\n try {\n return element.matches(':focus-visible');\n } catch (_e) {\n return true;\n }\n}\nexport function getFloatingFocusElement(floatingElement) {\n if (!floatingElement) {\n return null;\n }\n // Try to find the element that has `{...getFloatingProps()}` spread on it.\n // This indicates the floating element is acting as a positioning wrapper, and\n // so focus should be managed on the child element with the event handlers and\n // aria props.\n return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement;\n}","import { isMouseLikePointerType } from \"../utils/event.mjs\";\nexport { isTargetInsideEnabledTrigger as isInsideEnabledTrigger } from \"../utils/element.mjs\";\nfunction resolveValue(value, pointerType) {\n if (pointerType != null && !isMouseLikePointerType(pointerType)) {\n return 0;\n }\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function getDelay(value, prop, pointerType) {\n const result = resolveValue(value, pointerType);\n if (typeof result === 'number') {\n return result;\n }\n return result?.[prop];\n}\nexport function getRestMs(value) {\n if (typeof value === 'function') {\n return value();\n }\n return value;\n}\nexport function isClickLikeOpenEvent(openEventType, interactedInside) {\n return interactedInside || openEventType === 'click' || openEventType === 'mousedown';\n}\nexport function isHoverOpenEvent(openEventType) {\n return openEventType?.includes('mouse') && openEventType !== 'mousedown';\n}","export const none = 'none';\nexport const triggerPress = 'trigger-press';\nexport const triggerHover = 'trigger-hover';\nexport const triggerFocus = 'trigger-focus';\nexport const outsidePress = 'outside-press';\nexport const itemPress = 'item-press';\nexport const closePress = 'close-press';\nexport const linkPress = 'link-press';\nexport const clearPress = 'clear-press';\nexport const chipRemovePress = 'chip-remove-press';\nexport const trackPress = 'track-press';\nexport const incrementPress = 'increment-press';\nexport const decrementPress = 'decrement-press';\nexport const inputChange = 'input-change';\nexport const inputClear = 'input-clear';\nexport const inputBlur = 'input-blur';\nexport const inputPaste = 'input-paste';\nexport const inputPress = 'input-press';\nexport const focusOut = 'focus-out';\nexport const escapeKey = 'escape-key';\nexport const closeWatcher = 'close-watcher';\nexport const listNavigation = 'list-navigation';\nexport const keyboard = 'keyboard';\nexport const pointer = 'pointer';\nexport const drag = 'drag';\nexport const wheel = 'wheel';\nexport const scrub = 'scrub';\nexport const cancelOpen = 'cancel-open';\nexport const siblingOpen = 'sibling-open';\nexport const disabled = 'disabled';\nexport const missing = 'missing';\nexport const initial = 'initial';\nexport const imperativeAction = 'imperative-action';\nexport const swipe = 'swipe';\nexport const windowResize = 'window-resize';","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { REASONS } from \"./reasons.mjs\";\n\n/**\n * Maps a change `reason` string to the corresponding native event type.\n */\n\n/**\n * Details of custom change events emitted by Base UI components.\n */\n\n/**\n * Details of custom generic events emitted by Base UI components.\n */\n\n/**\n * Creates a Base UI event details object with the given reason and utilities\n * for preventing Base UI's internal event handling.\n */\nexport function createChangeEventDetails(reason, event, trigger, customProperties) {\n let canceled = false;\n let allowPropagation = false;\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n cancel() {\n canceled = true;\n },\n allowPropagation() {\n allowPropagation = true;\n },\n get isCanceled() {\n return canceled;\n },\n get isPropagationAllowed() {\n return allowPropagation;\n },\n trigger,\n ...custom\n };\n return details;\n}\nexport function createGenericEventDetails(reason, event, customProperties) {\n const custom = customProperties ?? EMPTY_OBJECT;\n const details = {\n reason,\n event: event ?? new Event('base-ui'),\n ...custom\n };\n return details;\n}","'use client';\n\nimport * as React from 'react';\nimport { getNodeName, isHTMLElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { platform } from '@base-ui/utils/platform';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { activeElement, contains, getTarget, isTypeableCombobox, getFloatingFocusElement, isTypeableElement } from \"../utils/element.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nimport { tabbable, focusable, isOutsideEvent, isTabbable, getNextTabbable, getPreviousTabbable } from \"../utils/tabbable.mjs\";\nimport { getNodeAncestors, getNodeChildren } from \"../utils/nodes.mjs\";\nimport { isElementVisible } from \"../utils/composite.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { markOthers } from \"../utils/markOthers.mjs\";\nimport { usePortalContext } from \"./FloatingPortal.mjs\";\nimport { useFloatingTree } from \"./FloatingTree.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { resolveRef } from \"../../utils/resolveRef.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nfunction getEventType(event, lastInteractionType) {\n const win = ownerWindow(getTarget(event));\n if (event instanceof win.KeyboardEvent) {\n return 'keyboard';\n }\n if (event instanceof win.FocusEvent) {\n // Focus events can be caused by a preceding pointer interaction (e.g., focusout on outside press).\n // Prefer the last known pointer type if provided, else treat as keyboard.\n return lastInteractionType || 'keyboard';\n }\n if ('pointerType' in event) {\n return event.pointerType || 'keyboard';\n }\n if ('touches' in event) {\n return 'touch';\n }\n if (event instanceof win.MouseEvent) {\n // onClick events may not contain pointer events, and will fall through to here\n return lastInteractionType || (event.detail === 0 ? 'keyboard' : 'mouse');\n }\n return '';\n}\nconst LIST_LIMIT = 20;\nlet previouslyFocusedElements = [];\nfunction clearDisconnectedPreviouslyFocusedElements() {\n previouslyFocusedElements = previouslyFocusedElements.filter(entry => {\n return entry.deref()?.isConnected;\n });\n}\nfunction addPreviouslyFocusedElement(element) {\n clearDisconnectedPreviouslyFocusedElements();\n if (element && getNodeName(element) !== 'body') {\n previouslyFocusedElements.push(new WeakRef(element));\n if (previouslyFocusedElements.length > LIST_LIMIT) {\n previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT);\n }\n }\n}\nfunction getPreviouslyFocusedElement() {\n clearDisconnectedPreviouslyFocusedElements();\n return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref();\n}\nfunction getFirstTabbableElement(container) {\n if (!container) {\n return null;\n }\n if (isTabbable(container)) {\n return container;\n }\n return tabbable(container)[0] || container;\n}\nfunction handleTabIndex(floatingFocusElement) {\n if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) {\n return;\n }\n if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) {\n return;\n }\n const focusableElements = focusable(floatingFocusElement);\n const tabbableContent = focusableElements.filter(element => {\n const dataTabIndex = element.getAttribute('data-tabindex') || '';\n return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');\n });\n const tabIndex = floatingFocusElement.getAttribute('tabindex');\n if (tabbableContent.length === 0) {\n if (tabIndex !== '0') {\n floatingFocusElement.setAttribute('tabindex', '0');\n // Mark our own write so the externally-managed early-return above doesn't\n // mistake it for a user-authored `tabindex` and freeze management.\n floatingFocusElement.setAttribute('data-tabindex', '0');\n }\n } else if (tabIndex !== '-1' || floatingFocusElement.hasAttribute('data-tabindex') && floatingFocusElement.getAttribute('data-tabindex') !== '-1') {\n floatingFocusElement.setAttribute('tabindex', '-1');\n floatingFocusElement.setAttribute('data-tabindex', '-1');\n }\n}\n/**\n * Provides focus management for the floating element.\n * @see https://floating-ui.com/docs/FloatingFocusManager\n * @internal\n */\nexport function FloatingFocusManager(props) {\n const {\n context,\n children,\n disabled = false,\n initialFocus = true,\n returnFocus = true,\n restoreFocus = false,\n modal = true,\n closeOnFocusOut = true,\n openInteractionType = '',\n nextFocusableElement,\n previousFocusableElement,\n beforeContentFocusGuardRef,\n externalTree,\n getInsideElements\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const domReference = store.useState('domReferenceElement');\n const floating = store.useState('floatingElement');\n const {\n events,\n dataRef\n } = store.context;\n const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId);\n const ignoreInitialFocus = initialFocus === false;\n // A typeable combobox reference (e.g. input/textarea) with `initialFocus={false}`\n // has different focus semantics: focus is not trapped inside the floating element,\n // so in the modal case the guards are not rendered, but `aria-hidden` is still\n // applied to the outside nodes.\n const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;\n const initialFocusRef = useValueAsRef(initialFocus);\n const returnFocusRef = useValueAsRef(returnFocus);\n const openInteractionTypeRef = useValueAsRef(openInteractionType);\n const openRef = useValueAsRef(open);\n const tree = useFloatingTree(externalTree);\n const portalContext = usePortalContext();\n const preventReturnFocusRef = React.useRef(false);\n const isPointerDownRef = React.useRef(false);\n const pointerDownOutsideRef = React.useRef(false);\n const lastFocusedTabbableRef = React.useRef(null);\n const closeTypeRef = React.useRef('');\n const lastInteractionTypeRef = React.useRef('');\n const beforeGuardRef = React.useRef(null);\n const afterGuardRef = React.useRef(null);\n const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef);\n const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef);\n const blurTimeout = useTimeout();\n const pointerDownTimeout = useTimeout();\n const restoreFocusFrame = useAnimationFrame();\n const isInsidePortal = portalContext != null;\n const floatingFocusElement = getFloatingFocusElement(floating);\n const getTabbableContent = useStableCallback((container = floatingFocusElement) => {\n return container ? tabbable(container) : [];\n });\n const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter(element => element != null) ?? []);\n\n // Prevent Tab from escaping the modal when there are no tabbable elements.\n React.useEffect(() => {\n if (disabled || !modal) {\n return undefined;\n }\n function onKeyDown(event) {\n if (event.key === 'Tab') {\n // The focus guards have nothing to focus, so we need to stop the event.\n if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) {\n stopEvent(event);\n }\n }\n }\n const doc = ownerDocument(floatingFocusElement);\n return addEventListener(doc, 'keydown', onKeyDown);\n }, [disabled, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]);\n\n // Track pointer/keyboard interactions to disambiguate focus and outside presses.\n React.useEffect(() => {\n if (disabled || !open) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n function clearPointerDownOutside() {\n pointerDownOutsideRef.current = false;\n }\n function onPointerDown(event) {\n const target = getTarget(event);\n const insideElements = getResolvedInsideElements();\n const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some(element => element === target || contains(element, target));\n pointerDownOutsideRef.current = !pointerTargetInside;\n lastInteractionTypeRef.current = event.pointerType || 'keyboard';\n if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) {\n isPointerDownRef.current = true;\n // Reset on the next tick so a single click on a click-trigger doesn't\n // permanently suppress focus-out closing for the lifetime of the instance.\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n }\n function onKeyDown() {\n lastInteractionTypeRef.current = 'keyboard';\n }\n return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true),\n // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups)\n // if the popup dismissed between pointerdown and pointerup.\n clearPointerDownOutside);\n }, [disabled, floating, domReference, floatingFocusElement, open, portalContext, pointerDownTimeout, getResolvedInsideElements]);\n\n // Close on focus out and restore focus within the floating tree when needed.\n React.useEffect(() => {\n if (disabled || !closeOnFocusOut) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n\n // In Safari, buttons lose focus when pressing them.\n function handlePointerDown() {\n isPointerDownRef.current = true;\n pointerDownTimeout.start(0, () => {\n isPointerDownRef.current = false;\n });\n }\n function handleFocusIn(event) {\n const target = getTarget(event);\n if (isTabbable(target)) {\n lastFocusedTabbableRef.current = target;\n }\n }\n function handleFocusOutside(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n const target = getTarget(event);\n\n // When focus is lost to the body (e.g. on a backdrop press), record the element that\n // had focus so a confirmation dialog opened while the body is focused can return focus\n // to it. Scoped to `modal` to avoid non-modal popups polluting the shared stack.\n if (modal && relatedTarget == null && target != null && contains(floating, target)) {\n addPreviouslyFocusedElement(target);\n }\n queueMicrotask(() => {\n const nodeId = getNodeId();\n const triggers = store.context.triggerElements;\n const insideElements = getResolvedInsideElements();\n const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute('focus-guard')) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget);\n const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some(element => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement(trigger => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find(node => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find(node => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));\n if (currentTarget === domReference && floatingFocusElement) {\n handleTabIndex(floatingFocusElement);\n }\n\n // Restore focus to the previously focused tabbable element to prevent\n // focus from being lost outside the floating tree.\n if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {\n // Let `FloatingPortal` effect knows that focus is still inside the\n // floating tree.\n if (isHTMLElement(floatingFocusElement)) {\n floatingFocusElement.focus();\n // If explicitly requested to restore focus to the popup container, do not search\n // for the next/previous tabbable element.\n if (restoreFocus === 'popup') {\n // If the focused element is removed on pointerdown, the browser\n // tries to move focus to it right after the `.focus()` call above,\n // but because it's removed in the same tick, focus is lost instead.\n // Re-focusing asynchronously (next frame) wins that race.\n restoreFocusFrame.request(() => {\n floatingFocusElement.focus();\n });\n return;\n }\n }\n const tabbableContent = getTabbableContent();\n const prevTabbable = lastFocusedTabbableRef.current;\n const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement;\n if (isHTMLElement(nodeToFocus)) {\n nodeToFocus.focus();\n }\n }\n\n // https://github.com/floating-ui/floating-ui/issues/3060\n if (dataRef.current.insideReactTree) {\n dataRef.current.insideReactTree = false;\n return;\n }\n\n // Focus did not move inside the floating tree, and there are no tabbable\n // portal guards to handle closing.\n if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && (\n // Fix React 18 Strict Mode returnFocus due to double rendering.\n // For an \"untrapped\" typeable combobox (input role=combobox with\n // initialFocus=false), re-opening the popup and tabbing out should still close it even\n // when the previously focused element (e.g. the next tabbable outside the popup) is\n // focused again. Otherwise, the popup remains open on the second Tab sequence:\n // click input -> Tab (closes) -> click input -> Tab.\n // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.\n isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) {\n preventReturnFocusRef.current = true;\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event));\n }\n });\n }\n function markInsideReactTree() {\n if (pointerDownOutsideRef.current) {\n return;\n }\n dataRef.current.insideReactTree = true;\n blurTimeout.start(0, () => {\n dataRef.current.insideReactTree = false;\n });\n }\n const domReferenceElement = isHTMLElement(domReference) ? domReference : null;\n if (!floating && !domReferenceElement) {\n return undefined;\n }\n return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, 'focusout', handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, 'pointerdown', handlePointerDown), floating && addEventListener(floating, 'focusin', handleFocusIn), floating && addEventListener(floating, 'focusout', handleFocusOutside), floating && portalContext && addEventListener(floating, 'focusout', markInsideReactTree, true));\n }, [disabled, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Hide everything outside the floating tree from assistive tech while open.\n React.useEffect(() => {\n if (disabled || !floating || !open) {\n return undefined;\n }\n\n // Don't hide portals nested within the parent portal.\n const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute('portal')}]`) || []);\n const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : [];\n const rootAncestorComboboxDomReference = ancestors.find(node => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference;\n const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()];\n const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter(x => x != null);\n const ariaHiddenCleanup = markOthers(insideElements, {\n ariaHidden: modal || isUntrappedTypeableCombobox,\n mark: false\n });\n const markerInsideElements = [floating, ...portalNodes].filter(x => x != null);\n const markerCleanup = markOthers(markerInsideElements);\n return () => {\n markerCleanup();\n ariaHiddenCleanup();\n };\n }, [open, disabled, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]);\n\n // Focus the initial element when the floating element opens.\n useIsoLayoutEffect(() => {\n if (!open || disabled || !isHTMLElement(floatingFocusElement)) {\n return;\n }\n closeTypeRef.current = '';\n lastInteractionTypeRef.current = '';\n const doc = ownerDocument(floatingFocusElement);\n const previouslyFocusedElement = activeElement(doc);\n\n // Wait for any layout effect state setters to execute to set `tabIndex`.\n queueMicrotask(() => {\n const initialFocusValueOrFn = initialFocusRef.current;\n const resolvedInitialFocus = typeof initialFocusValueOrFn === 'function' ? initialFocusValueOrFn(openInteractionTypeRef.current || '') : initialFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedInitialFocus === undefined || resolvedInitialFocus === false) {\n return;\n }\n const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement);\n if (focusAlreadyInsideFloatingEl) {\n return;\n }\n let focusableElements = null;\n const getDefaultFocusElement = () => {\n if (focusableElements == null) {\n focusableElements = getTabbableContent(floatingFocusElement);\n }\n return focusableElements[0] || floatingFocusElement;\n };\n let elToFocus;\n if (resolvedInitialFocus === true || resolvedInitialFocus === null) {\n elToFocus = getDefaultFocusElement();\n } else {\n elToFocus = resolveRef(resolvedInitialFocus);\n }\n elToFocus = elToFocus || getDefaultFocusElement();\n const hadFocusInside = contains(floatingFocusElement, activeElement(doc));\n\n // enqueueFocus returns a rAF-cancel function; we intentionally don't cancel this focus.\n void enqueueFocus(elToFocus, {\n preventScroll: elToFocus === floatingFocusElement,\n shouldFocus() {\n // This focus is queued on the next animation frame. If the floating element has closed\n // before it runs — e.g. tabbing out of a kept-mounted popup — don't pull focus back\n // onto the initial element after it has legitimately moved elsewhere.\n if (!openRef.current) {\n return false;\n }\n if (hadFocusInside) {\n return true;\n }\n const currentActiveElement = activeElement(doc);\n const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);\n return !focusMovedInside;\n }\n });\n });\n }, [disabled, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]);\n\n // Track return focus targets and restore focus on unmount/close.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n const doc = ownerDocument(floatingFocusElement);\n const elementFocusedBeforeOpen = activeElement(doc);\n // Only an explicit `null` interaction type represents a programmatic open.\n // `undefined` is normalized to `''` by the prop default, so it never reaches\n // here as nullish and is intentionally not treated as programmatic.\n const preferPreviousFocus = openInteractionTypeRef.current == null;\n addPreviouslyFocusedElement(elementFocusedBeforeOpen);\n function onOpenChangeLocal(details) {\n if (!details.open) {\n closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);\n }\n if (details.reason === REASONS.triggerHover && details.nativeEvent.type === 'mouseleave') {\n preventReturnFocusRef.current = true;\n }\n if (details.reason !== REASONS.outsidePress) {\n return;\n }\n if (details.nested) {\n preventReturnFocusRef.current = false;\n } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) {\n preventReturnFocusRef.current = false;\n } else {\n // On outside press, only return focus to the reference when the browser supports the\n // `focus({ preventScroll })` option; without it, restoring focus scrolls the page.\n // Chrome on Android and Samsung Internet still don't support `preventScroll`\n // (https://issues.chromium.org/issues/41453122), so the runtime check keeps return\n // focus disabled there to avoid the scroll jump.\n let isPreventScrollSupported = false;\n ownerDocument(floatingFocusElement).createElement('div').focus({\n get preventScroll() {\n isPreventScrollSupported = true;\n return false;\n }\n });\n if (isPreventScrollSupported) {\n preventReturnFocusRef.current = false;\n } else {\n preventReturnFocusRef.current = true;\n }\n }\n }\n events.on('openchange', onOpenChangeLocal);\n function getReturnElement(closeType) {\n const returnFocusValueOrFn = returnFocusRef.current;\n let resolvedReturnFocusValue = typeof returnFocusValueOrFn === 'function' ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;\n\n // `null` should fallback to default behavior in case of an empty ref.\n if (resolvedReturnFocusValue === undefined || resolvedReturnFocusValue === false) {\n return null;\n }\n if (resolvedReturnFocusValue === null) {\n resolvedReturnFocusValue = true;\n }\n const referenceReturnElement = domReference?.isConnected ? domReference : null;\n const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== 'body' ? elementFocusedBeforeOpen : null;\n let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;\n if (!defaultReturnElement) {\n defaultReturnElement = getPreviouslyFocusedElement() || null;\n }\n if (typeof resolvedReturnFocusValue === 'boolean') {\n return defaultReturnElement;\n }\n return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;\n }\n return () => {\n events.off('openchange', onOpenChangeLocal);\n const activeEl = activeElement(doc);\n const insideElements = getResolvedInsideElements();\n const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some(element => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some(node => contains(node.context?.elements.floating, activeEl));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const returnFocusValueOrFn = returnFocusRef.current;\n const closeType = closeTypeRef.current;\n const returnElement = getReturnElement(closeType);\n queueMicrotask(() => {\n // `returnElement` if it is tabbable, otherwise its first tabbable child,\n // otherwise `returnElement` itself (which may not be tabbable at all).\n const tabbableReturnElement = getFirstTabbableElement(returnElement);\n const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== 'boolean';\n if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (\n // If the focus moved somewhere else after mount, avoid returning focus\n // since it likely entered a different element which should be\n // respected: https://github.com/floating-ui/floating-ui/issues/2607\n !hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) {\n const focusOptions = {\n preventScroll: true\n };\n if (closeType === 'keyboard') {\n focusOptions.focusVisible = true;\n }\n tabbableReturnElement.focus(focusOptions);\n }\n preventReturnFocusRef.current = false;\n });\n };\n }, [disabled, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]);\n\n // Safari may randomly scroll to the bottom of the page if an input inside a popup has focus\n // when the popup unmounts from the DOM.\n // By blurring it before the popup unmounts, we can prevent this behavior.\n useIsoLayoutEffect(() => {\n if (!platform.engine.webkit || open || !floating) {\n return;\n }\n const activeEl = activeElement(ownerDocument(floating));\n if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) {\n return;\n }\n if (contains(floating, activeEl)) {\n activeEl.blur();\n }\n }, [open, floating]);\n\n // Synchronize the focus manager state (modal, closeOnFocusOut, open, etc.) to the\n // FloatingPortal context, which uses it to decide whether to render its own guards.\n useIsoLayoutEffect(() => {\n if (disabled || !portalContext) {\n return undefined;\n }\n portalContext.setFocusManagerState({\n modal,\n closeOnFocusOut,\n open,\n onOpenChange: store.setOpen,\n domReference\n });\n return () => {\n portalContext.setFocusManagerState(null);\n };\n }, [disabled, portalContext, modal, open, store, closeOnFocusOut, domReference]);\n\n // Keep the floating element tabIndex in sync and clear stale focus records.\n useIsoLayoutEffect(() => {\n if (disabled || !floatingFocusElement) {\n return undefined;\n }\n handleTabIndex(floatingFocusElement);\n return () => {\n queueMicrotask(clearDisconnectedPreviouslyFocusedElements);\n };\n }, [disabled, floatingFocusElement]);\n const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedBeforeGuardRef,\n onFocus: event => {\n if (modal) {\n const els = getTabbableContent();\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(els[els.length - 1]);\n } else if (portalContext?.portalNode) {\n preventReturnFocusRef.current = false;\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n } else {\n resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus();\n }\n }\n }\n }), children, shouldRenderGuards && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"inside\",\n ref: mergedAfterGuardRef,\n onFocus: event => {\n if (modal) {\n // enqueueFocus returns a rAF-cancel function we don't need here.\n void enqueueFocus(getTabbableContent()[0]);\n } else if (portalContext?.portalNode) {\n if (closeOnFocusOut) {\n preventReturnFocusRef.current = true;\n }\n if (isOutsideEvent(event, portalContext.portalNode)) {\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n } else {\n resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus();\n }\n }\n }\n })]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { platform } from '@base-ui/utils/platform';\nimport { visuallyHidden } from '@base-ui/utils/visuallyHidden';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const FocusGuard = /*#__PURE__*/React.forwardRef(function FocusGuard(props, ref) {\n const [role, setRole] = React.useState();\n useIsoLayoutEffect(() => {\n // Unlike NVDA and JAWS, VoiceOver's virtual cursor triggers `onFocus` as\n // it moves — but only on focusable/role-button elements through WebKit's\n // NSAccessibility path. Setting `role=\"button\"` lets the focus trap catch\n // the cursor.\n if (platform.screenReader.voiceOver && platform.engine.webkit) {\n setRole('button');\n }\n }, []);\n const restProps = {\n tabIndex: 0,\n // Role is only for VoiceOver\n role\n };\n return /*#__PURE__*/_jsx(\"span\", {\n ...props,\n ref: ref,\n style: visuallyHidden,\n \"aria-hidden\": role ? undefined : true,\n ...restProps,\n \"data-base-ui-focus-guard\": \"\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") FocusGuard.displayName = \"FocusGuard\";","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n const firstChar = placement[0];\n return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');\n}\nconst lrPlacement = ['left', 'right'];\nconst rlPlacement = ['right', 'left'];\nconst tbPlacement = ['top', 'bottom'];\nconst btPlacement = ['bottom', 'top'];\nfunction getSideList(side, isStart, rtl) {\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rlPlacement : lrPlacement;\n return isStart ? lrPlacement : rlPlacement;\n case 'left':\n case 'right':\n return isStart ? tbPlacement : btPlacement;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n const side = getSide(placement);\n return oppositeSideMap[side] + placement.slice(side.length);\n}\nfunction expandPaddingObject(padding) {\n var _padding$top, _padding$right, _padding$bottom, _padding$left;\n return {\n top: (_padding$top = padding.top) != null ? _padding$top : 0,\n right: (_padding$right = padding.right) != null ? _padding$right : 0,\n bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,\n left: (_padding$left = padding.left) != null ? _padding$left : 0\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = el.closest('[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}","import { getComputedStyle, getNodeName, isHTMLElement, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { activeElement, contains } from \"./element.mjs\";\nimport { isElementVisible } from \"./composite.mjs\";\nconst CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable=\"false\"]),audio[controls],video[controls]';\nfunction getParentElement(element) {\n const assignedSlot = element.assignedSlot;\n if (assignedSlot) {\n return assignedSlot;\n }\n if (element.parentElement) {\n return element.parentElement;\n }\n const rootNode = element.getRootNode();\n return isShadowRoot(rootNode) ? rootNode.host : null;\n}\nfunction getDetailsSummary(details) {\n for (const child of Array.from(details.children)) {\n if (getNodeName(child) === 'summary') {\n return child;\n }\n }\n return null;\n}\nfunction isWithinOpenDetailsSummary(element, details) {\n const summary = getDetailsSummary(details);\n return !!summary && (element === summary || contains(summary, element));\n}\nfunction isFocusableCandidate(element) {\n const nodeName = element ? getNodeName(element) : '';\n return element != null && element.matches(CANDIDATE_SELECTOR) && (nodeName !== 'summary' || element.parentElement != null && getNodeName(element.parentElement) === 'details' && getDetailsSummary(element.parentElement) === element) && (nodeName !== 'details' || getDetailsSummary(element) == null) && (nodeName !== 'input' || element.type !== 'hidden');\n}\nfunction isFocusableElement(element) {\n if (!isFocusableCandidate(element) || !element.isConnected || element.matches(':disabled')) {\n return false;\n }\n for (let current = element; current; current = getParentElement(current)) {\n const isAncestor = current !== element;\n const isSlot = getNodeName(current) === 'slot';\n if (current.hasAttribute('inert')) {\n return false;\n }\n if (isAncestor && getNodeName(current) === 'details' && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute('hidden') || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) {\n return false;\n }\n }\n return true;\n}\nfunction isVisibleInTabbableTree(element, isAncestor) {\n const styles = getComputedStyle(element);\n if (!isAncestor) {\n return isElementVisible(element, styles);\n }\n return styles.display !== 'none';\n}\nfunction getTabIndex(element) {\n const tabIndex = element.tabIndex;\n if (tabIndex < 0) {\n const nodeName = getNodeName(element);\n if (nodeName === 'details' || nodeName === 'audio' || nodeName === 'video' || isHTMLElement(element) && element.isContentEditable) {\n return 0;\n }\n }\n return tabIndex;\n}\nfunction getNamedRadioInput(element) {\n if (getNodeName(element) !== 'input') {\n return null;\n }\n const input = element;\n return input.type === 'radio' && input.name !== '' ? input : null;\n}\nfunction isTabbableRadio(element, candidates) {\n const input = getNamedRadioInput(element);\n if (!input) {\n return true;\n }\n const checkedRadio = candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form && radio.checked;\n });\n if (checkedRadio) {\n return checkedRadio === input;\n }\n return candidates.find(candidate => {\n const radio = getNamedRadioInput(candidate);\n return radio?.name === input.name && radio.form === input.form;\n }) === input;\n}\nfunction getComposedChildren(container) {\n if (isHTMLElement(container) && getNodeName(container) === 'slot') {\n const assignedElements = container.assignedElements({\n flatten: true\n });\n if (assignedElements.length > 0) {\n return assignedElements;\n }\n }\n if (isHTMLElement(container) && container.shadowRoot) {\n return Array.from(container.shadowRoot.children);\n }\n return Array.from(container.children);\n}\nfunction appendCandidates(container, list) {\n getComposedChildren(container).forEach(child => {\n if (isFocusableCandidate(child)) {\n list.push(child);\n }\n appendCandidates(child, list);\n });\n}\nfunction appendMatchingElements(container, selector, list) {\n getComposedChildren(container).forEach(child => {\n if (isHTMLElement(child) && child.matches(selector)) {\n list.push(child);\n }\n appendMatchingElements(child, selector, list);\n });\n}\nexport function isTabbable(element) {\n return isFocusableElement(element) && getTabIndex(element) >= 0;\n}\nexport function focusable(container) {\n const candidates = [];\n appendCandidates(container, candidates);\n return candidates.filter(isFocusableElement);\n}\nexport function tabbable(container) {\n const candidates = focusable(container);\n return candidates.filter(element => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates));\n}\nfunction getTabbableIn(container, dir) {\n const list = tabbable(container);\n const len = list.length;\n if (len === 0) {\n return undefined;\n }\n const active = activeElement(ownerDocument(container));\n const index = list.indexOf(active);\n // eslint-disable-next-line no-nested-ternary\n const nextIndex = index === -1 ? dir === 1 ? 0 : len - 1 : index + dir;\n return list[nextIndex];\n}\nexport function getNextTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement;\n}\nexport function getPreviousTabbable(referenceElement) {\n return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;\n}\nfunction getTabbableNearElement(referenceElement, dir) {\n if (!referenceElement) {\n return null;\n }\n const list = tabbable(ownerDocument(referenceElement).body);\n const elementCount = list.length;\n if (elementCount === 0) {\n return null;\n }\n const index = list.indexOf(referenceElement);\n if (index === -1) {\n return null;\n }\n const nextIndex = (index + dir + elementCount) % elementCount;\n return list[nextIndex];\n}\nexport function getTabbableAfterElement(referenceElement) {\n return getTabbableNearElement(referenceElement, 1);\n}\nexport function getTabbableBeforeElement(referenceElement) {\n return getTabbableNearElement(referenceElement, -1);\n}\nexport function isOutsideEvent(event, container) {\n const containerElement = container || event.currentTarget;\n const relatedTarget = event.relatedTarget;\n return !relatedTarget || !contains(containerElement, relatedTarget);\n}\nexport function disableFocusInside(container) {\n const tabbableElements = tabbable(container);\n tabbableElements.forEach(element => {\n element.dataset.tabindex = element.getAttribute('tabindex') || '';\n element.setAttribute('tabindex', '-1');\n });\n}\nexport function enableFocusInside(container) {\n const elements = [];\n appendMatchingElements(container, '[data-tabindex]', elements);\n elements.forEach(element => {\n const tabindex = element.dataset.tabindex;\n delete element.dataset.tabindex;\n if (tabindex) {\n element.setAttribute('tabindex', tabindex);\n } else {\n element.removeAttribute('tabindex');\n }\n });\n}","/* eslint-disable @typescript-eslint/no-loop-func */\n\nexport function getNodeChildren(nodes, id, onlyOpenChildren = true) {\n const directChildren = nodes.filter(node => node.parentId === id);\n return directChildren.flatMap(child => [...(!onlyOpenChildren || child.context?.open ? [child] : []), ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);\n}\nexport function getDeepestNode(nodes, id) {\n let deepestNodeId;\n let maxDepth = -1;\n function findDeepest(nodeId, depth) {\n if (depth > maxDepth) {\n deepestNodeId = nodeId;\n maxDepth = depth;\n }\n const children = getNodeChildren(nodes, nodeId);\n children.forEach(child => {\n findDeepest(child.id, depth + 1);\n });\n }\n findDeepest(id, 0);\n return nodes.find(node => node.id === deepestNodeId);\n}\nexport function getNodeAncestors(nodes, id) {\n let allAncestors = [];\n let currentParentId = nodes.find(node => node.id === id)?.parentId;\n while (currentParentId) {\n const currentNode = nodes.find(node => node.id === currentParentId);\n currentParentId = currentNode?.parentId;\n if (currentNode) {\n allAncestors = allAncestors.concat(currentNode);\n }\n }\n return allAncestors;\n}","export function createAttribute(name) {\n return `data-base-ui-${name}`;\n}","import { NOOP } from '@base-ui/utils/empty';\nlet rafId = 0;\nexport function enqueueFocus(el, options = {}) {\n const {\n preventScroll = false,\n sync = false,\n shouldFocus\n } = options;\n cancelAnimationFrame(rafId);\n function exec() {\n if (shouldFocus && !shouldFocus()) {\n return;\n }\n el?.focus({\n preventScroll\n });\n }\n if (sync) {\n exec();\n return NOOP;\n }\n const currentRafId = requestAnimationFrame(exec);\n rafId = currentRafId;\n return () => {\n if (rafId === currentRafId) {\n cancelAnimationFrame(currentRafId);\n rafId = 0;\n }\n };\n}","// Modified to add conditional `aria-hidden` support:\n// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts\nimport { getNodeName, isShadowRoot } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nconst counters = {\n inert: new WeakMap(),\n 'aria-hidden': new WeakMap()\n};\nconst markerName = 'data-base-ui-inert';\nconst uncontrolledElementsSets = {\n inert: new WeakSet(),\n 'aria-hidden': new WeakSet()\n};\nlet markerCounterMap = new WeakMap();\nlet lockCount = 0;\nfunction getUncontrolledElementsSet(controlAttribute) {\n return uncontrolledElementsSets[controlAttribute];\n}\nfunction unwrapHost(node) {\n if (!node) {\n return null;\n }\n return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);\n}\nconst correctElements = (parent, targets) => targets.map(target => {\n if (parent.contains(target)) {\n return target;\n }\n const correctedTarget = unwrapHost(target);\n if (parent.contains(correctedTarget)) {\n return correctedTarget;\n }\n return null;\n}).filter(x => x != null);\nconst buildKeepSet = targets => {\n const keep = new Set();\n targets.forEach(target => {\n let node = target;\n while (node && !keep.has(node)) {\n keep.add(node);\n node = node.parentNode;\n }\n });\n return keep;\n};\nconst collectOutsideElements = (root, keepElements, stopElements) => {\n const outside = [];\n const walk = parent => {\n if (!parent || stopElements.has(parent)) {\n return;\n }\n Array.from(parent.children).forEach(node => {\n if (getNodeName(node) === 'script') {\n return;\n }\n if (keepElements.has(node)) {\n walk(node);\n } else {\n outside.push(node);\n }\n });\n };\n walk(root);\n return outside;\n};\nfunction applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, {\n mark = true\n}) {\n let controlAttribute = null;\n if (inert) {\n controlAttribute = 'inert';\n } else if (ariaHidden) {\n controlAttribute = 'aria-hidden';\n }\n let counterMap = null;\n let uncontrolledElementsSet = null;\n const avoidElements = correctElements(body, uncorrectedAvoidElements);\n const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];\n const hiddenElements = [];\n const markedElements = [];\n if (controlAttribute) {\n const map = counters[controlAttribute];\n const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);\n uncontrolledElementsSet = currentUncontrolledElementsSet;\n counterMap = map;\n const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));\n const controlElements = avoidElements.concat(ariaLiveElements);\n const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));\n controlTargets.forEach(node => {\n const attr = node.getAttribute(controlAttribute);\n const alreadyHidden = attr !== null && attr !== 'false';\n const counterValue = (map.get(node) || 0) + 1;\n map.set(node, counterValue);\n hiddenElements.push(node);\n if (counterValue === 1 && alreadyHidden) {\n currentUncontrolledElementsSet.add(node);\n }\n if (!alreadyHidden) {\n node.setAttribute(controlAttribute, controlAttribute === 'inert' ? '' : 'true');\n }\n });\n }\n if (mark) {\n markerTargets.forEach(node => {\n const markerValue = (markerCounterMap.get(node) || 0) + 1;\n markerCounterMap.set(node, markerValue);\n markedElements.push(node);\n if (markerValue === 1) {\n node.setAttribute(markerName, '');\n }\n });\n }\n lockCount += 1;\n return () => {\n if (counterMap) {\n hiddenElements.forEach(element => {\n const currentCounterValue = counterMap.get(element) || 0;\n const counterValue = currentCounterValue - 1;\n counterMap.set(element, counterValue);\n if (!counterValue) {\n if (!uncontrolledElementsSet?.has(element) && controlAttribute) {\n element.removeAttribute(controlAttribute);\n }\n uncontrolledElementsSet?.delete(element);\n }\n });\n }\n if (mark) {\n markedElements.forEach(element => {\n const markerValue = (markerCounterMap.get(element) || 0) - 1;\n markerCounterMap.set(element, markerValue);\n if (!markerValue) {\n element.removeAttribute(markerName);\n }\n });\n }\n lockCount -= 1;\n if (!lockCount) {\n counters.inert = new WeakMap();\n counters['aria-hidden'] = new WeakMap();\n uncontrolledElementsSets.inert = new WeakSet();\n uncontrolledElementsSets['aria-hidden'] = new WeakSet();\n markerCounterMap = new WeakMap();\n }\n };\n}\nexport function markOthers(avoidElements, options = {}) {\n const {\n ariaHidden = false,\n inert = false,\n mark = true\n } = options;\n const body = ownerDocument(avoidElements[0]).body;\n return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, {\n mark\n });\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { isNode } from '@floating-ui/utils/dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { enableFocusInside, disableFocusInside, getPreviousTabbable, getNextTabbable, isOutsideEvent } from \"../utils/tabbable.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { ownerVisuallyHidden } from \"../../internals/constants.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst PortalContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") PortalContext.displayName = \"PortalContext\";\nexport const usePortalContext = () => React.useContext(PortalContext);\nconst attr = createAttribute('portal');\nexport function useFloatingPortalNode(props = {}) {\n const {\n ref,\n container: containerProp,\n componentProps = EMPTY_OBJECT,\n elementProps\n } = props;\n const uniqueId = useId();\n const portalContext = usePortalContext();\n const parentPortalNode = portalContext?.portalNode;\n const [containerElement, setContainerElement] = React.useState(null);\n const [portalNode, setPortalNode] = React.useState(null);\n const setPortalNodeRef = useStableCallback(node => {\n if (node !== null) {\n // the useIsoLayoutEffect below watching containerProp / parentPortalNode\n // sets setPortalNode(null) when the container becomes null or changes.\n // So even though the ref callback now ignores null, the portal node still gets cleared.\n setPortalNode(node);\n }\n });\n const containerRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n // Wait for the container to be resolved if explicitly `null`.\n if (containerProp === null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;\n if (resolvedContainer == null) {\n if (containerRef.current) {\n containerRef.current = null;\n setPortalNode(null);\n setContainerElement(null);\n }\n return;\n }\n if (containerRef.current !== resolvedContainer) {\n containerRef.current = resolvedContainer;\n setPortalNode(null);\n setContainerElement(resolvedContainer);\n }\n }, [containerProp, parentPortalNode]);\n const portalElement = useRenderElement('div', componentProps, {\n ref: [ref, setPortalNodeRef],\n props: [{\n id: uniqueId,\n [attr]: ''\n }, elementProps]\n });\n\n // This `createPortal` call injects `portalElement` into the `container`.\n // Another call inside `FloatingPortal`/`FloatingPortalLite` then injects the children into `portalElement`.\n const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ReactDOM.createPortal(portalElement, containerElement) : null;\n return {\n node: portalNode,\n // `id` and `render` props can override or remove the generated ID. Use the exact\n // rendered value so `aria-owns` never points at an ID absent from the DOM.\n nodeId: /*#__PURE__*/React.isValidElement(portalElement) ? portalElement.props.id : undefined,\n subtree: portalSubtree\n };\n}\n\n/**\n * Portals the floating element into a given container element — by default,\n * outside of the app root and into the body.\n * This is necessary to ensure the floating element can appear outside any\n * potential parent containers that cause clipping (such as `overflow: hidden`),\n * while retaining its location in the React tree.\n * @see https://floating-ui.com/docs/FloatingPortal\n * @internal\n */\nexport const FloatingPortal = /*#__PURE__*/React.forwardRef(function FloatingPortal(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n container,\n portalOwnerRole,\n ...elementProps\n } = componentProps;\n const {\n node: portalNode,\n nodeId: portalNodeId,\n subtree: portalSubtree\n } = useFloatingPortalNode({\n container,\n ref: forwardedRef,\n componentProps,\n elementProps\n });\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const [focusManagerState, setFocusManagerState] = React.useState(null);\n const focusInsideDisabledRef = React.useRef(false);\n const modal = focusManagerState?.modal;\n const open = focusManagerState?.open;\n const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!portalNode || modal) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (portalNode && event.relatedTarget && isOutsideEvent(event)) {\n if (event.type === 'focusin') {\n if (focusInsideDisabledRef.current) {\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }\n } else {\n disableFocusInside(portalNode);\n focusInsideDisabledRef.current = true;\n }\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(portalNode, 'focusin', onFocus, true), addEventListener(portalNode, 'focusout', onFocus, true));\n }, [portalNode, modal]);\n useIsoLayoutEffect(() => {\n if (!portalNode || open !== true || !focusInsideDisabledRef.current) {\n return;\n }\n\n // Restore tabbability before the focus manager's queued focus-on-open step runs.\n enableFocusInside(portalNode);\n focusInsideDisabledRef.current = false;\n }, [open, portalNode]);\n const portalContextValue = React.useMemo(() => ({\n beforeOutsideRef,\n afterOutsideRef,\n beforeInsideRef,\n afterInsideRef,\n portalNode,\n setFocusManagerState\n }), [portalNode]);\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [portalSubtree, /*#__PURE__*/_jsxs(PortalContext.Provider, {\n value: portalContextValue,\n children: [shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: beforeOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n beforeInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const prevTabbable = getPreviousTabbable(domReference);\n prevTabbable?.focus();\n }\n }\n }), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(\"span\", {\n role: portalOwnerRole,\n \"aria-owns\": portalNodeId,\n style: ownerVisuallyHidden\n }), portalNode && /*#__PURE__*/ReactDOM.createPortal(children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/_jsx(FocusGuard, {\n \"data-type\": \"outside\",\n ref: afterOutsideRef,\n onFocus: event => {\n if (isOutsideEvent(event, portalNode)) {\n afterInsideRef.current?.focus();\n } else {\n const domReference = focusManagerState ? focusManagerState.domReference : null;\n const nextTabbable = getNextTabbable(domReference);\n nextTabbable?.focus();\n if (focusManagerState?.closeOnFocusOut) {\n focusManagerState?.onOpenChange(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") FloatingPortal.displayName = \"FloatingPortal\";","'use client';\n\nimport * as React from 'react';\nimport { SafeReact } from \"./safeReact.mjs\";\nlet globalId = 0;\n\n// TODO React 17: Remove `useGlobalId` once React 17 support is removed\nfunction useGlobalId(idOverride, prefix = 'mui') {\n const [defaultId, setDefaultId] = React.useState(idOverride);\n const id = idOverride || defaultId;\n React.useEffect(() => {\n if (defaultId == null) {\n // Fallback to this default id when possible.\n // Use the incrementing value for client-side rendering only.\n // We can't use it server-side.\n // If you want to use random values please consider the Birthday Problem: https://en.wikipedia.org/wiki/Birthday_problem\n globalId += 1;\n setDefaultId(`${prefix}-${globalId}`);\n }\n }, [defaultId, prefix]);\n return id;\n}\nconst maybeReactUseId = SafeReact.useId;\n\n/**\n *\n * @example <div id={useId()} />\n * @param idOverride\n * @returns {string}\n */\nexport function useId(idOverride, prefix) {\n // React.useId() is only available from React 17.0.0.\n if (maybeReactUseId !== undefined) {\n const reactId = maybeReactUseId();\n return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);\n }\n\n // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.\n return useGlobalId(idOverride, prefix);\n}","export const TYPEAHEAD_RESET_MS = 500;\nexport const PATIENT_CLICK_THRESHOLD = 500;\nexport const DISABLED_TRANSITIONS_STYLE = {\n style: {\n transition: 'none'\n }\n};\nexport const CLICK_TRIGGER_IDENTIFIER = 'data-base-ui-click-trigger';\nexport const BASE_UI_SWIPE_IGNORE_ATTRIBUTE = 'data-base-ui-swipe-ignore';\nexport const LEGACY_SWIPE_IGNORE_ATTRIBUTE = 'data-swipe-ignore';\nexport const BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`;\nexport const LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`;\n\n/**\n * Used for dropdowns that usually strictly prefer top/bottom placements and\n * use `var(--available-height)` to limit their height.\n */\nexport const DROPDOWN_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'none'\n};\n\n/**\n * Used by regular popups that usually aren't scrollable and are allowed to\n * freely flip to any axis of placement.\n */\nexport const POPUP_COLLISION_AVOIDANCE = {\n fallbackAxisSide: 'end'\n};\n\n/**\n * Special visually hidden styles for the aria-owns owner element to ensure owned element\n * accessibility in iOS/Safari/VoiceControl.\n * The owner element is an empty span, so most of the common visually hidden styles are not needed.\n * @see https://github.com/floating-ui/floating-ui/issues/3403\n */\nexport const ownerVisuallyHidden = {\n clipPath: 'inset(50%)',\n position: 'fixed',\n top: 0,\n left: 0\n};","'use client';\n\nimport * as React from 'react';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FloatingTreeStore } from \"./FloatingTreeStore.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst FloatingNodeContext = /*#__PURE__*/React.createContext(null);\nif (process.env.NODE_ENV !== \"production\") FloatingNodeContext.displayName = \"FloatingNodeContext\";\nconst FloatingTreeContext = /*#__PURE__*/React.createContext(null);\n\n/**\n * Returns the parent node id for nested floating elements, if available.\n * Returns `null` for top-level floating elements.\n */\nif (process.env.NODE_ENV !== \"production\") FloatingTreeContext.displayName = \"FloatingTreeContext\";\nexport const useFloatingParentNodeId = () => React.useContext(FloatingNodeContext)?.id || null;\n\n/**\n * Returns the nearest floating tree context, if available.\n */\nexport const useFloatingTree = externalTree => {\n const contextTree = React.useContext(FloatingTreeContext);\n return externalTree ?? contextTree;\n};\n\n/**\n * Registers a node into the `FloatingTree`, returning its id.\n * @see https://floating-ui.com/docs/FloatingTree\n */\nexport function useFloatingNodeId(externalTree) {\n const id = useId();\n const tree = useFloatingTree(externalTree);\n const parentId = useFloatingParentNodeId();\n useIsoLayoutEffect(() => {\n if (!id) {\n return undefined;\n }\n const node = {\n id,\n parentId\n };\n tree?.addNode(node);\n return () => {\n tree?.removeNode(node);\n };\n }, [tree, id, parentId]);\n return id;\n}\n/**\n * Provides parent node context for nested floating elements.\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingNode(props) {\n const {\n children,\n id\n } = props;\n const parentId = useFloatingParentNodeId();\n return /*#__PURE__*/_jsx(FloatingNodeContext.Provider, {\n value: React.useMemo(() => ({\n id,\n parentId\n }), [id, parentId]),\n children: children\n });\n}\n/**\n * Provides context for nested floating elements when they are not children of\n * each other on the DOM.\n * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for:\n * - The `bubbles` option in the `useDismiss()` Hook\n * - Nested virtual list navigation\n * - Nested floating elements that each open on hover\n * - Custom communication between parent and child floating elements\n * @see https://floating-ui.com/docs/FloatingTree\n * @internal\n */\nexport function FloatingTree(props) {\n const {\n children,\n externalTree\n } = props;\n const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current;\n return /*#__PURE__*/_jsx(FloatingTreeContext.Provider, {\n value: tree,\n children: children\n });\n}","export function createEventEmitter() {\n const map = new Map();\n return {\n emit(event, data) {\n map.get(event)?.forEach(listener => listener(data));\n },\n on(event, listener) {\n if (!map.has(event)) {\n map.set(event, new Set());\n }\n map.get(event).add(listener);\n },\n off(event, listener) {\n map.get(event)?.delete(listener);\n }\n };\n}","import { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\n\n/**\n * Stores and manages floating elements in a tree structure.\n * This is a backing store for the `FloatingTree` component.\n */\nexport class FloatingTreeStore {\n nodesRef = {\n current: []\n };\n events = createEventEmitter();\n addNode(node) {\n this.nodesRef.current.push(node);\n }\n removeNode(node) {\n const index = this.nodesRef.current.findIndex(n => n === node);\n if (index !== -1) {\n this.nodesRef.current.splice(index, 1);\n }\n }\n}","/**\n * If the provided argument is a ref object, returns its `current` value.\n * Otherwise, returns the argument itself.\n */\nexport function resolveRef(maybeRef) {\n if (maybeRef == null) {\n return maybeRef;\n }\n return 'current' in maybeRef ? maybeRef.current : maybeRef;\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { getTarget, isTypeableElement } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType, isVirtualPointerEvent } from \"../utils/event.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nexport function useClick(context, props = {}) {\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n stickIfOpen = true,\n touchOpenDelay = 0,\n reason = REASONS.triggerPress\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const dataRef = store.context.dataRef;\n const pointerTypeRef = React.useRef(undefined);\n const frame = useAnimationFrame();\n const touchOpenTimeout = useTimeout();\n const reference = React.useMemo(() => {\n function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) {\n const details = createChangeEventDetails(reason, nativeEvent, target);\n if (nextOpen && pointerType === 'touch' && touchOpenDelay > 0) {\n touchOpenTimeout.start(touchOpenDelay, () => {\n store.setOpen(true, details);\n });\n } else {\n store.setOpen(nextOpen, details);\n }\n }\n function getNextOpen(open, currentTarget, isClickLikeOpenEvent) {\n const openEvent = dataRef.current.openEvent;\n const hasClickedOnInactiveTrigger = store.select('domReferenceElement') !== currentTarget;\n if (open && hasClickedOnInactiveTrigger) {\n // Moving between triggers should always open the newly active one.\n return true;\n }\n if (!open) {\n // A closed popup should open on the next press.\n return true;\n }\n if (!toggle) {\n // Non-toggle mode never closes on a repeated trigger press.\n return true;\n }\n if (openEvent && stickIfOpen) {\n // Preserve hover/focus-opened popups until the matching click-like event closes them.\n return !isClickLikeOpenEvent(openEvent.type);\n }\n\n // Otherwise, a repeated click toggles the popup closed.\n return false;\n }\n return {\n onPointerDown(event) {\n // Screen reader activations (Android TalkBack, desktop screen readers) report a\n // mouse-like `pointerType`, but `ignoreMouse` must not drop them: hover logic cannot\n // open for a virtual press since there is no real pointer movement to wait for.\n // Virtual `touch` presses (iOS VoiceOver) keep their type so `touchOpenDelay` applies.\n pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? 'virtual' : event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n const nativeEvent = event.nativeEvent;\n const open = store.select('open');\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0 || eventOption === 'click' || isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown');\n\n // Animations sometimes won't run on a typeable element if using a rAF.\n // Focus is always set on these elements. For touch, we may delay opening.\n const target = getTarget(nativeEvent);\n if (isTypeableElement(target)) {\n setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType);\n return;\n }\n\n // Capture the currentTarget before the rAF.\n // as React sets it to null after the event handler completes.\n const eventCurrentTarget = event.currentTarget;\n\n // Wait until focus is set on the element. This is an alternative to\n // `event.preventDefault()` to avoid :focus-visible from appearing when using a pointer.\n frame.request(() => {\n setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType);\n });\n },\n onClick(event) {\n if (eventOption === 'mousedown-only') {\n return;\n }\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerType) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) {\n return;\n }\n const open = store.select('open');\n const nextOpen = getNextOpen(open, event.currentTarget, openEventType => openEventType === 'click' || openEventType === 'mousedown' || openEventType === 'keydown' || openEventType === 'keyup');\n setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType);\n },\n onKeyDown() {\n pointerTypeRef.current = undefined;\n }\n };\n }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]);\n return React.useMemo(() => enabled ? {\n reference\n } : EMPTY_OBJECT, [enabled, reference]);\n}","'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent, isVirtualClick } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n // A click whose press began before the floating element opened is the tail of that\n // gesture (e.g. the drag-release that opened it), not a new outside press.\n const sawPressWhileOpenRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n\n // A same-batch close+reopen never renders `open === false`, so only `openchange` can\n // observe that session boundary. The effect below covers controlled flips.\n React.useEffect(() => {\n function handleOpenChange(details) {\n // Only the closing half ends the session: `setOpen(true)` on an already-open\n // element (hovering an inactive trigger) must not drop a press mid-gesture.\n if (!details.open) {\n sawPressWhileOpenRef.current = false;\n }\n }\n events.on('openchange', handleOpenChange);\n return () => {\n events.off('openchange', handleOpenChange);\n };\n }, [events]);\n React.useEffect(() => {\n if (!open || !enabled) {\n // Reset in the effect body, not the cleanup, which also runs when a dependency\n // changes mid-gesture.\n if (!open) {\n sawPressWhileOpenRef.current = false;\n }\n return clearInsideReactTree;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n const doc = ownerDocument(floatingElement);\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // Only `click` events reach this point in intentional mode.\n if (getOutsidePressEvent() === 'intentional') {\n // Press-less clicks (keyboard, assistive technology, `element.click()`) report no\n // click count; `isVirtualClick` also catches the ones that do.\n if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) {\n return;\n }\n\n // A press that starts inside and ends outside gets one suppressed\n // outside click. Run this after inside-target checks so inside clicks\n // don't consume the one-shot suppression.\n if (suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n\n // Only `pointerdown` marks a press; `mousedown` is its compatibility event, and\n // counting it would misattribute a gesture that started before open.\n if (event.type === 'pointerdown') {\n // Only a primary press can produce a `click`.\n if (event.button === 0) {\n sawPressWhileOpenRef.current = true;\n }\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n // A cancelled gesture produces no click. Not cleared on `pointerup`: the click\n // fires after it and must still find the press.\n if (event.type === 'pointercancel') {\n sawPressWhileOpenRef.current = false;\n }\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchmove', handleTouchMoveCapture, {\n capture: true,\n passive: true\n }), addEventListener(doc, 'touchend', handleTouchEndCapture, {\n capture: true,\n passive: true\n })));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n clearInsideReactTree();\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useFloating as usePosition } from '@floating-ui/react-dom';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { useFloatingRootContext } from \"./useFloatingRootContext.mjs\";\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nexport function useFloating(options = {}) {\n const internalStore = useFloatingRootContext(options);\n const store = options.rootContext || internalStore;\n return useFloatingWithStore(options, store);\n}\n\n/**\n * Base UI's private `useFloating` path. The caller must supply the root store, so this skips the\n * internal root-context hook used by the public Floating UI-compatible API.\n */\nexport function useBaseUIFloating(options) {\n return useFloatingWithStore(options, options.rootContext);\n}\nfunction useFloatingWithStore(options, store) {\n const {\n nodeId,\n externalTree\n } = options;\n const referenceElement = store.useState('referenceElement');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const open = store.useState('open');\n const floatingId = store.useState('floatingId');\n const [positionReference, setPositionReferenceRaw] = React.useState(null);\n const [localDomReference, setLocalDomReference] = React.useState(undefined);\n const [localFloatingElement, setLocalFloatingElement] = React.useState(undefined);\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree(externalTree);\n const storeElements = React.useMemo(() => ({\n reference: referenceElement,\n floating: floatingElement,\n domReference: domReferenceElement\n }), [referenceElement, floatingElement, domReferenceElement]);\n const position = usePosition({\n ...options,\n elements: {\n ...storeElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null;\n const syncedFloatingElement = localFloatingElement === undefined ? store.state.floatingElement : localFloatingElement;\n store.useSyncedValue('referenceElement', localDomReference ?? null);\n store.useSyncedValue('domReferenceElement', localDomReference === undefined ? domReferenceElement : localDomReferenceElement);\n store.useSyncedValue('floatingElement', syncedFloatingElement);\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n getClientRects: () => node.getClientRects(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n setPositionReferenceRaw(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setLocalDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs, setLocalDomReference]);\n const setFloating = React.useCallback(node => {\n setLocalFloatingElement(node);\n position.refs.setFloating(node);\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setFloating,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setFloating, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReferenceElement\n }), [position.elements, domReferenceElement]);\n const context = React.useMemo(() => ({\n ...position,\n dataRef: store.context.dataRef,\n open,\n onOpenChange: store.setOpen,\n events: store.context.events,\n floatingId,\n refs,\n elements,\n nodeId,\n rootStore: store\n }), [position, refs, elements, nodeId, store, open, floatingId]);\n useIsoLayoutEffect(() => {\n if (domReferenceElement) {\n domReferenceRef.current = domReferenceElement;\n }\n }, [domReferenceElement]);\n useIsoLayoutEffect(() => {\n store.context.dataRef.current.floatingContext = context;\n const node = tree?.nodesRef.current.find(n => n.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements,\n rootStore: store\n }), [position, refs, elements, context, store]);\n}","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n const alignment = getAlignment(placement);\n if (alignment) {\n coords[alignmentAxis] += commonAlign * (alignment === 'end' ? 1 : -1) * (rtl && isVertical ? -1 : 1);\n }\n return coords;\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) && (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n// Maximum number of resets that can occur before bailing to avoid infinite reset loops.\nconst MAX_RESET_COUNT = 50;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const platformWithDetectOverflow = platform.detectOverflow ? platform : {\n ...platform,\n detectOverflow\n };\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let resetCount = 0;\n const middlewareData = {};\n for (let i = 0; i < middleware.length; i++) {\n const currentMiddleware = middleware[i];\n if (!currentMiddleware) {\n continue;\n }\n const {\n name,\n fn\n } = currentMiddleware;\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform: platformWithDetectOverflow,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData[name] = {\n ...middlewareData[name],\n ...data\n };\n if (reset && resetCount < MAX_RESET_COUNT) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(minPadding, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;\n if (!ignoreCrossAxisOverflow ||\n // We leave the current main axis only if every placement on that axis\n // overflows the main axis.\n overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects,\n platform\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await platform.detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n\n // No rects (e.g. a hidden or detached reference, or a collapsed range) —\n // keep the existing reference rect rather than resetting to an invalid\n // one with non-finite values.\n if (!nativeClientRects.length) {\n return {};\n }\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && (clientRects[0].left > clientRects[1].right || clientRects[1].left > clientRects[0].right) && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n return rectToClientRect({\n x: left,\n y: top,\n width: right - left,\n height: bottom - top\n });\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n return rectToClientRect({\n x: minLeft,\n y: top,\n width: maxRight - minLeft,\n height: bottom - top\n });\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\nconst originSides = /*#__PURE__*/new Set(['left', 'top']);\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = originSides.has(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n platform\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const clampCoord = (axis, coord) => clamp(coord + overflow[axis === 'y' ? 'top' : 'left'], coord, coord - overflow[axis === 'y' ? 'bottom' : 'right']);\n if (checkMainAxis) {\n mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);\n }\n if (checkCrossAxis) {\n crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n var _rawOffset$mainAxis, _rawOffset$crossAxis;\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,\n crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = originSides.has(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n// Method syntax keeps callback parameters bivariant, but expressing the\n// explicit `| undefined` required by `exactOptionalPropertyTypes` needs\n// property syntax, which is contravariant under `strictFunctionTypes`.\n// Extracting the function from a method position restores that bivariance so\n// consumers can still assign callbacks with narrower parameter types.\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await platform.detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const shiftData = state.middlewareData.shift;\n const noShift = !shiftData;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if (shiftData != null && shiftData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if (shiftData != null && shiftData.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n if (isYAxis) {\n availableWidth = width - 2 * max(overflow.left, overflow.right);\n } else {\n availableHeight = height - 2 * max(overflow.top, overflow.bottom);\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","import { rectToClientRect, arrow as arrow$1, autoPlacement as autoPlacement$1, detectOverflow as detectOverflow$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle as getComputedStyle$1, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle$1(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement && offsetParent) {\n const win = getWindow(domElement);\n const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle$1(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If <html> has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll) {\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return element.getClientRects ? Array.from(element.getClientRects()) : [];\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `<html>` and `<body>` rect bounds if horizontally scrollable.\nfunction getDocumentRect(html) {\n const scroll = getNodeScroll(html);\n const body = html.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(html);\n const y = -scroll.scrollTop;\n if (getComputedStyle$1(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Safety check: ensure the scrollbar space is reasonable in case this\n// calculation is affected by unusual styles.\n// Most scrollbars leave 15-18px of space.\nconst SCROLLBAR_MAX = 25;\nfunction getViewportRect(element, strategy, rootBoundary) {\n if (rootBoundary === void 0) {\n rootBoundary = 'viewport';\n }\n const isLayoutViewport = rootBoundary === 'layoutViewport';\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n // Client coordinates are relative to the layout viewport, except in\n // WebKit with an `absolute` strategy, where they are relative to the\n // visual viewport.\n const layoutRelativeClientCoords = !isWebKit() || strategy === 'fixed';\n if (isLayoutViewport) {\n if (!layoutRelativeClientCoords) {\n x = -visualViewport.offsetLeft;\n y = -visualViewport.offsetTop;\n }\n } else {\n width = visualViewport.width;\n height = visualViewport.height;\n if (layoutRelativeClientCoords) {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n }\n const windowScrollbarX = getWindowScrollBarX(html);\n // `scrollbar-gutter: stable` on the <html> reserves gutter space that shrinks\n // the visual width but isn't reflected in `html.clientWidth`, so subtract it.\n // Only the inline-end (right) gutter can hold the scrollbar; `both-edges` also\n // reserves an empty inline-start gutter that clips nothing, so exclude just\n // the one scrollbar-side gutter — halve the measured (two-gutter) total. A\n // left-side scrollbar (`windowScrollbarX > 0`) is already handled by\n // `getHTMLOffset`/`visualViewport.width`; skip it here.\n if (windowScrollbarX <= 0) {\n const doc = html.ownerDocument;\n const body = doc.body;\n const bodyStyles = getComputedStyle(body);\n const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;\n const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);\n const gutter = getComputedStyle(html).scrollbarGutter === 'stable both-edges' ? reservedWidth / 2 : reservedWidth;\n if (gutter <= SCROLLBAR_MAX) {\n width -= gutter;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = getScale(element);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport' || clippingAncestor === 'layoutViewport') {\n rect = getViewportRect(element, strategy, clippingAncestor);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let lastKeptComputedStyle = null;\n const elementIsFixed = getComputedStyle$1(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle$1(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n // Position of the containing block chain below the current node. A fixed\n // element whose containing block hasn't been found yet is a fixed chain.\n const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? 'fixed' : '';\n\n // A non-containing ancestor does not clip the element when the chain\n // below it escapes it: a fixed chain escapes all ancestors up to the\n // next containing block, an absolute chain escapes static ancestors.\n const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === 'fixed' || lastPosition === 'absolute' && computedStyle.position === 'static');\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // The kept node carries the chain position for the next iteration.\n lastKeptComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);\n let top = firstRect.top;\n let right = firstRect.right;\n let bottom = firstRect.bottom;\n let left = firstRect.left;\n for (let i = 1; i < clippingAncestors.length; i++) {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);\n top = max(rect.top, top);\n right = min(rect.right, right);\n bottom = min(rect.bottom, bottom);\n left = max(rect.left, left);\n }\n return {\n width: right - left,\n height: bottom - top,\n x: left,\n y: top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n\n // If the <body> scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n if (!isOffsetParentAnElement && documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle$1(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the <html> element as the offsetParent if it's non-static,\n // while Chrome and Safari return the <body> element. The <body> element must\n // be used to perform the correct calculations even if the <html> element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle$1(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\nfunction rectsAreEqual(a, b) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove, ancestorResize) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const elementRectForRootMargin = element.getBoundingClientRect();\n const {\n left,\n top,\n width,\n height\n } = elementRectForRootMargin;\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n\n // The entry is a snapshot, so the reference may have moved since the\n // intersection was computed (under performance constraints, or between\n // consecutive frames of a multi-frame layout shift). The reported ratio\n // and the observed area are stale in that case and cannot be trusted to\n // detect subsequent movement, so refresh regardless of the ratio.\n if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {\n return refresh();\n }\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped in place, the ratio is 0. Throttle\n // the refresh to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle <iframe>s\n root: root.ownerDocument\n });\n } catch (_e) {\n io = new IntersectionObserver(handleObserve, options);\n }\n io.observe(element);\n }\n const win = getWindow(element);\n // The window is a resize ancestor, so when `ancestorResize` is enabled its\n // listener already runs the update on resize. Here we only need to rebuild\n // the `IntersectionObserver` for the new root size, skipping a redundant\n // update. When `ancestorResize` is disabled, this becomes the sole update.\n const handleResize = () => refresh(ancestorResize);\n win.addEventListener('resize', handleResize);\n refresh(true);\n return () => {\n win.removeEventListener('resize', handleResize);\n cleanup();\n };\n}\n\n/**\n * Automatically updates the position of the floating element when necessary.\n * Should only be called when the floating element is mounted on the DOM or\n * visible on the screen.\n * @returns cleanup function that should be invoked when the floating element is\n * removed from the DOM or hidden from the screen.\n * @see https://floating-ui.com/docs/autoUpdate\n */\nfunction autoUpdate(reference, floating, update, options) {\n if (options === void 0) {\n options = {};\n }\n const {\n ancestorScroll = true,\n ancestorResize = true,\n elementResize = typeof ResizeObserver === 'function',\n layoutShift = typeof IntersectionObserver === 'function',\n animationFrame = false\n } = options;\n const referenceEl = unwrapElement(reference);\n const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.addEventListener('scroll', update);\n ancestorResize && ancestor.addEventListener('resize', update);\n });\n const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;\n let reobserveFrame = -1;\n let resizeObserver = null;\n if (elementResize) {\n resizeObserver = new ResizeObserver(_ref => {\n let [firstEntry] = _ref;\n if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {\n // Prevent update loops when using the `size` middleware.\n // https://github.com/floating-ui/floating-ui/issues/1740\n resizeObserver.unobserve(floating);\n cancelAnimationFrame(reobserveFrame);\n reobserveFrame = requestAnimationFrame(() => {\n var _resizeObserver;\n (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);\n });\n }\n update();\n });\n if (referenceEl && !animationFrame) {\n resizeObserver.observe(referenceEl);\n }\n if (floating) {\n resizeObserver.observe(floating);\n }\n }\n let frameId;\n let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;\n if (animationFrame) {\n frameLoop();\n }\n function frameLoop() {\n const nextRefRect = getBoundingClientRect(reference);\n if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {\n update();\n }\n prevRefRect = nextRefRect;\n frameId = requestAnimationFrame(frameLoop);\n }\n update();\n return () => {\n var _resizeObserver2;\n ancestors.forEach(ancestor => {\n ancestorScroll && ancestor.removeEventListener('scroll', update);\n ancestorResize && ancestor.removeEventListener('resize', update);\n });\n cleanupIo == null || cleanupIo();\n (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();\n resizeObserver = null;\n if (animationFrame) {\n cancelAnimationFrame(frameId);\n }\n };\n}\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nconst detectOverflow = detectOverflow$1;\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = offset$1;\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = autoPlacement$1;\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = shift$1;\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = flip$1;\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = size$1;\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = hide$1;\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = arrow$1;\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = inline$1;\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = limitShift$1;\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n */\nconst computePosition = (reference, floating, options) => {\n // This caches the expensive `getClippingElementAncestors` function so that\n // multiple lifecycle resets re-use the same result. It only lives for a\n // single call. If other functions become expensive, we can add them as well.\n const cache = new Map();\n const mergedOptions = options != null ? options : {};\n const platformWithCache = {\n ...platform,\n ...mergedOptions.platform,\n _c: cache\n };\n return computePosition$1(reference, floating, {\n ...mergedOptions,\n platform: platformWithCache\n });\n};\n\nexport { arrow, autoPlacement, autoUpdate, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, platform, shift, size };\n","import { computePosition, arrow as arrow$2, autoPlacement as autoPlacement$1, flip as flip$1, hide as hide$1, inline as inline$1, limitShift as limitShift$1, offset as offset$1, shift as shift$1, size as size$1 } from '@floating-ui/dom';\nexport { autoUpdate, computePosition, detectOverflow, getOverflowAncestors, platform } from '@floating-ui/dom';\nimport * as React from 'react';\nimport { useLayoutEffect } from 'react';\nimport * as ReactDOM from 'react-dom';\n\nvar isClient = typeof document !== 'undefined';\n\nvar noop = function noop() {};\nvar index = isClient ? useLayoutEffect : noop;\n\n// Fork of `fast-deep-equal` that only does the comparisons we need and compares\n// functions\nfunction deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (typeof a !== typeof b) {\n return false;\n }\n if (typeof a === 'function' && a.toString() === b.toString()) {\n return true;\n }\n let length;\n let i;\n let keys;\n if (a && b && typeof a === 'object') {\n if (Array.isArray(a)) {\n length = a.length;\n if (length !== b.length) return false;\n for (i = length; i-- !== 0;) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) {\n return false;\n }\n for (i = length; i-- !== 0;) {\n if (!{}.hasOwnProperty.call(b, keys[i])) {\n return false;\n }\n }\n for (i = length; i-- !== 0;) {\n const key = keys[i];\n if (key === '_owner' && a.$$typeof) {\n continue;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return a !== a && b !== b;\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\nfunction useLatestRef(value) {\n const ref = React.useRef(value);\n index(() => {\n ref.current = value;\n });\n return ref;\n}\n\n/**\n * Provides data to position a floating element.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform,\n elements: {\n reference: externalReference,\n floating: externalFloating\n } = {},\n transform = true,\n whileElementsMounted,\n open\n } = options;\n const [data, setData] = React.useState({\n x: 0,\n y: 0,\n strategy,\n placement,\n middlewareData: {},\n isPositioned: false\n });\n const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);\n if (!deepEqual(latestMiddleware, middleware)) {\n setLatestMiddleware(middleware);\n }\n const [_reference, _setReference] = React.useState(null);\n const [_floating, _setFloating] = React.useState(null);\n const setReference = React.useCallback(node => {\n if (node !== referenceRef.current) {\n referenceRef.current = node;\n _setReference(node);\n }\n }, []);\n const setFloating = React.useCallback(node => {\n if (node !== floatingRef.current) {\n floatingRef.current = node;\n _setFloating(node);\n }\n }, []);\n const referenceEl = externalReference || _reference;\n const floatingEl = externalFloating || _floating;\n const referenceRef = React.useRef(null);\n const floatingRef = React.useRef(null);\n const dataRef = React.useRef(data);\n const hasWhileElementsMounted = whileElementsMounted != null;\n const whileElementsMountedRef = useLatestRef(whileElementsMounted);\n const platformRef = useLatestRef(platform);\n const openRef = useLatestRef(open);\n const update = React.useCallback(() => {\n if (!referenceRef.current || !floatingRef.current) {\n return;\n }\n const config = {\n placement,\n strategy,\n middleware: latestMiddleware\n };\n if (platformRef.current) {\n config.platform = platformRef.current;\n }\n computePosition(referenceRef.current, floatingRef.current, config).then(data => {\n const fullData = {\n ...data,\n // The floating element's position may be recomputed while it's closed\n // but still mounted (such as when transitioning out). To ensure\n // `isPositioned` will be `false` initially on the next open, avoid\n // setting it to `true` when `open === false` (must be specified).\n isPositioned: openRef.current !== false\n };\n if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {\n dataRef.current = fullData;\n ReactDOM.flushSync(() => {\n setData(fullData);\n });\n }\n });\n }, [latestMiddleware, placement, strategy, platformRef, openRef]);\n index(() => {\n if (open === false && dataRef.current.isPositioned) {\n dataRef.current.isPositioned = false;\n setData(data => ({\n ...data,\n isPositioned: false\n }));\n }\n }, [open]);\n const isMountedRef = React.useRef(false);\n index(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n index(() => {\n if (referenceEl) referenceRef.current = referenceEl;\n if (floatingEl) floatingRef.current = floatingEl;\n if (referenceEl && floatingEl) {\n if (whileElementsMountedRef.current) {\n return whileElementsMountedRef.current(referenceEl, floatingEl, update);\n }\n update();\n }\n }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);\n const refs = React.useMemo(() => ({\n reference: referenceRef,\n floating: floatingRef,\n setReference,\n setFloating\n }), [setReference, setFloating]);\n const elements = React.useMemo(() => ({\n reference: referenceEl,\n floating: floatingEl\n }), [referenceEl, floatingEl]);\n const floatingStyles = React.useMemo(() => {\n const initialStyles = {\n position: strategy,\n left: 0,\n top: 0\n };\n if (!elements.floating) {\n return initialStyles;\n }\n const x = roundByDPR(elements.floating, data.x);\n const y = roundByDPR(elements.floating, data.y);\n if (transform) {\n return {\n ...initialStyles,\n transform: \"translate(\" + x + \"px, \" + y + \"px)\",\n ...(getDPR(elements.floating) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy,\n left: x,\n top: y\n };\n }, [strategy, transform, elements.floating, data.x, data.y]);\n return React.useMemo(() => ({\n ...data,\n update,\n refs,\n elements,\n floatingStyles\n }), [data, update, refs, elements, floatingStyles]);\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow$1 = options => {\n function isRef(value) {\n return {}.hasOwnProperty.call(value, 'current');\n }\n return {\n name: 'arrow',\n options,\n fn(state) {\n const {\n element,\n padding\n } = typeof options === 'function' ? options(state) : options;\n if (element && isRef(element)) {\n if (element.current != null) {\n return arrow$2({\n element: element.current,\n padding\n }).fn(state);\n }\n return {};\n }\n if (element) {\n return arrow$2({\n element,\n padding\n }).fn(state);\n }\n return {};\n }\n };\n};\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = (options, deps) => {\n const result = offset$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = (options, deps) => {\n const result = shift$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = (options, deps) => {\n const result = limitShift$1(options);\n return {\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = (options, deps) => {\n const result = flip$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = (options, deps) => {\n const result = size$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = (options, deps) => {\n const result = autoPlacement$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = (options, deps) => {\n const result = hide$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = (options, deps) => {\n const result = inline$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = (options, deps) => {\n const result = arrow$1(options);\n return {\n name: result.name,\n fn: result.fn,\n options: [options, deps]\n };\n};\n\nexport { arrow, autoPlacement, flip, hide, inline, limitShift, offset, shift, size, useFloating };\n","import _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * Minimal store contract exposed by popup handles to detached triggers.\n *\n * Detached triggers read `store` during render and subscribe to be notified when the handle switches\n * between its fallback store and a root's live store.\n *\n * @template HandleStore Store shape exposed to detached triggers.\n */\n\n/**\n * Store shape holding a trigger registry, required by `BasePopupHandle.openByTrigger` to resolve a\n * trigger element by id on both the attached root's store and the fallback store.\n */\n\n/**\n * Store shape required by `BasePopupHandle.openByTrigger`/`closePopup` to drive open/close state.\n * Only the root-owned `Store` needs this — the `HandleStore` view exposed to detached triggers may\n * omit `setOpen` entirely (as Dialog and PreviewCard's do) since it is never called while detached.\n */\n\n/**\n * Shared implementation for popup handles that coordinate detached triggers with a mounted root.\n *\n * Subclasses provide the component-specific imperative methods, while this base class owns the\n * fallback store, root store attachment stack, subscriber notifications, and development warning for\n * overlapping roots.\n *\n * @template HandleStore Store shape exposed to detached triggers.\n * @template Store Root-owned store attached by the component root.\n */\nexport class BasePopupHandle {\n /**\n * Stores of every root currently using this handle, in attach order. A handle is meant to be used\n * by a single mounted root, but roots can transiently overlap (e.g. during an animated route\n * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of\n * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first.\n */\n attachedStores = [];\n\n /**\n * Store of the root that currently controls the handle: the most recently attached one still\n * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`.\n */\n attachedStoreValue = null;\n\n /**\n * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer.\n */\n storeListeners = new Set();\n\n /**\n * Creates a handle backed by the store used while no root is attached.\n *\n * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached,\n * so they can render and register without a mounted root. Triggers register into whichever store\n * `store` currently resolves to, so while detached they live in this store's trigger map and\n * migrate themselves to the root's store (and back) as it attaches/detaches.\n * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces\n * `MenuHandle.open()` in warning text.\n * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is\n * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to,\n * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning.\n */\n constructor(fallbackStore, componentName, throwOnMissingTrigger = true) {\n this.fallbackStore = fallbackStore;\n this.componentName = componentName;\n this.throwOnMissingTrigger = throwOnMissingTrigger;\n }\n get attachedStore() {\n return this.attachedStoreValue;\n }\n\n /**\n * Store that detached triggers read from: the attached root's store, or an inert fallback store\n * used while no root is attached.\n * @internal\n */\n get store() {\n return this.attachedStoreValue ?? this.fallbackStore;\n }\n\n /**\n * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on\n * the handle during render because a handle can be shared by concurrent server-rendered requests.\n * @internal\n */\n get serverStore() {\n return this.fallbackStore;\n }\n\n /**\n * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind\n * when a root attaches or detaches. Returns a function that removes the listener.\n * @internal\n */\n subscribeStore(listener) {\n this.storeListeners.add(listener);\n return () => {\n this.storeListeners.delete(listener);\n };\n }\n\n /**\n * Points the handle at a root's store and notifies subscribers so detached triggers re-render and\n * re-register into it (their registration effect migrates them when the store pointer changes).\n * Returns a cleanup function that detaches the store again.\n * @internal\n */\n attachStore(newStore) {\n this.attachedStores.push(newStore);\n this.setActiveStore(newStore);\n if (process.env.NODE_ENV !== 'production') {\n if (this.attachedStores.length > 1) {\n // More than one root is attached at once. This is usually a transient overlap during an\n // animated route transition, where the outgoing root unmounts shortly after the incoming\n // one mounts. Defer the check by a frame and only warn if the overlap is still present once\n // the transition has settled (more than one root stayed mounted), so a clean handoff doesn't\n // warn regardless of the exact unmount timing.\n // The warning frame only exists in development; it is created lazily so it never appears on\n // instances in production (like `controlledValues` in `ReactStore`).\n const dev = this;\n (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => {\n if (this.attachedStores.length > 1) {\n console.warn('Base UI: A handle is attached to more than one mounted root at the same time. ' + 'The most recently mounted root takes over and the previous one stops being controlled by the handle. ' + 'A handle should be used by a single root that stays mounted for the lifetime of the handle.');\n }\n });\n }\n }\n return () => {\n const index = this.attachedStores.lastIndexOf(newStore);\n if (index !== -1) {\n this.attachedStores.splice(index, 1);\n }\n // Restore control to the most recently attached root that is still mounted (or detach fully if\n // none remain). Clearing unconditionally would leave a still-mounted older root uncontrollable\n // when a newer overlapping root detaches first (e.g. a canceled route transition).\n this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null);\n };\n }\n\n /**\n * Sets the store that currently controls the handle and notifies subscribers when it changes, so\n * detached triggers re-render and migrate their registration to the new store.\n */\n setActiveStore(store) {\n if (this.attachedStoreValue !== store) {\n this.attachedStoreValue = store;\n this.storeListeners.forEach(listener => {\n listener();\n });\n }\n }\n\n /**\n * Opens the attached root's store and associates it with the trigger with the given id, or a\n * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public\n * `open()` method, which only narrows the parameter type.\n *\n * When a trigger id is given but no matching trigger is registered, anchored popups throw (see\n * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead.\n *\n * This method should only be called in an event handler or an effect (not during rendering).\n *\n * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open\n * without associating any trigger.\n */\n openByTrigger(triggerId) {\n const attachedStore = this.attachedStore;\n if (attachedStore === null) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Base UI: ${this.componentName}Handle.open() was called while no root using this handle is mounted. ` + 'The call was ignored; mount a root with this handle before opening it imperatively.');\n }\n return;\n }\n\n // Registered triggers normally live in the active root's store. During the commit in which a\n // root attaches, a still-mounted detached trigger has not re-registered into that store yet (it\n // migrates on its next render): it is still registered wherever it lived before — the fallback\n // store when this is the first root to attach, or a previously attached root's store during a\n // transient overlap (e.g. an animated route transition). Search the whole attachment stack\n // (newest first) and the fallback map so an imperative open-by-id called in that commit (e.g.\n // from a layout effect) still resolves the trigger instead of treating it as missing.\n let triggerElement;\n if (triggerId) {\n for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) {\n triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId);\n }\n triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId);\n }\n if (triggerId && !triggerElement) {\n if (this.throwOnMissingTrigger) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? `Base UI: ${this.componentName}Handle.open() was called with the trigger id \"${triggerId}\", ` + 'but no matching trigger is registered with this handle. ' + 'An anchored popup cannot open without a trigger to anchor to. ' + `Pass the id of a mounted ${this.componentName}.Trigger that has this handle set on its \"handle\" prop.` : _formatErrorMessage(99, this.componentName, triggerId, this.componentName));\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Base UI: ${this.componentName}Handle.open: No trigger found with id \"${triggerId}\". ` + 'The popup will open, but the trigger will not be associated with it.');\n }\n }\n attachedStore.setOpen(true, createChangeEventDetails(REASONS.imperativeAction, undefined, triggerElement));\n }\n\n /**\n * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning)\n * while no root is attached. Shared by every concrete handle's public `close()` method.\n *\n * This method should only be called in an event handler or an effect (not during rendering).\n */\n closePopup() {\n const attachedStore = this.attachedStore;\n if (attachedStore === null) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. ` + 'The call was ignored.');\n }\n return;\n }\n attachedStore.setOpen(false, createChangeEventDetails(REASONS.imperativeAction));\n }\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useId } from '@base-ui/utils/useId';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { FOCUSABLE_ATTRIBUTE } from \"../../floating-ui-react/utils/constants.mjs\";\nimport { useFloatingParentNodeId } from \"../../floating-ui-react/components/FloatingTree.mjs\";\nimport { useSyncedFloatingRootContext } from \"../../floating-ui-react/hooks/useSyncedFloatingRootContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nexport const FOCUSABLE_POPUP_PROPS = {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n};\n\n/**\n * Returns the default `initialFocus` resolver for a popup. When opened by touch it focuses the\n * popup element itself to prevent the virtual keyboard from opening (required for Android\n * specifically; iOS handles this automatically). Otherwise it falls back to the default behavior.\n */\nexport function createDefaultInitialFocus(popupRef) {\n return interactionType => interactionType === 'touch' ? popupRef.current : true;\n}\n\n/**\n * The subset of a popup handle that a Root needs to bind its store to. Both the real handle classes\n * and any test double satisfy it.\n */\n\n/**\n * Creates and owns a popup store on behalf of a Root part. The store is created exactly once, with\n * controlled props and root state synced separately after creation. Sets up the synced floating\n * root context and returns the store.\n *\n * @param createStore Factory that builds the store. Called exactly once, receiving the floating id\n * and whether the popup is nested inside another floating element, both resolved on the first render.\n * @param treatPopupAsFloatingElement Whether the popup element is passed to Floating UI as the\n * floating element instead of the default positioner.\n */\nexport function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) {\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n const store = useRefWithInit(() => createStore(floatingId, nested)).current;\n useSyncedFloatingRootContext({\n popupStore: store,\n treatPopupAsFloatingElement,\n floatingRootContext: store.state.floatingRootContext,\n floatingId,\n nested,\n onOpenChange: store.setOpen\n });\n return store;\n}\n\n/**\n * Attaches a Root's store to a handle for this component's committed lifetime. Popup Roots render\n * it before their interactions and user children so its layout effect runs before descendant layout\n * effects. This lets descendants call the handle during the Root's initial commit without attaching\n * during render, which would leak suspended or abandoned stores. Store subscribers are notified by\n * `attachStore` in this ordinary layout phase, where React permits synchronous updates.\n *\n * Popup Roots must render this component only when a handle is present so handle-less Roots avoid\n * mounting an extra fiber and layout effect.\n */\nexport function PopupHandleAttachment({\n handle,\n store\n}) {\n useIsoLayoutEffect(() => {\n return handle.attachStore(store);\n }, [handle, store]);\n return null;\n}\nfunction syncTriggerCount(store) {\n const triggerCount = store.context.triggerElements.size;\n if (store.select('open') && store.state.triggerCount !== triggerCount) {\n store.set('triggerCount', triggerCount);\n }\n}\n\n/**\n * Returns a stable callback ref that registers/unregisters the trigger element in the store.\n *\n * Stable so a downstream ref merger that retains the callback it was first given still reaches the\n * trigger's current store. The registration is tracked as a `(store, id, element)` triple, so\n * unregistering targets the store the element was actually registered in.\n *\n * Since the callback never changes, the caller must re-run it from a layout effect keyed on\n * `[store, id]` to migrate an already-registered element. That effect is also what registers the\n * element in the first place when `id` only resolves after the first commit (React 17's `useId`\n * fallback), because the register call made while the id is still `undefined` does nothing.\n *\n * @param id Id of the trigger.\n * @param store The Store instance where the trigger should be registered.\n */\nexport function useTriggerRegistration(id, store) {\n const registrationRef = React.useRef(null);\n return useStableCallback(element => {\n const registration = registrationRef.current;\n if (registration !== null) {\n if (registration.element === element && registration.store === store && registration.id === id) {\n // Already registered where it belongs, so the caller's migration effect is free on mount.\n return;\n }\n registrationRef.current = null;\n const registeredStore = registration.store;\n if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) {\n registeredStore.context.triggerElements.delete(registration.id);\n syncTriggerCount(registeredStore);\n }\n }\n if (element !== null && id !== undefined) {\n registrationRef.current = {\n store,\n id,\n element\n };\n store.context.triggerElements.add(id, element);\n syncTriggerCount(store);\n }\n });\n}\nexport function createPopupOpenState(state, open, trigger, preventUnmountOnClose = false) {\n let preventUnmountingOnClose = state.preventUnmountingOnClose;\n if (open) {\n // Opening starts a new close cycle, so clear any previous request to keep the popup mounted.\n preventUnmountingOnClose = false;\n } else if (preventUnmountOnClose) {\n preventUnmountingOnClose = true;\n }\n const triggerId = trigger?.id ?? null;\n let activeTriggerId = state.activeTriggerId;\n let activeTriggerElement = state.activeTriggerElement;\n\n // If a popup is closing, the `trigger` may be undefined.\n // We want to keep the previous value so that exit animations are played and focus is returned correctly.\n if (triggerId || open) {\n activeTriggerId = triggerId;\n activeTriggerElement = trigger ?? null;\n }\n return {\n open,\n preventUnmountingOnClose,\n activeTriggerId,\n activeTriggerElement\n };\n}\nexport function attachPreventUnmountOnClose(eventDetails) {\n let preventUnmountOnClose = false;\n eventDetails.preventUnmountOnClose = () => {\n preventUnmountOnClose = true;\n };\n return () => preventUnmountOnClose;\n}\n\n/**\n * Runs the shared open-change sequence for a popup store: notifies `onOpenChange`,\n * honors cancellation, dispatches the floating root change, maps the reason to an\n * `instantType`, and commits the state update (synchronously for hover so\n * `getAnimations()` observes it). Stores supply their own differences via\n * `extraState` (e.g. the last change reason) and `onBeforeDispatch` (e.g. updating\n * inline-rect coordinates).\n */\nexport function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) {\n const reason = eventDetails.reason;\n const isHover = reason === REASONS.triggerHover;\n const isFocusOpen = nextOpen && reason === REASONS.triggerFocus;\n const isDismissClose = !nextOpen && (reason === REASONS.triggerPress || reason === REASONS.escapeKey);\n const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);\n store.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n options.onBeforeDispatch?.();\n store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n const changeState = () => {\n const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());\n const updatedState = {\n ...options.extraState,\n ...popupOpenState\n };\n if (isFocusOpen) {\n updatedState.instantType = 'focus';\n } else if (isDismissClose) {\n updatedState.instantType = 'dismiss';\n } else if (isHover) {\n updatedState.instantType = undefined;\n }\n store.update(updatedState);\n };\n if (isHover) {\n // Flush synchronously for hover so `node.getAnimations()` sees the new state.\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n}\n\n/**\n * Sets up trigger data forwarding to the store.\n *\n * @param triggerId Id of the trigger.\n * @param triggerElementRef Ref for the trigger DOM element.\n * @param store The Store instance managing the popup state.\n * @param stateUpdates An object with state updates to apply when the trigger is active.\n */\nexport function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) {\n const isMountedByThisTrigger = store.useState('isMountedByTrigger', triggerId);\n const baseRegisterTrigger = useTriggerRegistration(triggerId, store);\n\n // Applies trigger-owned state (active-trigger ownership and payload) when the trigger registers.\n // Stable so payload/`stateUpdates` changes do not change the ref identity (which would needlessly\n // churn registration); it reads the latest closure values when invoked.\n const applyTriggerData = useStableCallback(element => {\n const open = store.select('open');\n const activeTriggerId = store.select('activeTriggerId');\n if (activeTriggerId === triggerId) {\n const changes = {\n activeTriggerElement: element,\n ...(open ? stateUpdates : null)\n };\n store.update(changes);\n return;\n }\n if (activeTriggerId == null && open) {\n // If a popup is already open, a detached trigger can mount before any active trigger\n // has been established. Claim the first registered trigger so trigger-owned focus\n // management and ARIA relationships work.\n const changes = {\n activeTriggerId: triggerId ?? null,\n activeTriggerElement: element,\n ...stateUpdates\n };\n store.update(changes);\n }\n });\n\n // Stable, so the merged ref on the rendered element keeps its identity for the trigger's whole\n // lifetime.\n const registerTrigger = useStableCallback(element => {\n baseRegisterTrigger(element);\n if (element) {\n applyTriggerData(element);\n }\n });\n\n // A stable ref does not re-fire on a store or id change, so migrate here instead: unregister from\n // the previous store, then register the element the trigger still renders into the current one.\n useIsoLayoutEffect(() => {\n registerTrigger(triggerElementRef.current);\n return () => registerTrigger(null);\n }, [registerTrigger, triggerElementRef, store, triggerId]);\n useIsoLayoutEffect(() => {\n if (isMountedByThisTrigger) {\n const changes = {\n activeTriggerElement: triggerElementRef.current,\n ...stateUpdates\n };\n store.update(changes);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]);\n return {\n registerTrigger,\n isMountedByThisTrigger\n };\n}\n/**\n * Keeps trigger registration state synchronized while the popup is open.\n *\n * When a popup opens without an explicit trigger id and exactly one trigger is registered, that\n * trigger is claimed as the active trigger. When the active trigger id is still registered but its\n * element changed, the active element is refreshed. When the active trigger id is missing from the\n * registry but the same element is still registered under a different id (e.g. the rendered trigger\n * carries its own DOM `id` that differs from Base UI's internal trigger id), the active id is\n * reassociated to the registered id instead of being treated as lost. When the active trigger\n * unregisters, the default path preserves existing ownership so non-closing popup families do not\n * silently claim a different trigger while staying open.\n *\n * If `closeOnActiveTriggerUnmount` is enabled, unregistering a previously resolved active trigger\n * requests a close after a microtask so a same-tick replacement trigger with the same id can\n * register first. An active trigger id that has not matched a registered trigger yet is treated as\n * pending and does not request a close.\n *\n * This should be called on the Root part.\n *\n * @param store The Store instance managing the popup state.\n * @param options Options for active trigger unmount behavior.\n */\nexport function useImplicitActiveTrigger(store, options = {}) {\n const {\n closeOnActiveTriggerUnmount = false\n } = options;\n // Distinguishes a trigger that unmounted from a new active trigger that has not hydrated yet.\n const resolvedActiveTriggerIdRef = React.useRef(null);\n const open = store.useState('open');\n const reactiveTriggerCount = store.useState('triggerCount');\n // Subscribe to the active trigger id so the reconciliation below reruns when ownership moves to\n // another trigger while the popup stays open (e.g. a focus/hover handoff between triggers).\n const activeTriggerId = store.useState('activeTriggerId');\n // Subscribe to the active trigger element so the reconciliation reruns when a pending active\n // trigger registers in a commit where the trigger count nets out unchanged (registration\n // forwards the element to the store when the registering trigger matches the active id).\n // Without this, the id would never be marked resolved and a later genuine unmount would be\n // misclassified as pending, disabling `closeOnActiveTriggerUnmount`.\n const reactiveActiveTriggerElement = store.useState('activeTriggerElement');\n useIsoLayoutEffect(() => {\n if (!open) {\n resolvedActiveTriggerIdRef.current = null;\n if (store.state.triggerCount !== 0) {\n store.set('triggerCount', 0);\n }\n return;\n }\n const triggerCount = store.context.triggerElements.size;\n const stateUpdates = {};\n if (store.state.triggerCount !== triggerCount) {\n stateUpdates.triggerCount = triggerCount;\n }\n const currentActiveTriggerId = store.select('activeTriggerId');\n let lostActiveTriggerId = null;\n if (currentActiveTriggerId) {\n const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId);\n if (!activeTriggerElement) {\n for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) {\n if (triggerElement === store.state.activeTriggerElement) {\n stateUpdates.activeTriggerId = triggerId;\n stateUpdates.activeTriggerElement = triggerElement;\n resolvedActiveTriggerIdRef.current = triggerId;\n break;\n }\n }\n if (stateUpdates.activeTriggerId === undefined) {\n if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) {\n lostActiveTriggerId = currentActiveTriggerId;\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = currentActiveTriggerId;\n if (activeTriggerElement !== store.state.activeTriggerElement) {\n stateUpdates.activeTriggerElement = activeTriggerElement;\n }\n }\n } else {\n resolvedActiveTriggerIdRef.current = null;\n }\n if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) {\n const iteratorResult = store.context.triggerElements.entries().next();\n if (!iteratorResult.done) {\n const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value;\n stateUpdates.activeTriggerId = implicitTriggerId;\n stateUpdates.activeTriggerElement = implicitTriggerElement;\n resolvedActiveTriggerIdRef.current = implicitTriggerId;\n }\n }\n if (stateUpdates.triggerCount !== undefined || stateUpdates.activeTriggerId !== undefined || stateUpdates.activeTriggerElement !== undefined) {\n store.update(stateUpdates);\n }\n if (lostActiveTriggerId) {\n if (closeOnActiveTriggerUnmount) {\n // Defer so a same-tick replacement trigger with the same id can register first.\n queueMicrotask(() => {\n if (store.select('open') && store.select('activeTriggerId') === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) {\n const eventDetails = createChangeEventDetails(REASONS.none);\n store.setOpen(false, eventDetails);\n // If closing is canceled, keep the previous active trigger ownership for the\n // still-open popup instead of claiming another trigger implicitly.\n if (!eventDetails.isCanceled) {\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null\n });\n }\n }\n });\n }\n }\n }, [open, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]);\n}\n\n/**\n * Manages the mounted state of the popup.\n * Sets up the transition status listeners and handles unmounting when needed.\n * Updates the `mounted`, `transitionStatus`, and `preventUnmountingOnClose` states in the store.\n *\n * @param open Whether the popup is open.\n * @param store The Store instance managing the popup state.\n * @param onUnmount Optional callback to be called when the popup is unmounted.\n * @param animateInitialOpen Whether a popup that mounts already open should still play its enter\n * transition. Defaults to `false`, so content that was open on the first render (a `defaultOpen`\n * popup on page load, SSR'd markup) appears without animating. Opt in for popups whose subtree\n * only mounts in response to something the user did, such as a submenu inside a menu popup.\n *\n * @returns A function to forcibly unmount the popup.\n */\nexport function useOpenStateTransitions(open, store, onUnmount, animateInitialOpen) {\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open, false, false, animateInitialOpen);\n const preventUnmountingOnClose = store.useState('preventUnmountingOnClose');\n // Opening starts a new close cycle. Clear during render so the close-completion hook below\n // reads the synchronized value on the same pass.\n const syncedPreventUnmountingOnClose = open ? false : preventUnmountingOnClose;\n store.useSyncedValues({\n mounted,\n transitionStatus,\n preventUnmountingOnClose: syncedPreventUnmountingOnClose\n });\n const forceUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeTriggerId: null,\n activeTriggerElement: null,\n mounted: false,\n preventUnmountingOnClose: false\n });\n onUnmount?.();\n store.context.onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: mounted && !open && !syncedPreventUnmountingOnClose,\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (!open) {\n forceUnmount();\n }\n }\n });\n return {\n forceUnmount,\n transitionStatus\n };\n}\nexport function usePopupInteractionProps(store, statePart) {\n store.useSyncedValues(statePart);\n useIsoLayoutEffect(() => () => {\n store.update({\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n });\n }, [store]);\n}\nexport function usePopupRootSync(store, open) {\n useIsoLayoutEffect(() => {\n if (!open && store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [open, store]);\n useIsoLayoutEffect(() => () => {\n if (store.state.openMethod !== null) {\n store.set('openMethod', null);\n }\n }, [store]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\n\n/**\n * Narrowed to the store members this hook uses so consumers do not need to provide\n * unrelated store capabilities.\n */\n\n/**\n * Keeps a FloatingRootStore in sync with the provided PopupStore.\n * Uses the provided FloatingRootStore when one exists, otherwise creates one once and updates it on every render.\n */\nexport function useSyncedFloatingRootContext(options) {\n const {\n popupStore,\n treatPopupAsFloatingElement = false,\n floatingRootContext: floatingRootContextProp,\n floatingId,\n nested,\n onOpenChange\n } = options;\n const open = popupStore.useState('open');\n const referenceElement = popupStore.useState('activeTriggerElement');\n const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? 'popupElement' : 'positionerElement');\n const triggerElements = popupStore.context.triggerElements;\n const handleOpenChange = onOpenChange;\n const internalStoreRef = React.useRef(null);\n if (floatingRootContextProp === undefined && internalStoreRef.current === null) {\n internalStoreRef.current = new FloatingRootStore({\n open,\n transitionStatus: undefined,\n referenceElement,\n floatingElement,\n triggerElements,\n onOpenChange: handleOpenChange,\n floatingId,\n syncOnly: true,\n nested\n });\n }\n const store = floatingRootContextProp ?? internalStoreRef.current;\n popupStore.useSyncedValue('floatingId', floatingId);\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId,\n referenceElement,\n floatingElement\n };\n if (isElement(referenceElement)) {\n valuesToSync.domReferenceElement = referenceElement;\n }\n if (store.state.positionReference === store.state.referenceElement) {\n valuesToSync.positionReference = referenceElement;\n }\n store.update(valuesToSync);\n }, [open, floatingId, referenceElement, floatingElement, store]);\n\n // Keep non-reactive context values fresh for interactions that call `store.setOpen`.\n store.context.onOpenChange = handleOpenChange;\n store.context.nested = nested;\n return store;\n}","import { ReactStore } from '@base-ui/utils/store';\nimport { createEventEmitter } from \"../utils/createEventEmitter.mjs\";\nimport { isClickLikeEvent } from \"../utils.mjs\";\nconst selectors = {\n open: state => state.open,\n transitionStatus: state => state.transitionStatus,\n domReferenceElement: state => state.domReferenceElement,\n referenceElement: state => state.positionReference ?? state.referenceElement,\n floatingElement: state => state.floatingElement,\n floatingId: state => state.floatingId\n};\nexport class FloatingRootStore extends ReactStore {\n constructor(options) {\n const {\n syncOnly,\n nested,\n onOpenChange,\n triggerElements,\n ...initialState\n } = options;\n super({\n ...initialState,\n positionReference: initialState.referenceElement,\n domReferenceElement: initialState.referenceElement\n }, {\n onOpenChange,\n dataRef: {\n current: {}\n },\n events: createEventEmitter(),\n nested,\n triggerElements\n }, selectors);\n this.syncOnly = syncOnly;\n }\n\n /**\n * Syncs the event used by hover logic to distinguish hover-open from click-like interaction.\n */\n syncOpenEvent = (newOpen, event) => {\n if (!newOpen || !this.state.open ||\n // Prevent a pending hover-open from overwriting a click-open event, while allowing\n // click events to upgrade a hover-open.\n event != null && isClickLikeEvent(event)) {\n this.context.dataRef.current.openEvent = newOpen ? event : undefined;\n }\n };\n\n /**\n * Runs the root-owned side effects for an open state change.\n */\n dispatchOpenChange = (newOpen, eventDetails) => {\n this.syncOpenEvent(newOpen, eventDetails.event);\n const details = {\n open: newOpen,\n reason: eventDetails.reason,\n nativeEvent: eventDetails.event,\n nested: this.context.nested,\n triggerElement: eventDetails.trigger\n };\n this.context.events.emit('openchange', details);\n };\n\n /**\n * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments.\n *\n * @param newOpen The new open state.\n * @param eventDetails Details about the event that triggered the open state change.\n */\n setOpen = (newOpen, eventDetails) => {\n if (this.syncOnly) {\n this.context.onOpenChange?.(newOpen, eventDetails);\n return;\n }\n this.dispatchOpenChange(newOpen, eventDetails);\n this.context.onOpenChange?.(newOpen, eventDetails);\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { AnimationFrame } from '@base-ui/utils/useAnimationFrame';\n/**\n * Provides a status string for CSS animations.\n * @param open - a boolean that determines if the element is open.\n * @param enableIdleState - a boolean that enables the `'idle'` state between `'starting'` and `'ending'`\n * @param deferEndingState - a boolean that delays the `'ending'` state by a frame\n * @param animateInitialOpen - a boolean that makes an element which mounts already open still go\n * through `'starting'`. Off by default so content that was open on the first render (a\n * `defaultOpen` popup on page load, SSR'd markup) doesn't animate in.\n */\nexport function useTransitionStatus(open, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {\n const [transitionStatus, setTransitionStatus] = React.useState(open && enableIdleState ? 'idle' : undefined);\n // Starting at `false` while open lets the `open && !mounted` branch below run on the first\n // render, which is what produces the `'starting'` phase. React re-renders before committing, so\n // the element is still mounted in the same pass.\n const [mounted, setMounted] = React.useState(open && !animateInitialOpen);\n if (open && !mounted) {\n setMounted(true);\n setTransitionStatus('starting');\n }\n if (!open && mounted && transitionStatus !== 'ending' && !deferEndingState) {\n setTransitionStatus('ending');\n }\n if (!open && !mounted && transitionStatus === 'ending') {\n setTransitionStatus(undefined);\n }\n useIsoLayoutEffect(() => {\n if (!open && mounted && transitionStatus !== 'ending' && deferEndingState) {\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('ending');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }\n return undefined;\n }, [open, mounted, transitionStatus, deferEndingState]);\n useIsoLayoutEffect(() => {\n if (!open || enableIdleState) {\n return undefined;\n }\n const frame = AnimationFrame.request(() => {\n // Avoid `flushSync` here due to Firefox.\n // See https://github.com/mui/base-ui/pull/3424\n setTransitionStatus(undefined);\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open]);\n useIsoLayoutEffect(() => {\n if (!open || !enableIdleState) {\n return undefined;\n }\n if (open && mounted && transitionStatus !== 'idle') {\n setTransitionStatus('starting');\n }\n const frame = AnimationFrame.request(() => {\n setTransitionStatus('idle');\n });\n return () => {\n AnimationFrame.cancel(frame);\n };\n }, [enableIdleState, open, mounted, transitionStatus]);\n return {\n mounted,\n setMounted,\n transitionStatus\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useAnimationsFinished } from \"./useAnimationsFinished.mjs\";\n\n/**\n * Calls the provided function when the CSS open/close animation or transition completes.\n */\nexport function useOpenChangeComplete(parameters) {\n const {\n enabled = true,\n open,\n ref,\n batch = false,\n onComplete: onCompleteParam\n } = parameters;\n const onComplete = useStableCallback(onCompleteParam);\n const runOnceAnimationsFinish = useAnimationsFinished(ref, open, batch);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n const abortController = new AbortController();\n runOnceAnimationsFinish(onComplete, abortController.signal);\n return () => {\n abortController.abort();\n };\n }, [enabled, open, onComplete, runOnceAnimationsFinish]);\n}","'use client';\n\nimport * as ReactDOM from 'react-dom';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { resolveRef } from \"../utils/resolveRef.mjs\";\nimport * as TransitionStatusDataAttributes from \"./TransitionStatusDataAttributes.mjs\";\nlet pendingCallbacks = null;\n\n/**\n * Runs the callback in a synchronous flush before the browser paints, so that the\n * browser doesn't paint an intermediate frame: https://github.com/mui/base-ui/issues/979\n * Callbacks that become ready within the same microtask checkpoint (e.g. multiple elements\n * whose animations finish together) are batched into a single commit:\n * https://github.com/mui/base-ui/issues/5481\n */\nfunction flushBeforePaint(fn) {\n if (!pendingCallbacks) {\n const callbacks = [];\n pendingCallbacks = callbacks;\n queueMicrotask(() => {\n pendingCallbacks = null;\n ReactDOM.flushSync(() => {\n for (const callback of callbacks) {\n callback();\n }\n });\n });\n }\n pendingCallbacks.push(fn);\n}\n\n/**\n * Executes a function once all animations have finished on the provided element.\n * If an animation is canceled, waits for any replacement animations before executing.\n * @param elementOrRef - The element to watch for animations.\n * @param waitForStartingStyleRemoved - Whether to wait for [data-starting-style] to be removed before checking for animations.\n * @param batch - Whether completions ready in the same microtask may be coalesced into a single\n * commit. A batched callback runs before earlier callbacks' React updates have committed, so only\n * opt in when the callback doesn't read state that another completion can change.\n * @returns A function that takes a callback to execute once all animations have finished, and an optional AbortSignal to abort the callback\n */\nexport function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) {\n const frame = useAnimationFrame();\n return useStableCallback((fnToExecute,\n /**\n * An optional [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that\n * can be used to abort `fnToExecute` before all the animations have finished.\n * @default null\n */\n signal = null) => {\n frame.cancel();\n const element = resolveRef(elementOrRef);\n if (element == null) {\n return;\n }\n const resolvedElement = element;\n const done = () => {\n if (!batch) {\n // Synchronously flush the unmounting of the component so that the browser doesn't\n // paint: https://github.com/mui/base-ui/issues/979\n // Each callback gets its own commit so that later completions observe the React\n // updates caused by earlier ones.\n ReactDOM.flushSync(fnToExecute);\n return;\n }\n flushBeforePaint(() => {\n // Re-check at flush time: the signal may abort between queueing and the flush.\n if (!signal?.aborted) {\n fnToExecute();\n }\n });\n };\n if (typeof resolvedElement.getAnimations !== 'function' || globalThis.BASE_UI_ANIMATIONS_DISABLED) {\n fnToExecute();\n return;\n }\n function exec() {\n Promise.all(resolvedElement.getAnimations().map(animation => animation.finished)).then(() => {\n if (!signal?.aborted) {\n done();\n }\n }, () => {\n if (signal?.aborted) {\n return;\n }\n const currentAnimations = resolvedElement.getAnimations();\n if (currentAnimations.some(animation => animation.pending || animation.playState !== 'finished')) {\n // Sometimes animations can be aborted because a property they depend on changes while the animation plays.\n // In such cases, we need to re-check if any new animations have started.\n exec();\n return;\n }\n done();\n });\n }\n if (waitForStartingStyleRemoved) {\n const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle;\n\n // If `[data-starting-style]` isn't present, fall back to waiting one more frame\n // to give \"open\" animations a chance to be registered.\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n frame.request(exec);\n return;\n }\n\n // Wait for `[data-starting-style]` to have been removed.\n const attributeObserver = new MutationObserver(() => {\n if (!resolvedElement.hasAttribute(startingStyleAttribute)) {\n attributeObserver.disconnect();\n exec();\n }\n });\n attributeObserver.observe(resolvedElement, {\n attributes: true,\n attributeFilter: [startingStyleAttribute]\n });\n signal?.addEventListener('abort', () => attributeObserver.disconnect(), {\n once: true\n });\n return;\n }\n frame.request(exec);\n });\n}","/**\n * Development-only reverse index of element to registered id, keyed by the owning map.\n *\n * Registration would otherwise have to scan every entry to detect an element claimed by two ids,\n * making the mount of many triggers sharing one handle quadratic. Kept module-scoped, lazily\n * initialized, and read only from `process.env.NODE_ENV` guards so production builds drop it along\n * with the checks.\n */\nlet devElementIdsByMap;\nfunction getDevElementIds(map) {\n devElementIdsByMap ??= new WeakMap();\n let elementIds = devElementIdsByMap.get(map);\n if (!elementIds) {\n elementIds = new WeakMap();\n devElementIdsByMap.set(map, elementIds);\n }\n return elementIds;\n}\n\n/**\n * Data structure to keep track of popup trigger elements by their IDs.\n *\n * Element lookups iterate the id map rather than maintaining a parallel Set. Registration is O(1),\n * while `hasElement` and `hasMatchingElement` are linear in the number of triggers.\n */\nexport class PopupTriggerMap {\n constructor() {\n this.idMap = new Map();\n }\n\n /**\n * Adds a trigger element with the given ID.\n *\n * Note: The provided element is assumed to not be registered under multiple IDs.\n */\n add(id, element) {\n if (process.env.NODE_ENV !== 'production') {\n const elementIds = getDevElementIds(this);\n const existingId = elementIds.get(element);\n if (existingId !== undefined && existingId !== id) {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error('Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.');\n }\n\n // Reusing an id for a different element evicts the previous one, so it must lose its claim\n // on the id or a later registration under a different id would be reported as a duplicate.\n const previousElement = this.idMap.get(id);\n if (previousElement !== undefined && previousElement !== element) {\n elementIds.delete(previousElement);\n }\n elementIds.set(element, id);\n }\n this.idMap.set(id, element);\n }\n\n /**\n * Removes the trigger element with the given ID.\n */\n delete(id) {\n if (process.env.NODE_ENV !== 'production') {\n const element = this.idMap.get(id);\n if (element !== undefined) {\n devElementIdsByMap?.get(this)?.delete(element);\n }\n }\n this.idMap.delete(id);\n }\n\n /**\n * Whether the given element is registered as a trigger.\n */\n hasElement(element) {\n for (const registered of this.idMap.values()) {\n if (registered === element) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Whether there is a registered trigger element matching the given predicate.\n */\n hasMatchingElement(predicate) {\n for (const element of this.idMap.values()) {\n if (predicate(element)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns the trigger element associated with the given ID, or undefined if no such element exists.\n */\n getById(id) {\n return this.idMap.get(id);\n }\n\n /**\n * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element].\n */\n entries() {\n return this.idMap.entries();\n }\n\n /**\n * Returns an iterable of all registered trigger elements.\n */\n elements() {\n return this.idMap.values();\n }\n\n /**\n * Returns the number of registered trigger elements.\n */\n get size() {\n return this.idMap.size;\n }\n}","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FloatingRootStore } from \"../../floating-ui-react/components/FloatingRootStore.mjs\";\n\n/**\n * State common to all popup stores.\n */\n\nexport function createInitialPopupStoreState(triggerElements, floatingId, nested = false) {\n return {\n open: false,\n openProp: undefined,\n mounted: false,\n transitionStatus: undefined,\n floatingRootContext: new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements,\n floatingId,\n syncOnly: true,\n nested,\n onOpenChange: undefined\n }),\n floatingId,\n triggerCount: 0,\n preventUnmountingOnClose: false,\n payload: undefined,\n activeTriggerId: null,\n activeTriggerElement: null,\n triggerIdProp: undefined,\n popupElement: null,\n positionerElement: null,\n activeTriggerProps: EMPTY_OBJECT,\n inactiveTriggerProps: EMPTY_OBJECT,\n popupProps: EMPTY_OBJECT\n };\n}\nconst activeTriggerIdSelector = state => state.triggerIdProp ?? state.activeTriggerId;\nconst openSelector = state => state.openProp ?? state.open;\nconst popupIdSelector = state => {\n const popupId = state.popupElement?.id ?? state.floatingId;\n return popupId || undefined;\n};\nfunction triggerOwnsOpenPopup(state, triggerId) {\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) === triggerId;\n}\nfunction triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {\n if (triggerOwnsOpenPopup(state, triggerId)) {\n return true;\n }\n return triggerId !== undefined && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1;\n}\nexport const popupStoreSelectors = {\n open: openSelector,\n mounted: state => state.mounted,\n transitionStatus: state => state.transitionStatus,\n floatingRootContext: state => state.floatingRootContext,\n triggerCount: state => state.triggerCount,\n preventUnmountingOnClose: state => state.preventUnmountingOnClose,\n payload: state => state.payload,\n activeTriggerId: activeTriggerIdSelector,\n activeTriggerElement: state => state.mounted ? state.activeTriggerElement : null,\n popupId: popupIdSelector,\n /**\n * Whether the trigger with the given ID was used to open the popup.\n */\n isTriggerActive: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId,\n /**\n * Whether the popup is open and was activated by a trigger with the given ID.\n */\n isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId),\n /**\n * Whether the popup is mounted and was activated by a trigger with the given ID.\n */\n isMountedByTrigger: (state, triggerId) => triggerId !== undefined && activeTriggerIdSelector(state) === triggerId && state.mounted,\n triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps,\n /**\n * Popup id for the trigger that currently owns the open popup.\n */\n triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : undefined,\n popupProps: state => state.popupProps,\n popupElement: state => state.popupElement,\n positionerElement: state => state.positionerElement\n};\n\n/**\n * Store members a detached handle-backed trigger reads or invokes for trigger registration and data\n * forwarding. `set`/`update` are included only for trigger-count and trigger-data bookkeeping; on a\n * detached (inert) store they are intentionally no-ops, so a write through them is not guaranteed to\n * be durable. Component handle-store views Pick these from their concrete store (preserving its\n * context and selectors) and add any component-specific trigger-invoked members such as `setOpen`.\n */\n\n/**\n * The subset of a popup store that trigger registration and data forwarding rely on. Narrow enough\n * that an inert store can be passed while detached.\n */","'use client';\n\nimport * as React from 'react';\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { NOOP } from '@base-ui/utils/empty';\n/**\n * Reads the store currently exposed by a popup handle and subscribes to store-pointer changes.\n * Detached triggers use this to follow a handle as a root attaches or detaches: while no root is\n * attached, the handle exposes its fallback store; once a root attaches, subscribers re-render and\n * read from the live root store.\n *\n * Returns `undefined` when no handle is provided so callers can fall back to their root context.\n *\n * @param handle The popup handle to read from, or `undefined` when the trigger is not handle-bound.\n */\nexport function usePopupHandleStore(handle) {\n const subscribe = React.useCallback(listener => {\n if (handle === undefined) {\n return NOOP;\n }\n return handle.subscribeStore(listener);\n }, [handle]);\n const getSnapshot = React.useCallback(() => {\n return handle === undefined ? undefined : handle.store;\n }, [handle]);\n return useSyncExternalStore(subscribe, getSnapshot, () => handle?.serverStore);\n}","'use client';\n\nimport { isElement } from '@floating-ui/utils/dom';\nimport { useId } from '@base-ui/utils/useId';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { useFloatingParentNodeId } from \"../components/FloatingTree.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange,\n elements = {}\n } = options;\n const floatingId = useId();\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== 'production') {\n const optionDomReference = elements.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');\n }\n }\n const store = useRefWithInit(() => new FloatingRootStore({\n open,\n transitionStatus: undefined,\n onOpenChange,\n referenceElement: elements.reference ?? null,\n floatingElement: elements.floating ?? null,\n triggerElements: new PopupTriggerMap(),\n floatingId,\n syncOnly: false,\n nested\n })).current;\n useIsoLayoutEffect(() => {\n const valuesToSync = {\n open,\n floatingId\n };\n if (elements.reference !== undefined) {\n valuesToSync.referenceElement = elements.reference;\n valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;\n }\n if (elements.floating !== undefined) {\n valuesToSync.floatingElement = elements.floating;\n }\n store.update(valuesToSync);\n }, [open, floatingId, elements.reference, elements.floating, store]);\n store.context.onOpenChange = onOpenChange;\n store.context.nested = nested;\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, isInteractiveElement, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, isClickLikeOpenEvent as isClickLikeOpenEventShared, isHoverOpenEvent, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\n/**\n * Provides hover interactions that should be attached to the floating element.\n */\nexport function useHoverFloatingInteraction(context, parameters = {}) {\n const {\n enabled = true,\n closeDelay: closeDelayProp = 0,\n nodeId: nodeIdProp\n } = parameters;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree();\n const parentId = useFloatingParentNodeId();\n const instance = useHoverInteractionSharedState(store);\n const childClosedTimeout = useTimeout();\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const isHoverOpen = useStableCallback(() => {\n return isHoverOpenEvent(dataRef.current.openEvent?.type);\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n instance.pointerType = undefined;\n instance.restTimeoutPending = false;\n instance.interactedInside = false;\n clearPointerEvents();\n }\n }, [open, instance, clearPointerEvents]);\n React.useEffect(() => {\n return clearPointerEvents;\n }, [clearPointerEvents]);\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) {\n const ref = domReferenceElement;\n const floatingEl = floatingElement;\n const doc = ownerDocument(floatingElement);\n const parentFloating = tree?.nodesRef.current.find(node => node.id === parentId)?.context?.elements.floating;\n if (parentFloating) {\n parentFloating.style.pointerEvents = '';\n }\n\n // A keep-mounted submenu can appear in the tree before it opens, so a\n // cached scope or parent lookup may resolve to the submenu itself. That\n // would not shield sibling items in the parent menu.\n const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;\n const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest('[data-rootownerid]') ?? doc.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: ref,\n floatingElement: floatingEl\n });\n return () => {\n clearPointerEvents();\n };\n }\n return undefined;\n }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function hasParentChildren() {\n return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0);\n }\n function closeWithDelay(event) {\n const closeDelay = getDelay(closeDelayProp, 'close', instance.pointerType);\n const close = () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n };\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, close);\n } else {\n instance.openChangeTimeout.clear();\n close();\n }\n }\n function handleInteractInside(event) {\n const target = getTarget(event);\n if (!isInteractiveElement(target)) {\n instance.interactedInside = false;\n return;\n }\n instance.interactedInside = target?.closest('[aria-haspopup]') != null;\n }\n function onFloatingMouseEnter() {\n instance.openChangeTimeout.clear();\n childClosedTimeout.clear();\n tree?.events.off('floating.closed', onNodeClosed);\n clearPointerEvents();\n }\n function onFloatingMouseLeave(event) {\n if (hasParentChildren() && tree) {\n tree.events.on('floating.closed', onNodeClosed);\n return;\n }\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n // If the mouse is leaving the reference element to another trigger, don't explicitly close the popup\n // as it will be moved.\n return;\n }\n const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp;\n const relatedTarget = event.relatedTarget;\n const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some(node => contains(node.context?.elements.floating, relatedTarget));\n if (isMovingIntoDescendantFloating) {\n return;\n }\n\n // If the safePolygon handler is active, let it handle the close logic.\n if (instance.handler) {\n instance.handler(event);\n return;\n }\n clearPointerEvents();\n if (isHoverOpen() && !isClickLikeOpenEvent()) {\n closeWithDelay(event);\n }\n }\n function onNodeClosed(event) {\n if (!tree || !parentId || hasParentChildren()) {\n return;\n }\n // Allow the mouseenter event to fire in case child was closed because mouse moved into parent.\n childClosedTimeout.start(0, () => {\n tree.events.off('floating.closed', onNodeClosed);\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree.events.emit('floating.closed', event);\n });\n }\n const floating = floatingElement;\n return mergeCleanups(floating && addEventListener(floating, 'mouseenter', onFloatingMouseEnter), floating && addEventListener(floating, 'mouseleave', onFloatingMouseLeave), floating && addEventListener(floating, 'pointerdown', handleInteractInside, true), () => {\n tree?.events.off('floating.closed', onNodeClosed);\n });\n }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent, clearPointerEvents, instance, tree, parentId, childClosedTimeout]);\n}","'use client';\n\nimport { useOnMount } from '@base-ui/utils/useOnMount';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { isInteractiveElement } from \"../utils.mjs\";\nexport { isInteractiveElement };\nexport class HoverInteraction {\n constructor() {\n this.pointerType = undefined;\n this.interactedInside = false;\n this.handler = undefined;\n this.blockMouseMove = true;\n this.performedPointerEventsMutation = false;\n this.pointerEventsScopeElement = null;\n this.pointerEventsReferenceElement = null;\n this.pointerEventsFloatingElement = null;\n this.restTimeoutPending = false;\n this.openChangeTimeout = new Timeout();\n this.restTimeout = new Timeout();\n this.handleCloseOptions = undefined;\n }\n static create() {\n return new HoverInteraction();\n }\n dispose = () => {\n this.openChangeTimeout.clear();\n this.restTimeout.clear();\n };\n disposeEffect = () => {\n return this.dispose;\n };\n}\nconst pointerEventsMutationOwnerByScopeElement = new WeakMap();\nexport function clearSafePolygonPointerEventsMutation(instance) {\n if (!instance.performedPointerEventsMutation) {\n return;\n }\n const scopeElement = instance.pointerEventsScopeElement;\n if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) {\n instance.pointerEventsScopeElement?.style.removeProperty('pointer-events');\n instance.pointerEventsReferenceElement?.style.removeProperty('pointer-events');\n instance.pointerEventsFloatingElement?.style.removeProperty('pointer-events');\n pointerEventsMutationOwnerByScopeElement.delete(scopeElement);\n }\n instance.performedPointerEventsMutation = false;\n instance.pointerEventsScopeElement = null;\n instance.pointerEventsReferenceElement = null;\n instance.pointerEventsFloatingElement = null;\n}\nexport function applySafePolygonPointerEventsMutation(instance, options) {\n const {\n scopeElement,\n referenceElement,\n floatingElement\n } = options;\n const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement);\n if (existingOwner && existingOwner !== instance) {\n clearSafePolygonPointerEventsMutation(existingOwner);\n }\n clearSafePolygonPointerEventsMutation(instance);\n instance.performedPointerEventsMutation = true;\n instance.pointerEventsScopeElement = scopeElement;\n instance.pointerEventsReferenceElement = referenceElement;\n instance.pointerEventsFloatingElement = floatingElement;\n pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance);\n scopeElement.style.pointerEvents = 'none';\n referenceElement.style.pointerEvents = 'auto';\n floatingElement.style.pointerEvents = 'auto';\n}\nexport function useHoverInteractionSharedState(store) {\n const data = store.context.dataRef.current;\n const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current;\n if (!data.hoverInteractionState) {\n data.hoverInteractionState = instance;\n }\n useOnMount(data.hoverInteractionState.disposeEffect);\n return data.hoverInteractionState;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { isElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { contains, getTarget } from \"../utils/element.mjs\";\nimport { isMouseLikePointerType } from \"../utils/event.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, useHoverInteractionSharedState } from \"./useHoverInteractionSharedState.mjs\";\nimport { getDelay, getRestMs, isClickLikeOpenEvent as isClickLikeOpenEventShared, isInsideEnabledTrigger } from \"./useHoverShared.mjs\";\nconst EMPTY_REF = {\n current: null\n};\n\n/**\n * Provides hover interactions that should be attached to reference or trigger\n * elements.\n */\nexport function useHoverReferenceInteraction(context, props = {}) {\n const {\n enabled = true,\n delay = 0,\n handleClose = null,\n mouseOnly = false,\n restMs = 0,\n move = true,\n triggerElementRef = EMPTY_REF,\n externalTree,\n isActiveTrigger = true,\n getHandleCloseContext,\n isClosing,\n shouldOpen: shouldOpenProp,\n guardStaleOpen = false\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const {\n dataRef,\n events\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const instance = useHoverInteractionSharedState(store);\n const isHoverCloseActiveRef = React.useRef(false);\n const handleCloseRef = useValueAsRef(handleClose);\n const delayRef = useValueAsRef(delay);\n const restMsRef = useValueAsRef(restMs);\n const enabledRef = useValueAsRef(enabled);\n const shouldOpenRef = useValueAsRef(shouldOpenProp);\n const isClosingRef = useValueAsRef(isClosing);\n const isClickLikeOpenEvent = useStableCallback(() => {\n return isClickLikeOpenEventShared(dataRef.current.openEvent?.type, instance.interactedInside);\n });\n const checkShouldOpen = useStableCallback(() => {\n return shouldOpenRef.current?.() !== false;\n });\n const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => {\n const allTriggers = store.context.triggerElements;\n\n // Fast path for normal usage where handlers are attached directly to triggers.\n if (allTriggers.hasElement(currentTarget)) {\n return !currentDomReference || !contains(currentDomReference, currentTarget);\n }\n\n // Fallback for delegated/wrapper usage where currentTarget may be outside the trigger map.\n if (!isElement(target)) {\n return false;\n }\n const targetElement = target;\n return allTriggers.hasMatchingElement(trigger => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement));\n });\n const cleanupMouseMoveHandler = useStableCallback(() => {\n if (!instance.handler) {\n return;\n }\n const doc = ownerDocument(store.select('domReferenceElement'));\n doc.removeEventListener('mousemove', instance.handler);\n instance.handler = undefined;\n });\n const clearPointerEvents = useStableCallback(() => {\n clearSafePolygonPointerEventsMutation(instance);\n });\n if (isActiveTrigger) {\n // eslint-disable-next-line no-underscore-dangle\n instance.handleCloseOptions = handleClose?.__options;\n }\n React.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]);\n\n // When closing before opening, clear the delay timeouts to cancel it\n // from showing.\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function onOpenChangeLocal(details) {\n if (!details.open) {\n isHoverCloseActiveRef.current = details.reason === REASONS.triggerHover;\n cleanupMouseMoveHandler();\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.blockMouseMove = true;\n instance.restTimeoutPending = false;\n } else {\n isHoverCloseActiveRef.current = false;\n }\n }\n events.on('openchange', onOpenChangeLocal);\n return () => {\n events.off('openchange', onOpenChangeLocal);\n };\n }, [enabled, events, instance, cleanupMouseMoveHandler]);\n React.useEffect(() => {\n if (!enabled) {\n return undefined;\n }\n function closeWithDelay(event, runElseBranch = true) {\n const closeDelay = getDelay(delayRef.current, 'close', instance.pointerType);\n if (closeDelay) {\n instance.openChangeTimeout.start(closeDelay, () => {\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n });\n } else if (runElseBranch) {\n instance.openChangeTimeout.clear();\n store.setOpen(false, createChangeEventDetails(REASONS.triggerHover, event));\n tree?.events.emit('floating.closed', event);\n }\n }\n const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select('domReferenceElement') : null);\n if (!isElement(trigger)) {\n return undefined;\n }\n function onMouseEnter(event) {\n instance.openChangeTimeout.clear();\n instance.blockMouseMove = false;\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n\n // Only rest delay is set; there's no fallback delay.\n // This will be handled by `onMouseMove`.\n const restMsValue = getRestMs(restMsRef.current);\n const openDelay = getDelay(delayRef.current, 'open', instance.pointerType);\n const eventTarget = getTarget(event);\n const currentTarget = event.currentTarget ?? null;\n const currentDomReference = store.select('domReferenceElement');\n let triggerNode = currentTarget;\n\n // Wrapper/delegated mode: resolve the actual trigger from the event target.\n if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) {\n for (const triggerElement of store.context.triggerElements.elements()) {\n if (contains(triggerElement, eventTarget)) {\n triggerNode = triggerElement;\n break;\n }\n }\n }\n\n // Wrapper/delegated mode fallback: if the wrapper contains the active trigger,\n // treat this as re-entering that active trigger.\n if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) {\n triggerNode = currentDomReference;\n }\n const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget);\n const isOpen = store.select('open');\n const isInClosingTransition = isClosingRef.current?.() ?? store.select('transitionStatus') === 'ending';\n const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current;\n const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition;\n const isRestOnlyDelay = restMsValue > 0 && !openDelay;\n const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition;\n const shouldOpen = !isOpen || isOverInactive;\n\n // Open immediately when moving between triggers while open, or during\n // a hover-driven close transition (including same-trigger re-entry).\n if (shouldOpenImmediately) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n return;\n }\n if (isRestOnlyDelay) {\n return;\n }\n if (openDelay) {\n instance.openChangeTimeout.start(openDelay, () => {\n if (shouldOpen && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n });\n } else if (shouldOpen) {\n if (checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, event, triggerNode));\n }\n }\n }\n function onMouseLeave(event) {\n if (isClickLikeOpenEvent()) {\n clearPointerEvents();\n return;\n }\n cleanupMouseMoveHandler();\n const domReferenceElement = store.select('domReferenceElement');\n const doc = ownerDocument(domReferenceElement);\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.();\n if (isInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) {\n return;\n }\n if (handleCloseRef.current && handleCloseContextBase) {\n if (!store.select('open')) {\n instance.openChangeTimeout.clear();\n }\n const currentTrigger = triggerElementRef.current;\n instance.handler = handleCloseRef.current({\n ...handleCloseContextBase,\n tree,\n x: event.clientX,\n y: event.clientY,\n onClose() {\n clearPointerEvents();\n cleanupMouseMoveHandler();\n if (enabledRef.current && !isClickLikeOpenEvent() && currentTrigger === store.select('domReferenceElement')) {\n closeWithDelay(event, true);\n }\n }\n });\n doc.addEventListener('mousemove', instance.handler);\n instance.handler(event);\n return;\n }\n const shouldClose = instance.pointerType === 'touch' ? !contains(store.select('floatingElement'), event.relatedTarget) : true;\n if (shouldClose) {\n closeWithDelay(event);\n }\n }\n\n // Backup cancellation for Chrome's dropped `mouseleave` — see `guardStaleOpen`.\n function onMouseOut(event) {\n if (contains(trigger, event.relatedTarget)) {\n return; // moved within the trigger's own subtree\n }\n instance.openChangeTimeout.clear();\n instance.restTimeout.clear();\n instance.restTimeoutPending = false;\n }\n const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, 'mouseout', onMouseOut) : undefined;\n if (move) {\n return mergeCleanups(addEventListener(trigger, 'mousemove', onMouseEnter, {\n once: true\n }), addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }\n return mergeCleanups(addEventListener(trigger, 'mouseenter', onMouseEnter), addEventListener(trigger, 'mouseleave', onMouseLeave), staleOpenGuard);\n }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]);\n return React.useMemo(() => {\n if (!enabled) {\n return undefined;\n }\n function setPointerRef(event) {\n instance.pointerType = event.pointerType;\n }\n return {\n onPointerDown: setPointerRef,\n onPointerEnter: setPointerRef,\n onMouseMove(event) {\n const {\n nativeEvent\n } = event;\n const trigger = event.currentTarget;\n const currentDomReference = store.select('domReferenceElement');\n const currentOpen = store.select('open');\n const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target);\n if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) {\n return;\n }\n if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) {\n const floatingElement = store.select('floatingElement');\n if (floatingElement) {\n const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body;\n applySafePolygonPointerEventsMutation(instance, {\n scopeElement,\n referenceElement: trigger,\n floatingElement\n });\n }\n }\n const restMsValue = getRestMs(restMsRef.current);\n if (currentOpen && !isOverInactive || restMsValue === 0) {\n return;\n }\n if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) {\n return;\n }\n instance.restTimeout.clear();\n function handleMouseMove() {\n instance.restTimeoutPending = false;\n\n // A delayed hover open should not override a click-like open that happened\n // while the hover delay was pending.\n if (isClickLikeOpenEvent()) {\n return;\n }\n const latestOpen = store.select('open');\n if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) {\n store.setOpen(true, createChangeEventDetails(REASONS.triggerHover, nativeEvent, trigger));\n }\n }\n if (instance.pointerType === 'touch') {\n ReactDOM.flushSync(() => {\n handleMouseMove();\n });\n } else if (isOverInactive && currentOpen) {\n handleMouseMove();\n } else {\n instance.restTimeoutPending = true;\n instance.restTimeout.start(restMsValue, handleMouseMove);\n }\n }\n };\n }, [enabled, instance, isClickLikeOpenEvent, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { platform } from '@base-ui/utils/platform';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"../utils/constants.mjs\";\nimport { activeElement, contains, getFloatingFocusElement, getTarget, isTypeableCombobox } from \"../utils/element.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nexport const ESCAPE = 'Escape';\n\n// WebKit fires zero-delta `mousemove`/`pointermove` events when the list scrolls\n// beneath a stationary pointer, moving the highlight during keyboard navigation.\n// https://github.com/mui/base-ui/issues/4002\nfunction isStationaryWebKitPointer(event) {\n return platform.engine.webkit && event.movementX === 0 && event.movementY === 0;\n}\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, grid) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && grid) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nexport function useListNavigation(context, props) {\n const {\n listRef,\n activeIndex,\n onNavigate: onNavigateProp = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loopFocus = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n parentOrientation,\n id,\n resetOnPointerLeave = true,\n externalTree,\n grid: navigateGrid\n } = props;\n const isGrid = navigateGrid != null;\n if (process.env.NODE_ENV !== 'production') {\n if (allowEscape) {\n if (!loopFocus) {\n console.warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n console.warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && isGrid) {\n console.warn('In grid list navigation mode, the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const dataRef = store.context.dataRef;\n const floatingFocusElement = getFloatingFocusElement(floatingElement);\n const typeableComboboxReference = isTypeableCombobox(domReferenceElement);\n const floatingFocusElementRef = useValueAsRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree(externalTree);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex ?? -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const onNavigate = useStableCallback(event => {\n onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);\n });\n const previousMountedRef = React.useRef(!!floatingElement);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const cancelQueuedFocusRef = React.useRef(null);\n const disabledIndicesRef = useValueAsRef(disabledIndices);\n const latestOpenRef = useValueAsRef(open);\n const selectedIndexRef = useValueAsRef(selectedIndex);\n const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);\n const focusFrame = useAnimationFrame();\n const waitForListPopulatedFrame = useAnimationFrame();\n const focusItem = useStableCallback(() => {\n function runFocus(item) {\n if (virtual) {\n tree?.events.emit('virtualfocus', item);\n } else {\n cancelQueuedFocusRef.current = enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n const forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) {\n return;\n }\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const shouldScrollIntoView =\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n item && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView?.({\n block: 'nearest',\n inline: 'nearest'\n });\n }\n });\n });\n useIsoLayoutEffect(() => {\n dataRef.current.orientation = orientation;\n }, [dataRef, orientation]);\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (open && floatingElement) {\n indexRef.current = selectedIndex ?? -1;\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Reset the active index when the list is no longer open and mounted (closing or\n // unmounting). `onNavigate` is a stable callback that always forwards to the latest\n // `onNavigate` prop.\n indexRef.current = -1;\n onNavigate();\n }\n }, [enabled, open, floatingElement, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (!open) {\n forceSyncFocusRef.current = false;\n return;\n }\n if (!floatingElement) {\n return;\n }\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs += 1;\n } else {\n // Initially focus the first non-disabled item. `disabledIndices` is deliberately\n // omitted here so attribute-disabled items (`disabled`/`aria-disabled`) are skipped\n // on open even when the consumer passes an empty `disabledIndices` array. Passing it\n // would regress that behavior (see mui/base-ui#2604).\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n useIsoLayoutEffect(() => {\n if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;\n // `floatingElement` is null here (see the guard above), so resolve the owner document from an\n // in-DOM element for realm-safety (shadow DOM/iframes): the reference element, falling back to\n // the parent floating element when the reference is virtual (`domReferenceElement` is null).\n const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);\n useIsoLayoutEffect(() => {\n previousOpenRef.current = open;\n previousMountedRef.current = !!floatingElement;\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [open, focusItemOnOpen]);\n const hasActiveIndex = activeIndex != null;\n const syncCurrentTarget = useStableCallback(event => {\n if (!latestOpenRef.current) {\n return;\n }\n const index = listRef.current.indexOf(event.currentTarget);\n if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {\n indexRef.current = index;\n onNavigate(event);\n }\n });\n const getParentOrientation = useStableCallback(() => {\n return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;\n });\n const getMinEnabledIndex = useStableCallback(() => {\n return getMinListIndex(listRef, disabledIndicesRef.current);\n });\n const commonOnKeyDown = useStableCallback(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {\n // If the nested list's close key is also the parent navigation key,\n // let the parent navigate. Otherwise, stop propagating the event.\n if (!isMainOrientationKey(event.key, getParentOrientation())) {\n stopEvent(event);\n }\n store.setOpen(false, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n if (virtual) {\n tree?.events.emit('virtualfocus', domReferenceElement);\n } else {\n domReferenceElement.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinListIndex(listRef, disabledIndices);\n const maxIndex = getMaxListIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate(event);\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate(event);\n }\n }\n\n // Grid navigation is injected by grid-capable consumers so non-grid\n // consumers (menu, select) tree-shake the grid helpers out.\n if (navigateGrid != null) {\n const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);\n if (index != null) {\n indexRef.current = index;\n onNavigate(event);\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate(event);\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loopFocus) {\n if (currentIndex >= maxIndex) {\n if (allowEscape && currentIndex !== listRef.current.length) {\n indexRef.current = -1;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = minIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else if (loopFocus) {\n if (currentIndex <= minIndex) {\n if (allowEscape && currentIndex !== -1) {\n indexRef.current = listRef.current.length;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = maxIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate(event);\n }\n });\n const item = React.useMemo(() => {\n const itemProps = {\n onFocus(event) {\n forceSyncFocusRef.current = true;\n syncCurrentTarget(event);\n },\n onClick: ({\n currentTarget\n }) => currentTarget.focus({\n preventScroll: true\n }),\n // Safari\n onMouseMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(event);\n }\n },\n onPointerLeave(event) {\n if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n const relatedTarget = event.relatedTarget;\n if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {\n return;\n }\n if (!resetOnPointerLeaveRef.current) {\n return;\n }\n cancelQueuedFocusRef.current?.();\n cancelQueuedFocusRef.current = null;\n indexRef.current = -1;\n onNavigate(event);\n if (!virtual) {\n const floatingFocusEl = floatingFocusElementRef.current;\n const activeEl = activeElement(ownerDocument(floatingFocusEl));\n if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {\n floatingFocusEl.focus({\n preventScroll: true\n });\n }\n }\n }\n };\n return itemProps;\n }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': `${id}-${activeIndex}`\n };\n }, [virtual, open, hasActiveIndex, id, activeIndex]);\n const floating = React.useMemo(() => {\n return {\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown(event) {\n // Close submenu on Shift+Tab\n if (event.key === 'Tab' && event.shiftKey && open && !virtual) {\n // If the event originated from within a nested element (e.g., a Dialog opened from\n // within the menu), don't close the menu. The nested element has its own focus\n // management and should handle the Tab key.\n const target = getTarget(event.nativeEvent);\n if (target && !contains(floatingFocusElementRef.current, target)) {\n return;\n }\n stopEvent(event);\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n domReferenceElement.focus();\n }\n return;\n }\n commonOnKeyDown(event);\n },\n onPointerMove(event) {\n if (isStationaryWebKitPointer(event)) {\n return;\n }\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, typeableComboboxReference, store, open, virtual, domReferenceElement]);\n const trigger = React.useMemo(() => {\n function openOnNavigationKeyDown(event) {\n store.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent, event.currentTarget));\n }\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = !virtual;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n onKeyDown(event) {\n // non-reactive open state (to prevent re-creation of the handler)\n const currentOpen = store.select('open');\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && currentOpen) {\n return commonOnKeyDown(event);\n }\n\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {\n return undefined;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (currentOpen) {\n indexRef.current = getMinEnabledIndex();\n onNavigate(event);\n } else {\n openOnNavigationKeyDown(event);\n }\n }\n return undefined;\n }\n if (isMainKey) {\n if (selectedIndexRef.current != null) {\n indexRef.current = selectedIndexRef.current;\n }\n stopEvent(event);\n if (!currentOpen && openOnArrowKeyDown) {\n openOnNavigationKeyDown(event);\n } else {\n commonOnKeyDown(event);\n }\n if (currentOpen) {\n onNavigate(event);\n }\n }\n return undefined;\n },\n onFocus(event) {\n if (store.select('open') && !virtual) {\n indexRef.current = -1;\n onNavigate(event);\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);\n const reference = React.useMemo(() => {\n return {\n ...ariaActiveDescendantProp,\n ...trigger\n };\n }, [ariaActiveDescendantProp, trigger]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item,\n trigger\n } : {}, [enabled, reference, floating, trigger, item]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { isElementVisible, isListIndexDisabled } from \"../utils/composite.mjs\";\nimport { contains } from \"../utils/element.mjs\";\nimport { stopEvent } from \"../utils/event.mjs\";\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nexport function useTypeahead(context, props) {\n const {\n listRef,\n elementsRef,\n activeIndex,\n onMatch: onMatchProp,\n disabledIndices,\n onTyping,\n enabled = true,\n resetMs = 750,\n selectedIndex = null\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const timeout = useTimeout();\n const stringRef = React.useRef('');\n const prevIndexRef = React.useRef(selectedIndex ?? activeIndex ?? -1);\n const matchIndexRef = React.useRef(null);\n const onKeyDown = useStableCallback(event => {\n function getElement(index) {\n return elementsRef?.current[index];\n }\n function isItemAvailable(index) {\n const element = getElement(index);\n if (element && !isElementVisible(element) || element?.matches(':disabled')) {\n return false;\n }\n // Visibility and native disabled state are handled above; pass an empty\n // element list so `isListIndexDisabled` resolves only the explicit\n // `disabledIndices` (array/predicate) and skips its own fallbacks.\n // Consumers that don't pass `disabledIndices` keep matching every visible\n // item except native disabled elements provided through `elementsRef`.\n return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);\n }\n function getMatchingIndex(list, string, startIndex = 0) {\n if (list.length === 0) {\n return -1;\n }\n const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;\n const lowerString = string.toLowerCase();\n for (let offset = 0; offset < list.length; offset += 1) {\n const index = (normalizedStartIndex + offset) % list.length;\n const text = list[index];\n if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index)) {\n continue;\n }\n return index;\n }\n return -1;\n }\n const listContent = listRef.current;\n if (stringRef.current.length > 0 && event.key === ' ') {\n // Space should continue the in-progress typeahead session.\n stopEvent(event);\n onTyping?.(true);\n }\n if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== ' ') {\n onTyping?.(false);\n }\n }\n if (listContent == null ||\n // Character key.\n event.key.length !== 1 ||\n // Modifier key.\n event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (open && event.key !== ' ') {\n stopEvent(event);\n onTyping?.(true);\n }\n\n // Capture whether this is a new typing session before mutating the string.\n const isNewSession = stringRef.current === '';\n if (isNewSession) {\n prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n }\n\n // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n // allow it in this case, too. Unavailable items are skipped while matching, so\n // they must be ignored here as well — otherwise a hidden or disabled double-letter\n // label would block rapid cycling through the available items.\n const allowRapidSuccessionOfFirstLetter = listContent.every((text, index) => text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);\n\n // Allows the user to cycle through items that start with the same letter\n // in rapid succession.\n if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n }\n stringRef.current += event.key;\n timeout.start(resetMs, () => {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n\n // Compute the starting index for this search.\n // If this is a new typing session (string is empty), base it on the current\n // selection/active item; otherwise continue from the last matched index.\n const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current;\n const startIndex = (prevIndex ?? 0) + 1;\n const index = getMatchingIndex(listContent, stringRef.current, startIndex);\n if (index !== -1) {\n onMatchProp?.(index);\n matchIndexRef.current = index;\n } else if (event.key !== ' ') {\n stringRef.current = '';\n onTyping?.(false);\n }\n });\n const onBlur = useStableCallback(event => {\n const next = event.relatedTarget;\n const currentDomReferenceElement = store.select('domReferenceElement');\n const currentFloatingElement = store.select('floatingElement');\n const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next);\n\n // Keep the session if focus moves within the composite (reference <-> floating).\n if (withinComposite) {\n return;\n }\n\n // End the current typing session when focus leaves the composite entirely.\n timeout.clear();\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n onTyping?.(false);\n });\n useIsoLayoutEffect(() => {\n if (!open && selectedIndex !== null) {\n return;\n }\n timeout.clear();\n matchIndexRef.current = null;\n if (stringRef.current !== '') {\n stringRef.current = '';\n }\n }, [open, selectedIndex, timeout]);\n const sharedProps = React.useMemo(() => ({\n onKeyDown,\n onBlur\n }), [onKeyDown, onBlur]);\n return React.useMemo(() => enabled ? {\n reference: sharedProps,\n floating: sharedProps\n } : {}, [enabled, sharedProps]);\n}","import { isElement } from '@floating-ui/utils/dom';\nimport { Timeout } from '@base-ui/utils/useTimeout';\nimport { contains, getTarget } from \"./utils/element.mjs\";\nimport { getNodeChildren } from \"./utils/nodes.mjs\";\n\n/* eslint-disable no-nested-ternary */\n\nconst CURSOR_SPEED_THRESHOLD = 0.1;\nconst CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD;\nconst POLYGON_BUFFER = 0.5;\nfunction hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) {\n return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi;\n}\nfunction isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) {\n let isInsideValue = false;\n if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) {\n isInsideValue = !isInsideValue;\n }\n if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) {\n isInsideValue = !isInsideValue;\n }\n return isInsideValue;\n}\nfunction isInsideRect(pointX, pointY, rect) {\n return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height;\n}\nfunction isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) {\n const minX = Math.min(x1, x2);\n const maxX = Math.max(x1, x2);\n const minY = Math.min(y1, y2);\n const maxY = Math.max(y1, y2);\n return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY;\n}\n/**\n * Generates a safe polygon area that the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nexport function safePolygon(options = {}) {\n const {\n blockPointerEvents = false\n } = options;\n const timeout = new Timeout();\n const fn = ({\n x,\n y,\n placement,\n elements,\n onClose,\n nodeId,\n tree\n }) => {\n const side = placement?.split('-')[0];\n let hasLanded = false;\n let lastX = null;\n let lastY = null;\n let lastCursorTime = typeof performance !== 'undefined' ? performance.now() : 0;\n function isCursorMovingSlowly(nextX, nextY) {\n const currentTime = performance.now();\n const elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return false;\n }\n const deltaX = nextX - lastX;\n const deltaY = nextY - lastY;\n const distanceSquared = deltaX * deltaX + deltaY * deltaY;\n const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED;\n lastX = nextX;\n lastY = nextY;\n lastCursorTime = currentTime;\n return distanceSquared < thresholdSquared;\n }\n function close() {\n timeout.clear();\n onClose();\n }\n return function onMouseMove(event) {\n timeout.clear();\n const domReference = elements.domReference;\n const floating = elements.floating;\n if (!domReference || !floating || side == null || x == null || y == null) {\n return undefined;\n }\n const {\n clientX,\n clientY\n } = event;\n const target = getTarget(event);\n const isLeave = event.type === 'mouseleave';\n const isOverFloatingEl = contains(floating, target);\n const isOverReferenceEl = contains(domReference, target);\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return undefined;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n if (!isLeave) {\n hasLanded = true;\n return undefined;\n }\n }\n\n // Prevent overlapping floating element from being stuck in an open-close\n // loop: https://github.com/floating-ui/floating-ui/issues/1910\n if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) {\n return undefined;\n }\n function hasOpenChildNode() {\n return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0);\n }\n function closeIfNoOpenChild() {\n if (!hasOpenChildNode()) {\n close();\n }\n }\n\n // If any nested child is open, abort.\n if (hasOpenChildNode()) {\n return undefined;\n }\n const refRect = domReference.getBoundingClientRect();\n const rect = floating.getBoundingClientRect();\n const cursorLeaveFromRight = x > rect.right - rect.width / 2;\n const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n const isFloatingWider = rect.width > refRect.width;\n const isFloatingTaller = rect.height > refRect.height;\n const left = (isFloatingWider ? refRect : rect).left;\n const right = (isFloatingWider ? refRect : rect).right;\n const top = (isFloatingTaller ? refRect : rect).top;\n const bottom = (isFloatingTaller ? refRect : rect).bottom;\n\n // If the pointer is leaving from the opposite side, the \"buffer\" logic\n // creates a point where the floating element remains open, but should be\n // ignored.\n // A constant of 1 handles floating point rounding errors.\n if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {\n closeIfNoOpenChild();\n return undefined;\n }\n\n // Ignore when the cursor is within the rectangular trough between the\n // two elements. Since the triangle is created from the cursor point,\n // which can start beyond the ref element's edge, traversing back and\n // forth from the ref to the floating element can cause it to close. This\n // ensures it always remains open in that case.\n let isInsideTroughRect = false;\n switch (side) {\n case 'top':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1);\n break;\n case 'bottom':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1);\n break;\n case 'left':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top);\n break;\n case 'right':\n isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top);\n break;\n default:\n }\n if (isInsideTroughRect) {\n return undefined;\n }\n if (hasLanded && !isInsideRect(clientX, clientY, refRect)) {\n closeIfNoOpenChild();\n return undefined;\n }\n if (!isLeave && isCursorMovingSlowly(clientX, clientY)) {\n closeIfNoOpenChild();\n return undefined;\n }\n let isInsidePolygon = false;\n switch (side) {\n case 'top':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y + POLYGON_BUFFER + 1;\n const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'bottom':\n {\n const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset;\n const cursorPointY = y - POLYGON_BUFFER;\n const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom;\n const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight);\n break;\n }\n case 'left':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x + POLYGON_BUFFER + 1;\n const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY);\n break;\n }\n case 'right':\n {\n const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4;\n const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset;\n const cursorPointX = x - POLYGON_BUFFER;\n const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right;\n const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER;\n isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom);\n break;\n }\n default:\n }\n if (!isInsidePolygon) {\n closeIfNoOpenChild();\n } else if (!hasLanded) {\n timeout.start(40, closeIfNoOpenChild);\n }\n return undefined;\n };\n };\n\n // eslint-disable-next-line no-underscore-dangle\n fn.__options = {\n ...options,\n blockPointerEvents\n };\n return fn;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\n\n/**\n * Root values consumed during render. Keep these outside `useSyncedValues` so descendant ref\n * callbacks see the current props during the same commit.\n */\n\nexport const SelectRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectRootContext.displayName = \"SelectRootContext\";\nexport const SelectRootPropsContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectRootPropsContext.displayName = \"SelectRootPropsContext\";\nexport const SelectFloatingContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectFloatingContext.displayName = \"SelectFloatingContext\";\nexport function useSelectRootContext() {\n const store = React.useContext(SelectRootContext);\n if (store === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectRootContext is missing. Select parts must be placed within <Select.Root>.' : _formatErrorMessage(60));\n }\n return store;\n}\nexport function useSelectRootPropsContext() {\n const context = React.useContext(SelectRootPropsContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectRootPropsContext is missing. Select parts must be placed within <Select.Root>.' : _formatErrorMessage(101));\n }\n return context;\n}\nexport function useSelectFloatingContext() {\n const context = React.useContext(SelectFloatingContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectFloatingContext is missing. Select parts must be placed within <Select.Root>.' : _formatErrorMessage(61));\n }\n return context;\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { NOOP } from \"../noop.mjs\";\nimport { DEFAULT_FIELD_ROOT_STATE, DEFAULT_VALIDITY_STATE } from \"../field-constants/constants.mjs\";\nexport const DEFAULT_FIELD_ROOT_CONTEXT = {\n invalid: undefined,\n name: undefined,\n validityData: {\n state: DEFAULT_VALIDITY_STATE,\n errors: [],\n error: '',\n value: '',\n initialValue: null\n },\n setValidityData: NOOP,\n disabled: undefined,\n setTouched: NOOP,\n setDirty: NOOP,\n setFilled: NOOP,\n setFocused: NOOP,\n validationMode: 'onSubmit',\n shouldValidateOnChange: () => false,\n state: DEFAULT_FIELD_ROOT_STATE,\n registerFieldControl: NOOP,\n validation: {\n getValidationProps: (_disabled, props = EMPTY_OBJECT) => props,\n inputRef: {\n current: null\n },\n registeredInputs: new Map(),\n registerInput: NOOP,\n getInputControl: () => null,\n commit: async () => {},\n change: NOOP\n }\n};\nexport const FieldRootContext = /*#__PURE__*/React.createContext(DEFAULT_FIELD_ROOT_CONTEXT);\nif (process.env.NODE_ENV !== \"production\") FieldRootContext.displayName = \"FieldRootContext\";\nexport function useFieldRootContext(optional = true) {\n const context = React.useContext(FieldRootContext);\n if (context.setValidityData === NOOP && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>.' : _formatErrorMessage(28));\n }\n return context;\n}","/**\n * Present when the field is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the field is in a valid state.\n */\nexport const valid = 'data-valid';\n/**\n * Present when the field is in an invalid state.\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the field has been touched.\n */\nexport const touched = 'data-touched';\n/**\n * Present when the field's value has changed.\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the field is filled.\n */\nexport const filled = 'data-filled';\n/**\n * Present when the field control is focused.\n */\nexport const focused = 'data-focused';","import * as FieldControlDataAttributes from \"../../field/control/FieldControlDataAttributes.mjs\";\nexport const DEFAULT_VALIDITY_STATE = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: null,\n valueMissing: false\n};\nexport const DEFAULT_FIELD_STATE_ATTRIBUTES = {\n valid: null,\n touched: false,\n dirty: false,\n filled: false,\n focused: false\n};\nexport const DEFAULT_FIELD_ROOT_STATE = {\n disabled: false,\n ...DEFAULT_FIELD_STATE_ATTRIBUTES\n};\nexport const fieldValidityMapping = {\n valid(value) {\n if (value === null) {\n return null;\n }\n if (value) {\n return {\n [FieldControlDataAttributes.valid]: ''\n };\n }\n return {\n [FieldControlDataAttributes.invalid]: ''\n };\n }\n};","'use client';\n\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useFieldRootContext } from \"../field-root-context/FieldRootContext.mjs\";\nexport function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) {\n const {\n registerFieldControl\n } = useFieldRootContext();\n const sourceRef = useRefWithInit(() => Symbol());\n\n // Re-register without unregistering first: re-registration with the same id updates the\n // form's fields Map entry in place, while a delete + re-add would move the field to the\n // end of the Map every time its value changes.\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n if (!enabled) {\n registerFieldControl(source, undefined);\n return;\n }\n const registration = {\n controlRef,\n getValue: getFormValueOverride,\n id,\n name,\n value\n };\n registerFieldControl(source, registration);\n }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]);\n useIsoLayoutEffect(() => {\n const source = sourceRef.current;\n return () => {\n registerFieldControl(source, undefined);\n };\n }, [registerFieldControl, sourceRef]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { NOOP } from \"../noop.mjs\";\nimport { useBaseUiId } from \"../useBaseUiId.mjs\";\nimport { useLabelableContext } from \"./LabelableContext.mjs\";\nexport function useLabelableId(params = {}) {\n const {\n id,\n enabled = true\n } = params;\n const {\n controlId,\n registerControlId,\n resetControlId\n } = useLabelableContext();\n\n // Deliberately not seeded with `id`: on React 17 the seed would stick around after the\n // `id` prop is removed, leaving the control on a stale id forever.\n const defaultId = useBaseUiId();\n const controlSourceRef = useRefWithInit(() => Symbol());\n const hasRegisteredRef = React.useRef(false);\n const hadExplicitIdRef = React.useRef(false);\n const unregisterControlId = useStableCallback(() => {\n if (!hasRegisteredRef.current || registerControlId === NOOP) {\n return;\n }\n hasRegisteredRef.current = false;\n registerControlId(controlSourceRef.current, undefined);\n });\n useIsoLayoutEffect(() => {\n if (!enabled || registerControlId === NOOP) {\n unregisterControlId();\n return undefined;\n }\n let nextId;\n if (id !== undefined) {\n hadExplicitIdRef.current = true;\n nextId = id;\n } else if (hadExplicitIdRef.current) {\n nextId = defaultId;\n } else {\n // An id-less replacement must claim the provider's fallback so a previously registered\n // explicit id is not retained after its control unmounts.\n resetControlId();\n return undefined;\n }\n\n // Either the control never had an explicit `id`, or React 17 has not assigned the\n // fallback id yet. Neither is worth registering.\n if (nextId === undefined) {\n unregisterControlId();\n return undefined;\n }\n hasRegisteredRef.current = true;\n registerControlId(controlSourceRef.current, nextId);\n return undefined;\n }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]);\n\n // Unregistering in the layout phase, not a passive effect: a replacement control's layout\n // effect would otherwise run first and still see the outgoing control's registration.\n useIsoLayoutEffect(() => {\n return unregisterControlId;\n }, [unregisterControlId]);\n\n // The provider's id wins until registration runs: the label renders `htmlFor` from the\n // provider's pre-registration state, so preempting it with an explicit `id` here would\n // leave the pair unassociated in server-rendered markup.\n return (enabled ? controlId : undefined) ?? id ?? defaultId;\n}","'use client';\n\nimport { useId } from '@base-ui/utils/useId';\n\n/**\n * Wraps `useId` and prefixes generated `id`s with `base-ui-`\n * @param {string | undefined} idOverride overrides the generated id when provided\n * @returns {string | undefined}\n */\nexport function useBaseUiId(idOverride) {\n return useId(idOverride, 'base-ui');\n}","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\n/**\n * A context for providing [labelable elements](https://html.spec.whatwg.org/multipage/forms.html#category-label)\\\n * with an accessible name (label) and description.\n */\nexport const LabelableContext = /*#__PURE__*/React.createContext({\n controlId: undefined,\n registerControlId: NOOP,\n resetControlId: NOOP,\n labelId: undefined,\n setLabelId: NOOP,\n messageIds: [],\n setMessageIds: NOOP,\n getDescriptionProps: externalProps => externalProps\n});\nif (process.env.NODE_ENV !== \"production\") LabelableContext.displayName = \"LabelableContext\";\nexport function useLabelableContext() {\n return React.useContext(LabelableContext);\n}","// https://github.com/mui/mui-x/blob/master/packages/x-internals/src/fastArrayCompare/fastArrayCompare.ts\n\n/**\n * Compares two arrays element-wise.\n *\n * The default comparison is `Object.is`, so `NaN` equals `NaN` and `0` does not equal `-0`.\n */\nexport function areArraysEqual(array1, array2, itemComparer = Object.is) {\n const {\n length\n } = array1;\n if (length !== array2.length) {\n return false;\n }\n for (let i = 0; i < length; i += 1) {\n if (!itemComparer(array1[i], array2[i])) {\n return false;\n }\n }\n return true;\n}","import { areArraysEqual } from '@base-ui/utils/areArraysEqual';\n// Compared by identity in `findSelectionIndex`; don't wrap it.\nexport const defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue);\nexport function compareItemEquality(itemValue, selectedValue, comparer) {\n if (itemValue == null || selectedValue == null) {\n return Object.is(itemValue, selectedValue);\n }\n return comparer(itemValue, selectedValue);\n}\nexport function isSelectedValueDirty(currentValue, initialValue, comparer) {\n if (Array.isArray(currentValue) && Array.isArray(initialValue)) {\n return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, comparer));\n }\n return currentValue !== initialValue;\n}\nexport function selectedValueIncludes(selectedValues, itemValue, comparer) {\n if (!selectedValues) {\n return false;\n }\n return selectedValues.some(selectedValue => {\n if (selectedValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\nexport function findItemIndex(itemValues, selectedValue, comparer) {\n if (!itemValues) {\n return -1;\n }\n return itemValues.findIndex(itemValue => {\n if (itemValue === undefined) {\n return false;\n }\n return compareItemEquality(itemValue, selectedValue, comparer);\n });\n}\n\n// The default comparer is `Object.is`, so the values can be indexed instead of rescanned\n// for every item. A custom comparer may match values that don't hash alike.\nfunction createSelectionMatcher(selectedValues, comparer) {\n if (comparer !== defaultItemEquality) {\n return itemValue => selectedValueIncludes(selectedValues, itemValue, comparer);\n }\n const index = new Set(selectedValues);\n index.delete(undefined);\n // `Set` treats +0 and -0 as equal; `Object.is` does not.\n return itemValue => index.has(itemValue) && (itemValue !== 0 || selectedValues.some(v => Object.is(itemValue, v)));\n}\nexport function findSelectionIndex(itemValues, selectedValue, comparer, multiple) {\n // Only treat the value as a list in multiple mode: an array can itself be a valid\n // single-select value.\n const index = multiple && Array.isArray(selectedValue) ?\n // Anchor to the first selected item in rendered order so the index does not depend\n // on the order in which the values were added to the array.\n itemValues.findIndex(createSelectionMatcher(selectedValue, comparer)) : findItemIndex(itemValues, selectedValue, comparer);\n return index === -1 ? null : index;\n}\n\n/** Resolves the first selected index as items register or change. */\nexport function resolveSelectedIndex(index, itemValue, registry, selectedValues, comparer, currentIndex) {\n if (selectedValueIncludes(selectedValues, itemValue, comparer)) {\n // A later item only takes over once the current anchor stops being selected.\n return currentIndex != null && index > currentIndex && selectedValueIncludes(selectedValues, registry[currentIndex], comparer) ? currentIndex : index;\n }\n // The holder re-elects the anchor once it stops being selected.\n return index === currentIndex ? findSelectionIndex(registry, selectedValues, comparer, true) : currentIndex;\n}\nexport function removeItem(selectedValues, itemValue, comparer) {\n return selectedValues.filter(selectedValue => !compareItemEquality(itemValue, selectedValue, comparer));\n}","'use client';\n\nimport * as React from 'react';\nimport { serializeValue } from \"./serializeValue.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction isGroup(item) {\n return typeof item === 'object' && item != null && Array.isArray(item.items);\n}\nexport function isGroupedItems(items) {\n // A group must carry an actual `items` array: key presence alone would misclassify an item\n // with an unrelated or optional `items` field.\n return isGroup(items?.[0]);\n}\nexport function flattenLeafItems(items) {\n return isGroupedItems(items) ? items.flatMap(group => group.items) : items;\n}\n\n/**\n * Checks if the items array contains an item with a null value that has a non-null label.\n */\nexport function hasNullItemLabel(items) {\n if (!Array.isArray(items)) {\n return items != null && 'null' in items;\n }\n const arrayItems = items;\n if (isGroupedItems(arrayItems)) {\n for (const group of arrayItems) {\n for (const item of group.items) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n }\n return false;\n }\n for (const item of arrayItems) {\n if (item && item.value == null && item.label != null) {\n return true;\n }\n }\n return false;\n}\nexport function stringifyAsLabel(item, itemToStringLabel) {\n if (itemToStringLabel && item != null) {\n return itemToStringLabel(item) ?? '';\n }\n if (item && typeof item === 'object') {\n if ('label' in item && item.label != null) {\n return String(item.label);\n }\n if ('value' in item) {\n return String(item.value);\n }\n }\n return serializeValue(item);\n}\nexport function stringifyAsValue(item, itemToStringValue) {\n if (itemToStringValue && item != null) {\n return itemToStringValue(item) ?? '';\n }\n if (item && typeof item === 'object' && 'value' in item && 'label' in item) {\n return serializeValue(item.value);\n }\n return serializeValue(item);\n}\nexport function resolveSelectedLabel(value, items, itemToStringLabel) {\n function fallback() {\n return stringifyAsLabel(value, itemToStringLabel);\n }\n if (itemToStringLabel && value != null) {\n return itemToStringLabel(value);\n }\n\n // Custom object with explicit label takes precedence\n if (value && typeof value === 'object' && 'label' in value && value.label != null) {\n return value.label;\n }\n\n // Items provided as plain record map\n if (items && !Array.isArray(items)) {\n const label = Object.hasOwn(items, value) ? items[value] : undefined;\n return label ?? fallback();\n }\n\n // Items provided as array (flat or grouped)\n if (Array.isArray(items)) {\n const arrayItems = items;\n const flatItems = flattenLeafItems(arrayItems);\n if (value == null || typeof value !== 'object') {\n const match = flatItems.find(item => item.value === value);\n if (match && match.label != null) {\n return match.label;\n }\n return fallback();\n }\n\n // Object without explicit label: try matching by its `value` property\n if ('value' in value) {\n const match = flatItems.find(item => item && item.value === value.value);\n if (match && match.label != null) {\n return match.label;\n }\n }\n }\n return fallback();\n}\nexport function resolveMultipleLabels(values, items, itemToStringLabel) {\n return values.reduce((acc, value, index) => {\n if (index > 0) {\n acc.push(', ');\n }\n acc.push(/*#__PURE__*/_jsx(React.Fragment, {\n children: resolveSelectedLabel(value, items, itemToStringLabel)\n }, index));\n return acc;\n }, []);\n}","export function serializeValue(value) {\n if (value == null) {\n return '';\n }\n if (typeof value === 'string') {\n return value;\n }\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}","import { compareItemEquality } from \"../internals/itemEquality.mjs\";\nimport { hasNullItemLabel, stringifyAsValue } from \"../internals/resolveValueLabel.mjs\";\n\n/**\n * Non-reactive values shared with the select parts. Nothing here is observable through\n * `selectors`, so writing to a ref never notifies subscribers.\n */\n\nexport const selectors = {\n id: state => state.id,\n labelId: state => state.labelId,\n modal: state => state.modal,\n items: state => state.items,\n itemToStringLabel: state => state.itemToStringLabel,\n isItemEqualToValue: state => state.isItemEqualToValue,\n value: state => state.value,\n hasSelectedValue: state => {\n const {\n value,\n multiple,\n itemToStringValue\n } = state;\n if (value == null) {\n return false;\n }\n if (multiple && Array.isArray(value)) {\n return value.length > 0;\n }\n return stringifyAsValue(value, itemToStringValue) !== '';\n },\n hasNullItemLabel: (state, enabled) => {\n return enabled ? hasNullItemLabel(state.items) : false;\n },\n open: state => state.open,\n mounted: state => state.mounted,\n forceMount: state => state.forceMount,\n transitionStatus: state => state.transitionStatus,\n openMethod: state => state.openMethod,\n activeIndex: state => state.activeIndex,\n selectedIndex: state => state.selectedIndex,\n isActive: (state, index) => state.activeIndex === index,\n isSelected: (state, itemValue) => {\n const comparer = state.isItemEqualToValue;\n const storeValue = state.value;\n if (state.multiple) {\n return Array.isArray(storeValue) && storeValue.some(selectedItem => compareItemEquality(itemValue, selectedItem, comparer));\n }\n\n // The value is the source of truth: a stale `selectedIndex` (e.g. the controlled\n // value changes while the popup is open, where the index sync is deferred) must not\n // keep a previously selected item marked as selected.\n return compareItemEquality(itemValue, storeValue, comparer);\n },\n isSelectedByFocus: (state, index) => {\n return state.selectedIndex === index;\n },\n popupProps: state => state.popupProps,\n triggerProps: state => state.triggerProps,\n triggerElement: state => state.triggerElement,\n positionerElement: state => state.positionerElement,\n listElement: state => state.listElement,\n popupSide: state => state.popupSide,\n scrollUpArrowVisible: state => state.scrollUpArrowVisible,\n scrollDownArrowVisible: state => state.scrollDownArrowVisible,\n hasScrollArrows: state => state.hasScrollArrows\n};","'use client';\n\nimport * as React from 'react';\nimport { NOOP } from \"../noop.mjs\";\nexport const FormContext = /*#__PURE__*/React.createContext({\n elementRef: {\n current: null\n },\n formRef: {\n current: {\n fields: new Map()\n }\n },\n errors: {},\n clearErrors: NOOP,\n validationMode: 'onSubmit',\n submitCountRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") FormContext.displayName = \"FormContext\";\nexport function useFormContext() {\n return React.useContext(FormContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nexport function useValueChanged(value, onChange) {\n const valueRef = React.useRef(value);\n const onChangeCallback = useStableCallback(onChange);\n useIsoLayoutEffect(() => {\n if (valueRef.current !== value) {\n onChangeCallback(valueRef.current);\n }\n valueRef.current = value;\n }, [value, onChangeCallback]);\n}","'use client';\n\nimport * as React from 'react';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useEnhancedClickHandler } from '@base-ui/utils/useEnhancedClickHandler';\nimport { platform } from '@base-ui/utils/platform';\nimport { useValueChanged } from \"../internals/useValueChanged.mjs\";\nexport function useOpenMethodTriggerProps(open, setOpenMethod) {\n const handleTriggerClick = useStableCallback((_, interactionType) => {\n const isOpen = typeof open === 'function' ? open() : open;\n if (!isOpen) {\n setOpenMethod(interactionType || (\n // On iOS Safari, the hitslop around touch targets means tapping outside an element's\n // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType`\n // will be \"\" in that case.\n platform.os.ios ? 'touch' : ''));\n }\n });\n const {\n onClick,\n onPointerDown\n } = useEnhancedClickHandler(handleTriggerClick);\n return React.useMemo(() => ({\n onClick,\n onPointerDown\n }), [onClick, onPointerDown]);\n}\n\n/**\n * Determines the interaction type (keyboard, mouse, touch, etc.) that opened the component.\n *\n * @param open The open state of the component.\n */\nexport function useOpenInteractionType(open) {\n const [openMethod, setOpenMethod] = React.useState(null);\n const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod);\n useValueChanged(open, previousOpen => {\n if (previousOpen && !open) {\n setOpenMethod(null);\n }\n });\n return React.useMemo(() => ({\n openMethod,\n triggerProps\n }), [openMethod, triggerProps]);\n}","'use client';\n\nimport * as React from 'react';\n/**\n * Provides a cross-browser way to determine the type of the pointer used to click.\n * Safari and Firefox do not provide the PointerEvent to the click handler (they use MouseEvent) yet.\n * Additionally, this implementation detects if the click was triggered by the keyboard.\n *\n * @param handler The function to be called when the button is clicked. The first parameter is the original event and the second parameter is the pointer type.\n */\nexport function useEnhancedClickHandler(handler) {\n const lastClickInteractionTypeRef = React.useRef('');\n const handlePointerDown = React.useCallback(event => {\n if (event.defaultPrevented) {\n return;\n }\n lastClickInteractionTypeRef.current = event.pointerType;\n handler(event, event.pointerType);\n }, [handler]);\n const handleClick = React.useCallback(event => {\n // event.detail has the number of clicks performed on the element. 0 means it was triggered by the keyboard.\n if (event.detail === 0) {\n handler(event, 'keyboard');\n return;\n }\n if ('pointerType' in event) {\n // Chrome and Edge correctly use PointerEvent\n handler(event, event.pointerType);\n } else {\n handler(event, lastClickInteractionTypeRef.current);\n }\n lastClickInteractionTypeRef.current = '';\n }, [handler]);\n return {\n onClick: handleClick,\n onPointerDown: handlePointerDown\n };\n}","export function clamp(val, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {\n return Math.max(min, Math.min(val, max));\n}","import { clamp } from '@base-ui/utils/clamp';\nexport const SCROLL_EDGE_TOLERANCE_PX = 1;\nexport function getMaxScrollOffset(scrollSize, clientSize) {\n return Math.max(0, scrollSize - clientSize);\n}\nexport function normalizeScrollOffset(value, max) {\n if (max <= 0) {\n return 0;\n }\n const clamped = clamp(value, 0, max);\n const startDistance = clamped;\n const endDistance = max - clamped;\n const withinStartTolerance = startDistance <= SCROLL_EDGE_TOLERANCE_PX;\n const withinEndTolerance = endDistance <= SCROLL_EDGE_TOLERANCE_PX;\n if (withinStartTolerance && withinEndTolerance) {\n return startDistance <= endDistance ? 0 : max;\n }\n if (withinStartTolerance) {\n return 0;\n }\n if (withinEndTolerance) {\n return max;\n }\n return clamped;\n}","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport { useLabel } from \"../../internals/labelable-provider/useLabel.mjs\";\nimport { getDefaultLabelId } from \"../../utils/resolveAriaLabelledBy.mjs\";\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\n\n/**\n * An accessible label that is automatically associated with the select trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectLabel = /*#__PURE__*/React.forwardRef(function SelectLabel(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n // Keep label id derived from the root and ignore runtime `id` overrides from untyped consumers.\n const elementPropsWithoutId = elementProps;\n delete elementPropsWithoutId.id;\n const fieldRootContext = useFieldRootContext();\n const store = useSelectRootContext();\n const triggerElement = store.useState('triggerElement');\n const rootId = store.useState('id');\n const defaultLabelId = getDefaultLabelId(rootId);\n const labelProps = useLabel({\n id: defaultLabelId,\n fallbackControlId: triggerElement?.id ?? rootId,\n setLabelId(nextLabelId) {\n const resolvedLabelId = typeof nextLabelId === 'function' ? nextLabelId(store.state.labelId) : nextLabelId;\n store.set('labelId', resolvedLabelId);\n }\n });\n return useRenderElement('div', componentProps, {\n ref: forwardedRef,\n state: fieldRootContext.state,\n props: [labelProps, elementProps],\n stateAttributesMapping: fieldValidityMapping\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectLabel.displayName = \"SelectLabel\";","'use client';\n\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../internals/useBaseUiId.mjs\";\nexport function useRegisteredLabelId(idProp, setLabelId) {\n const id = useBaseUiId(idProp);\n useIsoLayoutEffect(() => {\n setLabelId(id);\n return () => {\n setLabelId(currentId => currentId === id ? undefined : currentId);\n };\n }, [id, setLabelId]);\n return id;\n}","'use client';\n\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { useRegisteredLabelId } from \"../../utils/useRegisteredLabelId.mjs\";\nimport { useLabelableContext } from \"./LabelableContext.mjs\";\nexport function useLabel(params = {}) {\n const {\n id: idProp,\n fallbackControlId,\n native = false,\n setLabelId: setLabelIdProp,\n focusControl: focusControlProp\n } = params;\n const {\n controlId: contextControlId,\n setLabelId: setContextLabelId\n } = useLabelableContext();\n const syncLabelId = useStableCallback(nextLabelId => {\n setContextLabelId(nextLabelId);\n setLabelIdProp?.(nextLabelId);\n });\n const id = useRegisteredLabelId(idProp, syncLabelId);\n const resolvedControlId = contextControlId ?? fallbackControlId;\n function focusControl(event) {\n if (focusControlProp) {\n focusControlProp(event, resolvedControlId);\n return;\n }\n if (!resolvedControlId) {\n return;\n }\n const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId);\n if (isHTMLElement(controlElement)) {\n focusElementWithVisible(controlElement);\n }\n }\n function handleInteraction(event) {\n const target = getTarget(event.nativeEvent);\n if (target?.closest('button,input,select,textarea')) {\n return;\n }\n\n // Prevent text selection when double clicking label.\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault();\n }\n if (native) {\n return;\n }\n focusControl(event);\n }\n return native ? {\n id,\n htmlFor: resolvedControlId,\n onMouseDown: handleInteraction\n } : {\n id,\n onClick: handleInteraction,\n onPointerDown(event) {\n event.preventDefault();\n }\n };\n}\nexport function focusElementWithVisible(element) {\n element.focus({\n // Available from Chrome 144+ (January 2026).\n // Safari and Firefox already support it.\n focusVisible: true\n });\n}","'use client';\n\nexport function getDefaultLabelId(id) {\n return id == null ? undefined : `${id}-label`;\n}\nexport function resolveAriaLabelledBy(fieldLabelId, localLabelId) {\n return fieldLabelId ?? localLabelId;\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useSelectRootContext, useSelectRootPropsContext } from \"../root/SelectRootContext.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { isMouseWithinBounds } from \"../../utils/getPseudoElementBounds.mjs\";\nimport { contains, getFloatingFocusElement } from \"../../floating-ui-react/utils.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { resolveAriaLabelledBy } from \"../../utils/resolveAriaLabelledBy.mjs\";\nimport * as SelectTriggerDataAttributes from \"./SelectTriggerDataAttributes.mjs\";\nconst SELECTED_DELAY = 400;\nconst stateAttributesMapping = {\n ...pressableTriggerOpenStateMapping,\n ...fieldValidityMapping,\n popupSide: side => side ? {\n [SelectTriggerDataAttributes.popupSide]: side\n } : null,\n value: () => null\n};\n\n/**\n * A button that opens the select popup.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n id: idProp,\n disabled: disabledProp = false,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n setTouched,\n setFocused,\n validationMode,\n validation,\n state: fieldState,\n disabled: fieldDisabled\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const store = useSelectRootContext();\n const {\n readOnly,\n required,\n disabled: selectDisabled\n } = useSelectRootPropsContext();\n const disabled = fieldDisabled || selectDisabled || disabledProp;\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const value = store.useState('value');\n const triggerProps = store.useState('triggerProps');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const popupSideValue = store.useState('popupSide');\n const rootId = store.useState('id');\n const selectLabelId = store.useState('labelId');\n const hasSelectedValue = store.useState('hasSelectedValue');\n const popupSide = mounted && positionerElement ? popupSideValue : null;\n const id = idProp ?? rootId;\n const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);\n useLabelableId({\n id: idProp\n });\n const positionerRef = useValueAsRef(positionerElement);\n const triggerRef = React.useRef(null);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const setTriggerElement = store.useStateSetter('triggerElement');\n const timeoutFocus = useTimeout();\n const timeoutMouseDown = useTimeout();\n const selectedDelayTimeout = useTimeout();\n React.useEffect(() => {\n if (open) {\n // A mousedown on the trigger can open the popup under the cursor. Keep mouseup selection\n // disabled briefly so releasing over either the selected item or a neighboring item doesn't\n // commit an accidental selection. SelectItem can still opt into unselected mouseup sooner\n // after a real drag over the item.\n selectedDelayTimeout.start(SELECTED_DELAY, () => {\n store.context.selectionRef.current.allowUnselectedMouseUp = true;\n store.context.selectionRef.current.allowSelectedMouseUp = true;\n });\n return () => {\n selectedDelayTimeout.clear();\n };\n }\n store.context.selectionRef.current = {\n allowSelectedMouseUp: false,\n allowUnselectedMouseUp: false,\n dragY: 0\n };\n timeoutMouseDown.clear();\n return undefined;\n }, [open, store, timeoutMouseDown, selectedDelayTimeout]);\n const mergedProps = mergeProps(triggerProps, {\n id,\n role: 'combobox',\n 'aria-expanded': open,\n 'aria-haspopup': 'listbox',\n 'aria-controls': open ? listElement?.id ?? getFloatingFocusElement(positionerElement)?.id : undefined,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n tabIndex: disabled ? -1 : 0,\n onFocus(event) {\n setFocused(true);\n\n // The popup element shouldn't obscure the focused trigger.\n if (open && store.context.alignItemWithTriggerActiveRef.current) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.none, event.nativeEvent));\n }\n\n // Saves a re-render on initial click: `forceMount === true` mounts\n // the items before `open === true`. We could sync those cycles better\n // without a timeout, but this is enough for now.\n timeoutFocus.start(0, () => {\n store.set('forceMount', true);\n });\n },\n onBlur(event) {\n // If focus is moving into the popup, don't count it as a blur.\n if (contains(positionerElement, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(value);\n }\n },\n onMouseDown(event) {\n if (open) {\n return;\n }\n const doc = ownerDocument(event.currentTarget);\n function handleMouseUp(mouseEvent) {\n if (!triggerRef.current) {\n return;\n }\n const mouseUpTarget = mouseEvent.target;\n\n // Don't treat the release as an outside press when it lands on the trigger or inside\n // the popup positioner (or their children).\n if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget)) {\n return;\n }\n if (isMouseWithinBounds(mouseEvent, triggerRef.current)) {\n return;\n }\n store.context.setOpen(false, createChangeEventDetails(REASONS.cancelOpen, mouseEvent));\n }\n\n // Firefox can fire this upon mousedown\n timeoutMouseDown.start(0, () => {\n doc.addEventListener('mouseup', handleMouseUp, {\n once: true\n });\n });\n }\n }, elementProps, getButtonProps);\n const props = validation.getValidationProps(disabled, mergedProps);\n\n // ensure nested useButton does not overwrite the combobox role:\n // <Toolbar.Button render={<Select.Trigger />} />\n props.role = 'combobox';\n const state = {\n ...fieldState,\n open,\n disabled,\n value,\n readOnly,\n popupSide,\n placeholder: !hasSelectedValue\n };\n return useRenderElement('button', componentProps, {\n ref: [forwardedRef, triggerRef, buttonRef, setTriggerElement],\n state,\n stateAttributesMapping,\n props\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectTrigger.displayName = \"SelectTrigger\";","import { ownerWindow } from '@base-ui/utils/owner';\nimport { platform } from '@base-ui/utils/platform';\n// Tolerance around the element bounds so a fast click whose pointer drifts slightly\n// during press-release isn't mistaken for a drag-off-and-release cancellation.\n// Matches typical OS/browser drag-initiation thresholds.\nconst BOUNDARY_OFFSET = 5;\n\n/**\n * Determines if a mouse event occurred within the bounds of an element\n * (including its pseudo-elements), with a small tolerance for pointer drift.\n */\nexport function isMouseWithinBounds(event, element) {\n const bounds = getPseudoElementBounds(element);\n return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;\n}\nexport function getPseudoElementBounds(element) {\n const elementRect = element.getBoundingClientRect();\n const win = ownerWindow(element);\n\n // Avoid \"Not implemented: window.getComputedStyle(elt, pseudoElt)\" in jsdom.\n if (platform.env.jsdom) {\n return elementRect;\n }\n const beforeStyles = win.getComputedStyle(element, '::before');\n const afterStyles = win.getComputedStyle(element, '::after');\n const hasPseudoElements = beforeStyles.content !== 'none' || afterStyles.content !== 'none';\n if (!hasPseudoElements) {\n return elementRect;\n }\n\n // Get dimensions of pseudo-elements\n const beforeWidth = parseFloat(beforeStyles.width) || 0;\n const beforeHeight = parseFloat(beforeStyles.height) || 0;\n const afterWidth = parseFloat(afterStyles.width) || 0;\n const afterHeight = parseFloat(afterStyles.height) || 0;\n\n // Calculate max dimensions including pseudo-elements\n const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);\n const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);\n\n // Calculate the differences to extend the bounds\n const widthDiff = totalWidth - elementRect.width;\n const heightDiff = totalHeight - elementRect.height;\n return {\n left: elementRect.left - widthDiff / 2,\n right: elementRect.right + widthDiff / 2,\n top: elementRect.top - heightDiff / 2,\n bottom: elementRect.bottom + heightDiff / 2\n };\n}","import { CommonTriggerDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the corresponding select is open.\n */\nexport const popupOpen = CommonTriggerDataAttributes.popupOpen;\n/**\n * Present when the trigger is pressed.\n */\nexport const pressed = CommonTriggerDataAttributes.pressed;\n/**\n * Present when the select is disabled.\n */\nexport const disabled = 'data-disabled';\n/**\n * Present when the select is readonly.\n */\nexport const readonly = 'data-readonly';\n/**\n * Indicates which side the corresponding popup is positioned relative to its anchor.\n * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start' | null}\n */\nexport const popupSide = 'data-popup-side';\n/**\n * Present when the select is required.\n */\nexport const required = 'data-required';\n/**\n * Present when the select is in a valid state (when wrapped in Field.Root).\n */\nexport const valid = 'data-valid';\n/**\n * Present when the select is in an invalid state (when wrapped in Field.Root).\n */\nexport const invalid = 'data-invalid';\n/**\n * Present when the select has been touched (when wrapped in Field.Root).\n */\nexport const touched = 'data-touched';\n/**\n * Present when the select's value has changed (when wrapped in Field.Root).\n */\nexport const dirty = 'data-dirty';\n/**\n * Present when the select has a value (when wrapped in Field.Root).\n */\nexport const filled = 'data-filled';\n/**\n * Present when the select trigger is focused (when wrapped in Field.Root).\n */\nexport const focused = 'data-focused';\n/**\n * Present when the select doesn't have a value.\n */\nexport const placeholder = 'data-placeholder';","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { resolveMultipleLabels, resolveSelectedLabel } from \"../../internals/resolveValueLabel.mjs\";\nconst stateAttributesMapping = {\n value: () => null\n};\n\n/**\n * A text label of the currently selected item.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectValue = /*#__PURE__*/React.forwardRef(function SelectValue(componentProps, forwardedRef) {\n const {\n className,\n render,\n children: childrenProp,\n placeholder,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const value = store.useState('value');\n const items = store.useState('items');\n const itemToStringLabel = store.useState('itemToStringLabel');\n const hasSelectedValue = store.useState('hasSelectedValue');\n const shouldCheckNullItemLabel = !hasSelectedValue && placeholder != null && childrenProp == null;\n const hasNullLabel = store.useState('hasNullItemLabel', shouldCheckNullItemLabel);\n const state = {\n value,\n placeholder: !hasSelectedValue\n };\n let children = null;\n if (typeof childrenProp === 'function') {\n children = childrenProp(value);\n } else if (childrenProp != null) {\n children = childrenProp;\n } else if (shouldCheckNullItemLabel && !hasNullLabel) {\n children = placeholder;\n } else if (Array.isArray(value)) {\n children = resolveMultipleLabels(value, items, itemToStringLabel);\n } else {\n children = resolveSelectedLabel(value, items, itemToStringLabel);\n }\n const element = useRenderElement('span', componentProps, {\n state,\n ref: [forwardedRef, store.context.valueRef],\n props: [{\n children\n }, elementProps],\n stateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectValue.displayName = \"SelectValue\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { triggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * An icon that indicates that the trigger button opens a select popup.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectIcon = /*#__PURE__*/React.forwardRef(function SelectIcon(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const open = store.useState('open');\n const state = {\n open\n };\n const element = useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n props: [{\n 'aria-hidden': true,\n children: '▼'\n }, elementProps],\n stateAttributesMapping: triggerOpenStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectIcon.displayName = \"SelectIcon\";","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectPortal = /*#__PURE__*/React.forwardRef(function SelectPortal(portalProps, forwardedRef) {\n const store = useSelectRootContext();\n const mounted = store.useState('mounted');\n const forceMount = store.useState('forceMount');\n const shouldRender = mounted || forceMount;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectPortal.displayName = \"SelectPortal\";","'use client';\n\nimport * as React from 'react';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nconst stateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * An overlay displayed beneath the select popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectBackdrop = /*#__PURE__*/React.forwardRef(function SelectBackdrop(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const transitionStatus = store.useState('transitionStatus');\n const state = {\n open,\n transitionStatus\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: [{\n role: 'presentation',\n hidden: !mounted,\n style: {\n userSelect: 'none',\n WebkitUserSelect: 'none'\n }\n }, elementProps],\n stateAttributesMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectBackdrop.displayName = \"SelectBackdrop\";","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useSelectFloatingContext, useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { CompositeList } from \"../../internals/composite/list/CompositeList.mjs\";\nimport { useAnchorPositioning } from \"../../internals/useAnchorPositioning.mjs\";\nimport { SelectPositionerContext } from \"./SelectPositionerContext.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\nimport { DROPDOWN_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { clearStyles } from \"../popup/utils.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { findItemIndex } from \"../../internals/itemEquality.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { useAnchoredPopupScrollLock } from \"../../utils/useAnchoredPopupScrollLock.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst FIXED = {\n position: 'fixed'\n};\n\n/**\n * Positions the select popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectPositioner = /*#__PURE__*/React.forwardRef(function SelectPositioner(componentProps, forwardedRef) {\n const {\n anchor,\n className,\n render,\n // `useAnchorPositioning` applies the same defaults to the undefined values; the names\n // remain destructured to exclude the props from `elementProps`.\n positionMethod,\n side,\n align,\n sideOffset,\n alignOffset,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding,\n arrowPadding,\n sticky,\n disableAnchorTracking,\n alignItemWithTrigger = true,\n collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const floatingRootContext = useSelectFloatingContext();\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const modal = store.useState('modal');\n const value = store.useState('value');\n const openMethod = store.useState('openMethod');\n const positionerElement = store.useState('positionerElement');\n const triggerElement = store.useState('triggerElement');\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const transitionStatus = store.useState('transitionStatus');\n const scrollUpArrowRef = React.useRef(null);\n const scrollDownArrowRef = React.useRef(null);\n const [controlledAlignItemWithTrigger, setControlledAlignItemWithTrigger] = React.useState(alignItemWithTrigger);\n const alignItemWithTriggerActive = mounted && controlledAlignItemWithTrigger && openMethod !== 'touch';\n if (!mounted && controlledAlignItemWithTrigger !== alignItemWithTrigger) {\n setControlledAlignItemWithTrigger(alignItemWithTrigger);\n }\n React.useImperativeHandle(store.context.alignItemWithTriggerActiveRef, () => alignItemWithTriggerActive);\n useAnchoredPopupScrollLock((alignItemWithTriggerActive || modal) && open, openMethod === 'touch', positionerElement, triggerElement);\n const positioning = useAnchorPositioning({\n anchor,\n floatingRootContext,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking: disableAnchorTracking ?? alignItemWithTriggerActive,\n collisionAvoidance,\n keepMounted: true\n });\n const renderedSide = alignItemWithTriggerActive ? 'none' : positioning.side;\n const positionerStyles = alignItemWithTriggerActive ? FIXED : positioning.positionerStyles;\n const state = {\n open,\n side: renderedSide,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden\n };\n useIsoLayoutEffect(() => {\n store.set('popupSide', positioning.side);\n }, [store, positioning.side]);\n const setPositionerElement = store.useStateSetter('positionerElement');\n const element = usePositioner(componentProps, state, {\n styles: positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n const prevMapSizeRef = React.useRef(0);\n const onMapChange = useStableCallback(map => {\n if (store.context.valuesRef.current.length === 0) {\n return;\n }\n const prevSize = prevMapSizeRef.current;\n prevMapSizeRef.current = map.size;\n const eventDetails = createChangeEventDetails(REASONS.none);\n if (prevSize !== 0 && !store.state.multiple && value !== null) {\n const selectedValueIndex = findItemIndex(store.context.valuesRef.current, value, isItemEqualToValue);\n if (selectedValueIndex === -1) {\n const initialSelectedValue = store.context.initialValueRef.current;\n const hasInitial = initialSelectedValue != null && findItemIndex(store.context.valuesRef.current, initialSelectedValue, isItemEqualToValue) !== -1;\n const nextValue = hasInitial ? initialSelectedValue : null;\n store.context.setValue(nextValue, eventDetails);\n if (nextValue === null) {\n store.set('selectedIndex', null);\n store.context.selectedItemTextRef.current = null;\n }\n }\n }\n if (prevSize !== 0 && store.state.multiple && Array.isArray(value)) {\n const nextValue = value.filter(selectedItemValue => findItemIndex(store.context.valuesRef.current, selectedItemValue, isItemEqualToValue) !== -1);\n if (nextValue.length !== value.length) {\n store.context.setValue(nextValue, eventDetails);\n if (nextValue.length === 0) {\n store.set('selectedIndex', null);\n store.context.selectedItemTextRef.current = null;\n }\n }\n }\n if (open && alignItemWithTriggerActive) {\n store.update({\n scrollUpArrowVisible: false,\n scrollDownArrowVisible: false\n });\n const stylesToClear = {\n height: ''\n };\n clearStyles(positionerElement, stylesToClear);\n clearStyles(store.context.popupRef.current, stylesToClear);\n }\n });\n const contextValue = React.useMemo(() => ({\n ...positioning,\n side: renderedSide,\n alignItemWithTriggerActive,\n setControlledAlignItemWithTrigger,\n scrollUpArrowRef,\n scrollDownArrowRef\n }), [positioning, renderedSide, alignItemWithTriggerActive, setControlledAlignItemWithTrigger]);\n return /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: store.context.listRef,\n labelsRef: store.context.labelsRef,\n onMapChange: onMapChange,\n children: /*#__PURE__*/_jsxs(SelectPositionerContext.Provider, {\n value: contextValue,\n children: [mounted && modal && /*#__PURE__*/_jsx(InternalBackdrop, {\n inert: inertValue(!open),\n cutout: triggerElement\n }), element]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectPositioner.displayName = \"SelectPositioner\";","import { isReactVersionAtLeast } from \"./reactVersion.mjs\";\nexport function inertValue(value) {\n if (isReactVersionAtLeast(19)) {\n return value;\n }\n // compatibility with React < 19\n return value ? 'true' : undefined;\n}","/* eslint-disable no-bitwise */\n'use client';\n\nimport * as React from 'react';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { CompositeListContext } from \"./CompositeListContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Provides context for a list of items in a composite component.\n */\nexport function CompositeList(props) {\n const {\n children,\n elementsRef,\n labelsRef,\n onMapChange: onMapChangeProp\n } = props;\n const onMapChange = useStableCallback(onMapChangeProp);\n const [, setMapTick] = React.useState(false);\n const listeners = useRefWithInit(createListeners).current;\n const map = useRefWithInit(createMap).current;\n const nextIndexRef = React.useRef(0);\n const isDirtyRef = React.useRef(true);\n const itemsRef = React.useRef(null);\n const mutationObserverRef = React.useRef(null);\n\n // Item effects can run without their parent rendering. Schedule one synchronous\n // parent update for the whole commit so refs are rebuilt before paint and while\n // the originating React event is still inside `act()` in tests.\n const scheduleMapUpdate = useStableCallback(() => {\n if (isDirtyRef.current) {\n return;\n }\n isDirtyRef.current = true;\n setMapTick(tick => !tick);\n });\n const register = useStableCallback((node, registration) => {\n map.set(node, registration);\n scheduleMapUpdate();\n });\n const unregister = useStableCallback(node => {\n map.delete(node);\n scheduleMapUpdate();\n });\n const syncRefs = useStableCallback(items => {\n const nextMap = new Map();\n elementsRef.current.length = 0;\n if (labelsRef) {\n labelsRef.current.length = 0;\n }\n items.forEach(item => {\n nextMap.set(item.element, {\n ...(item.registration.metadata ?? {}),\n index: item.index\n });\n elementsRef.current[item.index] = item.element;\n if (labelsRef) {\n labelsRef.current[item.index] = item.registration.label !== undefined ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent;\n }\n });\n nextIndexRef.current = elementsRef.current.length;\n return nextMap;\n });\n function observe(sortedNodes) {\n mutationObserverRef.current?.disconnect();\n mutationObserverRef.current = null;\n\n // A single item can't reorder.\n if (typeof MutationObserver !== 'function' || sortedNodes.length < 2) {\n return;\n }\n const mutationObserver = new MutationObserver(entries => {\n // Only verify the order after a move: a node that was removed and later\n // re-added within the same batch. Additions and removals alone can't\n // change the relative order of the remaining items, and items that mount\n // or unmount re-sort through `register`/`unregister`.\n if (!hasMovedNode(entries)) {\n return;\n }\n let previousConnectedNode = null;\n\n // If any connected node now appears before the previous connected node,\n // wrappers/items moved and the index map needs to be rebuilt.\n for (const node of sortedNodes) {\n if (!node.isConnected) {\n continue;\n }\n if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) {\n mutationObserver.disconnect();\n scheduleMapUpdate();\n return;\n }\n previousConnectedNode = node;\n }\n });\n mutationObserverRef.current = mutationObserver;\n\n // A reorder that changes item indexes must invert at least one adjacent pair\n // from the previous sorted order. Observing each pair's common parent catches\n // both direct item moves and ancestor wrapper moves at the boundary.\n const roots = new Set();\n for (let i = 1; i < sortedNodes.length; i += 1) {\n const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]);\n if (root) {\n roots.add(root);\n }\n }\n roots.forEach(root => mutationObserver.observe(root, {\n childList: true\n }));\n }\n const flush = useStableCallback(() => {\n const [items, automaticNodes] = getCompositeListSnapshot(map);\n const nextMap = syncRefs(items);\n const previousItems = itemsRef.current;\n const changed = !previousItems || previousItems.length !== items.length || items.some((item, index) => {\n const previousItem = previousItems[index];\n return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata;\n });\n observe(automaticNodes);\n itemsRef.current = items;\n isDirtyRef.current = false;\n if (!changed) {\n return;\n }\n listeners.forEach(listener => listener(nextMap));\n onMapChange(nextMap);\n });\n useIsoLayoutEffect(() => {\n // Re-copy the last committed snapshot when the ref objects change or Strict Mode replays\n // effects without reattaching callback refs.\n if (!isDirtyRef.current && itemsRef.current) {\n syncRefs(itemsRef.current);\n }\n return () => {\n elementsRef.current = [];\n if (labelsRef) {\n labelsRef.current = [];\n }\n };\n }, [elementsRef, labelsRef, syncRefs]);\n useIsoLayoutEffect(() => {\n if (isDirtyRef.current) {\n flush();\n }\n });\n useIsoLayoutEffect(() => {\n return () => {\n mutationObserverRef.current?.disconnect();\n // React 18 Strict Mode replays effects without replaying callback refs.\n // Mark the retained map dirty so the replay rebuilds refs and observation.\n isDirtyRef.current = true;\n };\n }, []);\n const subscribeMapChange = useStableCallback(fn => {\n listeners.add(fn);\n return () => {\n listeners.delete(fn);\n };\n });\n const contextValue = React.useMemo(() => ({\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n }), [register, unregister, subscribeMapChange, nextIndexRef]);\n return /*#__PURE__*/_jsx(CompositeListContext.Provider, {\n value: contextValue,\n children: children\n });\n}\nfunction createMap() {\n return new Map();\n}\nfunction createListeners() {\n return new Set();\n}\nfunction getCompositeListSnapshot(map) {\n const reservedIndices = new Set();\n const items = [];\n const automaticItems = [];\n map.forEach((registration, node) => {\n if (!node.isConnected) {\n return;\n }\n const index = registration.index;\n const item = {\n index: index ?? -1,\n element: node,\n registration\n };\n if (index === null) {\n automaticItems.push(item);\n } else if (index >= 0) {\n reservedIndices.add(index);\n items.push(item);\n }\n });\n let nextAutomaticIndex = 0;\n automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element));\n automaticItems.forEach(item => {\n while (reservedIndices.has(nextAutomaticIndex)) {\n nextAutomaticIndex += 1;\n }\n item.index = nextAutomaticIndex;\n items.push(item);\n nextAutomaticIndex += 1;\n });\n if (reservedIndices.size > 0) {\n items.sort((a, b) => a.index - b.index);\n }\n return [items, automaticItems.map(item => item.element)];\n}\nfunction getCommonAncestor(firstNode, lastNode) {\n let ancestor = firstNode.parentElement;\n\n // The `parentElement` walk cannot cross shadow boundaries, so the native\n // `contains` is sufficient here.\n while (ancestor && !ancestor.contains(lastNode)) {\n ancestor = ancestor.parentElement;\n }\n return ancestor;\n}\nfunction hasMovedNode(entries) {\n for (const entry of entries) {\n for (let i = 0; i < entry.removedNodes.length; i += 1) {\n if (entry.removedNodes[i].isConnected) {\n return true;\n }\n }\n }\n return false;\n}\nfunction sortByDocumentPosition(a, b) {\n // `DOCUMENT_POSITION_CONTAINED_BY` is always reported alongside `FOLLOWING`, and `CONTAINS`\n // alongside `PRECEDING`, so testing `FOLLOWING` alone orders siblings and nested items alike.\n return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;\n}","'use client';\n\nimport * as React from 'react';\nexport const CompositeListContext = /*#__PURE__*/React.createContext({\n register: () => {},\n unregister: () => {},\n subscribeMapChange: () => () => {},\n nextIndexRef: {\n current: 0\n }\n});\nif (process.env.NODE_ENV !== \"production\") CompositeListContext.displayName = \"CompositeListContext\";\nexport function useCompositeListContext() {\n return React.useContext(CompositeListContext);\n}","'use client';\n\nimport * as React from 'react';\nimport { getSide, getAlignment, getSideAxis } from '@floating-ui/utils';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { autoUpdate, flip, limitShift, offset, shift as floatingShift, size } from \"../floating-ui-react/index.mjs\";\nimport { useBaseUIFloating } from \"../floating-ui-react/hooks/useFloating.mjs\";\nimport { useDirection } from \"./direction-context/DirectionContext.mjs\";\nimport { arrow } from \"../floating-ui-react/middleware/arrow.mjs\";\nimport { hide } from \"../utils/hideMiddleware.mjs\";\nimport { DEFAULT_SIDES } from \"../utils/adaptiveOriginConstants.mjs\";\nimport * as CommonPositionerCssVars from \"../utils/CommonPositionerCssVars.mjs\";\nconst AVAILABLE_WIDTH_VAR = CommonPositionerCssVars.availableWidth;\nconst AVAILABLE_HEIGHT_VAR = CommonPositionerCssVars.availableHeight;\nfunction getLogicalSide(sideParam, renderedSide, isRtl) {\n const isLogicalSideParam = sideParam === 'inline-start' || sideParam === 'inline-end';\n const logicalRight = isRtl ? 'inline-start' : 'inline-end';\n const logicalLeft = isRtl ? 'inline-end' : 'inline-start';\n return {\n top: 'top',\n right: isLogicalSideParam ? logicalRight : 'right',\n bottom: 'bottom',\n left: isLogicalSideParam ? logicalLeft : 'left'\n }[renderedSide];\n}\nfunction getOffsetData(state, sideParam, isRtl) {\n const {\n rects,\n placement\n } = state;\n const data = {\n side: getLogicalSide(sideParam, getSide(placement), isRtl),\n align: getAlignment(placement) || 'center',\n anchor: {\n width: rects.reference.width,\n height: rects.reference.height\n },\n positioner: {\n width: rects.floating.width,\n height: rects.floating.height\n }\n };\n return data;\n}\n/**\n * Provides standardized anchor positioning behavior for floating elements. Wraps Floating UI's\n * `useFloating` hook.\n */\nexport function useAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useBaseUIFloating);\n}\nexport function useAnchorPositioningWithHook(params, useFloatingHook) {\n const {\n // Public parameters\n anchor,\n positionMethod = 'absolute',\n side: sideParam = 'bottom',\n sideOffset = 0,\n align = 'center',\n alignOffset = 0,\n collisionBoundary,\n collisionPadding: collisionPaddingParam = 5,\n sticky = false,\n arrowPadding = 5,\n disableAnchorTracking = false,\n inline: inlineMiddleware,\n // Private parameters\n keepMounted = false,\n floatingRootContext,\n mounted,\n collisionAvoidance,\n shift,\n nodeId,\n adaptiveOrigin,\n lazyFlip = false,\n externalTree\n } = params;\n const [mountSide, setMountSide] = React.useState(null);\n if (!mounted && mountSide !== null) {\n setMountSide(null);\n }\n const collisionAvoidanceSide = collisionAvoidance.side || 'flip';\n const collisionAvoidanceAlign = collisionAvoidance.align || 'flip';\n const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || 'end';\n const shiftCrossAxis = shift?.crossAxis ?? false;\n const shiftRootBoundary = shift?.rootBoundary;\n const anchorFn = typeof anchor === 'function' ? anchor : undefined;\n const anchorFnCallback = useStableCallback(anchorFn);\n const anchorDep = anchorFn ? anchorFnCallback : anchor;\n const anchorValueRef = useValueAsRef(anchor);\n const mountedRef = useValueAsRef(mounted);\n const direction = useDirection();\n const isRtl = direction === 'rtl';\n const side = mountSide || {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n 'inline-end': isRtl ? 'left' : 'right',\n 'inline-start': isRtl ? 'right' : 'left'\n }[sideParam];\n const placement = align === 'center' ? side : `${side}-${align}`;\n let collisionPadding = collisionPaddingParam;\n if (typeof collisionPadding === 'number') {\n collisionPadding = {\n top: collisionPadding,\n right: collisionPadding,\n bottom: collisionPadding,\n left: collisionPadding\n };\n } else if (collisionPadding) {\n collisionPadding = {\n top: collisionPadding.top || 0,\n right: collisionPadding.right || 0,\n bottom: collisionPadding.bottom || 0,\n left: collisionPadding.left || 0\n };\n }\n\n // Create a bias to the preferred side.\n // On iOS, when the mobile software keyboard opens, the input is exactly centered\n // in the viewport, but this can cause it to flip to the top undesirably.\n // The bias is only applied to `flip()` so it doesn't shift the resting position\n // computed by `shift()` and `size()` away from the requested `collisionPadding`.\n const bias = 1;\n const biasTop = sideParam === 'bottom' ? bias : 0;\n const biasBottom = sideParam === 'top' ? bias : 0;\n const biasLeft = sideParam === 'right' ? bias : 0;\n const biasRight = sideParam === 'left' ? bias : 0;\n const commonCollisionProps = {\n boundary: collisionBoundary === 'clipping-ancestors' ? 'clippingAncestors' : collisionBoundary,\n padding: collisionPadding\n };\n\n // Using a ref assumes that the arrow element is always present in the DOM for the lifetime of the\n // popup. If this assumption ends up being false, we can switch to state to manage the arrow's\n // presence.\n const arrowRef = React.useRef(null);\n\n // Keep these reactive if they're not functions\n const sideOffsetRef = useValueAsRef(sideOffset);\n const alignOffsetRef = useValueAsRef(alignOffset);\n const sideOffsetDep = typeof sideOffset !== 'function' ? sideOffset : 0;\n const alignOffsetDep = typeof alignOffset !== 'function' ? alignOffset : 0;\n const middleware = [];\n if (inlineMiddleware) {\n middleware.push(inlineMiddleware);\n }\n middleware.push(offset(state => {\n const data = getOffsetData(state, sideParam, isRtl);\n const sideAxis = typeof sideOffsetRef.current === 'function' ? sideOffsetRef.current(data) : sideOffsetRef.current;\n const alignAxis = typeof alignOffsetRef.current === 'function' ? alignOffsetRef.current(data) : alignOffsetRef.current;\n return {\n mainAxis: sideAxis,\n crossAxis: alignAxis,\n alignmentAxis: alignAxis\n };\n }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam]));\n const shiftDisabled = collisionAvoidanceAlign === 'none' && collisionAvoidanceSide !== 'shift';\n const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === 'shift');\n const flipMiddleware = collisionAvoidanceSide === 'none' ? null : flip({\n ...commonCollisionProps,\n // Ensure the popup flips if it's been limited by its --available-height and it resizes.\n // Since the size() padding is smaller than the flip() padding, flip() will take precedence.\n padding: {\n top: collisionPadding.top + bias + biasTop,\n right: collisionPadding.right + bias + biasRight,\n bottom: collisionPadding.bottom + bias + biasBottom,\n left: collisionPadding.left + bias + biasLeft\n },\n mainAxis: !shiftCrossAxis && collisionAvoidanceSide === 'flip',\n crossAxis: collisionAvoidanceAlign === 'flip' ? 'alignment' : false,\n fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide\n });\n const shiftMiddleware = shiftDisabled ? null : floatingShift({\n ...commonCollisionProps,\n // Use the Layout Viewport to avoid shifting around when pinch-zooming.\n rootBoundary: shiftRootBoundary,\n mainAxis: collisionAvoidanceAlign !== 'none',\n crossAxis: crossAxisShiftEnabled,\n limiter: sticky || shiftCrossAxis ? undefined : limitShift(limitData => {\n if (!arrowRef.current) {\n return {};\n }\n const {\n width,\n height\n } = arrowRef.current.getBoundingClientRect();\n const sideAxis = getSideAxis(getSide(limitData.placement));\n const arrowSize = sideAxis === 'y' ? width : height;\n const offsetAmount = sideAxis === 'y' ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom;\n return {\n offset: arrowSize / 2 + offsetAmount / 2\n };\n })\n }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]);\n\n // https://floating-ui.com/docs/flip#combining-with-shift\n if (collisionAvoidanceSide === 'shift' || collisionAvoidanceAlign === 'shift' || align === 'center') {\n middleware.push(shiftMiddleware, flipMiddleware);\n } else {\n middleware.push(flipMiddleware, shiftMiddleware);\n }\n middleware.push(size({\n ...commonCollisionProps,\n apply({\n elements: {\n floating\n },\n availableWidth,\n availableHeight,\n rects\n }) {\n if (!mountedRef.current) {\n return;\n }\n const floatingStyle = floating.style;\n floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth}px`);\n floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight}px`);\n\n // Snap anchor dimensions to device pixels to ensure the popup's visual width matches the anchor's one.\n const dpr = ownerWindow(floating).devicePixelRatio || 1;\n const {\n x,\n y,\n width,\n height\n } = rects.reference;\n const anchorWidth = (Math.round((x + width) * dpr) - Math.round(x * dpr)) / dpr;\n const anchorHeight = (Math.round((y + height) * dpr) - Math.round(y * dpr)) / dpr;\n floatingStyle.setProperty(CommonPositionerCssVars.anchorWidth, `${anchorWidth}px`);\n floatingStyle.setProperty(CommonPositionerCssVars.anchorHeight, `${anchorHeight}px`);\n }\n }), arrow(state => ({\n // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set,\n // we'll create a fake element.\n element: arrowRef.current || ownerDocument(state.elements.floating).createElement('div'),\n // No padding for the fake arrow: it would displace aligned popups on narrow anchors.\n padding: arrowRef.current ? arrowPadding : 0,\n offsetParent: 'floating'\n }), [arrowPadding]), {\n name: 'transformOrigin',\n fn(state) {\n const {\n elements: {\n floating\n },\n middlewareData,\n placement: renderedPlacement,\n platform,\n rects,\n y\n } = state;\n const renderedSide = getSide(renderedPlacement);\n const renderedAlign = getAlignment(renderedPlacement);\n const isVertical = getSideAxis(renderedSide) === 'y';\n const arrowEl = arrowRef.current;\n const sideOffsetValue = typeof sideOffset === 'function' ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset;\n\n // An aligned arrowless popup grows from its aligned edge, until a shift (beyond subpixel)\n // breaks its alignment with the anchor. Everything else grows from the arrow, real or fake.\n let crossOrigin;\n if (!arrowEl && renderedAlign && Math.abs(isVertical ? middlewareData.shift?.x || 0 : middlewareData.shift?.y || 0) <= 1) {\n // The platform direction, not `isRtl`: it must match what Floating UI placed with.\n crossOrigin = renderedAlign === 'start' === (isVertical && platform.isRTL?.(floating) === true) ? '100%' : '0%';\n } else {\n const arrowOffset = isVertical ? middlewareData.arrow?.x || 0 : middlewareData.arrow?.y || 0;\n const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0;\n crossOrigin = `${arrowOffset + arrowSize / 2}px`;\n }\n\n // Side axis: the anchor-facing edge, or the anchor's center when the popup overlaps it.\n let sideOrigin = renderedSide === 'top' || renderedSide === 'left' ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`;\n if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData.shift?.y || 0) > sideOffsetValue) {\n sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y}px`;\n }\n floating.style.setProperty(CommonPositionerCssVars.transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`);\n return {};\n }\n }, hide, adaptiveOrigin);\n useIsoLayoutEffect(() => {\n // Ensure positioning doesn't run initially for `keepMounted` elements that\n // aren't initially open.\n if (!mounted && floatingRootContext) {\n floatingRootContext.update({\n referenceElement: null,\n floatingElement: null,\n domReferenceElement: null,\n positionReference: null\n });\n }\n }, [mounted, floatingRootContext]);\n const autoUpdateOptions = React.useMemo(() => ({\n ancestorScroll: !disableAnchorTracking,\n elementResize: !disableAnchorTracking && typeof ResizeObserver !== 'undefined',\n layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== 'undefined'\n }), [disableAnchorTracking]);\n const {\n refs,\n elements,\n x,\n y,\n middlewareData,\n update,\n placement: renderedPlacement,\n context,\n isPositioned,\n floatingStyles: originalFloatingStyles\n } = useFloatingHook({\n rootContext: floatingRootContext,\n open: keepMounted ? mounted : undefined,\n placement,\n middleware,\n strategy: positionMethod,\n whileElementsMounted: keepMounted ? undefined : (...args) => autoUpdate(...args, autoUpdateOptions),\n nodeId,\n externalTree\n });\n const {\n sideX,\n sideY\n } = middlewareData.adaptiveOrigin || DEFAULT_SIDES;\n\n // Default to `fixed` when not positioned to prevent `autoFocus` scroll jumps.\n // This ensures the popup is inside the viewport initially before it gets positioned.\n const resolvedPosition = isPositioned ? positionMethod : 'fixed';\n const floatingStyles = React.useMemo(() => {\n let base;\n if (!isPositioned) {\n // Until a position for the current open is computed, ignore any coordinates retained from a\n // previous open (or from a pass that measured the hidden popup as 0x0). Rendering the\n // full-size popup at such stale coordinates can overflow the layout viewport, which makes\n // mobile Chrome zoom the page out and reflow everything the popup is anchored to.\n base = {\n position: resolvedPosition,\n top: 0,\n left: 0\n };\n } else if (adaptiveOrigin) {\n base = {\n position: resolvedPosition,\n [sideX]: x,\n [sideY]: y\n };\n } else {\n base = {\n ...originalFloatingStyles,\n position: resolvedPosition\n };\n }\n\n // Seed the available size vars so consumer `max-height: min(x, var(--available-height))` rules\n // resolve to a valid length on the first positioning pass, before `size()` writes the real\n // values. Without a fallback the unresolved `var()` invalidates the whole declaration, so the\n // popup is measured unconstrained while `flip()` picks its side, against the full content\n // height rather than the capped one. Seeded unconditionally (not only while `!isPositioned`):\n // the keys must stay present with a constant value so React's per-property style diff never\n // rewrites them after mount, preserving the px values `size()` sets imperatively. Moving them\n // into the `!isPositioned` branch makes React remove them once positioned, wiping `size()`'s\n // values and leaving the popup unconstrained.\n base[AVAILABLE_WIDTH_VAR] = '100vw';\n base[AVAILABLE_HEIGHT_VAR] = '100vh';\n if (!isPositioned) {\n base.opacity = 0;\n }\n return base;\n }, [adaptiveOrigin, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]);\n const registeredPositionReferenceRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n const resolvedAnchor = typeof anchorValue === 'function' ? anchorValue() : anchorValue;\n const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null;\n const finalAnchor = unwrappedElement || null;\n if (finalAnchor !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(finalAnchor);\n registeredPositionReferenceRef.current = finalAnchor;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (!mounted) {\n return;\n }\n const anchorValue = anchorValueRef.current;\n\n // Refs from parent components are set after useLayoutEffect runs and are available in useEffect.\n // Therefore, if the anchor is a ref, we need to update the position reference in useEffect.\n if (typeof anchorValue === 'function') {\n return;\n }\n if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) {\n refs.setPositionReference(anchorValue.current);\n registeredPositionReferenceRef.current = anchorValue.current;\n }\n }, [mounted, refs, anchorDep, anchorValueRef]);\n React.useEffect(() => {\n if (keepMounted && mounted && elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update, autoUpdateOptions);\n }\n return undefined;\n }, [keepMounted, mounted, elements, update, autoUpdateOptions]);\n const renderedSide = getSide(renderedPlacement);\n const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl);\n const renderedAlign = getAlignment(renderedPlacement) || 'center';\n const anchorHidden = Boolean(middlewareData.hide?.referenceHidden);\n\n // Locks the flip (makes it \"sticky\") so it doesn't prefer a given placement\n // and flips back lazily, not eagerly. Ideal for filtered lists that change\n // the size of the popup dynamically to avoid unwanted flipping when typing.\n useIsoLayoutEffect(() => {\n if (lazyFlip && mounted && isPositioned && renderedSide !== side) {\n setMountSide(renderedSide);\n }\n }, [lazyFlip, mounted, isPositioned, renderedSide, side]);\n const arrowStyles = React.useMemo(() => ({\n position: 'absolute',\n top: middlewareData.arrow?.y,\n left: middlewareData.arrow?.x\n }), [middlewareData.arrow]);\n const arrowUncentered = middlewareData.arrow?.centerOffset !== 0;\n return React.useMemo(() => ({\n positionerStyles: floatingStyles,\n arrowStyles,\n arrowRef,\n arrowUncentered,\n side: logicalRenderedSide,\n align: renderedAlign,\n physicalSide: renderedSide,\n anchorHidden,\n refs,\n context,\n isPositioned,\n update\n }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update]);\n}\nfunction isRef(param) {\n return param != null && 'current' in param;\n}","'use client';\n\nimport * as React from 'react';\nexport const DirectionContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") DirectionContext.displayName = \"DirectionContext\";\nexport function useDirection() {\n const context = React.useContext(DirectionContext);\n return context?.direction ?? 'ltr';\n}","import { clamp, evaluate, getAlignment, getAlignmentAxis, getAxisLength, getPaddingObject } from '@floating-ui/utils';\n/**\n * Fork of the original `arrow` middleware from Floating UI that allows\n * configuring the offset parent.\n */\nexport const baseArrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0,\n offsetParent = 'real'\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = offsetParent === 'real' ? await platform.getOffsetParent?.(element) : elements.floating;\n let clientSize = elements.floating[clientProp] || rects.floating[length];\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await platform.isElement?.(arrowOffsetParent))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n // eslint-disable-next-line no-nested-ternary\n const alignmentOffset = shouldAddOffset ? center < min ? center - min : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * This wraps the core `arrow` middleware to allow React refs as the element.\n * @see https://floating-ui.com/docs/arrow\n */\nexport const arrow = (options, deps) => {\n const {\n name,\n fn\n } = baseArrow(options);\n return {\n name,\n fn,\n options: [options, deps]\n };\n};","export const hide = {\n name: 'hide',\n async fn(state) {\n const {\n width,\n height,\n x,\n y\n } = state.rects.reference;\n const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0;\n // Mirrors Floating UI's `hide()` referenceHidden strategy. Floating UI injects\n // `detectOverflow` into the middleware platform before invoking middleware.\n const overflow = await state.platform.detectOverflow(state, {\n elementContext: 'reference'\n });\n const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0;\n return {\n data: {\n referenceHidden: referenceHidden || anchorHidden\n }\n };\n }\n};","export const DEFAULT_SIDES = {\n sideX: 'left',\n sideY: 'top'\n};\n\n// Self-contained stand-in for Floating UI's `Middleware` type. Referencing the real type in\n// store state makes `tsc` declaration emit reference `Platform`/`detectOverflow` from\n// `@floating-ui/core` internals, which fails as non-portable (TS2883) in consuming builds.","/**\n * The available width between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableWidth = '--available-width';\n/**\n * The available height between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableHeight = '--available-height';\n/**\n * The anchor's width.\n * @type {number}\n */\nexport const anchorWidth = '--anchor-width';\n/**\n * The anchor's height.\n * @type {number}\n */\nexport const anchorHeight = '--anchor-height';\n/**\n * The coordinates that this element is anchored to. Used for animations and transitions.\n * @type {string}\n */\nexport const transformOrigin = '--transform-origin';\n/**\n * The width of the popup's positioner.\n * It is important to set `width` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerWidth = '--positioner-width';\n/**\n * The height of the popup's positioner.\n * It is important to set `height` to this value when using CSS to animate size changes.\n * @type {number}\n */\nexport const positionerHeight = '--positioner-height';","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectPositionerContext.displayName = \"SelectPositionerContext\";\nexport function useSelectPositionerContext() {\n const context = React.useContext(SelectPositionerContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectPositionerContext is missing. SelectPositioner parts must be placed within <Select.Positioner>.' : _formatErrorMessage(59));\n }\n return context;\n}","import * as React from 'react';\n\n/**\n * @internal\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const InternalBackdrop = /*#__PURE__*/React.forwardRef(function InternalBackdrop(props, ref) {\n const {\n cutout,\n ...otherProps\n } = props;\n let clipPath;\n if (cutout) {\n const rect = cutout.getBoundingClientRect();\n clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n }\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n role: \"presentation\"\n // Ensures Floating UI's outside press detection runs, as it considers\n // it an element that existed when the popup rendered.\n ,\n \"data-base-ui-inert\": \"\",\n ...otherProps,\n style: {\n position: 'fixed',\n inset: 0,\n userSelect: 'none',\n WebkitUserSelect: 'none',\n clipPath\n }\n });\n});\nif (process.env.NODE_ENV !== \"production\") InternalBackdrop.displayName = \"InternalBackdrop\";","export function clearStyles(element, originalStyles) {\n if (element) {\n Object.assign(element.style, originalStyles);\n }\n}\nexport const LIST_FUNCTIONAL_STYLES = {\n position: 'relative',\n maxHeight: '100%',\n overflowX: 'hidden',\n overflowY: 'auto'\n};","import { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { DISABLED_TRANSITIONS_STYLE } from \"./constants.mjs\";\nexport function getDisabledMountTransitionStyles(transitionStatus) {\n return transitionStatus === 'starting' ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT;\n}","'use client';\n\nimport { popupStateMapping } from \"./popupStateMapping.mjs\";\nimport { useRenderElement } from \"../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../internals/getDisabledMountTransitionStyles.mjs\";\n/**\n * Renders the shared outer Positioner element used by popup components.\n * Applies the common role, hidden state, transition styles, state attributes, and optional inert styling.\n */\nexport function usePositioner(componentProps, state, {\n styles,\n transitionStatus,\n props,\n refs,\n hidden,\n inert = false\n}) {\n const style = {\n ...styles\n };\n if (inert) {\n style.pointerEvents = 'none';\n }\n return useRenderElement('div', componentProps, {\n state,\n ref: refs,\n props: [{\n role: 'presentation',\n hidden,\n style\n }, getDisabledMountTransitionStyles(transitionStatus), props],\n stateAttributesMapping: popupStateMapping\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\n\n// Touch-opened popups normally avoid scroll locking so users can still swipe outside to dismiss.\n// This hook re-enables scroll lock only when the popup is effectively full-width.\n// Treat popups with up to 20px of total horizontal gutter as full-width so common ~10px side\n// padding still locks scroll, since that leaves too little outside space for a reliable swipe.\nconst VIEWPORT_WIDTH_TOLERANCE_PX = 20;\n\n/**\n * Manages scroll lock for anchored popups. For non-touch opens, scroll lock is applied when\n * enabled. For touch opens, scroll lock is applied only when the positioner width is effectively\n * viewport-sized.\n */\nexport function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {\n const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React.useState(false);\n useIsoLayoutEffect(() => {\n if (!enabled || !touchOpen || positionerElement == null) {\n setTouchOpenShouldLockScroll(false);\n return;\n }\n const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;\n const popupWidth = positionerElement.offsetWidth;\n setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);\n }, [enabled, touchOpen, positionerElement]);\n useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);\n}","'use client';\n\nimport { isOverflowElement } from '@floating-ui/utils/dom';\nimport { addEventListener } from \"./addEventListener.mjs\";\nimport { platform } from \"./platform/index.mjs\";\nimport { ownerDocument, ownerWindow } from \"./owner.mjs\";\nimport { useIsoLayoutEffect } from \"./useIsoLayoutEffect.mjs\";\nimport { Timeout } from \"./useTimeout.mjs\";\nimport { AnimationFrame } from \"./useAnimationFrame.mjs\";\nlet originalHtmlStyles = {};\nlet originalBodyStyles = {};\nlet originalHtmlScrollBehavior = '';\n\n// The viewport's overflow comes from <html> when it establishes its own scroll container, and\n// propagates from <body> otherwise. An `overflow` style on the other element doesn't lock the page.\nfunction getViewportScroller(html, body) {\n return isOverflowElement(html) ? html : body;\n}\nfunction isPageScrollLocked(win, html, body) {\n return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);\n}\nfunction hasInsetScrollbars(referenceElement) {\n if (typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const win = ownerWindow(doc);\n return win.innerWidth - doc.documentElement.clientWidth > 0;\n}\nfunction supportsStableScrollbarGutter(referenceElement) {\n const supported = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('scrollbar-gutter', 'stable');\n if (!supported || typeof document === 'undefined') {\n return false;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const scrollContainer = getViewportScroller(html, body);\n const originalScrollContainerOverflowY = scrollContainer.style.overflowY;\n const originalHtmlStyleGutter = html.style.scrollbarGutter;\n html.style.scrollbarGutter = 'stable';\n scrollContainer.style.overflowY = 'scroll';\n const before = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = 'hidden';\n const after = scrollContainer.offsetWidth;\n scrollContainer.style.overflowY = originalScrollContainerOverflowY;\n html.style.scrollbarGutter = originalHtmlStyleGutter;\n return before === after;\n}\nfunction preventScrollOverlayScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n\n // If an `overflow` style is present on <html>, we need to lock it, because a lock on <body>\n // won't have any effect.\n // But if <body> has an `overflow` style (like `overflow-x: hidden`), we need to lock it\n // instead, as sticky elements shift otherwise.\n const elementToLock = getViewportScroller(html, body);\n const originalElementToLockStyles = {\n overflowY: elementToLock.style.overflowY,\n overflowX: elementToLock.style.overflowX\n };\n Object.assign(elementToLock.style, {\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n return () => {\n Object.assign(elementToLock.style, originalElementToLockStyles);\n };\n}\nfunction preventScrollInsetScrollbars(referenceElement) {\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n let scrollTop = 0;\n let scrollLeft = 0;\n let updateGutterOnly = false;\n const resizeFrame = AnimationFrame.create();\n\n // Pinch-zoom in Safari causes a shift. Just don't lock scroll if there's any pinch-zoom.\n if (platform.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) {\n return () => {};\n }\n function lockScroll() {\n /* DOM reads: */\n\n const htmlStyles = win.getComputedStyle(html);\n const bodyStyles = win.getComputedStyle(body);\n const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || '';\n const hasBothEdges = htmlScrollbarGutterValue.includes('both-edges');\n const scrollbarGutterValue = hasBothEdges ? 'stable both-edges' : 'stable';\n scrollTop = html.scrollTop;\n scrollLeft = html.scrollLeft;\n originalHtmlStyles = {\n scrollbarGutter: html.style.scrollbarGutter,\n overflowY: html.style.overflowY,\n overflowX: html.style.overflowX\n };\n originalHtmlScrollBehavior = html.style.scrollBehavior;\n originalBodyStyles = {\n position: body.style.position,\n height: body.style.height,\n width: body.style.width,\n boxSizing: body.style.boxSizing,\n overflowY: body.style.overflowY,\n overflowX: body.style.overflowX,\n scrollBehavior: body.style.scrollBehavior\n };\n const isScrollableY = html.scrollHeight > html.clientHeight;\n const isScrollableX = html.scrollWidth > html.clientWidth;\n const hasConstantOverflowY = htmlStyles.overflowY === 'scroll' || bodyStyles.overflowY === 'scroll';\n const hasConstantOverflowX = htmlStyles.overflowX === 'scroll' || bodyStyles.overflowX === 'scroll';\n\n // Values can be negative in Firefox\n const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth);\n const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);\n\n // Avoid shift due to the default <body> margin. This does cause elements to be clipped\n // with whitespace. Warn if <body> has margins?\n const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);\n const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);\n const elementToLock = getViewportScroller(html, body);\n updateGutterOnly = supportsStableScrollbarGutter(referenceElement);\n\n /*\n * DOM writes:\n * Do not read the DOM past this point!\n */\n\n if (updateGutterOnly) {\n html.style.scrollbarGutter = scrollbarGutterValue;\n elementToLock.style.overflowY = 'hidden';\n elementToLock.style.overflowX = 'hidden';\n return;\n }\n Object.assign(html.style, {\n scrollbarGutter: scrollbarGutterValue,\n overflowY: 'hidden',\n overflowX: 'hidden'\n });\n if (isScrollableY || hasConstantOverflowY) {\n html.style.overflowY = 'scroll';\n }\n if (isScrollableX || hasConstantOverflowX) {\n html.style.overflowX = 'scroll';\n }\n Object.assign(body.style, {\n position: 'relative',\n height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',\n width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',\n boxSizing: 'border-box',\n // Assign the longhands that `cleanup` restores, so nothing is left behind.\n overflowY: 'hidden',\n overflowX: 'hidden',\n scrollBehavior: 'unset'\n });\n body.scrollTop = scrollTop;\n body.scrollLeft = scrollLeft;\n html.setAttribute('data-base-ui-scroll-locked', '');\n html.style.scrollBehavior = 'unset';\n }\n function cleanup() {\n Object.assign(html.style, originalHtmlStyles);\n Object.assign(body.style, originalBodyStyles);\n if (!updateGutterOnly) {\n html.scrollTop = scrollTop;\n html.scrollLeft = scrollLeft;\n html.removeAttribute('data-base-ui-scroll-locked');\n html.style.scrollBehavior = originalHtmlScrollBehavior;\n }\n }\n function handleResize() {\n cleanup();\n resizeFrame.request(lockScroll);\n }\n lockScroll();\n const unsubscribeResize = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n cleanup();\n // Sometimes this cleanup can run after test teardown because it is called\n // in a `setTimeout(fn, 0)`. Guard the returned cleanup to avoid calling\n // `removeEventListener` when it is no longer available in tests.\n if (typeof win.removeEventListener === 'function') {\n unsubscribeResize();\n }\n };\n}\nclass ScrollLocker {\n lockCount = 0;\n restore = null;\n timeoutLock = Timeout.create();\n timeoutUnlock = Timeout.create();\n acquire(referenceElement) {\n this.lockCount += 1;\n if (this.lockCount === 1 && this.restore === null) {\n this.timeoutLock.start(0, () => this.lock(referenceElement));\n }\n return this.release;\n }\n release = () => {\n this.lockCount -= 1;\n if (this.lockCount === 0 && this.restore) {\n this.timeoutUnlock.start(0, this.unlock);\n }\n };\n unlock = () => {\n if (this.lockCount === 0 && this.restore) {\n this.restore?.();\n this.restore = null;\n }\n };\n lock(referenceElement) {\n if (this.lockCount === 0 || this.restore !== null) {\n return;\n }\n const doc = ownerDocument(referenceElement);\n const html = doc.documentElement;\n const body = doc.body;\n const win = ownerWindow(html);\n\n // The page is already locked, either by the site author or by a non-Base UI overlay that\n // hasn't cleaned up yet. Leave it alone and wait for the lock to clear before taking over,\n // otherwise we'd snapshot the locked state and restore it after our own lock is released.\n if (isPageScrollLocked(win, html, body)) {\n const observer = new win.MutationObserver(() => {\n if (isPageScrollLocked(win, html, body)) {\n return;\n }\n observer.disconnect();\n this.restore = null;\n this.lock(referenceElement);\n });\n\n // Watch every attribute: locks are applied through inline styles, classes, or attributes\n // paired with a stylesheet (`data-scroll-locked` in react-remove-scroll, for example).\n const options = {\n attributes: true\n };\n observer.observe(html, options);\n observer.observe(body, options);\n this.restore = () => observer.disconnect();\n return;\n }\n const hasOverlayScrollbars = platform.os.ios || !hasInsetScrollbars(referenceElement);\n\n // On iOS, scroll locking does not work if the navbar is collapsed. Due to numerous\n // side effects and bugs that arise on iOS, it must be researched extensively before\n // being enabled to ensure it doesn't cause the following issues:\n // - Textboxes must scroll into view when focused, nor cause a glitchy scroll animation.\n // - The navbar must not force itself into view and cause layout shift.\n // - Scroll containers must not flicker upon closing a popup when it has an exit animation.\n this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);\n }\n}\nconst SCROLL_LOCKER = new ScrollLocker();\n\n/**\n * Locks the scroll of the document when enabled.\n *\n * @param enabled - Whether to enable the scroll lock.\n * @param referenceElement - Element to use as a reference for lock calculations.\n */\nexport function useScrollLock(enabled = true, referenceElement = null) {\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return undefined;\n }\n return SCROLL_LOCKER.acquire(referenceElement);\n }, [enabled, referenceElement]);\n}","'use client';\n\nimport * as React from 'react';\nimport { rectToClientRect } from '@floating-ui/utils';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { platform } from '@base-ui/utils/platform';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { clamp } from '@base-ui/utils/clamp';\nimport { FloatingFocusManager, platform as floatingPlatform } from \"../../floating-ui-react/index.mjs\";\nimport { useSelectFloatingContext, useSelectRootContext, useSelectRootPropsContext } from \"../root/SelectRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useSelectPositionerContext } from \"../positioner/SelectPositionerContext.mjs\";\nimport { styleDisableScrollbar } from \"../../utils/styles.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { clearStyles, LIST_FUNCTIONAL_STYLES } from \"./utils.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useToolbarRootContext } from \"../../toolbar/root/ToolbarRootContext.mjs\";\nimport { COMPOSITE_KEYS } from \"../../internals/composite/composite.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\nimport { getMaxScrollOffset, SCROLL_EDGE_TOLERANCE_PX } from \"../../utils/scrollEdges.mjs\";\nimport { useCSPContext } from \"../../internals/csp-context/CSPContext.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport * as SelectPositionerCssVars from \"../positioner/SelectPositionerCssVars.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping\n};\n\n/**\n * A container for the select list.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectPopup = /*#__PURE__*/React.forwardRef(function SelectPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n finalFocus,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const {\n multiple,\n readOnly,\n highlightItemOnHover\n } = useSelectRootPropsContext();\n const floatingRootContext = useSelectFloatingContext();\n const {\n side,\n align,\n alignItemWithTriggerActive,\n isPositioned,\n setControlledAlignItemWithTrigger\n } = useSelectPositionerContext();\n const insideToolbar = useToolbarRootContext(true) != null;\n const direction = useDirection();\n const {\n nonce,\n disableStyleElements\n } = useCSPContext();\n const id = store.useState('id');\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const mounted = store.useState('mounted');\n const popupProps = store.useState('popupProps');\n const transitionStatus = store.useState('transitionStatus');\n const triggerElement = store.useState('triggerElement');\n const positionerElement = store.useState('positionerElement');\n const listElement = store.useState('listElement');\n const reachedMaxHeightRef = React.useRef(false);\n const initialPlacedRef = React.useRef(false);\n const originalPositionerStylesRef = React.useRef({});\n const scrollArrowFrame = useAnimationFrame();\n const handleScroll = useStableCallback(scroller => {\n if (!positionerElement || !store.context.popupRef.current || !initialPlacedRef.current) {\n return;\n }\n const isTopPositioned = positionerElement.style.top === '0px';\n const isBottomPositioned = positionerElement.style.bottom === '0px';\n if (reachedMaxHeightRef.current || !alignItemWithTriggerActive || !isTopPositioned && !isBottomPositioned) {\n store.context.handleScrollArrowVisibility(scroller);\n return;\n }\n const scale = getScale(positionerElement);\n const currentHeight = normalizeSize(positionerElement.getBoundingClientRect().height, 'y', scale);\n const doc = ownerDocument(positionerElement);\n const win = ownerWindow(positionerElement);\n const positionerStyles = win.getComputedStyle(positionerElement);\n const marginTop = parseFloat(positionerStyles.marginTop);\n const marginBottom = parseFloat(positionerStyles.marginBottom);\n const maxPopupHeight = getMaxPopupHeight(win.getComputedStyle(store.context.popupRef.current));\n const maxAvailableHeight = Math.min(doc.documentElement.clientHeight - marginTop - marginBottom, maxPopupHeight);\n const scrollTop = scroller.scrollTop;\n const maxScrollTop = getMaxScrollTop(scroller);\n\n // `Infinity` requests a scroll to the recomputed maximum offset.\n let nextScrollTop = null;\n const setHeight = height => {\n positionerElement.style.height = `${height}px`;\n };\n const diff = isTopPositioned ? maxScrollTop - scrollTop : scrollTop;\n const nextHeight = Math.min(currentHeight + diff, maxAvailableHeight);\n if (diff <= SCROLL_EDGE_TOLERANCE_PX) {\n const heightDelta = clamp(diff, 0, maxAvailableHeight - currentHeight);\n if (heightDelta > 0) {\n // Consume the remaining scroll in height.\n setHeight(currentHeight + heightDelta);\n }\n scroller.scrollTop = isTopPositioned ? maxScrollTop : 0;\n if (maxAvailableHeight - (currentHeight + heightDelta) <= SCROLL_EDGE_TOLERANCE_PX) {\n reachedMaxHeightRef.current = true;\n }\n store.context.handleScrollArrowVisibility(scroller);\n return;\n }\n if (maxAvailableHeight - nextHeight > SCROLL_EDGE_TOLERANCE_PX) {\n nextScrollTop = isTopPositioned ? Infinity : 0;\n } else if (isBottomPositioned && scrollTop < maxScrollTop) {\n const overshoot = currentHeight + diff - maxAvailableHeight;\n nextScrollTop = scrollTop - (diff - overshoot);\n }\n const nextPositionerHeight = Math.ceil(nextHeight);\n if (nextPositionerHeight !== 0) {\n setHeight(nextPositionerHeight);\n }\n if (nextScrollTop != null) {\n // Recompute bounds after resizing (clientHeight likely changed).\n const target = clamp(nextScrollTop, 0, getMaxScrollTop(scroller));\n\n // Avoid adjustments that re-trigger scroll events forever.\n if (Math.abs(scroller.scrollTop - target) > SCROLL_EDGE_TOLERANCE_PX) {\n scroller.scrollTop = target;\n }\n }\n if (nextPositionerHeight >= maxAvailableHeight - SCROLL_EDGE_TOLERANCE_PX) {\n reachedMaxHeightRef.current = true;\n }\n store.context.handleScrollArrowVisibility(scroller);\n });\n React.useImperativeHandle(store.context.scrollHandlerRef, () => handleScroll, [handleScroll]);\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete(true);\n }\n }\n });\n const state = {\n open,\n transitionStatus,\n side,\n align\n };\n useIsoLayoutEffect(() => {\n if (!positionerElement || !store.context.popupRef.current || Object.keys(originalPositionerStylesRef.current).length) {\n return;\n }\n originalPositionerStylesRef.current = {\n top: positionerElement.style.top || '0',\n left: positionerElement.style.left || '0',\n right: positionerElement.style.right,\n height: positionerElement.style.height,\n bottom: positionerElement.style.bottom,\n minHeight: positionerElement.style.minHeight,\n maxHeight: positionerElement.style.maxHeight,\n marginTop: positionerElement.style.marginTop,\n marginBottom: positionerElement.style.marginBottom\n };\n }, [store, positionerElement]);\n useIsoLayoutEffect(() => {\n if (open || alignItemWithTriggerActive) {\n return;\n }\n initialPlacedRef.current = false;\n reachedMaxHeightRef.current = false;\n clearStyles(positionerElement, originalPositionerStylesRef.current);\n }, [open, alignItemWithTriggerActive, positionerElement]);\n useIsoLayoutEffect(() => {\n const popupElement = store.context.popupRef.current;\n\n // Wait for Floating UI's first positioning pass before reading DOM geometry.\n // We replace the final coordinates for aligned selects, but still need middleware\n // like `size()` to set CSS variables such as `--anchor-width`.\n if (!open || !triggerElement || !positionerElement || !popupElement || alignItemWithTriggerActive && !isPositioned || store.state.transitionStatus === 'ending') {\n return;\n }\n initialPlacedRef.current = true;\n popupElement.style.removeProperty(SelectPositionerCssVars.transformOrigin);\n if (!alignItemWithTriggerActive) {\n // The wrapper supplies the scroller: the list owns scrolling once it has mounted, and\n // this effect re-runs (cancelling the stale frame) when that happens.\n scrollArrowFrame.request(() => store.context.handleScrollArrowVisibility(listElement || popupElement));\n return;\n }\n\n // Ensure we remove any transforms that can affect the location of the popup\n // and therefore the calculations.\n const restoreTransformStyles = unsetTransformStyles(popupElement);\n try {\n let textElement = store.context.selectedItemTextRef.current;\n if (!textElement?.isConnected) {\n const hasSelectedValue = store.select('hasSelectedValue');\n textElement = !hasSelectedValue && store.context.firstItemTextRef.current?.isConnected ? store.context.firstItemTextRef.current : null;\n }\n const valueElement = store.context.valueRef.current;\n const win = ownerWindow(positionerElement);\n const positionerStyles = win.getComputedStyle(positionerElement);\n const popupStyles = win.getComputedStyle(popupElement);\n const doc = ownerDocument(triggerElement);\n const scale = getScale(triggerElement);\n const triggerRect = normalizeRect(triggerElement.getBoundingClientRect(), scale);\n const positionerRect = normalizeRect(positionerElement.getBoundingClientRect(), scale);\n const triggerHeight = triggerRect.height;\n const scroller = listElement || popupElement;\n const scrollHeight = scroller.scrollHeight;\n const borderBottom = parseFloat(popupStyles.borderBottomWidth);\n // The `|| N` fallbacks cover an unset/`auto` value (parses to `NaN`). Note a literal `0`\n // also resolves to the fallback, so an explicit `margin: 0` or `min-height: 0` still takes\n // the default below.\n const marginTop = parseFloat(positionerStyles.marginTop) || 10;\n const marginBottom = parseFloat(positionerStyles.marginBottom) || 10;\n const minHeight = parseFloat(positionerStyles.minHeight) || 100;\n const maxPopupHeight = getMaxPopupHeight(popupStyles);\n const paddingLeft = 5;\n const paddingRight = 5;\n const triggerCollisionThreshold = 20;\n const viewportHeight = doc.documentElement.clientHeight - marginTop - marginBottom;\n const viewportWidth = doc.documentElement.clientWidth;\n const availableSpaceBeneathTrigger = viewportHeight - triggerRect.bottom + triggerHeight;\n let textRect;\n let alignedLeft = direction === 'rtl' ? triggerRect.right - positionerRect.width : triggerRect.left;\n let offsetY = 0;\n if (textElement && valueElement) {\n const valueRect = normalizeRect(valueElement.getBoundingClientRect(), scale);\n textRect = normalizeRect(textElement.getBoundingClientRect(), scale);\n alignedLeft = positionerRect.left + (direction === 'rtl' ? valueRect.right - textRect.right : valueRect.left - textRect.left);\n const valueCenterFromTriggerTop = valueRect.top - triggerRect.top + valueRect.height / 2;\n const textCenterFromPositionerTop = textRect.top - positionerRect.top + textRect.height / 2;\n offsetY = textCenterFromPositionerTop - valueCenterFromTriggerTop;\n }\n const idealHeight = availableSpaceBeneathTrigger + offsetY + marginBottom + borderBottom;\n let height = Math.min(viewportHeight, idealHeight);\n const maxHeight = viewportHeight - marginTop - marginBottom;\n const scrollTop = idealHeight - height;\n const maxRight = viewportWidth - paddingRight;\n positionerElement.style.left = `${clamp(alignedLeft, paddingLeft, maxRight - positionerRect.width)}px`;\n positionerElement.style.height = `${height}px`;\n // `none` (not the invalid `auto`) so the explicit height governs in align mode and isn't\n // clamped by a `max-height` from user CSS.\n positionerElement.style.maxHeight = 'none';\n positionerElement.style.marginTop = `${marginTop}px`;\n positionerElement.style.marginBottom = `${marginBottom}px`;\n popupElement.style.height = '100%';\n const maxScrollTop = getMaxScrollTop(scroller);\n const isTopPositioned = scrollTop >= maxScrollTop - SCROLL_EDGE_TOLERANCE_PX;\n if (isTopPositioned) {\n height = Math.min(viewportHeight, positionerRect.height) - (scrollTop - maxScrollTop);\n }\n\n // When the trigger is too close to the top or bottom of the viewport, or the minHeight is\n // reached, we fallback to aligning the popup to the trigger as the UX is poor otherwise.\n const fallbackToAlignPopupToTrigger = triggerRect.top < triggerCollisionThreshold || triggerRect.bottom > viewportHeight - triggerCollisionThreshold || Math.ceil(height) + SCROLL_EDGE_TOLERANCE_PX < Math.min(scrollHeight, minHeight);\n\n // Safari doesn't position the popup correctly when pinch-zoomed.\n const isPinchZoomed = (win.visualViewport?.scale ?? 1) !== 1 && platform.engine.webkit;\n if (fallbackToAlignPopupToTrigger || isPinchZoomed) {\n clearStyles(positionerElement, originalPositionerStylesRef.current);\n setControlledAlignItemWithTrigger(false);\n return;\n }\n const initialHeight = Math.max(minHeight, height);\n if (isTopPositioned) {\n const topOffset = Math.max(0, viewportHeight - idealHeight);\n positionerElement.style.top = positionerRect.height >= maxHeight ? '0' : `${topOffset}px`;\n positionerElement.style.height = `${height}px`;\n scroller.scrollTop = getMaxScrollTop(scroller);\n } else {\n positionerElement.style.bottom = '0';\n scroller.scrollTop = scrollTop;\n }\n if (textRect) {\n const popupTop = positionerRect.top;\n const popupHeight = positionerRect.height;\n const textCenterY = textRect.top + textRect.height / 2;\n const clampedY = clamp(popupHeight > 0 ? (textCenterY - popupTop) / popupHeight * 100 : 50, 0, 100);\n popupElement.style.setProperty(SelectPositionerCssVars.transformOrigin, `50% ${clampedY}%`);\n }\n if (initialHeight === viewportHeight || height >= maxPopupHeight) {\n reachedMaxHeightRef.current = true;\n }\n store.context.handleScrollArrowVisibility(scroller);\n if (highlightItemOnHover && store.state.selectedIndex === null && store.state.activeIndex === null && store.context.listRef.current[0] != null) {\n store.set('activeIndex', 0);\n }\n } finally {\n restoreTransformStyles();\n }\n }, [store, open, positionerElement, triggerElement, alignItemWithTriggerActive, setControlledAlignItemWithTrigger, scrollArrowFrame, listElement, highlightItemOnHover, direction, isPositioned]);\n React.useEffect(() => {\n if (!alignItemWithTriggerActive || !positionerElement || !open) {\n return undefined;\n }\n const win = ownerWindow(positionerElement);\n function handleResize(event) {\n store.context.setOpen(false, createChangeEventDetails(REASONS.windowResize, event));\n }\n return addEventListener(win, 'resize', handleResize);\n }, [store, alignItemWithTriggerActive, positionerElement, open]);\n const defaultProps = {\n ...(listElement ? {\n role: 'presentation'\n } : {\n role: 'listbox',\n 'aria-multiselectable': multiple || undefined,\n 'aria-readonly': readOnly || undefined,\n id: `${id}-list`\n }),\n onKeyDown(event) {\n if (insideToolbar && COMPOSITE_KEYS.has(event.key)) {\n event.stopPropagation();\n }\n },\n onScroll(event) {\n if (listElement) {\n return;\n }\n handleScroll(event.currentTarget);\n },\n ...(alignItemWithTriggerActive && {\n style: listElement ? {\n height: '100%'\n } : LIST_FUNCTIONAL_STYLES\n }),\n className: !listElement && alignItemWithTriggerActive ? styleDisableScrollbar.className : undefined\n };\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, store.context.popupRef],\n state,\n stateAttributesMapping,\n props: [popupProps, defaultProps, getDisabledMountTransitionStyles(transitionStatus), elementProps]\n });\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [!disableStyleElements && styleDisableScrollbar.getElement(nonce), /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingRootContext,\n modal: false,\n disabled: !mounted,\n openInteractionType: openMethod,\n returnFocus: finalFocus,\n restoreFocus: true,\n children: element\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectPopup.displayName = \"SelectPopup\";\nfunction getMaxPopupHeight(popupStyles) {\n const maxHeightStyle = popupStyles.maxHeight;\n return maxHeightStyle.endsWith('px') ? parseFloat(maxHeightStyle) || Infinity : Infinity;\n}\nfunction getMaxScrollTop(scroller) {\n return getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);\n}\nfunction getScale(element) {\n // The platform API is async-capable, but the DOM platform returns a plain scale object.\n return floatingPlatform.getScale(element);\n}\nfunction normalizeSize(size, axis, scale) {\n return size / scale[axis];\n}\nfunction normalizeRect(rect, scale) {\n return rectToClientRect({\n x: normalizeSize(rect.x, 'x', scale),\n y: normalizeSize(rect.y, 'y', scale),\n width: normalizeSize(rect.width, 'x', scale),\n height: normalizeSize(rect.height, 'y', scale)\n });\n}\nconst TRANSFORM_STYLE_RESETS = [['transform', 'none'], ['scale', '1'], ['translate', '0 0']];\nfunction unsetTransformStyles(popupElement) {\n const {\n style\n } = popupElement;\n const originalStyles = {};\n for (const [property, value] of TRANSFORM_STYLE_RESETS) {\n originalStyles[property] = style.getPropertyValue(property);\n style.setProperty(property, value, 'important');\n }\n return () => {\n for (const [property] of TRANSFORM_STYLE_RESETS) {\n const originalValue = originalStyles[property];\n if (originalValue) {\n style.setProperty(property, originalValue);\n } else {\n style.removeProperty(property);\n }\n }\n };\n}","import { jsx as _jsx } from \"react/jsx-runtime\";\nconst DISABLE_SCROLLBAR_CLASS_NAME = 'base-ui-disable-scrollbar';\nexport const styleDisableScrollbar = {\n className: DISABLE_SCROLLBAR_CLASS_NAME,\n getElement(nonce) {\n return /*#__PURE__*/_jsx(\"style\", {\n nonce: nonce,\n href: DISABLE_SCROLLBAR_CLASS_NAME,\n precedence: \"base-ui:low\",\n children: `.${DISABLE_SCROLLBAR_CLASS_NAME}{scrollbar-width:none}.${DISABLE_SCROLLBAR_CLASS_NAME}::-webkit-scrollbar{display:none}`\n });\n }\n};\nif (process.env.NODE_ENV !== \"production\") styleDisableScrollbar.getElement.displayName = \"styleDisableScrollbar.getElement\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const ToolbarRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") ToolbarRootContext.displayName = \"ToolbarRootContext\";\nexport function useToolbarRootContext(optional) {\n const context = React.useContext(ToolbarRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : _formatErrorMessage(69));\n }\n return context;\n}","import { isHTMLElement } from '@floating-ui/utils/dom';\nexport { stopEvent, isIndexOutOfListBounds, isListIndexDisabled, findNonDisabledListIndex, getMaxListIndex, getMinListIndex } from \"../../floating-ui-react/utils.mjs\";\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const HOME = 'Home';\nexport const END = 'End';\nexport const PAGE_UP = 'PageUp';\nexport const PAGE_DOWN = 'PageDown';\nexport const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);\nexport const SHIFT = 'Shift';\nexport const MODIFIER_KEYS = [SHIFT, 'Control', 'Alt', 'Meta'];\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName === 'INPUT';\n}\nexport function isNativeInput(element) {\n if (isInputElement(element) && element.selectionStart != null) {\n return true;\n }\n if (isHTMLElement(element) && element.tagName === 'TEXTAREA') {\n return true;\n }\n return false;\n}\nexport function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {\n if (!scrollContainer || !element || !element.scrollTo) {\n return;\n }\n let targetX = scrollContainer.scrollLeft;\n let targetY = scrollContainer.scrollTop;\n const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;\n const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;\n if (isOverflowingX && orientation !== 'vertical') {\n const elementOffsetLeft = getOffset(scrollContainer, element, 'left');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (direction === 'ltr') {\n if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n }\n }\n if (direction === 'rtl') {\n if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n }\n }\n }\n if (isOverflowingY && orientation !== 'horizontal') {\n const elementOffsetTop = getOffset(scrollContainer, element, 'top');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {\n // overflow upwards, align top edges\n targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;\n } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {\n // overflow downwards, align bottom edges\n targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;\n }\n }\n scrollContainer.scrollTo({\n left: targetX,\n top: targetY,\n behavior: 'auto'\n });\n}\nfunction getOffset(ancestor, element, side) {\n const propName = side === 'left' ? 'offsetLeft' : 'offsetTop';\n let result = 0;\n while (element.offsetParent) {\n result += element[propName];\n if (element.offsetParent === ancestor) {\n break;\n }\n element = element.offsetParent;\n }\n return result;\n}\nfunction getStyles(element) {\n const styles = getComputedStyle(element);\n return {\n scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,\n scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,\n scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,\n scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,\n scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,\n scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,\n scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,\n scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0\n };\n}","'use client';\n\nimport * as React from 'react';\nexport const CSPContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") CSPContext.displayName = \"CSPContext\";\nconst DEFAULT_CSP_CONTEXT_VALUE = {\n disableStyleElements: false\n};\nexport function useCSPContext() {\n return React.useContext(CSPContext) ?? DEFAULT_CSP_CONTEXT_VALUE;\n}","/**\n * The available width between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableWidth = '--available-width';\n/**\n * The available height between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableHeight = '--available-height';\n/**\n * The anchor's width.\n * @type {number}\n */\nexport const anchorWidth = '--anchor-width';\n/**\n * The anchor's height.\n * @type {number}\n */\nexport const anchorHeight = '--anchor-height';\n/**\n * The coordinates that this element is anchored to. Used for animations and transitions.\n * @type {string}\n */\nexport const transformOrigin = '--transform-origin';","'use client';\n\nimport * as React from 'react';\nimport { useSelectRootContext, useSelectRootPropsContext } from \"../root/SelectRootContext.mjs\";\nimport { useSelectPositionerContext } from \"../positioner/SelectPositionerContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { styleDisableScrollbar } from \"../../utils/styles.mjs\";\nimport { LIST_FUNCTIONAL_STYLES } from \"../popup/utils.mjs\";\n\n/**\n * A container for the select items.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectList = /*#__PURE__*/React.forwardRef(function SelectList(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const {\n multiple,\n readOnly\n } = useSelectRootPropsContext();\n const {\n alignItemWithTriggerActive\n } = useSelectPositionerContext();\n const hasScrollArrows = store.useState('hasScrollArrows');\n const openMethod = store.useState('openMethod');\n const id = store.useState('id');\n const defaultProps = {\n id: `${id}-list`,\n role: 'listbox',\n 'aria-multiselectable': multiple || undefined,\n 'aria-readonly': readOnly || undefined,\n onScroll(event) {\n store.context.scrollHandlerRef.current?.(event.currentTarget);\n },\n ...(alignItemWithTriggerActive && {\n style: LIST_FUNCTIONAL_STYLES\n }),\n className: hasScrollArrows && openMethod !== 'touch' ? styleDisableScrollbar.className : undefined\n };\n const setListElement = store.useStateSetter('listElement');\n return useRenderElement('div', componentProps, {\n ref: [forwardedRef, setListElement],\n props: [defaultProps, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectList.displayName = \"SelectList\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useSelectRootContext, useSelectRootPropsContext } from \"../root/SelectRootContext.mjs\";\nimport { useCompositeListItem } from \"../../internals/composite/list/useCompositeListItem.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { SelectItemContext } from \"./SelectItemContext.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { compareItemEquality, removeItem, resolveSelectedIndex } from \"../../internals/itemEquality.mjs\";\nimport { isVirtualClick } from \"../../floating-ui-react/utils/event.mjs\";\n\n/**\n * An individual option in the select popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItem = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItem(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n value: itemValue = null,\n label,\n disabled: disabledProp = false,\n nativeButton = false,\n ...elementProps\n } = componentProps;\n const textRef = React.useRef(null);\n const listItem = useCompositeListItem({\n guess: true,\n label,\n textRef\n });\n const store = useSelectRootContext();\n const {\n itemProps,\n multiple,\n disabled: selectDisabled,\n readOnly\n } = useSelectRootPropsContext();\n const disabled = selectDisabled || disabledProp;\n const highlighted = store.useState('isActive', listItem.index);\n const open = store.useState('open');\n const selected = store.useState('isSelected', itemValue);\n const selectedByFocus = store.useState('isSelectedByFocus', listItem.index);\n const isItemEqualToValue = store.useState('isItemEqualToValue');\n const index = listItem.index;\n const itemRef = React.useRef(null);\n useIsoLayoutEffect(() => {\n const values = store.context.valuesRef.current;\n values[index] = itemValue;\n return () => {\n delete values[index];\n };\n }, [index, itemValue, store]);\n useIsoLayoutEffect(() => {\n const selectedValue = store.state.value;\n const currentIndex = store.state.selectedIndex;\n let nextIndex = currentIndex;\n let claims;\n if (multiple && Array.isArray(selectedValue)) {\n // The claiming item also owns the text ref that aligns the popup.\n nextIndex = resolveSelectedIndex(index, itemValue, store.context.valuesRef.current, selectedValue, isItemEqualToValue, currentIndex);\n claims = nextIndex === index;\n if (index === currentIndex && !claims) {\n store.context.selectedItemTextRef.current = null;\n }\n } else {\n claims = selectedValue !== undefined && compareItemEquality(itemValue, selectedValue, isItemEqualToValue);\n if (claims) {\n nextIndex = index;\n }\n }\n store.set('selectedIndex', nextIndex);\n\n // Make sure SelectPopup can measure the selected item on first open.\n // SelectItemText can still update this ref later when focus moves.\n if (claims && textRef.current) {\n store.context.selectedItemTextRef.current = textRef.current;\n }\n }, [index, multiple, isItemEqualToValue, store, itemValue]);\n const pointerTypeRef = React.useRef('mouse');\n const allowMouseSelectionRef = React.useRef(false);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton,\n composite: true\n });\n const state = {\n disabled,\n selected,\n highlighted\n };\n function commitSelection(event) {\n // A forced-open select (`open`/`defaultOpen`) can still receive item activations even\n // when the root is disabled or read-only, so guard the commit here too.\n if (selectDisabled || readOnly) {\n return;\n }\n const selectedValue = store.state.value;\n if (multiple) {\n const currentValue = Array.isArray(selectedValue) ? selectedValue : [];\n const nextValue = selected ? removeItem(currentValue, itemValue, isItemEqualToValue) : [...currentValue, itemValue];\n store.context.setValue(nextValue, createChangeEventDetails(REASONS.itemPress, event));\n } else {\n store.context.setValue(itemValue, createChangeEventDetails(REASONS.itemPress, event));\n store.context.setOpen(false, createChangeEventDetails(REASONS.itemPress, event));\n }\n }\n function resetDragMovement() {\n store.context.selectionRef.current.dragY = 0;\n }\n const defaultProps = {\n role: 'option',\n 'aria-selected': selected,\n tabIndex: open && highlighted ? 0 : -1,\n onKeyDown(event) {\n store.set('activeIndex', index);\n if (event.key === ' ' && store.context.typingRef.current) {\n // `useButton` skips Space activation for `role=\"option\"` items when the keydown\n // is `defaultPrevented`, keeping typeahead spaces from committing a selection.\n event.preventDefault();\n }\n },\n onClick(event) {\n const isMouseClick = pointerTypeRef.current !== 'touch';\n const clickPointerType = event.nativeEvent.pointerType;\n const isVirtualMouseClick = isMouseClick && isVirtualClick(event.nativeEvent) && (\n // Generic no-pointer `detail === 0` clicks stay tied to highlight state. Virtual\n // clicks that carry browser pointer data, including an empty string from assistive\n // technology, can activate unhighlighted items.\n clickPointerType !== undefined || highlighted);\n // With alignItemWithTrigger, opening can place an item under the cursor. Real mouse\n // clicks must start on the item, while virtual clicks represent explicit keyboard or\n // assistive technology activation.\n const isInvalidMouseClick = isMouseClick && !isVirtualMouseClick && !allowMouseSelectionRef.current;\n allowMouseSelectionRef.current = false;\n if (disabled || isInvalidMouseClick) {\n return;\n }\n commitSelection(event.nativeEvent);\n },\n onPointerEnter(event) {\n pointerTypeRef.current = event.pointerType;\n },\n onPointerMove(event) {\n if (event.pointerType === 'mouse' && event.buttons === 1) {\n const selection = store.context.selectionRef.current;\n selection.dragY += event.movementY;\n if (selection.dragY ** 2 >= 64) {\n selection.allowUnselectedMouseUp = true;\n }\n }\n },\n onPointerDown(event) {\n pointerTypeRef.current = event.pointerType;\n allowMouseSelectionRef.current = true;\n resetDragMovement();\n },\n onMouseUp() {\n resetDragMovement();\n if (disabled || pointerTypeRef.current === 'touch') {\n return;\n }\n\n // Regular clicks are committed by the click event.\n if (allowMouseSelectionRef.current) {\n return;\n }\n const disallowSelectedMouseUp = !store.context.selectionRef.current.allowSelectedMouseUp && selected;\n const disallowUnselectedMouseUp = !store.context.selectionRef.current.allowUnselectedMouseUp && !selected;\n if (disallowSelectedMouseUp || disallowUnselectedMouseUp) {\n return;\n }\n allowMouseSelectionRef.current = true;\n itemRef.current?.click();\n allowMouseSelectionRef.current = false;\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [buttonRef, forwardedRef, listItem.ref, itemRef],\n state,\n props: [itemProps, defaultProps, elementProps, getButtonProps]\n });\n const contextValue = React.useMemo(() => ({\n selected,\n index,\n textRef,\n selectedByFocus\n }), [selected, index, textRef, selectedByFocus]);\n return /*#__PURE__*/_jsx(SelectItemContext.Provider, {\n value: contextValue,\n children: element\n });\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItem.displayName = \"SelectItem\";","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useCompositeListContext } from \"./CompositeListContext.mjs\";\n/**\n * Used to register a list item and its index (DOM position) in the `CompositeList`.\n */\nexport function useCompositeListItem(params = {}) {\n const {\n guess,\n label,\n metadata,\n textRef,\n index: externalIndex\n } = params;\n const {\n register,\n unregister,\n subscribeMapChange,\n nextIndexRef\n } = useCompositeListContext();\n\n // Guess the index from the render order. This avoids a re-render after mount for\n // flat lists rendered in DOM order; when the guess is wrong (grouped or out-of-order\n // rendering), the commit flush corrects it before paint.\n const indexRef = React.useRef(-1);\n const [internalIndex, setInternalIndex] = React.useState(externalIndex == null && guess ? () => {\n if (indexRef.current === -1) {\n const newIndex = nextIndexRef.current;\n nextIndexRef.current += 1;\n indexRef.current = newIndex;\n }\n return indexRef.current;\n } : -1);\n const index = externalIndex ?? internalIndex;\n const componentRef = React.useRef(null);\n\n // Deliberately identity-sensitive: nested items sharing one DOM node rely on ref attachment\n // order to decide which registration wins, and republishing from an effect instead would let\n // an inner item's later update silently take ownership from the outer one.\n const ref = React.useCallback(node => {\n const previousNode = componentRef.current;\n if (previousNode) {\n unregister(previousNode);\n }\n componentRef.current = node;\n if (node) {\n register(node, {\n metadata: metadata ?? null,\n index: externalIndex ?? null,\n label,\n textRef\n });\n }\n }, [externalIndex, register, unregister, metadata, label, textRef]);\n useIsoLayoutEffect(() => {\n if (externalIndex != null) {\n return undefined;\n }\n return subscribeMapChange(map => {\n const i = componentRef.current ? map.get(componentRef.current)?.index : null;\n if (i != null) {\n setInternalIndex(i);\n }\n });\n }, [externalIndex, subscribeMapChange]);\n return {\n ref,\n index\n };\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectItemContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectItemContext.displayName = \"SelectItemContext\";\nexport function useSelectItemContext() {\n const context = React.useContext(SelectItemContext);\n if (!context) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectItemContext is missing. SelectItem parts must be placed within <Select.Item>.' : _formatErrorMessage(57));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\n\n/**\n * Indicates whether the select item is selected.\n * Renders a `<span>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectItemIndicator = /*#__PURE__*/React.forwardRef(function SelectItemIndicator(componentProps, forwardedRef) {\n const {\n selected\n } = useSelectItemContext();\n const shouldRender = componentProps.keepMounted || selected;\n if (!shouldRender) {\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return /*#__PURE__*/_jsx(Inner, {\n ...componentProps,\n ref: forwardedRef\n });\n});\n\n// Split the core implementation to avoid paying the hook costs unless the element needs to mount.\nif (process.env.NODE_ENV !== \"production\") SelectItemIndicator.displayName = \"SelectItemIndicator\";\nconst Inner = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef((componentProps, forwardedRef) => {\n const {\n render,\n className,\n style,\n keepMounted,\n ...elementProps\n } = componentProps;\n const {\n selected\n } = useSelectItemContext();\n const indicatorRef = React.useRef(null);\n const {\n transitionStatus,\n setMounted\n } = useTransitionStatus(selected);\n const state = {\n selected,\n transitionStatus\n };\n const element = useRenderElement('span', componentProps, {\n ref: [forwardedRef, indicatorRef],\n state,\n props: [{\n 'aria-hidden': true,\n children: '✔️'\n }, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n useOpenChangeComplete({\n batch: true,\n enabled: !selected,\n open: selected,\n ref: indicatorRef,\n onComplete() {\n if (!selected) {\n setMounted(false);\n }\n }\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") Inner.displayName = \"Inner\";","'use client';\n\nimport * as React from 'react';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useSelectItemContext } from \"../item/SelectItemContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A text label of the select item.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectItemText = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(function SelectItemText(componentProps, forwardedRef) {\n const {\n index,\n textRef,\n selectedByFocus\n } = useSelectItemContext();\n const store = useSelectRootContext();\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const localRef = React.useCallback(node => {\n if (!node) {\n return;\n }\n if (index === 0) {\n store.context.firstItemTextRef.current = node;\n }\n if (selectedByFocus) {\n store.context.selectedItemTextRef.current = node;\n }\n }, [store, index, selectedByFocus]);\n const element = useRenderElement('div', componentProps, {\n ref: [localRef, forwardedRef, textRef],\n props: elementProps\n });\n return element;\n}));\nif (process.env.NODE_ENV !== \"production\") SelectItemText.displayName = \"SelectItemText\";","'use client';\n\nimport * as React from 'react';\nimport { useSelectPositionerContext } from \"../positioner/SelectPositionerContext.mjs\";\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Displays an element positioned against the select popup anchor.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectArrow = /*#__PURE__*/React.forwardRef(function SelectArrow(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const store = useSelectRootContext();\n const {\n side,\n align,\n arrowRef,\n arrowStyles,\n arrowUncentered,\n alignItemWithTriggerActive\n } = useSelectPositionerContext();\n const open = store.useState('open');\n const state = {\n open,\n side,\n align,\n uncentered: arrowUncentered\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [arrowRef, forwardedRef],\n props: [{\n style: arrowStyles,\n 'aria-hidden': true\n }, elementProps],\n stateAttributesMapping: popupTransitionStateMapping\n });\n if (alignItemWithTriggerActive) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectArrow.displayName = \"SelectArrow\";","'use client';\n\nimport * as React from 'react';\nimport { SelectScrollArrow } from \"../scroll-arrow/SelectScrollArrow.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * An element that scrolls the select popup down when hovered. Does not render when using touch input.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectScrollDownArrow = /*#__PURE__*/React.forwardRef(function SelectScrollDownArrow(props, forwardedRef) {\n return /*#__PURE__*/_jsx(SelectScrollArrow, {\n ...props,\n ref: forwardedRef,\n direction: \"down\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectScrollDownArrow.displayName = \"SelectScrollDownArrow\";","'use client';\n\nimport * as React from 'react';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useSelectPositionerContext } from \"../positioner/SelectPositionerContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { getMaxScrollOffset, normalizeScrollOffset, SCROLL_EDGE_TOLERANCE_PX } from \"../../utils/scrollEdges.mjs\";\n\n/**\n * @internal\n */\nexport const SelectScrollArrow = /*#__PURE__*/React.forwardRef(function SelectScrollArrow(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n direction,\n keepMounted,\n ...elementProps\n } = componentProps;\n const isUp = direction === 'up';\n const store = useSelectRootContext();\n const {\n side,\n scrollDownArrowRef,\n scrollUpArrowRef\n } = useSelectPositionerContext();\n const visibleSelector = isUp ? 'scrollUpArrowVisible' : 'scrollDownArrowVisible';\n const stateVisible = store.useState(visibleSelector);\n const openMethod = store.useState('openMethod');\n\n // Scroll arrows are disabled for touch modality as they are a hover-only element.\n const visible = stateVisible && openMethod !== 'touch';\n const timeout = useTimeout();\n const scrollArrowRef = isUp ? scrollUpArrowRef : scrollDownArrowRef;\n const {\n mounted,\n transitionStatus,\n setMounted\n } = useTransitionStatus(visible);\n useIsoLayoutEffect(() => {\n store.context.scrollArrowsMountedCountRef.current += 1;\n store.set('hasScrollArrows', true);\n return () => {\n store.context.scrollArrowsMountedCountRef.current = Math.max(0, store.context.scrollArrowsMountedCountRef.current - 1);\n if (store.context.scrollArrowsMountedCountRef.current === 0) {\n store.set('hasScrollArrows', false);\n }\n };\n }, [store]);\n useOpenChangeComplete({\n open: visible,\n ref: scrollArrowRef,\n onComplete() {\n if (!visible) {\n setMounted(false);\n }\n }\n });\n const state = {\n direction,\n visible,\n side,\n transitionStatus\n };\n const defaultProps = {\n 'aria-hidden': true,\n children: isUp ? '▲' : '▼',\n style: {\n position: 'absolute'\n },\n onMouseMove(event) {\n if (event.movementX === 0 && event.movementY === 0 || timeout.isStarted()) {\n return;\n }\n store.set('activeIndex', null);\n function scrollNextItem() {\n const scroller = store.state.listElement ?? store.context.popupRef.current;\n if (!scroller) {\n return;\n }\n store.set('activeIndex', null);\n store.context.handleScrollArrowVisibility(scroller);\n const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);\n const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);\n const isScrolledToEdge = scrollTop === (isUp ? 0 : maxScrollTop);\n const items = store.context.listRef.current;\n if (scrollTop !== scroller.scrollTop) {\n scroller.scrollTop = scrollTop;\n }\n if (isScrolledToEdge) {\n timeout.clear();\n return;\n }\n if (items.length > 0) {\n const scrollArrowHeight = scrollArrowRef.current?.offsetHeight || 0;\n scroller.scrollTop = getTargetScrollTop(items, isUp, scrollTop, scroller.clientHeight, scrollArrowHeight, maxScrollTop);\n }\n timeout.start(40, scrollNextItem);\n }\n timeout.start(40, scrollNextItem);\n },\n onMouseLeave() {\n timeout.clear();\n }\n };\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, scrollArrowRef],\n state,\n props: [defaultProps, elementProps],\n stateAttributesMapping: transitionStatusMapping\n });\n const shouldRender = mounted || keepMounted;\n if (!shouldRender) {\n return null;\n }\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectScrollArrow.displayName = \"SelectScrollArrow\";\nfunction getTargetScrollTop(items, isUp, scrollTop, clientHeight, scrollArrowHeight, maxScrollTop) {\n if (isUp) {\n let firstVisibleIndex = 0;\n const visibleTop = scrollTop + scrollArrowHeight - SCROLL_EDGE_TOLERANCE_PX;\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item && item.offsetTop >= visibleTop) {\n firstVisibleIndex = i;\n break;\n }\n }\n const targetIndex = Math.max(0, firstVisibleIndex - 1);\n const targetItem = items[targetIndex];\n return targetIndex < firstVisibleIndex && targetItem ? normalizeScrollOffset(targetItem.offsetTop - scrollArrowHeight, maxScrollTop) : 0;\n }\n let lastVisibleIndex = items.length - 1;\n const visibleBottom = scrollTop + clientHeight - scrollArrowHeight + SCROLL_EDGE_TOLERANCE_PX;\n for (let i = 0; i < items.length; i += 1) {\n const item = items[i];\n if (item && item.offsetTop + item.offsetHeight > visibleBottom) {\n lastVisibleIndex = Math.max(0, i - 1);\n break;\n }\n }\n const targetIndex = Math.min(items.length - 1, lastVisibleIndex + 1);\n const targetItem = items[targetIndex];\n return targetIndex > lastVisibleIndex && targetItem ? normalizeScrollOffset(targetItem.offsetTop + targetItem.offsetHeight - clientHeight + scrollArrowHeight, maxScrollTop) : maxScrollTop;\n}","'use client';\n\nimport * as React from 'react';\nimport { SelectScrollArrow } from \"../scroll-arrow/SelectScrollArrow.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * An element that scrolls the select popup up when hovered. Does not render when using touch input.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectScrollUpArrow = /*#__PURE__*/React.forwardRef(function SelectScrollUpArrow(props, forwardedRef) {\n return /*#__PURE__*/_jsx(SelectScrollArrow, {\n ...props,\n ref: forwardedRef,\n direction: \"up\"\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectScrollUpArrow.displayName = \"SelectScrollUpArrow\";","'use client';\n\nimport * as React from 'react';\nimport { SelectGroupContext } from \"./SelectGroupContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Groups related select items with the corresponding label.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const SelectGroup = /*#__PURE__*/React.forwardRef(function SelectGroup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const [labelId, setLabelId] = React.useState();\n const contextValue = React.useMemo(() => ({\n labelId,\n setLabelId\n }), [labelId, setLabelId]);\n const element = useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [{\n role: 'group',\n 'aria-labelledby': labelId\n }, elementProps]\n });\n return /*#__PURE__*/_jsx(SelectGroupContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectGroup.displayName = \"SelectGroup\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const SelectGroupContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") SelectGroupContext.displayName = \"SelectGroupContext\";\nexport function useSelectGroupContext() {\n const context = React.useContext(SelectGroupContext);\n if (context === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: SelectGroupContext is missing. SelectGroup parts must be placed within <Select.Group>.' : _formatErrorMessage(56));\n }\n return context;\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useSelectGroupContext } from \"../group/SelectGroupContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * An accessible label that is automatically associated with its parent group.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectGroupLabel = /*#__PURE__*/React.forwardRef(function SelectGroupLabel(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const {\n setLabelId\n } = useSelectGroupContext();\n const id = useBaseUiId(idProp);\n useIsoLayoutEffect(() => {\n setLabelId(id);\n return () => {\n setLabelId(currentId => currentId === id ? undefined : currentId);\n };\n }, [id, setLabelId]);\n const element = useRenderElement('div', componentProps, {\n ref: forwardedRef,\n props: [{\n id,\n 'aria-hidden': true\n }, elementProps]\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") SelectGroupLabel.displayName = \"SelectGroupLabel\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * A visual separator between items.\n * Renders a `<div>` element.\n *\n * @internal\n */\nexport const ListboxSeparator = /*#__PURE__*/React.forwardRef(function ListboxSeparator(componentProps, forwardedRef) {\n const {\n className,\n render,\n orientation = 'horizontal',\n style,\n ...elementProps\n } = componentProps;\n const state = {\n orientation\n };\n return useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: [{\n role: 'presentation'\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") ListboxSeparator.displayName = \"ListboxSeparator\";","'use client';\n\nimport { ListboxSeparator } from \"../../utils/listbox-separator/ListboxSeparator.mjs\";\n/**\n * A visual separator between items or groups.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectSeparator = ListboxSeparator;","import { cva, type VariantProps } from \"class-variance-authority\";\nimport type { SVGProps } from \"react\";\n\nimport \"./icon.css\";\n\n// Named size scale taken from the design-tokens `icon.size` group\n// (--eg-icon-size-*). Icons are authored at the Figma-native 16×16 viewBox and\n// scaled via these sizes. Color is NOT a variant — it inherits from\n// `currentColor` (see icon.css), so consumers theme it through a CSS class.\nconst iconVariants = cva(\"eg-icon\", {\n variants: {\n size: {\n s: \"eg-icon--size-s\",\n m: \"eg-icon--size-m\",\n l: \"eg-icon--size-l\",\n },\n },\n defaultVariants: {\n size: \"m\",\n },\n});\n\nexport interface IconProps\n extends\n Omit<SVGProps<SVGSVGElement>, \"className\" | \"color\">,\n VariantProps<typeof iconVariants> {\n className?: string;\n /**\n * Icon color — any CSS color, e.g. `\"#10069f\"` or a token\n * `\"var(--eg-color-primary-royal-blue)\"`. Drives the `currentColor` fill.\n * Omit it to inherit `color` from a CSS class / ancestor instead.\n */\n color?: string;\n}\n\n/**\n * Internal base used by every generated icon. Renders the shared `<svg>` shell\n * (16×16 viewBox, `currentColor` fill, `aria-hidden` by default) and applies\n * the size class. Pass `aria-hidden={false}` + `aria-label` for a meaningful\n * icon. Each concrete icon supplies its paths as `children`.\n */\nexport function IconBase({\n size,\n className,\n color,\n style,\n children,\n ...props\n}: IconProps) {\n return (\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n aria-hidden=\"true\"\n focusable=\"false\"\n className={iconVariants({ size, className })}\n // `color` drives `currentColor`. The explicit prop wins over any\n // `color` set through `style`.\n style={color ? { ...style, color } : style}\n {...props}\n >\n {children}\n </svg>\n );\n}\n\nexport { iconVariants };\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/chevron-down.\nexport function ChevronDown(props: IconProps) {\n return (\n <IconBase {...props}>\n <path d=\"M8 11L3 5.99999L3.7 5.29999L8 9.59999L12.3 5.29999L13 5.99999L8 11Z\" />\n </IconBase>\n );\n}\n","\"use client\";\nimport * as React from \"react\";\nimport { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport { cx } from \"class-variance-authority\";\n\nimport { ChevronDown } from \"../../icons/ChevronDown\";\nimport \"./Select.css\";\n\n// ── Root ─────────────────────────────────────────────────────────────────────\nexport function Select<\n Value = unknown,\n Multiple extends boolean | undefined = false,\n>(props: SelectPrimitive.Root.Props<Value, Multiple>): React.JSX.Element {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\n// ── Label (plain <label>, place outside Select.Root) ──────────────────────────\nexport interface SelectLabelProps\n extends Omit<React.LabelHTMLAttributes<HTMLLabelElement>, \"className\"> {\n className?: string;\n disabled?: boolean;\n}\n\nexport function SelectLabel({\n className,\n disabled,\n ...props\n}: SelectLabelProps) {\n return (\n <label\n data-slot=\"select-label\"\n data-disabled={disabled || undefined}\n className={cx(\"eg-select-label\", className)}\n {...props}\n />\n );\n}\n\n// ── Helper text (place outside Select.Root) ──────────────────────────────────\nexport interface SelectHelperTextProps\n extends Omit<React.HTMLAttributes<HTMLSpanElement>, \"className\"> {\n className?: string;\n}\n\nexport function SelectHelperText({\n className,\n ...props\n}: SelectHelperTextProps) {\n return (\n <span\n data-slot=\"select-helper-text\"\n className={cx(\"eg-select-helper-text\", className)}\n {...props}\n />\n );\n}\n\n// ── Trigger ───────────────────────────────────────────────────────────────────\n// Combines Select.Trigger + Select.Value + trailing chevron.\n// Styled as a NavigationMenu trigger (transparent, 36 px, no border) so it can\n// sit directly next to NavigationMenu items in a header. States (hover, focus,\n// open, disabled) are pure CSS pseudo-classes / data-attributes.\n\nexport interface SelectTriggerProps\n extends Omit<SelectPrimitive.Trigger.Props, \"className\"> {\n className?: string;\n placeholder?: string;\n leadingIcon?: React.ReactNode;\n /** Formats the selected value for the collapsed trigger only — the open\n * dropdown list still renders each SelectItem's own children. */\n renderValue?: (value: unknown) => React.ReactNode;\n}\n\nexport function SelectTrigger({\n className,\n placeholder,\n leadingIcon,\n renderValue,\n ...props\n}: SelectTriggerProps) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n className={cx(\"eg-select-trigger\", className)}\n {...props}\n >\n {leadingIcon != null && (\n <span className=\"eg-select-trigger__icon\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n <SelectPrimitive.Value\n className=\"eg-select-value\"\n placeholder={placeholder}\n >\n {renderValue}\n </SelectPrimitive.Value>\n <span className=\"eg-select-trigger__chevron\" aria-hidden=\"true\">\n <ChevronDown />\n </span>\n </SelectPrimitive.Trigger>\n );\n}\n\n// ── Content (Portal → Positioner → Popup → List) ──────────────────────────────\n// Wraps the positioning infrastructure so consumers just pass items as children.\n\nexport interface SelectContentProps extends SelectPrimitive.Popup.Props {\n sideOffset?: number;\n alignItemWithTrigger?: boolean;\n className?: string;\n container?: HTMLElement | ShadowRoot | null;\n}\n\nexport function SelectContent({\n className,\n children,\n sideOffset = 0,\n alignItemWithTrigger = true,\n container,\n ...props\n}: SelectContentProps) {\n return (\n <SelectPrimitive.Portal {...(container != null ? { container } : {})}>\n <SelectPrimitive.Positioner\n sideOffset={sideOffset}\n alignItemWithTrigger={alignItemWithTrigger}\n >\n <SelectPrimitive.Popup\n data-slot=\"select-popup\"\n className={cx(\"eg-select-popup\", className)}\n {...props}\n >\n <SelectPrimitive.List className=\"eg-select-list\">\n {children}\n </SelectPrimitive.List>\n </SelectPrimitive.Popup>\n </SelectPrimitive.Positioner>\n </SelectPrimitive.Portal>\n );\n}\n\n// ── Item ─────────────────────────────────────────────────────────────────────\n// Renders ItemText (flex-grow label) + ItemIndicator (checkmark, layout-stable).\n// Pass a leadingIcon as React node for icon-prefixed items.\n\nexport interface SelectItemProps\n extends Omit<SelectPrimitive.Item.Props, \"className\"> {\n className?: string;\n leadingIcon?: React.ReactNode;\n}\n\nexport function SelectItem({\n className,\n children,\n leadingIcon,\n ...props\n}: SelectItemProps) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cx(\"eg-select-item\", className)}\n {...props}\n >\n {leadingIcon != null && (\n <span className=\"eg-select-item__icon\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n <SelectPrimitive.ItemText className=\"eg-select-item__text\">\n {children}\n </SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\n// ── Group + GroupLabel ────────────────────────────────────────────────────────\nexport function SelectGroup(props: SelectPrimitive.Group.Props) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nexport interface SelectGroupLabelProps\n extends Omit<SelectPrimitive.GroupLabel.Props, \"className\"> {\n className?: string;\n}\n\nexport function SelectGroupLabel({\n className,\n ...props\n}: SelectGroupLabelProps) {\n return (\n <SelectPrimitive.GroupLabel\n data-slot=\"select-group-label\"\n className={cx(\"eg-select-group-label\", className)}\n {...props}\n />\n );\n}\n\n// ── Separator ─────────────────────────────────────────────────────────────────\nexport interface SelectSeparatorProps\n extends Omit<SelectPrimitive.Separator.Props, \"className\"> {\n className?: string;\n}\n\nexport function SelectSeparator({\n className,\n ...props\n}: SelectSeparatorProps) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cx(\"eg-select-separator\", className)}\n {...props}\n />\n );\n}\n","\"use client\";\nimport * as React from \"react\";\nimport { Dialog as DialogPrimitive } from \"@base-ui/react/dialog\";\n\nimport { Button } from \"../Button\";\nimport { Warning } from \"../../icons/Warning\";\nimport \"./ErrorDialog.css\";\n\nexport interface ErrorDialogProps {\n /** Controlled open state — the consumer owns when this dialog appears. */\n open: boolean;\n /** Called when the dialog should close (Close button, Escape, backdrop click). */\n onClose: () => void;\n /** Dialog heading, e.g. \"Fehler\" or a translated error title. */\n title: string;\n /** Main body text — already resolved/translated by the caller. */\n message: string;\n /** Optional pre-formatted reference line, e.g. \"Referenz: <traceId> (<errorCode>)\". */\n reference?: string;\n /** Optional extra key/value pairs shown in a collapsible \"Details\" section. */\n details?: Record<string, unknown>;\n /** Label for the close button. Defaults to \"Schliessen\". */\n closeLabel?: string;\n /** Label for the details disclosure toggle. Defaults to \"Details\". */\n detailsLabel?: string;\n}\n\n/**\n * Formats a details value for display, tolerating inputs `JSON.stringify` can't\n * handle cleanly (circular references, `BigInt`, `undefined`) so the error-display\n * path itself never throws.\n */\nfunction formatDetailValue(value: unknown): string {\n if (typeof value === \"string\") return value;\n try {\n const json = JSON.stringify(value);\n return json ?? String(value);\n } catch {\n return String(value);\n }\n}\n\nexport function ErrorDialog({\n open,\n onClose,\n title,\n message,\n reference,\n details,\n closeLabel = \"Schliessen\",\n detailsLabel = \"Details\",\n}: ErrorDialogProps): React.JSX.Element {\n const detailsEntries = details ? Object.entries(details) : [];\n\n return (\n <DialogPrimitive.Root\n open={open}\n onOpenChange={(nextOpen) => {\n if (!nextOpen) onClose();\n }}\n >\n <DialogPrimitive.Portal>\n <DialogPrimitive.Backdrop\n data-slot=\"error-dialog-backdrop\"\n className=\"eg-error-dialog__backdrop\"\n />\n <DialogPrimitive.Viewport className=\"eg-error-dialog__viewport\">\n <DialogPrimitive.Popup\n data-slot=\"error-dialog\"\n className=\"eg-error-dialog\"\n role=\"alertdialog\"\n >\n <div className=\"eg-error-dialog__header\">\n <Warning className=\"eg-error-dialog__icon\" />\n <DialogPrimitive.Title\n data-slot=\"error-dialog-title\"\n className=\"eg-error-dialog__title\"\n >\n {title}\n </DialogPrimitive.Title>\n </div>\n <DialogPrimitive.Description\n data-slot=\"error-dialog-message\"\n className=\"eg-error-dialog__message\"\n >\n {message}\n </DialogPrimitive.Description>\n {reference && (\n <p\n data-slot=\"error-dialog-reference\"\n className=\"eg-error-dialog__reference\"\n >\n {reference}\n </p>\n )}\n {detailsEntries.length > 0 && (\n <details\n data-slot=\"error-dialog-details\"\n className=\"eg-error-dialog__details\"\n >\n <summary\n data-slot=\"error-dialog-details-toggle\"\n className=\"eg-error-dialog__details-summary\"\n >\n {detailsLabel}\n </summary>\n <dl className=\"eg-error-dialog__details-list\">\n {detailsEntries.map(([key, value]) => (\n <React.Fragment key={key}>\n <dt className=\"eg-error-dialog__details-key\">{key}</dt>\n <dd className=\"eg-error-dialog__details-value\">\n {formatDetailValue(value)}\n </dd>\n </React.Fragment>\n ))}\n </dl>\n </details>\n )}\n <div className=\"eg-error-dialog__footer\">\n <DialogPrimitive.Close\n render={\n <Button\n variant=\"secondary\"\n size=\"m\"\n data-slot=\"error-dialog-close\"\n >\n {closeLabel}\n </Button>\n }\n />\n </div>\n </DialogPrimitive.Popup>\n </DialogPrimitive.Viewport>\n </DialogPrimitive.Portal>\n </DialogPrimitive.Root>\n );\n}\n","export { DialogBackdrop as Backdrop } from \"./backdrop/DialogBackdrop.mjs\";\nexport { DialogClose as Close } from \"./close/DialogClose.mjs\";\nexport { DialogDescription as Description } from \"./description/DialogDescription.mjs\";\nexport { DialogPopup as Popup } from \"./popup/DialogPopup.mjs\";\nexport { DialogPortal as Portal } from \"./portal/DialogPortal.mjs\";\nexport { DialogRoot as Root } from \"./root/DialogRoot.mjs\";\nexport { DialogViewport as Viewport } from \"./viewport/DialogViewport.mjs\";\nexport { DialogTitle as Title } from \"./title/DialogTitle.mjs\";\nexport { DialogTrigger as Trigger } from \"./trigger/DialogTrigger.mjs\";\nexport { createDialogHandle as createHandle, DialogHandle as Handle } from \"./store/DialogHandle.mjs\";","'use client';\n\nimport * as React from 'react';\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * An overlay displayed beneath the popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogBackdrop = /*#__PURE__*/React.forwardRef(function DialogBackdrop(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n forceRender = false,\n ...elementProps\n } = componentProps;\n const store = useDialogRootContext();\n const open = store.useState('open');\n const nested = store.useState('nested');\n const mounted = store.useState('mounted');\n const transitionStatus = store.useState('transitionStatus');\n const state = {\n open,\n transitionStatus\n };\n return useRenderElement('div', componentProps, {\n state,\n ref: [store.context.backdropRef, forwardedRef],\n stateAttributesMapping: popupTransitionStateMapping,\n props: [{\n role: 'presentation',\n hidden: !mounted,\n style: {\n userSelect: 'none',\n WebkitUserSelect: 'none'\n }\n }, elementProps],\n enabled: forceRender || !nested\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogBackdrop.displayName = \"DialogBackdrop\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const DialogRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") DialogRootContext.displayName = \"DialogRootContext\";\nexport function useDialogRootContext(optional) {\n const store = React.useContext(DialogRootContext);\n if (!optional && store === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.' : _formatErrorMessage(27));\n }\n return store;\n}","'use client';\n\nimport * as React from 'react';\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * A button that closes the dialog.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogClose = /*#__PURE__*/React.forwardRef(function DialogClose(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n ...elementProps\n } = componentProps;\n const store = useDialogRootContext();\n const open = store.useState('open');\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const state = {\n disabled\n };\n function handleClick(event) {\n if (open) {\n store.setOpen(false, createChangeEventDetails(REASONS.closePress, event.nativeEvent));\n }\n }\n return useRenderElement('button', componentProps, {\n state,\n ref: [forwardedRef, buttonRef],\n props: [{\n onClick: handleClick\n }, elementProps, getButtonProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogClose.displayName = \"DialogClose\";","'use client';\n\nimport * as React from 'react';\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\n/**\n * A paragraph with additional information about the dialog.\n * Renders a `<p>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogDescription = /*#__PURE__*/React.forwardRef(function DialogDescription(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const store = useDialogRootContext();\n const id = useBaseUiId(idProp);\n store.useSyncedValueWithCleanup('descriptionElementId', id);\n return useRenderElement('p', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogDescription.displayName = \"DialogDescription\";","'use client';\n\nimport * as React from 'react';\nimport { FloatingFocusManager } from \"../../floating-ui-react/index.mjs\";\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useDialogPortalContext } from \"../portal/DialogPortalContext.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { COMPOSITE_KEYS } from \"../../internals/composite/composite.mjs\";\nimport { FOCUSABLE_POPUP_PROPS, createDefaultInitialFocus } from \"../../utils/popups/index.mjs\";\nimport * as DialogPopupCssVars from \"./DialogPopupCssVars.mjs\";\nimport { dialogStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\n\n/**\n * A container for the dialog contents.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const DialogPopup = /*#__PURE__*/React.forwardRef(function DialogPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n finalFocus,\n initialFocus,\n ...elementProps\n } = componentProps;\n const store = useDialogRootContext();\n const descriptionElementId = store.useState('descriptionElementId');\n const disablePointerDismissal = store.useState('disablePointerDismissal');\n const floatingRootContext = store.useState('floatingRootContext');\n const rootPopupProps = store.useState('popupProps');\n const modal = store.useState('modal');\n const mounted = store.useState('mounted');\n const nested = store.useState('nested');\n const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');\n const open = store.useState('open');\n const openMethod = store.useState('openMethod');\n const titleElementId = store.useState('titleElementId');\n const transitionStatus = store.useState('transitionStatus');\n const role = store.useState('role');\n const floatingId = floatingRootContext.useState('floatingId');\n useDialogPortalContext();\n useOpenChangeComplete({\n open,\n ref: store.context.popupRef,\n onComplete() {\n if (open) {\n store.context.onOpenChangeComplete?.(true);\n }\n }\n });\n const resolvedInitialFocus = initialFocus === undefined ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;\n const nestedDialogOpen = nestedOpenDialogCount > 0;\n const setPopupElement = store.useStateSetter('popupElement');\n const state = {\n open,\n nested,\n transitionStatus,\n nestedDialogOpen\n };\n const element = useRenderElement('div', componentProps, {\n state,\n props: [rootPopupProps, {\n id: floatingId,\n 'aria-labelledby': titleElementId,\n 'aria-describedby': descriptionElementId,\n role,\n ...FOCUSABLE_POPUP_PROPS,\n hidden: !mounted,\n onKeyDown(event) {\n if (COMPOSITE_KEYS.has(event.key)) {\n event.stopPropagation();\n }\n },\n style: {\n [DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount\n }\n }, elementProps],\n ref: [forwardedRef, store.context.popupRef, setPopupElement],\n stateAttributesMapping: dialogStateAttributesMapping\n });\n return /*#__PURE__*/_jsx(FloatingFocusManager, {\n context: floatingRootContext,\n openInteractionType: openMethod,\n disabled: !mounted,\n closeOnFocusOut: !disablePointerDismissal,\n initialFocus: resolvedInitialFocus,\n returnFocus: finalFocus,\n modal: modal !== false,\n restoreFocus: \"popup\",\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogPopup.displayName = \"DialogPopup\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const DialogPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") DialogPortalContext.displayName = \"DialogPortalContext\";\nexport function useDialogPortalContext() {\n const value = React.useContext(DialogPortalContext);\n if (value === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Dialog.Portal> is missing.' : _formatErrorMessage(26));\n }\n return value;\n}","/**\n * Indicates how many dialogs are nested within.\n * @type {number}\n */\nexport const nestedDialogs = '--nested-dialogs';","import { CommonPopupDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the dialog is open.\n */\nexport const open = CommonPopupDataAttributes.open;\n/**\n * Present when the dialog is closed.\n */\nexport const closed = CommonPopupDataAttributes.closed;\n/**\n * Present when the dialog begins animating in.\n */\nexport const startingStyle = CommonPopupDataAttributes.startingStyle;\n/**\n * Present when the dialog is animating out.\n */\nexport const endingStyle = CommonPopupDataAttributes.endingStyle;\n/**\n * Present when the dialog is nested within another dialog.\n */\nexport const nested = 'data-nested';\n/**\n * Present when the dialog has other open dialogs nested within it.\n */\nexport const nestedDialogOpen = 'data-nested-dialog-open';","import { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport * as DialogPopupDataAttributes from \"../popup/DialogPopupDataAttributes.mjs\";\n\n/**\n * Shared by `Dialog.Popup` and `Dialog.Viewport`, whose states have the same shape.\n * `nested` is not mapped: unmapped `true` booleans already render as `data-nested`.\n */\nexport const dialogStateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping,\n nestedDialogOpen(value) {\n return value ? {\n [DialogPopupDataAttributes.nestedDialogOpen]: ''\n } : null;\n }\n};","'use client';\n\nimport * as React from 'react';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { DialogPortalContext } from \"./DialogPortalContext.mjs\";\nimport { InternalBackdrop } from \"../../utils/InternalBackdrop.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport const DialogPortal = /*#__PURE__*/React.forwardRef(function DialogPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const store = useDialogRootContext();\n const mounted = store.useState('mounted');\n const modal = store.useState('modal');\n const open = store.useState('open');\n const shouldRender = mounted || keepMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(DialogPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsxs(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps,\n children: [mounted && modal === true && /*#__PURE__*/_jsx(InternalBackdrop, {\n ref: store.context.internalBackdropRef,\n inert: inertValue(!open)\n }), props.children]\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogPortal.displayName = \"DialogPortal\";","'use client';\n\nimport * as React from 'react';\nimport { DialogInteractions } from \"./useDialogRoot.mjs\";\nimport { DialogRootContext, useDialogRootContext } from \"./DialogRootContext.mjs\";\nimport { DialogStore } from \"../store/DialogStore.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useImplicitActiveTrigger, useOpenStateTransitions, PopupHandleAttachment, usePopupRootStore, usePopupRootSync } from \"../../utils/popups/index.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function useRenderDialogRoot(mode, props) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n disablePointerDismissal: disablePointerDismissalProp = false,\n modal: modalProp = true,\n actionsRef,\n handle,\n triggerId: triggerIdProp,\n defaultTriggerId: defaultTriggerIdProp = null\n } = props;\n const isDrawer = mode === 'drawer';\n const isAlertDialog = mode === 'alert-dialog';\n const modal = isAlertDialog ? true : modalProp;\n const disablePointerDismissal = isAlertDialog || disablePointerDismissalProp;\n const role = isAlertDialog ? 'alertdialog' : 'dialog';\n const parentStore = useDialogRootContext(true);\n const nested = parentStore != null;\n const rootState = {\n modal,\n disablePointerDismissal,\n nested,\n role\n };\n\n // The store is owned by this Root instance and created exactly once. It is not tied to the handle:\n // the handle attaches to it, so swapping the handle re-attaches rather than recreating state.\n // Default values are only initial values; controlled values and root state are synced after creation.\n // Dialogs pass the popup element to Floating UI as the floating element (`treatPopupAsFloatingElement`).\n const store = usePopupRootStore((floatingId, floatingNested) => new DialogStore({\n open: defaultOpen,\n openProp,\n activeTriggerId: defaultTriggerIdProp,\n triggerIdProp,\n ...rootState\n }, floatingId, floatingNested), true);\n store.useControlledProp('openProp', openProp);\n store.useControlledProp('triggerIdProp', triggerIdProp);\n store.useSyncedValues(rootState);\n store.useContextCallback('onOpenChange', onOpenChange);\n store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);\n const open = store.useState('open');\n const mounted = store.useState('mounted');\n const payload = store.useState('payload');\n usePopupRootSync(store, open);\n useImplicitActiveTrigger(store);\n const {\n forceUnmount\n } = useOpenStateTransitions(open, store);\n React.useImperativeHandle(actionsRef, () => ({\n unmount: forceUnmount,\n close: () => store.setOpen(false, createChangeEventDetails(REASONS.imperativeAction))\n }), [forceUnmount, store]);\n const shouldRenderInteractions = open || mounted;\n return /*#__PURE__*/_jsxs(DialogRootContext.Provider, {\n value: store,\n children: [handle && /*#__PURE__*/_jsx(PopupHandleAttachment, {\n handle: handle,\n store: store\n }), shouldRenderInteractions && /*#__PURE__*/_jsx(DialogInteractions, {\n store: store,\n parentContext: parentStore?.context,\n isDrawer: isDrawer\n }), typeof children === 'function' ? children({\n payload\n }) : children]\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useScrollLock } from '@base-ui/utils/useScrollLock';\nimport { useDismiss } from \"../../floating-ui-react/index.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { usePopupInteractionProps } from \"../../utils/popups/index.mjs\";\nexport function DialogInteractions({\n store,\n parentContext,\n isDrawer\n}) {\n const open = store.useState('open');\n const disablePointerDismissal = store.useState('disablePointerDismissal');\n const modal = store.useState('modal');\n const popupElement = store.useState('popupElement');\n const floatingRootContext = store.useState('floatingRootContext');\n const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = React.useState(0);\n const [ownNestedOpenDrawers, setOwnNestedOpenDrawers] = React.useState(0);\n const isTopmost = ownNestedOpenDialogs === 0;\n const dismiss = useDismiss(floatingRootContext, {\n outsidePressEvent() {\n if (store.context.internalBackdropRef.current || store.context.backdropRef.current) {\n return 'intentional';\n }\n // Ensure `aria-hidden` on outside elements is removed immediately\n // on outside press when trapping focus.\n return {\n mouse: modal === 'trap-focus' ? 'sloppy' : 'intentional',\n touch: 'sloppy'\n };\n },\n outsidePress(event) {\n if (!store.context.outsidePressEnabledRef.current) {\n return false;\n }\n\n // For mouse events, only accept left button (button 0)\n // For touch events, a single touch is equivalent to left button\n if ('button' in event && event.button !== 0) {\n return false;\n }\n if ('touches' in event) {\n // Outside press can be handled on `touchend`, where the lifted point is\n // reported in `changedTouches` and `touches` contains any remaining\n // active points. Treat it as a single-finger tap only when exactly one\n // touch ended and no other fingers are still down.\n if (event.type === 'touchend') {\n if (event.changedTouches.length !== 1 || event.touches.length !== 0) {\n return false;\n }\n } else if (event.touches.length !== 1) {\n return false;\n }\n }\n const target = getTarget(event);\n if (isTopmost && !disablePointerDismissal) {\n // Only close if the click occurred on the dialog's owning backdrop.\n // This supports multiple modal dialogs that aren't nested in the React tree:\n // https://github.com/mui/base-ui/issues/1320\n if (modal) {\n const internalBackdrop = store.context.internalBackdropRef.current;\n const backdrop = store.context.backdropRef.current;\n return internalBackdrop || backdrop ? internalBackdrop === target || backdrop === target || contains(target, popupElement) && !target?.hasAttribute('data-base-ui-portal') : true;\n }\n return true;\n }\n return false;\n },\n escapeKey: isTopmost\n });\n useScrollLock(open && modal === true, popupElement);\n\n // Listen for nested open/close events on this store to maintain the counts.\n // A close notification is an open notification with zeroed counts.\n store.useContextCallback('onNestedDialogOpen', (dialogCount, drawerCount) => {\n setOwnNestedOpenDialogs(dialogCount);\n setOwnNestedOpenDrawers(drawerCount);\n });\n\n // Notify parent of our open/close state using parent callbacks, if any\n useIsoLayoutEffect(() => {\n if (parentContext?.onNestedDialogOpen) {\n if (open) {\n parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0));\n } else {\n parentContext.onNestedDialogOpen(0, 0);\n }\n }\n return () => {\n if (parentContext?.onNestedDialogOpen && open) {\n parentContext.onNestedDialogOpen(0, 0);\n }\n };\n }, [isDrawer, open, ownNestedOpenDialogs, ownNestedOpenDrawers, parentContext]);\n usePopupInteractionProps(store, {\n // `enabled` is not passed to `useDismiss`, so its props are always defined,\n // and `trigger` is the same object as `reference`.\n activeTriggerProps: dismiss.reference,\n inactiveTriggerProps: dismiss.trigger,\n // DialogPopup and DrawerPopup spread `FOCUSABLE_POPUP_PROPS` directly, so\n // this only needs to carry the dismiss handlers.\n popupProps: dismiss.floating,\n nestedOpenDialogCount: ownNestedOpenDialogs,\n nestedOpenDrawerCount: ownNestedOpenDrawers\n });\n return null;\n}","import * as React from 'react';\nimport { ReactStore } from '@base-ui/utils/store';\nimport { NullStore } from \"../../utils/NullStore.mjs\";\nimport { createInitialPopupStoreState, popupStoreSelectors, PopupTriggerMap, createPopupOpenState } from \"../../utils/popups/index.mjs\";\nconst selectors = {\n ...popupStoreSelectors,\n modal: state => state.modal,\n nested: state => state.nested,\n nestedOpenDialogCount: state => state.nestedOpenDialogCount,\n nestedOpenDrawerCount: state => state.nestedOpenDrawerCount,\n disablePointerDismissal: state => state.disablePointerDismissal,\n openMethod: state => state.openMethod,\n descriptionElementId: state => state.descriptionElementId,\n titleElementId: state => state.titleElementId,\n viewportElement: state => state.viewportElement,\n role: state => state.role\n};\n\n/**\n * The subset of `DialogStore` that detached handle-backed triggers rely on. Both the real\n * `DialogStore` and the inert fallback store satisfy it, so a trigger can read from whichever\n * store the handle currently exposes.\n */\n\nexport class DialogStore extends ReactStore {\n constructor(initialState, floatingId, nested) {\n const triggerElements = new PopupTriggerMap();\n const state = createInitialState(initialState, triggerElements, floatingId, nested);\n super(state, createInitialContext(triggerElements), selectors);\n }\n setOpen = (nextOpen, eventDetails) => {\n eventDetails.preventUnmountOnClose = () => {\n this.set('preventUnmountingOnClose', true);\n };\n if (!nextOpen && eventDetails.trigger == null && this.state.activeTriggerId != null) {\n // When closing the dialog, pass the old trigger to the onOpenChange event\n // so it's not reset too early (potentially causing focus issues in controlled scenarios).\n eventDetails.trigger = this.state.activeTriggerElement ?? undefined;\n }\n this.context.onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);\n this.update(createPopupOpenState(this.state, nextOpen, eventDetails.trigger));\n };\n}\n\n/**\n * Creates the inert fallback store used by detached handle-backed triggers while no\n * `Dialog.Root` is attached. It preserves a dialog-specific trigger registry in context so\n * detached triggers can register before migrating to the live root store.\n */\nexport function createNullDialogStore() {\n const triggerElements = new PopupTriggerMap();\n return new NullStore(Object.freeze(createInitialState(undefined, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);\n}\nfunction createInitialState(initialState, triggerElements, floatingId, nested = false) {\n const state = {\n ...createInitialPopupStoreState(triggerElements, floatingId, nested),\n modal: true,\n disablePointerDismissal: false,\n viewportElement: null,\n descriptionElementId: undefined,\n titleElementId: undefined,\n openMethod: null,\n nested: false,\n nestedOpenDialogCount: 0,\n nestedOpenDrawerCount: 0,\n role: 'dialog',\n ...initialState\n };\n return state;\n}\nfunction createInitialContext(triggerElements) {\n return {\n popupRef: /*#__PURE__*/React.createRef(),\n backdropRef: /*#__PURE__*/React.createRef(),\n internalBackdropRef: /*#__PURE__*/React.createRef(),\n outsidePressEnabledRef: {\n current: true\n },\n triggerElements,\n onOpenChange: undefined,\n onOpenChangeComplete: undefined\n };\n}","import { ReactStore } from '@base-ui/utils/store';\n/**\n * A `ReactStore` whose state never changes.\n *\n * Useful for fallback stores that need to support normal store reads while detached from the\n * component that owns real state. Context values may still contain mutable refs or maps.\n */\nexport class NullStore extends ReactStore {\n // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding\n // `setState` alone would neutralize them today. They are overridden explicitly so the store stays\n // inert even if a future base-class change stops routing a mutator through `setState`.\n setState(_newState) {}\n update(_changes) {}\n set(_key, _value) {}\n notifyAll() {}\n}","'use client';\n\nimport { fastComponent } from '@base-ui/utils/fastHooks';\nimport { useRenderDialogRoot } from \"./useRenderDialogRoot.mjs\";\n\n/**\n * Groups all parts of the dialog.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogRoot = fastComponent(function DialogRoot(props) {\n return useRenderDialogRoot('dialog', props);\n});\nif (process.env.NODE_ENV !== \"production\") DialogRoot.displayName = \"DialogRoot\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useDialogPortalContext } from \"../portal/DialogPortalContext.mjs\";\nimport { dialogStateAttributesMapping } from \"../utils/stateAttributesMapping.mjs\";\n\n/**\n * A positioning container for the dialog popup that can be made scrollable.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogViewport = /*#__PURE__*/React.forwardRef(function DialogViewport(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n ...elementProps\n } = componentProps;\n const keepMounted = useDialogPortalContext();\n const store = useDialogRootContext();\n const open = store.useState('open');\n const nested = store.useState('nested');\n const transitionStatus = store.useState('transitionStatus');\n const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');\n const mounted = store.useState('mounted');\n const setViewportElement = store.useStateSetter('viewportElement');\n const nestedDialogOpen = nestedOpenDialogCount > 0;\n const state = {\n open,\n nested,\n transitionStatus,\n nestedDialogOpen\n };\n const shouldRender = keepMounted || mounted;\n return useRenderElement('div', componentProps, {\n enabled: shouldRender,\n state,\n ref: [forwardedRef, setViewportElement],\n stateAttributesMapping: dialogStateAttributesMapping,\n props: [{\n role: 'presentation',\n hidden: !mounted,\n style: {\n pointerEvents: !open ? 'none' : undefined\n },\n children\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogViewport.displayName = \"DialogViewport\";","'use client';\n\nimport * as React from 'react';\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\n/**\n * A heading that labels the dialog.\n * Renders an `<h2>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogTitle = /*#__PURE__*/React.forwardRef(function DialogTitle(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const store = useDialogRootContext();\n const id = useBaseUiId(idProp);\n store.useSyncedValueWithCleanup('titleElementId', id);\n return useRenderElement('h2', componentProps, {\n ref: forwardedRef,\n props: [{\n id\n }, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogTitle.displayName = \"DialogTitle\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nimport { fastComponentRef } from '@base-ui/utils/fastHooks';\nimport { useDialogRootContext } from \"../root/DialogRootContext.mjs\";\nimport { useButton } from \"../../internals/use-button/useButton.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { triggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { CLICK_TRIGGER_IDENTIFIER } from \"../../internals/constants.mjs\";\nimport { usePopupHandleStore, useTriggerDataForwarding } from \"../../utils/popups/index.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useClick } from \"../../floating-ui-react/index.mjs\";\nimport { useOpenMethodTriggerProps } from \"../../utils/useOpenInteractionType.mjs\";\n\n/**\n * A button that opens the dialog.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Dialog](https://base-ui.com/react/components/dialog)\n */\nexport const DialogTrigger = fastComponentRef(function DialogTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n disabled = false,\n nativeButton = true,\n id: idProp,\n payload,\n handle,\n ...elementProps\n } = componentProps;\n const dialogRootStore = useDialogRootContext(true);\n const handleStore = usePopupHandleStore(handle);\n const store = handleStore ?? dialogRootStore;\n if (!store) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.' : _formatErrorMessage(79));\n }\n const thisTriggerId = useBaseUiId(idProp);\n const floatingContext = store.useState('floatingRootContext');\n const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);\n const popupId = store.useState('triggerPopupId', thisTriggerId);\n const triggerElementRef = React.useRef(null);\n const {\n registerTrigger,\n isMountedByThisTrigger\n } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {\n payload\n });\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const click = useClick(floatingContext);\n const interactionTypeProps = useOpenMethodTriggerProps(() => store.select('open'), interactionType => {\n store.set('openMethod', interactionType);\n });\n const state = {\n disabled,\n open: isOpenedByThisTrigger\n };\n const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);\n return useRenderElement('button', componentProps, {\n state,\n ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef],\n props: [click.reference, rootTriggerProps, interactionTypeProps, {\n [CLICK_TRIGGER_IDENTIFIER]: '',\n id: thisTriggerId,\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpenedByThisTrigger,\n 'aria-controls': popupId\n }, elementProps, getButtonProps],\n stateAttributesMapping: triggerOpenStateMapping\n });\n});\nif (process.env.NODE_ENV !== \"production\") DialogTrigger.displayName = \"DialogTrigger\";","import { createNullDialogStore } from \"./DialogStore.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { BasePopupHandle } from \"../../utils/popups/popupHandle.mjs\";\n\n/**\n * Controls a Dialog imperatively and associates detached `Dialog.Trigger` components with a\n * `Dialog.Root`. Create one with `Dialog.createHandle()` and pass it to the `handle` prop of the\n * root and of any triggers rendered outside of it.\n *\n * The imperative methods take effect only while a root using this handle is mounted; calls made\n * before a root attaches (or after it unmounts) are ignored.\n */\nexport class DialogHandle extends BasePopupHandle {\n constructor() {\n super(createNullDialogStore(), 'Dialog', false);\n }\n\n /**\n * Opens the dialog, optionally associating it with a trigger.\n *\n * This method should only be called in an event handler or an effect (not during rendering).\n *\n * @param triggerId ID of the trigger to associate with the dialog. The trigger must be a matching\n * `Dialog.Trigger` with this handle passed as a prop. Pass `null` to open without associating any trigger.\n */\n open(triggerId) {\n this.openByTrigger(triggerId);\n }\n\n /**\n * Opens the dialog with the given payload, without associating it with any trigger.\n *\n * This method should only be called in an event handler or an effect (not during rendering).\n *\n * @param payload Payload to set when opening the dialog. It is exposed to the root's render-prop children.\n */\n openWithPayload(payload) {\n const attachedStore = this.attachedStore;\n if (attachedStore === null) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Base UI: DialogHandle.openWithPayload() was called while no root using this handle is mounted. ' + 'The call and its payload were ignored; mount a root with this handle before opening it imperatively.');\n }\n return;\n }\n attachedStore.set('payload', payload);\n attachedStore.setOpen(true, createChangeEventDetails(REASONS.imperativeAction));\n }\n\n /**\n * Closes the dialog.\n *\n * This method should only be called in an event handler or an effect (not during rendering).\n */\n close() {\n this.closePopup();\n }\n\n /**\n * Whether the dialog is currently open. Returns `false` while no root is attached to the handle.\n */\n get isOpen() {\n return this.attachedStore?.select('open') ?? false;\n }\n}\n\n/**\n * Creates a new handle to connect a Dialog.Root with detached Dialog.Trigger components.\n */\nexport function createDialogHandle() {\n return new DialogHandle();\n}","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/warning.\nexport function Warning(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M8 1C6.61553 1 5.26216 1.41054 4.11101 2.17971C2.95987 2.94888 2.06266 4.04213 1.53285 5.32122C1.00303 6.6003 0.86441 8.00776 1.13451 9.36563C1.4046 10.7235 2.07129 11.9708 3.05026 12.9497C4.02922 13.9287 5.2765 14.5954 6.63437 14.8655C7.99224 15.1356 9.3997 14.997 10.6788 14.4672C11.9579 13.9373 13.0511 13.0401 13.8203 11.889C14.5895 10.7378 15 9.38447 15 8C15 6.14348 14.2625 4.36301 12.9497 3.05025C11.637 1.7375 9.85652 1 8 1ZM8 14C6.81332 14 5.65328 13.6481 4.66658 12.9888C3.67989 12.3295 2.91085 11.3925 2.45673 10.2961C2.0026 9.19974 1.88378 7.99334 2.11529 6.82946C2.3468 5.66557 2.91825 4.59647 3.75736 3.75736C4.59648 2.91824 5.66558 2.3468 6.82946 2.11529C7.99335 1.88378 9.19975 2.0026 10.2961 2.45672C11.3925 2.91085 12.3295 3.67988 12.9888 4.66658C13.6481 5.65327 14 6.81331 14 8C14 9.5913 13.3679 11.1174 12.2426 12.2426C11.1174 13.3679 9.5913 14 8 14ZM8.5 4H7.5V9.5H8.5V4ZM7.58332 11.1264C7.70666 11.044 7.85166 11 8 11C8.19891 11 8.38968 11.079 8.53033 11.2197C8.67098 11.3603 8.75 11.5511 8.75 11.75C8.75 11.8983 8.70601 12.0433 8.6236 12.1667C8.54119 12.29 8.42406 12.3861 8.28701 12.4429C8.14997 12.4997 7.99917 12.5145 7.85368 12.4856C7.7082 12.4566 7.57456 12.3852 7.46967 12.2803C7.36478 12.1754 7.29335 12.0418 7.26441 11.8963C7.23547 11.7508 7.25033 11.6 7.30709 11.463C7.36386 11.3259 7.45999 11.2088 7.58332 11.1264Z\"\n />\n </IconBase>\n );\n}\n","export { NavigationMenuRoot as Root } from \"./root/NavigationMenuRoot.mjs\";\nexport { NavigationMenuList as List } from \"./list/NavigationMenuList.mjs\";\nexport { NavigationMenuItem as Item } from \"./item/NavigationMenuItem.mjs\";\nexport { NavigationMenuContent as Content } from \"./content/NavigationMenuContent.mjs\";\nexport { NavigationMenuTrigger as Trigger } from \"./trigger/NavigationMenuTrigger.mjs\";\nexport { NavigationMenuPortal as Portal } from \"./portal/NavigationMenuPortal.mjs\";\nexport { NavigationMenuPositioner as Positioner } from \"./positioner/NavigationMenuPositioner.mjs\";\nexport { NavigationMenuViewport as Viewport } from \"./viewport/NavigationMenuViewport.mjs\";\nexport { NavigationMenuBackdrop as Backdrop } from \"./backdrop/NavigationMenuBackdrop.mjs\";\nexport { NavigationMenuPopup as Popup } from \"./popup/NavigationMenuPopup.mjs\";\nexport { NavigationMenuArrow as Arrow } from \"./arrow/NavigationMenuArrow.mjs\";\nexport { NavigationMenuLink as Link } from \"./link/NavigationMenuLink.mjs\";\nexport { NavigationMenuIcon as Icon } from \"./icon/NavigationMenuIcon.mjs\";","'use client';\n\nimport * as React from 'react';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { FloatingNode, FloatingTree, useFloatingNodeId, useFloatingParentNodeId } from \"../../floating-ui-react/index.mjs\";\nimport { activeElement, contains } from \"../../floating-ui-react/utils.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { NavigationMenuRootContext, NavigationMenuTreeContext, useNavigationMenuRootContext } from \"./NavigationMenuRootContext.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport * as NavigationMenuPositionerCssVars from \"../positioner/NavigationMenuPositionerCssVars.mjs\";\nimport { setSharedFixedSize } from \"../utils/setSharedFixedSize.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst blockedReturnFocusReasons = new Set([REASONS.triggerHover, REASONS.outsidePress, REASONS.focusOut]);\nfunction getPositionerFixedSize(positionerElement) {\n // Read the last fixed positioner size rather than measuring the popup now:\n // during a controlled close, the popup can already be in its exit render and\n // report 0 before the closing transition gets a stable size to animate from.\n const width = parseFloat(positionerElement.style.getPropertyValue(NavigationMenuPositionerCssVars.positionerWidth)) || 0;\n const height = parseFloat(positionerElement.style.getPropertyValue(NavigationMenuPositionerCssVars.positionerHeight)) || 0;\n if (width <= 0 || height <= 0) {\n return null;\n }\n return {\n width,\n height\n };\n}\n\n/**\n * Groups all parts of the navigation menu.\n * Renders a `<nav>` element at the root, or `<div>` element when nested.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuRoot = /*#__PURE__*/React.forwardRef(function NavigationMenuRoot(componentProps, forwardedRef) {\n const {\n defaultValue = null,\n value: valueParam,\n onValueChange,\n actionsRef,\n delay = 50,\n closeDelay = 50,\n orientation = 'horizontal',\n onOpenChangeComplete\n } = componentProps;\n const nested = useFloatingParentNodeId() != null;\n const parentRootContext = useNavigationMenuRootContext(true);\n const [value, setValueUnwrapped] = useControlled({\n controlled: valueParam,\n default: defaultValue,\n name: 'NavigationMenu',\n state: 'value'\n });\n\n // Derive open state from value being non-nullish\n const open = value != null;\n const closeReasonRef = React.useRef(undefined);\n const rootRef = React.useRef(null);\n const [positionerElement, setPositionerElement] = React.useState(null);\n const [popupElement, setPopupElement] = React.useState(null);\n const [viewportElement, setViewportElement] = React.useState(null);\n const [viewportTargetElement, setViewportTargetElement] = React.useState(null);\n const [activationDirection, setActivationDirection] = React.useState(null);\n const [floatingRootContext, setFloatingRootContext] = React.useState(undefined);\n const [viewportInert, setViewportInert] = React.useState(false);\n const prevTriggerElementRef = React.useRef(null);\n const currentContentRef = React.useRef(null);\n const beforeInsideRef = React.useRef(null);\n const afterInsideRef = React.useRef(null);\n const beforeOutsideRef = React.useRef(null);\n const afterOutsideRef = React.useRef(null);\n // Shared across triggers so a newly active trigger can cancel a stale\n // popup auto-size reset scheduled by the previously active trigger.\n const popupAutoSizeResetRef = React.useRef({\n abortController: null,\n owner: null\n });\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n useIsoLayoutEffect(() => {\n if (open) {\n return;\n }\n if (!positionerElement || !popupElement) {\n return;\n }\n const closeTransitionSize = getPositionerFixedSize(positionerElement);\n if (!closeTransitionSize) {\n return;\n }\n\n // No cleanup is needed for this fixed size: if the popup unmounts, the inline\n // styles are removed with it. If it stays mounted, reopening runs the trigger's\n // sizing logic which clears these vars via `clearFixedSizes`/`setAutoSizes`.\n setSharedFixedSize(popupElement, positionerElement, closeTransitionSize.width, closeTransitionSize.height);\n }, [open, popupElement, positionerElement]);\n React.useEffect(() => {\n setViewportInert(false);\n }, [value]);\n const setValue = useStableCallback((nextValue, eventDetails) => {\n if (nextValue == null) {\n closeReasonRef.current = eventDetails.reason;\n }\n if (nextValue !== value) {\n onValueChange?.(nextValue, eventDetails);\n }\n if (eventDetails.isCanceled) {\n return;\n }\n if (nextValue == null) {\n setActivationDirection(null);\n setFloatingRootContext(undefined);\n }\n setValueUnwrapped(nextValue);\n if (nested && nextValue == null && eventDetails.reason === REASONS.linkPress && parentRootContext) {\n parentRootContext.setValue(null, eventDetails);\n }\n });\n const handleUnmount = useStableCallback(() => {\n const doc = ownerDocument(rootRef.current);\n const activeEl = activeElement(doc);\n const isReturnFocusBlocked = closeReasonRef.current ? blockedReturnFocusReasons.has(closeReasonRef.current) : false;\n if (!isReturnFocusBlocked && isHTMLElement(prevTriggerElementRef.current) && (activeEl === ownerDocument(popupElement).body || contains(popupElement, activeEl)) && popupElement) {\n prevTriggerElementRef.current.focus({\n preventScroll: true\n });\n prevTriggerElementRef.current = undefined;\n }\n setMounted(false);\n onOpenChangeComplete?.(false);\n setActivationDirection(null);\n setFloatingRootContext(undefined);\n currentContentRef.current = null;\n closeReasonRef.current = undefined;\n });\n\n // Providing `actionsRef` opts into manual unmounting, so close completion hooks leave it mounted.\n React.useImperativeHandle(actionsRef, () => ({\n unmount: handleUnmount\n }), [handleUnmount]);\n useOpenChangeComplete({\n enabled: !actionsRef,\n open,\n ref: {\n current: popupElement\n },\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n useOpenChangeComplete({\n enabled: !actionsRef,\n open,\n ref: {\n current: viewportTargetElement\n },\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n const contextActivationDirection = open ? activationDirection : null;\n const contextValue = React.useMemo(() => ({\n open,\n value,\n setValue,\n mounted,\n transitionStatus,\n positionerElement,\n setPositionerElement,\n popupElement,\n setPopupElement,\n viewportElement,\n setViewportElement,\n viewportTargetElement,\n setViewportTargetElement,\n activationDirection: contextActivationDirection,\n setActivationDirection,\n floatingRootContext,\n setFloatingRootContext,\n currentContentRef,\n nested,\n rootRef,\n beforeInsideRef,\n afterInsideRef,\n beforeOutsideRef,\n afterOutsideRef,\n prevTriggerElementRef,\n popupAutoSizeResetRef,\n delay,\n closeDelay,\n orientation,\n viewportInert,\n setViewportInert\n }), [open, value, setValue, mounted, transitionStatus, positionerElement, popupElement, viewportElement, viewportTargetElement, contextActivationDirection, floatingRootContext, nested, delay, closeDelay, orientation, viewportInert]);\n const jsx = /*#__PURE__*/_jsx(NavigationMenuRootContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(TreeContext, {\n componentProps: componentProps,\n forwardedRef: forwardedRef,\n children: componentProps.children\n })\n });\n if (!nested) {\n // FloatingTree provides context to nested menus\n return /*#__PURE__*/_jsx(FloatingTree, {\n children: jsx\n });\n }\n return jsx;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuRoot.displayName = \"NavigationMenuRoot\";\nfunction TreeContext(props) {\n const {\n className,\n render,\n defaultValue,\n value: valueParam,\n onValueChange,\n actionsRef,\n delay,\n closeDelay,\n orientation,\n onOpenChangeComplete,\n style,\n ...elementProps\n } = props.componentProps;\n const nodeId = useFloatingNodeId();\n const {\n rootRef,\n nested,\n open\n } = useNavigationMenuRootContext();\n const state = {\n open,\n nested\n };\n const element = useRenderElement(nested ? 'div' : 'nav', props.componentProps, {\n state,\n ref: [props.forwardedRef, rootRef],\n props: elementProps\n });\n return /*#__PURE__*/_jsx(NavigationMenuTreeContext.Provider, {\n value: nodeId,\n children: /*#__PURE__*/_jsx(FloatingNode, {\n id: nodeId,\n children: element\n })\n });\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const NavigationMenuRootContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuRootContext.displayName = \"NavigationMenuRootContext\";\nif (process.env.NODE_ENV !== 'production') {\n NavigationMenuRootContext.displayName = 'NavigationMenuRootContext';\n}\nfunction useNavigationMenuRootContext(optional) {\n const context = React.useContext(NavigationMenuRootContext);\n if (context === undefined && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: NavigationMenuRootContext is missing. Navigation Menu parts must be placed within <NavigationMenu.Root>.' : _formatErrorMessage(41));\n }\n return context;\n}\nexport const NavigationMenuTreeContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuTreeContext.displayName = \"NavigationMenuTreeContext\";\nfunction useNavigationMenuTreeContext() {\n return React.useContext(NavigationMenuTreeContext);\n}\nexport { useNavigationMenuRootContext, useNavigationMenuTreeContext };","/**\n * The available width between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableWidth = '--available-width';\n/**\n * The available height between the trigger and the edge of the viewport.\n * @type {number}\n */\nexport const availableHeight = '--available-height';\n/**\n * The anchor's width.\n * @type {number}\n */\nexport const anchorWidth = '--anchor-width';\n/**\n * The anchor's height.\n * @type {number}\n */\nexport const anchorHeight = '--anchor-height';\n/**\n * The coordinates that this element is anchored to. Used for animations and transitions.\n * @type {string}\n */\nexport const transformOrigin = '--transform-origin';\n/**\n * The fixed width of the positioner element.\n * @type {number}\n */\nexport const positionerWidth = '--positioner-width';\n/**\n * The fixed height of the positioner element.\n * @type {number}\n */\nexport const positionerHeight = '--positioner-height';","/**\n * The fixed width of the popup element.\n * @type {number}\n */\nexport const popupWidth = '--popup-width';\n/**\n * The fixed height of the popup element.\n * @type {number}\n */\nexport const popupHeight = '--popup-height';","import * as NavigationMenuPopupCssVars from \"../popup/NavigationMenuPopupCssVars.mjs\";\nimport * as NavigationMenuPositionerCssVars from \"../positioner/NavigationMenuPositionerCssVars.mjs\";\nexport function setSharedFixedSize(popupElement, positionerElement, width, height) {\n popupElement.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${width}px`);\n popupElement.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${height}px`);\n positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);\n positionerElement.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);\n}","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useDismiss, useHoverFloatingInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { CompositeRoot } from \"../../internals/composite/root/CompositeRoot.mjs\";\nimport { useNavigationMenuRootContext, useNavigationMenuTreeContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { NAVIGATION_MENU_TRIGGER_IDENTIFIER } from \"../utils/constants.mjs\";\nimport { NavigationMenuDismissContext } from \"./NavigationMenuDismissContext.mjs\";\nimport { getEmptyRootContext } from \"../../floating-ui-react/utils/getEmptyRootContext.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\n\n/**\n * Contains a list of navigation menu items.\n * Renders a `<ul>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const NavigationMenuList = /*#__PURE__*/React.forwardRef(function NavigationMenuList(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const nodeId = useNavigationMenuTreeContext();\n const {\n orientation,\n open,\n floatingRootContext,\n positionerElement,\n value,\n closeDelay,\n viewportElement,\n nested\n } = useNavigationMenuRootContext();\n const fallbackContext = React.useMemo(() => getEmptyRootContext(), []);\n const context = floatingRootContext || fallbackContext;\n const interactionsEnabled = positionerElement != null || value == null;\n const hoverInteractionsEnabled = positionerElement != null || viewportElement != null || value == null;\n useHoverFloatingInteraction(context, {\n enabled: Boolean(floatingRootContext) && hoverInteractionsEnabled,\n closeDelay,\n nodeId\n });\n const dismiss = useDismiss(context, {\n enabled: interactionsEnabled,\n outsidePressEvent: 'intentional',\n outsidePress(event) {\n const target = getTarget(event);\n const closestNavigationMenuTrigger = target?.closest(`[${NAVIGATION_MENU_TRIGGER_IDENTIFIER}]`);\n return closestNavigationMenuTrigger === null;\n }\n });\n const dismissProps = floatingRootContext ? dismiss : undefined;\n const state = {\n open\n };\n\n // `stopEventPropagation` won't stop the propagation if the end of the list is reached,\n // but we want to block it in this case.\n // When nested, skip this handler so arrow keys can reach the parent CompositeRoot.\n const defaultProps = nested ? EMPTY_OBJECT : {\n onKeyDown(event) {\n const shouldStop = orientation === 'horizontal' && (event.key === 'ArrowLeft' || event.key === 'ArrowRight') || orientation === 'vertical' && (event.key === 'ArrowUp' || event.key === 'ArrowDown');\n if (shouldStop) {\n event.stopPropagation();\n }\n }\n };\n const props = [dismissProps?.floating || EMPTY_OBJECT, defaultProps, elementProps];\n\n // When nested, skip the CompositeRoot wrapper so that triggers can participate\n // in the parent Content's composite navigation context. The key propagation\n // guard is already omitted through `defaultProps` above.\n const element = useRenderElement('ul', componentProps, {\n state,\n ref: forwardedRef,\n props,\n enabled: nested\n });\n if (nested) {\n return /*#__PURE__*/_jsx(NavigationMenuDismissContext.Provider, {\n value: dismissProps,\n children: element\n });\n }\n return /*#__PURE__*/_jsx(NavigationMenuDismissContext.Provider, {\n value: dismissProps,\n children: /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: props,\n loopFocus: false,\n orientation: orientation,\n tag: \"ul\"\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuList.displayName = \"NavigationMenuList\";","'use client';\n\nimport * as React from 'react';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { CompositeList } from \"../list/CompositeList.mjs\";\nimport { useCompositeRoot } from \"./useCompositeRoot.mjs\";\nimport { CompositeRootContext } from \"./CompositeRootContext.mjs\";\nimport { useRenderElement } from \"../../useRenderElement.mjs\";\nimport { useDirection } from \"../../direction-context/DirectionContext.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function CompositeRoot(componentProps) {\n const {\n render,\n className,\n style,\n refs = EMPTY_ARRAY,\n props = EMPTY_ARRAY,\n state = EMPTY_OBJECT,\n stateAttributesMapping,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n orientation,\n grid,\n loopFocus,\n onLoop,\n enableHomeAndEndKeys,\n onMapChange: onMapChangeProp,\n stopEventPropagation = true,\n rootRef,\n disabledIndices,\n modifierKeys,\n highlightItemOnHover = false,\n tag = 'div',\n ...elementProps\n } = componentProps;\n const direction = useDirection();\n const {\n props: defaultProps,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange: onMapChangeUnwrapped,\n relayKeyboardEvent\n } = useCompositeRoot({\n grid,\n loopFocus,\n onLoop,\n orientation,\n highlightedIndex: highlightedIndexProp,\n onHighlightedIndexChange: onHighlightedIndexChangeProp,\n rootRef,\n stopEventPropagation,\n enableHomeAndEndKeys,\n direction,\n disabledIndices,\n modifierKeys\n });\n const element = useRenderElement(tag, componentProps, {\n state,\n ref: refs,\n props: [defaultProps, ...props, elementProps],\n stateAttributesMapping\n });\n const contextValue = React.useMemo(() => ({\n highlightedIndex,\n onHighlightedIndexChange,\n highlightItemOnHover,\n relayKeyboardEvent\n }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);\n return /*#__PURE__*/_jsx(CompositeRootContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(CompositeList, {\n elementsRef: elementsRef,\n onMapChange: newMap => {\n onMapChangeProp?.(newMap);\n onMapChangeUnwrapped(newMap);\n },\n children: element\n })\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { isElementDisabled } from '@base-ui/utils/isElementDisabled';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { COMPOSITE_KEYS, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, END, HOME, MODIFIER_KEYS, findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isListIndexDisabled, isIndexOutOfListBounds, isNativeInput, scrollIntoViewIfNeeded } from \"../composite.mjs\";\nimport { ACTIVE_COMPOSITE_ITEM } from \"../constants.mjs\";\nimport { getTarget } from \"../../../floating-ui-react/utils.mjs\";\nexport function useCompositeRoot(params) {\n const {\n loopFocus = true,\n orientation = 'both',\n grid,\n onLoop,\n direction,\n highlightedIndex: externalHighlightedIndex,\n onHighlightedIndexChange: externalSetHighlightedIndex,\n rootRef: externalRef,\n enableHomeAndEndKeys = false,\n stopEventPropagation,\n disabledIndices,\n modifierKeys = EMPTY_ARRAY\n } = params;\n const [internalHighlightedIndex, internalSetHighlightedIndex] = React.useState(0);\n const isGrid = grid != null;\n const rootRef = React.useRef(null);\n const mergedRef = useMergedRefs(rootRef, externalRef);\n const elementsRef = React.useRef([]);\n const hasSetDefaultIndexRef = React.useRef(false);\n const highlightedElementRef = React.useRef(null);\n const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;\n const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {\n highlightedElementRef.current = elementsRef.current[index] ?? null;\n (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);\n if (shouldScrollIntoView) {\n const newActiveItem = elementsRef.current[index];\n scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);\n }\n });\n const onMapChange = useStableCallback(map => {\n if (map.size === 0) {\n return;\n }\n if (hasSetDefaultIndexRef.current) {\n const elements = elementsRef.current;\n // Items added or removed around the highlighted one shift its index, so the tab stop would\n // otherwise move to a different item and navigation would resume from the wrong position.\n const nextIndex = elements.indexOf(highlightedElementRef.current);\n if (nextIndex === -1) {\n // A replacement at the same index can keep the tab stop. Otherwise move it to an\n // eligible item so a missing, hidden, or disabled replacement does not take the\n // composite out of the tab order.\n const replacement = elements[highlightedIndex];\n if (!replacement || isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {\n onHighlightedIndexChange(getFallbackIndex(elements, disabledIndices));\n } else {\n highlightedElementRef.current = replacement;\n }\n } else if (nextIndex !== highlightedIndex) {\n onHighlightedIndexChange(nextIndex);\n }\n return;\n }\n hasSetDefaultIndexRef.current = true;\n const sortedElements = Array.from(map.keys());\n const activeItem = sortedElements.find(compositeElement => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;\n // Set the default highlighted index of an arbitrary composite item. The map value carries\n // the item's own index, which is not its position among the keys once a list mixes explicit\n // and automatic indexes and leaves gaps.\n const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;\n if (activeIndex !== -1) {\n onHighlightedIndexChange(activeIndex);\n } else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {\n // The default highlighted item is disabled, so it should not hold the single\n // roving tab stop: a natively disabled element is removed from the tab order,\n // and an aria-disabled one should not be the entry point. Move the tab stop\n // to the first enabled item. If every item is disabled, keep the current\n // highlighted index.\n const firstEnabledIndex = findNonDisabledListIndex(sortedElements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);\n });\n useIsoLayoutEffect(() => {\n // `disabledIndices` can resolve a render after the initial map population\n // (e.g. Toolbar derives it from item metadata through a state update), so the\n // default tab stop at index 0 may now point at a disabled item, leaving the\n // composite without a reachable tab stop. Re-validate and move it to the first\n // enabled item. Gated on `disabledIndices` being provided so composites that\n // rely on the DOM disabled fallback keep their existing behavior.\n if (disabledIndices == null || externalHighlightedIndex != null || !hasSetDefaultIndexRef.current) {\n return;\n }\n const elements = elementsRef.current;\n if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {\n const firstEnabledIndex = findNonDisabledListIndex(elements, {\n disabledIndices\n });\n if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) {\n onHighlightedIndexChange(firstEnabledIndex);\n }\n }\n }, [disabledIndices, externalHighlightedIndex, highlightedIndex, elementsRef, onHighlightedIndexChange]);\n const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {\n if (!onLoop) {\n return nextIndex;\n }\n return onLoop(event, prevIndex, nextIndex, elementsRef);\n });\n\n // Stable so that `relayKeyboardEvent` does not invalidate identity-sensitive\n // consumers (the `CompositeRootContext` value and trigger data forwarding).\n const onKeyDown = useStableCallback(event => {\n const isHomeOrEnd = event.key === HOME || event.key === END;\n if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) {\n return;\n }\n if (isModifierKeySet(event, modifierKeys)) {\n return;\n }\n const element = rootRef.current;\n if (!element) {\n return;\n }\n const isRtl = direction === 'rtl';\n const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;\n const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;\n const forwardKey = orientation === 'vertical' ? ARROW_DOWN : horizontalForwardKey;\n const backwardKey = orientation === 'vertical' ? ARROW_UP : horizontalBackwardKey;\n const target = getTarget(event.nativeEvent);\n if (target != null && isNativeInput(target) && !isElementDisabled(target)) {\n const selectionStart = target.selectionStart;\n const selectionEnd = target.selectionEnd;\n const textContent = target.value;\n // return to native textbox behavior when\n // 1 - Shift is held to make a text selection, or if there already is a text selection\n if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {\n return;\n }\n // 2 - arrow-ing forward and not in the last position of the text\n if (event.key !== backwardKey && selectionStart < textContent.length) {\n return;\n }\n // 3 -arrow-ing backward and not in the first position of the text\n if (event.key !== forwardKey && selectionStart > 0) {\n return;\n }\n }\n let nextIndex = highlightedIndex;\n const minIndex = getMinListIndex(elementsRef, disabledIndices);\n const maxIndex = getMaxListIndex(elementsRef, disabledIndices);\n if (grid != null) {\n nextIndex = grid({\n disabledIndices,\n elementsRef,\n event,\n highlightedIndex,\n loopFocus,\n maxIndex,\n minIndex,\n onLoop: wrappedOnLoop,\n orientation,\n rtl: isRtl\n });\n }\n const isForwardKey = orientation !== 'vertical' && event.key === horizontalForwardKey || orientation !== 'horizontal' && event.key === ARROW_DOWN;\n const isBackwardKey = orientation !== 'vertical' && event.key === horizontalBackwardKey || orientation !== 'horizontal' && event.key === ARROW_UP;\n if (enableHomeAndEndKeys) {\n if (event.key === HOME) {\n nextIndex = minIndex;\n } else if (event.key === END) {\n nextIndex = maxIndex;\n }\n }\n if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) {\n if (loopFocus && nextIndex === maxIndex && isForwardKey) {\n nextIndex = minIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else if (loopFocus && nextIndex === minIndex && isBackwardKey) {\n nextIndex = maxIndex;\n if (onLoop) {\n nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);\n }\n } else {\n nextIndex = findNonDisabledListIndex(elementsRef.current, {\n startingIndex: nextIndex,\n decrement: isBackwardKey,\n disabledIndices\n });\n }\n }\n if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {\n if (stopEventPropagation) {\n event.stopPropagation();\n }\n if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) {\n event.preventDefault();\n }\n onHighlightedIndexChange(nextIndex, true);\n\n // Wait for FocusManager `returnFocus` to execute.\n queueMicrotask(() => {\n elementsRef.current[nextIndex]?.focus();\n });\n }\n });\n const props = {\n ref: mergedRef,\n onFocus(event) {\n const element = rootRef.current;\n const target = getTarget(event.nativeEvent);\n if (!element || target == null || !isNativeInput(target)) {\n return;\n }\n target.setSelectionRange(0, target.value.length);\n },\n onKeyDown\n };\n return {\n props,\n highlightedIndex,\n onHighlightedIndexChange,\n elementsRef,\n onMapChange,\n relayKeyboardEvent: onKeyDown\n };\n}\n\n// Resolves the item that should hold the tab stop: the active item when it can take focus,\n// otherwise the first item that can. Falls back to index 0 so an all-disabled composite keeps the\n// index in range and regains a tab stop as soon as one of its items becomes focusable.\nfunction getFallbackIndex(elements, disabledIndices) {\n let fallbackIndex = -1;\n for (let index = 0; index < elements.length; index += 1) {\n const element = elements[index];\n if (!element || isListIndexDisabled(elements, index, disabledIndices)) {\n continue;\n }\n if (element.hasAttribute(ACTIVE_COMPOSITE_ITEM)) {\n return index;\n }\n if (fallbackIndex === -1) {\n fallbackIndex = index;\n }\n }\n return Math.max(fallbackIndex, 0);\n}\nfunction isModifierKeySet(event, ignoredModifierKeys) {\n for (const key of MODIFIER_KEYS) {\n if (ignoredModifierKeys.includes(key)) {\n continue;\n }\n if (event.getModifierState(key)) {\n return true;\n }\n }\n return false;\n}","export const ACTIVE_COMPOSITE_ITEM = 'data-composite-item-active';","export const OPEN_DELAY = 50;\nexport const CLOSE_DELAY = 50;\nexport const NAVIGATION_MENU_TRIGGER_IDENTIFIER = 'data-base-ui-navigation-menu-trigger';","'use client';\n\nimport * as React from 'react';\nexport const NavigationMenuDismissContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuDismissContext.displayName = \"NavigationMenuDismissContext\";\nexport function useNavigationMenuDismissContext() {\n return React.useContext(NavigationMenuDismissContext);\n}","import { PopupTriggerMap } from \"../../utils/popups/index.mjs\";\nimport { FloatingRootStore } from \"../components/FloatingRootStore.mjs\";\nexport function getEmptyRootContext() {\n return new FloatingRootStore({\n open: false,\n transitionStatus: undefined,\n floatingElement: null,\n referenceElement: null,\n triggerElements: new PopupTriggerMap(),\n floatingId: undefined,\n syncOnly: false,\n nested: false,\n onOpenChange: undefined\n });\n}","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { NavigationMenuItemContext } from \"./NavigationMenuItemContext.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\n\n/**\n * An individual navigation menu item.\n * Renders a `<li>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const NavigationMenuItem = /*#__PURE__*/React.forwardRef(function NavigationMenuItem(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n value: valueProp,\n ...elementProps\n } = componentProps;\n const fallbackValue = useBaseUiId();\n const value = valueProp ?? fallbackValue;\n const element = useRenderElement('li', componentProps, {\n ref: forwardedRef,\n props: elementProps\n });\n const contextValue = React.useMemo(() => ({\n value\n }), [value]);\n return /*#__PURE__*/_jsx(NavigationMenuItemContext.Provider, {\n value: contextValue,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuItem.displayName = \"NavigationMenuItem\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const NavigationMenuItemContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuItemContext.displayName = \"NavigationMenuItemContext\";\nexport function useNavigationMenuItemContext() {\n const value = React.useContext(NavigationMenuItemContext);\n if (!value) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: NavigationMenuItem parts must be used within a <NavigationMenu.Item>.' : _formatErrorMessage(39));\n }\n return value;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { FloatingNode } from \"../../floating-ui-react/index.mjs\";\nimport { contains, getTarget } from \"../../floating-ui-react/utils.mjs\";\nimport { useNavigationMenuRootContext, useNavigationMenuTreeContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { useNavigationMenuItemContext } from \"../item/NavigationMenuItemContext.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { transitionStatusMapping } from \"../../internals/stateAttributesMapping.mjs\";\nimport { CompositeRoot } from \"../../internals/composite/root/CompositeRoot.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport * as NavigationMenuContentDataAttributes from \"./NavigationMenuContentDataAttributes.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst stateAttributesMapping = {\n ...popupStateMapping,\n ...transitionStatusMapping,\n activationDirection(value) {\n if (!value) {\n return null;\n }\n return {\n [NavigationMenuContentDataAttributes.activationDirection]: value\n };\n }\n};\n\n/**\n * A container for the content of the navigation menu item that is moved into the popup\n * when the item is active.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuContent = /*#__PURE__*/React.forwardRef(function NavigationMenuContent(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n keepMounted = false,\n ...elementProps\n } = componentProps;\n const {\n mounted: popupMounted,\n viewportElement,\n value,\n activationDirection,\n currentContentRef,\n viewportTargetElement\n } = useNavigationMenuRootContext();\n const {\n value: itemValue\n } = useNavigationMenuItemContext();\n const nodeId = useNavigationMenuTreeContext();\n const open = popupMounted && value === itemValue;\n const ref = React.useRef(null);\n const [hasMountedInPortal, setHasMountedInPortal] = React.useState(false);\n const [focusInside, setFocusInside] = React.useState(false);\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n\n // If the popup unmounts before the content's exit animation completes, reset the internal\n // mounted state so the next open can re-enter via `transitionStatus=\"starting\"`.\n if (mounted && !popupMounted) {\n setMounted(false);\n }\n useOpenChangeComplete({\n ref,\n open,\n onComplete() {\n if (!open) {\n setMounted(false);\n }\n }\n });\n\n // When a content re-enters while still mounted (e.g. switching top-level triggers\n // back before the exit animation completes), the DOM element hasn't changed so the\n // callback ref won't fire again. Ensure the shared ref is updated so the\n // MutationObserver in the trigger watches the correct content element.\n useIsoLayoutEffect(() => {\n if (open && ref.current) {\n currentContentRef.current = ref.current;\n }\n }, [open, currentContentRef]);\n const state = {\n open,\n transitionStatus,\n activationDirection\n };\n const handleCurrentContentRef = useStableCallback(node => {\n // Inactive `keepMounted` content also mounts in the viewport; only the\n // active content can own the shared sizing observer target.\n if (node && open) {\n currentContentRef.current = node;\n }\n });\n const commonProps = {\n onFocus(event) {\n const target = getTarget(event.nativeEvent);\n if (target?.hasAttribute('data-base-ui-focus-guard')) {\n return;\n }\n setFocusInside(true);\n },\n onBlur(event) {\n if (!contains(event.currentTarget, event.relatedTarget)) {\n setFocusInside(false);\n }\n }\n };\n const defaultProps = !open && mounted ? {\n style: {\n position: 'absolute',\n top: 0,\n left: 0\n },\n inert: inertValue(!focusInside),\n ...commonProps\n } : commonProps;\n const portalContainer = viewportTargetElement || viewportElement;\n const hidden = keepMounted && !mounted;\n const shouldRenderInline = keepMounted && !portalContainer && !hasMountedInPortal;\n if (keepMounted && portalContainer && !hasMountedInPortal) {\n setHasMountedInPortal(true);\n }\n if (shouldRenderInline) {\n return /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: [defaultProps, {\n hidden: true\n }, elementProps],\n stateAttributesMapping: stateAttributesMapping\n });\n }\n if (!portalContainer || !mounted && !keepMounted) {\n return null;\n }\n return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx(FloatingNode, {\n id: nodeId,\n children: /*#__PURE__*/_jsx(CompositeRoot, {\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef, ref, handleCurrentContentRef],\n props: [defaultProps, hidden ? {\n hidden: true\n } : EMPTY_OBJECT, elementProps],\n stateAttributesMapping: stateAttributesMapping\n })\n }), portalContainer);\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuContent.displayName = \"NavigationMenuContent\";","import { CommonPopupDataAttributes } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * Present when the popup is open.\n */\nexport const open = CommonPopupDataAttributes.open;\n/**\n * Present when the popup is closed.\n */\nexport const closed = CommonPopupDataAttributes.closed;\n/**\n * Present when the content begins animating in.\n */\nexport const startingStyle = CommonPopupDataAttributes.startingStyle;\n/**\n * Present when the content is animating out.\n */\nexport const endingStyle = CommonPopupDataAttributes.endingStyle;\n/**\n * Which direction another trigger was activated from.\n * @type {'left' | 'right' | 'up' | 'down'}\n */\nexport const activationDirection = 'data-activation-direction';","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerWindow } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { safePolygon, useClick, useFloatingRootContext, useFloatingTree, useHoverReferenceInteraction } from \"../../floating-ui-react/index.mjs\";\nimport { applySafePolygonPointerEventsMutation, clearSafePolygonPointerEventsMutation, useHoverInteractionSharedState } from \"../../floating-ui-react/hooks/useHoverInteractionSharedState.mjs\";\nimport { contains, getTabbableAfterElement, getNextTabbable, getPreviousTabbable, isOutsideEvent, stopEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { useNavigationMenuItemContext } from \"../item/NavigationMenuItemContext.mjs\";\nimport { useNavigationMenuRootContext, useNavigationMenuTreeContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { ownerVisuallyHidden, PATIENT_CLICK_THRESHOLD } from \"../../internals/constants.mjs\";\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { TransitionStatusDataAttributes } from \"../../internals/stateAttributesMapping.mjs\";\nimport { isOutsideMenuEvent } from \"../utils/isOutsideMenuEvent.mjs\";\nimport { CompositeItem } from \"../../internals/composite/item/CompositeItem.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { useAnimationsFinished } from \"../../internals/useAnimationsFinished.mjs\";\nimport { getCssDimensions } from \"../../utils/getCssDimensions.mjs\";\nimport { NAVIGATION_MENU_TRIGGER_IDENTIFIER } from \"../utils/constants.mjs\";\nimport { setSharedFixedSize } from \"../utils/setSharedFixedSize.mjs\";\nimport { useNavigationMenuDismissContext } from \"../list/NavigationMenuDismissContext.mjs\";\nimport * as NavigationMenuPopupCssVars from \"../popup/NavigationMenuPopupCssVars.mjs\";\nimport * as NavigationMenuPositionerCssVars from \"../positioner/NavigationMenuPositionerCssVars.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst DEFAULT_SIZE = {\n width: 0,\n height: 0\n};\n\n/**\n * Opens the navigation menu popup when hovered or clicked, revealing the\n * associated content.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuTrigger = /*#__PURE__*/React.forwardRef(function NavigationMenuTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n nativeButton = true,\n disabled = false,\n ...elementProps\n } = componentProps;\n const {\n value,\n setValue,\n mounted,\n open,\n positionerElement,\n setActivationDirection,\n setFloatingRootContext,\n popupElement,\n viewportElement,\n transitionStatus,\n rootRef,\n beforeOutsideRef,\n afterOutsideRef,\n afterInsideRef,\n beforeInsideRef,\n prevTriggerElementRef,\n popupAutoSizeResetRef,\n currentContentRef,\n delay,\n closeDelay,\n orientation,\n setViewportInert,\n nested\n } = useNavigationMenuRootContext();\n const {\n value: itemValue\n } = useNavigationMenuItemContext();\n const nodeId = useNavigationMenuTreeContext();\n const tree = useFloatingTree();\n const dismissProps = useNavigationMenuDismissContext();\n const direction = useDirection();\n const stickIfOpenTimeout = useTimeout();\n const mutationFrame = useAnimationFrame();\n const resizeFrame = useAnimationFrame();\n const sizeFrame = useAnimationFrame();\n const [triggerElement, setTriggerElement] = React.useState(null);\n const [stickIfOpen, setStickIfOpen] = React.useState(true);\n const [pointerType, setPointerType] = React.useState('');\n const triggerElementRef = React.useRef(null);\n const prevSizeRef = React.useRef(DEFAULT_SIZE);\n const skipAutoSizeSyncRef = React.useRef(false);\n const isActiveItem = open && value === itemValue;\n const isActiveItemRef = useValueAsRef(isActiveItem);\n const interactionsEnabled = (positionerElement != null || value == null) && !disabled;\n const hoverFloatingElement = positionerElement || viewportElement;\n const hoverInteractionsEnabled = (hoverFloatingElement != null || value == null) && !disabled;\n const runOnceAnimationsFinish = useAnimationsFinished(popupElement);\n const handleTriggerElement = React.useCallback(element => {\n triggerElementRef.current = element;\n setTriggerElement(element);\n }, []);\n const cancelAutoSizeReset = useStableCallback((force = false) => {\n if (!force && popupAutoSizeResetRef.current.owner !== itemValue) {\n return;\n }\n popupAutoSizeResetRef.current.abortController?.abort();\n popupAutoSizeResetRef.current.abortController = null;\n popupAutoSizeResetRef.current.owner = null;\n });\n useIsoLayoutEffect(() => {\n if (isActiveItem) {\n return;\n }\n mutationFrame.cancel();\n sizeFrame.cancel();\n cancelAutoSizeReset();\n }, [isActiveItem, mutationFrame, sizeFrame, cancelAutoSizeReset]);\n function setAutoSizes(element) {\n element.style.setProperty(NavigationMenuPopupCssVars.popupWidth, 'auto');\n element.style.setProperty(NavigationMenuPopupCssVars.popupHeight, 'auto');\n }\n function clearFixedSizes(popup, positioner) {\n popup.style.removeProperty(NavigationMenuPopupCssVars.popupWidth);\n popup.style.removeProperty(NavigationMenuPopupCssVars.popupHeight);\n positioner.style.removeProperty(NavigationMenuPositionerCssVars.positionerWidth);\n positioner.style.removeProperty(NavigationMenuPositionerCssVars.positionerHeight);\n }\n function scheduleAutoSizeReset(popup) {\n cancelAutoSizeReset(true);\n const abortController = new AbortController();\n popupAutoSizeResetRef.current.abortController = abortController;\n popupAutoSizeResetRef.current.owner = itemValue;\n runOnceAnimationsFinish(() => {\n popupAutoSizeResetRef.current.abortController = null;\n popupAutoSizeResetRef.current.owner = null;\n setAutoSizes(popup);\n }, abortController.signal);\n }\n const handleValueChange = useStableCallback((popup, positioner, currentWidth, currentHeight) => {\n cancelAutoSizeReset(true);\n clearFixedSizes(popup, positioner);\n const {\n width,\n height\n } = getCssDimensions(popup);\n const measuredWidth = width || prevSizeRef.current.width;\n const measuredHeight = height || prevSizeRef.current.height;\n if (currentHeight === 0 || currentWidth === 0) {\n currentWidth = measuredWidth;\n currentHeight = measuredHeight;\n }\n popup.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${currentWidth}px`);\n popup.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${currentHeight}px`);\n positioner.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${measuredWidth}px`);\n positioner.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${measuredHeight}px`);\n sizeFrame.request(() => {\n if (!isActiveItemRef.current) {\n return;\n }\n popup.style.setProperty(NavigationMenuPopupCssVars.popupWidth, `${measuredWidth}px`);\n popup.style.setProperty(NavigationMenuPopupCssVars.popupHeight, `${measuredHeight}px`);\n scheduleAutoSizeReset(popup);\n });\n });\n const handleInterruptedMutationResize = useStableCallback((popup, positioner, currentWidth, currentHeight) => {\n sizeFrame.cancel();\n mutationFrame.cancel();\n cancelAutoSizeReset(true);\n if (currentWidth === 0 || currentHeight === 0) {\n return;\n }\n setSharedFixedSize(popup, positioner, currentWidth, currentHeight);\n mutationFrame.request(() => {\n mutationFrame.request(() => {\n clearFixedSizes(popup, positioner);\n const {\n width,\n height\n } = getCssDimensions(popup);\n const measuredWidth = width || currentWidth;\n const measuredHeight = height || currentHeight;\n setSharedFixedSize(popup, positioner, currentWidth, currentHeight);\n sizeFrame.request(() => {\n if (!isActiveItemRef.current) {\n return;\n }\n setSharedFixedSize(popup, positioner, measuredWidth, measuredHeight);\n scheduleAutoSizeReset(popup);\n });\n });\n });\n });\n const syncCurrentSize = useStableCallback((popup, positioner) => {\n sizeFrame.cancel();\n cancelAutoSizeReset(true);\n clearFixedSizes(popup, positioner);\n const {\n width,\n height\n } = getCssDimensions(popup);\n if (width === 0 || height === 0) {\n return;\n }\n prevSizeRef.current = {\n width,\n height\n };\n setAutoSizes(popup);\n positioner.style.setProperty(NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);\n positioner.style.setProperty(NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);\n });\n const getMutationBaseline = useStableCallback(popup => {\n const popupWidth = popup.style.getPropertyValue(NavigationMenuPopupCssVars.popupWidth);\n const popupHeight = popup.style.getPropertyValue(NavigationMenuPopupCssVars.popupHeight);\n const isResizing = popupWidth !== '' && popupWidth !== 'auto' && popupHeight !== '' && popupHeight !== 'auto';\n if (!isResizing) {\n return {\n size: prevSizeRef.current,\n syncPositioner: false\n };\n }\n return {\n size: {\n width: popup.offsetWidth || prevSizeRef.current.width,\n height: popup.offsetHeight || prevSizeRef.current.height\n },\n syncPositioner: true\n };\n });\n React.useEffect(() => {\n if (!open) {\n stickIfOpenTimeout.clear();\n mutationFrame.cancel();\n resizeFrame.cancel();\n sizeFrame.cancel();\n cancelAutoSizeReset(true);\n skipAutoSizeSyncRef.current = false;\n setPointerType('');\n }\n }, [stickIfOpenTimeout, open, mutationFrame, resizeFrame, sizeFrame, cancelAutoSizeReset]);\n React.useEffect(() => {\n if (!mounted) {\n prevSizeRef.current = DEFAULT_SIZE;\n }\n }, [mounted]);\n useIsoLayoutEffect(() => {\n if (!popupElement || typeof ResizeObserver !== 'function') {\n return undefined;\n }\n const resizeObserver = new ResizeObserver(() => {\n prevSizeRef.current = {\n width: popupElement.offsetWidth,\n height: popupElement.offsetHeight\n };\n });\n resizeObserver.observe(popupElement);\n return () => {\n resizeObserver.disconnect();\n };\n }, [popupElement]);\n React.useEffect(() => {\n if (!open || !isActiveItem || !popupElement || !positionerElement) {\n return undefined;\n }\n const popup = popupElement;\n const positioner = positionerElement;\n const win = ownerWindow(positioner);\n function handleResize() {\n resizeFrame.cancel();\n resizeFrame.request(() => syncCurrentSize(popup, positioner));\n }\n const unsubscribe = addEventListener(win, 'resize', handleResize);\n return () => {\n resizeFrame.cancel();\n unsubscribe();\n };\n }, [open, isActiveItem, popupElement, positionerElement, resizeFrame, syncCurrentSize]);\n React.useEffect(() => {\n const observedElement = currentContentRef.current;\n if (!observedElement || !popupElement || !positionerElement || !isActiveItem || typeof MutationObserver !== 'function') {\n return undefined;\n }\n const mutationObserver = new MutationObserver(() => {\n if (transitionStatus === 'starting' || popupElement.hasAttribute(TransitionStatusDataAttributes.startingStyle)) {\n syncCurrentSize(popupElement, positionerElement);\n return;\n }\n const {\n size,\n syncPositioner\n } = getMutationBaseline(popupElement);\n if (syncPositioner) {\n handleInterruptedMutationResize(popupElement, positionerElement, size.width, size.height);\n return;\n }\n handleValueChange(popupElement, positionerElement, size.width, size.height);\n });\n mutationObserver.observe(observedElement, {\n childList: true,\n subtree: true,\n characterData: true,\n // `keepMounted` submenu switches update dimensions by toggling hidden\n // content rather than inserting or removing content nodes.\n attributes: true,\n attributeFilter: ['hidden']\n });\n return () => {\n mutationObserver.disconnect();\n };\n }, [currentContentRef, popupElement, positionerElement, isActiveItem, transitionStatus, getMutationBaseline, handleInterruptedMutationResize, handleValueChange, syncCurrentSize]);\n useIsoLayoutEffect(() => {\n if (isActiveItemRef.current && open && popupElement && positionerElement) {\n if (skipAutoSizeSyncRef.current) {\n skipAutoSizeSyncRef.current = false;\n return undefined;\n }\n const {\n width,\n height\n } = getCssDimensions(popupElement);\n handleValueChange(popupElement, positionerElement, width, height);\n }\n return undefined;\n }, [currentContentRef, handleValueChange, isActiveItemRef, open, popupElement, positionerElement, transitionStatus]);\n function handleOpenChange(nextOpen, eventDetails) {\n const isHover = eventDetails.reason === REASONS.triggerHover;\n if (!interactionsEnabled) {\n return;\n }\n if (pointerType === 'touch' && isHover) {\n return;\n }\n if (!nextOpen && value !== itemValue) {\n return;\n }\n function changeState() {\n if (isHover) {\n // Only allow \"patient\" clicks to close the popup if it's open.\n // If they clicked within 500ms of the popup opening, keep it open.\n setStickIfOpen(true);\n stickIfOpenTimeout.clear();\n stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => {\n setStickIfOpen(false);\n });\n }\n if (nextOpen) {\n setValue(itemValue, eventDetails);\n } else {\n setValue(null, eventDetails);\n setPointerType('');\n }\n }\n if (isHover) {\n ReactDOM.flushSync(changeState);\n } else {\n changeState();\n }\n }\n const context = useFloatingRootContext({\n open,\n onOpenChange: handleOpenChange,\n elements: {\n reference: triggerElement,\n floating: hoverFloatingElement\n }\n });\n const hoverInteractionState = useHoverInteractionSharedState(context);\n const shouldBlockSafePolygonPointerEvents = pointerType !== 'touch';\n React.useEffect(() => {\n if (!open) {\n context.context.dataRef.current.openEvent = undefined;\n hoverInteractionState.pointerType = undefined;\n hoverInteractionState.interactedInside = false;\n hoverInteractionState.restTimeoutPending = false;\n hoverInteractionState.openChangeTimeout.clear();\n hoverInteractionState.restTimeout.clear();\n }\n return () => {\n clearSafePolygonPointerEventsMutation(hoverInteractionState);\n };\n }, [context, hoverInteractionState, open]);\n const getInlineHandleCloseContext = useStableCallback(() => {\n if (!nested || positionerElement || !triggerElementRef.current || !hoverFloatingElement) {\n return null;\n }\n return getHandleCloseContext(triggerElementRef.current, hoverFloatingElement, nodeId);\n });\n function getScope() {\n if (nested && positionerElement) {\n return null;\n }\n return triggerElementRef.current?.closest('ul') ?? null;\n }\n const hoverProps = useHoverReferenceInteraction(context, {\n enabled: hoverInteractionsEnabled,\n move: false,\n handleClose: safePolygon({\n blockPointerEvents: shouldBlockSafePolygonPointerEvents,\n getScope\n }),\n restMs: mounted && positionerElement ? 0 : delay,\n delay: {\n close: closeDelay\n },\n triggerElementRef,\n getHandleCloseContext: getInlineHandleCloseContext\n });\n const hover = React.useMemo(() => hoverProps ? {\n reference: hoverProps\n } : undefined, [hoverProps]);\n const click = useClick(context, {\n enabled: interactionsEnabled,\n stickIfOpen,\n toggle: isActiveItem\n });\n const referenceProps = React.useMemo(() => mergeProps(click.reference, hover?.reference), [click.reference, hover]);\n useIsoLayoutEffect(() => {\n if (isActiveItem) {\n setFloatingRootContext(context);\n prevTriggerElementRef.current = triggerElement;\n }\n }, [isActiveItem, context, setFloatingRootContext, prevTriggerElementRef, triggerElement]);\n function handleActivation(event) {\n ReactDOM.flushSync(() => {\n const currentTarget = event.currentTarget;\n const prevTriggerRect = prevTriggerElementRef.current?.getBoundingClientRect();\n if (mounted && prevTriggerRect && triggerElement) {\n const nextTriggerRect = triggerElement.getBoundingClientRect();\n const isMovingRight = nextTriggerRect.left > prevTriggerRect.left;\n const isMovingDown = nextTriggerRect.top > prevTriggerRect.top;\n if (orientation === 'horizontal' && nextTriggerRect.left !== prevTriggerRect.left) {\n setActivationDirection(isMovingRight ? 'right' : 'left');\n } else if (orientation === 'vertical' && nextTriggerRect.top !== prevTriggerRect.top) {\n setActivationDirection(isMovingDown ? 'down' : 'up');\n }\n }\n\n // Reset the `openEvent` to `undefined` when the active item changes so that a\n // `click` -> `hover` on new trigger -> `hover` back to old trigger doesn't unexpectedly\n // cause the popup to remain stuck open when leaving the old trigger.\n if (event.type !== 'click' && value != null) {\n context.context.dataRef.current.openEvent = undefined;\n }\n if (pointerType === 'touch' && event.type !== 'click') {\n return;\n }\n\n // Keyboard open events reach this activation path after `onKeyDown` has already set\n // the value with the `listNavigation` reason.\n if (value != null && event.type !== 'keydown') {\n setValue(itemValue, createChangeEventDetails(event.type === 'mouseenter' ? REASONS.triggerHover : REASONS.triggerPress, event.nativeEvent));\n }\n if (event.type === 'mouseenter' && shouldBlockSafePolygonPointerEvents && (!nested || !positionerElement) && hoverFloatingElement) {\n const applyPointerEventsMutation = () => {\n const scopeElement = getScope() ?? currentTarget.ownerDocument.body;\n applySafePolygonPointerEventsMutation(hoverInteractionState, {\n scopeElement,\n referenceElement: currentTarget,\n floatingElement: hoverFloatingElement\n });\n };\n if (value != null && value !== itemValue) {\n queueMicrotask(applyPointerEventsMutation);\n } else {\n applyPointerEventsMutation();\n }\n }\n });\n }\n const handleOpenEvent = useStableCallback(event => {\n if (disabled) {\n return;\n }\n if (!popupElement || !positionerElement) {\n handleActivation(event);\n return;\n }\n const {\n width,\n height\n } = getCssDimensions(popupElement);\n const shouldSkipAutoSizeSync = value != null && value !== itemValue && (event.type === 'click' || pointerType !== 'touch');\n handleActivation(event);\n if (shouldSkipAutoSizeSync) {\n skipAutoSizeSyncRef.current = true;\n }\n handleValueChange(popupElement, positionerElement, width, height);\n });\n const state = {\n open: isActiveItem,\n disabled\n };\n function handleSetPointerType(event) {\n setPointerType(event.pointerType);\n }\n function handleTriggerPointerDown(event) {\n handleSetPointerType(event);\n clearSafePolygonPointerEventsMutation(hoverInteractionState);\n }\n const defaultProps = {\n tabIndex: 0,\n onMouseEnter: handleOpenEvent,\n onClick: handleOpenEvent,\n onPointerEnter: handleSetPointerType,\n onPointerDown: handleTriggerPointerDown,\n 'aria-expanded': isActiveItem,\n 'aria-controls': isActiveItem ? popupElement?.id : undefined,\n [NAVIGATION_MENU_TRIGGER_IDENTIFIER]: '',\n onFocus() {\n if (!isActiveItem) {\n return;\n }\n setViewportInert(false);\n },\n onMouseLeave() {\n if (value == null) {\n clearSafePolygonPointerEventsMutation(hoverInteractionState);\n }\n },\n onKeyDown(event) {\n // For nested (submenu) triggers, don't intercept arrow keys that are used for\n // navigation in the parent content. The arrow keys should be handled by the\n // parent's CompositeRoot for navigating between items.\n if (nested) {\n return;\n }\n const verticalOpenKey = direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight';\n const openHorizontal = orientation === 'horizontal' && event.key === 'ArrowDown';\n const openVertical = orientation === 'vertical' && event.key === verticalOpenKey;\n if (openHorizontal || openVertical) {\n setValue(itemValue, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n handleOpenEvent(event);\n stopEvent(event);\n }\n },\n onBlur(event) {\n if (positionerElement && popupElement && isOutsideMenuEvent({\n currentTarget: event.currentTarget,\n relatedTarget: event.relatedTarget\n }, {\n popupElement,\n rootRef,\n tree,\n nodeId\n })) {\n setValue(null, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n };\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n focusableWhenDisabled: true,\n native: nativeButton\n });\n const referenceElement = hoverFloatingElement;\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(CompositeItem, {\n tag: \"button\",\n render: render,\n className: className,\n style: style,\n state: state,\n stateAttributesMapping: pressableTriggerOpenStateMapping,\n refs: [forwardedRef, handleTriggerElement, buttonRef],\n props: [referenceProps, dismissProps?.reference || EMPTY_ARRAY, defaultProps, elementProps, getButtonProps]\n }), isActiveItem && /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(FocusGuard, {\n ref: beforeOutsideRef,\n onFocus: event => {\n if (referenceElement && isOutsideEvent(event, referenceElement)) {\n beforeInsideRef.current?.focus();\n } else {\n const prevTabbable = getPreviousTabbable(triggerElement);\n prevTabbable?.focus();\n }\n }\n }), /*#__PURE__*/_jsx(\"span\", {\n \"aria-owns\": viewportElement?.id,\n style: ownerVisuallyHidden\n }), /*#__PURE__*/_jsx(FocusGuard, {\n ref: afterOutsideRef,\n onFocus: event => {\n if (referenceElement && isOutsideEvent(event, referenceElement)) {\n ReactDOM.flushSync(() => {\n setViewportInert(false);\n });\n const elementToFocus = afterInsideRef.current || triggerElement;\n elementToFocus?.focus();\n } else {\n let nextTabbable = getNextTabbable(triggerElement);\n if (nested && !positionerElement && referenceElement && nextTabbable && contains(referenceElement, nextTabbable)) {\n nextTabbable = getTabbableAfterElement(afterInsideRef.current);\n }\n nextTabbable?.focus();\n if ((!nested || positionerElement) && !contains(rootRef.current, nextTabbable)) {\n setValue(null, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n }\n })]\n })]\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuTrigger.displayName = \"NavigationMenuTrigger\";\nfunction getPlacementFromElements(domReferenceElement, floatingElement) {\n const referenceRect = domReferenceElement.getBoundingClientRect();\n const floatingRect = floatingElement.getBoundingClientRect();\n const referenceCenterX = referenceRect.left + referenceRect.width / 2;\n const referenceCenterY = referenceRect.top + referenceRect.height / 2;\n const floatingCenterX = floatingRect.left + floatingRect.width / 2;\n const floatingCenterY = floatingRect.top + floatingRect.height / 2;\n const deltaX = floatingCenterX - referenceCenterX;\n const deltaY = floatingCenterY - referenceCenterY;\n if (Math.abs(deltaX) >= Math.abs(deltaY)) {\n return deltaX >= 0 ? 'right' : 'left';\n }\n return deltaY >= 0 ? 'bottom' : 'top';\n}\nfunction getHandleCloseContext(domReferenceElement, floatingElement, nodeId) {\n return {\n placement: getPlacementFromElements(domReferenceElement, floatingElement),\n elements: {\n domReference: domReferenceElement,\n floating: floatingElement\n },\n nodeId\n };\n}","import { contains, getNodeChildren } from \"../../floating-ui-react/utils.mjs\";\nexport function isOutsideMenuEvent({\n currentTarget,\n relatedTarget\n}, params) {\n const {\n popupElement,\n rootRef,\n tree,\n nodeId\n } = params;\n const nodeChildrenContains = tree ? getNodeChildren(tree.nodesRef.current, nodeId).some(node => contains(node.context?.elements.floating, relatedTarget)) : false;\n if (!popupElement) {\n return !contains(rootRef.current, relatedTarget) && !nodeChildrenContains;\n }\n return !contains(popupElement, currentTarget) && !contains(popupElement, relatedTarget) && !contains(rootRef.current, relatedTarget) && !nodeChildrenContains;\n}","'use client';\n\nimport * as React from 'react';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useCompositeRootContext } from \"../root/CompositeRootContext.mjs\";\nimport { useCompositeListItem } from \"../list/useCompositeListItem.mjs\";\nexport function useCompositeItem(params = {}) {\n const {\n highlightItemOnHover,\n highlightedIndex,\n onHighlightedIndexChange\n } = useCompositeRootContext();\n const {\n ref,\n index\n } = useCompositeListItem(params);\n const isHighlighted = highlightedIndex === index;\n const itemRef = React.useRef(null);\n const mergedRef = useMergedRefs(ref, itemRef);\n const compositeProps = {\n tabIndex: isHighlighted ? 0 : -1,\n onFocus() {\n onHighlightedIndexChange(index);\n },\n onMouseMove() {\n const item = itemRef.current;\n if (!highlightItemOnHover || !item) {\n return;\n }\n const disabled = item.hasAttribute('disabled') || item.ariaDisabled === 'true';\n if (!isHighlighted && !disabled) {\n item.focus();\n }\n }\n };\n return {\n compositeProps,\n compositeRef: mergedRef,\n index\n };\n}","'use client';\n\nimport { EMPTY_OBJECT, EMPTY_ARRAY } from '@base-ui/utils/empty';\nimport { useRenderElement } from \"../../useRenderElement.mjs\";\nimport { useCompositeItem } from \"./useCompositeItem.mjs\";\nexport function CompositeItem(componentProps) {\n const {\n render,\n className,\n style,\n state = EMPTY_OBJECT,\n props = EMPTY_ARRAY,\n refs = EMPTY_ARRAY,\n metadata,\n stateAttributesMapping,\n tag = 'div',\n ...elementProps\n } = componentProps;\n const {\n compositeProps,\n compositeRef\n } = useCompositeItem({\n metadata\n });\n return useRenderElement(tag, componentProps, {\n state,\n // The composite ref attaches first so an outer item wins when nested items share a DOM node.\n ref: [compositeRef, ...refs],\n props: [compositeProps, ...props, elementProps],\n stateAttributesMapping\n });\n}","import { round } from '@floating-ui/utils';\nimport { getComputedStyle, isHTMLElement } from '@floating-ui/utils/dom';\nexport function getCssDimensions(element) {\n const css = getComputedStyle(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height\n };\n}","'use client';\n\nimport * as React from 'react';\nimport { FloatingPortal } from \"../../floating-ui-react/index.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { NavigationMenuPortalContext } from \"./NavigationMenuPortalContext.mjs\";\n\n/**\n * A portal element that moves the popup to a different part of the DOM.\n * By default, the portal element is appended to `<body>`.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const NavigationMenuPortal = /*#__PURE__*/React.forwardRef(function NavigationMenuPortal(props, forwardedRef) {\n const {\n keepMounted = false,\n ...portalProps\n } = props;\n const {\n mounted\n } = useNavigationMenuRootContext();\n const shouldRender = mounted || keepMounted;\n if (!shouldRender) {\n return null;\n }\n return /*#__PURE__*/_jsx(NavigationMenuPortalContext.Provider, {\n value: keepMounted,\n children: /*#__PURE__*/_jsx(FloatingPortal, {\n ref: forwardedRef,\n ...portalProps\n })\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuPortal.displayName = \"NavigationMenuPortal\";","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const NavigationMenuPortalContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuPortalContext.displayName = \"NavigationMenuPortalContext\";\nexport function useNavigationMenuPortalContext() {\n const value = React.useContext(NavigationMenuPortalContext);\n if (value === undefined) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: <NavigationMenu.Portal> is missing.' : _formatErrorMessage(40));\n }\n return value;\n}","'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerWindow } from '@base-ui/utils/owner';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { disableFocusInside, enableFocusInside, isOutsideEvent } from \"../../floating-ui-react/utils.mjs\";\nimport { getEmptyRootContext } from \"../../floating-ui-react/utils/getEmptyRootContext.mjs\";\nimport { useNavigationMenuRootContext, useNavigationMenuTreeContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { useNavigationMenuPortalContext } from \"../portal/NavigationMenuPortalContext.mjs\";\nimport { useNavigationMenuAnchorPositioning } from \"../utils/useNavigationMenuAnchorPositioning.mjs\";\nimport { NavigationMenuPositionerContext } from \"./NavigationMenuPositionerContext.mjs\";\nimport { DROPDOWN_COLLISION_AVOIDANCE, POPUP_COLLISION_AVOIDANCE } from \"../../internals/constants.mjs\";\nimport { adaptiveOrigin } from \"../../utils/adaptiveOriginMiddleware.mjs\";\nimport { usePositioner } from \"../../utils/usePositioner.mjs\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst EMPTY_ROOT_CONTEXT = getEmptyRootContext();\n\n/**\n * Positions the navigation menu against the currently active trigger.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuPositioner = /*#__PURE__*/React.forwardRef(function NavigationMenuPositioner(componentProps, forwardedRef) {\n const {\n open,\n mounted,\n positionerElement,\n setPositionerElement,\n floatingRootContext,\n nested,\n transitionStatus\n } = useNavigationMenuRootContext();\n const {\n className,\n render,\n anchor,\n positionMethod = 'absolute',\n side = 'bottom',\n align = 'center',\n sideOffset = 0,\n alignOffset = 0,\n collisionBoundary = 'clipping-ancestors',\n collisionPadding = 5,\n collisionAvoidance = nested ? POPUP_COLLISION_AVOIDANCE : DROPDOWN_COLLISION_AVOIDANCE,\n arrowPadding = 5,\n sticky = false,\n disableAnchorTracking = false,\n style,\n ...elementProps\n } = componentProps;\n const keepMounted = useNavigationMenuPortalContext();\n const nodeId = useNavigationMenuTreeContext();\n const initialInstantTimeout = useTimeout();\n const resizeTimeout = useTimeout();\n\n // When the menu is initially open, disable the positioner's transition for one frame\n // so a default value does not animate in from the unpositioned portal state.\n const [instant, setInstant] = React.useState(open);\n const needsInitialInstantResetRef = React.useRef(open);\n\n // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx\n React.useEffect(() => {\n if (!positionerElement) {\n return undefined;\n }\n\n // Make sure elements inside the portal element are tabbable only when the\n // portal has already been focused, either by tabbing into a focus trap\n // element outside or using the mouse.\n function onFocus(event) {\n if (positionerElement && isOutsideEvent(event)) {\n const focusing = event.type === 'focusin';\n const manageFocus = focusing ? enableFocusInside : disableFocusInside;\n manageFocus(positionerElement);\n }\n }\n\n // Listen to the event on the capture phase so they run before the focus\n // trap elements onFocus prop is called.\n return mergeCleanups(addEventListener(positionerElement, 'focusin', onFocus, true), addEventListener(positionerElement, 'focusout', onFocus, true));\n }, [positionerElement]);\n const domReference = (floatingRootContext || EMPTY_ROOT_CONTEXT).useState('domReferenceElement');\n const positioning = useNavigationMenuAnchorPositioning({\n anchor: anchor ?? domReference,\n positionMethod,\n mounted,\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n disableAnchorTracking,\n keepMounted,\n floatingRootContext,\n collisionAvoidance,\n shift: {\n rootBoundary: 'layoutViewport'\n },\n nodeId,\n // Allows the menu to remain anchored without wobbling while its size\n // and position transition simultaneously when side=top or side=left.\n adaptiveOrigin\n });\n const state = {\n open,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden,\n instant\n };\n React.useEffect(() => {\n if (!open) {\n return undefined;\n }\n if (needsInitialInstantResetRef.current) {\n initialInstantTimeout.start(0, () => {\n needsInitialInstantResetRef.current = false;\n if (!resizeTimeout.isStarted()) {\n setInstant(false);\n }\n });\n }\n function handleResize() {\n ReactDOM.flushSync(() => {\n setInstant(true);\n });\n resizeTimeout.start(100, () => {\n setInstant(false);\n });\n }\n const win = ownerWindow(positionerElement);\n return addEventListener(win, 'resize', handleResize);\n }, [open, initialInstantTimeout, resizeTimeout, positionerElement]);\n const element = usePositioner(componentProps, state, {\n styles: positioning.positionerStyles,\n transitionStatus,\n props: elementProps,\n refs: [forwardedRef, setPositionerElement],\n hidden: !mounted,\n inert: !open\n });\n return /*#__PURE__*/_jsx(NavigationMenuPositionerContext.Provider, {\n value: positioning,\n children: element\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuPositioner.displayName = \"NavigationMenuPositioner\";","'use client';\n\nimport { useFloating } from \"../../floating-ui-react/hooks/useFloating.mjs\";\nimport { useAnchorPositioningWithHook } from \"../../internals/useAnchorPositioning.mjs\";\n\n/**\n * Positioning path for the Navigation Menu, whose active trigger supplies its root store after the\n * positioner has already rendered.\n */\nexport function useNavigationMenuAnchorPositioning(params) {\n return useAnchorPositioningWithHook(params, useFloating);\n}","'use client';\n\nimport _formatErrorMessage from \"@base-ui/utils/formatErrorMessage\";\nimport * as React from 'react';\nexport const NavigationMenuPositionerContext = /*#__PURE__*/React.createContext(undefined);\nif (process.env.NODE_ENV !== \"production\") NavigationMenuPositionerContext.displayName = \"NavigationMenuPositionerContext\";\nexport function useNavigationMenuPositionerContext(optional = false) {\n const context = React.useContext(NavigationMenuPositionerContext);\n if (!context && !optional) {\n throw new Error(process.env.NODE_ENV !== \"production\" ? 'Base UI: NavigationMenuPositionerContext is missing. NavigationMenuPositioner parts must be placed within <NavigationMenu.Positioner>.' : _formatErrorMessage(42));\n }\n return context;\n}","import { ownerDocument, ownerWindow } from '@base-ui/utils/owner';\nimport { getSide } from '@floating-ui/utils';\nimport { DEFAULT_SIDES } from \"./adaptiveOriginConstants.mjs\";\nexport const adaptiveOrigin = {\n name: 'adaptiveOrigin',\n async fn(state) {\n const {\n x: rawX,\n y: rawY,\n rects: {\n floating: floatRect\n },\n elements: {\n floating\n },\n platform,\n strategy,\n placement\n } = state;\n const win = ownerWindow(floating);\n const styles = win.getComputedStyle(floating);\n const hasTransition = styles.transitionDuration !== '0s' && styles.transitionDuration !== '';\n if (!hasTransition) {\n return {\n x: rawX,\n y: rawY,\n data: DEFAULT_SIDES\n };\n }\n const offsetParent = await platform.getOffsetParent?.(floating);\n let offsetDimensions = {\n width: 0,\n height: 0\n };\n\n // For fixed strategy, prefer visualViewport if available\n if (strategy === 'fixed' && win?.visualViewport) {\n offsetDimensions = {\n width: win.visualViewport.width,\n height: win.visualViewport.height\n };\n } else if (offsetParent === win) {\n const doc = ownerDocument(floating);\n offsetDimensions = {\n width: doc.documentElement.clientWidth,\n height: doc.documentElement.clientHeight\n };\n } else if (await platform.isElement?.(offsetParent)) {\n offsetDimensions = await platform.getDimensions(offsetParent);\n }\n const currentSide = getSide(placement);\n let x = rawX;\n let y = rawY;\n if (currentSide === 'left') {\n x = offsetDimensions.width - (rawX + floatRect.width);\n }\n if (currentSide === 'top') {\n y = offsetDimensions.height - (rawY + floatRect.height);\n }\n const sideX = currentSide === 'left' ? 'right' : DEFAULT_SIDES.sideX;\n const sideY = currentSide === 'top' ? 'bottom' : DEFAULT_SIDES.sideY;\n return {\n x,\n y,\n data: {\n sideX,\n sideY\n }\n };\n }\n};","'use client';\n\nimport * as React from 'react';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useId } from '@base-ui/utils/useId';\nimport { inertValue } from '@base-ui/utils/inertValue';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { FocusGuard } from \"../../utils/FocusGuard.mjs\";\nimport { getNextTabbable, getPreviousTabbable, isOutsideEvent, contains } from \"../../floating-ui-react/utils.mjs\";\nimport { getEmptyRootContext } from \"../../floating-ui-react/utils/getEmptyRootContext.mjs\";\nimport { useNavigationMenuPositionerContext } from \"../positioner/NavigationMenuPositionerContext.mjs\";\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst EMPTY_ROOT_CONTEXT = getEmptyRootContext();\nfunction Guards({\n children\n}) {\n const {\n beforeInsideRef,\n beforeOutsideRef,\n afterInsideRef,\n afterOutsideRef,\n positionerElement,\n viewportElement,\n floatingRootContext\n } = useNavigationMenuRootContext();\n const hasPositioner = Boolean(useNavigationMenuPositionerContext(true));\n const referenceElement = positionerElement || viewportElement;\n if (!floatingRootContext && !hasPositioner) {\n return children;\n }\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(FocusGuard, {\n ref: beforeInsideRef,\n onFocus: event => {\n if (referenceElement && isOutsideEvent(event, referenceElement)) {\n getNextTabbable(referenceElement)?.focus();\n } else {\n beforeOutsideRef.current?.focus();\n }\n }\n }), children, /*#__PURE__*/_jsx(FocusGuard, {\n ref: afterInsideRef,\n onFocus: event => {\n if (referenceElement && isOutsideEvent(event, referenceElement)) {\n getPreviousTabbable(referenceElement)?.focus();\n } else {\n afterOutsideRef.current?.focus();\n }\n }\n })]\n });\n}\n\n/**\n * The clipping viewport of the navigation menu's current content.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuViewport = /*#__PURE__*/React.forwardRef(function NavigationMenuViewport(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n children,\n id: idProp,\n ...elementProps\n } = componentProps;\n const id = useId(idProp);\n const {\n setViewportElement,\n setViewportTargetElement,\n floatingRootContext,\n prevTriggerElementRef,\n viewportInert,\n setViewportInert\n } = useNavigationMenuRootContext();\n const positioning = useNavigationMenuPositionerContext(true);\n const hasPositioner = Boolean(positioning);\n const domReference = (floatingRootContext || EMPTY_ROOT_CONTEXT).useState('domReferenceElement');\n useIsoLayoutEffect(() => {\n if (domReference) {\n prevTriggerElementRef.current = domReference;\n }\n }, [domReference, prevTriggerElementRef]);\n const element = useRenderElement('div', componentProps, {\n ref: [forwardedRef, setViewportElement],\n props: [{\n id,\n onBlur(event) {\n const relatedTarget = event.relatedTarget;\n const currentTarget = event.currentTarget;\n\n // If focus is leaving the viewport and not going to the trigger, make it inert\n // to prevent a focus loop.\n if (relatedTarget && !contains(currentTarget, relatedTarget) && relatedTarget !== domReference) {\n setViewportInert(true);\n }\n },\n ...(!hasPositioner && viewportInert && {\n inert: inertValue(true)\n }),\n children: hasPositioner ? children : /*#__PURE__*/_jsx(Guards, {\n children: /*#__PURE__*/_jsx(\"div\", {\n ref: setViewportTargetElement,\n children: children\n })\n })\n }, elementProps]\n });\n return hasPositioner ? /*#__PURE__*/_jsx(Guards, {\n children: element\n }) : element;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuViewport.displayName = \"NavigationMenuViewport\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\n\n/**\n * A backdrop for the navigation menu popup.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuBackdrop = /*#__PURE__*/React.forwardRef(function NavigationMenuBackdrop(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n open,\n mounted,\n transitionStatus\n } = useNavigationMenuRootContext();\n const state = {\n open,\n transitionStatus\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: forwardedRef,\n props: [{\n role: 'presentation',\n hidden: !mounted,\n style: {\n userSelect: 'none',\n WebkitUserSelect: 'none'\n }\n }, elementProps],\n stateAttributesMapping: popupTransitionStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuBackdrop.displayName = \"NavigationMenuBackdrop\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { useBaseUiId } from \"../../internals/useBaseUiId.mjs\";\nimport { useNavigationMenuPositionerContext } from \"../positioner/NavigationMenuPositionerContext.mjs\";\nimport { useDirection } from \"../../internals/direction-context/DirectionContext.mjs\";\nimport { popupTransitionStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\n\n/**\n * A container for the navigation menu contents.\n * Renders a `<nav>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuPopup = /*#__PURE__*/React.forwardRef(function NavigationMenuPopup(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n id: idProp,\n ...elementProps\n } = componentProps;\n const {\n open,\n transitionStatus,\n setPopupElement\n } = useNavigationMenuRootContext();\n const positioning = useNavigationMenuPositionerContext();\n const direction = useDirection();\n const id = useBaseUiId(idProp);\n const state = {\n open,\n transitionStatus,\n side: positioning.side,\n align: positioning.align,\n anchorHidden: positioning.anchorHidden\n };\n\n // Ensure popup size transitions correctly when anchored to `bottom` (side=top) or `right` (side=left).\n let isPhysicalLeft = positioning.side === 'left';\n if (direction === 'rtl') {\n isPhysicalLeft = isPhysicalLeft || positioning.side === 'inline-end';\n } else {\n isPhysicalLeft = isPhysicalLeft || positioning.side === 'inline-start';\n }\n const isOriginSide = positioning.side === 'top' || isPhysicalLeft;\n const element = useRenderElement('nav', componentProps, {\n state,\n ref: [forwardedRef, setPopupElement],\n props: [{\n id,\n tabIndex: -1,\n style: isOriginSide ? {\n position: 'absolute',\n [positioning.side === 'top' ? 'bottom' : 'top']: '0',\n [isPhysicalLeft ? 'right' : 'left']: '0'\n } : {}\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping: popupTransitionStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuPopup.displayName = \"NavigationMenuPopup\";","'use client';\n\nimport * as React from 'react';\nimport { useNavigationMenuPositionerContext } from \"../positioner/NavigationMenuPositionerContext.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { popupStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { getDisabledMountTransitionStyles } from \"../../internals/getDisabledMountTransitionStyles.mjs\";\n\n/**\n * Displays an element pointing toward the navigation menu's current anchor.\n * Renders a `<div>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuArrow = /*#__PURE__*/React.forwardRef(function NavigationMenuArrow(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n open,\n transitionStatus\n } = useNavigationMenuRootContext();\n const {\n arrowRef,\n side,\n align,\n arrowUncentered,\n arrowStyles\n } = useNavigationMenuPositionerContext();\n const state = {\n open,\n side,\n align,\n uncentered: arrowUncentered\n };\n const element = useRenderElement('div', componentProps, {\n state,\n ref: [forwardedRef, arrowRef],\n props: [{\n style: arrowStyles,\n 'aria-hidden': true\n }, getDisabledMountTransitionStyles(transitionStatus), elementProps],\n stateAttributesMapping: popupStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuArrow.displayName = \"NavigationMenuArrow\";","'use client';\n\nimport * as React from 'react';\nimport { useFloatingTree } from \"../../floating-ui-react/index.mjs\";\nimport { useNavigationMenuRootContext, useNavigationMenuTreeContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { isOutsideMenuEvent } from \"../utils/isOutsideMenuEvent.mjs\";\nimport { CompositeItem } from \"../../internals/composite/item/CompositeItem.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\n\n/**\n * A link in the navigation menu that can be used to navigate to a different page or section.\n * Renders an `<a>` element.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const NavigationMenuLink = /*#__PURE__*/React.forwardRef(function NavigationMenuLink(componentProps, forwardedRef) {\n const {\n className,\n render,\n active = false,\n closeOnClick = false,\n style,\n ...elementProps\n } = componentProps;\n const {\n setValue,\n popupElement,\n positionerElement,\n rootRef\n } = useNavigationMenuRootContext();\n const nodeId = useNavigationMenuTreeContext();\n const tree = useFloatingTree();\n const state = {\n active\n };\n const defaultProps = {\n 'aria-current': active ? 'page' : undefined,\n tabIndex: undefined,\n onClick(event) {\n if (closeOnClick) {\n setValue(null, createChangeEventDetails(REASONS.linkPress, event.nativeEvent));\n }\n },\n onBlur(event) {\n if (positionerElement && popupElement && isOutsideMenuEvent({\n currentTarget: event.currentTarget,\n relatedTarget: event.relatedTarget\n }, {\n popupElement,\n rootRef,\n tree,\n nodeId\n })) {\n setValue(null, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n }\n }\n };\n return /*#__PURE__*/_jsx(CompositeItem, {\n tag: \"a\",\n render: render,\n className: className,\n style: style,\n state: state,\n refs: [forwardedRef],\n props: [defaultProps, elementProps]\n });\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuLink.displayName = \"NavigationMenuLink\";","'use client';\n\nimport * as React from 'react';\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { useNavigationMenuRootContext } from \"../root/NavigationMenuRootContext.mjs\";\nimport { triggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { useNavigationMenuItemContext } from \"../item/NavigationMenuItemContext.mjs\";\n\n/**\n * An icon that indicates that the trigger button opens a menu.\n *\n * Documentation: [Base UI Navigation Menu](https://base-ui.com/react/components/navigation-menu)\n */\nexport const NavigationMenuIcon = /*#__PURE__*/React.forwardRef(function NavigationMenuIcon(componentProps, forwardedRef) {\n const {\n render,\n className,\n style,\n ...elementProps\n } = componentProps;\n const {\n value: itemValue\n } = useNavigationMenuItemContext();\n const {\n open,\n value\n } = useNavigationMenuRootContext();\n const isActiveItem = open && value === itemValue;\n const state = {\n open: isActiveItem\n };\n const element = useRenderElement('span', componentProps, {\n state,\n ref: forwardedRef,\n props: [{\n 'aria-hidden': true,\n children: '▼'\n }, elementProps],\n stateAttributesMapping: triggerOpenStateMapping\n });\n return element;\n});\nif (process.env.NODE_ENV !== \"production\") NavigationMenuIcon.displayName = \"NavigationMenuIcon\";","\"use client\";\nimport * as React from \"react\";\nimport { NavigationMenu as NavigationMenuPrimitive } from \"@base-ui/react/navigation-menu\";\nimport { cx } from \"class-variance-authority\";\n\nimport { ChevronDown } from \"../../icons/ChevronDown\";\nimport \"./NavigationMenu.css\";\n\n// ── Root ─────────────────────────────────────────────────────────────────────\n// Wraps NavigationMenu.Root + the portal/positioner/popup/viewport so consumers\n// don't have to wire up the portal separately.\n// The portal renders at document.body by default (Base UI default) — pass\n// `container` (e.g. a Shadow Root) to redirect it, same pattern as\n// SelectContent's `container` prop.\n\nexport interface NavigationMenuProps\n extends NavigationMenuPrimitive.Root.Props {\n className?: string;\n positionerProps?: Partial<NavigationMenuPrimitive.Positioner.Props>;\n container?: HTMLElement | ShadowRoot | null;\n}\n\nexport function NavigationMenu({\n className,\n children,\n positionerProps,\n container,\n ...props\n}: NavigationMenuProps) {\n return (\n <NavigationMenuPrimitive.Root\n data-slot=\"navigation-menu\"\n className={cx(\"eg-nav-menu\", className)}\n {...props}\n >\n {children}\n <NavigationMenuPrimitive.Portal {...(container != null ? { container } : {})}>\n <NavigationMenuPrimitive.Positioner\n className=\"eg-nav-menu__positioner\"\n sideOffset={4}\n {...positionerProps}\n >\n <NavigationMenuPrimitive.Popup className=\"eg-nav-menu__popup\">\n <NavigationMenuPrimitive.Viewport className=\"eg-nav-menu__viewport\" />\n </NavigationMenuPrimitive.Popup>\n </NavigationMenuPrimitive.Positioner>\n </NavigationMenuPrimitive.Portal>\n </NavigationMenuPrimitive.Root>\n );\n}\n\n// ── List ──────────────────────────────────────────────────────────────────────\nexport interface NavigationMenuListProps\n extends NavigationMenuPrimitive.List.Props {\n className?: string;\n}\n\nexport function NavigationMenuList({\n className,\n ...props\n}: NavigationMenuListProps) {\n return (\n <NavigationMenuPrimitive.List\n data-slot=\"navigation-menu-list\"\n className={cx(\"eg-nav-menu__list\", className)}\n {...props}\n />\n );\n}\n\n// ── Item ──────────────────────────────────────────────────────────────────────\nexport interface NavigationMenuItemProps\n extends NavigationMenuPrimitive.Item.Props {\n className?: string;\n}\n\nexport function NavigationMenuItem({\n className,\n ...props\n}: NavigationMenuItemProps) {\n return (\n <NavigationMenuPrimitive.Item\n data-slot=\"navigation-menu-item\"\n className={cx(\"eg-nav-menu__item\", className)}\n {...props}\n />\n );\n}\n\n// ── Trigger ───────────────────────────────────────────────────────────────────\n// Maps to _M_HeaderNavItem: leading icon slot, label text (children), trailing\n// chevron (auto-rendered), optional notification badge.\n// States (hover, focus, open=data-popup-open, disabled) are pure CSS.\n\nexport interface NavigationMenuTriggerProps\n extends Omit<NavigationMenuPrimitive.Trigger.Props, \"className\"> {\n className?: string;\n leadingIcon?: React.ReactNode;\n badge?: number | string;\n}\n\nexport function NavigationMenuTrigger({\n className,\n leadingIcon,\n badge,\n disabled,\n children,\n ...props\n}: NavigationMenuTriggerProps) {\n return (\n <NavigationMenuPrimitive.Trigger\n data-slot=\"navigation-menu-trigger\"\n data-disabled={disabled || undefined}\n disabled={disabled}\n className={cx(\"eg-nav-menu__trigger\", className)}\n {...props}\n >\n {leadingIcon != null && (\n <span className=\"eg-nav-menu__trigger-icon\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n <span className=\"eg-nav-menu__trigger-label\">{children}</span>\n <span className=\"eg-nav-menu__trigger-chevron\" aria-hidden=\"true\">\n <ChevronDown />\n </span>\n {badge != null && (\n <span className=\"eg-nav-menu__badge\" aria-label={`${badge} notifications`}>\n {badge}\n </span>\n )}\n </NavigationMenuPrimitive.Trigger>\n );\n}\n\n// ── Anchor ────────────────────────────────────────────────────────────────────\n// Top-level nav link without a dropdown — renders as <a> with trigger styling.\n// Use inside NavigationMenuItem when a direct navigation link is needed (no\n// Trigger + Content pair). Supports an optional leading icon; no chevron.\n\nexport interface NavigationMenuAnchorProps\n extends Omit<NavigationMenuPrimitive.Link.Props, \"className\"> {\n className?: string;\n leadingIcon?: React.ReactNode;\n}\n\nexport function NavigationMenuAnchor({\n className,\n leadingIcon,\n children,\n ...props\n}: NavigationMenuAnchorProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot=\"navigation-menu-anchor\"\n className={cx(\"eg-nav-menu__trigger\", \"eg-nav-menu__anchor\", className)}\n {...props}\n >\n {leadingIcon != null && (\n <span className=\"eg-nav-menu__trigger-icon\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n <span className=\"eg-nav-menu__trigger-label\">{children}</span>\n </NavigationMenuPrimitive.Link>\n );\n}\n\n// ── Content ───────────────────────────────────────────────────────────────────\n// Per-item panel rendered inside the shared Viewport.\n// Place NavigationMenuLink components directly inside.\n\nexport interface NavigationMenuContentProps\n extends NavigationMenuPrimitive.Content.Props {\n className?: string;\n}\n\nexport function NavigationMenuContent({\n className,\n ...props\n}: NavigationMenuContentProps) {\n return (\n <NavigationMenuPrimitive.Content\n data-slot=\"navigation-menu-content\"\n className={cx(\"eg-nav-menu__content\", className)}\n {...props}\n />\n );\n}\n\n// ── Link ──────────────────────────────────────────────────────────────────────\n// Maps to _M_HeaderNavListItem: icon slots, label (children), active state.\n// Pass `active` when this item is the current page (adds left Royal Blue border).\n\nexport interface NavigationMenuLinkProps\n extends Omit<NavigationMenuPrimitive.Link.Props, \"className\"> {\n className?: string;\n leadingIcon?: React.ReactNode;\n trailingIcon?: React.ReactNode;\n active?: boolean;\n}\n\nexport function NavigationMenuLink({\n className,\n leadingIcon,\n trailingIcon,\n active,\n children,\n ...props\n}: NavigationMenuLinkProps) {\n return (\n <NavigationMenuPrimitive.Link\n data-slot=\"navigation-menu-link\"\n className={cx(\"eg-nav-menu__link\", active && \"eg-nav-menu__link--active\", className)}\n {...props}\n >\n {leadingIcon != null && (\n <span className=\"eg-nav-menu__link-icon\" aria-hidden=\"true\">\n {leadingIcon}\n </span>\n )}\n {children}\n {trailingIcon != null && (\n <span className=\"eg-nav-menu__link-icon\" aria-hidden=\"true\">\n {trailingIcon}\n </span>\n )}\n </NavigationMenuPrimitive.Link>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/document.\nexport function Document(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.85 4.65L9.35 1.15C9.25 1.05 9.15 1 9 1H4C3.45 1 3 1.45 3 2V14C3 14.55 3.45 15 4 15H12C12.55 15 13 14.55 13 14V5C13 4.85 12.95 4.75 12.85 4.65ZM9 2.2L11.8 5H9V2.2ZM12 14H4V2H8V5C8 5.55 8.45 6 9 6H12V14ZM5 11V12H11V11H5ZM5 9V8H11V9H5Z\"\n />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/search.\nexport function Search(props: IconProps) {\n return (\n <IconBase {...props}>\n <path d=\"M14.5 13.7929L10.7239 10.0169C11.6313 8.92758 12.0838 7.53038 11.9872 6.11596C11.8907 4.70153 11.2525 3.37879 10.2055 2.42288C9.15855 1.46698 7.78335 0.951515 6.366 0.983723C4.94865 1.01593 3.59828 1.59333 2.59581 2.59581C1.59333 3.59828 1.01593 4.94865 0.983723 6.366C0.951515 7.78335 1.46698 9.15855 2.42288 10.2055C3.37879 11.2525 4.70153 11.8907 6.11596 11.9872C7.53038 12.0838 8.92758 11.6313 10.0169 10.7239L13.7929 14.5L14.5 13.7929ZM2 6.5C2 5.60998 2.26392 4.73995 2.75838 3.99993C3.25285 3.25991 3.95565 2.68313 4.77792 2.34254C5.60019 2.00194 6.50499 1.91283 7.3779 2.08646C8.25082 2.2601 9.05264 2.68868 9.68198 3.31802C10.3113 3.94735 10.7399 4.74918 10.9135 5.62209C11.0872 6.495 10.998 7.3998 10.6575 8.22207C10.3169 9.04434 9.74008 9.74714 9.00006 10.2416C8.26004 10.7361 7.39001 11 6.5 11C5.30693 10.9987 4.1631 10.5241 3.31948 9.68052C2.47585 8.83689 2.00132 7.69306 2 6.5Z\" />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/send.\nexport function Send(props: IconProps) {\n return (\n <IconBase {...props}>\n <path d=\"M13.725 7.555L2.725 2.055C2.63879 2.01189 2.54195 1.99461 2.44614 2.00526C2.35034 2.0159 2.25965 2.05401 2.185 2.115C2.11372 2.17475 2.06051 2.2532 2.03136 2.34153C2.00221 2.42985 1.99828 2.52456 2.02 2.615L3.5 8L2 13.37C1.97962 13.4455 1.97724 13.5248 1.99306 13.6014C2.00887 13.678 2.04245 13.7499 2.09108 13.8111C2.13972 13.8724 2.20205 13.9214 2.27307 13.9542C2.34409 13.987 2.42182 14.0027 2.5 14C2.57827 13.9995 2.65534 13.9807 2.725 13.945L13.725 8.445C13.8069 8.40304 13.8756 8.3393 13.9236 8.26078C13.9716 8.18226 13.997 8.09203 13.997 8C13.997 7.90798 13.9716 7.81774 13.9236 7.73923C13.8756 7.66071 13.8069 7.59696 13.725 7.555ZM3.275 12.555L4.38 8.5H9V7.5H4.38L3.275 3.445L12.38 8L3.275 12.555Z\" />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/settings.\nexport function Settings(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M13.5 7.99996V8.37996L14.445 9.24496C14.6194 9.3979 14.7353 9.60672 14.7727 9.83568C14.8101 10.0646 14.7667 10.2995 14.65 10.5L13.51 12.5C13.4223 12.6518 13.2962 12.778 13.1444 12.8657C12.9926 12.9535 12.8204 12.9998 12.645 13C12.5363 13.0008 12.4282 12.9839 12.325 12.95L11.115 12.54C10.9035 12.6794 10.683 12.8047 10.455 12.915L10.2 14.175C10.1543 14.4052 10.029 14.6119 9.84623 14.7591C9.66341 14.9063 9.43466 14.9845 9.2 14.98H6.84C6.60535 14.9845 6.3766 14.9063 6.19378 14.7591C6.01096 14.6119 5.88573 14.4052 5.84 14.175L5.585 12.915C5.35859 12.8046 5.13977 12.6794 4.93 12.54L3.715 12.95C3.61176 12.9839 3.50368 13.0008 3.395 13C3.21964 12.9998 3.04741 12.9535 2.89559 12.8657C2.74376 12.778 2.61769 12.6518 2.53 12.5L1.35 10.5C1.22795 10.2975 1.18158 10.0583 1.2191 9.82493C1.25663 9.59152 1.37564 9.37896 1.555 9.22496L2.5 8.38496V7.99996V7.61996L1.555 6.75496C1.38057 6.60202 1.26473 6.39319 1.22733 6.16424C1.18993 5.93529 1.2333 5.70045 1.35 5.49996L2.53 3.49996C2.61769 3.34809 2.74376 3.22195 2.89559 3.13419C3.04741 3.04643 3.21964 3.00014 3.395 2.99996C3.50259 2.99264 3.61065 3.00277 3.715 3.02996L4.905 3.45996C5.11649 3.32053 5.33697 3.19526 5.565 3.08496L5.82 1.82496C5.86573 1.59476 5.99096 1.38798 6.17378 1.24081C6.3566 1.09364 6.58535 1.01546 6.82 1.01996H9.16C9.39466 1.01546 9.62341 1.09364 9.80623 1.24081C9.98905 1.38798 10.1143 1.59476 10.16 1.82496L10.415 3.08496C10.6414 3.19529 10.8602 3.32056 11.07 3.45996L12.285 3.04996C12.3882 3.01601 12.4963 2.99913 12.605 2.99996C12.7804 3.00014 12.9526 3.04643 13.1044 3.13419C13.2562 3.22195 13.3823 3.34809 13.47 3.49996L14.65 5.49996C14.7738 5.70075 14.8226 5.93885 14.7879 6.17216C14.7531 6.40547 14.637 6.61898 14.46 6.77496L13.5 7.61496V7.99996ZM10.89 11.42L12.605 12L13.785 9.99996L12.425 8.76496C12.5175 8.24739 12.5175 7.71753 12.425 7.19996L13.785 5.99996L12.605 3.99996L10.885 4.55996C10.4821 4.22453 10.0258 3.95917 9.535 3.77496L9.18 1.99996H6.82L6.465 3.79496C5.97031 3.97409 5.51147 4.23991 5.11 4.57996L3.395 3.99996L2.215 5.99996L3.575 7.23496C3.48255 7.75253 3.48255 8.28239 3.575 8.79996L2.215 9.99996L3.395 12L5.115 11.44C5.51786 11.7754 5.97422 12.0407 6.465 12.225L6.82 14H9.18L9.535 12.205C10.0297 12.0258 10.4885 11.76 10.89 11.42ZM6.33329 10.4944C6.82664 10.8241 7.40666 11 8 11C8.39508 11.004 8.78699 10.9292 9.15278 10.7798C9.51857 10.6305 9.85088 10.4096 10.1303 10.1303C10.4096 9.85088 10.6305 9.51857 10.7798 9.15278C10.9292 8.78699 11.004 8.39508 11 8C11 7.40666 10.8241 6.82664 10.4944 6.33329C10.1648 5.83994 9.69623 5.45543 9.14805 5.22836C8.59987 5.0013 7.99667 4.94189 7.41473 5.05765C6.83279 5.1734 6.29824 5.45912 5.87868 5.87868C5.45912 6.29824 5.1734 6.83279 5.05765 7.41473C4.94189 7.99667 5.0013 8.59987 5.22836 9.14805C5.45543 9.69623 5.83994 10.1648 6.33329 10.4944ZM7.22741 6.1397C7.47284 6.04137 7.73567 5.99384 8 6C8.26433 5.99384 8.52716 6.04137 8.77259 6.1397C9.01803 6.23803 9.24097 6.38512 9.42793 6.57208C9.61488 6.75904 9.76198 6.98197 9.86031 7.22741C9.95864 7.47284 10.0062 7.73567 10 8C10.0062 8.26433 9.95864 8.52716 9.86031 8.77259C9.76198 9.01803 9.61488 9.24097 9.42793 9.42793C9.24097 9.61488 9.01803 9.76198 8.77259 9.86031C8.52716 9.95864 8.26433 10.0062 8 10C7.73567 10.0062 7.47284 9.95864 7.22741 9.86031C6.98197 9.76198 6.75904 9.61488 6.57208 9.42793C6.38512 9.24097 6.23803 9.01803 6.1397 8.77259C6.04137 8.52716 5.99384 8.26433 6 8C5.99384 7.73567 6.04137 7.47284 6.1397 7.22741C6.23803 6.98197 6.38512 6.75904 6.57208 6.57208C6.75904 6.38512 6.98197 6.23803 7.22741 6.1397Z\"\n />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/star.\nexport function Star(props: IconProps) {\n return (\n <IconBase {...props}>\n <path d=\"M8.00001 3.26L9.38001 6.05L9.61001 6.55L10.11 6.625L13.19 7.07L11 9.22L10.625 9.585L10.715 10.085L11.24 13.15L8.48501 11.705L8.00001 11.5L7.53501 11.745L4.78001 13.17L5.28001 10.105L5.37001 9.605L5.00001 9.22L2.79001 7.045L5.87001 6.6L6.37001 6.525L6.60001 6.025L8.00001 3.26ZM8.00001 1L5.72501 5.61L0.640015 6.345L4.32001 9.935L3.45001 15L8.00001 12.61L12.55 15L11.68 9.935L15.36 6.35L10.275 5.61L8.00001 1Z\" />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/user-add.\nexport function UserAdd(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M6 2C6.49445 2 6.9778 2.14662 7.38893 2.42133C7.80005 2.69603 8.12048 3.08648 8.3097 3.54329C8.49892 4.00011 8.54843 4.50277 8.45196 4.98773C8.3555 5.47268 8.1174 5.91814 7.76777 6.26777C7.41814 6.6174 6.97268 6.8555 6.48773 6.95196C6.00278 7.04843 5.50011 6.99892 5.04329 6.8097C4.58648 6.62048 4.19603 6.30005 3.92133 5.88893C3.64662 5.4778 3.5 4.99445 3.5 4.5C3.5 3.83696 3.76339 3.20107 4.23223 2.73223C4.70108 2.26339 5.33696 2 6 2ZM6 1C5.30777 1 4.63108 1.20527 4.05551 1.58986C3.47993 1.97444 3.03133 2.52107 2.76642 3.16061C2.50152 3.80015 2.4322 4.50388 2.56725 5.18282C2.7023 5.86175 3.03564 6.48539 3.52513 6.97487C4.01461 7.46436 4.63825 7.7977 5.31719 7.93275C5.99612 8.0678 6.69985 7.99848 7.33939 7.73358C7.97894 7.46867 8.52556 7.02007 8.91015 6.4445C9.29473 5.86892 9.5 5.19223 9.5 4.5C9.5 3.57174 9.13125 2.6815 8.47487 2.02513C7.8185 1.36875 6.92826 1 6 1ZM16 7H14V5H13V7H11V8H13V10H14V8H16V7ZM10 15H11V12.5C11 11.5717 10.6313 10.6815 9.97487 10.0251C9.3185 9.36875 8.42826 9 7.5 9H4.5C3.57174 9 2.6815 9.36875 2.02513 10.0251C1.36875 10.6815 1 11.5717 1 12.5V15H2V12.5C2 11.837 2.26339 11.2011 2.73223 10.7322C3.20107 10.2634 3.83696 10 4.5 10H7.5C8.16304 10 8.79893 10.2634 9.26777 10.7322C9.73661 11.2011 10 11.837 10 12.5V15Z\"\n />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/login.\nexport function Login(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M7 15H13C13.2652 15 13.5196 14.8946 13.7071 14.7071C13.8946 14.5196 14 14.2652 14 14V2C14 1.73478 13.8946 1.48043 13.7071 1.29289C13.5196 1.10536 13.2652 1 13 1H7C6.73478 1 6.48043 1.10536 6.29289 1.29289C6.10536 1.48043 6 1.73478 6 2V3.5H7V2H13V14H7V12.5H6V14C6 14.2652 6.10536 14.5196 6.29289 14.7071C6.48043 14.8946 6.73478 15 7 15ZM9.085 8.5L7.295 10.295L8 11L11 8L8 5L7.295 5.705L9.085 7.5H2V8.5H9.085Z\"\n />\n </IconBase>\n );\n}\n","import { IconBase, type IconProps } from \"./icon-base\";\n\n// Generated from Figma icon/logout.\nexport function Logout(props: IconProps) {\n return (\n <IconBase {...props}>\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M9 15H3C2.73488 14.9997 2.4807 14.8942 2.29323 14.7068C2.10576 14.5193 2.0003 14.2651 2 14V2C2.0003 1.73488 2.10576 1.4807 2.29323 1.29323C2.4807 1.10576 2.73488 1.0003 3 1H9C9.26512 1.0003 9.5193 1.10576 9.70677 1.29323C9.89424 1.4807 9.9997 1.73488 10 2V3.5H9V2H3V14H9V12.5H10V14C9.9997 14.2651 9.89424 14.5193 9.70677 14.7068C9.5193 14.8942 9.26512 14.9997 9 15ZM12.086 8.5L10.293 10.293L11 11L14 8L11 5L10.293 5.707L12.086 7.5H5V8.5H12.086Z\"\n />\n </IconBase>\n );\n}\n","import { useId } from \"react\";\nimport { BrandBase, type BrandProps } from \"./brand-base\";\n\n// Generated from svg-logos/easygov-logo.svg\nexport function BrandEasygov(props: BrandProps) {\n const uid = useId();\n return (\n <BrandBase viewBox=\"0 0 356 86\" {...props}>\n <g clipPath={`url(#${uid}c0)`}>\n <path\n d=\"M33.6 36.5151C33.4 30.13 29.4 26.5383 24 26.5383C17.8 26.5383 13.6 30.3295 12.6 36.5151H33.6ZM24.4 17.3596C38.2 17.3596 45.6 27.3364 45.6 40.1068C45.6 41.5035 45.4 44.6961 45.4 44.6961H12.2C13 53.0766 19.4 57.4664 26.6 57.4664C34.4 57.4664 40.4 52.2784 40.4 52.2784L45 60.8585C45 60.8585 37.6 67.6427 25.8 67.6427C9.8 67.4432 0 55.8701 0 42.3016C0 27.536 10 17.3596 24.4 17.3596Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M69.8 58.065C76.2 58.065 80.6 51.2808 80.6 45.4942V44.297H78.6C72.4 44.297 62.6 45.0951 62.6 51.8794C62.6 55.0719 65 58.065 69.8 58.065ZM79 36.3156H80.6V35.717C80.6 29.3318 76.6 27.3364 71.4 27.3364C64.6 27.3364 58.2 31.9258 58.2 31.9258L53.6 23.3457C53.6 23.3457 61 17.3596 72.4 17.3596C85 17.3596 92.4 24.3434 92.4 36.5151V66.4455H81.4V62.4548C81.4 60.659 81.6 59.0627 81.6 59.0627H81.4C81.4 59.0627 77.8 67.4432 66.8 67.4432C58.2 67.4432 50.6 62.0557 50.6 52.478C50.6 37.3132 71.2 36.3156 79 36.3156Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M105.4 52.0789C105.4 52.0789 110.6 57.2668 118.4 57.2668C121.8 57.2668 124.8 55.6705 124.8 52.877C124.8 45.6937 101.4 46.6914 101.4 31.3271C101.4 22.348 109.4 17.1601 119.8 17.1601C130.6 17.1601 135.8 22.5476 135.8 22.5476L131.4 31.3271C131.4 31.3271 127 27.1369 119.6 27.1369C116.4 27.1369 113.4 28.5336 113.4 31.5267C113.4 38.3109 136.8 37.5128 136.8 52.877C136.8 60.8585 129.8 67.2436 118.4 67.2436C106.4 67.2436 99.8 60.2599 99.8 60.2599L105.4 52.0789Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M143 74.0278C143 74.0278 145.6 76.0232 148.4 76.0232C151.6 76.0232 154.8 74.0278 156.6 69.8376L158.4 65.6473L138.2 18.3573H151.6L161.6 45.8933C162.6 48.4872 163.4 52.2784 163.4 52.2784H163.6C163.6 52.2784 164.4 48.4872 165.2 45.8933L174.6 18.1578H187.6L166.2 73.4292C162.8 82.2088 156.2 86 148.8 86C143 86 138.8 82.8074 138.8 82.8074L143 74.0278Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M225.6 41.3039C225.6 30.3295 220.2 27.536 213.8 27.536C206.6 27.536 202.6 32.7239 202.6 40.9049C202.6 49.2854 207 55.471 214.6 55.471C220.2 55.2715 225.6 52.0789 225.6 41.3039ZM211.8 75.8237C219.2 75.8237 225.4 72.6311 225.4 64.2506V61.4571C225.4 60.2599 225.6 58.8631 225.6 58.8631H225.4C222.6 63.0534 218.4 65.2483 212 65.2483C198.2 65.2483 190.4 54.0742 190.4 41.1044C190.4 27.935 197.8 17.1601 211.6 17.1601C222 17.1601 225.8 23.3457 225.8 23.3457H226C226 23.3457 226 22.7471 226 21.949V18.3573H237.2V63.2529C237.2 79.6148 224.4 85.8005 211.8 85.8005C205.8 85.8005 199.4 84.2042 194.8 81.6102L198.4 72.4316C198.4 72.8306 204.6 75.8237 211.8 75.8237Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M272.4 57.2668C280.2 57.2668 286.6 51.2808 286.6 42.3016C286.6 33.5221 280.2 27.3364 272.4 27.3364C264.6 27.3364 258 33.5221 258 42.3016C258 51.2808 264.6 57.2668 272.4 57.2668ZM272.2 17.3596C286.8 17.3596 298.6 27.7355 298.6 42.5012C298.6 57.2668 286.8 67.6427 272.2 67.6427C257.6 67.6427 245.8 57.2668 245.8 42.5012C246 27.7355 257.6 17.3596 272.2 17.3596Z\"\n fill=\"#1D1D1F\"\n />\n <path\n d=\"M300.8 18.3573H313.4L323.4 48.0882C324.4 50.8817 325 55.2715 325 55.2715H325.2C325.2 55.2715 326 50.8817 326.8 48.0882L342.8 0H355.4L332.2 66.2459H318L300.8 18.3573Z\"\n fill=\"#FF2D16\"\n />\n </g>\n <defs>\n <clipPath id={`${uid}c0`}>\n <rect width=\"356\" height=\"86\" fill=\"white\" />\n </clipPath>\n </defs>\n </BrandBase>\n );\n}\n","export class InvalidTokenError extends Error {\n}\nInvalidTokenError.prototype.name = \"InvalidTokenError\";\nfunction b64DecodeUnicode(str) {\n return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {\n let code = p.charCodeAt(0).toString(16).toUpperCase();\n if (code.length < 2) {\n code = \"0\" + code;\n }\n return \"%\" + code;\n }));\n}\nfunction base64UrlDecode(str) {\n let output = str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n switch (output.length % 4) {\n case 0:\n break;\n case 2:\n output += \"==\";\n break;\n case 3:\n output += \"=\";\n break;\n default:\n throw new Error(\"base64 string is not of the correct length\");\n }\n try {\n return b64DecodeUnicode(output);\n }\n catch (err) {\n return atob(output);\n }\n}\nexport function jwtDecode(token, options) {\n if (typeof token !== \"string\") {\n throw new InvalidTokenError(\"Invalid token specified: must be a string\");\n }\n options || (options = {});\n const pos = options.header === true ? 0 : 1;\n const part = token.split(\".\")[pos];\n if (typeof part !== \"string\") {\n throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);\n }\n let decoded;\n try {\n decoded = base64UrlDecode(part);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);\n }\n try {\n return JSON.parse(decoded);\n }\n catch (e) {\n throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\n/**\n * Native interface\n *\n * @public\n */\nexport interface ILogger {\n debug(...args: unknown[]): void;\n info(...args: unknown[]): void;\n warn(...args: unknown[]): void;\n error(...args: unknown[]): void;\n}\n\nconst nopLogger: ILogger = {\n debug: () => undefined,\n info: () => undefined,\n warn: () => undefined,\n error: () => undefined,\n};\n\nlet level: number;\nlet logger: ILogger;\n\n/**\n * Log levels\n *\n * @public\n */\nexport enum Log {\n NONE,\n ERROR,\n WARN,\n INFO,\n DEBUG\n}\n\n/**\n * Log manager\n *\n * @public\n */\nexport namespace Log { // eslint-disable-line @typescript-eslint/no-namespace\n export function reset(): void {\n level = Log.INFO;\n logger = nopLogger;\n }\n\n export function setLevel(value: Log): void {\n if (!(Log.NONE <= value && value <= Log.DEBUG)) {\n throw new Error(\"Invalid log level\");\n }\n level = value;\n }\n\n export function setLogger(value: ILogger): void {\n logger = value;\n }\n}\n\n/**\n * Internal logger instance\n *\n * @public\n */\nexport class Logger {\n private _method?: string;\n public constructor(private _name: string) {}\n\n /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n public debug(...args: unknown[]): void {\n if (level >= Log.DEBUG) {\n logger.debug(Logger._format(this._name, this._method), ...args);\n }\n }\n public info(...args: unknown[]): void {\n if (level >= Log.INFO) {\n logger.info(Logger._format(this._name, this._method), ...args);\n }\n }\n public warn(...args: unknown[]): void {\n if (level >= Log.WARN) {\n logger.warn(Logger._format(this._name, this._method), ...args);\n }\n }\n public error(...args: unknown[]): void {\n if (level >= Log.ERROR) {\n logger.error(Logger._format(this._name, this._method), ...args);\n }\n }\n /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */\n\n public throw(err: Error): never {\n this.error(err);\n throw err;\n }\n\n public create(method: string): Logger {\n const methodLogger: Logger = Object.create(this);\n methodLogger._method = method;\n methodLogger.debug(\"begin\");\n return methodLogger;\n }\n\n public static createStatic(name: string, staticMethod: string): Logger {\n const staticLogger = new Logger(`${name}.${staticMethod}`);\n staticLogger.debug(\"begin\");\n return staticLogger;\n }\n\n private static _format(name: string, method?: string) {\n const prefix = `[${name}]`;\n return method ? `${prefix} ${method}:` : prefix;\n }\n\n /* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */\n // helpers for static class methods\n public static debug(name: string, ...args: unknown[]): void {\n if (level >= Log.DEBUG) {\n logger.debug(Logger._format(name), ...args);\n }\n }\n public static info(name: string, ...args: unknown[]): void {\n if (level >= Log.INFO) {\n logger.info(Logger._format(name), ...args);\n }\n }\n public static warn(name: string, ...args: unknown[]): void {\n if (level >= Log.WARN) {\n logger.warn(Logger._format(name), ...args);\n }\n }\n public static error(name: string, ...args: unknown[]): void {\n if (level >= Log.ERROR) {\n logger.error(Logger._format(name), ...args);\n }\n }\n /* eslint-enable @typescript-eslint/no-unsafe-enum-comparison */\n}\n\nLog.reset();\n","import { jwtDecode } from \"jwt-decode\";\n\nimport { Logger } from \"./Logger\";\nimport type { JwtClaims } from \"../Claims\";\nimport { CryptoUtils } from \"./CryptoUtils\";\n\n/**\n * @internal\n */\nexport class JwtUtils {\n // IMPORTANT: doesn't validate the token\n public static decode(token: string): JwtClaims {\n try {\n return jwtDecode<JwtClaims>(token);\n }\n catch (err) {\n Logger.error(\"JwtUtils.decode\", err);\n throw err;\n }\n }\n\n public static async generateSignedJwt(header: object, payload: object, privateKey: CryptoKey) : Promise<string> {\n const encodedHeader = CryptoUtils.encodeBase64Url(new TextEncoder().encode(JSON.stringify(header)));\n const encodedPayload = CryptoUtils.encodeBase64Url(new TextEncoder().encode(JSON.stringify(payload)));\n const encodedToken = `${encodedHeader}.${encodedPayload}`;\n\n const signature = await window.crypto.subtle.sign(\n {\n name: \"ECDSA\",\n hash: { name: \"SHA-256\" },\n },\n privateKey,\n new TextEncoder().encode(encodedToken),\n );\n\n const encodedSignature = CryptoUtils.encodeBase64Url(new Uint8Array(signature));\n return `${encodedToken}.${encodedSignature}`;\n }\n\n public static async generateSignedJwtWithHmac(header: object, payload: object, secretKey: CryptoKey): Promise<string> {\n const encodedHeader = CryptoUtils.encodeBase64Url(new TextEncoder().encode(JSON.stringify(header)));\n const encodedPayload = CryptoUtils.encodeBase64Url(new TextEncoder().encode(JSON.stringify(payload)));\n const encodedToken = `${encodedHeader}.${encodedPayload}`;\n\n const signature = await window.crypto.subtle.sign(\n \"HMAC\",\n secretKey,\n new TextEncoder().encode(encodedToken),\n );\n\n const encodedSignature = CryptoUtils.encodeBase64Url(new Uint8Array(signature));\n return `${encodedToken}.${encodedSignature}`;\n }\n}\n","import { Logger } from \"./Logger\";\nimport { JwtUtils } from \"./JwtUtils\";\n\nexport interface GenerateDPoPProofOpts {\n url: string;\n accessToken?: string;\n httpMethod?: string;\n keyPair: CryptoKeyPair;\n nonce?: string;\n}\n\nconst UUID_V4_TEMPLATE = \"10000000-1000-4000-8000-100000000000\";\n\nconst toBase64 = (val: ArrayBuffer | Uint8Array): string =>\n btoa([...new Uint8Array(val)]\n .map((chr) => String.fromCharCode(chr))\n .join(\"\"));\n\n/**\n * @internal\n */\nexport class CryptoUtils {\n private static _randomWord(): number {\n const arr = new Uint32Array(1);\n crypto.getRandomValues(arr);\n return arr[0];\n }\n\n /**\n * Generates RFC4122 version 4 guid\n */\n public static generateUUIDv4(): string {\n const uuid = UUID_V4_TEMPLATE.replace(/[018]/g, c =>\n (+c ^ CryptoUtils._randomWord() & 15 >> +c / 4).toString(16),\n );\n return uuid.replace(/-/g, \"\");\n }\n\n /**\n * PKCE: Generate a code verifier\n */\n public static generateCodeVerifier(): string {\n return CryptoUtils.generateUUIDv4() + CryptoUtils.generateUUIDv4() + CryptoUtils.generateUUIDv4();\n }\n\n /**\n * PKCE: Generate a code challenge\n */\n public static async generateCodeChallenge(code_verifier: string): Promise<string> {\n if (!crypto.subtle) {\n throw new Error(\"Crypto.subtle is available only in secure contexts (HTTPS).\");\n }\n\n try {\n const encoder = new TextEncoder();\n const data = encoder.encode(code_verifier);\n const hashed = await crypto.subtle.digest(\"SHA-256\", data);\n return toBase64(hashed).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n }\n catch (err) {\n Logger.error(\"CryptoUtils.generateCodeChallenge\", err);\n throw err;\n }\n }\n\n /**\n * Generates a base64-encoded string for a basic auth header\n */\n public static generateBasicAuth(client_id: string, client_secret: string): string {\n const encoder = new TextEncoder();\n const data = encoder.encode([client_id, client_secret].join(\":\"));\n return toBase64(data);\n }\n\n /**\n * Generates a hash of a string using a given algorithm\n * @param alg\n * @param message\n */\n public static async hash(alg: string, message: string) : Promise<Uint8Array> {\n const msgUint8 = new TextEncoder().encode(message);\n const hashBuffer = await crypto.subtle.digest(alg, msgUint8);\n return new Uint8Array(hashBuffer);\n }\n\n /**\n * Generates a base64url encoded string\n */\n public static encodeBase64Url = (input: Uint8Array) => {\n return toBase64(input).replace(/=/g, \"\").replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n };\n\n /**\n * Generates a rfc7638 compliant jwk thumbprint\n * @param jwk\n */\n public static async customCalculateJwkThumbprint(jwk: JsonWebKey): Promise<string> {\n let jsonObject: object;\n switch (jwk.kty) {\n case \"RSA\":\n jsonObject = {\n \"e\": jwk.e,\n \"kty\": jwk.kty,\n \"n\": jwk.n,\n };\n break;\n case \"EC\":\n jsonObject = {\n \"crv\": jwk.crv,\n \"kty\": jwk.kty,\n \"x\": jwk.x,\n \"y\": jwk.y,\n };\n break;\n case \"OKP\":\n jsonObject = {\n \"crv\": jwk.crv,\n \"kty\": jwk.kty,\n \"x\": jwk.x,\n };\n break;\n case \"oct\":\n jsonObject = {\n \"crv\": jwk.k,\n \"kty\": jwk.kty,\n };\n break;\n default:\n throw new Error(\"Unknown jwk type\");\n }\n const utf8encodedAndHashed = await CryptoUtils.hash(\"SHA-256\", JSON.stringify(jsonObject));\n return CryptoUtils.encodeBase64Url(utf8encodedAndHashed);\n }\n\n public static async generateDPoPProof({\n url,\n accessToken,\n httpMethod,\n keyPair,\n nonce,\n }: GenerateDPoPProofOpts): Promise<string> {\n let hashedToken: Uint8Array;\n let encodedHash: string;\n\n const payload: Record<string, string | number> = {\n \"jti\": window.crypto.randomUUID(),\n \"htm\": httpMethod ?? \"GET\",\n \"htu\": url,\n \"iat\": Math.floor(Date.now() / 1000),\n };\n\n if (accessToken) {\n hashedToken = await CryptoUtils.hash(\"SHA-256\", accessToken);\n encodedHash = CryptoUtils.encodeBase64Url(hashedToken);\n payload.ath = encodedHash;\n }\n\n if (nonce) {\n payload.nonce = nonce;\n }\n\n try {\n const publicJwk = await crypto.subtle.exportKey(\"jwk\", keyPair.publicKey);\n const header = {\n \"alg\": \"ES256\",\n \"typ\": \"dpop+jwt\",\n \"jwk\": {\n \"crv\": publicJwk.crv,\n \"kty\": publicJwk.kty,\n \"x\": publicJwk.x,\n \"y\": publicJwk.y,\n },\n };\n return await JwtUtils.generateSignedJwt(header, payload, keyPair.privateKey);\n } catch (err) {\n if (err instanceof TypeError) {\n throw new Error(`Error exporting dpop public key: ${err.message}`);\n } else {\n throw err;\n }\n }\n }\n\n public static async generateDPoPJkt(keyPair: CryptoKeyPair) : Promise<string> {\n try {\n const publicJwk = await crypto.subtle.exportKey(\"jwk\", keyPair.publicKey);\n return await CryptoUtils.customCalculateJwkThumbprint(publicJwk);\n } catch (err) {\n if (err instanceof TypeError) {\n throw new Error(`Could not retrieve dpop keys from storage: ${err.message}`);\n } else {\n throw err;\n }\n }\n }\n\n public static async generateDPoPKeys() : Promise<CryptoKeyPair> {\n return await window.crypto.subtle.generateKey(\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n false,\n [\"sign\", \"verify\"],\n );\n }\n\n /**\n * Generates a client assertion JWT for client_secret_jwt authentication\n * @param client_id The client identifier\n * @param client_secret The client secret\n * @param audience The token endpoint URL (audience)\n * @param algorithm The HMAC algorithm to use (HS256, HS384, HS512). Defaults to HS256\n */\n public static async generateClientAssertionJwt(client_id: string, client_secret: string, audience: string, algorithm: string = \"HS256\"): Promise<string> {\n const now = Math.floor(Date.now() / 1000);\n\n const header = {\n \"alg\": algorithm,\n \"typ\": \"JWT\",\n };\n\n const payload = {\n \"iss\": client_id,\n \"sub\": client_id,\n \"aud\": audience,\n \"jti\": CryptoUtils.generateUUIDv4(),\n \"exp\": now + 300, // 5 minutes\n \"iat\": now,\n };\n\n const hashMap: Record<string, string> = {\n \"HS256\": \"SHA-256\",\n \"HS384\": \"SHA-384\",\n \"HS512\": \"SHA-512\",\n };\n\n const hashFunction = hashMap[algorithm];\n if (!hashFunction) {\n throw new Error(`Unsupported algorithm: ${algorithm}. Supported algorithms are: HS256, HS384, HS512`);\n }\n\n const encoder = new TextEncoder();\n const secretKey = await crypto.subtle.importKey(\n \"raw\",\n encoder.encode(client_secret),\n { name: \"HMAC\", hash: hashFunction },\n false,\n [\"sign\"],\n );\n\n return await JwtUtils.generateSignedJwtWithHmac(header, payload, secretKey);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./Logger\";\n\n/**\n * @internal\n */\nexport type Callback<EventType extends unknown[]> = (...ev: EventType) => (Promise<void> | void);\n\n/**\n * @internal\n */\nexport class Event<EventType extends unknown[]> {\n protected readonly _logger: Logger;\n\n private readonly _callbacks: Array<Callback<EventType>> = [];\n\n public constructor(protected readonly _name: string) {\n this._logger = new Logger(`Event('${this._name}')`);\n }\n\n public addHandler(cb: Callback<EventType>): () => void {\n this._callbacks.push(cb);\n return () => this.removeHandler(cb);\n }\n\n public removeHandler(cb: Callback<EventType>): void {\n const idx = this._callbacks.lastIndexOf(cb);\n if (idx >= 0) {\n this._callbacks.splice(idx, 1);\n }\n }\n\n public async raise(...ev: EventType): Promise<void> {\n this._logger.debug(\"raise:\", ...ev);\n for (const cb of this._callbacks) {\n await cb(...ev);\n }\n }\n}\n","/**\n *\n * @public\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/open#window_features\n */\nexport interface PopupWindowFeatures {\n left?: number;\n top?: number;\n width?: number;\n height?: number;\n menubar?: boolean | string;\n toolbar?: boolean | string;\n location?: boolean | string;\n status?: boolean | string;\n resizable?: boolean | string;\n scrollbars?: boolean | string;\n /** Close popup window after time in seconds, by default it is -1. To enable this feature, set value greater than 0. */\n closePopupWindowAfterInSeconds?: number;\n\n [k: string]: boolean | string | number | undefined;\n}\n\nexport class PopupUtils {\n /**\n * Populates a map of window features with a placement centered in front of\n * the current window. If no explicit width is given, a default value is\n * binned into [800, 720, 600, 480, 360] based on the current window's width.\n */\n static center({ ...features }: PopupWindowFeatures): PopupWindowFeatures {\n if (features.width == null)\n features.width = [800, 720, 600, 480].find(width => width <= window.outerWidth / 1.618) ?? 360;\n features.left ??= Math.max(0, Math.round(window.screenX + (window.outerWidth - features.width) / 2));\n if (features.height != null)\n features.top ??= Math.max(0, Math.round(window.screenY + (window.outerHeight - features.height) / 2));\n return features;\n }\n\n static serialize(features: PopupWindowFeatures): string {\n return Object.entries(features)\n .filter(([, value]) => value != null)\n .map(([key, value]) => `${key}=${typeof value !== \"boolean\" ? value as string : value ? \"yes\" : \"no\"}`)\n .join(\",\");\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Event } from \"./Event\";\nimport { Logger } from \"./Logger\";\n\n/**\n * @internal\n */\nexport class Timer extends Event<[void]> {\n protected readonly _logger = new Logger(`Timer('${this._name}')`);\n private _timerHandle: ReturnType<typeof setInterval> | null = null;\n private _expiration = 0;\n\n // get the time\n public static getEpochTime(): number {\n return Math.floor(Date.now() / 1000);\n }\n\n public init(durationInSeconds: number): void {\n const logger = this._logger.create(\"init\");\n durationInSeconds = Math.max(Math.floor(durationInSeconds), 1);\n const expiration = Timer.getEpochTime() + durationInSeconds;\n if (this.expiration === expiration && this._timerHandle) {\n // no need to reinitialize to same expiration, so bail out\n logger.debug(\"skipping since already initialized for expiration at\", this.expiration);\n return;\n }\n\n this.cancel();\n\n logger.debug(\"using duration\", durationInSeconds);\n this._expiration = expiration;\n\n // we're using a fairly short timer and then checking the expiration in the\n // callback to handle scenarios where the browser device sleeps, and then\n // the timers end up getting delayed.\n const timerDurationInSeconds = Math.min(durationInSeconds, 5);\n this._timerHandle = setInterval(this._callback, timerDurationInSeconds * 1000);\n }\n\n public get expiration(): number {\n return this._expiration;\n }\n\n public cancel(): void {\n this._logger.create(\"cancel\");\n if (this._timerHandle) {\n clearInterval(this._timerHandle);\n this._timerHandle = null;\n }\n }\n\n protected _callback = (): void => {\n const diff = this._expiration - Timer.getEpochTime();\n this._logger.debug(\"timer completes in\", diff);\n\n if (this._expiration <= Timer.getEpochTime()) {\n this.cancel();\n void super.raise();\n }\n };\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\n/**\n * @internal\n */\nexport class UrlUtils {\n public static readParams(url: string, responseMode: \"query\" | \"fragment\" = \"query\"): URLSearchParams {\n if (!url) throw new TypeError(\"Invalid URL\");\n // the base URL is irrelevant, it's just here to support relative url arguments\n const parsedUrl = new URL(url, \"http://127.0.0.1\");\n const params = parsedUrl[responseMode === \"fragment\" ? \"hash\" : \"search\"];\n return new URLSearchParams(params.slice(1));\n }\n}\n\n/**\n * @internal\n */\nexport const URL_STATE_DELIMITER = \";\";","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"../utils\";\n\n/**\n * Error class thrown in case of an authentication error.\n *\n * @public\n * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n */\nexport class ErrorResponse extends Error {\n /** Marker to detect class: \"ErrorResponse\" */\n public readonly name: string = \"ErrorResponse\";\n\n /** An error code string that can be used to classify the types of errors that occur and to respond to errors. */\n public readonly error: string | null;\n /** additional information that can help a developer identify the cause of the error.*/\n public readonly error_description: string | null;\n /**\n * URI identifying a human-readable web page with information about the error, used to provide the client\n developer with additional information about the error.\n */\n public readonly error_uri: string | null;\n\n /** custom state data set during the initial signin request */\n public state?: unknown;\n\n public readonly session_state: string | null;\n\n public url_state?: string;\n\n public constructor(\n args: {\n error?: string | null; error_description?: string | null; error_uri?: string | null;\n userState?: unknown; session_state?: string | null; url_state?: string;\n },\n /** The x-www-form-urlencoded request body sent to the authority server */\n public readonly form?: URLSearchParams,\n ) {\n super(args.error_description || args.error || \"\");\n\n if (!args.error) {\n Logger.error(\"ErrorResponse\", \"No error passed\");\n throw new Error(\"No error passed\");\n }\n\n this.error = args.error;\n this.error_description = args.error_description ?? null;\n this.error_uri = args.error_uri ?? null;\n\n this.state = args.userState;\n this.session_state = args.session_state ?? null;\n this.url_state = args.url_state;\n }\n}\n","// Copyright (C) 2021 AuthTS Contributors\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\n/**\n * Error class thrown in case of network timeouts (e.g IFrame time out).\n *\n * @public\n */\nexport class ErrorTimeout extends Error {\n /** Marker to detect class: \"ErrorTimeout\" */\n public readonly name: string = \"ErrorTimeout\";\n\n public constructor(message?: string) {\n super(message);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, Timer } from \"./utils\";\nimport type { User } from \"./User\";\n\n/**\n * @public\n */\nexport type AccessTokenCallback = (...ev: unknown[]) => (Promise<void> | void);\n\n/**\n * @public\n */\nexport class AccessTokenEvents {\n protected readonly _logger = new Logger(\"AccessTokenEvents\");\n\n private readonly _expiringTimer = new Timer(\"Access token expiring\");\n private readonly _expiredTimer = new Timer(\"Access token expired\");\n private readonly _expiringNotificationTimeInSeconds: number;\n\n public constructor(args: { expiringNotificationTimeInSeconds: number }) {\n this._expiringNotificationTimeInSeconds = args.expiringNotificationTimeInSeconds;\n }\n\n public async load(container: User): Promise<void> {\n const logger = this._logger.create(\"load\");\n // only register events if there's an access token and it has an expiration\n if (container.access_token && container.expires_in !== undefined) {\n const duration = container.expires_in;\n logger.debug(\"access token present, remaining duration:\", duration);\n\n if (duration > 0) {\n // only register expiring if we still have time\n let expiring = duration - this._expiringNotificationTimeInSeconds;\n if (expiring <= 0) {\n expiring = 1;\n }\n\n logger.debug(\"registering expiring timer, raising in\", expiring, \"seconds\");\n this._expiringTimer.init(expiring);\n }\n else {\n logger.debug(\"canceling existing expiring timer because we're past expiration.\");\n this._expiringTimer.cancel();\n }\n\n // if it's negative, it will still fire\n const expired = duration + 1;\n logger.debug(\"registering expired timer, raising in\", expired, \"seconds\");\n this._expiredTimer.init(expired);\n }\n else {\n this._expiringTimer.cancel();\n this._expiredTimer.cancel();\n }\n }\n\n public async unload(): Promise<void> {\n this._logger.debug(\"unload: canceling existing access token timers\");\n this._expiringTimer.cancel();\n this._expiredTimer.cancel();\n }\n\n /**\n * Add callback: Raised prior to the access token expiring.\n */\n public addAccessTokenExpiring(cb: AccessTokenCallback): () => void {\n return this._expiringTimer.addHandler(cb);\n }\n /**\n * Remove callback: Raised prior to the access token expiring.\n */\n public removeAccessTokenExpiring(cb: AccessTokenCallback): void {\n this._expiringTimer.removeHandler(cb);\n }\n\n /**\n * Add callback: Raised after the access token has expired.\n */\n public addAccessTokenExpired(cb: AccessTokenCallback): () => void {\n return this._expiredTimer.addHandler(cb);\n }\n /**\n * Remove callback: Raised after the access token has expired.\n */\n public removeAccessTokenExpired(cb: AccessTokenCallback): void {\n this._expiredTimer.removeHandler(cb);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./utils\";\n\n/**\n * @internal\n */\nexport class CheckSessionIFrame {\n private readonly _logger = new Logger(\"CheckSessionIFrame\");\n private _frame_origin: string;\n private _frame: HTMLIFrameElement;\n private _timer: ReturnType<typeof setInterval> | null = null;\n private _session_state: string | null = null;\n\n public constructor(\n private _callback: () => Promise<void>,\n private _client_id: string,\n url: string,\n private _intervalInSeconds: number,\n private _stopOnError: boolean,\n ) {\n const parsedUrl = new URL(url);\n this._frame_origin = parsedUrl.origin;\n\n this._frame = window.document.createElement(\"iframe\");\n\n // shotgun approach\n this._frame.style.visibility = \"hidden\";\n this._frame.style.position = \"fixed\";\n this._frame.style.left = \"-1000px\";\n this._frame.style.top = \"0\";\n this._frame.width = \"0\";\n this._frame.height = \"0\";\n this._frame.src = parsedUrl.href;\n }\n\n public load(): Promise<void> {\n return new Promise<void>((resolve) => {\n this._frame.onload = () => {\n resolve();\n };\n\n window.document.body.appendChild(this._frame);\n window.addEventListener(\"message\", this._message, false);\n });\n }\n\n private _message = (e: MessageEvent<string>): void => {\n if (e.origin === this._frame_origin &&\n e.source === this._frame.contentWindow\n ) {\n if (e.data === \"error\") {\n this._logger.error(\"error message from check session op iframe\");\n if (this._stopOnError) {\n this.stop();\n }\n }\n else if (e.data === \"changed\") {\n this._logger.debug(\"changed message from check session op iframe\");\n this.stop();\n void this._callback();\n }\n else {\n this._logger.debug(e.data + \" message from check session op iframe\");\n }\n }\n };\n\n public start(session_state: string): void {\n if (this._session_state === session_state) {\n return;\n }\n\n this._logger.create(\"start\");\n\n this.stop();\n\n this._session_state = session_state;\n\n const send = () => {\n if (!this._frame.contentWindow || !this._session_state) {\n return;\n }\n\n this._frame.contentWindow.postMessage(this._client_id + \" \" + this._session_state, this._frame_origin);\n };\n\n // trigger now\n send();\n\n // and setup timer\n this._timer = setInterval(send, this._intervalInSeconds * 1000);\n }\n\n public stop(): void {\n this._logger.create(\"stop\");\n this._session_state = null;\n\n if (this._timer) {\n\n clearInterval(this._timer);\n this._timer = null;\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./utils\";\n\n/**\n * @public\n */\nexport class InMemoryWebStorage implements Storage {\n private readonly _logger = new Logger(\"InMemoryWebStorage\");\n private _data: Record<string, string> = {};\n\n public clear(): void {\n this._logger.create(\"clear\");\n this._data = {};\n }\n\n public getItem(key: string): string {\n this._logger.create(`getItem('${key}')`);\n return this._data[key];\n }\n\n public setItem(key: string, value: string): void {\n this._logger.create(`setItem('${key}')`);\n this._data[key] = value;\n }\n\n public removeItem(key: string): void {\n this._logger.create(`removeItem('${key}')`);\n delete this._data[key];\n }\n\n public get length(): number {\n return Object.getOwnPropertyNames(this._data).length;\n }\n\n public key(index: number): string {\n return Object.getOwnPropertyNames(this._data)[index];\n }\n}\n","export class ErrorDPoPNonce extends Error {\n /** Marker to detect class: \"ErrorDPoPNonce\" */\n public readonly name: string = \"ErrorDPoPNonce\";\n public readonly nonce: string;\n\n public constructor(nonce: string, message?: string) {\n super(message);\n this.nonce = nonce;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { ErrorResponse, ErrorTimeout } from \"./errors\";\nimport type { ExtraHeader } from \"./OidcClientSettings\";\nimport { Logger } from \"./utils\";\nimport { ErrorDPoPNonce } from \"./errors/ErrorDPoPNonce\";\n\n/**\n * @internal\n */\nexport type JwtHandler = (text: string) => Promise<Record<string, unknown>>;\n\n/**\n * @internal\n */\nexport interface GetJsonOpts {\n token?: string;\n credentials?: RequestCredentials;\n timeoutInSeconds?: number;\n}\n\n/**\n * @internal\n */\nexport interface PostFormOpts {\n body: URLSearchParams;\n basicAuth?: string;\n timeoutInSeconds?: number;\n initCredentials?: \"same-origin\" | \"include\" | \"omit\";\n extraHeaders?: Record<string, ExtraHeader>;\n}\n\n/**\n * @internal\n */\nexport class JsonService {\n private readonly _logger = new Logger(\"JsonService\");\n\n private _contentTypes: string[] = [];\n\n public constructor(\n additionalContentTypes: string[] = [],\n private _jwtHandler: JwtHandler | null = null,\n private _extraHeaders: Record<string, ExtraHeader> = {},\n ) {\n this._contentTypes.push(...additionalContentTypes, \"application/json\");\n if (_jwtHandler) {\n this._contentTypes.push(\"application/jwt\");\n }\n }\n\n protected async fetchWithTimeout(input: RequestInfo, init: RequestInit & { timeoutInSeconds?: number } = {}) {\n const { timeoutInSeconds, ...initFetch } = init;\n if (!timeoutInSeconds) {\n return await fetch(input, initFetch);\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutInSeconds * 1000);\n\n try {\n const response = await fetch(input, {\n ...init,\n signal: controller.signal,\n });\n return response;\n }\n catch (err) {\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new ErrorTimeout(\"Network timed out\");\n }\n throw err;\n }\n finally {\n clearTimeout(timeoutId);\n }\n }\n\n public async getJson(url: string, {\n token,\n credentials,\n timeoutInSeconds,\n }: GetJsonOpts = {}): Promise<Record<string, unknown>> {\n const logger = this._logger.create(\"getJson\");\n const headers: HeadersInit = {\n \"Accept\": this._contentTypes.join(\", \"),\n };\n if (token) {\n logger.debug(\"token passed, setting Authorization header\");\n headers[\"Authorization\"] = \"Bearer \" + token;\n }\n\n this._appendExtraHeaders(headers);\n\n let response: Response;\n try {\n logger.debug(\"url:\", url);\n response = await this.fetchWithTimeout(url, { method: \"GET\", headers, timeoutInSeconds, credentials });\n }\n catch (err) {\n logger.error(\"Network Error\");\n throw err;\n }\n\n logger.debug(\"HTTP response received, status\", response.status);\n const contentType = response.headers.get(\"Content-Type\");\n if (contentType && !this._contentTypes.find(item => contentType.startsWith(item))) {\n logger.throw(new Error(`Invalid response Content-Type: ${(contentType ?? \"undefined\")}, from URL: ${url}`));\n }\n if (response.ok && this._jwtHandler && contentType?.startsWith(\"application/jwt\")) {\n return await this._jwtHandler(await response.text());\n }\n let json: Record<string, unknown>;\n try {\n json = await response.json();\n }\n catch (err) {\n logger.error(\"Error parsing JSON response\", err);\n if (response.ok) throw err;\n throw new Error(`${response.statusText} (${response.status})`);\n }\n if (!response.ok) {\n logger.error(\"Error from server:\", json);\n if (json.error) {\n throw new ErrorResponse(json);\n }\n throw new Error(`${response.statusText} (${response.status}): ${JSON.stringify(json)}`);\n }\n return json;\n }\n\n public async postForm(url: string, {\n body,\n basicAuth,\n timeoutInSeconds,\n initCredentials,\n extraHeaders,\n }: PostFormOpts): Promise<Record<string, unknown>> {\n const logger = this._logger.create(\"postForm\");\n const headers: HeadersInit = {\n \"Accept\": this._contentTypes.join(\", \"),\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n ...extraHeaders,\n };\n if (basicAuth !== undefined) {\n headers[\"Authorization\"] = \"Basic \" + basicAuth;\n }\n\n this._appendExtraHeaders(headers);\n\n let response: Response;\n try {\n logger.debug(\"url:\", url);\n response = await this.fetchWithTimeout(url, { method: \"POST\", headers, body, timeoutInSeconds, credentials: initCredentials });\n }\n catch (err) {\n logger.error(\"Network error\");\n throw err;\n }\n\n logger.debug(\"HTTP response received, status\", response.status);\n const contentType = response.headers.get(\"Content-Type\");\n if (contentType && !this._contentTypes.find(item => contentType.startsWith(item))) {\n throw new Error(`Invalid response Content-Type: ${(contentType ?? \"undefined\")}, from URL: ${url}`);\n }\n\n const responseText = await response.text();\n\n let json: Record<string, unknown> = {};\n if (responseText) {\n try {\n json = JSON.parse(responseText);\n }\n catch (err) {\n logger.error(\"Error parsing JSON response\", err);\n if (response.ok) throw err;\n throw new Error(`${response.statusText} (${response.status})`);\n }\n }\n\n if (!response.ok) {\n logger.error(\"Error from server:\", json);\n if (response.headers.has(\"dpop-nonce\")) {\n const nonce = response.headers.get(\"dpop-nonce\") as string;\n throw new ErrorDPoPNonce(nonce, `${JSON.stringify(json)}`);\n }\n if (json.error) {\n throw new ErrorResponse(json, body);\n }\n throw new Error(`${response.statusText} (${response.status}): ${JSON.stringify(json)}`);\n }\n\n return json;\n }\n\n private _appendExtraHeaders(\n headers: Record<string, string>,\n ): void {\n const logger = this._logger.create(\"appendExtraHeaders\");\n const customKeys = Object.keys(this._extraHeaders);\n const protectedHeaders = [\n \"accept\",\n \"content-type\",\n ];\n const preventOverride = [\n \"authorization\",\n ];\n if (customKeys.length === 0) {\n return;\n }\n customKeys.forEach((headerName) => {\n if (protectedHeaders.includes(headerName.toLocaleLowerCase())) {\n logger.warn(\"Protected header could not be set\", headerName, protectedHeaders);\n return;\n }\n if (preventOverride.includes(headerName.toLocaleLowerCase()) &&\n Object.keys(headers).includes(headerName)) {\n logger.warn(\"Header could not be overridden\", headerName, preventOverride);\n return;\n }\n const content = (typeof this._extraHeaders[headerName] === \"function\") ?\n (this._extraHeaders[headerName] as ()=>string)() :\n this._extraHeaders[headerName];\n if (content && content !== \"\") {\n headers[headerName] = content;\n }\n });\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./utils\";\nimport { JsonService } from \"./JsonService\";\nimport type { OidcClientSettingsStore, SigningKey } from \"./OidcClientSettings\";\nimport type { OidcMetadata } from \"./OidcMetadata\";\n\n/**\n * @public\n * @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata\n */\nexport class MetadataService {\n private readonly _logger = new Logger(\"MetadataService\");\n private readonly _jsonService;\n\n // cache\n private _metadataUrl: string;\n private _signingKeys: SigningKey[] | null = null;\n private _metadata: Partial<OidcMetadata> | null = null;\n private _fetchRequestCredentials: RequestCredentials | undefined;\n\n public constructor(private readonly _settings: OidcClientSettingsStore) {\n this._metadataUrl = this._settings.metadataUrl;\n this._jsonService = new JsonService(\n [\"application/jwk-set+json\"],\n null,\n this._settings.extraHeaders,\n );\n if (this._settings.signingKeys) {\n this._logger.debug(\"using signingKeys from settings\");\n this._signingKeys = this._settings.signingKeys;\n }\n\n if (this._settings.metadata) {\n this._logger.debug(\"using metadata from settings\");\n this._metadata = this._settings.metadata;\n }\n\n if (this._settings.fetchRequestCredentials) {\n this._logger.debug(\"using fetchRequestCredentials from settings\");\n this._fetchRequestCredentials = this._settings.fetchRequestCredentials;\n }\n }\n\n public resetSigningKeys(): void {\n this._signingKeys = null;\n }\n\n public async getMetadata(): Promise<Partial<OidcMetadata>> {\n const logger = this._logger.create(\"getMetadata\");\n if (this._metadata) {\n logger.debug(\"using cached values\");\n return this._metadata;\n }\n\n if (!this._metadataUrl) {\n logger.throw(new Error(\"No authority or metadataUrl configured on settings\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n logger.debug(\"getting metadata from\", this._metadataUrl);\n const metadata = await this._jsonService.getJson(this._metadataUrl, { credentials: this._fetchRequestCredentials, timeoutInSeconds: this._settings.requestTimeoutInSeconds });\n\n logger.debug(\"merging remote JSON with seed metadata\");\n this._metadata = Object.assign({}, metadata, this._settings.metadataSeed);\n return this._metadata;\n }\n\n public getIssuer(): Promise<string> {\n return this._getMetadataProperty(\"issuer\") as Promise<string>;\n }\n\n public getAuthorizationEndpoint(): Promise<string> {\n return this._getMetadataProperty(\"authorization_endpoint\") as Promise<string>;\n }\n\n public getUserInfoEndpoint(): Promise<string> {\n return this._getMetadataProperty(\"userinfo_endpoint\") as Promise<string>;\n }\n\n public getTokenEndpoint(optional: false): Promise<string>;\n public getTokenEndpoint(optional?: true): Promise<string | undefined>;\n public getTokenEndpoint(optional = true): Promise<string | undefined> {\n return this._getMetadataProperty(\"token_endpoint\", optional) as Promise<string | undefined>;\n }\n\n public getCheckSessionIframe(): Promise<string | undefined> {\n return this._getMetadataProperty(\"check_session_iframe\", true) as Promise<string | undefined>;\n }\n\n public getEndSessionEndpoint(): Promise<string | undefined> {\n return this._getMetadataProperty(\"end_session_endpoint\", true) as Promise<string | undefined>;\n }\n\n public getRevocationEndpoint(optional: false): Promise<string>;\n public getRevocationEndpoint(optional?: true): Promise<string | undefined>;\n public getRevocationEndpoint(optional = true): Promise<string | undefined> {\n return this._getMetadataProperty(\"revocation_endpoint\", optional) as Promise<string | undefined>;\n }\n\n public getKeysEndpoint(optional: false): Promise<string>;\n public getKeysEndpoint(optional?: true): Promise<string | undefined>;\n public getKeysEndpoint(optional = true): Promise<string | undefined> {\n return this._getMetadataProperty(\"jwks_uri\", optional) as Promise<string | undefined>;\n }\n\n protected async _getMetadataProperty(name: keyof OidcMetadata, optional=false): Promise<string | boolean | string[] | undefined> {\n const logger = this._logger.create(`_getMetadataProperty('${name}')`);\n\n const metadata = await this.getMetadata();\n logger.debug(\"resolved\");\n\n if (metadata[name] === undefined) {\n if (optional === true) {\n logger.warn(\"Metadata does not contain optional property\");\n return undefined;\n }\n\n logger.throw(new Error(\"Metadata does not contain property \" + name));\n }\n\n return metadata[name];\n }\n\n public async getSigningKeys(): Promise<SigningKey[] | null> {\n const logger = this._logger.create(\"getSigningKeys\");\n if (this._signingKeys) {\n logger.debug(\"returning signingKeys from cache\");\n return this._signingKeys;\n }\n\n const jwks_uri = await this.getKeysEndpoint(false);\n logger.debug(\"got jwks_uri\", jwks_uri);\n\n const keySet = await this._jsonService.getJson(jwks_uri, { timeoutInSeconds: this._settings.requestTimeoutInSeconds });\n logger.debug(\"got key set\", keySet);\n\n if (!Array.isArray(keySet.keys)) {\n logger.throw(new Error(\"Missing keys on keyset\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n this._signingKeys = keySet.keys;\n return this._signingKeys;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./utils\";\nimport type { StateStore } from \"./StateStore\";\nimport type { AsyncStorage } from \"./AsyncStorage\";\n\n/**\n * @public\n */\nexport class WebStorageStateStore implements StateStore {\n private readonly _logger = new Logger(\"WebStorageStateStore\");\n\n private readonly _store: AsyncStorage | Storage;\n private readonly _prefix: string;\n\n public constructor({\n prefix = \"oidc.\",\n store = localStorage,\n }: { prefix?: string; store?: AsyncStorage | Storage } = {}) {\n this._store = store;\n this._prefix = prefix;\n }\n\n public async set(key: string, value: string): Promise<void> {\n this._logger.create(`set('${key}')`);\n\n key = this._prefix + key;\n await this._store.setItem(key, value);\n }\n\n public async get(key: string): Promise<string | null> {\n this._logger.create(`get('${key}')`);\n\n key = this._prefix + key;\n const item = await this._store.getItem(key);\n return item;\n }\n\n public async remove(key: string): Promise<string | null> {\n this._logger.create(`remove('${key}')`);\n\n key = this._prefix + key;\n const item = await this._store.getItem(key);\n await this._store.removeItem(key);\n return item;\n }\n\n public async getAllKeys(): Promise<string[]> {\n this._logger.create(\"getAllKeys\");\n const len = await this._store.length;\n\n const keys = [];\n for (let index = 0; index < len; index++) {\n const key = await this._store.key(index);\n if (key && key.indexOf(this._prefix) === 0) {\n keys.push(key.substr(this._prefix.length));\n }\n }\n return keys;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { WebStorageStateStore } from \"./WebStorageStateStore\";\nimport type { OidcMetadata } from \"./OidcMetadata\";\nimport type { StateStore } from \"./StateStore\";\nimport { InMemoryWebStorage } from \"./InMemoryWebStorage\";\nimport type { DPoPStore } from \"./DPoPStore\";\n\nconst DefaultResponseType = \"code\";\nconst DefaultScope = \"openid\";\nconst DefaultClientAuthentication = \"client_secret_post\";\nconst DefaultStaleStateAgeInSeconds = 60 * 15;\n\n/**\n * @public\n */\nexport type SigningKey = Record<string, string | string[]>;\n\n/**\n * @public\n */\nexport type ExtraHeader = string | (() => string);\n\n/**\n * Optional DPoP settings\n * @public\n */\nexport interface DPoPSettings {\n bind_authorization_code?: boolean;\n store: DPoPStore;\n}\n\n/**\n * The settings used to configure the {@link OidcClient}.\n *\n * @public\n */\nexport interface OidcClientSettings {\n /** The URL of the OIDC/OAuth2 provider */\n authority: string;\n metadataUrl?: string;\n /** Provide metadata when authority server does not allow CORS on the metadata endpoint */\n metadata?: Partial<OidcMetadata>;\n /** Can be used to seed or add additional values to the results of the discovery request */\n metadataSeed?: Partial<OidcMetadata>;\n /** Provide signingKeys when authority server does not allow CORS on the jwks uri */\n signingKeys?: SigningKey[];\n\n /** Your client application's identifier as registered with the OIDC/OAuth2 */\n client_id: string;\n client_secret?: string;\n /** The type of response desired from the OIDC/OAuth2 provider (default: \"code\") */\n response_type?: string;\n /** The scope being requested from the OIDC/OAuth2 provider (default: \"openid\") */\n scope?: string;\n /** The redirect URI of your client application to receive a response from the OIDC/OAuth2 provider */\n redirect_uri: string;\n /** The OIDC/OAuth2 post-logout redirect URI */\n post_logout_redirect_uri?: string;\n\n /**\n * Client authentication method that is used to authenticate when using the token endpoint (default: \"client_secret_post\")\n * - \"client_secret_basic\": using the HTTP Basic authentication scheme\n * - \"client_secret_post\": including the client credentials in the request body\n * - \"client_secret_jwt\": using a JWT signed with the client secret\n *\n * See https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication\n */\n client_authentication?: \"client_secret_basic\" | \"client_secret_post\" | \"client_secret_jwt\";\n\n /**\n * The signature algorithm to use for client_secret_jwt authentication (default: \"HS256\")\n * Supported algorithms: HS256, HS384, HS512\n */\n token_endpoint_auth_signing_alg?: \"HS256\" | \"HS384\" | \"HS512\";\n\n /** optional protocol param */\n prompt?: string;\n /** optional protocol param */\n display?: string;\n /** optional protocol param */\n max_age?: number;\n /** optional protocol param */\n ui_locales?: string;\n /** optional protocol param */\n acr_values?: string;\n /** optional protocol param */\n resource?: string | string[];\n\n /**\n * Optional protocol param\n * The response mode used by the authority server is defined by the response_type unless explicitly specified:\n * - Response mode for the OAuth 2.0 response type \"code\" is the \"query\" encoding\n * - Response mode for the OAuth 2.0 response type \"token\" is the \"fragment\" encoding\n *\n * @see https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes\n */\n response_mode?: \"query\" | \"fragment\";\n\n /**\n * Should optional OIDC protocol claims be removed from profile or specify the ones to be removed (default: true)\n * When true, the following claims are removed by default: [\"nbf\", \"jti\", \"auth_time\", \"nonce\", \"acr\", \"amr\", \"azp\", \"at_hash\"]\n * When specifying claims, the following claims are not allowed: [\"sub\", \"iss\", \"aud\", \"exp\", \"iat\"]\n */\n filterProtocolClaims?: boolean | string[];\n /** Flag to control if additional identity data is loaded from the user info endpoint in order to populate the user's profile (default: false) */\n loadUserInfo?: boolean;\n /** Number (in seconds) indicating the age of state entries in storage for authorize requests that are considered abandoned and thus can be cleaned up (default: 900) */\n staleStateAgeInSeconds?: number;\n\n /**\n * Indicates how objects returned from the user info endpoint as claims (e.g. `address`) are merged into the claims from the\n * id token as a single object. (default: `{ array: \"replace\" }`)\n * - array: \"replace\": natives (string, int, float) and arrays are replaced, objects are merged as distinct objects\n * - array: \"merge\": natives (string, int, float) are replaced, arrays and objects are merged as distinct objects\n */\n mergeClaimsStrategy?: { array: \"replace\" | \"merge\" };\n\n /**\n * Storage object used to persist interaction state (default: window.localStorage, InMemoryWebStorage iff no window).\n * E.g. `stateStore: new WebStorageStateStore({ store: window.localStorage })`\n */\n stateStore?: StateStore;\n\n /**\n * An object containing additional query string parameters to be including in the authorization request.\n * E.g, when using Azure AD to obtain an access token an additional resource parameter is required. extraQueryParams: `{resource:\"some_identifier\"}`\n */\n extraQueryParams?: Record<string, string | number | boolean>;\n\n extraTokenParams?: Record<string, unknown>;\n\n /**\n * An object containing additional header to be including in request.\n */\n extraHeaders?: Record<string, ExtraHeader>;\n\n /**\n * DPoP enabled or disabled\n */\n dpop?: DPoPSettings | undefined;\n\n /**\n * Will check the content type header of the response of the revocation endpoint to match these passed values (default: [])\n */\n revokeTokenAdditionalContentTypes?: string[];\n /**\n * Will disable PKCE validation, changing to true will not append to sign in request code_challenge and code_challenge_method. (default: false)\n */\n disablePKCE?: boolean;\n /**\n * Sets the credentials for fetch requests. (default: \"same-origin\")\n * Use this if you need to send cookies to the OIDC/OAuth2 provider or if you are using a proxy that requires cookies\n */\n fetchRequestCredentials?: RequestCredentials;\n\n /**\n * Only scopes in this list will be passed in the token refresh request.\n */\n refreshTokenAllowedScope?: string | undefined;\n\n /**\n * Defines request timeouts globally across all requests made to the authorisation server\n */\n requestTimeoutInSeconds?: number | undefined;\n\n /**\n * https://datatracker.ietf.org/doc/html/rfc6749#section-3.3 describes behavior when omitting scopes from sign in requests\n * If the IDP supports default scopes, this setting will ignore the scopes property passed to the config. (Default: false)\n */\n omitScopeWhenRequesting?: boolean;\n}\n\n/**\n * The settings with defaults applied of the {@link OidcClient}.\n *\n * @public\n * @see {@link OidcClientSettings}\n */\nexport class OidcClientSettingsStore {\n // metadata\n public readonly authority: string;\n public readonly metadataUrl: string;\n public readonly metadata: Partial<OidcMetadata> | undefined;\n public readonly metadataSeed: Partial<OidcMetadata> | undefined;\n public readonly signingKeys: SigningKey[] | undefined;\n\n // client config\n public readonly client_id: string;\n public readonly client_secret: string | undefined;\n public readonly response_type: string;\n public readonly scope: string;\n public readonly redirect_uri: string;\n public readonly post_logout_redirect_uri: string | undefined;\n public readonly client_authentication: \"client_secret_basic\" | \"client_secret_post\" | \"client_secret_jwt\";\n public readonly token_endpoint_auth_signing_alg: \"HS256\" | \"HS384\" | \"HS512\";\n\n // optional protocol params\n public readonly prompt: string | undefined;\n public readonly display: string | undefined;\n public readonly max_age: number | undefined;\n public readonly ui_locales: string | undefined;\n public readonly acr_values: string | undefined;\n public readonly resource: string | string[] | undefined;\n public readonly response_mode: \"query\" | \"fragment\" | undefined;\n\n // behavior flags\n public readonly filterProtocolClaims: boolean | string[];\n public readonly loadUserInfo: boolean;\n public readonly staleStateAgeInSeconds: number;\n public readonly mergeClaimsStrategy: { array: \"replace\" | \"merge\" };\n public readonly omitScopeWhenRequesting: boolean;\n\n public readonly stateStore: StateStore;\n\n // extra\n public readonly extraQueryParams: Record<string, string | number | boolean>;\n public readonly extraTokenParams: Record<string, unknown>;\n public readonly dpop: DPoPSettings | undefined;\n public readonly extraHeaders: Record<string, ExtraHeader>;\n\n public readonly revokeTokenAdditionalContentTypes?: string[];\n public readonly fetchRequestCredentials: RequestCredentials;\n public readonly refreshTokenAllowedScope: string | undefined;\n public readonly disablePKCE: boolean;\n public readonly requestTimeoutInSeconds: number | undefined;\n\n public constructor({\n // metadata related\n authority, metadataUrl, metadata, signingKeys, metadataSeed,\n // client related\n client_id, client_secret, response_type = DefaultResponseType, scope = DefaultScope,\n redirect_uri, post_logout_redirect_uri,\n client_authentication = DefaultClientAuthentication,\n token_endpoint_auth_signing_alg = \"HS256\",\n // optional protocol\n prompt, display, max_age, ui_locales, acr_values, resource, response_mode,\n // behavior flags\n filterProtocolClaims = true,\n loadUserInfo = false,\n requestTimeoutInSeconds,\n staleStateAgeInSeconds = DefaultStaleStateAgeInSeconds,\n mergeClaimsStrategy = { array: \"replace\" },\n disablePKCE = false,\n // other behavior\n stateStore,\n revokeTokenAdditionalContentTypes,\n fetchRequestCredentials,\n refreshTokenAllowedScope,\n // extra\n extraQueryParams = {},\n extraTokenParams = {},\n extraHeaders = {},\n dpop,\n omitScopeWhenRequesting = false,\n }: OidcClientSettings) {\n\n this.authority = authority;\n\n if (metadataUrl) {\n this.metadataUrl = metadataUrl;\n } else {\n this.metadataUrl = authority;\n if (authority) {\n if (!this.metadataUrl.endsWith(\"/\")) {\n this.metadataUrl += \"/\";\n }\n this.metadataUrl += \".well-known/openid-configuration\";\n }\n }\n\n this.metadata = metadata;\n this.metadataSeed = metadataSeed;\n this.signingKeys = signingKeys;\n\n this.client_id = client_id;\n this.client_secret = client_secret;\n this.response_type = response_type;\n this.scope = scope;\n this.redirect_uri = redirect_uri;\n this.post_logout_redirect_uri = post_logout_redirect_uri;\n this.client_authentication = client_authentication;\n this.token_endpoint_auth_signing_alg = token_endpoint_auth_signing_alg;\n\n this.prompt = prompt;\n this.display = display;\n this.max_age = max_age;\n this.ui_locales = ui_locales;\n this.acr_values = acr_values;\n this.resource = resource;\n this.response_mode = response_mode;\n\n this.filterProtocolClaims = filterProtocolClaims ?? true;\n this.loadUserInfo = !!loadUserInfo;\n this.staleStateAgeInSeconds = staleStateAgeInSeconds;\n this.mergeClaimsStrategy = mergeClaimsStrategy;\n this.omitScopeWhenRequesting = omitScopeWhenRequesting;\n this.disablePKCE = !!disablePKCE;\n this.revokeTokenAdditionalContentTypes = revokeTokenAdditionalContentTypes;\n\n this.fetchRequestCredentials = fetchRequestCredentials ? fetchRequestCredentials : \"same-origin\";\n this.requestTimeoutInSeconds = requestTimeoutInSeconds;\n\n if (stateStore) {\n this.stateStore = stateStore;\n }\n else {\n const store = typeof window !== \"undefined\" ? window.localStorage : new InMemoryWebStorage();\n this.stateStore = new WebStorageStateStore({ store });\n }\n\n this.refreshTokenAllowedScope = refreshTokenAllowedScope;\n\n this.extraQueryParams = extraQueryParams;\n this.extraTokenParams = extraTokenParams;\n this.extraHeaders = extraHeaders;\n\n this.dpop = dpop;\n if (this.dpop && !this.dpop?.store) {\n throw new Error(\"A DPoPStore is required when dpop is enabled\");\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, JwtUtils } from \"./utils\";\nimport { JsonService } from \"./JsonService\";\nimport type { MetadataService } from \"./MetadataService\";\nimport type { JwtClaims } from \"./Claims\";\nimport type { OidcClientSettingsStore } from \"./OidcClientSettings\";\n\n/**\n * @internal\n */\nexport class UserInfoService {\n protected readonly _logger = new Logger(\"UserInfoService\");\n private readonly _jsonService: JsonService;\n\n public constructor(private readonly _settings: OidcClientSettingsStore,\n private readonly _metadataService: MetadataService,\n ) {\n this._jsonService = new JsonService(\n undefined,\n this._getClaimsFromJwt,\n this._settings.extraHeaders,\n );\n }\n\n public async getClaims(token: string): Promise<JwtClaims> {\n const logger = this._logger.create(\"getClaims\");\n if (!token) {\n this._logger.throw(new Error(\"No token passed\"));\n }\n\n const url = await this._metadataService.getUserInfoEndpoint();\n logger.debug(\"got userinfo url\", url);\n\n const claims = await this._jsonService.getJson(url, {\n token,\n credentials: this._settings.fetchRequestCredentials,\n timeoutInSeconds: this._settings.requestTimeoutInSeconds,\n });\n logger.debug(\"got claims\", claims);\n\n return claims;\n }\n\n protected _getClaimsFromJwt = async (responseText: string): Promise<JwtClaims> => {\n const logger = this._logger.create(\"_getClaimsFromJwt\");\n try {\n const payload = JwtUtils.decode(responseText);\n logger.debug(\"JWT decoding successful\");\n\n return payload;\n } catch (err) {\n logger.error(\"Error parsing JWT response\");\n throw err;\n }\n };\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { CryptoUtils, Logger } from \"./utils\";\nimport { JsonService } from \"./JsonService\";\nimport type { MetadataService } from \"./MetadataService\";\nimport type { ExtraHeader, OidcClientSettingsStore } from \"./OidcClientSettings\";\n\n/**\n * @internal\n */\nexport interface ExchangeCodeArgs {\n client_id?: string;\n client_secret?: string;\n redirect_uri?: string;\n\n grant_type?: string;\n code: string;\n code_verifier?: string;\n\n extraHeaders?: Record<string, ExtraHeader>;\n}\n\n/**\n * @internal\n */\nexport interface ExchangeCredentialsArgs {\n client_id?: string;\n client_secret?: string;\n\n grant_type?: string;\n scope?: string;\n\n username: string;\n password: string;\n}\n\n/**\n * @internal\n */\nexport interface ExchangeRefreshTokenArgs {\n client_id?: string;\n client_secret?: string;\n redirect_uri?: string;\n\n grant_type?: string;\n refresh_token: string;\n scope?: string;\n resource?: string | string[];\n\n timeoutInSeconds?: number;\n\n extraHeaders?: Record<string, ExtraHeader>;\n}\n\n/**\n * @internal\n */\nexport interface RevokeArgs {\n token: string;\n token_type_hint?: \"access_token\" | \"refresh_token\";\n}\n\n/**\n * @internal\n */\nexport class TokenClient {\n private readonly _logger = new Logger(\"TokenClient\");\n private readonly _jsonService;\n\n public constructor(\n private readonly _settings: OidcClientSettingsStore,\n private readonly _metadataService: MetadataService,\n ) {\n this._jsonService = new JsonService(\n this._settings.revokeTokenAdditionalContentTypes,\n null,\n this._settings.extraHeaders,\n );\n }\n\n /**\n * Exchange code.\n *\n * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.1.3\n */\n public async exchangeCode({\n grant_type = \"authorization_code\",\n redirect_uri = this._settings.redirect_uri,\n client_id = this._settings.client_id,\n client_secret = this._settings.client_secret,\n extraHeaders,\n ...args\n }: ExchangeCodeArgs): Promise<Record<string, unknown>> {\n const logger = this._logger.create(\"exchangeCode\");\n if (!client_id) {\n logger.throw(new Error(\"A client_id is required\"));\n }\n if (!redirect_uri) {\n logger.throw(new Error(\"A redirect_uri is required\"));\n }\n if (!args.code) {\n logger.throw(new Error(\"A code is required\"));\n }\n\n const params = new URLSearchParams({ grant_type, redirect_uri });\n for (const [key, value] of Object.entries(args)) {\n if (value != null) {\n params.set(key, value);\n }\n }\n\n // Validate client_secret if required before making any external calls\n if ((this._settings.client_authentication === \"client_secret_basic\" ||\n this._settings.client_authentication === \"client_secret_jwt\") &&\n (client_secret === undefined || client_secret === null)) {\n logger.throw(new Error(\"A client_secret is required\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n let basicAuth: string | undefined;\n const url = await this._metadataService.getTokenEndpoint(false);\n switch (this._settings.client_authentication) {\n case \"client_secret_basic\":\n basicAuth = CryptoUtils.generateBasicAuth(client_id, client_secret!);\n break;\n case \"client_secret_post\":\n params.append(\"client_id\", client_id);\n if (client_secret) {\n params.append(\"client_secret\", client_secret);\n }\n break;\n case \"client_secret_jwt\": {\n const clientAssertion = await CryptoUtils.generateClientAssertionJwt(client_id, client_secret!, url, this._settings.token_endpoint_auth_signing_alg);\n params.append(\"client_id\", client_id);\n params.append(\"client_assertion_type\", \"urn:ietf:params:oauth:client-assertion-type:jwt-bearer\");\n params.append(\"client_assertion\", clientAssertion);\n break;\n }\n }\n logger.debug(\"got token endpoint\");\n\n const response = await this._jsonService.postForm(url, {\n body: params,\n basicAuth,\n timeoutInSeconds: this._settings.requestTimeoutInSeconds,\n initCredentials: this._settings.fetchRequestCredentials,\n extraHeaders,\n });\n\n logger.debug(\"got response\");\n\n return response;\n }\n\n /**\n * Exchange credentials.\n *\n * @see https://www.rfc-editor.org/rfc/rfc6749#section-4.3.2\n */\n public async exchangeCredentials({\n grant_type = \"password\",\n client_id = this._settings.client_id,\n client_secret = this._settings.client_secret,\n scope = this._settings.scope,\n ...args\n }: ExchangeCredentialsArgs): Promise<Record<string, unknown>> {\n const logger = this._logger.create(\"exchangeCredentials\");\n\n if (!client_id) {\n logger.throw(new Error(\"A client_id is required\"));\n }\n\n const params = new URLSearchParams({ grant_type });\n if (!this._settings.omitScopeWhenRequesting) {\n params.set(\"scope\", scope);\n }\n for (const [key, value] of Object.entries(args)) {\n if (value != null) {\n params.set(key, value);\n }\n }\n\n // Validate client_secret if required before making any external calls\n if ((this._settings.client_authentication === \"client_secret_basic\" ||\n this._settings.client_authentication === \"client_secret_jwt\") &&\n (client_secret === undefined || client_secret === null)) {\n logger.throw(new Error(\"A client_secret is required\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n let basicAuth: string | undefined;\n const url = await this._metadataService.getTokenEndpoint(false);\n switch (this._settings.client_authentication) {\n case \"client_secret_basic\":\n basicAuth = CryptoUtils.generateBasicAuth(client_id, client_secret!);\n break;\n case \"client_secret_post\":\n params.append(\"client_id\", client_id);\n if (client_secret) {\n params.append(\"client_secret\", client_secret);\n }\n break;\n case \"client_secret_jwt\": {\n const clientAssertion = await CryptoUtils.generateClientAssertionJwt(client_id, client_secret!, url, this._settings.token_endpoint_auth_signing_alg);\n params.append(\"client_id\", client_id);\n params.append(\"client_assertion_type\", \"urn:ietf:params:oauth:client-assertion-type:jwt-bearer\");\n params.append(\"client_assertion\", clientAssertion);\n break;\n }\n }\n logger.debug(\"got token endpoint\");\n\n const response = await this._jsonService.postForm(url, { body: params, basicAuth, timeoutInSeconds: this._settings.requestTimeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials });\n logger.debug(\"got response\");\n\n return response;\n }\n\n /**\n * Exchange a refresh token.\n *\n * @see https://www.rfc-editor.org/rfc/rfc6749#section-6\n */\n public async exchangeRefreshToken({\n grant_type = \"refresh_token\",\n client_id = this._settings.client_id,\n client_secret = this._settings.client_secret,\n timeoutInSeconds,\n extraHeaders,\n ...args\n }: ExchangeRefreshTokenArgs): Promise<Record<string, unknown>> {\n const logger = this._logger.create(\"exchangeRefreshToken\");\n if (!client_id) {\n logger.throw(new Error(\"A client_id is required\"));\n }\n if (!args.refresh_token) {\n logger.throw(new Error(\"A refresh_token is required\"));\n }\n\n const params = new URLSearchParams({ grant_type });\n for (const [key, value] of Object.entries(args)) {\n if (Array.isArray(value)) {\n value.forEach(param => params.append(key, param));\n }\n else if (value != null) {\n params.set(key, value);\n }\n }\n\n // Validate client_secret if required before making any external calls\n if ((this._settings.client_authentication === \"client_secret_basic\" ||\n this._settings.client_authentication === \"client_secret_jwt\") &&\n (client_secret === undefined || client_secret === null)) {\n logger.throw(new Error(\"A client_secret is required\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n let basicAuth: string | undefined;\n const url = await this._metadataService.getTokenEndpoint(false);\n switch (this._settings.client_authentication) {\n case \"client_secret_basic\":\n basicAuth = CryptoUtils.generateBasicAuth(client_id, client_secret!);\n break;\n case \"client_secret_post\":\n params.append(\"client_id\", client_id);\n if (client_secret) {\n params.append(\"client_secret\", client_secret);\n }\n break;\n case \"client_secret_jwt\": {\n const clientAssertion = await CryptoUtils.generateClientAssertionJwt(client_id, client_secret!, url, this._settings.token_endpoint_auth_signing_alg);\n params.append(\"client_id\", client_id);\n params.append(\"client_assertion_type\", \"urn:ietf:params:oauth:client-assertion-type:jwt-bearer\");\n params.append(\"client_assertion\", clientAssertion);\n break;\n }\n }\n logger.debug(\"got token endpoint\");\n\n const response = await this._jsonService.postForm(url, { body: params, basicAuth, timeoutInSeconds, initCredentials: this._settings.fetchRequestCredentials, extraHeaders });\n logger.debug(\"got response\");\n\n return response;\n }\n\n /**\n * Revoke an access or refresh token.\n *\n * @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.1\n */\n public async revoke(args: RevokeArgs): Promise<void> {\n const logger = this._logger.create(\"revoke\");\n if (!args.token) {\n logger.throw(new Error(\"A token is required\"));\n }\n\n const url = await this._metadataService.getRevocationEndpoint(false);\n\n logger.debug(`got revocation endpoint, revoking ${args.token_type_hint ?? \"default token type\"}`);\n\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(args)) {\n if (value != null) {\n params.set(key, value);\n }\n }\n params.set(\"client_id\", this._settings.client_id);\n if (this._settings.client_secret) {\n params.set(\"client_secret\", this._settings.client_secret);\n }\n\n await this._jsonService.postForm(url, { body: params, timeoutInSeconds: this._settings.requestTimeoutInSeconds });\n logger.debug(\"got response\");\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, JwtUtils } from \"./utils\";\nimport { ErrorResponse } from \"./errors\";\nimport type { MetadataService } from \"./MetadataService\";\nimport { UserInfoService } from \"./UserInfoService\";\nimport { TokenClient } from \"./TokenClient\";\nimport type { ExtraHeader, OidcClientSettingsStore } from \"./OidcClientSettings\";\nimport type { SigninState } from \"./SigninState\";\nimport type { SigninResponse } from \"./SigninResponse\";\nimport type { State } from \"./State\";\nimport type { SignoutResponse } from \"./SignoutResponse\";\nimport type { UserProfile } from \"./User\";\nimport type { RefreshState } from \"./RefreshState\";\nimport type { IdTokenClaims } from \"./Claims\";\nimport type { ClaimsService } from \"./ClaimsService\";\n\n/**\n * @internal\n */\nexport class ResponseValidator {\n protected readonly _logger = new Logger(\"ResponseValidator\");\n protected readonly _userInfoService: UserInfoService;\n protected readonly _tokenClient: TokenClient;\n\n public constructor(\n protected readonly _settings: OidcClientSettingsStore,\n protected readonly _metadataService: MetadataService,\n protected readonly _claimsService: ClaimsService,\n ) {\n this._userInfoService = new UserInfoService(this._settings, this._metadataService);\n this._tokenClient = new TokenClient(this._settings, this._metadataService);\n }\n\n public async validateSigninResponse(response: SigninResponse, state: SigninState, extraHeaders?: Record<string, ExtraHeader>): Promise<void> {\n const logger = this._logger.create(\"validateSigninResponse\");\n\n this._processSigninState(response, state);\n logger.debug(\"state processed\");\n\n await this._processCode(response, state, extraHeaders);\n logger.debug(\"code processed\");\n\n if (response.isOpenId) {\n this._validateIdTokenAttributes(response, \"\", state.nonce);\n }\n logger.debug(\"tokens validated\");\n\n await this._processClaims(response, state?.skipUserInfo, response.isOpenId);\n logger.debug(\"claims processed\");\n }\n\n public async validateCredentialsResponse(response: SigninResponse, skipUserInfo: boolean): Promise<void> {\n const logger = this._logger.create(\"validateCredentialsResponse\");\n const shouldValidateSubClaim = response.isOpenId && !!response.id_token;\n\n if (shouldValidateSubClaim) {\n this._validateIdTokenAttributes(response);\n }\n logger.debug(\"tokens validated\");\n\n await this._processClaims(response, skipUserInfo, shouldValidateSubClaim);\n logger.debug(\"claims processed\");\n }\n\n public async validateRefreshResponse(response: SigninResponse, state: RefreshState): Promise<void> {\n const logger = this._logger.create(\"validateRefreshResponse\");\n\n response.userState = state.data;\n // if there's no session_state on the response, copy over session_state from original request\n response.session_state ??= state.session_state;\n // if there's no scope on the response, then assume all scopes granted (per-spec) and copy over scopes from original request\n response.scope ??= state.scope;\n\n // OpenID Connect Core 1.0 says that id_token is optional in refresh response:\n // https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokenResponse\n if (response.isOpenId && !!response.id_token) {\n this._validateIdTokenAttributes(response, state.id_token);\n logger.debug(\"ID Token validated\");\n }\n\n if (!response.id_token) {\n // if there's no id_token on the response, copy over id_token from original request\n response.id_token = state.id_token;\n // and decoded part too\n response.profile = state.profile;\n }\n\n const hasIdToken = response.isOpenId && !!response.id_token;\n await this._processClaims(response, false, hasIdToken);\n logger.debug(\"claims processed\");\n }\n\n public validateSignoutResponse(response: SignoutResponse, state: State): void {\n const logger = this._logger.create(\"validateSignoutResponse\");\n if (state.id !== response.state) {\n logger.throw(new Error(\"State does not match\"));\n }\n\n // now that we know the state matches, take the stored data\n // and set it into the response so callers can get their state\n // this is important for both success & error outcomes\n logger.debug(\"state validated\");\n response.userState = state.data;\n\n if (response.error) {\n logger.warn(\"Response was error\", response.error);\n throw new ErrorResponse(response);\n }\n }\n\n protected _processSigninState(response: SigninResponse, state: SigninState): void {\n const logger = this._logger.create(\"_processSigninState\");\n if (state.id !== response.state) {\n logger.throw(new Error(\"State does not match\"));\n }\n\n if (!state.client_id) {\n logger.throw(new Error(\"No client_id on state\"));\n }\n\n if (!state.authority) {\n logger.throw(new Error(\"No authority on state\"));\n }\n\n // ensure we're using the correct authority\n if (this._settings.authority !== state.authority) {\n logger.throw(new Error(\"authority mismatch on settings vs. signin state\"));\n }\n if (this._settings.client_id && this._settings.client_id !== state.client_id) {\n logger.throw(new Error(\"client_id mismatch on settings vs. signin state\"));\n }\n\n // now that we know the state matches, take the stored data\n // and set it into the response so callers can get their state\n // this is important for both success & error outcomes\n logger.debug(\"state validated\");\n response.userState = state.data;\n response.url_state = state.url_state;\n // if there's no scope on the response, then assume all scopes granted (per-spec) and copy over scopes from original request\n response.scope ??= state.scope;\n\n if (response.error) {\n logger.warn(\"Response was error\", response.error);\n throw new ErrorResponse(response);\n }\n\n if (state.code_verifier && !response.code) {\n logger.throw(new Error(\"Expected code in response\"));\n }\n\n }\n\n protected async _processClaims(response: SigninResponse, skipUserInfo = false, validateSub = true): Promise<void> {\n const logger = this._logger.create(\"_processClaims\");\n response.profile = this._claimsService.filterProtocolClaims(response.profile);\n\n if (skipUserInfo || !this._settings.loadUserInfo || !response.access_token) {\n logger.debug(\"not loading user info\");\n return;\n }\n\n logger.debug(\"loading user info\");\n const claims = await this._userInfoService.getClaims(response.access_token);\n logger.debug(\"user info claims received from user info endpoint\");\n\n if (validateSub && claims.sub !== response.profile.sub) {\n logger.throw(new Error(\"subject from UserInfo response does not match subject in ID Token\"));\n }\n\n response.profile = this._claimsService.mergeClaims(response.profile, this._claimsService.filterProtocolClaims(claims as IdTokenClaims));\n logger.debug(\"user info claims received, updated profile:\", response.profile);\n }\n\n protected async _processCode(response: SigninResponse, state: SigninState, extraHeaders?: Record<string, ExtraHeader>): Promise<void> {\n const logger = this._logger.create(\"_processCode\");\n if (response.code) {\n logger.debug(\"Validating code\");\n const tokenResponse = await this._tokenClient.exchangeCode({\n client_id: state.client_id,\n client_secret: state.client_secret,\n code: response.code,\n redirect_uri: state.redirect_uri,\n code_verifier: state.code_verifier,\n extraHeaders: extraHeaders,\n ...state.extraTokenParams,\n });\n Object.assign(response, tokenResponse);\n } else {\n logger.debug(\"No code to process\");\n }\n }\n\n protected _validateIdTokenAttributes(response: SigninResponse, existingToken?: string, nonce?: string): void {\n const logger = this._logger.create(\"_validateIdTokenAttributes\");\n\n logger.debug(\"decoding ID Token JWT\");\n const incoming = JwtUtils.decode(response.id_token ?? \"\");\n\n if (!incoming.sub) {\n logger.throw(new Error(\"ID Token is missing a subject claim\"));\n }\n\n if (nonce && incoming.nonce !== nonce) {\n logger.throw(new Error(\"nonce in id_token does not match nonce in client storage\"));\n }\n\n if (existingToken) {\n const existing = JwtUtils.decode(existingToken);\n if (incoming.sub !== existing.sub) {\n logger.throw(new Error(\"sub in id_token does not match current sub\"));\n }\n if (incoming.auth_time && incoming.auth_time !== existing.auth_time) {\n logger.throw(new Error(\"auth_time in id_token does not match original auth_time\"));\n }\n if (incoming.azp && incoming.azp !== existing.azp) {\n logger.throw(new Error(\"azp in id_token does not match original azp\"));\n }\n if (!incoming.azp && existing.azp) {\n logger.throw(new Error(\"azp not in id_token, but present in original id_token\"));\n }\n }\n\n response.profile = incoming as UserProfile;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, CryptoUtils, Timer } from \"./utils\";\nimport type { StateStore } from \"./StateStore\";\n\n/**\n * @public\n */\nexport class State {\n public readonly id: string;\n public readonly created: number;\n public readonly request_type: string | undefined;\n public readonly url_state: string | undefined;\n\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n public readonly data?: unknown;\n\n public constructor(args: {\n id?: string;\n data?: unknown;\n created?: number;\n request_type?: string;\n url_state?: string;\n }) {\n this.id = args.id || CryptoUtils.generateUUIDv4();\n this.data = args.data;\n\n if (args.created && args.created > 0) {\n this.created = args.created;\n }\n else {\n this.created = Timer.getEpochTime();\n }\n this.request_type = args.request_type;\n this.url_state = args.url_state;\n }\n\n public toStorageString(): string {\n new Logger(\"State\").create(\"toStorageString\");\n return JSON.stringify({\n id: this.id,\n data: this.data,\n created: this.created,\n request_type: this.request_type,\n url_state: this.url_state,\n });\n }\n\n public static fromStorageString(storageString: string): Promise<State> {\n Logger.createStatic(\"State\", \"fromStorageString\");\n return Promise.resolve(new State(JSON.parse(storageString)));\n }\n\n public static async clearStaleState(storage: StateStore, age: number): Promise<void> {\n const logger = Logger.createStatic(\"State\", \"clearStaleState\");\n const cutoff = Timer.getEpochTime() - age;\n\n const keys = await storage.getAllKeys();\n logger.debug(\"got keys\", keys);\n\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const item = await storage.get(key);\n let remove = false;\n\n if (item) {\n try {\n const state = await State.fromStorageString(item);\n\n logger.debug(\"got item from key:\", key, state.created);\n if (state.created <= cutoff) {\n remove = true;\n }\n }\n catch (err) {\n logger.error(\"Error parsing state for key:\", key, err);\n remove = true;\n }\n }\n else {\n logger.debug(\"no item in storage for key:\", key);\n remove = true;\n }\n\n if (remove) {\n logger.debug(\"removed item for key:\", key);\n void storage.remove(key);\n }\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, CryptoUtils } from \"./utils\";\nimport { State } from \"./State\";\n\n/** @public */\nexport interface SigninStateArgs {\n id?: string;\n data?: unknown;\n created?: number;\n request_type?: string;\n\n code_verifier?: string;\n code_challenge?: string;\n authority: string;\n client_id: string;\n redirect_uri: string;\n scope: string;\n client_secret?: string;\n extraTokenParams?: Record<string, unknown>;\n response_mode?: \"query\" | \"fragment\";\n skipUserInfo?: boolean;\n url_state?: string;\n nonce?: string;\n}\n\n/** @public */\nexport type SigninStateCreateArgs = Omit<SigninStateArgs, \"code_verifier\"> & {\n code_verifier?: string | boolean;\n};\n\n/**\n * @public\n */\nexport class SigninState extends State {\n // isCode\n /** The same code_verifier that was used to obtain the authorization_code via PKCE. */\n public readonly code_verifier: string | undefined;\n /** Used to secure authorization code grants via Proof Key for Code Exchange (PKCE). */\n public readonly code_challenge: string | undefined;\n\n // to ensure state still matches settings\n /** @see {@link OidcClientSettings.authority} */\n public readonly authority: string;\n /** @see {@link OidcClientSettings.client_id} */\n public readonly client_id: string;\n /** @see {@link OidcClientSettings.redirect_uri} */\n public readonly redirect_uri: string;\n /** @see {@link OidcClientSettings.scope} */\n public readonly scope: string;\n /** @see {@link OidcClientSettings.client_secret} */\n public readonly client_secret: string | undefined;\n /** @see {@link OidcClientSettings.extraTokenParams} */\n public readonly extraTokenParams: Record<string, unknown> | undefined;\n /** @see {@link OidcClientSettings.response_mode} */\n public readonly response_mode: \"query\" | \"fragment\" | undefined;\n\n public readonly skipUserInfo: boolean | undefined;\n /** @see {@link SigninRequestCreateArgs.nonce} */\n public readonly nonce: string | undefined;\n\n private constructor(args: SigninStateArgs) {\n super(args);\n\n this.code_verifier = args.code_verifier;\n this.code_challenge = args.code_challenge;\n this.authority = args.authority;\n this.client_id = args.client_id;\n this.redirect_uri = args.redirect_uri;\n this.scope = args.scope;\n this.client_secret = args.client_secret;\n this.extraTokenParams = args.extraTokenParams;\n\n this.response_mode = args.response_mode;\n this.skipUserInfo = args.skipUserInfo;\n this.nonce = args.nonce;\n }\n\n public static async create(args: SigninStateCreateArgs): Promise<SigninState> {\n const code_verifier = args.code_verifier === true ? CryptoUtils.generateCodeVerifier() : (args.code_verifier || undefined);\n const code_challenge = code_verifier ? (await CryptoUtils.generateCodeChallenge(code_verifier)) : undefined;\n\n return new SigninState({\n ...args,\n code_verifier,\n code_challenge,\n });\n }\n\n public toStorageString(): string {\n new Logger(\"SigninState\").create(\"toStorageString\");\n return JSON.stringify({\n id: this.id,\n data: this.data,\n created: this.created,\n request_type: this.request_type,\n url_state: this.url_state,\n\n code_verifier: this.code_verifier,\n authority: this.authority,\n client_id: this.client_id,\n redirect_uri: this.redirect_uri,\n scope: this.scope,\n client_secret: this.client_secret,\n extraTokenParams : this.extraTokenParams,\n response_mode: this.response_mode,\n skipUserInfo: this.skipUserInfo,\n nonce: this.nonce,\n });\n }\n\n public static fromStorageString(storageString: string): Promise<SigninState> {\n Logger.createStatic(\"SigninState\", \"fromStorageString\");\n const data = JSON.parse(storageString);\n return SigninState.create(data);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, URL_STATE_DELIMITER } from \"./utils\";\nimport { SigninState } from \"./SigninState\";\n\n/**\n * @public\n * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest\n */\nexport interface SigninRequestCreateArgs {\n // mandatory\n url: string;\n authority: string;\n client_id: string;\n redirect_uri: string;\n response_type: string;\n scope: string;\n\n // optional\n response_mode?: \"query\" | \"fragment\";\n nonce?: string;\n display?: string;\n dpopJkt?: string;\n prompt?: string;\n max_age?: number;\n ui_locales?: string;\n id_token_hint?: string;\n login_hint?: string;\n acr_values?: string;\n\n // other\n resource?: string | string[];\n request?: string;\n request_uri?: string;\n request_type?: string;\n extraQueryParams?: Record<string, string | number | boolean>;\n\n // special\n extraTokenParams?: Record<string, unknown>;\n client_secret?: string;\n skipUserInfo?: boolean;\n disablePKCE?: boolean;\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n state_data?: unknown;\n url_state?: string;\n omitScopeWhenRequesting?: boolean;\n}\n\n/**\n * @public\n */\nexport class SigninRequest {\n private static readonly _logger = new Logger(\"SigninRequest\");\n\n public readonly url: string;\n public readonly state: SigninState;\n\n private constructor(args: {\n url: string;\n state: SigninState;\n }) {\n this.url = args.url;\n this.state = args.state;\n }\n\n public static async create({\n // mandatory\n url, authority, client_id, redirect_uri, response_type, scope,\n // optional\n state_data, response_mode, request_type, client_secret, nonce, url_state,\n resource,\n skipUserInfo,\n extraQueryParams,\n extraTokenParams,\n disablePKCE,\n dpopJkt,\n omitScopeWhenRequesting,\n ...optionalParams\n }: SigninRequestCreateArgs): Promise<SigninRequest> {\n if (!url) {\n this._logger.error(\"create: No url passed\");\n throw new Error(\"url\");\n }\n if (!client_id) {\n this._logger.error(\"create: No client_id passed\");\n throw new Error(\"client_id\");\n }\n if (!redirect_uri) {\n this._logger.error(\"create: No redirect_uri passed\");\n throw new Error(\"redirect_uri\");\n }\n if (!response_type) {\n this._logger.error(\"create: No response_type passed\");\n throw new Error(\"response_type\");\n }\n if (!scope) {\n this._logger.error(\"create: No scope passed\");\n throw new Error(\"scope\");\n }\n if (!authority) {\n this._logger.error(\"create: No authority passed\");\n throw new Error(\"authority\");\n }\n\n const state = await SigninState.create({\n data: state_data,\n request_type,\n url_state,\n code_verifier: !disablePKCE,\n client_id, authority, redirect_uri,\n response_mode,\n client_secret, scope, extraTokenParams,\n skipUserInfo,\n nonce,\n });\n\n const parsedUrl = new URL(url);\n parsedUrl.searchParams.append(\"client_id\", client_id);\n parsedUrl.searchParams.append(\"redirect_uri\", redirect_uri);\n parsedUrl.searchParams.append(\"response_type\", response_type);\n if (!omitScopeWhenRequesting) {\n parsedUrl.searchParams.append(\"scope\", scope);\n }\n if (nonce) {\n parsedUrl.searchParams.append(\"nonce\", nonce);\n }\n\n if (dpopJkt) {\n parsedUrl.searchParams.append(\"dpop_jkt\", dpopJkt);\n }\n\n let stateParam = state.id;\n if (url_state) {\n stateParam = `${stateParam}${URL_STATE_DELIMITER}${url_state}`;\n }\n parsedUrl.searchParams.append(\"state\", stateParam);\n if (state.code_challenge) {\n parsedUrl.searchParams.append(\"code_challenge\", state.code_challenge);\n parsedUrl.searchParams.append(\"code_challenge_method\", \"S256\");\n }\n\n if (resource) {\n // https://datatracker.ietf.org/doc/html/rfc8707\n const resources = Array.isArray(resource) ? resource : [resource];\n resources\n .forEach(r => parsedUrl.searchParams.append(\"resource\", r));\n }\n\n for (const [key, value] of Object.entries({ response_mode, ...optionalParams, ...extraQueryParams })) {\n if (value != null) {\n parsedUrl.searchParams.append(key, value.toString());\n }\n }\n\n return new SigninRequest({\n url: parsedUrl.href,\n state,\n });\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Timer, URL_STATE_DELIMITER } from \"./utils\";\nimport type { UserProfile } from \"./User\";\n\nconst OidcScope = \"openid\";\n\n/**\n * @public\n * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthResponse\n * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n */\nexport class SigninResponse {\n // props present in the initial callback response regardless of success\n public readonly state: string | null;\n /** @see {@link User.session_state} */\n public session_state: string | null;\n\n // error props\n /** @see {@link ErrorResponse.error} */\n public readonly error: string | null;\n /** @see {@link ErrorResponse.error_description} */\n public readonly error_description: string | null;\n /** @see {@link ErrorResponse.error_uri} */\n public readonly error_uri: string | null;\n\n // success props\n public readonly code: string | null;\n\n // props set after validation\n /** @see {@link User.id_token} */\n public id_token?: string;\n /** @see {@link User.access_token} */\n public access_token = \"\";\n /** @see {@link User.token_type} */\n public token_type = \"\";\n /** @see {@link User.refresh_token} */\n public refresh_token?: string;\n /** @see {@link User.scope} */\n public scope?: string;\n /** @see {@link User.expires_at} */\n public expires_at?: number;\n\n /** custom state data set during the initial signin request */\n public userState: unknown;\n public url_state?: string;\n\n /** @see {@link User.profile} */\n public profile: UserProfile = {} as UserProfile;\n\n public constructor(params: URLSearchParams) {\n this.state = params.get(\"state\");\n this.session_state = params.get(\"session_state\");\n if (this.state) {\n const splitState = decodeURIComponent(this.state).split(URL_STATE_DELIMITER);\n this.state = splitState[0];\n if (splitState.length > 1) {\n this.url_state = splitState.slice(1).join(URL_STATE_DELIMITER);\n }\n }\n\n this.error = params.get(\"error\");\n this.error_description = params.get(\"error_description\");\n this.error_uri = params.get(\"error_uri\");\n\n this.code = params.get(\"code\");\n }\n\n public get expires_in(): number | undefined {\n if (this.expires_at === undefined) {\n return undefined;\n }\n return this.expires_at - Timer.getEpochTime();\n }\n public set expires_in(value: number | undefined) {\n // spec expects a number, but normalize here just in case\n if (typeof value === \"string\") value = Number(value);\n if (value !== undefined && value >= 0) {\n this.expires_at = Math.floor(value) + Timer.getEpochTime();\n }\n }\n\n public get isOpenId(): boolean {\n return this.scope?.split(\" \").includes(OidcScope) || !!this.id_token;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, URL_STATE_DELIMITER } from \"./utils\";\nimport { State } from \"./State\";\n\n/**\n * @public\n * @see https://openid.net/specs/openid-connect-rpinitiated-1_0.html#RPLogout\n */\nexport interface SignoutRequestArgs {\n // mandatory\n url: string;\n\n // optional\n id_token_hint?: string;\n client_id?: string;\n post_logout_redirect_uri?: string;\n extraQueryParams?: Record<string, string | number | boolean>;\n\n // special\n request_type?: string;\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n state_data?: unknown;\n url_state?: string;\n}\n\n/**\n * @public\n */\nexport class SignoutRequest {\n private readonly _logger = new Logger(\"SignoutRequest\");\n\n public readonly url: string;\n public readonly state?: State;\n\n public constructor({\n url,\n state_data, id_token_hint, post_logout_redirect_uri, extraQueryParams, request_type, client_id, url_state,\n }: SignoutRequestArgs) {\n if (!url) {\n this._logger.error(\"ctor: No url passed\");\n throw new Error(\"url\");\n }\n\n const parsedUrl = new URL(url);\n if (id_token_hint) {\n parsedUrl.searchParams.append(\"id_token_hint\", id_token_hint);\n }\n if (client_id) {\n parsedUrl.searchParams.append(\"client_id\", client_id);\n }\n\n if (post_logout_redirect_uri) {\n parsedUrl.searchParams.append(\"post_logout_redirect_uri\", post_logout_redirect_uri);\n\n // Add state if either data needs to be stored, or url_state set for an intermediate proxy\n if (state_data || url_state) {\n this.state = new State({ data: state_data, request_type, url_state });\n\n let stateParam = this.state.id;\n if (url_state) {\n stateParam = `${stateParam}${URL_STATE_DELIMITER}${url_state}`;\n }\n parsedUrl.searchParams.append(\"state\", stateParam);\n }\n }\n\n for (const [key, value] of Object.entries({ ...extraQueryParams })) {\n if (value != null) {\n parsedUrl.searchParams.append(key, value.toString());\n }\n }\n\n this.url = parsedUrl.href;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { URL_STATE_DELIMITER } from \"./utils\";\n\n/**\n * @public\n * @see https://openid.net/specs/openid-connect-core-1_0.html#AuthError\n */\nexport class SignoutResponse {\n public readonly state: string | null;\n\n // error props\n /** @see {@link ErrorResponse.error} */\n public error: string | null;\n /** @see {@link ErrorResponse.error_description} */\n public error_description: string | null;\n /** @see {@link ErrorResponse.error_uri} */\n public error_uri: string | null;\n\n /** custom state data set during the initial signin request */\n public userState: unknown;\n public url_state?: string;\n\n public constructor(params: URLSearchParams) {\n this.state = params.get(\"state\");\n if (this.state) {\n const splitState = decodeURIComponent(this.state).split(URL_STATE_DELIMITER);\n this.state = splitState[0];\n if (splitState.length > 1) {\n this.url_state = splitState.slice(1).join(URL_STATE_DELIMITER);\n }\n }\n\n this.error = params.get(\"error\");\n this.error_description = params.get(\"error_description\");\n this.error_uri = params.get(\"error_uri\");\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport type { JwtClaims } from \"./Claims\";\nimport type { OidcClientSettingsStore } from \"./OidcClientSettings\";\nimport type { UserProfile } from \"./User\";\nimport { Logger } from \"./utils\";\n\n/**\n * Protocol claims that could be removed by default from profile.\n * Derived from the following sets of claims:\n * - {@link https://datatracker.ietf.org/doc/html/rfc7519.html#section-4.1}\n * - {@link https://openid.net/specs/openid-connect-core-1_0.html#IDToken}\n * - {@link https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken}\n *\n * @internal\n */\nconst DefaultProtocolClaims = [\n \"nbf\",\n \"jti\",\n \"auth_time\",\n \"nonce\",\n \"acr\",\n \"amr\",\n \"azp\",\n \"at_hash\", // https://openid.net/specs/openid-connect-core-1_0.html#CodeIDToken\n] as const;\n\n/**\n * Protocol claims that should never be removed from profile.\n * \"sub\" is needed internally and others should remain required as per the OIDC specs.\n *\n * @internal\n */\nconst InternalRequiredProtocolClaims = [\"sub\", \"iss\", \"aud\", \"exp\", \"iat\"];\n\n/**\n * @internal\n */\nexport class ClaimsService {\n protected readonly _logger = new Logger(\"ClaimsService\");\n public constructor(\n protected readonly _settings: OidcClientSettingsStore,\n ) {}\n\n public filterProtocolClaims(claims: UserProfile): UserProfile {\n const result = { ...claims };\n\n if (this._settings.filterProtocolClaims) {\n let protocolClaims;\n if (Array.isArray(this._settings.filterProtocolClaims)) {\n protocolClaims = this._settings.filterProtocolClaims;\n } else {\n protocolClaims = DefaultProtocolClaims;\n }\n\n for (const claim of protocolClaims) {\n if (!InternalRequiredProtocolClaims.includes(claim)) {\n delete result[claim];\n }\n }\n }\n\n return result;\n }\n\n public mergeClaims(claims1: JwtClaims, claims2: JwtClaims): UserProfile;\n public mergeClaims(claims1: UserProfile, claims2: JwtClaims): UserProfile {\n const result = { ...claims1 };\n for (const [claim, values] of Object.entries(claims2)) {\n if (result[claim] !== values) {\n if (Array.isArray(result[claim]) || Array.isArray(values)) {\n if (this._settings.mergeClaimsStrategy.array == \"replace\") {\n result[claim] = values;\n } else {\n const mergedValues = Array.isArray(result[claim]) ? result[claim] as unknown[] : [result[claim]];\n for (const value of Array.isArray(values) ? values : [values]) {\n if (!mergedValues.includes(value)) {\n mergedValues.push(value);\n }\n }\n result[claim] = mergedValues;\n }\n } else if (typeof result[claim] === \"object\" && typeof values === \"object\") {\n result[claim] = this.mergeClaims(result[claim] as JwtClaims, values as JwtClaims);\n } else {\n result[claim] = values;\n }\n }\n }\n\n return result;\n }\n}\n","/**\n * @public\n */\nexport interface DPoPStore {\n set(key: string, value: DPoPState): Promise<void>;\n get(key: string): Promise<DPoPState>;\n remove(key: string): Promise<DPoPState>;\n getAllKeys(): Promise<string[]>;\n}\n\n/**\n * @public\n */\nexport class DPoPState {\n public constructor(\n public readonly keys: CryptoKeyPair,\n public nonce?: string,\n ) { }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { CryptoUtils, Logger, UrlUtils } from \"./utils\";\nimport { ErrorResponse } from \"./errors\";\nimport { type ExtraHeader, type OidcClientSettings, OidcClientSettingsStore } from \"./OidcClientSettings\";\nimport { ResponseValidator } from \"./ResponseValidator\";\nimport { MetadataService } from \"./MetadataService\";\nimport type { RefreshState } from \"./RefreshState\";\nimport { SigninRequest, type SigninRequestCreateArgs } from \"./SigninRequest\";\nimport { SigninResponse } from \"./SigninResponse\";\nimport { SignoutRequest, type SignoutRequestArgs } from \"./SignoutRequest\";\nimport { SignoutResponse } from \"./SignoutResponse\";\nimport { SigninState } from \"./SigninState\";\nimport { State } from \"./State\";\nimport { TokenClient } from \"./TokenClient\";\nimport { ClaimsService } from \"./ClaimsService\";\nimport { DPoPState, type DPoPStore } from \"./DPoPStore\";\nimport { ErrorDPoPNonce } from \"./errors/ErrorDPoPNonce\";\n\n/**\n * @public\n */\nexport interface CreateSigninRequestArgs\n extends Omit<SigninRequestCreateArgs, \"url\" | \"authority\" | \"client_id\" | \"redirect_uri\" | \"response_type\" | \"scope\" | \"state_data\"> {\n redirect_uri?: string;\n response_type?: string;\n scope?: string;\n dpopJkt?: string;\n\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n state?: unknown;\n}\n\n/**\n * @public\n */\nexport interface UseRefreshTokenArgs {\n redirect_uri?: string;\n resource?: string | string[];\n extraTokenParams?: Record<string, unknown>;\n timeoutInSeconds?: number;\n\n state: RefreshState;\n\n extraHeaders?: Record<string, ExtraHeader>;\n}\n\n/**\n * @public\n */\nexport type CreateSignoutRequestArgs = Omit<SignoutRequestArgs, \"url\" | \"state_data\"> & {\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n state?: unknown;\n};\n\n/**\n * @public\n */\nexport type ProcessResourceOwnerPasswordCredentialsArgs = {\n username: string;\n password: string;\n skipUserInfo?: boolean;\n extraTokenParams?: Record<string, unknown>;\n};\n\n/**\n * Provides the raw OIDC/OAuth2 protocol support for the authorization endpoint and the end session endpoint in the\n * authorization server. It provides a bare-bones protocol implementation and is used by the UserManager class.\n * Only use this class if you simply want protocol support without the additional management features of the\n * UserManager class.\n *\n * @public\n */\nexport class OidcClient {\n public readonly settings: OidcClientSettingsStore;\n protected readonly _logger = new Logger(\"OidcClient\");\n\n public readonly metadataService: MetadataService;\n protected readonly _claimsService: ClaimsService;\n protected readonly _validator: ResponseValidator;\n protected readonly _tokenClient: TokenClient;\n\n public constructor(settings: OidcClientSettings);\n public constructor(settings: OidcClientSettingsStore, metadataService: MetadataService);\n public constructor(settings: OidcClientSettings | OidcClientSettingsStore, metadataService?: MetadataService) {\n this.settings = settings instanceof OidcClientSettingsStore ? settings : new OidcClientSettingsStore(settings);\n\n this.metadataService = metadataService ?? new MetadataService(this.settings);\n this._claimsService = new ClaimsService(this.settings);\n this._validator = new ResponseValidator(this.settings, this.metadataService, this._claimsService);\n this._tokenClient = new TokenClient(this.settings, this.metadataService);\n }\n\n public async createSigninRequest({\n state,\n request,\n request_uri,\n request_type,\n id_token_hint,\n login_hint,\n skipUserInfo,\n nonce,\n url_state,\n response_type = this.settings.response_type,\n scope = this.settings.scope,\n redirect_uri = this.settings.redirect_uri,\n prompt = this.settings.prompt,\n display = this.settings.display,\n max_age = this.settings.max_age,\n ui_locales = this.settings.ui_locales,\n acr_values = this.settings.acr_values,\n resource = this.settings.resource,\n response_mode = this.settings.response_mode,\n extraQueryParams = this.settings.extraQueryParams,\n extraTokenParams = this.settings.extraTokenParams,\n dpopJkt,\n omitScopeWhenRequesting = this.settings.omitScopeWhenRequesting,\n }: CreateSigninRequestArgs): Promise<SigninRequest> {\n const logger = this._logger.create(\"createSigninRequest\");\n\n if (response_type !== \"code\") {\n throw new Error(\"Only the Authorization Code flow (with PKCE) is supported\");\n }\n\n const url = await this.metadataService.getAuthorizationEndpoint();\n logger.debug(\"Received authorization endpoint\", url);\n\n const signinRequest = await SigninRequest.create({\n url,\n authority: this.settings.authority,\n client_id: this.settings.client_id,\n redirect_uri,\n response_type,\n scope,\n state_data: state,\n url_state,\n prompt, display, max_age, ui_locales, id_token_hint, login_hint, acr_values, dpopJkt,\n resource, request, request_uri, extraQueryParams, extraTokenParams, request_type, response_mode,\n client_secret: this.settings.client_secret,\n skipUserInfo,\n nonce,\n disablePKCE: this.settings.disablePKCE,\n omitScopeWhenRequesting,\n });\n\n // house cleaning\n await this.clearStaleState();\n\n const signinState = signinRequest.state;\n await this.settings.stateStore.set(signinState.id, signinState.toStorageString());\n return signinRequest;\n }\n\n public async readSigninResponseState(url: string, removeState = false): Promise<{ state: SigninState; response: SigninResponse }> {\n const logger = this._logger.create(\"readSigninResponseState\");\n\n const response = new SigninResponse(UrlUtils.readParams(url, this.settings.response_mode));\n if (!response.state) {\n logger.throw(new Error(\"No state in response\"));\n // need to throw within this function's body for type narrowing to work\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n const storedStateString = await this.settings.stateStore[removeState ? \"remove\" : \"get\"](response.state);\n if (!storedStateString) {\n logger.throw(new Error(\"No matching state found in storage\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n const state = await SigninState.fromStorageString(storedStateString);\n return { state, response };\n }\n\n public async processSigninResponse(url: string, extraHeaders?: Record<string, ExtraHeader>, removeState = true): Promise<SigninResponse> {\n const logger = this._logger.create(\"processSigninResponse\");\n\n const { state, response } = await this.readSigninResponseState(url, removeState);\n logger.debug(\"received state from storage; validating response\");\n\n if (this.settings.dpop && this.settings.dpop.store) {\n const dpopProof = await this.getDpopProof(this.settings.dpop.store);\n extraHeaders = { ...extraHeaders, \"DPoP\": dpopProof };\n }\n\n /**\n * The DPoP spec describes a method for Authorization Servers to supply a nonce value\n * in order to limit the lifetime of a given DPoP proof.\n * See https://datatracker.ietf.org/doc/html/rfc9449#name-authorization-server-provid\n * This involves the AS returning a 400 bad request with a DPoP-Nonce header containing\n * the nonce value. The client must then retry the request with a recomputed DPoP proof\n * containing the supplied nonce value.\n */\n try {\n await this._validator.validateSigninResponse(response, state, extraHeaders);\n }\n catch (err) {\n if (err instanceof ErrorDPoPNonce && this.settings.dpop) {\n const dpopProof = await this.getDpopProof(this.settings.dpop.store, err.nonce);\n extraHeaders![\"DPoP\"] = dpopProof;\n await this._validator.validateSigninResponse(response, state, extraHeaders);\n } else {\n throw err;\n }\n }\n\n return response;\n }\n\n async getDpopProof(dpopStore: DPoPStore, nonce?: string): Promise<string> {\n let keyPair: CryptoKeyPair;\n let dpopState: DPoPState;\n\n if (!(await dpopStore.getAllKeys()).includes(this.settings.client_id)) {\n keyPair = await CryptoUtils.generateDPoPKeys();\n dpopState = new DPoPState(keyPair, nonce);\n await dpopStore.set(this.settings.client_id, dpopState);\n } else {\n dpopState = await dpopStore.get(this.settings.client_id);\n\n // if the server supplied nonce has changed since the last request, update the nonce\n if (dpopState.nonce !== nonce && nonce) {\n dpopState.nonce = nonce;\n await dpopStore.set(this.settings.client_id, dpopState);\n }\n }\n\n return await CryptoUtils.generateDPoPProof({\n url: await this.metadataService.getTokenEndpoint(false),\n httpMethod: \"POST\",\n keyPair: dpopState.keys,\n nonce: dpopState.nonce,\n });\n }\n\n public async processResourceOwnerPasswordCredentials({\n username,\n password,\n skipUserInfo = false,\n extraTokenParams = {},\n }: ProcessResourceOwnerPasswordCredentialsArgs): Promise<SigninResponse> {\n const tokenResponse: Record<string, unknown> = await this._tokenClient.exchangeCredentials({ username, password, ...extraTokenParams });\n const signinResponse: SigninResponse = new SigninResponse(new URLSearchParams());\n Object.assign(signinResponse, tokenResponse);\n await this._validator.validateCredentialsResponse(signinResponse, skipUserInfo);\n return signinResponse;\n }\n\n public async useRefreshToken({\n state,\n redirect_uri,\n resource,\n timeoutInSeconds,\n extraHeaders,\n extraTokenParams,\n }: UseRefreshTokenArgs): Promise<SigninResponse> {\n const logger = this._logger.create(\"useRefreshToken\");\n\n // https://github.com/authts/oidc-client-ts/issues/695\n // In some cases (e.g. AzureAD), not all granted scopes are allowed on token refresh requests.\n // Therefore, we filter all granted scopes by a list of allowable scopes.\n let scope;\n if (this.settings.refreshTokenAllowedScope === undefined) {\n scope = state.scope;\n } else {\n const allowableScopes = this.settings.refreshTokenAllowedScope.split(\" \");\n const providedScopes = state.scope?.split(\" \") || [];\n\n scope = providedScopes.filter(s => allowableScopes.includes(s)).join(\" \");\n }\n\n if (this.settings.dpop && this.settings.dpop.store) {\n const dpopProof = await this.getDpopProof(this.settings.dpop.store);\n extraHeaders = { ...extraHeaders, \"DPoP\": dpopProof };\n }\n\n /**\n * The DPoP spec describes a method for Authorization Servers to supply a nonce value\n * in order to limit the lifetime of a given DPoP proof.\n * See https://datatracker.ietf.org/doc/html/rfc9449#name-authorization-server-provid\n * This involves the AS returning a 400 bad request with a DPoP-Nonce header containing\n * the nonce value. The client must then retry the request with a recomputed DPoP proof\n * containing the supplied nonce value.\n */\n let result;\n try {\n result = await this._tokenClient.exchangeRefreshToken({\n refresh_token: state.refresh_token,\n // provide the (possible filtered) scope list\n scope,\n redirect_uri,\n resource,\n timeoutInSeconds,\n extraHeaders,\n ...extraTokenParams,\n });\n } catch (err) {\n if (err instanceof ErrorDPoPNonce && this.settings.dpop) {\n extraHeaders![\"DPoP\"] = await this.getDpopProof(this.settings.dpop.store, err.nonce);\n result = await this._tokenClient.exchangeRefreshToken({\n refresh_token: state.refresh_token,\n // provide the (possible filtered) scope list\n scope,\n redirect_uri,\n resource,\n timeoutInSeconds,\n extraHeaders,\n ...extraTokenParams,\n });\n } else {\n throw err;\n }\n }\n\n const response = new SigninResponse(new URLSearchParams());\n Object.assign(response, result);\n logger.debug(\"validating response\", response);\n await this._validator.validateRefreshResponse(response, {\n ...state,\n // override the scope in the state handed over to the validator\n // so it can set the granted scope to the requested scope in case none is included in the response\n scope,\n });\n return response;\n }\n\n public async createSignoutRequest({\n state,\n id_token_hint,\n client_id,\n request_type,\n url_state,\n post_logout_redirect_uri = this.settings.post_logout_redirect_uri,\n extraQueryParams = this.settings.extraQueryParams,\n }: CreateSignoutRequestArgs = {}): Promise<SignoutRequest> {\n const logger = this._logger.create(\"createSignoutRequest\");\n\n const url = await this.metadataService.getEndSessionEndpoint();\n if (!url) {\n logger.throw(new Error(\"No end session endpoint\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n logger.debug(\"Received end session endpoint\", url);\n\n // specify the client identifier when post_logout_redirect_uri is used but id_token_hint is not\n if (!client_id && post_logout_redirect_uri && !id_token_hint) {\n client_id = this.settings.client_id;\n }\n\n const request = new SignoutRequest({\n url,\n id_token_hint,\n client_id,\n post_logout_redirect_uri,\n state_data: state,\n extraQueryParams,\n request_type,\n url_state,\n });\n\n // house cleaning\n await this.clearStaleState();\n\n const signoutState = request.state;\n if (signoutState) {\n logger.debug(\"Signout request has state to persist\");\n await this.settings.stateStore.set(signoutState.id, signoutState.toStorageString());\n }\n\n return request;\n }\n\n public async readSignoutResponseState(url: string, removeState = false): Promise<{ state: State | undefined; response: SignoutResponse }> {\n const logger = this._logger.create(\"readSignoutResponseState\");\n\n const response = new SignoutResponse(UrlUtils.readParams(url, this.settings.response_mode));\n if (!response.state) {\n logger.debug(\"No state in response\");\n\n if (response.error) {\n logger.warn(\"Response was error:\", response.error);\n throw new ErrorResponse(response);\n }\n\n return { state: undefined, response };\n }\n\n const storedStateString = await this.settings.stateStore[removeState ? \"remove\" : \"get\"](response.state);\n if (!storedStateString) {\n logger.throw(new Error(\"No matching state found in storage\"));\n // eslint-disable-next-line @typescript-eslint/only-throw-error\n throw null; // https://github.com/microsoft/TypeScript/issues/46972\n }\n\n const state = await State.fromStorageString(storedStateString);\n return { state, response };\n }\n\n public async processSignoutResponse(url: string): Promise<SignoutResponse> {\n const logger = this._logger.create(\"processSignoutResponse\");\n\n const { state, response } = await this.readSignoutResponseState(url, true);\n if (state) {\n logger.debug(\"Received state from storage; validating response\");\n this._validator.validateSignoutResponse(response, state);\n } else {\n logger.debug(\"No state from storage; skipping response validation\");\n }\n\n return response;\n }\n\n public clearStaleState(): Promise<void> {\n this._logger.create(\"clearStaleState\");\n return State.clearStaleState(this.settings.stateStore, this.settings.staleStateAgeInSeconds);\n }\n\n public async revokeToken(token: string, type?: \"access_token\" | \"refresh_token\"): Promise<void> {\n this._logger.create(\"revokeToken\");\n return await this._tokenClient.revoke({\n token,\n token_type_hint: type,\n });\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"./utils\";\nimport { CheckSessionIFrame } from \"./CheckSessionIFrame\";\nimport type { UserManager } from \"./UserManager\";\nimport type { User } from \"./User\";\n\n/**\n * @public\n */\nexport class SessionMonitor {\n private readonly _logger = new Logger(\"SessionMonitor\");\n\n private _sub: string | undefined;\n private _checkSessionIFrame?: CheckSessionIFrame;\n\n public constructor(private readonly _userManager: UserManager) {\n if (!_userManager) {\n this._logger.throw(new Error(\"No user manager passed\"));\n }\n\n this._userManager.events.addUserLoaded(this._start);\n this._userManager.events.addUserUnloaded(this._stop);\n\n this._init().catch((err: unknown) => {\n // catch to suppress errors since we're in a ctor\n this._logger.error(err);\n });\n }\n\n protected async _init(): Promise<void> {\n this._logger.create(\"_init\");\n const user = await this._userManager.getUser();\n // doing this manually here since calling getUser\n // doesn't trigger load event.\n if (user) {\n void this._start(user);\n }\n else if (this._userManager.settings.monitorAnonymousSession) {\n const session = await this._userManager.querySessionStatus();\n if (session) {\n const tmpUser = {\n session_state: session.session_state,\n profile: session.sub ? {\n sub: session.sub,\n } : null,\n };\n void this._start(tmpUser);\n }\n }\n }\n\n protected _start = async (\n user: User | {\n session_state: string;\n profile: { sub: string } | null;\n },\n ): Promise<void> => {\n const session_state = user.session_state;\n if (!session_state) {\n return;\n }\n const logger = this._logger.create(\"_start\");\n\n if (user.profile) {\n this._sub = user.profile.sub;\n logger.debug(\"session_state\", session_state, \", sub\", this._sub);\n }\n else {\n this._sub = undefined;\n logger.debug(\"session_state\", session_state, \", anonymous user\");\n }\n\n if (this._checkSessionIFrame) {\n this._checkSessionIFrame.start(session_state);\n return;\n }\n\n try {\n const url = await this._userManager.metadataService.getCheckSessionIframe();\n if (url) {\n logger.debug(\"initializing check session iframe\");\n\n const client_id = this._userManager.settings.client_id;\n const intervalInSeconds = this._userManager.settings.checkSessionIntervalInSeconds;\n const stopOnError = this._userManager.settings.stopCheckSessionOnError;\n\n const checkSessionIFrame = new CheckSessionIFrame(this._callback, client_id, url, intervalInSeconds, stopOnError);\n await checkSessionIFrame.load();\n this._checkSessionIFrame = checkSessionIFrame;\n checkSessionIFrame.start(session_state);\n }\n else {\n logger.warn(\"no check session iframe found in the metadata\");\n }\n }\n catch (err) {\n // catch to suppress errors since we're in non-promise callback\n logger.error(\"Error from getCheckSessionIframe:\", err instanceof Error ? err.message : err);\n }\n };\n\n protected _stop = (): void => {\n const logger = this._logger.create(\"_stop\");\n this._sub = undefined;\n\n if (this._checkSessionIFrame) {\n this._checkSessionIFrame.stop();\n }\n\n if (this._userManager.settings.monitorAnonymousSession) {\n // using a timer to delay re-initialization to avoid race conditions during signout\n // TODO rewrite to use promise correctly\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n const timerHandle = setInterval(async () => {\n clearInterval(timerHandle);\n\n try {\n const session = await this._userManager.querySessionStatus();\n if (session) {\n const tmpUser = {\n session_state: session.session_state,\n profile: session.sub ? {\n sub: session.sub,\n } : null,\n };\n void this._start(tmpUser);\n }\n }\n catch (err) {\n // catch to suppress errors since we're in a callback\n logger.error(\"error from querySessionStatus\", err instanceof Error ? err.message : err);\n }\n }, 1000);\n }\n };\n\n protected _callback = async (): Promise<void> => {\n const logger = this._logger.create(\"_callback\");\n try {\n const session = await this._userManager.querySessionStatus();\n let raiseEvent = true;\n\n if (session && this._checkSessionIFrame) {\n if (session.sub === this._sub) {\n raiseEvent = false;\n this._checkSessionIFrame.start(session.session_state);\n\n logger.debug(\"same sub still logged in at OP, session state has changed, restarting check session iframe; session_state\", session.session_state);\n await this._userManager.events._raiseUserSessionChanged();\n }\n else {\n logger.debug(\"different subject signed into OP\", session.sub);\n }\n }\n else {\n logger.debug(\"subject no longer signed into OP\");\n }\n\n if (raiseEvent) {\n if (this._sub) {\n await this._userManager.events._raiseUserSignedOut();\n }\n else {\n await this._userManager.events._raiseUserSignedIn();\n }\n } else {\n logger.debug(\"no change in session detected, no event to raise\");\n }\n }\n catch (err) {\n if (this._sub) {\n logger.debug(\"Error calling queryCurrentSigninSession; raising signed out event\", err);\n await this._userManager.events._raiseUserSignedOut();\n }\n }\n };\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, Timer } from \"./utils\";\nimport type { IdTokenClaims } from \"./Claims\";\n\n/**\n * Holds claims represented by a combination of the `id_token` and the user info endpoint.\n *\n * @public\n */\nexport type UserProfile = IdTokenClaims;\n\n/**\n * @public\n */\nexport class User {\n /**\n * A JSON Web Token (JWT). Only provided if `openid` scope was requested.\n * The application can access the data decoded by using the `profile` property.\n */\n public id_token?: string;\n\n /** The session state value returned from the OIDC provider. */\n public session_state: string | null;\n\n /**\n * The requested access token returned from the OIDC provider. The application can use this token to\n * authenticate itself to the secured resource.\n */\n public access_token: string;\n\n /**\n * An OAuth 2.0 refresh token. The app can use this token to acquire additional access tokens after the\n * current access token expires. Refresh tokens are long-lived and can be used to maintain access to resources\n * for extended periods of time.\n */\n public refresh_token?: string;\n\n /** Typically \"Bearer\" */\n public token_type: string;\n\n /** The scopes that the requested access token is valid for. */\n public scope?: string;\n\n /** The claims represented by a combination of the `id_token` and the user info endpoint. */\n public profile: UserProfile;\n\n /** The expires at returned from the OIDC provider. */\n public expires_at?: number;\n\n /** custom state data set during the initial signin request */\n public readonly state: unknown;\n public readonly url_state?: string;\n\n public constructor(args: {\n id_token?: string;\n session_state?: string | null;\n access_token: string;\n refresh_token?: string;\n token_type: string;\n scope?: string;\n profile: UserProfile;\n expires_at?: number;\n userState?: unknown;\n url_state?: string;\n }) {\n this.id_token = args.id_token;\n this.session_state = args.session_state ?? null;\n this.access_token = args.access_token;\n this.refresh_token = args.refresh_token;\n\n this.token_type = args.token_type;\n this.scope = args.scope;\n this.profile = args.profile;\n this.expires_at = args.expires_at;\n this.state = args.userState;\n this.url_state = args.url_state;\n }\n\n /** Computed number of seconds the access token has remaining. */\n public get expires_in(): number | undefined {\n if (this.expires_at === undefined) {\n return undefined;\n }\n return this.expires_at - Timer.getEpochTime();\n }\n\n public set expires_in(value: number | undefined) {\n if (value !== undefined) {\n this.expires_at = Math.floor(value) + Timer.getEpochTime();\n }\n }\n\n /** Computed value indicating if the access token is expired. */\n public get expired(): boolean | undefined {\n const expires_in = this.expires_in;\n if (expires_in === undefined) {\n return undefined;\n }\n return expires_in <= 0;\n }\n\n /** Array representing the parsed values from the `scope`. */\n public get scopes(): string[] {\n return this.scope?.split(\" \") ?? [];\n }\n\n public toStorageString(): string {\n new Logger(\"User\").create(\"toStorageString\");\n return JSON.stringify({\n id_token: this.id_token,\n session_state: this.session_state,\n access_token: this.access_token,\n refresh_token: this.refresh_token,\n token_type: this.token_type,\n scope: this.scope,\n profile: this.profile,\n expires_at: this.expires_at,\n });\n }\n\n public static fromStorageString(storageString: string): User {\n Logger.createStatic(\"User\", \"fromStorageString\");\n return new User(JSON.parse(storageString));\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Event, Logger, UrlUtils } from \"../utils\";\nimport type { IWindow, NavigateParams, NavigateResponse } from \"./IWindow\";\n\nconst messageSource = \"oidc-client\";\n\ninterface MessageData {\n source: string;\n url: string;\n keepOpen: boolean;\n}\n\n/**\n * Window implementation which resolves via communication from a child window\n * via the `Window.postMessage()` interface.\n *\n * @internal\n */\nexport abstract class AbstractChildWindow implements IWindow {\n protected abstract readonly _logger: Logger;\n protected readonly _abort = new Event<[reason: Error]>(\"Window navigation aborted\");\n protected readonly _disposeHandlers = new Set<() => void>();\n\n protected _window: WindowProxy | null = null;\n\n public async navigate(params: NavigateParams): Promise<NavigateResponse> {\n const logger = this._logger.create(\"navigate\");\n if (!this._window) {\n throw new Error(\"Attempted to navigate on a disposed window\");\n }\n\n logger.debug(\"setting URL in window\");\n this._window.location.replace(params.url);\n\n const { url, keepOpen } = await new Promise<MessageData>((resolve, reject) => {\n const listener = (e: MessageEvent) => {\n const data: MessageData | undefined = e.data;\n const origin = params.scriptOrigin ?? window.location.origin;\n if (e.origin !== origin || data?.source !== messageSource) {\n // silently discard events not intended for us\n return;\n }\n try {\n const state = UrlUtils.readParams(data.url, params.response_mode).get(\"state\");\n if (!state) {\n logger.warn(\"no state found in response url\");\n }\n if (e.source !== this._window && state !== params.state) {\n // MessageEvent source is a relatively modern feature, we can't rely on it\n // so we also inspect the payload for a matching state key as an alternative\n return;\n }\n }\n catch {\n this._dispose();\n reject(new Error(\"Invalid response from window\"));\n }\n resolve(data);\n };\n window.addEventListener(\"message\", listener, false);\n this._disposeHandlers.add(() => window.removeEventListener(\"message\", listener, false));\n const channel = new BroadcastChannel(`oidc-client-popup-${params.state}`);\n channel.addEventListener(\"message\", listener, false);\n this._disposeHandlers.add(() => channel.close());\n this._disposeHandlers.add(this._abort.addHandler((reason) => {\n this._dispose();\n reject(reason);\n }));\n });\n logger.debug(\"got response from window\");\n this._dispose();\n\n if (!keepOpen) {\n this.close();\n }\n\n return { url };\n }\n\n public abstract close(): void;\n\n private _dispose(): void {\n this._logger.create(\"_dispose\");\n\n for (const dispose of this._disposeHandlers) {\n dispose();\n }\n this._disposeHandlers.clear();\n }\n\n protected static _notifyParent(parent: Window | null, url: string, keepOpen = false, targetOrigin = window.location.origin): void {\n const msgData: MessageData = {\n source: messageSource,\n url,\n keepOpen,\n };\n const logger = new Logger(\"_notifyParent\");\n if (parent) {\n logger.debug(\"With parent. Using parent.postMessage.\");\n parent.postMessage(msgData, targetOrigin);\n } else {\n logger.debug(\"No parent. Using BroadcastChannel.\");\n const state = new URL(url).searchParams.get(\"state\");\n if (!state) {\n throw new Error(\"No parent and no state in URL. Can't complete notification.\");\n }\n const channel = new BroadcastChannel(`oidc-client-popup-${state}`);\n channel.postMessage(msgData);\n channel.close();\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { type OidcClientSettings, OidcClientSettingsStore } from \"./OidcClientSettings\";\nimport type { PopupWindowFeatures } from \"./utils/PopupUtils\";\nimport { WebStorageStateStore } from \"./WebStorageStateStore\";\nimport { InMemoryWebStorage } from \"./InMemoryWebStorage\";\nimport type { StateStore } from \"./StateStore\";\n\nexport const DefaultPopupWindowFeatures: PopupWindowFeatures = {\n location: false,\n toolbar: false,\n height: 640,\n closePopupWindowAfterInSeconds: -1,\n};\nexport const DefaultPopupTarget = \"_blank\";\nconst DefaultAccessTokenExpiringNotificationTimeInSeconds = 60;\nconst DefaultCheckSessionIntervalInSeconds = 2;\nexport const DefaultSilentRequestTimeoutInSeconds = 10;\n\n/**\n * The settings used to configure the {@link UserManager}.\n *\n * @public\n */\nexport interface UserManagerSettings extends OidcClientSettings {\n /** The URL for the page containing the call to signinPopupCallback to handle the callback from the OIDC/OAuth2 */\n popup_redirect_uri?: string;\n popup_post_logout_redirect_uri?: string;\n /**\n * The features parameter to window.open for the popup signin window. By default, the popup is\n * placed centered in front of the window opener.\n * (default: \\{ location: false, menubar: false, height: 640, closePopupWindowAfterInSeconds: -1 \\})\n */\n popupWindowFeatures?: PopupWindowFeatures;\n /** The target parameter to window.open for the popup signin window (default: \"_blank\") */\n popupWindowTarget?: string;\n /** The methods window.location method used to redirect (default: \"assign\") */\n redirectMethod?: \"replace\" | \"assign\";\n /** The methods target window being redirected (default: \"self\") */\n redirectTarget?: \"top\" | \"self\";\n\n /** The target to pass while calling postMessage inside iframe for callback (default: window.location.origin) */\n iframeNotifyParentOrigin?: string;\n\n /** The script origin to check during 'message' callback execution while performing silent auth via iframe (default: window.location.origin) */\n iframeScriptOrigin?: string;\n\n /** The URL for the page containing the code handling the silent renew */\n silent_redirect_uri?: string;\n /** Number of seconds to wait for the silent renew to return before assuming it has failed or timed out (default: 10) */\n silentRequestTimeoutInSeconds?: number;\n /** Flag to indicate if there should be an automatic attempt to renew the access token prior to its expiration. The automatic renew attempt starts 1 minute before the access token expires (default: true) */\n automaticSilentRenew?: boolean;\n /** Flag to validate user.profile.sub in silent renew calls (default: true) */\n validateSubOnSilentRenew?: boolean;\n /** Flag to control if id_token is included as id_token_hint in silent renew calls (default: false) */\n includeIdTokenInSilentRenew?: boolean;\n\n /** Will raise events for when user has performed a signout at the OP (default: false) */\n monitorSession?: boolean;\n monitorAnonymousSession?: boolean;\n /** Interval in seconds to check the user's session (default: 2) */\n checkSessionIntervalInSeconds?: number;\n query_status_response_type?: string;\n stopCheckSessionOnError?: boolean;\n\n /**\n * The `token_type_hint`s to pass to the authority server by default (default: [\"access_token\", \"refresh_token\"])\n *\n * Token types will be revoked in the same order as they are given here.\n */\n revokeTokenTypes?: (\"access_token\" | \"refresh_token\")[];\n /** Will invoke the revocation endpoint on signout if there is an access token for the user (default: false) */\n revokeTokensOnSignout?: boolean;\n /** Flag to control if id_token is included as id_token_hint in silent signout calls (default: false) */\n includeIdTokenInSilentSignout?: boolean;\n\n /** The number of seconds before an access token is to expire to raise the accessTokenExpiring event (default: 60) */\n accessTokenExpiringNotificationTimeInSeconds?: number;\n\n /**\n * Maximum number of timeout retries before raising silentRenewError event.\n * Set to 0 to fail immediately on timeout.\n * Undefined means infinite retries (maintains backward compatibility, default behavior).\n */\n maxSilentRenewTimeoutRetries?: number;\n\n /**\n * Storage object used to persist User for currently authenticated user (default: window.sessionStorage, InMemoryWebStorage iff no window).\n * E.g. `userStore: new WebStorageStateStore({ store: window.localStorage })`\n */\n userStore?: StateStore;\n}\n\n/**\n * The settings with defaults applied of the {@link UserManager}.\n * @see {@link UserManagerSettings}\n *\n * @public\n */\nexport class UserManagerSettingsStore extends OidcClientSettingsStore {\n public readonly popup_redirect_uri: string;\n public readonly popup_post_logout_redirect_uri: string | undefined;\n public readonly popupWindowFeatures: PopupWindowFeatures;\n public readonly popupWindowTarget: string;\n public readonly redirectMethod: \"replace\" | \"assign\";\n public readonly redirectTarget: \"top\" | \"self\";\n\n public readonly iframeNotifyParentOrigin: string | undefined;\n public readonly iframeScriptOrigin: string | undefined;\n\n public readonly silent_redirect_uri: string;\n public readonly silentRequestTimeoutInSeconds: number;\n public readonly automaticSilentRenew: boolean;\n public readonly validateSubOnSilentRenew: boolean;\n public readonly includeIdTokenInSilentRenew: boolean;\n\n public readonly monitorSession: boolean;\n public readonly monitorAnonymousSession: boolean;\n public readonly checkSessionIntervalInSeconds: number;\n public readonly query_status_response_type: string;\n public readonly stopCheckSessionOnError: boolean;\n\n public readonly revokeTokenTypes: (\"access_token\" | \"refresh_token\")[];\n public readonly revokeTokensOnSignout: boolean;\n public readonly includeIdTokenInSilentSignout: boolean;\n\n public readonly accessTokenExpiringNotificationTimeInSeconds: number;\n public readonly maxSilentRenewTimeoutRetries?: number;\n\n public readonly userStore: StateStore;\n\n public constructor(args: UserManagerSettings) {\n const {\n popup_redirect_uri = args.redirect_uri,\n popup_post_logout_redirect_uri = args.post_logout_redirect_uri,\n popupWindowFeatures = DefaultPopupWindowFeatures,\n popupWindowTarget = DefaultPopupTarget,\n redirectMethod = \"assign\",\n redirectTarget = \"self\",\n\n iframeNotifyParentOrigin = args.iframeNotifyParentOrigin,\n iframeScriptOrigin = args.iframeScriptOrigin,\n\n requestTimeoutInSeconds,\n silent_redirect_uri = args.redirect_uri,\n silentRequestTimeoutInSeconds,\n automaticSilentRenew = true,\n validateSubOnSilentRenew = true,\n includeIdTokenInSilentRenew = false,\n\n monitorSession = false,\n monitorAnonymousSession = false,\n checkSessionIntervalInSeconds = DefaultCheckSessionIntervalInSeconds,\n query_status_response_type = \"code\",\n stopCheckSessionOnError = true,\n\n revokeTokenTypes = [\"access_token\", \"refresh_token\"],\n revokeTokensOnSignout = false,\n includeIdTokenInSilentSignout = false,\n\n accessTokenExpiringNotificationTimeInSeconds = DefaultAccessTokenExpiringNotificationTimeInSeconds,\n\n maxSilentRenewTimeoutRetries,\n\n userStore,\n } = args;\n\n super(args);\n\n this.popup_redirect_uri = popup_redirect_uri;\n this.popup_post_logout_redirect_uri = popup_post_logout_redirect_uri;\n this.popupWindowFeatures = popupWindowFeatures;\n this.popupWindowTarget = popupWindowTarget;\n this.redirectMethod = redirectMethod;\n this.redirectTarget = redirectTarget;\n\n this.iframeNotifyParentOrigin = iframeNotifyParentOrigin;\n this.iframeScriptOrigin = iframeScriptOrigin;\n\n this.silent_redirect_uri = silent_redirect_uri;\n this.silentRequestTimeoutInSeconds = silentRequestTimeoutInSeconds || requestTimeoutInSeconds || DefaultSilentRequestTimeoutInSeconds;\n this.automaticSilentRenew = automaticSilentRenew;\n this.validateSubOnSilentRenew = validateSubOnSilentRenew;\n this.includeIdTokenInSilentRenew = includeIdTokenInSilentRenew;\n\n this.monitorSession = monitorSession;\n this.monitorAnonymousSession = monitorAnonymousSession;\n this.checkSessionIntervalInSeconds = checkSessionIntervalInSeconds;\n this.stopCheckSessionOnError = stopCheckSessionOnError;\n this.query_status_response_type = query_status_response_type;\n\n this.revokeTokenTypes = revokeTokenTypes;\n this.revokeTokensOnSignout = revokeTokensOnSignout;\n this.includeIdTokenInSilentSignout = includeIdTokenInSilentSignout;\n\n this.accessTokenExpiringNotificationTimeInSeconds = accessTokenExpiringNotificationTimeInSeconds;\n this.maxSilentRenewTimeoutRetries = maxSilentRenewTimeoutRetries;\n\n if (userStore) {\n this.userStore = userStore;\n }\n else {\n const store = typeof window !== \"undefined\" ? window.sessionStorage : new InMemoryWebStorage();\n this.userStore = new WebStorageStateStore({ store });\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"../utils\";\nimport { ErrorTimeout } from \"../errors\";\nimport type { NavigateParams, NavigateResponse } from \"./IWindow\";\nimport { AbstractChildWindow } from \"./AbstractChildWindow\";\nimport { DefaultSilentRequestTimeoutInSeconds } from \"../UserManagerSettings\";\n\n/**\n * @public\n */\nexport interface IFrameWindowParams {\n silentRequestTimeoutInSeconds?: number;\n}\n\n/**\n * @internal\n */\nexport class IFrameWindow extends AbstractChildWindow {\n protected readonly _logger = new Logger(\"IFrameWindow\");\n private _frame: HTMLIFrameElement | null;\n private _timeoutInSeconds: number;\n\n public constructor({\n silentRequestTimeoutInSeconds = DefaultSilentRequestTimeoutInSeconds,\n }: IFrameWindowParams) {\n super();\n this._timeoutInSeconds = silentRequestTimeoutInSeconds;\n\n this._frame = IFrameWindow.createHiddenIframe();\n this._window = this._frame.contentWindow;\n }\n\n private static createHiddenIframe(): HTMLIFrameElement {\n const iframe = window.document.createElement(\"iframe\");\n\n // shotgun approach\n iframe.style.visibility = \"hidden\";\n iframe.style.position = \"fixed\";\n iframe.style.left = \"-1000px\";\n iframe.style.top = \"0\";\n iframe.width = \"0\";\n iframe.height = \"0\";\n\n window.document.body.appendChild(iframe);\n return iframe;\n }\n\n public async navigate(params: NavigateParams): Promise<NavigateResponse> {\n this._logger.debug(\"navigate: Using timeout of:\", this._timeoutInSeconds);\n const timer = setTimeout(() => void this._abort.raise(new ErrorTimeout(\"IFrame timed out without a response\")), this._timeoutInSeconds * 1000);\n this._disposeHandlers.add(() => clearTimeout(timer));\n\n return await super.navigate(params);\n }\n\n public close(): void {\n if (this._frame) {\n if (this._frame.parentNode) {\n this._frame.addEventListener(\"load\", (ev) => {\n const frame = ev.target as HTMLIFrameElement;\n frame.parentNode?.removeChild(frame);\n void this._abort.raise(new Error(\"IFrame removed from DOM\"));\n }, true);\n this._frame.contentWindow?.location.replace(\"about:blank\");\n }\n this._frame = null;\n }\n this._window = null;\n }\n\n public static notifyParent(url: string, targetOrigin?: string): void {\n return super._notifyParent(window.parent, url, false, targetOrigin);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"../utils\";\nimport type { UserManagerSettingsStore } from \"../UserManagerSettings\";\nimport { IFrameWindow, type IFrameWindowParams } from \"./IFrameWindow\";\nimport type { INavigator } from \"./INavigator\";\n\n/**\n * @internal\n */\nexport class IFrameNavigator implements INavigator {\n private readonly _logger = new Logger(\"IFrameNavigator\");\n\n constructor(private _settings: UserManagerSettingsStore) {}\n\n public async prepare({\n silentRequestTimeoutInSeconds = this._settings.silentRequestTimeoutInSeconds,\n }: IFrameWindowParams): Promise<IFrameWindow> {\n return new IFrameWindow({ silentRequestTimeoutInSeconds });\n }\n\n public async callback(url: string): Promise<void> {\n this._logger.create(\"callback\");\n IFrameWindow.notifyParent(url, this._settings.iframeNotifyParentOrigin);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, PopupUtils, type PopupWindowFeatures } from \"../utils\";\nimport { DefaultPopupWindowFeatures, DefaultPopupTarget } from \"../UserManagerSettings\";\nimport { AbstractChildWindow } from \"./AbstractChildWindow\";\nimport type { NavigateParams, NavigateResponse } from \"./IWindow\";\n\nconst checkForPopupClosedInterval = 500;\nconst second = 1000;\n\n/**\n * @public\n */\nexport interface PopupWindowParams {\n popupWindowFeatures?: PopupWindowFeatures;\n popupWindowTarget?: string;\n /** An AbortSignal to set request's signal. */\n popupSignal?: AbortSignal | null;\n /** Abort navigator when the popup is lost */\n popupAbortOnClose?: boolean;\n}\n\n/**\n * @internal\n */\nexport class PopupWindow extends AbstractChildWindow {\n protected readonly _logger = new Logger(\"PopupWindow\");\n\n protected _window: WindowProxy | null;\n\n protected abortOnClose: boolean;\n\n public constructor({\n popupWindowTarget = DefaultPopupTarget,\n popupWindowFeatures = {},\n popupSignal,\n popupAbortOnClose,\n }: PopupWindowParams) {\n super();\n const centeredPopup = PopupUtils.center({ ...DefaultPopupWindowFeatures, ...popupWindowFeatures });\n this._window = window.open(undefined, popupWindowTarget, PopupUtils.serialize(centeredPopup));\n this.abortOnClose = Boolean(popupAbortOnClose);\n\n if (popupSignal) {\n popupSignal.addEventListener(\"abort\", () => {\n void this._abort.raise(new Error(popupSignal.reason ?? \"Popup aborted\"));\n });\n }\n\n if (popupWindowFeatures.closePopupWindowAfterInSeconds && popupWindowFeatures.closePopupWindowAfterInSeconds > 0) {\n setTimeout(() => {\n if (!this._window || typeof this._window.closed !== \"boolean\" || this._window.closed) {\n void this._abort.raise(new Error(\"Popup blocked by user\"));\n return;\n }\n\n this.close();\n }, popupWindowFeatures.closePopupWindowAfterInSeconds * second);\n }\n }\n\n public async navigate(params: NavigateParams): Promise<NavigateResponse> {\n this._window?.focus();\n\n const popupClosedInterval = setInterval(() => {\n if (!this._window || this._window.closed) {\n this._logger.debug(\"Popup closed by user or isolated by redirect\");\n clearPopupClosedInterval();\n this._disposeHandlers.delete(clearPopupClosedInterval);\n \n if (this.abortOnClose) {\n void this._abort.raise(new Error(\"Popup closed by user\"));\n }\n }\n }, checkForPopupClosedInterval);\n const clearPopupClosedInterval = () => clearInterval(popupClosedInterval);\n this._disposeHandlers.add(clearPopupClosedInterval);\n\n return await super.navigate(params);\n }\n\n public close(): void {\n if (this._window) {\n if (!this._window.closed) {\n this._window.close();\n void this._abort.raise(new Error(\"Popup closed\"));\n }\n }\n this._window = null;\n }\n\n public static notifyOpener(url: string, keepOpen: boolean): void {\n super._notifyParent(window.opener, url, keepOpen);\n if (!keepOpen && !window.opener) {\n window.close();\n }\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"../utils\";\nimport { PopupWindow, type PopupWindowParams } from \"./PopupWindow\";\nimport type { INavigator } from \"./INavigator\";\nimport type { UserManagerSettingsStore } from \"../UserManagerSettings\";\n\n/**\n * @internal\n */\nexport class PopupNavigator implements INavigator {\n private readonly _logger = new Logger(\"PopupNavigator\");\n\n constructor(private _settings: UserManagerSettingsStore) { }\n\n public async prepare({\n popupWindowFeatures = this._settings.popupWindowFeatures,\n popupWindowTarget = this._settings.popupWindowTarget,\n popupSignal,\n popupAbortOnClose,\n }: PopupWindowParams): Promise<PopupWindow> {\n return new PopupWindow({\n popupWindowFeatures,\n popupWindowTarget,\n popupSignal,\n popupAbortOnClose,\n });\n }\n\n public async callback(url: string, { keepOpen = false }): Promise<void> {\n this._logger.create(\"callback\");\n\n PopupWindow.notifyOpener(url, keepOpen);\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger } from \"../utils\";\nimport type { UserManagerSettingsStore } from \"../UserManagerSettings\";\nimport type { INavigator } from \"./INavigator\";\nimport type { IWindow, NavigateResponse } from \"./IWindow\";\n\n/**\n * @public\n */\nexport interface RedirectParams {\n redirectMethod?: \"replace\" | \"assign\";\n redirectTarget?: \"top\" | \"self\";\n}\n\n/**\n * @internal\n */\nexport class RedirectNavigator implements INavigator {\n private readonly _logger = new Logger(\"RedirectNavigator\");\n\n constructor(private _settings: UserManagerSettingsStore) {}\n\n public async prepare({\n redirectMethod = this._settings.redirectMethod,\n redirectTarget = this._settings.redirectTarget,\n }: RedirectParams): Promise<IWindow> {\n this._logger.create(\"prepare\");\n let targetWindow = window.self as Window;\n\n if (redirectTarget === \"top\") {\n targetWindow = window.top ?? window.self;\n }\n \n const redirect = targetWindow.location[redirectMethod].bind(targetWindow.location) as (url: string) => void;\n let abort: (reason: Error) => void;\n return {\n navigate: async (params): Promise<NavigateResponse> => {\n this._logger.create(\"navigate\");\n const promise = new Promise((resolve, reject) => {\n abort = reject;\n window.addEventListener(\"pageshow\", () => resolve(window.location.href));\n redirect(params.url);\n });\n return await (promise as Promise<NavigateResponse>);\n },\n close: () => {\n this._logger.create(\"close\");\n abort?.(new Error(\"Redirect aborted\"));\n targetWindow.stop();\n },\n };\n }\n\n public async callback(): Promise<void> {\n return;\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, Event } from \"./utils\";\nimport { AccessTokenEvents } from \"./AccessTokenEvents\";\nimport type { UserManagerSettingsStore } from \"./UserManagerSettings\";\nimport type { User } from \"./User\";\n\n/**\n * @public\n */\nexport type UserLoadedCallback = (user: User) => Promise<void> | void;\n/**\n * @public\n */\nexport type UserUnloadedCallback = () => Promise<void> | void;\n/**\n * @public\n */\nexport type SilentRenewErrorCallback = (error: Error) => Promise<void> | void;\n/**\n * @public\n */\nexport type UserSignedInCallback = () => Promise<void> | void;\n/**\n * @public\n */\nexport type UserSignedOutCallback = () => Promise<void> | void;\n/**\n * @public\n */\nexport type UserSessionChangedCallback = () => Promise<void> | void;\n\n/**\n * @public\n */\nexport class UserManagerEvents extends AccessTokenEvents {\n protected readonly _logger = new Logger(\"UserManagerEvents\");\n\n private readonly _userLoaded = new Event<[User]>(\"User loaded\");\n private readonly _userUnloaded = new Event<[]>(\"User unloaded\");\n private readonly _silentRenewError = new Event<[Error]>(\"Silent renew error\");\n private readonly _userSignedIn = new Event<[]>(\"User signed in\");\n private readonly _userSignedOut = new Event<[]>(\"User signed out\");\n private readonly _userSessionChanged = new Event<[]>(\"User session changed\");\n\n public constructor(settings: UserManagerSettingsStore) {\n super({ expiringNotificationTimeInSeconds: settings.accessTokenExpiringNotificationTimeInSeconds });\n }\n\n public async load(user: User, raiseEvent=true): Promise<void> {\n await super.load(user);\n if (raiseEvent) {\n await this._userLoaded.raise(user);\n }\n }\n\n public async unload(): Promise<void> {\n await super.unload();\n await this._userUnloaded.raise();\n }\n\n /**\n * Add callback: Raised when a user session has been established (or re-established).\n */\n public addUserLoaded(cb: UserLoadedCallback): () => void {\n return this._userLoaded.addHandler(cb);\n }\n /**\n * Remove callback: Raised when a user session has been established (or re-established).\n */\n public removeUserLoaded(cb: UserLoadedCallback): void {\n return this._userLoaded.removeHandler(cb);\n }\n\n /**\n * Add callback: Raised when a user session has been terminated.\n */\n public addUserUnloaded(cb: UserUnloadedCallback): () => void {\n return this._userUnloaded.addHandler(cb);\n }\n /**\n * Remove callback: Raised when a user session has been terminated.\n */\n public removeUserUnloaded(cb: UserUnloadedCallback): void {\n return this._userUnloaded.removeHandler(cb);\n }\n\n /**\n * Add callback: Raised when the automatic silent renew has failed.\n */\n public addSilentRenewError(cb: SilentRenewErrorCallback): () => void {\n return this._silentRenewError.addHandler(cb);\n }\n /**\n * Remove callback: Raised when the automatic silent renew has failed.\n */\n public removeSilentRenewError(cb: SilentRenewErrorCallback): void {\n return this._silentRenewError.removeHandler(cb);\n }\n /**\n * @internal\n */\n public async _raiseSilentRenewError(e: Error): Promise<void> {\n await this._silentRenewError.raise(e);\n }\n\n /**\n * Add callback: Raised when the user is signed in (when `monitorSession` is set).\n * @see {@link UserManagerSettings.monitorSession}\n */\n public addUserSignedIn(cb: UserSignedInCallback): () => void {\n return this._userSignedIn.addHandler(cb);\n }\n /**\n * Remove callback: Raised when the user is signed in (when `monitorSession` is set).\n */\n public removeUserSignedIn(cb: UserSignedInCallback): void {\n this._userSignedIn.removeHandler(cb);\n }\n /**\n * @internal\n */\n public async _raiseUserSignedIn(): Promise<void> {\n await this._userSignedIn.raise();\n }\n\n /**\n * Add callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).\n * @see {@link UserManagerSettings.monitorSession}\n */\n public addUserSignedOut(cb: UserSignedOutCallback): () => void {\n return this._userSignedOut.addHandler(cb);\n }\n /**\n * Remove callback: Raised when the user's sign-in status at the OP has changed (when `monitorSession` is set).\n */\n public removeUserSignedOut(cb: UserSignedOutCallback): void {\n this._userSignedOut.removeHandler(cb);\n }\n /**\n * @internal\n */\n public async _raiseUserSignedOut(): Promise<void> {\n await this._userSignedOut.raise();\n }\n\n /**\n * Add callback: Raised when the user session changed (when `monitorSession` is set).\n * @see {@link UserManagerSettings.monitorSession}\n */\n public addUserSessionChanged(cb: UserSessionChangedCallback): () => void {\n return this._userSessionChanged.addHandler(cb);\n }\n /**\n * Remove callback: Raised when the user session changed (when `monitorSession` is set).\n */\n public removeUserSessionChanged(cb: UserSessionChangedCallback): void {\n this._userSessionChanged.removeHandler(cb);\n }\n /**\n * @internal\n */\n public async _raiseUserSessionChanged(): Promise<void> {\n await this._userSessionChanged.raise();\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { Logger, Timer } from \"./utils\";\nimport { ErrorTimeout } from \"./errors\";\nimport type { UserManager } from \"./UserManager\";\nimport type { AccessTokenCallback } from \"./AccessTokenEvents\";\n\n/**\n * @internal\n */\nexport class SilentRenewService {\n protected _logger = new Logger(\"SilentRenewService\");\n private _isStarted = false;\n private readonly _retryTimer = new Timer(\"Retry Silent Renew\");\n private _timeoutRetryCount = 0;\n\n public constructor(private _userManager: UserManager) {}\n\n public async start(): Promise<void> {\n const logger = this._logger.create(\"start\");\n if (!this._isStarted) {\n this._isStarted = true;\n this._userManager.events.addAccessTokenExpiring(this._tokenExpiring);\n this._retryTimer.addHandler(this._tokenExpiring);\n\n // this will trigger loading of the user so the expiring events can be initialized\n try {\n await this._userManager.getUser();\n // deliberate nop\n }\n catch (err) {\n // catch to suppress errors since we're in a ctor\n logger.error(\"getUser error\", err);\n }\n }\n }\n\n public stop(): void {\n if (this._isStarted) {\n this._retryTimer.cancel();\n this._retryTimer.removeHandler(this._tokenExpiring);\n this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring);\n this._isStarted = false;\n }\n }\n\n protected _tokenExpiring: AccessTokenCallback = async () => {\n const logger = this._logger.create(\"_tokenExpiring\");\n try {\n await this._userManager.signinSilent();\n this._timeoutRetryCount = 0;\n logger.debug(\"silent token renewal successful\");\n }\n catch (err) {\n if (err instanceof ErrorTimeout) {\n // Increment timeout retry counter\n this._timeoutRetryCount++;\n\n // Check if a max timeout retry limit is configured\n const maxRetries = this._userManager.settings.maxSilentRenewTimeoutRetries;\n const hasReachedLimit = maxRetries !== undefined && this._timeoutRetryCount > maxRetries;\n\n if (hasReachedLimit) {\n // Limit reached: raise event to notify application and stop retrying\n logger.error(\n `Timeout retry limit reached (${this._timeoutRetryCount} > ${maxRetries}), ` +\n \"raising silentRenewError:\",\n err,\n );\n this._timeoutRetryCount = 0;\n await this._userManager.events._raiseSilentRenewError(err as Error);\n return;\n }\n\n // No limit configured (undefined) or limit not reached: continue retrying\n // no response from authority server, e.g. IFrame timeout, ...\n logger.warn(\n `ErrorTimeout from signinSilent (attempt ${this._timeoutRetryCount}), retry in 5s:`,\n err,\n );\n this._retryTimer.init(5);\n return;\n }\n\n // Non-timeout error: reset counter and raise event immediately\n logger.error(\"Error from signinSilent:\", err);\n this._timeoutRetryCount = 0;\n await this._userManager.events._raiseSilentRenewError(err as Error);\n }\n };\n}\n","// Copyright (C) AuthTS Contributors\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport type { UserProfile } from \"./User\";\n\n/**\n * Fake state store implementation necessary for validating refresh token requests.\n *\n * @public\n */\nexport class RefreshState {\n /** custom \"state\", which can be used by a caller to have \"data\" round tripped */\n public readonly data?: unknown;\n\n public readonly refresh_token: string;\n public readonly id_token?: string;\n public readonly session_state: string | null;\n public readonly scope?: string;\n public readonly profile: UserProfile;\n\n constructor(args: {\n refresh_token: string;\n id_token?: string;\n session_state: string | null;\n scope?: string;\n profile: UserProfile;\n\n state?: unknown;\n }) {\n this.refresh_token = args.refresh_token;\n this.id_token = args.id_token;\n this.session_state = args.session_state;\n this.scope = args.scope;\n this.profile = args.profile;\n\n this.data = args.state;\n\n }\n}\n","// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.\n\nimport { CryptoUtils, Logger } from \"./utils\";\nimport { ErrorResponse } from \"./errors\";\nimport { type NavigateResponse, type PopupWindowParams, type IWindow, type IFrameWindowParams, type RedirectParams, RedirectNavigator, PopupNavigator, IFrameNavigator, type INavigator } from \"./navigators\";\nimport { OidcClient, type CreateSigninRequestArgs, type CreateSignoutRequestArgs, type ProcessResourceOwnerPasswordCredentialsArgs, type UseRefreshTokenArgs } from \"./OidcClient\";\nimport { type UserManagerSettings, UserManagerSettingsStore } from \"./UserManagerSettings\";\nimport { User } from \"./User\";\nimport { UserManagerEvents } from \"./UserManagerEvents\";\nimport { SilentRenewService } from \"./SilentRenewService\";\nimport { SessionMonitor } from \"./SessionMonitor\";\nimport type { SessionStatus } from \"./SessionStatus\";\nimport type { SignoutResponse } from \"./SignoutResponse\";\nimport type { MetadataService } from \"./MetadataService\";\nimport { RefreshState } from \"./RefreshState\";\nimport type { SigninResponse } from \"./SigninResponse\";\nimport type { ExtraHeader, DPoPSettings } from \"./OidcClientSettings\";\nimport { DPoPState } from \"./DPoPStore\";\n\n/**\n * @public\n */\nexport type ExtraSigninRequestArgs = Pick<CreateSigninRequestArgs, \"nonce\" | \"extraQueryParams\" | \"extraTokenParams\" | \"state\" | \"redirect_uri\" | \"prompt\" | \"acr_values\" | \"login_hint\" | \"scope\" | \"max_age\" | \"ui_locales\" | \"resource\" | \"url_state\">;\n/**\n * @public\n */\nexport type ExtraSignoutRequestArgs = Pick<CreateSignoutRequestArgs, \"extraQueryParams\" | \"state\" | \"id_token_hint\" | \"post_logout_redirect_uri\" | \"url_state\">;\n\n/**\n * @public\n */\nexport type RevokeTokensTypes = UserManagerSettings[\"revokeTokenTypes\"];\n\n/**\n * @public\n */\nexport type SigninRedirectArgs = RedirectParams & ExtraSigninRequestArgs;\n\n/**\n * @public\n */\nexport type SigninPopupArgs = PopupWindowParams & ExtraSigninRequestArgs;\n\n/**\n * @public\n */\nexport type ExtraSignInSilentArgs = { \n // forceIframeAuth bypasses refresh token usage and forces iframe-based silent authentication\n forceIframeAuth?: boolean;\n};\n\n/**\n * @public\n */\nexport type SigninSilentArgs = IFrameWindowParams & ExtraSigninRequestArgs & ExtraSignInSilentArgs;\n\n/**\n * @public\n */\nexport type SigninResourceOwnerCredentialsArgs = ProcessResourceOwnerPasswordCredentialsArgs;\n\n/**\n * @public\n */\nexport type QuerySessionStatusArgs = IFrameWindowParams & ExtraSigninRequestArgs;\n\n/**\n * @public\n */\nexport type SignoutRedirectArgs = RedirectParams & ExtraSignoutRequestArgs;\n\n/**\n * @public\n */\nexport type SignoutPopupArgs = PopupWindowParams & ExtraSignoutRequestArgs;\n\n/**\n * @public\n */\nexport type SignoutSilentArgs = IFrameWindowParams & ExtraSignoutRequestArgs;\n\n/**\n * Provides a higher level API for signing a user in, signing out, managing the user's claims returned from the identity provider,\n * and managing an access token returned from the identity provider (OAuth2/OIDC).\n *\n * @public\n */\nexport class UserManager {\n /** Get the settings used to configure the `UserManager`. */\n public readonly settings: UserManagerSettingsStore;\n protected readonly _logger = new Logger(\"UserManager\");\n\n protected readonly _client: OidcClient;\n protected readonly _redirectNavigator: INavigator;\n protected readonly _popupNavigator: INavigator;\n protected readonly _iframeNavigator: INavigator;\n protected readonly _events: UserManagerEvents;\n protected readonly _silentRenewService: SilentRenewService;\n protected readonly _sessionMonitor: SessionMonitor | null;\n\n public constructor(settings: UserManagerSettings, redirectNavigator?: INavigator, popupNavigator?: INavigator, iframeNavigator?: INavigator) {\n this.settings = new UserManagerSettingsStore(settings);\n\n this._client = new OidcClient(settings);\n\n this._redirectNavigator = redirectNavigator ?? new RedirectNavigator(this.settings);\n this._popupNavigator = popupNavigator ?? new PopupNavigator(this.settings);\n this._iframeNavigator = iframeNavigator ?? new IFrameNavigator(this.settings);\n\n this._events = new UserManagerEvents(this.settings);\n this._silentRenewService = new SilentRenewService(this);\n\n // order is important for the following properties; these services depend upon the events.\n if (this.settings.automaticSilentRenew) {\n this.startSilentRenew();\n }\n\n this._sessionMonitor = null;\n if (this.settings.monitorSession) {\n this._sessionMonitor = new SessionMonitor(this);\n }\n }\n\n /**\n * Get object used to register for events raised by the `UserManager`.\n */\n public get events(): UserManagerEvents {\n return this._events;\n }\n\n /**\n * Get object used to access the metadata configuration of the identity provider.\n */\n public get metadataService(): MetadataService {\n return this._client.metadataService;\n }\n\n /**\n * Load the `User` object for the currently authenticated user.\n *\n * @param raiseEvent - If `true`, the `UserLoaded` event will be raised. Defaults to false.\n * @returns A promise\n */\n public async getUser(raiseEvent = false): Promise<User | null> {\n const logger = this._logger.create(\"getUser\");\n const user = await this._loadUser();\n if (user) {\n logger.info(\"user loaded\");\n await this._events.load(user, raiseEvent);\n return user;\n }\n\n logger.info(\"user not found in storage\");\n return null;\n }\n\n /**\n * Remove from any storage the currently authenticated user.\n *\n * @returns A promise\n */\n public async removeUser(): Promise<void> {\n const logger = this._logger.create(\"removeUser\");\n await this.storeUser(null);\n logger.info(\"user removed from storage\");\n await this._events.unload();\n }\n\n /**\n * Trigger a redirect of the current window to the authorization endpoint.\n *\n * @returns A promise\n *\n * @throws `Error` In cases of wrong authentication.\n */\n public async signinRedirect(args: SigninRedirectArgs = {}): Promise<void> {\n this._logger.create(\"signinRedirect\");\n const {\n redirectMethod,\n ...requestArgs\n } = args;\n\n let dpopJkt: string | undefined;\n if (this.settings.dpop?.bind_authorization_code) {\n dpopJkt = await this.generateDPoPJkt(this.settings.dpop);\n }\n\n const handle = await this._redirectNavigator.prepare({ redirectMethod });\n await this._signinStart({\n request_type: \"si:r\",\n dpopJkt,\n ...requestArgs,\n }, handle);\n }\n\n /**\n * Process the response (callback) from the authorization endpoint.\n * It is recommended to use {@link UserManager.signinCallback} instead.\n *\n * @returns A promise containing the authenticated `User`.\n *\n * @see {@link UserManager.signinCallback}\n */\n public async signinRedirectCallback(url = window.location.href): Promise<User> {\n const logger = this._logger.create(\"signinRedirectCallback\");\n const user = await this._signinEnd(url);\n if (user.profile && user.profile.sub) {\n logger.info(\"success, signed in subject\", user.profile.sub);\n }\n else {\n logger.info(\"no subject\");\n }\n\n return user;\n }\n\n /**\n * Trigger the signin with user/password.\n *\n * @returns A promise containing the authenticated `User`.\n * @throws {@link ErrorResponse} In cases of wrong authentication.\n */\n public async signinResourceOwnerCredentials({\n username,\n password,\n skipUserInfo = false,\n }: SigninResourceOwnerCredentialsArgs): Promise<User> {\n const logger = this._logger.create(\"signinResourceOwnerCredential\");\n\n const signinResponse = await this._client.processResourceOwnerPasswordCredentials({\n username,\n password,\n skipUserInfo,\n extraTokenParams: this.settings.extraTokenParams,\n });\n logger.debug(\"got signin response\");\n\n const user = await this._buildUser(signinResponse);\n if (user.profile && user.profile.sub) {\n logger.info(\"success, signed in subject\", user.profile.sub);\n } else {\n logger.info(\"no subject\");\n }\n return user;\n }\n\n /**\n * Trigger a request (via a popup window) to the authorization endpoint.\n *\n * @returns A promise containing the authenticated `User`.\n * @throws `Error` In cases of wrong authentication.\n */\n public async signinPopup(args: SigninPopupArgs = {}): Promise<User> {\n const logger = this._logger.create(\"signinPopup\");\n\n let dpopJkt: string | undefined;\n if (this.settings.dpop?.bind_authorization_code) {\n dpopJkt = await this.generateDPoPJkt(this.settings.dpop);\n }\n\n const {\n popupWindowFeatures,\n popupWindowTarget,\n popupSignal,\n popupAbortOnClose,\n ...requestArgs\n } = args;\n const url = this.settings.popup_redirect_uri;\n if (!url) {\n logger.throw(new Error(\"No popup_redirect_uri configured\"));\n }\n\n const handle = await this._popupNavigator.prepare({ popupWindowFeatures, popupWindowTarget, popupSignal, popupAbortOnClose });\n const user = await this._signin({\n request_type: \"si:p\",\n redirect_uri: url,\n display: \"popup\",\n dpopJkt,\n ...requestArgs,\n }, handle);\n if (user) {\n if (user.profile && user.profile.sub) {\n logger.info(\"success, signed in subject\", user.profile.sub);\n } else {\n logger.info(\"no subject\");\n }\n }\n\n return user;\n }\n\n /**\n * Notify the opening window of response (callback) from the authorization endpoint.\n * It is recommended to use {@link UserManager.signinCallback} instead.\n *\n * @returns A promise\n *\n * @see {@link UserManager.signinCallback}\n */\n public async signinPopupCallback(url = window.location.href, keepOpen = false): Promise<void> {\n const logger = this._logger.create(\"signinPopupCallback\");\n await this._popupNavigator.callback(url, { keepOpen });\n logger.info(\"success\");\n }\n\n /**\n * Trigger a silent request (via refresh token or an iframe) to the authorization endpoint.\n *\n * @returns A promise that contains the authenticated `User`.\n */\n public async signinSilent(args: SigninSilentArgs = {}): Promise<User | null> {\n const logger = this._logger.create(\"signinSilent\");\n const {\n silentRequestTimeoutInSeconds,\n ...requestArgs\n } = args;\n // first determine if we have a refresh token, or need to use iframe\n let user = await this._loadUser();\n // use refresh token unless forceIframeAuth is explicitly true\n if (!args.forceIframeAuth && user?.refresh_token) {\n logger.debug(\"using refresh token\");\n const state = new RefreshState(user as Required<User>);\n return await this._useRefreshToken({\n state,\n redirect_uri: requestArgs.redirect_uri,\n resource: requestArgs.resource,\n extraTokenParams: requestArgs.extraTokenParams,\n timeoutInSeconds: silentRequestTimeoutInSeconds,\n });\n }\n\n let dpopJkt: string | undefined;\n if (this.settings.dpop?.bind_authorization_code) {\n dpopJkt = await this.generateDPoPJkt(this.settings.dpop);\n }\n\n const url = this.settings.silent_redirect_uri;\n if (!url) {\n logger.throw(new Error(\"No silent_redirect_uri configured\"));\n }\n\n let verifySub: string | undefined;\n if (user && this.settings.validateSubOnSilentRenew) {\n logger.debug(\"subject prior to silent renew:\", user.profile.sub);\n verifySub = user.profile.sub;\n }\n\n const handle = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds });\n user = await this._signin({\n request_type: \"si:s\",\n redirect_uri: url,\n prompt: \"none\",\n id_token_hint: this.settings.includeIdTokenInSilentRenew ? user?.id_token : undefined,\n dpopJkt,\n ...requestArgs,\n }, handle, verifySub);\n if (user) {\n if (user.profile?.sub) {\n logger.info(\"success, signed in subject\", user.profile.sub);\n }\n else {\n logger.info(\"no subject\");\n }\n }\n\n return user;\n }\n\n protected async _useRefreshToken(args: UseRefreshTokenArgs): Promise<User> {\n const response = await this._client.useRefreshToken({\n timeoutInSeconds: this.settings.silentRequestTimeoutInSeconds,\n ...args,\n });\n const user = new User({ ...args.state, ...response });\n\n await this.storeUser(user);\n await this._events.load(user);\n return user;\n }\n\n /**\n *\n * Notify the parent window of response (callback) from the authorization endpoint.\n * It is recommended to use {@link UserManager.signinCallback} instead.\n *\n * @returns A promise\n *\n * @see {@link UserManager.signinCallback}\n */\n public async signinSilentCallback(url = window.location.href): Promise<void> {\n const logger = this._logger.create(\"signinSilentCallback\");\n await this._iframeNavigator.callback(url);\n logger.info(\"success\");\n }\n\n /**\n * Process any response (callback) from the authorization endpoint, by dispatching the request_type\n * and executing one of the following functions:\n * - {@link UserManager.signinRedirectCallback}\n * - {@link UserManager.signinPopupCallback}\n * - {@link UserManager.signinSilentCallback}\n *\n * @throws `Error` If request_type is unknown or signin cannot be processed.\n */\n public async signinCallback(url = window.location.href): Promise<User | undefined> {\n const { state } = await this._client.readSigninResponseState(url);\n switch (state.request_type) {\n case \"si:r\":\n return await this.signinRedirectCallback(url);\n case \"si:p\":\n await this.signinPopupCallback(url);\n break;\n case \"si:s\":\n await this.signinSilentCallback(url);\n break;\n default:\n throw new Error(\"invalid request_type in state\");\n }\n return undefined;\n }\n\n /**\n * Process any response (callback) from the end session endpoint, by dispatching the request_type\n * and executing one of the following functions:\n * - {@link UserManager.signoutRedirectCallback}\n * - {@link UserManager.signoutPopupCallback}\n * - {@link UserManager.signoutSilentCallback}\n *\n * @throws `Error` If request_type is unknown or signout cannot be processed.\n */\n public async signoutCallback(url = window.location.href, keepOpen = false): Promise<SignoutResponse | undefined> {\n const { state } = await this._client.readSignoutResponseState(url);\n if (!state) {\n return undefined;\n }\n\n switch (state.request_type) {\n case \"so:r\":\n return await this.signoutRedirectCallback(url);\n case \"so:p\":\n await this.signoutPopupCallback(url, keepOpen);\n break;\n case \"so:s\":\n await this.signoutSilentCallback(url);\n break;\n default:\n throw new Error(\"invalid request_type in state\");\n }\n return undefined;\n }\n\n /**\n * Query OP for user's current signin status.\n *\n * @returns A promise object with session_state and subject identifier.\n */\n public async querySessionStatus(args: QuerySessionStatusArgs = {}): Promise<SessionStatus | null> {\n const logger = this._logger.create(\"querySessionStatus\");\n const {\n silentRequestTimeoutInSeconds,\n ...requestArgs\n } = args;\n const url = this.settings.silent_redirect_uri;\n if (!url) {\n logger.throw(new Error(\"No silent_redirect_uri configured\"));\n }\n\n const user = await this._loadUser();\n const handle = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds });\n const navResponse = await this._signinStart({\n request_type: \"si:s\", // this acts like a signin silent\n redirect_uri: url,\n prompt: \"none\",\n id_token_hint: this.settings.includeIdTokenInSilentRenew ? user?.id_token : undefined,\n response_type: this.settings.query_status_response_type,\n scope: \"openid\",\n skipUserInfo: true,\n ...requestArgs,\n }, handle);\n try {\n const extraHeaders: Record<string, ExtraHeader> = {};\n const signinResponse = await this._client.processSigninResponse(navResponse.url, extraHeaders);\n logger.debug(\"got signin response\");\n\n if (signinResponse.session_state && signinResponse.profile.sub) {\n logger.info(\"success for subject\", signinResponse.profile.sub);\n return {\n session_state: signinResponse.session_state,\n sub: signinResponse.profile.sub,\n };\n }\n\n logger.info(\"success, user not authenticated\");\n return null;\n } catch (err) {\n if (this.settings.monitorAnonymousSession && err instanceof ErrorResponse) {\n switch (err.error) {\n case \"login_required\":\n case \"consent_required\":\n case \"interaction_required\":\n case \"account_selection_required\":\n logger.info(\"success for anonymous user\");\n return {\n session_state: err.session_state!,\n };\n }\n }\n throw err;\n }\n }\n\n protected async _signin(args: CreateSigninRequestArgs, handle: IWindow, verifySub?: string): Promise<User> {\n const navResponse = await this._signinStart(args, handle);\n return await this._signinEnd(navResponse.url, verifySub);\n }\n\n protected async _signinStart(args: CreateSigninRequestArgs, handle: IWindow): Promise<NavigateResponse> {\n const logger = this._logger.create(\"_signinStart\");\n\n try {\n const signinRequest = await this._client.createSigninRequest(args);\n logger.debug(\"got signin request\");\n\n return await handle.navigate({\n url: signinRequest.url,\n state: signinRequest.state.id,\n response_mode: signinRequest.state.response_mode,\n scriptOrigin: this.settings.iframeScriptOrigin,\n });\n } catch (err) {\n logger.debug(\"error after preparing navigator, closing navigator window\");\n handle.close();\n throw err;\n }\n }\n\n protected async _signinEnd(url: string, verifySub?: string): Promise<User> {\n const logger = this._logger.create(\"_signinEnd\");\n const extraHeaders: Record<string, ExtraHeader> = {};\n const signinResponse = await this._client.processSigninResponse(url, extraHeaders);\n logger.debug(\"got signin response\");\n\n const user = await this._buildUser(signinResponse, verifySub);\n return user;\n }\n\n protected async _buildUser(signinResponse: SigninResponse, verifySub?: string) {\n const logger = this._logger.create(\"_buildUser\");\n const user = new User(signinResponse);\n if (verifySub) {\n if (verifySub !== user.profile.sub) {\n logger.debug(\"current user does not match user returned from signin. sub from signin:\", user.profile.sub);\n throw new ErrorResponse({ ...signinResponse, error: \"login_required\" });\n }\n logger.debug(\"current user matches user returned from signin\");\n }\n\n await this.storeUser(user);\n logger.debug(\"user stored\");\n await this._events.load(user);\n\n return user;\n }\n\n /**\n * Trigger a redirect of the current window to the end session endpoint.\n *\n * @returns A promise\n */\n public async signoutRedirect(args: SignoutRedirectArgs = {}): Promise<void> {\n const logger = this._logger.create(\"signoutRedirect\");\n const {\n redirectMethod,\n ...requestArgs\n } = args;\n const handle = await this._redirectNavigator.prepare({ redirectMethod });\n await this._signoutStart({\n request_type: \"so:r\",\n post_logout_redirect_uri: this.settings.post_logout_redirect_uri,\n ...requestArgs,\n }, handle);\n logger.info(\"success\");\n }\n\n /**\n * Process response (callback) from the end session endpoint.\n * It is recommended to use {@link UserManager.signoutCallback} instead.\n *\n * @returns A promise containing signout response\n *\n * @see {@link UserManager.signoutCallback}\n */\n public async signoutRedirectCallback(url = window.location.href): Promise<SignoutResponse> {\n const logger = this._logger.create(\"signoutRedirectCallback\");\n const response = await this._signoutEnd(url);\n logger.info(\"success\");\n return response;\n }\n\n /**\n * Trigger a redirect of a popup window to the end session endpoint.\n *\n * @returns A promise\n */\n public async signoutPopup(args: SignoutPopupArgs = {}): Promise<void> {\n const logger = this._logger.create(\"signoutPopup\");\n const {\n popupWindowFeatures,\n popupWindowTarget,\n popupSignal,\n ...requestArgs\n } = args;\n const url = this.settings.popup_post_logout_redirect_uri;\n\n const handle = await this._popupNavigator.prepare({ popupWindowFeatures, popupWindowTarget, popupSignal });\n await this._signout({\n request_type: \"so:p\",\n post_logout_redirect_uri: url,\n // we're putting a dummy entry in here because we\n // need a unique id from the state for notification\n // to the parent window, which is necessary if we\n // plan to return back to the client after signout\n // and so we can close the popup after signout\n state: url == null ? undefined : {},\n ...requestArgs,\n }, handle);\n logger.info(\"success\");\n }\n\n /**\n * Process response (callback) from the end session endpoint from a popup window.\n * It is recommended to use {@link UserManager.signoutCallback} instead.\n *\n * @returns A promise\n *\n * @see {@link UserManager.signoutCallback}\n */\n public async signoutPopupCallback(url = window.location.href, keepOpen = false): Promise<void> {\n const logger = this._logger.create(\"signoutPopupCallback\");\n await this._popupNavigator.callback(url, { keepOpen });\n logger.info(\"success\");\n }\n\n protected async _signout(args: CreateSignoutRequestArgs, handle: IWindow): Promise<SignoutResponse> {\n const navResponse = await this._signoutStart(args, handle);\n return await this._signoutEnd(navResponse.url);\n }\n\n protected async _signoutStart(args: CreateSignoutRequestArgs = {}, handle: IWindow): Promise<NavigateResponse> {\n const logger = this._logger.create(\"_signoutStart\");\n\n try {\n const user = await this._loadUser();\n logger.debug(\"loaded current user from storage\");\n\n if (this.settings.revokeTokensOnSignout) {\n await this._revokeInternal(user);\n }\n\n const id_token = args.id_token_hint || user && user.id_token;\n if (id_token) {\n logger.debug(\"setting id_token_hint in signout request\");\n args.id_token_hint = id_token;\n }\n\n await this.removeUser();\n logger.debug(\"user removed, creating signout request\");\n\n const signoutRequest = await this._client.createSignoutRequest(args);\n logger.debug(\"got signout request\");\n\n return await handle.navigate({\n url: signoutRequest.url,\n state: signoutRequest.state?.id,\n scriptOrigin: this.settings.iframeScriptOrigin,\n });\n } catch (err) {\n logger.debug(\"error after preparing navigator, closing navigator window\");\n handle.close();\n throw err;\n }\n }\n\n protected async _signoutEnd(url: string): Promise<SignoutResponse> {\n const logger = this._logger.create(\"_signoutEnd\");\n const signoutResponse = await this._client.processSignoutResponse(url);\n logger.debug(\"got signout response\");\n\n return signoutResponse;\n }\n\n /**\n * Trigger a silent request (via an iframe) to the end session endpoint.\n *\n * @returns A promise\n */\n public async signoutSilent(args: SignoutSilentArgs = {}): Promise<void> {\n const logger = this._logger.create(\"signoutSilent\");\n const {\n silentRequestTimeoutInSeconds,\n ...requestArgs\n } = args;\n\n const id_token_hint = this.settings.includeIdTokenInSilentSignout\n ? (await this._loadUser())?.id_token\n : undefined;\n\n const url = this.settings.popup_post_logout_redirect_uri;\n const handle = await this._iframeNavigator.prepare({ silentRequestTimeoutInSeconds });\n await this._signout({\n request_type: \"so:s\",\n post_logout_redirect_uri: url,\n id_token_hint: id_token_hint,\n ...requestArgs,\n }, handle);\n\n logger.info(\"success\");\n }\n\n /**\n * Notify the parent window of response (callback) from the end session endpoint.\n * It is recommended to use {@link UserManager.signoutCallback} instead.\n *\n * @returns A promise\n *\n * @see {@link UserManager.signoutCallback}\n */\n public async signoutSilentCallback(url = window.location.href): Promise<void> {\n const logger = this._logger.create(\"signoutSilentCallback\");\n await this._iframeNavigator.callback(url);\n logger.info(\"success\");\n }\n\n public async revokeTokens(types?: RevokeTokensTypes): Promise<void> {\n const user = await this._loadUser();\n await this._revokeInternal(user, types);\n }\n\n protected async _revokeInternal(user: User | null, types = this.settings.revokeTokenTypes): Promise<void> {\n const logger = this._logger.create(\"_revokeInternal\");\n if (!user) return;\n\n const typesPresent = types.filter(type => typeof user[type] === \"string\");\n\n if (!typesPresent.length) {\n logger.debug(\"no need to revoke due to no token(s)\");\n return;\n }\n\n // don't Promise.all, order matters\n for (const type of typesPresent) {\n await this._client.revokeToken(\n user[type]!,\n type,\n );\n logger.info(`${type} revoked successfully`);\n if (type !== \"access_token\") {\n user[type] = null as never;\n }\n }\n\n await this.storeUser(user);\n logger.debug(\"user stored\");\n await this._events.load(user);\n }\n\n /**\n * Enables silent renew for the `UserManager`.\n */\n public startSilentRenew(): void {\n this._logger.create(\"startSilentRenew\");\n void this._silentRenewService.start();\n }\n\n /**\n * Disables silent renew for the `UserManager`.\n */\n public stopSilentRenew(): void {\n this._silentRenewService.stop();\n }\n\n protected get _userStoreKey(): string {\n return `user:${this.settings.authority}:${this.settings.client_id}`;\n }\n\n protected async _loadUser(): Promise<User | null> {\n const logger = this._logger.create(\"_loadUser\");\n const storageString = await this.settings.userStore.get(this._userStoreKey);\n if (storageString) {\n logger.debug(\"user storageString loaded\");\n return User.fromStorageString(storageString);\n }\n\n logger.debug(\"no user storageString\");\n return null;\n }\n\n public async storeUser(user: User | null): Promise<void> {\n const logger = this._logger.create(\"storeUser\");\n if (user) {\n logger.debug(\"storing user\");\n const storageString = user.toStorageString();\n await this.settings.userStore.set(this._userStoreKey, storageString);\n } else {\n this._logger.debug(\"removing user\");\n await this.settings.userStore.remove(this._userStoreKey);\n if (this.settings.dpop) {\n await this.settings.dpop.store.remove(this.settings.client_id);\n }\n }\n }\n\n /**\n * Removes stale state entries in storage for incomplete authorize requests.\n */\n public async clearStaleState(): Promise<void> {\n await this._client.clearStaleState();\n }\n\n /**\n * Dynamically generates a DPoP proof for a given user, URL and optional Http method.\n * This method is useful when you need to make a request to a resource server\n * with fetch or similar, and you need to include a DPoP proof in a DPoP header.\n * @param url - The URL to generate the DPoP proof for\n * @param user - The user to generate the DPoP proof for\n * @param httpMethod - Optional, defaults to \"GET\"\n * @param nonce - Optional nonce provided by the resource server\n *\n * @returns A promise containing the DPoP proof or undefined if DPoP is not enabled/no user is found.\n */\n public async dpopProof(url: string, user: User, httpMethod?: string, nonce?: string): Promise<string | undefined> {\n const dpopState = await this.settings.dpop?.store?.get(this.settings.client_id);\n if (dpopState) {\n return await CryptoUtils.generateDPoPProof({\n url,\n accessToken: user?.access_token,\n httpMethod: httpMethod,\n keyPair: dpopState.keys,\n nonce,\n });\n }\n return undefined;\n }\n\n async generateDPoPJkt(dpopSettings: DPoPSettings): Promise<string | undefined> {\n let dpopState = await dpopSettings.store.get(this.settings.client_id);\n if (!dpopState) {\n const dpopKeys = await CryptoUtils.generateDPoPKeys();\n dpopState = new DPoPState(dpopKeys);\n await dpopSettings.store.set(this.settings.client_id, dpopState);\n }\n return await CryptoUtils.generateDPoPJkt(dpopState.keys);\n }\n}\n","{\n \"name\": \"oidc-client-ts\",\n \"version\": \"3.5.0\",\n \"description\": \"OpenID Connect (OIDC) & OAuth2 client library\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/authts/oidc-client-ts.git\"\n },\n \"homepage\": \"https://github.com/authts/oidc-client-ts#readme\",\n \"license\": \"Apache-2.0\",\n \"main\": \"dist/umd/oidc-client-ts.js\",\n \"types\": \"dist/types/oidc-client-ts.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/oidc-client-ts.d.ts\",\n \"import\": \"./dist/esm/oidc-client-ts.js\",\n \"require\": \"./dist/umd/oidc-client-ts.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"files\": [\n \"dist\"\n ],\n \"keywords\": [\n \"authentication\",\n \"oauth2\",\n \"oidc\",\n \"openid\",\n \"OpenID Connect\"\n ],\n \"scripts\": {\n \"build\": \"node scripts/build.js && npm run build-types\",\n \"build-types\": \"tsc -p tsconfig.build.json && api-extractor run\",\n \"clean\": \"git clean -fdX dist lib *.tsbuildinfo\",\n \"prepack\": \"npm run build\",\n \"test\": \"tsc && vitest run\",\n \"typedoc\": \"typedoc\",\n \"lint\": \"eslint --max-warnings=0 --cache .\",\n \"prepare\": \"husky\"\n },\n \"dependencies\": {\n \"jwt-decode\": \"^4.0.0\"\n },\n \"devDependencies\": {\n \"@eslint/eslintrc\": \"^3.2.0\",\n \"@eslint/js\": \"^9.18.0\",\n \"@microsoft/api-extractor\": \"^7.49.1\",\n \"@stylistic/eslint-plugin\": \"^2.13.0\",\n \"@testing-library/jest-dom\": \"^6.6.3\",\n \"@types/node\": \"^24.10.1\",\n \"@typescript-eslint/eslint-plugin\": \"^8.20.0\",\n \"@typescript-eslint/parser\": \"^8.20.0\",\n \"@vitest/coverage-v8\": \"^4.0.16\",\n \"esbuild\": \"^0.27.0\",\n \"eslint\": \"^9.18.0\",\n \"eslint-plugin-testing-library\": \"^7.1.1\",\n \"fake-indexeddb\": \"^6.0.0\",\n \"globals\": \"^17.0.0\",\n \"http-proxy-middleware\": \"^3.0.3\",\n \"husky\": \"^9.1.7\",\n \"jose\": \"^5.9.6\",\n \"jsdom\": \"^27.3.0\",\n \"lint-staged\": \"^16.1.0\",\n \"typedoc\": \"^0.28.0\",\n \"typescript\": \"~5.8.2\",\n \"vitest\": \"^4.0.16\",\n \"yn\": \"^5.0.0\"\n },\n \"engines\": {\n \"node\": \">=18\"\n },\n \"lint-staged\": {\n \"*.{js,jsx,ts,tsx}\": \"eslint --cache --fix\"\n }\n}\n","// @ts-expect-error avoid enabling resolveJsonModule to keep build process simple\nimport { version } from \"../package.json\";\n\n/**\n * @public\n */\nexport const Version: string = version;\n","import { DPoPState, type DPoPStore } from \"./DPoPStore\";\n\n/**\n * Provides a default implementation of the DPoP store using IndexedDB.\n *\n * @public\n */\nexport class IndexedDbDPoPStore implements DPoPStore {\n readonly _dbName: string = \"oidc\";\n readonly _storeName: string = \"dpop\";\n\n public async set(key: string, value: DPoPState): Promise<void> {\n const store = await this.createStore(this._dbName, this._storeName);\n await store(\"readwrite\", (str: IDBObjectStore) => {\n str.put(value, key);\n return this.promisifyRequest(str.transaction);\n });\n }\n\n public async get(key: string): Promise<DPoPState> {\n const store = await this.createStore(this._dbName, this._storeName);\n return await store(\"readonly\", (str) => {\n return this.promisifyRequest(str.get(key));\n }) as DPoPState;\n }\n\n public async remove(key: string): Promise<DPoPState> {\n const item = await this.get(key);\n const store = await this.createStore(this._dbName, this._storeName);\n await store(\"readwrite\", (str) => {\n return this.promisifyRequest(str.delete(key));\n });\n return item;\n }\n\n public async getAllKeys(): Promise<string[]> {\n const store = await this.createStore(this._dbName, this._storeName);\n return await store(\"readonly\", (str) => {\n return this.promisifyRequest(str.getAllKeys());\n }) as string[];\n }\n\n promisifyRequest<T = undefined>(\n request: IDBRequest<T> | IDBTransaction): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n (request as IDBTransaction).oncomplete = (request as IDBRequest<T>).onsuccess = () => resolve((request as IDBRequest<T>).result);\n (request as IDBTransaction).onabort = (request as IDBRequest<T>).onerror = () => reject((request as IDBRequest<T>).error as Error);\n });\n }\n\n async createStore<T>(\n dbName: string,\n storeName: string,\n ): Promise<(txMode: IDBTransactionMode, callback: (store: IDBObjectStore) => T | PromiseLike<T>) => Promise<T>> {\n const request = indexedDB.open(dbName);\n request.onupgradeneeded = () => request.result.createObjectStore(storeName);\n const db = await this.promisifyRequest<IDBDatabase>(request);\n\n return async (\n txMode: IDBTransactionMode,\n callback: (store: IDBObjectStore) => T | PromiseLike<T>,\n ) => {\n const tx = db.transaction(storeName, txMode);\n const store = tx.objectStore(storeName);\n return await callback(store);\n };\n }\n}\n","// 'fach-xyz.in.easygov.swiss' + 'core' -> 'core.in.easygov.swiss'\n// 'localhost' (no dot) -> null, caller must fall back to an env var\nfunction replaceLeadingLabel(hostname: string, label: string): string | null {\n const dotIndex = hostname.indexOf('.');\n return dotIndex === -1 ? null : `${label}${hostname.slice(dotIndex)}`;\n}\n\n// Next.js/Turbopack only inlines NEXT_PUBLIC_* vars into the browser bundle\n// when accessed as a literal `process.env.NEXT_PUBLIC_X` at the call site —\n// a dynamic key (e.g. `process.env[someVariable]`) is never replaced, so it\n// silently evaluates to undefined client-side. Each exported resolver must\n// therefore read its own literal env var directly instead of going through\n// a shared helper parameterized by var name.\nfunction deriveOrigin(subdomain: string): string | null {\n if (typeof window === 'undefined') return null;\n const { protocol, hostname } = window.location;\n const replaced = replaceLeadingLabel(hostname, subdomain);\n return replaced ? `${protocol}//${replaced}` : null;\n}\n\nexport function resolveCoreOrigin(): string | null {\n return process.env.NEXT_PUBLIC_CORE_ORIGIN || deriveOrigin('core');\n}\n\nexport function resolveInfoOrigin(): string | null {\n return process.env.NEXT_PUBLIC_INFO_ORIGIN || deriveOrigin('info');\n}\n\nexport function resolveCoreApiOrigin(): string | null {\n return process.env.NEXT_PUBLIC_CORE_API_ORIGIN || resolveCoreOrigin();\n}\n\n// Keycloak on easygov.swiss is reachable at auth.<stage>.easygov.swiss but still\n// requires the realm path — it does not resolve OIDC endpoints at the bare origin.\nconst EASYGOV_REALM_PATH = '/auth/realms/easygov';\n\nexport function resolveOidcAuthority(): string | null {\n if (process.env.NEXT_PUBLIC_OIDC_AUTHORITY) return process.env.NEXT_PUBLIC_OIDC_AUTHORITY;\n const origin = deriveOrigin('auth');\n return origin ? `${origin}${EASYGOV_REALM_PATH}` : null;\n}\n\nexport type EnvironmentStage = 'IN' | 'VP' | 'DEV';\n\n// Classifies the hostname's remainder after stripping the leading label (the same slice\n// replaceLeadingLabel swaps) into a badge stage. Unlike replaceLeadingLabel/deriveOrigin\n// (which substitute the label to build a sibling origin), this only needs to recognize the\n// exact production remainder — a production ALLOWLIST, not a non-prod pattern-match.\n// Anything else — an unrecognized/future easygov.swiss stage segment, or a\n// non-easygov.swiss host entirely (localhost, the adesso dev cluster, a custom domain) — is\n// treated as non-production and defaults to DEV. Silently looking like production is the\n// worse failure mode for a government service.\nfunction classifyRemainder(remainder: string): EnvironmentStage | null {\n if (remainder === 'easygov.swiss') return null;\n if (remainder === 'in.easygov.swiss') return 'IN';\n if (remainder === 'vp.easygov.swiss') return 'VP';\n return 'DEV';\n}\n\nexport function resolveEnvironmentStage(): EnvironmentStage | null {\n if (typeof window === 'undefined') return null;\n const { hostname } = window.location;\n const dotIndex = hostname.indexOf('.');\n if (dotIndex === -1) return 'DEV'; // localhost — no dot at all\n return classifyRemainder(hostname.slice(dotIndex + 1));\n}\n","import {\n InMemoryWebStorage,\n UserManager,\n WebStorageStateStore,\n type User as OidcUser,\n type UserManagerSettings,\n} from 'oidc-client-ts';\nimport { resolveCoreOrigin, resolveInfoOrigin, resolveOidcAuthority } from './env';\n\n// oidc-client-ts spawns background processes (monitorSession iframe,\n// automaticSilentRenew) that can reject with TypeError('Load failed') when\n// Keycloak is unreachable or CORS blocks the fetch. These are not application\n// errors — prevent them from reaching the Next.js dev overlay.\nif (typeof window !== 'undefined') {\n window.addEventListener('unhandledrejection', (e: PromiseRejectionEvent) => {\n // oidc-client-ts background fetch failures (monitorSession iframe,\n // automaticSilentRenew) surface as TypeError('Load failed') or\n // TypeError('Failed to fetch'). These are not application bugs —\n // they mean Keycloak is temporarily unreachable. Suppress so the\n // Next.js dev overlay doesn't show them as fatal errors.\n const msg: string = e.reason instanceof Error ? e.reason.message : '';\n if (e.reason instanceof TypeError && (msg === 'Load failed' || msg === 'Failed to fetch')) {\n e.preventDefault();\n console.info('[easygov-header] suppressed background OIDC fetch error:', msg);\n }\n });\n}\n\nexport interface SessionUser {\n sub: string;\n name: string;\n}\n\nexport interface Session {\n user: SessionUser;\n accessToken: string;\n}\n\n/**\n * Lifecycle status of the OIDC session, orthogonal to the `current` payload.\n *\n * A route guard must key off this — NOT `user === null` — because a null user is\n * ambiguous: it occurs during logout, token renewal, and a silent-renew blip, none\n * of which mean \"genuinely logged out\". Only `unauthenticated` is a settled\n * logged-out state that is safe to react to with a login redirect.\n *\n * - `initializing` — initSession() has not resolved yet.\n * - `authenticated` — a valid session is present.\n * - `renewing` — the access token expired / a silent renew is running; the\n * previous session is kept until the renew resolves.\n * - `signing-in` — requireSession() issued a login redirect; navigation pending.\n * - `signing-out` — signOut() issued a logout redirect; navigation pending.\n * - `unauthenticated`— settled logged out. THE ONLY state that warrants a login redirect.\n * - `no-auth` — no OIDC authority configured / UserManager construction failed.\n */\nexport type AuthStatus =\n | 'initializing'\n | 'authenticated'\n | 'renewing'\n | 'signing-in'\n | 'signing-out'\n | 'unauthenticated'\n | 'no-auth';\n\ntype Listener = (session: Session | null) => void;\n\nconst OIDC_CLIENT_ID = 'core';\n\nlet current: Session | null = null;\nlet sessionInitialized = false;\nlet status: AuthStatus = 'initializing';\nconst listeners = new Set<Listener>();\nlet manager: UserManager | null = null;\n// True once initSession() has determined no auth is possible (no authority\n// configured, or UserManager construction failed). Tracked separately from\n// `manager` so requireSession()/signOut() can keep relying on a plain\n// `manager === null` check instead of a fake UserManager sentinel object.\nlet noAuthMode = false;\n\nfunction notify(): void {\n for (const listener of [...listeners]) listener(current);\n}\n\n// Transition the lifecycle status and notify subscribers. No-ops (and skips the\n// notify) when the status is unchanged, so status-only subscribers don't churn.\nfunction setStatus(next: AuthStatus): void {\n if (status === next) return;\n status = next;\n notify();\n}\n\nfunction applyOidcUser(oidcUser: OidcUser | null): void {\n if (oidcUser === null || oidcUser.expired === true) {\n if (current !== null) { current = null; notify(); }\n return;\n }\n const profile = oidcUser.profile as { sub?: string; name?: string; preferred_username?: string };\n const sub = profile.sub ?? '';\n const name = profile.name ?? profile.preferred_username ?? '(unknown)';\n current = { user: { sub, name }, accessToken: oidcUser.access_token };\n // Always notify here (not via setStatus): on a silent renew the userLoaded event\n // re-fires with a fresh access token while status is already 'authenticated', and\n // consumers must still observe the new token.\n status = 'authenticated';\n notify();\n}\n\nfunction buildSettings(): UserManagerSettings {\n const authority = resolveOidcAuthority() ?? '';\n const coreOrigin = resolveCoreOrigin() ?? '';\n const fallbackUri = typeof window !== 'undefined'\n ? window.location.origin + window.location.pathname\n : '';\n // Pre-populate standard Keycloak metadata so oidc-client-ts skips the\n // .well-known/openid-configuration fetch. That fetch requires CORS headers\n // on the Keycloak server — which may not be configured for localhost.\n // On production easygov.swiss the same URLs apply; on other environments\n // (adesso cluster) they are derived from the same authority base.\n const metadata = authority ? {\n authorization_endpoint: `${authority}/protocol/openid-connect/auth`,\n token_endpoint: `${authority}/protocol/openid-connect/token`,\n end_session_endpoint: `${authority}/protocol/openid-connect/logout`,\n userinfo_endpoint: `${authority}/protocol/openid-connect/userinfo`,\n check_session_iframe: `${authority}/protocol/openid-connect/login-status-iframe.html`,\n jwks_uri: `${authority}/protocol/openid-connect/certs`,\n } : undefined;\n return {\n authority,\n client_id: OIDC_CLIENT_ID,\n redirect_uri: fallbackUri,\n silent_redirect_uri: `${coreOrigin}/oidc-silent.html`,\n // oidc-client-ts validates the silent-renew postMessage's event.origin against\n // window.location.origin by default. Since silent_redirect_uri always points at\n // Core's origin (oidc-silent.html only exists there), that default rejects the\n // message whenever a different app (fach, info) is the one calling signinSilent.\n iframeScriptOrigin: coreOrigin,\n post_logout_redirect_uri: resolveInfoOrigin() ?? fallbackUri,\n scope: 'openid profile email',\n automaticSilentRenew: true,\n monitorSession: true,\n metadata,\n // Tokens live only in JS heap memory — never sessionStorage/localStorage — so\n // they cannot be read back out of disk-backed storage after an XSS attack.\n // Lost on reload; initSession()'s signinSilent() call re-establishes the\n // session via the Keycloak SSO cookie.\n userStore: new WebStorageStateStore({ store: new InMemoryWebStorage() }),\n };\n}\n\nconst OIDC_PARAM_KEYS = ['code', 'state', 'session_state', 'iss', 'error', 'error_description', 'error_uri'] as const;\n\nfunction hasOidcCallbackParams(search: string): boolean {\n return /[?&](code|error)=/.test(search);\n}\n\nfunction clearOidcParamsFromUrl(): void {\n if (typeof window === 'undefined') return;\n const url = new URL(window.location.href);\n let dirty = false;\n for (const k of OIDC_PARAM_KEYS) {\n if (url.searchParams.has(k)) { url.searchParams.delete(k); dirty = true; }\n }\n if (dirty) window.history.replaceState({}, document.title, url.pathname + url.search + url.hash);\n}\n\nfunction isInOidcSilentIframe(): boolean {\n if (typeof window === 'undefined') return false;\n try { return window !== window.top; } catch { return true; }\n}\n\nfunction degradeToNoAuth(): void {\n noAuthMode = true;\n sessionInitialized = true;\n setStatus('no-auth');\n}\n\nfunction errorCodeOf(err: unknown): string {\n if (err !== null && typeof err === 'object' && 'error' in err) {\n const code = (err as { error?: unknown }).error;\n if (typeof code === 'string') return code;\n }\n return '';\n}\n\nexport async function initSession(): Promise<void> {\n if (manager !== null || noAuthMode) {\n if (process.env['NODE_ENV'] !== 'production') {\n console.warn('[easygov-header] initSession called more than once. Mount a single <EasygovHeader> per page.');\n }\n return;\n }\n\n // No OIDC authority = localhost without env vars → degrade gracefully\n if (!resolveOidcAuthority()) {\n if (process.env['NODE_ENV'] !== 'production') {\n console.warn('[easygov-header] No OIDC authority configured. Set NEXT_PUBLIC_OIDC_AUTHORITY for local dev.');\n }\n degradeToNoAuth();\n return;\n }\n\n if (typeof window !== 'undefined' && isInOidcSilentIframe() && hasOidcCallbackParams(window.location.search)) {\n return;\n }\n\n try {\n manager = new UserManager(buildSettings());\n } catch (err) {\n if (process.env['NODE_ENV'] !== 'production') {\n console.warn('[easygov-header] Failed to create OIDC UserManager:', err);\n }\n degradeToNoAuth();\n return;\n }\n manager.events.addUserLoaded((u) => applyOidcUser(u));\n // userUnloaded fires from removeUser(), which oidc-client-ts calls synchronously\n // at the start of signoutRedirect() — before the browser navigates to the logout\n // endpoint. During that window status is already 'signing-out' (set in signOut()),\n // so we must NOT reinterpret it as a terminal logout; doing so is what let a guard\n // fire a competing login redirect that cancelled the logout.\n manager.events.addUserUnloaded(() => {\n if (status !== 'signing-out') setStatus('unauthenticated');\n applyOidcUser(null);\n });\n // Token expired / silent-renew failure are transient: automaticSilentRenew is\n // (re)fetching a token, or Keycloak is briefly unreachable. Keep the existing\n // session visible and mark 'renewing' so the route guard does not redirect. A\n // genuine server-side logout arrives via addUserSignedOut below.\n manager.events.addAccessTokenExpired(() => setStatus('renewing'));\n // Suppress unhandled rejections from background OIDC processes (monitorSession\n // iframe, automaticSilentRenew) — oidc-client-ts fires this event on failure.\n manager.events.addSilentRenewError(() => setStatus('renewing'));\n manager.events.addUserSignedOut(() => {\n setStatus('unauthenticated');\n applyOidcUser(null);\n });\n\n const search = typeof window !== 'undefined' ? window.location.search : '';\n\n if (typeof window !== 'undefined' && /[?&]code=/.test(search) && /[?&]state=/.test(search)) {\n try { await manager.signinCallback(); } catch { /* ignore */ }\n clearOidcParamsFromUrl();\n sessionInitialized = true;\n // signinCallback() raises userLoaded → applyOidcUser set status/current already;\n // this settles the terminal status explicitly for the callback-failed case too.\n // Notify unconditionally so `initialized`-based consumers observe init completing.\n status = current !== null ? 'authenticated' : 'unauthenticated';\n notify();\n return;\n }\n\n let topLevelHadError = false;\n if (typeof window !== 'undefined' && /[?&]error=/.test(search)) {\n topLevelHadError = true;\n clearOidcParamsFromUrl();\n }\n\n // userStore is InMemoryWebStorage — freshly empty on every mount — so there is\n // never a previously-stored user to restore here. The only way to become\n // authenticated on mount is a successful signinSilent() below (which fires\n // userLoaded and lets applyOidcUser() set status/current).\n if (!topLevelHadError) {\n try {\n await manager.signinSilent();\n } catch (err) {\n if (process.env['NODE_ENV'] !== 'production') {\n const code = errorCodeOf(err);\n console.info('[easygov-header] silent SSO unavailable', code !== '' ? code : err instanceof Error ? err.message : err);\n }\n }\n }\n sessionInitialized = true;\n // Notify unconditionally so `initialized`-based consumers observe init completing.\n status = current !== null ? 'authenticated' : 'unauthenticated';\n notify();\n}\n\nexport function getSessionInitialized(): boolean { return sessionInitialized; }\nexport function getAuthStatus(): AuthStatus { return status; }\nexport function getAccessToken(): string | null { return current?.accessToken ?? null; }\nexport function getUser(): SessionUser | null { return current?.user ?? null; }\n\nexport function onSessionChange(listener: Listener): () => void {\n listeners.add(listener);\n return () => { listeners.delete(listener); };\n}\n\nexport function requireSession(): void {\n if (manager === null) return;\n // Set synchronously BEFORE the redirect so the transient state during navigation\n // is never misread as 'unauthenticated' (which would re-trigger this redirect).\n setStatus('signing-in');\n void manager.signinRedirect();\n}\n\nexport function signOut(): void {\n if (manager === null) return;\n // Set synchronously BEFORE signoutRedirect(): oidc-client-ts calls removeUser()\n // (→ userUnloaded → current=null) synchronously inside signoutRedirect(), before\n // the browser navigates to the logout endpoint. Marking 'signing-out' first is\n // what stops a route guard from firing a competing login redirect in that window.\n setStatus('signing-out');\n void manager.signoutRedirect();\n}\n\n// requireSession()/signOut() above set status synchronously just before a full top-level\n// navigation to the OIDC provider. On a cancelled/back-navigated bfcache restore, `status` is\n// still frozen at 'signing-in'/'signing-out' and nothing else resolves it. `current` was already\n// updated synchronously by the time the redirect would have fired (signing-in: untouched, so\n// still null — the login path is only reachable while unauthenticated; signing-out: cleared to\n// null by the synchronous removeUser()/userUnloaded that signoutRedirect() fires before\n// navigating) — so resolving status from `current` the same way initSession() does above is\n// correct here too. `pageshow` with `persisted: true` is the standard signal for a bfcache\n// restore; a plain page reload never reaches this handler with a stale `status` in the first\n// place, since the whole module re-executes from `initializing`.\nif (typeof window !== 'undefined') {\n window.addEventListener('pageshow', (e: PageTransitionEvent) => {\n if (!e.persisted) return;\n if (status === 'signing-in' || status === 'signing-out') {\n setStatus(current !== null ? 'authenticated' : 'unauthenticated');\n }\n });\n}\n\nexport function clearSession(): void {\n current = null;\n status = 'unauthenticated';\n notify();\n}\n\n/** @internal — test-only */\nexport function __setSessionForTests(next: Session | null): void {\n current = next;\n sessionInitialized = true;\n status = next !== null ? 'authenticated' : 'unauthenticated';\n notify();\n}\n\n/** @internal — test-only */\nexport function __setAuthStatusForTests(next: AuthStatus): void {\n status = next;\n sessionInitialized = next !== 'initializing';\n notify();\n}\n\n/** @internal — test-only */\nexport function __resetSessionForTests(): void {\n current = null;\n sessionInitialized = false;\n status = 'initializing';\n listeners.clear();\n manager = null;\n noAuthMode = false;\n}\n","// Observes the customer/process/parentprocess context encoded in the URL path, from *every*\n// source of a URL change — not just back/forward.\n//\n// `popstate` fires only for back/forward navigation; a client-side router navigation (Next's\n// router.push/replace, and any equivalent) goes through history.pushState/replaceState, which\n// fire no event at all. Listening for `popstate` alone therefore misses every in-app navigation\n// — which is what left the header showing a stale customer account after /select-account\n// replaced the URL (EGOV-1339). Wrapping those two methods is the standard fill for that gap;\n// the alternative, the Navigation API's `navigate` event, is Chromium-only. Kept\n// framework-agnostic like the rest of EasygovHeader, so a consuming app never has to wire its\n// router in for the header to notice a context switch — see REQ-INT-10 for the consumer-visible\n// side effect that buys.\n\nexport type UrlContext = { type: 'customer' | 'process' | 'parentprocess'; id: string };\n\nconst CONTEXT_MARKERS: ReadonlySet<string> = new Set(['customer', 'process', 'parentprocess']);\n\nfunction urlPathSegments(): string[] {\n if (typeof window === 'undefined') return [];\n return window.location.pathname.split('/').filter(Boolean);\n}\n\n// Scans for a `customer`/`process`/`parentprocess` marker segment anywhere in the path. Exact\n// whole-segment matching, so `parentprocess` and `process` cannot shadow one another; a path\n// carrying two markers resolves to whichever appears first.\nexport function readContextFromUrl(): UrlContext | null {\n const segments = urlPathSegments();\n const typeIndex = segments.findIndex((segment) => CONTEXT_MARKERS.has(segment));\n const idSegment = typeIndex === -1 ? undefined : segments[typeIndex + 1];\n if (!idSegment) return null;\n return {\n type: segments[typeIndex] as UrlContext['type'],\n id: decodeURIComponent(idSegment),\n };\n}\n\nlet cachedPathname: string | null = null;\nlet cachedContext: UrlContext | null = null;\n\nfunction isSameContext(a: UrlContext | null, b: UrlContext | null): boolean {\n if (a === null || b === null) return a === b;\n return a.type === b.type && a.id === b.id;\n}\n\n/**\n * The URL's current context as an identity-stable `useSyncExternalStore` snapshot — the same\n * object is returned until the context itself changes.\n *\n * Two properties callers depend on: navigating between two pages of one context\n * (/dashboard/customer/X → /favorites/customer/X) is not observed as a change, so\n * context-keyed work (the `header-context` request, whose response is a pure function of\n * access token + this context) does not re-run; and the pathname is only re-parsed when it\n * actually differs, since `getSnapshot` runs on every render as well as every URL change.\n */\nexport function readUrlContext(): UrlContext | null {\n const pathname = typeof window === 'undefined' ? '' : window.location.pathname;\n if (pathname === cachedPathname) return cachedContext;\n cachedPathname = pathname;\n const next = readContextFromUrl();\n if (!isSameContext(next, cachedContext)) cachedContext = next;\n return cachedContext;\n}\n\n/** Server/hydration snapshot: the build has no URL. */\nexport function readServerUrlContext(): UrlContext | null {\n return null;\n}\n\nconst listeners = new Set<() => void>();\nlet installed = false;\nlet notifyScheduled = false;\n\nfunction notify(): void {\n notifyScheduled = false;\n if (listeners.size === 0) return;\n for (const listener of [...listeners]) listener();\n}\n\n// Deferred to a microtask instead of notified inline. Next's App Router commits every\n// navigation's URL from inside a `useInsertionEffect` (app-router.js, HistoryUpdater), and React\n// forbids scheduling an update from that phase — notifying inline made a subscribing\n// useSyncExternalStore re-render from there, which logs \"useInsertionEffect must not schedule\n// updates\" on every client-side navigation. A microtask runs once the commit has finished, with\n// window.location already updated, and coalesces a burst of history calls into a single notify.\nfunction scheduleNotify(): void {\n if (notifyScheduled || listeners.size === 0) return;\n notifyScheduled = true;\n queueMicrotask(notify);\n}\n\n// Installed on first subscribe and never uninstalled: un-patching safely would mean tracking\n// whether anyone else (a router, another EasygovHeader) wrapped the same methods after us.\n// Once installed it is a no-op while nobody is subscribed. A second copy of this module (the\n// web-components drop-in bundles its own — tsup `noExternal`) wraps this wrapper rather than\n// replacing it, so every copy still notifies its own subscribers exactly once.\nfunction install(): void {\n if (installed) return;\n installed = true;\n for (const method of ['pushState', 'replaceState'] as const) {\n const original = window.history[method].bind(window.history);\n window.history[method] = (data: unknown, unused: string, url?: string | URL | null): void => {\n // Delegate first, so listeners read the already-updated window.location.\n original(data, unused, url);\n scheduleNotify();\n };\n }\n window.addEventListener('popstate', scheduleNotify);\n}\n\nexport function subscribeUrlContext(listener: () => void): () => void {\n install();\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n","// The decoded header context, published by EasygovHeader and observed by consumers through\n// useEasygovHeaderContext. A module-level store rather than React context, mirroring session.ts:\n// consumers must not have to mount a provider around the header to read what it already fetched.\n\nimport type { HeaderContextClaims } from './types';\n\nexport interface EasygovHeaderContext {\n contextJwt: string | null;\n /**\n * Decoded but NOT signature-verified — see HeaderContextClaims. Null until the first\n * context resolves and again after sign-out; a failed refetch keeps the previously resolved\n * claims.\n */\n claims: HeaderContextClaims | null;\n}\n\nconst EMPTY: EasygovHeaderContext = { contextJwt: null, claims: null };\n\nlet snapshot: EasygovHeaderContext = EMPTY;\nconst listeners = new Set<() => void>();\n\n/** Registers `listener` to be called after every `publishHeaderContext` write; returns an unsubscribe function. */\nexport function subscribeHeaderContext(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * The current context as an identity-stable `useSyncExternalStore` snapshot — the same object is\n * returned until the context itself changes. `getSnapshot` runs on every render, so building a\n * fresh object per call would re-render forever. Decoded from the context JWT, signature unverified:\n * safe to render, never to authorize.\n */\nexport function readHeaderContext(): EasygovHeaderContext {\n return snapshot;\n}\n\n/** Server/hydration snapshot: no context exists until the client has fetched one. */\nexport function readServerHeaderContext(): EasygovHeaderContext {\n return EMPTY;\n}\n\n/**\n * @internal — written by EasygovHeader only. Publishing `null` (logout, or a session that never\n * resolved) clears the store, so subscribers cannot keep rendering a signed-out user's account.\n * The jwt identity guard is enough to detect change: claims are derived from the jwt.\n */\nexport function publishHeaderContext(\n contextJwt: string | null,\n claims: HeaderContextClaims | null,\n): void {\n if (contextJwt === snapshot.contextJwt) return;\n snapshot = contextJwt === null ? EMPTY : { contextJwt, claims };\n for (const listener of [...listeners]) listener();\n}\n\n/** @internal — test-only */\nexport function __resetHeaderContextForTests(): void {\n snapshot = EMPTY;\n listeners.clear();\n}\n","{\n \"name\": \"@easygov/react-components\",\n \"version\": \"0.9.0\",\n \"private\": false,\n \"description\": \"React 19 component library for EasyGov — accessible UI components styled with eg-* design tokens.\",\n \"license\": \"MIT\",\n \"author\": \"easygov\",\n \"keywords\": [\n \"easygov\",\n \"react\",\n \"components\",\n \"ui\",\n \"design-system\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://gitlab.adesso-group.com/229efe07/easygov20-highcode-ui-components.git\",\n \"directory\": \"packages/react-components\"\n },\n \"sideEffects\": [\n \"**/*.css\"\n ],\n \"exports\": {\n \".\": \"./src/index.ts\",\n \"./icons\": \"./src/icons/index.ts\",\n \"./styles.css\": {\n \"types\": \"./src/styles/styles-css.d.mts\",\n \"default\": \"./dist/easygov.css\"\n },\n \"./fonts.css\": \"./src/styles/fonts.css\",\n \"./fonts/noto-sans-latin\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./src/fonts/NotoSans-latin.woff2\"\n },\n \"./fonts/noto-sans-latin-ext\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./src/fonts/NotoSans-latin-ext.woff2\"\n },\n \"./fonts/noto-sans-italic-latin\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./src/fonts/NotoSans-Italic-latin.woff2\"\n },\n \"./fonts/noto-sans-italic-latin-ext\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./src/fonts/NotoSans-Italic-latin-ext.woff2\"\n }\n },\n \"files\": [\n \"dist\",\n \"src/fonts/OFL.txt\",\n \"src/fonts/woff2.d.mts\",\n \"src/styles/styles-css.d.mts\"\n ],\n \"publishConfig\": {\n \"access\": \"public\",\n \"main\": \"./dist/easygov.mjs\",\n \"module\": \"./dist/easygov.mjs\",\n \"types\": \"./dist/easygov.d.mts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/easygov.d.mts\",\n \"import\": \"./dist/easygov.mjs\"\n },\n \"./icons\": {\n \"types\": \"./dist/icons.d.mts\",\n \"import\": \"./dist/icons.mjs\"\n },\n \"./styles.css\": {\n \"types\": \"./src/styles/styles-css.d.mts\",\n \"default\": \"./dist/easygov.css\"\n },\n \"./fonts.css\": \"./dist/fonts.css\",\n \"./fonts/noto-sans-latin\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./dist/NotoSans-latin.woff2\"\n },\n \"./fonts/noto-sans-latin-ext\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./dist/NotoSans-latin-ext.woff2\"\n },\n \"./fonts/noto-sans-italic-latin\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./dist/NotoSans-Italic-latin.woff2\"\n },\n \"./fonts/noto-sans-italic-latin-ext\": {\n \"types\": \"./src/fonts/woff2.d.mts\",\n \"default\": \"./dist/NotoSans-Italic-latin-ext.woff2\"\n }\n }\n },\n \"scripts\": {\n \"lint\": \"eslint .\",\n \"build\": \"tsup\",\n \"check-types\": \"tsc --noEmit\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"generate:logos\": \"node scripts/generate-logos.mjs\",\n \"prepublishOnly\": \"tsup\"\n },\n \"peerDependencies\": {\n \"react\": \"^19\",\n \"react-dom\": \"^19\"\n },\n \"devDependencies\": {\n \"@easygov/design-tokens\": \"workspace:*\",\n \"@easygov/eslint-config\": \"workspace:*\",\n \"@easygov/typescript-config\": \"workspace:*\",\n \"@testing-library/jest-dom\": \"^7.0.0\",\n \"@testing-library/react\": \"^16.3.2\",\n \"@types/node\": \"^24.0.0\",\n \"@types/react\": \"19.3.0\",\n \"@types/react-dom\": \"19.3.0\",\n \"@vitest/coverage-v8\": \"^4.1.9\",\n \"eslint\": \"^9.39.1\",\n \"jsdom\": \"^30.0.0\",\n \"react\": \"^19.2.0\",\n \"react-dom\": \"^19.2.0\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"5.9.3\",\n \"vitest\": \"^4.1.9\"\n },\n \"dependencies\": {\n \"@base-ui/react\": \"^1.5.0\",\n \"class-variance-authority\": \"^0.7.1\",\n \"oidc-client-ts\": \"^3.5.0\"\n }\n}\n","// The current version info, published once at module load (libraryVersion) and again after\n// the first successful backend fetch (backendVersion). Module-level store rather than React\n// context, mirroring header-context-store.ts: consumers must not have to mount a provider\n// around the header to read what it already fetched.\n\nimport pkg from '../../../package.json';\nimport { resolveCoreApiOrigin } from './env';\n\nexport interface EasygovVersionInfo {\n /** This package's own version, from package.json — known synchronously, never null. */\n libraryVersion: string;\n /**\n * The core-backend API version reported by GET /external/api/v1/version. Null until the\n * first fetch resolves, and stays null forever on any failure (non-2xx, network error,\n * unresolved origin, malformed body) — there is no retry.\n */\n backendVersion: string | null;\n}\n\nconst libraryVersion: string = pkg.version;\n\nlet snapshot: EasygovVersionInfo = { libraryVersion, backendVersion: null };\nconst serverSnapshot: EasygovVersionInfo = { libraryVersion, backendVersion: null };\nconst listeners = new Set<() => void>();\n\n/** Registers `listener` to be called after every `publishBackendVersion` write; returns an unsubscribe function. */\nexport function subscribeVersionInfo(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * The current version info as an identity-stable `useSyncExternalStore` snapshot — the same\n * object is returned until the backend version changes. `getSnapshot` runs on every render,\n * so building a fresh object per call would re-render forever.\n */\nexport function readVersionInfo(): EasygovVersionInfo {\n return snapshot;\n}\n\n/** Server/hydration snapshot: the backend version is never known before the client fetches it. */\nexport function readServerVersionInfo(): EasygovVersionInfo {\n return serverSnapshot;\n}\n\n/** @internal — written by ensureBackendVersionFetch only. */\nfunction publishBackendVersion(version: string): void {\n snapshot = { libraryVersion, backendVersion: version };\n for (const listener of [...listeners]) listener();\n}\n\n// Module-level (not per-component-instance) so that mounting more than one EasygovHeader on\n// the same page — or the same header remounting — never issues a second network request for\n// a value that cannot change during the page's lifetime.\nlet fetchStarted = false;\n\n/**\n * Fetches the backend version at most once per page load and publishes it to the store on\n * success. Safe to call from every EasygovHeader mount: the module-level `fetchStarted` guard\n * makes every call after the first a no-op. Failures (bad status, network error, unresolved\n * origin, unparseable body) are swallowed — the store's backendVersion simply stays null, and\n * the version tooltip falls back to showing only the library version.\n */\nexport function ensureBackendVersionFetch(): void {\n if (fetchStarted) return;\n fetchStarted = true;\n\n const apiOrigin = resolveCoreApiOrigin();\n if (!apiOrigin) return;\n\n void (async () => {\n try {\n const res = await fetch(`${apiOrigin}/external/api/v1/version`);\n if (!res.ok) return;\n const data = (await res.json()) as { version?: unknown };\n if (typeof data.version !== 'string') return;\n publishBackendVersion(data.version);\n } catch {\n // Silently keep backendVersion null — see the doc comment above.\n }\n })();\n}\n\n/** @internal — test-only */\nexport function __resetVersionStoreForTests(): void {\n snapshot = { libraryVersion, backendVersion: null };\n serverSnapshot.backendVersion = null;\n listeners.clear();\n fetchStarted = false;\n}\n","import { type Locale, t } from \"./translations/t\";\n\n/**\n * Minimal, LOCAL mirror of the RFC 9457 Problem Detail (+ tracing extension) shape\n * `/external/bff/api/header-context` may respond with on failure. `@easygov/bff-api-client`\n * (which owns the real `ProblemDetailWithTrace` type and `formatErrorReference`) lives in the\n * separate `easygov20-highcode-application` repo and cannot be depended on from here — this\n * package must stay framework/app-agnostic (it also ships as web components) and has no access\n * to that repo's OpenAPI spec. Kept in sync by hand, same as `HeaderContextClaims` in ./types.ts.\n */\nexport interface HeaderContextProblemDetail {\n type?: string;\n title?: string;\n status?: number;\n detail?: string;\n instance?: string;\n errorCode?: string;\n traceId?: string;\n timestamp?: string;\n}\n\nconst KNOWN_PROBLEM_KEYS: ReadonlySet<string> = new Set([\n \"type\",\n \"title\",\n \"status\",\n \"detail\",\n \"instance\",\n \"errorCode\",\n \"traceId\",\n \"timestamp\",\n]);\n\n/**\n * Distinguishes \"no error\" (`null`) from \"an error occurred but its body didn't parse\"\n * (`{ problem: null }`) — a bare nullable `HeaderContextProblemDetail | null` can't tell those\n * apart, and the dialog must still open (with the generic fallback) in the second case.\n */\nexport interface HeaderContextErrorState {\n problem: HeaderContextProblemDetail | null;\n}\n\n/** Content for `<ErrorDialog>`, already localized — see `ErrorDialogProps` in `../ErrorDialog`. */\nexport interface HeaderContextErrorContent {\n title: string;\n message: string;\n reference?: string;\n details?: Record<string, unknown>;\n}\n\n/**\n * Best-effort parse of a failed header-context response's JSON body as a Problem Detail. Never\n * throws: returns `null` when the body is missing, not JSON, or not a plain object, so an\n * empty/non-JSON error body from an upstream proxy or gateway degrades to the generic fallback\n * message instead of crashing the header.\n */\nexport async function parseHeaderContextProblem(\n res: Response,\n): Promise<HeaderContextProblemDetail | null> {\n try {\n const body: unknown = await res.json();\n if (typeof body !== \"object\" || body === null || Array.isArray(body)) return null;\n return body as HeaderContextProblemDetail;\n } catch {\n return null;\n }\n}\n\n/**\n * Maps a (possibly null/unparsed) header-context Problem Detail to `<ErrorDialog>` content,\n * entirely through EasygovHeader's own translations/t.ts — never surfacing `problem.detail` or\n * `problem.title` verbatim, since those are backend-authored and not guaranteed to be in the\n * visitor's DisplayLanguage.\n *\n * Deliberately does NOT special-case every backend `errorCode`: `customer-account-not-accessible`\n * is EGOV-559's own motivating example, so it gets a specific, actionable message; anything else\n * (including no errorCode at all, or a null `problem`) falls back to one generic message. Add\n * more `errorCode` branches here as concrete cases come up — this function, not EasygovHeader.tsx,\n * is the single place that knowledge belongs.\n */\nexport function mapHeaderContextError(\n problem: HeaderContextProblemDetail | null,\n locale: Locale,\n): HeaderContextErrorContent {\n // parseHeaderContextProblem's `as HeaderContextProblemDetail` cast is unvalidated over\n // arbitrary parsed JSON, so the compile-time `string | undefined` type on these two fields is\n // not runtime-guaranteed — a backend that serializes explicit JSON `null` for an absent field\n // (common with some JSON serializers) would pass a bare `!== undefined` check. Narrow to\n // \"actually a non-empty string\" so null, other non-string types, and \"\" are all rejected alike.\n const traceId =\n typeof problem?.traceId === \"string\" && problem.traceId !== \"\" ? problem.traceId : undefined;\n const errorCode =\n typeof problem?.errorCode === \"string\" && problem.errorCode !== \"\" ? problem.errorCode : undefined;\n\n const message =\n errorCode === \"customer-account-not-accessible\"\n ? t(\"errorCustomerAccountNotAccessible\", locale)\n : t(\"errorFallbackMessage\", locale);\n\n const reference =\n traceId !== undefined\n ? `${t(\"errorReference\", locale)}: ${traceId}${errorCode !== undefined ? ` (${errorCode})` : \"\"}`\n : undefined;\n\n const leftover = problem\n ? Object.fromEntries(\n (Object.entries(problem) as [string, unknown][]).filter(\n ([key]) => !KNOWN_PROBLEM_KEYS.has(key),\n ),\n )\n : {};\n const details = Object.keys(leftover).length > 0 ? leftover : undefined;\n\n return { title: t(\"errorTitle\", locale), message, reference, details };\n}\n"],"mappings":"+HAAA,IAAAA,GAAAC,GAAAC,IAAA,cAWA,IAAIC,GAAQ,IACZ,SAASC,GAAGC,EAAGC,EAAG,CAChB,OAAQD,IAAMC,IAAYD,IAAN,GAAW,EAAIA,IAAM,EAAIC,IAAQD,IAAMA,GAAKC,IAAMA,CACxE,CACA,IAAIC,GAA0B,OAAO,OAAO,IAA7B,WAAkC,OAAO,GAAKH,GAC3DI,GAAWL,GAAM,SACjBM,GAAYN,GAAM,UAClBO,GAAkBP,GAAM,gBACxBQ,GAAgBR,GAAM,cACxB,SAASS,GAAuBC,EAAWC,EAAa,CACtD,IAAIC,EAAQD,EAAY,EACtBE,EAAYR,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Q,iBAAiB,OAAS,KAChD,uBAAwBhB,EACxB,WAAY0H,EACZ,OAAQtB,EACR,eAAgBY,EAChB,gBAAiBrE,EACjB,aAAcE,EAChB,KACA,QAACuF,GAAA,CACC,KAAM/B,IAAwB,KAC9B,QAASpF,EACT,MAAOoF,GAAqB,OAAS,GACrC,QAASA,GAAqB,SAAW,GACzC,UAAWA,GAAqB,UAChC,QAASA,GAAqB,QAC9B,WAAY3C,GAAE,kBAAmB0C,CAAe,EAChD,aAAc1C,GAAE,oBAAqB0C,CAAe,EACtD,GACF,CAEJ","names":["require_use_sync_external_store_shim_production","__commonJSMin","exports","React","is","x","y","objectIs","useState","useEffect","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","require_shim","__commonJSMin","exports","module","require_with_selector_production","__commonJSMin","exports","React","shim","is","x","y","objectIs","useSyncExternalStore","useRef","useEffect","useMemo","useDebugValue","subscribe","getSnapshot","getServerSnapshot","selector","isEqual","instRef","inst","memoizedSelector","nextSnapshot","hasMemo","memoizedSnapshot","currentSelection","memoizedSelection","nextSelection","maybeGetServerSnapshot","value","require_with_selector","__commonJSMin","exports","module","de_default","en_default","fr_default","it_default","dictionaries","de_default","en_default","fr_default","it_default","t","key","locale","LOCALES","DISPLAY_LANGUAGE_COOKIE","ONE_YEAR_SECONDS","resolveCookieDomain","hostname","dotIndex","remainder","shadowingCookieScopes","canonical","scopes","current","parent","isSupportedLocale","value","LOCALES","l","buildDisplayLanguageCookie","locale","protocol","parts","domain","buildExpiredDisplayLanguageCookie","readDisplayLanguageCookie","prefix","match","entry","writeDisplayLanguageCookie","scope","DISPLAY_LANGUAGE_SYNC_EVENT","FALLBACK_LOCALE","detectBrowserLocale","language","lang","isSupportedLocale","resolve","readDisplayLanguageCookie","snapshot","listeners","installed","notify","listener","apply","next","refresh","onSyncEvent","event","detail","locale","onVisibilityChange","install","getEasygovDisplayLanguage","getServerDisplayLanguage","setEasygovDisplayLanguage","writeDisplayLanguageCookie","subscribeEasygovDisplayLanguage","import_react","React","React","hasWindow","getNodeName","node","isNode","getWindow","_node$ownerDocument","getDocumentElement","_ref","value","isElement","isHTMLElement","isShadowRoot","isOverflowElement","element","overflow","overflowX","overflowY","display","getComputedStyle","isTableElement","isTopLayer","willChangeRe","containRe","isNotNone","isWebKitValue","isContainingBlock","elementOrCss","css","isWebKit","getContainingBlock","currentNode","getParentNode","isLastTraversableNode","getNodeScroll","result","getNearestOverflowAncestor","parentNode","getOverflowAncestors","list","traverseIframes","_node$ownerDocument2","scrollableAncestor","isBody","win","frameElement","getFrameElement","React","SafeReact","React","UNINITIALIZED","useRefWithInit","init","initArg","ref","useInsertionEffect","SafeReact","useSafeInsertionEffect","fn","useStableCallback","callback","stable","useRefWithInit","createStableCallback","assertNotCalled","args","React","noop","useIsoLayoutEffect","mergeObjects","a","b","EMPTY_PROPS","mergeProps","a","b","c","d","e","createInitialMergedProps","merged","mergeInto","mergePropsN","props","i","inputProps","isPropsGetter","resolvePropsGetter","copyInitialProps","mutablyMergeInto","copiedProps","propName","propValue","isEventHandler","wrapEventHandler","mergedProps","externalProps","externalPropValue","mergeObjects","mergeClassNames","mergeEventHandlers","key","value","code0","code1","code2","previousProps","ourHandler","theirHandler","args","event","isSyntheticEvent","baseUIEvent","makeEventPreventable","result","handler","ourClassName","theirClassName","createFormatErrorMessage","baseUrl","prefix","code","args","url","arg","formatErrorMessage","formatErrorMessage_default","React","CompositeRootContext","useCompositeRootContext","optional","context","formatErrorMessage_default","React","useFocusableWhenDisabled","parameters","focusableWhenDisabled","disabled","composite","tabIndexProp","isNativeButton","isFocusableComposite","isNonFocusableComposite","additionalProps","event","ownerDocument","node","dispatchClickWithModifiers","target","sourceEvent","detail","getWindow","useButton","parameters","disabled","focusableWhenDisabled","tabIndex","isNativeButton","compositeProp","elementRef","compositeRootContext","useCompositeRootContext","isCompositeItem","focusableWhenDisabledProps","useFocusableWhenDisabled","updateDisabled","element","isButtonElement","useIsoLayoutEffect","getButtonProps","externalProps","externalOnClick","externalOnMouseDown","externalOnKeyUp","externalOnKeyDown","externalOnPointerDown","otherExternalProps","mergeProps","event","makeEventPreventable","isCurrentTarget","currentTarget","isButton","isLink","isValidLinkElement","shouldClick","isEnterKey","isSpaceKey","role","isTextNavigationRole","dispatchClickWithModifiers","buttonRef","useStableCallback","elem","isHTMLElement","React","useMergedRefs","a","b","c","d","forkRef","useRefWithInit","createForkRef","didChange","update","useMergedRefsN","refs","didChangeN","newRefs","ref","index","instance","cleanupCallbacks","i","refCleanup","cleanupCallback","React","React","majorVersion","isReactVersionAtLeast","reactVersionToCheck","getReactElementRef","element","reactElement","propsWithRef","isReactVersionAtLeast","NOOP","EMPTY_ARRAY","EMPTY_OBJECT","getStateAttributesProps","state","customMapping","props","key","value","customProps","resolveClassName","className","state","resolveStyle","style","state","import_react","useRenderElement","element","componentProps","params","renderProp","unwrapLazyRenderProp","outProps","useRenderElementProps","state","EMPTY_OBJECT","evaluateRenderProp","classNameProp","styleProp","ref","props","stateAttributesMapping","enabled","className","resolveClassName","style","resolveStyle","stateProps","getStateAttributesProps","resolvedProps","resolveRenderFunctionProps","mergeObjects","useMergedRefsN","getReactElementRef","useMergedRefs","mergeClassNames","mergePropsN","mergeProps","REACT_LAZY_TYPE","unwrapLazyRenderProp","render","REACT_LAZY_TYPE","unwrapped","evaluateRenderProp","element","props","state","mergedProps","mergeProps","renderTag","formatErrorMessage_default","renderTag","Tag","props","_createElement","Button","componentProps","forwardedRef","render","className","disabled","focusableWhenDisabled","nativeButton","style","elementProps","getButtonProps","buttonRef","useButton","useRenderElement","import_jsx_runtime","buttonVariants","cva","Button","className","variant","size","props","index_parts_exports","__export","SelectArrow","SelectBackdrop","SelectGroup","SelectGroupLabel","SelectIcon","SelectItem","SelectItemIndicator","SelectItemText","SelectLabel","SelectList","SelectPopup","SelectPortal","SelectPositioner","SelectRoot","SelectScrollDownArrow","SelectScrollUpArrow","SelectSeparator","SelectTrigger","SelectValue","React","visuallyHiddenBase","visuallyHidden","visuallyHiddenInput","React","useOnFirstRender","fn","ref","React","usePreviousValue","value","state","setState","isElementDisabled","element","React","useControlled","controlled","defaultProp","name","state","isControlled","valueState","setValue","value","setValueIfUncontrolled","newValue","useValueAsRef","value","latest","useRefWithInit","createLatestRef","useIsoLayoutEffect","React","import_shim","import_with_selector","React","hooks","currentInstance","getInstance","register","hook","hooks","fastComponent","fn","FastComponent","props","forwardedRef","instance","useRefWithInit","createInstance","result","currentInstance","fastComponentRef","canUseRawUseSyncExternalStore","isReactVersionAtLeast","useStoreImplementation","useStoreFast","useStoreLegacy","useStore","store","selector","a1","a2","a3","useStoreR19","getSelection","register","instance","didChange","i","hook","value","onStoreChange","stores","unsubscribes","unsubscribe","getInstance","index","state","Store","state","fn","newState","currentTick","listener","changes","key","value","selector","a1","a2","a3","useStore","React","ReactStore","Store","state","context","selectors","key","value","store","useIsoLayoutEffect","statePart","dependencies","controlled","isControlled","a1","a2","a3","selector","useStore","fn","stableFunction","useStableCallback","NOOP","ref","listener","selectFn","prevValue","nextState","nextValue","oldValue","mergeCleanups","cleanups","i","cleanup","addEventListener","target","type","listener","options","React","useOnMount","fn","EMPTY_ARRAY","EMPTY","LAST_RAF","Scheduler","timestamp","currentCallbacks","currentCallbacksCount","i","fn","id","index","scheduler","AnimationFrame","_AnimationFrame","fn","scheduler","id","EMPTY","useAnimationFrame","timeout","useRefWithInit","useOnMount","EMPTY","Timeout","_Timeout","delay","fn","useTimeout","timeout","useRefWithInit","useOnMount","parts_exports","__export","engine_exports","env_exports","media_query_exports","os_exports","screen_reader_exports","os_exports","__export","android","apple","ios","linux","mac","windows","readRawData","userAgent","platform","maxTouchPoints","lowerUserAgent","lowerPlatform","ios","lowerPlatform","maxTouchPoints","ANDROID_STRING","android","lowerUserAgent","mac","windows","linux","apple","engine_exports","__export","blink","gecko","webkit","webkit","gecko","lowerUserAgent","blink","screen_reader_exports","__export","voiceOver","voiceOver","apple","env_exports","__export","jsdom","jsdom","lowerUserAgent","media_query_exports","__export","iOS","stopEvent","event","isReactEvent","isVirtualClick","parts_exports","isVirtualPointerEvent","isMouseLikePointerType","pointerType","strict","values","isClickLikeEvent","type","activeElement","doc","element","contains","parent","child","rootNode","isShadowRoot","next","getTarget","event","FOCUSABLE_ATTRIBUTE","TYPEABLE_SELECTOR","ARROW_LEFT","ARROW_RIGHT","ARROW_UP","ARROW_DOWN","TransitionStatusDataAttributes_exports","__export","endingStyle","startingStyle","STARTING_HOOK","startingStyle","ENDING_HOOK","endingStyle","transitionStatusMapping","value","CommonPopupDataAttributes_exports","__export","align","anchorHidden","closed","endingStyle","open","side","startingStyle","open","closed","startingStyle","endingStyle","anchorHidden","side","align","CommonTriggerDataAttributes_exports","__export","popupOpen","pressed","TRIGGER_HOOK","popupOpen","PRESSABLE_TRIGGER_HOOK","pressed","POPUP_OPEN_HOOK","open","POPUP_CLOSED_HOOK","closed","ANCHOR_HIDDEN_HOOK","anchorHidden","triggerOpenStateMapping","value","pressableTriggerOpenStateMapping","popupStateMapping","popupTransitionStateMapping","transitionStatusMapping","popupOpen","CommonTriggerDataAttributes_exports","triggerDisabled","isTargetInsideEnabledTrigger","target","triggerElements","isElement","targetElement","triggerDisabled","trigger","contains","isEventTargetWithin","event","node","eventAgain","isRootElement","element","isTypeableElement","isHTMLElement","TYPEABLE_SELECTOR","isInteractiveElement","isTypeableCombobox","getFloatingFocusElement","floatingElement","FOCUSABLE_ATTRIBUTE","resolveValue","value","pointerType","isMouseLikePointerType","getDelay","prop","result","getRestMs","isClickLikeOpenEvent","openEventType","interactedInside","isHoverOpenEvent","reason_parts_exports","__export","cancelOpen","chipRemovePress","clearPress","closePress","closeWatcher","decrementPress","disabled","drag","escapeKey","focusOut","imperativeAction","incrementPress","initial","inputBlur","inputChange","inputClear","inputPaste","inputPress","itemPress","keyboard","linkPress","listNavigation","missing","none","outsidePress","pointer","scrub","siblingOpen","swipe","trackPress","triggerFocus","triggerHover","triggerPress","wheel","windowResize","createChangeEventDetails","reason","event","trigger","customProperties","canceled","allowPropagation","custom","EMPTY_OBJECT","React","React","import_jsx_runtime","FocusGuard","props","ref","role","setRole","useIsoLayoutEffect","parts_exports","_jsx","visuallyHidden","min","max","round","floor","createCoords","v","oppositeSideMap","clamp","start","value","end","evaluate","param","getSide","placement","getAlignment","getOppositeAxis","axis","getAxisLength","getSideAxis","firstChar","getAlignmentAxis","getAlignmentSides","rects","rtl","alignment","alignmentAxis","length","mainAlignmentSide","getOppositePlacement","getExpandedPlacements","oppositePlacement","getOppositeAlignmentPlacement","lrPlacement","rlPlacement","tbPlacement","btPlacement","getSideList","side","isStart","getOppositeAxisPlacements","flipAlignment","direction","list","expandPaddingObject","padding","_padding$top","_padding$right","_padding$bottom","_padding$left","getPaddingObject","rectToClientRect","rect","x","y","width","height","isIndexOutOfListBounds","list","index","getMinListIndex","listRef","disabledIndices","findNonDisabledListIndex","getMaxListIndex","startingIndex","decrement","amount","isListIndexDisabled","isListIndexDisabled","list","index","disabledIndices","element","isElementVisible","isHiddenByStyles","styles","getComputedStyle","CANDIDATE_SELECTOR","getParentElement","element","assignedSlot","rootNode","isShadowRoot","getDetailsSummary","details","child","getNodeName","isWithinOpenDetailsSummary","summary","contains","isFocusableCandidate","nodeName","isFocusableElement","current","isAncestor","isSlot","isVisibleInTabbableTree","styles","getComputedStyle","isElementVisible","getTabIndex","tabIndex","isHTMLElement","getNamedRadioInput","input","isTabbableRadio","candidates","checkedRadio","candidate","radio","getComposedChildren","container","assignedElements","appendCandidates","list","appendMatchingElements","selector","isTabbable","focusable","tabbable","getTabbableIn","dir","len","active","activeElement","ownerDocument","index","nextIndex","getNextTabbable","referenceElement","getPreviousTabbable","getTabbableNearElement","elementCount","getTabbableAfterElement","isOutsideEvent","event","container","containerElement","relatedTarget","contains","disableFocusInside","tabbable","element","enableFocusInside","elements","appendMatchingElements","tabindex","getNodeChildren","nodes","id","onlyOpenChildren","node","child","getNodeAncestors","nodes","id","allAncestors","currentParentId","node","currentNode","createAttribute","name","rafId","enqueueFocus","el","options","preventScroll","sync","shouldFocus","exec","NOOP","currentRafId","counters","markerName","uncontrolledElementsSets","markerCounterMap","lockCount","getUncontrolledElementsSet","controlAttribute","unwrapHost","node","isShadowRoot","correctElements","parent","targets","target","correctedTarget","x","buildKeepSet","keep","collectOutsideElements","root","keepElements","stopElements","outside","walk","getNodeName","applyAttributeToOthers","uncorrectedAvoidElements","body","ariaHidden","inert","mark","counterMap","uncontrolledElementsSet","avoidElements","markerTargets","hiddenElements","markedElements","map","currentUncontrolledElementsSet","ariaLiveElements","controlElements","attr","alreadyHidden","counterValue","markerValue","element","markOthers","options","ownerDocument","React","ReactDOM","React","globalId","useGlobalId","idOverride","prefix","defaultId","setDefaultId","id","maybeReactUseId","SafeReact","useId","reactId","DISABLED_TRANSITIONS_STYLE","CLICK_TRIGGER_IDENTIFIER","BASE_UI_SWIPE_IGNORE_ATTRIBUTE","LEGACY_SWIPE_IGNORE_ATTRIBUTE","BASE_UI_SWIPE_IGNORE_SELECTOR","LEGACY_SWIPE_IGNORE_SELECTOR","DROPDOWN_COLLISION_AVOIDANCE","POPUP_COLLISION_AVOIDANCE","ownerVisuallyHidden","import_jsx_runtime","PortalContext","usePortalContext","attr","createAttribute","useFloatingPortalNode","props","ref","containerProp","componentProps","EMPTY_OBJECT","elementProps","uniqueId","useId","parentPortalNode","containerElement","setContainerElement","portalNode","setPortalNode","setPortalNodeRef","useStableCallback","node","containerRef","useIsoLayoutEffect","resolvedContainer","isNode","portalElement","useRenderElement","portalSubtree","FloatingPortal","forwardedRef","render","className","style","children","container","portalOwnerRole","portalNodeId","beforeOutsideRef","afterOutsideRef","beforeInsideRef","afterInsideRef","focusManagerState","setFocusManagerState","focusInsideDisabledRef","modal","open","shouldRenderGuards","onFocus","event","isOutsideEvent","enableFocusInside","disableFocusInside","mergeCleanups","addEventListener","portalContextValue","_jsxs","_jsx","FocusGuard","domReference","getPreviousTabbable","ownerVisuallyHidden","getNextTabbable","createChangeEventDetails","reason_parts_exports","React","createEventEmitter","map","event","data","listener","FloatingTreeStore","createEventEmitter","node","index","n","import_jsx_runtime","FloatingNodeContext","FloatingTreeContext","useFloatingParentNodeId","useFloatingTree","externalTree","contextTree","useFloatingNodeId","id","useId","tree","parentId","useIsoLayoutEffect","node","FloatingNode","props","children","_jsx","FloatingTree","useRefWithInit","FloatingTreeStore","resolveRef","maybeRef","import_jsx_runtime","getEventType","event","lastInteractionType","win","getWindow","getTarget","LIST_LIMIT","previouslyFocusedElements","clearDisconnectedPreviouslyFocusedElements","entry","addPreviouslyFocusedElement","element","getNodeName","getPreviouslyFocusedElement","getFirstTabbableElement","container","isTabbable","tabbable","handleTabIndex","floatingFocusElement","tabbableContent","focusable","dataTabIndex","tabIndex","FloatingFocusManager","props","context","children","disabled","initialFocus","returnFocus","restoreFocus","modal","closeOnFocusOut","openInteractionType","nextFocusableElement","previousFocusableElement","beforeContentFocusGuardRef","externalTree","getInsideElements","store","open","domReference","floating","events","dataRef","getNodeId","useStableCallback","ignoreInitialFocus","isUntrappedTypeableCombobox","isTypeableCombobox","initialFocusRef","useValueAsRef","returnFocusRef","openInteractionTypeRef","openRef","tree","useFloatingTree","portalContext","usePortalContext","preventReturnFocusRef","isPointerDownRef","pointerDownOutsideRef","lastFocusedTabbableRef","closeTypeRef","lastInteractionTypeRef","beforeGuardRef","afterGuardRef","mergedBeforeGuardRef","useMergedRefs","mergedAfterGuardRef","blurTimeout","useTimeout","pointerDownTimeout","restoreFocusFrame","useAnimationFrame","isInsidePortal","getFloatingFocusElement","getTabbableContent","getResolvedInsideElements","onKeyDown","contains","activeElement","ownerDocument","stopEvent","doc","addEventListener","clearPointerDownOutside","onPointerDown","target","insideElements","pointerTargetInside","CLICK_TRIGGER_IDENTIFIER","mergeCleanups","handlePointerDown","handleFocusIn","handleFocusOutside","relatedTarget","currentTarget","nodeId","triggers","isRelatedFocusGuard","createAttribute","resolveRef","movedToUnrelatedNode","trigger","getNodeChildren","node","getNodeAncestors","isElementVisible","isHTMLElement","prevTabbable","nodeToFocus","createChangeEventDetails","reason_parts_exports","markInsideReactTree","domReferenceElement","portalNodes","rootAncestorComboboxDomReference","x","ariaHiddenCleanup","markOthers","markerInsideElements","markerCleanup","useIsoLayoutEffect","previouslyFocusedElement","initialFocusValueOrFn","resolvedInitialFocus","focusableElements","getDefaultFocusElement","elToFocus","hadFocusInside","enqueueFocus","currentActiveElement","elementFocusedBeforeOpen","preferPreviousFocus","onOpenChangeLocal","details","isVirtualClick","isVirtualPointerEvent","isPreventScrollSupported","getReturnElement","closeType","returnFocusValueOrFn","resolvedReturnFocusValue","referenceReturnElement","previousReturnElement","defaultReturnElement","activeEl","isFocusInsideFloatingTree","returnElement","tabbableReturnElement","hasExplicitReturnFocus","focusOptions","parts_exports","isTypeableElement","shouldRenderGuards","_jsxs","_jsx","FocusGuard","els","isOutsideEvent","getNextTabbable","getPreviousTabbable","React","useClick","context","props","enabled","eventOption","toggle","ignoreMouse","stickIfOpen","touchOpenDelay","reason","reason_parts_exports","store","dataRef","pointerTypeRef","frame","useAnimationFrame","touchOpenTimeout","useTimeout","reference","setOpenWithTouchDelay","nextOpen","nativeEvent","target","pointerType","details","createChangeEventDetails","getNextOpen","open","currentTarget","isClickLikeOpenEvent","openEvent","hasClickedOnInactiveTrigger","event","isMouseLikePointerType","isVirtualPointerEvent","openEventType","getTarget","isTypeableElement","eventCurrentTarget","EMPTY_OBJECT","React","alwaysFalse","normalizeProp","normalizable","useDismiss","context","props","enabled","escapeKey","outsidePressProp","outsidePressEvent","referencePress","bubbles","externalTree","store","open","floatingElement","dataRef","events","tree","useFloatingTree","outsidePressFn","useStableCallback","outsidePress","outsidePressEnabled","getOutsidePressEventProp","escapeKeyBubbles","outsidePressBubbles","pressStartedInsideRef","pressStartPreventedRef","suppressNextOutsideClickRef","sawPressWhileOpenRef","isComposingRef","currentPointerTypeRef","touchStateRef","cancelDismissOnEndTimeout","useTimeout","clearInsideReactTreeTimeout","clearInsideReactTree","hasBlockingChild","bubbleKey","nodeId","getNodeChildren","child","isEventWithinOwnElements","event","isEventTargetWithin","closeOnReferencePress","createChangeEventDetails","reason_parts_exports","closeOnEscapeKeyDown","native","isReactEvent","eventDetails","markInsideReactTree","markPressStartedInsideReactTree","target","getTarget","contains","markInsidePressStartPrevented","handleOpenChange","details","compositionTimeout","Timeout","preventedPressSuppressionTimeout","doc","ownerDocument","handleCompositionStart","handleCompositionEnd","parts_exports","suppressImmediateOutsideClickAfterPreventedStart","resetPressStartState","getOutsidePressEvent","type","computedType","outsidePressEventValue","resolved","shouldIgnoreEvent","computedOutsidePressEvent","isEventWithinFloatingTree","targetIsInsideChildren","node","closeOnPressOutside","inertSelector","createAttribute","targetRoot","isElement","markers","isShadowRoot","triggers","trigger","targetRootAncestor","isLastTraversableNode","nextParent","getParentNode","isRootElement","marker","isHTMLElement","lastTraversableNode","style","getComputedStyle","scrollRe","isScrollableX","isScrollableY","canScrollX","canScrollY","isRTL","pressedVerticalScrollbar","pressedHorizontalScrollbar","isVirtualClick","handlePointerDown","handleTouchStart","touch","addTargetEventListenerOnce","listener","unsubscribe","addEventListener","handleTouchStartCapture","closeOnPressOutsideCapture","targetEvent","handlePressEndCapture","pressStartedInsideDefaultPrevented","handleTouchMove","deltaX","deltaY","distance","handleTouchMoveCapture","handleTouchEnd","handleTouchEndCapture","mergeCleanups","reference","floating","React","computeCoordsFromPlacement","_ref","placement","rtl","reference","floating","sideAxis","getSideAxis","alignmentAxis","getAlignmentAxis","alignLength","getAxisLength","side","getSide","isVertical","commonX","commonY","commonAlign","coords","alignment","getAlignment","detectOverflow","state","options","_await$platform$isEle","x","y","platform","rects","elements","strategy","boundary","rootBoundary","elementContext","altBoundary","padding","evaluate","paddingObject","getPaddingObject","element","clippingClientRect","rectToClientRect","rect","offsetParent","offsetScale","elementClientRect","MAX_RESET_COUNT","computePosition","config","middleware","platformWithDetectOverflow","statefulPlacement","resetCount","middlewareData","i","currentMiddleware","name","fn","nextX","nextY","data","reset","flip","options","state","_middlewareData$arrow","_middlewareData$flip","placement","middlewareData","rects","initialPlacement","platform","elements","checkMainAxis","checkCrossAxis","specifiedFallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment","detectOverflowOptions","evaluate","side","getSide","initialSideAxis","getSideAxis","isBasePlacement","rtl","fallbackPlacements","getOppositePlacement","getExpandedPlacements","hasFallbackAxisSideDirection","getOppositeAxisPlacements","placements","overflow","overflows","overflowsData","sides","getAlignmentSides","_middlewareData$flip2","_overflowsData$filter","nextIndex","nextPlacement","d","resetPlacement","a","b","_overflowsData$filter2","currentSideAxis","acc","originSides","convertValueToCoords","state","options","placement","platform","elements","rtl","side","getSide","alignment","getAlignment","isVertical","getSideAxis","mainAxisMulti","crossAxisMulti","rawValue","evaluate","mainAxis","crossAxis","alignmentAxis","offset","_middlewareData$offse","_middlewareData$arrow","x","y","middlewareData","diffCoords","shift","checkMainAxis","checkCrossAxis","limiter","_ref","detectOverflowOptions","coords","overflow","getOppositeAxis","mainAxisCoord","crossAxisCoord","clampCoord","axis","coord","clamp","limitedCoords","limitShift","_rawOffset$mainAxis","_rawOffset$crossAxis","rects","rawOffset","computedOffset","len","limitMin","limitMax","_middlewareData$offse2","isOriginSide","size","apply","isYAxis","width","height","heightSide","widthSide","maximumClippingHeight","maximumClippingWidth","overflowAvailableHeight","min","overflowAvailableWidth","shiftData","noShift","availableHeight","availableWidth","max","nextDimensions","getCssDimensions","element","css","getComputedStyle","width","height","hasOffset","isHTMLElement","offsetWidth","offsetHeight","shouldFallback","round","unwrapElement","isElement","getScale","domElement","createCoords","rect","$","x","y","noOffsets","getVisualOffsets","win","getWindow","isWebKit","shouldAddVisualOffsets","isFixed","floatingOffsetParent","getBoundingClientRect","includeScale","isFixedStrategy","offsetParent","clientRect","scale","visualOffsets","offsetWin","currentWin","currentIFrame","getFrameElement","iframeScale","iframeRect","left","top","rectToClientRect","getWindowScrollBarX","leftScroll","getNodeScroll","getDocumentElement","getHTMLOffset","documentElement","scroll","htmlRect","convertOffsetParentRelativeRectToViewportRelativeRect","_ref","elements","strategy","topLayer","isTopLayer","offsets","isOffsetParentAnElement","getNodeName","isOverflowElement","offsetRect","htmlOffset","getClientRects","getDocumentRect","html","body","max","SCROLLBAR_MAX","getViewportRect","rootBoundary","isLayoutViewport","visualViewport","layoutRelativeClientCoords","doc","bodyStyles","bodyMarginInline","reservedWidth","gutter","getInnerBoundingClientRect","getClientRectFromClippingAncestor","clippingAncestor","getClippingElementAncestors","cache","cachedResult","result","getOverflowAncestors","el","lastKeptComputedStyle","elementIsFixed","currentNode","getParentNode","isLastTraversableNode","computedStyle","currentNodeIsContaining","isContainingBlock","lastPosition","ancestor","getClippingRect","boundary","clippingAncestors","firstRect","right","bottom","i","min","getDimensions","getRectRelativeToOffsetParent","isStaticPositioned","getTrueOffsetParent","polyfill","rawOffsetParent","getOffsetParent","svgOffsetParent","isTableElement","getContainingBlock","getElementRects","data","getOffsetParentFn","getDimensionsFn","floatingDimensions","isRTL","platform","rectsAreEqual","a","b","observeMove","onMove","ancestorResize","io","timeoutId","root","cleanup","_io","refresh","skip","threshold","elementRectForRootMargin","insetTop","floor","insetRight","insetBottom","insetLeft","options","isFirstUpdate","handleObserve","entries","ratio","handleResize","autoUpdate","reference","floating","update","ancestorScroll","elementResize","layoutShift","animationFrame","referenceEl","ancestors","cleanupIo","reobserveFrame","resizeObserver","firstEntry","_resizeObserver","frameId","prevRefRect","frameLoop","nextRefRect","_resizeObserver2","offset","shift","flip","size","limitShift","computePosition","reference","floating","options","cache","mergedOptions","platformWithCache","platform","React","import_react","ReactDOM","isClient","noop","index","deepEqual","a","b","length","i","keys","key","getDPR","element","roundByDPR","value","dpr","useLatestRef","ref","useFloating","options","placement","strategy","middleware","platform","externalReference","externalFloating","transform","whileElementsMounted","open","data","setData","latestMiddleware","setLatestMiddleware","_reference","_setReference","_floating","_setFloating","setReference","node","referenceRef","setFloating","floatingRef","referenceEl","floatingEl","dataRef","hasWhileElementsMounted","whileElementsMountedRef","platformRef","openRef","update","config","computePosition","fullData","isMountedRef","refs","elements","floatingStyles","initialStyles","x","y","offset","options","deps","result","shift","limitShift","flip","size","BasePopupHandle","fallbackStore","componentName","throwOnMissingTrigger","listener","newStore","index","store","triggerId","attachedStore","triggerElement","i","formatErrorMessage_default","createChangeEventDetails","reason_parts_exports","React","ReactDOM","React","selectors","state","FloatingRootStore","ReactStore","options","syncOnly","nested","onOpenChange","triggerElements","initialState","createEventEmitter","newOpen","event","isClickLikeEvent","eventDetails","details","useSyncedFloatingRootContext","options","popupStore","treatPopupAsFloatingElement","floatingRootContextProp","floatingId","nested","onOpenChange","open","referenceElement","floatingElement","triggerElements","handleOpenChange","internalStoreRef","FloatingRootStore","store","useIsoLayoutEffect","valuesToSync","isElement","React","useTransitionStatus","open","enableIdleState","deferEndingState","animateInitialOpen","transitionStatus","setTransitionStatus","mounted","setMounted","useIsoLayoutEffect","frame","AnimationFrame","React","ReactDOM","pendingCallbacks","flushBeforePaint","fn","callbacks","callback","useAnimationsFinished","elementOrRef","waitForStartingStyleRemoved","batch","frame","useAnimationFrame","useStableCallback","fnToExecute","signal","element","resolveRef","resolvedElement","done","exec","animation","startingStyleAttribute","startingStyle","attributeObserver","useOpenChangeComplete","parameters","enabled","open","ref","batch","onCompleteParam","onComplete","useStableCallback","runOnceAnimationsFinish","useAnimationsFinished","abortController","FOCUSABLE_POPUP_PROPS","FOCUSABLE_ATTRIBUTE","createDefaultInitialFocus","popupRef","interactionType","usePopupRootStore","createStore","treatPopupAsFloatingElement","floatingId","useId","nested","useFloatingParentNodeId","store","useRefWithInit","useSyncedFloatingRootContext","PopupHandleAttachment","handle","useIsoLayoutEffect","syncTriggerCount","triggerCount","useTriggerRegistration","id","registrationRef","useStableCallback","element","registration","registeredStore","createPopupOpenState","state","open","trigger","preventUnmountOnClose","preventUnmountingOnClose","triggerId","activeTriggerId","activeTriggerElement","useTriggerDataForwarding","triggerId","triggerElementRef","store","stateUpdates","isMountedByThisTrigger","baseRegisterTrigger","useTriggerRegistration","applyTriggerData","useStableCallback","element","open","activeTriggerId","changes","registerTrigger","useIsoLayoutEffect","useImplicitActiveTrigger","options","closeOnActiveTriggerUnmount","resolvedActiveTriggerIdRef","reactiveTriggerCount","reactiveActiveTriggerElement","triggerCount","currentActiveTriggerId","lostActiveTriggerId","activeTriggerElement","triggerElement","iteratorResult","implicitTriggerId","implicitTriggerElement","eventDetails","createChangeEventDetails","reason_parts_exports","useOpenStateTransitions","onUnmount","animateInitialOpen","mounted","setMounted","transitionStatus","useTransitionStatus","preventUnmountingOnClose","syncedPreventUnmountingOnClose","forceUnmount","useOpenChangeComplete","usePopupInteractionProps","statePart","EMPTY_OBJECT","usePopupRootSync","PopupTriggerMap","id","element","registered","predicate","createInitialPopupStoreState","triggerElements","floatingId","nested","FloatingRootStore","EMPTY_OBJECT","activeTriggerIdSelector","state","openSelector","popupIdSelector","triggerOwnsOpenPopup","triggerId","triggerOwnsOpenPopupOrIsOnlyTrigger","popupStoreSelectors","isActive","React","import_shim","usePopupHandleStore","handle","subscribe","listener","NOOP","getSnapshot","useFloatingRootContext","options","open","onOpenChange","elements","floatingId","useId","nested","useFloatingParentNodeId","store","useRefWithInit","FloatingRootStore","PopupTriggerMap","useIsoLayoutEffect","valuesToSync","isElement","useFloating","options","internalStore","useFloatingRootContext","store","useFloatingWithStore","useBaseUIFloating","nodeId","externalTree","referenceElement","floatingElement","domReferenceElement","open","floatingId","positionReference","setPositionReferenceRaw","localDomReference","setLocalDomReference","localFloatingElement","setLocalFloatingElement","domReferenceRef","tree","useFloatingTree","storeElements","position","localDomReferenceElement","isElement","syncedFloatingElement","setPositionReference","node","computedPositionReference","setReference","setFloating","refs","elements","context","useIsoLayoutEffect","n","React","HoverInteraction","_HoverInteraction","Timeout","pointerEventsMutationOwnerByScopeElement","clearSafePolygonPointerEventsMutation","instance","scopeElement","applySafePolygonPointerEventsMutation","options","referenceElement","floatingElement","existingOwner","useHoverInteractionSharedState","store","data","useRefWithInit","useOnMount","useHoverFloatingInteraction","context","parameters","enabled","closeDelayProp","nodeIdProp","store","open","floatingElement","domReferenceElement","dataRef","tree","useFloatingTree","parentId","useFloatingParentNodeId","instance","useHoverInteractionSharedState","childClosedTimeout","useTimeout","isClickLikeOpenEvent","useStableCallback","isHoverOpen","isHoverOpenEvent","clearPointerEvents","clearSafePolygonPointerEventsMutation","useIsoLayoutEffect","isElement","ref","floatingEl","doc","ownerDocument","parentFloating","node","cachedScopeElement","parentScopeElement","scopeElement","applySafePolygonPointerEventsMutation","hasParentChildren","getNodeChildren","closeWithDelay","event","closeDelay","getDelay","close","createChangeEventDetails","reason_parts_exports","handleInteractInside","target","getTarget","isInteractiveElement","onFloatingMouseEnter","onNodeClosed","onFloatingMouseLeave","isTargetInsideEnabledTrigger","currentNodeId","relatedTarget","contains","floating","mergeCleanups","addEventListener","React","ReactDOM","EMPTY_REF","useHoverReferenceInteraction","context","props","enabled","delay","handleClose","mouseOnly","restMs","move","triggerElementRef","externalTree","isActiveTrigger","getHandleCloseContext","isClosing","shouldOpenProp","guardStaleOpen","store","dataRef","events","tree","useFloatingTree","instance","useHoverInteractionSharedState","isHoverCloseActiveRef","handleCloseRef","useValueAsRef","delayRef","restMsRef","enabledRef","shouldOpenRef","isClosingRef","isClickLikeOpenEvent","useStableCallback","checkShouldOpen","isOverInactiveTrigger","currentDomReference","currentTarget","target","allTriggers","contains","isElement","targetElement","trigger","cleanupMouseMoveHandler","ownerDocument","clearPointerEvents","clearSafePolygonPointerEventsMutation","onOpenChangeLocal","details","reason_parts_exports","closeWithDelay","event","runElseBranch","closeDelay","getDelay","createChangeEventDetails","onMouseEnter","isMouseLikePointerType","restMsValue","getRestMs","openDelay","eventTarget","getTarget","triggerNode","triggerElement","isOverInactive","isOpen","isInClosingTransition","isHoverCloseTransition","isReenteringSameTriggerDuringCloseTransition","isRestOnlyDelay","shouldOpenImmediately","shouldOpen","onMouseLeave","domReferenceElement","doc","handleCloseContextBase","isTargetInsideEnabledTrigger","currentTrigger","onMouseOut","staleOpenGuard","addEventListener","mergeCleanups","setPointerRef","nativeEvent","currentOpen","floatingElement","scopeElement","applySafePolygonPointerEventsMutation","handleMouseMove","latestOpen","React","ESCAPE","isStationaryWebKitPointer","event","parts_exports","doSwitch","orientation","vertical","horizontal","isMainOrientationKey","key","ARROW_UP","ARROW_DOWN","ARROW_LEFT","ARROW_RIGHT","isMainOrientationToEndKey","rtl","isCrossOrientationOpenKey","isCrossOrientationCloseKey","grid","useListNavigation","context","props","listRef","activeIndex","onNavigateProp","enabled","selectedIndex","allowEscape","loopFocus","nested","virtual","focusItemOnOpen","focusItemOnHover","openOnArrowKeyDown","disabledIndices","parentOrientation","id","resetOnPointerLeave","externalTree","navigateGrid","isGrid","store","open","floatingElement","domReferenceElement","dataRef","floatingFocusElement","getFloatingFocusElement","typeableComboboxReference","isTypeableCombobox","floatingFocusElementRef","useValueAsRef","parentId","useFloatingParentNodeId","tree","useFloatingTree","focusItemOnOpenRef","indexRef","keyRef","isPointerModalityRef","onNavigate","useStableCallback","previousMountedRef","previousOpenRef","forceSyncFocusRef","forceScrollIntoViewRef","cancelQueuedFocusRef","disabledIndicesRef","latestOpenRef","selectedIndexRef","resetOnPointerLeaveRef","focusFrame","useAnimationFrame","waitForListPopulatedFrame","focusItem","runFocus","item","enqueueFocus","initialItem","forceScrollIntoView","callback","waitedItem","useIsoLayoutEffect","runs","waitForListPopulated","getMinListIndex","getMaxListIndex","isIndexOutOfListBounds","nodes","parent","node","activeEl","activeElement","ownerDocument","treeContainsActiveEl","contains","hasActiveIndex","syncCurrentTarget","index","getParentOrientation","getMinEnabledIndex","commonOnKeyDown","stopEvent","createChangeEventDetails","reason_parts_exports","isHTMLElement","currentIndex","minIndex","maxIndex","findNonDisabledListIndex","currentTarget","relatedTarget","floatingFocusEl","ariaActiveDescendantProp","floating","target","getTarget","trigger","openOnNavigationKeyDown","checkVirtualMouse","isVirtualClick","checkVirtualPointer","isVirtualPointerEvent","currentOpen","isArrowKey","isParentCrossOpenKey","isMainKey","isNavigationKey","isParentMainKey","reference","React","useTypeahead","context","props","listRef","elementsRef","activeIndex","onMatchProp","disabledIndices","onTyping","enabled","resetMs","selectedIndex","store","open","timeout","useTimeout","stringRef","prevIndexRef","matchIndexRef","onKeyDown","useStableCallback","event","getElement","index","isItemAvailable","element","isElementVisible","isListIndexDisabled","EMPTY_ARRAY","getMatchingIndex","list","string","startIndex","normalizedStartIndex","lowerString","offset","listContent","stopEvent","isNewSession","text","onBlur","next","currentDomReferenceElement","currentFloatingElement","contains","useIsoLayoutEffect","sharedProps","CURSOR_SPEED_THRESHOLD","CURSOR_SPEED_THRESHOLD_SQUARED","POLYGON_BUFFER","hasIntersectingEdge","pointX","pointY","xi","yi","xj","yj","isPointInQuadrilateral","x1","y1","x2","y2","x3","y3","x4","y4","isInsideValue","isInsideRect","rect","isInsideAxisAlignedRect","minX","maxX","minY","maxY","safePolygon","options","blockPointerEvents","timeout","Timeout","fn","x","y","placement","elements","onClose","nodeId","tree","side","hasLanded","lastX","lastY","lastCursorTime","isCursorMovingSlowly","nextX","nextY","currentTime","elapsedTime","deltaX","deltaY","distanceSquared","thresholdSquared","close","event","domReference","floating","clientX","clientY","target","getTarget","isLeave","isOverFloatingEl","contains","isOverReferenceEl","isElement","hasOpenChildNode","getNodeChildren","closeIfNoOpenChild","refRect","cursorLeaveFromRight","cursorLeaveFromBottom","isFloatingWider","isFloatingTaller","left","right","top","bottom","isInsideTroughRect","isInsidePolygon","cursorXOffset","cursorPointOneX","cursorPointTwoX","cursorPointY","commonYLeft","commonYRight","cursorYOffset","cursorPointOneY","cursorPointTwoY","cursorPointX","commonXTop","commonXBottom","React","SelectRootContext","SelectRootPropsContext","SelectFloatingContext","useSelectRootContext","store","formatErrorMessage_default","useSelectRootPropsContext","context","useSelectFloatingContext","React","valid","invalid","DEFAULT_VALIDITY_STATE","DEFAULT_FIELD_STATE_ATTRIBUTES","DEFAULT_FIELD_ROOT_STATE","fieldValidityMapping","value","valid","invalid","DEFAULT_FIELD_ROOT_CONTEXT","DEFAULT_VALIDITY_STATE","NOOP","DEFAULT_FIELD_ROOT_STATE","_disabled","props","EMPTY_OBJECT","FieldRootContext","useFieldRootContext","optional","context","formatErrorMessage_default","useRegisterFieldControl","controlRef","id","value","getFormValueOverride","enabled","name","registerFieldControl","useFieldRootContext","sourceRef","useRefWithInit","useIsoLayoutEffect","source","React","useBaseUiId","idOverride","useId","React","LabelableContext","NOOP","externalProps","useLabelableContext","useLabelableId","params","id","enabled","controlId","registerControlId","resetControlId","useLabelableContext","defaultId","useBaseUiId","controlSourceRef","useRefWithInit","hasRegisteredRef","hadExplicitIdRef","unregisterControlId","useStableCallback","NOOP","useIsoLayoutEffect","nextId","areArraysEqual","array1","array2","itemComparer","length","i","defaultItemEquality","itemValue","selectedValue","compareItemEquality","comparer","isSelectedValueDirty","currentValue","initialValue","areArraysEqual","initialItemValue","selectedValueIncludes","selectedValues","findItemIndex","itemValues","createSelectionMatcher","index","v","findSelectionIndex","multiple","resolveSelectedIndex","registry","currentIndex","removeItem","React","serializeValue","value","import_jsx_runtime","isGroup","item","isGroupedItems","items","flattenLeafItems","group","hasNullItemLabel","arrayItems","stringifyAsLabel","itemToStringLabel","serializeValue","stringifyAsValue","itemToStringValue","resolveSelectedLabel","value","fallback","flatItems","match","resolveMultipleLabels","values","acc","index","_jsx","selectors","state","value","multiple","itemToStringValue","stringifyAsValue","enabled","hasNullItemLabel","index","itemValue","comparer","storeValue","selectedItem","compareItemEquality","React","FormContext","NOOP","useFormContext","React","useValueChanged","value","onChange","valueRef","onChangeCallback","useStableCallback","useIsoLayoutEffect","React","React","useEnhancedClickHandler","handler","lastClickInteractionTypeRef","handlePointerDown","event","useOpenMethodTriggerProps","open","setOpenMethod","handleTriggerClick","useStableCallback","_","interactionType","parts_exports","onClick","onPointerDown","useEnhancedClickHandler","useOpenInteractionType","openMethod","triggerProps","useValueChanged","previousOpen","clamp","val","min","max","SCROLL_EDGE_TOLERANCE_PX","getMaxScrollOffset","scrollSize","clientSize","normalizeScrollOffset","value","max","clamped","clamp","startDistance","endDistance","withinStartTolerance","withinEndTolerance","import_jsx_runtime","SelectRoot","props","id","valueProp","defaultValue","onValueChange","openProp","defaultOpen","onOpenChange","nameProp","form","autoComplete","disabledProp","readOnly","required","modal","actionsRef","inputRef","onOpenChangeComplete","items","multiple","itemToStringLabel","itemToStringValue","isItemEqualToValue","defaultItemEquality","highlightItemOnHover","children","clearErrors","useFormContext","setDirty","setTouched","setFocused","validityData","setFilled","fieldName","fieldDisabled","validation","validationMode","useFieldRootContext","generatedId","useLabelableId","disabled","name","value","setValueUnwrapped","useControlled","EMPTY_ARRAY","open","setOpenUnwrapped","listRef","labelsRef","popupRef","scrollHandlerRef","scrollArrowsMountedCountRef","valueRef","valuesRef","typingRef","firstItemTextRef","selectedItemTextRef","selectionRef","alignItemWithTriggerActiveRef","initialValueRef","mounted","setMounted","transitionStatus","useTransitionStatus","openMethod","interactionTypeProps","useOpenInteractionType","store","useRefWithInit","ReactStore","EMPTY_OBJECT","NOOP","selectors","activeIndex","selectedIndex","triggerElement","positionerElement","previousOpenMethod","usePreviousValue","renderedOpenMethod","serializedValue","stringifyAsValue","fieldStringValue","currentValue","controlRef","useValueAsRef","getStringifiedValueForForm","useStableCallback","useRegisterFieldControl","hasSelectedValue","useIsoLayoutEffect","nextIndex","findSelectionIndex","useValueChanged","isSelectedValueDirty","setOpen","nextOpen","eventDetails","reason_parts_exports","handleUnmount","useOpenChangeComplete","setValue","nextValue","handleScrollArrowVisibility","scroller","maxScrollTop","getMaxScrollOffset","scrollTop","normalizeScrollOffset","shouldShowUp","shouldShowDown","floatingContext","useFloatingRootContext","click","useClick","dismiss","useDismiss","listNavigation","useListNavigation","nextActiveIndex","typeahead","useTypeahead","index","isElementDisabled","createChangeEventDetails","typing","mergedTriggerProps","mergeProps","popupProps","FOCUSABLE_POPUP_PROPS","itemProps","useOnFirstRender","rootPropsContextValue","ref","useMergedRefs","hiddenInputName","hiddenInputs","v","currentSerializedValue","_jsx","_jsxs","SelectRootContext","SelectRootPropsContext","SelectFloatingContext","event","details","handleChange","nextValueLower","matchingIndex","candidate","stringifyAsLabel","_","renderedLabel","matchingValue","visuallyHiddenInput","visuallyHidden","React","useRegisteredLabelId","idProp","setLabelId","id","useBaseUiId","useIsoLayoutEffect","currentId","useLabel","params","idProp","fallbackControlId","native","setLabelIdProp","focusControlProp","contextControlId","setContextLabelId","useLabelableContext","syncLabelId","useStableCallback","nextLabelId","id","useRegisteredLabelId","resolvedControlId","focusControl","event","controlElement","ownerDocument","isHTMLElement","focusElementWithVisible","handleInteraction","getTarget","element","getDefaultLabelId","id","resolveAriaLabelledBy","fieldLabelId","localLabelId","SelectLabel","componentProps","forwardedRef","render","className","style","elementProps","elementPropsWithoutId","fieldRootContext","useFieldRootContext","store","useSelectRootContext","triggerElement","rootId","defaultLabelId","getDefaultLabelId","labelProps","useLabel","nextLabelId","resolvedLabelId","useRenderElement","fieldValidityMapping","React","BOUNDARY_OFFSET","isMouseWithinBounds","event","element","bounds","getPseudoElementBounds","elementRect","win","getWindow","parts_exports","beforeStyles","afterStyles","beforeWidth","beforeHeight","afterWidth","afterHeight","totalWidth","totalHeight","widthDiff","heightDiff","popupOpen","CommonTriggerDataAttributes_exports","pressed","popupSide","SELECTED_DELAY","stateAttributesMapping","pressableTriggerOpenStateMapping","fieldValidityMapping","side","popupSide","SelectTrigger","componentProps","forwardedRef","render","className","idProp","disabledProp","nativeButton","style","elementProps","setTouched","setFocused","validationMode","validation","fieldState","fieldDisabled","useFieldRootContext","fieldLabelId","useLabelableContext","store","useSelectRootContext","readOnly","required","selectDisabled","useSelectRootPropsContext","disabled","open","mounted","value","triggerProps","positionerElement","listElement","popupSideValue","rootId","selectLabelId","hasSelectedValue","id","ariaLabelledBy","resolveAriaLabelledBy","useLabelableId","positionerRef","useValueAsRef","triggerRef","getButtonProps","buttonRef","useButton","setTriggerElement","timeoutFocus","useTimeout","timeoutMouseDown","selectedDelayTimeout","mergedProps","mergeProps","getFloatingFocusElement","event","createChangeEventDetails","reason_parts_exports","contains","doc","ownerDocument","handleMouseUp","mouseEvent","mouseUpTarget","isMouseWithinBounds","props","state","useRenderElement","React","stateAttributesMapping","SelectValue","componentProps","forwardedRef","className","render","childrenProp","placeholder","style","elementProps","store","useSelectRootContext","value","items","itemToStringLabel","hasSelectedValue","shouldCheckNullItemLabel","hasNullLabel","state","children","resolveMultipleLabels","resolveSelectedLabel","useRenderElement","React","SelectIcon","componentProps","forwardedRef","render","className","style","elementProps","state","useSelectRootContext","useRenderElement","triggerOpenStateMapping","React","import_jsx_runtime","SelectPortal","portalProps","forwardedRef","store","useSelectRootContext","mounted","forceMount","_jsx","FloatingPortal","React","stateAttributesMapping","popupStateMapping","transitionStatusMapping","SelectBackdrop","componentProps","forwardedRef","render","className","style","elementProps","store","useSelectRootContext","open","mounted","transitionStatus","useRenderElement","React","inertValue","value","isReactVersionAtLeast","React","React","CompositeListContext","useCompositeListContext","import_jsx_runtime","CompositeList","props","children","elementsRef","labelsRef","onMapChangeProp","onMapChange","useStableCallback","setMapTick","listeners","useRefWithInit","createListeners","map","createMap","nextIndexRef","isDirtyRef","itemsRef","mutationObserverRef","scheduleMapUpdate","tick","register","node","registration","unregister","syncRefs","items","nextMap","item","observe","sortedNodes","mutationObserver","entries","hasMovedNode","previousConnectedNode","sortByDocumentPosition","roots","i","root","getCommonAncestor","flush","automaticNodes","getCompositeListSnapshot","previousItems","changed","index","previousItem","listener","useIsoLayoutEffect","subscribeMapChange","fn","contextValue","_jsx","CompositeListContext","reservedIndices","automaticItems","nextAutomaticIndex","a","b","firstNode","lastNode","ancestor","entry","React","React","DirectionContext","useDirection","baseArrow","options","state","x","y","placement","rects","platform","elements","middlewareData","element","padding","offsetParent","evaluate","paddingObject","getPaddingObject","coords","axis","getAlignmentAxis","length","getAxisLength","arrowDimensions","isYAxis","minProp","maxProp","clientProp","endDiff","startDiff","arrowOffsetParent","clientSize","centerToReference","largestPossiblePadding","minPadding","maxPadding","min","max","center","offset","clamp","shouldAddOffset","getAlignment","alignmentOffset","arrow","deps","name","fn","hide","state","width","height","x","y","anchorHidden","overflow","DEFAULT_SIDES","availableWidth","availableHeight","anchorWidth","anchorHeight","transformOrigin","AVAILABLE_WIDTH_VAR","availableWidth","AVAILABLE_HEIGHT_VAR","availableHeight","getLogicalSide","sideParam","renderedSide","isRtl","isLogicalSideParam","getOffsetData","state","rects","placement","getSide","getAlignment","useAnchorPositioning","params","useAnchorPositioningWithHook","useBaseUIFloating","useFloatingHook","anchor","positionMethod","sideOffset","align","alignOffset","collisionBoundary","collisionPaddingParam","sticky","arrowPadding","disableAnchorTracking","inlineMiddleware","keepMounted","floatingRootContext","mounted","collisionAvoidance","shift","nodeId","adaptiveOrigin","lazyFlip","externalTree","mountSide","setMountSide","collisionAvoidanceSide","collisionAvoidanceAlign","collisionAvoidanceFallbackAxisSide","shiftCrossAxis","shiftRootBoundary","anchorFn","anchorFnCallback","useStableCallback","anchorDep","anchorValueRef","useValueAsRef","mountedRef","useDirection","side","collisionPadding","bias","biasTop","biasBottom","biasLeft","biasRight","commonCollisionProps","arrowRef","sideOffsetRef","alignOffsetRef","sideOffsetDep","alignOffsetDep","middleware","offset","data","sideAxis","alignAxis","shiftDisabled","crossAxisShiftEnabled","flipMiddleware","flip","shiftMiddleware","limitShift","limitData","width","height","getSideAxis","arrowSize","offsetAmount","size","floating","floatingStyle","dpr","getWindow","x","y","anchorWidth","anchorHeight","arrow","ownerDocument","middlewareData","renderedPlacement","platform","renderedAlign","isVertical","arrowEl","sideOffsetValue","crossOrigin","arrowOffset","sideOrigin","transformOrigin","hide","useIsoLayoutEffect","autoUpdateOptions","refs","elements","update","context","isPositioned","originalFloatingStyles","args","autoUpdate","sideX","sideY","DEFAULT_SIDES","resolvedPosition","floatingStyles","base","registeredPositionReferenceRef","anchorValue","resolvedAnchor","finalAnchor","isRef","logicalRenderedSide","anchorHidden","arrowStyles","arrowUncentered","param","React","SelectPositionerContext","useSelectPositionerContext","context","formatErrorMessage_default","React","import_jsx_runtime","InternalBackdrop","props","ref","cutout","otherProps","clipPath","rect","_jsx","clearStyles","element","originalStyles","LIST_FUNCTIONAL_STYLES","getDisabledMountTransitionStyles","transitionStatus","DISABLED_TRANSITIONS_STYLE","EMPTY_OBJECT","usePositioner","componentProps","state","styles","transitionStatus","props","refs","hidden","inert","style","useRenderElement","getDisabledMountTransitionStyles","popupStateMapping","React","originalHtmlStyles","originalBodyStyles","originalHtmlScrollBehavior","getViewportScroller","html","body","isOverflowElement","isPageScrollLocked","win","hasInsetScrollbars","referenceElement","doc","ownerDocument","getWindow","supportsStableScrollbarGutter","scrollContainer","originalScrollContainerOverflowY","originalHtmlStyleGutter","before","after","preventScrollOverlayScrollbars","elementToLock","originalElementToLockStyles","preventScrollInsetScrollbars","scrollTop","scrollLeft","updateGutterOnly","resizeFrame","AnimationFrame","parts_exports","lockScroll","htmlStyles","bodyStyles","scrollbarGutterValue","isScrollableY","isScrollableX","hasConstantOverflowY","hasConstantOverflowX","scrollbarWidth","scrollbarHeight","marginY","marginX","cleanup","handleResize","unsubscribeResize","addEventListener","ScrollLocker","Timeout","observer","options","hasOverlayScrollbars","SCROLL_LOCKER","useScrollLock","enabled","useIsoLayoutEffect","VIEWPORT_WIDTH_TOLERANCE_PX","useAnchoredPopupScrollLock","enabled","touchOpen","positionerElement","referenceElement","touchOpenShouldLockScroll","setTouchOpenShouldLockScroll","useIsoLayoutEffect","viewportWidth","ownerDocument","popupWidth","useScrollLock","import_jsx_runtime","FIXED","SelectPositioner","componentProps","forwardedRef","anchor","className","render","positionMethod","side","align","sideOffset","alignOffset","collisionBoundary","collisionPadding","arrowPadding","sticky","disableAnchorTracking","alignItemWithTrigger","collisionAvoidance","DROPDOWN_COLLISION_AVOIDANCE","style","elementProps","store","useSelectRootContext","floatingRootContext","useSelectFloatingContext","open","mounted","modal","value","openMethod","positionerElement","triggerElement","isItemEqualToValue","transitionStatus","scrollUpArrowRef","scrollDownArrowRef","controlledAlignItemWithTrigger","setControlledAlignItemWithTrigger","alignItemWithTriggerActive","useAnchoredPopupScrollLock","positioning","useAnchorPositioning","renderedSide","positionerStyles","state","useIsoLayoutEffect","setPositionerElement","element","usePositioner","prevMapSizeRef","onMapChange","useStableCallback","map","prevSize","eventDetails","createChangeEventDetails","reason_parts_exports","findItemIndex","initialSelectedValue","nextValue","selectedItemValue","stylesToClear","clearStyles","contextValue","_jsx","CompositeList","_jsxs","SelectPositionerContext","InternalBackdrop","inertValue","React","import_jsx_runtime","DISABLE_SCROLLBAR_CLASS_NAME","styleDisableScrollbar","nonce","_jsx","React","ToolbarRootContext","useToolbarRootContext","optional","context","formatErrorMessage_default","ARROW_UP","ARROW_DOWN","ARROW_LEFT","ARROW_RIGHT","HOME","END","COMPOSITE_KEYS","ARROW_UP","ARROW_DOWN","ARROW_LEFT","ARROW_RIGHT","HOME","END","SHIFT","MODIFIER_KEYS","isInputElement","element","isHTMLElement","isNativeInput","scrollIntoViewIfNeeded","scrollContainer","direction","orientation","targetX","targetY","isOverflowingX","isOverflowingY","elementOffsetLeft","getOffset","containerStyles","getStyles","elementStyles","elementOffsetTop","ancestor","side","propName","result","styles","React","CSPContext","DEFAULT_CSP_CONTEXT_VALUE","useCSPContext","transformOrigin","import_jsx_runtime","stateAttributesMapping","popupStateMapping","transitionStatusMapping","SelectPopup","componentProps","forwardedRef","render","className","style","finalFocus","elementProps","store","useSelectRootContext","multiple","readOnly","highlightItemOnHover","useSelectRootPropsContext","floatingRootContext","useSelectFloatingContext","side","align","alignItemWithTriggerActive","isPositioned","setControlledAlignItemWithTrigger","useSelectPositionerContext","insideToolbar","useToolbarRootContext","direction","useDirection","nonce","disableStyleElements","useCSPContext","id","open","openMethod","mounted","popupProps","transitionStatus","triggerElement","positionerElement","listElement","reachedMaxHeightRef","initialPlacedRef","originalPositionerStylesRef","scrollArrowFrame","useAnimationFrame","handleScroll","useStableCallback","scroller","isTopPositioned","isBottomPositioned","scale","getScale","currentHeight","normalizeSize","doc","ownerDocument","win","getWindow","positionerStyles","marginTop","marginBottom","maxPopupHeight","getMaxPopupHeight","maxAvailableHeight","scrollTop","maxScrollTop","getMaxScrollTop","nextScrollTop","setHeight","height","diff","nextHeight","SCROLL_EDGE_TOLERANCE_PX","heightDelta","clamp","overshoot","nextPositionerHeight","target","useOpenChangeComplete","state","useIsoLayoutEffect","clearStyles","popupElement","transformOrigin","restoreTransformStyles","unsetTransformStyles","textElement","valueElement","popupStyles","triggerRect","normalizeRect","positionerRect","triggerHeight","scrollHeight","borderBottom","minHeight","paddingLeft","paddingRight","triggerCollisionThreshold","viewportHeight","viewportWidth","availableSpaceBeneathTrigger","textRect","alignedLeft","offsetY","valueRect","valueCenterFromTriggerTop","idealHeight","maxHeight","maxRight","fallbackToAlignPopupToTrigger","isPinchZoomed","parts_exports","initialHeight","topOffset","popupTop","popupHeight","textCenterY","clampedY","handleResize","event","createChangeEventDetails","reason_parts_exports","addEventListener","defaultProps","COMPOSITE_KEYS","LIST_FUNCTIONAL_STYLES","styleDisableScrollbar","element","useRenderElement","getDisabledMountTransitionStyles","_jsxs","_jsx","FloatingFocusManager","maxHeightStyle","getMaxScrollOffset","platform","size","axis","rect","rectToClientRect","TRANSFORM_STYLE_RESETS","originalStyles","property","value","originalValue","React","SelectList","componentProps","forwardedRef","render","className","style","elementProps","store","useSelectRootContext","multiple","readOnly","useSelectRootPropsContext","alignItemWithTriggerActive","useSelectPositionerContext","hasScrollArrows","openMethod","defaultProps","event","LIST_FUNCTIONAL_STYLES","styleDisableScrollbar","setListElement","useRenderElement","React","React","useCompositeListItem","params","guess","label","metadata","textRef","externalIndex","register","unregister","subscribeMapChange","nextIndexRef","useCompositeListContext","indexRef","internalIndex","setInternalIndex","newIndex","index","componentRef","ref","node","previousNode","useIsoLayoutEffect","map","i","React","SelectItemContext","useSelectItemContext","context","formatErrorMessage_default","import_jsx_runtime","SelectItem","componentProps","forwardedRef","render","className","style","itemValue","label","disabledProp","nativeButton","elementProps","textRef","listItem","useCompositeListItem","store","useSelectRootContext","itemProps","multiple","selectDisabled","readOnly","useSelectRootPropsContext","disabled","highlighted","open","selected","selectedByFocus","isItemEqualToValue","index","itemRef","useIsoLayoutEffect","values","selectedValue","currentIndex","nextIndex","claims","resolveSelectedIndex","compareItemEquality","pointerTypeRef","allowMouseSelectionRef","getButtonProps","buttonRef","useButton","state","commitSelection","event","currentValue","nextValue","removeItem","createChangeEventDetails","reason_parts_exports","resetDragMovement","defaultProps","isMouseClick","clickPointerType","isVirtualMouseClick","isVirtualClick","isInvalidMouseClick","selection","disallowSelectedMouseUp","disallowUnselectedMouseUp","element","useRenderElement","contextValue","_jsx","SelectItemContext","React","import_jsx_runtime","SelectItemIndicator","componentProps","forwardedRef","selected","useSelectItemContext","_jsx","Inner","render","className","style","keepMounted","elementProps","indicatorRef","transitionStatus","setMounted","useTransitionStatus","element","useRenderElement","transitionStatusMapping","useOpenChangeComplete","React","SelectItemText","componentProps","forwardedRef","index","textRef","selectedByFocus","useSelectItemContext","store","useSelectRootContext","render","className","style","elementProps","localRef","node","useRenderElement","React","SelectArrow","componentProps","forwardedRef","render","className","style","elementProps","store","useSelectRootContext","side","align","arrowRef","arrowStyles","arrowUncentered","alignItemWithTriggerActive","useSelectPositionerContext","state","element","useRenderElement","popupTransitionStateMapping","React","React","SelectScrollArrow","componentProps","forwardedRef","render","className","style","direction","keepMounted","elementProps","isUp","store","useSelectRootContext","side","scrollDownArrowRef","scrollUpArrowRef","useSelectPositionerContext","visibleSelector","stateVisible","openMethod","visible","timeout","useTimeout","scrollArrowRef","mounted","transitionStatus","setMounted","useTransitionStatus","useIsoLayoutEffect","useOpenChangeComplete","element","useRenderElement","event","scrollNextItem","scroller","maxScrollTop","getMaxScrollOffset","scrollTop","normalizeScrollOffset","isScrolledToEdge","items","scrollArrowHeight","getTargetScrollTop","transitionStatusMapping","clientHeight","firstVisibleIndex","visibleTop","SCROLL_EDGE_TOLERANCE_PX","i","item","targetIndex","targetItem","lastVisibleIndex","visibleBottom","import_jsx_runtime","SelectScrollDownArrow","props","forwardedRef","_jsx","SelectScrollArrow","React","import_jsx_runtime","SelectScrollUpArrow","props","forwardedRef","_jsx","SelectScrollArrow","React","React","SelectGroupContext","useSelectGroupContext","context","formatErrorMessage_default","import_jsx_runtime","SelectGroup","componentProps","forwardedRef","render","className","style","elementProps","labelId","setLabelId","contextValue","element","useRenderElement","_jsx","SelectGroupContext","React","SelectGroupLabel","componentProps","forwardedRef","render","className","style","idProp","elementProps","setLabelId","useSelectGroupContext","id","useBaseUiId","useIsoLayoutEffect","currentId","useRenderElement","React","ListboxSeparator","componentProps","forwardedRef","className","render","orientation","style","elementProps","useRenderElement","SelectSeparator","ListboxSeparator","import_jsx_runtime","iconVariants","cva","IconBase","size","className","color","style","children","props","import_jsx_runtime","ChevronDown","props","IconBase","import_jsx_runtime","Select","props","index_parts_exports","SelectTrigger","className","placeholder","leadingIcon","renderValue","props","index_parts_exports","cx","ChevronDown","SelectContent","children","sideOffset","alignItemWithTrigger","container","SelectItem","React","index_parts_exports","__export","DialogBackdrop","DialogClose","DialogDescription","DialogHandle","DialogPopup","DialogPortal","DialogRoot","DialogTitle","DialogTrigger","DialogViewport","createDialogHandle","React","React","DialogRootContext","useDialogRootContext","optional","store","formatErrorMessage_default","DialogBackdrop","componentProps","forwardedRef","render","className","style","forceRender","elementProps","store","useDialogRootContext","open","nested","mounted","transitionStatus","useRenderElement","popupTransitionStateMapping","React","DialogClose","componentProps","forwardedRef","render","className","style","disabled","nativeButton","elementProps","store","useDialogRootContext","open","getButtonProps","buttonRef","useButton","state","handleClick","event","createChangeEventDetails","reason_parts_exports","useRenderElement","React","DialogDescription","componentProps","forwardedRef","render","className","style","idProp","elementProps","store","useDialogRootContext","id","useBaseUiId","useRenderElement","React","React","DialogPortalContext","useDialogPortalContext","value","formatErrorMessage_default","nestedDialogs","open","CommonPopupDataAttributes_exports","closed","startingStyle","endingStyle","nestedDialogOpen","dialogStateAttributesMapping","popupStateMapping","transitionStatusMapping","value","nestedDialogOpen","import_jsx_runtime","DialogPopup","componentProps","forwardedRef","render","className","style","finalFocus","initialFocus","elementProps","store","useDialogRootContext","descriptionElementId","disablePointerDismissal","floatingRootContext","rootPopupProps","modal","mounted","nested","nestedOpenDialogCount","open","openMethod","titleElementId","transitionStatus","role","floatingId","useDialogPortalContext","useOpenChangeComplete","resolvedInitialFocus","createDefaultInitialFocus","nestedDialogOpen","setPopupElement","element","useRenderElement","FOCUSABLE_POPUP_PROPS","event","COMPOSITE_KEYS","nestedDialogs","dialogStateAttributesMapping","_jsx","FloatingFocusManager","React","import_jsx_runtime","DialogPortal","props","forwardedRef","keepMounted","portalProps","store","useDialogRootContext","mounted","modal","open","_jsx","DialogPortalContext","_jsxs","FloatingPortal","InternalBackdrop","inertValue","React","React","DialogInteractions","store","parentContext","isDrawer","open","disablePointerDismissal","modal","popupElement","floatingRootContext","ownNestedOpenDialogs","setOwnNestedOpenDialogs","ownNestedOpenDrawers","setOwnNestedOpenDrawers","isTopmost","dismiss","useDismiss","event","target","getTarget","internalBackdrop","backdrop","contains","useScrollLock","dialogCount","drawerCount","useIsoLayoutEffect","usePopupInteractionProps","React","NullStore","ReactStore","_newState","_changes","_key","_value","selectors","popupStoreSelectors","state","DialogStore","ReactStore","initialState","floatingId","nested","triggerElements","PopupTriggerMap","createInitialState","createInitialContext","nextOpen","eventDetails","createPopupOpenState","createNullDialogStore","NullStore","createInitialPopupStoreState","import_jsx_runtime","useRenderDialogRoot","mode","props","children","openProp","defaultOpen","onOpenChange","onOpenChangeComplete","disablePointerDismissalProp","modalProp","actionsRef","handle","triggerIdProp","defaultTriggerIdProp","isDrawer","isAlertDialog","modal","disablePointerDismissal","role","parentStore","useDialogRootContext","nested","rootState","store","usePopupRootStore","floatingId","floatingNested","DialogStore","open","mounted","payload","usePopupRootSync","useImplicitActiveTrigger","forceUnmount","useOpenStateTransitions","createChangeEventDetails","reason_parts_exports","shouldRenderInteractions","_jsxs","DialogRootContext","_jsx","PopupHandleAttachment","DialogInteractions","DialogRoot","fastComponent","props","useRenderDialogRoot","React","DialogViewport","componentProps","forwardedRef","render","className","style","children","elementProps","keepMounted","useDialogPortalContext","store","useDialogRootContext","open","nested","transitionStatus","nestedOpenDialogCount","mounted","setViewportElement","nestedDialogOpen","useRenderElement","dialogStateAttributesMapping","React","DialogTitle","componentProps","forwardedRef","render","className","style","idProp","elementProps","store","useDialogRootContext","id","useBaseUiId","useRenderElement","React","DialogTrigger","fastComponentRef","componentProps","forwardedRef","render","className","style","disabled","nativeButton","idProp","payload","handle","elementProps","dialogRootStore","useDialogRootContext","store","usePopupHandleStore","formatErrorMessage_default","thisTriggerId","useBaseUiId","floatingContext","isOpenedByThisTrigger","popupId","triggerElementRef","registerTrigger","isMountedByThisTrigger","useTriggerDataForwarding","getButtonProps","buttonRef","useButton","click","useClick","interactionTypeProps","useOpenMethodTriggerProps","interactionType","state","rootTriggerProps","useRenderElement","CLICK_TRIGGER_IDENTIFIER","triggerOpenStateMapping","DialogHandle","BasePopupHandle","createNullDialogStore","triggerId","payload","attachedStore","createChangeEventDetails","reason_parts_exports","createDialogHandle","import_jsx_runtime","Warning","props","IconBase","import_jsx_runtime","formatDetailValue","value","ErrorDialog","open","onClose","title","message","reference","details","closeLabel","detailsLabel","detailsEntries","index_parts_exports","nextOpen","Warning","key","Button","index_parts_exports","__export","NavigationMenuArrow","NavigationMenuBackdrop","NavigationMenuContent","NavigationMenuIcon","NavigationMenuItem","NavigationMenuLink","NavigationMenuList","NavigationMenuPopup","NavigationMenuPortal","NavigationMenuPositioner","NavigationMenuRoot","NavigationMenuTrigger","NavigationMenuViewport","React","React","NavigationMenuRootContext","useNavigationMenuRootContext","optional","context","formatErrorMessage_default","NavigationMenuTreeContext","useNavigationMenuTreeContext","positionerWidth","positionerHeight","popupWidth","popupHeight","setSharedFixedSize","popupElement","positionerElement","width","height","popupWidth","popupHeight","positionerWidth","positionerHeight","import_jsx_runtime","blockedReturnFocusReasons","reason_parts_exports","getPositionerFixedSize","positionerElement","width","positionerWidth","height","positionerHeight","NavigationMenuRoot","componentProps","forwardedRef","defaultValue","valueParam","onValueChange","actionsRef","delay","closeDelay","orientation","onOpenChangeComplete","nested","useFloatingParentNodeId","parentRootContext","useNavigationMenuRootContext","value","setValueUnwrapped","useControlled","open","closeReasonRef","rootRef","setPositionerElement","popupElement","setPopupElement","viewportElement","setViewportElement","viewportTargetElement","setViewportTargetElement","activationDirection","setActivationDirection","floatingRootContext","setFloatingRootContext","viewportInert","setViewportInert","prevTriggerElementRef","currentContentRef","beforeInsideRef","afterInsideRef","beforeOutsideRef","afterOutsideRef","popupAutoSizeResetRef","mounted","setMounted","transitionStatus","useTransitionStatus","useIsoLayoutEffect","closeTransitionSize","setSharedFixedSize","setValue","useStableCallback","nextValue","eventDetails","handleUnmount","doc","ownerDocument","activeEl","activeElement","isHTMLElement","contains","useOpenChangeComplete","contextActivationDirection","contextValue","jsx","_jsx","NavigationMenuRootContext","TreeContext","FloatingTree","props","className","render","style","elementProps","nodeId","useFloatingNodeId","state","element","useRenderElement","NavigationMenuTreeContext","FloatingNode","React","React","React","ACTIVE_COMPOSITE_ITEM","useCompositeRoot","params","loopFocus","orientation","grid","onLoop","direction","externalHighlightedIndex","externalSetHighlightedIndex","externalRef","enableHomeAndEndKeys","stopEventPropagation","disabledIndices","modifierKeys","EMPTY_ARRAY","internalHighlightedIndex","internalSetHighlightedIndex","isGrid","rootRef","mergedRef","useMergedRefs","elementsRef","hasSetDefaultIndexRef","highlightedElementRef","highlightedIndex","onHighlightedIndexChange","useStableCallback","index","shouldScrollIntoView","newActiveItem","scrollIntoViewIfNeeded","onMapChange","map","elements","nextIndex","replacement","isListIndexDisabled","getFallbackIndex","sortedElements","activeItem","compositeElement","ACTIVE_COMPOSITE_ITEM","activeIndex","firstEnabledIndex","findNonDisabledListIndex","isIndexOutOfListBounds","useIsoLayoutEffect","wrappedOnLoop","event","prevIndex","onKeyDown","isHomeOrEnd","HOME","END","COMPOSITE_KEYS","isModifierKeySet","isRtl","horizontalForwardKey","ARROW_LEFT","ARROW_RIGHT","horizontalBackwardKey","forwardKey","ARROW_DOWN","backwardKey","ARROW_UP","target","getTarget","isNativeInput","isElementDisabled","selectionStart","selectionEnd","textContent","minIndex","getMinListIndex","maxIndex","getMaxListIndex","isForwardKey","isBackwardKey","element","fallbackIndex","ignoredModifierKeys","key","MODIFIER_KEYS","import_jsx_runtime","CompositeRoot","componentProps","render","className","style","refs","EMPTY_ARRAY","props","state","EMPTY_OBJECT","stateAttributesMapping","highlightedIndexProp","onHighlightedIndexChangeProp","orientation","grid","loopFocus","onLoop","enableHomeAndEndKeys","onMapChangeProp","stopEventPropagation","rootRef","disabledIndices","modifierKeys","highlightItemOnHover","tag","elementProps","direction","useDirection","defaultProps","highlightedIndex","onHighlightedIndexChange","elementsRef","onMapChangeUnwrapped","relayKeyboardEvent","useCompositeRoot","element","useRenderElement","contextValue","_jsx","CompositeRootContext","CompositeList","newMap","NAVIGATION_MENU_TRIGGER_IDENTIFIER","React","NavigationMenuDismissContext","useNavigationMenuDismissContext","getEmptyRootContext","FloatingRootStore","PopupTriggerMap","import_jsx_runtime","NavigationMenuList","componentProps","forwardedRef","render","className","style","elementProps","nodeId","useNavigationMenuTreeContext","orientation","open","floatingRootContext","positionerElement","value","closeDelay","viewportElement","nested","useNavigationMenuRootContext","fallbackContext","getEmptyRootContext","context","interactionsEnabled","hoverInteractionsEnabled","useHoverFloatingInteraction","dismiss","useDismiss","event","getTarget","NAVIGATION_MENU_TRIGGER_IDENTIFIER","dismissProps","state","defaultProps","EMPTY_OBJECT","props","element","useRenderElement","_jsx","NavigationMenuDismissContext","CompositeRoot","React","React","NavigationMenuItemContext","useNavigationMenuItemContext","value","formatErrorMessage_default","import_jsx_runtime","NavigationMenuItem","componentProps","forwardedRef","render","className","style","valueProp","elementProps","fallbackValue","useBaseUiId","value","element","useRenderElement","contextValue","_jsx","NavigationMenuItemContext","React","ReactDOM","open","CommonPopupDataAttributes_exports","closed","startingStyle","endingStyle","activationDirection","import_jsx_runtime","stateAttributesMapping","popupStateMapping","transitionStatusMapping","value","activationDirection","NavigationMenuContent","componentProps","forwardedRef","render","className","style","keepMounted","elementProps","popupMounted","viewportElement","currentContentRef","viewportTargetElement","useNavigationMenuRootContext","itemValue","useNavigationMenuItemContext","nodeId","useNavigationMenuTreeContext","open","ref","hasMountedInPortal","setHasMountedInPortal","focusInside","setFocusInside","mounted","setMounted","transitionStatus","useTransitionStatus","useOpenChangeComplete","useIsoLayoutEffect","state","handleCurrentContentRef","useStableCallback","node","commonProps","event","getTarget","contains","defaultProps","inertValue","portalContainer","hidden","shouldRenderInline","_jsx","CompositeRoot","FloatingNode","EMPTY_OBJECT","React","ReactDOM","isOutsideMenuEvent","currentTarget","relatedTarget","params","popupElement","rootRef","tree","nodeId","nodeChildrenContains","getNodeChildren","node","contains","React","useCompositeItem","params","highlightItemOnHover","highlightedIndex","onHighlightedIndexChange","useCompositeRootContext","ref","index","useCompositeListItem","isHighlighted","itemRef","mergedRef","useMergedRefs","item","disabled","CompositeItem","componentProps","render","className","style","state","EMPTY_OBJECT","props","EMPTY_ARRAY","refs","metadata","stateAttributesMapping","tag","elementProps","compositeProps","compositeRef","useCompositeItem","useRenderElement","getCssDimensions","element","css","getComputedStyle","width","height","hasOffset","isHTMLElement","offsetWidth","offsetHeight","round","import_jsx_runtime","DEFAULT_SIZE","NavigationMenuTrigger","componentProps","forwardedRef","render","className","style","nativeButton","disabled","elementProps","value","setValue","mounted","open","positionerElement","setActivationDirection","setFloatingRootContext","popupElement","viewportElement","transitionStatus","rootRef","beforeOutsideRef","afterOutsideRef","afterInsideRef","beforeInsideRef","prevTriggerElementRef","popupAutoSizeResetRef","currentContentRef","delay","closeDelay","orientation","setViewportInert","nested","useNavigationMenuRootContext","itemValue","useNavigationMenuItemContext","nodeId","useNavigationMenuTreeContext","tree","useFloatingTree","dismissProps","useNavigationMenuDismissContext","direction","useDirection","stickIfOpenTimeout","useTimeout","mutationFrame","useAnimationFrame","resizeFrame","sizeFrame","triggerElement","setTriggerElement","stickIfOpen","setStickIfOpen","pointerType","setPointerType","triggerElementRef","prevSizeRef","skipAutoSizeSyncRef","isActiveItem","isActiveItemRef","useValueAsRef","interactionsEnabled","hoverFloatingElement","hoverInteractionsEnabled","runOnceAnimationsFinish","useAnimationsFinished","handleTriggerElement","element","cancelAutoSizeReset","useStableCallback","force","useIsoLayoutEffect","setAutoSizes","popupWidth","popupHeight","clearFixedSizes","popup","positioner","positionerWidth","positionerHeight","scheduleAutoSizeReset","abortController","handleValueChange","currentWidth","currentHeight","width","height","getCssDimensions","measuredWidth","measuredHeight","handleInterruptedMutationResize","setSharedFixedSize","syncCurrentSize","getMutationBaseline","resizeObserver","win","getWindow","handleResize","unsubscribe","addEventListener","observedElement","mutationObserver","TransitionStatusDataAttributes_exports","size","syncPositioner","handleOpenChange","nextOpen","eventDetails","isHover","reason_parts_exports","changeState","context","useFloatingRootContext","hoverInteractionState","useHoverInteractionSharedState","shouldBlockSafePolygonPointerEvents","clearSafePolygonPointerEventsMutation","getInlineHandleCloseContext","getHandleCloseContext","getScope","hoverProps","useHoverReferenceInteraction","safePolygon","hover","click","useClick","referenceProps","mergeProps","handleActivation","event","currentTarget","prevTriggerRect","nextTriggerRect","isMovingRight","isMovingDown","createChangeEventDetails","applyPointerEventsMutation","scopeElement","applySafePolygonPointerEventsMutation","handleOpenEvent","shouldSkipAutoSizeSync","state","handleSetPointerType","handleTriggerPointerDown","defaultProps","NAVIGATION_MENU_TRIGGER_IDENTIFIER","verticalOpenKey","openHorizontal","openVertical","stopEvent","isOutsideMenuEvent","getButtonProps","buttonRef","useButton","referenceElement","_jsxs","_jsx","CompositeItem","pressableTriggerOpenStateMapping","EMPTY_ARRAY","FocusGuard","isOutsideEvent","getPreviousTabbable","ownerVisuallyHidden","nextTabbable","getNextTabbable","contains","getTabbableAfterElement","getPlacementFromElements","domReferenceElement","floatingElement","referenceRect","floatingRect","referenceCenterX","referenceCenterY","floatingCenterX","floatingCenterY","deltaX","deltaY","React","React","NavigationMenuPortalContext","useNavigationMenuPortalContext","value","formatErrorMessage_default","import_jsx_runtime","NavigationMenuPortal","props","forwardedRef","keepMounted","portalProps","mounted","useNavigationMenuRootContext","_jsx","NavigationMenuPortalContext","FloatingPortal","React","ReactDOM","useNavigationMenuAnchorPositioning","params","useAnchorPositioningWithHook","useFloating","React","NavigationMenuPositionerContext","useNavigationMenuPositionerContext","optional","context","formatErrorMessage_default","adaptiveOrigin","state","rawX","rawY","floatRect","floating","platform","strategy","placement","win","getWindow","styles","DEFAULT_SIDES","offsetParent","offsetDimensions","doc","ownerDocument","currentSide","getSide","x","y","sideX","sideY","import_jsx_runtime","EMPTY_ROOT_CONTEXT","getEmptyRootContext","NavigationMenuPositioner","componentProps","forwardedRef","open","mounted","positionerElement","setPositionerElement","floatingRootContext","nested","transitionStatus","useNavigationMenuRootContext","className","render","anchor","positionMethod","side","align","sideOffset","alignOffset","collisionBoundary","collisionPadding","collisionAvoidance","POPUP_COLLISION_AVOIDANCE","DROPDOWN_COLLISION_AVOIDANCE","arrowPadding","sticky","disableAnchorTracking","style","elementProps","keepMounted","useNavigationMenuPortalContext","nodeId","useNavigationMenuTreeContext","initialInstantTimeout","useTimeout","resizeTimeout","instant","setInstant","needsInitialInstantResetRef","onFocus","event","isOutsideEvent","enableFocusInside","disableFocusInside","mergeCleanups","addEventListener","domReference","positioning","useNavigationMenuAnchorPositioning","adaptiveOrigin","state","handleResize","win","getWindow","element","usePositioner","_jsx","NavigationMenuPositionerContext","React","import_jsx_runtime","EMPTY_ROOT_CONTEXT","getEmptyRootContext","Guards","children","beforeInsideRef","beforeOutsideRef","afterInsideRef","afterOutsideRef","positionerElement","viewportElement","floatingRootContext","useNavigationMenuRootContext","hasPositioner","useNavigationMenuPositionerContext","referenceElement","_jsxs","_jsx","FocusGuard","event","isOutsideEvent","getNextTabbable","getPreviousTabbable","NavigationMenuViewport","componentProps","forwardedRef","render","className","style","idProp","elementProps","id","useId","setViewportElement","setViewportTargetElement","prevTriggerElementRef","viewportInert","setViewportInert","domReference","useIsoLayoutEffect","element","useRenderElement","relatedTarget","currentTarget","contains","inertValue","React","NavigationMenuBackdrop","componentProps","forwardedRef","render","className","style","elementProps","open","mounted","transitionStatus","useNavigationMenuRootContext","useRenderElement","popupTransitionStateMapping","React","NavigationMenuPopup","componentProps","forwardedRef","render","className","style","idProp","elementProps","open","transitionStatus","setPopupElement","useNavigationMenuRootContext","positioning","useNavigationMenuPositionerContext","direction","useDirection","id","useBaseUiId","state","isPhysicalLeft","isOriginSide","useRenderElement","getDisabledMountTransitionStyles","popupTransitionStateMapping","React","NavigationMenuArrow","componentProps","forwardedRef","render","className","style","elementProps","open","transitionStatus","useNavigationMenuRootContext","arrowRef","side","align","arrowUncentered","arrowStyles","useNavigationMenuPositionerContext","useRenderElement","getDisabledMountTransitionStyles","popupStateMapping","React","import_jsx_runtime","NavigationMenuLink","componentProps","forwardedRef","className","render","active","closeOnClick","style","elementProps","setValue","popupElement","positionerElement","rootRef","useNavigationMenuRootContext","nodeId","useNavigationMenuTreeContext","tree","useFloatingTree","_jsx","CompositeItem","event","createChangeEventDetails","reason_parts_exports","isOutsideMenuEvent","React","NavigationMenuIcon","componentProps","forwardedRef","render","className","style","elementProps","itemValue","useNavigationMenuItemContext","open","value","useNavigationMenuRootContext","useRenderElement","triggerOpenStateMapping","import_jsx_runtime","NavigationMenu","className","children","positionerProps","container","props","index_parts_exports","cx","NavigationMenuList","NavigationMenuItem","NavigationMenuTrigger","leadingIcon","badge","disabled","ChevronDown","NavigationMenuAnchor","NavigationMenuContent","NavigationMenuLink","trailingIcon","active","import_jsx_runtime","Document","props","IconBase","import_jsx_runtime","Search","props","IconBase","import_jsx_runtime","Send","props","IconBase","import_jsx_runtime","Settings","props","IconBase","import_jsx_runtime","Star","props","IconBase","import_jsx_runtime","UserAdd","props","IconBase","import_jsx_runtime","Login","props","IconBase","import_jsx_runtime","Logout","props","IconBase","import_react","import_jsx_runtime","BrandEasygov","props","uid","BrandBase","InvalidTokenError","b64DecodeUnicode","str","m","p","code","base64UrlDecode","output","jwtDecode","token","options","pos","part","decoded","e","nopLogger","level","logger","Log","reset","setLevel","value","setLogger","Logger","_Logger","_name","args","err","method","methodLogger","name","staticMethod","staticLogger","prefix","JwtUtils","token","jwtDecode","header","payload","privateKey","encodedHeader","CryptoUtils","encodedPayload","encodedToken","signature","encodedSignature","secretKey","UUID_V4_TEMPLATE","toBase64","val","chr","_CryptoUtils","arr","c","code_verifier","data","hashed","client_id","client_secret","alg","message","msgUint8","hashBuffer","jwk","jsonObject","utf8encodedAndHashed","url","accessToken","httpMethod","keyPair","nonce","hashedToken","encodedHash","publicJwk","audience","algorithm","now","hashFunction","encoder","input","Event","cb","idx","ev","PopupUtils","features","_a","_b","_c","width","key","Timer","_Timer","diff","durationInSeconds","expiration","timerDurationInSeconds","UrlUtils","responseMode","params","URL_STATE_DELIMITER","ErrorResponse","form","ErrorTimeout","AccessTokenEvents","container","duration","expiring","expired","CheckSessionIFrame","_callback","_client_id","_intervalInSeconds","_stopOnError","e","parsedUrl","resolve","session_state","send","InMemoryWebStorage","index","ErrorDPoPNonce","JsonService","additionalContentTypes","_jwtHandler","_extraHeaders","init","timeoutInSeconds","initFetch","controller","timeoutId","credentials","headers","response","contentType","item","json","body","basicAuth","initCredentials","extraHeaders","responseText","customKeys","protectedHeaders","preventOverride","headerName","content","MetadataService","_settings","metadata","optional","jwks_uri","keySet","WebStorageStateStore","store","len","keys","DefaultResponseType","DefaultScope","DefaultClientAuthentication","DefaultStaleStateAgeInSeconds","OidcClientSettingsStore","authority","metadataUrl","signingKeys","metadataSeed","response_type","scope","redirect_uri","post_logout_redirect_uri","client_authentication","token_endpoint_auth_signing_alg","prompt","display","max_age","ui_locales","acr_values","resource","response_mode","filterProtocolClaims","loadUserInfo","requestTimeoutInSeconds","staleStateAgeInSeconds","mergeClaimsStrategy","disablePKCE","stateStore","revokeTokenAdditionalContentTypes","fetchRequestCredentials","refreshTokenAllowedScope","extraQueryParams","extraTokenParams","dpop","omitScopeWhenRequesting","UserInfoService","_metadataService","claims","TokenClient","grant_type","clientAssertion","param","ResponseValidator","_claimsService","state","skipUserInfo","shouldValidateSubClaim","hasIdToken","validateSub","tokenResponse","existingToken","incoming","existing","State","_State","storageString","storage","age","cutoff","remove","SigninState","_SigninState","code_challenge","_SigninRequest","state_data","request_type","url_state","dpopJkt","optionalParams","stateParam","r","SigninRequest","OidcScope","SigninResponse","splitState","SignoutRequest","id_token_hint","SignoutResponse","DefaultProtocolClaims","InternalRequiredProtocolClaims","ClaimsService","result","protocolClaims","claim","claims1","claims2","values","mergedValues","DPoPState","OidcClient","settings","metadataService","request","request_uri","login_hint","signinRequest","signinState","removeState","storedStateString","dpopProof","dpopStore","dpopState","username","password","signinResponse","allowableScopes","s","signoutState","type","SessionMonitor","_userManager","user","intervalInSeconds","stopOnError","checkSessionIFrame","timerHandle","session","tmpUser","raiseEvent","User","_User","expires_in","messageSource","AbstractChildWindow","keepOpen","reject","listener","origin","channel","reason","dispose","parent","targetOrigin","msgData","DefaultPopupWindowFeatures","DefaultPopupTarget","DefaultAccessTokenExpiringNotificationTimeInSeconds","DefaultCheckSessionIntervalInSeconds","DefaultSilentRequestTimeoutInSeconds","UserManagerSettingsStore","popup_redirect_uri","popup_post_logout_redirect_uri","popupWindowFeatures","popupWindowTarget","redirectMethod","redirectTarget","iframeNotifyParentOrigin","iframeScriptOrigin","silent_redirect_uri","silentRequestTimeoutInSeconds","automaticSilentRenew","validateSubOnSilentRenew","includeIdTokenInSilentRenew","monitorSession","monitorAnonymousSession","checkSessionIntervalInSeconds","query_status_response_type","stopCheckSessionOnError","revokeTokenTypes","revokeTokensOnSignout","includeIdTokenInSilentSignout","accessTokenExpiringNotificationTimeInSeconds","maxSilentRenewTimeoutRetries","userStore","IFrameWindow","_IFrameWindow","iframe","timer","frame","IFrameNavigator","checkForPopupClosedInterval","second","PopupWindow","popupSignal","popupAbortOnClose","centeredPopup","popupClosedInterval","clearPopupClosedInterval","PopupNavigator","RedirectNavigator","targetWindow","redirect","abort","UserManagerEvents","SilentRenewService","maxRetries","RefreshState","UserManager","redirectNavigator","popupNavigator","iframeNavigator","requestArgs","handle","verifySub","navResponse","id_token","signoutRequest","signoutResponse","types","typesPresent","dpopSettings","dpopKeys","replaceLeadingLabel","hostname","label","dotIndex","deriveOrigin","subdomain","protocol","replaced","resolveCoreOrigin","resolveInfoOrigin","resolveCoreApiOrigin","EASYGOV_REALM_PATH","resolveOidcAuthority","origin","classifyRemainder","remainder","resolveEnvironmentStage","msg","OIDC_CLIENT_ID","current","sessionInitialized","status","listeners","manager","noAuthMode","notify","listener","setStatus","next","applyOidcUser","oidcUser","profile","sub","name","buildSettings","authority","resolveOidcAuthority","coreOrigin","resolveCoreOrigin","fallbackUri","metadata","resolveInfoOrigin","WebStorageStateStore","InMemoryWebStorage","OIDC_PARAM_KEYS","hasOidcCallbackParams","search","clearOidcParamsFromUrl","url","dirty","k","isInOidcSilentIframe","degradeToNoAuth","initSession","manager","noAuthMode","resolveOidcAuthority","degradeToNoAuth","isInOidcSilentIframe","hasOidcCallbackParams","UserManager","buildSettings","u","applyOidcUser","status","setStatus","search","clearOidcParamsFromUrl","sessionInitialized","current","notify","topLevelHadError","getSessionInitialized","getAccessToken","current","getUser","onSessionChange","listener","listeners","requireSession","manager","setStatus","signOut","status","CONTEXT_MARKERS","urlPathSegments","readContextFromUrl","segments","typeIndex","segment","idSegment","cachedPathname","cachedContext","isSameContext","a","b","readUrlContext","pathname","next","readServerUrlContext","listeners","installed","notifyScheduled","notify","listener","scheduleNotify","install","method","original","data","unused","url","subscribeUrlContext","EMPTY","snapshot","listeners","publishHeaderContext","contextJwt","claims","snapshot","EMPTY","listener","listeners","package_default","libraryVersion","package_default","snapshot","serverSnapshot","listeners","subscribeVersionInfo","listener","readVersionInfo","readServerVersionInfo","publishBackendVersion","version","fetchStarted","ensureBackendVersionFetch","apiOrigin","resolveCoreApiOrigin","res","data","KNOWN_PROBLEM_KEYS","parseHeaderContextProblem","res","body","mapHeaderContextError","problem","locale","traceId","errorCode","message","t","reference","leftover","key","details","import_jsx_runtime","NEVER_CHANGES","useLatestRef","value","ref","EMPTY_SESSION","cachedSnapshot","readSession","user","getUser","accessToken","getAccessToken","subscribeSession","listener","onSessionChange","useEasygovSession","useEasygovDisplayLanguage","subscribeEasygovDisplayLanguage","getEasygovDisplayLanguage","getServerDisplayLanguage","useEasygovVersionInfo","subscribeVersionInfo","readVersionInfo","readServerVersionInfo","useUrlContext","subscribeUrlContext","readUrlContext","readServerUrlContext","decodeJwtPayload","jwt","payload","base64","padded","binary","bytes","c","json","useHeaderContext","session","urlContext","contextJwt","setContextJwt","accessibleAccountCount","setAccessibleAccountCount","contextError","setContextError","userSub","token","getAccessToken","apiOrigin","resolveCoreApiOrigin","controller","url","res","problem","parseHeaderContextProblem","data","err","claims","dismissContextError","buildHref","origin","path","makeNavigateHandler","onNavigate","e","Header","initializing","user","onLogin","onLogout","dashboardPath","favoritesPath","companyPath","servicesPath","profilePath","coreOrigin","infoOrigin","infoHomePath","logoTitle","environmentStage","userDisplayName","companyLabel","locale","onLocaleChange","portalContainer","headerRef","announcement","loginPending","setLoginPending","logoutPending","setLogoutPending","onPageShow","handleLogin","handleLogout","isLoggedIn","AuthIcon","Logout","Login","authLabel","t","selectAccountPath","Grid","GridItem","BrandEasygov","NavigationMenu","NavigationMenuList","NavigationMenuItem","NavigationMenuAnchor","Send","Star","Document","NavigationMenuTrigger","NavigationMenuContent","NavigationMenuLink","UserAdd","Settings","Select","v","SelectTrigger","SelectContent","LOCALES","l","SelectItem","Button","Search","BrandSwiss","EasygovHeader","onLanguageChange","onContextChange","initRef","initSession","ensureBackendVersionFetch","versionInfo","initialized","subscribeSession","getSessionInitialized","useEasygovSession","selectedAccountId","headerElRef","prevUserSubRef","setAnnouncement","effectiveLocale","contextErrorContent","mapHeaderContextError","effectiveLocaleRef","useLatestRef","onLogoutRef","currentSub","previousSub","msg","onLanguageChangeRef","onContextChangeRef","publishHeaderContext","handleLocaleChange","newLocale","setEasygovDisplayLanguage","setPortalContainer","root","NEVER_CHANGES","resolveCoreOrigin","resolveInfoOrigin","resolveEnvironmentStage","onNavigateRef","dispatchNavigate","displayUser","claimsName","effectiveAccountId","contextPath","carriedContext","withContext","base","requireSession","signOut","ErrorDialog"]}
|