hunk.code_window:   /**
      * The `requestAnimationFrame` function or a custom scheduler.
      */
     requestFrame: typeof requestAnimationFrame
     constructor({
       update,
       onFrame,
       requestFrame,
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.after_edit:   requestFrame: RequestFrameFn
  
hunk.file_path: packages/core/src/FrameLoop.ts
hunk.type: replace
file: import * as konva from 'react-konva'
  import { createAnimatedComponent, withExtend } from '@react-spring/animated'
  import { AssignableKeys, SpringValue } from 'shared'
  import {
    ElementType,
    CSSProperties,
    ComponentPropsWithRef,
    ForwardRefExoticComponent,
  } from 'react'
  
  type KonvaExports = typeof konva
  
  type KonvaElements = {
    [P in keyof KonvaExports]: KonvaExports[P] extends ElementType ? P : never
  }[keyof KonvaExports]
  
  type KonvaComponents = {
    [Tag in KonvaElements]: AnimatedComponent<KonvaExports[Tag]>
  }
  
  const elements: KonvaElements[] = [
    'Arc',
    'Arrow',
    'Circle',
    'Ellipse',
    'FastLayer',
    'Group',
    'Image',
    'Label',
    'Layer',
    'Line',
    'Path',
    'Rect',
    'RegularPolygon',
    'Ring',
    'Shape',
    'Sprite',
    'Star',
    'Tag',
    'Text',
    'TextPath',
    'Transformer',
    'Wedge',
  ]
  
  type CreateAnimated = <T extends ElementType>(
    wrappedComponent: T
  ) => AnimatedComponent<T>
  
  // Extend animated with all the available Konva elements
  export const animated = withExtend(createAnimatedComponent as CreateAnimated &
    KonvaComponents).extend(elements)
  
  export { animated as a }
  
  /** The type of an `animated()` component */
  export type AnimatedComponent<
    T extends ElementType
  > = ForwardRefExoticComponent<AnimatedProps<ComponentPropsWithRef<T>>>
  
  /** The props of an `animated()` component */
  export type AnimatedProps<Props extends object> = {
    [P in keyof Props]: (P extends 'ref' ? Props[P] : AnimatedProp<Props[P]>)
  }
  
  // The animated prop value of a React element
  type AnimatedProp<T> = [T, T] extends [infer T, infer DT]
    ? [DT] extends [never]
      ? never
      : DT extends void
      ? undefined
      : DT extends object
      ? [AssignableKeys<DT, CSSProperties>] extends [never]
        ? DT extends ReadonlyArray<any>
          ? AnimatedStyles<DT>
          : DT
        : AnimatedStyle<T>
      : DT | AnimatedLeaf<T>
    : never
  
  // An animated array of style objects
  type AnimatedStyles<T extends ReadonlyArray<any>> = {
    [P in keyof T]: [T[P]] extends [infer DT]
      ? DT extends object
        ? [AssignableKeys<DT, CSSProperties>] extends [never]
          ? DT extends ReadonlyArray<any>
            ? AnimatedStyles<DT>
            : DT
          : { [P in keyof DT]: AnimatedProp<DT[P]> }
        : DT
      : never
  }
  
  // An animated object of style attributes
  type AnimatedStyle<T> = [T, T] extends [infer T, infer DT]
    ? DT extends void
      ? undefined
      : [DT] extends [never]
      ? never
      : DT extends object
      ? { [P in keyof DT]: AnimatedStyle<DT[P]> }
      : DT | AnimatedLeaf<T>
    : never
  
  // An animated value that is not an object
  type AnimatedLeaf<T> = [T] extends [object]
    ? never
    : SpringValue<Exclude<T, object | void>>
  