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 _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(\"(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 bodyStyle = _body.style,\n border = bodyStyle.borderTopStyle,\n AnimationProto = gsap.core.Animation.prototype,\n bounds,\n i;\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\"); // TODO: (?) maybe move to leveraging the velocity mechanism in Observer and skip intervals.\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.4\";\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() : (_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 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 return _triggers.sort(func || function (a, b) {\n return (a.vars.refreshPriority || 0) * -1e6 + a.start - (b.start + (b.vars.refreshPriority || 0) * -1e6);\n });\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 };","/*!\n * paths 3.12.4\n * https://gsap.com\n *\n * Copyright 2008-2023, GreenSock. All rights reserved.\n * Subject to the terms at https://gsap.com/standard-license or for\n * Club GSAP members, the agreement issued with that membership.\n * @author: Jack Doyle, jack@greensock.com\n*/\n\n/* eslint-disable */\nvar _svgPathExp = /[achlmqstvz]|(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[0-9]/ig,\n _numbersExp = /(?:(-)?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[0-9]/ig,\n _scientific = /[\\+\\-]?\\d*\\.?\\d+e[\\+\\-]?\\d+/ig,\n _selectorExp = /(^[#\\.][a-z]|[a-y][a-z])/i,\n _DEG2RAD = Math.PI / 180,\n _RAD2DEG = 180 / Math.PI,\n _sin = Math.sin,\n _cos = Math.cos,\n _abs = Math.abs,\n _sqrt = Math.sqrt,\n _atan2 = Math.atan2,\n _largeNum = 1e8,\n _isString = function _isString(value) {\n return typeof value === \"string\";\n},\n _isNumber = function _isNumber(value) {\n return typeof value === \"number\";\n},\n _isUndefined = function _isUndefined(value) {\n return typeof value === \"undefined\";\n},\n _temp = {},\n _temp2 = {},\n _roundingNum = 1e5,\n _wrapProgress = function _wrapProgress(progress) {\n return Math.round((progress + _largeNum) % 1 * _roundingNum) / _roundingNum || (progress < 0 ? 0 : 1);\n},\n //if progress lands on 1, the % will make it 0 which is why we || 1, but not if it's negative because it makes more sense for motion to end at 0 in that case.\n_round = function _round(value) {\n return Math.round(value * _roundingNum) / _roundingNum || 0;\n},\n _roundPrecise = function _roundPrecise(value) {\n return Math.round(value * 1e10) / 1e10 || 0;\n},\n _splitSegment = function _splitSegment(rawPath, segIndex, i, t) {\n var segment = rawPath[segIndex],\n shift = t === 1 ? 6 : subdivideSegment(segment, i, t);\n\n if (shift && shift + i + 2 < segment.length) {\n rawPath.splice(segIndex, 0, segment.slice(0, i + shift + 2));\n segment.splice(0, i + shift);\n return 1;\n }\n},\n _getSampleIndex = function _getSampleIndex(samples, length, progress) {\n // slightly slower way than doing this (when there's no lookup): segment.lookup[progress < 1 ? ~~(length / segment.minLength) : segment.lookup.length - 1] || 0;\n var l = samples.length,\n i = ~~(progress * l);\n\n if (samples[i] > length) {\n while (--i && samples[i] > length) {}\n\n i < 0 && (i = 0);\n } else {\n while (samples[++i] < length && i < l) {}\n }\n\n return i < l ? i : l - 1;\n},\n _reverseRawPath = function _reverseRawPath(rawPath, skipOuter) {\n var i = rawPath.length;\n skipOuter || rawPath.reverse();\n\n while (i--) {\n rawPath[i].reversed || reverseSegment(rawPath[i]);\n }\n},\n _copyMetaData = function _copyMetaData(source, copy) {\n copy.totalLength = source.totalLength;\n\n if (source.samples) {\n //segment\n copy.samples = source.samples.slice(0);\n copy.lookup = source.lookup.slice(0);\n copy.minLength = source.minLength;\n copy.resolution = source.resolution;\n } else if (source.totalPoints) {\n //rawPath\n copy.totalPoints = source.totalPoints;\n }\n\n return copy;\n},\n //pushes a new segment into a rawPath, but if its starting values match the ending values of the last segment, it'll merge it into that same segment (to reduce the number of segments)\n_appendOrMerge = function _appendOrMerge(rawPath, segment) {\n var index = rawPath.length,\n prevSeg = rawPath[index - 1] || [],\n l = prevSeg.length;\n\n if (index && segment[0] === prevSeg[l - 2] && segment[1] === prevSeg[l - 1]) {\n segment = prevSeg.concat(segment.slice(2));\n index--;\n }\n\n rawPath[index] = segment;\n},\n _bestDistance;\n/* TERMINOLOGY\n - RawPath - an array of arrays, one for each Segment. A single RawPath could have multiple \"M\" commands, defining Segments (paths aren't always connected).\n - Segment - an array containing a sequence of Cubic Bezier coordinates in alternating x, y, x, y format. Starting anchor, then control point 1, control point 2, and ending anchor, then the next control point 1, control point 2, anchor, etc. Uses less memory than an array with a bunch of {x, y} points.\n - Bezier - a single cubic Bezier with a starting anchor, two control points, and an ending anchor.\n - the variable \"t\" is typically the position along an individual Bezier path (time) and it's NOT linear, meaning it could accelerate/decelerate based on the control points whereas the \"p\" or \"progress\" value is linearly mapped to the whole path, so it shouldn't really accelerate/decelerate based on control points. So a progress of 0.2 would be almost exactly 20% along the path. \"t\" is ONLY in an individual Bezier piece.\n */\n//accepts basic selector text, a path instance, a RawPath instance, or a Segment and returns a RawPath (makes it easy to homogenize things). If an element or selector text is passed in, it'll also cache the value so that if it's queried again, it'll just take the path data from there instead of parsing it all over again (as long as the path data itself hasn't changed - it'll check).\n\n\nexport function getRawPath(value) {\n value = _isString(value) && _selectorExp.test(value) ? document.querySelector(value) || value : value;\n var e = value.getAttribute ? value : 0,\n rawPath;\n\n if (e && (value = value.getAttribute(\"d\"))) {\n //implements caching\n if (!e._gsPath) {\n e._gsPath = {};\n }\n\n rawPath = e._gsPath[value];\n return rawPath && !rawPath._dirty ? rawPath : e._gsPath[value] = stringToRawPath(value);\n }\n\n return !value ? console.warn(\"Expecting a
element or an SVG path data string\") : _isString(value) ? stringToRawPath(value) : _isNumber(value[0]) ? [value] : value;\n} //copies a RawPath WITHOUT the length meta data (for speed)\n\nexport function copyRawPath(rawPath) {\n var a = [],\n i = 0;\n\n for (; i < rawPath.length; i++) {\n a[i] = _copyMetaData(rawPath[i], rawPath[i].slice(0));\n }\n\n return _copyMetaData(rawPath, a);\n}\nexport function reverseSegment(segment) {\n var i = 0,\n y;\n segment.reverse(); //this will invert the order y, x, y, x so we must flip it back.\n\n for (; i < segment.length; i += 2) {\n y = segment[i];\n segment[i] = segment[i + 1];\n segment[i + 1] = y;\n }\n\n segment.reversed = !segment.reversed;\n}\n\nvar _createPath = function _createPath(e, ignore) {\n var path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\"),\n attr = [].slice.call(e.attributes),\n i = attr.length,\n name;\n ignore = \",\" + ignore + \",\";\n\n while (--i > -1) {\n name = attr[i].nodeName.toLowerCase(); //in Microsoft Edge, if you don't set the attribute with a lowercase name, it doesn't render correctly! Super weird.\n\n if (ignore.indexOf(\",\" + name + \",\") < 0) {\n path.setAttributeNS(null, name, attr[i].nodeValue);\n }\n }\n\n return path;\n},\n _typeAttrs = {\n rect: \"rx,ry,x,y,width,height\",\n circle: \"r,cx,cy\",\n ellipse: \"rx,ry,cx,cy\",\n line: \"x1,x2,y1,y2\"\n},\n _attrToObj = function _attrToObj(e, attrs) {\n var props = attrs ? attrs.split(\",\") : [],\n obj = {},\n i = props.length;\n\n while (--i > -1) {\n obj[props[i]] = +e.getAttribute(props[i]) || 0;\n }\n\n return obj;\n}; //converts an SVG shape like , , , , , etc. to a , swapping it in and copying the attributes to match.\n\n\nexport function convertToPath(element, swap) {\n var type = element.tagName.toLowerCase(),\n circ = 0.552284749831,\n data,\n x,\n y,\n r,\n ry,\n path,\n rcirc,\n rycirc,\n points,\n w,\n h,\n x2,\n x3,\n x4,\n x5,\n x6,\n y2,\n y3,\n y4,\n y5,\n y6,\n attr;\n\n if (type === \"path\" || !element.getBBox) {\n return element;\n }\n\n path = _createPath(element, \"x,y,width,height,cx,cy,rx,ry,r,x1,x2,y1,y2,points\");\n attr = _attrToObj(element, _typeAttrs[type]);\n\n if (type === \"rect\") {\n r = attr.rx;\n ry = attr.ry || r;\n x = attr.x;\n y = attr.y;\n w = attr.width - r * 2;\n h = attr.height - ry * 2;\n\n if (r || ry) {\n //if there are rounded corners, render cubic beziers\n x2 = x + r * (1 - circ);\n x3 = x + r;\n x4 = x3 + w;\n x5 = x4 + r * circ;\n x6 = x4 + r;\n y2 = y + ry * (1 - circ);\n y3 = y + ry;\n y4 = y3 + h;\n y5 = y4 + ry * circ;\n y6 = y4 + ry;\n data = \"M\" + x6 + \",\" + y3 + \" V\" + y4 + \" C\" + [x6, y5, x5, y6, x4, y6, x4 - (x4 - x3) / 3, y6, x3 + (x4 - x3) / 3, y6, x3, y6, x2, y6, x, y5, x, y4, x, y4 - (y4 - y3) / 3, x, y3 + (y4 - y3) / 3, x, y3, x, y2, x2, y, x3, y, x3 + (x4 - x3) / 3, y, x4 - (x4 - x3) / 3, y, x4, y, x5, y, x6, y2, x6, y3].join(\",\") + \"z\";\n } else {\n data = \"M\" + (x + w) + \",\" + y + \" v\" + h + \" h\" + -w + \" v\" + -h + \" h\" + w + \"z\";\n }\n } else if (type === \"circle\" || type === \"ellipse\") {\n if (type === \"circle\") {\n r = ry = attr.r;\n rycirc = r * circ;\n } else {\n r = attr.rx;\n ry = attr.ry;\n rycirc = ry * circ;\n }\n\n x = attr.cx;\n y = attr.cy;\n rcirc = r * circ;\n data = \"M\" + (x + r) + \",\" + y + \" C\" + [x + r, y + rycirc, x + rcirc, y + ry, x, y + ry, x - rcirc, y + ry, x - r, y + rycirc, x - r, y, x - r, y - rycirc, x - rcirc, y - ry, x, y - ry, x + rcirc, y - ry, x + r, y - rycirc, x + r, y].join(\",\") + \"z\";\n } else if (type === \"line\") {\n data = \"M\" + attr.x1 + \",\" + attr.y1 + \" L\" + attr.x2 + \",\" + attr.y2; //previously, we just converted to \"Mx,y Lx,y\" but Safari has bugs that cause that not to render properly when using a stroke-dasharray that's not fully visible! Using a cubic bezier fixes that issue.\n } else if (type === \"polyline\" || type === \"polygon\") {\n points = (element.getAttribute(\"points\") + \"\").match(_numbersExp) || [];\n x = points.shift();\n y = points.shift();\n data = \"M\" + x + \",\" + y + \" L\" + points.join(\",\");\n\n if (type === \"polygon\") {\n data += \",\" + x + \",\" + y + \"z\";\n }\n }\n\n path.setAttribute(\"d\", rawPathToString(path._gsRawPath = stringToRawPath(data)));\n\n if (swap && element.parentNode) {\n element.parentNode.insertBefore(path, element);\n element.parentNode.removeChild(element);\n }\n\n return path;\n} //returns the rotation (in degrees) at a particular progress on a rawPath (the slope of the tangent)\n\nexport function getRotationAtProgress(rawPath, progress) {\n var d = getProgressData(rawPath, progress >= 1 ? 1 - 1e-9 : progress ? progress : 1e-9);\n return getRotationAtBezierT(d.segment, d.i, d.t);\n}\n\nfunction getRotationAtBezierT(segment, i, t) {\n var a = segment[i],\n b = segment[i + 2],\n c = segment[i + 4],\n x;\n a += (b - a) * t;\n b += (c - b) * t;\n a += (b - a) * t;\n x = b + (c + (segment[i + 6] - c) * t - b) * t - a;\n a = segment[i + 1];\n b = segment[i + 3];\n c = segment[i + 5];\n a += (b - a) * t;\n b += (c - b) * t;\n a += (b - a) * t;\n return _round(_atan2(b + (c + (segment[i + 7] - c) * t - b) * t - a, x) * _RAD2DEG);\n}\n\nexport function sliceRawPath(rawPath, start, end) {\n end = _isUndefined(end) ? 1 : _roundPrecise(end) || 0; // we must round to avoid issues like 4.15 / 8 = 0.8300000000000001 instead of 0.83 or 2.8 / 5 = 0.5599999999999999 instead of 0.56 and if someone is doing a loop like start: 2.8 / 0.5, end: 2.8 / 0.5 + 1.\n\n start = _roundPrecise(start) || 0;\n var loops = Math.max(0, ~~(_abs(end - start) - 1e-8)),\n path = copyRawPath(rawPath);\n\n if (start > end) {\n start = 1 - start;\n end = 1 - end;\n\n _reverseRawPath(path);\n\n path.totalLength = 0;\n }\n\n if (start < 0 || end < 0) {\n var offset = Math.abs(~~Math.min(start, end)) + 1;\n start += offset;\n end += offset;\n }\n\n path.totalLength || cacheRawPathMeasurements(path);\n var wrap = end > 1,\n s = getProgressData(path, start, _temp, true),\n e = getProgressData(path, end, _temp2),\n eSeg = e.segment,\n sSeg = s.segment,\n eSegIndex = e.segIndex,\n sSegIndex = s.segIndex,\n ei = e.i,\n si = s.i,\n sameSegment = sSegIndex === eSegIndex,\n sameBezier = ei === si && sameSegment,\n wrapsBehind,\n sShift,\n eShift,\n i,\n copy,\n totalSegments,\n l,\n j;\n\n if (wrap || loops) {\n wrapsBehind = eSegIndex < sSegIndex || sameSegment && ei < si || sameBezier && e.t < s.t;\n\n if (_splitSegment(path, sSegIndex, si, s.t)) {\n sSegIndex++;\n\n if (!wrapsBehind) {\n eSegIndex++;\n\n if (sameBezier) {\n e.t = (e.t - s.t) / (1 - s.t);\n ei = 0;\n } else if (sameSegment) {\n ei -= si;\n }\n }\n }\n\n if (Math.abs(1 - (end - start)) < 1e-5) {\n eSegIndex = sSegIndex - 1;\n } else if (!e.t && eSegIndex) {\n eSegIndex--;\n } else if (_splitSegment(path, eSegIndex, ei, e.t) && wrapsBehind) {\n sSegIndex++;\n }\n\n if (s.t === 1) {\n sSegIndex = (sSegIndex + 1) % path.length;\n }\n\n copy = [];\n totalSegments = path.length;\n l = 1 + totalSegments * loops;\n j = sSegIndex;\n l += (totalSegments - sSegIndex + eSegIndex) % totalSegments;\n\n for (i = 0; i < l; i++) {\n _appendOrMerge(copy, path[j++ % totalSegments]);\n }\n\n path = copy;\n } else {\n eShift = e.t === 1 ? 6 : subdivideSegment(eSeg, ei, e.t);\n\n if (start !== end) {\n sShift = subdivideSegment(sSeg, si, sameBezier ? s.t / e.t : s.t);\n sameSegment && (eShift += sShift);\n eSeg.splice(ei + eShift + 2);\n (sShift || si) && sSeg.splice(0, si + sShift);\n i = path.length;\n\n while (i--) {\n //chop off any extra segments\n (i < sSegIndex || i > eSegIndex) && path.splice(i, 1);\n }\n } else {\n eSeg.angle = getRotationAtBezierT(eSeg, ei + eShift, 0); //record the value before we chop because it'll be impossible to determine the angle after its length is 0!\n\n ei += eShift;\n s = eSeg[ei];\n e = eSeg[ei + 1];\n eSeg.length = eSeg.totalLength = 0;\n eSeg.totalPoints = path.totalPoints = 8;\n eSeg.push(s, e, s, e, s, e, s, e);\n }\n }\n\n path.totalLength = 0;\n return path;\n} //measures a Segment according to its resolution (so if segment.resolution is 6, for example, it'll take 6 samples equally across each Bezier) and create/populate a \"samples\" Array that has the length up to each of those sample points (always increasing from the start) as well as a \"lookup\" array that's broken up according to the smallest distance between 2 samples. This gives us a very fast way of looking up a progress position rather than looping through all the points/Beziers. You can optionally have it only measure a subset, starting at startIndex and going for a specific number of beziers (remember, there are 3 x/y pairs each, for a total of 6 elements for each Bezier). It will also populate a \"totalLength\" property, but that's not generally super accurate because by default it'll only take 6 samples per Bezier. But for performance reasons, it's perfectly adequate for measuring progress values along the path. If you need a more accurate totalLength, either increase the resolution or use the more advanced bezierToPoints() method which keeps adding points until they don't deviate by more than a certain precision value.\n\nfunction measureSegment(segment, startIndex, bezierQty) {\n startIndex = startIndex || 0;\n\n if (!segment.samples) {\n segment.samples = [];\n segment.lookup = [];\n }\n\n var resolution = ~~segment.resolution || 12,\n inc = 1 / resolution,\n endIndex = bezierQty ? startIndex + bezierQty * 6 + 1 : segment.length,\n x1 = segment[startIndex],\n y1 = segment[startIndex + 1],\n samplesIndex = startIndex ? startIndex / 6 * resolution : 0,\n samples = segment.samples,\n lookup = segment.lookup,\n min = (startIndex ? segment.minLength : _largeNum) || _largeNum,\n prevLength = samples[samplesIndex + bezierQty * resolution - 1],\n length = startIndex ? samples[samplesIndex - 1] : 0,\n i,\n j,\n x4,\n x3,\n x2,\n xd,\n xd1,\n y4,\n y3,\n y2,\n yd,\n yd1,\n inv,\n t,\n lengthIndex,\n l,\n segLength;\n samples.length = lookup.length = 0;\n\n for (j = startIndex + 2; j < endIndex; j += 6) {\n x4 = segment[j + 4] - x1;\n x3 = segment[j + 2] - x1;\n x2 = segment[j] - x1;\n y4 = segment[j + 5] - y1;\n y3 = segment[j + 3] - y1;\n y2 = segment[j + 1] - y1;\n xd = xd1 = yd = yd1 = 0;\n\n if (_abs(x4) < .01 && _abs(y4) < .01 && _abs(x2) + _abs(y2) < .01) {\n //dump points that are sufficiently close (basically right on top of each other, making a bezier super tiny or 0 length)\n if (segment.length > 8) {\n segment.splice(j, 6);\n j -= 6;\n endIndex -= 6;\n }\n } else {\n for (i = 1; i <= resolution; i++) {\n t = inc * i;\n inv = 1 - t;\n xd = xd1 - (xd1 = (t * t * x4 + 3 * inv * (t * x3 + inv * x2)) * t);\n yd = yd1 - (yd1 = (t * t * y4 + 3 * inv * (t * y3 + inv * y2)) * t);\n l = _sqrt(yd * yd + xd * xd);\n\n if (l < min) {\n min = l;\n }\n\n length += l;\n samples[samplesIndex++] = length;\n }\n }\n\n x1 += x4;\n y1 += y4;\n }\n\n if (prevLength) {\n prevLength -= length;\n\n for (; samplesIndex < samples.length; samplesIndex++) {\n samples[samplesIndex] += prevLength;\n }\n }\n\n if (samples.length && min) {\n segment.totalLength = segLength = samples[samples.length - 1] || 0;\n segment.minLength = min;\n\n if (segLength / min < 9999) {\n // if the lookup would require too many values (memory problem), we skip this and instead we use a loop to lookup values directly in the samples Array\n l = lengthIndex = 0;\n\n for (i = 0; i < segLength; i += min) {\n lookup[l++] = samples[lengthIndex] < i ? ++lengthIndex : lengthIndex;\n }\n }\n } else {\n segment.totalLength = samples[0] = 0;\n }\n\n return startIndex ? length - samples[startIndex / 2 - 1] : length;\n}\n\nexport function cacheRawPathMeasurements(rawPath, resolution) {\n var pathLength, points, i;\n\n for (i = pathLength = points = 0; i < rawPath.length; i++) {\n rawPath[i].resolution = ~~resolution || 12; //steps per Bezier curve (anchor, 2 control points, to anchor)\n\n points += rawPath[i].length;\n pathLength += measureSegment(rawPath[i]);\n }\n\n rawPath.totalPoints = points;\n rawPath.totalLength = pathLength;\n return rawPath;\n} //divide segment[i] at position t (value between 0 and 1, progress along that particular cubic bezier segment that starts at segment[i]). Returns how many elements were spliced into the segment array (either 0 or 6)\n\nexport function subdivideSegment(segment, i, t) {\n if (t <= 0 || t >= 1) {\n return 0;\n }\n\n var ax = segment[i],\n ay = segment[i + 1],\n cp1x = segment[i + 2],\n cp1y = segment[i + 3],\n cp2x = segment[i + 4],\n cp2y = segment[i + 5],\n bx = segment[i + 6],\n by = segment[i + 7],\n x1a = ax + (cp1x - ax) * t,\n x2 = cp1x + (cp2x - cp1x) * t,\n y1a = ay + (cp1y - ay) * t,\n y2 = cp1y + (cp2y - cp1y) * t,\n x1 = x1a + (x2 - x1a) * t,\n y1 = y1a + (y2 - y1a) * t,\n x2a = cp2x + (bx - cp2x) * t,\n y2a = cp2y + (by - cp2y) * t;\n x2 += (x2a - x2) * t;\n y2 += (y2a - y2) * t;\n segment.splice(i + 2, 4, _round(x1a), //first control point\n _round(y1a), _round(x1), //second control point\n _round(y1), _round(x1 + (x2 - x1) * t), //new fabricated anchor on line\n _round(y1 + (y2 - y1) * t), _round(x2), //third control point\n _round(y2), _round(x2a), //fourth control point\n _round(y2a));\n segment.samples && segment.samples.splice(i / 6 * segment.resolution | 0, 0, 0, 0, 0, 0, 0, 0);\n return 6;\n} // returns an object {path, segment, segIndex, i, t}\n\nfunction getProgressData(rawPath, progress, decoratee, pushToNextIfAtEnd) {\n decoratee = decoratee || {};\n rawPath.totalLength || cacheRawPathMeasurements(rawPath);\n\n if (progress < 0 || progress > 1) {\n progress = _wrapProgress(progress);\n }\n\n var segIndex = 0,\n segment = rawPath[0],\n samples,\n resolution,\n length,\n min,\n max,\n i,\n t;\n\n if (!progress) {\n t = i = segIndex = 0;\n segment = rawPath[0];\n } else if (progress === 1) {\n t = 1;\n segIndex = rawPath.length - 1;\n segment = rawPath[segIndex];\n i = segment.length - 8;\n } else {\n if (rawPath.length > 1) {\n //speed optimization: most of the time, there's only one segment so skip the recursion.\n length = rawPath.totalLength * progress;\n max = i = 0;\n\n while ((max += rawPath[i++].totalLength) < length) {\n segIndex = i;\n }\n\n segment = rawPath[segIndex];\n min = max - segment.totalLength;\n progress = (length - min) / (max - min) || 0;\n }\n\n samples = segment.samples;\n resolution = segment.resolution; //how many samples per cubic bezier chunk\n\n length = segment.totalLength * progress;\n i = segment.lookup.length ? segment.lookup[~~(length / segment.minLength)] || 0 : _getSampleIndex(samples, length, progress);\n min = i ? samples[i - 1] : 0;\n max = samples[i];\n\n if (max < length) {\n min = max;\n max = samples[++i];\n }\n\n t = 1 / resolution * ((length - min) / (max - min) + i % resolution);\n i = ~~(i / resolution) * 6;\n\n if (pushToNextIfAtEnd && t === 1) {\n if (i + 6 < segment.length) {\n i += 6;\n t = 0;\n } else if (segIndex + 1 < rawPath.length) {\n i = t = 0;\n segment = rawPath[++segIndex];\n }\n }\n }\n\n decoratee.t = t;\n decoratee.i = i;\n decoratee.path = rawPath;\n decoratee.segment = segment;\n decoratee.segIndex = segIndex;\n return decoratee;\n}\n\nexport function getPositionOnPath(rawPath, progress, includeAngle, point) {\n var segment = rawPath[0],\n result = point || {},\n samples,\n resolution,\n length,\n min,\n max,\n i,\n t,\n a,\n inv;\n\n if (progress < 0 || progress > 1) {\n progress = _wrapProgress(progress);\n }\n\n segment.lookup || cacheRawPathMeasurements(rawPath);\n\n if (rawPath.length > 1) {\n //speed optimization: most of the time, there's only one segment so skip the recursion.\n length = rawPath.totalLength * progress;\n max = i = 0;\n\n while ((max += rawPath[i++].totalLength) < length) {\n segment = rawPath[i];\n }\n\n min = max - segment.totalLength;\n progress = (length - min) / (max - min) || 0;\n }\n\n samples = segment.samples;\n resolution = segment.resolution;\n length = segment.totalLength * progress;\n i = segment.lookup.length ? segment.lookup[progress < 1 ? ~~(length / segment.minLength) : segment.lookup.length - 1] || 0 : _getSampleIndex(samples, length, progress);\n min = i ? samples[i - 1] : 0;\n max = samples[i];\n\n if (max < length) {\n min = max;\n max = samples[++i];\n }\n\n t = 1 / resolution * ((length - min) / (max - min) + i % resolution) || 0;\n inv = 1 - t;\n i = ~~(i / resolution) * 6;\n a = segment[i];\n result.x = _round((t * t * (segment[i + 6] - a) + 3 * inv * (t * (segment[i + 4] - a) + inv * (segment[i + 2] - a))) * t + a);\n result.y = _round((t * t * (segment[i + 7] - (a = segment[i + 1])) + 3 * inv * (t * (segment[i + 5] - a) + inv * (segment[i + 3] - a))) * t + a);\n\n if (includeAngle) {\n result.angle = segment.totalLength ? getRotationAtBezierT(segment, i, t >= 1 ? 1 - 1e-9 : t ? t : 1e-9) : segment.angle || 0;\n }\n\n return result;\n} //applies a matrix transform to RawPath (or a segment in a RawPath) and returns whatever was passed in (it transforms the values in the array(s), not a copy).\n\nexport function transformRawPath(rawPath, a, b, c, d, tx, ty) {\n var j = rawPath.length,\n segment,\n l,\n i,\n x,\n y;\n\n while (--j > -1) {\n segment = rawPath[j];\n l = segment.length;\n\n for (i = 0; i < l; i += 2) {\n x = segment[i];\n y = segment[i + 1];\n segment[i] = x * a + y * c + tx;\n segment[i + 1] = x * b + y * d + ty;\n }\n }\n\n rawPath._dirty = 1;\n return rawPath;\n} // translates SVG arc data into a segment (cubic beziers). Angle is in degrees.\n\nfunction arcToSegment(lastX, lastY, rx, ry, angle, largeArcFlag, sweepFlag, x, y) {\n if (lastX === x && lastY === y) {\n return;\n }\n\n rx = _abs(rx);\n ry = _abs(ry);\n\n var angleRad = angle % 360 * _DEG2RAD,\n cosAngle = _cos(angleRad),\n sinAngle = _sin(angleRad),\n PI = Math.PI,\n TWOPI = PI * 2,\n dx2 = (lastX - x) / 2,\n dy2 = (lastY - y) / 2,\n x1 = cosAngle * dx2 + sinAngle * dy2,\n y1 = -sinAngle * dx2 + cosAngle * dy2,\n x1_sq = x1 * x1,\n y1_sq = y1 * y1,\n radiiCheck = x1_sq / (rx * rx) + y1_sq / (ry * ry);\n\n if (radiiCheck > 1) {\n rx = _sqrt(radiiCheck) * rx;\n ry = _sqrt(radiiCheck) * ry;\n }\n\n var rx_sq = rx * rx,\n ry_sq = ry * ry,\n sq = (rx_sq * ry_sq - rx_sq * y1_sq - ry_sq * x1_sq) / (rx_sq * y1_sq + ry_sq * x1_sq);\n\n if (sq < 0) {\n sq = 0;\n }\n\n var coef = (largeArcFlag === sweepFlag ? -1 : 1) * _sqrt(sq),\n cx1 = coef * (rx * y1 / ry),\n cy1 = coef * -(ry * x1 / rx),\n sx2 = (lastX + x) / 2,\n sy2 = (lastY + y) / 2,\n cx = sx2 + (cosAngle * cx1 - sinAngle * cy1),\n cy = sy2 + (sinAngle * cx1 + cosAngle * cy1),\n ux = (x1 - cx1) / rx,\n uy = (y1 - cy1) / ry,\n vx = (-x1 - cx1) / rx,\n vy = (-y1 - cy1) / ry,\n temp = ux * ux + uy * uy,\n angleStart = (uy < 0 ? -1 : 1) * Math.acos(ux / _sqrt(temp)),\n angleExtent = (ux * vy - uy * vx < 0 ? -1 : 1) * Math.acos((ux * vx + uy * vy) / _sqrt(temp * (vx * vx + vy * vy)));\n\n isNaN(angleExtent) && (angleExtent = PI); //rare edge case. Math.cos(-1) is NaN.\n\n if (!sweepFlag && angleExtent > 0) {\n angleExtent -= TWOPI;\n } else if (sweepFlag && angleExtent < 0) {\n angleExtent += TWOPI;\n }\n\n angleStart %= TWOPI;\n angleExtent %= TWOPI;\n\n var segments = Math.ceil(_abs(angleExtent) / (TWOPI / 4)),\n rawPath = [],\n angleIncrement = angleExtent / segments,\n controlLength = 4 / 3 * _sin(angleIncrement / 2) / (1 + _cos(angleIncrement / 2)),\n ma = cosAngle * rx,\n mb = sinAngle * rx,\n mc = sinAngle * -ry,\n md = cosAngle * ry,\n i;\n\n for (i = 0; i < segments; i++) {\n angle = angleStart + i * angleIncrement;\n x1 = _cos(angle);\n y1 = _sin(angle);\n ux = _cos(angle += angleIncrement);\n uy = _sin(angle);\n rawPath.push(x1 - controlLength * y1, y1 + controlLength * x1, ux + controlLength * uy, uy - controlLength * ux, ux, uy);\n } //now transform according to the actual size of the ellipse/arc (the beziers were noramlized, between 0 and 1 on a circle).\n\n\n for (i = 0; i < rawPath.length; i += 2) {\n x1 = rawPath[i];\n y1 = rawPath[i + 1];\n rawPath[i] = x1 * ma + y1 * mc + cx;\n rawPath[i + 1] = x1 * mb + y1 * md + cy;\n }\n\n rawPath[i - 2] = x; //always set the end to exactly where it's supposed to be\n\n rawPath[i - 1] = y;\n return rawPath;\n} //Spits back a RawPath with absolute coordinates. Each segment starts with a \"moveTo\" command (x coordinate, then y) and then 2 control points (x, y, x, y), then anchor. The goal is to minimize memory and maximize speed.\n\n\nexport function stringToRawPath(d) {\n var a = (d + \"\").replace(_scientific, function (m) {\n var n = +m;\n return n < 0.0001 && n > -0.0001 ? 0 : n;\n }).match(_svgPathExp) || [],\n //some authoring programs spit out very small numbers in scientific notation like \"1e-5\", so make sure we round that down to 0 first.\n path = [],\n relativeX = 0,\n relativeY = 0,\n twoThirds = 2 / 3,\n elements = a.length,\n points = 0,\n errorMessage = \"ERROR: malformed path: \" + d,\n i,\n j,\n x,\n y,\n command,\n isRelative,\n segment,\n startX,\n startY,\n difX,\n difY,\n beziers,\n prevCommand,\n flag1,\n flag2,\n line = function line(sx, sy, ex, ey) {\n difX = (ex - sx) / 3;\n difY = (ey - sy) / 3;\n segment.push(sx + difX, sy + difY, ex - difX, ey - difY, ex, ey);\n };\n\n if (!d || !isNaN(a[0]) || isNaN(a[1])) {\n console.log(errorMessage);\n return path;\n }\n\n for (i = 0; i < elements; i++) {\n prevCommand = command;\n\n if (isNaN(a[i])) {\n command = a[i].toUpperCase();\n isRelative = command !== a[i]; //lower case means relative\n } else {\n //commands like \"C\" can be strung together without any new command characters between.\n i--;\n }\n\n x = +a[i + 1];\n y = +a[i + 2];\n\n if (isRelative) {\n x += relativeX;\n y += relativeY;\n }\n\n if (!i) {\n startX = x;\n startY = y;\n } // \"M\" (move)\n\n\n if (command === \"M\") {\n if (segment) {\n if (segment.length < 8) {\n //if the path data was funky and just had a M with no actual drawing anywhere, skip it.\n path.length -= 1;\n } else {\n points += segment.length;\n }\n }\n\n relativeX = startX = x;\n relativeY = startY = y;\n segment = [x, y];\n path.push(segment);\n i += 2;\n command = \"L\"; //an \"M\" with more than 2 values gets interpreted as \"lineTo\" commands (\"L\").\n // \"C\" (cubic bezier)\n } else if (command === \"C\") {\n if (!segment) {\n segment = [0, 0];\n }\n\n if (!isRelative) {\n relativeX = relativeY = 0;\n } //note: \"*1\" is just a fast/short way to cast the value as a Number. WAAAY faster in Chrome, slightly slower in Firefox.\n\n\n segment.push(x, y, relativeX + a[i + 3] * 1, relativeY + a[i + 4] * 1, relativeX += a[i + 5] * 1, relativeY += a[i + 6] * 1);\n i += 6; // \"S\" (continuation of cubic bezier)\n } else if (command === \"S\") {\n difX = relativeX;\n difY = relativeY;\n\n if (prevCommand === \"C\" || prevCommand === \"S\") {\n difX += relativeX - segment[segment.length - 4];\n difY += relativeY - segment[segment.length - 3];\n }\n\n if (!isRelative) {\n relativeX = relativeY = 0;\n }\n\n segment.push(difX, difY, x, y, relativeX += a[i + 3] * 1, relativeY += a[i + 4] * 1);\n i += 4; // \"Q\" (quadratic bezier)\n } else if (command === \"Q\") {\n difX = relativeX + (x - relativeX) * twoThirds;\n difY = relativeY + (y - relativeY) * twoThirds;\n\n if (!isRelative) {\n relativeX = relativeY = 0;\n }\n\n relativeX += a[i + 3] * 1;\n relativeY += a[i + 4] * 1;\n segment.push(difX, difY, relativeX + (x - relativeX) * twoThirds, relativeY + (y - relativeY) * twoThirds, relativeX, relativeY);\n i += 4; // \"T\" (continuation of quadratic bezier)\n } else if (command === \"T\") {\n difX = relativeX - segment[segment.length - 4];\n difY = relativeY - segment[segment.length - 3];\n segment.push(relativeX + difX, relativeY + difY, x + (relativeX + difX * 1.5 - x) * twoThirds, y + (relativeY + difY * 1.5 - y) * twoThirds, relativeX = x, relativeY = y);\n i += 2; // \"H\" (horizontal line)\n } else if (command === \"H\") {\n line(relativeX, relativeY, relativeX = x, relativeY);\n i += 1; // \"V\" (vertical line)\n } else if (command === \"V\") {\n //adjust values because the first (and only one) isn't x in this case, it's y.\n line(relativeX, relativeY, relativeX, relativeY = x + (isRelative ? relativeY - relativeX : 0));\n i += 1; // \"L\" (line) or \"Z\" (close)\n } else if (command === \"L\" || command === \"Z\") {\n if (command === \"Z\") {\n x = startX;\n y = startY;\n segment.closed = true;\n }\n\n if (command === \"L\" || _abs(relativeX - x) > 0.5 || _abs(relativeY - y) > 0.5) {\n line(relativeX, relativeY, x, y);\n\n if (command === \"L\") {\n i += 2;\n }\n }\n\n relativeX = x;\n relativeY = y; // \"A\" (arc)\n } else if (command === \"A\") {\n flag1 = a[i + 4];\n flag2 = a[i + 5];\n difX = a[i + 6];\n difY = a[i + 7];\n j = 7;\n\n if (flag1.length > 1) {\n // for cases when the flags are merged, like \"a8 8 0 018 8\" (the 0 and 1 flags are WITH the x value of 8, but it could also be \"a8 8 0 01-8 8\" so it may include x or not)\n if (flag1.length < 3) {\n difY = difX;\n difX = flag2;\n j--;\n } else {\n difY = flag2;\n difX = flag1.substr(2);\n j -= 2;\n }\n\n flag2 = flag1.charAt(1);\n flag1 = flag1.charAt(0);\n }\n\n beziers = arcToSegment(relativeX, relativeY, +a[i + 1], +a[i + 2], +a[i + 3], +flag1, +flag2, (isRelative ? relativeX : 0) + difX * 1, (isRelative ? relativeY : 0) + difY * 1);\n i += j;\n\n if (beziers) {\n for (j = 0; j < beziers.length; j++) {\n segment.push(beziers[j]);\n }\n }\n\n relativeX = segment[segment.length - 2];\n relativeY = segment[segment.length - 1];\n } else {\n console.log(errorMessage);\n }\n }\n\n i = segment.length;\n\n if (i < 6) {\n //in case there's odd SVG like a M0,0 command at the very end.\n path.pop();\n i = 0;\n } else if (segment[0] === segment[i - 2] && segment[1] === segment[i - 1]) {\n segment.closed = true;\n }\n\n path.totalPoints = points + i;\n return path;\n} //populates the points array in alternating x/y values (like [x, y, x, y...] instead of individual point objects [{x, y}, {x, y}...] to conserve memory and stay in line with how we're handling segment arrays\n\nexport function bezierToPoints(x1, y1, x2, y2, x3, y3, x4, y4, threshold, points, index) {\n var x12 = (x1 + x2) / 2,\n y12 = (y1 + y2) / 2,\n x23 = (x2 + x3) / 2,\n y23 = (y2 + y3) / 2,\n x34 = (x3 + x4) / 2,\n y34 = (y3 + y4) / 2,\n x123 = (x12 + x23) / 2,\n y123 = (y12 + y23) / 2,\n x234 = (x23 + x34) / 2,\n y234 = (y23 + y34) / 2,\n x1234 = (x123 + x234) / 2,\n y1234 = (y123 + y234) / 2,\n dx = x4 - x1,\n dy = y4 - y1,\n d2 = _abs((x2 - x4) * dy - (y2 - y4) * dx),\n d3 = _abs((x3 - x4) * dy - (y3 - y4) * dx),\n length;\n\n if (!points) {\n points = [x1, y1, x4, y4];\n index = 2;\n }\n\n points.splice(index || points.length - 2, 0, x1234, y1234);\n\n if ((d2 + d3) * (d2 + d3) > threshold * (dx * dx + dy * dy)) {\n length = points.length;\n bezierToPoints(x1, y1, x12, y12, x123, y123, x1234, y1234, threshold, points, index);\n bezierToPoints(x1234, y1234, x234, y234, x34, y34, x4, y4, threshold, points, index + 2 + (points.length - length));\n }\n\n return points;\n}\n/*\nfunction getAngleBetweenPoints(x0, y0, x1, y1, x2, y2) { //angle between 3 points in radians\n\tvar dx1 = x1 - x0,\n\t\tdy1 = y1 - y0,\n\t\tdx2 = x2 - x1,\n\t\tdy2 = y2 - y1,\n\t\tdx3 = x2 - x0,\n\t\tdy3 = y2 - y0,\n\t\ta = dx1 * dx1 + dy1 * dy1,\n\t\tb = dx2 * dx2 + dy2 * dy2,\n\t\tc = dx3 * dx3 + dy3 * dy3;\n\treturn Math.acos( (a + b - c) / _sqrt(4 * a * b) );\n},\n*/\n//pointsToSegment() doesn't handle flat coordinates (where y is always 0) the way we need (the resulting control points are always right on top of the anchors), so this function basically makes the control points go directly up and down, varying in length based on the curviness (more curvy, further control points)\n\nexport function flatPointsToSegment(points, curviness) {\n if (curviness === void 0) {\n curviness = 1;\n }\n\n var x = points[0],\n y = 0,\n segment = [x, y],\n i = 2;\n\n for (; i < points.length; i += 2) {\n segment.push(x, y, points[i], y = (points[i] - x) * curviness / 2, x = points[i], -y);\n }\n\n return segment;\n} //points is an array of x/y points, like [x, y, x, y, x, y]\n\nexport function pointsToSegment(points, curviness) {\n //points = simplifyPoints(points, tolerance);\n _abs(points[0] - points[2]) < 1e-4 && _abs(points[1] - points[3]) < 1e-4 && (points = points.slice(2)); // if the first two points are super close, dump the first one.\n\n var l = points.length - 2,\n x = +points[0],\n y = +points[1],\n nextX = +points[2],\n nextY = +points[3],\n segment = [x, y, x, y],\n dx2 = nextX - x,\n dy2 = nextY - y,\n closed = Math.abs(points[l] - x) < 0.001 && Math.abs(points[l + 1] - y) < 0.001,\n prevX,\n prevY,\n i,\n dx1,\n dy1,\n r1,\n r2,\n r3,\n tl,\n mx1,\n mx2,\n mxm,\n my1,\n my2,\n mym;\n\n if (closed) {\n // if the start and end points are basically on top of each other, close the segment by adding the 2nd point to the end, and the 2nd-to-last point to the beginning (we'll remove them at the end, but this allows the curvature to look perfect)\n points.push(nextX, nextY);\n nextX = x;\n nextY = y;\n x = points[l - 2];\n y = points[l - 1];\n points.unshift(x, y);\n l += 4;\n }\n\n curviness = curviness || curviness === 0 ? +curviness : 1;\n\n for (i = 2; i < l; i += 2) {\n prevX = x;\n prevY = y;\n x = nextX;\n y = nextY;\n nextX = +points[i + 2];\n nextY = +points[i + 3];\n\n if (x === nextX && y === nextY) {\n continue;\n }\n\n dx1 = dx2;\n dy1 = dy2;\n dx2 = nextX - x;\n dy2 = nextY - y;\n r1 = _sqrt(dx1 * dx1 + dy1 * dy1); // r1, r2, and r3 correlate x and y (and z in the future). Basically 2D or 3D hypotenuse\n\n r2 = _sqrt(dx2 * dx2 + dy2 * dy2);\n r3 = _sqrt(Math.pow(dx2 / r2 + dx1 / r1, 2) + Math.pow(dy2 / r2 + dy1 / r1, 2));\n tl = (r1 + r2) * curviness * 0.25 / r3;\n mx1 = x - (x - prevX) * (r1 ? tl / r1 : 0);\n mx2 = x + (nextX - x) * (r2 ? tl / r2 : 0);\n mxm = x - (mx1 + ((mx2 - mx1) * (r1 * 3 / (r1 + r2) + 0.5) / 4 || 0));\n my1 = y - (y - prevY) * (r1 ? tl / r1 : 0);\n my2 = y + (nextY - y) * (r2 ? tl / r2 : 0);\n mym = y - (my1 + ((my2 - my1) * (r1 * 3 / (r1 + r2) + 0.5) / 4 || 0));\n\n if (x !== prevX || y !== prevY) {\n segment.push(_round(mx1 + mxm), // first control point\n _round(my1 + mym), _round(x), // anchor\n _round(y), _round(mx2 + mxm), // second control point\n _round(my2 + mym));\n }\n }\n\n x !== nextX || y !== nextY || segment.length < 4 ? segment.push(_round(nextX), _round(nextY), _round(nextX), _round(nextY)) : segment.length -= 2;\n\n if (segment.length === 2) {\n // only one point!\n segment.push(x, y, x, y, x, y);\n } else if (closed) {\n segment.splice(0, 6);\n segment.length = segment.length - 6;\n }\n\n return segment;\n} //returns the squared distance between an x/y coordinate and a segment between x1/y1 and x2/y2\n\nfunction pointToSegDist(x, y, x1, y1, x2, y2) {\n var dx = x2 - x1,\n dy = y2 - y1,\n t;\n\n if (dx || dy) {\n t = ((x - x1) * dx + (y - y1) * dy) / (dx * dx + dy * dy);\n\n if (t > 1) {\n x1 = x2;\n y1 = y2;\n } else if (t > 0) {\n x1 += dx * t;\n y1 += dy * t;\n }\n }\n\n return Math.pow(x - x1, 2) + Math.pow(y - y1, 2);\n}\n\nfunction simplifyStep(points, first, last, tolerance, simplified) {\n var maxSqDist = tolerance,\n firstX = points[first],\n firstY = points[first + 1],\n lastX = points[last],\n lastY = points[last + 1],\n index,\n i,\n d;\n\n for (i = first + 2; i < last; i += 2) {\n d = pointToSegDist(points[i], points[i + 1], firstX, firstY, lastX, lastY);\n\n if (d > maxSqDist) {\n index = i;\n maxSqDist = d;\n }\n }\n\n if (maxSqDist > tolerance) {\n index - first > 2 && simplifyStep(points, first, index, tolerance, simplified);\n simplified.push(points[index], points[index + 1]);\n last - index > 2 && simplifyStep(points, index, last, tolerance, simplified);\n }\n} //points is an array of x/y values like [x, y, x, y, x, y]\n\n\nexport function simplifyPoints(points, tolerance) {\n var prevX = parseFloat(points[0]),\n prevY = parseFloat(points[1]),\n temp = [prevX, prevY],\n l = points.length - 2,\n i,\n x,\n y,\n dx,\n dy,\n result,\n last;\n tolerance = Math.pow(tolerance || 1, 2);\n\n for (i = 2; i < l; i += 2) {\n x = parseFloat(points[i]);\n y = parseFloat(points[i + 1]);\n dx = prevX - x;\n dy = prevY - y;\n\n if (dx * dx + dy * dy > tolerance) {\n temp.push(x, y);\n prevX = x;\n prevY = y;\n }\n }\n\n temp.push(parseFloat(points[l]), parseFloat(points[l + 1]));\n last = temp.length - 2;\n result = [temp[0], temp[1]];\n simplifyStep(temp, 0, last, tolerance, result);\n result.push(temp[last], temp[last + 1]);\n return result;\n}\n\nfunction getClosestProgressOnBezier(iterations, px, py, start, end, slices, x0, y0, x1, y1, x2, y2, x3, y3) {\n var inc = (end - start) / slices,\n best = 0,\n t = start,\n x,\n y,\n d,\n dx,\n dy,\n inv;\n _bestDistance = _largeNum;\n\n while (t <= end) {\n inv = 1 - t;\n x = inv * inv * inv * x0 + 3 * inv * inv * t * x1 + 3 * inv * t * t * x2 + t * t * t * x3;\n y = inv * inv * inv * y0 + 3 * inv * inv * t * y1 + 3 * inv * t * t * y2 + t * t * t * y3;\n dx = x - px;\n dy = y - py;\n d = dx * dx + dy * dy;\n\n if (d < _bestDistance) {\n _bestDistance = d;\n best = t;\n }\n\n t += inc;\n }\n\n return iterations > 1 ? getClosestProgressOnBezier(iterations - 1, px, py, Math.max(best - inc, 0), Math.min(best + inc, 1), slices, x0, y0, x1, y1, x2, y2, x3, y3) : best;\n}\n\nexport function getClosestData(rawPath, x, y, slices) {\n //returns an object with the closest j, i, and t (j is the segment index, i is the index of the point in that segment, and t is the time/progress along that bezier)\n var closest = {\n j: 0,\n i: 0,\n t: 0\n },\n bestDistance = _largeNum,\n i,\n j,\n t,\n segment;\n\n for (j = 0; j < rawPath.length; j++) {\n segment = rawPath[j];\n\n for (i = 0; i < segment.length; i += 6) {\n t = getClosestProgressOnBezier(1, x, y, 0, 1, slices || 20, segment[i], segment[i + 1], segment[i + 2], segment[i + 3], segment[i + 4], segment[i + 5], segment[i + 6], segment[i + 7]);\n\n if (bestDistance > _bestDistance) {\n bestDistance = _bestDistance;\n closest.j = j;\n closest.i = i;\n closest.t = t;\n }\n }\n }\n\n return closest;\n} //subdivide a Segment closest to a specific x,y coordinate\n\nexport function subdivideSegmentNear(x, y, segment, slices, iterations) {\n var l = segment.length,\n bestDistance = _largeNum,\n bestT = 0,\n bestSegmentIndex = 0,\n t,\n i;\n slices = slices || 20;\n iterations = iterations || 3;\n\n for (i = 0; i < l; i += 6) {\n t = getClosestProgressOnBezier(1, x, y, 0, 1, slices, segment[i], segment[i + 1], segment[i + 2], segment[i + 3], segment[i + 4], segment[i + 5], segment[i + 6], segment[i + 7]);\n\n if (bestDistance > _bestDistance) {\n bestDistance = _bestDistance;\n bestT = t;\n bestSegmentIndex = i;\n }\n }\n\n t = getClosestProgressOnBezier(iterations, x, y, bestT - 0.05, bestT + 0.05, slices, segment[bestSegmentIndex], segment[bestSegmentIndex + 1], segment[bestSegmentIndex + 2], segment[bestSegmentIndex + 3], segment[bestSegmentIndex + 4], segment[bestSegmentIndex + 5], segment[bestSegmentIndex + 6], segment[bestSegmentIndex + 7]);\n subdivideSegment(segment, bestSegmentIndex, t);\n return bestSegmentIndex + 6;\n}\n/*\nTakes any of the following and converts it to an all Cubic Bezier SVG data string:\n- A data string like \"M0,0 L2,4 v20,15 H100\"\n- A RawPath, like [[x, y, x, y, x, y, x, y][[x, y, x, y, x, y, x, y]]\n- A Segment, like [x, y, x, y, x, y, x, y]\n\nNote: all numbers are rounded down to the closest 0.001 to minimize memory, maximize speed, and avoid odd numbers like 1e-13\n*/\n\nexport function rawPathToString(rawPath) {\n if (_isNumber(rawPath[0])) {\n //in case a segment is passed in instead\n rawPath = [rawPath];\n }\n\n var result = \"\",\n l = rawPath.length,\n sl,\n s,\n i,\n segment;\n\n for (s = 0; s < l; s++) {\n segment = rawPath[s];\n result += \"M\" + _round(segment[0]) + \",\" + _round(segment[1]) + \" C\";\n sl = segment.length;\n\n for (i = 2; i < sl; i++) {\n result += _round(segment[i++]) + \",\" + _round(segment[i++]) + \" \" + _round(segment[i++]) + \",\" + _round(segment[i++]) + \" \" + _round(segment[i++]) + \",\" + _round(segment[i]) + \" \";\n }\n\n if (segment.closed) {\n result += \"z\";\n }\n }\n\n return result;\n}\n/*\n// takes a segment with coordinates [x, y, x, y, ...] and converts the control points into angles and lengths [x, y, angle, length, angle, length, x, y, angle, length, ...] so that it animates more cleanly and avoids odd breaks/kinks. For example, if you animate from 1 o'clock to 6 o'clock, it'd just go directly/linearly rather than around. So the length would be very short in the middle of the tween.\nexport function cpCoordsToAngles(segment, copy) {\n\tvar result = copy ? segment.slice(0) : segment,\n\t\tx, y, i;\n\tfor (i = 0; i < segment.length; i+=6) {\n\t\tx = segment[i+2] - segment[i];\n\t\ty = segment[i+3] - segment[i+1];\n\t\tresult[i+2] = Math.atan2(y, x);\n\t\tresult[i+3] = Math.sqrt(x * x + y * y);\n\t\tx = segment[i+6] - segment[i+4];\n\t\ty = segment[i+7] - segment[i+5];\n\t\tresult[i+4] = Math.atan2(y, x);\n\t\tresult[i+5] = Math.sqrt(x * x + y * y);\n\t}\n\treturn result;\n}\n\n// takes a segment that was converted with cpCoordsToAngles() to have angles and lengths instead of coordinates for the control points, and converts it BACK into coordinates.\nexport function cpAnglesToCoords(segment, copy) {\n\tvar result = copy ? segment.slice(0) : segment,\n\t\tlength = segment.length,\n\t\trnd = 1000,\n\t\tangle, l, i, j;\n\tfor (i = 0; i < length; i+=6) {\n\t\tangle = segment[i+2];\n\t\tl = segment[i+3]; //length\n\t\tresult[i+2] = (((segment[i] + Math.cos(angle) * l) * rnd) | 0) / rnd;\n\t\tresult[i+3] = (((segment[i+1] + Math.sin(angle) * l) * rnd) | 0) / rnd;\n\t\tangle = segment[i+4];\n\t\tl = segment[i+5]; //length\n\t\tresult[i+4] = (((segment[i+6] - Math.cos(angle) * l) * rnd) | 0) / rnd;\n\t\tresult[i+5] = (((segment[i+7] - Math.sin(angle) * l) * rnd) | 0) / rnd;\n\t}\n\treturn result;\n}\n\n//adds an \"isSmooth\" array to each segment and populates it with a boolean value indicating whether or not it's smooth (the control points have basically the same slope). For any smooth control points, it converts the coordinates into angle (x, in radians) and length (y) and puts them into the same index value in a smoothData array.\nexport function populateSmoothData(rawPath) {\n\tlet j = rawPath.length,\n\t\tsmooth, segment, x, y, x2, y2, i, l, a, a2, isSmooth, smoothData;\n\twhile (--j > -1) {\n\t\tsegment = rawPath[j];\n\t\tisSmooth = segment.isSmooth = segment.isSmooth || [0, 0, 0, 0];\n\t\tsmoothData = segment.smoothData = segment.smoothData || [0, 0, 0, 0];\n\t\tisSmooth.length = 4;\n\t\tl = segment.length - 2;\n\t\tfor (i = 6; i < l; i += 6) {\n\t\t\tx = segment[i] - segment[i - 2];\n\t\t\ty = segment[i + 1] - segment[i - 1];\n\t\t\tx2 = segment[i + 2] - segment[i];\n\t\t\ty2 = segment[i + 3] - segment[i + 1];\n\t\t\ta = _atan2(y, x);\n\t\t\ta2 = _atan2(y2, x2);\n\t\t\tsmooth = (Math.abs(a - a2) < 0.09);\n\t\t\tif (smooth) {\n\t\t\t\tsmoothData[i - 2] = a;\n\t\t\t\tsmoothData[i + 2] = a2;\n\t\t\t\tsmoothData[i - 1] = _sqrt(x * x + y * y);\n\t\t\t\tsmoothData[i + 3] = _sqrt(x2 * x2 + y2 * y2);\n\t\t\t}\n\t\t\tisSmooth.push(smooth, smooth, 0, 0, smooth, smooth);\n\t\t}\n\t\t//if the first and last points are identical, check to see if there's a smooth transition. We must handle this a bit differently due to their positions in the array.\n\t\tif (segment[l] === segment[0] && segment[l+1] === segment[1]) {\n\t\t\tx = segment[0] - segment[l-2];\n\t\t\ty = segment[1] - segment[l-1];\n\t\t\tx2 = segment[2] - segment[0];\n\t\t\ty2 = segment[3] - segment[1];\n\t\t\ta = _atan2(y, x);\n\t\t\ta2 = _atan2(y2, x2);\n\t\t\tif (Math.abs(a - a2) < 0.09) {\n\t\t\t\tsmoothData[l-2] = a;\n\t\t\t\tsmoothData[2] = a2;\n\t\t\t\tsmoothData[l-1] = _sqrt(x * x + y * y);\n\t\t\t\tsmoothData[3] = _sqrt(x2 * x2 + y2 * y2);\n\t\t\t\tisSmooth[l-2] = isSmooth[l-1] = true; //don't change indexes 2 and 3 because we'll trigger everything from the END, and this will optimize file size a bit.\n\t\t\t}\n\t\t}\n\t}\n\treturn rawPath;\n}\nexport function pointToScreen(svgElement, point) {\n\tif (arguments.length < 2) { //by default, take the first set of coordinates in the path as the point\n\t\tlet rawPath = getRawPath(svgElement);\n\t\tpoint = svgElement.ownerSVGElement.createSVGPoint();\n\t\tpoint.x = rawPath[0][0];\n\t\tpoint.y = rawPath[0][1];\n\t}\n\treturn point.matrixTransform(svgElement.getScreenCTM());\n}\n\n*/","/*!\n * matrix 3.12.4\n * https://gsap.com\n *\n * Copyright 2008-2023, GreenSock. All rights reserved.\n * Subject to the terms at https://gsap.com/standard-license or for\n * Club GSAP members, the agreement issued with that membership.\n * @author: Jack Doyle, jack@greensock.com\n*/\n\n/* eslint-disable */\nvar _doc,\n _win,\n _docElement,\n _body,\n _divContainer,\n _svgContainer,\n _identityMatrix,\n _gEl,\n _transformProp = \"transform\",\n _transformOriginProp = _transformProp + \"Origin\",\n _hasOffsetBug,\n _setDoc = function _setDoc(element) {\n var doc = element.ownerDocument || element;\n\n if (!(_transformProp in element.style) && \"msTransform\" in element.style) {\n //to improve compatibility with old Microsoft browsers\n _transformProp = \"msTransform\";\n _transformOriginProp = _transformProp + \"Origin\";\n }\n\n while (doc.parentNode && (doc = doc.parentNode)) {}\n\n _win = window;\n _identityMatrix = new Matrix2D();\n\n if (doc) {\n _doc = doc;\n _docElement = doc.documentElement;\n _body = doc.body;\n _gEl = _doc.createElementNS(\"http://www.w3.org/2000/svg\", \"g\"); // prevent any existing CSS from transforming it\n\n _gEl.style.transform = \"none\"; // now test for the offset reporting bug. Use feature detection instead of browser sniffing to make things more bulletproof and future-proof. Hopefully Safari will fix their bug soon.\n\n var d1 = doc.createElement(\"div\"),\n d2 = doc.createElement(\"div\"),\n root = doc && (doc.body || doc.firstElementChild);\n\n if (root && root.appendChild) {\n root.appendChild(d1);\n d1.appendChild(d2);\n d1.setAttribute(\"style\", \"position:static;transform:translate3d(0,0,1px)\");\n _hasOffsetBug = d2.offsetParent !== d1;\n root.removeChild(d1);\n }\n }\n\n return doc;\n},\n _forceNonZeroScale = function _forceNonZeroScale(e) {\n // walks up the element's ancestors and finds any that had their scale set to 0 via GSAP, and changes them to 0.0001 to ensure that measurements work. Firefox has a bug that causes it to incorrectly report getBoundingClientRect() when scale is 0.\n var a, cache;\n\n while (e && e !== _body) {\n cache = e._gsap;\n cache && cache.uncache && cache.get(e, \"x\"); // force re-parsing of transforms if necessary\n\n if (cache && !cache.scaleX && !cache.scaleY && cache.renderTransform) {\n cache.scaleX = cache.scaleY = 1e-4;\n cache.renderTransform(1, cache);\n a ? a.push(cache) : a = [cache];\n }\n\n e = e.parentNode;\n }\n\n return a;\n},\n // possible future addition: pass an element to _forceDisplay() and it'll walk up all its ancestors and make sure anything with display: none is set to display: block, and if there's no parentNode, it'll add it to the body. It returns an Array that you can then feed to _revertDisplay() to have it revert all the changes it made.\n// _forceDisplay = e => {\n// \tlet a = [],\n// \t\tparent;\n// \twhile (e && e !== _body) {\n// \t\tparent = e.parentNode;\n// \t\t(_win.getComputedStyle(e).display === \"none\" || !parent) && a.push(e, e.style.display, parent) && (e.style.display = \"block\");\n// \t\tparent || _body.appendChild(e);\n// \t\te = parent;\n// \t}\n// \treturn a;\n// },\n// _revertDisplay = a => {\n// \tfor (let i = 0; i < a.length; i+=3) {\n// \t\ta[i+1] ? (a[i].style.display = a[i+1]) : a[i].style.removeProperty(\"display\");\n// \t\ta[i+2] || a[i].parentNode.removeChild(a[i]);\n// \t}\n// },\n_svgTemps = [],\n //we create 3 elements for SVG, and 3 for other DOM elements and cache them for performance reasons. They get nested in _divContainer and _svgContainer so that just one element is added to the DOM on each successive attempt. Again, performance is key.\n_divTemps = [],\n _getDocScrollTop = function _getDocScrollTop() {\n return _win.pageYOffset || _doc.scrollTop || _docElement.scrollTop || _body.scrollTop || 0;\n},\n _getDocScrollLeft = function _getDocScrollLeft() {\n return _win.pageXOffset || _doc.scrollLeft || _docElement.scrollLeft || _body.scrollLeft || 0;\n},\n _svgOwner = function _svgOwner(element) {\n return element.ownerSVGElement || ((element.tagName + \"\").toLowerCase() === \"svg\" ? element : null);\n},\n _isFixed = function _isFixed(element) {\n if (_win.getComputedStyle(element).position === \"fixed\") {\n return true;\n }\n\n element = element.parentNode;\n\n if (element && element.nodeType === 1) {\n // avoid document fragments which will throw an error.\n return _isFixed(element);\n }\n},\n _createSibling = function _createSibling(element, i) {\n if (element.parentNode && (_doc || _setDoc(element))) {\n var svg = _svgOwner(element),\n ns = svg ? svg.getAttribute(\"xmlns\") || \"http://www.w3.org/2000/svg\" : \"http://www.w3.org/1999/xhtml\",\n type = svg ? i ? \"rect\" : \"g\" : \"div\",\n x = i !== 2 ? 0 : 100,\n y = i === 3 ? 100 : 0,\n css = \"position:absolute;display:block;pointer-events:none;margin:0;padding:0;\",\n e = _doc.createElementNS ? _doc.createElementNS(ns.replace(/^https/, \"http\"), type) : _doc.createElement(type);\n\n if (i) {\n if (!svg) {\n if (!_divContainer) {\n _divContainer = _createSibling(element);\n _divContainer.style.cssText = css;\n }\n\n e.style.cssText = css + \"width:0.1px;height:0.1px;top:\" + y + \"px;left:\" + x + \"px\";\n\n _divContainer.appendChild(e);\n } else {\n _svgContainer || (_svgContainer = _createSibling(element));\n e.setAttribute(\"width\", 0.01);\n e.setAttribute(\"height\", 0.01);\n e.setAttribute(\"transform\", \"translate(\" + x + \",\" + y + \")\");\n\n _svgContainer.appendChild(e);\n }\n }\n\n return e;\n }\n\n throw \"Need document and parent.\";\n},\n _consolidate = function _consolidate(m) {\n // replaces SVGTransformList.consolidate() because a bug in Firefox causes it to break pointer events. See https://gsap.com/forums/topic/23248-touch-is-not-working-on-draggable-in-firefox-windows-v324/?tab=comments#comment-109800\n var c = new Matrix2D(),\n i = 0;\n\n for (; i < m.numberOfItems; i++) {\n c.multiply(m.getItem(i).matrix);\n }\n\n return c;\n},\n _getCTM = function _getCTM(svg) {\n var m = svg.getCTM(),\n transform;\n\n if (!m) {\n // Firefox returns null for getCTM() on root