"use strict";(self.webpackChunk_jbrowse_web=self.webpackChunk_jbrowse_web||[]).push([[1732],{51732:function(n,e,t){t.r(e),t.d(e,{default:function(){return T}});var o=t(96234),c=t(30969),i=t(81073),r=t(70054),a=t(75041),s=t(165),l=t(68595),u=t(89053),d=t(69852),p=t(2374),f=t(90550),m=t(40909),h=t(56699),g=t(37574),x=(0,f.observer)((function(n){var e=n.connectionType,t=n.model,o=n.session,i=e.configEditorComponent||h.wP;return(0,g.jsx)(c.Suspense,{fallback:(0,g.jsx)("div",{children:"Loading..."}),children:(0,g.jsx)(i,{model:{target:t},session:o})})})),C=t(35436),j=t(66581),v=t(28712),b=t(16374);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",color:"secondary",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)}}})),y=["Select a Connection Type","Configure Connection"];var T=(0,f.observer)((function(n){var e=n.model,t=(0,c.useState)(),p=(0,o.Z)(t,2),f=p[0],h=p[1],C=(0,c.useState)(),j=(0,o.Z)(C,2),v=j[0],b=j[1],T=(0,c.useState)(0),w=(0,o.Z)(T,2),N=w[0],S=w[1],E=k().classes,_=(0,i.getSession)(e),B=(0,m.getEnv)(_).pluginManager;function I(){switch(N){case 0:return(0,g.jsx)(Z,{connectionTypeChoices:B.getElementTypesInGroup("connection"),connectionType:f,setConnectionType:function(n){h(n),n&&b(n.configSchema.create({connectionId:"".concat(n.name,"-").concat(Date.now())},(0,m.getEnv)(e)))}});case 1:return f&&v?(0,g.jsx)(x,{connectionType:f,model:v,session:_}):null;default:return(0,g.jsx)(r.Z,{children:"Unknown step"})}}function L(){N===y.length-1?function(){var n=_.addConnectionConf(v);_.makeConnection&&_.makeConnection(n);_.hideWidget(e)}():S(N+1)}function W(){S(N-1)}return(0,g.jsx)("div",{className:E.root,children:(0,g.jsx)(a.Z,{className:E.stepper,activeStep:N,orientation:"vertical",children:y.map((function(n){return(0,g.jsxs)(s.Z,{children:[(0,g.jsx)(l.Z,{children:n}),(0,g.jsxs)(u.Z,{children:[I(),(0,g.jsxs)("div",{className:E.actionsContainer,children:[(0,g.jsx)(d.Z,{disabled:0===N,onClick:W,className:E.button,children:"Back"}),(0,g.jsx)(d.Z,{disabled:!(0===N&&f||1===N&&v),variant:"contained",color:"primary",onClick:L,className:E.button,"data-testid":"addConnectionNext",children:N===y.length-1?"Connect":"Next"})]})]})]},n)}))})})}))}}]);
//# sourceMappingURL=1732.320a1988.chunk.js.map