function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
import React from "react";
import Dropzone from "react-dropzone";
import classNames from "classnames";
import "./DropHandler.css";
var DropHandler = /*#__PURE__*/function (_React$Component) {
  _inheritsLoose(DropHandler, _React$Component);
  function DropHandler() {
    var _this;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
    _defineProperty(_assertThisInitialized(_this), "handleDrop", function (files) {
      if (!files || !files.length) {
        return window.toastr.warning("Unrecognized File Type");
      }
      _this.props.importSequenceFromFile(files[0]);
    });
    return _this;
  }
  var _proto = DropHandler.prototype;
  _proto.render = function render() {
    var _this$props = this.props,
      children = _this$props.children,
      style = _this$props.style,
      className = _this$props.className,
      disabled = _this$props.disabled;
    return /*#__PURE__*/React.createElement(Dropzone, {
      disabled: disabled,
      onClick: function onClick(evt) {
        return evt.preventDefault();
      },
      multiple: false,
      accept: [".gb", ".gbk", ".fasta", ".fa", ".geneious", ".gp", ".txt", ".dna", ".prot", ".ab1", ".json"],
      onDropRejected: function onDropRejected() {
        window.toastr.error("Error: Incorrect File Type");
      },
      onDrop: this.handleDrop
    }, function (_ref) {
      var getRootProps = _ref.getRootProps,
        isDragActive = _ref.isDragActive,
        isDragReject = _ref.isDragReject;
      return /*#__PURE__*/React.createElement("div", _extends({}, getRootProps(), {
        style: style,
        className: classNames(className, {
          isActive: isDragActive,
          isRejected: isDragReject
        })
      }), /*#__PURE__*/React.createElement(DraggingMessage, null), children);
    });
  };
  return DropHandler;
}(React.Component);
export { DropHandler as default };
function DraggingMessage() {
  return /*#__PURE__*/React.createElement("div", {
    className: "dropzone-dragging-message"
  }, "Drop Fasta or Genbank files to view them in the editor. The following extensions are accepted: .gb .gbk .fasta .fa .gp .txt");
}