{"version":3,"file":"waapi.mjs","sources":["../../../../../src/animation/waapi/supports/waapi.ts"],"sourcesContent":["import { memo } from \"motion-utils\"\nimport {\n AnyResolvedKeyframe,\n ValueAnimationOptionsWithRenderContext,\n} from \"../../types\"\n\n/**\n * A list of values that can be hardware-accelerated.\n */\nconst acceleratedValues = new Set([\n \"opacity\",\n \"clipPath\",\n \"filter\",\n \"transform\",\n // TODO: Could be re-enabled now we have support for linear() easing\n // \"background-color\"\n])\n\nconst supportsWaapi = /*@__PURE__*/ memo(() =>\n Object.hasOwnProperty.call(Element.prototype, \"animate\")\n)\n\nexport function supportsBrowserAnimation(\n options: ValueAnimationOptionsWithRenderContext\n) {\n const { motionValue, name, repeatDelay, repeatType, damping, type } =\n options\n\n const subject = motionValue?.owner?.current\n\n /**\n * We use this check instead of isHTMLElement() because we explicitly\n * **don't** want elements in different timing contexts (i.e. popups)\n * to be accelerated, as it's not possible to sync these animations\n * properly with those driven from the main window frameloop.\n */\n if (!(subject instanceof HTMLElement)) {\n return false\n }\n\n const { onUpdate, transformTemplate } = motionValue!.owner!.getProps()\n\n return (\n supportsWaapi() &&\n name &&\n acceleratedValues.has(name) &&\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 )\n}\n"],"names":[],"mappings":";;AAMA;;AAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAS;IACtC,SAAS;IACT,UAAU;IACV,QAAQ;IACR,WAAW;;;AAGd,CAAA,CAAC,CAAA;AAEF,MAAM,aAAa,iBAAiB,IAAI,CAAC,MACrC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAC3D,CAAA;AAEK,SAAU,wBAAwB,CACpC,OAAkD,EAAA;AAElD,IAAA,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,GAC/D,OAAO,CAAA;AAEX,IAAA,MAAM,OAAO,GAAG,WAAW,EAAE,KAAK,EAAE,OAAO,CAAA;AAE3C;;;;;AAKG;AACH,IAAA,IAAI,EAAE,OAAO,YAAY,WAAW,CAAC,EAAE;AACnC,QAAA,OAAO,KAAK,CAAA;KACf;AAED,IAAA,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,GAAG,WAAY,CAAC,KAAM,CAAC,QAAQ,EAAE,CAAA;IAEtE,QACI,aAAa,EAAE;QACf,IAAI;AACJ,QAAA,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC;AAC3B,SAAC,IAAI,KAAK,WAAW,IAAI,CAAC,iBAAiB,CAAC;AAC5C;;;AAGG;AACH,QAAA,CAAC,QAAQ;AACT,QAAA,CAAC,WAAW;AACZ,QAAA,UAAU,KAAK,QAAQ;AACvB,QAAA,OAAO,KAAK,CAAC;QACb,IAAI,KAAK,SAAS,EACrB;AACL;;;;"}