import { COMPONENT_SYMBOL, PROP_TYPES_SYMBOL, ASYNC_ORIGINAL_SYMBOL, ASYNC_RESOLVED_SYMBOL, ASYNC_DEFAULTS_SYMBOL } from './constants';
import { createProps } from './create-props';
let counter = 0;
export default class Component {
  constructor(...propObjects) {
    this.id = void 0;
    this.props = void 0;
    this.count = void 0;
    this.props = createProps(this, propObjects);
    this.id = this.props.id;
    this.count = counter++;
  }

  clone(newProps) {
    const {
      props
    } = this;
    const asyncProps = {};

    for (const key in props[ASYNC_DEFAULTS_SYMBOL]) {
      if (key in props[ASYNC_RESOLVED_SYMBOL]) {
        asyncProps[key] = props[ASYNC_RESOLVED_SYMBOL][key];
      } else if (key in props[ASYNC_ORIGINAL_SYMBOL]) {
        asyncProps[key] = props[ASYNC_ORIGINAL_SYMBOL][key];
      }
    }

    return new this.constructor({ ...props,
      ...asyncProps,
      ...newProps
    });
  }

}
Component.componentName = 'Component';
Component.defaultProps = {};
//# sourceMappingURL=component.js.map