"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const React = require("react");
const store = require("./store.js");
function getFormInstance() {
  var store$1 = new store();
  return {
    getFieldsValue: store$1.getFieldsValue,
    getFieldValue: store$1.getFieldValue,
    getFieldError: store$1.getFieldError,
    getFieldsError: store$1.getFieldsError,
    getTouchedFields: store$1.getTouchedFields,
    getFields: store$1.getFields,
    setFieldValue: store$1.setFieldValue,
    setFieldsValue: store$1.setFieldsValue,
    setFields: store$1.setFields,
    resetFields: store$1.resetFields,
    clearFields: store$1.clearFields,
    submit: store$1.submit,
    validate: store$1.validate,
    scrollToField: function() {
    },
    getInnerMethods: function(inner) {
      var methods = {};
      if (inner) {
        [
          "registerField",
          "registerWatcher",
          "innerSetInitialValues",
          "innerSetInitialValue",
          "innerSetCallbacks",
          "innerSetFieldValue",
          "innerGetStore"
        ].map(function(key) {
          methods[key] = store$1[key];
        });
      }
      return methods;
    }
  };
}
function useForm(form) {
  var formRef = React.useRef(form);
  if (!formRef.current) {
    if (form) {
      formRef.current = form;
    } else {
      formRef.current = getFormInstance();
    }
  }
  return [formRef.current];
}
exports.default = useForm;
exports.getFormInstance = getFormInstance;
//# sourceMappingURL=useForm.js.map
