"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[150],{20150:(e,r,t)=>{t.r(r),t.d(r,{default:()=>E});var a=t(66204),o=t(73330),n=t(86636),c=t(80013),l=t(7146),s=t(90872),i=t(38684),d=t(80846),p=t(55069),g=t(28453),m=t(49824);const u=(0,i.ZL)()((e=>({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)}})));function b({error:e}){const{classes:r}=u();return a.createElement(n.Z,{className:r.error},a.createElement("div",{className:r.errorHeader},a.createElement(m.Z,{color:"inherit",fontSize:"large"}),a.createElement("div",null,a.createElement(c.Z,{variant:"h6",color:"inherit",align:"center"},"Import error"))),a.createElement(c.Z,{className:r.errorMessage},`${e}`))}function h(e,r){return t=>r[t[e]]}const v=(0,i.ZL)()((e=>({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:h("isDragActive",{true:e.palette.secondary.light,false:e.palette.divider}),borderStyle:"dashed",backgroundColor:h("isDragActive",{true:(0,o.Fq)(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}}))),E=(0,d.observer)((function({model:e}){const[r,t]=(0,a.useState)(),{getRootProps:o,getInputProps:i,isDragActive:d}=(0,p.uI)({accept:"application/json",maxSize:536870912,multiple:!1,onDrop:async(r,a)=>{try{if(a.length>0)throw new Error(`${a[0].errors.map((e=>`${e}`)).join(", ")}`);{const t=await r[0].text();(0,s.getSession)(e).setSession?.(JSON.parse(t).session)}}catch(e){console.error(e),t(e)}}}),{classes:m}=v({isDragActive:d});return a.createElement("div",{className:m.root},a.createElement(n.Z,{className:m.paper},a.createElement("div",o({className:m.dropZone}),a.createElement("input",i()),a.createElement(g.Z,{className:m.uploadIcon,fontSize:"large"}),a.createElement(c.Z,{color:"textSecondary",align:"center",variant:"body1"},"Drag and drop files here"),a.createElement(c.Z,{color:"textSecondary",align:"center",variant:"body2"},"or"),a.createElement(l.Z,{color:"primary",variant:"contained"},"Browse Files"))),r?a.createElement(b,{error:r}):null)}))}}]);
//# sourceMappingURL=150.894b5d02.chunk.js.map