"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7389],{67389:(e,r,o)=>{o.r(r),o.d(r,{default:()=>v});var a=o(7552),t=o(99546),n=o(41604),s=o(62266),i=o(95054),c=o(61282),l=o(69092),d=o(68446),p=o(89295),g=o(75785),h=o(81478),u=o(69500);const x=(0,g.n9)()((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}=x();return(0,u.jsxs)(i.A,{className:r.error,children:[(0,u.jsxs)("div",{className:r.errorHeader,children:[(0,u.jsx)(h.A,{color:"inherit",fontSize:"large"}),(0,u.jsx)("div",{children:(0,u.jsx)(c.A,{variant:"h6",color:"inherit",align:"center",children:"Import error"})})]}),(0,u.jsx)(c.A,{className:r.errorMessage,children:`${e}`})]})}function j(e,r){return o=>r[o[e]]}const m=(0,g.n9)()((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:j("isDragActive",{true:e.palette.secondary.light,false:e.palette.divider}),borderStyle:"dashed",backgroundColor:j("isDragActive",{true:(0,s.X4)(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}}))),v=(0,d.observer)((function({model:e}){const[r,o]=(0,a.useState)(),{getRootProps:s,getInputProps:d,isDragActive:g}=(0,p.VB)({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 o=await r[0].text();(0,t.getSession)(e).setSession?.(JSON.parse(o).session)}catch(e){console.error(e),o(e)}}}),{classes:h}=m({isDragActive:g});return(0,u.jsxs)("div",{className:h.root,children:[(0,u.jsx)(i.A,{className:h.paper,children:(0,u.jsxs)("div",{...s({className:h.dropZone}),children:[(0,u.jsx)("input",{...d()}),(0,u.jsx)(n.A,{className:h.uploadIcon,fontSize:"large"}),(0,u.jsx)(c.A,{color:"textSecondary",align:"center",variant:"body1",children:"Drag and drop files here"}),(0,u.jsx)(c.A,{color:"textSecondary",align:"center",variant:"body2",children:"or"}),(0,u.jsx)(l.A,{color:"primary",variant:"contained",children:"Browse Files"})]})}),r?(0,u.jsx)(b,{error:r}):null]})}))}}]);
//# sourceMappingURL=7389.cb5a4616.chunk.js.map