(this["webpackJsonp@jbrowse/web"]=this["webpackJsonp@jbrowse/web"]||[]).push([[50],{2297:function(e,r,t){"use strict";t.r(r);var a=t(86),n=t(29),o=t(83),c=t.n(o),i=t(1),s=t.n(i),l=t(85),p=t(110),d=t(109),u=t(51),g=t(2203),m=t(2211),b=t(2208),h=t(14),f=t(87),v=t(2181),y=t(2163),j=t.n(y),x=t(2164),E=t.n(x),O=512*Math.pow(1024,2);function w(e,r){return function(t){return r[t[e]]}}var F=Object(u.a)((function(e){return{root:{margin:e.spacing(1)},paper:{display:"flex",flexDirection:"column"},dropZone:{textAlign:"center",margin:e.spacing(2),padding:e.spacing(2),borderWidth:2,borderRadius:2,borderColor:w("isDragActive",{true:e.palette.secondary.light,false:e.palette.divider}),borderStyle:"dashed",backgroundColor:w("isDragActive",{true:Object(h.a)(e.palette.text.primary,e.palette.action.hoverOpacity),false:e.palette.background.default}),outline:"none",transition:"border .24s ease-in-out","&:focus":{borderColor:e.palette.secondary.light}},uploadIcon:{color:e.palette.text.secondary},rejectedFiles:{marginTop:e.spacing(4)},listItem:{padding:e.spacing(0,4)},expandIcon:{color:"#FFFFFF"},error:{margin:e.spacing(2)},errorHeader:{background:e.palette.error.light,color:e.palette.error.contrastText,padding:e.spacing(2),textAlign:"center"},errorMessage:{padding:e.spacing(2)}}}));r.default=Object(f.observer)((function(e){var r=Object(i.useState)(""),t=Object(n.a)(r,2),o=t[0],u=t[1],h=e.model,f=Object(v.a)({accept:"application/json",maxSize:O,multiple:!1,onDrop:function(){var e=Object(a.a)(c.a.mark((function e(r,t){var a,o,i,s,g,m;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.length){e.next=3;break}return r.length||t.length>1?u("Only one session at a time may be imported"):t[0].size>O?u("File size is too large (".concat(Math.round(t[0].size/Math.pow(1024,2))," MiB), max size is ").concat(O/Math.pow(1024,2)," MiB")):"application/json"!==t[0].type?u("File does not appear to be JSON"):u("Unknown file import error"),e.abrupt("return");case 3:return a=Object(n.a)(r,1),o=a[0],i=Object(p.openLocation)(Object(d.storeBlobLocation)({blob:o})),e.prev=5,e.next=8,i.readFile("utf8");case 8:s=e.sent,e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(5),console.error(e.t0),u("Problem opening file ".concat(o.path,": ").concat(e.t0)),e.abrupt("return");case 16:try{g=JSON.parse(s).session}catch(c){console.error(c),g={error:"Error parsing ".concat(o.path,": ").concat(c)}}m=Object(l.getSession)(h);try{m.setSession(g)}catch(c){console.error(c),u("Error activating session: ".concat(c," "))}case 19:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(r,t){return e.apply(this,arguments)}}()}),y=f.getRootProps,x=f.getInputProps,w=f.isDragActive,S=F({isDragActive:w});return s.a.createElement("div",{className:S.root},s.a.createElement(g.a,{className:S.paper},s.a.createElement("div",y({className:S.dropZone}),s.a.createElement("input",x()),s.a.createElement(j.a,{className:S.uploadIcon,fontSize:"large"}),s.a.createElement(m.a,{color:"textSecondary",align:"center",variant:"body1"},"Drag and drop files here"),s.a.createElement(m.a,{color:"textSecondary",align:"center",variant:"body2"},"or"),s.a.createElement(b.a,{color:"primary",variant:"contained"},"Browse Files"))),o?s.a.createElement(g.a,{className:S.error},s.a.createElement("div",{className:S.errorHeader},s.a.createElement(E.a,{color:"inherit",fontSize:"large"}),s.a.createElement("div",null,s.a.createElement(m.a,{variant:"h6",color:"inherit",align:"center"},"Import error"))),s.a.createElement(m.a,{className:S.errorMessage},o)):null)}))}}]);
//# sourceMappingURL=50.cd67edfa.chunk.js.map