comp-hub 0.42.5 → 0.42.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var __webpack_modules__={53196:Dt=>{function webpackEmptyAsyncContext(Dt){return Promise.resolve().then((()=>{var Lt=new Error("Cannot find module '"+Dt+"'");Lt.code="MODULE_NOT_FOUND";throw Lt}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;Dt.exports=webpackEmptyAsyncContext},14071:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});const Gn=Wn(Tn(22078));const rr=Tn(23718);const{logLevel:cr=""}=(0,Gn.default)(process.argv.slice(2));Lt["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:cr||"warn"},coreLogger:{level:cr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:rr.backendMessages.en},zh:{default:rr.backendMessages.zh}},writeCookie:false}}},91921:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt["default"]={}},12799:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MainConfiguration=void 0;const gr=Tn(46123);const yr=cr(Tn(47453));const Sr=cr(Tn(99375));const Er=cr(Tn(65295));const Or=cr(Tn(2865));const Ir=cr(Tn(49179));const Hr=cr(Tn(62487));const Gr=cr(Tn(96955));const $r=cr(Tn(87735));const mi=cr(Tn(16928));const ki=cr(Tn(79896));const Ni=mr(Tn(76982));const Ri=Tn(79896);const ji=Tn(24434);const Ui=mr(Tn(99819));const Vi=mr(Tn(44400));const zi=mr(Tn(77036));const Ki=Tn(31855);const $i=Tn(26815);const Xi=Tn(54633);const Yi=Tn(59416);const Wo=Tn(61142);const Ho=Tn(64754);const Go=Tn(10778);const Xo=Tn(49969);const Yo=Tn(67872);const Qo=Tn(4145);const xa=cr(Tn(14071));const Ta=cr(Tn(91921));const wa=Tn(87518);const Oa=Tn(18801);const Ia=cr(Tn(68255));const Ra={DEFAULT_PORT:Number(wa.uri.getUrlPort($i.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let La=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const Dt=this.app.getEnv();this._websitePath=mi.resolve(__dirname,Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const Dt=this.app.getEnv();return Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL?$i.KEYS.REMOTE_SERVICE_URL_DEV:$i.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const Dt=this.app.getEnv();if(Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Dt=mi.join(__dirname,"../../cli/package.json");const Lt=JSON.parse((0,Ri.readFileSync)(Dt,"utf8"));return Lt.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(Dt){const Lt=new ji.EventEmitter;const Tn={...Dt,on:{...Dt.on,error:Dt=>{this.logger.error("Proxy Error:",Dt.message);Lt.emit("error",Dt)},proxyRes:()=>Lt.emit("proxyRes"),proxyReq:Dt=>{const Tn=`${Dt.protocol}//${Dt.host}${Dt.path}`;this.logger.debug("[Proxy] →",Tn);Lt.emit("proxyReq",Dt)},proxyReqWs:(...Dt)=>Lt.emit("proxyReqWs",...Dt)}};const Wn=Dt.pathRewrite;const Gn=Object.keys(Wn??{});if(Gn.length>0){const[Dt]=Gn;Tn.pathRewrite=Lt=>{let Tn=Lt.replace($i.KEYS.PROXY_PATH_PREFIX,"");Tn=Tn.replace(new RegExp(Dt),Wn[Dt]);return Tn}}else{Tn.pathRewrite=Dt=>Dt.replace($i.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Ki.createProxyMiddleware)(Tn),opt:Tn,event:Lt}}createProxyMap(Dt){const Lt={};for(const[Tn,Wn]of Object.entries(Dt)){Lt[Tn]=this.createProxyConfig(Wn)}return Lt}setupProxy(){const Dt=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);if(Ho.ProxyController.proxys){for(const Dt of Object.values(Ho.ProxyController.proxys)){Dt.event.removeAllListeners()}}Ho.ProxyController.proxys={};if(!Dt.proxy)return;Ho.ProxyController.proxys=this.createProxyMap(Dt.proxy)}async buildConfig(Dt){const Lt=this.app.getEnv();const Tn=Dt.cwd||process.cwd();this.logger.info("cwd:",Tn);this.logger.info("env:",Lt);const Wn={port:Dt.port||Ra.DEFAULT_PORT,allowDebug:Dt.allowDebug??false,api:Dt.api||this.apiUrl,dir:Dt.dir||"",cwd:Tn,proxy:Dt.proxy};const Gn=mi.join(this.websitePath,$i.KEYS.WEBSITE_PATH_MAIN);const rr=mi.join(Tn,Wn.dir||"").replace(/[\\/]$/,"");const cr=mi.join(Tn,$i.KEYS.PREBUILD_MODULE_DIR);const pr=mi.join(Tn,"node_modules");await ki.promises.mkdir(cr,{recursive:true});const mr={websitePath:Gn,prebuildModulePath:cr,cwd:Tn,port:Wn.port,srcPath:rr,remoteServer:Wn.api,version:this.getVersion(),allowDebug:Wn.allowDebug,proxy:Wn.proxy,projectHash:Ni.default.createHash("sha256").update(Tn).digest("hex").slice(0,8)};Go.remoteInstance.defaults.baseURL=mr.remoteServer;if(Lt===$i.KEYS.LOCAL_MIDWAY_ENV_PROD){mr.port=await(0,zi.default)({port:zi.default.makeRange(mr.port,mr.port+100)})}this.appConfig=mr;const gr={dirs:{default:{prefix:`/${$i.KEYS.WEBSITE_PATH_MAIN}`,dir:Gn},[$i.KEYS.MODULE_LOAD_PREFIX]:{prefix:$i.KEYS.MODULE_LOAD_PREFIX,dir:cr,maxAge:0},[$i.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:$i.KEYS.NODE_MODULES_LOAD_PREFIX,dir:pr,maxAge:0},[$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:mr.srcPath,maxAge:0}}};try{await ki.promises.access(Gn,ki.constants.F_OK)}catch(Dt){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Xo.getErrorMessage)(Dt));await ki.promises.mkdir(Gn,{recursive:true})}if(Lt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await ki.promises.writeFile(mi.join(__dirname,".comphubConfig.json"),JSON.stringify(mr,null,2))}return{koa:{port:mr.port},staticFile:gr,httpProxy:{strategy:{[$i.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${$i.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${mr.remoteServer}/$1`}}}}}async startSubPort(){const Dt=this.app.getEnv();const Lt=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);const{port:Tn,remoteServer:Wn}=Lt;let Gn=await(0,zi.default)({port:zi.default.makeRange(Tn,Tn+100)});const rr=new Ui.default;rr.use((async(Dt,Gn)=>{if(Dt.path.startsWith($i.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:Tn}=Lt;const Wn=Dt.path[0];const Gn=Dt.path.replace($i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const rr=await wa.locate.resolveBuildPath(Gn,{baseDir:Tn});if(rr){const Lt=rr.replace(Tn,"");const cr=Oa.textKit.replaceSlashWithSpecifiedSeparator(Lt,Wn);if(Gn!==cr){const Lt=cr.replace(Gn,"");Dt.redirect(Dt.path+Lt);return}}}const rr=[{prefix:`/${$i.KEYS.REMOTE_SERVICE_PREFIX}`,target:Wn,rewrite:{[`^/${$i.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${$i.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{[`^/${$i.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:$i.KEYS.MODULE_LOAD_PREFIX,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}},{prefix:$i.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}},{prefix:$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}}];for(const Lt of rr){if(Dt.path.startsWith(Lt.prefix)){await(0,Yo.createKoaProxy)(Dt,Lt.target,Lt.rewrite);return}}await Gn()}));rr.use((0,Vi.default)(this.websitePath,{index:false}));rr.use((async Dt=>{try{const Lt=(()=>{if(Dt.path.startsWith(`${$i.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return $i.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(Dt.path.startsWith(`${$i.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return $i.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const Tn=mi.join(this.websitePath,Lt,"index.html");const Wn=await ki.promises.readFile(Tn,"utf-8");const rr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:Gn})};<\/script>`;const cr=Wn.replace("\x3c!--GLOBAL_CONFIG--\x3e",rr);Dt.type="text/html; charset=utf-8";Dt.status=200;Dt.body=cr}catch(Lt){this.logger.error("读取 index.html 失败:",Lt);Dt.status=500;Dt.body="服务器内部错误"}}));await new Promise(((Tn,Wn)=>{let cr=0;const pr=rr.listen(Gn,(()=>{this.subServer=pr;this.app.setAttr($i.KEYS.COMPHUB_CONFIG_KEY,{...Lt,subPort:Gn});if(process.send){process.send({type:"subPort",subPort:Gn})}if(Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${Gn} 已启动`)}Tn()}));pr.on("error",(Dt=>{if(Dt.code==="EADDRINUSE"&&cr<Ra.MAX_SUB_PORT_RETRIES){cr++;this.logger.error(`子端口 ${Gn} 被占用,正在尝试端口 ${++Gn}`);pr.close();pr.listen(Gn)}else{Wn(Dt)}}))}))}async printAccessInfo(Dt){const Lt=await Dt.getAsync(yr.Framework);const Tn=Lt.getServer();const Wn=Tn.address();const Gn=this.app.getEnv();const rr=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",rr.cwd);this.logger.info("env:",Gn);this.logger.info("port:",rr.port);if(rr.subPort)this.logger.info("subPort:",rr.subPort);if(Wn&&typeof Wn!=="string"){const Dt=Wn.port;this.logger.info("Local Address:",`http://localhost:${Dt}`);if(Gn===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Lt=wa.network.getLocalIPv4();if(Lt)this.logger.info("Network Address:",`http://${Lt}:${Dt}`);this.logger.info("Swagger UI:",`http://localhost:${Dt}/swagger-ui/index.html`)}}}async onConfigLoad(){const Dt=await(0,Qo.waitForIpcConfig)();const Lt=await this.buildConfig(Dt);const Tn=this.app.getEnv();if(Tn===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await ki.promises.writeFile(mi.join(__dirname,".start.json"),JSON.stringify(Lt,null,2))}return Lt}async onReady(){this.app.setAttr($i.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Wo.ReportMiddleware]);this.app.useFilter([Yi.BadRequestErrorFilter,Xi.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(Dt){this.setupProxy();await this.startSubPort();await this.printAccessInfo(Dt)}async onStop(){if(this.subServer){await new Promise((Dt=>{this.subServer.close((()=>Dt()))}));this.logger.info("子服务已关闭")}}};Lt.MainConfiguration=La;rr([(0,gr.Logger)("coreLogger"),pr("design:type",Object)],La.prototype,"logger",void 0);rr([(0,gr.App)(),pr("design:type",Object)],La.prototype,"app",void 0);Lt.MainConfiguration=La=rr([(0,gr.Configuration)({imports:[yr,Sr,Or,Hr,Gr,$r,Ia,{component:Er,enabledEnvironment:[$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Ir,enabledEnvironment:[$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:xa,local:Ta}]})],La)},83465:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CompController=void 0;const cr=Tn(46123);const pr=Tn(48795);const mr=Tn(63366);const gr=Tn(49179);const yr=Tn(8131);const Sr=Tn(101);const Er=Tn(19465);const Or=Tn(19385);const Ir=Tn(4990);const Hr=(0,Or.createNoData)(gr.ApiProperty);let Gr=class CompController{async dir(Dt){const Lt=await this.compService.getCompDir(Dt.compPath);return Or.resUtil.success(Lt)}async file(Dt){const{filePath:Lt}=Dt;const Tn=await this.compService.getCompFile(Lt);return Or.resUtil.success({content:Tn})}async check(Dt){const Lt=await this.compService.checkCompConfig(Dt.compPath,Dt.framework);return Or.resUtil.success(Lt)}async updateVersion(Dt){const{compPath:Lt,version:Tn}=Dt;await this.compService.updateCompVersion(Lt,Tn);return Or.resUtil.noData()}async generateCompJson(Dt){const{compPath:Lt}=Dt;await this.compService.generateCompJson(Lt);return Or.resUtil.noData()}async dep(Dt){const{compPath:Lt}=Dt;const Tn=await this.compService.getCompDep(Lt);return Or.resUtil.success({thirdParty:Tn})}async checkCompRepeat(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();const Lt=await this.compService.checkCompRepeat(Dt);return Or.resUtil.success(Lt)}async submit(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(Dt);return Or.resUtil.noData()}async update(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(Dt);return Or.resUtil.noData()}async download(Dt){const Lt=await this.compService.downloadComp(Dt);if(Lt?.isRepeat){return Or.resUtil.success({isRepeat:true})}return Or.resUtil.success({isRepeat:false})}async localCompsByIds(Dt){const{compIds:Lt}=Dt;const Tn=await this.compService.getLocalCompsByIds(Lt);return Or.resUtil.success({compInfos:Tn})}async compFilesOssSignedUrl(Dt){const Lt=await this.compService.getCompFilesOssSignedUrl(Dt);return Or.resUtil.success(Lt)}async packageJson(){const Dt=await this.compService.getPackageJsonContent();return Or.resUtil.success({packageJson:Dt})}async compFileHash(Dt){const Lt=await this.compService.getCompFileHash(Dt);return Or.resUtil.success(Lt)}async localComps(Dt){const Lt=await this.compService.getLocalComps(Dt);return Or.resUtil.success(Lt)}async openCompPathInVscode(Dt){await this.compService.openCompPathInVscode(Dt);return Or.resUtil.noData()}async openCompPathInExplorer(Dt){await this.compService.openCompPathInExplorer(Dt);return Or.resUtil.noData()}async localCompDetailByPathHash(Dt){const Lt=await this.compService.getLocalCompDetailByPathHash(Dt);return Or.resUtil.success(Lt)}async writeFile(Dt){await this.compService.writeCompFile(Dt);return Or.resUtil.noData()}async renameDir(Dt){await this.compService.renameCompDir(Dt);return Or.resUtil.noData()}};Lt.CompController=Gr;Wn([(0,cr.App)(),Gn("design:type",Object)],Gr.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",pr.CompService)],Gr.prototype,"compService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",mr.ConfigService)],Gr.prototype,"configService",void 0);Wn([(0,gr.ApiOperation)({summary:"获取组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileVO)}),(0,cr.Post)("/dir"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompDirDTO]),Gn("design:returntype",Promise)],Gr.prototype,"dir",null);Wn([(0,gr.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileContentVO)}),(0,cr.Post)("/file"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFileDTO]),Gn("design:returntype",Promise)],Gr.prototype,"file",null);Wn([(0,gr.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompCheckVO)}),(0,cr.Post)("/check"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompCheckDTO]),Gn("design:returntype",Promise)],Gr.prototype,"check",null);Wn([(0,gr.ApiOperation)({summary:"更新组件版本号"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/updateVersion"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.UpdateVersionDTO]),Gn("design:returntype",Promise)],Gr.prototype,"updateVersion",null);Wn([(0,gr.ApiOperation)({summary:"生成组件指纹文件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/generateCompJson"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.GenerateCompJsonDTO]),Gn("design:returntype",Promise)],Gr.prototype,"generateCompJson",null);Wn([(0,gr.ApiOperation)({summary:"获取组件依赖关系"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.ImportScanResultVO)}),(0,cr.Post)("/dep"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.DepDTO]),Gn("design:returntype",Promise)],Gr.prototype,"dep",null);Wn([(0,gr.ApiOperation)({summary:"检查组件是否重复"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompSimilarListVO)}),(0,cr.Post)("/checkCompRepeat",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CheckCompRepeatDTO]),Gn("design:returntype",Promise)],Gr.prototype,"checkCompRepeat",null);Wn([(0,gr.ApiOperation)({summary:"提交组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/submit",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.SubmitCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"submit",null);Wn([(0,gr.ApiOperation)({summary:"更新组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/update",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.UpdateCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"update",null);Wn([(0,gr.ApiOperation)({summary:"下载组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.DownloadCompVO)}),(0,cr.Post)("/download",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.DownloadCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"download",null);Wn([(0,gr.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.LocalCompsByIdsVO)}),(0,cr.Post)("/localCompsByIds"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompsByIdsDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localCompsByIds",null);Wn([(0,gr.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFilesOssSignedUrlVO)}),(0,cr.Post)("/compFilesOssSignedUrl",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFilesOssSignedUrlDTO]),Gn("design:returntype",Promise)],Gr.prototype,"compFilesOssSignedUrl",null);Wn([(0,gr.ApiOperation)({summary:"获取package.json"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.PackageJsonVO)}),(0,cr.Post)("/packageJson"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Gr.prototype,"packageJson",null);Wn([(0,gr.ApiOperation)({summary:"获取组件文件hash"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileHashVO)}),(0,cr.Post)("/compFileHash"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFileHashDTO]),Gn("design:returntype",Promise)],Gr.prototype,"compFileHash",null);Wn([(0,gr.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,(0,Or.createListWrapper)(gr.ApiProperty,Sr.LocalCompsVO))}),(0,cr.Post)("/localComps",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompsDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localComps",null);Wn([(0,gr.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/openCompPathInVscode"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.OpenCompPathInVscodeDTO]),Gn("design:returntype",Promise)],Gr.prototype,"openCompPathInVscode",null);Wn([(0,gr.ApiOperation)({summary:"在系统文件管理器中打开并选中组件文件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/openCompPathInExplorer"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.OpenCompPathInExplorerDTO]),Gn("design:returntype",Promise)],Gr.prototype,"openCompPathInExplorer",null);Wn([(0,gr.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.LocalCompDetailVO)}),(0,cr.Post)("/localCompDetailByPathHash"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompDetailByPathHashDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localCompDetailByPathHash",null);Wn([(0,gr.ApiOperation)({summary:"写入文件到组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/writeFile"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompWriteFileDTO]),Gn("design:returntype",Promise)],Gr.prototype,"writeFile",null);Wn([(0,gr.ApiOperation)({summary:"重命名组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/renameDir"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.RenameCompDirDTO]),Gn("design:returntype",Promise)],Gr.prototype,"renameDir",null);Lt.CompController=Gr=Wn([(0,gr.ApiTags)(["comp"]),(0,cr.Controller)("/comp")],Gr)},96736:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ModuleController=void 0;const cr=Tn(46123);const pr=Tn(49179);const mr=Tn(85984);const gr=Tn(19428);const yr=Tn(71692);const Sr=Tn(61275);const Er=Tn(19385);const Or=(0,Er.createNoData)(pr.ApiProperty);let Ir=class ModuleController{async preBuild(Dt){const{deps:Lt}=Dt;let Tn=null;await this.queueService.enqueue((async()=>{Tn=await this.moduleService.preBuild(Lt)}));return Er.resUtil.success(Tn)}async buildTemplateCompiler(Dt){let Lt=null;await this.queueService.enqueue((async()=>{Lt=await this.moduleService.buildTemplateCompiler(Dt.vueVersion)}));return Er.resUtil.success(Lt)}async preBuildSize(){const Dt=await this.moduleService.preBuildSize();return Er.resUtil.success({size:Dt})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Er.resUtil.noData()}};Lt.ModuleController=Ir;Wn([(0,cr.Inject)(),Gn("design:type",mr.ModuleService)],Ir.prototype,"moduleService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.QueueService)],Ir.prototype,"queueService",void 0);Wn([(0,pr.ApiOperation)({summary:"模块预构建"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.PreBuildVO)}),(0,cr.Post)("/preBuild"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.PreBuildDTO]),Gn("design:returntype",Promise)],Ir.prototype,"preBuild",null);Wn([(0,pr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,pr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.BuildTemplateCompilerVO)}),(0,cr.Post)("/buildTemplateCompiler"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.BuildTemplateCompilerDTO]),Gn("design:returntype",Promise)],Ir.prototype,"buildTemplateCompiler",null);Wn([(0,pr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.PreBuildSizeVO)}),(0,cr.Post)("/preBuildSize"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Ir.prototype,"preBuildSize",null);Wn([(0,pr.ApiOperation)({summary:"清除预构建模块文件"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:Or}),(0,cr.Post)("/clearPreBuild"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Ir.prototype,"clearPreBuild",null);Lt.ModuleController=Ir=Wn([(0,pr.ApiTags)(["module"]),(0,cr.Controller)("/module")],Ir)},54991:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.OssController=void 0;const cr=Tn(46123);const pr=Tn(49179);const mr=Tn(19385);const gr=Tn(56415);const yr=Tn(75049);const Sr=Tn(80799);const Er=Tn(19465);let Or=class OssController{async fileSignUrl(Dt){const{objectId:Lt}=Dt;const Tn=await this.ossService.getDownloadSts();const Wn=await this.ossService.getFilePreviewUrl(Tn,Lt);return mr.resUtil.success({signUrl:Wn})}};Lt.OssController=Or;Wn([(0,cr.App)(),Gn("design:type",Object)],Or.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.OssService)],Or.prototype,"ossService",void 0);Wn([(0,pr.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,mr.createSuccessWrapper)(pr.ApiProperty,yr.SignedUrlVO)}),(0,cr.Post)("/fileSignUrl",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.SignedUrlDTO]),Gn("design:returntype",Promise)],Or.prototype,"fileSignUrl",null);Lt.OssController=Or=Wn([(0,pr.ApiTags)(["oss"]),(0,cr.Controller)("/oss")],Or)},64754:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr;Object.defineProperty(Lt,"__esModule",{value:true});Lt.ProxyController=void 0;const cr=Tn(46123);const pr=Tn(26815);const mr=pr.KEYS.PROXY_PATH_PREFIX;let gr=rr=class ProxyController{async proxy(){const Dt=this.ctx.path.replace(mr,"");let Lt=null;for(const[Tn,Wn]of Object.entries(rr.proxys)){const Gn=new RegExp(Tn);if(Gn.test(Dt)||Dt.startsWith(Tn)){Lt=Wn;break}}if(!Lt){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:Tn,event:Wn}=Lt;await new Promise(((Dt,Lt)=>{Tn(this.ctx.req,this.ctx.res);Wn.on("error",Lt);Wn.on("proxyRes",Dt)}))}};Lt.ProxyController=gr;Wn([(0,cr.Inject)(),Gn("design:type",Object)],gr.prototype,"ctx",void 0);Wn([(0,cr.All)("/*"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],gr.prototype,"proxy",null);Lt.ProxyController=gr=rr=Wn([(0,cr.Controller)(mr,{ignoreGlobalPrefix:true})],gr)},17076:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SpaController=void 0;const mr=Tn(46123);const gr=cr(Tn(79896));const yr=Tn(16928);const Sr=Tn(49179);const Er=Tn(63366);const Or=Tn(26815);let Ir=class SpaController{async index(){this.ctx.redirect(`/${Or.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const Dt=this.configService.comphubConfig();const{websitePath:Lt}=Dt;const Tn=(0,yr.resolve)(Lt,"index.html");let Wn=await gr.promises.readFile(Tn,"utf-8");const Gn=this.configService.getGlobalConfig();const{projectHash:rr}=Gn;if(rr){Wn=Wn.replace(/<base[^>]*>/gi,"");Wn=Wn.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${rr}/main/">`)}const cr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(Gn)};<\/script>`;Wn=Wn.replace("\x3c!--GLOBAL_CONFIG--\x3e",cr);return Wn}async getGlobalConfig(){return this.configService.getGlobalConfig()}};Lt.SpaController=Ir;rr([(0,mr.Inject)(),pr("design:type",Object)],Ir.prototype,"ctx",void 0);rr([(0,mr.App)(),pr("design:type",Object)],Ir.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Er.ConfigService)],Ir.prototype,"configService",void 0);rr([(0,mr.Get)("/"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"index",null);rr([(0,mr.Get)(`/${Or.KEYS.WEBSITE_PATH_MAIN}/*`),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"spa",null);rr([(0,mr.Get)(Or.KEYS.GLOBAL_CONFIG_PATH),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"getGlobalConfig",null);Lt.SpaController=Ir=rr([(0,Sr.ApiExcludeController)(),(0,mr.Controller)("/",{ignoreGlobalPrefix:true})],Ir)},44734:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VuefinderController=void 0;const cr=Tn(46123);const pr=Tn(5808);const mr=Tn(49179);const gr=Tn(23444);let yr=class VuefinderController{async list(Dt){const Lt=await this.vuefinderService.list(Dt);return Lt}};Lt.VuefinderController=yr;Wn([(0,cr.App)(),Gn("design:type",Object)],yr.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",pr.VuefinderService)],yr.prototype,"vuefinderService",void 0);Wn([(0,mr.ApiOperation)({summary:"list"}),(0,cr.Get)("/list"),rr(0,(0,cr.Query)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.VueFinderIndexDTO]),Gn("design:returntype",Promise)],yr.prototype,"list",null);Lt.VuefinderController=yr=Wn([(0,mr.ApiTags)(["vuefinder"]),(0,cr.Controller)("/vuefinder")],yr)},60149:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BasePageDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class BasePageDTO{}Lt.BasePageDTO=BasePageDTO;Wn([(0,rr.ApiProperty)({example:1,description:"当前页码",required:false}),(0,cr.Rule)(cr.RuleType.number().min(1)),Gn("design:type",Number)],BasePageDTO.prototype,"page",void 0);Wn([(0,rr.ApiProperty)({example:10,description:"每页数量",required:false}),(0,cr.Rule)(cr.RuleType.number().min(1).max(50)),Gn("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);Wn([(0,cr.Rule)(cr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,rr.ApiProperty)({example:"小明",description:"关键词",required:false}),Gn("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.RenameCompDirDTO=Lt.CompWriteFileDTO=Lt.LocalCompDetailByPathHashDTO=Lt.OpenCompPathInExplorerDTO=Lt.OpenCompPathInVscodeDTO=Lt.LocalCompsDTO=Lt.CompFilesOssSignedUrlDTO=Lt.DownloadCompDTO=Lt.UpdateCompDTO=Lt.SubmitCompDTO=Lt.DepItemDTO=Lt.CompFileDTO=Lt.UpdateVersionDTO=Lt.CompFileHashDTO=Lt.CheckCompRepeatDTO=Lt.LocalCompsByIdsDTO=Lt.DepDTO=Lt.GenerateCompJsonDTO=Lt.CompCheckDTO=Lt.CompDirDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);const pr=Tn(26815);const mr=Tn(60149);class CompPathDTO{}Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}Wn([(0,rr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}Lt.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}Lt.CompCheckDTO=CompCheckDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}Lt.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}Lt.DepDTO=DepDTO;class LocalCompsByIdsDTO{}Lt.LocalCompsByIdsDTO=LocalCompsByIdsDTO;Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}Lt.CheckCompRepeatDTO=CheckCompRepeatDTO;Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}Lt.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}Lt.UpdateVersionDTO=UpdateVersionDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}Lt.CompFileDTO=CompFileDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,cr.Rule)(cr.RuleType.array().optional().items(cr.RuleType.string())),Gn("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}Wn([(0,rr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],ParentDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}Lt.DepItemDTO=DepItemDTO;Wn([(0,rr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DepItemDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DepItemDTO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,cr.Rule)(cr.RuleType.object().optional()),Gn("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}Lt.SubmitCompDTO=SubmitCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);Wn([(0,rr.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,cr.Rule)(cr.RuleType.array().required()),Gn("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);Wn([(0,rr.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,cr.Rule)(cr.RuleType.array().required()),Gn("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,cr.Rule)(cr.RuleType.string().empty("").default("")),Gn("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,cr.Rule)(cr.RuleType.array().items(cr.RuleType.string())),Gn("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}Lt.UpdateCompDTO=UpdateCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,cr.Rule)(cr.RuleType.string().allow("").max(200)),Gn("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}Lt.DownloadCompDTO=DownloadCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,cr.Rule)(cr.RuleType.boolean().default(false)),Gn("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}Lt.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends mr.BasePageDTO{}Lt.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}Lt.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class OpenCompPathInExplorerDTO{}Lt.OpenCompPathInExplorerDTO=OpenCompPathInExplorerDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInExplorerDTO.prototype,"folderPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInExplorerDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}Lt.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}Lt.CompWriteFileDTO=CompWriteFileDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"文件名",example:pr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}Lt.RenameCompDirDTO=RenameCompDirDTO;Wn([(0,rr.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BuildTemplateCompilerDTO=Lt.PreBuildDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class PreBuildDTO{}Lt.PreBuildDTO=PreBuildDTO;Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}Lt.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;Wn([(0,rr.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},56415:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SignedUrlDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class SignedUrlDTO{}Lt.SignedUrlDTO=SignedUrlDTO;Wn([(0,cr.Rule)(cr.RuleType.string().required().error(new Error("对象id不能为空"))),(0,rr.ApiProperty)({example:"",description:"对象id",required:true}),Gn("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},23444:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VueFinderIndexDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class VueFinderIndexDTO{}Lt.VueFinderIndexDTO=VueFinderIndexDTO;Wn([(0,rr.ApiProperty)({required:false,description:"文件路径"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BadRequestErrorFilter=void 0;const Gn=Tn(46123);const rr=Tn(19385);const cr=Tn(26815);let pr=class BadRequestErrorFilter{async catch(Dt,Lt){const Tn=Lt.app.getEnv();if(Tn===cr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("BadRequestErrorFilter==>",Dt)}return rr.resUtil.error(Dt.message,Dt.status)}};Lt.BadRequestErrorFilter=pr;Lt.BadRequestErrorFilter=pr=Wn([(0,Gn.Catch)(Gn.httpError.BadRequestError)],pr)},54633:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DefaultErrorFilter=void 0;const Gn=Tn(46123);const rr=Tn(26815);let cr=class DefaultErrorFilter{async catch(Dt,Lt){const Tn=Lt.app.getEnv();try{const Lt=JSON.parse(Dt.message);return{...Lt}}catch(Dt){if(Tn===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("解析错误信息失败==>",Dt.message,"\n")}}finally{if(Tn===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("原始错误==>",Dt)}}Lt.status=Dt.status??500;return{code:Dt.status??500,message:Dt.message??"未知错误"}}};Lt.DefaultErrorFilter=cr;Lt.DefaultErrorFilter=cr=Wn([(0,Gn.Catch)()],cr)},15545:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(12799);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.MainConfiguration}});Gn(Tn(14071),Lt);Gn(Tn(91921),Lt);Gn(Tn(83465),Lt);Gn(Tn(96736),Lt);Gn(Tn(54991),Lt);Gn(Tn(64754),Lt);Gn(Tn(17076),Lt);Gn(Tn(44734),Lt);Gn(Tn(60149),Lt);Gn(Tn(8131),Lt);Gn(Tn(19428),Lt);Gn(Tn(56415),Lt);Gn(Tn(23444),Lt);Gn(Tn(59416),Lt);Gn(Tn(54633),Lt);Gn(Tn(9711),Lt);Gn(Tn(53951),Lt);Gn(Tn(77523),Lt);Gn(Tn(61142),Lt);Gn(Tn(19465),Lt);Gn(Tn(95637),Lt);Gn(Tn(48795),Lt);Gn(Tn(63366),Lt);Gn(Tn(23086),Lt);Gn(Tn(85984),Lt);Gn(Tn(80799),Lt);Gn(Tn(61275),Lt);Gn(Tn(19452),Lt);Gn(Tn(5808),Lt);Gn(Tn(66593),Lt);Gn(Tn(58953),Lt);Gn(Tn(49969),Lt);Gn(Tn(4145),Lt);Gn(Tn(10778),Lt);Gn(Tn(67872),Lt);Gn(Tn(101),Lt);Gn(Tn(71692),Lt);Gn(Tn(75049),Lt)},9711:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},53951:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},77523:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},61142:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ReportMiddleware=void 0;const Gn=Tn(46123);let rr=class ReportMiddleware{resolve(){return async(Dt,Lt)=>{const Tn=Date.now();const Wn=await Lt();const Gn=Dt.url;Dt.logger.info(`请求 ${Dt.method} ${Gn} → ${Dt.status} (${Date.now()-Tn}ms)`);return Wn}}static getName(){return"report"}};Lt.ReportMiddleware=rr;Lt.ReportMiddleware=rr=Wn([(0,Gn.Middleware)()],rr)},19465:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TokenMiddleware=void 0;const Gn=Tn(46123);const rr=Tn(10778);let cr=class TokenMiddleware{resolve(){return async(Dt,Lt)=>{(0,rr.setHeader)(Dt.header);await Lt()}}static getName(){return"token"}};Lt.TokenMiddleware=cr;Lt.TokenMiddleware=cr=Wn([(0,Gn.Middleware)()],cr)},95637:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CommandService=void 0;const cr=Tn(46123);const pr=rr(Tn(79896));const mr=Tn(63366);const gr=Tn(7455);const yr=rr(Tn(16928));const Sr=Tn(68255);const Er=Tn(35317);const Or=rr(Tn(70857));let Ir=class CommandService{async revealInVSCode(Dt,Lt,Tn=1,Wn=1){const{cwd:Gn}=this.configService.comphubConfig();if(!Dt||!pr.default.existsSync(Dt)||!pr.default.statSync(Dt).isDirectory()){throw new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const rr=yr.default.resolve(Dt,Lt);if(!pr.default.existsSync(rr)||pr.default.statSync(rr).isDirectory()){throw new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,gr.launchIDE)({file:Gn});(0,gr.launchIDE)({file:rr,line:Tn,column:Wn})}revealInExplorer(Dt,Lt){return new Promise(((Tn,Wn)=>{if(!Dt||!pr.default.existsSync(Dt)||!pr.default.statSync(Dt).isDirectory()){Wn(new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist")));return}const Gn=yr.default.resolve(Dt,Lt);if(!pr.default.existsSync(Gn)||pr.default.statSync(Gn).isDirectory()){Wn(new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist")));return}const rr=Or.default.platform();if(rr==="win32"){(0,Er.exec)(`explorer /select,"${Gn}"`,(()=>{Tn(Gn)}))}else{(0,Er.exec)(`open -R "${Gn}"`,(Dt=>{if(Dt){Wn(new cr.httpError.InternalServerErrorError(this.i18nService.translate("local.command.errors.openExplorerFailed",{args:[Dt.message]})));return}Tn(Gn)}))}}))}};Lt.CommandService=Ir;Wn([(0,cr.Inject)(),Gn("design:type",mr.ConfigService)],Ir.prototype,"configService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Object)],Ir.prototype,"ctx",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.MidwayI18nService)],Ir.prototype,"i18nService",void 0);Lt.CommandService=Ir=Wn([(0,cr.Provide)()],Ir)},48795:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CompService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(63366);const Er=Tn(23086);const Or=Tn(85984);const Ir=Tn(80799);const Hr=cr(Tn(70857));const Gr=cr(Tn(10232));const $r=Tn(87518);const mi=Tn(84464);const ki=Tn(95637);const Ni=Tn(26815);const Ri=Tn(18801);const ji=Tn(4990);const Ui=Tn(68255);let Vi=class CompService{getCompFullPath(Dt){const{srcPath:Lt}=this.configService.comphubConfig();Dt=Dt.replace(Ni.KEYS.FILE_MANAGER_DIRNAME,"");const Tn=gr.join(Lt,Dt);return Tn}checkCompEntryIndex(Dt,Lt=Ni.KEYS.COMP_FRAMEWORK_VUE){if(Lt===Ni.KEYS.COMP_FRAMEWORK_REACT){for(const Lt of Ni.KEYS.COMP_USE_ENTRY_FILE_REACT){const Tn=gr.join(Dt,Lt);if(yr.existsSync(Tn)){return Lt}}throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[Ni.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const Tn=gr.join(Dt,Ni.KEYS.COMP_USE_ENTRY_FILE);if(!yr.existsSync(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[Ni.KEYS.COMP_USE_ENTRY_FILE]}))}return Ni.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(Dt){const Lt=this.getCompFullPath(Dt);const Tn=gr.join(Lt,Ni.KEYS.COMP_CONFIG_FILENAME);if(!yr.existsSync(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(Dt){const Lt=Object.keys(Dt);const Tn=Ni.ARRAY.COMP_DEFAULT_FIELD.every((Dt=>!Dt.required||Lt.includes(Dt.name)));if(!Tn)return false;return Ri.versionKit.validateVersion(Dt.version)}async updateCompJson(Dt,Lt){const Tn=this.getCompFullPath(Dt);const Wn=gr.join(Tn,Ni.KEYS.COMP_CONFIG_FILENAME);const Gn=await this.getCompFile(Wn);const rr=Lt(JSON.parse(Gn));await yr.promises.writeFile(Wn,JSON.stringify(rr,null,4))}async readCompVersion(Dt){const Lt=gr.join(Dt,Ni.KEYS.COMP_CONFIG_FILENAME);const Tn=await this.getCompFile(Lt);const Wn=JSON.parse(Tn);return Wn.version}initCompJson(){return Ni.ARRAY.COMP_DEFAULT_FIELD.reduce(((Dt,Lt)=>{const Tn={};if(Lt.required){Tn[Lt.name]=Lt.default}return{...Dt,...Tn}}),{})}async uploadCompFolderToOss({compFullPath:Dt,version:Lt,ossData:Tn}){const{files:Wn}=await $r.fileTree.generateTree(Dt);const Gn=Wn.map((({absolutePath:Lt,size:Tn})=>{const Wn=Lt.replace(Dt,"");return{filePath:Wn,fileFullPath:Lt,size:Tn??0}}));Gn.sort(((Dt,Lt)=>Lt.size-Dt.size));for(let Dt=0;Dt<Gn.length;Dt++){const{filePath:Wn,fileFullPath:rr}=Gn[Dt];const cr=gr.join(Tn.key,Lt,Wn);const pr={...Tn,key:cr.replace(new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g"),"/")};const mr=yr.createReadStream(rr);await this.ossService.uploadFileToOss(pr,mr)}}async uploadPreBuildFilesToOss(Dt){const Lt=Object.values(Dt.entryNameToFile||{});const Tn=Array.from(new Set([...Lt,...Dt.chunkFiles||[]]));if(Tn.length===0)return;const Wn=await ji.remoteApi.v1Oss.osscontrollerPrebuildputpolicy();const Gn=Wn.data;const{cwd:rr}=this.configService.comphubConfig();const cr=gr.join(rr,Ni.KEYS.PREBUILD_MODULE_DIR);for(const Dt of Tn){const Lt=gr.join(cr,Dt);if(!yr.existsSync(Lt)){this.ctx.logger.warn(`预编译产物文件不存在,跳过上传: ${Lt}`);continue}const Tn=yr.createReadStream(Lt);const Wn={...Gn,key:Dt};await this.ossService.uploadFileToOss(Wn,Tn,true)}}async getCompHash(Dt){const Lt=await $r.digest.getFileHashList(Dt);const Tn=Lt.map((Dt=>`${Dt.relativePath}-${Dt.hash}`)).join(";");return $r.digest.getStringHash(Tn)}async getCompFeatures(Dt){const Lt=await $r.digest.getFileHashAndSsdeepList(Dt);const Tn=Lt.map((Dt=>{const Lt=(0,mi.omit)(Dt,["relativePath"]);return{...Lt,path:Dt.relativePath}}));const Wn=await $r.digest.getRelativeDirList(Dt);const Gn=JSON.stringify(Wn);const rr=$r.digest.getStringFuzzyHash(Gn);const cr=await this.getCompHash(Dt);return{fileHashList:Tn,compHash:cr,dirHash:$r.digest.getStringHash(Gn),dirSsdeep:$r.digest.getSsdeepStruct(rr)}}async getCompFileList(Dt){const{files:Lt}=await $r.fileTree.generateTree(Dt,{withStats:true,calculateSize:true});const Tn=Lt.map((({name:Lt,size:Tn,absolutePath:Wn})=>({name:Lt,size:Tn??0,path:Wn.replace(Dt,"").replace(new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g"),"/")})));return Tn}checkCompFileSize(Dt){if(Dt>Ni.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(Ni.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(Dt){if(Dt>Ni.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[Ni.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(Dt){const Lt=Ni.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const Tn=Math.floor(Lt/1024/1024);for(const Wn of Dt){if(Wn.size>Lt){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[Wn.path,Tn.toString()]}))}}}async findCompJsonPath(Dt){const{files:Lt}=await $r.fileTree.generateTree(Dt,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",Lt.length);const Tn=Lt.filter((({absolutePath:Dt})=>Dt.endsWith(Ni.KEYS.COMP_CONFIG_FILENAME)));return Tn}async getAllLocalCompIds(){const{srcPath:Dt}=this.configService.comphubConfig();const Lt=await this.findCompJsonPath(Dt);this.ctx.logger.debug("组件文件数量:",Lt.length);const Tn=Lt.map((async({absolutePath:Dt})=>{const Lt=await yr.promises.readFile(Dt,"utf8");const Tn=JSON.parse(Lt);const Wn=this.checkCompJsonFormat(Tn);const Gn=gr.dirname(Dt);return{compjson:Tn,isCompHub:Wn,compPath:Gn,pathHash:$r.digest.getStringHash(Gn)}}));const Wn=await Promise.all(Tn);return Wn.filter((Dt=>Dt.isCompHub&&Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(Dt){const{srcPath:Lt}=this.configService.comphubConfig();const Tn=gr.join(Dt.replace(Ni.KEYS.FILE_MANAGER_DIRNAME,`${Lt}${gr.sep}`));const{tree:Wn,files:Gn}=await $r.fileTree.generateTree(Tn,{sortBy:"type"});const _handleTree=Dt=>{const Lt={name:Dt.name,path:Dt.absolutePath,type:Dt.type};if(Dt.children&&Dt.children.length>0){Lt.children=Dt.children.map((Dt=>_handleTree(Dt)))}return Lt};return{tree:_handleTree(Wn),files:Gn.map((Dt=>Dt.absolutePath))}}async getCompFile(Dt){const Lt=await yr.promises.readFile(Dt,"utf-8");return Lt}async checkCompConfig(Dt,Lt=Ni.KEYS.COMP_FRAMEWORK_VUE){const Tn=gr.basename(Dt);const Wn=this.getCompFullPath(Dt);let Gn;try{const Dt=this.checkCompEntryIndex(Wn,Lt);Gn=gr.join(Tn,Dt)}catch(Dt){this.ctx.logger.error("检查组件入口文件失败",Dt);return{errorMsg:Dt.message}}try{this.checkCompJson(Dt)}catch(Dt){this.ctx.logger.error("检查组件配置文件comp.json失败",Dt);return{entryIndexPath:Gn,errorMsg:Dt.message}}const rr=gr.join(Tn,Ni.KEYS.COMP_CONFIG_FILENAME);try{const Lt=gr.join(this.getCompFullPath(Dt),Ni.KEYS.COMP_CONFIG_FILENAME);const Tn=await this.getCompFile(Lt);const Wn=this.checkCompJsonFormat(JSON.parse(Tn));if(!Wn){return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(Dt){this.ctx.logger.error("读取组件配置文件comp.json失败",Dt);return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:""}}async updateCompVersion(Dt,Lt){const Tn=Ri.versionKit.validateVersion(Lt);if(!Tn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const Wn=this.getCompFullPath(Dt);const Gn=gr.join(Wn,Ni.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Gn);const cr=JSON.parse(rr);cr.version=Lt;const pr=JSON.stringify(cr,null,2);await yr.promises.writeFile(Gn,pr)}async generateCompJson(Dt){const Lt=this.getCompFullPath(Dt);const Tn=gr.basename(Lt);const Wn=this.initCompJson();Wn.name=Tn;await yr.promises.writeFile(gr.join(Lt,Ni.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(Wn,null,4))}async getCompDep(Dt){const{cwd:Lt}=this.configService.comphubConfig();const Tn=this.getCompFullPath(Dt);const Wn=await this.depsService.getModuleEntry(Tn,Lt);return Wn}async getCompFileHash(Dt){const{compPath:Lt}=Dt;const Tn=this.getCompFullPath(Lt);const Wn=await this.getCompFeatures(Tn);return{compHash:Wn.compHash}}async checkCompRepeat(Dt){const{compPath:Lt,teamId:Tn}=Dt;const Wn=this.getCompFullPath(Lt);const Gn=await this.getCompFeatures(Wn);const rr=await ji.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(Gn,{headers:{"team-id":Tn}});return rr.data}async submitComp(Dt){let Lt="";let Tn={};try{const{compPath:Wn,dep:Gn,previewConfigs:rr,desc:cr,bgColor:pr,name:mr,teamId:gr,tags:yr,framework:Sr}=Dt;Tn={"team-id":gr};this.checkCompJson(Wn);const Er=this.getCompFullPath(Wn);const Or=await this.getCompFeatures(Er);this.checkCompEntryIndex(Er,Sr);const Ir=await this.readCompVersion(Er);const Hr=await this.getCompFileList(Er);const Gr=Hr.reduce(((Dt,Lt)=>Dt+Lt.size),0);this.checkCompFileNum(Hr.length);this.checkCompFileSize(Gr);this.checkCompSingleFileSize(Hr);const $r=await this.getPreBuildInfo(Gn);const mi={name:mr,dep:Gn,previewConfigs:rr,desc:cr,version:Ir,size:Gr,files:Hr,bgColor:pr,compFeatures:Or,tags:yr,preBuildInfo:$r};const ki=await ji.remoteApi.v1Comp.compcontrollerUpload(mi,{headers:Tn});const Ri=ki.data._id;Lt=Ri;await this.updateCompJson(Wn,(Dt=>({...Dt,name:mr,[Ni.KEYS.COMP_FIELD_COMP_ID]:Ri})));const{data:{componentDir:Ui}}=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const Vi=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Ui});const zi={compFullPath:Er,version:Ir,ossData:Vi.data};await this.uploadCompFolderToOss(zi);await this.uploadPreBuildFilesToOss($r);const{key:Ki}=Vi.data;const $i={compId:Ri,objectId:`${Ui}${Ki}`};await ji.remoteApi.v1Comp.compcontrollerUpdateobjectid($i)}catch(Dt){if(Lt){await ji.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:Lt},{headers:Tn})}if(Dt instanceof mr.httpError.BadRequestError){throw new mr.httpError.BadRequestError(Dt)}throw new Error(Dt.message)}}async updateComp(Dt){const{compId:Lt,compPath:Tn,dep:Wn,previewConfigs:Gn,desc:rr,bgColor:cr,name:pr,upgradeDesc:mr,teamId:Sr,tags:Er,framework:Or}=Dt;const Ir=this.getCompFullPath(Tn);const Hr=await this.getCompFeatures(Ir);this.checkCompEntryIndex(Ir,Or);const Gr=await ji.remoteApi.v1Comp.compcontrollerCompdetail({compId:Lt});const{objectId:$r,version:mi}=Gr.data;const ki=await this.readCompVersion(Ir);const Ri=await this.getCompFileList(Ir);const Ui=Ri.reduce(((Dt,Lt)=>Dt+Lt.size),0);this.checkCompFileNum(Ri.length);this.checkCompFileSize(Ui);this.checkCompSingleFileSize(Ri);const Vi=await this.getPreBuildInfo(Wn);const zi={compId:Lt,name:pr,dep:Wn,previewConfigs:Gn,desc:rr,version:ki,size:Ui,files:Ri,bgColor:cr,compFeatures:Hr,upgradeDesc:mr,tags:Er,preBuildInfo:Vi};const Ki=await ji.remoteApi.v1Comp.compcontrollerUpdate(zi,{headers:{"team-id":Sr}});const{isFileChange:$i}=Ki.data;if(!$i&&mi===ki){const Dt=gr.join(Ir,Ni.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(yr.existsSync(Dt)){const Lt=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const Tn=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Lt.data.componentDir});const Wn=$r.replace(Tn.data.dir,"");const Gn=gr.join(Wn,ki,Ni.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const rr=yr.createReadStream(Dt);const cr={...Tn.data,key:Gn};await this.ossService.uploadFileToOss(cr,rr,true)}return}const Xi=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Yi}=Xi.data;const Wo=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Yi});const Ho=$r.replace(Wo.data.dir,"");const Go={...Wo.data,key:Ho};const Xo={compFullPath:Ir,version:ki,ossData:Go};await this.uploadCompFolderToOss(Xo);await this.uploadPreBuildFilesToOss(Vi);await this.updateCompJson(Tn,(Dt=>({...Dt,name:pr,[Ni.KEYS.COMP_FIELD_COMP_ID]:Lt})))}async getPreBuildInfo(Dt){const Lt=await this.moduleService.preBuild(Dt.map((Dt=>Dt.name)));return{entryNameToFile:Lt.entryNameToFile,chunkFiles:Lt.chunkFiles}}async downloadComp(Dt){const{compId:Lt,savePath:Tn,isCover:Wn,compName:Gn,version:rr}=Dt;const{srcPath:cr}=this.configService.comphubConfig();const pr=Ni.KEYS.FILE_MANAGER_DIRNAME;const Sr=Tn.replace(pr,"").replace(/[/\\]/g,gr.sep);const Er=gr.join(cr,Sr,Gn);if(!Wn&&yr.existsSync(Er)){return{isRepeat:true}}const Or=Hr.tmpdir();const Ir=gr.join(Or,Ni.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Ir);const mi=await ji.remoteApi.v1Comp.compcontrollerCompdetail({compId:Lt,version:rr});if(!mi?.data){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:ki,objectId:Ri,name:Ui}=mi.data;let Vi=[];const zi=gr.join(Ir,Ri,rr);if(yr.existsSync(zi)){const{files:Dt}=await $r.fileTree.generateTree(zi);Vi=Dt}await ji.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:Lt,version:rr});if(ki.length===Vi.length){const Dt=Vi.find((({absolutePath:Dt})=>Dt.replace(zi,"").startsWith(`${gr.sep}${Ni.KEYS.COMP_CONFIG_FILENAME}`)));if(Dt){const Lt=await yr.promises.readFile(Dt.absolutePath,"utf8");const Tn=JSON.parse(Lt);const{name:Wn}=Tn;if(Ui===Wn){await Gr.copy(zi,Er);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Ki=ki.map((Dt=>{const Lt=gr.join(Ri,rr,Dt.path);return{path:Lt.replace(/[/\\]/g,"/")}}));const $i=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath($i,Ki,Ir);const Xi=gr.join(Ir,Ri,rr);await Gr.copy(Xi,Er)}async getLocalCompsByIds(Dt){const{srcPath:Lt}=this.configService.comphubConfig();const Tn=await this.findCompJsonPath(Lt);this.ctx.logger.debug("组件文件数量:",Tn.length);const Wn=Tn.map((async({absolutePath:Dt})=>{const Lt=await yr.promises.readFile(Dt,"utf8");const Tn=JSON.parse(Lt);return{...Tn,path:gr.dirname(Dt)}}));const Gn=await Promise.all(Wn);const rr=Gn.filter((Lt=>Dt.includes(Lt[Ni.KEYS.COMP_FIELD_COMP_ID])));if(!rr){return[]}const cr=Ni.KEYS.FILE_MANAGER_DIRNAME;const pr=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const mr=rr.map((Dt=>{const Tn=Dt.path.replace(Lt,"").replace(pr,"/").slice(1);return{id:Dt[Ni.KEYS.COMP_FIELD_COMP_ID],path:cr+Tn,fullPath:Dt.path,fullPathHash:$r.digest.getStringHash(Dt.path),basename:gr.basename(Dt.path)}}));return mr}async getCompFilesOssSignedUrl(Dt){const{version:Lt,objectId:Tn,files:Wn}=Dt;const Gn=await this.ossService.getDownloadSts();const rr=Wn.map((async Dt=>{const Wn=gr.join(Tn,Lt,Dt);const rr=await this.ossService.getFilePreviewUrl(Gn,Wn.replace(/[/\\]/g,"/"));return{path:Dt,signedUrl:rr}}));const cr=await Promise.all(rr);return{signedUrls:cr}}async getPackageJsonContent(){const Dt=this.configService.comphubConfig();const Lt=gr.join(Dt.cwd,"package.json");return await $r.fileSys.readJsonFile(Lt)}async getLocalComps(Dt){const{page:Lt=1,pageSize:Tn=10}=Dt;const{srcPath:Wn}=this.configService.comphubConfig();const Gn=await this.getAllLocalCompIds();const rr=Gn.map((Dt=>({id:Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID],pathHash:Dt.pathHash})));rr.sort(((Dt,Lt)=>Dt.id.localeCompare(Lt.id)));const cr=[...new Set(rr.map((Dt=>Dt.id)))];const pr=await ji.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:cr});const{ids:yr=[]}=pr.data;const Sr=rr.filter((Dt=>yr.includes(Dt.id)));const Er=Sr.length;const Or=Sr.slice((Lt-1)*Tn,Lt*Tn);const Ir=new Map(Gn.map((Dt=>[`${Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID]}_${Dt.pathHash}`,Dt])));const Hr=await ji.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Or.map((Dt=>Dt.id))});const{rows:Gr=[]}=Hr.data;const mi=new Map(Gr.map((Dt=>[Dt._id,Dt])));const ki=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const Ui=Ni.KEYS.FILE_MANAGER_DIRNAME;const Vi=Or.map((async({id:Dt,pathHash:Lt})=>{const Tn=Ir.get(`${Dt}_${Lt}`);const Gn=mi.get(Dt);if(!Gn||!Tn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[Dt]}))}const rr=Tn.compPath.replace(Wn,"").replace(ki,"/").slice(1);return{_id:$r.digest.getStringHash(Tn.compPath),name:Gn.name,compId:Dt,version:Tn.compjson.version,path:Ui+rr,previewConfigs:Gn.previewConfigs,bgColor:Gn.bgColor,fullPath:Tn.compPath}}));const zi=await Promise.all(Vi);return{total:Er,page:Lt,pageSize:Tn,rows:zi}}async getLocalCompDetailByPathHash(Dt){const{fullPathHash:Lt}=Dt;const Tn=await this.getAllLocalCompIds();const Wn=Tn.find((Dt=>Dt.pathHash===Lt));if(!Wn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[Lt]}))}const{srcPath:Gn}=this.configService.comphubConfig();const rr=Wn.compjson[Ni.KEYS.COMP_FIELD_COMP_ID];const{version:cr}=Wn.compjson;const pr=await ji.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[rr]});const{rows:yr=[]}=pr.data;const Sr=yr[0];const Er=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const Or=Ni.KEYS.FILE_MANAGER_DIRNAME;const Ir=Wn.compPath.replace(Gn,"").replace(Er,"/").slice(1);return{_id:Lt,name:Sr.name,compId:rr,version:cr,path:Or+Ir,previewConfigs:Sr.previewConfigs,bgColor:Sr.bgColor,fullPath:Wn.compPath}}async openCompPathInVscode(Dt){const{folderPath:Lt,relativeFilePath:Tn}=Dt;await this.commandService.revealInVSCode(Lt,Tn)}async openCompPathInExplorer(Dt){const{folderPath:Lt,relativeFilePath:Tn}=Dt;await this.commandService.revealInExplorer(Lt,Tn)}async writeCompFile(Dt){const{compPath:Lt,filename:Tn,content:Wn}=Dt;const Gn=this.getCompFullPath(Lt);const rr=gr.join(Gn,Tn);yr.writeFileSync(rr,Buffer.from(Wn,"base64"))}async renameCompDir(Dt){const{compPath:Lt,newName:Tn}=Dt;if(!Ri.textKit.validateCompName(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[Tn]}))}const Wn=this.getCompFullPath(Lt);const Gn=gr.basename(Wn);if(Gn===Tn)return;const rr=gr.dirname(Wn);const cr=gr.join(rr,Tn);if(yr.existsSync(cr)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[Tn]}))}await yr.promises.rename(Wn,cr)}};Lt.CompService=Vi;rr([(0,mr.App)(),pr("design:type",Object)],Vi.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Sr.ConfigService)],Vi.prototype,"configService",void 0);rr([(0,mr.Inject)(),pr("design:type",Ir.OssService)],Vi.prototype,"ossService",void 0);rr([(0,mr.Inject)(),pr("design:type",ki.CommandService)],Vi.prototype,"commandService",void 0);rr([(0,mr.Inject)(),pr("design:type",Er.DepsService)],Vi.prototype,"depsService",void 0);rr([(0,mr.Inject)(),pr("design:type",Or.ModuleService)],Vi.prototype,"moduleService",void 0);rr([(0,mr.Inject)(),pr("design:type",Object)],Vi.prototype,"ctx",void 0);rr([(0,mr.Inject)(),pr("design:type",Ui.MidwayI18nService)],Vi.prototype,"i18nService",void 0);Lt.CompService=Vi=rr([(0,mr.Provide)()],Vi)},63366:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ConfigService=void 0;const mr=Tn(46123);const gr=Tn(26815);const yr=cr(Tn(16928));let Sr=class ConfigService{comphubConfig(){const Dt=this.app.getAttr(gr.KEYS.COMPHUB_CONFIG_KEY);return Dt}getGlobalConfig(){const Dt=this.comphubConfig();const{cwd:Lt,srcPath:Tn,version:Wn,allowDebug:Gn,subPort:rr,projectHash:cr}=Dt;return{cwd:Lt,srcPath:Tn,sep:yr.sep,version:Wn,allowDebug:Gn,subPort:rr,projectHash:cr}}};Lt.ConfigService=Sr;rr([(0,mr.App)(),pr("design:type",Object)],Sr.prototype,"app",void 0);Lt.ConfigService=Sr=rr([(0,mr.Provide)()],Sr)},23086:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DepsService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(64713);const Er=Tn(87518);const Or=Tn(18801);const Ir=Tn(26815);const Hr=Tn(63366);const Gr=Tn(58953);let $r=class DepsService{async getModuleEntry(Dt,Lt){const Tn=await Er.fileSys.readJsonFile(gr.join(Lt,"package.json"));if(!Tn){this.ctx.logger.error("未找到 package.json 文件");return[]}const Wn=Er.resolver.findDependencyVersion(Tn,"vue");const Gn=Er.resolver.findDependencyVersion(Tn,"react");const rr=await Er.depGraph.detectImports(Dt,{pathAliases:["@"]});if(Wn&&Gn){throw new mr.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(Wn){rr.vue={version:Wn}}if(Gn){rr.react={version:Gn};const Dt=Er.resolver.findDependencyVersion(Tn,"react-dom");if(Dt){const Lt=Number(Or.versionKit.getMajorVersion(Gn));if(Lt>=18){rr["react-dom/client"]={version:Dt}}else{rr["react-dom"]={version:Dt}}}}const cr={};for(const[Dt]of Object.entries(rr)){const Wn=Er.resolver.findDependencyVersion(Tn,Dt);const Gn={version:Wn};const rr=await Er.resolver.findOwningPackage(Dt,Lt);if(rr){Gn.version=rr.version;if(!Wn){Gn.parent={name:rr.name,version:rr.version}}}cr[Dt]=Gn}return Object.entries(cr).map((([Dt,Lt])=>({name:Dt,version:Lt.version,...Lt.parent&&{parent:Lt.parent}})))}async buildTemplateCompiler(Dt,Lt,Tn){const Wn=gr.join(Lt,"node_modules","vue-template-compiler","package.json");let Gn;try{const Lt=JSON.parse(await yr.promises.readFile(Wn,"utf-8"));Gn=Lt.version;this.ctx.logger.info(`[buildTemplateCompiler] 找到 vue-template-compiler@${Gn},Vue 版本: ${Dt}`)}catch{throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${Dt}`)}const[rr,cr]=Dt.split(".").map(Number);const[pr,mr]=(Gn||"").split(".").map(Number);if(rr!==pr||cr!==mr){this.ctx.logger.warn(`[buildTemplateCompiler] 版本不完全匹配: vue@${Dt} vs vue-template-compiler@${Gn},`+`建议安装匹配版本: npm install vue-template-compiler@${Dt}`)}const Er=`export * from 'vue-template-compiler';`;const Or=gr.join(Tn,"__compiler_entry__.js");await yr.promises.mkdir(Tn,{recursive:true});await yr.promises.writeFile(Or,Er);const Ir=`vue2-template-compiler-${Dt.replace(/\./g,"_")}.js`;const Hr=gr.join(Tn,Ir);try{await(0,Sr.build)({entryPoints:[Or],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:Hr,platform:"browser",target:"es2015",absWorkingDir:Lt,nodePaths:[gr.join(Lt,"node_modules")],external:[],sourcemap:false,minify:false});this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Ir}`)}catch(Dt){await yr.promises.unlink(Or).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${Dt.message}`)}await yr.promises.unlink(Or).catch((()=>{}));return{fileName:Ir}}async precompileModule(Dt,Lt,Tn){console.log("预编译依赖模块");const Wn=await Er.fileSys.readJsonFile(gr.join(Tn,"package.json"));if(!Wn){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{},chunkFiles:[]}}const{entryPoints:Gn}=(0,Gr.buildEntryPoints)(Lt,Wn,Tn);const{entryPoints:rr,mergedPackages:cr}=(0,Gr.mergeSubPathEntries)(Gn);for(const[,Lt]of Object.entries(cr)){const Tn=(0,Gr.generateMergedWrapper)(Lt.subExportMap);const Wn=gr.join(Dt,`${Lt.entryKey}.js`);rr[Lt.entryKey]=Wn;await yr.promises.mkdir(gr.dirname(Wn),{recursive:true});await yr.promises.writeFile(Wn,Tn)}await yr.promises.mkdir(Dt,{recursive:true});const pr={};for(const[Dt,Lt]of Object.entries(rr)){if(Dt.startsWith("__merged__")||Er.resolver.isModuleInstalled(Dt,Tn)){pr[Dt]=Lt}}const mr={};const Or=gr.join(Dt,Ir.KEYS.META_FILE_NAME);const Hr=await Er.fileSys.readJsonFile(Or);const{filteredEntryPoints:$r,cachedMappings:mi}=(0,Gr.filterCachedModules)(pr,Hr);for(const[,Lt]of Object.entries(cr)){const Tn=Lt.entryKey;if(Hr?.[Tn]){const Wn=Hr[Tn].file;for(const Tn of Lt.wrapperSubPaths){const Gn=Lt.subExportMap[Tn];const rr=(0,Gr.getSubWrapperFileName)(Gn,Wn);const cr=gr.join(Dt,rr);if(!yr.existsSync(cr)){await yr.promises.writeFile(cr,(0,Gr.generateSubWrapper)(Gn,Wn))}mi[Tn]=rr}mi[Tn]=Wn}}Object.assign(mr,mi);if(Object.keys($r).length===0){return{entryNameToFile:mr,chunkFiles:this.resolveChunkFiles(mr,Hr)}}const ki={entryPoints:$r,bundle:true,format:"esm",splitting:true,outdir:Dt,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},loader:{".woff":"file",".woff2":"file",".ttf":"file",".eot":"file",".otf":"file",".svg":"file",".png":"dataurl",".jpg":"dataurl",".jpeg":"dataurl",".gif":"dataurl"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue","react"],absWorkingDir:Tn,nodePaths:[gr.join(Tn,"node_modules")]};const Ni=await(0,Sr.build)(ki);const{optimized:Ri,entryNameToFile:ji}=(0,Gr.analyzeBuildOutputs)(Ni,$r,Dt);for(const[,Lt]of Object.entries(cr)){const Tn=Lt.entryKey;if(!(Tn in $r))continue;const Wn=ji[Tn];if(!Wn)continue;for(const Tn of Lt.wrapperSubPaths){const Gn=Lt.subExportMap[Tn];const rr=(0,Gr.getSubWrapperFileName)(Gn,Wn);const cr=gr.join(Dt,rr);await yr.promises.writeFile(cr,(0,Gr.generateSubWrapper)(Gn,Wn));ji[Tn]=rr}}const Ui={...Hr,...Ri};await(0,Gr.saveBuildMetadata)(Or,Ui);const Vi={...mr,...ji};return{entryNameToFile:Vi,chunkFiles:this.resolveChunkFiles(Vi,Ui)}}resolveChunkFiles(Dt,Lt){const Tn=new Set(Object.values(Dt));const Wn=new Set;for(const[Gn]of Object.entries(Dt)){const Dt=Lt?.[Gn]?.chunkFiles;if(!Dt?.length)continue;for(const Lt of Dt){if(!Tn.has(Lt))Wn.add(Lt)}}return Array.from(Wn)}};Lt.DepsService=$r;rr([(0,mr.App)(),pr("design:type",Object)],$r.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);rr([(0,mr.Inject)(),pr("design:type",Hr.ConfigService)],$r.prototype,"configService",void 0);Lt.DepsService=$r=rr([(0,mr.Provide)()],$r)},85984:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ModuleService=void 0;const mr=Tn(46123);const gr=Tn(63366);const yr=Tn(23086);const Sr=cr(Tn(16928));const Er=Tn(87518);const Or=cr(Tn(79896));const Ir=Tn(26815);let Hr=class ModuleService{async getPreBuildModuleDir(){const{cwd:Dt}=this.configService.comphubConfig();const Lt=Sr.join(Dt,Ir.KEYS.PREBUILD_MODULE_DIR);await Or.promises.mkdir(Lt,{recursive:true});return Lt}async preBuild(Dt){const Lt=await this.getPreBuildModuleDir();const{cwd:Tn}=this.configService.comphubConfig();return await this.depsService.precompileModule(Lt,Dt,Tn)}async buildTemplateCompiler(Dt){const Lt=await this.getPreBuildModuleDir();const{cwd:Tn}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(Dt,Tn,Lt)}async preBuildSize(){const Dt=await this.getPreBuildModuleDir();return await Er.fileSys.dirSize(Dt)}async clearPreBuild(){const Dt=await this.getPreBuildModuleDir();await Or.promises.rm(Dt,{recursive:true,force:true})}};Lt.ModuleService=Hr;rr([(0,mr.Inject)(),pr("design:type",gr.ConfigService)],Hr.prototype,"configService",void 0);rr([(0,mr.Inject)(),pr("design:type",yr.DepsService)],Hr.prototype,"depsService",void 0);rr([(0,mr.App)(),pr("design:type",Object)],Hr.prototype,"app",void 0);Lt.ModuleService=Hr=rr([(0,mr.Provide)()],Hr)},80799:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.OssService=void 0;const gr=Tn(46123);const yr=mr(Tn(54504));const Sr=mr(Tn(12593));const Er=mr(Tn(18451));const Or=cr(Tn(16928));const Ir=cr(Tn(79896));const Hr=Tn(96955);const Gr=Tn(4990);const $r=mr(Tn(26506));const mi=mr(Tn(23046));const ki=Tn(45853);const Ni=Tn(26815);const Ri=Tn(68255);let ji=class OssService{createOssClient(Dt){const Lt={endpoint:Ni.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...Dt};return new Er.default(Lt)}getContentTypeWithCharset(Dt){const Lt=Or.extname(Dt).toLowerCase();const Tn={".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".mjs":"application/javascript; charset=utf-8",".cjs":"application/javascript; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".vue":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".svg":"image/svg+xml; charset=utf-8",".xml":"application/xml; charset=utf-8",".scss":"text/css; charset=utf-8",".sass":"text/css; charset=utf-8",".less":"text/css; charset=utf-8"};return Tn[Lt]}createOssFormData(Dt,Lt,Tn=false){const Wn=new yr.default;const Gn=Dt.dir+Dt.key;Wn.append("success_action_status","200");Wn.append("policy",Dt.policy);Wn.append("x-oss-signature",Dt.signature);Wn.append("x-oss-signature-version",Dt.x_oss_signature_version);Wn.append("x-oss-credential",Dt.x_oss_credential);Wn.append("x-oss-date",Dt.x_oss_date);Wn.append("key",Gn);Wn.append("x-oss-security-token",Dt.security_token);Wn.append("x-oss-forbid-overwrite",Tn?"false":"true");Wn.append("Cache-Control","public, max-age=31536000");const rr={};const cr=Lt.path?.toString();if(cr){const Dt=this.getContentTypeWithCharset(cr);if(Dt){rr.contentType=Dt}}Wn.append("file",Lt,rr);return{host:Dt.host,filePath:Gn,formData:Wn}}async getDownloadSts(){const Dt=await this.cache.get(Ni.KEYS.CACHE_KEY_STS_TOKEN);if(Dt){return Dt}const Lt=await Gr.remoteApi.v1Oss.osscontrollerGetsts();const Tn=new Date(Lt.data.Expiration).getTime()-1*60*1e3;await this.cache.set(Ni.KEYS.CACHE_KEY_STS_EXPIRE_TIME,Tn);const Wn=Tn-Date.now();this.ctx.logger.debug("STS过期时间",(0,mi.default)(Tn).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(Ni.KEYS.CACHE_KEY_STS_TOKEN,Lt.data,Wn);return Lt.data}async uploadFileToOss(Dt,Lt,Tn=false){const{host:Wn,formData:Gn}=this.createOssFormData(Dt,Lt,Tn);const rr=await Sr.default.post(Wn,Gn,{headers:{...Gn.getHeaders()}}).catch((async Dt=>{const Lt=Dt.response.data;const Tn=await(0,ki.parseStringPromise)(Lt);if(Tn?.Error){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Tn.Error.Message]}))}throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Dt.message||Dt]}))}));if(rr.status!==200){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.data]}))}}async downloadFileToPath(Dt,Lt,Tn){const Wn=this.createOssClient({region:Dt.region,accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken,bucket:Dt.bucket,refreshSTSToken:async()=>{const Dt=await this.getDownloadSts();return{accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken}}});const Gn=Lt.map((async Dt=>{const{path:Lt}=Dt;const Gn=Or.join(Tn,Lt);const rr=Or.dirname(Gn);if(!Ir.existsSync(rr)){Ir.mkdirSync(rr,{recursive:true})}return await Wn.get(Lt,Gn)}));return await Promise.all(Gn)}async getFilePreviewUrl(Dt,Lt){const Tn=(0,$r.default)(Lt);const Wn=await this.cache.get(Ni.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const Gn=await this.cache.get(Tn);const rr=Math.floor((Number(Wn)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",rr,"秒",Math.floor(rr/60),"分钟");if(Gn&&rr>0){return Gn}const cr=this.createOssClient({region:Dt.region,accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken,bucket:Dt.bucket,refreshSTSToken:async()=>{const Dt=await this.getDownloadSts();return{accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",rr,"秒",Math.floor(rr/60),"分钟");const pr=cr.signatureUrl(Lt,{expires:rr});await this.cache.set(Tn,pr,rr*1e3);this.ctx.logger.debug("缓存预览URL",Lt);return pr}};Lt.OssService=ji;rr([(0,gr.Inject)(),pr("design:type",Object)],ji.prototype,"ctx",void 0);rr([(0,gr.InjectClient)(Hr.CachingFactory,"default"),pr("design:type",Object)],ji.prototype,"cache",void 0);rr([(0,gr.Inject)(),pr("design:type",Ri.MidwayI18nService)],ji.prototype,"i18nService",void 0);Lt.OssService=ji=rr([(0,gr.Provide)()],ji)},61275:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.QueueService=void 0;const Gn=Tn(46123);let rr=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const Dt=this.queue.shift();if(Dt){await Dt()}this.isProcessing=false;this.processQueue()}async enqueue(Dt){return new Promise((Lt=>{this.queue.push((async()=>{try{await Dt()}finally{Lt()}}));this.processQueue()}))}};Lt.QueueService=rr;Lt.QueueService=rr=Wn([(0,Gn.Provide)(),(0,Gn.Scope)(Gn.ScopeEnum.Singleton)],rr)},19452:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TerminalService=void 0;const gr=Tn(46123);const yr=Tn(35317);const Sr=Tn(63366);const Er=cr(Tn(1999));const Or=Tn(73024);const Ir=Tn(51455);const Hr=Tn(87518);const Gr=mr(Tn(44644));let $r=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(Dt){if(!Dt||Dt.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(Dt);return Er.decode(Dt,"utf-8")}catch{return Er.decode(Dt,"gbk")}}async folderExists(Dt){try{await(0,Ir.access)(Dt,Or.constants.F_OK|Or.constants.R_OK);return true}catch{return false}}async shutdown(Dt=5e3){const Lt=this.subprocess;if(!Lt||Lt.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((Tn=>{let Wn=false;const done=()=>{if(!Wn){Wn=true;Tn(0)}};Lt.once("exit",done);(0,Gr.default)(Lt.pid,"SIGTERM",(Dt=>{if(Dt){this.ctx.emit("output",{err:Dt.message})}}));const Gn=setTimeout((()=>{(0,Gr.default)(Lt.pid,"SIGKILL",(Dt=>{if(Dt){this.ctx.emit("output",{err:Dt.message})}done()}))}),Dt);Lt.once("exit",(()=>clearTimeout(Gn)))}))}async execCmd({cwd:Dt,oldCwd:Lt,command:Tn}){if(!await this.folderExists(Dt)){this.ctx.emit("output",{err:`${Dt} 路径不存在`});this.ctx.emit("output",{cwd:Lt});return}this.cwd=Dt;if(!Tn.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(Tn==="^C"){await this.shutdown();return}this.subprocess=(0,yr.spawn)(Tn,{shell:true,cwd:Dt,stdio:["pipe","pipe","pipe"],detached:false,env:{...process.env,FORCE_COLOR:"3",NPM_CONFIG_COLOR:"always",COLORTERM:"truecolor",TERM:"xterm-256color"}});this.subprocess.stdout?.on("data",(Dt=>{this.ctx.emit("output",{stdout:this.smartDecode(Dt)})}));this.subprocess.stderr?.on("data",(Dt=>{this.ctx.emit("output",{stderr:this.smartDecode(Dt)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:Tn})}));this.subprocess.on("error",(Dt=>{this.ctx.emit("output",{err:Dt.message})}))}async cmdTab({cwd:Dt,lastWord:Lt}){let Tn=await Hr.fileSys.readDirFiles(Dt);if(Lt){Tn=Tn.filter((Dt=>Dt.name.startsWith(Lt)))}if(Tn.length===0){return}this.tabIndex=(this.tabIndex+1)%Tn.length;const Wn=Tn[this.tabIndex];this.ctx.emit("output",{tab:Wn.name})}};Lt.TerminalService=$r;rr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],$r.prototype,"configService",void 0);rr([(0,gr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);Lt.TerminalService=$r=rr([(0,gr.Provide)()],$r)},5808:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VuefinderService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(63366);const Er=cr(Tn(93900));const Or=Tn(26815);let Ir=class VuefinderService{async list({path:Dt}){const Lt=this.configService.comphubConfig();const{srcPath:Tn}=Lt;const Wn=Dt?.replace(Or.KEYS.FILE_MANAGER_DIRNAME,"")||"";let Gn=gr.join(Tn,Wn);const rr=await yr.promises.access(Gn).then((()=>true)).catch((()=>false));if(!rr){Gn=Tn;Dt=Or.KEYS.FILE_MANAGER_DIRNAME}const cr=await yr.promises.readdir(Gn);const pr=cr.map((async Lt=>{const Tn=gr.join(Gn,Lt);const Wn=await yr.promises.stat(Tn);const rr=Wn.isDirectory();const cr=Dt===Or.KEYS.FILE_MANAGER_DIRNAME?`${Dt}${Lt}`:`${Dt}/${Lt}`;return{type:rr?"dir":"file",path:cr,file_size:Wn.size,visibility:"public",last_modified:Math.floor(Wn.mtimeMs/1e3),basename:Lt,extension:rr?"":gr.extname(Lt).slice(1),mime_type:Er.lookup(Lt)||""}}));const mr=await Promise.all(pr);mr.sort(((Dt,Lt)=>{if(Dt.type==="dir"&&Lt.type==="file"){return-1}else if(Dt.type==="file"&&Lt.type==="dir"){return 1}else{return 0}}));return{storages:cr,dirname:Dt,files:mr}}};Lt.VuefinderService=Ir;rr([(0,mr.App)(),pr("design:type",Object)],Ir.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Sr.ConfigService)],Ir.prototype,"configService",void 0);Lt.VuefinderService=Ir=rr([(0,mr.Provide)()],Ir)},66593:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TerminalSocketController=void 0;const rr=Tn(46123);const cr=Tn(19452);let pr=class TerminalSocketController{async onConnection(){this.ctx.logger.debug(`新客户端连接:${this.ctx.id}`)}async onDisConnection(){this.ctx.logger.debug(`客户端断开连接:${this.ctx.id}`);await this.terminalService.shutdown()}async onCommand(Dt){this.terminalService.execCmd(Dt)}async onTab(Dt){this.terminalService.cmdTab(Dt)}};Lt.TerminalSocketController=pr;Wn([(0,rr.Inject)(),Gn("design:type",Object)],pr.prototype,"ctx",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.TerminalService)],pr.prototype,"terminalService",void 0);Wn([(0,rr.OnWSConnection)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"onConnection",null);Wn([(0,rr.OnWSDisConnection)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"onDisConnection",null);Wn([(0,rr.OnWSMessage)("command"),Gn("design:type",Function),Gn("design:paramtypes",[Object]),Gn("design:returntype",Promise)],pr.prototype,"onCommand",null);Wn([(0,rr.OnWSMessage)("tab"),Gn("design:type",Function),Gn("design:paramtypes",[Object]),Gn("design:returntype",Promise)],pr.prototype,"onTab",null);Lt.TerminalSocketController=pr=Wn([(0,rr.WSController)("/terminal")],pr)},58953:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();Object.defineProperty(Lt,"__esModule",{value:true});Lt.analyzeBuildOutputs=analyzeBuildOutputs;Lt.saveBuildMetadata=saveBuildMetadata;Lt.filterCachedModules=filterCachedModules;Lt.buildEntryPoints=buildEntryPoints;Lt.mergeSubPathEntries=mergeSubPathEntries;Lt.generateMergedWrapper=generateMergedWrapper;Lt.generateSubWrapper=generateSubWrapper;Lt.getSubWrapperFileName=getSubWrapperFileName;const cr=rr(Tn(16928));const pr=rr(Tn(79896));const mr=Tn(87518);const gr=Tn(18801);const yr=Tn(26815);function resolveModuleEntry(Dt,Lt){if(Dt!=="vue")return Dt;const Tn=gr.versionKit.getMajorVersion(Lt);return Tn==="3"?yr.KEYS.VUE_ESM_BUNDLER:Dt}function extractModuleName(Dt){const Lt=cr.extname(Dt);const Tn=cr.basename(Dt,Lt);return Tn.replace(/-[A-Za-z0-9_-]{8}$/,"")}function matchEntryKey(Dt,Lt){return Dt.find((Dt=>{const Tn=Dt.split("/");const Wn=Tn[Tn.length-1];return Lt===Wn}))}function analyzeBuildOutputs(Dt,Lt,Tn){const Wn={};const Gn={};const rr=Object.keys(Lt);const gr=Dt.metafile?.outputs??{};const yr=new Set(Object.keys(gr).map((Dt=>cr.basename(Dt))));for(const[Dt,Lt]of Object.entries(gr)){const gr=cr.basename(Dt);if(!Lt.entryPoint)continue;const Sr=extractModuleName(Dt);const Er=matchEntryKey(rr,Sr);if(!Er)continue;Gn[Er]=gr;const Or=cr.join(Tn,gr);const Ir=pr.readFileSync(Or,"utf-8");const Hr=mr.digest.getStringHash(Ir).slice(0,8);Wn[Er]={src:Lt.entryPoint,file:gr,fileHash:Hr,needsInterop:false,chunkFiles:(Lt.imports??[]).map((Dt=>cr.basename(Dt.path))).filter((Dt=>Dt&&yr.has(Dt)&&Dt!==gr))}}return{optimized:Wn,entryNameToFile:Gn}}async function saveBuildMetadata(Dt,Lt){await pr.promises.writeFile(Dt,JSON.stringify(Lt,null,2))}function filterCachedModules(Dt,Lt){if(!Lt){return{filteredEntryPoints:Dt,cachedMappings:{}}}const Tn={};const Wn={};for(const[Gn,rr]of Object.entries(Dt)){if(Lt[Gn]){Wn[Gn]=Lt[Gn].file}else{Tn[Gn]=rr}}return{filteredEntryPoints:Tn,cachedMappings:Wn}}function buildEntryPoints(Dt,Lt,Tn){const Wn={};for(const Gn of Dt){const Dt=mr.resolver.findDependencyVersion(Lt,Gn);if(!Dt){const Dt=mr.resolver.findOwningPackage(Gn,Tn);if(!Dt)continue}Wn[Gn]=resolveModuleEntry(Gn,Dt)}return{entryPoints:Wn}}function extractPackageName(Dt){if(Dt.startsWith("@")){const Lt=Dt.split("/");return Lt.slice(0,2).join("/")}return Dt.split("/")[0]}function toSafeIdentifier(Dt){return Dt.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(Dt){const Lt={};const Tn={};for(const[Wn,Gn]of Object.entries(Dt)){const Dt=extractPackageName(Wn);if(Wn!==Dt){const rr=!/\.(js|ts|jsx|tsx|mjs|cjs)$/.test(Wn);if(rr){Tn[Wn]=Gn;continue}if(!Lt[Dt])Lt[Dt]={};Lt[Dt][Wn]=Gn}else{Tn[Wn]=Gn}}const Wn={};for(const[Dt,Gn]of Object.entries(Lt)){const Lt=Object.keys(Gn);if(Lt.length<=1){Object.assign(Tn,Gn);continue}const rr=mr.digest.getStringHash(Lt.slice().sort().join("|")).slice(0,8);const cr=`__merged__${Dt}-${rr}`;const pr={};const gr=[];for(const Dt of Object.keys(Gn)){const Lt=toSafeIdentifier(Dt);pr[Dt]=Lt;gr.push(Dt)}Tn[cr]=cr;Wn[Dt]={entryKey:cr,subExportMap:pr,wrapperSubPaths:gr}}return{entryPoints:Tn,mergedPackages:Wn}}function generateMergedWrapper(Dt){const Lt=[];const Tn=[];const Wn=[];const Gn=new Set;for(const[rr,cr]of Object.entries(Dt)){if(Gn.has(cr))continue;Gn.add(cr);const Dt=`__imp_${cr}`;Lt.push(`import * as ${Dt} from '${rr}';`);Tn.push(`export const ${cr} = ${Dt}.default || Object.assign({}, ${Dt});`);Wn.push(`export * from '${rr}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...Lt,...Tn,...Wn,""].join("\n")}function generateSubWrapper(Dt,Lt){return[`// Auto-generated: sub-wrapper for ${Dt}`,`export { ${Dt} as default } from './${Lt}';`,`export * from './${Lt}';`,""].join("\n")}function getSubWrapperFileName(Dt,Lt){const Tn=cr.basename(Lt,cr.extname(Lt));return`${Dt}-w-${Tn}.js`}},49969:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getErrorMessage=getErrorMessage;function getErrorMessage(Dt){if(Dt instanceof Error)return Dt.message;if(typeof Dt==="string")return Dt;return String(Dt)}},4145:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.waitForIpcConfig=waitForIpcConfig;const Gn=Wn(Tn(16928));const rr=Tn(26815);function parseCwdArg(Dt){for(let Lt=0;Lt<Dt.length;Lt++){if(Dt[Lt]==="--cwd"&&Lt+1<Dt.length){return Dt[Lt+1]}if(Dt[Lt].startsWith("--cwd=")){return Dt[Lt].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const Dt=parseCwdArg(process.argv);if(Dt){return Promise.resolve({type:"config",port:0,cwd:Gn.default.resolve(Dt),allowDebug:process.env.MIDWAY_SERVER_ENV===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((Dt,Lt)=>{const Tn=setTimeout((()=>{Lt(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(Lt=>{if(Lt?.type==="config"){clearTimeout(Tn);Dt(Lt)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.remoteInstance=Lt.setHeader=void 0;const Gn=Tn(42552);const rr=Tn(26815);const cr=Wn(Tn(65692));const pr=(0,Gn.initInstance)(rr.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new cr.default.Agent({rejectUnauthorized:false})},(Dt=>Dt.replace(rr.KEYS.REMOTE_SERVICE_PREFIX,"")));Lt.remoteInstance=pr;let mr=null;const setHeader=Dt=>{mr=Dt};Lt.setHeader=setHeader;pr.interceptors.request.use((Dt=>{Dt.headers[rr.KEYS.AUTHORIZATION_HEADER_NAME]=mr[rr.KEYS.AUTHORIZATION_HEADER_NAME];Dt.headers[rr.KEYS.CSRF_TOKEN_HEADER_NAME]=mr[rr.KEYS.CSRF_TOKEN_HEADER_NAME];Dt.headers[rr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=mr[rr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];Dt.headers["cookie"]=mr.cookie;return Dt}),(Dt=>Promise.reject(Dt)));pr.interceptors.response.use((async Dt=>{if(Dt.data.code!==0){throw new Error(JSON.stringify(Dt.data))}return Dt.data}),(Dt=>Promise.reject(Dt)))},67872:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.createKoaProxy=createKoaProxy;const Gn=Wn(Tn(58611));const rr=Tn(31855);const cr=new Gn.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const pr=new Map;function getOrCreateSubProxy(Dt,Lt){const Tn=`${Dt}|${JSON.stringify(Lt)}`;if(!pr.has(Tn)){pr.set(Tn,(0,rr.createProxyMiddleware)({target:Dt,changeOrigin:true,secure:false,agent:cr,pathRewrite:Lt,on:{error:Dt=>{}}}))}return pr.get(Tn)}async function createKoaProxy(Dt,Lt,Tn){const Wn=getOrCreateSubProxy(Lt,Tn);return new Promise(((Lt,Tn)=>{Dt.res.on("finish",Lt);Dt.res.on("close",Lt);Dt.res.on("error",Tn);Wn(Dt.req,Dt.res,(Dt=>{if(Dt)Tn(Dt);else Lt()}))}))}},101:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.PackageJsonVO=Lt.LocalCompDetailVO=Lt.LocalCompsVO=Lt.CompFileHashVO=Lt.CompSimilarListVO=Lt.CompFilesOssSignedUrlVO=Lt.DownloadCompVO=Lt.LocalCompsByIdsVO=Lt.ImportScanResultVO=Lt.CompCheckVO=Lt.CompFileContentVO=Lt.CompFileVO=Lt.CompSimilarListItemVO=Lt.FileNode=void 0;const rr=Tn(49179);const cr=Tn(26815);class FileNode{}Lt.FileNode=FileNode;Wn([(0,rr.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),Gn("design:type",String)],FileNode.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],FileNode.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:cr.ENUM.FileType}),Gn("design:type",String)],FileNode.prototype,"type",void 0);Wn([(0,rr.ApiProperty)({description:"子节点",type:[FileNode]}),Gn("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}Lt.CompSimilarListItemVO=CompSimilarListItemVO;Wn([(0,rr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),Gn("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),Gn("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}Lt.CompFileVO=CompFileVO;Wn([(0,rr.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),Gn("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);Wn([(0,rr.ApiProperty)({type:[String],description:"组件文件列表",required:true}),Gn("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}Lt.CompFileContentVO=CompFileContentVO;Wn([(0,rr.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),Gn("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}Lt.CompCheckVO=CompCheckVO;Wn([(0,rr.ApiProperty)({description:"组件入口文件路径",required:false}),Gn("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);Wn([(0,rr.ApiProperty)({description:"组件配置文件路径",required:false}),Gn("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);Wn([(0,rr.ApiProperty)({description:"异常结果内容",required:true}),Gn("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}Wn([(0,rr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),Gn("design:type",String)],ParentVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),Gn("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}Wn([(0,rr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),Gn("design:type",String)],ImportDetailVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),Gn("design:type",String)],ImportDetailVO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),Gn("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}Lt.ImportScanResultVO=ImportScanResultVO;Wn([(0,rr.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),Gn("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}Wn([(0,rr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"id",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"basename",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}Lt.LocalCompsByIdsVO=LocalCompsByIdsVO;Wn([(0,rr.ApiProperty)({type:[CompInfoVO],required:true}),Gn("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}Lt.DownloadCompVO=DownloadCompVO;Wn([(0,rr.ApiProperty)({description:"组件是否重复",example:true,required:true}),Gn("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}Wn([(0,rr.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],SignedUrlItem.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),Gn("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}Lt.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;Wn([(0,rr.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),Gn("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}Lt.CompSimilarListVO=CompSimilarListVO;Wn([(0,rr.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),Gn("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}Lt.CompFileHashVO=CompFileHashVO;Wn([(0,rr.ApiProperty)({example:"123",description:"组件哈希值",required:true}),Gn("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}Wn([(0,rr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),Gn("design:type",String)],PreviewItem.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),Gn("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),Gn("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),Gn("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}Lt.LocalCompsVO=LocalCompsVO;Wn([(0,rr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"compId",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:[PreviewItem],required:true}),Gn("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),Gn("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}Lt.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}Lt.PackageJsonVO=PackageJsonVO;Wn([(0,rr.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),Gn("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BuildTemplateCompilerVO=Lt.PreBuildSizeVO=Lt.PreBuildVO=void 0;const rr=Tn(49179);class PreBuildVO{}Lt.PreBuildVO=PreBuildVO;Wn([(0,rr.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),Gn("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);Wn([(0,rr.ApiProperty)({description:"esbuild code-splitting 生成的公共 chunk 文件列表,上传 OSS 时需要一并上传",required:false,example:["chunk-26KRECMG.js","chunk-3AE7QCN7.js"]}),Gn("design:type",Array)],PreBuildVO.prototype,"chunkFiles",void 0);class PreBuildSizeVO{}Lt.PreBuildSizeVO=PreBuildSizeVO;Wn([(0,rr.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),Gn("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}Lt.BuildTemplateCompilerVO=BuildTemplateCompilerVO;Wn([(0,rr.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名,通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_6_14.js"}),Gn("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},75049:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SignedUrlVO=void 0;const rr=Tn(49179);class SignedUrlVO{}Lt.SignedUrlVO=SignedUrlVO;Wn([(0,rr.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),Gn("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},15798:(Dt,Lt)=>{"use strict";const Tn={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};Lt.parse=function(Dt,...Wn){const Gn=typeof Wn[0]==="object"&&Wn[0];const rr=Wn.length>1||!Gn?Wn[0]:undefined;const cr=Wn.length>1&&Wn[1]||Gn||{};const pr=JSON.parse(Dt,rr);if(cr.protoAction==="ignore"){return pr}if(!pr||typeof pr!=="object"){return pr}if(!Dt.match(Tn.suspectRx)){return pr}Lt.scan(pr,cr);return pr};Lt.scan=function(Dt,Lt={}){let Tn=[Dt];while(Tn.length){const Dt=Tn;Tn=[];for(const Wn of Dt){if(Object.prototype.hasOwnProperty.call(Wn,"__proto__")){if(Lt.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete Wn.__proto__}for(const Dt in Wn){const Lt=Wn[Dt];if(Lt&&typeof Lt==="object"){Tn.push(Wn[Dt])}}}}};Lt.safeParse=function(Dt,Tn){try{return Lt.parse(Dt,Tn)}catch(Dt){return null}}},35522:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(43700);const rr=Tn(66621);const cr=Tn(69322);const pr={};Dt.exports=function(Dt,Lt,Tn={}){Wn(Dt&&typeof Dt==="object","Invalid defaults value: must be an object");Wn(!Lt||Lt===true||typeof Lt==="object","Invalid source value: must be true, falsy or an object");Wn(typeof Tn==="object","Invalid options: must be an object");if(!Lt){return null}if(Tn.shallow){return pr.applyToDefaultsWithShallow(Dt,Lt,Tn)}const cr=Gn(Dt);if(Lt===true){return cr}const mr=Tn.nullOverride!==undefined?Tn.nullOverride:false;return rr(cr,Lt,{nullOverride:mr,mergeArrays:false})};pr.applyToDefaultsWithShallow=function(Dt,Lt,Tn){const mr=Tn.shallow;Wn(Array.isArray(mr),"Invalid keys");const gr=new Map;const yr=Lt===true?null:new Set;for(let Tn of mr){Tn=Array.isArray(Tn)?Tn:Tn.split(".");const Wn=cr(Dt,Tn);if(Wn&&typeof Wn==="object"){gr.set(Wn,yr&&cr(Lt,Tn)||Wn)}else if(yr){yr.add(Tn)}}const Sr=Gn(Dt,{},gr);if(!yr){return Sr}for(const Dt of yr){pr.reachCopy(Sr,Lt,Dt)}const Er=Tn.nullOverride!==undefined?Tn.nullOverride:false;return rr(Sr,Lt,{nullOverride:Er,mergeArrays:false})};pr.reachCopy=function(Dt,Lt,Tn){for(const Dt of Tn){if(!(Dt in Lt)){return}const Tn=Lt[Dt];if(typeof Tn!=="object"||Tn===null){return}Lt=Tn}const Wn=Lt;let Gn=Dt;for(let Dt=0;Dt<Tn.length-1;++Dt){const Lt=Tn[Dt];if(typeof Gn[Lt]!=="object"){Gn[Lt]={}}Gn=Gn[Lt]}Gn[Tn[Tn.length-1]]=Wn}},99583:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(16443);const Gn={};Dt.exports=function(Dt,...Lt){if(Dt){return}if(Lt.length===1&&Lt[0]instanceof Error){throw Lt[0]}throw new Wn(Lt)}},43700:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(69322);const Gn=Tn(99704);const rr=Tn(87492);const cr={needsProtoHack:new Set([Gn.set,Gn.map,Gn.weakSet,Gn.weakMap])};Dt.exports=cr.clone=function(Dt,Lt={},Tn=null){if(typeof Dt!=="object"||Dt===null){return Dt}let Wn=cr.clone;let pr=Tn;if(Lt.shallow){if(Lt.shallow!==true){return cr.cloneWithShallow(Dt,Lt)}Wn=Dt=>Dt}else if(pr){const Lt=pr.get(Dt);if(Lt){return Lt}}else{pr=new Map}const mr=Gn.getInternalProto(Dt);if(mr===Gn.buffer){return Buffer&&Buffer.from(Dt)}if(mr===Gn.date){return new Date(Dt.getTime())}if(mr===Gn.regex){return new RegExp(Dt)}const gr=cr.base(Dt,mr,Lt);if(gr===Dt){return Dt}if(pr){pr.set(Dt,gr)}if(mr===Gn.set){for(const Tn of Dt){gr.add(Wn(Tn,Lt,pr))}}else if(mr===Gn.map){for(const[Tn,Gn]of Dt){gr.set(Tn,Wn(Gn,Lt,pr))}}const yr=rr.keys(Dt,Lt);for(const Tn of yr){if(Tn==="__proto__"){continue}if(mr===Gn.array&&Tn==="length"){gr.length=Dt.length;continue}const rr=Object.getOwnPropertyDescriptor(Dt,Tn);if(rr){if(rr.get||rr.set){Object.defineProperty(gr,Tn,rr)}else if(rr.enumerable){gr[Tn]=Wn(Dt[Tn],Lt,pr)}else{Object.defineProperty(gr,Tn,{enumerable:false,writable:true,configurable:true,value:Wn(Dt[Tn],Lt,pr)})}}else{Object.defineProperty(gr,Tn,{enumerable:true,writable:true,configurable:true,value:Wn(Dt[Tn],Lt,pr)})}}return gr};cr.cloneWithShallow=function(Dt,Lt){const Tn=Lt.shallow;Lt=Object.assign({},Lt);Lt.shallow=false;const Gn=new Map;for(const Lt of Tn){const Tn=Wn(Dt,Lt);if(typeof Tn==="object"||typeof Tn==="function"){Gn.set(Tn,Tn)}}return cr.clone(Dt,Lt,Gn)};cr.base=function(Dt,Lt,Tn){if(Tn.prototype===false){if(cr.needsProtoHack.has(Lt)){return new Lt.constructor}return Lt===Gn.array?[]:{}}const Wn=Object.getPrototypeOf(Dt);if(Wn&&Wn.isImmutable){return Dt}if(Lt===Gn.array){const Dt=[];if(Wn!==Lt){Object.setPrototypeOf(Dt,Wn)}return Dt}if(cr.needsProtoHack.has(Lt)){const Dt=new Wn.constructor;if(Wn!==Lt){Object.setPrototypeOf(Dt,Wn)}return Dt}return Object.create(Wn)}},35879:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99704);const Gn={mismatched:null};Dt.exports=function(Dt,Lt,Tn){Tn=Object.assign({prototype:true},Tn);return!!Gn.isDeepEqual(Dt,Lt,Tn,[])};Gn.isDeepEqual=function(Dt,Lt,Tn,rr){if(Dt===Lt){return Dt!==0||1/Dt===1/Lt}const cr=typeof Dt;if(cr!==typeof Lt){return false}if(Dt===null||Lt===null){return false}if(cr==="function"){if(!Tn.deepFunction||Dt.toString()!==Lt.toString()){return false}}else if(cr!=="object"){return Dt!==Dt&&Lt!==Lt}const pr=Gn.getSharedType(Dt,Lt,!!Tn.prototype);switch(pr){case Wn.buffer:return Buffer&&Buffer.prototype.equals.call(Dt,Lt);case Wn.promise:return Dt===Lt;case Wn.regex:return Dt.toString()===Lt.toString();case Gn.mismatched:return false}for(let Tn=rr.length-1;Tn>=0;--Tn){if(rr[Tn].isSame(Dt,Lt)){return true}}rr.push(new Gn.SeenEntry(Dt,Lt));try{return!!Gn.isDeepEqualObj(pr,Dt,Lt,Tn,rr)}finally{rr.pop()}};Gn.getSharedType=function(Dt,Lt,Tn){if(Tn){if(Object.getPrototypeOf(Dt)!==Object.getPrototypeOf(Lt)){return Gn.mismatched}return Wn.getInternalProto(Dt)}const rr=Wn.getInternalProto(Dt);if(rr!==Wn.getInternalProto(Lt)){return Gn.mismatched}return rr};Gn.valueOf=function(Dt){const Lt=Dt.valueOf;if(Lt===undefined){return Dt}try{return Lt.call(Dt)}catch(Dt){return Dt}};Gn.hasOwnEnumerableProperty=function(Dt,Lt){return Object.prototype.propertyIsEnumerable.call(Dt,Lt)};Gn.isSetSimpleEqual=function(Dt,Lt){for(const Tn of Set.prototype.values.call(Dt)){if(!Set.prototype.has.call(Lt,Tn)){return false}}return true};Gn.isDeepEqualObj=function(Dt,Lt,Tn,rr,cr){const{isDeepEqual:pr,valueOf:mr,hasOwnEnumerableProperty:gr}=Gn;const{keys:yr,getOwnPropertySymbols:Sr}=Object;if(Dt===Wn.array){if(rr.part){for(const Dt of Lt){for(const Lt of Tn){if(pr(Dt,Lt,rr,cr)){return true}}}}else{if(Lt.length!==Tn.length){return false}for(let Dt=0;Dt<Lt.length;++Dt){if(!pr(Lt[Dt],Tn[Dt],rr,cr)){return false}}return true}}else if(Dt===Wn.set){if(Lt.size!==Tn.size){return false}if(!Gn.isSetSimpleEqual(Lt,Tn)){const Dt=new Set(Set.prototype.values.call(Tn));for(const Tn of Set.prototype.values.call(Lt)){if(Dt.delete(Tn)){continue}let Lt=false;for(const Wn of Dt){if(pr(Tn,Wn,rr,cr)){Dt.delete(Wn);Lt=true;break}}if(!Lt){return false}}}}else if(Dt===Wn.map){if(Lt.size!==Tn.size){return false}for(const[Dt,Wn]of Map.prototype.entries.call(Lt)){if(Wn===undefined&&!Map.prototype.has.call(Tn,Dt)){return false}if(!pr(Wn,Map.prototype.get.call(Tn,Dt),rr,cr)){return false}}}else if(Dt===Wn.error){if(Lt.name!==Tn.name||Lt.message!==Tn.message){return false}}const Er=mr(Lt);const Or=mr(Tn);if((Lt!==Er||Tn!==Or)&&!pr(Er,Or,rr,cr)){return false}const Ir=yr(Lt);if(!rr.part&&Ir.length!==yr(Tn).length&&!rr.skip){return false}let Hr=0;for(const Dt of Ir){if(rr.skip&&rr.skip.includes(Dt)){if(Tn[Dt]===undefined){++Hr}continue}if(!gr(Tn,Dt)){return false}if(!pr(Lt[Dt],Tn[Dt],rr,cr)){return false}}if(!rr.part&&Ir.length-Hr!==yr(Tn).length){return false}if(rr.symbols!==false){const Dt=Sr(Lt);const Wn=new Set(Sr(Tn));for(const Gn of Dt){if(!rr.skip||!rr.skip.includes(Gn)){if(gr(Lt,Gn)){if(!gr(Tn,Gn)){return false}if(!pr(Lt[Gn],Tn[Gn],rr,cr)){return false}}else if(gr(Tn,Gn)){return false}}Wn.delete(Gn)}for(const Dt of Wn){if(gr(Tn,Dt)){return false}}}return true};Gn.SeenEntry=class{constructor(Dt,Lt){this.obj=Dt;this.ref=Lt}isSame(Dt,Lt){return this.obj===Dt&&this.ref===Lt}}},16443:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(72912);const Gn={};Dt.exports=class extends Error{constructor(Dt){const Tn=Dt.filter((Dt=>Dt!=="")).map((Dt=>typeof Dt==="string"?Dt:Dt instanceof Error?Dt.message:Wn(Dt)));super(Tn.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,Lt.assert)}}}},57391:Dt=>{"use strict";const Lt={};Dt.exports=function(Dt){if(!Dt){return""}let Tn="";for(let Wn=0;Wn<Dt.length;++Wn){const Gn=Dt.charCodeAt(Wn);if(Lt.isSafe(Gn)){Tn+=Dt[Wn]}else{Tn+=Lt.escapeHtmlChar(Gn)}}return Tn};Lt.escapeHtmlChar=function(Dt){const Tn=Lt.namedHtml.get(Dt);if(Tn){return Tn}if(Dt>=256){return"&#"+Dt+";"}const Wn=Dt.toString(16).padStart(2,"0");return`&#x${Wn};`};Lt.isSafe=function(Dt){return Lt.safeCharCodes.has(Dt)};Lt.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);Lt.safeCharCodes=function(){const Dt=new Set;for(let Lt=32;Lt<123;++Lt){if(Lt>=97||Lt>=65&&Lt<=90||Lt>=48&&Lt<=57||Lt===32||Lt===46||Lt===44||Lt===45||Lt===58||Lt===95){Dt.add(Lt)}}return Dt}()},43935:Dt=>{"use strict";const Lt={};Dt.exports=function(Dt){return Dt.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:Dt=>{"use strict";const Lt={};Dt.exports=function(){}},66621:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(43700);const rr=Tn(87492);const cr={};Dt.exports=cr.merge=function(Dt,Lt,Tn){Wn(Dt&&typeof Dt==="object","Invalid target value: must be an object");Wn(Lt===null||Lt===undefined||typeof Lt==="object","Invalid source value: must be null, undefined, or an object");if(!Lt){return Dt}Tn=Object.assign({nullOverride:true,mergeArrays:true},Tn);if(Array.isArray(Lt)){Wn(Array.isArray(Dt),"Cannot merge array onto an object");if(!Tn.mergeArrays){Dt.length=0}for(let Wn=0;Wn<Lt.length;++Wn){Dt.push(Gn(Lt[Wn],{symbols:Tn.symbols}))}return Dt}const pr=rr.keys(Lt,Tn);for(let Wn=0;Wn<pr.length;++Wn){const rr=pr[Wn];if(rr==="__proto__"||!Object.prototype.propertyIsEnumerable.call(Lt,rr)){continue}const mr=Lt[rr];if(mr&&typeof mr==="object"){if(Dt[rr]===mr){continue}if(!Dt[rr]||typeof Dt[rr]!=="object"||Array.isArray(Dt[rr])!==Array.isArray(mr)||mr instanceof Date||Buffer&&Buffer.isBuffer(mr)||mr instanceof RegExp){Dt[rr]=Gn(mr,{symbols:Tn.symbols})}else{cr.merge(Dt[rr],mr,Tn)}}else{if(mr!==null&&mr!==undefined){Dt[rr]=mr}else if(Tn.nullOverride){Dt[rr]=mr}}}return Dt}},69322:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn={};Dt.exports=function(Dt,Lt,Tn){if(Lt===false||Lt===null||Lt===undefined){return Dt}Tn=Tn||{};if(typeof Tn==="string"){Tn={separator:Tn}}const rr=Array.isArray(Lt);Wn(!rr||!Tn.separator,"Separator option is not valid for array-based chain");const cr=rr?Lt:Lt.split(Tn.separator||".");let pr=Dt;for(let Dt=0;Dt<cr.length;++Dt){let rr=cr[Dt];const mr=Tn.iterables&&Gn.iterables(pr);if(Array.isArray(pr)||mr==="set"){const Dt=Number(rr);if(Number.isInteger(Dt)){rr=Dt<0?pr.length+Dt:Dt}}if(!pr||typeof pr==="function"&&Tn.functions===false||!mr&&pr[rr]===undefined){Wn(!Tn.strict||Dt+1===cr.length,"Missing segment",rr,"in reach path ",Lt);Wn(typeof pr==="object"||Tn.functions===true||typeof pr!=="function","Invalid segment",rr,"in reach path ",Lt);pr=Tn.default;break}if(!mr){pr=pr[rr]}else if(mr==="set"){pr=[...pr][rr]}else{pr=pr.get(rr)}}return pr};Gn.iterables=function(Dt){if(Dt instanceof Set){return"set"}if(Dt instanceof Map){return"map"}}},72912:Dt=>{"use strict";const Lt={};Dt.exports=function(...Dt){try{return JSON.stringify(...Dt)}catch(Dt){return"[Cannot display object: "+Dt.message+"]"}}},99704:(Dt,Lt)=>{"use strict";const Tn={};Lt=Dt.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};Tn.typeMap=new Map([["[object Error]",Lt.error],["[object Map]",Lt.map],["[object Promise]",Lt.promise],["[object Set]",Lt.set],["[object WeakMap]",Lt.weakMap],["[object WeakSet]",Lt.weakSet]]);Lt.getInternalProto=function(Dt){if(Array.isArray(Dt)){return Lt.array}if(Buffer&&Dt instanceof Buffer){return Lt.buffer}if(Dt instanceof Date){return Lt.date}if(Dt instanceof RegExp){return Lt.regex}if(Dt instanceof Error){return Lt.error}const Wn=Object.prototype.toString.call(Dt);return Tn.typeMap.get(Wn)||Lt.generic}},87492:(Dt,Lt)=>{"use strict";const Tn={};Lt.keys=function(Dt,Lt={}){return Lt.symbols!==false?Reflect.ownKeys(Dt):Object.getOwnPropertyNames(Dt)}},75663:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn={};Lt.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(Dt,Lt){Lt=Lt||{};const Tn=[].concat(Lt.before||[]);const Gn=[].concat(Lt.after||[]);const rr=Lt.group||"?";const cr=Lt.sort||0;Wn(!Tn.includes(rr),`Item cannot come before itself: ${rr}`);Wn(!Tn.includes("?"),"Item cannot come before unassociated items");Wn(!Gn.includes(rr),`Item cannot come after itself: ${rr}`);Wn(!Gn.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){const Dt={seq:this._items.length,sort:cr,before:Tn,after:Gn,group:rr,node:Lt};this._items.push(Dt)}if(!Lt.manual){const Dt=this._sort();Wn(Dt,"item",rr!=="?"?`added into group ${rr}`:"","created a dependencies error")}return this.nodes}merge(Dt){if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){if(Lt){for(const Dt of Lt._items){this._items.push(Object.assign({},Dt))}}}this._items.sort(Gn.mergeSort);for(let Dt=0;Dt<this._items.length;++Dt){this._items[Dt].seq=Dt}const Lt=this._sort();Wn(Lt,"merge created a dependencies error");return this.nodes}sort(){const Dt=this._sort();Wn(Dt,"sort created a dependencies error");return this.nodes}_sort(){const Dt={};const Lt=Object.create(null);const Tn=Object.create(null);for(const Wn of this._items){const Gn=Wn.seq;const rr=Wn.group;Tn[rr]=Tn[rr]||[];Tn[rr].push(Gn);Dt[Gn]=Wn.before;for(const Dt of Wn.after){Lt[Dt]=Lt[Dt]||[];Lt[Dt].push(Gn)}}for(const Lt in Dt){const Wn=[];for(const Gn in Dt[Lt]){const rr=Dt[Lt][Gn];Tn[rr]=Tn[rr]||[];Wn.push(...Tn[rr])}Dt[Lt]=Wn}for(const Wn in Lt){if(Tn[Wn]){for(const Gn of Tn[Wn]){Dt[Gn].push(...Lt[Wn])}}}const Wn={};for(const Lt in Dt){const Tn=Dt[Lt];for(const Dt of Tn){Wn[Dt]=Wn[Dt]||[];Wn[Dt].push(Lt)}}const Gn={};const rr=[];for(let Dt=0;Dt<this._items.length;++Dt){let Lt=Dt;if(Wn[Dt]){Lt=null;for(let Dt=0;Dt<this._items.length;++Dt){if(Gn[Dt]===true){continue}if(!Wn[Dt]){Wn[Dt]=[]}const Tn=Wn[Dt].length;let rr=0;for(let Lt=0;Lt<Tn;++Lt){if(Gn[Wn[Dt][Lt]]){++rr}}if(rr===Tn){Lt=Dt;break}}}if(Lt!==null){Gn[Lt]=true;rr.push(Lt)}}if(rr.length!==this._items.length){return false}const cr={};for(const Dt of this._items){cr[Dt.seq]=Dt}this._items=[];this.nodes=[];for(const Dt of rr){const Lt=cr[Dt];this.nodes.push(Lt.node);this._items.push(Lt)}return true}};Gn.mergeSort=(Dt,Lt)=>Dt.sort===Lt.sort?0:Dt.sort<Lt.sort?-1:1},3563:(Dt,Lt,Tn)=>{const{parse:Wn,format:Gn}=Tn(87016);const{pathToRegexp:rr,compile:cr,parse:pr}=Tn(44985);Dt.exports=Layer;function Layer(Dt,Lt,Tn,Wn={}){this.opts=Wn;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(Tn)?Tn:[Tn];for(const Dt of Lt){const Lt=this.methods.push(Dt.toUpperCase());if(this.methods[Lt-1]==="GET")this.methods.unshift("HEAD")}for(let Tn=0;Tn<this.stack.length;Tn++){const Wn=this.stack[Tn];const Gn=typeof Wn;if(Gn!=="function")throw new Error(`${Lt.toString()} \`${this.opts.name||Dt}\`: \`middleware\` must be a function, not \`${Gn}\``)}this.path=Dt;this.regexp=rr(Dt,this.paramNames,this.opts)}Layer.prototype.match=function(Dt){return this.regexp.test(Dt)};Layer.prototype.params=function(Dt,Lt,Tn={}){for(let Dt=Lt.length,Wn=0;Wn<Dt;Wn++){if(this.paramNames[Wn]){const Dt=Lt[Wn];if(Dt&&Dt.length>0)Tn[this.paramNames[Wn].name]=Dt?safeDecodeURIComponent(Dt):Dt}}return Tn};Layer.prototype.captures=function(Dt){return this.opts.ignoreCaptures?[]:Dt.match(this.regexp).slice(1)};Layer.prototype.url=function(Dt,Lt){let Tn=Dt;const rr=this.path.replace(/\(\.\*\)/g,"");if(typeof Dt!=="object"){Tn=Array.prototype.slice.call(arguments);if(typeof Tn[Tn.length-1]==="object"){Lt=Tn[Tn.length-1];Tn=Tn.slice(0,-1)}}const mr=cr(rr,{encode:encodeURIComponent,...Lt});let gr;const yr=pr(rr);let Sr={};if(Array.isArray(Tn)){for(let Dt=yr.length,Lt=0,Wn=0;Lt<Dt;Lt++){if(yr[Lt].name)Sr[yr[Lt].name]=Tn[Wn++]}}else if(yr.some((Dt=>Dt.name))){Sr=Dt}else if(!Lt){Lt=Dt}gr=mr(Sr);if(Lt&&Lt.query){gr=Wn(gr);if(typeof Lt.query==="string"){gr.search=Lt.query}else{gr.search=undefined;gr.query=Lt.query}return Gn(gr)}return gr};Layer.prototype.param=function(Dt,Lt){const{stack:Tn}=this;const Wn=this.paramNames;const middleware=function(Tn,Wn){return Lt.call(this,Tn.params[Dt],Tn,Wn)};middleware.param=Dt;const Gn=Wn.map((function(Dt){return Dt.name}));const rr=Gn.indexOf(Dt);if(rr>-1){Tn.some((function(Dt,Lt){if(!Dt.param||Gn.indexOf(Dt.param)>rr){Tn.splice(Lt,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(Dt){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${Dt}${this.path}`:Dt;this.paramNames=[];this.regexp=rr(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(Dt){try{return decodeURIComponent(Dt)}catch{return Dt}}},53777:(Dt,Lt,Tn)=>{const Wn=Tn(77246);const Gn=Tn(58024);const rr=Tn(93);const{pathToRegexp:cr}=Tn(44985);const pr=Tn(3563);const mr=Tn(26675)("koa-router");Dt.exports=Router;function Router(Dt={}){if(!(this instanceof Router))return new Router(Dt);this.opts=Dt;this.methods=this.opts.methods||["HEAD","OPTIONS","GET","PUT","PATCH","POST","DELETE"];this.exclusive=Boolean(this.opts.exclusive);this.params={};this.stack=[];this.host=this.opts.host}for(const gr of rr){function setMethodVerb(Dt){Router.prototype[Dt]=function(Lt,Tn,Wn){if(typeof Tn==="string"||Tn instanceof RegExp){Wn=Array.prototype.slice.call(arguments,2)}else{Wn=Array.prototype.slice.call(arguments,1);Tn=Lt;Lt=null}if(typeof Tn!=="string"&&!(Tn instanceof RegExp)&&(!Array.isArray(Tn)||Tn.length===0))throw new Error(`You have to provide a path when adding a ${Dt} handler`);this.register(Tn,[Dt],Wn,{name:Lt});return this}}setMethodVerb(gr)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const Dt=this;const Lt=Array.prototype.slice.call(arguments);let Tn;if(Array.isArray(Lt[0])&&typeof Lt[0][0]==="string"){const Gn=Lt[0];for(const rr of Gn){Dt.use.apply(Dt,[rr].concat(Lt.slice(1)))}return this}const Wn=typeof Lt[0]==="string";if(Wn)Tn=Lt.shift();for(const mr of Lt){if(mr.router){const gr=Object.assign(Object.create(Router.prototype),mr.router,{stack:[...mr.router.stack]});for(let yr=0;yr<gr.stack.length;yr++){const Sr=gr.stack[yr];const Er=Object.assign(Object.create(pr.prototype),Sr);if(Tn)Er.setPrefix(Tn);if(Dt.opts.prefix)Er.setPrefix(Dt.opts.prefix);Dt.stack.push(Er);gr.stack[yr]=Er}if(Dt.params){function setRouterParams(Lt){const Tn=Lt;for(const Lt of Tn){gr.param(Lt,Dt.params[Lt])}}setRouterParams(Object.keys(Dt.params))}}else{const Or=[];cr(Dt.opts.prefix||"",Or);const Ir=Dt.opts.prefix&&Or.length;Dt.register(Tn||"([^/]*)",[],mr,{end:false,ignoreCaptures:!Wn&&!Ir})}}return this};Router.prototype.prefix=function(Dt){Dt=Dt.replace(/\/$/,"");this.opts.prefix=Dt;for(let Lt=0;Lt<this.stack.length;Lt++){const Tn=this.stack[Lt];Tn.setPrefix(Dt)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const Dt=this;const Lt=function dispatch(Lt,Tn){mr("%s %s",Lt.method,Lt.path);const Gn=Dt.matchHost(Lt.host);if(!Gn){return Tn()}const rr=Dt.opts.routerPath||Lt.newRouterPath||Lt.path||Lt.routerPath;const cr=Dt.match(rr,Lt.method);let pr;if(Lt.matched){Lt.matched.push.apply(Lt.matched,cr.path)}else{Lt.matched=cr.path}Lt.router=Dt;if(!cr.route)return Tn();const gr=cr.pathAndMethod;const yr=gr[gr.length-1];Lt._matchedRoute=yr.path;if(yr.name){Lt._matchedRouteName=yr.name}pr=(Dt.exclusive?[yr]:gr).reduce((function(Dt,Lt){Dt.push((function(Dt,Tn){Dt.captures=Lt.captures(rr,Dt.captures);Dt.params=Dt.request.params=Lt.params(rr,Dt.captures,Dt.params);Dt.routerPath=Lt.path;Dt.routerName=Lt.name;Dt._matchedRoute=Lt.path;if(Lt.name){Dt._matchedRouteName=Lt.name}return Tn()}));return Dt.concat(Lt.stack)}),[]);return Wn(pr)(Lt,Tn)};Lt.router=this;return Lt};Router.prototype.allowedMethods=function(Dt={}){const Lt=this.methods;return function allowedMethods(Tn,Wn){return Wn().then((function(){const Wn={};if(!Tn.status||Tn.status===404){for(let Dt=0;Dt<Tn.matched.length;Dt++){const Lt=Tn.matched[Dt];for(let Dt=0;Dt<Lt.methods.length;Dt++){const Tn=Lt.methods[Dt];Wn[Tn]=Tn}}const rr=Object.keys(Wn);if(!~Lt.indexOf(Tn.method)){if(Dt.throw){const Lt=typeof Dt.notImplemented==="function"?Dt.notImplemented():new Gn.NotImplemented;throw Lt}else{Tn.status=501;Tn.set("Allow",rr.join(", "))}}else if(rr.length>0){if(Tn.method==="OPTIONS"){Tn.status=200;Tn.body="";Tn.set("Allow",rr.join(", "))}else if(!Wn[Tn.method]){if(Dt.throw){const Lt=typeof Dt.methodNotAllowed==="function"?Dt.methodNotAllowed():new Gn.MethodNotAllowed;throw Lt}else{Tn.status=405;Tn.set("Allow",rr.join(", "))}}}}}))}};Router.prototype.all=function(Dt,Lt,Tn){if(typeof Lt==="string"){Tn=Array.prototype.slice.call(arguments,2)}else{Tn=Array.prototype.slice.call(arguments,1);Lt=Dt;Dt=null}if(typeof Lt!=="string"&&!(Lt instanceof RegExp)&&(!Array.isArray(Lt)||Lt.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(Lt,rr,Tn,{name:Dt});return this};Router.prototype.redirect=function(Dt,Lt,Tn){if(typeof Dt==="symbol"||Dt[0]!=="/"){Dt=this.url(Dt);if(Dt instanceof Error)throw Dt}if(typeof Lt==="symbol"||Lt[0]!=="/"&&!Lt.includes("://")){Lt=this.url(Lt);if(Lt instanceof Error)throw Lt}return this.all(Dt,(Dt=>{Dt.redirect(Lt);Dt.status=Tn||301}))};Router.prototype.register=function(Dt,Lt,Tn,Wn={}){const Gn=this;const{stack:rr}=this;if(Array.isArray(Dt)){for(const rr of Dt){Gn.register.call(Gn,rr,Lt,Tn,Wn)}return this}const cr=new pr(Dt,Lt,Tn,{end:Wn.end===false?Wn.end:true,name:Wn.name,sensitive:Wn.sensitive||this.opts.sensitive||false,strict:Wn.strict||this.opts.strict||false,prefix:Wn.prefix||this.opts.prefix||"",ignoreCaptures:Wn.ignoreCaptures});if(this.opts.prefix){cr.setPrefix(this.opts.prefix)}for(let Dt=0;Dt<Object.keys(this.params).length;Dt++){const Lt=Object.keys(this.params)[Dt];cr.param(Lt,this.params[Lt])}rr.push(cr);mr("defined route %s %s",cr.methods,cr.path);return cr};Router.prototype.route=function(Dt){const Lt=this.stack;for(let Tn=Lt.length,Wn=0;Wn<Tn;Wn++){if(Lt[Wn].name&&Lt[Wn].name===Dt)return Lt[Wn]}return false};Router.prototype.url=function(Dt,Lt){const Tn=this.route(Dt);if(Tn){const Dt=Array.prototype.slice.call(arguments,1);return Tn.url.apply(Tn,Dt)}return new Error(`No route found for name: ${String(Dt)}`)};Router.prototype.match=function(Dt,Lt){const Tn=this.stack;let Wn;const Gn={path:[],pathAndMethod:[],route:false};for(let rr=Tn.length,cr=0;cr<rr;cr++){Wn=Tn[cr];mr("test %s %s",Wn.path,Wn.regexp);if(Wn.match(Dt)){Gn.path.push(Wn);if(Wn.methods.length===0||~Wn.methods.indexOf(Lt)){Gn.pathAndMethod.push(Wn);if(Wn.methods.length>0)Gn.route=true}}}return Gn};Router.prototype.matchHost=function(Dt){const{host:Lt}=this;if(!Lt){return true}if(!Dt){return false}if(typeof Lt==="string"){return Dt===Lt}if(typeof Lt==="object"&&Lt instanceof RegExp){return Lt.test(Dt)}};Router.prototype.param=function(Dt,Lt){this.params[Dt]=Lt;for(let Tn=0;Tn<this.stack.length;Tn++){const Wn=this.stack[Tn];Wn.param(Dt,Lt)}return this};Router.url=function(Dt){const Lt=Array.prototype.slice.call(arguments,1);return pr.prototype.url.apply({path:Dt},Lt)}},86979:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AsyncHooksContextManager=void 0;const Wn=Tn(46123);const Gn=Tn(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=Gn.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var Dt;return(Dt=this._stack[this._stack.length-1])!==null&&Dt!==void 0?Dt:Wn.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){this._enterContext(Dt);try{return Lt.call(Tn,...Wn)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(Dt,Lt){if(Lt==="TIMERWRAP")return;const Tn=this._stack[this._stack.length-1];if(Tn!==undefined){this._contexts.set(Dt,Tn)}}_destroy(Dt){this._contexts.delete(Dt)}_before(Dt){const Lt=this._contexts.get(Dt);if(Lt!==undefined){this._enterContext(Lt)}}_after(){this._exitContext()}_enterContext(Dt){this._stack.push(Dt)}_exitContext(){this._stack.pop()}bind(Dt,Lt){if(typeof Lt==="function"){const Tn=this;const contextWrapper=function(...Wn){return Tn.with(Dt,(()=>Lt.apply(this,Wn)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Lt.length});return contextWrapper}return Lt}}Lt.AsyncHooksContextManager=AsyncHooksContextManager},63259:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AsyncLocalStorageContextManager=void 0;const Wn=Tn(46123);const Gn=Tn(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new Gn.AsyncLocalStorage}active(){var Dt;return(Dt=this._asyncLocalStorage.getStore())!==null&&Dt!==void 0?Dt:Wn.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){const Gn=Tn==null?Lt:Lt.bind(Tn);return this._asyncLocalStorage.run(Dt,Gn,...Wn)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(Dt,Lt){if(typeof Lt==="function"){const Tn=this;const contextWrapper=function(...Wn){return Tn.with(Dt,(()=>Lt.apply(this,Wn)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Lt.length});return contextWrapper}return Lt}}Lt.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.createContextManager=Lt.isSemverGreaterThanOrEqualTo=void 0;Gn(Tn(86979),Lt);Gn(Tn(63259),Lt);var rr=Tn(43349);Object.defineProperty(Lt,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return rr.isSemverGreaterThanOrEqualTo}});Object.defineProperty(Lt,"createContextManager",{enumerable:true,get:function(){return rr.createContextManager}})},43349:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createContextManager=Lt.isSemverGreaterThanOrEqualTo=void 0;const Wn=Tn(63259);const Gn=Tn(86979);const rr=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(Dt,Lt){const Tn=rr.exec(Dt);const Wn=rr.exec(Lt);if(Tn&&Wn){if(Tn[1]===Wn[1]&&Tn[2]===Wn[2]&&Tn[3]===Wn[3]&&Tn[4]===Wn[4]){return true}return gteString(Tn[1],Wn[1])||Tn[1]===Wn[1]&>eString(Tn[2],Wn[2])||Tn[1]===Wn[1]&&Tn[2]===Wn[2]&>eString(Tn[3],Wn[3])||Tn[1]===Wn[1]&&Tn[2]===Wn[2]&&Tn[3]===Wn[3]&>eString(Tn[4],Wn[4])}return false}Lt.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(Dt,Lt){const Tn=parseInt(Dt,10);const Wn=parseInt(Lt,10);return Tn>Wn}function createContextManager(){const Dt=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?Wn.AsyncLocalStorageContextManager:Gn.AsyncHooksContextManager;return new Dt}Lt.createContextManager=createContextManager},26733:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Bootstrap=Lt.BootstrapStarter=void 0;const Wn=Tn(46123);const Gn=Tn(16928);const rr=Tn(51169);const cr=Tn(44101);const pr=Tn(5982);const mr=Tn(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(Dt={}){this.globalOptions=Dt;return this}async init(){this.appDir=this.globalOptions.appDir=this.globalOptions.appDir||process.cwd();this.baseDir=this.globalOptions.baseDir=this.getBaseDir();if(process.env["MIDWAY_FORK_MODE"]){if(process.env["MIDWAY_FORK_MODE"]==="cluster"){this.eventBus=new pr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new pr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const Dt=await(0,Wn.loadModule)((0,Gn.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(Dt===null||Dt===void 0?void 0:Dt.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,Wn.initializeGlobalApplicationContext)({asyncContextManager:(0,cr.createContextManager)(),loggerFactory:rr.loggers,...this.globalOptions});return this.applicationContext}async run(){this.applicationContext=await this.init();if(this.eventBus){await this.eventBus.start();if(process.env["MIDWAY_STICKY_MODE"]==="true"){const Dt=this.applicationContext.get(Wn.MidwayApplicationManager);const Lt=Dt.getApplication("socketIO");(0,mr.setupWorker)(Lt)}}const Dt=this.applicationContext.get(Wn.MidwayFrameworkService);if(!Dt.getMainApp()){throw new Wn.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,Wn.destroyGlobalApplicationContext)(this.applicationContext)}if(this.eventBus){await this.eventBus.stop()}}getApplicationContext(){return this.applicationContext}getBaseDir(){if(this.globalOptions.baseDir){return this.globalOptions.baseDir}if((0,Wn.isTypeScriptEnvironment)()){return(0,Gn.join)(this.appDir,"src")}else{return(0,Gn.join)(this.appDir,"dist")}}}Lt.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(Dt={}){this.configured=true;if(!this.logger&&!Dt.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(Dt.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}Dt.logger=this.logger}else{this.logger=this.logger||Dt.logger}if(Dt.appDir&&Dt.appDir!==process.cwd()){process.chdir(Dt.appDir)}this.getStarter().configure(Dt);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(!this.configured){this.configure()}process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onExit.bind(this));this.uncaughtExceptionHandler=this.uncaughtExceptionHandler.bind(this);process.on("uncaughtException",this.uncaughtExceptionHandler);this.unhandledRejectionHandler=this.unhandledRejectionHandler.bind(this);process.on("unhandledRejection",this.unhandledRejectionHandler);return this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((Dt=>{this.logger.error(Dt);process.exit(1)}))}static async stop(){await this.getStarter().stop();process.removeListener("uncaughtException",this.uncaughtExceptionHandler);process.removeListener("unhandledRejection",this.unhandledRejectionHandler);this.reset();global["MIDWAY_BOOTSTRAP_APP_READY"]=false}static reset(){this.configured=false;this.starter=null;this.bootstrapLoggerFactory.close()}static async onSignal(Dt){this.logger.info("[midway:bootstrap] receive signal %s, closing",Dt);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(Dt){this.logger.error("[midway:bootstrap] close with error: ",Dt);process.exit(1)}}static onExit(Dt){this.logger.info("[midway:bootstrap] exit with code:%s",Dt)}static uncaughtExceptionHandler(Dt){if(!(Dt instanceof Error)){Dt=new Error(String(Dt))}if(Dt.name==="Error"){Dt.name="unhandledExceptionError"}this.logger.error(Dt)}static unhandledRejectionHandler(Dt){if(!(Dt instanceof Error)){const Lt=new Error(String(Dt));if(Dt){if(Dt.name)Lt.name=Dt.name;if(Dt.message)Lt.message=Dt.message;if(Dt.stack)Lt.stack=Dt.stack}Dt=Lt}if(Dt.name==="Error"){Dt.name="unhandledRejectionError"}this.logger.error(Dt)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}Lt.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new rr.MidwayLoggerContainer},84575:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.setupStickyMaster=Lt.AbstractForkManager=Lt.ClusterManager=Lt.BootstrapStarter=Lt.Bootstrap=void 0;Gn(Tn(82516),Lt);var rr=Tn(26733);Object.defineProperty(Lt,"Bootstrap",{enumerable:true,get:function(){return rr.Bootstrap}});Object.defineProperty(Lt,"BootstrapStarter",{enumerable:true,get:function(){return rr.BootstrapStarter}});var cr=Tn(93772);Object.defineProperty(Lt,"ClusterManager",{enumerable:true,get:function(){return cr.ClusterManager}});var pr=Tn(84338);Object.defineProperty(Lt,"AbstractForkManager",{enumerable:true,get:function(){return pr.AbstractForkManager}});var mr=Tn(92364);Object.defineProperty(Lt,"setupStickyMaster",{enumerable:true,get:function(){return mr.setupStickyMaster}})},82516:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},84338:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AbstractForkManager=void 0;const Wn=Tn(70857);const Gn=Tn(39023);const rr=Tn(53599);const cr=Tn(24434);const pr=Tn(39023);const mr=(0,pr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(Dt){this.options=Dt;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new cr.EventEmitter;this.workers=new Map;this.isClosing=false;Dt.count=Dt.count||Wn.cpus().length-1;Dt.refork=Dt.refork!==false;Dt.limit=Dt.limit||60;Dt.duration=Dt.duration||6e4;Dt.logger=Dt.logger||console;Dt.workerInitTimeout=Dt.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:Dt.workerInitTimeout})}async start(){mr("Start manager with options: %j",this.options);this.bindWorkerDisconnect((Dt=>{mr(" - worker(%s): trigger event = disconnect",this.getWorkerId(Dt));const Lt=this.options.logger[Dt["disableRefork"]?"info":"error"];this.disconnectCount++;const Tn=this.isWorkerDead(Dt);if(Tn){mr(" - worker(%s): worker is dead",this.getWorkerId(Dt));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,rr.logDate)(),process.pid,this.getWorkerId(Dt));return}if(Dt["disableRefork"]){mr(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(Dt));Lt("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,rr.logDate)(),process.pid,this.getWorkerId(Dt));return}this.disconnects[this.getWorkerId(Dt)]=(0,rr.logDate)();this.tryToRefork(Dt)}));this.bindWorkerExit(((Dt,Lt,Tn)=>{mr(" - worker(%s): trigger event = exit",this.getWorkerId(Dt));this.workers.delete(this.getWorkerId(Dt));if(Dt["disableRefork"]){return}const Wn=!!this.disconnects[this.getWorkerId(Dt)];mr(" - worker(%s): isExpected=%s",this.getWorkerId(Dt),Wn);if(Wn){delete this.disconnects[this.getWorkerId(Dt)];return}mr(" - worker(%s): isWorkerDead=%s",this.getWorkerId(Dt),this.isWorkerDead(Dt));if(this.isWorkerDead(Dt)){return}mr(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(Dt);this.onUnexpected(Dt,Lt,Tn)}));this.bindClose();this.hub.on("reachReforkLimit",this.onReachReforkLimit.bind(this));setImmediate((()=>{if(process.listeners("uncaughtException").length===0){process.on("uncaughtException",this.onerror.bind(this))}}));for(let Dt=0;Dt<this.options.count;Dt++){const Dt=this.createWorker();mr(" - worker(%s) created",this.getWorkerId(Dt));this.eventBus.addWorker(Dt);this.workers.set(this.getWorkerId(Dt),Dt)}await this.eventBus.start()}tryToRefork(Dt){if(this.allowRefork()){mr(" - worker(%s): allow refork and will fork new",this.getWorkerId(Dt));const Lt=this.createWorker(Dt);this.workers.set(this.getWorkerId(Lt),Lt);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,rr.logDate)(),process.pid,this.getWorkerId(Lt),Lt["state"]);this.eventBus.addWorker(Lt)}else{mr(" - worker(%s): forbidden refork and will stop",this.getWorkerId(Dt));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,rr.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const Dt=this.reforks.push(Date.now());if(Dt>this.options.limit){this.reforks.shift()}const Lt=this.reforks[this.reforks.length-1]-this.reforks[0];const Tn=this.reforks.length<this.options.limit||Lt>this.options.duration;if(!Tn){this.hub.emit("reachReforkLimit")}return Tn}onerror(Dt){if(!Dt){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,rr.logDate)(),process.pid,Dt.stack);this.options.logger.error(Dt);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(Dt,Lt,Tn){const Wn=Dt.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const cr=new Error(Gn.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(Dt),Lt,Tn,Wn,Dt[Wn],Dt["state"]));cr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,rr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,cr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,rr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(Dt,Lt){await this.closeWorker(Dt);await Promise.race([(0,cr.once)(Dt,"exit"),(0,rr.sleep)(Lt)]);if(Dt.killed)return;(Dt.process||Dt).kill("SIGKILL")}async stop(Dt=2e3){mr("run close");this.isClosing=true;await this.eventBus.stop();for(const Lt of this.workers.values()){Lt["disableRefork"]=true;await this.killWorker(Lt,Dt)}if(this.exitListener){await this.exitListener()}}hasWorker(Dt){return this.workers.has(Dt)}getWorker(Dt){return this.workers.get(Dt)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(Dt){this.exitListener=Dt}bindClose(){process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onMasterExit.bind(this))}async onSignal(Dt){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",Dt);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(Dt){this.options.logger.error("[midway:master] close with error: ",Dt);process.exit(1)}}}onMasterExit(Dt){this.options.logger.info("[bootstrap:master] exit with code:%s",Dt)}}Lt.AbstractForkManager=AbstractForkManager},93772:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ClusterManager=void 0;const Wn=Tn(5982);const Gn=Tn(84338);const rr=Tn(29907);const cr=Tn(39023);const pr=Tn(46123);const mr=(0,cr.debuglog)("midway:bootstrap");class ClusterManager extends Gn.AbstractForkManager{constructor(Dt={}){super(Dt);this.options=Dt;Dt.args=Dt.args||[];Dt.execArgv=Dt.execArgv||[];if((0,pr.isTypeScriptEnvironment)()){Dt.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(rr["setupPrimary"]){rr["setupPrimary"](this.options)}else if(rr["setupMaster"]){rr["setupMaster"](this.options)}return rr.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(Dt){mr("Bind cluster.disconnect event");rr.on("disconnect",Dt)}bindWorkerExit(Dt){mr("Bind cluster.exit event");rr.on("exit",Dt)}getWorkerId(Dt){return String(Dt.process.pid)}isWorkerDead(Dt){return Dt.isDead()}closeWorker(Dt){Dt.kill("SIGTERM")}createEventBus(Dt){return new Wn.ChildProcessEventBus(Dt)}isPrimary(){return!rr.isWorker}}Lt.ClusterManager=ClusterManager},92364:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.setupWorker=Lt.setupStickyMaster=void 0;const Wn=Tn(29907);const Gn=Tn(76982);const randomId=()=>(0,Gn.randomBytes)(8).toString("hex");function setupStickyMaster(Dt,Lt={}){const Tn={loadBalancingMethod:"least-connection",...Lt};const Gn=new Map;const rr=/sid=([\w-]{20})/;let cr=0;const computeWorkerId=Dt=>{const Lt=rr.exec(Dt);if(Lt){const Dt=Lt[1];const Tn=Gn.get(Dt);if(Tn&&Wn.workers[Tn]){return Tn}}switch(Tn.loadBalancingMethod){case"random":{const Dt=Object.keys(Wn.workers);return Dt[Math.floor(Math.random()*Dt.length)]}case"round-robin":{const Dt=Object.keys(Wn.workers);cr++;if(cr>=Dt.length){cr=0}return Dt[cr]}case"least-connection":let Dt;for(const Lt in Wn.workers){const Tn=Wn.workers[Lt];if(Dt===undefined){Dt=Tn}else{const Lt=Tn["clientsCount"]||0;const Wn=Dt["clientsCount"]||0;if(Lt<Wn){Dt=Tn}}}return Dt.id}};Dt.on("connection",(Dt=>{let Lt,Tn;const sendCallback=Lt=>{if(Lt){Dt.destroy()}};Dt.on("data",(Gn=>{let rr="utf-8";let cr=Gn.toString(rr);if(Lt&&Tn){Wn.workers[Lt].send({type:"sticky:http-chunk",data:cr,encoding:rr,connectionId:Tn},sendCallback);return}Lt=computeWorkerId(cr);const pr=!(cr.startsWith("GET")||cr.substring(0,cr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(cr.startsWith("POST")&&cr.includes("multipart/form-data")){rr="base64";cr=Gn.toString("base64")}Dt.pause();if(pr){Tn=randomId()}Wn.workers[Lt].send({type:"sticky:connection",data:cr,encoding:rr,connectionId:Tn},Dt,{keepOpen:pr},sendCallback)}))}));Dt.on("request",(Dt=>{Dt.on("data",(()=>{}))}));Wn.on("message",((Dt,{type:Lt,data:Wn})=>{switch(Lt){case"sticky:connection":Gn.set(Wn,Dt.id);if(Tn.loadBalancingMethod==="least-connection"){Dt["clientsCount"]=(Dt["clientsCount"]||0)+1}break;case"sticky:disconnection":Gn.delete(Wn);if(Tn.loadBalancingMethod==="least-connection"){Dt["clientsCount"]--}break}}))}Lt.setupStickyMaster=setupStickyMaster;function setupWorker(Dt){const Lt=new Map;process.on("message",(({type:Tn,data:Wn,encoding:Gn,connectionId:rr},cr)=>{switch(Tn){case"sticky:connection":if(!cr){return}Dt.httpServer.emit("connection",cr);cr.emit("data",Buffer.from(Wn,Gn));cr.resume();if(rr){Lt.set(rr,cr);cr.on("close",(()=>{Lt.delete(rr)}))}break;case"sticky:http-chunk":{const Dt=Lt.get(rr);if(Dt){Dt.emit("data",Buffer.from(Wn,Gn))}}}}));const ignoreError=()=>{};Dt.engine.on("connection",(Dt=>{process.send({type:"sticky:connection",data:Dt.id},ignoreError);Dt.once("close",(()=>{process.send({type:"sticky:disconnection",data:Dt.id},ignoreError)}))}))}Lt.setupWorker=setupWorker},53599:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.sleep=Lt.logDate=void 0;function logDate(){const Dt=new Date;let Lt=Dt.getDate();if(Lt<10){Lt="0"+Lt}let Tn=Dt.getMonth()+1;if(Tn<10){Tn="0"+Tn}let Wn=Dt.getHours();if(Wn<10){Wn="0"+Wn}let Gn=Dt.getMinutes();if(Gn<10){Gn="0"+Gn}let rr=Dt.getSeconds();if(rr<10){rr="0"+rr}let cr=Dt.getMilliseconds();if(cr<10){cr="00"+cr}else if(cr<100){cr="0"+cr}return Dt.getFullYear()+"-"+Tn+"-"+Lt+" "+Wn+":"+Gn+":"+rr+"."+cr}Lt.logDate=logDate;async function sleep(Dt){return new Promise((Lt=>{setTimeout(Lt,Dt)}))}Lt.sleep=sleep},64080:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.multiCaching=Lt.createCache=Lt.caching=void 0;const Wn=Tn(48851);const Gn=Tn(87932);async function caching(Dt,Lt){if(Dt==="memory"){const Dt=(0,Gn.memoryStore)(Lt);return createCache(Dt,Lt)}if(typeof Dt==="function"){const Tn=await Dt(Lt);return createCache(Tn,Lt)}return createCache(Dt,Lt)}Lt.caching=caching;function createCache(Dt,Lt){return{wrap:async(Tn,Gn,rr)=>(0,Wn.coalesceAsync)(Tn,(async()=>{const cr=await Dt.get(Tn);if(cr===undefined){const Lt=await Gn();const Wn=typeof rr==="function"?rr(Lt):rr;await Dt.set(Tn,Lt,Wn);return Lt}else if(Lt===null||Lt===void 0?void 0:Lt.refreshThreshold){const pr=typeof rr==="function"?rr(cr):rr;const mr=await Dt.ttl(Tn);if(mr!==-1&&mr<Lt.refreshThreshold){(0,Wn.coalesceAsync)(`+++${Tn}`,Gn).then((Lt=>Dt.set(Tn,Lt,pr)))}}return cr})),store:Dt,del:Lt=>Dt.del(Lt),get:Lt=>Dt.get(Lt),set:(Lt,Tn,Wn)=>Dt.set(Lt,Tn,Wn),reset:()=>Dt.reset(),methodWrap:async(Tn,Gn,rr,cr)=>(0,Wn.coalesceAsync)(Tn,(async()=>{const pr=await Dt.get(Tn);if(pr===undefined){const Lt=await Gn(...rr);const Wn=typeof cr==="function"?cr(Lt):cr;await Dt.set(Tn,Lt,Wn);return Lt}else if(Lt===null||Lt===void 0?void 0:Lt.refreshThreshold){const mr=typeof cr==="function"?cr(pr):cr;const gr=await Dt.ttl(Tn);if(gr!==-1&&gr<Lt.refreshThreshold){(0,Wn.coalesceAsync)(`+++${Tn}`,(()=>Gn(...rr))).then((Lt=>Dt.set(Tn,Lt,mr)))}}return pr}))}}Lt.createCache=createCache;function multiCaching(Dt){const get=async Lt=>{for(const Tn of Dt){try{const Dt=await Tn.get(Lt);if(Dt!==undefined)return Dt}catch(Dt){}}};const set=async(Lt,Tn,Wn)=>{await Promise.all(Dt.map((Dt=>Dt.set(Lt,Tn,Wn))))};return{get:get,set:set,del:async Lt=>{await Promise.all(Dt.map((Dt=>Dt.del(Lt))))},async wrap(Lt,Tn,Wn){let Gn;let rr=0;for(;rr<Dt.length;rr++){try{Gn=await Dt[rr].get(Lt);if(Gn!==undefined)break}catch(Dt){}}if(Gn===undefined){const Dt=await Tn();const Gn=typeof Wn==="function"?Wn(Dt):Wn;await set(Lt,Dt,Gn);return Dt}else{const cr=typeof Wn==="function"?Wn(Gn):Wn;Promise.all(Dt.slice(0,rr).map((Dt=>Dt.set(Lt,Gn,cr)))).then();Dt[rr].wrap(Lt,Tn,Wn).then()}return Gn},reset:async()=>{await Promise.all(Dt.map((Dt=>Dt.reset())))},mget:async(...Lt)=>{const Tn=new Array(Lt.length).fill(undefined);for(const Wn of Dt){if(Tn.every((Dt=>Dt!==undefined)))break;try{const Dt=await Wn.store.mget(...Lt);Dt.forEach(((Dt,Lt)=>{if(Tn[Lt]===undefined&&Dt!==undefined)Tn[Lt]=Dt}))}catch(Dt){}}return Tn},mset:async(Lt,Tn)=>{await Promise.all(Dt.map((Dt=>Dt.store.mset(Lt,Tn))))},mdel:async(...Lt)=>{await Promise.all(Dt.map((Dt=>Dt.store.mdel(...Lt))))},methodWrap:async(Lt,Tn,Wn,Gn)=>{let rr;let cr=0;for(;cr<Dt.length;cr++){try{rr=await Dt[cr].get(Lt);if(rr!==undefined)break}catch(Dt){}}if(rr===undefined){const Dt=await Tn(...Wn);const rr=typeof Gn==="function"?Gn(Dt):Gn;await set(Lt,Dt,rr);return Dt}else{const pr=typeof Gn==="function"?Gn(rr):Gn;Promise.all(Dt.slice(0,cr).map((Dt=>Dt.set(Lt,rr,pr)))).then();Dt[cr].methodWrap(Lt,Tn,Wn,Gn).then()}return rr}}}Lt.multiCaching=multiCaching},8869:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(64080),Lt);Gn(Tn(87932),Lt);Gn(Tn(91724),Lt)},48851:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.coalesceAsync=void 0;const Tn=new Map;async function coalesceAsync(Dt,Lt){if(!hasKey(Dt)){addKey(Dt);try{const Tn=await Promise.resolve(Lt());coalesce({key:Dt,result:Tn});return Tn}catch(Lt){coalesce({key:Dt,error:Lt});throw Lt}}return enqueue(Dt)}Lt.coalesceAsync=coalesceAsync;function hasKey(Dt){return Tn.has(Dt)}function addKey(Dt){Tn.set(Dt,[])}function removeKey(Dt){Tn.delete(Dt)}function addCallbackToKey(Dt,Lt){const Wn=getCallbacksByKey(Dt);Wn.push(Lt);Tn.set(Dt,Wn)}function getCallbacksByKey(Dt){var Lt;return(Lt=Tn.get(Dt))!==null&&Lt!==void 0?Lt:[]}function enqueue(Dt){return new Promise(((Lt,Tn)=>{const Wn={resolve:Lt,reject:Tn};addCallbackToKey(Dt,Wn)}))}function dequeue(Dt){const Lt=getCallbacksByKey(Dt);removeKey(Dt);return Lt}function coalesce(Dt){const{key:Lt,error:Tn,result:Wn}=Dt;dequeue(Lt).forEach((Dt=>{if(Tn){Dt.reject(Tn)}else{Dt.resolve(Wn)}}))}},87932:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.memoryStore=void 0;const Wn=Tn(57223);const Gn=Tn(19944);function clone(Dt){if(typeof Dt==="object"&&Dt!==null){return Gn(Dt)}return Dt}function memoryStore(Dt){var Lt;const Tn=(Dt===null||Dt===void 0?void 0:Dt.shouldCloneBeforeSet)!==false;const Gn=(Lt=Dt===null||Dt===void 0?void 0:Dt.isCacheable)!==null&&Lt!==void 0?Lt:Dt=>Dt!==undefined;const rr={ttlAutopurge:true,...Dt,max:(Dt===null||Dt===void 0?void 0:Dt.max)||500,ttl:(Dt===null||Dt===void 0?void 0:Dt.ttl)!==undefined?Dt.ttl:0};const cr=new Wn(rr);return{async del(Dt){cr.delete(Dt)},get:async Dt=>cr.get(Dt),keys:async()=>[...cr.keys()],mget:async(...Dt)=>Dt.map((Dt=>cr.get(Dt))),async mset(Dt,Lt){const Wn={ttl:Lt!==undefined?Lt:rr.ttl};for(const[Lt,rr]of Dt){if(!Gn(rr))throw new Error(`no cacheable value ${JSON.stringify(rr)}`);if(Tn)cr.set(Lt,clone(rr),Wn);else cr.set(Lt,rr,Wn)}},async mdel(...Dt){for(const Lt of Dt)cr.delete(Lt)},async reset(){cr.clear()},ttl:async Dt=>cr.getRemainingTTL(Dt),async set(Dt,Lt,Wn){if(!Gn(Lt))throw new Error(`no cacheable value ${JSON.stringify(Lt)}`);if(Tn)Lt=clone(Lt);const pr=Wn!==undefined?Wn:rr.ttl;cr.set(Dt,Lt,{ttl:pr})},get calculatedSize(){return cr.calculatedSize},get size(){return cr.size},dump:()=>cr.dump(),load:(...Dt)=>cr.load(...Dt)}}Lt.memoryStore=memoryStore},91724:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},68805:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CacheConfiguration=Lt.getClassMethodDefaultCacheKey=void 0;const rr=Tn(46123);const cr=Tn(42696);const pr=Tn(91761);function getClassMethodDefaultCacheKey(Dt,Lt){return Dt.name+"-"+(0,rr.getProviderUUId)(Dt)+"-"+Lt}Lt.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let mr=class CacheConfiguration{async onReady(Dt){this.cacheService=await Dt.getAsync(pr.CachingFactory);this.decoratorService.registerMethodHandler(cr.CACHE_DECORATOR_KEY,(({target:Dt,propertyName:Lt,metadata:Tn})=>{if(!Tn.cacheKey){Tn.cacheKey=getClassMethodDefaultCacheKey(Dt,Lt)}return{around:async Dt=>{let Lt=Tn.cacheKey;const Wn=this.cacheService.get(Tn.cacheInstanceName);if(typeof Lt==="function"){Lt=await Lt({methodArgs:Dt.args,ctx:Dt.target[rr.REQUEST_OBJ_CTX_KEY],target:Dt.target})}if(typeof Lt==="string"){return Wn.methodWrap(Lt,Dt.proceed,Dt.args,Tn.ttl)}else{return Dt.proceed(...Dt.args)}}}}))}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayDecoratorService)],mr.prototype,"decoratorService",void 0);mr=Wn([(0,rr.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],mr);Lt.CacheConfiguration=mr},42696:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Caching=Lt.CACHE_DECORATOR_KEY=void 0;const Wn=Tn(46123);Lt.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(Dt,Tn,Gn){if(typeof Tn==="number"){Gn=Tn;Tn=undefined}return(0,Wn.createCustomMethodDecorator)(Lt.CACHE_DECORATOR_KEY,{cacheInstanceName:Dt,cacheKey:Tn,ttl:Gn})}Lt.Caching=Caching},91761:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CachingFactory=void 0;const rr=Tn(46123);const cr=Tn(8869);let pr=class CachingFactory extends rr.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(Dt,Lt){if(Array.isArray(Dt.store)){const Tn=[];for(const Wn of Dt.store){if(typeof Wn==="string"){if(!this.has(Wn)){throw new rr.MidwayCommonError(`cache instance "${Wn}" not found in "${Lt}", please check your configuration.`)}Tn.push(this.get(Wn))}else if(typeof Wn==="function"){Tn.push(await Wn())}else if(Wn["wrap"]){Tn.push(Wn["wrap"])}else if(typeof Wn==="object"){if(typeof Wn.store==="function"){Wn.store=await Wn.store(Wn["options"]||{},this.applicationContext)}if(!Wn.store){throw new rr.MidwayCommonError(`cache instance "${Lt}" store is undefined, please check your configuration.`)}Tn.push(await(0,cr.caching)(Wn.store,Wn["options"]))}else{throw new rr.MidwayCommonError("invalid cache config")}}return await(0,cr.multiCaching)(Tn)}else{if(typeof Dt.store==="function"){Dt.store=await Dt.store(Dt["options"]||{},this.applicationContext)}if(!Dt.store){throw new rr.MidwayCommonError(`cache instance "${Lt}" store is undefined, please check your configuration.`)}return await(0,cr.caching)(Dt.store,Dt["options"])}}getName(){return"cache-manager"}getCaching(Dt){return this.get(Dt)}getMultiCaching(Dt){return this.get(Dt)}};Wn([(0,rr.Config)("cacheManager"),Gn("design:type",Object)],pr.prototype,"cacheManagerConfig",void 0);Wn([(0,rr.ApplicationContext)(),Gn("design:type",Object)],pr.prototype,"applicationContext",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"init",null);pr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],pr);Lt.CachingFactory=pr},96955:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CacheManager=Lt.getClassMethodDefaultCacheKey=Lt.Configuration=void 0;var rr=Tn(68805);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.CacheConfiguration}});Object.defineProperty(Lt,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return rr.getClassMethodDefaultCacheKey}});Gn(Tn(43488),Lt);Gn(Tn(91761),Lt);Gn(Tn(42696),Lt);Lt.CacheManager=Tn(8869);Gn(Tn(93730),Lt)},43488:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},93730:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createRedisStore=void 0;const Wn=Tn(46123);const getVal=Dt=>JSON.stringify(Dt)||'"undefined"';function createRedisStore(Dt){return async(Lt,Tn)=>{const{RedisServiceFactory:Gn}=(0,Wn.safeRequire)("@midwayjs/redis");const rr=await Tn.getAsync(Gn);const cr=rr.get(Dt);return createStore(cr,Lt)}}Lt.createRedisStore=createRedisStore;function createStore(Dt,Lt){const Tn=(Lt===null||Lt===void 0?void 0:Lt.isCacheable)||(Dt=>Dt!==undefined&&Dt!==null);const keys=Lt=>Dt.keys(Lt);return{async get(Lt){const Tn=await Dt.get(Lt);if(Tn===undefined||Tn===null)return undefined;else{try{return JSON.parse(Tn)}catch(Dt){return Tn}}},async set(Gn,rr,cr){if(!Tn(rr))throw new Wn.MidwayCommonError(`"${rr}" is not a cacheable value`);const pr=cr===undefined?Lt===null||Lt===void 0?void 0:Lt.ttl:cr;if(pr!==undefined&&pr!==0)await Dt.set(Gn,getVal(rr),"PX",pr);else await Dt.set(Gn,getVal(rr))},async mset(Gn,rr){const cr=rr===undefined?Lt===null||Lt===void 0?void 0:Lt.ttl:rr;if(cr!==undefined&&cr!==0){const Lt=Dt.multi();for(const[Dt,rr]of Gn){if(!Tn(rr))throw new Wn.MidwayCommonError(`"${getVal(rr)}" is not a cacheable value`);Lt.set(Dt,getVal(rr),"PX",cr)}await Lt.exec()}else await Dt.mset(Gn.flatMap((([Dt,Lt])=>{if(!Tn(Lt))throw new Error(`"${getVal(Lt)}" is not a cacheable value`);return[Dt,getVal(Lt)]})))},mget:(...Lt)=>Dt.mget(Lt).then((Dt=>Dt.map((Dt=>{if(Dt===null||Dt===undefined){return undefined}else{try{return JSON.parse(Dt)}catch(Lt){return Dt}}})))),async mdel(...Lt){await Dt.del(Lt)},async del(Lt){await Dt.del(Lt)},ttl:async Lt=>Dt.pttl(Lt),keys:(Dt="*")=>keys(Dt),reset:()=>{throw new Wn.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:Tn}}},4074:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Cookie=void 0;const Wn=Tn(42613);const Gn=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const rr=/^(?:none|lax|strict)$/i;class Cookie{constructor(Dt,Lt,Tn){Wn(Gn.test(Dt),"argument name is invalid");Wn(!Lt||Gn.test(Lt),"argument value is invalid");this.name=Dt;this.value=Lt||"";this.attrs=mergeDefaultAttrs(Tn);Wn(!this.attrs.path||Gn.test(this.attrs.path),"argument option path is invalid");Wn(!this.attrs.domain||Gn.test(this.attrs.domain),"argument option domain is invalid");Wn(!this.attrs.sameSite||this.attrs.sameSite===true||rr.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!Lt){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let Dt=this.toString();const Lt=this.attrs;if(Lt.path)Dt+="; path="+Lt.path;const Tn=typeof Lt.maxAge==="string"?parseInt(Lt.maxAge,10):Lt.maxAge;if(Tn){Dt+="; max-age="+Math.round(Tn/1e3);Lt.expires=new Date(Date.now()+Tn)}if(Lt.expires)Dt+="; expires="+Lt.expires.toUTCString();if(Lt.domain)Dt+="; domain="+Lt.domain;if(Lt.sameSite)Dt+="; samesite="+(Lt.sameSite===true?"strict":Lt.sameSite.toLowerCase());if(Lt.secure)Dt+="; secure";if(Lt.httpOnly)Dt+="; httponly";if(Lt.priority)Dt+="; priority="+Lt.priority;if(Lt.partitioned)Dt+="; partitioned";return Dt}}Lt.Cookie=Cookie;const cr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(Dt){const Lt={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!Dt)return Lt;for(let Tn=0;Tn<cr.length;Tn++){const Wn=cr[Tn];if(Wn in Dt)Lt[Wn]=Dt[Wn]}return Lt}},11033:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.urlSafeDecode=Lt.urlSafeEncode=Lt.Cookies=void 0;const Wn=Tn(42613);const Gn=Tn(4074);const rr=Tn(5693);const cr=Tn(86054);const pr=Symbol("midwayCookies:keysArray");const mr=Symbol("midwayCookies:keys");const gr=new Map;class Cookies{constructor(Dt,Lt,Tn,Wn){var Gn;this[pr]=Lt?[].concat(Lt):Lt;this._defaultCookieOptions=Tn;this._defaultGetCookieOptions=Wn;this.ctx=Dt;this.secure=(Gn=Tn===null||Tn===void 0?void 0:Tn.secure)!==null&&Gn!==void 0?Gn:this.ctx.secure;this.app=Dt.app}get keys(){if(!this[mr]){const Dt=this[pr];Wn(Array.isArray(Dt),".keys required for encrypt/sign cookies");const Lt=gr.get(Dt);if(Lt){this[mr]=Lt}else{this[mr]=new rr.Keygrip(this[pr]);gr.set(Dt,this[mr])}}return this[mr]}get(Dt,Lt){Lt=Object.assign({},this._defaultGetCookieOptions||{},Lt);const Tn=computeSigned(Lt);const Wn=this.ctx.get("cookie");if(!Wn)return;const Gn=Wn.match(getPattern(Dt));if(!Gn)return;let rr=Gn[1];if(!Lt.encrypt&&!Tn)return rr;if(Tn){const Lt=Dt+".sig";const Tn=this.get(Lt,{signed:false});if(!Tn)return;const Wn=Dt+"="+rr;const Gn=this.keys.verify(Wn,Tn);if(Gn<0){this.set(Lt,null,{path:"/",signed:false});return}if(Gn>0){this.set(Lt,this.keys.sign(Wn),{signed:false})}return rr}rr=urlSafeDecode(rr);const cr=this.keys.decrypt(rr);if(cr===null||cr===void 0?void 0:cr.value){return cr.value.toString()}return undefined}set(Dt,Lt,Tn){if(!Tn&&typeof Lt!=="string"){Tn=Lt;Lt=""}Tn=Object.assign({},this._defaultCookieOptions,Tn);const Wn=computeSigned(Tn);Lt=Lt||"";if(!this.secure&&Tn.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let rr=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(rr))rr=[rr];if(Tn.encrypt){Lt=Lt&&urlSafeEncode(this.keys.encrypt(Lt))}if(Lt.length>4093){this.app.emit("cookieLimitExceed",{name:Dt,value:Lt,ctx:this.ctx})}const cr=this.ctx.get("user-agent");if(Tn.sameSite&&typeof Tn.sameSite==="string"&&Tn.sameSite.toLowerCase()==="none"){if(!this.secure||cr&&!this.isSameSiteNoneCompatible(cr)){Tn.sameSite=false}}if(Tn.partitioned){if(!this.secure||!cr||cr&&!this.isPartitionedCompatible(cr)){Tn.partitioned=false}}if(Tn.partitioned&&Tn.removeUnpartitioned){const Lt=Tn.overwrite;if(Lt){Tn.overwrite=false;rr=ignoreCookiesByName(rr,Dt)}const cr=Object.assign({},Tn,{partitioned:false});const pr=new Gn.Cookie(Dt,"",cr);if(Tn.secure===undefined)pr.attrs.secure=this.secure;rr=pushCookie(rr,pr);if(Wn){pr.name+=".sig";rr=ignoreCookiesByName(rr,pr.name);rr=pushCookie(rr,pr)}}if(Tn.priority){if(!cr||cr&&!this.isPriorityCompatible(cr)){Tn.priority=undefined}}const pr=new Gn.Cookie(Dt,Lt,Tn);if(Tn.secure===undefined)pr.attrs.secure=this.secure;rr=pushCookie(rr,pr);if(Wn){pr.value=Lt&&this.keys.sign(pr.toString());pr.name+=".sig";rr=pushCookie(rr,pr)}this.ctx.set("set-cookie",rr);return this}isSameSiteNoneCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=80}return(0,cr.isSameSiteNoneCompatible)(Dt)}isPartitionedCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=114}return false}parseChromiumAndMajorVersion(Dt){if(!this.uaParseResult){const Lt=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(Dt);if(!Lt)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(Lt[1])}}return this.uaParseResult}isPriorityCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=81}return false}}Lt.Cookies=Cookies;const yr=new Map;function getPattern(Dt){const Lt=yr.get(Dt);if(Lt)return Lt;const Tn=new RegExp("(?:^|;) *"+Dt.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");yr.set(Dt,Tn);return Tn}function computeSigned(Dt){if(Dt.encrypt)return false;return Dt.signed!==false}function pushCookie(Dt,Lt){if(Lt.attrs.overwrite){Dt=ignoreCookiesByName(Dt,Lt.name)}Dt.push(Lt.toHeader());return Dt}function ignoreCookiesByName(Dt,Lt){const Tn=`${Lt}=`;return Dt.filter((Dt=>!Dt.startsWith(Tn)))}function urlSafeEncode(Dt){return Dt.replace(/\+/g,"-").replace(/\//g,"_")}Lt.urlSafeEncode=urlSafeEncode;function urlSafeDecode(Dt){return Dt.replace(/-/g,"+").replace(/_/g,"/")}Lt.urlSafeDecode=urlSafeDecode},60990:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(33249),Lt);Gn(Tn(11033),Lt)},33249:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},5693:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Keygrip=void 0;const Wn=Tn(42613);const Gn=Tn(39023);const rr=Tn(76982);const cr=Tn(48978);const pr=(0,Gn.debuglog)("midway:cookies");const mr={"/":"_","+":"-","=":""};class Keygrip{constructor(Dt){Wn(Array.isArray(Dt)&&Dt.length,"keys must be provided and should be an array");this.keys=Dt;this.hash="sha256"}encrypt(Dt,Lt){Lt=Lt||this.keys[0];try{Dt=String(Dt);const Tn=getAlgorithm();const Wn=(0,rr.randomBytes)(64);const Gn=(0,rr.randomBytes)(16);const cr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const pr=deriveKeyFromPassword(Lt,Wn,Math.floor(cr*.47+1337));const mr=(0,rr.createCipheriv)(Tn,pr,Gn);const gr=Buffer.concat([mr.update(Dt,"utf8"),mr.final()]);const yr=mr.getAuthTag();const Sr=Buffer.concat([Wn,Gn,yr,Buffer.from(cr.toString()),gr]).toString("hex");return getEncryptedPrefix()+Sr}catch(Dt){pr("crypt error",Dt.stack);return undefined}}decrypt(Dt,Lt){if(!Lt){const Lt=this.keys;for(let Tn=0;Tn<Lt.length;Tn++){const Wn=this.decrypt(Dt,Lt[Tn]);if(Wn!==false)return{value:Wn,index:Tn}}return false}try{const Tn=getAlgorithm();const Wn=Dt.split(getEncryptedPrefix());if(Wn.length!==2){return void 0}else{Dt=Wn[1]}const Gn=Buffer.from(Dt,"hex");const cr=Gn.slice(0,64);const pr=Gn.slice(64,80);const mr=Gn.slice(80,96);const gr=parseInt(Gn.slice(96,101).toString("utf-8"),10);const yr=Gn.slice(101);const Sr=deriveKeyFromPassword(Lt,cr,Math.floor(gr*.47+1337));const Er=(0,rr.createDecipheriv)(Tn,Sr,pr);Er.setAuthTag(mr);return Er.update(yr,"binary","utf-8")+Er.final("utf-8")}catch(Dt){pr("crypt error",Dt.stack);return false}}sign(Dt,Lt){Lt=Lt||this.keys[0];return(0,rr.createHmac)(this.hash,Lt).update(Dt).digest("base64").replace(/\/|\+|=/g,(Dt=>mr[Dt]))}verify(Dt,Lt){const Tn=this.keys;for(let Wn=0;Wn<Tn.length;Wn++){if(cr(Buffer.from(Lt),Buffer.from(this.sign(Dt,Tn[Wn])))){pr("data %s match key %s",Dt,Tn[Wn]);return Wn}}return-1}}Lt.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(Dt,Lt,Tn){return(0,rr.pbkdf2Sync)(Dt,Lt,Tn,32,"sha512")}},83872:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BaseFramework=void 0;const rr=Tn(6192);const cr=Tn(2222);const pr=Tn(49757);const mr=Tn(97983);const gr=Tn(70275);const yr=Tn(78842);const Sr=Tn(37482);const Er=Tn(34888);const Or=Tn(12738);const Ir=Tn(68220);const Hr=Tn(39408);const Gr=Tn(77306);const $r=Tn(39023);const mi=Tn(75351);const ki=Tn(40581);const Ni=$r.debuglog("midway:debug");class BaseFramework{constructor(Dt){this.applicationContext=Dt;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var Dt,Lt;this.configurationOptions=(Dt=this.configure())!==null&&Dt!==void 0?Dt:{};this.contextLoggerApplyLogger=(Lt=this.configurationOptions.contextLoggerApplyLogger)!==null&&Lt!==void 0?Lt:"appLogger";this.contextLoggerFormat=this.configurationOptions.contextLoggerFormat;this.logger=this.loggerService.getLogger("coreLogger");this.appLogger=this.loggerService.getLogger("appLogger");return this}isEnable(){return true}async initialize(Dt){this.bootstrapOptions=Dt;await this.beforeContainerInitialize(Dt);await this.containerInitialize(Dt);await this.afterContainerInitialize(Dt);await this.containerDirectoryLoad(Dt);await this.afterContainerDirectoryLoad(Dt);await this.applicationInitialize(Dt);await this.containerReady(Dt);await this.afterContainerReady(Dt);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(Dt){}async containerDirectoryLoad(Dt){}async containerReady(Dt){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(Dt){return this.configService.getConfiguration(Dt)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(Dt,Lt){if(Lt&&Lt!=="appLogger"){const Tn=this.getLogger(Lt);let Wn=Dt.getAttr(cr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!Wn){Wn=new Map;Dt.setAttr(cr.REQUEST_CTX_LOGGER_CACHE_KEY,Wn)}if(Wn.has(Lt)){return Wn.get(Lt)}const Gn=this.loggerService.createContextLogger(Dt,Tn);Wn.set(Lt,Gn);return Gn}else{const Tn=this.getLogger(Lt!==null&&Lt!==void 0?Lt:this.contextLoggerApplyLogger);if(Dt["_logger"]){return Dt["_logger"]}Dt["_logger"]=this.loggerService.createContextLogger(Dt,Tn,{contextFormat:this.contextLoggerFormat});return Dt["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(Dt={},Lt=[]){const Tn={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:Dt=>this.getConfiguration(Dt),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>rr.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:Dt=>this.getLogger(Dt),createLogger:(Dt,Lt={})=>this.createLogger(Dt,Lt),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:Dt=>{const Lt=Dt||Object.create(this.defaultContext);if(!Lt.startTime){Lt.startTime=Date.now()}if(!Lt.logger){Lt.logger=this.createContextLogger(Lt)}if(!Lt.requestContext){Lt.requestContext=new mr.MidwayRequestContainer(Lt,this.getApplicationContext());Lt.requestContext.ready()}if(!Lt.getLogger){Lt.getLogger=Dt=>this.createContextLogger(Lt,Dt)}Lt.setAttr=(Dt,Tn)=>{Lt.requestContext.setAttr(Dt,Tn)};Lt.getAttr=Dt=>Lt.requestContext.getAttr(Dt);Lt.getApp=()=>this.getApplication();return Lt},addConfigObject:Dt=>{this.configService.addObject(Dt)},setAttr:(Dt,Lt)=>{this.getApplicationContext().setAttr(Dt,Lt)},getAttr:Dt=>this.getApplicationContext().getAttr(Dt),useMiddleware:Dt=>this.useMiddleware(Dt),getMiddleware:()=>this.getMiddleware(),useFilter:Dt=>this.useFilter(Dt),useGuard:Dt=>this.useGuard(Dt),getNamespace:()=>this.getNamespace()};for(const Dt of Lt){delete Tn[Dt]}Object.assign(this.app,Tn,Dt)}async beforeStop(){}async beforeContainerInitialize(Dt){}async afterContainerInitialize(Dt){}async afterContainerDirectoryLoad(Dt){}async afterContainerReady(Dt){}async applyMiddleware(Dt){var Lt;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(cr.ASYNC_CONTEXT_MANAGER_KEY)){const Dt=this.configService.getConfiguration("asyncContextManager.enable")||false;const Tn=Dt?((Lt=this.bootstrapOptions)===null||Lt===void 0?void 0:Lt.asyncContextManager)||new mi.NoopContextManager:new mi.NoopContextManager;if(Dt){Tn.enable()}this.applicationContext.registerObject(cr.ASYNC_CONTEXT_MANAGER_KEY,Tn)}this.middlewareManager.insertFirst((async(Dt,Lt)=>{const Tn=mi.ASYNC_ROOT_CONTEXT.setValue(cr.ASYNC_CONTEXT_KEY,Dt);const Wn=this.applicationContext.get(cr.ASYNC_CONTEXT_MANAGER_KEY);return await Wn.with(Tn,(async()=>{await this.mockService.runSimulatorContextSetup(Dt,this.app);this.mockService.applyContextMocks(this.app,Dt);let Tn=undefined;try{const Wn=await Lt();Tn=await this.filterManager.runResultFilter(Wn,Dt)}catch(Lt){Tn=await this.filterManager.runErrorFilter(Lt,Dt)}finally{await this.mockService.runSimulatorContextTearDown(Dt,this.app)}if(Tn.error){throw Tn.error}return Tn.result}))}));Ni(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(Dt){Dt=Array.isArray(Dt)?Dt:[Dt];return await this.middlewareService.compose([this.composeMiddleware,...Dt],this.app)}return this.composeMiddleware}getLogger(Dt){var Lt;return(Lt=this.loggerService.getLogger(Dt))!==null&&Lt!==void 0?Lt:this.appLogger}getCoreLogger(){return this.logger}createLogger(Dt,Lt={}){return this.loggerService.createLogger(Dt,Lt)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(Dt){this.middlewareManager.insertLast(Dt)}getMiddleware(){return this.middlewareManager}useFilter(Dt){return this.filterManager.useFilter(Dt)}useGuard(Dt){return this.guardManager.addGlobalGuard(Dt)}async runGuard(Dt,Lt,Tn){return this.guardManager.runGuard(Dt,Lt,Tn)}createMiddlewareManager(){return new Or.ContextMiddlewareManager}createFilterManager(){return new Hr.FilterManager}createGuardManager(){return new ki.GuardManager}setNamespace(Dt){this.namespace=Dt}getNamespace(){return this.namespace}}Wn([(0,pr.Inject)(),Gn("design:type",Er.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",gr.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",yr.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Sr.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Ir.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Gr.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);Wn([(0,pr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],BaseFramework.prototype,"init",null);Lt.BaseFramework=BaseFramework},43436:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayApplicationManager=void 0;const Gn=Tn(6192);const rr=Tn(49757);let cr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(Dt,Lt){this.globalFrameworkMap.set(Dt,Lt);if(Lt["getFrameworkType"]){this.globalFrameworkTypeMap.set(Lt["getFrameworkType"](),Lt)}}getFramework(Dt){if(typeof Dt==="string"){if(this.globalFrameworkMap.has(Dt)){return this.globalFrameworkMap.get(Dt)}}else{if(this.globalFrameworkTypeMap.has(Dt)){return this.globalFrameworkTypeMap.get(Dt)}}}getApplication(Dt){if(typeof Dt==="string"){if(this.globalFrameworkMap.has(Dt)){return this.globalFrameworkMap.get(Dt).getApplication()}}else{if(this.globalFrameworkTypeMap.has(Dt)){return this.globalFrameworkTypeMap.get(Dt).getApplication()}}}getApplications(Dt){if(!Dt){return Array.from(this.globalFrameworkMap.values()).map((Dt=>Dt.getApplication())).filter((Dt=>!!Dt))}else{return Dt.map((Dt=>this.getApplication(Dt))).filter((Dt=>!!Dt))}}};cr=Wn([(0,rr.Provide)(),(0,rr.Scope)(Gn.ScopeEnum.Singleton)],cr);Lt.MidwayApplicationManager=cr},75351:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.NoopContextManager=Lt.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(Dt){const Lt=this;Lt._currentContext=Dt?new Map(Dt):new Map;Lt.getValue=Dt=>Lt._currentContext.get(Dt);Lt.setValue=(Dt,Tn)=>{const Wn=new AsyncBaseContext(Lt._currentContext);Wn._currentContext.set(Dt,Tn);return Wn};Lt.deleteValue=Dt=>{const Tn=new AsyncBaseContext(Lt._currentContext);Tn._currentContext.delete(Dt);return Tn}}}Lt.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return Lt.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){return Lt.call(Tn,...Wn)}bind(Dt,Lt){return Lt}enable(){return this}disable(){return this}}Lt.NoopContextManager=NoopContextManager},46673:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DataListener=void 0;const rr=Tn(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(Dt){this.innerData=Dt}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],DataListener.prototype,"init",null);Wn([(0,rr.Destroy)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],DataListener.prototype,"stop",null);Lt.DataListener=DataListener},12849:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.globModels=Lt.formatGlobString=Lt.DataSourceManager=void 0;const rr=Tn(83486);const cr=Tn(86314);const pr=Tn(62525);const mr=Tn(16928);const gr=Tn(63289);const yr=Tn(2222);const Sr=Tn(39023);const Er=Tn(65308);const Or=Tn(49757);const Ir=Tn(70275);const Hr=Tn(78842);const Gr=Tn(67934);const $r=(0,Sr.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(Dt,Lt){var Tn,Wn;this.options=Dt;if(!this.options.dataSource){throw new cr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof Lt==="string"){Lt={baseDir:Lt,entitiesConfigKey:"entities"}}const Gn=Lt;const rr=(Wn=(Tn=this.configService)===null||Tn===void 0?void 0:Tn.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&Wn!==void 0?Wn:false;const processDataSource=async Lt=>{var Tn;const Wn=Dt.dataSource[Lt];const rr=Wn[Gn.entitiesConfigKey];if(rr){const Dt=new Set;for(const Wn of rr){if(typeof Wn==="string"){const rr=await globModels(Wn,Gn.baseDir,(Tn=this.environmentService)===null||Tn===void 0?void 0:Tn.getModuleLoadType());for(const Tn of rr){Dt.add(Tn);this.modelMapping.set(Tn,Lt)}}else{Dt.add(Wn);this.modelMapping.set(Wn,Lt)}}Wn[Gn.entitiesConfigKey]=Array.from(Dt);$r(`[core]: DataManager load ${Wn[Gn.entitiesConfigKey].length} models from ${Lt}.`)}const cr={cacheInstance:Dt.cacheInstance,validateConnection:Dt.validateConnection};await this.createInstance(Wn,Lt,cr)};const pr=Object.keys(Dt.dataSource);if(rr){await Promise.all(pr.map(processDataSource))}else{for(const Dt of pr){await processDataSource(Dt)}}}getDataSource(Dt){return this.dataSource.get(Dt)}hasDataSource(Dt){return this.dataSource.has(Dt)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(Dt){const Lt=this.getDataSource(Dt);return Lt?this.checkConnected(Lt):false}async createInstance(Dt,Lt,Tn){const Wn=Tn&&typeof Tn.cacheInstance==="boolean"?Tn.cacheInstance:true;const Gn=Tn&&Tn.validateConnection||false;const pr=(0,rr.extend)(true,{},this.options["default"],Dt);const mr=await this.createDataSource(pr,Lt);if(Wn&&Lt&&mr){this.dataSource.set(Lt,mr)}if(Gn){if(!mr){throw new cr.MidwayCommonError(`[DataSourceManager] ${Lt} initialization failed.`)}const Dt=await this.checkConnected(mr);if(!Dt){throw new cr.MidwayCommonError(`[DataSourceManager] ${Lt} is not connected.`)}}return mr}getDataSourceNameByModel(Dt){return this.modelMapping.get(Dt)}async stop(){const Dt=Array.from(this.dataSource.values());await Promise.all(Dt.map((Dt=>this.destroyDataSource(Dt))));this.dataSource.clear()}getDefaultDataSourceName(){if(this.innerDefaultDataSourceName===undefined){if(this.options["defaultDataSourceName"]){this.innerDefaultDataSourceName=this.options["defaultDataSourceName"]}else if(this.dataSource.size===1){this.innerDefaultDataSourceName=Array.from(this.dataSource.keys())[0]}else{this.innerDefaultDataSourceName=""}}return this.innerDefaultDataSourceName}getDataSourcePriority(Dt){return this.priorityManager.getPriority(this.dataSourcePriority[Dt])}isHighPriority(Dt){return this.priorityManager.isHighPriority(this.dataSourcePriority[Dt])}isMediumPriority(Dt){return this.priorityManager.isMediumPriority(this.dataSourcePriority[Dt])}isLowPriority(Dt){return this.priorityManager.isLowPriority(this.dataSourcePriority[Dt])}}Wn([(0,Or.Inject)(),Gn("design:type",String)],DataSourceManager.prototype,"appDir",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Ir.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Hr.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Gr.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);Lt.DataSourceManager=DataSourceManager;function formatGlobString(Dt){let Lt;if(!/^\*/.test(Dt)){Dt="/"+Dt}const Tn=(0,mr.parse)(Dt);if(Tn.base&&(/\*/.test(Tn.base)||Tn.ext)){Lt=[Dt]}else{Lt=[...yr.DEFAULT_PATTERN.map((Lt=>(0,mr.join)(Dt,Lt)))]}return Lt}Lt.formatGlobString=formatGlobString;async function globModels(Dt,Lt,Tn){const Wn=formatGlobString(Dt);const Gn=[];const rr=(0,pr.run)(Wn,{cwd:Lt,ignore:yr.IGNORE_PATTERN});for(const Dt of rr){const Lt=await(0,Er.loadModule)(Dt,{loadMode:Tn});if(gr.Types.isClass(Lt)){Gn.push(Lt)}else{for(const Dt in Lt){const Tn=Lt[Dt];if(gr.Types.isClass(Tn)){Gn.push(Tn)}}}}return Gn}Lt.globModels=globModels},1845:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.CustomModuleDetector=Lt.ESModuleFileDetector=Lt.CommonJSFileDetector=Lt.AbstractFileDetector=void 0;const Wn=Tn(63289);const Gn=Tn(62525);const rr=Tn(86314);const cr=Tn(2222);const pr=Tn(49757);const mr=Tn(65308);class AbstractFileDetector{constructor(Dt){this.options=Dt;this.extraDetectorOptions={}}setExtraDetectorOptions(Dt){this.extraDetectorOptions=Dt}}Lt.AbstractFileDetector=AbstractFileDetector;const gr=["**/**.tsx"].concat(cr.DEFAULT_PATTERN);const yr=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(cr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(Dt){if(this.getType()==="commonjs"){return this.loadSync(Dt)}else{return this.loadAsync(Dt)}}loadSync(Dt){var Lt;this.options=this.options||{};const Tn=[].concat((Lt=this.options.loadDir)!==null&&Lt!==void 0?Lt:Dt.get("baseDir"));for(const Lt of Tn){const Tn=(0,Gn.run)(gr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Lt,ignore:yr.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(Dt,Lt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&Wn.Types.isClass(Dt)){const Tn=(0,pr.getProviderName)(Dt);if(Tn){if(this.duplicateModuleCheckSet.has(Tn)){throw new rr.MidwayDuplicateClassNameError(Tn,Lt.srcPath,this.duplicateModuleCheckSet.get(Tn))}else{this.duplicateModuleCheckSet.set(Tn,Lt.srcPath)}}}};for(const Lt of Tn){const Tn=require(Lt);Dt.bindClass(Tn,{namespace:this.options.namespace,srcPath:Lt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(Dt){var Lt;this.options=this.options||{};const Tn=[].concat((Lt=this.options.loadDir)!==null&&Lt!==void 0?Lt:Dt.get("baseDir"));for(const Lt of Tn){const Tn=(0,Gn.run)(gr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Lt,ignore:yr.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(Dt,Lt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&Wn.Types.isClass(Dt)){const Tn=(0,pr.getProviderName)(Dt);if(Tn){if(this.duplicateModuleCheckSet.has(Tn)){throw new rr.MidwayDuplicateClassNameError(Tn,Lt.srcPath,this.duplicateModuleCheckSet.get(Tn))}else{this.duplicateModuleCheckSet.set(Tn,Lt.srcPath)}}}};for(const Lt of Tn){const Tn=await(0,mr.loadModule)(Lt,{loadMode:"esm"});Dt.bindClass(Tn,{namespace:this.options.namespace,srcPath:Lt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}Lt.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}Lt.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(Dt){for(const Lt of this.options.modules){Dt.bindClass(Lt,{namespace:this.options.namespace,createFrom:"module"})}}}Lt.CustomModuleDetector=CustomModuleDetector},39408:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FilterManager=void 0;const Wn=Tn(49757);const Gn=Tn(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(Dt){if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){if((0,Wn.getClassMetadata)(Wn.CATCH_KEY,Lt)){this.errFilterList.push(Lt)}if((0,Wn.getClassMetadata)(Wn.MATCH_KEY,Lt)){this.successFilterList.push(Lt)}}}async init(Dt){for(const Lt of this.errFilterList){const Tn=await Dt.getAsync(Lt);const Gn=(0,Wn.getClassMetadata)(Wn.CATCH_KEY,Lt);if(Gn&&Gn.catchTargets){Gn.catchOptions=Gn.catchOptions||{};for(const Dt of Gn.catchTargets){this.exceptionMap.set(Dt,{filter:Tn,catchOptions:Gn.catchOptions});if(Gn.catchOptions["matchPrototype"]){this.protoMatchList.push((Lt=>{if(Lt instanceof Dt){return Dt}else{return false}}))}}}else{this.defaultErrFilter=Tn}}for(const Lt of this.successFilterList){const Tn=await Dt.getAsync(Lt);const rr=(0,Wn.getClassMetadata)(Wn.MATCH_KEY,Lt);if(rr&&rr.matchPattern){this.matchFnList.push({matchFn:(0,Gn.toPathMatch)(rr.matchPattern),target:Tn})}}}async runErrorFilter(Dt,Lt,Tn,Wn){let Gn,rr;let cr=false;if(Dt&&this.exceptionMap.has(Dt.constructor)){cr=true;const rr=this.exceptionMap.get(Dt.constructor);Gn=await rr.filter.catch(Dt,Lt,Tn,Wn)}if(!cr&&this.protoMatchList.length){let rr;for(const Lt of this.protoMatchList){rr=Lt(Dt);if(rr){break}}if(rr){cr=true;const pr=this.exceptionMap.get(rr);Gn=await pr.filter.catch(Dt,Lt,Tn,Wn)}}if(!cr&&this.defaultErrFilter){cr=true;Gn=await this.defaultErrFilter.catch(Dt,Lt,Tn,Wn)}if(!cr){rr=Dt}return{result:Gn,error:rr}}async runResultFilter(Dt,Lt,Tn,Wn){let Gn=Dt;for(const Dt of this.matchFnList){if(Dt.matchFn(Lt,Tn)){Gn=await Dt.target.match(Gn,Lt,Tn,Wn)}}return{result:Gn,error:undefined}}}Lt.FilterManager=FilterManager},40581:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.GuardManager=void 0;const Wn=Tn(49757);class GuardManager extends Array{addGlobalGuard(Dt){if(!Array.isArray(Dt)){this.push(Dt)}else{this.push(...Dt)}}async runGuard(Dt,Lt,Tn){for(const Wn of this){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}const Gn=(0,Wn.getClassMetadata)(Wn.GUARD_KEY,Lt);if(Gn){for(const Wn of Gn){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}}const rr=(0,Wn.getPropertyMetadata)(Wn.GUARD_KEY,Lt,Tn);if(rr){for(const Wn of rr){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}}return true}}Lt.GuardManager=GuardManager},82535:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DefaultConsoleLoggerFactory=Lt.LoggerFactory=void 0;class LoggerFactory{}Lt.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(Dt,Lt){this.instance.set(Dt,console);return console}getLogger(Dt){return this.instance.get(Dt)}close(Dt){}removeLogger(Dt){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(Dt,Lt,Tn){return Lt}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}Lt.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createMiddleware=Lt.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(Dt){if(Array.isArray(Dt)){this.unshift(...Dt)}else{this.unshift(Dt)}}insertLast(Dt){if(Array.isArray(Dt)){this.push(...Dt)}else{this.push(Dt)}}insertBefore(Dt,Lt){if(typeof Lt!=="number"){Lt=this.findItemIndex(Lt)}if(Array.isArray(Dt)){this.splice(Lt,0,...Dt)}else{this.splice(Lt,0,Dt)}}insertAfter(Dt,Lt){if(typeof Lt!=="number"){Lt=this.findItemIndex(Lt)}if(Array.isArray(Dt)){this.splice(Lt+1,0,...Dt)}else{this.splice(Lt+1,0,Dt)}}findAndInsertAfter(Dt,Lt){Dt=this.findItem(Dt);Lt=this.findItem(Lt);if(!Dt||!Lt||Dt===Lt){return}if(Lt){const Tn=this.remove(Dt);if(Tn){this.insertAfter(Tn,Lt)}}}findAndInsertBefore(Dt,Lt){Dt=this.findItem(Dt);Lt=this.findItem(Lt);if(!Dt||!Lt||Dt===Lt){return}if(Lt){const Tn=this.remove(Dt);if(Tn){this.insertBefore(Tn,Lt)}}}findAndInsertFirst(Dt){const Lt=this.remove(Dt);if(Lt){this.insertFirst(Lt)}}findAndInsertLast(Dt){const Lt=this.remove(Dt);if(Lt){this.insertLast(Lt)}}findItemIndex(Dt){if(typeof Dt==="number"){return Dt}else if(typeof Dt==="string"){return this.findIndex((Lt=>this.getMiddlewareName(Lt)===Dt))}else{return this.findIndex((Lt=>Lt===Dt))}}findItem(Dt){if(typeof Dt==="number"){if(Dt>=0&&Dt<=this.length-1){return this[Dt]}}else if(typeof Dt==="string"){return this.find((Lt=>this.getMiddlewareName(Lt)===Dt))}else{return Dt}}getMiddlewareName(Dt){var Lt,Tn,Wn;if(Dt["middleware"]){return(Lt=Dt.name)!==null&&Lt!==void 0?Lt:this.getMiddlewareName(Dt["middleware"])}return(Wn=(Tn=Dt.getName&&Dt.getName())!==null&&Tn!==void 0?Tn:Dt._name)!==null&&Wn!==void 0?Wn:Dt.name}remove(Dt){if(typeof Dt==="number"&&Dt!==-1){return this.splice(Dt,1)[0]}else{const Lt=this.findItemIndex(Dt);if(Lt!==-1){return this.splice(Lt,1)[0]}}}push(...Dt){Dt.forEach((Dt=>{if(typeof Dt!=="string"&&!this.getMiddlewareName(Dt)){Dt._name="anonymous"}}));return super.push(...Dt)}unshift(...Dt){Dt.forEach((Dt=>{if(typeof Dt!=="string"&&!this.getMiddlewareName(Dt)){Dt._name="anonymous"}}));return super.unshift(...Dt)}getNames(){return this.map((Dt=>this.getMiddlewareName(Dt)))}}Lt.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(Dt,Lt,Tn){return{middleware:Dt,options:Lt,name:Tn}}Lt.createMiddleware=createMiddleware},70032:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayInitializerPerformanceManager=Lt.MidwayPerformanceManager=void 0;const Wn=Tn(82987);class MidwayPerformanceManager{constructor(Dt){this.group=Dt;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(Dt){if(!this.instances.has(Dt)){this.instances.set(Dt,new MidwayPerformanceManager(Dt))}return this.instances.get(Dt)}formatKey(Dt,Lt){return`${this.group}:${Dt}-${Lt}`}markStart(Dt){const Lt=this.formatKey(Dt,"start");Wn.performance.mark(Lt);this.marks.add(Lt)}markEnd(Dt){const Lt=this.formatKey(Dt,"start");const Tn=this.formatKey(Dt,"end");const Gn=`${this.group}:${Dt}`;Wn.performance.mark(Tn);this.marks.add(Tn);Wn.performance.measure(Gn,Lt,Tn);this.measures.add(Gn)}observeMeasure(Dt){if(this.observer){return}this.observer=new Wn.PerformanceObserver((Lt=>{const Tn=Lt.getEntries().filter((Dt=>Dt.name.startsWith(`${this.group}:`)));if(Tn.length>0){Dt({getEntries:()=>Tn})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((Dt=>{try{Wn.performance.clearMarks(Dt)}catch(Lt){console.warn(`Failed to clear mark ${Dt}: ${Lt}`)}}));this.marks.clear();this.measures.forEach((Dt=>{try{Wn.performance.clearMeasures(Dt)}catch(Lt){console.warn(`Failed to clear measure ${Dt}: ${Lt}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((Dt=>Dt.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const Dt=[];Wn.performance===null||Wn.performance===void 0?void 0:Wn.performance.getEntries().forEach((Lt=>{if(Lt.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){Dt.push(Lt.toJSON())}}));return Dt}}Lt.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(Dt){const Lt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Lt.markStart(Dt)}static markEnd(Dt){const Lt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Lt.markEnd(Dt)}static frameworkInitializeStart(Dt){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Dt}`)}static frameworkInitializeEnd(Dt){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Dt}`)}static frameworkRunStart(Dt){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Dt}`)}static frameworkRunEnd(Dt){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Dt}`)}static lifecycleStart(Dt,Lt){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Dt}:${Lt}`)}static lifecycleEnd(Dt,Lt){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Dt}:${Lt}`)}}Lt.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager;MidwayInitializerPerformanceManager.MEASURE_KEYS={INITIALIZE:"Initialize",METADATA_PREPARE:"MetadataPrepare",DETECTOR_PREPARE:"DetectorPrepare",DEFINITION_PREPARE:"DefinitionPrepare",CONFIG_LOAD:"ConfigLoad",LOGGER_PREPARE:"LoggerPrepare",FRAMEWORK_PREPARE:"FrameworkPrepare",FRAMEWORK_INITIALIZE:"FrameworkInitialize",FRAMEWORK_RUN:"FrameworkRun",LIFECYCLE_PREPARE:"LifecyclePrepare",PRELOAD_MODULE_PREPARE:"PreloadModulePrepare"}},67934:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPriorityManager=Lt.DEFAULT_PRIORITY=void 0;const Gn=Tn(49757);const rr=Tn(6192);Lt.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let cr=class MidwayPriorityManager{constructor(){this.priorityList=Lt.DEFAULT_PRIORITY;this.defaultPriority=Lt.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L1}isMediumPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L2}isLowPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L3}getPriority(Dt){return Dt||this.getDefaultPriority()}};cr=Wn([(0,Gn.Provide)(),(0,Gn.Scope)(rr.ScopeEnum.Singleton)],cr);Lt.MidwayPriorityManager=cr},64842:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServiceFactory=void 0;const rr=Tn(83486);const cr=Tn(67934);const pr=Tn(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(Dt={}){this.options=Dt;if(Dt.client){Dt.clients=Dt.clients||{};Dt.clients["default"]=Dt.clients["default"]||{};(0,rr.extend)(true,Dt.clients["default"],Dt.client)}if(Dt.clients){for(const Lt of Object.keys(Dt.clients)){await this.createInstance(Dt.clients[Lt],Lt)}}this.clientPriority=Dt.priority||{}}get(Dt="default"){return this.clients.get(Dt)}has(Dt){return this.clients.has(Dt)}async createInstance(Dt,Lt){Dt=(0,rr.extend)(true,{},this.options["default"],Dt);const Tn=await this.createClient(Dt,Lt);if(Tn){if(Lt){this.clients.set(Lt,Tn)}return Tn}}async destroyClient(Dt,Lt){}async stop(){for(const[Dt,Lt]of this.clients.entries()){await this.destroyClient(Lt,Dt)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(Dt){return this.priorityManager.getPriority(this.clientPriority[Dt])}isHighPriority(Dt){return this.priorityManager.isHighPriority(this.clientPriority[Dt])}isMediumPriority(Dt){return this.priorityManager.isMediumPriority(this.clientPriority[Dt])}isLowPriority(Dt){return this.priorityManager.isLowPriority(this.clientPriority[Dt])}}Wn([(0,pr.Inject)(),Gn("design:type",cr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);Lt.ServiceFactory=ServiceFactory},11330:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TypedResourceManager=void 0;class TypedResourceManager{constructor(Dt){this.typedResourceInitializerOptions=Dt;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(Dt,Lt){const Tn=await this.typedResourceInitializerOptions.resourceInitialize(Lt,Dt);this.resourceMap.set(Dt,Tn);return Tn}async init(){for(const Dt of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const Lt=this.typedResourceInitializerOptions.initializeValue[Dt];const Tn=this.typedResourceInitializerOptions.initializeClzProvider[Dt];const Wn=await this.createResource(Dt,Lt);const Gn=await this.typedResourceInitializerOptions.resourceBinding(Tn,Lt,Wn,Dt);if(Gn){this.resourceBindingMap.set(Dt,Gn)}}}async startParallel(){const Dt=[];for(const[Lt,Tn]of this.resourceMap.entries()){Dt.push(this.typedResourceInitializerOptions.resourceStart(Tn,this.typedResourceInitializerOptions.initializeValue[Lt],this.resourceBindingMap.get(Lt)))}await Promise.all(Dt)}async start(){for(const[Dt,Lt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(Lt,this.typedResourceInitializerOptions.initializeValue[Dt],this.resourceBindingMap.get(Dt))}}async destroyParallel(){const Dt=[];for(const[Lt,Tn]of this.resourceMap.entries()){Dt.push(this.typedResourceInitializerOptions.resourceDestroy(Tn,this.typedResourceInitializerOptions.initializeValue[Lt]))}await Promise.all(Dt)}async destroy(){for(const[Dt,Lt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(Lt,this.typedResourceInitializerOptions.initializeValue[Dt])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(Dt){return this.resourceMap.get(Dt)}}Lt.TypedResourceManager=TypedResourceManager},11026:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.WebControllerGenerator=void 0;const Wn=Tn(49757);const Gn=Tn(39023);const rr=Tn(6192);const cr=Tn(86314);const pr=Tn(68220);const mr=Gn.debuglog("midway:debug");class WebControllerGenerator{constructor(Dt,Lt){this.app=Dt;this.midwayWebRouterService=Lt}generateKoaController(Dt){return async(Lt,Tn)=>{if(Dt.controllerClz&&typeof Dt.method==="string"){const Tn=await this.app.getFramework().runGuard(Lt,Dt.controllerClz,Dt.method);if(!Tn){throw new cr.httpError.ForbiddenError}}const Gn=[Lt,Tn];let rr;if(typeof Dt.method!=="string"){rr=await Dt.method(Lt,Tn)}else{const Tn=await Lt.requestContext.getAsync(Dt.id);rr=await Tn[Dt.method].apply(Tn,Gn)}if(rr!==undefined){if(rr===null){Lt.response._body=null;Lt.response._midwayControllerNullBody=true}else{Lt.body=rr}}if(Array.isArray(Dt.responseMetadata)&&Dt.responseMetadata.length){for(const Tn of Dt.responseMetadata){switch(Tn.type){case Wn.WEB_RESPONSE_HTTP_CODE:Lt.status=Tn.code;break;case Wn.WEB_RESPONSE_HEADER:for(const Dt in(Tn===null||Tn===void 0?void 0:Tn.setHeaders)||{}){Lt.set(Dt,Tn.setHeaders[Dt])}break;case Wn.WEB_RESPONSE_CONTENT_TYPE:Lt.type=Tn.contentType;break;case Wn.WEB_RESPONSE_REDIRECT:Lt.status=Tn.code;Lt.redirect(Tn.url);return}}}}}async loadMidwayController(Dt){var Lt,Tn;const Wn=await this.midwayWebRouterService.getRouterTable();const Gn=await this.midwayWebRouterService.getRoutePriorityList();const cr=this.app.getApplicationContext();const gr=this.app.getCoreLogger();const yr=cr.get(pr.MidwayMiddlewareService);for(const pr of Gn){cr.bindClass(pr.routerModule);gr.debug(`Load Controller "${pr.controllerId}", prefix=${pr.prefix}`);mr(`[core]: Load Controller "${pr.controllerId}", prefix=${pr.prefix}`);const Gn=this.createRouter({prefix:pr.prefix,...pr.routerOptions});pr.middleware=(Lt=pr.middleware)!==null&&Lt!==void 0?Lt:[];if(pr.middleware.length){const Dt=await yr.compose(pr.middleware,this.app);Gn.use(Dt)}const Sr=Wn.get(pr.prefix);for(const Dt of Sr){const Lt=[];Dt.middleware=(Tn=Dt.middleware)!==null&&Tn!==void 0?Tn:[];if(Dt.middleware.length){const Tn=await yr.compose(Dt.middleware,this.app);Lt.push(Tn)}if(this.app.getFrameworkType()===rr.MidwayFrameworkType.WEB_KOA){if(typeof Dt.url==="string"&&/\*$/.test(Dt.url)){Dt.url=Dt.url.replace("*","(.*)")}}const Wn=[Dt.routerName,Dt.url,...Lt,this.generateController(Dt)];gr.debug(`Load Router "${Dt.requestMethod.toUpperCase()} ${Dt.url}"`);mr(`[core]: Load Router "${Dt.requestMethod.toUpperCase()} ${Dt.url}"`);Gn[Dt.requestMethod.toLowerCase()].apply(Gn,Wn)}Dt&&Dt(Gn)}}}Lt.WebControllerGenerator=WebControllerGenerator},42193:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});const Wn=Tn(65308);Lt["default"]=Dt=>{const Lt=(0,Wn.isDevelopmentEnvironment)((0,Wn.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Lt?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Lt}}}},2222:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.SINGLETON_CONTAINER_CTX=Lt.IGNORE_PATTERN=Lt.DEFAULT_PATTERN=Lt.ASYNC_CONTEXT_MANAGER_KEY=Lt.ASYNC_CONTEXT_KEY=Lt.REQUEST_CTX_LOGGER_CACHE_KEY=Lt.HTTP_SERVER_KEY=Lt.CONTAINER_OBJ_SCOPE=Lt.REQUEST_OBJ_CTX_KEY=Lt.REQUEST_CTX_KEY=Lt.MIDWAY_LOGGER_WRITEABLE_DIR=Lt.FUNCTION_INJECT_KEY=Lt.KEYS=void 0;Lt.KEYS={OBJECTS_ELEMENT:"objects",OBJECT_ELEMENT:"object",IMPORT_ELEMENT:"import",PROPERTY_ELEMENT:"property",LIST_ELEMENT:"list",MAP_ELEMENT:"map",ENTRY_ELEMENT:"entry",VALUE_ELEMENT:"value",PROPS_ELEMENT:"props",PROP_ELEMENT:"prop",SET_ELEMENT:"set",CONSTRUCTOR_ARG_ELEMENT:"constructor-arg",REF_ELEMENT:"ref",JSON_ELEMENT:"json",CONFIGURATION_ELEMENT:"configuration",ID_ATTRIBUTE:"id",PATH_ATTRIBUTE:"path",DIRECT_ATTRIBUTE:"direct",AUTOWIRE_ATTRIBUTE:"autowire",ASYNC_ATTRIBUTE:"async",NAME_ATTRIBUTE:"name",REF_ATTRIBUTE:"ref",KEY_ATTRIBUTE:"key",VALUE_ATTRIBUTE:"value",TYPE_ATTRIBUTE:"type",EXTERNAL_ATTRIBUTE:"external",OBJECT_ATTRIBUTE:"object",RESOURCE_ATTRIBUTE:"resource",SCOPE_ATTRIBUTE:"scope",ASPECT_ELEMENT:"aspect",AROUND_ELEMENT:"around",EXPRESSION_ATTRIBUTE:"expression",EXECUTE_ATTRIBUTE:"execute"};Lt.FUNCTION_INJECT_KEY="midway:function_inject_key";Lt.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";Lt.REQUEST_CTX_KEY="ctx";Lt.REQUEST_OBJ_CTX_KEY="_req_ctx";Lt.CONTAINER_OBJ_SCOPE="_obj_scope";Lt.HTTP_SERVER_KEY="_midway_http_server";Lt.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";Lt.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");Lt.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";Lt.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];Lt.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];Lt.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayContainer=void 0;const Wn=Tn(49757);const Gn=Tn(24451);const rr=Tn(39023);const cr=Tn(20873);const pr=Tn(6192);const mr=Tn(2222);const gr=Tn(47698);const yr=Tn(34881);const Sr=Tn(80932);const Er=Tn(70275);const Or=Tn(78842);const Ir=Tn(24434);const Hr=Tn(86314);const Gr=Tn(63289);const $r=Tn(65308);const mi=rr.debuglog("midway:debug");const ki=rr.debuglog("midway:bind");const Ni=9;class ContainerConfiguration{constructor(Dt){this.container=Dt;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(Dt){let Lt=Wn.MAIN_MODULE_KEY;const Tn=this.getConfigurationExport(Dt);if(!Tn.length)return;for(let Dt=0;Dt<Tn.length;Dt++){const rr=Tn[Dt];if(this.loadedMap.get(rr)){continue}let cr;if(rr instanceof Gn.FunctionalConfiguration){cr=rr.getConfigurationOptions()}else{cr=(0,Wn.getClassMetadata)(Wn.CONFIGURATION_KEY,rr)}this.loadedMap.set(rr,true);if(cr){if(cr.namespace!==undefined){Lt=cr.namespace;this.namespaceList.push(Lt)}this.configurationOptionsList.push(cr);mi(`[core]: load configuration in namespace="${Lt}"`);this.addImports(cr.imports);this.addImportObjects(cr.importObjects);this.addImportConfigs(cr.importConfigs);this.addImportConfigFilter(cr.importConfigFilter);this.bindConfigurationClass(rr,Lt)}}this.container.bindClass(Dt,{namespace:Lt})}addImportConfigs(Dt){if(Dt){if(Array.isArray(Dt)){this.container.get(Or.MidwayConfigService).add(Dt)}else{this.container.get(Or.MidwayConfigService).addObject(Dt)}}}addImportConfigFilter(Dt){if(Dt){this.container.get(Or.MidwayConfigService).addFilter(Dt)}}addImports(Dt=[]){var Lt;for(let Tn of Dt){if(!Tn)continue;if(typeof Tn==="string"){Tn=require(Tn)}if("Configuration"in Tn){this.load(Tn)}else if("component"in Tn){if(Tn===null||Tn===void 0?void 0:Tn.enabledEnvironment){if((Lt=Tn===null||Tn===void 0?void 0:Tn.enabledEnvironment)===null||Lt===void 0?void 0:Lt.includes(this.container.get(Er.MidwayEnvironmentService).getCurrentEnvironment())){this.load(Tn.component)}}else{this.load(Tn.component)}}else{this.load(Tn)}}}addImportObjects(Dt){if(Dt){const Lt=Object.keys(Dt);for(const Tn of Lt){if(typeof Dt[Tn]!==undefined){this.container.registerObject(Tn,Dt[Tn])}}}}bindConfigurationClass(Dt,Lt){if(Dt instanceof Gn.FunctionalConfiguration){}else{(0,Wn.saveProviderId)(undefined,Dt);const Tn=(0,Wn.getProviderUUId)(Dt);this.container.bind(Tn,Dt,{namespace:Lt,scope:pr.ScopeEnum.Singleton})}const Tn=(0,Wn.listModule)(Wn.CONFIGURATION_KEY);const rr=Tn.find((Lt=>Lt.target===Dt));if(!rr){(0,Wn.saveModule)(Wn.CONFIGURATION_KEY,{target:Dt,namespace:Lt})}}getConfigurationExport(Dt){const Lt=[];if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)||Dt instanceof Gn.FunctionalConfiguration){Lt.push(Dt)}else{for(const Tn in Dt){const Wn=Dt[Tn];if(Gr.Types.isClass(Wn)||Gr.Types.isFunction(Wn)||Wn instanceof Gn.FunctionalConfiguration){Lt.push(Wn)}}}return Lt}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(Dt){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=mr.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=Dt;this.init()}init(){this.registerObject(mr.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Ir}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new cr.ObjectDefinitionRegistry}return this._registry}set registry(Dt){this._registry=Dt}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Sr.ManagedResolverFactory(this)}return this._resolverFactory}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}get namespaceSet(){if(!this._namespaceSet){this._namespaceSet=new Set}return this._namespaceSet}load(Dt){var Lt,Tn,Wn;if(!Array.isArray(Dt)){Dt=[Dt]}const Gn=new ContainerConfiguration(this);for(const Lt of Dt){if(Lt){Gn.load(Lt)}}for(const Dt of Gn.getNamespaceList()){this.namespaceSet.add(Dt);mi(`[core]: load configuration in namespace="${Dt}" complete`)}const rr=(Lt=Gn.getConfigurationOptionsList())!==null&&Lt!==void 0?Lt:[];const cr=(Tn=rr.find((Dt=>!Dt.namespace)))!==null&&Tn!==void 0?Tn:{};this.fileDetector=(Wn=cr.detector)!==null&&Wn!==void 0?Wn:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:cr.conflictCheck,...cr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(Dt,Lt){if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)){this.bindModule(Dt,Lt)}else{for(const Tn in Dt){const Wn=Dt[Tn];if(Gr.Types.isClass(Wn)||Gr.Types.isFunction(Wn)){this.bindModule(Wn,Lt)}}}}bind(Dt,Lt,Tn){var Gn;if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)){return this.bindModule(Dt,Lt)}if(this.registry.hasDefinition(Dt)){return}if(Tn===null||Tn===void 0?void 0:Tn.bindHook){Tn.bindHook(Lt,Tn)}let rr;if(Gr.Types.isClass(Lt)){rr=new gr.ObjectDefinition;rr.name=(0,Wn.getProviderName)(Lt)}else{rr=new yr.FunctionDefinition;if(!Gr.Types.isAsyncFunction(Lt)){rr.asynchronous=false}rr.name=rr.id}rr.path=Lt;rr.id=Dt;rr.srcPath=(Tn===null||Tn===void 0?void 0:Tn.srcPath)||null;rr.namespace=(Tn===null||Tn===void 0?void 0:Tn.namespace)||"";rr.scope=(Tn===null||Tn===void 0?void 0:Tn.scope)||pr.ScopeEnum.Request;rr.createFrom=Tn===null||Tn===void 0?void 0:Tn.createFrom;if(rr.srcPath){mi(`[core]: bind id "${rr.name} (${rr.srcPath}) ${Dt}"`)}else{mi(`[core]: bind id "${rr.name}" ${Dt}`)}const cr=(0,Wn.getPropertyInject)(Lt);for(const Dt in cr){const Lt=cr[Dt];ki(`${" ".repeat(Ni)}inject properties => [${JSON.stringify(Lt)}]`);const Tn=new Sr.ManagedReference;Tn.args=Lt.args;Tn.name=Lt.value;Tn.injectMode=Lt["injectMode"];rr.properties.set(Lt["targetKey"],Tn)}const mr=(0,Wn.getClassExtendedMetadata)(Wn.INJECT_CUSTOM_PROPERTY,Lt);for(const Dt in mr){const Lt=mr[Dt];rr.handlerProps.push(Lt)}const Er=(Gn=(0,Wn.getObjectDefinition)(Lt))!==null&&Gn!==void 0?Gn:{};if(Er.initMethod){ki(`${" ".repeat(Ni)}register initMethod = ${Er.initMethod}`);rr.initMethod=Er.initMethod}if(Er.destroyMethod){ki(`${" ".repeat(Ni)}register destroyMethod = ${Er.destroyMethod}`);rr.destroyMethod=Er.destroyMethod}if(Er.scope){ki(`${" ".repeat(Ni)}register scope = ${Er.scope}`);rr.scope=Er.scope}if(Er.allowDowngrade){ki(`${" ".repeat(Ni)}register allowDowngrade = ${Er.allowDowngrade}`);rr.allowDowngrade=Er.allowDowngrade}this.objectCreateEventTarget.emit(pr.ObjectLifeCycleEvent.BEFORE_BIND,Lt,{context:this,definition:rr,replaceCallback:Dt=>{rr=Dt}});if(rr){this.registry.registerDefinition(rr.id,rr)}}bindModule(Dt,Lt){if(Gr.Types.isClass(Dt)){const Tn=(0,Wn.getProviderUUId)(Dt);if(Tn){this.identifierMapping.saveClassRelation(Dt,Lt===null||Lt===void 0?void 0:Lt.namespace);this.bind(Tn,Dt,Lt)}else{}}else{const Tn=Dt[mr.FUNCTION_INJECT_KEY];if(Tn&&Tn.id){if(!Tn.scope){Tn.scope=pr.ScopeEnum.Request}const Wn=$r.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(Tn.id,Wn);this.bind(Wn,Dt,{scope:Tn.scope,namespace:Lt.namespace,srcPath:Lt.srcPath,createFrom:Lt.createFrom})}}}setFileDetector(Dt){this.fileDetector=Dt}createChild(){return new MidwayContainer(this)}setAttr(Dt,Lt){this.attrMap.set(Dt,Lt)}getAttr(Dt){return this.attrMap.get(Dt)}getIdentifier(Dt){return(0,Wn.getProviderUUId)(Dt)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Sr.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(Dt,Lt,Tn){var Wn;Lt=Lt!==null&&Lt!==void 0?Lt:[];Tn=Tn!==null&&Tn!==void 0?Tn:{originName:Dt};if(typeof Dt!=="string"){Tn.originName=Dt.name;Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Gn=this.registry.getDefinition(Dt);if(!Gn&&this.parent){return this.parent.get(Dt,Lt)}if(!Gn){throw new Hr.MidwayDefinitionNotFoundError((Wn=Tn===null||Tn===void 0?void 0:Tn.originName)!==null&&Wn!==void 0?Wn:Dt)}return this.getManagedResolverFactory().create({definition:Gn,args:Lt})}async getAsync(Dt,Lt,Tn){var Wn;Lt=Lt!==null&&Lt!==void 0?Lt:[];Tn=Tn!==null&&Tn!==void 0?Tn:{originName:Dt};if(typeof Dt!=="string"){Tn.originName=Dt.name;Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Gn=this.registry.getDefinition(Dt);if(!Gn&&this.parent){return this.parent.getAsync(Dt,Lt)}if(!Gn){throw new Hr.MidwayDefinitionNotFoundError((Wn=Tn===null||Tn===void 0?void 0:Tn.originName)!==null&&Wn!==void 0?Wn:Dt)}return this.getManagedResolverFactory().createAsync({definition:Gn,args:Lt})}registerObject(Dt,Lt){this.registry.registerObject(Dt,Lt)}onBeforeBind(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_BIND,Dt)}onBeforeObjectCreated(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_CREATED,Dt)}onObjectCreated(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.AFTER_CREATED,Dt)}onObjectInit(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.AFTER_INIT,Dt)}onBeforeObjectDestroy(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_DESTROY,Dt)}saveModule(Dt,Lt){if(!this.moduleMap.has(Dt)){this.moduleMap.set(Dt,new Set)}this.moduleMap.get(Dt).add(Lt)}listModule(Dt){return Array.from(this.moduleMap.get(Dt)||{})}transformModule(Dt){this.moduleMap=new Map(Dt)}hasNamespace(Dt){return this.namespaceSet.has(Dt)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(Dt){return this.registry.hasDefinition(Dt)}hasObject(Dt){return this.registry.hasObject(Dt)}getInstanceScope(Dt){if(Dt[mr.CONTAINER_OBJ_SCOPE]){return Dt[mr.CONTAINER_OBJ_SCOPE]}return undefined}}Lt.MidwayContainer=MidwayContainer},20873:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectDefinitionRegistry=void 0;const Wn=Tn(49757);const Gn="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(Dt,Lt){const Tn=(0,Wn.getProviderUUId)(Dt);this.set(Tn,Tn);if(Tn){const Gn=(0,Wn.getProviderId)(Dt);if(Gn){this.set(Gn,Tn)}this.set((0,Wn.getProviderName)(Dt),Tn);if(Lt){this.set(Lt+":"+(0,Wn.getProviderName)(Dt),Tn)}}}saveFunctionRelation(Dt,Lt){this.set(Lt,Lt);this.set(Dt,Lt)}hasRelation(Dt){return this.has(Dt)}getRelation(Dt){return this.get(Dt)}}class ObjectDefinitionRegistry extends Map{constructor(){super(...arguments);this.singletonIds=[];this._identifierRelation=new LegacyIdentifierRelation}get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(Dt){this._identifierRelation=Dt}get identifiers(){const Dt=[];for(const Lt of this.keys()){if(Lt.indexOf(Gn)===-1){Dt.push(Lt)}}return Dt}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(Dt){const Lt=[];for(const Tn of this.values()){const Wn=Tn;if(Wn.name===Dt){Lt.push(Wn)}}return Lt}registerDefinition(Dt,Lt){if(Lt.isSingletonScope()){this.singletonIds.push(Dt)}this.set(Dt,Lt)}getDefinition(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.get(Dt)}removeDefinition(Dt){this.delete(Dt)}hasDefinition(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.has(Dt)}clearAll(){this.singletonIds=[];this.clear()}hasObject(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.has(Gn+Dt)}registerObject(Dt,Lt){this.set(Gn+Dt,Lt)}getObject(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.get(Gn+Dt)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(Dt){this.identifierRelation=Dt}}Lt.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ManagedResolverFactory=Lt.ManagedReference=void 0;const Wn=Tn(2222);const Gn=Tn(6192);const rr=Tn(39023);const cr=Tn(86314);const pr=rr.debuglog("midway:managedresolver");const mr=rr.debuglog("midway:debug");class ManagedReference{constructor(){this.type=Wn.KEYS.REF_ELEMENT}}Lt.ManagedReference=ManagedReference;class RefResolver{constructor(Dt){this.factory=Dt}get type(){return Wn.KEYS.REF_ELEMENT}resolve(Dt,Lt){var Tn;const Wn=Dt;if(Wn.injectMode===Gn.InjectModeEnum.Class&&!((Tn=this.factory.context.parent)!==null&&Tn!==void 0?Tn:this.factory.context).hasDefinition(Wn.name)){if(Lt==="loggerService"){throw new cr.MidwayInconsistentVersionError}else{throw new cr.MidwayMissingImportComponentError(Lt)}}return this.factory.context.get(Wn.name,Wn.args,{originName:Lt})}async resolveAsync(Dt,Lt){var Tn;const Wn=Dt;if(Wn.injectMode===Gn.InjectModeEnum.Class&&!((Tn=this.factory.context.parent)!==null&&Tn!==void 0?Tn:this.factory.context).hasDefinition(Wn.name)){if(Lt==="loggerService"){throw new cr.MidwayInconsistentVersionError}else{throw new cr.MidwayMissingImportComponentError(Lt)}}return this.factory.context.getAsync(Wn.name,Wn.args,{originName:Lt})}}class ManagedResolverFactory{constructor(Dt){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=Dt;this.resolvers={ref:new RefResolver(this)}}registerResolver(Dt){this.resolvers[Dt.type]=Dt}resolveManaged(Dt,Lt){const Tn=this.resolvers[Dt.type];if(!Tn||Tn.type!==Dt.type){throw new cr.MidwayResolverMissingError(Dt.type)}return Tn.resolve(Dt,Lt)}async resolveManagedAsync(Dt,Lt){const Tn=this.resolvers[Dt.type];if(!Tn||Tn.type!==Dt.type){throw new cr.MidwayResolverMissingError(Dt.type)}return Tn.resolveAsync(Dt,Lt)}create(Dt){const{definition:Lt,args:Tn}=Dt;if(Lt.isSingletonScope()&&this.singletonCache.has(Lt.id)){return this.singletonCache.get(Lt.id)}let rr=this.createProxyReference(Lt);if(rr){return rr}this.compareAndSetCreateStatus(Lt);if(Lt.hasDependsOn()){for(const Dt of Lt.dependsOn){this.context.get(Dt,Tn)}}mr(`[core]: Create id = "${Lt.name}" ${Lt.id}.`);const pr=Lt.creator.load();let gr=[];if(Tn&&Array.isArray(Tn)&&Tn.length>0){gr=Tn}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_CREATED,pr,{constructorArgs:gr,definition:Lt,context:this.context});rr=Lt.creator.doConstruct(pr,gr,this.context);if(Lt.isRequestScope()&&Lt.constructor.name==="ObjectDefinition"){Object.defineProperty(rr,Wn.REQUEST_OBJ_CTX_KEY,{value:this.context.get(Wn.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Lt.properties){const Dt=Lt.properties.propertyKeys();for(const Tn of Dt){this.checkSingletonInvokeRequest(Lt,Tn);try{rr[Tn]=this.resolveManaged(Lt.properties.get(Tn),Tn)}catch(Dt){if(cr.MidwayDefinitionNotFoundError.isClosePrototypeOf(Dt)){const Tn=Lt.path.name;Dt.updateErrorMsg(Tn)}this.removeCreateStatus(Lt,true);throw Dt}}}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_CREATED,rr,{context:this.context,definition:Lt,replaceCallback:Dt=>{rr=Dt}});Lt.creator.doInit(rr);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_INIT,rr,{context:this.context,definition:Lt});if(Lt.id){if(Lt.isSingletonScope()){this.singletonCache.set(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Singleton)}else if(Lt.isRequestScope()){this.context.registerObject(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Request)}else{this.setInstanceScope(rr,Gn.ScopeEnum.Prototype)}}this.removeCreateStatus(Lt,true);return rr}async createAsync(Dt){const{definition:Lt,args:Tn}=Dt;if(Lt.isSingletonScope()&&this.singletonCache.has(Lt.id)){pr(`id = ${Lt.id}(${Lt.name}) get from singleton cache.`);return this.singletonCache.get(Lt.id)}let rr=this.createProxyReference(Lt);if(rr){pr(`id = ${Lt.id}(${Lt.name}) from proxy reference.`);return rr}this.compareAndSetCreateStatus(Lt);if(Lt.hasDependsOn()){for(const Dt of Lt.dependsOn){pr("id = %s init depend %s.",Lt.id,Dt);await this.context.getAsync(Dt,Tn)}}mr(`[core]: Create id = "${Lt.name}" ${Lt.id}.`);const gr=Lt.creator.load();let yr=[];if(Tn&&Array.isArray(Tn)&&Tn.length>0){yr=Tn}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_CREATED,gr,{constructorArgs:yr,context:this.context});rr=await Lt.creator.doConstructAsync(gr,yr,this.context);if(!rr){this.removeCreateStatus(Lt,false);throw new cr.MidwayCommonError(`${Lt.id} construct return undefined`)}if(Lt.isRequestScope()&&Lt.constructor.name==="ObjectDefinition"){pr("id = %s inject ctx",Lt.id);Object.defineProperty(rr,Wn.REQUEST_OBJ_CTX_KEY,{value:this.context.get(Wn.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Lt.properties){const Dt=Lt.properties.propertyKeys();for(const Tn of Dt){this.checkSingletonInvokeRequest(Lt,Tn);try{rr[Tn]=await this.resolveManagedAsync(Lt.properties.get(Tn),Tn)}catch(Dt){if(cr.MidwayDefinitionNotFoundError.isClosePrototypeOf(Dt)){const Tn=Lt.path.name;Dt.updateErrorMsg(Tn)}this.removeCreateStatus(Lt,false);throw Dt}}}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_CREATED,rr,{context:this.context,definition:Lt,replaceCallback:Dt=>{rr=Dt}});await Lt.creator.doInitAsync(rr);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_INIT,rr,{context:this.context,definition:Lt});if(Lt.id){if(Lt.isSingletonScope()){pr(`id = ${Lt.id}(${Lt.name}) set to singleton cache`);this.singletonCache.set(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Singleton)}else if(Lt.isRequestScope()){pr(`id = ${Lt.id}(${Lt.name}) set to register object`);this.context.registerObject(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Request)}else{this.setInstanceScope(rr,Gn.ScopeEnum.Prototype)}}this.removeCreateStatus(Lt,true);return rr}async destroyCache(){for(const Dt of this.singletonCache.keys()){const Lt=this.context.registry.getDefinition(Dt);if(Lt.creator){const Tn=this.singletonCache.get(Dt);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_DESTROY,Tn,{context:this.context,definition:Lt});await Lt.creator.doDestroyAsync(Tn)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(Dt,Lt){if(this.creating.has(Dt.id)){this.creating.set(Dt.id,false)}return true}isCreating(Dt){return this.creating.has(Dt.id)&&this.creating.get(Dt.id)}compareAndSetCreateStatus(Dt){if(!this.creating.has(Dt.id)||!this.creating.get(Dt.id)){this.creating.set(Dt.id,true)}}createProxyReference(Dt){if(this.isCreating(Dt)){pr("create proxy for %s.",Dt.id);if(!this.depthFirstSearch(Dt.id,Dt)){pr("id = %s after dfs return null",Dt.id);return null}return new Proxy({__is_proxy__:true,__target_id__:Dt.id},{get:(Lt,Tn)=>{let Wn;if(Dt.isRequestScope()){Wn=this.context.registry.getObject(Dt.id)}else if(Dt.isSingletonScope()){Wn=this.singletonCache.get(Dt.id)}else{Wn=this.context.get(Dt.id)}if(Wn){if(typeof Wn[Tn]==="function"){return Wn[Tn].bind(Wn)}return Wn[Tn]}return undefined}})}return null}depthFirstSearch(Dt,Lt,Tn){var Wn;if(Lt){pr("dfs for %s == %s start.",Dt,Lt.id);if(Lt.properties){const Gn=Lt.properties.propertyKeys();if(Gn.indexOf(Dt)>-1){pr("dfs exist in properties %s == %s.",Dt,Lt.id);return true}for(const rr of Gn){if(!Array.isArray(Tn)){Tn=[Dt]}let Gn=rr;const cr=Lt.properties.get(rr);if(cr&&cr.name){Gn=(Wn=this.context.identifierMapping.getRelation(cr.name))!==null&&Wn!==void 0?Wn:cr.name}if(Gn===Dt){pr("dfs exist in properties key %s == %s.",Dt,Lt.id);return true}if(Tn.indexOf(Gn)>-1){pr("dfs depth circular %s == %s, %s, %j.",Dt,Lt.id,Gn,Tn);continue}else{Tn.push(Gn);pr("dfs depth push %s == %s, %j.",Dt,Gn,Tn)}let mr=this.context.registry.getDefinition(Gn);if(!mr&&this.context.parent){mr=this.context.parent.registry.getDefinition(Gn)}if(this.depthFirstSearch(Dt,mr,Tn)){pr("dfs exist in sub tree %s == %s subId = %s.",Dt,Lt.id,mr.id);return true}}}pr("dfs for %s == %s end.",Dt,Lt.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(Dt,Lt){if(Dt.isSingletonScope()){const Tn=Dt.properties.get(Lt);if(this.context.hasDefinition(Tn===null||Tn===void 0?void 0:Tn.name)){const Lt=this.context.registry.getDefinition(Tn.name);if(Lt.isRequestScope()&&!Lt.allowDowngrade){throw new cr.MidwaySingletonInjectRequestError(Dt.path.name,Lt.path.name)}}}return true}setInstanceScope(Dt,Lt){if(typeof Dt==="object"){if(Lt===Gn.ScopeEnum.Request&&Dt[Wn.REQUEST_OBJ_CTX_KEY]===Wn.SINGLETON_CONTAINER_CTX){Lt=Gn.ScopeEnum.Singleton}Object.defineProperty(Dt,Wn.CONTAINER_OBJ_SCOPE,{value:Lt,writable:false,enumerable:false,configurable:false})}}}Lt.ManagedResolverFactory=ManagedResolverFactory},28695:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.providerWrapper=void 0;const Wn=Tn(2222);function providerWrapper(Dt){for(const Lt of Dt){Object.defineProperty(Lt.provider,Wn.FUNCTION_INJECT_KEY,{value:Lt,writable:false})}}Lt.providerWrapper=providerWrapper},97983:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayRequestContainer=void 0;const Wn=Tn(9288);const Gn=Tn(49757);const rr=Tn(2222);class MidwayRequestContainer extends Wn.MidwayContainer{constructor(Dt,Lt){super(Lt);this.applicationContext=Lt;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=Dt;this.registerObject(rr.REQUEST_CTX_KEY,Dt);this.registerObject("res",{});if(Dt.logger){this.registerObject("logger",Dt.logger)}}init(){}get(Dt,Lt){if(typeof Dt!=="string"){Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Tn=this.applicationContext.registry.getDefinition(Dt);if(Tn){if(Tn.isRequestScope()||Tn.id===Gn.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:Tn,args:Lt})}}if(this.parent){return this.parent.get(Dt,Lt)}}async getAsync(Dt,Lt){if(typeof Dt!=="string"){Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Tn=this.applicationContext.registry.getDefinition(Dt);if(Tn){if(Tn.isRequestScope()||Tn.id===Gn.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:Tn,args:Lt})}}if(this.parent){return this.parent.getAsync(Dt,Lt)}}async ready(){}getContext(){return this.ctx}}Lt.MidwayRequestContainer=MidwayRequestContainer},76271:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Aspect=void 0;const Wn=Tn(49757);const Gn=Tn(18025);const rr=Tn(6192);function Aspect(Dt,Lt,Tn){return function(cr){(0,Wn.saveModule)(Wn.ASPECT_KEY,cr);const pr=[].concat(Dt);for(const Dt of pr){(0,Wn.attachClassMetadata)(Wn.ASPECT_KEY,{aspectTarget:Dt,match:Lt,priority:Tn},cr)}(0,Gn.Scope)(rr.ScopeEnum.Singleton)(cr);(0,Wn.Provide)()(cr)}}Lt.Aspect=Aspect},2940:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Autoload=void 0;const Wn=Tn(45317);const Gn=Tn(39990);function Autoload(){return function(Dt){(0,Wn.savePreloadModule)(Dt);(0,Gn.Provide)()(Dt)}}Lt.Autoload=Autoload},73821:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;const Wn=Tn(49757);function Configuration(Dt={}){return Lt=>{(0,Wn.saveClassMetadata)(Wn.CONFIGURATION_KEY,Dt,Lt)}}Lt.Configuration=Configuration},41573:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Match=Lt.Catch=void 0;const Wn=Tn(45317);const Gn=Tn(75105);const rr=Tn(18025);const cr=Tn(39990);const pr=Tn(6192);function Catch(Dt,Lt={}){return function(Tn){const mr=Dt?[].concat(Dt):undefined;(0,Wn.saveClassMetadata)(Gn.CATCH_KEY,{catchTargets:mr,catchOptions:Lt},Tn);(0,rr.Scope)(pr.ScopeEnum.Singleton)(Tn);(0,cr.Provide)()(Tn)}}Lt.Catch=Catch;function Match(Dt=true){return function(Lt){(0,Wn.saveClassMetadata)(Gn.MATCH_KEY,{matchPattern:Dt},Lt);(0,rr.Scope)(pr.ScopeEnum.Singleton)(Lt);(0,cr.Provide)()(Lt)}}Lt.Match=Match},1623:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApplicationContext=Lt.Logger=Lt.App=Lt.Config=Lt.Plugin=Lt.Framework=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Framework(){return Dt=>{(0,Wn.saveModule)(Wn.FRAMEWORK_KEY,Dt);(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Framework=Framework;function Plugin(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.PLUGIN_KEY,{identifier:Dt})}Lt.Plugin=Plugin;function Config(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.CONFIG_KEY,{identifier:Dt})}Lt.Config=Config;function App(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.APPLICATION_KEY,{type:Dt})}Lt.App=App;function Logger(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.LOGGER_KEY,{identifier:Dt})}Lt.Logger=Logger;function ApplicationContext(){return(0,Wn.createCustomPropertyDecorator)(Wn.APPLICATION_CONTEXT_KEY,{})}Lt.ApplicationContext=ApplicationContext},41958:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Guard=Lt.UseGuard=void 0;const Wn=Tn(45317);const Gn=Tn(6192);const rr=Tn(75105);const cr=Tn(39990);const pr=Tn(18025);function UseGuard(Dt){return(Lt,Tn,Gn)=>{if(!Array.isArray(Dt)){Dt=[Dt]}if(Tn){(0,Wn.savePropertyMetadata)(rr.GUARD_KEY,Dt,Lt,Tn)}else{(0,Wn.saveClassMetadata)(rr.GUARD_KEY,Dt,Lt)}}}Lt.UseGuard=UseGuard;function Guard(){return Dt=>{(0,cr.Provide)()(Dt);(0,pr.Scope)(Gn.ScopeEnum.Singleton)(Dt)}}Lt.Guard=Guard},92922:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.InjectClient=Lt.Inject=void 0;const Wn=Tn(45317);const Gn=Tn(75105);function Inject(Dt){return function(Lt,Tn){(0,Wn.savePropertyInject)({target:Lt,targetKey:Tn,identifier:Dt})}}Lt.Inject=Inject;function InjectClient(Dt,Lt){return(0,Wn.createCustomPropertyDecorator)(Gn.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:Dt,clientName:Lt})}Lt.InjectClient=InjectClient},17511:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Middleware=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Middleware(){return Dt=>{(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Middleware=Middleware},56329:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Mock=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Mock(){return Dt=>{(0,Wn.saveModule)(Wn.MOCK_KEY,Dt);(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Mock=Mock},18025:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Singleton=Lt.Scope=Lt.Destroy=Lt.Init=void 0;const Wn=Tn(45317);const Gn=Tn(39990);const rr=Tn(6192);function Init(){return function(Dt,Lt){(0,Wn.saveObjectDefinition)(Dt,{initMethod:Lt})}}Lt.Init=Init;function Destroy(){return function(Dt,Lt){(0,Wn.saveObjectDefinition)(Dt,{destroyMethod:Lt})}}Lt.Destroy=Destroy;function Scope(Dt,Lt){return function(Tn){(0,Wn.saveObjectDefinition)(Tn,{scope:Dt,...Lt})}}Lt.Scope=Scope;function Singleton(){return function(Dt){Scope(rr.ScopeEnum.Singleton)(Dt);(0,Gn.Provide)()(Dt)}}Lt.Singleton=Singleton},64331:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Pipe=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Pipe(){return Dt=>{(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Pipe=Pipe},52953:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Pipeline=void 0;const Wn=Tn(45317);const Gn=Tn(75105);function Pipeline(Dt){return(0,Wn.createCustomPropertyDecorator)(Gn.PIPELINE_IDENTIFIER,{valves:Dt})}Lt.Pipeline=Pipeline},39990:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Provide=void 0;const Wn=Tn(45317);function Provide(Dt){return function(Lt){return(0,Wn.saveProviderId)(Dt,Lt)}}Lt.Provide=Provide},75105:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TAGGED_CLS=Lt.INJECT_CUSTOM_PARAM=Lt.INJECT_CUSTOM_METHOD=Lt.INJECT_CUSTOM_PROPERTY=Lt.INJECT_TAG=Lt.NAMED_TAG=Lt.CLASS_KEY_CONSTRUCTOR=Lt.APPLICATION_CONTEXT_KEY=Lt.APPLICATION_KEY=Lt.LOGGER_KEY=Lt.PLUGIN_KEY=Lt.CONFIG_KEY=Lt.MS_HSF_METHOD_KEY=Lt.MS_DUBBO_METHOD_KEY=Lt.MS_GRPC_METHOD_KEY=Lt.MS_PROVIDER_KEY=Lt.MS_PRODUCER_KEY=Lt.MS_CONSUMER_KEY=Lt.RPC_DUBBO_KEY=Lt.RPC_GRPC_KEY=Lt.HSF_KEY=Lt.WS_EVENT_KEY=Lt.WS_CONTROLLER_KEY=Lt.MODULE_TASK_QUEUE_OPTIONS=Lt.MODULE_TASK_QUEUE_KEY=Lt.MODULE_TASK_TASK_LOCAL_OPTIONS=Lt.MODULE_TASK_TASK_LOCAL_KEY=Lt.MODULE_TASK_METADATA=Lt.MODULE_TASK_KEY=Lt.WEB_RESPONSE_RENDER=Lt.WEB_RESPONSE_CONTENT_TYPE=Lt.WEB_RESPONSE_HEADER=Lt.WEB_RESPONSE_REDIRECT=Lt.WEB_RESPONSE_HTTP_CODE=Lt.WEB_RESPONSE_KEY=Lt.WEB_ROUTER_PARAM_KEY=Lt.WEB_ROUTER_KEY=Lt.CONTROLLER_KEY=Lt.SERVERLESS_FUNC_KEY=Lt.FUNC_KEY=Lt.FACTORY_SERVICE_CLIENT_KEY=Lt.MOCK_KEY=Lt.GUARD_KEY=Lt.MATCH_KEY=Lt.CATCH_KEY=Lt.ASPECT_KEY=Lt.FRAMEWORK_KEY=Lt.CONFIGURATION_KEY=Lt.SCHEDULE_KEY=Lt.ALL=void 0;Lt.PRIVATE_META_DATA_KEY=Lt.MAIN_MODULE_KEY=Lt.LIFECYCLE_IDENTIFIER_PREFIX=Lt.PIPELINE_IDENTIFIER=Lt.OBJ_DEF_CLS=Lt.TAGGED_FUN=void 0;Lt.ALL="common:all_value_key";Lt.SCHEDULE_KEY="common:schedule";Lt.CONFIGURATION_KEY="common:configuration";Lt.FRAMEWORK_KEY="common:framework";Lt.ASPECT_KEY="common:aspect";Lt.CATCH_KEY="common:catch";Lt.MATCH_KEY="common:match";Lt.GUARD_KEY="common:guard";Lt.MOCK_KEY="common:mock";Lt.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";Lt.FUNC_KEY="faas:func";Lt.SERVERLESS_FUNC_KEY="faas:serverless:function";Lt.CONTROLLER_KEY="web:controller";Lt.WEB_ROUTER_KEY="web:router";Lt.WEB_ROUTER_PARAM_KEY="web:router_param";Lt.WEB_RESPONSE_KEY="web:response";Lt.WEB_RESPONSE_HTTP_CODE="web:response_http_code";Lt.WEB_RESPONSE_REDIRECT="web:response_redirect";Lt.WEB_RESPONSE_HEADER="web:response_header";Lt.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";Lt.WEB_RESPONSE_RENDER="web:response_render";Lt.MODULE_TASK_KEY="task:task";Lt.MODULE_TASK_METADATA="task:task:options";Lt.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";Lt.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";Lt.MODULE_TASK_QUEUE_KEY="task:task:queue";Lt.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";Lt.WS_CONTROLLER_KEY="ws:controller";Lt.WS_EVENT_KEY="ws:event";Lt.HSF_KEY="rpc:hsf";Lt.RPC_GRPC_KEY="rpc:grpc";Lt.RPC_DUBBO_KEY="rpc:dubbo";Lt.MS_CONSUMER_KEY="ms:consumer";Lt.MS_PRODUCER_KEY="ms:producer";Lt.MS_PROVIDER_KEY="ms:provider";Lt.MS_GRPC_METHOD_KEY="ms:grpc:method";Lt.MS_DUBBO_METHOD_KEY="ms:dubbo:method";Lt.MS_HSF_METHOD_KEY="ms:hsf:method";Lt.CONFIG_KEY="config";Lt.PLUGIN_KEY="plugin";Lt.LOGGER_KEY="logger";Lt.APPLICATION_KEY="__midway_framework_app__";Lt.APPLICATION_CONTEXT_KEY="__midway_application_context__";Lt.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";Lt.NAMED_TAG="named";Lt.INJECT_TAG="inject";Lt.INJECT_CUSTOM_PROPERTY="inject_custom_property";Lt.INJECT_CUSTOM_METHOD="inject_custom_method";Lt.INJECT_CUSTOM_PARAM="inject_custom_param";Lt.TAGGED_CLS="injection:tagged_class";Lt.TAGGED_FUN="injection:tagged_function";Lt.OBJ_DEF_CLS="injection:object_definition_class";Lt.PIPELINE_IDENTIFIER="__pipeline_identifier__";Lt.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";Lt.MAIN_MODULE_KEY="__main__";Lt.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createCustomParamDecorator=Lt.createCustomMethodDecorator=Lt.createCustomPropertyDecorator=Lt.getMethodReturnTypes=Lt.getPropertyType=Lt.getMethodParamTypes=Lt.BaseType=Lt.isProvide=Lt.getProviderUUId=Lt.getProviderName=Lt.getProviderId=Lt.saveProviderId=Lt.getObjectDefinition=Lt.saveObjectDefinition=Lt.getPropertyInject=Lt.savePropertyInject=Lt.transformTypeFromTSDesign=Lt.clearAllModule=Lt.resetModule=Lt.listModule=Lt.clearBindContainer=Lt.bindContainer=Lt.saveModule=Lt.listPreloadModule=Lt.savePreloadModule=Lt.getPropertyMetadata=Lt.attachPropertyMetadata=Lt.savePropertyMetadata=Lt.listPropertyDataFromClass=Lt.getPropertyDataFromClass=Lt.attachPropertyDataToClass=Lt.savePropertyDataToClass=Lt.getClassMetadata=Lt.getClassExtendedMetadata=Lt.attachClassMetadata=Lt.saveClassMetadata=Lt.DecoratorManager=Lt.INJECT_CLASS_KEY_PREFIX=Lt.PRELOAD_MODULE_KEY=void 0;Tn(37159);const Wn=Tn(6192);const Gn=Tn(75105);const rr=Tn(63289);const cr=Tn(90406);const pr=Tn(65308);const mr=Tn(61327);const gr=Tn(39023).debuglog("midway:core");Lt.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";Lt.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=Lt.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(Dt,Lt){if(this.container){return this.container.saveModule(Dt,Lt)}if(!this.has(Dt)){this.set(Dt,new Set)}this.get(Dt).add(Lt)}listModule(Dt){if(this.container){return this.container.listModule(Dt)}return Array.from(this.get(Dt)||{})}resetModule(Dt){this.set(Dt,new Set)}bindContainer(Dt){this.container=Dt;this.container.transformModule(this)}static getDecoratorClassKey(Dt){return Dt.toString()+"_CLS"}static removeDecoratorClassKeySuffix(Dt){return Dt.toString().replace("_CLS","")}static getDecoratorMethodKey(Dt){return Dt.toString()+"_METHOD"}static getDecoratorClsExtendedKey(Dt){return Dt.toString()+"_EXT"}static getDecoratorClsMethodPrefix(Dt){return Dt.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(Dt,Lt){return DecoratorManager.getDecoratorClsMethodPrefix(Dt)+":"+Lt.toString()}static getDecoratorMethod(Dt,Lt){return DecoratorManager.getDecoratorMethodKey(Dt)+"_"+Lt.toString()}static saveMetadata(Dt,Lt,Tn,Wn){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let Gn;if(Reflect.hasOwnMetadata(Dt,Lt)){Gn=Reflect.getMetadata(Dt,Lt)}else{Gn=new Map}Gn.set(Tn,Wn);Reflect.defineMetadata(Dt,Gn,Lt)}static attachMetadata(Dt,Lt,Tn,Wn,Gn,rr="one"){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let cr;if(Reflect.hasOwnMetadata(Dt,Lt)){cr=Reflect.getMetadata(Dt,Lt)}else{cr=new Map}if(!cr.has(Tn)){if(Gn){cr.set(Tn,{})}else{cr.set(Tn,[])}}if(Gn){if(rr==="one"){cr.get(Tn)[Gn]=Wn}else{if(cr.get(Tn)[Gn]){cr.get(Tn)[Gn].push(Wn)}else{cr.get(Tn)[Gn]=[Wn]}}}else{cr.get(Tn).push(Wn)}Reflect.defineMetadata(Dt,cr,Lt)}static getMetadata(Dt,Lt,Tn){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let Wn;if(!Reflect.hasOwnMetadata(Dt,Lt)){Wn=new Map;Reflect.defineMetadata(Dt,Wn,Lt)}else{Wn=Reflect.getMetadata(Dt,Lt)}if(!Tn){return Wn}return Wn.get(Tn)}saveMetadata(Dt,Lt,Tn,Wn){if(Wn){const Gn=DecoratorManager.getDecoratorMethod(Dt,Wn);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,Tn,Gn,Lt)}else{const Wn=DecoratorManager.getDecoratorClassKey(Dt);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,Tn,Wn,Lt)}}attachMetadata(Dt,Lt,Tn,Wn,Gn,rr){if(Wn){const cr=DecoratorManager.getDecoratorMethod(Dt,Wn);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,Tn,cr,Lt,Gn,rr)}else{const Wn=DecoratorManager.getDecoratorClassKey(Dt);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,Tn,Wn,Lt,Gn,rr)}}getMetadata(Dt,Lt,Tn){if(Tn){const Wn=DecoratorManager.getDecoratorMethod(Dt,Tn);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,Lt,Wn)}else{const Tn=`${DecoratorManager.getDecoratorClassKey(Dt)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,Lt,Tn)}}savePropertyDataToClass(Dt,Lt,Tn,Wn){const Gn=DecoratorManager.getDecoratorClsMethodKey(Dt,Wn);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,Tn,Gn,Lt)}attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn){const rr=DecoratorManager.getDecoratorClsMethodKey(Dt,Wn);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,Tn,rr,Lt,Gn)}getPropertyDataFromClass(Dt,Lt,Tn){const Wn=DecoratorManager.getDecoratorClsMethodKey(Dt,Tn);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Lt,Wn)}listPropertyDataFromClass(Dt,Lt){const Tn=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Lt);const Wn=[];for(const[Lt,Gn]of Tn){if(Lt.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(Dt))!==-1){Wn.push(Gn)}}return Wn}}Lt.DecoratorManager=DecoratorManager;let yr=new DecoratorManager;if(typeof global==="object"){if(global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const Dt=(0,mr.getModuleRequirePathList)("@midwayjs/core");if(Dt.length){console.info("The module may be located in:");Dt.forEach(((Dt,Lt)=>{console.info(`${Lt+1}. ${Dt}`)}))}yr=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=yr}}function saveClassMetadata(Dt,Lt,Tn,Wn){if(Wn&&typeof Lt==="object"){const Wn=yr.getMetadata(Dt,Tn);if(!Wn){return yr.saveMetadata(Dt,Lt,Tn)}if(Array.isArray(Wn)){return yr.saveMetadata(Dt,Wn.concat(Lt),Tn)}else{return yr.saveMetadata(Dt,Object.assign(Wn,Lt),Tn)}}else{return yr.saveMetadata(Dt,Lt,Tn)}}Lt.saveClassMetadata=saveClassMetadata;function attachClassMetadata(Dt,Lt,Tn,Wn,Gn){return yr.attachMetadata(Dt,Lt,Tn,undefined,Wn,Gn)}Lt.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(Dt,Lt,Tn,Wn){if(Wn===undefined){Wn=true}const Gn=DecoratorManager.getDecoratorClsExtendedKey(Dt);let rr=yr.getMetadata(Gn,Lt,Tn);if(Wn&&rr!==undefined){return rr}const cr=Reflect.getPrototypeOf(Lt);if(cr&&cr.constructor!==Object){rr=(0,pr.merge)(getClassExtendedMetadata(Dt,cr,Tn,Wn),yr.getMetadata(Dt,Lt,Tn))}yr.saveMetadata(Gn,rr||null,Lt,Tn);return rr}Lt.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(Dt,Lt){return yr.getMetadata(Dt,Lt)}Lt.getClassMetadata=getClassMetadata;function savePropertyDataToClass(Dt,Lt,Tn,Wn){return yr.savePropertyDataToClass(Dt,Lt,Tn,Wn)}Lt.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn){return yr.attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn)}Lt.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(Dt,Lt,Tn){return yr.getPropertyDataFromClass(Dt,Lt,Tn)}Lt.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(Dt,Lt){return yr.listPropertyDataFromClass(Dt,Lt)}Lt.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(Dt,Lt,Tn,Wn){return yr.saveMetadata(Dt,Lt,Tn,Wn)}Lt.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(Dt,Lt,Tn,Wn){return yr.attachMetadata(Dt,Lt,Tn,Wn)}Lt.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(Dt,Lt,Tn){return yr.getMetadata(Dt,Lt,Tn)}Lt.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(Dt){return saveModule(Lt.PRELOAD_MODULE_KEY,Dt)}Lt.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(Lt.PRELOAD_MODULE_KEY)}Lt.listPreloadModule=listPreloadModule;function saveModule(Dt,Lt){if((0,rr.isClass)(Lt)){saveProviderId(undefined,Lt)}return yr.saveModule(Dt,Lt)}Lt.saveModule=saveModule;function bindContainer(Dt){return yr.bindContainer(Dt)}Lt.bindContainer=bindContainer;function clearBindContainer(){return yr.container=null}Lt.clearBindContainer=clearBindContainer;function listModule(Dt,Lt){const Tn=yr.listModule(Dt);if(Lt){return Tn.filter(Lt)}else{return Tn}}Lt.listModule=listModule;function resetModule(Dt){return yr.resetModule(Dt)}Lt.resetModule=resetModule;function clearAllModule(){gr("--- clear all module here ---");return yr.clear()}Lt.clearAllModule=clearAllModule;function transformTypeFromTSDesign(Dt){if((0,rr.isNullOrUndefined)(Dt)){return{name:"undefined",isBaseType:true,originDesign:Dt}}switch(Dt.name){case"String":return{name:"string",isBaseType:true,originDesign:Dt};case"Number":return{name:"number",isBaseType:true,originDesign:Dt};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:Dt};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:Dt};case"Object":return{name:"object",isBaseType:true,originDesign:Dt};case"Function":return{name:"function",isBaseType:true,originDesign:Dt};default:return{name:Dt.name,isBaseType:false,originDesign:Dt}}}Lt.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(Dt){let Lt=Dt.identifier;let Tn=Wn.InjectModeEnum.Identifier;if(!Lt){const Gn=getPropertyType(Dt.target,Dt.targetKey);if(!Gn.isBaseType&&(0,rr.isClass)(Gn.originDesign)&&isProvide(Gn.originDesign)){Lt=getProviderUUId(Gn.originDesign);Tn=Wn.InjectModeEnum.Class}if(!Lt){Lt=Dt.targetKey;Tn=Wn.InjectModeEnum.PropertyName}}attachClassMetadata(Gn.INJECT_TAG,{targetKey:Dt.targetKey,value:Lt,args:Dt.args,injectMode:Tn},Dt.target,Dt.targetKey)}Lt.savePropertyInject=savePropertyInject;function getPropertyInject(Dt,Lt){return getClassExtendedMetadata(Gn.INJECT_TAG,Dt,undefined,Lt)}Lt.getPropertyInject=getPropertyInject;function saveObjectDefinition(Dt,Lt={}){saveClassMetadata(Gn.OBJ_DEF_CLS,Lt,Dt,true);return Dt}Lt.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(Dt){return getClassExtendedMetadata(Gn.OBJ_DEF_CLS,Dt)}Lt.getObjectDefinition=getObjectDefinition;function saveProviderId(Dt,Lt){if(isProvide(Lt)){if(Dt){const Tn=getClassMetadata(Gn.TAGGED_CLS,Lt);if(Tn.id!==Dt){Tn.id=Dt;saveClassMetadata(Gn.TAGGED_CLS,Tn,Lt);gr(`update provide: ${Lt.name} -> ${Tn.uuid}`)}}}else{const Tn=(0,pr.generateRandomId)();saveClassMetadata(Gn.TAGGED_CLS,{id:Dt,originName:Lt.name,uuid:Tn,name:(0,cr.camelCase)(Lt.name)},Lt);gr(`save provide: ${Lt.name} -> ${Tn}`)}return Lt}Lt.saveProviderId=saveProviderId;function getProviderId(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.id){return Lt.id}}Lt.getProviderId=getProviderId;function getProviderName(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.name){return Lt.name}}Lt.getProviderName=getProviderName;function getProviderUUId(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.uuid){return Lt.uuid}}Lt.getProviderUUId=getProviderUUId;function isProvide(Dt){return!!getClassMetadata(Gn.TAGGED_CLS,Dt)}Lt.isProvide=isProvide;var Sr;(function(Dt){Dt["Boolean"]="boolean";Dt["Number"]="number";Dt["String"]="string"})(Sr=Lt.BaseType||(Lt.BaseType={}));function getMethodParamTypes(Dt,Lt){if((0,rr.isClass)(Dt)){Dt=Dt.prototype}return Reflect.getMetadata("design:paramtypes",Dt,Lt)}Lt.getMethodParamTypes=getMethodParamTypes;function getPropertyType(Dt,Lt){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",Dt,Lt))}Lt.getPropertyType=getPropertyType;function getMethodReturnTypes(Dt,Lt){if((0,rr.isClass)(Dt)){Dt=Dt.prototype}return Reflect.getMetadata("design:returntype",Dt,Lt)}Lt.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(Dt,Lt,Tn=true){return function(Wn,rr){attachClassMetadata(Gn.INJECT_CUSTOM_PROPERTY,{propertyName:rr,key:Dt,metadata:Lt,impl:Tn},Wn,rr)}}Lt.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(Dt,Lt,Tn={impl:true}){if(typeof Tn==="boolean"){Tn={impl:Tn}}if(Tn.impl===undefined){Tn.impl=true}return function(Wn,rr,cr){attachClassMetadata(Gn.INJECT_CUSTOM_METHOD,{propertyName:rr,key:Dt,metadata:Lt,options:Tn},Wn)}}Lt.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(Dt,Lt,Tn={impl:true}){if(typeof Tn==="boolean"){Tn={impl:Tn}}if(Tn.impl===undefined){Tn.impl=true}return function(Wn,rr,cr){attachClassMetadata(Gn.INJECT_CUSTOM_PARAM,{key:Dt,parameterIndex:cr,propertyName:rr,metadata:Lt,options:Tn},Wn,rr,"multi")}}Lt.createCustomParamDecorator=createCustomParamDecorator},69193:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerlessTrigger=Lt.ServerlessFunction=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function ServerlessFunction(Dt){return(Lt,Tn,Gn)=>{(0,Wn.savePropertyMetadata)(Wn.SERVERLESS_FUNC_KEY,Dt,Lt,Tn)}}Lt.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(Dt,Lt={}){return(Tn,rr,cr)=>{var pr;if(Dt===Gn.ServerlessTriggerType.HTTP||Dt===Gn.ServerlessTriggerType.API_GATEWAY){Lt["method"]=(pr=Lt["method"])!==null&&pr!==void 0?pr:"get"}(0,Wn.saveModule)(Wn.FUNC_KEY,Tn.constructor);Lt=Lt||{};(0,Wn.attachClassMetadata)(Wn.FUNC_KEY,{type:Dt,methodName:rr,metadata:Lt},Tn)}}Lt.ServerlessTrigger=ServerlessTrigger},49757:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(39990),Lt);Gn(Tn(92922),Lt);Gn(Tn(52953),Lt);Gn(Tn(76271),Lt);Gn(Tn(2940),Lt);Gn(Tn(73821),Lt);Gn(Tn(18025),Lt);Gn(Tn(1623),Lt);Gn(Tn(41573),Lt);Gn(Tn(17511),Lt);Gn(Tn(41958),Lt);Gn(Tn(64331),Lt);Gn(Tn(56329),Lt);Gn(Tn(69193),Lt);Gn(Tn(86690),Lt);Gn(Tn(58843),Lt);Gn(Tn(29619),Lt);Gn(Tn(92233),Lt);Gn(Tn(75105),Lt);Gn(Tn(45317),Lt);Gn(Tn(573),Lt);Gn(Tn(4132),Lt);Gn(Tn(76543),Lt);Gn(Tn(64767),Lt);Gn(Tn(41684),Lt);Gn(Tn(17640),Lt);Gn(Tn(81970),Lt);Gn(Tn(52963),Lt);Gn(Tn(57706),Lt);Gn(Tn(67999),Lt);Gn(Tn(20551),Lt)},573:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Consumer=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Consumer(Dt,Lt={}){return Tn=>{(0,Wn.saveModule)(Wn.MS_CONSUMER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.MS_CONSUMER_KEY,{type:Dt,metadata:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Consumer=Consumer},64767:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.KafkaListener=void 0;const Wn=Tn(49757);function KafkaListener(Dt,Lt={}){return(Tn,Gn)=>{Lt.topic=Dt;Lt.propertyKey=Gn;(0,Wn.attachPropertyDataToClass)(Wn.MS_CONSUMER_KEY,Lt,Tn,Gn)}}Lt.KafkaListener=KafkaListener},4132:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DubboMethod=Lt.GrpcMethod=Lt.GrpcStreamTypeEnum=Lt.Provider=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Provider(Dt,Lt={}){return Tn=>{(0,Wn.saveModule)(Wn.MS_PROVIDER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.MS_PROVIDER_KEY,{type:Dt,metadata:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Provider=Provider;var rr;(function(Dt){Dt["BASE"]="base";Dt["DUPLEX"]="ServerDuplexStream";Dt["READABLE"]="ServerReadableStream";Dt["WRITEABLE"]="ServerWritableStream"})(rr=Lt.GrpcStreamTypeEnum||(Lt.GrpcStreamTypeEnum={}));function GrpcMethod(Dt={}){return(Lt,Tn,Gn)=>{if(!Dt.type){Dt.type=rr.BASE}(0,Wn.savePropertyMetadata)(Wn.MS_GRPC_METHOD_KEY,{methodName:Dt.methodName||Tn,type:Dt.type,onEnd:Dt.onEnd},Lt,Tn);return Gn}}Lt.GrpcMethod=GrpcMethod;function DubboMethod(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachClassMetadata)(Wn.MS_DUBBO_METHOD_KEY,{methodName:Dt||Tn},Lt);return Gn}}Lt.DubboMethod=DubboMethod},76543:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.RabbitMQListener=void 0;const Wn=Tn(49757);function RabbitMQListener(Dt,Lt={}){return(Tn,Gn)=>{Lt.queueName=Dt;Lt.propertyKey=Gn;(0,Wn.attachPropertyDataToClass)(Wn.MS_CONSUMER_KEY,Lt,Tn,Gn)}}Lt.RabbitMQListener=RabbitMQListener},41684:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HSF=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function HSF(Dt={}){return Lt=>{(0,Wn.saveModule)(Wn.HSF_KEY,Lt);(0,Wn.saveClassMetadata)(Wn.HSF_KEY,Dt,Lt);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Lt);(0,Wn.Provide)()(Lt)}}Lt.HSF=HSF},17640:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Queue=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function Queue(Dt){return function(Lt){(0,Wn.saveModule)(Gn.MODULE_TASK_QUEUE_KEY,Lt);(0,Wn.saveClassMetadata)(Gn.MODULE_TASK_QUEUE_OPTIONS,{options:Dt,name:Lt.name},Lt);(0,Wn.Provide)()(Lt)}}Lt.Queue=Queue},57706:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Schedule=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Schedule(Dt){return function(Lt){(0,Wn.saveModule)(Wn.SCHEDULE_KEY,Lt);(0,Wn.saveClassMetadata)(Wn.SCHEDULE_KEY,Dt,Lt);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Lt);(0,Wn.Provide)()(Lt)}}Lt.Schedule=Schedule},81970:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Task=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function Task(Dt){return function(Lt,Tn,rr){(0,Wn.saveModule)(Gn.MODULE_TASK_KEY,Lt.constructor);(0,Wn.attachClassMetadata)(Gn.MODULE_TASK_METADATA,{options:Dt,propertyKey:Tn,value:rr.value,name:Lt.constructor.name},Lt)}}Lt.Task=Task},52963:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TaskLocal=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function TaskLocal(Dt){return function(Lt,Tn,rr){(0,Wn.saveModule)(Gn.MODULE_TASK_TASK_LOCAL_KEY,Lt.constructor);(0,Wn.attachClassMetadata)(Gn.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:Dt,propertyKey:Tn,value:rr.value},Lt)}}Lt.TaskLocal=TaskLocal},86690:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Controller=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Controller(Dt="/",Lt={middleware:[],sensitive:true}){return Tn=>{(0,Wn.saveModule)(Wn.CONTROLLER_KEY,Tn);if(Dt)(0,Wn.saveClassMetadata)(Wn.CONTROLLER_KEY,{prefix:Dt,routerOptions:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Controller=Controller},58843:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Fields=Lt.Queries=Lt.RequestIP=Lt.RequestPath=Lt.Files=Lt.File=Lt.Headers=Lt.Param=Lt.Query=Lt.Body=Lt.Session=Lt.createRequestParamDecorator=Lt.RouteParamTypes=void 0;const Wn=Tn(49757);var Gn;(function(Dt){Dt["QUERY"]="query";Dt["BODY"]="body";Dt["PARAM"]="param";Dt["HEADERS"]="headers";Dt["SESSION"]="session";Dt["FILESTREAM"]="file_stream";Dt["FILESSTREAM"]="files_stream";Dt["NEXT"]="next";Dt["REQUEST_PATH"]="request_path";Dt["REQUEST_IP"]="request_ip";Dt["QUERIES"]="queries";Dt["FIELDS"]="fields";Dt["CUSTOM"]="custom"})(Gn=Lt.RouteParamTypes||(Lt.RouteParamTypes={}));const createParamMapping=function(Dt){return(Lt,Tn={})=>{let Gn=Lt;if(Array.isArray(Lt)&&Tn.pipes===undefined){Tn.pipes=Lt;Gn=undefined}return(0,Wn.createCustomParamDecorator)(Wn.WEB_ROUTER_PARAM_KEY,{type:Dt,propertyData:Gn},Tn)}};const createRequestParamDecorator=function(Dt,Lt){Lt=Lt||{};if(Array.isArray(Lt)){Lt={pipes:Lt}}return createParamMapping(Gn.CUSTOM)(Dt,Lt)};Lt.createRequestParamDecorator=createRequestParamDecorator;const Session=(Dt,Lt)=>createParamMapping(Gn.SESSION)(Dt,{pipes:Lt});Lt.Session=Session;const Body=(Dt,Lt)=>createParamMapping(Gn.BODY)(Dt,{pipes:Lt});Lt.Body=Body;const Query=(Dt,Lt)=>createParamMapping(Gn.QUERY)(Dt,{pipes:Lt});Lt.Query=Query;const Param=(Dt,Lt)=>createParamMapping(Gn.PARAM)(Dt,{pipes:Lt});Lt.Param=Param;const Headers=(Dt,Lt)=>createParamMapping(Gn.HEADERS)(Dt,{pipes:Lt});Lt.Headers=Headers;const File=(Dt,Lt)=>createParamMapping(Gn.FILESTREAM)(Dt,{pipes:Lt});Lt.File=File;const Files=(Dt,Lt)=>createParamMapping(Gn.FILESSTREAM)(Dt,{pipes:Lt});Lt.Files=Files;const RequestPath=Dt=>createParamMapping(Gn.REQUEST_PATH)(undefined,{pipes:Dt});Lt.RequestPath=RequestPath;const RequestIP=Dt=>createParamMapping(Gn.REQUEST_IP)(undefined,{pipes:Dt});Lt.RequestIP=RequestIP;const Queries=(Dt,Lt)=>createParamMapping(Gn.QUERIES)(Dt,{pipes:Lt});Lt.Queries=Queries;const Fields=(Dt,Lt)=>createParamMapping(Gn.FIELDS)(Dt,{pipes:Lt});Lt.Fields=Fields},29619:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.All=Lt.Head=Lt.Options=Lt.Patch=Lt.Put=Lt.Del=Lt.Get=Lt.Post=Lt.RequestMapping=Lt.RequestMethod=void 0;const Wn=Tn(49757);Lt.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const Gn={path:"/",requestMethod:Lt.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(Dt=Gn)=>{const Tn=Dt.path||"/";const rr=Dt.requestMethod||Lt.RequestMethod.GET;const cr=Dt.routerName;const pr=Dt.middleware;return(Lt,Gn,mr)=>{var gr;(0,Wn.attachClassMetadata)(Wn.WEB_ROUTER_KEY,{path:Tn,requestMethod:rr,routerName:cr,method:Gn,middleware:pr,summary:(Dt===null||Dt===void 0?void 0:Dt.summary)||"",description:(Dt===null||Dt===void 0?void 0:Dt.description)||"",ignoreGlobalPrefix:(gr=Dt===null||Dt===void 0?void 0:Dt.ignoreGlobalPrefix)!==null&&gr!==void 0?gr:false},Lt);return mr}};Lt.RequestMapping=RequestMapping;const createMappingDecorator=Dt=>(Tn,Wn={middleware:[]})=>(0,Lt.RequestMapping)(Object.assign(Wn,{requestMethod:Dt,path:Tn}));Lt.Post=createMappingDecorator(Lt.RequestMethod.POST);Lt.Get=createMappingDecorator(Lt.RequestMethod.GET);Lt.Del=createMappingDecorator(Lt.RequestMethod.DELETE);Lt.Put=createMappingDecorator(Lt.RequestMethod.PUT);Lt.Patch=createMappingDecorator(Lt.RequestMethod.PATCH);Lt.Options=createMappingDecorator(Lt.RequestMethod.OPTIONS);Lt.Head=createMappingDecorator(Lt.RequestMethod.HEAD);Lt.All=createMappingDecorator(Lt.RequestMethod.ALL)},92233:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createRender=Lt.ContentType=Lt.SetHeader=Lt.HttpCode=Lt.Redirect=void 0;const Wn=Tn(49757);function Redirect(Dt,Lt=302){return(Tn,Gn,rr)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_REDIRECT,url:Dt,code:Lt},Tn,Gn);return rr}}Lt.Redirect=Redirect;function HttpCode(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_HTTP_CODE,code:Dt},Lt,Tn);return Gn}}Lt.HttpCode=HttpCode;function SetHeader(Dt,Lt){return(Tn,Gn,rr)=>{let cr={};if(Lt){cr[Dt]=Lt}else{cr=Dt}(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_HEADER,setHeaders:cr},Tn,Gn);return rr}}Lt.SetHeader=SetHeader;function ContentType(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_CONTENT_TYPE,contentType:Dt},Lt,Tn);return Gn}}Lt.ContentType=ContentType;function createRender(Dt){return Dt=>(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_RENDER,templateName:Dt},Lt,Tn);return Gn}}Lt.createRender=createRender},67999:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.WSController=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function WSController(Dt="/",Lt={middleware:[],connectionMiddleware:[]}){return Tn=>{(0,Wn.saveModule)(Wn.WS_CONTROLLER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.WS_CONTROLLER_KEY,{namespace:Dt,routerOptions:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.WSController=WSController},20551:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.OnConnection=Lt.OnDisConnection=Lt.Emit=Lt.OnMessage=Lt.WSBroadCast=Lt.WSEmit=Lt.OnWSMessage=Lt.OnWSDisConnection=Lt.OnWSConnection=Lt.WSEventTypeEnum=void 0;const Wn=Tn(49757);var Gn;(function(Dt){Dt["ON_CONNECTION"]="ws:onConnection";Dt["ON_DISCONNECTION"]="ws:onDisconnection";Dt["ON_MESSAGE"]="ws:onMessage";Dt["ON_SOCKET_ERROR"]="ws:onSocketError";Dt["EMIT"]="ws:Emit";Dt["BROADCAST"]="ws:broadcast"})(Gn=Lt.WSEventTypeEnum||(Lt.WSEventTypeEnum={}));function OnWSConnection(Dt={}){return(Lt,Tn,rr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_CONNECTION,propertyName:Tn,eventOptions:Dt,descriptor:rr},Lt.constructor)}}Lt.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(Dt,Lt,Tn)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_DISCONNECTION,propertyName:Lt,descriptor:Tn},Dt.constructor)}}Lt.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(Dt,Lt={}){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_MESSAGE,messageEventName:Dt,propertyName:rr,eventOptions:Lt,descriptor:cr},Tn.constructor)}}Lt.OnWSMessage=OnWSMessage;function WSEmit(Dt,Lt=[]){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.EMIT,propertyName:rr,messageEventName:Dt,roomName:[].concat(Lt),descriptor:cr},Tn.constructor)}}Lt.WSEmit=WSEmit;function WSBroadCast(Dt="",Lt=[]){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.BROADCAST,propertyName:rr,messageEventName:Dt,roomName:[].concat(Lt),descriptor:cr},Tn.constructor)}}Lt.WSBroadCast=WSBroadCast;Lt.OnMessage=OnWSMessage;Lt.Emit=WSEmit;Lt.OnDisConnection=OnWSDisConnection;Lt.OnConnection=OnWSConnection},34881:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FunctionDefinition=void 0;const Wn=Tn(6192);const Gn=Tn(59327);class FunctionWrapperCreator extends Gn.ObjectCreator{doConstruct(Dt,Lt,Tn){if(!Dt){return null}return Dt(Tn,Lt)}async doConstructAsync(Dt,Lt,Tn){if(!Dt){return null}return Dt(Tn,Lt)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=Wn.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(Dt){}hasAttr(Dt){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(Dt){this.innerScope=Dt}isSingletonScope(){return this.innerScope===Wn.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===Wn.ScopeEnum.Request}setAttr(Dt,Lt){}}Lt.FunctionDefinition=FunctionDefinition},59327:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectCreator=void 0;const Wn=Tn(86314);const Gn=Tn(63289);class ObjectCreator{constructor(Dt){this.definition=Dt}load(){let Dt=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return Dt}const Lt=this.definition.path;if(this.definition.export){Dt=require(Lt)[this.definition.export]}else{Dt=require(Lt)}}else{Dt=this.definition.path}return Dt}doConstruct(Dt,Lt){if(!Dt){return Object.create(null)}let Tn;if(this.definition.constructMethod){Tn=Dt[this.definition.constructMethod].apply(Dt,Lt)}else{Tn=Reflect.construct(Dt,Lt)}return Tn}async doConstructAsync(Dt,Lt){if(!Dt){return Object.create(null)}let Tn;if(this.definition.constructMethod){const Wn=Dt[this.definition.constructMethod];if(Gn.Types.isAsyncFunction(Wn)){Tn=await Wn.apply(Dt,Lt)}else{Tn=Wn.apply(Dt,Lt)}}else{Tn=Reflect.construct(Dt,Lt)}return Tn}doInit(Dt){const Lt=Dt;if(this.definition.initMethod&&Lt[this.definition.initMethod]){if(Gn.Types.isGeneratorFunction(Lt[this.definition.initMethod])||Gn.Types.isAsyncFunction(Lt[this.definition.initMethod])){throw new Wn.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const Dt=Lt[this.definition.initMethod].call(Lt);if(Gn.Types.isPromise(Dt)){throw new Wn.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(Dt){const Lt=Dt;if(this.definition.initMethod&&Lt[this.definition.initMethod]){const Dt=Lt[this.definition.initMethod];if(Gn.Types.isAsyncFunction(Dt)){await Dt.call(Lt)}else{if(Dt.length===1){await new Promise((Tn=>{Dt.call(Lt,Tn)}))}else{Dt.call(Lt)}}}}doDestroy(Dt){if(this.definition.destroyMethod&&Dt[this.definition.destroyMethod]){Dt[this.definition.destroyMethod].call(Dt)}}async doDestroyAsync(Dt){if(this.definition.destroyMethod&&Dt[this.definition.destroyMethod]){const Lt=Dt[this.definition.destroyMethod];if(Gn.Types.isAsyncFunction(Lt)){await Lt.call(Dt)}else{if(Lt.length===1){await new Promise((Tn=>{Lt.call(Dt,Tn)}))}else{Lt.call(Dt)}}}}}Lt.ObjectCreator=ObjectCreator},47698:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectDefinition=void 0;const Wn=Tn(6192);const Gn=Tn(74701);const rr=Tn(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=Wn.ScopeEnum.Singleton;this.creator=null;this.id=null;this.name=null;this.initMethod=null;this.destroyMethod=null;this.constructMethod=null;this.constructorArgs=[];this.path=null;this.export=null;this.dependsOn=[];this.properties=new Gn.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new rr.ObjectCreator(this)}set asynchronous(Dt){this._asynchronous=Dt}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===Wn.ScopeEnum.Singleton}isRequestScope(){return this.scope===Wn.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(Dt){return this._attrs.get(Dt)}hasAttr(Dt){return this._attrs.has(Dt)}setAttr(Dt,Lt){this._attrs.set(Dt,Lt)}}Lt.ObjectDefinition=ObjectDefinition},74701:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(Dt,Lt){if(this.has(Dt)){return this.get(Dt)}return Lt}setProperty(Dt,Lt){return this.set(Dt,Lt)}}Lt.ObjectProperties=ObjectProperties},21769:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayHttpError=Lt.MidwayError=Lt.registerErrorCode=void 0;const Wn=Tn(58611);const Gn=new Set;function registerErrorCode(Dt,Lt){if(Gn.has(Dt)){throw new MidwayError(`Error group ${Dt} is duplicated, please check before adding.`)}else{Gn.add(Dt)}const Tn={};for(const Wn in Lt){Tn[Wn]=Dt.toUpperCase()+"_"+String(Lt[Wn]).toUpperCase()}return Tn}Lt.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(Dt,Lt,Tn){super(Dt);if(!Lt||typeof Lt==="object"){Tn=Lt;Lt="MIDWAY_10000"}this.name=this.constructor.name;this.code=Lt;this.cause=Tn===null||Tn===void 0?void 0:Tn.cause}}Lt.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(Dt,Lt,Tn,Gn){super(Dt?typeof Dt==="string"?Dt:Dt.message:Wn.STATUS_CODES[Lt],Tn!==null&&Tn!==void 0?Tn:String(Lt),Gn);if(Dt&&Dt["stack"]){this.stack=Dt["stack"]}this.status=Lt}}Lt.MidwayHttpError=MidwayHttpError},37198:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayEmptyValueError=Lt.MidwayInvalidConfigPropertyError=Lt.MidwayMainFrameworkMissingError=Lt.MidwayCodeInvokeTimeoutError=Lt.MidwayInvokeForbiddenError=Lt.MidwayRetryExceededMaxTimesError=Lt.MidwayDuplicateControllerOptionsError=Lt.MidwayDuplicateClassNameError=Lt.MidwayInconsistentVersionError=Lt.MidwayUtilHttpClientTimeoutError=Lt.MidwayMissingImportComponentError=Lt.MidwaySingletonInjectRequestError=Lt.MidwayUseWrongMethodError=Lt.MidwayDuplicateRouteError=Lt.MidwayResolverMissingError=Lt.MidwayInvalidConfigError=Lt.MidwayConfigMissingError=Lt.MidwayFeatureNotImplementedError=Lt.MidwayFeatureNoLongerSupportedError=Lt.MidwayDefinitionNotFoundError=Lt.MidwayParameterError=Lt.MidwayCommonError=Lt.FrameworkErrorEnum=void 0;const Wn=Tn(21769);Lt.FrameworkErrorEnum=(0,Wn.registerErrorCode)("midway",{UNKNOWN:1e4,COMMON:10001,PARAM_TYPE:10002,DEFINITION_NOT_FOUND:10003,FEATURE_NO_LONGER_SUPPORTED:10004,FEATURE_NOT_IMPLEMENTED:10004,MISSING_CONFIG:10006,MISSING_RESOLVER:10007,DUPLICATE_ROUTER:10008,USE_WRONG_METHOD:10009,SINGLETON_INJECT_REQUEST:10010,MISSING_IMPORTS:10011,UTIL_HTTP_TIMEOUT:10012,INCONSISTENT_VERSION:10013,INVALID_CONFIG:10014,DUPLICATE_CLASS_NAME:10015,DUPLICATE_CONTROLLER_PREFIX_OPTIONS:10016,RETRY_OVER_MAX_TIME:10017,INVOKE_METHOD_FORBIDDEN:10018,CODE_INVOKE_TIMEOUT:10019,MAIN_FRAMEWORK_MISSING:10020,INVALID_CONFIG_PROPERTY:10021,EMPTY_VALUE:10022});class MidwayCommonError extends Wn.MidwayError{constructor(Dt){super(Dt,Lt.FrameworkErrorEnum.COMMON)}}Lt.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends Wn.MidwayError{constructor(Dt){super(Dt!==null&&Dt!==void 0?Dt:"Parameter type not match",Lt.FrameworkErrorEnum.PARAM_TYPE)}}Lt.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends Wn.MidwayError{static isClosePrototypeOf(Dt){return Dt?Dt[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(Dt){super(`${Dt} is not valid in current context`,Lt.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(Dt){const Lt=this.message.split(" is not valid in current context")[0];this.message=`${Lt} in class ${Dt} is not valid in current context`}}Lt.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends Wn.MidwayError{constructor(Dt){super("This feature no longer supported \n"+Dt,Lt.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}Lt.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends Wn.MidwayError{constructor(Dt){super("This feature not implemented \n"+Dt,Lt.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}Lt.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends Wn.MidwayError{constructor(Dt){super(`Can't found config key "${Dt}" in your config, please set it first`,Lt.FrameworkErrorEnum.MISSING_CONFIG)}}Lt.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends Wn.MidwayError{constructor(Dt){super("Invalid config file \n"+Dt,Lt.FrameworkErrorEnum.INVALID_CONFIG)}}Lt.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends Wn.MidwayError{constructor(Dt){super(`Resolver "${Dt}" is missing.`,Lt.FrameworkErrorEnum.MISSING_RESOLVER)}}Lt.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`Duplicate router "${Dt}" at "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_ROUTER)}}Lt.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends Wn.MidwayError{constructor(Dt,Tn,Wn){const Gn=Wn?`${Wn} not valid by ${Dt}, Use ${Tn} instead!`:`You should not invoked by ${Dt}, Use ${Tn} instead!`;super(Gn,Lt.FrameworkErrorEnum.USE_WRONG_METHOD)}}Lt.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends Wn.MidwayError{constructor(Dt,Tn){const Wn=`${Dt} with singleton scope can't implicitly inject ${Tn} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${Tn} or use "ctx.requestContext.getAsync(${Tn})".`;super(Wn,Lt.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}Lt.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends Wn.MidwayError{constructor(Dt){const Tn=`"${Dt}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(Tn,Lt.FrameworkErrorEnum.MISSING_IMPORTS)}}Lt.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends Wn.MidwayError{constructor(Dt){super(Dt,Lt.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}Lt.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends Wn.MidwayError{constructor(){const Dt='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(Dt,Lt.FrameworkErrorEnum.INCONSISTENT_VERSION)}}Lt.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`"${Dt}" duplicated between "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}Lt.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`"Prefix ${Dt}" with duplicated controller options between "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}Lt.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`Invoke "${Dt}" retries exceeded the maximum number of times(${Tn}), error: ${Wn.message}`,Lt.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:Wn})}}Lt.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invoke "${Tn?Tn.name:"unknown"}.${Dt}" is forbidden.`,Lt.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}Lt.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invoke "${Dt}" running timeout(${Tn}ms)`,Lt.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}Lt.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends Wn.MidwayError{constructor(){super("Main framework missing, please check your configuration.",Lt.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}Lt.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invalid config property "${Dt}", ${Tn?`only ${Tn.join(",")} can be set`:"please check your configuration"}.`,Lt.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}Lt.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends Wn.MidwayError{constructor(Dt){super(Dt!==null&&Dt!==void 0?Dt:"There is an empty value got and it is not allowed.",Lt.FrameworkErrorEnum.EMPTY_VALUE)}}Lt.MidwayEmptyValueError=MidwayEmptyValueError},9504:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.httpError=Lt.GatewayTimeoutError=Lt.ServiceUnavailableError=Lt.BadGatewayError=Lt.NotImplementedError=Lt.InternalServerErrorError=Lt.TooManyRequestsError=Lt.UnprocessableEntityError=Lt.UnsupportedMediaTypeError=Lt.PayloadTooLargeError=Lt.GoneError=Lt.ConflictError=Lt.RequestTimeoutError=Lt.NotAcceptableError=Lt.ForbiddenError=Lt.NotFoundError=Lt.UnauthorizedError=Lt.BadRequestError=Lt.HttpStatus=void 0;const Wn=Tn(21769);var Gn;(function(Dt){Dt[Dt["CONTINUE"]=100]="CONTINUE";Dt[Dt["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Dt[Dt["PROCESSING"]=102]="PROCESSING";Dt[Dt["EARLYHINTS"]=103]="EARLYHINTS";Dt[Dt["OK"]=200]="OK";Dt[Dt["CREATED"]=201]="CREATED";Dt[Dt["ACCEPTED"]=202]="ACCEPTED";Dt[Dt["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Dt[Dt["NO_CONTENT"]=204]="NO_CONTENT";Dt[Dt["RESET_CONTENT"]=205]="RESET_CONTENT";Dt[Dt["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Dt[Dt["AMBIGUOUS"]=300]="AMBIGUOUS";Dt[Dt["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Dt[Dt["FOUND"]=302]="FOUND";Dt[Dt["SEE_OTHER"]=303]="SEE_OTHER";Dt[Dt["NOT_MODIFIED"]=304]="NOT_MODIFIED";Dt[Dt["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Dt[Dt["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Dt[Dt["BAD_REQUEST"]=400]="BAD_REQUEST";Dt[Dt["UNAUTHORIZED"]=401]="UNAUTHORIZED";Dt[Dt["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Dt[Dt["FORBIDDEN"]=403]="FORBIDDEN";Dt[Dt["NOT_FOUND"]=404]="NOT_FOUND";Dt[Dt["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Dt[Dt["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Dt[Dt["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Dt[Dt["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Dt[Dt["CONFLICT"]=409]="CONFLICT";Dt[Dt["GONE"]=410]="GONE";Dt[Dt["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Dt[Dt["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Dt[Dt["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Dt[Dt["URI_TOO_LONG"]=414]="URI_TOO_LONG";Dt[Dt["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Dt[Dt["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Dt[Dt["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Dt[Dt["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Dt[Dt["MISDIRECTED"]=421]="MISDIRECTED";Dt[Dt["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Dt[Dt["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Dt[Dt["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Dt[Dt["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Dt[Dt["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Dt[Dt["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Dt[Dt["BAD_GATEWAY"]=502]="BAD_GATEWAY";Dt[Dt["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Dt[Dt["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Dt[Dt["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(Gn=Lt.HttpStatus||(Lt.HttpStatus={}));class BadRequestError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.BAD_REQUEST)}}Lt.BadRequestError=BadRequestError;class UnauthorizedError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNAUTHORIZED)}}Lt.UnauthorizedError=UnauthorizedError;class NotFoundError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_FOUND)}}Lt.NotFoundError=NotFoundError;class ForbiddenError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.FORBIDDEN)}}Lt.ForbiddenError=ForbiddenError;class NotAcceptableError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_ACCEPTABLE)}}Lt.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.REQUEST_TIMEOUT)}}Lt.RequestTimeoutError=RequestTimeoutError;class ConflictError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.CONFLICT)}}Lt.ConflictError=ConflictError;class GoneError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.GONE)}}Lt.GoneError=GoneError;class PayloadTooLargeError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.PAYLOAD_TOO_LARGE)}}Lt.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNSUPPORTED_MEDIA_TYPE)}}Lt.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNPROCESSABLE_ENTITY)}}Lt.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.TOO_MANY_REQUESTS)}}Lt.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.INTERNAL_SERVER_ERROR)}}Lt.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_IMPLEMENTED)}}Lt.NotImplementedError=NotImplementedError;class BadGatewayError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.BAD_GATEWAY)}}Lt.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.SERVICE_UNAVAILABLE)}}Lt.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.GATEWAY_TIMEOUT)}}Lt.GatewayTimeoutError=GatewayTimeoutError;Lt.httpError={BadRequestError:BadRequestError,UnauthorizedError:UnauthorizedError,NotFoundError:NotFoundError,ForbiddenError:ForbiddenError,NotAcceptableError:NotAcceptableError,RequestTimeoutError:RequestTimeoutError,ConflictError:ConflictError,GoneError:GoneError,PayloadTooLargeError:PayloadTooLargeError,UnsupportedMediaTypeError:UnsupportedMediaTypeError,UnprocessableEntityError:UnprocessableEntityError,TooManyRequestsError:TooManyRequestsError,InternalServerErrorError:InternalServerErrorError,NotImplementedError:NotImplementedError,BadGatewayError:BadGatewayError,ServiceUnavailableError:ServiceUnavailableError,GatewayTimeoutError:GatewayTimeoutError}},86314:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.httpError=Lt.HttpStatus=void 0;Gn(Tn(21769),Lt);var rr=Tn(9504);Object.defineProperty(Lt,"HttpStatus",{enumerable:true,get:function(){return rr.HttpStatus}});Object.defineProperty(Lt,"httpError",{enumerable:true,get:function(){return rr.httpError}});Gn(Tn(37198),Lt)},24451:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createConfiguration=Lt.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(Dt){this.options=Dt;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(Dt,Lt){if(typeof Dt==="function"){this.configLoadHandler=Dt}else{return this.configLoadHandler(Dt,Lt)}return this}onReady(Dt,Lt){if(typeof Dt==="function"){this.readyHandler=Dt}else{return this.readyHandler(Dt,Lt)}return this}onServerReady(Dt,Lt){if(typeof Dt==="function"){this.serverReadyHandler=Dt}else{return this.serverReadyHandler(Dt,Lt)}return this}onStop(Dt,Lt){if(typeof Dt==="function"){this.stopHandler=Dt}else{return this.stopHandler(Dt,Lt)}return this}getConfigurationOptions(){return this.options}}Lt.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=Dt=>new FunctionalConfiguration(Dt);Lt.createConfiguration=createConfiguration},46123:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPerformanceManager=Lt.TypedResourceManager=Lt.HttpServerResponse=Lt.ServerResponse=Lt.FORMAT=Lt.FileUtils=Lt.PathFileUtil=Lt.Types=Lt.retryWith=Lt.retryWithAsync=Lt.extend=Lt.Utils=Lt.sleep=Lt.isTypeScriptEnvironment=Lt.wrapAsync=Lt.wrapMiddleware=Lt.pathMatching=Lt.transformRequestObjectByType=Lt.deprecatedOutput=Lt.delegateTargetAllPrototypeMethod=Lt.delegateTargetProperties=Lt.delegateTargetMethod=Lt.delegateTargetPrototypeMethod=Lt.loadModule=Lt.safeRequire=Lt.safelyGet=Lt.ASYNC_ROOT_CONTEXT=Lt.MidwayPriorityManager=Lt.DEFAULT_PRIORITY=Lt.DataSourceManager=Lt.WebRouterCollector=Lt.MidwayServerlessFunctionService=Lt.MidwayWebRouterService=Lt.MidwayHealthService=Lt.MidwayMockService=Lt.MidwayDecoratorService=Lt.MidwayMiddlewareService=Lt.MidwayLifeCycleService=Lt.MidwayAspectService=Lt.MidwayFrameworkService=Lt.MidwayLoggerService=Lt.MidwayInformationService=Lt.MidwayEnvironmentService=Lt.MidwayConfigService=Lt.FunctionalConfiguration=Lt.createConfiguration=Lt.BaseFramework=Lt.MidwayRequestContainer=void 0;Gn(Tn(6192),Lt);Gn(Tn(9288),Lt);var rr=Tn(97983);Object.defineProperty(Lt,"MidwayRequestContainer",{enumerable:true,get:function(){return rr.MidwayRequestContainer}});var cr=Tn(83872);Object.defineProperty(Lt,"BaseFramework",{enumerable:true,get:function(){return cr.BaseFramework}});Gn(Tn(28695),Lt);Gn(Tn(2222),Lt);var pr=Tn(24451);Object.defineProperty(Lt,"createConfiguration",{enumerable:true,get:function(){return pr.createConfiguration}});Object.defineProperty(Lt,"FunctionalConfiguration",{enumerable:true,get:function(){return pr.FunctionalConfiguration}});var mr=Tn(78842);Object.defineProperty(Lt,"MidwayConfigService",{enumerable:true,get:function(){return mr.MidwayConfigService}});var gr=Tn(70275);Object.defineProperty(Lt,"MidwayEnvironmentService",{enumerable:true,get:function(){return gr.MidwayEnvironmentService}});var yr=Tn(37482);Object.defineProperty(Lt,"MidwayInformationService",{enumerable:true,get:function(){return yr.MidwayInformationService}});var Sr=Tn(34888);Object.defineProperty(Lt,"MidwayLoggerService",{enumerable:true,get:function(){return Sr.MidwayLoggerService}});var Er=Tn(33332);Object.defineProperty(Lt,"MidwayFrameworkService",{enumerable:true,get:function(){return Er.MidwayFrameworkService}});var Or=Tn(70812);Object.defineProperty(Lt,"MidwayAspectService",{enumerable:true,get:function(){return Or.MidwayAspectService}});var Ir=Tn(13328);Object.defineProperty(Lt,"MidwayLifeCycleService",{enumerable:true,get:function(){return Ir.MidwayLifeCycleService}});var Hr=Tn(68220);Object.defineProperty(Lt,"MidwayMiddlewareService",{enumerable:true,get:function(){return Hr.MidwayMiddlewareService}});var Gr=Tn(96367);Object.defineProperty(Lt,"MidwayDecoratorService",{enumerable:true,get:function(){return Gr.MidwayDecoratorService}});var $r=Tn(77306);Object.defineProperty(Lt,"MidwayMockService",{enumerable:true,get:function(){return $r.MidwayMockService}});var mi=Tn(658);Object.defineProperty(Lt,"MidwayHealthService",{enumerable:true,get:function(){return mi.MidwayHealthService}});var ki=Tn(19985);Object.defineProperty(Lt,"MidwayWebRouterService",{enumerable:true,get:function(){return ki.MidwayWebRouterService}});var Ni=Tn(42592);Object.defineProperty(Lt,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return Ni.MidwayServerlessFunctionService}});Object.defineProperty(Lt,"WebRouterCollector",{enumerable:true,get:function(){return Ni.WebRouterCollector}});var Ri=Tn(12849);Object.defineProperty(Lt,"DataSourceManager",{enumerable:true,get:function(){return Ri.DataSourceManager}});var ji=Tn(67934);Object.defineProperty(Lt,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return ji.DEFAULT_PRIORITY}});Object.defineProperty(Lt,"MidwayPriorityManager",{enumerable:true,get:function(){return ji.MidwayPriorityManager}});Gn(Tn(28602),Lt);Gn(Tn(82535),Lt);Gn(Tn(64842),Lt);Gn(Tn(46673),Lt);Gn(Tn(1845),Lt);Gn(Tn(11026),Lt);Gn(Tn(12738),Lt);Gn(Tn(39408),Lt);Gn(Tn(43436),Lt);Gn(Tn(29222),Lt);Gn(Tn(86314),Lt);var Ui=Tn(75351);Object.defineProperty(Lt,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Ui.ASYNC_ROOT_CONTEXT}});Gn(Tn(49757),Lt);Gn(Tn(45317),Lt);Gn(Tn(75105),Lt);var Vi=Tn(65308);Object.defineProperty(Lt,"safelyGet",{enumerable:true,get:function(){return Vi.safelyGet}});Object.defineProperty(Lt,"safeRequire",{enumerable:true,get:function(){return Vi.safeRequire}});Object.defineProperty(Lt,"loadModule",{enumerable:true,get:function(){return Vi.loadModule}});Object.defineProperty(Lt,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Vi.delegateTargetPrototypeMethod}});Object.defineProperty(Lt,"delegateTargetMethod",{enumerable:true,get:function(){return Vi.delegateTargetMethod}});Object.defineProperty(Lt,"delegateTargetProperties",{enumerable:true,get:function(){return Vi.delegateTargetProperties}});Object.defineProperty(Lt,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Vi.delegateTargetAllPrototypeMethod}});Object.defineProperty(Lt,"deprecatedOutput",{enumerable:true,get:function(){return Vi.deprecatedOutput}});Object.defineProperty(Lt,"transformRequestObjectByType",{enumerable:true,get:function(){return Vi.transformRequestObjectByType}});Object.defineProperty(Lt,"pathMatching",{enumerable:true,get:function(){return Vi.pathMatching}});Object.defineProperty(Lt,"wrapMiddleware",{enumerable:true,get:function(){return Vi.wrapMiddleware}});Object.defineProperty(Lt,"wrapAsync",{enumerable:true,get:function(){return Vi.wrapAsync}});Object.defineProperty(Lt,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Vi.isTypeScriptEnvironment}});Object.defineProperty(Lt,"sleep",{enumerable:true,get:function(){return Vi.sleep}});Object.defineProperty(Lt,"Utils",{enumerable:true,get:function(){return Vi.Utils}});var zi=Tn(83486);Object.defineProperty(Lt,"extend",{enumerable:true,get:function(){return zi.extend}});Gn(Tn(46422),Lt);Gn(Tn(50539),Lt);Gn(Tn(73861),Lt);Gn(Tn(87653),Lt);var Ki=Tn(25198);Object.defineProperty(Lt,"retryWithAsync",{enumerable:true,get:function(){return Ki.retryWithAsync}});Object.defineProperty(Lt,"retryWith",{enumerable:true,get:function(){return Ki.retryWith}});var $i=Tn(63289);Object.defineProperty(Lt,"Types",{enumerable:true,get:function(){return $i.Types}});var Xi=Tn(61327);Object.defineProperty(Lt,"PathFileUtil",{enumerable:true,get:function(){return Xi.PathFileUtil}});var Yi=Tn(7589);Object.defineProperty(Lt,"FileUtils",{enumerable:true,get:function(){return Yi.FileUtils}});var Wo=Tn(30001);Object.defineProperty(Lt,"FORMAT",{enumerable:true,get:function(){return Wo.FORMAT}});var Ho=Tn(89995);Object.defineProperty(Lt,"ServerResponse",{enumerable:true,get:function(){return Ho.ServerResponse}});Object.defineProperty(Lt,"HttpServerResponse",{enumerable:true,get:function(){return Ho.HttpServerResponse}});var Go=Tn(11330);Object.defineProperty(Lt,"TypedResourceManager",{enumerable:true,get:function(){return Go.TypedResourceManager}});var Xo=Tn(70032);Object.defineProperty(Lt,"MidwayPerformanceManager",{enumerable:true,get:function(){return Xo.MidwayPerformanceManager}})},6192:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayProcessTypeEnum=Lt.ObjectLifeCycleEvent=Lt.ServerlessTriggerType=Lt.MidwayFrameworkType=Lt.FrameworkType=Lt.MSListenerType=Lt.MSProviderType=Lt.InjectModeEnum=Lt.ScopeEnum=void 0;var Tn;(function(Dt){Dt["Singleton"]="Singleton";Dt["Request"]="Request";Dt["Prototype"]="Prototype"})(Tn=Lt.ScopeEnum||(Lt.ScopeEnum={}));var Wn;(function(Dt){Dt["Identifier"]="Identifier";Dt["Class"]="Class";Dt["PropertyName"]="PropertyName"})(Wn=Lt.InjectModeEnum||(Lt.InjectModeEnum={}));var Gn;(function(Dt){Dt["DUBBO"]="dubbo";Dt["GRPC"]="gRPC"})(Gn=Lt.MSProviderType||(Lt.MSProviderType={}));var rr;(function(Dt){Dt["RABBITMQ"]="rabbitmq";Dt["MQTT"]="mqtt";Dt["KAFKA"]="kafka";Dt["REDIS"]="redis"})(rr=Lt.MSListenerType||(Lt.MSListenerType={}));class FrameworkType{}Lt.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(Dt){super();this.name=Dt}}Lt.MidwayFrameworkType=MidwayFrameworkType;MidwayFrameworkType.WEB=new MidwayFrameworkType("@midwayjs/web");MidwayFrameworkType.WEB_KOA=new MidwayFrameworkType("@midwayjs/web-koa");MidwayFrameworkType.WEB_EXPRESS=new MidwayFrameworkType("@midwayjs/express");MidwayFrameworkType.FAAS=new MidwayFrameworkType("@midwayjs/faas");MidwayFrameworkType.MS_GRPC=new MidwayFrameworkType("@midwayjs/grpc");MidwayFrameworkType.MS_RABBITMQ=new MidwayFrameworkType("@midwayjs/rabbitmq");MidwayFrameworkType.MS_KAFKA=new MidwayFrameworkType("@midwayjs/kafka");MidwayFrameworkType.WS_IO=new MidwayFrameworkType("@midwayjs/socketio");MidwayFrameworkType.WS=new MidwayFrameworkType("@midwayjs/ws");MidwayFrameworkType.SERVERLESS_APP=new MidwayFrameworkType("@midwayjs/serverless-app");MidwayFrameworkType.CUSTOM=new MidwayFrameworkType("");MidwayFrameworkType.EMPTY=new MidwayFrameworkType("empty");MidwayFrameworkType.LIGHT=new MidwayFrameworkType("light");MidwayFrameworkType.TASK=new MidwayFrameworkType("@midwayjs/task");var cr;(function(Dt){Dt["EVENT"]="event";Dt["HTTP"]="http";Dt["API_GATEWAY"]="apigw";Dt["OS"]="os";Dt["CDN"]="cdn";Dt["LOG"]="log";Dt["TIMER"]="timer";Dt["MQ"]="mq";Dt["KAFKA"]="kafka";Dt["HSF"]="hsf";Dt["MTOP"]="mtop";Dt["SSR"]="ssr"})(cr=Lt.ServerlessTriggerType||(Lt.ServerlessTriggerType={}));var pr;(function(Dt){Dt["BEFORE_BIND"]="beforeBind";Dt["BEFORE_CREATED"]="beforeObjectCreated";Dt["AFTER_CREATED"]="afterObjectCreated";Dt["AFTER_INIT"]="afterObjectInit";Dt["BEFORE_DESTROY"]="beforeObjectDestroy"})(pr=Lt.ObjectLifeCycleEvent||(Lt.ObjectLifeCycleEvent={}));var mr;(function(Dt){Dt["APPLICATION"]="APPLICATION";Dt["AGENT"]="AGENT"})(mr=Lt.MidwayProcessTypeEnum||(Lt.MidwayProcessTypeEnum={}))},72838:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerResponse=void 0;class ServerResponse{constructor(Dt){this.isSuccess=true;this.ctx=Dt}json(Dt){return Object.getPrototypeOf(this).constructor.JSON_TPL(Dt,this.isSuccess,this.ctx)}text(Dt){return Object.getPrototypeOf(this).constructor.TEXT_TPL(Dt,this.isSuccess,this.ctx)}blob(Dt){return Object.getPrototypeOf(this).constructor.BLOB_TPL(Dt,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}Lt.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(Dt,Lt,Tn)=>Dt;ServerResponse.JSON_TPL=(Dt,Lt,Tn)=>{if(Lt){return{success:"true",data:Dt}}else{return{success:"false",message:Dt||"fail"}}};ServerResponse.BLOB_TPL=(Dt,Lt,Tn)=>Dt},91959:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpServerResponse=void 0;const Wn=Tn(79896);const Gn=Tn(72838);const rr=Tn(82738);const cr=Tn(37407);const pr=Tn(16928);class HttpServerResponse extends Gn.ServerResponse{constructor(Dt){super(Dt)}status(Dt){this.ctx.res.statusCode=Dt;return this}header(Dt,Lt){this.ctx.res.setHeader(Dt,Lt);return this}headers(Dt){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(Dt)))}else{for(const Lt in Dt){this.header(Lt,Dt[Lt])}}return this}json(Dt){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(Dt,this.isSuccess,this.ctx)}text(Dt){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(Dt,this.isSuccess,this.ctx)}file(Dt,Lt){this.header("Content-Type",Lt||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,pr.basename)(Dt)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof Dt==="string"?(0,Wn.createReadStream)(Dt):Dt,this.isSuccess,this.ctx)}blob(Dt,Lt){this.header("Content-Type",Lt||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(Dt,this.isSuccess,this.ctx)}html(Dt){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(Dt,this.isSuccess,this.ctx)}redirect(Dt,Lt=302){this.status(Lt);if(this.ctx.redirect){return this.ctx.redirect(Dt)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(Dt)}else{this.header("Location",Dt)}}sse(Dt={}){return new rr.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...Dt})}stream(Dt={}){return new cr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...Dt})}}Lt.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(Dt,Lt,Tn)=>Dt;HttpServerResponse.SSE_TPL=(Dt,Lt)=>Dt;HttpServerResponse.STREAM_TPL=(Dt,Lt)=>Dt;HttpServerResponse.HTML_TPL=(Dt,Lt,Tn)=>Dt},89995:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpServerResponse=Lt.ServerResponse=void 0;var Wn=Tn(72838);Object.defineProperty(Lt,"ServerResponse",{enumerable:true,get:function(){return Wn.ServerResponse}});var Gn=Tn(91959);Object.defineProperty(Lt,"HttpServerResponse",{enumerable:true,get:function(){return Gn.HttpServerResponse}})},82738:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerSendEventStream=void 0;const Wn=Tn(2203);class ServerSendEventStream extends Wn.Transform{constructor(Dt,Lt={}){super({objectMode:true,...Lt});this.isActive=false;this.ctx=Dt;this.closeEvent=Lt.closeEvent||"close";this.options=Lt;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(Dt,Lt,Tn){try{let Lt,Wn="data: ";const Gn=/^\s*:\s*/;const rr=[];if(!this.isActive){this.isActive=true;const Dt={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const Lt in Dt){this.ctx.res.setHeader(Lt,Dt[Lt])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);rr.push(": ok")}const cr=Dt;if(cr.event)rr.push("event: "+cr.event);if(cr.retry)rr.push("retry: "+cr.retry);if(cr.id)rr.push("id: "+cr.id);if(typeof cr.data==="object"){Lt=JSON.stringify(cr.data);rr.push(Wn+Lt)}else if(typeof cr.data==="undefined"){rr.push(Wn)}else{cr.data=String(cr.data);if(cr.data.search(Gn)!==-1){cr.data=cr.data.replace(Gn,"");Wn=": "}cr.data=cr.data.replace(/(\r\n|\r|\n)/g,"\n");Lt=cr.data.split(/\n/);for(let Dt=0,Tn=Lt.length;Dt<Tn;++Dt){const Gn=Lt[Dt];if(Dt+1===Tn){rr.push(Wn+Gn)}else{rr.push(Wn+Gn)}}}this.push(rr.join("\n")+"\n\n");Tn()}catch(Dt){this.ctx.logger.error(Dt);this.sendError(Dt);this.end();Tn(Dt)}}sendError(Dt){this.send({event:"error",data:Dt.message||"An error occurred"})}sendEnd(Dt){Dt.event=this.closeEvent;this.send(Dt)}send(Dt){super.write(this.options.tpl(Dt,this.ctx))}handleClose(){this.end()}}Lt.ServerSendEventStream=ServerSendEventStream},37407:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpStreamResponse=void 0;const Wn=Tn(2203);class HttpStreamResponse extends Wn.Transform{constructor(Dt,Lt={}){super({objectMode:true,...Lt});this.isActive=false;this.ctx=Dt;this.options=Lt}_transform(Dt,Lt,Tn){try{if(!this.isActive){this.isActive=true;this.ctx.res.statusCode=200;this.ctx.res.setHeader("Transfer-Encoding","chunked");this.ctx.res.setHeader("Cache-Control","no-cache");this.ctx.req.socket.setTimeout(0)}if(typeof Dt==="string"){this.ctx.res.write(Dt)}else{this.ctx.res.write(JSON.stringify(Dt))}Tn()}catch(Dt){this.ctx.logger.error(Dt);this.end();this.ctx.res.end();Tn(Dt)}}send(Dt){if(!this.writable){return}this.write(this.options.tpl(Dt,this.ctx))}sendError(Dt){this.ctx.logger.error(Dt);this.end();this.ctx.res.end()}_flush(Dt){this.ctx.res.end();Dt()}}Lt.HttpStreamResponse=HttpStreamResponse},70812:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayAspectService=void 0;const rr=Tn(65675);const cr=Tn(6192);const pr=Tn(49757);const mr=Tn(63289);let gr=class MidwayAspectService{constructor(Dt){this.applicationContext=Dt}async loadAspect(){const Dt=(0,pr.listModule)(pr.ASPECT_KEY);let Lt=[];for(const Tn of Dt){const Dt=(0,pr.getClassMetadata)(pr.ASPECT_KEY,Tn);Lt=Lt.concat(Dt.map((Dt=>{Dt.aspectModule=Tn;return Dt})))}Lt.sort(((Dt,Lt)=>(Lt.priority||0)-(Dt.priority||0)));for(const Dt of Lt){const Lt=await this.applicationContext.getAsync(Dt.aspectModule);await this.addAspect(Lt,Dt)}}async addAspect(Dt,Lt){const Tn=Lt.aspectTarget;const Wn=Object.getOwnPropertyNames(Tn.prototype);const Gn=Lt.match?rr(Lt.match):()=>true;for(const Lt of Wn){if(Lt==="constructor"||!Gn(Lt)){continue}const Wn=Object.getOwnPropertyDescriptor(Tn.prototype,Lt);if(!Wn||Wn.writable===false){continue}this.interceptPrototypeMethod(Tn,Lt,Dt)}}interceptPrototypeMethod(Dt,Lt,Tn){const Wn=Dt.prototype[Lt];if(mr.Types.isAsyncFunction(Dt.prototype[Lt])){Dt.prototype[Lt]=async function(...Dt){var Gn,rr,cr;let pr,mr;const newProceed=(...Dt)=>Wn.apply(this,Dt);const gr={methodName:Lt,target:this,args:Dt,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof Tn==="function"){Tn=Tn()}try{await((Gn=Tn.before)===null||Gn===void 0?void 0:Gn.call(Tn,gr));if(Tn.around){mr=await Tn.around(gr)}else{mr=await Wn.call(this,...gr.args)}gr.proceed=undefined;const Dt=await((rr=Tn.afterReturn)===null||rr===void 0?void 0:rr.call(Tn,gr,mr));mr=typeof Dt==="undefined"?mr:Dt;return mr}catch(Dt){gr.proceed=undefined;pr=Dt;if(Tn.afterThrow){await Tn.afterThrow(gr,pr)}else{throw Dt}}finally{await((cr=Tn.after)===null||cr===void 0?void 0:cr.call(Tn,gr,mr,pr))}}}else{Dt.prototype[Lt]=function(...Dt){var Gn,rr,cr;let pr,mr;const newProceed=(...Dt)=>Wn.apply(this,Dt);const gr={methodName:Lt,target:this,args:Dt,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof Tn==="function"){Tn=Tn()}try{(Gn=Tn.before)===null||Gn===void 0?void 0:Gn.call(Tn,gr);if(Tn.around){mr=Tn.around(gr)}else{mr=Wn.call(this,...gr.args)}gr.proceed=undefined;const Dt=(rr=Tn.afterReturn)===null||rr===void 0?void 0:rr.call(Tn,gr,mr);mr=typeof Dt==="undefined"?mr:Dt;return mr}catch(Dt){gr.proceed=undefined;pr=Dt;if(Tn.afterThrow){Tn.afterThrow(gr,pr)}else{throw Dt}}finally{(cr=Tn.after)===null||cr===void 0?void 0:cr.call(Tn,gr,mr,pr)}}}}};gr=Wn([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],gr);Lt.MidwayAspectService=gr},78842:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayConfigService=void 0;const rr=Tn(16928);const cr=Tn(6192);const pr=Tn(65308);const mr=Tn(79896);const gr=Tn(39023);const yr=Tn(70275);const Sr=Tn(37482);const Er=Tn(83486);const Or=Tn(86314);const Ir=Tn(49757);const Hr=Tn(63289);const Gr=gr.debuglog("midway:debug");let $r=class MidwayConfigService{constructor(){this.envDirMap=new Map;this.aliasMap={prod:"production",unittest:"test"};this.configMergeOrder=[];this.configuration={};this.isReady=false;this.externalObject=[];this.configFilterList=[]}init(){this.appInfo={pkg:this.informationService.getPkg(),name:this.informationService.getProjectName(),baseDir:this.informationService.getBaseDir(),appDir:this.informationService.getAppDir(),HOME:this.informationService.getHome(),root:this.informationService.getRoot(),env:this.environmentService.getCurrentEnvironment()}}add(Dt){for(const Lt of Dt){if(typeof Lt==="string"){if(/\.\w+$/.test(Lt)){const Dt=this.getConfigEnv(Lt);const Tn=this.getEnvSet(Dt);Tn.add(Lt);if(this.aliasMap[Dt]){this.getEnvSet(this.aliasMap[Dt]).add(Lt)}}else{const Dt=(0,mr.statSync)(Lt);if(Dt.isDirectory()){const Dt=(0,mr.readdirSync)(Lt);this.add(Dt.map((Dt=>(0,rr.join)(Lt,Dt))))}}}else{for(const Dt in Lt){this.getEnvSet(Dt).add(Lt[Dt]);if(this.aliasMap[Dt]){this.getEnvSet(this.aliasMap[Dt]).add(Lt[Dt])}}}}}addObject(Dt,Lt=false){if(this.isReady){Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:Dt});if(Lt){this.configuration=(0,Er.extend)(true,Dt,this.configuration)}else{(0,Er.extend)(true,this.configuration,Dt)}}else{this.externalObject.push(Dt)}}getEnvSet(Dt){if(!this.envDirMap.has(Dt)){this.envDirMap.set(Dt,new Set)}return this.envDirMap.get(Dt)}getConfigEnv(Dt){const Lt=(0,rr.basename)(Dt);const Tn=Lt.split(".");const Wn=Tn.pop();if(Wn!=="js"&&Wn!=="ts"){return Wn}return Tn.pop()}load(){if(this.isReady)return;const Dt=this.getEnvSet("default");const Lt=this.getEnvSet(this.environmentService.getCurrentEnvironment());const Tn={};const Wn=Dt.size;for(const[Gn,rr]of[...Dt,...Lt].entries()){let Dt=this.loadConfig(rr);if(Hr.Types.isFunction(Dt)){Dt=Dt.apply(null,[this.appInfo,Tn])}if(!Dt){continue}Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");continue}if(typeof rr==="string"){Gr("[config]: Loaded config %s, %j",rr,Dt)}else{Gr("[config]: Loaded config %j",Dt)}this.configMergeOrder.push({env:Gn<Wn?"default":this.environmentService.getCurrentEnvironment(),extraPath:rr,value:Dt});(0,Er.extend)(true,Tn,Dt)}if(this.externalObject.length){for(let Dt of this.externalObject){if(Dt){Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");continue}Gr("[config]: Loaded external object %j",Dt);(0,Er.extend)(true,Tn,Dt);this.configMergeOrder.push({env:"default",extraPath:"",value:Dt})}}}this.configuration=Tn;this.isReady=true}getConfiguration(Dt){if(Dt){return(0,pr.safelyGet)(Dt,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(Dt){let Lt=typeof Dt==="string"?require(Dt):Dt;if(Lt&&Lt.__esModule){if(Lt&&Lt.default){if(Object.keys(Lt).length>1){throw new Or.MidwayInvalidConfigError(`${Dt} should not have both a default export and named export`)}Lt=Lt.default}}return Lt}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(Dt){this.configFilterList.push(Dt)}runWithFilter(Dt){for(const Lt of this.configFilterList){Gr(`[config]: Filter config by filter = "${Lt.name||"anonymous filter"}"`);Dt=Lt(Dt);Gr("[config]: Filter config result = %j",Dt)}return Dt}getAppInfo(){return this.appInfo}};Wn([(0,Ir.Inject)(),Gn("design:type",yr.MidwayEnvironmentService)],$r.prototype,"environmentService",void 0);Wn([(0,Ir.Inject)(),Gn("design:type",Sr.MidwayInformationService)],$r.prototype,"informationService",void 0);Wn([(0,Ir.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],$r.prototype,"init",null);$r=Wn([(0,Ir.Provide)(),(0,Ir.Scope)(cr.ScopeEnum.Singleton)],$r);Lt.MidwayConfigService=$r},96367:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayDecoratorService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(70812);const mr=Tn(86314);const gr=Tn(39023);const yr=Tn(63289);const Sr=gr.debuglog("midway:debug");let Er=class MidwayDecoratorService{constructor(Dt){this.applicationContext=Dt;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((Dt=>{const Lt=(0,rr.getClassMetadata)(rr.INJECT_CUSTOM_METHOD,Dt);if(Lt){for(const Tn of Lt){const{propertyName:Lt,key:Wn,metadata:Gn,options:rr}=Tn;if(!rr||!rr.impl){continue}this.aspectService.interceptPrototypeMethod(Dt,Lt,(()=>{const Tn=this.methodDecoratorMap.get(Wn);if(!Tn){throw new mr.MidwayCommonError(`Method Decorator "${Wn}" handler not found, please register first.`)}return Tn({target:Dt,propertyName:Lt,metadata:Gn})}))}}const Tn=(0,rr.getClassMetadata)(rr.INJECT_CUSTOM_PARAM,Dt);if(Tn){for(const Lt of Object.keys(Tn)){this.aspectService.interceptPrototypeMethod(Dt,Lt,(()=>({before:async Wn=>{const Gn=[...Wn.args];for(const cr of Tn[Lt]){const{propertyName:Lt,key:Tn,metadata:pr,parameterIndex:gr,options:Er}=cr;let Or;if(Er&&Er.impl){Or=this.parameterDecoratorMap.get(Tn);if(!Or){throw new mr.MidwayCommonError(`Parameter Decorator "${Tn}" handler not found, please register first.`)}}else{Or=async({parameterIndex:Dt,originArgs:Lt})=>Lt[Dt]}const Ir=(0,rr.getMethodParamTypes)(Dt,Lt);let Hr=false;try{Gn[gr]=await Or({metadata:pr,propertyName:Lt,parameterIndex:gr,target:Dt,originArgs:Gn,originParamType:Ir[gr],instance:Wn.target})}catch(Dt){Hr=true;if((Er===null||Er===void 0?void 0:Er.throwError)===true){throw Dt}else{Sr(`[core]: Parameter decorator throw error and use origin args, ${Dt.stack}`)}}if(Hr){continue}const Gr=[...this.parameterDecoratorPipes.get(Tn)||[],...(Er===null||Er===void 0?void 0:Er.pipes)||[]];for(const Dt of Gr){let Lt;if("transform"in Dt){Lt=Dt["transform"].bind(Dt)}else if((0,yr.isClass)(Dt)){const Tn=await this.applicationContext.getAsync(Dt);Lt=Tn.transform.bind(Tn)}else if(typeof Dt==="function"){Lt=Dt}else{throw new mr.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}Gn[gr]=await Lt(Gn[gr],{metaType:(0,rr.transformTypeFromTSDesign)(Ir[gr]),metadata:pr,target:Wn.target,methodName:Wn.methodName})}}Wn.args=Gn}})))}}}));this.applicationContext.onObjectCreated(((Dt,Lt)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(Lt.definition.handlerProps)){for(const Tn of Lt.definition.handlerProps){this.defineGetterPropertyValue(Tn,Dt,this.getHandler(Tn.key))}}}));this.registerPropertyHandler(rr.APPLICATION_CONTEXT_KEY,((Dt,Lt)=>this.applicationContext))}registerPropertyHandler(Dt,Lt){Sr(`[core]: Register property decorator key="${Dt}"`);this.propertyHandlerMap.set(Dt,Lt)}registerMethodHandler(Dt,Lt){Sr(`[core]: Register method decorator key="${Dt}"`);this.methodDecoratorMap.set(Dt,Lt)}registerParameterHandler(Dt,Lt){Sr(`[core]: Register parameter decorator key="${Dt}"`);this.parameterDecoratorMap.set(Dt,Lt)}registerParameterPipes(Dt,Lt){if(!this.parameterDecoratorPipes.has(Dt)){this.parameterDecoratorPipes.set(Dt,[])}this.parameterDecoratorPipes.set(Dt,this.parameterDecoratorPipes.get(Dt).concat(Lt))}defineGetterPropertyValue(Dt,Lt,Tn){if(Dt&&Tn){if(Dt.propertyName){Object.defineProperty(Lt,Dt.propertyName,{get:()=>{var Wn;return Tn(Dt.propertyName,(Wn=Dt.metadata)!==null&&Wn!==void 0?Wn:{},Lt)},configurable:true,enumerable:true})}}}getHandler(Dt){if(this.propertyHandlerMap.has(Dt)){return this.propertyHandlerMap.get(Dt)}}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayAspectService)],Er.prototype,"aspectService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],Er.prototype,"init",null);Er=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Er);Lt.MidwayDecoratorService=Er},70275:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayEnvironmentService=void 0;const Gn=Tn(6192);const rr=Tn(65308);const cr=Tn(49757);let pr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,rr.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(Dt){this.environment=Dt}isDevelopmentEnvironment(){return(0,rr.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(Dt){this.moduleLoadType=Dt}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};pr=Wn([(0,cr.Provide)(),(0,cr.Scope)(Gn.ScopeEnum.Singleton)],pr);Lt.MidwayEnvironmentService=pr},33332:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayFrameworkService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(78842);const mr=Tn(34888);const gr=Tn(83872);const yr=Tn(28602);const Sr=Tn(96367);const Er=Tn(70812);const Or=Tn(43436);const Ir=Tn(39023);const Hr=Tn(86314);const Gr=Tn(2222);const $r=Tn(70032);const mi=Ir.debuglog("midway:debug");let ki=class MidwayFrameworkService{constructor(Dt,Lt){this.applicationContext=Dt;this.globalOptions=Lt;this.globalFrameworkList=[]}async init(){var Dt,Lt;this.decoratorService.registerPropertyHandler(rr.CONFIG_KEY,((Dt,Lt)=>{var Tn;if(Lt.identifier===rr.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt)}}));this.decoratorService.registerPropertyHandler(rr.LOGGER_KEY,((Dt,Lt)=>{var Tn;return this.loggerService.getLogger((Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt)}));this.decoratorService.registerPropertyHandler(rr.PIPELINE_IDENTIFIER,((Dt,Lt,Tn)=>{var Wn,Gn;return new yr.MidwayPipelineService((Gn=(Wn=Tn[Gr.REQUEST_OBJ_CTX_KEY])===null||Wn===void 0?void 0:Wn.requestContext)!==null&&Gn!==void 0?Gn:this.applicationContext,Lt.valves)}));this.decoratorService.registerPropertyHandler(rr.APPLICATION_KEY,((Dt,Lt)=>{if(Lt.type){const Dt=this.applicationManager.getApplication(Lt.type);if(!Dt){throw new Hr.MidwayCommonError(`Framework ${Lt.type} not Found`)}return Dt}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(rr.PLUGIN_KEY,((Dt,Lt)=>{var Tn;return this.getMainApp()[(Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt]}));this.decoratorService.registerPropertyHandler(rr.FACTORY_SERVICE_CLIENT_KEY,((Dt,Lt)=>{const Tn=this.applicationContext.get(Lt.serviceFactoryClz);const Wn=Lt.clientName||Tn.getDefaultClientName();if(Wn&&Tn.has(Wn)){return Tn.get(Wn)}else{if(!Wn){throw new Hr.MidwayParameterError(`Please set clientName or options.defaultClientName for ${Lt.serviceFactoryClz.name}).`)}else{throw new Hr.MidwayParameterError(`ClientName(${Wn} not found in ${Lt.serviceFactoryClz.name}).`)}}}));let Tn=(0,rr.listModule)(rr.FRAMEWORK_KEY);Tn=filterProtoFramework(Tn);mi(`[core]: Found Framework length = ${Tn.length}`);if(Tn.length){for(const Lt of Tn){if(!this.applicationContext.hasDefinition((0,rr.getProviderUUId)(Lt))){mi(`[core]: Found Framework "${Lt.name}" but missing definition, skip initialize.`);continue}const Tn=await this.applicationContext.getAsync(Lt,[this.applicationContext]);if(Tn.isEnable()){$r.MidwayInitializerPerformanceManager.frameworkInitializeStart(Tn.getFrameworkName());await Tn.initialize({applicationContext:this.applicationContext,namespace:Tn.getNamespace(),...this.globalOptions});$r.MidwayInitializerPerformanceManager.frameworkInitializeEnd(Tn.getFrameworkName());mi(`[core]: Found Framework "${Tn.getFrameworkName()}" and initialize.`)}else{mi(`[core]: Found Framework "${Tn.getFrameworkName()}" and delay initialize.`)}const Wn=this.applicationContext.registry.getDefinition((0,rr.getProviderUUId)(Lt));Tn.setNamespace(Wn===null||Wn===void 0?void 0:Wn.namespace);this.applicationManager.addFramework((Dt=Wn===null||Wn===void 0?void 0:Wn.namespace)!==null&&Dt!==void 0?Dt:Tn.getFrameworkName(),Tn);this.globalFrameworkList.push(Tn)}let Wn;const Gn=this.applicationContext.getNamespaceList();for(const Dt of Gn){const Lt=this.applicationManager.getApplication(Dt);if(Lt){Wn=Dt;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(Lt=this.applicationManager.getFramework(Wn))!==null&&Lt!==void 0?Lt:this.globalFrameworkList[0];mi(`[core]: Current main Framework is "${Wn}".`)}await this.aspectService.loadAspect()}getMainApp(){var Dt;return(Dt=this.mainFramework)===null||Dt===void 0?void 0:Dt.getApplication()}getMainFramework(){return this.mainFramework}getFramework(Dt){return this.applicationManager.getFramework(Dt)}async runFramework(){const Dt=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((Lt,Tn)=>Dt.indexOf(Lt.getNamespace())-Dt.indexOf(Tn.getNamespace())));for(const Dt of this.globalFrameworkList){if(Dt.isEnable()){$r.MidwayInitializerPerformanceManager.frameworkRunStart(Dt.getFrameworkName());await Dt.run();mi(`[core]: Found Framework "${Dt.getFrameworkName()}" and run.`);$r.MidwayInitializerPerformanceManager.frameworkRunEnd(Dt.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((Dt=>Dt.stop())))}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayConfigService)],ki.prototype,"configService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",mr.MidwayLoggerService)],ki.prototype,"loggerService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Er.MidwayAspectService)],ki.prototype,"aspectService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Sr.MidwayDecoratorService)],ki.prototype,"decoratorService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Or.MidwayApplicationManager)],ki.prototype,"applicationManager",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],ki.prototype,"init",null);ki=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object,Object])],ki);Lt.MidwayFrameworkService=ki;function filterProtoFramework(Dt){const Lt=[];for(const Tn of Dt){let Dt=Object.getPrototypeOf(Tn);while(Dt.name&&Dt.name!==gr.BaseFramework.name){Lt.push(Dt);Dt=Object.getPrototypeOf(Dt)}}return Dt.filter((Dt=>!Lt.includes(Dt)))}},658:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayHealthService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(78842);const mr=Tn(65308);let gr=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(Dt){const Lt=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(Lt);for(const Lt of Dt){if(Lt.instance&&Lt.instance["onHealthCheck"]){this.healthCheckMethods.push({item:Lt.instance["onHealthCheck"].bind(Lt.instance),meta:{namespace:Lt.namespace}})}}}async getStatus(){const Dt=await(0,mr.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((Dt=>({item:Dt.item(this.applicationContext),meta:Dt.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(Dt,Lt)=>{if(Dt["status"]!==undefined){return{namespace:Lt.namespace,...Dt}}else{return{status:false,namespace:Lt.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(Dt,Lt)=>({status:false,namespace:Lt.namespace,reason:Dt.message})});const Lt=Dt.find((Dt=>!Dt.status));return{status:!Lt,namespace:Lt===null||Lt===void 0?void 0:Lt.namespace,reason:Lt===null||Lt===void 0?void 0:Lt.reason,results:Dt}}setCheckTimeout(Dt){this.healthCheckTimeout=Dt}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayConfigService)],gr.prototype,"configService",void 0);Wn([(0,rr.ApplicationContext)(),Gn("design:type",Object)],gr.prototype,"applicationContext",void 0);gr=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton)],gr);Lt.MidwayHealthService=gr},37482:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayInformationService=void 0;const rr=Tn(6192);const cr=Tn(65308);const pr=Tn(16928);const mr=Tn(49757);const gr=Tn(79896);let yr=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,pr.dirname)(this.baseDir)}const Dt=(0,pr.join)(this.appDir,"package.json");if((0,gr.existsSync)(Dt)){const Lt=(0,gr.readFileSync)(Dt,{encoding:"utf-8"});this.pkg=JSON.parse(Lt)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,cr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var Dt;return((Dt=this.pkg)===null||Dt===void 0?void 0:Dt["name"])||""}getRoot(){const Dt=(0,cr.isDevelopmentEnvironment)((0,cr.getCurrentEnvironment)());return Dt?this.getAppDir():this.getHome()}};Wn([(0,mr.Inject)(),Gn("design:type",String)],yr.prototype,"appDir",void 0);Wn([(0,mr.Inject)(),Gn("design:type",String)],yr.prototype,"baseDir",void 0);Wn([(0,mr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],yr.prototype,"init",null);yr=Wn([(0,mr.Provide)(),(0,mr.Scope)(rr.ScopeEnum.Singleton)],yr);Lt.MidwayInformationService=yr},13328:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayLifeCycleService=void 0;const rr=Tn(6192);const cr=Tn(49757);const pr=Tn(24451);const mr=Tn(33332);const gr=Tn(78842);const yr=Tn(39023);const Sr=Tn(77306);const Er=Tn(658);const Or=Tn(70032);const Ir=(0,yr.debuglog)("midway:debug");let Hr=class MidwayLifeCycleService{constructor(Dt){this.applicationContext=Dt;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const Dt=(0,cr.listModule)(cr.CONFIGURATION_KEY);Ir(`[core]: Found Configuration length = ${Dt.length}`);for(const Lt of Dt){if(Lt.target instanceof pr.FunctionalConfiguration){Lt.instance=Lt.target}else{Ir(`[core]: Lifecycle run ${Lt.namespace} init`);Lt.instance=await this.applicationContext.getAsync(Lt.target)}Lt.instance&&this.lifecycleInstanceList.push(Lt)}await this.healthService.init(this.lifecycleInstanceList);await Promise.all([this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectInit"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectDestroy")]);await this.runContainerLifeCycle(this.lifecycleInstanceList,"onConfigLoad",(Dt=>{if(Dt){this.configService.addObject(Dt)}}));await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady");await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady");if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();const Dt=(0,cr.listModule)(cr.CONFIGURATION_KEY)||[];for(const Lt of Dt.reverse()){let Dt;if(Lt.target instanceof pr.FunctionalConfiguration){Dt=Lt.target}else{Dt=await this.applicationContext.getAsync(Lt.target)}await this.runContainerLifeCycle(Dt,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(Dt,Lt,Tn){if(Array.isArray(Dt)){for(const Wn of Dt){if(typeof Wn.instance[Lt]==="function"){Ir(`[core]: Lifecycle run ${Wn.instance.constructor.name} ${Lt}`);Or.MidwayInitializerPerformanceManager.lifecycleStart(Wn.namespace,Lt);const Dt=await Wn.instance[Lt](this.applicationContext,this.frameworkService.getMainApp());if(Tn){Tn(Dt)}Or.MidwayInitializerPerformanceManager.lifecycleEnd(Wn.namespace,Lt)}}}else{if(typeof Dt[Lt]==="function"){const Wn=Dt.constructor.name;Ir(`[core]: Lifecycle run ${Wn} ${Lt}`);Or.MidwayInitializerPerformanceManager.lifecycleStart(Wn,Lt);const Gn=await Dt[Lt](this.applicationContext,this.frameworkService.getMainApp());if(Tn){Tn(Gn)}Or.MidwayInitializerPerformanceManager.lifecycleEnd(Wn,Lt)}}}async runObjectLifeCycle(Dt,Lt){for(const Tn of Dt){if(typeof Tn.instance[Lt]==="function"){Ir(`[core]: Lifecycle run ${Tn.instance.constructor.name} ${Lt}`);return await this.applicationContext[Lt](Tn.instance[Lt].bind(Tn.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};Wn([(0,cr.Inject)(),Gn("design:type",mr.MidwayFrameworkService)],Hr.prototype,"frameworkService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",gr.MidwayConfigService)],Hr.prototype,"configService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.MidwayMockService)],Hr.prototype,"mockService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Er.MidwayHealthService)],Hr.prototype,"healthService",void 0);Wn([(0,cr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Hr.prototype,"init",null);Hr=Wn([(0,cr.Provide)(),(0,cr.Scope)(rr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Hr);Lt.MidwayLifeCycleService=Hr},34888:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayLoggerService=void 0;const rr=Tn(49757);const cr=Tn(78842);const pr=Tn(64842);const mr=Tn(6192);const gr=Tn(82535);const yr=Tn(86314);let Sr=class MidwayLoggerService extends pr.ServiceFactory{constructor(Dt,Lt={}){super();this.applicationContext=Dt;this.globalOptions=Lt;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var Dt;const Lt=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Lt||this.globalOptions["loggerFactory"]||new gr.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new yr.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const Tn=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(Tn,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(Dt=this.applicationContext)===null||Dt===void 0?void 0:Dt.registerObject("logger",this.getLogger("appLogger"))}createClient(Dt,Lt){if(Dt.aliasName){this.aliasLoggerMap.set(Dt.aliasName,Lt)}if(!Dt.lazyLoad){this.loggerFactory.createLogger(Lt,Dt)}else{delete Dt["lazyLoad"];this.lazyLoggerConfigMap.set(Lt,Dt)}}getName(){return"logger"}createLogger(Dt,Lt){delete Lt["aliasName"];return this.loggerFactory.createLogger(Dt,Lt)}getLogger(Dt){if(this.aliasLoggerMap.has(Dt)){Dt=this.aliasLoggerMap.get(Dt)}const Lt=this.loggerFactory.getLogger(Dt);if(Lt){return Lt}if(this.lazyLoggerConfigMap.has(Dt)){this.createClient(this.lazyLoggerConfigMap.get(Dt),Dt);this.lazyLoggerConfigMap.delete(Dt)}return this.loggerFactory.getLogger(Dt)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(Dt,Lt,Tn){return this.loggerFactory.createContextLogger(Dt,Lt,Tn)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};Wn([(0,rr.Inject)(),Gn("design:type",cr.MidwayConfigService)],Sr.prototype,"configService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],Sr.prototype,"init",null);Sr=Wn([(0,rr.Provide)(),(0,rr.Scope)(mr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object,Object])],Sr);Lt.MidwayLoggerService=Sr},68220:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayMiddlewareService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(86314);const mr=Tn(65308);const gr=Tn(63289);const yr=Tn(39023);const Sr=(0,yr.debuglog)("midway:debug");let Er=class MidwayMiddlewareService{constructor(Dt){this.applicationContext=Dt}async compose(Dt,Lt,Tn){var Wn;if(!Array.isArray(Dt)){throw new pr.MidwayParameterError("Middleware stack must be an array")}const Gn=[];for(let Tn of Dt){if(gr.Types.isClass(Tn)||typeof Tn==="string"||(Tn===null||Tn===void 0?void 0:Tn["middleware"])){let Dt=(Wn=Tn===null||Tn===void 0?void 0:Tn["middleware"])!==null&&Wn!==void 0?Wn:Tn;const rr=Tn===null||Tn===void 0?void 0:Tn["options"];let cr=Tn===null||Tn===void 0?void 0:Tn["name"];if(typeof Dt==="string"&&!this.applicationContext.hasDefinition(Dt)){throw new pr.MidwayCommonError(`Middleware definition of "${Dt}" not found in midway container`)}const gr=await this.applicationContext.getAsync(Dt);if(gr){cr=cr!==null&&cr!==void 0?cr:gr.constructor.name;Dt=await gr.resolve(Lt,rr);if(!Dt){continue}if(!gr.match&&!gr.ignore){if(!Dt.name){Dt._name=cr}Gn.push(Dt)}else{const Lt=(0,mr.pathMatching)({match:gr.match,ignore:gr.ignore,thisResolver:gr});Tn=(Tn,Wn,Gn)=>{if(!Lt(Tn))return Wn();return Dt(Tn,Wn,Gn)};Tn._name=cr;Gn.push(Tn)}}else{throw new pr.MidwayCommonError("Middleware must have resolve method!")}}else{Gn.push(Tn)}}const composeFn=(Dt,Lt)=>{const Wn=(0,mr.isIncludeProperty)(Dt,"body");let rr=-1;return dispatch(0);function dispatch(cr){if(cr<=rr)return Promise.reject(new pr.MidwayCommonError("next() called multiple times"));rr=cr;let mr=Gn[cr];if(cr===Gn.length)mr=Lt;if(!mr)return Promise.resolve();const gr=`${Tn?`${Tn}.`:""}${rr} ${mr._name||mr.name||"anonymous"}`;const yr=Date.now();Sr(`[middleware]: in ${gr} +0`);try{if(Wn){return Promise.resolve(mr(Dt,dispatch.bind(null,cr+1),{index:rr})).then((Lt=>{if(Lt!==undefined&&Lt!==Dt["body"]){Dt["body"]=Lt}else if(Dt["body"]!==undefined){Lt=Dt["body"]}Sr(`[middleware]: out ${gr} +${Date.now()-yr} with body`);return Lt}))}else{return Promise.resolve(mr(Dt,dispatch.bind(null,cr+1),{index:rr})).then((Dt=>{Sr(`[middleware]: out ${gr} +${Date.now()-yr}`);return Dt}))}}catch(Dt){Sr(`[middleware]: out ${gr} +${Date.now()-yr} with err ${Dt.message}`);return Promise.reject(Dt)}}};if(Tn){composeFn._name=Tn}return composeFn}};Er=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Er);Lt.MidwayMiddlewareService=Er},77306:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr;Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayMockService=void 0;const cr=Tn(6192);const pr=Tn(49757);const mr=Tn(63289);let gr=rr=class MidwayMockService{constructor(Dt){this.applicationContext=Dt;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(rr.prepareMocks.length>0){for(const Dt of rr.prepareMocks){this.mockProperty(Dt.obj,Dt.key,Dt.value,Dt.group)}rr.prepareMocks=[]}}static mockClassProperty(Dt,Lt,Tn,Wn="default"){this.mockProperty(Dt.prototype,Lt,Tn,Wn)}static mockProperty(Dt,Lt,Tn,Wn="default"){this.prepareMocks.push({obj:Dt,key:Lt,value:Tn,group:Wn})}mockClassProperty(Dt,Lt,Tn,Wn="default"){return this.mockProperty(Dt.prototype,Lt,Tn,Wn)}mockProperty(Dt,Lt,Tn,Wn="default"){const Gn=Dt.hasOwnProperty(Lt);const rr={obj:Dt,key:Lt,descriptor:Object.getOwnPropertyDescriptor(Dt,Lt),hasOwnProperty:Gn};if(!this.mocks.has(Wn)){this.mocks.set(Wn,[])}this.mocks.get(Wn).push(rr);if(Gn){delete Dt[Lt]}let cr=this.cache.get(Wn);if(!cr){cr=new Map;this.cache.set(Wn,cr)}let pr=cr.get(Dt);if(!pr){pr=new Set;cr.set(Dt,pr)}pr.add(Lt);const mr=this.overridePropertyDescriptor(Tn);Object.defineProperty(Dt,Lt,mr)}mockContext(Dt,Lt,Tn,Wn="default"){if(!this.contextMocks.has(Wn)){this.contextMocks.set(Wn,[])}this.contextMocks.get(Wn).push({app:Dt,key:Lt,value:Tn})}restore(Dt="default"){this.restoreGroup(Dt)}restoreAll(){const Dt=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const Lt of Dt){this.restoreGroup(Lt)}this.simulatorList=[]}restoreGroup(Dt){const Lt=this.mocks.get(Dt)||[];for(let Dt=Lt.length-1;Dt>=0;Dt--){const Tn=Lt[Dt];if(!Tn.hasOwnProperty){delete Tn.obj[Tn.key]}else{Object.defineProperty(Tn.obj,Tn.key,Tn.descriptor)}}this.mocks.delete(Dt);this.contextMocks.delete(Dt);this.cache.delete(Dt);this.simulatorList=this.simulatorList.filter((Lt=>Lt["group"]!==Dt))}isMocked(Dt,Lt,Tn="default"){if((0,mr.isClass)(Dt)){Dt=Dt.prototype}const Wn=this.cache.get(Tn);const Gn=Wn?Wn.get(Dt):undefined;return Gn?Gn.has(Lt):false}applyContextMocks(Dt,Lt){for(const[,Tn]of this.contextMocks){for(const Wn of Tn){if(Wn.app===Dt){const Dt=this.overridePropertyDescriptor(Wn.value);if(typeof Wn.key==="string"){Object.defineProperty(Lt,Wn.key,Dt)}else{Wn.key(Lt)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((Dt,Lt)=>Dt+Lt.length),0)}overridePropertyDescriptor(Dt){const Lt={configurable:true,enumerable:true};if(Dt&&(Dt.get||Dt.set)){Lt.get=Dt.get;Lt.set=Dt.set}else{Lt.value=Dt;Lt.writable=true}return Lt}async initSimulation(Dt="default"){const Lt=(0,pr.listModule)(pr.MOCK_KEY);for(const Tn of Lt){const Lt=await this.applicationContext.getAsync(Tn);if(await Lt.enableCondition()){Lt["group"]=Dt;this.simulatorList.push(Lt)}}}async runSimulatorSetup(){var Dt;for(const Lt of this.simulatorList){await((Dt=Lt.setup)===null||Dt===void 0?void 0:Dt.call(Lt))}}async runSimulatorTearDown(){var Dt;for(let Lt=this.simulatorList.length-1;Lt>=0;Lt--){const Tn=this.simulatorList[Lt];await((Dt=Tn.tearDown)===null||Dt===void 0?void 0:Dt.call(Tn))}}async runSimulatorAppSetup(Dt){var Lt;for(const Tn of this.simulatorList){await((Lt=Tn.appSetup)===null||Lt===void 0?void 0:Lt.call(Tn,Dt))}}async runSimulatorAppTearDown(Dt){var Lt;for(let Tn=this.simulatorList.length-1;Tn>=0;Tn--){const Wn=this.simulatorList[Tn];await((Lt=Wn.appTearDown)===null||Lt===void 0?void 0:Lt.call(Wn,Dt))}}async runSimulatorContextSetup(Dt,Lt){var Tn;for(const Wn of this.simulatorList){await((Tn=Wn.contextSetup)===null||Tn===void 0?void 0:Tn.call(Wn,Dt,Lt))}}async runSimulatorContextTearDown(Dt,Lt){var Tn;for(let Wn=this.simulatorList.length-1;Wn>=0;Wn--){const Gn=this.simulatorList[Wn];await((Tn=Gn===null||Gn===void 0?void 0:Gn.contextTearDown)===null||Tn===void 0?void 0:Tn.call(Gn,Dt,Lt))}}};gr.prepareMocks=[];Wn([(0,pr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],gr.prototype,"init",null);Wn([(0,pr.Destroy)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],gr.prototype,"restoreAll",null);gr=rr=Wn([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],gr);Lt.MidwayMockService=gr},28602:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPipelineService=Lt.PipelineContext=void 0;const Wn=Tn(49757);class PipelineContext{constructor(Dt){this.info={current:null,currentName:null};this.data=new Map;this.args=Dt}get(Dt){return this.data.get(Dt)}set(Dt,Lt){this.data.set(Dt,Lt)}keys(){const Dt=[];const Lt=this.data.keys();for(const Tn of Lt){Dt.push(Tn)}return Dt}}Lt.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(Dt,Lt){this.applicationContext=Dt;this.valves=Lt}async parallel(Dt){const Lt=this.prepareParallelValves(Dt);const Tn=await Promise.all(Lt);return this.packResult(Tn,false)}async concat(Dt){const Lt=this.prepareParallelValves(Dt);const Tn=await Promise.all(Lt);return this.packResult(Tn,true)}async series(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);const Wn={success:true,result:null};const Gn={};const rr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let cr=1;for(const Dt of Lt){rr.prev=rr.current;rr.prevName=getName(rr.prev);rr.current=Dt;rr.currentName=getName(rr.current);if(cr<Lt.length){rr.next=Lt[cr];rr.nextName=getName(rr.next)}else{rr.next=undefined;rr.nextName=undefined}cr+=1;Tn.info=rr;try{const Lt=await this.applicationContext.getAsync(Dt);const Wn=await Lt.invoke(Tn);let cr=Dt;if(Lt.alias){cr=Lt.alias}Gn[cr]=Wn;rr.prevValue=Wn}catch(Lt){Wn.success=false;Wn.error={valveName:typeof Dt==="string"?Dt:Dt.name,message:Lt.message,error:Lt};return Wn}}Wn.result=Gn;return Wn}async concatSeries(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);const Wn={success:true,result:null};const Gn=[];const rr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let cr=1;for(const Dt of Lt){rr.prev=rr.current;rr.prevName=getName(rr.prev);rr.current=Dt;rr.currentName=getName(rr.current);if(cr<Lt.length){rr.next=Lt[cr];rr.nextName=getName(rr.next)}else{rr.next=undefined;rr.nextName=undefined}cr+=1;Tn.info=rr;try{const Lt=await this.applicationContext.getAsync(Dt);const Wn=await Lt.invoke(Tn);Gn.push(Wn);rr.prevValue=Wn}catch(Lt){Wn.success=false;Wn.error={valveName:typeof Dt==="string"?Dt:Dt.name,message:Lt.message,error:Lt};return Wn}}Wn.result=Gn;return Wn}async waterfall(Dt){const Lt=await this.concatSeries(Dt);if(Lt.success){const Dt=Lt.result;Lt.result=Dt[Dt.length-1]}return Lt}mergeValves(Dt){let Lt=[];if(this.valves&&this.valves.length>0){Lt=this.valves}let Tn=[];if(Dt){for(const Wn of Dt){if(Lt.includes(Wn)){Tn.push(Wn)}}}else{Tn=Lt}return Tn}prepareParallelValves(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);return Lt.map((async Dt=>{const Lt={valveName:Dt,dataKey:Dt,data:null};try{const Wn=await this.applicationContext.getAsync(Dt);if(Wn.alias){Lt.dataKey=Wn.alias}Lt.data=await Wn.invoke(Tn)}catch(Dt){Lt.error=Dt}return Lt}))}packResult(Dt,Lt=false){const Tn={success:true,result:null};let Wn;if(Lt){Wn=[]}else{Wn={}}for(const Gn of Dt){if(Gn.error){Tn.success=false;Tn.error={valveName:typeof Gn.valveName==="string"?Gn.valveName:Gn.valveName.name,message:Gn.error.message,error:Gn.error};return Tn}else{if(Lt){Wn.push(Gn.data)}else{Wn[Gn.dataKey]=Gn.data}}}Tn.result=Wn;return Tn}}Lt.MidwayPipelineService=MidwayPipelineService;function getName(Dt){if(Dt){if(typeof Dt==="string"){return Dt}else{return(0,Wn.getProviderName)(Dt)}}return null}},42592:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.WebRouterCollector=Lt.MidwayServerlessFunctionService=void 0;const rr=Tn(49757);const cr=Tn(19985);const pr=Tn(9288);const mr=Tn(1845);const gr=Tn(50539);const yr=Tn(6192);let Sr=class MidwayServerlessFunctionService extends cr.MidwayWebRouterService{constructor(Dt={}){super(Object.assign({},Dt,{includeFunctionRouter:true}));this.options=Dt}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const Dt of this.routes.values()){for(const Lt of Dt){if(Lt.requestMethod==="all"){Lt.functionTriggerMetadata=Lt.functionTriggerMetadata||{};Lt.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const Dt=(0,rr.listModule)(rr.FUNC_KEY);for(const Lt of Dt){this.collectFunctionRoute(Lt)}}collectFunctionRoute(Dt){var Lt,Tn,Wn,Gn,cr,pr,mr,gr,yr,Sr,Er,Or,Ir,Hr,Gr,$r,mi;const ki=(0,rr.getClassMetadata)(rr.FUNC_KEY,Dt);const Ni=(0,rr.getProviderName)(Dt);const Ri=(0,rr.getProviderUUId)(Dt);const ji="/";if(!this.routes.has(ji)){this.routes.set(ji,[]);this.routesPriority.push({prefix:ji,priority:-999,middleware:[],routerOptions:{},controllerId:Ni,routerModule:Dt})}for(const Ui of ki){if((Lt=Ui["metadata"])===null||Lt===void 0?void 0:Lt["path"]){const Lt=(0,rr.getPropertyDataFromClass)(rr.WEB_ROUTER_PARAM_KEY,Dt,Ui["methodName"])||[];const Er=(0,rr.getPropertyMetadata)(rr.WEB_RESPONSE_KEY,Dt,Ui["methodName"])||[];const Or={id:Ri,prefix:ji,routerName:"",url:Ui["metadata"]["path"],requestMethod:(Wn=(Tn=Ui["metadata"])===null||Tn===void 0?void 0:Tn["method"])!==null&&Wn!==void 0?Wn:"get",method:Ui["methodName"],description:"",summary:"",handlerName:`${Ni}.${Ui["methodName"]}`,funcHandlerName:`${Ni}.${Ui["methodName"]}`,controllerId:Ni,middleware:((Gn=Ui["metadata"])===null||Gn===void 0?void 0:Gn["middleware"])||[],controllerMiddleware:[],requestMetadata:Lt,responseMetadata:Er};const Ir=(0,rr.getPropertyMetadata)(rr.SERVERLESS_FUNC_KEY,Dt,Ui["methodName"])||{};const Hr=(mr=(cr=Ir["functionName"])!==null&&cr!==void 0?cr:(pr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||pr===void 0?void 0:pr["functionName"])!==null&&mr!==void 0?mr:createFunctionName(Dt,Ui["methodName"]);const Gr=(Sr=(gr=Ir["handlerName"])!==null&&gr!==void 0?gr:(yr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||yr===void 0?void 0:yr["handlerName"])!==null&&Sr!==void 0?Sr:Or.funcHandlerName;Or.functionName=Hr;Or.funcHandlerName=Gr;Or.functionTriggerName=Ui["type"];Or.functionTriggerMetadata=Ui["metadata"];Or.functionMetadata={functionName:Hr,...Ir};this.checkDuplicateAndPush(ji,Or)}else{const Lt=(0,rr.getPropertyMetadata)(rr.SERVERLESS_FUNC_KEY,Dt,Ui["methodName"])||{};const Tn=(Ir=(Er=Lt["functionName"])!==null&&Er!==void 0?Er:(Or=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||Or===void 0?void 0:Or["functionName"])!==null&&Ir!==void 0?Ir:createFunctionName(Dt,Ui["methodName"]);const Wn=($r=(Hr=Lt["handlerName"])!==null&&Hr!==void 0?Hr:(Gr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||Gr===void 0?void 0:Gr["handlerName"])!==null&&$r!==void 0?$r:`${Ni}.${Ui["methodName"]}`;this.checkDuplicateAndPush(ji,{id:Ri,prefix:ji,routerName:"",url:"",requestMethod:"",method:Ui["methodName"],description:"",summary:"",handlerName:`${Ni}.${Ui["methodName"]}`,funcHandlerName:Wn,controllerId:Ni,middleware:((mi=Ui["metadata"])===null||mi===void 0?void 0:mi["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:Tn,functionTriggerName:Ui["type"],functionTriggerMetadata:Ui["metadata"],functionMetadata:{functionName:Tn,...Lt}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(Dt,Lt,Tn={}){var Wn,Gn;const rr="";if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const cr=(Wn=Lt.functionName)!==null&&Wn!==void 0?Wn:Tn.functionName;this.checkDuplicateAndPush(rr,{id:null,method:Dt,url:Lt.metadata["path"]||"",requestMethod:Lt.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:Lt.handlerName||Tn.handlerName,controllerId:"",middleware:((Gn=Lt.metadata)===null||Gn===void 0?void 0:Gn.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:cr,functionTriggerName:Lt.metadata.name,functionTriggerMetadata:Lt.metadata,functionMetadata:{functionName:cr,...Tn}})}};Sr=Wn([(0,rr.Provide)(),(0,rr.Scope)(yr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Sr);Lt.MidwayServerlessFunctionService=Sr;function createFunctionName(Dt,Lt){return(0,rr.getProviderName)(Dt).replace(/[:#]/g,"-")+"-"+Lt}class WebRouterCollector{constructor(Dt="",Lt={}){this.baseDir=Dt;this.options=Lt}async init(){if(!this.proxy){if(this.baseDir){const Dt=new pr.MidwayContainer;(0,rr.bindContainer)(Dt);Dt.setFileDetector(new mr.CommonJSFileDetector({loadDir:this.baseDir}));await Dt.ready()}if(this.options.includeFunctionRouter){if((0,gr.getCurrentMainFramework)()){this.proxy=await(0,gr.getCurrentMainFramework)().getApplicationContext().getAsync(Sr,[this.options])}else{this.proxy=new Sr(this.options)}}else{if((0,gr.getCurrentMainFramework)()){this.proxy=await(0,gr.getCurrentMainFramework)().getApplicationContext().getAsync(cr.MidwayWebRouterService,[this.options])}else{this.proxy=new cr.MidwayWebRouterService(this.options)}}}}async getRoutePriorityList(){await this.init();return this.proxy.getRoutePriorityList()}async getRouterTable(){await this.init();return this.proxy.getRouterTable()}async getFlattenRouterTable(){await this.init();return this.proxy.getFlattenRouterTable()}}Lt.WebRouterCollector=WebRouterCollector},19985:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayWebRouterService=void 0;const rr=Tn(49757);const cr=Tn(65308);const pr=Tn(86314);const mr=Tn(39023);const gr=Tn(73861);const yr=Tn(63289);const Sr=Tn(6192);const Er=mr.debuglog("midway:debug");let Or=class MidwayWebRouterService{constructor(Dt={}){this.options=Dt;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const Dt=(0,rr.listModule)(rr.CONTROLLER_KEY);for(const Lt of Dt){const Dt=(0,rr.getClassMetadata)(rr.CONTROLLER_KEY,Lt);this.addController(Lt,Dt,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((Dt=>{const Lt=this.routes.get(Dt.prefix);if(Lt.length>0){return true}else{this.routes.delete(Dt.prefix);return false}}));for(const Dt of this.routes.keys()){const Lt=this.routes.get(Dt);this.routes.set(Dt,this.sortRouter(Lt))}this.routesPriority=this.routesPriority.sort(((Dt,Lt)=>Lt.prefix.length-Dt.prefix.length))}addController(Dt,Lt,Tn={},Wn=false){var Gn;if(Tn&&typeof Tn==="boolean"){Wn=Tn;Tn=undefined}if(!Tn){Tn={}}const mr=(0,rr.getProviderName)(Dt);Er(`[core]: Found Controller ${mr}.`);const gr=(0,rr.getProviderUUId)(Dt);Lt.routerOptions=Lt.routerOptions||{};let yr;const Or=Lt.routerOptions.middleware;const Ir=!!((Gn=Lt.routerOptions)===null||Gn===void 0?void 0:Gn.ignoreGlobalPrefix);let Hr=(0,cr.joinURLPath)(this.options.globalPrefix,Lt.prefix||"/");const Gr=Lt.prefix||"/";if(Ir){Hr=Gr}if(/\*/.test(Hr)){throw new pr.MidwayCommonError(`Router prefix ${Hr} can't set string with *`)}if(!this.routes.has(Hr)){this.routes.set(Hr,[]);this.routesPriority.push({prefix:Hr,priority:Hr==="/"&&yr===undefined?-999:0,middleware:Or,routerOptions:Lt.routerOptions,controllerId:mr,routerModule:Dt})}else{if(Or&&Or.length>0){const Dt=this.routesPriority.filter((Dt=>Dt.prefix===Hr))[0];throw new pr.MidwayDuplicateControllerOptionsError(Hr,mr,Dt.controllerId)}}if(!this.routes.has(Gr)){this.routes.set(Gr,[]);this.routesPriority.push({prefix:Gr,priority:Gr==="/"&&yr===undefined?-999:0,middleware:Or,routerOptions:Lt.routerOptions,controllerId:mr,routerModule:Dt})}const $r=(0,rr.getClassMetadata)(rr.WEB_ROUTER_KEY,Dt);if($r&&typeof $r[Symbol.iterator]==="function"){for(const Lt of $r){const Gn=(0,rr.getPropertyDataFromClass)(rr.WEB_ROUTER_PARAM_KEY,Dt,Lt.method)||[];const pr=(0,rr.getPropertyMetadata)(rr.WEB_RESPONSE_KEY,Dt,Lt.method)||[];const yr={id:gr,prefix:Lt.ignoreGlobalPrefix?Gr:Hr,routerName:Lt.routerName||"",url:Lt.path,requestMethod:Lt.requestMethod,method:Lt.method,description:Lt.description||"",summary:Lt.summary||"",handlerName:`${mr}.${Lt.method}`,funcHandlerName:`${mr}.${Lt.method}`,controllerId:mr,controllerClz:Dt,middleware:Lt.middleware||[],controllerMiddleware:Or||[],requestMetadata:Gn,responseMetadata:pr};if(Wn){yr.functionName=mr+"-"+Lt.method;yr.functionTriggerName=Sr.ServerlessTriggerType.HTTP;yr.functionTriggerMetadata={path:(0,cr.joinURLPath)(Hr,Lt.path.toString()),method:Lt.requestMethod};yr.functionMetadata={functionName:yr.functionName}}if(Tn.resourceFilter&&!Tn.resourceFilter(yr)){continue}this.checkDuplicateAndPush(yr.prefix,yr)}}}addRouter(Dt,Lt){const Tn=Lt.prefix||"";Lt.requestMethod=(Lt.requestMethod||"GET").toUpperCase();if(!this.routes.has(Tn)){this.routes.set(Tn,[]);this.routesPriority.push({prefix:Tn,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(Tn,Object.assign(Lt,{method:Dt}));this.sortPrefixAndRouter()}sortRouter(Dt){return Dt.map((Dt=>{const Lt=Dt.url.toString();const Tn=yr.Types.isRegExp(Dt.url)?Lt.split("\\/"):Lt.split("/");let Wn=0;for(const Dt of Tn){if(Dt===""||Dt.includes(":")||Dt.includes("*")){Wn+=0}else{Wn+=1}}let Gn=2;const rr=Lt.includes(":")?Lt.replace(/:.+$/,""):"";if(rr){Gn=1}if(Lt.includes("*")){Gn=0}return{...Dt,_pureRouter:Lt.replace(/\**$/,"").replace(/:\w+/,"123"),_level:Lt.split("/").length-1,_paramString:rr,_category:Gn,_weight:Wn}})).sort(((Dt,Lt)=>{if(Dt._category!==Lt._category){return Lt._category-Dt._category}if(Dt._weight!==Lt._weight){return Lt._weight-Dt._weight}if(Dt._level===Lt._level){if(Lt._pureRouter===Dt._pureRouter){return Dt.url.toString().length-Lt.url.toString().length}return Lt._pureRouter.length-Dt._pureRouter.length}return Lt._level-Dt._level}))}async getRoutePriorityList(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routesPriority}async getRouterTable(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routes}async getFlattenRouterTable(Dt={}){if(!this.isReady){await this.analyze();this.isReady=true}let Lt=[];for(const Dt of this.routesPriority){Lt=Lt.concat(this.routes.get(Dt.prefix))}if(Dt.compileUrlPattern){for(const Dt of Lt){if(Dt.fullUrlFlattenString){Dt.fullUrlCompiledRegexp=gr.PathToRegexpUtil.toRegexp(Dt.fullUrlFlattenString)}}}return Lt}async getMatchedRouterInfo(Dt,Lt){const Tn=await this.getFlattenRouterTable({compileUrlPattern:true});let Wn;for(const Gn of Tn){if(Gn.fullUrlCompiledRegexp){const Tn=Gn["requestMethod"].toUpperCase();if(("ALL"===Tn||Lt.toUpperCase()===Tn)&&Gn.fullUrlCompiledRegexp.test(Dt)){Wn=Gn;break}}}return Wn}checkDuplicateAndPush(Dt,Lt){const Tn=this.routes.get(Dt);const Wn=Tn.filter((Dt=>Lt.url&&Lt.requestMethod&&Dt.url===Lt.url&&Dt.requestMethod===Lt.requestMethod));if(Wn&&Wn.length){throw new pr.MidwayDuplicateRouteError(`${Lt.requestMethod} ${Lt.url}`,`${Wn[0].handlerName}`,`${Lt.handlerName}`)}if(!Lt.fullUrlFlattenString&&Lt.url&&typeof Lt.url==="string"){Lt.fullUrl=(0,cr.joinURLPath)(Dt,Lt.url);if(/\*$/.test(Lt.fullUrl)){Lt.fullUrlFlattenString=Lt.fullUrl.replace("*","(.*)")}else{Lt.fullUrlFlattenString=Lt.fullUrl}}Tn.push(Lt)}};Or=Wn([(0,rr.Provide)(),(0,rr.Scope)(Sr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Or);Lt.MidwayWebRouterService=Or},29222:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.prepareGlobalApplicationContext=Lt.prepareGlobalApplicationContextAsync=Lt.destroyGlobalApplicationContext=Lt.initializeGlobalApplicationContext=void 0;const Wn=Tn(46123);const Gn=Tn(42193);const rr=Tn(49757);const cr=Tn(39023);const pr=Tn(42592);const mr=Tn(16928);const gr=Tn(658);const yr=Tn(70032);const Sr=cr.debuglog("midway:debug");let Er=1;function printStepDebugInfo(Dt){Sr(`\n\nStep ${Er++}: ${Dt}\n`)}async function initializeGlobalApplicationContext(Dt){yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const Lt=await prepareGlobalApplicationContextAsync(Dt);printStepDebugInfo("Init logger");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const Tn=await Lt.getAsync(Wn.MidwayLoggerService,[Lt,Dt]);if(Tn.getLogger("appLogger")){Lt.registerObject("logger",Tn.getLogger("appLogger"))}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await Lt.getAsync(Wn.MidwayMockService,[Lt]);printStepDebugInfo("Init framework");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await Lt.getAsync(Wn.MidwayFrameworkService,[Lt,Dt]);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await Lt.getAsync(Wn.MidwayLifeCycleService,[Lt]);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const Gn=(0,rr.listPreloadModule)();for(const Dt of Gn){await Lt.getAsync(Dt)}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return Lt}Lt.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(Dt){const Lt=await Dt.getAsync(Wn.MidwayLoggerService);const Tn=Lt.getCurrentLoggerFactory();const Gn=await Dt.getAsync(Wn.MidwayLifeCycleService);await Gn.stop();await Dt.stop();(0,rr.clearBindContainer)();Tn.close();yr.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}Lt.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(Dt){var Lt,Tn,Er,Or,Ir;printStepDebugInfo("Ready to create applicationContext");Sr('[core]: start "initializeGlobalApplicationContext"');Sr(`[core]: bootstrap options = ${cr.inspect(Dt)}`);const Hr=(Lt=Dt.appDir)!==null&&Lt!==void 0?Lt:"";const Gr=(Tn=Dt.baseDir)!==null&&Tn!==void 0?Tn:"";yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const $r=(Er=Dt.applicationContext)!==null&&Er!==void 0?Er:new Wn.MidwayContainer;Sr("[core]: delegate module map from decoratorManager");(0,rr.bindContainer)($r);global["MIDWAY_APPLICATION_CONTEXT"]=$r;$r.registerObject("baseDir",Gr);$r.registerObject("appDir",Hr);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);Sr("[core]: set default file detector");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!Dt.moduleLoadType){Dt.moduleLoadType="commonjs"}if(Dt.moduleDetector!==false){Sr("[core]: set module load type = %s",Dt.moduleLoadType);if(!Dt.imports){Dt.imports=[await(0,Wn.loadModule)((0,mr.join)(Gr,`configuration${(0,Wn.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:Dt.moduleLoadType,safeLoad:true})]}if(Dt.moduleDetector===undefined){if(Dt.moduleLoadType==="esm"){$r.setFileDetector(new Wn.ESModuleFileDetector({loadDir:Gr,ignore:(Or=Dt.ignore)!==null&&Or!==void 0?Or:[]}));Dt.moduleLoadType="esm"}else{$r.setFileDetector(new Wn.CommonJSFileDetector({loadDir:Gr,ignore:(Ir=Dt.ignore)!==null&&Ir!==void 0?Ir:[]}))}}}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");$r.bindClass(Wn.MidwayEnvironmentService);$r.bindClass(Wn.MidwayInformationService);$r.bindClass(Wn.MidwayAspectService);$r.bindClass(Wn.MidwayDecoratorService);$r.bindClass(Wn.MidwayConfigService);$r.bindClass(Wn.MidwayLoggerService);$r.bindClass(Wn.MidwayApplicationManager);$r.bindClass(Wn.MidwayFrameworkService);$r.bindClass(Wn.MidwayMiddlewareService);$r.bindClass(Wn.MidwayLifeCycleService);$r.bindClass(Wn.MidwayMockService);$r.bindClass(Wn.MidwayWebRouterService);$r.bindClass(pr.MidwayServerlessFunctionService);$r.bindClass(gr.MidwayHealthService);$r.bindClass(Wn.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(Dt.preloadModules&&Dt.preloadModules.length){for(const Lt of Dt.preloadModules){$r.bindClass(Lt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const mi=$r.get(Wn.MidwayEnvironmentService);mi.setModuleLoadType(Dt.moduleLoadType);const ki=$r.get(Wn.MidwayConfigService);ki.add([{default:Gn.default}]);$r.get(Wn.MidwayAspectService,[$r]);$r.get(Wn.MidwayDecoratorService,[$r]);printStepDebugInfo("Load imports(component) and user code configuration module");$r.load([].concat(Dt.imports).concat(Dt.configurationModule));printStepDebugInfo("Run applicationContext ready method");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await $r.ready();yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Dt.globalConfig){if(Array.isArray(Dt.globalConfig)){ki.add(Dt.globalConfig)}else{ki.addObject(Dt.globalConfig)}}printStepDebugInfo("Load config file");ki.load();Sr("[core]: Current config = %j",ki.getConfiguration());yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);$r.get(Wn.MidwayMiddlewareService,[$r]);return $r}Lt.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(Dt){var Lt,Tn,Er,Or;printStepDebugInfo("Ready to create applicationContext");Sr('[core]: start "initializeGlobalApplicationContext"');Sr(`[core]: bootstrap options = ${cr.inspect(Dt)}`);const Ir=(Lt=Dt.appDir)!==null&&Lt!==void 0?Lt:"";const Hr=(Tn=Dt.baseDir)!==null&&Tn!==void 0?Tn:"";yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Gr=(Er=Dt.applicationContext)!==null&&Er!==void 0?Er:new Wn.MidwayContainer;Sr("[core]: delegate module map from decoratorManager");(0,rr.bindContainer)(Gr);global["MIDWAY_APPLICATION_CONTEXT"]=Gr;Gr.registerObject("baseDir",Hr);Gr.registerObject("appDir",Ir);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!Dt.moduleLoadType){Dt.moduleLoadType="commonjs"}if(Dt.moduleDetector!==false){if(Dt.moduleDetector===undefined){Gr.setFileDetector(new Wn.CommonJSFileDetector({ignore:(Or=Dt.ignore)!==null&&Or!==void 0?Or:[]}))}else if(Dt.moduleDetector){Gr.setFileDetector(Dt.moduleDetector)}}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Gr.bindClass(Wn.MidwayEnvironmentService);Gr.bindClass(Wn.MidwayInformationService);Gr.bindClass(Wn.MidwayAspectService);Gr.bindClass(Wn.MidwayDecoratorService);Gr.bindClass(Wn.MidwayConfigService);Gr.bindClass(Wn.MidwayLoggerService);Gr.bindClass(Wn.MidwayApplicationManager);Gr.bindClass(Wn.MidwayFrameworkService);Gr.bindClass(Wn.MidwayMiddlewareService);Gr.bindClass(Wn.MidwayLifeCycleService);Gr.bindClass(Wn.MidwayMockService);Gr.bindClass(Wn.MidwayWebRouterService);Gr.bindClass(pr.MidwayServerlessFunctionService);Gr.bindClass(gr.MidwayHealthService);Gr.bindClass(Wn.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(Dt.preloadModules&&Dt.preloadModules.length){for(const Lt of Dt.preloadModules){Gr.bindClass(Lt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const $r=Gr.get(Wn.MidwayEnvironmentService);$r.setModuleLoadType(Dt.moduleLoadType);const mi=Gr.get(Wn.MidwayConfigService);mi.add([{default:Gn.default}]);Gr.get(Wn.MidwayAspectService,[Gr]);Gr.get(Wn.MidwayDecoratorService,[Gr]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!Dt.imports){Dt.imports=[(0,Wn.safeRequire)((0,mr.join)(Dt.baseDir,"configuration"))]}Gr.load([].concat(Dt.imports).concat(Dt.configurationModule));printStepDebugInfo("Run applicationContext ready method");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Gr.ready();yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Dt.globalConfig){if(Array.isArray(Dt.globalConfig)){mi.add(Dt.globalConfig)}else{mi.addObject(Dt.globalConfig)}}printStepDebugInfo("Load config file");mi.load();Sr("[core]: Current config = %j",mi.getConfiguration());yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Gr.get(Wn.MidwayMiddlewareService,[Gr]);return Gr}Lt.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.pascalCase=Lt.camelCase=void 0;const Tn=/[\p{Lu}]/u;const Wn=/[\p{Ll}]/u;const Gn=/([\p{Alpha}\p{N}_]|$)/u;const rr=/[_.\- ]+/;const cr=new RegExp("^"+rr.source);const pr=new RegExp(rr.source+Gn.source,"gu");const mr=new RegExp("\\d+"+Gn.source,"gu");const preserveCamelCase=(Dt,Lt,Gn)=>{let rr=false;let cr=false;let pr=false;for(let mr=0;mr<Dt.length;mr++){const gr=Dt[mr];if(rr&&Tn.test(gr)){Dt=Dt.slice(0,mr)+"-"+Dt.slice(mr);rr=false;pr=cr;cr=true;mr++}else if(cr&&pr&&Wn.test(gr)){Dt=Dt.slice(0,mr-1)+"-"+Dt.slice(mr-1);pr=cr;cr=false;rr=true}else{rr=Lt(gr)===gr&&Gn(gr)!==gr;pr=cr;cr=Gn(gr)===gr&&Lt(gr)!==gr}}return Dt};const postProcess=(Dt,Lt)=>{pr.lastIndex=0;mr.lastIndex=0;return Dt.replace(pr,((Dt,Tn)=>Lt(Tn))).replace(mr,(Dt=>Lt(Dt)))};function camelCaseOrigin(Dt,Lt){Lt={pascalCase:false,...Lt};Dt=Dt.trim();if(Dt.length===0){return""}const toLowerCase=Dt=>Dt.toLowerCase();const toUpperCase=Dt=>Dt.toUpperCase();if(Dt.length===1){if(rr.test(Dt)){return""}return Lt.pascalCase?toUpperCase(Dt):toLowerCase(Dt)}const Tn=Dt!==toLowerCase(Dt);if(Tn){Dt=preserveCamelCase(Dt,toLowerCase,toUpperCase)}Dt=Dt.replace(cr,"");Dt=toLowerCase(Dt);if(Lt.pascalCase){Dt=toUpperCase(Dt.charAt(0))+Dt.slice(1)}return postProcess(Dt,toUpperCase)}function camelCase(Dt){return camelCaseOrigin(Dt,{pascalCase:false})}Lt.camelCase=camelCase;function pascalCase(Dt){return camelCaseOrigin(Dt,{pascalCase:true})}Lt.pascalCase=pascalCase},50539:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getCurrentAsyncContextManager=Lt.getCurrentMainApp=Lt.getCurrentMainFramework=Lt.getCurrentApplicationContext=void 0;const Wn=Tn(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];Lt.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];Lt.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const Dt=(0,Lt.getCurrentMainFramework)();if(Dt){return Dt.getApplication()}return undefined};Lt.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,Lt.getCurrentApplicationContext)().get(Wn.ASYNC_CONTEXT_MANAGER_KEY);Lt.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.extend=void 0;const Wn=Tn(63289);function extend(...Dt){let Lt,Tn,Gn,rr,cr;let pr=Dt[0];let mr=1;const gr=Dt.length;let yr=false;if(typeof pr==="boolean"){yr=pr;pr=Dt[1]||{};mr=2}else if(typeof pr!=="object"&&typeof pr!=="function"||pr==null){pr={}}for(;mr<gr;++mr){Lt=Dt[mr];if(Lt==null)continue;for(Tn in Lt){if(Tn==="__proto__")continue;Gn=pr[Tn];rr=Lt[Tn];if(pr===rr)continue;if(yr&&rr&&Wn.Types.isPlainObject(rr)){cr=Gn&&Wn.Types.isPlainObject(Gn)?Gn:{};pr[Tn]=extend(yr,cr,rr)}else if(typeof rr!=="undefined"){pr[Tn]=rr}}}return pr}Lt.extend=extend},2764:(Dt,Lt)=>{"use strict";
|
|
1
|
+
(()=>{var __webpack_modules__={53196:Dt=>{function webpackEmptyAsyncContext(Dt){return Promise.resolve().then((()=>{var Lt=new Error("Cannot find module '"+Dt+"'");Lt.code="MODULE_NOT_FOUND";throw Lt}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;Dt.exports=webpackEmptyAsyncContext},14071:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});const Gn=Wn(Tn(22078));const rr=Tn(23718);const{logLevel:cr=""}=(0,Gn.default)(process.argv.slice(2));Lt["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:cr||"warn"},coreLogger:{level:cr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:rr.backendMessages.en},zh:{default:rr.backendMessages.zh}},writeCookie:false}}},91921:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt["default"]={}},12799:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MainConfiguration=void 0;const gr=Tn(46123);const yr=cr(Tn(47453));const Sr=cr(Tn(99375));const Er=cr(Tn(65295));const Or=cr(Tn(2865));const Ir=cr(Tn(49179));const Hr=cr(Tn(62487));const Gr=cr(Tn(96955));const $r=cr(Tn(87735));const mi=cr(Tn(16928));const ki=cr(Tn(79896));const Ni=mr(Tn(76982));const Ri=Tn(79896);const ji=Tn(24434);const Ui=mr(Tn(99819));const Vi=mr(Tn(44400));const zi=mr(Tn(77036));const Ki=Tn(31855);const $i=Tn(26815);const Xi=Tn(54633);const Yi=Tn(59416);const Wo=Tn(61142);const Ho=Tn(64754);const Go=Tn(10778);const Xo=Tn(49969);const Yo=Tn(67872);const Qo=Tn(4145);const xa=cr(Tn(14071));const Ta=cr(Tn(91921));const wa=Tn(87518);const Oa=Tn(18801);const Ia=cr(Tn(68255));const Ra={DEFAULT_PORT:Number(wa.uri.getUrlPort($i.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let La=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null;this._websitePath=null}get websitePath(){if(!this._websitePath){const Dt=this.app.getEnv();this._websitePath=mi.resolve(__dirname,Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL?"../../../website":"./website")}return this._websitePath}get apiUrl(){const Dt=this.app.getEnv();return Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL?$i.KEYS.REMOTE_SERVICE_URL_DEV:$i.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const Dt=this.app.getEnv();if(Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Dt=mi.join(__dirname,"../../cli/package.json");const Lt=JSON.parse((0,Ri.readFileSync)(Dt,"utf8"));return Lt.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(Dt){const Lt=new ji.EventEmitter;const Tn={...Dt,on:{...Dt.on,error:Dt=>{this.logger.error("Proxy Error:",Dt.message);Lt.emit("error",Dt)},proxyRes:()=>Lt.emit("proxyRes"),proxyReq:Dt=>{const Tn=`${Dt.protocol}//${Dt.host}${Dt.path}`;this.logger.debug("[Proxy] →",Tn);Lt.emit("proxyReq",Dt)},proxyReqWs:(...Dt)=>Lt.emit("proxyReqWs",...Dt)}};const Wn=Dt.pathRewrite;const Gn=Object.keys(Wn??{});if(Gn.length>0){const[Dt]=Gn;Tn.pathRewrite=Lt=>{let Tn=Lt.replace($i.KEYS.PROXY_PATH_PREFIX,"");Tn=Tn.replace(new RegExp(Dt),Wn[Dt]);return Tn}}else{Tn.pathRewrite=Dt=>Dt.replace($i.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,Ki.createProxyMiddleware)(Tn),opt:Tn,event:Lt}}createProxyMap(Dt){const Lt={};for(const[Tn,Wn]of Object.entries(Dt)){Lt[Tn]=this.createProxyConfig(Wn)}return Lt}setupProxy(){const Dt=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);if(Ho.ProxyController.proxys){for(const Dt of Object.values(Ho.ProxyController.proxys)){Dt.event.removeAllListeners()}}Ho.ProxyController.proxys={};if(!Dt.proxy)return;Ho.ProxyController.proxys=this.createProxyMap(Dt.proxy)}async buildConfig(Dt){const Lt=this.app.getEnv();const Tn=Dt.cwd||process.cwd();this.logger.info("cwd:",Tn);this.logger.info("env:",Lt);const Wn={port:Dt.port||Ra.DEFAULT_PORT,allowDebug:Dt.allowDebug??false,api:Dt.api||this.apiUrl,dir:Dt.dir||"",cwd:Tn,proxy:Dt.proxy};const Gn=mi.join(this.websitePath,$i.KEYS.WEBSITE_PATH_MAIN);const rr=mi.join(Tn,Wn.dir||"").replace(/[\\/]$/,"");const cr=mi.join(Tn,$i.KEYS.PREBUILD_MODULE_DIR);const pr=mi.join(Tn,"node_modules");await ki.promises.mkdir(cr,{recursive:true});const mr={websitePath:Gn,prebuildModulePath:cr,cwd:Tn,port:Wn.port,srcPath:rr,remoteServer:Wn.api,version:this.getVersion(),allowDebug:Wn.allowDebug,proxy:Wn.proxy,projectHash:Ni.default.createHash("sha256").update(Tn).digest("hex").slice(0,8)};Go.remoteInstance.defaults.baseURL=mr.remoteServer;if(Lt===$i.KEYS.LOCAL_MIDWAY_ENV_PROD){mr.port=await(0,zi.default)({port:zi.default.makeRange(mr.port,mr.port+100)})}this.appConfig=mr;const gr={dirs:{default:{prefix:`/${$i.KEYS.WEBSITE_PATH_MAIN}`,dir:Gn},[$i.KEYS.MODULE_LOAD_PREFIX]:{prefix:$i.KEYS.MODULE_LOAD_PREFIX,dir:cr,maxAge:0},[$i.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:$i.KEYS.NODE_MODULES_LOAD_PREFIX,dir:pr,maxAge:0},[$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:mr.srcPath,maxAge:0}}};try{await ki.promises.access(Gn,ki.constants.F_OK)}catch(Dt){this.logger.warn("websitePathMain 不存在:请先构建前端项目",(0,Xo.getErrorMessage)(Dt));await ki.promises.mkdir(Gn,{recursive:true})}if(Lt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await ki.promises.writeFile(mi.join(__dirname,".comphubConfig.json"),JSON.stringify(mr,null,2))}return{koa:{port:mr.port},staticFile:gr,httpProxy:{strategy:{[$i.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${$i.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${mr.remoteServer}/$1`}}}}}async startSubPort(){const Dt=this.app.getEnv();const Lt=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);const{port:Tn,remoteServer:Wn}=Lt;let Gn=await(0,zi.default)({port:zi.default.makeRange(Tn,Tn+100)});const rr=new Ui.default;rr.use((async(Dt,Gn)=>{if(Dt.path.startsWith($i.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:Tn}=Lt;const Wn=Dt.path[0];const Gn=Dt.path.replace($i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const rr=await wa.locate.resolveBuildPath(Gn,{baseDir:Tn});if(rr){const Lt=rr.replace(Tn,"");const cr=Oa.textKit.replaceSlashWithSpecifiedSeparator(Lt,Wn);if(Gn!==cr){const Lt=cr.replace(Gn,"");Dt.redirect(Dt.path+Lt);return}}}const rr=[{prefix:`/${$i.KEYS.REMOTE_SERVICE_PREFIX}`,target:Wn,rewrite:{[`^/${$i.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${$i.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{[`^/${$i.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:$i.KEYS.MODULE_LOAD_PREFIX,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}},{prefix:$i.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}},{prefix:$i.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${$i.KEYS.IFRAME_HOST}:${Tn}`,rewrite:{}}];for(const Lt of rr){if(Dt.path.startsWith(Lt.prefix)){await(0,Yo.createKoaProxy)(Dt,Lt.target,Lt.rewrite);return}}await Gn()}));rr.use((0,Vi.default)(this.websitePath,{index:false}));rr.use((async Dt=>{try{const Lt=(()=>{if(Dt.path.startsWith(`${$i.KEYS.IFRAME_ITEM_WEBSITE_PATH}/`)){return $i.KEYS.IFRAME_ITEM_WEBSITE_PATH}if(Dt.path.startsWith(`${$i.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}/`)){return $i.KEYS.IFRAME_CONTAINER_WEBSITE_PATH}return""})();const Tn=mi.join(this.websitePath,Lt,"index.html");const Wn=await ki.promises.readFile(Tn,"utf-8");const rr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:Gn})};<\/script>`;const cr=Wn.replace("\x3c!--GLOBAL_CONFIG--\x3e",rr);Dt.type="text/html; charset=utf-8";Dt.status=200;Dt.body=cr}catch(Lt){this.logger.error("读取 index.html 失败:",Lt);Dt.status=500;Dt.body="服务器内部错误"}}));await new Promise(((Tn,Wn)=>{let cr=0;const pr=rr.listen(Gn,(()=>{this.subServer=pr;this.app.setAttr($i.KEYS.COMPHUB_CONFIG_KEY,{...Lt,subPort:Gn});if(process.send){process.send({type:"subPort",subPort:Gn})}if(Dt===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${Gn} 已启动`)}Tn()}));pr.on("error",(Dt=>{if(Dt.code==="EADDRINUSE"&&cr<Ra.MAX_SUB_PORT_RETRIES){cr++;this.logger.error(`子端口 ${Gn} 被占用,正在尝试端口 ${++Gn}`);pr.close();pr.listen(Gn)}else{Wn(Dt)}}))}))}async printAccessInfo(Dt){const Lt=await Dt.getAsync(yr.Framework);const Tn=Lt.getServer();const Wn=Tn.address();const Gn=this.app.getEnv();const rr=this.app.getAttr($i.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",rr.cwd);this.logger.info("env:",Gn);this.logger.info("port:",rr.port);if(rr.subPort)this.logger.info("subPort:",rr.subPort);if(Wn&&typeof Wn!=="string"){const Dt=Wn.port;this.logger.info("Local Address:",`http://localhost:${Dt}`);if(Gn===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const Lt=wa.network.getLocalIPv4();if(Lt)this.logger.info("Network Address:",`http://${Lt}:${Dt}`);this.logger.info("Swagger UI:",`http://localhost:${Dt}/swagger-ui/index.html`)}}}async onConfigLoad(){const Dt=await(0,Qo.waitForIpcConfig)();const Lt=await this.buildConfig(Dt);const Tn=this.app.getEnv();if(Tn===$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await ki.promises.writeFile(mi.join(__dirname,".start.json"),JSON.stringify(Lt,null,2))}return Lt}async onReady(){this.app.setAttr($i.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([Wo.ReportMiddleware]);this.app.useFilter([Yi.BadRequestErrorFilter,Xi.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(Dt){this.setupProxy();await this.startSubPort();await this.printAccessInfo(Dt)}async onStop(){if(this.subServer){await new Promise((Dt=>{this.subServer.close((()=>Dt()))}));this.logger.info("子服务已关闭")}}};Lt.MainConfiguration=La;rr([(0,gr.Logger)("coreLogger"),pr("design:type",Object)],La.prototype,"logger",void 0);rr([(0,gr.App)(),pr("design:type",Object)],La.prototype,"app",void 0);Lt.MainConfiguration=La=rr([(0,gr.Configuration)({imports:[yr,Sr,Or,Hr,Gr,$r,Ia,{component:Er,enabledEnvironment:[$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Ir,enabledEnvironment:[$i.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:xa,local:Ta}]})],La)},83465:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CompController=void 0;const cr=Tn(46123);const pr=Tn(48795);const mr=Tn(63366);const gr=Tn(49179);const yr=Tn(8131);const Sr=Tn(101);const Er=Tn(19465);const Or=Tn(19385);const Ir=Tn(4990);const Hr=(0,Or.createNoData)(gr.ApiProperty);let Gr=class CompController{async dir(Dt){const Lt=await this.compService.getCompDir(Dt.compPath);return Or.resUtil.success(Lt)}async file(Dt){const{filePath:Lt}=Dt;const Tn=await this.compService.getCompFile(Lt);return Or.resUtil.success({content:Tn})}async check(Dt){const Lt=await this.compService.checkCompConfig(Dt.compPath,Dt.framework);return Or.resUtil.success(Lt)}async updateVersion(Dt){const{compPath:Lt,version:Tn}=Dt;await this.compService.updateCompVersion(Lt,Tn);return Or.resUtil.noData()}async generateCompJson(Dt){const{compPath:Lt}=Dt;await this.compService.generateCompJson(Lt);return Or.resUtil.noData()}async dep(Dt){const{compPath:Lt}=Dt;const Tn=await this.compService.getCompDep(Lt);return Or.resUtil.success({thirdParty:Tn})}async checkCompRepeat(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();const Lt=await this.compService.checkCompRepeat(Dt);return Or.resUtil.success(Lt)}async submit(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(Dt);return Or.resUtil.noData()}async update(Dt){await Ir.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(Dt);return Or.resUtil.noData()}async download(Dt){const Lt=await this.compService.downloadComp(Dt);if(Lt?.isRepeat){return Or.resUtil.success({isRepeat:true})}return Or.resUtil.success({isRepeat:false})}async localCompsByIds(Dt){const{compIds:Lt}=Dt;const Tn=await this.compService.getLocalCompsByIds(Lt);return Or.resUtil.success({compInfos:Tn})}async compFilesOssSignedUrl(Dt){const Lt=await this.compService.getCompFilesOssSignedUrl(Dt);return Or.resUtil.success(Lt)}async packageJson(){const Dt=await this.compService.getPackageJsonContent();return Or.resUtil.success({packageJson:Dt})}async compFileHash(Dt){const Lt=await this.compService.getCompFileHash(Dt);return Or.resUtil.success(Lt)}async localComps(Dt){const Lt=await this.compService.getLocalComps(Dt);return Or.resUtil.success(Lt)}async openCompPathInVscode(Dt){await this.compService.openCompPathInVscode(Dt);return Or.resUtil.noData()}async openCompPathInExplorer(Dt){await this.compService.openCompPathInExplorer(Dt);return Or.resUtil.noData()}async localCompDetailByPathHash(Dt){const Lt=await this.compService.getLocalCompDetailByPathHash(Dt);return Or.resUtil.success(Lt)}async writeFile(Dt){await this.compService.writeCompFile(Dt);return Or.resUtil.noData()}async renameDir(Dt){await this.compService.renameCompDir(Dt);return Or.resUtil.noData()}};Lt.CompController=Gr;Wn([(0,cr.App)(),Gn("design:type",Object)],Gr.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",pr.CompService)],Gr.prototype,"compService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",mr.ConfigService)],Gr.prototype,"configService",void 0);Wn([(0,gr.ApiOperation)({summary:"获取组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileVO)}),(0,cr.Post)("/dir"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompDirDTO]),Gn("design:returntype",Promise)],Gr.prototype,"dir",null);Wn([(0,gr.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileContentVO)}),(0,cr.Post)("/file"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFileDTO]),Gn("design:returntype",Promise)],Gr.prototype,"file",null);Wn([(0,gr.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompCheckVO)}),(0,cr.Post)("/check"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompCheckDTO]),Gn("design:returntype",Promise)],Gr.prototype,"check",null);Wn([(0,gr.ApiOperation)({summary:"更新组件版本号"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/updateVersion"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.UpdateVersionDTO]),Gn("design:returntype",Promise)],Gr.prototype,"updateVersion",null);Wn([(0,gr.ApiOperation)({summary:"生成组件指纹文件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/generateCompJson"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.GenerateCompJsonDTO]),Gn("design:returntype",Promise)],Gr.prototype,"generateCompJson",null);Wn([(0,gr.ApiOperation)({summary:"获取组件依赖关系"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.ImportScanResultVO)}),(0,cr.Post)("/dep"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.DepDTO]),Gn("design:returntype",Promise)],Gr.prototype,"dep",null);Wn([(0,gr.ApiOperation)({summary:"检查组件是否重复"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompSimilarListVO)}),(0,cr.Post)("/checkCompRepeat",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CheckCompRepeatDTO]),Gn("design:returntype",Promise)],Gr.prototype,"checkCompRepeat",null);Wn([(0,gr.ApiOperation)({summary:"提交组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/submit",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.SubmitCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"submit",null);Wn([(0,gr.ApiOperation)({summary:"更新组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/update",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.UpdateCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"update",null);Wn([(0,gr.ApiOperation)({summary:"下载组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.DownloadCompVO)}),(0,cr.Post)("/download",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.DownloadCompDTO]),Gn("design:returntype",Promise)],Gr.prototype,"download",null);Wn([(0,gr.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.LocalCompsByIdsVO)}),(0,cr.Post)("/localCompsByIds"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompsByIdsDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localCompsByIds",null);Wn([(0,gr.ApiOperation)({summary:"获取组件文件夹下所有文件的oss签名访问地址"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFilesOssSignedUrlVO)}),(0,cr.Post)("/compFilesOssSignedUrl",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFilesOssSignedUrlDTO]),Gn("design:returntype",Promise)],Gr.prototype,"compFilesOssSignedUrl",null);Wn([(0,gr.ApiOperation)({summary:"获取package.json"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.PackageJsonVO)}),(0,cr.Post)("/packageJson"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Gr.prototype,"packageJson",null);Wn([(0,gr.ApiOperation)({summary:"获取组件文件hash"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.CompFileHashVO)}),(0,cr.Post)("/compFileHash"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompFileHashDTO]),Gn("design:returntype",Promise)],Gr.prototype,"compFileHash",null);Wn([(0,gr.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,(0,Or.createListWrapper)(gr.ApiProperty,Sr.LocalCompsVO))}),(0,cr.Post)("/localComps",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompsDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localComps",null);Wn([(0,gr.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/openCompPathInVscode"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.OpenCompPathInVscodeDTO]),Gn("design:returntype",Promise)],Gr.prototype,"openCompPathInVscode",null);Wn([(0,gr.ApiOperation)({summary:"在系统文件管理器中打开并选中组件文件"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/openCompPathInExplorer"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.OpenCompPathInExplorerDTO]),Gn("design:returntype",Promise)],Gr.prototype,"openCompPathInExplorer",null);Wn([(0,gr.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:(0,Or.createSuccessWrapper)(gr.ApiProperty,Sr.LocalCompDetailVO)}),(0,cr.Post)("/localCompDetailByPathHash"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.LocalCompDetailByPathHashDTO]),Gn("design:returntype",Promise)],Gr.prototype,"localCompDetailByPathHash",null);Wn([(0,gr.ApiOperation)({summary:"写入文件到组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/writeFile"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.CompWriteFileDTO]),Gn("design:returntype",Promise)],Gr.prototype,"writeFile",null);Wn([(0,gr.ApiOperation)({summary:"重命名组件目录"}),(0,gr.ApiResponse)({status:200,description:"返回结果",type:Hr}),(0,cr.Post)("/renameDir"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[yr.RenameCompDirDTO]),Gn("design:returntype",Promise)],Gr.prototype,"renameDir",null);Lt.CompController=Gr=Wn([(0,gr.ApiTags)(["comp"]),(0,cr.Controller)("/comp")],Gr)},96736:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ModuleController=void 0;const cr=Tn(46123);const pr=Tn(49179);const mr=Tn(85984);const gr=Tn(19428);const yr=Tn(71692);const Sr=Tn(61275);const Er=Tn(19385);const Or=(0,Er.createNoData)(pr.ApiProperty);let Ir=class ModuleController{async preBuild(Dt){const{deps:Lt}=Dt;let Tn=null;await this.queueService.enqueue((async()=>{Tn=await this.moduleService.preBuild(Lt)}));return Er.resUtil.success(Tn)}async buildTemplateCompiler(Dt){let Lt=null;await this.queueService.enqueue((async()=>{Lt=await this.moduleService.buildTemplateCompiler(Dt.vueVersion)}));return Er.resUtil.success(Lt)}async preBuildSize(){const Dt=await this.moduleService.preBuildSize();return Er.resUtil.success({size:Dt})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Er.resUtil.noData()}};Lt.ModuleController=Ir;Wn([(0,cr.Inject)(),Gn("design:type",mr.ModuleService)],Ir.prototype,"moduleService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.QueueService)],Ir.prototype,"queueService",void 0);Wn([(0,pr.ApiOperation)({summary:"模块预构建"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.PreBuildVO)}),(0,cr.Post)("/preBuild"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.PreBuildDTO]),Gn("design:returntype",Promise)],Ir.prototype,"preBuild",null);Wn([(0,pr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,pr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.BuildTemplateCompilerVO)}),(0,cr.Post)("/buildTemplateCompiler"),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.BuildTemplateCompilerDTO]),Gn("design:returntype",Promise)],Ir.prototype,"buildTemplateCompiler",null);Wn([(0,pr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,Er.createSuccessWrapper)(pr.ApiProperty,yr.PreBuildSizeVO)}),(0,cr.Post)("/preBuildSize"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Ir.prototype,"preBuildSize",null);Wn([(0,pr.ApiOperation)({summary:"清除预构建模块文件"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:Or}),(0,cr.Post)("/clearPreBuild"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Ir.prototype,"clearPreBuild",null);Lt.ModuleController=Ir=Wn([(0,pr.ApiTags)(["module"]),(0,cr.Controller)("/module")],Ir)},54991:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.OssController=void 0;const cr=Tn(46123);const pr=Tn(49179);const mr=Tn(19385);const gr=Tn(56415);const yr=Tn(75049);const Sr=Tn(80799);const Er=Tn(19465);let Or=class OssController{async fileSignUrl(Dt){const{objectId:Lt}=Dt;const Tn=await this.ossService.getDownloadSts();const Wn=await this.ossService.getFilePreviewUrl(Tn,Lt);return mr.resUtil.success({signUrl:Wn})}};Lt.OssController=Or;Wn([(0,cr.App)(),Gn("design:type",Object)],Or.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.OssService)],Or.prototype,"ossService",void 0);Wn([(0,pr.ApiOperation)({summary:"获取文件访问地址",description:"获取文件访问地址"}),(0,pr.ApiResponse)({status:200,description:"返回结果",type:(0,mr.createSuccessWrapper)(pr.ApiProperty,yr.SignedUrlVO)}),(0,cr.Post)("/fileSignUrl",{middleware:[Er.TokenMiddleware]}),rr(0,(0,cr.Body)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.SignedUrlDTO]),Gn("design:returntype",Promise)],Or.prototype,"fileSignUrl",null);Lt.OssController=Or=Wn([(0,pr.ApiTags)(["oss"]),(0,cr.Controller)("/oss")],Or)},64754:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr;Object.defineProperty(Lt,"__esModule",{value:true});Lt.ProxyController=void 0;const cr=Tn(46123);const pr=Tn(26815);const mr=pr.KEYS.PROXY_PATH_PREFIX;let gr=rr=class ProxyController{async proxy(){const Dt=this.ctx.path.replace(mr,"");let Lt=null;for(const[Tn,Wn]of Object.entries(rr.proxys)){const Gn=new RegExp(Tn);if(Gn.test(Dt)||Dt.startsWith(Tn)){Lt=Wn;break}}if(!Lt){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:Tn,event:Wn}=Lt;await new Promise(((Dt,Lt)=>{Tn(this.ctx.req,this.ctx.res);Wn.on("error",Lt);Wn.on("proxyRes",Dt)}))}};Lt.ProxyController=gr;Wn([(0,cr.Inject)(),Gn("design:type",Object)],gr.prototype,"ctx",void 0);Wn([(0,cr.All)("/*"),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],gr.prototype,"proxy",null);Lt.ProxyController=gr=rr=Wn([(0,cr.Controller)(mr,{ignoreGlobalPrefix:true})],gr)},17076:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SpaController=void 0;const mr=Tn(46123);const gr=cr(Tn(79896));const yr=Tn(16928);const Sr=Tn(49179);const Er=Tn(63366);const Or=Tn(26815);let Ir=class SpaController{async index(){this.ctx.redirect(`/${Or.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const Dt=this.configService.comphubConfig();const{websitePath:Lt}=Dt;const Tn=(0,yr.resolve)(Lt,"index.html");let Wn=await gr.promises.readFile(Tn,"utf-8");const Gn=this.configService.getGlobalConfig();const{projectHash:rr}=Gn;if(rr){Wn=Wn.replace(/<base[^>]*>/gi,"");Wn=Wn.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${rr}/main/">`)}const cr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(Gn)};<\/script>`;Wn=Wn.replace("\x3c!--GLOBAL_CONFIG--\x3e",cr);return Wn}async getGlobalConfig(){return this.configService.getGlobalConfig()}};Lt.SpaController=Ir;rr([(0,mr.Inject)(),pr("design:type",Object)],Ir.prototype,"ctx",void 0);rr([(0,mr.App)(),pr("design:type",Object)],Ir.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Er.ConfigService)],Ir.prototype,"configService",void 0);rr([(0,mr.Get)("/"),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"index",null);rr([(0,mr.Get)(`/${Or.KEYS.WEBSITE_PATH_MAIN}/*`),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"spa",null);rr([(0,mr.Get)(Or.KEYS.GLOBAL_CONFIG_PATH),pr("design:type",Function),pr("design:paramtypes",[]),pr("design:returntype",Promise)],Ir.prototype,"getGlobalConfig",null);Lt.SpaController=Ir=rr([(0,Sr.ApiExcludeController)(),(0,mr.Controller)("/",{ignoreGlobalPrefix:true})],Ir)},44734:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__param||function(Dt,Lt){return function(Tn,Wn){Lt(Tn,Wn,Dt)}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VuefinderController=void 0;const cr=Tn(46123);const pr=Tn(5808);const mr=Tn(49179);const gr=Tn(23444);let yr=class VuefinderController{async list(Dt){const Lt=await this.vuefinderService.list(Dt);return Lt}};Lt.VuefinderController=yr;Wn([(0,cr.App)(),Gn("design:type",Object)],yr.prototype,"app",void 0);Wn([(0,cr.Inject)(),Gn("design:type",pr.VuefinderService)],yr.prototype,"vuefinderService",void 0);Wn([(0,mr.ApiOperation)({summary:"list"}),(0,cr.Get)("/list"),rr(0,(0,cr.Query)()),Gn("design:type",Function),Gn("design:paramtypes",[gr.VueFinderIndexDTO]),Gn("design:returntype",Promise)],yr.prototype,"list",null);Lt.VuefinderController=yr=Wn([(0,mr.ApiTags)(["vuefinder"]),(0,cr.Controller)("/vuefinder")],yr)},60149:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BasePageDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class BasePageDTO{}Lt.BasePageDTO=BasePageDTO;Wn([(0,rr.ApiProperty)({example:1,description:"当前页码",required:false}),(0,cr.Rule)(cr.RuleType.number().min(1)),Gn("design:type",Number)],BasePageDTO.prototype,"page",void 0);Wn([(0,rr.ApiProperty)({example:10,description:"每页数量",required:false}),(0,cr.Rule)(cr.RuleType.number().min(1).max(50)),Gn("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);Wn([(0,cr.Rule)(cr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,rr.ApiProperty)({example:"小明",description:"关键词",required:false}),Gn("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.RenameCompDirDTO=Lt.CompWriteFileDTO=Lt.LocalCompDetailByPathHashDTO=Lt.OpenCompPathInExplorerDTO=Lt.OpenCompPathInVscodeDTO=Lt.LocalCompsDTO=Lt.CompFilesOssSignedUrlDTO=Lt.DownloadCompDTO=Lt.UpdateCompDTO=Lt.SubmitCompDTO=Lt.DepItemDTO=Lt.CompFileDTO=Lt.UpdateVersionDTO=Lt.CompFileHashDTO=Lt.CheckCompRepeatDTO=Lt.LocalCompsByIdsDTO=Lt.DepDTO=Lt.GenerateCompJsonDTO=Lt.CompCheckDTO=Lt.CompDirDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);const pr=Tn(26815);const mr=Tn(60149);class CompPathDTO{}Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}Wn([(0,rr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}Lt.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}Lt.CompCheckDTO=CompCheckDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}Lt.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}Lt.DepDTO=DepDTO;class LocalCompsByIdsDTO{}Lt.LocalCompsByIdsDTO=LocalCompsByIdsDTO;Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}Lt.CheckCompRepeatDTO=CheckCompRepeatDTO;Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}Lt.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}Lt.UpdateVersionDTO=UpdateVersionDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}Lt.CompFileDTO=CompFileDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,cr.Rule)(cr.RuleType.array().optional().items(cr.RuleType.string())),Gn("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}Wn([(0,rr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],ParentDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}Lt.DepItemDTO=DepItemDTO;Wn([(0,rr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DepItemDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DepItemDTO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,cr.Rule)(cr.RuleType.object().optional()),Gn("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}Lt.SubmitCompDTO=SubmitCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);Wn([(0,rr.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,cr.Rule)(cr.RuleType.array().required()),Gn("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);Wn([(0,rr.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,cr.Rule)(cr.RuleType.array().required()),Gn("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,cr.Rule)(cr.RuleType.string().empty("").default("")),Gn("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,cr.Rule)(cr.RuleType.array().items(cr.RuleType.string())),Gn("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}Lt.UpdateCompDTO=UpdateCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,cr.Rule)(cr.RuleType.string().allow("").max(200)),Gn("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}Lt.DownloadCompDTO=DownloadCompDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);Wn([(0,rr.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,cr.Rule)(cr.RuleType.boolean().default(false)),Gn("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class CompFilesOssSignedUrlDTO{}Lt.CompFilesOssSignedUrlDTO=CompFilesOssSignedUrlDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"对象存储id",example:"123"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompFilesOssSignedUrlDTO.prototype,"objectId",void 0);Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件文件路径",example:"MyComp/index.vue"}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],CompFilesOssSignedUrlDTO.prototype,"files",void 0);class LocalCompsDTO extends mr.BasePageDTO{}Lt.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}Lt.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class OpenCompPathInExplorerDTO{}Lt.OpenCompPathInExplorerDTO=OpenCompPathInExplorerDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInExplorerDTO.prototype,"folderPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],OpenCompPathInExplorerDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}Lt.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}Lt.CompWriteFileDTO=CompWriteFileDTO;Wn([(0,rr.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"文件名",example:pr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);Wn([(0,rr.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}Lt.RenameCompDirDTO=RenameCompDirDTO;Wn([(0,rr.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BuildTemplateCompilerDTO=Lt.PreBuildDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class PreBuildDTO{}Lt.PreBuildDTO=PreBuildDTO;Wn([(0,rr.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,cr.Rule)(cr.RuleType.array().required().items(cr.RuleType.string())),Gn("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}Lt.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;Wn([(0,rr.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,cr.Rule)(cr.RuleType.string().required()),Gn("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},56415:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SignedUrlDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class SignedUrlDTO{}Lt.SignedUrlDTO=SignedUrlDTO;Wn([(0,cr.Rule)(cr.RuleType.string().required().error(new Error("对象id不能为空"))),(0,rr.ApiProperty)({example:"",description:"对象id",required:true}),Gn("design:type",String)],SignedUrlDTO.prototype,"objectId",void 0)},23444:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VueFinderIndexDTO=void 0;const rr=Tn(49179);const cr=Tn(99375);class VueFinderIndexDTO{}Lt.VueFinderIndexDTO=VueFinderIndexDTO;Wn([(0,rr.ApiProperty)({required:false,description:"文件路径"}),(0,cr.Rule)(cr.RuleType.string()),Gn("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BadRequestErrorFilter=void 0;const Gn=Tn(46123);const rr=Tn(19385);const cr=Tn(26815);let pr=class BadRequestErrorFilter{async catch(Dt,Lt){const Tn=Lt.app.getEnv();if(Tn===cr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("BadRequestErrorFilter==>",Dt)}return rr.resUtil.error(Dt.message,Dt.status)}};Lt.BadRequestErrorFilter=pr;Lt.BadRequestErrorFilter=pr=Wn([(0,Gn.Catch)(Gn.httpError.BadRequestError)],pr)},54633:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DefaultErrorFilter=void 0;const Gn=Tn(46123);const rr=Tn(26815);let cr=class DefaultErrorFilter{async catch(Dt,Lt){const Tn=Lt.app.getEnv();try{const Lt=JSON.parse(Dt.message);return{...Lt}}catch(Dt){if(Tn===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("解析错误信息失败==>",Dt.message,"\n")}}finally{if(Tn===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){Lt.logger.error("原始错误==>",Dt)}}Lt.status=Dt.status??500;return{code:Dt.status??500,message:Dt.message??"未知错误"}}};Lt.DefaultErrorFilter=cr;Lt.DefaultErrorFilter=cr=Wn([(0,Gn.Catch)()],cr)},15545:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(12799);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.MainConfiguration}});Gn(Tn(14071),Lt);Gn(Tn(91921),Lt);Gn(Tn(83465),Lt);Gn(Tn(96736),Lt);Gn(Tn(54991),Lt);Gn(Tn(64754),Lt);Gn(Tn(17076),Lt);Gn(Tn(44734),Lt);Gn(Tn(60149),Lt);Gn(Tn(8131),Lt);Gn(Tn(19428),Lt);Gn(Tn(56415),Lt);Gn(Tn(23444),Lt);Gn(Tn(59416),Lt);Gn(Tn(54633),Lt);Gn(Tn(9711),Lt);Gn(Tn(53951),Lt);Gn(Tn(77523),Lt);Gn(Tn(61142),Lt);Gn(Tn(19465),Lt);Gn(Tn(95637),Lt);Gn(Tn(48795),Lt);Gn(Tn(63366),Lt);Gn(Tn(23086),Lt);Gn(Tn(85984),Lt);Gn(Tn(80799),Lt);Gn(Tn(61275),Lt);Gn(Tn(19452),Lt);Gn(Tn(5808),Lt);Gn(Tn(66593),Lt);Gn(Tn(58953),Lt);Gn(Tn(49969),Lt);Gn(Tn(4145),Lt);Gn(Tn(10778),Lt);Gn(Tn(67872),Lt);Gn(Tn(101),Lt);Gn(Tn(71692),Lt);Gn(Tn(75049),Lt)},9711:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},53951:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},77523:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},61142:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ReportMiddleware=void 0;const Gn=Tn(46123);let rr=class ReportMiddleware{resolve(){return async(Dt,Lt)=>{const Tn=Date.now();const Wn=await Lt();const Gn=Dt.url;Dt.logger.info(`请求 ${Dt.method} ${Gn} → ${Dt.status} (${Date.now()-Tn}ms)`);return Wn}}static getName(){return"report"}};Lt.ReportMiddleware=rr;Lt.ReportMiddleware=rr=Wn([(0,Gn.Middleware)()],rr)},19465:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TokenMiddleware=void 0;const Gn=Tn(46123);const rr=Tn(10778);let cr=class TokenMiddleware{resolve(){return async(Dt,Lt)=>{(0,rr.setHeader)(Dt.header);await Lt()}}static getName(){return"token"}};Lt.TokenMiddleware=cr;Lt.TokenMiddleware=cr=Wn([(0,Gn.Middleware)()],cr)},95637:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CommandService=void 0;const cr=Tn(46123);const pr=rr(Tn(79896));const mr=Tn(63366);const gr=Tn(7455);const yr=rr(Tn(16928));const Sr=Tn(68255);const Er=Tn(35317);const Or=rr(Tn(70857));let Ir=class CommandService{async revealInVSCode(Dt,Lt,Tn=1,Wn=1){const{cwd:Gn}=this.configService.comphubConfig();if(!Dt||!pr.default.existsSync(Dt)||!pr.default.statSync(Dt).isDirectory()){throw new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const rr=yr.default.resolve(Dt,Lt);if(!pr.default.existsSync(rr)||pr.default.statSync(rr).isDirectory()){throw new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,gr.launchIDE)({file:Gn});(0,gr.launchIDE)({file:rr,line:Tn,column:Wn})}revealInExplorer(Dt,Lt){return new Promise(((Tn,Wn)=>{if(!Dt||!pr.default.existsSync(Dt)||!pr.default.statSync(Dt).isDirectory()){Wn(new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist")));return}const Gn=yr.default.resolve(Dt,Lt);if(!pr.default.existsSync(Gn)||pr.default.statSync(Gn).isDirectory()){Wn(new cr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist")));return}const rr=Or.default.platform();if(rr==="win32"){(0,Er.exec)(`explorer /select,"${Gn}"`,(()=>{Tn(Gn)}))}else{(0,Er.exec)(`open -R "${Gn}"`,(Dt=>{if(Dt){Wn(new cr.httpError.InternalServerErrorError(this.i18nService.translate("local.command.errors.openExplorerFailed",{args:[Dt.message]})));return}Tn(Gn)}))}}))}};Lt.CommandService=Ir;Wn([(0,cr.Inject)(),Gn("design:type",mr.ConfigService)],Ir.prototype,"configService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Object)],Ir.prototype,"ctx",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.MidwayI18nService)],Ir.prototype,"i18nService",void 0);Lt.CommandService=Ir=Wn([(0,cr.Provide)()],Ir)},48795:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CompService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(63366);const Er=Tn(23086);const Or=Tn(85984);const Ir=Tn(80799);const Hr=cr(Tn(70857));const Gr=cr(Tn(10232));const $r=Tn(87518);const mi=Tn(84464);const ki=Tn(95637);const Ni=Tn(26815);const Ri=Tn(18801);const ji=Tn(4990);const Ui=Tn(68255);let Vi=class CompService{getCompFullPath(Dt){const{srcPath:Lt}=this.configService.comphubConfig();Dt=Dt.replace(Ni.KEYS.FILE_MANAGER_DIRNAME,"");const Tn=gr.join(Lt,Dt);return Tn}checkCompEntryIndex(Dt,Lt=Ni.KEYS.COMP_FRAMEWORK_VUE){if(Lt===Ni.KEYS.COMP_FRAMEWORK_REACT){for(const Lt of Ni.KEYS.COMP_USE_ENTRY_FILE_REACT){const Tn=gr.join(Dt,Lt);if(yr.existsSync(Tn)){return Lt}}throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[Ni.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const Tn=gr.join(Dt,Ni.KEYS.COMP_USE_ENTRY_FILE);if(!yr.existsSync(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[Ni.KEYS.COMP_USE_ENTRY_FILE]}))}return Ni.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(Dt){const Lt=this.getCompFullPath(Dt);const Tn=gr.join(Lt,Ni.KEYS.COMP_CONFIG_FILENAME);if(!yr.existsSync(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(Dt){const Lt=Object.keys(Dt);const Tn=Ni.ARRAY.COMP_DEFAULT_FIELD.every((Dt=>!Dt.required||Lt.includes(Dt.name)));if(!Tn)return false;return Ri.versionKit.validateVersion(Dt.version)}async updateCompJson(Dt,Lt){const Tn=this.getCompFullPath(Dt);const Wn=gr.join(Tn,Ni.KEYS.COMP_CONFIG_FILENAME);const Gn=await this.getCompFile(Wn);const rr=Lt(JSON.parse(Gn));await yr.promises.writeFile(Wn,JSON.stringify(rr,null,4))}async readCompVersion(Dt){const Lt=gr.join(Dt,Ni.KEYS.COMP_CONFIG_FILENAME);const Tn=await this.getCompFile(Lt);const Wn=JSON.parse(Tn);return Wn.version}initCompJson(){return Ni.ARRAY.COMP_DEFAULT_FIELD.reduce(((Dt,Lt)=>{const Tn={};if(Lt.required){Tn[Lt.name]=Lt.default}return{...Dt,...Tn}}),{})}async uploadCompFolderToOss({compFullPath:Dt,version:Lt,ossData:Tn}){const{files:Wn}=await $r.fileTree.generateTree(Dt);const Gn=Wn.map((({absolutePath:Lt,size:Tn})=>{const Wn=Lt.replace(Dt,"");return{filePath:Wn,fileFullPath:Lt,size:Tn??0}}));Gn.sort(((Dt,Lt)=>Lt.size-Dt.size));for(let Dt=0;Dt<Gn.length;Dt++){const{filePath:Wn,fileFullPath:rr}=Gn[Dt];const cr=gr.join(Tn.key,Lt,Wn);const pr={...Tn,key:cr.replace(new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g"),"/")};const mr=yr.createReadStream(rr);await this.ossService.uploadFileToOss(pr,mr)}}async uploadPreBuildFilesToOss(Dt){const Lt=Object.values(Dt.entryNameToFile||{});const Tn=Array.from(new Set([...Lt,...Dt.chunkFiles||[]]));if(Tn.length===0)return;const Wn=await ji.remoteApi.v1Oss.osscontrollerPrebuildputpolicy();const Gn=Wn.data;const{cwd:rr}=this.configService.comphubConfig();const cr=gr.join(rr,Ni.KEYS.PREBUILD_MODULE_DIR);for(const Dt of Tn){const Lt=gr.join(cr,Dt);if(!yr.existsSync(Lt)){this.ctx.logger.warn(`预编译产物文件不存在,跳过上传: ${Lt}`);continue}const Tn=yr.createReadStream(Lt);const Wn={...Gn,key:Dt};await this.ossService.uploadFileToOss(Wn,Tn,true)}}async getCompHash(Dt){const Lt=await $r.digest.getFileHashList(Dt);const Tn=Lt.map((Dt=>`${Dt.relativePath}-${Dt.hash}`)).join(";");return $r.digest.getStringHash(Tn)}async getCompFeatures(Dt){const Lt=await $r.digest.getFileHashAndSsdeepList(Dt);const Tn=Lt.map((Dt=>{const Lt=(0,mi.omit)(Dt,["relativePath"]);return{...Lt,path:Dt.relativePath}}));const Wn=await $r.digest.getRelativeDirList(Dt);const Gn=JSON.stringify(Wn);const rr=$r.digest.getStringFuzzyHash(Gn);const cr=await this.getCompHash(Dt);return{fileHashList:Tn,compHash:cr,dirHash:$r.digest.getStringHash(Gn),dirSsdeep:$r.digest.getSsdeepStruct(rr)}}async getCompFileList(Dt){const{files:Lt}=await $r.fileTree.generateTree(Dt,{withStats:true,calculateSize:true});const Tn=Lt.map((({name:Lt,size:Tn,absolutePath:Wn})=>({name:Lt,size:Tn??0,path:Wn.replace(Dt,"").replace(new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g"),"/")})));return Tn}checkCompFileSize(Dt){if(Dt>Ni.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(Ni.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(Dt){if(Dt>Ni.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[Ni.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(Dt){const Lt=Ni.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const Tn=Math.floor(Lt/1024/1024);for(const Wn of Dt){if(Wn.size>Lt){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[Wn.path,Tn.toString()]}))}}}async findCompJsonPath(Dt){const{files:Lt}=await $r.fileTree.generateTree(Dt,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",Lt.length);const Tn=Lt.filter((({absolutePath:Dt})=>Dt.endsWith(Ni.KEYS.COMP_CONFIG_FILENAME)));return Tn}async getAllLocalCompIds(){const{srcPath:Dt}=this.configService.comphubConfig();const Lt=await this.findCompJsonPath(Dt);this.ctx.logger.debug("组件文件数量:",Lt.length);const Tn=Lt.map((async({absolutePath:Dt})=>{const Lt=await yr.promises.readFile(Dt,"utf8");const Tn=JSON.parse(Lt);const Wn=this.checkCompJsonFormat(Tn);const Gn=gr.dirname(Dt);return{compjson:Tn,isCompHub:Wn,compPath:Gn,pathHash:$r.digest.getStringHash(Gn)}}));const Wn=await Promise.all(Tn);return Wn.filter((Dt=>Dt.isCompHub&&Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(Dt){const{srcPath:Lt}=this.configService.comphubConfig();const Tn=gr.join(Dt.replace(Ni.KEYS.FILE_MANAGER_DIRNAME,`${Lt}${gr.sep}`));const{tree:Wn,files:Gn}=await $r.fileTree.generateTree(Tn,{sortBy:"type"});const _handleTree=Dt=>{const Lt={name:Dt.name,path:Dt.absolutePath,type:Dt.type};if(Dt.children&&Dt.children.length>0){Lt.children=Dt.children.map((Dt=>_handleTree(Dt)))}return Lt};return{tree:_handleTree(Wn),files:Gn.map((Dt=>Dt.absolutePath))}}async getCompFile(Dt){const Lt=await yr.promises.readFile(Dt,"utf-8");return Lt}async checkCompConfig(Dt,Lt=Ni.KEYS.COMP_FRAMEWORK_VUE){const Tn=gr.basename(Dt);const Wn=this.getCompFullPath(Dt);let Gn;try{const Dt=this.checkCompEntryIndex(Wn,Lt);Gn=gr.join(Tn,Dt)}catch(Dt){this.ctx.logger.error("检查组件入口文件失败",Dt);return{errorMsg:Dt.message}}try{this.checkCompJson(Dt)}catch(Dt){this.ctx.logger.error("检查组件配置文件comp.json失败",Dt);return{entryIndexPath:Gn,errorMsg:Dt.message}}const rr=gr.join(Tn,Ni.KEYS.COMP_CONFIG_FILENAME);try{const Lt=gr.join(this.getCompFullPath(Dt),Ni.KEYS.COMP_CONFIG_FILENAME);const Tn=await this.getCompFile(Lt);const Wn=this.checkCompJsonFormat(JSON.parse(Tn));if(!Wn){return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(Dt){this.ctx.logger.error("读取组件配置文件comp.json失败",Dt);return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:Gn,compJsonPath:rr,errorMsg:""}}async updateCompVersion(Dt,Lt){const Tn=Ri.versionKit.validateVersion(Lt);if(!Tn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const Wn=this.getCompFullPath(Dt);const Gn=gr.join(Wn,Ni.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(Gn);const cr=JSON.parse(rr);cr.version=Lt;const pr=JSON.stringify(cr,null,2);await yr.promises.writeFile(Gn,pr)}async generateCompJson(Dt){const Lt=this.getCompFullPath(Dt);const Tn=gr.basename(Lt);const Wn=this.initCompJson();Wn.name=Tn;await yr.promises.writeFile(gr.join(Lt,Ni.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(Wn,null,4))}async getCompDep(Dt){const{cwd:Lt}=this.configService.comphubConfig();const Tn=this.getCompFullPath(Dt);const Wn=await this.depsService.getModuleEntry(Tn,Lt);return Wn}async getCompFileHash(Dt){const{compPath:Lt}=Dt;const Tn=this.getCompFullPath(Lt);const Wn=await this.getCompFeatures(Tn);return{compHash:Wn.compHash}}async checkCompRepeat(Dt){const{compPath:Lt,teamId:Tn}=Dt;const Wn=this.getCompFullPath(Lt);const Gn=await this.getCompFeatures(Wn);const rr=await ji.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(Gn,{headers:{"team-id":Tn}});return rr.data}async submitComp(Dt){let Lt="";let Tn={};try{const{compPath:Wn,dep:Gn,previewConfigs:rr,desc:cr,bgColor:pr,name:mr,teamId:gr,tags:yr,framework:Sr}=Dt;Tn={"team-id":gr};this.checkCompJson(Wn);const Er=this.getCompFullPath(Wn);const Or=await this.getCompFeatures(Er);this.checkCompEntryIndex(Er,Sr);const Ir=await this.readCompVersion(Er);const Hr=await this.getCompFileList(Er);const Gr=Hr.reduce(((Dt,Lt)=>Dt+Lt.size),0);this.checkCompFileNum(Hr.length);this.checkCompFileSize(Gr);this.checkCompSingleFileSize(Hr);const $r=await this.getPreBuildInfo(Gn);const mi={name:mr,dep:Gn,previewConfigs:rr,desc:cr,version:Ir,size:Gr,files:Hr,bgColor:pr,compFeatures:Or,tags:yr,preBuildInfo:$r};const ki=await ji.remoteApi.v1Comp.compcontrollerUpload(mi,{headers:Tn});const Ri=ki.data._id;Lt=Ri;await this.updateCompJson(Wn,(Dt=>({...Dt,name:mr,[Ni.KEYS.COMP_FIELD_COMP_ID]:Ri})));const{data:{componentDir:Ui}}=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const Vi=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Ui});const zi={compFullPath:Er,version:Ir,ossData:Vi.data};await this.uploadCompFolderToOss(zi);await this.uploadPreBuildFilesToOss($r);const{key:Ki}=Vi.data;const $i={compId:Ri,objectId:`${Ui}${Ki}`};await ji.remoteApi.v1Comp.compcontrollerUpdateobjectid($i)}catch(Dt){if(Lt){await ji.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:Lt},{headers:Tn})}if(Dt instanceof mr.httpError.BadRequestError){throw new mr.httpError.BadRequestError(Dt)}throw new Error(Dt.message)}}async updateComp(Dt){const{compId:Lt,compPath:Tn,dep:Wn,previewConfigs:Gn,desc:rr,bgColor:cr,name:pr,upgradeDesc:mr,teamId:Sr,tags:Er,framework:Or}=Dt;const Ir=this.getCompFullPath(Tn);const Hr=await this.getCompFeatures(Ir);this.checkCompEntryIndex(Ir,Or);const Gr=await ji.remoteApi.v1Comp.compcontrollerCompdetail({compId:Lt});const{objectId:$r,version:mi}=Gr.data;const ki=await this.readCompVersion(Ir);const Ri=await this.getCompFileList(Ir);const Ui=Ri.reduce(((Dt,Lt)=>Dt+Lt.size),0);this.checkCompFileNum(Ri.length);this.checkCompFileSize(Ui);this.checkCompSingleFileSize(Ri);const Vi=await this.getPreBuildInfo(Wn);const zi={compId:Lt,name:pr,dep:Wn,previewConfigs:Gn,desc:rr,version:ki,size:Ui,files:Ri,bgColor:cr,compFeatures:Hr,upgradeDesc:mr,tags:Er,preBuildInfo:Vi};const Ki=await ji.remoteApi.v1Comp.compcontrollerUpdate(zi,{headers:{"team-id":Sr}});const{isFileChange:$i}=Ki.data;if(!$i&&mi===ki){await this.uploadPreBuildFilesToOss(Vi);const Dt=gr.join(Ir,Ni.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(yr.existsSync(Dt)){const Lt=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const Tn=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Lt.data.componentDir});const Wn=$r.replace(Tn.data.dir,"");const Gn=gr.join(Wn,ki,Ni.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const rr=yr.createReadStream(Dt);const cr={...Tn.data,key:Gn};await this.ossService.uploadFileToOss(cr,rr,true)}return}const Xi=await ji.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Yi}=Xi.data;const Wo=await ji.remoteApi.v1Oss.osscontrollerPutpolicy({type:Yi});const Ho=$r.replace(Wo.data.dir,"");const Go={...Wo.data,key:Ho};const Xo={compFullPath:Ir,version:ki,ossData:Go};await this.uploadCompFolderToOss(Xo);await this.uploadPreBuildFilesToOss(Vi);await this.updateCompJson(Tn,(Dt=>({...Dt,name:pr,[Ni.KEYS.COMP_FIELD_COMP_ID]:Lt})))}async getPreBuildInfo(Dt){const Lt=await this.moduleService.preBuild(Dt.map((Dt=>Dt.name)));return{entryNameToFile:Lt.entryNameToFile,chunkFiles:Lt.chunkFiles}}async downloadComp(Dt){const{compId:Lt,savePath:Tn,isCover:Wn,compName:Gn,version:rr}=Dt;const{srcPath:cr}=this.configService.comphubConfig();const pr=Ni.KEYS.FILE_MANAGER_DIRNAME;const Sr=Tn.replace(pr,"").replace(/[/\\]/g,gr.sep);const Er=gr.join(cr,Sr,Gn);if(!Wn&&yr.existsSync(Er)){return{isRepeat:true}}const Or=Hr.tmpdir();const Ir=gr.join(Or,Ni.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Ir);const mi=await ji.remoteApi.v1Comp.compcontrollerCompdetail({compId:Lt,version:rr});if(!mi?.data){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:ki,objectId:Ri,name:Ui}=mi.data;let Vi=[];const zi=gr.join(Ir,Ri,rr);if(yr.existsSync(zi)){const{files:Dt}=await $r.fileTree.generateTree(zi);Vi=Dt}await ji.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:Lt,version:rr});if(ki.length===Vi.length){const Dt=Vi.find((({absolutePath:Dt})=>Dt.replace(zi,"").startsWith(`${gr.sep}${Ni.KEYS.COMP_CONFIG_FILENAME}`)));if(Dt){const Lt=await yr.promises.readFile(Dt.absolutePath,"utf8");const Tn=JSON.parse(Lt);const{name:Wn}=Tn;if(Ui===Wn){await Gr.copy(zi,Er);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const Ki=ki.map((Dt=>{const Lt=gr.join(Ri,rr,Dt.path);return{path:Lt.replace(/[/\\]/g,"/")}}));const $i=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath($i,Ki,Ir);const Xi=gr.join(Ir,Ri,rr);await Gr.copy(Xi,Er)}async getLocalCompsByIds(Dt){const{srcPath:Lt}=this.configService.comphubConfig();const Tn=await this.findCompJsonPath(Lt);this.ctx.logger.debug("组件文件数量:",Tn.length);const Wn=Tn.map((async({absolutePath:Dt})=>{const Lt=await yr.promises.readFile(Dt,"utf8");const Tn=JSON.parse(Lt);return{...Tn,path:gr.dirname(Dt)}}));const Gn=await Promise.all(Wn);const rr=Gn.filter((Lt=>Dt.includes(Lt[Ni.KEYS.COMP_FIELD_COMP_ID])));if(!rr){return[]}const cr=Ni.KEYS.FILE_MANAGER_DIRNAME;const pr=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const mr=rr.map((Dt=>{const Tn=Dt.path.replace(Lt,"").replace(pr,"/").slice(1);return{id:Dt[Ni.KEYS.COMP_FIELD_COMP_ID],path:cr+Tn,fullPath:Dt.path,fullPathHash:$r.digest.getStringHash(Dt.path),basename:gr.basename(Dt.path)}}));return mr}async getCompFilesOssSignedUrl(Dt){const{version:Lt,objectId:Tn,files:Wn}=Dt;const Gn=await this.ossService.getDownloadSts();const rr=Wn.map((async Dt=>{const Wn=gr.join(Tn,Lt,Dt);const rr=await this.ossService.getFilePreviewUrl(Gn,Wn.replace(/[/\\]/g,"/"));return{path:Dt,signedUrl:rr}}));const cr=await Promise.all(rr);return{signedUrls:cr}}async getPackageJsonContent(){const Dt=this.configService.comphubConfig();const Lt=gr.join(Dt.cwd,"package.json");return await $r.fileSys.readJsonFile(Lt)}async getLocalComps(Dt){const{page:Lt=1,pageSize:Tn=10}=Dt;const{srcPath:Wn}=this.configService.comphubConfig();const Gn=await this.getAllLocalCompIds();const rr=Gn.map((Dt=>({id:Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID],pathHash:Dt.pathHash})));rr.sort(((Dt,Lt)=>Dt.id.localeCompare(Lt.id)));const cr=[...new Set(rr.map((Dt=>Dt.id)))];const pr=await ji.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:cr});const{ids:yr=[]}=pr.data;const Sr=rr.filter((Dt=>yr.includes(Dt.id)));const Er=Sr.length;const Or=Sr.slice((Lt-1)*Tn,Lt*Tn);const Ir=new Map(Gn.map((Dt=>[`${Dt.compjson[Ni.KEYS.COMP_FIELD_COMP_ID]}_${Dt.pathHash}`,Dt])));const Hr=await ji.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Or.map((Dt=>Dt.id))});const{rows:Gr=[]}=Hr.data;const mi=new Map(Gr.map((Dt=>[Dt._id,Dt])));const ki=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const Ui=Ni.KEYS.FILE_MANAGER_DIRNAME;const Vi=Or.map((async({id:Dt,pathHash:Lt})=>{const Tn=Ir.get(`${Dt}_${Lt}`);const Gn=mi.get(Dt);if(!Gn||!Tn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[Dt]}))}const rr=Tn.compPath.replace(Wn,"").replace(ki,"/").slice(1);return{_id:$r.digest.getStringHash(Tn.compPath),name:Gn.name,compId:Dt,version:Tn.compjson.version,path:Ui+rr,previewConfigs:Gn.previewConfigs,bgColor:Gn.bgColor,fullPath:Tn.compPath}}));const zi=await Promise.all(Vi);return{total:Er,page:Lt,pageSize:Tn,rows:zi}}async getLocalCompDetailByPathHash(Dt){const{fullPathHash:Lt}=Dt;const Tn=await this.getAllLocalCompIds();const Wn=Tn.find((Dt=>Dt.pathHash===Lt));if(!Wn){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[Lt]}))}const{srcPath:Gn}=this.configService.comphubConfig();const rr=Wn.compjson[Ni.KEYS.COMP_FIELD_COMP_ID];const{version:cr}=Wn.compjson;const pr=await ji.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[rr]});const{rows:yr=[]}=pr.data;const Sr=yr[0];const Er=new RegExp(Ri.textKit.escapeRegExp(gr.sep),"g");const Or=Ni.KEYS.FILE_MANAGER_DIRNAME;const Ir=Wn.compPath.replace(Gn,"").replace(Er,"/").slice(1);return{_id:Lt,name:Sr.name,compId:rr,version:cr,path:Or+Ir,previewConfigs:Sr.previewConfigs,bgColor:Sr.bgColor,fullPath:Wn.compPath}}async openCompPathInVscode(Dt){const{folderPath:Lt,relativeFilePath:Tn}=Dt;await this.commandService.revealInVSCode(Lt,Tn)}async openCompPathInExplorer(Dt){const{folderPath:Lt,relativeFilePath:Tn}=Dt;await this.commandService.revealInExplorer(Lt,Tn)}async writeCompFile(Dt){const{compPath:Lt,filename:Tn,content:Wn}=Dt;const Gn=this.getCompFullPath(Lt);const rr=gr.join(Gn,Tn);yr.writeFileSync(rr,Buffer.from(Wn,"base64"))}async renameCompDir(Dt){const{compPath:Lt,newName:Tn}=Dt;if(!Ri.textKit.validateCompName(Tn)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[Tn]}))}const Wn=this.getCompFullPath(Lt);const Gn=gr.basename(Wn);if(Gn===Tn)return;const rr=gr.dirname(Wn);const cr=gr.join(rr,Tn);if(yr.existsSync(cr)){throw new mr.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[Tn]}))}await yr.promises.rename(Wn,cr)}};Lt.CompService=Vi;rr([(0,mr.App)(),pr("design:type",Object)],Vi.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Sr.ConfigService)],Vi.prototype,"configService",void 0);rr([(0,mr.Inject)(),pr("design:type",Ir.OssService)],Vi.prototype,"ossService",void 0);rr([(0,mr.Inject)(),pr("design:type",ki.CommandService)],Vi.prototype,"commandService",void 0);rr([(0,mr.Inject)(),pr("design:type",Er.DepsService)],Vi.prototype,"depsService",void 0);rr([(0,mr.Inject)(),pr("design:type",Or.ModuleService)],Vi.prototype,"moduleService",void 0);rr([(0,mr.Inject)(),pr("design:type",Object)],Vi.prototype,"ctx",void 0);rr([(0,mr.Inject)(),pr("design:type",Ui.MidwayI18nService)],Vi.prototype,"i18nService",void 0);Lt.CompService=Vi=rr([(0,mr.Provide)()],Vi)},63366:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ConfigService=void 0;const mr=Tn(46123);const gr=Tn(26815);const yr=cr(Tn(16928));let Sr=class ConfigService{comphubConfig(){const Dt=this.app.getAttr(gr.KEYS.COMPHUB_CONFIG_KEY);return Dt}getGlobalConfig(){const Dt=this.comphubConfig();const{cwd:Lt,srcPath:Tn,version:Wn,allowDebug:Gn,subPort:rr,projectHash:cr}=Dt;return{cwd:Lt,srcPath:Tn,sep:yr.sep,version:Wn,allowDebug:Gn,subPort:rr,projectHash:cr}}};Lt.ConfigService=Sr;rr([(0,mr.App)(),pr("design:type",Object)],Sr.prototype,"app",void 0);Lt.ConfigService=Sr=rr([(0,mr.Provide)()],Sr)},23086:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DepsService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(64713);const Er=Tn(87518);const Or=Tn(18801);const Ir=Tn(26815);const Hr=Tn(63366);const Gr=Tn(58953);let $r=class DepsService{async getModuleEntry(Dt,Lt){const Tn=await Er.fileSys.readJsonFile(gr.join(Lt,"package.json"));if(!Tn){this.ctx.logger.error("未找到 package.json 文件");return[]}const Wn=Er.resolver.findDependencyVersion(Tn,"vue");const Gn=Er.resolver.findDependencyVersion(Tn,"react");const rr=await Er.depGraph.detectImports(Dt,{pathAliases:["@"]});if(Wn&&Gn){throw new mr.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(Wn){rr.vue={version:Wn}}if(Gn){rr.react={version:Gn};const Dt=Er.resolver.findDependencyVersion(Tn,"react-dom");if(Dt){const Lt=Number(Or.versionKit.getMajorVersion(Gn));if(Lt>=18){rr["react-dom/client"]={version:Dt}}else{rr["react-dom"]={version:Dt}}}}const cr={};for(const[Dt]of Object.entries(rr)){const Wn=Er.resolver.findDependencyVersion(Tn,Dt);const Gn={version:Wn};const rr=await Er.resolver.findOwningPackage(Dt,Lt);if(rr){Gn.version=rr.version;if(!Wn){Gn.parent={name:rr.name,version:rr.version}}}cr[Dt]=Gn}return Object.entries(cr).map((([Dt,Lt])=>({name:Dt,version:Lt.version,...Lt.parent&&{parent:Lt.parent}})))}async buildTemplateCompiler(Dt,Lt,Tn){const Wn=gr.join(Lt,"node_modules","vue-template-compiler","package.json");let Gn;try{const Lt=JSON.parse(await yr.promises.readFile(Wn,"utf-8"));Gn=Lt.version;this.ctx.logger.info(`[buildTemplateCompiler] 找到 vue-template-compiler@${Gn},Vue 版本: ${Dt}`)}catch{throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${Dt}`)}const[rr,cr]=Dt.split(".").map(Number);const[pr,mr]=(Gn||"").split(".").map(Number);if(rr!==pr||cr!==mr){this.ctx.logger.warn(`[buildTemplateCompiler] 版本不完全匹配: vue@${Dt} vs vue-template-compiler@${Gn},`+`建议安装匹配版本: npm install vue-template-compiler@${Dt}`)}const Er=`export * from 'vue-template-compiler';`;const Or=gr.join(Tn,"__compiler_entry__.js");await yr.promises.mkdir(Tn,{recursive:true});await yr.promises.writeFile(Or,Er);const Ir=`vue2-template-compiler-${Dt.replace(/\./g,"_")}.js`;const Hr=gr.join(Tn,Ir);try{await(0,Sr.build)({entryPoints:[Or],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:Hr,platform:"browser",target:"es2015",absWorkingDir:Lt,nodePaths:[gr.join(Lt,"node_modules")],external:[],sourcemap:false,minify:false});this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Ir}`)}catch(Dt){await yr.promises.unlink(Or).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${Dt.message}`)}await yr.promises.unlink(Or).catch((()=>{}));return{fileName:Ir}}async precompileModule(Dt,Lt,Tn){console.log("预编译依赖模块");const Wn=await Er.fileSys.readJsonFile(gr.join(Tn,"package.json"));if(!Wn){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{},chunkFiles:[]}}const{entryPoints:Gn}=(0,Gr.buildEntryPoints)(Lt,Wn,Tn);const{entryPoints:rr,mergedPackages:cr}=(0,Gr.mergeSubPathEntries)(Gn);for(const[,Lt]of Object.entries(cr)){const Tn=(0,Gr.generateMergedWrapper)(Lt.subExportMap);const Wn=gr.join(Dt,`${Lt.entryKey}.js`);rr[Lt.entryKey]=Wn;await yr.promises.mkdir(gr.dirname(Wn),{recursive:true});await yr.promises.writeFile(Wn,Tn)}await yr.promises.mkdir(Dt,{recursive:true});const pr={};for(const[Dt,Lt]of Object.entries(rr)){if(Dt.startsWith("__merged__")||Er.resolver.isModuleInstalled(Dt,Tn)){pr[Dt]=Lt}}const mr={};const Or=gr.join(Dt,Ir.KEYS.META_FILE_NAME);const Hr=await Er.fileSys.readJsonFile(Or);const{filteredEntryPoints:$r,cachedMappings:mi}=(0,Gr.filterCachedModules)(pr,Hr);for(const[,Lt]of Object.entries(cr)){const Tn=Lt.entryKey;if(Hr?.[Tn]){const Wn=Hr[Tn].file;for(const Tn of Lt.wrapperSubPaths){const Gn=Lt.subExportMap[Tn];const rr=(0,Gr.getSubWrapperFileName)(Gn,Wn);const cr=gr.join(Dt,rr);if(!yr.existsSync(cr)){await yr.promises.writeFile(cr,(0,Gr.generateSubWrapper)(Gn,Wn))}mi[Tn]=rr}mi[Tn]=Wn}}Object.assign(mr,mi);if(Object.keys($r).length===0){return{entryNameToFile:mr,chunkFiles:this.resolveChunkFiles(mr,Hr)}}const ki={entryPoints:$r,bundle:true,format:"esm",splitting:true,outdir:Dt,entryNames:"[name]-[hash]",chunkNames:"chunk-[hash]",outExtension:{".js":".js"},loader:{".woff":"file",".woff2":"file",".ttf":"file",".eot":"file",".otf":"file",".svg":"file",".png":"dataurl",".jpg":"dataurl",".jpeg":"dataurl",".gif":"dataurl"},metafile:true,write:true,target:"esnext",sourcemap:false,external:["vue","react"],absWorkingDir:Tn,nodePaths:[gr.join(Tn,"node_modules")]};const Ni=await(0,Sr.build)(ki);const{optimized:Ri,entryNameToFile:ji}=(0,Gr.analyzeBuildOutputs)(Ni,$r,Dt);for(const[,Lt]of Object.entries(cr)){const Tn=Lt.entryKey;if(!(Tn in $r))continue;const Wn=ji[Tn];if(!Wn)continue;for(const Tn of Lt.wrapperSubPaths){const Gn=Lt.subExportMap[Tn];const rr=(0,Gr.getSubWrapperFileName)(Gn,Wn);const cr=gr.join(Dt,rr);await yr.promises.writeFile(cr,(0,Gr.generateSubWrapper)(Gn,Wn));ji[Tn]=rr}}const Ui={...Hr,...Ri};await(0,Gr.saveBuildMetadata)(Or,Ui);const Vi={...mr,...ji};return{entryNameToFile:Vi,chunkFiles:this.resolveChunkFiles(Vi,Ui)}}resolveChunkFiles(Dt,Lt){const Tn=new Set(Object.values(Dt));const Wn=new Set;for(const[Gn]of Object.entries(Dt)){const Dt=Lt?.[Gn]?.chunkFiles;if(!Dt?.length)continue;for(const Lt of Dt){if(!Tn.has(Lt))Wn.add(Lt)}}return Array.from(Wn)}};Lt.DepsService=$r;rr([(0,mr.App)(),pr("design:type",Object)],$r.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);rr([(0,mr.Inject)(),pr("design:type",Hr.ConfigService)],$r.prototype,"configService",void 0);Lt.DepsService=$r=rr([(0,mr.Provide)()],$r)},85984:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ModuleService=void 0;const mr=Tn(46123);const gr=Tn(63366);const yr=Tn(23086);const Sr=cr(Tn(16928));const Er=Tn(87518);const Or=cr(Tn(79896));const Ir=Tn(26815);let Hr=class ModuleService{async getPreBuildModuleDir(){const{cwd:Dt}=this.configService.comphubConfig();const Lt=Sr.join(Dt,Ir.KEYS.PREBUILD_MODULE_DIR);await Or.promises.mkdir(Lt,{recursive:true});return Lt}async preBuild(Dt){const Lt=await this.getPreBuildModuleDir();const{cwd:Tn}=this.configService.comphubConfig();return await this.depsService.precompileModule(Lt,Dt,Tn)}async buildTemplateCompiler(Dt){const Lt=await this.getPreBuildModuleDir();const{cwd:Tn}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(Dt,Tn,Lt)}async preBuildSize(){const Dt=await this.getPreBuildModuleDir();return await Er.fileSys.dirSize(Dt)}async clearPreBuild(){const Dt=await this.getPreBuildModuleDir();await Or.promises.rm(Dt,{recursive:true,force:true})}};Lt.ModuleService=Hr;rr([(0,mr.Inject)(),pr("design:type",gr.ConfigService)],Hr.prototype,"configService",void 0);rr([(0,mr.Inject)(),pr("design:type",yr.DepsService)],Hr.prototype,"depsService",void 0);rr([(0,mr.App)(),pr("design:type",Object)],Hr.prototype,"app",void 0);Lt.ModuleService=Hr=rr([(0,mr.Provide)()],Hr)},80799:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.OssService=void 0;const gr=Tn(46123);const yr=mr(Tn(54504));const Sr=mr(Tn(12593));const Er=mr(Tn(18451));const Or=cr(Tn(16928));const Ir=cr(Tn(79896));const Hr=Tn(96955);const Gr=Tn(4990);const $r=mr(Tn(26506));const mi=mr(Tn(23046));const ki=Tn(45853);const Ni=Tn(26815);const Ri=Tn(68255);let ji=class OssService{createOssClient(Dt){const Lt={endpoint:Ni.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...Dt};return new Er.default(Lt)}getContentTypeWithCharset(Dt){const Lt=Or.extname(Dt).toLowerCase();const Tn={".css":"text/css; charset=utf-8",".js":"application/javascript; charset=utf-8",".mjs":"application/javascript; charset=utf-8",".cjs":"application/javascript; charset=utf-8",".ts":"text/typescript; charset=utf-8",".tsx":"text/typescript; charset=utf-8",".jsx":"text/javascript; charset=utf-8",".json":"application/json; charset=utf-8",".html":"text/html; charset=utf-8",".htm":"text/html; charset=utf-8",".vue":"text/plain; charset=utf-8",".md":"text/markdown; charset=utf-8",".svg":"image/svg+xml; charset=utf-8",".xml":"application/xml; charset=utf-8",".scss":"text/css; charset=utf-8",".sass":"text/css; charset=utf-8",".less":"text/css; charset=utf-8"};return Tn[Lt]}createOssFormData(Dt,Lt,Tn=false){const Wn=new yr.default;const Gn=Dt.dir+Dt.key;Wn.append("success_action_status","200");Wn.append("policy",Dt.policy);Wn.append("x-oss-signature",Dt.signature);Wn.append("x-oss-signature-version",Dt.x_oss_signature_version);Wn.append("x-oss-credential",Dt.x_oss_credential);Wn.append("x-oss-date",Dt.x_oss_date);Wn.append("key",Gn);Wn.append("x-oss-security-token",Dt.security_token);Wn.append("x-oss-forbid-overwrite",Tn?"false":"true");Wn.append("Cache-Control","public, max-age=31536000");const rr={};const cr=Lt.path?.toString();if(cr){const Dt=this.getContentTypeWithCharset(cr);if(Dt){rr.contentType=Dt}}Wn.append("file",Lt,rr);return{host:Dt.host,filePath:Gn,formData:Wn}}async getDownloadSts(){const Dt=await this.cache.get(Ni.KEYS.CACHE_KEY_STS_TOKEN);if(Dt){return Dt}const Lt=await Gr.remoteApi.v1Oss.osscontrollerGetsts();const Tn=new Date(Lt.data.Expiration).getTime()-1*60*1e3;await this.cache.set(Ni.KEYS.CACHE_KEY_STS_EXPIRE_TIME,Tn);const Wn=Tn-Date.now();this.ctx.logger.debug("STS过期时间",(0,mi.default)(Tn).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(Ni.KEYS.CACHE_KEY_STS_TOKEN,Lt.data,Wn);return Lt.data}async uploadFileToOss(Dt,Lt,Tn=false){const{host:Wn,formData:Gn}=this.createOssFormData(Dt,Lt,Tn);const rr=await Sr.default.post(Wn,Gn,{headers:{...Gn.getHeaders()}}).catch((async Dt=>{const Lt=Dt.response.data;const Tn=await(0,ki.parseStringPromise)(Lt);if(Tn?.Error){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Tn.Error.Message]}))}throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[Dt.message||Dt]}))}));if(rr.status!==200){throw new gr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.data]}))}}async downloadFileToPath(Dt,Lt,Tn){const Wn=this.createOssClient({region:Dt.region,accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken,bucket:Dt.bucket,refreshSTSToken:async()=>{const Dt=await this.getDownloadSts();return{accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken}}});const Gn=Lt.map((async Dt=>{const{path:Lt}=Dt;const Gn=Or.join(Tn,Lt);const rr=Or.dirname(Gn);if(!Ir.existsSync(rr)){Ir.mkdirSync(rr,{recursive:true})}return await Wn.get(Lt,Gn)}));return await Promise.all(Gn)}async getFilePreviewUrl(Dt,Lt){const Tn=(0,$r.default)(Lt);const Wn=await this.cache.get(Ni.KEYS.CACHE_KEY_STS_EXPIRE_TIME);const Gn=await this.cache.get(Tn);const rr=Math.floor((Number(Wn)-Date.now())/1e3);this.ctx.logger.debug("文件地址过期时间:",rr,"秒",Math.floor(rr/60),"分钟");if(Gn&&rr>0){return Gn}const cr=this.createOssClient({region:Dt.region,accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken,bucket:Dt.bucket,refreshSTSToken:async()=>{const Dt=await this.getDownloadSts();return{accessKeyId:Dt.AccessKeyId,accessKeySecret:Dt.AccessKeySecret,stsToken:Dt.SecurityToken}}});this.ctx.logger.debug("文件地址过期时间:",rr,"秒",Math.floor(rr/60),"分钟");const pr=cr.signatureUrl(Lt,{expires:rr});await this.cache.set(Tn,pr,rr*1e3);this.ctx.logger.debug("缓存预览URL",Lt);return pr}};Lt.OssService=ji;rr([(0,gr.Inject)(),pr("design:type",Object)],ji.prototype,"ctx",void 0);rr([(0,gr.InjectClient)(Hr.CachingFactory,"default"),pr("design:type",Object)],ji.prototype,"cache",void 0);rr([(0,gr.Inject)(),pr("design:type",Ri.MidwayI18nService)],ji.prototype,"i18nService",void 0);Lt.OssService=ji=rr([(0,gr.Provide)()],ji)},61275:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.QueueService=void 0;const Gn=Tn(46123);let rr=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const Dt=this.queue.shift();if(Dt){await Dt()}this.isProcessing=false;this.processQueue()}async enqueue(Dt){return new Promise((Lt=>{this.queue.push((async()=>{try{await Dt()}finally{Lt()}}));this.processQueue()}))}};Lt.QueueService=rr;Lt.QueueService=rr=Wn([(0,Gn.Provide)(),(0,Gn.Scope)(Gn.ScopeEnum.Singleton)],rr)},19452:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var mr=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TerminalService=void 0;const gr=Tn(46123);const yr=Tn(35317);const Sr=Tn(63366);const Er=cr(Tn(1999));const Or=Tn(73024);const Ir=Tn(51455);const Hr=Tn(87518);const Gr=mr(Tn(44644));let $r=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(Dt){if(!Dt||Dt.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(Dt);return Er.decode(Dt,"utf-8")}catch{return Er.decode(Dt,"gbk")}}async folderExists(Dt){try{await(0,Ir.access)(Dt,Or.constants.F_OK|Or.constants.R_OK);return true}catch{return false}}async shutdown(Dt=5e3){const Lt=this.subprocess;if(!Lt||Lt.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((Tn=>{let Wn=false;const done=()=>{if(!Wn){Wn=true;Tn(0)}};Lt.once("exit",done);(0,Gr.default)(Lt.pid,"SIGTERM",(Dt=>{if(Dt){this.ctx.emit("output",{err:Dt.message})}}));const Gn=setTimeout((()=>{(0,Gr.default)(Lt.pid,"SIGKILL",(Dt=>{if(Dt){this.ctx.emit("output",{err:Dt.message})}done()}))}),Dt);Lt.once("exit",(()=>clearTimeout(Gn)))}))}async execCmd({cwd:Dt,oldCwd:Lt,command:Tn}){if(!await this.folderExists(Dt)){this.ctx.emit("output",{err:`${Dt} 路径不存在`});this.ctx.emit("output",{cwd:Lt});return}this.cwd=Dt;if(!Tn.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(Tn==="^C"){await this.shutdown();return}this.subprocess=(0,yr.spawn)(Tn,{shell:true,cwd:Dt,stdio:["pipe","pipe","pipe"],detached:false,env:{...process.env,FORCE_COLOR:"3",NPM_CONFIG_COLOR:"always",COLORTERM:"truecolor",TERM:"xterm-256color"}});this.subprocess.stdout?.on("data",(Dt=>{this.ctx.emit("output",{stdout:this.smartDecode(Dt)})}));this.subprocess.stderr?.on("data",(Dt=>{this.ctx.emit("output",{stderr:this.smartDecode(Dt)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:Tn})}));this.subprocess.on("error",(Dt=>{this.ctx.emit("output",{err:Dt.message})}))}async cmdTab({cwd:Dt,lastWord:Lt}){let Tn=await Hr.fileSys.readDirFiles(Dt);if(Lt){Tn=Tn.filter((Dt=>Dt.name.startsWith(Lt)))}if(Tn.length===0){return}this.tabIndex=(this.tabIndex+1)%Tn.length;const Wn=Tn[this.tabIndex];this.ctx.emit("output",{tab:Wn.name})}};Lt.TerminalService=$r;rr([(0,gr.Inject)(),pr("design:type",Sr.ConfigService)],$r.prototype,"configService",void 0);rr([(0,gr.Inject)(),pr("design:type",Object)],$r.prototype,"ctx",void 0);Lt.TerminalService=$r=rr([(0,gr.Provide)()],$r)},5808:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var cr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();var pr=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.VuefinderService=void 0;const mr=Tn(46123);const gr=cr(Tn(16928));const yr=cr(Tn(79896));const Sr=Tn(63366);const Er=cr(Tn(93900));const Or=Tn(26815);let Ir=class VuefinderService{async list({path:Dt}){const Lt=this.configService.comphubConfig();const{srcPath:Tn}=Lt;const Wn=Dt?.replace(Or.KEYS.FILE_MANAGER_DIRNAME,"")||"";let Gn=gr.join(Tn,Wn);const rr=await yr.promises.access(Gn).then((()=>true)).catch((()=>false));if(!rr){Gn=Tn;Dt=Or.KEYS.FILE_MANAGER_DIRNAME}const cr=await yr.promises.readdir(Gn);const pr=cr.map((async Lt=>{const Tn=gr.join(Gn,Lt);const Wn=await yr.promises.stat(Tn);const rr=Wn.isDirectory();const cr=Dt===Or.KEYS.FILE_MANAGER_DIRNAME?`${Dt}${Lt}`:`${Dt}/${Lt}`;return{type:rr?"dir":"file",path:cr,file_size:Wn.size,visibility:"public",last_modified:Math.floor(Wn.mtimeMs/1e3),basename:Lt,extension:rr?"":gr.extname(Lt).slice(1),mime_type:Er.lookup(Lt)||""}}));const mr=await Promise.all(pr);mr.sort(((Dt,Lt)=>{if(Dt.type==="dir"&&Lt.type==="file"){return-1}else if(Dt.type==="file"&&Lt.type==="dir"){return 1}else{return 0}}));return{storages:cr,dirname:Dt,files:mr}}};Lt.VuefinderService=Ir;rr([(0,mr.App)(),pr("design:type",Object)],Ir.prototype,"app",void 0);rr([(0,mr.Inject)(),pr("design:type",Sr.ConfigService)],Ir.prototype,"configService",void 0);Lt.VuefinderService=Ir=rr([(0,mr.Provide)()],Ir)},66593:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.TerminalSocketController=void 0;const rr=Tn(46123);const cr=Tn(19452);let pr=class TerminalSocketController{async onConnection(){this.ctx.logger.debug(`新客户端连接:${this.ctx.id}`)}async onDisConnection(){this.ctx.logger.debug(`客户端断开连接:${this.ctx.id}`);await this.terminalService.shutdown()}async onCommand(Dt){this.terminalService.execCmd(Dt)}async onTab(Dt){this.terminalService.cmdTab(Dt)}};Lt.TerminalSocketController=pr;Wn([(0,rr.Inject)(),Gn("design:type",Object)],pr.prototype,"ctx",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.TerminalService)],pr.prototype,"terminalService",void 0);Wn([(0,rr.OnWSConnection)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"onConnection",null);Wn([(0,rr.OnWSDisConnection)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"onDisConnection",null);Wn([(0,rr.OnWSMessage)("command"),Gn("design:type",Function),Gn("design:paramtypes",[Object]),Gn("design:returntype",Promise)],pr.prototype,"onCommand",null);Wn([(0,rr.OnWSMessage)("tab"),Gn("design:type",Function),Gn("design:paramtypes",[Object]),Gn("design:returntype",Promise)],pr.prototype,"onTab",null);Lt.TerminalSocketController=pr=Wn([(0,rr.WSController)("/terminal")],pr)},58953:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__setModuleDefault||(Object.create?function(Dt,Lt){Object.defineProperty(Dt,"default",{enumerable:true,value:Lt})}:function(Dt,Lt){Dt["default"]=Lt});var rr=this&&this.__importStar||function(){var ownKeys=function(Dt){ownKeys=Object.getOwnPropertyNames||function(Dt){var Lt=[];for(var Tn in Dt)if(Object.prototype.hasOwnProperty.call(Dt,Tn))Lt[Lt.length]=Tn;return Lt};return ownKeys(Dt)};return function(Dt){if(Dt&&Dt.__esModule)return Dt;var Lt={};if(Dt!=null)for(var Tn=ownKeys(Dt),rr=0;rr<Tn.length;rr++)if(Tn[rr]!=="default")Wn(Lt,Dt,Tn[rr]);Gn(Lt,Dt);return Lt}}();Object.defineProperty(Lt,"__esModule",{value:true});Lt.analyzeBuildOutputs=analyzeBuildOutputs;Lt.saveBuildMetadata=saveBuildMetadata;Lt.filterCachedModules=filterCachedModules;Lt.buildEntryPoints=buildEntryPoints;Lt.mergeSubPathEntries=mergeSubPathEntries;Lt.generateMergedWrapper=generateMergedWrapper;Lt.generateSubWrapper=generateSubWrapper;Lt.getSubWrapperFileName=getSubWrapperFileName;const cr=rr(Tn(16928));const pr=rr(Tn(79896));const mr=Tn(87518);const gr=Tn(18801);const yr=Tn(26815);function resolveModuleEntry(Dt,Lt){if(Dt!=="vue")return Dt;const Tn=gr.versionKit.getMajorVersion(Lt);return Tn==="3"?yr.KEYS.VUE_ESM_BUNDLER:Dt}function extractModuleName(Dt){const Lt=cr.extname(Dt);const Tn=cr.basename(Dt,Lt);return Tn.replace(/-[A-Za-z0-9_-]{8}$/,"")}function matchEntryKey(Dt,Lt){return Dt.find((Dt=>{const Tn=Dt.split("/");const Wn=Tn[Tn.length-1];return Lt===Wn}))}function analyzeBuildOutputs(Dt,Lt,Tn){const Wn={};const Gn={};const rr=Object.keys(Lt);const gr=Dt.metafile?.outputs??{};const yr=new Set(Object.keys(gr).map((Dt=>cr.basename(Dt))));for(const[Dt,Lt]of Object.entries(gr)){const gr=cr.basename(Dt);if(!Lt.entryPoint)continue;const Sr=extractModuleName(Dt);const Er=matchEntryKey(rr,Sr);if(!Er)continue;Gn[Er]=gr;const Or=cr.join(Tn,gr);const Ir=pr.readFileSync(Or,"utf-8");const Hr=mr.digest.getStringHash(Ir).slice(0,8);Wn[Er]={src:Lt.entryPoint,file:gr,fileHash:Hr,needsInterop:false,chunkFiles:(Lt.imports??[]).map((Dt=>cr.basename(Dt.path))).filter((Dt=>Dt&&yr.has(Dt)&&Dt!==gr))}}return{optimized:Wn,entryNameToFile:Gn}}async function saveBuildMetadata(Dt,Lt){await pr.promises.writeFile(Dt,JSON.stringify(Lt,null,2))}function filterCachedModules(Dt,Lt){if(!Lt){return{filteredEntryPoints:Dt,cachedMappings:{}}}const Tn={};const Wn={};for(const[Gn,rr]of Object.entries(Dt)){if(Lt[Gn]){Wn[Gn]=Lt[Gn].file}else{Tn[Gn]=rr}}return{filteredEntryPoints:Tn,cachedMappings:Wn}}function buildEntryPoints(Dt,Lt,Tn){const Wn={};for(const Gn of Dt){const Dt=mr.resolver.findDependencyVersion(Lt,Gn);if(!Dt){const Dt=mr.resolver.findOwningPackage(Gn,Tn);if(!Dt)continue}Wn[Gn]=resolveModuleEntry(Gn,Dt)}return{entryPoints:Wn}}function extractPackageName(Dt){if(Dt.startsWith("@")){const Lt=Dt.split("/");return Lt.slice(0,2).join("/")}return Dt.split("/")[0]}function toSafeIdentifier(Dt){return Dt.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(Dt){const Lt={};const Tn={};for(const[Wn,Gn]of Object.entries(Dt)){const Dt=extractPackageName(Wn);if(Wn!==Dt){const rr=!/\.(js|ts|jsx|tsx|mjs|cjs)$/.test(Wn);if(rr){Tn[Wn]=Gn;continue}if(!Lt[Dt])Lt[Dt]={};Lt[Dt][Wn]=Gn}else{Tn[Wn]=Gn}}const Wn={};for(const[Dt,Gn]of Object.entries(Lt)){const Lt=Object.keys(Gn);if(Lt.length<=1){Object.assign(Tn,Gn);continue}const rr=mr.digest.getStringHash(Lt.slice().sort().join("|")).slice(0,8);const cr=`__merged__${Dt}-${rr}`;const pr={};const gr=[];for(const Dt of Object.keys(Gn)){const Lt=toSafeIdentifier(Dt);pr[Dt]=Lt;gr.push(Dt)}Tn[cr]=cr;Wn[Dt]={entryKey:cr,subExportMap:pr,wrapperSubPaths:gr}}return{entryPoints:Tn,mergedPackages:Wn}}function generateMergedWrapper(Dt){const Lt=[];const Tn=[];const Wn=[];const Gn=new Set;for(const[rr,cr]of Object.entries(Dt)){if(Gn.has(cr))continue;Gn.add(cr);const Dt=`__imp_${cr}`;Lt.push(`import * as ${Dt} from '${rr}';`);Tn.push(`export const ${cr} = ${Dt}.default || Object.assign({}, ${Dt});`);Wn.push(`export * from '${rr}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...Lt,...Tn,...Wn,""].join("\n")}function generateSubWrapper(Dt,Lt){return[`// Auto-generated: sub-wrapper for ${Dt}`,`export { ${Dt} as default } from './${Lt}';`,`export * from './${Lt}';`,""].join("\n")}function getSubWrapperFileName(Dt,Lt){const Tn=cr.basename(Lt,cr.extname(Lt));return`${Dt}-w-${Tn}.js`}},49969:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getErrorMessage=getErrorMessage;function getErrorMessage(Dt){if(Dt instanceof Error)return Dt.message;if(typeof Dt==="string")return Dt;return String(Dt)}},4145:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.waitForIpcConfig=waitForIpcConfig;const Gn=Wn(Tn(16928));const rr=Tn(26815);function parseCwdArg(Dt){for(let Lt=0;Lt<Dt.length;Lt++){if(Dt[Lt]==="--cwd"&&Lt+1<Dt.length){return Dt[Lt+1]}if(Dt[Lt].startsWith("--cwd=")){return Dt[Lt].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const Dt=parseCwdArg(process.argv);if(Dt){return Promise.resolve({type:"config",port:0,cwd:Gn.default.resolve(Dt),allowDebug:process.env.MIDWAY_SERVER_ENV===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((Dt,Lt)=>{const Tn=setTimeout((()=>{Lt(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(Lt=>{if(Lt?.type==="config"){clearTimeout(Tn);Dt(Lt)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===rr.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.remoteInstance=Lt.setHeader=void 0;const Gn=Tn(42552);const rr=Tn(26815);const cr=Wn(Tn(65692));const pr=(0,Gn.initInstance)(rr.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new cr.default.Agent({rejectUnauthorized:false})},(Dt=>Dt.replace(rr.KEYS.REMOTE_SERVICE_PREFIX,"")));Lt.remoteInstance=pr;let mr=null;const setHeader=Dt=>{mr=Dt};Lt.setHeader=setHeader;pr.interceptors.request.use((Dt=>{Dt.headers[rr.KEYS.AUTHORIZATION_HEADER_NAME]=mr[rr.KEYS.AUTHORIZATION_HEADER_NAME];Dt.headers[rr.KEYS.CSRF_TOKEN_HEADER_NAME]=mr[rr.KEYS.CSRF_TOKEN_HEADER_NAME];Dt.headers[rr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=mr[rr.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];Dt.headers["cookie"]=mr.cookie;return Dt}),(Dt=>Promise.reject(Dt)));pr.interceptors.response.use((async Dt=>{if(Dt.data.code!==0){throw new Error(JSON.stringify(Dt.data))}return Dt.data}),(Dt=>Promise.reject(Dt)))},67872:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__importDefault||function(Dt){return Dt&&Dt.__esModule?Dt:{default:Dt}};Object.defineProperty(Lt,"__esModule",{value:true});Lt.createKoaProxy=createKoaProxy;const Gn=Wn(Tn(58611));const rr=Tn(31855);const cr=new Gn.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const pr=new Map;function getOrCreateSubProxy(Dt,Lt){const Tn=`${Dt}|${JSON.stringify(Lt)}`;if(!pr.has(Tn)){pr.set(Tn,(0,rr.createProxyMiddleware)({target:Dt,changeOrigin:true,secure:false,agent:cr,pathRewrite:Lt,on:{error:Dt=>{}}}))}return pr.get(Tn)}async function createKoaProxy(Dt,Lt,Tn){const Wn=getOrCreateSubProxy(Lt,Tn);return new Promise(((Lt,Tn)=>{Dt.res.on("finish",Lt);Dt.res.on("close",Lt);Dt.res.on("error",Tn);Wn(Dt.req,Dt.res,(Dt=>{if(Dt)Tn(Dt);else Lt()}))}))}},101:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.PackageJsonVO=Lt.LocalCompDetailVO=Lt.LocalCompsVO=Lt.CompFileHashVO=Lt.CompSimilarListVO=Lt.CompFilesOssSignedUrlVO=Lt.DownloadCompVO=Lt.LocalCompsByIdsVO=Lt.ImportScanResultVO=Lt.CompCheckVO=Lt.CompFileContentVO=Lt.CompFileVO=Lt.CompSimilarListItemVO=Lt.FileNode=void 0;const rr=Tn(49179);const cr=Tn(26815);class FileNode{}Lt.FileNode=FileNode;Wn([(0,rr.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),Gn("design:type",String)],FileNode.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],FileNode.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:cr.ENUM.FileType}),Gn("design:type",String)],FileNode.prototype,"type",void 0);Wn([(0,rr.ApiProperty)({description:"子节点",type:[FileNode]}),Gn("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}Lt.CompSimilarListItemVO=CompSimilarListItemVO;Wn([(0,rr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),Gn("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),Gn("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}Lt.CompFileVO=CompFileVO;Wn([(0,rr.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),Gn("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);Wn([(0,rr.ApiProperty)({type:[String],description:"组件文件列表",required:true}),Gn("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}Lt.CompFileContentVO=CompFileContentVO;Wn([(0,rr.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),Gn("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}Lt.CompCheckVO=CompCheckVO;Wn([(0,rr.ApiProperty)({description:"组件入口文件路径",required:false}),Gn("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);Wn([(0,rr.ApiProperty)({description:"组件配置文件路径",required:false}),Gn("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);Wn([(0,rr.ApiProperty)({description:"异常结果内容",required:true}),Gn("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}Wn([(0,rr.ApiProperty)({description:"父库名称",required:true,example:"vue"}),Gn("design:type",String)],ParentVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),Gn("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}Wn([(0,rr.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),Gn("design:type",String)],ImportDetailVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),Gn("design:type",String)],ImportDetailVO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),Gn("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}Lt.ImportScanResultVO=ImportScanResultVO;Wn([(0,rr.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),Gn("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}Wn([(0,rr.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"id",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"basename",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),Gn("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}Lt.LocalCompsByIdsVO=LocalCompsByIdsVO;Wn([(0,rr.ApiProperty)({type:[CompInfoVO],required:true}),Gn("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}Lt.DownloadCompVO=DownloadCompVO;Wn([(0,rr.ApiProperty)({description:"组件是否重复",example:true,required:true}),Gn("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class SignedUrlItem{}Wn([(0,rr.ApiProperty)({description:"文件路径",example:"/src/components/MyComp/index.vue",required:true}),Gn("design:type",String)],SignedUrlItem.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({description:"文件oss签名访问地址",example:"https://comp-hub.oss-cn-beijing.aliyuncs.com/src/components/MyComp/index.vue?x-oss-security-token=...",required:true}),Gn("design:type",String)],SignedUrlItem.prototype,"signedUrl",void 0);class CompFilesOssSignedUrlVO{}Lt.CompFilesOssSignedUrlVO=CompFilesOssSignedUrlVO;Wn([(0,rr.ApiProperty)({description:"文件oss签名访问地址列表",type:[SignedUrlItem],required:true}),Gn("design:type",Array)],CompFilesOssSignedUrlVO.prototype,"signedUrls",void 0);class CompSimilarListVO{}Lt.CompSimilarListVO=CompSimilarListVO;Wn([(0,rr.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),Gn("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}Lt.CompFileHashVO=CompFileHashVO;Wn([(0,rr.ApiProperty)({example:"123",description:"组件哈希值",required:true}),Gn("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}Wn([(0,rr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),Gn("design:type",String)],PreviewItem.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),Gn("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);Wn([(0,rr.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),Gn("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),Gn("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}Lt.LocalCompsVO=LocalCompsVO;Wn([(0,rr.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"_id",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"name",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"compId",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"version",void 0);Wn([(0,rr.ApiProperty)({type:[PreviewItem],required:true}),Gn("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"path",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),Gn("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);Wn([(0,rr.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),Gn("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}Lt.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}Lt.PackageJsonVO=PackageJsonVO;Wn([(0,rr.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),Gn("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BuildTemplateCompilerVO=Lt.PreBuildSizeVO=Lt.PreBuildVO=void 0;const rr=Tn(49179);class PreBuildVO{}Lt.PreBuildVO=PreBuildVO;Wn([(0,rr.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),Gn("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);Wn([(0,rr.ApiProperty)({description:"esbuild code-splitting 生成的公共 chunk 文件列表,上传 OSS 时需要一并上传",required:false,example:["chunk-26KRECMG.js","chunk-3AE7QCN7.js"]}),Gn("design:type",Array)],PreBuildVO.prototype,"chunkFiles",void 0);class PreBuildSizeVO{}Lt.PreBuildSizeVO=PreBuildSizeVO;Wn([(0,rr.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),Gn("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}Lt.BuildTemplateCompilerVO=BuildTemplateCompilerVO;Wn([(0,rr.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名,通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_6_14.js"}),Gn("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},75049:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SignedUrlVO=void 0;const rr=Tn(49179);class SignedUrlVO{}Lt.SignedUrlVO=SignedUrlVO;Wn([(0,rr.ApiProperty)({example:"xxxx",description:"带签名的访问地址",required:true}),Gn("design:type",String)],SignedUrlVO.prototype,"signUrl",void 0)},15798:(Dt,Lt)=>{"use strict";const Tn={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};Lt.parse=function(Dt,...Wn){const Gn=typeof Wn[0]==="object"&&Wn[0];const rr=Wn.length>1||!Gn?Wn[0]:undefined;const cr=Wn.length>1&&Wn[1]||Gn||{};const pr=JSON.parse(Dt,rr);if(cr.protoAction==="ignore"){return pr}if(!pr||typeof pr!=="object"){return pr}if(!Dt.match(Tn.suspectRx)){return pr}Lt.scan(pr,cr);return pr};Lt.scan=function(Dt,Lt={}){let Tn=[Dt];while(Tn.length){const Dt=Tn;Tn=[];for(const Wn of Dt){if(Object.prototype.hasOwnProperty.call(Wn,"__proto__")){if(Lt.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete Wn.__proto__}for(const Dt in Wn){const Lt=Wn[Dt];if(Lt&&typeof Lt==="object"){Tn.push(Wn[Dt])}}}}};Lt.safeParse=function(Dt,Tn){try{return Lt.parse(Dt,Tn)}catch(Dt){return null}}},35522:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(43700);const rr=Tn(66621);const cr=Tn(69322);const pr={};Dt.exports=function(Dt,Lt,Tn={}){Wn(Dt&&typeof Dt==="object","Invalid defaults value: must be an object");Wn(!Lt||Lt===true||typeof Lt==="object","Invalid source value: must be true, falsy or an object");Wn(typeof Tn==="object","Invalid options: must be an object");if(!Lt){return null}if(Tn.shallow){return pr.applyToDefaultsWithShallow(Dt,Lt,Tn)}const cr=Gn(Dt);if(Lt===true){return cr}const mr=Tn.nullOverride!==undefined?Tn.nullOverride:false;return rr(cr,Lt,{nullOverride:mr,mergeArrays:false})};pr.applyToDefaultsWithShallow=function(Dt,Lt,Tn){const mr=Tn.shallow;Wn(Array.isArray(mr),"Invalid keys");const gr=new Map;const yr=Lt===true?null:new Set;for(let Tn of mr){Tn=Array.isArray(Tn)?Tn:Tn.split(".");const Wn=cr(Dt,Tn);if(Wn&&typeof Wn==="object"){gr.set(Wn,yr&&cr(Lt,Tn)||Wn)}else if(yr){yr.add(Tn)}}const Sr=Gn(Dt,{},gr);if(!yr){return Sr}for(const Dt of yr){pr.reachCopy(Sr,Lt,Dt)}const Er=Tn.nullOverride!==undefined?Tn.nullOverride:false;return rr(Sr,Lt,{nullOverride:Er,mergeArrays:false})};pr.reachCopy=function(Dt,Lt,Tn){for(const Dt of Tn){if(!(Dt in Lt)){return}const Tn=Lt[Dt];if(typeof Tn!=="object"||Tn===null){return}Lt=Tn}const Wn=Lt;let Gn=Dt;for(let Dt=0;Dt<Tn.length-1;++Dt){const Lt=Tn[Dt];if(typeof Gn[Lt]!=="object"){Gn[Lt]={}}Gn=Gn[Lt]}Gn[Tn[Tn.length-1]]=Wn}},99583:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(16443);const Gn={};Dt.exports=function(Dt,...Lt){if(Dt){return}if(Lt.length===1&&Lt[0]instanceof Error){throw Lt[0]}throw new Wn(Lt)}},43700:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(69322);const Gn=Tn(99704);const rr=Tn(87492);const cr={needsProtoHack:new Set([Gn.set,Gn.map,Gn.weakSet,Gn.weakMap])};Dt.exports=cr.clone=function(Dt,Lt={},Tn=null){if(typeof Dt!=="object"||Dt===null){return Dt}let Wn=cr.clone;let pr=Tn;if(Lt.shallow){if(Lt.shallow!==true){return cr.cloneWithShallow(Dt,Lt)}Wn=Dt=>Dt}else if(pr){const Lt=pr.get(Dt);if(Lt){return Lt}}else{pr=new Map}const mr=Gn.getInternalProto(Dt);if(mr===Gn.buffer){return Buffer&&Buffer.from(Dt)}if(mr===Gn.date){return new Date(Dt.getTime())}if(mr===Gn.regex){return new RegExp(Dt)}const gr=cr.base(Dt,mr,Lt);if(gr===Dt){return Dt}if(pr){pr.set(Dt,gr)}if(mr===Gn.set){for(const Tn of Dt){gr.add(Wn(Tn,Lt,pr))}}else if(mr===Gn.map){for(const[Tn,Gn]of Dt){gr.set(Tn,Wn(Gn,Lt,pr))}}const yr=rr.keys(Dt,Lt);for(const Tn of yr){if(Tn==="__proto__"){continue}if(mr===Gn.array&&Tn==="length"){gr.length=Dt.length;continue}const rr=Object.getOwnPropertyDescriptor(Dt,Tn);if(rr){if(rr.get||rr.set){Object.defineProperty(gr,Tn,rr)}else if(rr.enumerable){gr[Tn]=Wn(Dt[Tn],Lt,pr)}else{Object.defineProperty(gr,Tn,{enumerable:false,writable:true,configurable:true,value:Wn(Dt[Tn],Lt,pr)})}}else{Object.defineProperty(gr,Tn,{enumerable:true,writable:true,configurable:true,value:Wn(Dt[Tn],Lt,pr)})}}return gr};cr.cloneWithShallow=function(Dt,Lt){const Tn=Lt.shallow;Lt=Object.assign({},Lt);Lt.shallow=false;const Gn=new Map;for(const Lt of Tn){const Tn=Wn(Dt,Lt);if(typeof Tn==="object"||typeof Tn==="function"){Gn.set(Tn,Tn)}}return cr.clone(Dt,Lt,Gn)};cr.base=function(Dt,Lt,Tn){if(Tn.prototype===false){if(cr.needsProtoHack.has(Lt)){return new Lt.constructor}return Lt===Gn.array?[]:{}}const Wn=Object.getPrototypeOf(Dt);if(Wn&&Wn.isImmutable){return Dt}if(Lt===Gn.array){const Dt=[];if(Wn!==Lt){Object.setPrototypeOf(Dt,Wn)}return Dt}if(cr.needsProtoHack.has(Lt)){const Dt=new Wn.constructor;if(Wn!==Lt){Object.setPrototypeOf(Dt,Wn)}return Dt}return Object.create(Wn)}},35879:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99704);const Gn={mismatched:null};Dt.exports=function(Dt,Lt,Tn){Tn=Object.assign({prototype:true},Tn);return!!Gn.isDeepEqual(Dt,Lt,Tn,[])};Gn.isDeepEqual=function(Dt,Lt,Tn,rr){if(Dt===Lt){return Dt!==0||1/Dt===1/Lt}const cr=typeof Dt;if(cr!==typeof Lt){return false}if(Dt===null||Lt===null){return false}if(cr==="function"){if(!Tn.deepFunction||Dt.toString()!==Lt.toString()){return false}}else if(cr!=="object"){return Dt!==Dt&&Lt!==Lt}const pr=Gn.getSharedType(Dt,Lt,!!Tn.prototype);switch(pr){case Wn.buffer:return Buffer&&Buffer.prototype.equals.call(Dt,Lt);case Wn.promise:return Dt===Lt;case Wn.regex:return Dt.toString()===Lt.toString();case Gn.mismatched:return false}for(let Tn=rr.length-1;Tn>=0;--Tn){if(rr[Tn].isSame(Dt,Lt)){return true}}rr.push(new Gn.SeenEntry(Dt,Lt));try{return!!Gn.isDeepEqualObj(pr,Dt,Lt,Tn,rr)}finally{rr.pop()}};Gn.getSharedType=function(Dt,Lt,Tn){if(Tn){if(Object.getPrototypeOf(Dt)!==Object.getPrototypeOf(Lt)){return Gn.mismatched}return Wn.getInternalProto(Dt)}const rr=Wn.getInternalProto(Dt);if(rr!==Wn.getInternalProto(Lt)){return Gn.mismatched}return rr};Gn.valueOf=function(Dt){const Lt=Dt.valueOf;if(Lt===undefined){return Dt}try{return Lt.call(Dt)}catch(Dt){return Dt}};Gn.hasOwnEnumerableProperty=function(Dt,Lt){return Object.prototype.propertyIsEnumerable.call(Dt,Lt)};Gn.isSetSimpleEqual=function(Dt,Lt){for(const Tn of Set.prototype.values.call(Dt)){if(!Set.prototype.has.call(Lt,Tn)){return false}}return true};Gn.isDeepEqualObj=function(Dt,Lt,Tn,rr,cr){const{isDeepEqual:pr,valueOf:mr,hasOwnEnumerableProperty:gr}=Gn;const{keys:yr,getOwnPropertySymbols:Sr}=Object;if(Dt===Wn.array){if(rr.part){for(const Dt of Lt){for(const Lt of Tn){if(pr(Dt,Lt,rr,cr)){return true}}}}else{if(Lt.length!==Tn.length){return false}for(let Dt=0;Dt<Lt.length;++Dt){if(!pr(Lt[Dt],Tn[Dt],rr,cr)){return false}}return true}}else if(Dt===Wn.set){if(Lt.size!==Tn.size){return false}if(!Gn.isSetSimpleEqual(Lt,Tn)){const Dt=new Set(Set.prototype.values.call(Tn));for(const Tn of Set.prototype.values.call(Lt)){if(Dt.delete(Tn)){continue}let Lt=false;for(const Wn of Dt){if(pr(Tn,Wn,rr,cr)){Dt.delete(Wn);Lt=true;break}}if(!Lt){return false}}}}else if(Dt===Wn.map){if(Lt.size!==Tn.size){return false}for(const[Dt,Wn]of Map.prototype.entries.call(Lt)){if(Wn===undefined&&!Map.prototype.has.call(Tn,Dt)){return false}if(!pr(Wn,Map.prototype.get.call(Tn,Dt),rr,cr)){return false}}}else if(Dt===Wn.error){if(Lt.name!==Tn.name||Lt.message!==Tn.message){return false}}const Er=mr(Lt);const Or=mr(Tn);if((Lt!==Er||Tn!==Or)&&!pr(Er,Or,rr,cr)){return false}const Ir=yr(Lt);if(!rr.part&&Ir.length!==yr(Tn).length&&!rr.skip){return false}let Hr=0;for(const Dt of Ir){if(rr.skip&&rr.skip.includes(Dt)){if(Tn[Dt]===undefined){++Hr}continue}if(!gr(Tn,Dt)){return false}if(!pr(Lt[Dt],Tn[Dt],rr,cr)){return false}}if(!rr.part&&Ir.length-Hr!==yr(Tn).length){return false}if(rr.symbols!==false){const Dt=Sr(Lt);const Wn=new Set(Sr(Tn));for(const Gn of Dt){if(!rr.skip||!rr.skip.includes(Gn)){if(gr(Lt,Gn)){if(!gr(Tn,Gn)){return false}if(!pr(Lt[Gn],Tn[Gn],rr,cr)){return false}}else if(gr(Tn,Gn)){return false}}Wn.delete(Gn)}for(const Dt of Wn){if(gr(Tn,Dt)){return false}}}return true};Gn.SeenEntry=class{constructor(Dt,Lt){this.obj=Dt;this.ref=Lt}isSame(Dt,Lt){return this.obj===Dt&&this.ref===Lt}}},16443:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(72912);const Gn={};Dt.exports=class extends Error{constructor(Dt){const Tn=Dt.filter((Dt=>Dt!=="")).map((Dt=>typeof Dt==="string"?Dt:Dt instanceof Error?Dt.message:Wn(Dt)));super(Tn.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,Lt.assert)}}}},57391:Dt=>{"use strict";const Lt={};Dt.exports=function(Dt){if(!Dt){return""}let Tn="";for(let Wn=0;Wn<Dt.length;++Wn){const Gn=Dt.charCodeAt(Wn);if(Lt.isSafe(Gn)){Tn+=Dt[Wn]}else{Tn+=Lt.escapeHtmlChar(Gn)}}return Tn};Lt.escapeHtmlChar=function(Dt){const Tn=Lt.namedHtml.get(Dt);if(Tn){return Tn}if(Dt>=256){return"&#"+Dt+";"}const Wn=Dt.toString(16).padStart(2,"0");return`&#x${Wn};`};Lt.isSafe=function(Dt){return Lt.safeCharCodes.has(Dt)};Lt.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]);Lt.safeCharCodes=function(){const Dt=new Set;for(let Lt=32;Lt<123;++Lt){if(Lt>=97||Lt>=65&&Lt<=90||Lt>=48&&Lt<=57||Lt===32||Lt===46||Lt===44||Lt===45||Lt===58||Lt===95){Dt.add(Lt)}}return Dt}()},43935:Dt=>{"use strict";const Lt={};Dt.exports=function(Dt){return Dt.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:Dt=>{"use strict";const Lt={};Dt.exports=function(){}},66621:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(43700);const rr=Tn(87492);const cr={};Dt.exports=cr.merge=function(Dt,Lt,Tn){Wn(Dt&&typeof Dt==="object","Invalid target value: must be an object");Wn(Lt===null||Lt===undefined||typeof Lt==="object","Invalid source value: must be null, undefined, or an object");if(!Lt){return Dt}Tn=Object.assign({nullOverride:true,mergeArrays:true},Tn);if(Array.isArray(Lt)){Wn(Array.isArray(Dt),"Cannot merge array onto an object");if(!Tn.mergeArrays){Dt.length=0}for(let Wn=0;Wn<Lt.length;++Wn){Dt.push(Gn(Lt[Wn],{symbols:Tn.symbols}))}return Dt}const pr=rr.keys(Lt,Tn);for(let Wn=0;Wn<pr.length;++Wn){const rr=pr[Wn];if(rr==="__proto__"||!Object.prototype.propertyIsEnumerable.call(Lt,rr)){continue}const mr=Lt[rr];if(mr&&typeof mr==="object"){if(Dt[rr]===mr){continue}if(!Dt[rr]||typeof Dt[rr]!=="object"||Array.isArray(Dt[rr])!==Array.isArray(mr)||mr instanceof Date||Buffer&&Buffer.isBuffer(mr)||mr instanceof RegExp){Dt[rr]=Gn(mr,{symbols:Tn.symbols})}else{cr.merge(Dt[rr],mr,Tn)}}else{if(mr!==null&&mr!==undefined){Dt[rr]=mr}else if(Tn.nullOverride){Dt[rr]=mr}}}return Dt}},69322:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn={};Dt.exports=function(Dt,Lt,Tn){if(Lt===false||Lt===null||Lt===undefined){return Dt}Tn=Tn||{};if(typeof Tn==="string"){Tn={separator:Tn}}const rr=Array.isArray(Lt);Wn(!rr||!Tn.separator,"Separator option is not valid for array-based chain");const cr=rr?Lt:Lt.split(Tn.separator||".");let pr=Dt;for(let Dt=0;Dt<cr.length;++Dt){let rr=cr[Dt];const mr=Tn.iterables&&Gn.iterables(pr);if(Array.isArray(pr)||mr==="set"){const Dt=Number(rr);if(Number.isInteger(Dt)){rr=Dt<0?pr.length+Dt:Dt}}if(!pr||typeof pr==="function"&&Tn.functions===false||!mr&&pr[rr]===undefined){Wn(!Tn.strict||Dt+1===cr.length,"Missing segment",rr,"in reach path ",Lt);Wn(typeof pr==="object"||Tn.functions===true||typeof pr!=="function","Invalid segment",rr,"in reach path ",Lt);pr=Tn.default;break}if(!mr){pr=pr[rr]}else if(mr==="set"){pr=[...pr][rr]}else{pr=pr.get(rr)}}return pr};Gn.iterables=function(Dt){if(Dt instanceof Set){return"set"}if(Dt instanceof Map){return"map"}}},72912:Dt=>{"use strict";const Lt={};Dt.exports=function(...Dt){try{return JSON.stringify(...Dt)}catch(Dt){return"[Cannot display object: "+Dt.message+"]"}}},99704:(Dt,Lt)=>{"use strict";const Tn={};Lt=Dt.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype};Tn.typeMap=new Map([["[object Error]",Lt.error],["[object Map]",Lt.map],["[object Promise]",Lt.promise],["[object Set]",Lt.set],["[object WeakMap]",Lt.weakMap],["[object WeakSet]",Lt.weakSet]]);Lt.getInternalProto=function(Dt){if(Array.isArray(Dt)){return Lt.array}if(Buffer&&Dt instanceof Buffer){return Lt.buffer}if(Dt instanceof Date){return Lt.date}if(Dt instanceof RegExp){return Lt.regex}if(Dt instanceof Error){return Lt.error}const Wn=Object.prototype.toString.call(Dt);return Tn.typeMap.get(Wn)||Lt.generic}},87492:(Dt,Lt)=>{"use strict";const Tn={};Lt.keys=function(Dt,Lt={}){return Lt.symbols!==false?Reflect.ownKeys(Dt):Object.getOwnPropertyNames(Dt)}},75663:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn={};Lt.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(Dt,Lt){Lt=Lt||{};const Tn=[].concat(Lt.before||[]);const Gn=[].concat(Lt.after||[]);const rr=Lt.group||"?";const cr=Lt.sort||0;Wn(!Tn.includes(rr),`Item cannot come before itself: ${rr}`);Wn(!Tn.includes("?"),"Item cannot come before unassociated items");Wn(!Gn.includes(rr),`Item cannot come after itself: ${rr}`);Wn(!Gn.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){const Dt={seq:this._items.length,sort:cr,before:Tn,after:Gn,group:rr,node:Lt};this._items.push(Dt)}if(!Lt.manual){const Dt=this._sort();Wn(Dt,"item",rr!=="?"?`added into group ${rr}`:"","created a dependencies error")}return this.nodes}merge(Dt){if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){if(Lt){for(const Dt of Lt._items){this._items.push(Object.assign({},Dt))}}}this._items.sort(Gn.mergeSort);for(let Dt=0;Dt<this._items.length;++Dt){this._items[Dt].seq=Dt}const Lt=this._sort();Wn(Lt,"merge created a dependencies error");return this.nodes}sort(){const Dt=this._sort();Wn(Dt,"sort created a dependencies error");return this.nodes}_sort(){const Dt={};const Lt=Object.create(null);const Tn=Object.create(null);for(const Wn of this._items){const Gn=Wn.seq;const rr=Wn.group;Tn[rr]=Tn[rr]||[];Tn[rr].push(Gn);Dt[Gn]=Wn.before;for(const Dt of Wn.after){Lt[Dt]=Lt[Dt]||[];Lt[Dt].push(Gn)}}for(const Lt in Dt){const Wn=[];for(const Gn in Dt[Lt]){const rr=Dt[Lt][Gn];Tn[rr]=Tn[rr]||[];Wn.push(...Tn[rr])}Dt[Lt]=Wn}for(const Wn in Lt){if(Tn[Wn]){for(const Gn of Tn[Wn]){Dt[Gn].push(...Lt[Wn])}}}const Wn={};for(const Lt in Dt){const Tn=Dt[Lt];for(const Dt of Tn){Wn[Dt]=Wn[Dt]||[];Wn[Dt].push(Lt)}}const Gn={};const rr=[];for(let Dt=0;Dt<this._items.length;++Dt){let Lt=Dt;if(Wn[Dt]){Lt=null;for(let Dt=0;Dt<this._items.length;++Dt){if(Gn[Dt]===true){continue}if(!Wn[Dt]){Wn[Dt]=[]}const Tn=Wn[Dt].length;let rr=0;for(let Lt=0;Lt<Tn;++Lt){if(Gn[Wn[Dt][Lt]]){++rr}}if(rr===Tn){Lt=Dt;break}}}if(Lt!==null){Gn[Lt]=true;rr.push(Lt)}}if(rr.length!==this._items.length){return false}const cr={};for(const Dt of this._items){cr[Dt.seq]=Dt}this._items=[];this.nodes=[];for(const Dt of rr){const Lt=cr[Dt];this.nodes.push(Lt.node);this._items.push(Lt)}return true}};Gn.mergeSort=(Dt,Lt)=>Dt.sort===Lt.sort?0:Dt.sort<Lt.sort?-1:1},3563:(Dt,Lt,Tn)=>{const{parse:Wn,format:Gn}=Tn(87016);const{pathToRegexp:rr,compile:cr,parse:pr}=Tn(44985);Dt.exports=Layer;function Layer(Dt,Lt,Tn,Wn={}){this.opts=Wn;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(Tn)?Tn:[Tn];for(const Dt of Lt){const Lt=this.methods.push(Dt.toUpperCase());if(this.methods[Lt-1]==="GET")this.methods.unshift("HEAD")}for(let Tn=0;Tn<this.stack.length;Tn++){const Wn=this.stack[Tn];const Gn=typeof Wn;if(Gn!=="function")throw new Error(`${Lt.toString()} \`${this.opts.name||Dt}\`: \`middleware\` must be a function, not \`${Gn}\``)}this.path=Dt;this.regexp=rr(Dt,this.paramNames,this.opts)}Layer.prototype.match=function(Dt){return this.regexp.test(Dt)};Layer.prototype.params=function(Dt,Lt,Tn={}){for(let Dt=Lt.length,Wn=0;Wn<Dt;Wn++){if(this.paramNames[Wn]){const Dt=Lt[Wn];if(Dt&&Dt.length>0)Tn[this.paramNames[Wn].name]=Dt?safeDecodeURIComponent(Dt):Dt}}return Tn};Layer.prototype.captures=function(Dt){return this.opts.ignoreCaptures?[]:Dt.match(this.regexp).slice(1)};Layer.prototype.url=function(Dt,Lt){let Tn=Dt;const rr=this.path.replace(/\(\.\*\)/g,"");if(typeof Dt!=="object"){Tn=Array.prototype.slice.call(arguments);if(typeof Tn[Tn.length-1]==="object"){Lt=Tn[Tn.length-1];Tn=Tn.slice(0,-1)}}const mr=cr(rr,{encode:encodeURIComponent,...Lt});let gr;const yr=pr(rr);let Sr={};if(Array.isArray(Tn)){for(let Dt=yr.length,Lt=0,Wn=0;Lt<Dt;Lt++){if(yr[Lt].name)Sr[yr[Lt].name]=Tn[Wn++]}}else if(yr.some((Dt=>Dt.name))){Sr=Dt}else if(!Lt){Lt=Dt}gr=mr(Sr);if(Lt&&Lt.query){gr=Wn(gr);if(typeof Lt.query==="string"){gr.search=Lt.query}else{gr.search=undefined;gr.query=Lt.query}return Gn(gr)}return gr};Layer.prototype.param=function(Dt,Lt){const{stack:Tn}=this;const Wn=this.paramNames;const middleware=function(Tn,Wn){return Lt.call(this,Tn.params[Dt],Tn,Wn)};middleware.param=Dt;const Gn=Wn.map((function(Dt){return Dt.name}));const rr=Gn.indexOf(Dt);if(rr>-1){Tn.some((function(Dt,Lt){if(!Dt.param||Gn.indexOf(Dt.param)>rr){Tn.splice(Lt,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(Dt){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${Dt}${this.path}`:Dt;this.paramNames=[];this.regexp=rr(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(Dt){try{return decodeURIComponent(Dt)}catch{return Dt}}},53777:(Dt,Lt,Tn)=>{const Wn=Tn(77246);const Gn=Tn(58024);const rr=Tn(93);const{pathToRegexp:cr}=Tn(44985);const pr=Tn(3563);const mr=Tn(26675)("koa-router");Dt.exports=Router;function Router(Dt={}){if(!(this instanceof Router))return new Router(Dt);this.opts=Dt;this.methods=this.opts.methods||["HEAD","OPTIONS","GET","PUT","PATCH","POST","DELETE"];this.exclusive=Boolean(this.opts.exclusive);this.params={};this.stack=[];this.host=this.opts.host}for(const gr of rr){function setMethodVerb(Dt){Router.prototype[Dt]=function(Lt,Tn,Wn){if(typeof Tn==="string"||Tn instanceof RegExp){Wn=Array.prototype.slice.call(arguments,2)}else{Wn=Array.prototype.slice.call(arguments,1);Tn=Lt;Lt=null}if(typeof Tn!=="string"&&!(Tn instanceof RegExp)&&(!Array.isArray(Tn)||Tn.length===0))throw new Error(`You have to provide a path when adding a ${Dt} handler`);this.register(Tn,[Dt],Wn,{name:Lt});return this}}setMethodVerb(gr)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const Dt=this;const Lt=Array.prototype.slice.call(arguments);let Tn;if(Array.isArray(Lt[0])&&typeof Lt[0][0]==="string"){const Gn=Lt[0];for(const rr of Gn){Dt.use.apply(Dt,[rr].concat(Lt.slice(1)))}return this}const Wn=typeof Lt[0]==="string";if(Wn)Tn=Lt.shift();for(const mr of Lt){if(mr.router){const gr=Object.assign(Object.create(Router.prototype),mr.router,{stack:[...mr.router.stack]});for(let yr=0;yr<gr.stack.length;yr++){const Sr=gr.stack[yr];const Er=Object.assign(Object.create(pr.prototype),Sr);if(Tn)Er.setPrefix(Tn);if(Dt.opts.prefix)Er.setPrefix(Dt.opts.prefix);Dt.stack.push(Er);gr.stack[yr]=Er}if(Dt.params){function setRouterParams(Lt){const Tn=Lt;for(const Lt of Tn){gr.param(Lt,Dt.params[Lt])}}setRouterParams(Object.keys(Dt.params))}}else{const Or=[];cr(Dt.opts.prefix||"",Or);const Ir=Dt.opts.prefix&&Or.length;Dt.register(Tn||"([^/]*)",[],mr,{end:false,ignoreCaptures:!Wn&&!Ir})}}return this};Router.prototype.prefix=function(Dt){Dt=Dt.replace(/\/$/,"");this.opts.prefix=Dt;for(let Lt=0;Lt<this.stack.length;Lt++){const Tn=this.stack[Lt];Tn.setPrefix(Dt)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const Dt=this;const Lt=function dispatch(Lt,Tn){mr("%s %s",Lt.method,Lt.path);const Gn=Dt.matchHost(Lt.host);if(!Gn){return Tn()}const rr=Dt.opts.routerPath||Lt.newRouterPath||Lt.path||Lt.routerPath;const cr=Dt.match(rr,Lt.method);let pr;if(Lt.matched){Lt.matched.push.apply(Lt.matched,cr.path)}else{Lt.matched=cr.path}Lt.router=Dt;if(!cr.route)return Tn();const gr=cr.pathAndMethod;const yr=gr[gr.length-1];Lt._matchedRoute=yr.path;if(yr.name){Lt._matchedRouteName=yr.name}pr=(Dt.exclusive?[yr]:gr).reduce((function(Dt,Lt){Dt.push((function(Dt,Tn){Dt.captures=Lt.captures(rr,Dt.captures);Dt.params=Dt.request.params=Lt.params(rr,Dt.captures,Dt.params);Dt.routerPath=Lt.path;Dt.routerName=Lt.name;Dt._matchedRoute=Lt.path;if(Lt.name){Dt._matchedRouteName=Lt.name}return Tn()}));return Dt.concat(Lt.stack)}),[]);return Wn(pr)(Lt,Tn)};Lt.router=this;return Lt};Router.prototype.allowedMethods=function(Dt={}){const Lt=this.methods;return function allowedMethods(Tn,Wn){return Wn().then((function(){const Wn={};if(!Tn.status||Tn.status===404){for(let Dt=0;Dt<Tn.matched.length;Dt++){const Lt=Tn.matched[Dt];for(let Dt=0;Dt<Lt.methods.length;Dt++){const Tn=Lt.methods[Dt];Wn[Tn]=Tn}}const rr=Object.keys(Wn);if(!~Lt.indexOf(Tn.method)){if(Dt.throw){const Lt=typeof Dt.notImplemented==="function"?Dt.notImplemented():new Gn.NotImplemented;throw Lt}else{Tn.status=501;Tn.set("Allow",rr.join(", "))}}else if(rr.length>0){if(Tn.method==="OPTIONS"){Tn.status=200;Tn.body="";Tn.set("Allow",rr.join(", "))}else if(!Wn[Tn.method]){if(Dt.throw){const Lt=typeof Dt.methodNotAllowed==="function"?Dt.methodNotAllowed():new Gn.MethodNotAllowed;throw Lt}else{Tn.status=405;Tn.set("Allow",rr.join(", "))}}}}}))}};Router.prototype.all=function(Dt,Lt,Tn){if(typeof Lt==="string"){Tn=Array.prototype.slice.call(arguments,2)}else{Tn=Array.prototype.slice.call(arguments,1);Lt=Dt;Dt=null}if(typeof Lt!=="string"&&!(Lt instanceof RegExp)&&(!Array.isArray(Lt)||Lt.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(Lt,rr,Tn,{name:Dt});return this};Router.prototype.redirect=function(Dt,Lt,Tn){if(typeof Dt==="symbol"||Dt[0]!=="/"){Dt=this.url(Dt);if(Dt instanceof Error)throw Dt}if(typeof Lt==="symbol"||Lt[0]!=="/"&&!Lt.includes("://")){Lt=this.url(Lt);if(Lt instanceof Error)throw Lt}return this.all(Dt,(Dt=>{Dt.redirect(Lt);Dt.status=Tn||301}))};Router.prototype.register=function(Dt,Lt,Tn,Wn={}){const Gn=this;const{stack:rr}=this;if(Array.isArray(Dt)){for(const rr of Dt){Gn.register.call(Gn,rr,Lt,Tn,Wn)}return this}const cr=new pr(Dt,Lt,Tn,{end:Wn.end===false?Wn.end:true,name:Wn.name,sensitive:Wn.sensitive||this.opts.sensitive||false,strict:Wn.strict||this.opts.strict||false,prefix:Wn.prefix||this.opts.prefix||"",ignoreCaptures:Wn.ignoreCaptures});if(this.opts.prefix){cr.setPrefix(this.opts.prefix)}for(let Dt=0;Dt<Object.keys(this.params).length;Dt++){const Lt=Object.keys(this.params)[Dt];cr.param(Lt,this.params[Lt])}rr.push(cr);mr("defined route %s %s",cr.methods,cr.path);return cr};Router.prototype.route=function(Dt){const Lt=this.stack;for(let Tn=Lt.length,Wn=0;Wn<Tn;Wn++){if(Lt[Wn].name&&Lt[Wn].name===Dt)return Lt[Wn]}return false};Router.prototype.url=function(Dt,Lt){const Tn=this.route(Dt);if(Tn){const Dt=Array.prototype.slice.call(arguments,1);return Tn.url.apply(Tn,Dt)}return new Error(`No route found for name: ${String(Dt)}`)};Router.prototype.match=function(Dt,Lt){const Tn=this.stack;let Wn;const Gn={path:[],pathAndMethod:[],route:false};for(let rr=Tn.length,cr=0;cr<rr;cr++){Wn=Tn[cr];mr("test %s %s",Wn.path,Wn.regexp);if(Wn.match(Dt)){Gn.path.push(Wn);if(Wn.methods.length===0||~Wn.methods.indexOf(Lt)){Gn.pathAndMethod.push(Wn);if(Wn.methods.length>0)Gn.route=true}}}return Gn};Router.prototype.matchHost=function(Dt){const{host:Lt}=this;if(!Lt){return true}if(!Dt){return false}if(typeof Lt==="string"){return Dt===Lt}if(typeof Lt==="object"&&Lt instanceof RegExp){return Lt.test(Dt)}};Router.prototype.param=function(Dt,Lt){this.params[Dt]=Lt;for(let Tn=0;Tn<this.stack.length;Tn++){const Wn=this.stack[Tn];Wn.param(Dt,Lt)}return this};Router.url=function(Dt){const Lt=Array.prototype.slice.call(arguments,1);return pr.prototype.url.apply({path:Dt},Lt)}},86979:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AsyncHooksContextManager=void 0;const Wn=Tn(46123);const Gn=Tn(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=Gn.createHook({init:this._init.bind(this),before:this._before.bind(this),after:this._after.bind(this),destroy:this._destroy.bind(this),promiseResolve:this._destroy.bind(this)})}active(){var Dt;return(Dt=this._stack[this._stack.length-1])!==null&&Dt!==void 0?Dt:Wn.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){this._enterContext(Dt);try{return Lt.call(Tn,...Wn)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(Dt,Lt){if(Lt==="TIMERWRAP")return;const Tn=this._stack[this._stack.length-1];if(Tn!==undefined){this._contexts.set(Dt,Tn)}}_destroy(Dt){this._contexts.delete(Dt)}_before(Dt){const Lt=this._contexts.get(Dt);if(Lt!==undefined){this._enterContext(Lt)}}_after(){this._exitContext()}_enterContext(Dt){this._stack.push(Dt)}_exitContext(){this._stack.pop()}bind(Dt,Lt){if(typeof Lt==="function"){const Tn=this;const contextWrapper=function(...Wn){return Tn.with(Dt,(()=>Lt.apply(this,Wn)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Lt.length});return contextWrapper}return Lt}}Lt.AsyncHooksContextManager=AsyncHooksContextManager},63259:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AsyncLocalStorageContextManager=void 0;const Wn=Tn(46123);const Gn=Tn(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new Gn.AsyncLocalStorage}active(){var Dt;return(Dt=this._asyncLocalStorage.getStore())!==null&&Dt!==void 0?Dt:Wn.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){const Gn=Tn==null?Lt:Lt.bind(Tn);return this._asyncLocalStorage.run(Dt,Gn,...Wn)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(Dt,Lt){if(typeof Lt==="function"){const Tn=this;const contextWrapper=function(...Wn){return Tn.with(Dt,(()=>Lt.apply(this,Wn)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:Lt.length});return contextWrapper}return Lt}}Lt.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.createContextManager=Lt.isSemverGreaterThanOrEqualTo=void 0;Gn(Tn(86979),Lt);Gn(Tn(63259),Lt);var rr=Tn(43349);Object.defineProperty(Lt,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return rr.isSemverGreaterThanOrEqualTo}});Object.defineProperty(Lt,"createContextManager",{enumerable:true,get:function(){return rr.createContextManager}})},43349:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createContextManager=Lt.isSemverGreaterThanOrEqualTo=void 0;const Wn=Tn(63259);const Gn=Tn(86979);const rr=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(Dt,Lt){const Tn=rr.exec(Dt);const Wn=rr.exec(Lt);if(Tn&&Wn){if(Tn[1]===Wn[1]&&Tn[2]===Wn[2]&&Tn[3]===Wn[3]&&Tn[4]===Wn[4]){return true}return gteString(Tn[1],Wn[1])||Tn[1]===Wn[1]&>eString(Tn[2],Wn[2])||Tn[1]===Wn[1]&&Tn[2]===Wn[2]&>eString(Tn[3],Wn[3])||Tn[1]===Wn[1]&&Tn[2]===Wn[2]&&Tn[3]===Wn[3]&>eString(Tn[4],Wn[4])}return false}Lt.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(Dt,Lt){const Tn=parseInt(Dt,10);const Wn=parseInt(Lt,10);return Tn>Wn}function createContextManager(){const Dt=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?Wn.AsyncLocalStorageContextManager:Gn.AsyncHooksContextManager;return new Dt}Lt.createContextManager=createContextManager},26733:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Bootstrap=Lt.BootstrapStarter=void 0;const Wn=Tn(46123);const Gn=Tn(16928);const rr=Tn(51169);const cr=Tn(44101);const pr=Tn(5982);const mr=Tn(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(Dt={}){this.globalOptions=Dt;return this}async init(){this.appDir=this.globalOptions.appDir=this.globalOptions.appDir||process.cwd();this.baseDir=this.globalOptions.baseDir=this.getBaseDir();if(process.env["MIDWAY_FORK_MODE"]){if(process.env["MIDWAY_FORK_MODE"]==="cluster"){this.eventBus=new pr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new pr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const Dt=await(0,Wn.loadModule)((0,Gn.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(Dt===null||Dt===void 0?void 0:Dt.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,Wn.initializeGlobalApplicationContext)({asyncContextManager:(0,cr.createContextManager)(),loggerFactory:rr.loggers,...this.globalOptions});return this.applicationContext}async run(){this.applicationContext=await this.init();if(this.eventBus){await this.eventBus.start();if(process.env["MIDWAY_STICKY_MODE"]==="true"){const Dt=this.applicationContext.get(Wn.MidwayApplicationManager);const Lt=Dt.getApplication("socketIO");(0,mr.setupWorker)(Lt)}}const Dt=this.applicationContext.get(Wn.MidwayFrameworkService);if(!Dt.getMainApp()){throw new Wn.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,Wn.destroyGlobalApplicationContext)(this.applicationContext)}if(this.eventBus){await this.eventBus.stop()}}getApplicationContext(){return this.applicationContext}getBaseDir(){if(this.globalOptions.baseDir){return this.globalOptions.baseDir}if((0,Wn.isTypeScriptEnvironment)()){return(0,Gn.join)(this.appDir,"src")}else{return(0,Gn.join)(this.appDir,"dist")}}}Lt.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(Dt={}){this.configured=true;if(!this.logger&&!Dt.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(Dt.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}Dt.logger=this.logger}else{this.logger=this.logger||Dt.logger}if(Dt.appDir&&Dt.appDir!==process.cwd()){process.chdir(Dt.appDir)}this.getStarter().configure(Dt);return this}static getStarter(){if(!this.starter){this.starter=new BootstrapStarter}return this.starter}static async run(){if(!this.configured){this.configure()}process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onExit.bind(this));this.uncaughtExceptionHandler=this.uncaughtExceptionHandler.bind(this);process.on("uncaughtException",this.uncaughtExceptionHandler);this.unhandledRejectionHandler=this.unhandledRejectionHandler.bind(this);process.on("unhandledRejection",this.unhandledRejectionHandler);return this.getStarter().run().then((()=>{this.logger.info("[midway:bootstrap] current app started");global["MIDWAY_BOOTSTRAP_APP_READY"]=true;return this.getApplicationContext()})).catch((Dt=>{this.logger.error(Dt);process.exit(1)}))}static async stop(){await this.getStarter().stop();process.removeListener("uncaughtException",this.uncaughtExceptionHandler);process.removeListener("unhandledRejection",this.unhandledRejectionHandler);this.reset();global["MIDWAY_BOOTSTRAP_APP_READY"]=false}static reset(){this.configured=false;this.starter=null;this.bootstrapLoggerFactory.close()}static async onSignal(Dt){this.logger.info("[midway:bootstrap] receive signal %s, closing",Dt);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(Dt){this.logger.error("[midway:bootstrap] close with error: ",Dt);process.exit(1)}}static onExit(Dt){this.logger.info("[midway:bootstrap] exit with code:%s",Dt)}static uncaughtExceptionHandler(Dt){if(!(Dt instanceof Error)){Dt=new Error(String(Dt))}if(Dt.name==="Error"){Dt.name="unhandledExceptionError"}this.logger.error(Dt)}static unhandledRejectionHandler(Dt){if(!(Dt instanceof Error)){const Lt=new Error(String(Dt));if(Dt){if(Dt.name)Lt.name=Dt.name;if(Dt.message)Lt.message=Dt.message;if(Dt.stack)Lt.stack=Dt.stack}Dt=Lt}if(Dt.name==="Error"){Dt.name="unhandledRejectionError"}this.logger.error(Dt)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}Lt.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new rr.MidwayLoggerContainer},84575:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.setupStickyMaster=Lt.AbstractForkManager=Lt.ClusterManager=Lt.BootstrapStarter=Lt.Bootstrap=void 0;Gn(Tn(82516),Lt);var rr=Tn(26733);Object.defineProperty(Lt,"Bootstrap",{enumerable:true,get:function(){return rr.Bootstrap}});Object.defineProperty(Lt,"BootstrapStarter",{enumerable:true,get:function(){return rr.BootstrapStarter}});var cr=Tn(93772);Object.defineProperty(Lt,"ClusterManager",{enumerable:true,get:function(){return cr.ClusterManager}});var pr=Tn(84338);Object.defineProperty(Lt,"AbstractForkManager",{enumerable:true,get:function(){return pr.AbstractForkManager}});var mr=Tn(92364);Object.defineProperty(Lt,"setupStickyMaster",{enumerable:true,get:function(){return mr.setupStickyMaster}})},82516:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},84338:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AbstractForkManager=void 0;const Wn=Tn(70857);const Gn=Tn(39023);const rr=Tn(53599);const cr=Tn(24434);const pr=Tn(39023);const mr=(0,pr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(Dt){this.options=Dt;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new cr.EventEmitter;this.workers=new Map;this.isClosing=false;Dt.count=Dt.count||Wn.cpus().length-1;Dt.refork=Dt.refork!==false;Dt.limit=Dt.limit||60;Dt.duration=Dt.duration||6e4;Dt.logger=Dt.logger||console;Dt.workerInitTimeout=Dt.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:Dt.workerInitTimeout})}async start(){mr("Start manager with options: %j",this.options);this.bindWorkerDisconnect((Dt=>{mr(" - worker(%s): trigger event = disconnect",this.getWorkerId(Dt));const Lt=this.options.logger[Dt["disableRefork"]?"info":"error"];this.disconnectCount++;const Tn=this.isWorkerDead(Dt);if(Tn){mr(" - worker(%s): worker is dead",this.getWorkerId(Dt));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,rr.logDate)(),process.pid,this.getWorkerId(Dt));return}if(Dt["disableRefork"]){mr(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(Dt));Lt("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,rr.logDate)(),process.pid,this.getWorkerId(Dt));return}this.disconnects[this.getWorkerId(Dt)]=(0,rr.logDate)();this.tryToRefork(Dt)}));this.bindWorkerExit(((Dt,Lt,Tn)=>{mr(" - worker(%s): trigger event = exit",this.getWorkerId(Dt));this.workers.delete(this.getWorkerId(Dt));if(Dt["disableRefork"]){return}const Wn=!!this.disconnects[this.getWorkerId(Dt)];mr(" - worker(%s): isExpected=%s",this.getWorkerId(Dt),Wn);if(Wn){delete this.disconnects[this.getWorkerId(Dt)];return}mr(" - worker(%s): isWorkerDead=%s",this.getWorkerId(Dt),this.isWorkerDead(Dt));if(this.isWorkerDead(Dt)){return}mr(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(Dt);this.onUnexpected(Dt,Lt,Tn)}));this.bindClose();this.hub.on("reachReforkLimit",this.onReachReforkLimit.bind(this));setImmediate((()=>{if(process.listeners("uncaughtException").length===0){process.on("uncaughtException",this.onerror.bind(this))}}));for(let Dt=0;Dt<this.options.count;Dt++){const Dt=this.createWorker();mr(" - worker(%s) created",this.getWorkerId(Dt));this.eventBus.addWorker(Dt);this.workers.set(this.getWorkerId(Dt),Dt)}await this.eventBus.start()}tryToRefork(Dt){if(this.allowRefork()){mr(" - worker(%s): allow refork and will fork new",this.getWorkerId(Dt));const Lt=this.createWorker(Dt);this.workers.set(this.getWorkerId(Lt),Lt);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,rr.logDate)(),process.pid,this.getWorkerId(Lt),Lt["state"]);this.eventBus.addWorker(Lt)}else{mr(" - worker(%s): forbidden refork and will stop",this.getWorkerId(Dt));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,rr.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const Dt=this.reforks.push(Date.now());if(Dt>this.options.limit){this.reforks.shift()}const Lt=this.reforks[this.reforks.length-1]-this.reforks[0];const Tn=this.reforks.length<this.options.limit||Lt>this.options.duration;if(!Tn){this.hub.emit("reachReforkLimit")}return Tn}onerror(Dt){if(!Dt){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,rr.logDate)(),process.pid,Dt.stack);this.options.logger.error(Dt);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(Dt,Lt,Tn){const Wn=Dt.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const cr=new Error(Gn.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(Dt),Lt,Tn,Wn,Dt[Wn],Dt["state"]));cr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,rr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,cr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,rr.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(Dt,Lt){await this.closeWorker(Dt);await Promise.race([(0,cr.once)(Dt,"exit"),(0,rr.sleep)(Lt)]);if(Dt.killed)return;(Dt.process||Dt).kill("SIGKILL")}async stop(Dt=2e3){mr("run close");this.isClosing=true;await this.eventBus.stop();for(const Lt of this.workers.values()){Lt["disableRefork"]=true;await this.killWorker(Lt,Dt)}if(this.exitListener){await this.exitListener()}}hasWorker(Dt){return this.workers.has(Dt)}getWorker(Dt){return this.workers.get(Dt)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(Dt){this.exitListener=Dt}bindClose(){process.once("SIGINT",this.onSignal.bind(this,"SIGINT"));process.once("SIGQUIT",this.onSignal.bind(this,"SIGQUIT"));process.once("SIGTERM",this.onSignal.bind(this,"SIGTERM"));process.once("exit",this.onMasterExit.bind(this))}async onSignal(Dt){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",Dt);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(Dt){this.options.logger.error("[midway:master] close with error: ",Dt);process.exit(1)}}}onMasterExit(Dt){this.options.logger.info("[bootstrap:master] exit with code:%s",Dt)}}Lt.AbstractForkManager=AbstractForkManager},93772:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ClusterManager=void 0;const Wn=Tn(5982);const Gn=Tn(84338);const rr=Tn(29907);const cr=Tn(39023);const pr=Tn(46123);const mr=(0,cr.debuglog)("midway:bootstrap");class ClusterManager extends Gn.AbstractForkManager{constructor(Dt={}){super(Dt);this.options=Dt;Dt.args=Dt.args||[];Dt.execArgv=Dt.execArgv||[];if((0,pr.isTypeScriptEnvironment)()){Dt.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(rr["setupPrimary"]){rr["setupPrimary"](this.options)}else if(rr["setupMaster"]){rr["setupMaster"](this.options)}return rr.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(Dt){mr("Bind cluster.disconnect event");rr.on("disconnect",Dt)}bindWorkerExit(Dt){mr("Bind cluster.exit event");rr.on("exit",Dt)}getWorkerId(Dt){return String(Dt.process.pid)}isWorkerDead(Dt){return Dt.isDead()}closeWorker(Dt){Dt.kill("SIGTERM")}createEventBus(Dt){return new Wn.ChildProcessEventBus(Dt)}isPrimary(){return!rr.isWorker}}Lt.ClusterManager=ClusterManager},92364:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.setupWorker=Lt.setupStickyMaster=void 0;const Wn=Tn(29907);const Gn=Tn(76982);const randomId=()=>(0,Gn.randomBytes)(8).toString("hex");function setupStickyMaster(Dt,Lt={}){const Tn={loadBalancingMethod:"least-connection",...Lt};const Gn=new Map;const rr=/sid=([\w-]{20})/;let cr=0;const computeWorkerId=Dt=>{const Lt=rr.exec(Dt);if(Lt){const Dt=Lt[1];const Tn=Gn.get(Dt);if(Tn&&Wn.workers[Tn]){return Tn}}switch(Tn.loadBalancingMethod){case"random":{const Dt=Object.keys(Wn.workers);return Dt[Math.floor(Math.random()*Dt.length)]}case"round-robin":{const Dt=Object.keys(Wn.workers);cr++;if(cr>=Dt.length){cr=0}return Dt[cr]}case"least-connection":let Dt;for(const Lt in Wn.workers){const Tn=Wn.workers[Lt];if(Dt===undefined){Dt=Tn}else{const Lt=Tn["clientsCount"]||0;const Wn=Dt["clientsCount"]||0;if(Lt<Wn){Dt=Tn}}}return Dt.id}};Dt.on("connection",(Dt=>{let Lt,Tn;const sendCallback=Lt=>{if(Lt){Dt.destroy()}};Dt.on("data",(Gn=>{let rr="utf-8";let cr=Gn.toString(rr);if(Lt&&Tn){Wn.workers[Lt].send({type:"sticky:http-chunk",data:cr,encoding:rr,connectionId:Tn},sendCallback);return}Lt=computeWorkerId(cr);const pr=!(cr.startsWith("GET")||cr.substring(0,cr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(cr.startsWith("POST")&&cr.includes("multipart/form-data")){rr="base64";cr=Gn.toString("base64")}Dt.pause();if(pr){Tn=randomId()}Wn.workers[Lt].send({type:"sticky:connection",data:cr,encoding:rr,connectionId:Tn},Dt,{keepOpen:pr},sendCallback)}))}));Dt.on("request",(Dt=>{Dt.on("data",(()=>{}))}));Wn.on("message",((Dt,{type:Lt,data:Wn})=>{switch(Lt){case"sticky:connection":Gn.set(Wn,Dt.id);if(Tn.loadBalancingMethod==="least-connection"){Dt["clientsCount"]=(Dt["clientsCount"]||0)+1}break;case"sticky:disconnection":Gn.delete(Wn);if(Tn.loadBalancingMethod==="least-connection"){Dt["clientsCount"]--}break}}))}Lt.setupStickyMaster=setupStickyMaster;function setupWorker(Dt){const Lt=new Map;process.on("message",(({type:Tn,data:Wn,encoding:Gn,connectionId:rr},cr)=>{switch(Tn){case"sticky:connection":if(!cr){return}Dt.httpServer.emit("connection",cr);cr.emit("data",Buffer.from(Wn,Gn));cr.resume();if(rr){Lt.set(rr,cr);cr.on("close",(()=>{Lt.delete(rr)}))}break;case"sticky:http-chunk":{const Dt=Lt.get(rr);if(Dt){Dt.emit("data",Buffer.from(Wn,Gn))}}}}));const ignoreError=()=>{};Dt.engine.on("connection",(Dt=>{process.send({type:"sticky:connection",data:Dt.id},ignoreError);Dt.once("close",(()=>{process.send({type:"sticky:disconnection",data:Dt.id},ignoreError)}))}))}Lt.setupWorker=setupWorker},53599:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.sleep=Lt.logDate=void 0;function logDate(){const Dt=new Date;let Lt=Dt.getDate();if(Lt<10){Lt="0"+Lt}let Tn=Dt.getMonth()+1;if(Tn<10){Tn="0"+Tn}let Wn=Dt.getHours();if(Wn<10){Wn="0"+Wn}let Gn=Dt.getMinutes();if(Gn<10){Gn="0"+Gn}let rr=Dt.getSeconds();if(rr<10){rr="0"+rr}let cr=Dt.getMilliseconds();if(cr<10){cr="00"+cr}else if(cr<100){cr="0"+cr}return Dt.getFullYear()+"-"+Tn+"-"+Lt+" "+Wn+":"+Gn+":"+rr+"."+cr}Lt.logDate=logDate;async function sleep(Dt){return new Promise((Lt=>{setTimeout(Lt,Dt)}))}Lt.sleep=sleep},64080:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.multiCaching=Lt.createCache=Lt.caching=void 0;const Wn=Tn(48851);const Gn=Tn(87932);async function caching(Dt,Lt){if(Dt==="memory"){const Dt=(0,Gn.memoryStore)(Lt);return createCache(Dt,Lt)}if(typeof Dt==="function"){const Tn=await Dt(Lt);return createCache(Tn,Lt)}return createCache(Dt,Lt)}Lt.caching=caching;function createCache(Dt,Lt){return{wrap:async(Tn,Gn,rr)=>(0,Wn.coalesceAsync)(Tn,(async()=>{const cr=await Dt.get(Tn);if(cr===undefined){const Lt=await Gn();const Wn=typeof rr==="function"?rr(Lt):rr;await Dt.set(Tn,Lt,Wn);return Lt}else if(Lt===null||Lt===void 0?void 0:Lt.refreshThreshold){const pr=typeof rr==="function"?rr(cr):rr;const mr=await Dt.ttl(Tn);if(mr!==-1&&mr<Lt.refreshThreshold){(0,Wn.coalesceAsync)(`+++${Tn}`,Gn).then((Lt=>Dt.set(Tn,Lt,pr)))}}return cr})),store:Dt,del:Lt=>Dt.del(Lt),get:Lt=>Dt.get(Lt),set:(Lt,Tn,Wn)=>Dt.set(Lt,Tn,Wn),reset:()=>Dt.reset(),methodWrap:async(Tn,Gn,rr,cr)=>(0,Wn.coalesceAsync)(Tn,(async()=>{const pr=await Dt.get(Tn);if(pr===undefined){const Lt=await Gn(...rr);const Wn=typeof cr==="function"?cr(Lt):cr;await Dt.set(Tn,Lt,Wn);return Lt}else if(Lt===null||Lt===void 0?void 0:Lt.refreshThreshold){const mr=typeof cr==="function"?cr(pr):cr;const gr=await Dt.ttl(Tn);if(gr!==-1&&gr<Lt.refreshThreshold){(0,Wn.coalesceAsync)(`+++${Tn}`,(()=>Gn(...rr))).then((Lt=>Dt.set(Tn,Lt,mr)))}}return pr}))}}Lt.createCache=createCache;function multiCaching(Dt){const get=async Lt=>{for(const Tn of Dt){try{const Dt=await Tn.get(Lt);if(Dt!==undefined)return Dt}catch(Dt){}}};const set=async(Lt,Tn,Wn)=>{await Promise.all(Dt.map((Dt=>Dt.set(Lt,Tn,Wn))))};return{get:get,set:set,del:async Lt=>{await Promise.all(Dt.map((Dt=>Dt.del(Lt))))},async wrap(Lt,Tn,Wn){let Gn;let rr=0;for(;rr<Dt.length;rr++){try{Gn=await Dt[rr].get(Lt);if(Gn!==undefined)break}catch(Dt){}}if(Gn===undefined){const Dt=await Tn();const Gn=typeof Wn==="function"?Wn(Dt):Wn;await set(Lt,Dt,Gn);return Dt}else{const cr=typeof Wn==="function"?Wn(Gn):Wn;Promise.all(Dt.slice(0,rr).map((Dt=>Dt.set(Lt,Gn,cr)))).then();Dt[rr].wrap(Lt,Tn,Wn).then()}return Gn},reset:async()=>{await Promise.all(Dt.map((Dt=>Dt.reset())))},mget:async(...Lt)=>{const Tn=new Array(Lt.length).fill(undefined);for(const Wn of Dt){if(Tn.every((Dt=>Dt!==undefined)))break;try{const Dt=await Wn.store.mget(...Lt);Dt.forEach(((Dt,Lt)=>{if(Tn[Lt]===undefined&&Dt!==undefined)Tn[Lt]=Dt}))}catch(Dt){}}return Tn},mset:async(Lt,Tn)=>{await Promise.all(Dt.map((Dt=>Dt.store.mset(Lt,Tn))))},mdel:async(...Lt)=>{await Promise.all(Dt.map((Dt=>Dt.store.mdel(...Lt))))},methodWrap:async(Lt,Tn,Wn,Gn)=>{let rr;let cr=0;for(;cr<Dt.length;cr++){try{rr=await Dt[cr].get(Lt);if(rr!==undefined)break}catch(Dt){}}if(rr===undefined){const Dt=await Tn(...Wn);const rr=typeof Gn==="function"?Gn(Dt):Gn;await set(Lt,Dt,rr);return Dt}else{const pr=typeof Gn==="function"?Gn(rr):Gn;Promise.all(Dt.slice(0,cr).map((Dt=>Dt.set(Lt,rr,pr)))).then();Dt[cr].methodWrap(Lt,Tn,Wn,Gn).then()}return rr}}}Lt.multiCaching=multiCaching},8869:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(64080),Lt);Gn(Tn(87932),Lt);Gn(Tn(91724),Lt)},48851:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.coalesceAsync=void 0;const Tn=new Map;async function coalesceAsync(Dt,Lt){if(!hasKey(Dt)){addKey(Dt);try{const Tn=await Promise.resolve(Lt());coalesce({key:Dt,result:Tn});return Tn}catch(Lt){coalesce({key:Dt,error:Lt});throw Lt}}return enqueue(Dt)}Lt.coalesceAsync=coalesceAsync;function hasKey(Dt){return Tn.has(Dt)}function addKey(Dt){Tn.set(Dt,[])}function removeKey(Dt){Tn.delete(Dt)}function addCallbackToKey(Dt,Lt){const Wn=getCallbacksByKey(Dt);Wn.push(Lt);Tn.set(Dt,Wn)}function getCallbacksByKey(Dt){var Lt;return(Lt=Tn.get(Dt))!==null&&Lt!==void 0?Lt:[]}function enqueue(Dt){return new Promise(((Lt,Tn)=>{const Wn={resolve:Lt,reject:Tn};addCallbackToKey(Dt,Wn)}))}function dequeue(Dt){const Lt=getCallbacksByKey(Dt);removeKey(Dt);return Lt}function coalesce(Dt){const{key:Lt,error:Tn,result:Wn}=Dt;dequeue(Lt).forEach((Dt=>{if(Tn){Dt.reject(Tn)}else{Dt.resolve(Wn)}}))}},87932:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.memoryStore=void 0;const Wn=Tn(57223);const Gn=Tn(19944);function clone(Dt){if(typeof Dt==="object"&&Dt!==null){return Gn(Dt)}return Dt}function memoryStore(Dt){var Lt;const Tn=(Dt===null||Dt===void 0?void 0:Dt.shouldCloneBeforeSet)!==false;const Gn=(Lt=Dt===null||Dt===void 0?void 0:Dt.isCacheable)!==null&&Lt!==void 0?Lt:Dt=>Dt!==undefined;const rr={ttlAutopurge:true,...Dt,max:(Dt===null||Dt===void 0?void 0:Dt.max)||500,ttl:(Dt===null||Dt===void 0?void 0:Dt.ttl)!==undefined?Dt.ttl:0};const cr=new Wn(rr);return{async del(Dt){cr.delete(Dt)},get:async Dt=>cr.get(Dt),keys:async()=>[...cr.keys()],mget:async(...Dt)=>Dt.map((Dt=>cr.get(Dt))),async mset(Dt,Lt){const Wn={ttl:Lt!==undefined?Lt:rr.ttl};for(const[Lt,rr]of Dt){if(!Gn(rr))throw new Error(`no cacheable value ${JSON.stringify(rr)}`);if(Tn)cr.set(Lt,clone(rr),Wn);else cr.set(Lt,rr,Wn)}},async mdel(...Dt){for(const Lt of Dt)cr.delete(Lt)},async reset(){cr.clear()},ttl:async Dt=>cr.getRemainingTTL(Dt),async set(Dt,Lt,Wn){if(!Gn(Lt))throw new Error(`no cacheable value ${JSON.stringify(Lt)}`);if(Tn)Lt=clone(Lt);const pr=Wn!==undefined?Wn:rr.ttl;cr.set(Dt,Lt,{ttl:pr})},get calculatedSize(){return cr.calculatedSize},get size(){return cr.size},dump:()=>cr.dump(),load:(...Dt)=>cr.load(...Dt)}}Lt.memoryStore=memoryStore},91724:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},68805:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CacheConfiguration=Lt.getClassMethodDefaultCacheKey=void 0;const rr=Tn(46123);const cr=Tn(42696);const pr=Tn(91761);function getClassMethodDefaultCacheKey(Dt,Lt){return Dt.name+"-"+(0,rr.getProviderUUId)(Dt)+"-"+Lt}Lt.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let mr=class CacheConfiguration{async onReady(Dt){this.cacheService=await Dt.getAsync(pr.CachingFactory);this.decoratorService.registerMethodHandler(cr.CACHE_DECORATOR_KEY,(({target:Dt,propertyName:Lt,metadata:Tn})=>{if(!Tn.cacheKey){Tn.cacheKey=getClassMethodDefaultCacheKey(Dt,Lt)}return{around:async Dt=>{let Lt=Tn.cacheKey;const Wn=this.cacheService.get(Tn.cacheInstanceName);if(typeof Lt==="function"){Lt=await Lt({methodArgs:Dt.args,ctx:Dt.target[rr.REQUEST_OBJ_CTX_KEY],target:Dt.target})}if(typeof Lt==="string"){return Wn.methodWrap(Lt,Dt.proceed,Dt.args,Tn.ttl)}else{return Dt.proceed(...Dt.args)}}}}))}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayDecoratorService)],mr.prototype,"decoratorService",void 0);mr=Wn([(0,rr.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],mr);Lt.CacheConfiguration=mr},42696:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Caching=Lt.CACHE_DECORATOR_KEY=void 0;const Wn=Tn(46123);Lt.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(Dt,Tn,Gn){if(typeof Tn==="number"){Gn=Tn;Tn=undefined}return(0,Wn.createCustomMethodDecorator)(Lt.CACHE_DECORATOR_KEY,{cacheInstanceName:Dt,cacheKey:Tn,ttl:Gn})}Lt.Caching=Caching},91761:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CachingFactory=void 0;const rr=Tn(46123);const cr=Tn(8869);let pr=class CachingFactory extends rr.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(Dt,Lt){if(Array.isArray(Dt.store)){const Tn=[];for(const Wn of Dt.store){if(typeof Wn==="string"){if(!this.has(Wn)){throw new rr.MidwayCommonError(`cache instance "${Wn}" not found in "${Lt}", please check your configuration.`)}Tn.push(this.get(Wn))}else if(typeof Wn==="function"){Tn.push(await Wn())}else if(Wn["wrap"]){Tn.push(Wn["wrap"])}else if(typeof Wn==="object"){if(typeof Wn.store==="function"){Wn.store=await Wn.store(Wn["options"]||{},this.applicationContext)}if(!Wn.store){throw new rr.MidwayCommonError(`cache instance "${Lt}" store is undefined, please check your configuration.`)}Tn.push(await(0,cr.caching)(Wn.store,Wn["options"]))}else{throw new rr.MidwayCommonError("invalid cache config")}}return await(0,cr.multiCaching)(Tn)}else{if(typeof Dt.store==="function"){Dt.store=await Dt.store(Dt["options"]||{},this.applicationContext)}if(!Dt.store){throw new rr.MidwayCommonError(`cache instance "${Lt}" store is undefined, please check your configuration.`)}return await(0,cr.caching)(Dt.store,Dt["options"])}}getName(){return"cache-manager"}getCaching(Dt){return this.get(Dt)}getMultiCaching(Dt){return this.get(Dt)}};Wn([(0,rr.Config)("cacheManager"),Gn("design:type",Object)],pr.prototype,"cacheManagerConfig",void 0);Wn([(0,rr.ApplicationContext)(),Gn("design:type",Object)],pr.prototype,"applicationContext",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"init",null);pr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],pr);Lt.CachingFactory=pr},96955:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.CacheManager=Lt.getClassMethodDefaultCacheKey=Lt.Configuration=void 0;var rr=Tn(68805);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.CacheConfiguration}});Object.defineProperty(Lt,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return rr.getClassMethodDefaultCacheKey}});Gn(Tn(43488),Lt);Gn(Tn(91761),Lt);Gn(Tn(42696),Lt);Lt.CacheManager=Tn(8869);Gn(Tn(93730),Lt)},43488:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},93730:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createRedisStore=void 0;const Wn=Tn(46123);const getVal=Dt=>JSON.stringify(Dt)||'"undefined"';function createRedisStore(Dt){return async(Lt,Tn)=>{const{RedisServiceFactory:Gn}=(0,Wn.safeRequire)("@midwayjs/redis");const rr=await Tn.getAsync(Gn);const cr=rr.get(Dt);return createStore(cr,Lt)}}Lt.createRedisStore=createRedisStore;function createStore(Dt,Lt){const Tn=(Lt===null||Lt===void 0?void 0:Lt.isCacheable)||(Dt=>Dt!==undefined&&Dt!==null);const keys=Lt=>Dt.keys(Lt);return{async get(Lt){const Tn=await Dt.get(Lt);if(Tn===undefined||Tn===null)return undefined;else{try{return JSON.parse(Tn)}catch(Dt){return Tn}}},async set(Gn,rr,cr){if(!Tn(rr))throw new Wn.MidwayCommonError(`"${rr}" is not a cacheable value`);const pr=cr===undefined?Lt===null||Lt===void 0?void 0:Lt.ttl:cr;if(pr!==undefined&&pr!==0)await Dt.set(Gn,getVal(rr),"PX",pr);else await Dt.set(Gn,getVal(rr))},async mset(Gn,rr){const cr=rr===undefined?Lt===null||Lt===void 0?void 0:Lt.ttl:rr;if(cr!==undefined&&cr!==0){const Lt=Dt.multi();for(const[Dt,rr]of Gn){if(!Tn(rr))throw new Wn.MidwayCommonError(`"${getVal(rr)}" is not a cacheable value`);Lt.set(Dt,getVal(rr),"PX",cr)}await Lt.exec()}else await Dt.mset(Gn.flatMap((([Dt,Lt])=>{if(!Tn(Lt))throw new Error(`"${getVal(Lt)}" is not a cacheable value`);return[Dt,getVal(Lt)]})))},mget:(...Lt)=>Dt.mget(Lt).then((Dt=>Dt.map((Dt=>{if(Dt===null||Dt===undefined){return undefined}else{try{return JSON.parse(Dt)}catch(Lt){return Dt}}})))),async mdel(...Lt){await Dt.del(Lt)},async del(Lt){await Dt.del(Lt)},ttl:async Lt=>Dt.pttl(Lt),keys:(Dt="*")=>keys(Dt),reset:()=>{throw new Wn.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:Tn}}},4074:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Cookie=void 0;const Wn=Tn(42613);const Gn=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const rr=/^(?:none|lax|strict)$/i;class Cookie{constructor(Dt,Lt,Tn){Wn(Gn.test(Dt),"argument name is invalid");Wn(!Lt||Gn.test(Lt),"argument value is invalid");this.name=Dt;this.value=Lt||"";this.attrs=mergeDefaultAttrs(Tn);Wn(!this.attrs.path||Gn.test(this.attrs.path),"argument option path is invalid");Wn(!this.attrs.domain||Gn.test(this.attrs.domain),"argument option domain is invalid");Wn(!this.attrs.sameSite||this.attrs.sameSite===true||rr.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!Lt){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let Dt=this.toString();const Lt=this.attrs;if(Lt.path)Dt+="; path="+Lt.path;const Tn=typeof Lt.maxAge==="string"?parseInt(Lt.maxAge,10):Lt.maxAge;if(Tn){Dt+="; max-age="+Math.round(Tn/1e3);Lt.expires=new Date(Date.now()+Tn)}if(Lt.expires)Dt+="; expires="+Lt.expires.toUTCString();if(Lt.domain)Dt+="; domain="+Lt.domain;if(Lt.sameSite)Dt+="; samesite="+(Lt.sameSite===true?"strict":Lt.sameSite.toLowerCase());if(Lt.secure)Dt+="; secure";if(Lt.httpOnly)Dt+="; httponly";if(Lt.priority)Dt+="; priority="+Lt.priority;if(Lt.partitioned)Dt+="; partitioned";return Dt}}Lt.Cookie=Cookie;const cr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(Dt){const Lt={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!Dt)return Lt;for(let Tn=0;Tn<cr.length;Tn++){const Wn=cr[Tn];if(Wn in Dt)Lt[Wn]=Dt[Wn]}return Lt}},11033:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.urlSafeDecode=Lt.urlSafeEncode=Lt.Cookies=void 0;const Wn=Tn(42613);const Gn=Tn(4074);const rr=Tn(5693);const cr=Tn(86054);const pr=Symbol("midwayCookies:keysArray");const mr=Symbol("midwayCookies:keys");const gr=new Map;class Cookies{constructor(Dt,Lt,Tn,Wn){var Gn;this[pr]=Lt?[].concat(Lt):Lt;this._defaultCookieOptions=Tn;this._defaultGetCookieOptions=Wn;this.ctx=Dt;this.secure=(Gn=Tn===null||Tn===void 0?void 0:Tn.secure)!==null&&Gn!==void 0?Gn:this.ctx.secure;this.app=Dt.app}get keys(){if(!this[mr]){const Dt=this[pr];Wn(Array.isArray(Dt),".keys required for encrypt/sign cookies");const Lt=gr.get(Dt);if(Lt){this[mr]=Lt}else{this[mr]=new rr.Keygrip(this[pr]);gr.set(Dt,this[mr])}}return this[mr]}get(Dt,Lt){Lt=Object.assign({},this._defaultGetCookieOptions||{},Lt);const Tn=computeSigned(Lt);const Wn=this.ctx.get("cookie");if(!Wn)return;const Gn=Wn.match(getPattern(Dt));if(!Gn)return;let rr=Gn[1];if(!Lt.encrypt&&!Tn)return rr;if(Tn){const Lt=Dt+".sig";const Tn=this.get(Lt,{signed:false});if(!Tn)return;const Wn=Dt+"="+rr;const Gn=this.keys.verify(Wn,Tn);if(Gn<0){this.set(Lt,null,{path:"/",signed:false});return}if(Gn>0){this.set(Lt,this.keys.sign(Wn),{signed:false})}return rr}rr=urlSafeDecode(rr);const cr=this.keys.decrypt(rr);if(cr===null||cr===void 0?void 0:cr.value){return cr.value.toString()}return undefined}set(Dt,Lt,Tn){if(!Tn&&typeof Lt!=="string"){Tn=Lt;Lt=""}Tn=Object.assign({},this._defaultCookieOptions,Tn);const Wn=computeSigned(Tn);Lt=Lt||"";if(!this.secure&&Tn.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let rr=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(rr))rr=[rr];if(Tn.encrypt){Lt=Lt&&urlSafeEncode(this.keys.encrypt(Lt))}if(Lt.length>4093){this.app.emit("cookieLimitExceed",{name:Dt,value:Lt,ctx:this.ctx})}const cr=this.ctx.get("user-agent");if(Tn.sameSite&&typeof Tn.sameSite==="string"&&Tn.sameSite.toLowerCase()==="none"){if(!this.secure||cr&&!this.isSameSiteNoneCompatible(cr)){Tn.sameSite=false}}if(Tn.partitioned){if(!this.secure||!cr||cr&&!this.isPartitionedCompatible(cr)){Tn.partitioned=false}}if(Tn.partitioned&&Tn.removeUnpartitioned){const Lt=Tn.overwrite;if(Lt){Tn.overwrite=false;rr=ignoreCookiesByName(rr,Dt)}const cr=Object.assign({},Tn,{partitioned:false});const pr=new Gn.Cookie(Dt,"",cr);if(Tn.secure===undefined)pr.attrs.secure=this.secure;rr=pushCookie(rr,pr);if(Wn){pr.name+=".sig";rr=ignoreCookiesByName(rr,pr.name);rr=pushCookie(rr,pr)}}if(Tn.priority){if(!cr||cr&&!this.isPriorityCompatible(cr)){Tn.priority=undefined}}const pr=new Gn.Cookie(Dt,Lt,Tn);if(Tn.secure===undefined)pr.attrs.secure=this.secure;rr=pushCookie(rr,pr);if(Wn){pr.value=Lt&&this.keys.sign(pr.toString());pr.name+=".sig";rr=pushCookie(rr,pr)}this.ctx.set("set-cookie",rr);return this}isSameSiteNoneCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=80}return(0,cr.isSameSiteNoneCompatible)(Dt)}isPartitionedCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=114}return false}parseChromiumAndMajorVersion(Dt){if(!this.uaParseResult){const Lt=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(Dt);if(!Lt)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(Lt[1])}}return this.uaParseResult}isPriorityCompatible(Dt){const Lt=this.parseChromiumAndMajorVersion(Dt);if(Lt.chromium&&Lt.majorVersion){return Lt.majorVersion>=81}return false}}Lt.Cookies=Cookies;const yr=new Map;function getPattern(Dt){const Lt=yr.get(Dt);if(Lt)return Lt;const Tn=new RegExp("(?:^|;) *"+Dt.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");yr.set(Dt,Tn);return Tn}function computeSigned(Dt){if(Dt.encrypt)return false;return Dt.signed!==false}function pushCookie(Dt,Lt){if(Lt.attrs.overwrite){Dt=ignoreCookiesByName(Dt,Lt.name)}Dt.push(Lt.toHeader());return Dt}function ignoreCookiesByName(Dt,Lt){const Tn=`${Lt}=`;return Dt.filter((Dt=>!Dt.startsWith(Tn)))}function urlSafeEncode(Dt){return Dt.replace(/\+/g,"-").replace(/\//g,"_")}Lt.urlSafeEncode=urlSafeEncode;function urlSafeDecode(Dt){return Dt.replace(/-/g,"+").replace(/_/g,"/")}Lt.urlSafeDecode=urlSafeDecode},60990:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(33249),Lt);Gn(Tn(11033),Lt)},33249:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},5693:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Keygrip=void 0;const Wn=Tn(42613);const Gn=Tn(39023);const rr=Tn(76982);const cr=Tn(48978);const pr=(0,Gn.debuglog)("midway:cookies");const mr={"/":"_","+":"-","=":""};class Keygrip{constructor(Dt){Wn(Array.isArray(Dt)&&Dt.length,"keys must be provided and should be an array");this.keys=Dt;this.hash="sha256"}encrypt(Dt,Lt){Lt=Lt||this.keys[0];try{Dt=String(Dt);const Tn=getAlgorithm();const Wn=(0,rr.randomBytes)(64);const Gn=(0,rr.randomBytes)(16);const cr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const pr=deriveKeyFromPassword(Lt,Wn,Math.floor(cr*.47+1337));const mr=(0,rr.createCipheriv)(Tn,pr,Gn);const gr=Buffer.concat([mr.update(Dt,"utf8"),mr.final()]);const yr=mr.getAuthTag();const Sr=Buffer.concat([Wn,Gn,yr,Buffer.from(cr.toString()),gr]).toString("hex");return getEncryptedPrefix()+Sr}catch(Dt){pr("crypt error",Dt.stack);return undefined}}decrypt(Dt,Lt){if(!Lt){const Lt=this.keys;for(let Tn=0;Tn<Lt.length;Tn++){const Wn=this.decrypt(Dt,Lt[Tn]);if(Wn!==false)return{value:Wn,index:Tn}}return false}try{const Tn=getAlgorithm();const Wn=Dt.split(getEncryptedPrefix());if(Wn.length!==2){return void 0}else{Dt=Wn[1]}const Gn=Buffer.from(Dt,"hex");const cr=Gn.slice(0,64);const pr=Gn.slice(64,80);const mr=Gn.slice(80,96);const gr=parseInt(Gn.slice(96,101).toString("utf-8"),10);const yr=Gn.slice(101);const Sr=deriveKeyFromPassword(Lt,cr,Math.floor(gr*.47+1337));const Er=(0,rr.createDecipheriv)(Tn,Sr,pr);Er.setAuthTag(mr);return Er.update(yr,"binary","utf-8")+Er.final("utf-8")}catch(Dt){pr("crypt error",Dt.stack);return false}}sign(Dt,Lt){Lt=Lt||this.keys[0];return(0,rr.createHmac)(this.hash,Lt).update(Dt).digest("base64").replace(/\/|\+|=/g,(Dt=>mr[Dt]))}verify(Dt,Lt){const Tn=this.keys;for(let Wn=0;Wn<Tn.length;Wn++){if(cr(Buffer.from(Lt),Buffer.from(this.sign(Dt,Tn[Wn])))){pr("data %s match key %s",Dt,Tn[Wn]);return Wn}}return-1}}Lt.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(Dt,Lt,Tn){return(0,rr.pbkdf2Sync)(Dt,Lt,Tn,32,"sha512")}},83872:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BaseFramework=void 0;const rr=Tn(6192);const cr=Tn(2222);const pr=Tn(49757);const mr=Tn(97983);const gr=Tn(70275);const yr=Tn(78842);const Sr=Tn(37482);const Er=Tn(34888);const Or=Tn(12738);const Ir=Tn(68220);const Hr=Tn(39408);const Gr=Tn(77306);const $r=Tn(39023);const mi=Tn(75351);const ki=Tn(40581);const Ni=$r.debuglog("midway:debug");class BaseFramework{constructor(Dt){this.applicationContext=Dt;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var Dt,Lt;this.configurationOptions=(Dt=this.configure())!==null&&Dt!==void 0?Dt:{};this.contextLoggerApplyLogger=(Lt=this.configurationOptions.contextLoggerApplyLogger)!==null&&Lt!==void 0?Lt:"appLogger";this.contextLoggerFormat=this.configurationOptions.contextLoggerFormat;this.logger=this.loggerService.getLogger("coreLogger");this.appLogger=this.loggerService.getLogger("appLogger");return this}isEnable(){return true}async initialize(Dt){this.bootstrapOptions=Dt;await this.beforeContainerInitialize(Dt);await this.containerInitialize(Dt);await this.afterContainerInitialize(Dt);await this.containerDirectoryLoad(Dt);await this.afterContainerDirectoryLoad(Dt);await this.applicationInitialize(Dt);await this.containerReady(Dt);await this.afterContainerReady(Dt);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(Dt){}async containerDirectoryLoad(Dt){}async containerReady(Dt){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(Dt){return this.configService.getConfiguration(Dt)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(Dt,Lt){if(Lt&&Lt!=="appLogger"){const Tn=this.getLogger(Lt);let Wn=Dt.getAttr(cr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!Wn){Wn=new Map;Dt.setAttr(cr.REQUEST_CTX_LOGGER_CACHE_KEY,Wn)}if(Wn.has(Lt)){return Wn.get(Lt)}const Gn=this.loggerService.createContextLogger(Dt,Tn);Wn.set(Lt,Gn);return Gn}else{const Tn=this.getLogger(Lt!==null&&Lt!==void 0?Lt:this.contextLoggerApplyLogger);if(Dt["_logger"]){return Dt["_logger"]}Dt["_logger"]=this.loggerService.createContextLogger(Dt,Tn,{contextFormat:this.contextLoggerFormat});return Dt["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(Dt={},Lt=[]){const Tn={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:Dt=>this.getConfiguration(Dt),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>rr.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:Dt=>this.getLogger(Dt),createLogger:(Dt,Lt={})=>this.createLogger(Dt,Lt),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:Dt=>{const Lt=Dt||Object.create(this.defaultContext);if(!Lt.startTime){Lt.startTime=Date.now()}if(!Lt.logger){Lt.logger=this.createContextLogger(Lt)}if(!Lt.requestContext){Lt.requestContext=new mr.MidwayRequestContainer(Lt,this.getApplicationContext());Lt.requestContext.ready()}if(!Lt.getLogger){Lt.getLogger=Dt=>this.createContextLogger(Lt,Dt)}Lt.setAttr=(Dt,Tn)=>{Lt.requestContext.setAttr(Dt,Tn)};Lt.getAttr=Dt=>Lt.requestContext.getAttr(Dt);Lt.getApp=()=>this.getApplication();return Lt},addConfigObject:Dt=>{this.configService.addObject(Dt)},setAttr:(Dt,Lt)=>{this.getApplicationContext().setAttr(Dt,Lt)},getAttr:Dt=>this.getApplicationContext().getAttr(Dt),useMiddleware:Dt=>this.useMiddleware(Dt),getMiddleware:()=>this.getMiddleware(),useFilter:Dt=>this.useFilter(Dt),useGuard:Dt=>this.useGuard(Dt),getNamespace:()=>this.getNamespace()};for(const Dt of Lt){delete Tn[Dt]}Object.assign(this.app,Tn,Dt)}async beforeStop(){}async beforeContainerInitialize(Dt){}async afterContainerInitialize(Dt){}async afterContainerDirectoryLoad(Dt){}async afterContainerReady(Dt){}async applyMiddleware(Dt){var Lt;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(cr.ASYNC_CONTEXT_MANAGER_KEY)){const Dt=this.configService.getConfiguration("asyncContextManager.enable")||false;const Tn=Dt?((Lt=this.bootstrapOptions)===null||Lt===void 0?void 0:Lt.asyncContextManager)||new mi.NoopContextManager:new mi.NoopContextManager;if(Dt){Tn.enable()}this.applicationContext.registerObject(cr.ASYNC_CONTEXT_MANAGER_KEY,Tn)}this.middlewareManager.insertFirst((async(Dt,Lt)=>{const Tn=mi.ASYNC_ROOT_CONTEXT.setValue(cr.ASYNC_CONTEXT_KEY,Dt);const Wn=this.applicationContext.get(cr.ASYNC_CONTEXT_MANAGER_KEY);return await Wn.with(Tn,(async()=>{await this.mockService.runSimulatorContextSetup(Dt,this.app);this.mockService.applyContextMocks(this.app,Dt);let Tn=undefined;try{const Wn=await Lt();Tn=await this.filterManager.runResultFilter(Wn,Dt)}catch(Lt){Tn=await this.filterManager.runErrorFilter(Lt,Dt)}finally{await this.mockService.runSimulatorContextTearDown(Dt,this.app)}if(Tn.error){throw Tn.error}return Tn.result}))}));Ni(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(Dt){Dt=Array.isArray(Dt)?Dt:[Dt];return await this.middlewareService.compose([this.composeMiddleware,...Dt],this.app)}return this.composeMiddleware}getLogger(Dt){var Lt;return(Lt=this.loggerService.getLogger(Dt))!==null&&Lt!==void 0?Lt:this.appLogger}getCoreLogger(){return this.logger}createLogger(Dt,Lt={}){return this.loggerService.createLogger(Dt,Lt)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(Dt){this.middlewareManager.insertLast(Dt)}getMiddleware(){return this.middlewareManager}useFilter(Dt){return this.filterManager.useFilter(Dt)}useGuard(Dt){return this.guardManager.addGlobalGuard(Dt)}async runGuard(Dt,Lt,Tn){return this.guardManager.runGuard(Dt,Lt,Tn)}createMiddlewareManager(){return new Or.ContextMiddlewareManager}createFilterManager(){return new Hr.FilterManager}createGuardManager(){return new ki.GuardManager}setNamespace(Dt){this.namespace=Dt}getNamespace(){return this.namespace}}Wn([(0,pr.Inject)(),Gn("design:type",Er.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",gr.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",yr.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Sr.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Ir.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);Wn([(0,pr.Inject)(),Gn("design:type",Gr.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);Wn([(0,pr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],BaseFramework.prototype,"init",null);Lt.BaseFramework=BaseFramework},43436:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayApplicationManager=void 0;const Gn=Tn(6192);const rr=Tn(49757);let cr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(Dt,Lt){this.globalFrameworkMap.set(Dt,Lt);if(Lt["getFrameworkType"]){this.globalFrameworkTypeMap.set(Lt["getFrameworkType"](),Lt)}}getFramework(Dt){if(typeof Dt==="string"){if(this.globalFrameworkMap.has(Dt)){return this.globalFrameworkMap.get(Dt)}}else{if(this.globalFrameworkTypeMap.has(Dt)){return this.globalFrameworkTypeMap.get(Dt)}}}getApplication(Dt){if(typeof Dt==="string"){if(this.globalFrameworkMap.has(Dt)){return this.globalFrameworkMap.get(Dt).getApplication()}}else{if(this.globalFrameworkTypeMap.has(Dt)){return this.globalFrameworkTypeMap.get(Dt).getApplication()}}}getApplications(Dt){if(!Dt){return Array.from(this.globalFrameworkMap.values()).map((Dt=>Dt.getApplication())).filter((Dt=>!!Dt))}else{return Dt.map((Dt=>this.getApplication(Dt))).filter((Dt=>!!Dt))}}};cr=Wn([(0,rr.Provide)(),(0,rr.Scope)(Gn.ScopeEnum.Singleton)],cr);Lt.MidwayApplicationManager=cr},75351:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.NoopContextManager=Lt.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(Dt){const Lt=this;Lt._currentContext=Dt?new Map(Dt):new Map;Lt.getValue=Dt=>Lt._currentContext.get(Dt);Lt.setValue=(Dt,Tn)=>{const Wn=new AsyncBaseContext(Lt._currentContext);Wn._currentContext.set(Dt,Tn);return Wn};Lt.deleteValue=Dt=>{const Tn=new AsyncBaseContext(Lt._currentContext);Tn._currentContext.delete(Dt);return Tn}}}Lt.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return Lt.ASYNC_ROOT_CONTEXT}with(Dt,Lt,Tn,...Wn){return Lt.call(Tn,...Wn)}bind(Dt,Lt){return Lt}enable(){return this}disable(){return this}}Lt.NoopContextManager=NoopContextManager},46673:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DataListener=void 0;const rr=Tn(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(Dt){this.innerData=Dt}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],DataListener.prototype,"init",null);Wn([(0,rr.Destroy)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],DataListener.prototype,"stop",null);Lt.DataListener=DataListener},12849:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.globModels=Lt.formatGlobString=Lt.DataSourceManager=void 0;const rr=Tn(83486);const cr=Tn(86314);const pr=Tn(62525);const mr=Tn(16928);const gr=Tn(63289);const yr=Tn(2222);const Sr=Tn(39023);const Er=Tn(65308);const Or=Tn(49757);const Ir=Tn(70275);const Hr=Tn(78842);const Gr=Tn(67934);const $r=(0,Sr.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(Dt,Lt){var Tn,Wn;this.options=Dt;if(!this.options.dataSource){throw new cr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof Lt==="string"){Lt={baseDir:Lt,entitiesConfigKey:"entities"}}const Gn=Lt;const rr=(Wn=(Tn=this.configService)===null||Tn===void 0?void 0:Tn.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&Wn!==void 0?Wn:false;const processDataSource=async Lt=>{var Tn;const Wn=Dt.dataSource[Lt];const rr=Wn[Gn.entitiesConfigKey];if(rr){const Dt=new Set;for(const Wn of rr){if(typeof Wn==="string"){const rr=await globModels(Wn,Gn.baseDir,(Tn=this.environmentService)===null||Tn===void 0?void 0:Tn.getModuleLoadType());for(const Tn of rr){Dt.add(Tn);this.modelMapping.set(Tn,Lt)}}else{Dt.add(Wn);this.modelMapping.set(Wn,Lt)}}Wn[Gn.entitiesConfigKey]=Array.from(Dt);$r(`[core]: DataManager load ${Wn[Gn.entitiesConfigKey].length} models from ${Lt}.`)}const cr={cacheInstance:Dt.cacheInstance,validateConnection:Dt.validateConnection};await this.createInstance(Wn,Lt,cr)};const pr=Object.keys(Dt.dataSource);if(rr){await Promise.all(pr.map(processDataSource))}else{for(const Dt of pr){await processDataSource(Dt)}}}getDataSource(Dt){return this.dataSource.get(Dt)}hasDataSource(Dt){return this.dataSource.has(Dt)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(Dt){const Lt=this.getDataSource(Dt);return Lt?this.checkConnected(Lt):false}async createInstance(Dt,Lt,Tn){const Wn=Tn&&typeof Tn.cacheInstance==="boolean"?Tn.cacheInstance:true;const Gn=Tn&&Tn.validateConnection||false;const pr=(0,rr.extend)(true,{},this.options["default"],Dt);const mr=await this.createDataSource(pr,Lt);if(Wn&&Lt&&mr){this.dataSource.set(Lt,mr)}if(Gn){if(!mr){throw new cr.MidwayCommonError(`[DataSourceManager] ${Lt} initialization failed.`)}const Dt=await this.checkConnected(mr);if(!Dt){throw new cr.MidwayCommonError(`[DataSourceManager] ${Lt} is not connected.`)}}return mr}getDataSourceNameByModel(Dt){return this.modelMapping.get(Dt)}async stop(){const Dt=Array.from(this.dataSource.values());await Promise.all(Dt.map((Dt=>this.destroyDataSource(Dt))));this.dataSource.clear()}getDefaultDataSourceName(){if(this.innerDefaultDataSourceName===undefined){if(this.options["defaultDataSourceName"]){this.innerDefaultDataSourceName=this.options["defaultDataSourceName"]}else if(this.dataSource.size===1){this.innerDefaultDataSourceName=Array.from(this.dataSource.keys())[0]}else{this.innerDefaultDataSourceName=""}}return this.innerDefaultDataSourceName}getDataSourcePriority(Dt){return this.priorityManager.getPriority(this.dataSourcePriority[Dt])}isHighPriority(Dt){return this.priorityManager.isHighPriority(this.dataSourcePriority[Dt])}isMediumPriority(Dt){return this.priorityManager.isMediumPriority(this.dataSourcePriority[Dt])}isLowPriority(Dt){return this.priorityManager.isLowPriority(this.dataSourcePriority[Dt])}}Wn([(0,Or.Inject)(),Gn("design:type",String)],DataSourceManager.prototype,"appDir",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Ir.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Hr.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);Wn([(0,Or.Inject)(),Gn("design:type",Gr.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);Lt.DataSourceManager=DataSourceManager;function formatGlobString(Dt){let Lt;if(!/^\*/.test(Dt)){Dt="/"+Dt}const Tn=(0,mr.parse)(Dt);if(Tn.base&&(/\*/.test(Tn.base)||Tn.ext)){Lt=[Dt]}else{Lt=[...yr.DEFAULT_PATTERN.map((Lt=>(0,mr.join)(Dt,Lt)))]}return Lt}Lt.formatGlobString=formatGlobString;async function globModels(Dt,Lt,Tn){const Wn=formatGlobString(Dt);const Gn=[];const rr=(0,pr.run)(Wn,{cwd:Lt,ignore:yr.IGNORE_PATTERN});for(const Dt of rr){const Lt=await(0,Er.loadModule)(Dt,{loadMode:Tn});if(gr.Types.isClass(Lt)){Gn.push(Lt)}else{for(const Dt in Lt){const Tn=Lt[Dt];if(gr.Types.isClass(Tn)){Gn.push(Tn)}}}}return Gn}Lt.globModels=globModels},1845:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.CustomModuleDetector=Lt.ESModuleFileDetector=Lt.CommonJSFileDetector=Lt.AbstractFileDetector=void 0;const Wn=Tn(63289);const Gn=Tn(62525);const rr=Tn(86314);const cr=Tn(2222);const pr=Tn(49757);const mr=Tn(65308);class AbstractFileDetector{constructor(Dt){this.options=Dt;this.extraDetectorOptions={}}setExtraDetectorOptions(Dt){this.extraDetectorOptions=Dt}}Lt.AbstractFileDetector=AbstractFileDetector;const gr=["**/**.tsx"].concat(cr.DEFAULT_PATTERN);const yr=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(cr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(Dt){if(this.getType()==="commonjs"){return this.loadSync(Dt)}else{return this.loadAsync(Dt)}}loadSync(Dt){var Lt;this.options=this.options||{};const Tn=[].concat((Lt=this.options.loadDir)!==null&&Lt!==void 0?Lt:Dt.get("baseDir"));for(const Lt of Tn){const Tn=(0,Gn.run)(gr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Lt,ignore:yr.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(Dt,Lt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&Wn.Types.isClass(Dt)){const Tn=(0,pr.getProviderName)(Dt);if(Tn){if(this.duplicateModuleCheckSet.has(Tn)){throw new rr.MidwayDuplicateClassNameError(Tn,Lt.srcPath,this.duplicateModuleCheckSet.get(Tn))}else{this.duplicateModuleCheckSet.set(Tn,Lt.srcPath)}}}};for(const Lt of Tn){const Tn=require(Lt);Dt.bindClass(Tn,{namespace:this.options.namespace,srcPath:Lt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(Dt){var Lt;this.options=this.options||{};const Tn=[].concat((Lt=this.options.loadDir)!==null&&Lt!==void 0?Lt:Dt.get("baseDir"));for(const Lt of Tn){const Tn=(0,Gn.run)(gr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:Lt,ignore:yr.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(Dt,Lt)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&Wn.Types.isClass(Dt)){const Tn=(0,pr.getProviderName)(Dt);if(Tn){if(this.duplicateModuleCheckSet.has(Tn)){throw new rr.MidwayDuplicateClassNameError(Tn,Lt.srcPath,this.duplicateModuleCheckSet.get(Tn))}else{this.duplicateModuleCheckSet.set(Tn,Lt.srcPath)}}}};for(const Lt of Tn){const Tn=await(0,mr.loadModule)(Lt,{loadMode:"esm"});Dt.bindClass(Tn,{namespace:this.options.namespace,srcPath:Lt,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}Lt.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}Lt.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(Dt){for(const Lt of this.options.modules){Dt.bindClass(Lt,{namespace:this.options.namespace,createFrom:"module"})}}}Lt.CustomModuleDetector=CustomModuleDetector},39408:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FilterManager=void 0;const Wn=Tn(49757);const Gn=Tn(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(Dt){if(!Array.isArray(Dt)){Dt=[Dt]}for(const Lt of Dt){if((0,Wn.getClassMetadata)(Wn.CATCH_KEY,Lt)){this.errFilterList.push(Lt)}if((0,Wn.getClassMetadata)(Wn.MATCH_KEY,Lt)){this.successFilterList.push(Lt)}}}async init(Dt){for(const Lt of this.errFilterList){const Tn=await Dt.getAsync(Lt);const Gn=(0,Wn.getClassMetadata)(Wn.CATCH_KEY,Lt);if(Gn&&Gn.catchTargets){Gn.catchOptions=Gn.catchOptions||{};for(const Dt of Gn.catchTargets){this.exceptionMap.set(Dt,{filter:Tn,catchOptions:Gn.catchOptions});if(Gn.catchOptions["matchPrototype"]){this.protoMatchList.push((Lt=>{if(Lt instanceof Dt){return Dt}else{return false}}))}}}else{this.defaultErrFilter=Tn}}for(const Lt of this.successFilterList){const Tn=await Dt.getAsync(Lt);const rr=(0,Wn.getClassMetadata)(Wn.MATCH_KEY,Lt);if(rr&&rr.matchPattern){this.matchFnList.push({matchFn:(0,Gn.toPathMatch)(rr.matchPattern),target:Tn})}}}async runErrorFilter(Dt,Lt,Tn,Wn){let Gn,rr;let cr=false;if(Dt&&this.exceptionMap.has(Dt.constructor)){cr=true;const rr=this.exceptionMap.get(Dt.constructor);Gn=await rr.filter.catch(Dt,Lt,Tn,Wn)}if(!cr&&this.protoMatchList.length){let rr;for(const Lt of this.protoMatchList){rr=Lt(Dt);if(rr){break}}if(rr){cr=true;const pr=this.exceptionMap.get(rr);Gn=await pr.filter.catch(Dt,Lt,Tn,Wn)}}if(!cr&&this.defaultErrFilter){cr=true;Gn=await this.defaultErrFilter.catch(Dt,Lt,Tn,Wn)}if(!cr){rr=Dt}return{result:Gn,error:rr}}async runResultFilter(Dt,Lt,Tn,Wn){let Gn=Dt;for(const Dt of this.matchFnList){if(Dt.matchFn(Lt,Tn)){Gn=await Dt.target.match(Gn,Lt,Tn,Wn)}}return{result:Gn,error:undefined}}}Lt.FilterManager=FilterManager},40581:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.GuardManager=void 0;const Wn=Tn(49757);class GuardManager extends Array{addGlobalGuard(Dt){if(!Array.isArray(Dt)){this.push(Dt)}else{this.push(...Dt)}}async runGuard(Dt,Lt,Tn){for(const Wn of this){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}const Gn=(0,Wn.getClassMetadata)(Wn.GUARD_KEY,Lt);if(Gn){for(const Wn of Gn){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}}const rr=(0,Wn.getPropertyMetadata)(Wn.GUARD_KEY,Lt,Tn);if(rr){for(const Wn of rr){const Gn=await Dt.requestContext.getAsync(Wn);const rr=await Gn.canActivate(Dt,Lt,Tn);if(!rr){return false}}}return true}}Lt.GuardManager=GuardManager},82535:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DefaultConsoleLoggerFactory=Lt.LoggerFactory=void 0;class LoggerFactory{}Lt.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(Dt,Lt){this.instance.set(Dt,console);return console}getLogger(Dt){return this.instance.get(Dt)}close(Dt){}removeLogger(Dt){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(Dt,Lt,Tn){return Lt}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}Lt.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createMiddleware=Lt.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(Dt){if(Array.isArray(Dt)){this.unshift(...Dt)}else{this.unshift(Dt)}}insertLast(Dt){if(Array.isArray(Dt)){this.push(...Dt)}else{this.push(Dt)}}insertBefore(Dt,Lt){if(typeof Lt!=="number"){Lt=this.findItemIndex(Lt)}if(Array.isArray(Dt)){this.splice(Lt,0,...Dt)}else{this.splice(Lt,0,Dt)}}insertAfter(Dt,Lt){if(typeof Lt!=="number"){Lt=this.findItemIndex(Lt)}if(Array.isArray(Dt)){this.splice(Lt+1,0,...Dt)}else{this.splice(Lt+1,0,Dt)}}findAndInsertAfter(Dt,Lt){Dt=this.findItem(Dt);Lt=this.findItem(Lt);if(!Dt||!Lt||Dt===Lt){return}if(Lt){const Tn=this.remove(Dt);if(Tn){this.insertAfter(Tn,Lt)}}}findAndInsertBefore(Dt,Lt){Dt=this.findItem(Dt);Lt=this.findItem(Lt);if(!Dt||!Lt||Dt===Lt){return}if(Lt){const Tn=this.remove(Dt);if(Tn){this.insertBefore(Tn,Lt)}}}findAndInsertFirst(Dt){const Lt=this.remove(Dt);if(Lt){this.insertFirst(Lt)}}findAndInsertLast(Dt){const Lt=this.remove(Dt);if(Lt){this.insertLast(Lt)}}findItemIndex(Dt){if(typeof Dt==="number"){return Dt}else if(typeof Dt==="string"){return this.findIndex((Lt=>this.getMiddlewareName(Lt)===Dt))}else{return this.findIndex((Lt=>Lt===Dt))}}findItem(Dt){if(typeof Dt==="number"){if(Dt>=0&&Dt<=this.length-1){return this[Dt]}}else if(typeof Dt==="string"){return this.find((Lt=>this.getMiddlewareName(Lt)===Dt))}else{return Dt}}getMiddlewareName(Dt){var Lt,Tn,Wn;if(Dt["middleware"]){return(Lt=Dt.name)!==null&&Lt!==void 0?Lt:this.getMiddlewareName(Dt["middleware"])}return(Wn=(Tn=Dt.getName&&Dt.getName())!==null&&Tn!==void 0?Tn:Dt._name)!==null&&Wn!==void 0?Wn:Dt.name}remove(Dt){if(typeof Dt==="number"&&Dt!==-1){return this.splice(Dt,1)[0]}else{const Lt=this.findItemIndex(Dt);if(Lt!==-1){return this.splice(Lt,1)[0]}}}push(...Dt){Dt.forEach((Dt=>{if(typeof Dt!=="string"&&!this.getMiddlewareName(Dt)){Dt._name="anonymous"}}));return super.push(...Dt)}unshift(...Dt){Dt.forEach((Dt=>{if(typeof Dt!=="string"&&!this.getMiddlewareName(Dt)){Dt._name="anonymous"}}));return super.unshift(...Dt)}getNames(){return this.map((Dt=>this.getMiddlewareName(Dt)))}}Lt.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(Dt,Lt,Tn){return{middleware:Dt,options:Lt,name:Tn}}Lt.createMiddleware=createMiddleware},70032:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayInitializerPerformanceManager=Lt.MidwayPerformanceManager=void 0;const Wn=Tn(82987);class MidwayPerformanceManager{constructor(Dt){this.group=Dt;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(Dt){if(!this.instances.has(Dt)){this.instances.set(Dt,new MidwayPerformanceManager(Dt))}return this.instances.get(Dt)}formatKey(Dt,Lt){return`${this.group}:${Dt}-${Lt}`}markStart(Dt){const Lt=this.formatKey(Dt,"start");Wn.performance.mark(Lt);this.marks.add(Lt)}markEnd(Dt){const Lt=this.formatKey(Dt,"start");const Tn=this.formatKey(Dt,"end");const Gn=`${this.group}:${Dt}`;Wn.performance.mark(Tn);this.marks.add(Tn);Wn.performance.measure(Gn,Lt,Tn);this.measures.add(Gn)}observeMeasure(Dt){if(this.observer){return}this.observer=new Wn.PerformanceObserver((Lt=>{const Tn=Lt.getEntries().filter((Dt=>Dt.name.startsWith(`${this.group}:`)));if(Tn.length>0){Dt({getEntries:()=>Tn})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((Dt=>{try{Wn.performance.clearMarks(Dt)}catch(Lt){console.warn(`Failed to clear mark ${Dt}: ${Lt}`)}}));this.marks.clear();this.measures.forEach((Dt=>{try{Wn.performance.clearMeasures(Dt)}catch(Lt){console.warn(`Failed to clear measure ${Dt}: ${Lt}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((Dt=>Dt.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const Dt=[];Wn.performance===null||Wn.performance===void 0?void 0:Wn.performance.getEntries().forEach((Lt=>{if(Lt.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){Dt.push(Lt.toJSON())}}));return Dt}}Lt.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(Dt){const Lt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Lt.markStart(Dt)}static markEnd(Dt){const Lt=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);Lt.markEnd(Dt)}static frameworkInitializeStart(Dt){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Dt}`)}static frameworkInitializeEnd(Dt){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${Dt}`)}static frameworkRunStart(Dt){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Dt}`)}static frameworkRunEnd(Dt){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${Dt}`)}static lifecycleStart(Dt,Lt){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Dt}:${Lt}`)}static lifecycleEnd(Dt,Lt){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${Dt}:${Lt}`)}}Lt.MidwayInitializerPerformanceManager=MidwayInitializerPerformanceManager;MidwayInitializerPerformanceManager.MEASURE_KEYS={INITIALIZE:"Initialize",METADATA_PREPARE:"MetadataPrepare",DETECTOR_PREPARE:"DetectorPrepare",DEFINITION_PREPARE:"DefinitionPrepare",CONFIG_LOAD:"ConfigLoad",LOGGER_PREPARE:"LoggerPrepare",FRAMEWORK_PREPARE:"FrameworkPrepare",FRAMEWORK_INITIALIZE:"FrameworkInitialize",FRAMEWORK_RUN:"FrameworkRun",LIFECYCLE_PREPARE:"LifecyclePrepare",PRELOAD_MODULE_PREPARE:"PreloadModulePrepare"}},67934:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPriorityManager=Lt.DEFAULT_PRIORITY=void 0;const Gn=Tn(49757);const rr=Tn(6192);Lt.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let cr=class MidwayPriorityManager{constructor(){this.priorityList=Lt.DEFAULT_PRIORITY;this.defaultPriority=Lt.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L1}isMediumPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L2}isLowPriority(Dt=Lt.DEFAULT_PRIORITY.L2){return Dt===Lt.DEFAULT_PRIORITY.L3}getPriority(Dt){return Dt||this.getDefaultPriority()}};cr=Wn([(0,Gn.Provide)(),(0,Gn.Scope)(rr.ScopeEnum.Singleton)],cr);Lt.MidwayPriorityManager=cr},64842:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServiceFactory=void 0;const rr=Tn(83486);const cr=Tn(67934);const pr=Tn(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(Dt={}){this.options=Dt;if(Dt.client){Dt.clients=Dt.clients||{};Dt.clients["default"]=Dt.clients["default"]||{};(0,rr.extend)(true,Dt.clients["default"],Dt.client)}if(Dt.clients){for(const Lt of Object.keys(Dt.clients)){await this.createInstance(Dt.clients[Lt],Lt)}}this.clientPriority=Dt.priority||{}}get(Dt="default"){return this.clients.get(Dt)}has(Dt){return this.clients.has(Dt)}async createInstance(Dt,Lt){Dt=(0,rr.extend)(true,{},this.options["default"],Dt);const Tn=await this.createClient(Dt,Lt);if(Tn){if(Lt){this.clients.set(Lt,Tn)}return Tn}}async destroyClient(Dt,Lt){}async stop(){for(const[Dt,Lt]of this.clients.entries()){await this.destroyClient(Lt,Dt)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(Dt){return this.priorityManager.getPriority(this.clientPriority[Dt])}isHighPriority(Dt){return this.priorityManager.isHighPriority(this.clientPriority[Dt])}isMediumPriority(Dt){return this.priorityManager.isMediumPriority(this.clientPriority[Dt])}isLowPriority(Dt){return this.priorityManager.isLowPriority(this.clientPriority[Dt])}}Wn([(0,pr.Inject)(),Gn("design:type",cr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);Lt.ServiceFactory=ServiceFactory},11330:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TypedResourceManager=void 0;class TypedResourceManager{constructor(Dt){this.typedResourceInitializerOptions=Dt;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(Dt,Lt){const Tn=await this.typedResourceInitializerOptions.resourceInitialize(Lt,Dt);this.resourceMap.set(Dt,Tn);return Tn}async init(){for(const Dt of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const Lt=this.typedResourceInitializerOptions.initializeValue[Dt];const Tn=this.typedResourceInitializerOptions.initializeClzProvider[Dt];const Wn=await this.createResource(Dt,Lt);const Gn=await this.typedResourceInitializerOptions.resourceBinding(Tn,Lt,Wn,Dt);if(Gn){this.resourceBindingMap.set(Dt,Gn)}}}async startParallel(){const Dt=[];for(const[Lt,Tn]of this.resourceMap.entries()){Dt.push(this.typedResourceInitializerOptions.resourceStart(Tn,this.typedResourceInitializerOptions.initializeValue[Lt],this.resourceBindingMap.get(Lt)))}await Promise.all(Dt)}async start(){for(const[Dt,Lt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(Lt,this.typedResourceInitializerOptions.initializeValue[Dt],this.resourceBindingMap.get(Dt))}}async destroyParallel(){const Dt=[];for(const[Lt,Tn]of this.resourceMap.entries()){Dt.push(this.typedResourceInitializerOptions.resourceDestroy(Tn,this.typedResourceInitializerOptions.initializeValue[Lt]))}await Promise.all(Dt)}async destroy(){for(const[Dt,Lt]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(Lt,this.typedResourceInitializerOptions.initializeValue[Dt])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(Dt){return this.resourceMap.get(Dt)}}Lt.TypedResourceManager=TypedResourceManager},11026:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.WebControllerGenerator=void 0;const Wn=Tn(49757);const Gn=Tn(39023);const rr=Tn(6192);const cr=Tn(86314);const pr=Tn(68220);const mr=Gn.debuglog("midway:debug");class WebControllerGenerator{constructor(Dt,Lt){this.app=Dt;this.midwayWebRouterService=Lt}generateKoaController(Dt){return async(Lt,Tn)=>{if(Dt.controllerClz&&typeof Dt.method==="string"){const Tn=await this.app.getFramework().runGuard(Lt,Dt.controllerClz,Dt.method);if(!Tn){throw new cr.httpError.ForbiddenError}}const Gn=[Lt,Tn];let rr;if(typeof Dt.method!=="string"){rr=await Dt.method(Lt,Tn)}else{const Tn=await Lt.requestContext.getAsync(Dt.id);rr=await Tn[Dt.method].apply(Tn,Gn)}if(rr!==undefined){if(rr===null){Lt.response._body=null;Lt.response._midwayControllerNullBody=true}else{Lt.body=rr}}if(Array.isArray(Dt.responseMetadata)&&Dt.responseMetadata.length){for(const Tn of Dt.responseMetadata){switch(Tn.type){case Wn.WEB_RESPONSE_HTTP_CODE:Lt.status=Tn.code;break;case Wn.WEB_RESPONSE_HEADER:for(const Dt in(Tn===null||Tn===void 0?void 0:Tn.setHeaders)||{}){Lt.set(Dt,Tn.setHeaders[Dt])}break;case Wn.WEB_RESPONSE_CONTENT_TYPE:Lt.type=Tn.contentType;break;case Wn.WEB_RESPONSE_REDIRECT:Lt.status=Tn.code;Lt.redirect(Tn.url);return}}}}}async loadMidwayController(Dt){var Lt,Tn;const Wn=await this.midwayWebRouterService.getRouterTable();const Gn=await this.midwayWebRouterService.getRoutePriorityList();const cr=this.app.getApplicationContext();const gr=this.app.getCoreLogger();const yr=cr.get(pr.MidwayMiddlewareService);for(const pr of Gn){cr.bindClass(pr.routerModule);gr.debug(`Load Controller "${pr.controllerId}", prefix=${pr.prefix}`);mr(`[core]: Load Controller "${pr.controllerId}", prefix=${pr.prefix}`);const Gn=this.createRouter({prefix:pr.prefix,...pr.routerOptions});pr.middleware=(Lt=pr.middleware)!==null&&Lt!==void 0?Lt:[];if(pr.middleware.length){const Dt=await yr.compose(pr.middleware,this.app);Gn.use(Dt)}const Sr=Wn.get(pr.prefix);for(const Dt of Sr){const Lt=[];Dt.middleware=(Tn=Dt.middleware)!==null&&Tn!==void 0?Tn:[];if(Dt.middleware.length){const Tn=await yr.compose(Dt.middleware,this.app);Lt.push(Tn)}if(this.app.getFrameworkType()===rr.MidwayFrameworkType.WEB_KOA){if(typeof Dt.url==="string"&&/\*$/.test(Dt.url)){Dt.url=Dt.url.replace("*","(.*)")}}const Wn=[Dt.routerName,Dt.url,...Lt,this.generateController(Dt)];gr.debug(`Load Router "${Dt.requestMethod.toUpperCase()} ${Dt.url}"`);mr(`[core]: Load Router "${Dt.requestMethod.toUpperCase()} ${Dt.url}"`);Gn[Dt.requestMethod.toLowerCase()].apply(Gn,Wn)}Dt&&Dt(Gn)}}}Lt.WebControllerGenerator=WebControllerGenerator},42193:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});const Wn=Tn(65308);Lt["default"]=Dt=>{const Lt=(0,Wn.isDevelopmentEnvironment)((0,Wn.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:Lt?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:Lt}}}},2222:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.SINGLETON_CONTAINER_CTX=Lt.IGNORE_PATTERN=Lt.DEFAULT_PATTERN=Lt.ASYNC_CONTEXT_MANAGER_KEY=Lt.ASYNC_CONTEXT_KEY=Lt.REQUEST_CTX_LOGGER_CACHE_KEY=Lt.HTTP_SERVER_KEY=Lt.CONTAINER_OBJ_SCOPE=Lt.REQUEST_OBJ_CTX_KEY=Lt.REQUEST_CTX_KEY=Lt.MIDWAY_LOGGER_WRITEABLE_DIR=Lt.FUNCTION_INJECT_KEY=Lt.KEYS=void 0;Lt.KEYS={OBJECTS_ELEMENT:"objects",OBJECT_ELEMENT:"object",IMPORT_ELEMENT:"import",PROPERTY_ELEMENT:"property",LIST_ELEMENT:"list",MAP_ELEMENT:"map",ENTRY_ELEMENT:"entry",VALUE_ELEMENT:"value",PROPS_ELEMENT:"props",PROP_ELEMENT:"prop",SET_ELEMENT:"set",CONSTRUCTOR_ARG_ELEMENT:"constructor-arg",REF_ELEMENT:"ref",JSON_ELEMENT:"json",CONFIGURATION_ELEMENT:"configuration",ID_ATTRIBUTE:"id",PATH_ATTRIBUTE:"path",DIRECT_ATTRIBUTE:"direct",AUTOWIRE_ATTRIBUTE:"autowire",ASYNC_ATTRIBUTE:"async",NAME_ATTRIBUTE:"name",REF_ATTRIBUTE:"ref",KEY_ATTRIBUTE:"key",VALUE_ATTRIBUTE:"value",TYPE_ATTRIBUTE:"type",EXTERNAL_ATTRIBUTE:"external",OBJECT_ATTRIBUTE:"object",RESOURCE_ATTRIBUTE:"resource",SCOPE_ATTRIBUTE:"scope",ASPECT_ELEMENT:"aspect",AROUND_ELEMENT:"around",EXPRESSION_ATTRIBUTE:"expression",EXECUTE_ATTRIBUTE:"execute"};Lt.FUNCTION_INJECT_KEY="midway:function_inject_key";Lt.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";Lt.REQUEST_CTX_KEY="ctx";Lt.REQUEST_OBJ_CTX_KEY="_req_ctx";Lt.CONTAINER_OBJ_SCOPE="_obj_scope";Lt.HTTP_SERVER_KEY="_midway_http_server";Lt.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";Lt.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");Lt.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";Lt.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];Lt.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];Lt.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayContainer=void 0;const Wn=Tn(49757);const Gn=Tn(24451);const rr=Tn(39023);const cr=Tn(20873);const pr=Tn(6192);const mr=Tn(2222);const gr=Tn(47698);const yr=Tn(34881);const Sr=Tn(80932);const Er=Tn(70275);const Or=Tn(78842);const Ir=Tn(24434);const Hr=Tn(86314);const Gr=Tn(63289);const $r=Tn(65308);const mi=rr.debuglog("midway:debug");const ki=rr.debuglog("midway:bind");const Ni=9;class ContainerConfiguration{constructor(Dt){this.container=Dt;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(Dt){let Lt=Wn.MAIN_MODULE_KEY;const Tn=this.getConfigurationExport(Dt);if(!Tn.length)return;for(let Dt=0;Dt<Tn.length;Dt++){const rr=Tn[Dt];if(this.loadedMap.get(rr)){continue}let cr;if(rr instanceof Gn.FunctionalConfiguration){cr=rr.getConfigurationOptions()}else{cr=(0,Wn.getClassMetadata)(Wn.CONFIGURATION_KEY,rr)}this.loadedMap.set(rr,true);if(cr){if(cr.namespace!==undefined){Lt=cr.namespace;this.namespaceList.push(Lt)}this.configurationOptionsList.push(cr);mi(`[core]: load configuration in namespace="${Lt}"`);this.addImports(cr.imports);this.addImportObjects(cr.importObjects);this.addImportConfigs(cr.importConfigs);this.addImportConfigFilter(cr.importConfigFilter);this.bindConfigurationClass(rr,Lt)}}this.container.bindClass(Dt,{namespace:Lt})}addImportConfigs(Dt){if(Dt){if(Array.isArray(Dt)){this.container.get(Or.MidwayConfigService).add(Dt)}else{this.container.get(Or.MidwayConfigService).addObject(Dt)}}}addImportConfigFilter(Dt){if(Dt){this.container.get(Or.MidwayConfigService).addFilter(Dt)}}addImports(Dt=[]){var Lt;for(let Tn of Dt){if(!Tn)continue;if(typeof Tn==="string"){Tn=require(Tn)}if("Configuration"in Tn){this.load(Tn)}else if("component"in Tn){if(Tn===null||Tn===void 0?void 0:Tn.enabledEnvironment){if((Lt=Tn===null||Tn===void 0?void 0:Tn.enabledEnvironment)===null||Lt===void 0?void 0:Lt.includes(this.container.get(Er.MidwayEnvironmentService).getCurrentEnvironment())){this.load(Tn.component)}}else{this.load(Tn.component)}}else{this.load(Tn)}}}addImportObjects(Dt){if(Dt){const Lt=Object.keys(Dt);for(const Tn of Lt){if(typeof Dt[Tn]!==undefined){this.container.registerObject(Tn,Dt[Tn])}}}}bindConfigurationClass(Dt,Lt){if(Dt instanceof Gn.FunctionalConfiguration){}else{(0,Wn.saveProviderId)(undefined,Dt);const Tn=(0,Wn.getProviderUUId)(Dt);this.container.bind(Tn,Dt,{namespace:Lt,scope:pr.ScopeEnum.Singleton})}const Tn=(0,Wn.listModule)(Wn.CONFIGURATION_KEY);const rr=Tn.find((Lt=>Lt.target===Dt));if(!rr){(0,Wn.saveModule)(Wn.CONFIGURATION_KEY,{target:Dt,namespace:Lt})}}getConfigurationExport(Dt){const Lt=[];if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)||Dt instanceof Gn.FunctionalConfiguration){Lt.push(Dt)}else{for(const Tn in Dt){const Wn=Dt[Tn];if(Gr.Types.isClass(Wn)||Gr.Types.isFunction(Wn)||Wn instanceof Gn.FunctionalConfiguration){Lt.push(Wn)}}}return Lt}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(Dt){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=mr.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=Dt;this.init()}init(){this.registerObject(mr.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Ir}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new cr.ObjectDefinitionRegistry}return this._registry}set registry(Dt){this._registry=Dt}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Sr.ManagedResolverFactory(this)}return this._resolverFactory}get identifierMapping(){if(!this._identifierMapping){this._identifierMapping=this.registry.getIdentifierRelation()}return this._identifierMapping}get namespaceSet(){if(!this._namespaceSet){this._namespaceSet=new Set}return this._namespaceSet}load(Dt){var Lt,Tn,Wn;if(!Array.isArray(Dt)){Dt=[Dt]}const Gn=new ContainerConfiguration(this);for(const Lt of Dt){if(Lt){Gn.load(Lt)}}for(const Dt of Gn.getNamespaceList()){this.namespaceSet.add(Dt);mi(`[core]: load configuration in namespace="${Dt}" complete`)}const rr=(Lt=Gn.getConfigurationOptionsList())!==null&&Lt!==void 0?Lt:[];const cr=(Tn=rr.find((Dt=>!Dt.namespace)))!==null&&Tn!==void 0?Tn:{};this.fileDetector=(Wn=cr.detector)!==null&&Wn!==void 0?Wn:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:cr.conflictCheck,...cr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(Dt,Lt){if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)){this.bindModule(Dt,Lt)}else{for(const Tn in Dt){const Wn=Dt[Tn];if(Gr.Types.isClass(Wn)||Gr.Types.isFunction(Wn)){this.bindModule(Wn,Lt)}}}}bind(Dt,Lt,Tn){var Gn;if(Gr.Types.isClass(Dt)||Gr.Types.isFunction(Dt)){return this.bindModule(Dt,Lt)}if(this.registry.hasDefinition(Dt)){return}if(Tn===null||Tn===void 0?void 0:Tn.bindHook){Tn.bindHook(Lt,Tn)}let rr;if(Gr.Types.isClass(Lt)){rr=new gr.ObjectDefinition;rr.name=(0,Wn.getProviderName)(Lt)}else{rr=new yr.FunctionDefinition;if(!Gr.Types.isAsyncFunction(Lt)){rr.asynchronous=false}rr.name=rr.id}rr.path=Lt;rr.id=Dt;rr.srcPath=(Tn===null||Tn===void 0?void 0:Tn.srcPath)||null;rr.namespace=(Tn===null||Tn===void 0?void 0:Tn.namespace)||"";rr.scope=(Tn===null||Tn===void 0?void 0:Tn.scope)||pr.ScopeEnum.Request;rr.createFrom=Tn===null||Tn===void 0?void 0:Tn.createFrom;if(rr.srcPath){mi(`[core]: bind id "${rr.name} (${rr.srcPath}) ${Dt}"`)}else{mi(`[core]: bind id "${rr.name}" ${Dt}`)}const cr=(0,Wn.getPropertyInject)(Lt);for(const Dt in cr){const Lt=cr[Dt];ki(`${" ".repeat(Ni)}inject properties => [${JSON.stringify(Lt)}]`);const Tn=new Sr.ManagedReference;Tn.args=Lt.args;Tn.name=Lt.value;Tn.injectMode=Lt["injectMode"];rr.properties.set(Lt["targetKey"],Tn)}const mr=(0,Wn.getClassExtendedMetadata)(Wn.INJECT_CUSTOM_PROPERTY,Lt);for(const Dt in mr){const Lt=mr[Dt];rr.handlerProps.push(Lt)}const Er=(Gn=(0,Wn.getObjectDefinition)(Lt))!==null&&Gn!==void 0?Gn:{};if(Er.initMethod){ki(`${" ".repeat(Ni)}register initMethod = ${Er.initMethod}`);rr.initMethod=Er.initMethod}if(Er.destroyMethod){ki(`${" ".repeat(Ni)}register destroyMethod = ${Er.destroyMethod}`);rr.destroyMethod=Er.destroyMethod}if(Er.scope){ki(`${" ".repeat(Ni)}register scope = ${Er.scope}`);rr.scope=Er.scope}if(Er.allowDowngrade){ki(`${" ".repeat(Ni)}register allowDowngrade = ${Er.allowDowngrade}`);rr.allowDowngrade=Er.allowDowngrade}this.objectCreateEventTarget.emit(pr.ObjectLifeCycleEvent.BEFORE_BIND,Lt,{context:this,definition:rr,replaceCallback:Dt=>{rr=Dt}});if(rr){this.registry.registerDefinition(rr.id,rr)}}bindModule(Dt,Lt){if(Gr.Types.isClass(Dt)){const Tn=(0,Wn.getProviderUUId)(Dt);if(Tn){this.identifierMapping.saveClassRelation(Dt,Lt===null||Lt===void 0?void 0:Lt.namespace);this.bind(Tn,Dt,Lt)}else{}}else{const Tn=Dt[mr.FUNCTION_INJECT_KEY];if(Tn&&Tn.id){if(!Tn.scope){Tn.scope=pr.ScopeEnum.Request}const Wn=$r.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(Tn.id,Wn);this.bind(Wn,Dt,{scope:Tn.scope,namespace:Lt.namespace,srcPath:Lt.srcPath,createFrom:Lt.createFrom})}}}setFileDetector(Dt){this.fileDetector=Dt}createChild(){return new MidwayContainer(this)}setAttr(Dt,Lt){this.attrMap.set(Dt,Lt)}getAttr(Dt){return this.attrMap.get(Dt)}getIdentifier(Dt){return(0,Wn.getProviderUUId)(Dt)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new Sr.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(Dt,Lt,Tn){var Wn;Lt=Lt!==null&&Lt!==void 0?Lt:[];Tn=Tn!==null&&Tn!==void 0?Tn:{originName:Dt};if(typeof Dt!=="string"){Tn.originName=Dt.name;Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Gn=this.registry.getDefinition(Dt);if(!Gn&&this.parent){return this.parent.get(Dt,Lt)}if(!Gn){throw new Hr.MidwayDefinitionNotFoundError((Wn=Tn===null||Tn===void 0?void 0:Tn.originName)!==null&&Wn!==void 0?Wn:Dt)}return this.getManagedResolverFactory().create({definition:Gn,args:Lt})}async getAsync(Dt,Lt,Tn){var Wn;Lt=Lt!==null&&Lt!==void 0?Lt:[];Tn=Tn!==null&&Tn!==void 0?Tn:{originName:Dt};if(typeof Dt!=="string"){Tn.originName=Dt.name;Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Gn=this.registry.getDefinition(Dt);if(!Gn&&this.parent){return this.parent.getAsync(Dt,Lt)}if(!Gn){throw new Hr.MidwayDefinitionNotFoundError((Wn=Tn===null||Tn===void 0?void 0:Tn.originName)!==null&&Wn!==void 0?Wn:Dt)}return this.getManagedResolverFactory().createAsync({definition:Gn,args:Lt})}registerObject(Dt,Lt){this.registry.registerObject(Dt,Lt)}onBeforeBind(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_BIND,Dt)}onBeforeObjectCreated(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_CREATED,Dt)}onObjectCreated(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.AFTER_CREATED,Dt)}onObjectInit(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.AFTER_INIT,Dt)}onBeforeObjectDestroy(Dt){this.objectCreateEventTarget.on(pr.ObjectLifeCycleEvent.BEFORE_DESTROY,Dt)}saveModule(Dt,Lt){if(!this.moduleMap.has(Dt)){this.moduleMap.set(Dt,new Set)}this.moduleMap.get(Dt).add(Lt)}listModule(Dt){return Array.from(this.moduleMap.get(Dt)||{})}transformModule(Dt){this.moduleMap=new Map(Dt)}hasNamespace(Dt){return this.namespaceSet.has(Dt)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(Dt){return this.registry.hasDefinition(Dt)}hasObject(Dt){return this.registry.hasObject(Dt)}getInstanceScope(Dt){if(Dt[mr.CONTAINER_OBJ_SCOPE]){return Dt[mr.CONTAINER_OBJ_SCOPE]}return undefined}}Lt.MidwayContainer=MidwayContainer},20873:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectDefinitionRegistry=void 0;const Wn=Tn(49757);const Gn="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(Dt,Lt){const Tn=(0,Wn.getProviderUUId)(Dt);this.set(Tn,Tn);if(Tn){const Gn=(0,Wn.getProviderId)(Dt);if(Gn){this.set(Gn,Tn)}this.set((0,Wn.getProviderName)(Dt),Tn);if(Lt){this.set(Lt+":"+(0,Wn.getProviderName)(Dt),Tn)}}}saveFunctionRelation(Dt,Lt){this.set(Lt,Lt);this.set(Dt,Lt)}hasRelation(Dt){return this.has(Dt)}getRelation(Dt){return this.get(Dt)}}class ObjectDefinitionRegistry extends Map{constructor(){super(...arguments);this.singletonIds=[];this._identifierRelation=new LegacyIdentifierRelation}get identifierRelation(){if(!this._identifierRelation){this._identifierRelation=new LegacyIdentifierRelation}return this._identifierRelation}set identifierRelation(Dt){this._identifierRelation=Dt}get identifiers(){const Dt=[];for(const Lt of this.keys()){if(Lt.indexOf(Gn)===-1){Dt.push(Lt)}}return Dt}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(Dt){const Lt=[];for(const Tn of this.values()){const Wn=Tn;if(Wn.name===Dt){Lt.push(Wn)}}return Lt}registerDefinition(Dt,Lt){if(Lt.isSingletonScope()){this.singletonIds.push(Dt)}this.set(Dt,Lt)}getDefinition(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.get(Dt)}removeDefinition(Dt){this.delete(Dt)}hasDefinition(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.has(Dt)}clearAll(){this.singletonIds=[];this.clear()}hasObject(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.has(Gn+Dt)}registerObject(Dt,Lt){this.set(Gn+Dt,Lt)}getObject(Dt){var Lt;Dt=(Lt=this.identifierRelation.getRelation(Dt))!==null&&Lt!==void 0?Lt:Dt;return this.get(Gn+Dt)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(Dt){this.identifierRelation=Dt}}Lt.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ManagedResolverFactory=Lt.ManagedReference=void 0;const Wn=Tn(2222);const Gn=Tn(6192);const rr=Tn(39023);const cr=Tn(86314);const pr=rr.debuglog("midway:managedresolver");const mr=rr.debuglog("midway:debug");class ManagedReference{constructor(){this.type=Wn.KEYS.REF_ELEMENT}}Lt.ManagedReference=ManagedReference;class RefResolver{constructor(Dt){this.factory=Dt}get type(){return Wn.KEYS.REF_ELEMENT}resolve(Dt,Lt){var Tn;const Wn=Dt;if(Wn.injectMode===Gn.InjectModeEnum.Class&&!((Tn=this.factory.context.parent)!==null&&Tn!==void 0?Tn:this.factory.context).hasDefinition(Wn.name)){if(Lt==="loggerService"){throw new cr.MidwayInconsistentVersionError}else{throw new cr.MidwayMissingImportComponentError(Lt)}}return this.factory.context.get(Wn.name,Wn.args,{originName:Lt})}async resolveAsync(Dt,Lt){var Tn;const Wn=Dt;if(Wn.injectMode===Gn.InjectModeEnum.Class&&!((Tn=this.factory.context.parent)!==null&&Tn!==void 0?Tn:this.factory.context).hasDefinition(Wn.name)){if(Lt==="loggerService"){throw new cr.MidwayInconsistentVersionError}else{throw new cr.MidwayMissingImportComponentError(Lt)}}return this.factory.context.getAsync(Wn.name,Wn.args,{originName:Lt})}}class ManagedResolverFactory{constructor(Dt){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=Dt;this.resolvers={ref:new RefResolver(this)}}registerResolver(Dt){this.resolvers[Dt.type]=Dt}resolveManaged(Dt,Lt){const Tn=this.resolvers[Dt.type];if(!Tn||Tn.type!==Dt.type){throw new cr.MidwayResolverMissingError(Dt.type)}return Tn.resolve(Dt,Lt)}async resolveManagedAsync(Dt,Lt){const Tn=this.resolvers[Dt.type];if(!Tn||Tn.type!==Dt.type){throw new cr.MidwayResolverMissingError(Dt.type)}return Tn.resolveAsync(Dt,Lt)}create(Dt){const{definition:Lt,args:Tn}=Dt;if(Lt.isSingletonScope()&&this.singletonCache.has(Lt.id)){return this.singletonCache.get(Lt.id)}let rr=this.createProxyReference(Lt);if(rr){return rr}this.compareAndSetCreateStatus(Lt);if(Lt.hasDependsOn()){for(const Dt of Lt.dependsOn){this.context.get(Dt,Tn)}}mr(`[core]: Create id = "${Lt.name}" ${Lt.id}.`);const pr=Lt.creator.load();let gr=[];if(Tn&&Array.isArray(Tn)&&Tn.length>0){gr=Tn}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_CREATED,pr,{constructorArgs:gr,definition:Lt,context:this.context});rr=Lt.creator.doConstruct(pr,gr,this.context);if(Lt.isRequestScope()&&Lt.constructor.name==="ObjectDefinition"){Object.defineProperty(rr,Wn.REQUEST_OBJ_CTX_KEY,{value:this.context.get(Wn.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Lt.properties){const Dt=Lt.properties.propertyKeys();for(const Tn of Dt){this.checkSingletonInvokeRequest(Lt,Tn);try{rr[Tn]=this.resolveManaged(Lt.properties.get(Tn),Tn)}catch(Dt){if(cr.MidwayDefinitionNotFoundError.isClosePrototypeOf(Dt)){const Tn=Lt.path.name;Dt.updateErrorMsg(Tn)}this.removeCreateStatus(Lt,true);throw Dt}}}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_CREATED,rr,{context:this.context,definition:Lt,replaceCallback:Dt=>{rr=Dt}});Lt.creator.doInit(rr);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_INIT,rr,{context:this.context,definition:Lt});if(Lt.id){if(Lt.isSingletonScope()){this.singletonCache.set(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Singleton)}else if(Lt.isRequestScope()){this.context.registerObject(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Request)}else{this.setInstanceScope(rr,Gn.ScopeEnum.Prototype)}}this.removeCreateStatus(Lt,true);return rr}async createAsync(Dt){const{definition:Lt,args:Tn}=Dt;if(Lt.isSingletonScope()&&this.singletonCache.has(Lt.id)){pr(`id = ${Lt.id}(${Lt.name}) get from singleton cache.`);return this.singletonCache.get(Lt.id)}let rr=this.createProxyReference(Lt);if(rr){pr(`id = ${Lt.id}(${Lt.name}) from proxy reference.`);return rr}this.compareAndSetCreateStatus(Lt);if(Lt.hasDependsOn()){for(const Dt of Lt.dependsOn){pr("id = %s init depend %s.",Lt.id,Dt);await this.context.getAsync(Dt,Tn)}}mr(`[core]: Create id = "${Lt.name}" ${Lt.id}.`);const gr=Lt.creator.load();let yr=[];if(Tn&&Array.isArray(Tn)&&Tn.length>0){yr=Tn}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_CREATED,gr,{constructorArgs:yr,context:this.context});rr=await Lt.creator.doConstructAsync(gr,yr,this.context);if(!rr){this.removeCreateStatus(Lt,false);throw new cr.MidwayCommonError(`${Lt.id} construct return undefined`)}if(Lt.isRequestScope()&&Lt.constructor.name==="ObjectDefinition"){pr("id = %s inject ctx",Lt.id);Object.defineProperty(rr,Wn.REQUEST_OBJ_CTX_KEY,{value:this.context.get(Wn.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(Lt.properties){const Dt=Lt.properties.propertyKeys();for(const Tn of Dt){this.checkSingletonInvokeRequest(Lt,Tn);try{rr[Tn]=await this.resolveManagedAsync(Lt.properties.get(Tn),Tn)}catch(Dt){if(cr.MidwayDefinitionNotFoundError.isClosePrototypeOf(Dt)){const Tn=Lt.path.name;Dt.updateErrorMsg(Tn)}this.removeCreateStatus(Lt,false);throw Dt}}}this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_CREATED,rr,{context:this.context,definition:Lt,replaceCallback:Dt=>{rr=Dt}});await Lt.creator.doInitAsync(rr);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.AFTER_INIT,rr,{context:this.context,definition:Lt});if(Lt.id){if(Lt.isSingletonScope()){pr(`id = ${Lt.id}(${Lt.name}) set to singleton cache`);this.singletonCache.set(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Singleton)}else if(Lt.isRequestScope()){pr(`id = ${Lt.id}(${Lt.name}) set to register object`);this.context.registerObject(Lt.id,rr);this.setInstanceScope(rr,Gn.ScopeEnum.Request)}else{this.setInstanceScope(rr,Gn.ScopeEnum.Prototype)}}this.removeCreateStatus(Lt,true);return rr}async destroyCache(){for(const Dt of this.singletonCache.keys()){const Lt=this.context.registry.getDefinition(Dt);if(Lt.creator){const Tn=this.singletonCache.get(Dt);this.getObjectEventTarget().emit(Gn.ObjectLifeCycleEvent.BEFORE_DESTROY,Tn,{context:this.context,definition:Lt});await Lt.creator.doDestroyAsync(Tn)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(Dt,Lt){if(this.creating.has(Dt.id)){this.creating.set(Dt.id,false)}return true}isCreating(Dt){return this.creating.has(Dt.id)&&this.creating.get(Dt.id)}compareAndSetCreateStatus(Dt){if(!this.creating.has(Dt.id)||!this.creating.get(Dt.id)){this.creating.set(Dt.id,true)}}createProxyReference(Dt){if(this.isCreating(Dt)){pr("create proxy for %s.",Dt.id);if(!this.depthFirstSearch(Dt.id,Dt)){pr("id = %s after dfs return null",Dt.id);return null}return new Proxy({__is_proxy__:true,__target_id__:Dt.id},{get:(Lt,Tn)=>{let Wn;if(Dt.isRequestScope()){Wn=this.context.registry.getObject(Dt.id)}else if(Dt.isSingletonScope()){Wn=this.singletonCache.get(Dt.id)}else{Wn=this.context.get(Dt.id)}if(Wn){if(typeof Wn[Tn]==="function"){return Wn[Tn].bind(Wn)}return Wn[Tn]}return undefined}})}return null}depthFirstSearch(Dt,Lt,Tn){var Wn;if(Lt){pr("dfs for %s == %s start.",Dt,Lt.id);if(Lt.properties){const Gn=Lt.properties.propertyKeys();if(Gn.indexOf(Dt)>-1){pr("dfs exist in properties %s == %s.",Dt,Lt.id);return true}for(const rr of Gn){if(!Array.isArray(Tn)){Tn=[Dt]}let Gn=rr;const cr=Lt.properties.get(rr);if(cr&&cr.name){Gn=(Wn=this.context.identifierMapping.getRelation(cr.name))!==null&&Wn!==void 0?Wn:cr.name}if(Gn===Dt){pr("dfs exist in properties key %s == %s.",Dt,Lt.id);return true}if(Tn.indexOf(Gn)>-1){pr("dfs depth circular %s == %s, %s, %j.",Dt,Lt.id,Gn,Tn);continue}else{Tn.push(Gn);pr("dfs depth push %s == %s, %j.",Dt,Gn,Tn)}let mr=this.context.registry.getDefinition(Gn);if(!mr&&this.context.parent){mr=this.context.parent.registry.getDefinition(Gn)}if(this.depthFirstSearch(Dt,mr,Tn)){pr("dfs exist in sub tree %s == %s subId = %s.",Dt,Lt.id,mr.id);return true}}}pr("dfs for %s == %s end.",Dt,Lt.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(Dt,Lt){if(Dt.isSingletonScope()){const Tn=Dt.properties.get(Lt);if(this.context.hasDefinition(Tn===null||Tn===void 0?void 0:Tn.name)){const Lt=this.context.registry.getDefinition(Tn.name);if(Lt.isRequestScope()&&!Lt.allowDowngrade){throw new cr.MidwaySingletonInjectRequestError(Dt.path.name,Lt.path.name)}}}return true}setInstanceScope(Dt,Lt){if(typeof Dt==="object"){if(Lt===Gn.ScopeEnum.Request&&Dt[Wn.REQUEST_OBJ_CTX_KEY]===Wn.SINGLETON_CONTAINER_CTX){Lt=Gn.ScopeEnum.Singleton}Object.defineProperty(Dt,Wn.CONTAINER_OBJ_SCOPE,{value:Lt,writable:false,enumerable:false,configurable:false})}}}Lt.ManagedResolverFactory=ManagedResolverFactory},28695:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.providerWrapper=void 0;const Wn=Tn(2222);function providerWrapper(Dt){for(const Lt of Dt){Object.defineProperty(Lt.provider,Wn.FUNCTION_INJECT_KEY,{value:Lt,writable:false})}}Lt.providerWrapper=providerWrapper},97983:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayRequestContainer=void 0;const Wn=Tn(9288);const Gn=Tn(49757);const rr=Tn(2222);class MidwayRequestContainer extends Wn.MidwayContainer{constructor(Dt,Lt){super(Lt);this.applicationContext=Lt;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=Dt;this.registerObject(rr.REQUEST_CTX_KEY,Dt);this.registerObject("res",{});if(Dt.logger){this.registerObject("logger",Dt.logger)}}init(){}get(Dt,Lt){if(typeof Dt!=="string"){Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Tn=this.applicationContext.registry.getDefinition(Dt);if(Tn){if(Tn.isRequestScope()||Tn.id===Gn.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:Tn,args:Lt})}}if(this.parent){return this.parent.get(Dt,Lt)}}async getAsync(Dt,Lt){if(typeof Dt!=="string"){Dt=this.getIdentifier(Dt)}if(this.registry.hasObject(Dt)){return this.registry.getObject(Dt)}const Tn=this.applicationContext.registry.getDefinition(Dt);if(Tn){if(Tn.isRequestScope()||Tn.id===Gn.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:Tn,args:Lt})}}if(this.parent){return this.parent.getAsync(Dt,Lt)}}async ready(){}getContext(){return this.ctx}}Lt.MidwayRequestContainer=MidwayRequestContainer},76271:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Aspect=void 0;const Wn=Tn(49757);const Gn=Tn(18025);const rr=Tn(6192);function Aspect(Dt,Lt,Tn){return function(cr){(0,Wn.saveModule)(Wn.ASPECT_KEY,cr);const pr=[].concat(Dt);for(const Dt of pr){(0,Wn.attachClassMetadata)(Wn.ASPECT_KEY,{aspectTarget:Dt,match:Lt,priority:Tn},cr)}(0,Gn.Scope)(rr.ScopeEnum.Singleton)(cr);(0,Wn.Provide)()(cr)}}Lt.Aspect=Aspect},2940:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Autoload=void 0;const Wn=Tn(45317);const Gn=Tn(39990);function Autoload(){return function(Dt){(0,Wn.savePreloadModule)(Dt);(0,Gn.Provide)()(Dt)}}Lt.Autoload=Autoload},73821:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;const Wn=Tn(49757);function Configuration(Dt={}){return Lt=>{(0,Wn.saveClassMetadata)(Wn.CONFIGURATION_KEY,Dt,Lt)}}Lt.Configuration=Configuration},41573:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Match=Lt.Catch=void 0;const Wn=Tn(45317);const Gn=Tn(75105);const rr=Tn(18025);const cr=Tn(39990);const pr=Tn(6192);function Catch(Dt,Lt={}){return function(Tn){const mr=Dt?[].concat(Dt):undefined;(0,Wn.saveClassMetadata)(Gn.CATCH_KEY,{catchTargets:mr,catchOptions:Lt},Tn);(0,rr.Scope)(pr.ScopeEnum.Singleton)(Tn);(0,cr.Provide)()(Tn)}}Lt.Catch=Catch;function Match(Dt=true){return function(Lt){(0,Wn.saveClassMetadata)(Gn.MATCH_KEY,{matchPattern:Dt},Lt);(0,rr.Scope)(pr.ScopeEnum.Singleton)(Lt);(0,cr.Provide)()(Lt)}}Lt.Match=Match},1623:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApplicationContext=Lt.Logger=Lt.App=Lt.Config=Lt.Plugin=Lt.Framework=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Framework(){return Dt=>{(0,Wn.saveModule)(Wn.FRAMEWORK_KEY,Dt);(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Framework=Framework;function Plugin(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.PLUGIN_KEY,{identifier:Dt})}Lt.Plugin=Plugin;function Config(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.CONFIG_KEY,{identifier:Dt})}Lt.Config=Config;function App(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.APPLICATION_KEY,{type:Dt})}Lt.App=App;function Logger(Dt){return(0,Wn.createCustomPropertyDecorator)(Wn.LOGGER_KEY,{identifier:Dt})}Lt.Logger=Logger;function ApplicationContext(){return(0,Wn.createCustomPropertyDecorator)(Wn.APPLICATION_CONTEXT_KEY,{})}Lt.ApplicationContext=ApplicationContext},41958:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Guard=Lt.UseGuard=void 0;const Wn=Tn(45317);const Gn=Tn(6192);const rr=Tn(75105);const cr=Tn(39990);const pr=Tn(18025);function UseGuard(Dt){return(Lt,Tn,Gn)=>{if(!Array.isArray(Dt)){Dt=[Dt]}if(Tn){(0,Wn.savePropertyMetadata)(rr.GUARD_KEY,Dt,Lt,Tn)}else{(0,Wn.saveClassMetadata)(rr.GUARD_KEY,Dt,Lt)}}}Lt.UseGuard=UseGuard;function Guard(){return Dt=>{(0,cr.Provide)()(Dt);(0,pr.Scope)(Gn.ScopeEnum.Singleton)(Dt)}}Lt.Guard=Guard},92922:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.InjectClient=Lt.Inject=void 0;const Wn=Tn(45317);const Gn=Tn(75105);function Inject(Dt){return function(Lt,Tn){(0,Wn.savePropertyInject)({target:Lt,targetKey:Tn,identifier:Dt})}}Lt.Inject=Inject;function InjectClient(Dt,Lt){return(0,Wn.createCustomPropertyDecorator)(Gn.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:Dt,clientName:Lt})}Lt.InjectClient=InjectClient},17511:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Middleware=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Middleware(){return Dt=>{(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Middleware=Middleware},56329:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Mock=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Mock(){return Dt=>{(0,Wn.saveModule)(Wn.MOCK_KEY,Dt);(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Mock=Mock},18025:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Singleton=Lt.Scope=Lt.Destroy=Lt.Init=void 0;const Wn=Tn(45317);const Gn=Tn(39990);const rr=Tn(6192);function Init(){return function(Dt,Lt){(0,Wn.saveObjectDefinition)(Dt,{initMethod:Lt})}}Lt.Init=Init;function Destroy(){return function(Dt,Lt){(0,Wn.saveObjectDefinition)(Dt,{destroyMethod:Lt})}}Lt.Destroy=Destroy;function Scope(Dt,Lt){return function(Tn){(0,Wn.saveObjectDefinition)(Tn,{scope:Dt,...Lt})}}Lt.Scope=Scope;function Singleton(){return function(Dt){Scope(rr.ScopeEnum.Singleton)(Dt);(0,Gn.Provide)()(Dt)}}Lt.Singleton=Singleton},64331:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Pipe=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Pipe(){return Dt=>{(0,Wn.Scope)(Gn.ScopeEnum.Singleton)(Dt);(0,Wn.Provide)()(Dt)}}Lt.Pipe=Pipe},52953:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Pipeline=void 0;const Wn=Tn(45317);const Gn=Tn(75105);function Pipeline(Dt){return(0,Wn.createCustomPropertyDecorator)(Gn.PIPELINE_IDENTIFIER,{valves:Dt})}Lt.Pipeline=Pipeline},39990:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Provide=void 0;const Wn=Tn(45317);function Provide(Dt){return function(Lt){return(0,Wn.saveProviderId)(Dt,Lt)}}Lt.Provide=Provide},75105:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TAGGED_CLS=Lt.INJECT_CUSTOM_PARAM=Lt.INJECT_CUSTOM_METHOD=Lt.INJECT_CUSTOM_PROPERTY=Lt.INJECT_TAG=Lt.NAMED_TAG=Lt.CLASS_KEY_CONSTRUCTOR=Lt.APPLICATION_CONTEXT_KEY=Lt.APPLICATION_KEY=Lt.LOGGER_KEY=Lt.PLUGIN_KEY=Lt.CONFIG_KEY=Lt.MS_HSF_METHOD_KEY=Lt.MS_DUBBO_METHOD_KEY=Lt.MS_GRPC_METHOD_KEY=Lt.MS_PROVIDER_KEY=Lt.MS_PRODUCER_KEY=Lt.MS_CONSUMER_KEY=Lt.RPC_DUBBO_KEY=Lt.RPC_GRPC_KEY=Lt.HSF_KEY=Lt.WS_EVENT_KEY=Lt.WS_CONTROLLER_KEY=Lt.MODULE_TASK_QUEUE_OPTIONS=Lt.MODULE_TASK_QUEUE_KEY=Lt.MODULE_TASK_TASK_LOCAL_OPTIONS=Lt.MODULE_TASK_TASK_LOCAL_KEY=Lt.MODULE_TASK_METADATA=Lt.MODULE_TASK_KEY=Lt.WEB_RESPONSE_RENDER=Lt.WEB_RESPONSE_CONTENT_TYPE=Lt.WEB_RESPONSE_HEADER=Lt.WEB_RESPONSE_REDIRECT=Lt.WEB_RESPONSE_HTTP_CODE=Lt.WEB_RESPONSE_KEY=Lt.WEB_ROUTER_PARAM_KEY=Lt.WEB_ROUTER_KEY=Lt.CONTROLLER_KEY=Lt.SERVERLESS_FUNC_KEY=Lt.FUNC_KEY=Lt.FACTORY_SERVICE_CLIENT_KEY=Lt.MOCK_KEY=Lt.GUARD_KEY=Lt.MATCH_KEY=Lt.CATCH_KEY=Lt.ASPECT_KEY=Lt.FRAMEWORK_KEY=Lt.CONFIGURATION_KEY=Lt.SCHEDULE_KEY=Lt.ALL=void 0;Lt.PRIVATE_META_DATA_KEY=Lt.MAIN_MODULE_KEY=Lt.LIFECYCLE_IDENTIFIER_PREFIX=Lt.PIPELINE_IDENTIFIER=Lt.OBJ_DEF_CLS=Lt.TAGGED_FUN=void 0;Lt.ALL="common:all_value_key";Lt.SCHEDULE_KEY="common:schedule";Lt.CONFIGURATION_KEY="common:configuration";Lt.FRAMEWORK_KEY="common:framework";Lt.ASPECT_KEY="common:aspect";Lt.CATCH_KEY="common:catch";Lt.MATCH_KEY="common:match";Lt.GUARD_KEY="common:guard";Lt.MOCK_KEY="common:mock";Lt.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";Lt.FUNC_KEY="faas:func";Lt.SERVERLESS_FUNC_KEY="faas:serverless:function";Lt.CONTROLLER_KEY="web:controller";Lt.WEB_ROUTER_KEY="web:router";Lt.WEB_ROUTER_PARAM_KEY="web:router_param";Lt.WEB_RESPONSE_KEY="web:response";Lt.WEB_RESPONSE_HTTP_CODE="web:response_http_code";Lt.WEB_RESPONSE_REDIRECT="web:response_redirect";Lt.WEB_RESPONSE_HEADER="web:response_header";Lt.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";Lt.WEB_RESPONSE_RENDER="web:response_render";Lt.MODULE_TASK_KEY="task:task";Lt.MODULE_TASK_METADATA="task:task:options";Lt.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";Lt.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";Lt.MODULE_TASK_QUEUE_KEY="task:task:queue";Lt.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";Lt.WS_CONTROLLER_KEY="ws:controller";Lt.WS_EVENT_KEY="ws:event";Lt.HSF_KEY="rpc:hsf";Lt.RPC_GRPC_KEY="rpc:grpc";Lt.RPC_DUBBO_KEY="rpc:dubbo";Lt.MS_CONSUMER_KEY="ms:consumer";Lt.MS_PRODUCER_KEY="ms:producer";Lt.MS_PROVIDER_KEY="ms:provider";Lt.MS_GRPC_METHOD_KEY="ms:grpc:method";Lt.MS_DUBBO_METHOD_KEY="ms:dubbo:method";Lt.MS_HSF_METHOD_KEY="ms:hsf:method";Lt.CONFIG_KEY="config";Lt.PLUGIN_KEY="plugin";Lt.LOGGER_KEY="logger";Lt.APPLICATION_KEY="__midway_framework_app__";Lt.APPLICATION_CONTEXT_KEY="__midway_application_context__";Lt.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";Lt.NAMED_TAG="named";Lt.INJECT_TAG="inject";Lt.INJECT_CUSTOM_PROPERTY="inject_custom_property";Lt.INJECT_CUSTOM_METHOD="inject_custom_method";Lt.INJECT_CUSTOM_PARAM="inject_custom_param";Lt.TAGGED_CLS="injection:tagged_class";Lt.TAGGED_FUN="injection:tagged_function";Lt.OBJ_DEF_CLS="injection:object_definition_class";Lt.PIPELINE_IDENTIFIER="__pipeline_identifier__";Lt.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";Lt.MAIN_MODULE_KEY="__main__";Lt.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createCustomParamDecorator=Lt.createCustomMethodDecorator=Lt.createCustomPropertyDecorator=Lt.getMethodReturnTypes=Lt.getPropertyType=Lt.getMethodParamTypes=Lt.BaseType=Lt.isProvide=Lt.getProviderUUId=Lt.getProviderName=Lt.getProviderId=Lt.saveProviderId=Lt.getObjectDefinition=Lt.saveObjectDefinition=Lt.getPropertyInject=Lt.savePropertyInject=Lt.transformTypeFromTSDesign=Lt.clearAllModule=Lt.resetModule=Lt.listModule=Lt.clearBindContainer=Lt.bindContainer=Lt.saveModule=Lt.listPreloadModule=Lt.savePreloadModule=Lt.getPropertyMetadata=Lt.attachPropertyMetadata=Lt.savePropertyMetadata=Lt.listPropertyDataFromClass=Lt.getPropertyDataFromClass=Lt.attachPropertyDataToClass=Lt.savePropertyDataToClass=Lt.getClassMetadata=Lt.getClassExtendedMetadata=Lt.attachClassMetadata=Lt.saveClassMetadata=Lt.DecoratorManager=Lt.INJECT_CLASS_KEY_PREFIX=Lt.PRELOAD_MODULE_KEY=void 0;Tn(37159);const Wn=Tn(6192);const Gn=Tn(75105);const rr=Tn(63289);const cr=Tn(90406);const pr=Tn(65308);const mr=Tn(61327);const gr=Tn(39023).debuglog("midway:core");Lt.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";Lt.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=Lt.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(Dt,Lt){if(this.container){return this.container.saveModule(Dt,Lt)}if(!this.has(Dt)){this.set(Dt,new Set)}this.get(Dt).add(Lt)}listModule(Dt){if(this.container){return this.container.listModule(Dt)}return Array.from(this.get(Dt)||{})}resetModule(Dt){this.set(Dt,new Set)}bindContainer(Dt){this.container=Dt;this.container.transformModule(this)}static getDecoratorClassKey(Dt){return Dt.toString()+"_CLS"}static removeDecoratorClassKeySuffix(Dt){return Dt.toString().replace("_CLS","")}static getDecoratorMethodKey(Dt){return Dt.toString()+"_METHOD"}static getDecoratorClsExtendedKey(Dt){return Dt.toString()+"_EXT"}static getDecoratorClsMethodPrefix(Dt){return Dt.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(Dt,Lt){return DecoratorManager.getDecoratorClsMethodPrefix(Dt)+":"+Lt.toString()}static getDecoratorMethod(Dt,Lt){return DecoratorManager.getDecoratorMethodKey(Dt)+"_"+Lt.toString()}static saveMetadata(Dt,Lt,Tn,Wn){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let Gn;if(Reflect.hasOwnMetadata(Dt,Lt)){Gn=Reflect.getMetadata(Dt,Lt)}else{Gn=new Map}Gn.set(Tn,Wn);Reflect.defineMetadata(Dt,Gn,Lt)}static attachMetadata(Dt,Lt,Tn,Wn,Gn,rr="one"){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let cr;if(Reflect.hasOwnMetadata(Dt,Lt)){cr=Reflect.getMetadata(Dt,Lt)}else{cr=new Map}if(!cr.has(Tn)){if(Gn){cr.set(Tn,{})}else{cr.set(Tn,[])}}if(Gn){if(rr==="one"){cr.get(Tn)[Gn]=Wn}else{if(cr.get(Tn)[Gn]){cr.get(Tn)[Gn].push(Wn)}else{cr.get(Tn)[Gn]=[Wn]}}}else{cr.get(Tn).push(Wn)}Reflect.defineMetadata(Dt,cr,Lt)}static getMetadata(Dt,Lt,Tn){if(typeof Lt==="object"&&Lt.constructor){Lt=Lt.constructor}let Wn;if(!Reflect.hasOwnMetadata(Dt,Lt)){Wn=new Map;Reflect.defineMetadata(Dt,Wn,Lt)}else{Wn=Reflect.getMetadata(Dt,Lt)}if(!Tn){return Wn}return Wn.get(Tn)}saveMetadata(Dt,Lt,Tn,Wn){if(Wn){const Gn=DecoratorManager.getDecoratorMethod(Dt,Wn);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,Tn,Gn,Lt)}else{const Wn=DecoratorManager.getDecoratorClassKey(Dt);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,Tn,Wn,Lt)}}attachMetadata(Dt,Lt,Tn,Wn,Gn,rr){if(Wn){const cr=DecoratorManager.getDecoratorMethod(Dt,Wn);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,Tn,cr,Lt,Gn,rr)}else{const Wn=DecoratorManager.getDecoratorClassKey(Dt);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,Tn,Wn,Lt,Gn,rr)}}getMetadata(Dt,Lt,Tn){if(Tn){const Wn=DecoratorManager.getDecoratorMethod(Dt,Tn);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,Lt,Wn)}else{const Tn=`${DecoratorManager.getDecoratorClassKey(Dt)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,Lt,Tn)}}savePropertyDataToClass(Dt,Lt,Tn,Wn){const Gn=DecoratorManager.getDecoratorClsMethodKey(Dt,Wn);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,Tn,Gn,Lt)}attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn){const rr=DecoratorManager.getDecoratorClsMethodKey(Dt,Wn);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,Tn,rr,Lt,Gn)}getPropertyDataFromClass(Dt,Lt,Tn){const Wn=DecoratorManager.getDecoratorClsMethodKey(Dt,Tn);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Lt,Wn)}listPropertyDataFromClass(Dt,Lt){const Tn=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,Lt);const Wn=[];for(const[Lt,Gn]of Tn){if(Lt.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(Dt))!==-1){Wn.push(Gn)}}return Wn}}Lt.DecoratorManager=DecoratorManager;let yr=new DecoratorManager;if(typeof global==="object"){if(global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]){console.warn('DecoratorManager not singleton and please check @midwayjs/core version by "npm ls @midwayjs/core"');const Dt=(0,mr.getModuleRequirePathList)("@midwayjs/core");if(Dt.length){console.info("The module may be located in:");Dt.forEach(((Dt,Lt)=>{console.info(`${Lt+1}. ${Dt}`)}))}yr=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=yr}}function saveClassMetadata(Dt,Lt,Tn,Wn){if(Wn&&typeof Lt==="object"){const Wn=yr.getMetadata(Dt,Tn);if(!Wn){return yr.saveMetadata(Dt,Lt,Tn)}if(Array.isArray(Wn)){return yr.saveMetadata(Dt,Wn.concat(Lt),Tn)}else{return yr.saveMetadata(Dt,Object.assign(Wn,Lt),Tn)}}else{return yr.saveMetadata(Dt,Lt,Tn)}}Lt.saveClassMetadata=saveClassMetadata;function attachClassMetadata(Dt,Lt,Tn,Wn,Gn){return yr.attachMetadata(Dt,Lt,Tn,undefined,Wn,Gn)}Lt.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(Dt,Lt,Tn,Wn){if(Wn===undefined){Wn=true}const Gn=DecoratorManager.getDecoratorClsExtendedKey(Dt);let rr=yr.getMetadata(Gn,Lt,Tn);if(Wn&&rr!==undefined){return rr}const cr=Reflect.getPrototypeOf(Lt);if(cr&&cr.constructor!==Object){rr=(0,pr.merge)(getClassExtendedMetadata(Dt,cr,Tn,Wn),yr.getMetadata(Dt,Lt,Tn))}yr.saveMetadata(Gn,rr||null,Lt,Tn);return rr}Lt.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(Dt,Lt){return yr.getMetadata(Dt,Lt)}Lt.getClassMetadata=getClassMetadata;function savePropertyDataToClass(Dt,Lt,Tn,Wn){return yr.savePropertyDataToClass(Dt,Lt,Tn,Wn)}Lt.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn){return yr.attachPropertyDataToClass(Dt,Lt,Tn,Wn,Gn)}Lt.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(Dt,Lt,Tn){return yr.getPropertyDataFromClass(Dt,Lt,Tn)}Lt.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(Dt,Lt){return yr.listPropertyDataFromClass(Dt,Lt)}Lt.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(Dt,Lt,Tn,Wn){return yr.saveMetadata(Dt,Lt,Tn,Wn)}Lt.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(Dt,Lt,Tn,Wn){return yr.attachMetadata(Dt,Lt,Tn,Wn)}Lt.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(Dt,Lt,Tn){return yr.getMetadata(Dt,Lt,Tn)}Lt.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(Dt){return saveModule(Lt.PRELOAD_MODULE_KEY,Dt)}Lt.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(Lt.PRELOAD_MODULE_KEY)}Lt.listPreloadModule=listPreloadModule;function saveModule(Dt,Lt){if((0,rr.isClass)(Lt)){saveProviderId(undefined,Lt)}return yr.saveModule(Dt,Lt)}Lt.saveModule=saveModule;function bindContainer(Dt){return yr.bindContainer(Dt)}Lt.bindContainer=bindContainer;function clearBindContainer(){return yr.container=null}Lt.clearBindContainer=clearBindContainer;function listModule(Dt,Lt){const Tn=yr.listModule(Dt);if(Lt){return Tn.filter(Lt)}else{return Tn}}Lt.listModule=listModule;function resetModule(Dt){return yr.resetModule(Dt)}Lt.resetModule=resetModule;function clearAllModule(){gr("--- clear all module here ---");return yr.clear()}Lt.clearAllModule=clearAllModule;function transformTypeFromTSDesign(Dt){if((0,rr.isNullOrUndefined)(Dt)){return{name:"undefined",isBaseType:true,originDesign:Dt}}switch(Dt.name){case"String":return{name:"string",isBaseType:true,originDesign:Dt};case"Number":return{name:"number",isBaseType:true,originDesign:Dt};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:Dt};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:Dt};case"Object":return{name:"object",isBaseType:true,originDesign:Dt};case"Function":return{name:"function",isBaseType:true,originDesign:Dt};default:return{name:Dt.name,isBaseType:false,originDesign:Dt}}}Lt.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(Dt){let Lt=Dt.identifier;let Tn=Wn.InjectModeEnum.Identifier;if(!Lt){const Gn=getPropertyType(Dt.target,Dt.targetKey);if(!Gn.isBaseType&&(0,rr.isClass)(Gn.originDesign)&&isProvide(Gn.originDesign)){Lt=getProviderUUId(Gn.originDesign);Tn=Wn.InjectModeEnum.Class}if(!Lt){Lt=Dt.targetKey;Tn=Wn.InjectModeEnum.PropertyName}}attachClassMetadata(Gn.INJECT_TAG,{targetKey:Dt.targetKey,value:Lt,args:Dt.args,injectMode:Tn},Dt.target,Dt.targetKey)}Lt.savePropertyInject=savePropertyInject;function getPropertyInject(Dt,Lt){return getClassExtendedMetadata(Gn.INJECT_TAG,Dt,undefined,Lt)}Lt.getPropertyInject=getPropertyInject;function saveObjectDefinition(Dt,Lt={}){saveClassMetadata(Gn.OBJ_DEF_CLS,Lt,Dt,true);return Dt}Lt.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(Dt){return getClassExtendedMetadata(Gn.OBJ_DEF_CLS,Dt)}Lt.getObjectDefinition=getObjectDefinition;function saveProviderId(Dt,Lt){if(isProvide(Lt)){if(Dt){const Tn=getClassMetadata(Gn.TAGGED_CLS,Lt);if(Tn.id!==Dt){Tn.id=Dt;saveClassMetadata(Gn.TAGGED_CLS,Tn,Lt);gr(`update provide: ${Lt.name} -> ${Tn.uuid}`)}}}else{const Tn=(0,pr.generateRandomId)();saveClassMetadata(Gn.TAGGED_CLS,{id:Dt,originName:Lt.name,uuid:Tn,name:(0,cr.camelCase)(Lt.name)},Lt);gr(`save provide: ${Lt.name} -> ${Tn}`)}return Lt}Lt.saveProviderId=saveProviderId;function getProviderId(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.id){return Lt.id}}Lt.getProviderId=getProviderId;function getProviderName(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.name){return Lt.name}}Lt.getProviderName=getProviderName;function getProviderUUId(Dt){const Lt=getClassMetadata(Gn.TAGGED_CLS,Dt);if(Lt&&Lt.uuid){return Lt.uuid}}Lt.getProviderUUId=getProviderUUId;function isProvide(Dt){return!!getClassMetadata(Gn.TAGGED_CLS,Dt)}Lt.isProvide=isProvide;var Sr;(function(Dt){Dt["Boolean"]="boolean";Dt["Number"]="number";Dt["String"]="string"})(Sr=Lt.BaseType||(Lt.BaseType={}));function getMethodParamTypes(Dt,Lt){if((0,rr.isClass)(Dt)){Dt=Dt.prototype}return Reflect.getMetadata("design:paramtypes",Dt,Lt)}Lt.getMethodParamTypes=getMethodParamTypes;function getPropertyType(Dt,Lt){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",Dt,Lt))}Lt.getPropertyType=getPropertyType;function getMethodReturnTypes(Dt,Lt){if((0,rr.isClass)(Dt)){Dt=Dt.prototype}return Reflect.getMetadata("design:returntype",Dt,Lt)}Lt.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(Dt,Lt,Tn=true){return function(Wn,rr){attachClassMetadata(Gn.INJECT_CUSTOM_PROPERTY,{propertyName:rr,key:Dt,metadata:Lt,impl:Tn},Wn,rr)}}Lt.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(Dt,Lt,Tn={impl:true}){if(typeof Tn==="boolean"){Tn={impl:Tn}}if(Tn.impl===undefined){Tn.impl=true}return function(Wn,rr,cr){attachClassMetadata(Gn.INJECT_CUSTOM_METHOD,{propertyName:rr,key:Dt,metadata:Lt,options:Tn},Wn)}}Lt.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(Dt,Lt,Tn={impl:true}){if(typeof Tn==="boolean"){Tn={impl:Tn}}if(Tn.impl===undefined){Tn.impl=true}return function(Wn,rr,cr){attachClassMetadata(Gn.INJECT_CUSTOM_PARAM,{key:Dt,parameterIndex:cr,propertyName:rr,metadata:Lt,options:Tn},Wn,rr,"multi")}}Lt.createCustomParamDecorator=createCustomParamDecorator},69193:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerlessTrigger=Lt.ServerlessFunction=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function ServerlessFunction(Dt){return(Lt,Tn,Gn)=>{(0,Wn.savePropertyMetadata)(Wn.SERVERLESS_FUNC_KEY,Dt,Lt,Tn)}}Lt.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(Dt,Lt={}){return(Tn,rr,cr)=>{var pr;if(Dt===Gn.ServerlessTriggerType.HTTP||Dt===Gn.ServerlessTriggerType.API_GATEWAY){Lt["method"]=(pr=Lt["method"])!==null&&pr!==void 0?pr:"get"}(0,Wn.saveModule)(Wn.FUNC_KEY,Tn.constructor);Lt=Lt||{};(0,Wn.attachClassMetadata)(Wn.FUNC_KEY,{type:Dt,methodName:rr,metadata:Lt},Tn)}}Lt.ServerlessTrigger=ServerlessTrigger},49757:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(39990),Lt);Gn(Tn(92922),Lt);Gn(Tn(52953),Lt);Gn(Tn(76271),Lt);Gn(Tn(2940),Lt);Gn(Tn(73821),Lt);Gn(Tn(18025),Lt);Gn(Tn(1623),Lt);Gn(Tn(41573),Lt);Gn(Tn(17511),Lt);Gn(Tn(41958),Lt);Gn(Tn(64331),Lt);Gn(Tn(56329),Lt);Gn(Tn(69193),Lt);Gn(Tn(86690),Lt);Gn(Tn(58843),Lt);Gn(Tn(29619),Lt);Gn(Tn(92233),Lt);Gn(Tn(75105),Lt);Gn(Tn(45317),Lt);Gn(Tn(573),Lt);Gn(Tn(4132),Lt);Gn(Tn(76543),Lt);Gn(Tn(64767),Lt);Gn(Tn(41684),Lt);Gn(Tn(17640),Lt);Gn(Tn(81970),Lt);Gn(Tn(52963),Lt);Gn(Tn(57706),Lt);Gn(Tn(67999),Lt);Gn(Tn(20551),Lt)},573:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Consumer=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Consumer(Dt,Lt={}){return Tn=>{(0,Wn.saveModule)(Wn.MS_CONSUMER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.MS_CONSUMER_KEY,{type:Dt,metadata:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Consumer=Consumer},64767:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.KafkaListener=void 0;const Wn=Tn(49757);function KafkaListener(Dt,Lt={}){return(Tn,Gn)=>{Lt.topic=Dt;Lt.propertyKey=Gn;(0,Wn.attachPropertyDataToClass)(Wn.MS_CONSUMER_KEY,Lt,Tn,Gn)}}Lt.KafkaListener=KafkaListener},4132:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DubboMethod=Lt.GrpcMethod=Lt.GrpcStreamTypeEnum=Lt.Provider=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Provider(Dt,Lt={}){return Tn=>{(0,Wn.saveModule)(Wn.MS_PROVIDER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.MS_PROVIDER_KEY,{type:Dt,metadata:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Provider=Provider;var rr;(function(Dt){Dt["BASE"]="base";Dt["DUPLEX"]="ServerDuplexStream";Dt["READABLE"]="ServerReadableStream";Dt["WRITEABLE"]="ServerWritableStream"})(rr=Lt.GrpcStreamTypeEnum||(Lt.GrpcStreamTypeEnum={}));function GrpcMethod(Dt={}){return(Lt,Tn,Gn)=>{if(!Dt.type){Dt.type=rr.BASE}(0,Wn.savePropertyMetadata)(Wn.MS_GRPC_METHOD_KEY,{methodName:Dt.methodName||Tn,type:Dt.type,onEnd:Dt.onEnd},Lt,Tn);return Gn}}Lt.GrpcMethod=GrpcMethod;function DubboMethod(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachClassMetadata)(Wn.MS_DUBBO_METHOD_KEY,{methodName:Dt||Tn},Lt);return Gn}}Lt.DubboMethod=DubboMethod},76543:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.RabbitMQListener=void 0;const Wn=Tn(49757);function RabbitMQListener(Dt,Lt={}){return(Tn,Gn)=>{Lt.queueName=Dt;Lt.propertyKey=Gn;(0,Wn.attachPropertyDataToClass)(Wn.MS_CONSUMER_KEY,Lt,Tn,Gn)}}Lt.RabbitMQListener=RabbitMQListener},41684:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HSF=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function HSF(Dt={}){return Lt=>{(0,Wn.saveModule)(Wn.HSF_KEY,Lt);(0,Wn.saveClassMetadata)(Wn.HSF_KEY,Dt,Lt);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Lt);(0,Wn.Provide)()(Lt)}}Lt.HSF=HSF},17640:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Queue=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function Queue(Dt){return function(Lt){(0,Wn.saveModule)(Gn.MODULE_TASK_QUEUE_KEY,Lt);(0,Wn.saveClassMetadata)(Gn.MODULE_TASK_QUEUE_OPTIONS,{options:Dt,name:Lt.name},Lt);(0,Wn.Provide)()(Lt)}}Lt.Queue=Queue},57706:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Schedule=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Schedule(Dt){return function(Lt){(0,Wn.saveModule)(Wn.SCHEDULE_KEY,Lt);(0,Wn.saveClassMetadata)(Wn.SCHEDULE_KEY,Dt,Lt);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Lt);(0,Wn.Provide)()(Lt)}}Lt.Schedule=Schedule},81970:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Task=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function Task(Dt){return function(Lt,Tn,rr){(0,Wn.saveModule)(Gn.MODULE_TASK_KEY,Lt.constructor);(0,Wn.attachClassMetadata)(Gn.MODULE_TASK_METADATA,{options:Dt,propertyKey:Tn,value:rr.value,name:Lt.constructor.name},Lt)}}Lt.Task=Task},52963:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.TaskLocal=void 0;const Wn=Tn(49757);const Gn=Tn(75105);function TaskLocal(Dt){return function(Lt,Tn,rr){(0,Wn.saveModule)(Gn.MODULE_TASK_TASK_LOCAL_KEY,Lt.constructor);(0,Wn.attachClassMetadata)(Gn.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:Dt,propertyKey:Tn,value:rr.value},Lt)}}Lt.TaskLocal=TaskLocal},86690:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Controller=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function Controller(Dt="/",Lt={middleware:[],sensitive:true}){return Tn=>{(0,Wn.saveModule)(Wn.CONTROLLER_KEY,Tn);if(Dt)(0,Wn.saveClassMetadata)(Wn.CONTROLLER_KEY,{prefix:Dt,routerOptions:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.Controller=Controller},58843:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Fields=Lt.Queries=Lt.RequestIP=Lt.RequestPath=Lt.Files=Lt.File=Lt.Headers=Lt.Param=Lt.Query=Lt.Body=Lt.Session=Lt.createRequestParamDecorator=Lt.RouteParamTypes=void 0;const Wn=Tn(49757);var Gn;(function(Dt){Dt["QUERY"]="query";Dt["BODY"]="body";Dt["PARAM"]="param";Dt["HEADERS"]="headers";Dt["SESSION"]="session";Dt["FILESTREAM"]="file_stream";Dt["FILESSTREAM"]="files_stream";Dt["NEXT"]="next";Dt["REQUEST_PATH"]="request_path";Dt["REQUEST_IP"]="request_ip";Dt["QUERIES"]="queries";Dt["FIELDS"]="fields";Dt["CUSTOM"]="custom"})(Gn=Lt.RouteParamTypes||(Lt.RouteParamTypes={}));const createParamMapping=function(Dt){return(Lt,Tn={})=>{let Gn=Lt;if(Array.isArray(Lt)&&Tn.pipes===undefined){Tn.pipes=Lt;Gn=undefined}return(0,Wn.createCustomParamDecorator)(Wn.WEB_ROUTER_PARAM_KEY,{type:Dt,propertyData:Gn},Tn)}};const createRequestParamDecorator=function(Dt,Lt){Lt=Lt||{};if(Array.isArray(Lt)){Lt={pipes:Lt}}return createParamMapping(Gn.CUSTOM)(Dt,Lt)};Lt.createRequestParamDecorator=createRequestParamDecorator;const Session=(Dt,Lt)=>createParamMapping(Gn.SESSION)(Dt,{pipes:Lt});Lt.Session=Session;const Body=(Dt,Lt)=>createParamMapping(Gn.BODY)(Dt,{pipes:Lt});Lt.Body=Body;const Query=(Dt,Lt)=>createParamMapping(Gn.QUERY)(Dt,{pipes:Lt});Lt.Query=Query;const Param=(Dt,Lt)=>createParamMapping(Gn.PARAM)(Dt,{pipes:Lt});Lt.Param=Param;const Headers=(Dt,Lt)=>createParamMapping(Gn.HEADERS)(Dt,{pipes:Lt});Lt.Headers=Headers;const File=(Dt,Lt)=>createParamMapping(Gn.FILESTREAM)(Dt,{pipes:Lt});Lt.File=File;const Files=(Dt,Lt)=>createParamMapping(Gn.FILESSTREAM)(Dt,{pipes:Lt});Lt.Files=Files;const RequestPath=Dt=>createParamMapping(Gn.REQUEST_PATH)(undefined,{pipes:Dt});Lt.RequestPath=RequestPath;const RequestIP=Dt=>createParamMapping(Gn.REQUEST_IP)(undefined,{pipes:Dt});Lt.RequestIP=RequestIP;const Queries=(Dt,Lt)=>createParamMapping(Gn.QUERIES)(Dt,{pipes:Lt});Lt.Queries=Queries;const Fields=(Dt,Lt)=>createParamMapping(Gn.FIELDS)(Dt,{pipes:Lt});Lt.Fields=Fields},29619:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.All=Lt.Head=Lt.Options=Lt.Patch=Lt.Put=Lt.Del=Lt.Get=Lt.Post=Lt.RequestMapping=Lt.RequestMethod=void 0;const Wn=Tn(49757);Lt.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const Gn={path:"/",requestMethod:Lt.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(Dt=Gn)=>{const Tn=Dt.path||"/";const rr=Dt.requestMethod||Lt.RequestMethod.GET;const cr=Dt.routerName;const pr=Dt.middleware;return(Lt,Gn,mr)=>{var gr;(0,Wn.attachClassMetadata)(Wn.WEB_ROUTER_KEY,{path:Tn,requestMethod:rr,routerName:cr,method:Gn,middleware:pr,summary:(Dt===null||Dt===void 0?void 0:Dt.summary)||"",description:(Dt===null||Dt===void 0?void 0:Dt.description)||"",ignoreGlobalPrefix:(gr=Dt===null||Dt===void 0?void 0:Dt.ignoreGlobalPrefix)!==null&&gr!==void 0?gr:false},Lt);return mr}};Lt.RequestMapping=RequestMapping;const createMappingDecorator=Dt=>(Tn,Wn={middleware:[]})=>(0,Lt.RequestMapping)(Object.assign(Wn,{requestMethod:Dt,path:Tn}));Lt.Post=createMappingDecorator(Lt.RequestMethod.POST);Lt.Get=createMappingDecorator(Lt.RequestMethod.GET);Lt.Del=createMappingDecorator(Lt.RequestMethod.DELETE);Lt.Put=createMappingDecorator(Lt.RequestMethod.PUT);Lt.Patch=createMappingDecorator(Lt.RequestMethod.PATCH);Lt.Options=createMappingDecorator(Lt.RequestMethod.OPTIONS);Lt.Head=createMappingDecorator(Lt.RequestMethod.HEAD);Lt.All=createMappingDecorator(Lt.RequestMethod.ALL)},92233:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createRender=Lt.ContentType=Lt.SetHeader=Lt.HttpCode=Lt.Redirect=void 0;const Wn=Tn(49757);function Redirect(Dt,Lt=302){return(Tn,Gn,rr)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_REDIRECT,url:Dt,code:Lt},Tn,Gn);return rr}}Lt.Redirect=Redirect;function HttpCode(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_HTTP_CODE,code:Dt},Lt,Tn);return Gn}}Lt.HttpCode=HttpCode;function SetHeader(Dt,Lt){return(Tn,Gn,rr)=>{let cr={};if(Lt){cr[Dt]=Lt}else{cr=Dt}(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_HEADER,setHeaders:cr},Tn,Gn);return rr}}Lt.SetHeader=SetHeader;function ContentType(Dt){return(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_CONTENT_TYPE,contentType:Dt},Lt,Tn);return Gn}}Lt.ContentType=ContentType;function createRender(Dt){return Dt=>(Lt,Tn,Gn)=>{(0,Wn.attachPropertyMetadata)(Wn.WEB_RESPONSE_KEY,{type:Wn.WEB_RESPONSE_RENDER,templateName:Dt},Lt,Tn);return Gn}}Lt.createRender=createRender},67999:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.WSController=void 0;const Wn=Tn(49757);const Gn=Tn(6192);function WSController(Dt="/",Lt={middleware:[],connectionMiddleware:[]}){return Tn=>{(0,Wn.saveModule)(Wn.WS_CONTROLLER_KEY,Tn);(0,Wn.saveClassMetadata)(Wn.WS_CONTROLLER_KEY,{namespace:Dt,routerOptions:Lt},Tn);(0,Wn.Scope)(Gn.ScopeEnum.Request)(Tn);(0,Wn.Provide)()(Tn)}}Lt.WSController=WSController},20551:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.OnConnection=Lt.OnDisConnection=Lt.Emit=Lt.OnMessage=Lt.WSBroadCast=Lt.WSEmit=Lt.OnWSMessage=Lt.OnWSDisConnection=Lt.OnWSConnection=Lt.WSEventTypeEnum=void 0;const Wn=Tn(49757);var Gn;(function(Dt){Dt["ON_CONNECTION"]="ws:onConnection";Dt["ON_DISCONNECTION"]="ws:onDisconnection";Dt["ON_MESSAGE"]="ws:onMessage";Dt["ON_SOCKET_ERROR"]="ws:onSocketError";Dt["EMIT"]="ws:Emit";Dt["BROADCAST"]="ws:broadcast"})(Gn=Lt.WSEventTypeEnum||(Lt.WSEventTypeEnum={}));function OnWSConnection(Dt={}){return(Lt,Tn,rr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_CONNECTION,propertyName:Tn,eventOptions:Dt,descriptor:rr},Lt.constructor)}}Lt.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(Dt,Lt,Tn)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_DISCONNECTION,propertyName:Lt,descriptor:Tn},Dt.constructor)}}Lt.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(Dt,Lt={}){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.ON_MESSAGE,messageEventName:Dt,propertyName:rr,eventOptions:Lt,descriptor:cr},Tn.constructor)}}Lt.OnWSMessage=OnWSMessage;function WSEmit(Dt,Lt=[]){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.EMIT,propertyName:rr,messageEventName:Dt,roomName:[].concat(Lt),descriptor:cr},Tn.constructor)}}Lt.WSEmit=WSEmit;function WSBroadCast(Dt="",Lt=[]){return(Tn,rr,cr)=>{(0,Wn.attachClassMetadata)(Wn.WS_EVENT_KEY,{eventType:Gn.BROADCAST,propertyName:rr,messageEventName:Dt,roomName:[].concat(Lt),descriptor:cr},Tn.constructor)}}Lt.WSBroadCast=WSBroadCast;Lt.OnMessage=OnWSMessage;Lt.Emit=WSEmit;Lt.OnDisConnection=OnWSDisConnection;Lt.OnConnection=OnWSConnection},34881:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FunctionDefinition=void 0;const Wn=Tn(6192);const Gn=Tn(59327);class FunctionWrapperCreator extends Gn.ObjectCreator{doConstruct(Dt,Lt,Tn){if(!Dt){return null}return Dt(Tn,Lt)}async doConstructAsync(Dt,Lt,Tn){if(!Dt){return null}return Dt(Tn,Lt)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=Wn.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(Dt){}hasAttr(Dt){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(Dt){this.innerScope=Dt}isSingletonScope(){return this.innerScope===Wn.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===Wn.ScopeEnum.Request}setAttr(Dt,Lt){}}Lt.FunctionDefinition=FunctionDefinition},59327:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectCreator=void 0;const Wn=Tn(86314);const Gn=Tn(63289);class ObjectCreator{constructor(Dt){this.definition=Dt}load(){let Dt=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return Dt}const Lt=this.definition.path;if(this.definition.export){Dt=require(Lt)[this.definition.export]}else{Dt=require(Lt)}}else{Dt=this.definition.path}return Dt}doConstruct(Dt,Lt){if(!Dt){return Object.create(null)}let Tn;if(this.definition.constructMethod){Tn=Dt[this.definition.constructMethod].apply(Dt,Lt)}else{Tn=Reflect.construct(Dt,Lt)}return Tn}async doConstructAsync(Dt,Lt){if(!Dt){return Object.create(null)}let Tn;if(this.definition.constructMethod){const Wn=Dt[this.definition.constructMethod];if(Gn.Types.isAsyncFunction(Wn)){Tn=await Wn.apply(Dt,Lt)}else{Tn=Wn.apply(Dt,Lt)}}else{Tn=Reflect.construct(Dt,Lt)}return Tn}doInit(Dt){const Lt=Dt;if(this.definition.initMethod&&Lt[this.definition.initMethod]){if(Gn.Types.isGeneratorFunction(Lt[this.definition.initMethod])||Gn.Types.isAsyncFunction(Lt[this.definition.initMethod])){throw new Wn.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const Dt=Lt[this.definition.initMethod].call(Lt);if(Gn.Types.isPromise(Dt)){throw new Wn.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(Dt){const Lt=Dt;if(this.definition.initMethod&&Lt[this.definition.initMethod]){const Dt=Lt[this.definition.initMethod];if(Gn.Types.isAsyncFunction(Dt)){await Dt.call(Lt)}else{if(Dt.length===1){await new Promise((Tn=>{Dt.call(Lt,Tn)}))}else{Dt.call(Lt)}}}}doDestroy(Dt){if(this.definition.destroyMethod&&Dt[this.definition.destroyMethod]){Dt[this.definition.destroyMethod].call(Dt)}}async doDestroyAsync(Dt){if(this.definition.destroyMethod&&Dt[this.definition.destroyMethod]){const Lt=Dt[this.definition.destroyMethod];if(Gn.Types.isAsyncFunction(Lt)){await Lt.call(Dt)}else{if(Lt.length===1){await new Promise((Tn=>{Lt.call(Dt,Tn)}))}else{Lt.call(Dt)}}}}}Lt.ObjectCreator=ObjectCreator},47698:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectDefinition=void 0;const Wn=Tn(6192);const Gn=Tn(74701);const rr=Tn(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=Wn.ScopeEnum.Singleton;this.creator=null;this.id=null;this.name=null;this.initMethod=null;this.destroyMethod=null;this.constructMethod=null;this.constructorArgs=[];this.path=null;this.export=null;this.dependsOn=[];this.properties=new Gn.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new rr.ObjectCreator(this)}set asynchronous(Dt){this._asynchronous=Dt}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===Wn.ScopeEnum.Singleton}isRequestScope(){return this.scope===Wn.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(Dt){return this._attrs.get(Dt)}hasAttr(Dt){return this._attrs.has(Dt)}setAttr(Dt,Lt){this._attrs.set(Dt,Lt)}}Lt.ObjectDefinition=ObjectDefinition},74701:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(Dt,Lt){if(this.has(Dt)){return this.get(Dt)}return Lt}setProperty(Dt,Lt){return this.set(Dt,Lt)}}Lt.ObjectProperties=ObjectProperties},21769:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayHttpError=Lt.MidwayError=Lt.registerErrorCode=void 0;const Wn=Tn(58611);const Gn=new Set;function registerErrorCode(Dt,Lt){if(Gn.has(Dt)){throw new MidwayError(`Error group ${Dt} is duplicated, please check before adding.`)}else{Gn.add(Dt)}const Tn={};for(const Wn in Lt){Tn[Wn]=Dt.toUpperCase()+"_"+String(Lt[Wn]).toUpperCase()}return Tn}Lt.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(Dt,Lt,Tn){super(Dt);if(!Lt||typeof Lt==="object"){Tn=Lt;Lt="MIDWAY_10000"}this.name=this.constructor.name;this.code=Lt;this.cause=Tn===null||Tn===void 0?void 0:Tn.cause}}Lt.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(Dt,Lt,Tn,Gn){super(Dt?typeof Dt==="string"?Dt:Dt.message:Wn.STATUS_CODES[Lt],Tn!==null&&Tn!==void 0?Tn:String(Lt),Gn);if(Dt&&Dt["stack"]){this.stack=Dt["stack"]}this.status=Lt}}Lt.MidwayHttpError=MidwayHttpError},37198:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayEmptyValueError=Lt.MidwayInvalidConfigPropertyError=Lt.MidwayMainFrameworkMissingError=Lt.MidwayCodeInvokeTimeoutError=Lt.MidwayInvokeForbiddenError=Lt.MidwayRetryExceededMaxTimesError=Lt.MidwayDuplicateControllerOptionsError=Lt.MidwayDuplicateClassNameError=Lt.MidwayInconsistentVersionError=Lt.MidwayUtilHttpClientTimeoutError=Lt.MidwayMissingImportComponentError=Lt.MidwaySingletonInjectRequestError=Lt.MidwayUseWrongMethodError=Lt.MidwayDuplicateRouteError=Lt.MidwayResolverMissingError=Lt.MidwayInvalidConfigError=Lt.MidwayConfigMissingError=Lt.MidwayFeatureNotImplementedError=Lt.MidwayFeatureNoLongerSupportedError=Lt.MidwayDefinitionNotFoundError=Lt.MidwayParameterError=Lt.MidwayCommonError=Lt.FrameworkErrorEnum=void 0;const Wn=Tn(21769);Lt.FrameworkErrorEnum=(0,Wn.registerErrorCode)("midway",{UNKNOWN:1e4,COMMON:10001,PARAM_TYPE:10002,DEFINITION_NOT_FOUND:10003,FEATURE_NO_LONGER_SUPPORTED:10004,FEATURE_NOT_IMPLEMENTED:10004,MISSING_CONFIG:10006,MISSING_RESOLVER:10007,DUPLICATE_ROUTER:10008,USE_WRONG_METHOD:10009,SINGLETON_INJECT_REQUEST:10010,MISSING_IMPORTS:10011,UTIL_HTTP_TIMEOUT:10012,INCONSISTENT_VERSION:10013,INVALID_CONFIG:10014,DUPLICATE_CLASS_NAME:10015,DUPLICATE_CONTROLLER_PREFIX_OPTIONS:10016,RETRY_OVER_MAX_TIME:10017,INVOKE_METHOD_FORBIDDEN:10018,CODE_INVOKE_TIMEOUT:10019,MAIN_FRAMEWORK_MISSING:10020,INVALID_CONFIG_PROPERTY:10021,EMPTY_VALUE:10022});class MidwayCommonError extends Wn.MidwayError{constructor(Dt){super(Dt,Lt.FrameworkErrorEnum.COMMON)}}Lt.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends Wn.MidwayError{constructor(Dt){super(Dt!==null&&Dt!==void 0?Dt:"Parameter type not match",Lt.FrameworkErrorEnum.PARAM_TYPE)}}Lt.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends Wn.MidwayError{static isClosePrototypeOf(Dt){return Dt?Dt[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(Dt){super(`${Dt} is not valid in current context`,Lt.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(Dt){const Lt=this.message.split(" is not valid in current context")[0];this.message=`${Lt} in class ${Dt} is not valid in current context`}}Lt.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends Wn.MidwayError{constructor(Dt){super("This feature no longer supported \n"+Dt,Lt.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}Lt.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends Wn.MidwayError{constructor(Dt){super("This feature not implemented \n"+Dt,Lt.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}Lt.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends Wn.MidwayError{constructor(Dt){super(`Can't found config key "${Dt}" in your config, please set it first`,Lt.FrameworkErrorEnum.MISSING_CONFIG)}}Lt.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends Wn.MidwayError{constructor(Dt){super("Invalid config file \n"+Dt,Lt.FrameworkErrorEnum.INVALID_CONFIG)}}Lt.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends Wn.MidwayError{constructor(Dt){super(`Resolver "${Dt}" is missing.`,Lt.FrameworkErrorEnum.MISSING_RESOLVER)}}Lt.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`Duplicate router "${Dt}" at "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_ROUTER)}}Lt.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends Wn.MidwayError{constructor(Dt,Tn,Wn){const Gn=Wn?`${Wn} not valid by ${Dt}, Use ${Tn} instead!`:`You should not invoked by ${Dt}, Use ${Tn} instead!`;super(Gn,Lt.FrameworkErrorEnum.USE_WRONG_METHOD)}}Lt.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends Wn.MidwayError{constructor(Dt,Tn){const Wn=`${Dt} with singleton scope can't implicitly inject ${Tn} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${Tn} or use "ctx.requestContext.getAsync(${Tn})".`;super(Wn,Lt.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}Lt.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends Wn.MidwayError{constructor(Dt){const Tn=`"${Dt}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(Tn,Lt.FrameworkErrorEnum.MISSING_IMPORTS)}}Lt.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends Wn.MidwayError{constructor(Dt){super(Dt,Lt.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}Lt.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends Wn.MidwayError{constructor(){const Dt='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(Dt,Lt.FrameworkErrorEnum.INCONSISTENT_VERSION)}}Lt.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`"${Dt}" duplicated between "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}Lt.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`"Prefix ${Dt}" with duplicated controller options between "${Tn}" and "${Wn}"`,Lt.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}Lt.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends Wn.MidwayError{constructor(Dt,Tn,Wn){super(`Invoke "${Dt}" retries exceeded the maximum number of times(${Tn}), error: ${Wn.message}`,Lt.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:Wn})}}Lt.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invoke "${Tn?Tn.name:"unknown"}.${Dt}" is forbidden.`,Lt.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}Lt.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invoke "${Dt}" running timeout(${Tn}ms)`,Lt.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}Lt.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends Wn.MidwayError{constructor(){super("Main framework missing, please check your configuration.",Lt.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}Lt.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends Wn.MidwayError{constructor(Dt,Tn){super(`Invalid config property "${Dt}", ${Tn?`only ${Tn.join(",")} can be set`:"please check your configuration"}.`,Lt.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}Lt.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends Wn.MidwayError{constructor(Dt){super(Dt!==null&&Dt!==void 0?Dt:"There is an empty value got and it is not allowed.",Lt.FrameworkErrorEnum.EMPTY_VALUE)}}Lt.MidwayEmptyValueError=MidwayEmptyValueError},9504:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.httpError=Lt.GatewayTimeoutError=Lt.ServiceUnavailableError=Lt.BadGatewayError=Lt.NotImplementedError=Lt.InternalServerErrorError=Lt.TooManyRequestsError=Lt.UnprocessableEntityError=Lt.UnsupportedMediaTypeError=Lt.PayloadTooLargeError=Lt.GoneError=Lt.ConflictError=Lt.RequestTimeoutError=Lt.NotAcceptableError=Lt.ForbiddenError=Lt.NotFoundError=Lt.UnauthorizedError=Lt.BadRequestError=Lt.HttpStatus=void 0;const Wn=Tn(21769);var Gn;(function(Dt){Dt[Dt["CONTINUE"]=100]="CONTINUE";Dt[Dt["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Dt[Dt["PROCESSING"]=102]="PROCESSING";Dt[Dt["EARLYHINTS"]=103]="EARLYHINTS";Dt[Dt["OK"]=200]="OK";Dt[Dt["CREATED"]=201]="CREATED";Dt[Dt["ACCEPTED"]=202]="ACCEPTED";Dt[Dt["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Dt[Dt["NO_CONTENT"]=204]="NO_CONTENT";Dt[Dt["RESET_CONTENT"]=205]="RESET_CONTENT";Dt[Dt["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Dt[Dt["AMBIGUOUS"]=300]="AMBIGUOUS";Dt[Dt["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Dt[Dt["FOUND"]=302]="FOUND";Dt[Dt["SEE_OTHER"]=303]="SEE_OTHER";Dt[Dt["NOT_MODIFIED"]=304]="NOT_MODIFIED";Dt[Dt["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Dt[Dt["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Dt[Dt["BAD_REQUEST"]=400]="BAD_REQUEST";Dt[Dt["UNAUTHORIZED"]=401]="UNAUTHORIZED";Dt[Dt["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Dt[Dt["FORBIDDEN"]=403]="FORBIDDEN";Dt[Dt["NOT_FOUND"]=404]="NOT_FOUND";Dt[Dt["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Dt[Dt["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Dt[Dt["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Dt[Dt["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Dt[Dt["CONFLICT"]=409]="CONFLICT";Dt[Dt["GONE"]=410]="GONE";Dt[Dt["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Dt[Dt["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Dt[Dt["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Dt[Dt["URI_TOO_LONG"]=414]="URI_TOO_LONG";Dt[Dt["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Dt[Dt["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Dt[Dt["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Dt[Dt["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Dt[Dt["MISDIRECTED"]=421]="MISDIRECTED";Dt[Dt["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Dt[Dt["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Dt[Dt["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Dt[Dt["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Dt[Dt["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Dt[Dt["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Dt[Dt["BAD_GATEWAY"]=502]="BAD_GATEWAY";Dt[Dt["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Dt[Dt["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Dt[Dt["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(Gn=Lt.HttpStatus||(Lt.HttpStatus={}));class BadRequestError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.BAD_REQUEST)}}Lt.BadRequestError=BadRequestError;class UnauthorizedError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNAUTHORIZED)}}Lt.UnauthorizedError=UnauthorizedError;class NotFoundError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_FOUND)}}Lt.NotFoundError=NotFoundError;class ForbiddenError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.FORBIDDEN)}}Lt.ForbiddenError=ForbiddenError;class NotAcceptableError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_ACCEPTABLE)}}Lt.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.REQUEST_TIMEOUT)}}Lt.RequestTimeoutError=RequestTimeoutError;class ConflictError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.CONFLICT)}}Lt.ConflictError=ConflictError;class GoneError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.GONE)}}Lt.GoneError=GoneError;class PayloadTooLargeError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.PAYLOAD_TOO_LARGE)}}Lt.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNSUPPORTED_MEDIA_TYPE)}}Lt.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.UNPROCESSABLE_ENTITY)}}Lt.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.TOO_MANY_REQUESTS)}}Lt.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.INTERNAL_SERVER_ERROR)}}Lt.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.NOT_IMPLEMENTED)}}Lt.NotImplementedError=NotImplementedError;class BadGatewayError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.BAD_GATEWAY)}}Lt.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.SERVICE_UNAVAILABLE)}}Lt.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends Wn.MidwayHttpError{constructor(Dt){super(Dt,Gn.GATEWAY_TIMEOUT)}}Lt.GatewayTimeoutError=GatewayTimeoutError;Lt.httpError={BadRequestError:BadRequestError,UnauthorizedError:UnauthorizedError,NotFoundError:NotFoundError,ForbiddenError:ForbiddenError,NotAcceptableError:NotAcceptableError,RequestTimeoutError:RequestTimeoutError,ConflictError:ConflictError,GoneError:GoneError,PayloadTooLargeError:PayloadTooLargeError,UnsupportedMediaTypeError:UnsupportedMediaTypeError,UnprocessableEntityError:UnprocessableEntityError,TooManyRequestsError:TooManyRequestsError,InternalServerErrorError:InternalServerErrorError,NotImplementedError:NotImplementedError,BadGatewayError:BadGatewayError,ServiceUnavailableError:ServiceUnavailableError,GatewayTimeoutError:GatewayTimeoutError}},86314:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.httpError=Lt.HttpStatus=void 0;Gn(Tn(21769),Lt);var rr=Tn(9504);Object.defineProperty(Lt,"HttpStatus",{enumerable:true,get:function(){return rr.HttpStatus}});Object.defineProperty(Lt,"httpError",{enumerable:true,get:function(){return rr.httpError}});Gn(Tn(37198),Lt)},24451:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createConfiguration=Lt.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(Dt){this.options=Dt;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(Dt,Lt){if(typeof Dt==="function"){this.configLoadHandler=Dt}else{return this.configLoadHandler(Dt,Lt)}return this}onReady(Dt,Lt){if(typeof Dt==="function"){this.readyHandler=Dt}else{return this.readyHandler(Dt,Lt)}return this}onServerReady(Dt,Lt){if(typeof Dt==="function"){this.serverReadyHandler=Dt}else{return this.serverReadyHandler(Dt,Lt)}return this}onStop(Dt,Lt){if(typeof Dt==="function"){this.stopHandler=Dt}else{return this.stopHandler(Dt,Lt)}return this}getConfigurationOptions(){return this.options}}Lt.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=Dt=>new FunctionalConfiguration(Dt);Lt.createConfiguration=createConfiguration},46123:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPerformanceManager=Lt.TypedResourceManager=Lt.HttpServerResponse=Lt.ServerResponse=Lt.FORMAT=Lt.FileUtils=Lt.PathFileUtil=Lt.Types=Lt.retryWith=Lt.retryWithAsync=Lt.extend=Lt.Utils=Lt.sleep=Lt.isTypeScriptEnvironment=Lt.wrapAsync=Lt.wrapMiddleware=Lt.pathMatching=Lt.transformRequestObjectByType=Lt.deprecatedOutput=Lt.delegateTargetAllPrototypeMethod=Lt.delegateTargetProperties=Lt.delegateTargetMethod=Lt.delegateTargetPrototypeMethod=Lt.loadModule=Lt.safeRequire=Lt.safelyGet=Lt.ASYNC_ROOT_CONTEXT=Lt.MidwayPriorityManager=Lt.DEFAULT_PRIORITY=Lt.DataSourceManager=Lt.WebRouterCollector=Lt.MidwayServerlessFunctionService=Lt.MidwayWebRouterService=Lt.MidwayHealthService=Lt.MidwayMockService=Lt.MidwayDecoratorService=Lt.MidwayMiddlewareService=Lt.MidwayLifeCycleService=Lt.MidwayAspectService=Lt.MidwayFrameworkService=Lt.MidwayLoggerService=Lt.MidwayInformationService=Lt.MidwayEnvironmentService=Lt.MidwayConfigService=Lt.FunctionalConfiguration=Lt.createConfiguration=Lt.BaseFramework=Lt.MidwayRequestContainer=void 0;Gn(Tn(6192),Lt);Gn(Tn(9288),Lt);var rr=Tn(97983);Object.defineProperty(Lt,"MidwayRequestContainer",{enumerable:true,get:function(){return rr.MidwayRequestContainer}});var cr=Tn(83872);Object.defineProperty(Lt,"BaseFramework",{enumerable:true,get:function(){return cr.BaseFramework}});Gn(Tn(28695),Lt);Gn(Tn(2222),Lt);var pr=Tn(24451);Object.defineProperty(Lt,"createConfiguration",{enumerable:true,get:function(){return pr.createConfiguration}});Object.defineProperty(Lt,"FunctionalConfiguration",{enumerable:true,get:function(){return pr.FunctionalConfiguration}});var mr=Tn(78842);Object.defineProperty(Lt,"MidwayConfigService",{enumerable:true,get:function(){return mr.MidwayConfigService}});var gr=Tn(70275);Object.defineProperty(Lt,"MidwayEnvironmentService",{enumerable:true,get:function(){return gr.MidwayEnvironmentService}});var yr=Tn(37482);Object.defineProperty(Lt,"MidwayInformationService",{enumerable:true,get:function(){return yr.MidwayInformationService}});var Sr=Tn(34888);Object.defineProperty(Lt,"MidwayLoggerService",{enumerable:true,get:function(){return Sr.MidwayLoggerService}});var Er=Tn(33332);Object.defineProperty(Lt,"MidwayFrameworkService",{enumerable:true,get:function(){return Er.MidwayFrameworkService}});var Or=Tn(70812);Object.defineProperty(Lt,"MidwayAspectService",{enumerable:true,get:function(){return Or.MidwayAspectService}});var Ir=Tn(13328);Object.defineProperty(Lt,"MidwayLifeCycleService",{enumerable:true,get:function(){return Ir.MidwayLifeCycleService}});var Hr=Tn(68220);Object.defineProperty(Lt,"MidwayMiddlewareService",{enumerable:true,get:function(){return Hr.MidwayMiddlewareService}});var Gr=Tn(96367);Object.defineProperty(Lt,"MidwayDecoratorService",{enumerable:true,get:function(){return Gr.MidwayDecoratorService}});var $r=Tn(77306);Object.defineProperty(Lt,"MidwayMockService",{enumerable:true,get:function(){return $r.MidwayMockService}});var mi=Tn(658);Object.defineProperty(Lt,"MidwayHealthService",{enumerable:true,get:function(){return mi.MidwayHealthService}});var ki=Tn(19985);Object.defineProperty(Lt,"MidwayWebRouterService",{enumerable:true,get:function(){return ki.MidwayWebRouterService}});var Ni=Tn(42592);Object.defineProperty(Lt,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return Ni.MidwayServerlessFunctionService}});Object.defineProperty(Lt,"WebRouterCollector",{enumerable:true,get:function(){return Ni.WebRouterCollector}});var Ri=Tn(12849);Object.defineProperty(Lt,"DataSourceManager",{enumerable:true,get:function(){return Ri.DataSourceManager}});var ji=Tn(67934);Object.defineProperty(Lt,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return ji.DEFAULT_PRIORITY}});Object.defineProperty(Lt,"MidwayPriorityManager",{enumerable:true,get:function(){return ji.MidwayPriorityManager}});Gn(Tn(28602),Lt);Gn(Tn(82535),Lt);Gn(Tn(64842),Lt);Gn(Tn(46673),Lt);Gn(Tn(1845),Lt);Gn(Tn(11026),Lt);Gn(Tn(12738),Lt);Gn(Tn(39408),Lt);Gn(Tn(43436),Lt);Gn(Tn(29222),Lt);Gn(Tn(86314),Lt);var Ui=Tn(75351);Object.defineProperty(Lt,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Ui.ASYNC_ROOT_CONTEXT}});Gn(Tn(49757),Lt);Gn(Tn(45317),Lt);Gn(Tn(75105),Lt);var Vi=Tn(65308);Object.defineProperty(Lt,"safelyGet",{enumerable:true,get:function(){return Vi.safelyGet}});Object.defineProperty(Lt,"safeRequire",{enumerable:true,get:function(){return Vi.safeRequire}});Object.defineProperty(Lt,"loadModule",{enumerable:true,get:function(){return Vi.loadModule}});Object.defineProperty(Lt,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Vi.delegateTargetPrototypeMethod}});Object.defineProperty(Lt,"delegateTargetMethod",{enumerable:true,get:function(){return Vi.delegateTargetMethod}});Object.defineProperty(Lt,"delegateTargetProperties",{enumerable:true,get:function(){return Vi.delegateTargetProperties}});Object.defineProperty(Lt,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Vi.delegateTargetAllPrototypeMethod}});Object.defineProperty(Lt,"deprecatedOutput",{enumerable:true,get:function(){return Vi.deprecatedOutput}});Object.defineProperty(Lt,"transformRequestObjectByType",{enumerable:true,get:function(){return Vi.transformRequestObjectByType}});Object.defineProperty(Lt,"pathMatching",{enumerable:true,get:function(){return Vi.pathMatching}});Object.defineProperty(Lt,"wrapMiddleware",{enumerable:true,get:function(){return Vi.wrapMiddleware}});Object.defineProperty(Lt,"wrapAsync",{enumerable:true,get:function(){return Vi.wrapAsync}});Object.defineProperty(Lt,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Vi.isTypeScriptEnvironment}});Object.defineProperty(Lt,"sleep",{enumerable:true,get:function(){return Vi.sleep}});Object.defineProperty(Lt,"Utils",{enumerable:true,get:function(){return Vi.Utils}});var zi=Tn(83486);Object.defineProperty(Lt,"extend",{enumerable:true,get:function(){return zi.extend}});Gn(Tn(46422),Lt);Gn(Tn(50539),Lt);Gn(Tn(73861),Lt);Gn(Tn(87653),Lt);var Ki=Tn(25198);Object.defineProperty(Lt,"retryWithAsync",{enumerable:true,get:function(){return Ki.retryWithAsync}});Object.defineProperty(Lt,"retryWith",{enumerable:true,get:function(){return Ki.retryWith}});var $i=Tn(63289);Object.defineProperty(Lt,"Types",{enumerable:true,get:function(){return $i.Types}});var Xi=Tn(61327);Object.defineProperty(Lt,"PathFileUtil",{enumerable:true,get:function(){return Xi.PathFileUtil}});var Yi=Tn(7589);Object.defineProperty(Lt,"FileUtils",{enumerable:true,get:function(){return Yi.FileUtils}});var Wo=Tn(30001);Object.defineProperty(Lt,"FORMAT",{enumerable:true,get:function(){return Wo.FORMAT}});var Ho=Tn(89995);Object.defineProperty(Lt,"ServerResponse",{enumerable:true,get:function(){return Ho.ServerResponse}});Object.defineProperty(Lt,"HttpServerResponse",{enumerable:true,get:function(){return Ho.HttpServerResponse}});var Go=Tn(11330);Object.defineProperty(Lt,"TypedResourceManager",{enumerable:true,get:function(){return Go.TypedResourceManager}});var Xo=Tn(70032);Object.defineProperty(Lt,"MidwayPerformanceManager",{enumerable:true,get:function(){return Xo.MidwayPerformanceManager}})},6192:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayProcessTypeEnum=Lt.ObjectLifeCycleEvent=Lt.ServerlessTriggerType=Lt.MidwayFrameworkType=Lt.FrameworkType=Lt.MSListenerType=Lt.MSProviderType=Lt.InjectModeEnum=Lt.ScopeEnum=void 0;var Tn;(function(Dt){Dt["Singleton"]="Singleton";Dt["Request"]="Request";Dt["Prototype"]="Prototype"})(Tn=Lt.ScopeEnum||(Lt.ScopeEnum={}));var Wn;(function(Dt){Dt["Identifier"]="Identifier";Dt["Class"]="Class";Dt["PropertyName"]="PropertyName"})(Wn=Lt.InjectModeEnum||(Lt.InjectModeEnum={}));var Gn;(function(Dt){Dt["DUBBO"]="dubbo";Dt["GRPC"]="gRPC"})(Gn=Lt.MSProviderType||(Lt.MSProviderType={}));var rr;(function(Dt){Dt["RABBITMQ"]="rabbitmq";Dt["MQTT"]="mqtt";Dt["KAFKA"]="kafka";Dt["REDIS"]="redis"})(rr=Lt.MSListenerType||(Lt.MSListenerType={}));class FrameworkType{}Lt.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(Dt){super();this.name=Dt}}Lt.MidwayFrameworkType=MidwayFrameworkType;MidwayFrameworkType.WEB=new MidwayFrameworkType("@midwayjs/web");MidwayFrameworkType.WEB_KOA=new MidwayFrameworkType("@midwayjs/web-koa");MidwayFrameworkType.WEB_EXPRESS=new MidwayFrameworkType("@midwayjs/express");MidwayFrameworkType.FAAS=new MidwayFrameworkType("@midwayjs/faas");MidwayFrameworkType.MS_GRPC=new MidwayFrameworkType("@midwayjs/grpc");MidwayFrameworkType.MS_RABBITMQ=new MidwayFrameworkType("@midwayjs/rabbitmq");MidwayFrameworkType.MS_KAFKA=new MidwayFrameworkType("@midwayjs/kafka");MidwayFrameworkType.WS_IO=new MidwayFrameworkType("@midwayjs/socketio");MidwayFrameworkType.WS=new MidwayFrameworkType("@midwayjs/ws");MidwayFrameworkType.SERVERLESS_APP=new MidwayFrameworkType("@midwayjs/serverless-app");MidwayFrameworkType.CUSTOM=new MidwayFrameworkType("");MidwayFrameworkType.EMPTY=new MidwayFrameworkType("empty");MidwayFrameworkType.LIGHT=new MidwayFrameworkType("light");MidwayFrameworkType.TASK=new MidwayFrameworkType("@midwayjs/task");var cr;(function(Dt){Dt["EVENT"]="event";Dt["HTTP"]="http";Dt["API_GATEWAY"]="apigw";Dt["OS"]="os";Dt["CDN"]="cdn";Dt["LOG"]="log";Dt["TIMER"]="timer";Dt["MQ"]="mq";Dt["KAFKA"]="kafka";Dt["HSF"]="hsf";Dt["MTOP"]="mtop";Dt["SSR"]="ssr"})(cr=Lt.ServerlessTriggerType||(Lt.ServerlessTriggerType={}));var pr;(function(Dt){Dt["BEFORE_BIND"]="beforeBind";Dt["BEFORE_CREATED"]="beforeObjectCreated";Dt["AFTER_CREATED"]="afterObjectCreated";Dt["AFTER_INIT"]="afterObjectInit";Dt["BEFORE_DESTROY"]="beforeObjectDestroy"})(pr=Lt.ObjectLifeCycleEvent||(Lt.ObjectLifeCycleEvent={}));var mr;(function(Dt){Dt["APPLICATION"]="APPLICATION";Dt["AGENT"]="AGENT"})(mr=Lt.MidwayProcessTypeEnum||(Lt.MidwayProcessTypeEnum={}))},72838:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerResponse=void 0;class ServerResponse{constructor(Dt){this.isSuccess=true;this.ctx=Dt}json(Dt){return Object.getPrototypeOf(this).constructor.JSON_TPL(Dt,this.isSuccess,this.ctx)}text(Dt){return Object.getPrototypeOf(this).constructor.TEXT_TPL(Dt,this.isSuccess,this.ctx)}blob(Dt){return Object.getPrototypeOf(this).constructor.BLOB_TPL(Dt,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}Lt.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(Dt,Lt,Tn)=>Dt;ServerResponse.JSON_TPL=(Dt,Lt,Tn)=>{if(Lt){return{success:"true",data:Dt}}else{return{success:"false",message:Dt||"fail"}}};ServerResponse.BLOB_TPL=(Dt,Lt,Tn)=>Dt},91959:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpServerResponse=void 0;const Wn=Tn(79896);const Gn=Tn(72838);const rr=Tn(82738);const cr=Tn(37407);const pr=Tn(16928);class HttpServerResponse extends Gn.ServerResponse{constructor(Dt){super(Dt)}status(Dt){this.ctx.res.statusCode=Dt;return this}header(Dt,Lt){this.ctx.res.setHeader(Dt,Lt);return this}headers(Dt){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(Dt)))}else{for(const Lt in Dt){this.header(Lt,Dt[Lt])}}return this}json(Dt){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(Dt,this.isSuccess,this.ctx)}text(Dt){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(Dt,this.isSuccess,this.ctx)}file(Dt,Lt){this.header("Content-Type",Lt||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,pr.basename)(Dt)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof Dt==="string"?(0,Wn.createReadStream)(Dt):Dt,this.isSuccess,this.ctx)}blob(Dt,Lt){this.header("Content-Type",Lt||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(Dt,this.isSuccess,this.ctx)}html(Dt){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(Dt,this.isSuccess,this.ctx)}redirect(Dt,Lt=302){this.status(Lt);if(this.ctx.redirect){return this.ctx.redirect(Dt)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(Dt)}else{this.header("Location",Dt)}}sse(Dt={}){return new rr.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...Dt})}stream(Dt={}){return new cr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...Dt})}}Lt.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(Dt,Lt,Tn)=>Dt;HttpServerResponse.SSE_TPL=(Dt,Lt)=>Dt;HttpServerResponse.STREAM_TPL=(Dt,Lt)=>Dt;HttpServerResponse.HTML_TPL=(Dt,Lt,Tn)=>Dt},89995:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpServerResponse=Lt.ServerResponse=void 0;var Wn=Tn(72838);Object.defineProperty(Lt,"ServerResponse",{enumerable:true,get:function(){return Wn.ServerResponse}});var Gn=Tn(91959);Object.defineProperty(Lt,"HttpServerResponse",{enumerable:true,get:function(){return Gn.HttpServerResponse}})},82738:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ServerSendEventStream=void 0;const Wn=Tn(2203);class ServerSendEventStream extends Wn.Transform{constructor(Dt,Lt={}){super({objectMode:true,...Lt});this.isActive=false;this.ctx=Dt;this.closeEvent=Lt.closeEvent||"close";this.options=Lt;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(Dt,Lt,Tn){try{let Lt,Wn="data: ";const Gn=/^\s*:\s*/;const rr=[];if(!this.isActive){this.isActive=true;const Dt={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const Lt in Dt){this.ctx.res.setHeader(Lt,Dt[Lt])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);rr.push(": ok")}const cr=Dt;if(cr.event)rr.push("event: "+cr.event);if(cr.retry)rr.push("retry: "+cr.retry);if(cr.id)rr.push("id: "+cr.id);if(typeof cr.data==="object"){Lt=JSON.stringify(cr.data);rr.push(Wn+Lt)}else if(typeof cr.data==="undefined"){rr.push(Wn)}else{cr.data=String(cr.data);if(cr.data.search(Gn)!==-1){cr.data=cr.data.replace(Gn,"");Wn=": "}cr.data=cr.data.replace(/(\r\n|\r|\n)/g,"\n");Lt=cr.data.split(/\n/);for(let Dt=0,Tn=Lt.length;Dt<Tn;++Dt){const Gn=Lt[Dt];if(Dt+1===Tn){rr.push(Wn+Gn)}else{rr.push(Wn+Gn)}}}this.push(rr.join("\n")+"\n\n");Tn()}catch(Dt){this.ctx.logger.error(Dt);this.sendError(Dt);this.end();Tn(Dt)}}sendError(Dt){this.send({event:"error",data:Dt.message||"An error occurred"})}sendEnd(Dt){Dt.event=this.closeEvent;this.send(Dt)}send(Dt){super.write(this.options.tpl(Dt,this.ctx))}handleClose(){this.end()}}Lt.ServerSendEventStream=ServerSendEventStream},37407:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpStreamResponse=void 0;const Wn=Tn(2203);class HttpStreamResponse extends Wn.Transform{constructor(Dt,Lt={}){super({objectMode:true,...Lt});this.isActive=false;this.ctx=Dt;this.options=Lt}_transform(Dt,Lt,Tn){try{if(!this.isActive){this.isActive=true;this.ctx.res.statusCode=200;this.ctx.res.setHeader("Transfer-Encoding","chunked");this.ctx.res.setHeader("Cache-Control","no-cache");this.ctx.req.socket.setTimeout(0)}if(typeof Dt==="string"){this.ctx.res.write(Dt)}else{this.ctx.res.write(JSON.stringify(Dt))}Tn()}catch(Dt){this.ctx.logger.error(Dt);this.end();this.ctx.res.end();Tn(Dt)}}send(Dt){if(!this.writable){return}this.write(this.options.tpl(Dt,this.ctx))}sendError(Dt){this.ctx.logger.error(Dt);this.end();this.ctx.res.end()}_flush(Dt){this.ctx.res.end();Dt()}}Lt.HttpStreamResponse=HttpStreamResponse},70812:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayAspectService=void 0;const rr=Tn(65675);const cr=Tn(6192);const pr=Tn(49757);const mr=Tn(63289);let gr=class MidwayAspectService{constructor(Dt){this.applicationContext=Dt}async loadAspect(){const Dt=(0,pr.listModule)(pr.ASPECT_KEY);let Lt=[];for(const Tn of Dt){const Dt=(0,pr.getClassMetadata)(pr.ASPECT_KEY,Tn);Lt=Lt.concat(Dt.map((Dt=>{Dt.aspectModule=Tn;return Dt})))}Lt.sort(((Dt,Lt)=>(Lt.priority||0)-(Dt.priority||0)));for(const Dt of Lt){const Lt=await this.applicationContext.getAsync(Dt.aspectModule);await this.addAspect(Lt,Dt)}}async addAspect(Dt,Lt){const Tn=Lt.aspectTarget;const Wn=Object.getOwnPropertyNames(Tn.prototype);const Gn=Lt.match?rr(Lt.match):()=>true;for(const Lt of Wn){if(Lt==="constructor"||!Gn(Lt)){continue}const Wn=Object.getOwnPropertyDescriptor(Tn.prototype,Lt);if(!Wn||Wn.writable===false){continue}this.interceptPrototypeMethod(Tn,Lt,Dt)}}interceptPrototypeMethod(Dt,Lt,Tn){const Wn=Dt.prototype[Lt];if(mr.Types.isAsyncFunction(Dt.prototype[Lt])){Dt.prototype[Lt]=async function(...Dt){var Gn,rr,cr;let pr,mr;const newProceed=(...Dt)=>Wn.apply(this,Dt);const gr={methodName:Lt,target:this,args:Dt,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof Tn==="function"){Tn=Tn()}try{await((Gn=Tn.before)===null||Gn===void 0?void 0:Gn.call(Tn,gr));if(Tn.around){mr=await Tn.around(gr)}else{mr=await Wn.call(this,...gr.args)}gr.proceed=undefined;const Dt=await((rr=Tn.afterReturn)===null||rr===void 0?void 0:rr.call(Tn,gr,mr));mr=typeof Dt==="undefined"?mr:Dt;return mr}catch(Dt){gr.proceed=undefined;pr=Dt;if(Tn.afterThrow){await Tn.afterThrow(gr,pr)}else{throw Dt}}finally{await((cr=Tn.after)===null||cr===void 0?void 0:cr.call(Tn,gr,mr,pr))}}}else{Dt.prototype[Lt]=function(...Dt){var Gn,rr,cr;let pr,mr;const newProceed=(...Dt)=>Wn.apply(this,Dt);const gr={methodName:Lt,target:this,args:Dt,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof Tn==="function"){Tn=Tn()}try{(Gn=Tn.before)===null||Gn===void 0?void 0:Gn.call(Tn,gr);if(Tn.around){mr=Tn.around(gr)}else{mr=Wn.call(this,...gr.args)}gr.proceed=undefined;const Dt=(rr=Tn.afterReturn)===null||rr===void 0?void 0:rr.call(Tn,gr,mr);mr=typeof Dt==="undefined"?mr:Dt;return mr}catch(Dt){gr.proceed=undefined;pr=Dt;if(Tn.afterThrow){Tn.afterThrow(gr,pr)}else{throw Dt}}finally{(cr=Tn.after)===null||cr===void 0?void 0:cr.call(Tn,gr,mr,pr)}}}}};gr=Wn([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],gr);Lt.MidwayAspectService=gr},78842:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayConfigService=void 0;const rr=Tn(16928);const cr=Tn(6192);const pr=Tn(65308);const mr=Tn(79896);const gr=Tn(39023);const yr=Tn(70275);const Sr=Tn(37482);const Er=Tn(83486);const Or=Tn(86314);const Ir=Tn(49757);const Hr=Tn(63289);const Gr=gr.debuglog("midway:debug");let $r=class MidwayConfigService{constructor(){this.envDirMap=new Map;this.aliasMap={prod:"production",unittest:"test"};this.configMergeOrder=[];this.configuration={};this.isReady=false;this.externalObject=[];this.configFilterList=[]}init(){this.appInfo={pkg:this.informationService.getPkg(),name:this.informationService.getProjectName(),baseDir:this.informationService.getBaseDir(),appDir:this.informationService.getAppDir(),HOME:this.informationService.getHome(),root:this.informationService.getRoot(),env:this.environmentService.getCurrentEnvironment()}}add(Dt){for(const Lt of Dt){if(typeof Lt==="string"){if(/\.\w+$/.test(Lt)){const Dt=this.getConfigEnv(Lt);const Tn=this.getEnvSet(Dt);Tn.add(Lt);if(this.aliasMap[Dt]){this.getEnvSet(this.aliasMap[Dt]).add(Lt)}}else{const Dt=(0,mr.statSync)(Lt);if(Dt.isDirectory()){const Dt=(0,mr.readdirSync)(Lt);this.add(Dt.map((Dt=>(0,rr.join)(Lt,Dt))))}}}else{for(const Dt in Lt){this.getEnvSet(Dt).add(Lt[Dt]);if(this.aliasMap[Dt]){this.getEnvSet(this.aliasMap[Dt]).add(Lt[Dt])}}}}}addObject(Dt,Lt=false){if(this.isReady){Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:Dt});if(Lt){this.configuration=(0,Er.extend)(true,Dt,this.configuration)}else{(0,Er.extend)(true,this.configuration,Dt)}}else{this.externalObject.push(Dt)}}getEnvSet(Dt){if(!this.envDirMap.has(Dt)){this.envDirMap.set(Dt,new Set)}return this.envDirMap.get(Dt)}getConfigEnv(Dt){const Lt=(0,rr.basename)(Dt);const Tn=Lt.split(".");const Wn=Tn.pop();if(Wn!=="js"&&Wn!=="ts"){return Wn}return Tn.pop()}load(){if(this.isReady)return;const Dt=this.getEnvSet("default");const Lt=this.getEnvSet(this.environmentService.getCurrentEnvironment());const Tn={};const Wn=Dt.size;for(const[Gn,rr]of[...Dt,...Lt].entries()){let Dt=this.loadConfig(rr);if(Hr.Types.isFunction(Dt)){Dt=Dt.apply(null,[this.appInfo,Tn])}if(!Dt){continue}Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");continue}if(typeof rr==="string"){Gr("[config]: Loaded config %s, %j",rr,Dt)}else{Gr("[config]: Loaded config %j",Dt)}this.configMergeOrder.push({env:Gn<Wn?"default":this.environmentService.getCurrentEnvironment(),extraPath:rr,value:Dt});(0,Er.extend)(true,Tn,Dt)}if(this.externalObject.length){for(let Dt of this.externalObject){if(Dt){Dt=this.runWithFilter(Dt);if(!Dt){Gr("[config]: Filter config and got undefined will be drop it");continue}Gr("[config]: Loaded external object %j",Dt);(0,Er.extend)(true,Tn,Dt);this.configMergeOrder.push({env:"default",extraPath:"",value:Dt})}}}this.configuration=Tn;this.isReady=true}getConfiguration(Dt){if(Dt){return(0,pr.safelyGet)(Dt,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(Dt){let Lt=typeof Dt==="string"?require(Dt):Dt;if(Lt&&Lt.__esModule){if(Lt&&Lt.default){if(Object.keys(Lt).length>1){throw new Or.MidwayInvalidConfigError(`${Dt} should not have both a default export and named export`)}Lt=Lt.default}}return Lt}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(Dt){this.configFilterList.push(Dt)}runWithFilter(Dt){for(const Lt of this.configFilterList){Gr(`[config]: Filter config by filter = "${Lt.name||"anonymous filter"}"`);Dt=Lt(Dt);Gr("[config]: Filter config result = %j",Dt)}return Dt}getAppInfo(){return this.appInfo}};Wn([(0,Ir.Inject)(),Gn("design:type",yr.MidwayEnvironmentService)],$r.prototype,"environmentService",void 0);Wn([(0,Ir.Inject)(),Gn("design:type",Sr.MidwayInformationService)],$r.prototype,"informationService",void 0);Wn([(0,Ir.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],$r.prototype,"init",null);$r=Wn([(0,Ir.Provide)(),(0,Ir.Scope)(cr.ScopeEnum.Singleton)],$r);Lt.MidwayConfigService=$r},96367:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayDecoratorService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(70812);const mr=Tn(86314);const gr=Tn(39023);const yr=Tn(63289);const Sr=gr.debuglog("midway:debug");let Er=class MidwayDecoratorService{constructor(Dt){this.applicationContext=Dt;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((Dt=>{const Lt=(0,rr.getClassMetadata)(rr.INJECT_CUSTOM_METHOD,Dt);if(Lt){for(const Tn of Lt){const{propertyName:Lt,key:Wn,metadata:Gn,options:rr}=Tn;if(!rr||!rr.impl){continue}this.aspectService.interceptPrototypeMethod(Dt,Lt,(()=>{const Tn=this.methodDecoratorMap.get(Wn);if(!Tn){throw new mr.MidwayCommonError(`Method Decorator "${Wn}" handler not found, please register first.`)}return Tn({target:Dt,propertyName:Lt,metadata:Gn})}))}}const Tn=(0,rr.getClassMetadata)(rr.INJECT_CUSTOM_PARAM,Dt);if(Tn){for(const Lt of Object.keys(Tn)){this.aspectService.interceptPrototypeMethod(Dt,Lt,(()=>({before:async Wn=>{const Gn=[...Wn.args];for(const cr of Tn[Lt]){const{propertyName:Lt,key:Tn,metadata:pr,parameterIndex:gr,options:Er}=cr;let Or;if(Er&&Er.impl){Or=this.parameterDecoratorMap.get(Tn);if(!Or){throw new mr.MidwayCommonError(`Parameter Decorator "${Tn}" handler not found, please register first.`)}}else{Or=async({parameterIndex:Dt,originArgs:Lt})=>Lt[Dt]}const Ir=(0,rr.getMethodParamTypes)(Dt,Lt);let Hr=false;try{Gn[gr]=await Or({metadata:pr,propertyName:Lt,parameterIndex:gr,target:Dt,originArgs:Gn,originParamType:Ir[gr],instance:Wn.target})}catch(Dt){Hr=true;if((Er===null||Er===void 0?void 0:Er.throwError)===true){throw Dt}else{Sr(`[core]: Parameter decorator throw error and use origin args, ${Dt.stack}`)}}if(Hr){continue}const Gr=[...this.parameterDecoratorPipes.get(Tn)||[],...(Er===null||Er===void 0?void 0:Er.pipes)||[]];for(const Dt of Gr){let Lt;if("transform"in Dt){Lt=Dt["transform"].bind(Dt)}else if((0,yr.isClass)(Dt)){const Tn=await this.applicationContext.getAsync(Dt);Lt=Tn.transform.bind(Tn)}else if(typeof Dt==="function"){Lt=Dt}else{throw new mr.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}Gn[gr]=await Lt(Gn[gr],{metaType:(0,rr.transformTypeFromTSDesign)(Ir[gr]),metadata:pr,target:Wn.target,methodName:Wn.methodName})}}Wn.args=Gn}})))}}}));this.applicationContext.onObjectCreated(((Dt,Lt)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(Lt.definition.handlerProps)){for(const Tn of Lt.definition.handlerProps){this.defineGetterPropertyValue(Tn,Dt,this.getHandler(Tn.key))}}}));this.registerPropertyHandler(rr.APPLICATION_CONTEXT_KEY,((Dt,Lt)=>this.applicationContext))}registerPropertyHandler(Dt,Lt){Sr(`[core]: Register property decorator key="${Dt}"`);this.propertyHandlerMap.set(Dt,Lt)}registerMethodHandler(Dt,Lt){Sr(`[core]: Register method decorator key="${Dt}"`);this.methodDecoratorMap.set(Dt,Lt)}registerParameterHandler(Dt,Lt){Sr(`[core]: Register parameter decorator key="${Dt}"`);this.parameterDecoratorMap.set(Dt,Lt)}registerParameterPipes(Dt,Lt){if(!this.parameterDecoratorPipes.has(Dt)){this.parameterDecoratorPipes.set(Dt,[])}this.parameterDecoratorPipes.set(Dt,this.parameterDecoratorPipes.get(Dt).concat(Lt))}defineGetterPropertyValue(Dt,Lt,Tn){if(Dt&&Tn){if(Dt.propertyName){Object.defineProperty(Lt,Dt.propertyName,{get:()=>{var Wn;return Tn(Dt.propertyName,(Wn=Dt.metadata)!==null&&Wn!==void 0?Wn:{},Lt)},configurable:true,enumerable:true})}}}getHandler(Dt){if(this.propertyHandlerMap.has(Dt)){return this.propertyHandlerMap.get(Dt)}}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayAspectService)],Er.prototype,"aspectService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],Er.prototype,"init",null);Er=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Er);Lt.MidwayDecoratorService=Er},70275:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayEnvironmentService=void 0;const Gn=Tn(6192);const rr=Tn(65308);const cr=Tn(49757);let pr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,rr.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(Dt){this.environment=Dt}isDevelopmentEnvironment(){return(0,rr.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(Dt){this.moduleLoadType=Dt}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};pr=Wn([(0,cr.Provide)(),(0,cr.Scope)(Gn.ScopeEnum.Singleton)],pr);Lt.MidwayEnvironmentService=pr},33332:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayFrameworkService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(78842);const mr=Tn(34888);const gr=Tn(83872);const yr=Tn(28602);const Sr=Tn(96367);const Er=Tn(70812);const Or=Tn(43436);const Ir=Tn(39023);const Hr=Tn(86314);const Gr=Tn(2222);const $r=Tn(70032);const mi=Ir.debuglog("midway:debug");let ki=class MidwayFrameworkService{constructor(Dt,Lt){this.applicationContext=Dt;this.globalOptions=Lt;this.globalFrameworkList=[]}async init(){var Dt,Lt;this.decoratorService.registerPropertyHandler(rr.CONFIG_KEY,((Dt,Lt)=>{var Tn;if(Lt.identifier===rr.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt)}}));this.decoratorService.registerPropertyHandler(rr.LOGGER_KEY,((Dt,Lt)=>{var Tn;return this.loggerService.getLogger((Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt)}));this.decoratorService.registerPropertyHandler(rr.PIPELINE_IDENTIFIER,((Dt,Lt,Tn)=>{var Wn,Gn;return new yr.MidwayPipelineService((Gn=(Wn=Tn[Gr.REQUEST_OBJ_CTX_KEY])===null||Wn===void 0?void 0:Wn.requestContext)!==null&&Gn!==void 0?Gn:this.applicationContext,Lt.valves)}));this.decoratorService.registerPropertyHandler(rr.APPLICATION_KEY,((Dt,Lt)=>{if(Lt.type){const Dt=this.applicationManager.getApplication(Lt.type);if(!Dt){throw new Hr.MidwayCommonError(`Framework ${Lt.type} not Found`)}return Dt}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(rr.PLUGIN_KEY,((Dt,Lt)=>{var Tn;return this.getMainApp()[(Tn=Lt.identifier)!==null&&Tn!==void 0?Tn:Dt]}));this.decoratorService.registerPropertyHandler(rr.FACTORY_SERVICE_CLIENT_KEY,((Dt,Lt)=>{const Tn=this.applicationContext.get(Lt.serviceFactoryClz);const Wn=Lt.clientName||Tn.getDefaultClientName();if(Wn&&Tn.has(Wn)){return Tn.get(Wn)}else{if(!Wn){throw new Hr.MidwayParameterError(`Please set clientName or options.defaultClientName for ${Lt.serviceFactoryClz.name}).`)}else{throw new Hr.MidwayParameterError(`ClientName(${Wn} not found in ${Lt.serviceFactoryClz.name}).`)}}}));let Tn=(0,rr.listModule)(rr.FRAMEWORK_KEY);Tn=filterProtoFramework(Tn);mi(`[core]: Found Framework length = ${Tn.length}`);if(Tn.length){for(const Lt of Tn){if(!this.applicationContext.hasDefinition((0,rr.getProviderUUId)(Lt))){mi(`[core]: Found Framework "${Lt.name}" but missing definition, skip initialize.`);continue}const Tn=await this.applicationContext.getAsync(Lt,[this.applicationContext]);if(Tn.isEnable()){$r.MidwayInitializerPerformanceManager.frameworkInitializeStart(Tn.getFrameworkName());await Tn.initialize({applicationContext:this.applicationContext,namespace:Tn.getNamespace(),...this.globalOptions});$r.MidwayInitializerPerformanceManager.frameworkInitializeEnd(Tn.getFrameworkName());mi(`[core]: Found Framework "${Tn.getFrameworkName()}" and initialize.`)}else{mi(`[core]: Found Framework "${Tn.getFrameworkName()}" and delay initialize.`)}const Wn=this.applicationContext.registry.getDefinition((0,rr.getProviderUUId)(Lt));Tn.setNamespace(Wn===null||Wn===void 0?void 0:Wn.namespace);this.applicationManager.addFramework((Dt=Wn===null||Wn===void 0?void 0:Wn.namespace)!==null&&Dt!==void 0?Dt:Tn.getFrameworkName(),Tn);this.globalFrameworkList.push(Tn)}let Wn;const Gn=this.applicationContext.getNamespaceList();for(const Dt of Gn){const Lt=this.applicationManager.getApplication(Dt);if(Lt){Wn=Dt;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(Lt=this.applicationManager.getFramework(Wn))!==null&&Lt!==void 0?Lt:this.globalFrameworkList[0];mi(`[core]: Current main Framework is "${Wn}".`)}await this.aspectService.loadAspect()}getMainApp(){var Dt;return(Dt=this.mainFramework)===null||Dt===void 0?void 0:Dt.getApplication()}getMainFramework(){return this.mainFramework}getFramework(Dt){return this.applicationManager.getFramework(Dt)}async runFramework(){const Dt=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((Lt,Tn)=>Dt.indexOf(Lt.getNamespace())-Dt.indexOf(Tn.getNamespace())));for(const Dt of this.globalFrameworkList){if(Dt.isEnable()){$r.MidwayInitializerPerformanceManager.frameworkRunStart(Dt.getFrameworkName());await Dt.run();mi(`[core]: Found Framework "${Dt.getFrameworkName()}" and run.`);$r.MidwayInitializerPerformanceManager.frameworkRunEnd(Dt.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((Dt=>Dt.stop())))}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayConfigService)],ki.prototype,"configService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",mr.MidwayLoggerService)],ki.prototype,"loggerService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Er.MidwayAspectService)],ki.prototype,"aspectService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Sr.MidwayDecoratorService)],ki.prototype,"decoratorService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Or.MidwayApplicationManager)],ki.prototype,"applicationManager",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],ki.prototype,"init",null);ki=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object,Object])],ki);Lt.MidwayFrameworkService=ki;function filterProtoFramework(Dt){const Lt=[];for(const Tn of Dt){let Dt=Object.getPrototypeOf(Tn);while(Dt.name&&Dt.name!==gr.BaseFramework.name){Lt.push(Dt);Dt=Object.getPrototypeOf(Dt)}}return Dt.filter((Dt=>!Lt.includes(Dt)))}},658:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayHealthService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(78842);const mr=Tn(65308);let gr=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(Dt){const Lt=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(Lt);for(const Lt of Dt){if(Lt.instance&&Lt.instance["onHealthCheck"]){this.healthCheckMethods.push({item:Lt.instance["onHealthCheck"].bind(Lt.instance),meta:{namespace:Lt.namespace}})}}}async getStatus(){const Dt=await(0,mr.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((Dt=>({item:Dt.item(this.applicationContext),meta:Dt.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(Dt,Lt)=>{if(Dt["status"]!==undefined){return{namespace:Lt.namespace,...Dt}}else{return{status:false,namespace:Lt.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(Dt,Lt)=>({status:false,namespace:Lt.namespace,reason:Dt.message})});const Lt=Dt.find((Dt=>!Dt.status));return{status:!Lt,namespace:Lt===null||Lt===void 0?void 0:Lt.namespace,reason:Lt===null||Lt===void 0?void 0:Lt.reason,results:Dt}}setCheckTimeout(Dt){this.healthCheckTimeout=Dt}};Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayConfigService)],gr.prototype,"configService",void 0);Wn([(0,rr.ApplicationContext)(),Gn("design:type",Object)],gr.prototype,"applicationContext",void 0);gr=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton)],gr);Lt.MidwayHealthService=gr},37482:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayInformationService=void 0;const rr=Tn(6192);const cr=Tn(65308);const pr=Tn(16928);const mr=Tn(49757);const gr=Tn(79896);let yr=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,pr.dirname)(this.baseDir)}const Dt=(0,pr.join)(this.appDir,"package.json");if((0,gr.existsSync)(Dt)){const Lt=(0,gr.readFileSync)(Dt,{encoding:"utf-8"});this.pkg=JSON.parse(Lt)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,cr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var Dt;return((Dt=this.pkg)===null||Dt===void 0?void 0:Dt["name"])||""}getRoot(){const Dt=(0,cr.isDevelopmentEnvironment)((0,cr.getCurrentEnvironment)());return Dt?this.getAppDir():this.getHome()}};Wn([(0,mr.Inject)(),Gn("design:type",String)],yr.prototype,"appDir",void 0);Wn([(0,mr.Inject)(),Gn("design:type",String)],yr.prototype,"baseDir",void 0);Wn([(0,mr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],yr.prototype,"init",null);yr=Wn([(0,mr.Provide)(),(0,mr.Scope)(rr.ScopeEnum.Singleton)],yr);Lt.MidwayInformationService=yr},13328:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayLifeCycleService=void 0;const rr=Tn(6192);const cr=Tn(49757);const pr=Tn(24451);const mr=Tn(33332);const gr=Tn(78842);const yr=Tn(39023);const Sr=Tn(77306);const Er=Tn(658);const Or=Tn(70032);const Ir=(0,yr.debuglog)("midway:debug");let Hr=class MidwayLifeCycleService{constructor(Dt){this.applicationContext=Dt;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const Dt=(0,cr.listModule)(cr.CONFIGURATION_KEY);Ir(`[core]: Found Configuration length = ${Dt.length}`);for(const Lt of Dt){if(Lt.target instanceof pr.FunctionalConfiguration){Lt.instance=Lt.target}else{Ir(`[core]: Lifecycle run ${Lt.namespace} init`);Lt.instance=await this.applicationContext.getAsync(Lt.target)}Lt.instance&&this.lifecycleInstanceList.push(Lt)}await this.healthService.init(this.lifecycleInstanceList);await Promise.all([this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectCreated"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onObjectInit"),this.runObjectLifeCycle(this.lifecycleInstanceList,"onBeforeObjectDestroy")]);await this.runContainerLifeCycle(this.lifecycleInstanceList,"onConfigLoad",(Dt=>{if(Dt){this.configService.addObject(Dt)}}));await this.mockService.runSimulatorSetup();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onReady");await this.frameworkService.runFramework();await this.runContainerLifeCycle(this.lifecycleInstanceList,"onServerReady");if(!this.configService.getConfiguration("debug.recordConfigMergeOrder")){this.configService.clearConfigMergeOrder()}}async stop(){await this.mockService.runSimulatorTearDown();const Dt=(0,cr.listModule)(cr.CONFIGURATION_KEY)||[];for(const Lt of Dt.reverse()){let Dt;if(Lt.target instanceof pr.FunctionalConfiguration){Dt=Lt.target}else{Dt=await this.applicationContext.getAsync(Lt.target)}await this.runContainerLifeCycle(Dt,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(Dt,Lt,Tn){if(Array.isArray(Dt)){for(const Wn of Dt){if(typeof Wn.instance[Lt]==="function"){Ir(`[core]: Lifecycle run ${Wn.instance.constructor.name} ${Lt}`);Or.MidwayInitializerPerformanceManager.lifecycleStart(Wn.namespace,Lt);const Dt=await Wn.instance[Lt](this.applicationContext,this.frameworkService.getMainApp());if(Tn){Tn(Dt)}Or.MidwayInitializerPerformanceManager.lifecycleEnd(Wn.namespace,Lt)}}}else{if(typeof Dt[Lt]==="function"){const Wn=Dt.constructor.name;Ir(`[core]: Lifecycle run ${Wn} ${Lt}`);Or.MidwayInitializerPerformanceManager.lifecycleStart(Wn,Lt);const Gn=await Dt[Lt](this.applicationContext,this.frameworkService.getMainApp());if(Tn){Tn(Gn)}Or.MidwayInitializerPerformanceManager.lifecycleEnd(Wn,Lt)}}}async runObjectLifeCycle(Dt,Lt){for(const Tn of Dt){if(typeof Tn.instance[Lt]==="function"){Ir(`[core]: Lifecycle run ${Tn.instance.constructor.name} ${Lt}`);return await this.applicationContext[Lt](Tn.instance[Lt].bind(Tn.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};Wn([(0,cr.Inject)(),Gn("design:type",mr.MidwayFrameworkService)],Hr.prototype,"frameworkService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",gr.MidwayConfigService)],Hr.prototype,"configService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Sr.MidwayMockService)],Hr.prototype,"mockService",void 0);Wn([(0,cr.Inject)(),Gn("design:type",Er.MidwayHealthService)],Hr.prototype,"healthService",void 0);Wn([(0,cr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Hr.prototype,"init",null);Hr=Wn([(0,cr.Provide)(),(0,cr.Scope)(rr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Hr);Lt.MidwayLifeCycleService=Hr},34888:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayLoggerService=void 0;const rr=Tn(49757);const cr=Tn(78842);const pr=Tn(64842);const mr=Tn(6192);const gr=Tn(82535);const yr=Tn(86314);let Sr=class MidwayLoggerService extends pr.ServiceFactory{constructor(Dt,Lt={}){super();this.applicationContext=Dt;this.globalOptions=Lt;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var Dt;const Lt=this.configService.getConfiguration("loggerFactory");this.loggerFactory=Lt||this.globalOptions["loggerFactory"]||new gr.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new yr.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const Tn=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(Tn,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(Dt=this.applicationContext)===null||Dt===void 0?void 0:Dt.registerObject("logger",this.getLogger("appLogger"))}createClient(Dt,Lt){if(Dt.aliasName){this.aliasLoggerMap.set(Dt.aliasName,Lt)}if(!Dt.lazyLoad){this.loggerFactory.createLogger(Lt,Dt)}else{delete Dt["lazyLoad"];this.lazyLoggerConfigMap.set(Lt,Dt)}}getName(){return"logger"}createLogger(Dt,Lt){delete Lt["aliasName"];return this.loggerFactory.createLogger(Dt,Lt)}getLogger(Dt){if(this.aliasLoggerMap.has(Dt)){Dt=this.aliasLoggerMap.get(Dt)}const Lt=this.loggerFactory.getLogger(Dt);if(Lt){return Lt}if(this.lazyLoggerConfigMap.has(Dt)){this.createClient(this.lazyLoggerConfigMap.get(Dt),Dt);this.lazyLoggerConfigMap.delete(Dt)}return this.loggerFactory.getLogger(Dt)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(Dt,Lt,Tn){return this.loggerFactory.createContextLogger(Dt,Lt,Tn)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};Wn([(0,rr.Inject)(),Gn("design:type",cr.MidwayConfigService)],Sr.prototype,"configService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],Sr.prototype,"init",null);Sr=Wn([(0,rr.Provide)(),(0,rr.Scope)(mr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object,Object])],Sr);Lt.MidwayLoggerService=Sr},68220:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayMiddlewareService=void 0;const rr=Tn(49757);const cr=Tn(6192);const pr=Tn(86314);const mr=Tn(65308);const gr=Tn(63289);const yr=Tn(39023);const Sr=(0,yr.debuglog)("midway:debug");let Er=class MidwayMiddlewareService{constructor(Dt){this.applicationContext=Dt}async compose(Dt,Lt,Tn){var Wn;if(!Array.isArray(Dt)){throw new pr.MidwayParameterError("Middleware stack must be an array")}const Gn=[];for(let Tn of Dt){if(gr.Types.isClass(Tn)||typeof Tn==="string"||(Tn===null||Tn===void 0?void 0:Tn["middleware"])){let Dt=(Wn=Tn===null||Tn===void 0?void 0:Tn["middleware"])!==null&&Wn!==void 0?Wn:Tn;const rr=Tn===null||Tn===void 0?void 0:Tn["options"];let cr=Tn===null||Tn===void 0?void 0:Tn["name"];if(typeof Dt==="string"&&!this.applicationContext.hasDefinition(Dt)){throw new pr.MidwayCommonError(`Middleware definition of "${Dt}" not found in midway container`)}const gr=await this.applicationContext.getAsync(Dt);if(gr){cr=cr!==null&&cr!==void 0?cr:gr.constructor.name;Dt=await gr.resolve(Lt,rr);if(!Dt){continue}if(!gr.match&&!gr.ignore){if(!Dt.name){Dt._name=cr}Gn.push(Dt)}else{const Lt=(0,mr.pathMatching)({match:gr.match,ignore:gr.ignore,thisResolver:gr});Tn=(Tn,Wn,Gn)=>{if(!Lt(Tn))return Wn();return Dt(Tn,Wn,Gn)};Tn._name=cr;Gn.push(Tn)}}else{throw new pr.MidwayCommonError("Middleware must have resolve method!")}}else{Gn.push(Tn)}}const composeFn=(Dt,Lt)=>{const Wn=(0,mr.isIncludeProperty)(Dt,"body");let rr=-1;return dispatch(0);function dispatch(cr){if(cr<=rr)return Promise.reject(new pr.MidwayCommonError("next() called multiple times"));rr=cr;let mr=Gn[cr];if(cr===Gn.length)mr=Lt;if(!mr)return Promise.resolve();const gr=`${Tn?`${Tn}.`:""}${rr} ${mr._name||mr.name||"anonymous"}`;const yr=Date.now();Sr(`[middleware]: in ${gr} +0`);try{if(Wn){return Promise.resolve(mr(Dt,dispatch.bind(null,cr+1),{index:rr})).then((Lt=>{if(Lt!==undefined&&Lt!==Dt["body"]){Dt["body"]=Lt}else if(Dt["body"]!==undefined){Lt=Dt["body"]}Sr(`[middleware]: out ${gr} +${Date.now()-yr} with body`);return Lt}))}else{return Promise.resolve(mr(Dt,dispatch.bind(null,cr+1),{index:rr})).then((Dt=>{Sr(`[middleware]: out ${gr} +${Date.now()-yr}`);return Dt}))}}catch(Dt){Sr(`[middleware]: out ${gr} +${Date.now()-yr} with err ${Dt.message}`);return Promise.reject(Dt)}}};if(Tn){composeFn._name=Tn}return composeFn}};Er=Wn([(0,rr.Provide)(),(0,rr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Er);Lt.MidwayMiddlewareService=Er},77306:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};var rr;Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayMockService=void 0;const cr=Tn(6192);const pr=Tn(49757);const mr=Tn(63289);let gr=rr=class MidwayMockService{constructor(Dt){this.applicationContext=Dt;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(rr.prepareMocks.length>0){for(const Dt of rr.prepareMocks){this.mockProperty(Dt.obj,Dt.key,Dt.value,Dt.group)}rr.prepareMocks=[]}}static mockClassProperty(Dt,Lt,Tn,Wn="default"){this.mockProperty(Dt.prototype,Lt,Tn,Wn)}static mockProperty(Dt,Lt,Tn,Wn="default"){this.prepareMocks.push({obj:Dt,key:Lt,value:Tn,group:Wn})}mockClassProperty(Dt,Lt,Tn,Wn="default"){return this.mockProperty(Dt.prototype,Lt,Tn,Wn)}mockProperty(Dt,Lt,Tn,Wn="default"){const Gn=Dt.hasOwnProperty(Lt);const rr={obj:Dt,key:Lt,descriptor:Object.getOwnPropertyDescriptor(Dt,Lt),hasOwnProperty:Gn};if(!this.mocks.has(Wn)){this.mocks.set(Wn,[])}this.mocks.get(Wn).push(rr);if(Gn){delete Dt[Lt]}let cr=this.cache.get(Wn);if(!cr){cr=new Map;this.cache.set(Wn,cr)}let pr=cr.get(Dt);if(!pr){pr=new Set;cr.set(Dt,pr)}pr.add(Lt);const mr=this.overridePropertyDescriptor(Tn);Object.defineProperty(Dt,Lt,mr)}mockContext(Dt,Lt,Tn,Wn="default"){if(!this.contextMocks.has(Wn)){this.contextMocks.set(Wn,[])}this.contextMocks.get(Wn).push({app:Dt,key:Lt,value:Tn})}restore(Dt="default"){this.restoreGroup(Dt)}restoreAll(){const Dt=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const Lt of Dt){this.restoreGroup(Lt)}this.simulatorList=[]}restoreGroup(Dt){const Lt=this.mocks.get(Dt)||[];for(let Dt=Lt.length-1;Dt>=0;Dt--){const Tn=Lt[Dt];if(!Tn.hasOwnProperty){delete Tn.obj[Tn.key]}else{Object.defineProperty(Tn.obj,Tn.key,Tn.descriptor)}}this.mocks.delete(Dt);this.contextMocks.delete(Dt);this.cache.delete(Dt);this.simulatorList=this.simulatorList.filter((Lt=>Lt["group"]!==Dt))}isMocked(Dt,Lt,Tn="default"){if((0,mr.isClass)(Dt)){Dt=Dt.prototype}const Wn=this.cache.get(Tn);const Gn=Wn?Wn.get(Dt):undefined;return Gn?Gn.has(Lt):false}applyContextMocks(Dt,Lt){for(const[,Tn]of this.contextMocks){for(const Wn of Tn){if(Wn.app===Dt){const Dt=this.overridePropertyDescriptor(Wn.value);if(typeof Wn.key==="string"){Object.defineProperty(Lt,Wn.key,Dt)}else{Wn.key(Lt)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((Dt,Lt)=>Dt+Lt.length),0)}overridePropertyDescriptor(Dt){const Lt={configurable:true,enumerable:true};if(Dt&&(Dt.get||Dt.set)){Lt.get=Dt.get;Lt.set=Dt.set}else{Lt.value=Dt;Lt.writable=true}return Lt}async initSimulation(Dt="default"){const Lt=(0,pr.listModule)(pr.MOCK_KEY);for(const Tn of Lt){const Lt=await this.applicationContext.getAsync(Tn);if(await Lt.enableCondition()){Lt["group"]=Dt;this.simulatorList.push(Lt)}}}async runSimulatorSetup(){var Dt;for(const Lt of this.simulatorList){await((Dt=Lt.setup)===null||Dt===void 0?void 0:Dt.call(Lt))}}async runSimulatorTearDown(){var Dt;for(let Lt=this.simulatorList.length-1;Lt>=0;Lt--){const Tn=this.simulatorList[Lt];await((Dt=Tn.tearDown)===null||Dt===void 0?void 0:Dt.call(Tn))}}async runSimulatorAppSetup(Dt){var Lt;for(const Tn of this.simulatorList){await((Lt=Tn.appSetup)===null||Lt===void 0?void 0:Lt.call(Tn,Dt))}}async runSimulatorAppTearDown(Dt){var Lt;for(let Tn=this.simulatorList.length-1;Tn>=0;Tn--){const Wn=this.simulatorList[Tn];await((Lt=Wn.appTearDown)===null||Lt===void 0?void 0:Lt.call(Wn,Dt))}}async runSimulatorContextSetup(Dt,Lt){var Tn;for(const Wn of this.simulatorList){await((Tn=Wn.contextSetup)===null||Tn===void 0?void 0:Tn.call(Wn,Dt,Lt))}}async runSimulatorContextTearDown(Dt,Lt){var Tn;for(let Wn=this.simulatorList.length-1;Wn>=0;Wn--){const Gn=this.simulatorList[Wn];await((Tn=Gn===null||Gn===void 0?void 0:Gn.contextTearDown)===null||Tn===void 0?void 0:Tn.call(Gn,Dt,Lt))}}};gr.prepareMocks=[];Wn([(0,pr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],gr.prototype,"init",null);Wn([(0,pr.Destroy)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],gr.prototype,"restoreAll",null);gr=rr=Wn([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],gr);Lt.MidwayMockService=gr},28602:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayPipelineService=Lt.PipelineContext=void 0;const Wn=Tn(49757);class PipelineContext{constructor(Dt){this.info={current:null,currentName:null};this.data=new Map;this.args=Dt}get(Dt){return this.data.get(Dt)}set(Dt,Lt){this.data.set(Dt,Lt)}keys(){const Dt=[];const Lt=this.data.keys();for(const Tn of Lt){Dt.push(Tn)}return Dt}}Lt.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(Dt,Lt){this.applicationContext=Dt;this.valves=Lt}async parallel(Dt){const Lt=this.prepareParallelValves(Dt);const Tn=await Promise.all(Lt);return this.packResult(Tn,false)}async concat(Dt){const Lt=this.prepareParallelValves(Dt);const Tn=await Promise.all(Lt);return this.packResult(Tn,true)}async series(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);const Wn={success:true,result:null};const Gn={};const rr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let cr=1;for(const Dt of Lt){rr.prev=rr.current;rr.prevName=getName(rr.prev);rr.current=Dt;rr.currentName=getName(rr.current);if(cr<Lt.length){rr.next=Lt[cr];rr.nextName=getName(rr.next)}else{rr.next=undefined;rr.nextName=undefined}cr+=1;Tn.info=rr;try{const Lt=await this.applicationContext.getAsync(Dt);const Wn=await Lt.invoke(Tn);let cr=Dt;if(Lt.alias){cr=Lt.alias}Gn[cr]=Wn;rr.prevValue=Wn}catch(Lt){Wn.success=false;Wn.error={valveName:typeof Dt==="string"?Dt:Dt.name,message:Lt.message,error:Lt};return Wn}}Wn.result=Gn;return Wn}async concatSeries(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);const Wn={success:true,result:null};const Gn=[];const rr={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let cr=1;for(const Dt of Lt){rr.prev=rr.current;rr.prevName=getName(rr.prev);rr.current=Dt;rr.currentName=getName(rr.current);if(cr<Lt.length){rr.next=Lt[cr];rr.nextName=getName(rr.next)}else{rr.next=undefined;rr.nextName=undefined}cr+=1;Tn.info=rr;try{const Lt=await this.applicationContext.getAsync(Dt);const Wn=await Lt.invoke(Tn);Gn.push(Wn);rr.prevValue=Wn}catch(Lt){Wn.success=false;Wn.error={valveName:typeof Dt==="string"?Dt:Dt.name,message:Lt.message,error:Lt};return Wn}}Wn.result=Gn;return Wn}async waterfall(Dt){const Lt=await this.concatSeries(Dt);if(Lt.success){const Dt=Lt.result;Lt.result=Dt[Dt.length-1]}return Lt}mergeValves(Dt){let Lt=[];if(this.valves&&this.valves.length>0){Lt=this.valves}let Tn=[];if(Dt){for(const Wn of Dt){if(Lt.includes(Wn)){Tn.push(Wn)}}}else{Tn=Lt}return Tn}prepareParallelValves(Dt){const Lt=this.mergeValves(Dt.valves);const Tn=new PipelineContext(Dt.args);return Lt.map((async Dt=>{const Lt={valveName:Dt,dataKey:Dt,data:null};try{const Wn=await this.applicationContext.getAsync(Dt);if(Wn.alias){Lt.dataKey=Wn.alias}Lt.data=await Wn.invoke(Tn)}catch(Dt){Lt.error=Dt}return Lt}))}packResult(Dt,Lt=false){const Tn={success:true,result:null};let Wn;if(Lt){Wn=[]}else{Wn={}}for(const Gn of Dt){if(Gn.error){Tn.success=false;Tn.error={valveName:typeof Gn.valveName==="string"?Gn.valveName:Gn.valveName.name,message:Gn.error.message,error:Gn.error};return Tn}else{if(Lt){Wn.push(Gn.data)}else{Wn[Gn.dataKey]=Gn.data}}}Tn.result=Wn;return Tn}}Lt.MidwayPipelineService=MidwayPipelineService;function getName(Dt){if(Dt){if(typeof Dt==="string"){return Dt}else{return(0,Wn.getProviderName)(Dt)}}return null}},42592:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.WebRouterCollector=Lt.MidwayServerlessFunctionService=void 0;const rr=Tn(49757);const cr=Tn(19985);const pr=Tn(9288);const mr=Tn(1845);const gr=Tn(50539);const yr=Tn(6192);let Sr=class MidwayServerlessFunctionService extends cr.MidwayWebRouterService{constructor(Dt={}){super(Object.assign({},Dt,{includeFunctionRouter:true}));this.options=Dt}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const Dt of this.routes.values()){for(const Lt of Dt){if(Lt.requestMethod==="all"){Lt.functionTriggerMetadata=Lt.functionTriggerMetadata||{};Lt.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const Dt=(0,rr.listModule)(rr.FUNC_KEY);for(const Lt of Dt){this.collectFunctionRoute(Lt)}}collectFunctionRoute(Dt){var Lt,Tn,Wn,Gn,cr,pr,mr,gr,yr,Sr,Er,Or,Ir,Hr,Gr,$r,mi;const ki=(0,rr.getClassMetadata)(rr.FUNC_KEY,Dt);const Ni=(0,rr.getProviderName)(Dt);const Ri=(0,rr.getProviderUUId)(Dt);const ji="/";if(!this.routes.has(ji)){this.routes.set(ji,[]);this.routesPriority.push({prefix:ji,priority:-999,middleware:[],routerOptions:{},controllerId:Ni,routerModule:Dt})}for(const Ui of ki){if((Lt=Ui["metadata"])===null||Lt===void 0?void 0:Lt["path"]){const Lt=(0,rr.getPropertyDataFromClass)(rr.WEB_ROUTER_PARAM_KEY,Dt,Ui["methodName"])||[];const Er=(0,rr.getPropertyMetadata)(rr.WEB_RESPONSE_KEY,Dt,Ui["methodName"])||[];const Or={id:Ri,prefix:ji,routerName:"",url:Ui["metadata"]["path"],requestMethod:(Wn=(Tn=Ui["metadata"])===null||Tn===void 0?void 0:Tn["method"])!==null&&Wn!==void 0?Wn:"get",method:Ui["methodName"],description:"",summary:"",handlerName:`${Ni}.${Ui["methodName"]}`,funcHandlerName:`${Ni}.${Ui["methodName"]}`,controllerId:Ni,middleware:((Gn=Ui["metadata"])===null||Gn===void 0?void 0:Gn["middleware"])||[],controllerMiddleware:[],requestMetadata:Lt,responseMetadata:Er};const Ir=(0,rr.getPropertyMetadata)(rr.SERVERLESS_FUNC_KEY,Dt,Ui["methodName"])||{};const Hr=(mr=(cr=Ir["functionName"])!==null&&cr!==void 0?cr:(pr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||pr===void 0?void 0:pr["functionName"])!==null&&mr!==void 0?mr:createFunctionName(Dt,Ui["methodName"]);const Gr=(Sr=(gr=Ir["handlerName"])!==null&&gr!==void 0?gr:(yr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||yr===void 0?void 0:yr["handlerName"])!==null&&Sr!==void 0?Sr:Or.funcHandlerName;Or.functionName=Hr;Or.funcHandlerName=Gr;Or.functionTriggerName=Ui["type"];Or.functionTriggerMetadata=Ui["metadata"];Or.functionMetadata={functionName:Hr,...Ir};this.checkDuplicateAndPush(ji,Or)}else{const Lt=(0,rr.getPropertyMetadata)(rr.SERVERLESS_FUNC_KEY,Dt,Ui["methodName"])||{};const Tn=(Ir=(Er=Lt["functionName"])!==null&&Er!==void 0?Er:(Or=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||Or===void 0?void 0:Or["functionName"])!==null&&Ir!==void 0?Ir:createFunctionName(Dt,Ui["methodName"]);const Wn=($r=(Hr=Lt["handlerName"])!==null&&Hr!==void 0?Hr:(Gr=Ui===null||Ui===void 0?void 0:Ui["metadata"])===null||Gr===void 0?void 0:Gr["handlerName"])!==null&&$r!==void 0?$r:`${Ni}.${Ui["methodName"]}`;this.checkDuplicateAndPush(ji,{id:Ri,prefix:ji,routerName:"",url:"",requestMethod:"",method:Ui["methodName"],description:"",summary:"",handlerName:`${Ni}.${Ui["methodName"]}`,funcHandlerName:Wn,controllerId:Ni,middleware:((mi=Ui["metadata"])===null||mi===void 0?void 0:mi["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:Tn,functionTriggerName:Ui["type"],functionTriggerMetadata:Ui["metadata"],functionMetadata:{functionName:Tn,...Lt}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(Dt,Lt,Tn={}){var Wn,Gn;const rr="";if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const cr=(Wn=Lt.functionName)!==null&&Wn!==void 0?Wn:Tn.functionName;this.checkDuplicateAndPush(rr,{id:null,method:Dt,url:Lt.metadata["path"]||"",requestMethod:Lt.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:Lt.handlerName||Tn.handlerName,controllerId:"",middleware:((Gn=Lt.metadata)===null||Gn===void 0?void 0:Gn.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:cr,functionTriggerName:Lt.metadata.name,functionTriggerMetadata:Lt.metadata,functionMetadata:{functionName:cr,...Tn}})}};Sr=Wn([(0,rr.Provide)(),(0,rr.Scope)(yr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Sr);Lt.MidwayServerlessFunctionService=Sr;function createFunctionName(Dt,Lt){return(0,rr.getProviderName)(Dt).replace(/[:#]/g,"-")+"-"+Lt}class WebRouterCollector{constructor(Dt="",Lt={}){this.baseDir=Dt;this.options=Lt}async init(){if(!this.proxy){if(this.baseDir){const Dt=new pr.MidwayContainer;(0,rr.bindContainer)(Dt);Dt.setFileDetector(new mr.CommonJSFileDetector({loadDir:this.baseDir}));await Dt.ready()}if(this.options.includeFunctionRouter){if((0,gr.getCurrentMainFramework)()){this.proxy=await(0,gr.getCurrentMainFramework)().getApplicationContext().getAsync(Sr,[this.options])}else{this.proxy=new Sr(this.options)}}else{if((0,gr.getCurrentMainFramework)()){this.proxy=await(0,gr.getCurrentMainFramework)().getApplicationContext().getAsync(cr.MidwayWebRouterService,[this.options])}else{this.proxy=new cr.MidwayWebRouterService(this.options)}}}}async getRoutePriorityList(){await this.init();return this.proxy.getRoutePriorityList()}async getRouterTable(){await this.init();return this.proxy.getRouterTable()}async getFlattenRouterTable(){await this.init();return this.proxy.getFlattenRouterTable()}}Lt.WebRouterCollector=WebRouterCollector},19985:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayWebRouterService=void 0;const rr=Tn(49757);const cr=Tn(65308);const pr=Tn(86314);const mr=Tn(39023);const gr=Tn(73861);const yr=Tn(63289);const Sr=Tn(6192);const Er=mr.debuglog("midway:debug");let Or=class MidwayWebRouterService{constructor(Dt={}){this.options=Dt;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const Dt=(0,rr.listModule)(rr.CONTROLLER_KEY);for(const Lt of Dt){const Dt=(0,rr.getClassMetadata)(rr.CONTROLLER_KEY,Lt);this.addController(Lt,Dt,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((Dt=>{const Lt=this.routes.get(Dt.prefix);if(Lt.length>0){return true}else{this.routes.delete(Dt.prefix);return false}}));for(const Dt of this.routes.keys()){const Lt=this.routes.get(Dt);this.routes.set(Dt,this.sortRouter(Lt))}this.routesPriority=this.routesPriority.sort(((Dt,Lt)=>Lt.prefix.length-Dt.prefix.length))}addController(Dt,Lt,Tn={},Wn=false){var Gn;if(Tn&&typeof Tn==="boolean"){Wn=Tn;Tn=undefined}if(!Tn){Tn={}}const mr=(0,rr.getProviderName)(Dt);Er(`[core]: Found Controller ${mr}.`);const gr=(0,rr.getProviderUUId)(Dt);Lt.routerOptions=Lt.routerOptions||{};let yr;const Or=Lt.routerOptions.middleware;const Ir=!!((Gn=Lt.routerOptions)===null||Gn===void 0?void 0:Gn.ignoreGlobalPrefix);let Hr=(0,cr.joinURLPath)(this.options.globalPrefix,Lt.prefix||"/");const Gr=Lt.prefix||"/";if(Ir){Hr=Gr}if(/\*/.test(Hr)){throw new pr.MidwayCommonError(`Router prefix ${Hr} can't set string with *`)}if(!this.routes.has(Hr)){this.routes.set(Hr,[]);this.routesPriority.push({prefix:Hr,priority:Hr==="/"&&yr===undefined?-999:0,middleware:Or,routerOptions:Lt.routerOptions,controllerId:mr,routerModule:Dt})}else{if(Or&&Or.length>0){const Dt=this.routesPriority.filter((Dt=>Dt.prefix===Hr))[0];throw new pr.MidwayDuplicateControllerOptionsError(Hr,mr,Dt.controllerId)}}if(!this.routes.has(Gr)){this.routes.set(Gr,[]);this.routesPriority.push({prefix:Gr,priority:Gr==="/"&&yr===undefined?-999:0,middleware:Or,routerOptions:Lt.routerOptions,controllerId:mr,routerModule:Dt})}const $r=(0,rr.getClassMetadata)(rr.WEB_ROUTER_KEY,Dt);if($r&&typeof $r[Symbol.iterator]==="function"){for(const Lt of $r){const Gn=(0,rr.getPropertyDataFromClass)(rr.WEB_ROUTER_PARAM_KEY,Dt,Lt.method)||[];const pr=(0,rr.getPropertyMetadata)(rr.WEB_RESPONSE_KEY,Dt,Lt.method)||[];const yr={id:gr,prefix:Lt.ignoreGlobalPrefix?Gr:Hr,routerName:Lt.routerName||"",url:Lt.path,requestMethod:Lt.requestMethod,method:Lt.method,description:Lt.description||"",summary:Lt.summary||"",handlerName:`${mr}.${Lt.method}`,funcHandlerName:`${mr}.${Lt.method}`,controllerId:mr,controllerClz:Dt,middleware:Lt.middleware||[],controllerMiddleware:Or||[],requestMetadata:Gn,responseMetadata:pr};if(Wn){yr.functionName=mr+"-"+Lt.method;yr.functionTriggerName=Sr.ServerlessTriggerType.HTTP;yr.functionTriggerMetadata={path:(0,cr.joinURLPath)(Hr,Lt.path.toString()),method:Lt.requestMethod};yr.functionMetadata={functionName:yr.functionName}}if(Tn.resourceFilter&&!Tn.resourceFilter(yr)){continue}this.checkDuplicateAndPush(yr.prefix,yr)}}}addRouter(Dt,Lt){const Tn=Lt.prefix||"";Lt.requestMethod=(Lt.requestMethod||"GET").toUpperCase();if(!this.routes.has(Tn)){this.routes.set(Tn,[]);this.routesPriority.push({prefix:Tn,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(Tn,Object.assign(Lt,{method:Dt}));this.sortPrefixAndRouter()}sortRouter(Dt){return Dt.map((Dt=>{const Lt=Dt.url.toString();const Tn=yr.Types.isRegExp(Dt.url)?Lt.split("\\/"):Lt.split("/");let Wn=0;for(const Dt of Tn){if(Dt===""||Dt.includes(":")||Dt.includes("*")){Wn+=0}else{Wn+=1}}let Gn=2;const rr=Lt.includes(":")?Lt.replace(/:.+$/,""):"";if(rr){Gn=1}if(Lt.includes("*")){Gn=0}return{...Dt,_pureRouter:Lt.replace(/\**$/,"").replace(/:\w+/,"123"),_level:Lt.split("/").length-1,_paramString:rr,_category:Gn,_weight:Wn}})).sort(((Dt,Lt)=>{if(Dt._category!==Lt._category){return Lt._category-Dt._category}if(Dt._weight!==Lt._weight){return Lt._weight-Dt._weight}if(Dt._level===Lt._level){if(Lt._pureRouter===Dt._pureRouter){return Dt.url.toString().length-Lt.url.toString().length}return Lt._pureRouter.length-Dt._pureRouter.length}return Lt._level-Dt._level}))}async getRoutePriorityList(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routesPriority}async getRouterTable(){if(!this.isReady){await this.analyze();this.isReady=true}return this.routes}async getFlattenRouterTable(Dt={}){if(!this.isReady){await this.analyze();this.isReady=true}let Lt=[];for(const Dt of this.routesPriority){Lt=Lt.concat(this.routes.get(Dt.prefix))}if(Dt.compileUrlPattern){for(const Dt of Lt){if(Dt.fullUrlFlattenString){Dt.fullUrlCompiledRegexp=gr.PathToRegexpUtil.toRegexp(Dt.fullUrlFlattenString)}}}return Lt}async getMatchedRouterInfo(Dt,Lt){const Tn=await this.getFlattenRouterTable({compileUrlPattern:true});let Wn;for(const Gn of Tn){if(Gn.fullUrlCompiledRegexp){const Tn=Gn["requestMethod"].toUpperCase();if(("ALL"===Tn||Lt.toUpperCase()===Tn)&&Gn.fullUrlCompiledRegexp.test(Dt)){Wn=Gn;break}}}return Wn}checkDuplicateAndPush(Dt,Lt){const Tn=this.routes.get(Dt);const Wn=Tn.filter((Dt=>Lt.url&&Lt.requestMethod&&Dt.url===Lt.url&&Dt.requestMethod===Lt.requestMethod));if(Wn&&Wn.length){throw new pr.MidwayDuplicateRouteError(`${Lt.requestMethod} ${Lt.url}`,`${Wn[0].handlerName}`,`${Lt.handlerName}`)}if(!Lt.fullUrlFlattenString&&Lt.url&&typeof Lt.url==="string"){Lt.fullUrl=(0,cr.joinURLPath)(Dt,Lt.url);if(/\*$/.test(Lt.fullUrl)){Lt.fullUrlFlattenString=Lt.fullUrl.replace("*","(.*)")}else{Lt.fullUrlFlattenString=Lt.fullUrl}}Tn.push(Lt)}};Or=Wn([(0,rr.Provide)(),(0,rr.Scope)(Sr.ScopeEnum.Singleton),Gn("design:paramtypes",[Object])],Or);Lt.MidwayWebRouterService=Or},29222:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.prepareGlobalApplicationContext=Lt.prepareGlobalApplicationContextAsync=Lt.destroyGlobalApplicationContext=Lt.initializeGlobalApplicationContext=void 0;const Wn=Tn(46123);const Gn=Tn(42193);const rr=Tn(49757);const cr=Tn(39023);const pr=Tn(42592);const mr=Tn(16928);const gr=Tn(658);const yr=Tn(70032);const Sr=cr.debuglog("midway:debug");let Er=1;function printStepDebugInfo(Dt){Sr(`\n\nStep ${Er++}: ${Dt}\n`)}async function initializeGlobalApplicationContext(Dt){yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const Lt=await prepareGlobalApplicationContextAsync(Dt);printStepDebugInfo("Init logger");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const Tn=await Lt.getAsync(Wn.MidwayLoggerService,[Lt,Dt]);if(Tn.getLogger("appLogger")){Lt.registerObject("logger",Tn.getLogger("appLogger"))}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await Lt.getAsync(Wn.MidwayMockService,[Lt]);printStepDebugInfo("Init framework");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await Lt.getAsync(Wn.MidwayFrameworkService,[Lt,Dt]);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await Lt.getAsync(Wn.MidwayLifeCycleService,[Lt]);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const Gn=(0,rr.listPreloadModule)();for(const Dt of Gn){await Lt.getAsync(Dt)}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return Lt}Lt.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(Dt){const Lt=await Dt.getAsync(Wn.MidwayLoggerService);const Tn=Lt.getCurrentLoggerFactory();const Gn=await Dt.getAsync(Wn.MidwayLifeCycleService);await Gn.stop();await Dt.stop();(0,rr.clearBindContainer)();Tn.close();yr.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}Lt.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(Dt){var Lt,Tn,Er,Or,Ir;printStepDebugInfo("Ready to create applicationContext");Sr('[core]: start "initializeGlobalApplicationContext"');Sr(`[core]: bootstrap options = ${cr.inspect(Dt)}`);const Hr=(Lt=Dt.appDir)!==null&&Lt!==void 0?Lt:"";const Gr=(Tn=Dt.baseDir)!==null&&Tn!==void 0?Tn:"";yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const $r=(Er=Dt.applicationContext)!==null&&Er!==void 0?Er:new Wn.MidwayContainer;Sr("[core]: delegate module map from decoratorManager");(0,rr.bindContainer)($r);global["MIDWAY_APPLICATION_CONTEXT"]=$r;$r.registerObject("baseDir",Gr);$r.registerObject("appDir",Hr);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);Sr("[core]: set default file detector");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!Dt.moduleLoadType){Dt.moduleLoadType="commonjs"}if(Dt.moduleDetector!==false){Sr("[core]: set module load type = %s",Dt.moduleLoadType);if(!Dt.imports){Dt.imports=[await(0,Wn.loadModule)((0,mr.join)(Gr,`configuration${(0,Wn.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:Dt.moduleLoadType,safeLoad:true})]}if(Dt.moduleDetector===undefined){if(Dt.moduleLoadType==="esm"){$r.setFileDetector(new Wn.ESModuleFileDetector({loadDir:Gr,ignore:(Or=Dt.ignore)!==null&&Or!==void 0?Or:[]}));Dt.moduleLoadType="esm"}else{$r.setFileDetector(new Wn.CommonJSFileDetector({loadDir:Gr,ignore:(Ir=Dt.ignore)!==null&&Ir!==void 0?Ir:[]}))}}}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");$r.bindClass(Wn.MidwayEnvironmentService);$r.bindClass(Wn.MidwayInformationService);$r.bindClass(Wn.MidwayAspectService);$r.bindClass(Wn.MidwayDecoratorService);$r.bindClass(Wn.MidwayConfigService);$r.bindClass(Wn.MidwayLoggerService);$r.bindClass(Wn.MidwayApplicationManager);$r.bindClass(Wn.MidwayFrameworkService);$r.bindClass(Wn.MidwayMiddlewareService);$r.bindClass(Wn.MidwayLifeCycleService);$r.bindClass(Wn.MidwayMockService);$r.bindClass(Wn.MidwayWebRouterService);$r.bindClass(pr.MidwayServerlessFunctionService);$r.bindClass(gr.MidwayHealthService);$r.bindClass(Wn.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(Dt.preloadModules&&Dt.preloadModules.length){for(const Lt of Dt.preloadModules){$r.bindClass(Lt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const mi=$r.get(Wn.MidwayEnvironmentService);mi.setModuleLoadType(Dt.moduleLoadType);const ki=$r.get(Wn.MidwayConfigService);ki.add([{default:Gn.default}]);$r.get(Wn.MidwayAspectService,[$r]);$r.get(Wn.MidwayDecoratorService,[$r]);printStepDebugInfo("Load imports(component) and user code configuration module");$r.load([].concat(Dt.imports).concat(Dt.configurationModule));printStepDebugInfo("Run applicationContext ready method");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await $r.ready();yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Dt.globalConfig){if(Array.isArray(Dt.globalConfig)){ki.add(Dt.globalConfig)}else{ki.addObject(Dt.globalConfig)}}printStepDebugInfo("Load config file");ki.load();Sr("[core]: Current config = %j",ki.getConfiguration());yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);$r.get(Wn.MidwayMiddlewareService,[$r]);return $r}Lt.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(Dt){var Lt,Tn,Er,Or;printStepDebugInfo("Ready to create applicationContext");Sr('[core]: start "initializeGlobalApplicationContext"');Sr(`[core]: bootstrap options = ${cr.inspect(Dt)}`);const Ir=(Lt=Dt.appDir)!==null&&Lt!==void 0?Lt:"";const Hr=(Tn=Dt.baseDir)!==null&&Tn!==void 0?Tn:"";yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Gr=(Er=Dt.applicationContext)!==null&&Er!==void 0?Er:new Wn.MidwayContainer;Sr("[core]: delegate module map from decoratorManager");(0,rr.bindContainer)(Gr);global["MIDWAY_APPLICATION_CONTEXT"]=Gr;Gr.registerObject("baseDir",Hr);Gr.registerObject("appDir",Ir);yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!Dt.moduleLoadType){Dt.moduleLoadType="commonjs"}if(Dt.moduleDetector!==false){if(Dt.moduleDetector===undefined){Gr.setFileDetector(new Wn.CommonJSFileDetector({ignore:(Or=Dt.ignore)!==null&&Or!==void 0?Or:[]}))}else if(Dt.moduleDetector){Gr.setFileDetector(Dt.moduleDetector)}}yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Gr.bindClass(Wn.MidwayEnvironmentService);Gr.bindClass(Wn.MidwayInformationService);Gr.bindClass(Wn.MidwayAspectService);Gr.bindClass(Wn.MidwayDecoratorService);Gr.bindClass(Wn.MidwayConfigService);Gr.bindClass(Wn.MidwayLoggerService);Gr.bindClass(Wn.MidwayApplicationManager);Gr.bindClass(Wn.MidwayFrameworkService);Gr.bindClass(Wn.MidwayMiddlewareService);Gr.bindClass(Wn.MidwayLifeCycleService);Gr.bindClass(Wn.MidwayMockService);Gr.bindClass(Wn.MidwayWebRouterService);Gr.bindClass(pr.MidwayServerlessFunctionService);Gr.bindClass(gr.MidwayHealthService);Gr.bindClass(Wn.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(Dt.preloadModules&&Dt.preloadModules.length){for(const Lt of Dt.preloadModules){Gr.bindClass(Lt)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const $r=Gr.get(Wn.MidwayEnvironmentService);$r.setModuleLoadType(Dt.moduleLoadType);const mi=Gr.get(Wn.MidwayConfigService);mi.add([{default:Gn.default}]);Gr.get(Wn.MidwayAspectService,[Gr]);Gr.get(Wn.MidwayDecoratorService,[Gr]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!Dt.imports){Dt.imports=[(0,Wn.safeRequire)((0,mr.join)(Dt.baseDir,"configuration"))]}Gr.load([].concat(Dt.imports).concat(Dt.configurationModule));printStepDebugInfo("Run applicationContext ready method");yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Gr.ready();yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);yr.MidwayInitializerPerformanceManager.markStart(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(Dt.globalConfig){if(Array.isArray(Dt.globalConfig)){mi.add(Dt.globalConfig)}else{mi.addObject(Dt.globalConfig)}}printStepDebugInfo("Load config file");mi.load();Sr("[core]: Current config = %j",mi.getConfiguration());yr.MidwayInitializerPerformanceManager.markEnd(yr.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Gr.get(Wn.MidwayMiddlewareService,[Gr]);return Gr}Lt.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.pascalCase=Lt.camelCase=void 0;const Tn=/[\p{Lu}]/u;const Wn=/[\p{Ll}]/u;const Gn=/([\p{Alpha}\p{N}_]|$)/u;const rr=/[_.\- ]+/;const cr=new RegExp("^"+rr.source);const pr=new RegExp(rr.source+Gn.source,"gu");const mr=new RegExp("\\d+"+Gn.source,"gu");const preserveCamelCase=(Dt,Lt,Gn)=>{let rr=false;let cr=false;let pr=false;for(let mr=0;mr<Dt.length;mr++){const gr=Dt[mr];if(rr&&Tn.test(gr)){Dt=Dt.slice(0,mr)+"-"+Dt.slice(mr);rr=false;pr=cr;cr=true;mr++}else if(cr&&pr&&Wn.test(gr)){Dt=Dt.slice(0,mr-1)+"-"+Dt.slice(mr-1);pr=cr;cr=false;rr=true}else{rr=Lt(gr)===gr&&Gn(gr)!==gr;pr=cr;cr=Gn(gr)===gr&&Lt(gr)!==gr}}return Dt};const postProcess=(Dt,Lt)=>{pr.lastIndex=0;mr.lastIndex=0;return Dt.replace(pr,((Dt,Tn)=>Lt(Tn))).replace(mr,(Dt=>Lt(Dt)))};function camelCaseOrigin(Dt,Lt){Lt={pascalCase:false,...Lt};Dt=Dt.trim();if(Dt.length===0){return""}const toLowerCase=Dt=>Dt.toLowerCase();const toUpperCase=Dt=>Dt.toUpperCase();if(Dt.length===1){if(rr.test(Dt)){return""}return Lt.pascalCase?toUpperCase(Dt):toLowerCase(Dt)}const Tn=Dt!==toLowerCase(Dt);if(Tn){Dt=preserveCamelCase(Dt,toLowerCase,toUpperCase)}Dt=Dt.replace(cr,"");Dt=toLowerCase(Dt);if(Lt.pascalCase){Dt=toUpperCase(Dt.charAt(0))+Dt.slice(1)}return postProcess(Dt,toUpperCase)}function camelCase(Dt){return camelCaseOrigin(Dt,{pascalCase:false})}Lt.camelCase=camelCase;function pascalCase(Dt){return camelCaseOrigin(Dt,{pascalCase:true})}Lt.pascalCase=pascalCase},50539:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getCurrentAsyncContextManager=Lt.getCurrentMainApp=Lt.getCurrentMainFramework=Lt.getCurrentApplicationContext=void 0;const Wn=Tn(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];Lt.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];Lt.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const Dt=(0,Lt.getCurrentMainFramework)();if(Dt){return Dt.getApplication()}return undefined};Lt.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,Lt.getCurrentApplicationContext)().get(Wn.ASYNC_CONTEXT_MANAGER_KEY);Lt.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.extend=void 0;const Wn=Tn(63289);function extend(...Dt){let Lt,Tn,Gn,rr,cr;let pr=Dt[0];let mr=1;const gr=Dt.length;let yr=false;if(typeof pr==="boolean"){yr=pr;pr=Dt[1]||{};mr=2}else if(typeof pr!=="object"&&typeof pr!=="function"||pr==null){pr={}}for(;mr<gr;++mr){Lt=Dt[mr];if(Lt==null)continue;for(Tn in Lt){if(Tn==="__proto__")continue;Gn=pr[Tn];rr=Lt[Tn];if(pr===rr)continue;if(yr&&rr&&Wn.Types.isPlainObject(rr)){cr=Gn&&Wn.Types.isPlainObject(Gn)?Gn:{};pr[Tn]=extend(yr,cr,rr)}else if(typeof rr!=="undefined"){pr[Tn]=rr}}}return pr}Lt.extend=extend},2764:(Dt,Lt)=>{"use strict";
|
|
2
2
|
/*! (c) 2020 Andrea Giammarchi */Object.defineProperty(Lt,"__esModule",{value:true});Lt.safeStringify=Lt.safeParse=void 0;const{parse:Tn,stringify:Wn}=JSON;const{keys:Gn}=Object;const rr=String;const cr="string";const pr={};const mr="object";const noop=(Dt,Lt)=>Lt;const primitives=Dt=>Dt instanceof rr?rr(Dt):Dt;const Primitives=(Dt,Lt)=>typeof Lt===cr?new rr(Lt):Lt;const revive=(Dt,Lt,Tn,Wn)=>{const cr=[];for(let gr=Gn(Tn),{length:yr}=gr,Sr=0;Sr<yr;Sr++){const Gn=gr[Sr];const yr=Tn[Gn];if(yr instanceof rr){const rr=Dt[yr];if(typeof rr===mr&&!Lt.has(rr)){Lt.add(rr);Tn[Gn]=pr;cr.push({k:Gn,a:[Dt,Lt,rr,Wn]})}else Tn[Gn]=Wn.call(Tn,Gn,rr)}else if(Tn[Gn]!==pr)Tn[Gn]=Wn.call(Tn,Gn,yr)}for(let{length:Dt}=cr,Lt=0;Lt<Dt;Lt++){const{k:Dt,a:Gn}=cr[Lt];Tn[Dt]=Wn.call(Tn,Dt,revive.apply(null,Gn))}return Tn};const set=(Dt,Lt,Tn)=>{const Wn=rr(Lt.push(Tn)-1);Dt.set(Tn,Wn);return Wn};function safeParse(Dt,Lt){const Wn=Tn(Dt,Primitives).map(primitives);const Gn=Wn[0];const rr=Lt||noop;const cr=typeof Gn===mr&&Gn?revive(Wn,new Set,Gn,rr):Gn;return rr.call({"":cr},"",cr)}Lt.safeParse=safeParse;function safeStringify(Dt,Lt,Tn){const Gn=Lt&&typeof Lt===mr?(Dt,Tn)=>Dt===""||-1<Lt.indexOf(Dt)?Tn:void 0:Lt||noop;const rr=new Map;const pr=[];const gr=[];let yr=+set(rr,pr,Gn.call({"":Dt},"",Dt));let Sr=!yr;while(yr<pr.length){Sr=true;gr[yr]=Wn(pr[yr++],replace,Tn)}return"["+gr.join(",")+"]";function replace(Dt,Lt){if(Sr){Sr=!Sr;return Lt}const Tn=Gn.call(this,Dt,Lt);switch(typeof Tn){case mr:if(Tn===null)return Tn;case cr:return rr.get(Tn)||set(rr,pr,Tn)}return Tn}}Lt.safeStringify=safeStringify},30001:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FORMAT=void 0;const Tn=1e3;const Wn=Tn*60;const Gn=Wn*60;const rr=Gn*24;const cr=rr*7;const pr=rr*365.25;const mr={ONE_SECOND:Tn,ONE_MINUTE:Wn,ONE_HOUR:Gn,ONE_DAY:rr,ONE_WEEK:cr,ONE_YEAR:pr};const gr={EVERY_SECOND:"* * * * * *",EVERY_MINUTE:"0 * * * * *",EVERY_HOUR:"0 0 * * * *",EVERY_DAY:"0 0 0 * * *",EVERY_DAY_ZERO_FIFTEEN:"0 15 0 * * *",EVERY_DAY_ONE_FIFTEEN:"0 15 1 * * *",EVERY_PER_5_SECOND:"*/5 * * * * *",EVERY_PER_10_SECOND:"*/10 * * * * *",EVERY_PER_30_SECOND:"*/30 * * * * *",EVERY_PER_5_MINUTE:"0 */5 * * * *",EVERY_PER_10_MINUTE:"0 */10 * * * *",EVERY_PER_30_MINUTE:"0 */30 * * * *"};Lt.FORMAT={MS:mr,CRONTAB:gr}},7589:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FileUtils=Lt.exists=void 0;const Wn=Tn(79896);async function exists(Dt){return Wn.promises.access(Dt,Wn.constants.F_OK).then((()=>true)).catch((()=>false))}Lt.exists=exists;Lt.FileUtils={exists:exists}},87653:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpClient=Lt.makeHttpRequest=void 0;const Wn=Tn(58611);const Gn=Tn(65692);const rr=Tn(87016);const cr=Tn(39023);const pr=Tn(86314);const mr=(0,cr.debuglog)("request-client");const gr=rr.URL;const yr={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(Dt,Lt){return Dt[Lt]||Dt[Lt.toLowerCase()]||Dt[Lt.toUpperCase()]}async function makeHttpRequest(Dt,Lt={}){mr(`request '${Dt}'`);const Tn=new gr(Dt);const rr=Tn.protocol==="https:"?Gn:Wn;Lt.method=(Lt.method||"GET").toUpperCase();const{contentType:cr,dataType:Sr,method:Er,timeout:Or=5e3,headers:Ir,...Hr}=Lt;const Gr={Accept:yr[Sr]||yr.octet,...Ir};let $r;if(Er==="GET"&&Lt.data){for(const Dt of Object.keys(Lt.data)){Tn.searchParams.set(Dt,Lt.data[Dt])}Gr["Content-Length"]=0}else if(Lt.data){$r=Buffer.from(JSON.stringify(Lt.data));if(!isHeaderExists(Gr,"Content-Type")){Gr["Content-Type"]=yr[cr]||yr.octet}if(!isHeaderExists(Gr,"Content-Length")){Gr["Content-Length"]=$r.byteLength}}return new Promise(((Lt,Wn)=>{const Gn=rr.request(Tn.toString(),{method:Er,headers:Gr,...Hr},(Tn=>{Tn.setTimeout(Or,(()=>{Tn.destroy(new Error("Response Timeout"))}));Tn.on("error",(Dt=>{Wn(Dt)}));const Gn=[];Tn.on("data",(Dt=>{Gn.push(Dt)}));Tn.on("end",(()=>{let rr=Buffer.concat(Gn);if(Sr==="text"||Sr==="json"){rr=rr.toString("utf8")}if(Sr==="json"){try{rr=JSON.parse(rr)}catch(Dt){return Wn(new Error("[httpclient] Unable to parse response data"))}}Object.assign(Tn,{status:Tn.statusCode,data:rr});mr(`request '${Dt}' resolved with status ${Tn.statusCode}`);Lt(Tn)}))}));Gn.setTimeout(Or,(()=>{Gn.destroy(new pr.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));Gn.on("error",(Dt=>{Wn(Dt)}));if(Er!=="GET"){Gn.end($r)}else{Gn.end()}}))}Lt.makeHttpRequest=makeHttpRequest;class HttpClient{constructor(Dt={}){this.defaultOptions=Dt}async request(Dt,Lt){return makeHttpRequest(Dt,Object.assign({},this.defaultOptions,Lt))}}Lt.HttpClient=HttpClient},65308:(Dt,Lt,Tn)=>{"use strict";Dt=Tn.nmd(Dt);Object.defineProperty(Lt,"__esModule",{value:true});Lt.Utils=Lt.createPromiseTimeoutInvokeChain=Lt.isTypeScriptEnvironment=Lt.toAsyncFunction=Lt.merge=Lt.generateRandomId=Lt.getParamNames=Lt.sleep=Lt.wrapAsync=Lt.isIncludeProperty=Lt.wrapMiddleware=Lt.pathMatching=Lt.toPathMatch=Lt.transformRequestObjectByType=Lt.deprecatedOutput=Lt.getCurrentDateString=Lt.delegateTargetProperties=Lt.delegateTargetMethod=Lt.delegateTargetAllPrototypeMethod=Lt.delegateTargetPrototypeMethod=Lt.joinURLPath=Lt.getUserHome=Lt.parsePrefix=Lt.safelyGet=Lt.loadModule=Lt.safeRequire=Lt.getCurrentEnvironment=Lt.isDevelopmentEnvironment=void 0;const Wn=Tn(16928);const Gn=Tn(79896);const rr=Tn(39023);const cr=Tn(14142);const pr=Tn(73861);const mr=Tn(86314);const gr=Tn(90406);const yr=Tn(2897);const Sr=Tn(2764);const Er=Tn(76982);const Or=Tn(63289);const Ir=Tn(87016);const Hr=(0,rr.debuglog)("midway:debug");const isDevelopmentEnvironment=Dt=>["local","test","unittest"].includes(Dt);Lt.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";Lt.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(Lt,Tn=true)=>{if(Lt.startsWith(`.${Wn.sep}`)||Lt.startsWith(`..${Wn.sep}`)){Lt=(0,Wn.resolve)((0,Wn.dirname)(Dt.parent.filename),Lt)}try{if(Tn){return require(Lt)}else{const Dt=(0,Gn.readFileSync)(Lt,{encoding:"utf-8"});return JSON.parse(Dt)}}catch(Dt){Hr(`[core]: SafeRequire Warning\n\n${Dt.message}\n`);return undefined}};Lt.safeRequire=safeRequire;const Gr={};const loadModule=async(Lt,rr={})=>{var cr,pr,mr;rr.enableCache=(cr=rr.enableCache)!==null&&cr!==void 0?cr:true;rr.safeLoad=(pr=rr.safeLoad)!==null&&pr!==void 0?pr:false;rr.loadMode=(mr=rr.loadMode)!==null&&mr!==void 0?mr:"commonjs";if(Lt.startsWith(`.${Wn.sep}`)||Lt.startsWith(`..${Wn.sep}`)){Lt=(0,Wn.resolve)((0,Wn.dirname)(Dt.parent.filename),Lt)}Hr(`[core]: load module ${Lt}, cache: ${rr.enableCache}, mode: ${rr.loadMode}, safeLoad: ${rr.safeLoad}`);try{if(rr.enableCache){if(rr.loadMode==="commonjs"){return require(Lt)}else{if(Lt.endsWith(".json")){if(!Gr[Lt]){const Dt=(0,Gn.readFileSync)(Lt,{encoding:"utf-8"});Gr[Lt]=JSON.parse(Dt)}return Gr[Lt]}else{return await Tn(53196)((0,Ir.pathToFileURL)(Lt).href)}}}else{const Dt=(0,Gn.readFileSync)(Lt,{encoding:"utf-8"});return JSON.parse(Dt)}}catch(Dt){if(!rr.safeLoad){throw Dt}else{Hr(`[core]: SafeLoadModule Warning\n\n${Dt.message}\n`);return undefined}}};Lt.loadModule=loadModule;function safelyGet(Dt,Lt){if(arguments.length===1){return Lt=>safelyGet(Dt,Lt)}if(typeof Lt==="undefined"||typeof Lt!=="object"||Lt===null){return void 0}const Tn=typeof Dt==="string"?Dt.split("."):Dt;let Wn=Lt;for(const Dt of Tn){if(typeof Wn==="undefined"||Wn===null){return void 0}else if(typeof Wn!=="object"){return void 0}Wn=Wn[Dt]}return Wn}Lt.safelyGet=safelyGet;function parsePrefix(Dt){if(Dt.includes("@")){return Dt.slice(1)}return Dt}Lt.parsePrefix=parsePrefix;function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}Lt.getUserHome=getUserHome;function joinURLPath(...Dt){Dt=Dt.filter((Dt=>!!Dt));if(Dt.length===0){return""}let Lt=Wn.posix.join(...Dt);Lt=Lt.replace(/\/+$/,"");if(!/^\//.test(Lt)){Lt="/"+Lt}return Lt}Lt.joinURLPath=joinURLPath;function delegateTargetPrototypeMethod(Dt,Lt,Tn){Lt.forEach((Lt=>{if(Lt.prototype){Object.getOwnPropertyNames(Lt.prototype).forEach((Lt=>{if(Lt!=="constructor"&&!/^_/.test(Lt)&&!Dt.prototype[Lt]){Dt.prototype[Lt]=function(...Dt){return this.instance[Lt](...Dt)}}}))}}));if(Tn){delegateTargetMethod(Dt,Tn)}}Lt.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;function delegateTargetAllPrototypeMethod(Dt,Lt){do{delegateTargetPrototypeMethod(Dt,[Lt]);Lt=Object.getPrototypeOf(Lt)}while(Lt)}Lt.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;function delegateTargetMethod(Dt,Lt){Lt.forEach((Lt=>{Dt.prototype[Lt]=function(...Dt){return this.instance[Lt](...Dt)}}))}Lt.delegateTargetMethod=delegateTargetMethod;function delegateTargetProperties(Dt,Lt){Lt.forEach((Lt=>{Object.defineProperty(Dt.prototype,Lt,{get(){return this.instance[Lt]}})}))}Lt.delegateTargetProperties=delegateTargetProperties;const getCurrentDateString=(Dt=Date.now())=>{const Lt=new Date(Dt);return`${Lt.getFullYear()}-${(Lt.getMonth()+1).toString().padStart(2,"0")}-${Lt.getDate().toString().padStart(2,"0")}`};Lt.getCurrentDateString=getCurrentDateString;const deprecatedOutput=Dt=>{console.warn("DeprecationWarning: "+Dt)};Lt.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(Dt,Lt)=>{if(Lt===undefined||Lt===null||Lt===Object||typeof Dt==="undefined"){return Dt}switch(Lt){case Number:return Number(Dt);case String:return String(Dt);case Boolean:if(Dt==="0"||Dt==="false"){return false}return Boolean(Dt);default:if(Dt instanceof Lt){return Dt}else{const Tn=cr["plainToClass"]||cr["plainToInstance"];return Tn(Lt,Dt)}}};Lt.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(Dt){if(typeof Dt==="boolean"){return Lt=>Dt}if(typeof Dt==="string"){const Lt=pr.PathToRegexpUtil.toRegexp(Dt.replace("*","(.*)"));if(Lt.global)Lt.lastIndex=0;return Dt=>Lt.test(Dt.path)}if(Dt instanceof RegExp){return Lt=>{if(Dt.global)Dt.lastIndex=0;return Dt.test(Lt.path)}}if(typeof Dt==="function")return Dt;if(Array.isArray(Dt)){const Lt=Dt.map((Dt=>toPathMatch(Dt)));return Dt=>Lt.some((Lt=>Lt(Dt)))}throw new mr.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+Dt)}Lt.toPathMatch=toPathMatch;function pathMatching(Dt){Dt=Dt||{};if(Dt.match&&Dt.ignore)throw new mr.MidwayCommonError("options.match and options.ignore can not both present");if(!Dt.match&&!Dt.ignore)return()=>true;if(Dt.match&&!Array.isArray(Dt.match)){Dt.match=[Dt.match]}if(Dt.ignore&&!Array.isArray(Dt.ignore)){Dt.ignore=[Dt.ignore]}const createMatch=Lt=>{const Tn=Lt.map((Lt=>{if(Dt.thisResolver){return toPathMatch(Lt).bind(Dt.thisResolver)}return toPathMatch(Lt)}));return Dt=>{for(let Lt=0;Lt<Tn.length;Lt++){const Wn=Tn[Lt](Dt);if(Wn){return true}}return false}};const Lt=Dt.match?createMatch(Dt.match):createMatch(Dt.ignore);return function pathMatch(Tn){const Wn=Lt(Tn);return Dt.match?Wn:!Wn}}Lt.pathMatching=pathMatching;function wrapMiddleware(Dt,Lt){if(Lt.enable===false)return null;if(!Lt.match&&!Lt.ignore)return Dt;const Tn=pathMatching(Lt);const fn=(Lt,Wn)=>{if(!Tn(Lt))return Wn();return Dt(Lt,Wn)};fn._name=Dt._name+"middlewareWrapper";return fn}Lt.wrapMiddleware=wrapMiddleware;function isOwnPropertyWritable(Dt,Lt){if(Dt==null)return false;const Tn=typeof Dt;if(Tn!=="object"&&Tn!=="function")return false;return!!Object.getOwnPropertyDescriptor(Dt,Lt)}function isIncludeProperty(Dt,Lt){while(Dt){if(isOwnPropertyWritable(Dt,Lt))return true;Dt=Object.getPrototypeOf(Dt)}return false}Lt.isIncludeProperty=isIncludeProperty;function wrapAsync(Dt){return(...Lt)=>{if(typeof Lt[Lt.length-1]==="function"){const Tn=Lt.pop();if(Dt.constructor.name!=="AsyncFunction"){const Dt=new TypeError("Must be an AsyncFunction");return Tn(Dt)}return Dt.apply(Dt,Lt).then((Dt=>{Tn(null,Dt)}),(Dt=>{Tn(Dt)}))}else{return Dt.apply(Dt,Lt)}}}Lt.wrapAsync=wrapAsync;function sleep(Dt=1e3){return new Promise((Lt=>{setTimeout((()=>{Lt()}),Dt)}))}Lt.sleep=sleep;const $r=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(Dt){const Lt=Dt.toString().replace($r,"");let Tn=Lt.slice(Lt.indexOf("(")+1,Lt.indexOf(")")).split(",").map((Dt=>Dt.trim().replace(/\s?=.*$/,"")));if(Tn.length===1&&Tn[0]===""){Tn=[]}return Tn}Lt.getParamNames=getParamNames;function generateRandomId(){return Er.randomBytes(16).toString("hex")}Lt.generateRandomId=generateRandomId;function merge(Dt,Lt){if(!Dt){Dt=Lt;Lt=null}if(!Dt){return null}if(Array.isArray(Dt)){return Dt.concat(Lt||[])}if(typeof Dt==="object"){return Object.assign({},Dt,Lt)}throw new Error("can not merge meta that type of "+typeof Dt)}Lt.merge=merge;function toAsyncFunction(Dt){if(Or.Types.isAsyncFunction(Dt)){return Dt}else{return async function(...Lt){return Promise.resolve(Dt.call(this,...Lt))}}}Lt.toAsyncFunction=toAsyncFunction;function isTypeScriptEnvironment(){const Dt=process.env.MIDWAY_TS_MODE;if("false"===Dt){return false}return Dt==="true"||!!require.extensions[".ts"]}Lt.isTypeScriptEnvironment=isTypeScriptEnvironment;async function createPromiseTimeoutInvokeChain(Dt){var Lt;if(!Dt.onSuccess){Dt.onSuccess=async Dt=>Dt}Dt.isConcurrent=(Lt=Dt.isConcurrent)!==null&&Lt!==void 0?Lt:true;Dt.promiseItems=Dt.promiseItems.map((Dt=>{if(Dt instanceof Promise){return{item:Dt}}else{return Dt}}));Dt.promiseItems=Dt.promiseItems.filter((Dt=>Dt["item"]instanceof Promise));if(Dt.isConcurrent){const Lt=Dt.promiseItems.map((Lt=>{const Tn=new Promise(((Tn,Wn)=>{var Gn;setTimeout((()=>{var Tn;return Wn(new mr.MidwayCodeInvokeTimeoutError(Dt.methodName,(Tn=Lt["timeout"])!==null&&Tn!==void 0?Tn:Dt.timeout))}),(Gn=Lt["timeout"])!==null&&Gn!==void 0?Gn:Dt.timeout)}));return Promise.race([Lt["item"],Tn]).then((Tn=>Dt.onSuccess(Tn,Lt["meta"]))).catch((Tn=>Dt.onFail(Tn,Lt["meta"])))}));return Promise.all(Lt)}else{const Lt=[];for(const Tn of Dt.promiseItems){const Wn=new Promise(((Lt,Wn)=>{var Gn;setTimeout((()=>{var Lt;return Wn(new mr.MidwayCodeInvokeTimeoutError(Dt.methodName,(Lt=Tn["timeout"])!==null&&Lt!==void 0?Lt:Dt.timeout))}),(Gn=Tn["timeout"])!==null&&Gn!==void 0?Gn:Dt.timeout)}));try{const Gn=await Promise.race([Tn["item"],Wn]).then((Lt=>Dt.onSuccess(Lt,Tn["meta"])));Lt.push(Gn)}catch(Wn){Lt.push(Dt.onFail(Wn,Tn["meta"]));break}}return Lt}}Lt.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;Lt.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:gr.camelCase,pascalCase:gr.pascalCase,randomUUID:yr.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:Sr.safeStringify,safeParse:Sr.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},61327:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getModuleRequirePathList=Lt.PathFileUtil=Lt.getFileContentSync=Lt.isPathEqual=Lt.isPath=void 0;const Wn=Tn(16928);const Gn=Tn(79896);function isPath(Dt){if(/(^[\.\/])|:|\\/.test(Dt)){return true}return false}Lt.isPath=isPath;function isPathEqual(Dt,Lt){if(!Dt||!Lt){return false}const Tn=(0,Wn.extname)(Dt);return Dt.replace(Tn,"")===Lt}Lt.isPathEqual=isPathEqual;function getFileContentSync(Dt,Lt){return typeof Dt==="string"?(0,Gn.readFileSync)(Dt,{encoding:Lt}):Dt}Lt.getFileContentSync=getFileContentSync;Lt.PathFileUtil={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync};function getModuleRequirePathList(Dt){const Lt=[Dt,Dt.replace(/\//g,"_")];let Tn={};const Wn=[];Object.keys(require.cache||{}).forEach((Dt=>{let Gn=-1;for(const Dt of Lt){const Lt=Dt.indexOf(Dt);if(Lt!==-1){Gn=Lt;break}}if(Gn===-1){return}const rr=Dt.slice(0,Gn);if(Tn[rr]){return}Tn[rr]=true;Wn.push(rr)}));Tn=undefined;return Wn}Lt.getModuleRequirePathList=getModuleRequirePathList},73861:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.PathToRegexpUtil=void 0;function lexer(Dt){const Lt=[];let Tn=0;while(Tn<Dt.length){const Wn=Dt[Tn];if(Wn==="*"||Wn==="+"||Wn==="?"){Lt.push({type:"MODIFIER",index:Tn,value:Dt[Tn++]});continue}if(Wn==="\\"){Lt.push({type:"ESCAPED_CHAR",index:Tn++,value:Dt[Tn++]});continue}if(Wn==="{"){Lt.push({type:"OPEN",index:Tn,value:Dt[Tn++]});continue}if(Wn==="}"){Lt.push({type:"CLOSE",index:Tn,value:Dt[Tn++]});continue}if(Wn===":"){let Wn="";let Gn=Tn+1;while(Gn<Dt.length){const Lt=Dt.charCodeAt(Gn);if(Lt>=48&&Lt<=57||Lt>=65&&Lt<=90||Lt>=97&&Lt<=122||Lt===95){Wn+=Dt[Gn++];continue}break}if(!Wn)throw new TypeError(`Missing parameter name at ${Tn}`);Lt.push({type:"NAME",index:Tn,value:Wn});Tn=Gn;continue}if(Wn==="("){let Wn=1;let Gn="";let rr=Tn+1;if(Dt[rr]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${rr}`)}while(rr<Dt.length){if(Dt[rr]==="\\"){Gn+=Dt[rr++]+Dt[rr++];continue}if(Dt[rr]===")"){Wn--;if(Wn===0){rr++;break}}else if(Dt[rr]==="("){Wn++;if(Dt[rr+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${rr}`)}}Gn+=Dt[rr++]}if(Wn)throw new TypeError(`Unbalanced pattern at ${Tn}`);if(!Gn)throw new TypeError(`Missing pattern at ${Tn}`);Lt.push({type:"PATTERN",index:Tn,value:Gn});Tn=rr;continue}Lt.push({type:"CHAR",index:Tn,value:Dt[Tn++]})}Lt.push({type:"END",index:Tn,value:""});return Lt}function parse(Dt,Lt={}){const Tn=lexer(Dt);const{prefixes:Wn="./"}=Lt;const Gn=`[^${escapeString(Lt.delimiter||"/#?")}]+?`;const rr=[];let cr=0;let pr=0;let mr="";const tryConsume=Dt=>{if(pr<Tn.length&&Tn[pr].type===Dt)return Tn[pr++].value};const mustConsume=Dt=>{const Lt=tryConsume(Dt);if(Lt!==undefined)return Lt;const{type:Wn,index:Gn}=Tn[pr];throw new TypeError(`Unexpected ${Wn} at ${Gn}, expected ${Dt}`)};const consumeText=()=>{let Dt="";let Lt;while(Lt=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){Dt+=Lt}return Dt};while(pr<Tn.length){const Dt=tryConsume("CHAR");const Lt=tryConsume("NAME");const Tn=tryConsume("PATTERN");if(Lt||Tn){let pr=Dt||"";if(Wn.indexOf(pr)===-1){mr+=pr;pr=""}if(mr){rr.push(mr);mr=""}rr.push({name:Lt||cr++,prefix:pr,suffix:"",pattern:Tn||Gn,modifier:tryConsume("MODIFIER")||""});continue}const pr=Dt||tryConsume("ESCAPED_CHAR");if(pr){mr+=pr;continue}if(mr){rr.push(mr);mr=""}const gr=tryConsume("OPEN");if(gr){const Dt=consumeText();const Lt=tryConsume("NAME")||"";const Tn=tryConsume("PATTERN")||"";const Wn=consumeText();mustConsume("CLOSE");rr.push({name:Lt||(Tn?cr++:""),pattern:Lt&&!Tn?Gn:Tn,prefix:Dt,suffix:Wn,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return rr}function compile(Dt,Lt){return tokensToFunction(parse(Dt,Lt),Lt)}function tokensToFunction(Dt,Lt={}){const Tn=flags(Lt);const{encode:Wn=Dt=>Dt,validate:Gn=true}=Lt;const rr=Dt.map((Dt=>{if(typeof Dt==="object"){return new RegExp(`^(?:${Dt.pattern})$`,Tn)}}));return Lt=>{let Tn="";for(let cr=0;cr<Dt.length;cr++){const pr=Dt[cr];if(typeof pr==="string"){Tn+=pr;continue}const mr=Lt?Lt[pr.name]:undefined;const gr=pr.modifier==="?"||pr.modifier==="*";const yr=pr.modifier==="*"||pr.modifier==="+";if(Array.isArray(mr)){if(!yr){throw new TypeError(`Expected "${pr.name}" to not repeat, but got an array`)}if(mr.length===0){if(gr)continue;throw new TypeError(`Expected "${pr.name}" to not be empty`)}for(let Dt=0;Dt<mr.length;Dt++){const Lt=Wn(mr[Dt],pr);if(Gn&&!rr[cr].test(Lt)){throw new TypeError(`Expected all "${pr.name}" to match "${pr.pattern}", but got "${Lt}"`)}Tn+=pr.prefix+Lt+pr.suffix}continue}if(typeof mr==="string"||typeof mr==="number"){const Dt=Wn(String(mr),pr);if(Gn&&!rr[cr].test(Dt)){throw new TypeError(`Expected "${pr.name}" to match "${pr.pattern}", but got "${Dt}"`)}Tn+=pr.prefix+Dt+pr.suffix;continue}if(gr)continue;const Sr=yr?"an array":"a string";throw new TypeError(`Expected "${pr.name}" to be ${Sr}`)}return Tn}}function match(Dt,Lt){const Tn=[];const Wn=toRegexp(Dt,Tn,Lt);return regexpToFunction(Wn,Tn,Lt)}function regexpToFunction(Dt,Lt,Tn={}){const{decode:Wn=Dt=>Dt}=Tn;return function(Tn){const Gn=Dt.exec(Tn);if(!Gn)return false;const{0:rr,index:cr}=Gn;const pr=Object.create(null);for(let Dt=1;Dt<Gn.length;Dt++){if(Gn[Dt]===undefined)continue;const Tn=Lt[Dt-1];if(Tn.modifier==="*"||Tn.modifier==="+"){pr[Tn.name]=Gn[Dt].split(Tn.prefix+Tn.suffix).map((Dt=>Wn(Dt,Tn)))}else{pr[Tn.name]=Wn(Gn[Dt],Tn)}}return{path:rr,index:cr,params:pr}}}function escapeString(Dt){return Dt.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(Dt){return Dt&&Dt.sensitive?"":"i"}function regexpToRegexp(Dt,Lt){if(!Lt)return Dt;const Tn=/\((?:\?<(.*?)>)?(?!\?)/g;let Wn=0;let Gn=Tn.exec(Dt.source);while(Gn){Lt.push({name:Gn[1]||Wn++,prefix:"",suffix:"",modifier:"",pattern:""});Gn=Tn.exec(Dt.source)}return Dt}function arrayToRegexp(Dt,Lt,Tn){const Wn=Dt.map((Dt=>toRegexp(Dt,Lt,Tn).source));return new RegExp(`(?:${Wn.join("|")})`,flags(Tn))}function stringToRegexp(Dt,Lt,Tn){return tokensToRegexp(parse(Dt,Tn),Lt,Tn)}function tokensToRegexp(Dt,Lt,Tn={}){const{strict:Wn=false,start:Gn=true,end:rr=true,encode:cr=Dt=>Dt,delimiter:pr="/#?",endsWith:mr=""}=Tn;const gr=`[${escapeString(mr)}]|$`;const yr=`[${escapeString(pr)}]`;let Sr=Gn?"^":"";for(const Tn of Dt){if(typeof Tn==="string"){Sr+=escapeString(cr(Tn))}else{const Dt=escapeString(cr(Tn.prefix));const Wn=escapeString(cr(Tn.suffix));if(Tn.pattern){if(Lt)Lt.push(Tn);if(Dt||Wn){if(Tn.modifier==="+"||Tn.modifier==="*"){const Lt=Tn.modifier==="*"?"?":"";Sr+=`(?:${Dt}((?:${Tn.pattern})(?:${Wn}${Dt}(?:${Tn.pattern}))*)${Wn})${Lt}`}else{Sr+=`(?:${Dt}(${Tn.pattern})${Wn})${Tn.modifier}`}}else{if(Tn.modifier==="+"||Tn.modifier==="*"){Sr+=`((?:${Tn.pattern})${Tn.modifier})`}else{Sr+=`(${Tn.pattern})${Tn.modifier}`}}}else{Sr+=`(?:${Dt}${Wn})${Tn.modifier}`}}}if(rr){if(!Wn)Sr+=`${yr}?`;Sr+=!Tn.endsWith?"$":`(?=${gr})`}else{const Lt=Dt[Dt.length-1];const Tn=typeof Lt==="string"?yr.indexOf(Lt[Lt.length-1])>-1:Lt===undefined;if(!Wn){Sr+=`(?:${yr}(?=${gr}))?`}if(!Tn){Sr+=`(?=${yr}|${gr})`}}return new RegExp(Sr,flags(Tn))}function toRegexp(Dt,Lt,Tn){if(Dt instanceof RegExp)return regexpToRegexp(Dt,Lt);if(Array.isArray(Dt))return arrayToRegexp(Dt,Lt,Tn);return stringToRegexp(Dt,Lt,Tn)}Lt.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},25198:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.retryWith=Lt.retryWithAsync=void 0;const Wn=Tn(65308);const Gn=Tn(86314);function retryWithAsync(Dt,Lt=1,Tn={}){let rr=Lt;let cr;return async(...pr)=>{do{try{return await Dt.bind(Tn.receiver||this)(...pr)}catch(Dt){cr=Dt}if(Tn.retryInterval>=0){await(0,Wn.sleep)(Tn.retryInterval)}}while(rr-- >0);if(Tn.throwOriginError){throw cr}else{throw new Gn.MidwayRetryExceededMaxTimesError(Dt.name||"anonymous",Lt,cr)}}}Lt.retryWithAsync=retryWithAsync;function retryWith(Dt,Lt=1,Tn={}){let Wn=Lt;let rr;return(...cr)=>{do{try{return Dt.bind(Tn.receiver||this)(...cr)}catch(Dt){rr=Dt}}while(Wn-- >0);if(Tn.throwOriginError){throw rr}else{throw new Gn.MidwayRetryExceededMaxTimesError(Dt.name||"anonymous",Lt,rr)}}}Lt.retryWith=retryWith},63289:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Types=Lt.isNullOrUndefined=Lt.isNull=Lt.isUndefined=Lt.isRegExp=Lt.isSet=Lt.isMap=Lt.isProxy=Lt.isNumber=Lt.isPlainObject=Lt.isObject=Lt.isFunction=Lt.isPromise=Lt.isGeneratorFunction=Lt.isAsyncFunction=Lt.isClass=Lt.isString=void 0;const Wn=Tn(39023);const Gn=Function.prototype.toString;const rr=Object.prototype.hasOwnProperty;const cr=Object.prototype.toString;function isString(Dt){return typeof Dt==="string"}Lt.isString=isString;function isClass(Dt){if(typeof Dt!=="function"){return false}if(/^class[\s{]/.test(Gn.call(Dt))){return true}}Lt.isClass=isClass;function isAsyncFunction(Dt){return Wn.types.isAsyncFunction(Dt)}Lt.isAsyncFunction=isAsyncFunction;function isGeneratorFunction(Dt){return Wn.types.isGeneratorFunction(Dt)}Lt.isGeneratorFunction=isGeneratorFunction;function isPromise(Dt){return Wn.types.isPromise(Dt)}Lt.isPromise=isPromise;function isFunction(Dt){return typeof Dt==="function"}Lt.isFunction=isFunction;function isObject(Dt){return Dt!==null&&typeof Dt==="object"}Lt.isObject=isObject;function isPlainObject(Dt){if(!Dt||cr.call(Dt)!=="[object Object]"){return false}const Lt=rr.call(Dt,"constructor");const Tn=Dt.constructor&&Dt.constructor.prototype&&rr.call(Dt.constructor.prototype,"isPrototypeOf");if(Dt.constructor&&!Lt&&!Tn){return false}let Wn;for(Wn in Dt){}return typeof Wn==="undefined"||rr.call(Dt,Wn)}Lt.isPlainObject=isPlainObject;function isNumber(Dt){return typeof Dt==="number"}Lt.isNumber=isNumber;function isProxy(Dt){return Wn.types.isProxy(Dt)}Lt.isProxy=isProxy;function isMap(Dt){return Wn.types.isMap(Dt)}Lt.isMap=isMap;function isSet(Dt){return Wn.types.isSet(Dt)}Lt.isSet=isSet;function isRegExp(Dt){return Wn.types.isRegExp(Dt)}Lt.isRegExp=isRegExp;function isUndefined(Dt){return Dt===undefined}Lt.isUndefined=isUndefined;function isNull(Dt){return Dt===null}Lt.isNull=isNull;function isNullOrUndefined(Dt){return isUndefined(Dt)||isNull(Dt)}Lt.isNullOrUndefined=isNullOrUndefined;Lt.Types={isClass:isClass,isAsyncFunction:isAsyncFunction,isGeneratorFunction:isGeneratorFunction,isString:isString,isPromise:isPromise,isFunction:isFunction,isObject:isObject,isPlainObject:isPlainObject,isNumber:isNumber,isProxy:isProxy,isMap:isMap,isSet:isSet,isRegExp:isRegExp,isUndefined:isUndefined,isNull:isNull,isNullOrUndefined:isNullOrUndefined}},2897:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.randomUUID=void 0;const Wn=Tn(76982);const Gn=new Uint8Array(256);let rr=Gn.length;function rng(){if(rr>Gn.length-16){Wn.randomFillSync(Gn);rr=0}return Gn.slice(rr,rr+=16)}const cr=[];for(let Dt=0;Dt<256;++Dt){cr.push((Dt+256).toString(16).slice(1))}function unsafeStringify(Dt,Lt=0){return(cr[Dt[Lt+0]]+cr[Dt[Lt+1]]+cr[Dt[Lt+2]]+cr[Dt[Lt+3]]+"-"+cr[Dt[Lt+4]]+cr[Dt[Lt+5]]+"-"+cr[Dt[Lt+6]]+cr[Dt[Lt+7]]+"-"+cr[Dt[Lt+8]]+cr[Dt[Lt+9]]+"-"+cr[Dt[Lt+10]]+cr[Dt[Lt+11]]+cr[Dt[Lt+12]]+cr[Dt[Lt+13]]+cr[Dt[Lt+14]]+cr[Dt[Lt+15]]).toLowerCase()}function randomUUID(Dt){if(!Dt&&Wn["randomUUID"]){return Wn["randomUUID"]()}const Lt=rng();Lt[6]=Lt[6]&15|64;Lt[8]=Lt[8]&63|128;return unsafeStringify(Lt)}Lt.randomUUID=randomUUID},46422:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.extractExpressLikeValue=Lt.extractKoaLikeValue=void 0;const Wn=Tn(49757);const Gn=Tn(65308);const extractKoaLikeValue=(Dt,Lt,Tn)=>{if(Wn.ALL===Lt){Lt=undefined}return function(rr,cr){switch(Dt){case Wn.RouteParamTypes.NEXT:return cr;case Wn.RouteParamTypes.BODY:return(0,Gn.transformRequestObjectByType)(Lt&&rr.request.body?rr.request.body[Lt]:rr.request.body,Tn);case Wn.RouteParamTypes.PARAM:return(0,Gn.transformRequestObjectByType)(Lt?rr.params[Lt]:rr.params,Tn);case Wn.RouteParamTypes.QUERY:return(0,Gn.transformRequestObjectByType)(Lt?rr.query[Lt]:rr.query,Tn);case Wn.RouteParamTypes.HEADERS:return(0,Gn.transformRequestObjectByType)(Lt?rr.get(Lt):rr.headers,Tn);case Wn.RouteParamTypes.SESSION:return(0,Gn.transformRequestObjectByType)(Lt?rr.session[Lt]:rr.session,Tn);case Wn.RouteParamTypes.FILESTREAM:if(rr.getFileStream){return rr.getFileStream(Lt)}else if(rr.files){if(Array.isArray(rr.files)){return rr.files[0]}else{return rr.files}}else{return undefined}case Wn.RouteParamTypes.FILESSTREAM:if(rr.multipart){return rr.multipart(Lt)}else if(rr.files){return rr.files}else{return undefined}case Wn.RouteParamTypes.REQUEST_PATH:return rr["path"];case Wn.RouteParamTypes.REQUEST_IP:return rr["ip"];case Wn.RouteParamTypes.QUERIES:if(rr.queries){return(0,Gn.transformRequestObjectByType)(Lt?rr.queries[Lt]:rr.queries,Tn)}else{return(0,Gn.transformRequestObjectByType)(Lt?rr.query[Lt]:rr.query,Tn)}case Wn.RouteParamTypes.FIELDS:return Lt?rr.fields[Lt]:rr.fields;case Wn.RouteParamTypes.CUSTOM:return Lt?Lt(rr):undefined;default:return null}}};Lt.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(Dt,Lt,Tn)=>{if(Wn.ALL===Lt){Lt=undefined}return function(rr,cr,pr){switch(Dt){case Wn.RouteParamTypes.NEXT:return pr;case Wn.RouteParamTypes.BODY:return(0,Gn.transformRequestObjectByType)(Lt&&rr.body?rr.body[Lt]:rr.body,Tn);case Wn.RouteParamTypes.PARAM:return(0,Gn.transformRequestObjectByType)(Lt?rr.params[Lt]:rr.params,Tn);case Wn.RouteParamTypes.QUERY:return(0,Gn.transformRequestObjectByType)(Lt?rr.query[Lt]:rr.query,Tn);case Wn.RouteParamTypes.HEADERS:return(0,Gn.transformRequestObjectByType)(Lt?rr.get(Lt):rr.headers,Tn);case Wn.RouteParamTypes.SESSION:return(0,Gn.transformRequestObjectByType)(Lt?rr.session[Lt]:rr.session,Tn);case Wn.RouteParamTypes.FILESTREAM:return rr.files?rr.files[0]:undefined;case Wn.RouteParamTypes.FILESSTREAM:return rr.files;case Wn.RouteParamTypes.REQUEST_PATH:return rr["baseUrl"];case Wn.RouteParamTypes.REQUEST_IP:return rr["ip"];case Wn.RouteParamTypes.QUERIES:if(rr.queries){return(0,Gn.transformRequestObjectByType)(Lt?rr.queries[Lt]:rr.queries,Tn)}else{return(0,Gn.transformRequestObjectByType)(Lt?rr.query[Lt]:rr.query,Tn)}case Wn.RouteParamTypes.FIELDS:return Lt?rr.fields[Lt]:rr.fields;case Wn.RouteParamTypes.CUSTOM:return Lt?Lt(rr,cr):undefined;default:return null}}};Lt.extractExpressLikeValue=extractExpressLikeValue},73317:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.AbstractEventBus=Lt.AckResponder=Lt.createWaitHandler=void 0;const Wn=Tn(48001);const Gn=Tn(39023);const rr=Tn(68108);const cr="_default_";const pr=null;function revertError(Dt){const Lt=new Error;Lt.name=Dt.name;Lt.message=Dt.message;Lt.stack=Dt.stack;return Lt}class MessageLimitSet extends Set{constructor(Dt){super();this.limit=Dt}add(Dt){if(this.size<this.limit){return super.add(Dt)}}}async function createWaitHandler(Dt,Lt={}){await new Promise(((Tn,Wn)=>{const Gn=setTimeout((()=>{clearInterval(cr);clearTimeout(Gn);Wn(new rr.EventBusTimeoutError)}),Lt.timeout||5e3);const cr=setInterval((()=>{if(Dt()){clearInterval(cr);clearTimeout(Gn);Tn(true)}}),Lt.timeoutCheckInterval||500)}))}Lt.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(Dt){this.debugLogger=Dt;this.buffer=[]}publish(Dt){this.buffer.push(Dt);if(this.waitingPromiseDeferred){const Dt=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;Dt.resolve(this.buffer.shift())}}error(Dt){if(this.waitingPromiseDeferred){const Lt=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;Lt.reject(Dt)}else{this.errorRisen=Dt}this.clear()}[Symbol.asyncIterator](){return this}async tryToGetNextData(){if(this.errorRisen){throw this.errorRisen}if(this.buffer.length>0){return this.buffer.shift()}else{const Dt={};Dt.promise=new Promise(((Lt,Tn)=>{Dt.resolve=Lt;Dt.reject=Tn}));this.waitingPromiseDeferred=Dt;return Dt.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:Dt,isEnd:Lt}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",Dt,Lt);if(Lt){this.clear();return{value:undefined,done:true}}else{return{value:Dt,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(Dt){this.dataHandler=Dt}onError(Dt){this.errorHandler=Dt}end(Dt){if(!this.isEndFlag){this.isEndFlag=true;if(Dt){this.sendData(Dt)}this.sendData(pr)}}sendData(Dt){if(this.dataHandler){this.dataHandler(Dt)}}send(Dt){if(!this.isEndFlag){this.sendData(Dt)}}error(Dt){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(Dt)}}}isEnd(){return this.isEndFlag}}Lt.AckResponder=AckResponder;class AbstractEventBus{constructor(Dt={}){this.options=Dt;this.isInited=false;this.workers=[];this.stopping=false;this.workerReady=new Map;this.topicListener=new Map;this.topicMessageCache=new Map;this.asyncMessageMap=new Map;this.eventListenerMap=new Map;this.debugLogger=this.createDebugger();this.debugLogger(`Start EventBus(${this.constructor.name}) in ${this.isWorker()?"worker":"main"}`);this.eventListenerMap.set(Wn.ListenerType.Error,(Dt=>{console.error(Dt)}));this.listener=(Dt,Lt)=>{var Tn,Gn;const rr=this.topicListener.get(((Tn=Dt.messageOptions)===null||Tn===void 0?void 0:Tn.topic)||cr);if(rr){for(const Tn of rr){if(Tn["_subscribeOnce"]){rr.delete(Tn)}new Promise((async(Wn,Gn)=>{try{await Wn(Tn(Dt,Lt))}catch(Dt){Gn(Dt)}})).catch((Dt=>{if(Lt){Lt.error(Dt)}else{this.eventListenerMap.get(Wn.ListenerType.Error)(Dt)}}))}}else{const Tn=((Gn=Dt.messageOptions)===null||Gn===void 0?void 0:Gn.topic)||cr;if(!this.topicMessageCache.has(Tn)){this.topicMessageCache.set(Tn,new MessageLimitSet(10))}this.topicMessageCache.get(Tn).add({message:Dt,responder:Lt})}};this.setupEventBind()}createDebugger(){return(0,Gn.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(Dt){if(Dt.messageCategory===Wn.MessageCategory.IN){if(this.isMain()){return`${Dt.message.type}|${Dt.messageCategory}: worker => main(△)`}else{return`${Dt.message.type}|${Dt.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${Dt.message.type}|${Dt.messageCategory}: main(△) => worker`}else{return`${Dt.message.type}|${Dt.messageCategory}: worker(△) => main`}}}async start(Dt){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((Dt=>{this.transit({messageCategory:Wn.MessageCategory.IN,message:Dt})}));this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:Wn.MessageType.Inited,body:this.isInited,error:Dt?{name:Dt.name,message:Dt.message,stack:Dt.stack}:undefined}})}}addWorker(Dt){this.debugLogger(`Add worker(${this.getWorkerId(Dt)})`);if(!this.workerReady.has(this.getWorkerId(Dt))){this.debugLogger(`Init worker(${this.getWorkerId(Dt)}) status = false`);this.workerReady.set(this.getWorkerId(Dt),{worker:Dt,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(Dt)}) status`)}Dt===null||Dt===void 0?void 0:Dt["on"]("exit",(async Lt=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(Dt));const Lt=this.workers.findIndex((Lt=>this.getWorkerId(Lt)===this.getWorkerId(Dt)));this.workers.splice(Lt,1)}}));this.workerListenMessage(Dt,(Dt=>{this.transit({messageCategory:Wn.MessageCategory.IN,message:Dt})}));this.workers.push(Dt)}isAllWorkerReady(){for(const[Dt,Lt]of this.workerReady){if(!Lt||!Lt.ready){this.debugLogger(`Worker(${Dt}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=Dt=>{var Lt,Tn,Gn,rr,cr,mr,gr,yr,Sr,Er,Or,Ir,Hr,Gr,$r;if(!Dt.message||!Dt.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(Dt),Dt);const mi=Dt.message;if(Dt.messageCategory===Wn.MessageCategory.OUT){if(mi.type===Wn.MessageType.Invoke||mi.type===Wn.MessageType.Request||mi.type===Wn.MessageType.Response||mi.type===Wn.MessageType.Broadcast){this.postMessage(mi);(Lt=this.eventListenerMap.get(Wn.ListenerType.Request))===null||Lt===void 0?void 0:Lt(mi)}else if(mi.type===Wn.MessageType.Inited){this.postMessage(mi);(Tn=this.eventListenerMap.get(Wn.ListenerType.Inited))===null||Tn===void 0?void 0:Tn(mi)}}else if(Dt.messageCategory===Wn.MessageCategory.IN){if(mi.type===Wn.MessageType.Invoke){const Dt=((Gn=mi.messageOptions)===null||Gn===void 0?void 0:Gn["isChunk"])===true;const Lt=new AckResponder;Lt.onData((Tn=>{var Gn;this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:Wn.MessageType.Response,body:Tn,messageOptions:{relatedMessageId:mi.messageId,isChunk:Dt,topic:(Gn=mi.messageOptions)===null||Gn===void 0?void 0:Gn.topic}}});if(!Dt){Lt.end()}}));Lt.onError((Tn=>{this.publish(Tn,{relatedMessageId:mi.messageId,isChunk:Dt});Lt.end()}));(rr=this.listener)===null||rr===void 0?void 0:rr.call(this,mi,Lt);(cr=this.eventListenerMap.get(Wn.ListenerType.Subscribe))===null||cr===void 0?void 0:cr(mi)}else if(mi.type===Wn.MessageType.Request){(mr=this.listener)===null||mr===void 0?void 0:mr.call(this,mi);(gr=this.eventListenerMap.get(Wn.ListenerType.Subscribe))===null||gr===void 0?void 0:gr(mi)}else if(mi.type===Wn.MessageType.Broadcast){if(this.isMain()){if(mi.messageOptions["includeMainFromWorker"]===true){(yr=this.listener)===null||yr===void 0?void 0:yr.call(this,mi);(Sr=this.eventListenerMap.get(Wn.ListenerType.Subscribe))===null||Sr===void 0?void 0:Sr(mi)}this.broadcast(mi.body,{...mi.messageOptions,relatedMessageId:mi.messageId,relatedWorkerId:mi.workerId})}else{(Er=this.listener)===null||Er===void 0?void 0:Er.call(this,mi);(Or=this.eventListenerMap.get(Wn.ListenerType.Subscribe))===null||Or===void 0?void 0:Or(mi)}}else if(mi.type===Wn.MessageType.Response){if((Ir=mi.messageOptions)===null||Ir===void 0?void 0:Ir.relatedMessageId){const Dt=this.asyncMessageMap.get(mi.messageOptions.relatedMessageId);const Lt=mi.messageOptions["isChunk"]===true;if(Dt){if(!Lt||Lt&&mi.body===pr){this.asyncMessageMap.delete(mi.messageOptions.relatedMessageId)}Dt(mi.error?revertError(mi.error):undefined,mi.body,Lt?mi.body===pr:true)}else{}}else{(Hr=this.listener)===null||Hr===void 0?void 0:Hr.call(this,mi);(Gr=this.eventListenerMap.get(Wn.ListenerType.Subscribe))===null||Gr===void 0?void 0:Gr(mi)}}else if(mi.type===Wn.MessageType.Inited){if(this.isMain()){if(mi.error){this.debugLogger(`got worker ${mi.workerId} ready failed`);this.eventListenerMap.get(Wn.ListenerType.Error)(revertError(mi.error))}else{($r=this.eventListenerMap.get(Wn.ListenerType.Inited))===null||$r===void 0?void 0:$r(mi);this.workerReady.get(mi.workerId).ready=true;this.debugLogger(`got worker ${mi.workerId} ready`)}}else{}}}}}transit(Dt){this.messageReceiver(Dt)}subscribe(Dt,Lt={}){const Tn=Lt.topic||cr;if(!this.topicListener.has(Tn)){this.topicListener.set(Tn,new Set)}if(Lt.subscribeOnce){Dt["_subscribeOnce"]=true}this.topicListener.get(Tn).add(Dt);Dt["_abortController"]={abort:()=>{this.topicListener.get(Tn).delete(Dt)}};if(this.topicMessageCache.has(Tn)&&this.topicMessageCache.get(Tn).size>0){for(const Dt of this.topicMessageCache.get(Tn)){this.listener(Dt.message,Dt.responder);if(Lt.subscribeOnce){break}}this.topicMessageCache.get(Tn).clear()}return Dt["_abortController"]}subscribeOnce(Dt,Lt={}){Lt.subscribeOnce=true;return this.subscribe(Dt,Lt)}publish(Dt,Lt={}){if(Dt instanceof Error){this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:Lt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?Wn.MessageType.Request:Wn.MessageType.Response,body:undefined,error:{name:Dt.name,message:Dt.message,stack:Dt.stack},messageOptions:Lt}})}else{this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:Lt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?Wn.MessageType.Request:Wn.MessageType.Response,body:Dt,messageOptions:Lt}})}}publishAsync(Dt,Lt={}){return new Promise(((Tn,Gn)=>{const rr=Lt.relatedMessageId||this.generateMessageId();this.useTimeout(rr,Lt.timeout,Tn,Gn);this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:rr,workerId:this.getWorkerId(),type:Wn.MessageType.Invoke,body:Dt,messageOptions:{topic:Lt.topic,dispatchToken:Lt.dispatchToken}}})}))}publishChunk(Dt,Lt={}){const Tn=Lt.relatedMessageId||this.generateMessageId();const Gn=new ChunkIterator(this.debugLogger);this.useTimeout(Tn,Lt.timeout,((Dt,Lt)=>{Gn.publish({data:Dt,isEnd:Lt})}),(Dt=>{Gn.error(Dt)}));this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:Tn,workerId:this.getWorkerId(),type:this.isMain()?Wn.MessageType.Invoke:Wn.MessageType.Response,body:Dt,messageOptions:{isChunk:true,topic:Lt.topic}}});return Gn}useTimeout(Dt,Lt=5e3,Tn,Wn){const Gn=setTimeout((()=>{clearTimeout(Gn);this.asyncMessageMap.delete(Dt);Wn(new rr.EventBusPublishTimeoutError(Dt))}),Lt);this.asyncMessageMap.set(Dt,((Dt,Lt,rr)=>{if(rr||Dt){clearTimeout(Gn)}if(Dt){Wn(Dt)}else{Tn(Lt,rr)}}))}broadcast(Dt,Lt={}){if(this.isWorker()){Lt={includeMainFromWorker:false,includeSelfFromWorker:false,...Lt}}this.transit({messageCategory:Wn.MessageCategory.OUT,message:{messageId:Lt.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:Wn.MessageType.Broadcast,body:Dt,messageOptions:Lt}})}postMessage(Dt){var Lt,Tn,Gn,cr,pr,mr,gr,yr;if(this.isMain()){if(this.workers.length>0){if(Dt.type===Wn.MessageType.Broadcast){if(Dt.messageOptions&&Dt.messageOptions["relatedWorkerId"]){this.workers.forEach((Lt=>{if(Dt.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(Lt)===Dt.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(Lt,Dt)}}))}else{this.workers.forEach((Lt=>this.mainSendMessage(Lt,Dt)))}}else if((Lt=Dt.messageOptions)===null||Lt===void 0?void 0:Lt["targetWorkerId"]){const Lt=(Gn=this.workerReady.get((Tn=Dt.messageOptions)===null||Tn===void 0?void 0:Tn["targetWorkerId"]))===null||Gn===void 0?void 0:Gn.worker;if(!Lt){throw new rr.EventBusPublishSpecifyWorkerError((cr=Dt.messageOptions)===null||cr===void 0?void 0:cr["targetWorkerId"])}this.mainSendMessage(Lt,Dt)}else{if(this.options.dispatchStrategy){const Lt=this.options.dispatchStrategy(this.workers,(pr=Dt.messageOptions)===null||pr===void 0?void 0:pr.dispatchToken);if(Lt){try{this.mainSendMessage(Lt,Dt)}catch(Lt){(mr=this.eventListenerMap.get(Wn.ListenerType.Error))===null||mr===void 0?void 0:mr(new rr.EventBusMainPostError(Dt,Lt))}}else{throw new rr.EventBusDispatchStrategyError}}else{const[Lt,...Tn]=this.workers;try{this.mainSendMessage(Lt,Dt)}catch(Lt){(gr=this.eventListenerMap.get(Wn.ListenerType.Error))===null||gr===void 0?void 0:gr(new rr.EventBusMainPostError(Dt,Lt))}this.workers=[...Tn,Lt]}}}}else{try{this.workerSendMessage(Dt)}catch(Lt){(yr=this.eventListenerMap.get(Wn.ListenerType.Error))===null||yr===void 0?void 0:yr(new rr.EventBusWorkerPostError(Dt,Lt))}}}onInited(Dt){this.eventListenerMap.set(Wn.ListenerType.Inited,Dt)}onPublish(Dt){this.eventListenerMap.set(Wn.ListenerType.Request,Dt)}onSubscribe(Dt){this.eventListenerMap.set(Wn.ListenerType.Subscribe,Dt)}onError(Dt){this.eventListenerMap.set(Wn.ListenerType.Error,Dt)}async stop(){this.stopping=true;this.workerReady.clear();this.eventListenerMap.clear();this.listener=null;this.workers.length=0}generateMessageId(){return Math.random().toString(36).substring(2)}}Lt.AbstractEventBus=AbstractEventBus},4779:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ChildProcessEventBus=void 0;const Wn=Tn(73317);const Gn=Tn(29907);const rr=Tn(932);class ChildProcessEventBus extends Wn.AbstractEventBus{workerSubscribeMessage(Dt){rr.on("message",Dt)}workerListenMessage(Dt,Lt){Dt.on("message",Lt)}workerSendMessage(Dt){rr.send(Dt)}mainSendMessage(Dt,Lt){Dt.send(Lt)}isMain(){return!this.isWorker()}isWorker(){var Dt;return(Dt=this.options.isWorker)!==null&&Dt!==void 0?Dt:Gn.isWorker}getWorkerId(Dt){var Lt;return String(Dt?(Lt=Dt.pid)!==null&&Lt!==void 0?Lt:Dt===null||Dt===void 0?void 0:Dt["process"].pid:rr.pid)}}Lt.ChildProcessEventBus=ChildProcessEventBus},68108:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.EventBusDispatchStrategyError=Lt.EventBusPublishSpecifyWorkerError=Lt.EventBusWorkerPostError=Lt.EventBusMainPostError=Lt.EventBusTimeoutError=Lt.EventBusPublishTimeoutError=void 0;const Wn=Tn(39023);class EventBusPublishTimeoutError extends Error{constructor(Dt){super(`Message(${Dt}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}Lt.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}Lt.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(Dt,Lt){super((0,Wn.format)("Main thread post message [%j] error => %s.",Dt,Lt.stack));this.name="EventBusMainPostError"}}Lt.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(Dt,Lt){super((0,Wn.format)("Worker post message [%j] error => %j.",Dt,Lt.stack));this.name="EventBusWorkerPostError"}}Lt.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(Dt){super((0,Wn.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",Dt));this.name="EventBusPublishSpecifyWorkerError"}}Lt.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}Lt.EventBusDispatchStrategyError=EventBusDispatchStrategyError},5982:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Gn(Tn(41836),Lt);Gn(Tn(4779),Lt);Gn(Tn(97633),Lt);Gn(Tn(68108),Lt);Gn(Tn(48001),Lt)},48001:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MessageCategory=Lt.ListenerType=Lt.MessageType=void 0;var Tn;(function(Dt){Dt["Inited"]="inited";Dt["Request"]="request";Dt["Response"]="response";Dt["Invoke"]="invoke";Dt["Broadcast"]="broadcast"})(Tn=Lt.MessageType||(Lt.MessageType={}));var Wn;(function(Dt){Dt["Inited"]="inited";Dt["Request"]="request";Dt["Subscribe"]="Subscribe";Dt["WorkerChanged"]="worker_changed";Dt["Error"]="error"})(Wn=Lt.ListenerType||(Lt.ListenerType={}));var Gn;(function(Dt){Dt["IN"]="in";Dt["OUT"]="out"})(Gn=Lt.MessageCategory||(Lt.MessageCategory={}))},97633:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.LocalEventBus=void 0;const Wn=Tn(73317);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const Gn=new LocalDispatcher;class LocalWorker{constructor(Dt){this.pid=Dt}onMessage(Dt){this.handler=Dt}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends Wn.AbstractEventBus{constructor(Dt={}){super(Dt);this.worker=new LocalWorker(Gn.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);Gn.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);Gn.childWorker=this.worker}}workerSubscribeMessage(Dt){if(this.isWorker()){Gn.childWorker.onMessage(Dt)}}workerListenMessage(Dt,Lt){if(this.isMain()){Gn.mainWorker.onMessage(Lt)}}workerSendMessage(Dt){if(Gn.mainWorker.handler){Gn.mainWorker.handler(Dt)}else{Gn.initMessageQueue.push({to:"main",message:Dt})}}mainSendMessage(Dt,Lt){if(Gn.childWorker.handler){Gn.childWorker.handler(Lt)}else{Gn.initMessageQueue.push({to:"worker",message:Lt})}}getWorkerId(Dt){return String((Dt||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(Dt){if(this.isMain()){await(0,Wn.createWaitHandler)((()=>Gn.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(Gn.childWorker);if(Gn.initMessageQueue.length){Gn.initMessageQueue.forEach((({to:Dt,message:Lt})=>{if(Dt==="worker"){this.mainSendMessage(Gn.childWorker,Lt)}else{this.workerSendMessage(Lt)}}));Gn.initMessageQueue=[]}}await super.start(Dt)}async stop(){Gn.clear();await super.stop()}}Lt.LocalEventBus=LocalEventBus},41836:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ThreadEventBus=void 0;const Wn=Tn(28167);const Gn=Tn(73317);class ThreadEventBus extends Gn.AbstractEventBus{constructor(Dt={}){super(Dt);if(!this.options.encoder){this.options.encoder=Dt=>Dt}if(!this.options.decoder){this.options.decoder=Dt=>Dt}}workerSubscribeMessage(Dt){Wn.parentPort.on("message",(Lt=>{Dt(this.options.decoder(Lt))}))}workerListenMessage(Dt,Lt){Dt.on("message",(Dt=>{Lt(this.options.decoder(Dt))}))}workerSendMessage(Dt){Wn.parentPort.postMessage(this.options.encoder(Dt))}mainSendMessage(Dt,Lt){Dt.postMessage(this.options.encoder(Lt))}isMain(){return!this.isWorker()}isWorker(){var Dt;return(Dt=this.options.isWorker)!==null&&Dt!==void 0?Dt:!Wn.isMainThread}getWorkerId(Dt){return String(Dt?Dt.threadId:Wn.threadId)}}Lt.ThreadEventBus=ThreadEventBus},62525:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.run=void 0;const Wn=Tn(79896);const Gn=Tn(16928);const rr=Tn(63268);const cr=Tn(39023);const pr=Tn(70857);const mr=(0,cr.debuglog)("midway:glob");function formatWindowsPath(Dt){if(pr.platform()==="win32"&&Dt){return Dt.map((Dt=>Dt.split(Gn.sep).join(Gn.posix.sep)))}return Dt}const run=(Dt,Lt={cwd:process.cwd(),ignore:[]})=>{mr(`midway glob pattern = ${Dt}, options = ${JSON.stringify(Lt)}`);const Tn=Date.now();const cr=Lt.cwd;Dt=formatWindowsPath(Dt)||[];mr(`after format pattern = ${Dt}`);const pr=rr(Dt,{ignore:formatWindowsPath(Lt.ignore)||[]});const gr=rr("**",{ignore:formatWindowsPath(Lt.ignore)||[]});function globDirectory(Dt,Lt,Tn,rr){if(!(0,Wn.existsSync)(Dt)){return[]}const pr=(0,Wn.readdirSync)(Dt);const gr=[];for(let yr of pr){const pr=(0,Gn.resolve)(Dt,yr);mr(`resolvePath = ${pr}`);const Sr=(0,Wn.statSync)(pr);if(Sr.isDirectory()&&Tn(pr.replace(cr,""))){const Dt=globDirectory(pr,Lt,Tn,rr);gr.push(...Dt)}else if(Sr.isFile()&&Lt(pr.replace(cr,""))){gr.push(pr)}}return gr}const yr=globDirectory(cr,pr,gr,Lt);mr(`midway glob timing ${Date.now()-Tn}ms`);return yr};Lt.run=run},18309:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.httpProxy=void 0;Lt.httpProxy={enable:true}},94713:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpProxyConfiguration=void 0;const rr=Tn(46123);const cr=Tn(18309);const pr=Tn(25747);let mr=class HttpProxyConfiguration{async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((Dt=>{Dt.useMiddleware(pr.HttpProxyMiddleware)}))}}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);Wn([(0,rr.Config)("httpProxy"),Gn("design:type",Object)],mr.prototype,"httpProxy",void 0);mr=Wn([(0,rr.Configuration)({namespace:"http-proxy",importConfigs:[{default:cr}]})],mr);Lt.HttpProxyConfiguration=mr},62487:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(94713);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.HttpProxyConfiguration}});Gn(Tn(93468),Lt);Gn(Tn(25747),Lt)},93468:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},25747:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpProxyMiddleware=void 0;const rr=Tn(46123);const cr=Tn(12593);let pr=class HttpProxyMiddleware{resolve(Dt){if(Dt.getNamespace()==="express"){return async(Dt,Lt,Tn)=>this.execProxy(Dt,Dt,Lt,Tn,false)}else{const Lt=Dt.getNamespace()==="faas";return async(Dt,Tn)=>{var Wn;const Gn=((Wn=Dt.request)===null||Wn===void 0?void 0:Wn.req)||Dt.request;return this.execProxy(Dt,Gn,Dt,Tn,Lt)}}}async execProxy(Dt,Lt,Tn,Wn,Gn){var rr,pr,mr;const gr=this.getProxyList(Dt.url);if(!gr){return Wn()}const{proxy:yr,url:Sr}=gr;const Er={};for(const Tn of Object.keys(Lt.headers)){if(((rr=yr.ignoreHeaders)===null||rr===void 0?void 0:rr[Tn])||Dt.header[Tn]===undefined){continue}Er[Tn.toLowerCase()]=Dt.header[Tn]}const Or=Lt.headers["x-forwarded-for"];Er["x-forwarded-for"]=Or?`${Or}, ${Dt.ip}`:Dt.ip;Er["host"]=Sr.host;delete Er["content-length"];const Ir=Lt.method.toUpperCase();const Hr=Tn.res||Tn;const Gr=!Gn&&Hr.on&&Hr.writable;const $r={method:Ir,url:Sr.href,headers:Er,responseType:Gr?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(Ir==="POST"||Ir==="PUT"){$r.data=(pr=Lt.body)!==null&&pr!==void 0?pr:(mr=Dt.request)===null||mr===void 0?void 0:mr.body;if(Lt.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof $r.data!=="string"){$r.data=Object.keys($r.data).map((Dt=>`${encodeURIComponent(Dt)}=${encodeURIComponent($r.data[Dt])}`)).join("&")}}const mi=await cr($r).catch((Dt=>{if(!Dt||!Dt.response){throw Dt||new Error("proxy unknown error")}return Dt.response}));Tn.type=mi.headers["content-type"];const ki={"transfer-encoding":true};if(Gr){ki["content-length"]=true}Object.keys(mi.headers).forEach((Dt=>{if(ki[Dt.toLowerCase()]){return}Tn.set(Dt,mi.headers[Dt])}));Tn.status=mi.status;if(Gr){await new Promise((Dt=>{Hr.on("finish",(()=>{if(Hr.end){Hr.end()}Dt(void 0)}));mi.data.pipe(Hr)}))}else{Tn.body=mi.data}}getProxyList(Dt){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const Lt=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((Dt=>Object.assign({},this.httpProxy.default,Dt))):[];for(const Tn of Lt){if(!Tn.match){continue}if(!Tn.match.test(Dt)){continue}if(Tn.host){if(Dt[0]==="/"){Dt=Tn.host+Dt}const Lt=new URL(Dt);return{proxy:Tn,url:Lt}}else if(Tn.target){const Lt=Dt.replace(Tn.match,Tn.target);return{proxy:Tn,url:new URL(Lt)}}}}static getName(){return"http-proxy"}};Wn([(0,rr.Config)("httpProxy"),Gn("design:type",Object)],pr.prototype,"httpProxy",void 0);Wn([(0,rr.Logger)(),Gn("design:type",Object)],pr.prototype,"logger",void 0);pr=Wn([(0,rr.Middleware)()],pr);Lt.HttpProxyMiddleware=pr},84845:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.i18n=void 0;const Wn=Tn(46123);Lt.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:Wn.FORMAT.MS.ONE_YEAR}},localsField:"i18n",missingKeyHandler:Dt=>Dt}},30673:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.I18nConfiguration=void 0;const rr=Tn(46123);const cr=Tn(84845);const pr=Tn(82027);let mr=class I18nConfiguration{async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((Dt=>{Dt.useMiddleware(pr.I18nMiddleware)}))}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);mr=Wn([(0,rr.Configuration)({namespace:"i18n",importConfigs:[{default:cr}]})],mr);Lt.I18nConfiguration=mr},35632:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayI18nService=Lt.MidwayI18nServiceSingleton=void 0;const rr=Tn(46123);const cr=Tn(77460);const pr=Tn(65675);const mr=Tn(15578);let gr=class MidwayI18nServiceSingleton{constructor(){this.localeTextMap=new Map;this.fallbackMatch=[];this.localeMatchCache={}}async init(){this.defaultLocale=(0,mr.formatLocale)(this.i18nConfig.defaultLocale);for(const Dt in this.i18nConfig.localeTable){this.addLocale(Dt,getES6Object(this.i18nConfig.localeTable[Dt]))}for(const Dt in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:pr((0,mr.formatLocale)(Dt)),locale:(0,mr.formatLocale)(this.i18nConfig.fallbacks[Dt])})}}addLocale(Dt,Lt){const Tn=getMap(this.localeTextMap,Dt,true);for(const Dt in Lt){if(typeof Lt[Dt]==="string"){getMap(Tn,"default").set(Dt,Lt[Dt])}else{for(const Wn in Lt[Dt]){getMap(Tn,Dt).set(Wn,Lt[Dt][Wn])}}}}translate(Dt,Lt={}){var Tn,Wn,Gn;const rr=(0,mr.formatLocale)((Tn=Lt.locale)!==null&&Tn!==void 0?Tn:this.defaultLocale);const cr=(Wn=Lt.args)!==null&&Wn!==void 0?Wn:[];const pr=(Gn=Lt.group)!==null&&Gn!==void 0?Gn:"default";let gr=this.getLocaleMappingText(rr,Dt,pr,cr);if(!gr&&rr!==this.defaultLocale){if(this.fallbackMatch.length){const Lt=this.fallbackMatch.find((Dt=>{if(Dt.pattern(rr)){return true}}));if(Lt){gr=this.getLocaleMappingText(Lt.locale,Dt,pr,cr)}}if(!gr){gr=this.getLocaleMappingText(this.defaultLocale,Dt,pr,cr)}}if(!gr&&this.i18nConfig.missingKeyHandler){gr=this.i18nConfig.missingKeyHandler(Dt,Lt)}return gr}getAvailableLocale(Dt,Lt="default"){Dt=(0,mr.formatLocale)(Dt);if(this.localeMatchCache[Dt+"_"+Lt]){return this.localeMatchCache[Dt+"_"+Lt]}if(this.localeTextMap.has(Dt)&&this.localeTextMap.get(Dt).has(Lt)){this.localeMatchCache[Dt+"_"+Lt]=Dt;return Dt}if(this.fallbackMatch.length){const Tn=this.fallbackMatch.find((Tn=>{if(Tn.pattern(Dt)){if(this.localeTextMap.has(Tn.locale)&&this.localeTextMap.get(Tn.locale).has(Lt)){this.localeMatchCache[Dt+"_"+Lt]=Tn.locale;return true}}}));if(Tn){return Tn.locale}}this.localeMatchCache[Dt+"_"+Lt]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(Dt){Dt=(0,mr.formatLocale)(Dt);if(this.localeTextMap.has(Dt)){return true}if(this.fallbackMatch.length){const Lt=this.fallbackMatch.find((Lt=>{if(Lt.pattern(Dt)){if(this.localeTextMap.has(Lt.locale)){return true}}}));if(Lt){return true}}return false}getLocaleMapping(Dt,Lt="default"){Dt=(0,mr.formatLocale)(Dt);const Tn=this.localeTextMap.get(Dt);if(Tn){return Tn.get(Lt)}}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(Dt,Lt,Tn,Wn){const Gn=this.localeTextMap.get(Dt);if(Gn){const Dt=Gn.get(Tn);if(Dt){const Tn=Dt.get(Lt);if(Tn){return formatText(Tn,Wn)}}}}};Wn([(0,rr.Config)("i18n"),Gn("design:type",Object)],gr.prototype,"i18nConfig",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],gr.prototype,"init",null);gr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],gr);Lt.MidwayI18nServiceSingleton=gr;let yr=class MidwayI18nService{translate(Dt,Lt={}){if(!Lt.locale){Lt.locale=this.ctx.getAttr&&this.ctx.getAttr(cr.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(Dt,Lt)}addLocale(Dt,Lt){this.i18nServiceSingleton.addLocale(Dt,Lt)}getLocaleMapping(Dt,Lt="default"){return this.i18nServiceSingleton.getLocaleMapping(Dt,Lt)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(Dt){var Lt,Tn;if(Dt){(Lt=this.ctx)===null||Lt===void 0?void 0:Lt.setAttr(cr.I18N_ATTR_KEY,(0,mr.formatLocale)(Dt))}else{(Tn=this.ctx)===null||Tn===void 0?void 0:Tn.setAttr(cr.I18N_ATTR_KEY,(0,mr.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(Dt,Lt="default"){return this.i18nServiceSingleton.getAvailableLocale(Dt,Lt)}hasAvailableLocale(Dt){return this.i18nServiceSingleton.hasAvailableLocale(Dt)}};Wn([(0,rr.Inject)(),Gn("design:type",gr)],yr.prototype,"i18nServiceSingleton",void 0);Wn([(0,rr.Inject)(),Gn("design:type",Object)],yr.prototype,"ctx",void 0);yr=Wn([(0,rr.Provide)()],yr);Lt.MidwayI18nService=yr;function formatText(Dt,Lt){if(Array.isArray(Lt)){return(0,mr.formatWithArray)(Dt,Lt)}else{return(0,mr.formatWithObject)(Dt,Lt)}}function getES6Object(Dt){for(const Lt in Dt){if(Dt[Lt]["default"]&&Object.keys(Dt[Lt]).length===1){Dt[Lt]=Dt[Lt].default}}return Dt}function getMap(Dt,Lt,Tn=false){Lt=Tn?(0,mr.formatLocale)(Lt):Lt;if(!Dt.has(Lt)){Dt.set(Lt,new Map)}return Dt.get(Lt)}},68255:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.formatLocale=Lt.Configuration=void 0;var rr=Tn(30673);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.I18nConfiguration}});Gn(Tn(35632),Lt);Gn(Tn(82027),Lt);Gn(Tn(77460),Lt);var cr=Tn(15578);Object.defineProperty(Lt,"formatLocale",{enumerable:true,get:function(){return cr.formatLocale}})},77460:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.I18N_ATTR_KEY=void 0;Lt.I18N_ATTR_KEY="i18n:locale"},82027:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.I18nMiddleware=Lt.I18nFilter=void 0;const rr=Tn(46123);const cr=Tn(77460);const pr=Tn(35632);const mr=Tn(15578);let gr=class I18nFilter{match(Dt,Lt,Tn){const Wn=Lt.getAttr(cr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&Wn&&this.resolverConfig.cookieField){const Dt={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};Tn.cookie(this.resolverConfig.cookieField.fieldName,Wn,Dt)}}return Dt}};Wn([(0,rr.Config)("i18n.resolver"),Gn("design:type",Object)],gr.prototype,"resolverConfig",void 0);Wn([(0,rr.Config)("i18n"),Gn("design:type",Object)],gr.prototype,"i18nConfig",void 0);gr=Wn([(0,rr.Match)()],gr);Lt.I18nFilter=gr;let yr=class I18nMiddleware{resolve(Dt){if(Dt.getFrameworkType()===rr.MidwayFrameworkType.WEB_EXPRESS){Dt.useFilter(gr);return async(Dt,Lt,Tn)=>{const Wn=await Dt.requestContext.getAsync(pr.MidwayI18nService);let Gn;if(this.resolverConfig){Gn=Dt.query[this.resolverConfig.queryField]||Dt.cookies[this.resolverConfig.cookieField.fieldName];if(!Gn){let Lt=Dt.acceptsLanguages();if(Lt){if(Array.isArray(Lt)){if(Lt[0]==="*"){Lt=Lt.slice(1)}if(Lt.length>0){for(let Dt=0;Dt<Lt.length;Dt++){const Tn=(0,mr.formatLocale)(Lt[Dt]);if(Wn.hasAvailableLocale(Tn)){Gn=Tn;break}}}}else{Gn=Lt}}}}if(Gn){Wn.saveRequestLocale(Gn)}else{Wn.saveRequestLocale()}Lt.locals[this.i18nConfig.localsField]=(Dt,Lt)=>Wn.translate(Dt,{args:Lt});return Tn()}}else{return async(Dt,Lt)=>{if(this.resolverConfig){let Lt=Dt.query[this.resolverConfig.queryField]||Dt.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const Tn=await Dt.requestContext.getAsync(pr.MidwayI18nService);if(!Lt){let Wn=Dt.acceptsLanguages();if(Wn){if(Array.isArray(Wn)){if(Wn[0]==="*"){Wn=Wn.slice(1)}if(Wn.length>0){for(let Dt=0;Dt<Wn.length;Dt++){const Gn=(0,mr.formatLocale)(Wn[Dt]);if(Tn.hasAvailableLocale(Gn)){Lt=Gn;break}}}}else{Lt=Wn}}}if(Lt){Tn.saveRequestLocale(Lt)}else{Tn.saveRequestLocale()}if(Dt.locals){Dt.locals[this.i18nConfig.localsField]=(Dt,Lt)=>Tn.translate(Dt,{args:Lt})}}await Lt();const Tn=Dt.getAttr(cr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&Tn&&this.resolverConfig.cookieField){const Lt={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};Dt.cookies.set(this.resolverConfig.cookieField.fieldName,Tn,Lt)}}}}}static getName(){return"i18n"}};Wn([(0,rr.Config)("i18n.resolver"),Gn("design:type",Object)],yr.prototype,"resolverConfig",void 0);Wn([(0,rr.Config)("i18n"),Gn("design:type",Object)],yr.prototype,"i18nConfig",void 0);yr=Wn([(0,rr.Middleware)()],yr);Lt.I18nMiddleware=yr},15578:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.formatLocale=Lt.formatWithObject=Lt.formatWithArray=void 0;const Tn=/\{(\d+)\}/g;function formatWithArray(Dt,Lt){return Dt.replace(Tn,((Dt,Tn)=>{const Wn=parseInt(Tn);if(Wn<Lt.length){return Lt[Wn]}return Dt}))}Lt.formatWithArray=formatWithArray;const Wn=/\{(.+?)\}/g;function formatWithObject(Dt,Lt){return Dt.replace(Wn,((Dt,Tn)=>{const Wn=Lt[Tn];if(Wn){return Wn}return Dt}))}Lt.formatWithObject=formatWithObject;function formatLocale(Dt){return Dt.replace("_","-").toLowerCase()}Lt.formatLocale=formatLocale},87370:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.info=void 0;const Wn=Tn(772);Lt.info={title:"Midway Info",infoPath:"/_info",hiddenKey:Wn.DefaultHiddenKey,ignoreKey:[]}},47265:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.InfoConfiguration=void 0;const rr=Tn(46123);const cr=Tn(82934);const pr=Tn(87370);let mr=class InfoConfiguration{async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((Dt=>{Dt.useMiddleware(cr.InfoMiddleware)}))}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);mr=Wn([(0,rr.Configuration)({namespace:"info",importConfigs:[{default:pr}]})],mr);Lt.InfoConfiguration=mr},65295:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(47265);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.InfoConfiguration}});Gn(Tn(44120),Lt);Gn(Tn(82934),Lt);Gn(Tn(772),Lt)},44120:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.InfoService=void 0;const rr=Tn(46123);const cr=Tn(46123);const pr=Tn(772);const mr=Tn(6730);const gr=Tn(70857);const yr=Tn(16928);const Sr=Tn(65675);let Er=class InfoService{async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((Dt=>Sr(Dt)))}info(Dt){const Lt=[];Lt.push(this.projectInfo());Lt.push(this.systemInfo());Lt.push(this.resourceOccupationInfo());Lt.push(this.softwareInfo());Lt.push(this.midwayConfig());Lt.push(this.midwayService());Lt.push(this.timeInfo());Lt.push(this.envInfo());Lt.push(this.dependenciesInfo());Lt.push(this.networkInfo());const Tn=Lt.map((({type:Dt,info:Lt})=>{const Tn=Object.keys(Lt);const Wn=Tn.filter((Dt=>!this.ignoreKey.includes(Dt)));const Gn={};for(const Dt of Wn){Gn[Dt]=Lt[Dt]}return{type:Dt,info:Gn}}));if(Dt==="html"){return(0,mr.renderToHtml)(Tn,this.titleConfig)}return Tn}projectInfo(){return{type:pr.InfoType.PROJECT,info:{Project:this.midwayInformationService.getProjectName(),AppDir:this.midwayInformationService.getAppDir(),BaseDir:this.midwayInformationService.getBaseDir(),Root:this.midwayInformationService.getRoot(),Env:this.environment.getCurrentEnvironment()}}}systemInfo(){const Dt=process.platform;return{type:pr.InfoType.SYSTEM,info:{Platform:Dt==="win32"?"Windows":Dt,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,gr.hostname)(),HomeDir:(0,gr.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const Dt=process.memoryUsage();const Lt=(0,gr.cpus)();return{type:pr.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,mr.bitToMB)(Dt.rss),"Heap Total Occupy":(0,mr.bitToMB)(Dt.heapTotal),"Heap Used":(0,mr.bitToMB)(Dt.heapUsed),"V8 C++ Object Memory":(0,mr.bitToMB)(Dt.external),"System Total Memory":(0,mr.bitToMB)((0,gr.totalmem)()),CPU:`${Lt[0]?`${Lt[0].model} ${Lt[0].speed}MHz`:""} ${Lt.length} core `,"CPU Usage":Lt.map((Dt=>{const Lt=Dt.times;return((1-Lt.idle/(Lt.idle+Lt.user+Lt.nice+Lt.sys+Lt.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const Dt=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const Lt={};for(const Tn of Dt){const Dt=this.midwayInformationService.getPkg();if(Dt){Lt[Tn]=Dt.version}}return{type:pr.InfoType.SOFTWARE,info:Lt}}envInfo(){const Dt={};Object.keys(process.env).forEach((Lt=>{Dt[Lt]=this.filterSecretContent(Lt,process.env[Lt])}));return{type:pr.InfoType.ENVIRONMENT_VARIABLE,info:Dt}}timeInfo(){const Dt=(new Date).toString().split(" ");return{type:pr.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,gr.uptime)(),Timezone:Dt.length>=7?Dt[5]:"",TimezoneName:Dt.length>=7?Dt.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const Dt=(0,gr.networkInterfaces)();const Lt={};Object.keys(Dt).forEach((Tn=>{const Wn=Dt[Tn];let Gn=Tn;if(Tn[Tn.length-1]==="0"){Gn=Tn.slice(0,-1)}if(Gn==="lo"){return}Lt[Gn]=Wn.sort((Dt=>{if(Dt.family==="IPv4"){return-1}return 1})).map((Dt=>`${Dt.family} ${Dt.address}`)).join(" / ")}));return{type:pr.InfoType.NETWORK,info:Lt}}dependenciesInfo(){const Dt=this.midwayInformationService.getPkg();const Lt=Dt.dependencies||{};const Tn={};Object.keys(Lt).forEach((Dt=>{const Wn=(0,mr.safeRequire)((0,yr.join)(Dt,"package.json"),{});Tn[Dt]=`${Wn.version||"Not Found"}(${Lt[Dt]})`}));return{type:pr.InfoType.DEPENDENCIES,info:Tn}}midwayService(){var Dt;const Lt={};if((Dt=this.container)===null||Dt===void 0?void 0:Dt.registry){for(const Dt of this.container.registry){const[Tn,Wn]=Dt;const Gn=Wn?(Wn===null||Wn===void 0?void 0:Wn.name)||Wn:typeof Wn;Lt[Tn]=`${(Wn===null||Wn===void 0?void 0:Wn.namespace)?`${Wn===null||Wn===void 0?void 0:Wn.namespace}:`:""}${Gn}${(Wn===null||Wn===void 0?void 0:Wn.scope)?` [${Wn===null||Wn===void 0?void 0:Wn.scope}]`:""}`}}return{type:pr.InfoType.MIDWAY_SERVICE,info:Lt}}midwayConfig(){const Dt={};const Lt=this.configService.getConfiguration()||{};Object.keys(Lt).forEach((Tn=>{Dt[Tn]=this.safeJson(this.filterSecretContent(Tn,Lt[Tn]))}));return{type:pr.InfoType.MIDWAY_CONFIG,info:Dt}}filterSecretContent(Dt,Lt){if(typeof Lt==="string"){const Tn=this.secretMatchList.some((Lt=>Lt(Dt.toLowerCase())));if(Tn){return(0,mr.safeContent)(Lt)}}else if(Array.isArray(Lt)){return Lt.map((Lt=>this.filterSecretContent(Dt,Lt)))}return Lt}safeJson(Dt){switch(typeof Dt){case"string":return`"${Dt}"`;case"number":return`${Dt}`;case"boolean":return String(Dt);case"object":if(!Dt){return"null"}if(Array.isArray(Dt)){return`[${Dt.map((Dt=>this.safeJson(Dt))).join(",")}]`}if(Dt instanceof RegExp){return`"${Dt.toString()}"`}const Lt=[];for(const Tn in Dt){Lt.push(`"${Tn}":${this.safeJson(this.filterSecretContent(Tn,Dt[Tn]))}`)}return`{${Lt.join(",")}}`;case"function":return`function ${Dt.name}(${Dt.length} args)`}return""}};Wn([(0,rr.Inject)(),Gn("design:type",cr.MidwayInformationService)],Er.prototype,"midwayInformationService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.MidwayConfigService)],Er.prototype,"configService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.MidwayEnvironmentService)],Er.prototype,"environment",void 0);Wn([(0,rr.Config)("info.title"),Gn("design:type",String)],Er.prototype,"titleConfig",void 0);Wn([(0,rr.Config)("info.hiddenKey"),Gn("design:type",Array)],Er.prototype,"defaultHiddenKey",void 0);Wn([(0,rr.Config)("info.ignoreKey"),Gn("design:type",Array)],Er.prototype,"ignoreKey",void 0);Wn([(0,rr.ApplicationContext)(),Gn("design:type",Object)],Er.prototype,"container",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Er.prototype,"init",null);Er=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],Er);Lt.InfoService=Er},772:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.InfoType=Lt.DefaultHiddenKey=void 0;Lt.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var Tn;(function(Dt){Dt["PROJECT"]="Project";Dt["SYSTEM"]="System";Dt["MEMORY_CPU"]="Memory & CPU";Dt["SOFTWARE"]="Software";Dt["ENVIRONMENT_VARIABLE"]="Environment Variable";Dt["TIME"]="Time";Dt["NETWORK"]="Network";Dt["RESOURCE"]="Resource";Dt["DEPENDENCIES"]="Dependencies";Dt["MIDWAY_SERVICE"]="Midway Service";Dt["MIDWAY_CONFIG"]="Midway Config"})(Tn=Lt.InfoType||(Lt.InfoType={}))},82934:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.InfoMiddleware=void 0;const rr=Tn(46123);const cr=Tn(44120);let pr=class InfoMiddleware{resolve(Dt){if(Dt.getFrameworkType()===rr.MidwayFrameworkType.WEB_EXPRESS){return async(Dt,Lt,Tn)=>{if(Dt.path===this.infoPath){Lt.type("html");Lt.send(this.infoService.info("html"))}else{Tn()}}}else{return async(Dt,Lt)=>{if(Dt.path===this.infoPath){return this.infoService.info("html")}return await Lt()}}}static getName(){return"info"}};Wn([(0,rr.Config)("info.infoPath"),Gn("design:type",String)],pr.prototype,"infoPath",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.InfoService)],pr.prototype,"infoService",void 0);pr=Wn([(0,rr.Middleware)()],pr);Lt.InfoMiddleware=pr},6730:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.safeContent=Lt.renderToHtml=Lt.bitToMB=Lt.safeRequire=void 0;const Wn=Tn(79896);function safeRequire(Dt,Lt){try{if(!(0,Wn.existsSync)(Dt)){return Lt}return JSON.parse((0,Wn.readFileSync)(Dt,"utf8"))}catch(Dt){return Lt}}Lt.safeRequire=safeRequire;function bitToMB(Dt){return Number((Dt||0)/1024/1024).toFixed(2)+" MB"}Lt.bitToMB=bitToMB;function renderToHtml(Dt,Lt){let Tn=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${Lt}</div>`;Tn+=Dt.map((Dt=>{const Lt=Object.keys(Dt.info||{});return`<div class="infoType">${Dt.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${Lt.map((Lt=>`<tr style="border: 1px solid #666;"><td class="infoName">${Lt}</td><td class="infoValue">${Dt.info[Lt]}</td></tr>`)).join("")}</table>`})).join("");return`<style>\n .infoType {background: #8e8dc5;margin-top: 24px;padding: 12px;font-weight: bold;font-size: 16px;}\n .infoName {font-weight:bold;vertical-align: top;background:#c2c6fc;width: 200px;word-break:break-all;padding: 12px;}\n .infoValue {vertical-align: top;background:#d8d8d8;padding: 12px;word-break:break-all;}\n </style><div style="margin: 24px auto;max-width: 720px;min-width: 440px;">${Tn}</div>`}Lt.renderToHtml=renderToHtml;function safeContent(Dt=""){if(Dt.length<3){return"*".repeat(Dt.length)}else if(Dt.length<6){return Dt[0]+"*".repeat(Dt.length-1)}else if(Dt.length<10){return Dt[0]+"*".repeat(Dt.length-2)+Dt[Dt.length-1]}else if(Dt.length<15){return Dt.slice(0,2)+"*".repeat(Dt.length-4)+Dt.slice(-2)}else{return Dt.slice(0,3)+"*".repeat(Dt.length-6)+Dt.slice(-3)}}Lt.safeContent=safeContent},89619:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.siteFile=Lt.bodyParser=Lt.onerror=Lt.cookiesExtra=Lt.cookies=Lt.keys=Lt.koa=void 0;Lt.koa={contextLoggerFormat:Dt=>{var Lt,Tn,Wn;const Gn=Dt.ctx;const rr=Gn.userId||"-";const cr=(Wn=(Lt=Gn.traceId)!==null&&Lt!==void 0?Lt:(Tn=Gn.tracer)===null||Tn===void 0?void 0:Tn.traceId)!==null&&Wn!==void 0?Wn:"-";const pr=Date.now()-Gn.startTime;const mr=rr+"/"+Gn.ip+"/"+cr+"/"+pr+"ms "+Gn.method+" "+Gn.url;return`${Dt.timestamp} ${Dt.LEVEL} ${Dt.pid} [${mr}] ${Dt.message}`},serverTimeout:2*60*1e3};Lt.keys="";Lt.cookies={};Lt.cookiesExtra={defaultGetOptions:{}};Lt.onerror={};Lt.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(Dt){Dt.message+=", check bodyParser config";throw Dt}};Lt.siteFile={enable:true,favicon:undefined}},9867:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.KoaConfiguration=void 0;const rr=Tn(46123);const cr=Tn(65579);const pr=Tn(62229);const mr=Tn(89619);const gr=Tn(18713);const yr=Tn(67241);let Sr=class KoaConfiguration{init(){this.decoratorService.registerParameterHandler(rr.WEB_ROUTER_PARAM_KEY,(Dt=>(0,rr.extractKoaLikeValue)(Dt.metadata.type,Dt.metadata.propertyData,Dt.originParamType)(Dt.originArgs[0],Dt.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([yr.SiteFileMiddleware,gr.BodyParserMiddleware])}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayDecoratorService)],Sr.prototype,"decoratorService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",pr.MidwayKoaFramework)],Sr.prototype,"koaFramework",void 0);Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayConfigService)],Sr.prototype,"configService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",void 0)],Sr.prototype,"init",null);Sr=Wn([(0,rr.Configuration)({namespace:"koa",imports:[cr],importConfigs:[{default:mr}]})],Sr);Lt.KoaConfiguration=Sr},62229:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayKoaFramework=void 0;const Gn=Tn(46123);const rr=Tn(60990);const cr=Tn(53777);const pr=Tn(10800);const mr=Tn(81236);const gr=Tn(69502);const yr=Tn(83480);const Sr=Tn(72040);const Er=Symbol("context#cookies");class KoaControllerGenerator extends Gn.WebControllerGenerator{constructor(Dt,Lt){super(Dt,Lt);this.app=Dt;this.webRouterService=Lt}createRouter(Dt){const Lt=new cr(Dt);Lt.prefix(Dt.prefix);return Lt}generateController(Dt){return this.generateKoaController(Dt)}}let Or=class MidwayKoaFramework extends Gn.BaseFramework{configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(Dt){const Lt=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!Lt){throw new Gn.MidwayConfigMissingError("config.keys")}const Tn=this.configService.getConfiguration("cookies");const Wn=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new pr({keys:[].concat(Lt),proxy:this.configurationOptions.proxy,proxyIpHeader:this.configurationOptions.proxyIpHeader,subdomainOffset:this.configurationOptions.subdomainOffset,maxIpsCount:this.configurationOptions.maxIpsCount});Object.defineProperty(this.app.context,"cookies",{get(){if(!this[Er]){this[Er]=new rr.Cookies(this,this.app.keys,Tn,Wn)}return this[Er]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(Dt){this.state=Dt}});Object.defineProperty(this.app.context,"forward",{get(){return async function(Dt){const Lt=this.requestContext.get(Gn.MidwayWebRouterService);const Tn=await Lt.getMatchedRouterInfo(Dt,this.method);if(Tn){if(Tn.controllerClz){const Dt=await this.requestContext.getAsync(Tn.controllerClz);return Dt[Tn.method](this)}else if(typeof Tn.method==="function"){return Tn.method(this)}}else{throw new Gn.httpError.NotFoundError(`Forward url ${Dt} Not Found`)}}}});const cr=this.configurationOptions.queryParseMode==="strict"?function(Dt){return!Array.isArray(Dt)?[Dt]:Dt}:this.configurationOptions.queryParseMode==="first"?function(Dt){return Array.isArray(Dt)?Dt[0]:Dt}:undefined;const Sr=this;Object.defineProperty(this.app.request,"query",{get(){const Dt=this.querystring;const Lt=this._querycache=this._querycache||{};if(Lt[Dt])return Lt[Dt];if(Sr.configurationOptions.queryParseMode){Lt[Dt]=gr.parse(Dt,Sr.configurationOptions.queryParseOptions||{})}else{Lt[Dt]=yr.parse(Dt)}if(cr){for(const Tn in Lt[Dt]){Lt[Dt][Tn]=cr(Lt[Dt][Tn])}}return Lt[Dt]},set(Dt){this._querycache=this._querycache||{};this._querycache[this.querystring]=Dt}});const Or=this.configService.getConfiguration("onerror");(0,mr.setupOnError)(this.app,Or,this.logger);const notFound=async(Dt,Lt)=>{await Lt();if(!Dt._matchedRoute&&Dt.body===undefined){throw new Gn.httpError.NotFoundError(`${Dt.path} Not Found`)}};const midwayRootMiddleware=async(Dt,Lt)=>{this.app.createAnonymousContext(Dt);await(await this.applyMiddleware(notFound))(Dt,Lt);if(Dt.body===undefined&&!Dt.response._explicitStatus&&Dt._matchedRoute){Dt.body=undefined}};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(Gn.MidwayWebRouterService,[{globalPrefix:this.configurationOptions.globalPrefix}]);this.generator=new KoaControllerGenerator(this.app,this.webRouterService);this.defineApplicationProperties();this.app.originUse=this.app.use;this.app.use=this.app.useMiddleware}async loadMidwayController(){await this.generator.loadMidwayController((Dt=>{var Lt;const Tn=Dt.middleware();Tn._name=`midwayController(${((Lt=Dt===null||Dt===void 0?void 0:Dt.opts)===null||Lt===void 0?void 0:Lt.prefix)||"/"})`;this.app.use(Tn)}))}generateController(Dt){return this.generator.generateKoaController(Dt)}async generateMiddleware(Dt){const Lt=await this.getApplicationContext().getAsync(Dt);return Lt.resolve()}async run(){await this.loadMidwayController();this.app.use=this.app.originUse;const Dt={...this.configurationOptions,...this.configurationOptions.serverOptions};if(Dt.key&&Dt.cert){Dt.key=Gn.PathFileUtil.getFileContentSync(Dt.key);Dt.cert=Gn.PathFileUtil.getFileContentSync(Dt.cert);Dt.ca=Gn.PathFileUtil.getFileContentSync(Dt.ca);process.env.MIDWAY_HTTP_SSL="true";if(Dt.http2){this.server=Tn(85675).createSecureServer(Dt,this.app.callback())}else{this.server=Tn(65692).createServer(Dt,this.app.callback())}}else{if(Dt.http2){this.server=Tn(85675).createServer(Dt,this.app.callback())}else{this.server=Tn(58611).createServer(Dt,this.app.callback())}}this.applicationContext.registerObject(Gn.HTTP_SERVER_KEY,this.server);if(Gn.Types.isNumber(this.configurationOptions.serverTimeout)){this.server.setTimeout(this.configurationOptions.serverTimeout)}this.configurationOptions.listenOptions={port:this.configurationOptions.port,host:this.configurationOptions.hostname,...this.configurationOptions.listenOptions};let Lt=process.env.MIDWAY_HTTP_PORT||this.configurationOptions.listenOptions.port;if(Lt===0||Lt==="0"){Lt=await(0,Sr.getFreePort)();this.logger.info(`Midway koa is listening on port ${Lt} (auto assigned)`)}this.configurationOptions.listenOptions.port=Number(Lt);if(this.configurationOptions.listenOptions.port){new Promise((Dt=>{this.server.listen(this.configurationOptions.listenOptions,(()=>{Dt()}));process.env.MIDWAY_HTTP_PORT=String(this.configurationOptions.listenOptions.port)}))}}async beforeStop(){if(this.server){new Promise((Dt=>{this.server.close(Dt);process.env.MIDWAY_HTTP_PORT=""}))}}getFrameworkType(){return Gn.MidwayFrameworkType.WEB_KOA}getFrameworkName(){return"web:koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(Dt){this.middlewareManager.insertLast(Dt)}useFilter(Dt){this.filterManager.useFilter(Dt)}};Or=Wn([(0,Gn.Framework)()],Or);Lt.MidwayKoaFramework=Or},47453:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=Lt.Framework=void 0;var rr=Tn(62229);Object.defineProperty(Lt,"Framework",{enumerable:true,get:function(){return rr.MidwayKoaFramework}});Gn(Tn(77678),Lt);var cr=Tn(9867);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return cr.KoaConfiguration}});Gn(Tn(67241),Lt);Gn(Tn(18713),Lt)},77678:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},18713:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.BodyParserMiddleware=void 0;const rr=Tn(36952);const cr=Tn(46123);let pr=class BodyParserMiddleware{resolve(){if(this.bodyparserConfig.enable){return rr(this.bodyparserConfig)}}static getName(){return"bodyParser"}};Wn([(0,cr.Config)("bodyParser"),Gn("design:type",Object)],pr.prototype,"bodyparserConfig",void 0);pr=Wn([(0,cr.Middleware)()],pr);Lt.BodyParserMiddleware=pr},67241:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SiteFileMiddleware=void 0;const rr=Tn(46123);const cr=Tn(16928);const pr="public, max-age=2592000";let mr=class SiteFileMiddleware{resolve(){if(this.siteFileConfig.enable){return async(Dt,Lt)=>{if(Dt.method!=="HEAD"&&Dt.method!=="GET")return Lt();if(Dt.path[0]!=="/")return Lt();if(Dt.path!=="/favicon.ico"){return Lt()}let Tn=this.siteFileConfig["favicon"];if(Tn===undefined){Tn=Buffer.from("")}if(!Tn)return Lt();if(typeof Tn==="string")return Dt.redirect(Tn);if(Buffer.isBuffer(Tn)){Dt.set("cache-control",pr);Dt.body=Tn;Dt.type=cr.extname(Dt.path);return}return Lt()}}}static getName(){return"siteFile"}};Wn([(0,rr.Config)("siteFile"),Gn("design:type",Object)],mr.prototype,"siteFileConfig",void 0);mr=Wn([(0,rr.Middleware)()],mr);Lt.SiteFileMiddleware=mr},81236:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.setupOnError=void 0;const Wn=Tn(58611);const Gn=Tn(72040);const rr=Tn(46123);function setupOnError(Dt,Lt,Tn){const cr=Object.assign({accepts(){const Dt=Lt.accepts||Gn.accepts;return Dt(this)},text(Lt,Tn){Tn.res._headers={};Tn.set(Lt.headers);if((0,Gn.isProduction)(Dt)){Tn.body=Wn.STATUS_CODES[Tn.status]}else{Tn.body=Lt.message}},html(Lt,Tn){const rr=(0,Gn.detectStatus)(Lt);if((0,Gn.isProduction)(Dt)){if(rr>=500){Tn.status=500;Tn.body=`<h2>Internal Server Error, real status: ${rr}</h2>`;return}else{Tn.status=rr;Tn.body=`<h2>${rr} ${Wn.STATUS_CODES[rr]}</h2>`;return}}if(Dt.getEnv()==="unittest"||Dt.getEnv()==="test"){Tn.status=rr;Tn.body=`${Lt.name}: ${Lt.message}\n${Lt.stack}`;return}Tn.body=Gn.tpl.replace("{{status}}",(0,Gn.escapeHtml)(Lt.status)).replace("{{errorCode}}",(0,Gn.escapeHtml)(Lt.code)).replace("{{stack}}",(0,Gn.escapeHtml)(Lt.stack));Tn.type="html"},json(Lt,Tn){const rr=(0,Gn.detectStatus)(Lt);const cr=Lt.code||Lt.type;if((0,Gn.isProduction)(Dt)){if(rr>=500){Tn.body={code:cr,message:Wn.STATUS_CODES[rr]}}else{Tn.body={code:cr,message:Lt.message}}}else{Tn.body={code:cr,message:Lt.message,stack:Lt.stack}}}},Lt);Dt.on("error",((Lt,Wn)=>{Wn=Wn||Dt.createAnonymousContext();const rr=(0,Gn.detectStatus)(Lt);if(rr>=500){try{Wn.logger.error(Lt)}catch(Dt){Tn.error(Lt);Tn.error(Dt)}return}try{Wn.logger.warn(Lt)}catch(Dt){Tn.warn(Lt);Tn.error(Dt)}}));Dt.context.onerror=function(Lt){if(Lt==null)return;if(this.req)(0,Gn.sendToWormhole)(this.req);if(!(Lt instanceof Error)){let Dt=Lt;if(typeof Lt==="object"){try{Dt=rr.Utils.safeStringify(Lt)}catch(Dt){}}const Tn=new Error("non-error thrown: "+Dt);if(Lt){if(Lt.name)Tn.name=Lt.name;if(Lt.message)Tn.message=Lt.message;if(Lt.stack)Tn.stack=Lt.stack;if(Lt.status)Tn["status"]=Lt.status;if(Lt.headers)Tn["headers"]=Lt.headers}Lt=Tn}const Tn=this.headerSent||!this.writable;if(Tn)Lt.headerSent=true;Dt.emit("error",Lt,this);if(Tn)return;if(Lt.code==="ENOENT")Lt.status=404;if(typeof Lt.status!=="number"||!Wn.STATUS_CODES[Lt.status]){Lt.status=500}this.status=Lt.status;this.set(Lt.headers);let pr="text";if(cr.accepts){pr=cr.accepts.call(this,"html","text","json")}else{pr=this.accepts("html","text","json")}pr=pr||"text";if(cr.all){cr.all.call(this,Lt,this)}else{if(cr.redirect&&pr!=="json"){this.redirect(cr.redirect)}else{cr[pr].call(this,Lt,this);this.type=pr}}if(pr==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}Lt.setupOnError=setupOnError},72040:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getFreePort=Lt.escapeHtml=Lt.tpl=Lt.isProduction=Lt.sendToWormhole=Lt.accepts=Lt.detectStatus=void 0;const Wn=Tn(69278);function detectStatus(Dt){let Lt=Dt.status||500;if(Lt<200){Lt=500}return Lt}Lt.detectStatus=detectStatus;function accepts(Dt){if(acceptJSON(Dt))return"json";return"html"}Lt.accepts=accepts;function acceptJSON(Dt){if(Dt.path.endsWith(".json"))return true;if(Dt.response.type&&Dt.response.type.indexOf("json")>=0)return true;if(Dt.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(Dt){return new Promise((Lt=>{if(typeof Dt.resume!=="function"){return Lt()}Dt.unpipe&&Dt.unpipe();Dt.resume();if(Dt._readableState&&Dt._readableState.ended){return Lt()}if(!Dt.readable||Dt.destroyed){return Lt()}function cleanup(){Dt.removeListener("end",onEnd);Dt.removeListener("close",onEnd);Dt.removeListener("error",onError)}function onEnd(){cleanup();Lt()}function onError(){cleanup();Lt()}Dt.on("end",onEnd);Dt.on("close",onEnd);Dt.on("error",onError)}))}Lt.sendToWormhole=sendToWormhole;function isProduction(Dt){return Dt.getEnv()!=="local"&&Dt.getEnv()!=="unittest"}Lt.isProduction=isProduction;Lt.tpl=`\n<!DOCTYPE html>\n<html>\n <head>\n <title>Error - {{status}}</title>\n <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">\n\n <style>\n body {\n padding: 50px 80px;\n font: 14px "Helvetica Neue", Helvetica, sans-serif;\n }\n\n h1 {\n font-size: 2em;\n margin-bottom: 5px;\n }\n\n pre {\n font-size: .8em;\n }\n </style>\n </head>\n <body>\n <div id="error">\n <h1>Error</h1>\n <p>Looks like something broke!</p>\n <p><h2>Stack</h2></p>\n <pre>\n <code>\n{{stack}}\n </code>\n </pre>\n <p><h2>Error Code</h2></p>\n <pre>\n <code>\n{{errorCode}}\n </code>\n </pre>\n </div>\n </body>\n</html>`;const Gn=/["'&<>]/;function escapeHtml(Dt){const Lt=""+Dt;const Tn=Gn.exec(Lt);if(!Tn){return Lt}let Wn;let rr="";let cr=0;let pr=0;for(cr=Tn.index;cr<Lt.length;cr++){switch(Lt.charCodeAt(cr)){case 34:Wn=""";break;case 38:Wn="&";break;case 39:Wn="'";break;case 60:Wn="<";break;case 62:Wn=">";break;default:continue}if(pr!==cr){rr+=Lt.substring(pr,cr)}pr=cr+1;rr+=Wn}return pr!==cr?rr+Lt.substring(pr,cr):rr}Lt.escapeHtml=escapeHtml;async function getFreePort(){return new Promise(((Dt,Lt)=>{const Tn=(0,Wn.createServer)();Tn.listen(0,(()=>{try{const Lt=Tn.address().port;Tn.close();Dt(Lt)}catch(Dt){Lt(Dt)}}))}))}Lt.getFreePort=getFreePort},28520:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.LEVEL=Lt.DefaultLogLevels=void 0;Lt.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};Lt.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},62379:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.LoggerFactory=void 0;const Wn=Tn(8481);const Gn=Tn(39023);const rr=Tn(16928);const cr=Tn(4002);const pr=Gn.debuglog("midway:debug");class LoggerFactory extends Map{constructor(Dt={}){super();this.factoryOptions=Dt}createLogger(Dt,Lt){if(!this.has(Dt)){pr('[logger]: Create logger "%s" with options %j',Dt,Lt);const Tn=new Wn.MidwayLogger(Object.assign(Lt,this.factoryOptions));this.addLogger(Dt,Tn);return Tn}return this.getLogger(Dt)}addLogger(Dt,Lt,Tn=true){if(!Tn||!this.has(Dt)){if(this.get(Dt)!==Lt){if(Lt["onClose"]){Lt["onClose"]((()=>{this.delete(Dt)}))}if(Lt["on"]){Lt.on("close",(()=>this.delete(Dt)))}this.set(Dt,Lt)}}else{throw new Error(`logger id ${Dt} has duplicate`)}return this.get(Dt)}getLogger(Dt){return this.get(Dt)}removeLogger(Dt){const Lt=this.get(Dt);Lt===null||Lt===void 0?void 0:Lt["close"]();this.delete(Dt)}get(Dt){return super.get(Dt)}close(Dt){if(Dt){return this.removeLogger(Dt)}Array.from(this.keys()).forEach((Dt=>this.removeLogger(Dt)))}getDefaultMidwayLoggerConfig(Dt){var Lt;const Tn=(0,cr.isDevelopmentEnvironment)(Dt.env);const Wn=(Lt=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&Lt!==void 0?Lt:Dt.root;if(!Wn){throw new Error('Midway Logger requires a root path during initialization, but it was provided empty. Please set it manually in the "logger.default.dir" configuration.')}return{midwayLogger:{default:{fileLogName:"midway-app.log",errorLogName:"common-error.log",dir:(0,rr.join)(Wn,"logs",Dt.name),auditFileDir:".audit",transports:{console:Tn?{autoColors:Tn}:false,file:{bufferWrite:!Tn},error:{bufferWrite:!Tn}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(Dt,Lt,Tn={}){return Lt.createContextLogger(Dt,Tn)}}Lt.LoggerFactory=LoggerFactory},51169:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayBaseLogger=Lt.MidwayLoggerContainer=Lt.createConsoleLogger=Lt.createFileLogger=Lt.createLogger=Lt.clearAllLoggers=Lt.loggers=void 0;const rr=Tn(62379);const cr=Tn(8481);Gn(Tn(51314),Lt);Gn(Tn(8481),Lt);Gn(Tn(19870),Lt);Gn(Tn(3993),Lt);Gn(Tn(96242),Lt);Gn(Tn(53828),Lt);Gn(Tn(62379),Lt);Gn(Tn(4002),Lt);Lt.loggers=new rr.LoggerFactory;const clearAllLoggers=()=>{Lt.loggers.close()};Lt.clearAllLoggers=clearAllLoggers;const createLogger=(Dt,Tn={})=>Lt.loggers.createLogger(Dt,Tn);Lt.createLogger=createLogger;const createFileLogger=(Dt,Tn)=>Lt.loggers.createLogger(Dt,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...Tn}}});Lt.createFileLogger=createFileLogger;const createConsoleLogger=(Dt,Tn={})=>Lt.loggers.createLogger(Dt,{transports:{console:Tn}});Lt.createConsoleLogger=createConsoleLogger;Lt.MidwayLoggerContainer=rr.LoggerFactory;Lt.MidwayBaseLogger=cr.MidwayLogger},51314:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},8481:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayChildLogger=Lt.MidwayContextLogger=Lt.MidwayLogger=Lt.TransportManager=void 0;const Wn=Tn(4002);const Gn=Tn(70857);const rr=Tn(19870);const cr=Tn(96242);const pr=Tn(3993);Lt.TransportManager=new Map;Lt.TransportManager.set("console",cr.ConsoleTransport);Lt.TransportManager.set("file",pr.FileTransport);Lt.TransportManager.set("error",pr.ErrorTransport);Lt.TransportManager.set("json",pr.JSONTransport);class MidwayLogger{constructor(Dt={}){this.transports=new Map;this.closeHandlers=[];Dt=(0,Wn.formatLegacyLoggerOptions)(Dt);this.options=Dt;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||Gn.EOL;if(this.options.transports){for(const Dt in this.options.transports){this.add(Dt,this.options.transports[Dt])}}}get level(){return this.options.level}set level(Dt){this.options.level=Dt}log(Dt,...Lt){this.transit(Dt,{},...Lt)}debug(...Dt){this.transit("debug",{},...Dt)}info(...Dt){this.transit("info",{},...Dt)}warn(...Dt){this.transit("warn",{},...Dt)}error(...Dt){this.transit("error",{},...Dt)}verbose(...Dt){this.transit("verbose",{},...Dt)}write(...Dt){this.transit(false,{},...Dt)}silly(...Dt){this.transit("silly",{},...Dt)}add(Dt,Tn){if(Tn){let Wn;if(!(Tn instanceof rr.Transport)){if(!Lt.TransportManager.has(Dt)){throw new Error(`Transport ${Dt} is not supported`)}else{Wn=new(Lt.TransportManager.get(Dt))(Tn)}}else{Wn=Tn}Wn.setLoggerOptions(this.options);this.transports.set(Dt,Wn)}}get(Dt){return this.transports.get(Dt)}remove(Dt,Lt={}){if(this.transports.has(Dt)){if(Lt.close===undefined||Lt.close){this.transports.get(Dt).close()}this.transports.delete(Dt)}}close(){for(const Dt of this.transports.keys()){this.remove(Dt,{close:true})}for(const Dt of this.closeHandlers){Dt()}}onClose(Dt){this.closeHandlers.push(Dt)}createContextLogger(Dt,Lt={}){return new MidwayContextLogger(Dt,this,Lt)}transit(Dt,Lt={},...Tn){if(Dt!==false&&!(0,Wn.isEnableLevel)(Dt,this.level)){return}for(const Wn of this.transports.values()){Wn.log(Dt,Lt,...Tn)}}getChild(Dt={}){return new MidwayChildLogger(this,Dt)}}Lt.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(Dt,Lt,Tn={}){this.ctx=Dt;this.parentLogger=Lt;this.options=Tn}debug(...Dt){this.transit("debug",...Dt)}info(...Dt){this.transit("info",...Dt)}warn(...Dt){this.transit("warn",...Dt)}error(...Dt){this.transit("error",...Dt)}verbose(...Dt){this.transit("verbose",...Dt)}write(...Dt){this.transit(false,...Dt)}transit(Dt,...Lt){this.parentLogger.transit(Dt,{ctx:this.ctx,contextFormat:this.options.contextFormat},...Lt)}getContext(){return this.ctx}}Lt.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(Dt,Lt={}){this.parentLogger=Dt;this.meta=Lt}debug(...Dt){this.transit("debug",...Dt)}info(...Dt){this.transit("info",...Dt)}warn(...Dt){this.transit("warn",...Dt)}error(...Dt){this.transit("error",...Dt)}verbose(...Dt){this.transit("verbose",...Dt)}write(...Dt){this.transit(false,...Dt)}transit(Dt,...Lt){this.parentLogger.transit(Dt,this.meta,...Lt)}}Lt.MidwayChildLogger=MidwayChildLogger},96242:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ConsoleTransport=void 0;const Wn=Tn(19870);const Gn=Tn(4002);const rr=Tn(78997);const cr=rr.supportsColor.stdout;class ConsoleTransport extends Wn.Transport{log(Dt,Lt,...Tn){if(!(0,Gn.isEnableLevel)(Dt,this.options.level)){return}let Wn=this.format(Dt,Lt,Tn);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&cr){const Lt=this.getColor(Dt);Wn=(0,rr.colorizeAll)(Wn,Lt)}Wn+=this.options.eol;if(Dt==="error"){process.stderr.write(Wn)}else{process.stdout.write(Wn)}}getColor(Dt){switch(Dt){case"debug":return rr.Color.blue;case"info":return rr.Color.green;case"warn":return rr.Color.yellow;case"error":return rr.Color.red;default:return rr.Color.white}}close(){}}Lt.ConsoleTransport=ConsoleTransport},3993:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.JSONTransport=Lt.ErrorTransport=Lt.FileTransport=void 0;const Wn=Tn(19870);const Gn=Tn(53828);const rr=Tn(16928);const cr=Tn(43106);const pr=Tn(79896);const mr=Tn(4002);const gr=Tn(61256);const yr=Tn(74450);class FileTransport extends Wn.Transport{constructor(Dt={}){super(Dt);this.options=Dt;this.bufSize=0;this.buf=[];if(this.options.bufferWrite){this.options.bufferMaxLength=this.options.bufferMaxLength||1e3;this.options.bufferFlushInterval=this.options.bufferFlushInterval||1e3;this.timer=this.createInterval()}if(!(0,mr.isValidFileName)(this.options.fileLogName)||!(0,mr.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const Lt={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,mr.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){Dt.auditFileDir=this.options.dir}if(!rr.isAbsolute(this.options.auditFileDir)){Dt.auditFileDir=rr.join(this.options.dir,Dt.auditFileDir)}this.logStream=Gn.FileStreamRotatorManager.getStream({...Lt,filename:rr.join(this.options.dir,this.options.fileLogName),size:(0,mr.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:rr.join(Dt.auditFileDir,"."+(0,gr.hash)(this.options)+"-audit.json"),...Dt});this.logStream.on("logRemoved",(Lt=>{if(Dt.zippedArchive){const Dt=Lt.name+".gz";if(pr.existsSync(Dt)){try{pr.unlinkSync(Dt)}catch(Dt){console.error(Dt)}return}}}));if(Dt.zippedArchive){this.logStream.on("rotate",(Dt=>{const Lt=pr.existsSync(Dt);const Tn=pr.existsSync(Dt+".gz");if(!Lt||Tn){return}const Wn=cr.createGzip();const Gn=pr.createReadStream(Dt);const rr=pr.createWriteStream(Dt+".gz");Gn.pipe(Wn).pipe(rr).on("finish",(()=>{if(pr.existsSync(Dt)){pr.unlinkSync(Dt)}}))}))}}log(Dt,Lt,...Tn){if(!(0,mr.isEnableLevel)(Dt,this.options.level)){return}let Wn=this.format(Dt,Lt,Tn);Wn+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=Wn.length;this.buf.push(Wn);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(Wn)}}close(){if(this.options.bufferWrite){if(this.buf&&this.buf.length>0){this.flush()}if(this.timer){clearInterval(this.timer);this.timer=null}}if(this.logStream){Gn.FileStreamRotatorManager.close(this.logStream);this.logStream=null}}flush(){if(this.buf.length>0&&this.writable){this.logStream.write(this.buf.join(""));this.buf=[];this.bufSize=0}}createInterval(){return setInterval((()=>this.flush()),this.options.bufferFlushInterval)}get writable(){return this.logStream&&this.logStream.canWrite()}}Lt.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(Dt){Dt.level="error";super(Dt)}}Lt.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(Dt,Lt,...Tn){if(!(0,mr.isEnableLevel)(Dt,this.options.level)){return}let Wn=this.format(Dt,Lt,Tn);if(typeof Wn==="string"||Buffer.isBuffer(Wn)){Wn=(0,yr.stringify)({message:Wn.toString()})}else{Wn=(0,yr.stringify)(Wn)}Wn+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=Wn.length;this.buf.push(Wn);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(Wn)}}}Lt.JSONTransport=JSONTransport},53828:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.FileStreamRotatorManager=Lt.FileStreamRotator=void 0;const Wn=Tn(79896);const Gn=Tn(16928);const rr=Tn(76982);const cr=Tn(24434);const pr=Tn(39023);const mr=Tn(23046);const gr=Tn(15419);const yr=Tn(42613);const Sr=Tn(4002);const Er=(0,pr.debuglog)("midway-logger");const Or=["daily","test","s","m","h","custom"];const Ir="YYYYMMDDHHmm";mr.extend(gr);class FileStreamRotator{getFrequency(Dt){const Lt=Dt.toLowerCase().match(/^(\d+)([smh])$/);if(Lt){return(0,Sr.checkNumAndType)(Lt[2],parseInt(Lt[1]))}const Tn=(0,Sr.checkDailyAndTest)(Dt);if(Tn){return Tn}return false}parseFileSize(Dt){if(Dt&&typeof Dt==="string"){const Lt=Dt.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(Lt){switch(Lt[2]){case"k":return Lt[1]*1024;case"m":return Lt[1]*1024*1024;case"g":return Lt[1]*1024*1024*1024}}}return null}getDate(Dt,Lt,Tn){Lt=Lt||Ir;const Wn=Tn?mr.utc():mr().local();if(Dt&&Or.indexOf(Dt.type)!==-1){switch(Dt.type){case"s":const Tn=Math.floor(Wn.second()/Dt.digit)*Dt.digit;return Wn.second(Tn).format(Lt);case"m":const Gn=Math.floor(Wn.minute()/Dt.digit)*Dt.digit;return Wn.minute(Gn).format(Lt);case"h":const rr=Math.floor(Wn.hour()/Dt.digit)*Dt.digit;return Wn.hour(rr).format(Lt);case"daily":case"custom":case"test":return Wn.format(Lt)}}return Wn.format(Lt)}setAuditLog(Dt,Lt,Tn){let rr=null;if(Dt){const cr=Dt.toString().substr(-1);const pr=Dt.toString().match(/^(\d+)/);if(Number(pr[1])>0){const Dt=Gn.dirname(Tn.replace(/%DATE%.+/,"_filename"));try{if(Lt){const Dt=Gn.resolve(Lt);rr=JSON.parse(Wn.readFileSync(Dt,{encoding:"utf-8"}))}else{const Lt=Gn.resolve(Dt+"/"+".audit.json");rr=JSON.parse(Wn.readFileSync(Lt,{encoding:"utf-8"}))}}catch(Tn){if(Tn.code!=="ENOENT"){return null}rr={keep:{days:false,amount:Number(pr[1])},auditLog:Lt||Dt+"/"+".audit.json",files:[]}}rr.keep={days:cr==="d",amount:Number(pr[1])}}}return rr}writeAuditLog(Dt){try{(0,Sr.mkDirForFile)(Dt.auditLog);Wn.writeFileSync(Dt.auditLog,JSON.stringify(Dt,null,2))}catch(Lt){Er((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",Dt.auditLog,"Error:",Lt)}}addLogToAudit(Dt,Lt,Tn){if(Lt&&Lt.files){const Wn=Lt.files.findIndex((Lt=>Lt.name===Dt));if(Wn!==-1){return Lt}const Gn=Date.now();Lt.files.push({date:Gn,name:Dt,hash:rr.createHash(Lt.hashType).update(Dt+"LOG_FILE"+Gn).digest("hex")});if(Lt.keep.days){const Dt=mr().subtract(Lt.keep.amount,"days").valueOf();Lt.files=Lt.files.filter((Wn=>{if(Wn.date>Dt){return true}Wn.hashType=Lt.hashType;(0,Sr.removeFile)(Wn);Tn.emit("logRemoved",Wn);return false}))}else{const Dt=Lt.files.splice(-Lt.keep.amount);if(Lt.files.length>0){Lt.files.filter((Dt=>{Dt.hashType=Lt.hashType;(0,Sr.removeFile)(Dt);Tn.emit("logRemoved",Dt);return false}))}Lt.files=Dt}this.writeAuditLog(Lt)}return Lt}getStream(Dt){let Lt=null;let Tn=null;yr(Dt.filename,"options.filename must be supplied");if(Dt.frequency){Lt=this.getFrequency(Dt.frequency)}const Gn=this.setAuditLog(Dt.maxFiles,Dt.auditFile,Dt.filename);if(Gn!=null){Gn.hashType=Dt.auditHashType!==undefined?Dt.auditHashType:"md5"}let rr=null;let gr=0;let Hr=0;if(Dt.size){rr=this.parseFileSize(Dt.size)}let Gr=Dt.dateFormat||Ir;if(Lt&&Lt.type==="daily"){if(!Dt.dateFormat){Gr="YYYY-MM-DD"}if(mr().format(Gr)!==mr().endOf("day").format(Gr)||mr().format(Gr)===mr().add(1,"day").format(Gr)){Er((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");Lt.type="custom"}}if(Lt){Tn=Dt.frequency?this.getDate(Lt,Gr,Dt.utc):""}Dt.createSymlink=Dt.createSymlink||false;Dt.extension=Dt.extension||"";const $r=Dt.filename;let mi=null;let ki=$r+(Tn?"."+Tn:"");if($r.match(/%DATE%/)){ki=$r.replace(/%DATE%/g,Tn?Tn:this.getDate(null,Gr,Dt.utc))}if(rr){let Lt=null;let Tn=ki;if(Gn&&Gn.files&&Gn.files instanceof Array&&Gn.files.length>0){const Dt=Gn.files[Gn.files.length-1].name;if(Dt.match(Tn)){const Lt=Dt.match(Tn+"\\.(\\d+)");if(Lt){Tn=Dt;gr=Lt[1]}}}if(gr===0&&Tn===ki){Tn+=Dt.extension}while(Wn.existsSync(Tn)){Lt=Tn;gr++;Tn=ki+"."+gr+Dt.extension}if(Lt){const Dt=Wn.statSync(Lt);if(Dt.size<rr){Tn=Lt;gr--;Hr=Dt.size}}ki=Tn}else{ki+=Dt.extension}Er((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",ki);(0,Sr.mkDirForFile)(ki);const Ni=Dt.fileOptions||{flags:"a"};let Ri=Wn.createWriteStream(ki,Ni);if(Tn&&Lt&&Or.indexOf(Lt.type)>-1||rr>0){Er((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",Lt?Lt.type:"",rr?"size: "+rr:"");const mr=new cr;mr.auditLog=Gn;mr.filename=Dt.filename;mr.end=(...Dt)=>{Ri.end(...Dt);yr.clear()};mr.canWrite=()=>!Ri.closed&&Ri.writable&&!Ri.destroyed;(0,Sr.BubbleEvents)(Ri,mr);mr.on("new",(Lt=>{mr.auditLog=this.addLogToAudit(Lt,mr.auditLog,mr);if(Dt.createSymlink){(0,Sr.createCurrentSymLink)(Lt,Dt.symlinkName)}}));const yr=(0,Sr.debounce)((()=>{let Dt=false;try{const Dt=Wn.statSync(ki);if(Dt.size>Hr){Hr=Dt.size}}catch(Lt){Dt=true}return Dt}),1e3);mr.write=(Gn,cr)=>{const Or=yr();const Ir=Lt?this.getDate(Lt,Gr,Dt.utc):Tn;if(Or||Tn&&Ir!==Tn||rr&&Hr>rr){let Gn=$r+(Tn&&Lt?"."+Ir:"");if($r.match(/%DATE%/)&&Tn){Gn=$r.replace(/%DATE%/g,Ir)}if(rr&&Hr>rr){gr++;Gn+="."+gr+Dt.extension}else{gr=0;Gn+=Dt.extension}Hr=0;Er((new Date).toLocaleString(),(0,pr.format)("[FileStreamRotator] Changing logs from %s to %s",ki,Gn));Tn=Ir;mi=ki;ki=Gn;if(Dt.endStream===true){Ri.end()}else{Ri.destroy()}(0,Sr.mkDirForFile)(ki);Ri=Wn.createWriteStream(Gn,Ni);mr.emit("new",Gn);mr.emit("rotate",mi,Gn);(0,Sr.BubbleEvents)(Ri,mr)}Ri.write(Gn,cr);Hr+=Buffer.byteLength(Gn,cr)};process.nextTick((()=>{mr.emit("new",ki)}));mr.emit("new",ki);return mr}else{Er((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",Dt.frequency,Dt.size);process.nextTick((()=>{Ri.emit("new",ki)}));return Ri}}}Lt.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(Dt){let Lt;if(this.enabled){if(!this.streamPool.has(Dt.filename)){const Lt=(new FileStreamRotator).getStream(Dt);this.streamPool.set(Dt.filename,Lt);this.loggerRef.set(Lt,0)}Lt=this.streamPool.get(Dt.filename);let Tn=this.loggerRef.get(Lt);this.loggerRef.set(Lt,Tn++)}else{Lt=(new FileStreamRotator).getStream(Dt)}return Lt}static close(Dt){if(this.enabled){if(this.loggerRef.has(Dt)){let Lt=this.loggerRef.get(Dt);Lt--;if(Lt===0){Dt.end();this.streamPool.delete(Dt.filename);this.loggerRef.delete(Dt)}else if(Lt>0){this.loggerRef.set(Dt,Lt)}else{}}}else{Dt.end()}}static clear(){for(const Dt of this.streamPool.values()){Dt.end();if(this.loggerRef.has(Dt)){this.loggerRef.delete(Dt)}}this.streamPool.clear();this.loggerRef=new WeakMap}}Lt.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},19870:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.EmptyTransport=Lt.Transport=void 0;const Wn=Tn(39023);const Gn=Tn(4002);const rr=Tn(28520);class Transport{constructor(Dt={}){this.options=Dt;this.pid=process.pid}setLoggerOptions(Dt){this.loggerOptions=Dt;this.options.level=this.options.level||Dt.level;this.options.format=this.options.format||Dt.format;this.options.contextFormat=this.options.contextFormat||Dt.contextFormat;this.options.eol=this.options.eol||Dt.eol}format(Dt,Lt,Tn){const Gn=this.getLoggerInfo(Dt,Lt,Tn);if(Buffer.isBuffer(Gn.args[0])){return Gn.args[0]}if(Dt===false){return(0,Wn.format)(Gn.message)}const rr=Lt.contextFormat||this.options.contextFormat;if(Lt.ctx&&rr){return rr(Gn)}const cr=Lt.format||this.options.format;if(cr){return cr(Gn)}if(Dt){return(0,Wn.format)("%s %s %s %s",Gn.timestamp,Gn.LEVEL,Gn.pid,Gn.message)}else{return(0,Wn.format)(Gn.message)}}getLoggerInfo(Dt,Lt,Tn){const cr=Dt||"";const pr={level:cr,pid:this.pid};Object.defineProperties(pr,{timestamp:{get(){return(0,Gn.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return rr.LEVEL[cr]||""},enumerable:false},args:{get(){return Tn},enumerable:false},originArgs:{get(){return Tn},enumerable:false},message:{get(){return(0,Wn.format)(...Tn)},enumerable:false},ctx:{get(){return Lt.ctx},enumerable:false},originError:{get(){return Tn.find((Dt=>Dt instanceof Error))},enumerable:false},meta:{get(){return Lt},enumerable:false}});return pr}get level(){return this.options.level}set level(Dt){this.options.level=Dt}}Lt.Transport=Transport;class EmptyTransport extends Transport{log(Dt,...Lt){}close(){}}Lt.EmptyTransport=EmptyTransport},78997:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.supportsColor=Lt.colorizeAll=Lt.colorize=Lt.Color=void 0;const Wn=Tn(932);const Gn=Tn(70857);const rr=Tn(52018);Lt.Color={red:Dt=>`[31m${Dt}[39m`,green:Dt=>`[32m${Dt}[39m`,yellow:Dt=>`[33m${Dt}[39m`,blue:Dt=>`[34m${Dt}[39m`,magenta:Dt=>`[35m${Dt}[39m`,cyan:Dt=>`[36m${Dt}[39m`,white:Dt=>`[37m${Dt}[39m`,gray:Dt=>`[90m${Dt}[39m`,grey:Dt=>`[90m${Dt}[39m`,black:Dt=>`[30m${Dt}[39m`,bgRed:Dt=>`[41m${Dt}[49m`,bgGreen:Dt=>`[42m${Dt}[49m`,bgYellow:Dt=>`[43m${Dt}[49m`,bgBlue:Dt=>`[44m${Dt}[49m`,bgMagenta:Dt=>`[45m${Dt}[49m`,bgCyan:Dt=>`[46m${Dt}[49m`,bgWhite:Dt=>`[47m${Dt}[49m`,bgBlack:Dt=>`[40m${Dt}[49m`,bold:Dt=>`[1m${Dt}[22m`,dim:Dt=>`[2m${Dt}[22m`,italic:Dt=>`[3m${Dt}[23m`,underline:Dt=>`[4m${Dt}[24m`,inverse:Dt=>`[7m${Dt}[27m`,hidden:Dt=>`[8m${Dt}[28m`,strikethrough:Dt=>`[9m${Dt}[29m`};const colorize=(Dt,Tn)=>{if(typeof Tn==="function"){return Tn(Dt)}else{return Lt.Color[Tn](Dt)}};Lt.colorize=colorize;const colorizeAll=(Dt,Tn)=>Dt.replace(/([^\s]+)/g,(Dt=>(0,Lt.colorize)(Dt,Tn)));Lt.colorizeAll=colorizeAll;function hasFlag(Dt,Lt=process.argv){const Tn=Dt.startsWith("-")?"":Dt.length===1?"-":"--";const Wn=Lt.indexOf(Tn+Dt);const Gn=Lt.indexOf("--");return Wn!==-1&&(Gn===-1||Wn<Gn)}let cr;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){cr=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){cr=1}function envForceColor(){if("FORCE_COLOR"in Wn.env){if(Wn.env.FORCE_COLOR==="true"){return 1}if(Wn.env.FORCE_COLOR==="false"){return 0}return Wn.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Wn.env.FORCE_COLOR,10),3)}}function translateLevel(Dt){if(Dt===0){return false}return{level:Dt,hasBasic:true,has256:Dt>=2,has16m:Dt>=3}}function _supportsColor(Dt,Lt){const Tn=Lt.streamIsTTY;const rr=true;const pr=envForceColor();if(pr!==undefined){cr=pr}const mr=rr?cr:pr;if(mr===0){return 0}if(rr){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in Wn.env&&"AGENT_NAME"in Wn.env){return 1}if(Dt&&!Tn&&mr===undefined){return 0}const gr=mr||0;if(Wn.env.TERM==="dumb"){return gr}if(Wn.platform==="win32"){const Dt=Gn.release().split(".");if(Number(Dt[0])>=10&&Number(Dt[2])>=10586){return Number(Dt[2])>=14931?3:2}return 1}if("CI"in Wn.env){if("GITHUB_ACTIONS"in Wn.env||"GITEA_ACTIONS"in Wn.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((Dt=>Dt in Wn.env))||Wn.env.CI_NAME==="codeship"){return 1}return gr}if("TEAMCITY_VERSION"in Wn.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Wn.env.TEAMCITY_VERSION)?1:0}if(Wn.env.COLORTERM==="truecolor"){return 3}if(Wn.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in Wn.env){const Dt=Number.parseInt((Wn.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Wn.env.TERM_PROGRAM){case"iTerm.app":{return Dt>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(Wn.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Wn.env.TERM)){return 1}if("COLORTERM"in Wn.env){return 1}return gr}function createSupportsColor(Dt){const Lt=_supportsColor(true,{streamIsTTY:Dt.isTTY});return translateLevel(Lt)}Lt.supportsColor={stdout:createSupportsColor({isTTY:rr.isatty(1)}),stderr:createSupportsColor({isTTY:rr.isatty(2)})}},61256:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.hash=void 0;const Wn=Tn(76982);const Gn=Tn(2203);function hash(Dt){const Lt={algorithm:"sha1",encoding:"hex",excludeValues:false,ignoreUnknown:false,respectType:true,respectFunctionNames:true,respectFunctionProperties:true,unorderedArrays:false,unorderedSets:true,unorderedObjects:true,replacer:undefined,excludeKeys:undefined};const Tn=Wn.createHash(Lt.algorithm);const Gn=typeHasher(Lt,Tn);Gn.dispatch(Dt);if(!Tn.update){Tn.end("")}return Tn.digest(Lt.encoding)}Lt.hash=hash;function typeHasher(Dt,Lt,Tn){Tn=Tn||[];const write=function(Dt){if(Lt.update){return Lt.update(Dt,"utf8")}else{return Lt.write(Dt,"utf8")}};return{dispatch:function(Lt){if(Dt.replacer){Lt=Dt.replacer(Lt)}let Tn=typeof Lt;if(Lt===null){Tn="null"}return this["_"+Tn](Lt)},_object:function(Lt){const Wn=/\[object (.*)\]/i;const Gn=Object.prototype.toString.call(Lt);let rr=Wn.exec(Gn);if(!rr){rr="unknown:["+Gn+"]"}else{rr=rr[1]}rr=rr.toLowerCase();let cr=null;if((cr=Tn.indexOf(Lt))>=0){return this.dispatch("[CIRCULAR:"+cr+"]")}else{Tn.push(Lt)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(Lt)){write("buffer:");return write(Lt)}if(rr!=="object"&&rr!=="function"&&rr!=="asyncfunction"){if(this["_"+rr]){this["_"+rr](Lt)}else if(Dt.ignoreUnknown){return write("["+rr+"]")}else{throw new Error('Unknown object type "'+rr+'"')}}else{let Tn=Object.keys(Lt);if(Dt.unorderedObjects){Tn=Tn.sort()}if(Dt.respectType!==false&&!isNativeFunction(Lt)){Tn.splice(0,0,"prototype","__proto__","constructor")}if(Dt.excludeKeys){Tn=Tn.filter((Lt=>!Dt.excludeKeys(Lt)))}write("object:"+Tn.length+":");const Wn=this;return Tn.forEach((Tn=>{Wn.dispatch(Tn);write(":");if(!Dt.excludeValues){Wn.dispatch(Lt[Tn])}write(",")}))}},_array:function(Lt,Wn){Wn=typeof Wn!=="undefined"?Wn:Dt.unorderedArrays!==false;const rr=this;write("array:"+Lt.length+":");if(!Wn||Lt.length<=1){return Lt.forEach((Dt=>rr.dispatch(Dt)))}let cr=[];const pr=Lt.map((Lt=>{const Wn=new Gn.PassThrough;const rr=Tn.slice();const pr=typeHasher(Dt,Wn,rr);pr.dispatch(Lt);cr=cr.concat(rr.slice(Tn.length));return Wn.read().toString()}));Tn=Tn.concat(cr);pr.sort();return this._array(pr,false)},_date:function(Dt){return write("date:"+Dt.toJSON())},_symbol:function(Dt){return write("symbol:"+Dt.toString())},_error:function(Dt){return write("error:"+Dt.toString())},_boolean:function(Dt){return write("bool:"+Dt.toString())},_string:function(Dt){write("string:"+Dt.length+":");write(Dt.toString())},_function:function(Lt){write("fn:");if(isNativeFunction(Lt)){this.dispatch("[native]")}else{this.dispatch(Lt.toString())}if(Dt.respectFunctionNames!==false){this.dispatch("function-name:"+String(Lt.name))}if(Dt.respectFunctionProperties){this._object(Lt)}},_number:function(Dt){return write("number:"+Dt.toString())},_xml:function(Dt){return write("xml:"+Dt.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(Dt){return write("regex:"+Dt.toString())},_uint8array:function(Dt){write("uint8array:");return this.dispatch(Array.prototype.slice.call(Dt))},_uint8clampedarray:function(Dt){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(Dt))},_int8array:function(Dt){write("int8array:");return this.dispatch(Array.prototype.slice.call(Dt))},_uint16array:function(Dt){write("uint16array:");return this.dispatch(Array.prototype.slice.call(Dt))},_int16array:function(Dt){write("int16array:");return this.dispatch(Array.prototype.slice.call(Dt))},_uint32array:function(Dt){write("uint32array:");return this.dispatch(Array.prototype.slice.call(Dt))},_int32array:function(Dt){write("int32array:");return this.dispatch(Array.prototype.slice.call(Dt))},_float32array:function(Dt){write("float32array:");return this.dispatch(Array.prototype.slice.call(Dt))},_float64array:function(Dt){write("float64array:");return this.dispatch(Array.prototype.slice.call(Dt))},_arraybuffer:function(Dt){write("arraybuffer:");return this.dispatch(new Uint8Array(Dt))},_url:function(Dt){return write("url:"+Dt.toString())},_map:function(Lt){write("map:");const Tn=Array.from(Lt);return this._array(Tn,Dt.unorderedSets!==false)},_set:function(Lt){write("set:");const Tn=Array.from(Lt);return this._array(Tn,Dt.unorderedSets!==false)},_file:function(Dt){write("file:");return this.dispatch([Dt.name,Dt.size,Dt.type,Dt.lastModfied])},_blob:function(){if(Dt.ignoreUnknown){return write("[blob]")}throw Error("Hashing Blob objects is currently not supported\n"+"(see https://github.com/puleos/object-hash/issues/26)\n"+'Use "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return write("domwindow")},_bigint:function(Dt){return write("bigint:"+Dt.toString())},_process:function(){return write("process")},_timer:function(){return write("timer")},_pipe:function(){return write("pipe")},_tcp:function(){return write("tcp")},_udp:function(){return write("udp")},_tty:function(){return write("tty")},_statwatcher:function(){return write("statwatcher")},_securecontext:function(){return write("securecontext")},_connection:function(){return write("connection")},_zlib:function(){return write("zlib")},_context:function(){return write("context")},_nodescript:function(){return write("nodescript")},_httpparser:function(){return write("httpparser")},_dataview:function(){return write("dataview")},_signal:function(){return write("signal")},_fsevent:function(){return write("fsevent")},_tlswrap:function(){return write("tlswrap")}}}function isNativeFunction(Dt){if(typeof Dt!=="function"){return false}const Lt=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return Lt.exec(Function.prototype.toString.call(Dt))!=null}},4002:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getFormatDate=Lt.isWin32=Lt.BubbleEvents=Lt.formatLegacyLoggerOptions=Lt.formatLoggerOptions=Lt.isDevelopmentEnvironment=Lt.debounce=Lt.throwIf=Lt.getMaxSize=Lt.isValidDirName=Lt.isValidFileName=Lt.removeFile=Lt.createCurrentSymLink=Lt.mkDirForFile=Lt.checkDailyAndTest=Lt.checkNumAndType=Lt.isEnableLevel=void 0;const Wn=Tn(28520);const Gn=Tn(79896);const rr=Tn(16928);const cr=Tn(76982);const pr=Tn(16928);const mr=Tn(70857);const gr=Tn(19870);function isEnableLevel(Dt,Lt){if(!Dt||!Lt){return true}return Wn.DefaultLogLevels[Dt]<=Wn.DefaultLogLevels[Lt]}Lt.isEnableLevel=isEnableLevel;function checkNumAndType(Dt,Lt){if(typeof Lt==="number"){switch(Dt){case"s":case"m":if(Lt<0||Lt>60){return false}break;case"h":if(Lt<0||Lt>24){return false}break}return{type:Dt,digit:Lt}}}Lt.checkNumAndType=checkNumAndType;function checkDailyAndTest(Dt){switch(Dt){case"custom":case"daily":return{type:Dt,digit:undefined};case"test":return{type:Dt,digit:0}}return false}Lt.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(Dt){const Lt=pr.dirname(Dt);Lt.split(pr.sep).reduce(((Dt,Lt)=>{Dt+=Lt+pr.sep;if(!Gn.existsSync(Dt)){try{Gn.mkdirSync(Dt)}catch(Dt){if(Dt.code!=="EEXIST"){throw Dt}}}return Dt}),"")}Lt.mkDirForFile=mkDirForFile;function createCurrentSymLink(Dt,Lt){const Tn=Lt||"current.log";const Wn=(0,rr.dirname)(Dt);const cr=(0,rr.basename)(Dt);const pr=Wn+"/"+Tn;try{const Dt=Gn.lstatSync(pr);if(Dt.isSymbolicLink()){Gn.unlinkSync(pr);Gn.symlinkSync(cr,pr)}}catch(Dt){if(Dt&&Dt.code==="ENOENT"){try{Gn.symlinkSync(cr,pr)}catch(Dt){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",pr," -> ",cr)}}}}Lt.createCurrentSymLink=createCurrentSymLink;function removeFile(Dt){if(Dt.hash===cr.createHash(Dt.hashType).update(Dt.name+"LOG_FILE"+Dt.date).digest("hex")){try{if(Gn.existsSync(Dt.name)){Gn.unlinkSync(Dt.name)}}catch(Lt){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",Dt.name)}}}Lt.removeFile=removeFile;function isValidFileName(Dt){return!/["<>|:*?\\/\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(Dt)}Lt.isValidFileName=isValidFileName;function isValidDirName(Dt){return!/["<>|\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]/g.test(Dt)}Lt.isValidDirName=isValidDirName;function getMaxSize(Dt){if(Dt&&typeof Dt==="string"){const Lt=Dt.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(Lt){return Dt}}else if(Dt&&Number.isInteger(Dt)){const Lt=Math.round(Dt/1024);return Lt===0?"1k":Lt+"k"}return null}Lt.getMaxSize=getMaxSize;function throwIf(Dt,...Lt){Array.prototype.slice.call(Lt,1).forEach((Tn=>{if(Dt[Tn]){throw new Error("Cannot set "+Tn+" and "+Lt[0]+" together")}}))}Lt.throwIf=throwIf;function debounce(Dt,Lt,Tn){let Wn,Gn,rr,cr,pr;if(null==Lt)Lt=100;function later(){const mr=Date.now()-cr;if(mr<Lt&&mr>=0){Wn=setTimeout(later,Lt-mr)}else{Wn=null;if(!Tn){pr=Dt.apply(rr,Gn);rr=Gn=null}}}const debounced=(...Gn)=>{rr=this;cr=Date.now();const mr=Tn&&!Wn;if(!Wn)Wn=setTimeout(later,Lt);if(mr){pr=Dt.apply(rr,Gn);rr=Gn=null}return pr};debounced.clear=()=>{if(Wn){clearTimeout(Wn);Wn=null}};debounced.flush=()=>{if(Wn){pr=Dt.apply(rr,Gn);rr=Gn=null;clearTimeout(Wn);Wn=null}};return debounced}Lt.debounce=debounce;const isDevelopmentEnvironment=Dt=>["local","test","unittest"].includes(Dt);Lt.isDevelopmentEnvironment=isDevelopmentEnvironment;const yr={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(Dt){if(Object.keys(Dt).some((Dt=>yr[Dt]))){const Lt={transports:{}};for(const Tn of Object.keys(Dt)){if(!yr[Tn]){Lt[Tn]=Dt[Tn]}}if(Lt.transports["console"]&&(Dt["enableConsole"]===false||Dt["disableConsole"]===true)){Lt.transports["console"]=false}if(Lt.transports["file"]&&(Dt["enableFile"]===false||Dt["disableFile"]===true)){Lt.transports["file"]=false}if(Lt.transports["error"]&&(Dt["enableError"]===false||Dt["disableError"]===true)){Lt.transports["error"]=false}if(Lt.transports["json"]&&Dt["enableJSON"]===false){Lt.transports["json"]=false}return Lt}return Dt}Lt.formatLoggerOptions=formatLoggerOptions;const Sr={level:{category:"top",mappingKey:"level",isOld:false},consoleLevel:{category:"console",mappingKey:"level",isOld:true},fileLevel:{category:"file",mappingKey:"level",isOld:true},jsonLevel:{category:"json",mappingKey:"level",isOld:true},format:{category:"top",mappingKey:"format",isOld:false},contextFormat:{category:"top",mappingKey:"contextFormat",isOld:false},jsonFormat:{category:"json",mappingKey:"format",isOld:true},dir:{category:["file","error","json"],mappingKey:"dir",isOld:true},errorDir:{category:"error",mappingKey:"dir",overwriteIfExists:true,isOld:true},jsonDir:{category:"json",mappingKey:"dir",overwriteIfExists:true,isOld:true},aliasName:{ignore:true,isOld:false},fileLogName:{category:["file"],mappingKey:"fileLogName",isOld:true},errorLogName:{category:"error",mappingKey:"fileLogName",overwriteIfExists:true,isOld:true},jsonLogName:{category:"json",mappingKey:"fileLogName",overwriteIfExists:true,isOld:true},enableConsole:{ignore:true,isOld:true},enableFile:{ignore:true,isOld:true},enableError:{ignore:true,isOld:true},enableJSON:{ignore:true,isOld:true},disableSymlink:{category:["file","error","json"],mappingKey:"createSymlink",isOld:true},disableFileSymlink:{category:"file",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},disableErrorSymlink:{category:"error",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},disableJSONSymlink:{category:"json",mappingKey:"createSymlink",reverseValue:true,overwriteIfExists:true,isOld:true},maxSize:{category:["file","error","json"],mappingKey:"maxSize",isOld:true},fileMaxSize:{category:"file",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},errMaxSize:{category:"error",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},jsonMaxSize:{category:"json",mappingKey:"maxSize",overwriteIfExists:true,isOld:true},maxFiles:{category:["file","error","json"],mappingKey:"maxFiles",isOld:true},fileMaxFiles:{category:"file",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},errMaxFiles:{category:"error",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},jsonMaxFiles:{category:"json",mappingKey:"maxFiles",overwriteIfExists:true,isOld:true},eol:{category:"top",mappingKey:"eol",isOld:false},jsonEol:{category:"json",mappingKey:"eol",isOld:true},zippedArchive:{category:["file","error","json"],mappingKey:"zippedArchive",isOld:true},fileZippedArchive:{category:"file",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},errZippedArchive:{category:"error",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},jsonZippedArchive:{category:"json",mappingKey:"zippedArchive",overwriteIfExists:true,isOld:true},datePattern:{category:["file","error","json"],mappingKey:"datePattern",isOld:true},fileDatePattern:{category:"file",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},errDatePattern:{category:"error",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},jsonDatePattern:{category:"json",mappingKey:"datePattern",overwriteIfExists:true,isOld:true},auditFileDir:{category:["file","error","json"],mappingKey:"auditFileDir",isOld:true},printFormat:{category:"top",mappingKey:"format",isOld:true},defaultMeta:{ignore:true,isOld:true},defaultLabel:{ignore:true,isOld:true},disableConsole:{ignore:true,isOld:true},disableFile:{ignore:true,isOld:true},disableError:{ignore:true,isOld:true},fileOptions:{category:["file","error","json"],mappingKey:"fileOptions",isOld:true}};const Er=Object.prototype.hasOwnProperty;const Or=Object.prototype.toString;function formatLegacyLoggerOptions(Dt){var Lt,Tn,Wn,Gn,rr,cr;function isPlainObject(Dt){if(!Dt||Or.call(Dt)!=="[object Object]"){return false}const Lt=Er.call(Dt,"constructor");const Tn=Dt.constructor&&Dt.constructor.prototype&&Er.call(Dt.constructor.prototype,"isPrototypeOf");if(Dt.constructor&&!Lt&&!Tn){return false}let Wn;for(Wn in Dt){}return typeof Wn==="undefined"||Er.call(Dt,Wn)}function deepMerge(Dt,Lt){if(!Dt){return Lt}if(Lt&&!isPlainObject(Lt)){return Lt}for(const Tn of Object.keys(Lt)){if(Lt[Tn]instanceof Object){Object.assign(Lt[Tn],deepMerge(Dt[Tn],Lt[Tn]))}}Object.assign(Dt||{},Lt);return Dt}function setTransportOptions(Lt,Tn,Wn,Gn=false){var rr,cr;if(!Lt.transports[Wn]){Lt.transports[Wn]={}}const pr=(rr=Sr[Tn].mappingKey)!==null&&rr!==void 0?rr:Tn;if(Gn){Lt.transports[Wn][pr]=Dt[Tn]}else{Lt.transports[Wn][pr]=(cr=Lt.transports[Wn][pr])!==null&&cr!==void 0?cr:Dt[Tn]}}function isValidTransport(Dt){return Dt&&(Dt instanceof gr.Transport||typeof Dt==="object"&&Dt["dir"]&&Dt["fileLogName"])}if(Object.keys(Dt).some((Dt=>{var Lt;return(Lt=Sr[Dt])===null||Lt===void 0?void 0:Lt.isOld}))){const pr={transports:{}};for(const Tn of Object.keys(Dt)){if(!Sr[Tn]){continue}else{if(Sr[Tn].ignore){continue}Sr[Tn].category=[].concat(Sr[Tn].category);for(const Wn of Sr[Tn].category){if(Wn==="all"){for(const Dt of Object.keys(pr.transports)){setTransportOptions(pr,Tn,Dt,Sr[Tn].overwriteIfExists)}}else if(Wn==="top"){pr[Tn]=(Lt=pr[Tn])!==null&&Lt!==void 0?Lt:Dt[Sr[Tn].mappingKey]}else{setTransportOptions(pr,Tn,Wn,Sr[Tn].overwriteIfExists)}}}}for(const Lt of Object.keys(Dt)){if(!Sr[Lt]){deepMerge(pr[Lt],Dt[Lt])}}if(Dt["enableConsole"]===false||Dt["disableConsole"]===true){pr.transports["console"]=false}else{pr.transports["console"]=(Tn=pr.transports["console"])!==null&&Tn!==void 0?Tn:{}}if(Dt["enableFile"]===false||Dt["disableFile"]===true){pr.transports["file"]=false}else{pr.transports["file"]=(Wn=pr.transports["file"])!==null&&Wn!==void 0?Wn:{}}if(Dt["enableError"]===false||Dt["disableError"]===true){pr.transports["error"]=false}else{pr.transports["error"]=(Gn=pr.transports["error"])!==null&&Gn!==void 0?Gn:{}}if(((rr=Dt===null||Dt===void 0?void 0:Dt.transports)===null||rr===void 0?void 0:rr["json"])===undefined&&(Dt["enableJSON"]===undefined||Dt["enableJSON"]===false)){pr.transports["json"]=false}else{}for(const Dt of["file","error","json"]){if((cr=pr===null||pr===void 0?void 0:pr.transports)===null||cr===void 0?void 0:cr[Dt]){if(!isValidTransport(pr.transports[Dt])){delete pr.transports[Dt]}}}return pr}return Dt}Lt.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(Dt,Lt){Dt.on("close",(()=>{Lt.emit("close")}));Dt.on("finish",(()=>{Lt.emit("finish")}));Dt.on("error",(Dt=>{Lt.emit("error",Dt)}));Dt.on("open",(Dt=>{Lt.emit("open",Dt)}))}Lt.BubbleEvents=BubbleEvents;function isWin32(){return mr.platform()==="win32"}Lt.isWin32=isWin32;function getFormatDate(Dt){function pad(Dt,Lt=2){const Tn=Dt+"";return Tn.padStart(Lt,"0")}const Lt=Dt.getFullYear();const Tn=Dt.getMonth()+1;const Wn=Dt.getDate();const Gn=Dt.getHours();const rr=Dt.getMinutes();const cr=Dt.getSeconds();const pr=Dt.getMilliseconds();return`${Lt}-${pad(Tn)}-${pad(Wn)} ${pad(Gn)}:${pad(rr)}:${pad(cr)}.${pad(pr,3)}`}Lt.getFormatDate=getFormatDate},74129:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.session=void 0;Lt.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},16885:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SessionConfiguration=void 0;const rr=Tn(46123);const cr=Tn(74129);const pr=Tn(97628);let mr=class SessionConfiguration{async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((Dt=>{if(Dt.on){Dt.on("session:missed",(({ctx:Dt,key:Lt})=>{this.logger.warn("[session][missed] key(%s)",Lt)}));Dt.on("session:expired",(({ctx:Dt,key:Lt,value:Tn})=>{this.logger.warn("[session][expired] key(%s) value(%j)",Lt,this.sessionConfig.logValue?Tn:"")}));Dt.on("session:invalid",(({ctx:Dt,key:Lt,value:Tn})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",Lt,this.sessionConfig.logValue?Tn:"")}))}Dt.useMiddleware(pr.SessionMiddleware)}))}}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);Wn([(0,rr.Logger)("coreLogger"),Gn("design:type",Object)],mr.prototype,"logger",void 0);Wn([(0,rr.Config)("session"),Gn("design:type",Object)],mr.prototype,"sessionConfig",void 0);mr=Wn([(0,rr.Configuration)({namespace:"session",importConfigs:[{default:cr}]})],mr);Lt.SessionConfiguration=mr},65579:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;Gn(Tn(58864),Lt);var rr=Tn(16885);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.SessionConfiguration}});Gn(Tn(97628),Lt);Gn(Tn(11586),Lt)},58864:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.SessionStore=void 0;class SessionStore{}Lt.SessionStore=SessionStore},56720:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ContextSession=void 0;const Wn=Tn(39023);const Gn=Tn(92355);const rr=Tn(16859);const cr=(0,Wn.debuglog)("session:context");class ContextSession{constructor(Dt,Lt){this.ctx=Dt;this.app=Dt.app;this.opts=Object.assign({},Lt);this.store=this.opts.ContextStore?new this.opts.ContextStore(Dt):this.opts.store}get(){const Dt=this.session;if(Dt)return Dt;if(Dt===false)return null;this.store?this.create():this.initFromCookie();return this.session}set(Dt){if(Dt===null){this.session=false;return}if(typeof Dt==="object"){this.create(Dt,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){cr("init from external");const Dt=this.ctx;const Lt=this.opts;let Tn;if(Lt.externalKey){Tn=Lt.externalKey.get(Dt);cr("get external key from custom %s",Tn)}else{Tn=Dt.cookies.get(Lt.key,Lt);cr("get external key from cookie %s",Tn)}if(!Tn){this.create();return}const Wn=await this.store.get(Tn,Lt.maxAge,{ctx:Dt,rolling:Lt.rolling});if(!this.valid(Wn,Tn)){this.create();return}this.create(Wn,Tn);this.prevHash=(0,Gn.hash)(this.session.toJSON())}initFromCookie(){cr("init from cookie");const Dt=this.ctx;const Lt=this.opts;const Tn=Dt.cookies.get(Lt.key,Lt);if(!Tn){this.create();return}let Wn;cr("parse %s",Tn);try{Wn=Lt.decode(Tn)}catch(Wn){cr("decode %j error: %s",Tn,Wn);if(!(Wn instanceof SyntaxError)){Dt.cookies.set(Lt.key,"",Lt);Wn.headers={"set-cookie":Dt.response.get("set-cookie")};throw Wn}this.create();return}cr("parsed %j",Wn);if(!this.valid(Wn)){this.create();return}this.create(Wn);this.prevHash=(0,Gn.hash)(this.session.toJSON())}valid(Dt,Lt){const Tn=this.ctx;if(!Dt){this.emit("missed",{key:Lt,value:Dt,ctx:Tn});return false}if(Dt._expire&&Dt._expire<Date.now()){cr("expired session");this.emit("expired",{key:Lt,value:Dt,ctx:Tn});return false}const Wn=this.opts.valid;if(typeof Wn==="function"&&!Wn(Tn,Dt)){cr("invalid session");this.emit("invalid",{key:Lt,value:Dt,ctx:Tn});return false}return true}emit(Dt,Lt){setImmediate((()=>{this.app.emit(`session:${Dt}`,Lt)}))}create(Dt,Lt){cr("create session with val: %j externalKey: %s",Dt,Lt);if(this.store){this.externalKey=Lt||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new rr.Session(this,Dt,this.externalKey)}async commit({save:Dt=false,regenerate:Lt=false}={}){const Tn=this.session;const Wn=this.opts;const Gn=this.ctx;if(undefined===Tn)return;if(Tn===false){await this.remove();return}if(Lt){await this.remove();if(this.store)this.externalKey=Wn.genid&&Wn.genid(Gn)}const rr=Dt||Lt||Tn._requireSave?"force":this._shouldSaveSession();cr("should save session: %s",rr);if(!rr)return;if(typeof Wn.beforeSave==="function"){cr("before save");Wn.beforeSave(Gn,Tn)}const pr=rr==="changed";await this.save(pr)}_shouldSaveSession(){const Dt=this.prevHash;const Lt=this.session;const Tn=Lt.toJSON();if(!Dt&&!Object.keys(Tn).length)return"";const Wn=Dt!==(0,Gn.hash)(Tn);if(Wn)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const Dt=Lt._expire;const Tn=Lt.maxAge;if(Dt&&Tn&&Dt-Date.now()<Tn/2)return"renew"}return""}async remove(){const Dt=Object.assign({},this.opts,{expires:Gn.COOKIE_EXP_DATE,maxAge:false});const Lt=this.ctx;const Tn=Dt.key;const Wn=this.externalKey;if(Wn){await this.store.destroy(Wn,{ctx:Lt})}Lt.cookies.set(Tn,"",Dt)}async save(Dt){const Lt=this.opts;const Tn=Lt.key;const Wn=this.externalKey;let rr=this.session.toJSON();let pr=Lt.maxAge?Lt.maxAge:Gn.ONE_DAY;if(pr==="session"){Lt.maxAge=undefined;rr._session=true}else{rr._expire=pr+Date.now();rr._maxAge=pr}if(Wn){cr("save %j to external key %s",rr,Wn);if(typeof pr==="number"){pr+=1e4}await this.store.set(Wn,rr,pr,{changed:Dt,ctx:this.ctx,rolling:Lt.rolling});if(Lt.externalKey){Lt.externalKey.set(this.ctx,Wn)}else{this.ctx.cookies.set(Tn,Wn,Lt)}return}cr("save %j to cookie",rr);rr=Lt.encode(rr);cr("save %s",rr);this.ctx.cookies.set(Tn,rr,Lt)}}Lt.ContextSession=ContextSession},81361:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.crc32=void 0;const Tn=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];function crc32(Dt,Lt=false){let Wn=~0;for(let Lt=0,Gn=Dt.length;Lt<Gn;Lt++){Wn=Wn>>>8^Tn[(Wn^Dt.charCodeAt(Lt))&255]}Wn=Math.abs(Wn^-1);return Lt?Wn.toString(16):Wn}Lt.crc32=crc32},16859:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Session=void 0;class Session{constructor(Dt,Lt,Tn){this.isNew=true;this._sessCtx=Dt;this._ctx=Dt.ctx;this._externalKey=Tn;if(!Lt){this.isNew=true}else{for(const Dt in Lt){if(Dt==="_maxAge")this._ctx.sessionOptions.maxAge=Lt._maxAge;else if(Dt==="_session")this._ctx.sessionOptions.maxAge="session";else this[Dt]=Lt[Dt]}}}toJSON(){const Dt={};Object.keys(this).forEach((Lt=>{if(Lt==="isNew")return;if(Lt[0]==="_")return;Dt[Lt]=this[Lt]}));return Dt}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(Dt){this._ctx.sessionOptions.maxAge=Dt;this._requireSave=true}get externalKey(){return this._externalKey}save(Dt){return this.commit({save:true},Dt)}regenerate(Dt){return this.commit({regenerate:true},Dt)}manuallyCommit(){return this.commit()}commit(Dt,Lt){if(typeof Dt==="function"){Lt=Dt;Dt={}}const Tn=this._sessCtx.commit(Dt);if(Lt){Tn.then((()=>Lt()),Lt)}else{return Tn}}}Lt.Session=Session},11586:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SessionStoreManager=void 0;const Gn=Tn(46123);let rr=class SessionStoreManager{setSessionStore(Dt){this.sessionStore=Dt}getSessionStore(){return this.sessionStore}};rr=Wn([(0,Gn.Provide)(),(0,Gn.Scope)(Gn.ScopeEnum.Singleton)],rr);Lt.SessionStoreManager=rr},92355:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ONE_DAY=Lt.COOKIE_EXP_DATE=Lt.hash=Lt.encode=Lt.decode=void 0;const Wn=Tn(81361);function decode(Dt){const Lt=Buffer.from(Dt,"base64").toString("utf8");return JSON.parse(Lt)}Lt.decode=decode;function encode(Dt){Dt=JSON.stringify(Dt);return Buffer.from(Dt).toString("base64")}Lt.encode=encode;function hash(Dt){return(0,Wn.crc32)(JSON.stringify(Dt))}Lt.hash=hash;Lt.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");Lt.ONE_DAY=24*60*60*1e3},97628:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SessionMiddleware=void 0;const rr=Tn(46123);const cr=Tn(11586);const pr=Tn(92355);const mr=Tn(42613);const gr=Tn(56720);const yr=Symbol("context#contextSession");const Sr=Symbol("context#_contextSession");function formatOpts(Dt){Dt=Dt||{};Dt.key=Dt.key||"koa.sess";if(!("maxAge"in Dt))Dt.maxAge=Dt.maxage;if(Dt.overwrite==null)Dt.overwrite=true;if(Dt.httpOnly==null)Dt.httpOnly=true;if(Dt.sameSite==null)delete Dt.sameSite;if(Dt.signed==null)Dt.signed=true;if(Dt.autoCommit==null)Dt.autoCommit=true;if(typeof Dt.encode!=="function"){Dt.encode=pr.encode}if(typeof Dt.decode!=="function"){Dt.decode=pr.decode}const Lt=Dt.store;if(Lt){mr(rr.Types.isFunction(Lt.get),"store.get must be function");mr(rr.Types.isFunction(Lt.set),"store.set must be function");mr(rr.Types.isFunction(Lt.destroy),"store.destroy must be function")}const Tn=Dt.externalKey;if(Tn){mr(rr.Types.isFunction(Tn.get),"externalKey.get must be function");mr(rr.Types.isFunction(Tn.set),"externalKey.set must be function")}const Wn=Dt.ContextStore;if(Wn){mr(rr.Types.isClass(Wn),"ContextStore must be a class");mr(rr.Types.isFunction(Wn.prototype.get),"ContextStore.prototype.get must be function");mr(rr.Types.isFunction(Wn.prototype.set),"ContextStore.prototype.set must be function");mr(rr.Types.isFunction(Wn.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!Dt.genid){if(Dt.prefix){Dt.genid=()=>`${Dt.prefix}${rr.Utils.randomUUID()}`}else{Dt.genid=rr.Utils.randomUUID}}return Dt}function extendContext(Dt,Lt){if(Dt.hasOwnProperty(yr)){return}Object.defineProperties(Dt,{[yr]:{get(){if(this[Sr]){return this[Sr]}this[Sr]=new gr.ContextSession(this,Lt);return this[Sr]}},session:{get(){return this[yr].get()},set(Dt){this[yr].set(Dt)},configurable:true},sessionOptions:{get(){return this[yr].opts}}})}let Er=class SessionMiddleware{resolve(Dt){if(!this.sessionConfig.httpOnly){this.logger.warn("[midway-session]: please set `config.session.httpOnly` to true. It is very dangerous if session can read by client JavaScript.")}const Lt=this.sessionStoreManager.getSessionStore();if(Lt){this.sessionConfig.store=Lt}const Tn=formatOpts(this.sessionConfig);extendContext(Dt.context,Tn);return async function session(Dt,Lt){const Wn=Dt[yr];if(Wn.store){await Wn.initFromExternal()}try{await Lt()}finally{if(Tn.autoCommit){await Wn.commit()}}}}static getName(){return"session"}};Wn([(0,rr.Config)("session"),Gn("design:type",Object)],Er.prototype,"sessionConfig",void 0);Wn([(0,rr.Logger)(),Gn("design:type",Object)],Er.prototype,"logger",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.SessionStoreManager)],Er.prototype,"sessionStoreManager",void 0);Er=Wn([(0,rr.Middleware)()],Er);Lt.SessionMiddleware=Er},96313:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SocketIOConfiguration=void 0;const Gn=Tn(46123);let rr=class SocketIOConfiguration{};rr=Wn([(0,Gn.Configuration)({namespace:"socketIO"})],rr);Lt.SocketIOConfiguration=rr},53739:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwaySocketIOFramework=void 0;const Gn=Tn(46123);const rr=Tn(39023);const cr=(0,rr.debuglog)("midway:socket.io");const pr=Tn(46966);const mr=Tn(46123);let gr=class MidwaySocketIOFramework extends Gn.BaseFramework{constructor(){super(...arguments);this.namespaceList=[];this.connectionMiddlewareManager=this.createMiddlewareManager()}configure(){return this.configService.getConfiguration("socketIO")}applicationInitialize(){this.app=new pr.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:Dt=>this.useConnectionMiddleware(Dt),getConnectionMiddleware:()=>this.getConnectionMiddleware()})}async run(){await this.loadMidwayController();if(this.configurationOptions.adapter){this.app.adapter(this.configurationOptions.adapter);this.logger.debug("[midway:socketio] init socket.io-redis ready!")}if(this.configurationOptions.port){this.app.listen(this.configurationOptions.port,this.configurationOptions);this.logger.info(`[midway:socketio] Socket.io server port = ${this.configurationOptions.port} start success`)}else if(this.applicationContext.hasObject(Gn.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(Gn.HTTP_SERVER_KEY),this.configurationOptions);this.logger.info("[midway:socketio] Socket.io server start success and attach to web server")}}async beforeStop(){return new Promise((Dt=>{this.app.close((()=>{setTimeout((()=>{Dt()}),1e3)}))}))}getFrameworkType(){return Gn.MidwayFrameworkType.WS_IO}async loadMidwayController(){const Dt=(0,mr.listModule)(mr.WS_CONTROLLER_KEY);for(const Lt of Dt){await this.addNamespace(Lt)}}async addNamespace(Dt){var Lt,Tn;const Wn=(0,mr.getClassMetadata)(mr.WS_CONTROLLER_KEY,Dt);const rr=this.app.of(Wn.namespace);this.namespaceList.push(Wn.namespace);const pr=(Lt=Wn.routerOptions.middleware)!==null&&Lt!==void 0?Lt:[];const gr=(Tn=Wn.routerOptions.connectionMiddleware)!==null&&Tn!==void 0?Tn:[];rr.use(((Dt,Lt)=>{this.app.createAnonymousContext(Dt);Dt.requestContext.registerObject("socket",Dt);Dt.app=this.app;Lt()}));rr.on("connect",(Lt=>{let Tn=this.middlewareService.compose([...this.connectionMiddlewareManager,...gr],this.app).then((Dt=>Dt(Lt)));const Wn=(0,mr.getClassMetadata)(mr.WS_EVENT_KEY,Dt);const rr={};const yr=Wn.filter((Dt=>Dt.eventType===mr.WSEventTypeEnum.ON_CONNECTION));if(yr.length){Tn=Tn.then((()=>Promise.all(yr.map((async Tn=>{var Wn;rr[Tn.propertyName]=rr[Tn.propertyName]||{responseEvents:[]};const Gn=await Lt.requestContext.getAsync(Dt);try{const Dt=await this.middlewareService.compose([...((Wn=Tn===null||Tn===void 0?void 0:Tn.eventOptions)===null||Wn===void 0?void 0:Wn.middleware)||[],async(Dt,Wn)=>Gn[Tn.propertyName].apply(Gn,[Lt])],this.app);const cr=await Dt(Lt);await this.bindSocketResponse(cr,Lt,Tn.propertyName,rr)}catch(Dt){this.logger.error(Dt)}})))))}const Sr=Wn.filter((Dt=>Dt.eventType!==mr.WSEventTypeEnum.ON_CONNECTION));if(Sr.length){for(const Wn of Sr){rr[Wn.propertyName]=rr[Wn.propertyName]||{responseEvents:[]};if(Wn.eventType===mr.WSEventTypeEnum.ON_MESSAGE){Lt.on(Wn.messageEventName,(async(...mr)=>{await Tn;const gr=await Lt.requestContext.getAsync(Dt);cr("got message",Wn.messageEventName,mr);try{const Tn=await(await this.applyMiddleware((async(Lt,Tn)=>{var rr;const cr=await this.middlewareService.compose([...pr,...((rr=Wn===null||Wn===void 0?void 0:Wn.eventOptions)===null||rr===void 0?void 0:rr.middleware)||[],async(Lt,Tn)=>{const rr=await this.app.getFramework().runGuard(Lt,Dt,Wn.propertyName);if(!rr){throw new Gn.MidwayInvokeForbiddenError(Wn.propertyName,Dt)}return gr[Wn.propertyName].apply(gr,mr)}],this.app);return await cr(Lt,Tn)})))(Lt);if(typeof mr[mr.length-1]==="function"){mr[mr.length-1](Tn)}else{await this.bindSocketResponse(Tn,Lt,Wn.propertyName,rr)}}catch(Dt){this.logger.error(Dt)}}))}else if(Wn.eventType===mr.WSEventTypeEnum.ON_DISCONNECTION){Lt.on("disconnect",(async Tn=>{const Gn=await Lt.requestContext.getAsync(Dt);try{const Dt=await Gn[Wn.propertyName].apply(Gn,[Tn]);await this.bindSocketResponse(Dt,Lt,Wn.propertyName,rr)}catch(Dt){this.logger.error(Dt)}}))}else{rr[Wn.propertyName].responseEvents.push(Wn)}}}}));if(rr.adapter&&rr.adapter.on){rr.adapter.on("error",(Dt=>{this.logger.error(Dt)}))}rr.on("error",(Dt=>{this.logger.error(Dt)}))}async bindSocketResponse(Dt,Lt,Tn,Wn){if(Dt&&Wn[Tn]){for(const Gn of Wn[Tn].responseEvents){if(Gn.eventType===mr.WSEventTypeEnum.EMIT){if(Gn.roomName.length){Lt=Gn.roomName.reduce(((Dt,Lt)=>Dt.to(Lt)),Lt)}Lt.emit.apply(Lt,[Gn.messageEventName].concat(Dt))}else if(Gn.eventType===mr.WSEventTypeEnum.BROADCAST){Lt.nsp.emit.apply(Lt.nsp,[].concat(Dt))}}}}getFrameworkName(){return"midway:socketIO"}useConnectionMiddleware(Dt){this.connectionMiddlewareManager.insertLast(Dt)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};gr=Wn([(0,mr.Framework)()],gr);Lt.MidwaySocketIOFramework=gr},87735:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=Lt.createRedisAdapter=Lt.Framework=void 0;var rr=Tn(53739);Object.defineProperty(Lt,"Framework",{enumerable:true,get:function(){return rr.MidwaySocketIOFramework}});var cr=Tn(47191);Object.defineProperty(Lt,"createRedisAdapter",{enumerable:true,get:function(){return cr.createRedisAdapter}});Gn(Tn(94460),Lt);var pr=Tn(96313);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return pr.SocketIOConfiguration}})},94460:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},47191:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.createRedisAdapter=void 0;const Wn=Tn(56748);function createRedisAdapter(Dt){if(Dt.host&&Dt.port){return(0,Wn.createAdapter)("redis://"+Dt.host+":"+Dt.port,Dt)}if(Dt.pubClient&&Dt.subClient){return(0,Wn.createAdapter)(Dt)}throw new Error("error socket adapter options")}Lt.createRedisAdapter=createRedisAdapter},95567:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});const Wn=Tn(16928);Lt["default"]=Dt=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,Wn.join)(Dt.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},40647:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.StaticFileConfiguration=void 0;const rr=Tn(46123);const cr=Tn(88218);const pr=Tn(95567);let mr=class StaticFileConfiguration{async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(Dt){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((Lt=>{if(Dt.hasNamespace("cross-domain")){Lt.getMiddleware().insertAfter(cr.StaticMiddleware,"cors")}else{Lt.getMiddleware().insertFirst(cr.StaticMiddleware)}}))}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);mr=Wn([(0,rr.Configuration)({namespace:"static-file",importConfigs:[{default:pr}]})],mr);Lt.StaticFileConfiguration=mr},44803:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DirectoryNotFoundError=Lt.StaticFileErrorEnum=void 0;const Wn=Tn(46123);Lt.StaticFileErrorEnum=(0,Wn.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends Wn.MidwayError{constructor(Dt){super(`Path ${Dt} not exist, please check it.`,Lt.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}Lt.DirectoryNotFoundError=DirectoryNotFoundError},2865:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(40647);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.StaticFileConfiguration}});Gn(Tn(88218),Lt);Gn(Tn(20066),Lt);Gn(Tn(44803),Lt)},20066:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},88218:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.StaticMiddleware=void 0;const rr=Tn(46123);const cr=Tn(42613);const pr=Tn(4239);const mr=Tn(91404);const gr=Tn(93546);const yr=Tn(44803);const Sr=Tn(79896);let Er=class StaticMiddleware{async resolve(Dt){const Lt=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){Lt.push(this.staticFileConfig.dir)}const Tn=[];function rangeMiddleware(Dt,Lt){const Wn=Tn.some((Lt=>Dt.path.startsWith(Lt)));if(Wn){return gr(Dt,Lt)}return Lt()}const Wn=[rangeMiddleware];for(const Dt of Lt){cr(rr.Types.isObject(Dt)||rr.Types.isString(Dt),"`config.static.dir` must be `string | Array<string|object>`.");const Lt=Object.assign({},this.staticFileConfig,Dt);if(Lt.dynamic&&!Lt.files){Lt.files=new mr(Lt.maxFiles)}if(Lt.prefix){Tn.push(Lt.prefix)}if(this.environmentService.isPkgEnvironment()){if(!Sr.existsSync(Lt.dir)){throw new yr.DirectoryNotFoundError(Lt.dir)}}else{if(!await rr.FileUtils.exists(Lt.dir)){throw new yr.DirectoryNotFoundError(Lt.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",Lt.prefix,Lt.dir);Wn.push(pr(Lt))}return await this.middlewareService.compose(Wn,Dt,"staticFile")}static getName(){return"staticFile"}};Wn([(0,rr.Config)("staticFile"),Gn("design:type",Object)],Er.prototype,"staticFileConfig",void 0);Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayMiddlewareService)],Er.prototype,"middlewareService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayEnvironmentService)],Er.prototype,"environmentService",void 0);Wn([(0,rr.Logger)("coreLogger"),Gn("design:type",Object)],Er.prototype,"logger",void 0);Er=Wn([(0,rr.Middleware)()],Er);Lt.StaticMiddleware=Er},73455:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.isEnumMetadata=Lt.isEnumDefined=Lt.isEnumArray=Lt.addEnumSchema=Lt.addEnumArraySchema=Lt.getEnumType=Lt.getEnumValues=void 0;function getEnumValues(Dt){if(Array.isArray(Dt)){return Dt}if(typeof Dt!=="object"){return[]}const Lt=Object.keys(Dt).filter((Dt=>isNaN(Number(Dt)))).map((Lt=>Dt[Lt]));return Array.from(new Set(Lt))}Lt.getEnumValues=getEnumValues;function getEnumType(Dt){const Lt=Dt.filter((Dt=>typeof Dt==="string")).length>0;return Lt?"string":"number"}Lt.getEnumType=getEnumType;function addEnumArraySchema(Dt,Lt){const Tn=Dt.schema||{};Dt.schema=Tn;Tn.type="array";delete Dt.isArray;const Wn=getEnumValues(Lt.enum);Tn.items={type:getEnumType(Wn),enum:Wn};if(Lt.enumName){Dt.enumName=Lt.enumName}}Lt.addEnumArraySchema=addEnumArraySchema;function addEnumSchema(Dt,Lt){const Tn=Dt.schema||{};const Wn=getEnumValues(Lt.enum);Dt.schema=Tn;Tn.enum=Wn;Tn.type=getEnumType(Wn);if(Lt.enumName){Dt.enumName=Lt.enumName}}Lt.addEnumSchema=addEnumSchema;const isEnumArray=Dt=>Dt.isArray&&Dt.enum;Lt.isEnumArray=isEnumArray;const isEnumDefined=Dt=>Dt.enum;Lt.isEnumDefined=isEnumDefined;const isEnumMetadata=Dt=>{var Lt;return Dt.enum||Dt.isArray&&((Lt=Dt.items)===null||Lt===void 0?void 0:Lt["enum"])};Lt.isEnumMetadata=isEnumMetadata},80163:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.HttpStatus=void 0;var Tn;(function(Dt){Dt[Dt["CONTINUE"]=100]="CONTINUE";Dt[Dt["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";Dt[Dt["PROCESSING"]=102]="PROCESSING";Dt[Dt["EARLYHINTS"]=103]="EARLYHINTS";Dt[Dt["OK"]=200]="OK";Dt[Dt["CREATED"]=201]="CREATED";Dt[Dt["ACCEPTED"]=202]="ACCEPTED";Dt[Dt["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";Dt[Dt["NO_CONTENT"]=204]="NO_CONTENT";Dt[Dt["RESET_CONTENT"]=205]="RESET_CONTENT";Dt[Dt["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";Dt[Dt["AMBIGUOUS"]=300]="AMBIGUOUS";Dt[Dt["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";Dt[Dt["FOUND"]=302]="FOUND";Dt[Dt["SEE_OTHER"]=303]="SEE_OTHER";Dt[Dt["NOT_MODIFIED"]=304]="NOT_MODIFIED";Dt[Dt["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";Dt[Dt["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";Dt[Dt["BAD_REQUEST"]=400]="BAD_REQUEST";Dt[Dt["UNAUTHORIZED"]=401]="UNAUTHORIZED";Dt[Dt["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";Dt[Dt["FORBIDDEN"]=403]="FORBIDDEN";Dt[Dt["NOT_FOUND"]=404]="NOT_FOUND";Dt[Dt["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";Dt[Dt["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";Dt[Dt["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";Dt[Dt["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";Dt[Dt["CONFLICT"]=409]="CONFLICT";Dt[Dt["GONE"]=410]="GONE";Dt[Dt["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";Dt[Dt["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";Dt[Dt["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";Dt[Dt["URI_TOO_LONG"]=414]="URI_TOO_LONG";Dt[Dt["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";Dt[Dt["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";Dt[Dt["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";Dt[Dt["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";Dt[Dt["MISDIRECTED"]=421]="MISDIRECTED";Dt[Dt["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";Dt[Dt["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";Dt[Dt["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";Dt[Dt["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";Dt[Dt["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";Dt[Dt["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";Dt[Dt["BAD_GATEWAY"]=502]="BAD_GATEWAY";Dt[Dt["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";Dt[Dt["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";Dt[Dt["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(Tn=Lt.HttpStatus||(Lt.HttpStatus={}))},68641:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.swagger=void 0;const Wn=Tn(3376);const Gn=Tn(46123);const rr=(0,Gn.safeRequire)("swagger-ui-dist");Lt.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:rr&&rr.getAbsoluteFSPath?Wn.renderSwaggerUIDist:Wn.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true}},9317:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SwaggerConfiguration=void 0;const rr=Tn(46123);const cr=Tn(49179);const pr=Tn(68641);let mr=class SwaggerConfiguration{async onReady(Dt){const Lt=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(Lt.length){const Tn=await Dt.getAsync(cr.SwaggerExplorer);Tn.scanApp();let Wn=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(Wn){if(!/^\//.test(Wn)){Wn="/"+Wn}Tn.addGlobalPrefix(Wn)}Lt.forEach((Dt=>{Dt.useMiddleware(cr.SwaggerMiddleware)}))}}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayApplicationManager)],mr.prototype,"applicationManager",void 0);Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayConfigService)],mr.prototype,"configService",void 0);mr=Wn([(0,rr.Configuration)({importConfigs:[{default:pr}],namespace:"swagger"})],mr);Lt.SwaggerConfiguration=mr},48574:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DECORATORS=Lt.DECORATORS_METHOD_METADATA=Lt.DECORATORS_CLASS_METADATA=Lt.DECORATORS_PREFIX=void 0;Lt.DECORATORS_PREFIX="swagger";Lt.DECORATORS_CLASS_METADATA="swagger:class_metadata";Lt.DECORATORS_METHOD_METADATA="swagger:method_metadata";Lt.DECORATORS={API_OPERATION:`${Lt.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${Lt.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${Lt.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${Lt.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${Lt.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${Lt.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${Lt.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${Lt.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${Lt.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${Lt.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${Lt.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${Lt.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${Lt.DECORATORS_PREFIX}/apiExtension`}},51102:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiBasicAuth=void 0;const Wn=Tn(55118);function ApiBasicAuth(Dt="basic"){return(0,Wn.ApiSecurity)(Dt)}Lt.ApiBasicAuth=ApiBasicAuth},21873:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiBearerAuth=void 0;const Wn=Tn(55118);function ApiBearerAuth(Dt="bearer"){return(0,Wn.ApiSecurity)(Dt)}Lt.ApiBearerAuth=ApiBearerAuth},65288:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiBody=Lt.BodyContentType=void 0;const Wn=Tn(73455);const Gn=Tn(15071);var rr;(function(Dt){Dt["FormUrlEncoded"]="application/x-www-form-urlencoded";Dt["JSON"]="application/json";Dt["Multipart"]="multipart/form-data";Dt["MultipartMixed"]="multipart/mixed";Dt["OctetStream"]="application/octet-stream"})(rr=Lt.BodyContentType||(Lt.BodyContentType={}));const cr={type:String,required:true};function ApiBody(Dt){const[Lt,Tn]=(0,Gn.getTypeIsArrayTuple)(Dt.type,Dt.isArray);const rr={in:"body",...Dt,type:Lt,isArray:Tn};if((0,Wn.isEnumArray)(Dt)){(0,Wn.addEnumArraySchema)(rr,Dt)}else if((0,Wn.isEnumDefined)(Dt)){(0,Wn.addEnumSchema)(rr,Dt)}return(0,Gn.createParamDecorator)(rr,cr)}Lt.ApiBody=ApiBody},80222:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiCookieAuth=void 0;const Wn=Tn(55118);function ApiCookieAuth(Dt="cookie"){return(0,Wn.ApiSecurity)(Dt)}Lt.ApiCookieAuth=ApiCookieAuth},44097:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiExcludeController=void 0;const Wn=Tn(46123);const Gn=Tn(48574);function ApiExcludeController(Dt=true){return Lt=>{(0,Wn.saveClassMetadata)(Gn.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:Dt},Lt)}}Lt.ApiExcludeController=ApiExcludeController},61944:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiExcludeEndpoint=void 0;const Wn=Tn(48574);const Gn=Tn(15071);function ApiExcludeEndpoint(Dt=true){return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_EXCLUDE_ENDPOINT,true)}Lt.ApiExcludeEndpoint=ApiExcludeEndpoint},70821:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiExtension=void 0;const Wn=Tn(48574);const Gn=Tn(15071);function ApiExtension(Dt,Lt){if(!Dt.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const Tn={[Dt]:JSON.parse(JSON.stringify(Lt))};return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_EXTENSION,Tn)}Lt.ApiExtension=ApiExtension},91582:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiExtraModel=void 0;const Wn=Tn(48574);const Gn=Tn(15071);function ApiExtraModel(Dt){return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_EXTRA_MODEL,Dt)}Lt.ApiExtraModel=ApiExtraModel},40301:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiHeaders=Lt.ApiHeader=void 0;const Wn=Tn(48574);const Gn=Tn(73455);const rr=Tn(15071);const cr={name:""};function ApiHeader(Dt){const Lt={name:!Dt.name?cr.name:Dt.name,in:"header",description:Dt.description,required:Dt.required,schema:{...Dt.schema||{},type:"string"}};if(Dt.enum){const Tn=(0,Gn.getEnumValues)(Dt.enum);Lt.schema={enum:Tn,type:(0,Gn.getEnumType)(Tn)}}return(Dt,Tn,Gn)=>{if(Gn){return(0,rr.createMixedDecorator)(Wn.DECORATORS.API_HEADERS,Lt)(Dt,Tn,Gn)}return(0,rr.createMixedDecorator)(Wn.DECORATORS.API_HEADERS,Lt)(Dt,undefined,undefined)}}Lt.ApiHeader=ApiHeader;const ApiHeaders=Dt=>(Lt,Tn,Wn)=>{Dt.forEach((Dt=>ApiHeader(Dt)(Lt,Tn,Wn)))};Lt.ApiHeaders=ApiHeaders},10555:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiOAuth2=void 0;const Wn=Tn(55118);function ApiOAuth2(Dt,Lt="oauth2"){return(0,Wn.ApiSecurity)(Lt,Dt)}Lt.ApiOAuth2=ApiOAuth2},39025:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiOperation=void 0;const Wn=Tn(48574);const Gn=Tn(15071);const rr={summary:""};function ApiOperation(Dt){return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_OPERATION,{...rr,...Dt})}Lt.ApiOperation=ApiOperation},58729:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiParam=void 0;const Wn=Tn(15071);const Gn=Tn(73455);const rr={name:"",required:true};function ApiParam(Dt){const Lt={name:!Dt.name?rr.name:Dt.name,in:"path",...Dt};const Tn=Dt;if(Tn.enum){Lt.schema=Lt.schema||{};const Dt=Lt.schema;const Wn=(0,Gn.getEnumValues)(Tn.enum);Dt.type=(0,Gn.getEnumType)(Wn);Dt.enum=Wn;if(Tn.enumName){Lt.enumName=Tn.enumName}}return(0,Wn.createParamDecorator)(Lt,rr)}Lt.ApiParam=ApiParam},13529:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiResponseProperty=Lt.ApiPropertyOptional=Lt.createApiPropertyDecorator=Lt.ApiProperty=void 0;const Wn=Tn(48574);const Gn=Tn(73455);const rr=Tn(15071);const isEnumArray=Dt=>Dt.isArray&&!!Dt.enum;function ApiProperty(Dt={}){return createApiPropertyDecorator(Dt)}Lt.ApiProperty=ApiProperty;function createApiPropertyDecorator(Dt={}){const[Lt,Tn]=(0,rr.getTypeIsArrayTuple)(Dt.type,Dt.isArray);Dt={...Dt,type:Lt};if(isEnumArray(Dt)){Dt.type="array";const Lt=(0,Gn.getEnumValues)(Dt.enum);Dt.items={type:(0,Gn.getEnumType)(Lt),enum:Lt};delete Dt.enum}else if(Dt.enum){const Lt=(0,Gn.getEnumValues)(Dt.enum);Dt.enum=Lt;Dt.type=(0,Gn.getEnumType)(Lt)}if(Tn){Dt.type="array";Dt.items={type:Lt}}return(0,rr.createPropertyDecorator)(Wn.DECORATORS.API_MODEL_PROPERTIES,Dt)}Lt.createApiPropertyDecorator=createApiPropertyDecorator;function ApiPropertyOptional(Dt={}){return ApiProperty({...Dt,required:false})}Lt.ApiPropertyOptional=ApiPropertyOptional;function ApiResponseProperty(Dt={}){return ApiProperty({readOnly:true,...Dt})}Lt.ApiResponseProperty=ApiResponseProperty},60360:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiQuery=void 0;const Wn=Tn(73455);const Gn=Tn(15071);const rr={name:"",required:true};function ApiQuery(Dt){const Lt=Dt;const[Tn,cr]=(0,Gn.getTypeIsArrayTuple)(Lt.type,Lt.isArray);const pr={name:!Dt.name?rr.name:Dt.name,in:"query",...Dt,type:Tn};if((0,Wn.isEnumArray)(Dt)){(0,Wn.addEnumArraySchema)(pr,Dt)}else if((0,Wn.isEnumDefined)(Dt)){(0,Wn.addEnumSchema)(pr,Dt)}if(cr){pr.isArray=cr}return(0,Gn.createParamDecorator)(pr,rr)}Lt.ApiQuery=ApiQuery},95555:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiDefaultResponse=Lt.ApiUnsupportedMediaTypeResponse=Lt.ApiUnprocessableEntityResponse=Lt.ApiServiceUnavailableResponse=Lt.ApiRequestTimeoutResponse=Lt.ApiPayloadTooLargeResponse=Lt.ApiPreconditionFailedResponse=Lt.ApiNotImplementedResponse=Lt.ApiNotAcceptableResponse=Lt.ApiMethodNotAllowedResponse=Lt.ApiGoneResponse=Lt.ApiGatewayTimeoutResponse=Lt.ApiForbiddenResponse=Lt.ApiConflictResponse=Lt.ApiBadGatewayResponse=Lt.ApiInternalServerErrorResponse=Lt.ApiNotFoundResponse=Lt.ApiTooManyRequestsResponse=Lt.ApiUnauthorizedResponse=Lt.ApiBadRequestResponse=Lt.ApiFoundResponse=Lt.ApiMovedPermanentlyResponse=Lt.ApiNoContentResponse=Lt.ApiAcceptedResponse=Lt.ApiCreatedResponse=Lt.ApiOkResponse=Lt.ApiResponse=void 0;const Wn=Tn(48574);const Gn=Tn(15071);const rr=Tn(80163);function ApiResponse(Dt){const[Lt,Tn]=(0,Gn.getTypeIsArrayTuple)(Dt.type,Dt.isArray);Dt.type=Lt;Dt.isArray=Tn;Dt.description=Dt.description?Dt.description:"";const rr={[Dt.status||"default"]:Dt};return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_RESPONSE,rr)}Lt.ApiResponse=ApiResponse;const ApiOkResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.OK});Lt.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.CREATED});Lt.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.ACCEPTED});Lt.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.NO_CONTENT});Lt.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.MOVED_PERMANENTLY});Lt.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.FOUND});Lt.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.BAD_REQUEST});Lt.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.UNAUTHORIZED});Lt.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.TOO_MANY_REQUESTS});Lt.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.NOT_FOUND});Lt.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.INTERNAL_SERVER_ERROR});Lt.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.BAD_GATEWAY});Lt.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.CONFLICT});Lt.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.FORBIDDEN});Lt.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.GATEWAY_TIMEOUT});Lt.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.GONE});Lt.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.METHOD_NOT_ALLOWED});Lt.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.NOT_ACCEPTABLE});Lt.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.NOT_IMPLEMENTED});Lt.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.PRECONDITION_FAILED});Lt.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.PAYLOAD_TOO_LARGE});Lt.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.REQUEST_TIMEOUT});Lt.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.SERVICE_UNAVAILABLE});Lt.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.UNPROCESSABLE_ENTITY});Lt.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(Dt={})=>ApiResponse({...Dt,status:rr.HttpStatus.UNSUPPORTED_MEDIA_TYPE});Lt.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(Dt={})=>ApiResponse({...Dt,status:"default"});Lt.ApiDefaultResponse=ApiDefaultResponse},55118:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiExcludeSecurity=Lt.ApiSecurity=void 0;const Wn=Tn(48574);const Gn=Tn(15071);function ApiSecurity(Dt,Lt=[]){let Tn;if(typeof Dt==="string"){Tn={[Dt]:Lt||[]}}else{Tn=Dt}return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_SECURITY,Tn)}Lt.ApiSecurity=ApiSecurity;function ApiExcludeSecurity(){return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_EXCLUDE_SECURITY,true)}Lt.ApiExcludeSecurity=ApiExcludeSecurity},37505:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.ApiTags=void 0;const Wn=Tn(48574);const Gn=Tn(15071);function ApiTags(Dt){return(0,Gn.createMixedDecorator)(Wn.DECORATORS.API_TAGS,Dt)}Lt.ApiTags=ApiTags},15071:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.getSchemaPath=Lt.getTypeIsArrayTuple=Lt.createParamDecorator=Lt.createMixedDecorator=Lt.createPropertyDecorator=void 0;const Wn=Tn(46123);const Gn=Tn(48574);function createPropertyDecorator(Dt,Lt){return(0,Wn.createCustomPropertyDecorator)(Dt,Lt,false)}Lt.createPropertyDecorator=createPropertyDecorator;function createMixedDecorator(Dt,Lt){return(Tn,rr)=>{if(rr){(0,Wn.attachPropertyDataToClass)(Gn.DECORATORS_METHOD_METADATA,{key:Dt,propertyName:rr,metadata:Lt},Tn,rr)}else{(0,Wn.attachClassMetadata)(Gn.DECORATORS_CLASS_METADATA,{key:Dt,metadata:Lt},Tn)}}}Lt.createMixedDecorator=createMixedDecorator;function createParamDecorator(Dt,Lt){return createMixedDecorator(Gn.DECORATORS.API_PARAMETERS,{...Lt,...Dt})}Lt.createParamDecorator=createParamDecorator;function getTypeIsArrayTuple(Dt,Lt){if(!Dt){return[Dt,Lt]}if(Lt){return[Dt,Lt]}const Tn=Array.isArray(Dt);const Wn=Tn?Dt[0]:Dt;return[Wn,Tn]}Lt.getTypeIsArrayTuple=getTypeIsArrayTuple;function getSchemaPath(Dt){let Lt=Dt;if(typeof Dt!=="string"){Lt=Dt?Dt.name:Dt}return`#/components/schemas/${Lt}`}Lt.getSchemaPath=getSchemaPath},74398:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.getSchemaPath=Lt.ApiResponseProperty=Lt.ApiPropertyOptional=Lt.ApiProperty=void 0;Gn(Tn(65288),Lt);Gn(Tn(61944),Lt);Gn(Tn(44097),Lt);Gn(Tn(40301),Lt);Gn(Tn(39025),Lt);Gn(Tn(58729),Lt);var rr=Tn(13529);Object.defineProperty(Lt,"ApiProperty",{enumerable:true,get:function(){return rr.ApiProperty}});Object.defineProperty(Lt,"ApiPropertyOptional",{enumerable:true,get:function(){return rr.ApiPropertyOptional}});Object.defineProperty(Lt,"ApiResponseProperty",{enumerable:true,get:function(){return rr.ApiResponseProperty}});Gn(Tn(60360),Lt);Gn(Tn(95555),Lt);Gn(Tn(37505),Lt);Gn(Tn(70821),Lt);Gn(Tn(51102),Lt);Gn(Tn(21873),Lt);Gn(Tn(80222),Lt);Gn(Tn(10555),Lt);Gn(Tn(55118),Lt);Gn(Tn(91582),Lt);var cr=Tn(15071);Object.defineProperty(Lt,"getSchemaPath",{enumerable:true,get:function(){return cr.getSchemaPath}})},2171:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.DocumentBuilder=void 0;class DocumentBuilder{constructor(){this.document={openapi:"3.0.1",info:{title:"",description:"",version:"1.0.0",contact:{}},tags:[],servers:[],components:{},paths:{}}}setTitle(Dt){this.document.info.title=Dt;return this}setDescription(Dt){this.document.info.description=Dt;return this}setVersion(Dt){this.document.info.version=Dt;return this}setTermsOfService(Dt){this.document.info.termsOfService=Dt;return this}setContact(Dt,Lt,Tn){this.document.info.contact={name:Dt,url:Lt,email:Tn};return this}setLicense(Dt,Lt){this.document.info.license={name:Dt,url:Lt};return this}addServer(Dt,Lt,Tn){this.document.servers.push({url:Dt,description:Lt,variables:Tn});return this}setExternalDoc(Dt,Lt){this.document.externalDocs={description:Dt,url:Lt};return this}addPaths(Dt){Object.assign(this.document.paths,Dt);return this}getPaths(){return this.document.paths}setPaths(Dt){this.document.paths=Dt;return this}addSchema(Dt){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,Dt);return this}getSchema(Dt){var Lt,Tn;if((Lt=this.document.components)===null||Lt===void 0?void 0:Lt.schemas){return(Tn=this.document.components)===null||Tn===void 0?void 0:Tn.schemas[Dt]}return undefined}addTag(Dt,Lt="",Tn){const Wn=this.document.tags||[];if(Array.isArray(Dt)){const Lt=Dt;for(const Tn of Lt){if(!Wn.find((Lt=>Lt.name===Dt))){Wn.push({name:Tn,description:""})}}return this}if(!Wn.find((Lt=>Lt.name===Dt))){Wn.push({name:Dt,description:Lt,externalDocs:Tn})}else{Wn.forEach((Wn=>{if(Wn.name===Dt){if(Lt){Wn.description=Lt}if(Tn){Wn.externalDocs=Tn}}}))}this.document.tags=Wn;return this}addSecurity(Dt,Lt){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[Dt]:Lt};return this}addSecurityRequirements(Dt,Lt=[]){let Tn;if(typeof Dt==="string"){Tn={[Dt]:Lt}}else{Tn=Dt}this.document.security=(this.document.security||[]).concat({...Tn});return this}addBearerAuth(Dt={type:"http"},Lt="bearer"){this.addSecurity(Lt,{type:"http",scheme:"bearer",bearerFormat:"JWT",...Dt});return this}addOAuth2(Dt={type:"oauth2"},Lt="oauth2"){if(!Lt){Lt="oauth2"}this.addSecurity(Lt,{type:"oauth2",flows:{...Dt===null||Dt===void 0?void 0:Dt.flows}});return this}addApiKey(Dt={type:"apiKey"},Lt="api_key"){if(!Lt){Lt="api_key"}this.addSecurity(Lt,{type:"apiKey",in:"header",name:Lt,...Dt});return this}addBasicAuth(Dt={type:"http"},Lt="basic"){if(!Lt){Lt="basic"}this.addSecurity(Lt,{type:"http",scheme:"basic",...Dt});return this}addCookieAuth(Dt="connect.sid",Lt={type:"apiKey"},Tn="cookie"){if(!Dt){Dt="connect.sid"}if(!Tn){Tn="cookie"}this.addSecurity(Tn,{type:"apiKey",in:"cookie",name:Dt,...Lt});return this}sortTags(){const Dt=this.document.tags;this.document.tags=Dt.sort(((Dt,Lt)=>{const Tn=Dt.name;const Wn=Lt.name;const Gn=Tn.length>Wn.length?Wn.length:Tn.length;for(let Dt=0;Dt<Gn;Dt++){if(Tn.charCodeAt(Dt)>Wn.charCodeAt(Dt)){return 1}else if(Tn.charCodeAt(Dt)<Wn.charCodeAt(Dt)){return-1}}return 0}))}build(){return this.document}}Lt.DocumentBuilder=DocumentBuilder},49179:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.renderJSON=Lt.renderSwaggerUIDist=Lt.renderSwaggerUIRemote=Lt.SwaggerMiddleware=Lt.SwaggerExplorer=Lt.Configuration=void 0;Gn(Tn(74398),Lt);Gn(Tn(87448),Lt);var rr=Tn(9317);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.SwaggerConfiguration}});var cr=Tn(33984);Object.defineProperty(Lt,"SwaggerExplorer",{enumerable:true,get:function(){return cr.SwaggerExplorer}});var pr=Tn(64811);Object.defineProperty(Lt,"SwaggerMiddleware",{enumerable:true,get:function(){return pr.SwaggerMiddleware}});var mr=Tn(3376);Object.defineProperty(Lt,"renderSwaggerUIRemote",{enumerable:true,get:function(){return mr.renderSwaggerUIRemote}});Object.defineProperty(Lt,"renderSwaggerUIDist",{enumerable:true,get:function(){return mr.renderSwaggerUIDist}});Object.defineProperty(Lt,"renderJSON",{enumerable:true,get:function(){return mr.renderJSON}});Gn(Tn(48574),Lt)},87448:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true})},33984:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SwaggerExplorer=void 0;const rr=Tn(46123);const cr=Tn(48574);const pr=Tn(2171);const mr=Tn(49179);const gr=Tn(73455);let yr=class SwaggerExplorer{constructor(){this.swaggerConfig={};this.documentBuilder=new pr.DocumentBuilder;this.operationIdFactory=(Dt,Lt)=>`${Dt.toLowerCase()}_${Lt.method.toLocaleLowerCase()}`}async init(){var Dt,Lt,Tn,Wn,Gn,rr,cr,pr,mr,gr,yr,Sr,Er,Or,Ir,Hr,Gr,$r,mi,ki,Ni,Ri,ji,Ui,Vi,zi,Ki,$i,Xi,Yi,Wo;this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(((Dt=this.swaggerConfig)===null||Dt===void 0?void 0:Dt.contact)&&typeof((Lt=this.swaggerConfig)===null||Lt===void 0?void 0:Lt.contact)==="object"){this.documentBuilder.setContact((Wn=(Tn=this.swaggerConfig)===null||Tn===void 0?void 0:Tn.contact)===null||Wn===void 0?void 0:Wn.name,(rr=(Gn=this.swaggerConfig)===null||Gn===void 0?void 0:Gn.contact)===null||rr===void 0?void 0:rr.url,(pr=(cr=this.swaggerConfig)===null||cr===void 0?void 0:cr.contact)===null||pr===void 0?void 0:pr.email)}if(((mr=this.swaggerConfig)===null||mr===void 0?void 0:mr.license)&&typeof((gr=this.swaggerConfig)===null||gr===void 0?void 0:gr.license)==="object"){this.documentBuilder.setLicense((Sr=(yr=this.swaggerConfig)===null||yr===void 0?void 0:yr.license)===null||Sr===void 0?void 0:Sr.name,(Or=(Er=this.swaggerConfig)===null||Er===void 0?void 0:Er.license)===null||Or===void 0?void 0:Or.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(((Ir=this.swaggerConfig)===null||Ir===void 0?void 0:Ir.externalDocs)&&typeof((Hr=this.swaggerConfig)===null||Hr===void 0?void 0:Hr.externalDocs)==="object"){this.documentBuilder.setExternalDoc(($r=(Gr=this.swaggerConfig)===null||Gr===void 0?void 0:Gr.externalDocs)===null||$r===void 0?void 0:$r.description,(ki=(mi=this.swaggerConfig)===null||mi===void 0?void 0:mi.externalDocs)===null||ki===void 0?void 0:ki.url)}if(((Ni=this.swaggerConfig)===null||Ni===void 0?void 0:Ni.servers)&&Array.isArray((Ri=this.swaggerConfig)===null||Ri===void 0?void 0:Ri.servers)){for(const Dt of(ji=this.swaggerConfig)===null||ji===void 0?void 0:ji.servers){this.documentBuilder.addServer(Dt===null||Dt===void 0?void 0:Dt.url,Dt===null||Dt===void 0?void 0:Dt.description,Dt===null||Dt===void 0?void 0:Dt.variables)}}if(((Ui=this.swaggerConfig)===null||Ui===void 0?void 0:Ui.tags)&&Array.isArray((Vi=this.swaggerConfig)===null||Vi===void 0?void 0:Vi.tags)){for(const Dt of(zi=this.swaggerConfig)===null||zi===void 0?void 0:zi.tags){this.documentBuilder.addTag(Dt.name,Dt.description,Dt.externalDocs)}}if(($i=(Ki=this.swaggerConfig)===null||Ki===void 0?void 0:Ki.documentOptions)===null||$i===void 0?void 0:$i.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}if(Array.isArray((Xi=this.swaggerConfig)===null||Xi===void 0?void 0:Xi.auth)){for(const Dt of(Yi=this.swaggerConfig)===null||Yi===void 0?void 0:Yi.auth){this.setAuth(Dt)}}else{this.setAuth((Wo=this.swaggerConfig)===null||Wo===void 0?void 0:Wo.auth)}}addGlobalPrefix(Dt){if(!Dt){return}const Lt=this.documentBuilder.getPaths();const Tn={};for(const[Wn,Gn]of Object.entries(Lt)){if(!/^\//.test(Wn)){Tn[`${Dt}/${Wn}`]=Gn}else{Tn[`${Dt}${Wn}`]=Gn}}this.documentBuilder.setPaths(Tn)}scanApp(){var Dt;const Lt=(0,rr.listModule)(rr.CONTROLLER_KEY);for(const Dt of Lt){this.generatePath(Dt)}if((Dt=this.swaggerConfig)===null||Dt===void 0?void 0:Dt.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(Dt){var Lt;const Tn=(0,rr.getClassMetadata)(cr.DECORATORS.API_EXCLUDE_CONTROLLER,Dt);if(Tn&&Tn.disable){return}const Wn=(Lt=this.swaggerConfig.isGenerateTagForController)!==null&&Lt!==void 0?Lt:true;this.parseExtraModel(Dt);const Gn=(0,rr.getClassMetadata)(cr.DECORATORS_CLASS_METADATA,Dt)||[];const pr=(0,rr.getClassMetadata)(rr.INJECT_CUSTOM_PARAM,Dt)||[];const mr=(0,rr.getClassMetadata)(rr.CONTROLLER_KEY,Dt);const gr=mr.prefix;const yr=Gn.filter((Dt=>Dt.key===cr.DECORATORS.API_TAGS));let Sr=[];const Er=[];if(yr.length>0){Sr=parseTags(yr);Sr.forEach((Dt=>{addTag(Dt,Er)}))}else{if(Wn){const Dt={name:"",description:""};if(gr!=="/"){Dt.name=(mr===null||mr===void 0?void 0:mr.routerOptions.tagName)||(/^\//.test(gr)?gr.split("/")[1]:gr);Dt.description=(mr===null||mr===void 0?void 0:mr.routerOptions.description)||Dt.name}else{Dt.name=mr===null||mr===void 0?void 0:mr.routerOptions.tagName;Dt.description=(mr===null||mr===void 0?void 0:mr.routerOptions.description)||Dt.name}if(Dt.name){Sr.push(Dt.name);addTag([Dt.name,Dt.description],Er)}}else{}}const Or=(0,rr.getClassMetadata)(rr.WEB_ROUTER_KEY,Dt);let Ir=Gn.filter((Dt=>Dt.key===cr.DECORATORS.API_HEADERS));if(Ir.length>0){Ir=Ir.map((Dt=>Dt.metadata))}const Hr=Gn.filter((Dt=>Dt.key===cr.DECORATORS.API_SECURITY));const Gr={};if(Or&&typeof Or[Symbol.iterator]==="function"){for(const Lt of Or){let Tn=(gr+Lt.path).replace("//","/");Tn=replaceUrl(Tn,parseParamsInPath(Tn));const Wn=(0,rr.getPropertyDataFromClass)(cr.DECORATORS_METHOD_METADATA,Dt,Lt.method)||[];const mr=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_SECURITY));const yr=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_EXCLUDE_ENDPOINT&&Dt.propertyName===Lt.method));if(yr[0]){continue}if(this.swaggerConfig.routerFilter){const Dt=this.swaggerConfig.routerFilter(Tn,Lt);if(Dt){continue}}const Or=pr[Lt.method]||[];const $r=Or.filter((Dt=>{var Lt;return Dt.key===rr.WEB_ROUTER_PARAM_KEY&&((Lt=Dt===null||Dt===void 0?void 0:Dt.metadata)===null||Lt===void 0?void 0:Lt.type)===rr.RouteParamTypes.BODY}));if($r.length>1){continue}this.generateRouteMethod(Tn,Lt,Gr,Wn,Or,Ir,Dt);if(Gr[Tn][Lt.requestMethod].tags.length===0){Gr[Tn][Lt.requestMethod].tags=Sr}else{Gr[Tn][Lt.requestMethod].tags.forEach((Dt=>{addTag(Dt,Er)}))}const mi=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_EXTENSION&&Dt.propertyName===Lt.method));for(const Dt of mi){if(Dt.metadata){Object.assign(Gr[Tn][Lt.requestMethod],Dt.metadata)}}const ki=Wn.find((Dt=>Dt.key===cr.DECORATORS.API_EXCLUDE_SECURITY));const Ni=mr.length>0;const Ri=Gn.find((Dt=>Dt.key===cr.DECORATORS.API_EXCLUDE_SECURITY));const ji=Hr.length>0;if(ki){Gr[Tn][Lt.requestMethod].security=[]}else if(Ni){Gr[Tn][Lt.requestMethod].security=mr.map((Dt=>Dt.metadata)).filter(Boolean)}else if(Ri){Gr[Tn][Lt.requestMethod].security=[]}else if(ji){Gr[Tn][Lt.requestMethod].security=Hr.map((Dt=>Dt.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(Gr);if(Object.keys(Gr).length>0){Er.forEach((Dt=>{if(Array.isArray(Dt)){this.documentBuilder.addTag(Dt[0],Dt[1])}else{this.documentBuilder.addTag(Dt)}}))}}generateRouteMethod(Dt,Lt,Tn,Wn,Gn,pr,gr){var yr,Sr,Er,Or,Ir,Hr,Gr,$r,mi,ki,Ni,Ri,ji,Ui,Vi,zi,Ki,$i,Xi;const Yi=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_OPERATION&&Dt.propertyName===Lt.method))[0];const Wo=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_TAGS&&Dt.propertyName===Lt.method));const Ho=parseTags(Wo);let Go=Tn[Dt];if(!Go){Go={}}const Xo=[];Go[Lt.requestMethod]={summary:getNotEmptyValue((yr=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||yr===void 0?void 0:yr.summary,Lt.summary),description:getNotEmptyValue((Sr=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Sr===void 0?void 0:Sr.description,Lt.description),operationId:((Er=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Er===void 0?void 0:Er.operationId)||this.getOperationId(gr.name,Lt),tags:Ho.length?Ho:(Ir=(Or=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Or===void 0?void 0:Or.tags)!==null&&Ir!==void 0?Ir:[]};if(((Hr=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Hr===void 0?void 0:Hr.deprecated)!=null){Go[Lt.requestMethod].deprecated=!!((Gr=Yi===null||Yi===void 0?void 0:Yi.metadata)===null||Gr===void 0?void 0:Gr.deprecated)}const Yo=Gn.filter((Dt=>{var Lt;return Dt.key===rr.WEB_ROUTER_PARAM_KEY&&((Lt=Dt===null||Dt===void 0?void 0:Dt.metadata)===null||Lt===void 0?void 0:Lt.type)!==rr.RouteParamTypes.CUSTOM}));const Qo=(0,rr.getMethodParamTypes)(gr,Lt.method);const xa=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_PARAMETERS&&Dt.propertyName===Lt.method));for(const Dt of xa){if(Dt.metadata.schema===undefined){Dt.metadata.schema={};if(Dt.metadata.type){Dt.metadata.schema["type"]=Dt.metadata.type;delete Dt.metadata.type}if(Dt.metadata.isArray){Dt.metadata.schema["items"]={type:Dt.metadata.schema["type"]};Dt.metadata.schema["type"]="array";delete Dt.metadata.isArray}if(Dt.metadata.enum!==undefined){Dt.metadata.schema.enum=Dt.metadata.enum;delete Dt.metadata.enum}}else{delete Dt.metadata.type;delete Dt.metadata.isArray;delete Dt.metadata.enum}const Tn=Dt.metadata;Tn.schema=this.formatType(Dt.metadata.schema);if(Tn.in==="query"||Tn.in==="path"||Tn.in==="header"){Xo.push(Tn)}else if(Tn.in==="body"){Tn.content=($r=Tn.content)!==null&&$r!==void 0?$r:{};if(Object.keys(Tn.content).length===0){Tn.content[Tn.contentType||"application/json"]=(mi=Tn.content[Tn.contentType||"application/json"])!==null&&mi!==void 0?mi:{schema:Tn.schema}}for(const Dt in Tn.content){Tn.content[Dt].schema=this.formatType(Tn.content[Dt].schema)}Go[Lt.requestMethod].requestBody=(ki=Go[Lt.requestMethod].requestBody)!==null&&ki!==void 0?ki:{};Go[Lt.requestMethod].requestBody.description=(Ni=Go[Lt.requestMethod].requestBody.description)!==null&&Ni!==void 0?Ni:Tn.description;Go[Lt.requestMethod].requestBody.content=(Ri=Go[Lt.requestMethod].requestBody.content)!==null&&Ri!==void 0?Ri:Tn.content;Go[Lt.requestMethod].requestBody.required=(ji=Go[Lt.requestMethod].requestBody.required)!==null&&ji!==void 0?ji:Tn.required}}for(const Tn of Yo){const Wn=Qo[Tn.parameterIndex];const Gn={name:(Ui=Tn===null||Tn===void 0?void 0:Tn.metadata)===null||Ui===void 0?void 0:Ui.propertyData,in:convertTypeToString((Vi=Tn.metadata)===null||Vi===void 0?void 0:Vi.type),required:false};const cr=Xo.find((Dt=>{var Lt;return Dt.name===((Lt=Tn===null||Tn===void 0?void 0:Tn.metadata)===null||Lt===void 0?void 0:Lt.propertyData)&&Dt.in===Gn.in}));if(cr){continue}if(Gn.in==="path"){Gn.required=true;if(Dt.indexOf("{"+Gn.name+"}")===-1){continue}}if(rr.Types.isClass(Wn)){this.parseClzz(Wn)}if(Gn.in==="query"||Gn.in==="path"){if(rr.Types.isClass(Wn)){const Dt=this.documentBuilder.getSchema(Wn.name);Object.keys(Dt.properties).forEach((Lt=>{var Tn,Wn;const rr={name:Lt,in:Gn.in,description:(Tn=Dt.properties[Lt])===null||Tn===void 0?void 0:Tn.description,schema:Dt.properties[Lt],required:((Wn=Dt.required)===null||Wn===void 0?void 0:Wn.includes(Lt))||false};Xo.push(rr)}));continue}else{if(!Gn.name){continue}Gn.schema={type:convertSchemaType((zi=Wn===null||Wn===void 0?void 0:Wn.name)!==null&&zi!==void 0?zi:Wn)}}}else if(Gn.in==="body"){if(Lt.requestMethod===rr.RequestMethod.GET){continue}if(Go[Lt.requestMethod].requestBody){continue}if(((Ki=Tn.metadata)===null||Ki===void 0?void 0:Ki.type)===rr.RouteParamTypes.FILESSTREAM){Gn.content={};Gn.content[mr.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:Gn.description}}}}}else if((($i=Tn.metadata)===null||$i===void 0?void 0:$i.type)===rr.RouteParamTypes.FILESTREAM){Gn.content={};Gn.content[mr.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:Gn.description}}}}}else{if(rr.Types.isClass(Wn)){Gn.content={"application/json":{schema:{$ref:"#/components/schemas/"+Wn.name}}}}else{Gn.content={"text/plain":{schema:{type:convertSchemaType((Xi=Wn===null||Wn===void 0?void 0:Wn.name)!==null&&Xi!==void 0?Xi:Wn)}}}}}Go[Lt.requestMethod].requestBody={required:true,description:Gn.description||Gn.name,content:Gn.content};continue}Xo.push(Gn)}if(pr&&pr.length){pr.forEach((Dt=>Xo.unshift(Dt)))}const Ta=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_HEADERS));if(Ta.length>0){Ta.forEach((Dt=>Xo.unshift(Dt.metadata)))}Go[Lt.requestMethod].parameters=Xo;const wa=Wn.filter((Dt=>Dt.key===cr.DECORATORS.API_RESPONSE&&Dt.propertyName===Lt.method));const Oa={};for(const Dt of wa){const Lt=Dt.metadata;const Tn=Object.keys(Lt);for(const Dt of Tn){const Tn=Lt[Dt];if(Tn.schema){Tn.content={"application/json":{schema:this.formatType(Tn.schema)}};delete Tn.schema}else if(Tn.type){if(rr.Types.isClass(Tn.type)){this.parseClzz(Tn.type);if(Tn.isArray){Tn.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+Tn.type.name}}}}}else{Tn.content={"application/json":{schema:{$ref:"#/components/schemas/"+Tn.type.name}}}}}else{Tn.content={"text/plain":{schema:{type:convertSchemaType(Tn.type)}}}}}delete Tn.status;delete Tn.type;delete Tn.isArray;delete Tn.format}Object.assign(Oa,Lt)}if(Object.keys(Oa).length>0){Go[Lt.requestMethod].responses=Oa}else{Go[Lt.requestMethod].responses={200:{description:"OK"}}}Tn[Dt]=Go}getOperationId(Dt,Lt){return this.operationIdFactory(Dt,Lt)}parseExtraModel(Dt){const Lt=(0,rr.getClassMetadata)(cr.DECORATORS_CLASS_METADATA,Dt)||[];const Tn=Lt.filter((Dt=>Dt.key===cr.DECORATORS.API_EXTRA_MODEL));for(const Dt of Tn){if(Array.isArray(Dt.metadata)){for(const Lt of Dt.metadata){this.parseClzz(Lt)}}else{this.parseClzz(Dt.metadata)}}}parseSubPropertyType(Dt){var Lt,Tn,Wn;let Gn;if(Dt===null||Dt===void 0?void 0:Dt.enum){Gn={type:Dt===null||Dt===void 0?void 0:Dt.type,enum:Dt===null||Dt===void 0?void 0:Dt.enum,default:Dt===null||Dt===void 0?void 0:Dt.default};if(Dt===null||Dt===void 0?void 0:Dt.description){Gn.description=Dt===null||Dt===void 0?void 0:Dt.description}return Gn}if((Lt=Dt===null||Dt===void 0?void 0:Dt.items)===null||Lt===void 0?void 0:Lt.enum){Gn={type:Dt===null||Dt===void 0?void 0:Dt.type,items:Dt===null||Dt===void 0?void 0:Dt.items,default:Dt===null||Dt===void 0?void 0:Dt.default};if(Dt===null||Dt===void 0?void 0:Dt.description){Gn.description=Dt===null||Dt===void 0?void 0:Dt.description}return Gn}let cr=false;let pr=parseTypeSchema(Dt===null||Dt===void 0?void 0:Dt.type);Dt===null||Dt===void 0?true:delete Dt.type;if(pr==="array"){cr=true;pr=parseTypeSchema((Tn=Dt===null||Dt===void 0?void 0:Dt.items)===null||Tn===void 0?void 0:Tn.type);Dt===null||Dt===void 0?true:delete Dt.items.type}if(Dt===null||Dt===void 0?void 0:Dt.oneOf){Gn={oneOf:[]};Dt===null||Dt===void 0?void 0:Dt.oneOf.forEach((Dt=>{Gn.push(this.parseSubPropertyType(Dt))}));Dt===null||Dt===void 0?true:delete Dt.oneOf}if(rr.Types.isClass(pr)){this.parseClzz(pr);if(cr){Gn={type:"array",items:{$ref:"#/components/schemas/"+(pr===null||pr===void 0?void 0:pr.name)}}}else{Gn={$ref:"#/components/schemas/"+(pr===null||pr===void 0?void 0:pr.name)}}delete Dt.items}else{if(cr){if(!pr){if((Wn=Dt===null||Dt===void 0?void 0:Dt.items)===null||Wn===void 0?void 0:Wn["$ref"]){Dt.items["$ref"]=parseTypeSchema(Dt.items["$ref"])}Gn={type:"array",items:Dt===null||Dt===void 0?void 0:Dt.items}}else{Gn={type:"array",items:{type:convertSchemaType((pr===null||pr===void 0?void 0:pr.name)||pr)}}}delete Dt.items}else{Gn={type:pr,format:Dt===null||Dt===void 0?void 0:Dt.format};if(Gn.type==="Date"){Gn.type="string";if(!Gn.format){Gn.format="date"}}delete Dt.format}}return Object.assign(Gn,Dt)}formatType(Dt){if(Dt===null){return null}if(Dt.enum){if(Array.isArray(Dt.enum)){Dt.enum.map((Dt=>this.formatType(Dt)))}else{Dt.enum=(0,gr.getEnumValues)(Dt.enum)}}if(Dt.not){Dt.not=this.formatType(Dt.not)}if(Dt["$ref"]&&typeof Dt["$ref"]==="function"){Dt["$ref"]=Dt["$ref"]()}if(Dt.oneOf){Dt.oneOf=Dt.oneOf.map((Dt=>this.formatType(Dt)))}else if(Dt.anyOf){Dt.anyOf=Dt.anyOf.map((Dt=>this.formatType(Dt)))}else if(Dt.allOf){Dt.allOf=Dt.allOf.map((Dt=>this.formatType(Dt)))}["not","$ref","oneOf","anyOf","allOf"].forEach((Lt=>{if(Dt[Lt]){delete Dt["type"]}}));if(Dt.properties){const Lt={};for(const Tn in Dt.properties){Lt[Tn]=this.formatType(Dt.properties[Tn])}Dt.properties=Lt}if(Dt.additionalProperties){Dt.additionalProperties=this.formatType(Dt.additionalProperties)}if(["string","number","boolean","integer"].includes(Dt.type)){}else if(Dt.type===Number){Dt.type="number"}else if(Dt.type===String){Dt.type="string"}else if(Dt.type===Boolean){Dt.type="boolean"}else if(Dt.type==="date"||Dt.type==="Date"||Dt.type===Date){Dt.type="string";Dt.format="date-time"}else if(Dt.type===Array||Dt.type==="array"){Dt.type="array";if(Dt.items){Dt.items=this.formatType(Dt.items)}}else if(Array.isArray(Dt.type)){Dt.items=this.formatType({type:Dt.type[0]});Dt.type="array"}else if(Dt.type===Object||Dt.type==="object"){Dt.type="object"}else if(rr.Types.isClass(Dt.type)){this.parseClzz(Dt.type);Dt["$ref"]="#/components/schemas/"+Dt.type.name;delete Dt["type"]}else if(Dt.type instanceof Function){Dt.type=Dt.type();this.formatType(Dt)}return Dt}parseClzz(Dt){if(this.documentBuilder.getSchema(Dt.name)){return this.documentBuilder.getSchema(Dt.name)}this.parseExtraModel(Dt);const Lt=(0,rr.getClassExtendedMetadata)(rr.INJECT_CUSTOM_PROPERTY,Dt);const Tn={type:"object",properties:{}};this.documentBuilder.addSchema({[Dt.name]:Tn});if(Lt){for(const Wn of Object.keys(Lt)){const Gn=Lt[Wn].metadata||{};if(!Gn.type){Gn.type=(0,rr.getPropertyType)(Dt.prototype,Wn).name}Tn.properties[Wn]=Tn.properties[Wn]||{};for(const Dt in Gn){if(Dt==="required"&&Gn["required"]){if(!Tn.required){Tn.required=[]}Tn.required.push(Wn)}else if(["oneOf","anyOf","allOf"].includes(Dt)){Tn.properties[Wn][Dt]=[];Gn[Dt].forEach((Lt=>{Tn.properties[Wn][Dt].push(this.formatType(Lt))}))}else if(Dt==="not"){Tn.properties[Wn][Dt]=this.formatType(Gn[Dt])}else if(Dt==="type"){this.formatType(Gn);if(Gn.type){Tn.properties[Wn].type=Gn.type}if(Gn["$ref"]){Tn.properties[Wn].$ref=Gn["$ref"]}if(Gn.items){Tn.properties[Wn].items=Gn.items}if(Gn.format){Tn.properties[Wn].format=Gn.format}if(Gn.pattern){Tn.properties[Wn].pattern=Gn.pattern}if(Gn.enum){Tn.properties[Wn].enum=Gn.enum}}else if(Dt==="items"||Dt==="pattern"||Dt==="format"||Dt==="enum"||Dt==="$ref"){}else{Tn.properties[Wn][Dt]=Gn[Dt]}}}}return Tn}setAuth(Dt){if(!Dt){return}const{authType:Lt,name:Tn="",addSecurityRequirements:Wn=false,...Gn}=Dt;if(!Lt){return}switch(Lt){case"basic":{this.documentBuilder.addBasicAuth(Gn,Tn);break}case"bearer":{this.documentBuilder.addBearerAuth(Gn,Tn);break}case"cookie":{const{cookieName:Dt,securityName:Lt,...Tn}=Gn;this.documentBuilder.addCookieAuth(Dt,Tn,Lt);break}case"oauth2":{this.documentBuilder.addOAuth2(Gn,Tn);break}case"apikey":{this.documentBuilder.addApiKey(Gn,Tn);break}case"custom":{this.documentBuilder.addSecurity(Tn,Gn);break}}if(Wn){this.documentBuilder.addSecurityRequirements(Tn)}}};Wn([(0,rr.Config)("swagger"),Gn("design:type",Object)],yr.prototype,"swaggerConfig",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],yr.prototype,"init",null);yr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],yr);Lt.SwaggerExplorer=yr;function parseParamsInPath(Dt){const Lt=[];Dt.split("/").forEach((Dt=>{if(Dt.startsWith(":")){const Tn=Dt.slice(1);Lt.push(Tn)}}));return Lt}function replaceUrl(Dt,Lt){Lt.forEach((Lt=>{Dt=Dt.replace(`:${Lt}`,`{${Lt}}`)}));return Dt}function convertTypeToString(Dt){switch(Dt){case rr.RouteParamTypes.HEADERS:return"header";case rr.RouteParamTypes.QUERY:return"query";case rr.RouteParamTypes.PARAM:return"path";case rr.RouteParamTypes.BODY:case rr.RouteParamTypes.FIELDS:case rr.RouteParamTypes.FILESSTREAM:case rr.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(Dt){switch(Dt){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function getNotEmptyValue(...Dt){for(const Lt of Dt){if(Lt){return Lt}}}function parseTypeSchema(Dt){switch(Dt){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof Dt==="function"&&!rr.Types.isClass(Dt)){Dt=Dt()}return Dt}}function parseTags(Dt){let Lt=[];if(Dt.length>0){for(const Tn of Dt){Lt=Lt.concat(Tn.metadata)}}return Lt}function addTag(Dt,Lt=[]){if(Lt.find((Lt=>{if(Array.isArray(Dt)){return Lt===Dt[0]}else{return Lt===Dt}}))){}else{Lt.push(Dt)}}},64811:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.SwaggerMiddleware=void 0;const rr=Tn(46123);const cr=Tn(33984);let pr=class SwaggerMiddleware{async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new rr.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(Dt){if(Dt.getNamespace()==="express"){return async(Dt,Lt,Tn)=>{const Wn=Dt.path;const Gn=await this.swaggerRender(Wn);if(Gn){const{ext:Dt,content:Tn}=Gn;if(Dt===".js"){Lt.type("application/javascript")}else if(Dt===".map"){Lt.type("application/json")}else if(Dt===".css"){Lt.type("text/css")}else if(Dt===".png"){Lt.type("image/png")}Lt.send(Tn)}else{return Tn()}}}else{return async(Dt,Lt)=>{const Tn=Dt.path;const Wn=await this.swaggerRender(Tn);if(Wn){const{ext:Lt,content:Tn}=Wn;if(Lt===".js"){Dt.set("Content-Type","application/javascript")}else if(Lt===".map"){Dt.set("Content-Type","application/json")}else if(Lt===".css"){Dt.set("Content-Type","text/css")}else if(Lt===".png"){Dt.set("Content-Type","image/png")}Dt.body=Tn}else{return Lt()}}}}static getName(){return"swagger"}};Wn([(0,rr.Config)("swagger"),Gn("design:type",Object)],pr.prototype,"swaggerConfig",void 0);Wn([(0,rr.Inject)(),Gn("design:type",cr.SwaggerExplorer)],pr.prototype,"swaggerExplorer",void 0);Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayEnvironmentService)],pr.prototype,"environmentService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],pr.prototype,"init",null);pr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],pr);Lt.SwaggerMiddleware=pr},3376:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.renderSwaggerUIRemote=Lt.renderJSON=Lt.renderSwaggerUIDist=void 0;const Wn=Tn(46123);const Gn=Tn(79896);const rr=Tn(16928);function renderSwaggerUIDist(Dt,Lt){const{getAbsoluteFSPath:Tn}=(0,Wn.safeRequire)("swagger-ui-dist");if(!Tn){throw new Wn.MidwayCommonError("swagger-ui-dist is not installed")}const cr=Dt.swaggerUIRenderOptions||{};if(cr.customInitializer){if((0,rr.isAbsolute)(cr.customInitializer)){cr.customInitializer=(0,Gn.readFileSync)(cr.customInitializer)}else{throw new Wn.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(Lt){let Tn=`location.href.replace('${Dt.swaggerPath}/index.html', '${Dt.swaggerPath}/index.json'),\n validatorUrl: null,`;if(Dt.displayOptions){Object.entries(Dt.displayOptions).forEach((([Dt,Lt])=>{const Wn=typeof Lt==="string"?`'${Lt}'`:Lt;Tn+=`\n${Dt}: ${Wn},`}))}return Lt.replace('"https://petstore.swagger.io/v2/swagger.json",',Tn)}const pr=Tn();return async Tn=>{if(!pr||Tn.indexOf(Dt.swaggerPath)===-1){return}const Wn=Tn.split("/");let mr=Wn.pop();if(mr==="index.json"){return{ext:"json",content:Lt.getData()}}if(!mr){mr="index.html"}let gr=(0,Gn.readFileSync)((0,rr.join)(pr,mr));if(mr==="swagger-initializer.js"&&(cr===null||cr===void 0?void 0:cr.customInitializer)){return{ext:"js",content:cr.customInitializer}}if(mr==="index.html"||mr==="swagger-initializer.js"){gr=gr.toString("utf8");gr=replaceInfo(gr)}const yr=(0,rr.extname)(mr);return{ext:yr,content:gr}}}Lt.renderSwaggerUIDist=renderSwaggerUIDist;function renderJSON(Dt,Lt){return async Tn=>{if(Tn.indexOf(Dt.swaggerPath)===-1){return}const Wn=Tn.split("/");const Gn=Wn.pop();if(Gn==="index.json"){return{ext:"json",content:Lt.getData()}}return}}Lt.renderJSON=renderJSON;function renderSwaggerUIRemote(Dt,Lt){const Tn=Dt.swaggerUIRenderOptions||{};const Wn=(Tn===null||Tn===void 0?void 0:Tn.indexPagePath)||(0,rr.join)(__dirname,"../../index.html");return async Tn=>{if(Tn.indexOf(Dt.swaggerPath)===-1){return}const rr=Tn.split("/");let cr=rr.pop();if(cr==="index.json"){return{ext:"json",content:Lt.getData()}}if(!cr){cr="index.html"}if(cr==="index.html"){const Dt=(0,Gn.readFileSync)(Wn,"utf8");return{ext:"html",content:Dt}}return}}Lt.renderSwaggerUIRemote=renderSwaggerUIRemote},77053:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.i18n=Lt.validate=void 0;Lt.validate={validationOptions:{},errorStatus:422};Lt.i18n={localeTable:{en_US:{validate:Tn(98044)},zh_CN:{validate:Tn(62462)}}}},41601:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.ValidateConfiguration=void 0;const rr=Tn(46123);const cr=Tn(77053);const pr=Tn(75284);const mr=Tn(68255);const gr=Tn(47215);const yr=Tn(6482);let Sr=class ValidateConfiguration{async init(){this.decoratorService.registerParameterHandler(yr.VALID_KEY,(({parameterIndex:Dt,originParamType:Lt,originArgs:Tn,metadata:Wn})=>{if(!Wn.schema){Wn.schema=this.validateService.getSchema(Lt)}return Tn[Dt]}))}async onReady(Dt){await Dt.getAsync(gr.ValidationPipe);await Dt.getAsync(gr.ParseIntPipe);await Dt.getAsync(gr.ParseBoolPipe);await Dt.getAsync(gr.ParseFloatPipe);await Dt.getAsync(gr.DecoratorValidPipe);this.decoratorService.registerParameterPipes(rr.WEB_ROUTER_PARAM_KEY,[gr.ValidationPipe])}};Wn([(0,rr.Inject)(),Gn("design:type",rr.MidwayDecoratorService)],Sr.prototype,"decoratorService",void 0);Wn([(0,rr.Inject)(),Gn("design:type",pr.ValidateService)],Sr.prototype,"validateService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Sr.prototype,"init",null);Sr=Wn([(0,rr.Configuration)({namespace:"validate",imports:[mr],importConfigs:[{default:cr}]})],Sr);Lt.ValidateConfiguration=Sr},6482:(Dt,Lt)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.VALID_KEY=Lt.VALIDATE_KEY=Lt.RULES_CLASS_KEY=Lt.RULES_KEY=void 0;Lt.RULES_KEY="common:rules";Lt.RULES_CLASS_KEY="common:class_rules";Lt.VALIDATE_KEY="common:validate";Lt.VALID_KEY="validate:valid"},61171:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.RuleType=Lt.Rule=void 0;const Wn=Tn(15192);Lt.RuleType=Wn;const Gn=Tn(46123);const rr=Tn(6482);function Rule(Dt,Lt={required:true}){return function(Tn,cr){if(cr){if(!Wn.isSchema(Dt)){Dt=Wn.object((0,Gn.getClassMetadata)(rr.RULES_KEY,Dt)).meta({id:Dt.name});if((0,Gn.getPropertyType)(Tn,cr).name==="Array"){Dt=Wn.array().items(Dt);if(Lt.min){Dt=Dt.min(Lt.min)}if(Lt.max){Dt=Dt.max(Lt.max)}}if(Lt.required){Dt=Dt.required()}}(0,Gn.attachClassMetadata)(rr.RULES_KEY,Dt,Tn,cr)}else{if(Wn.isSchema(Dt)){}}}}Lt.Rule=Rule},99419:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Valid=void 0;const Wn=Tn(46123);const Gn=Tn(6482);const rr=Tn(47215);function Valid(Dt,Lt){if(Array.isArray(Dt)){Lt=Dt;Dt=undefined}else{Lt=Lt||[]}return(0,Wn.createCustomParamDecorator)(Gn.VALID_KEY,{schema:Dt},{pipes:[rr.DecoratorValidPipe,...Lt]})}Lt.Valid=Valid},75995:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.Validate=void 0;const Wn=Tn(46123);const Gn=Tn(6482);function Validate(Dt={}){return(Lt,Tn,rr)=>{(0,Wn.savePropertyMetadata)(Gn.VALIDATE_KEY,Dt,Lt,Tn)}}Lt.Validate=Validate},48698:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.OmitDto=Lt.PickDto=void 0;const Wn=Tn(46123);const Gn=Tn(6482);function PickDto(Dt,Lt){const pickedDto=function(){};pickedDto.prototype=Dt.prototype;const Tn=(0,Wn.getClassExtendedMetadata)(Gn.RULES_KEY,Dt);const rr={};for(const Dt of Lt){if(Tn[Dt]){rr[Dt]=Tn[Dt]}}(0,Wn.saveClassMetadata)(Gn.RULES_KEY,rr,pickedDto);return pickedDto}Lt.PickDto=PickDto;function OmitDto(Dt,Lt){const pickedDto=function(){};pickedDto.prototype=Dt.prototype;const Tn=(0,Wn.getClassExtendedMetadata)(Gn.RULES_KEY,Dt);const rr=Object.assign({},Tn);for(const Dt of Lt){delete rr[Dt]}(0,Wn.saveClassMetadata)(Gn.RULES_KEY,rr,pickedDto);return pickedDto}Lt.OmitDto=OmitDto},42429:(Dt,Lt,Tn)=>{"use strict";Object.defineProperty(Lt,"__esModule",{value:true});Lt.MidwayValidationError=void 0;const Wn=Tn(46123);const Gn=(0,Wn.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends Wn.MidwayHttpError{constructor(Dt,Lt,Tn){super(Dt,Lt,Gn.VALIDATE_FAIL,{cause:Tn})}}Lt.MidwayValidationError=MidwayValidationError},99375:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__createBinding||(Object.create?function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;var Gn=Object.getOwnPropertyDescriptor(Lt,Tn);if(!Gn||("get"in Gn?!Lt.__esModule:Gn.writable||Gn.configurable)){Gn={enumerable:true,get:function(){return Lt[Tn]}}}Object.defineProperty(Dt,Wn,Gn)}:function(Dt,Lt,Tn,Wn){if(Wn===undefined)Wn=Tn;Dt[Wn]=Lt[Tn]});var Gn=this&&this.__exportStar||function(Dt,Lt){for(var Tn in Dt)if(Tn!=="default"&&!Object.prototype.hasOwnProperty.call(Lt,Tn))Wn(Lt,Dt,Tn)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.Configuration=void 0;var rr=Tn(41601);Object.defineProperty(Lt,"Configuration",{enumerable:true,get:function(){return rr.ValidateConfiguration}});Gn(Tn(61171),Lt);Gn(Tn(75995),Lt);Gn(Tn(99419),Lt);Gn(Tn(48698),Lt);Gn(Tn(75284),Lt);Gn(Tn(42429),Lt);Gn(Tn(47215),Lt)},47215:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.DefaultValuePipe=Lt.ParseFloatPipe=Lt.ParseBoolPipe=Lt.ParseIntPipe=Lt.DecoratorValidPipe=Lt.ParsePipe=Lt.ValidationPipe=Lt.AbstractValidationPipe=void 0;const rr=Tn(46123);const cr=Tn(75284);const pr=Tn(68255);const mr=Tn(6482);const gr=Tn(15192);class AbstractValidationPipe{validateWithSchema(Dt,Lt,Tn){const Wn=this.parseValidationOptions(Lt);const Gn=this.validateService.validateWithSchema(Tn,Dt,Wn);if(Gn&&Gn.value!==undefined){return Gn.value}return Dt}validate(Dt,Lt){const Tn=this.parseValidationOptions(Lt);if(Lt.metaType.isBaseType){return Dt}const Wn=this.validateService.validate(Lt.metaType.originDesign,Dt,Tn);if(Wn&&Wn.value){return Wn.value}return Dt}parseValidationOptions(Dt){const Lt=(0,rr.getPropertyMetadata)(mr.VALIDATE_KEY,Dt.target,Dt.methodName)||{};if(!Lt.locale){const Tn=Dt.target[rr.REQUEST_OBJ_CTX_KEY];if(Tn&&Tn.getAttr){Lt.locale=Tn.getAttr(pr.I18N_ATTR_KEY)}}return Lt}getSchema(){return undefined}}Wn([(0,rr.Inject)(),Gn("design:type",cr.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);Lt.AbstractValidationPipe=AbstractValidationPipe;let yr=class ValidationPipe extends AbstractValidationPipe{transform(Dt,Lt){return this.validate(Dt,Lt)}};yr=Wn([(0,rr.Pipe)()],yr);Lt.ValidationPipe=yr;class ParsePipe extends AbstractValidationPipe{transform(Dt,Lt){return this.validateWithSchema(Dt,Lt,Lt.metadata["schema"]||this.getSchema())}}Lt.ParsePipe=ParsePipe;let Sr=class DecoratorValidPipe extends ParsePipe{};Sr=Wn([(0,rr.Pipe)()],Sr);Lt.DecoratorValidPipe=Sr;let Er=class ParseIntPipe extends ParsePipe{getSchema(){return gr.number().integer().required()}};Er=Wn([(0,rr.Pipe)()],Er);Lt.ParseIntPipe=Er;let Or=class ParseBoolPipe extends ParsePipe{getSchema(){return gr.boolean().required()}};Or=Wn([(0,rr.Pipe)()],Or);Lt.ParseBoolPipe=Or;let Ir=class ParseFloatPipe extends ParsePipe{getSchema(){return gr.number().required()}};Ir=Wn([(0,rr.Pipe)()],Ir);Lt.ParseFloatPipe=Ir;class DefaultValuePipe{constructor(Dt){this.defaultValue=Dt}transform(Dt,Lt){if(Dt===undefined||Dt===null||typeof Dt==="number"&&isNaN(Dt)){return this.defaultValue}return Dt}}Lt.DefaultValuePipe=DefaultValuePipe},75284:function(Dt,Lt,Tn){"use strict";var Wn=this&&this.__decorate||function(Dt,Lt,Tn,Wn){var Gn=arguments.length,rr=Gn<3?Lt:Wn===null?Wn=Object.getOwnPropertyDescriptor(Lt,Tn):Wn,cr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")rr=Reflect.decorate(Dt,Lt,Tn,Wn);else for(var pr=Dt.length-1;pr>=0;pr--)if(cr=Dt[pr])rr=(Gn<3?cr(rr):Gn>3?cr(Lt,Tn,rr):cr(Lt,Tn))||rr;return Gn>3&&rr&&Object.defineProperty(Lt,Tn,rr),rr};var Gn=this&&this.__metadata||function(Dt,Lt){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(Dt,Lt)};Object.defineProperty(Lt,"__esModule",{value:true});Lt.getSchema=Lt.ValidateService=void 0;const rr=Tn(46123);const cr=Tn(77053);const pr=Tn(6482);const mr=Tn(15192);const gr=Tn(68255);const yr=Tn(42429);let Sr=class ValidateService{constructor(){this.messages={}}async init(){const Dt=Object.keys(cr.i18n.localeTable);Dt.forEach((Dt=>{this.messages[(0,gr.formatLocale)(Dt)]=Object.fromEntries(this.i18nService.getLocaleMapping(Dt,"validate"))}))}validate(Dt,Lt,Tn={}){const Wn=this.getSchema(Dt);return this.validateWithSchema(Wn,Lt,Tn)}validateWithSchema(Dt,Lt,Tn={}){var Wn,Gn,rr;if(!Dt){return undefined}Tn.validationOptions=Tn.validationOptions||{};Tn.validationOptions.errors=Tn.validationOptions.errors||{};Tn.validationOptions.errors.language=(0,gr.formatLocale)(this.i18nService.getAvailableLocale(Tn.validationOptions.errors.language||Tn.locale||this.i18nConfig.defaultLocale,"validate"));const cr=Dt.validate(Lt,Object.assign({},(Wn=this.validateConfig.validationOptions)!==null&&Wn!==void 0?Wn:{},{messages:this.messages},(Gn=Tn.validationOptions)!==null&&Gn!==void 0?Gn:{}));if(cr.error){throw new yr.MidwayValidationError(cr.error.message,(rr=Tn===null||Tn===void 0?void 0:Tn.errorStatus)!==null&&rr!==void 0?rr:this.validateConfig.errorStatus,cr.error)}else{return cr}}getSchema(Dt){return getSchema(Dt)}};Wn([(0,rr.Config)("validate"),Gn("design:type",Object)],Sr.prototype,"validateConfig",void 0);Wn([(0,rr.Config)("i18n"),Gn("design:type",Object)],Sr.prototype,"i18nConfig",void 0);Wn([(0,rr.Inject)(),Gn("design:type",gr.MidwayI18nServiceSingleton)],Sr.prototype,"i18nService",void 0);Wn([(0,rr.Init)(),Gn("design:type",Function),Gn("design:paramtypes",[]),Gn("design:returntype",Promise)],Sr.prototype,"init",null);Sr=Wn([(0,rr.Provide)(),(0,rr.Scope)(rr.ScopeEnum.Singleton)],Sr);Lt.ValidateService=Sr;function getSchema(Dt){const Lt=(0,rr.getClassExtendedMetadata)(pr.RULES_KEY,Dt);if(Lt){return mr.object(Lt)}}Lt.getSchema=getSchema},6647:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(87016);const Gn=Tn(16480);const rr={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:Wn.URL||URL};Lt.analyze=function(Dt,Lt={}){if(!Dt){return Gn.code("DOMAIN_NON_EMPTY_STRING")}if(typeof Dt!=="string"){throw new Error("Invalid input: domain must be a string")}if(Dt.length>256){return Gn.code("DOMAIN_TOO_LONG")}const Tn=!rr.nonAsciiRx.test(Dt);if(!Tn){if(Lt.allowUnicode===false){return Gn.code("DOMAIN_INVALID_UNICODE_CHARS")}Dt=Dt.normalize("NFC")}if(rr.domainControlRx.test(Dt)){return Gn.code("DOMAIN_INVALID_CHARS")}Dt=rr.punycode(Dt);if(Lt.allowFullyQualified&&Dt[Dt.length-1]==="."){Dt=Dt.slice(0,-1)}const Wn=Lt.minDomainSegments||rr.minDomainSegments;const cr=Dt.split(".");if(cr.length<Wn){return Gn.code("DOMAIN_SEGMENTS_COUNT")}if(Lt.maxDomainSegments){if(cr.length>Lt.maxDomainSegments){return Gn.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const pr=Lt.tlds;if(pr){const Dt=cr[cr.length-1].toLowerCase();if(pr.deny&&pr.deny.has(Dt)||pr.allow&&!pr.allow.has(Dt)){return Gn.code("DOMAIN_FORBIDDEN_TLDS")}}for(let Dt=0;Dt<cr.length;++Dt){const Lt=cr[Dt];if(!Lt.length){return Gn.code("DOMAIN_EMPTY_SEGMENT")}if(Lt.length>63){return Gn.code("DOMAIN_LONG_SEGMENT")}if(Dt<cr.length-1){if(!rr.domainSegmentRx.test(Lt)){return Gn.code("DOMAIN_INVALID_CHARS")}}else{if(!rr.tldSegmentRx.test(Lt)){return Gn.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};Lt.isValid=function(Dt,Tn){return!Lt.analyze(Dt,Tn)};rr.punycode=function(Dt){if(Dt.includes("%")){Dt=Dt.replace(/%/g,"%25")}try{return new rr.URL(`http://${Dt}`).host}catch(Lt){return Dt}}},71099:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(39023);const Gn=Tn(6647);const rr=Tn(16480);const cr={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(Wn.TextEncoder||TextEncoder)};Lt.analyze=function(Dt,Lt){return cr.email(Dt,Lt)};Lt.isValid=function(Dt,Lt){return!cr.email(Dt,Lt)};cr.email=function(Dt,Lt={}){if(typeof Dt!=="string"){throw new Error("Invalid input: email must be a string")}if(!Dt){return rr.code("EMPTY_STRING")}const Tn=!cr.nonAsciiRx.test(Dt);if(!Tn){if(Lt.allowUnicode===false){return rr.code("FORBIDDEN_UNICODE")}Dt=Dt.normalize("NFC")}const Wn=Dt.split("@");if(Wn.length!==2){return Wn.length>2?rr.code("MULTIPLE_AT_CHAR"):rr.code("MISSING_AT_CHAR")}const[pr,mr]=Wn;if(!pr){return rr.code("EMPTY_LOCAL")}if(!Lt.ignoreLength){if(Dt.length>254){return rr.code("ADDRESS_TOO_LONG")}if(cr.encoder.encode(pr).length>64){return rr.code("LOCAL_TOO_LONG")}}return cr.local(pr,Tn)||Gn.analyze(mr,Lt)};cr.local=function(Dt,Lt){const Tn=Dt.split(".");for(const Dt of Tn){if(!Dt.length){return rr.code("EMPTY_LOCAL_SEGMENT")}if(Lt){if(!cr.atextRx.test(Dt)){return rr.code("INVALID_LOCAL_CHARS")}continue}for(const Lt of Dt){if(cr.atextRx.test(Lt)){continue}const Dt=cr.binary(Lt);if(!cr.atomRx.test(Dt)){return rr.code("INVALID_LOCAL_CHARS")}}}};cr.binary=function(Dt){return Array.from(cr.encoder.encode(Dt)).map((Dt=>String.fromCharCode(Dt))).join("")};cr.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;cr.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},16480:(Dt,Lt)=>{"use strict";Lt.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"};Lt.code=function(Dt){return{code:Dt,error:Lt.codes[Dt]}}},54990:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(63377);const rr={};Lt.regex=function(Dt={}){Wn(Dt.cidr===undefined||typeof Dt.cidr==="string","options.cidr must be a string");const Lt=Dt.cidr?Dt.cidr.toLowerCase():"optional";Wn(["required","optional","forbidden"].includes(Lt),"options.cidr must be one of required, optional, forbidden");Wn(Dt.version===undefined||typeof Dt.version==="string"||Array.isArray(Dt.version),"options.version must be a string or an array of string");let Tn=Dt.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(Tn)){Tn=[Tn]}Wn(Tn.length>=1,"options.version must have at least 1 version specified");for(let Dt=0;Dt<Tn.length;++Dt){Wn(typeof Tn[Dt]==="string","options.version must only contain strings");Tn[Dt]=Tn[Dt].toLowerCase();Wn(["ipv4","ipv6","ipvfuture"].includes(Tn[Dt]),"options.version contains unknown version "+Tn[Dt]+" - must be one of ipv4, ipv6, ipvfuture")}Tn=Array.from(new Set(Tn));const rr=Tn.map((Dt=>{if(Lt==="forbidden"){return Gn.ip[Dt]}const Tn=`\\/${Dt==="ipv4"?Gn.ip.v4Cidr:Gn.ip.v6Cidr}`;if(Lt==="required"){return`${Gn.ip[Dt]}${Tn}`}return`${Gn.ip[Dt]}(?:${Tn})?`}));const cr=`(?:${rr.join("|")})`;const pr=new RegExp(`^${cr}$`);return{cidr:Lt,versions:Tn,regex:pr,raw:cr}}},33618:Dt=>{"use strict";const Lt={};Lt.tlds=["AAA","AARP","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIDS","KIM","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"];Dt.exports=new Set(Lt.tlds.map((Dt=>Dt.toLowerCase())))},63377:(Dt,Lt,Tn)=>{"use strict";const Wn=Tn(99583);const Gn=Tn(43935);const rr={};rr.generate=function(){const Dt={};const Lt="\\dA-Fa-f";const Tn="["+Lt+"]";const Wn="\\w-\\.~";const Gn="!\\$&'\\(\\)\\*\\+,;=";const rr="%"+Lt;const cr=Wn+rr+Gn+":@";const pr="["+cr+"]";const mr="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";Dt.ipv4address="(?:"+mr+"\\.){3}"+mr;const gr=Tn+"{1,4}";const yr="(?:"+gr+":"+gr+"|"+Dt.ipv4address+")";const Sr="(?:"+gr+":){6}"+yr;const Er="::(?:"+gr+":){5}"+yr;const Or="(?:"+gr+")?::(?:"+gr+":){4}"+yr;const Ir="(?:(?:"+gr+":){0,1}"+gr+")?::(?:"+gr+":){3}"+yr;const Hr="(?:(?:"+gr+":){0,2}"+gr+")?::(?:"+gr+":){2}"+yr;const Gr="(?:(?:"+gr+":){0,3}"+gr+")?::"+gr+":"+yr;const $r="(?:(?:"+gr+":){0,4}"+gr+")?::"+yr;const mi="(?:(?:"+gr+":){0,5}"+gr+")?::"+gr;const ki="(?:(?:"+gr+":){0,6}"+gr+")?::";Dt.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";Dt.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";Dt.ipv6address="(?:"+Sr+"|"+Er+"|"+Or+"|"+Ir+"|"+Hr+"|"+Gr+"|"+$r+"|"+mi+"|"+ki+")";Dt.ipvFuture="v"+Tn+"+\\.["+Wn+Gn+":]+";Dt.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";Dt.schemeRegex=new RegExp(Dt.scheme);const Ni="["+Wn+rr+Gn+":]*";const Ri="\\[(?:"+Dt.ipv6address+"|"+Dt.ipvFuture+")\\]";const ji="["+Wn+rr+Gn+"]{1,255}";const Ui="(?:"+Ri+"|"+Dt.ipv4address+"|"+ji+")";const Vi="\\d*";const zi="(?:"+Ni+"@)?"+Ui+"(?::"+Vi+")?";const Ki="(?:"+Ni+"@)?("+Ui+")(?::"+Vi+")?";const $i=pr+"*";const Xi=pr+"+";const Yi="["+Wn+rr+Gn+"@"+"]+";const Wo="";const Ho="(?:\\/"+$i+")*";const Go="\\/(?:"+Xi+Ho+")?";const Xo=Xi+Ho;const Yo=Yi+Ho;const Qo="(?:\\/\\/\\/"+$i+Ho+")";Dt.hierPart="(?:"+"(?:\\/\\/"+zi+Ho+")"+"|"+Go+"|"+Xo+"|"+Qo+")";Dt.hierPartCapture="(?:"+"(?:\\/\\/"+Ki+Ho+")"+"|"+Go+"|"+Xo+")";Dt.relativeRef="(?:"+"(?:\\/\\/"+zi+Ho+")"+"|"+Go+"|"+Yo+"|"+Wo+")";Dt.relativeRefCapture="(?:"+"(?:\\/\\/"+Ki+Ho+")"+"|"+Go+"|"+Yo+"|"+Wo+")";Dt.query="["+cr+"\\/\\?]*(?=#|$)";Dt.queryWithSquareBrackets="["+cr+"\\[\\]\\/\\?]*(?=#|$)";Dt.fragment="["+cr+"\\/\\?]*";return Dt};rr.rfc3986=rr.generate();Lt.ip={v4Cidr:rr.rfc3986.ipv4Cidr,v6Cidr:rr.rfc3986.ipv6Cidr,ipv4:rr.rfc3986.ipv4address,ipv6:rr.rfc3986.ipv6address,ipvfuture:rr.rfc3986.ipvFuture};rr.createRegex=function(Dt){const Lt=rr.rfc3986;const Tn=Dt.allowQuerySquareBrackets?Lt.queryWithSquareBrackets:Lt.query;const cr="(?:\\?"+Tn+")?"+"(?:#"+Lt.fragment+")?";const pr=Dt.domain?Lt.relativeRefCapture:Lt.relativeRef;if(Dt.relativeOnly){return rr.wrap(pr+cr)}let mr="";if(Dt.scheme){Wn(Dt.scheme instanceof RegExp||typeof Dt.scheme==="string"||Array.isArray(Dt.scheme),"scheme must be a RegExp, String, or Array");const Tn=[].concat(Dt.scheme);Wn(Tn.length>=1,"scheme must have at least 1 scheme specified");const rr=[];for(let Dt=0;Dt<Tn.length;++Dt){const cr=Tn[Dt];Wn(cr instanceof RegExp||typeof cr==="string","scheme at position "+Dt+" must be a RegExp or String");if(cr instanceof RegExp){rr.push(cr.source.toString())}else{Wn(Lt.schemeRegex.test(cr),"scheme at position "+Dt+" must be a valid scheme");rr.push(Gn(cr))}}mr=rr.join("|")}const gr=mr?"(?:"+mr+")":Lt.scheme;const yr="(?:"+gr+":"+(Dt.domain?Lt.hierPartCapture:Lt.hierPart)+")";const Sr=Dt.allowRelative?"(?:"+yr+"|"+pr+")":yr;return rr.wrap(Sr+cr,mr)};rr.wrap=function(Dt,Lt){Dt=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${Dt}`;return{raw:Dt,regex:new RegExp(`^${Dt}$`),scheme:Lt}};rr.uriRegex=rr.createRegex({});Lt.regex=function(Dt={}){if(Dt.scheme||Dt.allowRelative||Dt.relativeOnly||Dt.allowQuerySquareBrackets||Dt.domain){return rr.createRegex(Dt)}return rr.uriRegex}},25673:(Dt,Lt)=>{"use strict";const Tn={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};Lt.Parser=class{constructor(Dt,Lt={}){if(!Lt[Tn.settings]&&Lt.constants){for(const Dt in Lt.constants){const Tn=Lt.constants[Dt];if(Tn!==null&&!["boolean","number","string"].includes(typeof Tn)){throw new Error(`Formula constant ${Dt} contains invalid ${typeof Tn} value type`)}}}this.settings=Lt[Tn.settings]?Lt:Object.assign({[Tn.settings]:true,constants:{},functions:{}},Lt);this.single=null;this._parts=null;this._parse(Dt)}_parse(Dt){let Wn=[];let Gn="";let rr=0;let cr=false;const flush=Dt=>{if(rr){throw new Error("Formula missing closing parenthesis")}const pr=Wn.length?Wn[Wn.length-1]:null;if(!cr&&!Gn&&!Dt){return}if(pr&&pr.type==="reference"&&Dt===")"){pr.type="function";pr.value=this._subFormula(Gn,pr.value);Gn="";return}if(Dt===")"){const Dt=new Lt.Parser(Gn,this.settings);Wn.push({type:"segment",value:Dt})}else if(cr){if(cr==="]"){Wn.push({type:"reference",value:Gn});Gn="";return}Wn.push({type:"literal",value:Gn})}else if(Tn.operatorCharacters.includes(Gn)){if(pr&&pr.type==="operator"&&Tn.operators.includes(pr.value+Gn)){pr.value+=Gn}else{Wn.push({type:"operator",value:Gn})}}else if(Gn.match(Tn.numberRx)){Wn.push({type:"constant",value:parseFloat(Gn)})}else if(this.settings.constants[Gn]!==undefined){Wn.push({type:"constant",value:this.settings.constants[Gn]})}else{if(!Gn.match(Tn.tokenRx)){throw new Error(`Formula contains invalid token: ${Gn}`)}Wn.push({type:"reference",value:Gn})}Gn=""};for(const Lt of Dt){if(cr){if(Lt===cr){flush();cr=false}else{Gn+=Lt}}else if(rr){if(Lt==="("){Gn+=Lt;++rr}else if(Lt===")"){--rr;if(!rr){flush(Lt)}else{Gn+=Lt}}else{Gn+=Lt}}else if(Lt in Tn.literals){cr=Tn.literals[Lt]}else if(Lt==="("){flush();++rr}else if(Tn.operatorCharacters.includes(Lt)){flush();Gn=Lt;flush()}else if(Lt!==" "){Gn+=Lt}else{flush()}}flush();Wn=Wn.map(((Dt,Lt)=>{if(Dt.type!=="operator"||Dt.value!=="-"||Lt&&Wn[Lt-1].type!=="operator"){return Dt}return{type:"operator",value:"n"}}));let pr=false;for(const Dt of Wn){if(Dt.type==="operator"){if(Tn.operatorsPrefix.includes(Dt.value)){continue}if(!pr){throw new Error("Formula contains an operator in invalid position")}if(!Tn.operators.includes(Dt.value)){throw new Error(`Formula contains an unknown operator ${Dt.value}`)}}else if(pr){throw new Error("Formula missing expected operator")}pr=!pr}if(!pr){throw new Error("Formula contains invalid trailing operator")}if(Wn.length===1&&["reference","literal","constant"].includes(Wn[0].type)){this.single={type:Wn[0].type==="reference"?"reference":"value",value:Wn[0].value}}this._parts=Wn.map((Dt=>{if(Dt.type==="operator"){return Tn.operatorsPrefix.includes(Dt.value)?Dt:Dt.value}if(Dt.type!=="reference"){return Dt.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(Dt.value)){throw new Error(`Formula contains invalid reference ${Dt.value}`)}if(this.settings.reference){return this.settings.reference(Dt.value)}return Tn.reference(Dt.value)}))}_subFormula(Dt,Wn){const Gn=this.settings.functions[Wn];if(typeof Gn!=="function"){throw new Error(`Formula contains unknown function ${Wn}`)}let rr=[];if(Dt){let Lt="";let Gn=0;let cr=false;const flush=()=>{if(!Lt){throw new Error(`Formula contains function ${Wn} with invalid arguments ${Dt}`)}rr.push(Lt);Lt=""};for(let Wn=0;Wn<Dt.length;++Wn){const rr=Dt[Wn];if(cr){Lt+=rr;if(rr===cr){cr=false}}else if(rr in Tn.literals&&!Gn){Lt+=rr;cr=Tn.literals[rr]}else if(rr===","&&!Gn){flush()}else{Lt+=rr;if(rr==="("){++Gn}else if(rr===")"){--Gn}}}flush()}rr=rr.map((Dt=>new Lt.Parser(Dt,this.settings)));return function(Dt){const Lt=[];for(const Tn of rr){Lt.push(Tn.evaluate(Dt))}return Gn.call(Dt,...Lt)}}evaluate(Dt){const Lt=this._parts.slice();for(let Wn=Lt.length-2;Wn>=0;--Wn){const Gn=Lt[Wn];if(Gn&&Gn.type==="operator"){const rr=Lt[Wn+1];Lt.splice(Wn+1,1);const cr=Tn.evaluate(rr,Dt);Lt[Wn]=Tn.single(Gn.value,cr)}}Tn.operatorsOrder.forEach((Wn=>{for(let Gn=1;Gn<Lt.length-1;){if(Wn.includes(Lt[Gn])){const Wn=Lt[Gn];const rr=Tn.evaluate(Lt[Gn-1],Dt);const cr=Tn.evaluate(Lt[Gn+1],Dt);Lt.splice(Gn,2);const pr=Tn.calculate(Wn,rr,cr);Lt[Gn-1]=pr===0?0:pr}else{Gn+=2}}}));return Tn.evaluate(Lt[0],Dt)}};Lt.Parser.prototype[Tn.symbol]=true;Tn.reference=function(Dt){return function(Lt){return Lt&&Lt[Dt]!==undefined?Lt[Dt]:null}};Tn.evaluate=function(Dt,Lt){if(Dt===null){return null}if(typeof Dt==="function"){return Dt(Lt)}if(Dt[Tn.symbol]){return Dt.evaluate(Lt)}return Dt};Tn.single=function(Dt,Lt){if(Dt==="!"){return Lt?false:true}const Tn=-Lt;if(Tn===0){return 0}return Tn};Tn.calculate=function(Dt,Lt,Wn){if(Dt==="??"){return Tn.exists(Lt)?Lt:Wn}if(typeof Lt==="string"||typeof Wn==="string"){if(Dt==="+"){Lt=Tn.exists(Lt)?Lt:"";Wn=Tn.exists(Wn)?Wn:"";return Lt+Wn}}else{switch(Dt){case"^":return Math.pow(Lt,Wn);case"*":return Lt*Wn;case"/":return Lt/Wn;case"%":return Lt%Wn;case"+":return Lt+Wn;case"-":return Lt-Wn}}switch(Dt){case"<":return Lt<Wn;case"<=":return Lt<=Wn;case">":return Lt>Wn;case">=":return Lt>=Wn;case"==":return Lt===Wn;case"!=":return Lt!==Wn;case"&&":return Lt&&Wn;case"||":return Lt||Wn}return null};Tn.exists=function(Dt){return Dt!==null&&Dt!==undefined}},533:(Dt,Lt)=>{"use strict";const Tn={};Lt.location=function(Dt=0){const Lt=Error.prepareStackTrace;Error.prepareStackTrace=(Dt,Lt)=>Lt;const Tn={};Error.captureStackTrace(Tn,this);const Wn=Tn.stack[Dt+1];Error.prepareStackTrace=Lt;return{filename:Wn.getFileName(),line:Wn.getLineNumber()}}},90167:(Dt,Lt,Tn)=>{"use strict";
|
|
3
3
|
/*!
|
|
4
4
|
* accepts
|