Files
pole-book/server/node_modules/@strapi/ui-primitives/dist/index.mjs.map

1 line
184 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"version":3,"file":"index.mjs","sources":["../src/components/Collection.tsx","../src/hooks/useCollator.ts","../src/hooks/useFilter.ts","../src/hooks/usePrev.ts","../src/components/Combobox/Combobox.tsx","../src/hooks/useCallbackRef.ts","../src/components/Select/Select.tsx","../src/helpers/events.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * An internal fork of Radix UI's `Collection` component.\n *\n * We've added a subscription API to allow us to subscribe to changes in the collection via the useCollection hook.\n */\nimport * as React from 'react';\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Slot } from '@radix-ui/react-slot';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype SlotProps = Radix.ComponentPropsWithoutRef<typeof Slot>;\ntype CollectionElement = HTMLElement;\ninterface CollectionProps extends SlotProps {\n scope: any;\n}\n\ninterface CollectionProviderProps {\n children?: React.ReactNode;\n scope: any;\n}\n\n// We have resorted to returning slots directly rather than exposing primitives that can then\n// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.\n// This is because we encountered issues with generic types that cannot be statically analysed\n// due to creating them dynamically via createCollection.\n\nfunction createCollection<ItemElement extends HTMLElement, ItemData = object>(name: string) {\n /* -----------------------------------------------------------------------------------------------\n * CollectionProvider\n * ---------------------------------------------------------------------------------------------*/\n\n const PROVIDER_NAME = `${name}CollectionProvider`;\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n\n type ItemMapValue = { ref: React.RefObject<ItemElement> } & ItemData;\n\n type ContextValue = {\n collectionRef: React.RefObject<CollectionElement>;\n itemMap: Map<React.RefObject<ItemElement>, ItemMapValue>;\n listeners: Set<Listener>;\n };\n\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext<ContextValue>(PROVIDER_NAME, {\n collectionRef: { current: null },\n itemMap: new Map(),\n listeners: new Set<Listener>(),\n });\n\n const CollectionProvider = (props: CollectionProviderProps) => {\n const { scope, children } = props;\n const ref = React.useRef<CollectionElement>(null);\n const itemMap = React.useRef<ContextValue['itemMap']>(new Map()).current;\n const listeners = React.useRef<ContextValue['listeners']>(new Set()).current;\n\n return (\n <CollectionProviderImpl scope={scope} itemMap={itemMap} collectionRef={ref} listeners={listeners}>\n {children}\n </CollectionProviderImpl>\n );\n };\n\n CollectionProvider.displayName = PROVIDER_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionSlot\n * ---------------------------------------------------------------------------------------------*/\n\n const COLLECTION_SLOT_NAME = `${name}CollectionSlot`;\n\n const CollectionSlot = React.forwardRef<CollectionElement, CollectionProps>((props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n\n return <Slot ref={composedRefs}>{children}</Slot>;\n });\n\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * CollectionItem\n * ---------------------------------------------------------------------------------------------*/\n\n const ITEM_SLOT_NAME = `${name}CollectionItemSlot`;\n const ITEM_DATA_ATTR = 'data-radix-collection-item';\n\n type CollectionItemSlotProps = ItemData & {\n children: React.ReactNode;\n scope: any;\n };\n\n const CollectionItemSlot = React.forwardRef<ItemElement, CollectionItemSlotProps>((props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef<ItemElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n\n React.useEffect(() => {\n const previousMap = Array.from(context.itemMap.values());\n context.itemMap.set(ref, { ref, ...(itemData as unknown as ItemData) });\n\n context.listeners.forEach((listener) => listener(Array.from(context.itemMap.values()), previousMap));\n\n return () => {\n const previousMap = Array.from(context.itemMap.values());\n context.itemMap.delete(ref);\n context.listeners.forEach((listener) => listener(Array.from(context.itemMap.values()), previousMap));\n };\n });\n\n return (\n <Slot {...{ [ITEM_DATA_ATTR]: '' }} ref={composedRefs}>\n {children}\n </Slot>\n );\n });\n\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n\n /* -----------------------------------------------------------------------------------------------\n * useCollection\n * ---------------------------------------------------------------------------------------------*/\n\n type Listener = (newState: ItemMapValue[], prevState: ItemMapValue[]) => void;\n\n function useCollection(scope: any) {\n const context = useCollectionContext(`${name}CollectionConsumer`, scope);\n\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current!) - orderedNodes.indexOf(b.ref.current!),\n );\n\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n\n const subscribe = React.useCallback(\n (listener: Listener) => {\n context.listeners.add(listener);\n\n // Unsubscribe\n return () => context.listeners.delete(listener);\n },\n [context.listeners],\n );\n\n return { getItems, subscribe };\n }\n\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope,\n ] as const;\n}\n\nexport { createCollection };\nexport type { CollectionProps, CollectionProviderProps };\n","/**\n * Stolen from @react-aria/i18n\n */\n\nconst cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(locale: string, options?: Intl.CollatorOptions): Intl.Collator {\n const cacheKey =\n locale +\n (options\n ? Object.entries(options)\n .sort((a, b) => (a[0] < b[0] ? -1 : 1))\n .join()\n : '');\n\n if (cache.has(cacheKey)) {\n return cache.get(cacheKey)!;\n }\n\n const formatter = new Intl.Collator(locale, options);\n cache.set(cacheKey, formatter);\n\n return formatter;\n}\n","/**\n * Stolen from @react-aria/i18n\n */\n\nimport { useCollator } from './useCollator';\n\nexport interface Filter {\n /** Returns whether a string starts with a given substring. */\n startsWith(string: string, substring: string): boolean;\n /** Returns whether a string ends with a given substring. */\n endsWith(string: string, substring: string): boolean;\n /** Returns whether a string contains a given substring. */\n contains(string: string, substring: string): boolean;\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(locale: string, options?: Intl.CollatorOptions): Filter {\n const collator = useCollator(locale, {\n usage: 'search',\n ...options,\n });\n\n return {\n startsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n // Normalize both strings so we can slice safely\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n return collator.compare(string.slice(0, substring.length), substring) === 0;\n },\n endsWith(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n return collator.compare(string.slice(-substring.length), substring) === 0;\n },\n contains(string, substring) {\n if (substring.length === 0) {\n return true;\n }\n\n string = string.normalize('NFC');\n substring = substring.normalize('NFC');\n\n let scan = 0;\n const sliceLen = substring.length;\n for (; scan + sliceLen <= string.length; scan++) {\n const slice = string.slice(scan, scan + sliceLen);\n\n if (collator.compare(substring, slice) === 0) {\n return true;\n }\n }\n\n return false;\n },\n };\n}\n","import * as React from 'react';\n\nexport const usePrev = <T>(value: T): T | undefined => {\n const ref = React.useRef<T>();\n\n React.useEffect(() => {\n ref.current = value;\n });\n\n return ref.current;\n};\n","import * as React from 'react';\n\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContext } from '@radix-ui/react-context';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { hideOthers } from 'aria-hidden';\nimport * as ReactDOM from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport { useFilter } from '../../hooks/useFilter';\nimport { usePrev } from '../../hooks/usePrev';\nimport { createCollection } from '../Collection';\n\nimport type { ComponentPropsWithoutRef } from '@radix-ui/react-primitive';\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\nconst SELECTION_KEYS = ['Enter'];\n\nconst defaultIsPrintableCharacter = (str: string): boolean => {\n return Boolean(str.length === 1 && str.match(/\\S| /));\n};\n\n/* -------------------------------------------------------------------------------------------------\n * Combobox\n * -----------------------------------------------------------------------------------------------*/\n\nconst COMBOBOX_NAME = 'Combobox';\n\nconst [Collection, useCollection] = createCollection<ComboboxItemElement, CollectionData>(COMBOBOX_NAME);\n\ntype CollectionData = OptionData | CreateData;\n\ninterface Data {\n value: string;\n disabled: boolean;\n textValue: string;\n isVisible?: boolean;\n}\n\ninterface OptionData extends Data {\n type: 'option';\n}\n\ninterface CreateData extends Data {\n type: 'create';\n}\n\ntype AutocompleteObject =\n | { type: 'none'; filter?: never }\n | { type: 'list'; filter: 'contains' | 'startsWith' }\n | { type: 'both'; filter: 'startsWith' };\n\ntype Autocomplete = 'none' | 'list' | 'both' | AutocompleteObject;\n\ntype ComboboxContextValue = {\n allowCustomValue: boolean;\n autocomplete: AutocompleteObject;\n contentId: string;\n disabled?: boolean;\n locale: string;\n onOpenChange(open: boolean): void;\n onTriggerChange(node: ComboboxInputElement | null): void;\n onValueChange(value: string | undefined): void;\n open: boolean;\n required: boolean;\n trigger: ComboboxInputElement | null;\n value?: string;\n focusFirst: (\n candidates: Array<HTMLDivElement | null>,\n items: Array<CollectionData & { ref: React.RefObject<HTMLDivElement> }>,\n ) => void;\n textValue?: string;\n onTextValueChange(textValue: string): void;\n onViewportChange(node: ComboboxViewportElement | null): void;\n onContentChange(node: ComboboxContentImplElement | null): void;\n visuallyFocussedItem: HTMLDivElement | null;\n filterValue: string | undefined;\n onFilterValueChange: (value: string | undefined) => void;\n onVisuallyFocussedItemChange: (item: HTMLDivElement | null) => void;\n isPrintableCharacter: (str: string) => boolean;\n visible?: boolean;\n};\n\nconst [ComboboxProvider, useComboboxContext] = createContext<ComboboxContextValue>(COMBOBOX_NAME);\n\ninterface RootProps {\n allowCustomValue?: boolean;\n autocomplete?: Autocomplete;\n children?: React.ReactNode;\n defaultOpen?: boolean;\n defaultValue?: string;\n defaultTextValue?: string;\n disabled?: boolean;\n locale?: string;\n onOpenChange?(open: boolean): void;\n onValueChange?(value: string): void;\n onTextValueChange?(textValue: string): void;\n textValue?: string;\n open?: boolean;\n required?: boolean;\n value?: string;\n defaultFilterValue?: string;\n filterValue?: string;\n onFilterValueChange?(value: string): void;\n isPrintableCharacter?: (str: string) => boolean;\n visible?: boolean;\n}\n\n/**\n * @internal don't expose this. It's only used to access the `useCollection` hook.\n */\nconst ComboboxProviders = ({ children }: { children: React.ReactNode }) => (\n <PopperPrimitive.Root>\n <Collection.Provider scope={undefined}>{children}</Collection.Provider>\n </PopperPrimitive.Root>\n);\n\nconst formatAutocomplete = (autocomplete: Autocomplete) => {\n if (typeof autocomplete === 'string') {\n if (autocomplete === 'none') {\n return {\n type: autocomplete,\n filter: undefined,\n };\n }\n return {\n type: autocomplete,\n filter: 'startsWith' as const,\n };\n }\n return autocomplete;\n};\n\nconst Combobox = (props: RootProps) => {\n const {\n allowCustomValue = false,\n autocomplete = 'none',\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n disabled,\n required = false,\n locale = 'en-EN',\n onTextValueChange,\n textValue: textValueProp,\n defaultTextValue,\n filterValue: filterValueProp,\n defaultFilterValue,\n onFilterValueChange,\n isPrintableCharacter = defaultIsPrintableCharacter,\n visible = false,\n } = props;\n\n const [trigger, setTrigger] = React.useState<ComboboxInputElement | null>(null);\n const [viewport, setViewport] = React.useState<ComboboxViewportElement | null>(null);\n const [content, setContent] = React.useState<ComboboxContentImplElement | null>(null);\n const [visuallyFocussedItem, setVisuallyFocussedItem] = React.useState<HTMLDivElement | null>(null);\n\n /**\n * Lets state either be handled externally or internally.\n */\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n const [value, setValue] = useControllableState({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n const [textValue, setTextValue] = useControllableState({\n prop: textValueProp,\n defaultProp: allowCustomValue && !defaultTextValue ? valueProp : defaultTextValue,\n onChange: onTextValueChange,\n });\n const [filterValue, setFilterValue] = useControllableState({\n prop: filterValueProp,\n defaultProp: defaultFilterValue,\n onChange: onFilterValueChange,\n });\n\n const id = useId();\n\n const focusFirst: ComboboxContextValue['focusFirst'] = React.useCallback(\n (candidates, items) => {\n const allItems = items.map((item) => item.ref.current);\n const [firstItem, ...restItems] = allItems;\n const [lastItem] = restItems.slice(-1);\n\n const PREVIOUSLY_FOCUSED_ELEMENT =\n visuallyFocussedItem ?? items.find((item) => item.value === value)?.ref.current;\n // eslint-disable-next-line no-restricted-syntax\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: 'nearest' });\n\n // viewport might have padding so scroll to its edges when focusing first/last items.\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n\n setVisuallyFocussedItem(candidate);\n\n if (autocomplete === 'both') {\n const item = items.find((item) => item.ref.current === candidate);\n\n if (item) {\n setTextValue(item.textValue);\n }\n }\n\n if (candidate !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [autocomplete, setTextValue, viewport, visuallyFocussedItem, value],\n );\n\n const autocompleteObject: AutocompleteObject = formatAutocomplete(autocomplete);\n\n React.useEffect(() => {\n if (autocomplete !== 'both') {\n setVisuallyFocussedItem(null);\n }\n }, [textValue, autocomplete]);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (content && trigger) return hideOthers([content, trigger]);\n }, [content, trigger]);\n\n return (\n <ComboboxProviders>\n <ComboboxProvider\n allowCustomValue={allowCustomValue}\n autocomplete={autocompleteObject}\n required={required}\n trigger={trigger}\n onTriggerChange={setTrigger}\n contentId={id}\n value={value}\n onValueChange={setValue}\n open={open}\n onOpenChange={setOpen}\n disabled={disabled}\n locale={locale}\n focusFirst={focusFirst}\n textValue={textValue}\n onTextValueChange={setTextValue}\n onViewportChange={setViewport}\n onContentChange={setContent}\n visuallyFocussedItem={visuallyFocussedItem}\n filterValue={filterValue}\n onFilterValueChange={setFilterValue}\n onVisuallyFocussedItemChange={setVisuallyFocussedItem}\n isPrintableCharacter={isPrintableCharacter}\n visible={visible}\n >\n {children}\n </ComboboxProvider>\n </ComboboxProviders>\n );\n};\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype TriggerProps = PrimitiveDivProps;\n\nconst TRIGGER_NAME = 'ComboboxTrigger';\ntype ComboboxTriggerElement = React.ElementRef<'div'>;\n\nconst ComboboxTrigger = React.forwardRef<ComboboxTriggerElement, TriggerProps>((props, forwardedRef) => {\n const { ...triggerProps } = props;\n const context = useComboboxContext(TRIGGER_NAME);\n\n const handleOpen = () => {\n if (!context.disabled) {\n context.onOpenChange(true);\n }\n };\n\n return (\n <PopperPrimitive.Anchor asChild>\n <FocusScope\n asChild\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapped={context.open}\n onMountAutoFocus={(event) => {\n // we prevent open autofocus because we manually focus the selected item\n event.preventDefault();\n }}\n onUnmountAutoFocus={(event) => {\n context.trigger?.focus({ preventScroll: true });\n /**\n * In firefox there's a some kind of selection happening after\n * unmounting all of this, so we make sure we clear that.\n */\n document.getSelection()?.empty();\n event.preventDefault();\n }}\n >\n <div\n ref={forwardedRef}\n data-disabled={context.disabled ? '' : undefined}\n {...triggerProps} // Enable compatibility with native label or custom `Label` \"click\" for Safari:\n onClick={composeEventHandlers(triggerProps.onClick, (event) => {\n // To prevent focus() calls from Slot, it causes unexpected focus states on UI\n // ref: https://github.com/strapi/design-system/issues/1330\n if (context.disabled) {\n event.preventDefault();\n return;\n }\n\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n context.trigger?.focus();\n })}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n // To prevent focus() calls from Slot, it causes unexpected focus states on UI\n // ref: https://github.com/strapi/design-system/issues/1330\n if (context.disabled) {\n event.preventDefault();\n return;\n }\n\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n const target = event.target as HTMLElement;\n\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n\n /**\n * This has been added to allow events inside the trigger to be easily fired\n * e.g. the clear button or removing a tag\n */\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n /**\n * Firefox had issues focussing the input correctly.\n */\n context.trigger?.focus();\n }\n })}\n />\n </FocusScope>\n </PopperPrimitive.Anchor>\n );\n});\n\nComboboxTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst INPUT_NAME = 'ComboboxInput';\n\ntype TextInputProps = React.InputHTMLAttributes<HTMLInputElement>;\ntype ComboboxInputElement = React.ElementRef<'input'>;\n\nconst ComboxboxTextInput = React.forwardRef<ComboboxInputElement, TextInputProps>((props, forwardedRef) => {\n const context = useComboboxContext(INPUT_NAME);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const { getItems } = useCollection(undefined);\n\n const { startsWith } = useFilter(context.locale, { sensitivity: 'base' });\n\n const isDisabled = context.disabled;\n const composedRefs = useComposedRefs(inputRef, forwardedRef, context.onTriggerChange);\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n }\n };\n\n const previousFilter = usePrev(context.filterValue);\n\n /**\n * If you suddenly get a match it pushes you right to the end.\n */\n useLayoutEffect(() => {\n const timeout = setTimeout(() => {\n if (\n context.textValue === '' ||\n context.textValue === undefined ||\n context.filterValue === '' ||\n context.filterValue === undefined\n )\n return;\n\n const firstItem = getItems().find(\n (item) => item.type === 'option' && startsWith(item.textValue, context.textValue!),\n );\n\n const characterChangedAtIndex = findChangedIndex(previousFilter ?? '', context.filterValue);\n\n /**\n * If there's a match, we want to select the text after the match.\n */\n if (firstItem && !context.visuallyFocussedItem && characterChangedAtIndex === context.filterValue.length) {\n inputRef.current?.setSelectionRange(context.filterValue.length, context.textValue.length);\n }\n });\n\n return () => clearTimeout(timeout);\n }, [context.textValue, context.filterValue, startsWith, context.visuallyFocussedItem, getItems, previousFilter]);\n\n return (\n <input\n type=\"text\"\n role=\"combobox\"\n aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-required={context.required}\n aria-autocomplete={context.autocomplete.type}\n data-state={context.open ? 'open' : 'closed'}\n aria-disabled={isDisabled}\n aria-activedescendant={context.visuallyFocussedItem?.id}\n disabled={isDisabled}\n data-disabled={isDisabled ? '' : undefined}\n data-placeholder={context.textValue === undefined ? '' : undefined}\n value={context.textValue ?? ''}\n {...props}\n ref={composedRefs}\n onKeyDown={composeEventHandlers(props.onKeyDown, (event) => {\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n if (!context.open) {\n handleOpen();\n }\n\n setTimeout(() => {\n const items = getItems().filter((item) => !item.disabled && item.isVisible);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (['ArrowUp', 'End'].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if (['ArrowUp', 'ArrowDown'].includes(event.key)) {\n const currentElement =\n context.visuallyFocussedItem ?? getItems().find((item) => item.value === context.value)?.ref.current;\n\n if (currentElement) {\n let currentIndex = candidateNodes.indexOf(currentElement);\n\n /**\n * This lets us go around the items in one big loop.\n */\n if (currentIndex === candidateNodes.length - 1) {\n currentIndex = -1;\n }\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n }\n if (\n ['ArrowDown'].includes(event.key) &&\n context.autocomplete.type === 'both' &&\n candidateNodes.length > 1\n ) {\n const [firstItem, ...restItems] = candidateNodes;\n const firstItemText = getItems().find((item) => item.ref.current === firstItem)!.textValue;\n\n if (context.textValue === firstItemText) {\n candidateNodes = restItems;\n }\n }\n context.focusFirst(candidateNodes, getItems());\n });\n event.preventDefault();\n } else if (['Tab'].includes(event.key) && context.open) {\n event.preventDefault();\n } else if (['Escape'].includes(event.key)) {\n if (context.open) {\n context.onOpenChange(false);\n } else {\n context.onValueChange(undefined);\n context.onTextValueChange('');\n }\n event.preventDefault();\n } else if (SELECTION_KEYS.includes(event.key)) {\n if (context.visuallyFocussedItem) {\n const focussedItem = getItems().find((item) => item.ref.current === context.visuallyFocussedItem);\n\n if (focussedItem) {\n context.onValueChange(focussedItem.value);\n context.onTextValueChange(focussedItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(focussedItem.textValue);\n }\n\n focussedItem.ref.current?.click();\n }\n } else {\n const matchedItem = getItems().find(\n (item) => item.type === 'option' && !item.disabled && item.textValue === context.textValue,\n );\n\n if (matchedItem) {\n context.onValueChange(matchedItem.value);\n context.onTextValueChange(matchedItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(matchedItem.textValue);\n }\n\n matchedItem.ref.current?.click();\n }\n }\n\n context.onOpenChange(false);\n event.preventDefault();\n } else {\n context.onVisuallyFocussedItemChange(null);\n }\n })}\n onChange={composeEventHandlers(props.onChange, (event) => {\n context.onTextValueChange(event.currentTarget.value);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(event.currentTarget.value);\n }\n })}\n onKeyUp={composeEventHandlers(props.onKeyUp, (event) => {\n if (!context.open && (context.isPrintableCharacter(event.key) || ['Backspace'].includes(event.key))) {\n handleOpen();\n }\n\n setTimeout(() => {\n if (\n context.autocomplete.type === 'both' &&\n context.isPrintableCharacter(event.key) &&\n context.filterValue !== undefined\n ) {\n const value = context.filterValue;\n const firstItem = getItems().find((item) => startsWith(item.textValue, value));\n\n if (firstItem) {\n context.onTextValueChange(firstItem.textValue);\n }\n }\n });\n\n if (context.autocomplete.type === 'none' && context.isPrintableCharacter(event.key)) {\n const value = context.textValue ?? '';\n\n const nextItem = getItems().find((item) => startsWith(item.textValue, value));\n\n if (nextItem) {\n context.onVisuallyFocussedItemChange(nextItem.ref.current);\n nextItem.ref.current?.scrollIntoView();\n }\n }\n })}\n onBlur={composeEventHandlers(props.onBlur, () => {\n if (context.open) {\n return;\n }\n\n context.onVisuallyFocussedItemChange(null);\n\n const [activeItem] = getItems().filter(\n (item) => item.textValue === context.textValue && item.type === 'option',\n );\n\n if (activeItem) {\n context.onValueChange(activeItem.value);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(activeItem.textValue);\n }\n\n return;\n }\n\n /**\n * If we allow custom values and we didn't find an active item\n * we just want to set it to the text value.\n */\n if (context.allowCustomValue) {\n context.onValueChange(context.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(context.textValue);\n }\n\n return;\n }\n\n const [previousItem] = getItems().filter((item) => item.value === context.value && item.type === 'option');\n\n /**\n * If we've succesfully typed a value that matches an item, we want to\n * update the value to that item's value. Otherwise, we want to update\n * the value to the previous value.\n *\n * If theres no previous value and we've typed a value that doesn't match\n * an item, we want to clear the value.\n */\n\n if (previousItem && context.textValue !== '') {\n context.onTextValueChange(previousItem.textValue);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(previousItem.textValue);\n }\n } else {\n context.onValueChange(undefined);\n context.onTextValueChange('');\n }\n })}\n />\n );\n});\n\nComboxboxTextInput.displayName = 'ComboboxTextInput';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxIcon\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxIconElement = React.ElementRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = ComponentPropsWithoutRef<typeof Primitive.button>;\ntype IconProps = PrimitiveButtonProps;\n\nconst ComboboxIcon = React.forwardRef<ComboboxIconElement, IconProps>((props, forwardedRef) => {\n const { children, ...iconProps } = props;\n\n const context = useComboboxContext(INPUT_NAME);\n\n const isDisabled = context.disabled;\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n /**\n * We should be focussing the trigger here not this button.\n */\n context.trigger?.focus();\n }\n };\n\n return (\n <Primitive.button\n aria-hidden\n type=\"button\"\n aria-disabled={isDisabled}\n aria-controls={context.contentId}\n aria-expanded={context.open}\n disabled={isDisabled}\n data-disabled={isDisabled ? '' : undefined}\n {...iconProps}\n tabIndex={-1}\n ref={forwardedRef} // Enable compatibility with native label or custom `Label` \"click\" for Safari:\n onClick={composeEventHandlers(iconProps.onClick, () => {\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n context.trigger?.focus();\n })}\n onPointerDown={composeEventHandlers(iconProps.onPointerDown, (event) => {\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(iconProps.onKeyDown, (event) => {\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })}\n >\n {children || '▼'}\n </Primitive.button>\n );\n});\n\nComboboxIcon.displayName = 'ComboboxIcon';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'ComboboxPortal';\n\ntype IPortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface PortalProps extends Omit<IPortalProps, 'asChild'> {\n children?: React.ReactNode;\n}\n\nconst ComboboxPortal = (props: PortalProps) => {\n return <PortalPrimitive asChild {...props} />;\n};\n\nComboboxPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'ComboboxContent';\n\ntype ComboboxContentElement = ComboboxContentImplElement;\ntype ContentProps = ComboboxContentImplProps;\n\nconst ComboboxContent = React.forwardRef<ComboboxContentElement, ContentProps>((props, forwardedRef) => {\n const context = useComboboxContext(CONTENT_NAME);\n const { getItems } = useCollection(undefined);\n const [fragment, setFragment] = React.useState<DocumentFragment>();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n useLayoutEffect(() => {\n if (context.open && context.autocomplete.type === 'none') {\n setTimeout(() => {\n const activeItem = getItems().find((item) => item.value === context.value);\n activeItem?.ref.current?.scrollIntoView({ block: 'nearest' });\n });\n }\n }, [getItems, context.autocomplete, context.value, context.open]);\n\n if (!context.open) {\n const frag = fragment as Element | undefined;\n\n return frag\n ? ReactDOM.createPortal(\n <Collection.Slot scope={undefined}>\n <div>{props.children}</div>\n </Collection.Slot>,\n frag,\n )\n : null;\n }\n\n return <ComboboxContentImpl {...props} ref={forwardedRef} />;\n});\n\nComboboxContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxContentImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_MARGIN = 10;\n\ntype ComboboxContentImplElement = ComboboxPopperPositionElement;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\n\ntype ComboboxPopperPrivateProps = { onPlaced?: PopperContentProps['onPlaced'] };\n\ninterface ComboboxContentImplProps extends Omit<ComboboxPopperPositionProps, keyof ComboboxPopperPrivateProps> {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n}\n\n/**\n * @internal This is the implementation of the `ComboboxContent` component. But should not be used on it's own\n * for accessibility reasons. Use `ComboboxContent` instead.\n */\nconst ComboboxContentImpl = React.forwardRef<ComboboxContentImplElement, ComboboxContentImplProps>(\n (props, forwardedRef) => {\n const { onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;\n const context = useComboboxContext(CONTENT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, (node) => context.onContentChange(node));\n\n // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`\n // and close on `pointerup` outside.\n const { onOpenChange } = context;\n\n useFocusGuards();\n\n React.useEffect(() => {\n const close = () => {\n onOpenChange(false);\n };\n window.addEventListener('blur', close);\n window.addEventListener('resize', close);\n\n return () => {\n window.removeEventListener('blur', close);\n window.removeEventListener('resize', close);\n };\n }, [onOpenChange]);\n\n return (\n <RemoveScroll allowPinchZoom>\n <DismissableLayer\n asChild\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n // When focus is trapped, a focusout event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={(event) => {\n event.preventDefault();\n }}\n onDismiss={() => {\n context.onOpenChange(false);\n context.trigger?.focus({ preventScroll: true });\n }}\n >\n <ComboboxPopperPosition\n role=\"listbox\"\n id={context.contentId}\n data-state={context.open ? 'open' : 'closed'}\n onContextMenu={(event) => event.preventDefault()}\n {...contentProps}\n ref={composedRefs}\n style={{\n // flex layout so we can place the scroll buttons properly\n display: 'flex',\n flexDirection: 'column',\n // reset the outline by default as the content MAY get focused\n outline: 'none',\n ...contentProps.style,\n }}\n />\n </DismissableLayer>\n </RemoveScroll>\n );\n },\n);\n\nComboboxContentImpl.displayName = 'ComboboxContentImpl';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxPopperPosition\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxPopperPositionElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface ComboboxPopperPositionProps extends PopperContentProps, ComboboxPopperPrivateProps {}\n\nconst ComboboxPopperPosition = React.forwardRef<ComboboxPopperPositionElement, ComboboxPopperPositionProps>(\n (props, forwardedRef) => {\n const { align = 'start', collisionPadding = CONTENT_MARGIN, ...popperProps } = props;\n\n return (\n <PopperPrimitive.Content\n {...popperProps}\n ref={forwardedRef}\n align={align}\n collisionPadding={collisionPadding}\n style={{\n // Ensure border-box for floating-ui calculations\n boxSizing: 'border-box',\n ...popperProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-combobox-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-combobox-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-combobox-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-combobox-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-combobox-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n },\n);\n\nComboboxPopperPosition.displayName = 'ComboboxPopperPosition';\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxViewport\n * -----------------------------------------------------------------------------------------------*/\n\nconst VIEWPORT_NAME = 'ComboboxViewport';\n\ntype ComboboxViewportElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = ComponentPropsWithoutRef<typeof Primitive.div>;\ntype ViewportProps = PrimitiveDivProps;\n\nconst ComboboxViewport = React.forwardRef<ComboboxViewportElement, ViewportProps>((props, forwardedRef) => {\n const comboboxContext = useComboboxContext(VIEWPORT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, comboboxContext.onViewportChange);\n\n return (\n <>\n {/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */}\n <style\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: `[data-radix-combobox-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-combobox-viewport]::-webkit-scrollbar{display:none}`,\n }}\n />\n <Collection.Slot scope={undefined}>\n <Primitive.div\n data-radix-combobox-viewport=\"\"\n role=\"presentation\"\n {...props}\n ref={composedRefs}\n style={{\n // we use position: 'relative' here on the `viewport` so that when we call\n // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport\n // (independent of the scrollUpButton).\n position: 'relative',\n flex: 1,\n overflow: 'auto',\n ...props.style,\n }}\n />\n </Collection.Slot>\n </>\n );\n});\n\nComboboxViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemContext\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'ComboboxItem';\n\ninterface ComboboxItemContextValue {\n onTextValueChange(node: HTMLSpanElement | null): void;\n textId: string;\n isSelected: boolean;\n textValue: string;\n}\n\nconst [ComboboxItemProvider, useComboboxItemContext] = createContext<ComboboxItemContextValue>(ITEM_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype ComboboxItemElement = ComboboxItemImplElement;\n\ninterface ItemProps extends ItemImplProps {\n textValue?: string;\n}\n\nexport const ComboboxItem = React.forwardRef<ComboboxItemElement, ItemProps>((props, forwardedRef) => {\n const { value, disabled = false, textValue: textValueProp, ...restProps } = props;\n const [fragment, setFragment] = React.useState<DocumentFragment>();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n const { onTextValueChange, textValue: contextTextValue, ...context } = useComboboxContext(ITEM_NAME);\n\n const textId = useId();\n\n const [textValue, setTextValue] = React.useState(textValueProp ?? '');\n\n const isSelected = context.value === value;\n\n const { startsWith, contains } = useFilter(context.locale, { sensitivity: 'base' });\n\n const handleTextValueChange = React.useCallback((node: HTMLSpanElement | null) => {\n setTextValue((prevTextValue) => {\n return prevTextValue || (node?.textContent ?? '').trim();\n });\n }, []);\n\n React.useEffect(() => {\n /**\n * This effect is designed to run when the value prop is\n * controlled and we need to update the text value accordingly.\n */\n if (isSelected && contextTextValue === undefined && textValue !== '') {\n onTextValueChange(textValue);\n }\n }, [textValue, isSelected, contextTextValue, onTextValueChange]);\n\n if (\n (context.autocomplete.type === 'both' &&\n textValue &&\n context.filterValue &&\n !startsWith(textValue, context.filterValue)) ||\n (context.autocomplete.type === 'list' &&\n context.autocomplete.filter === 'startsWith' &&\n textValue &&\n contextTextValue &&\n !startsWith(textValue, contextTextValue)) ||\n (context.autocomplete.type === 'list' &&\n context.autocomplete.filter === 'contains' &&\n textValue &&\n contextTextValue &&\n !contains(textValue, contextTextValue))\n ) {\n return fragment\n ? ReactDOM.createPortal(\n <ComboboxItemProvider\n textId={textId}\n onTextValueChange={handleTextValueChange}\n isSelected={isSelected}\n textValue={textValue}\n >\n <Collection.ItemSlot\n scope={undefined}\n value={value}\n textValue={textValue}\n disabled={disabled}\n type=\"option\"\n isVisible={false}\n >\n <ComboboxItemImpl ref={forwardedRef} value={value} disabled={disabled} {...restProps} />\n </Collection.ItemSlot>\n </ComboboxItemProvider>,\n fragment,\n )\n : null;\n }\n\n return (\n <ComboboxItemProvider\n textId={textId}\n onTextValueChange={handleTextValueChange}\n isSelected={isSelected}\n textValue={textValue}\n >\n <Collection.ItemSlot\n scope={undefined}\n value={value}\n textValue={textValue}\n disabled={disabled}\n type=\"option\"\n isVisible\n >\n <ComboboxItemImpl ref={forwardedRef} value={value} disabled={disabled} {...restProps} />\n </Collection.ItemSlot>\n </ComboboxItemProvider>\n );\n});\n\nComboboxItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_IMPL_NAME = 'ComboboxItemImpl';\n\ntype ComboboxItemImplElement = React.ElementRef<typeof Primitive.div>;\n\ninterface ItemImplProps extends PrimitiveDivProps {\n value: string;\n disabled?: boolean;\n}\n\nconst ComboboxItemImpl = React.forwardRef<ComboboxItemImplElement, ItemImplProps>((props, forwardedRef) => {\n const { value, disabled = false, ...restProps } = props;\n const itemRef = React.useRef<HTMLDivElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, itemRef);\n\n const { getItems } = useCollection(undefined);\n const { onTextValueChange, visuallyFocussedItem, ...context } = useComboboxContext(ITEM_NAME);\n const { isSelected, textValue, textId } = useComboboxItemContext(ITEM_IMPL_NAME);\n\n const handleSelect = () => {\n if (!disabled) {\n context.onValueChange(value);\n onTextValueChange(textValue);\n context.onOpenChange(false);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(textValue);\n }\n\n context.trigger?.focus({ preventScroll: true });\n }\n };\n\n const isFocused = React.useMemo(() => {\n return visuallyFocussedItem === getItems().find((item) => item.ref.current === itemRef.current)?.ref.current;\n }, [getItems, visuallyFocussedItem]);\n\n const id = useId();\n\n return (\n <Primitive.div\n role=\"option\"\n aria-labelledby={textId}\n data-highlighted={isFocused ? '' : undefined}\n // `isFocused` caveat fixes stuttering in VoiceOver\n aria-selected={isSelected && isFocused}\n data-state={isSelected ? 'checked' : 'unchecked'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n {...restProps}\n id={id}\n ref={composedRefs}\n onPointerUp={composeEventHandlers(restProps.onPointerUp, handleSelect)}\n />\n );\n});\n\nComboboxItemImpl.displayName = ITEM_IMPL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'ComboboxItemText';\n\ntype PrimitiveSpanProps = ComponentPropsWithoutRef<typeof Primitive.span>;\ntype ItemTextProps = PrimitiveSpanProps;\n\nconst ComboboxItemText = React.forwardRef<HTMLSpanElement, ItemTextProps>((props, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { className: _unusedClassName, style: _unusedStyle, ...itemTextProps } = props;\n const itemContext = useComboboxItemContext(ITEM_TEXT_NAME);\n const composedRefs = useComposedRefs(forwardedRef, itemContext.onTextValueChange);\n\n return <Primitive.span id={itemContext.textId} {...itemTextProps} ref={composedRefs} />;\n});\n\nComboboxItemText.displayName = ITEM_TEXT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'ComboboxItemIndicator';\ntype ItemIndicatorProps = PrimitiveSpanProps;\n\nconst ComboboxItemIndicator = React.forwardRef<HTMLSpanElement, ItemIndicatorProps>((props, forwardedRef) => {\n const { isSelected } = useComboboxItemContext(ITEM_INDICATOR_NAME);\n\n return isSelected ? <Primitive.span aria-hidden {...props} ref={forwardedRef} /> : null;\n});\n\nComboboxItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxNoValueFound\n * -----------------------------------------------------------------------------------------------*/\n\nconst NO_VALUE_FOUND_NAME = 'ComboboxNoValueFound';\n\ntype NoValueFoundProps = PrimitiveDivProps;\n\nconst ComboboxNoValueFound = React.forwardRef<HTMLDivElement, NoValueFoundProps>((props, ref) => {\n const {\n textValue = '',\n filterValue = '',\n visible = false,\n locale,\n autocomplete,\n } = useComboboxContext(NO_VALUE_FOUND_NAME);\n const [items, setItems] = React.useState<CollectionData[]>([]);\n const { subscribe } = useCollection(undefined);\n\n const { startsWith, contains } = useFilter(locale, { sensitivity: 'base' });\n\n /**\n * We need to use a subscription here so we know *exactly*\n * what items are in the collection whenever they update\n */\n React.useEffect(() => {\n const unsub = subscribe((state) => {\n // Filter out the input value unless it's explicitly required for \"creatable\" options\n if (visible) {\n const filteredItems = state.filter((item) => item.type !== 'create');\n setItems(filteredItems);\n } else {\n setItems(state);\n }\n });\n\n return () => {\n unsub();\n };\n }, [visible, subscribe]);\n\n if (autocomplete.type === 'none' && items.length > 0) return null;\n\n if (\n autocomplete.type === 'list' &&\n autocomplete.filter === 'startsWith' &&\n items.some((item) => startsWith(item.textValue, textValue))\n ) {\n return null;\n }\n\n if (autocomplete.type === 'both' && items.some((item) => startsWith(item.textValue, filterValue))) {\n return null;\n }\n\n if (\n autocomplete.type === 'list' &&\n autocomplete.filter === 'contains' &&\n items.some((item) => contains(item.textValue, textValue))\n ) {\n return null;\n }\n\n return <Primitive.div {...props} ref={ref} />;\n});\n\nComboboxNoValueFound.displayName = NO_VALUE_FOUND_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * ComboboxCreateItem\n * -----------------------------------------------------------------------------------------------*/\n\ninterface CreateItemProps extends PrimitiveDivProps {\n disabled?: boolean;\n}\n\nconst ComboboxCreateItem = React.forwardRef<ComboboxItemElement, CreateItemProps>((props, ref) => {\n const { disabled = false, ...restProps } = props;\n const context = useComboboxContext(NO_VALUE_FOUND_NAME);\n const { textValue, visuallyFocussedItem } = context;\n const { getItems, subscribe } = useCollection(undefined);\n const itemRef = React.useRef<HTMLDivElement>(null);\n const [show, setShow] = React.useState(false);\n\n const composedRefs = useComposedRefs(ref, itemRef);\n\n const isFocused = React.useMemo(() => {\n return visuallyFocussedItem === getItems().find((item) => item.ref.current === itemRef.current)?.ref.current;\n }, [getItems, visuallyFocussedItem]);\n\n const id = useId();\n\n const handleSelect = () => {\n if (!disabled && textValue) {\n context.onValueChange(textValue);\n context.onTextValueChange(textValue);\n context.onOpenChange(false);\n\n if (context.autocomplete.type === 'both') {\n context.onFilterValueChange(textValue);\n }\n\n context.trigger?.focus({ preventScroll: true });\n }\n };\n\n useLayoutEffect(() => {\n const unsub = subscribe((state) => {\n setShow(!state.some((item) => item.textValue === textValue && item.type !== 'create'));\n });\n\n if (getItems().length === 0) {\n setShow(true);\n }\n\n return () => {\n unsub();\n };\n }, [textValue, subscribe, getItems]);\n\n if ((!textValue || !show) && !context.visible) {\n return null;\n }\n\n return (\n <Collection.ItemSlot\n scope={undefined}\n value={textValue ?? ''}\n textValue={textValue ?? ''}\n disabled={disabled}\n isVisible\n type=\"create\"\n >\n <Primitive.div\n role=\"option\"\n tabIndex={disabled ? undefined : -1}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n data-highlighted={isFocused ? '' : undefined}\n {...restProps}\n id={id}\n ref={composedRefs}\n onPointerUp={composeEventHandlers(restProps.onPointerUp, handleSelect)}\n />\n </Collection.ItemSlot>\n );\n});\n\nComboboxCreateItem.displayName = 'ComboboxCreateItem';\n\nconst Root = Combobox;\nconst Trigger = ComboboxTrigger;\nconst TextInput = ComboxboxTextInput;\nconst Icon = ComboboxIcon;\nconst Portal = ComboboxPortal;\nconst Content = ComboboxContent;\nconst Viewport = ComboboxViewport;\nconst Item = ComboboxItem;\nconst ItemText = ComboboxItemText;\nconst ItemIndicator = ComboboxItemIndicator;\nconst NoValueFound = ComboboxNoValueFound;\nconst CreateItem = ComboboxCreateItem;\n\nexport {\n Root,\n Trigger,\n TextInput,\n Icon,\n Portal,\n Content,\n Viewport,\n Item,\n ItemText,\n ItemIndicator,\n NoValueFound,\n CreateItem,\n};\n\nexport type {\n RootProps,\n TriggerProps,\n TextInputProps,\n IconProps,\n PortalProps,\n ContentProps,\n ViewportProps,\n ItemProps,\n ItemTextProps,\n ItemIndicatorProps,\n NoValueFoundProps,\n CreateItemProps,\n Autocomplete,\n AutocompleteObject,\n};\n\n/**\n * Given two strings find the exact index of the character that changed\n */\nfunction findChangedIndex(a: string, b: string) {\n const length = Math.min(a.length, b.length);\n\n for (let i = 0; i < length; i++) {\n if (a[i] !== b[i]) {\n return i;\n }\n }\n\n return length;\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nfunction useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T {\n const callbackRef = React.useRef(callback);\n\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n\n // https://github.com/facebook/react/issues/19240\n return React.useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);\n}\n\nexport { useCallbackRef };\n","/**\n * We've forked this from RadixUI to add primarily support for multi-select.\n * This is on their roadmap https://github.com/radix-ui/primitives/issues/1193\n *\n * The changes are dotted around the codebase but all linked to a primary objective:\n * 1. The Select `value` can now be a string or an array of strings\n * 2. The Select `onValueChange` callback now receives a string or an array of strings\n *\n * Therefore, anywhere you see code handling values. It will accept and manage `string | string[]`,\n * thankfully Typescript is very helpful with this.\n *\n * Hopefully in the future we can remove this fork ✌🏼\n */\n\nimport * as React from 'react';\n\nimport { clamp } from '@radix-ui/number';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createCollection } from '@radix-ui/react-collection';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useDirection } from '@radix-ui/react-direction';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\nimport { useFocusGuards } from '@radix-ui/react-focus-guards';\nimport { FocusScope } from '@radix-ui/react-focus-scope';\nimport { useId } from '@radix-ui/react-id';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal as PortalPrimitive } from '@radix-ui/react-portal';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\nimport { usePrevious } from '@radix-ui/react-use-previous';\nimport { VisuallyHidden } from '@radix-ui/react-visually-hidden';\nimport { hideOthers } from 'aria-hidden';\nimport * as ReactDOM from 'react-dom';\nimport { RemoveScroll } from 'react-remove-scroll';\n\nimport { useCallbackRef } from '../../hooks/useCallbackRef';\n\nimport type { Scope } from '@radix-ui/react-context';\nimport type * as Radix from '@radix-ui/react-primitive';\n\ntype Direction = 'ltr' | 'rtl';\n\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\nconst SELECTION_KEYS = [' ', 'Enter'];\n\n/* -------------------------------------------------------------------------------------------------\n * Select\n * -----------------------------------------------------------------------------------------------*/\n\nconst SELECT_NAME = 'Select';\n\ntype ItemData = { value: string | string[]; disabled: boolean; textValue: string };\nconst [Collection, useCollection, createCollectionScope] = createCollection<SelectItemElement, ItemData>(SELECT_NAME);\n\ntype ScopedProps<P> = P & { __scopeSelect?: Scope };\nconst [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [\n createCollectionScope,\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ninterface SelectContextValue {\n trigger: SelectTriggerElement | null;\n onTriggerChange(node: SelectTriggerElement | null): void;\n valueNode: SelectValueElement | null;\n onValueNodeChange(node: SelectValueElement): void;\n valueNodeHasChildren: boolean;\n onValueNodeHasChildrenChange(hasChildren: boolean): void;\n contentId: string;\n open: boolean;\n required?: boolean;\n onOpenChange(open: boolean): void;\n dir: SelectProps['dir'];\n triggerPointerDownPosRef: React.MutableRefObject<{ x: number; y: number } | null>;\n disabled?: boolean;\n value?: string | string[];\n onValueChange(value: string | string[]): void;\n multi: boolean;\n}\n\nconst [SelectProvider, useSelectContext] = createSelectContext<SelectContextValue>(SELECT_NAME);\n\ntype NativeOption = React.ReactElement<React.ComponentProps<'option'>>;\n\ntype SelectNativeOptionsContextValue = {\n onNativeOptionAdd(option: NativeOption): void;\n onNativeOptionRemove(option: NativeOption): void;\n};\nconst [SelectNativeOptionsProvider, useSelectNativeOptionsContext] =\n createSelectContext<SelectNativeOptionsContextValue>(SELECT_NAME);\n\ninterface SharedSelectProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?(open: boolean): void;\n dir?: Direction;\n name?: string;\n autoComplete?: string;\n disabled?: boolean;\n required?: boolean;\n}\n\ninterface SingleSelectProps extends SharedSelectProps {\n onValueChange?(value: string): void;\n value?: string;\n defaultValue?: string;\n multi?: false;\n}\n\ninterface MultiSelectProps extends SharedSelectProps {\n onValueChange?(value: string[]): void;\n value?: string[];\n defaultValue?: string[];\n multi: true;\n}\n\ntype SelectProps = SingleSelectProps | MultiSelectProps;\n\nconst Select = (props: ScopedProps<SelectProps>) => {\n const {\n __scopeSelect,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n value: valueProp,\n defaultValue,\n onValueChange,\n dir,\n // name,\n // autoComplete,\n disabled,\n required,\n multi = false,\n } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const [trigger, setTrigger] = React.useState<SelectTriggerElement | null>(null);\n const [valueNode, setValueNode] = React.useState<SelectValueElement | null>(null);\n const [valueNodeHasChildren, setValueNodeHasChildren] = React.useState(false);\n const direction = useDirection(dir);\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [value, setValue] = useControllableState<string | string[]>({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange(value: string | string[]) {\n if (onValueChange) {\n if (Array.isArray(value)) {\n // @ts-expect-error the type for `onValueChange` is a join of the possible types, this should be fixed...\n onValueChange(value);\n } else {\n // @ts-expect-error the type for `onValueChange` is a join of the possible types, this should be fixed...\n onValueChange(value);\n }\n }\n },\n });\n\n const triggerPointerDownPosRef = React.useRef<{ x: number; y: number } | null>(null);\n\n // We set this to true by default so that events bubble to forms without JS (SSR)\n const [_nativeOptionsSet, setNativeOptionsSet] = React.useState(new Set<NativeOption>());\n\n // The native `select` only associates the correct default value if the corresponding\n // `option` is rendered as a child **at the same time** as itself.\n // Because it might take a few renders for our items to gather the information to build\n // the native `option`(s), we generate a key on the `select` to make sure React re-builds it\n // each time the options change.\n // const nativeSelectKey = Array.from(nativeOptionsSet)\n // .map((option) => option.props.value)\n // .join(';');\n\n return (\n <PopperPrimitive.Root {...popperScope}>\n <SelectProvider\n required={required}\n scope={__scopeSelect}\n trigger={trigger}\n onTriggerChange={setTrigger}\n valueNode={valueNode}\n onValueNodeChange={setValueNode}\n valueNodeHasChildren={valueNodeHasChildren}\n onValueNodeHasChildrenChange={setValueNodeHasChildren}\n contentId={useId()}\n value={value}\n onValueChange={setValue}\n open={open}\n onOpenChange={setOpen}\n dir={direction}\n triggerPointerDownPosRef={triggerPointerDownPosRef}\n disabled={disabled}\n multi={multi}\n >\n <Collection.Provider scope={__scopeSelect}>\n <SelectNativeOptionsProvider\n scope={props.__scopeSelect}\n onNativeOptionAdd={React.useCallback((option) => {\n setNativeOptionsSet((prev) => new Set(prev).add(option));\n }, [])}\n onNativeOptionRemove={React.useCallback((option) => {\n setNativeOptionsSet((prev) => {\n const optionsSet = new Set(prev);\n optionsSet.delete(option);\n\n return optionsSet;\n });\n }, [])}\n >\n {children}\n </SelectNativeOptionsProvider>\n </Collection.Provider>\n {/* {isFormControl ? (\n <BubbleSelect\n key={nativeSelectKey}\n aria-hidden\n required={required}\n tabIndex={-1}\n name={name}\n autoComplete={autoComplete}\n value={value}\n // enable form autofill\n onChange={(event) => setValue(event.target.value)}\n disabled={disabled}\n >\n {value === undefined ? <option value=\"\" /> : null}\n {Array.from(nativeOptionsSet)}\n </BubbleSelect>\n ) : null} */}\n </SelectProvider>\n </PopperPrimitive.Root>\n );\n};\n\nSelect.displayName = SELECT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'SelectTrigger';\n\ntype SelectTriggerElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ntype SelectTriggerProps = PrimitiveButtonProps;\n\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props: ScopedProps<SelectTriggerProps>, forwardedRef) => {\n const { __scopeSelect, ...triggerProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(TRIGGER_NAME, __scopeSelect);\n const isDisabled = context.disabled;\n const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);\n const getItems = useCollection(__scopeSelect);\n\n const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.value === context.value);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n\n if (nextItem !== undefined && !Array.isArray(nextItem.value)) {\n const newValue = context.multi ? [nextItem.value] : nextItem.value;\n context.onValueChange(newValue);\n }\n });\n\n const handleOpen = () => {\n if (!isDisabled) {\n context.onOpenChange(true);\n // reset typeahead when we open\n resetTypeahead();\n }\n };\n\n /**\n * The `combobox` was a `button` element, instead it is now a `div` element\n * this avoids events issues with nesting the DesignSystem Tags inside the Select Trigger\n */\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.div\n role=\"combobox\"\n aria-controls={context.contentId}\n aria-expanded={context.open}\n aria-required={context.required}\n aria-autocomplete=\"none\"\n dir={context.dir}\n data-state={context.open ? 'open' : 'closed'}\n data-disabled={isDisabled ? '' : undefined}\n data-placeholder={context.value === undefined ? '' : undefined}\n tabIndex={isDisabled ? undefined : 0}\n {...triggerProps}\n ref={composedRefs}\n // Enable compatibility with native label or custom `Label` \"click\" for Safari:\n onClick={composeEventHandlers(triggerProps.onClick, (event) => {\n // Whilst browsers generally have no issue focusing the trigger when clicking\n // on a label, Safari seems to struggle with the fact that there's no `onClick`.\n // We force `focus` in this case. Note: this doesn't create any other side-effect\n // because we are preventing default in `onPointerDown` so effectively\n // this only runs for a label \"click\"\n event.currentTarget.focus();\n })}\n onPointerDown={composeEventHandlers(triggerProps.onPointerDown, (event) => {\n // prevent implicit pointer capture\n // https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture\n const target = event.target as HTMLElement;\n\n if (target.hasPointerCapture(event.pointerId)) {\n target.releasePointerCapture(event.pointerId);\n }\n\n /**\n * This has been added to allow events inside the trigger to be easily fired\n * e.g. the clear button or removing a tag\n */\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)\n // but not when the control key is pressed (avoiding MacOS right click)\n if (event.button === 0 && event.ctrlKey === false) {\n handleOpen();\n context.triggerPointerDownPosRef.current = {\n x: Math.round(event.pageX),\n y: Math.round(event.pageY),\n };\n // prevent trigger from stealing focus from the active item after opening.\n event.preventDefault();\n }\n })}\n onKeyDown={composeEventHandlers(triggerProps.onKeyDown, (event) => {\n const isTypingAhead = searchRef.current !== '';\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n const target = event.target as HTMLElement;\n\n const buttonTarg = target.closest('button') ?? target.closest('div');\n\n if (buttonTarg !== event.currentTarget) {\n return;\n }\n\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n\n if (isTypingAhead && event.key === ' ') return;\n\n if (OPEN_KEYS.includes(event.key)) {\n handleOpen();\n event.preventDefault();\n }\n })}\n />\n </PopperPrimitive.Anchor>\n );\n },\n);\n\nSelectTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectValue\n * -----------------------------------------------------------------------------------------------*/\n\nconst VALUE_NAME = 'SelectValue';\n\ntype SelectValueElement = React.ElementRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = Radix.ComponentPropsWithoutRef<typeof Primitive.span>;\ntype SelectValueRenderFn = {\n ({ value, textValue }: { value?: string; textValue?: string }): React.ReactNode;\n (value?: string): React.ReactNode;\n};\ninterface SelectValueProps extends Omit<PrimitiveSpanProps, 'placeholder' | 'children'> {\n placeholder?: React.ReactNode;\n children?: React.ReactNode | SelectValueRenderFn;\n}\n\nconst SelectValue = React.forwardRef<SelectValueElement, SelectValueProps>(\n (props: ScopedProps<SelectValueProps>, forwardedRef) => {\n const { __scopeSelect, children, placeholder, ...valueProps } = props;\n const context = useSelectContext(VALUE_NAME, __scopeSelect);\n const { onValueNodeHasChildrenChange } = context;\n const hasChildren = children !== undefined;\n const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);\n const [valuedItems, setValuedItems] = React.useState<ItemData[]>([]);\n\n const getItems = useCollection(__scopeSelect);\n\n useLayoutEffect(() => {\n onValueNodeHasChildrenChange(hasChildren);\n }, [onValueNodeHasChildrenChange, hasChildren]);\n\n /**\n * SelectValue can now receive a function as a child. This allows\n * us to render the Tags inside the Trigger based on the item values\n *\n * Because of the imperative nature of `getItems` we store the items in state\n * based on changes to the select value, if an item's value is in `getItems`\n * it's essentially memoized for the render function.\n */\n\n React.useLayoutEffect(() => {\n if (Array.isArray(context.value) && valuedItems.length !== context.value.length) {\n const timeout = setTimeout(() => {\n const valuedItems = getItems().filter((item) =>\n !Array.isArray(item.value) ? context.value?.includes(item.value) : false,\n );\n\n setValuedItems(valuedItems);\n });\n\n return () => {\n clearTimeout(timeout);\n };\n }\n }, [context.value, getItems, valuedItems]);\n\n let renderValue: React.ReactNode;\n\n if ((context.value === undefined || context.value.length === 0) && placeholder !== undefined) {\n renderValue = <span>{placeholder}</span>;\n } else if (typeof children === 'function') {\n if (Array.isArray(context.value)) {\n const childrenArray = context.value.map((value) => {\n const valueItem = valuedItems.find((item) => item.value === value);\n\n if (!valueItem) {\n return null;\n }\n\n return children({ value, textValue: valueItem?.textValue });\n });\n\n renderValue = childrenArray.every((child) => child === null) ? placeholder : childrenArray;\n } else {\n renderValue = children(context.value);\n }\n } else {\n renderValue = children;\n }\n\n /**\n * Wrap the renderValue in it's own span so react knows to re-render this.\n * Otherwise it will render the incorrect thing on clear nothing.\n */\n return (\n <Primitive.span {...valueProps} ref={composedRefs}>\n {renderValue || null}\n </Primitive.span>\n );\n },\n);\n\nSelectValue.displayName = VALUE_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectIcon\n * -----------------------------------------------------------------------------------------------*/\n\nconst ICON_NAME = 'SelectIcon';\n\ntype SelectIconElement = React.ElementRef<typeof Primitive.span>;\ntype SelectIconProps = PrimitiveSpanProps;\n\nconst SelectIcon = React.forwardRef<SelectIconElement, SelectIconProps>(\n (props: ScopedProps<SelectIconProps>, forwardedRef) => {\n const { __scopeSelect, children, ...iconProps } = props;\n\n return (\n <Primitive.span aria-hidden {...iconProps} ref={forwardedRef}>\n {children || '▼'}\n </Primitive.span>\n );\n },\n);\n\nSelectIcon.displayName = ICON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'SelectPortal';\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof PortalPrimitive>;\ninterface SelectPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n}\n\nconst SelectPortal = (props: ScopedProps<SelectPortalProps>) => {\n return <PortalPrimitive asChild {...props} />;\n};\n\nSelectPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'SelectContent';\n\ntype SelectContentElement = SelectContentImplElement;\ntype SelectContentProps = SelectContentImplProps;\n\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props: ScopedProps<SelectContentProps>, forwardedRef) => {\n const context = useSelectContext(CONTENT_NAME, props.__scopeSelect);\n const [fragment, setFragment] = React.useState<DocumentFragment>();\n\n // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server\n useLayoutEffect(() => {\n setFragment(new DocumentFragment());\n }, []);\n\n if (!context.open) {\n const frag = fragment as Element | undefined;\n\n return frag\n ? ReactDOM.createPortal(\n <SelectContentProvider scope={props.__scopeSelect}>\n <Collection.Slot scope={props.__scopeSelect}>\n <div>{props.children}</div>\n </Collection.Slot>\n </SelectContentProvider>,\n frag,\n )\n : null;\n }\n\n return <SelectContentImpl {...props} ref={forwardedRef} />;\n },\n);\n\nSelectContent.displayName = CONTENT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectContentImpl\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_MARGIN = 10;\n\ntype SelectContentContextValue = {\n content?: SelectContentElement | null;\n viewport?: SelectViewportElement | null;\n onViewportChange?: (node: SelectViewportElement | null) => void;\n itemRefCallback?: (node: SelectItemElement | null, value: string | string[], disabled: boolean) => void;\n selectedItem?: SelectItemElement | null;\n onItemLeave?: () => void;\n itemTextRefCallback?: (node: SelectItemTextElement | null, value: string | string[], disabled: boolean) => void;\n focusSelectedItem?: () => void;\n selectedItemText?: SelectItemTextElement | null;\n position?: SelectContentProps['position'];\n isPositioned?: boolean;\n searchRef?: React.RefObject<string>;\n};\n\nconst [SelectContentProvider, useSelectContentContext] = createSelectContext<SelectContentContextValue>(CONTENT_NAME);\n\nconst CONTENT_IMPL_NAME = 'SelectContentImpl';\n\ntype SelectContentImplElement = SelectPopperPositionElement | SelectItemAlignedPositionElement;\ntype DismissableLayerProps = React.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype FocusScopeProps = Radix.ComponentPropsWithoutRef<typeof FocusScope>;\n\ntype SelectPopperPrivateProps = { onPlaced?: PopperContentProps['onPlaced'] };\n\ninterface SelectContentImplProps\n extends Omit<SelectPopperPositionProps, keyof SelectPopperPrivateProps>,\n Omit<SelectItemAlignedPositionProps, keyof SelectPopperPrivateProps> {\n /**\n * Event handler called when auto-focusing on close.\n * Can be prevented.\n */\n onCloseAutoFocus?: FocusScopeProps['onUnmountAutoFocus'];\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `DismissableLayer`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n\n position?: 'item-aligned' | 'popper';\n}\n\nconst SelectContentImpl = React.forwardRef<SelectContentImplElement, SelectContentImplProps>(\n (props: ScopedProps<SelectContentImplProps>, forwardedRef) => {\n const {\n __scopeSelect,\n position = 'item-aligned',\n onCloseAutoFocus,\n onEscapeKeyDown,\n onPointerDownOutside,\n //\n // PopperContent props\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n //\n ...contentProps\n } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const [content, setContent] = React.useState<SelectContentImplElement | null>(null);\n const [viewport, setViewport] = React.useState<SelectViewportElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const [selectedItem, setSelectedItem] = React.useState<SelectItemElement | null>(null);\n const [selectedItemText, setSelectedItemText] = React.useState<SelectItemTextElement | null>(null);\n const getItems = useCollection(__scopeSelect);\n const [isPositioned, setIsPositioned] = React.useState(false);\n const firstValidItemFoundRef = React.useRef(false);\n\n // aria-hide everything except the content (better supported equivalent to setting aria-modal)\n React.useEffect(() => {\n if (content) return hideOthers(content);\n }, [content]);\n\n // Make sure the whole tree has focus guards as our `Select` may be\n // the last element in the DOM (because of the `Portal`)\n useFocusGuards();\n\n const focusFirst = React.useCallback(\n (candidates: Array<HTMLElement | null>) => {\n const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);\n const [lastItem] = restItems.slice(-1);\n\n const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;\n // eslint-disable-next-line no-restricted-syntax\n for (const candidate of candidates) {\n // if focus is already where we want to go, we don't want to keep going through the candidates\n if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;\n candidate?.scrollIntoView({ block: 'nearest' });\n\n // viewport might have padding so scroll to its edges when focusing first/last items.\n if (candidate === firstItem && viewport) viewport.scrollTop = 0;\n\n if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;\n\n candidate?.focus();\n\n if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;\n }\n },\n [getItems, viewport],\n );\n\n const focusSelectedItem = React.useCallback(\n () => focusFirst([selectedItem, content]),\n [focusFirst, selectedItem, content],\n );\n\n // Since this is not dependent on layout, we want to ensure this runs at the same time as\n // other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.\n React.useEffect(() => {\n if (isPositioned) {\n focusSelectedItem();\n }\n }, [isPositioned, focusSelectedItem]);\n\n // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`\n // and close on `pointerup` outside.\n const { onOpenChange, triggerPointerDownPosRef } = context;\n React.useEffect(() => {\n if (content) {\n let pointerMoveDelta = { x: 0, y: 0 };\n\n const handlePointerMove = (event: PointerEvent) => {\n pointerMoveDelta = {\n x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),\n y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0)),\n };\n };\n const handlePointerUp = (event: PointerEvent) => {\n // If the pointer hasn't moved by a certain threshold then we prevent selecting item on `pointerup`.\n if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {\n event.preventDefault();\n } else if (!content.contains(event.target as HTMLElement)) {\n // otherwise, if the event was outside the content, close.\n onOpenChange(false);\n }\n document.removeEventListener('pointermove', handlePointerMove);\n triggerPointerDownPosRef.current = null;\n };\n\n if (triggerPointerDownPosRef.current !== null) {\n document.addEventListener('pointermove', handlePointerMove);\n document.addEventListener('pointerup', handlePointerUp, { capture: true, once: true });\n }\n\n return () => {\n document.removeEventListener('pointermove', handlePointerMove);\n document.removeEventListener('pointerup', handlePointerUp, { capture: true });\n };\n }\n }, [content, onOpenChange, triggerPointerDownPosRef]);\n\n React.useEffect(() => {\n const close = () => onOpenChange(false);\n window.addEventListener('blur', close);\n window.addEventListener('resize', close);\n\n return () => {\n window.removeEventListener('blur', close);\n window.removeEventListener('resize', close);\n };\n }, [onOpenChange]);\n\n const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {\n const enabledItems = getItems().filter((item) => !item.disabled);\n const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);\n const nextItem = findNextItem(enabledItems, search, currentItem);\n\n if (nextItem) {\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => (nextItem.ref.current as HTMLElement).focus());\n }\n });\n\n const itemRefCallback = React.useCallback(\n (node: SelectItemElement | null, value: string | string[], disabled: boolean) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem = context.value !== undefined && context.value === value;\n\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItem(node);\n\n if (isFirstValidItem) firstValidItemFoundRef.current = true;\n }\n },\n [context.value],\n );\n const handleItemLeave = React.useCallback(() => content?.focus(), [content]);\n const itemTextRefCallback = React.useCallback(\n (node: SelectItemTextElement | null, value: string | string[], disabled: boolean) => {\n const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;\n const isSelectedItem =\n context.value !== undefined &&\n (Array.isArray(value) ? value.every((v) => context.value?.includes(v)) : context.value === value);\n\n if (isSelectedItem || isFirstValidItem) {\n setSelectedItemText(node);\n }\n },\n [context.value],\n );\n\n const SelectPosition = position === 'popper' ? SelectPopperPosition : SelectItemAlignedPosition;\n\n // Silently ignore props that are not supported by `SelectItemAlignedPosition`\n const popperContentProps =\n SelectPosition === SelectPopperPosition\n ? {\n side,\n sideOffset,\n align,\n alignOffset,\n arrowPadding,\n collisionBoundary,\n collisionPadding,\n sticky,\n hideWhenDetached,\n avoidCollisions,\n }\n : {};\n\n return (\n <SelectContentProvider\n scope={__scopeSelect}\n content={content}\n viewport={viewport}\n onViewportChange={setViewport}\n itemRefCallback={itemRefCallback}\n selectedItem={selectedItem}\n onItemLeave={handleItemLeave}\n itemTextRefCallback={itemTextRefCallback}\n focusSelectedItem={focusSelectedItem}\n selectedItemText={selectedItemText}\n position={position}\n isPositioned={isPositioned}\n searchRef={searchRef}\n >\n <RemoveScroll as={Slot} allowPinchZoom>\n <FocusScope\n asChild\n // we make sure we're not trapping once it's been closed\n // (closed !== unmounted when animating out)\n trapped={context.open}\n onMountAutoFocus={(event) => {\n // we prevent open autofocus because we manually focus the selected item\n event.preventDefault();\n }}\n onUnmountAutoFocus={composeEventHandlers(onCloseAutoFocus, (event) => {\n context.trigger?.focus({ preventScroll: true });\n /**\n * In firefox there's a some kind of selection happening after\n * unmounting all of this, so we make sure we clear that.\n */\n document.getSelection()?.empty();\n event.preventDefault();\n })}\n >\n <DismissableLayer\n asChild\n disableOutsidePointerEvents\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n // When focus is trapped, a focusout event may still happen.\n // We make sure we don't trigger our `onDismiss` in such case.\n onFocusOutside={(event) => event.preventDefault()}\n onDismiss={() => context.onOpenChange(false)}\n >\n <SelectPosition\n role=\"listbox\"\n id={context.contentId}\n data-state={context.open ? 'open' : 'closed'}\n aria-multiselectable={context.multi ? 'true' : undefined}\n dir={context.dir}\n onContextMenu={(event) => event.preventDefault()}\n {...contentProps}\n {...popperContentProps}\n onPlaced={() => setIsPositioned(true)}\n ref={composedRefs}\n style={{\n // flex layout so we can place the scroll buttons properly\n display: 'flex',\n flexDirection: 'column',\n // reset the outline by default as the content MAY get focused\n outline: 'none',\n ...contentProps.style,\n }}\n onKeyDown={composeEventHandlers(contentProps.onKeyDown, (event) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n\n // select should not be navigated using tab key so we prevent it\n if (event.key === 'Tab') event.preventDefault();\n\n if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);\n\n if (['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) {\n const items = getItems().filter((item) => !item.disabled);\n let candidateNodes = items.map((item) => item.ref.current!);\n\n if (['ArrowUp', 'End'].includes(event.key)) {\n candidateNodes = candidateNodes.slice().reverse();\n }\n if (['ArrowUp', 'ArrowDown'].includes(event.key)) {\n const currentElement = event.target as SelectItemElement;\n const currentIndex = candidateNodes.indexOf(currentElement);\n candidateNodes = candidateNodes.slice(currentIndex + 1);\n }\n\n /**\n * Imperative focus during keydown is risky so we prevent React's batching updates\n * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332\n */\n setTimeout(() => focusFirst(candidateNodes));\n\n event.preventDefault();\n }\n })}\n />\n </DismissableLayer>\n </FocusScope>\n </RemoveScroll>\n </SelectContentProvider>\n );\n },\n);\n\nSelectContentImpl.displayName = CONTENT_IMPL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemAlignedPosition\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_ALIGNED_POSITION_NAME = 'SelectItemAlignedPosition';\n\ntype SelectItemAlignedPositionElement = React.ElementRef<typeof Primitive.div>;\ninterface SelectItemAlignedPositionProps extends PrimitiveDivProps, SelectPopperPrivateProps {}\n\nconst SelectItemAlignedPosition = React.forwardRef<SelectItemAlignedPositionElement, SelectItemAlignedPositionProps>(\n (props: ScopedProps<SelectItemAlignedPositionProps>, forwardedRef) => {\n const { __scopeSelect, onPlaced, ...popperProps } = props;\n const context = useSelectContext(CONTENT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(CONTENT_NAME, __scopeSelect);\n const [contentWrapper, setContentWrapper] = React.useState<HTMLDivElement | null>(null);\n const [content, setContent] = React.useState<SelectItemAlignedPositionElement | null>(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));\n const getItems = useCollection(__scopeSelect);\n const shouldExpandOnScrollRef = React.useRef(false);\n const shouldRepositionRef = React.useRef(true);\n\n const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;\n const position = React.useCallback(() => {\n if (\n context.trigger &&\n context.valueNode &&\n contentWrapper &&\n content &&\n viewport &&\n selectedItem &&\n selectedItemText\n ) {\n const triggerRect = context.trigger.getBoundingClientRect();\n\n // -----------------------------------------------------------------------------------------\n // Horizontal positioning\n // -----------------------------------------------------------------------------------------\n const contentRect = content.getBoundingClientRect();\n const valueNodeRect = context.valueNode.getBoundingClientRect();\n const itemTextRect = selectedItemText.getBoundingClientRect();\n\n if (context.dir !== 'rtl') {\n const itemTextOffset = itemTextRect.left - contentRect.left;\n const left = valueNodeRect.left - itemTextOffset;\n const leftDelta = triggerRect.left - left;\n const minContentWidth = triggerRect.width + leftDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const rightEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedLeft = clamp(left, [CONTENT_MARGIN, rightEdge - contentWidth]);\n\n contentWrapper.style.minWidth = `${minContentWidth}px`;\n contentWrapper.style.left = `${clampedLeft}px`;\n } else {\n const itemTextOffset = contentRect.right - itemTextRect.right;\n const right = window.innerWidth - valueNodeRect.right - itemTextOffset;\n const rightDelta = window.innerWidth - triggerRect.right - right;\n const minContentWidth = triggerRect.width + rightDelta;\n const contentWidth = Math.max(minContentWidth, contentRect.width);\n const leftEdge = window.innerWidth - CONTENT_MARGIN;\n const clampedRight = clamp(right, [CONTENT_MARGIN, leftEdge - contentWidth]);\n\n contentWrapper.style.minWidth = `${minContentWidth}px`;\n contentWrapper.style.right = `${clampedRight}px`;\n }\n\n // -----------------------------------------------------------------------------------------\n // Vertical positioning\n // -----------------------------------------------------------------------------------------\n const items = getItems();\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const itemsHeight = viewport.scrollHeight;\n\n const contentStyles = window.getComputedStyle(content);\n const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);\n const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);\n const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);\n const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);\n const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth; // prettier-ignore\n const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);\n\n const viewportStyles = window.getComputedStyle(viewport);\n const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);\n const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);\n\n const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;\n const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;\n\n const selectedItemHalfHeight = selectedItem.offsetHeight / 2;\n const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;\n const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;\n const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;\n\n const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;\n\n if (willAlignWithoutTopOverflow) {\n const isLastItem = selectedItem === items[items.length - 1].ref.current;\n contentWrapper.style.bottom = `${0}px`;\n const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;\n const clampedTriggerMiddleToBottomEdge = Math.max(\n triggerMiddleToBottomEdge,\n selectedItemHalfHeight +\n // viewport might have padding bottom, include it to avoid a scrollable viewport\n (isLastItem ? viewportPaddingBottom : 0) +\n viewportOffsetBottom +\n contentBorderBottomWidth,\n );\n const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;\n contentWrapper.style.height = `${height}px`;\n } else {\n const isFirstItem = selectedItem === items[0].ref.current;\n contentWrapper.style.top = `${0}px`;\n const clampedTopEdgeToTriggerMiddle = Math.max(\n topEdgeToTriggerMiddle,\n contentBorderTopWidth +\n viewport.offsetTop +\n // viewport might have padding top, include it to avoid a scrollable viewport\n (isFirstItem ? viewportPaddingTop : 0) +\n selectedItemHalfHeight,\n );\n const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;\n contentWrapper.style.height = `${height}px`;\n viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;\n }\n\n contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;\n contentWrapper.style.minHeight = `${minContentHeight}px`;\n contentWrapper.style.maxHeight = `${availableHeight}px`;\n // -----------------------------------------------------------------------------------------\n\n onPlaced?.();\n\n // we don't want the initial scroll position adjustment to trigger \"expand on scroll\"\n // so we explicitly turn it on only after they've registered.\n requestAnimationFrame(() => (shouldExpandOnScrollRef.current = true));\n }\n }, [\n getItems,\n context.trigger,\n context.valueNode,\n contentWrapper,\n content,\n viewport,\n selectedItem,\n selectedItemText,\n context.dir,\n onPlaced,\n ]);\n\n useLayoutEffect(() => position(), [position]);\n\n // copy z-index from content to wrapper\n const [contentZIndex, setContentZIndex] = React.useState<string>();\n useLayoutEffect(() => {\n if (content) setContentZIndex(window.getComputedStyle(content).zIndex);\n }, [content]);\n\n // When the viewport becomes scrollable at the top, the scroll up button will mount.\n // Because it is part of the normal flow, it will push down the viewport, thus throwing our\n // trigger => selectedItem alignment off by the amount the viewport was pushed down.\n // We wait for this to happen and then re-run the positining logic one more time to account for it.\n const handleScrollButtonChange = React.useCallback(\n (node: SelectScrollButtonImplElement | null) => {\n if (node && shouldRepositionRef.current === true) {\n position();\n focusSelectedItem?.();\n shouldRepositionRef.current = false;\n }\n },\n [position, focusSelectedItem],\n );\n\n return (\n <SelectViewportProvider\n scope={__scopeSelect}\n contentWrapper={contentWrapper}\n shouldExpandOnScrollRef={shouldExpandOnScrollRef}\n onScrollButtonChange={handleScrollButtonChange}\n >\n <div\n ref={setContentWrapper}\n style={{\n display: 'flex',\n flexDirection: 'column',\n position: 'fixed',\n zIndex: contentZIndex,\n }}\n >\n <Primitive.div\n {...popperProps}\n ref={composedRefs}\n style={{\n // When we get the height of the content, it includes borders. If we were to set\n // the height without having `boxSizing: 'border-box'` it would be too big.\n boxSizing: 'border-box',\n // We need to ensure the content doesn't get taller than the wrapper\n maxHeight: '100%',\n ...popperProps.style,\n }}\n />\n </div>\n </SelectViewportProvider>\n );\n },\n);\n\nSelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectPopperPosition\n * -----------------------------------------------------------------------------------------------*/\n\nconst POPPER_POSITION_NAME = 'SelectPopperPosition';\n\ntype SelectPopperPositionElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype PopperContentProps = React.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface SelectPopperPositionProps extends PopperContentProps, SelectPopperPrivateProps {}\n\nconst SelectPopperPosition = React.forwardRef<SelectPopperPositionElement, SelectPopperPositionProps>(\n (props: ScopedProps<SelectPopperPositionProps>, forwardedRef) => {\n const { __scopeSelect, align = 'start', collisionPadding = CONTENT_MARGIN, ...popperProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n\n return (\n <PopperPrimitive.Content\n {...popperScope}\n {...popperProps}\n ref={forwardedRef}\n align={align}\n collisionPadding={collisionPadding}\n style={{\n // Ensure border-box for floating-ui calculations\n boxSizing: 'border-box',\n ...popperProps.style,\n // re-namespace exposed content custom properties\n ...{\n '--radix-select-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-select-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-select-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-select-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-select-trigger-height': 'var(--radix-popper-anchor-height)',\n },\n }}\n />\n );\n },\n);\n\nSelectPopperPosition.displayName = POPPER_POSITION_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectViewport\n * -----------------------------------------------------------------------------------------------*/\n\ntype SelectViewportContextValue = {\n contentWrapper?: HTMLDivElement | null;\n shouldExpandOnScrollRef?: React.RefObject<boolean>;\n onScrollButtonChange?: (node: SelectScrollButtonImplElement | null) => void;\n};\n\nconst [SelectViewportProvider, useSelectViewportContext] = createSelectContext<SelectViewportContextValue>(\n CONTENT_NAME,\n {},\n);\n\nconst VIEWPORT_NAME = 'SelectViewport';\n\ntype SelectViewportElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ntype SelectViewportProps = PrimitiveDivProps;\n\nconst SelectViewport = React.forwardRef<SelectViewportElement, SelectViewportProps>(\n (props: ScopedProps<SelectViewportProps>, forwardedRef) => {\n const { __scopeSelect, ...viewportProps } = props;\n const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);\n const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);\n const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);\n const prevScrollTopRef = React.useRef(0);\n\n return (\n <>\n {/* Hide scrollbars cross-browser and enable momentum scroll for touch devices */}\n <style\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`,\n }}\n />\n <Collection.Slot scope={__scopeSelect}>\n <Primitive.div\n data-radix-select-viewport=\"\"\n role=\"presentation\"\n {...viewportProps}\n ref={composedRefs}\n style={{\n // we use position: 'relative' here on the `viewport` so that when we call\n // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport\n // (independent of the scrollUpButton).\n position: 'relative',\n flex: 1,\n overflow: 'auto',\n ...viewportProps.style,\n }}\n onScroll={composeEventHandlers(viewportProps.onScroll, (event) => {\n const viewport = event.currentTarget;\n const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;\n\n if (shouldExpandOnScrollRef?.current && contentWrapper) {\n const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);\n\n if (scrolledBy > 0) {\n const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;\n const cssMinHeight = parseFloat(contentWrapper.style.minHeight);\n const cssHeight = parseFloat(contentWrapper.style.height);\n const prevHeight = Math.max(cssMinHeight, cssHeight);\n\n if (prevHeight < availableHeight) {\n const nextHeight = prevHeight + scrolledBy;\n const clampedNextHeight = Math.min(availableHeight, nextHeight);\n const heightDiff = nextHeight - clampedNextHeight;\n\n contentWrapper.style.height = `${clampedNextHeight}px`;\n\n if (contentWrapper.style.bottom === '0px') {\n viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;\n // ensure the content stays pinned to the bottom\n contentWrapper.style.justifyContent = 'flex-end';\n }\n }\n }\n }\n prevScrollTopRef.current = viewport.scrollTop;\n })}\n />\n </Collection.Slot>\n </>\n );\n },\n);\n\nSelectViewport.displayName = VIEWPORT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectGroup\n * -----------------------------------------------------------------------------------------------*/\n\nconst GROUP_NAME = 'SelectGroup';\n\ntype SelectGroupContextValue = { id: string };\n\nconst [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext<SelectGroupContextValue>(GROUP_NAME);\n\ntype SelectGroupElement = React.ElementRef<typeof Primitive.div>;\ntype SelectGroupProps = PrimitiveDivProps;\n\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n (props: ScopedProps<SelectGroupProps>, forwardedRef) => {\n const { __scopeSelect, ...groupProps } = props;\n const groupId = useId();\n\n return (\n <SelectGroupContextProvider scope={__scopeSelect} id={groupId}>\n <Primitive.div role=\"group\" aria-labelledby={groupId} {...groupProps} ref={forwardedRef} />\n </SelectGroupContextProvider>\n );\n },\n);\n\nSelectGroup.displayName = GROUP_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectLabel\n * -----------------------------------------------------------------------------------------------*/\n\nconst LABEL_NAME = 'SelectLabel';\n\ntype SelectLabelElement = React.ElementRef<typeof Primitive.div>;\ntype SelectLabelProps = PrimitiveDivProps;\n\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n (props: ScopedProps<SelectLabelProps>, forwardedRef) => {\n const { __scopeSelect, ...labelProps } = props;\n const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);\n\n return <Primitive.div id={groupContext.id} {...labelProps} ref={forwardedRef} />;\n },\n);\n\nSelectLabel.displayName = LABEL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItem\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_NAME = 'SelectItem';\n\ntype SelectItemContextValue = {\n value: string | string[];\n disabled: boolean;\n textId: string;\n isSelected: boolean;\n isIntermediate: boolean;\n onItemTextChange(node: SelectItemTextElement | null): void;\n};\n\nconst [SelectItemContextProvider, useSelectItemContext] = createSelectContext<SelectItemContextValue>(ITEM_NAME);\n\ntype SelectItemElement = React.ElementRef<typeof Primitive.div>;\ninterface SelectItemProps extends PrimitiveDivProps {\n value: string | string[];\n disabled?: boolean;\n textValue?: string;\n}\n\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>(\n (props: ScopedProps<SelectItemProps>, forwardedRef) => {\n const { __scopeSelect, value, disabled = false, textValue: textValueProp, ...itemProps } = props;\n const context = useSelectContext(ITEM_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);\n const isSelected =\n typeof value === 'string'\n ? Array.isArray(context.value)\n ? context.value.includes(value)\n : context.value === value\n : value.every((v) => context.value?.includes(v));\n\n const isIntermediate =\n Array.isArray(context.value) && Array.isArray(value) && value.some((v) => context.value?.includes(v));\n const [textValue, setTextValue] = React.useState(textValueProp ?? '');\n const [isFocused, setIsFocused] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, (node) =>\n contentContext.itemRefCallback?.(node, value, disabled),\n );\n const textId = useId();\n\n const handleSelect = () => {\n if (!disabled) {\n let newValue: string | string[] = context.multi && typeof value === 'string' ? [value] : value;\n\n if (isIntermediate && !isSelected) {\n context.onValueChange(newValue);\n } else if (Array.isArray(context.value)) {\n newValue = toggleArrayValue(value, context.value);\n }\n\n context.onValueChange(newValue);\n\n if (!context.multi) {\n context.onOpenChange(false);\n }\n }\n };\n\n if (!context.multi && Array.isArray(value)) {\n throw new Error('You can only pass an array of values in multi selects');\n }\n\n return (\n <SelectItemContextProvider\n scope={__scopeSelect}\n value={value}\n disabled={disabled}\n textId={textId}\n isSelected={isSelected}\n isIntermediate={isIntermediate}\n onItemTextChange={React.useCallback((node) => {\n setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? '').trim());\n }, [])}\n >\n <Collection.ItemSlot scope={__scopeSelect} value={value} disabled={disabled} textValue={textValue}>\n <Primitive.div\n role=\"option\"\n aria-labelledby={textId}\n data-highlighted={isFocused ? '' : undefined}\n // `isFocused` caveat fixes stuttering in VoiceOver\n aria-selected={!context.multi ? isSelected && isFocused : undefined}\n aria-checked={context.multi ? isSelected : undefined}\n data-state={isSelected ? 'checked' : 'unchecked'}\n aria-disabled={disabled || undefined}\n data-disabled={disabled ? '' : undefined}\n tabIndex={disabled ? undefined : -1}\n {...itemProps}\n ref={composedRefs}\n onFocus={composeEventHandlers(itemProps.onFocus, () => setIsFocused(true))}\n onBlur={composeEventHandlers(itemProps.onBlur, () => setIsFocused(false))}\n onPointerUp={composeEventHandlers(itemProps.onPointerUp, handleSelect)}\n onPointerMove={composeEventHandlers(itemProps.onPointerMove, (event) => {\n if (disabled) {\n contentContext.onItemLeave?.();\n } else {\n // even though safari doesn't support this option, it's acceptable\n // as it only means it might scroll a few pixels when using the pointer.\n event.currentTarget.focus({ preventScroll: true });\n }\n })}\n onPointerLeave={composeEventHandlers(itemProps.onPointerLeave, (event) => {\n if (event.currentTarget === document.activeElement) {\n contentContext.onItemLeave?.();\n }\n })}\n onKeyDown={composeEventHandlers(itemProps.onKeyDown, (event) => {\n const isTypingAhead = contentContext.searchRef?.current !== '';\n\n if (isTypingAhead && event.key === ' ') return;\n\n if (SELECTION_KEYS.includes(event.key)) handleSelect();\n\n // prevent page scroll if using the space key to select an item\n if (event.key === ' ') event.preventDefault();\n })}\n />\n </Collection.ItemSlot>\n </SelectItemContextProvider>\n );\n },\n);\n\nSelectItem.displayName = ITEM_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemText\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_TEXT_NAME = 'SelectItemText';\n\ntype SelectItemTextElement = React.ElementRef<typeof Primitive.span>;\ntype SelectItemTextProps = PrimitiveSpanProps;\n\nconst SelectItemText = React.forwardRef<SelectItemTextElement, SelectItemTextProps>(\n (props: ScopedProps<SelectItemTextProps>, forwardedRef) => {\n // We ignore `className` and `style` as this part shouldn't be styled.\n const { __scopeSelect, className: _className, style: _style, ...itemTextProps } = props;\n const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);\n const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);\n const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);\n const [itemTextNode, setItemTextNode] = React.useState<SelectItemTextElement | null>(null);\n const composedRefs = useComposedRefs(\n forwardedRef,\n (node) => setItemTextNode(node),\n itemContext.onItemTextChange,\n (node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled),\n );\n\n const textContent = itemTextNode?.textContent;\n const nativeOption = React.useMemo(\n () => (\n <option\n key={Array.isArray(itemContext.value) ? itemContext.value.join(';') : itemContext.value}\n value={itemContext.value}\n disabled={itemContext.disabled}\n >\n {textContent}\n </option>\n ),\n [itemContext.disabled, itemContext.value, textContent],\n );\n\n const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;\n useLayoutEffect(() => {\n onNativeOptionAdd(nativeOption);\n\n return () => onNativeOptionRemove(nativeOption);\n }, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);\n\n return (\n <>\n <Primitive.span id={itemContext.textId} {...itemTextProps} ref={composedRefs} />\n\n {/* Portal the select item text into the trigger value node */}\n {itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren\n ? ReactDOM.createPortal(itemTextProps.children, context.valueNode)\n : null}\n </>\n );\n },\n);\n\nSelectItemText.displayName = ITEM_TEXT_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectItemIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst ITEM_INDICATOR_NAME = 'SelectItemIndicator';\n\ntype SelectItemIndicatorElement = React.ElementRef<typeof Primitive.span>;\ninterface SelectItemIndicatorProps extends Omit<PrimitiveSpanProps, 'children'> {\n children?: React.ReactNode | ((state: { isSelected: boolean; isIntermediate: boolean }) => React.ReactNode);\n}\n\nconst SelectItemIndicator = React.forwardRef<SelectItemIndicatorElement, SelectItemIndicatorProps>(\n (props: ScopedProps<SelectItemIndicatorProps>, forwardedRef) => {\n const { __scopeSelect, children, ...itemIndicatorProps } = props;\n const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);\n\n /**\n * Children for SelectItemIndicator can be a render prop function which in a multi-select\n * allows us to render an empty or full checkbox depending on the state of the item.\n *\n * Because the SelectItem can recieve an array of values, isIntermediate is true when\n * at least one of those values is selected, it's passed to the ItemContext similarly\n * to how isSelected is passed. So for \"group parents\", they can be correctly styled.\n */\n\n if (typeof children === 'function') {\n return (\n <Primitive.span aria-hidden {...itemIndicatorProps} ref={forwardedRef}>\n {children({\n isSelected: itemContext.isSelected,\n isIntermediate: itemContext.isIntermediate,\n })}\n </Primitive.span>\n );\n }\n\n return itemContext.isSelected ? (\n <Primitive.span aria-hidden {...itemIndicatorProps} ref={forwardedRef}>\n {children}\n </Primitive.span>\n ) : null;\n },\n);\n\nSelectItemIndicator.displayName = ITEM_INDICATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollUpButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';\n\ntype SelectScrollUpButtonElement = SelectScrollButtonImplElement;\ntype SelectScrollUpButtonProps = Omit<SelectScrollButtonImplProps, 'onAutoScroll'>;\n\nconst SelectScrollUpButton = React.forwardRef<SelectScrollUpButtonElement, SelectScrollUpButtonProps>(\n (props: ScopedProps<SelectScrollUpButtonProps>, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);\n const [canScrollUp, setCanScrollUp] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n const handleScroll = () => {\n const canScrollUp = viewport.scrollTop > 0;\n setCanScrollUp(canScrollUp);\n };\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollUp ? (\n <SelectScrollButtonImpl\n {...props}\n ref={composedRefs}\n onAutoScroll={() => {\n const { viewport, selectedItem } = contentContext;\n\n if (viewport && selectedItem) {\n viewport.scrollTop -= selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n },\n);\n\nSelectScrollUpButton.displayName = SCROLL_UP_BUTTON_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectScrollDownButton\n * -----------------------------------------------------------------------------------------------*/\n\nconst SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';\n\ntype SelectScrollDownButtonElement = SelectScrollButtonImplElement;\ntype SelectScrollDownButtonProps = Omit<SelectScrollButtonImplProps, 'onAutoScroll'>;\n\nconst SelectScrollDownButton = React.forwardRef<SelectScrollDownButtonElement, SelectScrollDownButtonProps>(\n (props: ScopedProps<SelectScrollDownButtonProps>, forwardedRef) => {\n const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);\n const [canScrollDown, setCanScrollDown] = React.useState(false);\n const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);\n\n useLayoutEffect(() => {\n if (contentContext.viewport && contentContext.isPositioned) {\n const viewport = contentContext.viewport;\n const handleScroll = () => {\n const maxScroll = viewport.scrollHeight - viewport.clientHeight;\n // we use Math.ceil here because if the UI is zoomed-in\n // `scrollTop` is not always reported as an integer\n const canScrollDown = Math.ceil(viewport.scrollTop) < maxScroll;\n setCanScrollDown(canScrollDown);\n };\n handleScroll();\n viewport.addEventListener('scroll', handleScroll);\n\n return () => viewport.removeEventListener('scroll', handleScroll);\n }\n }, [contentContext.viewport, contentContext.isPositioned]);\n\n return canScrollDown ? (\n <SelectScrollButtonImpl\n {...props}\n ref={composedRefs}\n onAutoScroll={() => {\n const { viewport, selectedItem } = contentContext;\n\n if (viewport && selectedItem) {\n viewport.scrollTop += selectedItem.offsetHeight;\n }\n }}\n />\n ) : null;\n },\n);\n\nSelectScrollDownButton.displayName = SCROLL_DOWN_BUTTON_NAME;\n\ntype SelectScrollButtonImplElement = React.ElementRef<typeof Primitive.div>;\ninterface SelectScrollButtonImplProps extends PrimitiveDivProps {\n onAutoScroll(): void;\n}\n\nconst SelectScrollButtonImpl = React.forwardRef<SelectScrollButtonImplElement, SelectScrollButtonImplProps>(\n (props: ScopedProps<SelectScrollButtonImplProps>, forwardedRef) => {\n const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;\n const contentContext = useSelectContentContext('SelectScrollButton', __scopeSelect);\n const autoScrollTimerRef = React.useRef<number | null>(null);\n const getItems = useCollection(__scopeSelect);\n\n const clearAutoScrollTimer = React.useCallback(() => {\n if (autoScrollTimerRef.current !== null) {\n window.clearInterval(autoScrollTimerRef.current);\n autoScrollTimerRef.current = null;\n }\n }, []);\n\n React.useEffect(() => {\n return () => clearAutoScrollTimer();\n }, [clearAutoScrollTimer]);\n\n // When the viewport becomes scrollable on either side, the relevant scroll button will mount.\n // Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)\n // the viewport, potentially causing the active item to now be partially out of view.\n // We re-run the `scrollIntoView` logic to make sure it stays within the viewport.\n useLayoutEffect(() => {\n const activeItem = getItems().find((item) => item.ref.current === document.activeElement);\n activeItem?.ref.current?.scrollIntoView({ block: 'nearest' });\n }, [getItems]);\n\n return (\n <Primitive.div\n aria-hidden\n {...scrollIndicatorProps}\n ref={forwardedRef}\n style={{ flexShrink: 0, ...scrollIndicatorProps.style }}\n onPointerMove={composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {\n contentContext.onItemLeave?.();\n\n if (autoScrollTimerRef.current === null) {\n autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);\n }\n })}\n onPointerLeave={composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {\n clearAutoScrollTimer();\n })}\n />\n );\n },\n);\n\nSelectScrollButtonImpl.displayName = 'SelectScrollButtonImpl';\n\n/* -------------------------------------------------------------------------------------------------\n * SelectSeparator\n * -----------------------------------------------------------------------------------------------*/\n\nconst SEPARATOR_NAME = 'SelectSeparator';\n\ntype SelectSeparatorElement = React.ElementRef<typeof Primitive.div>;\ntype SelectSeparatorProps = PrimitiveDivProps;\n\nconst SelectSeparator = React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n (props: ScopedProps<SelectSeparatorProps>, forwardedRef) => {\n const { __scopeSelect, ...separatorProps } = props;\n\n return <Primitive.div aria-hidden {...separatorProps} ref={forwardedRef} />;\n },\n);\n\nSelectSeparator.displayName = SEPARATOR_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * SelectArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'SelectArrow';\n\ntype SelectArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ntype SelectArrowProps = PopperArrowProps;\n\nconst SelectArrow = React.forwardRef<SelectArrowElement, SelectArrowProps>(\n (props: ScopedProps<SelectArrowProps>, forwardedRef) => {\n const { __scopeSelect, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeSelect);\n const context = useSelectContext(ARROW_NAME, __scopeSelect);\n const contentContext = useSelectContentContext(ARROW_NAME, __scopeSelect);\n\n return context.open && contentContext.position === 'popper' ? (\n <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />\n ) : null;\n },\n);\n\nSelectArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_SELECT_NAME = 'BubbleSelect';\n\nconst BubbleSelect = React.forwardRef<HTMLSelectElement, React.ComponentPropsWithoutRef<'select'>>(\n (props, forwardedRef) => {\n const { value, ...selectProps } = props;\n const ref = React.useRef<HTMLSelectElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const prevValue = usePrevious(value);\n const context = useSelectContext(BUBBLE_SELECT_NAME, undefined);\n\n // Bubble value change to parents (e.g form change event)\n React.useEffect(() => {\n const select = ref.current!;\n const selectProto = window.HTMLSelectElement.prototype;\n const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value') as PropertyDescriptor;\n const setValue = descriptor.set;\n\n if (prevValue !== value && setValue) {\n const event = new Event('change', { bubbles: true });\n setValue.call(select, value);\n select.dispatchEvent(event);\n }\n }, [prevValue, value]);\n\n let defaultValue = value;\n\n if (context.multi && !Array.isArray(value)) {\n defaultValue = [];\n }\n\n /**\n * We purposefully use a `select` here to support form autofill as much\n * as possible.\n *\n * We purposefully do not add the `value` attribute here to allow the value\n * to be set programatically and bubble to any parent form `onChange` event.\n * Adding the `value` will cause React to consider the programatic\n * dispatch a duplicate and it will get swallowed.\n *\n * We use `VisuallyHidden` rather than `display: \"none\"` because Safari autofill\n * won't work otherwise.\n */\n return (\n <VisuallyHidden asChild>\n <select\n {...selectProps}\n multiple={context.multi ? true : undefined}\n ref={composedRefs}\n defaultValue={defaultValue}\n />\n </VisuallyHidden>\n );\n },\n);\n\nBubbleSelect.displayName = 'BubbleSelect';\n\nfunction useTypeaheadSearch(onSearchChange: (search: string) => void) {\n const handleSearchChange = useCallbackRef(onSearchChange);\n const searchRef = React.useRef('');\n const timerRef = React.useRef(0);\n\n const handleTypeaheadSearch = React.useCallback(\n (key: string) => {\n const search = searchRef.current + key;\n handleSearchChange(search);\n\n (function updateSearch(value: string) {\n searchRef.current = value;\n window.clearTimeout(timerRef.current);\n\n // Reset `searchRef` 1 second after it was last updated\n if (value !== '') timerRef.current = window.setTimeout(() => updateSearch(''), 1000);\n })(search);\n },\n [handleSearchChange],\n );\n\n const resetTypeahead = React.useCallback(() => {\n searchRef.current = '';\n window.clearTimeout(timerRef.current);\n }, []);\n\n React.useEffect(() => {\n return () => window.clearTimeout(timerRef.current);\n }, []);\n\n return [searchRef, handleTypeaheadSearch, resetTypeahead] as const;\n}\n\n/**\n * This is the \"meat\" of the typeahead matching logic. It takes in a list of items,\n * the search and the current item, and returns the next item (or `undefined`).\n *\n * We normalize the search because if a user has repeatedly pressed a character,\n * we want the exact same behavior as if we only had that one character\n * (ie. cycle through items starting with that character)\n *\n * We also reorder the items by wrapping the array around the current item.\n * This is so we always look forward from the current item, and picking the first\n * item will always be the correct one.\n *\n * Finally, if the normalized search is exactly one character, we exclude the\n * current item from the values because otherwise it would be the first to match always\n * and focus would never move. This is as opposed to the regular case, where we\n * don't want focus to move if the current item still matches.\n */\nfunction findNextItem<T extends { textValue: string }>(items: T[], search: string, currentItem?: T) {\n const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);\n const normalizedSearch = isRepeated ? search[0] : search;\n const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;\n let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));\n const excludeCurrentItem = normalizedSearch.length === 1;\n\n if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);\n const nextItem = wrappedItems.find((item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase()));\n\n return nextItem !== currentItem ? nextItem : undefined;\n}\n\n/**\n * Wraps an array around itself at a given start index\n * Example: `wrapArray(['a', 'b', 'c', 'd'], 2) === ['c', 'd', 'a', 'b']`\n */\nfunction wrapArray<T>(array: T[], startIndex: number) {\n return array.map((_, index) => array[(startIndex + index) % array.length]);\n}\n\nconst toggleArrayValue = (value: string | string[], array: string[] = []): string[] => {\n if (Array.isArray(value)) {\n return value.reduce((acc, val) => toggleArrayValue(val, acc), array);\n }\n\n const index = array.indexOf(value);\n\n if (index === -1) {\n return [...array, value];\n }\n\n return [...array.slice(0, index), ...array.slice(index + 1)];\n};\n\nconst Root = Select;\nconst Trigger = SelectTrigger;\nconst Value = SelectValue;\nconst Icon = SelectIcon;\nconst Portal = SelectPortal;\nconst Content = SelectContent;\nconst Viewport = SelectViewport;\nconst Group = SelectGroup;\nconst Label = SelectLabel;\nconst Item = SelectItem;\nconst ItemText = SelectItemText;\nconst ItemIndicator = SelectItemIndicator;\nconst ScrollUpButton = SelectScrollUpButton;\nconst ScrollDownButton = SelectScrollDownButton;\nconst Separator = SelectSeparator;\nconst Arrow = SelectArrow;\n\nexport {\n createSelectScope,\n //\n Select,\n SelectTrigger,\n SelectValue,\n SelectIcon,\n SelectPortal,\n SelectContent,\n SelectViewport,\n SelectGroup,\n SelectLabel,\n SelectItem,\n SelectItemText,\n SelectItemIndicator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n SelectSeparator,\n SelectArrow,\n //\n Root,\n Trigger,\n Value,\n Icon,\n Portal,\n Content,\n Viewport,\n Group,\n Label,\n Item,\n ItemText,\n ItemIndicator,\n ScrollUpButton,\n ScrollDownButton,\n Separator,\n Arrow,\n};\nexport type {\n SingleSelectProps,\n MultiSelectProps,\n SelectProps,\n SelectTriggerProps,\n SelectValueProps,\n SelectValueRenderFn,\n SelectIconProps,\n SelectPortalProps,\n SelectContentProps,\n SelectContentImplProps,\n SelectViewportProps,\n SelectGroupProps,\n SelectLabelProps,\n SelectItemProps,\n SelectItemTextProps,\n SelectItemIndicatorProps,\n SelectScrollUpButtonProps,\n SelectScrollDownButtonProps,\n SelectSeparatorProps,\n SelectArrowProps,\n};\n","function composeEventHandlers<E>(\n originalEventHandler?: (event: E) => void,\n ourEventHandler?: (event: E) => void,\n { checkForDefaultPrevented = true } = {},\n) {\n return function handleEvent(event: E) {\n originalEventHandler?.(event);\n\n if (checkForDefaultPrevented === false || !(event as unknown as Event).defaultPrevented) {\n return ourEventHandler?.(event);\n }\n };\n}\n\nexport { composeEventHandlers };\n"],"names":["createCollectionScope","previousMap","useCollection","OPEN_KEYS","SELECTION_KEYS","Collection","item","TRIGGER_NAME","composeEventHandlers","PORTAL_NAME","PortalPrimitive","CONTENT_NAME","CONTENT_MARGIN","VIEWPORT_NAME","ITEM_NAME","ITEM_TEXT_NAME","ITEM_INDICATOR_NAME","Root","Trigger","Icon","Portal","Content","Viewport","Item","ItemText","ItemIndicator","createCollection","value","valuedItems","canScrollUp","canScrollDown"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,iBAAqE,MAAc;AAKpF,QAAA,gBAAgB,GAAG,IAAI;AAC7B,QAAM,CAAC,yBAAyBA,sBAAqB,IAAI,mBAAmB,aAAa;AAUzF,QAAM,CAAC,wBAAwB,oBAAoB,IAAI,wBAAsC,eAAe;AAAA,IAC1G,eAAe,EAAE,SAAS,KAAK;AAAA,IAC/B,6BAAa,IAAI;AAAA,IACjB,+BAAe,IAAc;AAAA,EAAA,CAC9B;AAEK,QAAA,qBAAqB,CAAC,UAAmC;AACvD,UAAA,EAAE,OAAO,SAAa,IAAA;AACtB,UAAA,MAAM,MAAM,OAA0B,IAAI;AAChD,UAAM,UAAU,MAAM,OAAoC,oBAAA,IAAA,CAAK,EAAE;AAC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