"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[9589],{69589:function(n,e,t){t.r(e),t.d(e,{default:function(){return y}});var o=t(96234),c=t(96902),i=t(97531),r=t(35388),a=t(66431),s=t(32143),l=t(15817),u=t(8317),d=t(44536),p=t(91188),f=t(4782),m=t(30474),h=t(46186),g=t(29938),x=(0,f.observer)((function(n){var e=n.connectionType,t=n.model,o=n.session,i=e.configEditorComponent||m.wP;return(0,g.jsx)(c.Suspense,{fallback:(0,g.jsx)(h.LoadingEllipses,{}),children:(0,g.jsx)(i,{model:{target:t},session:o})})})),C=t(66519),j=t(25322),v=t(15996),b=t(16403);var Z=function(n){var e=n.connectionTypeChoices,t=n.connectionType,o=n.setConnectionType;return(0,c.useEffect)((function(){t||o(e[0])})),(0,g.jsx)("form",{autoComplete:"off",children:t?(0,g.jsx)(C.Z,{value:t.name,label:"connectionType",helperText:t.description?(0,g.jsxs)(g.Fragment,{children:[t.description,t.url?(0,g.jsx)(j.Z,{href:t.url,rel:"noopener noreferrer",target:"_blank",children:(0,g.jsx)(b.Z,{})}):null]}):null,select:!0,fullWidth:!0,onChange:function(n){return o(e.find((function(e){return e.name===n.target.value})))},variant:"outlined",children:e.map((function(n){return(0,g.jsx)(v.Z,{value:n.name,children:n.displayName||n.name},n.name)}))}):null})},k=(0,p.ZL)()((function(n){return{root:{marginTop:n.spacing(1)},stepper:{backgroundColor:n.palette.background.default},button:{marginTop:n.spacing(1),marginRight:n.spacing(1)},actionsContainer:{marginBottom:n.spacing(2)}}})),T=["Select a Connection Type","Configure Connection"];var y=(0,f.observer)((function(n){var e=n.model,t=(0,c.useState)(),p=(0,o.Z)(t,2),f=p[0],m=p[1],h=(0,c.useState)(),C=(0,o.Z)(h,2),j=C[0],v=C[1],b=(0,c.useState)(0),y=(0,o.Z)(b,2),w=y[0],N=y[1],S=k().classes,E=(0,i.getSession)(e),_=(0,i.getEnv)(E).pluginManager;function B(){switch(w){case 0:return(0,g.jsx)(Z,{connectionTypeChoices:_.getElementTypesInGroup("connection"),connectionType:f,setConnectionType:function(n){m(n),n&&v(n.configSchema.create({connectionId:"".concat(n.name,"-").concat(Date.now())},(0,i.getEnv)(e)))}});case 1:return f&&j?(0,g.jsx)(x,{connectionType:f,model:j,session:E}):null;default:return(0,g.jsx)(r.Z,{children:"Unknown step"})}}function I(){w===T.length-1?function(){var n=E.addConnectionConf(j);E.makeConnection&&E.makeConnection(n);E.hideWidget(e)}():N(w+1)}function L(){N(w-1)}return(0,g.jsx)("div",{className:S.root,children:(0,g.jsx)(a.Z,{className:S.stepper,activeStep:w,orientation:"vertical",children:T.map((function(n){return(0,g.jsxs)(s.Z,{children:[(0,g.jsx)(l.Z,{children:n}),(0,g.jsxs)(u.Z,{children:[B(),(0,g.jsxs)("div",{className:S.actionsContainer,children:[(0,g.jsx)(d.Z,{disabled:0===w,onClick:L,className:S.button,children:"Back"}),(0,g.jsx)(d.Z,{disabled:!(0===w&&f||1===w&&j),variant:"contained",color:"primary",onClick:I,className:S.button,"data-testid":"addConnectionNext",children:w===T.length-1?"Connect":"Next"})]})]})]},n)}))})})}))}}]);
//# sourceMappingURL=9589.12296570.chunk.js.map