"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_react=_interopRequireWildcard(require("react")),_reactDropzone=_interopRequireDefault(require("react-dropzone")),_ErrorBoundary=_interopRequireDefault(require("../../hoc/ErrorBoundary")),_react2=require("@lingui/react"),Accept=/*#__PURE__*/function(_Component){function Accept(){var _getPrototypeOf2,_this;(0,_classCallCheck2.default)(this,Accept);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf3.default)(Accept)).call.apply(_getPrototypeOf2,[this].concat(args))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)((0,_assertThisInitialized2.default)(_this)),"dropzoneRef",void 0),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)((0,_assertThisInitialized2.default)(_this)),"state",{accepted:[],rejected:[]}),_this}return(0,_inherits2.default)(Accept,_Component),(0,_createClass2.default)(Accept,[{key:"render",value:function render(){var _this2=this;return _react.default.createElement(_ErrorBoundary.default,null,_react.default.createElement("section",null,_react.default.createElement("div",{className:"dropzone"},_react.default.createElement(_reactDropzone.default,{ref:function ref(node){_this2.dropzoneRef=node},accept:"image/jpeg, image/png",onDrop:function onDrop(accepted,rejected){_this2.setState({accepted:accepted,rejected:rejected})}},_react.default.createElement("p",null,_react.default.createElement(_react2.Trans,{id:"Try dropping some files here, or click to select files to upload."})),_react.default.createElement("p",null,_react.default.createElement(_react2.Trans,{id:"Only *.jpeg and *.png images will be accepted"})))),_react.default.createElement("aside",null,_react.default.createElement("h2",null,_react.default.createElement(_react2.Trans,{id:"Accepted files"})),_react.default.createElement("ul",null,this.state.accepted.map(function(f){return _react.default.createElement("li",{key:f.name},f.name," - ",f.size," bytes")})),_react.default.createElement("h2",null,_react.default.createElement(_react2.Trans,{id:"Rejected files"})),_react.default.createElement("ul",null,this.state.rejected.map(function(f){return _react.default.createElement("li",{key:f.name},f.name," - ",f.size," bytes")}))),_react.default.createElement("button",{type:"button",onClick:function onClick(){_this2.dropzoneRef.open()}},_react.default.createElement(_react2.Trans,{id:"Open File Dialog"}))))}}]),Accept}(_react.Component),_default=Accept;exports.default=_default;