`, so it can be styled via any CSS solution you prefer.\n * @see https://floating-ui.com/docs/FloatingOverlay\n */\nconst FloatingOverlay = /*#__PURE__*/React.forwardRef(function FloatingOverlay(props, ref) {\n const {\n lockScroll = false,\n ...rest\n } = props;\n index(() => {\n if (!lockScroll) return;\n lockCount++;\n if (lockCount === 1) {\n cleanup = enableScrollLock();\n }\n return () => {\n lockCount--;\n if (lockCount === 0) {\n cleanup();\n }\n };\n }, [lockScroll]);\n return /*#__PURE__*/jsx(\"div\", {\n ref: ref,\n ...rest,\n style: {\n position: 'fixed',\n overflow: 'auto',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...rest.style\n }\n });\n});\n\nfunction isButtonTarget(event) {\n return isHTMLElement(event.target) && event.target.tagName === 'BUTTON';\n}\nfunction isSpaceIgnored(element) {\n return isTypeableElement(element);\n}\n/**\n * Opens or closes the floating element when clicking the reference element.\n * @see https://floating-ui.com/docs/useClick\n */\nfunction useClick(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n onOpenChange,\n dataRef,\n elements: {\n domReference\n }\n } = context;\n const {\n enabled = true,\n event: eventOption = 'click',\n toggle = true,\n ignoreMouse = false,\n keyboardHandlers = true,\n stickIfOpen = true\n } = props;\n const pointerTypeRef = React.useRef();\n const didKeyDownRef = React.useRef(false);\n const reference = React.useMemo(() => ({\n onPointerDown(event) {\n pointerTypeRef.current = event.pointerType;\n },\n onMouseDown(event) {\n const pointerType = pointerTypeRef.current;\n\n // Ignore all buttons except for the \"main\" button.\n // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n if (event.button !== 0) return;\n if (eventOption === 'click') return;\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;\n if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'mousedown' : true)) {\n onOpenChange(false, event.nativeEvent, 'click');\n } else {\n // Prevent stealing focus from the floating element\n event.preventDefault();\n onOpenChange(true, event.nativeEvent, 'click');\n }\n },\n onClick(event) {\n const pointerType = pointerTypeRef.current;\n if (eventOption === 'mousedown' && pointerTypeRef.current) {\n pointerTypeRef.current = undefined;\n return;\n }\n if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return;\n if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'click' : true)) {\n onOpenChange(false, event.nativeEvent, 'click');\n } else {\n onOpenChange(true, event.nativeEvent, 'click');\n }\n },\n onKeyDown(event) {\n pointerTypeRef.current = undefined;\n if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) {\n return;\n }\n if (event.key === ' ' && !isSpaceIgnored(domReference)) {\n // Prevent scrolling\n event.preventDefault();\n didKeyDownRef.current = true;\n }\n if (event.key === 'Enter') {\n if (open && toggle) {\n onOpenChange(false, event.nativeEvent, 'click');\n } else {\n onOpenChange(true, event.nativeEvent, 'click');\n }\n }\n },\n onKeyUp(event) {\n if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) {\n return;\n }\n if (event.key === ' ' && didKeyDownRef.current) {\n didKeyDownRef.current = false;\n if (open && toggle) {\n onOpenChange(false, event.nativeEvent, 'click');\n } else {\n onOpenChange(true, event.nativeEvent, 'click');\n }\n }\n }\n }), [dataRef, domReference, eventOption, ignoreMouse, keyboardHandlers, onOpenChange, open, stickIfOpen, toggle]);\n return React.useMemo(() => enabled ? {\n reference\n } : {}, [enabled, reference]);\n}\n\nfunction createVirtualElement(domElement, data) {\n let offsetX = null;\n let offsetY = null;\n let isAutoUpdateEvent = false;\n return {\n contextElement: domElement || undefined,\n getBoundingClientRect() {\n var _data$dataRef$current;\n const domRect = (domElement == null ? void 0 : domElement.getBoundingClientRect()) || {\n width: 0,\n height: 0,\n x: 0,\n y: 0\n };\n const isXAxis = data.axis === 'x' || data.axis === 'both';\n const isYAxis = data.axis === 'y' || data.axis === 'both';\n const canTrackCursorOnAutoUpdate = ['mouseenter', 'mousemove'].includes(((_data$dataRef$current = data.dataRef.current.openEvent) == null ? void 0 : _data$dataRef$current.type) || '') && data.pointerType !== 'touch';\n let width = domRect.width;\n let height = domRect.height;\n let x = domRect.x;\n let y = domRect.y;\n if (offsetX == null && data.x && isXAxis) {\n offsetX = domRect.x - data.x;\n }\n if (offsetY == null && data.y && isYAxis) {\n offsetY = domRect.y - data.y;\n }\n x -= offsetX || 0;\n y -= offsetY || 0;\n width = 0;\n height = 0;\n if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) {\n width = data.axis === 'y' ? domRect.width : 0;\n height = data.axis === 'x' ? domRect.height : 0;\n x = isXAxis && data.x != null ? data.x : x;\n y = isYAxis && data.y != null ? data.y : y;\n } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) {\n height = data.axis === 'x' ? domRect.height : height;\n width = data.axis === 'y' ? domRect.width : width;\n }\n isAutoUpdateEvent = true;\n return {\n width,\n height,\n x,\n y,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x\n };\n }\n };\n}\nfunction isMouseBasedEvent(event) {\n return event != null && event.clientX != null;\n}\n/**\n * Positions the floating element relative to a client point (in the viewport),\n * such as the mouse position. By default, it follows the mouse cursor.\n * @see https://floating-ui.com/docs/useClientPoint\n */\nfunction useClientPoint(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n dataRef,\n elements: {\n floating,\n domReference\n },\n refs\n } = context;\n const {\n enabled = true,\n axis = 'both',\n x = null,\n y = null\n } = props;\n const initialRef = React.useRef(false);\n const cleanupListenerRef = React.useRef(null);\n const [pointerType, setPointerType] = React.useState();\n const [reactive, setReactive] = React.useState([]);\n const setReference = useEffectEvent((x, y) => {\n if (initialRef.current) return;\n\n // Prevent setting if the open event was not a mouse-like one\n // (e.g. focus to open, then hover over the reference element).\n // Only apply if the event exists.\n if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) {\n return;\n }\n refs.setPositionReference(createVirtualElement(domReference, {\n x,\n y,\n axis,\n dataRef,\n pointerType\n }));\n });\n const handleReferenceEnterOrMove = useEffectEvent(event => {\n if (x != null || y != null) return;\n if (!open) {\n setReference(event.clientX, event.clientY);\n } else if (!cleanupListenerRef.current) {\n // If there's no cleanup, there's no listener, but we want to ensure\n // we add the listener if the cursor landed on the floating element and\n // then back on the reference (i.e. it's interactive).\n setReactive([]);\n }\n });\n\n // If the pointer is a mouse-like pointer, we want to continue following the\n // mouse even if the floating element is transitioning out. On touch\n // devices, this is undesirable because the floating element will move to\n // the dismissal touch point.\n const openCheck = isMouseLikePointerType(pointerType) ? floating : open;\n const addListener = React.useCallback(() => {\n // Explicitly specified `x`/`y` coordinates shouldn't add a listener.\n if (!openCheck || !enabled || x != null || y != null) return;\n const win = getWindow(floating);\n function handleMouseMove(event) {\n const target = getTarget(event);\n if (!contains(floating, target)) {\n setReference(event.clientX, event.clientY);\n } else {\n win.removeEventListener('mousemove', handleMouseMove);\n cleanupListenerRef.current = null;\n }\n }\n if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) {\n win.addEventListener('mousemove', handleMouseMove);\n const cleanup = () => {\n win.removeEventListener('mousemove', handleMouseMove);\n cleanupListenerRef.current = null;\n };\n cleanupListenerRef.current = cleanup;\n return cleanup;\n }\n refs.setPositionReference(domReference);\n }, [openCheck, enabled, x, y, floating, dataRef, refs, domReference, setReference]);\n React.useEffect(() => {\n return addListener();\n }, [addListener, reactive]);\n React.useEffect(() => {\n if (enabled && !floating) {\n initialRef.current = false;\n }\n }, [enabled, floating]);\n React.useEffect(() => {\n if (!enabled && open) {\n initialRef.current = true;\n }\n }, [enabled, open]);\n index(() => {\n if (enabled && (x != null || y != null)) {\n initialRef.current = false;\n setReference(x, y);\n }\n }, [enabled, x, y, setReference]);\n const reference = React.useMemo(() => {\n function setPointerTypeRef(_ref) {\n let {\n pointerType\n } = _ref;\n setPointerType(pointerType);\n }\n return {\n onPointerDown: setPointerTypeRef,\n onPointerEnter: setPointerTypeRef,\n onMouseMove: handleReferenceEnterOrMove,\n onMouseEnter: handleReferenceEnterOrMove\n };\n }, [handleReferenceEnterOrMove]);\n return React.useMemo(() => enabled ? {\n reference\n } : {}, [enabled, reference]);\n}\n\nconst bubbleHandlerKeys = {\n pointerdown: 'onPointerDown',\n mousedown: 'onMouseDown',\n click: 'onClick'\n};\nconst captureHandlerKeys = {\n pointerdown: 'onPointerDownCapture',\n mousedown: 'onMouseDownCapture',\n click: 'onClickCapture'\n};\nconst normalizeProp = normalizable => {\n var _normalizable$escapeK, _normalizable$outside;\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true\n };\n};\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nfunction useDismiss(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n onOpenChange,\n elements,\n dataRef\n } = context;\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: unstable_outsidePress = true,\n outsidePressEvent = 'pointerdown',\n referencePress = false,\n referencePressEvent = 'pointerdown',\n ancestorScroll = false,\n bubbles,\n capture\n } = props;\n const tree = useFloatingTree();\n const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === 'function' ? unstable_outsidePress : () => false);\n const outsidePress = typeof unstable_outsidePress === 'function' ? outsidePressFn : unstable_outsidePress;\n const insideReactTreeRef = React.useRef(false);\n const endedOrStartedInsideRef = React.useRef(false);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const {\n escapeKey: escapeKeyCapture,\n outsidePress: outsidePressCapture\n } = normalizeProp(capture);\n const isComposingRef = React.useRef(false);\n const closeOnEscapeKeyDown = useEffectEvent(event => {\n var _dataRef$current$floa;\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;\n const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];\n if (!escapeKeyBubbles) {\n event.stopPropagation();\n if (children.length > 0) {\n let shouldDismiss = true;\n children.forEach(child => {\n var _child$context;\n if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {\n shouldDismiss = false;\n return;\n }\n });\n if (!shouldDismiss) {\n return;\n }\n }\n }\n onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, 'escape-key');\n });\n const closeOnEscapeKeyDownCapture = useEffectEvent(event => {\n var _getTarget2;\n const callback = () => {\n var _getTarget;\n closeOnEscapeKeyDown(event);\n (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener('keydown', callback);\n };\n (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener('keydown', callback);\n });\n const closeOnPressOutside = useEffectEvent(event => {\n var _dataRef$current$floa2;\n // Given developers can stop the propagation of the synthetic event,\n // we can only be confident with a positive value.\n const insideReactTree = insideReactTreeRef.current;\n insideReactTreeRef.current = false;\n\n // When click outside is lazy (`click` event), handle dragging.\n // Don't close if:\n // - The click started inside the floating element.\n // - The click ended inside the floating element.\n const endedOrStartedInside = endedOrStartedInsideRef.current;\n endedOrStartedInsideRef.current = false;\n if (outsidePressEvent === 'click' && endedOrStartedInside) {\n return;\n }\n if (insideReactTree) {\n return;\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n const target = getTarget(event);\n const inertSelector = \"[\" + createAttribute('inert') + \"]\";\n const markers = getDocument(elements.floating).querySelectorAll(inertSelector);\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, elements.floating) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n Array.from(markers).every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n if (isHTMLElement(target) && floating) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;\n const targetIsInsideChildren = tree && getChildren(tree.nodesRef.current, nodeId).some(node => {\n var _node$context;\n return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);\n });\n if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {\n return;\n }\n const children = tree ? getChildren(tree.nodesRef.current, nodeId) : [];\n if (children.length > 0) {\n let shouldDismiss = true;\n children.forEach(child => {\n var _child$context2;\n if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {\n shouldDismiss = false;\n return;\n }\n });\n if (!shouldDismiss) {\n return;\n }\n }\n onOpenChange(false, event, 'outside-press');\n });\n const closeOnPressOutsideCapture = useEffectEvent(event => {\n var _getTarget4;\n const callback = () => {\n var _getTarget3;\n closeOnPressOutside(event);\n (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);\n };\n (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);\n });\n React.useEffect(() => {\n if (!open || !enabled) {\n return;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n let compositionTimeout = -1;\n function onScroll(event) {\n onOpenChange(false, event, 'ancestor-scroll');\n }\n function handleCompositionStart() {\n window.clearTimeout(compositionTimeout);\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout = window.setTimeout(() => {\n isComposingRef.current = false;\n },\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n isWebKit() ? 5 : 0);\n }\n const doc = getDocument(elements.floating);\n if (escapeKey) {\n doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);\n doc.addEventListener('compositionstart', handleCompositionStart);\n doc.addEventListener('compositionend', handleCompositionEnd);\n }\n outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);\n let ancestors = [];\n if (ancestorScroll) {\n if (isElement(elements.domReference)) {\n ancestors = getOverflowAncestors(elements.domReference);\n }\n if (isElement(elements.floating)) {\n ancestors = ancestors.concat(getOverflowAncestors(elements.floating));\n }\n if (!isElement(elements.reference) && elements.reference && elements.reference.contextElement) {\n ancestors = ancestors.concat(getOverflowAncestors(elements.reference.contextElement));\n }\n }\n\n // Ignore the visual viewport for scrolling dismissal (allow pinch-zoom)\n ancestors = ancestors.filter(ancestor => {\n var _doc$defaultView;\n return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);\n });\n ancestors.forEach(ancestor => {\n ancestor.addEventListener('scroll', onScroll, {\n passive: true\n });\n });\n return () => {\n if (escapeKey) {\n doc.removeEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);\n doc.removeEventListener('compositionstart', handleCompositionStart);\n doc.removeEventListener('compositionend', handleCompositionEnd);\n }\n outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);\n ancestors.forEach(ancestor => {\n ancestor.removeEventListener('scroll', onScroll);\n });\n window.clearTimeout(compositionTimeout);\n };\n }, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);\n React.useEffect(() => {\n insideReactTreeRef.current = false;\n }, [outsidePress, outsidePressEvent]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n ...(referencePress && {\n [bubbleHandlerKeys[referencePressEvent]]: event => {\n onOpenChange(false, event.nativeEvent, 'reference-press');\n },\n ...(referencePressEvent !== 'click' && {\n onClick(event) {\n onOpenChange(false, event.nativeEvent, 'reference-press');\n }\n })\n })\n }), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onMouseDown() {\n endedOrStartedInsideRef.current = true;\n },\n onMouseUp() {\n endedOrStartedInsideRef.current = true;\n },\n [captureHandlerKeys[outsidePressEvent]]: () => {\n insideReactTreeRef.current = true;\n }\n }), [closeOnEscapeKeyDown, outsidePressEvent]);\n return React.useMemo(() => enabled ? {\n reference,\n floating\n } : {}, [enabled, reference, floating]);\n}\n\nfunction useFloatingRootContext(options) {\n const {\n open = false,\n onOpenChange: onOpenChangeProp,\n elements: elementsProp\n } = options;\n const floatingId = useId();\n const dataRef = React.useRef({});\n const [events] = React.useState(() => createPubSub());\n const nested = useFloatingParentNodeId() != null;\n if (process.env.NODE_ENV !== \"production\") {\n const optionDomReference = elementsProp.reference;\n if (optionDomReference && !isElement(optionDomReference)) {\n error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `refs.setPositionReference()`', 'instead.');\n }\n }\n const [positionReference, setPositionReference] = React.useState(elementsProp.reference);\n const onOpenChange = useEffectEvent((open, event, reason) => {\n dataRef.current.openEvent = open ? event : undefined;\n events.emit('openchange', {\n open,\n event,\n reason,\n nested\n });\n onOpenChangeProp == null || onOpenChangeProp(open, event, reason);\n });\n const refs = React.useMemo(() => ({\n setPositionReference\n }), []);\n const elements = React.useMemo(() => ({\n reference: positionReference || elementsProp.reference || null,\n floating: elementsProp.floating || null,\n domReference: elementsProp.reference\n }), [positionReference, elementsProp.reference, elementsProp.floating]);\n return React.useMemo(() => ({\n dataRef,\n open,\n onOpenChange,\n elements,\n events,\n floatingId,\n refs\n }), [open, onOpenChange, elements, events, floatingId, refs]);\n}\n\n/**\n * Provides data to position a floating element and context to add interactions.\n * @see https://floating-ui.com/docs/useFloating\n */\nfunction useFloating(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n nodeId\n } = options;\n const internalRootContext = useFloatingRootContext({\n ...options,\n elements: {\n reference: null,\n floating: null,\n ...options.elements\n }\n });\n const rootContext = options.rootContext || internalRootContext;\n const computedElements = rootContext.elements;\n const [_domReference, setDomReference] = React.useState(null);\n const [positionReference, _setPositionReference] = React.useState(null);\n const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;\n const domReference = optionDomReference || _domReference;\n const domReferenceRef = React.useRef(null);\n const tree = useFloatingTree();\n index(() => {\n if (domReference) {\n domReferenceRef.current = domReference;\n }\n }, [domReference]);\n const position = useFloating$1({\n ...options,\n elements: {\n ...computedElements,\n ...(positionReference && {\n reference: positionReference\n })\n }\n });\n const setPositionReference = React.useCallback(node => {\n const computedPositionReference = isElement(node) ? {\n getBoundingClientRect: () => node.getBoundingClientRect(),\n contextElement: node\n } : node;\n // Store the positionReference in state if the DOM reference is specified externally via the\n // `elements.reference` option. This ensures that it won't be overridden on future renders.\n _setPositionReference(computedPositionReference);\n position.refs.setReference(computedPositionReference);\n }, [position.refs]);\n const setReference = React.useCallback(node => {\n if (isElement(node) || node === null) {\n domReferenceRef.current = node;\n setDomReference(node);\n }\n\n // Backwards-compatibility for passing a virtual element to `reference`\n // after it has set the DOM reference.\n if (isElement(position.refs.reference.current) || position.refs.reference.current === null ||\n // Don't allow setting virtual elements using the old technique back to\n // `null` to support `positionReference` + an unstable `reference`\n // callback ref.\n node !== null && !isElement(node)) {\n position.refs.setReference(node);\n }\n }, [position.refs]);\n const refs = React.useMemo(() => ({\n ...position.refs,\n setReference,\n setPositionReference,\n domReference: domReferenceRef\n }), [position.refs, setReference, setPositionReference]);\n const elements = React.useMemo(() => ({\n ...position.elements,\n domReference: domReference\n }), [position.elements, domReference]);\n const context = React.useMemo(() => ({\n ...position,\n ...rootContext,\n refs,\n elements,\n nodeId\n }), [position, refs, elements, nodeId, rootContext]);\n index(() => {\n rootContext.dataRef.current.floatingContext = context;\n const node = tree == null ? void 0 : tree.nodesRef.current.find(node => node.id === nodeId);\n if (node) {\n node.context = context;\n }\n });\n return React.useMemo(() => ({\n ...position,\n context,\n refs,\n elements\n }), [position, refs, elements, context]);\n}\n\n/**\n * Opens the floating element while the reference element has focus, like CSS\n * `:focus`.\n * @see https://floating-ui.com/docs/useFocus\n */\nfunction useFocus(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n onOpenChange,\n events,\n dataRef,\n elements\n } = context;\n const {\n enabled = true,\n visibleOnly = true\n } = props;\n const blockFocusRef = React.useRef(false);\n const timeoutRef = React.useRef(-1);\n const keyboardModalityRef = React.useRef(true);\n React.useEffect(() => {\n if (!enabled) return;\n const win = getWindow(elements.domReference);\n\n // If the reference was focused and the user left the tab/window, and the\n // floating element was not open, the focus should be blocked when they\n // return to the tab/window.\n function onBlur() {\n if (!open && isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference))) {\n blockFocusRef.current = true;\n }\n }\n function onKeyDown() {\n keyboardModalityRef.current = true;\n }\n win.addEventListener('blur', onBlur);\n win.addEventListener('keydown', onKeyDown, true);\n return () => {\n win.removeEventListener('blur', onBlur);\n win.removeEventListener('keydown', onKeyDown, true);\n };\n }, [elements.domReference, open, enabled]);\n React.useEffect(() => {\n if (!enabled) return;\n function onOpenChange(_ref) {\n let {\n reason\n } = _ref;\n if (reason === 'reference-press' || reason === 'escape-key') {\n blockFocusRef.current = true;\n }\n }\n events.on('openchange', onOpenChange);\n return () => {\n events.off('openchange', onOpenChange);\n };\n }, [events, enabled]);\n React.useEffect(() => {\n return () => {\n clearTimeoutIfSet(timeoutRef);\n };\n }, []);\n const reference = React.useMemo(() => ({\n onPointerDown(event) {\n if (isVirtualPointerEvent(event.nativeEvent)) return;\n keyboardModalityRef.current = false;\n },\n onMouseLeave() {\n blockFocusRef.current = false;\n },\n onFocus(event) {\n if (blockFocusRef.current) return;\n const target = getTarget(event.nativeEvent);\n if (visibleOnly && isElement(target)) {\n try {\n // Mac Safari unreliably matches `:focus-visible` on the reference\n // if focus was outside the page initially - use the fallback\n // instead.\n if (isSafari() && isMac()) throw Error();\n if (!target.matches(':focus-visible')) return;\n } catch (_e) {\n // Old browsers will throw an error when using `:focus-visible`.\n if (!keyboardModalityRef.current && !isTypeableElement(target)) {\n return;\n }\n }\n }\n onOpenChange(true, event.nativeEvent, 'focus');\n },\n onBlur(event) {\n blockFocusRef.current = false;\n const relatedTarget = event.relatedTarget;\n const nativeEvent = event.nativeEvent;\n\n // Hit the non-modal focus management portal guard. Focus will be\n // moved into the floating element immediately after.\n const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside';\n\n // Wait for the window blur listener to fire.\n timeoutRef.current = window.setTimeout(() => {\n var _dataRef$current$floa;\n const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);\n\n // Focus left the page, keep it open.\n if (!relatedTarget && activeEl === elements.domReference) return;\n\n // When focusing the reference element (e.g. regular click), then\n // clicking into the floating element, prevent it from hiding.\n // Note: it must be focusable, e.g. `tabindex=\"-1\"`.\n // We can not rely on relatedTarget to point to the correct element\n // as it will only point to the shadow host of the newly focused element\n // and not the element that actually has received focus if it is located\n // inside a shadow root.\n if (contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains(elements.domReference, activeEl) || movedToFocusGuard) {\n return;\n }\n onOpenChange(false, nativeEvent, 'focus');\n });\n }\n }), [dataRef, elements.domReference, onOpenChange, visibleOnly]);\n return React.useMemo(() => enabled ? {\n reference\n } : {}, [enabled, reference]);\n}\n\nconst ACTIVE_KEY = 'active';\nconst SELECTED_KEY = 'selected';\nfunction mergeProps(userProps, propsList, elementKey) {\n const map = new Map();\n const isItem = elementKey === 'item';\n let domUserProps = userProps;\n if (isItem && userProps) {\n const {\n [ACTIVE_KEY]: _,\n [SELECTED_KEY]: __,\n ...validProps\n } = userProps;\n domUserProps = validProps;\n }\n return {\n ...(elementKey === 'floating' && {\n tabIndex: -1,\n [FOCUSABLE_ATTRIBUTE]: ''\n }),\n ...domUserProps,\n ...propsList.map(value => {\n const propsOrGetProps = value ? value[elementKey] : null;\n if (typeof propsOrGetProps === 'function') {\n return userProps ? propsOrGetProps(userProps) : null;\n }\n return propsOrGetProps;\n }).concat(userProps).reduce((acc, props) => {\n if (!props) {\n return acc;\n }\n Object.entries(props).forEach(_ref => {\n let [key, value] = _ref;\n if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {\n return;\n }\n if (key.indexOf('on') === 0) {\n if (!map.has(key)) {\n map.set(key, []);\n }\n if (typeof value === 'function') {\n var _map$get;\n (_map$get = map.get(key)) == null || _map$get.push(value);\n acc[key] = function () {\n var _map$get2;\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map(fn => fn(...args)).find(val => val !== undefined);\n };\n }\n } else {\n acc[key] = value;\n }\n });\n return acc;\n }, {})\n };\n}\n/**\n * Merges an array of interaction hooks' props into prop getters, allowing\n * event handler functions to be composed together without overwriting one\n * another.\n * @see https://floating-ui.com/docs/useInteractions\n */\nfunction useInteractions(propsList) {\n if (propsList === void 0) {\n propsList = [];\n }\n const referenceDeps = propsList.map(key => key == null ? void 0 : key.reference);\n const floatingDeps = propsList.map(key => key == null ? void 0 : key.floating);\n const itemDeps = propsList.map(key => key == null ? void 0 : key.item);\n const getReferenceProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'reference'),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n referenceDeps);\n const getFloatingProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'floating'),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n floatingDeps);\n const getItemProps = React.useCallback(userProps => mergeProps(userProps, propsList, 'item'),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n itemDeps);\n return React.useMemo(() => ({\n getReferenceProps,\n getFloatingProps,\n getItemProps\n }), [getReferenceProps, getFloatingProps, getItemProps]);\n}\n\nconst ESCAPE = 'Escape';\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, cols) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && cols && cols > 1) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nfunction useListNavigation(context, props) {\n const {\n open,\n onOpenChange,\n elements\n } = context;\n const {\n listRef,\n activeIndex,\n onNavigate: unstable_onNavigate = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loop = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n cols = 1,\n scrollItemIntoView = true,\n virtualItemRef,\n itemSizes,\n dense = false\n } = props;\n if (process.env.NODE_ENV !== \"production\") {\n if (allowEscape) {\n if (!loop) {\n warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && cols > 1) {\n warn('In grid list navigation mode (`cols` > 1), the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const floatingFocusElement = getFloatingFocusElement(elements.floating);\n const floatingFocusElementRef = useLatestRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree();\n index(() => {\n context.dataRef.current.orientation = orientation;\n }, [context, orientation]);\n const onNavigate = useEffectEvent(() => {\n unstable_onNavigate(indexRef.current === -1 ? null : indexRef.current);\n });\n const typeableComboboxReference = isTypeableCombobox(elements.domReference);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex != null ? selectedIndex : -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const previousOnNavigateRef = React.useRef(onNavigate);\n const previousMountedRef = React.useRef(!!elements.floating);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const disabledIndicesRef = useLatestRef(disabledIndices);\n const latestOpenRef = useLatestRef(open);\n const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView);\n const selectedIndexRef = useLatestRef(selectedIndex);\n const [activeId, setActiveId] = React.useState();\n const [virtualId, setVirtualId] = React.useState();\n const focusItem = useEffectEvent(() => {\n function runFocus(item) {\n if (virtual) {\n setActiveId(item.id);\n tree == null || tree.events.emit('virtualfocus', item);\n if (virtualItemRef) {\n virtualItemRef.current = item;\n }\n } else {\n enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? v => v() : requestAnimationFrame;\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) return;\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const scrollIntoViewOptions = scrollItemIntoViewRef.current;\n const shouldScrollIntoView = scrollIntoViewOptions && item && (forceScrollIntoViewRef.current || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView == null || waitedItem.scrollIntoView(typeof scrollIntoViewOptions === 'boolean' ? {\n block: 'nearest',\n inline: 'nearest'\n } : scrollIntoViewOptions);\n }\n });\n });\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n index(() => {\n if (!enabled) return;\n if (open && elements.floating) {\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n indexRef.current = selectedIndex;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Since the user can specify `onNavigate` conditionally\n // (onNavigate: open ? setActiveIndex : setSelectedIndex),\n // we store and call the previous function.\n indexRef.current = -1;\n previousOnNavigateRef.current();\n }\n }, [enabled, open, elements.floating, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n index(() => {\n if (!enabled) return;\n if (!open) return;\n if (!elements.floating) return;\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? requestAnimationFrame : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs++;\n } else {\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinIndex(listRef, disabledIndicesRef.current) : getMaxIndex(listRef, disabledIndicesRef.current);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfBounds(listRef, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, elements.floating, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, disabledIndicesRef]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n index(() => {\n var _nodes$find;\n if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = (_nodes$find = nodes.find(node => node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating;\n const activeEl = activeElement(getDocument(elements.floating));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, elements.floating, tree, parentId, virtual]);\n index(() => {\n if (!enabled) return;\n if (!tree) return;\n if (!virtual) return;\n if (parentId) return;\n function handleVirtualFocus(item) {\n setVirtualId(item.id);\n if (virtualItemRef) {\n virtualItemRef.current = item;\n }\n }\n tree.events.on('virtualfocus', handleVirtualFocus);\n return () => {\n tree.events.off('virtualfocus', handleVirtualFocus);\n };\n }, [enabled, tree, virtual, parentId, virtualItemRef]);\n index(() => {\n previousOnNavigateRef.current = onNavigate;\n previousOpenRef.current = open;\n previousMountedRef.current = !!elements.floating;\n });\n index(() => {\n if (!open) {\n keyRef.current = null;\n }\n }, [open]);\n const hasActiveIndex = activeIndex != null;\n const item = React.useMemo(() => {\n function syncCurrentTarget(currentTarget) {\n if (!open) return;\n const index = listRef.current.indexOf(currentTarget);\n if (index !== -1 && indexRef.current !== index) {\n indexRef.current = index;\n onNavigate();\n }\n }\n const props = {\n onFocus(_ref) {\n let {\n currentTarget\n } = _ref;\n forceSyncFocusRef.current = true;\n syncCurrentTarget(currentTarget);\n },\n onClick: _ref2 => {\n let {\n currentTarget\n } = _ref2;\n return currentTarget.focus({\n preventScroll: true\n });\n },\n // Safari\n ...(focusItemOnHover && {\n onMouseMove(_ref3) {\n let {\n currentTarget\n } = _ref3;\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n syncCurrentTarget(currentTarget);\n },\n onPointerLeave(_ref4) {\n let {\n pointerType\n } = _ref4;\n if (!isPointerModalityRef.current || pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n indexRef.current = -1;\n onNavigate();\n if (!virtual) {\n var _floatingFocusElement;\n (_floatingFocusElement = floatingFocusElementRef.current) == null || _floatingFocusElement.focus({\n preventScroll: true\n });\n }\n }\n })\n };\n return props;\n }, [open, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, virtual]);\n const commonOnKeyDown = useEffectEvent(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, cols)) {\n stopEvent(event);\n onOpenChange(false, event.nativeEvent, 'list-navigation');\n if (isHTMLElement(elements.domReference)) {\n if (virtual) {\n tree == null || tree.events.emit('virtualfocus', elements.domReference);\n } else {\n elements.domReference.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinIndex(listRef, disabledIndices);\n const maxIndex = getMaxIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate();\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate();\n }\n }\n\n // Grid navigation.\n if (cols > 1) {\n const sizes = itemSizes || Array.from({\n length: listRef.current.length\n }, () => ({\n width: 1,\n height: 1\n }));\n // To calculate movements on the grid, we use hypothetical cell indices\n // as if every item was 1x1, then convert back to real indices.\n const cellMap = buildCellMap(sizes, cols, dense);\n const minGridIndex = cellMap.findIndex(index => index != null && !isDisabled(listRef.current, index, disabledIndices));\n // last enabled index\n const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1);\n const index = cellMap[getGridNavigatedIndex({\n current: cellMap.map(itemIndex => itemIndex != null ? listRef.current[itemIndex] : null)\n }, {\n event,\n orientation,\n loop,\n rtl,\n cols,\n // treat undefined (empty grid spaces) as disabled indices so we\n // don't end up in them\n disabledIndices: getCellIndices([...(disabledIndices || listRef.current.map((_, index) => isDisabled(listRef.current, index) ? index : undefined)), undefined], cellMap),\n minIndex: minGridIndex,\n maxIndex: maxGridIndex,\n prevIndex: getCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols,\n // use a corner matching the edge closest to the direction\n // we're moving in so we don't end up in the same item. Prefer\n // top/left over bottom/right.\n event.key === ARROW_DOWN ? 'bl' : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? 'tr' : 'tl'),\n stopEvent: true\n })];\n if (index != null) {\n indexRef.current = index;\n onNavigate();\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate();\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loop) {\n indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n });\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else {\n if (loop) {\n indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n }\n if (isIndexOutOfBounds(listRef, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate();\n }\n });\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': virtualId || activeId\n };\n }, [virtual, open, hasActiveIndex, virtualId, activeId]);\n const floating = React.useMemo(() => {\n return {\n 'aria-orientation': orientation === 'both' ? undefined : orientation,\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown: commonOnKeyDown,\n onPointerMove() {\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, orientation, typeableComboboxReference]);\n const reference = React.useMemo(() => {\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n ...ariaActiveDescendantProp,\n onKeyDown(event) {\n var _tree$nodesRef$curren;\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isHomeOrEndKey = ['Home', 'End'].includes(event.key);\n const isMoveKey = isArrowKey || isHomeOrEndKey;\n const parentOrientation = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find(node => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.dataRef) == null ? void 0 : _tree$nodesRef$curren.current.orientation;\n const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl);\n const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl, cols);\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, parentOrientation, rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && open) {\n const rootNode = tree == null ? void 0 : tree.nodesRef.current.find(node => node.parentId == null);\n const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null;\n if (isMoveKey && deepestNode && virtualItemRef) {\n const eventObject = new KeyboardEvent('keydown', {\n key: event.key,\n bubbles: true\n });\n if (isCrossOpenKey || isCrossCloseKey) {\n var _deepestNode$context, _deepestNode$context2;\n const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget;\n const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find(item => (item == null ? void 0 : item.id) === activeId) : null;\n if (dispatchItem) {\n stopEvent(event);\n dispatchItem.dispatchEvent(eventObject);\n setVirtualId(undefined);\n }\n }\n if ((isMainKey || isHomeOrEndKey) && deepestNode.context) {\n if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) {\n var _deepestNode$context$;\n stopEvent(event);\n (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject);\n return;\n }\n }\n }\n return commonOnKeyDown(event);\n }\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!open && !openOnArrowKeyDown && isArrowKey) {\n return;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, parentOrientation);\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (open) {\n indexRef.current = getMinIndex(listRef, disabledIndicesRef.current);\n onNavigate();\n } else {\n onOpenChange(true, event.nativeEvent, 'list-navigation');\n }\n }\n return;\n }\n if (isMainKey) {\n if (selectedIndex != null) {\n indexRef.current = selectedIndex;\n }\n stopEvent(event);\n if (!open && openOnArrowKeyDown) {\n onOpenChange(true, event.nativeEvent, 'list-navigation');\n } else {\n commonOnKeyDown(event);\n }\n if (open) {\n onNavigate();\n }\n }\n },\n onFocus() {\n if (open && !virtual) {\n indexRef.current = -1;\n onNavigate();\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [activeId, ariaActiveDescendantProp, cols, commonOnKeyDown, disabledIndicesRef, focusItemOnOpen, listRef, nested, onNavigate, onOpenChange, open, openOnArrowKeyDown, orientation, parentId, rtl, selectedIndex, tree, virtual, virtualItemRef]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item\n } : {}, [enabled, reference, floating, item]);\n}\n\nconst componentRoleToAriaRoleMap = /*#__PURE__*/new Map([['select', 'listbox'], ['combobox', 'listbox'], ['label', false]]);\n\n/**\n * Adds base screen reader props to the reference and floating elements for a\n * given floating element `role`.\n * @see https://floating-ui.com/docs/useRole\n */\nfunction useRole(context, props) {\n var _componentRoleToAriaR;\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n floatingId\n } = context;\n const {\n enabled = true,\n role = 'dialog'\n } = props;\n const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;\n const referenceId = useId();\n const parentId = useFloatingParentNodeId();\n const isNested = parentId != null;\n const reference = React.useMemo(() => {\n if (ariaRole === 'tooltip' || role === 'label') {\n return {\n [\"aria-\" + (role === 'label' ? 'labelledby' : 'describedby')]: open ? floatingId : undefined\n };\n }\n return {\n 'aria-expanded': open ? 'true' : 'false',\n 'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole,\n 'aria-controls': open ? floatingId : undefined,\n ...(ariaRole === 'listbox' && {\n role: 'combobox'\n }),\n ...(ariaRole === 'menu' && {\n id: referenceId\n }),\n ...(ariaRole === 'menu' && isNested && {\n role: 'menuitem'\n }),\n ...(role === 'select' && {\n 'aria-autocomplete': 'none'\n }),\n ...(role === 'combobox' && {\n 'aria-autocomplete': 'list'\n })\n };\n }, [ariaRole, floatingId, isNested, open, referenceId, role]);\n const floating = React.useMemo(() => {\n const floatingProps = {\n id: floatingId,\n ...(ariaRole && {\n role: ariaRole\n })\n };\n if (ariaRole === 'tooltip' || role === 'label') {\n return floatingProps;\n }\n return {\n ...floatingProps,\n ...(ariaRole === 'menu' && {\n 'aria-labelledby': referenceId\n })\n };\n }, [ariaRole, floatingId, referenceId, role]);\n const item = React.useCallback(_ref => {\n let {\n active,\n selected\n } = _ref;\n const commonProps = {\n role: 'option',\n ...(active && {\n id: floatingId + \"-option\"\n })\n };\n\n // For `menu`, we are unable to tell if the item is a `menuitemradio`\n // or `menuitemcheckbox`. For backwards-compatibility reasons, also\n // avoid defaulting to `menuitem` as it may overwrite custom role props.\n switch (role) {\n case 'select':\n return {\n ...commonProps,\n 'aria-selected': active && selected\n };\n case 'combobox':\n {\n return {\n ...commonProps,\n ...(active && {\n 'aria-selected': true\n })\n };\n }\n }\n return {};\n }, [floatingId, role]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item\n } : {}, [enabled, reference, floating, item]);\n}\n\n// Converts a JS style key like `backgroundColor` to a CSS transition-property\n// like `background-color`.\nconst camelCaseToKebabCase = str => str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? '-' : '') + $.toLowerCase());\nfunction execWithArgsOrReturn(valueOrFn, args) {\n return typeof valueOrFn === 'function' ? valueOrFn(args) : valueOrFn;\n}\nfunction useDelayUnmount(open, durationMs) {\n const [isMounted, setIsMounted] = React.useState(open);\n if (open && !isMounted) {\n setIsMounted(true);\n }\n React.useEffect(() => {\n if (!open && isMounted) {\n const timeout = setTimeout(() => setIsMounted(false), durationMs);\n return () => clearTimeout(timeout);\n }\n }, [open, isMounted, durationMs]);\n return isMounted;\n}\n/**\n * Provides a status string to apply CSS transitions to a floating element,\n * correctly handling placement-aware transitions.\n * @see https://floating-ui.com/docs/useTransition#usetransitionstatus\n */\nfunction useTransitionStatus(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n open,\n elements: {\n floating\n }\n } = context;\n const {\n duration = 250\n } = props;\n const isNumberDuration = typeof duration === 'number';\n const closeDuration = (isNumberDuration ? duration : duration.close) || 0;\n const [status, setStatus] = React.useState('unmounted');\n const isMounted = useDelayUnmount(open, closeDuration);\n if (!isMounted && status === 'close') {\n setStatus('unmounted');\n }\n index(() => {\n if (!floating) return;\n if (open) {\n setStatus('initial');\n const frame = requestAnimationFrame(() => {\n setStatus('open');\n });\n return () => {\n cancelAnimationFrame(frame);\n };\n }\n setStatus('close');\n }, [open, floating]);\n return {\n isMounted,\n status\n };\n}\n/**\n * Provides styles to apply CSS transitions to a floating element, correctly\n * handling placement-aware transitions. Wrapper around `useTransitionStatus`.\n * @see https://floating-ui.com/docs/useTransition#usetransitionstyles\n */\nfunction useTransitionStyles(context, props) {\n if (props === void 0) {\n props = {};\n }\n const {\n initial: unstable_initial = {\n opacity: 0\n },\n open: unstable_open,\n close: unstable_close,\n common: unstable_common,\n duration = 250\n } = props;\n const placement = context.placement;\n const side = placement.split('-')[0];\n const fnArgs = React.useMemo(() => ({\n side,\n placement\n }), [side, placement]);\n const isNumberDuration = typeof duration === 'number';\n const openDuration = (isNumberDuration ? duration : duration.open) || 0;\n const closeDuration = (isNumberDuration ? duration : duration.close) || 0;\n const [styles, setStyles] = React.useState(() => ({\n ...execWithArgsOrReturn(unstable_common, fnArgs),\n ...execWithArgsOrReturn(unstable_initial, fnArgs)\n }));\n const {\n isMounted,\n status\n } = useTransitionStatus(context, {\n duration\n });\n const initialRef = useLatestRef(unstable_initial);\n const openRef = useLatestRef(unstable_open);\n const closeRef = useLatestRef(unstable_close);\n const commonRef = useLatestRef(unstable_common);\n index(() => {\n const initialStyles = execWithArgsOrReturn(initialRef.current, fnArgs);\n const closeStyles = execWithArgsOrReturn(closeRef.current, fnArgs);\n const commonStyles = execWithArgsOrReturn(commonRef.current, fnArgs);\n const openStyles = execWithArgsOrReturn(openRef.current, fnArgs) || Object.keys(initialStyles).reduce((acc, key) => {\n acc[key] = '';\n return acc;\n }, {});\n if (status === 'initial') {\n setStyles(styles => ({\n transitionProperty: styles.transitionProperty,\n ...commonStyles,\n ...initialStyles\n }));\n }\n if (status === 'open') {\n setStyles({\n transitionProperty: Object.keys(openStyles).map(camelCaseToKebabCase).join(','),\n transitionDuration: openDuration + \"ms\",\n ...commonStyles,\n ...openStyles\n });\n }\n if (status === 'close') {\n const styles = closeStyles || initialStyles;\n setStyles({\n transitionProperty: Object.keys(styles).map(camelCaseToKebabCase).join(','),\n transitionDuration: closeDuration + \"ms\",\n ...commonStyles,\n ...styles\n });\n }\n }, [closeDuration, closeRef, initialRef, openRef, commonRef, openDuration, status, fnArgs]);\n return {\n isMounted,\n styles\n };\n}\n\n/**\n * Provides a matching callback that can be used to focus an item as the user\n * types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nfunction useTypeahead(context, props) {\n var _ref;\n const {\n open,\n dataRef\n } = context;\n const {\n listRef,\n activeIndex,\n onMatch: unstable_onMatch,\n onTypingChange: unstable_onTypingChange,\n enabled = true,\n findMatch = null,\n resetMs = 750,\n ignoreKeys = [],\n selectedIndex = null\n } = props;\n const timeoutIdRef = React.useRef(-1);\n const stringRef = React.useRef('');\n const prevIndexRef = React.useRef((_ref = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref : -1);\n const matchIndexRef = React.useRef(null);\n const onMatch = useEffectEvent(unstable_onMatch);\n const onTypingChange = useEffectEvent(unstable_onTypingChange);\n const findMatchRef = useLatestRef(findMatch);\n const ignoreKeysRef = useLatestRef(ignoreKeys);\n index(() => {\n if (open) {\n clearTimeoutIfSet(timeoutIdRef);\n matchIndexRef.current = null;\n stringRef.current = '';\n }\n }, [open]);\n index(() => {\n // Sync arrow key navigation but not typeahead navigation.\n if (open && stringRef.current === '') {\n var _ref2;\n prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1;\n }\n }, [open, selectedIndex, activeIndex]);\n const setTypingChange = useEffectEvent(value => {\n if (value) {\n if (!dataRef.current.typing) {\n dataRef.current.typing = value;\n onTypingChange(value);\n }\n } else {\n if (dataRef.current.typing) {\n dataRef.current.typing = value;\n onTypingChange(value);\n }\n }\n });\n const onKeyDown = useEffectEvent(event => {\n function getMatchingIndex(list, orderedList, string) {\n const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find(text => (text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0);\n return str ? list.indexOf(str) : -1;\n }\n const listContent = listRef.current;\n if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') {\n if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) {\n setTypingChange(false);\n } else if (event.key === ' ') {\n stopEvent(event);\n }\n }\n if (listContent == null || ignoreKeysRef.current.includes(event.key) ||\n // Character key.\n event.key.length !== 1 ||\n // Modifier key.\n event.ctrlKey || event.metaKey || event.altKey) {\n return;\n }\n if (open && event.key !== ' ') {\n stopEvent(event);\n setTypingChange(true);\n }\n\n // Bail out if the list contains a word like \"llama\" or \"aaron\". TODO:\n // allow it in this case, too.\n const allowRapidSuccessionOfFirstLetter = listContent.every(text => {\n var _text$, _text$2;\n return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true;\n });\n\n // Allows the user to cycle through items that start with the same letter\n // in rapid succession.\n if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n }\n stringRef.current += event.key;\n clearTimeoutIfSet(timeoutIdRef);\n timeoutIdRef.current = window.setTimeout(() => {\n stringRef.current = '';\n prevIndexRef.current = matchIndexRef.current;\n setTypingChange(false);\n }, resetMs);\n const prevIndex = prevIndexRef.current;\n const index = getMatchingIndex(listContent, [...listContent.slice((prevIndex || 0) + 1), ...listContent.slice(0, (prevIndex || 0) + 1)], stringRef.current);\n if (index !== -1) {\n onMatch(index);\n matchIndexRef.current = index;\n } else if (event.key !== ' ') {\n stringRef.current = '';\n setTypingChange(false);\n }\n });\n const reference = React.useMemo(() => ({\n onKeyDown\n }), [onKeyDown]);\n const floating = React.useMemo(() => {\n return {\n onKeyDown,\n onKeyUp(event) {\n if (event.key === ' ') {\n setTypingChange(false);\n }\n }\n };\n }, [onKeyDown, setTypingChange]);\n return React.useMemo(() => enabled ? {\n reference,\n floating\n } : {}, [enabled, reference, floating]);\n}\n\nfunction getArgsWithCustomFloatingHeight(state, height) {\n return {\n ...state,\n rects: {\n ...state.rects,\n floating: {\n ...state.rects.floating,\n height\n }\n }\n };\n}\n/**\n * Positions the floating element such that an inner element inside of it is\n * anchored to the reference element.\n * @see https://floating-ui.com/docs/inner\n * @deprecated\n */\nconst inner = props => ({\n name: 'inner',\n options: props,\n async fn(state) {\n const {\n listRef,\n overflowRef,\n onFallbackChange,\n offset: innerOffset = 0,\n index = 0,\n minItemsVisible = 4,\n referenceOverflowThreshold = 0,\n scrollRef,\n ...detectOverflowOptions\n } = evaluate(props, state);\n const {\n rects,\n elements: {\n floating\n }\n } = state;\n const item = listRef.current[index];\n const scrollEl = (scrollRef == null ? void 0 : scrollRef.current) || floating;\n\n // Valid combinations:\n // 1. Floating element is the scrollRef and has a border (default)\n // 2. Floating element is not the scrollRef, floating element has a border\n // 3. Floating element is not the scrollRef, scrollRef has a border\n // Floating > {...getFloatingProps()} wrapper > scrollRef > items is not\n // allowed as VoiceOver doesn't work.\n const clientTop = floating.clientTop || scrollEl.clientTop;\n const floatingIsBordered = floating.clientTop !== 0;\n const scrollElIsBordered = scrollEl.clientTop !== 0;\n const floatingIsScrollEl = floating === scrollEl;\n if (process.env.NODE_ENV !== \"production\") {\n if (!state.placement.startsWith('bottom')) {\n warn('`placement` side must be \"bottom\" when using the `inner`', 'middleware.');\n }\n }\n if (!item) {\n return {};\n }\n const nextArgs = {\n ...state,\n ...(await offset(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state))\n };\n const overflow = await detectOverflow(getArgsWithCustomFloatingHeight(nextArgs, scrollEl.scrollHeight + clientTop + floating.clientTop), detectOverflowOptions);\n const refOverflow = await detectOverflow(nextArgs, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const diffY = max(0, overflow.top);\n const nextY = nextArgs.y + diffY;\n const isScrollable = scrollEl.scrollHeight > scrollEl.clientHeight;\n const rounder = isScrollable ? v => v : round;\n const maxHeight = rounder(max(0, scrollEl.scrollHeight + (floatingIsBordered && floatingIsScrollEl || scrollElIsBordered ? clientTop * 2 : 0) - diffY - max(0, overflow.bottom)));\n scrollEl.style.maxHeight = maxHeight + \"px\";\n scrollEl.scrollTop = diffY;\n\n // There is not enough space, fallback to standard anchored positioning\n if (onFallbackChange) {\n const shouldFallback = scrollEl.offsetHeight < item.offsetHeight * min(minItemsVisible, listRef.current.length) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold;\n ReactDOM.flushSync(() => onFallbackChange(shouldFallback));\n }\n if (overflowRef) {\n overflowRef.current = await detectOverflow(getArgsWithCustomFloatingHeight({\n ...nextArgs,\n y: nextY\n }, scrollEl.offsetHeight + clientTop + floating.clientTop), detectOverflowOptions);\n }\n return {\n y: nextY\n };\n }\n});\n/**\n * Changes the `inner` middleware's `offset` upon a `wheel` event to\n * expand the floating element's height, revealing more list items.\n * @see https://floating-ui.com/docs/inner\n * @deprecated\n */\nfunction useInnerOffset(context, props) {\n const {\n open,\n elements\n } = context;\n const {\n enabled = true,\n overflowRef,\n scrollRef,\n onChange: unstable_onChange\n } = props;\n const onChange = useEffectEvent(unstable_onChange);\n const controlledScrollingRef = React.useRef(false);\n const prevScrollTopRef = React.useRef(null);\n const initialOverflowRef = React.useRef(null);\n React.useEffect(() => {\n if (!enabled) return;\n function onWheel(e) {\n if (e.ctrlKey || !el || overflowRef.current == null) {\n return;\n }\n const dY = e.deltaY;\n const isAtTop = overflowRef.current.top >= -0.5;\n const isAtBottom = overflowRef.current.bottom >= -0.5;\n const remainingScroll = el.scrollHeight - el.clientHeight;\n const sign = dY < 0 ? -1 : 1;\n const method = dY < 0 ? 'max' : 'min';\n if (el.scrollHeight <= el.clientHeight) {\n return;\n }\n if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) {\n e.preventDefault();\n ReactDOM.flushSync(() => {\n onChange(d => d + Math[method](dY, remainingScroll * sign));\n });\n } else if (/firefox/i.test(getUserAgent())) {\n // Needed to propagate scrolling during momentum scrolling phase once\n // it gets limited by the boundary. UX improvement, not critical.\n el.scrollTop += dY;\n }\n }\n const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;\n if (open && el) {\n el.addEventListener('wheel', onWheel);\n\n // Wait for the position to be ready.\n requestAnimationFrame(() => {\n prevScrollTopRef.current = el.scrollTop;\n if (overflowRef.current != null) {\n initialOverflowRef.current = {\n ...overflowRef.current\n };\n }\n });\n return () => {\n prevScrollTopRef.current = null;\n initialOverflowRef.current = null;\n el.removeEventListener('wheel', onWheel);\n };\n }\n }, [enabled, open, elements.floating, overflowRef, scrollRef, onChange]);\n const floating = React.useMemo(() => ({\n onKeyDown() {\n controlledScrollingRef.current = true;\n },\n onWheel() {\n controlledScrollingRef.current = false;\n },\n onPointerMove() {\n controlledScrollingRef.current = false;\n },\n onScroll() {\n const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;\n if (!overflowRef.current || !el || !controlledScrollingRef.current) {\n return;\n }\n if (prevScrollTopRef.current !== null) {\n const scrollDiff = el.scrollTop - prevScrollTopRef.current;\n if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) {\n ReactDOM.flushSync(() => onChange(d => d + scrollDiff));\n }\n }\n\n // [Firefox] Wait for the height change to have been applied.\n requestAnimationFrame(() => {\n prevScrollTopRef.current = el.scrollTop;\n });\n }\n }), [elements.floating, onChange, overflowRef, scrollRef]);\n return React.useMemo(() => enabled ? {\n floating\n } : {}, [enabled, floating]);\n}\n\nfunction isPointInPolygon(point, polygon) {\n const [x, y] = point;\n let isInside = false;\n const length = polygon.length;\n for (let i = 0, j = length - 1; i < length; j = i++) {\n const [xi, yi] = polygon[i] || [0, 0];\n const [xj, yj] = polygon[j] || [0, 0];\n const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi;\n if (intersect) {\n isInside = !isInside;\n }\n }\n return isInside;\n}\nfunction isInside(point, rect) {\n return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height;\n}\n/**\n * Generates a safe polygon area that the user can traverse without closing the\n * floating element once leaving the reference element.\n * @see https://floating-ui.com/docs/useHover#safepolygon\n */\nfunction safePolygon(options) {\n if (options === void 0) {\n options = {};\n }\n const {\n buffer = 0.5,\n blockPointerEvents = false,\n requireIntent = true\n } = options;\n let timeoutId;\n let hasLanded = false;\n let lastX = null;\n let lastY = null;\n let lastCursorTime = performance.now();\n function getCursorSpeed(x, y) {\n const currentTime = performance.now();\n const elapsedTime = currentTime - lastCursorTime;\n if (lastX === null || lastY === null || elapsedTime === 0) {\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return null;\n }\n const deltaX = x - lastX;\n const deltaY = y - lastY;\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n const speed = distance / elapsedTime; // px / ms\n\n lastX = x;\n lastY = y;\n lastCursorTime = currentTime;\n return speed;\n }\n const fn = _ref => {\n let {\n x,\n y,\n placement,\n elements,\n onClose,\n nodeId,\n tree\n } = _ref;\n return function onMouseMove(event) {\n function close() {\n clearTimeout(timeoutId);\n onClose();\n }\n clearTimeout(timeoutId);\n if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) {\n return;\n }\n const {\n clientX,\n clientY\n } = event;\n const clientPoint = [clientX, clientY];\n const target = getTarget(event);\n const isLeave = event.type === 'mouseleave';\n const isOverFloatingEl = contains(elements.floating, target);\n const isOverReferenceEl = contains(elements.domReference, target);\n const refRect = elements.domReference.getBoundingClientRect();\n const rect = elements.floating.getBoundingClientRect();\n const side = placement.split('-')[0];\n const cursorLeaveFromRight = x > rect.right - rect.width / 2;\n const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2;\n const isOverReferenceRect = isInside(clientPoint, refRect);\n const isFloatingWider = rect.width > refRect.width;\n const isFloatingTaller = rect.height > refRect.height;\n const left = (isFloatingWider ? refRect : rect).left;\n const right = (isFloatingWider ? refRect : rect).right;\n const top = (isFloatingTaller ? refRect : rect).top;\n const bottom = (isFloatingTaller ? refRect : rect).bottom;\n if (isOverFloatingEl) {\n hasLanded = true;\n if (!isLeave) {\n return;\n }\n }\n if (isOverReferenceEl) {\n hasLanded = false;\n }\n if (isOverReferenceEl && !isLeave) {\n hasLanded = true;\n return;\n }\n\n // Prevent overlapping floating element from being stuck in an open-close\n // loop: https://github.com/floating-ui/floating-ui/issues/1910\n if (isLeave && isElement(event.relatedTarget) && contains(elements.floating, event.relatedTarget)) {\n return;\n }\n\n // If any nested child is open, abort.\n if (tree && getChildren(tree.nodesRef.current, nodeId).some(_ref2 => {\n let {\n context\n } = _ref2;\n return context == null ? void 0 : context.open;\n })) {\n return;\n }\n\n // If the pointer is leaving from the opposite side, the \"buffer\" logic\n // creates a point where the floating element remains open, but should be\n // ignored.\n // A constant of 1 handles floating point rounding errors.\n if (side === 'top' && y >= refRect.bottom - 1 || side === 'bottom' && y <= refRect.top + 1 || side === 'left' && x >= refRect.right - 1 || side === 'right' && x <= refRect.left + 1) {\n return close();\n }\n\n // Ignore when the cursor is within the rectangular trough between the\n // two elements. Since the triangle is created from the cursor point,\n // which can start beyond the ref element's edge, traversing back and\n // forth from the ref to the floating element can cause it to close. This\n // ensures it always remains open in that case.\n let rectPoly = [];\n switch (side) {\n case 'top':\n rectPoly = [[left, refRect.top + 1], [left, rect.bottom - 1], [right, rect.bottom - 1], [right, refRect.top + 1]];\n break;\n case 'bottom':\n rectPoly = [[left, rect.top + 1], [left, refRect.bottom - 1], [right, refRect.bottom - 1], [right, rect.top + 1]];\n break;\n case 'left':\n rectPoly = [[rect.right - 1, bottom], [rect.right - 1, top], [refRect.left + 1, top], [refRect.left + 1, bottom]];\n break;\n case 'right':\n rectPoly = [[refRect.right - 1, bottom], [refRect.right - 1, top], [rect.left + 1, top], [rect.left + 1, bottom]];\n break;\n }\n function getPolygon(_ref3) {\n let [x, y] = _ref3;\n switch (side) {\n case 'top':\n {\n const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];\n const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y + buffer + 1];\n const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer]];\n return [cursorPointOne, cursorPointTwo, ...commonPoints];\n }\n case 'bottom':\n {\n const cursorPointOne = [isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];\n const cursorPointTwo = [isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, y - buffer];\n const commonPoints = [[rect.left, cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom], [rect.right, cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer]];\n return [cursorPointOne, cursorPointTwo, ...commonPoints];\n }\n case 'left':\n {\n const cursorPointOne = [x + buffer + 1, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n const cursorPointTwo = [x + buffer + 1, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n const commonPoints = [[cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, rect.bottom]];\n return [...commonPoints, cursorPointOne, cursorPointTwo];\n }\n case 'right':\n {\n const cursorPointOne = [x - buffer, isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n const cursorPointTwo = [x - buffer, isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4];\n const commonPoints = [[cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, rect.top], [cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, rect.bottom]];\n return [cursorPointOne, cursorPointTwo, ...commonPoints];\n }\n }\n }\n if (isPointInPolygon([clientX, clientY], rectPoly)) {\n return;\n }\n if (hasLanded && !isOverReferenceRect) {\n return close();\n }\n if (!isLeave && requireIntent) {\n const cursorSpeed = getCursorSpeed(event.clientX, event.clientY);\n const cursorSpeedThreshold = 0.1;\n if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) {\n return close();\n }\n }\n if (!isPointInPolygon([clientX, clientY], getPolygon([x, y]))) {\n close();\n } else if (!hasLanded && requireIntent) {\n timeoutId = window.setTimeout(close, 40);\n }\n };\n };\n fn.__options = {\n blockPointerEvents\n };\n return fn;\n}\n\nexport { Composite, CompositeItem, FloatingArrow, FloatingDelayGroup, FloatingFocusManager, FloatingList, FloatingNode, FloatingOverlay, FloatingPortal, FloatingTree, inner, safePolygon, useClick, useClientPoint, useDelayGroup, useDelayGroupContext, useDismiss, useFloating, useFloatingNodeId, useFloatingParentNodeId, useFloatingPortalNode, useFloatingRootContext, useFloatingTree, useFocus, useHover, useId, useInnerOffset, useInteractions, useListItem, useListNavigation, useMergeRefs, useRole, useTransitionStatus, useTransitionStyles, useTypeahead };\n","// extracted by mini-css-extract-plugin","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar View_exports = {};\n__export(View_exports, {\n View: () => View\n});\nmodule.exports = __toCommonJS(View_exports);\nvar import_helpers = require(\"@tamagui/helpers\"),\n import_constants = require(\"../constants/constants.cjs\"),\n import_createComponent = require(\"../createComponent.cjs\");\nconst View = (0, import_createComponent.createComponent)({\n acceptsClassName: !0,\n defaultProps: import_constants.stackDefaultStyles,\n validStyles: import_helpers.validStyles\n});","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar getCSSStylesAtomic_exports = {};\n__export(getCSSStylesAtomic_exports, {\n getCSSStylesAtomic: () => getCSSStylesAtomic,\n getStyleAtomic: () => getStyleAtomic,\n styleToCSS: () => styleToCSS\n});\nmodule.exports = __toCommonJS(getCSSStylesAtomic_exports);\nvar import_helpers = require(\"@tamagui/helpers\"),\n import_config = require(\"../config.cjs\"),\n import_defaultOffset = require(\"./defaultOffset.cjs\"),\n import_normalizeColor = require(\"./normalizeColor.cjs\"),\n import_normalizeValueWithProperty = require(\"./normalizeValueWithProperty.cjs\"),\n import_pseudoDescriptors = require(\"./pseudoDescriptors.cjs\"),\n import_transformsToString = require(\"./transformsToString.cjs\"),\n import_useMedia = require(\"../hooks/useMedia.cjs\");\nfunction getCSSStylesAtomic(style) {\n styleToCSS(style);\n const out = [];\n for (const key in style) {\n if (key === \"$$css\") continue;\n const val = style[key];\n if (key in import_pseudoDescriptors.pseudoDescriptors) val && out.push(...getStyleAtomic(val, import_pseudoDescriptors.pseudoDescriptors[key]));else if ((0, import_useMedia.isMediaKey)(key)) for (const subKey in val) {\n const so = getStyleObject(val, subKey);\n so && (so[0] = key, out.push(so));\n } else {\n const so = getStyleObject(style, key);\n so && out.push(so);\n }\n }\n return out;\n}\nconst getStyleAtomic = (style, pseudo) => {\n styleToCSS(style);\n const out = [];\n for (const key in style) {\n const so = getStyleObject(style, key, pseudo);\n so && out.push(so);\n }\n return out;\n};\nlet conf = null;\nconst getStyleObject = (style, key, pseudo) => {\n let val = style[key];\n if (val == null) return;\n key === \"transform\" && Array.isArray(style.transform) && (val = (0, import_transformsToString.transformsToString)(val));\n const value = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key),\n hash = (0, import_helpers.simpleHash)(typeof value == \"string\" ? value : `${value}`),\n pseudoPrefix = pseudo ? `0${pseudo.name}-` : \"\";\n conf ||= (0, import_config.getConfigMaybe)();\n const identifier = `_${conf?.inverseShorthands[key] || key}-${pseudoPrefix}${hash}`,\n rules = createAtomicRules(identifier, key, value, pseudo);\n return [\n // array for performance\n key, value, identifier, pseudo?.name, rules];\n};\nfunction styleToCSS(style) {\n const {\n shadowOffset,\n shadowRadius,\n shadowColor,\n shadowOpacity\n } = style;\n if (shadowRadius || shadowColor) {\n const offset = shadowOffset || import_defaultOffset.defaultOffset,\n width = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(offset.width),\n height = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(offset.height),\n radius = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(shadowRadius),\n color = (0, import_normalizeColor.normalizeColor)(shadowColor, shadowOpacity),\n shadow = `${width} ${height} ${radius} ${color}`;\n style.boxShadow = style.boxShadow ? `${style.boxShadow}, ${shadow}` : shadow, delete style.shadowOffset, delete style.shadowRadius, delete style.shadowColor, delete style.shadowOpacity;\n }\n const {\n textShadowColor,\n textShadowOffset,\n textShadowRadius\n } = style;\n if (textShadowColor || textShadowOffset || textShadowRadius) {\n const {\n height,\n width\n } = textShadowOffset || import_defaultOffset.defaultOffset,\n radius = textShadowRadius || 0,\n color = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(textShadowColor, \"textShadowColor\");\n if (color && (height !== 0 || width !== 0 || radius !== 0)) {\n const blurRadius = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(radius),\n offsetX = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(width),\n offsetY = (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(height);\n style.textShadow = `${offsetX} ${offsetY} ${blurRadius} ${color}`;\n }\n delete style.textShadowColor, delete style.textShadowOffset, delete style.textShadowRadius;\n }\n}\nfunction createDeclarationBlock(style, important = !1) {\n let next = \"\";\n for (const [key, value] of style) next += `${hyphenateStyleName(key)}:${value}${important ? \" !important\" : \"\"};`;\n return `{${next}}`;\n}\nconst hcache = {},\n toHyphenLower = match => `-${match.toLowerCase()}`,\n hyphenateStyleName = key => {\n if (key in hcache) return hcache[key];\n const val = key.replace(/[A-Z]/g, toHyphenLower);\n return hcache[key] = val, val;\n },\n selectorPriority = (() => {\n const res = {};\n for (const key in import_pseudoDescriptors.pseudoDescriptors) {\n const pseudo = import_pseudoDescriptors.pseudoDescriptors[key];\n res[pseudo.name] = `${[...Array(pseudo.priority)].map(() => \":root\").join(\"\")} `;\n }\n return res;\n })();\nfunction createAtomicRules(identifier, property, value, pseudo) {\n const pseudoIdPostfix = pseudo ? pseudo.name === \"disabled\" ? \"[aria-disabled]\" : `:${pseudo.name}` : \"\",\n pseudoSelector = pseudo?.selector;\n let selector = pseudo ? pseudoSelector ? `${pseudoSelector} .${identifier}` : `${selectorPriority[pseudo.name]} .${identifier}${pseudoIdPostfix}` : `:root .${identifier}`;\n pseudoSelector === import_pseudoDescriptors.pseudoDescriptors.enterStyle.selector && (selector = `${selector}, .${identifier}${pseudoSelector}`);\n const important = !!pseudo;\n let rules = [];\n switch (property) {\n // Equivalent to using '::placeholder'\n case \"placeholderTextColor\":\n {\n const block = createDeclarationBlock([[\"color\", value], [\"opacity\", 1]], important);\n rules.push(`${selector}::placeholder${block}`);\n break;\n }\n // all webkit prefixed rules\n case \"backgroundClip\":\n case \"userSelect\":\n {\n const webkitProperty = `Webkit${`${property[0].toUpperCase()}${property.slice(1)}`}`,\n block = createDeclarationBlock([[property, value], [webkitProperty, value]], important);\n rules.push(`${selector}${block}`);\n break;\n }\n // Polyfill for additional 'pointer-events' values\n case \"pointerEvents\":\n {\n let finalValue = value;\n value === \"auto\" || value === \"box-only\" ? (finalValue = \"auto\", value === \"box-only\" && rules.push(`${selector}>*${boxOnly}`)) : (value === \"none\" || value === \"box-none\") && (finalValue = \"none\", value === \"box-none\" && rules.push(`${selector}>*${boxNone}`));\n const block = createDeclarationBlock([[\"pointerEvents\", finalValue]], !0);\n rules.push(`${selector}${block}`);\n break;\n }\n default:\n {\n const block = createDeclarationBlock([[property, value]], important);\n rules.push(`${selector}${block}`);\n break;\n }\n }\n return pseudo?.name === \"hover\" && (rules = rules.map(r => `@media (hover) {${r}}`)), rules;\n}\nconst boxNone = createDeclarationBlock([[\"pointerEvents\", \"auto\"]], !0),\n boxOnly = createDeclarationBlock([[\"pointerEvents\", \"none\"]], !0);","import { Observable } from '../../tools/observable';\nimport { createValueHistory } from '../../tools/valueHistory';\nimport { relativeNow, clocksOrigin, ONE_MINUTE } from '../../tools/utils/timeUtils';\nimport { addEventListener, addEventListeners } from '../../browser/addEventListener';\nimport { clearInterval, setInterval } from '../../tools/timer';\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants';\nimport { startSessionStore } from './sessionStore';\nexport const VISIBILITY_CHECK_DELAY = ONE_MINUTE;\nconst SESSION_CONTEXT_TIMEOUT_DELAY = SESSION_TIME_OUT_DELAY;\nlet stopCallbacks = [];\nexport function startSessionManager(configuration, productKey, computeSessionState, trackingConsentState) {\n const renewObservable = new Observable();\n const expireObservable = new Observable();\n // TODO - Improve configuration type and remove assertion\n const sessionStore = startSessionStore(configuration.sessionStoreStrategyType, configuration, productKey, computeSessionState);\n stopCallbacks.push(() => sessionStore.stop());\n const sessionContextHistory = createValueHistory({\n expireDelay: SESSION_CONTEXT_TIMEOUT_DELAY,\n });\n stopCallbacks.push(() => sessionContextHistory.stop());\n sessionStore.renewObservable.subscribe(() => {\n sessionContextHistory.add(buildSessionContext(), relativeNow());\n renewObservable.notify();\n });\n sessionStore.expireObservable.subscribe(() => {\n expireObservable.notify();\n sessionContextHistory.closeActive(relativeNow());\n });\n // We expand/renew session unconditionally as tracking consent is always granted when the session\n // manager is started.\n sessionStore.expandOrRenewSession();\n sessionContextHistory.add(buildSessionContext(), clocksOrigin().relative);\n trackingConsentState.observable.subscribe(() => {\n if (trackingConsentState.isGranted()) {\n sessionStore.expandOrRenewSession();\n }\n else {\n sessionStore.expire();\n }\n });\n trackActivity(configuration, () => {\n if (trackingConsentState.isGranted()) {\n sessionStore.expandOrRenewSession();\n }\n });\n trackVisibility(configuration, () => sessionStore.expandSession());\n trackResume(configuration, () => sessionStore.restartSession());\n function buildSessionContext() {\n return {\n id: sessionStore.getSession().id,\n trackingType: sessionStore.getSession()[productKey],\n isReplayForced: !!sessionStore.getSession().forcedReplay,\n anonymousId: sessionStore.getSession().anonymousId,\n };\n }\n return {\n findSession: (startTime, options) => sessionContextHistory.find(startTime, options),\n renewObservable,\n expireObservable,\n sessionStateUpdateObservable: sessionStore.sessionStateUpdateObservable,\n expire: sessionStore.expire,\n updateSessionState: sessionStore.updateSessionState,\n };\n}\nexport function stopSessionManager() {\n stopCallbacks.forEach((e) => e());\n stopCallbacks = [];\n}\nfunction trackActivity(configuration, expandOrRenewSession) {\n const { stop } = addEventListeners(configuration, window, [\"click\" /* DOM_EVENT.CLICK */, \"touchstart\" /* DOM_EVENT.TOUCH_START */, \"keydown\" /* DOM_EVENT.KEY_DOWN */, \"scroll\" /* DOM_EVENT.SCROLL */], expandOrRenewSession, { capture: true, passive: true });\n stopCallbacks.push(stop);\n}\nfunction trackVisibility(configuration, expandSession) {\n const expandSessionWhenVisible = () => {\n if (document.visibilityState === 'visible') {\n expandSession();\n }\n };\n const { stop } = addEventListener(configuration, document, \"visibilitychange\" /* DOM_EVENT.VISIBILITY_CHANGE */, expandSessionWhenVisible);\n stopCallbacks.push(stop);\n const visibilityCheckInterval = setInterval(expandSessionWhenVisible, VISIBILITY_CHECK_DELAY);\n stopCallbacks.push(() => {\n clearInterval(visibilityCheckInterval);\n });\n}\nfunction trackResume(configuration, cb) {\n const { stop } = addEventListener(configuration, window, \"resume\" /* DOM_EVENT.RESUME */, cb, { capture: true });\n stopCallbacks.push(stop);\n}\n//# sourceMappingURL=sessionManager.js.map","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","import { Icon, IconSize } from \"@my/ui\"\nimport { analytics } from \"app/telemetry\"\nimport {\n Dispatch,\n MutableRefObject,\n SetStateAction,\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport {\n Keyboard,\n LayoutChangeEvent,\n NativeSyntheticEvent,\n TextInputContentSizeChangeEventData,\n} from \"react-native\"\nimport {\n Button,\n Input,\n InputProps,\n SizableText,\n View,\n YStack,\n isWeb,\n useMedia,\n useWindowDimensions,\n} from \"tamagui\"\nimport { DisclaimerText } from \"./DisclaimerSection\"\nimport { isMobileWeb } from \"@my/utils/src/universalTypes/typeHelper\"\n\nconst MAX_MESSAGE_LENGTH = 2000\n\ntype MessageInputProps = InputProps & {\n newMessageText: string\n setNewMessageText: Dispatch
>\n onNewUserMessage: (newMessageText: string) => void\n /**\n * A boolean flag to disable the input field.\n * When true, the input field is disabled and the user cannot type a new message.\n */\n disableInput?: boolean\n}\n\nexport const MessageInput = forwardRef(\n ({ newMessageText, setNewMessageText, onNewUserMessage, disableInput, ...inputProps }, ref) => {\n const [lengthWarning, setLengthWarning] = useState(false)\n const [inputWidth, setInputWidth] = useState(null)\n const [enterPressed, setEnterPressed] = useState(false)\n const [inputHeight, setInputHeight] = useState(null)\n const { height: windowHeight } = useWindowDimensions()\n const { sm } = useMedia()\n const wasEverFocused = useRef(false)\n\n const submitDisabled = newMessageText.length === 0 || disableInput\n\n useEffect(() => {\n if (newMessageText?.length >= MAX_MESSAGE_LENGTH) {\n setLengthWarning(true)\n analytics.track(\"Page Viewed\", { page: \"ChatPage\", error: \"MessageTooLong\" })\n } else {\n setLengthWarning(false)\n }\n }, [newMessageText, setLengthWarning])\n\n useEffect(() => {\n const mutableRef = ref as MutableRefObject\n if (wasEverFocused.current && mutableRef?.current) {\n if (isWeb) {\n // @ts-expect-error input listener is only available on web\n const input = ref.current as HTMLInputElement\n\n const handleFocusOut = (event: FocusEvent) => {\n // Only refocus if The user didn't explicitly click outside the chat input\n // and the input is not disabled\n if (!event.relatedTarget && !disableInput) input.focus()\n }\n\n // Focus input when it becomes enabled\n if (!disableInput) {\n setTimeout(() => input.focus(), 0)\n }\n\n input.addEventListener?.(\"focusout\", handleFocusOut)\n return () => input.removeEventListener?.(\"focusout\", handleFocusOut)\n } else if (!disableInput) {\n setTimeout(() => {\n mutableRef?.current?.focus()\n }, 0)\n }\n }\n }, [disableInput, ref])\n\n const onNewUserMessageWithDismiss = useCallback(\n (messageText: string) => {\n Keyboard.dismiss()\n onNewUserMessage(messageText)\n },\n [onNewUserMessage],\n )\n\n const handleKeyPress = (event: { nativeEvent: { key: string; shiftKey?: boolean } }) => {\n const { nativeEvent } = event\n // Trim whitespace from the start and end of the message.\n const trimmedMessage = newMessageText.trim()\n\n // On Enter, new line or send message.\n if (nativeEvent.key === \"Enter\" && trimmedMessage.length > 0 && !disableInput) {\n // If shift key is pressed, add new line.\n if (nativeEvent.shiftKey) {\n setNewMessageText(newMessageText)\n return\n } else {\n setEnterPressed(true)\n setNewMessageText(trimmedMessage)\n }\n }\n }\n\n const handleTextChangeAndSubmit = (text: string) => {\n if (enterPressed) {\n onNewUserMessageWithDismiss(newMessageText)\n setEnterPressed(false)\n } else {\n setNewMessageText(text)\n }\n }\n\n const webMaxInputHeight = sm || windowHeight < 600 ? 100 : 200\n const mobileMaxInputHeight = windowHeight > 500 ? 100 : 75\n\n const handleContentSizeChange = useCallback(\n (e: NativeSyntheticEvent) => {\n const height = e.nativeEvent.contentSize.height\n const maxHeight = isWeb ? webMaxInputHeight : mobileMaxInputHeight\n const minHeight = 44\n\n if (!newMessageText.trim()) {\n if (inputHeight !== minHeight) {\n setInputHeight(minHeight)\n }\n return\n }\n\n const newHeight = Math.round(Math.min(Math.max(height, minHeight), maxHeight))\n\n if (newHeight !== inputHeight) {\n setInputHeight(newHeight)\n }\n },\n [inputHeight, mobileMaxInputHeight, newMessageText, webMaxInputHeight],\n )\n\n const cursor = (disableInput ?? inputProps.disabled) ? \"not-allowed\" : \"text\"\n\n return (\n \n \n setInputWidth(e?.nativeEvent?.layout?.width)}\n onFocus={() => (wasEverFocused.current = true)}\n placeholder={disableInput ? \"Sending message...please wait\" : \"Type a message...\"}\n placeholderTextColor=\"$textDisabled\"\n ref={ref}\n testID=\"message-view-chat-input\"\n value={newMessageText}\n disabled={disableInput}\n {...inputProps}\n />\n \n \n\n {lengthWarning && (\n \n \n You've reached the 2000 character limit.\n \n \n )}\n\n \n \n )\n },\n)\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","import { User } from \"@my/api\"\nimport { setDatadogUser } from \"./datadog\"\nimport { analytics } from \"./analytics\"\nimport { useEffect, useRef } from \"react\"\nimport { AnalyticsProperties } from \"../types/analytics\"\n\nexport * from \"./datadog\"\nexport * from \"./logger\"\nexport * from \"./analytics\"\n\n/**\n * Custom React Hook for tracking page views and exits using analytics.\n *\n * @param {string} pageName - The name of the page being tracked.\n * @param {AnalyticsProperties} properties - Additional properties to track.\n * @param {boolean} isLoading - Flag to determine if tracking should be delayed (e.g., waiting for UTM params).\n *\n * @example\n * ```tsx\n * usePageTracking(\"HomePage\", { first_time_user: true }, isUtmLoading);\n * ```\n *\n * @remarks\n * - This hook logs when a page is mounted and unmounted.\n * - Uses `analytics.track` to log `Page Viewed` and `Page Left` events.\n * - Only tracks after isLoading is false.\n *\n * @returns {void} - This hook does not return any value.\n */\nexport function usePageTracking(\n pageName: string,\n properties?: AnalyticsProperties,\n isLoading: boolean = false,\n) {\n const hasTracked = useRef(false)\n\n useEffect(() => {\n // Only track if not loading and hasn't tracked yet\n if (!isLoading && !hasTracked.current) {\n analytics.track(`Page Viewed`, {\n ...properties,\n page_name: pageName,\n })\n hasTracked.current = true\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLoading]) // Only re-run when pageName or isLoading state changes\n}\n\nexport function setMonitoringUser(user: User) {\n setDatadogUser(user)\n analytics.identify(user.auth0Id)\n\n // IdentifyV2 is uses PostHog underneath the hood, and\n // we decided to use the user's id as the distinct id after switching to PostHog\n analytics.identifyV2(user.id, user.email, user.auth0Id)\n\n analytics.setSuperProperties({\n first_seen: user.createdAt,\n })\n analytics.setProfile({\n first_seen: user.createdAt,\n user_utm_source: user.utm?.utmSource,\n user_utm_medium: user.utm?.utmMedium,\n user_utm_campaign: user.utm?.utmCampaign,\n user_utm_content: user.utm?.utmContent,\n user_utm_term: user.utm?.utmTerm,\n $email: user.email,\n })\n}\n\nexport const trackButtonClicked = (\n buttonName: string,\n pageName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalProperties: { [key: string]: any } = {},\n) => {\n analytics.track(\"Button Clicked\", {\n button_name: buttonName,\n page_name: pageName,\n ...additionalProperties,\n })\n}\n\nexport const trackInteractionEvent = (\n type: string,\n interactionType: string,\n pageName: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n additionalProperties: { [key: string]: any } = {},\n) => {\n analytics.track(\"Interaction Event\", {\n type: type, // system or user\n interaction_type: interactionType, // the actual interaction name\n page_name: pageName,\n ...additionalProperties,\n })\n}\n\n/**\n * Tracks when the app is installed by a user.\n *\n * @param additionalProperties - Optional object containing additional properties to track with the install event\n *\n * @example\n * ```ts\n * trackAppInstall({ utm_source: 'google', utm_medium: 'cpc' })\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const trackAppInstall = (additionalProperties: Record = {}) => {\n analytics.track(\"App Install\", additionalProperties)\n}\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n'use strict';\n\nvar emptyFunction = require(\"./emptyFunction\");\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\n\nfunction printWarning(format) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n var argIndex = 0;\n var message = 'Warning: ' + format.replace(/%s/g, function () {\n return args[argIndex++];\n });\n\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n}\n\nvar warning = process.env.NODE_ENV !== \"production\" ? function (condition, format) {\n if (format === undefined) {\n throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');\n }\n\n if (!condition) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {\n args[_key2 - 2] = arguments[_key2];\n }\n\n printWarning.apply(void 0, [format].concat(args));\n }\n} : emptyFunction;\nmodule.exports = warning;","// extracted by mini-css-extract-plugin","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","'use strict'\n\nmodule.exports = require('./colors.json')\n","/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport { unmountComponentAtNode } from 'react-dom';\nexport default unmountComponentAtNode;","/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport { hydrate as domLegacyHydrate, render as domLegacyRender } from 'react-dom';\nimport { createRoot as domCreateRoot, hydrateRoot as domHydrateRoot } from 'react-dom/client';\nimport unmountComponentAtNode from '../unmountComponentAtNode';\nimport { createSheet } from '../StyleSheet/dom';\nexport function hydrate(element, root) {\n createSheet(root);\n return domHydrateRoot(root, element);\n}\nexport function render(element, root) {\n createSheet(root);\n var reactRoot = domCreateRoot(root);\n reactRoot.render(element);\n return reactRoot;\n}\nexport function hydrateLegacy(element, root, callback) {\n createSheet(root);\n domLegacyHydrate(element, root, callback);\n return {\n unmount: function unmount() {\n return unmountComponentAtNode(root);\n }\n };\n}\nexport default function renderLegacy(element, root, callback) {\n createSheet(root);\n domLegacyRender(element, root, callback);\n return {\n unmount: function unmount() {\n return unmountComponentAtNode(root);\n }\n };\n}","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport canUseDOM from '../../modules/canUseDom';\nfunction isScreenReaderEnabled() {\n return new Promise((resolve, reject) => {\n resolve(true);\n });\n}\nvar prefersReducedMotionMedia = canUseDOM && typeof window.matchMedia === 'function' ? window.matchMedia('(prefers-reduced-motion: reduce)') : null;\nfunction isReduceMotionEnabled() {\n return new Promise((resolve, reject) => {\n resolve(prefersReducedMotionMedia ? prefersReducedMotionMedia.matches : true);\n });\n}\nfunction addChangeListener(fn) {\n if (prefersReducedMotionMedia != null) {\n prefersReducedMotionMedia.addEventListener != null ? prefersReducedMotionMedia.addEventListener('change', fn) : prefersReducedMotionMedia.addListener(fn);\n }\n}\nfunction removeChangeListener(fn) {\n if (prefersReducedMotionMedia != null) {\n prefersReducedMotionMedia.removeEventListener != null ? prefersReducedMotionMedia.removeEventListener('change', fn) : prefersReducedMotionMedia.removeListener(fn);\n }\n}\nvar handlers = {};\nvar AccessibilityInfo = {\n /**\n * Query whether a screen reader is currently enabled.\n *\n * Returns a promise which resolves to a boolean.\n * The result is `true` when a screen reader is enabled and `false` otherwise.\n */\n isScreenReaderEnabled,\n /**\n * Query whether the user prefers reduced motion.\n *\n * Returns a promise which resolves to a boolean.\n * The result is `true` when a screen reader is enabled and `false` otherwise.\n */\n isReduceMotionEnabled,\n /**\n * Deprecated\n */\n fetch: isScreenReaderEnabled,\n /**\n * Add an event handler. Supported events: reduceMotionChanged\n */\n addEventListener: function addEventListener(eventName, handler) {\n if (eventName === 'reduceMotionChanged') {\n if (!prefersReducedMotionMedia) {\n return;\n }\n var listener = event => {\n handler(event.matches);\n };\n addChangeListener(listener);\n handlers[handler] = listener;\n }\n return {\n remove: () => AccessibilityInfo.removeEventListener(eventName, handler)\n };\n },\n /**\n * Set accessibility focus to a react component.\n */\n setAccessibilityFocus: function setAccessibilityFocus(reactTag) {},\n /**\n * Post a string to be announced by the screen reader.\n */\n announceForAccessibility: function announceForAccessibility(announcement) {},\n /**\n * Remove an event handler.\n */\n removeEventListener: function removeEventListener(eventName, handler) {\n if (eventName === 'reduceMotionChanged') {\n var listener = handlers[handler];\n if (!listener || !prefersReducedMotionMedia) {\n return;\n }\n removeChangeListener(listener);\n }\n return;\n }\n};\nexport default AccessibilityInfo;","/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nclass Alert {\n static alert() {}\n}\nexport default Alert;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport * as React from 'react';\nimport StyleSheet from '../StyleSheet';\nimport View from '../View';\nvar RootTagContext = /*#__PURE__*/React.createContext(null);\nvar AppContainer = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {\n var children = props.children,\n WrapperComponent = props.WrapperComponent;\n var innerView = /*#__PURE__*/React.createElement(View, {\n children: children,\n key: 1,\n style: styles.appContainer\n });\n if (WrapperComponent) {\n innerView = /*#__PURE__*/React.createElement(WrapperComponent, null, innerView);\n }\n return /*#__PURE__*/React.createElement(RootTagContext.Provider, {\n value: props.rootTag\n }, /*#__PURE__*/React.createElement(View, {\n ref: forwardedRef,\n style: styles.appContainer\n }, innerView));\n});\nAppContainer.displayName = 'AppContainer';\nexport default AppContainer;\nvar styles = StyleSheet.create({\n appContainer: {\n flex: 1,\n pointerEvents: 'box-none'\n }\n});","import _extends from \"@babel/runtime/helpers/extends\";\n/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport AppContainer from './AppContainer';\nimport invariant from 'fbjs/lib/invariant';\nimport renderLegacy, { hydrateLegacy, render, hydrate } from '../render';\nimport StyleSheet from '../StyleSheet';\nimport React from 'react';\nexport default function renderApplication(RootComponent, WrapperComponent, callback, options) {\n var shouldHydrate = options.hydrate,\n initialProps = options.initialProps,\n mode = options.mode,\n rootTag = options.rootTag;\n var renderFn = shouldHydrate ? mode === 'concurrent' ? hydrate : hydrateLegacy : mode === 'concurrent' ? render : renderLegacy;\n invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);\n return renderFn(/*#__PURE__*/React.createElement(AppContainer, {\n WrapperComponent: WrapperComponent,\n ref: callback,\n rootTag: rootTag\n }, /*#__PURE__*/React.createElement(RootComponent, initialProps)), rootTag);\n}\nexport function getApplication(RootComponent, initialProps, WrapperComponent) {\n var element = /*#__PURE__*/React.createElement(AppContainer, {\n WrapperComponent: WrapperComponent,\n rootTag: {}\n }, /*#__PURE__*/React.createElement(RootComponent, initialProps));\n // Don't escape CSS text\n var getStyleElement = props => {\n var sheet = StyleSheet.getSheet();\n return /*#__PURE__*/React.createElement(\"style\", _extends({}, props, {\n dangerouslySetInnerHTML: {\n __html: sheet.textContent\n },\n id: sheet.id\n }));\n };\n return {\n element,\n getStyleElement\n };\n}","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport _objectSpread from \"@babel/runtime/helpers/objectSpread2\";\nimport invariant from 'fbjs/lib/invariant';\nimport unmountComponentAtNode from '../unmountComponentAtNode';\nimport renderApplication, { getApplication as _getApplication } from './renderApplication';\nvar emptyObject = {};\nvar runnables = {};\nvar componentProviderInstrumentationHook = component => component();\nvar wrapperComponentProvider;\n\n/**\n * `AppRegistry` is the JS entry point to running all React Native apps.\n */\nexport default class AppRegistry {\n static getAppKeys() {\n return Object.keys(runnables);\n }\n static getApplication(appKey, appParameters) {\n invariant(runnables[appKey] && runnables[appKey].getApplication, \"Application \" + appKey + \" has not been registered. \" + 'This is either due to an import error during initialization or failure to call AppRegistry.registerComponent.');\n return runnables[appKey].getApplication(appParameters);\n }\n static registerComponent(appKey, componentProvider) {\n runnables[appKey] = {\n getApplication: appParameters => _getApplication(componentProviderInstrumentationHook(componentProvider), appParameters ? appParameters.initialProps : emptyObject, wrapperComponentProvider && wrapperComponentProvider(appParameters)),\n run: appParameters => renderApplication(componentProviderInstrumentationHook(componentProvider), wrapperComponentProvider && wrapperComponentProvider(appParameters), appParameters.callback, {\n hydrate: appParameters.hydrate || false,\n initialProps: appParameters.initialProps || emptyObject,\n mode: appParameters.mode || 'concurrent',\n rootTag: appParameters.rootTag\n })\n };\n return appKey;\n }\n static registerConfig(config) {\n config.forEach(_ref => {\n var appKey = _ref.appKey,\n component = _ref.component,\n run = _ref.run;\n if (run) {\n AppRegistry.registerRunnable(appKey, run);\n } else {\n invariant(component, 'No component provider passed in');\n AppRegistry.registerComponent(appKey, component);\n }\n });\n }\n\n // TODO: fix style sheet creation when using this method\n static registerRunnable(appKey, run) {\n runnables[appKey] = {\n run\n };\n return appKey;\n }\n static runApplication(appKey, appParameters) {\n var isDevelopment = process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test';\n if (isDevelopment) {\n var params = _objectSpread({}, appParameters);\n params.rootTag = \"#\" + params.rootTag.id;\n console.log(\"Running application \\\"\" + appKey + \"\\\" with appParams:\\n\", params, \"\\nDevelopment-level warnings: \" + (isDevelopment ? 'ON' : 'OFF') + \".\" + (\"\\nPerformance optimizations: \" + (isDevelopment ? 'OFF' : 'ON') + \".\"));\n }\n invariant(runnables[appKey] && runnables[appKey].run, \"Application \\\"\" + appKey + \"\\\" has not been registered. \" + 'This is either due to an import error during initialization or failure to call AppRegistry.registerComponent.');\n return runnables[appKey].run(appParameters);\n }\n static setComponentProviderInstrumentationHook(hook) {\n componentProviderInstrumentationHook = hook;\n }\n static setWrapperComponentProvider(provider) {\n wrapperComponentProvider = provider;\n }\n static unmountApplicationComponentAtRootTag(rootTag) {\n unmountComponentAtNode(rootTag);\n }\n}","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport invariant from 'fbjs/lib/invariant';\nimport EventEmitter from '../../vendor/react-native/vendor/emitter/EventEmitter';\nimport canUseDOM from '../../modules/canUseDom';\n\n// Android 4.4 browser\nvar isPrefixed = canUseDOM && !document.hasOwnProperty('hidden') && document.hasOwnProperty('webkitHidden');\nvar EVENT_TYPES = ['change', 'memoryWarning'];\nvar VISIBILITY_CHANGE_EVENT = isPrefixed ? 'webkitvisibilitychange' : 'visibilitychange';\nvar VISIBILITY_STATE_PROPERTY = isPrefixed ? 'webkitVisibilityState' : 'visibilityState';\nvar AppStates = {\n BACKGROUND: 'background',\n ACTIVE: 'active'\n};\nvar changeEmitter = null;\nexport default class AppState {\n static get currentState() {\n if (!AppState.isAvailable) {\n return AppStates.ACTIVE;\n }\n switch (document[VISIBILITY_STATE_PROPERTY]) {\n case 'hidden':\n case 'prerender':\n case 'unloaded':\n return AppStates.BACKGROUND;\n default:\n return AppStates.ACTIVE;\n }\n }\n static addEventListener(type, handler) {\n if (AppState.isAvailable) {\n invariant(EVENT_TYPES.indexOf(type) !== -1, 'Trying to subscribe to unknown event: \"%s\"', type);\n if (type === 'change') {\n if (!changeEmitter) {\n changeEmitter = new EventEmitter();\n document.addEventListener(VISIBILITY_CHANGE_EVENT, () => {\n if (changeEmitter) {\n changeEmitter.emit('change', AppState.currentState);\n }\n }, false);\n }\n return changeEmitter.addListener(type, handler);\n }\n }\n }\n}\nAppState.isAvailable = canUseDOM && !!document[VISIBILITY_STATE_PROPERTY];","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nfunction emptyFunction() {}\nvar BackHandler = {\n exitApp: emptyFunction,\n addEventListener() {\n console.error('BackHandler is not supported on web and should not be used.');\n return {\n remove: emptyFunction\n };\n },\n removeEventListener: emptyFunction\n};\nexport default BackHandler;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nvar clipboardAvailable;\nexport default class Clipboard {\n static isAvailable() {\n if (clipboardAvailable === undefined) {\n clipboardAvailable = typeof document.queryCommandSupported === 'function' && document.queryCommandSupported('copy');\n }\n return clipboardAvailable;\n }\n static getString() {\n return Promise.resolve('');\n }\n static setString(text) {\n var success = false;\n var body = document.body;\n if (body) {\n // add the text to a hidden node\n var node = document.createElement('span');\n node.textContent = text;\n node.style.opacity = '0';\n node.style.position = 'absolute';\n node.style.whiteSpace = 'pre-wrap';\n node.style.userSelect = 'auto';\n body.appendChild(node);\n\n // select the text\n var selection = window.getSelection();\n selection.removeAllRanges();\n var range = document.createRange();\n range.selectNodeContents(node);\n selection.addRange(range);\n\n // attempt to copy\n try {\n document.execCommand('copy');\n success = true;\n } catch (e) {}\n\n // remove selection and node\n selection.removeAllRanges();\n body.removeChild(node);\n }\n return success;\n }\n}","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nvar I18nManager = {\n allowRTL() {\n return;\n },\n forceRTL() {\n return;\n },\n getConstants() {\n return {\n isRTL: false\n };\n }\n};\nexport default I18nManager;","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n * @format\n */\n\n'use strict';\n\nimport Platform from '../../../exports/Platform';\nimport UIManager from '../../../exports/UIManager';\nvar __DEV__ = process.env.NODE_ENV !== 'production';\nfunction configureNext(config, onAnimationDidEnd) {\n if (!Platform.isTesting) {\n UIManager.configureNextLayoutAnimation(config, onAnimationDidEnd !== null && onAnimationDidEnd !== void 0 ? onAnimationDidEnd : function () {}, function () {} /* unused onError */);\n }\n}\nfunction create(duration, type, property) {\n return {\n duration,\n create: {\n type,\n property\n },\n update: {\n type\n },\n delete: {\n type,\n property\n }\n };\n}\nvar Presets = {\n easeInEaseOut: create(300, 'easeInEaseOut', 'opacity'),\n linear: create(500, 'linear', 'opacity'),\n spring: {\n duration: 700,\n create: {\n type: 'linear',\n property: 'opacity'\n },\n update: {\n type: 'spring',\n springDamping: 0.4\n },\n delete: {\n type: 'linear',\n property: 'opacity'\n }\n }\n};\n\n/**\n * Automatically animates views to their new positions when the\n * next layout happens.\n *\n * A common way to use this API is to call it before calling `setState`.\n *\n * Note that in order to get this to work on **Android** you need to set the following flags via `UIManager`:\n *\n * UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);\n */\nvar LayoutAnimation = {\n /**\n * Schedules an animation to happen on the next layout.\n *\n * @param config Specifies animation properties:\n *\n * - `duration` in milliseconds\n * - `create`, `AnimationConfig` for animating in new views\n * - `update`, `AnimationConfig` for animating views that have been updated\n *\n * @param onAnimationDidEnd Called when the animation finished.\n * Only supported on iOS.\n * @param onError Called on error. Only supported on iOS.\n */\n configureNext,\n /**\n * Helper for creating a config for `configureNext`.\n */\n create,\n Types: Object.freeze({\n spring: 'spring',\n linear: 'linear',\n easeInEaseOut: 'easeInEaseOut',\n easeIn: 'easeIn',\n easeOut: 'easeOut',\n keyboard: 'keyboard'\n }),\n Properties: Object.freeze({\n opacity: 'opacity',\n scaleX: 'scaleX',\n scaleY: 'scaleY',\n scaleXY: 'scaleXY'\n }),\n checkConfig() {\n console.error('LayoutAnimation.checkConfig(...) has been disabled.');\n },\n Presets,\n easeInEaseOut: configureNext.bind(null, Presets.easeInEaseOut),\n linear: configureNext.bind(null, Presets.linear),\n spring: configureNext.bind(null, Presets.spring)\n};\nexport default LayoutAnimation;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport LayoutAnimation from '../../vendor/react-native/LayoutAnimation';\nexport default LayoutAnimation;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport invariant from 'fbjs/lib/invariant';\nclass Share {\n static share(content, options) {\n if (options === void 0) {\n options = {};\n }\n invariant(typeof content === 'object' && content !== null, 'Content to share must be a valid object');\n invariant(typeof content.url === 'string' || typeof content.message === 'string', 'At least one of URL and message is required');\n invariant(typeof options === 'object' && options !== null, 'Options must be a valid object');\n invariant(!content.title || typeof content.title === 'string', 'Invalid title: title should be a string.');\n if (window.navigator.share !== undefined) {\n return window.navigator.share({\n title: content.title,\n text: content.message,\n url: content.url\n });\n } else {\n return Promise.reject(new Error('Share is not supported in this browser'));\n }\n }\n\n /**\n * The content was successfully shared.\n */\n static get sharedAction() {\n return 'sharedAction';\n }\n\n /**\n * The dialog has been dismissed.\n * @platform ios\n */\n static get dismissedAction() {\n return 'dismissedAction';\n }\n}\nexport default Share;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nvar vibrate = pattern => {\n if ('vibrate' in window.navigator) {\n window.navigator.vibrate(pattern);\n }\n};\nvar Vibration = {\n cancel() {\n vibrate(0);\n },\n vibrate(pattern) {\n if (pattern === void 0) {\n pattern = 400;\n }\n vibrate(pattern);\n }\n};\nexport default Vibration;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport * as React from 'react';\nimport StyleSheet from '../StyleSheet';\nimport TouchableOpacity from '../TouchableOpacity';\nimport Text from '../Text';\n//import { warnOnce } from '../../modules/warnOnce';\n\nvar Button = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {\n // warnOnce('Button', 'Button is deprecated. Please use Pressable.');\n\n var accessibilityLabel = props.accessibilityLabel,\n color = props.color,\n disabled = props.disabled,\n onPress = props.onPress,\n testID = props.testID,\n title = props.title;\n return /*#__PURE__*/React.createElement(TouchableOpacity, {\n accessibilityLabel: accessibilityLabel,\n accessibilityRole: \"button\",\n disabled: disabled,\n focusable: !disabled,\n onPress: onPress,\n ref: forwardedRef,\n style: [styles.button, color && {\n backgroundColor: color\n }, disabled && styles.buttonDisabled],\n testID: testID\n }, /*#__PURE__*/React.createElement(Text, {\n style: [styles.text, disabled && styles.textDisabled]\n }, title));\n});\nButton.displayName = 'Button';\nvar styles = StyleSheet.create({\n button: {\n backgroundColor: '#2196F3',\n borderRadius: 2\n },\n text: {\n color: '#fff',\n fontWeight: '500',\n padding: 8,\n textAlign: 'center',\n textTransform: 'uppercase'\n },\n buttonDisabled: {\n backgroundColor: '#dfdfdf'\n },\n textDisabled: {\n color: '#a1a1a1'\n }\n});\nexport default Button;","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"style\"];\n/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport * as React from 'react';\nimport StyleSheet from '../StyleSheet';\nimport View from '../View';\nimport canUseDOM from '../../modules/canUseDom';\nvar cssFunction = function () {\n if (canUseDOM && window.CSS && window.CSS.supports && window.CSS.supports('top: constant(safe-area-inset-top)')) {\n return 'constant';\n }\n return 'env';\n}();\nvar SafeAreaView = /*#__PURE__*/React.forwardRef((props, ref) => {\n var style = props.style,\n rest = _objectWithoutPropertiesLoose(props, _excluded);\n return /*#__PURE__*/React.createElement(View, _extends({}, rest, {\n ref: ref,\n style: [styles.root, style]\n }));\n});\nSafeAreaView.displayName = 'SafeAreaView';\nvar styles = StyleSheet.create({\n root: {\n paddingTop: cssFunction + \"(safe-area-inset-top)\",\n paddingRight: cssFunction + \"(safe-area-inset-right)\",\n paddingBottom: cssFunction + \"(safe-area-inset-bottom)\",\n paddingLeft: cssFunction + \"(safe-area-inset-left)\"\n }\n});\nexport default SafeAreaView;","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport VirtualizedList from '../../vendor/react-native/VirtualizedList';\nexport default VirtualizedList;","import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nvar _excluded = [\"style\"];\n/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport View from '../../exports/View';\nimport React from 'react';\n\n/**\n * Common implementation for a simple stubbed view.\n */\nfunction UnimplementedView(_ref) {\n var style = _ref.style,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n return /*#__PURE__*/React.createElement(View, _extends({}, props, {\n style: [unimplementedViewStyles, style]\n }));\n}\nvar unimplementedViewStyles = process.env.NODE_ENV !== 'production' ? {\n alignSelf: 'flex-start',\n borderColor: 'red',\n borderWidth: 1\n} : {};\nexport default UnimplementedView;","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\nimport React from 'react';\nimport UnimplementedView from '../../modules/UnimplementedView';\nfunction YellowBox(props) {\n return /*#__PURE__*/React.createElement(UnimplementedView, props);\n}\nYellowBox.ignoreWarnings = () => {};\nexport default YellowBox;","import RCTDeviceEventEmitter from '../../vendor/react-native/EventEmitter/RCTDeviceEventEmitter';\nexport default RCTDeviceEventEmitter;","/**\n * Copyright (c) Nicolas Gallagher.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport { useLocaleContext } from '../../modules/useLocale';\nexport default useLocaleContext;","export { default as unstable_createElement } from './exports/createElement';\nexport { default as findNodeHandle } from './exports/findNodeHandle';\nexport { default as processColor } from './exports/processColor';\nexport { default as render } from './exports/render';\nexport { default as unmountComponentAtNode } from './exports/unmountComponentAtNode';\nexport { default as NativeModules } from './exports/NativeModules';\n\n// APIs\nexport { default as AccessibilityInfo } from './exports/AccessibilityInfo';\nexport { default as Alert } from './exports/Alert';\nexport { default as Animated } from './exports/Animated';\nexport { default as Appearance } from './exports/Appearance';\nexport { default as AppRegistry } from './exports/AppRegistry';\nexport { default as AppState } from './exports/AppState';\nexport { default as BackHandler } from './exports/BackHandler';\nexport { default as Clipboard } from './exports/Clipboard';\nexport { default as Dimensions } from './exports/Dimensions';\nexport { default as Easing } from './exports/Easing';\nexport { default as I18nManager } from './exports/I18nManager';\nexport { default as Keyboard } from './exports/Keyboard';\nexport { default as InteractionManager } from './exports/InteractionManager';\nexport { default as LayoutAnimation } from './exports/LayoutAnimation';\nexport { default as Linking } from './exports/Linking';\nexport { default as NativeEventEmitter } from './exports/NativeEventEmitter';\nexport { default as PanResponder } from './exports/PanResponder';\nexport { default as PixelRatio } from './exports/PixelRatio';\nexport { default as Platform } from './exports/Platform';\nexport { default as Share } from './exports/Share';\nexport { default as StyleSheet } from './exports/StyleSheet';\nexport { default as UIManager } from './exports/UIManager';\nexport { default as Vibration } from './exports/Vibration';\n\n// components\nexport { default as ActivityIndicator } from './exports/ActivityIndicator';\nexport { default as Button } from './exports/Button';\nexport { default as CheckBox } from './exports/CheckBox';\nexport { default as FlatList } from './exports/FlatList';\nexport { default as Image } from './exports/Image';\nexport { default as ImageBackground } from './exports/ImageBackground';\nexport { default as KeyboardAvoidingView } from './exports/KeyboardAvoidingView';\nexport { default as Modal } from './exports/Modal';\nexport { default as Picker } from './exports/Picker';\nexport { default as Pressable } from './exports/Pressable';\nexport { default as ProgressBar } from './exports/ProgressBar';\nexport { default as RefreshControl } from './exports/RefreshControl';\nexport { default as SafeAreaView } from './exports/SafeAreaView';\nexport { default as ScrollView } from './exports/ScrollView';\nexport { default as SectionList } from './exports/SectionList';\nexport { default as StatusBar } from './exports/StatusBar';\nexport { default as Switch } from './exports/Switch';\nexport { default as Text } from './exports/Text';\nexport { default as TextInput } from './exports/TextInput';\nexport { default as Touchable } from './exports/Touchable';\nexport { default as TouchableHighlight } from './exports/TouchableHighlight';\nexport { default as TouchableNativeFeedback } from './exports/TouchableNativeFeedback';\nexport { default as TouchableOpacity } from './exports/TouchableOpacity';\nexport { default as TouchableWithoutFeedback } from './exports/TouchableWithoutFeedback';\nexport { default as View } from './exports/View';\nexport { default as VirtualizedList } from './exports/VirtualizedList';\nexport { default as YellowBox } from './exports/YellowBox';\nexport { default as LogBox } from './exports/LogBox';\n\n// plugins\nexport { default as DeviceEventEmitter } from './exports/DeviceEventEmitter';\n\n// hooks\nexport { default as useColorScheme } from './exports/useColorScheme';\nexport { default as useLocaleContext } from './exports/useLocaleContext';\nexport { default as useWindowDimensions } from './exports/useWindowDimensions';","// extracted by mini-css-extract-plugin","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar matchMedia_exports = {};\n__export(matchMedia_exports, {\n matchMedia: () => matchMedia\n});\nmodule.exports = __toCommonJS(matchMedia_exports);\nconst matchMedia = globalThis.matchMedia;","export default {\"src\":\"/_next/static/media/HomeBackground-native.ae01898d.png\",\"height\":1646,\"width\":476,\"blurDataURL\":\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAAICAMAAADk895wAAAAGFBMVEX/+PKl0Ma72sny6dfH1sfD2Mm+28ry7t8vJdWQAAAAB3RSTlP+/uL+/f7k6lQsTwAAAAlwSFlzAAALEwAACxMBAJqcGAAAABZJREFUeJxjYGNiYGRkYGVhYGdmQAIAAhMAHpTt0IsAAAAASUVORK5CYII=\",\"blurWidth\":2,\"blurHeight\":8};","export function getConnectivity() {\n var _a;\n const navigator = window.navigator;\n return {\n status: navigator.onLine ? 'connected' : 'not_connected',\n interfaces: navigator.connection && navigator.connection.type ? [navigator.connection.type] : undefined,\n effective_type: (_a = navigator.connection) === null || _a === void 0 ? void 0 : _a.effectiveType,\n };\n}\n//# sourceMappingURL=connectivity.js.map","// import { useThemeName } from \"tamagui\"\n\nexport const useIsDarkMode = () => {\n /**\n * Utility to check whether the app is in dark mode.\n *\n * Note: dark mode is currently disabled globally while we finish the dark mode styling.\n * To turn it on, remove the early return and uncomment the real implementation.\n * You will also need to adjust themes.ts\n */\n // const themeName = useThemeName()\n // return themeName == \"dark\"\n return false\n}\n","// src/queryCache.ts\nimport { hashQueryKeyByOptions, matchQuery } from \"./utils.js\";\nimport { Query } from \"./query.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Subscribable } from \"./subscribable.js\";\nvar QueryCache = class extends Subscribable {\n constructor(config = {}) {\n super();\n this.config = config;\n this.#queries = /* @__PURE__ */ new Map();\n }\n #queries;\n build(client, options, state) {\n const queryKey = options.queryKey;\n const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);\n let query = this.get(queryHash);\n if (!query) {\n query = new Query({\n cache: this,\n queryKey,\n queryHash,\n options: client.defaultQueryOptions(options),\n state,\n defaultOptions: client.getQueryDefaults(queryKey)\n });\n this.add(query);\n }\n return query;\n }\n add(query) {\n if (!this.#queries.has(query.queryHash)) {\n this.#queries.set(query.queryHash, query);\n this.notify({\n type: \"added\",\n query\n });\n }\n }\n remove(query) {\n const queryInMap = this.#queries.get(query.queryHash);\n if (queryInMap) {\n query.destroy();\n if (queryInMap === query) {\n this.#queries.delete(query.queryHash);\n }\n this.notify({ type: \"removed\", query });\n }\n }\n clear() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n this.remove(query);\n });\n });\n }\n get(queryHash) {\n return this.#queries.get(queryHash);\n }\n getAll() {\n return [...this.#queries.values()];\n }\n find(filters) {\n const defaultedFilters = { exact: true, ...filters };\n return this.getAll().find(\n (query) => matchQuery(defaultedFilters, query)\n );\n }\n findAll(filters = {}) {\n const queries = this.getAll();\n return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;\n }\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event);\n });\n });\n }\n onFocus() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n query.onFocus();\n });\n });\n }\n onOnline() {\n notifyManager.batch(() => {\n this.getAll().forEach((query) => {\n query.onOnline();\n });\n });\n }\n};\nexport {\n QueryCache\n};\n//# sourceMappingURL=queryCache.js.map","// src/mutationCache.ts\nimport { notifyManager } from \"./notifyManager.js\";\nimport { Mutation } from \"./mutation.js\";\nimport { matchMutation, noop } from \"./utils.js\";\nimport { Subscribable } from \"./subscribable.js\";\nvar MutationCache = class extends Subscribable {\n constructor(config = {}) {\n super();\n this.config = config;\n this.#mutations = /* @__PURE__ */ new Set();\n this.#scopes = /* @__PURE__ */ new Map();\n this.#mutationId = 0;\n }\n #mutations;\n #scopes;\n #mutationId;\n build(client, options, state) {\n const mutation = new Mutation({\n mutationCache: this,\n mutationId: ++this.#mutationId,\n options: client.defaultMutationOptions(options),\n state\n });\n this.add(mutation);\n return mutation;\n }\n add(mutation) {\n this.#mutations.add(mutation);\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const scopedMutations = this.#scopes.get(scope);\n if (scopedMutations) {\n scopedMutations.push(mutation);\n } else {\n this.#scopes.set(scope, [mutation]);\n }\n }\n this.notify({ type: \"added\", mutation });\n }\n remove(mutation) {\n if (this.#mutations.delete(mutation)) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const scopedMutations = this.#scopes.get(scope);\n if (scopedMutations) {\n if (scopedMutations.length > 1) {\n const index = scopedMutations.indexOf(mutation);\n if (index !== -1) {\n scopedMutations.splice(index, 1);\n }\n } else if (scopedMutations[0] === mutation) {\n this.#scopes.delete(scope);\n }\n }\n }\n }\n this.notify({ type: \"removed\", mutation });\n }\n canRun(mutation) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const mutationsWithSameScope = this.#scopes.get(scope);\n const firstPendingMutation = mutationsWithSameScope?.find(\n (m) => m.state.status === \"pending\"\n );\n return !firstPendingMutation || firstPendingMutation === mutation;\n } else {\n return true;\n }\n }\n runNext(mutation) {\n const scope = scopeFor(mutation);\n if (typeof scope === \"string\") {\n const foundMutation = this.#scopes.get(scope)?.find((m) => m !== mutation && m.state.isPaused);\n return foundMutation?.continue() ?? Promise.resolve();\n } else {\n return Promise.resolve();\n }\n }\n clear() {\n notifyManager.batch(() => {\n this.#mutations.forEach((mutation) => {\n this.notify({ type: \"removed\", mutation });\n });\n this.#mutations.clear();\n this.#scopes.clear();\n });\n }\n getAll() {\n return Array.from(this.#mutations);\n }\n find(filters) {\n const defaultedFilters = { exact: true, ...filters };\n return this.getAll().find(\n (mutation) => matchMutation(defaultedFilters, mutation)\n );\n }\n findAll(filters = {}) {\n return this.getAll().filter((mutation) => matchMutation(filters, mutation));\n }\n notify(event) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event);\n });\n });\n }\n resumePausedMutations() {\n const pausedMutations = this.getAll().filter((x) => x.state.isPaused);\n return notifyManager.batch(\n () => Promise.all(\n pausedMutations.map((mutation) => mutation.continue().catch(noop))\n )\n );\n }\n};\nfunction scopeFor(mutation) {\n return mutation.options.scope?.id;\n}\nexport {\n MutationCache\n};\n//# sourceMappingURL=mutationCache.js.map","// src/infiniteQueryBehavior.ts\nimport { addToEnd, addToStart, ensureQueryFn } from \"./utils.js\";\nfunction infiniteQueryBehavior(pages) {\n return {\n onFetch: (context, query) => {\n const options = context.options;\n const direction = context.fetchOptions?.meta?.fetchMore?.direction;\n const oldPages = context.state.data?.pages || [];\n const oldPageParams = context.state.data?.pageParams || [];\n let result = { pages: [], pageParams: [] };\n let currentPage = 0;\n const fetchFn = async () => {\n let cancelled = false;\n const addSignalProperty = (object) => {\n Object.defineProperty(object, \"signal\", {\n enumerable: true,\n get: () => {\n if (context.signal.aborted) {\n cancelled = true;\n } else {\n context.signal.addEventListener(\"abort\", () => {\n cancelled = true;\n });\n }\n return context.signal;\n }\n });\n };\n const queryFn = ensureQueryFn(context.options, context.fetchOptions);\n const fetchPage = async (data, param, previous) => {\n if (cancelled) {\n return Promise.reject();\n }\n if (param == null && data.pages.length) {\n return Promise.resolve(data);\n }\n const queryFnContext = {\n queryKey: context.queryKey,\n pageParam: param,\n direction: previous ? \"backward\" : \"forward\",\n meta: context.options.meta\n };\n addSignalProperty(queryFnContext);\n const page = await queryFn(\n queryFnContext\n );\n const { maxPages } = context.options;\n const addTo = previous ? addToStart : addToEnd;\n return {\n pages: addTo(data.pages, page, maxPages),\n pageParams: addTo(data.pageParams, param, maxPages)\n };\n };\n if (direction && oldPages.length) {\n const previous = direction === \"backward\";\n const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;\n const oldData = {\n pages: oldPages,\n pageParams: oldPageParams\n };\n const param = pageParamFn(options, oldData);\n result = await fetchPage(oldData, param, previous);\n } else {\n const remainingPages = pages ?? oldPages.length;\n do {\n const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);\n if (currentPage > 0 && param == null) {\n break;\n }\n result = await fetchPage(result, param);\n currentPage++;\n } while (currentPage < remainingPages);\n }\n return result;\n };\n if (context.options.persister) {\n context.fetchFn = () => {\n return context.options.persister?.(\n fetchFn,\n {\n queryKey: context.queryKey,\n meta: context.options.meta,\n signal: context.signal\n },\n query\n );\n };\n } else {\n context.fetchFn = fetchFn;\n }\n }\n };\n}\nfunction getNextPageParam(options, { pages, pageParams }) {\n const lastIndex = pages.length - 1;\n return pages.length > 0 ? options.getNextPageParam(\n pages[lastIndex],\n pages,\n pageParams[lastIndex],\n pageParams\n ) : void 0;\n}\nfunction getPreviousPageParam(options, { pages, pageParams }) {\n return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;\n}\nfunction hasNextPage(options, data) {\n if (!data)\n return false;\n return getNextPageParam(options, data) != null;\n}\nfunction hasPreviousPage(options, data) {\n if (!data || !options.getPreviousPageParam)\n return false;\n return getPreviousPageParam(options, data) != null;\n}\nexport {\n hasNextPage,\n hasPreviousPage,\n infiniteQueryBehavior\n};\n//# sourceMappingURL=infiniteQueryBehavior.js.map","// src/queryClient.ts\nimport {\n functionalUpdate,\n hashKey,\n hashQueryKeyByOptions,\n noop,\n partialMatchKey,\n resolveStaleTime,\n skipToken\n} from \"./utils.js\";\nimport { QueryCache } from \"./queryCache.js\";\nimport { MutationCache } from \"./mutationCache.js\";\nimport { focusManager } from \"./focusManager.js\";\nimport { onlineManager } from \"./onlineManager.js\";\nimport { notifyManager } from \"./notifyManager.js\";\nimport { infiniteQueryBehavior } from \"./infiniteQueryBehavior.js\";\nvar QueryClient = class {\n #queryCache;\n #mutationCache;\n #defaultOptions;\n #queryDefaults;\n #mutationDefaults;\n #mountCount;\n #unsubscribeFocus;\n #unsubscribeOnline;\n constructor(config = {}) {\n this.#queryCache = config.queryCache || new QueryCache();\n this.#mutationCache = config.mutationCache || new MutationCache();\n this.#defaultOptions = config.defaultOptions || {};\n this.#queryDefaults = /* @__PURE__ */ new Map();\n this.#mutationDefaults = /* @__PURE__ */ new Map();\n this.#mountCount = 0;\n }\n mount() {\n this.#mountCount++;\n if (this.#mountCount !== 1)\n return;\n this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {\n if (focused) {\n await this.resumePausedMutations();\n this.#queryCache.onFocus();\n }\n });\n this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {\n if (online) {\n await this.resumePausedMutations();\n this.#queryCache.onOnline();\n }\n });\n }\n unmount() {\n this.#mountCount--;\n if (this.#mountCount !== 0)\n return;\n this.#unsubscribeFocus?.();\n this.#unsubscribeFocus = void 0;\n this.#unsubscribeOnline?.();\n this.#unsubscribeOnline = void 0;\n }\n isFetching(filters) {\n return this.#queryCache.findAll({ ...filters, fetchStatus: \"fetching\" }).length;\n }\n isMutating(filters) {\n return this.#mutationCache.findAll({ ...filters, status: \"pending\" }).length;\n }\n getQueryData(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(options.queryHash)?.state.data;\n }\n ensureQueryData(options) {\n const defaultedOptions = this.defaultQueryOptions(options);\n const query = this.#queryCache.build(this, defaultedOptions);\n const cachedData = query.state.data;\n if (cachedData === void 0) {\n return this.fetchQuery(options);\n }\n if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {\n void this.prefetchQuery(defaultedOptions);\n }\n return Promise.resolve(cachedData);\n }\n getQueriesData(filters) {\n return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {\n const data = state.data;\n return [queryKey, data];\n });\n }\n setQueryData(queryKey, updater, options) {\n const defaultedOptions = this.defaultQueryOptions({ queryKey });\n const query = this.#queryCache.get(\n defaultedOptions.queryHash\n );\n const prevData = query?.state.data;\n const data = functionalUpdate(updater, prevData);\n if (data === void 0) {\n return void 0;\n }\n return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });\n }\n setQueriesData(filters, updater, options) {\n return notifyManager.batch(\n () => this.#queryCache.findAll(filters).map(({ queryKey }) => [\n queryKey,\n this.setQueryData(queryKey, updater, options)\n ])\n );\n }\n getQueryState(queryKey) {\n const options = this.defaultQueryOptions({ queryKey });\n return this.#queryCache.get(\n options.queryHash\n )?.state;\n }\n removeQueries(filters) {\n const queryCache = this.#queryCache;\n notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n queryCache.remove(query);\n });\n });\n }\n resetQueries(filters, options) {\n const queryCache = this.#queryCache;\n const refetchFilters = {\n type: \"active\",\n ...filters\n };\n return notifyManager.batch(() => {\n queryCache.findAll(filters).forEach((query) => {\n query.reset();\n });\n return this.refetchQueries(refetchFilters, options);\n });\n }\n cancelQueries(filters, cancelOptions = {}) {\n const defaultedCancelOptions = { revert: true, ...cancelOptions };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))\n );\n return Promise.all(promises).then(noop).catch(noop);\n }\n invalidateQueries(filters, options = {}) {\n return notifyManager.batch(() => {\n this.#queryCache.findAll(filters).forEach((query) => {\n query.invalidate();\n });\n if (filters?.refetchType === \"none\") {\n return Promise.resolve();\n }\n const refetchFilters = {\n ...filters,\n type: filters?.refetchType ?? filters?.type ?? \"active\"\n };\n return this.refetchQueries(refetchFilters, options);\n });\n }\n refetchQueries(filters, options = {}) {\n const fetchOptions = {\n ...options,\n cancelRefetch: options.cancelRefetch ?? true\n };\n const promises = notifyManager.batch(\n () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled()).map((query) => {\n let promise = query.fetch(void 0, fetchOptions);\n if (!fetchOptions.throwOnError) {\n promise = promise.catch(noop);\n }\n return query.state.fetchStatus === \"paused\" ? Promise.resolve() : promise;\n })\n );\n return Promise.all(promises).then(noop);\n }\n fetchQuery(options) {\n const defaultedOptions = this.defaultQueryOptions(options);\n if (defaultedOptions.retry === void 0) {\n defaultedOptions.retry = false;\n }\n const query = this.#queryCache.build(this, defaultedOptions);\n return query.isStaleByTime(\n resolveStaleTime(defaultedOptions.staleTime, query)\n ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);\n }\n prefetchQuery(options) {\n return this.fetchQuery(options).then(noop).catch(noop);\n }\n fetchInfiniteQuery(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.fetchQuery(options);\n }\n prefetchInfiniteQuery(options) {\n return this.fetchInfiniteQuery(options).then(noop).catch(noop);\n }\n ensureInfiniteQueryData(options) {\n options.behavior = infiniteQueryBehavior(options.pages);\n return this.ensureQueryData(options);\n }\n resumePausedMutations() {\n if (onlineManager.isOnline()) {\n return this.#mutationCache.resumePausedMutations();\n }\n return Promise.resolve();\n }\n getQueryCache() {\n return this.#queryCache;\n }\n getMutationCache() {\n return this.#mutationCache;\n }\n getDefaultOptions() {\n return this.#defaultOptions;\n }\n setDefaultOptions(options) {\n this.#defaultOptions = options;\n }\n setQueryDefaults(queryKey, options) {\n this.#queryDefaults.set(hashKey(queryKey), {\n queryKey,\n defaultOptions: options\n });\n }\n getQueryDefaults(queryKey) {\n const defaults = [...this.#queryDefaults.values()];\n const result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(queryKey, queryDefault.queryKey)) {\n Object.assign(result, queryDefault.defaultOptions);\n }\n });\n return result;\n }\n setMutationDefaults(mutationKey, options) {\n this.#mutationDefaults.set(hashKey(mutationKey), {\n mutationKey,\n defaultOptions: options\n });\n }\n getMutationDefaults(mutationKey) {\n const defaults = [...this.#mutationDefaults.values()];\n let result = {};\n defaults.forEach((queryDefault) => {\n if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {\n result = { ...result, ...queryDefault.defaultOptions };\n }\n });\n return result;\n }\n defaultQueryOptions(options) {\n if (options._defaulted) {\n return options;\n }\n const defaultedOptions = {\n ...this.#defaultOptions.queries,\n ...this.getQueryDefaults(options.queryKey),\n ...options,\n _defaulted: true\n };\n if (!defaultedOptions.queryHash) {\n defaultedOptions.queryHash = hashQueryKeyByOptions(\n defaultedOptions.queryKey,\n defaultedOptions\n );\n }\n if (defaultedOptions.refetchOnReconnect === void 0) {\n defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== \"always\";\n }\n if (defaultedOptions.throwOnError === void 0) {\n defaultedOptions.throwOnError = !!defaultedOptions.suspense;\n }\n if (!defaultedOptions.networkMode && defaultedOptions.persister) {\n defaultedOptions.networkMode = \"offlineFirst\";\n }\n if (defaultedOptions.queryFn === skipToken) {\n defaultedOptions.enabled = false;\n }\n return defaultedOptions;\n }\n defaultMutationOptions(options) {\n if (options?._defaulted) {\n return options;\n }\n return {\n ...this.#defaultOptions.mutations,\n ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),\n ...options,\n _defaulted: true\n };\n }\n clear() {\n this.#queryCache.clear();\n this.#mutationCache.clear();\n }\n};\nexport {\n QueryClient\n};\n//# sourceMappingURL=queryClient.js.map","import { QueryClient } from \"@tanstack/react-query\"\nimport { useMemo } from \"react\"\n\nconst MILLISECONDS_PER_SECOND = 1000\nconst MILLISECONDS_PER_MINUTE = MILLISECONDS_PER_SECOND * 60\nconst MILLISECONDS_PER_HOUR = MILLISECONDS_PER_MINUTE * 60\n\nconst TWENTY_SECONDS = MILLISECONDS_PER_SECOND * 20\nconst FIVE_MINUTES = MILLISECONDS_PER_MINUTE * 5\nconst TWENTY_MINUTES = MILLISECONDS_PER_MINUTE * 20\nconst ONE_HOUR = MILLISECONDS_PER_HOUR\n\nexport const CacheTimes = {\n NONE: TWENTY_SECONDS, // We don't want to use a true 0 because it's useful to debounce parallel requests\n SHORT: FIVE_MINUTES,\n MEDIUM: TWENTY_MINUTES,\n LONG: ONE_HOUR,\n DEFAULT: TWENTY_SECONDS,\n} as const\n\nexport function useSetupQueryClient() {\n const client = useMemo(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: CacheTimes.DEFAULT,\n },\n },\n }),\n [],\n )\n return client\n}\n","/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * \n */\n\n'use client';\n\nimport * as React from 'react';\nimport createElement from '../createElement';\nimport * as forwardedProps from '../../modules/forwardedProps';\nimport pick from '../../modules/pick';\nimport useElementLayout from '../../modules/useElementLayout';\nimport useLayoutEffect from '../../modules/useLayoutEffect';\nimport useMergeRefs from '../../modules/useMergeRefs';\nimport usePlatformMethods from '../../modules/usePlatformMethods';\nimport useResponderEvents from '../../modules/useResponderEvents';\nimport { getLocaleDirection, useLocaleContext } from '../../modules/useLocale';\nimport StyleSheet from '../StyleSheet';\nimport TextInputState from '../../modules/TextInputState';\n//import { warnOnce } from '../../modules/warnOnce';\n\n/**\n * Determines whether a 'selection' prop differs from a node's existing\n * selection state.\n */\nvar isSelectionStale = (node, selection) => {\n var selectionEnd = node.selectionEnd,\n selectionStart = node.selectionStart;\n var start = selection.start,\n end = selection.end;\n return start !== selectionStart || end !== selectionEnd;\n};\n\n/**\n * Certain input types do no support 'selectSelectionRange' and will throw an\n * error.\n */\nvar setSelection = (node, selection) => {\n if (isSelectionStale(node, selection)) {\n var start = selection.start,\n end = selection.end;\n try {\n node.setSelectionRange(start, end || start);\n } catch (e) {}\n }\n};\nvar forwardPropsList = Object.assign({}, forwardedProps.defaultProps, forwardedProps.accessibilityProps, forwardedProps.clickProps, forwardedProps.focusProps, forwardedProps.keyboardProps, forwardedProps.mouseProps, forwardedProps.touchProps, forwardedProps.styleProps, {\n autoCapitalize: true,\n autoComplete: true,\n autoCorrect: true,\n autoFocus: true,\n defaultValue: true,\n disabled: true,\n lang: true,\n maxLength: true,\n onChange: true,\n onScroll: true,\n placeholder: true,\n pointerEvents: true,\n readOnly: true,\n rows: true,\n spellCheck: true,\n value: true,\n type: true\n});\nvar pickProps = props => pick(props, forwardPropsList);\n\n// If an Input Method Editor is processing key input, the 'keyCode' is 229.\n// https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode\nfunction isEventComposing(nativeEvent) {\n return nativeEvent.isComposing || nativeEvent.keyCode === 229;\n}\nvar focusTimeout = null;\nvar TextInput = /*#__PURE__*/React.forwardRef((props, forwardedRef) => {\n var _props$autoCapitalize = props.autoCapitalize,\n autoCapitalize = _props$autoCapitalize === void 0 ? 'sentences' : _props$autoCapitalize,\n autoComplete = props.autoComplete,\n autoCompleteType = props.autoCompleteType,\n _props$autoCorrect = props.autoCorrect,\n autoCorrect = _props$autoCorrect === void 0 ? true : _props$autoCorrect,\n blurOnSubmit = props.blurOnSubmit,\n caretHidden = props.caretHidden,\n clearTextOnFocus = props.clearTextOnFocus,\n dir = props.dir,\n editable = props.editable,\n enterKeyHint = props.enterKeyHint,\n inputMode = props.inputMode,\n keyboardType = props.keyboardType,\n _props$multiline = props.multiline,\n multiline = _props$multiline === void 0 ? false : _props$multiline,\n numberOfLines = props.numberOfLines,\n onBlur = props.onBlur,\n onChange = props.onChange,\n onChangeText = props.onChangeText,\n onContentSizeChange = props.onContentSizeChange,\n onFocus = props.onFocus,\n onKeyPress = props.onKeyPress,\n onLayout = props.onLayout,\n onMoveShouldSetResponder = props.onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture = props.onMoveShouldSetResponderCapture,\n onResponderEnd = props.onResponderEnd,\n onResponderGrant = props.onResponderGrant,\n onResponderMove = props.onResponderMove,\n onResponderReject = props.onResponderReject,\n onResponderRelease = props.onResponderRelease,\n onResponderStart = props.onResponderStart,\n onResponderTerminate = props.onResponderTerminate,\n onResponderTerminationRequest = props.onResponderTerminationRequest,\n onScrollShouldSetResponder = props.onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture = props.onScrollShouldSetResponderCapture,\n onSelectionChange = props.onSelectionChange,\n onSelectionChangeShouldSetResponder = props.onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture = props.onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder = props.onStartShouldSetResponder,\n onStartShouldSetResponderCapture = props.onStartShouldSetResponderCapture,\n onSubmitEditing = props.onSubmitEditing,\n placeholderTextColor = props.placeholderTextColor,\n _props$readOnly = props.readOnly,\n readOnly = _props$readOnly === void 0 ? false : _props$readOnly,\n returnKeyType = props.returnKeyType,\n rows = props.rows,\n _props$secureTextEntr = props.secureTextEntry,\n secureTextEntry = _props$secureTextEntr === void 0 ? false : _props$secureTextEntr,\n selection = props.selection,\n selectTextOnFocus = props.selectTextOnFocus,\n showSoftInputOnFocus = props.showSoftInputOnFocus,\n spellCheck = props.spellCheck;\n var type;\n var _inputMode;\n if (inputMode != null) {\n _inputMode = inputMode;\n if (inputMode === 'email') {\n type = 'email';\n } else if (inputMode === 'tel') {\n type = 'tel';\n } else if (inputMode === 'search') {\n type = 'search';\n } else if (inputMode === 'url') {\n type = 'url';\n } else {\n type = 'text';\n }\n } else if (keyboardType != null) {\n // warnOnce('keyboardType', 'keyboardType is deprecated. Use inputMode.');\n switch (keyboardType) {\n case 'email-address':\n type = 'email';\n break;\n case 'number-pad':\n case 'numeric':\n _inputMode = 'numeric';\n break;\n case 'decimal-pad':\n _inputMode = 'decimal';\n break;\n case 'phone-pad':\n type = 'tel';\n break;\n case 'search':\n case 'web-search':\n type = 'search';\n break;\n case 'url':\n type = 'url';\n break;\n default:\n type = 'text';\n }\n }\n if (secureTextEntry) {\n type = 'password';\n }\n var dimensions = React.useRef({\n height: null,\n width: null\n });\n var hostRef = React.useRef(null);\n var prevSelection = React.useRef(null);\n var prevSecureTextEntry = React.useRef(false);\n React.useEffect(() => {\n if (hostRef.current && prevSelection.current) {\n setSelection(hostRef.current, prevSelection.current);\n }\n prevSecureTextEntry.current = secureTextEntry;\n }, [secureTextEntry]);\n var handleContentSizeChange = React.useCallback(hostNode => {\n if (multiline && onContentSizeChange && hostNode != null) {\n var newHeight = hostNode.scrollHeight;\n var newWidth = hostNode.scrollWidth;\n if (newHeight !== dimensions.current.height || newWidth !== dimensions.current.width) {\n dimensions.current.height = newHeight;\n dimensions.current.width = newWidth;\n onContentSizeChange({\n nativeEvent: {\n contentSize: {\n height: dimensions.current.height,\n width: dimensions.current.width\n }\n }\n });\n }\n }\n }, [multiline, onContentSizeChange]);\n var imperativeRef = React.useMemo(() => hostNode => {\n // TextInput needs to add more methods to the hostNode in addition to those\n // added by `usePlatformMethods`. This is temporarily until an API like\n // `TextInput.clear(hostRef)` is added to React Native.\n if (hostNode != null) {\n hostNode.clear = function () {\n if (hostNode != null) {\n hostNode.value = '';\n }\n };\n hostNode.isFocused = function () {\n return hostNode != null && TextInputState.currentlyFocusedField() === hostNode;\n };\n handleContentSizeChange(hostNode);\n }\n }, [handleContentSizeChange]);\n function handleBlur(e) {\n TextInputState._currentlyFocusedNode = null;\n if (onBlur) {\n e.nativeEvent.text = e.target.value;\n onBlur(e);\n }\n }\n function handleChange(e) {\n var hostNode = e.target;\n var text = hostNode.value;\n e.nativeEvent.text = text;\n handleContentSizeChange(hostNode);\n if (onChange) {\n onChange(e);\n }\n if (onChangeText) {\n onChangeText(text);\n }\n }\n function handleFocus(e) {\n var hostNode = e.target;\n if (onFocus) {\n e.nativeEvent.text = hostNode.value;\n onFocus(e);\n }\n if (hostNode != null) {\n TextInputState._currentlyFocusedNode = hostNode;\n if (clearTextOnFocus) {\n hostNode.value = '';\n }\n if (selectTextOnFocus) {\n // Safari requires selection to occur in a setTimeout\n if (focusTimeout != null) {\n clearTimeout(focusTimeout);\n }\n focusTimeout = setTimeout(() => {\n // Check if the input is still focused after the timeout\n // (see #2704)\n if (hostNode != null && document.activeElement === hostNode) {\n hostNode.select();\n }\n }, 0);\n }\n }\n }\n function handleKeyDown(e) {\n var hostNode = e.target;\n // Prevent key events bubbling (see #612)\n e.stopPropagation();\n var blurOnSubmitDefault = !multiline;\n var shouldBlurOnSubmit = blurOnSubmit == null ? blurOnSubmitDefault : blurOnSubmit;\n var nativeEvent = e.nativeEvent;\n var isComposing = isEventComposing(nativeEvent);\n if (onKeyPress) {\n onKeyPress(e);\n }\n if (e.key === 'Enter' && !e.shiftKey &&\n // Do not call submit if composition is occuring.\n !isComposing && !e.isDefaultPrevented()) {\n if ((blurOnSubmit || !multiline) && onSubmitEditing) {\n // prevent \"Enter\" from inserting a newline or submitting a form\n e.preventDefault();\n nativeEvent.text = e.target.value;\n onSubmitEditing(e);\n }\n if (shouldBlurOnSubmit && hostNode != null) {\n setTimeout(() => hostNode.blur(), 0);\n }\n }\n }\n function handleSelectionChange(e) {\n try {\n var _e$target = e.target,\n selectionStart = _e$target.selectionStart,\n selectionEnd = _e$target.selectionEnd;\n var _selection = {\n start: selectionStart,\n end: selectionEnd\n };\n if (onSelectionChange) {\n e.nativeEvent.selection = _selection;\n e.nativeEvent.text = e.target.value;\n onSelectionChange(e);\n }\n if (prevSecureTextEntry.current === secureTextEntry) {\n prevSelection.current = _selection;\n }\n } catch (e) {}\n }\n useLayoutEffect(() => {\n var node = hostRef.current;\n if (node != null && selection != null) {\n setSelection(node, selection);\n }\n if (document.activeElement === node) {\n TextInputState._currentlyFocusedNode = node;\n }\n }, [hostRef, selection]);\n var component = multiline ? 'textarea' : 'input';\n useElementLayout(hostRef, onLayout);\n useResponderEvents(hostRef, {\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture\n });\n var _useLocaleContext = useLocaleContext(),\n contextDirection = _useLocaleContext.direction;\n var supportedProps = pickProps(props);\n supportedProps.autoCapitalize = autoCapitalize;\n supportedProps.autoComplete = autoComplete || autoCompleteType || 'on';\n supportedProps.autoCorrect = autoCorrect ? 'on' : 'off';\n // 'auto' by default allows browsers to infer writing direction\n supportedProps.dir = dir !== undefined ? dir : 'auto';\n /*\n if (returnKeyType != null) {\n warnOnce('returnKeyType', 'returnKeyType is deprecated. Use enterKeyHint.');\n }\n */\n supportedProps.enterKeyHint = enterKeyHint || returnKeyType;\n supportedProps.inputMode = _inputMode;\n supportedProps.onBlur = handleBlur;\n supportedProps.onChange = handleChange;\n supportedProps.onFocus = handleFocus;\n supportedProps.onKeyDown = handleKeyDown;\n supportedProps.onSelect = handleSelectionChange;\n /*\n if (editable != null) {\n warnOnce('editable', 'editable is deprecated. Use readOnly.');\n }\n */\n supportedProps.readOnly = readOnly === true || editable === false;\n /*\n if (numberOfLines != null) {\n warnOnce(\n 'numberOfLines',\n 'TextInput numberOfLines is deprecated. Use rows.'\n );\n }\n */\n supportedProps.rows = multiline ? rows != null ? rows : numberOfLines : 1;\n supportedProps.spellCheck = spellCheck != null ? spellCheck : autoCorrect;\n supportedProps.style = [{\n '--placeholderTextColor': placeholderTextColor\n }, styles.textinput$raw, styles.placeholder, props.style, caretHidden && styles.caretHidden];\n supportedProps.type = multiline ? undefined : type;\n supportedProps.virtualkeyboardpolicy = showSoftInputOnFocus === false ? 'manual' : 'auto';\n var platformMethodsRef = usePlatformMethods(supportedProps);\n var setRef = useMergeRefs(hostRef, platformMethodsRef, imperativeRef, forwardedRef);\n supportedProps.ref = setRef;\n var langDirection = props.lang != null ? getLocaleDirection(props.lang) : null;\n var componentDirection = props.dir || langDirection;\n var writingDirection = componentDirection || contextDirection;\n var element = createElement(component, supportedProps, {\n writingDirection\n });\n return element;\n});\nTextInput.displayName = 'TextInput';\n// $FlowFixMe\nTextInput.State = TextInputState;\nvar styles = StyleSheet.create({\n textinput$raw: {\n MozAppearance: 'textfield',\n WebkitAppearance: 'none',\n backgroundColor: 'transparent',\n border: '0 solid black',\n borderRadius: 0,\n boxSizing: 'border-box',\n font: '14px System',\n margin: 0,\n padding: 0,\n resize: 'none'\n },\n placeholder: {\n placeholderTextColor: 'var(--placeholderTextColor)'\n },\n caretHidden: {\n caretColor: 'transparent'\n }\n});\nexport default TextInput;","// extracted by mini-css-extract-plugin","import { Button, ShadowlessDialogContent } from \"@my/ui\"\nimport { analytics, trackButtonClicked } from \"app/telemetry\"\nimport { formatUtmForMixpanel } from \"app/utm/formatUtmForMixpanel\"\nimport { useUtm } from \"app/utm/useUtm\"\nimport { useEffect } from \"react\"\nimport { Dialog, ScrollView, SizableText, View, VisuallyHidden, useMedia } from \"tamagui\"\n\ninterface DisclaimerProps {\n modalVisible: boolean\n setModalVisible: (visible: boolean) => void\n}\n\nexport const DisclaimerModal: React.FC = ({ modalVisible, setModalVisible }) => {\n const { sm, tiny } = useMedia()\n const { utmParameters, isLoading: isUtmLoading } = useUtm()\n\n useEffect(() => {\n if (modalVisible && !isUtmLoading) {\n analytics.track(\"Page Viewed\", {\n page_name: \"Disclaimer\",\n ...formatUtmForMixpanel(utmParameters),\n })\n }\n }, [modalVisible, isUtmLoading])\n\n return (\n \n )\n}\n\nconst DISCLAIMER_TEXT = `This app functions as a chat bot and responses are not given by humans. It is designed to provide access to educational health resources, information, and materials for informational purposes only. Please be aware that we may review your chats and shared data for quality improvement and research and development purposes. It is not intended to provide medical or other professional clinical advice or as a substitute for such advice. Always seek the advice of a health provider with any questions you may have regarding a health condition.`\n","import { BasicBanner, Button, Icon, IconSize } from \"@my/ui\"\nimport { TextWithUnderline } from \"@my/ui/src/Underline\"\nimport { useStoredBoolean } from \"app/storage\"\nimport { trackButtonClicked } from \"app/telemetry\"\nimport { useEffect, useState } from \"react\"\nimport { XStack, SizableText, useMedia } from \"tamagui\"\nimport { DisclaimerModal } from \"./DisclaimerModal\"\n\nexport type DisclaimerProps = {\n onModalVisible?: (visible: boolean) => void\n}\n\nexport type DisclaimerBannerProps = DisclaimerProps & {\n visible: boolean\n setVisible: (visible: boolean) => void\n}\n\nexport const DisclaimerBanner: React.FC = ({\n visible,\n setVisible,\n onModalVisible,\n}) => {\n const [hasClosedDisclaimerBar, setHasClosedDisclaimerBar] = useStoredBoolean(\n \"has-closed-disclaimer-bar\",\n false,\n )\n const [modalVisible, setModalVisible] = useState(false)\n\n useEffect(() => {\n setVisible(hasClosedDisclaimerBar === false)\n }, [hasClosedDisclaimerBar])\n\n useEffect(() => {\n onModalVisible?.(modalVisible)\n }, [modalVisible])\n\n return (\n <>\n {visible && (\n <>\n setHasClosedDisclaimerBar(true)}>\n \n \n \n >\n )}\n >\n )\n}\n\nexport const DisclaimerText: React.FC = ({ onModalVisible }) => {\n const { sm } = useMedia()\n const [modalVisible, setModalVisible] = useState(false)\n\n useEffect(() => {\n onModalVisible?.(modalVisible)\n }, [modalVisible])\n\n return (\n <>\n \n \n >\n )\n}\n","import { getTokens, isVariable } from \"@tamagui/web\";\nconst defaultOptions = {\n shift: 0,\n bounds: [0]\n },\n getSize = (size, options) => getTokenRelative(\"size\", size, options),\n getSpace = (space, options) => getTokenRelative(\"space\", space, options),\n getRadius = (radius, options) => getTokenRelative(\"radius\", radius, options),\n cacheVariables = {},\n cacheWholeVariables = {},\n cacheKeys = {},\n cacheWholeKeys = {},\n stepTokenUpOrDown = (type, current, options = defaultOptions) => {\n const tokens = getTokens({\n prefixed: !0\n })[type];\n if (!(type in cacheVariables)) {\n cacheKeys[type] = [], cacheVariables[type] = [], cacheWholeKeys[type] = [], cacheWholeVariables[type] = [];\n const sorted = Object.keys(tokens).map(k => tokens[k]).sort((a, b) => a.val - b.val);\n for (const token of sorted) cacheKeys[type].push(token.key), cacheVariables[type].push(token);\n const sortedExcludingHalfSteps = sorted.filter(x => !x.key.endsWith(\".5\"));\n for (const token of sortedExcludingHalfSteps) cacheWholeKeys[type].push(token.key), cacheWholeVariables[type].push(token);\n }\n const isString = typeof current == \"string\",\n tokensOrdered = (options.excludeHalfSteps ? isString ? cacheWholeKeys : cacheWholeVariables : isString ? cacheKeys : cacheVariables)[type],\n min = options.bounds?.[0] ?? 0,\n max = options.bounds?.[1] ?? tokensOrdered.length - 1,\n currentIndex = tokensOrdered.indexOf(current);\n let shift = options.shift || 0;\n shift && (current === \"$true\" || isVariable(current) && current.name === \"true\") && (shift += shift > 0 ? 1 : -1);\n const index = Math.min(max, Math.max(min, currentIndex + shift)),\n found = tokensOrdered[index];\n return (typeof found == \"string\" ? tokens[found] : found) || tokens.$true;\n },\n getTokenRelative = stepTokenUpOrDown;\nexport { getRadius, getSize, getSpace, getTokenRelative, stepTokenUpOrDown };\n//# sourceMappingURL=index.mjs.map\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar setupHooks_exports = {};\n__export(setupHooks_exports, {\n hooks: () => hooks,\n setupHooks: () => setupHooks\n});\nmodule.exports = __toCommonJS(setupHooks_exports);\nconst hooks = {};\nfunction setupHooks(next) {\n Object.assign(hooks, next);\n}","/**\n * Return true if the draw is successful\n * @param threshold between 0 and 100\n */\nexport function performDraw(threshold) {\n return threshold !== 0 && Math.random() * 100 <= threshold;\n}\nexport function round(num, decimals) {\n return +num.toFixed(decimals);\n}\nexport function isPercentage(value) {\n return isNumber(value) && value >= 0 && value <= 100;\n}\nexport function isNumber(value) {\n return typeof value === 'number';\n}\n//# sourceMappingURL=numberUtils.js.map","\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/_app\",\n function () {\n return require(\"private-next-pages/_app.tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/_app\"])\n });\n }\n ","/**\n * Checks if `value` is in the array cache.\n *\n * @private\n * @name has\n * @memberOf SetCache\n * @param {*} value The value to search for.\n * @returns {number} Returns `true` if `value` is found, else `false`.\n */\nfunction setCacheHas(value) {\n return this.__data__.has(value);\n}\n\nmodule.exports = setCacheHas;\n","import { createStyledContext } from \"@tamagui/core\";\nconst CheckboxStyledContext = createStyledContext({\n size: \"$true\",\n scaleIcon: 1\n});\nexport { CheckboxStyledContext };\n//# sourceMappingURL=CheckboxStyledContext.mjs.map\n","import { getVariableValue, styled } from \"@tamagui/core\";\nimport { getSize } from \"@tamagui/get-token\";\nimport { ThemeableStack } from \"@tamagui/stacks\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext.mjs\";\nconst INDICATOR_NAME = \"CheckboxIndicator\",\n CheckboxIndicatorFrame = styled(ThemeableStack, {\n // use Checkbox for easier themes\n name: INDICATOR_NAME,\n context: CheckboxStyledContext,\n variants: {\n unstyled: {\n false: {}\n }\n },\n defaultVariants: {\n unstyled: process.env.TAMAGUI_HEADLESS === \"1\"\n }\n }),\n CHECKBOX_NAME = \"Checkbox\",\n CheckboxFrame = styled(ThemeableStack, {\n name: CHECKBOX_NAME,\n tag: \"button\",\n context: CheckboxStyledContext,\n variants: {\n unstyled: {\n false: {\n size: \"$true\",\n backgroundColor: \"$background\",\n alignItems: \"center\",\n justifyContent: \"center\",\n pressTheme: !0,\n focusable: !0,\n borderWidth: 1,\n borderColor: \"$borderColor\",\n hoverStyle: {\n borderColor: \"$borderColorHover\"\n },\n focusStyle: {\n borderColor: \"$borderColorFocus\"\n },\n focusVisibleStyle: {\n outlineStyle: \"solid\",\n outlineWidth: 2,\n outlineColor: \"$outlineColor\"\n }\n }\n },\n disabled: {\n true: {\n pointerEvents: \"none\",\n userSelect: \"none\",\n cursor: \"not-allowed\",\n hoverStyle: {\n borderColor: \"$borderColor\",\n backgroundColor: \"$background\"\n },\n pressStyle: {\n borderColor: \"$borderColor\",\n backgroundColor: \"$background\"\n },\n focusStyle: {\n outlineWidth: 0\n }\n }\n },\n size: {\n \"...size\": val => ({\n borderRadius: getVariableValue(getSize(val)) / 8\n })\n }\n },\n defaultVariants: {\n unstyled: process.env.TAMAGUI_HEADLESS === \"1\"\n }\n });\nexport { CheckboxFrame, CheckboxIndicatorFrame };\n//# sourceMappingURL=Checkbox.mjs.map\n","function isIndeterminate(checked) {\n return checked === \"indeterminate\";\n}\nfunction getState(checked) {\n return isIndeterminate(checked) ? \"indeterminate\" : checked ? \"checked\" : \"unchecked\";\n}\nexport { getState, isIndeterminate };\n//# sourceMappingURL=utils.mjs.map\n","import { usePrevious } from \"@tamagui/use-previous\";\nimport * as React from \"react\";\nimport { isIndeterminate } from \"./utils.mjs\";\nimport { jsx } from \"react/jsx-runtime\";\nconst BubbleInput = props => {\n const {\n checked,\n bubbles = !0,\n control,\n isHidden,\n ...inputProps\n } = props,\n ref = React.useRef(null),\n prevChecked = usePrevious(checked);\n return React.useEffect(() => {\n const input = ref.current,\n inputProto = window.HTMLInputElement.prototype,\n setChecked = Object.getOwnPropertyDescriptor(inputProto, \"checked\").set;\n if (prevChecked !== checked && setChecked) {\n const event = new Event(\"click\", {\n bubbles\n });\n input.indeterminate = isIndeterminate(checked), setChecked.call(input, isIndeterminate(checked) ? !1 : checked), input.dispatchEvent(event);\n }\n }, [prevChecked, checked, bubbles]), /* @__PURE__ */jsx(\"input\", {\n type: \"checkbox\",\n defaultChecked: isIndeterminate(checked) ? !1 : checked,\n ...inputProps,\n tabIndex: -1,\n ref,\n \"aria-hidden\": isHidden,\n style: {\n ...(isHidden ? {\n // ...controlSize,\n position: \"absolute\",\n pointerEvents: \"none\",\n opacity: 0,\n margin: 0\n } : {\n appearance: \"auto\",\n accentColor: \"var(--color6)\"\n }),\n ...props.style\n }\n });\n};\nexport { BubbleInput };\n//# sourceMappingURL=BubbleInput.mjs.map\n","import { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { composeEventHandlers } from \"@tamagui/helpers\";\nimport { useLabelContext } from \"@tamagui/label\";\nimport React, { useMemo } from \"react\";\nimport { BubbleInput } from \"./BubbleInput.mjs\";\nimport { getState, isIndeterminate } from \"./utils.mjs\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction useCheckbox(props, [checked, setChecked], ref) {\n const {\n labelledBy: ariaLabelledby,\n name,\n required,\n disabled,\n value = \"on\",\n onCheckedChange,\n ...checkboxProps\n } = props,\n [button, setButton] = React.useState(null),\n composedRefs = useComposedRefs(ref, setButton),\n hasConsumerStoppedPropagationRef = React.useRef(!1),\n isFormControl = isWeb ? button ? !!button.closest(\"form\") : !0 : !1,\n labelId = useLabelContext(button),\n labelledBy = ariaLabelledby || labelId,\n parentKeyDown = props.onKeyDown,\n handleKeyDown = useMemo(() => composeEventHandlers(parentKeyDown, event => {\n event.key === \"Enter\" && event.preventDefault();\n }), [parentKeyDown]),\n handlePress = useMemo(() => composeEventHandlers(props.onPress, event => {\n setChecked(prevChecked => isIndeterminate(prevChecked) ? !0 : !prevChecked), isFormControl && \"isPropagationStopped\" in event && (hasConsumerStoppedPropagationRef.current = event.isPropagationStopped(), hasConsumerStoppedPropagationRef.current || event.stopPropagation());\n }), [isFormControl]);\n return {\n bubbleInput: isWeb && isFormControl ? /* @__PURE__ */jsx(BubbleInput, {\n isHidden: !0,\n control: button,\n bubbles: !hasConsumerStoppedPropagationRef.current,\n name,\n value,\n checked,\n required,\n disabled\n }) : null,\n checkboxRef: composedRefs,\n checkboxProps: {\n role: \"checkbox\",\n \"aria-labelledby\": labelledBy,\n \"aria-checked\": isIndeterminate(checked) ? \"mixed\" : checked,\n ...checkboxProps,\n ...(isWeb && {\n type: \"button\",\n value,\n \"data-state\": getState(checked),\n \"data-disabled\": disabled ? \"\" : void 0,\n disabled,\n onKeyDown: disabled ? void 0 : handleKeyDown\n }),\n onPress: disabled ? void 0 : handlePress\n }\n };\n}\nexport { useCheckbox };\n//# sourceMappingURL=useCheckbox.mjs.map\n","import React, { useMemo } from \"react\";\nimport { isIndeterminate, useCheckbox } from \"@tamagui/checkbox-headless\";\nimport { getVariableValue, shouldRenderNativePlatform, useProps, useTheme, withStaticProperties } from \"@tamagui/core\";\nimport { getFontSize } from \"@tamagui/font-size\";\nimport { getSize } from \"@tamagui/get-token\";\nimport { useGetThemedIcon } from \"@tamagui/helpers-tamagui\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport { CheckboxFrame, CheckboxIndicatorFrame } from \"./Checkbox.mjs\";\nimport { CheckboxStyledContext } from \"./CheckboxStyledContext.mjs\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst CheckboxContext = React.createContext({\n checked: !1,\n disabled: !1\n }),\n ensureContext = x => {\n x.context || (x.context = CheckboxContext);\n };\nfunction createCheckbox(createProps) {\n const {\n disableActiveTheme,\n Frame = CheckboxFrame,\n Indicator = CheckboxIndicatorFrame\n } = createProps;\n ensureContext(Frame), ensureContext(Indicator);\n const FrameComponent = Frame.styleable(function (_props, forwardedRef) {\n const {\n scaleSize = 0.45,\n sizeAdjust = 0,\n scaleIcon,\n checked: checkedProp,\n defaultChecked,\n onCheckedChange,\n native,\n unstyled = !1,\n ...props\n } = _props,\n propsActive = useProps(props),\n styledContext = React.useContext(CheckboxStyledContext);\n let adjustedSize = 0,\n size = 0;\n unstyled || (adjustedSize = getVariableValue(getSize(propsActive.size ?? styledContext?.size ?? \"$true\", {\n shift: sizeAdjust\n })), size = scaleSize ? Math.round(adjustedSize * scaleSize) : adjustedSize);\n const [checked = !1, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultChecked,\n onChange: onCheckedChange\n }),\n {\n checkboxProps,\n checkboxRef,\n bubbleInput\n } = useCheckbox(\n // @ts-ignore\n propsActive, [checked, setChecked], forwardedRef);\n if (shouldRenderNativePlatform(native) === \"web\") return /* @__PURE__ */jsx(\"input\", {\n type: \"checkbox\",\n defaultChecked: isIndeterminate(checked) ? !1 : checked,\n tabIndex: -1,\n ref: checkboxRef,\n disabled: checkboxProps.disabled,\n style: {\n appearance: \"auto\",\n accentColor: \"var(--color6)\",\n ...checkboxProps.style\n // TODO: any\n }\n });\n const memoizedContext = useMemo(() => ({\n checked,\n disabled: checkboxProps.disabled\n }), [checked, checkboxProps.disabled]);\n return /* @__PURE__ */jsx(CheckboxContext.Provider, {\n value: memoizedContext,\n children: /* @__PURE__ */jsxs(CheckboxStyledContext.Provider, {\n size: propsActive.size ?? styledContext?.size ?? \"$true\",\n scaleIcon: scaleIcon ?? styledContext?.scaleIcon ?? 1,\n children: [/* @__PURE__ */jsx(Frame, {\n ...(!unstyled && {\n width: size,\n height: size\n }),\n tag: \"button\",\n ref: checkboxRef,\n unstyled,\n ...(unstyled === !1 && {\n size,\n theme: checked ? \"active\" : null\n }),\n checked,\n disabled: checkboxProps.disabled,\n ...checkboxProps,\n style: checkboxProps.style,\n children: propsActive.children\n }), bubbleInput]\n })\n });\n }),\n IndicatorComponent = Indicator.styleable((props, forwardedRef) => {\n const {\n // __scopeCheckbox,\n children: childrenProp,\n forceMount,\n disablePassStyles,\n unstyled = !1,\n ...indicatorProps\n } = props,\n styledContext = React.useContext(CheckboxStyledContext);\n let children = childrenProp;\n if (!unstyled) {\n const iconSize = (typeof styledContext.size == \"number\" ? styledContext.size * 0.65 : getFontSize(styledContext.size)) * styledContext.scaleIcon,\n theme = useTheme(),\n getThemedIcon = useGetThemedIcon({\n size: iconSize,\n color: theme.color\n });\n children = React.Children.toArray(childrenProp).map(child => disablePassStyles || !React.isValidElement(child) ? child : getThemedIcon(child));\n }\n const context = React.useContext(CheckboxContext);\n return forceMount || isIndeterminate(context.checked) || context.checked === !0 ? /* @__PURE__ */jsx(Indicator, {\n pointerEvents: \"none\",\n ...indicatorProps,\n ref: forwardedRef,\n children\n }) : null;\n });\n return withStaticProperties(FrameComponent, {\n Indicator: IndicatorComponent\n });\n}\nexport { CheckboxContext, createCheckbox };\n//# sourceMappingURL=createCheckbox.mjs.map\n","import { CheckboxFrame, CheckboxIndicatorFrame } from \"./Checkbox.mjs\";\nimport { createCheckbox } from \"./createCheckbox.mjs\";\nexport * from \"./createCheckbox.mjs\";\nexport * from \"./Checkbox.mjs\";\nexport * from \"./CheckboxStyledContext.mjs\";\nconst Checkbox = createCheckbox({\n Frame: CheckboxFrame,\n Indicator: CheckboxIndicatorFrame\n});\nexport { Checkbox };\n//# sourceMappingURL=index.mjs.map\n","import { ImageSourcePropType } from \"react-native\"\nimport { Asset } from \"./assets\"\n\nexport function loadImageAsset(asset: Asset): ImageSourcePropType {\n return asset.default.src as ImageSourcePropType\n}\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar setupReactNative_exports = {};\n__export(setupReactNative_exports, {\n getReactNativeConfig: () => getReactNativeConfig,\n setupReactNative: () => setupReactNative\n});\nmodule.exports = __toCommonJS(setupReactNative_exports);\nconst ReactNativeStaticConfigs = /* @__PURE__ */new WeakMap();\nfunction getReactNativeConfig(Component) {\n if (Component) return Component.getSize && Component.prefetch ? RNConfigs.Image : Component.displayName === \"Text\" && Component.render ? RNConfigs.Text : Component.render && (Component.displayName === \"ScrollView\" || Component.displayName === \"View\") ? RNConfigs.default : Component.State?.blurTextInput ? RNConfigs.TextInput : ReactNativeStaticConfigs.get(Component);\n}\nconst RNConfigs = {\n Image: {\n isReactNative: !0,\n inlineProps: /* @__PURE__ */new Set([\"src\", \"width\", \"height\"])\n },\n Text: {\n isReactNative: !0,\n isText: !0\n },\n TextInput: {\n isReactNative: !0,\n isInput: !0,\n isText: !0\n },\n default: {\n isReactNative: !0\n }\n};\nfunction setupReactNative(rnExports) {}","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n },\n __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar index_exports = {};\n__export(index_exports, {\n Stack: () => Stack,\n Text: () => Text,\n View: () => View,\n createTamagui: () => createTamagui\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_react_native_media_driver = require(\"@tamagui/react-native-media-driver\"),\n import_react_native_use_responder_events = require(\"@tamagui/react-native-use-responder-events\"),\n import_web = require(\"@tamagui/web\"),\n import_react = require(\"react\"),\n import_createOptimizedView = require(\"./createOptimizedView.cjs\"),\n import_getBaseViews = require(\"./getBaseViews.cjs\"),\n import_getRect = require(\"./helpers/getRect.cjs\"),\n import_useElementLayout = require(\"./hooks/useElementLayout.cjs\"),\n import_Pressability = require(\"./vendor/Pressability.cjs\"),\n import_addNativeValidStyles = require(\"./addNativeValidStyles.cjs\");\n__reExport(index_exports, require(\"@tamagui/web\"), module.exports);\n__reExport(index_exports, require(\"./reactNativeTypes.cjs\"), module.exports);\n(0, import_addNativeValidStyles.addNativeValidStyles)();\nconst createTamagui = conf => (0, import_web.createTamagui)(conf),\n baseViews = (0, import_getBaseViews.getBaseViews)();\n(0, import_web.setupHooks)({\n getBaseViews: import_getBaseViews.getBaseViews,\n setElementProps: node => {\n node && !node.measure && (node.measure ||= callback => (0, import_useElementLayout.measureLayout)(node, null, callback), node.measureLayout ||= (relativeToNode, success) => (0, import_useElementLayout.measureLayout)(node, relativeToNode, success), node.measureInWindow ||= callback => {\n setTimeout(() => {\n const {\n height,\n left,\n top,\n width\n } = (0, import_getRect.getRect)(node);\n callback(left, top, width, height);\n }, 0);\n });\n },\n usePropsTransform(elementType, propsIn, stateRef, willHydrate) {\n {\n const isDOM = typeof elementType == \"string\",\n {\n // remove event props handles by useResponderEvents\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n // android\n collapsable,\n focusable,\n // deprecated,\n accessible,\n accessibilityDisabled,\n onLayout,\n hrefAttrs,\n ...plainDOMProps\n } = propsIn;\n if ((willHydrate || isDOM) && ((0, import_useElementLayout.useElementLayout)(stateRef, isDOM ? onLayout : void 0), (0, import_react_native_use_responder_events.useResponderEvents)(stateRef, isDOM ? propsIn : void 0)), isDOM) {\n if (plainDOMProps.href && hrefAttrs) {\n const {\n download,\n rel,\n target\n } = hrefAttrs;\n download != null && (plainDOMProps.download = download), rel && (plainDOMProps.rel = rel), typeof target == \"string\" && (plainDOMProps.target = target.charAt(0) !== \"_\" ? `_${target}` : target);\n }\n return plainDOMProps;\n }\n }\n },\n useEvents(viewProps, events, {\n pseudos\n }, setStateShallow, staticConfig) {}\n});\nconst View = import_web.View,\n Stack = import_web.Stack,\n Text = import_web.Text;","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar normalizeValueWithProperty_exports = {};\n__export(normalizeValueWithProperty_exports, {\n normalizeValueWithProperty: () => normalizeValueWithProperty\n});\nmodule.exports = __toCommonJS(normalizeValueWithProperty_exports);\nvar import_constants = require(\"@tamagui/constants\"),\n import_helpers = require(\"@tamagui/helpers\");\nconst stylePropsAllPlusTransforms = {\n ...import_helpers.stylePropsAll,\n translateX: !0,\n translateY: !0\n};\nfunction normalizeValueWithProperty(value, property = \"\") {\n if (!import_constants.isWeb || import_helpers.stylePropsUnitless[property] || property && !stylePropsAllPlusTransforms[property] || typeof value == \"boolean\") return value;\n let res = value;\n return value && typeof value == \"object\" ? value : (typeof value == \"number\" ? res = `${value}px` : property && (res = `${res}`), res);\n}","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all) __defProp(target, name, {\n get: all[name],\n enumerable: !0\n });\n },\n __copyProps = (to, from, except, desc) => {\n if (from && typeof from == \"object\" || typeof from == \"function\") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {\n get: () => from[key],\n enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n });\n return to;\n };\nvar __toCommonJS = mod => __copyProps(__defProp({}, \"__esModule\", {\n value: !0\n}), mod);\nvar getExpandedShorthands_exports = {};\n__export(getExpandedShorthands_exports, {\n getExpandedShorthands: () => getExpandedShorthands\n});\nmodule.exports = __toCommonJS(getExpandedShorthands_exports);\nvar import_config = require(\"../config.cjs\");\nfunction getExpandedShorthands(props) {\n const shorthands = (0, import_config.getConfig)().shorthands;\n if (!shorthands) return props;\n const res = {};\n for (const key in props) res[shorthands[key] || key] = props[key];\n return res;\n}","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","// src/AuthContext.ts\nimport React from \"react\";\nvar AuthContext = React.createContext(void 0);\nAuthContext.displayName = \"AuthContext\";\n\n// src/AuthProvider.tsx\nimport React2 from \"react\";\nimport { UserManager } from \"oidc-client-ts\";\n\n// src/AuthState.ts\nvar initialAuthState = {\n isLoading: true,\n isAuthenticated: false\n};\n\n// src/reducer.ts\nvar reducer = (state, action) => {\n switch (action.type) {\n case \"INITIALISED\":\n case \"USER_LOADED\":\n return {\n ...state,\n user: action.user,\n isLoading: false,\n isAuthenticated: action.user ? !action.user.expired : false,\n error: void 0\n };\n case \"USER_SIGNED_OUT\":\n case \"USER_UNLOADED\":\n return {\n ...state,\n user: void 0,\n isAuthenticated: false\n };\n case \"NAVIGATOR_INIT\":\n return {\n ...state,\n isLoading: true,\n activeNavigator: action.method\n };\n case \"NAVIGATOR_CLOSE\":\n return {\n ...state,\n isLoading: false,\n activeNavigator: void 0\n };\n case \"ERROR\":\n return {\n ...state,\n isLoading: false,\n error: action.error\n };\n default:\n return {\n ...state,\n isLoading: false,\n error: new Error(`unknown type ${action[\"type\"]}`)\n };\n }\n};\n\n// src/utils.ts\nvar hasAuthParams = (location = window.location) => {\n let searchParams = new URLSearchParams(location.search);\n if ((searchParams.get(\"code\") || searchParams.get(\"error\")) && searchParams.get(\"state\")) {\n return true;\n }\n searchParams = new URLSearchParams(location.hash.replace(\"#\", \"?\"));\n if ((searchParams.get(\"code\") || searchParams.get(\"error\")) && searchParams.get(\"state\")) {\n return true;\n }\n return false;\n};\nvar normalizeErrorFn = (fallbackMessage) => (error) => {\n if (error instanceof Error) {\n return error;\n }\n return new Error(fallbackMessage);\n};\nvar signinError = normalizeErrorFn(\"Sign-in failed\");\nvar signoutError = normalizeErrorFn(\"Sign-out failed\");\n\n// src/AuthProvider.tsx\nvar userManagerContextKeys = [\n \"clearStaleState\",\n \"querySessionStatus\",\n \"revokeTokens\",\n \"startSilentRenew\",\n \"stopSilentRenew\"\n];\nvar navigatorKeys = [\n \"signinPopup\",\n \"signinSilent\",\n \"signinRedirect\",\n \"signinResourceOwnerCredentials\",\n \"signoutPopup\",\n \"signoutRedirect\",\n \"signoutSilent\"\n];\nvar unsupportedEnvironment = (fnName) => () => {\n throw new Error(\n `UserManager#${fnName} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`\n );\n};\nvar UserManagerImpl = typeof window === \"undefined\" ? null : UserManager;\nvar AuthProvider = (props) => {\n const {\n children,\n onSigninCallback,\n skipSigninCallback,\n matchSignoutCallback,\n onSignoutCallback,\n onRemoveUser,\n userManager: userManagerProp = null,\n ...userManagerSettings\n } = props;\n const [userManager] = React2.useState(() => {\n return userManagerProp != null ? userManagerProp : UserManagerImpl ? new UserManagerImpl(userManagerSettings) : { settings: userManagerSettings };\n });\n const [state, dispatch] = React2.useReducer(reducer, initialAuthState);\n const userManagerContext = React2.useMemo(\n () => Object.assign(\n {\n settings: userManager.settings,\n events: userManager.events\n },\n Object.fromEntries(\n userManagerContextKeys.map((key) => {\n var _a, _b;\n return [\n key,\n (_b = (_a = userManager[key]) == null ? void 0 : _a.bind(userManager)) != null ? _b : unsupportedEnvironment(key)\n ];\n })\n ),\n Object.fromEntries(\n navigatorKeys.map((key) => [\n key,\n userManager[key] ? async (args) => {\n dispatch({\n type: \"NAVIGATOR_INIT\",\n method: key\n });\n try {\n return await userManager[key](args);\n } catch (error) {\n dispatch({ type: \"ERROR\", error });\n return null;\n } finally {\n dispatch({ type: \"NAVIGATOR_CLOSE\" });\n }\n } : unsupportedEnvironment(key)\n ])\n )\n ),\n [userManager]\n );\n const didInitialize = React2.useRef(false);\n React2.useEffect(() => {\n if (!userManager || didInitialize.current) {\n return;\n }\n didInitialize.current = true;\n void (async () => {\n try {\n let user = null;\n if (hasAuthParams() && !skipSigninCallback) {\n user = await userManager.signinCallback();\n onSigninCallback && await onSigninCallback(user);\n }\n user = !user ? await userManager.getUser() : user;\n dispatch({ type: \"INITIALISED\", user });\n } catch (error) {\n dispatch({ type: \"ERROR\", error: signinError(error) });\n }\n try {\n if (matchSignoutCallback && matchSignoutCallback(userManager.settings)) {\n const resp = await userManager.signoutCallback();\n onSignoutCallback && await onSignoutCallback(resp);\n }\n } catch (error) {\n dispatch({ type: \"ERROR\", error: signoutError(error) });\n }\n })();\n }, [userManager, skipSigninCallback, onSigninCallback, onSignoutCallback, matchSignoutCallback]);\n React2.useEffect(() => {\n if (!userManager) return void 0;\n const handleUserLoaded = (user) => {\n dispatch({ type: \"USER_LOADED\", user });\n };\n userManager.events.addUserLoaded(handleUserLoaded);\n const handleUserUnloaded = () => {\n dispatch({ type: \"USER_UNLOADED\" });\n };\n userManager.events.addUserUnloaded(handleUserUnloaded);\n const handleUserSignedOut = () => {\n dispatch({ type: \"USER_SIGNED_OUT\" });\n };\n userManager.events.addUserSignedOut(handleUserSignedOut);\n const handleSilentRenewError = (error) => {\n dispatch({ type: \"ERROR\", error });\n };\n userManager.events.addSilentRenewError(handleSilentRenewError);\n return () => {\n userManager.events.removeUserLoaded(handleUserLoaded);\n userManager.events.removeUserUnloaded(handleUserUnloaded);\n userManager.events.removeUserSignedOut(handleUserSignedOut);\n userManager.events.removeSilentRenewError(handleSilentRenewError);\n };\n }, [userManager]);\n const removeUser = React2.useCallback(async () => {\n if (!userManager) unsupportedEnvironment(\"removeUser\");\n await userManager.removeUser();\n onRemoveUser && await onRemoveUser();\n }, [userManager, onRemoveUser]);\n const contextValue = React2.useMemo(() => {\n return {\n ...state,\n ...userManagerContext,\n removeUser\n };\n }, [state, userManagerContext, removeUser]);\n return /* @__PURE__ */ React2.createElement(AuthContext.Provider, { value: contextValue }, children);\n};\n\n// src/useAuth.ts\nimport React3 from \"react\";\nvar useAuth = () => {\n const context = React3.useContext(AuthContext);\n if (!context) {\n console.warn(\"AuthProvider context is undefined, please verify you are calling useAuth() as child of a component.\");\n }\n return context;\n};\n\n// src/withAuth.tsx\nimport React4 from \"react\";\nfunction withAuth(Component) {\n const displayName = `withAuth(${Component.displayName || Component.name})`;\n const C = (props) => {\n const auth = useAuth();\n return /* @__PURE__ */ React4.createElement(Component, { ...props, auth });\n };\n C.displayName = displayName;\n return C;\n}\n\n// src/withAuthenticationRequired.tsx\nimport React5 from \"react\";\nvar withAuthenticationRequired = (Component, options = {}) => {\n const { OnRedirecting = () => /* @__PURE__ */ React5.createElement(React5.Fragment, null), onBeforeSignin, signinRedirectArgs } = options;\n const displayName = `withAuthenticationRequired(${Component.displayName || Component.name})`;\n const C = (props) => {\n const auth = useAuth();\n React5.useEffect(() => {\n if (hasAuthParams() || auth.isLoading || auth.activeNavigator || auth.isAuthenticated) {\n return;\n }\n void (async () => {\n onBeforeSignin && await onBeforeSignin();\n await auth.signinRedirect(signinRedirectArgs);\n })();\n }, [auth.isLoading, auth.isAuthenticated, auth]);\n return auth.isAuthenticated ? /* @__PURE__ */ React5.createElement(Component, { ...props }) : OnRedirecting();\n };\n C.displayName = displayName;\n return C;\n};\nexport {\n AuthContext,\n AuthProvider,\n hasAuthParams,\n useAuth,\n withAuth,\n withAuthenticationRequired\n};\n//# sourceMappingURL=react-oidc-context.js.map\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","import { setTimeout } from './timer';\nimport { callMonitored } from './monitor';\nimport { noop } from './utils/functionUtils';\nimport { createHandlingStack } from './stackTrace/handlingStack';\n/**\n * Instruments a method on a object, calling the given callback before the original method is\n * invoked. The callback receives an object with information about the method call.\n *\n * This function makes sure that we are \"good citizens\" regarding third party instrumentations: when\n * removing the instrumentation, the original method is usually restored, but if a third party\n * instrumentation was set after ours, we keep it in place and just replace our instrumentation with\n * a noop.\n *\n * Note: it is generally better to instrument methods that are \"owned\" by the object instead of ones\n * that are inherited from the prototype chain. Example:\n * * do: `instrumentMethod(Array.prototype, 'push', ...)`\n * * don't: `instrumentMethod([], 'push', ...)`\n *\n * This method is also used to set event handler properties (ex: window.onerror = ...), as it has\n * the same requirements as instrumenting a method:\n * * if the event handler is already set by a third party, we need to call it and not just blindly\n * override it.\n * * if the event handler is set by a third party after us, we need to keep it in place when\n * removing ours.\n *\n * @example\n *\n * instrumentMethod(window, 'fetch', ({ target, parameters, onPostCall }) => {\n * console.log('Before calling fetch on', target, 'with parameters', parameters)\n *\n * onPostCall((result) => {\n * console.log('After fetch calling on', target, 'with parameters', parameters, 'and result', result)\n * })\n * })\n */\nexport function instrumentMethod(targetPrototype, method, onPreCall, { computeHandlingStack } = {}) {\n let original = targetPrototype[method];\n if (typeof original !== 'function') {\n if (method in targetPrototype && method.startsWith('on')) {\n original = noop;\n }\n else {\n return { stop: noop };\n }\n }\n let stopped = false;\n const instrumentation = function () {\n if (stopped) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n return original.apply(this, arguments);\n }\n const parameters = Array.from(arguments);\n let postCallCallback;\n callMonitored(onPreCall, null, [\n {\n target: this,\n parameters,\n onPostCall: (callback) => {\n postCallCallback = callback;\n },\n handlingStack: computeHandlingStack ? createHandlingStack('instrumented method') : undefined,\n },\n ]);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n const result = original.apply(this, parameters);\n if (postCallCallback) {\n callMonitored(postCallCallback, null, [result]);\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return result;\n };\n targetPrototype[method] = instrumentation;\n return {\n stop: () => {\n stopped = true;\n // If the instrumentation has been removed by a third party, keep the last one\n if (targetPrototype[method] === instrumentation) {\n targetPrototype[method] = original;\n }\n },\n };\n}\nexport function instrumentSetter(targetPrototype, property, after) {\n const originalDescriptor = Object.getOwnPropertyDescriptor(targetPrototype, property);\n if (!originalDescriptor || !originalDescriptor.set || !originalDescriptor.configurable) {\n return { stop: noop };\n }\n const stoppedInstrumentation = noop;\n let instrumentation = (target, value) => {\n // put hooked setter into event loop to avoid of set latency\n setTimeout(() => {\n if (instrumentation !== stoppedInstrumentation) {\n after(target, value);\n }\n }, 0);\n };\n const instrumentationWrapper = function (value) {\n originalDescriptor.set.call(this, value);\n instrumentation(this, value);\n };\n Object.defineProperty(targetPrototype, property, {\n set: instrumentationWrapper,\n });\n return {\n stop: () => {\n var _a;\n if (((_a = Object.getOwnPropertyDescriptor(targetPrototype, property)) === null || _a === void 0 ? void 0 : _a.set) === instrumentationWrapper) {\n Object.defineProperty(targetPrototype, property, originalDescriptor);\n }\n instrumentation = stoppedInstrumentation;\n },\n };\n}\n//# sourceMappingURL=instrumentMethod.js.map","import { RedirectStatusCode } from './redirect-status-code'\nimport {\n RedirectType,\n type RedirectError,\n isRedirectError,\n REDIRECT_ERROR_CODE,\n} from './redirect-error'\n\nconst actionAsyncStorage =\n typeof window === 'undefined'\n ? (\n require('../../server/app-render/action-async-storage.external') as typeof import('../../server/app-render/action-async-storage.external')\n ).actionAsyncStorage\n : undefined\n\nexport function getRedirectError(\n url: string,\n type: RedirectType,\n statusCode: RedirectStatusCode = RedirectStatusCode.TemporaryRedirect\n): RedirectError {\n const error = new Error(REDIRECT_ERROR_CODE) as RedirectError\n error.digest = `${REDIRECT_ERROR_CODE};${type};${url};${statusCode};`\n return error\n}\n\n/**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 307/303 to the caller.\n * - In a Server Action, type defaults to 'push' and 'replace' elsewhere.\n *\n * Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\nexport function redirect(\n /** The URL to redirect to */\n url: string,\n type?: RedirectType\n): never {\n type ??= actionAsyncStorage?.getStore()?.isAction\n ? RedirectType.push\n : RedirectType.replace\n\n throw getRedirectError(url, type, RedirectStatusCode.TemporaryRedirect)\n}\n\n/**\n * This function allows you to redirect the user to another URL. It can be used in\n * [Server Components](https://nextjs.org/docs/app/building-your-application/rendering/server-components),\n * [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/route-handlers), and\n * [Server Actions](https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations).\n *\n * - In a Server Component, this will insert a meta tag to redirect the user to the target page.\n * - In a Route Handler or Server Action, it will serve a 308/303 to the caller.\n *\n * Read more: [Next.js Docs: `redirect`](https://nextjs.org/docs/app/api-reference/functions/redirect)\n */\nexport function permanentRedirect(\n /** The URL to redirect to */\n url: string,\n type: RedirectType = RedirectType.replace\n): never {\n throw getRedirectError(url, type, RedirectStatusCode.PermanentRedirect)\n}\n\n/**\n * Returns the encoded URL from the error if it's a RedirectError, null\n * otherwise. Note that this does not validate the URL returned.\n *\n * @param error the error that may be a redirect error\n * @return the url if the error was a redirect error\n */\nexport function getURLFromRedirectError(error: RedirectError): string\nexport function getURLFromRedirectError(error: unknown): string | null {\n if (!isRedirectError(error)) return null\n\n // Slices off the beginning of the digest that contains the code and the\n // separating ';'.\n return error.digest.split(';').slice(2, -2).join(';')\n}\n\nexport function getRedirectTypeFromError(error: RedirectError): RedirectType {\n if (!isRedirectError(error)) {\n throw new Error('Not a redirect error')\n }\n\n return error.digest.split(';', 2)[1] as RedirectType\n}\n\nexport function getRedirectStatusCodeFromError(error: RedirectError): number {\n if (!isRedirectError(error)) {\n throw new Error('Not a redirect error')\n }\n\n return Number(error.digest.split(';').at(-2))\n}\n","function e(e){function t(e,t){Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.message=e,this.code=t}return t.prototype=new Error,t.prototype.name=e,t.prototype.constructor=t,t}const t=e(\"LaunchDarklyUnexpectedResponseError\"),n=e(\"LaunchDarklyInvalidEnvironmentIdError\"),r=e(\"LaunchDarklyInvalidUserError\"),o=e(\"LaunchDarklyInvalidEventKeyError\"),i=e(\"LaunchDarklyInvalidArgumentError\"),a=e(\"LaunchDarklyFlagFetchError\");for(var s={LDUnexpectedResponseError:t,LDInvalidEnvironmentIdError:n,LDInvalidUserError:r,LDInvalidEventKeyError:o,LDInvalidArgumentError:i,LDInvalidDataError:e(\"LaunchDarklyInvalidDataError\"),LDFlagFetchError:a,LDTimeoutError:e(\"LaunchDarklyTimeoutError\"),isHttpErrorRecoverable:function(e){return!(e>=400&&e<500)||(400===e||408===e||429===e)}},c=function(e){var t=m(e),n=t[0],r=t[1];return 3*(n+r)/4-r},u=function(e){var t,n,r=m(e),o=r[0],i=r[1],a=new g(function(e,t,n){return 3*(t+n)/4-n}(0,o,i)),s=0,c=i>0?o-4:o;for(n=0;n>16&255,a[s++]=t>>8&255,a[s++]=255&t;2===i&&(t=f[e.charCodeAt(n)]<<2|f[e.charCodeAt(n+1)]>>4,a[s++]=255&t);1===i&&(t=f[e.charCodeAt(n)]<<10|f[e.charCodeAt(n+1)]<<4|f[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t);return a},l=function(e){for(var t,n=e.length,r=n%3,o=[],i=16383,a=0,s=n-r;as?s:a+i));1===r?(t=e[n-1],o.push(d[t>>2]+d[t<<4&63]+\"==\")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(d[t>>10]+d[t>>4&63]+d[t<<2&63]+\"=\"));return o.join(\"\")},d=[],f=[],g=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,v=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",p=0;p<64;++p)d[p]=v[p],f[v.charCodeAt(p)]=p;function m(e){var t=e.length;if(t%4>0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var n=e.indexOf(\"=\");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function h(e,t,n){for(var r,o,i=[],a=t;a>18&63]+d[o>>12&63]+d[o>>6&63]+d[63&o]);return i.join(\"\")}f[\"-\".charCodeAt(0)]=62,f[\"_\".charCodeAt(0)]=63;var y={byteLength:c,toByteArray:u,fromByteArray:l},w=Array.isArray,b=Object.keys,k=Object.prototype.hasOwnProperty,E=function e(t,n){if(t===n)return!0;if(t&&n&&\"object\"==typeof t&&\"object\"==typeof n){var r,o,i,a=w(t),s=w(n);if(a&&s){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=s)return!1;var c=t instanceof Date,u=n instanceof Date;if(c!=u)return!1;if(c&&u)return t.getTime()==n.getTime();var l=t instanceof RegExp,d=n instanceof RegExp;if(l!=d)return!1;if(l&&d)return t.toString()==n.toString();var f=b(t);if((o=f.length)!==b(n).length)return!1;for(r=o;0!=r--;)if(!k.call(n,f[r]))return!1;for(r=o;0!=r--;)if(!e(t[i=f[r]],n[i]))return!1;return!0}return t!=t&&n!=n};const D=[\"key\",\"ip\",\"country\",\"email\",\"firstName\",\"lastName\",\"avatar\",\"name\"];function x(e){const t=unescape(encodeURIComponent(e));return y.fromByteArray(function(e){const t=[];for(let n=0;n({...e,...t})),{})},getLDUserAgentString:function(e){const t=e.version||\"?\";return e.userAgent+\"/\"+t},objectHasOwnProperty:C,onNextTick:function(e){setTimeout(e,0)},sanitizeContext:function(e){if(!e)return e;let t;return null!==e.kind&&void 0!==e.kind||D.forEach((n=>{const r=e[n];void 0!==r&&\"string\"!=typeof r&&(t=t||{...e},t[n]=String(r))})),t||e},transformValuesToVersionedValues:function(e){const t={};for(const n in e)C(e,n)&&(t[n]={value:e[n],version:0});return t},transformVersionedValuesToValues:function(e){const t={};for(const n in e)C(e,n)&&(t[n]=e[n].value);return t},wrapPromiseCallback:function(e,t){const n=e.then((e=>(t&&setTimeout((()=>{t(null,e)}),0),e)),(e=>{if(!t)return Promise.reject(e);setTimeout((()=>{t(e,null)}),0)}));return t?void 0:n}},I=new Uint8Array(16);function O(){if(!P&&!(P=\"undefined\"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||\"undefined\"!=typeof msCrypto&&\"function\"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error(\"crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported\");return P(I)}var T=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function L(e){return\"string\"==typeof e&&T.test(e)}for(var U,R,A=[],j=0;j<256;++j)A.push((j+256).toString(16).substr(1));function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(A[e[t+0]]+A[e[t+1]]+A[e[t+2]]+A[e[t+3]]+\"-\"+A[e[t+4]]+A[e[t+5]]+\"-\"+A[e[t+6]]+A[e[t+7]]+\"-\"+A[e[t+8]]+A[e[t+9]]+\"-\"+A[e[t+10]]+A[e[t+11]]+A[e[t+12]]+A[e[t+13]]+A[e[t+14]]+A[e[t+15]]).toLowerCase();if(!L(n))throw TypeError(\"Stringified UUID is invalid\");return n}var N=0,$=0;function V(e){if(!L(e))throw TypeError(\"Invalid UUID\");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function M(e,t,n){function r(e,r,o,i){if(\"string\"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n>>9<<4)+1}function H(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function z(e,t,n,r,o,i){return H((a=H(H(t,e),H(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function K(e,t,n,r,o,i,a){return z(t&n|~t&r,e,t,o,i,a)}function _(e,t,n,r,o,i,a){return z(t&r|n&~r,e,t,o,i,a)}function J(e,t,n,r,o,i,a){return z(t^n^r,e,t,o,i,a)}function B(e,t,n,r,o,i,a){return z(n^(t|~r),e,t,o,i,a)}var G=M(\"v3\",48,(function(e){if(\"string\"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n>5]>>>o%32&255,a=parseInt(r.charAt(i>>>4&15)+r.charAt(15&i),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<>>32-t}var Y=M(\"v5\",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(\"string\"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var o=0;o>>0;w=y,y=h,h=Q(m,30)>>>0,m=p,p=E}n[0]=n[0]+p>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+h>>>0,n[3]=n[3]+y>>>0,n[4]=n[4]+w>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),Z=Y;var ee=Object.freeze({__proto__:null,v1:function(e,t,n){var r=t&&n||0,o=t||new Array(16),i=(e=e||{}).node||U,a=void 0!==e.clockseq?e.clockseq:R;if(null==i||null==a){var s=e.random||(e.rng||O)();null==i&&(i=U=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=R=16383&(s[6]<<8|s[7]))}var c=void 0!==e.msecs?e.msecs:Date.now(),u=void 0!==e.nsecs?e.nsecs:$+1,l=c-N+(u-$)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||c>N)&&void 0===e.nsecs&&(u=0),u>=1e4)throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");N=c,$=u,R=a;var d=(1e4*(268435455&(c+=122192928e5))+u)%4294967296;o[r++]=d>>>24&255,o[r++]=d>>>16&255,o[r++]=d>>>8&255,o[r++]=255&d;var f=c/4294967296*1e4&268435455;o[r++]=f>>>8&255,o[r++]=255&f,o[r++]=f>>>24&15|16,o[r++]=f>>>16&255,o[r++]=a>>>8|128,o[r++]=255&a;for(var g=0;g<6;++g)o[r+g]=i[g];return t||F(o)},v3:W,v4:function(e,t,n){var r=(e=e||{}).random||(e.rng||O)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return F(r)},v5:Z,NIL:\"00000000-0000-0000-0000-000000000000\",version:function(e){if(!L(e))throw TypeError(\"Invalid UUID\");return parseInt(e.substr(14,1),16)},validate:L,stringify:F,parse:V});const te=[\"debug\",\"info\",\"warn\",\"error\",\"none\"];var ne={commonBasicLogger:function(e,t){if(e&&e.destination&&\"function\"!=typeof e.destination)throw new Error(\"destination for basicLogger was set to a non-function\");function n(e){return function(t){console&&console[e]&&console[e].call(console,t)}}const r=e&&e.destination?[e.destination,e.destination,e.destination,e.destination]:[n(\"log\"),n(\"info\"),n(\"warn\"),n(\"error\")],o=!(!e||!e.destination),i=e&&void 0!==e.prefix&&null!==e.prefix?e.prefix:\"[LaunchDarkly] \";let a=1;if(e&&e.level)for(let t=0;t{};else{const n=e;c[t]=function(){s(n,t,arguments)}}}return c},validateLogger:function(e){te.forEach((t=>{if(\"none\"!==t&&(!e[t]||\"function\"!=typeof e[t]))throw new Error(\"Provided logger instance must support logger.\"+t+\"(...) method\")}))}};function re(e){return e&&e.message?e.message:\"string\"==typeof e||e instanceof String?e:JSON.stringify(e)}const oe=\" Please see https://docs.launchdarkly.com/sdk/client-side/javascript#initialize-the-client for instructions on SDK initialization.\";var ie={bootstrapInvalid:function(){return\"LaunchDarkly bootstrap data is not available because the back end could not read the flags.\"},bootstrapOldFormat:function(){return\"LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly.\"+oe},clientInitialized:function(){return\"LaunchDarkly client initialized\"},clientNotReady:function(){return\"LaunchDarkly client is not ready\"},debugEnqueueingEvent:function(e){return'enqueueing \"'+e+'\" event'},debugPostingDiagnosticEvent:function(e){return\"sending diagnostic event (\"+e.kind+\")\"},debugPostingEvents:function(e){return\"sending \"+e+\" events\"},debugStreamDelete:function(e){return'received streaming deletion for flag \"'+e+'\"'},debugStreamDeleteIgnored:function(e){return'received streaming deletion for flag \"'+e+'\" but ignored due to version check'},debugStreamPatch:function(e){return'received streaming update for flag \"'+e+'\"'},debugStreamPatchIgnored:function(e){return'received streaming update for flag \"'+e+'\" but ignored due to version check'},debugStreamPing:function(){return\"received ping message from stream\"},debugPolling:function(e){return\"polling for feature flags at \"+e},debugStreamPut:function(){return\"received streaming update for all flags\"},deprecated:function(e,t){return t?'\"'+e+'\" is deprecated, please use \"'+t+'\"':'\"'+e+'\" is deprecated'},environmentNotFound:function(){return\"Environment not found. Double check that you specified a valid environment/client-side ID.\"+oe},environmentNotSpecified:function(){return\"No environment/client-side ID was specified.\"+oe},errorFetchingFlags:function(e){return\"Error fetching flag settings: \"+re(e)},eventCapacityExceeded:function(){return\"Exceeded event queue capacity. Increase capacity to avoid dropping events.\"},eventWithoutContext:function(){return\"Be sure to call `identify` in the LaunchDarkly client: https://docs.launchdarkly.com/sdk/features/identify#javascript\"},httpErrorMessage:function(e,t,n){return\"Received error \"+e+(401===e?\" (invalid SDK key)\":\"\")+\" for \"+t+\" - \"+(s.isHttpErrorRecoverable(e)?n:\"giving up permanently\")},httpUnavailable:function(){return\"Cannot make HTTP requests in this environment.\"+oe},identifyDisabled:function(){return\"identify() has no effect here; it must be called on the main client instance\"},inspectorMethodError:(e,t)=>`an inspector: \"${t}\" of type: \"${e}\" generated an exception`,invalidContentType:function(e){return'Expected application/json content type but got \"'+e+'\"'},invalidData:function(){return\"Invalid data received from LaunchDarkly; connection may have been interrupted\"},invalidInspector:(e,t)=>`an inspector: \"${t}\" of an invalid type (${e}) was configured`,invalidKey:function(){return\"Event key must be a string\"},invalidMetricValue:e=>`The track function was called with a non-numeric \"metricValue\" (${e}), only numeric metric values are supported.`,invalidContext:function(){return\"Invalid context specified.\"+oe},invalidTagValue:e=>`Config option \"${e}\" must only contain letters, numbers, ., _ or -.`,localStorageUnavailable:function(e){return\"local storage is unavailable: \"+re(e)},networkError:e=>\"network error\"+(e?\" (\"+e+\")\":\"\"),optionBelowMinimum:(e,t,n)=>'Config option \"'+e+'\" was set to '+t+\", changing to minimum value of \"+n,streamClosing:function(){return\"Closing stream connection\"},streamConnecting:function(e){return\"Opening stream connection to \"+e},streamError:function(e,t){return\"Error on stream connection: \"+re(e)+\", will continue retrying after \"+t+\" milliseconds.\"},tagValueTooLong:e=>`Value of \"${e}\" was longer than 64 characters and was discarded.`,unknownCustomEventKey:function(e){return'Custom event \"'+e+'\" does not exist'},unknownOption:e=>'Ignoring unknown config option \"'+e+'\"',contextNotSpecified:function(){return\"No context specified.\"+oe},unrecoverableStreamError:e=>`Error on stream connection ${re(e)}, giving up permanently`,wrongOptionType:(e,t,n)=>'Config option \"'+e+'\" should be of type '+t+\", got \"+n+\", using default value\",wrongOptionTypeBoolean:(e,t)=>'Config option \"'+e+'\" should be a boolean, got '+t+\", converting to boolean\"};const{validateLogger:ae}=ne,se={baseUrl:{default:\"https://app.launchdarkly.com\"},streamUrl:{default:\"https://clientstream.launchdarkly.com\"},eventsUrl:{default:\"https://events.launchdarkly.com\"},sendEvents:{default:!0},streaming:{type:\"boolean\"},sendLDHeaders:{default:!0},requestHeaderTransform:{type:\"function\"},sendEventsOnlyForVariation:{default:!1},useReport:{default:!1},evaluationReasons:{default:!1},eventCapacity:{default:100,minimum:1},flushInterval:{default:2e3,minimum:2e3},samplingInterval:{default:0,minimum:0},streamReconnectDelay:{default:1e3,minimum:0},allAttributesPrivate:{default:!1},privateAttributes:{default:[]},bootstrap:{type:\"string|object\"},diagnosticRecordingInterval:{default:9e5,minimum:2e3},diagnosticOptOut:{default:!1},wrapperName:{type:\"string\"},wrapperVersion:{type:\"string\"},stateProvider:{type:\"object\"},application:{validator:function(e,t,n){const r={};t.id&&(r.id=le(`${e}.id`,t.id,n));t.version&&(r.version=le(`${e}.version`,t.version,n));return r}},inspectors:{default:[]}},ce=/^(\\w|\\.|-)+$/;function ue(e){return e&&e.replace(/\\/+$/,\"\")}function le(e,t,n){if(\"string\"==typeof t&&t.match(ce)){if(!(t.length>64))return t;n.warn(ie.tagValueTooLong(e))}else n.warn(ie.invalidTagValue(e))}var de={baseOptionDefs:se,validate:function(e,t,n,r){const o=S.extend({logger:{default:r}},se,n),i={};function a(e){S.onNextTick((()=>{t&&t.maybeReportError(new s.LDInvalidArgumentError(e))}))}let c=S.extend({},e||{});return function(e){const t=e;Object.keys(i).forEach((e=>{if(void 0!==t[e]){const n=i[e];r&&r.warn(ie.deprecated(e,n)),n&&(void 0===t[n]&&(t[n]=t[e]),delete t[e])}}))}(c),c=function(e){const t=S.extend({},e);return Object.keys(o).forEach((e=>{void 0!==t[e]&&null!==t[e]||(t[e]=o[e]&&o[e].default)})),t}(c),c=function(e){const t=S.extend({},e),n=e=>{if(null===e)return\"any\";if(void 0===e)return;if(Array.isArray(e))return\"array\";const t=typeof e;return\"boolean\"===t||\"string\"===t||\"number\"===t||\"function\"===t?t:\"object\"};return Object.keys(e).forEach((i=>{const s=e[i];if(null!=s){const c=o[i];if(void 0===c)a(ie.unknownOption(i));else{const o=c.type||n(c.default),u=c.validator;if(u){const n=u(i,e[i],r);void 0!==n?t[i]=n:delete t[i]}else if(\"any\"!==o){const e=o.split(\"|\"),r=n(s);e.indexOf(r)<0?\"boolean\"===o?(t[i]=!!s,a(ie.wrongOptionTypeBoolean(i,r))):(a(ie.wrongOptionType(i,o,r)),t[i]=c.default):\"number\"===r&&void 0!==c.minimum&&sArray.isArray(r[e])?r[e].sort().map((t=>`${e}/${t}`)):[`${e}/${r[e]}`])).reduce(((e,t)=>e.concat(t)),[]).join(\" \")),n},transformHeaders:function(e,t){return t&&t.requestHeaderTransform?t.requestHeaderTransform({...e}):e}};const{v1:ve}=ee,{getLDHeaders:pe,transformHeaders:me}=ge;var he=function(e,t,n){const r=S.extend({\"Content-Type\":\"application/json\"},pe(e,n)),o={};return o.sendEvents=(t,o,i)=>{if(!e.httpRequest)return Promise.resolve();const a=JSON.stringify(t),c=i?null:ve();return function t(u){const l=i?r:S.extend({},r,{\"X-LaunchDarkly-Event-Schema\":\"4\",\"X-LaunchDarkly-Payload-ID\":c});return e.httpRequest(\"POST\",o,me(l,n),a).promise.then((e=>{if(e)return e.status>=400&&s.isHttpErrorRecoverable(e.status)&&u?t(!1):function(e){const t={status:e.status},n=e.header(\"date\");if(n){const e=Date.parse(n);e&&(t.serverTime=e)}return t}(e)})).catch((()=>u?t(!1):Promise.reject()))}(!0).catch((()=>{}))},o};const{commonBasicLogger:ye}=ne;function we(e){return\"string\"==typeof e&&\"kind\"!==e&&e.match(/^(\\w|\\.|-)+$/)}function be(e){return e.includes(\"%\")||e.includes(\":\")?e.replace(/%/g,\"%25\").replace(/:/g,\"%3A\"):e}var ke={checkContext:function(e,t){if(e){if(t&&(void 0===e.kind||null===e.kind))return void 0!==e.key&&null!==e.key;const n=e.key,r=void 0===e.kind?\"user\":e.kind,o=we(r),i=\"multi\"===r||null!=n&&\"\"!==n;if(\"multi\"===r){const t=Object.keys(e).filter((e=>\"kind\"!==e));return i&&t.every((e=>we(e)))&&t.every((t=>{const n=e[t].key;return null!=n&&\"\"!==n}))}return i&&o}return!1},getContextKeys:function(e,t=ye()){if(!e)return;const n={},{kind:r,key:o}=e;switch(r){case void 0:n.user=`${o}`;break;case\"multi\":Object.entries(e).filter((([e])=>\"kind\"!==e)).forEach((([e,t])=>{t&&t.key&&(n[e]=t.key)}));break;case null:t.warn(`null is not a valid context kind: ${e}`);break;case\"\":t.warn(`'' is not a valid context kind: ${e}`);break;default:n[r]=`${o}`}return n},getContextKinds:function(e){return e?null===e.kind||void 0===e.kind?[\"user\"]:\"multi\"!==e.kind?[e.kind]:Object.keys(e).filter((e=>\"kind\"!==e)):[]},getCanonicalKey:function(e){if(e){if((void 0===e.kind||null===e.kind||\"user\"===e.kind)&&e.key)return e.key;if(\"multi\"!==e.kind&&e.key)return`${e.kind}:${be(e.key)}`;if(\"multi\"===e.kind)return Object.keys(e).sort().filter((e=>\"kind\"!==e)).map((t=>`${t}:${be(e[t].key)}`)).join(\":\")}}};const{getContextKinds:Ee}=ke;var De=function(){const e={};let t=0,n=0,r={},o={};return e.summarizeEvent=e=>{if(\"feature\"===e.kind){const i=e.key+\":\"+(null!==e.variation&&void 0!==e.variation?e.variation:\"\")+\":\"+(null!==e.version&&void 0!==e.version?e.version:\"\"),a=r[i];let s=o[e.key];s||(s=new Set,o[e.key]=s),function(e){return e.context?Ee(e.context):e.contextKeys?Object.keys(e.contextKeys):[]}(e).forEach((e=>s.add(e))),a?a.count=a.count+1:r[i]={count:1,key:e.key,version:e.version,variation:e.variation,value:e.value,default:e.default},(0===t||e.creationDaten&&(n=e.creationDate)}},e.getSummary=()=>{const e={};let i=!0;for(const t of Object.values(r)){let n=e[t.key];n||(n={default:t.default,counters:[],contextKinds:[...o[t.key]]},e[t.key]=n);const r={value:t.value,count:t.count};void 0!==t.variation&&null!==t.variation&&(r.variation=t.variation),void 0!==t.version&&null!==t.version?r.version=t.version:r.unknown=!0,n.counters.push(r),i=!1}return i?null:{startDate:t,endDate:n,features:e}},e.clearSummary=()=>{t=0,n=0,r={},o={}},e};function xe(e){return e.replace(/~/g,\"~0\").replace(/\\//g,\"~1\")}function Ce(e){return(e.startsWith(\"/\")?e.substring(1):e).split(\"/\").map((e=>e.indexOf(\"~\")>=0?e.replace(/~1/g,\"/\").replace(/~0/g,\"~\"):e))}function Pe(e){return!e.startsWith(\"/\")}function Se(e,t){const n=Pe(e),r=Pe(t);if(n&&r)return e===t;if(n){const n=Ce(t);return 1===n.length&&e===n[0]}if(r){const n=Ce(e);return 1===n.length&&t===n[0]}return e===t}function Ie(e){return`/${xe(e)}`}var Oe={cloneExcluding:function(e,t){const n=[],r={},o=[];for(n.push(...Object.keys(e).map((t=>({key:t,ptr:Ie(t),source:e,parent:r,visited:[e]}))));n.length;){const e=n.pop();if(t.some((t=>Se(t,e.ptr))))o.push(e.ptr);else{const t=e.source[e.key];if(null===t)e.parent[e.key]=t;else if(Array.isArray(t))e.parent[e.key]=[...t];else if(\"object\"==typeof t){if(e.visited.includes(t))continue;e.parent[e.key]={},n.push(...Object.keys(t).map((n=>{return{key:n,ptr:(r=e.ptr,o=xe(n),`${r}/${o}`),source:t,parent:e.parent[e.key],visited:[...e.visited,t]};var r,o})))}else e.parent[e.key]=t}}return{cloned:r,excluded:o.sort()}},compare:Se,literalToReference:Ie};var Te=function(e){const t={},n=e.allAttributesPrivate,r=e.privateAttributes||[],o=[\"key\",\"kind\",\"_meta\",\"anonymous\"],i=[\"name\",\"ip\",\"firstName\",\"lastName\",\"email\",\"avatar\",\"country\"],a=(e,t)=>{if(\"object\"!=typeof e||null===e||Array.isArray(e))return;const{cloned:i,excluded:a}=Oe.cloneExcluding(e,((e,t)=>(n||t&&e.anonymous?Object.keys(e):[...r,...e._meta&&e._meta.privateAttributes||[]]).filter((e=>!o.some((t=>Oe.compare(e,t))))))(e,t));return i.key=String(i.key),a.length&&(i._meta||(i._meta={}),i._meta.redactedAttributes=a),i._meta&&(delete i._meta.privateAttributes,0===Object.keys(i._meta).length&&delete i._meta),void 0!==i.anonymous&&(i.anonymous=!!i.anonymous),i};return t.filter=(e,t=!1)=>void 0===e.kind||null===e.kind?a((e=>{const t={...e.custom||{},kind:\"user\",key:e.key};void 0!==e.anonymous&&(t.anonymous=!!e.anonymous);for(const n of i)delete t[n],void 0!==e[n]&&null!==e[n]&&(t[n]=String(e[n]));return void 0!==e.privateAttributeNames&&null!==e.privateAttributeNames&&(t._meta=t._meta||{},t._meta.privateAttributes=e.privateAttributeNames.map((e=>e.startsWith(\"/\")?Oe.literalToReference(e):e))),t})(e),t):\"multi\"===e.kind?((e,t)=>{const n={kind:e.kind},r=Object.keys(e);for(const o of r)if(\"kind\"!==o){const r=a(e[o],t);r&&(n[o]=r)}return n})(e,t):a(e,t),t};const{getContextKeys:Le}=ke;var Ue=function(e,t,n,r=null,o=null,i=null){const a={},c=i||he(e,n,t),u=S.appendUrlPath(t.eventsUrl,\"/events/bulk/\"+n),l=De(),d=Te(t),f=t.samplingInterval,g=t.eventCapacity,v=t.flushInterval,p=t.logger;let m,h=[],y=0,w=!1,b=!1;function k(){return 0===f||0===Math.floor(Math.random()*f)}function E(e){const t=S.extend({},e);return\"identify\"===e.kind?t.context=d.filter(e.context):\"feature\"===e.kind?t.context=d.filter(e.context,!0):(t.contextKeys=Le(e.context,p),delete t.context),\"feature\"===e.kind&&(delete t.trackEvents,delete t.debugEventsUntilDate),t}function D(e){h.lengthy&&r.debugEventsUntilDate>(new Date).getTime()):t=k(),t&&D(E(e)),n){const t=S.extend({},e,{kind:\"debug\"});t.context=d.filter(t.context),delete t.trackEvents,delete t.debugEventsUntilDate,D(t)}},a.flush=function(){if(w)return Promise.resolve();const e=h,t=l.getSummary();return l.clearSummary(),t&&(t.kind=\"summary\",e.push(t)),r&&r.setEventsInLastBatch(e.length),0===e.length?Promise.resolve():(h=[],p.debug(ie.debugPostingEvents(e.length)),c.sendEvents(e,u).then((e=>{e&&(e.serverTime&&(y=e.serverTime),s.isHttpErrorRecoverable(e.status)||(w=!0),e.status>=400&&S.onNextTick((()=>{o.maybeReportError(new s.LDUnexpectedResponseError(ie.httpErrorMessage(e.status,\"event posting\",\"some events were dropped\")))})))})))},a.start=function(){const e=()=>{a.flush(),m=setTimeout(e,v)};m=setTimeout(e,v)},a.stop=function(){clearTimeout(m)},a};var Re=function(e){const t={},n={};return t.on=function(e,t,r){n[e]=n[e]||[],n[e]=n[e].concat({handler:t,context:r})},t.off=function(e,t,r){if(n[e])for(let o=0;o