{"version":3,"sources":["jsdelivr-header.js","/npm/jsdom-testing-mocks@1.16.0/src/index.ts","/npm/jsdom-testing-mocks@1.16.0/src/helper.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/size/DOMRect.ts","/npm/jsdom-testing-mocks@1.16.0/src/tools.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/intersection-observer.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/resize-observer.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/size/size.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/viewport.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/MediaQueryListEvent.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/css-typed-om/index.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/AnimationEffect.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/cssNumberishHelpers.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/KeyframeEffect.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/AnimationPlaybackEvent.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/AnimationTimeline.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/DocumentTimeline.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/easingFunctions.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/elementAnimations.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/Animation.ts","/npm/jsdom-testing-mocks@1.16.0/src/mocks/web-animations-api/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,m/DCNA,cAAA,GAAA,SAAA,cAAA,CAAA,UAAA,IAAA,UAAA,mBAAA,IAAA,mBAAA,oBAAA,IAAA,oBAAA,iBAAA,IAAA,iBAAA,iBAAA,IAAA,iBAAA,oBAAA,IAAA,oBAAA,qBAAA,IAAA,qBAA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ACvC,EAAwB,SAAS,UAAU,cAEjD,gBAEA,OAAO,iBAAiB,QAAQ,UAAW,CACzC,QAAS,CACP,UAAU,EACV,cAAc,EACd,MAAO,SAET,cAAe,CACb,UAAU,EACV,cAAc,EACd,MAAO,iBAIX,OAAO,eAAe,SAAS,UAAW,gBAAiB,CACzD,UAAU,EACV,cAAc,EACd,MAAO,mBAGT,QAAO,WAAU,KACf,iBAAgB,IAGlB,QAAO,UAAS,KACd,QAAQ,UAAU,QAAU,EAC5B,QAAQ,UAAU,cAAgB,EAClC,SAAS,UAAU,cAAgB,CAAA,GAEvC","file":"/npm/jsdom-testing-mocks@1.16.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/jsdom-testing-mocks@1.16.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export * from './mocks/intersection-observer';\nexport * from './mocks/resize-observer';\nexport * from './mocks/size';\nexport * from './mocks/viewport';\nexport * from './mocks/web-animations-api';\nexport * from './mocks/css-typed-om';\nexport * from './tools';\n","export class UndefinedHookError extends Error {\n  constructor(hook: string) {\n    let message = '';\n\n    // @ts-ignore\n    if (typeof global?.['vi'] !== 'undefined') {\n      message = `jsdom-testing-mocks: ${hook} is not defined. You can enable globals in your config or pass the hook manually to the configMocks function`;\n    } else {\n      message = `jsdom-testing-mocks: ${hook} is not defined. If you need to pass it manually, please use the configMocks function`;\n    }\n\n    super(message);\n  }\n}\n\nexport class WrongEnvironmentError extends Error {\n  constructor() {\n    super(\n      'jsdom-testing-mocks: window is not defined. Please use this library in a browser environment'\n    );\n  }\n}\n\nexport const isJsdomEnv = () => {\n  return typeof window !== 'undefined';\n};\n","import { isJsdomEnv, WrongEnvironmentError } from '../../helper';\n\nconst protectedProps = ['_x', '_y', '_width', '_height'];\n\nclass MockedDOMRectReadOnly implements DOMRectReadOnly {\n  _x: number;\n  _y: number;\n  _width: number;\n  _height: number;\n\n  constructor(x = 0, y = 0, width = 0, height = 0) {\n    this._x = x;\n    this._y = y;\n    this._width = width;\n    this._height = height;\n\n    // make protected props non-enumerable\n    protectedProps.forEach((prop) => {\n      const descriptor = Object.getOwnPropertyDescriptor(this, prop);\n\n      if (descriptor) {\n        Object.defineProperty(this, prop, {\n          ...descriptor,\n          enumerable: false,\n        });\n      }\n    });\n  }\n\n  get x() {\n    return this._x;\n  }\n\n  set x(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get y() {\n    return this._y;\n  }\n\n  set y(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get width() {\n    return this._width;\n  }\n\n  set width(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get height() {\n    return this._height;\n  }\n\n  set height(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get left() {\n    return this._x;\n  }\n\n  set left(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get right() {\n    return this._x + Math.max(0, this._width);\n  }\n\n  set right(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get top() {\n    return this._y;\n  }\n\n  set top(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  get bottom() {\n    return this._y + Math.max(0, this._height);\n  }\n\n  set bottom(_value: number) {\n    /* read-only – ignore writes to mimic native */\n  }\n\n  toJSON() {\n    return {\n      bottom: this.bottom,\n      height: this.height,\n      left: this.left,\n      right: this.right,\n      top: this.top,\n      width: this.width,\n      x: this.x,\n      y: this.y,\n    };\n  }\n\n  toString() {\n    return '[object DOMRectReadOnly]';\n  }\n}\n\nclass MockedDOMRect extends MockedDOMRectReadOnly implements DOMRect {\n  constructor(x = 0, y = 0, width = 0, height = 0) {\n    super(x, y, width, height);\n  }\n\n  get x() {\n    return super.x;\n  }\n\n  set x(_value: number) {\n    this._x = _value;\n  }\n\n  get y() {\n    return super.y;\n  }\n\n  set y(_value: number) {\n    this._y = _value;\n  }\n\n  get width() {\n    return super.width;\n  }\n\n  set width(_value: number) {\n    this._width = _value;\n  }\n\n  get height() {\n    return super.height;\n  }\n\n  set height(_value: number) {\n    this._height = _value;\n  }\n\n  toString() {\n    return '[object DOMRect]';\n  }\n}\n\nfunction mockDOMRect() {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n\n  // Always override to ensure consistent behaviour across environments\n  Object.defineProperty(window, 'DOMRectReadOnly', {\n    writable: true,\n    configurable: true,\n    value: MockedDOMRectReadOnly,\n  });\n\n  Object.defineProperty(window, 'DOMRect', {\n    writable: true,\n    configurable: true,\n    value: MockedDOMRect,\n  });\n}\n\nexport { MockedDOMRectReadOnly, MockedDOMRect, mockDOMRect };\n","import { UndefinedHookError } from './helper';\n\ntype JTMConfig = {\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  beforeAll: (callback: () => any) => void;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  afterAll: (callback: () => any) => void;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  beforeEach: (callback: () => any) => void;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  afterEach: (callback: () => any) => void;\n  act: (trigger: () => void) => void;\n};\n\nconst getThrowHookError = (hookName: string) => () => {\n  throw new UndefinedHookError(hookName);\n};\n\nconst config: JTMConfig = {\n  beforeAll:\n    typeof beforeAll !== 'undefined'\n      ? beforeAll\n      : getThrowHookError('beforeAll'),\n  afterAll:\n    typeof afterAll !== 'undefined' ? afterAll : getThrowHookError('afterAll'),\n  beforeEach:\n    typeof beforeEach !== 'undefined'\n      ? beforeEach\n      : getThrowHookError('beforeEach'),\n  afterEach:\n    typeof afterEach !== 'undefined'\n      ? afterEach\n      : getThrowHookError('afterEach'),\n  act: (trigger) => trigger(),\n};\n\nexport const getConfig = () => config;\nexport const configMocks = ({\n  beforeAll,\n  afterAll,\n  beforeEach,\n  afterEach,\n  act,\n}: Partial<JTMConfig>) => {\n  if (beforeAll) config.beforeAll = beforeAll;\n  if (afterAll) config.afterAll = afterAll;\n  if (beforeEach) config.beforeEach = beforeEach;\n  if (afterEach) config.afterEach = afterEach;\n  if (act) config.act = act;\n};\n","import { Writable, PartialDeep } from 'type-fest';\r\nimport { mockDOMRect } from './size/DOMRect';\r\nimport { getConfig } from '../tools';\r\nimport { isJsdomEnv, WrongEnvironmentError } from '../helper';\r\n\r\nconst config = getConfig();\r\n\r\nexport type IntersectionDescription = Omit<\r\n  PartialDeep<Writable<IntersectionObserverEntry>>,\r\n  'target'\r\n> & {\r\n  target?: Element;\r\n};\r\n\r\nexport type NodeIntersectionDescription = {\r\n  node: HTMLElement;\r\n  desc?: IntersectionDescription;\r\n};\r\n\r\ntype State = {\r\n  observers: MockedIntersectionObserver[];\r\n};\r\n\r\nconst defaultState: State = {\r\n  observers: [],\r\n};\r\n\r\nconst state = { ...defaultState };\r\n\r\nfunction isElement(tested: unknown): tested is HTMLElement {\r\n  return typeof HTMLElement === 'object'\r\n    ? tested instanceof HTMLElement // DOM2\r\n    : Boolean(tested) &&\r\n        typeof tested === 'object' &&\r\n        tested !== null &&\r\n        (tested as HTMLElement).nodeType === 1 &&\r\n        typeof (tested as HTMLElement).nodeName === 'string';\r\n}\r\n\r\nfunction getObserversByNode(node: HTMLElement) {\r\n  return state.observers.filter((observer) => observer.nodes.includes(node));\r\n}\r\n\r\nfunction normalizeNodeDescriptions(\r\n  nodeDescriptions: (NodeIntersectionDescription | HTMLElement)[]\r\n): NodeIntersectionDescription[] {\r\n  return nodeDescriptions.map((nodeDesc) => {\r\n    if (isElement(nodeDesc)) {\r\n      return { node: nodeDesc };\r\n    }\r\n\r\n    return nodeDesc;\r\n  });\r\n}\r\n\r\nfunction getNodeDescriptionsByObserver(\r\n  nodeDescriptions: NodeIntersectionDescription[]\r\n) {\r\n  const observerNodes: {\r\n    observer: MockedIntersectionObserver;\r\n    nodeDescriptions: NodeIntersectionDescription[];\r\n  }[] = [];\r\n\r\n  nodeDescriptions.forEach(({ node, desc }) => {\r\n    const observers = getObserversByNode(node);\r\n\r\n    observers.forEach((observer) => {\r\n      const observerNode = observerNodes.find(\r\n        ({ observer: obs }) => obs === observer\r\n      );\r\n\r\n      if (observerNode) {\r\n        observerNode.nodeDescriptions.push({ node, desc });\r\n      } else {\r\n        observerNodes.push({\r\n          observer,\r\n          nodeDescriptions: [{ node, desc }],\r\n        });\r\n      }\r\n    });\r\n  });\r\n\r\n  return observerNodes;\r\n}\r\n\r\nfunction findNodeIndex(nodes: HTMLElement[], node: HTMLElement) {\r\n  const index = nodes.findIndex((nodeInArray) => node.isSameNode(nodeInArray));\r\n\r\n  if (index === -1) {\r\n    throw new Error('IntersectionObserver mock: node not found');\r\n  }\r\n\r\n  return index;\r\n}\r\n\r\nexport class MockedIntersectionObserver implements IntersectionObserver {\r\n  nodes: HTMLElement[] = [];\r\n  nodeStates: IntersectionObserverEntry[] = [];\r\n  callback: IntersectionObserverCallback;\r\n  readonly root: Element | Document | null = null;\r\n  readonly rootMargin: string = '0px 0px 0px 0px';\r\n  readonly thresholds: ReadonlyArray<number> = [0];\r\n  timeOrigin = 0;\r\n\r\n  constructor(\r\n    callback: IntersectionObserverCallback,\r\n    options?: IntersectionObserverInit | undefined\r\n  ) {\r\n    this.callback = callback;\r\n\r\n    if (options) {\r\n      if (typeof options.root !== 'undefined') {\r\n        this.root = options.root;\r\n      }\r\n\r\n      if (typeof options.rootMargin !== 'undefined') {\r\n        this.rootMargin = options.rootMargin;\r\n      }\r\n\r\n      if (typeof options.threshold !== 'undefined') {\r\n        this.thresholds = Array.isArray(options.threshold)\r\n          ? options.threshold\r\n          : [options.threshold];\r\n      }\r\n    }\r\n\r\n    this.timeOrigin = performance.now();\r\n\r\n    state.observers.push(this);\r\n  }\r\n\r\n  observe(node: HTMLElement) {\r\n    this.nodes.push(node);\r\n    this.nodeStates.push({\r\n      isIntersecting: false,\r\n      target: node,\r\n      time: performance.now() - this.timeOrigin,\r\n      rootBounds: new DOMRectReadOnly(),\r\n      intersectionRect: new DOMRectReadOnly(),\r\n      intersectionRatio: 0,\r\n      boundingClientRect: new DOMRectReadOnly(),\r\n    });\r\n  }\r\n\r\n  unobserve(node: HTMLElement) {\r\n    const index = this.nodes.findIndex((value) => value.isSameNode(node));\r\n\r\n    this.nodes.splice(index, 1);\r\n    this.nodeStates.splice(index, 1);\r\n  }\r\n\r\n  disconnect() {\r\n    this.nodes = [];\r\n    this.nodeStates = [];\r\n  }\r\n\r\n  triggerNode(node: HTMLElement, desc: IntersectionDescription) {\r\n    const index = findNodeIndex(this.nodes, node);\r\n    const nodeState = this.nodeStates[index];\r\n\r\n    this.nodeStates[index] = {\r\n      ...nodeState,\r\n      time: performance.now() - this.timeOrigin,\r\n      target: node,\r\n      ...desc,\r\n    } as IntersectionObserverEntry;\r\n\r\n    this.callback([this.nodeStates[index]], this);\r\n  }\r\n\r\n  triggerNodes(nodeDescriptions: NodeIntersectionDescription[]) {\r\n    if (nodeDescriptions.length === 0) return;\r\n\r\n    const nodeIndexes = nodeDescriptions.map(({ node }) =>\r\n      findNodeIndex(this.nodes, node)\r\n    );\r\n\r\n    const nodeStates = nodeDescriptions.map(({ node, desc }, index) => {\r\n      const newState = {\r\n        ...this.nodeStates[nodeIndexes[index]],\r\n        time: performance.now() - this.timeOrigin,\r\n        target: node,\r\n        ...desc,\r\n      } as IntersectionObserverEntry;\r\n\r\n      this.nodeStates[nodeIndexes[index]] = newState;\r\n\r\n      return newState;\r\n    });\r\n\r\n    this.callback(nodeStates, this);\r\n  }\r\n\r\n  takeRecords(): IntersectionObserverEntry[] {\r\n    return [];\r\n  }\r\n}\r\n\r\nfunction mockIntersectionObserver() {\r\n  if (!isJsdomEnv()) {\r\n    throw new WrongEnvironmentError();\r\n  }\r\n\r\n  mockDOMRect();\r\n\r\n  const savedImplementation = window.IntersectionObserver;\r\n\r\n  Object.defineProperty(window, 'IntersectionObserver', {\r\n    writable: true,\r\n    configurable: true,\r\n    value: MockedIntersectionObserver,\r\n  });\r\n\r\n  config.afterAll(() => {\r\n    window.IntersectionObserver = savedImplementation;\r\n  });\r\n\r\n  return {\r\n    enterAll: (desc?: IntersectionDescription) => {\r\n      config.act(() => {\r\n        state.observers.forEach((observer) => {\r\n          const nodeDescriptions = observer.nodes.map((node) => ({\r\n            node,\r\n            desc: {\r\n              intersectionRatio: 1,\r\n              ...desc,\r\n              isIntersecting: true,\r\n            },\r\n          }));\r\n\r\n          observer.triggerNodes(nodeDescriptions);\r\n        });\r\n      });\r\n    },\r\n    enterNode: (node: HTMLElement, desc?: IntersectionDescription) => {\r\n      const observers = getObserversByNode(node);\r\n\r\n      config.act(() => {\r\n        observers.forEach((observer) => {\r\n          observer.triggerNode(node, {\r\n            intersectionRatio: 1,\r\n            ...desc,\r\n            isIntersecting: true,\r\n          });\r\n        });\r\n      });\r\n    },\r\n    enterNodes: (\r\n      nodeDescriptions: (NodeIntersectionDescription | HTMLElement)[]\r\n    ) => {\r\n      const normalizedNodeDescriptions =\r\n        normalizeNodeDescriptions(nodeDescriptions);\r\n      const observerNodes = getNodeDescriptionsByObserver(\r\n        normalizedNodeDescriptions\r\n      );\r\n\r\n      config.act(() => {\r\n        observerNodes.forEach(({ observer, nodeDescriptions }) => {\r\n          observer.triggerNodes(\r\n            nodeDescriptions.map(({ node, desc }) => ({\r\n              node,\r\n              desc: { intersectionRatio: 1, ...desc, isIntersecting: true },\r\n            }))\r\n          );\r\n        });\r\n      });\r\n    },\r\n    leaveAll: (desc?: IntersectionDescription) => {\r\n      config.act(() => {\r\n        state.observers.forEach((observer) => {\r\n          const nodeDescriptions = observer.nodes.map((node) => ({\r\n            node,\r\n            desc: {\r\n              intersectionRatio: 0,\r\n              ...desc,\r\n              isIntersecting: false,\r\n            },\r\n          }));\r\n\r\n          observer.triggerNodes(nodeDescriptions);\r\n        });\r\n      });\r\n    },\r\n    leaveNode: (node: HTMLElement, desc?: IntersectionDescription) => {\r\n      const observers = getObserversByNode(node);\r\n\r\n      config.act(() => {\r\n        observers.forEach((observer) => {\r\n          observer.triggerNode(node, {\r\n            intersectionRatio: 0,\r\n            ...desc,\r\n            isIntersecting: false,\r\n          });\r\n        });\r\n      });\r\n    },\r\n    triggerNodes: (\r\n      nodeDescriptions: (NodeIntersectionDescription | HTMLElement)[]\r\n    ) => {\r\n      const normalizedNodeDescriptions =\r\n        normalizeNodeDescriptions(nodeDescriptions);\r\n\r\n      const observerNodes = getNodeDescriptionsByObserver(\r\n        normalizedNodeDescriptions\r\n      );\r\n\r\n      config.act(() => {\r\n        observerNodes.forEach(({ observer, nodeDescriptions }) => {\r\n          observer.triggerNodes(nodeDescriptions);\r\n        });\r\n      });\r\n    },\r\n    leaveNodes: (\r\n      nodeDescriptions: (NodeIntersectionDescription | HTMLElement)[]\r\n    ) => {\r\n      const normalizedNodeDescriptions =\r\n        normalizeNodeDescriptions(nodeDescriptions);\r\n\r\n      const observerNodes = getNodeDescriptionsByObserver(\r\n        normalizedNodeDescriptions\r\n      );\r\n\r\n      config.act(() => {\r\n        observerNodes.forEach(({ observer, nodeDescriptions }) => {\r\n          observer.triggerNodes(\r\n            nodeDescriptions.map(({ node, desc }) => ({\r\n              node,\r\n              desc: { intersectionRatio: 0, ...desc, isIntersecting: false },\r\n            }))\r\n          );\r\n        });\r\n      });\r\n    },\r\n    cleanup: () => {\r\n      window.IntersectionObserver = savedImplementation;\r\n\r\n      state.observers = [];\r\n    },\r\n  };\r\n}\r\n\r\nexport { mockIntersectionObserver };\r\n","import { RequireAtLeastOne } from 'type-fest';\nimport { mockDOMRect } from './size/DOMRect';\nimport { isJsdomEnv, WrongEnvironmentError } from '../helper';\nimport { getConfig } from '../tools';\n\nconst config = getConfig();\n\ntype Sizes = {\n  borderBoxSize: ResizeObserverSize[];\n  contentBoxSize: ResizeObserverSize[];\n  contentRect: DOMRectReadOnly;\n};\n\ntype ResizeObserverSizeInput = RequireAtLeastOne<ResizeObserverSize>;\ntype SizeInput = {\n  borderBoxSize: ResizeObserverSizeInput[] | ResizeObserverSizeInput;\n  contentBoxSize: ResizeObserverSizeInput[] | ResizeObserverSizeInput;\n};\n\ntype Size = RequireAtLeastOne<SizeInput>;\n\ntype State = {\n  observers: MockedResizeObserver[];\n  targetObservers: Map<HTMLElement, MockedResizeObserver[]>;\n  elementSizes: Map<HTMLElement, Sizes>;\n};\n\nconst state: State = {\n  observers: [],\n  targetObservers: new Map(),\n  elementSizes: new Map(),\n};\n\nfunction resetState() {\n  state.observers = [];\n  state.targetObservers = new Map();\n  state.elementSizes = new Map();\n}\n\nfunction defineResizeObserverSize(\n  input: ResizeObserverSizeInput\n): ResizeObserverSize {\n  return {\n    blockSize: input.blockSize ?? 0,\n    inlineSize: input.inlineSize ?? 0,\n  };\n}\n\nclass MockedResizeObserver implements ResizeObserver {\n  callback: ResizeObserverCallback;\n  observationTargets = new Set<HTMLElement>();\n  activeTargets = new Set<HTMLElement>();\n\n  constructor(callback: ResizeObserverCallback) {\n    this.callback = callback;\n    state.observers.push(this);\n  }\n\n  observe = (node: HTMLElement) => {\n    this.observationTargets.add(node);\n    this.activeTargets.add(node);\n\n    if (state.targetObservers.has(node)) {\n      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n      state.targetObservers.get(node)!.push(this);\n    } else {\n      state.targetObservers.set(node, [this]);\n    }\n  };\n\n  unobserve = (node: HTMLElement) => {\n    this.observationTargets.delete(node);\n\n    const targetObservers = state.targetObservers.get(node);\n\n    if (targetObservers) {\n      const index = targetObservers.findIndex((mro) => mro === this);\n\n      targetObservers.splice(index, 1);\n\n      if (targetObservers.length === 0) {\n        state.targetObservers.delete(node);\n      }\n    }\n  };\n\n  disconnect = () => {\n    for (const node of this.observationTargets) {\n      const targetObservers = state.targetObservers.get(node);\n\n      if (targetObservers) {\n        const index = targetObservers.findIndex((mro) => mro === this);\n\n        targetObservers.splice(index, 1);\n\n        if (targetObservers.length === 0) {\n          state.targetObservers.delete(node);\n        }\n      }\n    }\n\n    this.observationTargets.clear();\n  };\n}\n\nfunction elementToEntry(element: HTMLElement): ResizeObserverEntry | null {\n  const boundingClientRect = element.getBoundingClientRect();\n  let sizes = state.elementSizes.get(element);\n\n  if (!sizes) {\n    sizes = {\n      borderBoxSize: [\n        {\n          blockSize: boundingClientRect.width,\n          inlineSize: boundingClientRect.height,\n        },\n      ],\n      contentBoxSize: [\n        {\n          blockSize: boundingClientRect.width,\n          inlineSize: boundingClientRect.height,\n        },\n      ],\n      contentRect: boundingClientRect,\n    };\n  }\n\n  if (sizes.contentRect.width === 0 && sizes.contentRect.height === 0) {\n    return null;\n  }\n\n  return {\n    borderBoxSize: Object.freeze(sizes.borderBoxSize),\n    contentBoxSize: Object.freeze(sizes.contentBoxSize),\n    contentRect: sizes.contentRect,\n    devicePixelContentBoxSize: Object.freeze(\n      sizes.contentBoxSize.map((size) => ({\n        blockSize: size.blockSize * window.devicePixelRatio,\n        inlineSize: size.inlineSize * window.devicePixelRatio,\n      }))\n    ),\n    target: element,\n  };\n}\n\nfunction mockResizeObserver() {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n\n  mockDOMRect();\n\n  const savedImplementation = window.ResizeObserver;\n\n  Object.defineProperty(window, 'ResizeObserver', {\n    writable: true,\n    configurable: true,\n    value: MockedResizeObserver,\n  });\n\n  config.afterEach(() => {\n    resetState();\n  });\n\n  config.afterAll(() => {\n    window.ResizeObserver = savedImplementation;\n  });\n\n  return {\n    getObservers: (element?: HTMLElement) => {\n      if (element) {\n        return [...(state.targetObservers.get(element) ?? [])];\n      }\n\n      return [...state.observers];\n    },\n    getObservedElements: (observer?: ResizeObserver) => {\n      if (observer) {\n        return [...(observer as MockedResizeObserver).observationTargets];\n      }\n\n      return [...state.targetObservers.keys()];\n    },\n    mockElementSize: (element: HTMLElement, size: Size) => {\n      let contentBoxSize: ResizeObserverSize[];\n      let borderBoxSize: ResizeObserverSize[];\n\n      if (!size.borderBoxSize && size.contentBoxSize) {\n        if (!Array.isArray(size.contentBoxSize)) {\n          size.contentBoxSize = [size.contentBoxSize];\n        }\n\n        contentBoxSize = size.contentBoxSize.map(defineResizeObserverSize);\n        borderBoxSize = contentBoxSize;\n      } else if (size.borderBoxSize && !size.contentBoxSize) {\n        if (!Array.isArray(size.borderBoxSize)) {\n          size.borderBoxSize = [size.borderBoxSize];\n        }\n\n        contentBoxSize = size.borderBoxSize.map(defineResizeObserverSize);\n        borderBoxSize = contentBoxSize;\n      } else if (size.borderBoxSize && size.contentBoxSize) {\n        if (!Array.isArray(size.borderBoxSize)) {\n          size.borderBoxSize = [size.borderBoxSize];\n        }\n\n        if (!Array.isArray(size.contentBoxSize)) {\n          size.contentBoxSize = [size.contentBoxSize];\n        }\n\n        contentBoxSize = size.contentBoxSize.map(defineResizeObserverSize);\n        borderBoxSize = size.borderBoxSize.map(defineResizeObserverSize);\n\n        if (borderBoxSize.length !== contentBoxSize.length) {\n          throw new Error(\n            'Both borderBoxSize and contentBoxSize must have the same amount of elements.'\n          );\n        }\n      } else {\n        throw new Error(\n          'Neither borderBoxSize nor contentBoxSize was provided.'\n        );\n      }\n\n      // verify contentBoxSize and borderBoxSize are not negative\n      contentBoxSize.forEach((size, index) => {\n        if (size.blockSize < 0) {\n          throw new Error(\n            `contentBoxSize[${index}].blockSize must not be negative.`\n          );\n        }\n\n        if (size.inlineSize < 0) {\n          throw new Error(\n            `contentBoxSize[${index}].inlineSize must not be negative.`\n          );\n        }\n      });\n\n      borderBoxSize.forEach((size, index) => {\n        if (size.blockSize < 0) {\n          throw new Error(\n            `borderBoxSize[${index}].blockSize must not be negative.`\n          );\n        }\n\n        if (size.inlineSize < 0) {\n          throw new Error(\n            `borderBoxSize[${index}].inlineSize must not be negative.`\n          );\n        }\n      });\n\n      const contentRect = new DOMRect(\n        0,\n        0,\n        contentBoxSize.reduce((acc, size) => acc + size.inlineSize, 0),\n        contentBoxSize.reduce((acc, size) => acc + size.blockSize, 0)\n      );\n\n      state.elementSizes.set(element, {\n        contentBoxSize,\n        borderBoxSize,\n        contentRect,\n      });\n    },\n    resize: (\n      elements: HTMLElement | HTMLElement[] = [],\n      { ignoreImplicit = false } = {}\n    ) => {\n      config.act(() => {\n        if (!Array.isArray(elements)) {\n          elements = [elements];\n        }\n\n        for (const observer of state.observers) {\n          const observedSubset = elements.filter((element) =>\n            observer.observationTargets.has(element)\n          );\n\n          const observedSubsetAndActive = new Set([\n            ...observedSubset,\n            ...(ignoreImplicit ? [] : observer.activeTargets),\n          ]);\n\n          observer.activeTargets.clear();\n\n          const entries = Array.from(observedSubsetAndActive)\n            .map(elementToEntry)\n            .filter(Boolean) as ResizeObserverEntry[];\n\n          if (entries.length > 0) {\n            observer.callback(entries, observer);\n          }\n        }\n      });\n    },\n  };\n}\n\nexport { mockResizeObserver };\n","import { mockDOMRect } from './DOMRect';\n\nexport const mockElementBoundingClientRect = (\n  element: HTMLElement,\n  {\n    x = 0,\n    y = 0,\n    width = 0,\n    height = 0,\n  }: Partial<Pick<DOMRect, 'x' | 'y' | 'width' | 'height'>>\n) => {\n  mockDOMRect();\n\n  const savedImplementation = element.getBoundingClientRect;\n\n  element.getBoundingClientRect = () =>\n    new DOMRectReadOnly(x, y, width, height);\n\n  return savedImplementation;\n};\n","import mediaQuery, { MediaValues } from 'css-mediaquery';\r\nimport { mockMediaQueryListEvent } from './MediaQueryListEvent';\r\nimport { getConfig } from '../tools';\r\nimport { isJsdomEnv, WrongEnvironmentError } from '../helper';\r\n\r\nconst config = getConfig();\r\n\r\n/**\r\n *  A tool that allows testing components that use js media queries (matchMedia)\r\n * `mockViewport` must be called before rendering the component\r\n *  @example using react testing library\r\n *\r\n *  const viewport = mockViewport({ width: '320px', height: '568px' })\r\n *\r\n *  const { getByText, queryByText } = render(<TestComponent />)\r\n *\r\n *  expect(getByText('Content visible only in the phone')).toBeInTheDocument()\r\n *  expect(queryByText('Content visible only on desktop')).not.toBeInTheDocument()\r\n *\r\n *  act(() => {\r\n *    viewport.set({ width: '1440px', height: '900px' })\r\n *  })\r\n *\r\n *  expect(queryByText('Content visible only on the phone')).not.toBeInTheDocument()\r\n *  expect(getByText('Content visible only on desktop')).toBeInTheDocument()\r\n *\r\n *  viewport.cleanup()\r\n *\r\n */\r\n\r\nexport type ViewportDescription = Partial<MediaValues>;\r\nexport type MockViewport = {\r\n  cleanup: () => void;\r\n  set: (newDesc: ViewportDescription) => void;\r\n};\r\n\r\ntype Listener = (this: MediaQueryList, ev: MediaQueryListEvent) => void;\r\ntype ListenerObject = {\r\n  handleEvent: (ev: MediaQueryListEvent) => void;\r\n};\r\ntype ListenerOrListenerObject = Listener | ListenerObject;\r\n\r\nfunction isEventListenerObject(\r\n  obj: ListenerOrListenerObject\r\n): obj is ListenerObject {\r\n  return (obj as ListenerObject).handleEvent !== undefined;\r\n}\r\n\r\nfunction mockViewport(desc: ViewportDescription): MockViewport {\r\n  if (!isJsdomEnv()) {\r\n    throw new WrongEnvironmentError();\r\n  }\r\n\r\n  mockMediaQueryListEvent();\r\n\r\n  const state: {\r\n    currentDesc: ViewportDescription;\r\n    oldListeners: {\r\n      listener: Listener;\r\n      list: MediaQueryList;\r\n      matches: boolean;\r\n    }[];\r\n    listeners: {\r\n      listener: ListenerOrListenerObject;\r\n      list: MediaQueryList;\r\n      matches: boolean;\r\n    }[];\r\n  } = {\r\n    currentDesc: desc,\r\n    oldListeners: [],\r\n    listeners: [],\r\n  };\r\n\r\n  const savedImplementation = window.matchMedia;\r\n\r\n  const addOldListener = (\r\n    list: MediaQueryList,\r\n    matches: boolean,\r\n    listener: Listener\r\n  ) => {\r\n    state.oldListeners.push({ listener, matches, list });\r\n  };\r\n\r\n  const removeOldListener = (listenerToRemove: Listener) => {\r\n    const index = state.oldListeners.findIndex(\r\n      ({ listener }) => listener === listenerToRemove\r\n    );\r\n\r\n    state.oldListeners.splice(index, 1);\r\n  };\r\n\r\n  const addListener = (\r\n    list: MediaQueryList,\r\n    matches: boolean,\r\n    listener: ListenerOrListenerObject\r\n  ) => {\r\n    state.listeners.push({ listener, matches, list });\r\n  };\r\n\r\n  const removeListener = (listenerToRemove: ListenerOrListenerObject) => {\r\n    const index = state.listeners.findIndex(\r\n      ({ listener }) => listener === listenerToRemove\r\n    );\r\n\r\n    state.listeners.splice(index, 1);\r\n  };\r\n\r\n  Object.defineProperty(window, 'matchMedia', {\r\n    writable: true,\r\n    value: (query: string): MediaQueryList => ({\r\n      get matches() {\r\n        return mediaQuery.match(query, state.currentDesc);\r\n      },\r\n      media: query,\r\n      onchange: null,\r\n      addListener: function (listener) {\r\n        if (listener) {\r\n          addOldListener(this, this.matches, listener);\r\n        }\r\n      }, // deprecated\r\n      removeListener: (listener) => {\r\n        if (listener) {\r\n          removeOldListener(listener);\r\n        }\r\n      }, // deprecated\r\n      addEventListener: function (\r\n        eventType: Parameters<MediaQueryList['addEventListener']>[0],\r\n        listener: Parameters<MediaQueryList['addEventListener']>[1]\r\n      ) {\r\n        if (eventType === 'change') {\r\n          addListener(this, this.matches, listener);\r\n        }\r\n      },\r\n      removeEventListener: (\r\n        eventType: Parameters<MediaQueryList['removeEventListener']>[0],\r\n        listener: Parameters<MediaQueryList['removeEventListener']>[1]\r\n      ) => {\r\n        if (eventType === 'change') {\r\n          if (isEventListenerObject(listener)) {\r\n            removeListener(listener.handleEvent);\r\n          } else {\r\n            removeListener(listener);\r\n          }\r\n        }\r\n      },\r\n      dispatchEvent: (event: Event) => {\r\n        if (event.type === 'change') {\r\n          state.listeners.forEach(({ listener, list }) => {\r\n            if (isEventListenerObject(listener)) {\r\n              listener.handleEvent(event as MediaQueryListEvent);\r\n            } else {\r\n              listener.call(list, event as MediaQueryListEvent);\r\n            }\r\n          });\r\n\r\n          state.oldListeners.forEach(({ listener, list }) => {\r\n            listener.call(list, event as MediaQueryListEvent);\r\n          });\r\n        }\r\n\r\n        return true;\r\n      },\r\n    }),\r\n  });\r\n\r\n  return {\r\n    cleanup: () => {\r\n      window.matchMedia = savedImplementation;\r\n    },\r\n    set: (newDesc: ViewportDescription) => {\r\n      config.act(() => {\r\n        state.currentDesc = newDesc;\r\n        state.listeners.forEach(\r\n          ({ listener, matches, list }, listenerIndex) => {\r\n            const newMatches = list.matches;\r\n\r\n            if (newMatches !== matches) {\r\n              const changeEvent = new MediaQueryListEvent('change', {\r\n                matches: newMatches,\r\n                media: list.media,\r\n              });\r\n\r\n              if (isEventListenerObject(listener)) {\r\n                listener.handleEvent(changeEvent);\r\n              } else {\r\n                listener.call(list, changeEvent);\r\n              }\r\n\r\n              state.listeners[listenerIndex].matches = newMatches;\r\n            }\r\n          }\r\n        );\r\n\r\n        state.oldListeners.forEach(\r\n          ({ listener, matches, list }, listenerIndex) => {\r\n            const newMatches = list.matches;\r\n\r\n            if (newMatches !== matches) {\r\n              const changeEvent = new MediaQueryListEvent('change', {\r\n                matches: newMatches,\r\n                media: list.media,\r\n              });\r\n\r\n              listener.call(list, changeEvent);\r\n\r\n              state.oldListeners[listenerIndex].matches = newMatches;\r\n            }\r\n          }\r\n        );\r\n      });\r\n    },\r\n  };\r\n}\r\n\r\nfunction mockViewportForTestGroup(desc: ViewportDescription) {\r\n  let viewport: MockViewport;\r\n\r\n  config.beforeAll(() => {\r\n    viewport = mockViewport(desc);\r\n  });\r\n\r\n  config.afterAll(() => {\r\n    viewport.cleanup();\r\n  });\r\n}\r\n\r\nexport { mockViewport, mockViewportForTestGroup };\r\n","import { isJsdomEnv, WrongEnvironmentError } from '../helper';\n\nclass MockedMediaQueryListEvent extends Event implements MediaQueryListEvent {\n  readonly matches: boolean;\n  readonly media: string;\n\n  constructor(type: 'change', eventInitDict: MediaQueryListEventInit = {}) {\n    super(type);\n\n    this.media = eventInitDict.media ?? '';\n    this.matches = eventInitDict.matches ?? false;\n  }\n}\n\nfunction mockMediaQueryListEvent() {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n\n  if (typeof MediaQueryListEvent === 'undefined') {\n    Object.defineProperty(window, 'MediaQueryListEvent', {\n      writable: true,\n      configurable: true,\n      value: MockedMediaQueryListEvent,\n    });\n  }\n}\n\nexport { MockedMediaQueryListEvent, mockMediaQueryListEvent };\n","import { isJsdomEnv, WrongEnvironmentError } from '../../helper';\n\n/**\n * CSS Typed OM Implementation\n * \n * A comprehensive polyfill for CSS Typed Object Model Level 1\n * Based on the W3C specification: https://www.w3.org/TR/css-typed-om-1/\n * \n * This implementation includes:\n * - CSSNumericValue (base class)\n * - CSSUnitValue (single unit values)\n * - CSSMathValue and subclasses (math expressions)\n * - Unit conversion and type checking\n * - Full arithmetic operations\n */\n\n// ============================================================================\n// Types and Constants\n// ============================================================================\n\n/**\n * CSS numeric base types as defined in the specification\n */\ntype CSSNumericBaseType = 'length' | 'angle' | 'time' | 'frequency' | 'resolution' | 'flex' | 'percent';\n\n/**\n * CSS math operators\n */\ntype CSSMathOperator = 'sum' | 'product' | 'negate' | 'invert' | 'min' | 'max' | 'clamp';\n\n/**\n * CSS numeric type representing the dimensional analysis of a value\n */\ninterface CSSNumericType {\n  length: number;\n  angle: number;\n  time: number;\n  frequency: number;\n  resolution: number;\n  flex: number;\n  percent: number;\n  percentHint?: CSSNumericBaseType;\n}\n\n/**\n * Unit conversion table for compatible units\n */\nconst UNIT_CONVERSIONS: Record<string, { canonical: string; factor: number }> = {\n  // Length units (canonical: px)\n  'px': { canonical: 'px', factor: 1 },\n  'in': { canonical: 'px', factor: 96 },\n  'cm': { canonical: 'px', factor: 96 / 2.54 },\n  'mm': { canonical: 'px', factor: 96 / 25.4 },\n  'pt': { canonical: 'px', factor: 96 / 72 },\n  'pc': { canonical: 'px', factor: 96 / 6 },\n  'Q': { canonical: 'px', factor: 96 / 101.6 },\n  \n  // Angle units (canonical: deg)\n  'deg': { canonical: 'deg', factor: 1 },\n  'rad': { canonical: 'deg', factor: 180 / Math.PI },\n  'grad': { canonical: 'deg', factor: 0.9 },\n  'turn': { canonical: 'deg', factor: 360 },\n  \n  // Time units (canonical: ms)\n  'ms': { canonical: 'ms', factor: 1 },\n  's': { canonical: 'ms', factor: 1000 },\n  \n  // Frequency units (canonical: Hz)\n  'Hz': { canonical: 'Hz', factor: 1 },\n  'kHz': { canonical: 'Hz', factor: 1000 },\n  \n  // Resolution units (canonical: dppx)\n  'dppx': { canonical: 'dppx', factor: 1 },\n  'dpi': { canonical: 'dppx', factor: 1 / 96 },\n  'dpcm': { canonical: 'dppx', factor: 2.54 / 96 },\n};\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\n/**\n * Gets the base type for a given unit\n */\nfunction getBaseType(unit: string): CSSNumericBaseType | null {\n  if (unit === 'number') return null;\n  if (unit === 'percent') return 'percent';\n  \n  // Length units - comprehensive list\n  const lengthUnits = [\n    // Absolute\n    'px', 'in', 'cm', 'mm', 'pt', 'pc', 'Q',\n    // Font-relative\n    'em', 'rem', 'ex', 'ch', 'cap', 'ic', 'lh', 'rlh',\n    // Viewport-relative (original)\n    'vw', 'vh', 'vi', 'vb', 'vmin', 'vmax',\n    // Viewport-relative (small)\n    'svw', 'svh', 'svi', 'svb', 'svmin', 'svmax',\n    // Viewport-relative (large)\n    'lvw', 'lvh', 'lvi', 'lvb', 'lvmin', 'lvmax',\n    // Viewport-relative (dynamic)\n    'dvw', 'dvh', 'dvi', 'dvb', 'dvmin', 'dvmax',\n    // Container query\n    'cqw', 'cqh', 'cqi', 'cqb', 'cqmin', 'cqmax'\n  ];\n  \n  if (lengthUnits.includes(unit)) return 'length';\n  if (['deg', 'rad', 'grad', 'turn'].includes(unit)) return 'angle';\n  if (['ms', 's'].includes(unit)) return 'time';\n  if (['Hz', 'kHz'].includes(unit)) return 'frequency';\n  if (['dppx', 'dpi', 'dpcm'].includes(unit)) return 'resolution';\n  if (unit === 'fr') return 'flex';\n  return null;\n}\n\n/**\n * Creates a CSS numeric type from a unit (sparse - only non-zero properties)\n */\nfunction createTypeFromUnit(unit: string): CSSNumericType {\n  const baseType = getBaseType(unit);\n  if (baseType && baseType !== 'percent') {\n    const result: Partial<CSSNumericType> = {};\n    result[baseType] = 1;\n    return result as CSSNumericType;\n  } else if (baseType === 'percent') {\n    return { percent: 1 } as CSSNumericType;\n  }\n  return {} as CSSNumericType; // Empty object for dimensionless numbers\n}\n\n/**\n * Adds two CSS numeric types\n */\nfunction addTypes(type1: CSSNumericType, type2: CSSNumericType): CSSNumericType | null {\n  // For addition, types must be compatible (same dimensions)\n  const result: CSSNumericType = { ...type1 };\n  \n  // Check if both are numbers (empty objects or all zeros)\n  const isType1Number = Object.keys(type1).length === 0 || Object.values(type1).every(v => v === 0 || v === undefined);\n  const isType2Number = Object.keys(type2).length === 0 || Object.values(type2).every(v => v === 0 || v === undefined);\n  \n  // Numbers can only be added to other numbers\n  if (isType1Number && isType2Number) {\n    return {} as CSSNumericType; // Return empty object for numbers\n  }\n  \n  // If one is number and other isn't, it's incompatible for addition\n  if (isType1Number || isType2Number) {\n    return null;\n  }\n  \n  // Check if types are compatible for addition (same dimensions)\n  const keys: Array<keyof CSSNumericType> = ['length', 'angle', 'time', 'frequency', 'resolution', 'flex', 'percent'];\n  for (const key of keys) {\n    if (key === 'percentHint') continue;\n    if ((type1[key] || 0) !== (type2[key] || 0)) {\n      return null;\n    }\n  }\n  \n  return result;\n}\n\n/**\n * Multiplies two CSS numeric types\n */\nfunction multiplyTypes(type1: CSSNumericType, type2: CSSNumericType): CSSNumericType {\n  const result: CSSNumericType = {\n    length: type1.length + type2.length,\n    angle: type1.angle + type2.angle,\n    time: type1.time + type2.time,\n    frequency: type1.frequency + type2.frequency,\n    resolution: type1.resolution + type2.resolution,\n    flex: type1.flex + type2.flex,\n    percent: type1.percent + type2.percent\n  };\n  \n  return result;\n}\n\n/**\n * Converts a unit to its canonical form if possible\n */\nfunction convertUnit(value: number, fromUnit: string, toUnit: string): number | null {\n  if (fromUnit === toUnit) return value;\n  \n  const fromConversion = UNIT_CONVERSIONS[fromUnit];\n  const toConversion = UNIT_CONVERSIONS[toUnit];\n  \n  if (!fromConversion || !toConversion) return null;\n  if (fromConversion.canonical !== toConversion.canonical) return null;\n  \n  // Convert: value * fromFactor / toFactor\n  const result = value * fromConversion.factor / toConversion.factor;\n  \n  // Round to match browser precision - use fewer decimal places to match browser behavior\n  return Math.round(result * 10000) / 10000;\n}\n\n/**\n * Gets the canonical unit for a given unit\n */\nfunction getCanonicalUnit(unit: string): string {\n  const conversion = UNIT_CONVERSIONS[unit];\n  return conversion ? conversion.canonical : unit;\n}\n\n/**\n * Converts a CSSNumberish value to a CSSNumericValue\n */\nfunction rectifyNumberish(value: CSSNumberish, allowDirectNumbers = false): MockedCSSNumericValue {\n  if (typeof value === 'number') {\n    if (allowDirectNumbers) {\n      return new MockedCSSUnitValue(value, 'number');\n    }\n    throw new TypeError('Numbers cannot be used directly in CSS Typed OM operations. Use CSS.number() to create a CSSNumericValue.');\n  }\n  if (value instanceof MockedCSSNumericValue) {\n    return value;\n  }\n  throw new TypeError('Invalid CSSNumberish value');\n}\n\n// ============================================================================\n// CSSNumericValue (Base Class)\n// ============================================================================\n\n/**\n * Base class for all CSS numeric values\n */\nabstract class MockedCSSNumericValue implements CSSNumericValue {\n  constructor() {\n    if (new.target === MockedCSSNumericValue) {\n      throw new TypeError('Cannot instantiate abstract class MockedCSSNumericValue directly');\n    }\n  }\n  /**\n   * Returns the type of this numeric value\n   */\n  abstract type(): CSSNumericType;\n\n  /**\n   * Adds one or more values to this value\n   */\n  add(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    // Check for raw numbers - they should throw\n    if (values.some(v => typeof v === 'number')) {\n      throw new TypeError('Cannot add numbers directly. Use CSS.number() instead.');\n    }\n    \n    const operands = [this, ...values.map(v => rectifyNumberish(v))];\n    \n    // Try to simplify if all are CSSUnitValue with same unit\n    if (operands.every(op => op instanceof MockedCSSUnitValue)) {\n      const unitValues = operands as MockedCSSUnitValue[];\n      const firstUnit = unitValues[0].unit;\n      if (unitValues.every(uv => uv.unit === firstUnit)) {\n        const sum = unitValues.reduce((acc, uv) => acc + uv.value, 0);\n        return new MockedCSSUnitValue(sum, firstUnit);\n      }\n    }\n    \n    // Special case: if all are numbers, simplify\n    if (operands.every(op => op instanceof MockedCSSUnitValue && op.unit === 'number')) {\n      const sum = operands.reduce((acc, op) => acc + (op as MockedCSSUnitValue).value, 0);\n      return new MockedCSSUnitValue(sum, 'number');\n    }\n    \n    // Check type compatibility\n    let resultType = this.type();\n    for (let i = 1; i < operands.length; i++) {\n      const opType = operands[i].type();\n      const addedType = addTypes(resultType, opType);\n      if (addedType === null) {\n        throw new TypeError('Incompatible types for addition');\n      }\n      resultType = addedType;\n    }\n    \n    return new MockedCSSMathSum(operands);\n  }\n\n  /**\n   * Subtracts one or more values from this value\n   */\n  sub(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    // Check for raw numbers - they should throw\n    if (values.some(v => typeof v === 'number')) {\n      throw new TypeError('Cannot subtract numbers directly. Use CSS.number() instead.');\n    }\n    \n    const negatedValues = values.map(v => {\n      const numeric = rectifyNumberish(v);\n      return numeric.negate();\n    });\n    return this.add(...negatedValues);\n  }\n\n  /**\n   * Multiplies this value by one or more values\n   */\n  mul(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    const operands = [this, ...values.map(v => rectifyNumberish(v, true))];\n    \n    // Try to simplify if all are numbers or one unit with numbers\n    if (operands.every(op => op instanceof MockedCSSUnitValue)) {\n      const unitValues = operands as MockedCSSUnitValue[];\n      const numbers = unitValues.filter(uv => uv.unit === 'number');\n      const nonNumbers = unitValues.filter(uv => uv.unit !== 'number');\n      \n      if (nonNumbers.length <= 1) {\n        const numberProduct = numbers.reduce((acc, uv) => acc * uv.value, 1);\n        if (nonNumbers.length === 0) {\n          return new MockedCSSUnitValue(numberProduct, 'number');\n        } else {\n          const singleUnit = nonNumbers[0];\n          return new MockedCSSUnitValue(numberProduct * singleUnit.value, singleUnit.unit);\n        }\n      }\n    }\n    \n    return new MockedCSSMathProduct(operands);\n  }\n\n  /**\n   * Divides this value by one or more values\n   */\n  div(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    const invertedValues = values.map(v => {\n      const numeric = rectifyNumberish(v, true);\n      if (numeric instanceof MockedCSSUnitValue && numeric.value === 0) {\n        throw new RangeError('Cannot divide by zero');\n      }\n      return numeric.invert();\n    });\n    return this.mul(...invertedValues);\n  }\n\n  /**\n   * Returns the minimum of this value and one or more other values\n   */\n  min(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    // Per CSS Typed OM spec, throw TypeError for raw numbers instead of returning null\n    // This follows the spec rather than quirky browser behavior, providing better type safety\n    if (values.some(v => typeof v === 'number')) {\n      throw new TypeError('Cannot use raw numbers in min(). Use CSS.number() instead.');\n    }\n    \n    const operands = [this, ...values.map(v => rectifyNumberish(v))];\n    \n    // Try to simplify if all are CSSUnitValue with same unit\n    if (operands.every(op => op instanceof MockedCSSUnitValue)) {\n      const unitValues = operands as MockedCSSUnitValue[];\n      const firstUnit = unitValues[0].unit;\n      if (unitValues.every(uv => uv.unit === firstUnit)) {\n        const minValue = Math.min(...unitValues.map(uv => uv.value));\n        return new MockedCSSUnitValue(minValue, firstUnit);\n      }\n    }\n    \n    return new MockedCSSMathMin(operands);\n  }\n\n  /**\n   * Returns the maximum of this value and one or more other values\n   */\n  max(...values: CSSNumberish[]): CSSNumericValue {\n    if (values.length === 0) return this;\n    \n    // Per CSS Typed OM spec, throw TypeError for raw numbers instead of returning null\n    // This follows the spec rather than quirky browser behavior, providing better type safety\n    if (values.some(v => typeof v === 'number')) {\n      throw new TypeError('Cannot use raw numbers in max(). Use CSS.number() instead.');\n    }\n    \n    const operands = [this, ...values.map(v => rectifyNumberish(v))];\n    \n    // Try to simplify if all are CSSUnitValue with same unit\n    if (operands.every(op => op instanceof MockedCSSUnitValue)) {\n      const unitValues = operands as MockedCSSUnitValue[];\n      const firstUnit = unitValues[0].unit;\n      if (unitValues.every(uv => uv.unit === firstUnit)) {\n        const maxValue = Math.max(...unitValues.map(uv => uv.value));\n        return new MockedCSSUnitValue(maxValue, firstUnit);\n      }\n    }\n    \n    return new MockedCSSMathMax(operands);\n  }\n\n  /**\n   * Checks if this value equals one or more other values\n   */\n  equals(...values: CSSNumberish[]): boolean {\n    for (const value of values) {\n      const numeric = rectifyNumberish(value);\n      if (!this.isEqualTo(numeric)) {\n        return false;\n      }\n    }\n    return true;\n  }\n\n  /**\n   * Converts this value to the specified unit\n   */\n  to(unit: string): CSSUnitValue {\n    if (!(this instanceof MockedCSSUnitValue)) {\n      throw new TypeError('Cannot convert complex values to a single unit');\n    }\n    \n    const converted = convertUnit(this.value, this.unit, unit);\n    if (converted === null) {\n      throw new TypeError(`Cannot convert from '${this.unit}' to '${unit}'`);\n    }\n    \n    return new MockedCSSUnitValue(converted, unit);\n  }\n\n  /**\n   * Converts this value to a sum of the specified units\n   */\n  toSum(...units: string[]): CSSMathSum {\n    // For simplicity, if no units specified, return this as a sum\n    if (units.length === 0) {\n      if (this instanceof MockedCSSMathSum) {\n        return this;\n      }\n      return new MockedCSSMathSum([this]);\n    }\n    \n    // If this is a simple unit value, try to convert to requested units\n    if (this instanceof MockedCSSUnitValue) {\n      const results: MockedCSSUnitValue[] = [];\n      const sourceUnit = this.unit;\n      let foundCompatible = false;\n      \n      for (const targetUnit of units) {\n        // Check if units are compatible\n        const converted = convertUnit(this.value, sourceUnit, targetUnit);\n        if (converted !== null && !foundCompatible) {\n          // Put all value in the first compatible unit\n          results.push(new MockedCSSUnitValue(converted, targetUnit));\n          foundCompatible = true;\n        } else {\n          // Incompatible unit or already used compatible unit, add zero\n          results.push(new MockedCSSUnitValue(0, targetUnit));\n        }\n      }\n      \n      if (!foundCompatible) {\n        throw new TypeError(`Cannot convert ${sourceUnit} to any of the specified units`);\n      }\n      \n      return new MockedCSSMathSum(results);\n    }\n    \n    // For complex values, try to simplify first\n    if (this instanceof MockedCSSMathSum) {\n      // Group values by compatible units\n      const groups = new Map<string, MockedCSSUnitValue[]>();\n      \n      for (const value of this.values) {\n        if (value instanceof MockedCSSUnitValue) {\n          const key = getCanonicalUnit(value.unit);\n          if (!groups.has(key)) {\n            groups.set(key, []);\n          }\n          groups.get(key)?.push(value);\n        }\n      }\n      \n      const results: MockedCSSUnitValue[] = [];\n      \n      for (const targetUnit of units) {\n        const canonicalUnit = getCanonicalUnit(targetUnit);\n        const compatibleValues = groups.get(canonicalUnit) || [];\n        \n        if (compatibleValues.length > 0) {\n          // Sum all compatible values and convert to target unit\n          let sum = 0;\n          for (const val of compatibleValues) {\n            const converted = convertUnit(val.value, val.unit, targetUnit);\n            if (converted !== null) {\n              sum += converted;\n            }\n          }\n          results.push(new MockedCSSUnitValue(sum, targetUnit));\n          groups.delete(canonicalUnit);\n        } else {\n          results.push(new MockedCSSUnitValue(0, targetUnit));\n        }\n      }\n      \n      // Check if any groups remain (incompatible units)\n      if (groups.size > 0) {\n        throw new TypeError('Some values cannot be converted to the specified units');\n      }\n      \n      return new MockedCSSMathSum(results);\n    }\n    \n    throw new TypeError('Cannot convert complex math expressions to sum');\n  }\n\n  /**\n   * Negates this value\n   */\n  negate(): CSSNumericValue {\n    if (this instanceof MockedCSSUnitValue) {\n      return new MockedCSSUnitValue(-this.value, this.unit);\n    }\n    return new MockedCSSMathNegate(this);\n  }\n\n  /**\n   * Inverts this value (1/value)\n   */\n  invert(): CSSNumericValue {\n    if (this instanceof MockedCSSUnitValue && this.unit === 'number') {\n      if (this.value === 0) {\n        throw new RangeError('Cannot invert zero');\n      }\n      return new MockedCSSUnitValue(1 / this.value, 'number');\n    }\n    return new MockedCSSMathInvert(this);\n  }\n\n  /**\n   * Checks if this value is equal to another\n   */\n  protected isEqualTo(other: MockedCSSNumericValue): boolean {\n    if (this.constructor !== other.constructor) {\n      return false;\n    }\n    \n    if (this instanceof MockedCSSUnitValue && other instanceof MockedCSSUnitValue) {\n      return this.value === other.value && this.unit === other.unit;\n    }\n    \n    // For math values, check structure\n    if (this instanceof MockedCSSMathSum && other instanceof MockedCSSMathSum) {\n      return this.values.length === other.values.length &&\n             this.values.every((v, i) => v.isEqualTo(other.values[i]));\n    }\n    \n    // Add more comparisons for other math types as needed\n    return false;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  static parse(_cssText: string): MockedCSSNumericValue {\n    throw new TypeError('CSS.parse is not available in browsers');\n  }\n}\n\n// ============================================================================\n// CSSUnitValue\n// ============================================================================\n\n/**\n * Represents a CSS value with a single numeric value and unit\n */\nclass MockedCSSUnitValue extends MockedCSSNumericValue implements CSSUnitValue {\n  constructor(public value: number, public unit: string) {\n    super();\n    \n    // Validate numeric value - throw for NaN, Infinity, -Infinity\n    if (typeof value !== 'number' || !isFinite(value)) {\n      throw new TypeError('Invalid numeric value');\n    }\n    \n    // Map % to percent\n    if (unit === '%') {\n      this.unit = 'percent';\n    }\n    \n    // Validate unit\n    if (this.unit !== 'number' && this.unit !== 'percent' && getBaseType(this.unit) === null) {\n      throw new TypeError(`Invalid unit: ${unit}`);\n    }\n  }\n\n  type(): CSSNumericType {\n    return createTypeFromUnit(this.unit);\n  }\n\n  toString(): string {\n    if (this.unit === 'number') {\n      return String(this.value);\n    }\n    \n    // Handle scientific notation for large numbers like browser\n    if (Math.abs(this.value) >= 1000000) {\n      const exp = this.value.toExponential();\n      // Pad exponent with zero to match browser format (e+06 instead of e+6)\n      const formatted = exp.replace(/e\\+(\\d)$/, 'e+0$1');\n      return `${formatted}${this.unit}`;\n    }\n    \n    return `${this.value}${this.unit}`;\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-unused-vars\n  static parse(_cssText: string): MockedCSSUnitValue {\n    // _cssText parameter required for interface compatibility\n    throw new TypeError('CSS.parse is not available in browsers');\n  }\n}\n\n// ============================================================================\n// CSSMathValue (Base for Math Operations)\n// ============================================================================\n\n/**\n * Base class for CSS math expressions\n */\nabstract class MockedCSSMathValue extends MockedCSSNumericValue implements CSSMathValue {\n  abstract get operator(): CSSMathOperator;\n  \n  toString(): string {\n    return `calc(${this.toCSSString()})`;\n  }\n  \n  protected abstract toCSSString(): string;\n}\n\n// ============================================================================\n// CSSMathSum\n// ============================================================================\n\n/**\n * Represents a CSS calc() sum expression\n */\nclass MockedCSSMathSum extends MockedCSSMathValue implements CSSMathSum {\n  readonly operator: CSSMathOperator = 'sum';\n  \n  constructor(public values: MockedCSSNumericValue[]) {\n    super();\n    if (values.length === 0) {\n      throw new SyntaxError('CSSMathSum requires at least one value');\n    }\n  }\n\n  type(): CSSNumericType {\n    let result = this.values[0].type();\n    for (let i = 1; i < this.values.length; i++) {\n      const addedType = addTypes(result, this.values[i].type());\n      if (addedType === null) {\n        throw new TypeError('Incompatible types in sum');\n      }\n      result = addedType;\n    }\n    return result;\n  }\n\n  protected toCSSString(): string {\n    return this.values.map((v, i) => {\n      const str = v.toString();\n      if (i > 0) {\n        if (str.startsWith('-')) {\n          return `+ ${str}`;\n        } else {\n          return `+ ${str}`;\n        }\n      }\n      return str;\n    }).join(' ');\n  }\n}\n\n// ============================================================================\n// CSSMathProduct\n// ============================================================================\n\n/**\n * Represents a CSS calc() product expression\n */\nclass MockedCSSMathProduct extends MockedCSSMathValue implements CSSMathProduct {\n  readonly operator: CSSMathOperator = 'product';\n  \n  constructor(public values: MockedCSSNumericValue[]) {\n    super();\n    if (values.length === 0) {\n      throw new SyntaxError('CSSMathProduct requires at least one value');\n    }\n  }\n\n  type(): CSSNumericType {\n    let result = this.values[0].type();\n    for (let i = 1; i < this.values.length; i++) {\n      result = multiplyTypes(result, this.values[i].type());\n    }\n    return result;\n  }\n\n  protected toCSSString(): string {\n    return this.values.map(v => v.toString()).join(' * ');\n  }\n}\n\n// ============================================================================\n// CSSMathNegate\n// ============================================================================\n\n/**\n * Represents a CSS calc() negation\n */\nclass MockedCSSMathNegate extends MockedCSSMathValue implements CSSMathNegate {\n  readonly operator: CSSMathOperator = 'negate';\n  \n  constructor(public value: MockedCSSNumericValue) {\n    super();\n  }\n\n  type(): CSSNumericType {\n    return this.value.type();\n  }\n\n  protected toCSSString(): string {\n    return `-${this.value.toString()}`;\n  }\n}\n\n// ============================================================================\n// CSSMathInvert\n// ============================================================================\n\n/**\n * Represents a CSS calc() inversion (1/value)\n */\nclass MockedCSSMathInvert extends MockedCSSMathValue implements CSSMathInvert {\n  readonly operator: CSSMathOperator = 'invert';\n  \n  constructor(public value: MockedCSSNumericValue) {\n    super();\n  }\n\n  type(): CSSNumericType {\n    const valueType = this.value.type();\n    const result: CSSNumericType = {\n      length: -valueType.length,\n      angle: -valueType.angle,\n      time: -valueType.time,\n      frequency: -valueType.frequency,\n      resolution: -valueType.resolution,\n      flex: -valueType.flex,\n      percent: -valueType.percent\n    };\n    return result;\n  }\n\n  protected toCSSString(): string {\n    return `1 / ${this.value.toString()}`;\n  }\n}\n\n// ============================================================================\n// CSSMathMin\n// ============================================================================\n\n/**\n * Represents a CSS min() expression\n */\nclass MockedCSSMathMin extends MockedCSSMathValue implements CSSMathMin {\n  readonly operator: CSSMathOperator = 'min';\n  \n  constructor(public values: MockedCSSNumericValue[]) {\n    super();\n    if (values.length === 0) {\n      throw new SyntaxError('CSSMathMin requires at least one value');\n    }\n  }\n\n  type(): CSSNumericType {\n    let result = this.values[0].type();\n    for (let i = 1; i < this.values.length; i++) {\n      const addedType = addTypes(result, this.values[i].type());\n      if (addedType === null) {\n        throw new TypeError('Incompatible types in min()');\n      }\n      result = addedType;\n    }\n    return result;\n  }\n\n  protected toCSSString(): string {\n    return `min(${this.values.map(v => v.toString()).join(', ')})`;\n  }\n\n  toString(): string {\n    return this.toCSSString();\n  }\n}\n\n// ============================================================================\n// CSSMathMax\n// ============================================================================\n\n/**\n * Represents a CSS max() expression\n */\nclass MockedCSSMathMax extends MockedCSSMathValue implements CSSMathMax {\n  readonly operator: CSSMathOperator = 'max';\n  \n  constructor(public values: MockedCSSNumericValue[]) {\n    super();\n    if (values.length === 0) {\n      throw new SyntaxError('CSSMathMax requires at least one value');\n    }\n  }\n\n  type(): CSSNumericType {\n    let result = this.values[0].type();\n    for (let i = 1; i < this.values.length; i++) {\n      const addedType = addTypes(result, this.values[i].type());\n      if (addedType === null) {\n        throw new TypeError('Incompatible types in max()');\n      }\n      result = addedType;\n    }\n    return result;\n  }\n\n  protected toCSSString(): string {\n    return `max(${this.values.map(v => v.toString()).join(', ')})`;\n  }\n\n  toString(): string {\n    return this.toCSSString();\n  }\n}\n\n// ============================================================================\n// CSSMathClamp\n// ============================================================================\n\n/**\n * Represents a CSS clamp() expression\n */\nclass MockedCSSMathClamp extends MockedCSSMathValue implements CSSMathClamp {\n  readonly operator: CSSMathOperator = 'clamp';\n  \n  constructor(\n    public lower: MockedCSSNumericValue,\n    public value: MockedCSSNumericValue,\n    public upper: MockedCSSNumericValue\n  ) {\n    super();\n    \n    // Type check compatibility\n    const lowerType = lower.type();\n    const valueType = value.type();\n    const upperType = upper.type();\n    \n    const resultType = addTypes(lowerType, valueType);\n    if (resultType === null) {\n      throw new TypeError('Incompatible types in clamp() lower and value');\n    }\n    \n    const finalType = addTypes(resultType, upperType);\n    if (finalType === null) {\n      throw new TypeError('Incompatible types in clamp()');\n    }\n  }\n\n  type(): CSSNumericType {\n    // All three values must be compatible, so return the type of any of them\n    return this.lower.type();\n  }\n\n  protected toCSSString(): string {\n    return `clamp(${this.lower.toString()}, ${this.value.toString()}, ${this.upper.toString()})`;\n  }\n\n  toString(): string {\n    return this.toCSSString();\n  }\n}\n\n// ============================================================================\n// CSS Factory Functions\n// ============================================================================\n\nexport const MockedCSS = {\n  // Numbers and percentages\n  number: (value: number) => new MockedCSSUnitValue(value, 'number'),\n  percent: (value: number) => new MockedCSSUnitValue(value, 'percent'),\n  \n  // Length units - Absolute\n  px: (value: number) => new MockedCSSUnitValue(value, 'px'),\n  cm: (value: number) => new MockedCSSUnitValue(value, 'cm'),\n  mm: (value: number) => new MockedCSSUnitValue(value, 'mm'),\n  in: (value: number) => new MockedCSSUnitValue(value, 'in'),\n  pt: (value: number) => new MockedCSSUnitValue(value, 'pt'),\n  pc: (value: number) => new MockedCSSUnitValue(value, 'pc'),\n  Q: (value: number) => new MockedCSSUnitValue(value, 'Q'),\n  \n  // Length units - Font-relative\n  em: (value: number) => new MockedCSSUnitValue(value, 'em'),\n  rem: (value: number) => new MockedCSSUnitValue(value, 'rem'),\n  ex: (value: number) => new MockedCSSUnitValue(value, 'ex'),\n  ch: (value: number) => new MockedCSSUnitValue(value, 'ch'),\n  cap: (value: number) => new MockedCSSUnitValue(value, 'cap'),\n  ic: (value: number) => new MockedCSSUnitValue(value, 'ic'),\n  lh: (value: number) => new MockedCSSUnitValue(value, 'lh'),\n  rlh: (value: number) => new MockedCSSUnitValue(value, 'rlh'),\n  \n  // Length units - Viewport-relative (original)\n  vw: (value: number) => new MockedCSSUnitValue(value, 'vw'),\n  vh: (value: number) => new MockedCSSUnitValue(value, 'vh'),\n  vi: (value: number) => new MockedCSSUnitValue(value, 'vi'),\n  vb: (value: number) => new MockedCSSUnitValue(value, 'vb'),\n  vmin: (value: number) => new MockedCSSUnitValue(value, 'vmin'),\n  vmax: (value: number) => new MockedCSSUnitValue(value, 'vmax'),\n  \n  // Length units - Viewport-relative (small)\n  svw: (value: number) => new MockedCSSUnitValue(value, 'svw'),\n  svh: (value: number) => new MockedCSSUnitValue(value, 'svh'),\n  svi: (value: number) => new MockedCSSUnitValue(value, 'svi'),\n  svb: (value: number) => new MockedCSSUnitValue(value, 'svb'),\n  svmin: (value: number) => new MockedCSSUnitValue(value, 'svmin'),\n  svmax: (value: number) => new MockedCSSUnitValue(value, 'svmax'),\n  \n  // Length units - Viewport-relative (large)\n  lvw: (value: number) => new MockedCSSUnitValue(value, 'lvw'),\n  lvh: (value: number) => new MockedCSSUnitValue(value, 'lvh'),\n  lvi: (value: number) => new MockedCSSUnitValue(value, 'lvi'),\n  lvb: (value: number) => new MockedCSSUnitValue(value, 'lvb'),\n  lvmin: (value: number) => new MockedCSSUnitValue(value, 'lvmin'),\n  lvmax: (value: number) => new MockedCSSUnitValue(value, 'lvmax'),\n  \n  // Length units - Viewport-relative (dynamic)\n  dvw: (value: number) => new MockedCSSUnitValue(value, 'dvw'),\n  dvh: (value: number) => new MockedCSSUnitValue(value, 'dvh'),\n  dvi: (value: number) => new MockedCSSUnitValue(value, 'dvi'),\n  dvb: (value: number) => new MockedCSSUnitValue(value, 'dvb'),\n  dvmin: (value: number) => new MockedCSSUnitValue(value, 'dvmin'),\n  dvmax: (value: number) => new MockedCSSUnitValue(value, 'dvmax'),\n  \n  // Length units - Container query\n  cqw: (value: number) => new MockedCSSUnitValue(value, 'cqw'),\n  cqh: (value: number) => new MockedCSSUnitValue(value, 'cqh'),\n  cqi: (value: number) => new MockedCSSUnitValue(value, 'cqi'),\n  cqb: (value: number) => new MockedCSSUnitValue(value, 'cqb'),\n  cqmin: (value: number) => new MockedCSSUnitValue(value, 'cqmin'),\n  cqmax: (value: number) => new MockedCSSUnitValue(value, 'cqmax'),\n  \n  // Angle units\n  deg: (value: number) => new MockedCSSUnitValue(value, 'deg'),\n  rad: (value: number) => new MockedCSSUnitValue(value, 'rad'),\n  grad: (value: number) => new MockedCSSUnitValue(value, 'grad'),\n  turn: (value: number) => new MockedCSSUnitValue(value, 'turn'),\n  \n  // Time units\n  s: (value: number) => new MockedCSSUnitValue(value, 's'),\n  ms: (value: number) => new MockedCSSUnitValue(value, 'ms'),\n  \n  // Frequency units\n  Hz: (value: number) => new MockedCSSUnitValue(value, 'Hz'),\n  kHz: (value: number) => new MockedCSSUnitValue(value, 'kHz'),\n  \n  // Resolution units\n  dpi: (value: number) => new MockedCSSUnitValue(value, 'dpi'),\n  dpcm: (value: number) => new MockedCSSUnitValue(value, 'dpcm'),\n  dppx: (value: number) => new MockedCSSUnitValue(value, 'dppx'),\n  \n  // Flex units\n  fr: (value: number) => new MockedCSSUnitValue(value, 'fr'),\n};\n\n// ============================================================================\n// Initialization Function\n// ============================================================================\n\n/**\n * Initializes CSS Typed OM mocks in the global environment\n */\nexport function initCSSTypedOM(): void {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n\n  // Install the classes on globalThis\n  Object.defineProperty(globalThis, 'CSSNumericValue', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSNumericValue,\n  });\n\n  Object.defineProperty(globalThis, 'CSSUnitValue', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSUnitValue,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathValue', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathValue,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathSum', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathSum,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathProduct', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathProduct,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathNegate', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathNegate,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathInvert', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathInvert,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathMin', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathMin,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathMax', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathMax,\n  });\n\n  Object.defineProperty(globalThis, 'CSSMathClamp', {\n    writable: true,\n    configurable: true,\n    value: MockedCSSMathClamp,\n  });\n\n  // Install CSS factory functions\n  Object.defineProperty(globalThis, 'CSS', {\n    writable: true,\n    configurable: true,\n    value: MockedCSS,\n  });\n}\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport {\n  MockedCSSNumericValue,\n  MockedCSSUnitValue,\n  MockedCSSMathValue,\n  MockedCSSMathSum,\n  MockedCSSMathProduct,\n  MockedCSSMathNegate,\n  MockedCSSMathInvert,\n  MockedCSSMathMin,\n  MockedCSSMathMax,\n  MockedCSSMathClamp,\n};\n\n// Re-export for compatibility with existing code\nexport { initCSSTypedOM as mockCSSTypedOM }; ","import { cssNumberishToNumber } from './cssNumberishHelpers';\n\nclass MockedAnimationEffect implements AnimationEffect {\n  #timing: EffectTiming = {\n    delay: 0,\n    direction: 'normal',\n    duration: 'auto',\n    easing: 'linear',\n    endDelay: 0,\n    fill: 'auto',\n    iterationStart: 0,\n    iterations: 1,\n  };\n\n  constructor() {\n    if (this.constructor === MockedAnimationEffect) {\n      throw new TypeError('Illegal constructor');\n    }\n  }\n\n  // Changed from private (#getNormalizedDuration) to protected (_getNormalizedDuration)\n  // to allow access from child classes in all JavaScript environments\n  protected _getNormalizedDuration(): number {\n    // the only possible value is \"auto\"\n    if (typeof this.#timing.duration === 'string') {\n      return 0;\n    }\n\n    const durationNum = cssNumberishToNumber(this.#timing.duration ?? null);\n    return durationNum ?? 0;\n  }\n\n  getTiming() {\n    return this.#timing;\n  }\n\n  getComputedTiming(): ComputedEffectTiming {\n    // duration of the animation\n    const duration = this._getNormalizedDuration();\n\n    // Calculated as (iteration_duration * iteration_count)\n    const activeDuration =\n      this.#timing.iterations === Infinity\n        ? Infinity\n        : duration * (this.#timing.iterations ?? 1);\n\n    // The end time of an animation effect is the result of evaluating max(start delay + active duration + end delay, 0).\n    const endTime =\n      this.#timing.iterations === Infinity\n        ? Infinity\n        : Math.max(\n            (this.#timing.delay ?? 0) +\n              activeDuration +\n              (this.#timing.endDelay ?? 0),\n            0\n          );\n\n    // must be linked to the animation\n    const currentIteration = null;\n\n    return {\n      ...this.#timing,\n      duration,\n      fill: this.#timing.fill === 'auto' ? 'none' : this.#timing.fill,\n      activeDuration,\n      currentIteration:\n        this.#timing.iterations === Infinity ? null : currentIteration,\n      endTime,\n      localTime: null,\n      progress: null,\n    };\n  }\n\n  updateTiming(timing?: OptionalEffectTiming | undefined): void {\n    Object.assign(this.#timing, timing);\n  }\n}\n\nfunction mockAnimationEffect() {\n  if (typeof AnimationEffect === 'undefined') {\n    Object.defineProperty(window, 'AnimationEffect', {\n      writable: true,\n      configurable: true,\n      value: MockedAnimationEffect,\n    });\n  }\n}\n\nexport { MockedAnimationEffect, mockAnimationEffect };\n","import { isJsdomEnv, WrongEnvironmentError } from '../../helper';\nimport { initCSSTypedOM as mockCSSTypedOM } from '../css-typed-om';\n\n\n/**\n * Converts CSSNumberish to number, handling null and CSSUnitValue values.\n * @param value - The CSSNumberish value to convert (can be null)\n * @returns The number value in milliseconds, or null if the input is null or cannot be converted\n */\nexport function cssNumberishToNumber(value: CSSNumberish | null): number | null {\n  if (value === null) return null;\n  if (typeof value === 'number') return value;\n\n  // Handle CSSUnitValue instances\n  if (value instanceof CSSUnitValue) {\n    const { unit, value: raw } = value;\n    if (unit === 's') return raw * 1000; // seconds to ms\n    if (unit === 'ms' || unit === 'number') return raw;\n    console.warn(\n      `jsdom-testing-mocks: Unsupported CSS unit '${unit}' in cssNumberishToNumber. Returning null.`\n    );\n    return null;\n  }\n\n  // Handle CSSMathValue instances\n  if (value instanceof CSSMathValue) {\n    // Check the type to determine the appropriate conversion\n    const valueType = value.type();\n    \n    // If it's a time-dimensioned value, try to convert using toSum\n    if (valueType.time === 1 && Object.values(valueType).filter(v => v !== 0).length === 1) {\n      try {\n        // Convert to a sum with milliseconds\n        const msSum = value.toSum('ms');\n        if (msSum.values.length === 1 && msSum.values[0] instanceof CSSUnitValue) {\n          return msSum.values[0].value;\n        }\n        console.warn(\n          'jsdom-testing-mocks: Cannot simplify time-dimensioned CSSMathValue to single millisecond value. Returning null.'\n        );\n        return null;\n      } catch {\n        console.warn(\n          'jsdom-testing-mocks: Cannot convert time-dimensioned CSSMathValue to milliseconds. Returning null.'\n        );\n        return null;\n      }\n    }\n    \n    // If it's dimensionless (number), try to convert using toSum\n    if (Object.values(valueType).every(v => v === 0 || v === undefined)) {\n      try {\n        // Convert to a sum with numbers\n        const numberSum = value.toSum('number');\n        if (numberSum.values.length === 1 && numberSum.values[0] instanceof CSSUnitValue) {\n          return numberSum.values[0].value;\n        }\n        console.warn(\n          'jsdom-testing-mocks: Cannot simplify dimensionless CSSMathValue to single number value. Returning null.'\n        );\n        return null;\n      } catch {\n        console.warn(\n          'jsdom-testing-mocks: Cannot convert dimensionless CSSMathValue to number. Returning null.'\n        );\n        return null;\n      }\n    }\n    \n    // For other dimensions, we cannot convert to time/number units\n    console.warn(\n      'jsdom-testing-mocks: CSSMathValue has incompatible dimensions for animation timing. Returning null.'\n    );\n    return null;\n  }\n\n  console.warn(\n    'jsdom-testing-mocks: Unsupported CSSNumberish value in cssNumberishToNumber. Returning null.'\n  );\n  return null;\n}\n\n/**\n * @returns The number value, or the default value if conversion fails\n */\nexport function cssNumberishToNumberWithDefault(\n  value: CSSNumberish | null,\n  defaultValue: number\n): number {\n  const converted = cssNumberishToNumber(value);\n  return converted ?? defaultValue;\n}\n\n/**\n * Converts a number to CSSNumberish\n * @param value - The number value to convert\n * @returns The number as CSSNumberish\n */\nexport function numberToCSSNumberish(value: number): CSSNumberish {\n  return value;\n}\n\n/**\n * Initialize CSS Typed OM mocks in JSDOM environment\n */\nexport function initCSSTypedOM(): void {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n  \n  mockCSSTypedOM();\n}\n\n ","import { mockAnimationEffect, MockedAnimationEffect } from './AnimationEffect';\nimport { cssNumberishToNumber } from './cssNumberishHelpers';\n\n/**\n  Given the structure of PropertyIndexedKeyframes as such:\n  {\n    opacity: [ 0, 0.9, 1 ],\n    transform: [ \"translateX(0)\", \"translateX(50px)\", \"translateX(100px)\" ],\n    offset: [ 0, 0.8 ],\n    easing: [ 'ease-in', 'ease-out' ],\n  }\n  convert it to the structure of Keyframe[] as such:\n  [\n    { opacity: 0, transform: \"translateX(0)\", offset: 0, easing: 'ease-in' },\n    { opacity: 0.9, transform: \"translateX(50px)\", offset: 0.8, easing: 'ease-out' },\n    { opacity: 1, transform: \"translateX(100px)\" },\n  ]\n*/\nexport function convertPropertyIndexedKeyframes(\n  piKeyframes: PropertyIndexedKeyframes\n): Keyframe[] {\n  const keyframes: Keyframe[] = [];\n  let done = false;\n  let keyframeIndex = 0;\n\n  while (!done) {\n    let keyframe: Keyframe | undefined;\n\n    for (const property in piKeyframes) {\n      const values = piKeyframes[property];\n      const propertyArray = Array.isArray(values) ? values : [values];\n\n      if (!propertyArray) {\n        continue;\n      }\n\n      const piKeyframe = propertyArray[keyframeIndex];\n\n      if (typeof piKeyframe === 'undefined' || piKeyframe === null) {\n        continue;\n      }\n\n      if (!keyframe) {\n        keyframe = {};\n      }\n\n      keyframe[property] = piKeyframe;\n    }\n\n    if (keyframe) {\n      keyframeIndex++;\n      keyframes.push(keyframe);\n      continue;\n    }\n\n    done = true;\n  }\n\n  return keyframes;\n}\n\nclass MockedKeyframeEffect\n  extends MockedAnimationEffect\n  implements KeyframeEffect\n{\n  composite: CompositeOperation = 'replace';\n  iterationComposite: IterationCompositeOperation;\n  pseudoElement: string | null = null;\n  target: Element | null;\n  #keyframes: Keyframe[] = [];\n\n  constructor(\n    target: Element,\n    keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\n    options: number | KeyframeEffectOptions = {}\n  ) {\n    super();\n\n    if (typeof options === 'number') {\n      options = { duration: options };\n    }\n\n    const { composite, iterationComposite, pseudoElement, ...timing } = options;\n\n    this.setKeyframes(keyframes);\n    this.target = target;\n    this.composite = composite || 'replace';\n    // not actually implemented, just to make ts happy\n    this.iterationComposite = iterationComposite || 'replace';\n    this.pseudoElement = pseudoElement || null;\n\n    // Only update timing if options were provided\n    if (Object.keys(timing).length > 0) {\n      // Convert CSSNumberish values to numbers for updateTiming\n      const convertedTiming: OptionalEffectTiming = {};\n      \n      if (timing.delay !== undefined) {\n        convertedTiming.delay = cssNumberishToNumber(timing.delay) ?? timing.delay;\n      }\n      if (timing.duration !== undefined) {\n        convertedTiming.duration = typeof timing.duration === 'string' ? timing.duration : cssNumberishToNumber(timing.duration) ?? 0;\n      }\n      if (timing.endDelay !== undefined) {\n        convertedTiming.endDelay = cssNumberishToNumber(timing.endDelay) ?? timing.endDelay;\n      }\n      if (timing.iterationStart !== undefined) {\n        convertedTiming.iterationStart = cssNumberishToNumber(timing.iterationStart) ?? timing.iterationStart;\n      }\n      if (timing.iterations !== undefined) {\n        convertedTiming.iterations = cssNumberishToNumber(timing.iterations) ?? timing.iterations;\n      }\n      if (timing.direction !== undefined) {\n        convertedTiming.direction = timing.direction;\n      }\n      if (timing.easing !== undefined) {\n        convertedTiming.easing = timing.easing;\n      }\n      if (timing.fill !== undefined) {\n        convertedTiming.fill = timing.fill;\n      }\n      if (timing.playbackRate !== undefined) {\n        convertedTiming.playbackRate = timing.playbackRate;\n      }\n      this.updateTiming(convertedTiming);\n    }\n  }\n\n  #validateKeyframes(keyframes: Keyframe[]) {\n    let lastExplicitOffset: number | undefined;\n\n    keyframes.forEach((keyframe) => {\n      const offset = keyframe.offset;\n\n      if (typeof offset === 'number') {\n        if (offset < 0 || offset > 1) {\n          throw new TypeError(\n            \"Failed to construct 'KeyframeEffect': Offsets must be null or in the range [0,1].\"\n          );\n        }\n\n        if (typeof lastExplicitOffset === 'number') {\n          if (offset < lastExplicitOffset) {\n            throw new TypeError(\n              \"Failed to construct 'KeyframeEffect': Offsets must be monotonically non-decreasing.\"\n            );\n          }\n        }\n\n        lastExplicitOffset = offset;\n      }\n    });\n  }\n\n  getKeyframes(): ComputedKeyframe[] {\n    const totalKeyframes = this.#keyframes.length;\n\n    if (totalKeyframes === 0) {\n      return [];\n    }\n\n    let currentOffset =\n      this.#keyframes[0]?.offset ?? (totalKeyframes === 1 ? 1 : 0);\n\n    return this.#keyframes.map(\n      ({ composite, offset, easing, ...keyframe }, index) => {\n        const computedKeyframe = {\n          offset: offset ?? null,\n          composite: composite ?? this.composite,\n          easing: easing ?? 'linear',\n          computedOffset: currentOffset,\n          ...keyframe,\n        };\n\n        // calculate the next offset\n        // (implements KeyframeEffect.spacing)\n        let nextOffset: number | undefined;\n        let keyframesUntilNextOffset: number | undefined;\n\n        for (let i = index + 1; i < totalKeyframes; i++) {\n          const offset = this.#keyframes[i].offset;\n\n          if (typeof offset === 'number') {\n            nextOffset = offset;\n            keyframesUntilNextOffset = i - index;\n            break;\n          }\n        }\n\n        if (nextOffset === undefined) {\n          nextOffset = 1;\n          keyframesUntilNextOffset = this.#keyframes.length - index - 1;\n        }\n\n        const offsetDiff =\n          typeof keyframesUntilNextOffset === 'number' &&\n          keyframesUntilNextOffset > 0\n            ? (nextOffset - currentOffset) / keyframesUntilNextOffset\n            : 0;\n\n        currentOffset = currentOffset + offsetDiff;\n\n        return computedKeyframe;\n      }\n    );\n  }\n\n  setKeyframes(keyframes: Keyframe[] | PropertyIndexedKeyframes | null) {\n    let kf: Keyframe[];\n\n    if (keyframes === null) {\n      kf = [];\n    } else if (Array.isArray(keyframes)) {\n      kf = keyframes;\n    } else {\n      kf = convertPropertyIndexedKeyframes(keyframes);\n    }\n\n    this.#validateKeyframes(kf);\n\n    this.#keyframes = kf;\n  }\n}\n\nfunction mockKeyframeEffect() {\n  mockAnimationEffect();\n\n  if (typeof KeyframeEffect === 'undefined') {\n    Object.defineProperty(window, 'KeyframeEffect', {\n      writable: true,\n      configurable: true,\n      value: MockedKeyframeEffect,\n    });\n  }\n}\n\nexport { MockedKeyframeEffect, mockKeyframeEffect };\n","class MockedAnimationPlaybackEvent\n  extends Event\n  implements AnimationPlaybackEvent\n{\n  readonly currentTime = null;\n  readonly timelineTime = null;\n}\n\nfunction mockAnimationPlaybackEvent() {\n  if (typeof AnimationPlaybackEvent === 'undefined') {\n    Object.defineProperty(window, 'AnimationPlaybackEvent', {\n      writable: true,\n      configurable: true,\n      value: MockedAnimationPlaybackEvent,\n    });\n  }\n}\n\nexport { mockAnimationPlaybackEvent };\n","class MockedAnimationTimeline implements AnimationTimeline {\n  constructor() {\n    if (this.constructor === MockedAnimationTimeline) {\n      throw new TypeError('Illegal constructor');\n    }\n  }\n\n  get currentTime() {\n    return performance.now();\n  }\n}\n\nfunction mockAnimationTimeline() {\n  if (typeof AnimationTimeline === 'undefined') {\n    Object.defineProperty(window, 'AnimationTimeline', {\n      writable: true,\n      configurable: true,\n      value: MockedAnimationTimeline,\n    });\n  }\n}\n\nexport { MockedAnimationTimeline, mockAnimationTimeline };\n","import {\n  mockAnimationTimeline,\n  MockedAnimationTimeline,\n} from './AnimationTimeline';\n\nclass MockedDocumentTimeline\n  extends MockedAnimationTimeline\n  implements DocumentTimeline\n{\n  #originTime = 0;\n\n  constructor(options?: DocumentTimelineOptions) {\n    super();\n\n    this.#originTime = options?.originTime ?? 0;\n  }\n\n  get currentTime() {\n    return performance.now() - this.#originTime;\n  }\n}\n\nfunction mockDocumentTimeline() {\n  mockAnimationTimeline();\n\n  if (typeof DocumentTimeline === 'undefined') {\n    Object.defineProperty(window, 'DocumentTimeline', {\n      writable: true,\n      configurable: true,\n      value: MockedDocumentTimeline,\n    });\n\n    Object.defineProperty(Document.prototype, 'timeline', {\n      writable: true,\n      configurable: true,\n      value: new MockedDocumentTimeline(),\n    });\n  }\n}\n\nexport { mockDocumentTimeline };\n","import BezierEasing from 'bezier-easing';\n\nconst ease = BezierEasing(0.25, 0.1, 0.25, 1.0);\nconst easeIn = BezierEasing(0.42, 0.0, 1.0, 1.0);\nconst easeOut = BezierEasing(0.0, 0.0, 0.58, 1.0);\nconst easeInOut = BezierEasing(0.42, 0.0, 0.58, 1.0);\n\nconst VALID_JUMPTERMS = [\n  'jump-start',\n  'jump-end',\n  'jump-none',\n  'jump-both',\n  'start',\n  'end',\n];\n\nconst clamp = (value: number) => Math.min(Math.max(value, 0), 1);\n\n/**\n * @param easing - string like \"steps(4, end)\"\n * @returns easing function\n */\nexport const StepsEasing = (easing: string) => {\n  switch (easing) {\n    case 'step-start':\n      easing = 'steps(1, jump-start)';\n      break;\n    case 'step-end':\n      easing = 'steps(1, jump-end)';\n      break;\n  }\n\n  const easingString = easing.replace('steps(', '').replace(')', '');\n  const easingArray = easingString.split(',').map((step) => step.trim());\n  const [nString, jumpterm = 'jump-end'] = easingArray;\n\n  const n = Number(nString);\n\n  if (\n    isNaN(n) ||\n    !Number.isInteger(n) ||\n    n <= 0 ||\n    !VALID_JUMPTERMS.includes(jumpterm)\n  ) {\n    throw new Error(`Invalid easing function: ${easing}`);\n  }\n\n  switch (jumpterm) {\n    case 'start':\n    case 'jump-start':\n      return (value: number) => {\n        const step = Math.ceil(value * n);\n        return clamp(step / n);\n      };\n\n    case 'end':\n    case 'jump-end':\n      return (value: number) => {\n        const step = Math.floor(value * n);\n        return clamp(step / n);\n      };\n\n    case 'jump-none':\n      return (value: number) => {\n        const step = Math.floor(value * n);\n        return clamp(step / (n - 1));\n      };\n\n    case 'jump-both':\n      return (value: number) => {\n        if (value === 1) {\n          return 1;\n        }\n\n        const step = Math.ceil(value * n);\n        return clamp(step / (n + 1));\n      };\n  }\n\n  throw new Error(`Invalid easing function: ${easing}`);\n};\n\n// easing functions\nconst easingFunctions: {\n  [key: string]: (value: number, before: boolean) => number;\n} = {\n  linear: (value) => value,\n  ease,\n  'ease-in': easeIn,\n  'ease-out': easeOut,\n  'ease-in-out': easeInOut,\n};\n\nfunction getEasingFunctionFromString(easing: string) {\n  if (easingFunctions[easing]) {\n    return easingFunctions[easing];\n  }\n\n  // convert \"cubic-bezier(x1, y1, x2, y2)\" string to bezier easing function\n  if (easing.indexOf('cubic-bezier(') === 0) {\n    const bezierString = easing.replace('cubic-bezier(', '').replace(')', '');\n    const bezierArray = bezierString.split(',').map(Number);\n    easingFunctions[easing] = BezierEasing(\n      bezierArray[0],\n      bezierArray[1],\n      bezierArray[2],\n      bezierArray[3]\n    );\n\n    return easingFunctions[easing];\n  }\n\n  // convert \"steps(x)\" string\n  if (easing.indexOf('steps(') === 0) {\n    easingFunctions[easing] = StepsEasing(easing);\n\n    return easingFunctions[easing];\n  }\n\n  throw new Error(`Unknown easing function \"${easing}\"`);\n}\n\nexport { getEasingFunctionFromString, easingFunctions };\n","const elementAnimations = new Map<Element, Animation[]>();\n\nexport function removeAnimation(element: Element, animation: Animation) {\n  const animations = elementAnimations.get(element);\n\n  if (animations) {\n    const index = animations.indexOf(animation);\n\n    if (index !== -1) {\n      animations.splice(index, 1);\n    }\n  }\n}\n\nexport function addAnimation(element: Element, animation: Animation) {\n  const animations = elementAnimations.get(element) ?? [];\n  animations.push(animation);\n\n  elementAnimations.set(element, animations);\n}\n\nexport function getAnimations(this: Element) {\n  return elementAnimations.get(this) ?? [];\n}\n\nexport function getAllAnimations() {\n  return Array.from(elementAnimations.values()).flat();\n}\n\nexport function clearAnimations() {\n  // Cancel all running animations to prevent requestAnimationFrame errors during teardown\n  const allAnimations = getAllAnimations();\n  allAnimations.forEach((animation) => {\n    // Cancel the animation properly - this stops the requestAnimationFrame loop\n    animation.cancel();\n  });\n\n  elementAnimations.clear();\n}\n","import { mockKeyframeEffect } from './KeyframeEffect';\nimport { mockAnimationPlaybackEvent } from './AnimationPlaybackEvent';\nimport { mockDocumentTimeline } from './DocumentTimeline';\nimport { getEasingFunctionFromString } from './easingFunctions';\nimport { addAnimation, removeAnimation } from './elementAnimations';\nimport { getConfig } from '../../tools';\nimport { cssNumberishToNumber, numberToCSSNumberish } from './cssNumberishHelpers';\n\ntype ActiveAnimationTimeline = AnimationTimeline & {\n  currentTime: NonNullable<AnimationTimeline['currentTime']>;\n};\n\ntype ComputedKeyframeNonStylePropNames =\n  | 'composite'\n  | 'computedOffset'\n  | 'easing'\n  | 'offset';\n\ntype ComputedKeyframeStyleProps = Omit<\n  ComputedKeyframe,\n  ComputedKeyframeNonStylePropNames\n>;\n\ntype ComputedKeyframeWithOptionalNonStyleProps = ComputedKeyframeStyleProps &\n  Partial<Pick<ComputedKeyframe, ComputedKeyframeNonStylePropNames>>;\n\ntype DefinedEffectTiming = Required<EffectTiming>;\n\ntype DefinedComputedEffectTiming = Required<\n  Omit<ComputedEffectTiming, 'localTime' | 'progress'>\n> & {\n  duration: number;\n};\n\nconst config = getConfig();\nexport const NON_STYLE_KEYFRAME_PROPERTIES = ['offset', 'composite', 'easing'];\nexport const RENAMED_KEYFRAME_PROPERTIES: {\n  [key: string]: string;\n} = {\n  cssFloat: 'float',\n  cssOffset: 'offset',\n};\n\n\n\nconst noop = () => {};\n\n/**\n * Implements https://www.w3.org/TR/web-animations-1\n *\n * With the following differences:\n * - There's no style interpolation\n * - The implementation is based on requestAnimationFrame\n */\nclass MockedAnimation extends EventTarget implements Animation {\n  id = '';\n  readonly pending = false;\n  readonly replaceState = 'active';\n\n  // implementation details\n  #finishedPromise: Promise<Animation>;\n  #readyPromise: Promise<Animation>;\n  #startTime: number | null = null;\n  #pendingPauseTask: (() => void) | null = null;\n  #pendingPlayTask: (() => void) | null = null;\n  #previousCurrentTime: number | null = null;\n  #previousPhase: 'before' | 'active' | 'after' | 'idle' = 'idle';\n  #effect: AnimationEffect | null = null;\n  #timeline: AnimationTimeline | null = null;\n  #rafId: number | null = null;\n  #initialKeyframe: ComputedKeyframeStyleProps;\n  #fillMode: Omit<FillMode, 'auto'>;\n  #promiseStates: {\n    finished: 'pending' | 'resolved' | 'rejected';\n    ready: 'pending' | 'resolved' | 'rejected';\n  } = {\n    finished: 'pending',\n    ready: 'resolved',\n  };\n  #resolvers: {\n    ready: {\n      resolve: (value: Animation | PromiseLike<Animation>) => void;\n      reject: (reason: Error) => void;\n    };\n    finished: {\n      resolve: (value: Animation | PromiseLike<Animation>) => void;\n      reject: (reason: Error) => void;\n    };\n  } = {\n    ready: {\n      resolve: noop,\n      reject: noop,\n    },\n    finished: {\n      resolve: noop,\n      reject: noop,\n    },\n  };\n  #getRawComputedTiming: () => Omit<\n    ComputedEffectTiming,\n    'localTime' | 'progress'\n  > = () => ({});\n  #pendingPlaybackRate: number | null = null;\n  #playbackRate = 1;\n  #holdTime: number | null = null;\n\n  constructor(\n    effect: AnimationEffect | null = null,\n    timeline: AnimationTimeline = document.timeline\n  ) {\n    super();\n\n    this.effect = effect;\n    this.#timeline = timeline;\n    this.#initialKeyframe = this.#calcInitialKeyframe();\n    this.#fillMode = effect?.getComputedTiming().fill ?? 'none';\n    this.#finishedPromise = this.#getNewFinishedPromise();\n    this.#readyPromise = Promise.resolve(this);\n  }\n\n  #getTiming() {\n    if (!this.#effect) {\n      // Per the spec, if there's no effect, we should return a default timing object.\n      // https://www.w3.org/TR/web-animations-1/#dom-animation-effect\n      return {\n        delay: 0,\n        direction: 'normal',\n        duration: 0,\n        easing: 'linear',\n        endDelay: 0,\n        fill: 'auto',\n        iterationStart: 0,\n        iterations: 1,\n      } as DefinedEffectTiming;\n    }\n    return this.#effect.getTiming() as DefinedEffectTiming;\n  }\n\n  #getComputedTiming() {\n    return this.#getRawComputedTiming.call(\n      this.effect\n    ) as DefinedComputedEffectTiming;\n  }\n\n  get #localTime() {\n    // The local time of an animation effect at a given moment is based on the first matching condition from the following:\n    //  If the animation effect is associated with an animation,\n    //    the local time is the current time of the animation.\n    //  Otherwise,\n    //    the local time is unresolved.\n    if (this.#effect !== null) {\n      return this.currentTime;\n    }\n\n    return null;\n  }\n\n  #addToTarget() {\n    if (!this.#hasKeyframeEffect() || this.effect.target == null) {\n      return;\n    }\n\n    addAnimation(this.effect.target, this);\n  }\n\n  #removeFromTarget() {\n    if (!this.#hasKeyframeEffect() || this.effect.target == null) {\n      return;\n    }\n\n    removeAnimation(this.effect.target, this);\n  }\n\n  #getNewFinishedPromise() {\n    this.#promiseStates.finished = 'pending';\n\n    return new Promise<Animation>((resolve, reject) => {\n      this.#resolvers.finished.resolve = (animation) => {\n        this.#removeFromTarget();\n        this.#promiseStates.finished = 'resolved';\n        resolve(animation);\n      };\n      this.#resolvers.finished.reject = (error) => {\n        this.#removeFromTarget();\n        this.#promiseStates.finished = 'rejected';\n        reject(error);\n      };\n    });\n  }\n\n  #getNewReadyPromise() {\n    this.#promiseStates.ready = 'pending';\n    this.#addToTarget();\n\n    return new Promise<Animation>((resolve, reject) => {\n      this.#resolvers.ready.resolve = (animation) => {\n        this.#promiseStates.ready = 'resolved';\n        resolve(animation);\n      };\n      this.#resolvers.ready.reject = (error) => {\n        this.#promiseStates.ready = 'rejected';\n        reject(error);\n      };\n    });\n  }\n\n  #silentlyRejectFinishedPromise(error: Error) {\n    this.#finishedPromise.catch(noop);\n    this.#resolvers.finished.reject(error);\n  }\n\n  #hasPendingTask() {\n    return this.#pendingPauseTask || this.#pendingPlayTask;\n  }\n\n  #isTimelineActive(): this is { timeline: ActiveAnimationTimeline } {\n    return this.#timeline?.currentTime !== null;\n  }\n\n  #hasKeyframeEffect(): this is { effect: KeyframeEffect } {\n    return this.#effect instanceof KeyframeEffect;\n  }\n\n  #isTimelineMonotonicallyIncreasing() {\n    return this.#timeline instanceof DocumentTimeline;\n  }\n\n  #calcInitialKeyframe() {\n    const initialKeyframe: ComputedKeyframeStyleProps = {};\n    const uniqueProps = new Set<string>();\n\n    if (!(this.#effect instanceof KeyframeEffect)) {\n      return initialKeyframe;\n    }\n\n    const target = this.#effect.target;\n\n    this.#effect.getKeyframes().forEach((keyframe) => {\n      for (const property in keyframe) {\n        if (NON_STYLE_KEYFRAME_PROPERTIES.includes(property)) {\n          continue;\n        }\n\n        uniqueProps.add(property);\n      }\n    });\n\n    uniqueProps.forEach((property) => {\n      const propertyName = RENAMED_KEYFRAME_PROPERTIES[property] ?? property;\n\n      const value = (target as HTMLElement).style.getPropertyValue(\n        propertyName\n      );\n\n      initialKeyframe[property] = value;\n    });\n\n    return initialKeyframe;\n  }\n\n  #applyPendingPlaybackRate() {\n    if (this.#pendingPlaybackRate !== null) {\n      this.#playbackRate = this.#pendingPlaybackRate;\n      this.#pendingPlaybackRate = null;\n    }\n  }\n\n  // ‘backwards’ if the effect is associated with an animation and the associated animation’s playback rate is less than zero; in all other cases, the animation direction is ‘forwards’.\n  get #animationDirection() {\n    return this.#effect !== null && this.playbackRate < 0\n      ? 'backwards'\n      : 'forwards';\n  }\n\n  // An animation effect is in the before phase if the animation effect’s local time is not unresolved and either of the following conditions are met:\n  //   the local time is less than the before-active boundary time, or\n  //   the animation direction is ‘backwards’ and the local time is equal to the before-active boundary time.\n  // An animation effect is in the after phase if the animation effect’s local time is not unresolved and either of the following conditions are met:\n  //   the local time is greater than the active-after boundary time, or\n  //   the animation direction is ‘forwards’ and the local time is equal to the active-after boundary time.\n  // An animation effect is in the active phase if the animation effect’s local time is not unresolved and it is not in either the before phase nor the after phase.\n  // Furthermore, it is often convenient to refer to the case when an animation effect is in none of the above phases as being in the idle phase.\n  get #phase() {\n    const localTime = this.#localTime;\n\n    if (localTime === null) {\n      return 'idle';\n    }\n\n    const computedTiming = this.#getComputedTiming();\n    const delay = cssNumberishToNumber(computedTiming.delay) ?? 0;\n    const activeDuration = cssNumberishToNumber(computedTiming.activeDuration) ?? 0;\n    const endTime = cssNumberishToNumber(computedTiming.endTime) ?? 0;\n    const localTimeNum = cssNumberishToNumber(localTime) ?? 0;\n\n    const beforeActiveBoundaryTime = Math.max(Math.min(delay, endTime), 0);\n    const activeAfterBoundaryTime = Math.max(\n      Math.min(delay + activeDuration, endTime),\n      0\n    );\n\n    if (\n      localTimeNum < beforeActiveBoundaryTime ||\n      (this.#animationDirection === 'backwards' &&\n        localTimeNum === beforeActiveBoundaryTime)\n    ) {\n      return 'before';\n    }\n\n    if (\n      localTimeNum > activeAfterBoundaryTime ||\n      (this.#animationDirection === 'forwards' &&\n        localTimeNum === activeAfterBoundaryTime)\n    ) {\n      return 'after';\n    }\n\n    return 'active';\n  }\n\n  // An animation effect is in play if all of the following conditions are met:\n  //   the animation effect is in the active phase, and\n  //   the animation effect is associated with an animation that is not finished.\n  get animationEffectStateInPlay() {\n    return this.#phase === 'active' && this.playState !== 'finished';\n  }\n\n  // An animation effect is current if any of the following conditions are true:\n  //   the animation effect is in play, or\n  //   the animation effect is associated with an animation with a playback rate > 0 and the animation effect is in the before phase, or\n  //   the animation effect is associated with an animation with a playback rate < 0 and the animation effect is in the after phase.\n  get animationEffectStateCurrent() {\n    const phase = this.#phase;\n\n    return (\n      this.animationEffectStateInPlay ||\n      (this.playbackRate > 0 && phase === 'before') ||\n      (this.playbackRate < 0 && phase === 'after')\n    );\n  }\n\n  // An animation effect is in effect if its active time, as calculated according to the procedure in §4.8.3.1 Calculating the active time, is not unresolved.\n  get animationEffectStateInEffect() {\n    return this.#activeTime !== null;\n  }\n\n  get finished() {\n    return this.#finishedPromise;\n  }\n\n  get ready() {\n    return this.#readyPromise;\n  }\n\n  get timeline() {\n    return this.#timeline;\n  }\n\n  // 4.4.1. Setting the timeline of an animation\n  set timeline(timeline: AnimationTimeline | null) {\n    if (this.#timeline === timeline) {\n      return;\n    }\n\n    this.#timeline = timeline;\n\n    if (this.startTime !== null) {\n      this.#holdTime = null;\n    }\n\n    this.#updateFinishedState(false, false);\n  }\n\n  get effect() {\n    return this.#effect;\n  }\n\n  // 4.4.2. Setting the associated effect of an animation\n  set effect(effect: AnimationEffect | null) {\n    // 1. Let old effect be the current associated effect of animation, if any.\n    const oldEffect = this.#effect;\n\n    // 2. If new effect is the same object as old effect, abort this procedure.\n    if (effect === oldEffect) {\n      return;\n    }\n\n    // 3. If animation has a pending pause task, reschedule that task to run as soon as animation is ready.\n    if (this.#pendingPauseTask) {\n      this.ready.then(() => this.#pendingPauseTask?.());\n    }\n\n    // 4. If animation has a pending play task, reschedule that task to run as soon as animation is ready to play new effect.\n    if (this.#pendingPlayTask) {\n      this.ready.then(() => this.#pendingPlayTask?.());\n    }\n\n    // 5. If new effect is not null and if new effect is the associated effect of another animation, previous animation, run the procedure to set the associated effect of an animation (this procedure) on previous animation passing null as new effect.\n    if (effect) {\n      const anotherAnimation = document\n        .getAnimations()\n        .find((anim) => anim.effect === effect);\n\n      if (anotherAnimation) {\n        anotherAnimation.effect = null;\n      }\n    }\n\n    // 6. Let the associated effect of animation be new effect.\n    this.#effect = effect;\n\n    // 7. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n    this.#updateFinishedState(false, false);\n\n    if (effect) {\n      this.#getRawComputedTiming = effect.getComputedTiming;\n\n      effect.getComputedTiming = () => {\n        const computedTiming = this.#getRawComputedTiming.call(effect);\n\n        return {\n          ...computedTiming,\n          localTime: this.#localTime,\n          progress: this.#transformedProgress,\n        };\n      };\n    }\n  }\n\n  #resetPendingTasks() {\n    // 1. If animation does not have a pending play task or a pending pause task, abort this procedure.\n    if (!this.#hasPendingTask()) {\n      return;\n    }\n\n    // 2. If animation has a pending play task, cancel that task.\n    if (this.#pendingPlayTask) {\n      this.#pendingPlayTask = null;\n    }\n\n    // 3. If animation has a pending pause task, cancel that task.\n    if (this.#pendingPauseTask) {\n      this.#pendingPauseTask = null;\n    }\n\n    // 4. Apply any pending playback rate on animation.\n    this.#applyPendingPlaybackRate();\n\n    // 5. Reject animation’s current ready promise with a DOMException named \"AbortError\".\n    this.#silentlyRejectFinishedPromise(\n      new DOMException(undefined, 'AbortError')\n    );\n\n    // 6. Set the [[PromiseIsHandled]] internal slot of animation’s current ready promise to true.\n\n    // 7. Let animation’s current ready promise be the result of creating a new resolved Promise object with value animation in the relevant Realm of animation.\n    this.#readyPromise = Promise.resolve(this);\n  }\n\n  #calculateCurrentTime() {\n    if (\n      !this.#timeline ||\n      this.#timeline.currentTime === null ||\n      this.startTime === null\n    ) {\n      return null;\n    } else {\n      const timelineTime = cssNumberishToNumber(this.#timeline.currentTime);\n      const startTime = cssNumberishToNumber(this.startTime);\n      if (timelineTime === null || startTime === null) {\n        return null;\n      }\n      return (timelineTime - startTime) * this.playbackRate;\n    }\n  }\n\n  #calculateStartTime(seekTime: number) {\n    let startTime = null;\n\n    if (this.#timeline) {\n      const timelineTime = cssNumberishToNumber(this.#timeline.currentTime);\n\n      if (timelineTime !== null) {\n        startTime = timelineTime - seekTime / this.playbackRate;\n      }\n    }\n\n    return startTime;\n  }\n\n  #getCurrentTimeInternal() {\n    return this.#holdTime !== null\n      ? this.#holdTime\n      : this.#calculateCurrentTime();\n  }\n\n  // The effective playback rate of an animation is its pending playback rate, if set, otherwise it is the animation’s playback rate.\n  get #effectivePlaybackRate() {\n    return this.#pendingPlaybackRate ?? this.playbackRate;\n  }\n\n  // https://www.w3.org/TR/web-animations-1/#the-current-time-of-an-animation\n  // 4.4.3. The current time of an animation\n  get currentTime(): CSSNumberish | null {\n    return this.#getCurrentTimeInternal();\n  }\n\n  // https://www.w3.org/TR/web-animations-1/#setting-the-current-time-of-an-animation\n  // 4.4.4. Setting the current time of an animation\n  set currentTime(seekTime: number | null) {\n    // 1. Run the steps to silently set the current time of animation to seek time.\n    this.#setCurrentTimeSilent(seekTime);\n\n    // 2. If animation has a pending pause task, synchronously complete the pause operation by performing the following steps:\n    if (this.#pendingPauseTask) {\n      // 2.1 Set animation’s hold time to seek time.\n      this.#holdTime = seekTime;\n      // 2.2 Apply any pending playback rate to animation.\n      this.#applyPendingPlaybackRate();\n      // 2.3 Make animation’s start time unresolved.\n      this.#startTime = null;\n      // 2.4 Cancel the pending pause task.\n      this.#pendingPauseTask = null;\n      // 2.5 Resolve animation’s current ready promise with animation.\n      this.#resolvers.ready.resolve(this);\n    }\n\n    // 3. Run the procedure to update an animation’s finished state for animation with the did seek flag set to true, and the synchronously notify flag set to false.\n    this.#updateFinishedState(true, false);\n  }\n\n  #setCurrentTimeSilent(seekTime: number | null) {\n    // 1. If seek time is an unresolved time value, then perform the following steps.\n    if (seekTime === null) {\n      if (this.currentTime !== null) {\n        throw new TypeError(\n          \"Failed to set the 'currentTime' property on 'Animation': currentTime may not be changed from resolved to unresolved\"\n        );\n      }\n\n      return;\n    }\n\n    const startTime = this.startTime;\n    const holdTime = this.#holdTime;\n\n    // 2. Update either animation’s hold time or start time as follows:\n    // 3. If animation has no associated timeline or the associated timeline is inactive, make animation’s start time unresolved.\n    if (\n      holdTime ||\n      startTime === null ||\n      this.#timeline === null ||\n      this.#timeline.currentTime === null ||\n      this.playbackRate == 0\n    ) {\n      this.#holdTime = seekTime;\n    } else {\n      this.startTime = this.#calculateStartTime(seekTime);\n    }\n\n    // 4. Make animation’s previous current time unresolved.\n    this.#previousCurrentTime = null;\n  }\n\n  get startTime(): CSSNumberish | null {\n    return this.#startTime;\n  }\n\n  // 4.4.5. Setting the start time of an animation\n  set startTime(newTime: CSSNumberish | null) {\n    // 1. Let timeline time be the current time value of the timeline that animation is associated with. If there is no timeline associated with animation or the associated timeline is inactive, let the timeline time be unresolved.\n    const timelineTime = this.#timeline?.currentTime ?? null;\n\n    // 2. If timeline time is unresolved and new start time is resolved, make animation’s hold time unresolved.\n    if (timelineTime === null && newTime !== null) {\n      this.#holdTime = null;\n    }\n\n    // 3. Let previous current time be animation’s current time.\n    this.#previousCurrentTime = cssNumberishToNumber(this.currentTime);\n\n    // 4. Apply any pending playback rate on animation.\n    this.#applyPendingPlaybackRate();\n\n    // 5. Set animation’s start time to new start time.\n    this.#startTime = cssNumberishToNumber(newTime);\n\n    // 6. Update animation’s hold time based on the first matching condition from the following,\n    if (newTime !== null) {\n      // If animation’s playback rate is not zero, make animation’s hold time unresolved.\n      if (this.playbackRate !== 0) {\n        this.#holdTime = null;\n      }\n    } else {\n      // Set animation’s hold time to previous current time even if previous current time is unresolved.\n      this.#holdTime = this.#previousCurrentTime;\n    }\n\n    // 7. If animation has a pending play task or a pending pause task, cancel that task and resolve animation’s current ready promise with animation.\n    if (this.#hasPendingTask()) {\n      this.#pendingPlayTask = null;\n      this.#pendingPauseTask = null;\n      this.#resolvers.ready.resolve(this);\n    }\n\n    // 8. Run the procedure to update an animation’s finished state for animation with the did seek flag set to true, and the synchronously notify flag set to false.\n    this.#updateFinishedState(true, false);\n  }\n\n  #iteration() {\n    if (!this.#hasKeyframeEffect()) {\n      return;\n    }\n\n    const playState = this.playState;\n    const phase = this.#phase;\n    const fillMode = this.#fillMode;\n    const keyframes = this.effect.getKeyframes();\n\n    if (playState === 'running' || playState === 'finished') {\n      if (this.#previousPhase !== phase) {\n        // describes the beginning of the animation\n        // either a change from idle to before if moving forwards\n        // either a change from idle to after if moving backwards\n        if (this.#previousPhase === 'idle') {\n          // going forwards\n          if (this.playbackRate > 0) {\n            if (\n              phase === 'before' &&\n              (fillMode === 'backwards' || fillMode === 'both')\n            ) {\n              if (keyframes.length > 1) {\n                this.#commitKeyframeStyles(keyframes[0]);\n              }\n            }\n          }\n          // going backwards\n          else {\n            if (\n              phase === 'after' &&\n              (fillMode === 'forwards' || fillMode === 'both')\n            ) {\n              this.#commitKeyframeStyles(keyframes[keyframes.length - 1]);\n            }\n          }\n        } else if (this.#previousPhase === 'active') {\n          if (phase === 'after') {\n            if (fillMode === 'backwards' || fillMode === 'none') {\n              this.#commitKeyframeStyles(this.#initialKeyframe);\n            }\n          } else if (phase === 'before') {\n            if (fillMode === 'forwards' || fillMode === 'none') {\n              this.#commitKeyframeStyles(this.#initialKeyframe);\n            }\n          }\n        }\n      }\n\n      if (phase === 'active') {\n        this.commitStyles();\n      }\n\n      if (playState === 'running') {\n        this.#rafId = requestAnimationFrame(() => {\n          this.#iteration();\n        });\n      }\n\n      this.#previousPhase = phase;\n    }\n\n    this.#updateFinishedState(false, true);\n  }\n\n  #cancelIteration() {\n    if (this.#rafId !== null) {\n      cancelAnimationFrame(this.#rafId);\n      this.#rafId = null;\n    }\n  }\n\n  #playTask() {\n    this.#pendingPlayTask = null;\n\n    // assert timeline\n    if (!this.#isTimelineActive()) {\n      throw new Error(\n        \"Failed to play an 'Animation': the animation's timeline is inactive\"\n      );\n    }\n\n    // 1. Assert that at least one of animation’s start time or hold time is resolved.\n    if (this.#startTime === null && this.#holdTime === null) {\n      throw new Error(\n        \"Failed to play an 'Animation': the start time or hold time must be resolved\"\n      );\n    }\n\n    // 2. Let ready time be the time value of the timeline associated with animation at the moment when animation became ready.\n    const readyTime = this.timeline.currentTime;\n\n    // console.log('readyTime', readyTime, this.#holdTime, this.startTime);\n\n    // 3. Perform the steps corresponding to the first matching condition below, if any:\n    // If animation’s hold time is resolved,\n    //   Apply any pending playback rate on animation.\n    //   Let new start time be the result of evaluating ready time - hold time / playback rate for animation. If the playback rate is zero, let new start time be simply ready time.\n    //   Set the start time of animation to new start time.\n    //   If animation’s playback rate is not 0, make animation’s hold time unresolved.\n    // If animation’s start time is resolved and animation has a pending playback rate,\n    //   Let current time to match be the result of evaluating (ready time - start time) × playback rate for animation.\n    //   Apply any pending playback rate on animation.\n    //   If animation’s playback rate is zero, let animation’s hold time be current time to match.\n    //   Let new start time be the result of evaluating ready time - current time to match / playback rate for animation. If the playback rate is zero, let new start time be simply ready time.\n    //   Set the start time of animation to new start time.\n\n    if (this.#holdTime !== null) {\n      this.#applyPendingPlaybackRate();\n      const readyTimeNum = cssNumberishToNumber(readyTime);\n      if (readyTimeNum === null) return;\n      const holdTimeNum = this.#holdTime;\n      const newStartTime =\n        this.#playbackRate === 0\n          ? readyTimeNum\n          : readyTimeNum - holdTimeNum / this.#playbackRate;\n\n      this.startTime = numberToCSSNumberish(newStartTime);\n    } else if (this.#startTime !== null && this.#pendingPlaybackRate !== null) {\n      const readyTimeNum = cssNumberishToNumber(readyTime);\n      const startTimeNum = cssNumberishToNumber(this.#startTime);\n      if (readyTimeNum === null || startTimeNum === null) return;\n      const currentTimeToMatch =\n        (readyTimeNum - startTimeNum) * this.playbackRate;\n\n      this.#applyPendingPlaybackRate();\n\n      if (this.#playbackRate === 0) {\n        this.#holdTime = currentTimeToMatch;\n      } else {\n        const newStartTime =\n          readyTimeNum - currentTimeToMatch / this.#playbackRate;\n        this.startTime = numberToCSSNumberish(newStartTime);\n      }\n    }\n\n    // 4. Resolve animation’s current ready promise with animation.\n    this.#resolvers.ready.resolve(this);\n\n    // 5. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n    this.#updateFinishedState(false, false);\n  }\n\n  #play(autoRewind: boolean) {\n    // 1. Let aborted pause be a boolean flag that is true if animation has a pending pause task, and false otherwise.\n    const abortedPause = this.#pendingPauseTask !== null;\n\n    // 2. Let has pending ready promise be a boolean flag that is initially false.\n    let hasPendingReadyPromise = false;\n\n    // 3. Let seek time be a time value that is initially unresolved.\n    let seekTime: number | null = null;\n\n    // 4. Let has finite timeline be true if animation has an associated timeline that is not monotonically increasing.\n    const hasFiniteTimeline =\n      this.#timeline && !this.#isTimelineMonotonicallyIncreasing();\n\n    // 5. Perform the steps corresponding to the first matching condition from the following, if any:\n    const currentTime = this.currentTime;\n    const effectEnd = this.#getComputedTiming().endTime;\n\n    // condition 1\n    const currentTimeNum = cssNumberishToNumber(currentTime);\n    const effectEndNum = cssNumberishToNumber(effectEnd);\n    if (\n      this.#effectivePlaybackRate > 0 &&\n      autoRewind &&\n      (currentTimeNum === null || currentTimeNum < 0 || (effectEndNum !== null && currentTimeNum >= effectEndNum))\n    ) {\n      seekTime = 0;\n    }\n    // condition 2\n    else if (\n      this.#effectivePlaybackRate < 0 &&\n      autoRewind &&\n      (currentTimeNum === null || currentTimeNum <= 0 || (effectEndNum !== null && currentTimeNum > effectEndNum))\n    ) {\n      if (effectEndNum === Infinity) {\n        throw new DOMException(\n          \"Failed to execute 'play' on 'Animation': Cannot play reversed Animation with infinite target effect end.\",\n          'InvalidStateError'\n        );\n      }\n\n      seekTime = effectEndNum ?? 0;\n    }\n    // condition 3\n    else if (this.#effectivePlaybackRate === 0 && currentTime === null) {\n      seekTime = 0;\n    }\n\n    // 6. If seek time is resolved,\n    if (seekTime !== null) {\n      if (hasFiniteTimeline) {\n        this.startTime = seekTime;\n        this.#holdTime = null;\n        this.#applyPendingPlaybackRate();\n      } else {\n        this.#holdTime = seekTime;\n      }\n    }\n\n    // 7. If animation’s hold time is resolved, let its start time be unresolved.\n    if (this.#holdTime !== null) {\n      this.startTime = null;\n    }\n\n    // 8. If animation has a pending play task or a pending pause task,\n    if (this.#hasPendingTask()) {\n      this.#pendingPauseTask = null;\n      this.#pendingPlayTask = null;\n      hasPendingReadyPromise = true;\n    }\n\n    // 9. If the following four conditions are all satisfied:\n    // If the following four conditions are all satisfied:\n    //   animation’s hold time is unresolved, and\n    //   seek time is unresolved, and\n    //   aborted pause is false, and\n    //   animation does not have a pending playback rate,\n    //     abort this procedure.\n    if (\n      this.#holdTime === null &&\n      seekTime === null &&\n      !abortedPause &&\n      this.#pendingPlaybackRate === null\n    ) {\n      return;\n    }\n\n    // 10. If has pending ready promise is false, let animation’s current ready promise be a new promise in the relevant Realm of animation.\n    if (!hasPendingReadyPromise) {\n      this.#readyPromise = this.#getNewReadyPromise();\n    }\n\n    // 11. Schedule a task to run as soon as animation is ready. The task shall perform the following steps:\n    this.#pendingPlayTask = () => {\n      this.#playTask();\n    };\n\n    this.ready.then(() => {\n      this.#pendingPlayTask?.();\n      this.#iteration();\n    });\n\n    queueMicrotask(() => {\n      this.#resolvers.ready.resolve(this);\n    });\n\n    // 12. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n    this.#updateFinishedState(false, false);\n  }\n\n  // 4.4.8. Playing an animation\n  // https://www.w3.org/TR/web-animations-1/#playing-an-animation-section\n  play() {\n    this.#play(true);\n  }\n\n  #pauseTask() {\n    this.#pendingPauseTask = null;\n\n    // assert timeline\n    if (!this.#isTimelineActive()) {\n      throw new Error(\n        \"Failed to pause an 'Animation': the animation's timeline is inactive\"\n      );\n    }\n\n    // 1. Let ready time be the time value of the timeline associated with animation at the moment when the user agent completed processing necessary to suspend playback of animation’s associated effect.\n    const readyTime = this.timeline.currentTime;\n\n    // 2. If animation’s start time is resolved and its hold time is not resolved, let animation’s hold time be the result of evaluating (ready time - start time) × playback rate.\n    if (this.#startTime !== null && this.#holdTime === null) {\n      const readyTimeNum = cssNumberishToNumber(readyTime);\n      const startTimeNum = cssNumberishToNumber(this.#startTime);\n      if (readyTimeNum !== null && startTimeNum !== null) {\n        this.#holdTime = (readyTimeNum - startTimeNum) * this.#playbackRate;\n      }\n    }\n\n    // Note: The hold time might be already set if the animation is finished, or if the animation has a pending play task. In either case we want to preserve the hold time as we enter the paused state.\n\n    // 3. Apply any pending playback rate on animation.\n    this.#applyPendingPlaybackRate();\n\n    // 4. Make animation’s start time unresolved.\n    this.#startTime = null;\n\n    // 5. Resolve animation’s current ready promise with animation.\n    this.#resolvers.ready.resolve(this);\n\n    // 6. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n    this.#updateFinishedState(false, false);\n  }\n\n  // 4.4.9. Pausing an animation\n  // https://www.w3.org/TR/web-animations-1/#pausing-an-animation-section\n  pause() {\n    // 1. If animation has a pending pause task, abort these steps.\n    if (this.#pendingPauseTask !== null) {\n      return;\n    }\n\n    // 2. If the play state of animation is paused, abort these steps.\n    if (this.playState === 'paused') {\n      return;\n    }\n\n    // 3. Let seek time be a time value that is initially unresolved.\n    let seekTime: number | null = null;\n\n    // 4. Let has finite timeline be true if animation has an associated timeline that is not monotonically increasing.\n    const hasFiniteTimeline =\n      this.#timeline && !this.#isTimelineMonotonicallyIncreasing();\n\n    // 5. If the animation’s current time is unresolved, perform the steps according to the first matching condition from below:\n    //    If animation’s playback rate is ≥ 0,\n    //      Set seek time to zero.\n    //    Otherwise,\n    //      If associated effect end for animation is positive infinity,\n    //        throw an \"InvalidStateError\" DOMException and abort these steps.\n    //      Otherwise,\n    //        Set seek time to animation’s associated effect end.\n    const currentTime = this.currentTime;\n    const effectEnd = this.#getComputedTiming().endTime;\n\n    if (currentTime === null) {\n      if (this.#playbackRate >= 0) {\n        seekTime = 0;\n      } else {\n        if (effectEnd === Infinity) {\n          throw new DOMException(\n            \"Failed to execute 'pause' on 'Animation': Cannot play reversed Animation with infinite target effect end.\",\n            'InvalidStateError'\n          );\n        } else {\n          const effectEndNum = cssNumberishToNumber(effectEnd);\n          seekTime = effectEndNum ?? 0;\n        }\n      }\n    }\n\n    // 6. If seek time is resolved,\n    //      If has finite timeline is true,\n    //        Set animation’s start time to seek time.\n    //      Otherwise,\n    //        Set animation’s hold time to seek time.\n    if (seekTime !== null) {\n      if (hasFiniteTimeline) {\n        this.startTime = seekTime;\n      } else {\n        this.#holdTime = seekTime;\n      }\n    }\n\n    // 7. Let has pending ready promise be a boolean flag that is initially false.\n    let hasPendingReadyPromise = false;\n\n    // 8. If animation has a pending play task, cancel that task and let has pending ready promise be true.\n    if (this.#pendingPlayTask !== null) {\n      this.#pendingPlayTask = null;\n      hasPendingReadyPromise = true;\n    }\n\n    // 9. If has pending ready promise is false, set animation’s current ready promise to a new promise in the relevant Realm of animation.\n    if (!hasPendingReadyPromise) {\n      this.#readyPromise = this.#getNewReadyPromise();\n    }\n\n    // 10. Schedule a task to be executed at the first possible moment when\n    //       the animation is associated with a timeline that is not inactive.\n    this.#pendingPauseTask = () => {\n      this.#pauseTask();\n    };\n\n    queueMicrotask(() => {\n      this.#pendingPauseTask?.();\n\n      // 11. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n      this.#updateFinishedState(false, false);\n    });\n\n    this.#cancelIteration();\n  }\n\n  // 4.4.12. Updating the finished state\n  // https://www.w3.org/TR/web-animations-1/#updating-the-finished-state\n  #finishNotification() {\n    // 1. If animation’s play state is not equal to finished, abort these steps.\n    if (this.playState !== 'finished') {\n      return;\n    }\n\n    // 2. Resolve animation’s current finished promise object with animation.\n    this.#resolvers.finished.resolve(this);\n\n    // 3. Create an AnimationPlaybackEvent, finishEvent.\n    // Set finishEvent’s type attribute to finish.\n    // Set finishEvent’s currentTime attribute to the current time of animation.\n    // Set finishEvent’s timelineTime attribute to the current time of the timeline with which animation is associated. If animation is not associated with a timeline, or the timeline is inactive, let timelineTime be null.\n    const finishEvent = new AnimationPlaybackEvent('finish', {\n      currentTime: this.currentTime,\n      timelineTime: this.timeline ? this.timeline.currentTime : null,\n    });\n\n    // 7. If animation has a document for timing, then append finishEvent to its document for timing's pending animation event queue along with its target, animation. For the scheduled event time, use the result of converting animation’s associated effect end to an origin-relative time.\n    //    Otherwise, queue a task to dispatch finishEvent at animation. The task source for this task is the DOM manipulation task source.\n\n    const triggerFinish = () => {\n      this.dispatchEvent(finishEvent);\n      this.onfinish?.(finishEvent);\n    };\n\n    if (config.act) {\n      config.act(triggerFinish);\n    } else {\n      triggerFinish();\n    }\n  }\n\n  #queuedFinishNotificationMicrotask: (() => void) | null = null;\n\n  #cancelFinishNotificationMicrotask() {\n    this.#queuedFinishNotificationMicrotask = null;\n  }\n\n  #queueFinishNotificationMicrotask() {\n    if (this.#queuedFinishNotificationMicrotask === null) {\n      this.#queuedFinishNotificationMicrotask = () => {\n        this.#finishNotification();\n        this.#queuedFinishNotificationMicrotask = null;\n      };\n\n      queueMicrotask(() => this.#queuedFinishNotificationMicrotask?.());\n    }\n  }\n\n  #updateFinishedState(\n    // indicates if the update is being performed after setting the current time\n    didSeek: boolean,\n    // indicates the update was called in a context where we expect finished event queueing and finished promise resolution to happen immediately, if at all\n    synchronouslyNotify: boolean\n  ) {\n    // 1. Let the unconstrained current time be the result of calculating the current time substituting an unresolved time value for the hold time if did seek is false. If did seek is true, the unconstrained current time is equal to the current time.\n    const unconstrainedCurrentTime = didSeek\n      ? this.#calculateCurrentTime()\n      : this.currentTime;\n\n    // 2. If all three of the following conditions are true,\n    //   the unconstrained current time is resolved, and\n    //   animation’s start time is resolved, and\n    //   animation does not have a pending play task or a pending pause task, then update animation’s hold time based on the first matching condition for animation from below, if any:\n    //   If playback rate > 0 and unconstrained current time is greater than or equal to associated effect end,\n    //     If did seek is true, let the hold time be the value of unconstrained current time.\n    //     If did seek is false, let the hold time be the maximum value of previous current time and associated  effect end. If the previous current time is unresolved, let the hold time be associated effect end.\n    //   If playback rate < 0 and unconstrained current time is less than or equal to 0,\n    //     If did seek is true, let the hold time be the value of unconstrained current time.\n    //     If did seek is false, let the hold time be the minimum value of previous current time and zero. If the previous current time is unresolved, let the hold time be zero.\n    //   If playback rate ≠ 0, and animation is associated with an active timeline,\n    //     Perform the following steps:\n    //       If did seek is true and the hold time is resolved, let animation’s start time be equal to the result of evaluating timeline time - (hold time / playback rate) where timeline time is the current time value of timeline associated with animation.\n    //       Let the hold time be unresolved.\n    const startTime = this.startTime;\n    const effectEnd = this.#getComputedTiming().endTime;\n\n    if (\n      unconstrainedCurrentTime !== null &&\n      startTime !== null &&\n      !this.#hasPendingTask()\n    ) {\n      // If playback rate > 0 and unconstrained current time is greater than or equal to associated effect end,\n      //   If did seek is true, let the hold time be the value of unconstrained current time.\n      //   If did seek is false, let the hold time be the maximum value of previous current time and associated effect end. If the previous current time is unresolved, let the hold time be associated effect end.\n      // If playback rate < 0 and unconstrained current time is less than or equal to 0,\n      //   If did seek is true, let the hold time be the value of unconstrained current time.\n      //   If did seek is false, let the hold time be the minimum value of previous current time and zero. If the previous current time is unresolved, let the hold time be zero.\n      // If playback rate ≠ 0, and animation is associated with an active timeline,\n      //   Perform the following steps:\n      //   1. If did seek is true and the hold time is resolved, let animation’s start time be equal to the result of evaluating timeline time - (hold time / playback rate) where timeline time is the current time value of timeline associated with animation.\n      //   2. Let the hold time be unresolved.\n      const playbackRate = this.playbackRate;\n\n      const unconstrainedCurrentTimeNum = cssNumberishToNumber(unconstrainedCurrentTime);\n      const effectEndNum = cssNumberishToNumber(effectEnd);\n      if (playbackRate > 0 && unconstrainedCurrentTimeNum !== null && effectEndNum !== null && unconstrainedCurrentTimeNum >= effectEndNum) {\n        if (didSeek) {\n          this.#holdTime = unconstrainedCurrentTimeNum;\n        } else {\n          if (this.#previousCurrentTime === null) {\n            this.#holdTime = effectEndNum;\n          } else {\n            this.#holdTime = Math.max(this.#previousCurrentTime, effectEndNum);\n          }\n        }\n      } else if (playbackRate < 0 && unconstrainedCurrentTimeNum !== null && unconstrainedCurrentTimeNum <= 0) {\n        if (didSeek) {\n          this.#holdTime = unconstrainedCurrentTimeNum;\n        } else {\n          if (this.#previousCurrentTime === null) {\n            this.#holdTime = 0;\n          } else {\n            this.#holdTime = Math.min(this.#previousCurrentTime, 0);\n          }\n        }\n      } else if (playbackRate !== 0 && this.#isTimelineActive()) {\n        if (didSeek && this.#holdTime !== null) {\n          const timelineTimeNum = cssNumberishToNumber(this.timeline.currentTime);\n          if (timelineTimeNum !== null) {\n            this.startTime = numberToCSSNumberish(timelineTimeNum - this.#holdTime / playbackRate);\n          }\n        }\n        this.#holdTime = null;\n      }\n    }\n\n    // 3. Set the previous current time of animation be the result of calculating its current time.\n    this.#previousCurrentTime = this.#calculateCurrentTime();\n\n    // 4. Let current finished state be true if the play state of animation is finished. Otherwise, let it be false.\n    const currentFinishedState = this.playState === 'finished';\n\n    // 5. If current finished state is true and the current finished promise is not yet resolved, perform the following steps\n    //    If synchronously notify is true, cancel any queued microtask to run the finish notification steps for this animation, and run the finish notification steps immediately.\n    //    Otherwise, if synchronously notify is false, queue a microtask to run finish notification steps for animation unless there is already a microtask queued to run those steps for animation.\n    // console.log(\n    //   'finishing!',\n    //   currentFinishedState,\n    //   this.#promiseStates.finished !== 'resolved',\n    //   synchronouslyNotify\n    // );\n\n    if (currentFinishedState && this.#promiseStates.finished !== 'resolved') {\n      if (synchronouslyNotify) {\n        this.#cancelFinishNotificationMicrotask();\n        this.#finishNotification();\n      } else {\n        this.#queueFinishNotificationMicrotask();\n        // this.#queueMicrotask(() => this.#finishNotification());\n      }\n    }\n\n    // 6. If current finished state is false and animation’s current finished promise is already resolved, set animation’s current finished promise to a new promise in the relevant Realm of animation.\n    if (!currentFinishedState && this.#promiseStates.finished === 'resolved') {\n      this.#finishedPromise = this.#getNewFinishedPromise();\n    }\n  }\n\n  // 4.4.13. Finishing an animation\n  finish() {\n    // 1. If animation’s effective playback rate is zero, or if animation’s effective playback rate > 0 and associated effect end is infinity, throw an \"InvalidStateError\" DOMException and abort these steps.\n    const effectivePlaybackRate = this.#effectivePlaybackRate;\n    const effectEnd = this.#getComputedTiming().endTime;\n\n    if (\n      effectivePlaybackRate === 0 ||\n      (effectivePlaybackRate > 0 && effectEnd === Infinity)\n    ) {\n      throw new DOMException(\n        \"Failed to execute 'finish' on 'Animation': Cannot finish Animation with an infinite target effect end.\",\n        'InvalidStateError'\n      );\n    }\n\n    // 2. Apply any pending playback rate to animation.\n    this.#applyPendingPlaybackRate();\n\n    // 3. Set limit as follows:\n    //      If playback rate > 0,\n    //        Let limit be associated effect end.\n    //      Otherwise,\n    //        Let limit be zero.\n    const limit = this.#playbackRate > 0 ? effectEnd : 0;\n\n    // 4. Silently set the current time to limit.\n    const limitNum = cssNumberishToNumber(limit);\n    if (limitNum !== null) {\n      this.#setCurrentTimeSilent(limitNum);\n    }\n\n    // 5. If animation’s start time is unresolved and animation has an associated active timeline, let the start time be the result of evaluating timeline time - (limit / playback rate) where timeline time is the current time value of the associated timeline.\n    if (this.#startTime === null && this.#isTimelineActive()) {\n      const timelineTimeNum = cssNumberishToNumber(this.timeline.currentTime);\n      if (timelineTimeNum !== null && limitNum !== null) {\n        this.#startTime = timelineTimeNum - limitNum / this.#playbackRate;\n      }\n    }\n\n    // 6. If there is a pending pause task and start time is resolved,\n    // 6.1 Let the hold time be unresolved.\n    //     > Typically the hold time will already be unresolved except in the case when the animation was previously idle.\n    // 6.2 Cancel the pending pause task.\n    // 6.3 Resolve the current ready promise of animation with animation.\n    if (this.#pendingPauseTask !== null && this.#startTime !== null) {\n      this.#holdTime = null;\n      this.#pendingPauseTask = null;\n      this.#resolvers.ready.resolve(this);\n    }\n\n    // 7. If there is a pending play task and start time is resolved, cancel that task and resolve the current ready promise of animation with animation.\n    if (this.#pendingPlayTask !== null && this.#startTime !== null) {\n      this.#pendingPlayTask = null;\n      this.#resolvers.ready.resolve(this);\n    }\n\n    // 8. Run the procedure to update an animation’s finished state for animation with the did seek flag set to true, and the synchronously notify flag set to true.\n    this.#updateFinishedState(true, true);\n  }\n\n  // 4.4.14. Canceling an animation\n  // https://www.w3.org/TR/web-animations-1/#canceling-an-animation-section\n  cancel() {\n    if (!this.#hasKeyframeEffect()) {\n      return;\n    }\n\n    // 1. If animation’s play state is not idle, perform the following steps:\n    if (this.playState !== 'idle') {\n      // Run the procedure to reset an animation’s pending tasks on animation.\n      this.#resetPendingTasks();\n\n      // Reject the current finished promise with a DOMException named \"AbortError\".\n      this.#silentlyRejectFinishedPromise(\n        new DOMException('The user aborted a request.', 'AbortError')\n      );\n\n      // Set the [[PromiseIsHandled]] internal slot of the current finished promise to true.\n\n      // Let current finished promise be a new promise in the relevant Realm of animation.\n      this.#finishedPromise = this.#getNewFinishedPromise();\n\n      // Let timeline time be the current time of the timeline with which animation is associated. If animation is not associated with an active timeline, let timeline time be n unresolved time value.\n      const timelineTime = this.timeline?.currentTime ?? null;\n\n      // Create an AnimationPlaybackEvent, cancelEvent.\n      // Set cancelEvent’s type attribute to cancel.\n      // Set cancelEvent’s currentTime to null.\n      // Set cancelEvent’s timelineTime to timeline time. If timeline time is unresolved, set it to null.\n      const cancelEvent = new AnimationPlaybackEvent('cancel', {\n        currentTime: null,\n        timelineTime,\n      });\n\n      // If animation has a document for timing, then append cancelEvent to its document for timing's pending animation event queue along with its target, animation. If animation is associated with an active timeline that defines a procedure to convert timeline times to origin-relative time, let the scheduled event time be the result of applying that procedure to timeline time. Otherwise, the scheduled event time is an unresolved time value.\n\n      // Otherwise, queue a task to dispatch cancelEvent at animation. The task source for this task is the DOM manipulation task source.\n\n      const triggerCancel = () => {\n        this.dispatchEvent(cancelEvent);\n        this.oncancel?.(cancelEvent);\n      };\n\n      if (config.act) {\n        config.act(triggerCancel);\n      } else {\n        triggerCancel();\n      }\n    } else {\n      // it's not in the spec, but chrome does it\n      this.#pendingPlaybackRate = null;\n      this.#pendingPauseTask = this.#pendingPlayTask = null;\n    }\n\n    // 2. Make animation’s hold time unresolved.\n    this.#holdTime = null;\n\n    // 3. Make animation’s start time unresolved.\n    this.#startTime = null;\n  }\n\n  get playbackRate() {\n    return this.#playbackRate;\n  }\n\n  // 4.4.15.1. Setting the playback rate of an animation\n  set playbackRate(rate: number) {\n    // 1. Clear any pending playback rate on animation.\n    this.#pendingPlaybackRate = null;\n\n    // 2. Let previous time be the value of the current time of animation before changing the playback rate.\n    const previousTime = this.currentTime;\n\n    // 3. Set the playback rate to new playback rate.\n    this.#playbackRate = rate;\n\n    // 4. If previous time is resolved, set the current time of animation to previous time\n    if (previousTime !== null) {\n      const previousTimeNum = cssNumberishToNumber(previousTime);\n      if (previousTimeNum !== null) {\n        this.currentTime = previousTimeNum;\n      }\n    }\n  }\n\n  // 4.4.15.2. Seamlessly updating the playback rate of an animation\n  // https://www.w3.org/TR/web-animations-1/#seamlessly-updating-the-playback-rate-of-an-animation\n  updatePlaybackRate(playbackRate: number) {\n    // 1. Let previous play state be animation’s play state.\n    const previousPlayState = this.playState;\n\n    // 2. Let animation’s pending playback rate be new playback rate.\n    this.#pendingPlaybackRate = playbackRate;\n\n    // 3. Perform the steps corresponding to the first matching condition from below:\n    // If animation has a pending play task or a pending pause task, abort these steps.\n    if (this.#hasPendingTask()) {\n      return;\n    }\n\n    switch (previousPlayState) {\n      // If previous play state is idle or paused, apply any pending playback rate on animation.\n      case 'idle':\n      case 'paused':\n        this.#applyPendingPlaybackRate();\n        break;\n\n      case 'finished':\n        {\n          // 1. Let the unconstrained current time be the result of calculating the current time of animation substituting an unresolved time value for the hold time.\n          const unconstrainedCurrentTime =\n            this.#calculateCurrentTime() ?? this.#holdTime;\n\n          // 2. Let animation’s start time be the result of evaluating the following expression:\n          // timeline time - (unconstrained current time / pending playback rate)\n          // Where timeline time is the current time value of the timeline associated with animation.\n          const timelineTime = this.timeline?.currentTime ?? null;\n\n          if (this.#pendingPlaybackRate !== 0) {\n            if (timelineTime) {\n              const timelineTimeNum = cssNumberishToNumber(timelineTime);\n              const unconstrainedCurrentTimeNum = cssNumberishToNumber(unconstrainedCurrentTime);\n              if (timelineTimeNum !== null) {\n                this.#startTime = unconstrainedCurrentTimeNum\n                  ? timelineTimeNum -\n                    unconstrainedCurrentTimeNum / this.#pendingPlaybackRate\n                  : null;\n              }\n            }\n          } else {\n            // 3. If pending playback rate is zero, let animation’s start time be timeline time.\n            const timelineTimeNum = cssNumberishToNumber(timelineTime);\n            this.#startTime = timelineTimeNum;\n          }\n\n          // 4. Apply any pending playback rate on animation.\n          this.#applyPendingPlaybackRate();\n\n          // 5. Run the procedure to update an animation’s finished state for animation with the did seek flag set to false, and the synchronously notify flag set to false.\n          this.#updateFinishedState(false, false);\n        }\n        break;\n\n      case 'running':\n        this.#cancelIteration();\n\n        // Run the procedure to play an animation for animation with the auto-rewind flag set to false.\n        this.#play(false);\n        break;\n    }\n  }\n\n  // 4.4.16. Reversing an animation\n  // https://www.w3.org/TR/web-animations-1/#reversing-an-animation-section\n  reverse() {\n    // 1. If there is no timeline associated with animation, or the associated timeline is inactive throw an \"InvalidStateError\" DOMException and abort these steps.\n    if (this.timeline === null || !this.#isTimelineActive()) {\n      throw new DOMException(\n        'Cannot reverse an animation with no active timeline',\n        'InvalidStateError'\n      );\n    }\n\n    // 2. Let original pending playback rate be animation’s pending playback rate.\n    const originalPendingPlaybackRate = this.#pendingPlaybackRate;\n\n    // 3. Let animation’s pending playback rate be the additive inverse of its effective playback rate (i.e. -effective playback rate).\n    this.#pendingPlaybackRate = -this.#effectivePlaybackRate;\n\n    this.#cancelIteration();\n\n    // 4. Run the steps to play an animation for animation with the auto-rewind flag set to true.\n    //    If the steps to play an animation throw an exception, set animation’s pending playback rate to original pending playback rate and propagate the exception.\n    try {\n      this.#play(true);\n    } catch (error) {\n      this.#pendingPlaybackRate = originalPendingPlaybackRate;\n      throw error;\n    }\n  }\n\n  // 4.4.17. Play states\n  // https://www.w3.org/TR/web-animations-1/#play-states\n  get playState() {\n    // The play state of animation, animation, at a given moment is the state corresponding to the first matching condition from the following:\n\n    const currentTime = this.currentTime;\n\n    // All of the following conditions are true:\n    //   The current time of animation is unresolved, and\n    //   the start time of animation is unresolved, and\n    //   animation does not have either a pending play task or a pending pause task,\n    //     → idle\n    if (\n      currentTime === null &&\n      this.#startTime === null &&\n      !this.#hasPendingTask()\n    ) {\n      return 'idle';\n    }\n\n    // Either of the following conditions are true:\n    //   animation has a pending pause task, or\n    //   both the start time of animation is unresolved and it does not have a pending play task,\n    //     → paused\n    else if (\n      this.#pendingPauseTask !== null ||\n      (this.startTime === null && this.#pendingPlayTask === null)\n    ) {\n      return 'paused';\n    }\n\n    // For animation, current time is resolved and either of the following conditions are true:\n    //   animation’s effective playback rate > 0 and current time ≥ associated effect end; or\n    //   animation’s effective playback rate < 0 and current time ≤ 0,\n    //     → finished\n    else if (\n      currentTime !== null &&\n      ((this.#effectivePlaybackRate > 0 &&\n        (() => {\n          const currentTimeNum = cssNumberishToNumber(currentTime);\n          const endTimeNum = cssNumberishToNumber(this.#getComputedTiming().endTime);\n          return currentTimeNum !== null && endTimeNum !== null && currentTimeNum >= endTimeNum;\n        })()) ||\n        (this.#effectivePlaybackRate < 0 && (() => {\n          const currentTimeNum = cssNumberishToNumber(currentTime);\n          return currentTimeNum !== null && currentTimeNum <= 0;\n        })()))\n    ) {\n      return 'finished';\n    }\n\n    // Otherwise,\n    //   → running\n    else {\n      return 'running';\n    }\n  }\n\n  set playState(_newPlayState: AnimationPlayState) {\n    throw new TypeError(\n      'Cannot set property playState of #<Animation> which has only a getter'\n    );\n  }\n\n  // 4.8.3.1. Calculating the active time\n  // If the animation effect is in the before phase,\n  //   The result depends on the first matching condition from the following,\n  //     If the fill mode is backwards or both,\n  //       Return the result of evaluating max(local time - start delay, 0).\n  //     Otherwise,\n  //       Return an unresolved time value.\n  // If the animation effect is in the active phase,\n  //   Return the result of evaluating local time - start delay.\n  // If the animation effect is in the after phase,\n  //   The result depends on the first matching condition from the following,\n  //     If the fill mode is forwards or both,\n  //       Return the result of evaluating max(min(local time - start delay, active duration), 0).\n  //     Otherwise,\n  //       Return an unresolved time value.\n  // Otherwise (the local time is unresolved),\n  //   Return an unresolved time value.\n  get #activeTime() {\n    const computedTiming = this.#getComputedTiming();\n    const localTime = this.#localTime;\n\n    if (localTime === null) {\n      return null;\n    }\n\n    switch (this.#phase) {\n      case 'before':\n        if (this.#fillMode === 'backwards' || this.#fillMode === 'both') {\n          const localTimeNum = cssNumberishToNumber(localTime);\n          const delayNum = cssNumberishToNumber(computedTiming.delay);\n          if (localTimeNum !== null && delayNum !== null) {\n            return Math.max(localTimeNum - delayNum, 0);\n          }\n          return null;\n        } else {\n          return null;\n        }\n      case 'active': {\n        const localTimeNum = cssNumberishToNumber(localTime);\n        const delayNum = cssNumberishToNumber(computedTiming.delay);\n        if (localTimeNum !== null && delayNum !== null) {\n          return localTimeNum - delayNum;\n        }\n        return null;\n      }\n      case 'after':\n        if (this.#fillMode === 'forwards' || this.#fillMode === 'both') {\n          const localTimeNum = cssNumberishToNumber(localTime);\n          const delayNum = cssNumberishToNumber(computedTiming.delay);\n          const activeDurationNum = cssNumberishToNumber(computedTiming.activeDuration);\n          if (localTimeNum !== null && delayNum !== null && activeDurationNum !== null) {\n            return Math.max(\n              Math.min(\n                localTimeNum - delayNum,\n                activeDurationNum\n              ),\n              0\n            );\n          }\n          return null;\n        } else {\n          return null;\n        }\n      default:\n        return null;\n    }\n  }\n\n  // 4.8.3.2. Calculating the overall progress\n  // The overall progress describes the number of iterations that have completed (including partial iterations) and is defined as follows:\n  // 1. If the active time is unresolved, return unresolved.\n  // 2. Calculate an initial value for overall progress based on the first matching condition from below,\n  //   If the iteration duration is zero,\n  //     If the animation effect is in the before phase, let overall progress be zero, otherwise, let it be equal to the iteration count.\n  //   Otherwise,\n  //     Let overall progress be the result of calculating active time / iteration duration.\n  // 3. Return the result of calculating overall progress + iteration start.\n  get #overallProgress() {\n    const activeTime = this.#activeTime;\n\n    if (activeTime === null) {\n      return null;\n    }\n\n    const computedTiming = this.#getComputedTiming();\n\n    let overallProgress: number;\n\n    if (computedTiming.duration === 0) {\n      if (this.#phase === 'before') {\n        overallProgress = 0;\n      } else {\n        overallProgress = computedTiming.iterations;\n      }\n    } else {\n      overallProgress = activeTime / computedTiming.duration;\n    }\n\n    return overallProgress + computedTiming.iterationStart;\n  }\n\n  // 4.8.3.3. Calculating the simple iteration progress\n  // https://www.w3.org/TR/web-animations-1/#calculating-the-simple-iteration-progress\n  // The simple iteration progress is a fraction of the progress through the current iteration that ignores transformations to the time introduced by the playback direction or timing functions applied to the effect, and is calculated as follows:\n  // 1. If the overall progress is unresolved, return unresolved.\n  // 2. If overall progress is infinity, let the simple iteration progress be iteration start % 1.0, otherwise, let the simple iteration progress be overall progress % 1.0.\n  // 3. If all of the following conditions are true,\n  //   the simple iteration progress calculated above is zero, and\n  //   the animation effect is in the active phase or the after phase, and\n  //   the active time is equal to the active duration, and\n  //   the iteration count is not equal to zero.\n  // let the simple iteration progress be 1.0.\n  // 4. Return simple iteration progress.\n  get #iterationProgress() {\n    const overallProgress = this.#overallProgress;\n\n    if (overallProgress === null) {\n      return null;\n    }\n\n    const computedTiming = this.#getComputedTiming();\n\n    let iterationProgress: number;\n\n    if (overallProgress === Infinity) {\n      iterationProgress = computedTiming.iterationStart % 1.0;\n    } else {\n      iterationProgress = overallProgress % 1.0;\n    }\n\n    if (\n      iterationProgress === 0 &&\n      (this.#phase === 'active' || this.#phase === 'after') &&\n      this.#activeTime === computedTiming.activeDuration &&\n      computedTiming.iterations !== 0\n    ) {\n      iterationProgress = 1.0;\n    }\n\n    return iterationProgress;\n  }\n\n  // 4.8.4. Calculating the current iteration\n  // https://www.w3.org/TR/web-animations-1/#calculating-the-current-iteration\n  // The current iteration can be calculated using the following steps:\n  //   If the active time is unresolved, return unresolved.\n  //   If the animation effect is in the after phase and the iteration count is infinity, return infinity.\n  //   If the simple iteration progress is 1.0, return floor(overall progress) - 1.\n  //   Otherwise, return floor(overall progress).\n  get #currentIteration() {\n    const activeTime = this.#activeTime;\n\n    if (activeTime === null) {\n      return null;\n    }\n\n    const timing = this.#getTiming();\n\n    if (this.#phase === 'after' && timing.iterations === Infinity) {\n      return Infinity;\n    }\n\n    const iterationProgress = this.#iterationProgress;\n\n    // overall progress should be defined here, see #overallProgress getter\n    const overallProgress = this.#overallProgress;\n    if (overallProgress === null) {\n      // This case should ideally not be reached if activeTime is not null,\n      // but as a fallback, we can return 0.\n      return 0;\n    }\n\n    if (iterationProgress === 1.0) {\n      return Math.floor(overallProgress) - 1;\n    } else {\n      return Math.floor(overallProgress);\n    }\n  }\n\n  // 4.9.1. Calculating the directed progress\n  // https://www.w3.org/TR/web-animations-1/#calculating-the-directed-progress\n  // The directed progress is calculated from the simple iteration progress using the following steps:\n  // 1. If the simple iteration progress is unresolved, return unresolved.\n  // 2. Calculate the current direction using the first matching condition from the following list:\n  //   If playback direction is normal,\n  //     Let the current direction be forwards.\n  //   If playback direction is reverse,\n  //     Let the current direction be reverse.\n  //   Otherwise,\n  //     Let d be the current iteration.\n  //     If playback direction is alternate-reverse increment d by 1.\n  //     If d % 2 == 0, let the current direction be forwards, otherwise let the current direction be reverse. If d is infinity, let the current direction be forwards.\n  // 3. If the current direction is forwards then return the simple iteration progress.\n  //   Otherwise, return 1.0 - simple iteration progress.\n  get #currentDirection() {\n    if (this.#currentIteration === null) {\n      return null;\n    }\n\n    const timing = this.#getTiming();\n\n    let currentDirection: 'forwards' | 'reverse';\n    const playbackDirection = timing.direction;\n\n    if (playbackDirection === 'normal') {\n      currentDirection = 'forwards';\n    } else if (playbackDirection === 'reverse') {\n      currentDirection = 'reverse';\n    } else {\n      let currentIteration = this.#currentIteration;\n\n      if (playbackDirection === 'alternate-reverse') {\n        currentIteration += 1;\n      }\n\n      if (currentIteration === Infinity || currentIteration % 2 === 0) {\n        currentDirection = 'forwards';\n      } else {\n        currentDirection = 'reverse';\n      }\n    }\n\n    return currentDirection;\n  }\n\n  get #directedProgress() {\n    const iterationProgress = this.#iterationProgress;\n\n    if (iterationProgress === null) {\n      return null;\n    }\n\n    const currentDirection = this.#currentDirection;\n\n    if (currentDirection === 'forwards') {\n      return iterationProgress;\n    } else {\n      return 1.0 - iterationProgress;\n    }\n  }\n\n  // 4.10.1. Calculating the transformed progress\n  // https://www.w3.org/TR/web-animations-1/#calculating-the-transformed-progress\n  // The transformed progress is calculated from the directed progress using the following steps:\n  // 1. If the directed progress is unresolved, return unresolved.\n  // 2. Calculate the value of the before flag as follows:\n  // 2.1. Determine the current direction using the procedure defined in §4.9.1 Calculating the directed progress.\n  // 2.2. If the current direction is forwards, let going forwards be true, otherwise it is false.\n  // 2.3. The before flag is set if the animation effect is in the before phase and going forwards is true; or if the animation effect is in the after phase and going forwards is false.\n  // 3. Return the result of evaluating the animation effect’s timing function passing directed progress as the input progress value and before flag as the before flag.\n  get #transformedProgress() {\n    const directedProgress = this.#directedProgress;\n    const timing = this.#getTiming();\n\n    if (directedProgress === null || typeof timing === 'undefined') {\n      return null;\n    }\n\n    const timingFunction = getEasingFunctionFromString(timing.easing);\n\n    const currentDirection = directedProgress >= 0 ? 'forwards' : 'reverse';\n\n    const beforeFlag =\n      (this.#phase === 'before' && currentDirection === 'forwards') ||\n      (this.#phase === 'after' && currentDirection === 'reverse');\n\n    return timingFunction(directedProgress, beforeFlag);\n  }\n\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null =\n    null;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null =\n    null;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  onremove: ((this: Animation, ev: Event) => any) | null = null;\n\n  #commitKeyframeStyles(keyframe: ComputedKeyframeWithOptionalNonStyleProps) {\n    if (!(this.#effect instanceof KeyframeEffect)) {\n      return;\n    }\n\n    const element = this.#effect.target as HTMLElement;\n    const { composite, computedOffset, easing, offset, ...keyframeStyles } =\n      keyframe;\n\n    for (const property in keyframeStyles) {\n      const value = keyframeStyles[property];\n\n      if (typeof value === 'undefined' || value === null) {\n        element.style.removeProperty(property);\n        continue;\n      }\n\n      const valueAsString =\n        typeof value === 'string' ? value : value.toString();\n\n      element.style.setProperty(property, valueAsString);\n    }\n  }\n\n  // this mock doesn't calculate intermediate styles,\n  // only the ones defined in keyframes\n  commitStyles() {\n    if (\n      !(this.#effect instanceof KeyframeEffect) ||\n      !this.#isTimelineActive()\n    ) {\n      return;\n    }\n\n    const keyframes = this.#effect.getKeyframes();\n    // const currentProgress = this.#effect.getComputedTiming().progress;\n    const currentProgress = this.#transformedProgress;\n    const currentDirection = this.#currentDirection;\n\n    if (\n      keyframes.length === 0 ||\n      currentProgress === null ||\n      currentDirection === null ||\n      !this.#effect.target\n    ) {\n      return;\n    }\n\n    if (\n      keyframes.length === 1 &&\n      ((currentDirection === 'forwards' && currentProgress <= 0.5) ||\n        (currentDirection === 'reverse' && currentProgress >= 0.5))\n    ) {\n      this.#commitKeyframeStyles(this.#initialKeyframe);\n      return;\n    }\n\n    // find the keyframe closest to the current progress\n    let closestKeyframe: ComputedKeyframe = keyframes[0];\n    let smallestDistance = Infinity;\n\n    for (const keyframe of keyframes) {\n      const distance = Math.abs(keyframe.computedOffset - currentProgress);\n\n      if (distance < smallestDistance) {\n        smallestDistance = distance;\n        closestKeyframe = keyframe;\n      }\n    }\n\n    this.#commitKeyframeStyles(closestKeyframe);\n  }\n\n  persist() {\n    console.log(\"persist isn't implemented yet\");\n  }\n}\n\nfunction mockAnimation() {\n  mockKeyframeEffect();\n  mockAnimationPlaybackEvent();\n  mockDocumentTimeline();\n\n  if (typeof Animation === 'undefined') {\n    Object.defineProperty(window, 'Animation', {\n      writable: true,\n      configurable: true,\n      value: MockedAnimation,\n    });\n  }\n}\n\nexport { MockedAnimation, mockAnimation };\n","import { mockAnimation } from './Animation';\nimport {\n  getAnimations,\n  getAllAnimations,\n  clearAnimations,\n} from './elementAnimations';\nimport { getConfig } from '../../tools';\nimport { isJsdomEnv, WrongEnvironmentError } from '../../helper';\n\nconst config = getConfig();\n\nfunction animate(\n  this: Element,\n  keyframes: Keyframe[],\n  options?: number | KeyframeAnimationOptions\n) {\n  const keyframeEffect = new KeyframeEffect(this, keyframes, options);\n\n  const animation = new Animation(keyframeEffect);\n  if (typeof options == 'object' && options.id) {\n    animation.id = options.id;\n  }\n\n  animation.play();\n\n  return animation;\n}\n\nfunction mockAnimationsApi() {\n  if (!isJsdomEnv()) {\n    throw new WrongEnvironmentError();\n  }\n\n  const savedAnimate = Element.prototype.animate;\n  const savedGetAnimations = Element.prototype.getAnimations;\n  const savedGetAllAnimations = Document.prototype.getAnimations;\n\n  mockAnimation();\n\n  Object.defineProperties(Element.prototype, {\n    animate: {\n      writable: true,\n      configurable: true,\n      value: animate,\n    },\n    getAnimations: {\n      writable: true,\n      configurable: true,\n      value: getAnimations,\n    },\n  });\n\n  Object.defineProperty(Document.prototype, 'getAnimations', {\n    writable: true,\n    configurable: true,\n    value: getAllAnimations,\n  });\n\n  config.afterEach(() => {\n    clearAnimations();\n  });\n\n  config.afterAll(() => {\n    Element.prototype.animate = savedAnimate;\n    Element.prototype.getAnimations = savedGetAnimations;\n    Document.prototype.getAnimations = savedGetAllAnimations;\n  });\n}\n\nexport { mockAnimationsApi };\n"]}