/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/local-proxy-tools@1.2.0/bin/proxy-tools.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
#!/usr/bin/env node
const http=require("http"),Koa=require("koa"),logger=require("koa-logger"),httpProxy=require("./proxy/http-proxy"),httpsProxy=require("./proxy/https-proxy"),config=require("./config/main"),registerRouter=require("./routes"),bodyParser=require("koa-bodyparser"),path=require("path"),static=require("koa-static"),cors=require("koa-cors"),opn=require("opn"),url=require("url"),fs=require("fs"),portfinder=require("portfinder"),convert=require("koa-convert"),staticPath="./view/dist/",app=new Koa,view=new Koa;function listen(r){process.env.PORT=r;http.createServer(app.callback()).listen(r,config.HOST).on("connect",httpsProxy),console.log("Starting up proxy-tools"),console.log("  Please set the proxy to: http://localhost:"+r),console.log("  GUI pages location: http://localhost:"+r),console.log("Hit CTRL-C to stop the server")}app.use(convert(cors())),app.use(logger()),app.use(httpProxy()),app.use(static(path.join(__dirname,staticPath))),app.use(bodyParser()),app.use(registerRouter()),portfinder.basePort=config.PORT,portfinder.getPort((function(r,e){if(r)throw r;listen(e)})),process.on("uncaughtException",(function(r){console.error("An uncaught error occurred!"),console.error(r.stack)}));
//# sourceMappingURL=/sm/9317dc7e8f744cdea2c39a394cd55956e649e26ae6cd8076f65d54226811f061.map