"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7389],{67389:(e,r,o)=>{o.r(r),o.d(r,{default:()=>f});var a=o(7552),t=o(99546),s=o(41604),n=o(62266),i=o(95054),c=o(61282),l=o(69092),d=o(68446),p=o(89295),g=o(75785),h=o(67758),u=o(81478),x=o(69500);const b=(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 m(e){const r=(0,h.c)(11),{error:o}=e,{classes:a}=b();let t,s,n;r[0]===Symbol.for("react.memo_cache_sentinel")?(t=(0,x.jsx)(u.A,{color:"inherit",fontSize:"large"}),s=(0,x.jsx)("div",{children:(0,x.jsx)(c.A,{variant:"h6",color:"inherit",align:"center",children:"Import error"})}),r[0]=t,r[1]=s):(t=r[0],s=r[1]),r[2]!==a.errorHeader?(n=(0,x.jsxs)("div",{className:a.errorHeader,children:[t,s]}),r[2]=a.errorHeader,r[3]=n):n=r[3];const l=`${o}`;let d,p;return r[4]!==a.errorMessage||r[5]!==l?(d=(0,x.jsx)(c.A,{className:a.errorMessage,children:l}),r[4]=a.errorMessage,r[5]=l,r[6]=d):d=r[6],r[7]!==a.error||r[8]!==n||r[9]!==d?(p=(0,x.jsxs)(i.A,{className:a.error,children:[n,d]}),r[7]=a.error,r[8]=n,r[9]=d,r[10]=p):p=r[10],p}function j(e,r){return o=>r[o[e]]}const v=(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,n.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}})),f=(0,d.observer)(function({model:e}){const[r,o]=(0,a.useState)(),{getRootProps:n,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}=v({isDragActive:g});return(0,x.jsxs)("div",{className:h.root,children:[(0,x.jsx)(i.A,{className:h.paper,children:(0,x.jsxs)("div",{...n({className:h.dropZone}),children:[(0,x.jsx)("input",{...d()}),(0,x.jsx)(s.A,{className:h.uploadIcon,fontSize:"large"}),(0,x.jsx)(c.A,{color:"textSecondary",align:"center",variant:"body1",children:"Drag and drop files here"}),(0,x.jsx)(c.A,{color:"textSecondary",align:"center",variant:"body2",children:"or"}),(0,x.jsx)(l.A,{color:"primary",variant:"contained",children:"Browse Files"})]})}),r?(0,x.jsx)(m,{error:r}):null]})})}}]);
//# sourceMappingURL=7389.2441600a.chunk.js.map