"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[7297],{67297:(e,t,a)=>{a.r(t),a.d(t,{default:()=>S});var n=a(66204),s=a(38684),r=a(80846),o=a(90872),i=a(82051),l=a(93840),m=a(94926),c=a(10126),d=a(7146),u=a(35421),p=a(3206),b=a(26545),g=a(85084),h=a(33846);const x=(0,r.observer)((function({model:e,selectedAsm:t,value:a,setValue:s,setOption:r}){const i=(0,o.getSession)(e),{assemblyManager:l,textSearchManager:m}=i,{rankSearchResults:c}=e,d=e.searchScope(t),u=l.get(t);return n.createElement(g.Z,{fetchResults:e=>(0,h.kx)({queryString:e,assembly:u,textSearchManager:m,rankSearchResults:c,searchScope:d}),model:e,assemblyName:t,value:a,minWidth:270,onChange:e=>s(e),onSelect:e=>r(e),TextFieldProps:{variant:"outlined",helperText:"Enter sequence name, feature name, or location"}})})),f=(0,s.ZL)()((e=>({importFormContainer:{padding:e.spacing(2)},button:{margin:e.spacing(2)},container:{padding:e.spacing(4)}}))),S=(0,r.observer)((function({model:e}){const{classes:t}=f(),a=(0,o.getSession)(e),{assemblyNames:s,assemblyManager:r}=a,{error:g}=e,[h,S]=(0,n.useState)(s[0]),[Z,v]=(0,n.useState)(),y=r.get(h),E=s.length?y?.error:"No configured assemblies",k=E||g,[w,W]=(0,n.useState)(""),C=y?.regions,N=!!C,R=C?C[0]?.refName:"";return(0,n.useEffect)((()=>{W(R)}),[R,h]),n.createElement("div",{className:t.container},k?n.createElement(u.ErrorMessage,{error:k}):null,n.createElement(i.Z,{className:t.importFormContainer},n.createElement("form",{onSubmit:async t=>{if(t.preventDefault(),e.setError(void 0),w)try{Z?.getDisplayString()===w&&Z.hasLocation()?await(0,b.Xp)({option:Z,model:e,assemblyName:h}):Z?.results?.length?e.setSearchResults(Z.results,Z.getLabel(),h):y&&await(0,b.I8)({input:w,assembly:y,model:e})}catch(e){console.error(e),a.notify(`${e}`,"warning")}}},n.createElement(l.ZP,{container:!0,spacing:1,justifyContent:"center",alignItems:"center"},n.createElement(l.ZP,{item:!0},n.createElement(m.Z,null,n.createElement(u.AssemblySelector,{onChange:e=>S(e),localStorageKey:"lgv",session:a,selected:h}))),n.createElement(l.ZP,{item:!0},h?E?n.createElement(p.Z,{style:{color:"red"}}):N?n.createElement(m.Z,null,n.createElement(x,{value:w,setValue:W,selectedAsm:h,setOption:v,model:e})):n.createElement(c.Z,{size:20,disableShrink:!0}):null),n.createElement(l.ZP,{item:!0},n.createElement(m.Z,null,n.createElement(d.Z,{type:"submit",disabled:!w,className:t.button,variant:"contained",color:"primary"},"Open")),n.createElement(m.Z,null,n.createElement(d.Z,{disabled:!w,className:t.button,onClick:()=>{e.setError(void 0),e.showAllRegionsInAssembly(h)},variant:"contained",color:"secondary"},"Show all regions in assembly")))))))}))},82051:(e,t,a)=>{a.d(t,{Z:()=>y});var n=a(55559),s=a(30984),r=a(66204),o=a(56317),i=a(46730),l=a(95201),m=a(58029),c=a(77877),d=a(605),u=a(71684),p=a(43188);const b=["className","component","disableGutters","fixed","maxWidth","classes"],g=(0,u.Z)(),h=(0,d.Z)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${(0,i.Z)(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),x=e=>(0,c.Z)({props:e,name:"MuiContainer",defaultTheme:g});var f=a(40118),S=a(61125),Z=a(57369);const v=function(e={}){const{createStyledComponent:t=h,useThemeProps:a=x,componentName:c="MuiContainer"}=e,d=t((({theme:e,ownerState:t})=>(0,s.Z)({width:"100%",marginLeft:"auto",boxSizing:"border-box",marginRight:"auto",display:"block"},!t.disableGutters&&{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}})),(({theme:e,ownerState:t})=>t.fixed&&Object.keys(e.breakpoints.values).reduce(((t,a)=>{const n=a,s=e.breakpoints.values[n];return 0!==s&&(t[e.breakpoints.up(n)]={maxWidth:`${s}${e.breakpoints.unit}`}),t}),{})),(({theme:e,ownerState:t})=>(0,s.Z)({},"xs"===t.maxWidth&&{[e.breakpoints.up("xs")]:{maxWidth:Math.max(e.breakpoints.values.xs,444)}},t.maxWidth&&"xs"!==t.maxWidth&&{[e.breakpoints.up(t.maxWidth)]:{maxWidth:`${e.breakpoints.values[t.maxWidth]}${e.breakpoints.unit}`}}))),u=r.forwardRef((function(e,t){const r=a(e),{className:u,component:g="div",disableGutters:h=!1,fixed:x=!1,maxWidth:f="lg"}=r,S=(0,n.Z)(r,b),Z=(0,s.Z)({},r,{component:g,disableGutters:h,fixed:x,maxWidth:f}),v=((e,t)=>{const{classes:a,fixed:n,disableGutters:s,maxWidth:r}=e,o={root:["root",r&&`maxWidth${(0,i.Z)(String(r))}`,n&&"fixed",s&&"disableGutters"]};return(0,m.Z)(o,(e=>(0,l.Z)(t,e)),a)})(Z,c);return(0,p.jsx)(d,(0,s.Z)({as:g,ownerState:Z,className:(0,o.Z)(v.root,u),ref:t},S))}));return u}({createStyledComponent:(0,S.ZP)("div",{name:"MuiContainer",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[`maxWidth${(0,f.Z)(String(a.maxWidth))}`],a.fixed&&t.fixed,a.disableGutters&&t.disableGutters]}}),useThemeProps:e=>(0,Z.Z)({props:e,name:"MuiContainer"})}),y=v}}]);
//# sourceMappingURL=7297.2aa61b97.chunk.js.map