/*! For license information please see dll.SpreadsheetUpload.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[126],{1820:function(e,t){},1821:function(e,t){},3157:function(e,t,n){"use strict";n.r(t);var a=n(967),r=n(3158);a.default.addResources("de","spreadsheet-upload",r.DE),a.default.addResources("en","spreadsheet-upload",r.EN),a.default.addResources("es","spreadsheet-upload",r.ES)},3158:function(e){e.exports=JSON.parse('{"DE":{"csv-upload-prompt":"Bitte laden Sie einen Datensatz hoch (CSV-Format)","drop-file":"Datei hier ablegen","error-message":"Der folgende Fehler wurde beim Versuch, die Datei zu lesen, festgestellt","error-title":"Could not read file.","first-row-names":"Erste Reihe enthält Variablennamen","no-csv":"Keine CSV-Datei.","no-csv-message":"Bei der bereitgestellten Datei handelt es sich nicht um eine CSV-Datei.","title":"Datei-Upload"},"EN":{"csv-upload-prompt":"Please upload a data set (CSV format)","drop-file":"Drop file here","error-message":"The following error was encountered while trying to read the file","error-title":"Konnte Datei nicht lesen.","first-row-names":"First row contains variable names","no-csv":"No CSV file.","no-csv-message":"The supplied file is not a CSV file.","title":"File Upload"},"ES":{}}')},923:function(e,t,n){"use strict";n.r(t);var a=n(14),r=n.n(a),o=n(12),i=n.n(o),l=n(10),s=n.n(l),d=n(15),p=n.n(d),u=n(16),c=n.n(u),f=n(8),h=n.n(f),m=n(7),g=n.n(m),v=n(0),D=n.n(v),E=n(1),w=n.n(E),C=n(3482),S=n(86),b=n(1164),y=n(3147),F=n.n(y),R=n(3156),x=n.n(R),U=n(977),V=n.n(U),T=n(975),N=n.n(T),P=n(353),_=n.n(P),k=n(35),A=n(197);n(3157);function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,a=h()(e);if(t){var r=h()(this).constructor;n=Reflect.construct(a,arguments,r)}else n=a.apply(this,arguments);return c()(this,n)}}var B=/\r(?!\n)/g,J=function(e){p()(n,e);var t=O(n);function n(e){var a;return r()(this,n),a=t.call(this,e),g()(s()(a),"handleFileUpload",(function(){a.setState({uploading:!0},(function(){var e=new FileReader,t=a.fileUpload.files[0];e.addEventListener("load",a.onFileRead,!1),e.addEventListener("progress",(function(e){if(e.lengthComputable){var t=e.loaded/e.total;a.setState({percentCompleted:t})}}),!1),e.readAsText(t,"utf-8")}))})),g()(s()(a),"onFileRead",(function(e){var t,n,r=e.target.result,o=x()(r);t=N()(o)?",":o.delimiter;var i=(r=V()(r,B,"\n")).indexOf("\n"),l=r.substring(0,i).split(t);a.state.header?(n=l,r=r.substring(i+1)):n=l.map((function(e,t){return"VAR_"+(t+1)})),a.setState({percentCompleted:0,uploading:!1}),F()(r,{delimiter:t,columns:n,cast:!0},(function(e,t){if(e)return a.context.addNotification({title:a.props.t("error-title"),message:"".concat(a.props.t("error-message"),": ").concat(e.message),level:"error",position:"tr"}),a.props.onUpload(e);a.props.onUpload(null,t)}))})),g()(s()(a),"ignoreDrag",(function(e){e.stopPropagation(),e.preventDefault()})),g()(s()(a),"onFileDrop",(function(e){e.stopPropagation(),e.preventDefault();var t=e.dataTransfer,n=new FileReader,r=null;if(t.items?"file"===t.items[0].kind&&(r=t.items[0].getAsFile()):r=t.files[0],r){if("text/csv"!==r.type)return a.context.addNotification({title:a.props.t("no-csv"),message:a.props.t("no-csv-message"),level:"error",position:"tr"});n.addEventListener("load",a.onFileRead,!1),n.readAsText(r,"utf-8")}})),a.state={percentCompleted:0,uploading:!1,header:!0},a}return i()(n,[{key:"render",value:function(){var e=this,t=_()(100*this.state.percentCompleted);return D.a.createElement(S.default,null,D.a.createElement(S.default.Header,{as:"h2"},this.props.title||this.props.t("title")),D.a.createElement(S.default.Body,null,D.a.createElement("label",{htmlFor:"CSVUpload"},this.props.t("csv-upload-prompt"),":"),D.a.createElement("input",{id:"CSVUpload",type:"file",accept:".csv",onChange:this.handleFileUpload,ref:function(t){e.fileUpload=t},style:{margin:"auto"}}),D.a.createElement("p",null,"or"),D.a.createElement("div",{onDrop:this.onFileDrop,onDragOver:this.ignoreDrag,onDragEnd:this.ignoreDrag,style:{minHeight:"150px",width:"250px",border:"1px solid blue",padding:"10px"}},D.a.createElement("span",null,this.props.t("drop-file"))),D.a.createElement(A.default,{legend:this.props.t("first-row-names"),defaultValue:!0,onChange:function(t){e.setState({header:t})}}),this.state.uploading?D.a.createElement(b.default,{now:t,label:"".concat(t,"%")}):null))}}]),n}(v.Component);J.defaultProps={onUpload:function(){},title:null},J.propTypes={onUpload:w.a.func,title:w.a.string},J.contextType=k.default,t.default=Object(C.withTranslation)("spreadsheet-upload")(J)}}]);