-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
executable file
·2 lines (2 loc) · 20.7 KB
/
index.js
1
2
#!/usr/bin/env node
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(t,e){t.exports=require("colors")},function(t,e){t.exports=require("lodash")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(13);e.Logger={showWarn:r.showWarn,showError:r.showError,showInfo:r.showInfo,showLog:r.showLog},function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(15))},function(t,e){t.exports=require("path")},function(t,e){t.exports=require("fs-extra")},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.get_default_config=function(){return{ws:!1,changeOrigin:!0,pathMatch:"/"}}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var u=i(n(4)),s=i(n(3));e.get_custom_config=function(t){return r(void 0,void 0,void 0,(function(){var e,r,i;return o(this,(function(o){switch(o.label){case 0:e=t||"./proxy.config.js",r=s.default.resolve("./",e),i={},o.label=1;case 1:return o.trys.push([1,7,,8]),/\.js$/.test(e)?[4,Promise.resolve().then((function(){return a(n(20)(r))}))]:[3,3];case 2:return i=o.sent(),[3,6];case 3:return/\.json$/.test(e)?[4,u.default.readJSON(r)]:[3,5];case 4:return i=o.sent(),[3,6];case 5:throw new Error(t+" is not a valid config file, use default options instead");case 6:return[2,i];case 7:throw o.sent();case 8:return[2]}}))}))}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=n(8),u=n(17),s=n(2),l=i(n(0));r(void 0,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,5,,6]),[4,(t=new u.Program).start()];case 1:return e=o.sent(),[4,t.getOptions()];case 2:return n=o.sent(),e?[4,s.Banner.show("Proxy Server","Basic")]:[3,4];case 3:o.sent(),a.start_server(n),o.label=4;case 4:return[3,6];case 5:return r=o.sent(),console.log("\n"),console.log(r),console.log("\n"),console.log(l.default.red("Failed to start the server")),[3,6];case 6:return[2]}}))}))},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=i(n(9)),u=i(n(10)),s=i(n(11)),l=i(n(12)),c=i(n(0)),f=n(1),h=n(2),p=function(t){var e=l.default.createServer(),n=function(t,e){return r(void 0,void 0,void 0,(function(){return o(this,(function(r){return[2,new Promise((function(r,o){t.once("error",(function(r){if("EADDRINUSE"===r.code)return n(t,e+1);o(r)})),t.once("listening",(function(){t.close(),r(e)})),t.listen(e)}))]}))}))};return n(e,t)};e.start_server=function(t){return r(void 0,void 0,void 0,(function(){var e,n,r,i,l;return o(this,(function(o){switch(o.label){case 0:return e=f.get(t,"port")||8080,[4,p(e)];case 1:return n=o.sent(),(r=a.default()).use(s.default()),f.get(t,"target")&&(i=f.get(t,"pathMatch","/").split(/,\s?/).filter((function(t){return!!t})),l=u.default(i,t),r.use(l)),r.listen(n,(function(){var t="Server is listening to "+n.toString();h.Logger.showLog(c.default.green(t))})),[2]}}))}))}},function(t,e){t.exports=require("express")},function(t,e){t.exports=require("http-proxy-middleware")},function(t,e){t.exports=require("cors")},function(t,e){t.exports=require("net")},function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(n(0)),i=n(14);e.showLog=function(t){var e=i.get_timestamp();console.log("[LOG] "+e+" "+t)},e.showWarn=function(t){var e="["+o.default.bgYellow("WARN")+"]",n=i.get_timestamp();console.log(e+" "+n+" "+t)},e.showInfo=function(t){var e="["+o.default.cyan("INFO")+"]",n=i.get_timestamp();console.log(e+" "+n+" "+t)},e.showError=function(t){var e="["+o.default.bgRed("ERROR")+"]",n=i.get_timestamp();console.log(e+" "+n+" "+t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.get_timestamp=function(){return(new Date).toJSON().replace("T"," ").replace(/\.\w{4}$/,"")}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=i(n(16)),u=i(n(0));e.Banner={show:function(t,e){return void 0===e&&(e="Basic"),r(void 0,void 0,void 0,(function(){return o(this,(function(n){return[2,new Promise((function(n,r){a.default.text(t,e,(function(t,e){t&&r(t),console.log("\n"),console.log(u.default.green(e||"-_-")),n(e)}))}))]}))}))}}},function(t,e){t.exports=require("figlet")},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=i(n(3)),u=i(n(18)),s=i(n(0)),l=n(1),c=i(n(4)),f=n(19),h=function(){function t(){var t=this;this.program=u.default,this.options={},this.initConfig=function(){t.program.option("-i, --init","initailize the config file").action((function(e){e.init&&t.init()}))},this.setPort=function(){t.program.option("-p, --port <serverPort>","set port to proxy server, default is "+s.default.green("8080")).action((function(e){return l.set(t.options,"port",parseInt(e.port)||8080)}))},this.setTarget=function(){t.program.option("-t, --target <url>","set target to proxy server, target is required").action((function(e){return l.set(t.options,"target",e.target)}))},this.setConfigFilePath=function(){t.program.option("-c, --config [filepath]","set config file path, proxy is disabled by default").action((function(e){return l.set(t.options,"config",e.config)}))},this.setPathMatch=function(){t.program.option("-P, --path-match <paths>",'specify path(s) to proxy, otherwise the request will be sent without proxy.\nIf there are multiple paths, use "," to separate the path.\ne.g. '+s.default.cyan('$ proxy-server --path-match "/path1,/path2" --target "https://mydomain.com"')).action((function(e){return l.set(t.options,"pathMatch",e.pathMatch)}))},this.setPort(),this.setTarget(),this.setConfigFilePath(),this.setPathMatch(),this.initConfig()}return t.prototype.init=function(){return r(this,void 0,void 0,(function(){var t,e,n,r;return o(this,(function(o){switch(o.label){case 0:t="proxy.config.js",e=a.default.resolve("./",t),n=f.get_config_template(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,c.default.outputFile(e,n)];case 2:return o.sent(),console.log(s.default.green(t)+" has been created"),[2,!0];case 3:return r=o.sent(),console.error(r),[3,4];case 4:return[2]}}))}))},t.prototype.start=function(){return r(this,void 0,void 0,(function(){return o(this,(function(t){return this.program.parse(process.argv),2===process.argv.length?(this.program.outputHelp(),console.log("\n"),[2,!1]):this.program.init?[2,!1]:[2,!0]}))}))},t.prototype.getOptions=function(){return r(this,void 0,void 0,(function(){var t,e,n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),t="./proxy.config.js",this.options.config&&"string"==typeof this.options.config?t=this.options.config:void 0===this.options.config&&(t=void 0),[4,f.get_config(t)];case 1:return e=r.sent(),n=this.options,[2,l.assign(e,n)];case 2:throw r.sent();case 3:return[2]}}))}))},t}();e.Program=h},function(t,e){t.exports=require("commander")},function(t,e,n){"use strict";function r(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),r(n(5)),r(n(6)),r(n(21)),r(n(22))},function(t,e){function n(t){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id=20},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.get_config_template=function(){return"module.exports = {\n /**\n * Options for local server\n */\n port: 3000, // set the port for your proxy server,\n pathMatch: '/', // matched path will be proxied, others will be ignored\n\n /** \n * Options from http-proxy-middleware\n * Please go to https://github.com/chimurai/http-proxy-middleware#http-proxy-middleware-options for more detailed specification.\n * Auther: chimurai\n * Github repository: https://github.com/chimurai/http-proxy-middleware#http-proxy-middleware-options\n */\n // target: null, \t\t // url string to be parsed with the url module\n // forward: null, \t\t // url string to be parsed with the url module\n // agent: null, \t\t // object to be passed to http(s).request (see Node's https agent and http agent objects)\n // ssl: null, \t\t // object to be passed to https.createServer()\n ws: true, \t\t // true/false: if you want to proxy websockets\n // xfwd: false, \t\t // true/false, adds x-forward headers\n // secure: false, \t\t // true/false, if you want to verify the SSL Certs\n // toProxy: false, \t\t // true/false, passes the absolute URL as the path (useful for proxying to proxies)\n // prependPath: true, \t\t// true/false, Default: true - specify whether you want to prepend the target's path to the proxy path\n // ignorePath: false, \t\t// true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request (note: you will have to append / manually if required).\n // localAddress: null, \t\t// Local interface string to bind for outgoing connections\n changeOrigin: true, \t\t// true/false, Default: false - changes the origin of the host header to the target URL\n // preserveHeaderKeyCase: false, \t\t// true/false, Default: false - specify whether you want to keep letter case of response header key\n // auth: null, \t\t // Basic authentication i.e. 'user:password' to compute an Authorization header.\n // hostRewrite: null, \t\t// rewrites the location hostname on (301/302/307/308) redirects.\n // autoRewrite: null, \t\t// rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.\n // protocolRewrite: null, \t\t // rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null.\n // cookieDomainRewrite: null, \t\t// rewrites domain of set-cookie headers.\n // cookiePathRewrite: null, \t\t// rewrites path of set-cookie headers.\n // headers: null, \t\t // object, adds request headers. (Example: {host:'www.example.org'})\n // proxyTimeout: null, \t\t// timeout (in millis) when proxy receives no response from target\n // timeout: null, \t\t // timeout (in millis) for incoming requests\n // followRedirects: false, \t\t // true/false, Default: false - specify whether you want to follow redirects\n // selfHandleResponse: false, \t\t// true/false, if set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event\n // buffer: null, \t\t // stream of data to send as the request body. Maybe you have some middleware that consumes the request stream before proxying it on e.g. If you read the body of a request into a field called 'req.rawbody' you could restream this field in the buffer \n}"}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{s(r.next(t))}catch(t){i(t)}}function u(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(i){return function(u){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,u])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),a=n(6),u=n(1);e.get_config=function(t){return r(void 0,void 0,void 0,(function(){var e,n;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),t?[4,a.get_custom_config(t)]:[3,2];case 1:return e=r.sent(),n=i.get_default_config(),[2,u.assign(n,e)];case 2:return[2,i.get_default_config()];case 3:throw r.sent();case 4:return[2]}}))}))}}]);