import Debug from 'debug' ; import { Capabilities , setEvaluatorImpl } from '@kui-shell/core' ; import { isDisabled , config } from './lib/config' ; const debug = Debug ( 'plugins/proxy-support/preload' ) ; /**
 * This is the capabilities registraion
 *
 */ export const registerCapability = async ( ) => { if ( Capabilities . inBrowser ( ) ) { const { proxyServer } = await config ( ) ; debug ( 'config' , proxyServer ) ; if ( ! isDisabled ( proxyServer ) ) { Capabilities . assertHasProxy ( ) ; Capabilities . assertLocalAccess ( ) ; } } } ; /**
 * This is the module
 *
 */ export default async ( ) => { if ( Capabilities . inBrowser ( ) ) { const { proxyServer } = await config ( ) ; debug ( 'config' , proxyServer ) ; if ( ! isDisabled ( proxyServer ) ) { const ProxyEvaluator = ( await import ( './lib/proxy-executor' ) ) . default ; debug ( 'attempting to establish our proxy executor' ) ; setEvaluatorImpl ( new ProxyEvaluator ( ) ) ; } } } ;