import "./configureLottie.js";
import { AnyTag, ElementProps, LottieHandle, LottieRenderer } from "./types.js";
import { UseLottieOptions } from "./useLottieAnimation.js";
import { ReactNode, Ref } from "react";
//#region src/animation/createLottieComponent.d.ts
/**
 * What a Lottie component owns, on top of everything the animation takes.
 *
 * Every name here is checked against the attributes of the elements `as`
 * permits, so none of them can quietly take an attribute away from a consumer.
 */
interface LottieOwnProps<Children extends ReactNode, Renderer extends LottieRenderer> extends UseLottieOptions<Renderer> {
  /** Which element to render. A `div` unless you say otherwise. */
  as?: unknown;
  /**
   * Anything at all. Passing children means you place the animation yourself
   * with `<LottieDisplay>`, and this component renders only the box around it.
   */
  children?: Children;
  /** Added to the library's class rather than replacing it. */
  className?: string;
  /**
   * Where to put the imperative handle: the commands, without the values.
   *
   * `ref` names the element, because this component accepts that element's
   * whole attribute set, so the handle needs somewhere of its own to go. Write
   * `useRef<LottieHandle>(null)`; no ref type is exported.
   */
  lottieRef?: Ref<LottieHandle>;
}
/** What a Lottie component accepts for a given element. */
type LottieComponentProps<As extends AnyTag, Children extends ReactNode, Renderer extends LottieRenderer> = ElementProps<LottieOwnProps<Children, Renderer>, As, Children, Renderer>;
/**
 * A component that renders an animation, still generic in its element, its
 * children and its renderer once the engine has been chosen.
 *
 * Written out as a call signature rather than inferred, because a function that
 * returns a component would otherwise settle those parameters at the moment the
 * component is created and hand back something that is no longer polymorphic.
 */
type LottieComponent<Renderers extends LottieRenderer> = <As extends AnyTag = "div", Children extends ReactNode = undefined, Renderer extends Renderers = Extract<Renderers, typeof LottieRenderer.svg>>(props: LottieComponentProps<As, Children, Renderer> & {
  ref?: Ref<HTMLElement>;
}) => ReactNode;
//#endregion
export { LottieComponent, LottieComponentProps, LottieOwnProps };