import C from "./index-extends.js";
import x from "./index-objectWithoutPropertiesLoose.js";
import N from "./index-inheritsLoose.js";
import v from "./index-_virtual16.js";
import A from "./index-addClass.js";
import _ from "./index-removeClass.js";
import c from "react";
import E from "./index-Transition.js";
import { classNamesShape as $ } from "./index-PropTypes.js";
import { forceReflow as S } from "./index-reflow.js";
var T = function(i, p) {
  return i && p && p.split(" ").forEach(function(s) {
    return A(i, s);
  });
}, d = function(i, p) {
  return i && p && p.split(" ").forEach(function(s) {
    return _(i, s);
  });
}, g = /* @__PURE__ */ (function(u) {
  N(i, u);
  function i() {
    for (var s, t = arguments.length, a = new Array(t), o = 0; o < t; o++)
      a[o] = arguments[o];
    return s = u.call.apply(u, [this].concat(a)) || this, s.appliedClasses = {
      appear: {},
      enter: {},
      exit: {}
    }, s.onEnter = function(e, r) {
      var n = s.resolveArguments(e, r), l = n[0], m = n[1];
      s.removeClasses(l, "exit"), s.addClass(l, m ? "appear" : "enter", "base"), s.props.onEnter && s.props.onEnter(e, r);
    }, s.onEntering = function(e, r) {
      var n = s.resolveArguments(e, r), l = n[0], m = n[1], f = m ? "appear" : "enter";
      s.addClass(l, f, "active"), s.props.onEntering && s.props.onEntering(e, r);
    }, s.onEntered = function(e, r) {
      var n = s.resolveArguments(e, r), l = n[0], m = n[1], f = m ? "appear" : "enter";
      s.removeClasses(l, f), s.addClass(l, f, "done"), s.props.onEntered && s.props.onEntered(e, r);
    }, s.onExit = function(e) {
      var r = s.resolveArguments(e), n = r[0];
      s.removeClasses(n, "appear"), s.removeClasses(n, "enter"), s.addClass(n, "exit", "base"), s.props.onExit && s.props.onExit(e);
    }, s.onExiting = function(e) {
      var r = s.resolveArguments(e), n = r[0];
      s.addClass(n, "exit", "active"), s.props.onExiting && s.props.onExiting(e);
    }, s.onExited = function(e) {
      var r = s.resolveArguments(e), n = r[0];
      s.removeClasses(n, "exit"), s.addClass(n, "exit", "done"), s.props.onExited && s.props.onExited(e);
    }, s.resolveArguments = function(e, r) {
      return s.props.nodeRef ? [s.props.nodeRef.current, e] : [e, r];
    }, s.getClassNames = function(e) {
      var r = s.props.classNames, n = typeof r == "string", l = n && r ? r + "-" : "", m = n ? "" + l + e : r[e], f = n ? m + "-active" : r[e + "Active"], h = n ? m + "-done" : r[e + "Done"];
      return {
        baseClassName: m,
        activeClassName: f,
        doneClassName: h
      };
    }, s;
  }
  var p = i.prototype;
  return p.addClass = function(t, a, o) {
    var e = this.getClassNames(a)[o + "ClassName"], r = this.getClassNames("enter"), n = r.doneClassName;
    a === "appear" && o === "done" && n && (e += " " + n), o === "active" && t && S(t), e && (this.appliedClasses[a][o] = e, T(t, e));
  }, p.removeClasses = function(t, a) {
    var o = this.appliedClasses[a], e = o.base, r = o.active, n = o.done;
    this.appliedClasses[a] = {}, e && d(t, e), r && d(t, r), n && d(t, n);
  }, p.render = function() {
    var t = this.props;
    t.classNames;
    var a = x(t, ["classNames"]);
    return /* @__PURE__ */ c.createElement(E, C({}, a, {
      onEnter: this.onEnter,
      onEntered: this.onEntered,
      onEntering: this.onEntering,
      onExit: this.onExit,
      onExiting: this.onExiting,
      onExited: this.onExited
    }));
  }, i;
})(c.Component);
g.defaultProps = {
  classNames: ""
};
g.propTypes = process.env.NODE_ENV !== "production" ? C({}, E.propTypes, {
  /**
   * The animation classNames applied to the component as it appears, enters,
   * exits or has finished the transition. A single name can be provided, which
   * will be suffixed for each stage, e.g. `classNames="fade"` applies:
   *
   * - `fade-appear`, `fade-appear-active`, `fade-appear-done`
   * - `fade-enter`, `fade-enter-active`, `fade-enter-done`
   * - `fade-exit`, `fade-exit-active`, `fade-exit-done`
   *
   * A few details to note about how these classes are applied:
   *
   * 1. They are _joined_ with the ones that are already defined on the child
   *    component, so if you want to add some base styles, you can use
   *    `className` without worrying that it will be overridden.
   *
   * 2. If the transition component mounts with `in={false}`, no classes are
   *    applied yet. You might be expecting `*-exit-done`, but if you think
   *    about it, a component cannot finish exiting if it hasn't entered yet.
   *
   * 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
   *    allows you to define different behavior for when appearing is done and
   *    when regular entering is done, using selectors like
   *    `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
   *    an epic entrance animation when element first appears in the DOM using
   *    [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
   *    simply use `fade-enter-done` for defining both cases.
   *
   * Each individual classNames can also be specified independently like:
   *
   * ```js
   * classNames={{
   *  appear: 'my-appear',
   *  appearActive: 'my-active-appear',
   *  appearDone: 'my-done-appear',
   *  enter: 'my-enter',
   *  enterActive: 'my-active-enter',
   *  enterDone: 'my-done-enter',
   *  exit: 'my-exit',
   *  exitActive: 'my-active-exit',
   *  exitDone: 'my-done-exit',
   * }}
   * ```
   *
   * If you want to set these classes using CSS Modules:
   *
   * ```js
   * import styles from './styles.css';
   * ```
   *
   * you might want to use camelCase in your CSS file, that way could simply
   * spread them instead of listing them one by one:
   *
   * ```js
   * classNames={{ ...styles }}
   * ```
   *
   * @type {string | {
   *  appear?: string,
   *  appearActive?: string,
   *  appearDone?: string,
   *  enter?: string,
   *  enterActive?: string,
   *  enterDone?: string,
   *  exit?: string,
   *  exitActive?: string,
   *  exitDone?: string,
   * }}
   */
  classNames: $,
  /**
   * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
   * applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEnter: v.func,
  /**
   * A `<Transition>` callback fired immediately after the 'enter-active' or
   * 'appear-active' class is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEntering: v.func,
  /**
   * A `<Transition>` callback fired immediately after the 'enter' or
   * 'appear' classes are **removed** and the `done` class is added to the DOM node.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed.
   *
   * @type Function(node: HtmlElement, isAppearing: bool)
   */
  onEntered: v.func,
  /**
   * A `<Transition>` callback fired immediately after the 'exit' class is
   * applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExit: v.func,
  /**
   * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExiting: v.func,
  /**
   * A `<Transition>` callback fired immediately after the 'exit' classes
   * are **removed** and the `exit-done` class is added to the DOM node.
   *
   * **Note**: when `nodeRef` prop is passed, `node` is not passed
   *
   * @type Function(node: HtmlElement)
   */
  onExited: v.func
}) : {};
export {
  g as default
};
