{
  "version": 3,
  "sources": ["../../node_modules/htmx.org/dist/htmx.esm.js", "../../node_modules/motion-utils/src/array.ts", "../../node_modules/motion-utils/src/clamp.ts", "../../node_modules/motion-utils/src/global-config.ts", "../../node_modules/motion-utils/src/is-numerical-string.ts", "../../node_modules/motion-utils/src/is-object.ts", "../../node_modules/motion-utils/src/is-zero-value-string.ts", "../../node_modules/motion-utils/src/memo.ts", "../../node_modules/motion-utils/src/noop.ts", "../../node_modules/motion-utils/src/pipe.ts", "../../node_modules/motion-utils/src/progress.ts", "../../node_modules/motion-utils/src/subscription-manager.ts", "../../node_modules/motion-utils/src/time-conversion.ts", "../../node_modules/motion-utils/src/velocity-per-second.ts", "../../node_modules/motion-utils/src/wrap.ts", "../../node_modules/motion-utils/src/easing/cubic-bezier.ts", "../../node_modules/motion-utils/src/easing/modifiers/mirror.ts", "../../node_modules/motion-utils/src/easing/modifiers/reverse.ts", "../../node_modules/motion-utils/src/easing/back.ts", "../../node_modules/motion-utils/src/easing/anticipate.ts", "../../node_modules/motion-utils/src/easing/circ.ts", "../../node_modules/motion-utils/src/easing/ease.ts", "../../node_modules/motion-utils/src/easing/utils/is-easing-array.ts", "../../node_modules/motion-utils/src/easing/utils/get-easing-for-segment.ts", "../../node_modules/motion-utils/src/easing/utils/is-bezier-definition.ts", "../../node_modules/motion-utils/src/easing/utils/map.ts", "../../node_modules/motion-dom/src/frameloop/frame-data.ts", "../../node_modules/motion-dom/src/frameloop/sync-time.ts", "../../node_modules/motion-dom/src/value/types/utils/sanitize.ts", "../../node_modules/motion-dom/src/animation/utils/is-css-variable.ts", "../../node_modules/motion-dom/src/value/types/numbers/index.ts", "../../node_modules/motion-dom/src/value/types/utils/float-regex.ts", "../../node_modules/motion-dom/src/value/types/utils/is-nullish.ts", "../../node_modules/motion-dom/src/value/types/utils/single-color-regex.ts", "../../node_modules/motion-dom/src/value/types/color/utils.ts", "../../node_modules/motion-dom/src/value/types/color/rgba.ts", "../../node_modules/motion-dom/src/value/types/color/hex.ts", "../../node_modules/motion-dom/src/value/types/numbers/units.ts", "../../node_modules/motion-dom/src/value/types/color/hsla.ts", "../../node_modules/motion-dom/src/value/types/color/index.ts", "../../node_modules/motion-dom/src/value/types/utils/color-regex.ts", "../../node_modules/motion-dom/src/value/types/complex/index.ts", "../../node_modules/motion-dom/src/value/types/color/hsla-to-rgba.ts", "../../node_modules/motion-dom/src/utils/mix/immediate.ts", "../../node_modules/motion-dom/src/utils/mix/number.ts", "../../node_modules/motion-dom/src/utils/mix/color.ts", "../../node_modules/motion-dom/src/utils/mix/visibility.ts", "../../node_modules/motion-dom/src/utils/mix/complex.ts", "../../node_modules/motion-dom/src/utils/mix/index.ts", "../../node_modules/motion-dom/src/frameloop/order.ts", "../../node_modules/motion-dom/src/frameloop/render-step.ts", "../../node_modules/motion-dom/src/frameloop/batcher.ts", "../../node_modules/motion-dom/src/frameloop/frame.ts", "../../node_modules/motion-dom/src/animation/drivers/frame.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/linear.ts", "../../node_modules/motion-dom/src/animation/generators/utils/calc-duration.ts", "../../node_modules/motion-dom/src/animation/generators/utils/create-generator-easing.ts", "../../node_modules/motion-dom/src/animation/generators/spring.ts", "../../node_modules/motion-dom/src/animation/generators/inertia.ts", "../../node_modules/motion-dom/src/utils/interpolate.ts", "../../node_modules/motion-dom/src/animation/keyframes/offsets/fill.ts", "../../node_modules/motion-dom/src/animation/keyframes/offsets/default.ts", "../../node_modules/motion-dom/src/animation/keyframes/offsets/time.ts", "../../node_modules/motion-dom/src/animation/generators/keyframes.ts", "../../node_modules/motion-dom/src/animation/generators/utils/velocity.ts", "../../node_modules/motion-dom/src/animation/keyframes/get-final.ts", "../../node_modules/motion-dom/src/animation/utils/replace-transition-type.ts", "../../node_modules/motion-dom/src/animation/utils/resolve-start-time.ts", "../../node_modules/motion-dom/src/animation/utils/notify-inspector.ts", "../../node_modules/motion-dom/src/animation/utils/WithPromise.ts", "../../node_modules/motion-dom/src/animation/JSAnimation.ts", "../../node_modules/motion-dom/src/value/types/complex/filter.ts", "../../node_modules/motion-dom/src/value/types/complex/mask.ts", "../../node_modules/motion-dom/src/value/types/int.ts", "../../node_modules/motion-dom/src/value/types/maps/transform.ts", "../../node_modules/motion-dom/src/value/types/maps/number.ts", "../../node_modules/motion-dom/src/value/types/maps/defaults.ts", "../../node_modules/motion-dom/src/value/types/utils/animatable-none.ts", "../../node_modules/motion-dom/src/animation/keyframes/utils/fill-wildcards.ts", "../../node_modules/motion-dom/src/render/dom/parse-transform.ts", "../../node_modules/motion-dom/src/render/utils/keys-transform.ts", "../../node_modules/motion-dom/src/animation/keyframes/utils/unit-conversion.ts", "../../node_modules/motion-dom/src/animation/keyframes/KeyframesResolver.ts", "../../node_modules/motion-dom/src/render/dom/is-css-var.ts", "../../node_modules/motion-dom/src/render/dom/style-set.ts", "../../node_modules/motion-dom/src/utils/supports/flags.ts", "../../node_modules/motion-dom/src/utils/supports/memo.ts", "../../node_modules/motion-dom/src/utils/supports/scroll-timeline.ts", "../../node_modules/motion-dom/src/utils/supports/linear-easing.ts", "../../node_modules/motion-dom/src/animation/waapi/easing/cubic-bezier.ts", "../../node_modules/motion-dom/src/animation/waapi/easing/supported.ts", "../../node_modules/motion-dom/src/animation/waapi/easing/map-easing.ts", "../../node_modules/motion-dom/src/animation/waapi/start-waapi-animation.ts", "../../node_modules/motion-dom/src/animation/generators/utils/is-generator.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/apply-generator.ts", "../../node_modules/motion-dom/src/animation/NativeAnimation.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/unsupported-easing.ts", "../../node_modules/motion-dom/src/animation/NativeAnimationExtended.ts", "../../node_modules/motion-dom/src/animation/utils/is-animatable.ts", "../../node_modules/motion-dom/src/animation/utils/can-animate.ts", "../../node_modules/motion-dom/src/animation/utils/make-animation-instant.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/accelerated-values.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/is-browser-color.ts", "../../node_modules/motion-dom/src/animation/waapi/utils/needs-mixer.ts", "../../node_modules/motion-dom/src/animation/waapi/supports/waapi.ts", "../../node_modules/motion-dom/src/value/types/utils/get-as-type.ts", "../../node_modules/motion-dom/src/render/html/utils/build-transform.ts", "../../node_modules/motion-dom/src/animation/waapi/transforms/groups.ts", "../../node_modules/motion-dom/src/animation/waapi/transforms/TransformAnimation.ts", "../../node_modules/motion-dom/src/animation/AsyncMotionValueAnimation.ts", "../../node_modules/motion-dom/src/animation/GroupAnimation.ts", "../../node_modules/motion-dom/src/animation/GroupAnimationWithThen.ts", "../../node_modules/motion-dom/src/value/index.ts", "../../node_modules/motion-dom/src/animation/utils/resolve-transition.ts", "../../node_modules/motion-dom/src/animation/utils/get-value-transition.ts", "../../node_modules/motion-dom/src/animation/utils/default-transitions.ts", "../../node_modules/motion-dom/src/animation/utils/is-transition-defined.ts", "../../node_modules/motion-dom/src/animation/interfaces/motion-value.ts", "../../node_modules/motion-dom/src/animation/utils/css-variables-conversion.ts", "../../node_modules/motion-dom/src/render/utils/keys-position.ts", "../../node_modules/motion-dom/src/value/utils/is-motion-value.ts", "../../node_modules/motion-dom/src/value/types/auto.ts", "../../node_modules/motion-dom/src/value/types/test.ts", "../../node_modules/motion-dom/src/value/types/dimensions.ts", "../../node_modules/motion-dom/src/animation/keyframes/utils/is-none.ts", "../../node_modules/motion-dom/src/animation/keyframes/utils/make-none-animatable.ts", "../../node_modules/motion-dom/src/animation/keyframes/DOMKeyframesResolver.ts", "../../node_modules/motion-dom/src/animation/animate/effects.ts", "../../node_modules/motion-dom/src/utils/is-html-element.ts", "../../node_modules/motion-dom/src/utils/is-svg-element.ts", "../../node_modules/motion-dom/src/scope/active.ts", "../../node_modules/motion-dom/src/utils/resolve-elements.ts", "../../node_modules/motion-dom/src/effects/MotionValueState.ts", "../../node_modules/motion-dom/src/effects/utils/create-effect.ts", "../../node_modules/motion-dom/src/effects/style/transform.ts", "../../node_modules/motion-dom/src/effects/style/index.ts", "../../node_modules/motion-dom/src/render/dom/utils/camel-to-dash.ts", "../../node_modules/motion-dom/src/render/svg/utils/build-attrs.ts", "../../node_modules/motion-dom/src/effects/attr/index.ts", "../../node_modules/motion-dom/src/effects/svg/index.ts", "../../node_modules/motion-dom/src/projection/geometry/conversion.ts", "../../node_modules/motion-dom/src/projection/utils/measure.ts", "../../node_modules/motion-dom/src/animation/animate/element.ts", "../../node_modules/motion-dom/src/effects/prop/index.ts", "../../node_modules/motion-dom/src/animation/animate/single-value.ts", "../../node_modules/motion-dom/src/render/store.ts", "../../node_modules/framer-motion/src/animation/utils/is-dom-keyframes.ts", "../../node_modules/framer-motion/src/animation/animate/resolve-subjects.ts", "../../node_modules/framer-motion/src/animation/sequence/utils/calc-repeat-duration.ts", "../../node_modules/framer-motion/src/animation/sequence/utils/calc-time.ts", "../../node_modules/framer-motion/src/animation/sequence/utils/edit.ts", "../../node_modules/framer-motion/src/animation/sequence/utils/normalize-times.ts", "../../node_modules/framer-motion/src/animation/sequence/utils/sort.ts", "../../node_modules/framer-motion/src/animation/sequence/create.ts", "../../node_modules/framer-motion/src/animation/animate/subject.ts", "../../node_modules/framer-motion/src/animation/animate/sequence.ts", "../../node_modules/framer-motion/src/animation/timeline/index.ts", "../../node_modules/framer-motion/src/animation/animate/index.ts", "../../frontend/src/offline-queue.js", "../../frontend/src/photo.js", "../../frontend/src/feedback.js", "../../frontend/src/phone.js", "../../frontend/src/app.js"],
  "sourcesContent": ["var htmx = (() => {\n\n    /**\n     * HCON, htmx's mini config language. Mirrors the JSON API.\n     *\n     * Used by hx-trigger, hx-swap, hx-vals, and other htmx config attributes.\n     *\n     * @see https://four.htmx.org/docs#hcon\n     */\n    const HCON = {\n        /**\n         * Parses an HCON string into an object.\n         *\n         * @example\n         * HCON.parse('foo:1 bar:true');     // {foo: 1, bar: true}\n         * HCON.parse('sse.mode:once');      // {sse: {mode: 'once'}}\n         * HCON.parse('{\"foo\": 1}');         // {foo: 1}\n         */\n        parse(string) {\n            if (!string) return {};\n            if (string.startsWith('{')) return JSON.parse(string);\n            let pattern = /(?:\"([^\"]+)\"|'([^']+)'|([^\\s,:]+))(?:\\s*:\\s*(?:\"([^\"]*)\"|'([^']*)'|<((?:[^/]|\\/(?!>))+)\\/>|([^\\s,]+)))?(?=\\s|,|$)/g;\n            let result = {};\n            for (let match of string.matchAll(pattern)) {\n                let [,\n                    doubleQuotedKey,    // \"key\"\n                    singleQuotedKey,    // 'key'\n                    bareKey,            //  key\n                    doubleQuotedValue,  // \"value\"\n                    singleQuotedValue,  // 'value'\n                    hyperscriptValue,   // <value/>\n                    bareValue,          //  value\n                ] = match;\n\n                // pick this match's key and value forms\n                let key = doubleQuotedKey ?? singleQuotedKey ?? bareKey;\n                let value = (doubleQuotedValue ?? singleQuotedValue ?? hyperscriptValue ?? bareValue ?? 'true').trim();\n\n                // JSON-parse if possible (e.g. \"5\" -> 5; \"abc\" stays string)\n                try { value = JSON.parse(value); } catch {}\n\n                // bare a.b -> {a:{b:...}}; quoted \"a.b\" -> {\"a.b\":...}\n                let isDottedPath = bareKey?.includes('.');\n                let pair = isDottedPath\n                    ? key.split('.').reduceRight((acc, segment) => ({[segment]: acc}), value)\n                    : {[key]: value};\n                HCON.merge(pair, result);\n            }\n            return result;\n        },\n\n        /**\n         * Splits an HCON-aware string at top-level commas.\n         * Commas inside [], (), <.../>, \"...\", '...' are preserved.\n         *\n         * @example\n         * HCON.split('a:1, b:2');                // ['a:1', ' b:2']\n         * HCON.split('from:\".a, .b\", click');    // ['from:\".a, .b\"', ' click']\n         */\n        split(string) {\n            return string.split(/,(?![^\\[]*\\])(?![^(]*\\))(?![^<]*\\/>)(?=(?:[^\"']|\"[^\"]*\"|'[^']*')*$)/);\n        },\n\n        /**\n         * Deep-merges a source (HCON string or object) into a target.\n         *\n         * @example\n         * HCON.merge({a: {b: 1}}, {a: {c: 2}});   // {a: {b: 1, c: 2}}\n         * HCON.merge('a.b:1', {a: {c: 2}});       // {a: {b: 1, c: 2}}\n         */\n        merge(source, target) {\n            if (typeof source === 'string') source = HCON.parse(source);\n\n            for (let [key, val] of Object.entries(source)) {\n                if (['__proto__', 'constructor', 'prototype'].includes(key)) continue;\n\n                let sourceIsObject = val?.constructor === Object;\n                let targetIsObject = target[key]?.constructor === Object;\n\n                if (sourceIsObject && targetIsObject) {\n                    HCON.merge(val, target[key]);\n                } else {\n                    target[key] = val;\n                }\n            }\n            return target;\n        },\n    };\n\n    class RequestQueue {\n        #current = null\n        #queue = []\n\n        /** Returns \"run\", \"queued\", or \"dropped\" */\n        admit(strategy, runRequest, abortRequest) {\n            if (!this.#current) {\n                this.#current = {strategy, abort: abortRequest}\n                return \"run\"\n            }\n            if (strategy === \"replace\" || (strategy !== \"abort\" && this.#current.strategy === \"abort\")) {\n                this.#queue = []\n                this.#current.abort?.()\n                this.#current = {strategy, abort: abortRequest}\n                return \"run\"\n            }\n            if (strategy === \"queue all\") {\n                this.#queue.push(runRequest)\n            } else if (strategy === \"queue last\") {\n                this.#queue = [runRequest]\n            } else if (strategy !== \"abort\" && strategy !== \"drop\" && this.#queue.length === 0) {\n                // default queue first\n                this.#queue.push(runRequest)\n            } else {\n                return \"dropped\"\n            }\n            return \"queued\"\n        }\n\n        continue(abortRequest) {\n            if (this.#current?.abort !== abortRequest) return\n            this.#current = null    // free current slot\n            this.#queue.shift()?.() // run next request\n        }\n\n        abort() {\n            this.#current?.abort?.()\n        }\n    }\n\n    class Htmx {\n\n        #HCON = HCON\n        #extMethods = new Map();\n        #approvedExt = '';\n        #registeredExt = new Set();\n        _loc = window.location;  // mockable for testing\n        #internalAPI;\n        #Function = Function;\n        #AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;\n        #ttPolicy = { createHTML: s => s, createScript: s => s };\n        #actionSelector\n        #boostSelector = \"a,form\";\n        #verbs = [\"get\", \"post\", \"put\", \"patch\", \"delete\", \"query\"];\n        #hxOnQuery\n        #transitionQueue\n        #historyAbort\n        #historyInitialized\n        #processingTransition\n\n        constructor() {\n            this.#initHtmxConfig();\n            this.#initRequestIndicatorCss();\n            this.#actionSelector = this.#prefixSelector('[hx-action],[hx-get],[hx-post],[hx-put],[hx-patch],[hx-delete],[hx-query]');\n            this.#hxOnQuery = new XPathEvaluator().createExpression(`.//*[@*[${this.#prefixes(\"hx-on\").map(p => `starts-with(name(), \"${p}\")`).join(' or ')}]]`);\n            this.#internalAPI = {\n                HCON,\n                attributeValue: this.#attributeValue.bind(this),\n                parseTriggerSpecs: this.#parseTriggerSpecs.bind(this),\n                determineMethodAndAction: this.#determineMethodAndAction.bind(this),\n                createRequestContext: this.#createRequestContext.bind(this),\n                collectFormData: this.#collectFormData.bind(this),\n                getAttributeObject: this.#getAttributeObject.bind(this),\n                insertContent: this.#insertContent.bind(this),\n                morph: this.#morph.bind(this),\n                isSoftMatch: this.#isSoftMatch.bind(this),\n                initSecurity: (ttPolicy, syncFn, asyncFn) => {\n                    if (ttPolicy) this.#ttPolicy = ttPolicy;\n                    if (syncFn) this.#Function = syncFn;\n                    if (asyncFn) this.#AsyncFunction = asyncFn;\n                },\n                onTrigger: this.#onTrigger.bind(this),\n                htmxProp: this.#htmxProp.bind(this),\n                triggerHtmxEvent: this.#trigger.bind(this),\n                executeJavaScript: this.#executeJavaScript.bind(this)\n            };\n            let init = () => this.initialize();\n            if (document.readyState === 'loading') {\n                document.addEventListener(\"DOMContentLoaded\", init)\n            } else {\n                setTimeout(init)\n            }\n        }\n\n        #initHtmxConfig() {\n            this.version = '4.0.1'\n            this.config = {\n                logAll: false,\n                prefix: \"data-hx-\",\n                transitions: false,\n                history: true,\n                mode: 'same-origin',\n                defaultSwap: \"innerHTML\",\n                defaultFocusScroll: false,\n                indicatorClass: \"htmx-indicator\",\n                requestClass: \"htmx-request\",\n                includeIndicatorCSS: true,\n                defaultTimeout: 60000, /* 60 second default timeout */\n                extensions: '',\n                morphIgnore: [\"data-htmx-powered\"],\n                morphSkip: '[hx-morph-skip]',\n                morphSkipChildren: '[hx-morph-skip-children]',\n                morphScanLimit: 10,\n                noSwap: [204, 304],\n                implicitInheritance: false,\n                defaultSettleDelay: 1,\n                allowEmptySwapAfterOOB: false\n            }\n            let metaConfig = document.querySelector('meta[name=\"htmx-config\"]');\n            if (metaConfig) {\n                HCON.merge(metaConfig.content, this.config);\n            }\n            this.#approvedExt = this.config.extensions;\n        }\n\n        #initRequestIndicatorCss() {\n            if (this.config.includeIndicatorCSS !== false) {\n                let indicator = this.config.indicatorClass;\n                let request = this.config.requestClass;\n                try {\n                    this.indicatorStyleSheet = new CSSStyleSheet();\n                    this.indicatorStyleSheet.replaceSync(\n                        `.${indicator}{opacity:0;visibility: hidden} ` +\n                        `.${request} .${indicator}, .${request}.${indicator}{opacity:1;visibility: visible;transition: opacity 200ms ease-in}`\n                    );\n                    document.adoptedStyleSheets.push(this.indicatorStyleSheet);\n                } catch {}\n            }\n        }\n\n        registerExtension(name, extension) {\n            if (this.#approvedExt && !this.#approvedExt.split(/,\\s*/).includes(name)) return false;\n            if (this.#registeredExt.has(name)) return false;\n            this.#registeredExt.add(name);\n            if (extension.init) extension.init(this.#internalAPI);\n            Object.entries(extension).forEach(([key, value]) => {\n                if(!this.#extMethods.get(key)?.push(value)) this.#extMethods.set(key, [value]);\n            });\n        }\n\n        #ignore(elt) {\n            let p = this.config.prefix;\n            return !elt.closest || elt.closest('[hx-ignore]') != null || (p && elt.closest(`[${p}ignore]`) != null);\n        }\n\n        #attr(elt, name) {\n            let p = this.config.prefix;\n            return elt.getAttribute(name) ?? (p ? elt.getAttribute(name.replace('hx-', p)) : null);\n        }\n\n        #attrName(elt, name) {\n            let p = this.config.prefix && name.replace('hx-', this.config.prefix);\n            return elt.hasAttribute(name) ? name : (p && elt.hasAttribute(p) ? p : null);\n        }\n\n        #prefixSelector(s) {\n            return this.#prefixes(s).join(',');\n        }\n\n        #prefixes(s) {\n            let result = [s];\n            if (this.config.prefix) result.push(s.replaceAll('hx-', this.config.prefix));\n            return result;\n        }\n\n        #queryEltAndDescendants(elt, selector) {\n            let results = [...(elt.querySelectorAll?.(selector) ?? [])];\n            if (elt.matches?.(selector)) {\n                results.unshift(elt);\n            }\n            return results;\n        }\n\n        #normalizeSwapStyle(style) {\n            return style === 'before' ? 'beforebegin' :\n                   style === 'after' ? 'afterend' :\n                   style === 'prepend' ? 'afterbegin' :\n                   style === 'append' ? 'beforeend' : style;\n        }\n\n        #findThisElements(elt, attrName) {\n            let result = [];\n            this.#attributeValue(elt, attrName, undefined, (val, elt) => {\n                if (val?.split(/\\s*[,:]\\s*/).includes('this')) result.push(elt);\n            });\n            return result;\n        }\n\n        #attributeValue(elt, name, defaultVal, eltCollector, allowInheritance = this.config.implicitInheritance) {\n            name = this.#maybeAdjustMetaCharacter(name);\n            let inherited = this.#maybeAdjustMetaCharacter(\":inherited\");\n            let append = this.#maybeAdjustMetaCharacter(\":append\");\n\n            let val = this.#attr(elt, name) ?? this.#attr(elt, name + inherited);\n            if (val != null) return eltCollector ? eltCollector(val, elt) : val;\n\n            let n1 = CSS.escape(allowInheritance ? name : name + inherited);\n            let n2 = CSS.escape(name + inherited + append);\n            let inheritSelector = this.#prefixSelector(`[${n1}],[${n2}]`);\n            let appendName = this.#attrName(elt, name + append) ?? this.#attrName(elt, name + inherited + append);\n            if (appendName) {\n                let appendValue = elt.getAttribute(appendName);\n                let parent = elt.parentNode?.closest?.(inheritSelector);\n                if (eltCollector) eltCollector(appendValue, elt);\n                if (parent) {\n                    let parentVal = this.#attributeValue(parent, name, undefined, eltCollector, allowInheritance);\n                    return parentVal ? (parentVal + \",\" + appendValue).replace(/[{}]/g, '') : appendValue;\n                }\n                return appendValue;\n            }\n\n            let parent = elt.parentNode?.closest?.(inheritSelector);\n            if (parent) {\n                val = this.#attributeValue(parent, name, undefined, eltCollector);\n                if (!eltCollector && val && allowInheritance) {\n                    this.#triggerExtensions(elt, \"htmx:after:implicitInheritance\", {elt, name, parent})\n                }\n                return val;\n            }\n            return defaultVal;\n        }\n\n        #parseTriggerSpecs(spec) {\n            return HCON.split(spec).flatMap(s => {\n                // support `every 1s [cond]` by moving it next to `every`\n                s = s.replace(/^\\s*every\\s+(\\S+?)\\s*(\\[[^\\]]*\\])/, 'every$2 $1');\n                let [,name,rest] = s.match(/^\\s*(\\S+\\[[^\\]]*\\]|\\S+)\\s*(.*?)\\s*$/) ?? [];\n                if (!name) return [];  // skip empty/whitespace-only tokens\n                if (/\\[[^\\]]*$/.test(name)) throw \"unterminated:\" + name;  // e.g. click[ctrlKey\n                return [{name, ...HCON.parse(rest)}];  // spread modifiers (delay, throttle, etc.) onto result\n            });\n        }\n\n        #determineMethodAndAction(elt, evt) {\n            let method = this.#attributeValue(elt, \"hx-method\");\n            let action = this.#attributeValue(elt, \"hx-action\", undefined, undefined, false);\n            if (!action) {\n                for (let verb of this.#verbs) {\n                    let verbAction = this.#attributeValue(elt, \"hx-\" + verb, undefined, undefined, false);\n                    if (verbAction != null) {\n                        action = verbAction;\n                        method = verb;\n                        break;\n                    }\n                }\n            }\n            if (this.#isBoosted(elt)) {\n                action ||= evt.submitter?.getAttribute?.(\"formAction\") || elt.getAttribute(elt.matches(\"a\") ? \"href\" : \"action\");\n            }\n            method ||= evt.submitter?.getAttribute?.(\"formmethod\") || elt.getAttribute(\"method\") || \"GET\";\n            return {action, method: method.toUpperCase()};\n        }\n\n        #htmxProp(elt) {\n            if (!elt._htmx) {\n                elt._htmx = { listeners: [], triggerSpecs: [] };\n                elt.setAttribute('data-htmx-powered', 'true');\n            }\n            return elt._htmx;\n        }\n\n        #htmxState(elt) {\n            return elt._htmx_state ||= {};\n        }\n\n        #initializeElement(elt) {\n            if (this.#shouldInitialize(elt) && this.#trigger(elt, \"htmx:before:init\", {}, true)) {\n                let htmxProp = this.#htmxProp(elt);\n                htmxProp.initialized = true;\n                htmxProp.eventHandler = this.#createHtmxEventHandler(elt);\n                this.#initializeTriggers(elt);\n                this.#trigger(elt, \"htmx:after:init\", {}, true)\n            }\n        }\n\n        #createHtmxEventHandler(elt) {\n            return async (evt) => {\n                try {\n                    let ctx = this.#createRequestContext(elt, evt);\n                    await this.#handleTriggerEvent(ctx);\n                } catch (e) {\n                    this.#trigger(elt, 'htmx:error', { error: e });\n                }\n            };\n        }\n\n        #createRequestContext(sourceElement, sourceEvent) {\n            let {action, method} = this.#determineMethodAndAction(sourceElement, sourceEvent);\n            let [fullAction, anchor] = (action || '').split('#');\n            let ac = new AbortController();\n            let ctx = {\n                sourceElement,\n                sourceEvent,\n                status: \"created\",\n                select: this.#attributeValue(sourceElement, \"hx-select\"),\n                selectOOB: this.#attributeValue(sourceElement, \"hx-select-oob\"),\n                target: this.#attributeValue(sourceElement, \"hx-target\"),\n                swap: this.#attributeValue(sourceElement, \"hx-swap\") ?? this.config.defaultSwap,\n                push: this.#attributeValue(sourceElement, \"hx-push-url\"),\n                replace: this.#attributeValue(sourceElement, \"hx-replace-url\"),\n                transition: this.config.transitions,\n                confirm: this.#attributeValue(sourceElement, \"hx-confirm\"),\n                request: {\n                    validate: \"true\" === this.#attributeValue(sourceElement, \"hx-validate\", sourceElement.matches('form') && !sourceElement.noValidate && !sourceEvent.submitter?.formNoValidate ? \"true\" : \"false\", undefined, false),\n                    action: fullAction,\n                    anchor,\n                    method,\n                    headers: this.#createCoreHeaders(sourceElement),\n                    abort: ac.abort.bind(ac),\n                    credentials: \"same-origin\",\n                    signal: ac.signal,\n                    mode: this.config.mode\n                }\n            };\n            // Apply boost config overrides\n            if (sourceElement._htmx?.boosted) {\n                HCON.merge(sourceElement._htmx.boosted, ctx);\n            }\n            ctx.target = this.#resolveTarget(sourceElement, ctx.target);\n            if (ctx.target) {\n                ctx.request.headers[\"HX-Target\"] = this.#buildIdentifier(ctx.target);\n            }\n\n            // Apply hx-config overrides\n            let hxConfig = this.#attributeValue(sourceElement, \"hx-config\");\n            if (hxConfig) {\n                HCON.merge(hxConfig, ctx.request);\n                ctx.request.mode = this.config.mode;  // mode is security-sensitive, never allow per-element override\n            }\n            return ctx;\n        }\n\n        #buildIdentifier(elt) {\n            return `${elt.tagName.toLowerCase()}${elt.id ? '#' + encodeURI(elt.id) : ''}`;\n        }\n\n        #createCoreHeaders(elt) {\n            let headers = {\n                \"HX-Request\": \"true\",\n                \"HX-Source\": this.#buildIdentifier(elt),\n                \"HX-Current-URL\": location.href,\n                \"Accept\": \"text/html\"\n            };\n            if (this.#isBoosted(elt)) {\n                headers[\"HX-Boosted\"] = \"true\"\n            }\n            return headers;\n        }\n\n        #handleHxHeaders(elt, ctx) {\n            return this.#getAttributeObject(elt, \"hx-headers\", obj => {\n                for (let key in obj) ctx.request.headers[key] = String(obj[key]);\n            }, {ctx});\n        }\n\n        #resolveTarget(elt, selector) {\n            if (selector instanceof Element) {\n                return selector;\n            } else if (selector != null) {\n                return this.#findOrWarn(elt, selector, \"hx-target\");\n            } else if (this.#isBoosted(elt)) {\n                return document.body\n            } else {\n                return elt;\n            }\n        }\n\n        #isBoosted(elt) {\n            return elt?._htmx?.boosted;\n        }\n\n        async #handleTriggerEvent(ctx) {\n            let elt = ctx.sourceElement\n            let evt = ctx.sourceEvent\n            if (!elt.isConnected) return\n\n            if (this.#isModifierKeyClick(evt)) return\n\n            if (this.#shouldCancel(evt)) evt.preventDefault()\n\n            // determine if request uses query params\n            let usesQueryParams = /GET|DELETE/.test(ctx.request.method);\n\n            // Only include *enclosing* form info for request types that do not use\n            // query parameters (can still be included explicitly with hx-include)\n            let form = usesQueryParams\n                ? (elt.matches('form') ? elt : null)\n                : (elt.form || elt.closest(\"form\"))\n\n            // Build request body\n            let body = this.#collectFormData(elt, form, evt.submitter, ctx.request.validate, usesQueryParams)\n            if (!body) return  // Validation failed\n            let valsResult = this.#getAttributeObject(elt, \"hx-vals\", obj => {\n                ctx.vals = obj; // make available for json extensions\n                for (let key in obj) body.set(key, obj[key]);\n            }, {ctx});\n            if (valsResult) await valsResult; // Only await if it returned a promise\n            if (ctx.values) {\n                for (let k in ctx.values) {\n                    body.delete(k);\n                    body.append(k, ctx.values[k]);\n                }\n            }\n\n            // Handle dynamic headers\n            let headersResult = this.#handleHxHeaders(elt, ctx)\n            if (headersResult) await headersResult  // Only await if it returned a promise\n\n            // Setup event-dependent request details\n            Object.assign(ctx.request, {\n                form,\n                submitter: evt.submitter,\n                body\n            })\n\n            if (!this.#trigger(elt, \"htmx:config:request\", {ctx: ctx})) return\n            if (ctx.request.method === 'DIALOG') return\n\n            let javascriptContent = this.#extractJavascriptContent(ctx.request.action);\n            if (javascriptContent != null) {\n                let data = Object.fromEntries(ctx.request.body);\n                await this.#executeJavaScript(ctx.sourceElement, data, javascriptContent, false);\n                return\n            } else if (usesQueryParams) {\n                let url = new URL(ctx.request.action, document.baseURI);\n\n                for (let key of ctx.request.body.keys()) {\n                    url.searchParams.delete(key);\n                }\n                for (let [key, value] of ctx.request.body) {\n                    url.searchParams.append(key, value);\n                }\n\n                // Keep relative if same origin, otherwise use full URL\n                if (url.origin === location.origin) {\n                    ctx.request.action = url.pathname + url.search;\n                } else {\n                    ctx.request.action = url.href;\n                }\n                ctx.request.body = null;\n            } else if ((this.#attributeValue(elt, \"hx-encoding\") ?? form?.enctype) !== \"multipart/form-data\") {\n                ctx.request.body = new URLSearchParams(ctx.request.body);\n            }\n\n            await this.#issueRequest(ctx);\n        }\n\n        async #issueRequest(ctx) {\n            let elt = ctx.sourceElement\n            let syncStrategy = this.#determineSyncStrategy(elt);\n            let requestQueue = this.#getRequestQueue(elt);\n            this.#initializeAbortListener(elt);\n\n            let abortRequest = () => ctx.request?.abort?.()\n\n            if (requestQueue.admit(\n                syncStrategy,\n                () => this.#issueRequest(ctx), // run when ready\n                abortRequest                  // abort if replaced\n            ) !== \"run\") return\n\n            ctx.status = \"issuing\"\n            ctx.indicators ??= [];\n            ctx.disabledElements ??= [];\n\n            try {\n                // Handle confirmation\n                if (ctx.confirm) {\n                    let confirmed = await new Promise(resolve => {\n                        let detail = {ctx, issueRequest: () => resolve(true), dropRequest: () => resolve(false)};\n                        if (this.#trigger(elt, \"htmx:confirm\", detail)) {\n                            let js = this.#extractJavascriptContent(ctx.confirm);\n                            resolve(js ? this.#executeJavaScript(elt, {ctx}, js, true) : window.confirm(ctx.confirm));\n                        }\n                    });\n                    if (!confirmed) return;\n                }\n\n                // initialize timeout & indicators after confirmation\n                this.#initTimeout(ctx);\n                this.#showIndicators(ctx);\n                this.#disableElements(ctx);\n\n                ctx.fetch ||= window.fetch.bind(window)\n                // Set HX-Request-Type based on final target/select (after all modifications)\n                ctx.request.headers[\"HX-Request-Type\"] = (ctx.target === document.body || ctx.select) ? \"full\" : \"partial\";\n                if (!this.#trigger(elt, \"htmx:before:request\", {ctx})) return;\n\n                let response = await ctx.fetch(ctx.request.action, ctx.request);\n\n                ctx.response = {\n                    raw: response,\n                    status: response.status,\n                    headers: response.headers,\n                }\n                this.#extractHxHeaders(ctx);\n                if (!this.#trigger(elt, \"htmx:before:response\", {ctx})) return;\n                ctx.text = await response.text();\n                if (!this.#trigger(elt, \"htmx:after:request\", {ctx})) return;\n\n                if (ctx.response.status >= 400) {\n                    this.#trigger(elt, \"htmx:response:error\", {ctx})\n                }\n\n                if(this.#handleHeadersAndMaybeReturnEarly(ctx)){\n                    ctx.keepIndicators = true;\n                    return\n                }\n\n                if (ctx.status === \"issuing\") {\n                    if (ctx.hx.retarget) ctx.target = ctx.hx.retarget;   // HX-Retarget\n                    if (ctx.hx.reswap) ctx.swap = ctx.hx.reswap;       // HX-Reswap\n                    if (ctx.hx.reselect) ctx.select = ctx.hx.reselect; // HX-Reselect\n                    if (ctx.target?.isConnected === false) return; // prevent swap and side effects if target just got removed\n                    ctx.status = \"response received\";\n                    this.#handleStatusCodes(ctx);\n                    await this.swap(ctx);\n                    ctx.status = \"swapped\";\n                }\n\n            } catch (error) {\n                ctx.status = \"error: \" + error;\n                if (error?.name !== 'AbortError' || ctx.request.signal.reason === 'timeout') this.#trigger(elt, \"htmx:error\", {ctx, error})\n            } finally {\n                // An extension that took over the response reports when it has\n                // finished delivering. Undefined for a normal request.\n                await ctx.extensionPromise?.catch(() => {});\n                clearTimeout(ctx.requestTimeout);\n                if (ctx.hx?.trigger) { // HX-Trigger\n                    this.#handleTriggerHeader(ctx.hx.trigger, ctx.sourceElement);\n                }\n                this.#trigger(elt, \"htmx:finally:request\", {ctx})\n                if (!ctx.keepIndicators) {\n                    this.#hideIndicators(ctx.indicators);\n                    this.#enableElements(ctx.disabledElements);\n                }\n\n                requestQueue.continue(abortRequest)\n            }\n        }\n\n        // Extract HX-* response headers into ctx.hx\n        // Maps: HX-Trigger -> ctx.hx.trigger, HX-Push-Url -> ctx.hx.pushurl, etc.\n        #extractHxHeaders(ctx) {\n            ctx.hx = {}\n            for (let [k, v] of ctx.response.raw.headers) {\n                if (k.toLowerCase().startsWith('hx-')) {\n                    ctx.hx[k.slice(3).toLowerCase().replace(/-/g, '')] = v\n                }\n            }\n        }\n\n        // Handle response headers that abort normal swap processing.\n        // Returns true if the response was fully handled by a header.\n        #handleHeadersAndMaybeReturnEarly(ctx) {\n            if (ctx.hx.refresh === 'true') { // HX-Refresh\n                this._loc.reload();\n                return true\n            }\n            if (ctx.hx.redirect) { // HX-Redirect\n                this._loc.href = ctx.hx.redirect;\n                return true\n            }\n            if (ctx.hx.location) { // HX-Location\n                let path = ctx.hx.location, opts = {};\n                let parsed = HCON.parse(path);\n                if (path[0] === '{' || parsed.path != null) {\n                    opts = parsed;\n                    path = opts.path;\n                    delete opts.path;\n                }\n                if (opts.push == null && opts.replace == null) opts.push = 'true';\n                opts.indicators = ctx.indicators;\n                opts.disabledElements = ctx.disabledElements;\n                this.ajax('GET', path, opts);\n                return true\n            }\n        }\n\n        #initTimeout(ctx) {\n            let timeout = ctx.request.timeout != null\n                ? this.parseInterval(ctx.request.timeout)\n                : this.config.defaultTimeout;\n            if (timeout) {\n                ctx.requestTimeout = setTimeout(() => ctx.request?.abort?.('timeout'), timeout);\n            }\n        }\n\n        #determineSyncStrategy(elt) {\n            let hxSync = this.#attributeValue(elt, \"hx-sync\");\n            if (!hxSync) return \"queue first\";\n            let strategy = hxSync.split(\":\").pop().trim();\n            return /^(drop|abort|replace|queue)/.test(strategy) ? strategy : \"queue first\";\n        }\n\n        #getRequestQueue(elt) {\n            let hxSync = this.#attributeValue(elt, \"hx-sync\");\n            let syncElt = elt\n            if (hxSync) {\n                let selector = hxSync.includes(\":\")\n                    ? hxSync.slice(0, hxSync.lastIndexOf(\":\")).trim()\n                    : (/^(drop|abort|replace|queue)/.test(hxSync) ? null : hxSync);\n                if (selector) syncElt = this.#findOrWarn(elt, selector, \"hx-sync\") || elt;\n            }\n            return this.#htmxState(syncElt).rq ||= new RequestQueue()\n        }\n\n        #isModifierKeyClick(evt) {\n            return evt.type === 'click' && (evt.ctrlKey || evt.metaKey || evt.shiftKey)\n                && !!evt.currentTarget?.closest?.('a[href]')\n        }\n\n        #shouldCancel(evt) {\n            let elt = evt.currentTarget\n            let isSubmit = evt.type === 'submit' && elt?.tagName === 'FORM'\n            if (isSubmit) return true\n\n            let isClick = evt.type === 'click' && evt.button === 0\n            if (!isClick) return false\n\n            let btn = elt?.closest?.('button, input[type=\"submit\"], input[type=\"image\"]')\n            let form = btn?.form || btn?.closest('form')\n            let isSubmitButton = btn && !btn.disabled && form &&\n                (btn.type === 'submit' || btn.type === 'image' || (!btn.type && btn.tagName === 'BUTTON'))\n            if (isSubmitButton) return true\n\n            let link = elt?.closest?.('a')\n            if (!link || !link.href) return false\n\n            let href = link.getAttribute('href')\n            let isFragmentOnly = href && href.startsWith('#') && href.length > 1\n            return !isFragmentOnly\n        }\n\n        #initializeTriggers(elt, initialHandler = elt._htmx.eventHandler) {\n            let hxTrigger = this.#attributeValue(elt, \"hx-trigger\", undefined, undefined, false);\n            let trigger = hxTrigger || (elt.matches(\"form\") ? \"submit\" :\n                elt.matches(\"input:not([type=button]):not([type=submit]),select,textarea\") ? \"change\" :\n                    \"click\");\n            this.#onTrigger(elt, trigger, initialHandler)\n        }\n\n        // Wire up event listeners with full modifier support (once, prevent, stop,\n        // delay, throttle, changed, capture, passive, from, filter, etc.)\n        #onTrigger(elt, specString, handler) {\n            let specs = this.#parseTriggerSpecs(specString)\n            this.#htmxProp(elt).triggerSpecs.push(...specs)\n\n            for (let spec of specs) {\n                spec.listeners = []\n\n                let [eventName, filter] = this.#extractFilter(spec.name);\n\n                // Resolve from: elements (self listens on elt but filters by event.target in guard)\n                let fromElts = [elt];\n                if (spec.from === 'outside') fromElts = [document];\n                else if (spec.from && spec.from !== 'self') fromElts = this.#findAllExt(elt, spec.from);\n\n                // Inner: runs after delay/throttle resolves\n                let inner = (evt) => {\n                    if (spec.halt || spec.prevent) evt.preventDefault();\n                    if (spec.halt || spec.stop || spec.consume) evt.stopPropagation();\n                    if (spec.changed) {\n                        let values = this.#htmxState(elt).changedValues ??= new WeakMap();\n                        let target = evt.target;\n                        if (!['checkbox', 'radio'].includes(target?.type)) {\n                            let value = target?.value;\n                            if (values.has(target) && values.get(target) === value) return;\n                            values.set(target, value);\n                        }\n                    }\n                    if (spec.once) {\n                        for (let info of spec.listeners) info.fromElt.removeEventListener(info.eventName, info.handler, info);\n                    }\n                    handler(evt);\n                };\n\n                // Wrap inner with delay/throttle if needed\n                let timed = inner;\n                if (spec.delay) {\n                    timed = evt => {\n                        clearTimeout(spec.timeout);\n                        spec.timeout = setTimeout(() => inner(evt), this.parseInterval(spec.delay));\n                    };\n                } else if (spec.throttle) {\n                    timed = evt => {\n                        if (spec.throttled) {\n                            spec.throttledEvent = evt;\n                        } else {\n                            spec.throttled = true;\n                            inner(evt);\n                            spec.throttleTimeout = setTimeout(() => {\n                                spec.throttled = false;\n                                if (spec.throttledEvent) {\n                                    let e = spec.throttledEvent;\n                                    spec.throttledEvent = null;\n                                    timed(e);\n                                }\n                            }, this.parseInterval(spec.throttle));\n                        }\n                    };\n                }\n\n                // Guarded: pre-timing checks that determine if event should proceed\n                spec.handler = (evt) => {\n                    if (this.#shouldCancel(evt)) evt.preventDefault();\n                    if (spec.from === 'self' && evt.target !== elt) return;\n                    if (spec.from === 'outside' && elt.contains(evt.target)) return;\n                    if (spec.target && !evt.target?.matches?.(spec.target)) return;\n                    if (filter) {\n                        let evtArgs = {}; for (let k in evt) if (/^[a-z]+$/i.test(k)) evtArgs[k] = evt[k];\n                        if (!this.#executeJavaScript(elt, evtArgs, filter, true, false)) return;\n                    }\n                    // a new trigger replaces any pending delayed or throttled trigger on this element\n                    if (eventName !== 'every') {\n                        for (let other of this.#htmxProp(elt).triggerSpecs) {\n                            clearTimeout(other.timeout);\n                            other.throttledEvent = null;\n                        }\n                    }\n                    timed(evt);\n                };\n\n                // Intersect/revealed: set up observer\n                if (eventName === 'intersect' || eventName === 'revealed') {\n                    let observerOptions = {rootMargin: spec.rootMargin};\n                    if (spec.root) observerOptions.root = this.#findOrWarn(elt, spec.root);\n                    if (spec.threshold) observerOptions.threshold = parseFloat(spec.threshold);\n                    let isRevealed = eventName === 'revealed';\n                    spec.observer = new IntersectionObserver((entries) => {\n                        for (let i = 0; i < entries.length; i++) {\n                            if (entries[i].isIntersecting) {\n                                this.trigger(entries[i].target, 'intersect', {}, false);\n                                if (isRevealed) spec.observer.disconnect();\n                                break;\n                            }\n                        }\n                    }, observerOptions);\n                    eventName = 'intersect';\n                    for (let fromElt of fromElts) spec.observer.observe(fromElt);\n                }\n\n                // Every: set up interval\n                if (eventName === \"every\") {\n                    let interval = Object.keys(spec).find(k => k !== 'name');\n                    spec.interval = setInterval(() => {\n                        if (elt.isConnected) this.#trigger(elt, 'every', {}, false);\n                        else clearInterval(spec.interval);\n                    }, this.parseInterval(interval));\n                }\n\n                // Load: fire immediately, no listener needed\n                if (eventName === 'load') {\n                    spec.handler(new CustomEvent('load'));\n                    continue;\n                }\n\n                // Register listeners\n                for (let fromElt of fromElts) {\n                    let listenerInfo = {fromElt, eventName, handler: spec.handler,\n                        capture: !!spec.capture, passive: !!spec.passive};\n                    elt._htmx.listeners.push(listenerInfo);\n                    spec.listeners.push(listenerInfo);\n                    fromElt.addEventListener(eventName, spec.handler, listenerInfo);\n                }\n            }\n        }\n\n        #extractFilter(str) {\n            let match = str.match(/^([^\\[]*)\\[([^\\]]*)]/);\n            if (!match) return [str, null];\n            return [match[1], match[2]];\n        }\n\n        #handleTriggerHeader(value, elt) {\n            if (value[0] === '{') {\n                let triggers = HCON.parse(value);\n                for (let name in triggers) {\n                    let detail = triggers[name];\n                    let target = elt;\n                    if (detail?.target) {\n                        target = this.find(detail.target);\n                    }\n                    this.trigger(target, name, typeof detail === 'object' ? detail : {value: detail});\n                }\n            } else {\n                value.split(',').forEach(name => this.trigger(elt, name.trim(), {}));\n            }\n        }\n\n        #apiMethods(thisArg) {\n            let bound = {};\n            let proto = Object.getPrototypeOf(this);\n            for (let name of Object.getOwnPropertyNames(proto)) {\n                if (name !== 'constructor' && typeof this[name] === 'function') {\n                    if ([\"find\", \"findAll\"].includes(name)) {\n                        bound[name] = (arg1, arg2) => {\n                            if (arg2 === undefined) {\n                                return this[name](thisArg, arg1)\n                            } else {\n                                return this[name](arg1, arg2)\n                            }\n                        }\n                    } else {\n                        bound[name] = this[name].bind(this);\n                    }\n                }\n            }\n            return bound;\n        }\n\n        #executeJavaScript(thisArg, obj, code, expression = true, isAsync = true, compile = false) {\n            let args = {}\n            Object.assign(args, this.#apiMethods(thisArg))\n            let scope = {};\n            let detail = { scope, code };\n            this.#triggerExtensions(thisArg, \"htmx:scope\", detail);\n            code = detail.code;\n            Object.assign(args, scope);\n            Object.assign(args, obj)\n            let keys = Object.keys(args);\n            let values = Object.values(args);\n            let FunctionConstructor = isAsync ? this.#AsyncFunction : this.#Function;\n            let func = new FunctionConstructor(...keys, expression ? `return (${code})` : code);\n            return compile ? () => func.call(thisArg, ...values) : func.call(thisArg, ...values);\n        }\n\n        /**\n         * Initialize htmx attributes on root and all its descendants. When force is true, root\n         * and every powered descendant are first torn down and re-wired from their current\n         * attributes - use this after mutating hx-* attributes on an already-processed element.\n         * @see https://four.htmx.org/reference/methods/htmx-process\n         * @param {Element | ShadowRoot} root\n         * @param {boolean} [force]\n         */\n        process(root, force) {\n            if (!root?.isConnected) return;\n            if (!(root instanceof Element)) { // ShadowRoot\n                for (let elt of root.children || []) this.process(elt, force);\n                return;\n            }\n            if (force) this.#cleanup(root, true);\n            if (this.#ignore(root)) return;\n            if (!this.#trigger(root, \"htmx:before:process\")) return\n            let hxOnNodes = [root];\n            let iter = this.#hxOnQuery.evaluate(root)\n            let node = null\n            while (node = iter.iterateNext()) hxOnNodes.push(node)\n            for (let hxOnNode of hxOnNodes) {\n                if (!this.#ignore(hxOnNode) && this.#trigger(hxOnNode, \"htmx:before:on:init\", {}, true)) {\n                    this.#handleHxOnAttributes(hxOnNode);\n                }\n            }\n            for (let elt of this.#queryEltAndDescendants(root, this.#actionSelector)) {\n                this.#initializeElement(elt);\n            }\n            for (let elt of this.#queryEltAndDescendants(root, this.#boostSelector)) {\n                this.#maybeBoost(elt);\n            }\n            this.#trigger(root, \"htmx:after:process\");\n        }\n\n        #maybeBoost(elt) {\n            let hxBoost = this.#attributeValue(elt, \"hx-boost\");\n            if (hxBoost && hxBoost !== \"false\" && this.#shouldBoost(elt) && this.#trigger(elt, \"htmx:before:init\", {}, true)) {\n                let htmxProp = this.#htmxProp(elt);\n                htmxProp.initialized = true;\n                htmxProp.eventHandler = this.#createHtmxEventHandler(elt);\n                htmxProp.boosted = hxBoost;\n                this.#initializeTriggers(elt);\n                this.#trigger(elt, \"htmx:after:init\", {}, true)\n            }\n        }\n\n        #shouldBoost(elt) {\n            if (this.#shouldInitialize(elt)) {\n                if (elt.tagName === \"A\") {\n                    if (elt.target === '' || elt.target === '_self') {\n                        return !elt.hasAttribute('download') && !elt.getAttribute('href')?.startsWith?.(\"#\") && this.#isSameOrigin(elt.href)\n                    }\n                } else if (elt.tagName === \"FORM\") {\n                    return elt.method !== 'dialog' &&  this.#isSameOrigin(elt.action);\n                }\n            }\n        }\n\n        #isSameOrigin(url) {\n            try {\n                // URL constructor handles both relative and absolute URLs\n                const parsed = new URL(url, window.location.href);\n                return parsed.origin === window.location.origin;\n            } catch (e) {\n                // If URL parsing fails, assume not same-origin\n                return false;\n            }\n        }\n\n        #shouldInitialize(elt) {\n            return !elt._htmx?.initialized && !this.#ignore(elt);\n        }\n\n        /**\n         * Remove listeners, timers, and observers from elt and all its powered descendants.\n         * When force is true, also delete their htmx state so a re-process fully re-initializes them.\n         * @param {Element} elt\n         * @param {boolean} [force]\n         */\n        #cleanup(elt, force) {\n            let elts = [elt, ...elt.querySelectorAll?.('[data-htmx-powered]') ?? []];\n            for (let e of elts) {\n                if (!e._htmx) continue;\n                this.#trigger(e, \"htmx:before:cleanup\")\n                for (let spec of e._htmx.triggerSpecs || []) {\n                    if (spec.interval) clearInterval(spec.interval);\n                    if (spec.timeout) clearTimeout(spec.timeout);\n                    if (spec.throttleTimeout) clearTimeout(spec.throttleTimeout);\n                    spec.observer?.disconnect()\n                }\n                for (let info of e._htmx.listeners || []) {\n                    info.fromElt.removeEventListener(info.eventName, info.handler, info);\n                }\n                e.removeAttribute('data-htmx-powered');\n                this.#trigger(e, \"htmx:after:cleanup\")\n                if (force) delete e._htmx;\n            }\n        }\n\n        #handlePreservedElements(fragment) {\n            let pantry = document.createElement('div');\n            pantry.hidden = true;\n            document.body.insertAdjacentElement('afterend', pantry);\n            let newPreservedElts = fragment.querySelectorAll?.(this.#prefixSelector('[hx-preserve]')) || [];\n            for (let preservedElt of newPreservedElts) {\n                let currentElt = document.getElementById(preservedElt.id);\n                if (currentElt) {\n                    this.#moveBefore(pantry, currentElt, null);\n                }\n            }\n            return pantry\n        }\n\n        #restorePreservedElements(pantry) {\n            for (let preservedElt of [...pantry.children]) {\n                let newElt = document.getElementById(preservedElt.id);\n                if (newElt) {\n                    this.#moveBefore(newElt.parentNode, preservedElt, newElt);\n                    this.#cleanup(newElt)\n                    newElt.remove()\n                }\n            }\n            pantry.remove();\n        }\n\n        #parseHTML(resp) {\n            let trusted = this.#ttPolicy.createHTML(resp);\n            // {} works around Chrome 150-156 dropping comments :/\n            return Document.parseHTMLUnsafe?.(trusted, {}) || new DOMParser().parseFromString(trusted, 'text/html');\n        }\n\n        #makeFragment(text) {\n            // Convert <hx-*> tags (e.g. <hx-partial>, <hx-oob>) to <template hx type=\"*\">\n            let response = text.replace(/<hx-([a-z]+)(\\s+|>)/gi, '<template hx type=\"$1\"$2').replace(/<\\/hx-[a-z]+>/gi, '</template>');\n            let title = '';\n            response = response.replace(/<head(\\s[^>]*)?>[\\s\\S]*?<\\/head>/i, m => (title = this.#parseHTML(m).title, ''));\n            let startTag = response.match(/<([a-z][^\\/>\\x20\\t\\r\\n\\f]*)/i)?.[1]?.toLowerCase();\n\n            let doc, fragment;\n            if (startTag === 'html' || startTag === 'body') {\n                doc = this.#parseHTML(response);\n                fragment = document.createDocumentFragment();\n                fragment.append(doc.body);\n            } else {\n                doc = this.#parseHTML(`<template>${response}</template>`);\n                fragment = doc.querySelector('template').content;\n            }\n\n            if (!title) {\n                let titleElt = fragment.querySelector('title:not(svg title)');\n                if (titleElt) {\n                    title = titleElt.textContent;\n                    titleElt.remove();\n                }\n            }\n\n            this.#processScripts(fragment);\n\n            return {\n                fragment,\n                title\n            };\n        }\n\n        #createOOBTask(tasks, elt, oobValue, sourceElement) {\n            let targetSelector = elt.id ? '#' + CSS.escape(elt.id) : null;\n            // if oobValue is in \"swapStyle:selector\" form (no space before colon), split it; otherwise treat as HCON\n            let [, style, sel] = oobValue.match(/^(\\S+):(.+)/) ?? [];\n            if (style) [oobValue, targetSelector] = [style, sel || targetSelector];\n            if (oobValue === 'true' || !oobValue) oobValue = 'outerHTML';\n\n            let swapSpec = this.#parseSwapSpec(oobValue);\n            targetSelector = swapSpec.target || targetSelector;\n            swapSpec.strip ??= !swapSpec.style.startsWith('outer');\n            if (!targetSelector) return;\n            let targets = this.#findAllExt(sourceElement, targetSelector);\n            for (let target of targets) {\n                let fragment = document.createDocumentFragment();\n                fragment.append(elt.cloneNode(true));\n                tasks.push({type: 'oob', fragment, target, swapSpec, sourceElement});\n            }\n            elt.remove();\n        }\n\n        #processOOB(fragment, sourceElement, selectOOB) {\n            let tasks = [];\n\n            // Process hx-select-oob first (select elements from response)\n            if (selectOOB) {\n                for (let spec of selectOOB.split(',')) {\n                    let [selector, oobValue = 'true'] = spec.split(/:(.*)/);\n                    for (let elt of fragment.querySelectorAll(selector)) {\n                        this.#createOOBTask(tasks, elt, oobValue, sourceElement);\n                    }\n                }\n            }\n\n            // Process elements with hx-swap-oob attribute\n            for (let oobElt of fragment.querySelectorAll(this.#prefixSelector('[hx-swap-oob]'))) {\n                let oobAttr = this.#attrName(oobElt, 'hx-swap-oob');\n                let oobValue = oobElt.getAttribute(oobAttr);\n                oobElt.removeAttribute(oobAttr);\n                this.#createOOBTask(tasks, oobElt, oobValue, sourceElement);\n            }\n            return tasks;\n        }\n\n        #insertNodes(parent, before, fragment) {\n            if (before) {\n                before.before(...fragment.childNodes);\n            } else {\n                parent.append(...fragment.childNodes);\n            }\n        }\n\n        #parseSwapSpec(swapStr) {\n            swapStr = swapStr.trim();\n            let style = this.config.defaultSwap\n            if (swapStr && !/^\\S*:/.test(swapStr)) {\n                let m = swapStr.match(/^(\\S+)\\s*(.*)$/);\n                style = m[1];\n                swapStr = m[2];\n            }\n            return {style: this.#normalizeSwapStyle(style), ...HCON.parse(swapStr)};\n        }\n\n        #processPartials(fragment, ctx) {\n            let tasks = [];\n\n            for (let templateElt of fragment.querySelectorAll('template[hx]')) {\n                let type = templateElt.getAttribute('type');\n                \n                if (type === 'partial') {\n                    let targetSelector = this.#attr(templateElt, 'hx-target') || (templateElt.id ? '#' + CSS.escape(templateElt.id) : null);\n                    if (targetSelector) {\n                        this.#processScripts(templateElt.content);\n                        let swapSpec = this.#parseSwapSpec(this.#attr(templateElt, 'hx-swap') || this.config.defaultSwap);\n                        if (swapSpec.ignoreTitle) ctx.title = null;\n                        let targets = this.#findAllExt(ctx.sourceElement, targetSelector);\n                        for (let target of targets.length ? targets : [null]) {\n                            tasks.push({\n                                type: 'partial',\n                                fragment: templateElt.content.cloneNode(true),\n                                target,\n                                swapSpec,\n                                sourceElement: ctx.sourceElement\n                            });\n                        }\n                    }\n                } else {\n                    this.#triggerExtensions(templateElt, 'htmx:process:' + type, { ctx, tasks });\n                }\n                templateElt.remove();\n            }\n\n            return tasks;\n        }\n\n        #setFocus(elt, options, start, end) {\n            try {\n                if (start != null && elt.setSelectionRange) {\n                    elt.setSelectionRange(start, end);\n                }\n                elt.focus(options);\n            } catch (e) {\n                // setSelectionRange or Web component focus may fail so ignore\n            }\n        }\n\n        #handleAutoFocus(elt) {\n            let autofocus = this.#queryEltAndDescendants(elt, '[autofocus]')[0];\n            if (autofocus) {\n                this.#setFocus(autofocus);\n            }\n        }\n\n        // window and document have no scrollTop or scrollIntoView, so use the document's scrolling element\n        #normalizeScrollTarget(target) {\n            return target === window || target === document ? document.scrollingElement : target;\n        }\n\n        #handleScroll(swapSpec, target) {\n            if (swapSpec.scroll) {\n                let scrollTarget = swapSpec.scrollTarget ? this.#normalizeScrollTarget(this.#findExt(target, swapSpec.scrollTarget)) : target;\n                if (scrollTarget) {\n                    if (swapSpec.scroll === 'top') {\n                        scrollTarget.scrollTop = 0;\n                    } else if (swapSpec.scroll === 'bottom'){\n                        scrollTarget.scrollTop = scrollTarget.scrollHeight;\n                    }\n                }\n            }\n            if (swapSpec.show === 'top' || swapSpec.show === 'bottom') {\n                let showTarget = swapSpec.showTarget ? this.#normalizeScrollTarget(this.#findExt(target, swapSpec.showTarget)) : target;\n                showTarget?.scrollIntoView?.(swapSpec.show === 'top')\n            }\n        }\n\n        #handleAnchorScroll(ctx) {\n            if (ctx.request?.anchor) {\n                document.getElementById(ctx.request.anchor)?.scrollIntoView({block: 'start', behavior: 'auto'});\n            }\n        }\n\n        #processScripts(container) {\n            let scripts = this.#queryEltAndDescendants(container, 'script');\n            for (let oldScript of scripts) {\n                let newScript = document.createElement('script');\n                for (let attr of oldScript.attributes) {\n                    newScript.setAttribute(attr.name, attr.value);\n                }\n                if (this.config.inlineScriptNonce) {\n                    newScript.nonce = this.config.inlineScriptNonce;\n                }\n                newScript.textContent = this.#ttPolicy.createScript(oldScript.textContent);\n                oldScript.replaceWith(newScript);\n            }\n        }\n\n        //============================================================================================\n        // Public JS API\n        //============================================================================================\n\n        initialize() {\n            if (this.config.history && !this.#historyInitialized) {\n                this.#historyInitialized = true;\n                if (window.navigation && !/firefox/i.test(navigator.userAgent)) {\n                    navigation.addEventListener('navigate', (event) => {\n                        if (event.navigationType === 'traverse' && event.canIntercept && !event.hashChange)\n                            event.intercept({handler: () => this.#restoreHistory()});\n                    });\n                /* c8 ignore next 3 */\n                } else {\n                    window.addEventListener('popstate', (event) => this.#restoreHistory(event.state));\n                }\n            }\n            this.process(document.body);\n        }\n\n        async swap(ctx) {\n            try {\n                let {fragment, title} = this.#makeFragment(ctx.text);\n                ctx.title = title;\n                let tasks = [];\n\n                // Process OOB and partials\n                let oobTasks = this.#processOOB(fragment, ctx.sourceElement, ctx.selectOOB);\n                let partialTasks = this.#processPartials(fragment, ctx);\n                tasks.push(...oobTasks, ...partialTasks);\n\n                // Determine if empty swap should be prevented\n                // partials always prevent; oob prevents by default unless config.allowEmptySwapAfterOOB is true\n                let hasPartials = partialTasks.length || (oobTasks.length && !this.config.allowEmptySwapAfterOOB);\n\n                // Process main swap\n                let mainSwap = this.#processMainSwap(ctx, fragment, hasPartials);\n                if (mainSwap) {\n                    tasks.unshift(mainSwap);\n                }\n\n                if(!this.#trigger(ctx.sourceElement, \"htmx:before:swap\", {ctx, tasks})){\n                    return\n                }\n\n                this.#handleHistoryUpdate(ctx);\n\n                let swapPromises = [];\n                let transitionTasks = [];\n                for (let task of tasks) {\n                    if (task.swapSpec?.transition ?? mainSwap?.transition ?? ctx.transition) {\n                        transitionTasks.push(task);\n                    } else {\n                        swapPromises.push(this.#insertContent(task));\n                    }\n                }\n\n                // submit all transition tasks in the transition queue w/no CSS transitions\n                if (transitionTasks.length > 0) {\n                    let tasksWrapper = async ()=> {\n                        for (let task of transitionTasks) {\n                            await this.#insertContent(task, false)\n                        }\n                    }\n                    swapPromises.push(this.#submitTransitionTask(tasksWrapper, ctx));\n                }\n\n                await Promise.all(swapPromises);\n\n                if (!ctx.sourceElement?.isConnected && mainSwap?.target?.isConnected) {\n                    ctx.sourceElement = mainSwap.target;\n                }\n\n                this.#trigger(ctx.sourceElement, \"htmx:after:swap\", {ctx});\n                if (ctx.title && ctx.swap !== 'none') document.title = ctx.title;\n                this.#handleAnchorScroll(ctx);\n            } finally {\n                this.#trigger(ctx.sourceElement, \"htmx:finally:swap\", {ctx});\n            }\n        }\n\n        #processMainSwap(ctx, fragment, hasPartials) {\n            // Create main task if needed\n            let swapSpec = this.#parseSwapSpec(ctx.swap || this.config.defaultSwap);\n            if (swapSpec.ignoreTitle) ctx.title = null;\n            // skip main swap if fragment is empty after partial/oob removal\n            // swapEmpty modifier can override; default: skip if hasPartials\n            if (\n                swapSpec.style === 'delete' ||    // delete always runs regardless of content\n                (fragment.querySelector('body') || fragment).childElementCount > 0 || // or fragment has elements\n                fragment.textContent.trim() ||    // or fragment has text\n                (swapSpec.swapEmpty ?? !hasPartials)\n            ) {\n                if (ctx.select) {\n                    let selected = fragment.querySelectorAll(ctx.select);\n                    fragment = document.createDocumentFragment();\n                    fragment.append(...selected);\n                }\n                if (this.#isBoosted(ctx.sourceElement)) {\n                    swapSpec.show ||= 'top';\n                }\n                let mainSwap = {\n                    type: 'main',\n                    fragment,\n                    target: this.#resolveTarget(ctx.sourceElement || document.body, swapSpec.target || ctx.target),\n                    swapSpec,\n                    sourceElement: ctx.sourceElement,\n                    transition: ctx.transition && swapSpec.transition !== false\n                };\n                return mainSwap;\n            }\n        }\n\n        async #insertContent(task, cssTransition = true) {\n            let {target, swapSpec, fragment} = task;\n            if (typeof target === 'string') {\n                target = document.querySelector(target);\n            }\n            if (!target) return;\n            if (typeof swapSpec === 'string') {\n                swapSpec = this.#parseSwapSpec(swapSpec);\n            }\n            let swapStyle = swapSpec.style;\n            if (swapStyle === 'none') return;\n            // Body fragment: strip wrapper unless outer* swap on document.body\n            if (fragment.firstElementChild?.tagName === 'BODY') {\n                const keepBody = target === document.body && swapStyle.startsWith('outer')\n                if (keepBody && swapStyle === 'outerHTML') swapStyle = 'outerSync'\n                swapSpec.strip ??= !keepBody\n            }\n            if (swapSpec.strip && fragment.firstElementChild) {\n                fragment = document.createDocumentFragment();\n                fragment.append(...(task.fragment.firstElementChild.content || task.fragment.firstElementChild).childNodes);\n            }\n\n            this.#addClass(target, \"htmx-swapping\")\n            if (cssTransition && task.swapSpec?.swap) {\n                await this.timeout(task.swapSpec?.swap)\n            }\n\n            if (swapStyle === 'delete') {\n                if (target.parentNode) {\n                    this.#cleanup(target);\n                    target.parentNode.removeChild(target);\n                }\n                return;\n            }\n\n            // innerHTML/outerHTML swaps backup focus and handle CSS transitions\n            let focusInfo;\n            let settleTasks = []\n            let settleDelay = swapSpec.settle ?? this.config.defaultSettleDelay;\n            let parentNode = target.parentNode;\n            if (swapStyle === 'innerHTML' || (swapStyle === 'outerHTML' && parentNode)) {\n                let activeElt = document.activeElement;\n                if (activeElt?.id) {\n                    let start, end;\n                    try { start = activeElt.selectionStart; end = activeElt.selectionEnd; } catch (e) {}\n                    focusInfo = { elt: activeElt, start, end };\n                }\n                settleTasks = cssTransition && settleDelay ? this.#startCSSTransitions(fragment, target) : []\n            }\n\n            let pantry = this.#handlePreservedElements(fragment);\n            let newContent = [...fragment.childNodes]\n            try {\n                if (swapStyle === 'innerHTML') {\n                    for (const child of target.children) {\n                        this.#cleanup(child)\n                    }\n                    target.replaceChildren(...fragment.childNodes);\n                } else if (swapStyle === 'textContent') {\n                    for (const child of target.querySelectorAll('[data-htmx-powered]')) {\n                        this.#cleanup(child)\n                    }\n                    target.textContent = fragment.textContent;\n                } else if (swapStyle === 'outerHTML') {\n                    if (parentNode) {\n                        this.#insertNodes(parentNode, target, fragment);\n                        this.#cleanup(target)\n                        parentNode.removeChild(target);\n                        target = newContent.find(node => node.nodeType === 1) || parentNode\n                    }\n                } else if (swapStyle === 'outerSync') {\n                    this.#copyAttributes(target, fragment.firstElementChild);\n                    for (const child of target.children) {\n                        this.#cleanup(child)\n                    }\n                    target.replaceChildren(...fragment.firstElementChild.childNodes);\n                    newContent = [target];\n                } else if (swapStyle === 'innerMorph') {\n                    this.#morph(target, fragment, true);\n                    newContent = [...target.childNodes];\n                } else if (swapStyle === 'outerMorph') {\n                    this.#morph(target, fragment, false);\n                    newContent.push(target);\n                } else if (swapStyle === 'beforebegin') {\n                    if (parentNode) {\n                        this.#insertNodes(parentNode, target, fragment);\n                    }\n                } else if (swapStyle === 'afterbegin') {\n                    this.#insertNodes(target, target.firstChild, fragment);\n                } else if (swapStyle === 'beforeend') {\n                    this.#insertNodes(target, null, fragment);\n                } else if (swapStyle === 'afterend') {\n                    if (parentNode) {\n                        this.#insertNodes(parentNode, target.nextSibling, fragment);\n                    }\n                } else {\n                    let methods = this.#extMethods.get('handle_swap') || []\n                    let handled = false;\n                    for (const method of methods) {\n                        let result = method(swapStyle, target, fragment, swapSpec);\n                        if (result) {\n                            handled = true;\n                            if (Array.isArray(result)) {\n                                newContent = result;\n                            }\n                            break;\n                        }\n                    }\n                    if (!handled) {\n                        throw new Error(`Unknown swap style: ${swapStyle}`);\n                    }\n                }\n            } finally {\n                this.#removeClass(target, \"htmx-swapping\")\n            }\n            task.target = target;\n            this.#restorePreservedElements(pantry);\n            if (focusInfo && !focusInfo.elt.matches(':focus')) {\n                let newElt = document.getElementById(focusInfo.elt.id);\n                if (newElt) {\n                    let focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !this.config.defaultFocusScroll };\n                    this.#setFocus(newElt, focusOptions, focusInfo.start, focusInfo.end);\n                }\n            }\n\n            this.#trigger(target, \"htmx:before:settle\", {task, newContent, settleTasks})\n\n            for (const elt of newContent) {\n                this.#addClass(elt, \"htmx-added\")\n            }\n\n            if (cssTransition && settleTasks.length > 0) {\n                this.#addClass(target, \"htmx-settling\")\n                await this.timeout(settleDelay);\n                // invoke settle tasks\n                for (let settleTask of settleTasks) {\n                    settleTask()\n                }\n                this.#removeClass(target, \"htmx-settling\")\n            }\n\n            this.#trigger(target, \"htmx:after:settle\", {task, newContent, settleTasks})\n\n            for (const elt of newContent) {\n                this.#removeClass(elt, \"htmx-added\")\n                this.process(elt);\n                this.#handleAutoFocus(elt);\n            }\n            \n            this.#handleScroll(swapSpec, target);\n        }\n\n        #trigger(on, eventName, detail = {}, bubbles = true) {\n            // Convention: events with detail.error log at error level, detail.warn at warn level,\n            // otherwise at event level (gated by config.logAll). One emit per event.\n            if (detail.error) {\n                let prefix = `htmx: ${eventName}: ${detail.error.message ?? detail.error}`;\n                if (detail.error instanceof Error) console.error(prefix, detail.error, { elt: on, detail });\n                else console.error(prefix, { elt: on, detail });\n            } else if (detail.warn) {\n                console.warn(`htmx: ${eventName}: ${detail.warn}`, { elt: on, detail });\n            } else if (this.config.logAll) {\n                console.log(`htmx: ${eventName}`, { elt: on, detail });\n            }\n            on = this.#normalizeElement(on)\n            this.#triggerExtensions(on, eventName, detail);\n            return this.trigger(on, this.#maybeAdjustMetaCharacter(eventName), detail, bubbles)\n        }\n\n        #triggerExtensions(elt, eventName, detail = {}) {\n            let methods = this.#extMethods.get(eventName.replace(/:/g, '_'))\n            if (methods) {\n                detail.cancelled = false;\n                for (const fn of methods) {\n                    if (fn(elt, detail) === false || detail.cancelled) {\n                        detail.cancelled = true;\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n\n        timeout(time) {\n            time = this.parseInterval(time);\n            if (time > 0) {\n                return new Promise(resolve => setTimeout(resolve, time));\n            }\n        }\n\n        onLoad(callback) {\n            this.on(this.#maybeAdjustMetaCharacter(\"htmx:after:process\"), (evt) => {\n                callback(evt.target)\n            })\n        }\n\n        on(eventOrElt, eventOrCallback, callback) {\n            let event;\n            let elt = document;\n            if (callback === undefined) {\n                event = eventOrElt;\n                callback =  eventOrCallback\n            } else {\n                elt = this.#normalizeElement(eventOrElt);\n                event = eventOrCallback;\n            }\n            elt.addEventListener(event, callback);\n            return callback;\n        }\n\n        find(selectorOrElt, selector) {\n            return this.#findExt(selectorOrElt, selector)\n        }\n\n        findAll(selectorOrElt, selector) {\n            return this.#findAllExt(selectorOrElt, selector)\n        }\n\n        parseInterval(str) {\n            if (typeof str === 'number') return str;\n            let m = {ms: 1, s: 1000, m: 60000};\n            let [, n, u] = str?.match(/^([\\d.]+)(ms|s|m)?$/) || [];\n            let v = parseFloat(n) * (m[u] || 1);\n            return isNaN(v) ? undefined : v;\n        }\n\n        trigger(on, eventName, detail = {}, bubbles = true) {\n            on = this.#normalizeElement(on)\n            let evt = new CustomEvent(eventName, {\n                detail,\n                cancelable: true,\n                bubbles,\n                composed: true\n            });\n            let target = on?.isConnected ? on : document;\n            let result = !detail?.cancelled && target.dispatchEvent(evt);\n            return result\n        }\n        ajax(verb, path, options) {\n            // Normalize options to object\n            if (!options || options instanceof Element || typeof options === 'string') {\n                options = {target: options};\n            }\n\n            let sourceElt = typeof options.source === 'string' ?\n                document.querySelector(options.source) : options.source;\n\n            // If source selector was provided but didn't match, reject\n            if (typeof options.source === 'string' && !sourceElt) {\n                return Promise.reject(new Error('Source not found'));\n            }\n\n            sourceElt ||= document.body;\n\n            let ctx = this.#createRequestContext(sourceElt, options.event || {});\n            Object.assign(ctx, options);\n            if (options.target) {\n                ctx.target = this.#resolveTarget(document.body, options.target);\n                if (!ctx.target) return Promise.reject(new Error('Target not found'));\n            }\n            Object.assign(ctx.request, {action: path, method: verb.toUpperCase()});\n            if (options.headers) Object.assign(ctx.request.headers, options.headers);\n\n            return this.#handleTriggerEvent(ctx);\n        }\n\n        //============================================================================================\n        // History Support\n        //============================================================================================\n\n        #pushUrlIntoHistory(path) {\n            if (!this.config.history) return;\n             history.pushState({htmx: true}, '', path);\n            this.#trigger(document, \"htmx:after:history:push\", {path});\n        }\n\n        #replaceUrlInHistory(path) {\n            if (!this.config.history) return;\n            history.replaceState({htmx: true}, '', path);\n            this.#trigger(document, \"htmx:after:history:replace\", {path});\n        }\n\n        async #restoreHistory(state, path) {\n            await this.timeout(1);\n            state ??= history.state;\n            if (!state?.htmx) return;\n            this.#historyAbort?.abort();\n            path = path || location.pathname + location.search;\n            let historyElt = document.querySelector(this.#prefixSelector('[hx-history-elt]')) || document.body;\n            if (this.#trigger(document, \"htmx:before:history:restore\", {path, cacheMiss: true})) {\n                if (this.config.history === \"reload\") {\n                    this._loc.reload();\n                } else {\n                    this.#historyAbort = new AbortController();\n                    return this.ajax('GET', path, {\n                        target: historyElt,\n                        swap: 'outerSync',\n                        select: historyElt !== document.body ? this.#prefixSelector('[hx-history-elt]') : undefined,\n                        request: {\n                            headers: {'HX-History-Restore-Request': 'true'},\n                            signal: this.#historyAbort.signal\n                        }\n                    });\n                }\n            }\n        }\n\n        #resolveHistoryAction(ctx) {\n            let {sourceElement, push, replace, hx, response} = ctx;\n\n            // allow response headers to override history action\n            if (hx?.pushurl || hx?.replaceurl) { // HX-Push-Url, HX-Replace-Url\n                push = hx.pushurl;\n                replace = hx.replaceurl;\n            }\n\n            // if this is a boosted element, default to pushing\n            if (push == null && replace == null && this.#isBoosted(sourceElement)) {\n                push = 'true';\n            }\n            \n            // normalize \"false\" to null\n            if (push === 'false' || push === false) push = null;\n            if (replace === 'false' || replace === false) replace = null;\n\n            if (!push && !replace) return null;\n\n            let path = push || replace;\n            // if the path is simply \"true\" normalize to the current path\n            if (path === 'true') {\n                let finalUrl = response?.raw?.url || ctx.request.action;\n                let url = new URL(finalUrl, location.href);\n                path = url.pathname + url.search + (ctx.request.anchor ? '#' + ctx.request.anchor : '');\n            }\n\n            let type = push ? 'push' : 'replace';\n            return {type, path};\n        }\n\n        #handleHistoryUpdate(ctx) {\n            if (!this.config.history) return;\n            // Stamp the current entry on the first htmx swap after a fresh page load,\n            // so back traversals to this page are interceptable.\n            if (!history.state?.htmx) history.replaceState({htmx: true}, '', location.href);\n            let action = this.#resolveHistoryAction(ctx);\n            if (!action) return;\n\n            let historyDetail = {\n                history: action,\n                sourceElement: ctx.sourceElement,\n                response: ctx.response\n            };\n            if (!this.#trigger(document, \"htmx:before:history:update\", historyDetail)) return;\n            if (action.type === 'push') {\n                this.#pushUrlIntoHistory(action.path);\n            } else {\n                this.#replaceUrlInHistory(action.path);\n            }\n            this.#trigger(document, \"htmx:after:history:update\", historyDetail);\n        }\n\n        // hx-on:<event> binds to <event> directly\n        // hx-on::<event> is shorthand for hx-on:htmx:<event> (htmx events)\n        #handleHxOnAttributes(node) {\n            if (node._htmx?.onInitialized) return;\n            let hxOnNames = this.#prefixes(\"hx-on\");\n            let mc = this.config.metaCharacter || ':';\n            let handler = (code) => async (evt) => {\n                try {\n                    await this.#executeJavaScript(node, { event: evt },\n                        `with(event?.detail||{}){${code}}`, false);\n                } catch (e) {\n                    if (typeof e !== 'symbol') this.#trigger(node, 'htmx:error', { error: e });\n                }\n            };\n            for (let attr of node.getAttributeNames()) {\n                let prefix = hxOnNames.find(p => attr.startsWith(p));\n                if (!prefix) continue;\n                this.#htmxProp(node).onInitialized = true;\n                let rest = attr.substring(prefix.length);\n                let value = node.getAttribute(attr);\n                // hx-on=\"click once -> doA(); blur -> doB()\"\n                if (!rest) {\n                    for (let part of value.split(/;(?=[^;]*->)/)) {\n                        let idx = part.indexOf('->');\n                        if (idx !== -1) this.#onTrigger(node, part.substring(0, idx).trim(), handler(part.substring(idx + 2).trim()));\n                    }\n                    continue;\n                }\n                // hx-on:click=\"code\" or hx-on::before:request=\"code\"\n                if (rest[0] !== mc) continue;\n                let eventName = rest.substring(1);\n                if (eventName.startsWith(mc)) eventName = 'htmx' + mc + eventName.substring(1);\n                this.#onTrigger(node, eventName, handler(value));\n            }\n        }\n\n        #showIndicators(ctx) {\n            let elt = ctx.sourceElement;\n            let hxIndicator = this.#attributeValue(elt, \"hx-indicator\");\n            let indicatorElements;\n            if (!hxIndicator) {\n                if (elt === document.body) return;\n                indicatorElements = [elt];\n            } else {\n                indicatorElements = this.#findAllExt(elt, hxIndicator, \"hx-indicator\");\n            }\n            for (const indicator of indicatorElements) {\n                ctx.indicators.push(indicator);\n                let s = this.#htmxState(indicator);\n                s.rc = (s.rc || 0) + 1;\n                this.#addClass(indicator, this.config.requestClass);\n            }\n        }\n\n        #hideIndicators(indicatorElements) {\n            for (let indicator of indicatorElements) {\n                let s = this.#htmxState(indicator);\n                if (s.rc && --s.rc <= 0) {\n                    this.#removeClass(indicator, this.config.requestClass);\n                    delete s.rc;\n                }\n            }\n        }\n\n        #disableElements(ctx) {\n            let elt = ctx.sourceElement;\n            let hxDisable = this.#attributeValue(elt, \"hx-disable\");\n            if (!hxDisable) return;\n            for (let el of this.#findAllExt(elt, hxDisable, \"hx-disable\")) {\n                    ctx.disabledElements.push(el);\n                    let s = this.#htmxState(el);\n                    s.dc = (s.dc || 0) + 1;\n                    el.disabled = true;\n            }\n        }\n\n        #enableElements(disabledElements) {\n            for (const indicator of disabledElements) {\n                let s = this.#htmxState(indicator);\n                if (s.dc && --s.dc <= 0) {\n                    indicator.disabled = false\n                    delete s.dc;\n                }\n            }\n        }\n\n        #collectFormData(elt, form, submitter, validate, isGet) {\n            if (validate && form && !form.reportValidity()) return\n\n            // treat a named submit button that owns hx-post as its own submitter (#4073)\n            submitter ??= (form && elt.type === 'submit') ? elt : null;\n\n            let formData = form ? new FormData(form) : new FormData()\n            let included = form ? new Set(form.elements) : new Set()\n            if (!form) {\n                if (validate && elt.reportValidity && !elt.reportValidity()) return\n                this.#addInputValues(elt, included, formData, isGet);\n            }\n            if (submitter?.name) {\n                formData.append(submitter.name, submitter.value)\n                included.add(submitter);\n            }\n            let hxInclude = this.#attributeValue(elt, \"hx-include\");\n            if (hxInclude) {\n                for (let node of this.#findAllExt(elt, hxInclude)) {\n                    if (validate && node.reportValidity && !node.reportValidity()) return\n                    this.#addInputValues(node, included, formData);\n                }\n            }\n            return formData\n        }\n\n        #addInputValues(elt, included, formData, isGet) {\n            let tag = elt.tagName;\n            let inputs = [];\n            if (tag === 'BUTTON' || tag.includes('-')) {\n                inputs = [elt]; // send own value only, never collect children\n            } else if (['INPUT', 'SELECT', 'TEXTAREA', 'FIELDSET'].includes(tag) || (!isGet && elt !== document.body)) {\n                inputs = this.#queryEltAndDescendants(elt, '[name]:not(button)');\n            }\n            // GET on non-form-control containers sends nothing; POST on body sends nothing; use hx-include for explicit inclusion\n\n            for (let input of inputs) {\n                let name = input.name || input.getAttribute?.('name');\n                if (!name || input.matches(':disabled') || included.has(input)) continue;\n                included.add(input);\n\n                let type = input.type;\n                if (type === 'checkbox' || type === 'radio' || (input.tagName !== 'INPUT' && 'checked' in input)) {\n                    // Only add if checked\n                    if (input.checked) {\n                        formData.append(name, input.value);\n                    }\n                } else if (type === 'file') {\n                    // Add all selected files\n                    for (let file of input.files) {\n                        formData.append(name, file);\n                    }\n                } else if (type === 'select-multiple') {\n                    // Add all selected options\n                    for (let option of input.selectedOptions) {\n                        formData.append(name, option.value);\n                    }\n                } else if (Array.isArray(input.value)) {\n                    // Add all array values (e.g. custom elements)\n                    for (let v of input.value) {\n                        formData.append(name, v);\n                    }\n                } else {\n                    formData.append(name, input.value);\n                }\n            }\n        }\n\n        #getAttributeObject(elt, attrName, callback, scope = {}) {\n            let hxAttr = this.#attributeValue(elt, attrName);\n            if (!hxAttr) return null;\n\n            let javascriptContent = this.#extractJavascriptContent(hxAttr);\n            if (javascriptContent) {\n                // Wrap in braces if not already wrapped (for htmx 2.x compatibility)\n                if (javascriptContent.indexOf('{') !== 0) {\n                    javascriptContent = '{' + javascriptContent + '}';\n                }\n                // Return promise for async evaluation\n                return this.#executeJavaScript(elt, scope, javascriptContent, true).then(obj => {\n                    callback(obj);\n                });\n            } else {\n                // Synchronous path - return the parsed object directly\n                callback(HCON.parse(hxAttr));\n            }\n        }\n\n        #stringHyperscriptStyleSelector(selector) {\n            let s = selector.trim();\n            return s.startsWith('<') && s.endsWith('/>') ? s.slice(1, -2) : s;\n        }\n\n        #findAllExt(eltOrSelector, maybeSelector, thisAttr, global) {\n            let selector = maybeSelector ?? eltOrSelector;\n            let elt = maybeSelector ? (this.#normalizeElement(eltOrSelector) || document.body) : document;\n            if (selector.startsWith('global ')) {\n                return this.#findAllExt(elt, selector.slice(7), thisAttr, true);\n            }\n            let parts = selector ? HCON.split(selector) : [];\n            let result = []\n            let unprocessedParts = []\n            for (const part of parts) {\n                let selector = this.#stringHyperscriptStyleSelector(part)\n                let item\n                if (selector.startsWith('closest ')) {\n                    item = elt.closest(selector.slice(8))\n                } else if (selector.startsWith('find ')) {\n                    item = elt.querySelector(selector.slice(5))\n                } else if (selector.startsWith('findAll ')) {\n                    result.push(...elt.querySelectorAll(selector.slice(8)))\n                } else if (selector === 'next' || selector === 'nextElementSibling') {\n                    item = elt.nextElementSibling\n                } else if (selector.startsWith('next ')) {\n                    item = this.#scanForwardQuery(elt, selector.slice(5), !!global)\n                } else if (selector === 'previous' || selector === 'previousElementSibling') {\n                    item = elt.previousElementSibling\n                } else if (selector.startsWith('previous ')) {\n                    item = this.#scanBackwardsQuery(elt, selector.slice(9), !!global)\n                } else if (selector === 'document') {\n                    item = document\n                } else if (selector === 'window') {\n                    item = window\n                } else if (selector === 'body') {\n                    item = document.body\n                } else if (selector === 'host') {\n                    item = (elt.getRootNode()).host\n                } else if (selector === 'this') {\n                    if (thisAttr) {\n                        result.push(...this.#findThisElements(elt, thisAttr));\n                        continue;\n                    }\n                    item = elt\n                } else {\n                    unprocessedParts.push(selector)\n                }\n\n                if (item) {\n                    result.push(item)\n                }\n            }\n\n            if (unprocessedParts.length > 0) {\n                let standardSelector = unprocessedParts.join(',')\n                let rootNode = this.#getRootNode(elt, !!global)\n                result.push(...rootNode.querySelectorAll(standardSelector))\n            }\n\n            return [...new Set(result)]\n        }\n\n        #scanForwardQuery(start, match, global) {\n            return this.#scanUntilComparison(this.#getRootNode(start, global).querySelectorAll(match), start, Node.DOCUMENT_POSITION_PRECEDING);\n        }\n\n        #scanBackwardsQuery(start, match, global) {\n            let results = [...this.#getRootNode(start, global).querySelectorAll(match)].reverse()\n            return this.#scanUntilComparison(results, start, Node.DOCUMENT_POSITION_FOLLOWING);\n        }\n\n        #scanUntilComparison(results, start, comparison) {\n            for (const elt of results) {\n                if (elt.compareDocumentPosition(start) === comparison) {\n                    return elt\n                }\n            }\n        }\n\n        #getRootNode(elt, global) {\n            if (elt.isConnected && elt.getRootNode) {\n                return elt.getRootNode?.({composed: global})\n            } else {\n                return document\n            }\n        }\n\n        #findOrWarn(elt, selector, thisAttr) {\n            let result = this.#findAllExt(elt, selector, thisAttr)[0]\n            if (!result) {\n                console.warn(`htmx: '${selector}' on ${thisAttr} did not match any element`,\n                    { elt, selector, attr: thisAttr });\n            }\n            return result\n        }\n\n        #findExt(eltOrSelector, selector, thisAttr) {\n            return this.#findAllExt(eltOrSelector, selector, thisAttr)[0]\n        }\n\n        #extractJavascriptContent(string) {\n            if (string != null) {\n                if (string.startsWith(\"js:\")) {\n                    return string.substring(3);\n                } else if (string.startsWith(\"javascript:\")) {\n                    return string.substring(11);\n                }\n            }\n        }\n\n        #initializeAbortListener(elt) {\n            let htmxProp = this.#htmxProp(elt);\n            if (htmxProp.abortInitialized) return;\n            htmxProp.abortInitialized = true;\n            let handler = () => {\n                let requestQueue = this.#getRequestQueue(elt);\n                requestQueue.abort();\n            };\n            elt.addEventListener(\"htmx:abort\", handler);\n            htmxProp.listeners.push({fromElt: elt, eventName: \"htmx:abort\", handler});\n        }\n\n        #morph(oldNode, fragment, innerHTML) {\n            let {persistentIds, idMap} = this.#createIdMaps(oldNode, fragment);\n            let pantry = document.createElement(\"div\");\n            pantry.hidden = true;\n            document.body.after( pantry);\n            let ctx = {target: oldNode, idMap, persistentIds, pantry, futureMatches: new WeakSet()};\n\n            if (innerHTML) {\n                this.#morphChildren(ctx, oldNode, fragment);\n            } else {\n                this.#morphChildren(ctx, oldNode.parentNode, fragment, oldNode, oldNode.nextSibling);\n            }\n            this.#cleanup(pantry)\n            pantry.remove();\n        }\n\n        #morphChildren(ctx, oldParent, newParent, insertionPoint = null, endPoint = null) {\n            if (oldParent instanceof HTMLTemplateElement && newParent instanceof HTMLTemplateElement) {\n                oldParent = oldParent.content;\n                newParent = newParent.content;\n            }\n            insertionPoint ||= oldParent.firstChild;\n\n            let newChild = newParent.firstChild;\n            while (newChild) {\n                let matchedNode;\n                if (insertionPoint && insertionPoint != endPoint) {\n                    matchedNode = this.#findBestMatch(ctx, newChild, insertionPoint, endPoint);\n                    if (matchedNode) {\n                        if (matchedNode !== insertionPoint) {\n                            let cursor = insertionPoint;\n                            while (cursor && cursor !== matchedNode) {\n                                let tempNode = cursor;\n                                cursor = cursor.nextSibling;\n                                // remove nodes unless they match upcoming content in which case move them to end for later use\n                                if (tempNode instanceof Element && (ctx.idMap.has(tempNode) || this.#matchesUpcomingSibling(ctx, tempNode, newChild))) {\n                                    this.#moveBefore(oldParent, tempNode, endPoint);\n                                } else {\n                                    this.#removeNode(ctx, tempNode);\n                                }\n                            }\n                        }\n                    }\n                }\n\n                if (!matchedNode && newChild instanceof Element && ctx.persistentIds.has(newChild.id)) {\n                    let escapedId = CSS.escape(newChild.id);\n                    matchedNode = (ctx.target.id === newChild.id && ctx.target) ||\n                        ctx.target.querySelector(`[id=\"${escapedId}\"]`) ||\n                        ctx.pantry.querySelector(`[id=\"${escapedId}\"]`);\n                    let element = matchedNode;\n                    while ((element = element.parentNode)) {\n                        let idSet = ctx.idMap.get(element);\n                        if (idSet) {\n                            idSet.delete(matchedNode.id);\n                            if (!idSet.size) ctx.idMap.delete(element);\n                        }\n                    }\n                    this.#moveBefore(oldParent, matchedNode, insertionPoint);\n                }\n\n                if (matchedNode) {\n                    this.#morphNode(matchedNode, newChild, ctx);\n                    insertionPoint = matchedNode.nextSibling;\n                    newChild = newChild.nextSibling;\n                    continue;\n                }\n\n                let nextNewChild = newChild.nextSibling;\n                if (ctx.idMap.has(newChild)) {\n                    let placeholder = document.createElement(newChild.tagName);\n                    oldParent.insertBefore(placeholder, insertionPoint);\n                    this.#morphNode(placeholder, newChild, ctx);\n                    this.process(placeholder);\n                    insertionPoint = placeholder.nextSibling;\n                } else {\n                    oldParent.insertBefore(newChild, insertionPoint);\n                    insertionPoint = newChild.nextSibling;\n                }\n                newChild = nextNewChild;\n            }\n\n            while (insertionPoint && insertionPoint != endPoint) {\n                let tempNode = insertionPoint;\n                insertionPoint = insertionPoint.nextSibling;\n                this.#removeNode(ctx, tempNode);\n            }\n        }\n\n        #matchesUpcomingSibling(ctx, oldElt, startNode) {\n            if (ctx.futureMatches.has(oldElt)) return true;\n            for (let sibling = startNode.nextSibling, i = 0; sibling && i < this.config.morphScanLimit; sibling = sibling.nextSibling, i++) {\n                if (sibling instanceof Element && oldElt.isEqualNode(sibling)) {\n                    ctx.futureMatches.add(oldElt);\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        #findBestMatch(ctx, node, startPoint, endPoint) {\n            // text nodes match positionally (patch in place via #morphNode), 3 = TEXT_NODE\n            if (node.nodeType === 3) return startPoint?.nodeType === 3 ? startPoint : null;\n            if (!(node instanceof Element)) return null;\n            let softMatch = null, displaceMatchCount = 0, scanLimit = this.config.morphScanLimit;\n            let newSet = ctx.idMap.get(node), nodeMatchCount = newSet?.size || 0;\n            // If node has a non-persistent ID, insert instead of soft matching\n            if (node.id && !newSet) return null;\n            let cursor = startPoint;\n            while (cursor && cursor != endPoint) {\n                let oldSet = ctx.idMap.get(cursor);\n                if (this.#internalAPI.isSoftMatch(cursor, node)) {\n                    // Hard match: matching IDs found in both nodes\n                    if (oldSet && newSet && [...oldSet].some(id => newSet.has(id))) return cursor;\n                    if (!oldSet) {\n                        // Exact match: nodes are identical\n                        if (scanLimit > 0 && cursor.isEqualNode(node)) return cursor;\n                        // Soft match: same tag/type, save as fallback\n                        if (!softMatch) softMatch = cursor;\n                    }\n                }\n                // Stop if too many ID elements would be displaced\n                displaceMatchCount += oldSet?.size || 0;\n                if (displaceMatchCount > nodeMatchCount) break;\n                // Don't move elements containing a focused typeable input\n                if (document.activeElement?.selectionStart != null && cursor.contains(document.activeElement)) break;\n                // Stop scanning if limit reached and no IDs to match\n                if (--scanLimit < 1 && nodeMatchCount === 0) break;\n                cursor = cursor.nextSibling;\n            }\n            // Only return fallback softMatch if it does not match upcoming content\n            if (softMatch && this.#matchesUpcomingSibling(ctx, softMatch, node)) return null;\n            return softMatch;\n        }\n\n        #isSoftMatch(oldNode, newNode) {\n            if (!(oldNode instanceof Element) || oldNode.tagName !== newNode.tagName) {\n                return false;\n            }\n            // Script tags must be identical to match - never patch a script with different content\n            if (oldNode.tagName === 'SCRIPT' && !oldNode.isEqualNode(newNode)) return false;\n            return !oldNode.id || oldNode.id === newNode.id;\n        }\n\n        #removeNode(ctx, node) {\n            if (ctx.idMap.has(node)) {\n                this.#moveBefore(ctx.pantry, node, null);\n            } else {\n                this.#cleanup(node)\n                node.remove();\n            }\n        }\n\n        #moveBefore(parentNode, element, after) {\n            if (parentNode.moveBefore) {\n                try {\n                    parentNode.moveBefore(element, after);\n                    return\n                } catch (e) {\n                    // ignore and insertBefore instead\n                }\n            }\n            parentNode.insertBefore(element, after);\n        }\n\n        #morphNode(oldNode, newNode, ctx) {\n            if (oldNode.nodeType === 3) { // text node\n                if (oldNode.nodeValue !== newNode.nodeValue) oldNode.nodeValue = newNode.nodeValue;\n                return;\n            }\n            if (this.config.morphSkip && oldNode.matches?.(this.config.morphSkip)) return;\n                \n            // Trigger extension hook - if returns false, skip morphing this node\n            if (!this.#triggerExtensions(oldNode, \"htmx:before:morph:node\", {oldNode, newNode})) return;\n                \n            this.#copyAttributes(oldNode, newNode);\n            if (oldNode instanceof HTMLTextAreaElement && document.activeElement !== oldNode && oldNode.defaultValue != newNode.defaultValue) {\n                oldNode.value = newNode.value;\n            }\n            let skipChildren = this.config.morphSkipChildren && oldNode.matches?.(this.config.morphSkipChildren);\n            // isEqualNode does not detect template content diff so always morph templates\n            if (!skipChildren && (!oldNode.isEqualNode(newNode) || newNode.tagName === 'TEMPLATE' || newNode.querySelector?.('template'))) {\n                this.#morphChildren(ctx, oldNode, newNode);\n            }\n        }\n\n        #copyAttributes(destination, source) {\n            let attributesToIgnore = this.config.morphIgnore || [];\n            let needsReinit = false;\n            let isHxAttr = name => this.#prefixes('hx-').some(p => name.startsWith(p));\n            for (const attr of source.attributes) {\n                if (!attributesToIgnore.some(p => attr.name.startsWith(p)) && destination.getAttribute(attr.name) !== attr.value) {\n                    if (isHxAttr(attr.name)) needsReinit = true;\n                    if (!this.#triggerExtensions(destination, 'htmx:before:morph:attr', { attrName: attr.name, newValue: attr.value })) continue;\n                    destination.setAttribute(attr.name, attr.value);\n                    if (attr.name === \"value\" && destination instanceof HTMLInputElement && destination.type !== \"file\" && document.activeElement !== destination) {\n                            destination.value = attr.value;\n                    }\n                }\n            }\n            for (let i = destination.attributes.length - 1; i >= 0; i--) {\n                let attr = destination.attributes[i];\n                if (attr && !source.hasAttribute(attr.name) && !attributesToIgnore.some(p => attr.name.startsWith(p))) {\n                    if (isHxAttr(attr.name)) needsReinit = true;\n                    if (!this.#triggerExtensions(destination, 'htmx:before:morph:attr', { attrName: attr.name, newValue: null })) continue;\n                    destination.removeAttribute(attr.name);\n                }\n            }\n            if (needsReinit) this.#cleanup(destination, true);\n        }\n\n        #populateIdMapWithTree(idMap, persistentIds, root, elements) {\n            for (const elt of elements) {\n                if (persistentIds.has(elt.id)) {\n                    let current = elt;\n                    while (current && current !== root) {\n                        let idSet = idMap.get(current);\n                        if (idSet == null) {\n                            idSet = new Set();\n                            idMap.set(current, idSet);\n                        }\n                        idSet.add(elt.id);\n                        current = current.parentElement;\n                    }\n                }\n            }\n        }\n\n        #createIdMaps(oldNode, newContent) {\n            let oldIdElements = this.#queryEltAndDescendants(oldNode, \"[id]\");\n            let newIdElements = newContent.querySelectorAll(\"[id]\");\n            let persistentIds = this.#createPersistentIds(oldIdElements, newIdElements);\n            let idMap = new Map();\n            this.#populateIdMapWithTree(idMap, persistentIds, oldNode.parentElement, oldIdElements);\n            this.#populateIdMapWithTree(idMap, persistentIds, newContent, newIdElements);\n            return {persistentIds, idMap};\n        }\n\n        #createPersistentIds(oldIdElements, newIdElements) {\n            let duplicateIds = new Set(), oldIdTagNameMap = new Map();\n            for (const {id, tagName} of oldIdElements) {\n                if (oldIdTagNameMap.has(id)) duplicateIds.add(id);\n                else if (id) oldIdTagNameMap.set(id, tagName);\n            }\n            let persistentIds = new Set();\n            for (const {id, tagName} of newIdElements) {\n                if (persistentIds.has(id)) duplicateIds.add(id);\n                else if (oldIdTagNameMap.get(id) === tagName) persistentIds.add(id);\n            }\n            for (const id of duplicateIds) persistentIds.delete(id);\n            return persistentIds;\n        }\n\n        #handleStatusCodes(ctx) {\n            let status = ctx.response.raw.status;\n            let noSwapStrings = this.config.noSwap.map(x => x + \"\");\n            let str = status + \"\"\n            for (let pattern of [str, str.slice(0, 2) + 'x', str[0] + 'xx']) {\n                if (noSwapStrings.includes(pattern)) {\n                    ctx.swap = \"none\";\n                    return\n                }\n                let statusValue = this.#attributeValue(ctx.sourceElement, \"hx-status:\" + pattern);\n                if (statusValue) {\n                    HCON.merge(statusValue, ctx);\n                    return;\n                }\n            }\n        }\n\n        #submitTransitionTask(task, ctx) {\n            return new Promise((resolve) => {\n                this.#transitionQueue ||= [];\n                this.#transitionQueue.push({ task, resolve, ctx });\n                if (!this.#processingTransition) {\n                    this.#processTransitionQueue();\n                }\n            });\n        }\n\n        async #processTransitionQueue() {\n            if (this.#transitionQueue.length === 0 || this.#processingTransition) {\n                return;\n            }\n\n            this.#processingTransition = true;\n            let { task, resolve, ctx } = this.#transitionQueue.shift();\n\n            try {\n                if (document.startViewTransition) {\n                    let detail = {task, ctx};\n                    this.#trigger(ctx.sourceElement, \"htmx:before:viewTransition\", detail)\n                    await document.startViewTransition(detail.task).finished;\n                    this.#trigger(ctx.sourceElement, \"htmx:after:viewTransition\", detail)\n                } else {\n                    await task();\n                }\n            } catch (e) {\n                // Transitions can be skipped/aborted - this is normal\n            } finally {\n                this.#processingTransition = false;\n                resolve();\n                this.#processTransitionQueue();\n            }\n        }\n\n        #startCSSTransitions(fragment, root) {\n            let cssAttrs = ['class', 'style', 'width', 'height'];\n            let idElements = root.querySelectorAll(\"[id]\");\n            let existingElementsById = Object.fromEntries([...idElements].map(e => [e.id, e]));\n            let newElementsWithIds = fragment.querySelectorAll(\"[id]\");\n            let restoreTasks = []\n            for (let elt of newElementsWithIds) {\n                let existing = existingElementsById[elt.id];\n                if (existing?.tagName === elt.tagName) {\n                    let clone = elt.cloneNode(false); // shallow clone node\n                    for (let a of cssAttrs) existing.hasAttribute(a) ? elt.setAttribute(a, existing.getAttribute(a)) : elt.removeAttribute(a);\n                    restoreTasks.push(()=>{\n                        this.#copyAttributes(elt, clone)\n                    })\n                }\n            }\n            return restoreTasks;\n        }\n\n        #addClass(elt, cls) {\n            elt?.classList?.add?.(cls);\n        }\n\n        #removeClass(elt, cls) {\n            elt?.classList?.remove?.(cls);\n            if (elt?.classList?.length === 0) elt.removeAttribute('class');\n        }\n\n        #normalizeElement(cssOrElement) {\n            if (typeof cssOrElement === \"string\") {\n                return this.find(cssOrElement);\n            } else {\n                return cssOrElement\n            }\n        }\n\n        #maybeAdjustMetaCharacter(string) {\n            if (this.config.metaCharacter) {\n                return string.replace(/:/g, this.config.metaCharacter);\n            } else {\n                return string;\n            }\n        }\n\n    }\n\n    return new Htmx()\n})()\n\n;\n\nif (typeof window !== \"undefined\") window.htmx = htmx;\nexport default htmx;\n", "export function addUniqueItem<T>(arr: T[], item: T) {\n    if (arr.indexOf(item) === -1) arr.push(item)\n}\n\nexport function removeItem<T>(arr: T[], item: T) {\n    const index = arr.indexOf(item)\n    if (index > -1) arr.splice(index, 1)\n}\n\n// Adapted from array-move\nexport function moveItem<T>([...arr]: T[], fromIndex: number, toIndex: number) {\n    const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex\n\n    if (startIndex >= 0 && startIndex < arr.length) {\n        const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex\n\n        const [item] = arr.splice(fromIndex, 1)\n        arr.splice(endIndex, 0, item)\n    }\n\n    return arr\n}\n", "export const clamp = (min: number, max: number, v: number) => {\n    if (v > max) return max\n    if (v < min) return min\n    return v\n}\n", "export const MotionGlobalConfig: {\n    skipAnimations?: boolean\n    instantAnimations?: boolean\n    useManualTiming?: boolean\n    WillChange?: any\n    mix?: <T>(a: T, b: T) => (p: number) => T\n} = {}\n", "/**\n * Check if value is a numerical string, ie a string that is purely a number eg \"100\" or \"-100.1\"\n */\nexport const isNumericalString = (v: string) => /^-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)$/u.test(v)\n", "export const isObject = (value: unknown): value is object =>\n    typeof value === \"object\" && value !== null\n", "/**\n * Check if the value is a zero value string like \"0px\" or \"0%\"\n */\nexport const isZeroValueString = (v: string) => /^0[^.\\s]+$/u.test(v)\n", "/*#__NO_SIDE_EFFECTS__*/\nexport function memo<T extends any>(callback: () => T) {\n    let result: T | undefined\n\n    return () => {\n        if (result === undefined) result = callback()\n        return result\n    }\n}\n", "/*#__NO_SIDE_EFFECTS__*/\nexport const noop = <T>(any: T): T => any\n", "/**\n * Pipe\n * Compose other transformers to run linearily\n * pipe(min(20), max(40))\n * @param  {...functions} transformers\n * @return {function}\n */\nexport const pipe = (...transformers: Function[]) =>\n    transformers.reduce((a, b) => (v: any) => b(a(v)))\n", "/*\n  Progress within given range\n\n  Given a lower limit and an upper limit, we return the progress\n  (expressed as a number 0-1) represented by the given value, and\n  limit that progress to within 0-1.\n*/\n/*#__NO_SIDE_EFFECTS__*/\nexport const progress = (from: number, to: number, value: number) => {\n    const range = to - from\n    return range ? (value - from) / range : 1\n}\n", "import { addUniqueItem, removeItem } from \"./array\"\n\ntype GenericHandler = (...args: any) => void\n\nexport class SubscriptionManager<Handler extends GenericHandler> {\n    private subscriptions: Handler[] = []\n\n    add(handler: Handler): VoidFunction {\n        addUniqueItem(this.subscriptions, handler)\n        return () => this.remove(handler)\n    }\n\n    remove(handler: Handler) {\n        removeItem(this.subscriptions, handler)\n    }\n\n    notify(\n        a?: Parameters<Handler>[0],\n        b?: Parameters<Handler>[1],\n        c?: Parameters<Handler>[2]\n    ) {\n        const numSubscriptions = this.subscriptions.length\n\n        if (!numSubscriptions) return\n\n        if (numSubscriptions === 1) {\n            /**\n             * If there's only a single handler we can just call it without invoking a loop.\n             */\n            this.subscriptions[0](a, b, c)\n        } else {\n            for (let i = 0; i < numSubscriptions; i++) {\n                /**\n                 * Check whether the handler exists before firing as it's possible\n                 * the subscriptions were modified during this loop running.\n                 */\n                const handler = this.subscriptions[i]\n                handler && handler(a, b, c)\n            }\n        }\n    }\n\n    getSize() {\n        return this.subscriptions.length\n    }\n\n    clear() {\n        this.subscriptions.length = 0\n    }\n}\n", "/**\n * Converts seconds to milliseconds\n *\n * @param seconds - Time in seconds.\n * @return milliseconds - Converted time in milliseconds.\n */\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const secondsToMilliseconds = (seconds: number) => seconds * 1000\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const millisecondsToSeconds = (milliseconds: number) =>\n    milliseconds / 1000\n", "/*\n  Convert velocity into velocity per second\n*/\n/*#__NO_SIDE_EFFECTS__*/\nexport const velocityPerSecond = (velocity: number, frameDuration: number) =>\n    frameDuration ? velocity * (1000 / frameDuration) : 0\n", "export const wrap = (min: number, max: number, v: number) => {\n    const rangeSize = max - min\n    return ((((v - min) % rangeSize) + rangeSize) % rangeSize) + min\n}\n", "/*\n  Bezier function generator\n  This has been modified from Gaëtan Renaudeau's BezierEasing\n  https://github.com/gre/bezier-easing/blob/master/src/index.js\n  https://github.com/gre/bezier-easing/blob/master/LICENSE\n\n  t is found for a given x with Newton-Raphson, safeguarded by a bisection\n  bracket: whenever a Newton step would leave the bracket (near flat parts\n  of the curve), it bisects instead. This converges to full precision in\n  ~5 iterations on typical curves, so output is smooth rather than snapped\n  to a fixed bisection grid. The slope is estimated with a forward\n  difference, and the lookup table is omitted, to save bytes.\n\n  x = 0 and x = 1 return exactly 0 and 1. x outside [0, 1] starts outside\n  the bracket, so it bisects towards the nearer end and saturates to within\n  ~1e-12 of 0 or 1.\n  Usage\n    const easeOut = cubicBezier(.17,.67,.83,.67);\n    const x = easeOut(0.5); // returns 0.627...\n*/\n\nimport { noop } from \"../noop\"\n\n// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.\n// Bernstein form, so it is exactly 0 at t = 0 and exactly 1 at t = 1.\nconst calcBezier = (t: number, a1: number, a2: number) =>\n    t * (3 * (1 - t) * ((1 - t) * a1 + t * a2) + t * t)\n\n/*#__NO_SIDE_EFFECTS__*/\nexport function cubicBezier(\n    mX1: number,\n    mY1: number,\n    mX2: number,\n    mY2: number\n) {\n    // If this is a linear gradient, return linear easing\n    if (mX1 === mY1 && mX2 === mY2) return noop\n\n    return (x: number) => {\n        let lowerBound = 0\n        let upperBound = 1\n        let t = x\n\n        for (let i = 0; ; i++) {\n            // If t is outside the bracket, because x is out of range or a\n            // Newton step overshot where the slope is ~0, bisect instead.\n            if (!(t >= lowerBound && t <= upperBound)) {\n                t = (lowerBound + upperBound) / 2\n            }\n\n            const currentX = calcBezier(t, mX1, mX2) - x\n            if (currentX * currentX < 1e-28 || i === 40) break\n            currentX > 0 ? (upperBound = t) : (lowerBound = t)\n\n            // Newton-Raphson step, with dx/dt from a forward difference\n            t -=\n                (currentX * 1e-7) /\n                (calcBezier(t + 1e-7, mX1, mX2) - x - currentX)\n        }\n\n        return calcBezier(t, mY1, mY2)\n    }\n}\n", "// Accepts an easing function and returns a new one that outputs mirrored values for\n\nimport { EasingModifier } from \"../types\"\n\n// the second half of the animation. Turns easeIn into easeInOut.\n/*#__NO_SIDE_EFFECTS__*/\nexport const mirrorEasing: EasingModifier = (easing) => (p) =>\n    p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2\n", "// Accepts an easing function and returns a new one that outputs reversed values.\n\nimport { EasingModifier } from \"../types\"\n\n// Turns easeIn into easeOut.\n/*#__NO_SIDE_EFFECTS__*/\nexport const reverseEasing: EasingModifier = (easing) => (p) =>\n    1 - easing(1 - p)\n", "import { cubicBezier } from \"./cubic-bezier\"\nimport { mirrorEasing } from \"./modifiers/mirror\"\nimport { reverseEasing } from \"./modifiers/reverse\"\n\nexport const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99)\nexport const backIn = /*@__PURE__*/ reverseEasing(backOut)\nexport const backInOut = /*@__PURE__*/ mirrorEasing(backIn)\n", "import { backIn } from \"./back\"\n\nexport const anticipate = (p: number) =>\n    p >= 1\n        ? 1\n        : (p *= 2) < 1\n          ? 0.5 * backIn(p)\n          : 0.5 * (2 - Math.pow(2, -10 * (p - 1)))\n", "import { mirrorEasing } from \"./modifiers/mirror\"\nimport { reverseEasing } from \"./modifiers/reverse\"\nimport { EasingFunction } from \"./types\"\n\nexport const circIn: EasingFunction = (p) => 1 - Math.sin(Math.acos(p))\nexport const circOut = /* @__PURE__ */ reverseEasing(circIn)\nexport const circInOut = /* @__PURE__ */ mirrorEasing(circIn)\n", "import { cubicBezier } from \"./cubic-bezier\"\n\nexport const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1)\nexport const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1)\nexport const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1)\n", "import { Easing } from \"../types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const isEasingArray = (ease: any): ease is Easing[] => {\n    return Array.isArray(ease) && typeof ease[0] !== \"number\"\n}\n", "import { wrap } from \"../../wrap\"\nimport { Easing } from \"../types\"\nimport { isEasingArray } from \"./is-easing-array\"\n\n/*#__NO_SIDE_EFFECTS__*/\nexport function getEasingForSegment(\n    easing: Easing | Easing[],\n    i: number\n): Easing {\n    return isEasingArray(easing) ? easing[wrap(0, easing.length, i)] : easing\n}\n", "import { BezierDefinition, Easing } from \"../types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nexport const isBezierDefinition = (\n    easing: Easing | Easing[]\n): easing is BezierDefinition =>\n    Array.isArray(easing) && typeof easing[0] === \"number\"\n", "import { invariant } from \"../../errors\"\nimport { noop } from \"../../noop\"\nimport { anticipate } from \"../anticipate\"\nimport { backIn, backInOut, backOut } from \"../back\"\nimport { circIn, circInOut, circOut } from \"../circ\"\nimport { cubicBezier } from \"../cubic-bezier\"\nimport { easeIn, easeInOut, easeOut } from \"../ease\"\nimport { Easing, EasingFunction } from \"../types\"\nimport { isBezierDefinition } from \"./is-bezier-definition\"\n\nconst easingLookup = {\n    linear: noop,\n    easeIn,\n    easeInOut,\n    easeOut,\n    circIn,\n    circInOut,\n    circOut,\n    backIn,\n    backInOut,\n    backOut,\n    anticipate,\n}\n\nconst isValidEasing = (easing: Easing): easing is keyof typeof easingLookup => {\n    return typeof easing === \"string\"\n}\n\nexport const easingDefinitionToFunction = (\n    definition: Easing\n): EasingFunction => {\n    if (isBezierDefinition(definition)) {\n        // If cubic bezier definition, create bezier curve\n        typeof process !== \"undefined\" &&\n            process.env.NODE_ENV !== \"production\" &&\n            invariant(\n                definition.length === 4,\n                `Cubic bezier arrays must contain four numerical values.`,\n                \"cubic-bezier-length\"\n            )\n\n        const [x1, y1, x2, y2] = definition\n        return cubicBezier(x1, y1, x2, y2)\n    } else if (isValidEasing(definition)) {\n        // Else lookup from table\n        typeof process !== \"undefined\" &&\n            process.env.NODE_ENV !== \"production\" &&\n            invariant(\n                easingLookup[definition] !== undefined,\n                `Invalid easing type '${definition}'`,\n                \"invalid-easing-type\"\n            )\n        return easingLookup[definition]\n    }\n\n    return definition\n}\n", "import { FrameData } from \"./types\"\n\n/**\n * The frameloop's state, kept apart from the frameloop itself so that\n * reading it doesn't bundle the scheduler.\n */\nexport const frameData: FrameData = {\n    delta: 0.0,\n    timestamp: 0.0,\n    isProcessing: false,\n}\n", "import { MotionGlobalConfig } from \"motion-utils\"\nimport { frameData } from \"./frame-data\"\n\nlet now: number | undefined\n\nfunction clearTime() {\n    now = undefined\n}\n\n/**\n * An eventloop-synchronous alternative to performance.now().\n *\n * Ensures that time measurements remain consistent within a synchronous context.\n * Usually calling performance.now() twice within the same synchronous context\n * will return different values which isn't useful for animations when we're usually\n * trying to sync animations to the same frame.\n */\nexport const time = {\n    now: (): number => {\n        if (now === undefined) {\n            time.set(\n                frameData.isProcessing || MotionGlobalConfig.useManualTiming\n                    ? frameData.timestamp\n                    : performance.now()\n            )\n        }\n\n        return now!\n    },\n    set: (newTime: number) => {\n        now = newTime\n        queueMicrotask(clearTime)\n    },\n}\n", "// If this number is a decimal, make it just five decimal places\n// to avoid exponents\nexport const sanitize = (v: number) => Math.round(v * 100000) / 100000\n", "import { AnyResolvedKeyframe } from \"../types\"\n\nexport type CSSVariableName = `--${string}`\n\nexport type CSSVariableToken = `var(${CSSVariableName})`\n\nconst checkStringStartsWith =\n    <T extends string>(token: string) =>\n    (key?: AnyResolvedKeyframe | null): key is T =>\n        typeof key === \"string\" && key.startsWith(token)\n\nexport const isCSSVariableName =\n    /*@__PURE__*/ checkStringStartsWith<CSSVariableName>(\"--\")\n\nconst startsAsVariableToken =\n    /*@__PURE__*/ checkStringStartsWith<CSSVariableToken>(\"var(--\")\nexport const isCSSVariableToken = (\n    value?: string\n): value is CSSVariableToken => {\n    const startsWithToken = startsAsVariableToken(value)\n\n    if (!startsWithToken) return false\n\n    // Ensure any comments are stripped from the value as this can harm performance of the regex.\n    return singleCssVariableRegex.test(value.split(\"/*\")[0].trim())\n}\n\nconst singleCssVariableRegex =\n    /var\\(--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)$/iu\n\n/**\n * Check if a value contains a CSS variable anywhere (e.g. inside calc()).\n * Unlike isCSSVariableToken which checks if the value IS a var() token,\n * this checks if the value CONTAINS var() somewhere in the string.\n */\nexport function containsCSSVariable(\n    value?: AnyResolvedKeyframe | null\n): boolean {\n    if (typeof value !== \"string\") return false\n    // Strip comments to avoid false positives\n    return value.split(\"/*\")[0].includes(\"var(--\")\n}\n", "import { clamp } from \"motion-utils\"\n\nexport const number = {\n    test: (v: number) => typeof v === \"number\",\n    parse: parseFloat,\n    transform: (v: number) => v,\n}\n\nexport const alpha = {\n    ...number,\n    transform: (v: number) => clamp(0, 1, v),\n}\n\nexport const scale = {\n    ...number,\n    default: 1,\n}\n", "export const floatRegex = /-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)/gu\n", "export function isNullish(v: any): v is null | undefined {\n    return v == null\n}\n", "export const singleColorRegex =\n    /^(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))$/iu\n", "import { Color, HSLA, RGBA } from \"../types\"\nimport { floatRegex } from \"../utils/float-regex\"\nimport { isNullish } from \"../utils/is-nullish\"\nimport { singleColorRegex } from \"../utils/single-color-regex\"\n\n/**\n * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,\n * but false if a number or multiple colors\n */\nexport const isColorString = (type: string, testProp?: string) => (v: any) => {\n    return Boolean(\n        (typeof v === \"string\" &&\n            singleColorRegex.test(v) &&\n            v.startsWith(type)) ||\n            (testProp &&\n                !isNullish(v) &&\n                Object.prototype.hasOwnProperty.call(v, testProp))\n    )\n}\n\nexport const splitColor =\n    <V extends RGBA | HSLA>(aName: string, bName: string, cName: string) =>\n    (v: string | Color): V => {\n        if (typeof v !== \"string\") return v as any\n\n        const [a, b, c, alpha] = v.match(floatRegex) as any\n\n        return {\n            [aName]: parseFloat(a),\n            [bName]: parseFloat(b),\n            [cName]: parseFloat(c),\n            alpha: alpha !== undefined ? parseFloat(alpha) : 1,\n        } as V\n    }\n", "import { clamp } from \"motion-utils\"\nimport { alpha as alphaType, number } from \"../numbers\"\nimport { RGBA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nconst clampRgbUnit = (v: number) => clamp(0, 255, v)\nexport const rgbUnit = {\n    ...number,\n    transform: (v: number) => Math.round(clampRgbUnit(v)),\n}\n\nexport const rgba = {\n    test: /*@__PURE__*/ isColorString(\"rgb\", \"red\"),\n    parse: /*@__PURE__*/ splitColor<RGBA>(\"red\", \"green\", \"blue\"),\n    transform: ({ red, green, blue, alpha = 1 }: RGBA) =>\n        \"rgba(\" +\n        rgbUnit.transform(red) +\n        \", \" +\n        rgbUnit.transform(green) +\n        \", \" +\n        rgbUnit.transform(blue) +\n        \", \" +\n        sanitize(alphaType.transform(alpha)) +\n        \")\",\n}\n", "import { RGBA } from \"../types\"\nimport { rgba } from \"./rgba\"\nimport { isColorString } from \"./utils\"\n\n/**\n * #FF0000 has two characters per channel, #F00 one, which is doubled.\n */\nconst channel = (v: string, i: number, size: number) => {\n    const c = v.substring(1 + i * size, 1 + (i + 1) * size)\n    return size > 1 ? c : c + c\n}\n\nfunction parseHex(v: string): RGBA {\n    const size = v.length > 5 ? 2 : 1\n    const alpha = channel(v, 3, size)\n\n    return {\n        red: parseInt(channel(v, 0, size), 16),\n        green: parseInt(channel(v, 1, size), 16),\n        blue: parseInt(channel(v, 2, size), 16),\n        alpha: alpha ? parseInt(alpha, 16) / 255 : 1,\n    }\n}\n\nexport const hex = {\n    test: /*@__PURE__*/ isColorString(\"#\"),\n    parse: parseHex,\n    transform: rgba.transform,\n}\n", "import { AnyResolvedKeyframe } from \"../../../animation/types\"\n\n/*#__NO_SIDE_EFFECTS__*/\nconst createUnitType = (unit: string) => ({\n    test: (v: AnyResolvedKeyframe) =>\n        typeof v === \"string\" && v.endsWith(unit) && v.split(\" \").length === 1,\n    parse: parseFloat,\n    transform: (v: number | string) => `${v}${unit}`,\n})\n\nexport const degrees = /*@__PURE__*/ createUnitType(\"deg\")\nexport const percent = /*@__PURE__*/ createUnitType(\"%\")\nexport const px = /*@__PURE__*/ createUnitType(\"px\")\nexport const vh = /*@__PURE__*/ createUnitType(\"vh\")\nexport const vw = /*@__PURE__*/ createUnitType(\"vw\")\n\nexport const progressPercentage = /*@__PURE__*/ (() => ({\n    ...percent,\n    parse: (v: string) => percent.parse(v) / 100,\n    transform: (v: number) => percent.transform(v * 100),\n}))()\n", "import { alpha as alphaType } from \"../numbers\"\nimport { percent } from \"../numbers/units\"\nimport { HSLA } from \"../types\"\nimport { sanitize } from \"../utils/sanitize\"\nimport { isColorString, splitColor } from \"./utils\"\n\nexport const hsla = {\n    test: /*@__PURE__*/ isColorString(\"hsl\", \"hue\"),\n    parse: /*@__PURE__*/ splitColor<HSLA>(\"hue\", \"saturation\", \"lightness\"),\n    transform: ({ hue, saturation, lightness, alpha = 1 }: HSLA) => {\n        return (\n            \"hsla(\" +\n            Math.round(hue) +\n            \", \" +\n            percent.transform(sanitize(saturation)) +\n            \", \" +\n            percent.transform(sanitize(lightness)) +\n            \", \" +\n            sanitize(alphaType.transform(alpha)) +\n            \")\"\n        )\n    },\n}\n", "import { HSLA, RGBA } from \"../types\"\nimport { hex } from \"./hex\"\nimport { hsla } from \"./hsla\"\nimport { rgba } from \"./rgba\"\n\nexport const color = {\n    test: (v: any) => rgba.test(v) || hex.test(v) || hsla.test(v),\n    parse: (v: any): RGBA | HSLA => {\n        if (rgba.test(v)) {\n            return rgba.parse(v)\n        } else if (hsla.test(v)) {\n            return hsla.parse(v)\n        } else {\n            return hex.parse(v)\n        }\n    },\n    transform: (v: HSLA | RGBA | string) => {\n        return typeof v === \"string\"\n            ? v\n            : v.hasOwnProperty(\"red\")\n            ? rgba.transform(v as RGBA)\n            : hsla.transform(v as HSLA)\n    },\n    getAnimatableNone: (v: string) => {\n        const parsed = color.parse(v)\n        parsed.alpha = 0\n        return color.transform(parsed)\n    },\n}\n", "export const colorRegex =\n    /(?:#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\))/giu\n", "import { AnyResolvedKeyframe } from \"../../../animation/types\"\nimport { CSSVariableToken } from \"../../../animation/utils/is-css-variable\"\nimport { color } from \"../color\"\nimport { Color } from \"../types\"\nimport { colorRegex } from \"../utils/color-regex\"\nimport { floatRegex } from \"../utils/float-regex\"\nimport { sanitize } from \"../utils/sanitize\"\n\n/**\n * Non-global copies of the token regexes so test() can use .test()\n * (no match array, stops at the first token) without lastIndex state.\n */\nconst hasFloat = /*@__PURE__*/ new RegExp(floatRegex.source)\nconst hasColor = /*@__PURE__*/ new RegExp(colorRegex.source, \"i\")\n\nfunction test(v: any) {\n    return (\n        isNaN(v) &&\n        typeof v === \"string\" &&\n        (hasFloat.test(v) || hasColor.test(v))\n    )\n}\n\nconst NUMBER_TOKEN = \"number\"\nconst COLOR_TOKEN = \"color\"\nconst VAR_TOKEN = \"var\"\nconst VAR_FUNCTION_TOKEN = \"var(\"\nconst SPLIT_TOKEN = \"${}\"\n\nexport type ComplexValues = Array<\n    CSSVariableToken | AnyResolvedKeyframe | Color\n>\n\nexport interface ValueIndexes {\n    color: number[]\n    number: number[]\n    var: number[]\n}\n\nexport interface ComplexValueInfo {\n    values: ComplexValues\n    split: string[]\n    indexes: ValueIndexes\n    types: Array<keyof ValueIndexes>\n}\n\n// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`.\n// The lookahead skips digits in function names, like the 3 in matrix3d(.\nconst complexRegex =\n    /var\\s*\\(\\s*--(?:[\\w-]+\\s*|[\\w-]+\\s*,(?:\\s*[^)(\\s]|\\s*\\((?:[^)(]|\\([^)(]*\\))*\\))+\\s*)\\)|#[\\da-f]{3,8}|(?:rgb|hsl)a?\\((?:-?[\\d.]+%?[,\\s]+){2}-?[\\d.]+%?\\s*(?:[,/]\\s*)?(?:\\b\\d+(?:\\.\\d+)?|\\.\\d+)?%?\\)|-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?![a-z]*\\()/giu\n\n/**\n * Whether analyseComplexValue(value) would find any values, without\n * tokenising the string. CSS variables are resolved before this is\n * used, so it's enough to look for a number or a color.\n */\nexport function hasComplexValues(value: AnyResolvedKeyframe) {\n    const asString = value.toString()\n    return hasFloat.test(asString) || hasColor.test(asString)\n}\n\nexport function analyseComplexValue(\n    value: AnyResolvedKeyframe\n): ComplexValueInfo {\n    const originalValue = value.toString()\n\n    const values: ComplexValues = []\n    const indexes: ValueIndexes = {\n        color: [],\n        number: [],\n        var: [],\n    }\n    const types: Array<keyof ValueIndexes> = []\n\n    let i = 0\n    const tokenised = originalValue.replace(complexRegex, (parsedValue) => {\n        if (color.test(parsedValue)) {\n            indexes.color.push(i)\n            types.push(COLOR_TOKEN)\n            values.push(color.parse(parsedValue))\n        } else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {\n            indexes.var.push(i)\n            types.push(VAR_TOKEN)\n            values.push(parsedValue)\n        } else {\n            indexes.number.push(i)\n            types.push(NUMBER_TOKEN)\n            values.push(parseFloat(parsedValue))\n        }\n        ++i\n        return SPLIT_TOKEN\n    })\n    const split = tokenised.split(SPLIT_TOKEN)\n\n    return { values, split, indexes, types }\n}\n\nfunction parseComplexValue(v: AnyResolvedKeyframe) {\n    return analyseComplexValue(v).values\n}\n\nexport function buildTransformer({ split, types }: ComplexValueInfo) {\n    const numSections = split.length\n    return (v: Array<CSSVariableToken | Color | number | string>) => {\n        let output = \"\"\n        for (let i = 0; i < numSections; i++) {\n            output += split[i]\n            if (v[i] !== undefined) {\n                const type = types[i]\n                if (type === NUMBER_TOKEN) {\n                    output += sanitize(v[i] as number)\n                } else if (type === COLOR_TOKEN) {\n                    output += color.transform(v[i] as Color)\n                } else {\n                    output += v[i]\n                }\n            }\n        }\n\n        return output\n    }\n}\n\nfunction createTransformer(source: AnyResolvedKeyframe) {\n    return buildTransformer(analyseComplexValue(source))\n}\n\nconst convertNumbersToZero = (v: number | string) =>\n    typeof v === \"number\" ? 0 : color.test(v) ? color.getAnimatableNone(v) : v\n\n/**\n * Convert a parsed value to its zero equivalent, but preserve numbers\n * that act as divisors in CSS calc() expressions.\n *\n * analyseComplexValue extracts numbers from CSS strings and puts the\n * surrounding text into a `split` template array. For example:\n *   \"calc(var(--gap) / 5)\"  →  values: [var(--gap), 5]\n *                               split:  [\"calc(\", \" / \", \")\"]\n *\n * When building a zero-equivalent for animation, naively zeroing all\n * numbers turns the divisor into 0 → \"calc(var(--gap) / 0)\" → NaN.\n * We detect this by checking whether the text preceding a number\n * (split[i]) ends with \"/\" — the CSS calc division operator.\n */\nconst convertToZero = (\n    value: ComplexValues[number],\n    splitBefore: string\n): ComplexValues[number] => {\n    if (typeof value === \"number\") {\n        return splitBefore?.trim().endsWith(\"/\") ? value : 0\n    }\n    return convertNumbersToZero(value as string)\n}\n\nfunction getAnimatableNone(v: AnyResolvedKeyframe) {\n    const info = analyseComplexValue(v)\n    const transformer = buildTransformer(info)\n    return transformer(\n        info.values.map((value, i) => convertToZero(value, info.split[i]))\n    )\n}\n\nexport const complex = {\n    test,\n    parse: parseComplexValue,\n    createTransformer,\n    getAnimatableNone,\n}\n", "import { HSLA, RGBA } from \"../types\"\n\n// Adapted from https://gist.github.com/mjackson/5311256\nfunction hueToRgb(p: number, q: number, t: number) {\n    if (t < 0) t += 1\n    if (t > 1) t -= 1\n    if (t < 1 / 6) return p + (q - p) * 6 * t\n    if (t < 1 / 2) return q\n    if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6\n    return p\n}\n\nexport function hslaToRgba({ hue, saturation, lightness, alpha }: HSLA): RGBA {\n    hue /= 360\n    saturation /= 100\n    lightness /= 100\n\n    let red = 0\n    let green = 0\n    let blue = 0\n\n    if (!saturation) {\n        red = green = blue = lightness\n    } else {\n        const q =\n            lightness < 0.5\n                ? lightness * (1 + saturation)\n                : lightness + saturation - lightness * saturation\n        const p = 2 * lightness - q\n\n        red = hueToRgb(p, q, hue + 1 / 3)\n        green = hueToRgb(p, q, hue)\n        blue = hueToRgb(p, q, hue - 1 / 3)\n    }\n\n    return {\n        red: Math.round(red * 255),\n        green: Math.round(green * 255),\n        blue: Math.round(blue * 255),\n        alpha,\n    }\n}\n", "export function mixImmediate<T>(a: T, b: T) {\n    return (p: number) => (p > 0 ? b : a)\n}\n", "/*\n  Value in range from progress\n\n  Given a lower limit and an upper limit, we return the value within\n  that range as expressed by progress (usually a number from 0 to 1)\n\n  So progress = 0.5 would change\n\n  from -------- to\n\n  to\n\n  from ---- to\n\n  E.g. from = 10, to = 20, progress = 0.5 => 15\n\n  @param [number]: Lower limit of range\n  @param [number]: Upper limit of range\n  @param [number]: The progress between lower and upper limits expressed 0-1\n  @return [number]: Value as calculated from progress within range (not limited within range)\n*/\nexport const mixNumber = (from: number, to: number, progress: number) => {\n    return from + (to - from) * progress\n}\n", "import { warning } from \"motion-utils\"\nimport { hex } from \"../../value/types/color/hex\"\nimport { hsla } from \"../../value/types/color/hsla\"\nimport { hslaToRgba } from \"../../value/types/color/hsla-to-rgba\"\nimport { rgba } from \"../../value/types/color/rgba\"\nimport { Color, HSLA, RGBA } from \"../../value/types/types\"\nimport { mixImmediate } from \"./immediate\"\nimport { mixNumber } from \"./number\"\n\n// Linear color space blending\n// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw\n// Demonstrated http://codepen.io/osublake/pen/xGVVaN\nexport const mixLinearColor = (from: number, to: number, v: number) => {\n    const fromExpo = from * from\n    const expo = v * (to * to - fromExpo) + fromExpo\n    return expo < 0 ? 0 : Math.sqrt(expo)\n}\n\nconst colorTypes = [hex, rgba, hsla]\nconst getColorType = (v: Color | string) =>\n    colorTypes.find((type) => type.test(v))\n\nfunction asRGBA(color: Color | string) {\n    const type = getColorType(color)\n\n    if (!type) {\n        process.env.NODE_ENV !== \"production\" &&\n            warning(\n                false,\n                `'${color}' is not an animatable color. Use the equivalent color code instead.`,\n                \"color-not-animatable\"\n            )\n        return false\n    }\n\n    let model = type.parse(color)\n\n    if (type === hsla) {\n        // TODO Remove this cast - needed since Motion's stricter typing\n        model = hslaToRgba(model as HSLA)\n    }\n\n    return model as RGBA\n}\n\nexport const mixColor = (from: Color | string, to: Color | string) => {\n    const fromRGBA = asRGBA(from)\n    const toRGBA = asRGBA(to)\n\n    if (!fromRGBA || !toRGBA) {\n        return mixImmediate(from, to)\n    }\n\n    const blended = { ...fromRGBA }\n\n    return (v: number) => {\n        blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v)\n        blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v)\n        blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v)\n        blended.alpha = mixNumber(fromRGBA.alpha, toRGBA.alpha, v)\n        return rgba.transform!(blended)\n    }\n}\n", "export const invisibleValues = new Set([\"none\", \"hidden\"])\n\n/**\n * Returns a function that, when provided a progress value between 0 and 1,\n * will return the \"none\" or \"hidden\" string only when the progress is that of\n * the origin or target.\n */\nexport function mixVisibility(origin: string, target: string) {\n    if (invisibleValues.has(origin)) {\n        return (p: number) => (p <= 0 ? origin : target)\n    } else {\n        return (p: number) => (p >= 1 ? target : origin)\n    }\n}\n", "import { pipe, warning } from \"motion-utils\"\nimport { AnyResolvedKeyframe } from \"../../animation/types\"\nimport { isCSSVariableToken } from \"../../animation/utils/is-css-variable\"\nimport { color } from \"../../value/types/color\"\nimport {\n    analyseComplexValue,\n    buildTransformer,\n    ComplexValueInfo,\n    ComplexValues,\n} from \"../../value/types/complex\"\nimport { HSLA, RGBA } from \"../../value/types/types\"\nimport { mixColor } from \"./color\"\nimport { mixImmediate } from \"./immediate\"\nimport { mixNumber as mixNumberImmediate } from \"./number\"\nimport { invisibleValues, mixVisibility } from \"./visibility\"\n\ntype MixableArray = Array<number | RGBA | HSLA | string>\ninterface MixableObject {\n    [key: string]: AnyResolvedKeyframe | RGBA | HSLA\n}\n\nfunction mixNumber(a: number, b: number) {\n    return (p: number) => mixNumberImmediate(a, b, p)\n}\n\nexport function getMixer<T>(a: T) {\n    if (typeof a === \"number\") {\n        return mixNumber\n    } else if (typeof a === \"string\") {\n        return isCSSVariableToken(a)\n            ? mixImmediate\n            : color.test(a)\n            ? mixColor\n            : mixComplex\n    } else if (Array.isArray(a)) {\n        return mixArray\n    } else if (typeof a === \"object\") {\n        return color.test(a) ? mixColor : mixObject\n    }\n\n    return mixImmediate\n}\n\nexport function mixArray(a: MixableArray, b: MixableArray) {\n    const output = [...a]\n    const numValues = output.length\n\n    const blendValue = a.map((v, i) => getMixer(v)(v as any, b[i] as any))\n\n    return (p: number) => {\n        for (let i = 0; i < numValues; i++) {\n            output[i] = blendValue[i](p) as any\n        }\n        return output\n    }\n}\n\nexport function mixObject(a: MixableObject, b: MixableObject) {\n    const output = { ...a, ...b }\n    const blendValue: { [key: string]: (v: number) => any } = {}\n\n    for (const key in output) {\n        if (a[key] !== undefined && b[key] !== undefined) {\n            blendValue[key] = getMixer(a[key])(\n                a[key] as any,\n                b[key] as any\n            ) as any\n        }\n    }\n\n    return (v: number) => {\n        for (const key in blendValue) {\n            output[key] = blendValue[key](v)\n        }\n        return output\n    }\n}\n\nfunction matchOrder(\n    origin: ComplexValueInfo,\n    target: ComplexValueInfo\n): ComplexValues {\n    const orderedOrigin: ComplexValues = []\n\n    const pointers = { color: 0, var: 0, number: 0 }\n\n    for (let i = 0; i < target.values.length; i++) {\n        const type = target.types[i]\n        const originIndex = origin.indexes[type][pointers[type]]\n        const originValue = origin.values[originIndex] ?? 0\n\n        orderedOrigin[i] = originValue\n\n        pointers[type]++\n    }\n\n    return orderedOrigin\n}\n\nexport const mixComplex = (\n    origin: AnyResolvedKeyframe,\n    target: AnyResolvedKeyframe\n) => {\n    const originStats = analyseComplexValue(origin)\n    const targetStats = analyseComplexValue(target)\n    const canInterpolate =\n        originStats.indexes.var.length === targetStats.indexes.var.length &&\n        originStats.indexes.color.length === targetStats.indexes.color.length &&\n        originStats.indexes.number.length >= targetStats.indexes.number.length\n\n    if (canInterpolate) {\n        if (\n            (invisibleValues.has(origin as string) &&\n                !targetStats.values.length) ||\n            (invisibleValues.has(target as string) &&\n                !originStats.values.length)\n        ) {\n            return mixVisibility(origin as string, target as string)\n        }\n\n        return pipe(\n            mixArray(matchOrder(originStats, targetStats), targetStats.values),\n            buildTransformer(targetStats)\n        )\n    } else {\n        process.env.NODE_ENV !== \"production\" &&\n            warning(\n                true,\n                `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,\n                \"complex-values-different\"\n            )\n\n        return mixImmediate(origin, target)\n    }\n}\n", "import { sanitize } from \"../../value/types/utils/sanitize\"\nimport { getMixer } from \"./complex\"\nimport { mixNumber as mixNumberImmediate } from \"./number\"\nimport { Mixer } from \"./types\"\n\n/**\n * A single number with an optional unit, e.g. \"50%\", \"-10px\", \".5em\".\n * Exponents don't match, so they fall through to the complex mixer.\n */\nconst unitValue = /^(-?(?:\\d+(?:\\.\\d*)?|\\.\\d+))([a-z%]*)$/iu\n\n/**\n * Most CSS values Motion mixes are a single number with a unit. Mixing\n * these directly produces the same output as the complex mixer\n * (\"25%\", \"0.33333px\") without tokenising both strings.\n */\nfunction mixUnit(from: string, to: string): Mixer<string> | undefined {\n    const a = unitValue.exec(from)\n    if (!a) return\n    const b = unitValue.exec(to)\n    if (!b || a[2] !== b[2]) return\n\n    const unit = a[2]\n    const origin = parseFloat(a[1])\n    const target = parseFloat(b[1])\n\n    return (p: number) =>\n        sanitize(mixNumberImmediate(origin, target, p)) + unit\n}\n\nexport function mix<T>(from: T, to: T): Mixer<T>\nexport function mix(from: number, to: number, p: number): number\nexport function mix<T>(from: T, to: T, p?: T): Mixer<T> | number {\n    if (\n        typeof from === \"number\" &&\n        typeof to === \"number\" &&\n        typeof p === \"number\"\n    ) {\n        return mixNumberImmediate(from, to, p)\n    }\n\n    if (typeof from === \"string\" && typeof to === \"string\") {\n        const mixer = mixUnit(from, to)\n        if (mixer) return mixer as Mixer<T>\n    }\n\n    const mixer = getMixer(from)\n    return mixer(from as any, to as any) as Mixer<T>\n}\n", "import { StepId } from \"./types\"\n\nexport const stepsOrder: StepId[] = [\n    \"setup\", // Compute\n    \"read\", // Read\n    \"resolveKeyframes\", // Write/Read/Write/Read\n    \"preUpdate\", // Compute\n    \"update\", // Compute\n    \"preRender\", // Compute\n    \"render\", // Write\n    \"postRender\", // Compute\n] as const\n\nexport type StepNames = (typeof stepsOrder)[number]\n", "import { FrameData, Process, Step } from \"./types\"\n\nexport function createRenderStep(runNextFrame: () => void): Step {\n    /**\n     * We create and reuse two queues, one to queue jobs for the current frame\n     * and one for the next. We reuse to avoid triggering GC after x frames.\n     */\n    let thisFrame = new Set<Process>()\n    let nextFrame = new Set<Process>()\n\n    /**\n     * Track whether we're currently processing jobs in this step. This way\n     * we can decide whether to schedule new jobs for this frame or next.\n     */\n    let isProcessing = false\n\n    let flushNextFrame = false\n\n    /**\n     * The callback currently running. If it schedules itself with `immediate`\n     * it's left in place, so as before it doesn't run again this step.\n     */\n    let running: Process | undefined\n\n    /**\n     * A set of processes which were marked keepAlive when scheduled.\n     * A keepAlive process is always also held by a frame queue until\n     * it's cancelled, so a Set has the same lifetime semantics as a\n     * WeakSet here while being considerably faster to query every frame.\n     */\n    const toKeepAlive = new Set<Process>()\n\n    let latestFrameData: FrameData = {\n        delta: 0.0,\n        timestamp: 0.0,\n        isProcessing: false,\n    }\n\n    function triggerCallback(callback: Process) {\n        if (toKeepAlive.has(callback)) {\n            nextFrame.add(callback)\n            runNextFrame()\n        }\n\n        ;(running = callback)(latestFrameData)\n    }\n\n    const step: Step = {\n        /**\n         * Schedule a process to run on the next frame.\n         */\n        schedule: (callback, keepAlive = false, immediate = false) => {\n            const addToCurrentFrame = immediate && isProcessing\n            const queue = addToCurrentFrame ? thisFrame : nextFrame\n\n            if (keepAlive) toKeepAlive.add(callback)\n\n            /**\n             * A callback scheduled with `immediate` during processing may\n             * already have run this step (for instance, a value it reads was\n             * changed by a later callback). Re-adding moves it to the end of\n             * the queue, so it runs again. The running callback is excluded,\n             * so one that re-schedules itself can't loop forever.\n             */\n            addToCurrentFrame && callback !== running && queue.delete(callback)\n\n            queue.add(callback)\n\n            return callback\n        },\n\n        /**\n         * Cancel the provided callback from running on the next frame.\n         */\n        cancel: (callback) => {\n            nextFrame.delete(callback)\n            toKeepAlive.delete(callback)\n        },\n\n        /**\n         * Execute all schedule callbacks.\n         */\n        process: (frameData) => {\n            latestFrameData = frameData\n\n            /**\n             * If we're already processing we've probably been triggered by a flushSync\n             * inside an existing process. Instead of executing, mark flushNextFrame\n             * as true and ensure we flush the following frame at the end of this one.\n             */\n            if (isProcessing) {\n                flushNextFrame = true\n                return\n            }\n\n            isProcessing = true\n\n            // Swap this frame and the next to avoid GC\n            const prevFrame = thisFrame\n            thisFrame = nextFrame\n            nextFrame = prevFrame\n\n            // Execute this frame\n            thisFrame.forEach(triggerCallback)\n\n            // Clear the frame so no callbacks remain. This is to avoid\n            // memory leaks should this render step not run for a while.\n            thisFrame.clear()\n            running = undefined\n\n            isProcessing = false\n\n            if (flushNextFrame) {\n                flushNextFrame = false\n                step.process(frameData)\n            }\n        },\n    }\n\n    return step\n}\n", "import { MotionGlobalConfig } from \"motion-utils\"\nimport { stepsOrder } from \"./order\"\nimport { createRenderStep } from \"./render-step\"\nimport { Batcher, FrameData, Process, Steps } from \"./types\"\n\nconst maxElapsed = 40\n\nexport function createRenderBatcher(\n    scheduleNextBatch: (callback: Function) => void,\n    allowKeepAlive: boolean,\n    state: FrameData = {\n        delta: 0.0,\n        timestamp: 0.0,\n        isProcessing: false,\n    }\n) {\n    let runNextFrame = false\n    let useDefaultElapsed = true\n\n    const flagRunNextFrame = () => (runNextFrame = true)\n\n    const steps = stepsOrder.reduce((acc, key) => {\n        acc[key] = createRenderStep(flagRunNextFrame)\n        return acc\n    }, {} as Steps)\n\n    const {\n        setup,\n        read,\n        resolveKeyframes,\n        preUpdate,\n        update,\n        preRender,\n        render,\n        postRender,\n    } = steps\n\n    const processBatch = () => {\n        const useManualTiming = MotionGlobalConfig.useManualTiming\n        const timestamp = useManualTiming\n            ? state.timestamp\n            : performance.now()\n        runNextFrame = false\n\n        if (!useManualTiming) {\n            state.delta = useDefaultElapsed\n                ? 1000 / 60\n                : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1)\n        }\n\n        state.timestamp = timestamp\n        state.isProcessing = true\n\n        // Unrolled render loop for better per-frame performance\n        setup.process(state)\n        read.process(state)\n        resolveKeyframes.process(state)\n        preUpdate.process(state)\n        update.process(state)\n        preRender.process(state)\n        render.process(state)\n        postRender.process(state)\n\n        state.isProcessing = false\n\n        if (runNextFrame && allowKeepAlive) {\n            useDefaultElapsed = false\n            scheduleNextBatch(processBatch)\n        }\n    }\n\n    const wake = () => {\n        runNextFrame = true\n        useDefaultElapsed = true\n\n        if (!state.isProcessing) {\n            scheduleNextBatch(processBatch)\n        }\n    }\n\n    const schedule = stepsOrder.reduce((acc, key) => {\n        const step = steps[key]\n        acc[key] = (process: Process, keepAlive = false, immediate = false) => {\n            if (!runNextFrame) wake()\n\n            return step.schedule(process, keepAlive, immediate)\n        }\n        return acc\n    }, {} as Batcher)\n\n    const cancel = (process: Process) => {\n        for (let i = 0; i < stepsOrder.length; i++) {\n            steps[stepsOrder[i]].cancel(process)\n        }\n    }\n\n    return { schedule, cancel, state, steps }\n}\n", "import { noop } from \"motion-utils\"\nimport { createRenderBatcher } from \"./batcher\"\nimport { frameData } from \"./frame-data\"\n\nexport const {\n    schedule: frame,\n    cancel: cancelFrame,\n    steps: frameSteps,\n} = /* @__PURE__ */ createRenderBatcher(\n    typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : noop,\n    true,\n    frameData\n)\n", "import { cancelFrame, frame, frameData } from \"../../frameloop\"\nimport { time } from \"../../frameloop/sync-time\"\nimport { FrameData } from \"../../frameloop/types\"\nimport { Driver } from \"./types\"\n\nexport const frameloopDriver: Driver = (update) => {\n    const passTimestamp = ({ timestamp }: FrameData) => update(timestamp)\n\n    return {\n        start: (keepAlive = true) => frame.update(passTimestamp, keepAlive),\n        stop: () => cancelFrame(passTimestamp),\n        /**\n         * If we're processing this frame we can use the\n         * framelocked timestamp to keep things in sync.\n         */\n        now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),\n    }\n}\n", "import { EasingFunction } from \"motion-utils\"\n\nexport const generateLinearEasing = (\n    easing: EasingFunction,\n    duration: number, // as milliseconds\n    resolution: number = 10 // as milliseconds\n): string => {\n    let points = \"\"\n    const numPoints = Math.max(Math.round(duration / resolution), 2)\n\n    for (let i = 0; i < numPoints; i++) {\n        points += Math.round(easing(i / (numPoints - 1)) * 10000) / 10000 + \", \"\n    }\n\n    return `linear(${points.substring(0, points.length - 2)})`\n}\n", "import { KeyframeGenerator } from \"../../types\"\n\n/**\n * Implement a practical max duration for keyframe generation\n * to prevent infinite loops\n */\nexport const maxGeneratorDuration = 20_000\n\nexport function calcGeneratorDuration<T>(\n    generator: KeyframeGenerator<T>,\n    timeStep = 50,\n    maxDuration = maxGeneratorDuration,\n    keyframes?: T[]\n): number {\n    let duration = 0\n    let state = generator.next(duration)\n    keyframes?.push(state.value)\n\n    while (!state.done && duration < maxDuration) {\n        duration += timeStep\n        state = generator.next(duration)\n        keyframes?.push(state.value)\n    }\n\n    return duration >= maxDuration ? Infinity : duration\n}\n", "import { millisecondsToSeconds } from \"motion-utils\"\nimport { GeneratorFactory, Transition } from \"../../types\"\nimport { calcGeneratorDuration, maxGeneratorDuration } from \"./calc-duration\"\n\n/**\n * Create a progress => progress easing function from a generator.\n */\nexport function createGeneratorEasing(\n    options: Transition,\n    scale = 100,\n    createGenerator: GeneratorFactory\n) {\n    /**\n     * The easing is generated over 0 - scale, but velocity is in the\n     * value's own units, so scale it to match. Otherwise an interrupted\n     * spring hands off the wrong speed, or direction. Keyframes with\n     * units (colours, filters, mixed units) give NaN, which is falsy,\n     * so their velocity passes through unscaled.\n     */\n    const { keyframes: k, velocity: v } = options as any\n    const delta = k && k[k.length - 1] - k[0]\n\n    const generator = createGenerator({\n        ...options,\n        velocity: v && delta ? (v * scale) / delta : v,\n        keyframes: [0, scale],\n    })\n    const duration = Math.min(\n        calcGeneratorDuration(generator),\n        maxGeneratorDuration\n    )\n\n    return {\n        type: \"keyframes\",\n        ease: (progress: number) => {\n            return generator.next(duration * progress).value / scale\n        },\n        duration: millisecondsToSeconds(duration),\n    }\n}\n", "import {\n    clamp,\n    millisecondsToSeconds,\n    secondsToMilliseconds,\n    warning,\n} from \"motion-utils\"\nimport {\n    AnimationState,\n    KeyframeGenerator,\n    SpringOptions,\n    Transition,\n    ValueAnimationOptions,\n} from \"../types\"\nimport { generateLinearEasing } from \"../waapi/utils/linear\"\nimport {\n    calcGeneratorDuration,\n    maxGeneratorDuration,\n} from \"./utils/calc-duration\"\nimport { createGeneratorEasing } from \"./utils/create-generator-easing\"\n\n// Default spring physics\nconst defaultStiffness = 100\nconst defaultDamping = 10\nconst defaultMass = 1.0\n\n// Default duration/bounce-based options\nconst defaultDuration = 800 // in ms\nconst defaultBounce = 0.3\nconst defaultVisualDuration = 0.3 // in seconds\n\n// Rest thresholds\nconst restSpeedGranular = 0.01\nconst restSpeedDefault = 2\nconst restDeltaGranular = 0.005\nconst restDeltaDefault = 0.5\n\n// Limits\nconst minDuration = 0.01 // in seconds\nconst maxDuration = 10.0 // in seconds\nconst minDamping = 0.05\n\n/**\n * Maps bounce to a damping ratio as SwiftUI does: 0 is critically damped, and\n * it approaches undamped towards 1 and infinitely overdamped towards -1. Both\n * ends are limited so the spring still moves and settles.\n */\nconst bounceToDampingRatio = (bounce: number) =>\n    bounce < 0\n        ? 1 / Math.max(1 + bounce, minDamping)\n        : Math.max(1 - bounce, minDamping)\n\n/**\n * Scales an overdamped spring's undamped frequency so that, at its defining\n * time, it has as far left to go as the critically damped spring that's\n * criticalFreqTime radians in by then. A negative bounce then changes the\n * shape of the curve, not when it arrives. 1 at a damping ratio of 1, so\n * there's no jump at a bounce of 0.\n *\n * Solved by Newton on the remaining distance (times fast - slow), which is\n * convex from criticalFreqTime onwards. criticalFreqTime is always below the\n * answer, so it converges from below without overshooting.\n */\nfunction overdampedFreqScale(dampingRatio: number, criticalFreqTime: number) {\n    if (!(dampingRatio > 1)) return 1\n\n    const root = Math.sqrt(dampingRatio * dampingRatio - 1)\n    const slow = dampingRatio - root\n    const fast = dampingRatio + root\n    const target =\n        2 * root * Math.exp(-criticalFreqTime) * (1 + criticalFreqTime)\n\n    return (\n        approximateRoot(\n            (freqTime) =>\n                fast * Math.exp(-slow * freqTime) -\n                slow * Math.exp(-fast * freqTime) -\n                target,\n            (freqTime) =>\n                Math.exp(-fast * freqTime) - Math.exp(-slow * freqTime),\n            criticalFreqTime\n        ) / criticalFreqTime\n    )\n}\n\nfunction calcAngularFreq(undampedFreq: number, dampingRatio: number) {\n    return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio)\n}\n\nconst rootIterations = 12\nfunction approximateRoot(\n    envelope: (num: number) => number,\n    derivative: (num: number) => number,\n    initialGuess: number\n): number {\n    let result = initialGuess\n    for (let i = 1; i < rootIterations; i++) {\n        result = result - envelope(result) / derivative(result)\n    }\n    return result\n}\n\n/**\n * This is ported from the Framer implementation of duration-based spring resolution.\n */\nconst safeMin = 0.001\n\n/**\n * Assumes zero initial velocity and the default mass: time-defined springs\n * ignore inherited velocity and only resolve without valid physics. Returns\n * NaN physics when the root search doesn't converge.\n */\nfunction findSpring({\n    duration = defaultDuration,\n    bounce = defaultBounce,\n}: SpringOptions) {\n    let envelope: (num: number) => number\n    let derivative: (num: number) => number\n\n    process.env.NODE_ENV !== \"production\" &&\n        warning(\n            duration <= secondsToMilliseconds(maxDuration),\n            \"Spring duration must be 10 seconds or less\",\n            \"spring-duration-limit\"\n        )\n\n    const dampingRatio = bounceToDampingRatio(bounce)\n\n    duration = clamp(minDuration, maxDuration, millisecondsToSeconds(duration))\n\n    if (dampingRatio < 1) {\n        /**\n         * Underdamped spring\n         */\n        envelope = (undampedFreq) => {\n            const exponentialDecay = undampedFreq * dampingRatio\n            const delta = exponentialDecay * duration\n            const b = calcAngularFreq(undampedFreq, dampingRatio)\n            const c = Math.exp(-delta)\n            return safeMin - (exponentialDecay / b) * c\n        }\n\n        derivative = (undampedFreq) => {\n            const exponentialDecay = undampedFreq * dampingRatio\n            const delta = exponentialDecay * duration\n            const e =\n                dampingRatio *\n                dampingRatio *\n                undampedFreq *\n                undampedFreq *\n                duration\n            const f = Math.exp(-delta)\n            const g = calcAngularFreq(undampedFreq * undampedFreq, dampingRatio)\n            const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1\n            return (factor * -e * f) / g\n        }\n    } else {\n        /**\n         * Critically-damped spring. Overdamped springs reuse this root,\n         * scaled below.\n         */\n        envelope = (undampedFreq) => {\n            const a = Math.exp(-undampedFreq * duration)\n            const b = undampedFreq * duration + 1\n            return -safeMin + a * b\n        }\n\n        derivative = (undampedFreq) => {\n            const a = Math.exp(-undampedFreq * duration)\n            const b = -undampedFreq * (duration * duration)\n            return a * b\n        }\n    }\n\n    const initialGuess = 5 / duration\n    const criticalFreq = approximateRoot(envelope, derivative, initialGuess)\n    const undampedFreq =\n        criticalFreq *\n        overdampedFreqScale(dampingRatio, criticalFreq * duration)\n    const stiffness = undampedFreq * undampedFreq\n\n    return {\n        stiffness,\n        damping: dampingRatio * 2 * Math.sqrt(stiffness),\n        duration: secondsToMilliseconds(duration),\n    }\n}\n\n/**\n * Spring physics must be finite. stiffness and mass are also divisors so must\n * be positive, whereas a damping of 0 is a valid, perpetually oscillating\n * spring. Relational rather than Number.isFinite so numeric strings still\n * coerce.\n */\nconst isValidPhysics = (value: number | undefined, canBeZero?: boolean) =>\n    (canBeZero ? value! >= 0 : value! > 0) && value! < Infinity\n\n/**\n * Returns value if it's usable spring physics, otherwise undefined so callers\n * fall back to the default. An explicit `undefined`, e.g. from a forwarded\n * optional prop, must fall back too. Invalid physics would otherwise resolve\n * to NaN spring values that never report done.\n */\nfunction resolvePhysics(value: number | undefined, canBeZero?: boolean) {\n    if (isValidPhysics(value, canBeZero)) return value\n\n    if (process.env.NODE_ENV !== \"production\") {\n        warning(\n            value === undefined,\n            \"Spring stiffness and mass must be positive, damping 0 or greater\",\n            \"spring-invalid-physics\"\n        )\n    }\n\n    return undefined\n}\n\nfunction getSpringOptions(options: SpringOptions) {\n    /**\n     * Resolve physics before choosing between physics- and duration-based\n     * resolution, so an invalid stiffness doesn't also silently discard a\n     * valid duration/bounce.\n     */\n    const validStiffness = resolvePhysics(options.stiffness)\n    const validDamping = resolvePhysics(options.damping, true)\n    const validMass = resolvePhysics(options.mass)\n\n    const springOptions = {\n        ...options,\n        stiffness: validStiffness ?? defaultStiffness,\n        damping: validDamping ?? defaultDamping,\n        mass: validMass ?? defaultMass,\n        isResolvedFromDuration: false,\n        // stiffness/damping/mass overrides duration/bounce\n        isTimeDefined:\n            (validStiffness ?? validDamping ?? validMass) === undefined &&\n            (options.duration !== undefined || options.bounce !== undefined),\n    }\n\n    if (springOptions.isTimeDefined) {\n        if (options.visualDuration) {\n            const dampingRatio = bounceToDampingRatio(options.bounce || 0)\n            const root =\n                ((2 * Math.PI) / (options.visualDuration * 1.2)) *\n                overdampedFreqScale(dampingRatio, (2 * Math.PI) / 1.2)\n            springOptions.stiffness = root * root\n            springOptions.damping =\n                2 * dampingRatio * Math.sqrt(springOptions.stiffness)\n        } else {\n            Object.assign(springOptions, findSpring(springOptions))\n            springOptions.isResolvedFromDuration = true\n        }\n\n        /**\n         * Time options can degenerate: a NaN bounce gives a NaN damping, an\n         * infinite visualDuration a 0 stiffness, and findSpring NaN for both\n         * when it doesn't converge. Replace the two together, so the\n         * relationship duration resolution establishes between them is never\n         * left half-overwritten.\n         */\n        if (\n            !isValidPhysics(springOptions.stiffness) ||\n            !isValidPhysics(springOptions.damping, true)\n        ) {\n            springOptions.stiffness = defaultStiffness\n            springOptions.damping = defaultDamping\n        }\n    }\n\n    return springOptions\n}\n\nfunction springGenerator(\n    optionsOrVisualDuration:\n        | ValueAnimationOptions<number>\n        | number = defaultVisualDuration,\n    bounce = defaultBounce\n): KeyframeGenerator<number> {\n    const options =\n        typeof optionsOrVisualDuration !== \"object\"\n            ? ({\n                  visualDuration: optionsOrVisualDuration,\n                  keyframes: [0, 1],\n                  bounce,\n              } as ValueAnimationOptions<number>)\n            : optionsOrVisualDuration\n\n    const origin = options.keyframes[0]\n    const target = options.keyframes[options.keyframes.length - 1]\n\n    /**\n     * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n     * to reduce GC during animation.\n     */\n    const state: AnimationState<number> = { done: false, value: origin }\n\n    const {\n        stiffness,\n        damping,\n        mass,\n        duration,\n        isResolvedFromDuration,\n        isTimeDefined,\n    } = getSpringOptions({ ...options })\n\n    /**\n     * Time-defined springs ignore inherited velocity. Velocity from\n     * interrupted animations causes massive oscillation on small-range\n     * animations.\n     */\n    const inheritVelocity = (velocity: number) =>\n        isTimeDefined ? 0 : -millisecondsToSeconds(velocity)\n\n    const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass))\n    const undampedAngularFreq = millisecondsToSeconds(\n        Math.sqrt(stiffness / mass)\n    )\n    const decay = dampingRatio * undampedAngularFreq\n\n    /**\n     * Everything that changes when the spring is retargeted: written by\n     * retarget() and update(), read by the resolvers. Grouped on one object,\n     * like the coefficients (c) below. Writing doubles to object fields\n     * measured marginally faster than to captured let variables in optimised\n     * code; neither allocates, so this is a grouping choice, not a GC one.\n     */\n    const s = {\n        target,\n        delta: target - origin,\n        velocity: inheritVelocity(options.velocity || 0) || 0,\n        restSpeed: 0,\n        restDelta: 0,\n    }\n\n    /**\n     * If we're working on a granular scale, use smaller defaults for determining\n     * when the spring is finished.\n     *\n     * These defaults have been selected empirically based on what strikes a good\n     * ratio between feeling good and finishing as soon as changes are imperceptible.\n     */\n    const setRestThresholds = () => {\n        const isGranularScale = Math.abs(s.delta) < 5\n        s.restSpeed =\n            options.restSpeed ||\n            (isGranularScale ? restSpeedGranular : restSpeedDefault)\n        s.restDelta =\n            options.restDelta ||\n            (isGranularScale ? restDeltaGranular : restDeltaDefault)\n    }\n    setRestThresholds()\n\n    let resolveSpring: (v: number) => number\n    let resolveVelocity: (t: number) => number\n\n    /**\n     * Derives the coefficients that depend on origin, target and initial\n     * velocity. Called once now and again whenever the spring is retargeted.\n     */\n    let update: VoidFunction\n\n    if (dampingRatio < 1) {\n        const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio)\n\n        /**\n         * A is the position coefficient, sinC/cosC the coefficients of the\n         * analytical derivative (px/ms). The exp/sin/cos terms depend only\n         * on t, so they're memoized by t independently of the target: a\n         * spring retargeted every frame samples the same t each frame and\n         * skips the transcendentals entirely.\n         */\n        const c = { A: 0, sinC: 0, cosC: 0, t: -1, env: 0, sin: 0, cos: 0 }\n\n        update = () => {\n            c.A = (s.velocity + decay * s.delta) / angularFreq\n            c.sinC = decay * c.A + s.delta * angularFreq\n            c.cosC = decay * s.delta - c.A * angularFreq\n        }\n\n        const sample = (t: number) => {\n            if (t !== c.t) {\n                c.t = t\n                c.env = Math.exp(-decay * t)\n                c.sin = Math.sin(angularFreq * t)\n                c.cos = Math.cos(angularFreq * t)\n            }\n        }\n\n        // Underdamped spring\n        resolveSpring = (t: number) => {\n            sample(t)\n            return s.target - c.env * (c.A * c.sin + s.delta * c.cos)\n        }\n\n        resolveVelocity = (t: number) => {\n            sample(t)\n            return c.env * (c.sinC * c.sin + c.cosC * c.cos)\n        }\n    } else if (dampingRatio === 1) {\n        // Critically damped spring\n        resolveSpring = (t: number) =>\n            s.target -\n            Math.exp(-undampedAngularFreq * t) *\n                (s.delta + (s.velocity + undampedAngularFreq * s.delta) * t)\n\n        // Analytical derivative of critically damped spring (px/ms)\n        const c = { C: 0 }\n        update = () => {\n            c.C = s.velocity + undampedAngularFreq * s.delta\n        }\n        resolveVelocity = (t: number) =>\n            Math.exp(-undampedAngularFreq * t) *\n            (undampedAngularFreq * c.C * t - s.velocity)\n    } else {\n        /**\n         * Overdamped spring: the sum of a slow and a fast decaying\n         * exponential, so no term can overflow however heavily it's damped.\n         */\n        const dampedAngularFreq =\n            undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1)\n        const slow = decay - dampedAngularFreq\n        const fast = decay + dampedAngularFreq\n\n        /**\n         * Physics-defined springs keep a non-physical limit: once\n         * dampedAngularFreq * t passes 300, both terms decay at the damping\n         * rate. Heavily overdamped drag springs (dragElastic: 0,\n         * dragTransition) rely on this to settle almost at once rather than\n         * creep at stiffness / damping. It only applies when reached within\n         * 300ms (a dampedAngularFreq of 1 rad/ms), so it reads as a stiff\n         * spring snapping into place: any later and it cuts off a slow spring\n         * that's visibly still moving (#1207). Negative bounce needs the\n         * exact curve, so time-defined springs are exempt.\n         */\n        const limit =\n            dampedAngularFreq < 1 || isTimeDefined\n                ? Infinity\n                : 300 / dampedAngularFreq\n        const decayAt = (rate: number, t: number) =>\n            Math.exp(t > limit ? (decay - rate) * limit - decay * t : -rate * t)\n\n        const c = { S: 0, F: 0 }\n        update = () => {\n            const P = (s.velocity + decay * s.delta) / dampedAngularFreq\n            c.S = (s.delta + P) / 2\n            c.F = (s.delta - P) / 2\n        }\n\n        resolveSpring = (t: number) =>\n            s.target - c.S * decayAt(slow, t) - c.F * decayAt(fast, t)\n\n        // Analytical derivative of overdamped spring (px/ms)\n        resolveVelocity = (t: number) =>\n            slow * c.S * decayAt(slow, t) + fast * c.F * decayAt(fast, t)\n    }\n\n    update()\n\n    const calculatedDuration = isResolvedFromDuration ? duration || null : null\n\n    const generator = {\n        calculatedDuration,\n        /**\n         * Aim the spring at a new target from its current position and\n         * velocity, reusing the resolved physics and closures.\n         */\n        retarget: (keyframes: number[], newVelocity: number) => {\n            s.target = keyframes[keyframes.length - 1]\n            s.delta = s.target - keyframes[0]\n            s.velocity = inheritVelocity(newVelocity)\n            // Default thresholds depend on the scale of the new delta\n            if (!(options.restSpeed && options.restDelta)) setRestThresholds()\n            // Invalidate any duration lazily cached by JSAnimation\n            generator.calculatedDuration = calculatedDuration\n            state.done = false\n            update()\n        },\n        velocity: (t: number) => secondsToMilliseconds(resolveVelocity(t)),\n        next: (t: number) => {\n            const current = resolveSpring(t)\n\n            if (!isResolvedFromDuration) {\n                const currentVelocity = secondsToMilliseconds(\n                    resolveVelocity(t)\n                )\n                state.done =\n                    Math.abs(currentVelocity) <= s.restSpeed &&\n                    Math.abs(s.target - current) <= s.restDelta\n            } else {\n                state.done = t >= duration!\n            }\n\n            state.value = state.done ? s.target : current\n\n            return state\n        },\n        toString: () => {\n            const easingDuration = Math.min(\n                calcGeneratorDuration(generator),\n                maxGeneratorDuration\n            )\n\n            const easing = generateLinearEasing(\n                (progress: number) =>\n                    generator.next(easingDuration * progress).value,\n                easingDuration,\n                30\n            )\n\n            return easingDuration + \"ms \" + easing\n        },\n        toTransition: () => {},\n    }\n\n    return generator\n}\n\nconst spring = /* @__PURE__ */ Object.assign(springGenerator, {\n    applyToOptions: (options: Transition) => {\n        const generatorOptions = createGeneratorEasing(\n            options as any,\n            100,\n            springGenerator\n        )\n\n        options.ease = generatorOptions.ease\n        options.duration = secondsToMilliseconds(generatorOptions.duration)\n        options.type = \"keyframes\"\n        return options\n    },\n})\n\nexport { spring }\n", "import {\n    AnimationState,\n    KeyframeGenerator,\n    ValueAnimationOptions,\n} from \"../types\"\nimport { spring as createSpring } from \"./spring\"\n\nexport function inertia({\n    keyframes,\n    velocity = 0.0,\n    power = 0.8,\n    timeConstant = 325,\n    bounceDamping = 10,\n    bounceStiffness = 500,\n    modifyTarget,\n    min,\n    max,\n    restDelta = 0.5,\n    restSpeed,\n}: ValueAnimationOptions<number>): KeyframeGenerator<number> {\n    const origin = keyframes[0]\n\n    const state: AnimationState<number> = {\n        done: false,\n        value: origin,\n    }\n\n    const isOutOfBounds = (v: number) => v < min! || v > max!\n\n    const nearestBoundary = (v: number) => {\n        if (min === undefined) return max\n        if (max === undefined) return min\n\n        return Math.abs(min - v) < Math.abs(max - v) ? min : max\n    }\n\n    let amplitude = power * velocity\n    const ideal = origin + amplitude\n    const target = modifyTarget ? modifyTarget(ideal) : ideal\n\n    /**\n     * If the target has changed we need to re-calculate the amplitude, otherwise\n     * the animation will start from the wrong position.\n     */\n    if (target !== ideal) amplitude = target - origin\n\n    const calcDelta = (t: number) => -amplitude * Math.exp(-t / timeConstant)\n\n    const applyFriction = (t: number) => {\n        const delta = calcDelta(t)\n        state.done = Math.abs(delta) <= restDelta\n        // target + delta can be off from origin by a float error at t = 0\n        state.value = state.done ? target : t ? target + delta : origin\n    }\n\n    /**\n     * Ideally this would resolve for t in a stateless way, we could\n     * do that by always precalculating the animation but as we know\n     * this will be done anyway we can assume that spring will\n     * be discovered during that.\n     */\n    let timeReachedBoundary: number | undefined\n    let spring: KeyframeGenerator<number> | undefined\n\n    const checkCatchBoundary = (t: number) => {\n        if (!isOutOfBounds(state.value)) return\n\n        timeReachedBoundary = t\n\n        spring = createSpring({\n            keyframes: [state.value, nearestBoundary(state.value)!],\n            /**\n             * The friction curve is target + calcDelta(t), so its exact\n             * derivative is -calcDelta(t) / timeConstant in units/ms,\n             * converted here to the units/second expected by spring.\n             */\n            velocity: (-calcDelta(t) / timeConstant) * 1000,\n            damping: bounceDamping,\n            stiffness: bounceStiffness,\n            restDelta,\n            restSpeed,\n        })\n    }\n\n    checkCatchBoundary(0)\n\n    return {\n        calculatedDuration: null,\n        next: (t: number) => {\n            /**\n             * We need to resolve the friction to figure out if we need a\n             * spring but we don't want to do this twice per frame. So here\n             * we flag if we updated for this frame and later if we did\n             * we can skip doing it again.\n             */\n            let hasUpdatedFrame = false\n            if (!spring && timeReachedBoundary === undefined) {\n                hasUpdatedFrame = true\n                applyFriction(t)\n                checkCatchBoundary(t)\n            }\n\n            /**\n             * If we have a spring and the provided t is beyond the moment the friction\n             * animation crossed the min/max boundary, use the spring.\n             */\n            if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) {\n                return spring!.next(t - timeReachedBoundary)\n            } else {\n                !hasUpdatedFrame && applyFriction(t)\n                return state\n            }\n        },\n    }\n}\n", "import {\n    clamp,\n    EasingFunction,\n    invariant,\n    MotionGlobalConfig,\n    noop,\n    pipe,\n    progress,\n} from \"motion-utils\"\nimport { mix } from \"./mix\"\nimport { Mixer, MixerFactory } from \"./mix/types\"\n\nexport interface InterpolateOptions<T> {\n    clamp?: boolean\n    ease?: EasingFunction | EasingFunction[]\n    /**\n     * Returns a mixer for a pair of values, or `undefined` to mix them\n     * as usual.\n     */\n    mixer?: (from: T, to: T) => Mixer<T> | undefined\n}\n\nfunction createMixers<T>(\n    output: T[],\n    ease?: EasingFunction | EasingFunction[],\n    customMixer?: InterpolateOptions<T>[\"mixer\"]\n) {\n    const mixers: Array<Mixer<T>> = []\n    const mixerFactory: MixerFactory<T> = MotionGlobalConfig.mix || mix\n    const numMixers = output.length - 1\n\n    for (let i = 0; i < numMixers; i++) {\n        let mixer =\n            customMixer?.(output[i], output[i + 1]) ||\n            mixerFactory(output[i], output[i + 1])\n\n        if (ease) {\n            const easingFunction = Array.isArray(ease) ? ease[i] || noop : ease\n            mixer = pipe(easingFunction, mixer) as Mixer<T>\n        }\n\n        mixers.push(mixer)\n    }\n\n    return mixers\n}\n\n/**\n * Create a function that maps from a numerical input array to a generic output array.\n *\n * Accepts:\n *   - Numbers\n *   - Colors (hex, hsl, hsla, rgb, rgba)\n *   - Complex (combinations of one or more numbers or strings)\n *\n * ```jsx\n * const mixColor = interpolate([0, 1], ['#fff', '#000'])\n *\n * mixColor(0.5) // 'rgba(128, 128, 128, 1)'\n * ```\n *\n * TODO Revisit this approach once we've moved to data models for values,\n * probably not needed to pregenerate mixer functions.\n *\n * @public\n */\nexport function interpolate<T>(\n    input: number[],\n    output: T[],\n    { clamp: isClamp = true, ease, mixer }: InterpolateOptions<T> = {}\n): (v: number) => T {\n    const inputLength = input.length\n\n    process.env.NODE_ENV !== \"production\" &&\n        invariant(\n            inputLength === output.length,\n            \"Both input and output ranges must be the same length\",\n            \"range-length\"\n        )\n\n    /**\n     * If we're only provided a single input, we can just make a function\n     * that returns the output.\n     */\n    if (inputLength === 1) return () => output[0]\n    if (inputLength === 2 && output[0] === output[1]) return () => output[1]\n\n    const isZeroDeltaRange = input[0] === input[1]\n\n    // If input runs highest -> lowest, reverse both arrays\n    if (input[0] > input[inputLength - 1]) {\n        input = [...input].reverse()\n        output = [...output].reverse()\n    }\n\n    const mixers = createMixers(output, ease, mixer)\n    const numMixers = mixers.length\n\n    const interpolator = (v: number): T => {\n        if (isZeroDeltaRange && v < input[0]) return output[0]\n\n        let i = 0\n\n        if (numMixers > 1) {\n            for (; i < input.length - 2; i++) {\n                if (v < input[i + 1]) break\n            }\n        }\n\n        const progressInRange = progress(input[i], input[i + 1], v)\n\n        return mixers[i](progressInRange)\n    }\n\n    return isClamp\n        ? (v: number) =>\n              interpolator(clamp(input[0], input[inputLength - 1], v))\n        : interpolator\n}\n", "import { progress } from \"motion-utils\"\nimport { mixNumber } from \"../../../utils/mix/number\"\n\nexport function fillOffset(offset: number[], remaining: number): void {\n    const min = offset[offset.length - 1]\n    for (let i = 1; i <= remaining; i++) {\n        const offsetProgress = progress(0, remaining, i)\n        offset.push(mixNumber(min, 1, offsetProgress))\n    }\n}\n", "import { fillOffset } from \"./fill\"\n\nexport function defaultOffset(arr: any[]): number[] {\n    const offset = [0]\n    fillOffset(offset, arr.length - 1)\n    return offset\n}\n", "export function convertOffsetToTimes(offset: number[], duration: number) {\n    return offset.map((o) => o * duration)\n}\n", "import {\n    easeInOut,\n    easingDefinitionToFunction,\n    EasingFunction,\n    isEasingArray,\n    MotionGlobalConfig,\n} from \"motion-utils\"\nimport { interpolate } from \"../../utils/interpolate\"\nimport { mix } from \"../../utils/mix\"\nimport { defaultOffset } from \"../keyframes/offsets/default\"\nimport { convertOffsetToTimes } from \"../keyframes/offsets/time\"\nimport {\n    AnimationState,\n    AnyResolvedKeyframe,\n    KeyframeGenerator,\n    ValueAnimationOptions,\n} from \"../types\"\n\nexport function defaultEasing(\n    values: any[],\n    easing?: EasingFunction\n): EasingFunction[] {\n    return values.map(() => easing || easeInOut).splice(0, values.length - 1)\n}\n\nexport function keyframes<T extends AnyResolvedKeyframe>({\n    duration = 300,\n    keyframes: keyframeValues,\n    times,\n    ease = \"easeInOut\",\n    mixer: transitionMixer,\n}: ValueAnimationOptions<T>): KeyframeGenerator<T> {\n    /**\n     * A mixer only blends values that aren't numbers. Numbers blend as\n     * usual, as they do in springs, and so do the progress animations\n     * behind layout and path animations, which take the same transition.\n     */\n    const customMixer =\n        typeof keyframeValues[0] === \"number\" ? undefined : transitionMixer\n\n    /**\n     * Easing functions can be externally defined as strings. Here we convert them\n     * into actual functions.\n     */\n    const easingFunctions = isEasingArray(ease)\n        ? ease.map(easingDefinitionToFunction)\n        : easingDefinitionToFunction(ease) || easeInOut\n\n    /**\n     * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator\n     * to reduce GC during animation.\n     */\n    const state: AnimationState<T> = {\n        done: false,\n        value: keyframeValues[0],\n    }\n\n    /**\n     * Two keyframes, or keyframes that hold, move once, then hold, as each\n     * value of a sequence does, ease and mix only the pair that moves.\n     */\n    let span = -1\n    if (!customMixer) {\n        for (let i = 1; i < keyframeValues.length; i++) {\n            if (keyframeValues[i] !== keyframeValues[i - 1]) {\n                if (span >= 0) {\n                    span = -2\n                    break\n                }\n                span = i - 1\n            }\n        }\n    }\n\n    if (span >= 0) {\n        const offsets =\n            times && times.length === keyframeValues.length\n                ? times\n                : defaultOffset(keyframeValues)\n        const from = offsets[span] * duration\n        const to = offsets[span + 1] * duration\n        const origin = keyframeValues[span]\n        const target = keyframeValues[span + 1]\n        const ease = Array.isArray(easingFunctions)\n            ? easingFunctions[span]\n            : easingFunctions\n        const mixer = (MotionGlobalConfig.mix || mix)(origin, target)\n        const last = keyframeValues.length - 2\n\n        return {\n            calculatedDuration: duration,\n            next: (t: number) => {\n                /**\n                 * Held keyframes either side of the move are mixed as\n                 * interpolate() mixes them, so colours keep its format.\n                 */\n                state.value =\n                    span && t < from\n                        ? mixer(0)\n                        : span < last && (t >= to || !duration)\n                        ? typeof target === \"number\"\n                            ? target\n                            : mixer(1)\n                        : mixer(\n                              ease(\n                                  t >= to || !duration\n                                      ? 1\n                                      : t <= from\n                                      ? 0\n                                      : (t - from) / (to - from)\n                              )\n                          )\n                state.done = t >= duration\n                return state\n            },\n        }\n    }\n\n    /**\n     * Create a times array based on the provided 0-1 offsets\n     */\n    const absoluteTimes = convertOffsetToTimes(\n        // Only use the provided offsets if they're the correct length\n        // TODO Maybe we should warn here if there's a length mismatch\n        times && times.length === keyframeValues.length\n            ? times\n            : defaultOffset(keyframeValues),\n        duration\n    )\n\n    const mapTimeToKeyframe = interpolate<T>(absoluteTimes, keyframeValues, {\n        ease: Array.isArray(easingFunctions)\n            ? easingFunctions\n            : defaultEasing(keyframeValues, easingFunctions),\n        mixer: customMixer,\n    })\n\n    return {\n        calculatedDuration: duration,\n        next: (t: number) => {\n            state.value = mapTimeToKeyframe(t)\n            state.done = t >= duration\n            return state\n        },\n    }\n}\n", "import { velocityPerSecond } from \"motion-utils\"\nimport { KeyframeGenerator } from \"../../types\"\n\nconst velocitySampleDuration = 5 // ms\n\nexport function getGeneratorVelocity(\n    resolveValue: (v: number) => number,\n    t: number,\n    current: number\n) {\n    const prevT = Math.max(t - velocitySampleDuration, 0)\n    return velocityPerSecond(current - resolveValue(prevT), t - prevT)\n}\n\n/**\n * A generator's velocity at time t in units/second: analytical where the\n * generator provides it (springs), otherwise by finite difference. Before\n * the animation has started this is its initial velocity.\n */\nexport function calcGeneratorVelocity(\n    generator: KeyframeGenerator<any>,\n    t: number,\n    initialVelocity = 0\n): number {\n    if (t <= 0) return initialVelocity\n\n    return generator.velocity\n        ? generator.velocity(t)\n        : getGeneratorVelocity(\n              (s) => generator.next(s).value as number,\n              t,\n              generator.next(t).value as number\n          )\n}\n", "import { AnimationPlaybackOptions } from \"../types\"\n\nexport function getFinalKeyframe<T>(\n    keyframes: T[],\n    { repeat, repeatType = \"loop\" }: AnimationPlaybackOptions,\n    finalKeyframe?: T,\n    speed: number = 1\n): T {\n    /**\n     * The first and last keyframes that aren't null, and how many there\n     * are. Found in one pass rather than filtering into a new array, as\n     * this runs for every value of every animation.\n     */\n    let first: T | undefined\n    let last: T | undefined\n    let numResolved = 0\n    for (let i = 0; i < keyframes.length; i++) {\n        const keyframe = keyframes[i]\n        if (keyframe !== null) {\n            if (!numResolved++) first = keyframe\n            last = keyframe\n        }\n    }\n\n    const useFirstKeyframe =\n        speed < 0 || (repeat && repeatType !== \"loop\" && repeat % 2 === 1)\n    const index = useFirstKeyframe ? 0 : numResolved - 1\n\n    return !index || finalKeyframe === undefined\n        ? ((index ? last : first) as T)\n        : finalKeyframe\n}\n", "import { inertia } from \"../generators/inertia\"\nimport { keyframes } from \"../generators/keyframes\"\nimport { spring } from \"../generators/spring\"\nimport { GeneratorFactory, ValueAnimationTransition } from \"../types\"\n\nconst transitionTypeMap: { [key: string]: GeneratorFactory } = {\n    decay: inertia,\n    inertia,\n    tween: keyframes,\n    keyframes: keyframes,\n    spring,\n}\n\nexport function replaceTransitionType(transition: ValueAnimationTransition) {\n    if (typeof transition.type === \"string\") {\n        transition.type = transitionTypeMap[transition.type]\n    }\n}\n", "import { MotionGlobalConfig } from \"motion-utils\"\n\n/**\n * If an animation's keyframes resolve, or its first frame renders, more than\n * this long after its start time, it starts from then instead. While we prefer\n * to \"start\" an animation as soon as it's triggered, this avoids a visual jump\n * into it after main thread work.\n *\n * Manual timing steps frames by however long it likes, so never lags.\n */\nconst MAX_START_DELAY = 40\n\nexport const resolveStartTime = (startTime: number, now: number) =>\n    now - startTime > MAX_START_DELAY && !MotionGlobalConfig.useManualTiming\n        ? now\n        : startTime\n", "import { frameData } from \"../../frameloop/frame-data\"\nimport { time } from \"../../frameloop/sync-time\"\n\ninterface MotionInspectBase {\n    animation: unknown\n    timestamp: number\n    frameTimestamp: number\n    frameIsProcessing: boolean\n}\n\ninterface MotionInspectAnimationStart extends MotionInspectBase {\n    kind: \"animation-start\"\n    options: object\n}\n\ninterface MotionInspectLayoutAnimationStart extends MotionInspectBase {\n    kind: \"layout-animation-start\"\n    node: unknown\n}\n\ntype MotionInspectRecord =\n    | MotionInspectAnimationStart\n    | MotionInspectLayoutAnimationStart\n\ntype MotionInspectHook = (record: MotionInspectRecord) => void\n\ntype InspectGlobal = typeof globalThis & {\n    __MOTION_INSPECT__?: MotionInspectHook\n}\n\nfunction baseRecord<K extends MotionInspectRecord[\"kind\"]>(\n    kind: K,\n    animation: unknown\n) {\n    return {\n        kind,\n        animation,\n        timestamp: time.now(),\n        frameTimestamp: frameData.timestamp,\n        frameIsProcessing: frameData.isProcessing,\n    }\n}\n\n/**\n * Notify an optional inspector without adding a public Motion API.\n *\n * The record is a raw firehose: the live animation handle, the concrete\n * animation's internal options object untouched (timing fields in\n * internal milliseconds, name/keyframes/element/motionValue still\n * attached), a timestamp and the raw frameloop state at notify time.\n * All interpretation belongs to the consumer behind\n * globalThis.__MOTION_INSPECT__.\n */\nexport function notifyAnimationStart(\n    animation: unknown,\n    options: object,\n    transition?: object\n): void {\n    const notify = (globalThis as InspectGlobal).__MOTION_INSPECT__\n    if (!notify) return\n\n    try {\n        notify({\n            ...baseRecord(\"animation-start\", animation),\n            options: transition ? { ...options, ...transition } : options,\n        })\n    } catch {}\n}\n\n/**\n * Layout animations drive a projection node's progress rather than a\n * property, so the record forwards the live node itself: it carries the\n * DOM instance, the layout options (layoutId) and the progress handle.\n * Fired inside the frame.update that starts the animation, so nodes\n * animating in the same layout commit share frameTimestamp.\n */\nexport function notifyLayoutAnimationStart(\n    animation: unknown,\n    node: unknown\n): void {\n    const notify = (globalThis as InspectGlobal).__MOTION_INSPECT__\n    if (!notify) return\n\n    try {\n        notify({\n            ...baseRecord(\"layout-animation-start\", animation),\n            node,\n        })\n    } catch {}\n}\n", "export class WithPromise {\n    /**\n     * The promise and its resolver are only created when `finished` is\n     * first read. Most animations are never awaited, so this saves a\n     * Promise allocation per value animation.\n     */\n    private _finished?: Promise<void>\n\n    private _resolve?: VoidFunction\n\n    private isResolved = false\n\n    get finished() {\n        if (!this._finished) {\n            this._finished = this.isResolved\n                ? Promise.resolve()\n                : new Promise<void>((resolve) => {\n                      this._resolve = resolve\n                  })\n        }\n\n        return this._finished\n    }\n\n    protected updateFinished() {\n        this._finished = this._resolve = undefined\n        this.isResolved = false\n    }\n\n    protected notifyFinished() {\n        this.isResolved = true\n        this._resolve?.()\n    }\n\n    /**\n     * Allows the animation to be awaited.\n     *\n     * @deprecated Use `finished` instead.\n     */\n    then(onResolve: VoidFunction, onReject?: VoidFunction) {\n        return this.finished.then(onResolve, onReject)\n    }\n}\n", "import {\n    clamp,\n    invariant,\n    millisecondsToSeconds,\n    pipe,\n    secondsToMilliseconds,\n} from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { mix } from \"../utils/mix\"\nimport { Mixer } from \"../utils/mix/types\"\nimport { frameloopDriver } from \"./drivers/frame\"\nimport { DriverControls } from \"./drivers/types\"\nimport { inertia } from \"./generators/inertia\"\nimport { keyframes as keyframesGenerator } from \"./generators/keyframes\"\nimport { calcGeneratorDuration } from \"./generators/utils/calc-duration\"\nimport { calcGeneratorVelocity } from \"./generators/utils/velocity\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n    AnimationPlaybackControlsWithThen,\n    AnimationState,\n    GeneratorFactory,\n    KeyframeGenerator,\n    TimelineWithFallback,\n    ValueAnimationOptions,\n} from \"./types\"\nimport { replaceTransitionType } from \"./utils/replace-transition-type\"\nimport { resolveStartTime } from \"./utils/resolve-start-time\"\nimport { notifyAnimationStart } from \"./utils/notify-inspector\"\nimport { WithPromise } from \"./utils/WithPromise\"\n\nconst percentToProgress = (percent: number) => percent / 100\n\nexport const round = (value: number) => Math.round(value * 10000) / 10000\n\nexport class JSAnimation<T extends number | string>\n    extends WithPromise\n    implements AnimationPlaybackControlsWithThen\n{\n    state: AnimationPlayState = \"idle\"\n\n    startTime: number | null = null\n\n    /**\n     * The driver that's controlling the animation loop. Normally this is a requestAnimationFrame loop\n     * but in tests we can pass in a synchronous loop.\n     */\n    protected driver?: DriverControls\n\n    protected isStopped = false\n\n    /**\n     * The start time this animation picked for itself, until its first tick.\n     */\n    private pendingStartTime?: number\n\n    private generator: KeyframeGenerator<T>\n\n    private calculatedDuration: number\n\n    protected resolvedDuration: number\n\n    protected totalDuration: number\n\n    protected options: ValueAnimationOptions<T>\n\n    /**\n     * The current time of the animation.\n     */\n    private currentTime: number = 0\n\n    /**\n     * The time at which the animation was paused.\n     */\n    protected holdTime: number | null = null\n\n    /**\n     * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.\n     */\n    private playbackSpeed = 1\n\n    /*\n     * If our generator doesn't support mixing numbers, we need to replace keyframes with\n     * [0, 100] and then make a function that maps that to the actual keyframes.\n     *\n     * 100 is chosen instead of 1 as it works nicer with spring animations.\n     */\n    private mixKeyframes: Mixer<T> | undefined\n\n    private mirroredGenerator: KeyframeGenerator<T> | undefined\n\n    /**\n     * Reusable state object for the delay phase to avoid\n     * allocating a new object every frame.\n     */\n    private delayState: AnimationState<T> = {\n        done: false,\n        value: undefined as unknown as T,\n    }\n\n    constructor(options: ValueAnimationOptions<T>) {\n        super()\n\n        this.options = options\n        this.initAnimation()\n        this.play()\n\n        if (options.autoplay === false) this.pause()\n\n        notifyAnimationStart(this, this.options)\n    }\n\n    initAnimation() {\n        const { options } = this\n\n        replaceTransitionType(options)\n\n        const {\n            type = keyframesGenerator,\n            repeat = 0,\n            repeatDelay = 0,\n            repeatType,\n            velocity = 0,\n        } = options\n        let { keyframes } = options\n\n        const generatorFactory =\n            (type as GeneratorFactory) || keyframesGenerator\n\n        if (\n            process.env.NODE_ENV !== \"production\" &&\n            generatorFactory !== keyframesGenerator\n        ) {\n            invariant(\n                keyframes.length <= 2,\n                `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes}`,\n                \"spring-two-frames\"\n            )\n        }\n\n        /**\n         * This runs again when a spring is flattened to attach it to a\n         * timeline, and the keyframes generator blends values itself.\n         */\n        this.mixKeyframes = undefined\n\n        if (\n            generatorFactory !== keyframesGenerator &&\n            typeof keyframes[0] !== \"number\"\n        ) {\n            this.mixKeyframes = pipe(\n                percentToProgress,\n                options.mixer?.(keyframes[0], keyframes[1]) ||\n                    mix(keyframes[0], keyframes[1])\n            ) as (t: number) => T\n\n            keyframes = [0 as T, 100 as T]\n        }\n\n        const generator = generatorFactory(\n            keyframes === options.keyframes\n                ? options\n                : { ...options, keyframes }\n        )\n\n        /**\n         * If we have a mirror repeat type we need to create a second generator that outputs the\n         * mirrored (not reversed) animation and later ping pong between the two generators.\n         */\n        if (repeatType === \"mirror\") {\n            this.mirroredGenerator = generatorFactory({\n                ...options,\n                keyframes: [...keyframes].reverse(),\n                velocity: -velocity,\n            })\n        }\n\n        /**\n         * If duration is undefined and we have repeat options,\n         * we need to calculate a duration from the generator.\n         *\n         * We set it to the generator itself to cache the duration.\n         * Any timeline resolver will need to have already precalculated\n         * the duration by this step.\n         */\n        if (generator.calculatedDuration === null) {\n            generator.calculatedDuration = calcGeneratorDuration(generator)\n        }\n\n        const { calculatedDuration } = generator\n        this.calculatedDuration = calculatedDuration\n        this.resolvedDuration = calculatedDuration + repeatDelay\n        this.totalDuration = this.resolvedDuration * (repeat + 1) - repeatDelay\n        this.generator = generator\n    }\n\n    updateTime(timestamp: number) {\n        // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =\n        // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for\n        // example.\n        this.currentTime =\n            this.holdTime ??\n            Math.round(timestamp - this.startTime!) * this.playbackSpeed\n    }\n\n    tick(timestamp: number, sample = false) {\n        const { generator, totalDuration, calculatedDuration } = this\n\n        if (this.startTime === null) return generator.next(0)\n\n        const {\n            delay = 0,\n            keyframes,\n            type,\n            onUpdate,\n            finalKeyframe,\n        } = this.options\n\n        if (this.startTime === this.pendingStartTime) {\n            this.startTime = resolveStartTime(this.startTime, timestamp)\n        }\n        this.pendingStartTime = undefined\n\n        /**\n         * requestAnimationFrame timestamps can come through as lower than\n         * the startTime as set by performance.now(). Here we prevent this,\n         * though in the future it could be possible to make setting startTime\n         * a pending operation that gets resolved here.\n         */\n        if (this.speed > 0) {\n            this.startTime = Math.min(this.startTime, timestamp)\n        } else if (this.speed < 0) {\n            this.startTime = Math.min(\n                timestamp - totalDuration / this.speed,\n                this.startTime\n            )\n        }\n\n        if (sample) {\n            this.currentTime = timestamp\n        } else {\n            this.updateTime(timestamp)\n        }\n\n        // Rebase on delay\n        const timeWithoutDelay =\n            this.currentTime - delay * (this.playbackSpeed >= 0 ? 1 : -1)\n        const isInDelayPhase =\n            this.playbackSpeed >= 0\n                ? timeWithoutDelay < 0\n                : timeWithoutDelay > totalDuration\n        this.currentTime = Math.max(timeWithoutDelay, 0)\n\n        // If this animation has finished, set the current time  to the total duration.\n        if (this.state === \"finished\" && this.holdTime === null) {\n            this.currentTime = totalDuration\n        }\n\n        const state = this.generate(this.currentTime, isInDelayPhase)\n\n        let { done } = state\n\n        /**\n         * A generator that takes longer than maxGeneratorDuration to finish\n         * has an Infinity duration, so played forwards it finishes when it\n         * says it's done.\n         */\n        if (!isInDelayPhase) {\n            done =\n                this.playbackSpeed >= 0\n                    ? calculatedDuration < Infinity\n                        ? this.currentTime >= totalDuration\n                        : done\n                    : this.currentTime <= 0\n        }\n\n        const isAnimationFinished =\n            this.holdTime === null &&\n            (this.state === \"finished\" || (this.state === \"running\" && done))\n\n        // TODO: The exception for inertia could be cleaner here\n        if (isAnimationFinished && type !== inertia) {\n            state.value = getFinalKeyframe(\n                keyframes,\n                this.options,\n                finalKeyframe,\n                this.speed\n            )\n        }\n\n        if (onUpdate) {\n            onUpdate(state.value)\n        }\n\n        if (isAnimationFinished) {\n            this.finish()\n        }\n\n        return state\n    }\n\n    /**\n     * This animation's time, including delay, at a timestamp.\n     */\n    at(timestamp: number) {\n        return (\n            this.holdTime ??\n            round((timestamp - this.startTime!) * this.playbackSpeed)\n        )\n    }\n\n    /**\n     * The value at a timestamp, without changing this animation's state.\n     * If resolved, it ends at the last resolved keyframe, which is in the\n     * same unit as the others, rather than at finalKeyframe.\n     */\n    sampleAt(timestamp: number, resolved?: boolean): T {\n        const { options, totalDuration } = this\n        const t = this.at(timestamp) - (options.delay || 0)\n\n        return t >= totalDuration && options.type !== inertia\n            ? getFinalKeyframe(\n                  options.keyframes,\n                  options,\n                  resolved ? undefined : options.finalKeyframe\n              )\n            : this.generate(Math.max(t, 0), t < 0).value\n    }\n\n    /**\n     * The generator's state `currentTime` ms after the delay, without\n     * changing the animation's own state.\n     */\n    protected generate(\n        currentTime: number,\n        isInDelayPhase: boolean\n    ): AnimationState<T> {\n        const {\n            generator,\n            totalDuration,\n            mixKeyframes,\n            mirroredGenerator,\n            resolvedDuration,\n        } = this\n        const { keyframes, repeat, repeatType, repeatDelay } = this.options\n\n        let elapsed = currentTime\n        let frameGenerator = generator\n\n        if (repeat) {\n            /**\n             * Get the current progress (0-1) of the animation. If t is >\n             * than duration we'll get values like 2.5 (midway through the\n             * third iteration)\n             */\n            const progress =\n                Math.min(currentTime, totalDuration) / resolvedDuration\n\n            /**\n             * Get the current iteration (0 indexed). For instance the floor of\n             * 2.5 is 2.\n             */\n            let currentIteration = Math.floor(progress)\n\n            /**\n             * Get the current progress of the iteration by taking the remainder\n             * so 2.5 is 0.5 through iteration 2\n             */\n            let iterationProgress = progress % 1.0\n\n            /**\n             * If iteration progress is 1 we count that as the end\n             * of the previous iteration.\n             */\n            if (!iterationProgress && progress >= 1) {\n                iterationProgress = 1\n            }\n\n            iterationProgress === 1 && currentIteration--\n\n            currentIteration = Math.min(currentIteration, repeat + 1)\n\n            /**\n             * Reverse progress if we're not running in \"normal\" direction\n             */\n\n            const isOddIteration = Boolean(currentIteration % 2)\n            if (isOddIteration) {\n                if (repeatType === \"reverse\") {\n                    iterationProgress = 1 - iterationProgress\n                    if (repeatDelay) {\n                        iterationProgress -= repeatDelay / resolvedDuration\n                    }\n                } else if (repeatType === \"mirror\") {\n                    frameGenerator = mirroredGenerator!\n                }\n            }\n\n            elapsed = clamp(0, 1, iterationProgress) * resolvedDuration\n        }\n\n        /**\n         * If we're in negative time, set state as the initial keyframe.\n         * This prevents delay: x, duration: 0 animations from finishing\n         * instantly.\n         */\n        let state: AnimationState<T>\n        if (isInDelayPhase) {\n            this.delayState.value = keyframes[0]\n            state = this.delayState\n        } else {\n            state = frameGenerator.next(elapsed)\n        }\n\n        if (mixKeyframes && !isInDelayPhase) {\n            state.value = mixKeyframes(state.value as number)\n        }\n\n        return state\n    }\n\n    get duration() {\n        return millisecondsToSeconds(this.calculatedDuration)\n    }\n\n    get iterationDuration() {\n        return this.duration + millisecondsToSeconds(this.options.delay ?? 0)\n    }\n\n    get time() {\n        return millisecondsToSeconds(this.currentTime)\n    }\n\n    set time(newTime: number) {\n        /**\n         * Seeking out of \"finished\" leaves the animation paused, so play()\n         * won't renew finished. Renew it here.\n         */\n        if (this.state === \"finished\") this.updateFinished()\n\n        newTime = secondsToMilliseconds(newTime)\n        this.currentTime = newTime\n\n        if (\n            this.startTime === null ||\n            this.holdTime !== null ||\n            this.playbackSpeed === 0\n        ) {\n            this.holdTime = newTime\n        } else if (this.driver) {\n            this.startTime = this.driver.now() - newTime / this.playbackSpeed\n        }\n\n        if (this.driver) {\n            this.driver.start(false)\n        } else {\n            this.startTime = 0\n            this.state = \"paused\"\n            this.holdTime = newTime\n            this.tick(newTime)\n        }\n    }\n\n    /**\n     * Returns the generator's velocity at the current time in units/second.\n     * Uses the analytical derivative when available (springs), avoiding\n     * the MotionValue's frame-dependent velocity estimation.\n     */\n    getGeneratorVelocity(): number {\n        return calcGeneratorVelocity(\n            this.generator,\n            this.currentTime,\n            this.options.velocity\n        )\n    }\n\n    get speed() {\n        return this.playbackSpeed\n    }\n\n    set speed(newSpeed: number) {\n        const hasChanged = this.playbackSpeed !== newSpeed\n\n        if (hasChanged && this.driver) {\n            this.updateTime(time.now())\n        }\n\n        this.playbackSpeed = newSpeed\n\n        if (hasChanged && this.driver) {\n            this.time = millisecondsToSeconds(this.currentTime)\n        }\n    }\n\n    play() {\n        if (this.isStopped) return\n\n        const { driver = frameloopDriver, startTime } = this.options\n\n        if (!this.driver) {\n            this.driver = driver((timestamp) => this.tick(timestamp))\n        }\n\n        this.options.onPlay?.()\n\n        const now = this.driver.now()\n\n        if (this.state === \"finished\") {\n            this.updateFinished()\n            this.startTime = now\n        } else if (this.holdTime !== null) {\n            this.startTime = now - this.holdTime / (this.playbackSpeed || 1)\n        } else if (!this.startTime) {\n            this.startTime = startTime ?? (this.pendingStartTime = now)\n        }\n\n        if (this.state === \"finished\" && this.speed < 0) {\n            this.startTime += this.calculatedDuration\n        }\n\n        this.holdTime = null\n\n        /**\n         * Set playState to running only after we've used it in\n         * the previous logic.\n         */\n        this.state = \"running\"\n\n        this.driver.start()\n    }\n\n    pause() {\n        this.state = \"paused\"\n        this.updateTime(time.now())\n        this.holdTime = this.currentTime\n    }\n\n    /**\n     * This method is bound to the instance to fix a pattern where\n     * animation.stop is returned as a reference from a useEffect.\n     */\n    stop = () => {\n        const { motionValue } = this.options\n        if (motionValue && motionValue.updatedAt !== time.now()) {\n            this.tick(time.now())\n        }\n\n        this.isStopped = true\n        if (this.state === \"idle\") return\n        this.teardown()\n        this.options.onStop?.()\n    }\n\n    complete() {\n        if (this.state !== \"running\") {\n            this.play()\n        }\n\n        this.state = \"finished\"\n        this.holdTime = null\n    }\n\n    finish() {\n        this.notifyFinished()\n        this.teardown()\n        this.state = \"finished\"\n\n        this.options.onComplete?.()\n    }\n\n    cancel() {\n        this.holdTime = null\n        this.startTime = 0\n        this.tick(0)\n        this.teardown()\n        this.options.onCancel?.()\n    }\n\n    private teardown() {\n        this.state = \"idle\"\n        this.driver?.stop()\n        this.driver = undefined\n        this.startTime = this.holdTime = null\n    }\n\n    sample(sampleTime: number): AnimationState<T> {\n        this.startTime = 0\n        return this.tick(sampleTime, true)\n    }\n\n    attachTimeline(timeline: TimelineWithFallback): VoidFunction {\n        if (this.options.allowFlatten) {\n            this.options.type = \"keyframes\"\n            this.options.ease = \"linear\"\n            this.initAnimation()\n        }\n\n        this.driver?.stop()\n        return timeline.observe(this)\n    }\n}\n\n// Legacy function support\nexport function animateValue<T extends number | string>(\n    options: ValueAnimationOptions<T>\n) {\n    return new JSAnimation(options)\n}\n", "import { complex } from \".\"\nimport { floatRegex } from \"../utils/float-regex\"\n\n/**\n * Properties that should default to 1 or 100%\n */\nconst maxDefaults = new Set([\"brightness\", \"contrast\", \"saturate\", \"opacity\"])\n\nfunction applyDefaultFilter(v: string) {\n    const [name, value] = v.slice(0, -1).split(\"(\")\n\n    if (name === \"drop-shadow\") return v\n\n    const [number] = value.match(floatRegex) || []\n    if (!number) return v\n\n    const unit = value.replace(number, \"\")\n    let defaultValue = maxDefaults.has(name) ? 1 : 0\n    if (number !== value) defaultValue *= 100\n\n    return name + \"(\" + defaultValue + unit + \")\"\n}\n\nconst functionRegex = /\\b([a-z-]*)\\(.*?\\)/gu\n\nexport const filter = {\n    ...complex,\n    getAnimatableNone: (v: string) => {\n        const functions = v.match(functionRegex)\n        return functions ? functions.map(applyDefaultFilter).join(\" \") : v\n    },\n}\n", "import { complex } from \".\"\nimport { AnyResolvedKeyframe } from \"../../../animation/types\"\n\nexport const mask = {\n    ...complex,\n    getAnimatableNone: (v: AnyResolvedKeyframe) => {\n        const parsed = complex.parse(v)\n        const transformer = complex.createTransformer(v)\n        return transformer(\n            parsed.map((v) =>\n                typeof v === \"number\" ? 0 : typeof v === \"object\" ? { ...v, alpha: 1 } : v\n            )\n        )\n    },\n}\n", "import { number } from \"./numbers\"\n\nexport const int = {\n    ...number,\n    transform: Math.round,\n}\n", "import { alpha, scale } from \"../numbers\"\nimport { degrees, progressPercentage, px } from \"../numbers/units\"\nimport { ValueTypeMap } from \"./types\"\n\nexport const transformValueTypes: ValueTypeMap = {\n    rotate: degrees,\n    /**\n     * Internal channel for `transition.path` orientToPath. Composed onto\n     * `rotate` at the transform-build sites so the user's `rotate` is\n     * never read or overwritten. Not part of `transformPropOrder`.\n     */\n    pathRotation: degrees,\n    rotateX: degrees,\n    rotateY: degrees,\n    rotateZ: degrees,\n    scale,\n    scaleX: scale,\n    scaleY: scale,\n    scaleZ: scale,\n    skew: degrees,\n    skewX: degrees,\n    skewY: degrees,\n    distance: px,\n    translateX: px,\n    translateY: px,\n    translateZ: px,\n    x: px,\n    y: px,\n    z: px,\n    perspective: px,\n    transformPerspective: px,\n    opacity: alpha,\n    originX: progressPercentage,\n    originY: progressPercentage,\n    originZ: px,\n}\n", "import { int } from \"../int\"\nimport { alpha } from \"../numbers\"\nimport { px } from \"../numbers/units\"\nimport { transformValueTypes } from \"./transform\"\nimport { ValueTypeMap } from \"./types\"\n\nexport const numberValueTypes: ValueTypeMap = {\n    // Border props\n    borderWidth: px,\n    borderTopWidth: px,\n    borderRightWidth: px,\n    borderBottomWidth: px,\n    borderLeftWidth: px,\n    borderRadius: px,\n    borderTopLeftRadius: px,\n    borderTopRightRadius: px,\n    borderBottomRightRadius: px,\n    borderBottomLeftRadius: px,\n\n    // Positioning props\n    width: px,\n    maxWidth: px,\n    height: px,\n    maxHeight: px,\n    top: px,\n    right: px,\n    bottom: px,\n    left: px,\n    inset: px,\n    insetBlock: px,\n    insetBlockStart: px,\n    insetBlockEnd: px,\n    insetInline: px,\n    insetInlineStart: px,\n    insetInlineEnd: px,\n\n    // Spacing props\n    padding: px,\n    paddingTop: px,\n    paddingRight: px,\n    paddingBottom: px,\n    paddingLeft: px,\n    paddingBlock: px,\n    paddingBlockStart: px,\n    paddingBlockEnd: px,\n    paddingInline: px,\n    paddingInlineStart: px,\n    paddingInlineEnd: px,\n    margin: px,\n    marginTop: px,\n    marginRight: px,\n    marginBottom: px,\n    marginLeft: px,\n    marginBlock: px,\n    marginBlockStart: px,\n    marginBlockEnd: px,\n    marginInline: px,\n    marginInlineStart: px,\n    marginInlineEnd: px,\n\n    // Typography\n    fontSize: px,\n\n    // Misc\n    backgroundPositionX: px,\n    backgroundPositionY: px,\n\n    ...transformValueTypes,\n    zIndex: int,\n\n    // SVG\n    fillOpacity: alpha,\n    strokeOpacity: alpha,\n    numOctaves: int,\n}\n", "import { color } from \"../color\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { numberValueTypes } from \"./number\"\nimport { ValueTypeMap } from \"./types\"\n\n/**\n * A map of default value types for common values\n */\nexport const defaultValueTypes: ValueTypeMap = {\n    ...numberValueTypes,\n\n    // Color props\n    color,\n    backgroundColor: color,\n    outlineColor: color,\n    fill: color,\n    stroke: color,\n\n    // Border props\n    borderColor: color,\n    borderTopColor: color,\n    borderRightColor: color,\n    borderBottomColor: color,\n    borderLeftColor: color,\n    filter,\n    WebkitFilter: filter,\n    mask,\n    WebkitMask: mask,\n}\n\n/**\n * Gets the default ValueType for the provided value key\n */\nexport const getDefaultValueType = (key: string) => defaultValueTypes[key]\n", "import { complex } from \"../complex\"\nimport { filter } from \"../complex/filter\"\nimport { mask } from \"../complex/mask\"\nimport { getDefaultValueType } from \"../maps/defaults\"\n\nconst customTypes = /*@__PURE__*/ new Set([filter, mask])\n\n/**\n * The last call and its result. animate() on many elements asks for the\n * same none for each one, and parsing the value is the slow part.\n */\nlet lastKey: string | undefined\nlet lastValue: string | undefined\nlet lastNone: any\n\nexport function getAnimatableNone(key: string, value: string) {\n    if (key === lastKey && value === lastValue) return lastNone\n\n    let defaultValueType = getDefaultValueType(key)\n    if (!customTypes.has(defaultValueType as any)) defaultValueType = complex\n    // If value is not recognised as animatable, ie \"none\", create an animatable version origin based on the target\n    lastNone = defaultValueType.getAnimatableNone\n        ? defaultValueType.getAnimatableNone(value)\n        : undefined\n    lastKey = key\n    lastValue = value\n\n    return lastNone\n}\n", "import { UnresolvedValueKeyframe, ValueKeyframe } from \"../../types\"\n\nexport function fillWildcards(\n    keyframes: ValueKeyframe[] | UnresolvedValueKeyframe[]\n) {\n    for (let i = 1; i < keyframes.length; i++) {\n        keyframes[i] ??= keyframes[i - 1]\n    }\n}\n", "import { transformPropOrder } from \"../utils/keys-transform\"\n\nconst radToDeg = (rad: number) => (rad * 180) / Math.PI\n\ntype MatrixParser = (values: number[]) => number\n\ntype MatrixParsers = Record<\n    (typeof transformPropOrder)[number],\n    number | MatrixParser\n>\n\nconst rotate = (v: number[]) => {\n    const angle = radToDeg(Math.atan2(v[1], v[0]))\n    return rebaseAngle(angle)\n}\n\nconst matrix2dParsers: MatrixParsers = {\n    x: 4,\n    y: 5,\n    translateX: 4,\n    translateY: 5,\n    scaleX: 0,\n    scaleY: 3,\n    scaleZ: () => 1,\n    scale: (v) => (Math.abs(v[0]) + Math.abs(v[3])) / 2,\n    rotate,\n    rotateZ: rotate,\n    skewX: (v) => radToDeg(Math.atan(v[1])),\n    skewY: (v) => radToDeg(Math.atan(v[2])),\n    skew: (v) => (Math.abs(v[1]) + Math.abs(v[2])) / 2,\n} as const\n\nconst rebaseAngle = (angle: number) => {\n    angle = angle % 360\n    if (angle < 0) angle += 360\n    return angle\n}\n\nconst rotateZ = rotate\n\nconst scaleX = (v: number[]) => Math.hypot(v[0], v[1])\nconst scaleY = (v: number[]) => Math.hypot(v[4], v[5])\n\nconst matrix3dParsers: MatrixParsers = {\n    x: 12,\n    y: 13,\n    z: 14,\n    translateX: 12,\n    translateY: 13,\n    translateZ: 14,\n    scaleX,\n    scaleY,\n    scaleZ: (v) => Math.hypot(v[8], v[9], v[10]),\n    scale: (v) => (scaleX(v) + scaleY(v)) / 2,\n    rotateX: (v) => rebaseAngle(radToDeg(Math.atan2(v[6], v[5]))),\n    rotateY: (v) => rebaseAngle(radToDeg(Math.atan2(-v[2], v[0]))),\n    rotateZ,\n    rotate: rotateZ,\n    skewX: (v) => radToDeg(Math.atan(v[4])),\n    skewY: (v) => radToDeg(Math.atan(v[1])),\n    skew: (v) => (Math.abs(v[1]) + Math.abs(v[4])) / 2,\n} as const\n\nexport function defaultTransformValue(name: string): number {\n    return name.includes(\"scale\") ? 1 : 0\n}\n\nexport function parseValueFromTransform(\n    transform: string | undefined,\n    name: string\n): number {\n    if (!transform || transform === \"none\") {\n        return defaultTransformValue(name)\n    }\n\n    const match = transform.match(/^matrix(3d)?\\(([-\\d.e\\s,]+)\\)$/u)\n\n    if (!match) {\n        return defaultTransformValue(name)\n    }\n\n    const valueParser = (match[1] ? matrix3dParsers : matrix2dParsers)[name]\n    /**\n     * parseFloat skips leading whitespace and stops at trailing whitespace.\n     */\n    const values = match[2].split(\",\").map((v) => parseFloat(v))\n\n    return typeof valueParser === \"function\"\n        ? valueParser(values)\n        : values[valueParser]\n}\n\nexport const readTransformValue = (instance: HTMLElement, name: string) => {\n    const { transform = \"none\" } = getComputedStyle(instance)\n    return parseValueFromTransform(transform, name)\n}\n", "/**\n * Generate a list of every possible transform key.\n */\nexport const transformPropOrder = [\n    \"transformPerspective\",\n    \"x\",\n    \"y\",\n    \"z\",\n    \"translateX\",\n    \"translateY\",\n    \"translateZ\",\n    \"scale\",\n    \"scaleX\",\n    \"scaleY\",\n    \"scaleZ\",\n    \"rotate\",\n    \"rotateX\",\n    \"rotateY\",\n    \"rotateZ\",\n    \"skew\",\n    \"skewX\",\n    \"skewY\",\n]\n\n/**\n * A quick lookup for transform props.\n *\n * `pathRotation` is a transform for routing purposes (skipped from raw\n * style application, wired to the transform composite, flags transform\n * dirty) but is intentionally NOT in `transformPropOrder` — it is\n * composed onto `rotate` at the build sites, not serialized in its own\n * slot, and must stay out of the order-array consumers (parse-transform,\n * unit-conversion, keys-position).\n */\nexport const transformProps = /*@__PURE__*/ (() =>\n    new Set([...transformPropOrder, \"pathRotation\"]))()\n", "import type { Box } from \"motion-utils\"\nimport { parseValueFromTransform } from \"../../../render/dom/parse-transform\"\nimport { transformPropOrder } from \"../../../render/utils/keys-transform\"\nimport { MotionValue } from \"../../../value\"\nimport { number } from \"../../../value/types/numbers\"\nimport { px } from \"../../../value/types/numbers/units\"\nimport { ValueType } from \"../../../value/types/types\"\nimport { AnyResolvedKeyframe } from \"../../types\"\nimport { WithRender } from \"../types\"\n\nexport const isNumOrPxType = (v?: ValueType): v is ValueType =>\n    v === number || v === px\n\n/**\n * Measures a positional value in pixels from an element's computed style.\n * The bounding box is only measured on demand as it forces layout and is\n * affected by transforms.\n */\ntype GetActualMeasurementInPixels = (\n    computedStyle: Partial<CSSStyleDeclaration>,\n    measureBox: () => Box\n) => number\n\nconst transformKeys = new Set([\"x\", \"y\", \"z\"])\nconst nonTranslationalTransformKeys = /* @__PURE__ */ transformPropOrder.filter(\n    (key) => !transformKeys.has(key)\n)\n\ntype RemovedTransforms = [string, AnyResolvedKeyframe][]\n\n/**\n * Reset any bounding box-changing transforms so the element can be\n * measured. Returns the values to restore. Values already at their\n * default don't change the box, so they're left alone: an element with\n * only `rotate: 0` doesn't need to be re-rendered before measuring.\n */\nexport function removeNonTranslationalTransform(visualElement: WithRender) {\n    const removedTransforms: RemovedTransforms = []\n\n    nonTranslationalTransformKeys.forEach((key) => {\n        const value: MotionValue<AnyResolvedKeyframe> | undefined =\n            visualElement.getValue(key)\n        if (value !== undefined) {\n            const current = value.get()\n            const reset = key.startsWith(\"scale\") ? 1 : 0\n\n            if (current === reset) return\n\n            removedTransforms.push([key, current])\n            value.set(reset)\n        }\n    })\n\n    return removedTransforms\n}\n\n/**\n * Values that can only be measured from the bounding box. Elements with\n * these values need bounding box-changing transforms removed first.\n */\nexport const boxDependentValues = new Set([\"bottom\", \"right\"])\n\n/**\n * Computed width/height is already in pixels and unaffected by\n * transforms. It's \"auto\" for elements without a layout box (e.g. inline),\n * in which case we fall back to measuring the bounding box.\n */\nfunction measureDimension(\n    computed: string | undefined,\n    measureBox: () => Box,\n    axis: \"x\" | \"y\",\n    paddingStart: string,\n    paddingEnd: string,\n    boxSizing?: string\n) {\n    const px = parseFloat(computed as string)\n    if (!isNaN(px)) return px\n\n    const { min, max } = measureBox()[axis]\n    const size = max - min\n    return boxSizing === \"border-box\"\n        ? size\n        : size - parseFloat(paddingStart) - parseFloat(paddingEnd)\n}\n\nconst transformX: GetActualMeasurementInPixels = ({ transform }) =>\n    parseValueFromTransform(transform, \"x\")\nconst transformY: GetActualMeasurementInPixels = ({ transform }) =>\n    parseValueFromTransform(transform, \"y\")\n\nexport const positionalValues: { [key: string]: GetActualMeasurementInPixels } =\n    {\n        // Dimensions\n        width: (\n            { width, paddingLeft = \"0\", paddingRight = \"0\", boxSizing },\n            measureBox\n        ) =>\n            measureDimension(\n                width,\n                measureBox,\n                \"x\",\n                paddingLeft,\n                paddingRight,\n                boxSizing\n            ),\n        height: (\n            { height, paddingTop = \"0\", paddingBottom = \"0\", boxSizing },\n            measureBox\n        ) =>\n            measureDimension(\n                height,\n                measureBox,\n                \"y\",\n                paddingTop,\n                paddingBottom,\n                boxSizing\n            ),\n\n        top: ({ top }) => parseFloat(top as string),\n        left: ({ left }) => parseFloat(left as string),\n        bottom: ({ top }, measureBox) => {\n            const { y } = measureBox()\n            return parseFloat(top as string) + (y.max - y.min)\n        },\n        right: ({ left }, measureBox) => {\n            const { x } = measureBox()\n            return parseFloat(left as string) + (x.max - x.min)\n        },\n\n        // Transform, including translate longform names\n        x: transformX,\n        y: transformY,\n        translateX: transformX,\n        translateY: transformY,\n    }\n", "import { isNumericalString, isZeroValueString } from \"motion-utils\"\nimport { frame } from \"../../frameloop\"\nimport { MotionValue } from \"../../value\"\nimport { complex } from \"../../value/types/complex\"\nimport { getAnimatableNone } from \"../../value/types/utils/animatable-none\"\nimport { AnyResolvedKeyframe } from \"../types\"\nimport { WithRender } from \"./types\"\nimport { fillWildcards } from \"./utils/fill-wildcards\"\nimport {\n    boxDependentValues,\n    removeNonTranslationalTransform,\n} from \"./utils/unit-conversion\"\n\nexport type UnresolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T | null>\n\nexport type ResolvedKeyframes<T extends AnyResolvedKeyframe> = Array<T>\n\nconst toResolve = new Set<KeyframeResolver>()\nlet isScheduled = false\nlet anyNeedsMeasurement = false\nlet isForced = false\n\nfunction measureAllKeyframes() {\n    if (anyNeedsMeasurement) {\n        const resolversToMeasure: KeyframeResolver[] = []\n        const elementsToMeasure = new Set<WithRender>()\n        const elementsToUntransform = new Set<WithRender>()\n\n        toResolve.forEach((resolver) => {\n            if (!resolver.needsMeasurement) return\n\n            resolversToMeasure.push(resolver)\n            elementsToMeasure.add(resolver.element!)\n\n            if (boxDependentValues.has(resolver.name!)) {\n                elementsToUntransform.add(resolver.element!)\n            }\n        })\n\n        const transformsToRestore = new Map<\n            WithRender,\n            [string, AnyResolvedKeyframe][]\n        >()\n\n        /**\n         * Write pass\n         * Values measured from the bounding box need bounding box-changing\n         * transforms removed first. Values read from computed style don't.\n         */\n        elementsToUntransform.forEach((element: WithRender) => {\n            const removedTransforms = removeNonTranslationalTransform(\n                element as any\n            )\n\n            if (!removedTransforms.length) return\n\n            transformsToRestore.set(element, removedTransforms)\n\n            element.render()\n        })\n\n        // Read\n        resolversToMeasure.forEach((resolver) => resolver.measureInitialState())\n\n        // Write\n        elementsToMeasure.forEach((element: WithRender) => {\n            element.render()\n\n            const restore = transformsToRestore.get(element)\n            if (restore) {\n                restore.forEach(([key, value]) => {\n                    element.getValue(key)?.set(value)\n                })\n            }\n        })\n\n        // Read\n        resolversToMeasure.forEach((resolver) => resolver.measureEndState())\n\n        // Write\n        resolversToMeasure.forEach((resolver) => {\n            if (resolver.suspendedScrollY !== undefined) {\n                window.scrollTo(0, resolver.suspendedScrollY)\n            }\n        })\n    }\n\n    anyNeedsMeasurement = false\n    isScheduled = false\n\n    toResolve.forEach((resolver) => resolver.complete(isForced))\n    toResolve.clear()\n}\n\nfunction readAllKeyframes() {\n    toResolve.forEach((resolver) => {\n        resolver.readKeyframes()\n\n        if (resolver.needsMeasurement) {\n            anyNeedsMeasurement = true\n        }\n    })\n}\n\nexport function flushKeyframeResolvers() {\n    isForced = true\n    readAllKeyframes()\n    measureAllKeyframes()\n    isForced = false\n}\n\n/**\n * Normalise a value read from the subject into an animation origin: a\n * number read as a string (\"0\", \"200\") becomes a number, and a value\n * that isn't animatable (e.g. \"none\") but whose target is becomes an\n * animatable zero in the shape of the target.\n */\nfunction readOrigin(\n    value: AnyResolvedKeyframe | null | undefined,\n    name: string,\n    target: AnyResolvedKeyframe | null\n) {\n    if (typeof value === \"string\") {\n        if (isNumericalString(value) || isZeroValueString(value)) {\n            return parseFloat(value)\n        } else if (!complex.test(value) && complex.test(target)) {\n            return getAnimatableNone(name, target as string)\n        }\n    }\n\n    return value ?? undefined\n}\n\nexport type OnKeyframesResolved<T extends AnyResolvedKeyframe> = (\n    resolvedKeyframes: ResolvedKeyframes<T>,\n    finalKeyframe: T,\n    forced: boolean\n) => void\n\nexport class KeyframeResolver<T extends AnyResolvedKeyframe = any> {\n    name?: string\n    element?: WithRender\n    finalKeyframe?: T\n    suspendedScrollY?: number\n\n    protected unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>\n\n    protected motionValue?: MotionValue<T>\n    private onComplete: OnKeyframesResolved<T>\n\n    state: \"pending\" | \"scheduled\" | \"complete\" = \"pending\"\n\n    /**\n     * Track whether this resolver is async. If it is, it'll be added to the\n     * resolver queue and flushed in the next frame. Resolvers that aren't going\n     * to trigger read/write thrashing don't need to be async.\n     */\n    protected isAsync = false\n\n    /**\n     * Track whether this resolver needs to perform a measurement\n     * to resolve its keyframes.\n     */\n    needsMeasurement = false\n\n    constructor(\n        unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>,\n        onComplete: OnKeyframesResolved<T>,\n        name?: string,\n        motionValue?: MotionValue<T>,\n        element?: WithRender,\n        isAsync = false\n    ) {\n        this.unresolvedKeyframes = [...unresolvedKeyframes]\n        this.onComplete = onComplete\n        this.name = name\n        this.motionValue = motionValue\n        this.element = element\n        this.isAsync = isAsync\n    }\n\n    scheduleResolve() {\n        this.state = \"scheduled\"\n\n        if (this.isAsync) {\n            toResolve.add(this)\n\n            if (!isScheduled) {\n                isScheduled = true\n                frame.read(readAllKeyframes)\n                frame.resolveKeyframes(measureAllKeyframes)\n            }\n        } else {\n            this.readKeyframes()\n            this.complete()\n        }\n    }\n\n    readKeyframes() {\n        const { unresolvedKeyframes, name, element, motionValue } = this\n\n        // If initial keyframe is null we need to read it from the DOM\n        if (unresolvedKeyframes[0] === null) {\n            const currentValue = motionValue?.get()\n\n            // TODO: This doesn't work if the final keyframe is a wildcard\n            const finalKeyframe =\n                unresolvedKeyframes[unresolvedKeyframes.length - 1]\n\n            if (currentValue !== undefined) {\n                unresolvedKeyframes[0] = currentValue\n            } else if (element && name) {\n                const valueAsRead = readOrigin(\n                    element.readValue(name, finalKeyframe),\n                    name,\n                    finalKeyframe\n                )\n\n                if (valueAsRead !== undefined) {\n                    unresolvedKeyframes[0] = valueAsRead\n                }\n            }\n\n            if (unresolvedKeyframes[0] === undefined) {\n                unresolvedKeyframes[0] = finalKeyframe\n            }\n\n            if (motionValue && currentValue === undefined) {\n                motionValue.set(unresolvedKeyframes[0] as T)\n            }\n        }\n\n        fillWildcards(unresolvedKeyframes)\n    }\n\n    setFinalKeyframe() {}\n    measureInitialState() {}\n    renderEndStyles() {}\n    measureEndState() {}\n\n    complete(isForcedComplete = false) {\n        this.state = \"complete\"\n\n        this.onComplete(\n            this.unresolvedKeyframes as ResolvedKeyframes<T>,\n            this.finalKeyframe as T,\n            isForcedComplete\n        )\n\n        toResolve.delete(this)\n    }\n\n    cancel() {\n        if (this.state === \"scheduled\") {\n            toResolve.delete(this)\n            this.state = \"pending\"\n        }\n    }\n\n    resume() {\n        if (this.state === \"pending\") this.scheduleResolve()\n    }\n}\n", "export const isCSSVar = (name: string) => name.startsWith(\"--\")\n", "import { AnyResolvedKeyframe } from \"../../animation/types\"\nimport { isCSSVar } from \"./is-css-var\"\n\nexport function setStyle(\n    element: HTMLElement | SVGElement,\n    name: string,\n    value: AnyResolvedKeyframe\n) {\n    isCSSVar(name)\n        ? element.style.setProperty(name, value as string)\n        : (element.style[name as any] = value as string)\n}\n", "/**\n * Add the ability for test suites to manually set support flags\n * to better test more environments.\n */\nexport const supportsFlags: Record<string, boolean | undefined> = {}\n", "import { memo } from \"motion-utils\"\nimport { supportsFlags } from \"./flags\"\n\nexport function memoSupports<T extends any>(\n    callback: () => T,\n    supportsFlag: keyof typeof supportsFlags\n) {\n    const memoized = memo(callback)\n    return () => supportsFlags[supportsFlag] ?? memoized()\n}\n", "import { ProgressTimeline } from \"../..\"\nimport { memoSupports } from \"./memo\"\n\ndeclare global {\n    interface Window {\n        ScrollTimeline: ScrollTimeline\n        ViewTimeline: ViewTimeline\n    }\n}\n\ndeclare class ScrollTimeline implements ProgressTimeline {\n    constructor(options: ScrollOptions)\n\n    currentTime: null | { value: number }\n\n    cancel?: VoidFunction\n}\n\ndeclare class ViewTimeline implements ProgressTimeline {\n    constructor(options: { subject: Element; axis?: string })\n\n    currentTime: null | { value: number }\n\n    cancel?: VoidFunction\n}\n\nexport const supportsScrollTimeline = /* @__PURE__ */ memoSupports(\n    () => window.ScrollTimeline !== undefined,\n    \"scrollTimeline\"\n)\n\nexport const supportsViewTimeline = /* @__PURE__ */ memoSupports(\n    () => window.ViewTimeline !== undefined,\n    \"viewTimeline\"\n)\n", "import { memoSupports } from \"./memo\"\n\nexport const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {\n    try {\n        document\n            .createElement(\"div\")\n            .animate({ opacity: 0 }, { easing: \"linear(0, 1)\" })\n    } catch (e) {\n        return false\n    }\n    return true\n}, \"linearEasing\")\n", "import { BezierDefinition } from \"motion-utils\"\n\nexport const cubicBezierAsString = ([a, b, c, d]: BezierDefinition) =>\n    `cubic-bezier(${a}, ${b}, ${c}, ${d})`\n", "import { cubicBezierAsString } from \"./cubic-bezier\"\n\nexport const supportedWaapiEasing = {\n    linear: \"linear\",\n    ease: \"ease\",\n    easeIn: \"ease-in\",\n    easeOut: \"ease-out\",\n    easeInOut: \"ease-in-out\",\n    circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),\n    circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),\n    backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),\n    backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),\n}\n", "import { Easing, isBezierDefinition } from \"motion-utils\"\nimport { supportsLinearEasing } from \"../../../utils/supports/linear-easing\"\nimport { generateLinearEasing } from \"../utils/linear\"\nimport { cubicBezierAsString } from \"./cubic-bezier\"\nimport { supportedWaapiEasing } from \"./supported\"\n\nexport function mapEasingToNativeEasing(\n    easing: Easing | Easing[] | undefined,\n    duration: number\n): undefined | string | string[] {\n    if (!easing) {\n        return undefined\n    } else if (typeof easing === \"function\") {\n        return supportsLinearEasing()\n            ? generateLinearEasing(easing, duration)\n            : \"ease-out\"\n    } else if (isBezierDefinition(easing)) {\n        return cubicBezierAsString(easing)\n    } else if (Array.isArray(easing)) {\n        return easing.map(\n            (segmentEasing) =>\n                (mapEasingToNativeEasing(segmentEasing, duration) as string) ||\n                supportedWaapiEasing.easeOut\n        )\n    } else {\n        return supportedWaapiEasing[easing as keyof typeof supportedWaapiEasing]\n    }\n}\n", "import { ValueKeyframesDefinition, ValueTransition } from \"../types\"\nimport { mapEasingToNativeEasing } from \"./easing/map-easing\"\n\nexport function startWaapiAnimation(\n    element: Element,\n    valueName: string,\n    keyframes: ValueKeyframesDefinition,\n    {\n        delay = 0,\n        duration = 300,\n        repeat = 0,\n        repeatType = \"loop\",\n        ease = \"easeOut\",\n        times,\n    }: ValueTransition = {},\n    pseudoElement: string | undefined = undefined\n) {\n    const keyframeOptions: PropertyIndexedKeyframes = {\n        [valueName]: keyframes as string[],\n    }\n    if (times) keyframeOptions.offset = times\n\n    const easing = mapEasingToNativeEasing(ease, duration)\n\n    /**\n     * If this is an easing array, apply to keyframes, not animation as a whole\n     */\n    if (Array.isArray(easing)) keyframeOptions.easing = easing\n\n    const options: KeyframeAnimationOptions = {\n        delay,\n        duration,\n        easing: !Array.isArray(easing) ? easing : \"linear\",\n        fill: \"both\",\n        iterations: repeat + 1,\n        direction: repeatType === \"reverse\" ? \"alternate\" : \"normal\",\n    }\n\n    if (pseudoElement) options.pseudoElement = pseudoElement\n\n    return element.animate(keyframeOptions, options)\n}\n", "import { AnimationGeneratorType, GeneratorFactory } from \"../../types\"\n\nexport function isGenerator(\n    type?: AnimationGeneratorType\n): type is GeneratorFactory {\n    return typeof type === \"function\" && \"applyToOptions\" in type\n}\n", "import { ValueTransition } from \"../../../animation/types\"\nimport { supportsLinearEasing } from \"../../../utils/supports/linear-easing\"\nimport { isGenerator } from \"../../generators/utils/is-generator\"\n\nexport function applyGeneratorOptions({\n    type,\n    ...options\n}: ValueTransition): ValueTransition {\n    if (isGenerator(type) && supportsLinearEasing()) {\n        return type.applyToOptions!(options)\n    } else {\n        options.duration ??= 300\n        options.ease ??= \"easeOut\"\n    }\n\n    return options\n}\n", "import {\n    invariant,\n    millisecondsToSeconds,\n    noop,\n    secondsToMilliseconds,\n} from \"motion-utils\"\nimport { setStyle } from \"../render/dom/style-set\"\nimport { supportsScrollTimeline } from \"../utils/supports/scroll-timeline\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n    AnimationPlaybackControlsWithThen,\n    AnyResolvedKeyframe,\n    DOMValueAnimationOptions,\n    TimelineWithFallback,\n} from \"./types\"\nimport { WithPromise } from \"./utils/WithPromise\"\nimport { notifyAnimationStart } from \"./utils/notify-inspector\"\nimport { startWaapiAnimation } from \"./waapi/start-waapi-animation\"\nimport { applyGeneratorOptions } from \"./waapi/utils/apply-generator\"\n\nexport interface NativeAnimationOptions<V extends AnyResolvedKeyframe = number>\n    extends DOMValueAnimationOptions<V> {\n    pseudoElement?: string\n    startTime?: number\n}\n\n/**\n * NativeAnimation implements AnimationPlaybackControls for the browser's Web Animations API.\n */\nexport class NativeAnimation<T extends AnyResolvedKeyframe>\n    extends WithPromise\n    implements AnimationPlaybackControlsWithThen\n{\n    /**\n     * The interfaced Web Animation API animation\n     */\n    protected animation: Animation\n\n    protected finishedTime: number | null = null\n\n    protected options: NativeAnimationOptions\n\n    /**\n     * The WAAPI animation's finish handler. It's only attached while the\n     * animation can finish, because WebKit never collects an animation\n     * once it has run, nor anything its handlers reference (#4034).\n     */\n    protected onFinish: VoidFunction | null\n\n    private allowFlatten: boolean\n\n    private isStopped = false\n\n    private isPseudoElement: boolean\n\n    /**\n     * Tracks a manually-set start time that takes precedence over WAAPI's\n     * dynamic startTime. This is cleared when play() or time setter is called,\n     * allowing WAAPI to take over timing.\n     */\n    protected manualStartTime: number | null = null\n\n    constructor(options?: NativeAnimationOptions) {\n        super()\n\n        if (!options) return\n\n        const {\n            element,\n            name,\n            keyframes,\n            pseudoElement,\n            allowFlatten = false,\n            finalKeyframe,\n            onComplete,\n        } = options as any\n\n        this.isPseudoElement = Boolean(pseudoElement)\n\n        this.allowFlatten = allowFlatten\n        this.options = options\n\n        typeof process !== \"undefined\" &&\n            process.env.NODE_ENV !== \"production\" &&\n            invariant(\n                typeof options.type !== \"string\",\n                `Mini animate() doesn't support \"type\" as a string.`,\n                \"mini-spring\"\n            )\n\n        const transition = applyGeneratorOptions(options)\n\n        this.animation = startWaapiAnimation(\n            element,\n            name,\n            keyframes,\n            transition,\n            pseudoElement\n        )\n\n        if (transition.autoplay === false) {\n            this.animation.pause()\n        }\n\n        this.animation.onfinish = this.onFinish = () => {\n            this.animation.onfinish = null\n            this.finishedTime = this.time\n\n            if (!pseudoElement) {\n                const keyframe = getFinalKeyframe(\n                    keyframes as any,\n                    this.options as any,\n                    finalKeyframe,\n                    this.speed\n                )\n                this.updateMotionValue?.(keyframe)\n\n                /**\n                 * If we can, we want to commit the final style as set by the user,\n                 * rather than the computed keyframe value supplied by the animation.\n                 * We always do this, even when a motion value is present, to prevent\n                 * a visual flash in Firefox where the WAAPI animation's fill is removed\n                 * during cancel() before the scheduled render can apply the correct value.\n                 */\n                setStyle(element, name, keyframe)\n\n                this.animation.cancel()\n            }\n\n            onComplete?.()\n            this.notifyFinished()\n        }\n\n        notifyAnimationStart(this, options, transition)\n    }\n\n    updateMotionValue?(value?: T): void\n\n    play() {\n        if (this.isStopped) return\n\n        this.manualStartTime = null\n        this.animation.onfinish = this.onFinish\n        this.animation.play()\n\n        if (this.state === \"finished\") {\n            this.updateFinished()\n        }\n    }\n\n    pause() {\n        this.animation.pause()\n    }\n\n    complete() {\n        if (!this.isStopped) this.animation.onfinish = this.onFinish\n        this.animation.finish?.()\n    }\n\n    cancel() {\n        this.animation.onfinish = null\n        try {\n            this.animation.cancel()\n        } catch (e) {}\n    }\n\n    stop() {\n        if (this.isStopped) return\n        this.isStopped = true\n\n        /**\n         * Before its finish event, a finished animation (an instant one is\n         * as soon as it starts) is still showing its end, so it's stopped\n         * like a running one. Otherwise that event would apply its end\n         * over whatever animates the value next.\n         */\n        if (this.state === \"idle\" || this.finishedTime !== null) return\n\n        if (this.updateMotionValue) {\n            this.updateMotionValue()\n        } else {\n            this.commitStyles()\n        }\n\n        if (!this.isPseudoElement) this.cancel()\n    }\n\n    /**\n     * WAAPI doesn't natively have any interruption capabilities.\n     *\n     * In this method, we commit styles back to the DOM before cancelling\n     * the animation.\n     *\n     * This is designed to be overridden by NativeAnimationExtended, which\n     * will create a renderless JS animation and sample it twice to calculate\n     * its current value, \"previous\" value, and therefore allow\n     * Motion to also correctly calculate velocity for any subsequent animation\n     * while deferring the commit until the next animation frame.\n     */\n    protected commitStyles() {\n        const element = this.options?.element\n        if (!this.isPseudoElement && element?.isConnected) {\n            this.animation.commitStyles?.()\n        }\n    }\n\n    get duration() {\n        const duration =\n            this.animation.effect?.getComputedTiming?.().duration || 0\n\n        return millisecondsToSeconds(Number(duration))\n    }\n\n    get iterationDuration() {\n        const { delay = 0 } = this.options || {}\n        return this.duration + millisecondsToSeconds(delay)\n    }\n\n    get time() {\n        return millisecondsToSeconds(Number(this.animation.currentTime) || 0)\n    }\n\n    set time(newTime: number) {\n        const wasFinished = this.finishedTime !== null\n        this.manualStartTime = null\n        this.finishedTime = null\n        this.animation.currentTime = secondsToMilliseconds(newTime)\n\n        /**\n         * Seeking out of \"finished\" leaves the animation paused, so play()\n         * won't renew finished. Renew it here.\n         */\n        if (wasFinished) {\n            this.animation.pause()\n            this.updateFinished()\n        }\n    }\n\n    /**\n     * The playback speed of the animation.\n     * 1 = normal speed, 2 = double speed, 0.5 = half speed.\n     */\n    get speed() {\n        return this.animation.playbackRate\n    }\n\n    set speed(newSpeed: number) {\n        // Allow backwards playback after finishing\n        if (newSpeed < 0) this.finishedTime = null\n\n        this.animation.playbackRate = newSpeed\n    }\n\n    get state() {\n        return this.finishedTime !== null\n            ? \"finished\"\n            : this.animation.playState\n    }\n\n    get startTime() {\n        return this.manualStartTime ?? Number(this.animation.startTime)\n    }\n\n    set startTime(newStartTime: number) {\n        this.manualStartTime = this.animation.startTime = newStartTime\n    }\n\n    /**\n     * Attaches a timeline to the animation, for instance the `ScrollTimeline`.\n     */\n    attachTimeline({\n        timeline,\n        onAttach,\n        observe,\n    }: TimelineWithFallback): VoidFunction {\n        if (this.allowFlatten) {\n            this.animation.effect?.updateTiming({ easing: \"linear\" })\n        }\n\n        this.animation.onfinish = this.onFinish = null\n\n        if (timeline && supportsScrollTimeline()) {\n            this.animation.timeline = timeline as any\n            onAttach?.(this.animation)\n\n            return noop<void>\n        } else {\n            return observe(this)\n        }\n    }\n}\n", "import { anticipate, backInOut, circInOut } from \"motion-utils\"\nimport { ValueAnimationTransition } from \"../../types\"\n\nconst unsupportedEasingFunctions = {\n    anticipate,\n    backInOut,\n    circInOut,\n}\n\nfunction isUnsupportedEase(\n    key: string\n): key is keyof typeof unsupportedEasingFunctions {\n    return key in unsupportedEasingFunctions\n}\n\nexport function replaceStringEasing(transition: ValueAnimationTransition) {\n    if (\n        typeof transition.ease === \"string\" &&\n        isUnsupportedEase(transition.ease)\n    ) {\n        transition.ease = unsupportedEasingFunctions[transition.ease]\n    }\n}\n", "import { clamp } from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { setStyle } from \"../render/dom/style-set\"\nimport { JSAnimation } from \"./JSAnimation\"\nimport { NativeAnimation, NativeAnimationOptions } from \"./NativeAnimation\"\nimport { AnyResolvedKeyframe, ValueAnimationOptions } from \"./types\"\nimport { replaceTransitionType } from \"./utils/replace-transition-type\"\nimport { replaceStringEasing } from \"./waapi/utils/unsupported-easing\"\n\nexport type NativeAnimationOptionsExtended<T extends AnyResolvedKeyframe> =\n    NativeAnimationOptions & ValueAnimationOptions<T> & NativeAnimationOptions\n\n/**\n * 10ms is chosen here as it strikes a balance between smooth\n * results (more than one keyframe per frame at 60fps) and\n * keyframe quantity.\n */\nexport const sampleDelta = 10 //ms\n\nexport class NativeAnimationExtended<\n    T extends AnyResolvedKeyframe\n> extends NativeAnimation<T> {\n    options: NativeAnimationOptionsExtended<T>\n\n    constructor(options: NativeAnimationOptionsExtended<T>) {\n        /**\n         * The base NativeAnimation function only supports a subset\n         * of Motion easings, and WAAPI also only supports some\n         * easing functions via string/cubic-bezier definitions.\n         *\n         * This function replaces those unsupported easing functions\n         * with a JS easing function. This will later get compiled\n         * to a linear() easing function.\n         */\n        replaceStringEasing(options)\n\n        /**\n         * Ensure we replace the transition type with a generator function\n         * before passing to WAAPI.\n         *\n         * TODO: Does this have a better home? It could be shared with\n         * JSAnimation.\n         */\n        replaceTransitionType(options)\n\n        super(options)\n\n        /**\n         * Only set startTime when the animation should autoplay.\n         * Setting startTime on a paused WAAPI animation unpauses it\n         * (per the WAAPI spec), which breaks autoplay: false.\n         */\n        if (options.startTime !== undefined && options.autoplay !== false) {\n            this.startTime = options.startTime\n        }\n\n        this.options = options\n    }\n\n    private sampler?: JSAnimation<T>\n\n    /**\n     * The animation's time now, in ms. Wall-clock rather than WAAPI's\n     * currentTime while running, as under CPU load currentTime may not\n     * reflect the actual elapsed time, causing incorrect sampling and\n     * visual jumps.\n     */\n    private elapsed() {\n        return this.state === \"running\"\n            ? (time.now() - this.startTime) * this.speed\n            : this.time * 1000\n    }\n\n    /**\n     * The value at a time, from a renderless JS animation.\n     */\n    private sample(sampleTime: number) {\n        if (!this.sampler) {\n            const {\n                motionValue,\n                onUpdate,\n                onComplete,\n                onPlay,\n                onStop,\n                element,\n                ...options\n            } = this.options\n\n            /**\n             * Stop it straight away so its driver doesn't run every frame.\n             * It can still be sampled.\n             */\n            this.sampler = new JSAnimation({ ...options, autoplay: false })\n            this.sampler.stop()\n        }\n\n        return this.sampler.sample(Math.max(0, sampleTime)).value\n    }\n\n    /**\n     * The value now, as WAAPI doesn't set the motion value while it runs.\n     */\n    liveValue() {\n        const { state } = this\n\n        if (state === \"running\" || state === \"paused\") {\n            return this.sample(this.elapsed())\n        }\n    }\n\n    /**\n     * WAAPI doesn't natively have any interruption capabilities.\n     *\n     * Rather than read committed styles back out of the DOM, we can\n     * sample a renderless JS animation twice to calculate its current\n     * value, \"previous\" value, and therefore allow Motion to calculate\n     * velocity for any subsequent animation.\n     */\n    updateMotionValue(value?: T) {\n        const { motionValue, element, name } = this.options\n\n        if (!motionValue) return\n\n        if (value !== undefined) {\n            motionValue.set(value)\n            return\n        }\n\n        const { speed } = this\n        const sampleTime = this.elapsed()\n        const delta =\n            this.state === \"running\" && speed\n                ? clamp(0, sampleDelta, sampleTime)\n                : 0\n        const current = this.sample(sampleTime)\n\n        /**\n         * Write the estimated value to inline style so it persists\n         * after cancel(), covering the async gap before the next\n         * animation starts.\n         */\n        if (element && name) setStyle(element, name, current)\n\n        motionValue.setWithVelocity(\n            this.sample(sampleTime - delta * Math.sign(speed)),\n            current,\n            delta / Math.abs(speed || 1)\n        )\n    }\n}\n", "import { complex } from \"../../value/types/complex\"\nimport { ValueKeyframesDefinition } from \"../types\"\n\n/**\n * Check if a value is animatable. Examples:\n *\n * ✅: 100, \"100px\", \"#fff\"\n * ❌: \"block\", \"url(2.jpg)\"\n * @param value\n *\n * @internal\n */\nexport const isAnimatable = (\n    value: ValueKeyframesDefinition,\n    name?: string\n) => {\n    // If the list of keys that might be non-animatable grows, replace with Set\n    if (name === \"zIndex\") return false\n\n    // If it's a number or a keyframes array, we can animate it. We might at some point\n    // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,\n    // but for now lets leave it like this for performance reasons\n    if (typeof value === \"number\" || Array.isArray(value)) return true\n\n    if (\n        typeof value === \"string\" && // It's animatable if we have a string\n        (complex.test(value) || value === \"0\") && // And it contains numbers and/or colors\n        !value.startsWith(\"url(\") // Unless it starts with \"url(\"\n    ) {\n        return true\n    }\n\n    return false\n}\n", "import { warning } from \"motion-utils\"\nimport { isGenerator } from \"../generators/utils/is-generator\"\nimport { ResolvedKeyframes } from \"../keyframes/KeyframesResolver\"\nimport { AnimationGeneratorType } from \"../types\"\nimport { isAnimatable } from \"./is-animatable\"\n\nfunction hasKeyframesChanged(keyframes: ResolvedKeyframes<any>) {\n    const current = keyframes[0]\n    if (keyframes.length === 1) return true\n    for (let i = 0; i < keyframes.length; i++) {\n        if (keyframes[i] !== current) return true\n    }\n}\n\nexport function canAnimate(\n    keyframes: ResolvedKeyframes<any>,\n    name?: string,\n    type?: AnimationGeneratorType,\n    velocity?: number\n) {\n    /**\n     * Check if we're able to animate between the start and end keyframes,\n     * and throw a warning if we're attempting to animate between one that's\n     * animatable and another that isn't.\n     */\n    const originKeyframe = keyframes[0]\n    if (originKeyframe === null) {\n        return false\n    }\n\n    /**\n     * These aren't traditionally animatable but we do support them.\n     * In future we could look into making this more generic or replacing\n     * this function with mix() === mixImmediate\n     */\n    if (name === \"display\" || name === \"visibility\") return true\n\n    const targetKeyframe = keyframes[keyframes.length - 1]\n    const isOriginAnimatable = isAnimatable(originKeyframe, name)\n    const isTargetAnimatable = isAnimatable(targetKeyframe, name)\n\n    // Always skip if any of these are true\n    if (!isOriginAnimatable || !isTargetAnimatable) {\n        // Only build the message when we're going to warn\n        isOriginAnimatable !== isTargetAnimatable &&\n            process.env.NODE_ENV !== \"production\" &&\n            warning(\n                false,\n                `You are trying to animate ${name} from \"${originKeyframe}\" to \"${targetKeyframe}\". \"${\n                    isOriginAnimatable ? targetKeyframe : originKeyframe\n                }\" is not an animatable value.`,\n                \"value-not-animatable\"\n            )\n\n        return false\n    }\n\n    return (\n        hasKeyframesChanged(keyframes) ||\n        ((type === \"spring\" || isGenerator(type)) && velocity)\n    )\n}\n", "import { ValueAnimationOptions } from \"../types\"\n\nexport function makeAnimationInstant(\n    options: Partial<{\n        duration: ValueAnimationOptions[\"duration\"]\n        type: ValueAnimationOptions[\"type\"]\n    }>\n): void {\n    options.duration = 0\n    options.type = \"keyframes\"\n}\n", "/**\n * A list of values that can be hardware-accelerated.\n *\n * Colors aren't included: WAAPI mixes them in sRGB, but JS animations\n * (and the sampler that estimates a WAAPI value on interrupt) mix them\n * in linear color space, so interrupting one would visibly jump.\n */\nexport const acceleratedValues = new Set<string>([\n    \"opacity\",\n    \"clipPath\",\n    \"filter\",\n    \"transform\",\n])\n", "const browserColorFunctions =\n    /^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\\(/\n\nexport function hasBrowserOnlyColors(keyframes: any[]): boolean {\n    for (let i = 0; i < keyframes.length; i++) {\n        if (\n            typeof keyframes[i] === \"string\" &&\n            browserColorFunctions.test(keyframes[i])\n        ) {\n            return true\n        }\n    }\n    return false\n}\n", "import type { ValueAnimationOptions } from \"../../types\"\n\n/**\n * Whether an animation needs its mixer, which WAAPI can't call. Numbers\n * blend as usual, and an animation whose mixer declines every pair runs\n * as it would without one.\n */\nexport const needsMixer = ({ mixer, keyframes }: ValueAnimationOptions<any>) =>\n    mixer &&\n    typeof keyframes[0] !== \"number\" &&\n    keyframes.some((keyframe, i) => i && mixer(keyframes[i - 1], keyframe))\n", "import { MotionGlobalConfig } from \"motion-utils\"\nimport {\n    AnyResolvedKeyframe,\n    ValueAnimationOptionsWithRenderContext,\n} from \"../../types\"\nimport { acceleratedValues } from \"../utils/accelerated-values\"\nimport { hasBrowserOnlyColors } from \"../utils/is-browser-color\"\nimport { needsMixer } from \"../utils/needs-mixer\"\n\nconst colorProperties = new Set([\n    \"color\",\n    \"backgroundColor\",\n    \"outlineColor\",\n    \"fill\",\n    \"stroke\",\n    \"borderColor\",\n    \"borderTopColor\",\n    \"borderRightColor\",\n    \"borderBottomColor\",\n    \"borderLeftColor\",\n])\n\n/**\n * WAAPI runs on the browser's clock, so on a manual clock every animation\n * runs in JS where processFrame can drive it. Set the flag before starting\n * animations: running WAAPI animations stay on the browser's clock.\n */\nexport const supportsWaapi = () =>\n    !MotionGlobalConfig.useManualTiming &&\n    Object.hasOwnProperty.call(Element.prototype, \"animate\")\n\nexport function supportsBrowserAnimation<T extends AnyResolvedKeyframe>(\n    options: ValueAnimationOptionsWithRenderContext<T>\n) {\n    const {\n        motionValue,\n        name,\n        repeatDelay,\n        repeatType,\n        damping,\n        type,\n        keyframes,\n    } = options\n\n    /**\n     * Most values can't be accelerated at all, so check the name before\n     * looking at the element or its props.\n     */\n    if (\n        !name ||\n        !(acceleratedValues.has(name) || colorProperties.has(name))\n    ) {\n        return false\n    }\n\n    const subject = motionValue?.owner?.current\n\n    /**\n     * We use instanceof checks instead of isHTMLElement()/isSVGElement()\n     * because we explicitly **don't** want elements in different timing\n     * contexts (i.e. popups) to be accelerated, as it's not possible to sync\n     * these animations properly with those driven from the main window\n     * frameloop.\n     */\n    if (\n        !(subject instanceof HTMLElement) &&\n        !(subject instanceof SVGElement)\n    ) {\n        return false\n    }\n\n    const { onUpdate, transformTemplate } = motionValue!.owner!.getProps()\n\n    return (\n        supportsWaapi() &&\n        /**\n         * Force WAAPI for color properties with browser-only color formats\n         * (oklch, oklab, lab, lch, etc.) that the JS animation path can't parse.\n         */\n        (acceleratedValues.has(name) ||\n            (colorProperties.has(name) &&\n                hasBrowserOnlyColors(keyframes))) &&\n        (name !== \"transform\" || !transformTemplate) &&\n        /**\n         * If we're outputting values to onUpdate then we can't use WAAPI as there's\n         * no way to read the value from WAAPI every frame.\n         */\n        !onUpdate &&\n        !repeatDelay &&\n        repeatType !== \"mirror\" &&\n        damping !== 0 &&\n        type !== \"inertia\" &&\n        !needsMixer(options)\n    )\n}\n", "import { ValueType } from \"../types\"\n\n/**\n * Provided a value and a ValueType, returns the value as that value type.\n */\nexport const getValueAsType = (value: any, type?: ValueType) => {\n    return type && typeof value === \"number\"\n        ? (type as any).transform(value)\n        : value\n}\n", "import { getValueAsType } from \"../../../value/types/utils/get-as-type\"\nimport { numberValueTypes } from \"../../../value/types/maps/number\"\nimport { transformValueTypes } from \"../../../value/types/maps/transform\"\nimport type { AnyResolvedKeyframe } from \"../../../animation/types\"\nimport { transformPropOrder } from \"../../utils/keys-transform\"\nimport { ResolvedValues } from \"../../types\"\nimport { HTMLRenderState } from \"../types\"\nimport type { MotionNodeOptions } from \"../../../node/types\"\n\nexport const translateAlias: Record<string, string> = {\n    x: \"translateX\",\n    y: \"translateY\",\n    z: \"translateZ\",\n    transformPerspective: \"perspective\",\n}\n\nconst numTransforms = transformPropOrder.length\n\n/**\n * Cache of `translateX(`-style openers so each transform function is a few\n * string concatenations rather than a template.\n */\nconst openers: Record<string, string> = {}\n\n/**\n * A transform function, e.g. `translateX(10px)` for `x: 10`.\n */\nexport const transformFunction = (\n    key: string,\n    value: AnyResolvedKeyframe,\n    valueAsType = getValueAsType(value, transformValueTypes[key])\n) => (openers[key] ||= (translateAlias[key] || key) + \"(\") + valueAsType + \")\"\n\n/**\n * Whether a transform value is at its default, so can be left out.\n */\nexport const isDefaultTransform = (key: string, value: AnyResolvedKeyframe) =>\n    (typeof value === \"number\" ? value : parseFloat(value)) ===\n    (key.startsWith(\"scale\") ? 1 : 0)\n\n/**\n * Build a CSS transform style from individual x/y/scale etc properties.\n *\n * This outputs with a default order of transforms/scales/rotations, this can be customised by\n * providing a transformTemplate function.\n */\nexport function buildTransform(\n    latestValues: ResolvedValues,\n    transform: HTMLRenderState[\"transform\"],\n    transformTemplate?: MotionNodeOptions[\"transformTemplate\"]\n) {\n    // The transform string we're going to build into.\n    let transformString = \"\"\n\n    /**\n     * Loop over all possible transforms in order, adding the ones that\n     * are present to the transform string.\n     */\n    for (let i = 0; i < numTransforms; i++) {\n        const key = transformPropOrder[i]\n        const value = latestValues[key]\n\n        if (value === undefined) continue\n\n        const valueAsType =\n            transformTemplate &&\n            (transform[key] = getValueAsType(value, numberValueTypes[key]))\n\n        if (!isDefaultTransform(key, value)) {\n            transformString +=\n                transformFunction(key, value, valueAsType || undefined) + \" \"\n        }\n    }\n\n    // `pathRotation` composes onto `rotate` as a separate additive term so\n    // the user's `rotate` is never clobbered. Deliberately not a slot in\n    // `transformPropOrder`.\n    const pathRotation = latestValues.pathRotation\n    if (pathRotation) {\n        transformString += transformFunction(\"rotate\", pathRotation)\n    }\n\n    transformString = transformString.trim()\n\n    // If we have a custom `transform` template, pass our transform values and\n    // generated transformString to that before returning\n    return transformTemplate\n        ? transformTemplate(transform, transformString)\n        : transformString || \"none\"\n}\n", "/**\n * The independent transform (x, scale, rotate etc) animations running on\n * each element, composed into one hardware-accelerated `transform`.\n *\n * Kept apart from the group itself so renderers and projection can tell a\n * group about outside changes without importing the animation code.\n */\nexport interface TransformGroupHooks {\n    /**\n     * A transform value may have been set by something other than one of\n     * the group's animations.\n     */\n    check(): void\n\n    /**\n     * Hand every animation in the group back to the main thread, with\n     * up-to-date values, e.g. before layout is measured. Returns true if\n     * this wrote the element's transform.\n     */\n    demote(): true | void\n}\n\nexport const transformGroups = new WeakMap<object, TransformGroupHooks>()\n", "import {\n    BezierDefinition,\n    clamp,\n    EasingFunction,\n    easingDefinitionToFunction,\n    isBezierDefinition,\n    isEasingArray,\n    millisecondsToSeconds,\n    progress,\n} from \"motion-utils\"\nimport { frame } from \"../../../frameloop/frame\"\nimport { frameData } from \"../../../frameloop/frame-data\"\nimport { time } from \"../../../frameloop/sync-time\"\nimport {\n    isDefaultTransform,\n    transformFunction,\n} from \"../../../render/html/utils/build-transform\"\nimport type { ResolvedValues } from \"../../../render/types\"\nimport { transformPropOrder } from \"../../../render/utils/keys-transform\"\nimport { mixNumber } from \"../../../utils/mix/number\"\nimport type { MotionValue, Owner } from \"../../../value\"\nimport { frameloopDriver } from \"../../drivers/frame\"\nimport { Driver, DriverControls } from \"../../drivers/types\"\nimport { keyframes as keyframesGenerator } from \"../../generators/keyframes\"\nimport { defaultOffset } from \"../../keyframes/offsets/default\"\nimport { JSAnimation, round } from \"../../JSAnimation\"\nimport { sampleDelta } from \"../../NativeAnimationExtended\"\nimport {\n    AnyResolvedKeyframe,\n    TimelineWithFallback,\n    ValueAnimationOptions,\n} from \"../../types\"\nimport { cubicBezierAsString } from \"../easing/cubic-bezier\"\nimport { supportedWaapiEasing } from \"../easing/supported\"\nimport { supportsWaapi } from \"../supports/waapi\"\nimport { needsMixer } from \"../utils/needs-mixer\"\nimport { supportsLinearEasing } from \"../../../utils/supports/linear-easing\"\nimport { TransformGroupHooks, transformGroups } from \"./groups\"\n\n/**\n * Independent transforms (x, y, scale, rotate etc) all write to the one\n * `transform` style, so they can't each run as their own WAAPI animation.\n * Instead, every transform animation on an element joins a group. While\n * every animation in the group can be accelerated, the group composes them\n * into a single `transform` WAAPI animation. The animations stay\n * JSAnimations, but their driver doesn't tick, so they do no work per\n * frame.\n *\n * When every animation follows the same eased progress, which is the case\n * for values that share a transition, the WAAPI animation has just two\n * keyframes and that easing. Otherwise it has as few sampled keyframes\n * as keep it accurate. It's only rebuilt when an animation starts or\n * stops. Pausing, seeking and speed changes that apply to every animation\n * in the group are made to the WAAPI animation, and animations complete\n * on its finish events.\n *\n * If one of them can't be accelerated, or something else keeps writing\n * the element's transform, the whole group moves to the main thread.\n */\n\ninterface TransformOwner extends Owner {\n    current: HTMLElement\n    latestValues?: Record<string, AnyResolvedKeyframe>\n    getValue(key: string): MotionValue | undefined\n    projection?: { isProjecting(): boolean }\n}\n\ninterface TransformDriverControls extends DriverControls {\n    js: DriverControls\n}\n\ninterface TransformGroup extends TransformGroupHooks {\n    tracks: Set<TransformAnimation<any>>\n\n    /**\n     * Whether the group's animations are running on the main thread.\n     */\n    isJS: boolean\n\n    /**\n     * Whether animations are finishing because they reached their end,\n     * which the WAAPI animation has already rendered.\n     */\n    isFinishing: boolean\n\n    /**\n     * Rebuild or retime the WAAPI animation. A churn is a change it may\n     * not be able to follow, like a seek or an outside write.\n     */\n    schedule(needsBuild: boolean, isChurn?: boolean): void\n\n    /**\n     * An animation was stopped. Rebuild without it or, if it was the last,\n     * end the group.\n     */\n    release(track: TransformAnimation<any>): void\n    demote(canReturn?: boolean): true | void\n}\n\n/**\n * Where each animation was when the WAAPI animation was built: its time,\n * speed and whether it was held.\n */\ntype BuiltState = [number, number, boolean]\n\ninterface Segment {\n    animation: Animation\n    /**\n     * When this starts and ends, relative to when the group was built.\n     */\n    offset: number\n    end: number\n    isDone?: boolean\n}\n\n/**\n * Sample at the interruption sampling rate, up to a cap for long\n * animations.\n */\nconst maxSamples = 200\n\n/**\n * How far values may stray from the WAAPI animation: as a fraction of\n * each value's change when they share an easing, otherwise in px or deg,\n * or for scale.\n */\nconst easingTolerance = 0.001\nconst sampleTolerance = 0.1\nconst scaleTolerance = 0.001\n\n/**\n * If an outside write, or a seek the WAAPI animation can't follow,\n * happens again within this window, the group is being driven every\n * frame (scrubbing, drag), which is cheaper on the main thread than\n * rebuilding the WAAPI animation every frame.\n */\nconst churnWindow = 100\n\n/**\n * A WAAPI animation that starts moving later than this, as most segments\n * of a long sequence do, is built this long before it starts, rather than\n * all at once at the start.\n */\nconst buildAhead = 100\n\n/**\n * Named easings that are the same cubic-bezier in JS and CSS.\n */\nconst nativeEasings = new Set([\"linear\", \"easeIn\", \"easeOut\", \"easeInOut\"])\nconst isNativeEasing = (ease: unknown): ease is \"linear\" =>\n    nativeEasings.has(ease as string)\n\n/**\n * The last trace of each easing WAAPI can't run into linear(), with its\n * number of samples, so the elements of a sequence that share an easing\n * and duration trace it once.\n */\nconst traced = new WeakMap<EasingFunction, [number, string]>()\n\nconst trace = (ease: EasingFunction, samples: number) => {\n    let last = traced.get(ease)\n    if (last?.[0] !== samples) {\n        last = [\n            samples,\n            \"linear(\" +\n                defaultOffset(Array(samples + 1)).map(\n                    (p) => round(ease(p)) + \" \" + round(p * 100) + \"%\"\n                ) +\n                \")\",\n        ]\n        traced.set(ease, last)\n    }\n    return last[1]\n}\n\n/**\n * How many samples trace an easing between two timestamps.\n */\nconst countSamples = (from: number, to: number) =>\n    Math.min(maxSamples, Math.max(2, Math.ceil((to - from) / sampleDelta)))\n\n/**\n * Whether two eased progresses match. False if either is NaN.\n */\nconst isNear = (a: number, b: number) => Math.abs(a - b) <= easingTolerance\n\nconst byTime = (a: number, b: number) => a - b\n\n/**\n * n + 1 evenly spaced timestamps, from one timestamp to another.\n */\nconst spread = (from: number, to: number, n: number) =>\n    defaultOffset(Array(n + 1)).map((p) => mixNumber(from, to, p))\n\nconst getOwner = (options: ValueAnimationOptions<any>) =>\n    options.motionValue!.owner as TransformOwner\n\nconst getGroup = (element: Element) =>\n    transformGroups.get(element) as TransformGroup | undefined\n\n/**\n * Whether an animation has ended, so can leave its group.\n */\nconst hasEnded = ({ state }: TransformAnimation<any>) =>\n    state === \"idle\" || state === \"finished\"\n\nconst read = (owner: TransformOwner, key: string) =>\n    owner.latestValues ? owner.latestValues[key] : owner.getValue(key)?.get()\n\n/**\n * Whether this animation should join its element's transform group.\n * Animations that can't be accelerated still join, so the group knows\n * to stay on the main thread while they run. Browsers without linear()\n * easing stay on the main thread.\n */\nexport const canGroupTransform = ({\n    name,\n    motionValue,\n}: ValueAnimationOptions<any>) =>\n    name &&\n    transformPropOrder.includes(name) &&\n    motionValue?.owner?.current instanceof HTMLElement &&\n    supportsWaapi() &&\n    supportsLinearEasing()\n\nfunction canAccelerateTransform(options: ValueAnimationOptions<any>) {\n    const owner = getOwner(options)\n    const { onUpdate, transformTemplate } = owner.getProps()\n\n    return (\n        /**\n         * A handoff from an optimised appear animation is already running\n         * on its own WAAPI animation. onUpdate needs every value, every\n         * frame.\n         */\n        !options.isHandoff &&\n        !onUpdate &&\n        !options.hasOnUpdate &&\n        /**\n         * transformTemplate could output anything.\n         */\n        !transformTemplate &&\n        options.type !== \"inertia\" &&\n        /**\n         * A literal transform, or pathRotation, replaces or adds to the\n         * transform we'd build. styleEffect builds its own as \"none\".\n         */\n        (read(owner, \"transform\") || \"none\") === \"none\" &&\n        !read(owner, \"pathRotation\") &&\n        /**\n         * Layout animations write transform every frame.\n         */\n        !owner.projection?.isProjecting() &&\n        /**\n         * A mixer that blends these values makes them every frame. It's\n         * asked last, as it's user code.\n         */\n        !needsMixer(options)\n    )\n}\n\n/**\n * Starting or stopping tells the group to update its WAAPI animation.\n * The frame loop driver is only made once the group is on the main\n * thread, as accelerated animations never tick.\n */\nclass TransformDriver implements TransformDriverControls {\n    private driver?: DriverControls\n\n    constructor(\n        private element: Element,\n        private update: (timestamp: number) => void,\n        private makeDriver: Driver,\n        public animation?: TransformAnimation<any>\n    ) {}\n\n    get js() {\n        return (this.driver ||= this.makeDriver(this.update))\n    }\n\n    now() {\n        return this.driver || this.makeDriver !== frameloopDriver\n            ? this.js.now()\n            : frameData.isProcessing\n            ? frameData.timestamp\n            : time.now()\n    }\n\n    /**\n     * keepAlive is false when seeking. Seeking the WAAPI animation is\n     * free, but if a seek needs a rebuild and keeps happening, the group\n     * moves to the main thread.\n     */\n    start(keepAlive = true) {\n        const group = getGroup(this.element)\n        !group || group.isJS\n            ? this.js.start(keepAlive)\n            : group.schedule(false, !keepAlive)\n    }\n\n    stopJS() {\n        this.driver?.stop()\n    }\n\n    stop() {\n        this.stopJS()\n        const group = getGroup(this.element)\n        group && !group.isFinishing && group.release(this.animation!)\n    }\n}\n\n/**\n * JSAnimation's time setter, looked up on first use rather than at module\n * load, so the module has no top-level side effects and stays\n * tree-shakeable in flattened bundles.\n */\nlet setTime: ((this: JSAnimation<any>, time: number) => void) | undefined\n\nexport class TransformAnimation<\n    T extends number | string\n> extends JSAnimation<T> {\n    canAccelerate: boolean\n\n    constructor(options: ValueAnimationOptions<T>) {\n        const element = getOwner(options).current\n        const { driver = frameloopDriver } = options\n        let animation: TransformAnimation<T> | undefined\n\n        /**\n         * Before JSAnimation replaces the type with its generator.\n         */\n        const canAccelerate = canAccelerateTransform(options)\n\n        /**\n         * The driver ticks on the main thread only once the group has\n         * moved there, so its frame loop driver is made then.\n         */\n        options.driver = (update) =>\n            new TransformDriver(element, update, driver, animation)\n\n        super(options)\n\n        animation = this\n        /**\n         * The first driver is made in super(), before this was assigned.\n         */\n        const firstDriver = this.driver as TransformDriver | undefined\n        firstDriver && (firstDriver.animation = this)\n        this.canAccelerate = canAccelerate\n\n        /**\n         * stop is bound in JSAnimation, so wrap it rather than override.\n         * Before stopping, set the motion value to where the WAAPI\n         * animation is now, with velocity, for the next animation to\n         * start from.\n         */\n        const { stop } = this\n        this.stop = () => {\n            this.isAccelerated() && this.sync()\n            stop()\n        }\n    }\n\n    private offsetsOf?: unknown[]\n    private cachedOffsets?: number[]\n\n    /**\n     * Each keyframe's offset, made once for the keyframes rather than on\n     * every build.\n     */\n    offsets() {\n        const { keyframes, times } = this.options\n        if (times) return times\n        if (this.offsetsOf !== keyframes) {\n            this.offsetsOf = keyframes\n            this.cachedOffsets = defaultOffset(keyframes)\n        }\n        return this.cachedOffsets!\n    }\n\n    get group() {\n        return getGroup(getOwner(this.options).current)\n    }\n\n    get js() {\n        return (this.driver as TransformDriverControls | undefined)?.js\n    }\n\n    stopJS() {\n        ;(this.driver as TransformDriver | undefined)?.stopJS()\n    }\n\n    get name() {\n        return this.options.name!\n    }\n\n    /**\n     * When this stops moving, or, if it repeats forever, when it starts\n     * repeating, and how long each repeat takes. Held (paused, or at\n     * speed 0) animations never stop moving.\n     */\n    timing() {\n        const { startTime, speed, totalDuration } = this\n        const { delay = 0, repeatType } = this.options\n\n        return this.holdTime !== null\n            ? [Infinity, 0]\n            : totalDuration === Infinity\n            ? [\n                  startTime! + delay / speed,\n                  (this.resolvedDuration * (repeatType === \"loop\" ? 1 : 2)) /\n                      speed || 1,\n              ]\n            : [startTime! + (delay + totalDuration) / speed, 0]\n    }\n\n    /**\n     * Whether this is running, or paused, on the compositor.\n     */\n    isAccelerated() {\n        const { group, state } = this\n        return (\n            group?.tracks.has(this) &&\n            !group.isJS &&\n            this.canAccelerate &&\n            (state === \"running\" || state === \"paused\")\n        )\n    }\n\n    /**\n     * The value now, while this runs on the compositor and so doesn't\n     * set its motion value every frame.\n     */\n    liveValue() {\n        return this.isAccelerated() ? this.sampleAt(time.now()) : undefined\n    }\n\n    /**\n     * If this moves between two keyframes only, holding still either side\n     * of them, as each value of a sequence segment does, when it starts\n     * and stops moving, and its easing: as a string if WAAPI runs it\n     * exactly, otherwise its function, to trace.\n     */\n    tween(): [number, number, (string | EasingFunction)?] | undefined {\n        const { keyframes, type, repeat, delay = 0 } = this.options\n        let span = -1\n\n        if (repeat || type !== keyframesGenerator || this.holdTime !== null) {\n            return\n        }\n\n        for (let i = 1; i < keyframes.length; i++) {\n            if (keyframes[i] !== keyframes[i - 1]) {\n                if (span >= 0) return\n                span = i - 1\n            }\n        }\n\n        let { ease } = this.options\n        if (isEasingArray(ease)) ease = ease[span]\n\n        const offsets = this.offsets()\n        const at = (i: number) =>\n            this.startTime! +\n            (delay + offsets[i] * this.totalDuration) / this.speed\n\n        if (span >= 0) {\n            const easing = isBezierDefinition(ease!)\n                ? cubicBezierAsString(ease as BezierDefinition)\n                : isNativeEasing(ease)\n                ? supportedWaapiEasing[ease]\n                : easingDefinitionToFunction(ease!)\n\n            /**\n             * An easing that doesn't run from 0 to 1 doesn't move between\n             * the keyframes, so is traced from the values it gives instead.\n             */\n            return [\n                at(span),\n                at(span + 1),\n                typeof easing === \"string\" ||\n                (isNear(easing(0), 0) && isNear(easing(1), 1))\n                    ? easing\n                    : undefined,\n            ]\n        }\n    }\n\n    /**\n     * The timestamps between two timestamps where this reaches a\n     * keyframe or starts a repeat, where it can turn or jump.\n     */\n    boundaries(from: number, to: number) {\n        const { startTime, speed, resolvedDuration, options } = this\n        const {\n            delay = 0,\n            repeat = 0,\n            repeatDelay = 0,\n            repeatType,\n            type,\n        } = options\n        const offsets =\n            (type || keyframesGenerator) === keyframesGenerator\n                ? this.offsets()\n                : [0, 1]\n        const start = startTime! + delay / speed\n        const result: number[] = []\n\n        if (this.holdTime !== null || !(resolvedDuration > 0)) return result\n\n        for (\n            let i = Math.max(\n                0,\n                Math.floor(((from - start) * speed) / resolvedDuration)\n            );\n            i <= repeat;\n            i++\n        ) {\n            const iterationStart = start + (i * resolvedDuration) / speed\n            if (iterationStart > to) break\n\n            for (const offset of offsets) {\n                const t =\n                    iterationStart +\n                    ((i % 2 && repeatType && repeatType !== \"loop\"\n                        ? 1 - offset\n                        : offset) *\n                        (resolvedDuration - repeatDelay)) /\n                        speed\n                t > from && t < to && result.push(t)\n            }\n        }\n\n        return result\n    }\n\n    /**\n     * The value at a timestamp, as a number.\n     */\n    numberAt(timestamp: number) {\n        return parseFloat(this.sampleAt(timestamp, true) as string)\n    }\n\n    /**\n     * Write the current value, and velocity, to the motion value.\n     */\n    sync() {\n        const now = time.now()\n        const value = this.sampleAt(now, true)\n\n        /**\n         * A held value doesn't move, so there's no need to sample it\n         * twice.\n         */\n        this.options.motionValue!.setWithVelocity(\n            this.holdTime === null\n                ? this.sampleAt(now - sampleDelta, true)\n                : value,\n            value,\n            sampleDelta\n        )\n    }\n\n    play() {\n        /**\n         * A stopped animation (one that was interrupted) can't play again,\n         * so it mustn't join the group.\n         */\n        if (this.isStopped) return\n        ;(this.group || createGroup(getOwner(this.options))).tracks.add(this)\n\n        super.play()\n    }\n\n    pause() {\n        super.pause()\n\n        this.isAccelerated() && this.group!.schedule(false)\n    }\n\n    /**\n     * JSAnimation finishes on its next tick, which only happens once the\n     * group is on the main thread, so finish now. That includes an\n     * animation that can't be accelerated but reached its end before the\n     * group could move there.\n     */\n    complete() {\n        super.complete()\n        const { group } = this\n        group && !group.isJS && this.tick(time.now())\n    }\n\n    /**\n     * Without a tick to rebase it, a held time still includes the delay,\n     * so take it off here, as a JS animation does on its next tick.\n     */\n    get time() {\n        if (this.isAccelerated()) {\n            return millisecondsToSeconds(\n                clamp(\n                    0,\n                    this.totalDuration,\n                    this.at(time.now()) - (this.options.delay || 0)\n                )\n            )\n        }\n\n        return super.time\n    }\n\n    /**\n     * Calls JSAnimation's setter directly, as `super.time =` is a slow\n     * path in V8 and this runs for every animation of a seeked sequence.\n     */\n    set time(newTime: number) {\n        ;(setTime ??= Object.getOwnPropertyDescriptor(\n            JSAnimation.prototype,\n            \"time\"\n        )!.set!).call(this, newTime)\n    }\n\n    /**\n     * Scroll timelines set time every frame, so run these on the main\n     * thread.\n     */\n    attachTimeline(timeline: TimelineWithFallback) {\n        this.canAccelerate = false\n        this.group?.demote(true)\n        return super.attachTimeline(timeline)\n    }\n}\n\n/**\n * Groups that build straight after the current task build in one\n * microtask, rather than one each.\n */\nlet builds: VoidFunction[] | undefined\n\nconst buildSoon = (build: VoidFunction) => {\n    builds ||\n        queueMicrotask(() => {\n            const queue = builds!\n            builds = undefined\n            queue.forEach((build) => build())\n        })\n    ;(builds ||= []).push(build)\n}\n\nfunction createGroup(owner: TransformOwner): TransformGroup {\n    const element = owner.current\n    const tracks = new Set<TransformAnimation<any>>()\n    const byKey = new Map<string, TransformAnimation<any>>()\n\n    /**\n     * Transforms that aren't animating, as built into the WAAPI animation.\n     */\n    let statics: Record<string, AnyResolvedKeyframe | undefined> = {}\n    /**\n     * The transforms in the WAAPI animation, in order.\n     */\n    let keys: string[] = []\n    let built = new Map<TransformAnimation<any>, BuiltState>()\n    let segments: Segment[] = []\n    let needsBuild = false\n    let isScheduled = false\n    let isEnded = false\n    let hasChurned = false\n    let lastChurn = -Infinity\n    let wake: ReturnType<typeof setTimeout> | undefined\n    let wakeAt = Infinity\n    /**\n     * While waiting to build a tween that starts later, how long after\n     * the last build to build it.\n     */\n    let buildAt: number | undefined\n\n    const has = (key: string) => {\n        for (const track of tracks) if (track.name === key) return true\n    }\n\n    /**\n     * The transform values at a timestamp or, without one, from the\n     * motion values. Animations that don't repeat forever are sampled no\n     * earlier than settled, so a loop that starts from an earlier cycle\n     * boundary holds them at their end.\n     */\n    const valuesAt = (timestamp?: number, settled?: number) => {\n        const values: ResolvedValues = {}\n        for (const key of timestamp === undefined ? transformPropOrder : keys) {\n            const track = byKey.get(key)\n            const value =\n                timestamp === undefined\n                    ? read(owner, key)\n                    : track\n                    ? track.sampleAt(\n                          settled! > timestamp && !track.timing()[1]\n                              ? settled!\n                              : timestamp\n                      )\n                    : statics[key]\n\n            if (value !== undefined) values[key] = value\n        }\n        return values\n    }\n\n    /**\n     * Build a transform from values in transformPropOrder. For a keyframe,\n     * every key is written, even at its default, so each keyframe has the\n     * same list of functions and the browser interpolates them one by one.\n     * As an inline style, defaults are left out, as buildTransform does.\n     */\n    const toTransform = (values: ResolvedValues, isStyle?: boolean) => {\n        let transform = \"\"\n        for (const key in values) {\n            const value = values[key]\n            if (!isStyle || !isDefaultTransform(key, value)) {\n                transform += transformFunction(key, value) + \" \"\n            }\n        }\n        return (isStyle ? transform.trim() : transform) || \"none\"\n    }\n\n    /**\n     * Build the transform at a timestamp.\n     */\n    const compose = (timestamp: number, settled?: number) =>\n        toTransform(valuesAt(timestamp, settled))\n\n    /**\n     * Write the transform as an inline style, as the renderer would.\n     */\n    const commit = (values = valuesAt()) => {\n        element.style.transform = toTransform(values, true)\n    }\n\n    /**\n     * Cancel a WAAPI animation and remove its handlers, as WebKit never\n     * collects an animation once it has run, nor anything its handlers\n     * reference (#4034).\n     */\n    const cancel = (animation: Animation) => {\n        animation.onfinish = animation.oncancel = null\n        animation.cancel()\n    }\n\n    /**\n     * Cancel the WAAPI animations, by default first committing the\n     * transform. The renderer writes its own version on its next render.\n     */\n    const stop = (shouldCommit = true) => {\n        clearTimeout(wake)\n        wakeAt = Infinity\n        buildAt = undefined\n        shouldCommit && commit()\n        segments.forEach(({ animation }) => cancel(animation))\n        segments = []\n    }\n\n    /**\n     * A WAAPI animation that add() starts by setting its startTime. Playing\n     * it first, as element.animate() does, would leave WebKit holding that\n     * play's ready time once startTime ends the play, and it uses that for\n     * the next updatePlaybackRate(), so the animation would jump.\n     */\n    const create = (\n        keyframes: PropertyIndexedKeyframes | null,\n        options: KeyframeAnimationOptions\n    ) =>\n        new Animation(\n            new KeyframeEffect(element, keyframes, options) as AnimationEffect\n        )\n\n    const add = (animation: Animation, offset: number, end = Infinity) => {\n        const segment: Segment = { animation, offset, end }\n        animation.startTime = time.now() + offset\n\n        /**\n         * Animations finish when the WAAPI animation reaches their end.\n         * Once a loop has taken over, the finished animation isn't needed.\n         */\n        if (end < Infinity) {\n            animation.onfinish = () => {\n                segment.isDone = true\n                if (segments.some((s) => s.end === Infinity)) {\n                    cancel(animation)\n                    segments = segments.filter((s) => s !== segment)\n                }\n                group.schedule(false)\n            }\n        }\n\n        /**\n         * Something else cancelled it, so carry on on the main thread.\n         */\n        animation.oncancel = () => segments.includes(segment) && group.demote()\n\n        segments.push(segment)\n    }\n\n    /**\n     * Where a value jumps between two timestamps, as when a repeat starts\n     * again: the timestamps either side of the jump, or none if it moves\n     * there continuously.\n     */\n    const jumpAt = (value: (t: number) => number, a: number, b: number) => {\n        const change = (x: number, y: number) => Math.abs(value(y) - value(x))\n        const size = change(a, b)\n        while (b - a > 0.01) {\n            const mid = (a + b) / 2\n            change(a, mid) > change(mid, b) ? (b = mid) : (a = mid)\n        }\n        return change(a, b) > size / 2 ? [a, b] : []\n    }\n\n    /**\n     * If every moving animation follows the same eased progress between\n     * two timestamps, the easing that describes it.\n     */\n    const getEasing = (\n        moving: TransformAnimation<any>[],\n        from: number,\n        to: number,\n        bounds: number[]\n    ) => {\n        const samples = countSamples(from, to)\n\n        /**\n         * Too many keyframes or repeats to follow with this many samples.\n         */\n        if (bounds.length * 4 > samples) return\n\n        /**\n         * First check half way, where values with different easings\n         * usually differ, before sampling every value many times.\n         */\n        let quick: number | undefined\n        for (const track of moving) {\n            const first = track.numberAt(from)\n            const p =\n                (track.numberAt((from + to) / 2) - first) /\n                (track.numberAt(to) - first)\n\n            /**\n             * NaN if it doesn't move.\n             */\n            if (p !== p) continue\n            if (quick === undefined) quick = p\n            else if (!isNear(p, quick)) return\n        }\n\n        const at = spread(from, to, samples).concat(bounds).sort(byTime)\n\n        const position = (t: number) => progress(from, to, t)\n        let shared: number[] | undefined\n        let progressAt: (t: number) => number\n\n        for (const track of moving) {\n            const first = track.numberAt(from)\n            const changes = at.map((t) => track.numberAt(t) - first)\n            const end = changes[changes.length - 1]\n\n            /**\n             * A value that ends only a tiny way from where it started, as\n             * a round trip does if it's built just after it starts, or\n             * from a float residue, ends where it started. Dividing by\n             * that tiny range would stretch the easing to values the\n             * compositor can't render.\n             */\n            const range = changes.some(\n                (change) => Math.abs(change) * easingTolerance > Math.abs(end)\n            )\n                ? 0\n                : end\n\n            const progress = changes.map((change) =>\n                range ? change / range : change\n            )\n\n            /**\n             * The first value that moves sets the easing, and every other\n             * one must follow it. A value that doesn't change, like one\n             * still in its delay, fits any easing. One that changes but\n             * ends where it started fits none.\n             */\n            if (range && !shared) {\n                shared = progress\n                progressAt = (t) => (track.numberAt(t) - first) / range\n            } else if (\n                progress.some((p, i) => !isNear(p, range && shared![i]))\n            ) {\n                return\n            }\n        }\n\n        if (!shared || shared.every((p, i) => isNear(p, position(at[i])))) {\n            return \"linear\"\n        }\n\n        /**\n         * A repeat that starts again jumps back, which takes two points at\n         * the same position.\n         */\n        const points: string[] = []\n        const point = (t: number, p = progressAt(t)) =>\n            points.push(round(p) + \" \" + round(position(t) * 100) + \"%\")\n        shared.forEach((p, i) => {\n            i &&\n                Math.abs(p - shared![i - 1]) > 0.2 &&\n                jumpAt(progressAt, at[i - 1], at[i]).forEach((t) => point(t))\n            point(at[i], p)\n        })\n\n        return \"linear(\" + points + \")\"\n    }\n\n    /**\n     * Sample timestamps between two timestamps, closer together where the\n     * moving animations curve.\n     */\n    const sample = (\n        moving: TransformAnimation<any>[],\n        from: number,\n        to: number,\n        bounds: number[]\n    ) => {\n        const times = [from]\n\n        /**\n         * A linear tween is straight between its keyframes, so only the\n         * other values can curve, and a tween only while it moves.\n         */\n        const curved: TransformAnimation<any>[] = []\n        let curveFrom = to\n        let curveTo = from\n        for (const track of moving) {\n            const tween = track.tween()\n            if (tween?.[2] !== \"linear\") {\n                const [trackEnd, cycle] = track.timing()\n                const [a, b] = tween || [from, cycle ? to : trackEnd]\n                curveFrom = Math.min(curveFrom, a)\n                curveTo = Math.max(curveTo, b)\n                curved.push(track)\n            }\n        }\n        curveFrom = Math.max(from, curveFrom)\n        curveTo = Math.min(to, curveTo)\n\n        /**\n         * Values that aren't numbers, like calc(), are left to the\n         * browser to interpolate.\n         */\n        const isStraight = (a: number, b: number) =>\n            curved.every(\n                (track) =>\n                    !(\n                        Math.abs(\n                            track.numberAt((a + b) / 2) -\n                                (track.numberAt(a) + track.numberAt(b)) / 2\n                        ) >\n                        (track.name.startsWith(\"scale\")\n                            ? scaleTolerance\n                            : sampleTolerance)\n                    )\n            )\n\n        const split = (a: number, b: number, depth: number) => {\n            if (b - a < 1 || isStraight(a, b)) {\n                times.push(b)\n            } else if (depth < 4) {\n                split(a, (a + b) / 2, depth + 1)\n                split((a + b) / 2, b, depth + 1)\n            } else {\n                /**\n                 * Keyframes either side of a jump, like a repeat starting\n                 * again, so it doesn't play as a quick sweep.\n                 */\n                for (const track of moving) {\n                    times.push(...jumpAt((t) => track.numberAt(t), a, b))\n                }\n                times.push(b)\n            }\n        }\n\n        /**\n         * Split at least every 100ms where a value can curve, and at every\n         * keyframe and repeat, either side of where a value can jump.\n         */\n        const ends =\n            curveTo > curveFrom\n                ? spread(\n                      curveFrom,\n                      curveTo,\n                      Math.ceil((curveTo - curveFrom) / 100)\n                  )\n                : []\n        ends.push(to)\n        for (const t of bounds) ends.push(t, Math.min(t + 0.01, to))\n\n        let start = from\n        for (const end of ends.sort(byTime)) {\n            end > start && split(start, end, 0)\n            start = end\n        }\n\n        return times.sort(byTime)\n    }\n\n    /**\n     * If every moving animation is the same tween, started together, as\n     * happens for the values of one animate() call or transition, when\n     * they move and their native easing.\n     */\n    const getTween = (moving: TransformAnimation<any>[]) => {\n        let shared: [number, number, (string | EasingFunction)?] | undefined\n\n        for (const track of moving) {\n            const tween = track.tween()\n            if (\n                !tween ||\n                (shared &&\n                    (Math.abs(tween[0] - shared[0]) > 1 ||\n                        Math.abs(tween[1] - shared[1]) > 1))\n            ) {\n                return\n            }\n            /**\n             * Easings that differ, like the springs a sequence makes for\n             * each value, can still be the same curve.\n             */\n            shared = [\n                tween[0],\n                tween[1],\n                !shared || tween[2] === shared[2] ? tween[2] : undefined,\n            ]\n        }\n\n        return shared\n    }\n\n    /**\n     * A WAAPI animation of the composed transform between two timestamps.\n     */\n    const run = (\n        moving: TransformAnimation<any>[],\n        from: number,\n        to: number,\n        nativeEasing?: string,\n        options: KeyframeAnimationOptions = { fill: \"both\" },\n        settled?: number\n    ) => {\n        /**\n         * With an easing given, there's nothing to sample, so no need\n         * for the boundaries.\n         */\n        const bounds = nativeEasing\n            ? []\n            : moving.flatMap((track) => track.boundaries(from, to))\n        const easing = nativeEasing || getEasing(moving, from, to, bounds)\n        const times = easing ? [from, to] : sample(moving, from, to, bounds)\n        const transform = times.map((t) => compose(t, settled))\n        let keyframes: PropertyIndexedKeyframes | null = { transform }\n        if (!easing) {\n            keyframes.offset = times.map((t) => progress(from, to, t))\n        }\n\n        /**\n         * If nothing moves, don't hold a transform, which, even at its\n         * default, would make the element a containing block. The empty\n         * animation still finishes the animations.\n         */\n        if (transform.every((t) => t === transform[0])) {\n            commit(valuesAt(from, settled))\n            keyframes = null\n        }\n\n        return create(keyframes, {\n            ...options,\n            duration: to - from,\n            easing: easing || \"linear\",\n        })\n    }\n\n    /**\n     * Check whether it's time to build in this long. A check that's due\n     * sooner is kept, and checks again if it's early, so pausing and\n     * playing don't each replace a timer. One due later, after a seek or\n     * speed change while held, is replaced.\n     */\n    const wakeIn = (delay: number) => {\n        const at = time.now() + delay\n        if (at < wakeAt) {\n            clearTimeout(wake)\n            wakeAt = at\n            wake = setTimeout(() => {\n                wakeAt = Infinity\n                group.schedule(false)\n            }, delay)\n        }\n    }\n\n    /**\n     * Replace the WAAPI animations with ones built from now. Returns\n     * undefined if the animations can't be composed.\n     */\n    const animate = (now: number) => {\n        /**\n         * The finite part runs until the last finite animation (or the\n         * last delay) ends. Infinitely repeating animations then continue\n         * as one looping WAAPI animation, which needs them to share a\n         * cycle.\n         */\n        let end = now\n        let cycle = 0\n        let cycleStart = 0\n        const moving: TransformAnimation<any>[] = []\n        const looping: TransformAnimation<any>[] = []\n        const ends = new Set<number>()\n\n        byKey.clear()\n        built = new Map()\n\n        for (const track of tracks) {\n            byKey.set(track.name, track)\n\n            const [trackEnd, trackCycle] = track.timing()\n            const isHeld = trackEnd === Infinity\n\n            built.set(track, [track.at(now), track.speed, isHeld])\n\n            if (isHeld) continue\n\n            if (track.speed < 0) return\n\n            if (trackCycle) {\n                if (cycle) {\n                    const phase = (trackEnd - cycleStart) / trackCycle\n                    if (\n                        Math.abs(trackCycle - cycle) > 1 ||\n                        Math.abs(phase - Math.round(phase)) * cycle > 1\n                    ) {\n                        return\n                    }\n                } else {\n                    cycle = trackCycle\n                    cycleStart = trackEnd\n                }\n                looping.push(track)\n            } else {\n                ends.add(trackEnd)\n            }\n\n            moving.push(track)\n            end = Math.max(end, trackEnd)\n        }\n\n        statics = {}\n        /**\n         * Transforms that aren't animating are left out at their default.\n         */\n        keys = transformPropOrder.filter((key) => {\n            if (byKey.has(key)) return true\n            const value = (statics[key] = read(owner, key))\n            return value !== undefined && !isDefaultTransform(key, value)\n        })\n\n        stop(false)\n\n        /**\n         * Values that share one tween are one WAAPI animation of it, with\n         * two keyframes and its own easing, from when they started.\n         */\n        const tween = !cycle && getTween(moving)\n\n        try {\n            if (end > now) {\n                let easing: string | undefined\n\n                if (tween && tween[1] > now) {\n                    const [from, to, ease] = tween\n\n                    /**\n                     * Until it's built, the motion values hold where it\n                     * starts, for the renderer to write.\n                     */\n                    if (from - now > buildAhead) {\n                        moving.forEach((track) => track.sync())\n                        wakeIn((buildAt = from - now - buildAhead))\n                        return true\n                    }\n\n                    easing =\n                        typeof ease === \"string\"\n                            ? ease\n                            : ease\n                            ? trace(ease, countSamples(from, to))\n                            : getEasing(moving, from, to, [])\n\n                    /**\n                     * It holds its last keyframe until the animations end.\n                     */\n                    easing &&\n                        add(\n                            run(moving, from, to, easing, {\n                                fill: \"both\",\n                                endDelay: end - to,\n                            }),\n                            from - now,\n                            end - from\n                        )\n                }\n\n                easing || add(run(moving, now, end), 0, end - now)\n\n                /**\n                 * Animations that end sooner finish on the events of\n                 * empty animations that end with them.\n                 */\n                ends.forEach(\n                    (trackEnd) =>\n                        trackEnd < end - 1 &&\n                        add(\n                            create(null, { duration: trackEnd - now }),\n                            0,\n                            trackEnd - now\n                        )\n                )\n            }\n\n            if (cycle) {\n                /**\n                 * Build one cycle from a cycle boundary, so it repeats\n                 * seamlessly, and start it part way through.\n                 */\n                const from =\n                    cycleStart + Math.floor((end - cycleStart) / cycle) * cycle\n\n                add(\n                    run(\n                        looping,\n                        from,\n                        from + cycle,\n                        undefined,\n                        {\n                            iterations: Infinity,\n                            iterationStart: (end - from) / cycle,\n                            /**\n                             * It must not fill backwards over the finite part\n                             * that runs before it.\n                             */\n                            fill: \"forwards\",\n                        },\n                        end\n                    ),\n                    end - now\n                )\n            }\n        } catch {\n            return\n        }\n\n        /**\n         * Everything is held, so hold it with an inline style instead.\n         */\n        segments.length || stop()\n\n        return true\n    }\n\n    /**\n     * If every animation has been paused, played, seeked or sped up\n     * together since the WAAPI animation was built, do the same to it.\n     * Returns false if it needs rebuilding instead. Seeking to before a\n     * tween starts rebuilds, so a running group seeked every frame still\n     * moves to the main thread.\n     */\n    const retime = (now: number, isSeek: boolean) => {\n        let elapsed: number | undefined\n        let rate = 0\n\n        for (const track of tracks) {\n            const state = built.get(track)\n            if (!state) return false\n\n            const [builtTime, builtSpeed, wasHeld] = state\n            const trackTime = track.at(now)\n            const isHeld = track.timing()[0] === Infinity\n\n            /**\n             * With nothing on the compositor, a held animation is set\n             * where it's held, so it can be seeked as often as needed.\n             */\n            if (wasHeld) {\n                if (isHeld && (trackTime === builtTime || !segments.length)) {\n                    continue\n                }\n                return false\n            }\n\n            const trackElapsed = (trackTime - builtTime) / builtSpeed\n            const trackRate = isHeld ? 0 : track.speed / builtSpeed\n\n            if (elapsed === undefined) {\n                elapsed = trackElapsed\n                rate = trackRate\n            } else if (\n                Math.abs(trackElapsed - elapsed) > 1 ||\n                trackRate !== rate\n            ) {\n                return false\n            }\n        }\n\n        if (elapsed === undefined) return true\n\n        /**\n         * Waiting to build a tween that starts later. Until then the\n         * values hold where they start, so only when to build changes.\n         * Held, it has nothing on the compositor, so it can be seeked.\n         */\n        if (!segments.length) {\n            if (buildAt === undefined || (isSeek && rate)) return false\n\n            if (rate) {\n                const delay = (buildAt - elapsed) / rate\n                if (delay < 1) return false\n                wakeIn(delay)\n            }\n            return true\n        }\n\n        /**\n         * Only a tween is built to start later, and it holds its first\n         * keyframe until then, so it can be paused and played before it\n         * starts.\n         */\n        for (const { offset, end, isDone } of segments) {\n            const local = elapsed - offset\n            if (\n                end < Infinity &&\n                (isDone\n                    ? local < end - 1\n                    : (local < 0 && (isSeek || offset <= 0)) || local >= end)\n            ) {\n                return false\n            }\n        }\n\n        for (const { animation, offset, isDone } of segments) {\n            if (isDone) continue\n\n            const local = elapsed - offset\n            if (\n                rate &&\n                animation.updatePlaybackRate &&\n                animation.playState === \"running\" &&\n                Math.abs(Number(animation.currentTime) - local) < 20\n            ) {\n                /**\n                 * Only the speed changed. Setting playbackRate and\n                 * startTime restarts a running compositor animation, which\n                 * can render the underlying value for a frame.\n                 */\n                animation.playbackRate !== rate &&\n                    animation.updatePlaybackRate(rate)\n            } else if (rate) {\n                animation.playbackRate !== rate &&\n                    (animation.playbackRate = rate)\n                animation.startTime = now - local / rate\n            } else {\n                /**\n                 * Hold it without pause(), whose pending pause setting\n                 * currentTime would end at once, leaving WebKit holding its\n                 * ready time (see create()).\n                 */\n                animation.startTime = null\n                animation.currentTime = local\n            }\n        }\n\n        return true\n    }\n\n    /**\n     * If no animations are left, write where they got to and cancel the\n     * WAAPI animations. Returns whether the group ended.\n     */\n    const end = () => {\n        if (tracks.size) return false\n\n        isEnded = true\n        /**\n         * The element may have a newer group if this one was detached\n         * (see handOffElementState).\n         */\n        getGroup(element) === group && transformGroups.delete(element)\n        group.isJS || stop()\n        return true\n    }\n\n    const build = () => {\n        const now = time.now()\n\n        /**\n         * Finish the animations that have reached their end, which the\n         * WAAPI animation has already rendered.\n         */\n        if (!group.isJS) {\n            group.isFinishing = true\n            tracks.forEach((track) => {\n                const [trackEnd, trackCycle] = track.timing()\n\n                if (\n                    track.state === \"running\" &&\n                    track.speed > 0 &&\n                    !trackCycle &&\n                    trackEnd <= now + 1\n                ) {\n                    track.complete()\n\n                    /**\n                     * From now it's checked for outside writes like any\n                     * other static transform. If the WAAPI animation never\n                     * rendered it (it was instant), rebuild with its value.\n                     */\n                    statics[track.name] = read(owner, track.name)\n                    built.has(track) || (needsBuild = true)\n                }\n            })\n            group.isFinishing = false\n        }\n\n        isScheduled = false\n\n        if (isEnded) return\n\n        tracks.forEach((track) => hasEnded(track) && tracks.delete(track))\n\n        if (end()) return\n\n        for (const track of tracks) {\n            if (!track.canAccelerate) return group.demote(true)\n        }\n\n        /**\n         * Everything that kept the group on the main thread has finished,\n         * so move the remaining animations back to the compositor.\n         */\n        if (group.isJS) {\n            group.isJS = false\n            needsBuild = true\n            tracks.forEach((track) => track.stopJS())\n        }\n\n        const shouldBuild = needsBuild\n        const churned = hasChurned\n        needsBuild = hasChurned = false\n\n        if (shouldBuild || !retime(now, churned)) {\n            if (churned) {\n                if (now - lastChurn < churnWindow) return group.demote()\n                lastChurn = now\n            }\n            if (!animate(now)) return group.demote()\n        } else if (buildAt !== undefined && !churned) {\n            /**\n             * Still waiting to build, so the values still hold where\n             * they start.\n             */\n            return\n        }\n\n        /**\n         * Held animations don't move, so set their motion values to where\n         * they're held, as a JSAnimation would on its next tick. Pausing\n         * and seeking schedule this, so it's once however many there are.\n         */\n        tracks.forEach(\n            (track) => track.timing()[0] === Infinity && track.sync()\n        )\n    }\n\n    const group: TransformGroup = {\n        tracks,\n        isJS: false,\n        isFinishing: false,\n\n        schedule(build_: boolean, isChurn?: boolean) {\n            if (isEnded) return\n\n            needsBuild ||= build_\n            hasChurned ||= !!isChurn\n\n            /**\n             * Build in this frame's render step, so it's in place before\n             * anything reads the DOM in postRender, or straight after the\n             * current task outside of a frame.\n             */\n            if (!isScheduled) {\n                isScheduled = true\n                frameData.isProcessing\n                    ? frame.render(build, false, true)\n                    : buildSoon(build)\n            }\n        },\n\n        /**\n         * End the group now, rather than when it next builds, so the\n         * element's transform is the caller's again as soon as its last\n         * animation is stopped.\n         */\n        release(track) {\n            /**\n             * Only drop the stopped animation. Others can be idle because\n             * they're part way through play(), and are about to run.\n             */\n            hasEnded(track) && tracks.delete(track)\n            end() || group.schedule(true)\n        },\n\n        /**\n         * An outside write. Rebuild once, but if it keeps happening, move\n         * to the main thread.\n         */\n        check() {\n            if (group.isJS) return\n\n            for (const key in statics) {\n                if (read(owner, key) !== statics[key] && !has(key)) {\n                    return group.schedule(true, true)\n                }\n            }\n        },\n\n        demote(canReturn?: boolean) {\n            if (group.isJS || isEnded) return\n\n            /**\n             * Unless only another animation is holding the group on the\n             * main thread, these animations stay there until they end.\n             */\n            tracks.forEach((track) => {\n                track.isAccelerated() && track.sync()\n                canReturn || (track.canAccelerate = false)\n            })\n\n            group.isJS = true\n            built = new Map()\n\n            stop()\n\n            tracks.forEach(\n                (track) => track.state === \"running\" && track.js?.start()\n            )\n\n            return true\n        },\n    }\n\n    transformGroups.set(element, group)\n\n    return group\n}\n", "import { MotionGlobalConfig } from \"motion-utils\"\nimport { time } from \"../frameloop/sync-time\"\nimport { JSAnimation } from \"./JSAnimation\"\nimport { getFinalKeyframe } from \"./keyframes/get-final\"\nimport {\n    KeyframeResolver as DefaultKeyframeResolver,\n    flushKeyframeResolvers,\n    ResolvedKeyframes,\n} from \"./keyframes/KeyframesResolver\"\nimport { NativeAnimationExtended } from \"./NativeAnimationExtended\"\nimport {\n    AnimationPlaybackControls,\n    AnyResolvedKeyframe,\n    TimelineWithFallback,\n    ValueAnimationOptions,\n} from \"./types\"\nimport { canAnimate } from \"./utils/can-animate\"\nimport { makeAnimationInstant } from \"./utils/make-animation-instant\"\nimport { resolveStartTime } from \"./utils/resolve-start-time\"\nimport { WithPromise } from \"./utils/WithPromise\"\nimport { supportsBrowserAnimation } from \"./waapi/supports/waapi\"\nimport {\n    canGroupTransform,\n    TransformAnimation,\n} from \"./waapi/transforms/TransformAnimation\"\n\ntype ResolvedOptions<T extends AnyResolvedKeyframe> =\n    ValueAnimationOptions<T> & {\n        startTime?: number\n        finalKeyframe?: T\n    }\n\nexport class AsyncMotionValueAnimation<T extends AnyResolvedKeyframe>\n    extends WithPromise\n    implements AnimationPlaybackControls\n{\n    private createdAt: number\n\n    private resolvedAt: number | undefined\n\n    private _animation: AnimationPlaybackControls | undefined\n\n    private pendingTimeline: TimelineWithFallback | undefined\n\n    private keyframeResolver: DefaultKeyframeResolver | undefined\n\n    private stopTimeline: VoidFunction | undefined\n\n    constructor(options: ValueAnimationOptions<T>) {\n        super()\n\n        this.createdAt = time.now()\n\n        const { keyframes, name, motionValue, element } = options\n\n        /**\n         * animateMotionValue builds a fresh options object per value, so\n         * it's completed in place as keyframes resolve rather than copied.\n         */\n        const optionsWithDefaults = options as ResolvedOptions<T>\n        optionsWithDefaults.autoplay ??= true\n        optionsWithDefaults.delay ??= 0\n        optionsWithDefaults.type ??= \"keyframes\"\n        optionsWithDefaults.repeat ??= 0\n        optionsWithDefaults.repeatDelay ??= 0\n        optionsWithDefaults.repeatType ??= \"loop\"\n\n        const KeyframeResolver =\n            element?.KeyframeResolver || DefaultKeyframeResolver\n\n        this.keyframeResolver = new KeyframeResolver(\n            keyframes,\n            (\n                resolvedKeyframes: ResolvedKeyframes<T>,\n                finalKeyframe: T,\n                forced: boolean\n            ) =>\n                this.onKeyframesResolved(\n                    resolvedKeyframes,\n                    finalKeyframe,\n                    optionsWithDefaults,\n                    !forced\n                ),\n            name,\n            motionValue,\n            element\n        )\n        this.keyframeResolver?.scheduleResolve()\n    }\n\n    onKeyframesResolved(\n        keyframes: ResolvedKeyframes<T>,\n        finalKeyframe: T,\n        options: ResolvedOptions<T>,\n        sync: boolean\n    ) {\n        this.keyframeResolver = undefined\n\n        const { name, type, velocity, delay, isHandoff, onUpdate } = options\n        this.resolvedAt = time.now()\n\n        /**\n         * If we can't animate this value with the resolved keyframes\n         * then we should complete it immediately.\n         */\n        const canAnimateValue = canAnimate(keyframes, name, type, velocity)\n        if (!canAnimateValue) {\n            if (MotionGlobalConfig.instantAnimations || !delay) {\n                onUpdate?.(getFinalKeyframe(keyframes, options, finalKeyframe))\n            }\n\n            keyframes[0] = keyframes[keyframes.length - 1]\n\n            makeAnimationInstant(options)\n            options.repeat = 0\n        }\n\n        const { onComplete } = options\n        options.finalKeyframe = finalKeyframe\n        options.keyframes = keyframes\n        /**\n         * JSAnimation and NativeAnimation call onComplete exactly when\n         * their own `finished` resolves, so this replaces a promise chain\n         * per value with a callback.\n         */\n        options.onComplete = () => {\n            onComplete?.()\n            this.notifyFinished()\n        }\n\n        /**\n         * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via\n         * WAAPI. Therefore, this animation must be JS to ensure it runs \"under\" the\n         * optimised animation.\n         *\n         * Also skip WAAPI when keyframes aren't animatable, as the resolved\n         * values may not be valid CSS and would trigger browser warnings.\n         */\n        const useWaapi =\n            canAnimateValue && !isHandoff && supportsBrowserAnimation(options)\n\n        /**\n         * Independent transforms (x, scale etc) on an HTML element are\n         * composed into one WAAPI transform animation per element.\n         */\n        const isGroupedTransform = !useWaapi && canGroupTransform(options)\n\n        /**\n         * Resolve startTime for the animation. A startTime passed in options\n         * (an optimised appear handoff syncing to its WAAPI animation) takes\n         * precedence.\n         *\n         * *Ideally*, we would use the createdAt time as t=0 as the following\n         * frame would then be the first frame of the animation in progress,\n         * which would feel snappier. If keyframes resolved on a later frame,\n         * and long after creation, we start from then instead.\n         *\n         * If they resolved immediately, a JSAnimation picks its own start\n         * time and resolves it the same way on its first frame, so every\n         * animation started in that moment stays in sync. WAAPI has no frame\n         * of ours to do that on.\n         */\n        if (\n            sync &&\n            (useWaapi ||\n                isGroupedTransform ||\n                this.resolvedAt !== this.createdAt)\n        ) {\n            options.startTime ??= resolveStartTime(\n                this.createdAt,\n                this.resolvedAt!\n            )\n        }\n\n        let animation: AnimationPlaybackControls\n        if (useWaapi) {\n            /**\n             * The resolver needed the VisualElement, WAAPI needs the DOM\n             * element. JSAnimation reads neither, so this is safe to\n             * leave in place if we fall back to it.\n             */\n            options.element = options.motionValue?.owner?.current\n            try {\n                animation = new NativeAnimationExtended(options as any)\n            } catch {\n                animation = new JSAnimation(options)\n            }\n        } else if (isGroupedTransform) {\n            animation = new TransformAnimation(options)\n        } else {\n            animation = new JSAnimation(options)\n        }\n\n        if (this.pendingTimeline) {\n            this.stopTimeline = animation.attachTimeline(this.pendingTimeline)\n            this.pendingTimeline = undefined\n        }\n\n        this._animation = animation\n    }\n\n    get finished() {\n        return this._animation ? this._animation.finished : super.finished\n    }\n\n    then(onResolve: VoidFunction, _onReject?: VoidFunction) {\n        return this.finished.finally(onResolve).then(() => {})\n    }\n\n    /**\n     * The value now, if the animation runs on the compositor.\n     */\n    liveValue() {\n        return (\n            this._animation as { liveValue?: () => T | undefined } | undefined\n        )?.liveValue?.()\n    }\n\n    get animation(): AnimationPlaybackControls {\n        if (!this._animation) {\n            this.keyframeResolver?.resume()\n            flushKeyframeResolvers()\n        }\n\n        return this._animation!\n    }\n\n    get duration() {\n        return this.animation.duration\n    }\n\n    get iterationDuration() {\n        return this.animation.iterationDuration\n    }\n\n    get time() {\n        return this.animation.time\n    }\n\n    set time(newTime: number) {\n        this.animation.time = newTime\n    }\n\n    get speed() {\n        return this.animation.speed\n    }\n\n    get state() {\n        return this.animation.state\n    }\n\n    set speed(newSpeed: number) {\n        this.animation.speed = newSpeed\n    }\n\n    get startTime() {\n        return this.animation.startTime\n    }\n\n    attachTimeline(timeline: TimelineWithFallback) {\n        if (this._animation) {\n            this.stopTimeline = this.animation.attachTimeline(timeline)\n        } else {\n            this.pendingTimeline = timeline\n        }\n\n        return () => this.stop()\n    }\n\n    play() {\n        this.animation.play()\n    }\n\n    pause() {\n        this.animation.pause()\n    }\n\n    complete() {\n        this.animation.complete()\n    }\n\n    cancel() {\n        this._animation?.cancel()\n        this.keyframeResolver?.cancel()\n    }\n\n    /**\n     * Bound to support return animation.stop pattern\n     */\n    stop = () => {\n        if (this._animation) {\n            this._animation.stop()\n            this.stopTimeline?.()\n        }\n\n        this.keyframeResolver?.cancel()\n    }\n}\n", "import { AnimationPlaybackControls, TimelineWithFallback } from \"./types\"\n\ntype PropNames =\n    | \"time\"\n    | \"speed\"\n    | \"duration\"\n    | \"attachTimeline\"\n    | \"startTime\"\n    | \"state\"\n\nexport type AcceptedAnimations = AnimationPlaybackControls\n\nexport type GroupedAnimations = AcceptedAnimations[]\n\nexport class GroupAnimation implements AnimationPlaybackControls {\n    animations: GroupedAnimations\n\n    constructor(animations: Array<AcceptedAnimations | undefined>) {\n        this.animations = animations.filter(Boolean) as GroupedAnimations\n    }\n\n    get finished() {\n        return Promise.all(\n            this.animations.map((animation) => animation.finished)\n        )\n    }\n\n    /**\n     * TODO: Filter out cancelled or stopped animations before returning\n     */\n    private getAll(propName: PropNames) {\n        return this.animations[0][propName] as any\n    }\n\n    attachTimeline(timeline: TimelineWithFallback) {\n        const subscriptions = this.animations.map((animation) =>\n            animation.attachTimeline(timeline)\n        )\n\n        return () => {\n            subscriptions.forEach((cancel, i) => {\n                cancel && cancel()\n                this.animations[i].stop()\n            })\n        }\n    }\n\n    get time() {\n        return this.getAll(\"time\")\n    }\n\n    /**\n     * Setters and methods name the property directly, rather than through\n     * a shared helper, so each call site stays monomorphic. Sequences\n     * call these on every animation, many times a second.\n     */\n    set time(time: number) {\n        for (const animation of this.animations) animation.time = time\n    }\n\n    get speed() {\n        return this.getAll(\"speed\")\n    }\n\n    set speed(speed: number) {\n        for (const animation of this.animations) animation.speed = speed\n    }\n\n    get state() {\n        return this.getAll(\"state\")\n    }\n\n    get startTime() {\n        return this.getAll(\"startTime\")\n    }\n\n    get duration() {\n        return getMax(this.animations, \"duration\")\n    }\n\n    get iterationDuration() {\n        return getMax(this.animations, \"iterationDuration\")\n    }\n\n    play() {\n        for (const animation of this.animations) animation.play()\n    }\n\n    pause() {\n        for (const animation of this.animations) animation.pause()\n    }\n\n    // Bound to accommodate common `return animation.stop` pattern\n    stop = () => {\n        for (const animation of this.animations) animation.stop()\n    }\n\n    cancel() {\n        for (const animation of this.animations) animation.cancel()\n    }\n\n    complete() {\n        for (const animation of this.animations) animation.complete()\n    }\n}\n\nfunction getMax(\n    animations: GroupedAnimations,\n    propName: \"iterationDuration\" | \"duration\"\n): number {\n    let max = 0\n\n    for (let i = 0; i < animations.length; i++) {\n        const value = animations[i][propName]\n        if (value !== null && value > max) {\n            max = value\n        }\n    }\n    return max\n}\n", "import { GroupAnimation } from \"./GroupAnimation\"\nimport { AnimationPlaybackControlsWithThen } from \"./types\"\n\nexport class GroupAnimationWithThen\n    extends GroupAnimation\n    implements AnimationPlaybackControlsWithThen\n{\n    then(onResolve: VoidFunction, _onReject?: VoidFunction) {\n        return this.finished.finally(onResolve).then(() => {})\n    }\n}\n", "import {\n    EasingFunction,\n    SubscriptionManager,\n    velocityPerSecond,\n    warnOnce,\n} from \"motion-utils\"\nimport {\n    AnimationPlaybackControlsWithThen,\n    AnyResolvedKeyframe,\n    MotionValueAnimation,\n    TransformProperties,\n} from \"../animation/types\"\nimport { frame } from \"../frameloop\"\nimport { time } from \"../frameloop/sync-time\"\n\n/**\n * @public\n */\nexport type Subscriber<T> = (v: T) => void\n\n/**\n * @public\n */\nexport type PassiveEffect<T> = (v: T, safeSetter: (v: T) => void) => void\n\nexport type StartAnimation = (\n    complete: () => void\n) => AnimationPlaybackControlsWithThen | undefined\n\nexport interface MotionValueEventCallbacks<V> {\n    animationStart: () => void\n    animationComplete: () => void\n    animationCancel: () => void\n    change: (latestValue: V) => void\n    destroy: () => void\n}\n\n/**\n * Maximum time between the value of two frames, beyond which we\n * assume the velocity has since been 0.\n */\nconst MAX_VELOCITY_DELTA = 30\n\nconst isFloat = (value: any): value is string => {\n    return !isNaN(parseFloat(value))\n}\n\ninterface ResolvedValues {\n    [key: string]: AnyResolvedKeyframe\n}\n\nexport interface Owner {\n    current: HTMLElement | unknown\n    getProps: () => {\n        onUpdate?: (latest: ResolvedValues) => void\n        transformTemplate?: (\n            transform: TransformProperties,\n            generatedTransform: string\n        ) => string\n    }\n}\n\nexport interface AccelerateConfig {\n    factory: (animation: AnimationPlaybackControlsWithThen) => VoidFunction\n    times: number[]\n    keyframes: any[]\n    ease?: EasingFunction | EasingFunction[]\n    duration: number\n    isTransformed?: boolean\n}\n\nexport interface MotionValueOptions {\n    owner?: Owner\n}\n\nexport const collectMotionValues: { current: MotionValue[] | undefined } = {\n    current: undefined,\n}\n\n/**\n * `MotionValue` is used to track the state and velocity of motion values.\n *\n * @public\n */\nexport class MotionValue<V = any> {\n    /**\n     * If a MotionValue has an owner, it was created internally within Motion\n     * and therefore has no external listeners. It is therefore safe to animate via WAAPI.\n     */\n    owner?: Owner\n\n    /**\n     * The current state of the `MotionValue`.\n     */\n    private current: V | undefined\n\n    /**\n     * The previous state of the `MotionValue`.\n     */\n    private prev: V | undefined\n\n    /**\n     * The previous state of the `MotionValue` at the end of the previous frame.\n     */\n    private prevFrameValue: V | undefined\n\n    /**\n     * The last time the `MotionValue` was updated.\n     */\n    updatedAt: number\n\n    /**\n     * The time `prevFrameValue` was updated.\n     */\n    prevUpdatedAt: number | undefined\n\n    /**\n     * Add a passive effect to this `MotionValue`.\n     *\n     * A passive effect intercepts calls to `set`. For instance, `useSpring` adds\n     * a passive effect that attaches a `spring` to the latest\n     * set value. Hypothetically there could be a `useSmooth` that attaches an input smoothing effect.\n     *\n     * @internal\n     */\n    private passiveEffect?: PassiveEffect<V>\n    private stopPassiveEffect?: VoidFunction\n\n    /**\n     * Whether the passive effect is active.\n     */\n    isEffectActive?: boolean\n\n    /**\n     * A reference to the currently-controlling animation.\n     */\n    animation?: MotionValueAnimation\n\n    /**\n     * The sole `change` subscriber. Most values have exactly one (an\n     * effect or a follower), so it's stored and notified directly. A\n     * SubscriptionManager is only created for a second subscriber.\n     */\n    private changeSubscriber?: Subscriber<V>\n\n    /**\n     * Tracks whether this value can output a velocity. Currently this is only true\n     * if the value is numerical, but we might be able to widen the scope here and support\n     * other value types.\n     *\n     * @internal\n     */\n    private canTrackVelocity: boolean | null = null\n\n    /**\n     * A list of MotionValues whose values are computed from this one.\n     * This is a rough start to a proper signal-like dirtying system.\n     */\n    private dependents: Set<MotionValue> | undefined\n\n    /**\n     * Tracks whether this value should be removed\n     */\n    liveStyle?: boolean\n\n    /**\n     * Scroll timeline acceleration metadata. When set, VisualElement\n     * can create a native WAAPI animation attached to a scroll timeline\n     * instead of driving updates through JS.\n     */\n    accelerate?: AccelerateConfig\n\n    /**\n     * @param init - The initiating value\n     * @param config - Optional configuration options\n     *\n     * -  `transformer`: A function to transform incoming values with.\n     */\n    constructor(init: V, options: MotionValueOptions = {}) {\n        this.setCurrent(init)\n        this.owner = options.owner\n    }\n\n    setCurrent(current: V) {\n        this.current = current\n        this.updatedAt = time.now()\n\n        if (this.canTrackVelocity === null && current !== undefined) {\n            this.canTrackVelocity = isFloat(this.current)\n        }\n    }\n\n    setPrevFrameValue(prevFrameValue: V | undefined = this.current) {\n        this.prevFrameValue = prevFrameValue\n        this.prevUpdatedAt = this.updatedAt\n    }\n\n    /**\n     * Adds a function that will be notified when the `MotionValue` is updated.\n     *\n     * It returns a function that, when called, will cancel the subscription.\n     *\n     * When calling `onChange` inside a React component, it should be wrapped with the\n     * `useEffect` hook. As it returns an unsubscribe function, this should be returned\n     * from the `useEffect` function to ensure you don't add duplicate subscribers..\n     *\n     * ```jsx\n     * export const MyComponent = () => {\n     *   const x = useMotionValue(0)\n     *   const y = useMotionValue(0)\n     *   const opacity = useMotionValue(1)\n     *\n     *   useEffect(() => {\n     *     function updateOpacity() {\n     *       const maxXY = Math.max(x.get(), y.get())\n     *       const newOpacity = transform(maxXY, [0, 100], [1, 0])\n     *       opacity.set(newOpacity)\n     *     }\n     *\n     *     const unsubscribeX = x.on(\"change\", updateOpacity)\n     *     const unsubscribeY = y.on(\"change\", updateOpacity)\n     *\n     *     return () => {\n     *       unsubscribeX()\n     *       unsubscribeY()\n     *     }\n     *   }, [])\n     *\n     *   return <motion.div style={{ x }} />\n     * }\n     * ```\n     *\n     * @param subscriber - A function that receives the latest value.\n     * @returns A function that, when called, will cancel this subscription.\n     *\n     * @deprecated\n     */\n    onChange(subscription: Subscriber<V>): () => void {\n        if (process.env.NODE_ENV !== \"production\") {\n            warnOnce(\n                false,\n                `value.onChange(callback) is deprecated. Switch to value.on(\"change\", callback).`\n            )\n        }\n        return this.on(\"change\", subscription)\n    }\n\n    /**\n     * An object containing a SubscriptionManager for each active event.\n     */\n    private events: {\n        [key: string]: SubscriptionManager<any>\n    } = {}\n\n    on<EventName extends keyof MotionValueEventCallbacks<V>>(\n        eventName: EventName,\n        callback: MotionValueEventCallbacks<V>[EventName]\n    ): VoidFunction {\n        if (eventName === \"change\") return this.onChangeSubscribe(callback)\n\n        return (this.events[eventName] ||= new SubscriptionManager()).add(\n            callback\n        )\n    }\n\n    private onChangeSubscribe(callback: Subscriber<V>): VoidFunction {\n        const { events } = this\n\n        if (!events.change && !this.changeSubscriber) {\n            this.changeSubscriber = callback\n        } else {\n            if (!events.change) {\n                events.change = new SubscriptionManager()\n                events.change.add(this.changeSubscriber!)\n                this.changeSubscriber = undefined\n            }\n            events.change.add(callback)\n        }\n\n        return () => {\n            if (this.changeSubscriber === callback) {\n                this.changeSubscriber = undefined\n            } else {\n                events.change?.remove(callback)\n            }\n            this.stopIfUnobserved()\n        }\n    }\n\n    /**\n     * If we have no more change listeners by the start\n     * of the next frame, stop active animations.\n     */\n    private stopIfUnobserved() {\n        frame.read(() => {\n            if (!this.changeSubscriber && !this.events.change?.getSize()) {\n                this.stop()\n            }\n        })\n    }\n\n    clearListeners() {\n        this.changeSubscriber = undefined\n        for (const eventManagers in this.events) {\n            this.events[eventManagers].clear()\n        }\n    }\n\n    /**\n     * Attaches a passive effect to the `MotionValue`.\n     */\n    attach(passiveEffect: PassiveEffect<V>, stopPassiveEffect: VoidFunction) {\n        this.passiveEffect = passiveEffect\n        this.stopPassiveEffect = stopPassiveEffect\n    }\n\n    /**\n     * Sets the state of the `MotionValue`.\n     *\n     * @remarks\n     *\n     * ```jsx\n     * const x = useMotionValue(0)\n     * x.set(10)\n     * ```\n     *\n     * @param latest - Latest value to set.\n     * @param render - Whether to notify render subscribers. Defaults to `true`\n     *\n     * @public\n     */\n    set(v: V) {\n        this.passiveEffect\n            ? this.passiveEffect(v, this.updateAndNotify)\n            : this.updateAndNotify(v)\n    }\n\n    setWithVelocity(prev: V, current: V, delta: number) {\n        this.set(current)\n        this.prev = undefined\n        this.prevFrameValue = prev\n        this.prevUpdatedAt = this.updatedAt - delta\n    }\n\n    /**\n     * Set the state of the `MotionValue`, stopping any active animations,\n     * effects, and resets velocity to `0`.\n     */\n    jump(v: V, endAnimation = true) {\n        if (endAnimation) {\n            /**\n             * Stop first, as stopping a running animation can set the\n             * value it's showing, which would replace v. Marking the value\n             * as updated now skips a JS animation's catch-up tick on stop,\n             * which could otherwise complete it.\n             */\n            this.updatedAt = time.now()\n            this.stop()\n        }\n        this.updateAndNotify(v)\n        this.prev = v\n        this.prevUpdatedAt = this.prevFrameValue = undefined\n        this.stopPassiveEffect?.()\n    }\n\n    dirty() {\n        const { current, changeSubscriber } = this\n        /**\n         * One or the other exists. Subscribing during the direct\n         * subscriber's call moves it into a new manager, which must not\n         * then be notified for the same change.\n         */\n        if (changeSubscriber) {\n            changeSubscriber(current!)\n        } else {\n            this.events.change?.notify(current)\n        }\n    }\n\n    addDependent(dependent: MotionValue) {\n        ;(this.dependents ||= new Set()).add(dependent)\n    }\n\n    removeDependent(dependent: MotionValue) {\n        this.dependents?.delete(dependent)\n    }\n\n    updateAndNotify = (v: V) => {\n        const currentTime = time.now()\n\n        /**\n         * If we're updating the value during another frame or eventloop\n         * than the previous frame, then the we set the previous frame value\n         * to current.\n         */\n        if (this.updatedAt !== currentTime) {\n            this.setPrevFrameValue()\n        }\n\n        this.prev = this.current\n\n        this.setCurrent(v)\n\n        // Update update subscribers\n        if (this.current !== this.prev) {\n            this.dirty()\n\n            if (this.dependents) {\n                for (const dependent of this.dependents) {\n                    dependent.dirty()\n                }\n            }\n        }\n    }\n\n    /**\n     * Returns the latest state of `MotionValue`\n     *\n     * @returns - The latest state of `MotionValue`\n     *\n     * @public\n     */\n    get() {\n        collectMotionValues.current?.push(this)\n\n        /**\n         * A value animating on the compositor isn't updated every frame,\n         * so read it from its animation.\n         */\n        const sampled = this.animation?.liveValue?.()\n\n        return sampled === undefined ? this.current! : (sampled as V)\n    }\n\n    /**\n     * The value as last set. Unlike get(), this doesn't read an animation\n     * running on the compositor, which renders the value itself.\n     */\n    getCurrent() {\n        return this.current!\n    }\n\n    /**\n     * @public\n     */\n    getPrevious() {\n        return this.prev\n    }\n\n    /**\n     * Returns the latest velocity of `MotionValue`\n     *\n     * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.\n     *\n     * @public\n     */\n    getVelocity() {\n        const currentTime = time.now()\n\n        if (\n            !this.canTrackVelocity ||\n            this.prevFrameValue === undefined ||\n            currentTime - this.updatedAt > MAX_VELOCITY_DELTA\n        ) {\n            return 0\n        }\n\n        const delta = Math.min(\n            this.updatedAt - this.prevUpdatedAt!,\n            MAX_VELOCITY_DELTA\n        )\n\n        // Casts because of parseFloat's poor typing\n        return velocityPerSecond(\n            parseFloat(this.current as any) -\n                parseFloat(this.prevFrameValue as any),\n            delta\n        )\n    }\n\n    hasAnimated = false\n\n    /**\n     * Registers a new animation to control this `MotionValue`. Only one\n     * animation can drive a `MotionValue` at one time.\n     *\n     * ```jsx\n     * value.start()\n     * ```\n     *\n     * @param animation - A function that starts the provided animation\n     */\n    start(startAnimation: StartAnimation) {\n        return new Promise<void>((resolve) => this.run(startAnimation, resolve))\n    }\n\n    /**\n     * As start(), without making a promise, for animations started\n     * internally, which complete through their own controls.\n     */\n    run(startAnimation: StartAnimation, onComplete?: VoidFunction) {\n        this.stop()\n        this.hasAnimated = true\n\n        /**\n         * Guard against animations that complete before startAnimation\n         * has returned.\n         */\n        let isComplete = false\n        let animation: MotionValueAnimation | undefined\n        // eslint-disable-next-line prefer-const -- read by the callback before assignment when completing synchronously\n        animation = startAnimation(() => {\n            isComplete = true\n            this.events.animationComplete?.notify()\n            if (this.animation === animation) this.animation = undefined\n            onComplete?.()\n        })\n\n        if (!isComplete) this.animation = animation\n\n        this.events.animationStart?.notify()\n    }\n\n    /**\n     * Stop the currently active animation.\n     *\n     * @public\n     */\n    stop() {\n        if (this.animation) {\n            this.animation.stop()\n            this.events.animationCancel?.notify()\n        }\n        // Assign rather than delete to keep the object's shape stable\n        this.animation = undefined\n    }\n\n    /**\n     * Returns `true` if this value is currently animating.\n     *\n     * @public\n     */\n    isAnimating() {\n        return !!this.animation\n    }\n\n    /**\n     * Destroy and clean up subscribers to this `MotionValue`.\n     *\n     * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically\n     * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually\n     * created a `MotionValue` via the `motionValue` function.\n     *\n     * @public\n     */\n    destroy() {\n        this.dependents?.clear()\n        this.events.destroy?.notify()\n        this.clearListeners()\n        this.stop()\n        this.stopPassiveEffect?.()\n    }\n}\n\nexport function motionValue<V>(init: V, options?: MotionValueOptions) {\n    return new MotionValue<V>(init, options)\n}\n", "/**\n * If `transition` has `inherit: true`, shallow-merge it with\n * `parentTransition` (child keys win) and strip the `inherit` key.\n * Otherwise return `transition` unchanged.\n */\nexport function resolveTransition(\n    transition: any,\n    parentTransition?: any\n) {\n    if (transition?.inherit && parentTransition) {\n        const { inherit: _, ...rest } = transition\n        return { ...parentTransition, ...rest }\n    }\n\n    return transition\n}\n", "import { resolveTransition } from \"./resolve-transition\"\n\nexport function getValueTransition(transition: any, key: string) {\n    const valueTransition =\n        transition?.[key as keyof typeof transition] ??\n        transition?.[\"default\"] ??\n        transition\n\n    if (valueTransition !== transition) {\n        return resolveTransition(valueTransition, transition)\n    }\n\n    return valueTransition\n}\n", "import { transformProps } from \"../../render/utils/keys-transform\"\nimport type { ValueAnimationOptions } from \"../types\"\n\nconst underDampedSpring: Partial<ValueAnimationOptions> = {\n    type: \"spring\",\n    stiffness: 500,\n    damping: 25,\n    restSpeed: 10,\n}\n\nconst criticallyDampedSpring = (\n    target: unknown\n): Partial<ValueAnimationOptions> => ({\n    type: \"spring\",\n    stiffness: 550,\n    damping: target === 0 ? 2 * Math.sqrt(550) : 30,\n    restSpeed: 10,\n})\n\nconst keyframesTransition: Partial<ValueAnimationOptions> = {\n    type: \"keyframes\",\n    duration: 0.8,\n}\n\n/**\n * Default easing curve is a slightly shallower version of\n * the default browser easing curve.\n */\nconst ease: Partial<ValueAnimationOptions> = {\n    type: \"keyframes\",\n    ease: [0.25, 0.1, 0.35, 1],\n    duration: 0.3,\n}\n\nexport const getDefaultTransition = (\n    valueKey: string,\n    { keyframes }: ValueAnimationOptions\n): Partial<ValueAnimationOptions> => {\n    if (keyframes.length > 2) {\n        return keyframesTransition\n    } else if (transformProps.has(valueKey)) {\n        return valueKey.startsWith(\"scale\")\n            ? criticallyDampedSpring(keyframes[1])\n            : underDampedSpring\n    }\n\n    return ease\n}\n", "import type { AnyResolvedKeyframe } from \"../types\"\nimport type { Transition } from \"../types\"\n\nconst orchestrationKeys = new Set([\n    \"when\",\n    \"delay\",\n    \"delayChildren\",\n    \"staggerChildren\",\n    \"staggerDirection\",\n    \"repeat\",\n    \"repeatType\",\n    \"repeatDelay\",\n    \"from\",\n    \"elapsed\",\n    \"out\",\n    \"mixer\",\n])\n\n/**\n * Decide whether a transition is defined on a given Transition.\n * This filters out orchestration options and returns true\n * if any options are left.\n */\nexport function isTransitionDefined(\n    transition: Transition & { elapsed?: number; from?: AnyResolvedKeyframe }\n) {\n    for (const key in transition) {\n        if (!orchestrationKeys.has(key)) return true\n    }\n    return false\n}\n", "import { MotionGlobalConfig, secondsToMilliseconds } from \"motion-utils\"\nimport { AsyncMotionValueAnimation } from \"../AsyncMotionValueAnimation\"\nimport { JSAnimation } from \"../JSAnimation\"\nimport type {\n    AnyResolvedKeyframe,\n    ValueAnimationOptions,\n    ValueTransition,\n} from \"../types\"\nimport type { UnresolvedKeyframes } from \"../keyframes/KeyframesResolver\"\nimport { getValueTransition } from \"../utils/get-value-transition\"\nimport { makeAnimationInstant } from \"../utils/make-animation-instant\"\nimport { getDefaultTransition } from \"../utils/default-transitions\"\nimport { getFinalKeyframe } from \"../keyframes/get-final\"\nimport { isTransitionDefined } from \"../utils/is-transition-defined\"\nimport { frame } from \"../../frameloop\"\nimport type { MotionValue, StartAnimation } from \"../../value\"\nimport type { AnimationElement } from \"../keyframes/types\"\n\nexport const animateMotionValue =\n    <V extends AnyResolvedKeyframe>(\n        name: string,\n        value: MotionValue<V>,\n        target: V | UnresolvedKeyframes<V>,\n        transition: ValueTransition & { elapsed?: number } = {},\n        element?: AnimationElement,\n        isHandoff?: boolean\n    ): StartAnimation =>\n    (onComplete) => {\n        const valueTransition = getValueTransition(transition, name) || {}\n\n        /**\n         * Most transition values are currently completely overwritten by value-specific\n         * transitions. In the future it'd be nicer to blend these transitions. But for now\n         * delay actually does inherit from the root transition if not value-specific.\n         */\n        const delay = valueTransition.delay || transition.delay || 0\n\n        /**\n         * Elapsed isn't a public transition option but can be passed through from\n         * optimized appear effects in milliseconds.\n         */\n        let { elapsed = 0 } = transition\n        elapsed = elapsed - secondsToMilliseconds(delay)\n\n        const options: ValueAnimationOptions = {\n            keyframes: Array.isArray(target) ? target : [null, target],\n            ease: \"easeOut\",\n            velocity: value.getVelocity(),\n            ...valueTransition,\n            delay: -elapsed,\n            onUpdate: (v) => {\n                value.set(v)\n                valueTransition.onUpdate && valueTransition.onUpdate(v)\n            },\n            onComplete: () => {\n                onComplete()\n                valueTransition.onComplete && valueTransition.onComplete()\n            },\n            name,\n            motionValue: value,\n            element: isHandoff ? undefined : element,\n            hasOnUpdate: !!valueTransition.onUpdate,\n        }\n\n        /**\n         * If there's no transition defined for this value, we can generate\n         * unique transition settings for this value.\n         */\n        if (!isTransitionDefined(valueTransition)) {\n            Object.assign(options, getDefaultTransition(name, options))\n        }\n\n        /**\n         * Both WAAPI and our internal animation functions use durations\n         * as defined by milliseconds, while our external API defines them\n         * as seconds.\n         */\n        options.duration &&= secondsToMilliseconds(options.duration)\n        options.repeatDelay &&= secondsToMilliseconds(options.repeatDelay)\n\n        /**\n         * Support deprecated way to set initial value. Prefer keyframe syntax.\n         */\n        if (options.from !== undefined) {\n            options.keyframes[0] = options.from as any\n        }\n\n        let shouldSkip = false\n\n        if (\n            (options as any).type === false ||\n            (options.duration === 0 && !options.repeatDelay)\n        ) {\n            makeAnimationInstant(options)\n\n            if (options.delay === 0) {\n                shouldSkip = true\n            }\n        }\n\n        if (\n            MotionGlobalConfig.instantAnimations ||\n            MotionGlobalConfig.skipAnimations ||\n            element?.shouldSkipAnimations ||\n            valueTransition.skipAnimations\n        ) {\n            shouldSkip = true\n            makeAnimationInstant(options)\n            options.delay = 0\n        }\n\n        /**\n         * If the transition type or easing has been explicitly set by the user\n         * then we don't want to allow flattening the animation.\n         */\n        options.allowFlatten = !valueTransition.type && !valueTransition.ease\n\n        /**\n         * If we can or must skip creating the animation, and apply only\n         * the final keyframe, do so. We also check once keyframes are resolved but\n         * this early check prevents the need to create an animation at all.\n         */\n        if (shouldSkip && !isHandoff && value.get() !== undefined) {\n            const finalKeyframe = getFinalKeyframe<V>(\n                options.keyframes as V[],\n                valueTransition\n            )\n\n            if (finalKeyframe !== undefined) {\n                frame.update(() => {\n                    options.onUpdate!(finalKeyframe)\n                    options.onComplete!()\n                })\n\n                return\n            }\n        }\n\n        return valueTransition.isSync\n            ? new JSAnimation(options)\n            : new AsyncMotionValueAnimation(options)\n    }\n", "import { invariant, isNumericalString } from \"motion-utils\"\nimport { AnyResolvedKeyframe } from \"../types\"\nimport { CSSVariableToken, isCSSVariableToken } from \"./is-css-variable\"\n\n/**\n * Parse Framer's special CSS variable format into a CSS token and a fallback.\n *\n * ```\n * `var(--foo, #fff)` => [`--foo`, '#fff']\n * ```\n *\n * @param current\n */\n\nconst splitCSSVariableRegex =\n    // eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words\n    /^var\\(--(?:([\\w-]+)|([\\w-]+), ?([a-zA-Z\\d ()%#.,-]+))\\)/u\nexport function parseCSSVariable(current: string) {\n    const match = splitCSSVariableRegex.exec(current)\n    if (!match) return [,]\n\n    const [, token1, token2, fallback] = match\n    return [`--${token1 ?? token2}`, fallback]\n}\n\nconst maxDepth = 4\nexport function getVariableValue(\n    current: CSSVariableToken,\n    element: Element,\n    depth = 1\n): AnyResolvedKeyframe | undefined {\n    process.env.NODE_ENV !== \"production\" &&\n        invariant(\n            depth <= maxDepth,\n            `Max CSS variable fallback depth detected in property \"${current}\". This may indicate a circular fallback dependency.`,\n            \"max-css-var-depth\"\n        )\n\n    const [token, fallback] = parseCSSVariable(current)\n\n    // No CSS variable detected\n    if (!token) return\n\n    // Attempt to read this CSS variable off the element\n    const resolved = window.getComputedStyle(element).getPropertyValue(token)\n\n    if (resolved) {\n        const trimmed = resolved.trim()\n        return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed\n    }\n\n    return isCSSVariableToken(fallback)\n        ? getVariableValue(fallback, element, depth + 1)\n        : fallback\n}\n", "import { transformPropOrder } from \"./keys-transform\"\n\nexport const positionalKeys = new Set([\n    \"width\",\n    \"height\",\n    \"top\",\n    \"left\",\n    \"right\",\n    \"bottom\",\n    ...transformPropOrder,\n])\n", "import type { MotionValue } from \"..\"\n\nexport const isMotionValue = (value: any): value is MotionValue =>\n    Boolean(value && value.getVelocity)\n", "import { ValueType } from \"./types\"\n\n/**\n * ValueType for \"auto\"\n */\nexport const auto: ValueType = {\n    test: (v: any) => v === \"auto\",\n    parse: (v) => v,\n}\n", "import { ValueType } from \"./types\"\n\n/**\n * Tests a provided value against a ValueType\n */\nexport const testValueType = (v: any) => (type: ValueType) => type.test(v)\n", "import { auto } from \"./auto\"\nimport { number } from \"./numbers\"\nimport { degrees, percent, px, vh, vw } from \"./numbers/units\"\nimport { testValueType } from \"./test\"\n\n/**\n * A list of value types commonly used for dimensions\n */\nexport const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]\n\n/**\n * Tests a dimensional value against the list of dimension ValueTypes\n */\nexport const findDimensionValueType = (v: any) =>\n    dimensionValueTypes.find(testValueType(v))\n", "import { isZeroValueString } from \"motion-utils\"\nimport { AnyResolvedKeyframe } from \"../../types\"\n\nexport function isNone(value: AnyResolvedKeyframe | null) {\n    if (typeof value === \"number\") {\n        return value === 0\n    } else if (value !== null) {\n        return value === \"none\" || value === \"0\" || isZeroValueString(value)\n    } else {\n        return true\n    }\n}\n", "import { hasComplexValues } from \"../../../value/types/complex\"\nimport { getAnimatableNone } from \"../../../value/types/utils/animatable-none\"\nimport { AnyResolvedKeyframe } from \"../../types\"\nimport { UnresolvedKeyframes } from \"../KeyframesResolver\"\n\n/**\n * If we encounter keyframes like \"none\" or \"0\" and we also have keyframes like\n * \"#fff\" or \"200px 200px\" we want to find a keyframe to serve as a template for\n * the \"none\" keyframes. In this case \"#fff\" or \"200px 200px\" - then these get turned into\n * zero equivalents, i.e. \"#fff0\" or \"0px 0px\".\n */\nconst invalidTemplates = new Set([\"auto\", \"none\", \"0\"])\n\nexport function makeNoneKeyframesAnimatable(\n    unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>,\n    noneKeyframeIndexes: number[],\n    name?: string\n) {\n    let i = 0\n    let animatableTemplate: string | undefined = undefined\n    while (i < unresolvedKeyframes.length && !animatableTemplate) {\n        const keyframe = unresolvedKeyframes[i]\n        if (\n            typeof keyframe === \"string\" &&\n            !invalidTemplates.has(keyframe) &&\n            hasComplexValues(keyframe)\n        ) {\n            animatableTemplate = unresolvedKeyframes[i] as string\n        }\n        i++\n    }\n\n    if (animatableTemplate && name) {\n        for (const noneIndex of noneKeyframeIndexes) {\n            /**\n             * A zero-valued template like \"0%\" is already its own\n             * animatable none, so there's nothing to derive.\n             */\n            if (unresolvedKeyframes[noneIndex] === animatableTemplate) continue\n\n            unresolvedKeyframes[noneIndex] = getAnimatableNone(\n                name,\n                animatableTemplate\n            )\n        }\n    }\n}\n", "import { positionalKeys } from \"../../render/utils/keys-position\"\nimport { findDimensionValueType } from \"../../value/types/dimensions\"\nimport { AnyResolvedKeyframe } from \"../types\"\nimport { getVariableValue } from \"../utils/css-variables-conversion\"\nimport {\n    containsCSSVariable,\n    isCSSVariableToken,\n} from \"../utils/is-css-variable\"\nimport type { MotionValue } from \"../../value\"\nimport {\n    KeyframeResolver,\n    OnKeyframesResolved,\n    UnresolvedKeyframes,\n} from \"./KeyframesResolver\"\nimport { WithRender } from \"./types\"\nimport { isNone } from \"./utils/is-none\"\nimport { makeNoneKeyframesAnimatable } from \"./utils/make-none-animatable\"\nimport { isNumOrPxType, positionalValues } from \"./utils/unit-conversion\"\n\nexport class DOMKeyframesResolver<\n    T extends AnyResolvedKeyframe\n> extends KeyframeResolver<T> {\n    name: string\n    element?: WithRender\n\n    private measuredOrigin?: AnyResolvedKeyframe\n\n    /**\n     * Passes isAsync to the base constructor rather than setting it as a\n     * class field, which would compile to a constructor that spreads\n     * `arguments` into super(). That spread is slow in the interpreter,\n     * and animate() constructs one resolver per value.\n     */\n    constructor(\n        unresolvedKeyframes: UnresolvedKeyframes<AnyResolvedKeyframe>,\n        onComplete: OnKeyframesResolved<T>,\n        name?: string,\n        motionValue?: MotionValue<T>,\n        element?: WithRender\n    ) {\n        super(unresolvedKeyframes, onComplete, name, motionValue, element, true)\n    }\n\n    /**\n     * Keyframes that don't need reading from the DOM, or measuring,\n     * resolve straight away rather than in the frame loop's batched read.\n     */\n    scheduleResolve() {\n        if (this.canReadNow()) {\n            this.readKeyframes()\n            if (!this.needsMeasurement) return this.complete()\n        }\n\n        super.scheduleResolve()\n    }\n\n    private canReadNow() {\n        const { unresolvedKeyframes, element, motionValue } = this\n        const origin = unresolvedKeyframes[0] ?? motionValue?.get()\n\n        if (!element?.current || origin === undefined) return false\n\n        for (let i = 0; i < unresolvedKeyframes.length; i++) {\n            if (containsCSSVariable(i ? unresolvedKeyframes[i] : origin)) {\n                return false\n            }\n        }\n\n        return true\n    }\n\n    readKeyframes() {\n        const { unresolvedKeyframes, element, name } = this\n\n        if (!element?.current) return\n\n        super.readKeyframes()\n\n        /**\n         * If any keyframe is a CSS variable, we need to find its value by sampling the element\n         */\n        for (let i = 0; i < unresolvedKeyframes.length; i++) {\n            let keyframe = unresolvedKeyframes[i]\n\n            if (typeof keyframe === \"string\") {\n                keyframe = keyframe.trim()\n\n                if (isCSSVariableToken(keyframe)) {\n                    const resolved = getVariableValue(keyframe, element.current)\n\n                    if (resolved !== undefined) {\n                        unresolvedKeyframes[i] = resolved as T\n                    }\n\n                    if (i === unresolvedKeyframes.length - 1) {\n                        this.finalKeyframe = keyframe as T\n                    }\n                }\n            }\n        }\n\n        /**\n         * Resolve \"none\" values. We do this potentially twice - once before and once after measuring keyframes.\n         * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which\n         * have a far bigger performance impact.\n         */\n        this.resolveNoneKeyframes()\n\n        /**\n         * Check to see if unit type has changed. If so schedule jobs that will\n         * temporarily set styles to the destination keyframes.\n         * Skip if we have more than two keyframes or this isn't a positional value.\n         * TODO: We can throw if there are multiple keyframes and the value type changes.\n         */\n        if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {\n            return\n        }\n\n        const [origin, target] = unresolvedKeyframes\n\n        // Two numbers share a unit, so skip the value type search.\n        if (typeof origin === \"number\" && typeof target === \"number\") return\n\n        const originType = findDimensionValueType(origin)\n        const targetType = findDimensionValueType(target)\n\n        /**\n         * If one keyframe contains embedded CSS variables (e.g. in calc()) and the other\n         * doesn't, we need to measure to convert to pixels. This handles GitHub issue #3410.\n         */\n        const originHasVar = containsCSSVariable(origin)\n        const targetHasVar = containsCSSVariable(target)\n\n        if (originHasVar !== targetHasVar && positionalValues[name]) {\n            this.needsMeasurement = true\n            return\n        }\n\n        /**\n         * Either we don't recognise these value types or we can animate between them.\n         */\n        if (originType === targetType) return\n\n        /**\n         * If both values are numbers or pixels, we can animate between them by\n         * converting them to numbers.\n         */\n        if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {\n            for (let i = 0; i < unresolvedKeyframes.length; i++) {\n                const value = unresolvedKeyframes[i]\n                if (typeof value === \"string\") {\n                    unresolvedKeyframes[i] = parseFloat(value as string)\n                }\n            }\n        } else if (positionalValues[name]) {\n            /**\n             * Else, the only way to resolve this is by measuring the element.\n             */\n            this.needsMeasurement = true\n        }\n    }\n\n    resolveNoneKeyframes() {\n        const { unresolvedKeyframes, name } = this\n\n        const noneKeyframeIndexes: number[] = []\n        for (let i = 0; i < unresolvedKeyframes.length; i++) {\n            if (\n                unresolvedKeyframes[i] === null ||\n                isNone(unresolvedKeyframes[i])\n            ) {\n                noneKeyframeIndexes.push(i)\n            }\n        }\n\n        if (noneKeyframeIndexes.length) {\n            makeNoneKeyframesAnimatable(\n                unresolvedKeyframes,\n                noneKeyframeIndexes,\n                name\n            )\n        }\n    }\n\n    private measure() {\n        const { element, name } = this\n        return positionalValues[name](\n            window.getComputedStyle(element!.current!),\n            () => element!.measureViewportBox()\n        )\n    }\n\n    measureInitialState() {\n        const { element, unresolvedKeyframes, name } = this\n\n        if (!element?.current) return\n\n        if (name === \"height\") this.suspendedScrollY = window.pageYOffset\n\n        this.measuredOrigin = this.measure()\n\n        unresolvedKeyframes[0] = this.measuredOrigin\n\n        // Set final key frame to measure after next render\n        const measureKeyframe =\n            unresolvedKeyframes[unresolvedKeyframes.length - 1]\n\n        if (measureKeyframe !== undefined) {\n            this.motionValue?.jump(measureKeyframe as T, false)\n        }\n    }\n\n    measureEndState() {\n        const { element, unresolvedKeyframes } = this\n\n        if (!element?.current) return\n\n        this.motionValue?.jump(this.measuredOrigin as T, false)\n\n        const finalKeyframeIndex = unresolvedKeyframes.length - 1\n        const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex]\n\n        unresolvedKeyframes[finalKeyframeIndex] = this.measure() as any\n\n        if (finalKeyframe !== null && this.finalKeyframe === undefined) {\n            this.finalKeyframe = finalKeyframe as T\n        }\n\n        this.resolveNoneKeyframes()\n    }\n}\n", "import { invariant, removeItem } from \"motion-utils\"\nimport { AnimateEffect } from \"../../effects/utils/create-effect\"\nimport { frame } from \"../../frameloop\"\nimport { positionalKeys } from \"../../render/utils/keys-position\"\nimport { MotionValue, motionValue } from \"../../value\"\nimport { animateMotionValue } from \"../interfaces/motion-value\"\nimport { AnimationElement } from \"../keyframes/types\"\nimport {\n    AnimationPlaybackControlsWithThen,\n    AnyResolvedKeyframe,\n    UnresolvedValueKeyframe,\n    ValueTransition,\n} from \"../types\"\n\n/**\n * Effects registered via `animate.addEffect()`, most recent first.\n */\nconst effects: AnimateEffect<any>[] = []\n\nexport function addEffect(effect: AnimateEffect<any>): void {\n    process.env.NODE_ENV !== \"production\" &&\n        invariant(\n            typeof effect.test === \"function\" &&\n                typeof effect.read === \"function\",\n            \"Effects passed to animate.addEffect() need test() and read().\",\n            \"effect-missing-test\"\n        )\n\n    removeEffect(effect)\n    effects.unshift(effect)\n}\n\nexport function removeEffect(effect: AnimateEffect<any>): void {\n    removeItem(effects, effect)\n}\n\nexport function findEffect(subject: unknown): AnimateEffect | undefined {\n    return effects.find((effect) => effect.test(subject))\n}\n\nexport interface EffectKeyframes {\n    [key: string]:\n        | UnresolvedValueKeyframe\n        | UnresolvedValueKeyframe[]\n        | Record<string, unknown>\n        | undefined\n    transition?: Record<string, unknown>\n    transitionEnd?: Record<string, AnyResolvedKeyframe>\n}\n\n/**\n * Effect subjects can expose any key, so per-key transition overrides\n * are keyed by arbitrary strings.\n */\nexport type EffectTransition = ValueTransition & {\n    reduceMotion?: boolean\n    skipAnimations?: boolean\n} & Record<string, unknown>\n\n/**\n * Animate each key in `keyframes` on the motion value `getValue` returns\n * for it. `element` is what the keyframe resolver uses to read, render\n * and measure the subject when the effect defers resolution to it.\n */\nexport function animateValues(\n    getValue: (key: string) => MotionValue,\n    keyframes: EffectKeyframes,\n    transition: EffectTransition = {},\n    element?: AnimationElement\n): AnimationPlaybackControlsWithThen[] {\n    const animations: AnimationPlaybackControlsWithThen[] = []\n    const { velocity, path } = transition\n    const reduceMotion = transition.reduceMotion ?? element?.shouldReduceMotion\n\n    /**\n     * Only elements have x/y to move along a path. path claims them by\n     * deleting them, so hand it a copy.\n     */\n    if (path?.animateValues && element) {\n        keyframes = { ...keyframes }\n        path.animateValues(getValue, keyframes, transition, 0, animations)\n    }\n\n    for (const key in keyframes) {\n        if (key === \"transition\" || key === \"transitionEnd\") continue\n\n        const target = keyframes[key]\n        if (target === undefined) continue\n\n        const value = getValue(key)\n\n        /**\n         * If the value is already at the defined target, skip the animation.\n         * We still re-assert the value via frame.update to take precedence\n         * over any stale transitionEnd callbacks from previous animations.\n         */\n        const current = value.get()\n        if (\n            current !== undefined &&\n            !value.isAnimating() &&\n            !Array.isArray(target) &&\n            target === current &&\n            !velocity\n        ) {\n            frame.update(() => value.set(target))\n            continue\n        }\n\n        value.run(\n            animateMotionValue(\n                key,\n                value,\n                target as any,\n                reduceMotion && positionalKeys.has(key)\n                    ? { type: false }\n                    : transition,\n                element\n            )\n        )\n\n        value.animation &&\n            animations.push(\n                value.animation as AnimationPlaybackControlsWithThen\n            )\n    }\n\n    const { transitionEnd } = keyframes\n    if (transitionEnd) {\n        const applyTransitionEnd = () =>\n            frame.update(() => {\n                for (const key in transitionEnd) {\n                    getValue(key).set(transitionEnd[key])\n                }\n            })\n\n        animations.length\n            ? Promise.all(animations).then(applyTransitionEnd)\n            : applyTransitionEnd()\n    }\n\n    return animations\n}\n\n/**\n * Animate the keys of `subject` via `effect`. Motion values are created on\n * first animation and bound to the subject through the effect for the\n * rest of its life.\n *\n * Without `element`, a new value is seeded synchronously from the first\n * keyframe or `effect.read()`. With it, the value starts undefined and the\n * keyframe resolver reads the subject (batched, with unit conversion by\n * measurement) via `element`.\n */\nexport function animateEffectSubject<Subject extends object>(\n    effect: AnimateEffect<Subject>,\n    subject: Subject,\n    keyframes: EffectKeyframes,\n    transition?: EffectTransition,\n    element?: AnimationElement\n): AnimationPlaybackControlsWithThen[] {\n    /**\n     * Values made for this call are bound with one effect call, after the\n     * loop, rather than one each.\n     */\n    let created: Record<string, MotionValue> | undefined\n    let isBound = false\n\n    const animations = animateValues(\n        (key) => {\n            let value = created?.[key] ?? effect.get(subject, key)\n\n            if (!value) {\n                let initial: AnyResolvedKeyframe | undefined\n\n                if (!element) {\n                    const target = keyframes[key] as\n                        | UnresolvedValueKeyframe\n                        | UnresolvedValueKeyframe[]\n                    initial =\n                        firstKeyframe(target) ??\n                        effect.read(subject, key, target)\n\n                    process.env.NODE_ENV !== \"production\" &&\n                        invariant(\n                            initial !== undefined,\n                            `\"${key}\" can't be read from the animated subject. Provide [from, to] keyframes.`,\n                            \"effect-unreadable-value\"\n                        )\n                }\n\n                value = motionValue(initial, { owner: element })\n                isBound\n                    ? effect(subject, { [key]: value })\n                    : ((created ||= {})[key] = value)\n            }\n\n            return value\n        },\n        keyframes,\n        transition,\n        element\n    )\n\n    isBound = true\n    created && effect(subject, created)\n\n    return animations\n}\n\nfunction firstKeyframe(\n    target: UnresolvedValueKeyframe | UnresolvedValueKeyframe[] | undefined\n) {\n    const first = Array.isArray(target) ? target[0] : undefined\n    return first === null ? undefined : first\n}\n", "import { isObject } from \"motion-utils\"\n\n/**\n * Checks if an element is an HTML element in a way\n * that works across iframes\n */\nexport function isHTMLElement(element: unknown): element is HTMLElement {\n    return (\n        isObject(element) &&\n        \"offsetHeight\" in element &&\n        !(\"ownerSVGElement\" in element)\n    )\n}\n", "import { isObject } from \"motion-utils\"\n\n/**\n * Checks if an element is an SVG element in a way\n * that works across iframes\n */\nexport function isSVGElement(element: unknown): element is SVGElement {\n    return isObject(element) && \"ownerSVGElement\" in element\n}\n", "import type { AnimationOptions } from \"../animation/types\"\n\n/**\n * The scope that `animate()`, `scroll()`, `inView()`, gestures and\n * `resize()` register their cleanups with while it runs. Set by\n * `scopeMotion()`.\n */\nexport interface ActiveScope {\n    root?: Element\n    transition?: AnimationOptions\n    add(cleanup: VoidFunction): VoidFunction\n    bind<F extends (...args: any[]) => any>(callback: F): F\n    track(element: Element): void\n}\n\nexport const activeScope: { current?: ActiveScope } = {}\n\n/**\n * Register `cleanup` with the active scope, if there is one, so stopping\n * the scope also runs it.\n */\nexport function addToScope<T extends VoidFunction>(cleanup: T): T {\n    activeScope.current?.add(cleanup)\n    return cleanup\n}\n\n/**\n * Collect the animation a builder like `animateLayout()` or\n * `animateView()` resolves with. If the scope stops first, the animation\n * is stopped as soon as it starts.\n */\nexport function addBuilderToScope(builder: {\n    then(resolve: (animation?: any) => void, reject?: () => void): unknown\n}) {\n    const scope = activeScope.current\n    if (!scope) return\n\n    let isStopped = false\n    let stop: VoidFunction | undefined\n    const remove = scope.add(() => {\n        isStopped = true\n        stop?.()\n    })\n\n    builder.then((animation?: { stop(): void; finished: Promise<any> }) => {\n        if (!animation) return\n        stop = () => animation.stop()\n        isStopped ? stop() : animation.finished.then(remove)\n    }, remove)\n}\n\n/**\n * Bind `callback` to the active scope, so anything it starts later (for\n * instance an animation in an `inView()` callback) is collected too.\n */\nexport const bindToScope = <F extends (...args: any[]) => any>(callback: F) =>\n    activeScope.current ? activeScope.current.bind(callback) : callback\n", "import { activeScope } from \"../scope/active\"\n\nexport type ElementOrSelector =\n    | Element\n    | Element[]\n    | NodeListOf<Element>\n    | string\n    | null\n    | undefined\n\nexport interface WithQuerySelectorAll {\n    querySelectorAll: Element[\"querySelectorAll\"]\n}\n\nexport interface AnimationScope<T = any> {\n    readonly current: T\n    animations: any[] // TODO: Refactor to types package AnimationPlaybackControls[]\n    /**\n     * Set by useAnimate() from MotionConfig, so timelines created with\n     * this scope follow the same settings.\n     */\n    reduceMotion?: boolean\n    skipAnimations?: boolean\n}\n\nexport interface SelectorCache {\n    [key: string]: NodeListOf<Element>\n}\n\nexport function resolveElements(\n    elementOrSelector: ElementOrSelector,\n    scope?: AnimationScope,\n    selectorCache?: SelectorCache\n): Element[] {\n    if (elementOrSelector == null) {\n        return []\n    }\n\n    if (elementOrSelector instanceof EventTarget) {\n        return [elementOrSelector]\n    } else if (typeof elementOrSelector === \"string\") {\n        const root: WithQuerySelectorAll = scope\n            ? scope.current\n            : activeScope.current?.root || document\n\n        const elements =\n            selectorCache?.[elementOrSelector] ??\n            root.querySelectorAll(elementOrSelector)\n\n        return elements ? Array.from(elements) : []\n    }\n\n    return Array.from(elementOrSelector).filter(\n        (element): element is Element => element != null\n    )\n}\n", "import { frame } from \"../frameloop/frame\"\nimport { Schedule } from \"../frameloop/types\"\nimport { MotionValue } from \"../value\"\n\ninterface Entry {\n    value: MotionValue\n    render?: VoidFunction\n    onRemove: VoidFunction\n}\n\nexport class MotionValueState {\n    /**\n     * Transform keys bound to this state, in `transformPropOrder`, and\n     * the value bound to each. Lets the transform builder visit only\n     * bound transforms, reading each value directly.\n     */\n    transformKeys?: string[]\n    transformValues?: Record<string, MotionValue>\n\n    private values = new Map<string, Entry>()\n\n    /**\n     * Renders scheduled for the next flush, usually one or two (values\n     * bound to the same computed render, e.g. `x` and `y` to `transform`,\n     * share an entry). Tracked with a count rather than truncating the\n     * array so no backing store is reallocated every frame. Kept per\n     * state so pending writes can be flushed synchronously before the\n     * subject is measured.\n     */\n    private pending: VoidFunction[] = []\n    private numPending = 0\n\n    /**\n     * @param step - The frameloop step renders are scheduled in. Defaults\n     * to `frame.render`. Effects that feed a render loop running in\n     * `frame.render` (GPU scenes) should write in `frame.preRender`.\n     */\n    constructor(private step: Schedule = frame.render) {}\n\n    /**\n     * @param render - Writes the value to the subject. Renders read the\n     * motion value directly rather than a cached copy, so there is one\n     * place a value lives.\n     * @param computed - A value already in this state (e.g. `transform`)\n     * whose render should run whenever `value` changes.\n     */\n    set(\n        name: string,\n        value: MotionValue,\n        render?: VoidFunction,\n        computed?: MotionValue\n    ): VoidFunction {\n        this.values.get(name)?.onRemove()\n\n        if (computed) {\n            for (const entry of this.values.values()) {\n                if (entry.value === computed) render = entry.render\n            }\n        }\n\n        const onChange = () => render && this.schedule(render)\n\n        /**\n         * Values created ahead of a DOM read start out undefined and\n         * have nothing to render until they're set.\n         */\n        value.get() !== undefined && onChange()\n\n        const cancelOnChange = value.on(\"change\", onChange)\n\n        const onRemove = () => {\n            cancelOnChange()\n            render && !computed && this.cancel(render)\n            /**\n             * A later set() of the same name has already removed this\n             * entry, so leave the one that replaced it.\n             */\n            this.values.get(name)?.onRemove === onRemove &&\n                this.values.delete(name)\n        }\n\n        this.values.set(name, {\n            value,\n            render: computed ? undefined : render,\n            onRemove,\n        })\n\n        return onRemove\n    }\n\n    get(name: string): MotionValue | undefined {\n        return this.values.get(name)?.value\n    }\n\n    /**\n     * Detach every value from this state and return them, so another\n     * renderer can take them over. The state stays cached by its effect,\n     * so the bound transforms are reset too rather than leaking into\n     * values bound later.\n     */\n    release() {\n        const values = new Map<string, MotionValue>()\n        this.values.forEach((entry, name) => {\n            values.set(name, entry.value)\n            entry.onRemove()\n        })\n        this.transformKeys = this.transformValues = undefined\n        return values\n    }\n\n    private schedule(render: VoidFunction) {\n        const { pending, numPending } = this\n\n        for (let i = 0; i < numPending; i++) {\n            if (pending[i] === render) return\n        }\n\n        numPending || this.step(this.flush)\n\n        pending[this.numPending++] = render\n    }\n\n    private cancel(render: VoidFunction) {\n        const { pending } = this\n\n        for (let i = 0; i < this.numPending; i++) {\n            if (pending[i] === render) {\n                pending[i] = pending[--this.numPending]\n                return\n            }\n        }\n    }\n\n    /**\n     * Run the pending renders. Resetting the count first means a render\n     * scheduled while flushing lands in the next frame, as with the\n     * frameloop itself.\n     */\n    flush = () => {\n        const { pending, numPending } = this\n        this.numPending = 0\n        for (let i = 0; i < numPending; i++) pending[i]()\n    }\n}\n", "import {\n    AnyResolvedKeyframe,\n    UnresolvedValueKeyframe,\n} from \"../../animation/types\"\nimport { Schedule } from \"../../frameloop/types\"\nimport { MotionValue } from \"../../value\"\nimport { MotionValueState } from \"../MotionValueState\"\n\n/**\n * Returns true if the effect knows how to write to `subject`.\n */\nexport type EffectTest<Subject extends object> = (\n    subject: unknown\n) => subject is Subject\n\n/**\n * Reads the current value of `key` from `subject`, used as the initial\n * keyframe when `animate()` creates a motion value for the subject.\n * Returns `undefined` when the value can't be read.\n *\n * `keyframes` is the target being animated to, so effects can match\n * the format of the initial value (for instance color vs numeric).\n */\nexport type EffectRead<Subject extends object> = (\n    subject: Subject,\n    key: string,\n    keyframes?: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n) => AnyResolvedKeyframe | undefined\n\nexport interface EffectOptions<Subject extends object> {\n    test?: EffectTest<Subject>\n    read?: EffectRead<Subject>\n\n    /**\n     * Frameloop step writes are scheduled in. Defaults to `frame.render`.\n     */\n    step?: Schedule\n}\n\nexport interface Effect<Subject extends object = object>\n    extends EffectOptions<Subject> {\n    (subject: Subject, values: Record<string, MotionValue>): VoidFunction\n\n    /**\n     * Returns the motion value currently bound to `key` on `subject`, if any.\n     */\n    get(subject: Subject, key: string): MotionValue | undefined\n\n    /**\n     * Write `subject`'s pending values now rather than in the next frame,\n     * e.g. so it can be measured with a target applied.\n     */\n    flush(subject: Subject): void\n\n    /**\n     * The state holding the motion values bound to `subject`, if any have\n     * been, so they can be handed to another renderer.\n     */\n    state(subject: Subject): MotionValueState | undefined\n}\n\n/**\n * An effect that can be registered with `animate.addEffect()`.\n */\nexport interface AnimateEffect<Subject extends object = object>\n    extends Effect<Subject> {\n    test: EffectTest<Subject>\n    read: EffectRead<Subject>\n}\n\nexport type AddEffectValue<Subject extends object> = (\n    subject: Subject,\n    state: MotionValueState,\n    key: string,\n    value: MotionValue\n) => VoidFunction\n\nexport function createEffect<Subject extends object>(\n    addValue: AddEffectValue<Subject>,\n    options: EffectOptions<Subject> & {\n        test: EffectTest<Subject>\n        read: EffectRead<Subject>\n    }\n): AnimateEffect<Subject>\nexport function createEffect<Subject extends object>(\n    addValue: AddEffectValue<Subject>,\n    options?: EffectOptions<Subject>\n): Effect<Subject>\nexport function createEffect<Subject extends object>(\n    addValue: AddEffectValue<Subject>,\n    { step, ...options }: EffectOptions<Subject> = {}\n): Effect<Subject> {\n    const stateCache = new WeakMap<Subject, MotionValueState>()\n\n    const effect = (\n        subject: Subject,\n        values: Record<string, MotionValue>\n    ): VoidFunction => {\n        const state = stateCache.get(subject) ?? new MotionValueState(step)\n\n        stateCache.set(subject, state)\n\n        const subscriptions: VoidFunction[] = []\n\n        for (const key in values) {\n            const value = values[key]\n            const remove = addValue(subject, state, key, value)\n            subscriptions.push(remove)\n        }\n\n        return () => {\n            for (const cancel of subscriptions) cancel()\n        }\n    }\n\n    return Object.assign(effect, options, {\n        get: (subject: Subject, key: string) =>\n            stateCache.get(subject)?.get(key),\n        flush: (subject: Subject) => stateCache.get(subject)?.flush(),\n        state: (subject: Subject) => stateCache.get(subject),\n    })\n}\n", "import {\n    isDefaultTransform,\n    transformFunction,\n} from \"../../render/html/utils/build-transform\"\nimport { MotionValueState } from \"../MotionValueState\"\n\nexport function buildTransform(state: MotionValueState) {\n    let transform = \"\"\n    const { transformKeys: keys = [], transformValues: values = {} } = state\n\n    /**\n     * Loop over the bound transforms in order, adding the ones that\n     * aren't at their default value to the transform string.\n     */\n    for (let i = 0; i < keys.length; i++) {\n        const key = keys[i]\n        const value = values[key].getCurrent()\n\n        if (value === undefined) continue\n\n        if (!isDefaultTransform(key, value)) {\n            transform += (transform && \" \") + transformFunction(key, value)\n        }\n    }\n\n    // See build-transform.ts: additive `rotate()` so user `rotate` isn't\n    // clobbered. Not a `transformPropOrder` slot.\n    const pathRotation = state.get(\"pathRotation\")?.get()\n    if (pathRotation) {\n        transform +=\n            (transform && \" \") + transformFunction(\"rotate\", pathRotation)\n    }\n\n    return transform || \"none\"\n}\n", "import { transformGroups } from \"../../animation/waapi/transforms/groups\"\nimport { isCSSVar } from \"../../render/dom/is-css-var\"\nimport { readTransformValue } from \"../../render/dom/parse-transform\"\nimport {\n    transformPropOrder,\n    transformProps,\n} from \"../../render/utils/keys-transform\"\nimport { isHTMLElement } from \"../../utils/is-html-element\"\nimport { isSVGElement } from \"../../utils/is-svg-element\"\nimport { MotionValue } from \"../../value\"\nimport { numberValueTypes } from \"../../value/types/maps/number\"\nimport { getValueAsType } from \"../../value/types/utils/get-as-type\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { createSelectorEffect } from \"../utils/create-dom-effect\"\nimport { createEffect } from \"../utils/create-effect\"\nimport { buildTransform } from \"./transform\"\n\nexport const originProps = new Set([\"originX\", \"originY\", \"originZ\"])\n\n/**\n * A bound value in its default unit, e.g. `originX: 50` -> `\"50%\"`.\n */\nconst styleValue = (state: MotionValueState, key: string) =>\n    getValueAsType(state.get(key)?.get(), numberValueTypes[key])\n\nexport const addStyleValue = (\n    element: HTMLElement | SVGElement,\n    state: MotionValueState,\n    key: string,\n    value: MotionValue\n) => {\n    let render: VoidFunction | undefined = undefined\n    let computed: MotionValue | undefined = undefined\n\n    if (transformProps.has(key)) {\n        if (key !== \"pathRotation\") {\n            const keys = (state.transformKeys ??= [])\n            ;(state.transformValues ??= {})[key] = value\n\n            if (!keys.includes(key)) {\n                keys.push(key)\n                keys.sort(\n                    (a, b) =>\n                        transformPropOrder.indexOf(a) -\n                        transformPropOrder.indexOf(b)\n                )\n            }\n        }\n\n        if (!state.get(\"transform\")) {\n            // If this is an HTML element, we need to set the transform-box to fill-box\n            // to normalise the transform relative to the element's bounding box\n            if (!isHTMLElement(element) && !state.get(\"transformBox\")) {\n                addStyleValue(\n                    element,\n                    state,\n                    \"transformBox\",\n                    new MotionValue(\"fill-box\")\n                )\n            }\n\n            state.set(\"transform\", new MotionValue(\"none\"), () => {\n                transformGroups.get(element)?.check()\n                element.style.transform = buildTransform(state)\n            })\n        }\n\n        computed = state.get(\"transform\")\n    } else if (originProps.has(key)) {\n        if (!state.get(\"transformOrigin\")) {\n            state.set(\"transformOrigin\", new MotionValue(\"\"), () => {\n                const originX = styleValue(state, \"originX\") ?? \"50%\"\n                const originY = styleValue(state, \"originY\") ?? \"50%\"\n                const originZ = styleValue(state, \"originZ\") ?? 0\n                element.style.transformOrigin = `${originX} ${originY} ${originZ}`\n            })\n        }\n\n        computed = state.get(\"transformOrigin\")\n    } else if (isCSSVar(key)) {\n        render = () => {\n            element.style.setProperty(key, value.getCurrent() as string)\n        }\n    } else {\n        render = () => {\n            element.style[key as any] = getValueAsType(\n                value.getCurrent(),\n                numberValueTypes[key]\n            ) as string\n        }\n    }\n\n    return state.set(key, value, render, computed)\n}\n\nexport type StyleSubject = HTMLElement | SVGElement\n\nconst isStyleSubject = (subject: unknown): subject is StyleSubject =>\n    isHTMLElement(subject) || isSVGElement(subject)\n\n/**\n * Reads the current value of a style from the element, as the initial\n * keyframe when `animate()` targets an element via this effect. Transforms\n * are parsed out of the computed matrix; everything else is the computed\n * style. Units aren't converted to match the target keyframes. A style\n * the browser can't report is 0, as a VisualElement reports it.\n */\nexport const readStyleValue = (element: StyleSubject, key: string) => {\n    if (transformProps.has(key)) {\n        return readTransformValue(element as HTMLElement, key)\n    }\n\n    const computedStyle = getComputedStyle(element)\n    const value = isCSSVar(key)\n        ? computedStyle.getPropertyValue(key)\n        : computedStyle[key as any]\n\n    return (typeof value === \"string\" && value.trim()) || 0\n}\n\n/**\n * The per-element effect `animate()` binds through, so HTML values share\n * state with a direct `styleEffect()` call. The exported `styleEffect`\n * is this wrapped to also accept selectors.\n */\nexport const styleSubjectEffect = /*@__PURE__*/ createEffect(addStyleValue, {\n    test: isStyleSubject,\n    read: readStyleValue,\n})\n\nexport const styleEffect =\n    /*@__PURE__*/ createSelectorEffect(styleSubjectEffect)\n", "export function camelToDash(str: string): string {\n    return str.replace(/([A-Z])/g, (match) => `-${match.toLowerCase()}`)\n}\n", "import type { MotionNodeOptions } from \"../../../node/types\"\nimport { buildHTMLStyles } from \"../../html/utils/build-styles\"\nimport { ResolvedValues } from \"../../types\"\nimport { SVGRenderState } from \"../types\"\nimport { buildSVGPath } from \"./path\"\n\n/**\n * Values rendered via style rather than as attributes. This must include\n * every value WAAPI can accelerate, as WAAPI writes its final value to\n * style, which would otherwise override later attribute writes.\n */\nexport const cssStyleProperties = [\n    \"transform\",\n    \"opacity\",\n    \"clipPath\",\n    \"filter\",\n    \"offsetDistance\",\n    \"offsetPath\",\n    \"offsetRotate\",\n    \"offsetAnchor\",\n]\n\n/**\n * Build SVG visual attributes, like cx and style.transform\n */\nexport function buildSVGAttrs(\n    state: SVGRenderState,\n    {\n        attrX,\n        attrY,\n        attrScale,\n        pathLength,\n        pathSpacing = 1,\n        pathOffset = 0,\n        // This is object creation, which we try to avoid per-frame.\n        ...latest\n    }: ResolvedValues,\n    isSVGTag: boolean,\n    transformTemplate?: MotionNodeOptions[\"transformTemplate\"],\n    styleProp?: Record<string, any>\n) {\n    buildHTMLStyles(state, latest, transformTemplate)\n\n    /**\n     * For svg tags we just want to make sure viewBox is animatable and treat all the styles\n     * as normal HTML tags.\n     */\n    if (isSVGTag) {\n        if (state.style.viewBox) {\n            state.attrs.viewBox = state.style.viewBox\n        }\n        return\n    }\n\n    state.attrs = state.style\n    state.style = {}\n    const { attrs, style } = state\n\n    for (const key of cssStyleProperties) {\n        if (attrs[key] !== undefined) {\n            style[key] = attrs[key]\n            delete attrs[key]\n        }\n    }\n\n    if (style.transform || attrs.transformOrigin) {\n        style.transformOrigin = attrs.transformOrigin ?? \"50% 50%\"\n        delete attrs.transformOrigin\n    }\n\n    if (style.transform) {\n        /**\n         * SVG's element transform-origin uses its own median as a reference.\n         * Therefore, transformBox becomes a fill-box\n         */\n        style.transformBox = (styleProp?.transformBox as string) ?? \"fill-box\"\n        delete attrs.transformBox\n    }\n\n    // Render attrX/attrY/attrScale as attributes\n    if (attrX !== undefined) attrs.x = attrX\n    if (attrY !== undefined) attrs.y = attrY\n    if (attrScale !== undefined) attrs.scale = attrScale\n\n    // Build SVG path if one has been defined\n    if (pathLength !== undefined) {\n        buildSVGPath(\n            attrs,\n            pathLength as number,\n            pathSpacing as number,\n            pathOffset as number,\n            false\n        )\n    }\n}\n", "import { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\nimport { MotionValue } from \"../../value\"\nimport { numberValueTypes } from \"../../value/types/maps/number\"\nimport { getValueAsType } from \"../../value/types/utils/get-as-type\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { createSelectorEffect } from \"../utils/create-dom-effect\"\nimport { createEffect } from \"../utils/create-effect\"\n\nfunction canSetAsProperty(element: HTMLElement | SVGElement, name: string) {\n    if (!(name in element)) return false\n\n    const descriptor =\n        Object.getOwnPropertyDescriptor(Object.getPrototypeOf(element), name) ||\n        Object.getOwnPropertyDescriptor(element, name)\n\n    // Check if it has a setter\n    return descriptor && typeof descriptor.set === \"function\"\n}\n\n/**\n * `name` is the attribute written when it differs from the key the value\n * is stored under, e.g. `attrX` -> `x`. Numbers take the attribute's\n * default unit (`x: 100` -> `\"100px\"`), as they do when key and name match.\n */\nexport const addAttrValue = (\n    element: HTMLElement | SVGElement,\n    state: MotionValueState,\n    key: string,\n    value: MotionValue,\n    name: string = key\n) => {\n    const isProp = canSetAsProperty(element, name)\n    if (!isProp && (name.startsWith(\"data\") || name.startsWith(\"aria\"))) {\n        name = camelToDash(name)\n    }\n\n    const type = numberValueTypes[key] || numberValueTypes[name]\n\n    /**\n     * Set attribute directly via property if available\n     */\n    const render = isProp\n        ? () => {\n              ;(element as any)[name] = getValueAsType(\n                  value.get(),\n                  numberValueTypes[key]\n              )\n          }\n        : () => {\n              const v = getValueAsType(value.get(), type)\n              if (v === null || v === undefined) {\n                  element.removeAttribute(name)\n              } else {\n                  element.setAttribute(name, String(v))\n              }\n          }\n\n    return state.set(key, value, render)\n}\n\nexport const attrEffect = /*@__PURE__*/ createSelectorEffect(\n    /*@__PURE__*/ createEffect(addAttrValue)\n)\n", "import { frame } from \"../../frameloop\"\nimport { isCSSVar } from \"../../render/dom/is-css-var\"\nimport { camelToDash } from \"../../render/dom/utils/camel-to-dash\"\nimport { cssStyleProperties } from \"../../render/svg/utils/build-attrs\"\nimport { transformProps } from \"../../render/utils/keys-transform\"\nimport { isSVGElement } from \"../../utils/is-svg-element\"\nimport { MotionValue } from \"../../value\"\nimport { numberValueTypes } from \"../../value/types/maps/number\"\nimport { addAttrValue } from \"../attr\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { addStyleValue, originProps, readStyleValue } from \"../style\"\nimport { createSelectorEffect } from \"../utils/create-dom-effect\"\nimport { createEffect } from \"../utils/create-effect\"\n\nfunction addSVGPathValue(\n    element: SVGElement,\n    state: MotionValueState,\n    key: string,\n    value: MotionValue\n) {\n    frame.render(() => element.setAttribute(\"pathLength\", \"1\"))\n\n    if (key === \"pathOffset\") {\n        return state.set(key, value, () => {\n            // Use unitless value to avoid Safari zoom bug\n            const offset = value.get()\n            element.setAttribute(\"stroke-dashoffset\", `${-offset}`)\n        })\n    } else {\n        if (!state.get(\"stroke-dasharray\")) {\n            state.set(\"stroke-dasharray\", new MotionValue(\"1 1\"), () => {\n                const pathLength = state.get(\"pathLength\")?.get() ?? 1\n                const pathSpacing = state.get(\"pathSpacing\")?.get()\n\n                // Use unitless values to avoid Safari zoom bug\n                element.setAttribute(\n                    \"stroke-dasharray\",\n                    `${pathLength} ${pathSpacing ?? 1 - Number(pathLength)}`\n                )\n            })\n        }\n\n        return state.set(key, value, undefined, state.get(\"stroke-dasharray\"))\n    }\n}\n\nexport const addSVGValue = (\n    element: SVGElement,\n    state: MotionValueState,\n    key: string,\n    value: MotionValue\n) => {\n    if (key.startsWith(\"path\") && !transformProps.has(key)) {\n        return addSVGPathValue(element, state, key, value)\n    } else if (key.startsWith(\"attr\")) {\n        return addAttrValue(element, state, key, value, convertAttrKey(key))\n    } else if (key === \"d\") {\n        /**\n         * `d` is a CSS property in Chrome and Firefox, but only as\n         * `path(...)`, so path data goes to the attribute, taken out of\n         * `path(...)` if it's written that way. Path data itself has no\n         * quotes or brackets.\n         */\n        return state.set(key, value, () => {\n            const d = value.get()?.replace(/path\\(|[\"')]/g, \"\")\n            d === undefined\n                ? element.removeAttribute(key)\n                : element.setAttribute(key, d)\n        })\n    }\n\n    /**\n     * Transforms and origins aren't CSS properties (bar `x`/`y` in some\n     * browsers), so check them by name rather than `key in element.style`.\n     */\n    const handler =\n        transformProps.has(key) ||\n        originProps.has(key) ||\n        isCSSVar(key) ||\n        key in element.style\n            ? addStyleValue\n            : addAttrValue\n    return handler(element, state, key, value)\n}\n\n/**\n * Reads the current value of `key` from an SVG element as the origin of\n * an animation, as the SVG VisualElement does: transforms start from\n * their defaults, CSS variables and the few CSS-only properties come from\n * computed style, falling back to the attribute when that's empty (e.g.\n * the element isn't rendered), and everything else is read from the\n * attribute, dash-cased (`strokeWidth` -> `stroke-width`) or, failing\n * that, as written (`baseFrequency`).\n */\nexport const readSVGValue = (element: SVGElement, key: string) => {\n    if (transformProps.has(key)) {\n        return numberValueTypes[key]?.default || 0\n    }\n\n    if (isCSSVar(key) || cssStyleProperties.includes(key)) {\n        return (\n            readStyleValue(element, key) ||\n            element.getAttribute(camelToDash(key)) ||\n            0\n        )\n    }\n\n    key = convertAttrKey(key)\n\n    return (\n        element.getAttribute(camelToDash(key)) ??\n        element.getAttribute(key) ??\n        undefined\n    )\n}\n\n/**\n * The per-element effect `animate()` binds through, so SVG values share\n * state with a direct `svgEffect()` call.\n */\nexport const svgSubjectEffect = /*@__PURE__*/ createEffect(addSVGValue, {\n    test: isSVGElement,\n    read: readSVGValue,\n})\n\nexport const svgEffect = /*@__PURE__*/ createSelectorEffect(svgSubjectEffect)\n\nfunction convertAttrKey(key: string) {\n    return key.replace(/^attr([A-Z])/, (_, firstChar) =>\n        firstChar.toLowerCase()\n    )\n}\n", "import { BoundingBox, Box, TransformPoint } from \"motion-utils\"\n\n/**\n * Bounding boxes tend to be defined as top, left, right, bottom. For various operations\n * it's easier to consider each axis individually. This function returns a bounding box\n * as a map of single-axis min/max values.\n */\nexport function convertBoundingBoxToBox({\n    top,\n    left,\n    right,\n    bottom,\n}: BoundingBox): Box {\n    return {\n        x: { min: left, max: right },\n        y: { min: top, max: bottom },\n    }\n}\n\nexport function convertBoxToBoundingBox({ x, y }: Box): BoundingBox {\n    return { top: y.min, right: x.max, bottom: y.max, left: x.min }\n}\n\n/**\n * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function\n * provided by Framer to allow measured points to be corrected for device scaling. This is used\n * when measuring DOM elements and DOM event points.\n */\nexport function transformBoxPoints(\n    point: BoundingBox,\n    transformPoint?: TransformPoint\n) {\n    if (!transformPoint) return point\n    const topLeft = transformPoint({ x: point.left, y: point.top })\n    const bottomRight = transformPoint({ x: point.right, y: point.bottom })\n\n    return {\n        top: topLeft.y,\n        left: topLeft.x,\n        bottom: bottomRight.y,\n        right: bottomRight.x,\n    }\n}\n", "import { TransformPoint } from \"motion-utils\"\nimport {\n    convertBoundingBoxToBox,\n    transformBoxPoints,\n} from \"../geometry/conversion\"\nimport { translateAxis } from \"../geometry/delta-apply\"\n\nexport function measureViewportBox(\n    instance: HTMLElement,\n    transformPoint?: TransformPoint\n) {\n    return convertBoundingBoxToBox(\n        transformBoxPoints(instance.getBoundingClientRect(), transformPoint)\n    )\n}\n\nexport function measurePageBox(\n    element: HTMLElement,\n    rootProjectionNode: any,\n    transformPagePoint?: TransformPoint\n) {\n    const viewportBox = measureViewportBox(element, transformPagePoint)\n    const { scroll } = rootProjectionNode\n\n    if (scroll) {\n        translateAxis(viewportBox.x, scroll.offset.x)\n        translateAxis(viewportBox.y, scroll.offset.y)\n    }\n\n    return viewportBox\n}\n\nexport const measureDocumentScroll = () => ({\n    x: document.documentElement.scrollLeft || document.body?.scrollLeft || 0,\n    y: document.documentElement.scrollTop || document.body?.scrollTop || 0,\n})\n", "import { styleSubjectEffect, StyleSubject } from \"../../effects/style\"\nimport { svgSubjectEffect } from \"../../effects/svg\"\nimport { measureViewportBox } from \"../../projection/utils/measure\"\nimport type { VisualElement } from \"../../render/VisualElement\"\nimport { isSVGElement } from \"../../utils/is-svg-element\"\nimport { activeScope } from \"../../scope/active\"\nimport { MotionValue, Owner } from \"../../value\"\nimport { transformGroups } from \"../waapi/transforms/groups\"\nimport { DOMKeyframesResolver } from \"../keyframes/DOMKeyframesResolver\"\nimport { AnimationElement } from \"../keyframes/types\"\nimport { AnimationPlaybackControlsWithThen } from \"../types\"\nimport {\n    animateEffectSubject,\n    animateValues,\n    EffectKeyframes,\n    EffectTransition,\n} from \"./effects\"\n\nconst noProps = {}\n\ntype ElementEffect = typeof styleSubjectEffect\n\nconst getElementEffect = (element: Element) =>\n    (isSVGElement(element)\n        ? svgSubjectEffect\n        : styleSubjectEffect) as ElementEffect\n\n/**\n * Presents an effect bound to a DOM element in the shape the DOM keyframe\n * resolver and WAAPI expect, which is that of a VisualElement. Holds no\n * state: everything delegates to the effect. Goes once the resolver takes\n * an effect and subject directly.\n */\nclass EffectSubject implements AnimationElement, Owner {\n    KeyframeResolver = DOMKeyframesResolver\n\n    constructor(private effect: ElementEffect, public current: StyleSubject) {}\n\n    getValue(key: string) {\n        return this.effect.get(this.current, key)\n    }\n\n    readValue(key: string, target?: unknown) {\n        return this.effect.read(this.current, key, target as any)\n    }\n\n    render() {\n        this.effect.flush(this.current)\n    }\n\n    measureViewportBox() {\n        return measureViewportBox(this.current as HTMLElement)\n    }\n\n    getProps() {\n        return noProps\n    }\n}\n\n/**\n * Animate a DOM element's styles. HTML elements are bound through\n * styleEffect, SVG through svgEffect, and both are resolved with the DOM\n * keyframe resolver so reads are batched, units are converted by\n * measurement and eligible values run on WAAPI.\n *\n * Pass the element's VisualElement (a <motion.*> component or an\n * animateLayout() node) to animate its values instead, so the two keep\n * sharing values and a renderer.\n */\nexport function animateElement(\n    element: StyleSubject,\n    keyframes: EffectKeyframes,\n    transition?: EffectTransition,\n    visualElement?: VisualElement\n): AnimationPlaybackControlsWithThen[] {\n    activeScope.current?.track(element)\n\n    if (visualElement) {\n        return animateValues(\n            (key) => visualElement.getValue(key, null),\n            keyframes,\n            transition,\n            visualElement\n        )\n    }\n\n    const effect = getElementEffect(element)\n\n    return animateEffectSubject(\n        effect,\n        element,\n        keyframes,\n        transition,\n        new EffectSubject(effect, element)\n    )\n}\n\n/**\n * Detach the values styleEffect/svgEffect bound to `element`, so the\n * next animation reads its starting values from the DOM again.\n */\nexport const releaseElement = (element: Element) =>\n    getElementEffect(element)\n        .state(element as StyleSubject)\n        ?.release()\n\n/**\n * Hand the values styleEffect/svgEffect are rendering on `element`,\n * whether bound by animate() or directly, to a VisualElement that now\n * owns the element (e.g. created by animateLayout()), so a single\n * renderer drives them alongside its own values.\n */\nexport function handOffElementState(\n    element: Element,\n    visualElement: VisualElement\n) {\n    const state = getElementEffect(element).state(element as StyleSubject)\n    if (!state) return\n\n    /**\n     * A transform group reads values through the effect state, which is\n     * about to be emptied. Hand its animations to the main thread (writing\n     * their current transform) and detach it, so animations the\n     * VisualElement starts form a new group that reads from it.\n     */\n    const group = transformGroups.get(element)\n    if (group) {\n        group.demote()\n        transformGroups.delete(element)\n    }\n\n    const { transformKeys } = state\n    state.release().forEach((value: MotionValue, key: string) => {\n        /**\n         * The style effect derives transform (from the bound transform\n         * keys) and transformBox itself; a VisualElement builds its own.\n         */\n        const derived =\n            key === \"transformBox\" ||\n            (key === \"transform\" && transformKeys?.length)\n\n        if (!derived) {\n            value.owner = visualElement\n            visualElement.addValue(key, value)\n        }\n    })\n}\n", "import { isObject } from \"motion-utils\"\nimport { MotionValue } from \"../../value\"\nimport { MotionValueState } from \"../MotionValueState\"\nimport { createEffect } from \"../utils/create-effect\"\n\ninterface PropSubject {\n    [key: string]: any\n}\n\n/**\n * Writes motion values to the properties of any object. This is\n * animate()'s fallback for subjects no registered effect claims.\n */\nexport const propEffect = /*@__PURE__*/ createEffect(\n    (\n        subject: PropSubject,\n        state: MotionValueState,\n        key: string,\n        value: MotionValue\n    ) => {\n        return state.set(\n            key,\n            value,\n            () => {\n                subject[key] = value.get()\n            }\n        )\n    },\n    {\n        test: (subject: unknown): subject is PropSubject => isObject(subject),\n        read: (subject, key) => {\n            const value = subject[key]\n            return typeof value === \"string\" || typeof value === \"number\"\n                ? value\n                : undefined\n        },\n    }\n)\n", "import { animateMotionValue } from \"../interfaces/motion-value\"\nimport type {\n    AnimationPlaybackControlsWithThen,\n    AnyResolvedKeyframe,\n    UnresolvedValueKeyframe,\n    ValueAnimationTransition,\n} from \"../types\"\nimport {\n    motionValue as createMotionValue,\n    MotionValue,\n} from \"../../value\"\nimport { isMotionValue } from \"../../value/utils/is-motion-value\"\n\nexport function animateSingleValue<V extends AnyResolvedKeyframe>(\n    value: MotionValue<V> | V,\n    keyframes: V | UnresolvedValueKeyframe<V>[],\n    options?: ValueAnimationTransition\n): AnimationPlaybackControlsWithThen {\n    const motionValue = isMotionValue(value) ? value : createMotionValue(value)\n\n    motionValue.run(animateMotionValue(\"\", motionValue, keyframes, options))\n\n    return motionValue.animation as AnimationPlaybackControlsWithThen\n}\n", "import type { VisualElement } from \"./VisualElement\"\n\nexport const visualElementStore = new WeakMap<any, VisualElement>()\n", "import { DOMKeyframesDefinition } from \"motion-dom\"\n\nexport function isDOMKeyframes(\n    keyframes: unknown\n): keyframes is DOMKeyframesDefinition {\n    return typeof keyframes === \"object\" && !Array.isArray(keyframes)\n}\n", "import {\n    AnimationScope,\n    DOMKeyframesDefinition,\n    SelectorCache,\n    resolveElements,\n} from \"motion-dom\"\nimport { ObjectTarget } from \"../sequence/types\"\nimport { isDOMKeyframes } from \"../utils/is-dom-keyframes\"\n\nexport function resolveSubjects<O extends {}>(\n    subject:\n        | string\n        | Element\n        | Element[]\n        | NodeListOf<Element>\n        | O\n        | O[]\n        | null\n        | undefined,\n    keyframes: DOMKeyframesDefinition | ObjectTarget<O>,\n    scope?: AnimationScope,\n    selectorCache?: SelectorCache\n) {\n    if (subject == null) {\n        return []\n    }\n\n    if (typeof subject === \"string\" && isDOMKeyframes(keyframes)) {\n        return resolveElements(subject, scope, selectorCache)\n    } else if (subject instanceof NodeList) {\n        return Array.from(subject)\n    } else if (Array.isArray(subject)) {\n        return subject.filter((s) => s != null)\n    } else {\n        return [subject]\n    }\n}\n", "export function calculateRepeatDuration(\n    duration: number,\n    repeat: number,\n    repeatDelay: number\n): number {\n    return duration * (repeat + 1) + repeatDelay * repeat\n}\n", "import { SequenceTime } from \"../types\"\n\n/**\n * The time of a label, or a label with an offset like \"label+1\" or\n * \"label-0.5\". An exact label name wins over an offset.\n */\nexport function calcLabelTime(\n    position: string,\n    labels: Map<string, number>\n): number | undefined {\n    if (labels.has(position)) return labels.get(position)\n    const [, name, offset] = position.match(/^(.+?)([+-][\\d.]+)$/) || []\n    return labels.has(name)\n        ? Math.max(0, labels.get(name)! + parseFloat(offset))\n        : undefined\n}\n\n/**\n * Given a absolute or relative time definition and current/prev time state of the sequence,\n * calculate an absolute time for the next keyframes.\n */\nexport function calcNextTime(\n    current: number,\n    next: SequenceTime,\n    prev: number,\n    labels: Map<string, number>\n): number {\n    if (typeof next === \"number\") {\n        return next\n    } else if (next.startsWith(\"-\") || next.startsWith(\"+\")) {\n        return Math.max(0, current + parseFloat(next))\n    } else if (next === \"<\") {\n        return prev\n    } else if (next.startsWith(\"<\")) {\n        return Math.max(0, prev + parseFloat(next.slice(1)))\n    } else {\n        return calcLabelTime(next, labels) ?? current\n    }\n}\n", "import { mixNumber, UnresolvedValueKeyframe } from \"motion-dom\"\nimport { Easing, getEasingForSegment, removeItem } from \"motion-utils\"\nimport type { ValueSequence } from \"../types\"\n\nexport function eraseKeyframes(\n    sequence: ValueSequence,\n    startTime: number,\n    endTime: number\n): void {\n    for (let i = 0; i < sequence.length; i++) {\n        const keyframe = sequence[i]\n\n        if (keyframe.at > startTime && keyframe.at < endTime) {\n            removeItem(sequence, keyframe)\n\n            // If we remove this item we have to push the pointer back one\n            i--\n        }\n    }\n}\n\nexport function addKeyframes(\n    sequence: ValueSequence,\n    keyframes: UnresolvedValueKeyframe[],\n    easing: Easing | Easing[],\n    offset: number[],\n    startTime: number,\n    endTime: number\n): void {\n    /**\n     * Erase every existing value between currentTime and targetTime,\n     * this will essentially splice this timeline into any currently\n     * defined ones.\n     */\n    eraseKeyframes(sequence, startTime, endTime)\n\n    for (let i = 0; i < keyframes.length; i++) {\n        sequence.push({\n            value: keyframes[i],\n            at: mixNumber(startTime, endTime, offset[i]),\n            easing: getEasingForSegment(easing, i),\n        })\n    }\n}\n", "/**\n * Take an array of times that represent repeated keyframes. For instance\n * if we have original times of [0, 0.5, 1] then our repeated times will\n * be [0, 0.5, 1, 1, 1.5, 2]. Loop over the times and scale them back\n * down to a 0-1 scale.\n *\n * `repeatDelayUnits` is the repeatDelay expressed in units of a single\n * iteration's duration, so the total span equals `(repeat + 1) + repeat * repeatDelayUnits`.\n */\nexport function normalizeTimes(\n    times: number[],\n    repeat: number,\n    repeatDelayUnits = 0\n): void {\n    const totalUnits = repeat + 1 + repeat * repeatDelayUnits\n    for (let i = 0; i < times.length; i++) {\n        times[i] = times[i] / totalUnits\n    }\n}\n", "import { AbsoluteKeyframe } from \"../types\"\n\nexport function compareByTime(\n    a: AbsoluteKeyframe,\n    b: AbsoluteKeyframe\n): number {\n    if (a.at === b.at) {\n        if (a.value === null) return 1\n        if (b.value === null) return -1\n        return 0\n    } else {\n        return a.at - b.at\n    }\n}\n", "import {\n    AnimationScope,\n    createGeneratorEasing,\n    defaultOffset,\n    DOMKeyframesDefinition,\n    AnimationOptions as DynamicAnimationOptions,\n    fillOffset,\n    GeneratorFactory,\n    isGenerator,\n    isMotionValue,\n    Transition,\n    UnresolvedValueKeyframe,\n    type AnyResolvedKeyframe,\n    type MotionValue,\n} from \"motion-dom\"\nimport {\n    Easing,\n    getEasingForSegment,\n    progress,\n    reverseEasing,\n    secondsToMilliseconds,\n    warning,\n} from \"motion-utils\"\nimport { resolveSubjects } from \"../animate/resolve-subjects\"\nimport {\n    AnimationSequence,\n    At,\n    ResolvedAnimationDefinitions,\n    SequenceMap,\n    SequenceInfo,\n    SequenceOptions,\n    SequenceTime,\n    ValueSequence,\n} from \"./types\"\nimport { calculateRepeatDuration } from \"./utils/calc-repeat-duration\"\nimport { calcNextTime } from \"./utils/calc-time\"\nimport { addKeyframes } from \"./utils/edit\"\nimport { normalizeTimes } from \"./utils/normalize-times\"\nimport { compareByTime } from \"./utils/sort\"\n\nconst defaultSegmentEasing = \"easeInOut\"\n\nconst MAX_REPEAT = 20\n\nexport function createAnimationsFromSequence(\n    sequence: AnimationSequence,\n    { defaultTransition = {}, ...sequenceTransition }: SequenceOptions = {},\n    scope?: AnimationScope,\n    generators?: { [key: string]: GeneratorFactory },\n    info?: SequenceInfo\n): ResolvedAnimationDefinitions {\n    const defaultDuration = defaultTransition.duration || 0.3\n    const animationDefinitions: ResolvedAnimationDefinitions = new Map()\n    const sequences = new Map<Element | MotionValue, SequenceMap>()\n    const elementCache = {}\n    const timeLabels = new Map<string, number>()\n\n    let prevTime = 0\n    let currentTime = 0\n    let totalDuration = 0\n\n    /**\n     * Build the timeline by mapping over the sequence array and converting\n     * the definitions into keyframes and offsets with absolute time values.\n     * These will later get converted into relative offsets in a second pass.\n     *\n     * Nested sequences are resolved recursively. `base` is the absolute\n     * start of the sequence being resolved, so numeric `at` values inside\n     * a nested sequence are relative to where it starts. Returns the time\n     * the sequence ends.\n     */\n    const resolveSequence = (sequence: AnimationSequence, base: number) => {\n        let sequenceEnd = base\n\n        const resolveTime = (at: SequenceTime) =>\n            typeof at === \"number\"\n                ? base + at\n                : calcNextTime(currentTime, at, prevTime, timeLabels)\n\n        for (let i = 0; i < sequence.length; i++) {\n            const segment = sequence[i]\n\n            /**\n             * If this is a timeline label, mark it and skip the rest of this iteration.\n             */\n            if (typeof segment === \"string\") {\n                timeLabels.set(segment, currentTime)\n                continue\n            } else if (!Array.isArray(segment)) {\n                const start =\n                    segment.at === undefined\n                        ? currentTime\n                        : resolveTime(segment.at)\n\n                if (\"sequence\" in segment) {\n                    /**\n                     * Resolve the nested sequence from its start. Afterwards\n                     * \"<\" points at its start and the next segment follows\n                     * its end, as if it were a single segment.\n                     */\n                    prevTime = currentTime = start\n                    currentTime = resolveSequence(segment.sequence, start)\n                    prevTime = start\n                    sequenceEnd = Math.max(sequenceEnd, currentTime)\n                } else {\n                    timeLabels.set(segment.name, start)\n                }\n                continue\n            }\n\n            let [subject, keyframes, transition = {}] = segment\n\n            /**\n             * If a relative or absolute time value has been specified we need to resolve\n             * it in relation to the currentTime.\n             */\n            if (transition.at !== undefined) {\n                currentTime = resolveTime(transition.at)\n            }\n\n            /**\n             * Keep track of the maximum duration in this definition. This will be\n             * applied to currentTime once the definition has been parsed.\n             */\n            let maxDuration = 0\n\n            const resolveValueSequence = (\n                valueKeyframes:\n                    | UnresolvedValueKeyframe\n                    | UnresolvedValueKeyframe[],\n                valueTransition: Transition | DynamicAnimationOptions,\n                valueSequence: ValueSequence,\n                elementIndex = 0,\n                numSubjects = 0\n            ) => {\n                const valueKeyframesAsList = keyframesAsList(valueKeyframes)\n                const {\n                    delay = 0,\n                    times = defaultOffset(valueKeyframesAsList),\n                    type = defaultTransition.type || \"keyframes\",\n                    repeat,\n                    repeatType,\n                    repeatDelay = 0,\n                    ...remainingTransition\n                } = valueTransition\n                let { ease = defaultTransition.ease || \"easeOut\", duration } =\n                    valueTransition\n\n                /**\n                 * The value animates as one, so it takes the first mixer\n                 * given for it, or else the default transition's.\n                 */\n                valueSequence.mixer ||= valueTransition.mixer\n\n                /**\n                 * Resolve stagger() if defined.\n                 */\n                const calculatedDelay =\n                    typeof delay === \"function\"\n                        ? delay(elementIndex, numSubjects)\n                        : delay\n\n                /**\n                 * If this animation should and can use a spring, generate a spring easing function.\n                 */\n                const numKeyframes = valueKeyframesAsList.length\n                const createGenerator = isGenerator(type)\n                    ? type\n                    : generators?.[type || \"keyframes\"]\n\n                if (numKeyframes <= 2 && createGenerator) {\n                    /**\n                     * As we're creating an easing function from a spring,\n                     * ideally we want to generate it using the real distance\n                     * between the two keyframes. However this isn't always\n                     * possible - in these situations we use 0-100.\n                     */\n                    let absoluteDelta = 100\n                    if (\n                        numKeyframes === 2 &&\n                        isNumberKeyframesArray(valueKeyframesAsList)\n                    ) {\n                        const delta =\n                            valueKeyframesAsList[1] - valueKeyframesAsList[0]\n                        absoluteDelta = Math.abs(delta)\n                    }\n\n                    const springTransition = {\n                        ...defaultTransition,\n                        ...remainingTransition,\n                    }\n                    if (duration !== undefined) {\n                        springTransition.duration =\n                            secondsToMilliseconds(duration)\n                    }\n\n                    const springEasing = createGeneratorEasing(\n                        springTransition,\n                        absoluteDelta,\n                        createGenerator\n                    )\n\n                    ease = springEasing.ease\n                    duration = springEasing.duration\n                }\n\n                duration ??= defaultDuration\n\n                const startTime = currentTime + calculatedDelay\n\n                /**\n                 * If there's only one time offset of 0, fill in a second with length 1\n                 */\n                if (times.length === 1 && times[0] === 0) {\n                    times[1] = 1\n                }\n\n                /**\n                 * Fill out if offset if fewer offsets than keyframes\n                 */\n                const remainder = times.length - valueKeyframesAsList.length\n                remainder > 0 && fillOffset(times, remainder)\n\n                /**\n                 * If only one value has been set, ie [1], push a null to the start of\n                 * the keyframe array. This will let us mark a keyframe at this point\n                 * that will later be hydrated with the previous value.\n                 */\n                valueKeyframesAsList.length === 1 &&\n                    valueKeyframesAsList.unshift(null)\n\n                /**\n                 * Segments can't express `repeat: Infinity` or very large\n                 * counts — they'd leave dead time after the segment or\n                 * explode the keyframe array. Ignore with a warning.\n                 */\n                if (repeat) {\n                    typeof process !== \"undefined\" &&\n                        process.env.NODE_ENV !== \"production\" &&\n                        warning(\n                            repeat < MAX_REPEAT,\n                            `Sequence segments can't repeat ${repeat} times — ignoring repeat option. Use a value below ${MAX_REPEAT} or apply repeat at the sequence level instead.`\n                        )\n                }\n\n                if (repeat && repeat < MAX_REPEAT) {\n                    /**\n                     * Express repeatDelay in units of a single iteration's duration\n                     * so it can be added to the per-iteration time offsets below\n                     * before they're normalized to 0-1.\n                     */\n                    const repeatDelayUnits =\n                        duration > 0 ? repeatDelay / duration : 0\n\n                    duration = calculateRepeatDuration(\n                        duration,\n                        repeat,\n                        repeatDelay\n                    )\n\n                    const originalKeyframes = [...valueKeyframesAsList]\n                    const originalTimes = [...times]\n                    ease = Array.isArray(ease) ? [...ease] : [ease]\n                    const originalEase = [...ease]\n\n                    /**\n                     * For reverse/mirror, alternate iterations play the segment\n                     * backwards. mirror matches JSAnimation's mirroredGenerator:\n                     * reversed keyframes, easings unchanged. reverse matches\n                     * JSAnimation's iterationProgress = 1 - p: reversed\n                     * keyframes, easing array reversed AND each function easing\n                     * mapped through reverseEasing (string easings unchanged —\n                     * they're resolved later by the keyframes engine).\n                     */\n                    const isFlipping =\n                        repeatType === \"reverse\" || repeatType === \"mirror\"\n                    let flippedKeyframes = originalKeyframes\n                    let flippedEases = originalEase\n                    if (isFlipping) {\n                        flippedKeyframes = [...originalKeyframes].reverse()\n                        if (repeatType === \"reverse\") {\n                            flippedEases = [...originalEase]\n                                .reverse()\n                                .map((e) =>\n                                    typeof e === \"function\"\n                                        ? reverseEasing(e)\n                                        : e\n                                )\n                        }\n                    }\n\n                    for (\n                        let repeatIndex = 0;\n                        repeatIndex < repeat;\n                        repeatIndex++\n                    ) {\n                        const isFlipped = isFlipping && repeatIndex % 2 === 0\n                        const iterKeyframes = isFlipped\n                            ? flippedKeyframes\n                            : originalKeyframes\n                        const iterEase = isFlipped ? flippedEases : originalEase\n                        const iterStartOffset =\n                            (repeatIndex + 1) * (1 + repeatDelayUnits)\n\n                        /**\n                         * If repeatDelay is set, hold the previous iteration's\n                         * final value through the delay by inserting a keyframe\n                         * at the moment the next iteration begins.\n                         */\n                        if (repeatDelayUnits > 0) {\n                            valueKeyframesAsList.push(\n                                valueKeyframesAsList[\n                                    valueKeyframesAsList.length - 1\n                                ]\n                            )\n                            times.push(iterStartOffset)\n                            ease.push(\"linear\")\n                        }\n\n                        valueKeyframesAsList.push(...iterKeyframes)\n\n                        for (\n                            let keyframeIndex = 0;\n                            keyframeIndex < iterKeyframes.length;\n                            keyframeIndex++\n                        ) {\n                            times.push(\n                                originalTimes[keyframeIndex] + iterStartOffset\n                            )\n                            ease.push(\n                                keyframeIndex === 0\n                                    ? \"linear\"\n                                    : getEasingForSegment(\n                                          iterEase,\n                                          keyframeIndex - 1\n                                      )\n                            )\n                        }\n                    }\n\n                    normalizeTimes(times, repeat, repeatDelayUnits)\n                }\n\n                const targetTime = startTime + duration\n\n                /**\n                 * Add keyframes, mapping offsets to absolute time.\n                 */\n                addKeyframes(\n                    valueSequence,\n                    valueKeyframesAsList,\n                    ease as Easing | Easing[],\n                    times,\n                    startTime,\n                    targetTime\n                )\n\n                maxDuration = Math.max(calculatedDelay + duration, maxDuration)\n                totalDuration = Math.max(targetTime, totalDuration)\n            }\n\n            if (isMotionValue(subject)) {\n                const subjectSequence = getSubjectSequence(subject, sequences)\n                resolveValueSequence(\n                    keyframes as AnyResolvedKeyframe,\n                    transition,\n                    getValueSequence(\"default\", subjectSequence)\n                )\n            } else {\n                const subjects = resolveSubjects(\n                    subject,\n                    keyframes as DOMKeyframesDefinition,\n                    scope,\n                    elementCache\n                )\n\n                const numSubjects = subjects.length\n\n                /**\n                 * For every element in this segment, process the defined values.\n                 */\n                for (\n                    let subjectIndex = 0;\n                    subjectIndex < numSubjects;\n                    subjectIndex++\n                ) {\n                    /**\n                     * Cast necessary, but we know these are of this type\n                     */\n                    keyframes = keyframes as DOMKeyframesDefinition\n                    transition = transition as DynamicAnimationOptions\n\n                    const thisSubject = subjects[subjectIndex]\n                    const subjectSequence = getSubjectSequence(\n                        thisSubject,\n                        sequences\n                    )\n\n                    for (const key in keyframes) {\n                        resolveValueSequence(\n                            keyframes[\n                                key as keyof typeof keyframes\n                            ] as UnresolvedValueKeyframe,\n                            getValueTransition(transition, key),\n                            getValueSequence(key, subjectSequence),\n                            subjectIndex,\n                            numSubjects\n                        )\n                    }\n                }\n            }\n\n            prevTime = currentTime\n            currentTime += maxDuration\n            sequenceEnd = Math.max(sequenceEnd, currentTime)\n        }\n\n        return sequenceEnd\n    }\n\n    resolveSequence(sequence, 0)\n\n    if (info) {\n        info.duration = totalDuration\n        info.labels = timeLabels\n    }\n\n    /**\n     * Exclude `type` from defaultTransition since springs have been\n     * converted to duration-based easing functions in resolveValueSequence.\n     * Including `type: \"spring\"` would cause JSAnimation to error when\n     * the merged keyframes array has more than 2 keyframes.\n     */\n    const { type: _type, ...remainingDefaultTransition } = defaultTransition\n\n    /**\n     * For every element and value combination create a new animation.\n     */\n    sequences.forEach((valueSequences, element) => {\n        for (const key in valueSequences) {\n            const valueSequence = valueSequences[key]\n\n            /**\n             * Arrange all the keyframes in ascending time order.\n             */\n            valueSequence.sort(compareByTime)\n\n            const keyframes: UnresolvedValueKeyframe[] = []\n            const valueOffset: number[] = []\n            const valueEasing: Easing[] = []\n\n            /**\n             * For each keyframe, translate absolute times into\n             * relative offsets based on the total duration of the timeline.\n             */\n            for (let i = 0; i < valueSequence.length; i++) {\n                const { at, value, easing } = valueSequence[i]\n                keyframes.push(value)\n                valueOffset.push(progress(0, totalDuration, at))\n                valueEasing.push(easing || \"easeOut\")\n            }\n\n            /**\n             * If the first keyframe doesn't land on offset: 0\n             * provide one by duplicating the initial keyframe. This ensures\n             * it snaps to the first keyframe when the animation starts.\n             */\n            if (valueOffset[0] !== 0) {\n                valueOffset.unshift(0)\n                keyframes.unshift(keyframes[0])\n                valueEasing.unshift(defaultSegmentEasing)\n            }\n\n            /**\n             * If the last keyframe doesn't land on offset: 1\n             * provide one with a null wildcard value. This will ensure it\n             * stays static until the end of the animation.\n             */\n            if (valueOffset[valueOffset.length - 1] !== 1) {\n                valueOffset.push(1)\n                keyframes.push(null)\n            }\n\n            if (!animationDefinitions.has(element)) {\n                animationDefinitions.set(element, {\n                    keyframes: {},\n                    transition: {},\n                })\n            }\n\n            const definition = animationDefinitions.get(element)!\n\n            definition.keyframes[key] = keyframes\n\n            definition.transition[key] = {\n                ...remainingDefaultTransition,\n                duration: totalDuration,\n                ease: valueEasing,\n                times: valueOffset,\n                mixer: valueSequence.mixer || defaultTransition.mixer,\n                ...sequenceTransition,\n            }\n        }\n    })\n\n    return animationDefinitions\n}\n\nfunction getSubjectSequence<O extends {}>(\n    subject: Element | MotionValue | O,\n    sequences: Map<Element | MotionValue | O, SequenceMap>\n): SequenceMap {\n    !sequences.has(subject) && sequences.set(subject, {})\n    return sequences.get(subject)!\n}\n\nfunction getValueSequence(name: string, sequences: SequenceMap): ValueSequence {\n    if (!sequences[name]) sequences[name] = []\n    return sequences[name]\n}\n\nfunction keyframesAsList(\n    keyframes: UnresolvedValueKeyframe | UnresolvedValueKeyframe[]\n): UnresolvedValueKeyframe[] {\n    return Array.isArray(keyframes) ? keyframes : [keyframes]\n}\n\nexport function getValueTransition(\n    transition: DynamicAnimationOptions & At,\n    key: string\n): DynamicAnimationOptions {\n    return transition && transition[key as keyof typeof transition]\n        ? {\n              ...transition,\n              ...(transition[key as keyof typeof transition] as Transition),\n          }\n        : { ...transition }\n}\n\nconst isNumber = (keyframe: unknown) => typeof keyframe === \"number\"\nconst isNumberKeyframesArray = (\n    keyframes: UnresolvedValueKeyframe[]\n): keyframes is number[] => keyframes.every(isNumber)\n", "import {\n    animateEffectSubject,\n    animateElement,\n    AnimationPlaybackControlsWithThen,\n    AnimationScope,\n    AnyResolvedKeyframe,\n    DOMKeyframesDefinition,\n    AnimationOptions as DynamicAnimationOptions,\n    EffectKeyframes,\n    EffectTransition,\n    ElementOrSelector,\n    findEffect,\n    isMotionValue,\n    MotionValue,\n    propEffect,\n    UnresolvedValueKeyframe,\n    ValueAnimationTransition,\n    visualElementStore,\n} from \"motion-dom\"\nimport { invariant } from \"motion-utils\"\nimport { ObjectTarget } from \"../sequence/types\"\nimport { isDOMKeyframes } from \"../utils/is-dom-keyframes\"\nimport { resolveSubjects } from \"./resolve-subjects\"\nimport { animateSingleValue } from \"motion-dom\"\n\nexport type AnimationSubject = Element | MotionValue<any> | any\n\nfunction isSingleValue(\n    subject: unknown,\n    keyframes: unknown\n): subject is MotionValue | AnyResolvedKeyframe {\n    return (\n        isMotionValue(subject) ||\n        typeof subject === \"number\" ||\n        (typeof subject === \"string\" && !isDOMKeyframes(keyframes))\n    )\n}\n\n/**\n * Animate a string\n */\nexport function animateSubject(\n    value: string | MotionValue<string>,\n    keyframes: string | UnresolvedValueKeyframe<string>[],\n    options?: ValueAnimationTransition<string>\n): AnimationPlaybackControlsWithThen[]\n/**\n * Animate a number\n */\nexport function animateSubject(\n    value: number | MotionValue<number>,\n    keyframes: number | UnresolvedValueKeyframe<number>[],\n    options?: ValueAnimationTransition<number>\n): AnimationPlaybackControlsWithThen[]\n/**\n * Animate a Element\n */\nexport function animateSubject(\n    element: ElementOrSelector,\n    keyframes: DOMKeyframesDefinition,\n    options?: DynamicAnimationOptions,\n    scope?: AnimationScope\n): AnimationPlaybackControlsWithThen[]\n/**\n * Animate a object\n */\nexport function animateSubject<O extends Object>(\n    object: O | O[],\n    keyframes: ObjectTarget<O>,\n    options?: DynamicAnimationOptions\n): AnimationPlaybackControlsWithThen[]\n/**\n * Implementation\n */\nexport function animateSubject<O extends Object>(\n    subject:\n        | MotionValue<number>\n        | MotionValue<string>\n        | number\n        | string\n        | ElementOrSelector\n        | O\n        | O[],\n    keyframes:\n        | number\n        | string\n        | UnresolvedValueKeyframe<number>[]\n        | UnresolvedValueKeyframe<string>[]\n        | DOMKeyframesDefinition\n        | ObjectTarget<O>,\n    options?:\n        | ValueAnimationTransition<number>\n        | ValueAnimationTransition<string>\n        | DynamicAnimationOptions,\n    scope?: AnimationScope\n): AnimationPlaybackControlsWithThen[] {\n    const animations: AnimationPlaybackControlsWithThen[] = []\n\n    if (isSingleValue(subject, keyframes)) {\n        animations.push(\n            animateSingleValue(\n                subject,\n                isDOMKeyframes(keyframes)\n                    ? (keyframes as any).default || keyframes\n                    : keyframes,\n                options ? (options as any).default || options : options\n            )\n        )\n    } else {\n        // Gracefully handle null/undefined subjects (e.g., from querySelector returning null)\n        if (subject == null) {\n            return animations\n        }\n\n        const subjects = resolveSubjects(\n            subject,\n            keyframes as DOMKeyframesDefinition,\n            scope\n        )\n\n        const numSubjects = subjects.length\n\n        process.env.NODE_ENV !== \"production\" &&\n            invariant(\n                Boolean(numSubjects),\n                \"No valid elements provided.\",\n                \"no-valid-elements\"\n            )\n\n        for (let i = 0; i < numSubjects; i++) {\n            const thisSubject = subjects[i]\n            const transition = { ...options }\n\n            /**\n             * Resolve stagger function if provided.\n             */\n            if (\n                \"delay\" in transition &&\n                typeof transition.delay === \"function\"\n            ) {\n                transition.delay = transition.delay(i, numSubjects)\n            }\n\n            if (thisSubject instanceof Element) {\n                /**\n                 * An element already owned by a VisualElement (a <motion.*>\n                 * component or animateLayout()) animates its values so they\n                 * share one renderer. Anything else is driven through\n                 * styleEffect (or svgEffect) and the DOM keyframe resolver,\n                 * without creating a VisualElement.\n                 */\n                animations.push(\n                    ...animateElement(\n                        thisSubject as HTMLElement | SVGElement,\n                        keyframes as EffectKeyframes,\n                        transition as EffectTransition,\n                        visualElementStore.get(thisSubject)\n                    )\n                )\n            } else {\n                /**\n                 * Registered effects (animate.addEffect) claim non-DOM\n                 * subjects before we fall back to writing plain properties.\n                 */\n                animations.push(\n                    ...animateEffectSubject(\n                        findEffect(thisSubject) ?? propEffect,\n                        thisSubject as object,\n                        keyframes as EffectKeyframes,\n                        transition as EffectTransition\n                    )\n                )\n            }\n        }\n    }\n\n    return animations\n}\n", "import {\n    AnimationPlaybackControlsWithThen,\n    AnimationScope,\n    motionValue,\n    spring,\n} from \"motion-dom\"\nimport { createAnimationsFromSequence } from \"../sequence/create\"\nimport {\n    AnimationSequence,\n    SequenceInfo,\n    SequenceOptions,\n} from \"../sequence/types\"\nimport { animateSubject } from \"./subject\"\n\nexport function animateSequence(\n    sequence: AnimationSequence,\n    options?: SequenceOptions,\n    scope?: AnimationScope,\n    info?: SequenceInfo\n) {\n    const animations: AnimationPlaybackControlsWithThen[] = []\n\n    /**\n     * Pre-process: replace function segments with MotionValue segments,\n     * subscribe callbacks immediately\n     */\n    const processedSequence = sequence.map((segment) => {\n        if (Array.isArray(segment) && typeof segment[0] === \"function\") {\n            const callback = segment[0] as (value: any) => void\n            const mv = motionValue(0)\n            mv.on(\"change\", callback)\n\n            if (segment.length === 1) {\n                return [mv, [0, 1]] as any\n            } else if (segment.length === 2) {\n                return [mv, [0, 1], segment[1]] as any\n            } else {\n                return [mv, segment[1], segment[2]] as any\n            }\n        }\n        return segment\n    }) as AnimationSequence\n\n    const animationDefinitions = createAnimationsFromSequence(\n        processedSequence,\n        options,\n        scope,\n        { spring },\n        info\n    )\n\n    /**\n     * Transitions are made per value, but reduceMotion is read from the\n     * top level. animate() resolves it into options, and the default\n     * transition covers timelines made directly.\n     */\n    const reduceMotion =\n        options?.reduceMotion ??\n        (options?.defaultTransition as SequenceOptions)?.reduceMotion\n\n    animationDefinitions.forEach(({ keyframes, transition }, subject) => {\n        animations.push(\n            ...animateSubject(subject, keyframes, {\n                ...transition,\n                reduceMotion,\n            })\n        )\n    })\n\n    return animations\n}\n", "import {\n    activeScope,\n    animateSingleValue,\n    AnimationPlaybackControls,\n    AnimationPlaybackControlsWithThen,\n    AnimationScope,\n    GroupAnimationWithThen,\n    MotionValue,\n    motionValue,\n    TimelineWithFallback,\n} from \"motion-dom\"\nimport { removeItem } from \"motion-utils\"\nimport { animateSequence } from \"../animate/sequence\"\nimport { calcLabelTime } from \"../sequence/utils/calc-time\"\nimport {\n    AnimationSequence,\n    Segment,\n    SequenceInfo,\n    SequenceOptions,\n    SequenceTime,\n} from \"../sequence/types\"\n\nexport type TimelineItem = Segment | Timeline\n\n/**\n * Called with the playback direction: 1 forwards, -1 backwards.\n */\nexport type TimelineCallback = (direction: 1 | -1) => void\n\nexport interface TimelineOptions extends SequenceOptions {\n    /**\n     * Start paused. Defaults to `true` (plays as soon as it's built).\n     */\n    autoplay?: boolean\n    /**\n     * Resolve selectors within this scope, and stop when it's torn\n     * down. Pass the scope from useAnimate() in React.\n     */\n    scope?: AnimationScope\n    /**\n     * Called every frame while the playhead moves, with its time in\n     * seconds within the current repeat.\n     */\n    onUpdate?: (time: number) => void\n    /**\n     * Called each time the timeline starts a repeat.\n     */\n    onRepeat?: () => void\n    /**\n     * Called instead of `onComplete` when the timeline finishes\n     * playing backwards, at its start.\n     */\n    onReverseComplete?: () => void\n}\n\ninterface Marker {\n    name: string\n    time: number\n    callback?: TimelineCallback\n    pause?: boolean\n}\n\ninterface Entry {\n    item: TimelineItem | TimelineCallback\n    at?: SequenceTime\n    marker?: Marker\n}\n\nlet markerId = 0\n\n/**\n * Split a time across repeats into its repeat and the playhead position in\n * the sequence. A time on a repeat boundary is the end of the repeat\n * before it, as it is for the clock's value. With `index`, join a position\n * in that repeat back into a time. Mirrored and reversed repeats play\n * every other repeat backwards.\n */\nfunction inRepeat(\n    {\n        repeat = 0,\n        repeatDelay = 0,\n        repeatType = \"loop\",\n        delay = 0,\n    }: TimelineOptions,\n    duration: number,\n    time: number,\n    index?: number\n) {\n    const cycle = duration + repeatDelay\n    const isSplit = index === undefined\n    if (isSplit) {\n        const t = Math.max(0, time - delay)\n        index =\n            cycle && t > 0\n                ? Math.min(repeat, Math.ceil(t / cycle - 1e-9) - 1)\n                : 0\n        time = Math.min(t - index * cycle, duration)\n    }\n    if (repeatType !== \"loop\" && index! % 2) time = duration - time\n    return [index!, isSplit ? time : delay + index! * cycle + time]\n}\n\n/**\n * Copy a segment with a new `at`, adding a transition if it has none.\n */\nfunction withAt(segment: any[], at: SequenceTime) {\n    const copy = [...segment]\n    const i = typeof copy[0] === \"function\" ? Math.max(1, copy.length - 1) : 2\n    copy[i] = { ...copy[i], at }\n    return copy as Segment\n}\n\nconst label = (name: string, at?: SequenceTime): Segment =>\n    at === undefined ? name : { name, at }\n\n/**\n * Rewind to the start and stop, so every value is back at the value it\n * started from and the next build reads those values as its origin.\n */\nfunction rewind(animation: AnimationPlaybackControls) {\n    animation.pause()\n    animation.time = 0\n    animation.stop()\n}\n\n/**\n * A sequence that can be changed after it's created. Segments, labels,\n * callbacks, pauses and other timelines can be added, moved and removed\n * at any point, including while it plays.\n *\n * Changes are batched and applied once per microtask. Each change\n * rebuilds the underlying animations from the timeline's starting\n * values, then restores the playhead, speed and play state, so changes\n * made while playing take effect without a jump.\n */\nexport class Timeline implements AnimationPlaybackControlsWithThen {\n    finished!: Promise<any>\n\n    private entries: Entry[] = []\n\n    private group?: GroupAnimationWithThen\n\n    /**\n     * Tracks the playhead in seconds. Used to fire callbacks, pauses and\n     * playTo(). Only created when one of those needs it.\n     */\n    private clock?: MotionValue<number>\n\n    private clockAnimation?: AnimationPlaybackControls\n\n    /**\n     * The repeat the playhead is in, to detect when it starts another.\n     */\n    private repeatIndex = 0\n\n    private prevTime = 0\n\n    private markers: Marker[] = []\n\n    private labels = new Map<string, number>()\n\n    private totalDuration = 0\n\n    private isDirty = false\n\n    private isPaused: boolean\n\n    private isDone = false\n\n    private isRebuilding = false\n\n    private playbackSpeed = 1\n\n    private stopAt?: number\n\n    private parent?: Timeline\n\n    private scrollTimeline?: TimelineWithFallback\n\n    private detachScroll?: VoidFunction\n\n    private resolveFinished!: VoidFunction\n\n    /**\n     * The scopeMotion() scope this was created in. Rebuilds run in it, so\n     * selectors resolve in its root and cancel() restores what they\n     * animate.\n     */\n    private motionScope = activeScope.current\n\n    /**\n     * Set when the scope stops, so later changes don't restart it.\n     */\n    private isKilled = false\n\n    /**\n     * True while this plays the animations it was created with, before\n     * any change compiles it as a sequence.\n     */\n    private isWrapped = false\n\n    /**\n     * `animations` are already running animations of `items`, as\n     * animate() makes them. The timeline plays these until it's first\n     * changed, so it costs nothing over the animations themselves until\n     * then.\n     */\n    constructor(\n        items: TimelineItem[] = [],\n        private options: TimelineOptions = {},\n        animations?: AnimationPlaybackControlsWithThen[]\n    ) {\n        this.isPaused = options.autoplay === false\n        this.newFinished()\n        items.forEach((item) => this.add(item))\n\n        if (animations) {\n            this.isDirty = false\n            this.isWrapped = true\n            this.group = new GroupAnimationWithThen(animations)\n            this.watch()\n        } else {\n            /**\n             * Build now, like animate(), so selectors resolve while a\n             * scope is attached. Later changes are batched.\n             */\n            this.invalidate()\n            this.flush()\n        }\n    }\n\n    /**\n     * Add a segment, label or timeline. `at` overrides any `at` already\n     * on the segment. The item itself is the handle for `move()` and\n     * `remove()`.\n     */\n    add(item: TimelineItem, at?: SequenceTime) {\n        if (item instanceof Timeline) item.adopt(this)\n        return this.push({ item, at })\n    }\n\n    /**\n     * Fire a callback when the playhead crosses `at`, in either direction.\n     * It receives the direction: 1 forwards, -1 backwards.\n     */\n    call(callback: TimelineCallback, at?: SequenceTime) {\n        return this.push({\n            item: callback,\n            at,\n            marker: { name: \"_m\" + markerId++, time: 0, callback },\n        })\n    }\n\n    /**\n     * Pause when the playhead reaches `at`.\n     */\n    addPause(at?: SequenceTime, callback?: TimelineCallback) {\n        return this.push({\n            item: callback || {},\n            at,\n            marker: { name: \"_m\" + markerId++, time: 0, callback, pause: true },\n        } as Entry)\n    }\n\n    /**\n     * Change where an item starts.\n     */\n    move(item: TimelineItem | TimelineCallback, at: SequenceTime) {\n        this.entries.forEach((entry) => {\n            if (entry.item === item) entry.at = at\n        })\n        return this.invalidate()\n    }\n\n    /**\n     * Remove a segment, label, callback or timeline.\n     */\n    remove(item: TimelineItem | TimelineCallback) {\n        if (item instanceof Timeline) item.parent = undefined\n        this.entries = this.entries.filter((entry) => entry.item !== item)\n        return this.invalidate()\n    }\n\n    clear() {\n        this.entries = []\n        return this.invalidate()\n    }\n\n    /**\n     * The time of a label in seconds, or `undefined` if there's no label\n     * with this name.\n     */\n    getLabelTime(name: string) {\n        this.flush()\n        return this.labels.get(name)\n    }\n\n    /**\n     * Jump to a time in seconds or a label.\n     */\n    seek(position: SequenceTime) {\n        this.time = this.resolve(position)\n        return this\n    }\n\n    /**\n     * Play forwards or backwards to a time or label, then pause there.\n     */\n    playTo(position: SequenceTime) {\n        const stopAt = this.resolve(position)\n        const duration = this.iterationDuration\n\n        /**\n         * A repeating timeline plays to the position in the repeat it's\n         * already in, rather than all the way back to the first.\n         */\n        const time = this.time\n        const [index] = inRepeat(this.options, duration, time)\n        const target = inRepeat(this.options, duration, stopAt, index)[1]\n        const speed = Math.abs(this.speed)\n        this.speed = target < time ? -speed : speed\n        this.stopAt = stopAt\n        this.clock || this.invalidate()\n        this.play()\n        return this\n    }\n\n    reverse() {\n        this.speed = -this.speed\n        this.play()\n        return this\n    }\n\n    get progress() {\n        return this.duration ? this.time / this.duration : 0\n    }\n\n    set progress(progress: number) {\n        this.time = progress * this.duration\n    }\n\n    get time() {\n        return this.active()?.time ?? 0\n    }\n\n    set time(time: number) {\n        this.flush()\n        this.prevTime = time\n        this.group && (this.group.time = time)\n        this.repeatIndex = this.currentRepeat()\n    }\n\n    get speed() {\n        return this.playbackSpeed\n    }\n\n    set speed(speed: number) {\n        this.playbackSpeed = speed\n        this.group && (this.group.speed = speed)\n    }\n\n    get duration() {\n        this.flush()\n        return this.isWrapped ? this.group!.duration : this.totalDuration\n    }\n\n    get iterationDuration() {\n        this.flush()\n        return this.isWrapped\n            ? this.group!.iterationDuration\n            : this.totalDuration\n    }\n\n    get state() {\n        return this.active()?.state ?? \"idle\"\n    }\n\n    get startTime() {\n        return this.active()?.startTime ?? null\n    }\n\n    play() {\n        this.flush()\n        this.isPaused = false\n        this.group?.play()\n\n        /**\n         * Watch after playing, so it waits for the restarted animations\n         * rather than the ones that already finished.\n         */\n        if (this.isDone) {\n            this.newFinished()\n            this.watch()\n        }\n    }\n\n    pause() {\n        this.flush()\n        this.isPaused = true\n        this.group?.pause()\n    }\n\n    stop = () => {\n        this.flush()\n        this.group?.stop()\n    }\n\n    cancel() {\n        this.flush()\n        this.group?.cancel()\n    }\n\n    complete() {\n        this.flush()\n        this.group?.complete()\n    }\n\n    attachTimeline(timeline: TimelineWithFallback) {\n        this.flush()\n        this.scrollTimeline = timeline\n        this.detachScroll = this.group?.attachTimeline(timeline)\n\n        return () => {\n            this.scrollTimeline = undefined\n            this.detachScroll?.()\n        }\n    }\n\n    then(onResolve: VoidFunction, onReject?: VoidFunction) {\n        return this.finished.then(onResolve, onReject)\n    }\n\n    /**\n     * The current animations, if any are running. Skipped animations\n     * (skipAnimations, reduced motion) can leave the group empty.\n     */\n    private active() {\n        this.flush()\n        return this.group?.animations.length ? this.group : undefined\n    }\n\n    private push(entry: Entry) {\n        this.entries.push(entry)\n        return this.invalidate()\n    }\n\n    /**\n     * Schedule a rebuild. A nested timeline passes changes up, as it's\n     * built as part of its parent.\n     */\n    private invalidate(): this {\n        if (this.parent) {\n            this.parent.invalidate()\n        } else if (!this.isDirty) {\n            this.isDirty = true\n            queueMicrotask(() => this.flush())\n        }\n        return this\n    }\n\n    /**\n     * Apply pending changes now, so reads straight after a change\n     * reflect it.\n     */\n    private flush() {\n        this.isDirty && !this.parent && !this.isKilled && this.build()\n    }\n\n    private adopt(parent: Timeline) {\n        if (this.group) {\n            rewind(this.group)\n            this.group = undefined\n        }\n        this.isDirty = false\n        this.parent = parent\n    }\n\n    private build() {\n        const prevDuration = this.isWrapped\n            ? this.group!.iterationDuration\n            : this.totalDuration\n        this.isDirty = false\n        this.isWrapped = false\n\n        const prev = this.group\n        let time = 0\n\n        if (prev) {\n            this.isRebuilding = true\n            if (this.scrollTimeline) {\n                /**\n                 * Scroll-linked animations can't be seeked in seconds.\n                 * Cancelling also returns them to their starting values,\n                 * and the new build is attached to scroll instead.\n                 */\n                this.detachScroll?.()\n                prev.cancel()\n            } else {\n                time = prev.animations.length ? prev.time : 0\n                rewind(prev)\n            }\n            this.isRebuilding = false\n        }\n\n        const {\n            defaultTransition,\n            onComplete,\n            onUpdate,\n            onRepeat,\n            onReverseComplete,\n            autoplay,\n            scope,\n            ...options\n        } = this.options\n\n        /**\n         * Inherit MotionConfig settings from a useAnimate() scope.\n         */\n        const playback: SequenceOptions = {}\n        if (scope?.reduceMotion !== undefined) {\n            playback.reduceMotion = scope.reduceMotion\n        }\n        if (scope?.skipAnimations !== undefined) {\n            playback.skipAnimations = scope.skipAnimations\n        }\n        Object.assign(playback, options)\n        const markers = new Map<string, Marker>()\n        const info: SequenceInfo = {}\n        const prevScope = activeScope.current\n        activeScope.current = this.motionScope\n        let animations: AnimationPlaybackControlsWithThen[]\n        try {\n            animations = animateSequence(\n                this.toSequence(markers),\n                { defaultTransition, ...playback },\n                scope,\n                info\n            )\n        } finally {\n            activeScope.current = prevScope\n        }\n\n        const labels = info.labels!\n        let duration = playback.duration ?? info.duration!\n\n        /**\n         * A `duration` option stretches every animation to fit, so scale\n         * label and marker times to match.\n         */\n        const scale = info.duration ? duration / info.duration : 1\n        labels.forEach((time, name) => labels.set(name, time * scale))\n\n        /**\n         * Markers are resolved as labels. Move them out of the label map\n         * and extend the duration to reach any marker past the end.\n         */\n        this.markers = []\n        markers.forEach((marker, name) => {\n            marker.time = labels.get(name)!\n            labels.delete(name)\n            duration = Math.max(duration, marker.time)\n            this.markers.push(marker)\n        })\n        this.markers.sort((a, b) => a.time - b.time)\n        this.labels = labels\n        this.totalDuration = duration\n\n        /**\n         * Callbacks, pauses and playTo() watch a linear clock. Without\n         * them, the timeline is only its animations.\n         */\n        this.clock = this.clockAnimation = undefined\n        if (\n            this.markers.length ||\n            this.stopAt !== undefined ||\n            onUpdate ||\n            onRepeat\n        ) {\n            const clock = (this.clock = motionValue(0))\n            clock.on(\"change\", (t) => clock === this.clock && this.onClock(t))\n            animations.unshift(\n                (this.clockAnimation = animateSingleValue(\n                    clock,\n                    [0, duration],\n                    {\n                        ...playback,\n                        duration,\n                        ease: \"linear\",\n                    }\n                ))\n            )\n        }\n\n        const group = (this.group = new GroupAnimationWithThen(animations))\n\n        /**\n         * Keep the playhead in the same repeat and at the same position,\n         * so changing a repeating timeline doesn't jump it.\n         */\n        const { delay = 0, repeat = 0, repeatDelay = 0 } = this.options\n        const [index, position] = inRepeat(this.options, prevDuration, time)\n        if (time > delay) {\n            time = inRepeat(\n                this.options,\n                duration,\n                Math.min(position, duration),\n                index\n            )[1]\n        }\n        if (\n            this.isDone &&\n            time < delay + (repeat + 1) * (duration + repeatDelay) - repeatDelay\n        ) {\n            this.newFinished()\n        }\n\n        if (this.scrollTimeline) {\n            this.detachScroll = group.attachTimeline(this.scrollTimeline)\n        } else {\n            group.speed = this.playbackSpeed\n            if (this.isPaused) group.pause()\n            if (time) group.time = time\n        }\n        this.repeatIndex = this.currentRepeat()\n        /**\n         * Treat a start from 0 as coming from just before it, so markers\n         * at 0 fire.\n         */\n        this.prevTime = time || -1\n\n        this.watch()\n    }\n\n    private toSequence(markers: Map<string, Marker>): AnimationSequence {\n        return this.entries.map(({ item, at, marker }) => {\n            if (marker) {\n                markers.set(marker.name, marker)\n                return label(marker.name, at)\n            }\n            if (item instanceof Timeline) {\n                return { sequence: item.toSequence(markers), at }\n            }\n            if (typeof item === \"string\") return label(item, at)\n            if (at === undefined) return item as Segment\n            return Array.isArray(item)\n                ? withAt(item, at)\n                : ({ ...item, at } as Segment)\n        })\n    }\n\n    private resolve(position: SequenceTime) {\n        this.flush()\n        return typeof position === \"number\"\n            ? position\n            : calcLabelTime(position, this.labels) ?? this.time\n    }\n\n    /**\n     * The repeat the clock is in, from its time across all repeats.\n     */\n    private currentRepeat() {\n        return inRepeat(\n            this.options,\n            this.totalDuration,\n            this.clockAnimation?.time ?? 0\n        )[0]\n    }\n\n    private onClock(time: number) {\n        let prevTime = this.prevTime\n        this.prevTime = time\n        if (this.isRebuilding) return\n\n        const { onUpdate, onRepeat, repeatType = \"loop\" } = this.options\n        onUpdate?.(time)\n\n        /**\n         * A frame can cross any number of repeats. Finish crossing each\n         * repeat it leaves, then cross the next from its edge. A loop\n         * starts each repeat from the same edge. The others turn around.\n         */\n        const repeatIndex = this.currentRepeat()\n        const step = repeatIndex > this.repeatIndex ? 1 : -1\n        while (repeatIndex !== this.repeatIndex) {\n            const isForward =\n                (this.speed > 0) ===\n                (repeatType === \"loop\" || !(this.repeatIndex % 2))\n            const edge = isForward ? this.totalDuration : 0\n            if (this.cross(prevTime, edge)) return\n            this.repeatIndex += step\n            onRepeat?.()\n            prevTime =\n                repeatType === \"loop\" ? (isForward ? -1 : Infinity) : edge\n        }\n\n        this.cross(prevTime, time)\n    }\n\n    /**\n     * Fire markers between two playhead times. Returns `true` if it\n     * paused.\n     */\n    private cross(from: number, to: number) {\n        if (from === to) return\n\n        const isForward = to > from\n        const crossed = (t: number) =>\n            isForward ? t > from && t <= to : t < from && t >= to\n\n        const markers = isForward ? this.markers : [...this.markers].reverse()\n        for (const marker of markers) {\n            if (!crossed(marker.time)) continue\n            marker.callback?.(isForward ? 1 : -1)\n            if (marker.pause) return this.pauseAt(marker.time)\n        }\n\n        if (this.stopAt !== undefined && crossed(this.stopAt)) {\n            this.pauseAt(this.stopAt)\n            this.stopAt = undefined\n            return true\n        }\n    }\n\n    /**\n     * Pause at a playhead position in the current repeat.\n     */\n    private pauseAt(position: number) {\n        this.pause()\n        this.time = inRepeat(\n            this.options,\n            this.totalDuration,\n            position,\n            this.repeatIndex\n        )[1]\n        return true\n    }\n\n    private watch() {\n        const group = this.group!\n        group.finished.then(() => {\n            if (group !== this.group || this.isDone) return\n            this.isDone = true\n            const { onComplete, onReverseComplete } = this.options\n            /**\n             * Without onReverseComplete, onComplete fires in either\n             * direction, as it does for a single animation.\n             */\n            const callback = (this.speed < 0 && onReverseComplete) || onComplete\n            /**\n             * Resolve this run's promise, even if the callback plays the\n             * timeline again and so makes a new one.\n             */\n            const resolve = this.resolveFinished\n            callback?.()\n            resolve()\n        })\n    }\n\n    private newFinished() {\n        this.isDone = false\n        this.finished = new Promise<void>((resolve) => {\n            this.resolveFinished = resolve\n        })\n\n        /**\n         * Stay in the scopeMotion() scope this was created in, and the\n         * useAnimate() scope, while playing. Each replay, including a\n         * change that restarts a finished timeline, registers again.\n         */\n        const { scope } = this.options\n        const remove = this.motionScope?.add(() => {\n            this.isKilled = true\n            this.stop()\n        })\n        scope?.animations.push(this)\n        this.finished.then(() => {\n            remove?.()\n            scope && removeItem(scope.animations, this)\n        })\n    }\n}\n", "import type {\n    AnimationScope,\n    DOMKeyframesDefinition,\n    AnimationOptions as DynamicAnimationOptions,\n    ElementOrSelector,\n    MotionValue,\n    UnresolvedValueKeyframe,\n    ValueAnimationTransition,\n} from \"motion-dom\"\nimport { activeScope, addEffect, removeEffect } from \"motion-dom\"\nimport {\n    AnimationSequence,\n    ObjectTarget,\n    Segment,\n    SequenceOptions,\n} from \"../sequence/types\"\nimport { Timeline, TimelineOptions } from \"../timeline\"\nimport { animateSubject } from \"./subject\"\n\n/**\n * A sequence has at least one segment or nested sequence. Labels alone\n * are never a sequence, as an array of strings isn't a subject either.\n */\nfunction isSequence(value: unknown): value is AnimationSequence {\n    return (\n        Array.isArray(value) &&\n        value.some((item) => Array.isArray(item) || (item as any)?.sequence)\n    )\n}\n\ninterface ScopedAnimateOptions {\n    scope?: AnimationScope\n    reduceMotion?: boolean\n    skipAnimations?: boolean\n}\n\n/**\n * Creates an animation function that is optionally scoped\n * to a specific element.\n */\nexport function createScopedAnimate(options: ScopedAnimateOptions = {}) {\n    const { scope, reduceMotion, skipAnimations } = options\n    /**\n     * Animate a sequence\n     */\n    function scopedAnimate(\n        sequence: AnimationSequence,\n        options?: Omit<TimelineOptions, \"scope\">\n    ): Timeline\n    /**\n     * Animate a string\n     */\n    function scopedAnimate(\n        value: string | MotionValue<string>,\n        keyframes: string | UnresolvedValueKeyframe<string>[],\n        options?: ValueAnimationTransition<string>\n    ): Timeline\n    /**\n     * Animate a number\n     */\n    function scopedAnimate(\n        value: number | MotionValue<number>,\n        keyframes: number | UnresolvedValueKeyframe<number>[],\n        options?: ValueAnimationTransition<number>\n    ): Timeline\n    /**\n     * Animate a generic motion value\n     */\n    function scopedAnimate<V extends string | number>(\n        value: V | MotionValue<V>,\n        keyframes: V | UnresolvedValueKeyframe<V>[],\n        options?: ValueAnimationTransition<V>\n    ): Timeline\n    /**\n     * Animate an Element\n     */\n    function scopedAnimate(\n        element: ElementOrSelector,\n        keyframes: DOMKeyframesDefinition,\n        options?: DynamicAnimationOptions\n    ): Timeline\n    /**\n     * Animate an object\n     */\n    function scopedAnimate<O extends {}>(\n        object: O | O[],\n        keyframes: ObjectTarget<O>,\n        options?: DynamicAnimationOptions\n    ): Timeline\n    /**\n     * Implementation\n     */\n    function scopedAnimate<O extends {}>(\n        subjectOrSequence:\n            | AnimationSequence\n            | MotionValue<number>\n            | MotionValue<string>\n            | number\n            | string\n            | ElementOrSelector\n            | O\n            | O[],\n        optionsOrKeyframes?:\n            | Omit<TimelineOptions, \"scope\">\n            | number\n            | string\n            | UnresolvedValueKeyframe<number>[]\n            | UnresolvedValueKeyframe<string>[]\n            | DOMKeyframesDefinition\n            | ObjectTarget<O>,\n        options?:\n            | ValueAnimationTransition<number>\n            | ValueAnimationTransition<string>\n            | DynamicAnimationOptions\n    ): Timeline {\n        const scopeTransition = activeScope.current?.transition\n\n        const inherited: { reduceMotion?: boolean; skipAnimations?: boolean } =\n            {}\n        if (reduceMotion !== undefined) inherited.reduceMotion = reduceMotion\n        if (skipAnimations !== undefined)\n            inherited.skipAnimations = skipAnimations\n\n        let timeline: Timeline\n\n        if (isSequence(subjectOrSequence)) {\n            const sequenceOptions = {\n                ...inherited,\n                ...(optionsOrKeyframes as SequenceOptions),\n                scope,\n            }\n            if (scopeTransition) {\n                sequenceOptions.defaultTransition = {\n                    ...scopeTransition,\n                    ...sequenceOptions.defaultTransition,\n                } as SequenceOptions[\"defaultTransition\"]\n            }\n\n            /**\n             * Resolve reduceMotion in the same order as a single\n             * animation: options, then the default transition (which\n             * includes the scope's), then useAnimate()'s.\n             */\n            sequenceOptions.reduceMotion =\n                (optionsOrKeyframes as SequenceOptions)?.reduceMotion ??\n                (sequenceOptions.defaultTransition as SequenceOptions)\n                    ?.reduceMotion ??\n                reduceMotion\n\n            timeline = new Timeline(subjectOrSequence, sequenceOptions)\n        } else {\n            // Extract top-level onComplete so it doesn't get applied per-value\n            const { onComplete, ...rest } = options || {}\n            const transition = {\n                ...inherited,\n                ...scopeTransition,\n                ...rest,\n            } as DynamicAnimationOptions\n\n            /**\n             * Play the animations directly, and only compile them as a\n             * sequence if the timeline is changed. Values animated from a\n             * number are animated via their onUpdate callback instead.\n             */\n            const { onUpdate } = rest as ValueAnimationTransition\n            const segment = (\n                typeof subjectOrSequence === \"number\" ||\n                (typeof subjectOrSequence === \"string\" &&\n                    (typeof optionsOrKeyframes === \"string\" ||\n                        Array.isArray(optionsOrKeyframes)))\n                    ? [\n                          onUpdate || (() => {}),\n                          Array.isArray(optionsOrKeyframes)\n                              ? optionsOrKeyframes\n                              : [subjectOrSequence, optionsOrKeyframes],\n                          { ...transition, onUpdate: undefined },\n                      ]\n                    : [subjectOrSequence, optionsOrKeyframes, transition]\n            ) as Segment\n\n            timeline = new Timeline(\n                [segment],\n                { ...inherited, onComplete, scope } as SequenceOptions,\n                animateSubject(\n                    subjectOrSequence as ElementOrSelector,\n                    optionsOrKeyframes as DOMKeyframesDefinition,\n                    transition,\n                    scope\n                )\n            )\n        }\n\n        return timeline\n    }\n\n    return scopedAnimate\n}\n\nexport const animate = /* @__PURE__ */ Object.assign(\n    /* @__PURE__ */ createScopedAnimate(),\n    {\n        /**\n         * Register an effect so `animate()` can animate the subjects it\n         * claims, for instance `animate.addEffect(threeEffect)`. The most\n         * recently added effect is tested first. DOM elements are always\n         * animated directly.\n         */\n        addEffect,\n        removeEffect,\n    }\n)\n", "/**\n * Offline write queue (DR-7).\n *\n * Each queued item is a form POST: {key, url, method, fields: [[name, value, filename?]]}.\n * Values can be Blobs (ticket photos). Items live in IndexedDB so they survive the\n * app closing with no signal, and are sent in order with an Idempotency-Key header,\n * so a retry never creates a duplicate on the server.\n */\nconst DB_NAME = \"loadone\";\nconst STORE = \"outbox\";\nconst listeners = new Set();\nlet flushing = null;\n\nfunction openDb() {\n  return new Promise((resolve, reject) => {\n    const req = indexedDB.open(DB_NAME, 1);\n    req.onupgradeneeded = () => req.result.createObjectStore(STORE, { keyPath: \"key\" });\n    req.onsuccess = () => resolve(req.result);\n    req.onerror = () => reject(req.error);\n  });\n}\n\nasync function tx(mode, fn) {\n  const db = await openDb();\n  return new Promise((resolve, reject) => {\n    const t = db.transaction(STORE, mode);\n    const store = t.objectStore(STORE);\n    const result = fn(store);\n    t.oncomplete = () => resolve(result?.result ?? result);\n    t.onerror = () => reject(t.error);\n  });\n}\n\nfunction changed() {\n  listeners.forEach((fn) => fn());\n}\n\nexport function onQueueChange(fn) {\n  listeners.add(fn);\n}\n\nexport async function enqueue(item) {\n  await tx(\"readwrite\", (s) => s.put({ ...item, createdAt: Date.now(), attempts: 0 }));\n  changed();\n}\n\nexport async function queueItems() {\n  try {\n    const items = await tx(\"readonly\", (s) => s.getAll());\n    return (items ?? []).sort((a, b) => a.createdAt - b.createdAt);\n  } catch {\n    return [];\n  }\n}\n\nexport async function queueCount() {\n  return (await queueItems()).length;\n}\n\nasync function remove(key) {\n  await tx(\"readwrite\", (s) => s.delete(key));\n}\n\nfunction csrf() {\n  const m = document.cookie.match(/(?:^|;\\s*)csrftoken=([^;]+)/);\n  return m ? decodeURIComponent(m[1]) : document.querySelector('meta[name=\"csrf-token\"]')?.content ?? \"\";\n}\n\nasync function send(item) {\n  const body = new FormData();\n  for (const [name, value, filename] of item.fields) {\n    if (value instanceof Blob) body.append(name, value, filename ?? \"upload.jpg\");\n    else body.append(name, value);\n  }\n  return fetch(item.url, {\n    method: item.method ?? \"POST\",\n    body,\n    credentials: \"same-origin\",\n    headers: { \"Idempotency-Key\": item.key, \"X-CSRFToken\": csrf(), Accept: \"application/json\" },\n  });\n}\n\n/** Send everything queued. Returns {sent: [{key, redirect}], rejected: [{key, body}], pending: n}. */\nexport function flushQueue() {\n  if (flushing) return flushing;\n  flushing = (async () => {\n    const sent = [];\n    const rejected = [];\n    for (const item of await queueItems()) {\n      let res;\n      try {\n        res = await send(item);\n      } catch {\n        break; // offline: keep this and everything after it, in order\n      }\n      if (res.ok) {\n        let redirect = item.next ?? null;\n        try {\n          const data = await res.clone().json();\n          redirect = data.redirect ?? redirect;\n        } catch {\n          /* not JSON */\n        }\n        await remove(item.key);\n        sent.push({ key: item.key, redirect });\n      } else if (res.status >= 400 && res.status < 500 && res.status !== 408 && res.status !== 429) {\n        // The server refused it (validation, already submitted, signed out). Don't retry forever.\n        await remove(item.key);\n        rejected.push({ key: item.key, status: res.status, body: await res.text() });\n      } else {\n        break; // server trouble: try again later\n      }\n    }\n    changed();\n    return { sent, rejected, pending: await queueCount() };\n  })().finally(() => {\n    flushing = null;\n  });\n  return flushing;\n}\n", "/**\n * Ticket photo checks on the phone (DR-6) and preparation for upload.\n *\n * checkPhoto() rejects photos that are too small, too dark/bright (glare) or\n * blurry, using the variance of a Laplacian over a downscaled greyscale copy.\n * preparePhoto() re-encodes to JPEG at most 2400px on the long side, which keeps\n * uploads small on weak signal while staying sharp enough to read.\n */\nconst MIN_SIDE = 900;\nconst BLUR_THRESHOLD = 60; // variance of Laplacian on a 512px copy\nconst MAX_SIDE = 2400;\n\nasync function loadBitmap(file) {\n  if (\"createImageBitmap\" in window) {\n    try {\n      return await createImageBitmap(file, { imageOrientation: \"from-image\" });\n    } catch {\n      /* fall through */\n    }\n  }\n  return new Promise((resolve, reject) => {\n    const img = new Image();\n    img.onload = () => resolve(img);\n    img.onerror = reject;\n    img.src = URL.createObjectURL(file);\n  });\n}\n\nexport async function checkPhoto(file) {\n  if (!file.type.startsWith(\"image/\")) return { ok: false, reason: \"that file isn't a photo.\" };\n  let bmp;\n  try {\n    bmp = await loadBitmap(file);\n  } catch {\n    return { ok: false, reason: \"the phone couldn't open that photo.\" };\n  }\n  const w = bmp.width;\n  const h = bmp.height;\n  if (Math.min(w, h) < MIN_SIDE) return { ok: false, reason: \"the photo is too small. Move closer to the ticket.\" };\n\n  const scale = 512 / Math.max(w, h);\n  const cw = Math.round(w * scale);\n  const ch = Math.round(h * scale);\n  const canvas = new OffscreenCanvas(cw, ch);\n  const ctx = canvas.getContext(\"2d\", { willReadFrequently: true });\n  ctx.drawImage(bmp, 0, 0, cw, ch);\n  const { data } = ctx.getImageData(0, 0, cw, ch);\n\n  const grey = new Float32Array(cw * ch);\n  let sum = 0;\n  let clipped = 0;\n  for (let i = 0, p = 0; i < data.length; i += 4, p++) {\n    const g = 0.299 * data[i] + 0.587 * data[i + 1] + 0.114 * data[i + 2];\n    grey[p] = g;\n    sum += g;\n    if (g > 250) clipped++;\n  }\n  const mean = sum / grey.length;\n  if (mean < 45) return { ok: false, reason: \"the photo is too dark. Turn on a light or use the flash.\" };\n  if (clipped / grey.length > 0.25) return { ok: false, reason: \"there's glare on the ticket. Tilt the phone a little.\" };\n\n  let lapSum = 0;\n  let lapSq = 0;\n  let n = 0;\n  for (let y = 1; y < ch - 1; y++) {\n    for (let x = 1; x < cw - 1; x++) {\n      const p = y * cw + x;\n      const lap = grey[p - cw] + grey[p + cw] + grey[p - 1] + grey[p + 1] - 4 * grey[p];\n      lapSum += lap;\n      lapSq += lap * lap;\n      n++;\n    }\n  }\n  const variance = lapSq / n - (lapSum / n) ** 2;\n  if (variance < BLUR_THRESHOLD) return { ok: false, reason: \"the photo is blurry. Hold the phone still.\" };\n  return { ok: true, width: w, height: h, sharpness: Math.round(variance) };\n}\n\nexport async function preparePhoto(file) {\n  const bmp = await loadBitmap(file);\n  const scale = Math.min(1, MAX_SIDE / Math.max(bmp.width, bmp.height));\n  const w = Math.round(bmp.width * scale);\n  const h = Math.round(bmp.height * scale);\n  const canvas = new OffscreenCanvas(w, h);\n  canvas.getContext(\"2d\").drawImage(bmp, 0, 0, w, h);\n  return canvas.convertToBlob({ type: \"image/jpeg\", quality: 0.86 });\n}\n", "/**\n * Tap feedback for slow connections.\n *\n * Almost every action is a full-page link or form POST, so on weak signal a tap\n * can look like nothing happened. This makes every tap visibly acknowledged:\n *   - the tapped button shows a spinner (data-busy) and can't be submitted twice\n *   - a thin progress bar runs at the top until the next page arrives\n *   - after a few seconds a toast says the connection is slow\n *   - a short vibration on Android (iOS ignores it)\n * Everything resets on pageshow, so Back never brings up a stuck spinner.\n *\n * Buttons are never given `disabled`: a disabled submitter drops its name=value,\n * and some forms (sign-in code: action=verify/resend) depend on it.\n */\n\nexport const reduceMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\nconst SLOW_AFTER_MS = 5000;\nlet slowTimer = 0;\nlet trickleTimer = 0;\n\nfunction bar() {\n  return document.getElementById(\"nav-progress\");\n}\n\nexport const progress = {\n  start() {\n    const el = bar();\n    clearTimeout(slowTimer);\n    slowTimer = setTimeout(() => {\n      document.dispatchEvent(\n        new CustomEvent(\"loadone:toast\", { detail: { message: \"Slow connection. Still working\u2026\", kind: \"info\" } }),\n      );\n    }, SLOW_AFTER_MS);\n    if (!el) return;\n    clearInterval(trickleTimer);\n    let width = 12;\n    el.dataset.active = \"\";\n    el.style.width = `${width}%`;\n    // Creep toward 90% so it never looks finished before the page arrives.\n    trickleTimer = setInterval(() => {\n      width += (90 - width) * 0.08;\n      el.style.width = `${width}%`;\n    }, 300);\n  },\n  done() {\n    clearTimeout(slowTimer);\n    clearInterval(trickleTimer);\n    const el = bar();\n    if (!el || !(\"active\" in el.dataset)) return;\n    el.style.width = \"100%\";\n    setTimeout(() => {\n      delete el.dataset.active;\n      el.style.width = \"0\";\n    }, 200);\n  },\n};\n\nexport function setBusy(button, on) {\n  if (!button) return;\n  if (on) button.dataset.busy = \"\";\n  else delete button.dataset.busy;\n}\n\nfunction buzz() {\n  if (!reduceMotion) navigator.vibrate?.(10);\n}\n\nfunction submitterOf(e) {\n  return e.submitter ?? e.target.querySelector('button[type=\"submit\"], button:not([type]), input[type=\"submit\"]');\n}\n\nfunction reset() {\n  progress.done();\n  document.querySelectorAll(\"[data-busy]\").forEach((el) => setBusy(el, false));\n  document.querySelectorAll(\"form[data-submitting]\").forEach((f) => delete f.dataset.submitting);\n}\n\n/** Call once, after the app's own submit handlers are registered, so they run first. */\nexport function initFeedback() {\n  // Form posts: spinner on the tapped button, block a second submit.\n  document.addEventListener(\"submit\", (e) => {\n    const form = e.target;\n    if (!(form instanceof HTMLFormElement)) return;\n    if (form.matches(\"[data-offline-form], [data-photo-form]\")) return; // they manage their own state\n    if (\"submitting\" in form.dataset) {\n      e.preventDefault();\n      return;\n    }\n    if (e.defaultPrevented) return; // cancelled confirm(), or htmx/JS handled it\n    if (form.target && form.target !== \"_self\") return;\n    form.dataset.submitting = \"\";\n    setBusy(submitterOf(e), true);\n    progress.start();\n    buzz();\n  });\n\n  // Link taps: start the bar; tab bar highlights the new tab at once.\n  document.addEventListener(\"click\", (e) => {\n    if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;\n    const a = e.target.closest?.(\"a[href]\");\n    if (!a || a.target === \"_blank\" || a.hasAttribute(\"download\")) return;\n    const url = new URL(a.href, window.location.href);\n    if (url.origin !== window.location.origin) return;\n    if (url.pathname === window.location.pathname && url.search === window.location.search && url.hash) return;\n    progress.start();\n    const tabs = a.closest(\".tab-bar\");\n    if (tabs) {\n      tabs.querySelectorAll(\"a[aria-current]\").forEach((t) => t.removeAttribute(\"aria-current\"));\n      a.setAttribute(\"aria-current\", \"page\");\n      buzz();\n    }\n  });\n\n  // Back/forward cache restores the page as it was when we left: clear busy state.\n  window.addEventListener(\"pageshow\", reset);\n}\n", "/**\n * Mobile number inputs (<input data-phone>, from MobileNumberField).\n *\n * As digits are typed: space them like the example (\"208 555 0134\") and turn the help line\n * under the field into a live count (\"6 of 10 digits\") that ends in a check mark. The server\n * still validates; this only shows people the format while they type.\n */\n\nconst EXAMPLE = \"208 555 0134\";\n\nfunction digitsOf(value) {\n  let digits = value.replace(/\\D/g, \"\");\n  if (digits.length === 11 && digits.startsWith(\"1\")) digits = digits.slice(1);\n  return digits;\n}\n\nexport function spaced(digits) {\n  return [digits.slice(0, 3), digits.slice(3, 6), digits.slice(6, 10)].filter(Boolean).join(\" \");\n}\n\nexport function status(value) {\n  if (!value.trim()) return { text: null, kind: \"help\" };\n  if (/[a-z]/i.test(value)) return { text: `Use numbers only, like ${EXAMPLE}.`, kind: \"error\" };\n  if (value.trim().startsWith(\"+\")) return { text: null, kind: \"help\" };\n  const n = digitsOf(value).length;\n  if (n < 10) return { text: `${n} of 10 digits, like ${EXAMPLE}`, kind: \"help\" };\n  if (n > 10) return { text: `That's ${n} digits. A mobile number has 10, like ${EXAMPLE}.`, kind: \"error\" };\n  return { text: `\u2713 ${spaced(digitsOf(value))}`, kind: \"ok\" };\n}\n\nfunction init(input) {\n  if (input.dataset.phoneReady) return;\n  input.dataset.phoneReady = \"1\";\n  const line = document.getElementById(`${input.id}-help`) ?? document.getElementById(`${input.id}-error`);\n  const original = line ? { text: line.textContent, className: line.className } : null;\n\n  const render = () => {\n    if (!line) return;\n    const { text, kind } = status(input.value);\n    if (text === null) {\n      line.textContent = original.text;\n      line.className = original.className;\n      return;\n    }\n    line.textContent = text;\n    line.className =\n      \"mt-1.5 text-base font-medium \" +\n      (kind === \"error\" ? \"text-error\" : kind === \"ok\" ? \"text-success\" : \"text-base-content/70\");\n    // A fresh edit replaces any server error shown for the previous value.\n    input.classList.toggle(\"input-error\", kind === \"error\");\n    input.setAttribute(\"aria-invalid\", kind === \"error\" ? \"true\" : \"false\");\n  };\n\n  input.addEventListener(\"input\", (e) => {\n    // Only reformat when typing at the end, so editing in the middle doesn't move the cursor.\n    const atEnd = input.selectionStart === input.value.length;\n    const v = input.value;\n    if (atEnd && e.inputType?.startsWith(\"insert\") && !v.trim().startsWith(\"+\") && !/[a-z]/i.test(v)) {\n      const digits = v.replace(/\\D/g, \"\");\n      const lead = digits.length === 11 && digits.startsWith(\"1\") ? \"1 \" : \"\";\n      input.value = lead + spaced(lead ? digits.slice(1) : digits) + digits.slice(lead ? 11 : 10);\n    }\n    render();\n  });\n  input.addEventListener(\"blur\", render);\n}\n\nexport function initPhoneInputs(root = document) {\n  root.querySelectorAll?.(\"input[data-phone]\").forEach(init);\n}\n", "/**\n * LoadOne front-end entry.\n *\n * - htmx 4 for server-rendered partial updates (CSRF header added to every request)\n * - motion for small, purposeful transitions (confirmations, sheets)\n * - Chart.js for carrier-admin summaries (canvas[data-chart])\n * - Offline queue: ticket photos and edits are saved on the phone (IndexedDB)\n *   and sent when coverage returns, each with an Idempotency-Key (DR-7).\n * - Photo check: blur/brightness/size before a ticket photo is accepted (DR-6).\n */\nimport htmx from \"htmx.org/dist/htmx.esm.js\";\nimport { animate } from \"motion\";\nimport { queueCount, enqueue, flushQueue, onQueueChange } from \"./offline-queue.js\";\nimport { checkPhoto, preparePhoto } from \"./photo.js\";\nimport { initFeedback, progress, reduceMotion, setBusy } from \"./feedback.js\";\nimport { initPhoneInputs } from \"./phone.js\";\n\nwindow.htmx = htmx;\n\n// --- CSRF ------------------------------------------------------------------------------\n\nexport function csrfToken() {\n  const m = document.cookie.match(/(?:^|;\\s*)csrftoken=([^;]+)/);\n  if (m) return decodeURIComponent(m[1]);\n  return document.querySelector('meta[name=\"csrf-token\"]')?.content ?? \"\";\n}\n\ndocument.addEventListener(\"htmx:config:request\", (evt) => {\n  const ctx = evt.detail.ctx;\n  if (ctx?.request?.headers) ctx.request.headers[\"X-CSRFToken\"] = csrfToken();\n});\n\n// --- Motion: one purposeful entrance for things the user just caused -------------------\n\nfunction reveal(root) {\n  if (reduceMotion) return;\n  root.querySelectorAll?.(\"[data-reveal]\").forEach((el, i) => {\n    animate(el, { opacity: [0, 1], y: [12, 0] }, { duration: 0.32, delay: i * 0.04, ease: [0.2, 0.7, 0.2, 1] });\n    el.removeAttribute(\"data-reveal\");\n  });\n  root.querySelectorAll?.(\"[data-pop]\").forEach((el) => {\n    animate(el, { scale: [0.6, 1.08, 1], opacity: [0, 1] }, { duration: 0.5, ease: \"easeOut\" });\n    el.removeAttribute(\"data-pop\");\n  });\n}\n\ndocument.addEventListener(\"htmx:after:swap\", (evt) => {\n  reveal(evt.detail?.ctx?.target ?? document);\n  initCharts(document);\n  initPhotoForms(document);\n  initPhoneInputs(document);\n});\n\n// --- Toasts ---------------------------------------------------------------------------\n\nexport function toast(message, kind = \"info\") {\n  const host = document.getElementById(\"toasts\");\n  if (!host) return;\n  const el = document.createElement(\"div\");\n  el.className = `alert alert-${kind} shadow-lg text-base font-medium`;\n  el.setAttribute(\"role\", \"status\");\n  el.textContent = message;\n  host.appendChild(el);\n  if (!reduceMotion) animate(el, { opacity: [0, 1], y: [16, 0] }, { duration: 0.25 });\n  setTimeout(() => el.remove(), 4500);\n}\n\ndocument.addEventListener(\"loadone:toast\", (e) => toast(e.detail?.message ?? e.detail?.value ?? \"\", e.detail?.kind));\n\n// --- Charts ---------------------------------------------------------------------------\n\nfunction cssVar(name) {\n  return getComputedStyle(document.documentElement).getPropertyValue(name).trim();\n}\n\nasync function initCharts(root) {\n  const canvases = root.querySelectorAll(\"canvas[data-chart]:not([data-ready])\");\n  if (!canvases.length) return;\n  const { Chart } = await import(\"./charts.js\");\n  canvases.forEach((canvas) => {\n    canvas.dataset.ready = \"1\";\n    const spec = JSON.parse(document.getElementById(canvas.dataset.chart)?.textContent ?? \"{}\");\n    const palette = [cssVar(\"--color-primary\"), cssVar(\"--color-secondary\"), cssVar(\"--color-accent\"), cssVar(\"--color-info\"), cssVar(\"--color-success\")];\n    const text = cssVar(\"--color-base-content\");\n    new Chart(canvas, {\n      type: spec.type ?? \"bar\",\n      data: {\n        labels: spec.labels ?? [],\n        datasets: (spec.datasets ?? []).map((d, i) => ({\n          borderWidth: 0,\n          borderRadius: 6,\n          backgroundColor: spec.type === \"doughnut\" ? palette : palette[i % palette.length],\n          ...d,\n        })),\n      },\n      options: {\n        indexAxis: spec.indexAxis ?? \"x\",\n        responsive: true,\n        maintainAspectRatio: false,\n        animation: reduceMotion ? false : { duration: 500 },\n        plugins: {\n          legend: { display: spec.type === \"doughnut\", position: \"bottom\", labels: { color: text, font: { family: \"Barlow\", size: 13 } } },\n          tooltip: { callbacks: spec.currency ? { label: (c) => ` $${Number(c.raw).toLocaleString(undefined, { minimumFractionDigits: 2 })}` } : {} },\n        },\n        scales:\n          spec.type === \"doughnut\"\n            ? {}\n            : {\n                [spec.indexAxis === \"y\" ? \"y\" : \"x\"]: { grid: { display: false }, ticks: { color: text, font: { family: \"Barlow\", size: 14, weight: 600 } } },\n                [spec.indexAxis === \"y\" ? \"x\" : \"y\"]: { beginAtZero: true, grid: { color: cssVar(\"--color-base-300\") }, ticks: { color: text, precision: 0 } },\n              },\n      },\n    });\n  });\n}\n\n// --- Ticket photo forms ------------------------------------------------------------------\n// <form data-photo-form action=\"...\" data-next=\"...\"> with <input type=file name=image capture>\n\nfunction initPhotoForms(root) {\n  root.querySelectorAll(\"form[data-photo-form]:not([data-ready])\").forEach((form) => {\n    form.dataset.ready = \"1\";\n    const input = form.querySelector('input[type=\"file\"]');\n    const preview = form.querySelector(\"[data-preview]\");\n    const message = form.querySelector(\"[data-photo-message]\");\n    const submit = form.querySelector('button[type=\"submit\"]');\n    let prepared = null;\n\n    const setMessage = (text, kind) => {\n      if (!message) return;\n      message.textContent = text;\n      message.className = `text-base font-medium ${kind === \"error\" ? \"text-error\" : \"text-base-content/70\"}`;\n      message.hidden = !text;\n    };\n\n    input?.addEventListener(\"change\", async () => {\n      prepared = null;\n      submit && (submit.disabled = true);\n      const file = input.files?.[0];\n      if (!file) return;\n      setMessage(\"Checking the photo\u2026\");\n      const check = await checkPhoto(file);\n      if (preview) {\n        preview.src = URL.createObjectURL(file);\n        preview.hidden = false;\n      }\n      if (!check.ok) {\n        form.dataset.state = \"unreadable\";\n        setMessage(`Ticket unreadable: ${check.reason} Retake the photo.`, \"error\");\n        return;\n      }\n      prepared = await preparePhoto(file);\n      form.dataset.state = \"ready\";\n      setMessage(\"Photo looks clear. Send it when you're ready.\");\n      submit && (submit.disabled = false);\n      submit?.focus();\n    });\n\n    form.addEventListener(\"submit\", async (e) => {\n      e.preventDefault();\n      if (!prepared) return;\n      submit.disabled = true;\n      setBusy(submit, true);\n      progress.start();\n      const key = crypto.randomUUID();\n      const fields = [\n        [\"image\", prepared, `ticket-${key}.jpg`],\n        [\"device_captured_at\", new Date().toISOString()],\n        [\"client_key\", key],\n      ];\n      await enqueue({ key, url: form.action, method: \"POST\", fields, label: form.dataset.label ?? \"Ticket photo\", next: form.dataset.next });\n      const result = await flushQueue();\n      const sent = result.sent.find((r) => r.key === key);\n      const failed = result.rejected.find((r) => r.key === key);\n      if (sent) {\n        window.location.assign(sent.redirect || form.dataset.next || window.location.href);\n      } else if (failed) {\n        setMessage(errorText(failed), \"error\");\n        submit.disabled = false;\n        setBusy(submit, false);\n        progress.done();\n      } else {\n        window.location.assign(form.dataset.next || window.location.href);\n        toast(\"Saved on your phone. It uploads by itself when you have signal.\", \"warning\");\n      }\n    });\n  });\n}\n\nfunction errorText(failed) {\n  try {\n    return JSON.parse(failed.body).error ?? \"That didn't go through. Try again.\";\n  } catch {\n    return failed.status === 403 ? \"You're signed out. Sign in again, then retry.\" : \"That didn't go through. Try again.\";\n  }\n}\n\n// --- Offline-capable plain forms ---------------------------------------------------------\n// <form data-offline-form> posts through the queue so edits survive with no signal.\n\ndocument.addEventListener(\"submit\", async (e) => {\n  const form = e.target;\n  if (!(form instanceof HTMLFormElement) || !form.matches(\"[data-offline-form]\")) return;\n  e.preventDefault();\n  if (\"submitting\" in form.dataset) return;\n  form.dataset.submitting = \"\";\n  const button = e.submitter ?? form.querySelector('button[type=\"submit\"], button:not([type])');\n  setBusy(button, true);\n  progress.start();\n  const key = crypto.randomUUID();\n  const fields = [...new FormData(form).entries()].filter(([name]) => name !== \"csrfmiddlewaretoken\");\n  await enqueue({ key, url: form.action, method: \"POST\", fields, label: form.dataset.label ?? \"Changes\" });\n  const result = await flushQueue();\n  const sent = result.sent.find((r) => r.key === key);\n  const failed = result.rejected.find((r) => r.key === key);\n  if (sent) {\n    window.location.assign(sent.redirect || window.location.href);\n    return; // stay busy until the next page arrives\n  }\n  delete form.dataset.submitting;\n  setBusy(button, false);\n  progress.done();\n  if (failed) {\n    toast(errorText(failed), \"error\");\n  } else {\n    toast(\"Saved on your phone. It sends by itself when you have signal.\", \"warning\");\n  }\n});\n\n// --- Sign out: drop cached pages so the next person on this phone can't see them -------------\n\ndocument.addEventListener(\"submit\", (e) => {\n  if (e.target instanceof HTMLFormElement && e.target.matches(\"[data-signout]\") && \"caches\" in window) {\n    caches.delete(\"loadone-pages\");\n  }\n});\n\n// --- Queue status badge -------------------------------------------------------------------\n\nasync function renderQueueBadge() {\n  const n = await queueCount();\n  document.querySelectorAll(\"[data-queue-badge]\").forEach((el) => {\n    el.hidden = n === 0;\n    const label = el.querySelector(\"[data-queue-count]\");\n    if (label) label.textContent = n === 1 ? \"1 item waiting for signal\" : `${n} items waiting for signal`;\n  });\n}\n\nonQueueChange(renderQueueBadge);\nwindow.addEventListener(\"online\", async () => {\n  const { sent } = await flushQueue();\n  if (sent.length) {\n    toast(sent.length === 1 ? \"Uploaded what was saved on your phone.\" : `Uploaded ${sent.length} saved items.`, \"success\");\n    setTimeout(() => window.location.reload(), 900);\n  }\n});\n\n// --- Service worker ----------------------------------------------------------------------\n\nif (\"serviceWorker\" in navigator && document.documentElement.dataset.sw) {\n  navigator.serviceWorker.register(document.documentElement.dataset.sw, { scope: \"/\" }).catch(() => {});\n}\n\n// --- Tap feedback (registered last so the handlers above run first) -------------------------\n\ninitFeedback();\n\n// --- Boot ------------------------------------------------------------------------------------\n\nfunction boot() {\n  reveal(document);\n  initPhoneInputs(document);\n  initCharts(document);\n  initPhotoForms(document);\n  renderQueueBadge();\n  if (navigator.onLine) flushQueue().then(({ sent }) => sent.length && renderQueueBadge());\n  setInterval(() => navigator.onLine && flushQueue(), 30000);\n}\n\nif (document.readyState === \"loading\") document.addEventListener(\"DOMContentLoaded\", boot);\nelse boot();\n"],
  "mappings": "AAAA,IAAIA,IAAQ,IAAM,CASd,IAAMC,EAAO,CAST,MAAMC,EAAQ,CACV,GAAI,CAACA,EAAQ,MAAO,CAAC,EACrB,GAAIA,EAAO,WAAW,GAAG,EAAG,OAAO,KAAK,MAAMA,CAAM,EACpD,IAAIC,EAAU,qHACVC,EAAS,CAAC,EACd,QAASC,KAASH,EAAO,SAASC,CAAO,EAAG,CACxC,GAAI,C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CAC5C,GAAM,CAAE,KAAAL,CAAK,EAAI,MAAMD,GAAW,EAC9BC,EAAK,SACPhC,GAAMgC,EAAK,SAAW,EAAI,yCAA2C,YAAYA,EAAK,MAAM,gBAAiB,SAAS,EACtH,WAAW,IAAM,OAAO,SAAS,OAAO,EAAG,GAAG,EAElD,CAAC,EAIG,kBAAmB,WAAa,SAAS,gBAAgB,QAAQ,IACnE,UAAU,cAAc,SAAS,SAAS,gBAAgB,QAAQ,GAAI,CAAE,MAAO,GAAI,CAAC,EAAE,MAAM,IAAM,CAAC,CAAC,EAKtGU,GAAa,EAIb,SAASC,IAAO,CACdpD,GAAO,QAAQ,EACfQ,GAAgB,QAAQ,EACxBF,GAAW,QAAQ,EACnBC,GAAe,QAAQ,EACvBuC,GAAiB,EACb,UAAU,QAAQN,GAAW,EAAE,KAAK,CAAC,CAAE,KAAAC,CAAK,IAAMA,EAAK,QAAUK,GAAiB,CAAC,EACvF,YAAY,IAAM,UAAU,QAAUN,GAAW,EAAG,GAAK,CAC3D,CAEI,SAAS,aAAe,UAAW,SAAS,iBAAiB,mBAAoBY,EAAI,EACpFA,GAAK",
  "names": ["htmx", "HCON", "string", "pattern", "result", "match", "doubleQuotedKey", "singleQuotedKey", "bareKey", "doubleQuotedValue", "singleQuotedValue", "hyperscriptValue", "bareValue", "key", "value", "pair", "acc", "segment", "source", "target", "val", "sourceIsObject", "targetIsObject", "RequestQueue", "#current", "#queue", "strategy", "runRequest", "abortRequest", "Htmx", "#HCON", "#extMethods", "#approvedExt", "#registeredExt", "#internalAPI", "#Function", "#AsyncFunction", "#ttPolicy", "s", "#actionSelector", "#boostSelector", "#verbs", "#hxOnQuery", "#transitionQueue", "#historyAbort", "#historyInitialized", "#processingTransition", "#initHtmxConfig", "#initRequestIndicatorCss", "#prefixSelector", "#prefixes", "p", "#attributeValue", "#parseTriggerSpecs", "#determineMethodAndAction", "#createRequestContext", "#collectFormData", "#getAttributeObject", "#insertContent", "#morph", "#isSoftMatch", "ttPolicy", "syncFn", "asyncFn", "#onTrigger", "#htmxProp", "#trigger", "#executeJavaScript", "init", "metaConfig", "indicator", "request", "name", "extension", "#ignore", "elt", "#attr", "#attrName", "#queryEltAndDescendants", "selector", "results", "#normalizeSwapStyle", "style", "#findThisElements", "attrName", "defaultVal", "eltCollector", "allowInheritance", "#maybeAdjustMetaCharacter", "inherited", "append", "n1", "n2", "inheritSelector", "appendName", "appendValue", "parent", "parentVal", "#triggerExtensions", "spec", "rest", "evt", "method", "action", "verb", "verbAction", "#isBoosted", "#htmxState", "#initializeElement", "#shouldInitialize", "htmxProp", "#createHtmxEventHandler", "#initializeTriggers", "ctx", "#handleTriggerEvent", "e", "sourceElement", "sourceEvent", "fullAction", "anchor", "ac", "#createCoreHeaders", "#resolveTarget", "#buildIdentifier", "hxConfig", "headers", "#handleHxHeaders", "obj", "#findOrWarn", "#isModifierKeyClick", "#shouldCancel", "usesQueryParams", "form", "body", "valsResult", "k", "headersResult", "javascriptContent", "#extractJavascriptContent", "data", "url", "#issueRequest", "syncStrategy", "#determineSyncStrategy", "requestQueue", "#getRequestQueue", "#initializeAbortListener", "resolve", "detail", "js", "#initTimeout", "#showIndicators", "#disableElements", "response", "#extractHxHeaders", "#handleHeadersAndMaybeReturnEarly", "#handleStatusCodes", "error", "#handleTriggerHeader", "#hideIndicators", "#enableElements", "v", "path", "opts", "parsed", "timeout", "hxSync", "syncElt", "btn", "link", "href", "initialHandler", "trigger", "specString", "handler", "specs", "eventName", "filter", "#extractFilter", "fromElts", "#findAllExt", "inner", "values", "info", "timed", "evtArgs", "other", "observerOptions", "isRevealed", "entries", "i", "fromElt", "interval", "listenerInfo", "str", "triggers", "#apiMethods", "thisArg", "bound", "proto", "arg1", "arg2", "code", "expression", "isAsync", "compile", "args", "scope", "keys", "FunctionConstructor", "func", "root", "force", "#cleanup", "hxOnNodes", "iter", "node", "hxOnNode", "#handleHxOnAttributes", "#maybeBoost", "hxBoost", "#shouldBoost", "#isSameOrigin", "elts", "#handlePreservedElements", "fragment", "pantry", "newPreservedElts", "preservedElt", "currentElt", "#moveBefore", "#restorePreservedElements", "newElt", "#parseHTML", "resp", "trusted", "#makeFragment", "text", "title", "m", "startTag", "doc", "titleElt", "#processScripts", "#createOOBTask", "tasks", "oobValue", "targetSelector", "sel", "swapSpec", "#parseSwapSpec", "targets", "#processOOB", "selectOOB", "oobElt", "oobAttr", "#insertNodes", "before", "swapStr", "#processPartials", "templateElt", "type", "#setFocus", "options", "start", "end", "#handleAutoFocus", "autofocus", "#normalizeScrollTarget", "#handleScroll", "scrollTarget", "#findExt", "#handleAnchorScroll", "container", "scripts", "oldScript", "newScript", "attr", "event", "#restoreHistory", "oobTasks", "partialTasks", "hasPartials", "mainSwap", "#processMainSwap", "#handleHistoryUpdate", "swapPromises", "transitionTasks", "task", "tasksWrapper", "#submitTransitionTask", "selected", "cssTransition", "swapStyle", "keepBody", "#addClass", "focusInfo", "settleTasks", "settleDelay", "parentNode", "activeElt", "#startCSSTransitions", "newContent", "child", "#copyAttributes", "methods", "handled", "#removeClass", "focusOptions", "settleTask", "on", "bubbles", "prefix", "#normalizeElement", "fn", "time", "callback", "eventOrElt", "eventOrCallback", "selectorOrElt", "n", "u", "sourceElt", "#pushUrlIntoHistory", "#replaceUrlInHistory", "state", "historyElt", "#resolveHistoryAction", "push", "replace", "hx", "finalUrl", "historyDetail", "hxOnNames", "mc", "part", "idx", "hxIndicator", "indicatorElements", "hxDisable", "el", "disabledElements", "submitter", "validate", "isGet", "formData", "included", "#addInputValues", "hxInclude", "tag", "inputs", "input", "file", "option", "hxAttr", "#stringHyperscriptStyleSelector", "eltOrSelector", "maybeSelector", "thisAttr", "global", "parts", "unprocessedParts", "item", "#scanForwardQuery", "#scanBackwardsQuery", "standardSelector", "rootNode", "#getRootNode", "#scanUntilComparison", "comparison", "oldNode", "innerHTML", "persistentIds", "idMap", "#createIdMaps", "#morphChildren", "oldParent", "newParent", "insertionPoint", "endPoint", "newChild", "matchedNode", "#findBestMatch", "cursor", "tempNode", "#matchesUpcomingSibling", "#removeNode", "escapedId", "element", "idSet", "#morphNode", "nextNewChild", "placeholder", "oldElt", "startNode", "sibling", "startPoint", "softMatch", "displaceMatchCount", "scanLimit", "newSet", "nodeMatchCount", "oldSet", "id", "newNode", "after", "destination", "attributesToIgnore", "needsReinit", "isHxAttr", "#populateIdMapWithTree", "elements", "current", "oldIdElements", "newIdElements", "#createPersistentIds", "duplicateIds", "oldIdTagNameMap", "tagName", "status", "noSwapStrings", "x", "statusValue", "#processTransitionQueue", "cssAttrs", "idElements", "existingElementsById", "newElementsWithIds", "restoreTasks", "existing", "clone", "a", "cls", "cssOrElement", "htmx_esm_default", "addUniqueItem", "arr", "item", "removeItem", "index", "clamp", "min", "max", "v", "MotionGlobalConfig", "isNumericalString", "v", "isObject", "value", "isZeroValueString", "v", "memo", "callback", "result", "noop", "any", "pipe", "transformers", "a", "b", "v", "progress", "from", "to", "value", "range", "SubscriptionManager", "handler", "addUniqueItem", "removeItem", "a", "b", "c", "numSubscriptions", "secondsToMilliseconds", "seconds", "millisecondsToSeconds", "milliseconds", "velocityPerSecond", "velocity", "frameDuration", "wrap", "min", "max", "v", "rangeSize", "calcBezier", "t", "a1", "a2", "cubicBezier", "mX1", "mY1", "mX2", "mY2", "noop", "x", "lowerBound", "upperBound", "i", "currentX", "mirrorEasing", "easing", "p", "reverseEasing", "easing", "p", "backOut", "cubicBezier", "backIn", "reverseEasing", "backInOut", "mirrorEasing", "anticipate", "p", "backIn", "circIn", "p", "circOut", "reverseEasing", "circInOut", "mirrorEasing", "easeIn", "cubicBezier", "easeOut", "easeInOut", "isEasingArray", "ease", "getEasingForSegment", "easing", "i", "isEasingArray", "wrap", "isBezierDefinition", "easing", "easingLookup", "noop", "easeIn", "easeInOut", "easeOut", "circIn", "circInOut", "circOut", "backIn", "backInOut", "backOut", "anticipate", "isValidEasing", "easing", "easingDefinitionToFunction", "definition", "isBezierDefinition", "x1", "y1", "x2", "y2", "cubicBezier", "frameData", "now", "clearTime", "time", "frameData", "MotionGlobalConfig", "newTime", "sanitize", "v", "checkStringStartsWith", "token", "key", "startsAsVariableToken", "checkStringStartsWith", "isCSSVariableToken", "value", "singleCssVariableRegex", "containsCSSVariable", "number", "v", "alpha", "clamp", "scale", "floatRegex", "isNullish", "v", "singleColorRegex", "isColorString", "type", "testProp", "v", "singleColorRegex", "isNullish", "splitColor", "aName", "bName", "cName", "a", "b", "c", "alpha", "floatRegex", "clampRgbUnit", "v", "clamp", "rgbUnit", "number", "rgba", "isColorString", "splitColor", "red", "green", "blue", "alpha", "sanitize", "alphaType", "channel", "v", "i", "size", "c", "parseHex", "alpha", "hex", "isColorString", "rgba", "createUnitType", "unit", "v", "degrees", "percent", "px", "vh", "vw", "progressPercentage", "hsla", "isColorString", "splitColor", "hue", "saturation", "lightness", "alpha", "percent", "sanitize", "alphaType", "color", "v", "rgba", "hex", "hsla", "parsed", "colorRegex", "hasFloat", "floatRegex", "hasColor", "colorRegex", "test", "v", "NUMBER_TOKEN", "COLOR_TOKEN", "VAR_TOKEN", "VAR_FUNCTION_TOKEN", "SPLIT_TOKEN", "complexRegex", "hasComplexValues", "value", "asString", "analyseComplexValue", "originalValue", "values", "indexes", "types", "split", "parsedValue", "color", "parseComplexValue", "buildTransformer", "numSections", "output", "type", "sanitize", "createTransformer", "source", "convertNumbersToZero", "convertToZero", "splitBefore", "getAnimatableNone", "info", "i", "complex", "hueToRgb", "p", "q", "t", "hslaToRgba", "hue", "saturation", "lightness", "alpha", "red", "green", "blue", "mixImmediate", "a", "b", "p", "mixNumber", "from", "to", "progress", "mixLinearColor", "from", "to", "v", "fromExpo", "expo", "colorTypes", "hex", "rgba", "hsla", "getColorType", "type", "asRGBA", "color", "model", "hslaToRgba", "mixColor", "fromRGBA", "toRGBA", "mixImmediate", "blended", "mixNumber", "invisibleValues", "mixVisibility", "origin", "target", "p", "mixNumber", "a", "b", "p", "mixNumberImmediate", "getMixer", "isCSSVariableToken", "mixImmediate", "color", "mixColor", "mixComplex", "mixArray", "mixObject", "output", "numValues", "blendValue", "v", "i", "key", "matchOrder", "origin", "target", "orderedOrigin", "pointers", "type", "originIndex", "originValue", "originStats", "analyseComplexValue", "targetStats", "invisibleValues", "mixVisibility", "pipe", "buildTransformer", "unitValue", "mixUnit", "from", "to", "a", "b", "unit", "origin", "target", "p", "sanitize", "mixNumberImmediate", "mix", "mixer", "getMixer", "stepsOrder", "createRenderStep", "runNextFrame", "thisFrame", "nextFrame", "isProcessing", "flushNextFrame", "running", "toKeepAlive", "latestFrameData", "triggerCallback", "callback", "step", "keepAlive", "immediate", "addToCurrentFrame", "queue", "frameData", "prevFrame", "maxElapsed", "createRenderBatcher", "scheduleNextBatch", "allowKeepAlive", "state", "runNextFrame", "useDefaultElapsed", "flagRunNextFrame", "steps", "stepsOrder", "acc", "key", "createRenderStep", "setup", "read", "resolveKeyframes", "preUpdate", "update", "preRender", "render", "postRender", "processBatch", "useManualTiming", "MotionGlobalConfig", "timestamp", "wake", "step", "process", "keepAlive", "immediate", "i", "frame", "cancelFrame", "frameSteps", "createRenderBatcher", "noop", "frameData", "frameloopDriver", "update", "passTimestamp", "timestamp", "keepAlive", "frame", "cancelFrame", "frameData", "time", "generateLinearEasing", "easing", "duration", "resolution", "points", "numPoints", "calcGeneratorDuration", "generator", "timeStep", "maxDuration", "keyframes", "duration", "state", "createGeneratorEasing", "options", "scale", "createGenerator", "k", "v", "delta", "generator", "duration", "calcGeneratorDuration", "progress", "millisecondsToSeconds", "defaultStiffness", "defaultDamping", "defaultMass", "defaultDuration", "defaultBounce", "defaultVisualDuration", "restSpeedGranular", "restSpeedDefault", "restDeltaGranular", "restDeltaDefault", "minDuration", "maxDuration", "minDamping", "bounceToDampingRatio", "bounce", "overdampedFreqScale", "dampingRatio", "criticalFreqTime", "root", "slow", "fast", "target", "approximateRoot", "freqTime", "calcAngularFreq", "undampedFreq", "rootIterations", "envelope", "derivative", "initialGuess", "result", "i", "safeMin", "findSpring", "duration", "clamp", "millisecondsToSeconds", "exponentialDecay", "delta", "b", "c", "e", "f", "g", "a", "criticalFreq", "stiffness", "secondsToMilliseconds", "isValidPhysics", "value", "canBeZero", "resolvePhysics", "getSpringOptions", "options", "validStiffness", "validDamping", "validMass", "springOptions", "springGenerator", "optionsOrVisualDuration", "origin", "state", "damping", "mass", "isResolvedFromDuration", "isTimeDefined", "inheritVelocity", "velocity", "undampedAngularFreq", "decay", "s", "setRestThresholds", "isGranularScale", "resolveSpring", "resolveVelocity", "update", "angularFreq", "sample", "t", "dampedAngularFreq", "limit", "decayAt", "rate", "P", "calculatedDuration", "generator", "keyframes", "newVelocity", "current", "currentVelocity", "easingDuration", "calcGeneratorDuration", "easing", "generateLinearEasing", "progress", "spring", "generatorOptions", "createGeneratorEasing", "inertia", "keyframes", "velocity", "power", "timeConstant", "bounceDamping", "bounceStiffness", "modifyTarget", "min", "max", "restDelta", "restSpeed", "origin", "state", "isOutOfBounds", "v", "nearestBoundary", "amplitude", "ideal", "target", "calcDelta", "t", "applyFriction", "delta", "timeReachedBoundary", "spring", "checkCatchBoundary", "createSpring", "hasUpdatedFrame", "createMixers", "output", "ease", "customMixer", "mixers", "mixerFactory", "MotionGlobalConfig", "mix", "numMixers", "i", "mixer", "easingFunction", "noop", "pipe", "interpolate", "input", "isClamp", "inputLength", "isZeroDeltaRange", "interpolator", "v", "progressInRange", "progress", "clamp", "fillOffset", "offset", "remaining", "min", "i", "offsetProgress", "progress", "mixNumber", "defaultOffset", "arr", "offset", "fillOffset", "convertOffsetToTimes", "offset", "duration", "o", "defaultEasing", "values", "easing", "easeInOut", "keyframes", "duration", "keyframeValues", "times", "ease", "transitionMixer", "customMixer", "easingFunctions", "isEasingArray", "easingDefinitionToFunction", "state", "span", "i", "offsets", "defaultOffset", "from", "to", "origin", "target", "mixer", "MotionGlobalConfig", "mix", "last", "t", "absoluteTimes", "convertOffsetToTimes", "mapTimeToKeyframe", "interpolate", "velocitySampleDuration", "getGeneratorVelocity", "resolveValue", "current", "prevT", "velocityPerSecond", "calcGeneratorVelocity", "generator", "initialVelocity", "s", "getFinalKeyframe", "keyframes", "repeat", "repeatType", "finalKeyframe", "speed", "first", "last", "numResolved", "i", "keyframe", "index", "transitionTypeMap", "inertia", "keyframes", "spring", "replaceTransitionType", "transition", "MAX_START_DELAY", "resolveStartTime", "startTime", "now", "MotionGlobalConfig", "baseRecord", "kind", "animation", "time", "frameData", "notifyAnimationStart", "options", "transition", "notify", "WithPromise", "resolve", "onResolve", "onReject", "percentToProgress", "percent", "round", "value", "JSAnimation", "WithPromise", "options", "motionValue", "time", "notifyAnimationStart", "replaceTransitionType", "type", "keyframesGenerator", "repeat", "repeatDelay", "repeatType", "velocity", "keyframes", "generatorFactory", "pipe", "mix", "generator", "calcGeneratorDuration", "calculatedDuration", "timestamp", "sample", "totalDuration", "delay", "onUpdate", "finalKeyframe", "resolveStartTime", "timeWithoutDelay", "isInDelayPhase", "state", "done", "isAnimationFinished", "inertia", "getFinalKeyframe", "resolved", "t", "currentTime", "mixKeyframes", "mirroredGenerator", "resolvedDuration", "elapsed", "frameGenerator", "progress", "currentIteration", "iterationProgress", "clamp", "millisecondsToSeconds", "newTime", "secondsToMilliseconds", "calcGeneratorVelocity", "newSpeed", "hasChanged", "driver", "frameloopDriver", "startTime", "now", "sampleTime", "timeline", "maxDefaults", "applyDefaultFilter", "v", "name", "value", "number", "floatRegex", "unit", "defaultValue", "functionRegex", "filter", "complex", "functions", "mask", "complex", "v", "parsed", "int", "number", "transformValueTypes", "degrees", "scale", "px", "alpha", "progressPercentage", "numberValueTypes", "px", "transformValueTypes", "int", "alpha", "defaultValueTypes", "numberValueTypes", "color", "filter", "mask", "getDefaultValueType", "key", "customTypes", "filter", "mask", "lastKey", "lastValue", "lastNone", "getAnimatableNone", "key", "value", "defaultValueType", "getDefaultValueType", "complex", "fillWildcards", "keyframes", "i", "radToDeg", "rad", "rotate", "v", "angle", "rebaseAngle", "matrix2dParsers", "rotateZ", "scaleX", "scaleY", "matrix3dParsers", "defaultTransformValue", "name", "parseValueFromTransform", "transform", "match", "valueParser", "values", "readTransformValue", "instance", "transformPropOrder", "transformProps", "isNumOrPxType", "v", "number", "px", "transformKeys", "nonTranslationalTransformKeys", "transformPropOrder", "key", "removeNonTranslationalTransform", "visualElement", "removedTransforms", "value", "current", "reset", "boxDependentValues", "measureDimension", "computed", "measureBox", "axis", "paddingStart", "paddingEnd", "boxSizing", "min", "max", "size", "transformX", "transform", "parseValueFromTransform", "transformY", "positionalValues", "width", "paddingLeft", "paddingRight", "height", "paddingTop", "paddingBottom", "top", "left", "y", "x", "toResolve", "isScheduled", "anyNeedsMeasurement", "isForced", "measureAllKeyframes", "resolversToMeasure", "elementsToMeasure", "elementsToUntransform", "resolver", "boxDependentValues", "transformsToRestore", "element", "removedTransforms", "removeNonTranslationalTransform", "restore", "key", "value", "readAllKeyframes", "flushKeyframeResolvers", "readOrigin", "name", "target", "isNumericalString", "isZeroValueString", "complex", "getAnimatableNone", "KeyframeResolver", "unresolvedKeyframes", "onComplete", "motionValue", "isAsync", "frame", "currentValue", "finalKeyframe", "valueAsRead", "fillWildcards", "isForcedComplete", "isCSSVar", "name", "setStyle", "element", "name", "value", "isCSSVar", "supportsFlags", "memoSupports", "callback", "supportsFlag", "memoized", "memo", "supportsFlags", "supportsScrollTimeline", "memoSupports", "supportsLinearEasing", "memoSupports", "cubicBezierAsString", "a", "b", "c", "d", "supportedWaapiEasing", "cubicBezierAsString", "mapEasingToNativeEasing", "easing", "duration", "supportsLinearEasing", "generateLinearEasing", "isBezierDefinition", "cubicBezierAsString", "segmentEasing", "supportedWaapiEasing", "startWaapiAnimation", "element", "valueName", "keyframes", "delay", "duration", "repeat", "repeatType", "ease", "times", "pseudoElement", "keyframeOptions", "easing", "mapEasingToNativeEasing", "options", "isGenerator", "type", "applyGeneratorOptions", "type", "options", "isGenerator", "supportsLinearEasing", "NativeAnimation", "WithPromise", "options", "element", "name", "keyframes", "pseudoElement", "allowFlatten", "finalKeyframe", "onComplete", "transition", "applyGeneratorOptions", "startWaapiAnimation", "keyframe", "getFinalKeyframe", "setStyle", "notifyAnimationStart", "duration", "millisecondsToSeconds", "delay", "newTime", "wasFinished", "secondsToMilliseconds", "newSpeed", "newStartTime", "timeline", "onAttach", "observe", "supportsScrollTimeline", "noop", "unsupportedEasingFunctions", "anticipate", "backInOut", "circInOut", "isUnsupportedEase", "key", "replaceStringEasing", "transition", "sampleDelta", "NativeAnimationExtended", "NativeAnimation", "options", "replaceStringEasing", "replaceTransitionType", "time", "sampleTime", "motionValue", "onUpdate", "onComplete", "onPlay", "onStop", "element", "JSAnimation", "state", "value", "name", "speed", "delta", "clamp", "current", "setStyle", "isAnimatable", "value", "name", "complex", "hasKeyframesChanged", "keyframes", "current", "i", "canAnimate", "name", "type", "velocity", "originKeyframe", "targetKeyframe", "isOriginAnimatable", "isAnimatable", "isTargetAnimatable", "isGenerator", "makeAnimationInstant", "options", "acceleratedValues", "browserColorFunctions", "hasBrowserOnlyColors", "keyframes", "i", "needsMixer", "mixer", "keyframes", "keyframe", "i", "colorProperties", "supportsWaapi", "MotionGlobalConfig", "supportsBrowserAnimation", "options", "motionValue", "name", "repeatDelay", "repeatType", "damping", "type", "keyframes", "acceleratedValues", "subject", "onUpdate", "transformTemplate", "hasBrowserOnlyColors", "needsMixer", "getValueAsType", "value", "type", "translateAlias", "numTransforms", "transformPropOrder", "openers", "transformFunction", "key", "value", "valueAsType", "getValueAsType", "transformValueTypes", "isDefaultTransform", "transformGroups", "maxSamples", "easingTolerance", "sampleTolerance", "scaleTolerance", "churnWindow", "buildAhead", "nativeEasings", "isNativeEasing", "ease", "traced", "trace", "samples", "last", "defaultOffset", "p", "round", "countSamples", "from", "to", "sampleDelta", "isNear", "a", "b", "byTime", "spread", "mixNumber", "getOwner", "options", "getGroup", "element", "transformGroups", "hasEnded", "state", "read", "owner", "key", "canGroupTransform", "name", "motionValue", "transformPropOrder", "supportsWaapi", "supportsLinearEasing", "canAccelerateTransform", "onUpdate", "transformTemplate", "needsMixer", "TransformDriver", "update", "makeDriver", "animation", "frameloopDriver", "frameData", "time", "keepAlive", "group", "setTime", "TransformAnimation", "JSAnimation", "driver", "canAccelerate", "firstDriver", "stop", "keyframes", "times", "startTime", "speed", "totalDuration", "delay", "repeatType", "type", "repeat", "span", "keyframesGenerator", "i", "isEasingArray", "offsets", "at", "easing", "isBezierDefinition", "cubicBezierAsString", "supportedWaapiEasing", "easingDefinitionToFunction", "resolvedDuration", "repeatDelay", "start", "result", "iterationStart", "offset", "t", "timestamp", "now", "value", "createGroup", "millisecondsToSeconds", "clamp", "newTime", "timeline", "builds", "buildSoon", "build", "queue", "tracks", "byKey", "statics", "keys", "built", "segments", "needsBuild", "isScheduled", "isEnded", "hasChurned", "lastChurn", "wake", "wakeAt", "buildAt", "has", "track", "valuesAt", "settled", "values", "toTransform", "isStyle", "transform", "isDefaultTransform", "transformFunction", "compose", "commit", "cancel", "shouldCommit", "create", "add", "end", "segment", "s", "jumpAt", "change", "x", "y", "size", "mid", "getEasing", "moving", "bounds", "quick", "first", "position", "progress", "shared", "progressAt", "changes", "range", "points", "point", "sample", "curved", "curveFrom", "curveTo", "tween", "trackEnd", "cycle", "isStraight", "split", "depth", "ends", "getTween", "run", "nativeEasing", "wakeIn", "animate", "cycleStart", "looping", "trackCycle", "isHeld", "phase", "retime", "isSeek", "elapsed", "rate", "builtTime", "builtSpeed", "wasHeld", "trackTime", "trackElapsed", "trackRate", "isDone", "local", "shouldBuild", "churned", "build_", "isChurn", "frame", "canReturn", "AsyncMotionValueAnimation", "WithPromise", "options", "time", "keyframes", "name", "motionValue", "element", "optionsWithDefaults", "KeyframeResolver", "DefaultKeyframeResolver", "resolvedKeyframes", "finalKeyframe", "forced", "sync", "type", "velocity", "delay", "isHandoff", "onUpdate", "canAnimateValue", "canAnimate", "MotionGlobalConfig", "getFinalKeyframe", "makeAnimationInstant", "onComplete", "useWaapi", "supportsBrowserAnimation", "isGroupedTransform", "canGroupTransform", "resolveStartTime", "animation", "NativeAnimationExtended", "JSAnimation", "TransformAnimation", "onResolve", "_onReject", "flushKeyframeResolvers", "newTime", "newSpeed", "timeline", "GroupAnimation", "animations", "animation", "propName", "timeline", "subscriptions", "cancel", "i", "time", "speed", "getMax", "max", "value", "GroupAnimationWithThen", "GroupAnimation", "onResolve", "_onReject", "MAX_VELOCITY_DELTA", "isFloat", "value", "collectMotionValues", "MotionValue", "init", "options", "v", "currentTime", "time", "dependent", "current", "prevFrameValue", "subscription", "eventName", "callback", "_a", "SubscriptionManager", "events", "frame", "eventManagers", "passiveEffect", "stopPassiveEffect", "prev", "delta", "endAnimation", "changeSubscriber", "sampled", "velocityPerSecond", "startAnimation", "resolve", "onComplete", "isComplete", "animation", "motionValue", "resolveTransition", "transition", "parentTransition", "_", "rest", "getValueTransition", "transition", "key", "valueTransition", "resolveTransition", "underDampedSpring", "criticallyDampedSpring", "target", "keyframesTransition", "ease", "getDefaultTransition", "valueKey", "keyframes", "transformProps", "orchestrationKeys", "isTransitionDefined", "transition", "key", "animateMotionValue", "name", "value", "target", "transition", "element", "isHandoff", "onComplete", "valueTransition", "getValueTransition", "delay", "elapsed", "secondsToMilliseconds", "options", "v", "isTransitionDefined", "getDefaultTransition", "shouldSkip", "makeAnimationInstant", "MotionGlobalConfig", "finalKeyframe", "getFinalKeyframe", "frame", "JSAnimation", "AsyncMotionValueAnimation", "splitCSSVariableRegex", "parseCSSVariable", "current", "match", "token1", "token2", "fallback", "getVariableValue", "current", "element", "depth", "token", "fallback", "parseCSSVariable", "resolved", "trimmed", "isNumericalString", "isCSSVariableToken", "positionalKeys", "transformPropOrder", "isMotionValue", "value", "auto", "v", "testValueType", "v", "type", "dimensionValueTypes", "number", "px", "percent", "degrees", "vw", "vh", "auto", "findDimensionValueType", "v", "testValueType", "isNone", "value", "isZeroValueString", "invalidTemplates", "makeNoneKeyframesAnimatable", "unresolvedKeyframes", "noneKeyframeIndexes", "name", "i", "animatableTemplate", "keyframe", "hasComplexValues", "noneIndex", "getAnimatableNone", "DOMKeyframesResolver", "KeyframeResolver", "unresolvedKeyframes", "onComplete", "name", "motionValue", "element", "origin", "containsCSSVariable", "i", "keyframe", "isCSSVariableToken", "resolved", "getVariableValue", "positionalKeys", "target", "originType", "findDimensionValueType", "targetType", "originHasVar", "targetHasVar", "positionalValues", "isNumOrPxType", "value", "noneKeyframeIndexes", "isNone", "makeNoneKeyframesAnimatable", "measureKeyframe", "finalKeyframeIndex", "finalKeyframe", "effects", "addEffect", "effect", "removeEffect", "removeItem", "findEffect", "subject", "animateValues", "getValue", "keyframes", "transition", "element", "animations", "velocity", "path", "reduceMotion", "key", "target", "value", "current", "frame", "animateMotionValue", "positionalKeys", "transitionEnd", "applyTransitionEnd", "animateEffectSubject", "created", "isBound", "initial", "firstKeyframe", "motionValue", "first", "isHTMLElement", "element", "isObject", "isSVGElement", "element", "isObject", "activeScope", "resolveElements", "elementOrSelector", "scope", "selectorCache", "root", "activeScope", "elements", "element", "MotionValueState", "step", "frame", "pending", "numPending", "i", "name", "value", "render", "computed", "entry", "onChange", "cancelOnChange", "onRemove", "values", "createEffect", "addValue", "step", "options", "stateCache", "subject", "values", "state", "MotionValueState", "subscriptions", "key", "value", "remove", "cancel", "buildTransform", "state", "transform", "keys", "values", "key", "value", "isDefaultTransform", "transformFunction", "pathRotation", "originProps", "styleValue", "state", "key", "getValueAsType", "numberValueTypes", "addStyleValue", "element", "value", "render", "computed", "transformProps", "keys", "b", "transformPropOrder", "isHTMLElement", "MotionValue", "transformGroups", "buildTransform", "originX", "originY", "originZ", "isCSSVar", "isStyleSubject", "subject", "isSVGElement", "readStyleValue", "readTransformValue", "computedStyle", "styleSubjectEffect", "createEffect", "camelToDash", "str", "match", "cssStyleProperties", "canSetAsProperty", "element", "name", "descriptor", "addAttrValue", "state", "key", "value", "isProp", "camelToDash", "type", "numberValueTypes", "render", "getValueAsType", "v", "addSVGPathValue", "element", "state", "key", "value", "frame", "offset", "MotionValue", "pathLength", "pathSpacing", "addSVGValue", "transformProps", "addAttrValue", "convertAttrKey", "d", "originProps", "isCSSVar", "addStyleValue", "readSVGValue", "numberValueTypes", "cssStyleProperties", "readStyleValue", "camelToDash", "svgSubjectEffect", "createEffect", "isSVGElement", "convertAttrKey", "key", "_", "firstChar", "convertBoundingBoxToBox", "top", "left", "right", "bottom", "transformBoxPoints", "point", "transformPoint", "topLeft", "bottomRight", "measureViewportBox", "instance", "transformPoint", "convertBoundingBoxToBox", "transformBoxPoints", "noProps", "getElementEffect", "element", "isSVGElement", "svgSubjectEffect", "styleSubjectEffect", "EffectSubject", "effect", "current", "DOMKeyframesResolver", "key", "target", "measureViewportBox", "animateElement", "keyframes", "transition", "visualElement", "activeScope", "animateValues", "animateEffectSubject", "propEffect", "createEffect", "subject", "state", "key", "value", "isObject", "animateSingleValue", "value", "keyframes", "options", "motionValue", "isMotionValue", "createMotionValue", "animateMotionValue", "visualElementStore", "isDOMKeyframes", "keyframes", "resolveSubjects", "subject", "keyframes", "scope", "selectorCache", "isDOMKeyframes", "resolveElements", "s", "calculateRepeatDuration", "duration", "repeat", "repeatDelay", "calcLabelTime", "position", "labels", "name", "offset", "calcNextTime", "current", "next", "prev", "eraseKeyframes", "sequence", "startTime", "endTime", "i", "keyframe", "removeItem", "addKeyframes", "keyframes", "easing", "offset", "mixNumber", "getEasingForSegment", "normalizeTimes", "times", "repeat", "repeatDelayUnits", "totalUnits", "i", "compareByTime", "a", "b", "defaultSegmentEasing", "MAX_REPEAT", "createAnimationsFromSequence", "sequence", "defaultTransition", "sequenceTransition", "scope", "generators", "info", "defaultDuration", "animationDefinitions", "sequences", "elementCache", "timeLabels", "prevTime", "currentTime", "totalDuration", "resolveSequence", "base", "sequenceEnd", "resolveTime", "at", "calcNextTime", "i", "segment", "start", "subject", "keyframes", "transition", "maxDuration", "resolveValueSequence", "valueKeyframes", "valueTransition", "valueSequence", "elementIndex", "numSubjects", "valueKeyframesAsList", "keyframesAsList", "delay", "times", "defaultOffset", "type", "repeat", "repeatType", "repeatDelay", "remainingTransition", "ease", "duration", "calculatedDelay", "numKeyframes", "createGenerator", "isGenerator", "absoluteDelta", "isNumberKeyframesArray", "delta", "springTransition", "secondsToMilliseconds", "springEasing", "createGeneratorEasing", "startTime", "remainder", "fillOffset", "repeatDelayUnits", "calculateRepeatDuration", "originalKeyframes", "originalTimes", "originalEase", "isFlipping", "flippedKeyframes", "flippedEases", "e", "reverseEasing", "repeatIndex", "isFlipped", "iterKeyframes", "iterEase", "iterStartOffset", "keyframeIndex", "getEasingForSegment", "normalizeTimes", "targetTime", "addKeyframes", "isMotionValue", "subjectSequence", "getSubjectSequence", "getValueSequence", "subjects", "resolveSubjects", "subjectIndex", "thisSubject", "key", "getValueTransition", "_type", "remainingDefaultTransition", "valueSequences", "element", "compareByTime", "valueOffset", "valueEasing", "value", "easing", "progress", "definition", "name", "isNumber", "keyframe", "isSingleValue", "subject", "keyframes", "isMotionValue", "isDOMKeyframes", "animateSubject", "options", "scope", "animations", "animateSingleValue", "subjects", "resolveSubjects", "numSubjects", "i", "thisSubject", "transition", "animateElement", "visualElementStore", "animateEffectSubject", "findEffect", "propEffect", "animateSequence", "sequence", "options", "scope", "info", "animations", "processedSequence", "segment", "callback", "mv", "motionValue", "animationDefinitions", "createAnimationsFromSequence", "spring", "reduceMotion", "keyframes", "transition", "subject", "animateSubject", "markerId", "inRepeat", "repeat", "repeatDelay", "repeatType", "delay", "duration", "time", "index", "cycle", "isSplit", "t", "withAt", "segment", "at", "copy", "i", "label", "name", "rewind", "animation", "Timeline", "_Timeline", "items", "options", "animations", "activeScope", "item", "GroupAnimationWithThen", "callback", "entry", "position", "stopAt", "target", "speed", "progress", "timeline", "onResolve", "onReject", "parent", "prevDuration", "prev", "defaultTransition", "onComplete", "onUpdate", "onRepeat", "onReverseComplete", "autoplay", "scope", "playback", "markers", "info", "prevScope", "animateSequence", "labels", "scale", "marker", "a", "b", "clock", "motionValue", "animateSingleValue", "group", "calcLabelTime", "prevTime", "repeatIndex", "step", "isForward", "edge", "from", "to", "crossed", "resolve", "remove", "removeItem", "isSequence", "value", "item", "createScopedAnimate", "options", "scope", "reduceMotion", "skipAnimations", "scopedAnimate", "subjectOrSequence", "optionsOrKeyframes", "scopeTransition", "activeScope", "inherited", "timeline", "sequenceOptions", "Timeline", "onComplete", "rest", "transition", "onUpdate", "segment", "animateSubject", "animate", "addEffect", "removeEffect", "DB_NAME", "STORE", "listeners", "flushing", "openDb", "resolve", "reject", "req", "tx", "mode", "fn", "db", "t", "store", "result", "changed", "onQueueChange", "enqueue", "item", "s", "queueItems", "a", "b", "queueCount", "remove", "key", "csrf", "m", "send", "body", "name", "value", "filename", "flushQueue", "sent", "rejected", "res", "redirect", "loadBitmap", "file", "resolve", "reject", "img", "checkPhoto", "bmp", "w", "h", "scale", "cw", "ch", "ctx", "data", "grey", "sum", "clipped", "i", "p", "g", "lapSum", "lapSq", "n", "y", "x", "lap", "variance", "preparePhoto", "canvas", "reduceMotion", "SLOW_AFTER_MS", "slowTimer", "trickleTimer", "bar", "progress", "el", "width", "setBusy", "button", "on", "buzz", "submitterOf", "e", "reset", "f", "initFeedback", "form", "a", "url", "tabs", "t", "EXAMPLE", "digitsOf", "value", "digits", "spaced", "status", "n", "init", "input", "line", "original", "render", "text", "kind", "atEnd", "v", "lead", "initPhoneInputs", "root", "htmx_esm_default", "csrfToken", "m", "evt", "ctx", "reveal", "root", "reduceMotion", "el", "i", "animate", "initCharts", "initPhotoForms", "initPhoneInputs", "toast", "message", "kind", "host", "e", "cssVar", "name", "canvases", "Chart", "canvas", "spec", "palette", "text", "d", "c", "form", "input", "preview", "submit", "prepared", "setMessage", "file", "check", "checkPhoto", "preparePhoto", "setBusy", "progress", "key", "fields", "enqueue", "result", "flushQueue", "sent", "r", "failed", "errorText", "button", "renderQueueBadge", "n", "queueCount", "label", "onQueueChange", "initFeedback", "boot"]
}
