(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6446],{26597:function(n,e,t){"use strict";t.r(e),t.d(e,{default:function(){return T}});var i=t(27812),r=t(50029),o=t(87794),s=t.n(o),u=t(68527),a=t(49609),c=t(66752),l=t(11163),d=t(67294),f=t(97142),p=t(70783),v=t(45035),x=t(20095),h=t(24226),j=t(52313),y=t(9613),_=t(74157),m=t(4043),S=t(95693),w=t(98643),g=t(85130),A=t(85893),C=function(){var n=(0,f.T)(),e=(0,f.C)(x.ZZ),t=e.connection,i=e.connectionOption,r=(0,d.useState)(void 0),o=r[0],s=r[1],a=(0,d.useMemo)((function(){return function(){var n=[];return null!==o&&void 0!==o&&o.options&&o.options.forEach((function(e){var i;switch(e){case m.H5.CONNECTOR_PARAMETERS:i={label:e,content:(0,A.jsx)(_.s,{})};break;case m.H5.DATASET_CONFIGURATION:i=null!==t&&void 0!==t&&t.key?{label:e,content:(0,A.jsx)(S.Z,{})}:void 0;break;case m.H5.DSR_CUSTOMIZATION:i=null!==t&&void 0!==t&&t.key?{label:e,content:(0,A.jsx)(w.Z,{})}:void 0}i&&n.push(i)})),n}}),[null===t||void 0===t?void 0:t.key,null===o||void 0===o?void 0:o.options]);return(0,d.useEffect)((function(){if(i){var e=m.IM.find((function(n){return n.type===(null===i||void 0===i?void 0:i.type)}));e&&(s(e),n((0,x.nj)(m.Ss[2])))}return function(){n((0,x.mc)())}}),[i,n]),t&&i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(u.X6,{fontSize:"2xl",fontWeight:"semibold",maxHeight:"40px",mb:"4px",whiteSpace:"nowrap",children:(0,A.jsxs)(u.xu,{alignItems:"center",display:"flex",children:[(0,A.jsx)(g.Z,{data:t}),(0,A.jsx)(u.xv,{ml:"8px",children:t.name})]})}),(0,A.jsx)(y.Z,{steps:[m.Ss[0],m.Ss[2]]}),(0,A.jsx)(u.gC,{alignItems:"stretch",flex:"1",gap:"18px",children:(0,A.jsx)(j.Z,{data:a(),flexGrow:1,isLazy:!0})})]}):null},E=t(74015),T=function(){var n=(0,f.T)(),e=(0,l.useRouter)(),t=(0,p.VY)().errorAlert,o=(0,f.C)(x.y_),j=(0,d.useState)(!1),y=j[0],_=j[1],m=(0,d.useState)(!0),S=m[0],w=m[1],g=function(n,e){return e.find((function(e){var t;return e.identifier===n.connection_type&&e.identifier!==E.Rj.SAAS||e.identifier===(null===(t=n.saas_config)||void 0===t?void 0:t.type)}))};return(0,d.useEffect)((function(){var u=function(){t("An error occurred while loading ".concat(e.query.id)),e.push(v.JR,void 0,{shallow:!0})},a=function(){var e=(0,r.Z)(s().mark((function e(t){var r,a,c,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,_(!0),(r=[]).push(n(h.DM.endpoints.getDatastoreConnectionByKey.initiate(t))),0===o.length&&r.push(n(x.d8.endpoints.getAllConnectionTypes.initiate({search:""}))),e.next=7,Promise.allSettled(r);case 7:(a=e.sent).every((function(n){return"fulfilled"===n.status}))?(n((0,x.lm)(a[0].value.data)),c=(0,i.Z)(a[1]?a[1].value.data.items:o),l=g(a[0].value.data,c),n((0,x.yA)(l)),_(!1),w(!1)):u(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),u();case 14:case"end":return e.stop()}}),e,null,[[0,11]])})));return function(n){return e.apply(this,arguments)}}(),c=e.query.id;return c&&!y&&S&&a(c),function(){}}),[o,n,t,y,S,e]),(0,A.jsxs)(A.Fragment,{children:[S&&(0,A.jsx)(u.xu,{display:"flex",h:"100vh",justifyContent:"center",children:(0,A.jsx)(u.M5,{children:(0,A.jsx)(a.$,{})})}),!S&&(0,A.jsx)(c.Z,{children:(0,A.jsx)(C,{})})]})}},92304:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/datastore-connection/[id]",function(){return t(26597)}])}},function(n){n.O(0,[2437,4231,6114,6647,7826,6459,9774,2888,179],(function(){return e=92304,n(n.s=e);var e}));var e=n.O();_N_E=e}]);