@bazza-ui/react 0.1.0-canary.15 → 0.1.0-canary.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox/index.cjs +1 -1
- package/dist/combobox/index.cjs.map +1 -1
- package/dist/combobox/index.d.ts +842 -834
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +1 -1
- package/dist/command-menu/index.cjs +1 -1
- package/dist/command-menu/index.cjs.map +1 -1
- package/dist/command-menu/index.d.ts +123 -96
- package/dist/command-menu/index.js +1 -1
- package/dist/command-menu/index.js.map +1 -1
- package/dist/context-menu/index.cjs +1 -1
- package/dist/context-menu/index.cjs.map +1 -1
- package/dist/context-menu/index.d.ts +701 -658
- package/dist/context-menu/index.js +1 -1
- package/dist/context-menu/index.js.map +1 -1
- package/dist/dropdown-menu/index.cjs +1 -1
- package/dist/dropdown-menu/index.cjs.map +1 -1
- package/dist/dropdown-menu/index.d.ts +723 -680
- package/dist/dropdown-menu/index.js +1 -1
- package/dist/dropdown-menu/index.js.map +1 -1
- package/dist/events-DDOsDu4X.d.ts +2091 -0
- package/dist/index-Cabqj7qI.d.ts +2003 -0
- package/dist/index-D8OrKThQ.d.ts +977 -0
- package/dist/internal/listbox/index.cjs +1 -2
- package/dist/internal/listbox/index.d.ts +2 -272
- package/dist/internal/listbox/index.js +1 -2
- package/dist/internal/popup-menu/index.cjs +1 -2
- package/dist/internal/popup-menu/index.d.ts +4 -238
- package/dist/internal/popup-menu/index.js +1 -2
- package/dist/items-CD2hw6-3.js +2 -0
- package/dist/items-CD2hw6-3.js.map +1 -0
- package/dist/items-DYDljwnt.cjs +2 -0
- package/dist/items-DYDljwnt.cjs.map +1 -0
- package/dist/{items-B6HeFO_8.d.cts → items-ceX--VIv.d.ts} +21 -19
- package/dist/kbd/index.cjs +1 -1
- package/dist/kbd/index.cjs.map +1 -1
- package/dist/kbd/index.d.ts +35 -35
- package/dist/kbd/index.js +1 -1
- package/dist/kbd/index.js.map +1 -1
- package/dist/listbox-CnwUlLZA.js +2 -0
- package/dist/listbox-CnwUlLZA.js.map +1 -0
- package/dist/listbox-DYvJTiF6.cjs +2 -0
- package/dist/listbox-DYvJTiF6.cjs.map +1 -0
- package/dist/loaders/index.cjs +1 -1
- package/dist/loaders/index.cjs.map +1 -1
- package/dist/loaders/index.d.ts +218 -188
- package/dist/loaders/index.js +1 -1
- package/dist/loaders/index.js.map +1 -1
- package/dist/merge-element-props-0mpNO7ZH.cjs +2 -0
- package/dist/merge-element-props-0mpNO7ZH.cjs.map +1 -0
- package/dist/merge-element-props-PxUvRHax.js +2 -0
- package/dist/merge-element-props-PxUvRHax.js.map +1 -0
- package/dist/platform-C-sxBTRa.cjs +2 -0
- package/dist/platform-C-sxBTRa.cjs.map +1 -0
- package/dist/platform-C4_cGUkS.js +2 -0
- package/dist/platform-C4_cGUkS.js.map +1 -0
- package/dist/popup-menu-BBAzAXIe.cjs +2 -0
- package/dist/popup-menu-BBAzAXIe.cjs.map +1 -0
- package/dist/popup-menu-HmBMJEZc.js +2 -0
- package/dist/popup-menu-HmBMJEZc.js.map +1 -0
- package/dist/resolve-state-props-C-zbhdXd.cjs +2 -0
- package/dist/resolve-state-props-C-zbhdXd.cjs.map +1 -0
- package/dist/resolve-state-props-D31kizRZ.js +2 -0
- package/dist/resolve-state-props-D31kizRZ.js.map +1 -0
- package/dist/rolldown-runtime-5lHFv1cW.cjs +1 -0
- package/dist/rolldown-runtime-DK3Fl9T5.js +1 -0
- package/dist/select/index.cjs +1 -1
- package/dist/select/index.cjs.map +1 -1
- package/dist/select/index.d.ts +835 -828
- package/dist/select/index.js +1 -1
- package/dist/select/index.js.map +1 -1
- package/dist/suggestion-menu/index.cjs +4 -0
- package/dist/suggestion-menu/index.cjs.map +1 -0
- package/dist/suggestion-menu/index.d.ts +359 -0
- package/dist/suggestion-menu/index.js +4 -0
- package/dist/suggestion-menu/index.js.map +1 -0
- package/dist/types-BbN28E3_.d.ts +50 -0
- package/dist/video-player/index.cjs +2 -2
- package/dist/video-player/index.cjs.map +1 -1
- package/dist/video-player/index.d.ts +964 -1000
- package/dist/video-player/index.js +2 -2
- package/dist/video-player/index.js.map +1 -1
- package/package.json +14 -5
- package/dist/ListboxStore-B8oTpM57.d.cts +0 -453
- package/dist/ListboxStore-CV5vPUUc.d.ts +0 -453
- package/dist/chunk-4C666HHU.js +0 -2
- package/dist/chunk-4C666HHU.js.map +0 -1
- package/dist/chunk-5T5B5SPR.cjs +0 -2
- package/dist/chunk-5T5B5SPR.cjs.map +0 -1
- package/dist/chunk-A4Z5BY7H.js +0 -2
- package/dist/chunk-A4Z5BY7H.js.map +0 -1
- package/dist/chunk-BEWVWSAW.cjs +0 -2
- package/dist/chunk-BEWVWSAW.cjs.map +0 -1
- package/dist/chunk-EDZTZHQ4.js +0 -2
- package/dist/chunk-EDZTZHQ4.js.map +0 -1
- package/dist/chunk-IT372NHF.js +0 -2
- package/dist/chunk-IT372NHF.js.map +0 -1
- package/dist/chunk-JFEVUUPC.cjs +0 -2
- package/dist/chunk-JFEVUUPC.cjs.map +0 -1
- package/dist/chunk-KO3DXT3Y.js +0 -2
- package/dist/chunk-KO3DXT3Y.js.map +0 -1
- package/dist/chunk-LXXK4S4Q.js +0 -2
- package/dist/chunk-LXXK4S4Q.js.map +0 -1
- package/dist/chunk-M4G6J7DP.cjs +0 -2
- package/dist/chunk-M4G6J7DP.cjs.map +0 -1
- package/dist/chunk-SCDHQZFI.cjs +0 -2
- package/dist/chunk-SCDHQZFI.cjs.map +0 -1
- package/dist/chunk-XMZZ62VJ.cjs +0 -2
- package/dist/chunk-XMZZ62VJ.cjs.map +0 -1
- package/dist/combobox/index.d.cts +0 -1066
- package/dist/command-menu/index.d.cts +0 -154
- package/dist/command-score-CTJ9NV6n.d.cts +0 -23
- package/dist/command-score-CTJ9NV6n.d.ts +0 -23
- package/dist/context-menu/index.d.cts +0 -696
- package/dist/dropdown-menu/index.d.cts +0 -723
- package/dist/events-BTHQ2OoH.d.ts +0 -1860
- package/dist/events-DVcrtGe3.d.cts +0 -1860
- package/dist/input-C95v6jB0.d.cts +0 -46
- package/dist/input-CYweYB_i.d.ts +0 -46
- package/dist/internal/listbox/index.cjs.map +0 -1
- package/dist/internal/listbox/index.d.cts +0 -272
- package/dist/internal/listbox/index.js.map +0 -1
- package/dist/internal/popup-menu/index.cjs.map +0 -1
- package/dist/internal/popup-menu/index.d.cts +0 -238
- package/dist/internal/popup-menu/index.js.map +0 -1
- package/dist/items-B6HeFO_8.d.ts +0 -37
- package/dist/kbd/index.d.cts +0 -61
- package/dist/loaders/index.d.cts +0 -363
- package/dist/loading-C6WZGUc3.d.cts +0 -29
- package/dist/loading-CC4n55sR.d.ts +0 -29
- package/dist/resolve-B-j0eW24.d.cts +0 -406
- package/dist/resolve-B1F-a3P1.d.ts +0 -406
- package/dist/scroll-arrow-BBoKckL_.d.cts +0 -544
- package/dist/scroll-arrow-fl3B5sVO.d.ts +0 -544
- package/dist/select/index.d.cts +0 -1005
- package/dist/separator-Dn15rte3.d.ts +0 -275
- package/dist/separator-NjsBVzek.d.cts +0 -275
- package/dist/surface-context-CGLDpMej.d.ts +0 -14
- package/dist/surface-context-CN4Lb_6F.d.cts +0 -14
- package/dist/type-guards-BHHzjRvZ.d.cts +0 -351
- package/dist/type-guards-C0e_GpeY.d.ts +0 -351
- package/dist/types-DT4FOOa2.d.cts +0 -51
- package/dist/types-DT4FOOa2.d.ts +0 -51
- package/dist/use-listbox-item-NzZuY34-.d.cts +0 -212
- package/dist/use-listbox-item-NzZuY34-.d.ts +0 -212
- package/dist/video-player/index.d.cts +0 -1391
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["REASONS.imperativeAction","REASONS.none","noResults","REASONS.imperativeAction","REASONS.escapeKey","REASONS.focusOut","REASONS.noResults","__exportAll","PopupMenuScrollUpArrow","PopupMenuItem","PopupMenuSurface","usePopupMenuContext","PopupMenuList","LiveStatusRegion","PopupMenuPositioner","useFocusOwner","PopupMenuLinkItem","usePopupMenuRoot","PopupMenuEmpty","PopupMenuGroupLabel","PopupMenuIcon","useForwardedKeyDown","PopupMenuProviders","useAsyncMenuCoordinator","PopupMenuArrow","PopupMenuTreeItem","useDataList","PopupMenuPortal","PopupMenuSeparator","PopupMenuFooter","PopupMenuGroup","PopupMenuLoading","PopupMenuScrollDownArrow","PopupMenuTreeConnector","PopupMenuGroupValue","useMaybeAsyncMenuCoordinator","PopupMenuHeader","PopupMenuPopup","PopupMenuTree","isPopupMenuNode","noResults","focusOut","escapeKey","imperativeAction","useListboxContext","none","React","SuggestionMenuHandle","#state","#connection","#listeners","listener","next","open","#pendingOpen","previous","element","#requestOpen","#set","changes","event","#openChangeListeners","reason","connection","createSuggestionMenuHandle","SuggestionMenuRootContext","useSuggestionMenuRootContext","context","SuggestionMenuList","rest","props","observerRef","setRef","node","syncHostAria","observer","forwardedRef","SuggestionMenuPopup","SuggestionMenuPositioner","anchored","store","positionerRef","heldSide","setHeldSide","holdRenderedSide","rendered","current","side","frame","anchoredQueryRef","query","base","collisionAvoidance","resolvedCollisionAvoidance","SHARED_ATTRIBUTES","INPUT_ATTRIBUTES","managedAttributes","host","getHostAttributes","shared","listId","activeDescendant","useHostAria","params","listIdRef","savedRef","saved","name","value","latest","sync","mountedListId","attributes","isInPopup","popup","target","watchHost","doc","focusTimeout","endSelection","onFocusOut","options","onMouseDown","onClick","view","onWindowClick","windowEvent","end","timeout","MENU_KEYS","handleSuggestionMenuKey","metaKey","altKey","shiftKey","ctrlKey","key","defaultGetAriaResultsText","count","results","label","SuggestionMenuResultsStatus","sameRect","a","b","useVirtualAnchor","anchorRef","anchor","lastRectRef","readyRef","cacheRef","cache","measureKey","rect","hostChanged","KeyboardBridge","focusOwnerStore","forward","warned","warnOnce","message","SuggestionMenuRoot","openProp","queryProp","anchorProp","itemsProp","onOpenChangeCompleteProp","noResults$1","handleState","handle","storeRef","reportedOpenRef","pendingChangeRef","pending","nextOpen","change","details","onOpenChange","lastNotifiedOpenRef","handleOpenChangeRef","handleOpenChange","forwardKeyDownRef","detachHostRef","emptyQueryRef","noResultsRef","queryPropRef","openOnQueryChangeRef","keyboardHighlightQuery","setKeyboardHighlightQuery","queryRef","isOpen","send","empty","controlled","selecting","heldClose","startSelection","request","choosing","forwarded","used","keyEvent","payload","highlightedId","highlightSource","announcement","setAnnouncement","getAriaResultsTextRef","getAriaResultsText","reportResults","text","anchorReady","handleOpenChangeComplete","handlePopoverOpenChange","rootContext","Popover","children","countShownRows","virtualized","virtualItemsCount","filteredCount","rowLabel","list","id","el","SuggestionMenuResultsReporter","coordinator","settled","menuHighlightRef","menuHighlightedId","cancelled","ids","chosen","BRANCH_KINDS","warnedBranches","warnBranches","withoutBranches","dropped","keep","def","entry","nodes","index","result","entries","SuggestionMenuSurface","filteredContent","content","MIRRORED_STYLES","measureTextPosition","field","style","mirror","mirrorStyle","property","isInput","borderX","px","borderBoxWidth","scrollbar","marker","fieldRect","mirrorRect","markerRect","matchTextTrigger","before","caret","best","trigger","triggers","from","startsLine","REPLACING_INPUT_TYPES","ENDING_REASONS","diffEdit","max","after","start","mapPosition","position","edit","delta","attachTextTrigger","root","isFocused","detachHost","takeHost","menu","pendingEdit","session","closing","ended","syncValue","known","map","endSession","evaluate","match","isEnded","stopListening","onFocus","onBeforeInput","inputType","onInput","onKeyDown","onSelectionChange","onScroll","useTextTrigger","optionsRef","detachRef","index_parts_exports"],"sources":["../../src/suggestion-menu/handle.ts","../../src/suggestion-menu/root/root-context.ts","../../src/suggestion-menu/list/list.tsx","../../src/suggestion-menu/popup/popup.tsx","../../src/suggestion-menu/positioner/positioner.tsx","../../src/suggestion-menu/root/host-aria.ts","../../src/suggestion-menu/root/host-events.ts","../../src/suggestion-menu/root/keymap.ts","../../src/suggestion-menu/root/results-status.tsx","../../src/suggestion-menu/root/virtual-anchor.ts","../../src/suggestion-menu/root/root.tsx","../../src/suggestion-menu/surface/results-reporter.tsx","../../src/suggestion-menu/surface/surface.tsx","../../src/suggestion-menu/text-trigger/caret.ts","../../src/suggestion-menu/text-trigger/match.ts","../../src/suggestion-menu/text-trigger/attach-text-trigger.ts","../../src/suggestion-menu/text-trigger/use-text-trigger.ts","../../src/suggestion-menu/index.parts.ts"],"sourcesContent":["import type * as React from 'react'\nimport { REASONS } from '../utils/events/index.js'\nimport type { SuggestionMenuOpenChangeReason } from './events.js'\n\n/** Where the popup is anchored: usually the trigger character's rect. */\nexport type SuggestionMenuAnchor = () => DOMRect | null\n\n/** What the host input tells the menu when a trigger is typed or updated. */\nexport interface SuggestionMenuUpdate<Payload = unknown> {\n /** The text typed after the trigger. */\n query?: string\n /** Measures where the popup is anchored. */\n anchor?: SuggestionMenuAnchor\n /** Data for the Root's `children` function, e.g. which trigger was typed. */\n payload?: Payload\n}\n\n/** The handle's state, read by the Root. */\nexport interface SuggestionMenuHandleState<Payload = unknown> {\n query: string\n anchor: SuggestionMenuAnchor | null\n payload: Payload | undefined\n /** The attached host input, if any. */\n host: Element | null\n /** Fields last set through `update()`, for the Root's precedence warnings. */\n updated: { query: boolean; anchor: boolean }\n}\n\n/** @internal How a mounted Root serves the handle. */\nexport interface SuggestionMenuConnection {\n isOpen: () => boolean\n requestOpenChange: (\n open: boolean,\n reason: SuggestionMenuOpenChangeReason,\n event?: Event,\n ) => void\n handleKeyDown: (event: KeyboardEvent | React.KeyboardEvent) => boolean\n attachHost: (host: Element | null, previous: Element | null) => void\n}\n\n/**\n * Connects a suggestion menu's Root to its host input: an `<input>`, a\n * `<textarea>` or a contenteditable editor that owns DOM focus and the typed\n * text. Created outside React, so non-React editor code (a ProseMirror plugin,\n * a CodeMirror extension) can drive the menu. One host input is attached at a\n * time.\n */\nexport class SuggestionMenuHandle<Payload = unknown> {\n #state: SuggestionMenuHandleState<Payload> = {\n query: '',\n anchor: null,\n payload: undefined,\n host: null,\n updated: { query: false, anchor: false },\n }\n\n #listeners = new Set<() => void>()\n #openChangeListeners = new Set<\n (open: boolean, reason: SuggestionMenuOpenChangeReason) => void\n >()\n #connection: SuggestionMenuConnection | null = null\n // An open/close requested before any Root was connected.\n #pendingOpen: boolean | null = null\n\n /** The attached host input, if any. */\n get host(): Element | null {\n return this.#state.host\n }\n\n /** The query from the last `update()`. */\n get query(): string {\n return this.#state.query\n }\n\n /**\n * The payload from the last `update()`, e.g. the text-field match to\n * replace when a row is chosen.\n */\n get payload(): Payload | undefined {\n return this.#state.payload\n }\n\n /** Whether the menu is open. `false` while no Root is connected. */\n get isOpen(): boolean {\n return this.#connection?.isOpen() ?? false\n }\n\n /** @internal */\n subscribe = (listener: () => void): (() => void) => {\n this.#listeners.add(listener)\n return () => {\n this.#listeners.delete(listener)\n }\n }\n\n /** @internal */\n getState = (): SuggestionMenuHandleState<Payload> => this.#state\n\n #set(next: Partial<SuggestionMenuHandleState<Payload>>) {\n this.#state = { ...this.#state, ...next }\n for (const listener of this.#listeners) listener()\n }\n\n #requestOpen(open: boolean) {\n if (this.#connection) {\n this.#connection.requestOpenChange(open, REASONS.imperativeAction)\n } else {\n this.#pendingOpen = open\n }\n }\n\n /**\n * Attaches the host input. Attaching another element detaches the previous\n * one and closes the menu if it was open for it. Returns a function that\n * detaches this element.\n */\n attach(element: Element): () => void {\n const previous = this.#state.host\n if (previous !== element) {\n if (previous && this.isOpen) this.#requestOpen(false)\n this.#set({ host: element })\n this.#connection?.attachHost(element, previous)\n }\n return () => {\n if (this.#state.host !== element) return\n if (this.isOpen) this.#requestOpen(false)\n this.#set({ host: null })\n this.#connection?.attachHost(null, element)\n }\n }\n\n /** Opens the menu, or updates its query, anchor and payload while open. */\n update(next: SuggestionMenuUpdate<Payload>): void {\n const changes: Partial<SuggestionMenuHandleState<Payload>> = {\n updated: {\n query: this.#state.updated.query || next.query !== undefined,\n anchor: this.#state.updated.anchor || next.anchor !== undefined,\n },\n }\n if (next.query !== undefined) changes.query = next.query\n if (next.anchor !== undefined) changes.anchor = next.anchor\n if ('payload' in next) changes.payload = next.payload\n this.#set(changes)\n if (!this.isOpen) this.#requestOpen(true)\n }\n\n /**\n * Closes the menu. Call it whenever the trigger ends (deleted, or the caret\n * left it), even if the menu is already closed: it also resets what the\n * menu remembers about the trigger, such as a query that had no results.\n */\n close(): void {\n this.#requestOpen(false)\n }\n\n /**\n * Passes a key press from the host input to the menu. Returns `true` when\n * the menu used the key and prevented its default action; `false` means the\n * key keeps its normal meaning in the host.\n */\n handleKeyDown(event: KeyboardEvent | React.KeyboardEvent): boolean {\n return this.#connection?.handleKeyDown(event) ?? false\n }\n\n /**\n * @internal Called when the menu actually opens or closes (not for requests\n * that were cancelled or refused), with the reason. Returns an unsubscribe.\n */\n subscribeOpenChange = (\n listener: (open: boolean, reason: SuggestionMenuOpenChangeReason) => void,\n ): (() => void) => {\n this.#openChangeListeners.add(listener)\n return () => {\n this.#openChangeListeners.delete(listener)\n }\n }\n\n /** @internal The Root reports a change that happened. */\n notifyOpenChange(open: boolean, reason: SuggestionMenuOpenChangeReason) {\n for (const listener of this.#openChangeListeners) listener(open, reason)\n }\n\n /** @internal Connects a mounted Root. Returns a disconnect function. */\n connect(connection: SuggestionMenuConnection): () => void {\n const previous = this.#connection\n if (previous && previous !== connection) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n '[SuggestionMenu] A handle serves one Root at a time; the Root mounted last takes it over.',\n )\n }\n // The replaced Root stops watching the host.\n previous.attachHost(null, this.#state.host)\n }\n this.#connection = connection\n connection.attachHost(this.#state.host, null)\n if (this.#pendingOpen !== null) {\n const open = this.#pendingOpen\n this.#pendingOpen = null\n connection.requestOpenChange(open, REASONS.imperativeAction)\n }\n return () => {\n if (this.#connection !== connection) return\n connection.attachHost(null, this.#state.host)\n this.#connection = null\n }\n }\n}\n\n/** Creates a handle that connects a suggestion menu to its host input. */\nexport function createSuggestionMenuHandle<\n Payload = unknown,\n>(): SuggestionMenuHandle<Payload> {\n return new SuggestionMenuHandle<Payload>()\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { SuggestionMenuHandle } from '../handle.js'\n\nexport interface SuggestionMenuRootContextValue {\n handle: SuggestionMenuHandle\n /** The current query, from the Root's `query` prop or the handle. */\n query: string\n /** The payload from the last `update()`. */\n payload: unknown\n /**\n * Called by the Surface when its results have settled, with the number of\n * results and the text of the row Enter would choose.\n */\n reportResults: (count: number, label: string | null) => void\n /** Writes the host's ARIA attributes again, e.g. once the list mounts. */\n syncHostAria: (listId?: string) => void\n /** Whether the anchor has measured a rect during this opening. */\n anchorReady: boolean\n}\n\nexport const SuggestionMenuRootContext =\n React.createContext<SuggestionMenuRootContextValue | null>(null)\n\nexport function useSuggestionMenuRootContext(): SuggestionMenuRootContextValue {\n const context = React.useContext(SuggestionMenuRootContext)\n if (!context) {\n throw new Error(\n 'SuggestionMenu parts must be used within a SuggestionMenu.Root.',\n )\n }\n return context\n}\n","'use client'\n\nimport * as React from 'react'\nimport { PopupMenuList } from '../../internal/popup-menu/index.js'\nimport { useSuggestionMenuRootContext } from '../root/root-context.js'\n\nexport interface SuggestionMenuListProps extends PopupMenuList.Props {\n /**\n * Accessible label for the listbox.\n * @default 'Suggestions'\n */\n label?: string\n}\n\n/**\n * The listbox of suggestions. Keyboard handling comes from the host input,\n * so the list never takes focus.\n * Renders a `<div>` element with `role=\"listbox\"`.\n */\nexport const SuggestionMenuList = React.forwardRef<\n HTMLDivElement,\n SuggestionMenuListProps\n>(function SuggestionMenuList(props, forwardedRef) {\n const { label = 'Suggestions', ...rest } = props\n const { syncHostAria } = useSuggestionMenuRootContext()\n const observerRef = React.useRef<MutationObserver | null>(null)\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n // The host's `aria-controls` points at the list as soon as it has its\n // id, which can arrive a render after the element mounts.\n observerRef.current?.disconnect()\n observerRef.current = null\n if (node) {\n if (node.id) syncHostAria(node.id)\n const observer = new MutationObserver(() => {\n if (node.id) syncHostAria(node.id)\n })\n observer.observe(node, { attributeFilter: ['id'] })\n observerRef.current = observer\n }\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n },\n [forwardedRef, syncHostAria],\n )\n return <PopupMenuList ref={setRef} label={label} {...rest} />\n})\n\nexport namespace SuggestionMenuList {\n export type Props = SuggestionMenuListProps\n}\n","'use client'\n\nimport * as React from 'react'\nimport { PopupMenuPopup } from '../../internal/popup-menu/index.js'\n\nexport interface SuggestionMenuPopupProps extends PopupMenuPopup.Props {}\n\n/**\n * The popup that holds the suggestions. It isn't a dialog: focus never enters\n * it, and the listbox inside is what the host input points at.\n * Renders a `<div>` element.\n */\nexport const SuggestionMenuPopup = React.forwardRef<\n HTMLDivElement,\n SuggestionMenuPopupProps\n>(function SuggestionMenuPopup(props, forwardedRef) {\n return <PopupMenuPopup ref={forwardedRef} role=\"presentation\" {...props} />\n})\n\nexport namespace SuggestionMenuPopup {\n export type Props = SuggestionMenuPopupProps\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n PopupMenuPositioner,\n usePopupMenuContext,\n} from '../../internal/popup-menu/index.js'\nimport { useSuggestionMenuRootContext } from '../root/root-context.js'\n\ntype Side = NonNullable<PopupMenuPositioner.Props['side']>\ntype CollisionAvoidance = PopupMenuPositioner.Props['collisionAvoidance']\n\nexport interface SuggestionMenuPositionerProps\n extends PopupMenuPositioner.Props {\n /**\n * Which side of the anchor to place the popup on. If there's no room, it\n * opens on the other side, and stays there until it closes.\n * @default 'bottom'\n */\n side?: Side\n /**\n * How to align the popup against the anchor.\n * @default 'start'\n */\n align?: PopupMenuPositioner.Props['align']\n}\n\n/**\n * Positions the popup against the host's text. The side is chosen when the\n * menu opens and held until it closes: the popup may shift along the line,\n * but never flips between above and below while it's open.\n * Renders a `<div>` element.\n */\nexport const SuggestionMenuPositioner = React.forwardRef<\n HTMLDivElement,\n SuggestionMenuPositionerProps\n>(function SuggestionMenuPositioner(props, forwardedRef) {\n const {\n side = 'bottom',\n align = 'start',\n collisionAvoidance,\n ...rest\n } = props\n const { store } = usePopupMenuContext()\n const { query, anchorReady: anchored } = useSuggestionMenuRootContext()\n const open = store.useState('open')\n const positionerRef = React.useRef<HTMLDivElement | null>(null)\n const [heldSide, setHeldSide] = React.useState<Side | null>(null)\n\n // The side is chosen when the menu opens: Base UI positions the popup\n // asynchronously, and the side it chose (after any flip) has landed by the\n // next frame after there's an anchor. It's held from then on.\n const holdRenderedSide = React.useCallback(() => {\n const rendered = positionerRef.current?.getAttribute('data-side')\n setHeldSide((current) => current ?? ((rendered as Side | null) || side))\n }, [side])\n React.useLayoutEffect(() => {\n if (!open) {\n setHeldSide(null)\n return undefined\n }\n if (!anchored) return undefined\n const frame = requestAnimationFrame(holdRenderedSide)\n return () => cancelAnimationFrame(frame)\n }, [open, anchored, holdRenderedSide])\n // Frames don't run in a background tab; the first keystroke after the\n // popup was positioned against the anchor holds it then.\n const anchoredQueryRef = React.useRef<string | null>(null)\n React.useLayoutEffect(() => {\n if (!open || !anchored) {\n anchoredQueryRef.current = null\n return\n }\n if (anchoredQueryRef.current === null) {\n anchoredQueryRef.current = query\n return\n }\n if (query !== anchoredQueryRef.current) holdRenderedSide()\n }, [open, query, anchored, holdRenderedSide])\n\n // Only ever above or below: a popup beside the anchor would cover the text\n // being typed.\n const base: CollisionAvoidance = collisionAvoidance ?? {\n side: 'flip',\n align: 'shift',\n fallbackAxisSide: 'none',\n }\n const resolvedCollisionAvoidance: CollisionAvoidance =\n heldSide !== null\n ? { ...(typeof base === 'object' ? base : {}), side: 'none' }\n : base\n\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n positionerRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n },\n [forwardedRef],\n )\n\n return (\n <PopupMenuPositioner\n ref={setRef}\n {...rest}\n side={heldSide ?? side}\n align={align}\n collisionAvoidance={resolvedCollisionAvoidance}\n />\n )\n})\n\nexport namespace SuggestionMenuPositioner {\n export type Props = SuggestionMenuPositionerProps\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { ListboxStore } from '../../internal/listbox/index.js'\n\n/** Written on every host while the menu is open. */\nconst SHARED_ATTRIBUTES = [\n 'aria-controls',\n 'aria-activedescendant',\n 'aria-autocomplete',\n 'aria-haspopup',\n] as const\n\n/** Also written on a single-line `<input>`, which becomes a combobox. */\nconst INPUT_ATTRIBUTES = ['role', 'aria-expanded'] as const\n\ntype HostAttribute =\n | (typeof SHARED_ATTRIBUTES)[number]\n | (typeof INPUT_ATTRIBUTES)[number]\n\nfunction managedAttributes(host: Element): readonly HostAttribute[] {\n return host instanceof HTMLInputElement\n ? [...INPUT_ATTRIBUTES, ...SHARED_ATTRIBUTES]\n : SHARED_ATTRIBUTES\n}\n\n/**\n * The attributes the host should carry while the menu is open. A single-line\n * `<input>` becomes a combobox. A `<textarea>` or contenteditable keeps its\n * own role (usually `textbox`) and gets no `aria-expanded`, which `textbox`\n * doesn't support (see ADR 0005); those two attributes aren't touched.\n */\nexport function getHostAttributes(\n host: Element,\n listId: string | null,\n activeDescendant: string | null,\n): Partial<Record<HostAttribute, string | null>> {\n const shared = {\n 'aria-controls': listId,\n 'aria-activedescendant': activeDescendant,\n 'aria-autocomplete': 'list',\n 'aria-haspopup': 'listbox',\n }\n return host instanceof HTMLInputElement\n ? { role: 'combobox', 'aria-expanded': 'true', ...shared }\n : shared\n}\n\n/**\n * Writes the host's ARIA attributes while the menu is open and puts back the\n * host's own values when it closes or the host is detached. Until the menu\n * opens, the host is an ordinary text field. Returns a function that writes\n * them again, for when the list mounts without the Root re-rendering.\n */\nexport function useHostAria(params: {\n store: ListboxStore\n host: Element | null\n open: boolean\n activeDescendant: string | null\n}): (listId?: string) => void {\n const { store, host, open, activeDescendant } = params\n const listIdRef = React.useRef<string | null>(null)\n\n // Writes wait until the host's own values are saved: the list can mount\n // (and ask for a write) earlier in the same commit.\n const savedRef = React.useRef(false)\n React.useLayoutEffect(() => {\n if (!host || !open) return undefined\n const saved = managedAttributes(host).map(\n (name) => [name, host.getAttribute(name)] as const,\n )\n savedRef.current = true\n return () => {\n savedRef.current = false\n for (const [name, value] of saved) {\n if (value === null) host.removeAttribute(name)\n else host.setAttribute(name, value)\n }\n }\n }, [host, open])\n\n const latest = React.useRef({ store, host, open, activeDescendant })\n latest.current = { store, host, open, activeDescendant }\n const sync = React.useCallback((mountedListId?: string) => {\n if (mountedListId) listIdRef.current = mountedListId\n const current = latest.current\n if (!current.host || !current.open || !savedRef.current) return\n const listId =\n current.store.context.refs.listRef.current?.id ||\n listIdRef.current ||\n current.store.context.listId ||\n null\n const attributes = getHostAttributes(\n current.host,\n listId,\n current.activeDescendant,\n )\n for (const name of managedAttributes(current.host)) {\n const value = attributes[name] ?? null\n if (value === null) {\n if (current.host.hasAttribute(name)) current.host.removeAttribute(name)\n } else if (current.host.getAttribute(name) !== value) {\n current.host.setAttribute(name, value)\n }\n }\n }, [])\n\n // Runs after every render: the Root re-renders as the highlight moves.\n React.useLayoutEffect(sync)\n return sync\n}\n","'use client'\n\nexport interface HostEventsOptions {\n isOpen: () => boolean\n /** The popup element, while it's mounted. */\n getPopup: () => HTMLElement | null\n /** Focus left the host for somewhere other than the popup. */\n onFocusOut: (event: FocusEvent) => void\n /** A press inside the popup is about to choose a row. */\n onSelectionStart: () => void\n /** The press has been handled. */\n onSelectionEnd: () => void\n}\n\nfunction isInPopup(event: Event, popup: HTMLElement | null) {\n if (!popup) return false\n // composedPath() sees through shadow roots, where `target` is retargeted.\n const target = event.composedPath()[0] ?? event.target\n return target instanceof Node && popup.contains(target)\n}\n\n/**\n * Watches the attached host input for the menu:\n * - focus leaving the host closes the menu, unless it moved into the popup,\n * the whole window lost focus, or the host got it back before the next task;\n * - a press inside the popup doesn't move focus out of the host (form fields\n * inside the popup keep their native focus);\n * - a click inside the popup marks a row selection, so the Root can tell a\n * close requested by the row's `onSelect` from the menu's own.\n * Returns a function that stops watching.\n */\nexport function watchHost(host: Element, options: HostEventsOptions) {\n const doc = host.ownerDocument\n let focusTimeout: ReturnType<typeof setTimeout> | undefined\n let endSelection: (() => void) | null = null\n\n const onFocusOut = (event: Event) => {\n if (!options.isOpen()) return\n const next = (event as FocusEvent).relatedTarget\n const popup = options.getPopup()\n if (next instanceof Node && popup?.contains(next)) return\n clearTimeout(focusTimeout)\n focusTimeout = setTimeout(() => {\n if (!options.isOpen() || !doc.hasFocus()) return\n // Read now: the host may have been attached before it was in the page.\n const root = host.getRootNode() as Document | ShadowRoot\n if (root.activeElement === host) return\n options.onFocusOut(event as FocusEvent)\n })\n }\n\n const onMouseDown = (event: MouseEvent) => {\n if (!options.isOpen() || !isInPopup(event, options.getPopup())) return\n const target = event.composedPath()[0]\n if (\n target instanceof Element &&\n target.closest('input, textarea, select, [contenteditable]')\n ) {\n return\n }\n event.preventDefault()\n }\n\n const onClick = (event: MouseEvent) => {\n if (!options.isOpen() || !isInPopup(event, options.getPopup())) return\n // A click fired from inside a row's handler belongs to that selection.\n if (endSelection) return\n options.onSelectionStart()\n // The row's handler (React's listener on its root) runs later in this\n // dispatch, and browsers run microtasks between listeners, so the\n // selection ends when the click reaches the window. A timeout covers a\n // click that stopped propagating before that.\n const view = doc.defaultView\n // Only this click ends it: the row's handler may fire another one.\n const onWindowClick = (windowEvent: Event) => {\n if (windowEvent === event) end()\n }\n const end = () => {\n if (endSelection !== end) return\n endSelection = null\n view?.removeEventListener('click', onWindowClick)\n clearTimeout(timeout)\n options.onSelectionEnd()\n }\n endSelection = end\n view?.addEventListener('click', onWindowClick)\n const timeout = setTimeout(end)\n }\n\n host.addEventListener('focusout', onFocusOut)\n doc.addEventListener('mousedown', onMouseDown, true)\n doc.addEventListener('click', onClick, true)\n return () => {\n endSelection?.()\n clearTimeout(focusTimeout)\n host.removeEventListener('focusout', onFocusOut)\n doc.removeEventListener('mousedown', onMouseDown, true)\n doc.removeEventListener('click', onClick, true)\n }\n}\n","import type * as React from 'react'\n\ntype HostKeyboardEvent = KeyboardEvent | React.KeyboardEvent\n\n/** Keys the menu may use while open; everything else stays with the host. */\nconst MENU_KEYS = new Set(['ArrowDown', 'ArrowUp', 'Home', 'End', 'Enter'])\n\nexport interface SuggestionMenuKeymapOptions {\n /** Whether the menu is open. */\n isOpen: () => boolean\n /** Runs the menu's own keyboard handling; returns whether it used the key. */\n forward: (event: HostKeyboardEvent) => boolean\n /** Closes the menu because Escape was pressed. */\n dismiss: (event: HostKeyboardEvent) => void\n}\n\n/**\n * Decides what a key press in the host input does to the suggestion menu.\n * Returns `true` when the menu used the key (its default action is then\n * prevented), `false` when the key keeps its meaning in the host.\n *\n * While open: ↑/↓, Ctrl+N/P and Home/End move the highlight, Enter chooses the\n * highlighted row, and Escape closes the menu without reaching an enclosing\n * dialog. Tab, ←/→, PageUp/PageDown, printable keys, and any key with ⌘, Alt\n * or Shift (or Ctrl other than N/P) belong to the host. Nothing is handled\n * while closed or during IME composition.\n */\nexport function handleSuggestionMenuKey(\n event: HostKeyboardEvent,\n options: SuggestionMenuKeymapOptions,\n): boolean {\n const native = 'nativeEvent' in event ? event.nativeEvent : event\n if (native.isComposing || event.keyCode === 229) return false\n if (event.defaultPrevented || !options.isOpen()) return false\n\n const { key, ctrlKey, metaKey, altKey, shiftKey } = event\n if (metaKey || altKey || shiftKey) return false\n\n if (ctrlKey) {\n if (key !== 'n' && key !== 'p') return false\n return options.forward(event)\n }\n\n if (key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n options.dismiss(event)\n return true\n }\n\n if (!MENU_KEYS.has(key)) return false\n return options.forward(event)\n}\n","'use client'\n\nimport {\n type LiveStatusAnnouncement,\n LiveStatusRegion,\n} from '../../utils/live-status-region.js'\n\n/**\n * Formats the result summary.\n * @param count The number of results.\n * @param label The text of the row Enter would choose, or `null` if none.\n */\nexport type GetAriaResultsText = (count: number, label: string | null) => string\n\nexport const defaultGetAriaResultsText: GetAriaResultsText = (count, label) => {\n if (count === 0) return 'No results'\n const results = `${count} ${count === 1 ? 'result' : 'results'}`\n return label ? `${results}, first: ${label}` : results\n}\n\nexport type ResultsAnnouncement = LiveStatusAnnouncement\n\n/**\n * Visually hidden polite status region that announces the settled result\n * summary. Rendered by the Root from mount, outside the popup, so Safari\n * VoiceOver has seen it before the first summary arrives.\n */\nexport function SuggestionMenuResultsStatus(props: {\n announcement: ResultsAnnouncement | null\n}) {\n return <LiveStatusRegion announcement={props.announcement} element=\"span\" />\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { SuggestionMenuAnchor } from '../handle.js'\n\n/** The anchor the popup is positioned against. */\nexport interface SuggestionMenuVirtualAnchor {\n getBoundingClientRect(): DOMRect\n /** The host input, so scrolling its containers repositions the popup. */\n contextElement: Element | undefined\n}\n\nfunction sameRect(a: DOMRect, b: DOMRect) {\n return (\n a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height\n )\n}\n\n/**\n * Wraps the anchor function in a virtual anchor for the positioner.\n *\n * Base UI repositions (a flip/shift/size pass) whenever it gets a new anchor\n * object, so a new one is made only when the measured rect differs from the\n * last one. The anchor is measured once per change of `measureKey` (each\n * `update()`, prop change or opening), the anchor function or the host.\n * `getBoundingClientRect()` always calls the latest function, so scrolling\n * re-measures and the popup follows. When the function returns `null`, the\n * last rect is kept.\n */\nexport function useVirtualAnchor(\n anchor: SuggestionMenuAnchor | null | undefined,\n host: Element | null,\n measureKey: unknown,\n): { virtualAnchor: SuggestionMenuVirtualAnchor | undefined; ready: boolean } {\n const anchorRef = React.useRef(anchor)\n anchorRef.current = anchor\n const lastRectRef = React.useRef<DOMRect | null>(null)\n // Whether a rect was measured since the anchor was last passed in (i.e.\n // during this opening); the kept object may still hold the last one's.\n const readyRef = React.useRef(false)\n if (!anchor) readyRef.current = false\n const cacheRef = React.useRef<{\n anchor: SuggestionMenuAnchor | null | undefined\n host: Element | null\n measureKey: unknown\n value: SuggestionMenuVirtualAnchor | undefined\n } | null>(null)\n\n const cache = cacheRef.current\n if (\n cache &&\n cache.anchor === anchor &&\n cache.host === host &&\n cache.measureKey === measureKey\n ) {\n return { virtualAnchor: cache.value, ready: readyRef.current }\n }\n\n let value = cache?.value\n const rect = anchor?.() ?? null\n if (rect) readyRef.current = true\n const hostChanged =\n value !== undefined && value.contextElement !== (host ?? undefined)\n if (rect && (!lastRectRef.current || !sameRect(rect, lastRectRef.current))) {\n lastRectRef.current = rect\n value = undefined\n }\n if (anchor && (value === undefined || hostChanged) && lastRectRef.current) {\n value = {\n getBoundingClientRect: () => {\n const latest = anchorRef.current?.() ?? null\n if (latest) lastRectRef.current = latest\n return lastRectRef.current ?? new DOMRect()\n },\n contextElement: host ?? undefined,\n }\n }\n cacheRef.current = { anchor, host, measureKey, value }\n return { virtualAnchor: value, ready: readyRef.current }\n}\n","'use client'\n\nimport { Popover, type PopoverRootProps } from '@base-ui/react/popover'\nimport * as React from 'react'\nimport type { ListboxStore, VirtualItem } from '../../internal/listbox/index.js'\nimport type { PopupMenuOpenChangeReason } from '../../internal/popup-menu/events.js'\nimport {\n type ForwardKeyDown,\n type PopupMenuHighlightChangeHandler,\n PopupMenuProviders,\n type UsePopupMenuRootParams,\n useFocusOwner,\n useForwardedKeyDown,\n usePopupMenuContext,\n usePopupMenuRoot,\n} from '../../internal/popup-menu/index.js'\nimport type {\n GetResolvedIdFn,\n PopupMenuIdScope,\n} from '../../internal/popup-menu/menu-tree/types.js'\nimport { REASONS } from '../../utils/events/index.js'\nimport type {\n SuggestionMenuHighlightChangeEventDetails,\n SuggestionMenuOpenChangeEventDetails,\n SuggestionMenuOpenChangeReason,\n} from '../events.js'\nimport type { SuggestionMenuAnchor, SuggestionMenuHandle } from '../handle.js'\nimport { useHostAria } from './host-aria.js'\nimport { watchHost } from './host-events.js'\nimport { handleSuggestionMenuKey } from './keymap.js'\nimport {\n defaultGetAriaResultsText,\n type GetAriaResultsText,\n type ResultsAnnouncement,\n SuggestionMenuResultsStatus,\n} from './results-status.js'\nimport { SuggestionMenuRootContext } from './root-context.js'\nimport { useVirtualAnchor } from './virtual-anchor.js'\n\n/** What the Root's `children` function receives. */\nexport interface SuggestionMenuRootRenderState<Payload = unknown> {\n /** The payload from the last `update()`. */\n payload: Payload | undefined\n /** The current query. */\n query: string\n}\n\nexport interface SuggestionMenuRootProps<Payload = unknown>\n extends Omit<\n PopoverRootProps,\n | 'open'\n | 'onOpenChange'\n | 'defaultOpen'\n | 'actionsRef'\n | 'modal'\n | 'handle'\n | 'triggerId'\n | 'children'\n > {\n /** Connects the menu to its host input. Create it with `SuggestionMenu.createHandle()`. */\n handle: SuggestionMenuHandle<Payload>\n /**\n * Whether the menu is open, for controlled use. When set, `update()`,\n * `close()` and the menu's own dismissals become `onOpenChange` requests.\n */\n open?: boolean\n /**\n * Whether the menu is initially open, for uncontrolled use.\n * @default false\n */\n defaultOpen?: boolean\n /** Called when the menu asks to open or close, with the reason. */\n onOpenChange?: (\n open: boolean,\n eventDetails: SuggestionMenuOpenChangeEventDetails,\n ) => void\n /**\n * The query, for controlled use. When set, it wins over the handle's\n * `update({ query })`. The menu never changes the query itself.\n */\n query?: string\n /**\n * Measures where the popup is anchored, for controlled use. When set, it\n * wins over the handle's `update({ anchor })`.\n */\n anchor?: SuggestionMenuAnchor\n /**\n * Whether virtualization mode is enabled. Wire your virtualizer to\n * `onHighlightChange` so it scrolls to the highlighted row.\n * @default false\n */\n virtualized?: boolean\n /** Pre-registered items for virtualization. */\n items?: VirtualItem[]\n /** Called when the highlighted row changes. */\n onHighlightChange?: PopupMenuHighlightChangeHandler<SuggestionMenuHighlightChangeEventDetails>\n /**\n * Computes canonical Resolved IDs for data-first content. Read once when the\n * menu mounts.\n */\n getResolvedId?: GetResolvedIdFn\n /**\n * Definition Key uniqueness scope. Read once when the menu mounts.\n * @default 'surface'\n */\n idScope?: PopupMenuIdScope\n /**\n * Formats the result summary announced to screen readers once results\n * settle, for localisation. Receives the number of results and the text of\n * the row Enter would choose.\n * @default (count, label) => count === 0 ? 'No results' : `${count} results, first: ${label}`\n */\n getAriaResultsText?: GetAriaResultsText\n /**\n * What happens when nothing matches the query, once every search for it has\n * finished.\n * - `'empty'`: the menu stays open and shows `Empty`; Enter reaches the host.\n * - `'close'`: the menu closes (reason `'no-results'`). An `update()` with\n * the same query leaves it closed; one with any other query searches\n * again.\n * @default 'empty'\n */\n noResults?: 'empty' | 'close'\n /** The menu's parts, or a function of the payload and query that returns them. */\n children:\n | React.ReactNode\n | ((state: SuggestionMenuRootRenderState<Payload>) => React.ReactNode)\n}\n\n/**\n * Runs inside the providers so the menu's keyboard handling can reach the\n * store; hands the forwarding function to the Root.\n */\nfunction KeyboardBridge(props: {\n forwardKeyDownRef: React.MutableRefObject<ForwardKeyDown | null>\n}) {\n const { store, closeAll } = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const open = store.useState('open')\n const forward = useForwardedKeyDown({\n store,\n surfaceId: 'suggestion-menu-host',\n focusOwnerStore,\n depth: 0,\n submenuContext: null,\n subpageContext: null,\n enabled: open,\n closeAll,\n })\n props.forwardKeyDownRef.current = forward\n return null\n}\n\nconst warned = new Set<string>()\nfunction warnOnce(key: string, message: string) {\n if (process.env.NODE_ENV === 'production' || warned.has(key)) return\n warned.add(key)\n console.warn(message)\n}\n\n/**\n * Groups all parts of the suggestion menu and connects them to the host input\n * through its handle. Never modal: DOM focus stays in the host input.\n * Doesn't render its own HTML element.\n */\nexport function SuggestionMenuRoot<Payload = unknown>(\n props: SuggestionMenuRootProps<Payload>,\n) {\n const {\n handle,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n query: queryProp,\n anchor: anchorProp,\n virtualized = false,\n items: itemsProp,\n onHighlightChange,\n onOpenChangeComplete: onOpenChangeCompleteProp,\n getResolvedId,\n idScope = 'surface',\n getAriaResultsText = defaultGetAriaResultsText,\n noResults = 'empty',\n children,\n ...rest\n } = props\n\n const handleState = React.useSyncExternalStore(\n handle.subscribe,\n handle.getState,\n handle.getState,\n )\n\n const storeRef = React.useRef<ListboxStore | null>(null)\n const reportedOpenRef = React.useRef<boolean | null>(null)\n const pendingChangeRef = React.useRef<{\n open: boolean\n reason: SuggestionMenuOpenChangeReason\n thisTask: boolean\n } | null>(null)\n const {\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n virtualization,\n handleOpenChange,\n disabled,\n menuTreeResolver,\n } = usePopupMenuRoot({\n // A request that matches the current state isn't reported. In an editor,\n // choosing a row edits the text, and the trigger code then calls\n // `close()` too. Until the task ends, the last reported state counts as\n // current: a controlled parent's `open` prop hasn't re-rendered yet.\n onOpenChange: ((\n nextOpen: boolean,\n details: SuggestionMenuOpenChangeEventDetails,\n ) => {\n // The reason of the request that changes the state, for the handle:\n // the first one in this task, or a later task's (a controlled parent\n // may have refused an earlier one).\n const pending = pendingChangeRef.current\n if (\n storeRef.current?.select('open') !== nextOpen &&\n (!pending || pending.open !== nextOpen || !pending.thisTask)\n ) {\n const change = {\n open: nextOpen,\n reason: details.reason,\n thisTask: true,\n }\n pendingChangeRef.current = change\n queueMicrotask(() => {\n change.thisTask = false\n })\n // A controlled parent may commit the change in a later task; to\n // refuse it, it cancels the details, which drops the reason.\n }\n const current =\n reportedOpenRef.current ?? storeRef.current?.select('open')\n if (current === nextOpen) return\n // Recorded before the consumer runs: its handler may ask again (e.g.\n // an editor exiting the trigger calls `close()` from inside it).\n const previous = reportedOpenRef.current\n reportedOpenRef.current = nextOpen\n queueMicrotask(() => {\n reportedOpenRef.current = null\n })\n onOpenChange?.(nextOpen, details)\n // A cancelled request didn't happen, so the next one is reported too.\n if (details.isCanceled) {\n reportedOpenRef.current = previous\n pendingChangeRef.current = null\n }\n }) as unknown as UsePopupMenuRootParams['onOpenChange'],\n defaultOpen,\n virtualized,\n items: itemsProp,\n onHighlightChange:\n onHighlightChange as unknown as UsePopupMenuRootParams['onHighlightChange'],\n closeOnOutsidePress: 'pointerdown',\n // Pressing the host input, or focusing it, never dismisses the menu.\n getDismissExemptElements: () => [handle.host],\n getResolvedId,\n idScope,\n })\n\n storeRef.current = store\n store.useControlledProp('openProp', openProp)\n const open = store.useState('open')\n // Tell the handle once the change has happened (a controlled parent may\n // refuse it), e.g. so a text-field binding knows how the menu closed.\n const lastNotifiedOpenRef = React.useRef(open)\n React.useLayoutEffect(() => {\n if (lastNotifiedOpenRef.current === open) return\n lastNotifiedOpenRef.current = open\n const pending = pendingChangeRef.current\n pendingChangeRef.current = null\n handle.notifyOpenChange(\n open,\n pending?.open === open ? pending.reason : REASONS.none,\n )\n }, [open, handle])\n\n const handleOpenChangeRef = React.useRef(handleOpenChange)\n handleOpenChangeRef.current = handleOpenChange\n const forwardKeyDownRef = React.useRef<ForwardKeyDown | null>(null)\n const detachHostRef = React.useRef<(() => void) | null>(null)\n // With `noResults: 'close'`: the query whose results settled empty.\n const emptyQueryRef = React.useRef<string | null>(null)\n const noResultsRef = React.useRef(noResults)\n noResultsRef.current = noResults\n const queryPropRef = React.useRef(queryProp)\n queryPropRef.current = queryProp\n const openOnQueryChangeRef = React.useRef(false)\n\n // `aria-activedescendant` follows keyboard highlight only (ADR 0005). Set\n // when the menu moves the highlight for a key; cleared when the query\n // changes, on ←/→, and when the pointer or the menu itself moves it.\n const [keyboardHighlightQuery, setKeyboardHighlightQuery] = React.useState<\n string | null\n >(null)\n const queryRef = React.useRef('')\n\n React.useLayoutEffect(() => {\n const isOpen = () => store.select('open')\n const send = (\n nextOpen: boolean,\n reason: SuggestionMenuOpenChangeReason,\n event?: Event,\n ) => {\n if (reason === REASONS.imperativeAction) {\n const empty = emptyQueryRef.current\n if (nextOpen && empty !== null) {\n // The query that settled empty stays closed (e.g. only the caret\n // moved); any other query searches again. A controlled query may\n // not have rendered yet, so that open waits for it.\n const controlled = queryPropRef.current\n if (controlled === empty) {\n openOnQueryChangeRef.current = true\n return\n }\n if (controlled === undefined && handle.getState().query === empty) {\n return\n }\n }\n emptyQueryRef.current = null\n openOnQueryChangeRef.current = false\n }\n handleOpenChangeRef.current(\n nextOpen,\n reason as PopupMenuOpenChangeReason,\n event,\n )\n }\n\n // While a row is being chosen (Enter, or a click on a row), a `close()`\n // from the row's `onSelect` waits, so the menu's own close reports\n // `item-press` first; the waiting close is then a no-op.\n let selecting = 0\n let heldClose: { event: Event | undefined } | null = null\n const startSelection = () => {\n selecting += 1\n }\n const endSelection = () => {\n selecting -= 1\n if (selecting > 0 || !heldClose) return\n const { event } = heldClose\n heldClose = null\n send(false, REASONS.imperativeAction, event)\n }\n const request = (\n nextOpen: boolean,\n reason: SuggestionMenuOpenChangeReason,\n event?: Event,\n ) => {\n if (!nextOpen && reason === REASONS.imperativeAction && selecting > 0) {\n heldClose = { event }\n return\n }\n send(nextOpen, reason, event)\n }\n\n return handle.connect({\n isOpen,\n requestOpenChange: request,\n handleKeyDown: (event) => {\n // Moving the caret hands the screen reader back to the text.\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n setKeyboardHighlightQuery(null)\n }\n return handleSuggestionMenuKey(event, {\n isOpen,\n forward: (forwarded) => {\n const choosing = forwarded.key === 'Enter'\n if (choosing) startSelection()\n try {\n const used = forwardKeyDownRef.current?.(forwarded) ?? false\n if (used && !choosing) {\n setKeyboardHighlightQuery(queryRef.current)\n }\n return used\n } finally {\n if (choosing) endSelection()\n }\n },\n dismiss: (keyEvent) =>\n request(\n false,\n REASONS.escapeKey,\n 'nativeEvent' in keyEvent ? keyEvent.nativeEvent : keyEvent,\n ),\n })\n },\n attachHost: (host) => {\n // A new host (or none) starts fresh.\n emptyQueryRef.current = null\n openOnQueryChangeRef.current = false\n detachHostRef.current?.()\n detachHostRef.current = host\n ? watchHost(host, {\n isOpen,\n getPopup: () => store.context.refs.popupRef.current,\n onFocusOut: (event) => request(false, REASONS.focusOut, event),\n onSelectionStart: startSelection,\n onSelectionEnd: endSelection,\n })\n : null\n },\n })\n }, [handle, store])\n\n if (queryProp !== undefined && handleState.updated.query) {\n warnOnce(\n 'query',\n '[SuggestionMenu] Both the `query` prop and `handle.update({ query })` set the query; the prop wins.',\n )\n }\n if (anchorProp !== undefined && handleState.updated.anchor) {\n warnOnce(\n 'anchor',\n '[SuggestionMenu] Both the `anchor` prop and `handle.update({ anchor })` set the anchor; the prop wins.',\n )\n }\n\n const query = queryProp ?? handleState.query\n // An open that waited for a controlled query to leave the empty one. The\n // prop can render after the `update()` (e.g. state set from an editor's\n // native listener), so it waits until the next `update()`, `close()` or\n // host change.\n React.useLayoutEffect(() => {\n if (!openOnQueryChangeRef.current || query === emptyQueryRef.current) return\n openOnQueryChangeRef.current = false\n emptyQueryRef.current = null\n handleOpenChangeRef.current(\n true,\n REASONS.imperativeAction as PopupMenuOpenChangeReason,\n )\n }, [query])\n const anchor = anchorProp ?? handleState.anchor\n const payload = handleState.payload\n const host = handleState.host\n queryRef.current = query\n\n const highlightedId = store.useState('highlightedId')\n const highlightSource = store.useState('highlightSource')\n // Decided during render, so a pointer or automatic highlight never reaches\n // the host, not even for one render.\n const activeDescendant =\n open && highlightSource === 'keyboard' && keyboardHighlightQuery === query\n ? highlightedId\n : null\n React.useEffect(() => {\n if (highlightSource !== 'keyboard') setKeyboardHighlightQuery(null)\n }, [highlightSource])\n // A new query disarms it for good, even if the text comes back.\n React.useLayoutEffect(() => {\n setKeyboardHighlightQuery(null)\n }, [query])\n const syncHostAria = useHostAria({ store, host, open, activeDescendant })\n\n // The settled result summary, reported by the Surface once per settle.\n const [announcement, setAnnouncement] =\n React.useState<ResultsAnnouncement | null>(null)\n const getAriaResultsTextRef = React.useRef(getAriaResultsText)\n getAriaResultsTextRef.current = getAriaResultsText\n const reportResults = React.useCallback(\n (count: number, label: string | null) => {\n if (count === 0 && noResultsRef.current === 'close') {\n emptyQueryRef.current = queryRef.current\n handleOpenChangeRef.current(\n false,\n REASONS.noResults as PopupMenuOpenChangeReason,\n )\n return\n }\n const text = getAriaResultsTextRef.current(count, label)\n setAnnouncement((current) => ({ text, key: (current?.key ?? 0) + 1 }))\n },\n [],\n )\n React.useEffect(() => {\n if (open) return\n setKeyboardHighlightQuery(null)\n setAnnouncement(null)\n }, [open])\n\n // Measured while open: again on each `update()`, query change and opening,\n // never on close (the text the anchor measured may be gone by then).\n const measureKey = React.useMemo(\n () => ({}),\n // biome-ignore lint/correctness/useExhaustiveDependencies: these are the triggers\n [handleState, query, open],\n )\n const { virtualAnchor, ready: anchorReady } = useVirtualAnchor(\n open ? anchor : undefined,\n host,\n measureKey,\n )\n\n const handleOpenChangeComplete = React.useCallback(\n (nextOpen: boolean) => {\n if (!nextOpen) {\n store.clearHighlight()\n store.context.onCloseComplete?.()\n store.context.onPopupCloseComplete?.()\n }\n onOpenChangeCompleteProp?.(nextOpen)\n },\n [store, onOpenChangeCompleteProp],\n )\n\n const handlePopoverOpenChange = React.useCallback(\n (nextOpen: boolean, details: Popover.Root.ChangeEventDetails) => {\n handleOpenChange(\n nextOpen,\n details.reason as PopupMenuOpenChangeReason,\n details.event,\n )\n },\n [handleOpenChange],\n )\n\n const rootContext = React.useMemo(\n () => ({\n handle: handle as SuggestionMenuHandle,\n query,\n payload,\n reportResults,\n syncHostAria,\n anchorReady,\n }),\n [handle, query, payload, reportResults, syncHostAria, anchorReady],\n )\n\n return (\n <PopupMenuProviders\n store={store}\n menuTreeResolver={menuTreeResolver}\n focusOwnerStore={focusOwnerStore}\n openChainStore={openChainStore}\n disabled={disabled}\n depth={0}\n closeAll={closeAll}\n registerSurface={registerSurface}\n virtualization={virtualization}\n virtualAnchor={virtualAnchor}\n menuType=\"context\"\n externalFocus\n closeOnOutsidePress=\"pointerdown\"\n componentName=\"suggestion-menu\"\n >\n <KeyboardBridge forwardKeyDownRef={forwardKeyDownRef} />\n <SuggestionMenuResultsStatus announcement={announcement} />\n <SuggestionMenuRootContext.Provider value={rootContext}>\n <Popover.Root\n {...rest}\n open={open}\n onOpenChange={handlePopoverOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n modal={false}\n >\n {typeof children === 'function'\n ? children({ payload, query })\n : children}\n </Popover.Root>\n </SuggestionMenuRootContext.Provider>\n </PopupMenuProviders>\n )\n}\n\nexport namespace SuggestionMenuRoot {\n export type Props<Payload = unknown> = SuggestionMenuRootProps<Payload>\n export type RenderState<Payload = unknown> =\n SuggestionMenuRootRenderState<Payload>\n export type ChangeEventDetails = SuggestionMenuOpenChangeEventDetails\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n type ListboxStore,\n useListboxContext,\n} from '../../internal/listbox/index.js'\nimport { useMaybeAsyncMenuCoordinator } from '../../internal/popup-menu/index.js'\nimport { useSuggestionMenuRootContext } from '../root/root-context.js'\n\n/**\n * How many rows the list shows, disabled ones included: a list of only\n * disabled rows still has results, it just can't choose one. The same numbers\n * `Empty` decides from, so the summary never disagrees with it.\n * @internal Exported for tests.\n */\nexport function countShownRows(store: Pick<ListboxStore, 'state'>): number {\n const { virtualized, virtualItemsCount, filteredCount } = store.state\n return virtualized ? virtualItemsCount : filteredCount\n}\n\n/** A row's accessible text, found inside this menu's list. */\nfunction rowLabel(store: ListboxStore, id: string): string | null {\n const list = store.context.refs.listRef.current\n const element =\n store.context.refs.itemRefs.get(id)?.current ??\n [...(list?.querySelectorAll('[id]') ?? [])].find((el) => el.id === id)\n const text =\n element?.getAttribute('aria-label') ?? element?.textContent?.trim()\n return text || store.context.items.get(id)?.value || null\n}\n\n/**\n * Tells the Root what the settled results are, so its status region can\n * announce them. Lives inside the Surface, where the settle state is known.\n */\nexport function SuggestionMenuResultsReporter() {\n const { store } = useListboxContext()\n const coordinator = useMaybeAsyncMenuCoordinator()\n const { query, reportResults } = useSuggestionMenuRootContext()\n const open = store.useState('open')\n const highlightedId = store.useState('highlightedId')\n const highlightSource = store.useState('highlightSource')\n const settled = coordinator?.rootReveal.settled ?? true\n\n // Re-run when the menu itself moves the highlight (e.g. to the first row\n // once rows land). Moves by keyboard or pointer are voiced through\n // aria-activedescendant and the row, not the summary.\n const menuHighlightRef = React.useRef<string | null>(null)\n if (highlightSource !== 'keyboard' && highlightSource !== 'pointer') {\n menuHighlightRef.current = highlightedId\n }\n const menuHighlightedId = menuHighlightRef.current\n\n React.useLayoutEffect(() => {\n if (!open || !settled) return undefined\n // Read the rows once this update has finished, still before paint: a\n // settle published from a layout effect re-renders first, and cancels\n // this if the results turned out not to be settled after all.\n let cancelled = false\n queueMicrotask(() => {\n if (cancelled) return\n const ids = store.getVisibleItemIds()\n // The row Enter would choose: the highlighted one, if any.\n const current = store.state.highlightedId\n const chosen = current !== null && ids.includes(current) ? current : null\n reportResults(\n countShownRows(store),\n chosen ? rowLabel(store, chosen) : null,\n )\n })\n return () => {\n cancelled = true\n }\n }, [open, settled, query, menuHighlightedId, store, reportResults])\n\n return null\n}\n","'use client'\n\nimport * as React from 'react'\nimport { useListboxContext } from '../../internal/listbox/index.js'\nimport {\n isPopupMenuNode,\n type NodeDef,\n PopupMenuSurface,\n type PopupMenuSurfaceProps,\n} from '../../internal/popup-menu/index.js'\nimport { useSuggestionMenuRootContext } from '../root/root-context.js'\nimport { SuggestionMenuResultsReporter } from './results-reporter.js'\n\nexport interface SuggestionMenuSurfaceProps\n extends Omit<\n PopupMenuSurfaceProps,\n 'search' | 'onSearchChange' | 'defaultSearch' | 'skipAutoFocus'\n > {\n /**\n * How rows from `asyncContent` combine with `content`.\n * @default 'append'\n */\n asyncContentMode?: PopupMenuSurfaceProps['asyncContentMode']\n}\n\nconst BRANCH_KINDS = new Set(['submenu', 'subpage'])\n\nlet warnedBranches = false\nfunction warnBranches() {\n if (process.env.NODE_ENV === 'production' || warnedBranches) return\n warnedBranches = true\n console.warn(\n '[SuggestionMenu] Submenu and subpage definitions are not supported and were skipped.',\n )\n}\n\ntype ContentEntry = NonNullable<PopupMenuSurfaceProps['content']>[number]\n\n/**\n * Drops submenu and subpage defs (anywhere in the content), warning once.\n * @internal Exported for tests.\n */\nexport function withoutBranches<T extends ContentEntry>(\n entries: readonly T[],\n): T[] {\n let dropped = false\n const keep = <E extends ContentEntry>(list: readonly E[]): E[] =>\n list.flatMap((entry): E[] => {\n const def: NodeDef = isPopupMenuNode(entry) ? entry.def : entry\n if (BRANCH_KINDS.has(def.kind)) {\n dropped = true\n return []\n }\n if (isPopupMenuNode(entry)) return [entry]\n const children = 'nodes' in def ? def.nodes : undefined\n if (Array.isArray(children)) {\n const nodes = keep(children as NodeDef[])\n const changed =\n nodes.length !== children.length ||\n nodes.some((node, index) => node !== children[index])\n return changed ? [{ ...def, nodes } as E] : [entry]\n }\n return [entry]\n })\n const result = keep(entries)\n if (dropped) warnBranches()\n return dropped ? result : (entries as T[])\n}\n\n/**\n * One pane of suggestions: its content, loaders, list and empty/loading\n * states. The query comes from the host input (through the Root), never from\n * an input inside the popup. Submenu and subpage definitions in `content` are\n * skipped with a development warning; rows from `asyncContent` are shown as\n * returned, so loaders shouldn't return them.\n * Renders a `<div>` element.\n */\nexport const SuggestionMenuSurface = React.forwardRef<\n HTMLDivElement,\n SuggestionMenuSurfaceProps\n>(function SuggestionMenuSurface(props, forwardedRef) {\n const { content, asyncContentMode = 'append', children, ...rest } = props\n const { query } = useSuggestionMenuRootContext()\n const { store } = useListboxContext()\n\n // The host input plays the role of the surface's input: the list neither\n // takes focus nor handles keys itself.\n React.useLayoutEffect(() => {\n store.setHasInput(true)\n return () => store.setHasInput(false)\n }, [store])\n\n const filteredContent = React.useMemo(\n () =>\n content ? withoutBranches(content as readonly ContentEntry[]) : content,\n [content],\n ) as PopupMenuSurfaceProps['content']\n\n return (\n <PopupMenuSurface\n ref={forwardedRef}\n {...rest}\n content={filteredContent}\n asyncContentMode={asyncContentMode}\n search={query}\n // DOM focus stays in the host input.\n skipAutoFocus\n >\n {children}\n <SuggestionMenuResultsReporter />\n </PopupMenuSurface>\n )\n})\n\nexport namespace SuggestionMenuSurface {\n export type Props = SuggestionMenuSurfaceProps\n}\n","/** Styles that decide where text lands inside a text field. */\nconst MIRRORED_STYLES = [\n 'borderTopWidth',\n 'borderRightWidth',\n 'borderBottomWidth',\n 'borderLeftWidth',\n 'borderStyle',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'fontStyle',\n 'fontVariant',\n 'fontWeight',\n 'fontStretch',\n 'fontSize',\n 'fontSizeAdjust',\n 'lineHeight',\n 'fontFamily',\n 'fontFeatureSettings',\n 'fontKerning',\n 'textAlign',\n 'textTransform',\n 'textIndent',\n 'textDecoration',\n 'letterSpacing',\n 'wordSpacing',\n 'tabSize',\n 'direction',\n 'whiteSpace',\n 'wordBreak',\n 'overflowWrap',\n 'hyphens',\n 'fontVariationSettings',\n] as const\n\n/**\n * Measures where a character of a text field's value is drawn, in viewport\n * coordinates, by laying the text out in an invisible copy of the field (the\n * \"mirror element\" technique). Returns `null` when the field isn't in the page.\n */\nexport function measureTextPosition(\n field: HTMLInputElement | HTMLTextAreaElement,\n index: number,\n): DOMRect | null {\n const doc = field.ownerDocument\n const view = doc.defaultView\n if (!view || !field.isConnected) return null\n\n const style = view.getComputedStyle(field)\n const mirror = doc.createElement('div')\n const mirrorStyle = mirror.style\n for (const property of MIRRORED_STYLES) {\n mirrorStyle[property] = style[property]\n }\n const isInput = field instanceof HTMLInputElement\n mirrorStyle.position = 'absolute'\n mirrorStyle.visibility = 'hidden'\n mirrorStyle.top = '0'\n mirrorStyle.left = '-9999px'\n mirrorStyle.overflow = 'hidden'\n // The width the text wraps in: the field's (fractional) width, minus any\n // scrollbar.\n const borderX =\n Number.parseFloat(style.borderLeftWidth) +\n Number.parseFloat(style.borderRightWidth)\n // Layout width: fractional, and unaffected by transforms or zoom.\n const px = (value: string) => Number.parseFloat(value) || 0\n const borderBoxWidth =\n style.boxSizing === 'border-box'\n ? px(style.width)\n : px(style.width) +\n px(style.paddingLeft) +\n px(style.paddingRight) +\n borderX\n const scrollbar = field.offsetWidth - field.clientWidth - borderX\n mirrorStyle.boxSizing = 'border-box'\n mirrorStyle.width = `${borderBoxWidth - scrollbar}px`\n if (isInput) {\n // An input is one line, centred in its content box.\n mirrorStyle.whiteSpace = 'pre'\n const contentHeight =\n field.clientHeight -\n Number.parseFloat(style.paddingTop) -\n Number.parseFloat(style.paddingBottom)\n mirrorStyle.lineHeight = `${contentHeight}px`\n }\n\n const value = field.value\n mirror.textContent = value.slice(0, index)\n const marker = doc.createElement('span')\n // A non-empty marker so it has a line box even at the end of the text.\n marker.textContent = value.slice(index, index + 1) || '\\u200b'\n mirror.append(marker)\n // The rest of the text, so a word that wraps as a whole wraps here too.\n mirror.append(value.slice(index + 1))\n doc.body.append(mirror)\n\n try {\n const fieldRect = field.getBoundingClientRect()\n const mirrorRect = mirror.getBoundingClientRect()\n const markerRect = marker.getBoundingClientRect()\n return new DOMRect(\n fieldRect.left + (markerRect.left - mirrorRect.left) - field.scrollLeft,\n fieldRect.top + (markerRect.top - mirrorRect.top) - field.scrollTop,\n markerRect.width,\n markerRect.height,\n )\n } finally {\n mirror.remove()\n }\n}\n","/** A character that opens the suggestion menu when typed in a text field. */\nexport interface SuggestionMenuTextTrigger {\n /** The trigger, e.g. `'@'`, `'/'` or `':'`. */\n char: string\n /**\n * Whether the query may contain spaces, e.g. `@Alice Smith`. A line break\n * always ends it.\n * @default false\n */\n allowSpaces?: boolean\n /**\n * Whether the trigger only counts at the start of a line.\n * @default false\n */\n startOfLine?: boolean\n /**\n * How many characters must follow the trigger before the menu opens.\n * @default 0\n */\n minLength?: number\n}\n\n/** A trigger typed in a text field: the menu's payload. */\nexport interface SuggestionMenuTextTriggerMatch {\n /** The trigger that matched. */\n trigger: SuggestionMenuTextTrigger\n /** The text typed after the trigger. */\n query: string\n /** Where the trigger character starts in the field's value. */\n from: number\n /**\n * Where the typed query ends: the caret, or further if the caret was moved\n * back inside it. Replace `from`–`to` to insert a choice.\n */\n to: number\n}\n\n/**\n * Finds the trigger the caret is in, if any. A trigger counts at the start of\n * the text or after whitespace (or only at the start of a line, with\n * `startOfLine`), and runs to the caret. The trigger closest to the caret\n * wins.\n */\nexport function matchTextTrigger(\n text: string,\n caret: number,\n triggers: readonly SuggestionMenuTextTrigger[],\n): SuggestionMenuTextTriggerMatch | null {\n const before = text.slice(0, caret)\n let best: SuggestionMenuTextTriggerMatch | null = null\n for (const trigger of triggers) {\n if (!trigger.char) continue\n const from = before.lastIndexOf(trigger.char)\n if (from < 0 || (best && from <= best.from)) continue\n const query = before.slice(from + trigger.char.length)\n if (query.includes('\\n')) continue\n if (!trigger.allowSpaces && /\\s/.test(query)) continue\n if (query.length < (trigger.minLength ?? 0)) continue\n const previous = from === 0 ? '' : before.charAt(from - 1)\n const startsLine = from === 0 || previous === '\\n'\n if (\n trigger.startOfLine ? !startsLine : !(startsLine || /\\s/.test(previous))\n )\n continue\n best = { trigger, query, from, to: caret }\n }\n return best\n}\n","import type { SuggestionMenuHandle } from '../handle.js'\nimport { measureTextPosition } from './caret.js'\nimport {\n matchTextTrigger,\n type SuggestionMenuTextTrigger,\n type SuggestionMenuTextTriggerMatch,\n} from './match.js'\n\n/** What the binding needs from a handle. */\nexport type SuggestionMenuTextTriggerHandle = Pick<\n SuggestionMenuHandle<SuggestionMenuTextTriggerMatch>,\n | 'attach'\n | 'update'\n | 'close'\n | 'handleKeyDown'\n | 'host'\n | 'subscribeOpenChange'\n>\n\nexport interface AttachTextTriggerOptions {\n /** The characters that open the menu. */\n triggers: readonly SuggestionMenuTextTrigger[]\n}\n\n/** `beforeinput` types that replace the current selection. */\nconst REPLACING_INPUT_TYPES = new Set([\n 'insertText',\n 'insertFromPaste',\n 'insertLineBreak',\n 'insertParagraph',\n])\n\n/** Closes that end the trigger: it stays closed until it's typed again. */\nconst ENDING_REASONS = new Set(['escape-key', 'item-press'])\n\n/** A run of the old value that was replaced: `[start, end)`. */\ninterface Edit {\n start: number\n end: number\n}\n\n/**\n * The run of `before` that was replaced to make `after`, found from their\n * common prefix and suffix. Ambiguous when the edit repeats a neighbouring\n * character, so an edit known from `beforeinput` is preferred.\n */\nfunction diffEdit(before: string, after: string): Edit {\n const max = Math.min(before.length, after.length)\n let start = 0\n while (start < max && before[start] === after[start]) start++\n let end = 0\n while (\n end < max - start &&\n before[before.length - 1 - end] === after[after.length - 1 - end]\n ) {\n end++\n }\n return { start, end: before.length - end }\n}\n\n/**\n * Maps a position through an edit. Returns `null` when the position was inside\n * the replaced run (e.g. a trigger character that was deleted or typed over).\n */\nfunction mapPosition(edit: Edit, delta: number, position: number) {\n if (position < edit.start) return position\n if (position >= edit.end) return position + delta\n return null\n}\n\n/**\n * Makes an `<input>` or `<textarea>` the suggestion menu's host. Typing a\n * trigger opens the menu with the text after it as the query, anchored at the\n * trigger character; the payload (`menu.payload`) is the match, with the\n * range to replace. Keys the menu uses are forwarded to it and go no further.\n * After Escape, or once a row is chosen, the menu stays closed until the\n * trigger is typed again. A handle shared by several fields follows the one\n * the user is typing in. Returns a function that detaches the field.\n */\nexport function attachTextTrigger(\n menu: SuggestionMenuTextTriggerHandle,\n field: HTMLInputElement | HTMLTextAreaElement,\n options: AttachTextTriggerOptions,\n): () => void {\n const doc = field.ownerDocument\n const root = () => field.getRootNode() as Document | ShadowRoot\n const isFocused = () => root().activeElement === field\n let detachHost: (() => void) | null = null\n const takeHost = () => {\n if (menu.host !== field) detachHost = menu.attach(field)\n }\n // A shared handle stays with the field that has it, unless this one is\n // where the user is.\n if (menu.host === null || isFocused()) takeHost()\n\n let value = field.value\n // The selection an insertion or replacement is about to replace, from\n // `beforeinput`: exact where a diff would guess.\n let pendingEdit: Edit | null = null\n // The trigger this field opened the menu for, until it's closed here: its\n // start, and how far its query has been typed.\n let session: { char: string; from: number; end: number } | null = null\n // A session this field just closed, until the menu reports how it closed:\n // choosing a row usually edits the text first, which ends the match.\n let closing: { char: string; from: number } | null = null\n // Triggers that ended (Escape, or a row was chosen): they stay closed while\n // their character is in place.\n let ended: Array<{ char: string; from: number }> = []\n\n /** Moves remembered positions through whatever changed the value. */\n const syncValue = () => {\n const next = field.value\n const known = pendingEdit\n pendingEdit = null\n if (next === value) return\n const before = value\n value = next\n // Trust the selection only if the text outside it really is unchanged.\n const edit =\n known &&\n before.slice(0, known.start) === next.slice(0, known.start) &&\n next.endsWith(before.slice(known.end))\n ? known\n : diffEdit(before, next)\n const delta = next.length - before.length\n const map = (position: number) => mapPosition(edit, delta, position)\n ended = ended.flatMap((trigger) => {\n const from = map(trigger.from)\n return from === null ? [] : [{ ...trigger, from }]\n })\n if (session) {\n const from = map(session.from)\n if (from === null) {\n // The trigger character was deleted or typed over.\n session = null\n menu.close()\n } else {\n session = { ...session, from, end: map(session.end) ?? from }\n }\n }\n if (closing) {\n const from = map(closing.from)\n closing = from === null ? null : { ...closing, from }\n }\n }\n\n const endSession = () => {\n if (!session) return\n closing = { char: session.char, from: session.from }\n session = null\n menu.close()\n }\n\n const evaluate = () => {\n if (menu.host !== field) return\n syncValue()\n const caret = field.selectionStart\n const collapsed = caret !== null && caret === field.selectionEnd\n const match = collapsed\n ? matchTextTrigger(field.value, caret, options.triggers)\n : null\n const isEnded =\n match !== null &&\n ended.some(\n (trigger) =>\n trigger.from === match.from && trigger.char === match.trigger.char,\n )\n if (!match || isEnded) return endSession()\n\n const same =\n session?.char === match.trigger.char && session.from === match.from\n // What was typed for this trigger: typing moves `end` along (through the\n // edit mapping); moving the caret doesn't, so text that was already there\n // is never replaced.\n const end = same && session ? session.end : match.to\n session = { char: match.trigger.char, from: match.from, end }\n closing = null\n const from = match.from\n menu.update({\n query: match.query,\n payload: { ...match, to: end },\n // The trigger character, not the caret, so typing doesn't move it.\n anchor: () => measureTextPosition(field, from),\n })\n }\n\n const stopListening = menu.subscribeOpenChange((open, reason) => {\n if (open || menu.host !== field) return\n syncValue()\n const target = session ?? closing\n closing = null\n if (target && ENDING_REASONS.has(reason)) {\n ended.push({ char: target.char, from: target.from })\n }\n })\n\n const onFocus = () => {\n takeHost()\n evaluate()\n }\n const onBeforeInput = (event: Event) => {\n const { inputType } = event as InputEvent\n const start = field.selectionStart\n const end = field.selectionEnd\n if (start === null || end === null) return\n // These replace the selection; others (undo, drop, deleting beside a\n // collapsed caret) change text elsewhere, which the diff finds.\n const replacesSelection =\n REPLACING_INPUT_TYPES.has(inputType) ||\n (start !== end && inputType.startsWith('delete'))\n if (replacesSelection) {\n syncValue()\n pendingEdit = { start, end }\n }\n }\n const onInput = () => {\n if (isFocused()) takeHost()\n evaluate()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (menu.host !== field) return\n // A key the menu used (e.g. Enter choosing a row) goes no further, so an\n // app's own Enter-to-send doesn't also run.\n if (menu.handleKeyDown(event)) event.stopPropagation()\n }\n const onSelectionChange = () => {\n if (isFocused()) evaluate()\n }\n // Scrolling the field moves the text under the popup.\n const onScroll = () => {\n if (session) evaluate()\n }\n\n // One element type, so the event map types `keydown` as a KeyboardEvent.\n const element: HTMLElement = field\n element.addEventListener('beforeinput', onBeforeInput)\n element.addEventListener('input', onInput)\n element.addEventListener('focus', onFocus)\n element.addEventListener('keydown', onKeyDown)\n element.addEventListener('scroll', onScroll)\n doc.addEventListener('selectionchange', onSelectionChange)\n return () => {\n stopListening()\n element.removeEventListener('beforeinput', onBeforeInput)\n element.removeEventListener('input', onInput)\n element.removeEventListener('focus', onFocus)\n element.removeEventListener('keydown', onKeyDown)\n element.removeEventListener('scroll', onScroll)\n doc.removeEventListener('selectionchange', onSelectionChange)\n if (menu.host === field) endSession()\n detachHost?.()\n }\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n type AttachTextTriggerOptions,\n attachTextTrigger,\n type SuggestionMenuTextTriggerHandle,\n} from './attach-text-trigger.js'\n\n/**\n * React wrapper for `attachTextTrigger`. Returns a stable ref for the\n * `<input>` or `<textarea>`; pass it directly (the attached field is\n * `menu.host`). The latest `triggers` are used on every keystroke.\n */\nexport function useTextTrigger(\n menu: SuggestionMenuTextTriggerHandle,\n options: AttachTextTriggerOptions,\n): (field: HTMLInputElement | HTMLTextAreaElement | null) => void {\n const optionsRef = React.useRef(options)\n optionsRef.current = options\n const detachRef = React.useRef<(() => void) | null>(null)\n\n // React calls the ref with `null` when the field unmounts, which detaches.\n return React.useCallback(\n (field: HTMLInputElement | HTMLTextAreaElement | null) => {\n detachRef.current?.()\n detachRef.current = field\n ? attachTextTrigger(menu, field, {\n get triggers() {\n return optionsRef.current.triggers\n },\n })\n : null\n },\n [menu],\n )\n}\n","// ============================================================================\n// Suggestion Menu Parts\n// ============================================================================\n\n// Pure aliases of the canonical resolved-node model (ADR-0001).\nexport type {\n NodeDef,\n PopupMenuNode as Node,\n} from '../internal/popup-menu/index.js'\n\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuEmpty as Empty,\n PopupMenuFooter as Footer,\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n PopupMenuGroupValue as GroupValue,\n PopupMenuHeader as Header,\n PopupMenuIcon as Icon,\n PopupMenuItem as Item,\n PopupMenuLinkItem as LinkItem,\n PopupMenuLoading as Loading,\n PopupMenuPortal as Portal,\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n PopupMenuTree as Tree,\n PopupMenuTreeConnector as TreeConnector,\n PopupMenuTreeItem as TreeItem,\n useAsyncMenuCoordinator,\n useDataList,\n} from '../internal/popup-menu/index.js'\nexport {\n createSuggestionMenuHandle as createHandle,\n SuggestionMenuHandle as Handle,\n} from './handle.js'\nexport { SuggestionMenuList as List } from './list/list.js'\nexport { SuggestionMenuPopup as Popup } from './popup/popup.js'\nexport { SuggestionMenuPositioner as Positioner } from './positioner/positioner.js'\nexport { SuggestionMenuRoot as Root } from './root/root.js'\nexport { SuggestionMenuSurface as Surface } from './surface/surface.js'\nexport { attachTextTrigger } from './text-trigger/attach-text-trigger.js'\nexport type {\n SuggestionMenuTextTrigger as TextTrigger,\n SuggestionMenuTextTriggerMatch as TextTriggerMatch,\n} from './text-trigger/match.js'\nexport { useTextTrigger } from './text-trigger/use-text-trigger.js'\n"],"mappings":"uhBA+CA,IAAa+C,EAAb,KAAqD,CACnD,GAA6C,CAC3C,MAAO,GACP,OAAQ,KACR,QAAS,IAAA,GACT,KAAM,KACN,QAAS,CAAE,MAAO,GAAO,OAAQ,EAAM,CACzC,EAEA,mBAAa,IAAI,IACjB,mBAAuB,IAAI,IAG3B,GAA+C,KAE/C,GAA+B,KAG/B,IAAI,MAAuB,CACzB,OAAO,KAAKC,GAAO,IACrB,CAGA,IAAI,OAAgB,C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AAQ,iBAAiB,UAAWuP,CAAS,EAC7CvP,EAAQ,iBAAiB,SAAUyP,CAAQ,EAC3C5L,EAAI,iBAAiB,kBAAmB2L,CAAiB,MAC5C,CACXN,EAAc,EACdlP,EAAQ,oBAAoB,cAAeoP,CAAa,EACxDpP,EAAQ,oBAAoB,QAASsP,CAAO,EAC5CtP,EAAQ,oBAAoB,QAASmP,CAAO,EAC5CnP,EAAQ,oBAAoB,UAAWuP,CAAS,EAChDvP,EAAQ,oBAAoB,SAAUyP,CAAQ,EAC9C5L,EAAI,oBAAoB,kBAAmB2L,CAAiB,EACxDlB,EAAK,OAASrC,GAAO6C,EAAW,EACpCV,IAAa,CACf,CACF,CC9OA,SAAgBsB,GACd,EACA,EACgE,CAChE,IAAMC,EAAarQ,EAAM,OAAO2E,CAAO,EACvC,EAAW,QAAUA,EACrB,IAAM2L,EAAYtQ,EAAM,OAA4B,IAAI,EAGxD,OAAOA,EAAM,YACV,GAAyD,CACxDsQ,EAAU,UAAU,EACpB,EAAU,QAAU3D,EAChBgC,GAAkBK,EAAMrC,EAAO,CAC7B,IAAI,UAAW,CACb,OAAO0D,EAAW,QAAQ,QAC5B,CACF,CAAC,EACD,IACN,EACA,CAACrB,CAAI,CACP,CACF"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
//#region src/utils/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Render function that receives props and state, returns a React element.
|
|
5
|
+
*/
|
|
6
|
+
type ComponentRenderFn<Props, State> = (props: Props, state: State) => React.ReactElement<unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* HTML props with ref support.
|
|
9
|
+
*/
|
|
10
|
+
type HTMLProps<T = any> = React.HTMLAttributes<T> & {
|
|
11
|
+
ref?: React.Ref<T> | undefined;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* React synthetic event augmented by Base UI's mergeProps utility.
|
|
15
|
+
*/
|
|
16
|
+
type PreventableBaseHandlerEvent<E extends React.SyntheticEvent<Element, Event>> = E & {
|
|
17
|
+
preventBaseUIHandler: () => void;
|
|
18
|
+
readonly baseUIHandlerPrevented?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type WithPreventableBaseHandler<T> = T extends ((event: infer E) => infer R) ? E extends React.SyntheticEvent<Element, Event> ? (event: PreventableBaseHandlerEvent<E>) => R : T : T;
|
|
21
|
+
/**
|
|
22
|
+
* Adds Base UI's preventBaseUIHandler event typing to React event handlers.
|
|
23
|
+
*/
|
|
24
|
+
type WithPreventableBaseHandlers<T> = { [K in keyof T]: WithPreventableBaseHandler<T[K]>; };
|
|
25
|
+
/**
|
|
26
|
+
* Props shared by all Bazza UI components.
|
|
27
|
+
* Includes className (string or state-based function), render prop, and style (object or state-based function).
|
|
28
|
+
*/
|
|
29
|
+
type ComponentProps<ElementType extends React.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<React.ComponentPropsWithRef<ElementType>, 'className' | 'color' | 'defaultValue' | 'defaultChecked'> & {
|
|
30
|
+
/**
|
|
31
|
+
* CSS class applied to the element, or a function that
|
|
32
|
+
* returns a class based on the component's state.
|
|
33
|
+
*/
|
|
34
|
+
className?: string | ((state: State) => string | undefined);
|
|
35
|
+
/**
|
|
36
|
+
* Allows you to replace the component's HTML element
|
|
37
|
+
* with a different tag, or compose it with another component.
|
|
38
|
+
*
|
|
39
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
40
|
+
*/
|
|
41
|
+
render?: ComponentRenderFn<RenderFunctionProps, State> | React.ReactElement;
|
|
42
|
+
/**
|
|
43
|
+
* Style applied to the element, or a function that
|
|
44
|
+
* returns a style object based on the component's state.
|
|
45
|
+
*/
|
|
46
|
+
style?: React.CSSProperties | ((state: State) => React.CSSProperties | undefined);
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { ComponentRenderFn as n, WithPreventableBaseHandlers as r, ComponentProps as t };
|
|
50
|
+
//# sourceMappingURL=types-BbN28E3_.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.
|
|
2
|
-
`),s=a.length>0,p={active:s,cueText:t,cues:a},i={ref:r,"aria-live":"polite","aria-atomic":!0,role:"status",style:{pointerEvents:"none"},"data-active":s||void 0};return l?l(i,p):u?_jsxruntime.jsx.call(void 0, "div",{...i,...n,children:u}):_jsxruntime.jsx.call(void 0, "div",{...i,...n,children:t})});var lr=sr.forwardRef(function(e,r){let{render:l,...u}=e,n=P("CaptionsButton"),o=n.registeredTracks.length>0,a=n.activeTextTrack!==null,t={active:a,available:o,trackCount:n.registeredTracks.length},s=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":a?"Disable captions":"Enable captions","aria-pressed":a,disabled:!o,"data-active":a||void 0,"data-available":o||void 0,onClick(){if(a)n.setTextTrack(null);else if(n.registeredTracks.length>0){let p=n.registeredTracks[0];_optionalChain([p, 'optionalAccess', _2 => _2.textTrack])&&n.setTextTrack(p.textTrack)}}},u);return l?l(s,t):_jsxruntime.jsx.call(void 0, "button",{...s})});var ur=it.forwardRef(function(e,r){let{render:l,children:u,...n}=e,o=P("CaptionsMenu"),a={registeredTracks:o.registeredTracks,activeTextTrack:o.activeTextTrack},t={ref:r,role:"menu","aria-label":"Captions","data-active":o.activeTextTrack!==null||void 0};return l?l(t,a):_jsxruntime.jsx.call(void 0, "div",{...t,...n,children:_nullishCoalesce(u, () => (_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, Ae,{track:null,children:"Off"}),o.registeredTracks.map(s=>_jsxruntime.jsx.call(void 0, Ae,{track:s.textTrack,children:s.label},s.id))]})))})}),Ae=it.forwardRef(function(e,r){let{track:l,children:u,...n}=e,o=P("CaptionsMenuItem"),a=o.activeTextTrack===l,t=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button",role:"menuitemradio","aria-checked":a,"data-active":a||void 0,onClick(){o.setTextTrack(l)}},n);return _jsxruntime.jsx.call(void 0, "button",{...t,children:u})});var We=(t=>(t.open="data-open",t.closed="data-closed",t.idle="data-idle",t.playing="data-playing",t.paused="data-paused",t.ended="data-ended",t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t))(We||{});function an(c){let e=[...c.getAnimations(),...Array.from(c.querySelectorAll("*")).flatMap(r=>r.getAnimations())];return e.length===0?Promise.resolve():Promise.all(e.map(r=>r.finished)).then(()=>{}).catch(()=>{})}function Y(c){let{open:e,keepMounted:r=!1}=c,[l,u]=X.useState(e||r),[n,o]=X.useState(e?"starting":void 0),a=X.useRef(null),t=X.useRef(!1);return X.useEffect(()=>{if(e){t.current=!1,u(!0),o("starting");let s=requestAnimationFrame(()=>{requestAnimationFrame(()=>{o(void 0)})});return()=>cancelAnimationFrame(s)}},[e]),X.useEffect(()=>{if(!e&&l&&!t.current){o("ending");let s=a.current;if(!s){o(void 0),r||u(!1);return}t.current=!0;let p=requestAnimationFrame(()=>{requestAnimationFrame(()=>{an(s).then(()=>{t.current&&(t.current=!1,o(void 0),r||u(!1))})})});return()=>{cancelAnimationFrame(p)}}},[e,l,r]),X.useEffect(()=>{r&&!l&&!e&&u(!0)},[r,l,e]),{mounted:l||r,transitionStatus:n,elementRef:a}}var cr=fe.forwardRef(function(e,r){let{idleTimeout:l,keepMounted:u=!1,render:n,children:o,...a}=e,t=P("Controls"),p=(_nullishCoalesce(l, () => (t.idleTimeout)))===0||!t.idle,{mounted:i,transitionStatus:f,elementRef:b}=Y({open:p,keepMounted:u}),S=fe.useCallback(L=>{b.current=L,typeof r=="function"?r(L):r&&(r.current=L)},[r,b]),{onClick:T,...y}=a,x=fe.useCallback(L=>{L.stopPropagation(),_optionalChain([T, 'optionalCall', _3 => _3(L)])},[T]),v={open:p,idle:t.idle,playing:t.playing,paused:t.paused,ended:t.ended},k={ref:S,onClick:x,"data-open":p||void 0,"data-closed":!p||void 0,"data-idle":t.idle||void 0,"data-playing":t.playing||void 0,"data-paused":t.paused||void 0,"data-ended":t.ended||void 0,"data-starting-style":f==="starting"||void 0,"data-ending-style":f==="ending"||void 0};return i?n?n(k,v):_jsxruntime.jsx.call(void 0, "div",{...k,...y,children:o}):null});var dr=ue.forwardRef(function(e,r){let{render:l,children:u,...n}=e,o=P("FullscreenButton"),[a,t]=ue.useState(!1);ue.useEffect(()=>{t("fullscreenEnabled"in document&&document.fullscreenEnabled)},[]);let s={fullscreen:o.fullscreen,supported:a},p=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":o.fullscreen?"Exit fullscreen":"Enter fullscreen","aria-pressed":o.fullscreen,disabled:!a,"data-fullscreen":o.fullscreen||void 0,"data-supported":a||void 0,onClick(){o.toggleFullscreen()}},n);return l?l(p,s):_jsxruntime.jsx.call(void 0, "button",{...p,children:u})});var fr=pr.forwardRef(function(e,r){let{render:l,...u}=e,n=P("MuteButton"),o={muted:n.muted,volume:n.volume},a=n.volume,t=n.muted,s=a===0||t,p=a>0&&!t,i=!t&&a>0&&a<.5,f=!t&&a>=.5,b=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":n.muted?"Unmute":"Mute","aria-pressed":n.muted,"data-muted":t||void 0,"data-volume-off":s||void 0,"data-volume-on":p||void 0,"data-volume-low":i||void 0,"data-volume-high":f||void 0,onClick(){n.toggleMute()}},u);return l?l(b,o):_jsxruntime.jsx.call(void 0, "button",{...b})});var Fe=(i=>(i.open="data-open",i.closed="data-closed",i.playing="data-playing",i.paused="data-paused",i.ended="data-ended",i.waiting="data-waiting",i.seeking="data-seeking",i.fullscreen="data-fullscreen",i.pip="data-pip",i.startingStyle="data-starting-style",i.endingStyle="data-ending-style",i))(Fe||{});var mr=Qe.forwardRef(function(e,r){let{idleTimeout:l,keepMounted:u=!1,render:n,children:o,...a}=e,t=P("Overlay"),p=(_nullishCoalesce(l, () => (t.idleTimeout)))===0||!t.idle,{mounted:i,transitionStatus:f,elementRef:b}=Y({open:p,keepMounted:u}),S=Qe.useCallback(x=>{b.current=x,typeof r=="function"?r(x):r&&(r.current=x)},[r,b]),T={playing:t.playing,paused:t.paused,ended:t.ended,waiting:t.waiting,seeking:t.seeking,fullscreen:t.fullscreen,pictureInPicture:t.pictureInPicture,open:p},y=_chunkSCDHQZFIcjs.a.call(void 0, {ref:S,onClick(){t.toggle()},"data-playing":t.playing||void 0,"data-paused":t.paused||void 0,"data-ended":t.ended||void 0,"data-waiting":t.waiting||void 0,"data-seeking":t.seeking||void 0,"data-fullscreen":t.fullscreen||void 0,"data-pip":t.pictureInPicture||void 0,"data-open":p||void 0,"data-closed":!p||void 0,"data-starting-style":f==="starting"||void 0,"data-ending-style":f==="ending"||void 0},a);return i?n?n(y,T):_jsxruntime.jsx.call(void 0, "div",{...y,...a,children:o}):null});var Pr=ce.forwardRef(function(e,r){let{render:l,...u}=e,n=P("PictureInPictureButton"),[o,a]=ce.useState(!1);ce.useEffect(()=>{a("pictureInPictureEnabled"in document&&document.pictureInPictureEnabled)},[]);let t={pictureInPicture:n.pictureInPicture,supported:o},s=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":n.pictureInPicture?"Exit picture-in-picture":"Enter picture-in-picture","aria-pressed":n.pictureInPicture,disabled:!o,"data-pip":n.pictureInPicture||void 0,"data-supported":o||void 0,onClick(){n.togglePictureInPicture()}},u);return l?l(s,t):_jsxruntime.jsx.call(void 0, "button",{...s})});var Rr=yr.forwardRef(function(e,r){let{render:l,children:u,...n}=e,o=P("PlayButton"),a={playing:o.playing,paused:o.paused,ended:o.ended,waiting:o.waiting},t=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":o.playing?"Pause":"Play","data-playing":o.playing||void 0,"data-paused":o.paused||void 0,"data-ended":o.ended||void 0,"data-waiting":o.waiting||void 0,onClick(){o.toggle()}},n);return l?l(t,a):_jsxruntime.jsx.call(void 0, "button",{...t,children:u})});var fn=[.25,.5,.75,1,1.25,1.5,1.75,2],br=Sr.forwardRef(function(e,r){let{rates:l=fn,render:u,children:n,...o}=e,a=P("PlaybackRateButton"),t={playbackRate:a.playbackRate,rates:l},s=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button","aria-label":`Playback speed: ${a.playbackRate}x`,"data-rate":a.playbackRate,onClick(){let p=l.indexOf(a.playbackRate),i=_nullishCoalesce(_nullishCoalesce(l[(p+1)%l.length], () => (l[0])), () => (a.playbackRate));a.setPlaybackRate(i)}},o);return u?u(s,t):_jsxruntime.jsx.call(void 0, "button",{...s,children:_nullishCoalesce(n, () => (`${a.playbackRate}x`))})});var Pn=[.25,.5,.75,1,1.25,1.5,1.75,2],kr=lt.forwardRef(function(e,r){let{rates:l=Pn,render:u,children:n,...o}=e,a=P("PlaybackRateMenu"),t={playbackRate:a.playbackRate,rates:l},s={ref:r,role:"menu","aria-label":"Playback speed","data-rate":a.playbackRate};return u?u(s,t):_jsxruntime.jsx.call(void 0, "div",{...s,...o,children:_nullishCoalesce(n, () => (l.map(p=>_jsxruntime.jsx.call(void 0, ut,{rate:p},p))))})}),ut=lt.forwardRef(function(e,r){let{rate:l,children:u,...n}=e,o=P("PlaybackRateMenuItem"),a=o.playbackRate===l,t=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button",role:"menuitemradio","aria-checked":a,"data-active":a||void 0,onClick(){o.setPlaybackRate(l)}},n);return _jsxruntime.jsx.call(void 0, "button",{...t,children:_nullishCoalesce(u, () => (`${l}x`))})});var _reactdom = require('react-dom'); var Mr = _interopRequireWildcard(_reactdom);function gr(c){let{children:e,container:r}=c,[l,u]=$e.useState(!1);if($e.useEffect(()=>(u(!0),()=>u(!1)),[]),!l)return null;let n=_nullishCoalesce(r, () => ((typeof document<"u"?document.body:null)));return n?_reactdom.createPortal.call(void 0, e,n):null}var vr=Ne.forwardRef(function(e,r){let{keepMounted:l=!1,render:u,children:n,...o}=e,a=P("Poster"),t=!a.canPlay,s=a.canPlay,{mounted:p,transitionStatus:i,elementRef:f}=Y({open:t,keepMounted:l}),b=Rn(r,f),S={loading:t,loaded:s,transitionStatus:i},T={ref:b,"aria-hidden":!0,"data-loading":t||void 0,"data-loaded":s||void 0,"data-starting-style":i==="starting"||void 0,"data-ending-style":i==="ending"||void 0};return p?u?u(T,S):_jsxruntime.jsx.call(void 0, "div",{...T,...o,children:n}):null});function Rn(...c){return Ne.useCallback(e=>{for(let r of c)typeof r=="function"?r(e):r!=null&&(r.current=e)},c)}var Tr=dt.forwardRef(function(e,r){let{render:l,children:u,...n}=e,o=P("QualityMenu"),a={qualities:o.qualities,activeQuality:o.activeQuality},t={ref:r,role:"menu","aria-label":"Video quality","data-quality":_nullishCoalesce(_optionalChain([o, 'access', _4 => _4.activeQuality, 'optionalAccess', _5 => _5.label]), () => (void 0))};return l?l(t,a):_jsxruntime.jsx.call(void 0, "div",{...t,...n,children:_nullishCoalesce(u, () => (o.qualities.map(s=>_jsxruntime.jsx.call(void 0, pt,{quality:s,children:s.label},s.label))))})}),pt=dt.forwardRef(function(e,r){let{quality:l,children:u,...n}=e,o=P("QualityMenuItem"),a=_optionalChain([o, 'access', _6 => _6.activeQuality, 'optionalAccess', _7 => _7.label])===l.label,t=_chunkSCDHQZFIcjs.a.call(void 0, {ref:r,type:"button",role:"menuitemradio","aria-checked":a,"data-active":a||void 0,onClick(){o.setQuality(l)}},n);return _jsxruntime.jsx.call(void 0, "button",{...t,children:u})});var je=(s=>(s.playing="data-playing",s.paused="data-paused",s.ended="data-ended",s.waiting="data-waiting",s.seeking="data-seeking",s.fullscreen="data-fullscreen",s.pip="data-pip",s.muted="data-muted",s.idle="data-idle",s))(je||{});function bn(c,e){return!(c instanceof HTMLElement)||c instanceof HTMLInputElement&&c.type==="range"&&e===" "?!1:c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable}function kn(c){return c==="ArrowRight"||c==="ArrowLeft"}function hr(c,e){let r=ie(),l=Ue.useRef(r);l.current=r,Ue.useEffect(()=>{if(e==="none")return;let u=a=>{if(bn(a.target,a.key))return;let t=l.current;switch(a.key){case" ":a.preventDefault(),t.toggle();break;case"f":case"F":a.preventDefault(),t.toggleFullscreen();break;case"ArrowUp":a.preventDefault(),t.setVolume(Math.min(t.volume+.1,1));break;case"ArrowDown":a.preventDefault(),t.setVolume(Math.max(t.volume-.1,0));break;case"ArrowRight":a.preventDefault(),t.beginSeekInteraction(),t.seek(Math.min(t.currentTime+5,t.duration));break;case"ArrowLeft":a.preventDefault(),t.beginSeekInteraction(),t.seek(Math.max(t.currentTime-5,0));break;default:return}t.resetIdle()},n=a=>{kn(a.key)&&l.current.endSeekInteraction()};if(e==="global")return window.addEventListener("keydown",u),window.addEventListener("keyup",n),()=>{window.removeEventListener("keydown",u),window.removeEventListener("keyup",n)};let o=c.current;if(o)return o.addEventListener("keydown",u),o.addEventListener("keyup",n),()=>{o.removeEventListener("keydown",u),o.removeEventListener("keyup",n)}},[e,c])}function _e(c,e,r){let[l,u]=d.useState(e),n=c!==void 0,o=n?c:l,a=d.useCallback(t=>{let s=typeof t=="function"?t(o):t;n||u(s),_optionalChain([r, 'optionalCall', _8 => _8(s)])},[n,o,r]);return[o,a]}function gn({rootRef:c,videoRef:e,actionsRef:r,defaultPlaying:l=!1,autoPlay:u=!1,defaultVolume:n=1,defaultMuted:o=!1,defaultPlaybackRate:a=1,playing:t,onPlayingChange:s,volume:p,onVolumeChange:i,muted:f,onMutedChange:b,playbackRate:S,onPlaybackRateChange:T,currentTime:y,onCurrentTimeChange:x,idleTimeout:v=3e3,preventIdleWhenPaused:k=!1,idle:L,onIdleChange:M,onEnded:w,onWaiting:H,onSeeking:Q,onSeeked:D,onFullscreenChange:h,onPictureInPictureChange:$,children:U}){let q=d.useRef(1),_=d.useRef(!1),z=d.useRef(!1),Z=d.useRef(!1),[B,I]=d.useState("paused"),[g,A]=d.useState(l?"play":"pause");d.useEffect(()=>{t!==void 0&&(A(t?"play":"pause"),B!=="waiting"&&I(t?"playing":"paused"))},[t,B]);let[W,te]=_e(p,n,i),[J,pe]=_e(f,o,b),[Pt,yt]=_e(S,a,T),[qr,re]=_e(L,!0,M),ne=d.useRef(null),ye=d.useCallback(()=>{ne.current&&(clearTimeout(ne.current),ne.current=null)},[]),Rt=d.useCallback(()=>{v!==0&&(ye(),ne.current=setTimeout(()=>{re(!0)},v))},[v,ye,re]),St=d.useCallback(()=>{re(!1),Rt()},[re,Rt]),bt=d.useCallback(()=>{ye(),re(!0)},[ye,re]);d.useEffect(()=>(v>0&&(ne.current=setTimeout(()=>{re(!0)},v)),()=>{ne.current&&clearTimeout(ne.current)}),[]);let kt=k&&B!=="playing"?!1:qr,se=d.useCallback(()=>{let m=e.current;m&&(m.muted!==J&&(m.muted=J),m.volume!==W&&(m.volume=W))},[J,e,W]),Re=d.useCallback(async()=>{let m=e.current;if(!(!u||!m||Z.current)){Z.current=!0,A("play"),se();try{await m.play(),I("playing"),_optionalChain([s, 'optionalCall', _9 => _9(!0)])}catch (e2){A("pause"),I("paused")}}},[u,s,se,e]);d.useEffect(()=>{if(!u){Z.current=!1;return}Re()},[u,Re]);let[gt,vt]=d.useState(0),[Se,Tt]=d.useState(0),[ht,Xr]=d.useState(null),[be,Yr]=d.useState(null),[xt,Ct]=d.useState(!1),[Mt,le]=d.useState(!1),[ke,Gr]=d.useState(!1),[ge,Et]=d.useState(!1),[Bt,ot]=d.useState([]),[oe,zr]=d.useState(null),[Vt,ve]=d.useState([]),[wt,Wn]=d.useState([]),[Lt,Jr]=d.useState(null);d.useEffect(()=>{y!==void 0&&e.current&&(e.current.currentTime=y)},[y,e]),d.useEffect(()=>{f===void 0&&p===void 0||se()},[f,p,se]),d.useEffect(()=>{let m=()=>{let C=document.fullscreenElement===c.current;Gr(C),_optionalChain([h, 'optionalCall', _10 => _10(C)])};return document.addEventListener("fullscreenchange",m),()=>document.removeEventListener("fullscreenchange",m)},[h,c]),d.useEffect(()=>{let m=e.current;if(!m)return;let C=()=>{Et(!0),_optionalChain([$, 'optionalCall', _11 => _11(!0)])},N=()=>{Et(!1),_optionalChain([$, 'optionalCall', _12 => _12(!1)])};return m.addEventListener("enterpictureinpicture",C),m.addEventListener("leavepictureinpicture",N),()=>{m.removeEventListener("enterpictureinpicture",C),m.removeEventListener("leavepictureinpicture",N)}},[$,e]);let Te=d.useCallback(async()=>{e.current&&(A("play"),await e.current.play(),I("playing"),_optionalChain([s, 'optionalCall', _13 => _13(!0)]))},[e,s]),he=d.useCallback(()=>{e.current&&(A("pause"),e.current.pause(),I("paused"),_optionalChain([s, 'optionalCall', _14 => _14(!1)]))},[e,s]),xe=d.useCallback(async()=>{B==="playing"?he():await Te()},[B,Te,he]),Ce=d.useCallback(m=>{e.current&&(e.current.currentTime=m,vt(m),_optionalChain([x, 'optionalCall', _15 => _15(m)]))},[x,e]),Ht=d.useCallback(()=>{let m=e.current;!m||_.current||(_.current=!0,z.current=g==="play",le(!0),z.current&&!m.paused&&m.pause())},[g,e]),It=d.useCallback(()=>{let m=e.current;if(!m||!_.current)return;let C=z.current&&g==="play";if(_.current=!1,z.current=!1,!C){le(!1);return}m.play().then(()=>{I("playing"),le(!1)}).catch(()=>{I("waiting"),le(!1)})},[g,e]),Me=d.useCallback(m=>{let C=Math.max(0,Math.min(1,m));e.current&&(e.current.volume=C),te(C)},[te,e]),Dt=d.useCallback(()=>{if(!(J||W===0))q.current=W,e.current&&(e.current.muted=!0),pe(!0);else{let C=q.current>0?q.current:1;e.current&&(e.current.volume=C,e.current.muted=!1),te(C),pe(!1)}},[J,W,pe,te,e]),Ee=d.useCallback(async()=>{_optionalChain([c, 'access', _16 => _16.current, 'optionalAccess', _17 => _17.requestFullscreen])&&await c.current.requestFullscreen()},[c]),Be=d.useCallback(async()=>{document.exitFullscreen&&await document.exitFullscreen()},[]),Ve=d.useCallback(async()=>{ke?await Be():await Ee()},[ke,Ee,Be]),we=d.useCallback(async()=>{_optionalChain([e, 'access', _18 => _18.current, 'optionalAccess', _19 => _19.requestPictureInPicture])&&await e.current.requestPictureInPicture()},[e]),Le=d.useCallback(async()=>{document.pictureInPictureElement&&await document.exitPictureInPicture()},[]),Ot=d.useCallback(async()=>{ge?await Le():await we()},[ge,we,Le]),At=d.useCallback(m=>{e.current&&(e.current.playbackRate=m),yt(m)},[yt,e]),Wt=d.useCallback(m=>{if(e.current){for(let C=0;C<e.current.textTracks.length;C++){let N=e.current.textTracks[C];N&&(N.mode="disabled")}m&&(m.mode="hidden")}zr(m),ve([])},[e]),Ft=d.useCallback(m=>{Jr(m)},[]),Qt=d.useCallback(m=>{ot(C=>C.some(N=>N.id===m.id)?C:[...C,m])},[]),$t=d.useCallback(m=>{ot(C=>C.filter(N=>N.id!==m))},[]),Nt=d.useCallback((m,C)=>{ot(N=>N.map(ae=>ae.id===m?{...ae,textTrack:C}:ae))},[]);d.useEffect(()=>{if(!oe){ve([]);return}let m=()=>{let C=oe.activeCues;if(!C){ve([]);return}let N=[];for(let ae=0;ae<C.length;ae++){let rr=C[ae];rr instanceof VTTCue&&N.push(rr)}ve(N)};return m(),oe.addEventListener("cuechange",m),()=>{oe.removeEventListener("cuechange",m)}},[oe]),d.useImperativeHandle(r,()=>({toggle:xe,seek:Ce,setVolume:Me,toggleFullscreen:Ve}),[xe,Ce,Me,Ve]);let jt=d.useCallback(()=>{if(e.current){let m=e.current.currentTime;vt(m),_optionalChain([x, 'optionalCall', _20 => _20(m)])}},[x,e]),Ut=d.useCallback(()=>{e.current&&Tt(e.current.duration)},[e]),_t=d.useCallback(()=>{e.current&&Xr(e.current.buffered)},[e]),Kt=d.useCallback(()=>{A("play"),I("playing"),_optionalChain([s, 'optionalCall', _21 => _21(!0)])},[s]),qt=d.useCallback(()=>{_.current||B!=="ended"&&(I("paused"),_optionalChain([s, 'optionalCall', _22 => _22(!1)]))},[B,s]),Xt=d.useCallback(()=>{A("pause"),I("ended"),_optionalChain([s, 'optionalCall', _23 => _23(!1)]),_optionalChain([w, 'optionalCall', _24 => _24()])},[s,w]),Yt=d.useCallback(()=>{_.current||(I("waiting"),_optionalChain([H, 'optionalCall', _25 => _25()]))},[H]),Gt=d.useCallback(()=>{if(_.current){Ct(!0);return}if(B==="waiting"){let m=g==="play"?"playing":"paused";I(m),_optionalChain([s, 'optionalCall', _26 => _26(m==="playing")])}Ct(!0)},[B,g,s]),zt=d.useCallback(()=>{le(!0),B==="ended"&&I("paused"),_optionalChain([Q, 'optionalCall', _27 => _27()])},[B,Q]),Jt=d.useCallback(()=>{if(le(!1),e.current){let{currentTime:m,duration:C}=e.current;C>0&&C-m<.01&&I("ended")}_optionalChain([D, 'optionalCall', _28 => _28()])},[D,e]),Zt=d.useCallback(()=>{e.current&&(te(e.current.volume),pe(e.current.muted))},[te,pe,e]),er=d.useCallback(()=>{e.current&&Tt(e.current.duration)},[e]),tr=d.useCallback(()=>{se(),Re()},[Re,se]),Zr=d.useMemo(()=>({playbackStatus:B,playbackIntent:g,playing:B==="playing",paused:B==="paused",ended:B==="ended",waiting:B==="waiting",seeking:Mt,canPlay:xt,currentTime:gt,duration:Se,buffered:ht,hoverTime:be,hoverProgress:be!==null&&Se>0?be/Se*100:null,volume:W,muted:J,fullscreen:ke,pictureInPicture:ge,idle:kt,idleTimeout:v,preventIdleWhenPaused:k,registeredTracks:Bt,activeTextTrack:oe,activeCues:Vt,playbackRate:Pt,qualities:wt,activeQuality:Lt,videoRef:e,rootRef:c,play:Te,pause:he,toggle:xe,seek:Ce,setVolume:Me,toggleMute:Dt,enterFullscreen:Ee,exitFullscreen:Be,toggleFullscreen:Ve,enterPictureInPicture:we,exitPictureInPicture:Le,togglePictureInPicture:Ot,setPlaybackRate:At,setTextTrack:Wt,setQuality:Ft,registerTrack:Qt,unregisterTrack:$t,updateTrackRef:Nt,resetIdle:St,setHoverTime:Yr,beginSeekInteraction:Ht,endSeekInteraction:It,_handlers:{onTimeUpdate:jt,onDurationChange:Ut,onProgress:_t,onPlay:Kt,onPause:qt,onEnded:Xt,onWaiting:Yt,onCanPlay:Gt,onSeeking:zt,onSeeked:Jt,onVolumeChange:Zt,onLoadedMetadata:er,onVideoMount:tr,onRootMouseLeave:bt}}),[B,g,Mt,xt,gt,Se,ht,be,W,J,ke,ge,kt,v,k,Bt,oe,Vt,Pt,wt,Lt,e,c,Te,he,xe,Ce,Me,Dt,Ee,Be,Ve,we,Le,Ot,At,Wt,Ft,Qt,$t,Nt,St,Ht,It,jt,Ut,_t,Kt,qt,Xt,Yt,Gt,zt,Jt,Zt,er,tr,bt]);return _jsxruntime.jsx.call(void 0, at.Provider,{value:Zr,children:U})}var xr=d.forwardRef(function(e,r){let{actionsRef:l,keyboardShortcuts:u="focused",defaultPlaying:n,autoPlay:o,defaultVolume:a,defaultMuted:t,defaultPlaybackRate:s,playing:p,onPlayingChange:i,volume:f,onVolumeChange:b,muted:S,onMutedChange:T,playbackRate:y,onPlaybackRateChange:x,currentTime:v,onCurrentTimeChange:k,idleTimeout:L,preventIdleWhenPaused:M,hideCursorWhenIdle:w="fullscreen",idle:H,onIdleChange:Q,onEnded:D,onWaiting:h,onSeeking:$,onSeeked:U,onFullscreenChange:q,onPictureInPictureChange:_,children:z,...Z}=e,B=d.useRef(null),I=d.useRef(null);return _jsxruntime.jsx.call(void 0, gn,{actionsRef:l,defaultPlaying:n,autoPlay:o,defaultVolume:a,defaultMuted:t,defaultPlaybackRate:s,playing:p,onPlayingChange:i,volume:f,onVolumeChange:b,muted:S,onMutedChange:T,playbackRate:y,onPlaybackRateChange:x,currentTime:v,onCurrentTimeChange:k,idleTimeout:L,preventIdleWhenPaused:M,idle:H,onIdleChange:Q,onEnded:D,onWaiting:h,onSeeking:$,onSeeked:U,onFullscreenChange:q,onPictureInPictureChange:_,rootRef:B,videoRef:I,children:_jsxruntime.jsx.call(void 0, vn,{ref:r,rootRef:B,keyboardShortcuts:u,hideCursorWhenIdle:w,...Z,children:z})})}),vn=d.forwardRef(function({rootRef:e,keyboardShortcuts:r,hideCursorWhenIdle:l,children:u,className:n,style:o,...a},t){let s=ie(),p=Tn(t,e),i=d.useRef(null);hr(e,r);let f=d.useCallback(w=>{let{clientX:H,clientY:Q}=w,D=i.current;D&&D.x===H&&D.y===Q||(i.current={x:H,y:Q},s.resetIdle())},[s]),b=d.useCallback(w=>{let{clientX:H,clientY:Q}=w,D=i.current;D&&D.x===H&&D.y===Q||(i.current={x:H,y:Q},s.resetIdle())},[s]),S=d.useCallback(()=>{s._handlers.onRootMouseLeave()},[s._handlers]),T=d.useCallback(()=>{s.resetIdle()},[s]),y=d.useCallback(()=>{s.resetIdle()},[s]),x=d.useCallback(w=>{w.key==="Tab"&&s.resetIdle()},[s]),v=_chunkSCDHQZFIcjs.a.call(void 0, {onMouseMove:f,onMouseEnter:b,onMouseLeave:S,onClick:T,onFocus:y,onKeyDown:x},a),k={"data-playing":s.playing||void 0,"data-paused":s.paused||void 0,"data-ended":s.ended||void 0,"data-waiting":s.waiting||void 0,"data-seeking":s.seeking||void 0,"data-fullscreen":s.fullscreen||void 0,"data-pip":s.pictureInPicture||void 0,"data-muted":s.muted||void 0,"data-idle":s.idle||void 0},L=l!==!1&&s.idle&&(l==="always"||l==="fullscreen"&&s.fullscreen),M=d.useId();return _jsxruntime.jsxs.call(void 0, "div",{...v,ref:p,tabIndex:r==="focused"?0:void 0,className:n,style:o,"data-video-player-scope":M,...k,children:[L&&_jsxruntime.jsx.call(void 0, "style",{children:`[data-video-player-scope="${M}"], [data-video-player-scope="${M}"] * { cursor: none !important; }`}),u]})});function Tn(...c){return d.useCallback(e=>{for(let r of c)typeof r=="function"?r(e):r!=null&&(r.current=e)},c)}var qe=(o=>(o.progress="--seek-progress",o.buffered="--seek-buffered",o.currentTime="--seek-current-time",o.duration="--seek-duration",o.hoverProgress="--seek-hover-progress",o.hoverTime="--seek-hover-time",o))(qe||{});var Xe=(u=>(u.seeking="data-seeking",u.hovering="data-hovering",u.pressing="data-pressing",u.dragging="data-dragging",u))(Xe||{});var _slider = require('@base-ui/react/slider');var _react2 = require('@floating-ui/react');var Ye=(u=>(u.open="data-open",u.closed="data-closed",u.startingStyle="data-starting-style",u.endingStyle="data-ending-style",u))(Ye||{});var ft=R.createContext(null);function Er(c){let e=R.useContext(ft);if(!e)throw new Error(`${c} must be used within SeekSlider`);return e}function Cr(c){return c==="ArrowRight"||c==="ArrowLeft"}var Br=R.forwardRef(function(e,r){let{render:l,children:u,onPointerMove:n,onPointerLeave:o,onPointerDown:a,onKeyUp:t,onValueCommitted:s,...p}=e,i=P("SeekSlider"),f=R.useRef(null),[b,S]=R.useState(null),[T,y]=R.useState(!1),[x,v]=R.useState(!1),k=R.useRef(!1);R.useEffect(()=>{if(!T)return;let g=()=>{y(!1),v(!1),k.current=!1,i.endSeekInteraction()};return window.addEventListener("pointerup",g),()=>window.removeEventListener("pointerup",g)},[T,i]);let L=i.duration>0?i.currentTime/i.duration*100:0,M=R.useCallback((g,A)=>{let W=typeof g=="number"?g:g[0];W!==void 0&&(A.reason==="keyboard"&&i.beginSeekInteraction(),i.seek(W),i.resetIdle(),k.current&&v(!0))},[i]),w=R.useCallback(g=>{if(_optionalChain([n, 'optionalCall', _29 => _29(g)]),!f.current||i.duration===0)return;let A=f.current.getBoundingClientRect(),W=g.clientX-A.left,J=Math.max(0,Math.min(1,W/A.width))*i.duration;i.setHoverTime(J)},[n,i]),H=R.useCallback(g=>{_optionalChain([o, 'optionalCall', _30 => _30(g)]),i.setHoverTime(null)},[o,i]),Q=R.useCallback(g=>{_optionalChain([a, 'optionalCall', _31 => _31(g)]),y(!0),k.current=!0,i.beginSeekInteraction()},[a,i]),D=R.useCallback(g=>{_optionalChain([t, 'optionalCall', _32 => _32(g)]),Cr(g.key)&&i.endSeekInteraction()},[t,i]),h=R.useCallback((g,A)=>{let W=typeof g=="number"?g:g[0];W!==void 0&&(_optionalChain([s, 'optionalCall', _33 => _33(W,A)]),y(!1),v(!1),k.current=!1,!(A.reason==="keyboard"&&Cr(A.event.key))&&i.endSeekInteraction())},[s,i]),$=R.useMemo(()=>{if(!i.buffered||i.buffered.length===0)return 0;for(let g=0;g<i.buffered.length;g++)if(i.buffered.start(g)<=i.currentTime&&i.currentTime<=i.buffered.end(g))return i.buffered.end(g);return i.buffered.end(0)},[i.buffered,i.currentTime]),U=i.duration>0?$/i.duration*100:0;R.useLayoutEffect(()=>{typeof r=="function"?r(f.current):r&&(r.current=f.current)});let q={currentTime:i.currentTime,duration:i.duration,progress:L,seeking:i.seeking,pressing:T,dragging:x,hoverTime:i.hoverTime,hoverProgress:i.hoverProgress},_=i.hoverProgress!==null,z=_nullishCoalesce(i.hoverProgress, () => (0)),Z=R.useMemo(()=>({sliderRef:f,previewThumbElement:b,setPreviewThumbElement:S,hoverProgress:z,open:_}),[f,b,S,z,_]),B={position:"relative","--seek-progress":`${L}%`,"--seek-buffered":`${U}%`,"--seek-current-time":i.currentTime,"--seek-duration":i.duration,"--seek-hover-progress":i.hoverProgress!==null?`${i.hoverProgress}%`:void 0,"--seek-hover-time":_nullishCoalesce(i.hoverTime, () => (void 0)),...p.style},I={"data-seeking":i.seeking||void 0,"data-hovering":i.hoverTime!==null||void 0,"data-pressing":T||void 0,"data-dragging":x||void 0,style:B};return l?_jsxruntime.jsx.call(void 0, ft.Provider,{value:Z,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:f,min:0,max:i.duration||100,step:.1,value:i.currentTime,onValueChange:M,onValueCommitted:h,onPointerMove:w,onPointerLeave:H,onPointerDown:Q,onKeyUp:D,"aria-label":"Seek",render:g=>l({...g,...I,style:{...g.style,...I.style}},q)})}):_jsxruntime.jsx.call(void 0, ft.Provider,{value:Z,children:_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:f,min:0,max:i.duration||100,step:.1,value:i.currentTime,onValueChange:M,onValueCommitted:h,onPointerMove:w,onPointerLeave:H,onPointerDown:Q,onKeyUp:D,"aria-label":"Seek",...I,...p,children:_nullishCoalesce(u, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{style:{position:"relative"},children:[_jsxruntime.jsx.call(void 0, "div",{style:{position:"absolute",left:0,top:0,height:"100%",width:`${U}%`}}),_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})})}),Vr=_slider.Slider.Control,wr=R.forwardRef(function(e,r){let{render:l,children:u,style:n,...o}=e,a={},t={position:"relative",...n},s={ref:r,style:t};return l?_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{render:p=>l({...p,...s},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:r,style:t,...o,children:u})}),Lr=R.forwardRef(function(e,r){let{render:l,children:u,style:n,...o}=e,a=P("SeekSliderProgress"),s={progress:a.duration>0?a.currentTime/a.duration*100:0},p={height:"100%",...n},i={ref:r,style:p};return l?_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{render:f=>l({...f,...i,style:{...f.style,...p}},s)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:r,style:p,...o,children:u})}),Hr=R.forwardRef(function(e,r){let{render:l,children:u,style:n,...o}=e,a={},t={ref:r,style:_nullishCoalesce(n, () => ({}))};return l?_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{render:s=>l({...s,...t,style:{...s.style,...n}},a)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:r,style:n,...o,children:u})}),Ir=R.forwardRef(function(e,r){let{render:l,children:u,...n}=e,o=P("SeekSliderBuffered"),a=R.useMemo(()=>{if(!o.buffered||o.buffered.length===0)return 0;for(let f=0;f<o.buffered.length;f++)if(o.buffered.start(f)<=o.currentTime&&o.currentTime<=o.buffered.end(f))return o.buffered.end(f);return o.buffered.end(0)},[o.buffered,o.currentTime]),t=o.duration>0?a/o.duration*100:0,s={bufferedPercentage:t},p={position:"absolute",left:0,top:0,height:"100%",width:`${t}%`,...n.style},i={ref:r,style:p};return l?l(i,s):_jsxruntime.jsx.call(void 0, "div",{...i,...n,children:u})}),Dr=R.forwardRef(function(e,r){let{keepMounted:l=!1,render:u,children:n,...o}=e,a=P("SeekSliderPreviewThumb"),t=Er("SeekSliderPreviewThumb"),s=a.hoverProgress!==null,p=R.useRef(0);a.hoverProgress!==null&&(p.current=a.hoverProgress);let i=_nullishCoalesce(a.hoverProgress, () => (p.current)),{mounted:f,transitionStatus:b,elementRef:S}=Y({open:s,keepMounted:l}),T=R.useCallback(k=>{S.current=k,t.setPreviewThumbElement(k),typeof r=="function"?r(k):r&&(r.current=k)},[r,S,t]),y={open:s,transitionStatus:b,hoverProgress:i},x={position:"absolute",left:`${i}%`,transform:"translateX(-50%)",pointerEvents:"none",...o.style},v={ref:T,style:x,"data-open":s||void 0,"data-closed":!s||void 0,"data-starting-style":b==="starting"||void 0,"data-ending-style":b==="ending"||void 0};return f?u?u(v,y):_jsxruntime.jsx.call(void 0, "span",{...v,...o,children:n}):null}),Or=R.forwardRef(function(e,r){let{render:l,children:u,style:n,...o}=e,a=P("SeekSliderHover"),t=a.hoverProgress!==null,s=_nullishCoalesce(a.hoverProgress, () => (0)),p={hovering:t,hoverProgress:a.hoverProgress,hoverTime:a.hoverTime},i={position:"absolute",left:0,top:0,height:"100%",width:`${s}%`,pointerEvents:"none",...n},f={ref:r,style:i,"data-hovering":t||void 0};return l?l(f,p):_jsxruntime.jsx.call(void 0, "div",{...f,...o,children:u})});function Ge({children:c,container:e}){let r=P("SeekSliderPreviewTooltipPortal"),[l,u]=R.useState(!1);if(R.useEffect(()=>{u(!0)},[]),!l)return null;let n=_nullishCoalesce(_nullishCoalesce(e, () => (r.rootRef.current)), () => (document.body));return Mr.createPortal(c,n)}var ze=R.forwardRef(function(e,r){let{sideOffset:l=8,collisionPadding:u=0,collisionBoundary:n,keepMounted:o=!1,children:a,style:t,...s}=e,p=Er("SeekSliderPreviewTooltipPositioner"),{previewThumbElement:i,open:f,hoverProgress:b}=p,[S,T]=R.useState(null),{refs:y,floatingStyles:x,update:v}=_react2.useFloating.call(void 0, {placement:"top",middleware:[_react2.offset.call(void 0, l),_react2.shift.call(void 0, {boundary:n,padding:u})]});R.useLayoutEffect(()=>{i&&y.setReference(i)},[i,y]),R.useEffect(()=>{if(f&&i&&S)return _react2.autoUpdate.call(void 0, i,S,v)},[f,i,S,v]),R.useLayoutEffect(()=>{f&&i&&S&&v()},[b,f,i,S,v]);let k=R.useCallback(M=>{y.setFloating(M),T(M),typeof r=="function"?r(M):r&&(r.current=M)},[y,r]);return(o||f)&&!!i?_jsxruntime.jsx.call(void 0, "div",{ref:k,style:{...x,...t},"data-seek-slider-preview-tooltip-positioner":!0,"data-open":f||void 0,"data-closed":!f||void 0,...s,children:a}):null}),Je=R.forwardRef(function(e,r){let{children:l,...u}=e;return _jsxruntime.jsx.call(void 0, "div",{ref:r,"data-seek-slider-preview-tooltip-popup":!0,...u,children:l})});function me({sideOffset:c,collisionPadding:e,collisionBoundary:r,keepMounted:l,container:u,children:n,...o}){return _jsxruntime.jsx.call(void 0, Ge,{container:u,children:_jsxruntime.jsx.call(void 0, ze,{sideOffset:c,collisionPadding:e,collisionBoundary:r,keepMounted:l,children:_jsxruntime.jsx.call(void 0, Je,{...o,children:n})})})}me.Portal=Ge;me.Positioner=ze;me.Popup=Je;var Ze=(l=>(l.loading="data-loading",l.ready="data-ready",l.error="data-error",l))(Ze||{});var Ar=F.forwardRef(function(e,r){let{time:l,crossOrigin:u="anonymous",render:n,children:o,width:a,height:t,...s}=e,p=P("Thumbnail"),i=F.useRef(null),f=F.useRef(null),b=F.useRef(null),[S,T]=F.useState("idle"),[y,x]=F.useState({width:160,height:90}),v=l!==void 0?l:p.hoverTime,k=F.useMemo(()=>{let h=p.videoRef.current;return h?h.currentSrc||h.src:null},[p.videoRef]);F.useEffect(()=>{if(!k)return;let h=document.createElement("video");h.src=k,h.crossOrigin=u,h.preload="metadata",h.muted=!0,h.playsInline=!0;let $=()=>{x({width:h.videoWidth,height:h.videoHeight})},U=()=>{T("error")};return h.addEventListener("loadedmetadata",$),h.addEventListener("error",U),f.current=h,()=>{h.removeEventListener("loadedmetadata",$),h.removeEventListener("error",U),h.src="",f.current=null}},[k,u]),F.useEffect(()=>{let h=f.current,$=i.current;if(!h||!$||v===null||v===void 0||b.current!==null&&Math.abs(b.current-v)<.1)return;T("loading");let U=()=>{let q=$.getContext("2d");if(q)try{q.drawImage(h,0,0,$.width,$.height),b.current=v,T("ready")}catch (e3){T("error")}};return h.addEventListener("seeked",U,{once:!0}),h.currentTime=v,()=>{h.removeEventListener("seeked",U)}},[v]);let L=F.useCallback(h=>{i.current=h,typeof r=="function"?r(h):r&&(r.current=h)},[r]),M=y.width/y.height,w=_nullishCoalesce(a, () => (160)),H=_nullishCoalesce(t, () => (Math.round(w/M)));typeof w=="string"&&(w=160),typeof H=="string"&&(H=90);let Q={loading:S==="loading",ready:S==="ready",error:S==="error",time:v,videoWidth:y.width,videoHeight:y.height},D={ref:L,width:w,height:H,"data-loading":S==="loading"||void 0,"data-ready":S==="ready"||void 0,"data-error":S==="error"||void 0};return n?n(D,Q):_jsxruntime.jsx.call(void 0, "canvas",{...D,...s,children:o})});var et=(e=>(e.hovering="data-hovering",e))(et||{});var Wr=tt.forwardRef(function(e,r){let{format:l="current / duration",fixedWidth:u=!0,align:n="left",render:o,...a}=e,t=P("TimeDisplay"),s=tt.useRef(0);t.hoverTime!==null&&(s.current=t.hoverTime);let p=t.duration-t.currentTime,i=Pe(t.currentTime),f=Pe(t.duration),b=Pe(p),S=t.hoverTime!==null?Pe(t.hoverTime):Pe(s.current),T={currentTime:t.currentTime,duration:t.duration,remaining:p,hoverTime:t.hoverTime,hovering:t.hoverTime!==null,formattedCurrent:i,formattedDuration:f,formattedRemaining:b,formattedHover:S},y=()=>{switch(l){case"current":return i;case"duration":return f;case"remaining":return`-${b}`;case"current / duration":return`${i} / ${f}`;case"current / remaining":return`${i} / -${b}`;case"hover":return S;default:return`${i} / ${f}`}},x=()=>{let k=Ln(t.duration);switch(l){case"current":case"duration":case"hover":return k;case"remaining":return`-${k}`;case"current / duration":return`${k} / ${k}`;case"current / remaining":return`${k} / -${k}`;default:return`${k} / ${k}`}},v={ref:r,style:{position:u?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},"data-hovering":T.hovering||void 0};return o?o(v,T):_jsxruntime.jsx.call(void 0, "span",{ref:r,"data-hovering":T.hovering||void 0,...a,style:{position:u?"relative":void 0,userSelect:"none",fontVariantNumeric:"tabular-nums",...a.style},children:u?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, "span",{"aria-hidden":!0,style:{visibility:"hidden"},children:x()}),_jsxruntime.jsx.call(void 0, "span",{style:wn(n),children:y()})]}):y()})});function wn(c){let e={position:"absolute"};switch(c){case"left":return{...e,left:0};case"right":return{...e,right:0};case"center":return{...e,left:"50%",transform:"translateX(-50%)"}}}function Pe(c){if(!Number.isFinite(c)||Number.isNaN(c))return"0:00";let e=Math.floor(c/3600),r=Math.floor(c%3600/60),l=Math.floor(c%60);return e>0?`${e}:${r.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`:`${r}:${l.toString().padStart(2,"0")}`}function Ln(c){if(!Number.isFinite(c)||Number.isNaN(c)||c<=0)return"0:00";let e=Math.floor(c/3600),r=Math.floor(c%3600/60);if(e>0){let u=String(e).length;return`${"0".repeat(u)}:00:00`}let l=String(r).length;return`${"0".repeat(l)}:00`}var Fr=K.forwardRef(function(e,r){let{kind:l="captions",src:u,label:n,srcLang:o,default:a,...t}=e,{registerTrack:s,unregisterTrack:p,updateTrackRef:i,setTextTrack:f}=P("Track"),b=K.useRef(null),S=K.useId(),T=K.useCallback(y=>{typeof r=="function"?r(y):r&&(r.current=y),b.current=y},[r]);return K.useEffect(()=>(s({id:S,kind:l,label:n,srcLang:o,src:u,textTrack:null}),()=>{p(S)}),[S,l,n,o,u,s,p]),K.useEffect(()=>{let y=b.current;if(!y)return;let x=()=>{y.track&&(y.track.mode="disabled",i(S,y.track),a&&f(y.track))};return y.track&&x(),y.addEventListener("load",x),()=>{y.removeEventListener("load",x)}},[S,a,i,f]),_jsxruntime.jsx.call(void 0, "track",{ref:T,kind:l,src:u,label:n,srcLang:o,default:a,...t})});var Qr=de.forwardRef(function(e,r){let{toggleOnClick:l=!0,...u}=e,n=P("Video"),o=de.useRef(!1),a=de.useCallback(p=>{typeof r=="function"?r(p):r&&(r.current=p),n.videoRef.current=p,p&&!o.current&&(o.current=!0,n._handlers.onVideoMount(),p.readyState>=1&&p.duration&&(n._handlers.onLoadedMetadata(),n._handlers.onDurationChange()),p.readyState>=3&&n._handlers.onCanPlay())},[r,n.videoRef,n._handlers]),t={"data-playing":n.playing||void 0,"data-paused":n.paused||void 0,"data-ended":n.ended||void 0,"data-waiting":n.waiting||void 0,"data-seeking":n.seeking||void 0},s=_chunkSCDHQZFIcjs.a.call(void 0, {ref:a,preload:"metadata",...t,onClick(){l&&n.toggle()},onTimeUpdate:n._handlers.onTimeUpdate,onDurationChange:n._handlers.onDurationChange,onProgress:n._handlers.onProgress,onPlay:n._handlers.onPlay,onPause:n._handlers.onPause,onEnded:n._handlers.onEnded,onWaiting:n._handlers.onWaiting,onCanPlay:n._handlers.onCanPlay,onSeeking:n._handlers.onSeeking,onSeeked:n._handlers.onSeeked,onVolumeChange:n._handlers.onVolumeChange,onLoadedMetadata:n._handlers.onLoadedMetadata},u);return _jsxruntime.jsx.call(void 0, "video",{...s})});var rt=(r=>(r.volume="--volume",r.volumePercentage="--volume-percentage",r))(rt||{});var nt=(u=>(u.muted="data-muted",u.volume="data-volume",u.pressing="data-pressing",u.dragging="data-dragging",u))(nt||{});var $r=O.forwardRef(function(e,r){let{render:l,children:u,onPointerDown:n,...o}=e,a=P("VolumeSlider"),t=O.useRef(null),[s,p]=O.useState(!1),[i,f]=O.useState(!1),b=O.useRef(!1);O.useEffect(()=>{if(!s)return;let M=()=>{p(!1),f(!1),b.current=!1};return window.addEventListener("pointerup",M),()=>window.removeEventListener("pointerup",M)},[s]),O.useLayoutEffect(()=>{typeof r=="function"?r(t.current):r&&(r.current=t.current)});let S=a.volume*100,T={volume:a.volume,muted:a.muted,percentage:S,pressing:s,dragging:i},y=O.useCallback(M=>{let w=typeof M=="number"?M:M[0];if(w!==void 0){if(a.muted){let H=a.videoRef.current;H&&(H.muted=!1)}a.setVolume(w),a.resetIdle(),b.current&&f(!0)}},[a]),x=O.useCallback(M=>{_optionalChain([n, 'optionalCall', _34 => _34(M)]),p(!0),b.current=!0},[n]),v={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":s||void 0,"data-dragging":i||void 0},k={position:"relative","--volume":a.volume,"--volume-percentage":`${S}%`,...o.style},L={"data-muted":a.muted||void 0,"data-volume":a.volume,"data-pressing":s||void 0,"data-dragging":i||void 0,style:k};return l?_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:t,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:y,onPointerDown:x,"aria-label":"Volume",render:M=>l({...M,...L},T)}):_jsxruntime.jsx.call(void 0, _slider.Slider.Root,{ref:t,min:0,max:1,step:.01,value:a.muted?0:a.volume,onValueChange:y,onPointerDown:x,"aria-label":"Volume",...v,...o,style:k,children:_nullishCoalesce(u, () => (_jsxruntime.jsx.call(void 0, _slider.Slider.Control,{children:_jsxruntime.jsxs.call(void 0, _slider.Slider.Track,{children:[_jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{}),_jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{})]})})))})}),Nr=_slider.Slider.Control,jr=O.forwardRef(function(e,r){let{style:l,...u}=e,n={position:"relative",...l};return _jsxruntime.jsx.call(void 0, _slider.Slider.Track,{ref:r,style:n,...u})}),Ur=O.forwardRef(function(e,r){return _jsxruntime.jsx.call(void 0, _slider.Slider.Indicator,{ref:r,...e})}),_r=O.forwardRef(function(e,r){return _jsxruntime.jsx.call(void 0, _slider.Slider.Thumb,{ref:r,...e})});exports.VideoPlayer = Kr; exports.useVideoPlayer = ie;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../rolldown-runtime-5lHFv1cW.cjs"),t=require("../resolve-state-props-C-zbhdXd.cjs"),n=require("../merge-element-props-0mpNO7ZH.cjs");let r=require("react");r=e.n(r,1);let i=require("react/jsx-runtime"),a=require("react-dom");a=e.n(a,1);let o=require("@base-ui/react/slider"),s=require("@floating-ui/react");const c=r.createContext(null);function l(e){let t=r.useContext(c);if(!t)throw Error(`<VideoPlayer.${e}> must be used within <VideoPlayer.Root>`);return t}function u(){return l(`useVideoPlayer`)}const d=r.forwardRef(function(e,t){let{render:n,...a}=e,o=l(`BufferedIndicator`),s=r.useMemo(()=>{if(!o.buffered||o.buffered.length===0)return 0;for(let e=0;e<o.buffered.length;e++)if(o.buffered.start(e)<=o.currentTime&&o.currentTime<=o.buffered.end(e))return o.buffered.end(e);return o.buffered.end(0)},[o.buffered,o.currentTime]),c=o.duration>0?s/o.duration*100:0,u={buffered:o.buffered,duration:o.duration,bufferedPercentage:c,bufferedEnd:s},d={"--buffered-percentage":`${c}%`,"--buffered-end":s,...a.style};return n?n({ref:t,style:d,"aria-hidden":!0},u):/* @__PURE__ */ (0,i.jsx)(`div`,{ref:t,"aria-hidden":`true`,...a,style:d})});let f=/* @__PURE__ */ function(e){return e.active=`data-active`,e}({});const p=r.forwardRef(function(e,t){let{render:n,children:r,...a}=e,o=l(`Captions`).activeCues,s=o.map(e=>e.text).join(`
|
|
2
|
+
`),c=o.length>0,u={active:c,cueText:s,cues:o},d={ref:t,"aria-live":`polite`,"aria-atomic":!0,role:`status`,style:{pointerEvents:`none`},"data-active":c||void 0};return n?n(d,u):r?/* @__PURE__ */ (0,i.jsx)(`div`,{...d,...a,children:r}):/* @__PURE__ */ (0,i.jsx)(`div`,{...d,...a,children:s})}),m=r.forwardRef(function(e,t){let{render:r,...a}=e,o=l(`CaptionsButton`),s=o.registeredTracks.length>0,c=o.activeTextTrack!==null,u={active:c,available:s,trackCount:o.registeredTracks.length},d=n.t({ref:t,type:`button`,"aria-label":c?`Disable captions`:`Enable captions`,"aria-pressed":c,disabled:!s,"data-active":c||void 0,"data-available":s||void 0,onClick(){if(c)o.setTextTrack(null);else if(o.registeredTracks.length>0){let e=o.registeredTracks[0];e?.textTrack&&o.setTextTrack(e.textTrack)}}},a);return r?r(d,u):/* @__PURE__ */ (0,i.jsx)(`button`,{...d})}),h=r.forwardRef(function(e,t){let{render:n,children:r,...a}=e,o=l(`CaptionsMenu`),s={registeredTracks:o.registeredTracks,activeTextTrack:o.activeTextTrack},c={ref:t,role:`menu`,"aria-label":`Captions`,"data-active":o.activeTextTrack!==null||void 0};return n?n(c,s):/* @__PURE__ */ (0,i.jsx)(`div`,{...c,...a,children:r??/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(g,{track:null,children:`Off`}),o.registeredTracks.map(e=>/* @__PURE__ */ (0,i.jsx)(g,{track:e.textTrack,children:e.label},e.id))]})})}),g=r.forwardRef(function(e,t){let{track:r,children:a,...o}=e,s=l(`CaptionsMenuItem`),c=s.activeTextTrack===r,u=n.t({ref:t,type:`button`,role:`menuitemradio`,"aria-checked":c,"data-active":c||void 0,onClick(){s.setTextTrack(r)}},o);return/* @__PURE__ */ (0,i.jsx)(`button`,{...u,children:a})});let _=/* @__PURE__ */ function(e){return e.open=`data-open`,e.closed=`data-closed`,e.idle=`data-idle`,e.playing=`data-playing`,e.paused=`data-paused`,e.ended=`data-ended`,e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({});function v(e){let t=[...e.getAnimations(),...Array.from(e.querySelectorAll(`*`)).flatMap(e=>e.getAnimations())];return t.length===0?Promise.resolve():Promise.all(t.map(e=>e.finished)).then(()=>{}).catch(()=>{})}function y(e){let{open:t,keepMounted:n=!1}=e,[i,a]=r.useState(t||n),[o,s]=r.useState(t?`starting`:void 0),c=r.useRef(null),l=r.useRef(!1);return r.useEffect(()=>{if(t){l.current=!1,a(!0),s(`starting`);let e=requestAnimationFrame(()=>{requestAnimationFrame(()=>{s(void 0)})});return()=>cancelAnimationFrame(e)}},[t]),r.useEffect(()=>{if(!t&&i&&!l.current){s(`ending`);let e=c.current;if(!e){s(void 0),n||a(!1);return}l.current=!0;let t=requestAnimationFrame(()=>{requestAnimationFrame(()=>{v(e).then(()=>{l.current&&(l.current=!1,s(void 0),n||a(!1))})})});return()=>{cancelAnimationFrame(t)}}},[t,i,n]),r.useEffect(()=>{n&&!i&&!t&&a(!0)},[n,i,t]),{mounted:i||n,transitionStatus:o,elementRef:c}}const b=r.forwardRef(function(e,t){let{idleTimeout:n,keepMounted:a=!1,render:o,children:s,...c}=e,u=l(`Controls`),d=(n??u.idleTimeout)===0||!u.idle,{mounted:f,transitionStatus:p,elementRef:m}=y({open:d,keepMounted:a}),h=r.useCallback(e=>{m.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t,m]),{onClick:g,..._}=c,v=r.useCallback(e=>{e.stopPropagation(),g?.(e)},[g]),b={open:d,idle:u.idle,playing:u.playing,paused:u.paused,ended:u.ended},x={ref:h,onClick:v,"data-open":d||void 0,"data-closed":!d||void 0,"data-idle":u.idle||void 0,"data-playing":u.playing||void 0,"data-paused":u.paused||void 0,"data-ended":u.ended||void 0,"data-starting-style":p===`starting`||void 0,"data-ending-style":p===`ending`||void 0};return f?o?o(x,b):/* @__PURE__ */ (0,i.jsx)(`div`,{...x,..._,children:s}):null}),x=r.forwardRef(function(e,t){let{render:a,children:o,...s}=e,c=l(`FullscreenButton`),[u,d]=r.useState(!1);r.useEffect(()=>{d(`fullscreenEnabled`in document&&document.fullscreenEnabled)},[]);let f={fullscreen:c.fullscreen,supported:u},p=n.t({ref:t,type:`button`,"aria-label":c.fullscreen?`Exit fullscreen`:`Enter fullscreen`,"aria-pressed":c.fullscreen,disabled:!u,"data-fullscreen":c.fullscreen||void 0,"data-supported":u||void 0,onClick(){c.toggleFullscreen()}},s);return a?a(p,f):/* @__PURE__ */ (0,i.jsx)(`button`,{...p,children:o})}),S=r.forwardRef(function(e,t){let{render:r,...a}=e,o=l(`MuteButton`),s={muted:o.muted,volume:o.volume},c=o.volume,u=o.muted,d=c===0||u,f=c>0&&!u,p=!u&&c>0&&c<.5,m=!u&&c>=.5,h=n.t({ref:t,type:`button`,"aria-label":o.muted?`Unmute`:`Mute`,"aria-pressed":o.muted,"data-muted":u||void 0,"data-volume-off":d||void 0,"data-volume-on":f||void 0,"data-volume-low":p||void 0,"data-volume-high":m||void 0,onClick(){o.toggleMute()}},a);return r?r(h,s):/* @__PURE__ */ (0,i.jsx)(`button`,{...h})});let C=/* @__PURE__ */ function(e){return e.open=`data-open`,e.closed=`data-closed`,e.playing=`data-playing`,e.paused=`data-paused`,e.ended=`data-ended`,e.waiting=`data-waiting`,e.seeking=`data-seeking`,e.fullscreen=`data-fullscreen`,e.pip=`data-pip`,e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({});const w=r.forwardRef(function(e,t){let{idleTimeout:a,keepMounted:o=!1,render:s,children:c,...u}=e,d=l(`Overlay`),f=(a??d.idleTimeout)===0||!d.idle,{mounted:p,transitionStatus:m,elementRef:h}=y({open:f,keepMounted:o}),g=r.useCallback(e=>{h.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t,h]),_={playing:d.playing,paused:d.paused,ended:d.ended,waiting:d.waiting,seeking:d.seeking,fullscreen:d.fullscreen,pictureInPicture:d.pictureInPicture,open:f},v=n.t({ref:g,onClick(){d.toggle()},"data-playing":d.playing||void 0,"data-paused":d.paused||void 0,"data-ended":d.ended||void 0,"data-waiting":d.waiting||void 0,"data-seeking":d.seeking||void 0,"data-fullscreen":d.fullscreen||void 0,"data-pip":d.pictureInPicture||void 0,"data-open":f||void 0,"data-closed":!f||void 0,"data-starting-style":m===`starting`||void 0,"data-ending-style":m===`ending`||void 0},u);return p?s?s(v,_):/* @__PURE__ */ (0,i.jsx)(`div`,{...v,...u,children:c}):null}),T=r.forwardRef(function(e,t){let{render:a,...o}=e,s=l(`PictureInPictureButton`),[c,u]=r.useState(!1);r.useEffect(()=>{u(`pictureInPictureEnabled`in document&&document.pictureInPictureEnabled)},[]);let d={pictureInPicture:s.pictureInPicture,supported:c},f=n.t({ref:t,type:`button`,"aria-label":s.pictureInPicture?`Exit picture-in-picture`:`Enter picture-in-picture`,"aria-pressed":s.pictureInPicture,disabled:!c,"data-pip":s.pictureInPicture||void 0,"data-supported":c||void 0,onClick(){s.togglePictureInPicture()}},o);return a?a(f,d):/* @__PURE__ */ (0,i.jsx)(`button`,{...f})}),E=r.forwardRef(function(e,t){let{render:r,children:a,...o}=e,s=l(`PlayButton`),c={playing:s.playing,paused:s.paused,ended:s.ended,waiting:s.waiting},u=n.t({ref:t,type:`button`,"aria-label":s.playing?`Pause`:`Play`,"data-playing":s.playing||void 0,"data-paused":s.paused||void 0,"data-ended":s.ended||void 0,"data-waiting":s.waiting||void 0,onClick(){s.toggle()}},o);return r?r(u,c):/* @__PURE__ */ (0,i.jsx)(`button`,{...u,children:a})}),D=[.25,.5,.75,1,1.25,1.5,1.75,2],O=r.forwardRef(function(e,t){let{rates:r=D,render:a,children:o,...s}=e,c=l(`PlaybackRateButton`),u={playbackRate:c.playbackRate,rates:r},d=n.t({ref:t,type:`button`,"aria-label":`Playback speed: ${c.playbackRate}x`,"data-rate":c.playbackRate,onClick(){let e=r.indexOf(c.playbackRate),t=r[(e+1)%r.length]??r[0]??c.playbackRate;c.setPlaybackRate(t)}},s);return a?a(d,u):/* @__PURE__ */ (0,i.jsx)(`button`,{...d,children:o??`${c.playbackRate}x`})}),k=[.25,.5,.75,1,1.25,1.5,1.75,2],A=r.forwardRef(function(e,t){let{rates:n=k,render:r,children:a,...o}=e,s=l(`PlaybackRateMenu`),c={playbackRate:s.playbackRate,rates:n},u={ref:t,role:`menu`,"aria-label":`Playback speed`,"data-rate":s.playbackRate};return r?r(u,c):/* @__PURE__ */ (0,i.jsx)(`div`,{...u,...o,children:a??n.map(e=>/* @__PURE__ */ (0,i.jsx)(j,{rate:e},e))})}),j=r.forwardRef(function(e,t){let{rate:r,children:a,...o}=e,s=l(`PlaybackRateMenuItem`),c=s.playbackRate===r,u=n.t({ref:t,type:`button`,role:`menuitemradio`,"aria-checked":c,"data-active":c||void 0,onClick(){s.setPlaybackRate(r)}},o);return/* @__PURE__ */ (0,i.jsx)(`button`,{...u,children:a??`${r}x`})});function M(e){let{children:t,container:n}=e,[i,o]=r.useState(!1);if(r.useEffect(()=>(o(!0),()=>o(!1)),[]),!i)return null;let s=n??(typeof document<`u`?document.body:null);return s?(0,a.createPortal)(t,s):null}const N=r.forwardRef(function(e,t){let{keepMounted:n=!1,render:r,children:a,...o}=e,s=l(`Poster`),c=!s.canPlay,u=s.canPlay,{mounted:d,transitionStatus:f,elementRef:p}=y({open:c,keepMounted:n}),m=P(t,p),h={loading:c,loaded:u,transitionStatus:f},g={ref:m,"aria-hidden":!0,"data-loading":c||void 0,"data-loaded":u||void 0,"data-starting-style":f===`starting`||void 0,"data-ending-style":f===`ending`||void 0};return d?r?r(g,h):/* @__PURE__ */ (0,i.jsx)(`div`,{...g,...o,children:a}):null});function P(...e){return r.useCallback(t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)},e)}const F=r.forwardRef(function(e,t){let{render:n,children:r,...a}=e,o=l(`QualityMenu`),s={qualities:o.qualities,activeQuality:o.activeQuality},c={ref:t,role:`menu`,"aria-label":`Video quality`,"data-quality":o.activeQuality?.label??void 0};return n?n(c,s):/* @__PURE__ */ (0,i.jsx)(`div`,{...c,...a,children:r??o.qualities.map(e=>/* @__PURE__ */ (0,i.jsx)(I,{quality:e,children:e.label},e.label))})}),I=r.forwardRef(function(e,t){let{quality:r,children:a,...o}=e,s=l(`QualityMenuItem`),c=s.activeQuality?.label===r.label,u=n.t({ref:t,type:`button`,role:`menuitemradio`,"aria-checked":c,"data-active":c||void 0,onClick(){s.setQuality(r)}},o);return/* @__PURE__ */ (0,i.jsx)(`button`,{...u,children:a})});let L=/* @__PURE__ */ function(e){return e.playing=`data-playing`,e.paused=`data-paused`,e.ended=`data-ended`,e.waiting=`data-waiting`,e.seeking=`data-seeking`,e.fullscreen=`data-fullscreen`,e.pip=`data-pip`,e.muted=`data-muted`,e.idle=`data-idle`,e}({});function R(e,t){return!(e instanceof HTMLElement)||e instanceof HTMLInputElement&&e.type===`range`&&t===` `?!1:e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable}function z(e){return e===`ArrowRight`||e===`ArrowLeft`}function B(e,t){let n=u(),i=r.useRef(n);i.current=n,r.useEffect(()=>{if(t===`none`)return;let n=e=>{if(R(e.target,e.key))return;let t=i.current;switch(e.key){case` `:e.preventDefault(),t.toggle();break;case`f`:case`F`:e.preventDefault(),t.toggleFullscreen();break;case`ArrowUp`:e.preventDefault(),t.setVolume(Math.min(t.volume+.1,1));break;case`ArrowDown`:e.preventDefault(),t.setVolume(Math.max(t.volume-.1,0));break;case`ArrowRight`:e.preventDefault(),t.beginSeekInteraction(),t.seek(Math.min(t.currentTime+5,t.duration));break;case`ArrowLeft`:e.preventDefault(),t.beginSeekInteraction(),t.seek(Math.max(t.currentTime-5,0));break;default:return}t.resetIdle()},r=e=>{z(e.key)&&i.current.endSeekInteraction()};if(t===`global`)return window.addEventListener(`keydown`,n),window.addEventListener(`keyup`,r),()=>{window.removeEventListener(`keydown`,n),window.removeEventListener(`keyup`,r)};let a=e.current;if(a)return a.addEventListener(`keydown`,n),a.addEventListener(`keyup`,r),()=>{a.removeEventListener(`keydown`,n),a.removeEventListener(`keyup`,r)}},[t,e])}function ee(e,t,n){let[i,a]=r.useState(t),o=e!==void 0,s=o?e:i;return[s,r.useCallback(e=>{let t=typeof e==`function`?e(s):e;o||a(t),n?.(t)},[o,s,n])]}function V({rootRef:e,videoRef:t,actionsRef:n,defaultPlaying:a=!1,autoPlay:o=!1,defaultVolume:s=1,defaultMuted:l=!1,defaultPlaybackRate:u=1,playing:d,onPlayingChange:f,volume:p,onVolumeChange:m,muted:h,onMutedChange:g,playbackRate:_,onPlaybackRateChange:v,currentTime:y,onCurrentTimeChange:b,idleTimeout:x=3e3,preventIdleWhenPaused:S=!1,idle:C,onIdleChange:w,onEnded:T,onWaiting:E,onSeeking:D,onSeeked:O,onFullscreenChange:k,onPictureInPictureChange:A,children:j}){let M=r.useRef(1),N=r.useRef(!1),P=r.useRef(!1),F=r.useRef(!1),[I,L]=r.useState(`paused`),[R,z]=r.useState(a?`play`:`pause`);r.useEffect(()=>{d!==void 0&&(z(d?`play`:`pause`),I!==`waiting`&&L(d?`playing`:`paused`))},[d,I]);let[B,V]=ee(p,s,m),[H,U]=ee(h,l,g),[te,ne]=ee(_,u,v),[re,W]=ee(C,!0,w),G=r.useRef(null),K=r.useCallback(()=>{G.current&&=(clearTimeout(G.current),null)},[]),ie=r.useCallback(()=>{x!==0&&(K(),G.current=setTimeout(()=>{W(!0)},x))},[x,K,W]),ae=r.useCallback(()=>{W(!1),ie()},[W,ie]),oe=r.useCallback(()=>{K(),W(!0)},[K,W]);r.useEffect(()=>(x>0&&(G.current=setTimeout(()=>{W(!0)},x)),()=>{G.current&&clearTimeout(G.current)}),[]);let se=S&&I!==`playing`?!1:re,q=r.useCallback(()=>{let e=t.current;e&&(e.muted!==H&&(e.muted=H),e.volume!==B&&(e.volume=B))},[H,t,B]),J=r.useCallback(async()=>{let e=t.current;if(o&&e&&!F.current){F.current=!0,z(`play`),q();try{await e.play(),L(`playing`),f?.(!0)}catch{z(`pause`),L(`paused`)}}},[o,f,q,t]);r.useEffect(()=>{if(!o){F.current=!1;return}J()},[o,J]);let[ce,le]=r.useState(0),[ue,Y]=r.useState(0),[de,fe]=r.useState(null),[X,pe]=r.useState(null),[me,he]=r.useState(!1),[ge,Z]=r.useState(!1),[Q,_e]=r.useState(!1),[ve,ye]=r.useState(!1),[be,xe]=r.useState([]),[$,Se]=r.useState(null),[Ce,we]=r.useState([]),[Te,Ee]=r.useState([]),[De,Oe]=r.useState(null);r.useEffect(()=>{y!==void 0&&t.current&&(t.current.currentTime=y)},[y,t]),r.useEffect(()=>{(h!==void 0||p!==void 0)&&q()},[h,p,q]),r.useEffect(()=>{let t=()=>{let t=document.fullscreenElement===e.current;_e(t),k?.(t)};return document.addEventListener(`fullscreenchange`,t),()=>document.removeEventListener(`fullscreenchange`,t)},[k,e]),r.useEffect(()=>{let e=t.current;if(!e)return;let n=()=>{ye(!0),A?.(!0)},r=()=>{ye(!1),A?.(!1)};return e.addEventListener(`enterpictureinpicture`,n),e.addEventListener(`leavepictureinpicture`,r),()=>{e.removeEventListener(`enterpictureinpicture`,n),e.removeEventListener(`leavepictureinpicture`,r)}},[A,t]);let ke=r.useCallback(async()=>{t.current&&(z(`play`),await t.current.play(),L(`playing`),f?.(!0))},[t,f]),Ae=r.useCallback(()=>{t.current&&(z(`pause`),t.current.pause(),L(`paused`),f?.(!1))},[t,f]),je=r.useCallback(async()=>{I===`playing`?Ae():await ke()},[I,ke,Ae]),Me=r.useCallback(e=>{t.current&&(t.current.currentTime=e,le(e),b?.(e))},[b,t]),Ne=r.useCallback(()=>{let e=t.current;e&&!N.current&&(N.current=!0,P.current=R===`play`,Z(!0),P.current&&!e.paused&&e.pause())},[R,t]),Pe=r.useCallback(()=>{let e=t.current;if(!e||!N.current)return;let n=P.current&&R===`play`;if(N.current=!1,P.current=!1,!n){Z(!1);return}e.play().then(()=>{L(`playing`),Z(!1)}).catch(()=>{L(`waiting`),Z(!1)})},[R,t]),Fe=r.useCallback(e=>{let n=Math.max(0,Math.min(1,e));t.current&&(t.current.volume=n),V(n)},[V,t]),Ie=r.useCallback(()=>{if(!(H||B===0))M.current=B,t.current&&(t.current.muted=!0),U(!0);else{let e=M.current>0?M.current:1;t.current&&(t.current.volume=e,t.current.muted=!1),V(e),U(!1)}},[H,B,U,V,t]),Le=r.useCallback(async()=>{e.current?.requestFullscreen&&await e.current.requestFullscreen()},[e]),Re=r.useCallback(async()=>{document.exitFullscreen&&await document.exitFullscreen()},[]),ze=r.useCallback(async()=>{Q?await Re():await Le()},[Q,Le,Re]),Be=r.useCallback(async()=>{t.current?.requestPictureInPicture&&await t.current.requestPictureInPicture()},[t]),Ve=r.useCallback(async()=>{document.pictureInPictureElement&&await document.exitPictureInPicture()},[]),He=r.useCallback(async()=>{ve?await Ve():await Be()},[ve,Be,Ve]),Ue=r.useCallback(e=>{t.current&&(t.current.playbackRate=e),ne(e)},[ne,t]),We=r.useCallback(e=>{if(t.current){for(let e=0;e<t.current.textTracks.length;e++){let n=t.current.textTracks[e];n&&(n.mode=`disabled`)}e&&(e.mode=`hidden`)}Se(e),we([])},[t]),Ge=r.useCallback(e=>{Oe(e)},[]),Ke=r.useCallback(e=>{xe(t=>t.some(t=>t.id===e.id)?t:[...t,e])},[]),qe=r.useCallback(e=>{xe(t=>t.filter(t=>t.id!==e))},[]),Je=r.useCallback((e,t)=>{xe(n=>n.map(n=>n.id===e?{...n,textTrack:t}:n))},[]);r.useEffect(()=>{if(!$){we([]);return}let e=()=>{let e=$.activeCues;if(!e){we([]);return}let t=[];for(let n=0;n<e.length;n++){let r=e[n];r instanceof VTTCue&&t.push(r)}we(t)};return e(),$.addEventListener(`cuechange`,e),()=>{$.removeEventListener(`cuechange`,e)}},[$]),r.useImperativeHandle(n,()=>({toggle:je,seek:Me,setVolume:Fe,toggleFullscreen:ze}),[je,Me,Fe,ze]);let Ye=r.useCallback(()=>{if(t.current){let e=t.current.currentTime;le(e),b?.(e)}},[b,t]),Xe=r.useCallback(()=>{t.current&&Y(t.current.duration)},[t]),Ze=r.useCallback(()=>{t.current&&fe(t.current.buffered)},[t]),Qe=r.useCallback(()=>{z(`play`),L(`playing`),f?.(!0)},[f]),$e=r.useCallback(()=>{N.current||I!==`ended`&&(L(`paused`),f?.(!1))},[I,f]),et=r.useCallback(()=>{z(`pause`),L(`ended`),f?.(!1),T?.()},[f,T]),tt=r.useCallback(()=>{N.current||(L(`waiting`),E?.())},[E]),nt=r.useCallback(()=>{if(N.current){he(!0);return}if(I===`waiting`){let e=R===`play`?`playing`:`paused`;L(e),f?.(e===`playing`)}he(!0)},[I,R,f]),rt=r.useCallback(()=>{Z(!0),I===`ended`&&L(`paused`),D?.()},[I,D]),it=r.useCallback(()=>{if(Z(!1),t.current){let{currentTime:e,duration:n}=t.current;n>0&&n-e<.01&&L(`ended`)}O?.()},[O,t]),at=r.useCallback(()=>{t.current&&(V(t.current.volume),U(t.current.muted))},[V,U,t]),ot=r.useCallback(()=>{t.current&&Y(t.current.duration)},[t]),st=r.useCallback(()=>{q(),J()},[J,q]),ct=r.useMemo(()=>({playbackStatus:I,playbackIntent:R,playing:I===`playing`,paused:I===`paused`,ended:I===`ended`,waiting:I===`waiting`,seeking:ge,canPlay:me,currentTime:ce,duration:ue,buffered:de,hoverTime:X,hoverProgress:X!==null&&ue>0?X/ue*100:null,volume:B,muted:H,fullscreen:Q,pictureInPicture:ve,idle:se,idleTimeout:x,preventIdleWhenPaused:S,registeredTracks:be,activeTextTrack:$,activeCues:Ce,playbackRate:te,qualities:Te,activeQuality:De,videoRef:t,rootRef:e,play:ke,pause:Ae,toggle:je,seek:Me,setVolume:Fe,toggleMute:Ie,enterFullscreen:Le,exitFullscreen:Re,toggleFullscreen:ze,enterPictureInPicture:Be,exitPictureInPicture:Ve,togglePictureInPicture:He,setPlaybackRate:Ue,setTextTrack:We,setQuality:Ge,registerTrack:Ke,unregisterTrack:qe,updateTrackRef:Je,resetIdle:ae,setHoverTime:pe,beginSeekInteraction:Ne,endSeekInteraction:Pe,_handlers:{onTimeUpdate:Ye,onDurationChange:Xe,onProgress:Ze,onPlay:Qe,onPause:$e,onEnded:et,onWaiting:tt,onCanPlay:nt,onSeeking:rt,onSeeked:it,onVolumeChange:at,onLoadedMetadata:ot,onVideoMount:st,onRootMouseLeave:oe}}),[I,R,ge,me,ce,ue,de,X,B,H,Q,ve,se,x,S,be,$,Ce,te,Te,De,t,e,ke,Ae,je,Me,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,Ge,Ke,qe,Je,ae,Ne,Pe,Ye,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,st,oe]);return/* @__PURE__ */ (0,i.jsx)(c.Provider,{value:ct,children:j})}const H=r.forwardRef(function(e,t){let{actionsRef:n,keyboardShortcuts:a=`focused`,defaultPlaying:o,autoPlay:s,defaultVolume:c,defaultMuted:l,defaultPlaybackRate:u,playing:d,onPlayingChange:f,volume:p,onVolumeChange:m,muted:h,onMutedChange:g,playbackRate:_,onPlaybackRateChange:v,currentTime:y,onCurrentTimeChange:b,idleTimeout:x,preventIdleWhenPaused:S,hideCursorWhenIdle:C=`fullscreen`,idle:w,onIdleChange:T,onEnded:E,onWaiting:D,onSeeking:O,onSeeked:k,onFullscreenChange:A,onPictureInPictureChange:j,children:M,...N}=e,P=r.useRef(null),F=r.useRef(null);return/* @__PURE__ */ (0,i.jsx)(V,{actionsRef:n,defaultPlaying:o,autoPlay:s,defaultVolume:c,defaultMuted:l,defaultPlaybackRate:u,playing:d,onPlayingChange:f,volume:p,onVolumeChange:m,muted:h,onMutedChange:g,playbackRate:_,onPlaybackRateChange:v,currentTime:y,onCurrentTimeChange:b,idleTimeout:x,preventIdleWhenPaused:S,idle:w,onIdleChange:T,onEnded:E,onWaiting:D,onSeeking:O,onSeeked:k,onFullscreenChange:A,onPictureInPictureChange:j,rootRef:P,videoRef:F,children:/* @__PURE__ */ (0,i.jsx)(U,{ref:t,rootRef:P,keyboardShortcuts:a,hideCursorWhenIdle:C,...N,children:M})})}),U=r.forwardRef(function({rootRef:e,keyboardShortcuts:t,hideCursorWhenIdle:a,children:o,className:s,style:c,...l},d){let f=u(),p=te(d,e),m=r.useRef(null);B(e,t);let h=r.useCallback(e=>{let{clientX:t,clientY:n}=e,r=m.current;r&&r.x===t&&r.y===n||(m.current={x:t,y:n},f.resetIdle())},[f]),g=r.useCallback(e=>{let{clientX:t,clientY:n}=e,r=m.current;r&&r.x===t&&r.y===n||(m.current={x:t,y:n},f.resetIdle())},[f]),_=r.useCallback(()=>{f._handlers.onRootMouseLeave()},[f._handlers]),v=r.useCallback(()=>{f.resetIdle()},[f]),y=r.useCallback(()=>{f.resetIdle()},[f]),b=r.useCallback(e=>{e.key===`Tab`&&f.resetIdle()},[f]),x=n.t({onMouseMove:h,onMouseEnter:g,onMouseLeave:_,onClick:v,onFocus:y,onKeyDown:b},l),S={"data-playing":f.playing||void 0,"data-paused":f.paused||void 0,"data-ended":f.ended||void 0,"data-waiting":f.waiting||void 0,"data-seeking":f.seeking||void 0,"data-fullscreen":f.fullscreen||void 0,"data-pip":f.pictureInPicture||void 0,"data-muted":f.muted||void 0,"data-idle":f.idle||void 0},C=a!==!1&&f.idle&&(a===`always`||a===`fullscreen`&&f.fullscreen),w=r.useId();return/* @__PURE__ */ (0,i.jsxs)(`div`,{...x,ref:p,tabIndex:t===`focused`?0:void 0,className:s,style:c,"data-video-player-scope":w,...S,children:[C&&/* @__PURE__ */ (0,i.jsx)(`style`,{children:`[data-video-player-scope="${w}"], [data-video-player-scope="${w}"] * { cursor: none !important; }`}),o]})});function te(...e){return r.useCallback(t=>{for(let n of e)typeof n==`function`?n(t):n!=null&&(n.current=t)},e)}let ne=/* @__PURE__ */ function(e){return e.progress=`--seek-progress`,e.buffered=`--seek-buffered`,e.currentTime=`--seek-current-time`,e.duration=`--seek-duration`,e.hoverProgress=`--seek-hover-progress`,e.hoverTime=`--seek-hover-time`,e}({}),re=/* @__PURE__ */ function(e){return e.seeking=`data-seeking`,e.hovering=`data-hovering`,e.pressing=`data-pressing`,e.dragging=`data-dragging`,e}({}),W=/* @__PURE__ */ function(e){return e.open=`data-open`,e.closed=`data-closed`,e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({});const G=r.createContext(null);function K(e){let t=r.useContext(G);if(!t)throw Error(`${e} must be used within SeekSlider`);return t}function ie(e){return e===`ArrowRight`||e===`ArrowLeft`}const ae=r.forwardRef(function(e,n){let{render:a,children:s,onPointerMove:c,onPointerLeave:u,onPointerDown:d,onKeyUp:f,onValueCommitted:p,style:m,...h}=e,g=l(`SeekSlider`),_=r.useRef(null),[v,y]=r.useState(null),[b,x]=r.useState(!1),[S,C]=r.useState(!1),w=r.useRef(!1);r.useEffect(()=>{if(!b)return;let e=()=>{x(!1),C(!1),w.current=!1,g.endSeekInteraction()};return window.addEventListener(`pointerup`,e),()=>window.removeEventListener(`pointerup`,e)},[b,g]);let T=g.duration>0?g.currentTime/g.duration*100:0,E=r.useCallback((e,t)=>{let n=typeof e==`number`?e:e[0];n!==void 0&&(t.reason===`keyboard`&&g.beginSeekInteraction(),g.seek(n),g.resetIdle(),w.current&&C(!0))},[g]),D=r.useCallback(e=>{if(c?.(e),!_.current||g.duration===0)return;let t=_.current.getBoundingClientRect(),n=e.clientX-t.left,r=Math.max(0,Math.min(1,n/t.width))*g.duration;g.setHoverTime(r)},[c,g]),O=r.useCallback(e=>{u?.(e),g.setHoverTime(null)},[u,g]),k=r.useCallback(e=>{d?.(e),x(!0),w.current=!0,g.beginSeekInteraction()},[d,g]),A=r.useCallback(e=>{f?.(e),ie(e.key)&&g.endSeekInteraction()},[f,g]),j=r.useCallback((e,t)=>{let n=typeof e==`number`?e:e[0];n!==void 0&&(p?.(n,t),x(!1),C(!1),w.current=!1,!(t.reason===`keyboard`&&ie(t.event.key))&&g.endSeekInteraction())},[p,g]),M=r.useMemo(()=>{if(!g.buffered||g.buffered.length===0)return 0;for(let e=0;e<g.buffered.length;e++)if(g.buffered.start(e)<=g.currentTime&&g.currentTime<=g.buffered.end(e))return g.buffered.end(e);return g.buffered.end(0)},[g.buffered,g.currentTime]),N=g.duration>0?M/g.duration*100:0;r.useLayoutEffect(()=>{typeof n==`function`?n(_.current):n&&(n.current=_.current)});let P={currentTime:g.currentTime,duration:g.duration,progress:T,seeking:g.seeking,pressing:b,dragging:S,hoverTime:g.hoverTime,hoverProgress:g.hoverProgress},F=g.hoverProgress!==null,I=g.hoverProgress??0,L=r.useMemo(()=>({sliderRef:_,previewThumbElement:v,setPreviewThumbElement:y,hoverProgress:I,open:F}),[_,v,y,I,F]),R=t.t(m,e=>({position:`relative`,"--seek-progress":`${T}%`,"--seek-buffered":`${N}%`,"--seek-current-time":g.currentTime,"--seek-duration":g.duration,"--seek-hover-progress":g.hoverProgress===null?void 0:`${g.hoverProgress}%`,"--seek-hover-time":g.hoverTime??void 0,...e})),z={"data-seeking":g.seeking||void 0,"data-hovering":g.hoverTime!==null||void 0,"data-pressing":b||void 0,"data-dragging":S||void 0};return a?/* @__PURE__ */ (0,i.jsx)(G.Provider,{value:L,children:/* @__PURE__ */ (0,i.jsx)(o.Slider.Root,{ref:_,min:0,max:g.duration||100,step:.1,value:g.currentTime,onValueChange:E,onValueCommitted:j,onPointerMove:D,onPointerLeave:O,onPointerDown:k,onKeyUp:A,"aria-label":`Seek`,...h,render:(e,n)=>{let r={...z,style:{...e.style,...t.r(R,n)}};return a({...e,...r},P)}})}):/* @__PURE__ */ (0,i.jsx)(G.Provider,{value:L,children:/* @__PURE__ */ (0,i.jsx)(o.Slider.Root,{ref:_,min:0,max:g.duration||100,step:.1,value:g.currentTime,onValueChange:E,onValueCommitted:j,onPointerMove:D,onPointerLeave:O,onPointerDown:k,onKeyUp:A,"aria-label":`Seek`,...z,...h,style:R,children:s??/* @__PURE__ */ (0,i.jsx)(o.Slider.Control,{children:/* @__PURE__ */ (0,i.jsxs)(o.Slider.Track,{style:{position:`relative`},children:[/* @__PURE__ */ (0,i.jsx)(`div`,{style:{position:`absolute`,left:0,top:0,height:`100%`,width:`${N}%`}}),/* @__PURE__ */ (0,i.jsx)(o.Slider.Indicator,{}),/* @__PURE__ */ (0,i.jsx)(o.Slider.Thumb,{})]})})})})}),oe=o.Slider.Control,se=r.forwardRef(function(e,n){let{render:r,children:a,style:s,...c}=e,l={},u=t.t(s,e=>({position:`relative`,...e}));return r?/* @__PURE__ */ (0,i.jsx)(o.Slider.Track,{...c,render:(e,i)=>{let a={ref:n,style:t.r(u,i)??{}};return r({...e,...a},l)}}):/* @__PURE__ */ (0,i.jsx)(o.Slider.Track,{ref:n,style:u,...c,children:a})}),q=r.forwardRef(function(e,n){let{render:r,children:a,style:s,...c}=e,u=l(`SeekSliderProgress`),d={progress:u.duration>0?u.currentTime/u.duration*100:0},f=t.t(s,e=>({height:`100%`,...e}));return r?/* @__PURE__ */ (0,i.jsx)(o.Slider.Indicator,{...c,render:(e,i)=>{let a={ref:n,style:{...e.style,...t.r(f,i)}};return r({...e,...a},d)}}):/* @__PURE__ */ (0,i.jsx)(o.Slider.Indicator,{ref:n,style:f,...c,children:a})}),J=r.forwardRef(function(e,t){let{render:n,children:r,style:a,...s}=e,c={},l={ref:t,style:a??{}};return n?/* @__PURE__ */ (0,i.jsx)(o.Slider.Thumb,{...s,render:e=>n({...e,...l,style:{...e.style,...a}},c)}):/* @__PURE__ */ (0,i.jsx)(o.Slider.Thumb,{ref:t,style:a,...s,children:r})}),ce=r.forwardRef(function(e,t){let{render:n,children:a,...o}=e,s=l(`SeekSliderBuffered`),c=r.useMemo(()=>{if(!s.buffered||s.buffered.length===0)return 0;for(let e=0;e<s.buffered.length;e++)if(s.buffered.start(e)<=s.currentTime&&s.currentTime<=s.buffered.end(e))return s.buffered.end(e);return s.buffered.end(0)},[s.buffered,s.currentTime]),u=s.duration>0?c/s.duration*100:0,d={bufferedPercentage:u},f={ref:t,style:{position:`absolute`,left:0,top:0,height:`100%`,width:`${u}%`,...o.style}};return n?n(f,d):/* @__PURE__ */ (0,i.jsx)(`div`,{...f,...o,children:a})}),le=r.forwardRef(function(e,t){let{keepMounted:n=!1,render:a,children:o,...s}=e,c=l(`SeekSliderPreviewThumb`),u=K(`SeekSliderPreviewThumb`),d=c.hoverProgress!==null,f=r.useRef(0);c.hoverProgress!==null&&(f.current=c.hoverProgress);let p=c.hoverProgress??f.current,{mounted:m,transitionStatus:h,elementRef:g}=y({open:d,keepMounted:n}),_=r.useCallback(e=>{g.current=e,u.setPreviewThumbElement(e),typeof t==`function`?t(e):t&&(t.current=e)},[t,g,u]),v={open:d,transitionStatus:h,hoverProgress:p},b={ref:_,style:{position:`absolute`,left:`${p}%`,transform:`translateX(-50%)`,pointerEvents:`none`,...s.style},"data-open":d||void 0,"data-closed":!d||void 0,"data-starting-style":h===`starting`||void 0,"data-ending-style":h===`ending`||void 0};return m?a?a(b,v):/* @__PURE__ */ (0,i.jsx)(`span`,{...b,...s,children:o}):null}),ue=r.forwardRef(function(e,t){let{render:n,children:r,style:a,...o}=e,s=l(`SeekSliderHover`),c=s.hoverProgress!==null,u=s.hoverProgress??0,d={hovering:c,hoverProgress:s.hoverProgress,hoverTime:s.hoverTime},f={ref:t,style:{position:`absolute`,left:0,top:0,height:`100%`,width:`${u}%`,pointerEvents:`none`,...a},"data-hovering":c||void 0};return n?n(f,d):/* @__PURE__ */ (0,i.jsx)(`div`,{...f,...o,children:r})});function Y({children:e,container:t}){let n=l(`SeekSliderPreviewTooltipPortal`),[i,o]=r.useState(!1);if(r.useEffect(()=>{o(!0)},[]),!i)return null;let s=t??n.rootRef.current??document.body;return a.createPortal(e,s)}const de=r.forwardRef(function(e,t){let{sideOffset:n=8,collisionPadding:a=0,collisionBoundary:o,keepMounted:c=!1,children:l,style:u,...d}=e,{previewThumbElement:f,open:p,hoverProgress:m}=K(`SeekSliderPreviewTooltipPositioner`),[h,g]=r.useState(null),{refs:_,floatingStyles:v,update:y}=(0,s.useFloating)({placement:`top`,middleware:[(0,s.offset)(n),(0,s.shift)({boundary:o,padding:a})]});r.useLayoutEffect(()=>{f&&_.setReference(f)},[f,_]),r.useEffect(()=>{if(p&&f&&h)return(0,s.autoUpdate)(f,h,y)},[p,f,h,y]),r.useLayoutEffect(()=>{p&&f&&h&&y()},[m,p,f,h,y]);let b=r.useCallback(e=>{_.setFloating(e),g(e),typeof t==`function`?t(e):t&&(t.current=e)},[_,t]);return(c||p)&&f?/* @__PURE__ */ (0,i.jsx)(`div`,{ref:b,style:{...v,...u},"data-seek-slider-preview-tooltip-positioner":!0,"data-open":p||void 0,"data-closed":!p||void 0,...d,children:l}):null}),fe=r.forwardRef(function(e,t){let{children:n,...r}=e;return/* @__PURE__ */ (0,i.jsx)(`div`,{ref:t,"data-seek-slider-preview-tooltip-popup":!0,...r,children:n})});function X({sideOffset:e,collisionPadding:t,collisionBoundary:n,keepMounted:r,container:a,children:o,...s}){return/* @__PURE__ */ (0,i.jsx)(Y,{container:a,children:/* @__PURE__ */ (0,i.jsx)(de,{sideOffset:e,collisionPadding:t,collisionBoundary:n,keepMounted:r,children:/* @__PURE__ */ (0,i.jsx)(fe,{...s,children:o})})})}X.Portal=Y,X.Positioner=de,X.Popup=fe;let pe=/* @__PURE__ */ function(e){return e.loading=`data-loading`,e.ready=`data-ready`,e.error=`data-error`,e}({});const me=r.forwardRef(function(e,t){let{time:n,crossOrigin:a=`anonymous`,render:o,children:s,width:c,height:u,...d}=e,f=l(`Thumbnail`),p=r.useRef(null),m=r.useRef(null),h=r.useRef(null),[g,_]=r.useState(`idle`),[v,y]=r.useState({width:160,height:90}),b=n===void 0?f.hoverTime:n,x=r.useMemo(()=>{let e=f.videoRef.current;return e?e.currentSrc||e.src:null},[f.videoRef]);r.useEffect(()=>{if(!x)return;let e=document.createElement(`video`);e.src=x,e.crossOrigin=a,e.preload=`metadata`,e.muted=!0,e.playsInline=!0;let t=()=>{y({width:e.videoWidth,height:e.videoHeight})},n=()=>{_(`error`)};return e.addEventListener(`loadedmetadata`,t),e.addEventListener(`error`,n),m.current=e,()=>{e.removeEventListener(`loadedmetadata`,t),e.removeEventListener(`error`,n),e.src=``,m.current=null}},[x,a]),r.useEffect(()=>{let e=m.current,t=p.current;if(!e||!t||b==null||h.current!==null&&Math.abs(h.current-b)<.1)return;_(`loading`);let n=()=>{let n=t.getContext(`2d`);if(n)try{n.drawImage(e,0,0,t.width,t.height),h.current=b,_(`ready`)}catch{_(`error`)}};return e.addEventListener(`seeked`,n,{once:!0}),e.currentTime=b,()=>{e.removeEventListener(`seeked`,n)}},[b]);let S=r.useCallback(e=>{p.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),C=v.width/v.height,w=c??160,T=u??Math.round(w/C);typeof w==`string`&&(w=160),typeof T==`string`&&(T=90);let E={loading:g===`loading`,ready:g===`ready`,error:g===`error`,time:b,videoWidth:v.width,videoHeight:v.height},D={ref:S,width:w,height:T,"data-loading":g===`loading`||void 0,"data-ready":g===`ready`||void 0,"data-error":g===`error`||void 0};return o?o(D,E):/* @__PURE__ */ (0,i.jsx)(`canvas`,{...D,...d,children:s})});let he=/* @__PURE__ */ function(e){return e.hovering=`data-hovering`,e}({});const ge=r.forwardRef(function(e,t){let{format:n=`current / duration`,fixedWidth:a=!0,align:o=`left`,render:s,...c}=e,u=l(`TimeDisplay`),d=r.useRef(0);u.hoverTime!==null&&(d.current=u.hoverTime);let f=u.duration-u.currentTime,p=Q(u.currentTime),m=Q(u.duration),h=Q(f),g=u.hoverTime===null?Q(d.current):Q(u.hoverTime),_={currentTime:u.currentTime,duration:u.duration,remaining:f,hoverTime:u.hoverTime,hovering:u.hoverTime!==null,formattedCurrent:p,formattedDuration:m,formattedRemaining:h,formattedHover:g},v=()=>{switch(n){case`current`:return p;case`duration`:return m;case`remaining`:return`-${h}`;case`current / duration`:return`${p} / ${m}`;case`current / remaining`:return`${p} / -${h}`;case`hover`:return g;default:return`${p} / ${m}`}},y=()=>{let e=_e(u.duration);switch(n){case`current`:case`duration`:case`hover`:return e;case`remaining`:return`-${e}`;case`current / duration`:return`${e} / ${e}`;case`current / remaining`:return`${e} / -${e}`;default:return`${e} / ${e}`}},b={ref:t,style:{position:a?`relative`:void 0,userSelect:`none`,fontVariantNumeric:`tabular-nums`,...c.style},"data-hovering":_.hovering||void 0};return s?s(b,_):/* @__PURE__ */ (0,i.jsx)(`span`,{ref:t,"data-hovering":_.hovering||void 0,...c,style:{position:a?`relative`:void 0,userSelect:`none`,fontVariantNumeric:`tabular-nums`,...c.style},children:a?/* @__PURE__ */ (0,i.jsxs)(i.Fragment,{children:[/* @__PURE__ */ (0,i.jsx)(`span`,{"aria-hidden":!0,style:{visibility:`hidden`},children:y()}),/* @__PURE__ */ (0,i.jsx)(`span`,{style:Z(o),children:v()})]}):v()})});function Z(e){let t={position:`absolute`};switch(e){case`left`:return{...t,left:0};case`right`:return{...t,right:0};case`center`:return{...t,left:`50%`,transform:`translateX(-50%)`}}}function Q(e){if(!Number.isFinite(e)||Number.isNaN(e))return`0:00`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return t>0?`${t}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`:`${n}:${r.toString().padStart(2,`0`)}`}function _e(e){if(!Number.isFinite(e)||Number.isNaN(e)||e<=0)return`0:00`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);if(t>0){let e=String(t).length;return`${`0`.repeat(e)}:00:00`}let r=String(n).length;return`${`0`.repeat(r)}:00`}const ve=r.forwardRef(function(e,t){let{kind:n=`captions`,src:a,label:o,srcLang:s,default:c,...u}=e,{registerTrack:d,unregisterTrack:f,updateTrackRef:p,setTextTrack:m}=l(`Track`),h=r.useRef(null),g=r.useId(),_=r.useCallback(e=>{typeof t==`function`?t(e):t&&(t.current=e),h.current=e},[t]);return r.useEffect(()=>(d({id:g,kind:n,label:o,srcLang:s,src:a,textTrack:null}),()=>{f(g)}),[g,n,o,s,a,d,f]),r.useEffect(()=>{let e=h.current;if(!e)return;let t=()=>{e.track&&(e.track.mode=`disabled`,p(g,e.track),c&&m(e.track))};return e.track&&t(),e.addEventListener(`load`,t),()=>{e.removeEventListener(`load`,t)}},[g,c,p,m]),/* @__PURE__ */ (0,i.jsx)(`track`,{ref:_,kind:n,src:a,label:o,srcLang:s,default:c,...u})}),ye=r.forwardRef(function(e,t){let{toggleOnClick:a=!0,...o}=e,s=l(`Video`),c=r.useRef(!1),u=r.useCallback(e=>{typeof t==`function`?t(e):t&&(t.current=e),s.videoRef.current=e,e&&!c.current&&(c.current=!0,s._handlers.onVideoMount(),e.readyState>=1&&e.duration&&(s._handlers.onLoadedMetadata(),s._handlers.onDurationChange()),e.readyState>=3&&s._handlers.onCanPlay())},[t,s.videoRef,s._handlers]),d={"data-playing":s.playing||void 0,"data-paused":s.paused||void 0,"data-ended":s.ended||void 0,"data-waiting":s.waiting||void 0,"data-seeking":s.seeking||void 0},f=n.t({ref:u,preload:`metadata`,...d,onClick(){a&&s.toggle()},onTimeUpdate:s._handlers.onTimeUpdate,onDurationChange:s._handlers.onDurationChange,onProgress:s._handlers.onProgress,onPlay:s._handlers.onPlay,onPause:s._handlers.onPause,onEnded:s._handlers.onEnded,onWaiting:s._handlers.onWaiting,onCanPlay:s._handlers.onCanPlay,onSeeking:s._handlers.onSeeking,onSeeked:s._handlers.onSeeked,onVolumeChange:s._handlers.onVolumeChange,onLoadedMetadata:s._handlers.onLoadedMetadata},o);return/* @__PURE__ */ (0,i.jsx)(`video`,{...f})});let be=/* @__PURE__ */ function(e){return e.volume=`--volume`,e.volumePercentage=`--volume-percentage`,e}({}),xe=/* @__PURE__ */ function(e){return e.muted=`data-muted`,e.volume=`data-volume`,e.pressing=`data-pressing`,e.dragging=`data-dragging`,e}({});const $=r.forwardRef(function(e,n){let{render:a,children:s,onPointerDown:c,style:u,...d}=e,f=l(`VolumeSlider`),p=r.useRef(null),[m,h]=r.useState(!1),[g,_]=r.useState(!1),v=r.useRef(!1);r.useEffect(()=>{if(!m)return;let e=()=>{h(!1),_(!1),v.current=!1};return window.addEventListener(`pointerup`,e),()=>window.removeEventListener(`pointerup`,e)},[m]),r.useLayoutEffect(()=>{typeof n==`function`?n(p.current):n&&(n.current=p.current)});let y=f.volume*100,b={volume:f.volume,muted:f.muted,percentage:y,pressing:m,dragging:g},x=r.useCallback(e=>{let t=typeof e==`number`?e:e[0];if(t!==void 0){if(f.muted){let e=f.videoRef.current;e&&(e.muted=!1)}f.setVolume(t),f.resetIdle(),v.current&&_(!0)}},[f]),S=r.useCallback(e=>{c?.(e),h(!0),v.current=!0},[c]),C={"data-muted":f.muted||void 0,"data-volume":f.volume,"data-pressing":m||void 0,"data-dragging":g||void 0},w=t.t(u,e=>({position:`relative`,"--volume":f.volume,"--volume-percentage":`${y}%`,...e}));return a?/* @__PURE__ */ (0,i.jsx)(o.Slider.Root,{ref:p,min:0,max:1,step:.01,value:f.muted?0:f.volume,onValueChange:x,onPointerDown:S,"aria-label":`Volume`,...d,render:(e,n)=>{let r={...C,style:t.r(w,n)??{}};return a({...e,...r},b)}}):/* @__PURE__ */ (0,i.jsx)(o.Slider.Root,{ref:p,min:0,max:1,step:.01,value:f.muted?0:f.volume,onValueChange:x,onPointerDown:S,"aria-label":`Volume`,...C,...d,style:w,children:s??/* @__PURE__ */ (0,i.jsx)(o.Slider.Control,{children:/* @__PURE__ */ (0,i.jsxs)(o.Slider.Track,{children:[/* @__PURE__ */ (0,i.jsx)(o.Slider.Indicator,{}),/* @__PURE__ */ (0,i.jsx)(o.Slider.Thumb,{})]})})})}),Se=o.Slider.Control,Ce=r.forwardRef(function(e,n){let{style:r,...a}=e,s=t.t(r,e=>({position:`relative`,...e}));return/* @__PURE__ */ (0,i.jsx)(o.Slider.Track,{ref:n,style:s,...a})}),we=r.forwardRef(function(e,t){return/* @__PURE__ */ (0,i.jsx)(o.Slider.Indicator,{ref:t,...e})}),Te=r.forwardRef(function(e,t){return/* @__PURE__ */ (0,i.jsx)(o.Slider.Thumb,{ref:t,...e})});var Ee=/* @__PURE__ */ e.t({BufferedIndicator:()=>d,Captions:()=>p,CaptionsButton:()=>m,CaptionsDataAttributes:()=>f,CaptionsMenu:()=>h,CaptionsMenuItem:()=>g,Controls:()=>b,ControlsDataAttributes:()=>_,FullscreenButton:()=>x,MuteButton:()=>S,Overlay:()=>w,OverlayDataAttributes:()=>C,PictureInPictureButton:()=>T,PlayButton:()=>E,PlaybackRateButton:()=>O,PlaybackRateMenu:()=>A,PlaybackRateMenuItem:()=>j,Portal:()=>M,Poster:()=>N,QualityMenu:()=>F,QualityMenuItem:()=>I,Root:()=>H,RootDataAttributes:()=>L,SeekSlider:()=>ae,SeekSliderBuffered:()=>ce,SeekSliderControl:()=>oe,SeekSliderCssVars:()=>ne,SeekSliderDataAttributes:()=>re,SeekSliderHover:()=>ue,SeekSliderPreviewThumb:()=>le,SeekSliderPreviewThumbDataAttributes:()=>W,SeekSliderPreviewTooltip:()=>X,SeekSliderPreviewTooltipPopup:()=>fe,SeekSliderPreviewTooltipPortal:()=>Y,SeekSliderPreviewTooltipPositioner:()=>de,SeekSliderProgress:()=>q,SeekSliderThumb:()=>J,SeekSliderTrack:()=>se,Thumbnail:()=>me,ThumbnailDataAttributes:()=>pe,TimeDisplay:()=>ge,TimeDisplayDataAttributes:()=>he,Track:()=>ve,Video:()=>ye,VolumeSlider:()=>$,VolumeSliderControl:()=>Se,VolumeSliderCssVars:()=>be,VolumeSliderDataAttributes:()=>xe,VolumeSliderRange:()=>we,VolumeSliderThumb:()=>Te,VolumeSliderTrack:()=>Ce,useTransitionStatus:()=>y,useVideoPlayer:()=>u});Object.defineProperty(exports,"VideoPlayer",{enumerable:!0,get:function(){return Ee}}),exports.useVideoPlayer=u;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|