with its height set to 100vh and measure that since that's what the scrolling is based on anyway and it's not affected by address bar showing/hiding.\n\n _div100vh.style.height = \"100vh\";\n _div100vh.style.position = \"absolute\";\n\n _refresh100vh();\n\n _rafBugFix();\n\n Observer.register(gsap); // isTouch is 0 if no touch, 1 if ONLY touch, and 2 if it can accommodate touch but also other types like mouse/pointer.\n\n ScrollTrigger.isTouch = Observer.isTouch;\n _fixIOSBug = Observer.isTouch && /(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent); // since 2017, iOS has had a bug that causes event.clientX/Y to be inaccurate when a scroll occurs, thus we must alternate ignoring every other touchmove event to work around it. See https://bugs.webkit.org/show_bug.cgi?id=181954 and https://codepen.io/GreenSock/pen/ExbrPNa/087cef197dc35445a0951e8935c41503\n\n _ignoreMobileResize = Observer.isTouch === 1;\n\n _addListener(_win, \"wheel\", _onScroll); // mostly for 3rd party smooth scrolling libraries.\n\n\n _root = [_win, _doc, _docEl, _body];\n\n if (gsap.matchMedia) {\n ScrollTrigger.matchMedia = function (vars) {\n var mm = gsap.matchMedia(),\n p;\n\n for (p in vars) {\n mm.add(p, vars[p]);\n }\n\n return mm;\n };\n\n gsap.addEventListener(\"matchMediaInit\", function () {\n return _revertAll();\n });\n gsap.addEventListener(\"matchMediaRevert\", function () {\n return _revertRecorded();\n });\n gsap.addEventListener(\"matchMedia\", function () {\n _refreshAll(0, 1);\n\n _dispatch(\"matchMedia\");\n });\n gsap.matchMedia().add(\"(orientation: portrait)\", function () {\n // when orientation changes, we should take new base measurements for the ignoreMobileResize feature.\n _setBaseDimensions();\n\n return _setBaseDimensions;\n });\n } else {\n console.warn(\"Requires GSAP 3.11.0 or later\");\n }\n\n _setBaseDimensions();\n\n _addListener(_doc, \"scroll\", _onScroll); // some browsers (like Chrome), the window stops dispatching scroll events on the window if you scroll really fast, but it's consistent on the document!\n\n\n var bodyHasStyle = _body.hasAttribute(\"style\"),\n bodyStyle = _body.style,\n border = bodyStyle.borderTopStyle,\n AnimationProto = gsap.core.Animation.prototype,\n bounds,\n i;\n\n AnimationProto.revert || Object.defineProperty(AnimationProto, \"revert\", {\n value: function value() {\n return this.time(-0.01, true);\n }\n }); // only for backwards compatibility (Animation.revert() was added after 3.10.4)\n\n bodyStyle.borderTopStyle = \"solid\"; // works around an issue where a margin of a child element could throw off the bounds of the _body, making it seem like there's a margin when there actually isn't. The border ensures that the bounds are accurate.\n\n bounds = _getBounds(_body);\n _vertical.m = Math.round(bounds.top + _vertical.sc()) || 0; // accommodate the offset of the caused by margins and/or padding\n\n _horizontal.m = Math.round(bounds.left + _horizontal.sc()) || 0;\n border ? bodyStyle.borderTopStyle = border : bodyStyle.removeProperty(\"border-top-style\");\n\n if (!bodyHasStyle) {\n // SSR frameworks like Next.js complain if this attribute gets added.\n _body.setAttribute(\"style\", \"\"); // it's not enough to just removeAttribute() - we must first set it to empty, otherwise Next.js complains.\n\n\n _body.removeAttribute(\"style\");\n } // TODO: (?) maybe move to leveraging the velocity mechanism in Observer and skip intervals.\n\n\n _syncInterval = setInterval(_sync, 250);\n gsap.delayedCall(0.5, function () {\n return _startup = 0;\n });\n\n _addListener(_doc, \"touchcancel\", _passThrough); // some older Android devices intermittently stop dispatching \"touchmove\" events if we don't listen for \"touchcancel\" on the document.\n\n\n _addListener(_body, \"touchstart\", _passThrough); //works around Safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/\n\n\n _multiListener(_addListener, _doc, \"pointerdown,touchstart,mousedown\", _pointerDownHandler);\n\n _multiListener(_addListener, _doc, \"pointerup,touchend,mouseup\", _pointerUpHandler);\n\n _transformProp = gsap.utils.checkPrefix(\"transform\");\n\n _stateProps.push(_transformProp);\n\n _coreInitted = _getTime();\n _resizeDelay = gsap.delayedCall(0.2, _refreshAll).pause();\n _autoRefresh = [_doc, \"visibilitychange\", function () {\n var w = _win.innerWidth,\n h = _win.innerHeight;\n\n if (_doc.hidden) {\n _prevWidth = w;\n _prevHeight = h;\n } else if (_prevWidth !== w || _prevHeight !== h) {\n _onResize();\n }\n }, _doc, \"DOMContentLoaded\", _refreshAll, _win, \"load\", _refreshAll, _win, \"resize\", _onResize];\n\n _iterateAutoRefresh(_addListener);\n\n _triggers.forEach(function (trigger) {\n return trigger.enable(0, 1);\n });\n\n for (i = 0; i < _scrollers.length; i += 3) {\n _wheelListener(_removeListener, _scrollers[i], _scrollers[i + 1]);\n\n _wheelListener(_removeListener, _scrollers[i], _scrollers[i + 2]);\n }\n }\n }\n };\n\n ScrollTrigger.config = function config(vars) {\n \"limitCallbacks\" in vars && (_limitCallbacks = !!vars.limitCallbacks);\n var ms = vars.syncInterval;\n ms && clearInterval(_syncInterval) || (_syncInterval = ms) && setInterval(_sync, ms);\n \"ignoreMobileResize\" in vars && (_ignoreMobileResize = ScrollTrigger.isTouch === 1 && vars.ignoreMobileResize);\n\n if (\"autoRefreshEvents\" in vars) {\n _iterateAutoRefresh(_removeListener) || _iterateAutoRefresh(_addListener, vars.autoRefreshEvents || \"none\");\n _ignoreResize = (vars.autoRefreshEvents + \"\").indexOf(\"resize\") === -1;\n }\n };\n\n ScrollTrigger.scrollerProxy = function scrollerProxy(target, vars) {\n var t = _getTarget(target),\n i = _scrollers.indexOf(t),\n isViewport = _isViewport(t);\n\n if (~i) {\n _scrollers.splice(i, isViewport ? 6 : 2);\n }\n\n if (vars) {\n isViewport ? _proxies.unshift(_win, vars, _body, vars, _docEl, vars) : _proxies.unshift(t, vars);\n }\n };\n\n ScrollTrigger.clearMatchMedia = function clearMatchMedia(query) {\n _triggers.forEach(function (t) {\n return t._ctx && t._ctx.query === query && t._ctx.kill(true, true);\n });\n };\n\n ScrollTrigger.isInViewport = function isInViewport(element, ratio, horizontal) {\n var bounds = (_isString(element) ? _getTarget(element) : element).getBoundingClientRect(),\n offset = bounds[horizontal ? _width : _height] * ratio || 0;\n return horizontal ? bounds.right - offset > 0 && bounds.left + offset < _win.innerWidth : bounds.bottom - offset > 0 && bounds.top + offset < _win.innerHeight;\n };\n\n ScrollTrigger.positionInViewport = function positionInViewport(element, referencePoint, horizontal) {\n _isString(element) && (element = _getTarget(element));\n var bounds = element.getBoundingClientRect(),\n size = bounds[horizontal ? _width : _height],\n offset = referencePoint == null ? size / 2 : referencePoint in _keywords ? _keywords[referencePoint] * size : ~referencePoint.indexOf(\"%\") ? parseFloat(referencePoint) * size / 100 : parseFloat(referencePoint) || 0;\n return horizontal ? (bounds.left + offset) / _win.innerWidth : (bounds.top + offset) / _win.innerHeight;\n };\n\n ScrollTrigger.killAll = function killAll(allowListeners) {\n _triggers.slice(0).forEach(function (t) {\n return t.vars.id !== \"ScrollSmoother\" && t.kill();\n });\n\n if (allowListeners !== true) {\n var listeners = _listeners.killAll || [];\n _listeners = {};\n listeners.forEach(function (f) {\n return f();\n });\n }\n };\n\n return ScrollTrigger;\n}();\nScrollTrigger.version = \"3.12.7\";\n\nScrollTrigger.saveStyles = function (targets) {\n return targets ? _toArray(targets).forEach(function (target) {\n // saved styles are recorded in a consecutive alternating Array, like [element, cssText, transform attribute, cache, matchMedia, ...]\n if (target && target.style) {\n var i = _savedStyles.indexOf(target);\n\n i >= 0 && _savedStyles.splice(i, 5);\n\n _savedStyles.push(target, target.style.cssText, target.getBBox && target.getAttribute(\"transform\"), gsap.core.getCache(target), _context());\n }\n }) : _savedStyles;\n};\n\nScrollTrigger.revert = function (soft, media) {\n return _revertAll(!soft, media);\n};\n\nScrollTrigger.create = function (vars, animation) {\n return new ScrollTrigger(vars, animation);\n};\n\nScrollTrigger.refresh = function (safe) {\n return safe ? _onResize(true) : (_coreInitted || ScrollTrigger.register()) && _refreshAll(true);\n};\n\nScrollTrigger.update = function (force) {\n return ++_scrollers.cache && _updateAll(force === true ? 2 : 0);\n};\n\nScrollTrigger.clearScrollMemory = _clearScrollMemory;\n\nScrollTrigger.maxScroll = function (element, horizontal) {\n return _maxScroll(element, horizontal ? _horizontal : _vertical);\n};\n\nScrollTrigger.getScrollFunc = function (element, horizontal) {\n return _getScrollFunc(_getTarget(element), horizontal ? _horizontal : _vertical);\n};\n\nScrollTrigger.getById = function (id) {\n return _ids[id];\n};\n\nScrollTrigger.getAll = function () {\n return _triggers.filter(function (t) {\n return t.vars.id !== \"ScrollSmoother\";\n });\n}; // it's common for people to ScrollTrigger.getAll(t => t.kill()) on page routes, for example, and we don't want it to ruin smooth scrolling by killing the main ScrollSmoother one.\n\n\nScrollTrigger.isScrolling = function () {\n return !!_lastScrollTime;\n};\n\nScrollTrigger.snapDirectional = _snapDirectional;\n\nScrollTrigger.addEventListener = function (type, callback) {\n var a = _listeners[type] || (_listeners[type] = []);\n ~a.indexOf(callback) || a.push(callback);\n};\n\nScrollTrigger.removeEventListener = function (type, callback) {\n var a = _listeners[type],\n i = a && a.indexOf(callback);\n i >= 0 && a.splice(i, 1);\n};\n\nScrollTrigger.batch = function (targets, vars) {\n var result = [],\n varsCopy = {},\n interval = vars.interval || 0.016,\n batchMax = vars.batchMax || 1e9,\n proxyCallback = function proxyCallback(type, callback) {\n var elements = [],\n triggers = [],\n delay = gsap.delayedCall(interval, function () {\n callback(elements, triggers);\n elements = [];\n triggers = [];\n }).pause();\n return function (self) {\n elements.length || delay.restart(true);\n elements.push(self.trigger);\n triggers.push(self);\n batchMax <= elements.length && delay.progress(1);\n };\n },\n p;\n\n for (p in vars) {\n varsCopy[p] = p.substr(0, 2) === \"on\" && _isFunction(vars[p]) && p !== \"onRefreshInit\" ? proxyCallback(p, vars[p]) : vars[p];\n }\n\n if (_isFunction(batchMax)) {\n batchMax = batchMax();\n\n _addListener(ScrollTrigger, \"refresh\", function () {\n return batchMax = vars.batchMax();\n });\n }\n\n _toArray(targets).forEach(function (target) {\n var config = {};\n\n for (p in varsCopy) {\n config[p] = varsCopy[p];\n }\n\n config.trigger = target;\n result.push(ScrollTrigger.create(config));\n });\n\n return result;\n}; // to reduce file size. clamps the scroll and also returns a duration multiplier so that if the scroll gets chopped shorter, the duration gets curtailed as well (otherwise if you're very close to the top of the page, for example, and swipe up really fast, it'll suddenly slow down and take a long time to reach the top).\n\n\nvar _clampScrollAndGetDurationMultiplier = function _clampScrollAndGetDurationMultiplier(scrollFunc, current, end, max) {\n current > max ? scrollFunc(max) : current < 0 && scrollFunc(0);\n return end > max ? (max - current) / (end - current) : end < 0 ? current / (current - end) : 1;\n},\n _allowNativePanning = function _allowNativePanning(target, direction) {\n if (direction === true) {\n target.style.removeProperty(\"touch-action\");\n } else {\n target.style.touchAction = direction === true ? \"auto\" : direction ? \"pan-\" + direction + (Observer.isTouch ? \" pinch-zoom\" : \"\") : \"none\"; // note: Firefox doesn't support it pinch-zoom properly, at least in addition to a pan-x or pan-y.\n }\n\n target === _docEl && _allowNativePanning(_body, direction);\n},\n _overflow = {\n auto: 1,\n scroll: 1\n},\n _nestedScroll = function _nestedScroll(_ref5) {\n var event = _ref5.event,\n target = _ref5.target,\n axis = _ref5.axis;\n\n var node = (event.changedTouches ? event.changedTouches[0] : event).target,\n cache = node._gsap || gsap.core.getCache(node),\n time = _getTime(),\n cs;\n\n if (!cache._isScrollT || time - cache._isScrollT > 2000) {\n // cache for 2 seconds to improve performance.\n while (node && node !== _body && (node.scrollHeight <= node.clientHeight && node.scrollWidth <= node.clientWidth || !(_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX]))) {\n node = node.parentNode;\n }\n\n cache._isScroll = node && node !== target && !_isViewport(node) && (_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX]);\n cache._isScrollT = time;\n }\n\n if (cache._isScroll || axis === \"x\") {\n event.stopPropagation();\n event._gsapAllow = true;\n }\n},\n // capture events on scrollable elements INSIDE the and allow those by calling stopPropagation() when we find a scrollable ancestor\n_inputObserver = function _inputObserver(target, type, inputs, nested) {\n return Observer.create({\n target: target,\n capture: true,\n debounce: false,\n lockAxis: true,\n type: type,\n onWheel: nested = nested && _nestedScroll,\n onPress: nested,\n onDrag: nested,\n onScroll: nested,\n onEnable: function onEnable() {\n return inputs && _addListener(_doc, Observer.eventTypes[0], _captureInputs, false, true);\n },\n onDisable: function onDisable() {\n return _removeListener(_doc, Observer.eventTypes[0], _captureInputs, true);\n }\n });\n},\n _inputExp = /(input|label|select|textarea)/i,\n _inputIsFocused,\n _captureInputs = function _captureInputs(e) {\n var isInput = _inputExp.test(e.target.tagName);\n\n if (isInput || _inputIsFocused) {\n e._gsapAllow = true;\n _inputIsFocused = isInput;\n }\n},\n _getScrollNormalizer = function _getScrollNormalizer(vars) {\n _isObject(vars) || (vars = {});\n vars.preventDefault = vars.isNormalizer = vars.allowClicks = true;\n vars.type || (vars.type = \"wheel,touch\");\n vars.debounce = !!vars.debounce;\n vars.id = vars.id || \"normalizer\";\n\n var _vars2 = vars,\n normalizeScrollX = _vars2.normalizeScrollX,\n momentum = _vars2.momentum,\n allowNestedScroll = _vars2.allowNestedScroll,\n onRelease = _vars2.onRelease,\n self,\n maxY,\n target = _getTarget(vars.target) || _docEl,\n smoother = gsap.core.globals().ScrollSmoother,\n smootherInstance = smoother && smoother.get(),\n content = _fixIOSBug && (vars.content && _getTarget(vars.content) || smootherInstance && vars.content !== false && !smootherInstance.smooth() && smootherInstance.content()),\n scrollFuncY = _getScrollFunc(target, _vertical),\n scrollFuncX = _getScrollFunc(target, _horizontal),\n scale = 1,\n initialScale = (Observer.isTouch && _win.visualViewport ? _win.visualViewport.scale * _win.visualViewport.width : _win.outerWidth) / _win.innerWidth,\n wheelRefresh = 0,\n resolveMomentumDuration = _isFunction(momentum) ? function () {\n return momentum(self);\n } : function () {\n return momentum || 2.8;\n },\n lastRefreshID,\n skipTouchMove,\n inputObserver = _inputObserver(target, vars.type, true, allowNestedScroll),\n resumeTouchMove = function resumeTouchMove() {\n return skipTouchMove = false;\n },\n scrollClampX = _passThrough,\n scrollClampY = _passThrough,\n updateClamps = function updateClamps() {\n maxY = _maxScroll(target, _vertical);\n scrollClampY = _clamp(_fixIOSBug ? 1 : 0, maxY);\n normalizeScrollX && (scrollClampX = _clamp(0, _maxScroll(target, _horizontal)));\n lastRefreshID = _refreshID;\n },\n removeContentOffset = function removeContentOffset() {\n content._gsap.y = _round(parseFloat(content._gsap.y) + scrollFuncY.offset) + \"px\";\n content.style.transform = \"matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, \" + parseFloat(content._gsap.y) + \", 0, 1)\";\n scrollFuncY.offset = scrollFuncY.cacheID = 0;\n },\n ignoreDrag = function ignoreDrag() {\n if (skipTouchMove) {\n requestAnimationFrame(resumeTouchMove);\n\n var offset = _round(self.deltaY / 2),\n scroll = scrollClampY(scrollFuncY.v - offset);\n\n if (content && scroll !== scrollFuncY.v + scrollFuncY.offset) {\n scrollFuncY.offset = scroll - scrollFuncY.v;\n\n var y = _round((parseFloat(content && content._gsap.y) || 0) - scrollFuncY.offset);\n\n content.style.transform = \"matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, \" + y + \", 0, 1)\";\n content._gsap.y = y + \"px\";\n scrollFuncY.cacheID = _scrollers.cache;\n\n _updateAll();\n }\n\n return true;\n }\n\n scrollFuncY.offset && removeContentOffset();\n skipTouchMove = true;\n },\n tween,\n startScrollX,\n startScrollY,\n onStopDelayedCall,\n onResize = function onResize() {\n // if the window resizes, like on an iPhone which Apple FORCES the address bar to show/hide even if we event.preventDefault(), it may be scrolling too far now that the address bar is showing, so we must dynamically adjust the momentum tween.\n updateClamps();\n\n if (tween.isActive() && tween.vars.scrollY > maxY) {\n scrollFuncY() > maxY ? tween.progress(1) && scrollFuncY(maxY) : tween.resetTo(\"scrollY\", maxY);\n }\n };\n\n content && gsap.set(content, {\n y: \"+=0\"\n }); // to ensure there's a cache (element._gsap)\n\n vars.ignoreCheck = function (e) {\n return _fixIOSBug && e.type === \"touchmove\" && ignoreDrag(e) || scale > 1.05 && e.type !== \"touchstart\" || self.isGesturing || e.touches && e.touches.length > 1;\n };\n\n vars.onPress = function () {\n skipTouchMove = false;\n var prevScale = scale;\n scale = _round((_win.visualViewport && _win.visualViewport.scale || 1) / initialScale);\n tween.pause();\n prevScale !== scale && _allowNativePanning(target, scale > 1.01 ? true : normalizeScrollX ? false : \"x\");\n startScrollX = scrollFuncX();\n startScrollY = scrollFuncY();\n updateClamps();\n lastRefreshID = _refreshID;\n };\n\n vars.onRelease = vars.onGestureStart = function (self, wasDragging) {\n scrollFuncY.offset && removeContentOffset();\n\n if (!wasDragging) {\n onStopDelayedCall.restart(true);\n } else {\n _scrollers.cache++; // make sure we're pulling the non-cached value\n // alternate algorithm: durX = Math.min(6, Math.abs(self.velocityX / 800)),\tdur = Math.max(durX, Math.min(6, Math.abs(self.velocityY / 800))); dur = dur * (0.4 + (1 - _power4In(dur / 6)) * 0.6)) * (momentumSpeed || 1)\n\n var dur = resolveMomentumDuration(),\n currentScroll,\n endScroll;\n\n if (normalizeScrollX) {\n currentScroll = scrollFuncX();\n endScroll = currentScroll + dur * 0.05 * -self.velocityX / 0.227; // the constant .227 is from power4(0.05). velocity is inverted because scrolling goes in the opposite direction.\n\n dur *= _clampScrollAndGetDurationMultiplier(scrollFuncX, currentScroll, endScroll, _maxScroll(target, _horizontal));\n tween.vars.scrollX = scrollClampX(endScroll);\n }\n\n currentScroll = scrollFuncY();\n endScroll = currentScroll + dur * 0.05 * -self.velocityY / 0.227; // the constant .227 is from power4(0.05)\n\n dur *= _clampScrollAndGetDurationMultiplier(scrollFuncY, currentScroll, endScroll, _maxScroll(target, _vertical));\n tween.vars.scrollY = scrollClampY(endScroll);\n tween.invalidate().duration(dur).play(0.01);\n\n if (_fixIOSBug && tween.vars.scrollY >= maxY || currentScroll >= maxY - 1) {\n // iOS bug: it'll show the address bar but NOT fire the window \"resize\" event until the animation is done but we must protect against overshoot so we leverage an onUpdate to do so.\n gsap.to({}, {\n onUpdate: onResize,\n duration: dur\n });\n }\n }\n\n onRelease && onRelease(self);\n };\n\n vars.onWheel = function () {\n tween._ts && tween.pause();\n\n if (_getTime() - wheelRefresh > 1000) {\n // after 1 second, refresh the clamps otherwise that'll only happen when ScrollTrigger.refresh() is called or for touch-scrolling.\n lastRefreshID = 0;\n wheelRefresh = _getTime();\n }\n };\n\n vars.onChange = function (self, dx, dy, xArray, yArray) {\n _refreshID !== lastRefreshID && updateClamps();\n dx && normalizeScrollX && scrollFuncX(scrollClampX(xArray[2] === dx ? startScrollX + (self.startX - self.x) : scrollFuncX() + dx - xArray[1])); // for more precision, we track pointer/touch movement from the start, otherwise it'll drift.\n\n if (dy) {\n scrollFuncY.offset && removeContentOffset();\n var isTouch = yArray[2] === dy,\n y = isTouch ? startScrollY + self.startY - self.y : scrollFuncY() + dy - yArray[1],\n yClamped = scrollClampY(y);\n isTouch && y !== yClamped && (startScrollY += yClamped - y);\n scrollFuncY(yClamped);\n }\n\n (dy || dx) && _updateAll();\n };\n\n vars.onEnable = function () {\n _allowNativePanning(target, normalizeScrollX ? false : \"x\");\n\n ScrollTrigger.addEventListener(\"refresh\", onResize);\n\n _addListener(_win, \"resize\", onResize);\n\n if (scrollFuncY.smooth) {\n scrollFuncY.target.style.scrollBehavior = \"auto\";\n scrollFuncY.smooth = scrollFuncX.smooth = false;\n }\n\n inputObserver.enable();\n };\n\n vars.onDisable = function () {\n _allowNativePanning(target, true);\n\n _removeListener(_win, \"resize\", onResize);\n\n ScrollTrigger.removeEventListener(\"refresh\", onResize);\n inputObserver.kill();\n };\n\n vars.lockAxis = vars.lockAxis !== false;\n self = new Observer(vars);\n self.iOS = _fixIOSBug; // used in the Observer getCachedScroll() function to work around an iOS bug that wreaks havoc with TouchEvent.clientY if we allow scroll to go all the way back to 0.\n\n _fixIOSBug && !scrollFuncY() && scrollFuncY(1); // iOS bug causes event.clientY values to freak out (wildly inaccurate) if the scroll position is exactly 0.\n\n _fixIOSBug && gsap.ticker.add(_passThrough); // prevent the ticker from sleeping\n\n onStopDelayedCall = self._dc;\n tween = gsap.to(self, {\n ease: \"power4\",\n paused: true,\n inherit: false,\n scrollX: normalizeScrollX ? \"+=0.1\" : \"+=0\",\n scrollY: \"+=0.1\",\n modifiers: {\n scrollY: _interruptionTracker(scrollFuncY, scrollFuncY(), function () {\n return tween.pause();\n })\n },\n onUpdate: _updateAll,\n onComplete: onStopDelayedCall.vars.onComplete\n }); // we need the modifier to sense if the scroll position is altered outside of the momentum tween (like with a scrollTo tween) so we can pause() it to prevent conflicts.\n\n return self;\n};\n\nScrollTrigger.sort = function (func) {\n if (_isFunction(func)) {\n return _triggers.sort(func);\n }\n\n var scroll = _win.pageYOffset || 0;\n ScrollTrigger.getAll().forEach(function (t) {\n return t._sortY = t.trigger ? scroll + t.trigger.getBoundingClientRect().top : t.start + _win.innerHeight;\n });\n return _triggers.sort(func || function (a, b) {\n return (a.vars.refreshPriority || 0) * -1e6 + (a.vars.containerAnimation ? 1e6 : a._sortY) - ((b.vars.containerAnimation ? 1e6 : b._sortY) + (b.vars.refreshPriority || 0) * -1e6);\n }); // anything with a containerAnimation should refresh last.\n};\n\nScrollTrigger.observe = function (vars) {\n return new Observer(vars);\n};\n\nScrollTrigger.normalizeScroll = function (vars) {\n if (typeof vars === \"undefined\") {\n return _normalizer;\n }\n\n if (vars === true && _normalizer) {\n return _normalizer.enable();\n }\n\n if (vars === false) {\n _normalizer && _normalizer.kill();\n _normalizer = vars;\n return;\n }\n\n var normalizer = vars instanceof Observer ? vars : _getScrollNormalizer(vars);\n _normalizer && _normalizer.target === normalizer.target && _normalizer.kill();\n _isViewport(normalizer.target) && (_normalizer = normalizer);\n return normalizer;\n};\n\nScrollTrigger.core = {\n // smaller file size way to leverage in ScrollSmoother and Observer\n _getVelocityProp: _getVelocityProp,\n _inputObserver: _inputObserver,\n _scrollers: _scrollers,\n _proxies: _proxies,\n bridge: {\n // when normalizeScroll sets the scroll position (ss = setScroll)\n ss: function ss() {\n _lastScrollTime || _dispatch(\"scrollStart\");\n _lastScrollTime = _getTime();\n },\n // a way to get the _refreshing value in Observer\n ref: function ref() {\n return _refreshing;\n }\n }\n};\n_getGSAP() && gsap.registerPlugin(ScrollTrigger);\nexport { ScrollTrigger as default };","import { Controller } from \"@hotwired/stimulus\";\nimport gsap from \"gsap\";\nimport { ScrollTrigger } from \"gsap/ScrollTrigger\";\n\ngsap.registerPlugin(ScrollTrigger);\n\n// Connects to data-controller=\"parallax\"\nexport default class extends Controller {\n static targets = [];\n\n calculateBaseY(el) {\n const speed = 1 - parseFloat(el.dataset.speed) / 100;\n return speed * this.power;\n }\n\n calculateHeroY(_el) {\n return 200;\n }\n\n connect() {\n this.type = this.element.dataset.parallaxType ?? \"base\";\n this.power = parseFloat(this.element.dataset.power ?? 4) * 1000;\n this.scrub = this.element.dataset.scrub ?? 1;\n this.elements = this.element.querySelectorAll(\"[data-speed]\");\n\n this.tl = gsap.timeline({\n scrollTrigger: {\n endTrigger: this.element,\n fastScrollEnd: true,\n invalidateOnRefresh: true,\n preventOverlaps: true,\n scrub: this.type == \"base\" ? 1 : true,\n trigger: this.type == \"base\" ? this.element : undefined,\n },\n });\n\n this.tl.fromTo(\n this.elements,\n { y: 0 },\n {\n ease: \"none\",\n immediateRender: true,\n y: (i, el) => {\n switch (this.type) {\n case \"base\":\n return this.calculateBaseY(el);\n case \"hero\":\n return this.calculateHeroY(el);\n }\n },\n },\n );\n }\n\n disconnect() {\n this.tl.scrollTrigger.kill();\n this.tl.kill();\n }\n}\n\n/* Parallax\n Translate animation on the element or elements linked to the scroll progress.\n Can be used with a single element, but multiple elements can be animated using the same scroll by adding data-speed attribute to any children of the controller element.\n\n Data attributes on the controller element\n - power: strength modifier for all the parallaxes in the controller, useful to ajust the strength of all the parallaxes without having to change individual values (default: 4)\n - scrub: number of seconds before the scroll catches up. Used to give the parallaxes more life. Use value of true for no delay (default: 1)\n\n Data attributes on each elements\n - speed: strength of the individual parallax. Must be bigger than 100. Value of 100 is equal to no mouvement (no default value)\n\n Notes\n - The returned value in the y: (i, el) function is the final y position of the element. The scrollTrigger animates from y value 0 when the viewport is at the top of the controller element, to the final y value when the viewport is at the bottom of the controller element\n - Add a hardcoded css translateY to a parent or children div to reposition the element so that it is in the same position in the page as in figma. Is it useless to change the attributes or the y: (i, el) function to reposition the element.\n - The animations may lag or jump if multiple parallax controllers are used too close too one another. Use a single controller a parent element to fix the issue\n*/\n","import { Controller } from \"@hotwired/stimulus\";\n\n// Connects to data-controller=\"price-calculator\"\nexport default class extends Controller {\n connect() {\n const small_bars_milk = document.getElementById(\"choco_finance_form_small_bars_milk\");\n const small_bars_black = document.getElementById(\"choco_finance_form_small_bars_black\");\n this.choco_finance_submit = document.getElementById(\"choco_finance_submit\");\n this.choco_finance_errors = document.getElementById(\"choco_finance_errors\");\n\n small_bars_milk.addEventListener(\"input\", () => this.updateTotal(small_bars_milk, small_bars_black, this.element));\n small_bars_black.addEventListener(\"input\", () => this.updateTotal(small_bars_milk, small_bars_black, this.element));\n }\n\n disconnect() {}\n\n updateTotal(small_bars_milk, small_bars_black, price_calculator) {\n const quantity_small_bars_milk =\n small_bars_milk.value != \"\" && small_bars_milk.value.match(new RegExp(\"^[0-9]*$\"))\n ? parseInt(small_bars_milk.value)\n : 0;\n const quantity_small_bars_black =\n small_bars_black.value != \"\" && small_bars_black.value.match(new RegExp(\"^[0-9]*$\"))\n ? parseInt(small_bars_black.value)\n : 0;\n\n const total_boxes = quantity_small_bars_milk + quantity_small_bars_black;\n\n this.choco_finance_errors.innerHTML = total_boxes < 10 ? choco_finance_errors.dataset.error : \"\";\n\n //choco_finance_submit.disabled = total_boxes < 10;\n this.element.innerHTML = `${total_boxes * 98}$`;\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { debounce } from \"remeda\";\n\n// Connects to data-controller=\"quantity\"\nexport default class extends Controller {\n static targets = [\"quantityInput\", \"decrementButton\", \"incrementButton\"];\n\n static values = {\n submit: String,\n };\n\n connect() {\n this.adjust(0, { updateValue: false, canSubmit: false });\n }\n\n onInput() {\n this.adjust(0, { updateValue: false });\n }\n\n increment() {\n this.adjust(1);\n }\n\n decrement() {\n this.adjust(-1);\n }\n\n adjust(n, { updateValue = true, canSubmit = true } = {}) {\n let input = this.quantityInputTarget;\n if (input == null) return;\n\n let minValue = (input.min != null && input.min !== '') ? +(input.min) : 0;\n let maxValue = (input.max != null && input.max !== '') ? +(input.max) : Infinity;\n let value = Math.min(maxValue, Math.max(minValue, +(input.value) + n));\n if (updateValue) input.value = value;\n\n if (this.decrementButtonTarget) this.decrementButtonTarget.disabled = (value <= minValue);\n if (this.incrementButtonTarget) this.incrementButtonTarget.disabled = (value >= maxValue);\n\n if (canSubmit && this.submitValue === \"debounce\") {\n this.debouncedSubmit.call();\n }\n }\n\n debouncedSubmit = debounce(\n () => {\n this.element?.closest('form')?.requestSubmit();\n },\n { timing: \"trailing\", waitMs: 800 },\n )\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport gsap from \"gsap\";\n// Connects to data-controller=\"simple-filters\"\nexport default class extends Controller {\n static targets = [\"buttons\", \"buttonsWrapper\", \"tabs\", \"tabsWrapper\"];\n\n connect() {\n let currentEl = null;\n if (window.location.hash != \"\") {\n this.currentSlug = window.location.hash.replace(\"#\", \"\");\n currentEl = this.tabsWrapperTarget.querySelector('[data-simple-filters-index=\"' + this.currentSlug + '\"]');\n this.buttonsWrapperTarget\n .querySelector('[data-simple-filters-index=\"' + this.currentSlug + '\"]')\n .classList.add(\"current-tab\");\n } else {\n currentEl = this.tabsTargets[0];\n this.buttonsTargets[0].classList.add(\"current-tab\");\n this.currentSlug = this.tabsTargets[0].dataset.simpleFiltersIndex;\n }\n currentEl.classList.add(\"fade-in-childs--manual\", \"fade-in--manual\");\n gsap.set(currentEl, { opacity: 1, zIndex: 1, position: \"relative\" });\n // gsap.set(this.tabsWrapperTarget, { height: currentEl.offsetHeight });\n }\n\n disconnect() { }\n\n onClick(event) {\n const newSlug = event.currentTarget.dataset.simpleFiltersIndex;\n\n if (newSlug != this.currentSlug) {\n const currentEl = this.tabsWrapperTarget.querySelector(\n '[data-simple-filters-index=\"' + this.currentSlug + '\"]',\n );\n if (currentEl) {\n gsap.to(currentEl, { duration: 0.35, opacity: 0, zIndex: -1, position: \"absolute\" });\n this.buttonsWrapperTarget\n .querySelector('[data-simple-filters-index=\"' + this.currentSlug + '\"]')\n .classList.remove(\"current-tab\");\n currentEl.classList.remove(\"fade-in-childs--manual\", \"fade-in--manual\");\n }\n\n if (history.pushState) {\n history.pushState(null, null, \"#\" + newSlug);\n }\n\n this.buttonsWrapperTarget\n .querySelector('[data-simple-filters-index=\"' + newSlug + '\"]')\n .classList.add(\"current-tab\");\n const newEl = this.tabsWrapperTarget.querySelector('[data-simple-filters-index=\"' + newSlug + '\"]');\n gsap.delayedCall(0.1, () => {\n newEl.classList.add(\"fade-in-childs--manual\", \"fade-in--manual\");\n });\n gsap.to(newEl, { delay: 0.25, duration: 0.35, opacity: 1, zIndex: 1, position: \"relative\" });\n this.currentSlug = newSlug;\n console.log(newEl.offsetHeight)\n gsap.to(this.tabsWrapperTarget, { duration: 0.35, height: newEl.offsetHeight }).then(() => {\n gsap.set(this.tabsWrapperTarget, { height: null });\n // gsap.to(this.tabsWrapperTarget, { duration: 0.35, height: newEl.offsetHeight }).then(() => {\n // gsap.set(this.tabsWrapperTarget, { height: null });\n // });\n });\n }\n }\n}\n","const SCOPE = Symbol(0);\nlet scheduledEffects = false, runningEffects = false, currentScope = null, currentObserver = null, currentObservers = null, currentObserversIndex = 0, effects = [], defaultContext = {};\nconst NOOP = () => {\n}, STATE_CLEAN = 0, STATE_CHECK = 1, STATE_DIRTY = 2, STATE_DISPOSED = 3;\nfunction flushEffects() {\n scheduledEffects = true;\n queueMicrotask(runEffects);\n}\nfunction runEffects() {\n if (!effects.length) {\n scheduledEffects = false;\n return;\n }\n runningEffects = true;\n for (let i = 0; i < effects.length; i++) {\n if (effects[i].$st !== STATE_CLEAN)\n runTop(effects[i]);\n }\n effects = [];\n scheduledEffects = false;\n runningEffects = false;\n}\nfunction runTop(node) {\n let ancestors = [node];\n while (node = node[SCOPE]) {\n if (node.$e && node.$st !== STATE_CLEAN)\n ancestors.push(node);\n }\n for (let i = ancestors.length - 1; i >= 0; i--) {\n updateCheck(ancestors[i]);\n }\n}\nfunction root(init) {\n const scope = createScope();\n return compute(scope, !init.length ? init : init.bind(null, dispose.bind(scope)), null);\n}\nfunction peek(fn) {\n return compute(currentScope, fn, null);\n}\nfunction untrack(fn) {\n return compute(null, fn, null);\n}\nfunction tick() {\n if (!runningEffects)\n runEffects();\n}\nfunction getScope() {\n return currentScope;\n}\nfunction scoped(run, scope) {\n try {\n return compute(scope, run, null);\n } catch (error) {\n handleError(scope, error);\n return;\n }\n}\nfunction getContext(key, scope = currentScope) {\n return scope?.$cx[key];\n}\nfunction setContext(key, value, scope = currentScope) {\n if (scope)\n scope.$cx = { ...scope.$cx, [key]: value };\n}\nfunction onDispose(disposable) {\n if (!disposable || !currentScope)\n return disposable || NOOP;\n const node = currentScope;\n if (!node.$d) {\n node.$d = disposable;\n } else if (Array.isArray(node.$d)) {\n node.$d.push(disposable);\n } else {\n node.$d = [node.$d, disposable];\n }\n return function removeDispose() {\n if (node.$st === STATE_DISPOSED)\n return;\n disposable.call(null);\n if (isFunction$1(node.$d)) {\n node.$d = null;\n } else if (Array.isArray(node.$d)) {\n node.$d.splice(node.$d.indexOf(disposable), 1);\n }\n };\n}\nfunction dispose(self = true) {\n if (this.$st === STATE_DISPOSED)\n return;\n if (this.$h) {\n if (Array.isArray(this.$h)) {\n for (let i = this.$h.length - 1; i >= 0; i--) {\n dispose.call(this.$h[i]);\n }\n } else {\n dispose.call(this.$h);\n }\n }\n if (self) {\n const parent = this[SCOPE];\n if (parent) {\n if (Array.isArray(parent.$h)) {\n parent.$h.splice(parent.$h.indexOf(this), 1);\n } else {\n parent.$h = null;\n }\n }\n disposeNode(this);\n }\n}\nfunction disposeNode(node) {\n node.$st = STATE_DISPOSED;\n if (node.$d)\n emptyDisposal(node);\n if (node.$s)\n removeSourceObservers(node, 0);\n node[SCOPE] = null;\n node.$s = null;\n node.$o = null;\n node.$h = null;\n node.$cx = defaultContext;\n node.$eh = null;\n}\nfunction emptyDisposal(scope) {\n try {\n if (Array.isArray(scope.$d)) {\n for (let i = scope.$d.length - 1; i >= 0; i--) {\n const callable = scope.$d[i];\n callable.call(callable);\n }\n } else {\n scope.$d.call(scope.$d);\n }\n scope.$d = null;\n } catch (error) {\n handleError(scope, error);\n }\n}\nfunction compute(scope, compute2, observer) {\n const prevScope = currentScope, prevObserver = currentObserver;\n currentScope = scope;\n currentObserver = observer;\n try {\n return compute2.call(scope);\n } finally {\n currentScope = prevScope;\n currentObserver = prevObserver;\n }\n}\nfunction handleError(scope, error) {\n if (!scope || !scope.$eh)\n throw error;\n let i = 0, len = scope.$eh.length, currentError = error;\n for (i = 0; i < len; i++) {\n try {\n scope.$eh[i](currentError);\n break;\n } catch (error2) {\n currentError = error2;\n }\n }\n if (i === len)\n throw currentError;\n}\nfunction read() {\n if (this.$st === STATE_DISPOSED)\n return this.$v;\n if (currentObserver && !this.$e) {\n if (!currentObservers && currentObserver.$s && currentObserver.$s[currentObserversIndex] == this) {\n currentObserversIndex++;\n } else if (!currentObservers)\n currentObservers = [this];\n else\n currentObservers.push(this);\n }\n if (this.$c)\n updateCheck(this);\n return this.$v;\n}\nfunction write(newValue) {\n const value = isFunction$1(newValue) ? newValue(this.$v) : newValue;\n if (this.$ch(this.$v, value)) {\n this.$v = value;\n if (this.$o) {\n for (let i = 0; i < this.$o.length; i++) {\n notify(this.$o[i], STATE_DIRTY);\n }\n }\n }\n return this.$v;\n}\nconst ScopeNode = function Scope() {\n this[SCOPE] = null;\n this.$h = null;\n if (currentScope)\n currentScope.append(this);\n};\nconst ScopeProto = ScopeNode.prototype;\nScopeProto.$cx = defaultContext;\nScopeProto.$eh = null;\nScopeProto.$c = null;\nScopeProto.$d = null;\nScopeProto.append = function(child) {\n child[SCOPE] = this;\n if (!this.$h) {\n this.$h = child;\n } else if (Array.isArray(this.$h)) {\n this.$h.push(child);\n } else {\n this.$h = [this.$h, child];\n }\n child.$cx = child.$cx === defaultContext ? this.$cx : { ...this.$cx, ...child.$cx };\n if (this.$eh) {\n child.$eh = !child.$eh ? this.$eh : [...child.$eh, ...this.$eh];\n }\n};\nScopeProto.dispose = function() {\n dispose.call(this);\n};\nfunction createScope() {\n return new ScopeNode();\n}\nconst ComputeNode = function Computation(initialValue, compute2, options) {\n ScopeNode.call(this);\n this.$st = compute2 ? STATE_DIRTY : STATE_CLEAN;\n this.$i = false;\n this.$e = false;\n this.$s = null;\n this.$o = null;\n this.$v = initialValue;\n if (compute2)\n this.$c = compute2;\n if (options && options.dirty)\n this.$ch = options.dirty;\n};\nconst ComputeProto = ComputeNode.prototype;\nObject.setPrototypeOf(ComputeProto, ScopeProto);\nComputeProto.$ch = isNotEqual;\nComputeProto.call = read;\nfunction createComputation(initialValue, compute2, options) {\n return new ComputeNode(initialValue, compute2, options);\n}\nfunction isNotEqual(a, b) {\n return a !== b;\n}\nfunction isFunction$1(value) {\n return typeof value === \"function\";\n}\nfunction updateCheck(node) {\n if (node.$st === STATE_CHECK) {\n for (let i = 0; i < node.$s.length; i++) {\n updateCheck(node.$s[i]);\n if (node.$st === STATE_DIRTY) {\n break;\n }\n }\n }\n if (node.$st === STATE_DIRTY)\n update(node);\n else\n node.$st = STATE_CLEAN;\n}\nfunction cleanup(node) {\n if (node.$h)\n dispose.call(node, false);\n if (node.$d)\n emptyDisposal(node);\n node.$eh = node[SCOPE] ? node[SCOPE].$eh : null;\n}\nfunction update(node) {\n let prevObservers = currentObservers, prevObserversIndex = currentObserversIndex;\n currentObservers = null;\n currentObserversIndex = 0;\n try {\n cleanup(node);\n const result = compute(node, node.$c, node);\n updateObservers(node);\n if (!node.$e && node.$i) {\n write.call(node, result);\n } else {\n node.$v = result;\n node.$i = true;\n }\n } catch (error) {\n updateObservers(node);\n handleError(node, error);\n } finally {\n currentObservers = prevObservers;\n currentObserversIndex = prevObserversIndex;\n node.$st = STATE_CLEAN;\n }\n}\nfunction updateObservers(node) {\n if (currentObservers) {\n if (node.$s)\n removeSourceObservers(node, currentObserversIndex);\n if (node.$s && currentObserversIndex > 0) {\n node.$s.length = currentObserversIndex + currentObservers.length;\n for (let i = 0; i < currentObservers.length; i++) {\n node.$s[currentObserversIndex + i] = currentObservers[i];\n }\n } else {\n node.$s = currentObservers;\n }\n let source;\n for (let i = currentObserversIndex; i < node.$s.length; i++) {\n source = node.$s[i];\n if (!source.$o)\n source.$o = [node];\n else\n source.$o.push(node);\n }\n } else if (node.$s && currentObserversIndex < node.$s.length) {\n removeSourceObservers(node, currentObserversIndex);\n node.$s.length = currentObserversIndex;\n }\n}\nfunction notify(node, state) {\n if (node.$st >= state)\n return;\n if (node.$e && node.$st === STATE_CLEAN) {\n effects.push(node);\n if (!scheduledEffects)\n flushEffects();\n }\n node.$st = state;\n if (node.$o) {\n for (let i = 0; i < node.$o.length; i++) {\n notify(node.$o[i], STATE_CHECK);\n }\n }\n}\nfunction removeSourceObservers(node, index) {\n let source, swap;\n for (let i = index; i < node.$s.length; i++) {\n source = node.$s[i];\n if (source.$o) {\n swap = source.$o.indexOf(node);\n source.$o[swap] = source.$o[source.$o.length - 1];\n source.$o.pop();\n }\n }\n}\nfunction noop(...args) {\n}\nfunction isNull(value) {\n return value === null;\n}\nfunction isUndefined(value) {\n return typeof value === \"undefined\";\n}\nfunction isNil(value) {\n return isNull(value) || isUndefined(value);\n}\nfunction isObject(value) {\n return value?.constructor === Object;\n}\nfunction isNumber(value) {\n return typeof value === \"number\" && !Number.isNaN(value);\n}\nfunction isString(value) {\n return typeof value === \"string\";\n}\nfunction isBoolean(value) {\n return typeof value === \"boolean\";\n}\nfunction isFunction(value) {\n return typeof value === \"function\";\n}\nfunction isArray(value) {\n return Array.isArray(value);\n}\nconst EVENT = Event, DOM_EVENT = Symbol(\"DOM_EVENT\");\nclass DOMEvent extends EVENT {\n [DOM_EVENT] = true;\n /**\n * The event detail.\n */\n detail;\n /**\n * The event trigger chain.\n */\n triggers = new EventTriggers();\n /**\n * The preceding event that was responsible for this event being fired.\n */\n get trigger() {\n return this.triggers.source;\n }\n /**\n * The origin event that lead to this event being fired.\n */\n get originEvent() {\n return this.triggers.origin;\n }\n /**\n * Whether the origin event was triggered by the user.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted}\n */\n get isOriginTrusted() {\n return this.triggers.origin?.isTrusted ?? false;\n }\n constructor(type, ...init) {\n super(type, init[0]);\n this.detail = init[0]?.detail;\n const trigger = init[0]?.trigger;\n if (trigger) this.triggers.add(trigger);\n }\n}\nclass EventTriggers {\n chain = [];\n get source() {\n return this.chain[0];\n }\n get origin() {\n return this.chain[this.chain.length - 1];\n }\n /**\n * Appends the event to the end of the chain.\n */\n add(event) {\n this.chain.push(event);\n if (isDOMEvent(event)) {\n this.chain.push(...event.triggers);\n }\n }\n /**\n * Removes the event from the chain and returns it (if found).\n */\n remove(event) {\n return this.chain.splice(this.chain.indexOf(event), 1)[0];\n }\n /**\n * Returns whether the chain contains the given `event`.\n */\n has(event) {\n return this.chain.some((e) => e === event);\n }\n /**\n * Returns whether the chain contains the given event type.\n */\n hasType(type) {\n return !!this.findType(type);\n }\n /**\n * Returns the first event with the given `type` found in the chain.\n */\n findType(type) {\n return this.chain.find((e) => e.type === type);\n }\n /**\n * Walks an event chain on a given `event`, and invokes the given `callback` for each trigger event.\n */\n walk(callback) {\n for (const event of this.chain) {\n const returnValue = callback(event);\n if (returnValue) return [event, returnValue];\n }\n }\n [Symbol.iterator]() {\n return this.chain.values();\n }\n}\nfunction isDOMEvent(event) {\n return !!event?.[DOM_EVENT];\n}\nfunction walkTriggerEventChain(event, callback) {\n if (!isDOMEvent(event)) return;\n return event.triggers.walk(callback);\n}\nfunction findTriggerEvent(event, type) {\n return isDOMEvent(event) ? event.triggers.findType(type) : void 0;\n}\nfunction hasTriggerEvent(event, type) {\n return !!findTriggerEvent(event, type);\n}\nfunction appendTriggerEvent(event, trigger) {\n if (trigger) event.triggers.add(trigger);\n}\nclass EventsTarget extends EventTarget {\n /** @internal type only */\n $ts__events;\n addEventListener(type, callback, options) {\n return super.addEventListener(type, callback, options);\n }\n removeEventListener(type, callback, options) {\n return super.removeEventListener(type, callback, options);\n }\n}\nfunction listenEvent(target, type, handler, options) {\n target.addEventListener(type, handler, options);\n return onDispose(() => target.removeEventListener(type, handler, options));\n}\nclass EventsController {\n #target;\n #controller;\n get signal() {\n return this.#controller.signal;\n }\n constructor(target) {\n this.#target = target;\n this.#controller = new AbortController();\n onDispose(this.abort.bind(this));\n }\n add(type, handler, options) {\n if (this.signal.aborted) throw Error(\"aborted\");\n this.#target.addEventListener(type, handler, {\n ...options,\n signal: options?.signal ? anySignal(this.signal, options.signal) : this.signal\n });\n return this;\n }\n remove(type, handler) {\n this.#target.removeEventListener(type, handler);\n return this;\n }\n abort(reason) {\n this.#controller.abort(reason);\n }\n}\nfunction anySignal(...signals) {\n const controller = new AbortController(), options = { signal: controller.signal };\n function onAbort(event) {\n controller.abort(event.target.reason);\n }\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n break;\n }\n signal.addEventListener(\"abort\", onAbort, options);\n }\n return controller.signal;\n}\nfunction isPointerEvent(event) {\n return !!event?.type.startsWith(\"pointer\");\n}\nfunction isTouchEvent(event) {\n return !!event?.type.startsWith(\"touch\");\n}\nfunction isMouseEvent(event) {\n return /^(click|mouse)/.test(event?.type ?? \"\");\n}\nfunction isKeyboardEvent(event) {\n return !!event?.type.startsWith(\"key\");\n}\nfunction wasEnterKeyPressed(event) {\n return isKeyboardEvent(event) && event.key === \"Enter\";\n}\nfunction isKeyboardClick(event) {\n return isKeyboardEvent(event) && (event.key === \"Enter\" || event.key === \" \");\n}\nfunction isDOMNode(node) {\n return node instanceof Node;\n}\nfunction setAttribute(host, name, value) {\n if (!host) return;\n else if (!value && value !== \"\" && value !== 0) {\n host.removeAttribute(name);\n } else {\n const attrValue = value === true ? \"\" : value + \"\";\n if (host.getAttribute(name) !== attrValue) {\n host.setAttribute(name, attrValue);\n }\n }\n}\nfunction setStyle(host, property, value) {\n if (!host) return;\n else if (!value && value !== 0) {\n host.style.removeProperty(property);\n } else {\n host.style.setProperty(property, value + \"\");\n }\n}\nfunction toggleClass(host, name, value) {\n host.classList[value ? \"add\" : \"remove\"](name);\n}\n\nfunction signal(initialValue, options) {\n const node = createComputation(initialValue, null, options), signal2 = read.bind(node);\n signal2[SCOPE] = true;\n signal2.set = write.bind(node);\n return signal2;\n}\nfunction isReadSignal(fn) {\n return isFunction$1(fn) && SCOPE in fn;\n}\nfunction computed(compute, options) {\n const node = createComputation(\n options?.initial,\n compute,\n options\n ), signal2 = read.bind(node);\n signal2[SCOPE] = true;\n return signal2;\n}\nfunction effect$1(effect2, options) {\n const signal2 = createComputation(\n null,\n function runEffect() {\n let effectResult = effect2();\n isFunction$1(effectResult) && onDispose(effectResult);\n return null;\n },\n void 0\n );\n signal2.$e = true;\n update(signal2);\n return dispose.bind(signal2, true);\n}\nfunction isWriteSignal(fn) {\n return isReadSignal(fn) && \"set\" in fn;\n}\nconst effect = effect$1;\nfunction createContext(provide) {\n return { id: Symbol(), provide };\n}\nfunction provideContext(context, value, scope = getScope()) {\n const hasProvidedValue = !isUndefined(value);\n setContext(context.id, hasProvidedValue ? value : context.provide?.(), scope);\n}\nfunction useContext(context) {\n const value = getContext(context.id);\n return value;\n}\nfunction hasProvidedContext(context) {\n return !isUndefined(getContext(context.id));\n}\nconst PROPS = /* @__PURE__ */ Symbol(0);\nconst METHODS = /* @__PURE__ */ Symbol(0);\nconst ON_DISPATCH = /* @__PURE__ */ Symbol(0);\nconst EMPTY_PROPS = {};\nclass Instance {\n /** @internal type only */\n $ts__events;\n /** @internal type only */\n $ts__vars;\n /* @internal */\n [ON_DISPATCH] = null;\n $el = signal(null);\n el = null;\n scope = null;\n attachScope = null;\n connectScope = null;\n component = null;\n destroyed = false;\n props = EMPTY_PROPS;\n attrs = null;\n styles = null;\n state;\n $state;\n #setupCallbacks = [];\n #attachCallbacks = [];\n #connectCallbacks = [];\n #destroyCallbacks = [];\n constructor(Component, scope, init) {\n this.scope = scope;\n if (init?.scope) init.scope.append(scope);\n let stateFactory = Component.state, props = Component.props;\n if (stateFactory) {\n this.$state = stateFactory.create();\n this.state = new Proxy(this.$state, {\n get: (_, prop) => this.$state[prop]()\n });\n provideContext(stateFactory, this.$state);\n }\n if (props) {\n this.props = createInstanceProps(props);\n if (init?.props) {\n for (const prop of Object.keys(init.props)) {\n this.props[prop]?.set(init.props[prop]);\n }\n }\n }\n onDispose(this.destroy.bind(this));\n }\n setup() {\n scoped(() => {\n for (const callback of this.#setupCallbacks) callback();\n }, this.scope);\n }\n attach(el) {\n if (this.el) return;\n this.el = el;\n this.$el.set(el);\n scoped(() => {\n this.attachScope = createScope();\n scoped(() => {\n for (const callback of this.#attachCallbacks) callback(this.el);\n this.#attachAttrs();\n this.#attachStyles();\n }, this.attachScope);\n }, this.scope);\n el.dispatchEvent(new Event(\"attached\"));\n }\n detach() {\n this.attachScope?.dispose();\n this.attachScope = null;\n this.connectScope = null;\n this.el = null;\n this.$el.set(null);\n }\n connect() {\n if (!this.el || !this.attachScope || !this.#connectCallbacks.length) return;\n scoped(() => {\n this.connectScope = createScope();\n scoped(() => {\n for (const callback of this.#connectCallbacks) callback(this.el);\n }, this.connectScope);\n }, this.attachScope);\n }\n disconnect() {\n this.connectScope?.dispose();\n this.connectScope = null;\n }\n destroy() {\n if (this.destroyed) return;\n this.destroyed = true;\n scoped(() => {\n for (const callback of this.#destroyCallbacks) callback(this.el);\n }, this.scope);\n const el = this.el;\n this.detach();\n this.scope.dispose();\n this.#setupCallbacks.length = 0;\n this.#attachCallbacks.length = 0;\n this.#connectCallbacks.length = 0;\n this.#destroyCallbacks.length = 0;\n this.component = null;\n this.attrs = null;\n this.styles = null;\n this.props = EMPTY_PROPS;\n this.scope = null;\n this.state = EMPTY_PROPS;\n this.$state = null;\n if (el) delete el.$;\n }\n addHooks(target) {\n if (target.onSetup) this.#setupCallbacks.push(target.onSetup.bind(target));\n if (target.onAttach) this.#attachCallbacks.push(target.onAttach.bind(target));\n if (target.onConnect) this.#connectCallbacks.push(target.onConnect.bind(target));\n if (target.onDestroy) this.#destroyCallbacks.push(target.onDestroy.bind(target));\n }\n #attachAttrs() {\n if (!this.attrs) return;\n for (const name of Object.keys(this.attrs)) {\n if (isFunction(this.attrs[name])) {\n effect(this.#setAttr.bind(this, name));\n } else {\n setAttribute(this.el, name, this.attrs[name]);\n }\n }\n }\n #attachStyles() {\n if (!this.styles) return;\n for (const name of Object.keys(this.styles)) {\n if (isFunction(this.styles[name])) {\n effect(this.#setStyle.bind(this, name));\n } else {\n setStyle(this.el, name, this.styles[name]);\n }\n }\n }\n #setAttr(name) {\n setAttribute(this.el, name, this.attrs[name].call(this.component));\n }\n #setStyle(name) {\n setStyle(this.el, name, this.styles[name].call(this.component));\n }\n}\nfunction createInstanceProps(props) {\n const $props = {};\n for (const name of Object.keys(props)) {\n const def = props[name];\n $props[name] = signal(def, def);\n }\n return $props;\n}\nlet currentInstance = { $$: null };\nfunction createComponent(Component, init) {\n return root(() => {\n currentInstance.$$ = new Instance(Component, getScope(), init);\n const component = new Component();\n currentInstance.$$.component = component;\n currentInstance.$$ = null;\n return component;\n });\n}\nclass ViewController extends EventTarget {\n /** @internal */\n $$;\n get el() {\n return this.$$.el;\n }\n get $el() {\n return this.$$.$el();\n }\n get scope() {\n return this.$$.scope;\n }\n get attachScope() {\n return this.$$.attachScope;\n }\n get connectScope() {\n return this.$$.connectScope;\n }\n /** @internal */\n get $props() {\n return this.$$.props;\n }\n /** @internal */\n get $state() {\n return this.$$.$state;\n }\n get state() {\n return this.$$.state;\n }\n constructor() {\n super();\n if (currentInstance.$$) this.attach(currentInstance);\n }\n attach({ $$ }) {\n this.$$ = $$;\n $$.addHooks(this);\n return this;\n }\n addEventListener(type, callback, options) {\n this.listen(type, callback, options);\n }\n removeEventListener(type, callback, options) {\n this.el?.removeEventListener(type, callback, options);\n }\n /**\n * The given callback is invoked when the component is ready to be set up.\n *\n * - This hook will run once.\n * - This hook is called both client-side and server-side.\n * - It's safe to use context inside this hook.\n * - The host element has not attached yet - wait for `onAttach`.\n */\n /**\n * This method can be used to specify attributes that should be set on the host element. Any\n * attributes that are assigned to a function will be considered a signal and updated accordingly.\n */\n setAttributes(attributes) {\n if (!this.$$.attrs) this.$$.attrs = {};\n Object.assign(this.$$.attrs, attributes);\n }\n /**\n * This method can be used to specify styles that should set be set on the host element. Any\n * styles that are assigned to a function will be considered a signal and updated accordingly.\n */\n setStyles(styles) {\n if (!this.$$.styles) this.$$.styles = {};\n Object.assign(this.$$.styles, styles);\n }\n /**\n * This method is used to satisfy the CSS variables contract specified on the current\n * component. Other CSS variables can be set via the `setStyles` method.\n */\n setCSSVars(vars) {\n this.setStyles(vars);\n }\n /**\n * Type-safe utility for creating component DOM events.\n */\n createEvent(type, ...init) {\n return new DOMEvent(type, init[0]);\n }\n /**\n * Creates a `DOMEvent` and dispatches it from the host element. This method is typed to\n * match all component events.\n */\n dispatch(type, ...init) {\n if (!this.el) return false;\n const event = type instanceof Event ? type : new DOMEvent(type, init[0]);\n Object.defineProperty(event, \"target\", {\n get: () => this.$$.component\n });\n return untrack(() => {\n this.$$[ON_DISPATCH]?.(event);\n return this.el.dispatchEvent(event);\n });\n }\n dispatchEvent(event) {\n return this.dispatch(event);\n }\n /**\n * Adds an event listener for the given `type` and returns a function which can be invoked to\n * remove the event listener.\n *\n * - The listener is removed if the current scope is disposed.\n * - This method is safe to use on the server (noop).\n */\n listen(type, handler, options) {\n if (!this.el) return noop;\n return listenEvent(this.el, type, handler, options);\n }\n}\n\nclass Component extends ViewController {\n subscribe(callback) {\n return scoped(() => effect(() => callback(this.state)), this.$$.scope);\n }\n destroy() {\n this.$$.destroy();\n }\n}\nfunction prop(target, propertyKey, descriptor) {\n if (!target[PROPS]) target[PROPS] = /* @__PURE__ */ new Set();\n target[PROPS].add(propertyKey);\n}\nfunction method(target, propertyKey, descriptor) {\n if (!target[METHODS]) target[METHODS] = /* @__PURE__ */ new Set();\n target[METHODS].add(propertyKey);\n}\nclass State {\n id = Symbol(0);\n record;\n #descriptors;\n constructor(record) {\n this.record = record;\n this.#descriptors = Object.getOwnPropertyDescriptors(record);\n }\n create() {\n const store = {}, state = new Proxy(store, { get: (_, prop2) => store[prop2]() });\n for (const name of Object.keys(this.record)) {\n const getter = this.#descriptors[name].get;\n store[name] = getter ? computed(getter.bind(state)) : signal(this.record[name]);\n }\n return store;\n }\n reset(record, filter) {\n for (const name of Object.keys(record)) {\n if (!this.#descriptors[name].get && (!filter || filter(name))) {\n record[name].set(this.record[name]);\n }\n }\n }\n}\nfunction useState(state) {\n return useContext(state);\n}\n\nfunction runAll(fns, arg) {\n for (const fn of fns) fn(arg);\n}\n\nfunction camelToKebabCase(str) {\n return str.replace(/([a-z])([A-Z])/g, \"$1-$2\").toLowerCase();\n}\nfunction kebabToCamelCase(str) {\n return str.replace(/-./g, (x) => x[1].toUpperCase());\n}\nfunction uppercaseFirstChar(str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nfunction unwrap(fn) {\n return isFunction(fn) ? fn() : fn;\n}\nfunction ariaBool(value) {\n return value ? \"true\" : \"false\";\n}\nfunction createDisposalBin() {\n const disposal = /* @__PURE__ */ new Set();\n return {\n add(...callbacks) {\n for (const callback of callbacks) disposal.add(callback);\n },\n empty() {\n for (const callback of disposal) callback();\n disposal.clear();\n }\n };\n}\nfunction keysOf(obj) {\n return Object.keys(obj);\n}\nfunction deferredPromise() {\n let resolve, reject;\n const promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve, reject };\n}\nfunction waitTimeout(delay) {\n return new Promise((resolve) => setTimeout(resolve, delay));\n}\nfunction animationFrameThrottle(func) {\n let id = -1, lastArgs;\n function throttle(...args) {\n lastArgs = args;\n if (id >= 0) return;\n id = window.requestAnimationFrame(() => {\n func.apply(this, lastArgs);\n id = -1;\n lastArgs = void 0;\n });\n }\n return throttle;\n}\nconst requestIdleCallback = typeof window !== \"undefined\" ? \"requestIdleCallback\" in window ? window.requestIdleCallback : (cb) => window.setTimeout(cb, 1) : noop;\nfunction waitIdlePeriod(callback, options) {\n return new Promise((resolve) => {\n requestIdleCallback((deadline) => {\n callback?.(deadline);\n resolve();\n }, options);\n });\n}\n\nvar key = {\n fullscreenEnabled: 0,\n fullscreenElement: 1,\n requestFullscreen: 2,\n exitFullscreen: 3,\n fullscreenchange: 4,\n fullscreenerror: 5,\n fullscreen: 6\n};\nvar webkit = [\n \"webkitFullscreenEnabled\",\n \"webkitFullscreenElement\",\n \"webkitRequestFullscreen\",\n \"webkitExitFullscreen\",\n \"webkitfullscreenchange\",\n \"webkitfullscreenerror\",\n \"-webkit-full-screen\"\n];\nvar moz = [\n \"mozFullScreenEnabled\",\n \"mozFullScreenElement\",\n \"mozRequestFullScreen\",\n \"mozCancelFullScreen\",\n \"mozfullscreenchange\",\n \"mozfullscreenerror\",\n \"-moz-full-screen\"\n];\nvar ms = [\n \"msFullscreenEnabled\",\n \"msFullscreenElement\",\n \"msRequestFullscreen\",\n \"msExitFullscreen\",\n \"MSFullscreenChange\",\n \"MSFullscreenError\",\n \"-ms-fullscreen\"\n];\nvar document$1 = typeof window !== \"undefined\" && typeof window.document !== \"undefined\" ? window.document : {};\nvar vendor = \"fullscreenEnabled\" in document$1 && Object.keys(key) || webkit[0] in document$1 && webkit || moz[0] in document$1 && moz || ms[0] in document$1 && ms || [];\nvar fscreen = {\n requestFullscreen: function(element) {\n return element[vendor[key.requestFullscreen]]();\n },\n requestFullscreenFunction: function(element) {\n return element[vendor[key.requestFullscreen]];\n },\n get exitFullscreen() {\n return document$1[vendor[key.exitFullscreen]].bind(document$1);\n },\n get fullscreenPseudoClass() {\n return \":\" + vendor[key.fullscreen];\n },\n addEventListener: function(type, handler, options) {\n return document$1.addEventListener(vendor[key[type]], handler, options);\n },\n removeEventListener: function(type, handler, options) {\n return document$1.removeEventListener(vendor[key[type]], handler, options);\n },\n get fullscreenEnabled() {\n return Boolean(document$1[vendor[key.fullscreenEnabled]]);\n },\n set fullscreenEnabled(val) {\n },\n get fullscreenElement() {\n return document$1[vendor[key.fullscreenElement]];\n },\n set fullscreenElement(val) {\n },\n get onfullscreenchange() {\n return document$1[(\"on\" + vendor[key.fullscreenchange]).toLowerCase()];\n },\n set onfullscreenchange(handler) {\n return document$1[(\"on\" + vendor[key.fullscreenchange]).toLowerCase()] = handler;\n },\n get onfullscreenerror() {\n return document$1[(\"on\" + vendor[key.fullscreenerror]).toLowerCase()];\n },\n set onfullscreenerror(handler) {\n return document$1[(\"on\" + vendor[key.fullscreenerror]).toLowerCase()] = handler;\n }\n};\n\nvar functionThrottle = throttle;\n\nfunction throttle(fn, interval, options) {\n var timeoutId = null;\n var throttledFn = null;\n var leading = (options && options.leading);\n var trailing = (options && options.trailing);\n\n if (leading == null) {\n leading = true; // default\n }\n\n if (trailing == null) {\n trailing = !leading; //default\n }\n\n if (leading == true) {\n trailing = false; // forced because there should be invocation per call\n }\n\n var cancel = function() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n var flush = function() {\n var call = throttledFn;\n cancel();\n\n if (call) {\n call();\n }\n };\n\n var throttleWrapper = function() {\n var callNow = leading && !timeoutId;\n var context = this;\n var args = arguments;\n\n throttledFn = function() {\n return fn.apply(context, args);\n };\n\n if (!timeoutId) {\n timeoutId = setTimeout(function() {\n timeoutId = null;\n\n if (trailing) {\n return throttledFn();\n }\n }, interval);\n }\n\n if (callNow) {\n callNow = false;\n return throttledFn();\n }\n };\n\n throttleWrapper.cancel = cancel;\n throttleWrapper.flush = flush;\n\n return throttleWrapper;\n}\n\nvar functionDebounce = debounce;\n\nfunction debounce(fn, wait, callFirst) {\n var timeout = null;\n var debouncedFn = null;\n\n var clear = function() {\n if (timeout) {\n clearTimeout(timeout);\n\n debouncedFn = null;\n timeout = null;\n }\n };\n\n var flush = function() {\n var call = debouncedFn;\n clear();\n\n if (call) {\n call();\n }\n };\n\n var debounceWrapper = function() {\n if (!wait) {\n return fn.apply(this, arguments);\n }\n\n var context = this;\n var args = arguments;\n var callNow = callFirst && !timeout;\n clear();\n\n debouncedFn = function() {\n fn.apply(context, args);\n };\n\n timeout = setTimeout(function() {\n timeout = null;\n\n if (!callNow) {\n var call = debouncedFn;\n debouncedFn = null;\n\n return call();\n }\n }, wait);\n\n if (callNow) {\n return debouncedFn();\n }\n };\n\n debounceWrapper.cancel = clear;\n debounceWrapper.flush = flush;\n\n return debounceWrapper;\n}\n\nconst t = (t2) => \"object\" == typeof t2 && null != t2 && 1 === t2.nodeType, e = (t2, e2) => (!e2 || \"hidden\" !== t2) && (\"visible\" !== t2 && \"clip\" !== t2), n = (t2, n2) => {\n if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {\n const o2 = getComputedStyle(t2, null);\n return e(o2.overflowY, n2) || e(o2.overflowX, n2) || ((t3) => {\n const e2 = ((t4) => {\n if (!t4.ownerDocument || !t4.ownerDocument.defaultView) return null;\n try {\n return t4.ownerDocument.defaultView.frameElement;\n } catch (t5) {\n return null;\n }\n })(t3);\n return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);\n })(t2);\n }\n return false;\n}, o = (t2, e2, n2, o2, l2, r2, i, s) => r2 < t2 && i > e2 || r2 > t2 && i < e2 ? 0 : r2 <= t2 && s <= n2 || i >= e2 && s >= n2 ? r2 - t2 - o2 : i > e2 && s < n2 || r2 < t2 && s > n2 ? i - e2 + l2 : 0, l = (t2) => {\n const e2 = t2.parentElement;\n return null == e2 ? t2.getRootNode().host || null : e2;\n}, r = (e2, r2) => {\n var i, s, d, h;\n if (\"undefined\" == typeof document) return [];\n const { scrollMode: c, block: f, inline: u, boundary: a, skipOverflowHiddenElements: g } = r2, p = \"function\" == typeof a ? a : (t2) => t2 !== a;\n if (!t(e2)) throw new TypeError(\"Invalid target\");\n const m = document.scrollingElement || document.documentElement, w = [];\n let W = e2;\n for (; t(W) && p(W); ) {\n if (W = l(W), W === m) {\n w.push(W);\n break;\n }\n null != W && W === document.body && n(W) && !n(document.documentElement) || null != W && n(W, g) && w.push(W);\n }\n const b = null != (s = null == (i = window.visualViewport) ? void 0 : i.width) ? s : innerWidth, H = null != (h = null == (d = window.visualViewport) ? void 0 : d.height) ? h : innerHeight, { scrollX: y, scrollY: M } = window, { height: v, width: E, top: x, right: C, bottom: I, left: R } = e2.getBoundingClientRect(), { top: T, right: B, bottom: F, left: V } = ((t2) => {\n const e3 = window.getComputedStyle(t2);\n return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 };\n })(e2);\n let k = \"start\" === f || \"nearest\" === f ? x - T : \"end\" === f ? I + F : x + v / 2 - T + F, D = \"center\" === u ? R + E / 2 - V + B : \"end\" === u ? C + B : R - V;\n const L = [];\n for (let t2 = 0; t2 < w.length; t2++) {\n const e3 = w[t2], { height: n2, width: l2, top: r3, right: i2, bottom: s2, left: d2 } = e3.getBoundingClientRect();\n if (\"if-needed\" === c && x >= 0 && R >= 0 && I <= H && C <= b && x >= r3 && I <= s2 && R >= d2 && C <= i2) return L;\n const h2 = getComputedStyle(e3), a2 = parseInt(h2.borderLeftWidth, 10), g2 = parseInt(h2.borderTopWidth, 10), p2 = parseInt(h2.borderRightWidth, 10), W2 = parseInt(h2.borderBottomWidth, 10);\n let T2 = 0, B2 = 0;\n const F2 = \"offsetWidth\" in e3 ? e3.offsetWidth - e3.clientWidth - a2 - p2 : 0, V2 = \"offsetHeight\" in e3 ? e3.offsetHeight - e3.clientHeight - g2 - W2 : 0, S = \"offsetWidth\" in e3 ? 0 === e3.offsetWidth ? 0 : l2 / e3.offsetWidth : 0, X = \"offsetHeight\" in e3 ? 0 === e3.offsetHeight ? 0 : n2 / e3.offsetHeight : 0;\n if (m === e3) T2 = \"start\" === f ? k : \"end\" === f ? k - H : \"nearest\" === f ? o(M, M + H, H, g2, W2, M + k, M + k + v, v) : k - H / 2, B2 = \"start\" === u ? D : \"center\" === u ? D - b / 2 : \"end\" === u ? D - b : o(y, y + b, b, a2, p2, y + D, y + D + E, E), T2 = Math.max(0, T2 + M), B2 = Math.max(0, B2 + y);\n else {\n T2 = \"start\" === f ? k - r3 - g2 : \"end\" === f ? k - s2 + W2 + V2 : \"nearest\" === f ? o(r3, s2, n2, g2, W2 + V2, k, k + v, v) : k - (r3 + n2 / 2) + V2 / 2, B2 = \"start\" === u ? D - d2 - a2 : \"center\" === u ? D - (d2 + l2 / 2) + F2 / 2 : \"end\" === u ? D - i2 + p2 + F2 : o(d2, i2, l2, a2, p2 + F2, D, D + E, E);\n const { scrollLeft: t3, scrollTop: h3 } = e3;\n T2 = 0 === X ? 0 : Math.max(0, Math.min(h3 + T2 / X, e3.scrollHeight - n2 / X + V2)), B2 = 0 === S ? 0 : Math.max(0, Math.min(t3 + B2 / S, e3.scrollWidth - l2 / S + F2)), k += h3 - T2, D += t3 - B2;\n }\n L.push({ el: e3, top: T2, left: B2 });\n }\n return L;\n};\n\nconst STRING = (v) => v === null ? \"\" : v + \"\";\nconst NULLABLE_STRING = (v) => v === null ? null : v + \"\";\nconst NUMBER = (v) => v === null ? 0 : Number(v);\nconst BOOLEAN = (v) => v !== null;\nconst FUNCTION = () => null;\nconst ARRAY = (v) => v === null ? [] : JSON.parse(v);\nconst OBJECT = (v) => v === null ? {} : JSON.parse(v);\nfunction inferAttributeConverter(value) {\n if (value === null) return NULLABLE_STRING;\n switch (typeof value) {\n case \"undefined\":\n return STRING;\n case \"string\":\n return STRING;\n case \"boolean\":\n return BOOLEAN;\n case \"number\":\n return NUMBER;\n case \"function\":\n return FUNCTION;\n case \"object\":\n return isArray(value) ? ARRAY : OBJECT;\n default:\n return STRING;\n }\n}\nconst ATTRS = /* @__PURE__ */ Symbol(0);\nconst SETUP = /* @__PURE__ */ Symbol(0);\nconst SETUP_STATE = /* @__PURE__ */ Symbol(0);\nconst SETUP_CALLBACKS = /* @__PURE__ */ Symbol(0);\nvar SetupState;\n(function(SetupState2) {\n const Idle = 0;\n SetupState2[SetupState2[\"Idle\"] = Idle] = \"Idle\";\n const Pending = 1;\n SetupState2[SetupState2[\"Pending\"] = Pending] = \"Pending\";\n const Ready = 2;\n SetupState2[SetupState2[\"Ready\"] = Ready] = \"Ready\";\n})(SetupState || (SetupState = {}));\nfunction Host(Super, Component) {\n class MaverickElement extends Super {\n static attrs;\n static [ATTRS] = null;\n static get observedAttributes() {\n if (!this[ATTRS] && Component.props) {\n const map = /* @__PURE__ */ new Map();\n for (const propName of Object.keys(Component.props)) {\n let attr = this.attrs?.[propName], attrName = isString(attr) ? attr : !attr ? attr : attr?.attr;\n if (attrName === false) continue;\n if (!attrName) attrName = camelToKebabCase(propName);\n map.set(attrName, {\n prop: propName,\n converter: attr && !isString(attr) && attr?.converter || inferAttributeConverter(Component.props[propName])\n });\n }\n this[ATTRS] = map;\n }\n return this[ATTRS] ? Array.from(this[ATTRS].keys()) : [];\n }\n $;\n [SETUP_STATE] = SetupState.Idle;\n [SETUP_CALLBACKS] = null;\n keepAlive = false;\n forwardKeepAlive = true;\n get scope() {\n return this.$.$$.scope;\n }\n get attachScope() {\n return this.$.$$.attachScope;\n }\n get connectScope() {\n return this.$.$$.connectScope;\n }\n get $props() {\n return this.$.$$.props;\n }\n get $state() {\n return this.$.$$.$state;\n }\n get state() {\n return this.$.state;\n }\n constructor(...args) {\n super(...args);\n this.$ = scoped(() => createComponent(Component), null);\n this.$.$$.addHooks(this);\n if (Component.props) {\n const props = this.$props, descriptors = Object.getOwnPropertyDescriptors(this);\n for (const prop of Object.keys(descriptors)) {\n if (prop in Component.props) {\n props[prop].set(this[prop]);\n delete this[prop];\n }\n }\n }\n }\n attributeChangedCallback(name, _, newValue) {\n const Ctor = this.constructor;\n if (!Ctor[ATTRS]) {\n super.attributeChangedCallback?.(name, _, newValue);\n return;\n }\n const def = Ctor[ATTRS].get(name);\n if (def) this[def.prop] = def.converter(newValue);\n }\n connectedCallback() {\n const instance = this.$?.$$;\n if (!instance || instance.destroyed) return;\n if (this[SETUP_STATE] !== SetupState.Ready) {\n setup.call(this);\n return;\n }\n if (!this.isConnected) return;\n if (this.hasAttribute(\"keep-alive\")) {\n this.keepAlive = true;\n }\n instance.connect();\n if (isArray(this[SETUP_CALLBACKS])) runAll(this[SETUP_CALLBACKS], this);\n this[SETUP_CALLBACKS] = null;\n const callback = super.connectedCallback;\n if (callback) scoped(() => callback.call(this), this.connectScope);\n return;\n }\n disconnectedCallback() {\n const instance = this.$?.$$;\n if (!instance || instance.destroyed) return;\n instance.disconnect();\n const callback = super.disconnectedCallback;\n if (callback) callback.call(this);\n if (!this.keepAlive && !this.hasAttribute(\"keep-alive\")) {\n setTimeout(() => {\n requestAnimationFrame(() => {\n if (!this.isConnected) instance.destroy();\n });\n }, 0);\n }\n }\n [SETUP]() {\n const instance = this.$.$$, Ctor = this.constructor;\n if (instance.destroyed) return;\n const attrs = Ctor[ATTRS];\n if (attrs) {\n for (const attr of this.attributes) {\n let def = attrs.get(attr.name);\n if (def && def.converter) {\n instance.props[def.prop].set(def.converter(this.getAttribute(attr.name)));\n }\n }\n }\n instance.setup();\n instance.attach(this);\n this[SETUP_STATE] = SetupState.Ready;\n this.connectedCallback();\n }\n // @ts-expect-error\n subscribe(callback) {\n return this.$.subscribe(callback);\n }\n destroy() {\n this.disconnectedCallback();\n this.$.destroy();\n }\n }\n extendProto(MaverickElement, Component);\n return MaverickElement;\n}\nfunction extendProto(Element, Component) {\n const ElementProto = Element.prototype, ComponentProto = Component.prototype;\n if (Component.props) {\n for (const prop of Object.keys(Component.props)) {\n Object.defineProperty(ElementProto, prop, {\n enumerable: true,\n configurable: true,\n get() {\n return this.$props[prop]();\n },\n set(value) {\n this.$props[prop].set(value);\n }\n });\n }\n }\n if (ComponentProto[PROPS]) {\n for (const name of ComponentProto[PROPS]) {\n Object.defineProperty(ElementProto, name, {\n enumerable: true,\n configurable: true,\n get() {\n return this.$[name];\n },\n set(value) {\n this.$[name] = value;\n }\n });\n }\n }\n if (ComponentProto[METHODS]) {\n for (const name of ComponentProto[METHODS]) {\n ElementProto[name] = function(...args) {\n return this.$[name](...args);\n };\n }\n }\n}\nfunction setup() {\n if (this[SETUP_STATE] !== SetupState.Idle) return;\n this[SETUP_STATE] = SetupState.Pending;\n const parent = findParent(this), isParentRegistered = parent && window.customElements.get(parent.localName), isParentSetup = parent && parent[SETUP_STATE] === SetupState.Ready;\n if (parent && (!isParentRegistered || !isParentSetup)) {\n waitForParent.call(this, parent);\n return;\n }\n attach.call(this, parent);\n}\nasync function waitForParent(parent) {\n await window.customElements.whenDefined(parent.localName);\n if (parent[SETUP_STATE] !== SetupState.Ready) {\n await new Promise((res) => (parent[SETUP_CALLBACKS] ??= []).push(res));\n }\n attach.call(this, parent);\n}\nfunction attach(parent) {\n if (!this.isConnected) return;\n if (parent) {\n if (parent.keepAlive && parent.forwardKeepAlive) {\n this.keepAlive = true;\n this.setAttribute(\"keep-alive\", \"\");\n }\n const scope = this.$.$$.scope;\n if (scope) parent.$.$$.attachScope.append(scope);\n }\n this[SETUP]();\n}\nfunction findParent(host) {\n let node = host.parentNode, prefix = host.localName.split(\"-\", 1)[0] + \"-\";\n while (node) {\n if (node.nodeType === 1 && node.localName.startsWith(prefix)) {\n return node;\n }\n node = node.parentNode;\n }\n return null;\n}\nfunction defineCustomElement(element, throws = false) {\n if (throws || !window.customElements.get(element.tagName)) {\n window.customElements.define(element.tagName, element);\n }\n}\n\nvar Icon$24 = `
`;\n\nvar Icon$0 = ` `;\n\nvar Icon$5 = ` `;\n\nvar Icon$8 = ``;\n\nvar Icon$11 = ``;\n\nvar Icon$13 = ``;\n\nvar Icon$16 = ` `;\n\nvar Icon$19 = ``;\n\nvar Icon$22 = ``;\n\nvar Icon$26 = ` `;\n\nvar Icon$27 = ``;\n\nvar Icon$31 = ` `;\n\nvar Icon$33 = ` `;\n\nvar Icon$34 = ``;\n\nvar Icon$35 = ``;\n\nvar Icon$39 = ` `;\n\nvar Icon$40 = ` `;\n\nvar Icon$53 = ``;\n\nvar Icon$54 = ` `;\n\nvar Icon$56 = ` `;\n\nvar Icon$59 = ` `;\n\nvar Icon$60 = ` `;\n\nvar Icon$61 = ` `;\n\nvar Icon$62 = ``;\n\nvar Icon$63 = ` `;\n\nvar Icon$74 = ``;\n\nvar Icon$77 = ` `;\n\nvar Icon$81 = ` `;\n\nvar Icon$88 = ``;\n\nvar Icon$104 = ` `;\n\nvar Icon$105 = ` `;\n\nexport { BOOLEAN, Component, DOMEvent, EventsController, EventsTarget, Host, Icon$0, Icon$104, Icon$105, Icon$11, Icon$13, Icon$16, Icon$19, Icon$22, Icon$24, Icon$26, Icon$27, Icon$31, Icon$33, Icon$34, Icon$35, Icon$39, Icon$40, Icon$5, Icon$53, Icon$54, Icon$56, Icon$59, Icon$60, Icon$61, Icon$62, Icon$63, Icon$74, Icon$77, Icon$8, Icon$81, Icon$88, State, ViewController, animationFrameThrottle, appendTriggerEvent, ariaBool, camelToKebabCase, computed, createContext, createDisposalBin, createScope, deferredPromise, defineCustomElement, effect, findTriggerEvent, fscreen, functionDebounce, functionThrottle, getScope, hasProvidedContext, hasTriggerEvent, isArray, isBoolean, isDOMNode, isFunction, isKeyboardClick, isKeyboardEvent, isMouseEvent, isNil, isNull, isNumber, isObject, isPointerEvent, isString, isTouchEvent, isUndefined, isWriteSignal, kebabToCamelCase, keysOf, listenEvent, method, noop, onDispose, peek, prop, provideContext, r, scoped, setAttribute, setStyle, signal, tick, toggleClass, untrack, unwrap, uppercaseFirstChar, useContext, useState, waitIdlePeriod, waitTimeout, walkTriggerEventChain, wasEnterKeyPressed };\n","import { createContext, useContext } from './vidstack-CRlI3Mh7.js';\n\nconst mediaContext = createContext();\nfunction useMediaContext() {\n return useContext(mediaContext);\n}\nfunction useMediaState() {\n return useMediaContext().$state;\n}\n\nexport { mediaContext, useMediaContext, useMediaState };\n","import { isFunction, isUndefined, waitTimeout, isString } from './vidstack-CRlI3Mh7.js';\n\nconst UA = navigator?.userAgent.toLowerCase() || \"\";\nconst IS_IOS = /iphone|ipad|ipod|ios|crios|fxios/i.test(UA);\nconst IS_IPHONE = /(iphone|ipod)/gi.test(navigator?.platform || \"\");\nconst IS_CHROME = !!window.chrome;\nconst IS_SAFARI = !!window.safari || IS_IOS;\nfunction canOrientScreen() {\n return canRotateScreen() && isFunction(screen.orientation.unlock);\n}\nfunction canRotateScreen() {\n return !isUndefined(window.screen.orientation) && !isUndefined(window.screen.orientation.lock);\n}\nfunction canPlayAudioType(audio, type) {\n if (!audio) audio = document.createElement(\"audio\");\n return audio.canPlayType(type).length > 0;\n}\nfunction canPlayVideoType(video, type) {\n if (!video) video = document.createElement(\"video\");\n return video.canPlayType(type).length > 0;\n}\nfunction canPlayHLSNatively(video) {\n if (!video) video = document.createElement(\"video\");\n return video.canPlayType(\"application/vnd.apple.mpegurl\").length > 0;\n}\nfunction canUsePictureInPicture(video) {\n return !!document.pictureInPictureEnabled && !video?.disablePictureInPicture;\n}\nfunction canUseVideoPresentation(video) {\n return isFunction(video?.webkitSupportsPresentationMode) && isFunction(video?.webkitSetPresentationMode);\n}\nasync function canChangeVolume() {\n const video = document.createElement(\"video\");\n video.volume = 0.5;\n await waitTimeout(0);\n return video.volume === 0.5;\n}\nfunction getMediaSource() {\n return window?.ManagedMediaSource ?? window?.MediaSource ?? window?.WebKitMediaSource;\n}\nfunction getSourceBuffer() {\n return window?.SourceBuffer ?? window?.WebKitSourceBuffer;\n}\nfunction isHLSSupported() {\n const MediaSource = getMediaSource();\n if (isUndefined(MediaSource)) return false;\n const isTypeSupported = MediaSource && isFunction(MediaSource.isTypeSupported) && MediaSource.isTypeSupported('video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"');\n const SourceBuffer = getSourceBuffer();\n const isSourceBufferValid = isUndefined(SourceBuffer) || !isUndefined(SourceBuffer.prototype) && isFunction(SourceBuffer.prototype.appendBuffer) && isFunction(SourceBuffer.prototype.remove);\n return !!isTypeSupported && !!isSourceBufferValid;\n}\nfunction isDASHSupported() {\n return isHLSSupported();\n}\n\nconst AUDIO_EXTENSIONS = /\\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\\?)/i;\nconst AUDIO_TYPES = /* @__PURE__ */ new Set([\n \"audio/mpeg\",\n \"audio/ogg\",\n \"audio/3gp\",\n \"audio/mp3\",\n \"audio/webm\",\n \"audio/flac\",\n \"audio/m4a\",\n \"audio/m4b\",\n \"audio/mp4a\",\n \"audio/mp4\"\n]);\nconst VIDEO_EXTENSIONS = /\\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\\d+]+)?($|\\?)/i;\nconst VIDEO_TYPES = /* @__PURE__ */ new Set([\n \"video/mp4\",\n \"video/webm\",\n \"video/3gp\",\n \"video/ogg\",\n \"video/avi\",\n \"video/mpeg\"\n]);\nconst HLS_VIDEO_EXTENSIONS = /\\.(m3u8)($|\\?)/i;\nconst DASH_VIDEO_EXTENSIONS = /\\.(mpd)($|\\?)/i;\nconst HLS_VIDEO_TYPES = /* @__PURE__ */ new Set([\n // Apple sanctioned\n \"application/vnd.apple.mpegurl\",\n // Apple sanctioned for backwards compatibility\n \"audio/mpegurl\",\n // Very common\n \"audio/x-mpegurl\",\n // Very common\n \"application/x-mpegurl\",\n // Included for completeness\n \"video/x-mpegurl\",\n \"video/mpegurl\",\n \"application/mpegurl\"\n]);\nconst DASH_VIDEO_TYPES = /* @__PURE__ */ new Set([\"application/dash+xml\"]);\nfunction isAudioSrc({ src, type }) {\n return isString(src) ? AUDIO_EXTENSIONS.test(src) || AUDIO_TYPES.has(type) || src.startsWith(\"blob:\") && type === \"audio/object\" : type === \"audio/object\";\n}\nfunction isVideoSrc(src) {\n return isString(src.src) ? VIDEO_EXTENSIONS.test(src.src) || VIDEO_TYPES.has(src.type) || src.src.startsWith(\"blob:\") && src.type === \"video/object\" || isHLSSrc(src) && canPlayHLSNatively() : src.type === \"video/object\";\n}\nfunction isHLSSrc({ src, type }) {\n return isString(src) && HLS_VIDEO_EXTENSIONS.test(src) || HLS_VIDEO_TYPES.has(type);\n}\nfunction isDASHSrc({ src, type }) {\n return isString(src) && DASH_VIDEO_EXTENSIONS.test(src) || DASH_VIDEO_TYPES.has(type);\n}\nfunction canGoogleCastSrc(src) {\n return isString(src.src) && (isAudioSrc(src) || isVideoSrc(src) || isHLSSrc(src));\n}\nfunction isMediaStream(src) {\n return typeof window.MediaStream !== \"undefined\" && src instanceof window.MediaStream;\n}\n\nexport { AUDIO_EXTENSIONS, AUDIO_TYPES, DASH_VIDEO_EXTENSIONS, DASH_VIDEO_TYPES, HLS_VIDEO_EXTENSIONS, HLS_VIDEO_TYPES, IS_CHROME, IS_IOS, IS_IPHONE, IS_SAFARI, VIDEO_EXTENSIONS, VIDEO_TYPES, canChangeVolume, canGoogleCastSrc, canOrientScreen, canPlayAudioType, canPlayHLSNatively, canPlayVideoType, canRotateScreen, canUsePictureInPicture, canUseVideoPresentation, isAudioSrc, isDASHSrc, isDASHSupported, isHLSSrc, isHLSSupported, isMediaStream, isVideoSrc };\n","import { isArray, isUndefined } from './vidstack-CRlI3Mh7.js';\n\nclass TimeRange {\n #ranges;\n get length() {\n return this.#ranges.length;\n }\n constructor(start, end) {\n if (isArray(start)) {\n this.#ranges = start;\n } else if (!isUndefined(start) && !isUndefined(end)) {\n this.#ranges = [[start, end]];\n } else {\n this.#ranges = [];\n }\n }\n start(index) {\n return this.#ranges[index][0] ?? Infinity;\n }\n end(index) {\n return this.#ranges[index][1] ?? Infinity;\n }\n}\nfunction getTimeRangesStart(range) {\n if (!range.length) return null;\n let min = range.start(0);\n for (let i = 1; i < range.length; i++) {\n const value = range.start(i);\n if (value < min) min = value;\n }\n return min;\n}\nfunction getTimeRangesEnd(range) {\n if (!range.length) return null;\n let max = range.end(0);\n for (let i = 1; i < range.length; i++) {\n const value = range.end(i);\n if (value > max) max = value;\n }\n return max;\n}\nfunction normalizeTimeIntervals(intervals) {\n if (intervals.length <= 1) {\n return intervals;\n }\n intervals.sort((a, b) => a[0] - b[0]);\n let normalized = [], current = intervals[0];\n for (let i = 1; i < intervals.length; i++) {\n const next = intervals[i];\n if (current[1] >= next[0] - 1) {\n current = [current[0], Math.max(current[1], next[1])];\n } else {\n normalized.push(current);\n current = next;\n }\n }\n normalized.push(current);\n return normalized;\n}\nfunction updateTimeIntervals(intervals, interval, value) {\n let start = interval[0], end = interval[1];\n if (value < start) {\n return [value, -1];\n } else if (value === start) {\n return interval;\n } else if (start === -1) {\n interval[0] = value;\n return interval;\n } else if (value > start) {\n interval[1] = value;\n if (end === -1) intervals.push(interval);\n }\n normalizeTimeIntervals(intervals);\n return interval;\n}\n\nexport { TimeRange, getTimeRangesEnd, getTimeRangesStart, normalizeTimeIntervals, updateTimeIntervals };\n","import { isNull, isBoolean, isString, deferredPromise } from './vidstack-CRlI3Mh7.js';\nimport { isAudioSrc, isVideoSrc } from './vidstack-DwhHIY5e.js';\n\nfunction appendParamsToURL(baseUrl, params) {\n const url = new URL(baseUrl);\n for (const key of Object.keys(params)) {\n url.searchParams.set(key, params[key] + \"\");\n }\n return url.toString();\n}\nfunction preconnect(url, rel = \"preconnect\") {\n const exists = document.querySelector(`link[href=\"${url}\"]`);\n if (!isNull(exists)) return true;\n const link = document.createElement(\"link\");\n link.rel = rel;\n link.href = url;\n link.crossOrigin = \"true\";\n document.head.append(link);\n return true;\n}\nconst pendingRequests = {};\nfunction loadScript(src) {\n if (pendingRequests[src]) return pendingRequests[src].promise;\n const promise = deferredPromise(), exists = document.querySelector(`script[src=\"${src}\"]`);\n if (!isNull(exists)) {\n promise.resolve();\n return promise.promise;\n }\n pendingRequests[src] = promise;\n const script = document.createElement(\"script\");\n script.src = src;\n script.onload = () => {\n promise.resolve();\n delete pendingRequests[src];\n };\n script.onerror = () => {\n promise.reject();\n delete pendingRequests[src];\n };\n setTimeout(() => document.head.append(script), 0);\n return promise.promise;\n}\nfunction getRequestCredentials(crossOrigin) {\n return crossOrigin === \"use-credentials\" ? \"include\" : isString(crossOrigin) ? \"same-origin\" : void 0;\n}\nfunction getDownloadFile({\n title,\n src,\n download\n}) {\n const url = isBoolean(download) || download === \"\" ? src.src : isString(download) ? download : download?.url;\n if (!isValidFileDownload({ url, src, download })) return null;\n return {\n url,\n name: !isBoolean(download) && !isString(download) && download?.filename || title.toLowerCase() || \"media\"\n };\n}\nfunction isValidFileDownload({\n url,\n src,\n download\n}) {\n return isString(url) && (download && download !== true || isAudioSrc(src) || isVideoSrc(src));\n}\n\nexport { appendParamsToURL, getDownloadFile, getRequestCredentials, loadScript, preconnect };\n","import { listenEvent, scoped, getScope, isString } from './vidstack-CRlI3Mh7.js';\n\nfunction findActiveCue(cues, time) {\n for (let i = 0, len = cues.length; i < len; i++) {\n if (isCueActive(cues[i], time)) return cues[i];\n }\n return null;\n}\nfunction isCueActive(cue, time) {\n return time >= cue.startTime && time < cue.endTime;\n}\nfunction watchActiveTextTrack(tracks, kind, onChange) {\n let currentTrack = null, scope = getScope();\n function onModeChange() {\n const kinds = isString(kind) ? [kind] : kind, track = tracks.toArray().find((track2) => kinds.includes(track2.kind) && track2.mode === \"showing\");\n if (track === currentTrack) return;\n if (!track) {\n onChange(null);\n currentTrack = null;\n return;\n }\n if (track.readyState == 2) {\n onChange(track);\n } else {\n onChange(null);\n scoped(() => {\n const off = listenEvent(\n track,\n \"load\",\n () => {\n onChange(track);\n off();\n },\n { once: true }\n );\n }, scope);\n }\n currentTrack = track;\n }\n onModeChange();\n return listenEvent(tracks, \"mode-change\", onModeChange);\n}\nfunction watchCueTextChange(tracks, kind, callback) {\n watchActiveTextTrack(tracks, kind, (track) => {\n if (!track) {\n callback(\"\");\n return;\n }\n const onCueChange = () => {\n const activeCue = track?.activeCues[0];\n callback(activeCue?.text || \"\");\n };\n onCueChange();\n listenEvent(track, \"cue-change\", onCueChange);\n });\n}\n\nexport { findActiveCue, isCueActive, watchActiveTextTrack, watchCueTextChange };\n","import { EventsTarget, DOMEvent, isString, isArray, isNumber } from './vidstack-CRlI3Mh7.js';\nimport { getRequestCredentials } from './vidstack-A9j--j6J.js';\nimport { isCueActive } from './vidstack-lwuXewh7.js';\n\nconst CROSS_ORIGIN = Symbol(0), READY_STATE = Symbol(0), UPDATE_ACTIVE_CUES = Symbol(0), CAN_LOAD = Symbol(0), ON_MODE_CHANGE = Symbol(0), NATIVE = Symbol(0), NATIVE_HLS = Symbol(0);\nconst TextTrackSymbol = {\n crossOrigin: CROSS_ORIGIN,\n readyState: READY_STATE,\n updateActiveCues: UPDATE_ACTIVE_CUES,\n canLoad: CAN_LOAD,\n onModeChange: ON_MODE_CHANGE,\n native: NATIVE,\n nativeHLS: NATIVE_HLS\n};\n\nclass TextTrack extends EventsTarget {\n static createId(track) {\n return `vds-${track.type}-${track.kind}-${track.src ?? track.label ?? \"?\"}`;\n }\n src;\n content;\n type;\n encoding;\n id = \"\";\n label = \"\";\n language = \"\";\n kind;\n default = false;\n #canLoad = false;\n #currentTime = 0;\n #mode = \"disabled\";\n #metadata = {};\n #regions = [];\n #cues = [];\n #activeCues = [];\n /** @internal */\n [TextTrackSymbol.readyState] = 0;\n /** @internal */\n [TextTrackSymbol.crossOrigin];\n /** @internal */\n [TextTrackSymbol.onModeChange] = null;\n /** @internal */\n [TextTrackSymbol.native] = null;\n get metadata() {\n return this.#metadata;\n }\n get regions() {\n return this.#regions;\n }\n get cues() {\n return this.#cues;\n }\n get activeCues() {\n return this.#activeCues;\n }\n /**\n * - 0: Not Loading\n * - 1: Loading\n * - 2: Ready\n * - 3: Error\n */\n get readyState() {\n return this[TextTrackSymbol.readyState];\n }\n get mode() {\n return this.#mode;\n }\n set mode(mode) {\n this.setMode(mode);\n }\n constructor(init) {\n super();\n for (const prop of Object.keys(init)) this[prop] = init[prop];\n if (!this.type) this.type = \"vtt\";\n if (init.content) {\n this.#parseContent(init);\n } else if (!init.src) {\n this[TextTrackSymbol.readyState] = 2;\n }\n }\n addCue(cue, trigger) {\n let i = 0, length = this.#cues.length;\n for (i = 0; i < length; i++) if (cue.endTime <= this.#cues[i].startTime) break;\n if (i === length) this.#cues.push(cue);\n else this.#cues.splice(i, 0, cue);\n if (!(cue instanceof TextTrackCue)) {\n this[TextTrackSymbol.native]?.track.addCue(cue);\n }\n this.dispatchEvent(new DOMEvent(\"add-cue\", { detail: cue, trigger }));\n if (isCueActive(cue, this.#currentTime)) {\n this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);\n }\n }\n removeCue(cue, trigger) {\n const index = this.#cues.indexOf(cue);\n if (index >= 0) {\n const isActive = this.#activeCues.includes(cue);\n this.#cues.splice(index, 1);\n this[TextTrackSymbol.native]?.track.removeCue(cue);\n this.dispatchEvent(new DOMEvent(\"remove-cue\", { detail: cue, trigger }));\n if (isActive) {\n this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);\n }\n }\n }\n setMode(mode, trigger) {\n if (this.#mode === mode) return;\n this.#mode = mode;\n if (mode === \"disabled\") {\n this.#activeCues = [];\n this.#activeCuesChanged();\n } else if (this.readyState === 2) {\n this[TextTrackSymbol.updateActiveCues](this.#currentTime, trigger);\n } else {\n this.#load();\n }\n this.dispatchEvent(new DOMEvent(\"mode-change\", { detail: this, trigger }));\n this[TextTrackSymbol.onModeChange]?.();\n }\n /** @internal */\n [TextTrackSymbol.updateActiveCues](currentTime, trigger) {\n this.#currentTime = currentTime;\n if (this.mode === \"disabled\" || !this.#cues.length) return;\n const activeCues = [];\n for (let i = 0, length = this.#cues.length; i < length; i++) {\n const cue = this.#cues[i];\n if (isCueActive(cue, currentTime)) activeCues.push(cue);\n }\n let changed = activeCues.length !== this.#activeCues.length;\n if (!changed) {\n for (let i = 0; i < activeCues.length; i++) {\n if (!this.#activeCues.includes(activeCues[i])) {\n changed = true;\n break;\n }\n }\n }\n this.#activeCues = activeCues;\n if (changed) this.#activeCuesChanged(trigger);\n }\n /** @internal */\n [TextTrackSymbol.canLoad]() {\n this.#canLoad = true;\n if (this.#mode !== \"disabled\") this.#load();\n }\n #parseContent(init) {\n import('media-captions').then(({ parseText, VTTCue, VTTRegion }) => {\n if (!isString(init.content) || init.type === \"json\") {\n this.#parseJSON(init.content, VTTCue, VTTRegion);\n if (this.readyState !== 3) this.#ready();\n } else {\n parseText(init.content, { type: init.type }).then(({ cues, regions }) => {\n this.#cues = cues;\n this.#regions = regions;\n this.#ready();\n });\n }\n });\n }\n async #load() {\n if (!this.#canLoad || this[TextTrackSymbol.readyState] > 0) return;\n this[TextTrackSymbol.readyState] = 1;\n this.dispatchEvent(new DOMEvent(\"load-start\"));\n if (!this.src) {\n this.#ready();\n return;\n }\n try {\n const { parseResponse, VTTCue, VTTRegion } = await import('media-captions'), crossOrigin = this[TextTrackSymbol.crossOrigin]?.();\n const response = fetch(this.src, {\n headers: this.type === \"json\" ? { \"Content-Type\": \"application/json\" } : void 0,\n credentials: getRequestCredentials(crossOrigin)\n });\n if (this.type === \"json\") {\n this.#parseJSON(await (await response).text(), VTTCue, VTTRegion);\n } else {\n const { errors, metadata, regions, cues } = await parseResponse(response, {\n type: this.type,\n encoding: this.encoding\n });\n if (errors[0]?.code === 0) {\n throw errors[0];\n } else {\n this.#metadata = metadata;\n this.#regions = regions;\n this.#cues = cues;\n }\n }\n this.#ready();\n } catch (error) {\n this.#error(error);\n }\n }\n #ready() {\n this[TextTrackSymbol.readyState] = 2;\n if (!this.src || this.type !== \"vtt\") {\n const native = this[TextTrackSymbol.native];\n if (native && !native.managed) {\n for (const cue of this.#cues) native.track.addCue(cue);\n }\n }\n const loadEvent = new DOMEvent(\"load\");\n this[TextTrackSymbol.updateActiveCues](this.#currentTime, loadEvent);\n this.dispatchEvent(loadEvent);\n }\n #error(error) {\n this[TextTrackSymbol.readyState] = 3;\n this.dispatchEvent(new DOMEvent(\"error\", { detail: error }));\n }\n #parseJSON(json, VTTCue, VTTRegion) {\n try {\n const { regions, cues } = parseJSONCaptionsFile(json, VTTCue, VTTRegion);\n this.#regions = regions;\n this.#cues = cues;\n } catch (error) {\n this.#error(error);\n }\n }\n #activeCuesChanged(trigger) {\n this.dispatchEvent(new DOMEvent(\"cue-change\", { trigger }));\n }\n}\nconst captionRE = /captions|subtitles/;\nfunction isTrackCaptionKind(track) {\n return captionRE.test(track.kind);\n}\nfunction parseJSONCaptionsFile(json, Cue, Region) {\n const content = isString(json) ? JSON.parse(json) : json;\n let regions = [], cues = [];\n if (content.regions && Region) {\n regions = content.regions.map((region) => Object.assign(new Region(), region));\n }\n if (content.cues || isArray(content)) {\n cues = (isArray(content) ? content : content.cues).filter((content2) => isNumber(content2.startTime) && isNumber(content2.endTime)).map((cue) => Object.assign(new Cue(0, 0, \"\"), cue));\n }\n return { regions, cues };\n}\n\nexport { TextTrack, TextTrackSymbol, isTrackCaptionKind, parseJSONCaptionsFile };\n","const ADD = Symbol(0), REMOVE = Symbol(0), RESET = Symbol(0), SELECT = Symbol(0), READONLY = Symbol(0), SET_READONLY = Symbol(0), ON_RESET = Symbol(0), ON_REMOVE = Symbol(0), ON_USER_SELECT = Symbol(0);\nconst ListSymbol = {\n add: ADD,\n remove: REMOVE,\n reset: RESET,\n select: SELECT,\n readonly: READONLY,\n setReadonly: SET_READONLY,\n onReset: ON_RESET,\n onRemove: ON_REMOVE,\n onUserSelect: ON_USER_SELECT\n};\n\nexport { ListSymbol };\n","const SET_AUTO = Symbol(0), ENABLE_AUTO = Symbol(0);\nconst QualitySymbol = {\n setAuto: SET_AUTO,\n enableAuto: ENABLE_AUTO\n};\n\nexport { QualitySymbol };\n","function coerceToError(error) {\n return error instanceof Error ? error : Error(typeof error === \"string\" ? error : JSON.stringify(error));\n}\nfunction assert(condition, message) {\n if (!condition) {\n throw Error(\"Assertion failed.\");\n }\n}\n\nexport { assert, coerceToError };\n","/**\n * Custom positioning reference element.\n * @see https://floating-ui.com/docs/virtual-elements\n */\n\nconst sides = ['top', 'right', 'bottom', 'left'];\nconst alignments = ['start', 'end'];\nconst placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + \"-\" + alignments[0], side + \"-\" + alignments[1]), []);\nconst min = Math.min;\nconst max = Math.max;\nconst round = Math.round;\nconst floor = Math.floor;\nconst createCoords = v => ({\n x: v,\n y: v\n});\nconst oppositeSideMap = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nconst oppositeAlignmentMap = {\n start: 'end',\n end: 'start'\n};\nfunction clamp(start, value, end) {\n return max(start, min(value, end));\n}\nfunction evaluate(value, param) {\n return typeof value === 'function' ? value(param) : value;\n}\nfunction getSide(placement) {\n return placement.split('-')[0];\n}\nfunction getAlignment(placement) {\n return placement.split('-')[1];\n}\nfunction getOppositeAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}\nfunction getAxisLength(axis) {\n return axis === 'y' ? 'height' : 'width';\n}\nfunction getSideAxis(placement) {\n return ['top', 'bottom'].includes(getSide(placement)) ? 'y' : 'x';\n}\nfunction getAlignmentAxis(placement) {\n return getOppositeAxis(getSideAxis(placement));\n}\nfunction getAlignmentSides(placement, rects, rtl) {\n if (rtl === void 0) {\n rtl = false;\n }\n const alignment = getAlignment(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const length = getAxisLength(alignmentAxis);\n let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';\n if (rects.reference[length] > rects.floating[length]) {\n mainAlignmentSide = getOppositePlacement(mainAlignmentSide);\n }\n return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];\n}\nfunction getExpandedPlacements(placement) {\n const oppositePlacement = getOppositePlacement(placement);\n return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];\n}\nfunction getOppositeAlignmentPlacement(placement) {\n return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);\n}\nfunction getSideList(side, isStart, rtl) {\n const lr = ['left', 'right'];\n const rl = ['right', 'left'];\n const tb = ['top', 'bottom'];\n const bt = ['bottom', 'top'];\n switch (side) {\n case 'top':\n case 'bottom':\n if (rtl) return isStart ? rl : lr;\n return isStart ? lr : rl;\n case 'left':\n case 'right':\n return isStart ? tb : bt;\n default:\n return [];\n }\n}\nfunction getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {\n const alignment = getAlignment(placement);\n let list = getSideList(getSide(placement), direction === 'start', rtl);\n if (alignment) {\n list = list.map(side => side + \"-\" + alignment);\n if (flipAlignment) {\n list = list.concat(list.map(getOppositeAlignmentPlacement));\n }\n }\n return list;\n}\nfunction getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);\n}\nfunction expandPaddingObject(padding) {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n ...padding\n };\n}\nfunction getPaddingObject(padding) {\n return typeof padding !== 'number' ? expandPaddingObject(padding) : {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n };\n}\nfunction rectToClientRect(rect) {\n const {\n x,\n y,\n width,\n height\n } = rect;\n return {\n width,\n height,\n top: y,\n left: x,\n right: x + width,\n bottom: y + height,\n x,\n y\n };\n}\n\nexport { alignments, clamp, createCoords, evaluate, expandPaddingObject, floor, getAlignment, getAlignmentAxis, getAlignmentSides, getAxisLength, getExpandedPlacements, getOppositeAlignmentPlacement, getOppositeAxis, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, getSide, getSideAxis, max, min, placements, rectToClientRect, round, sides };\n","import { getSideAxis, getAlignmentAxis, getAxisLength, getSide, getAlignment, evaluate, getPaddingObject, rectToClientRect, min, clamp, placements, getAlignmentSides, getOppositeAlignmentPlacement, getOppositePlacement, getExpandedPlacements, getOppositeAxisPlacements, sides, max, getOppositeAxis } from '@floating-ui/utils';\nexport { rectToClientRect } from '@floating-ui/utils';\n\nfunction computeCoordsFromPlacement(_ref, placement, rtl) {\n let {\n reference,\n floating\n } = _ref;\n const sideAxis = getSideAxis(placement);\n const alignmentAxis = getAlignmentAxis(placement);\n const alignLength = getAxisLength(alignmentAxis);\n const side = getSide(placement);\n const isVertical = sideAxis === 'y';\n const commonX = reference.x + reference.width / 2 - floating.width / 2;\n const commonY = reference.y + reference.height / 2 - floating.height / 2;\n const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;\n let coords;\n switch (side) {\n case 'top':\n coords = {\n x: commonX,\n y: reference.y - floating.height\n };\n break;\n case 'bottom':\n coords = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n case 'right':\n coords = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n case 'left':\n coords = {\n x: reference.x - floating.width,\n y: commonY\n };\n break;\n default:\n coords = {\n x: reference.x,\n y: reference.y\n };\n }\n switch (getAlignment(placement)) {\n case 'start':\n coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n case 'end':\n coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);\n break;\n }\n return coords;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element\n * next to a given reference element.\n *\n * This export does not have any `platform` interface logic. You will need to\n * write one for the platform you are using Floating UI with.\n */\nconst computePosition = async (reference, floating, config) => {\n const {\n placement = 'bottom',\n strategy = 'absolute',\n middleware = [],\n platform\n } = config;\n const validMiddleware = middleware.filter(Boolean);\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));\n let rects = await platform.getElementRects({\n reference,\n floating,\n strategy\n });\n let {\n x,\n y\n } = computeCoordsFromPlacement(rects, placement, rtl);\n let statefulPlacement = placement;\n let middlewareData = {};\n let resetCount = 0;\n for (let i = 0; i < validMiddleware.length; i++) {\n const {\n name,\n fn\n } = validMiddleware[i];\n const {\n x: nextX,\n y: nextY,\n data,\n reset\n } = await fn({\n x,\n y,\n initialPlacement: placement,\n placement: statefulPlacement,\n strategy,\n middlewareData,\n rects,\n platform,\n elements: {\n reference,\n floating\n }\n });\n x = nextX != null ? nextX : x;\n y = nextY != null ? nextY : y;\n middlewareData = {\n ...middlewareData,\n [name]: {\n ...middlewareData[name],\n ...data\n }\n };\n if (reset && resetCount <= 50) {\n resetCount++;\n if (typeof reset === 'object') {\n if (reset.placement) {\n statefulPlacement = reset.placement;\n }\n if (reset.rects) {\n rects = reset.rects === true ? await platform.getElementRects({\n reference,\n floating,\n strategy\n }) : reset.rects;\n }\n ({\n x,\n y\n } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));\n }\n i = -1;\n }\n }\n return {\n x,\n y,\n placement: statefulPlacement,\n strategy,\n middlewareData\n };\n};\n\n/**\n * Resolves with an object of overflow side offsets that determine how much the\n * element is overflowing a given clipping boundary on each side.\n * - positive = overflowing the boundary by that number of pixels\n * - negative = how many pixels left before it will overflow\n * - 0 = lies flush with the boundary\n * @see https://floating-ui.com/docs/detectOverflow\n */\nasync function detectOverflow(state, options) {\n var _await$platform$isEle;\n if (options === void 0) {\n options = {};\n }\n const {\n x,\n y,\n platform,\n rects,\n elements,\n strategy\n } = state;\n const {\n boundary = 'clippingAncestors',\n rootBoundary = 'viewport',\n elementContext = 'floating',\n altBoundary = false,\n padding = 0\n } = evaluate(options, state);\n const paddingObject = getPaddingObject(padding);\n const altContext = elementContext === 'floating' ? 'reference' : 'floating';\n const element = elements[altBoundary ? altContext : elementContext];\n const clippingClientRect = rectToClientRect(await platform.getClippingRect({\n element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),\n boundary,\n rootBoundary,\n strategy\n }));\n const rect = elementContext === 'floating' ? {\n x,\n y,\n width: rects.floating.width,\n height: rects.floating.height\n } : rects.reference;\n const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));\n const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {\n x: 1,\n y: 1\n } : {\n x: 1,\n y: 1\n };\n const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({\n elements,\n rect,\n offsetParent,\n strategy\n }) : rect);\n return {\n top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,\n bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,\n left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,\n right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x\n };\n}\n\n/**\n * Provides data to position an inner element of the floating element so that it\n * appears centered to the reference element.\n * @see https://floating-ui.com/docs/arrow\n */\nconst arrow = options => ({\n name: 'arrow',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n platform,\n elements,\n middlewareData\n } = state;\n // Since `element` is required, we don't Partial<> the type.\n const {\n element,\n padding = 0\n } = evaluate(options, state) || {};\n if (element == null) {\n return {};\n }\n const paddingObject = getPaddingObject(padding);\n const coords = {\n x,\n y\n };\n const axis = getAlignmentAxis(placement);\n const length = getAxisLength(axis);\n const arrowDimensions = await platform.getDimensions(element);\n const isYAxis = axis === 'y';\n const minProp = isYAxis ? 'top' : 'left';\n const maxProp = isYAxis ? 'bottom' : 'right';\n const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';\n const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];\n const startDiff = coords[axis] - rects.reference[axis];\n const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));\n let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;\n\n // DOM platform can return `window` as the `offsetParent`.\n if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {\n clientSize = elements.floating[clientProp] || rects.floating[length];\n }\n const centerToReference = endDiff / 2 - startDiff / 2;\n\n // If the padding is large enough that it causes the arrow to no longer be\n // centered, modify the padding so that it is centered.\n const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;\n const minPadding = min(paddingObject[minProp], largestPossiblePadding);\n const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);\n\n // Make sure the arrow doesn't overflow the floating element if the center\n // point is outside the floating element's bounds.\n const min$1 = minPadding;\n const max = clientSize - arrowDimensions[length] - maxPadding;\n const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;\n const offset = clamp(min$1, center, max);\n\n // If the reference is small enough that the arrow's padding causes it to\n // to point to nothing for an aligned placement, adjust the offset of the\n // floating element itself. To ensure `shift()` continues to take action,\n // a single reset is performed when this is true.\n const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;\n const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;\n return {\n [axis]: coords[axis] + alignmentOffset,\n data: {\n [axis]: offset,\n centerOffset: center - offset - alignmentOffset,\n ...(shouldAddOffset && {\n alignmentOffset\n })\n },\n reset: shouldAddOffset\n };\n }\n});\n\nfunction getPlacementList(alignment, autoAlignment, allowedPlacements) {\n const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => getSide(placement) === placement);\n return allowedPlacementsSortedByAlignment.filter(placement => {\n if (alignment) {\n return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);\n }\n return true;\n });\n}\n/**\n * Optimizes the visibility of the floating element by choosing the placement\n * that has the most space available automatically, without needing to specify a\n * preferred placement. Alternative to `flip`.\n * @see https://floating-ui.com/docs/autoPlacement\n */\nconst autoPlacement = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'autoPlacement',\n options,\n async fn(state) {\n var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;\n const {\n rects,\n middlewareData,\n placement,\n platform,\n elements\n } = state;\n const {\n crossAxis = false,\n alignment,\n allowedPlacements = placements,\n autoAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;\n const currentPlacement = placements$1[currentIndex];\n if (currentPlacement == null) {\n return {};\n }\n const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));\n\n // Make `computeCoords` start from the right place.\n if (placement !== currentPlacement) {\n return {\n reset: {\n placement: placements$1[0]\n }\n };\n }\n const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];\n const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {\n placement: currentPlacement,\n overflows: currentOverflows\n }];\n const nextPlacement = placements$1[currentIndex + 1];\n\n // There are more placements to check.\n if (nextPlacement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n const placementsSortedByMostSpace = allOverflows.map(d => {\n const alignment = getAlignment(d.placement);\n return [d.placement, alignment && crossAxis ?\n // Check along the mainAxis and main crossAxis side.\n d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :\n // Check only the mainAxis.\n d.overflows[0], d.overflows];\n }).sort((a, b) => a[1] - b[1]);\n const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,\n // Aligned placements should not check their opposite crossAxis\n // side.\n getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));\n const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];\n if (resetPlacement !== placement) {\n return {\n data: {\n index: currentIndex + 1,\n overflows: allOverflows\n },\n reset: {\n placement: resetPlacement\n }\n };\n }\n return {};\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by flipping the `placement`\n * in order to keep it in view when the preferred placement(s) will overflow the\n * clipping boundary. Alternative to `autoPlacement`.\n * @see https://floating-ui.com/docs/flip\n */\nconst flip = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'flip',\n options,\n async fn(state) {\n var _middlewareData$arrow, _middlewareData$flip;\n const {\n placement,\n middlewareData,\n rects,\n initialPlacement,\n platform,\n elements\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true,\n fallbackPlacements: specifiedFallbackPlacements,\n fallbackStrategy = 'bestFit',\n fallbackAxisSideDirection = 'none',\n flipAlignment = true,\n ...detectOverflowOptions\n } = evaluate(options, state);\n\n // If a reset by the arrow was caused due to an alignment offset being\n // added, we should skip any logic now since `flip()` has already done its\n // work.\n // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643\n if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n const side = getSide(placement);\n const initialSideAxis = getSideAxis(initialPlacement);\n const isBasePlacement = getSide(initialPlacement) === initialPlacement;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));\n const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';\n if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {\n fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));\n }\n const placements = [initialPlacement, ...fallbackPlacements];\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const overflows = [];\n let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];\n if (checkMainAxis) {\n overflows.push(overflow[side]);\n }\n if (checkCrossAxis) {\n const sides = getAlignmentSides(placement, rects, rtl);\n overflows.push(overflow[sides[0]], overflow[sides[1]]);\n }\n overflowsData = [...overflowsData, {\n placement,\n overflows\n }];\n\n // One or more sides is overflowing.\n if (!overflows.every(side => side <= 0)) {\n var _middlewareData$flip2, _overflowsData$filter;\n const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;\n const nextPlacement = placements[nextIndex];\n if (nextPlacement) {\n // Try next placement and re-run the lifecycle.\n return {\n data: {\n index: nextIndex,\n overflows: overflowsData\n },\n reset: {\n placement: nextPlacement\n }\n };\n }\n\n // First, find the candidates that fit on the mainAxis side of overflow,\n // then find the placement that fits the best on the main crossAxis side.\n let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;\n\n // Otherwise fallback.\n if (!resetPlacement) {\n switch (fallbackStrategy) {\n case 'bestFit':\n {\n var _overflowsData$filter2;\n const placement = (_overflowsData$filter2 = overflowsData.filter(d => {\n if (hasFallbackAxisSideDirection) {\n const currentSideAxis = getSideAxis(d.placement);\n return currentSideAxis === initialSideAxis ||\n // Create a bias to the `y` side axis due to horizontal\n // reading directions favoring greater width.\n currentSideAxis === 'y';\n }\n return true;\n }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];\n if (placement) {\n resetPlacement = placement;\n }\n break;\n }\n case 'initialPlacement':\n resetPlacement = initialPlacement;\n break;\n }\n }\n if (placement !== resetPlacement) {\n return {\n reset: {\n placement: resetPlacement\n }\n };\n }\n }\n return {};\n }\n };\n};\n\nfunction getSideOffsets(overflow, rect) {\n return {\n top: overflow.top - rect.height,\n right: overflow.right - rect.width,\n bottom: overflow.bottom - rect.height,\n left: overflow.left - rect.width\n };\n}\nfunction isAnySideFullyClipped(overflow) {\n return sides.some(side => overflow[side] >= 0);\n}\n/**\n * Provides data to hide the floating element in applicable situations, such as\n * when it is not in the same clipping context as the reference element.\n * @see https://floating-ui.com/docs/hide\n */\nconst hide = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'hide',\n options,\n async fn(state) {\n const {\n rects\n } = state;\n const {\n strategy = 'referenceHidden',\n ...detectOverflowOptions\n } = evaluate(options, state);\n switch (strategy) {\n case 'referenceHidden':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n elementContext: 'reference'\n });\n const offsets = getSideOffsets(overflow, rects.reference);\n return {\n data: {\n referenceHiddenOffsets: offsets,\n referenceHidden: isAnySideFullyClipped(offsets)\n }\n };\n }\n case 'escaped':\n {\n const overflow = await detectOverflow(state, {\n ...detectOverflowOptions,\n altBoundary: true\n });\n const offsets = getSideOffsets(overflow, rects.floating);\n return {\n data: {\n escapedOffsets: offsets,\n escaped: isAnySideFullyClipped(offsets)\n }\n };\n }\n default:\n {\n return {};\n }\n }\n }\n };\n};\n\nfunction getBoundingRect(rects) {\n const minX = min(...rects.map(rect => rect.left));\n const minY = min(...rects.map(rect => rect.top));\n const maxX = max(...rects.map(rect => rect.right));\n const maxY = max(...rects.map(rect => rect.bottom));\n return {\n x: minX,\n y: minY,\n width: maxX - minX,\n height: maxY - minY\n };\n}\nfunction getRectsByLine(rects) {\n const sortedRects = rects.slice().sort((a, b) => a.y - b.y);\n const groups = [];\n let prevRect = null;\n for (let i = 0; i < sortedRects.length; i++) {\n const rect = sortedRects[i];\n if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {\n groups.push([rect]);\n } else {\n groups[groups.length - 1].push(rect);\n }\n prevRect = rect;\n }\n return groups.map(rect => rectToClientRect(getBoundingRect(rect)));\n}\n/**\n * Provides improved positioning for inline reference elements that can span\n * over multiple lines, such as hyperlinks or range selections.\n * @see https://floating-ui.com/docs/inline\n */\nconst inline = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'inline',\n options,\n async fn(state) {\n const {\n placement,\n elements,\n rects,\n platform,\n strategy\n } = state;\n // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a\n // ClientRect's bounds, despite the event listener being triggered. A\n // padding of 2 seems to handle this issue.\n const {\n padding = 2,\n x,\n y\n } = evaluate(options, state);\n const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);\n const clientRects = getRectsByLine(nativeClientRects);\n const fallback = rectToClientRect(getBoundingRect(nativeClientRects));\n const paddingObject = getPaddingObject(padding);\n function getBoundingClientRect() {\n // There are two rects and they are disjoined.\n if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {\n // Find the first rect in which the point is fully inside.\n return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;\n }\n\n // There are 2 or more connected rects.\n if (clientRects.length >= 2) {\n if (getSideAxis(placement) === 'y') {\n const firstRect = clientRects[0];\n const lastRect = clientRects[clientRects.length - 1];\n const isTop = getSide(placement) === 'top';\n const top = firstRect.top;\n const bottom = lastRect.bottom;\n const left = isTop ? firstRect.left : lastRect.left;\n const right = isTop ? firstRect.right : lastRect.right;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n const isLeftSide = getSide(placement) === 'left';\n const maxRight = max(...clientRects.map(rect => rect.right));\n const minLeft = min(...clientRects.map(rect => rect.left));\n const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);\n const top = measureRects[0].top;\n const bottom = measureRects[measureRects.length - 1].bottom;\n const left = minLeft;\n const right = maxRight;\n const width = right - left;\n const height = bottom - top;\n return {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x: left,\n y: top\n };\n }\n return fallback;\n }\n const resetRects = await platform.getElementRects({\n reference: {\n getBoundingClientRect\n },\n floating: elements.floating,\n strategy\n });\n if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {\n return {\n reset: {\n rects: resetRects\n }\n };\n }\n return {};\n }\n };\n};\n\n// For type backwards-compatibility, the `OffsetOptions` type was also\n// Derivable.\n\nasync function convertValueToCoords(state, options) {\n const {\n placement,\n platform,\n elements\n } = state;\n const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isVertical = getSideAxis(placement) === 'y';\n const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;\n const crossAxisMulti = rtl && isVertical ? -1 : 1;\n const rawValue = evaluate(options, state);\n\n // eslint-disable-next-line prefer-const\n let {\n mainAxis,\n crossAxis,\n alignmentAxis\n } = typeof rawValue === 'number' ? {\n mainAxis: rawValue,\n crossAxis: 0,\n alignmentAxis: null\n } : {\n mainAxis: rawValue.mainAxis || 0,\n crossAxis: rawValue.crossAxis || 0,\n alignmentAxis: rawValue.alignmentAxis\n };\n if (alignment && typeof alignmentAxis === 'number') {\n crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;\n }\n return isVertical ? {\n x: crossAxis * crossAxisMulti,\n y: mainAxis * mainAxisMulti\n } : {\n x: mainAxis * mainAxisMulti,\n y: crossAxis * crossAxisMulti\n };\n}\n\n/**\n * Modifies the placement by translating the floating element along the\n * specified axes.\n * A number (shorthand for `mainAxis` or distance), or an axes configuration\n * object may be passed.\n * @see https://floating-ui.com/docs/offset\n */\nconst offset = function (options) {\n if (options === void 0) {\n options = 0;\n }\n return {\n name: 'offset',\n options,\n async fn(state) {\n var _middlewareData$offse, _middlewareData$arrow;\n const {\n x,\n y,\n placement,\n middlewareData\n } = state;\n const diffCoords = await convertValueToCoords(state, options);\n\n // If the placement is the same and the arrow caused an alignment offset\n // then we don't need to change the positioning coordinates.\n if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {\n return {};\n }\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: {\n ...diffCoords,\n placement\n }\n };\n }\n };\n};\n\n/**\n * Optimizes the visibility of the floating element by shifting it in order to\n * keep it in view when it will overflow the clipping boundary.\n * @see https://floating-ui.com/docs/shift\n */\nconst shift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'shift',\n options,\n async fn(state) {\n const {\n x,\n y,\n placement\n } = state;\n const {\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = false,\n limiter = {\n fn: _ref => {\n let {\n x,\n y\n } = _ref;\n return {\n x,\n y\n };\n }\n },\n ...detectOverflowOptions\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const crossAxis = getSideAxis(getSide(placement));\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n if (checkMainAxis) {\n const minSide = mainAxis === 'y' ? 'top' : 'left';\n const maxSide = mainAxis === 'y' ? 'bottom' : 'right';\n const min = mainAxisCoord + overflow[minSide];\n const max = mainAxisCoord - overflow[maxSide];\n mainAxisCoord = clamp(min, mainAxisCoord, max);\n }\n if (checkCrossAxis) {\n const minSide = crossAxis === 'y' ? 'top' : 'left';\n const maxSide = crossAxis === 'y' ? 'bottom' : 'right';\n const min = crossAxisCoord + overflow[minSide];\n const max = crossAxisCoord - overflow[maxSide];\n crossAxisCoord = clamp(min, crossAxisCoord, max);\n }\n const limitedCoords = limiter.fn({\n ...state,\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n });\n return {\n ...limitedCoords,\n data: {\n x: limitedCoords.x - x,\n y: limitedCoords.y - y,\n enabled: {\n [mainAxis]: checkMainAxis,\n [crossAxis]: checkCrossAxis\n }\n }\n };\n }\n };\n};\n/**\n * Built-in `limiter` that will stop `shift()` at a certain point.\n */\nconst limitShift = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n options,\n fn(state) {\n const {\n x,\n y,\n placement,\n rects,\n middlewareData\n } = state;\n const {\n offset = 0,\n mainAxis: checkMainAxis = true,\n crossAxis: checkCrossAxis = true\n } = evaluate(options, state);\n const coords = {\n x,\n y\n };\n const crossAxis = getSideAxis(placement);\n const mainAxis = getOppositeAxis(crossAxis);\n let mainAxisCoord = coords[mainAxis];\n let crossAxisCoord = coords[crossAxis];\n const rawOffset = evaluate(offset, state);\n const computedOffset = typeof rawOffset === 'number' ? {\n mainAxis: rawOffset,\n crossAxis: 0\n } : {\n mainAxis: 0,\n crossAxis: 0,\n ...rawOffset\n };\n if (checkMainAxis) {\n const len = mainAxis === 'y' ? 'height' : 'width';\n const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;\n const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;\n if (mainAxisCoord < limitMin) {\n mainAxisCoord = limitMin;\n } else if (mainAxisCoord > limitMax) {\n mainAxisCoord = limitMax;\n }\n }\n if (checkCrossAxis) {\n var _middlewareData$offse, _middlewareData$offse2;\n const len = mainAxis === 'y' ? 'width' : 'height';\n const isOriginSide = ['top', 'left'].includes(getSide(placement));\n const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);\n const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);\n if (crossAxisCoord < limitMin) {\n crossAxisCoord = limitMin;\n } else if (crossAxisCoord > limitMax) {\n crossAxisCoord = limitMax;\n }\n }\n return {\n [mainAxis]: mainAxisCoord,\n [crossAxis]: crossAxisCoord\n };\n }\n };\n};\n\n/**\n * Provides data that allows you to change the size of the floating element —\n * for instance, prevent it from overflowing the clipping boundary or match the\n * width of the reference element.\n * @see https://floating-ui.com/docs/size\n */\nconst size = function (options) {\n if (options === void 0) {\n options = {};\n }\n return {\n name: 'size',\n options,\n async fn(state) {\n var _state$middlewareData, _state$middlewareData2;\n const {\n placement,\n rects,\n platform,\n elements\n } = state;\n const {\n apply = () => {},\n ...detectOverflowOptions\n } = evaluate(options, state);\n const overflow = await detectOverflow(state, detectOverflowOptions);\n const side = getSide(placement);\n const alignment = getAlignment(placement);\n const isYAxis = getSideAxis(placement) === 'y';\n const {\n width,\n height\n } = rects.floating;\n let heightSide;\n let widthSide;\n if (side === 'top' || side === 'bottom') {\n heightSide = side;\n widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';\n } else {\n widthSide = side;\n heightSide = alignment === 'end' ? 'top' : 'bottom';\n }\n const maximumClippingHeight = height - overflow.top - overflow.bottom;\n const maximumClippingWidth = width - overflow.left - overflow.right;\n const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);\n const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);\n const noShift = !state.middlewareData.shift;\n let availableHeight = overflowAvailableHeight;\n let availableWidth = overflowAvailableWidth;\n if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {\n availableWidth = maximumClippingWidth;\n }\n if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {\n availableHeight = maximumClippingHeight;\n }\n if (noShift && !alignment) {\n const xMin = max(overflow.left, 0);\n const xMax = max(overflow.right, 0);\n const yMin = max(overflow.top, 0);\n const yMax = max(overflow.bottom, 0);\n if (isYAxis) {\n availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));\n } else {\n availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));\n }\n }\n await apply({\n ...state,\n availableWidth,\n availableHeight\n });\n const nextDimensions = await platform.getDimensions(elements.floating);\n if (width !== nextDimensions.width || height !== nextDimensions.height) {\n return {\n reset: {\n rects: true\n }\n };\n }\n return {};\n }\n };\n};\n\nexport { arrow, autoPlacement, computePosition, detectOverflow, flip, hide, inline, limitShift, offset, shift, size };\n","function hasWindow() {\n return typeof window !== 'undefined';\n}\nfunction getNodeName(node) {\n if (isNode(node)) {\n return (node.nodeName || '').toLowerCase();\n }\n // Mocked nodes in testing environments may not be instances of Node. By\n // returning `#document` an infinite loop won't occur.\n // https://github.com/floating-ui/floating-ui/issues/2317\n return '#document';\n}\nfunction getWindow(node) {\n var _node$ownerDocument;\n return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;\n}\nfunction getDocumentElement(node) {\n var _ref;\n return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;\n}\nfunction isNode(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Node || value instanceof getWindow(value).Node;\n}\nfunction isElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof Element || value instanceof getWindow(value).Element;\n}\nfunction isHTMLElement(value) {\n if (!hasWindow()) {\n return false;\n }\n return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;\n}\nfunction isShadowRoot(value) {\n if (!hasWindow() || typeof ShadowRoot === 'undefined') {\n return false;\n }\n return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;\n}\nfunction isOverflowElement(element) {\n const {\n overflow,\n overflowX,\n overflowY,\n display\n } = getComputedStyle(element);\n return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);\n}\nfunction isTableElement(element) {\n return ['table', 'td', 'th'].includes(getNodeName(element));\n}\nfunction isTopLayer(element) {\n return [':popover-open', ':modal'].some(selector => {\n try {\n return element.matches(selector);\n } catch (e) {\n return false;\n }\n });\n}\nfunction isContainingBlock(elementOrCss) {\n const webkit = isWebKit();\n const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));\n}\nfunction getContainingBlock(element) {\n let currentNode = getParentNode(element);\n while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {\n if (isContainingBlock(currentNode)) {\n return currentNode;\n } else if (isTopLayer(currentNode)) {\n return null;\n }\n currentNode = getParentNode(currentNode);\n }\n return null;\n}\nfunction isWebKit() {\n if (typeof CSS === 'undefined' || !CSS.supports) return false;\n return CSS.supports('-webkit-backdrop-filter', 'none');\n}\nfunction isLastTraversableNode(node) {\n return ['html', 'body', '#document'].includes(getNodeName(node));\n}\nfunction getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}\nfunction getNodeScroll(element) {\n if (isElement(element)) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n }\n return {\n scrollLeft: element.scrollX,\n scrollTop: element.scrollY\n };\n}\nfunction getParentNode(node) {\n if (getNodeName(node) === 'html') {\n return node;\n }\n const result =\n // Step into the shadow DOM of the parent of a slotted node.\n node.assignedSlot ||\n // DOM Element detected.\n node.parentNode ||\n // ShadowRoot detected.\n isShadowRoot(node) && node.host ||\n // Fallback.\n getDocumentElement(node);\n return isShadowRoot(result) ? result.host : result;\n}\nfunction getNearestOverflowAncestor(node) {\n const parentNode = getParentNode(node);\n if (isLastTraversableNode(parentNode)) {\n return node.ownerDocument ? node.ownerDocument.body : node.body;\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode;\n }\n return getNearestOverflowAncestor(parentNode);\n}\nfunction getOverflowAncestors(node, list, traverseIframes) {\n var _node$ownerDocument2;\n if (list === void 0) {\n list = [];\n }\n if (traverseIframes === void 0) {\n traverseIframes = true;\n }\n const scrollableAncestor = getNearestOverflowAncestor(node);\n const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);\n const win = getWindow(scrollableAncestor);\n if (isBody) {\n const frameElement = getFrameElement(win);\n return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);\n }\n return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));\n}\nfunction getFrameElement(win) {\n return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;\n}\n\nexport { getComputedStyle, getContainingBlock, getDocumentElement, getFrameElement, getNearestOverflowAncestor, getNodeName, getNodeScroll, getOverflowAncestors, getParentNode, getWindow, isContainingBlock, isElement, isHTMLElement, isLastTraversableNode, isNode, isOverflowElement, isShadowRoot, isTableElement, isTopLayer, isWebKit };\n","import { rectToClientRect, detectOverflow as detectOverflow$1, offset as offset$1, autoPlacement as autoPlacement$1, shift as shift$1, flip as flip$1, size as size$1, hide as hide$1, arrow as arrow$1, inline as inline$1, limitShift as limitShift$1, computePosition as computePosition$1 } from '@floating-ui/core';\nimport { round, createCoords, max, min, floor } from '@floating-ui/utils';\nimport { getComputedStyle, isHTMLElement, isElement, getWindow, isWebKit, getFrameElement, getNodeScroll, getDocumentElement, isTopLayer, getNodeName, isOverflowElement, getOverflowAncestors, getParentNode, isLastTraversableNode, isContainingBlock, isTableElement, getContainingBlock } from '@floating-ui/utils/dom';\nexport { getOverflowAncestors } from '@floating-ui/utils/dom';\n\nfunction getCssDimensions(element) {\n const css = getComputedStyle(element);\n // In testing environments, the `width` and `height` properties are empty\n // strings for SVG elements, returning NaN. Fallback to `0` in this case.\n let width = parseFloat(css.width) || 0;\n let height = parseFloat(css.height) || 0;\n const hasOffset = isHTMLElement(element);\n const offsetWidth = hasOffset ? element.offsetWidth : width;\n const offsetHeight = hasOffset ? element.offsetHeight : height;\n const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;\n if (shouldFallback) {\n width = offsetWidth;\n height = offsetHeight;\n }\n return {\n width,\n height,\n $: shouldFallback\n };\n}\n\nfunction unwrapElement(element) {\n return !isElement(element) ? element.contextElement : element;\n}\n\nfunction getScale(element) {\n const domElement = unwrapElement(element);\n if (!isHTMLElement(domElement)) {\n return createCoords(1);\n }\n const rect = domElement.getBoundingClientRect();\n const {\n width,\n height,\n $\n } = getCssDimensions(domElement);\n let x = ($ ? round(rect.width) : rect.width) / width;\n let y = ($ ? round(rect.height) : rect.height) / height;\n\n // 0, NaN, or Infinity should always fallback to 1.\n\n if (!x || !Number.isFinite(x)) {\n x = 1;\n }\n if (!y || !Number.isFinite(y)) {\n y = 1;\n }\n return {\n x,\n y\n };\n}\n\nconst noOffsets = /*#__PURE__*/createCoords(0);\nfunction getVisualOffsets(element) {\n const win = getWindow(element);\n if (!isWebKit() || !win.visualViewport) {\n return noOffsets;\n }\n return {\n x: win.visualViewport.offsetLeft,\n y: win.visualViewport.offsetTop\n };\n}\nfunction shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {\n return false;\n }\n return isFixed;\n}\n\nfunction getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n const clientRect = element.getBoundingClientRect();\n const domElement = unwrapElement(element);\n let scale = createCoords(1);\n if (includeScale) {\n if (offsetParent) {\n if (isElement(offsetParent)) {\n scale = getScale(offsetParent);\n }\n } else {\n scale = getScale(element);\n }\n }\n const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);\n let x = (clientRect.left + visualOffsets.x) / scale.x;\n let y = (clientRect.top + visualOffsets.y) / scale.y;\n let width = clientRect.width / scale.x;\n let height = clientRect.height / scale.y;\n if (domElement) {\n const win = getWindow(domElement);\n const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;\n let currentWin = win;\n let currentIFrame = getFrameElement(currentWin);\n while (currentIFrame && offsetParent && offsetWin !== currentWin) {\n const iframeScale = getScale(currentIFrame);\n const iframeRect = currentIFrame.getBoundingClientRect();\n const css = getComputedStyle(currentIFrame);\n const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;\n const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;\n x *= iframeScale.x;\n y *= iframeScale.y;\n width *= iframeScale.x;\n height *= iframeScale.y;\n x += left;\n y += top;\n currentWin = getWindow(currentIFrame);\n currentIFrame = getFrameElement(currentWin);\n }\n }\n return rectToClientRect({\n width,\n height,\n x,\n y\n });\n}\n\n// If has a CSS width greater than the viewport, then this will be\n// incorrect for RTL.\nfunction getWindowScrollBarX(element, rect) {\n const leftScroll = getNodeScroll(element).scrollLeft;\n if (!rect) {\n return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;\n }\n return rect.left + leftScroll;\n}\n\nfunction getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {\n if (ignoreScrollbarX === void 0) {\n ignoreScrollbarX = false;\n }\n const htmlRect = documentElement.getBoundingClientRect();\n const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :\n // RTL scrollbar.\n getWindowScrollBarX(documentElement, htmlRect));\n const y = htmlRect.top + scroll.scrollTop;\n return {\n x,\n y\n };\n}\n\nfunction convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {\n let {\n elements,\n rect,\n offsetParent,\n strategy\n } = _ref;\n const isFixed = strategy === 'fixed';\n const documentElement = getDocumentElement(offsetParent);\n const topLayer = elements ? isTopLayer(elements.floating) : false;\n if (offsetParent === documentElement || topLayer && isFixed) {\n return rect;\n }\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n let scale = createCoords(1);\n const offsets = createCoords(0);\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isHTMLElement(offsetParent)) {\n const offsetRect = getBoundingClientRect(offsetParent);\n scale = getScale(offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);\n return {\n width: rect.width * scale.x,\n height: rect.height * scale.y,\n x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,\n y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y\n };\n}\n\nfunction getClientRects(element) {\n return Array.from(element.getClientRects());\n}\n\n// Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable.\nfunction getDocumentRect(element) {\n const html = getDocumentElement(element);\n const scroll = getNodeScroll(element);\n const body = element.ownerDocument.body;\n const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);\n const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);\n let x = -scroll.scrollLeft + getWindowScrollBarX(element);\n const y = -scroll.scrollTop;\n if (getComputedStyle(body).direction === 'rtl') {\n x += max(html.clientWidth, body.clientWidth) - width;\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\nfunction getViewportRect(element, strategy) {\n const win = getWindow(element);\n const html = getDocumentElement(element);\n const visualViewport = win.visualViewport;\n let width = html.clientWidth;\n let height = html.clientHeight;\n let x = 0;\n let y = 0;\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n const visualViewportBased = isWebKit();\n if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n return {\n width,\n height,\n x,\n y\n };\n}\n\n// Returns the inner client rect, subtracting scrollbars if present.\nfunction getInnerBoundingClientRect(element, strategy) {\n const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');\n const top = clientRect.top + element.clientTop;\n const left = clientRect.left + element.clientLeft;\n const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);\n const width = element.clientWidth * scale.x;\n const height = element.clientHeight * scale.y;\n const x = left * scale.x;\n const y = top * scale.y;\n return {\n width,\n height,\n x,\n y\n };\n}\nfunction getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {\n let rect;\n if (clippingAncestor === 'viewport') {\n rect = getViewportRect(element, strategy);\n } else if (clippingAncestor === 'document') {\n rect = getDocumentRect(getDocumentElement(element));\n } else if (isElement(clippingAncestor)) {\n rect = getInnerBoundingClientRect(clippingAncestor, strategy);\n } else {\n const visualOffsets = getVisualOffsets(element);\n rect = {\n x: clippingAncestor.x - visualOffsets.x,\n y: clippingAncestor.y - visualOffsets.y,\n width: clippingAncestor.width,\n height: clippingAncestor.height\n };\n }\n return rectToClientRect(rect);\n}\nfunction hasFixedPositionAncestor(element, stopNode) {\n const parentNode = getParentNode(element);\n if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {\n return false;\n }\n return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);\n}\n\n// A \"clipping ancestor\" is an `overflow` element with the characteristic of\n// clipping (or hiding) child elements. This returns all clipping ancestors\n// of the given element up the tree.\nfunction getClippingElementAncestors(element, cache) {\n const cachedResult = cache.get(element);\n if (cachedResult) {\n return cachedResult;\n }\n let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');\n let currentContainingBlockComputedStyle = null;\n const elementIsFixed = getComputedStyle(element).position === 'fixed';\n let currentNode = elementIsFixed ? getParentNode(element) : element;\n\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {\n const computedStyle = getComputedStyle(currentNode);\n const currentNodeIsContaining = isContainingBlock(currentNode);\n if (!currentNodeIsContaining && computedStyle.position === 'fixed') {\n currentContainingBlockComputedStyle = null;\n }\n const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);\n if (shouldDropCurrentNode) {\n // Drop non-containing blocks.\n result = result.filter(ancestor => ancestor !== currentNode);\n } else {\n // Record last containing block for next iteration.\n currentContainingBlockComputedStyle = computedStyle;\n }\n currentNode = getParentNode(currentNode);\n }\n cache.set(element, result);\n return result;\n}\n\n// Gets the maximum area that the element is visible in due to any number of\n// clipping ancestors.\nfunction getClippingRect(_ref) {\n let {\n element,\n boundary,\n rootBoundary,\n strategy\n } = _ref;\n const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);\n const clippingAncestors = [...elementClippingAncestors, rootBoundary];\n const firstClippingAncestor = clippingAncestors[0];\n const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {\n const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));\n return {\n width: clippingRect.right - clippingRect.left,\n height: clippingRect.bottom - clippingRect.top,\n x: clippingRect.left,\n y: clippingRect.top\n };\n}\n\nfunction getDimensions(element) {\n const {\n width,\n height\n } = getCssDimensions(element);\n return {\n width,\n height\n };\n}\n\nfunction getRectRelativeToOffsetParent(element, offsetParent, strategy) {\n const isOffsetParentAnElement = isHTMLElement(offsetParent);\n const documentElement = getDocumentElement(offsetParent);\n const isFixed = strategy === 'fixed';\n const rect = getBoundingClientRect(element, true, isFixed, offsetParent);\n let scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n const offsets = createCoords(0);\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n if (isOffsetParentAnElement) {\n const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);\n offsets.x = offsetRect.x + offsetParent.clientLeft;\n offsets.y = offsetRect.y + offsetParent.clientTop;\n } else if (documentElement) {\n // If the scrollbar appears on the left (e.g. RTL systems). Use\n // Firefox with layout.scrollbar.side = 3 in about:config to test this.\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);\n const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;\n const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;\n return {\n x,\n y,\n width: rect.width,\n height: rect.height\n };\n}\n\nfunction isStaticPositioned(element) {\n return getComputedStyle(element).position === 'static';\n}\n\nfunction getTrueOffsetParent(element, polyfill) {\n if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {\n return null;\n }\n if (polyfill) {\n return polyfill(element);\n }\n let rawOffsetParent = element.offsetParent;\n\n // Firefox returns the element as the offsetParent if it's non-static,\n // while Chrome and Safari return the element. The element must\n // be used to perform the correct calculations even if the element is\n // non-static.\n if (getDocumentElement(element) === rawOffsetParent) {\n rawOffsetParent = rawOffsetParent.ownerDocument.body;\n }\n return rawOffsetParent;\n}\n\n// Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\nfunction getOffsetParent(element, polyfill) {\n const win = getWindow(element);\n if (isTopLayer(element)) {\n return win;\n }\n if (!isHTMLElement(element)) {\n let svgOffsetParent = getParentNode(element);\n while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {\n if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {\n return svgOffsetParent;\n }\n svgOffsetParent = getParentNode(svgOffsetParent);\n }\n return win;\n }\n let offsetParent = getTrueOffsetParent(element, polyfill);\n while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {\n offsetParent = getTrueOffsetParent(offsetParent, polyfill);\n }\n if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {\n return win;\n }\n return offsetParent || getContainingBlock(element) || win;\n}\n\nconst getElementRects = async function (data) {\n const getOffsetParentFn = this.getOffsetParent || getOffsetParent;\n const getDimensionsFn = this.getDimensions;\n const floatingDimensions = await getDimensionsFn(data.floating);\n return {\n reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),\n floating: {\n x: 0,\n y: 0,\n width: floatingDimensions.width,\n height: floatingDimensions.height\n }\n };\n};\n\nfunction isRTL(element) {\n return getComputedStyle(element).direction === 'rtl';\n}\n\nconst platform = {\n convertOffsetParentRelativeRectToViewportRelativeRect,\n getDocumentElement,\n getClippingRect,\n getOffsetParent,\n getElementRects,\n getClientRects,\n getDimensions,\n getScale,\n isElement,\n isRTL\n};\n\n// https://samthor.au/2021/observing-dom/\nfunction observeMove(element, onMove) {\n let io = null;\n let timeoutId;\n const root = getDocumentElement(element);\n function cleanup() {\n var _io;\n clearTimeout(timeoutId);\n (_io = io) == null || _io.disconnect();\n io = null;\n }\n function refresh(skip, threshold) {\n if (skip === void 0) {\n skip = false;\n }\n if (threshold === void 0) {\n threshold = 1;\n }\n cleanup();\n const {\n left,\n top,\n width,\n height\n } = element.getBoundingClientRect();\n if (!skip) {\n onMove();\n }\n if (!width || !height) {\n return;\n }\n const insetTop = floor(top);\n const insetRight = floor(root.clientWidth - (left + width));\n const insetBottom = floor(root.clientHeight - (top + height));\n const insetLeft = floor(left);\n const rootMargin = -insetTop + \"px \" + -insetRight + \"px \" + -insetBottom + \"px \" + -insetLeft + \"px\";\n const options = {\n rootMargin,\n threshold: max(0, min(1, threshold)) || 1\n };\n let isFirstUpdate = true;\n function handleObserve(entries) {\n const ratio = entries[0].intersectionRatio;\n if (ratio !== threshold) {\n if (!isFirstUpdate) {\n return refresh();\n }\n if (!ratio) {\n // If the reference is clipped, the ratio is 0. Throttle the refresh\n // to prevent an infinite loop of updates.\n timeoutId = setTimeout(() => {\n refresh(false, 1e-7);\n }, 1000);\n } else {\n refresh(false, ratio);\n }\n }\n isFirstUpdate = false;\n }\n\n // Older browsers don't support a `document` as the root and will throw an\n // error.\n try {\n io = new IntersectionObserver(handleObserve, {\n ...options,\n // Handle