????
Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/ |
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/plugin-connections-80ae91f131268f8b281e.js |
/*! For license information please see ../license.txt */ "use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[11450],{60920:(e,n,t)=>{t.r(n),t.d(n,{ConnectionAuthService:()=>f});var i=t(1118),o=t(56826),r=t(50420),s=t(49690),a=t(34906),c=t(63716),d=t(5576),l=t(71635),u=t(76643);const h=(0,r.j)((()=>Promise.all([t.e(11502),t.e(67557),t.e(89814),t.e(11450),t.e(65317)]).then(t.bind(t,77804)).then((e=>e.DatabaseAuthDialog))));let f=class ConnectionAuthService extends c.O{constructor(e,n,t,i,o){super(),this.connectionInfoResource=e,this.commonDialogService=n,this.authProviderService=t,this.connectionsManagerService=i,this.authenticationService=o,i.connectionExecutor.addHandler(this.connectionDialog.bind(this)),this.authenticationService.onLogout.before(i.onDisconnect,(n=>({connections:e.values.filter((e=>e.connected)).map(s.createConnectionParam),state:n})))}async connectionDialog(e,n){const t=n.getContext(this.connectionsManagerService.connectionContext),i=await this.auth(e.key,e.resetCredentials);i?.connected&&(t.connection=i)}async auth(e,n){if(!this.connectionInfoResource.has(e))return null;let t=await this.connectionInfoResource.load(e);const i=t?.connected;if(t?.connected){if(!n)return t;this.connectionInfoResource.close(e)}if(t.requiredAuth){if(!await this.authProviderService.requireProvider(t.requiredAuth))return t}t=await this.connectionInfoResource.load(e,["includeAuthNeeded","includeNetworkHandlersConfig","includeCredentialsSaved"]);const o=t.networkHandlersConfig.filter((e=>e.enabled&&(!e.savePassword||n))).map((e=>e.id));if(t.authNeeded||t.credentialsSaved&&n||o.length>0){const t=await this.commonDialogService.open(h,{connection:e,networkHandlers:o,resetCredentials:n});n&&i&&t===l.DialogueStateResult.Rejected&&await this.connectionInfoResource.init(e)}else await this.connectionInfoResource.init({projectId:e.projectId,connectionId:e.connectionId});return this.connectionInfoResource.get(e)}};f=(0,i.Cg)([(0,d._)(),(0,i.Sn)("design:paramtypes",[s.ConnectionInfoResource,l.CommonDialogService,o.AuthProviderService,a.ConnectionsManagerService,u.AuthenticationService])],f)},17786:(e,n,t)=>{t.r(n),t.d(n,{ConnectionAuthenticationDialog:()=>S});var i=t(41773),o=t(7838),r=t(17675),s=t(64928),a=t(35025),c=t(51477),d=t(62204),l=t(92659),u=t(84972),h=t(7167),f=t(9428),p=t(89232),g=t(86358);const m={submittingForm:"submittingForm___GN3eX",connectionAuthenticationFormLoader:"connectionAuthenticationFormLoader___jE6nw",button:"button___YvtcG"};var v=t(37549);const S=(0,o.PA)((function ConnectionAuthenticationDialog({payload:e,rejectDialog:n,resolveDialog:t}){const o=(0,r.W)(),S=(0,s.d)(m),[C]=(0,a.i)({focusFirstChild:!0}),{driver:_}=(0,g.Y)(e.driverId||"");return(0,i.jsxs)(c.n,{size:"large",children:[(0,i.jsx)(d.D,{title:"connections_connection_credentials_provisioning",subTitle:"connections_connection_credentials_provisioning_description",icon:_?.icon,onReject:n}),(0,i.jsx)(l.a,{children:(0,i.jsx)(u.l,{ref:C,className:(0,h.s)(S,{submittingForm:!0}),onSubmit:()=>t(),children:(0,i.jsx)(v.A,{config:e.config,authModelId:e.authModelId,networkHandlers:e.networkHandlers,formId:e.config.connectionId||e.driverId,className:(0,h.s)(S,{connectionAuthenticationFormLoader:!0}),hideFeatures:["nonSecuredProperty"]})})}),(0,i.jsx)(f.Z,{children:(0,i.jsx)(p.$,{mod:["unelevated"],className:(0,h.s)(S,{button:!0}),onClick:()=>t(),children:o("ui_apply")})})]})}))},18071:(e,n,t)=>{t.r(n),t.d(n,{ConnectionAuthenticationForm:()=>b});var i=t(41773),o=t(7838),r=t(17675),s=t(84383),a=t(76652),c=t(16101),d=t(13821),l=t(13359),u=t(15380),h=t(14249),f=t(41684),p=t(39865),g=t(64043),m=t(43974),v=t(94538),S=t(85421);const C=(0,o.PA)((function NetworkHandlerAuthForm({id:e,networkHandlersConfig:n,allowSaveCredentials:t,disabled:o}){const a=(0,r.W)(),c=(0,s.q)(NetworkHandlerAuthForm,g.NetworkHandlerResource,e);n.some((n=>n.id===e))||n.push({id:e,authType:m.f$w.Password,userName:"",password:"",savePassword:!1,secureProperties:{}});const h=n.find((n=>n.id===e)),f=h.id===g.SSH_TUNNEL_ID,C=h.authType===m.f$w.PublicKey,_=C?"Passphrase":a(`connections_network_handler_${e}_password`,"connections_network_handler_default_password"),b=c.data?.properties.filter((e=>e.features.includes(S.$)));return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.U,{children:c.data?.label||a(`connections_network_handler_${e}_title`,"connections_network_handler_default_title")}),f&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.F,{type:"text",name:"userName",state:h,disabled:o,children:a(`connections_network_handler_${e}_user`,"connections_network_handler_default_user")}),(0,i.jsx)(p.F,{type:"password",name:"password",canShowPassword:!1,state:h,disabled:o,children:_})]}),f&&C&&(0,i.jsx)(v.g,{state:h,disabled:o}),!f&&(0,i.jsx)(l.d,{state:h.secureProperties,properties:b??[],autofillToken:"new-password",hideEmptyPlaceholder:!0}),t&&(0,i.jsx)(u.G,{id:e+"_savePassword",name:"savePassword",state:h,label:a("connections_connection_edit_save_credentials"),disabled:o})]})})),_=(0,o.PA)((function NetworkHandlers({networkHandlers:e,networkHandlersConfig:n,allowSaveCredentials:t,disabled:o}){return e.length?(0,i.jsx)(c.Y,{gap:!0,small:!0,children:e.map((e=>(0,i.jsx)(C,{id:e,networkHandlersConfig:n,allowSaveCredentials:t,disabled:o},e)))}):null})),b=(0,o.PA)((function ConnectionAuthenticationForm({config:e,networkHandlers:n,authProperties:t,authModelId:o,formId:p,allowSaveCredentials:g,disabled:m,className:v,hideFeatures:S}){const C=(0,r.W)(),b=(0,s.q)(ConnectionAuthenticationForm,f.DatabaseAuthModelsResource,o);let y=b.data?.properties;return t&&(y=t),y&&S?.length&&(y=y.filter((e=>!e.features.some((e=>S.includes(e)))))),(0,i.jsxs)(a.m,{className:v,children:[o&&(0,i.jsx)(c.Y,{gap:!0,small:!0,children:y?(0,i.jsxs)(i.Fragment,{children:[!!n?.length&&(0,i.jsx)(d.U,{children:C("connections_database_authentication")}),(0,i.jsx)(l.d,{autofillToken:`section-${p||""} section-auth`,properties:y,state:e.credentials,disabled:m,canShowPassword:!1}),g&&(0,i.jsx)(u.G,{id:p||"DBAuthSaveCredentials",name:"saveCredentials",label:C("connections_connection_edit_save_credentials"),disabled:m,state:e})]}):(0,i.jsx)(h.x,{children:"Authentication data is not avaliable"})}),n&&e.networkHandlersConfig&&(0,i.jsx)(_,{networkHandlers:n,networkHandlersConfig:e.networkHandlersConfig,allowSaveCredentials:g,disabled:m})]})}))},37549:(e,n,t)=>{t.d(n,{A:()=>i});const i=(0,t(50420).j)((()=>Promise.all([t.e(11502),t.e(7542),t.e(67557),t.e(89814),t.e(11450),t.e(36429)]).then(t.bind(t,18071)).then((e=>e.ConnectionAuthenticationForm))))},91022:(e,n,t)=>{t.d(n,{Z:()=>i});const i=(0,t(15993).createContext)(null)},6730:(e,n,t)=>{t.d(n,{ConnectionForm:()=>x});var i=t(41773),o=t(7838),r=t(15993),s=t(77337),a=t(64928),c=t(37046),d=t(91184),l=t(99152),u=t(7167),h=t(69519),f=t(84972),p=t(6899),g=t(42157),m=t(18699),v=t(19395),S=t(22321),C=t(44451),_=t(52843),b=t(91022);const y={tabList:"tabList___PIbb_",connectionTopBar:"connectionTopBar___WUQco theme-border-color-background theme-background-secondary theme-text-on-secondary",connectionTopBarTabs:"connectionTopBarTabs___hbQLn",connectionTopBarActions:"connectionTopBarActions___We7HH",connectionStatusMessage:"connectionStatusMessage___K1TKH theme-typography--caption",iconOrImage:"iconOrImage___DMyEV",box:"box___M1QWs theme-background-secondary theme-text-on-secondary",contentBox:"contentBox___TdgPc theme-background-secondary theme-border-color-background"};var I=t(22799),w=t(50400);const x=(0,o.PA)((function ConnectionForm({state:e,onCancel:n,onSave:t=(()=>{}),className:o}){const x=(0,s.U)({onSave:t}),j=(0,m.h)(I.ConnectionFormService),P=(0,a.d)(y),k=(0,c.m)({onSubmit:n=>{"test"===n?.type?e.test():e.save()}}),T=(0,s.U)((()=>({save:async()=>k.submit(new SubmitEvent("submit")),test:async()=>k.submit(new SubmitEvent("test"))})));return(0,d.H)({executor:e.submittingTask,postHandlers:[function save(e,n){const t=n.getContext(j.connectionValidationContext),i=n.getContext(j.connectionStatusContext),o=n.getContext(w.I);t.valid&&i.saved&&"submit"===e.submitType&&x.onSave(o)}]}),(0,r.useEffect)((()=>{e.loadConnectionInfo()}),[e]),e.initError?(0,i.jsx)(l.Z,{exception:e.initError,onRetry:()=>e.loadConnectionInfo()}):e.configured?(0,i.jsx)(f.l,{context:k,contents:!0,children:(0,i.jsx)(S._,{container:j.tabsContainer,localState:e.partsState,state:e,onCancel:n,children:(0,i.jsxs)("div",{className:(0,u.s)(P,{box:!0},o),children:[(0,i.jsxs)("div",{className:(0,u.s)(P,{connectionTopBar:!0}),children:[(0,i.jsxs)("div",{className:(0,u.s)(P,{connectionTopBarTabs:!0}),children:[(0,i.jsx)("div",{className:(0,u.s)(P,{connectionStatusMessage:!0}),children:(0,i.jsx)(p.M,{type:v.R.Info,message:e.statusMessage})}),(0,i.jsx)(C.w,{className:(0,u.s)(P,{tabList:!0}),disabled:e.disabled,underline:!0,big:!0})]}),(0,i.jsx)("div",{className:(0,u.s)(P,{connectionTopBarActions:!0}),children:(0,i.jsx)(h.a,{suspense:!0,inline:!0,hideMessage:!0,hideException:!0,children:(0,i.jsx)(b.Z.Provider,{value:T,children:(0,i.jsx)(g.O,{container:j.actionsContainer,state:e,onCancel:n})})})})]}),(0,i.jsx)("div",{className:(0,u.s)(P,{contentBox:!0}),children:(0,i.jsx)(_.A,{})})]})})}):(0,i.jsx)("div",{className:(0,u.s)(P,{box:!0},o),children:(0,i.jsx)(h.a,{})})}))},35578:(e,n,t)=>{t.d(n,{ConnectionFormBaseActions:()=>m});var i=t(41773),o=t(7838),r=t(15993),s=t(68164),a=t(17675),c=t(84383),d=t(34685),l=t(89232),u=t(74749),h=t(41684),f=t(40601),p=t(58855),g=t(91022);const m=(0,o.PA)((function ConnectionFormBaseActions({state:e,onCancel:n}){const t=(0,r.useContext)(g.Z);if(!t)throw new Error("ConnectionFormActionsContext not provided");const o=(0,a.W)(),m=(0,c.q)(ConnectionFormBaseActions,u.DBDriverResource,e.config.driverId||null).data,v=(0,c.q)(ConnectionFormBaseActions,f.ServerConfigResource,void 0),{data:S}=(0,c.q)(ConnectionFormBaseActions,h.DatabaseAuthModelsResource,(0,d.u)((()=>e.config.authModelId||e.info?.authModel||m?.defaultAuthModel||null))),C=(0,p.s)({providerId:S?.requiredAuth??e.info?.requiredAuth??s.T}),_=C.providerId===s.T||C.authorized,b=v.data?.distributed&&!!e.config.sharedCredentials;return(0,i.jsxs)(i.Fragment,{children:[n&&(0,i.jsx)(l.$,{type:"button",disabled:e.disabled,mod:["outlined"],onClick:n,children:o("ui_processing_cancel")}),!b&&(0,i.jsx)(l.$,{type:"button",disabled:e.disabled||!_,mod:["outlined"],loader:!0,onClick:t.test,children:o("connections_connection_test")}),(0,i.jsx)(l.$,{type:"button",disabled:e.disabled||e.readonly,mod:["unelevated"],loader:!0,onClick:t.save,children:o("edit"===e.mode?"ui_processing_save":"ui_processing_create")})]})}))},27411:(e,n,t)=>{t.d(n,{Q:()=>i});const i=t(15993).lazy((async()=>{const{ConnectionForm:e}=await Promise.all([t.e(11502),t.e(97493),t.e(67557),t.e(11450),t.e(87830)]).then(t.bind(t,6730));return{default:e}}))},22799:(e,n,t)=>{t.r(n),t.d(n,{ConnectionFormService:()=>S});var i=t(1118),o=t(94866),r=t(46210),s=t(5576),a=t(71635),c=t(19395),d=t(14452),l=t(86764),u=t(55803),h=t(34227),f=t(68356);const p=(0,t(50420).j)((()=>Promise.all([t.e(11502),t.e(7542),t.e(67557),t.e(89814),t.e(11450),t.e(62570),t.e(10211)]).then(t.bind(t,17786)).then((e=>e.ConnectionAuthenticationDialog))));const g=t(15993).lazy((async()=>{const{ConnectionFormBaseActions:e}=await Promise.all([t.e(11502),t.e(7542),t.e(97493),t.e(67557),t.e(89814),t.e(11450),t.e(62570),t.e(32592)]).then(t.bind(t,35578));return{default:e}}));var m=t(50400),v=t(14371);let S=class ConnectionFormService{constructor(e,n,t){this.notificationService=e,this.commonDialogService=n,this.localizationService=t,this.connectionValidationContext=()=>({valid:!0,messages:[],info(e){this.messages.push(e)},error(e){this.messages.push(e),this.valid=!1}}),this.connectionStatusContext=()=>({saved:!0,messages:[],exception:null,info(e){this.messages.push(e)},error(e,n=null){this.messages.push(e),this.saved=!1,this.exception=n}}),this.showSubmittingStatusMessage=(e,n)=>{const t=n.getContext(this.connectionStatusContext);t.saved||l.a.interrupt(n),t.messages.length>0&&(t.exception?this.notificationService.logException(t.exception,t.messages[0],t.messages.slice(1).join("\n")):this.notificationService.notify({title:t.messages[0],message:t.messages.slice(1).join("\n")},t.saved?c.R.Success:c.R.Error))},this.askCredentials=async(e,n)=>{const t=n.getContext(v.t);if("test"!==e.submitType||!t.authModelId&&!t.networkHandlers.length)return;const i=n.getContext(m.I);(0,o.h5)((()=>{t.authModelId&&(i.credentials||(i.credentials={...e.state.config.credentials}),i.credentials=(0,o.sH)(i.credentials)),t.networkHandlers.length>0&&(i.networkHandlersConfig||(i.networkHandlersConfig=(0,o.HO)(e.state.config.networkHandlersConfig)||[]),i.networkHandlersConfig=(0,o.sH)(i.networkHandlersConfig))}));await this.commonDialogService.open(p,{config:i,authModelId:t.authModelId,networkHandlers:t.networkHandlers,driverId:i.driverId})===a.DialogueStateResult.Rejected&&l.a.interrupt(n)},this.ensureValidation=(e,n)=>{const t=n.getContext(this.connectionValidationContext);if(t.valid||l.a.interrupt(n),t.messages.length>0){const n=t.messages.map((e=>this.localizationService.translate(e)));this.notificationService.notify({title:"edit"===e.state.mode?"connections_administration_connection_save_error":"connections_administration_connection_create_error",message:n.join("\n")},t.valid?c.R.Info:c.R.Error)}},this.tabsContainer=new f.a("Connection settings"),this.actionsContainer=new r.B,this.configureTask=new u.t,this.fillConfigTask=new u.t,this.prepareConfigTask=new u.t,this.formSubmittingTask=new u.t,this.formValidationTask=new u.t,this.formStateTask=new u.t,this.formSubmittingTask.before(this.formValidationTask).before(this.prepareConfigTask),this.formStateTask.before(this.prepareConfigTask,(e=>({state:e,submitType:"submit"}))),this.prepareConfigTask.addPostHandler(this.askCredentials),this.formSubmittingTask.addPostHandler(this.showSubmittingStatusMessage),this.formValidationTask.addPostHandler(this.ensureValidation),this.actionsContainer.add(g)}};S=(0,i.Cg)([(0,s._)(),(0,i.Sn)("design:paramtypes",[d.NotificationService,a.CommonDialogService,h.LocalizationService])],S)},77583:(e,n,t)=>{t.d(n,{C:()=>ConnectionFormState});var i=t(94866),o=t(49690),r=t(29606),s=t(48619),a=t(35721),c=t(31324),d=t(90783);class ConnectionFormState{get loading(){return this.loadConnectionTask.executing||this.submittingTask.executing}get disabled(){return this.loading||!!this.stateInfo?.disabled||this.loadConnectionTask.executing}get availableDrivers(){return 0===this._availableDrivers.length&&this.config.driverId?[this.config.driverId]:this._availableDrivers}get info(){if(this.config.connectionId&&null!==this.projectId)return this.resource.get((0,o.createConnectionParam)(this.projectId,this.config.connectionId))}get readonly(){return!!this.stateInfo?.readonly||"admin"!==this.type&&"create"!==this.mode&&!this.info?.canEdit}get id(){return"create"===this.mode?"create":this.config.connectionId||this._id}constructor(e,n,t,o){this.projectsService=e,this.projectInfoResource=n,this._id=(0,a.u)(),this.initError=null,this.resource=o,this.projectId=null,this.config={},this._availableDrivers=[],this.stateInfo=null,this.partsState=new c.C,this.service=t,this.formStateTask=new r.Q(this,(()=>!0)),this.loadConnectionTask=new r.Q(this,(()=>!0)),this.submittingTask=new r.Q,this.closeTask=new r.Q,this.statusMessage=null,this.configured=!1,this.mode="create",this.type="public",this.syncProject=this.syncProject.bind(this),this.syncInfo=this.syncInfo.bind(this),this.test=this.test.bind(this),this.save=this.save.bind(this),this.checkFormState=this.checkFormState.bind(this),this.loadInfo=this.loadInfo.bind(this),this.updateFormState=this.updateFormState.bind(this),this.formStateTask.addCollection(t.formStateTask).addPostHandler(this.updateFormState),this.resource.onItemUpdate.addHandler(this.syncInfo),this.projectInfoResource.onDataUpdate.addHandler(this.syncProject),this.projectsService.onActiveProjectChange.addHandler(this.syncProject),this.submittingTask.addPostHandler((async(e,n)=>{const i=n.getContext(t.connectionStatusContext),o=n.getContext(t.connectionValidationContext);"submit"===e.submitType&&i.saved&&o.valid&&(this.reset(),await this.load())})),this.loadConnectionTask.before(t.configureTask).addPostHandler(this.loadInfo).next(t.fillConfigTask,((e,n)=>{const t=n.getContext(d.i);return{state:e,updated:e.info!==t.info||e.config.driverId!==t.driverId||!this.configured}})).next(this.formStateTask),(0,i.Gn)(this,{projectId:i.sH,mode:i.sH,type:i.sH,config:i.sH,availableDrivers:i.EW,_availableDrivers:i.sH,info:i.EW,statusMessage:i.sH,configured:i.sH,readonly:i.EW,stateInfo:i.sH,initError:i.sH.ref,id:i.EW,reset:i.XI,setOptions:i.XI,setConfig:i.XI,setAvailableDrivers:i.XI,updateFormState:i.XI})}async loadConnectionInfo(){try{return this.initError=null,await this.loadConnectionTask.execute(this),this.info}catch(e){throw this.initError=e,e}}async load(){await this.loadConnectionInfo()}reset(){this.configured=!1,this.partsState.clear()}setPartsState(e){return this.partsState=e,this}setOptions(e,n){return this.mode=e,this.type=n,this}setConfig(e,n){return this.setProject(e),this.config=n,this.reset(),this}setProject(e){return this.projectId=e,this}setAvailableDrivers(e){return this._availableDrivers=e,this.reset(),this}async save(){await this.submittingTask.executeScope({state:this,submitType:"submit"},this.service.formSubmittingTask)}async test(){await this.submittingTask.executeScope({state:this,submitType:"test"},this.service.formSubmittingTask)}async checkFormState(){return await this.loadConnectionInfo(),this.stateInfo}dispose(){this.resource.onItemUpdate.removeHandler(this.syncInfo),this.projectInfoResource.onDataUpdate.removeHandler(this.syncProject),this.projectsService.onActiveProjectChange.removeHandler(this.syncProject)}async close(){await this.closeTask.execute()}updateFormState(e,n){const t=n.getContext(s.D);"create"===this.mode&&t.markEdited(),this.statusMessage=t.statusMessage,null===this.statusMessage&&"edit"===this.mode&&(this.info?.canEdit||(this.statusMessage="connections_connection_edit_not_own_deny")),this.stateInfo=t,this.configured=!0}syncInfo(e){this.config.connectionId&&null!==this.projectId&&this.resource.isIntersect(e,(0,o.createConnectionParam)(this.projectId,this.config.connectionId))&&this.loadConnectionInfo()}async syncProject(){if(!this.projectId)return;const e=this.projectInfoResource.get(this.projectId);e?.canEditDataSources&&this.projectsService.activeProjects.includes(e)||await this.close()}async loadInfo(e,n){if(!e.config.connectionId||null===e.projectId)return;const t=(0,o.createConnectionParam)(e.projectId,e.config.connectionId),i=n.getContext(d.i);e.resource.has(t)&&await e.resource.load(t,i.connectionIncludes)}}},50400:(e,n,t)=>{function connectionConfigContext(){return{}}t.d(n,{I:()=>connectionConfigContext})},14371:(e,n,t)=>{function connectionCredentialsStateContext(){return{authModelId:null,networkHandlers:[],requireAuthModel(e){this.authModelId=e},requireNetworkHandler(e){this.networkHandlers.push(e)}}}t.d(n,{t:()=>connectionCredentialsStateContext})},21124:(e,n,t)=>{t.r(n),t.d(n,{ConnectionDriverPropertiesTabService:()=>p});var i=t(1118),o=t(94866),r=t(74749),s=t(82103),a=t(5576),c=t(12629),d=t(48619),l=t(90783),u=t(22799),h=t(50400);const f=t(15993).lazy((async()=>{const{DriverProperties:e}=await Promise.all([t.e(11502),t.e(7542),t.e(97493),t.e(67557),t.e(11450),t.e(11116),t.e(62570),t.e(95860),t.e(99603)]).then(t.bind(t,55226));return{default:e}}));let p=class ConnectionDriverPropertiesTabService extends s.j{constructor(e,n){super(),this.connectionFormService=e,this.dbDriverResource=n,(0,o.Gn)(this,{fillConfig:o.XI})}register(){this.connectionFormService.tabsContainer.add({key:"driver_properties",name:"customConnection_properties",title:"customConnection_properties",order:2,panel:()=>f,isDisabled:(e,n)=>!n?.state.config.driverId||!n.state.config.driverId}),this.connectionFormService.prepareConfigTask.addHandler(this.prepareConfig.bind(this)),this.connectionFormService.formStateTask.addHandler(this.formState.bind(this)),this.connectionFormService.fillConfigTask.addHandler(this.fillConfig.bind(this)),this.connectionFormService.configureTask.addHandler(this.configure.bind(this))}load(){}configure(e,n){n.getContext(l.i).include("includeProperties","includeProviderProperties")}fillConfig({state:e,updated:n},t){n&&(e.config.properties||(e.config.properties={}),e.info&&(e.config.properties={...e.info.properties}))}prepareConfig({state:e},n){const t=n.getContext(h.I);if(t.properties={...e.config.properties},t.driverId){const e=this.dbDriverResource.get(t.driverId),n={},i=new Set(e?.driverProperties?.map((e=>e.id))??[]);for(let e of Object.keys(t.properties)){const o=t.properties[e];i?.has(e)||(e=e.trim()),n[e]="string"==typeof o?o.trim():o}t.properties=n}}formState(e,n){if(!e.info||!e.config.driverId)return;const t=n.getContext(h.I),i=this.dbDriverResource.get(e.config.driverId);if(i?.driverProperties&&!(0,c.I)(i.driverProperties,t.properties,e.info.properties)){n.getContext(d.D).markEdited()}}};p=(0,i.Cg)([(0,a._)(),(0,i.Sn)("design:paramtypes",[u.ConnectionFormService,r.DBDriverResource])],p)},55226:(e,n,t)=>{t.d(n,{DriverProperties:()=>v});var i=t(41773),o=t(94866),r=t(7838),s=t(15993),a=t(64928),c=t(84383),d=t(71120),l=t(7167),u=t(16101),h=t(44483),f=t(74749),p=t(26909),g=t(35721);const m={coloredContainer:"coloredContainer___u_XtI",group:"group___FMSXI",propertiesTable:"propertiesTable___NXZuF"},v=(0,r.PA)((function DriverProperties({tabId:e,state:n}){const{selected:t}=(0,p.V)(e),r=(0,a.d)(m),[v]=(0,s.useState)((()=>{const e=(0,o.sH)([]);return{propertiesList:e,add:function add(n,t){e.unshift({id:(0,g.u)(),key:n??"",defaultValue:t??"",keyPlaceholder:"property",new:void 0===n})},remove:function remove(n){e.splice(e.indexOf(n),1)}}})),S=(0,c.q)(DriverProperties,f.DBDriverResource,{key:t&&n.config.driverId||null,includes:["includeDriverProperties"]});(0,o.h5)((()=>{if(S.data)for(const e of Object.keys(n.config.properties))S.data.driverProperties.some((n=>n.id===e))||v.propertiesList.some((n=>n.key===e))||v.add(e,n.config.properties[e])}));const C=(0,s.useMemo)((()=>(0,o.EW)((()=>[...v.propertiesList,...S.data?.driverProperties?S.data.driverProperties.map((e=>({id:e.id,key:e.id,keyPlaceholder:e.id,displayName:e.displayName,valuePlaceholder:e.defaultValue,defaultValue:e.defaultValue,description:e.description,validValues:e.validValues}))):[]]))),[S.data]);return(0,i.jsx)(d.U,{className:(0,l.s)(r,{coloredContainer:!0}),parent:!0,children:(0,i.jsx)(u.Y,{className:(0,l.s)(r,{group:!0}),box:!0,large:!0,children:(0,i.jsx)(h.k,{className:(0,l.s)(r,{propertiesTable:!0}),properties:C.get(),propertiesState:n.config.properties,readOnly:n.readonly,filterable:!0,onAdd:v.add,onRemove:v.remove})})})}))},91941:(e,n,t)=>{t.r(n),t.d(n,{ConnectionOptionsTabService:()=>H,Options:()=>T});var i=t(1118),o=t(94866),r=t(15993),s=t(68164),a=t(11130),c=t(6332),d=t(49690),l=t(72464),u=t(74749),h=t(41684),f=t(82103),p=t(5576),g=t(34227),m=t(10392),v=t(40601),S=t(43974),C=t(12629),_=t(48619),b=t(14509),y=t(9724),I=t(42891),w=t(90783),x=t(22799),j=t(50400),P=t(14371),k=t(33682);const T=r.lazy((async()=>{const{Options:e}=await Promise.all([t.e(11502),t.e(7542),t.e(97493),t.e(67557),t.e(89814),t.e(11450),t.e(62570),t.e(95860),t.e(87698)]).then(t.bind(t,17270));return{default:e}}));let H=class ConnectionOptionsTabService extends f.j{constructor(e,n,t,i,r,s,a,c){super(),this.serverConfigResource=e,this.projectInfoResource=n,this.connectionFormService=t,this.dbDriverResource=i,this.userInfoResource=r,this.localizationService=s,this.authProvidersResource=a,this.databaseAuthModelsResource=c,(0,o.Gn)(this,{fillConfig:o.XI})}register(){this.connectionFormService.tabsContainer.add({key:"options",name:"customConnection_main",order:1,panel:()=>T}),this.connectionFormService.prepareConfigTask.addHandler(this.prepareConfig.bind(this)),this.connectionFormService.formValidationTask.addHandler(this.validate.bind(this)),this.connectionFormService.formSubmittingTask.addHandler(this.save.bind(this)),this.connectionFormService.formStateTask.addHandler(this.formState.bind(this)).addHandler(this.formAuthState.bind(this)),this.connectionFormService.configureTask.addHandler(this.configure.bind(this)),this.connectionFormService.fillConfigTask.addHandler(this.fillConfig.bind(this))}load(){}isProjectShared(e){if(null===e.projectId)return!1;const n=this.projectInfoResource.get(e.projectId);return!!n&&(0,m.isSharedProject)(n)}async save({state:e,submitType:n},t){const i=t.getContext(this.connectionFormService.connectionStatusContext),o=t.getContext(j.I);if(e.projectId)try{if("submit"===n)if("edit"===e.mode){const n=await e.resource.update((0,d.createConnectionParam)(e.projectId,o.connectionId),o);i.info("Connection was updated"),i.info(n.name)}else{const n=await e.resource.create(e.projectId,o);o.connectionId=n.id,i.info("Connection was created"),i.info(n.name)}else{const n=await e.resource.test(e.projectId,o);i.info("Connection is established"),i.info("Client version: "+n.clientVersion),i.info("Server version: "+n.serverVersion),i.info("Connection time: "+n.connectTime)}}catch(e){"submit"===n?i.error("connections_connection_create_fail",e):i.error("connections_connection_test_fail",e)}else i.error("connections_connection_create_fail")}async validate({state:e},n){const t=n.getContext(this.connectionFormService.connectionValidationContext);if(e.config.configurationType===S.dB5.Manual&&0===e.config.host?.length&&e.config.driverId){(await this.dbDriverResource.load(e.config.driverId)).embedded||t.error("plugin_connections_connection_form_host_invalid")}if(e.config.name?.length||t.error("plugin_connections_connection_form_name_invalid"),e.config.driverId&&e.config.configurationType){(await this.dbDriverResource.load(e.config.driverId,["includeProviderProperties"])).configurationTypes.includes(e.config.configurationType)||t.error("plugin_connections_connection_form_host_configuration_invalid")}if(null!==e.projectId&&"create"===e.mode){const n=this.projectInfoResource.get(e.projectId);n?.canEditDataSources||t.error("plugin_connections_connection_form_project_invalid")}}async setDefaults(e){if(!e.config.driverId)return;const n=await this.dbDriverResource.load(e.config.driverId,["includeProviderProperties"]);e.config.authModelId=n?.defaultAuthModel,e.config.configurationType=n?.configurationTypes.includes(S.dB5.Manual)?S.dB5.Manual:S.dB5.Url,e.config.host=n?.defaultServer||"localhost",e.config.port=n?.defaultPort,e.config.databaseName=n?.defaultDatabase,e.config.url=n?.sampleURL,(0,l.E)(n)?e.config.name=e.config.url:e.config.name=(0,k.G)(n.name||"",e.config.host,e.config.port,n.defaultPort)}async fillConfig({state:e,updated:n},t){if(n)if(e.config.credentials&&!n||(e.config.credentials={},e.config.saveCredentials=!1),e.config.providerProperties&&!n||(e.config.providerProperties={}),e.info){if(e.config.connectionId=e.info.id,e.config.configurationType=e.info.configurationType,e.config.name=e.info.name,e.config.description=e.info.description,e.config.template=e.info.template,e.config.driverId=e.info.driverId,e.config.host=e.info.host,e.config.port=e.info.port,e.config.serverName=e.info.serverName,e.config.databaseName=e.info.databaseName,e.config.url=e.info.url,e.config.folder=e.info.folder,e.config.authModelId=e.info.authModel,e.config.saveCredentials=e.info.credentialsSaved,e.config.sharedCredentials=e.info.sharedCredentials,e.config.keepAliveInterval=e.info.keepAliveInterval,e.info.authProperties)for(const n of e.info.authProperties)n.features.includes("password")||(e.config.credentials[n.id]=n.value);e.info.providerProperties&&(e.config.providerProperties={...e.info.providerProperties})}else await this.setDefaults(e)}configure(e,n){n.getContext(w.i).include("includeOrigin","includeAuthProperties","includeCredentialsSaved","customIncludeOptions")}getTrimmedPropertiesConfig(e,n){const t=(0,o.HO)(n);for(const i of e){const e=n?.[i.id];"string"==typeof e&&e&&(t[i.id]=e?.trim())}return t}async prepareConfig({state:e},n){const t=n.getContext(j.I),i=n.getContext(P.t);if(!e.config.driverId||!e.projectId)return;const r=await this.dbDriverResource.load(e.config.driverId,["includeProviderProperties"]),s=(0,o.HO)(t);if("edit"===e.mode&&(s.connectionId=e.config.connectionId),s.configurationType=e.config.configurationType,s.name=e.config.name?.trim(),s.name&&"create"===e.mode){const n=(await e.resource.load((0,d.ConnectionInfoProjectKey)(e.projectId))).map((e=>e.name));s.name=(0,b.l)(s.name,n)}if(s.description=e.config.description?.trim(),s.template=e.config.template,s.driverId=e.config.driverId,s.keepAliveInterval=Number(e.config.keepAliveInterval),!e.config.template&&e.config.folder&&(s.folder=e.config.folder),s.configurationType===S.dB5.Url?s.url=e.config.url?.trim():(r.embedded||(s.host=e.config.host?.trim(),s.port=e.config.port?.trim()),r.requiresServerName&&(s.serverName=e.config.serverName?.trim()),s.databaseName=e.config.databaseName?.trim()),(e.config.authModelId||r.defaultAuthModel)&&!r.anonymousAccess){s.authModelId=e.config.authModelId||r.defaultAuthModel,s.sharedCredentials=e.config.sharedCredentials,s.saveCredentials=e.config.saveCredentials||s.sharedCredentials;const n=await this.getConnectionAuthModelProperties(s.authModelId,e.info);this.isCredentialsChanged(n,e.config.credentials)&&(s.credentials=this.getTrimmedPropertiesConfig(n,{...e.config.credentials})),s.saveCredentials||i.requireAuthModel(s.authModelId)}if(r.providerProperties.length>0){const n={...e.config.providerProperties};for(const e of r.providerProperties){if(!e.id)continue;const t=e.supportedConfigurationTypes?.some((e=>e===s.configurationType));if(t){const t=(0,y.K)(e.defaultValue);!(e.id in n)&&t&&(n[e.id]=e.defaultValue)}else delete n[e.id]}s.providerProperties=n;for(const e of Object.keys(s.providerProperties))"string"==typeof s.providerProperties[e]&&(s.providerProperties[e]=s.providerProperties[e]?.trim())}(0,o.h5)((()=>{Object.assign(t,s)}))}async formAuthState(e,n){const t=n.getContext(j.I),i=n.getContext(_.D),o=await this.dbDriverResource.load(t.driverId,["includeProviderProperties"]),r=(await this.databaseAuthModelsResource.load(t.authModelId??e.info?.authModel??o.defaultAuthModel)).requiredAuth??e.info?.requiredAuth??s.T;if(await this.userInfoResource.load(),!this.userInfoResource.hasToken(r)){const n=await this.authProvidersResource.load(r),t=this.localizationService.translate("connections_public_connection_cloud_auth_required",void 0,{providerLabel:n.label});i.setInfo(t),i.readonly="edit"===e.mode}}async formState(e,n){if(!e.info)return;const t=n.getContext(j.I),i=n.getContext(_.D),o=await this.dbDriverResource.load(e.config.driverId,["includeProviderProperties"]);(!(0,I.V)(t.name,e.info.name,"")||!(0,I.V)(t.configurationType,e.info.configurationType,S.dB5.Manual)||!(0,I.V)(t.description,e.info.description,"")||!(0,I.V)(t.template,e.info.template,!0)||!(0,I.V)(t.folder,e.info.folder,void 0)||!(0,I.V)(t.driverId,e.info.driverId,"")||void 0!==t.url&&!(0,I.V)(t.url,e.info.url,"")||void 0!==t.host&&!(0,I.V)(t.host,e.info.host,"")||void 0!==t.port&&!(0,I.V)(t.port,e.info.port,"")||void 0!==t.serverName&&!(0,I.V)(t.serverName,e.info.serverName,"")||void 0!==t.databaseName&&!(0,I.V)(t.databaseName,e.info.databaseName,"")||void 0!==t.credentials||void 0!==t.authModelId&&!(0,I.V)(t.authModelId,e.info.authModel,"")||void 0!==t.saveCredentials&&t.saveCredentials!==e.info.credentialsSaved||void 0!==t.sharedCredentials&&t.sharedCredentials!==e.info.sharedCredentials||void 0!==t.providerProperties&&!(0,C.I)(o.providerProperties,t.providerProperties,e.info.providerProperties)||void 0!==t.keepAliveInterval&&!(0,I.V)(t.keepAliveInterval,e.info.keepAliveInterval))&&i.markEdited()}isCredentialsChanged(e,n){for(const t of e){const e=n[t.id];if(t.features.includes("password")){if(void 0!==e)return!!t.features.includes("file")||!!e}else if(e!==t.value)return!0}return!1}async getConnectionAuthModelProperties(e,n){let t=(await this.databaseAuthModelsResource.load(e)).properties;return n?.authProperties&&n.authProperties.length>0&&(t=n.authProperties),t}};H=(0,i.Cg)([(0,p._)(),(0,i.Sn)("design:paramtypes",[v.ServerConfigResource,m.ProjectInfoResource,x.ConnectionFormService,u.DBDriverResource,a.UserInfoResource,g.LocalizationService,c.AuthProvidersResource,h.DatabaseAuthModelsResource])],H)},17270:(e,n,t)=>{t.d(n,{Options:()=>re});var i=t(41773),o=t(7838),r=t(15993),s=t(68164),a=t(84383),c=t(17675),d=t(64928),l=t(56909),u=t(56138),h=t(34685),f=t(84972),p=t(7167),g=t(71120),m=t(76652),v=t(16101),S=t(86795),C=t(61549),_=t(88297),b=t(47434),y=t(39865),I=t(76228),w=t(13821),x=t(15380),j=t(27863),P=t(74749),k=t(41684),T=t(46880),H=t(18699),A=t(40601),N=t(43974),D=t(43524),R=t(58855),F=t(50083),M=t(13359),O=t(61077);const E=(0,o.PA)((function ConnectionAuthModelCredentialsForm({credentials:e,defaultCredentials:n,properties:t,readonly:o,disabled:r}){return(0,i.jsx)(m.m,{wrap:!0,gap:!0,hideEmpty:!0,children:(0,i.jsx)(M.d,{autofillToken:O.n?"section-connection-authentication section-secrets":"new-password",properties:t,state:e,defaultState:n,disabled:r,readOnly:o,showRememberTip:!0,hideEmptyPlaceholder:!0,tiny:!0})})}));var L=t(3094),q=t(7278),V=t(43759),B=t(72755),U=t(9724);const z=(0,o.PA)((function ConnectionAuthModelSelector({authModelCredentialsState:e,applicableAuthModels:n,onAuthModelChange:t,readonlyAuthModelId:o,readonly:r,disabled:s}){const c=(0,L.J)(B.y.admin),d=(0,a.q)(ConnectionAuthModelSelector,k.DatabaseAuthModelsResource,n.length?(0,q.OU)(n):V.r8).data.filter(U.K).filter((e=>c||!e.requiresLocalConfiguration));return d.length<=1?null:(0,i.jsx)(S.G,{name:"authModelId",state:e,items:d,keySelector:e=>e.id,valueSelector:e=>e.displayName,titleSelector:e=>e.description,searchable:d.length>10,readOnly:r||o,disabled:s,tiny:!0,fill:!0,onSelect:t})}));var $=t(22799);var W=t(91941);const G={form:"form___QIVE_"},K=(0,o.PA)((function ParametersForm({config:e,embedded:n,requiresServerName:t,disabled:o,readOnly:r,originLocal:s}){const a=(0,c.W)();return(0,i.jsxs)(m.m,{gap:!0,children:[!n&&(0,i.jsxs)(m.m,{wrap:!0,gap:!0,children:[(0,i.jsx)(y.F,{type:"text",name:"host",state:e,disabled:o,readOnly:r||!s,small:!0,required:!0,children:a("customConnection_custom_host")}),(0,i.jsx)(y.F,{type:"number",name:"port",state:e,disabled:o,readOnly:r||!s,tiny:!0,children:a("customConnection_custom_port")})]}),(0,i.jsx)(y.F,{type:"text",name:"databaseName",state:e,disabled:o,readOnly:r,children:a("customConnection_custom_database")}),t&&(0,i.jsx)(y.F,{type:"text",name:"serverName",state:e,disabled:o,readOnly:r,required:!0,children:a("customConnection_custom_server_name")})]})}));var X=t(91176),Z=t(68318),Q=t(13804);const Y={keepAliveInterval:0},J=(0,o.PA)((function ProviderPropertiesForm({config:e,properties:n,disabled:t,readonly:o}){const r=(0,c.W)(),s=n.filter((n=>n.supportedConfigurationTypes?.some((n=>n===e.configurationType)))),{categories:a,isUncategorizedExists:d}=(0,X.y)(s);if(!s.length)return null;const l=s.filter((e=>!e.category&&"Boolean"===e.dataType)),u=s.filter((e=>!e.category&&"Boolean"!==e.dataType));return(0,i.jsxs)(v.Y,{form:!0,gap:!0,children:[d&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(w.U,{children:r("ui_settings")}),l.length>0&&(0,i.jsx)(m.m,{gap:!0,wrap:!0,dense:!0,children:(0,i.jsx)(M.d,{properties:l,state:e.providerProperties,disabled:t,readOnly:o,maximum:!0,hideEmptyPlaceholder:!0})}),u.length>0&&(0,i.jsx)(m.m,{wrap:!0,gap:!0,children:(0,i.jsx)(M.d,{properties:u,state:e.providerProperties,disabled:t,readOnly:o,tiny:!0,hideEmptyPlaceholder:!0})})]}),(0,i.jsx)(y.F,{type:"number",minLength:1,min:0,max:32767,name:"keepAliveInterval",disabled:t,readOnly:o,title:r("connections_connection_keep_alive_tooltip"),state:e,defaultState:Y,children:r("connections_connection_keep_alive")}),a.map(((n,r)=>(0,i.jsx)(m.m,{gap:!0,children:(0,i.jsx)(Z.V,{label:n,defaultExpanded:0===r,children:(0,i.jsx)(m.m,{dense:isOnlyBooleans(s,n),wrap:!0,gap:!0,children:(0,i.jsx)(M.d,{properties:s,state:e.providerProperties,category:n,disabled:t,readOnly:o,geLayoutSize:e=>"checkbox"===(0,Q.b)(e)?{maximum:!0}:{small:!0,noGrow:!0},hideEmptyPlaceholder:!0})})})},`${n}_${e.driverId}`)))]})}));function isOnlyBooleans(e,n){return e.filter((e=>!n||e.category===n)).every((e=>"Boolean"===e.dataType))}var ee=t(94866),ne=t(77337),te=t(72464),ie=t(33682);const oe=[{name:"Manual",value:N.dB5.Manual},{name:"URL",value:N.dB5.Url}],re=(0,o.PA)((function Options({state:e}){const n=(0,a.q)(Options,A.ServerConfigResource,void 0),t=(0,H.h)(W.ConnectionOptionsTabService),o=(0,H.h)($.ConnectionFormService),M=(0,r.useRef)(null),O=(0,c.W)(),{info:L,config:q,availableDrivers:V,submittingTask:B,disabled:U}=e,X=(0,d.d)(G),Z=(0,r.useContext)(D.w),Q=e.readonly||"profile"===L?.authModel;(0,l.e)(B.for(o.formValidationTask),M.current);const Y=function useOptions(e){const n=(0,H.h)(P.DBDriverResource),t=(0,ne.U)((()=>({prevName:null,prevDriverId:null})),{state:e});return(0,ne.U)({updateNameTemplate(e){(0,ee.h5)((()=>{const{state:{config:n,info:i}}=t;if((0,te.E)(e,i))return t.prevName=n.url||"",void(n.name=n.url||"");if(!e)return void(n.name="New connection");const o=(0,ie.G)(e.name||"",n.host,n.port,e.defaultPort);t.prevName=o,n.name=o}))},setDefaults(e){(0,ee.h5)((()=>{const{state:{config:i,info:o},prevDriverId:r}=t;if(o||e?.id!==i.driverId)return;let s;r&&(s=n.get(r)),t.prevDriverId=e?.id||null,i.configurationType&&e?.configurationTypes.includes(i.configurationType)||(i.configurationType=e?.configurationTypes.includes(N.dB5.Manual)?N.dB5.Manual:N.dB5.Url),(!s&&void 0===i.host||i.host===s?.defaultServer)&&(i.host=e?.defaultServer||"localhost"),(!s&&void 0===i.port||i.port===s?.defaultPort)&&(i.port=e?.defaultPort),(!s&&void 0===i.databaseName||i.databaseName===s?.defaultDatabase)&&(i.databaseName=e?.defaultDatabase),(!s&&void 0===i.url||i.url===s?.sampleURL)&&(i.url=e?.sampleURL),this.isNameAutoFill()&&this.updateNameTemplate(e),e?.id!==s?.id&&(i.credentials={},i.providerProperties={},i.authModelId=e?.defaultAuthModel)}))},setAuthModel(e){const{state:{config:n,info:i}}=t;if(n.credentials={},e.id===i?.authModel&&i.authProperties)for(const e of i.authProperties)e.features.includes("password")||(n.credentials[e.id]=e.value);t.state.checkFormState()},isNameAutoFill(){const{prevName:e,state:{config:n,mode:i}}=t;return(n.name===e||null===e)&&"create"===i}})}(e),{credentialsSavingEnabled:re}=(0,u.J)(),se=(0,a.q)(Options,P.DBDriverResource,{key:q.driverId||null,includes:["includeProviderProperties"]},{onData:e=>{Y.setDefaults(e)}}),ae=se.data,ce=oe.filter((e=>ae?.configurationTypes.includes(e.value)));const de=ae?.applicableAuthModels??[],le=(0,a.q)(Options,k.DatabaseAuthModelsResource,(0,h.u)((()=>q.authModelId||L?.authModel||ae?.defaultAuthModel||null)),{onData:e=>Y.setAuthModel(e)}),ue=le.data;const he=(0,R.s)({providerId:ue?.requiredAuth??L?.requiredAuth??s.T}),fe=q.configurationType===N.dB5.Url,pe="edit"===e.mode,ge=!L||(0,T.C)(L),me=se.resource.enabledDrivers.filter((({id:e})=>V.includes(e)));let ve=ue?.properties;L?.authProperties&&L.authProperties.length>0&&q.authModelId===L.authModel&&(ve=L.authProperties);const Se=q.sharedCredentials&&n.data?.distributed;return(0,i.jsx)(f.l,{ref:M,className:(0,p.s)(X,{form:!0}),disabled:se.isLoading(),onChange:function handleFormChange(e,n){"name"!==n&&Y.isNameAutoFill()&&Y.updateNameTemplate(ae),q.template&&(q.folder=void 0)},children:(0,i.jsxs)(g.U,{wrap:!0,overflow:!0,parent:!0,gap:!0,children:[(0,i.jsxs)(m.m,{medium:!0,gap:!0,children:[(0,i.jsxs)(v.Y,{form:!0,gap:!0,children:[(0,i.jsxs)(m.m,{wrap:!0,gap:!0,children:[(0,i.jsx)(S.G,{name:"driverId",state:q,items:me,keySelector:e=>e.id,valueSelector:e=>e.name??"",titleSelector:e=>e.description,iconSelector:e=>e.icon,searchable:me.length>10,readOnly:Q||pe||me.length<2,disabled:U,loading:se.isLoading(),tiny:!0,fill:!0,children:O("connections_connection_driver")}),ce.length>1&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(C.J,{label:O("connections_connection_configuration"),tiny:!0,children:(0,i.jsx)(m.m,{gap:!0,children:(0,i.jsx)(_.z,{name:"configurationType",state:q,children:oe.map((e=>(0,i.jsx)(b.s,{id:e.value,value:e.value,mod:["primary","small"],readOnly:Q||ce.length<2,disabled:Q,keepSize:!0,children:e.name},e.value)))})})})})]}),fe?(0,i.jsx)(y.F,{type:"text",name:"url",state:q,disabled:U,readOnly:Q,autoComplete:`section-${q.driverId||"driver"} section-jdbc`,children:O("customConnection_url_JDBC")}):(0,i.jsx)(K,{config:q,embedded:ae?.embedded,requiresServerName:ae?.requiresServerName,disabled:U,readOnly:Q,originLocal:ge})]}),(0,i.jsxs)(v.Y,{form:!0,gap:!0,children:[(0,i.jsxs)(m.m,{wrap:!0,gap:!0,children:[(0,i.jsx)(y.F,{type:"text",name:"name",minLength:1,state:q,disabled:U,readOnly:Q,required:!0,fill:!0,children:O("connections_connection_name")}),!q.template&&(0,i.jsx)(F.g,{value:e.projectId,readOnly:Q||pe,disabled:U,autoHide:!0,onChange:n=>e.setProject(n)}),!q.template&&(0,i.jsx)(y.F,{type:"text",name:"folder",state:q,disabled:U,autoComplete:`section-${q.driverId||"driver"} section-folder`,autoHide:!0,readOnly:!0,tiny:!0,fill:!0,children:O("customConnection_folder")})]}),(0,i.jsx)(I.T,{name:"description",rows:3,state:q,disabled:U,readOnly:Q,children:O("connections_connection_description")})]})]}),(0,i.jsxs)(m.m,{medium:!0,gap:!0,children:[!ae?.anonymousAccess&&(he.authorized||!pe)&&(0,i.jsxs)(v.Y,{form:!0,gap:!0,children:[(0,i.jsx)(w.U,{children:O("connections_connection_edit_authentication")}),n.resource.distributed&&t.isProjectShared(e)&&(0,i.jsx)(x.G,{id:q.connectionId+"isShared",name:"sharedCredentials",title:O("connections_connection_share_credentials_tooltip"),state:q,disabled:U||Q,keepSize:!0,children:O("connections_connection_share_credentials")}),(0,i.jsx)(z,{authModelCredentialsState:q,applicableAuthModels:de,readonlyAuthModelId:!ge,readonly:Q,disabled:U,onAuthModelChange:async function handleAuthModelSelect(e){if(!e)return;const n=await le.resource.load(e);n&&Y.setAuthModel(n)}}),Se?(0,i.jsxs)(C.J,{children:[O("plugin_connections_connection_form_shared_credentials_manage_info"),(0,i.jsx)(j.N,{inline:!0,onClick:function openCredentialsTab(e){e.preventDefault(),Z?.open("shared_credentials")},children:O("plugin_connections_connection_form_shared_credentials_manage_info_tab_link")})]}):(0,i.jsx)(i.Fragment,{children:ve&&(0,i.jsx)(E,{credentials:q.credentials,properties:ve,readonly:Q,disabled:U})}),!Se&&ue&&re&&!q.template&&(0,i.jsx)(x.G,{id:q.connectionId+"authNeeded",name:"saveCredentials",state:q,disabled:U||Q||q.sharedCredentials,mod:["primary"],keepSize:!0,children:O("connections_connection_edit_save_credentials")})]}),ae?.providerProperties&&(0,i.jsx)(J,{config:q,properties:ae.providerProperties,disabled:U,readonly:Q})]})]})})}))},33682:(e,n,t)=>{t.d(n,{G:()=>getConnectionName});const i=20;function getConnectionName(e,n,t,o){let r=e;return n&&(r+="@"+n.slice(0,i),t&&t!==o&&(r+=":"+t)),r}},80735:(e,n,t)=>{t.d(n,{ConnectionFormAuthenticationAction:()=>p});var i=t(41773),o=t(7838),r=t(68164),s=t(17675),a=t(84383),c=t(34685),d=t(89232),l=t(74749),u=t(41684),h=t(58855);const f=(0,o.PA)((function ConnectionFormAuthenticationAction({state:e}){const n=(0,s.W)(),t=(0,a.q)(ConnectionFormAuthenticationAction,l.DBDriverResource,e.config.driverId||null).data,{data:o}=(0,a.q)(ConnectionFormAuthenticationAction,u.DatabaseAuthModelsResource,(0,c.u)((()=>e.config.authModelId||e.info?.authModel||t?.defaultAuthModel||null))),f=(0,h.s)({providerId:o?.requiredAuth??e.info?.requiredAuth??r.T,onAuthenticate:()=>e.loadConnectionInfo()});return f.authorized?null:(0,i.jsx)(d.$,{type:"button",disabled:e.disabled,mod:["outlined"],onClick:f.auth,children:n("authentication_authenticate")})})),p=(0,o.PA)((function ConnectionFormAuthenticationAction({state:e}){const n=(0,a.q)(ConnectionFormAuthenticationAction,l.DBDriverResource,e.config.driverId||null).data,{data:t}=(0,a.q)(ConnectionFormAuthenticationAction,u.DatabaseAuthModelsResource,(0,c.u)((()=>e.config.authModelId||e.info?.authModel||n?.defaultAuthModel||null)));return t?.requiredAuth||e.info?.requiredAuth?(0,i.jsx)(f,{state:e}):null}))},23407:(e,n,t)=>{t.r(n),t.d(n,{ConnectionFormAuthenticationAction:()=>l,ConnectionOriginInfoTabService:()=>f,OriginInfo:()=>u,OriginInfoTab:()=>h});var i=t(1118),o=t(15993),r=t(46880),s=t(82103),a=t(5576),c=t(90783),d=t(22799);const l=o.lazy((async()=>{const{ConnectionFormAuthenticationAction:e}=await Promise.all([t.e(11502),t.e(7542),t.e(97493),t.e(67557),t.e(89814),t.e(11450),t.e(62570),t.e(77222)]).then(t.bind(t,80735));return{default:e}})),u=o.lazy((async()=>{const{OriginInfo:e}=await Promise.all([t.e(11502),t.e(7542),t.e(97493),t.e(67557),t.e(70639),t.e(89814),t.e(11450),t.e(62570),t.e(95860),t.e(31031)]).then(t.bind(t,51479));return{default:e}})),h=o.lazy((async()=>{const{OriginInfoTab:e}=await Promise.all([t.e(97493),t.e(67557),t.e(11450),t.e(53412)]).then(t.bind(t,32346));return{default:e}}));let f=class ConnectionOriginInfoTabService extends s.j{constructor(e){super(),this.connectionFormService=e}register(){this.connectionFormService.tabsContainer.add({key:"origin",order:3,tab:()=>h,panel:()=>u,stateGetter:()=>()=>({}),isHidden:(e,n)=>!n?.state.info||(0,r.C)(n.state.info)}),this.connectionFormService.configureTask.addHandler(this.configure.bind(this)),this.connectionFormService.actionsContainer.add(l,0)}load(){}configure(e,n){n.getContext(c.i).include("includeOrigin")}};f=(0,i.Cg)([(0,a._)(),(0,i.Sn)("design:paramtypes",[d.ConnectionFormService])],f)},51479:(e,n,t)=>{t.d(n,{OriginInfo:()=>x});var i=t(41773),o=t(94866),r=t(7838),s=t(11130),a=t(68164),c=t(6332),d=t(17675),l=t(84383),u=t(64928),h=t(71120),f=t(7167),p=t(69519),g=t(99152),m=t(14249),v=t(16101),S=t(13359),C=t(74749),_=t(41684),b=t(49690),y=t(26909),I=t(60300);const w={loader:"loader___cWY9a",coloredContainer:"coloredContainer___uQT9R"},x=(0,r.PA)((function OriginInfo({tabId:e,state:{info:n,resource:t,config:r}}){const x=(0,y.V)(e),j=(0,d.W)(),P=(0,l.q)(OriginInfo,s.UserInfoResource,void 0),k=(0,I.i)(),T=(0,u.d)(w),H=(0,l.q)(OriginInfo,C.DBDriverResource,r.driverId??null),A=(0,l.q)(OriginInfo,_.DatabaseAuthModelsResource,r.authModelId??n?.authModel??H.data?.defaultAuthModel??null),N=A.data?.requiredAuth??n?.requiredAuth??a.T,D=P.resource.hasToken(N),R=(0,l.q)(OriginInfo,c.AuthProvidersResource,N),F=(0,l.q)(OriginInfo,t,{key:x.selected&&n?(0,b.createConnectionParam)(n.projectId,n.id):null,includes:["includeOrigin","customIncludeOriginDetails"]},{active:D,onData:e=>{(0,o.h5)((()=>{if(e.origin.details){for(const e of Object.keys(k))delete k[e];for(const n of e.origin.details)k[n.id]=n.value}}))}});return F.isLoading()?(0,i.jsx)(h.U,{className:(0,f.s)(T,{coloredContainer:!0}),children:(0,i.jsx)(p.a,{className:(0,f.s)(T,{loader:!0})},"static")}):F.exception?(0,i.jsx)(h.U,{className:(0,f.s)(T,{coloredContainer:!0}),children:(0,i.jsx)(g.Z,{exception:F.exception,onRetry:F.reload})}):D?F.data?.origin.details&&0!==F.data.origin.details.length?(0,i.jsxs)(h.U,{className:(0,f.s)(T,{coloredContainer:!0}),parent:!0,children:[(0,i.jsx)(v.Y,{large:!0,gap:!0,children:(0,i.jsx)(S.d,{properties:F.data.origin.details,state:k,readOnly:!0,small:!0,autoHide:!0})}),(0,i.jsx)(p.a,{className:(0,f.s)(T,{loader:!0}),loading:F.isLoading(),overlay:!0},"overlay")]}):(0,i.jsx)(h.U,{className:(0,f.s)(T,{coloredContainer:!0}),parent:!0,children:(0,i.jsx)(m.x,{children:j("connections_administration_connection_no_information")})}):(0,i.jsx)(h.U,{className:(0,f.s)(T,{coloredContainer:!0}),parent:!0,children:(0,i.jsx)(m.x,{children:j("connections_public_connection_cloud_auth_required",void 0,{providerLabel:R.data?.label})})})}))},32346:(e,n,t)=>{t.d(n,{OriginInfoTab:()=>c});var i=t(41773),o=t(7838),r=t(70500),s=t(43659),a=t(19259);const c=(0,o.PA)((function OriginInfoTab({state:{info:e},...n}){return(0,i.jsx)(s.o,{...n,children:(0,i.jsx)(a.I,{children:(0,i.jsx)(r.H,{token:e?.origin?.displayName||"Origin"})})})}))},62989:(e,n,t)=>{t.r(n),t.d(n,{ConnectionSSHTabService:()=>S,SSHPanel:()=>v,SSHTab:()=>m});var i=t(1118),o=t(94866),r=t(15993),s=t(64043),a=t(74749),c=t(82103),d=t(5576),l=t(43974),u=t(48619),h=t(90783),f=t(22799),p=t(50400),g=t(14371);const m=r.lazy((async()=>{const{SSHTab:e}=await Promise.all([t.e(97493),t.e(67557),t.e(11450),t.e(21984)]).then(t.bind(t,57584));return{default:e}})),v=r.lazy((async()=>{const{SSHPanel:e}=await Promise.all([t.e(11502),t.e(7542),t.e(67557),t.e(11450),t.e(62570),t.e(54841)]).then(t.bind(t,83011));return{default:e}}));let S=class ConnectionSSHTabService extends c.j{constructor(e,n){super(),this.connectionFormService=e,this.dbDriverResource=n,(0,o.Gn)(this,{fillConfig:o.XI,prepareConfig:o.XI})}register(){this.connectionFormService.tabsContainer.add({key:"ssh",name:"customConnection_main",order:3,tab:()=>m,panel:()=>v,isHidden:(e,n)=>{if(n?.state.config.driverId){const e=this.dbDriverResource.get(n.state.config.driverId);return n.state.config.configurationType===l.dB5.Url||!e?.applicableNetworkHandlers.includes(s.SSH_TUNNEL_ID)}return!0}}),this.connectionFormService.prepareConfigTask.addHandler(this.prepareConfig.bind(this)),this.connectionFormService.formValidationTask.addHandler(this.validate.bind(this)),this.connectionFormService.formStateTask.addHandler(this.formState.bind(this)),this.connectionFormService.configureTask.addHandler(this.configure.bind(this)),this.connectionFormService.fillConfigTask.addHandler(this.fillConfig.bind(this))}load(){}fillConfig({state:e,updated:n},t){if(!n)return;const i=e.info?.networkHandlersConfig?.find((e=>e.id===s.SSH_TUNNEL_ID));e.config.networkHandlersConfig||(e.config.networkHandlersConfig=[]),e.config.networkHandlersConfig.some((e=>e.id===s.SSH_TUNNEL_ID))||e.config.networkHandlersConfig.push({id:s.SSH_TUNNEL_ID,enabled:!1,authType:l.f$w.Password,password:"",savePassword:!1,userName:"",key:"",...i,properties:{port:22,host:"",aliveInterval:"0",sshConnectTimeout:"10000",...i?.properties}})}configure(e,n){n.getContext(h.i).include("includeNetworkHandlersConfig")}validate({state:{config:e,info:n}},t){const i=t.getContext(this.connectionFormService.connectionValidationContext);if(!e.networkHandlersConfig)return;const o=e.networkHandlersConfig.find((e=>e.id===s.SSH_TUNNEL_ID));if(o&&o.enabled){const e=n?.networkHandlersConfig?.find((e=>e.id===o.id));if(this.isChanged(o,e)){o.savePassword&&!o.userName?.length&&i.error("Field SSH 'User' can't be empty"),o.properties?.host?.length||i.error("Field SSH 'Host' can't be empty");const e=Number(o.properties?.port);(Number.isNaN(e)||e<1)&&i.error("Field SSH 'Port' can't be empty")}const t=o.authType===l.f$w.PublicKey,r=""===e?.key;t&&o.savePassword&&!r&&!o.key?.length&&i.error("Field SSH 'Private key' can't be empty");const s=""===e?.password&&e.authType===o.authType;t||!o.savePassword||s||o.password?.length||i.error("Field SSH 'Password' can't be empty")}}prepareConfig({state:e},n){const t=n.getContext(p.I),i=n.getContext(g.t);if(e.config.configurationType===l.dB5.Url||!e.config.networkHandlersConfig||0===e.config.networkHandlersConfig.length)return;let o;const r=e.config.networkHandlersConfig.find((e=>e.id===s.SSH_TUNNEL_ID));if(!r)return;const a=e.info?.networkHandlersConfig?.find((e=>e.id===r.id)),c=this.isPasswordChanged(r,a),d=this.isKeyChanged(r,a);(this.isChanged(r,a)||c||d)&&(o={...r,savePassword:r.savePassword||t.sharedCredentials,key:r.authType===l.f$w.PublicKey&&d?r.key:void 0,password:c?r.password:void 0},delete o.secureProperties),r.enabled&&!r.savePassword&&i.requireNetworkHandler(r.id),o&&(t.networkHandlersConfig||(t.networkHandlersConfig=[]),o=this.getTrimmedSSHConfig(o),t.networkHandlersConfig.push(o))}getTrimmedSSHConfig(e){const n=(0,o.HO)(e),t=Object.keys(e);for(const e of t)"string"==typeof n[e]&&(n[e]=n[e]?.trim());for(const e in n.properties)"string"==typeof n.properties[e]&&(n.properties[e]=n.properties[e]?.trim());return n}formState(e,n){if(void 0!==n.getContext(p.I).networkHandlersConfig){n.getContext(u.D).markEdited()}}isChanged(e,n){if(!n&&!e.enabled)return!1;const t=Number(n?.properties?.port),i=Number(e.properties?.port);return e.enabled!==n?.enabled||e.authType!==n?.authType||e.savePassword!==n?.savePassword||e.userName!==n?.userName||e.properties?.host!==n?.properties?.host||t!==i||e.properties?.aliveInterval!==n?.properties?.aliveInterval||e.properties?.sshConnectTimeout!==n?.properties?.sshConnectTimeout}isPasswordChanged(e,n){return!(!n&&!e.enabled)&&((null===n?.password&&null!==e.password||""===n?.password)&&""!==e.password||!!e.password?.length)}isKeyChanged(e,n){return!(!n&&!e.enabled)&&((null===n?.key&&null!==e.key||""===n?.key)&&""!==e.key||!!e.key?.length)}};S=(0,i.Cg)([(0,d._)(),(0,i.Sn)("design:paramtypes",[f.ConnectionFormService,a.DBDriverResource])],S)},94538:(e,n,t)=>{t.d(n,{g:()=>u});var i=t(41773),o=t(7838),r=t(17675),s=t(76228),a=t(84836),c=t(13157),d=t(89232),l=t(31793);const u=(0,o.PA)((function SSHKeyUploader({state:e,saved:n,disabled:t,readonly:o}){const u=(0,r.W)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(s.T,{name:"key",state:e,disabled:t,readOnly:o,description:n?u("ui_processing_saved"):void 0,required:e.savePassword&&!n,medium:!0,children:u("connections_network_handler_ssh_tunnel_private_key")}),(0,i.jsx)(a.N,{children:(0,i.jsx)(c.L,{disabled:t||o,reset:!0,onChange:async function handleKeyUpload(n){const t=n.target.files?.[0];if(!t)throw new Error("File is not found");const i=(0,l.N)(t),o=await i.promise;o&&(e.key=o)},children:(0,i.jsx)(d.$,{tag:"div",disabled:t||o,mod:["outlined"],children:u("ui_file")})})})]})}))},83011:(e,n,t)=>{t.d(n,{SSHPanel:()=>T});var i=t(41773),o=t(7838),r=t(64043),s=t(15993),a=t(56138),c=t(84383),d=t(64928),l=t(17675),u=t(84972),h=t(7167),f=t(71120),p=t(16101),g=t(90760),m=t(86795),v=t(76652),S=t(39865),C=t(15380),_=t(68318),b=t(84836),y=t(89232),I=t(43974),w=t(61077);const x=[{key:I.f$w.Password,label:"Password"},{key:I.f$w.PublicKey,label:"Public Key"}],j={form:"form___ucTut"};var P=t(94538);const k=(0,o.PA)((function SSH({state:e,handlerState:n}){const{info:t,readonly:o,disabled:k}=e,[T,H]=(0,s.useState)(!1),{credentialsSavingEnabled:A}=(0,a.J)(),N=t?.networkHandlersConfig?.find((e=>e.id===r.SSH_TUNNEL_ID)),D=(0,c.q)(SSH,r.NetworkHandlerResource,r.SSH_TUNNEL_ID,{onData:e=>{if(0===Object.keys(n).length)for(const t of e.properties)t.features.includes("password")||(n.properties[t.id]=t.value)}}),R=(0,d.d)(j),F=(0,l.W)(),M=k||T,O=n.enabled||!1,E=n.authType===I.f$w.PublicKey,L=null===N?.password&&""!==n.password||!!n.password?.length,q=E?!!n.key?.length:L,V=E?"Passphrase":F("connections_network_handler_ssh_tunnel_password"),B=""===N?.password&&N.authType===n.authType,U=""===N?.key,z=F("connections_network_handler_ssh_tunnel_advanced_settings_alive_interval"),$=F("connections_network_handler_ssh_tunnel_advanced_settings_connect_timeout"),W=(0,s.useCallback)((()=>{n.password=""}),[]);return(0,i.jsx)(u.l,{className:(0,h.s)(R,{form:!0}),children:(0,i.jsx)(f.U,{parent:!0,children:(0,i.jsxs)(p.Y,{form:!0,gap:!0,keepSize:!0,large:!0,children:[(0,i.jsx)(g.d,{id:"ssh-enable-switch",name:"enabled",state:n,mod:["primary"],disabled:M||o,children:F("connections_network_handler_ssh_tunnel_enable")}),(0,i.jsx)(m.G,{name:"authType",state:n,items:x,keySelector:e=>e.key,valueSelector:e=>e.label,disabled:M||o||!O,tiny:!0,onSelect:W,children:F("connections_network_handler_ssh_tunnel_auth_type")}),(0,i.jsxs)(v.m,{wrap:!0,gap:!0,children:[(0,i.jsx)(S.F,{type:"text",name:"host",state:n.properties,disabled:M||!O,readOnly:o,required:!0,small:!0,children:F("connections_network_handler_ssh_tunnel_host")}),(0,i.jsx)(S.F,{type:"number",name:"port",state:n.properties,disabled:M||!O,readOnly:o,required:!0,tiny:!0,children:F("connections_network_handler_ssh_tunnel_port")})]}),(0,i.jsxs)(v.m,{wrap:!0,gap:!0,children:[(0,i.jsx)(S.F,{type:"text",name:"userName",state:n,disabled:M||!O,readOnly:o,required:n.savePassword,tiny:!0,fill:!0,children:F("connections_network_handler_ssh_tunnel_user")}),(0,i.jsx)(S.F,{type:"password",name:"password",autoComplete:w.n?"section-connection-ssh-authentication section-ssh password":"new-password",state:n,disabled:M||!O,readOnly:o,required:!B&&!E&&n.savePassword,description:B?F("ui_processing_saved"):void 0,tiny:!0,fill:!0,children:V}),E&&(0,i.jsx)(P.g,{state:n,saved:U,disabled:M||!O,readonly:o})]}),A&&!e.config.template&&!e.config.sharedCredentials&&(0,i.jsx)(C.G,{id:r.SSH_TUNNEL_ID+"_savePassword",name:"savePassword",state:n,disabled:M||!O||o,children:F("connections_connection_edit_save_credentials")}),(0,i.jsx)(v.m,{gap:!0,children:(0,i.jsx)(_.V,{label:F("connections_network_handler_ssh_tunnel_advanced_settings"),children:(0,i.jsxs)(v.m,{gap:!0,children:[(0,i.jsx)(S.F,{type:"number",name:"aliveInterval",state:n.properties,disabled:M||!O,readOnly:o,labelTooltip:z,tiny:!0,children:z}),(0,i.jsx)(S.F,{type:"number",name:"sshConnectTimeout",state:n.properties,disabled:M||!O,readOnly:o,labelTooltip:$,tiny:!0,children:$})]})})}),(0,i.jsx)(b.N,{children:(0,i.jsx)(y.$,{type:"button",mod:["unelevated"],disabled:M||!O||!q,loader:!0,onClick:async()=>{H(!0),await D.resource.test(n),H(!1)},children:F("connections_network_handler_test")})})]})})})})),T=(0,o.PA)((function SSHPanel(e){const n=e.state.config.networkHandlersConfig?.find((e=>e.id===r.SSH_TUNNEL_ID));return n?(0,i.jsx)(k,{...e,handlerState:n}):null}))},57584:(e,n,t)=>{t.d(n,{SSHTab:()=>l});var i=t(41773),o=t(7838),r=t(84383),s=t(70500),a=t(64043),c=t(43659),d=t(19259);const l=(0,o.PA)((function SSHTab(e){const n=(0,r.q)(SSHTab,a.NetworkHandlerResource,a.SSH_TUNNEL_ID);return(0,i.jsx)(c.o,{...e,title:n.data?.description,children:(0,i.jsx)(d.I,{children:(0,i.jsx)(s.H,{token:n.data?.label||"connections_network_handler_ssh_tunnel_title"})})})}))},6741:(e,n,t)=>{t.r(n),t.d(n,{ConnectionSSLTabService:()=>w,SSLPanel:()=>I,SSLTab:()=>y});var i=t(1118),o=t(94866),r=t(15993),s=t(74749),a=t(64043),c=t(82103),d=t(5576),l=t(40813),u=t(48619),h=t(9724),f=t(17057),p=t(90783),g=t(22799),m=t(50400),v=t(14371),S=t(87940),C=t(95817),_=t(85421),b=t(92929);const y=r.lazy((async()=>{const{SSLTab:e}=await Promise.all([t.e(97493),t.e(67557),t.e(11450),t.e(97270)]).then(t.bind(t,73976));return{default:e}})),I=r.lazy((async()=>{const{SSLPanel:e}=await Promise.all([t.e(11502),t.e(7542),t.e(67557),t.e(11450),t.e(74889)]).then(t.bind(t,96582));return{default:e}}));let w=class ConnectionSSLTabService extends c.j{constructor(e,n,t){super(),this.connectionFormService=e,this.dbDriverResource=n,this.networkHandlerResource=t,(0,o.Gn)(this,{fillConfig:o.XI,prepareConfig:o.XI})}register(){this.connectionFormService.tabsContainer.add({key:"ssl",order:4,tab:()=>y,panel:()=>I,isHidden:(e,n)=>{if(n?.state.config.driverId){const e=this.dbDriverResource.get(n.state.config.driverId);return!(0,C.T)(this.networkHandlerResource.values,e?.applicableNetworkHandlers??[])}return!0}}),this.connectionFormService.prepareConfigTask.addHandler(this.prepareConfig.bind(this)),this.connectionFormService.formStateTask.addHandler(this.formState.bind(this)),this.connectionFormService.configureTask.addHandler(this.configure.bind(this)),this.connectionFormService.fillConfigTask.addHandler(this.fillConfig.bind(this))}load(){}async fillConfig({state:e,updated:n},t){if(!n||!e.config.driverId)return;const i=await this.dbDriverResource.load(e.config.driverId),r=await this.networkHandlerResource.load(l.fZ),s=(0,C.T)(r,i?.applicableNetworkHandlers??[]);if(!s)return;const a=e.info?.networkHandlersConfig?.find((e=>e.id===s.id));if(e.config.networkHandlersConfig||(e.config.networkHandlersConfig=[]),!e.config.networkHandlersConfig.some((e=>e.id===s.id))){const n=a?(0,o.HO)(a):(0,S.Q)(s.id);n.secureProperties&&(n.properties={...n.properties,...n.secureProperties}),e.config.networkHandlersConfig.push(n)}}configure(e,n){n.getContext(p.i).include("includeNetworkHandlersConfig")}async prepareConfig({state:e,submitType:n},t){const i=t.getContext(m.I),r=t.getContext(v.t);if(!e.config.networkHandlersConfig||0===e.config.networkHandlersConfig.length||!e.config.driverId)return;const s=await this.dbDriverResource.load(e.config.driverId),a=await this.networkHandlerResource.load(l.fZ),c=e.config.networkHandlersConfig.find((e=>s?.applicableNetworkHandlers.includes(e.id)&&a.some((n=>n.id===e.id&&n.codeName===b.V)))),d=a.find((e=>e.id===c?.id));if(!c)return;const u=e.info?.networkHandlersConfig?.find((e=>e.id===c.id)),f=(0,o.HO)(c);f.savePassword=c.savePassword||i.sharedCredentials;const p=this.isChanged(f,u);if(p&&d){for(const e of d.properties){if(!e.id)continue;const n=e.id,t=(0,h.K)(e.defaultValue);!(n in f.properties)&&t&&(f.properties[n]=e.defaultValue);if(e.features.includes(_.$)){const e=f.properties[n];u?.secureProperties?.[n]!==e?f.secureProperties[n]=(0,o.HO)(e):delete f.secureProperties[n],delete f.properties[n]}}"submit"===n&&(0===Object.keys(f.secureProperties).length&&delete f.secureProperties,0===Object.keys(f.properties).length&&delete f.properties)}c.enabled&&!c.savePassword&&r.requireNetworkHandler(c.id),p&&(i.networkHandlersConfig||(i.networkHandlersConfig=[]),this.trimSSLConfig(f),i.networkHandlersConfig.push(f))}trimSSLConfig(e){const{secureProperties:n}=e;if(n&&Object.keys(n).length)for(const e in n)"string"==typeof n[e]&&(n[e]=n[e]?.trim())}formState(e,n){if(void 0!==n.getContext(m.I).networkHandlersConfig){n.getContext(u.D).markEdited()}}isChanged(e,n){if(!n&&!e.enabled)return!1;const t={...n?.properties??{},...n?.secureProperties??{}};return e.enabled!==n?.enabled||e.savePassword!==n?.savePassword||!(0,f.X)(e.properties,t)}};w=(0,i.Cg)([(0,d._)(),(0,i.Sn)("design:paramtypes",[g.ConnectionFormService,s.DBDriverResource,a.NetworkHandlerResource])],w)},85421:(e,n,t)=>{t.d(n,{$:()=>i});const i="secured"},96582:(e,n,t)=>{t.d(n,{SSLPanel:()=>k});var i=t(41773),o=t(7838),r=t(84383),s=t(64043),a=t(74749),c=t(40813),d=t(87940),l=t(95817),u=t(15993),h=t(17675),f=t(64928),p=t(56138),g=t(91176),m=t(84972),v=t(7167),S=t(71120),C=t(16101),_=t(90760),b=t(13359),y=t(13821),I=t(15380),w=t(61077);const x="********",j={form:"form___vo_ks"},P=(0,o.PA)((function SSL({state:e,handler:n,handlerState:t}){const{info:o,readonly:r,disabled:s,loading:a}=e,c=(0,h.W)(),d=(0,f.d)(j),{credentialsSavingEnabled:l}=(0,p.J)(),{categories:P,isUncategorizedExists:k}=(0,g.y)(n.properties),T=s||a,H=t.enabled||!1,A=o?.networkHandlersConfig?.find((e=>e.id===n.id)),N=w.n?"section-connection-authentication-ssl section-ssl":"new-password";return(0,i.jsx)(m.l,{className:(0,v.s)(d,{form:!0}),children:(0,i.jsx)(S.U,{parent:!0,children:(0,i.jsxs)(C.Y,{gap:!0,form:!0,large:!0,vertical:!0,children:[(0,i.jsx)(_.d,{id:"ssl-enable-switch",name:"enabled",state:t,description:n.description,mod:["primary"],disabled:T||r,children:c("connections_public_connection_ssl_enable")}),k&&(0,i.jsx)(b.d,{state:t.properties,properties:n.properties,category:null,disabled:T||r||!H,isSaved:e=>!!e.id&&A?.secureProperties[e.id]===x,autofillToken:N,hideEmptyPlaceholder:!0,showRememberTip:!0,small:!0}),P.map((e=>(0,i.jsxs)(u.Fragment,{children:[(0,i.jsx)(y.U,{keepSize:!0,children:e}),(0,i.jsx)(b.d,{state:t.properties,properties:n.properties,category:e,disabled:T||r||!H,isSaved:e=>!!e.id&&A?.secureProperties[e.id]===x,autofillToken:N,hideEmptyPlaceholder:!0,showRememberTip:!0,small:!0})]},e))),l&&!e.config.template&&!e.config.sharedCredentials&&(0,i.jsx)(I.G,{id:n.id+"_savePassword",name:"savePassword",state:t,disabled:T||!H||r||e.config.sharedCredentials,children:c("connections_connection_edit_save_credentials")})]})})})})),k=(0,o.PA)((function SSLPanel(e){const n=(0,r.q)(SSLPanel,s.NetworkHandlerResource,c.fZ),t=(0,r.q)(SSLPanel,a.DBDriverResource,e.state.config.driverId??null),o=(0,l.T)(n.resource.values,t.data?.applicableNetworkHandlers??[]);e.state.configured&&o&&!e.state.config.networkHandlersConfig?.some((e=>e.id===o?.id))&&e.state.config.networkHandlersConfig?.push((0,d.Q)(o.id));const u=e.state.config.networkHandlersConfig?.find((e=>e.id===o?.id));return o&&u?(0,i.jsx)(P,{...e,handler:o,handlerState:u}):null}))},73976:(e,n,t)=>{t.d(n,{SSLTab:()=>f});var i=t(41773),o=t(7838),r=t(84383),s=t(70500),a=t(64043),c=t(74749),d=t(40813),l=t(43659),u=t(19259),h=t(95817);const f=(0,o.PA)((function SSLTab(e){const n=(0,r.q)(SSLTab,a.NetworkHandlerResource,d.fZ),t=(0,r.q)(SSLTab,c.DBDriverResource,e.state.config.driverId??null),o=(0,h.T)(n.resource.values,t.data?.applicableNetworkHandlers??[]);return o?(0,i.jsx)(l.o,{...e,title:o.description,children:(0,i.jsx)(u.I,{children:(0,i.jsx)(s.H,{token:o.label})})}):null}))},92929:(e,n,t)=>{t.d(n,{V:()=>i});const i="SSL"},87940:(e,n,t)=>{function getSSLDefaultConfig(e){return{id:e,enabled:!1,properties:{},secureProperties:{}}}t.d(n,{Q:()=>getSSLDefaultConfig})},95817:(e,n,t)=>{t.d(n,{T:()=>getSSLDriverHandler});var i=t(92929);function getSSLDriverHandler(e,n){return e.find((e=>n.includes(e.id)&&e.codeName===i.V))}},90783:(e,n,t)=>{function connectionFormConfigureContext(e,n){return{info:n.info,driverId:n.config.driverId,connectionIncludes:[],include(...e){for(const n of e)this.connectionIncludes.includes(n)||this.connectionIncludes.push(n)}}}t.d(n,{i:()=>connectionFormConfigureContext})},81800:(e,n,t)=>{t.d(n,{D:()=>useConnectionFormState});var i=t(15993),o=t(18699),r=t(62151),s=t(10392),a=t(22799),c=t(77583);function useConnectionFormState(e,n){const t=(0,o.h)(r.ProjectsService),d=(0,o.h)(s.ProjectInfoResource),l=(0,o.h)(a.ConnectionFormService),[u]=(0,i.useState)((()=>{const i=new c.C(t,d,l,e);return n?.(i),i.load(),i}));return(0,i.useEffect)((()=>()=>u.dispose()),[]),u}},81500:(e,n,t)=>{t.r(n),t.d(n,{ConnectionShield:()=>g});var i=t(41773),o=t(7838),r=t(15993),s=t(17675),a=t(84383),c=t(69519),d=t(14249),l=t(89232),u=t(34906),h=t(49690),f=t(18699),p=t(14452);const g=(0,o.PA)((function ConnectionShield({connectionKey:e,children:n}){const t=(0,s.W)(),o=(0,f.h)(u.ConnectionsManagerService),g=(0,f.h)(p.NotificationService),m=(0,a.q)(ConnectionShield,h.ConnectionInfoResource,e),[v,S]=(0,r.useState)(!1);return m.data&&!m.data.connected?v||m.isLoading()?(0,i.jsx)(c.a,{}):(0,i.jsx)(d.x,{children:(0,i.jsx)(l.$,{type:"button",mod:["unelevated"],onClick:async function handleConnect(){if(!v&&m.data&&e){S(!0);try{await o.requireConnection(e)}catch(e){g.logException(e)}finally{S(!1)}}},children:t("connections_connection_connect")})}):n}))},39926:(e,n,t)=>{t.d(n,{K:()=>i});const i=(0,t(50420).j)((()=>Promise.all([t.e(11450),t.e(46015)]).then(t.bind(t,81500)).then((e=>e.ConnectionShield))))},80657:(e,n,t)=>{t.r(n),t.d(n,{ConnectionMenuBootstrap:()=>M});var i=t(1118),o=t(91135),r=t(49690),s=t(34906),a=t(78686),c=t(82103),d=t(5576),l=t(14452),u=t(14841),h=t(3942),f=t(64809),p=t(40813),g=t(72755),m=t(50301),v=t(68061),S=t(40601),C=t(85153),_=t(43858),b=t(79023),y=t(72877),I=t(76635),w=t(75069),x=t(66291),j=t(19102);const P=(0,j.V)("connection-change-credentials",{label:"app_navigationTree_context_change_credentials"}),k=(0,j.V)("connection-disconnect",{label:"app_navigationTree_context_disconnect"}),T=(0,j.V)("connection-disconnect-all",{label:"plugin_connections_action_disconnect_all_label"}),H=(0,j.V)("connection-edit",{label:"connections_public_connection_edit_menu_item_title"}),A=(0,j.V)("connection-view-advanced",{label:"app_navigationTree_connection_view_option_advanced",type:"select"}),N=(0,j.V)("connection-view-simple",{label:"app_navigationTree_connection_view_option_simple",type:"select"}),D=(0,j.V)("connection-view-system-objects",{label:"app_navigationTree_connection_view_option_showSystemObjects",type:"checkbox"});const R=(0,t(85240).E)("connection-view","app_navigationTree_connection_view");var F=t(13429);let M=class ConnectionMenuBootstrap extends c.j{constructor(e,n,t,i,o,r,s,a,c,d,l){super(),this.notificationService=e,this.connectionInfoResource=n,this.navNodeManagerService=t,this.connectionsManagerService=i,this.actionService=o,this.menuService=r,this.publicConnectionFormService=s,this.connectionsSettingsService=a,this.pluginConnectionsSettingsService=c,this.permissionsService=d,this.serverConfigResource=l}register(){this.addConnectionsMenuToTopAppBar(),this.menuService.addCreator({root:!0,isApplicable:e=>{if(this.pluginConnectionsSettingsService.hideConnectionViewForUsers&&!this.permissionsService.has(g.y.admin))return!1;const n=e.get(o.A);if(!n?.connected)return!1;const t=e.get(u.G);return!(t&&!t.objectFeatures.includes(h.v.dataSource))&&e.has(o.A)},getItems:(e,n)=>[...n,R]}),this.menuService.addCreator({menus:[R],getItems:(e,n)=>[...n,N,A,new C.w,D]}),this.actionService.addHandler({id:"connection-view",actions:[N,A,D],contexts:[o.A],isChecked:(e,n)=>{const t=e.get(o.A);switch(n){case N:return(0,m.s)(t.navigatorSettings,m.P.simple);case A:return(0,m.s)(t.navigatorSettings,m.P.advanced);case D:return t.navigatorSettings.showSystemObjects}return!1},handler:async(e,n)=>{const t=e.get(o.A);switch(n){case N:await this.changeConnectionView(t,m.P.simple);break;case A:await this.changeConnectionView(t,m.P.advanced);break;case D:{const e=t.navigatorSettings;await this.changeConnectionView(t,{...e,showSystemObjects:!e.showSystemObjects});break}}}}),this.menuService.addCreator({root:!0,contexts:[o.A],getItems:(e,n)=>[...n,P,H,k,T]}),this.actionService.addHandler({id:"connection-management",contexts:[o.A],isActionApplicable:(e,n)=>{const t=e.get(o.A);if(!t)return!1;const i=e.get(u.G);return!(i&&!i.objectFeatures.includes(h.v.dataSource))&&(n===k?t.connected:n===T?this.connectionsManagerService.hasAnyConnection(!0):n===_.n?t.canDelete:n===H?t.canEdit||t.canViewSettings:n===P&&(this.serverConfigResource.distributed&&!t.sharedCredentials))},isHidden:(e,n)=>{const t=e.get(o.A);return n===P&&!t?.credentialsSaved},getLoader:(e,n)=>{const t=e.get(o.A);return n===P?(0,p.pd)(this.connectionInfoResource,(()=>(0,r.createConnectionParam)(t)),(()=>["includeCredentialsSaved"]),!0):[]},handler:async(e,n)=>{const t=e.get(o.A);switch(n){case k:await this.connectionsManagerService.closeConnectionAsync((0,r.createConnectionParam)(t));break;case T:await this.connectionsManagerService.closeAllConnections();break;case _.n:try{await this.connectionsManagerService.deleteConnection((0,r.createConnectionParam)(t))}catch(e){this.notificationService.logException(e,"Failed to delete connection")}break;case H:this.publicConnectionFormService.open(t.projectId,{connectionId:t.id});break;case P:await this.connectionsManagerService.requireConnection({connectionId:t.id,projectId:t.projectId},!0)}}})}async changeConnectionView(e,n){try{(e=await this.connectionInfoResource.changeConnectionView((0,r.createConnectionParam)(e),n)).nodePath&&await this.navNodeManagerService.refreshTree(e.nodePath)}catch(e){this.notificationService.logException(e)}}addConnectionsMenuToTopAppBar(){this.menuService.addCreator({menus:[I._],getItems:(e,n)=>[...n,F.y]}),this.menuService.setHandler({id:"connections-menu-base",menus:[F.y],isHidden:()=>0===this.connectionsManagerService.createConnectionProjects.length||this.connectionsSettingsService.disabled,isLabelVisible:()=>!1})}};M=(0,i.Cg)([(0,d._)(),(0,i.Sn)("design:paramtypes",[l.NotificationService,r.ConnectionInfoResource,f.NavNodeManagerService,s.ConnectionsManagerService,b.ActionService,y.MenuService,x.PublicConnectionFormService,a.ConnectionsSettingsService,w.PluginConnectionsSettingsService,v.PermissionsService,S.ServerConfigResource])],M)},13429:(e,n,t)=>{t.d(n,{y:()=>i});const i=(0,t(85240).E)("connections","plugin_connections_menu_connections_label","/icons/plugin_connections_menu_m.svg","plugin_connections_menu_connections_label")},77804:(e,n,t)=>{t.r(n),t.d(n,{DatabaseAuthDialog:()=>L});var i=t(41773),o=t(7838),r=t(84383),s=t(17675),a=t(51477),c=t(62204),d=t(49690),l=t(74749),u=t(64928),h=t(35025),f=t(56138),p=t(90447),g=t(15280),m=t(92659),v=t(84972),S=t(7167),C=t(69519),_=t(9428),b=t(20272),y=t(37549);const I={submittingForm:"submittingForm___o2dw7",connectionAuthenticationFormLoader:"connectionAuthenticationFormLoader___ZQNqp",errorMessage:"errorMessage___xB36X theme-background-secondary theme-text-on-secondary"};var w=t(89232);const x={footerContainer:"footerContainer___zD1Jx",button:"button___JAnXv"},j=(0,o.PA)((function DatabaseCredentialsAuthDialogFooter({isAuthenticating:e,onLogin:n,className:t,children:o}){const r=(0,u.d)(x),a=(0,s.W)();return(0,i.jsxs)("div",{className:(0,S.s)(r,{footerContainer:!0},t),children:[o,(0,i.jsx)(w.$,{className:(0,S.s)(r,{button:!0}),type:"button",mod:["unelevated"],disabled:e,loading:e,onClick:n,children:a("authentication_login")})]})}));var P=t(94866),k=t(28347),T=t(86990),H=t(18699),A=t(43974);const N=(0,o.PA)((function DatabaseCredentialsAuthDialog({connection:e,networkHandlers:n,resetCredentials:t,onLogin:o}){const r=(0,u.d)(I),a=(0,s.W)(),[c]=(0,h.i)({focusFirstChild:!0}),{credentialsSavingEnabled:w}=(0,f.J)(),x=function useDatabaseCredentialsAuthDialog(e,n,t,i){const o=(0,H.h)(d.ConnectionInfoResource),r=(0,H.h)(l.DBDriverResource);return(0,k.G)((()=>({get authModelId(){return(this.connection?.authNeeded||this.resetCredentials)&&(this.connection?.authModel||this.driver?.defaultAuthModel)||null},connection:null,driver:null,authenticating:!1,loading:!1,loaded:!1,exception:null,authException:null,config:{credentials:{},networkHandlersConfig:[],saveCredentials:!1},async load(){if(!this.loaded&&!this.loading)try{this.exception=null,this.loading=!0;const e=await this.connectionInfoResource.load(this.key,["includeAuthProperties","includeNetworkHandlersConfig","includeAuthNeeded"]),n=await this.dbDriverResource.load(e.driverId);if(e.authNeeded){const n=e.authProperties.find((e=>e.id===T.w));n?.value&&(this.config.credentials[T.w]=n.value)}for(const n of this.networkHandlers){const t=e.networkHandlersConfig.find((e=>e.id===n));t&&(t.userName||t.authType!==A.f$w.Password)&&this.config.networkHandlersConfig.push({id:t.id,authType:t.authType,userName:t.userName,password:t.password,savePassword:t.savePassword})}this.connection=e,this.driver=n,this.loaded=!0}catch(e){this.exception=e}finally{this.loading=!1}},async login(){if(!this.authenticating)try{this.authException=null,this.authenticating=!0,await this.connectionInfoResource.init(this.getConfig()),this.onInit?.()}catch(e){this.authException=e}finally{this.authenticating=!1}},getConfig(){const e={projectId:this.key.projectId,connectionId:this.key.connectionId};return this.authModelId&&(Object.keys(this.config.credentials).length>0&&(e.credentials=this.config.credentials),e.saveCredentials=this.config.saveCredentials),this.config.networkHandlersConfig.length>0&&(e.networkCredentials=this.config.networkHandlersConfig),e},isLoading(){return this.loading},isLoaded(){return this.loaded},isError(){return!!this.exception}})),{authModelId:P.EW,config:P.sH,connection:P.sH.ref,driver:P.sH.ref,authenticating:P.sH.ref,loading:P.sH.ref,loaded:P.sH.ref,exception:P.sH.ref,authException:P.sH.ref,load:P.XI.bound,login:P.XI.bound},{connectionInfoResource:o,dbDriverResource:r,key:e,networkHandlers:n,resetCredentials:t,onInit:i})}(e,n,t,o),N=(0,p.s)(x.authException);return(0,g.X)(DatabaseCredentialsAuthDialog,x),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m.a,{children:(0,i.jsx)(v.l,{ref:c,className:(0,S.s)(r,{submittingForm:!0}),onSubmit:x.login,children:(0,i.jsx)(C.a,{state:x,inlineException:!0,children:(0,i.jsx)(y.A,{config:x.config,authModelId:x.authModelId,authProperties:x.connection?.authProperties,networkHandlers:n,formId:`${e.projectId}:${e.connectionId}`,allowSaveCredentials:w,className:(0,S.s)(r,{connectionAuthenticationFormLoader:!0}),disabled:x.authenticating,hideFeatures:["nonSecuredProperty"]})})})}),(0,i.jsx)(_.Z,{children:(0,i.jsx)(j,{isAuthenticating:x.authenticating,onLogin:x.login,children:x.authException&&(0,i.jsx)(b.K,{text:N.message??a("core_blocks_exception_message_error_message"),hasDetails:N.hasDetails,className:I.errorMessage,onShowDetails:N.open})})})]})}));var D=t(23089),R=t(10041),F=t(60233),M=t(16101),O=t(99152);const E=(0,o.PA)((function DatabaseSecretAuthDialog({connectionKey:e,onLogin:n}){const t=(0,r.q)(DatabaseSecretAuthDialog,d.ConnectionInfoResource,{key:e,includes:["includeAuthNeeded","includeSharedSecrets","includeNetworkHandlersConfig","includeCredentialsSaved"]}),o=(0,k.G)((()=>({exception:null,authenticating:!1})),{exception:P.sH.ref,authenticating:P.sH.ref},!1),s=t.data?.sharedSecrets||[];return o.authenticating?(0,i.jsx)(C.a,{loader:!0}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m.a,{noBodyPadding:!0,children:(0,i.jsx)(D.k,{children:s.map((r=>(0,i.jsx)(R.c,{onClick:()=>async function handleSecretSelect(i){try{o.authenticating=!0,await t.resource.init({...e,selectedSecretId:i}),o.exception=null,n?.()}catch(e){o.exception=e}finally{o.authenticating=!1}}(r.secretId),children:(0,i.jsx)(F.z,{children:r.displayName})},r.secretId)))})}),o.exception&&(0,i.jsx)(_.Z,{children:(0,i.jsx)(M.Y,{secondary:!0,vertical:!0,dense:!0,children:(0,i.jsx)(O.Z,{exception:o.exception,inline:!0})})})]})})),L=(0,o.PA)((function DatabaseAuthDialog({payload:e,options:n,rejectDialog:t,resolveDialog:o}){const u=(0,r.q)(DatabaseAuthDialog,d.ConnectionInfoResource,{key:e.connection,includes:["includeAuthNeeded","includeSharedSecrets","includeNetworkHandlersConfig","includeCredentialsSaved"]}),h=(0,s.W)(),f=(0,r.q)(DatabaseAuthDialog,l.DBDriverResource,u.data?.driverId||null),p=(u.data?.sharedSecrets?.length||0)>1;let g=u.data?.name;return p&&(g=[g,h("plugin_connections_connection_auth_secret_description")].join(" | ")),(0,i.jsxs)(a.n,{size:"large",fixedSize:p,children:[(0,i.jsx)(c.D,{title:"connections_database_authentication",subTitle:g,icon:f.data?.icon,onReject:n?.persistent?void 0:t}),p?(0,i.jsx)(E,{connectionKey:e.connection,onLogin:o}):(0,i.jsx)(N,{connection:e.connection,networkHandlers:e.networkHandlers,resetCredentials:e.resetCredentials,onLogin:o})]})}))},78112:(e,n,t)=>{t.r(n),t.d(n,{LocaleService:()=>a});var i=t(1118),o=t(82103),r=t(5576),s=t(34227);let a=class LocaleService extends o.j{constructor(e){super(),this.localizationService=e}register(){this.localizationService.addProvider(this.provider.bind(this))}load(){}async provider(e){switch(e){case"ru":return(await Promise.all([t.e(92436),t.e(66770)]).then(t.bind(t,31860))).default;case"it":return(await Promise.all([t.e(32756),t.e(44389)]).then(t.bind(t,81412))).default;case"zh":return(await Promise.all([t.e(52041),t.e(99627)]).then(t.bind(t,20911))).default;case"fr":return(await Promise.all([t.e(29671),t.e(10079)]).then(t.bind(t,11637))).default;default:return(await Promise.all([t.e(41114),t.e(32460)]).then(t.bind(t,68410))).default}}};a=(0,i.Cg)([(0,r._)(),(0,i.Sn)("design:paramtypes",[s.LocalizationService])],a)},29697:(e,n,t)=>{t.r(n),t.d(n,{ConnectionFoldersBootstrap:()=>V});var i=t(1118),o=t(94866),r=t(11130),s=t(3118),a=t(49690),c=t(78683),d=t(49845),l=t(98940),u=t(60410),h=t(34906),f=t(82103),p=t(5576),g=t(71635),m=t(14452),v=t(86764),S=t(34227),C=t(33620),_=t(30819),b=t(81244),y=t(49311),I=t(35350),w=t(64809),x=t(6587),j=t(3702),P=t(97007),k=t(3838),T=t(10392),H=t(40813),A=t(85213),N=t(7278),D=t(45934),R=t(30342),F=t(79023),M=t(72877),O=t(65427),E=t(48477),L=t(93732);const q="Connection";let V=class ConnectionFoldersBootstrap extends f.j{constructor(e,n,t,i,o,r,s,a,c,d,l,u,h,f){super(),this.localizationService=e,this.userInfoResource=n,this.navTreeResource=t,this.actionService=i,this.menuService=o,this.connectionInfoResource=r,this.navNodeManagerService=s,this.connectionFolderResource=a,this.connectionsManagerService=c,this.commonDialogService=d,this.notificationService=l,this.navNodeInfoResource=u,this.projectInfoResource=h,this.projectsNavNodeService=f}register(){this.navNodeInfoResource.onItemUpdate.addHandler(this.syncWithNavTree.bind(this)),this.navNodeInfoResource.onItemDelete.addHandler(this.syncWithNavTree.bind(this)),this.navNodeManagerService.onMove.addHandler(this.moveConnectionToFolder.bind(this)),this.navTreeResource.beforeNodeDelete.addHandler((async(e,n)=>{if(v.a.isInterrupted(n))return;const t=n.getContext(C.v);if(t.confirmed)return;await this.connectionFolderResource.load(H.fZ);const i=A.F.filter(e,(e=>void 0!==this.connectionFolderResource.fromNodeId(e))).map((e=>this.navNodeInfoResource.get(e))).filter(Boolean).map((e=>e.name)).join();if(!i)return;await this.commonDialogService.open(s.n,{title:"ui_data_delete_confirmation",message:this.localizationService.translate("connections_public_connection_folder_delete_confirmation",void 0,{name:i}),confirmActionText:"ui_delete"})===g.DialogueStateResult.Rejected?v.a.interrupt(n):t.confirm()})),this.actionService.addHandler({id:"tree-tools-menu-folders-handler",contexts:[O.S],isActionApplicable:(e,n)=>{const t=e.get(O.S);if(n!==R.p||!this.userInfoResource.data||t.baseRoot!==_.ROOT_NODE_PATH)return!1;return void 0!==this.getTargetNode(t)},handler:this.elementsTreeActionHandler.bind(this)}),this.menuService.addCreator({menus:[E.b],getItems:(e,n)=>n.includes(R.p)?n:[...n,R.p]})}async moveConnectionToFolder({type:e,targetNode:n,moveContexts:t},i){if(![P.O,b.Z].includes(n.nodeType))return;await this.projectInfoResource.load(H.fZ);const o=i.getContext(y.E),r=(0,I.x)(t),s=r.map((e=>e.id)),c=this.navTreeResource.get(n.id)??[],d=this.projectsNavNodeService.getProject(n.id);if(r.every((e=>!(![q,b.Z,P.O].includes(e.nodeType)||d!==this.projectsNavNodeService.getProject(e.id)||c.includes(e.id)||n.id===e.id))))if(e===w.ENodeMoveType.CanDrop)d?.canEditDataSources&&o.setCanMove(!0);else{const e=this.navNodeInfoResource.get((0,N.OU)(c)),t=r.filter((n=>n.nodeType===b.Z&&(e.some((e=>e?.nodeType===b.Z&&e.name===n.name))||r.some((e=>e.nodeType===b.Z&&e.name===n.name&&e.id!==n.id)))));if(t.length>0)return void this.notificationService.logError({title:"connections_public_connection_folder_move_failed",message:this.localizationService.translate("connections_public_connection_folder_move_duplication",void 0,{name:t.map((e=>`"${e.name}"`)).join(", ")})});try{await this.navTreeResource.moveTo((0,N.OU)(s),n.id);const e=s.map((e=>{const n=this.connectionInfoResource.getConnectionForNode(e);return n?(0,a.createConnectionParam)(n):null})).filter(Boolean);this.connectionInfoResource.markOutdated((0,N.OU)(e))}catch(e){this.notificationService.logException(e,"connections_public_connection_folder_move_failed")}}}async elementsTreeActionHandler(e,n){const t=e.get(O.S);if(void 0!==t)switch(n){case R.p:{const e=this.getTargetNode(t);if(!e)return void this.notificationService.logError({title:"Can't create folder",message:"core_projects_no_default_project"});let n;e.folderId&&(n=(0,c.p)(e.folderId));const i=await this.commonDialogService.open(L.L,{value:this.localizationService.translate("ui_folder_new"),projectId:e.projectId,folder:n?.folderId,title:"core_view_action_new_folder",icon:"/icons/folder.svg#root",create:!0,selectProject:e.selectProject,validation:async({name:e,folder:n,projectId:t},i)=>{const o=e.trim();if(0===o.length||!o.match(d.CONNECTION_FOLDER_NAME_VALIDATION))return i("connections_connection_folder_validation"),!1;try{return await this.connectionFolderResource.load((0,d.ConnectionFolderProjectKey)(t)),!this.connectionFolderResource.has((0,l.q)(t,(0,D.A)(n,o)))}catch(e){return i("connections_connection_folder_validation"),!1}}});if(i!==g.DialogueStateResult.Rejected&&i!==g.DialogueStateResult.Resolved)try{await this.connectionFolderResource.create(i.projectId,i.name,i.folder),this.navTreeResource.markOutdated(i.folder?(0,u.u)((0,l.q)(i.projectId,i.folder)):(0,k.V)(i.projectId))}catch(e){this.notificationService.logException(e,"Can't create folder")}break}}}async syncWithNavTree(e){A.F.some(e,(e=>void 0!==this.connectionFolderResource.fromNodeId(e)))&&this.connectionFolderResource.markOutdated()}getTargetNode(e){(0,o.O8)((()=>this.projectInfoResource.load(H.fZ)));const n=e.getSelected();if(0===n.length){const e=this.connectionsManagerService.createConnectionProjects;if(e.length>0){const n=e[0];return{projectId:n.id,projectNodeId:(0,k.V)(n.id),selectProject:e.length>1}}return}const t=n[0],i=[...this.navNodeInfoResource.getParents(t),t],r=this.navNodeInfoResource.get((0,N.OU)(i)),s=r.find((e=>e?.nodeType===P.O));if(!s)return;const a=this.projectsNavNodeService.getByNodeId(s.id);if(!a?.canEditDataSources)return;const c=r.slice().reverse().find((e=>e?.nodeType===b.Z));return{projectId:a.id,folderId:c?.id,projectNodeId:s.id,selectProject:!1}}};V=(0,i.Cg)([(0,p._)(),(0,i.Sn)("design:paramtypes",[S.LocalizationService,r.UserInfoResource,x.NavTreeResource,F.ActionService,M.MenuService,a.ConnectionInfoResource,w.NavNodeManagerService,d.ConnectionFolderResource,h.ConnectionsManagerService,g.CommonDialogService,m.NotificationService,_.NavNodeInfoResource,T.ProjectInfoResource,j.ProjectsNavNodeService])],V)},32662:(e,n,t)=>{t.r(n),t.d(n,{PluginBootstrap:()=>s});var i=t(1118),o=t(82103),r=t(5576);let s=class PluginBootstrap extends o.j{constructor(){super()}register(){}load(){}};s=(0,i.Cg)([(0,r._)(),(0,i.Sn)("design:paramtypes",[])],s)},75069:(e,n,t)=>{t.r(n),t.d(n,{PluginConnectionsSettingsService:()=>u});var i=t(1118),o=t(63716),r=t(5576),s=t(83916),a=t(80625),c=t(3065),d=t(31038);const l=c.Ik({"plugin.connections.hideConnectionViewForUsers":d.W.stringedBoolean().default(!1)});let u=class PluginConnectionsSettingsService extends o.O{get hideConnectionViewForUsers(){return this.settings.getValue("plugin.connections.hideConnectionViewForUsers")}constructor(e,n){super(),this.settingsProviderService=e,this.settingsManagerService=n,this.settings=this.settingsProviderService.createSettings(l),this.registerSettings()}registerSettings(){this.settingsManagerService.registerSettings(this.settings,(()=>[]))}};u=(0,i.Cg)([(0,r._)(),(0,i.Sn)("design:paramtypes",[s.SettingsProviderService,a.SettingsManagerService])],u)},33659:(e,n,t)=>{t.r(n),t.d(n,{PublicConnectionForm:()=>f});var i=t(41773),o=t(7838),r=t(15993),s=t(64928),a=t(69519),c=t(7167),d=t(18699),l=t(27411);const u={loader:"loader___TG19y"};var h=t(66291);const f=(0,o.PA)((function PublicConnectionForm(){const e=(0,d.h)(h.PublicConnectionFormService),n=(0,s.d)(u),t=(0,r.useCallback)((()=>e.close(!0)),[]),o=(0,r.useCallback)((()=>e.save()),[]);return(0,i.jsx)(a.a,{className:(0,c.s)(n,{loader:!0}),loading:null===e.formState,children:()=>e.formState&&(0,i.jsx)(l.Q,{state:e.formState,onSave:o,onCancel:t})})}))},66291:(e,n,t)=>{t.r(n),t.d(n,{PublicConnectionFormService:()=>y});var i=t(1118),o=t(94866),r=t(11130),s=t(50420),a=t(26533),c=t(49690),d=t(34906),l=t(5576),u=t(71635),h=t(14452),f=t(86764),p=t(3366),g=t(62151),m=t(10392),v=t(86411),S=t(76643),C=t(22799),_=t(77583);const b=(0,s.j)((()=>Promise.all([t.e(11502),t.e(11450),t.e(89151)]).then(t.bind(t,33659)).then((e=>e.PublicConnectionForm)))),formGetter=()=>b;let y=class PublicConnectionFormService{constructor(e,n,t,i,r,s,a,d,l,u){this.commonDialogService=e,this.notificationService=n,this.optionsPanelService=t,this.connectionFormService=i,this.connectionInfoResource=r,this.connectionsManagerService=s,this.userInfoResource=a,this.authenticationService=d,this.projectsService=l,this.projectInfoResource=u,this.closeRemoved=(e,n)=>{this.formState&&this.formState.config.connectionId&&null!==this.formState.projectId&&(this.connectionInfoResource.has((0,c.createConnectionParam)(this.formState.projectId,this.formState.config.connectionId))||this.close(!0))},this.closeDeleted=(e,n)=>{this.formState&&this.formState.config.connectionId&&null!==this.formState.projectId&&this.connectionInfoResource.isIntersect(e,(0,c.createConnectionParam)(this.formState.projectId,this.formState.config.connectionId))&&this.close(!0)},this.closeHandler=async(e,n)=>{await this.showUnsavedChangesDialog()||f.a.interrupt(n)},this.formState=null,this.optionsPanelService.closeTask.addHandler(this.closeHandler),this.connectionInfoResource.onDataUpdate.addPostHandler(this.closeRemoved),this.connectionInfoResource.onItemDelete.addPostHandler(this.closeDeleted),this.authenticationService.onLogin.addHandler((0,p.G)((()=>!!this.formState&&this.optionsPanelService.isOpen(formGetter)),(async(e,n)=>{if("before"===e&&null===this.userInfoResource.data){await this.showUnsavedChangesDialog()||f.a.interrupt(n)}}))),(0,o.Gn)(this,{formState:o.sH.shallow,change:o.XI,open:o.XI,close:o.XI})}change(e,n,t){this.formState||(this.formState=new _.C(this.projectsService,this.projectInfoResource,this.connectionFormService,this.connectionInfoResource),this.formState.closeTask.addHandler(this.close.bind(this,!0))),this.formState.setOptions(n.connectionId?"edit":"create","public").setConfig(e,n).setAvailableDrivers(t||[]),this.formState.load()}async open(e,n,t){const i=await this.optionsPanelService.open(formGetter);return i&&this.change(e,n,t),i}async close(e){if(!this.formState)return!0;e&&this.clearFormState();const n=await this.optionsPanelService.close();return n&&this.clearFormState(),n}async save(){const e=this.formState&&this.formState.config.connectionId&&null!==this.formState.projectId?(0,c.createConnectionParam)(this.formState.projectId,this.formState.config.connectionId):null;await this.close(!0),e&&this.connectionInfoResource.isConnected(e)&&this.tryReconnect(e)}async showUnsavedChangesDialog(){if(!this.formState||!this.optionsPanelService.isOpen(formGetter)||this.formState.config.connectionId&&null!==this.formState.projectId&&!this.connectionInfoResource.has((0,c.createConnectionParam)(this.formState.projectId,this.formState.config.connectionId)))return!0;const e=await this.formState.checkFormState();if(!e?.edited)return!0;return await this.commonDialogService.open(a.K,{title:"connections_public_connection_edit_cancel_title",message:"connections_public_connection_edit_cancel_message",confirmActionText:"ui_processing_ok"})!==u.DialogueStateResult.Rejected}async tryReconnect(e){if(await this.commonDialogService.open(a.K,{title:"connections_public_connection_edit_reconnect_title",message:"connections_public_connection_edit_reconnect_message",confirmActionText:"ui_reconnect"})!==u.DialogueStateResult.Rejected)try{await this.connectionInfoResource.close(e),await this.connectionsManagerService.requireConnection(e)}catch(e){this.notificationService.logException(e,"connections_public_connection_edit_reconnect_failed")}}clearFormState(){this.formState?.dispose(),this.formState=null}};y=(0,i.Cg)([(0,l._)(),(0,i.Sn)("design:paramtypes",[u.CommonDialogService,h.NotificationService,v.OptionsPanelService,C.ConnectionFormService,c.ConnectionInfoResource,d.ConnectionsManagerService,r.UserInfoResource,S.AuthenticationService,g.ProjectsService,m.ProjectInfoResource])],y)}}]);