comp-hub 0.44.22 → 0.45.22

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var __webpack_modules__={53196:St=>{function webpackEmptyAsyncContext(St){return Promise.resolve().then((()=>{var On=new Error("Cannot find module '"+St+"'");On.code="MODULE_NOT_FOUND";throw On}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;St.exports=webpackEmptyAsyncContext},14071:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});const cr=ir(rr(22078));const ur=rr(23718);const{logLevel:pr=""}=(0,cr.default)(process.argv.slice(2));On["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:pr||"warn"},coreLogger:{level:pr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:ur.backendMessages.en},zh:{default:ur.backendMessages.zh},fr:{default:ur.backendMessages.fr},nl:{default:ur.backendMessages.nl},"zh-TW":{default:ur.backendMessages["zh-TW"]}},writeCookie:false}}},91921:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On["default"]={}},12799:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.MainConfiguration=void 0;const Sr=rr(46123);const Er=pr(rr(47453));const kr=pr(rr(99375));const Pr=pr(rr(65295));const Ir=pr(rr(2865));const Lr=pr(rr(49179));const Br=pr(rr(62487));const jr=pr(rr(96955));const Ur=pr(rr(87735));const Vr=pr(rr(16928));const Wr=pr(rr(79896));const zr=br(rr(76982));const qr=rr(79896);const Kr=rr(24434);const Xr=br(rr(99819));const Yr=br(rr(77036));const ii=rr(31855);const oi=rr(26815);const ai=rr(54633);const pi=rr(59416);const mi=rr(61142);const bi=rr(64754);const xi=rr(10778);const wi=rr(67872);const Oi=rr(15960);const Ii=rr(4145);const Ri=pr(rr(14071));const Li=pr(rr(91921));const Bi=rr(87518);const ji=rr(18801);const Ui=pr(rr(68255));const zi={DEFAULT_PORT:Number(Bi.uri.getUrlPort(oi.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Ki=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null}get apiUrl(){const St=this.app.getEnv();return St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL?oi.KEYS.REMOTE_SERVICE_URL_DEV:oi.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const St=this.app.getEnv();if(St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const St=Vr.join(__dirname,"../../cli/package.json");const On=JSON.parse((0,qr.readFileSync)(St,"utf8"));return On.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(St){const On=new Kr.EventEmitter;const rr={...St,on:{...St.on,error:St=>{this.logger.error("Proxy Error:",St.message);On.emit("error",St)},proxyRes:()=>On.emit("proxyRes"),proxyReq:St=>{const rr=`${St.protocol}//${St.host}${St.path}`;this.logger.debug("[Proxy] →",rr);On.emit("proxyReq",St)},proxyReqWs:(...St)=>On.emit("proxyReqWs",...St)}};const ir=St.pathRewrite;const cr=Object.keys(ir??{});if(cr.length>0){const[St]=cr;rr.pathRewrite=On=>{let rr=On.replace(oi.KEYS.PROXY_PATH_PREFIX,"");rr=rr.replace(new RegExp(St),ir[St]);return rr}}else{rr.pathRewrite=St=>St.replace(oi.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,ii.createProxyMiddleware)(rr),opt:rr,event:On}}createProxyMap(St){const On={};for(const[rr,ir]of Object.entries(St)){On[rr]=this.createProxyConfig(ir)}return On}setupProxy(){const St=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);if(bi.ProxyController.proxys){for(const St of Object.values(bi.ProxyController.proxys)){St.event.removeAllListeners()}}bi.ProxyController.proxys={};if(!St.proxy)return;bi.ProxyController.proxys=this.createProxyMap(St.proxy)}async buildConfig(St){const On=this.app.getEnv();const rr=St.cwd||process.cwd();this.logger.info("cwd:",rr);this.logger.info("env:",On);const ir={port:St.port||zi.DEFAULT_PORT,allowDebug:St.allowDebug??false,api:St.api||this.apiUrl,dir:St.dir||"",cwd:rr,proxy:St.proxy};const cr=Vr.join(rr,ir.dir||"").replace(/[\\/]$/,"");const ur=Vr.join(rr,oi.KEYS.PREBUILD_MODULE_DIR);const pr=Vr.join(rr,"node_modules");await Wr.promises.mkdir(ur,{recursive:true});const fr={prebuildModulePath:ur,cwd:rr,port:ir.port,srcPath:cr,remoteServer:ir.api,version:this.getVersion(),allowDebug:ir.allowDebug,proxy:ir.proxy,projectHash:zr.default.createHash("sha256").update(rr).digest("hex").slice(0,8),ossWebsite:(0,Oi.shouldUseOssMode)(On)?{main:process.env.WEBSITE_OSS_URL_MAIN||oi.KEYS.WEBSITE_OSS_URL_MAIN,iframe:process.env.WEBSITE_OSS_URL_IFRAME||oi.KEYS.WEBSITE_OSS_URL_IFRAME}:null};xi.remoteInstance.defaults.baseURL=fr.remoteServer;if(On===oi.KEYS.LOCAL_MIDWAY_ENV_PROD){fr.port=await(0,Yr.default)({port:Yr.default.makeRange(fr.port,fr.port+100)})}this.appConfig=fr;const br={[oi.KEYS.MODULE_LOAD_PREFIX]:{prefix:oi.KEYS.MODULE_LOAD_PREFIX,dir:ur,maxAge:0},[oi.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:oi.KEYS.NODE_MODULES_LOAD_PREFIX,dir:pr,maxAge:0},[oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:fr.srcPath,maxAge:0}};br.default={prefix:"/public",dir:ur};const Sr={dirs:br};if(On===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await Wr.promises.writeFile(Vr.join(__dirname,".comphubConfig.json"),JSON.stringify(fr,null,2))}return{koa:{port:fr.port},staticFile:Sr,httpProxy:{strategy:{[oi.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${oi.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${fr.remoteServer}/$1`}}}}}async startSubPort(){const St=this.app.getEnv();const On=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);const{port:rr,remoteServer:ir}=On;let cr=await(0,Yr.default)({port:Yr.default.makeRange(rr,rr+100)});const ur=new Xr.default;ur.use((async(St,cr)=>{if(St.path.startsWith(oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:rr}=On;const ir=St.path[0];const cr=St.path.replace(oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const ur=await Bi.locate.resolveBuildPath(cr,{baseDir:rr});if(ur){const On=ur.replace(rr,"");const pr=ji.textKit.replaceSlashWithSpecifiedSeparator(On,ir);if(cr!==pr){const On=pr.replace(cr,"");St.redirect(St.path+On);return}}}const ur=[{prefix:`/${oi.KEYS.REMOTE_SERVICE_PREFIX}`,target:ir,rewrite:{[`^/${oi.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${oi.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{[`^/${oi.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:oi.KEYS.MODULE_LOAD_PREFIX,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:oi.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}}];for(const On of ur){if(St.path.startsWith(On.prefix)){await(0,wi.createKoaProxy)(St,On.target,On.rewrite);return}}await cr()}));if((0,Oi.shouldUseOssMode)(St)){const St=On.ossWebsite;ur.use((0,Oi.createOssStaticMiddleware)({mainBaseUrl:St.main,iframeBaseUrl:St.iframe,htmlMode:"inject",injectHtml:(St,On)=>{const rr=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);const ir=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:rr.subPort})};<\/script>`;return On.replace("\x3c!--GLOBAL_CONFIG--\x3e",ir)},logger:this.logger}))}await new Promise(((rr,ir)=>{let pr=0;const fr=ur.listen(cr,(()=>{this.subServer=fr;this.app.setAttr(oi.KEYS.COMPHUB_CONFIG_KEY,{...On,subPort:cr});if(process.send){process.send({type:"subPort",subPort:cr})}if(St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${cr} 已启动`)}rr()}));fr.on("error",(St=>{if(St.code==="EADDRINUSE"&&pr<zi.MAX_SUB_PORT_RETRIES){pr++;this.logger.error(`子端口 ${cr} 被占用,正在尝试端口 ${++cr}`);fr.close();fr.listen(cr)}else{ir(St)}}))}))}async printAccessInfo(St){const On=await St.getAsync(Er.Framework);const rr=On.getServer();const ir=rr.address();const cr=this.app.getEnv();const ur=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",ur.cwd);this.logger.info("env:",cr);this.logger.info("port:",ur.port);if(ur.subPort)this.logger.info("subPort:",ur.subPort);if(ir&&typeof ir!=="string"){const St=ir.port;this.logger.info("Local Address:",`http://localhost:${St}`);if(cr===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const On=Bi.network.getLocalIPv4();if(On)this.logger.info("Network Address:",`http://${On}:${St}`);this.logger.info("Swagger UI:",`http://localhost:${St}/swagger-ui/index.html`)}}}async onConfigLoad(){const St=await(0,Ii.waitForIpcConfig)();const On=await this.buildConfig(St);const rr=this.app.getEnv();if(rr===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await Wr.promises.writeFile(Vr.join(__dirname,".start.json"),JSON.stringify(On,null,2))}return On}async onReady(){this.app.setAttr(oi.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([mi.ReportMiddleware]);const St=this.app.getEnv();if((0,Oi.shouldUseOssMode)(St)){const St=this.appConfig.ossWebsite;this.app.use((0,Oi.createOssStaticMiddleware)({mainBaseUrl:St.main,iframeBaseUrl:St.iframe,htmlMode:"passthrough",logger:this.logger}))}this.app.useFilter([pi.BadRequestErrorFilter,ai.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(St){this.setupProxy();await this.startSubPort();await this.printAccessInfo(St)}async onStop(){if(this.subServer){await new Promise((St=>{this.subServer.close((()=>St()))}));this.logger.info("子服务已关闭")}}};On.MainConfiguration=Ki;ur([(0,Sr.Logger)("coreLogger"),fr("design:type",Object)],Ki.prototype,"logger",void 0);ur([(0,Sr.App)(),fr("design:type",Object)],Ki.prototype,"app",void 0);On.MainConfiguration=Ki=ur([(0,Sr.Configuration)({imports:[Er,kr,Ir,Br,jr,Ur,Ui,{component:Pr,enabledEnvironment:[oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Lr,enabledEnvironment:[oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:Ri,local:Li}]})],Ki)},83465:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.CompController=void 0;const pr=rr(46123);const fr=rr(48795);const br=rr(63366);const Sr=rr(49179);const Er=rr(8131);const kr=rr(101);const Pr=rr(19465);const Ir=rr(19385);const Lr=rr(4990);const Br=(0,Ir.createNoData)(Sr.ApiProperty);let jr=class CompController{async dir(St){const On=await this.compService.getCompDir(St.compPath);return Ir.resUtil.success(On)}async file(St){const{filePath:On}=St;const rr=await this.compService.getCompFile(On);return Ir.resUtil.success({content:rr})}async check(St){const On=await this.compService.checkCompConfig(St.compPath,St.framework);return Ir.resUtil.success(On)}async updateVersion(St){const{compPath:On,version:rr}=St;await this.compService.updateCompVersion(On,rr);return Ir.resUtil.noData()}async generateCompJson(St){const{compPath:On}=St;await this.compService.generateCompJson(On);return Ir.resUtil.noData()}async dep(St){const{compPath:On}=St;const rr=await this.compService.getCompDep(On);return Ir.resUtil.success({thirdParty:rr})}async checkCompRepeat(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();const On=await this.compService.checkCompRepeat(St);return Ir.resUtil.success(On)}async submit(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(St);return Ir.resUtil.noData()}async update(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(St);return Ir.resUtil.noData()}async download(St){const On=await this.compService.downloadComp(St);if(On?.isRepeat){return Ir.resUtil.success({isRepeat:true})}return Ir.resUtil.success({isRepeat:false})}async localCompsByIds(St){const{compIds:On}=St;const rr=await this.compService.getLocalCompsByIds(On);return Ir.resUtil.success({compInfos:rr})}async packageJson(){const St=await this.compService.getPackageJsonContent();return Ir.resUtil.success({packageJson:St})}async compFileHash(St){const On=await this.compService.getCompFileHash(St);return Ir.resUtil.success(On)}async localComps(St){const On=await this.compService.getLocalComps(St);return Ir.resUtil.success(On)}async openCompPathInVscode(St){await this.compService.openCompPathInVscode(St);return Ir.resUtil.noData()}async openCompPathInExplorer(St){await this.compService.openCompPathInExplorer(St);return Ir.resUtil.noData()}async localCompDetailByPathHash(St){const On=await this.compService.getLocalCompDetailByPathHash(St);return Ir.resUtil.success(On)}async writeFile(St){await this.compService.writeCompFile(St);return Ir.resUtil.noData()}async renameDir(St){await this.compService.renameCompDir(St);return Ir.resUtil.noData()}};On.CompController=jr;ir([(0,pr.App)(),cr("design:type",Object)],jr.prototype,"app",void 0);ir([(0,pr.Inject)(),cr("design:type",fr.CompService)],jr.prototype,"compService",void 0);ir([(0,pr.Inject)(),cr("design:type",br.ConfigService)],jr.prototype,"configService",void 0);ir([(0,Sr.ApiOperation)({summary:"获取组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileVO)}),(0,pr.Post)("/dir"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompDirDTO]),cr("design:returntype",Promise)],jr.prototype,"dir",null);ir([(0,Sr.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileContentVO)}),(0,pr.Post)("/file"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompFileDTO]),cr("design:returntype",Promise)],jr.prototype,"file",null);ir([(0,Sr.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompCheckVO)}),(0,pr.Post)("/check"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompCheckDTO]),cr("design:returntype",Promise)],jr.prototype,"check",null);ir([(0,Sr.ApiOperation)({summary:"更新组件版本号"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/updateVersion"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.UpdateVersionDTO]),cr("design:returntype",Promise)],jr.prototype,"updateVersion",null);ir([(0,Sr.ApiOperation)({summary:"生成组件指纹文件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/generateCompJson"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.GenerateCompJsonDTO]),cr("design:returntype",Promise)],jr.prototype,"generateCompJson",null);ir([(0,Sr.ApiOperation)({summary:"获取组件依赖关系"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.ImportScanResultVO)}),(0,pr.Post)("/dep"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.DepDTO]),cr("design:returntype",Promise)],jr.prototype,"dep",null);ir([(0,Sr.ApiOperation)({summary:"检查组件是否重复"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompSimilarListVO)}),(0,pr.Post)("/checkCompRepeat",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CheckCompRepeatDTO]),cr("design:returntype",Promise)],jr.prototype,"checkCompRepeat",null);ir([(0,Sr.ApiOperation)({summary:"提交组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/submit",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.SubmitCompDTO]),cr("design:returntype",Promise)],jr.prototype,"submit",null);ir([(0,Sr.ApiOperation)({summary:"更新组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/update",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.UpdateCompDTO]),cr("design:returntype",Promise)],jr.prototype,"update",null);ir([(0,Sr.ApiOperation)({summary:"下载组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.DownloadCompVO)}),(0,pr.Post)("/download",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.DownloadCompDTO]),cr("design:returntype",Promise)],jr.prototype,"download",null);ir([(0,Sr.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.LocalCompsByIdsVO)}),(0,pr.Post)("/localCompsByIds"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompsByIdsDTO]),cr("design:returntype",Promise)],jr.prototype,"localCompsByIds",null);ir([(0,Sr.ApiOperation)({summary:"获取package.json"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.PackageJsonVO)}),(0,pr.Post)("/packageJson"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],jr.prototype,"packageJson",null);ir([(0,Sr.ApiOperation)({summary:"获取组件文件hash"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileHashVO)}),(0,pr.Post)("/compFileHash"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompFileHashDTO]),cr("design:returntype",Promise)],jr.prototype,"compFileHash",null);ir([(0,Sr.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,(0,Ir.createListWrapper)(Sr.ApiProperty,kr.LocalCompsVO))}),(0,pr.Post)("/localComps",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompsDTO]),cr("design:returntype",Promise)],jr.prototype,"localComps",null);ir([(0,Sr.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/openCompPathInVscode"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.OpenCompPathInVscodeDTO]),cr("design:returntype",Promise)],jr.prototype,"openCompPathInVscode",null);ir([(0,Sr.ApiOperation)({summary:"在系统文件管理器中打开并选中组件文件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/openCompPathInExplorer"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.OpenCompPathInExplorerDTO]),cr("design:returntype",Promise)],jr.prototype,"openCompPathInExplorer",null);ir([(0,Sr.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.LocalCompDetailVO)}),(0,pr.Post)("/localCompDetailByPathHash"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompDetailByPathHashDTO]),cr("design:returntype",Promise)],jr.prototype,"localCompDetailByPathHash",null);ir([(0,Sr.ApiOperation)({summary:"写入文件到组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/writeFile"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompWriteFileDTO]),cr("design:returntype",Promise)],jr.prototype,"writeFile",null);ir([(0,Sr.ApiOperation)({summary:"重命名组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/renameDir"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.RenameCompDirDTO]),cr("design:returntype",Promise)],jr.prototype,"renameDir",null);On.CompController=jr=ir([(0,Sr.ApiTags)(["comp"]),(0,pr.Controller)("/comp")],jr)},96736:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.ModuleController=void 0;const pr=rr(46123);const fr=rr(49179);const br=rr(85984);const Sr=rr(19428);const Er=rr(71692);const kr=rr(61275);const Pr=rr(19385);const Ir=(0,Pr.createNoData)(fr.ApiProperty);let Lr=class ModuleController{async preBuild(St){const{deps:On}=St;let rr=null;await this.queueService.enqueue((async()=>{rr=await this.moduleService.preBuild(On)}));return Pr.resUtil.success(rr)}async buildTemplateCompiler(St){let On=null;await this.queueService.enqueue((async()=>{On=await this.moduleService.buildTemplateCompiler(St.vueVersion)}));return Pr.resUtil.success(On)}async preBuildSize(){const St=await this.moduleService.preBuildSize();return Pr.resUtil.success({size:St})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Pr.resUtil.noData()}};On.ModuleController=Lr;ir([(0,pr.Inject)(),cr("design:type",br.ModuleService)],Lr.prototype,"moduleService",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.QueueService)],Lr.prototype,"queueService",void 0);ir([(0,fr.ApiOperation)({summary:"模块预构建"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.PreBuildVO)}),(0,pr.Post)("/preBuild"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Sr.PreBuildDTO]),cr("design:returntype",Promise)],Lr.prototype,"preBuild",null);ir([(0,fr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,fr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.BuildTemplateCompilerVO)}),(0,pr.Post)("/buildTemplateCompiler"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Sr.BuildTemplateCompilerDTO]),cr("design:returntype",Promise)],Lr.prototype,"buildTemplateCompiler",null);ir([(0,fr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.PreBuildSizeVO)}),(0,pr.Post)("/preBuildSize"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Lr.prototype,"preBuildSize",null);ir([(0,fr.ApiOperation)({summary:"清除预构建模块文件"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:Ir}),(0,pr.Post)("/clearPreBuild"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Lr.prototype,"clearPreBuild",null);On.ModuleController=Lr=ir([(0,fr.ApiTags)(["module"]),(0,pr.Controller)("/module")],Lr)},64754:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur;Object.defineProperty(On,"__esModule",{value:true});On.ProxyController=void 0;const pr=rr(46123);const fr=rr(26815);const br=fr.KEYS.PROXY_PATH_PREFIX;let Sr=ur=class ProxyController{async proxy(){const St=this.ctx.path.replace(br,"");let On=null;for(const[rr,ir]of Object.entries(ur.proxys)){const cr=new RegExp(rr);if(cr.test(St)||St.startsWith(rr)){On=ir;break}}if(!On){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:rr,event:ir}=On;await new Promise(((St,On)=>{rr(this.ctx.req,this.ctx.res);ir.on("error",On);ir.on("proxyRes",St)}))}};On.ProxyController=Sr;ir([(0,pr.Inject)(),cr("design:type",Object)],Sr.prototype,"ctx",void 0);ir([(0,pr.All)("/*"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Sr.prototype,"proxy",null);On.ProxyController=Sr=ur=ir([(0,pr.Controller)(br,{ignoreGlobalPrefix:true})],Sr)},17076:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SpaController=void 0;const ur=rr(46123);const pr=rr(49179);const fr=rr(63366);const br=rr(26815);const Sr="无法连接 OSS 资源服务器,请检查网络后重试";let Er=class SpaController{async index(){this.ctx.redirect(`/${br.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const St=this.configService.comphubConfig();const{ossWebsite:On}=St;if(!On){this.ctx.status=404;return}let rr;let ir;try{ir=await fetch(`${On.main}/${br.KEYS.WEBSITE_PATH_MAIN}/index.html`,{signal:AbortSignal.timeout(15e3)})}catch{this.ctx.status=502;this.ctx.body=Sr;return}if(!ir.ok){this.ctx.status=502;this.ctx.body=Sr;return}rr=await ir.text();this.ctx.set("Cache-Control","no-cache");const cr=this.configService.getGlobalConfig();const{projectHash:ur}=cr;if(ur){rr=rr.replace(/<base[^>]*>/gi,"");rr=rr.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${ur}/${br.KEYS.WEBSITE_PATH_MAIN}/">`)}const pr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(cr)};<\/script>`;rr=rr.replace("\x3c!--GLOBAL_CONFIG--\x3e",pr);return rr}async getGlobalConfig(){return this.configService.getGlobalConfig()}};On.SpaController=Er;ir([(0,ur.Inject)(),cr("design:type",Object)],Er.prototype,"ctx",void 0);ir([(0,ur.App)(),cr("design:type",Object)],Er.prototype,"app",void 0);ir([(0,ur.Inject)(),cr("design:type",fr.ConfigService)],Er.prototype,"configService",void 0);ir([(0,ur.Get)("/"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"index",null);ir([(0,ur.Get)(`/${br.KEYS.WEBSITE_PATH_MAIN}/*`),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"spa",null);ir([(0,ur.Get)(br.KEYS.GLOBAL_CONFIG_PATH),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"getGlobalConfig",null);On.SpaController=Er=ir([(0,pr.ApiExcludeController)(),(0,ur.Controller)("/",{ignoreGlobalPrefix:true})],Er)},44734:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.VuefinderController=void 0;const pr=rr(46123);const fr=rr(5808);const br=rr(49179);const Sr=rr(23444);let Er=class VuefinderController{async list(St){const On=await this.vuefinderService.list(St);return On}};On.VuefinderController=Er;ir([(0,pr.App)(),cr("design:type",Object)],Er.prototype,"app",void 0);ir([(0,pr.Inject)(),cr("design:type",fr.VuefinderService)],Er.prototype,"vuefinderService",void 0);ir([(0,br.ApiOperation)({summary:"list"}),(0,pr.Get)("/list"),ur(0,(0,pr.Query)()),cr("design:type",Function),cr("design:paramtypes",[Sr.VueFinderIndexDTO]),cr("design:returntype",Promise)],Er.prototype,"list",null);On.VuefinderController=Er=ir([(0,br.ApiTags)(["vuefinder"]),(0,pr.Controller)("/vuefinder")],Er)},60149:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BasePageDTO=void 0;const ur=rr(49179);const pr=rr(99375);class BasePageDTO{}On.BasePageDTO=BasePageDTO;ir([(0,ur.ApiProperty)({example:1,description:"当前页码",required:false}),(0,pr.Rule)(pr.RuleType.number().min(1)),cr("design:type",Number)],BasePageDTO.prototype,"page",void 0);ir([(0,ur.ApiProperty)({example:10,description:"每页数量",required:false}),(0,pr.Rule)(pr.RuleType.number().min(1).max(50)),cr("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);ir([(0,pr.Rule)(pr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,ur.ApiProperty)({example:"小明",description:"关键词",required:false}),cr("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.RenameCompDirDTO=On.CompWriteFileDTO=On.LocalCompDetailByPathHashDTO=On.OpenCompPathInExplorerDTO=On.OpenCompPathInVscodeDTO=On.LocalCompsDTO=On.DownloadCompDTO=On.UpdateCompDTO=On.SubmitCompDTO=On.DepItemDTO=On.CompFileDTO=On.UpdateVersionDTO=On.CompFileHashDTO=On.CheckCompRepeatDTO=On.LocalCompsByIdsDTO=On.DepDTO=On.GenerateCompJsonDTO=On.CompCheckDTO=On.CompDirDTO=void 0;const ur=rr(49179);const pr=rr(99375);const fr=rr(26815);const br=rr(60149);class CompPathDTO{}ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}ir([(0,ur.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}On.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}On.CompCheckDTO=CompCheckDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}On.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}On.DepDTO=DepDTO;class LocalCompsByIdsDTO{}On.LocalCompsByIdsDTO=LocalCompsByIdsDTO;ir([(0,ur.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}On.CheckCompRepeatDTO=CheckCompRepeatDTO;ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}On.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}On.UpdateVersionDTO=UpdateVersionDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}On.CompFileDTO=CompFileDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,pr.Rule)(pr.RuleType.array().optional().items(pr.RuleType.string())),cr("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}ir([(0,ur.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],ParentDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}On.DepItemDTO=DepItemDTO;ir([(0,ur.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DepItemDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DepItemDTO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,pr.Rule)(pr.RuleType.object().optional()),cr("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}On.SubmitCompDTO=SubmitCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);ir([(0,ur.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,pr.Rule)(pr.RuleType.array().required()),cr("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);ir([(0,ur.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,pr.Rule)(pr.RuleType.array().required()),cr("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,pr.Rule)(pr.RuleType.string().empty("").default("")),cr("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,pr.Rule)(pr.RuleType.array().items(pr.RuleType.string())),cr("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}On.UpdateCompDTO=UpdateCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,pr.Rule)(pr.RuleType.string().allow("").max(200)),cr("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}On.DownloadCompDTO=DownloadCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);ir([(0,ur.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,pr.Rule)(pr.RuleType.boolean().default(false)),cr("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class LocalCompsDTO extends br.BasePageDTO{}On.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}On.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class OpenCompPathInExplorerDTO{}On.OpenCompPathInExplorerDTO=OpenCompPathInExplorerDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInExplorerDTO.prototype,"folderPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInExplorerDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}On.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}On.CompWriteFileDTO=CompWriteFileDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"文件名",example:fr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);ir([(0,ur.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}On.RenameCompDirDTO=RenameCompDirDTO;ir([(0,ur.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BuildTemplateCompilerDTO=On.PreBuildDTO=void 0;const ur=rr(49179);const pr=rr(99375);class PreBuildDTO{}On.PreBuildDTO=PreBuildDTO;ir([(0,ur.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}On.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;ir([(0,ur.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},23444:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.VueFinderIndexDTO=void 0;const ur=rr(49179);const pr=rr(99375);class VueFinderIndexDTO{}On.VueFinderIndexDTO=VueFinderIndexDTO;ir([(0,ur.ApiProperty)({required:false,description:"文件路径"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.BadRequestErrorFilter=void 0;const cr=rr(46123);const ur=rr(19385);const pr=rr(26815);let fr=class BadRequestErrorFilter{async catch(St,On){const rr=On.app.getEnv();if(rr===pr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("BadRequestErrorFilter==>",St)}return ur.resUtil.error(St.message,St.status)}};On.BadRequestErrorFilter=fr;On.BadRequestErrorFilter=fr=ir([(0,cr.Catch)(cr.httpError.BadRequestError)],fr)},54633:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.DefaultErrorFilter=void 0;const cr=rr(46123);const ur=rr(26815);let pr=class DefaultErrorFilter{async catch(St,On){const rr=On.app.getEnv();try{const On=JSON.parse(St.message);return{...On}}catch(St){if(rr===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("解析错误信息失败==>",St.message,"\n")}}finally{if(rr===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("原始错误==>",St)}}On.status=St.status??500;return{code:St.status??500,message:St.message??"未知错误"}}};On.DefaultErrorFilter=pr;On.DefaultErrorFilter=pr=ir([(0,cr.Catch)()],pr)},15545:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(12799);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.MainConfiguration}});cr(rr(14071),On);cr(rr(91921),On);cr(rr(83465),On);cr(rr(96736),On);cr(rr(64754),On);cr(rr(17076),On);cr(rr(44734),On);cr(rr(60149),On);cr(rr(8131),On);cr(rr(19428),On);cr(rr(23444),On);cr(rr(59416),On);cr(rr(54633),On);cr(rr(9711),On);cr(rr(53951),On);cr(rr(77523),On);cr(rr(15960),On);cr(rr(61142),On);cr(rr(19465),On);cr(rr(95637),On);cr(rr(48795),On);cr(rr(63366),On);cr(rr(23086),On);cr(rr(85984),On);cr(rr(80799),On);cr(rr(61275),On);cr(rr(19452),On);cr(rr(5808),On);cr(rr(66593),On);cr(rr(58953),On);cr(rr(49969),On);cr(rr(4145),On);cr(rr(10778),On);cr(rr(67872),On);cr(rr(101),On);cr(rr(71692),On)},9711:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},53951:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},77523:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},15960:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.OSS_HTML_CACHE_CONTROL=void 0;On.shouldUseOssMode=shouldUseOssMode;On.resolveOssUrl=resolveOssUrl;On.isHtmlRequest=isHtmlRequest;On.toHtmlFileUrl=toHtmlFileUrl;On.createOssStaticMiddleware=createOssStaticMiddleware;const ir=rr(2203);const cr=rr(26815);On.OSS_HTML_CACHE_CONTROL="no-cache";function shouldUseOssMode(St){return St!==cr.KEYS.LOCAL_MIDWAY_ENV_LOCAL}function resolveOssUrl(St,On,rr){if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_MAIN}/`))return St+rr;if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_CONTAINER}/`))return On+rr;if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_ITEM}/`))return On+rr;return null}function isHtmlRequest(St,On){if(St.endsWith("/")||/\.html$/i.test(St))return true;return/text\/html/i.test(On)}function toHtmlFileUrl(St,On){if(/\.html$/i.test(On))return St;const rr=On.split("/").filter(Boolean)[0]??"";return St.slice(0,St.length-On.length)+`/${rr}/index.html`}function createOssStaticMiddleware(St){return async(rr,cr)=>{const ur=resolveOssUrl(St.mainBaseUrl,St.iframeBaseUrl,rr.path);if(!ur){await cr();return}const pr=isHtmlRequest(rr.path,rr.headers.accept||"");if(pr&&St.htmlMode==="passthrough"){await cr();return}try{const cr=pr?toHtmlFileUrl(ur,rr.path):ur;const fr=await fetch(cr,{redirect:"follow",signal:AbortSignal.timeout(15e3)});if(pr){const ir=await fr.text();if(!fr.ok){rr.status=fr.status;rr.body=ir;return}rr.status=fr.status;rr.type="text/html; charset=utf-8";const cr=St.htmlHeaders??{"Cache-Control":On.OSS_HTML_CACHE_CONTROL};for(const[St,On]of Object.entries(cr))rr.set(St,On);rr.body=St.injectHtml?.(rr.path,ir)??ir;return}rr.status=fr.status;rr.set("content-type",fr.headers.get("content-type")||"application/octet-stream");const br=fr.headers.get("cache-control");if(br)rr.set("cache-control",br);rr.body=fr.body?ir.Readable.fromWeb(fr.body):""}catch(On){const ir=On instanceof Error?On.message:String(On);St.logger?.warn("[oss-static] 代理失败:",ir);rr.status=502;rr.body="无法连接 OSS 资源服务器,请检查网络后重试"}}}},61142:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.ReportMiddleware=void 0;const cr=rr(46123);let ur=class ReportMiddleware{resolve(){return async(St,On)=>{const rr=Date.now();const ir=await On();const cr=St.url;St.logger.info(`请求 ${St.method} ${cr} → ${St.status} (${Date.now()-rr}ms)`);return ir}}static getName(){return"report"}};On.ReportMiddleware=ur;On.ReportMiddleware=ur=ir([(0,cr.Middleware)()],ur)},19465:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.TokenMiddleware=void 0;const cr=rr(46123);const ur=rr(10778);let pr=class TokenMiddleware{resolve(){return async(St,On)=>{(0,ur.setHeader)(St.header);await On()}}static getName(){return"token"}};On.TokenMiddleware=pr;On.TokenMiddleware=pr=ir([(0,cr.Middleware)()],pr)},95637:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.CommandService=void 0;const pr=rr(46123);const fr=ur(rr(79896));const br=rr(63366);const Sr=rr(7455);const Er=ur(rr(16928));const kr=rr(68255);const Pr=rr(35317);const Ir=ur(rr(70857));let Lr=class CommandService{async revealInVSCode(St,On,rr=1,ir=1){const{cwd:cr}=this.configService.comphubConfig();if(!St||!fr.default.existsSync(St)||!fr.default.statSync(St).isDirectory()){throw new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const ur=Er.default.resolve(St,On);if(!fr.default.existsSync(ur)||fr.default.statSync(ur).isDirectory()){throw new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,Sr.launchIDE)({file:cr});(0,Sr.launchIDE)({file:ur,line:rr,column:ir})}revealInExplorer(St,On){return new Promise(((rr,ir)=>{if(!St||!fr.default.existsSync(St)||!fr.default.statSync(St).isDirectory()){ir(new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist")));return}const cr=Er.default.resolve(St,On);if(!fr.default.existsSync(cr)||fr.default.statSync(cr).isDirectory()){ir(new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist")));return}const ur=Ir.default.platform();if(ur==="win32"){(0,Pr.exec)(`explorer /select,"${cr}"`,(()=>{rr(cr)}))}else{(0,Pr.exec)(`open -R "${cr}"`,(St=>{if(St){ir(new pr.httpError.InternalServerErrorError(this.i18nService.translate("local.command.errors.openExplorerFailed",{args:[St.message]})));return}rr(cr)}))}}))}};On.CommandService=Lr;ir([(0,pr.Inject)(),cr("design:type",br.ConfigService)],Lr.prototype,"configService",void 0);ir([(0,pr.Inject)(),cr("design:type",Object)],Lr.prototype,"ctx",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.MidwayI18nService)],Lr.prototype,"i18nService",void 0);On.CommandService=Lr=ir([(0,pr.Provide)()],Lr)},48795:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CompService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(63366);const Pr=rr(23086);const Ir=rr(85984);const Lr=rr(80799);const Br=pr(rr(70857));const jr=pr(rr(10232));const Ur=rr(87518);const Vr=rr(84464);const Wr=rr(95637);const zr=rr(26815);const qr=rr(18801);const Kr=rr(4990);const Xr=rr(68255);let Yr=class CompService{getCompFullPath(St){const{srcPath:On}=this.configService.comphubConfig();St=St.replace(zr.KEYS.FILE_MANAGER_DIRNAME,"");const rr=Sr.join(On,St);return rr}checkCompEntryIndex(St,On=zr.KEYS.COMP_FRAMEWORK_VUE){if(On===zr.KEYS.COMP_FRAMEWORK_REACT){for(const On of zr.KEYS.COMP_USE_ENTRY_FILE_REACT){const rr=Sr.join(St,On);if(Er.existsSync(rr)){return On}}throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[zr.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const rr=Sr.join(St,zr.KEYS.COMP_USE_ENTRY_FILE);if(!Er.existsSync(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[zr.KEYS.COMP_USE_ENTRY_FILE]}))}return zr.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(St){const On=this.getCompFullPath(St);const rr=Sr.join(On,zr.KEYS.COMP_CONFIG_FILENAME);if(!Er.existsSync(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(St){const On=Object.keys(St);const rr=zr.ARRAY.COMP_DEFAULT_FIELD.every((St=>!St.required||On.includes(St.name)));if(!rr)return false;return qr.versionKit.validateVersion(St.version)}async updateCompJson(St,On){const rr=this.getCompFullPath(St);const ir=Sr.join(rr,zr.KEYS.COMP_CONFIG_FILENAME);const cr=await this.getCompFile(ir);const ur=On(JSON.parse(cr));await Er.promises.writeFile(ir,JSON.stringify(ur,null,4))}async readCompVersion(St){const On=Sr.join(St,zr.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(On);const ir=JSON.parse(rr);return ir.version}initCompJson(){return zr.ARRAY.COMP_DEFAULT_FIELD.reduce(((St,On)=>{const rr={};if(On.required){rr[On.name]=On.default}return{...St,...rr}}),{})}async uploadCompFolderToOss({compFullPath:St,version:On,ossData:rr}){const{files:ir}=await Ur.fileTree.generateTree(St);const cr=ir.map((({absolutePath:On,size:rr})=>{const ir=On.replace(St,"");return{filePath:ir,fileFullPath:On,size:rr??0}}));cr.sort(((St,On)=>On.size-St.size));for(let St=0;St<cr.length;St++){const{filePath:ir,fileFullPath:ur}=cr[St];const pr=Sr.join(rr.key,On,ir);const fr={...rr,key:pr.replace(new RegExp(qr.textKit.escapeRegExp(Sr.sep),"g"),"/")};const br=Er.createReadStream(ur);await this.ossService.uploadFileToOss(fr,br)}}async uploadPreBuildFilesToOss(St){const On=Object.values(St.entryNameToFile||{});const rr=Array.from(new Set([...On,...St.chunkFiles||[]]));if(rr.length===0)return;const ir=await Kr.remoteApi.v1Oss.osscontrollerPrebuildputpolicy();const cr=ir.data;const{cwd:ur}=this.configService.comphubConfig();const pr=Sr.join(ur,zr.KEYS.PREBUILD_MODULE_DIR);for(const St of rr){const On=Sr.join(pr,St);if(!Er.existsSync(On)){this.ctx.logger.warn(`预编译产物文件不存在,跳过上传: ${On}`);continue}const rr=Er.createReadStream(On);const ir={...cr,key:St};await this.ossService.uploadFileToOss(ir,rr,true)}}async getCompHash(St){const On=await Ur.digest.getFileHashList(St);const rr=On.map((St=>`${St.relativePath}-${St.hash}`)).join(";");return Ur.digest.getStringHash(rr)}async getCompFeatures(St){const On=await Ur.digest.getFileHashAndSsdeepList(St);const rr=On.map((St=>{const On=(0,Vr.omit)(St,["relativePath"]);return{...On,path:St.relativePath}}));const ir=await Ur.digest.getRelativeDirList(St);const cr=JSON.stringify(ir);const ur=Ur.digest.getStringFuzzyHash(cr);const pr=await this.getCompHash(St);return{fileHashList:rr,compHash:pr,dirHash:Ur.digest.getStringHash(cr),dirSsdeep:Ur.digest.getSsdeepStruct(ur)}}async getCompFileList(St){const{files:On}=await Ur.fileTree.generateTree(St,{withStats:true,calculateSize:true});const rr=On.map((({name:On,size:rr,absolutePath:ir})=>({name:On,size:rr??0,path:ir.replace(St,"").replace(new RegExp(qr.textKit.escapeRegExp(Sr.sep),"g"),"/")})));return rr}checkCompFileSize(St){if(St>zr.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(zr.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(St){if(St>zr.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[zr.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(St){const On=zr.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const rr=Math.floor(On/1024/1024);for(const ir of St){if(ir.size>On){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[ir.path,rr.toString()]}))}}}async findCompJsonPath(St){const{files:On}=await Ur.fileTree.generateTree(St,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",On.length);const rr=On.filter((({absolutePath:St})=>St.endsWith(zr.KEYS.COMP_CONFIG_FILENAME)));return rr}async getAllLocalCompIds(){const{srcPath:St}=this.configService.comphubConfig();const On=await this.findCompJsonPath(St);this.ctx.logger.debug("组件文件数量:",On.length);const rr=On.map((async({absolutePath:St})=>{const On=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(On);const ir=this.checkCompJsonFormat(rr);const cr=Sr.dirname(St);return{compjson:rr,isCompHub:ir,compPath:cr,pathHash:Ur.digest.getStringHash(cr)}}));const ir=await Promise.all(rr);return ir.filter((St=>St.isCompHub&&St.compjson[zr.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(St){const{srcPath:On}=this.configService.comphubConfig();const rr=Sr.join(St.replace(zr.KEYS.FILE_MANAGER_DIRNAME,`${On}${Sr.sep}`));const{tree:ir,files:cr}=await Ur.fileTree.generateTree(rr,{sortBy:"type"});const _handleTree=St=>{const On={name:St.name,path:St.absolutePath,type:St.type};if(St.children&&St.children.length>0){On.children=St.children.map((St=>_handleTree(St)))}return On};return{tree:_handleTree(ir),files:cr.map((St=>St.absolutePath))}}async getCompFile(St){const On=await Er.promises.readFile(St,"utf-8");return On}async checkCompConfig(St,On=zr.KEYS.COMP_FRAMEWORK_VUE){const rr=Sr.basename(St);const ir=this.getCompFullPath(St);let cr;try{const St=this.checkCompEntryIndex(ir,On);cr=Sr.join(rr,St)}catch(St){this.ctx.logger.error("检查组件入口文件失败",St);return{errorMsg:St.message}}try{this.checkCompJson(St)}catch(St){this.ctx.logger.error("检查组件配置文件comp.json失败",St);return{entryIndexPath:cr,errorMsg:St.message}}const ur=Sr.join(rr,zr.KEYS.COMP_CONFIG_FILENAME);try{const On=Sr.join(this.getCompFullPath(St),zr.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(On);const ir=this.checkCompJsonFormat(JSON.parse(rr));if(!ir){return{entryIndexPath:cr,compJsonPath:ur,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(St){this.ctx.logger.error("读取组件配置文件comp.json失败",St);return{entryIndexPath:cr,compJsonPath:ur,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:cr,compJsonPath:ur,errorMsg:""}}async updateCompVersion(St,On){const rr=qr.versionKit.validateVersion(On);if(!rr){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const ir=this.getCompFullPath(St);const cr=Sr.join(ir,zr.KEYS.COMP_CONFIG_FILENAME);const ur=await this.getCompFile(cr);const pr=JSON.parse(ur);pr.version=On;const fr=JSON.stringify(pr,null,2);await Er.promises.writeFile(cr,fr)}async generateCompJson(St){const On=this.getCompFullPath(St);const rr=Sr.basename(On);const ir=this.initCompJson();ir.name=rr;await Er.promises.writeFile(Sr.join(On,zr.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(ir,null,4))}async getCompDep(St){const{cwd:On}=this.configService.comphubConfig();const rr=this.getCompFullPath(St);const ir=await this.depsService.getModuleEntry(rr,On);return ir}async getCompFileHash(St){const{compPath:On}=St;const rr=this.getCompFullPath(On);const ir=await this.getCompFeatures(rr);return{compHash:ir.compHash}}async checkCompRepeat(St){const{compPath:On,teamId:rr}=St;const ir=this.getCompFullPath(On);const cr=await this.getCompFeatures(ir);const ur=await Kr.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(cr,{headers:{"team-id":rr}});return ur.data}async submitComp(St){let On="";let rr={};try{const{compPath:ir,dep:cr,previewConfigs:ur,desc:pr,bgColor:fr,name:br,teamId:Sr,tags:Er,framework:kr}=St;rr={"team-id":Sr};this.checkCompJson(ir);const Pr=this.getCompFullPath(ir);const Ir=await this.getCompFeatures(Pr);this.checkCompEntryIndex(Pr,kr);const Lr=await this.readCompVersion(Pr);const Br=await this.getCompFileList(Pr);const jr=Br.reduce(((St,On)=>St+On.size),0);this.checkCompFileNum(Br.length);this.checkCompFileSize(jr);this.checkCompSingleFileSize(Br);const Ur=await this.getPreBuildInfo(cr);const Vr={name:br,dep:cr,previewConfigs:ur,desc:pr,version:Lr,size:jr,files:Br,bgColor:fr,compFeatures:Ir,tags:Er,preBuildInfo:Ur,framework:kr};const Wr=await Kr.remoteApi.v1Comp.compcontrollerUpload(Vr,{headers:rr});const qr=Wr.data._id;On=qr;await this.updateCompJson(ir,(St=>({...St,name:br,[zr.KEYS.COMP_FIELD_COMP_ID]:qr})));const{data:{componentDir:Xr}}=await Kr.remoteApi.v1Oss.osscontrollerCompossdir();const Yr=await Kr.remoteApi.v1Oss.osscontrollerPutpolicy({type:Xr});const ii={compFullPath:Pr,version:Lr,ossData:Yr.data};await this.uploadCompFolderToOss(ii);await this.uploadPreBuildFilesToOss(Ur);const{key:oi}=Yr.data;const ai={compId:qr,objectId:`${Xr}${oi}`};await Kr.remoteApi.v1Comp.compcontrollerUpdateobjectid(ai)}catch(St){if(On){await Kr.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:On},{headers:rr})}if(St instanceof br.httpError.BadRequestError){throw new br.httpError.BadRequestError(St)}throw new Error(St.message)}}async updateComp(St){const{compId:On,compPath:rr,dep:ir,previewConfigs:cr,desc:ur,bgColor:pr,name:fr,upgradeDesc:br,teamId:kr,tags:Pr,framework:Ir}=St;const Lr=this.getCompFullPath(rr);const Br=await this.getCompFeatures(Lr);this.checkCompEntryIndex(Lr,Ir);const jr=await Kr.remoteApi.v1Comp.compcontrollerCompdetail({compId:On});const{objectId:Ur,version:Vr}=jr.data;const Wr=await this.readCompVersion(Lr);const qr=await this.getCompFileList(Lr);const Xr=qr.reduce(((St,On)=>St+On.size),0);this.checkCompFileNum(qr.length);this.checkCompFileSize(Xr);this.checkCompSingleFileSize(qr);const Yr=await this.getPreBuildInfo(ir);const ii={compId:On,name:fr,dep:ir,previewConfigs:cr,desc:ur,version:Wr,size:Xr,files:qr,bgColor:pr,compFeatures:Br,upgradeDesc:br,tags:Pr,preBuildInfo:Yr,framework:Ir};const oi=await Kr.remoteApi.v1Comp.compcontrollerUpdate(ii,{headers:{"team-id":kr}});const{isFileChange:ai}=oi.data;if(!ai&&Vr===Wr){await this.uploadPreBuildFilesToOss(Yr);const St=Sr.join(Lr,zr.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(Er.existsSync(St)){const On=await Kr.remoteApi.v1Oss.osscontrollerCompossdir();const rr=await Kr.remoteApi.v1Oss.osscontrollerPutpolicy({type:On.data.componentDir});const ir=Ur.replace(rr.data.dir,"");const cr=Sr.join(ir,Wr,zr.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const ur=Er.createReadStream(St);const pr={...rr.data,key:cr};await this.ossService.uploadFileToOss(pr,ur,true)}return}const pi=await Kr.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:mi}=pi.data;const bi=await Kr.remoteApi.v1Oss.osscontrollerPutpolicy({type:mi});const xi=Ur.replace(bi.data.dir,"");const wi={...bi.data,key:xi};const Oi={compFullPath:Lr,version:Wr,ossData:wi};await this.uploadCompFolderToOss(Oi);await this.uploadPreBuildFilesToOss(Yr);await this.updateCompJson(rr,(St=>({...St,name:fr,[zr.KEYS.COMP_FIELD_COMP_ID]:On})))}async getPreBuildInfo(St){const On=await this.moduleService.preBuild(St.map((St=>St.name)));return{entryNameToFile:On.entryNameToFile,chunkFiles:On.chunkFiles}}async downloadComp(St){const{compId:On,savePath:rr,isCover:ir,compName:cr,version:ur}=St;const{srcPath:pr}=this.configService.comphubConfig();const fr=zr.KEYS.FILE_MANAGER_DIRNAME;const kr=rr.replace(fr,"").replace(/[/\\]/g,Sr.sep);const Pr=Sr.join(pr,kr,cr);if(!ir&&Er.existsSync(Pr)){return{isRepeat:true}}const Ir=Br.tmpdir();const Lr=Sr.join(Ir,zr.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Lr);const Vr=await Kr.remoteApi.v1Comp.compcontrollerCompdetail({compId:On,version:ur});if(!Vr?.data){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:Wr,objectId:qr,name:Xr}=Vr.data;let Yr=[];const ii=Sr.join(Lr,qr,ur);if(Er.existsSync(ii)){const{files:St}=await Ur.fileTree.generateTree(ii);Yr=St}await Kr.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:On,version:ur});if(Wr.length===Yr.length){const St=Yr.find((({absolutePath:St})=>St.replace(ii,"").startsWith(`${Sr.sep}${zr.KEYS.COMP_CONFIG_FILENAME}`)));if(St){const On=await Er.promises.readFile(St.absolutePath,"utf8");const rr=JSON.parse(On);const{name:ir}=rr;if(Xr===ir){await jr.copy(ii,Pr);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const oi=Wr.map((St=>{const On=Sr.join(qr,ur,St.path);return{path:On.replace(/[/\\]/g,"/")}}));const ai=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(ai,oi,Lr);const pi=Sr.join(Lr,qr,ur);await jr.copy(pi,Pr)}async getLocalCompsByIds(St){const{srcPath:On}=this.configService.comphubConfig();const rr=await this.findCompJsonPath(On);this.ctx.logger.debug("组件文件数量:",rr.length);const ir=rr.map((async({absolutePath:St})=>{const On=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(On);return{...rr,path:Sr.dirname(St)}}));const cr=await Promise.all(ir);const ur=cr.filter((On=>St.includes(On[zr.KEYS.COMP_FIELD_COMP_ID])));if(!ur){return[]}const pr=zr.KEYS.FILE_MANAGER_DIRNAME;const fr=new RegExp(qr.textKit.escapeRegExp(Sr.sep),"g");const br=ur.map((St=>{const rr=St.path.replace(On,"").replace(fr,"/").slice(1);return{id:St[zr.KEYS.COMP_FIELD_COMP_ID],path:pr+rr,fullPath:St.path,fullPathHash:Ur.digest.getStringHash(St.path),basename:Sr.basename(St.path)}}));return br}async getPackageJsonContent(){const St=this.configService.comphubConfig();const On=Sr.join(St.cwd,"package.json");return await Ur.fileSys.readJsonFile(On)}async getLocalComps(St){const{page:On=1,pageSize:rr=10}=St;const{srcPath:ir}=this.configService.comphubConfig();const cr=await this.getAllLocalCompIds();const ur=cr.map((St=>({id:St.compjson[zr.KEYS.COMP_FIELD_COMP_ID],pathHash:St.pathHash})));ur.sort(((St,On)=>St.id.localeCompare(On.id)));const pr=[...new Set(ur.map((St=>St.id)))];const fr=await Kr.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:pr});const{ids:Er=[]}=fr.data;const kr=ur.filter((St=>Er.includes(St.id)));const Pr=kr.length;const Ir=kr.slice((On-1)*rr,On*rr);const Lr=new Map(cr.map((St=>[`${St.compjson[zr.KEYS.COMP_FIELD_COMP_ID]}_${St.pathHash}`,St])));const Br=await Kr.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Ir.map((St=>St.id))});const{rows:jr=[]}=Br.data;const Vr=new Map(jr.map((St=>[St._id,St])));const Wr=new RegExp(qr.textKit.escapeRegExp(Sr.sep),"g");const Xr=zr.KEYS.FILE_MANAGER_DIRNAME;const Yr=Ir.map((async({id:St,pathHash:On})=>{const rr=Lr.get(`${St}_${On}`);const cr=Vr.get(St);if(!cr||!rr){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[St]}))}const ur=rr.compPath.replace(ir,"").replace(Wr,"/").slice(1);return{_id:Ur.digest.getStringHash(rr.compPath),name:cr.name,compId:St,version:rr.compjson.version,path:Xr+ur,previewConfigs:cr.previewConfigs,bgColor:cr.bgColor,fullPath:rr.compPath}}));const ii=await Promise.all(Yr);return{total:Pr,page:On,pageSize:rr,rows:ii}}async getLocalCompDetailByPathHash(St){const{fullPathHash:On}=St;const rr=await this.getAllLocalCompIds();const ir=rr.find((St=>St.pathHash===On));if(!ir){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[On]}))}const{srcPath:cr}=this.configService.comphubConfig();const ur=ir.compjson[zr.KEYS.COMP_FIELD_COMP_ID];const{version:pr}=ir.compjson;const fr=await Kr.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[ur]});const{rows:Er=[]}=fr.data;const kr=Er[0];const Pr=new RegExp(qr.textKit.escapeRegExp(Sr.sep),"g");const Ir=zr.KEYS.FILE_MANAGER_DIRNAME;const Lr=ir.compPath.replace(cr,"").replace(Pr,"/").slice(1);return{_id:On,name:kr.name,compId:ur,version:pr,path:Ir+Lr,previewConfigs:kr.previewConfigs,bgColor:kr.bgColor,fullPath:ir.compPath}}async openCompPathInVscode(St){const{folderPath:On,relativeFilePath:rr}=St;await this.commandService.revealInVSCode(On,rr)}async openCompPathInExplorer(St){const{folderPath:On,relativeFilePath:rr}=St;await this.commandService.revealInExplorer(On,rr)}async writeCompFile(St){const{compPath:On,filename:rr,content:ir}=St;const cr=this.getCompFullPath(On);const ur=Sr.join(cr,rr);Er.writeFileSync(ur,Buffer.from(ir,"base64"))}async renameCompDir(St){const{compPath:On,newName:rr}=St;if(!qr.textKit.validateCompName(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[rr]}))}const ir=this.getCompFullPath(On);const cr=Sr.basename(ir);if(cr===rr)return;const ur=Sr.dirname(ir);const pr=Sr.join(ur,rr);if(Er.existsSync(pr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[rr]}))}await Er.promises.rename(ir,pr)}};On.CompService=Yr;ur([(0,br.App)(),fr("design:type",Object)],Yr.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",kr.ConfigService)],Yr.prototype,"configService",void 0);ur([(0,br.Inject)(),fr("design:type",Lr.OssService)],Yr.prototype,"ossService",void 0);ur([(0,br.Inject)(),fr("design:type",Wr.CommandService)],Yr.prototype,"commandService",void 0);ur([(0,br.Inject)(),fr("design:type",Pr.DepsService)],Yr.prototype,"depsService",void 0);ur([(0,br.Inject)(),fr("design:type",Ir.ModuleService)],Yr.prototype,"moduleService",void 0);ur([(0,br.Inject)(),fr("design:type",Object)],Yr.prototype,"ctx",void 0);ur([(0,br.Inject)(),fr("design:type",Xr.MidwayI18nService)],Yr.prototype,"i18nService",void 0);On.CompService=Yr=ur([(0,br.Provide)()],Yr)},63366:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ConfigService=void 0;const br=rr(46123);const Sr=rr(26815);const Er=pr(rr(16928));let kr=class ConfigService{comphubConfig(){const St=this.app.getAttr(Sr.KEYS.COMPHUB_CONFIG_KEY);return St}getGlobalConfig(){const St=this.comphubConfig();const{cwd:On,srcPath:rr,version:ir,allowDebug:cr,subPort:ur,projectHash:pr}=St;return{cwd:On,srcPath:rr,sep:Er.sep,version:ir,allowDebug:cr,subPort:ur,projectHash:pr}}};On.ConfigService=kr;ur([(0,br.App)(),fr("design:type",Object)],kr.prototype,"app",void 0);On.ConfigService=kr=ur([(0,br.Provide)()],kr)},23086:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.DepsService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(64713);const Pr=rr(87518);const Ir=rr(18801);const Lr=rr(26815);const Br=rr(63366);const jr=rr(58953);let Ur=class DepsService{async getModuleEntry(St,On){const rr=await Pr.fileSys.readJsonFile(Sr.join(On,"package.json"));if(!rr){this.ctx.logger.error("未找到 package.json 文件");return[]}const ir=Pr.resolver.findDependencyVersion(rr,"vue");const cr=Pr.resolver.findDependencyVersion(rr,"react");const ur=await Pr.depGraph.detectImports(St,{pathAliases:["@"]});if(ir&&cr){throw new br.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(ir){ur.vue={version:ir}}if(cr){ur.react={version:cr};const St=Pr.resolver.findDependencyVersion(rr,"react-dom");if(St){const On=Number(Ir.versionKit.getMajorVersion(cr));if(On>=18){ur["react-dom/client"]={version:St}}else{ur["react-dom"]={version:St}}}}const pr={};for(const[St]of Object.entries(ur)){const ir=Pr.resolver.findDependencyVersion(rr,St);const cr={version:ir};const ur=await Pr.resolver.findOwningPackage(St,On);if(ur){cr.version=ur.version;if(!ir){cr.parent={name:ur.name,version:ur.version}}}pr[St]=cr}return Object.entries(pr).map((([St,On])=>({name:St,version:On.version,...On.parent&&{parent:On.parent}})))}async buildTemplateCompiler(St,On,rr){const ir=Sr.join(On,"node_modules","vue-template-compiler","package.json");let cr;try{const On=JSON.parse(await Er.promises.readFile(ir,"utf-8"));cr=On.version;this.ctx.logger.info(`[buildTemplateCompiler] 找到 vue-template-compiler@${cr},Vue 版本: ${St}`)}catch{throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${St}`)}const[ur,pr]=St.split(".").map(Number);const[fr,br]=(cr||"").split(".").map(Number);if(ur!==fr||pr!==br){this.ctx.logger.warn(`[buildTemplateCompiler] 版本不完全匹配: vue@${St} vs vue-template-compiler@${cr},`+`建议安装匹配版本: npm install vue-template-compiler@${St}`)}const Pr=`export * from 'vue-template-compiler';`;const Ir=Sr.join(rr,"__compiler_entry__.js");await Er.promises.mkdir(rr,{recursive:true});await Er.promises.writeFile(Ir,Pr);const Lr=`vue2-template-compiler-${St.replace(/\./g,"_")}.js`;const Br=Sr.join(rr,Lr);try{await(0,kr.build)({entryPoints:[Ir],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:Br,platform:"browser",target:"es2015",absWorkingDir:On,nodePaths:[Sr.join(On,"node_modules")],external:[],sourcemap:false,minify:false});this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Lr}`)}catch(St){await Er.promises.unlink(Ir).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${St.message}`)}await Er.promises.unlink(Ir).catch((()=>{}));return{fileName:Lr}}async precompileModule(St,On,rr){const ir=await Pr.fileSys.readJsonFile(Sr.join(rr,"package.json"));if(!ir){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{},chunkFiles:[]}}const{entryPoints:cr,entryKeyToDepName:ur,skippedDeps:pr}=await(0,jr.buildEntryPoints)(On,ir,rr);const{entryPoints:fr,mergedPackages:br}=(0,jr.mergeSubPathEntries)(cr);for(const[,On]of Object.entries(br)){const rr=(0,jr.generateMergedWrapper)(On.subExportMap);const ir=Sr.join(St,`${On.entryKey}.js`);fr[On.entryKey]=ir;await Er.promises.mkdir(Sr.dirname(ir),{recursive:true});await Er.promises.writeFile(ir,rr)}await Er.promises.mkdir(St,{recursive:true});const Ir={};for(const[St,On]of Object.entries(fr)){const ir=ur[St]??St;if(St.startsWith("__merged__")||Pr.resolver.isModuleInstalled(ir,rr)){Ir[St]=On}else{pr.push(ir)}}const Br={};const Ur=Sr.join(St,Lr.KEYS.META_FILE_NAME);const Vr=await Pr.fileSys.readJsonFile(Ur);const{filteredEntryPoints:Wr,cachedMappings:zr}=(0,jr.filterCachedModules)(Ir,Vr);for(const[,On]of Object.entries(br)){const rr=On.entryKey;if(Vr?.[rr]){const ir=Vr[rr].file;for(const rr of On.wrapperSubPaths){const cr=On.subExportMap[rr];const ur=(0,jr.getSubWrapperFileName)(cr,ir);const pr=Sr.join(St,ur);if(!Er.existsSync(pr)){await Er.promises.writeFile(pr,(0,jr.generateSubWrapper)(cr,ir))}zr[rr]=ur}zr[rr]=ir}}Object.assign(Br,zr);if(Object.keys(Wr).length===0){const St=this.resolveChunkFiles(Br,Vr);const ir=this.restoreEntryNames(Br,ur);this.warnMissingDeps(On,ir,pr,rr);return{entryNameToFile:ir,chunkFiles:St}}const qr={entryPoints:Wr,bundle:true,format:"esm",splitting:true,outdir:St,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:rr,nodePaths:[Sr.join(rr,"node_modules")]};const Kr=await(0,kr.build)(qr);const{optimized:Xr,entryNameToFile:Yr}=(0,jr.analyzeBuildOutputs)(Kr,Wr,St);for(const[,On]of Object.entries(br)){const rr=On.entryKey;if(!(rr in Wr))continue;const ir=Yr[rr];if(!ir)continue;for(const rr of On.wrapperSubPaths){const cr=On.subExportMap[rr];const ur=(0,jr.getSubWrapperFileName)(cr,ir);const pr=Sr.join(St,ur);await Er.promises.writeFile(pr,(0,jr.generateSubWrapper)(cr,ir));Yr[rr]=ur}}const ii={...Vr,...Xr};await(0,jr.saveBuildMetadata)(Ur,ii);const oi={...Br,...Yr};const ai=this.resolveChunkFiles(oi,ii);const pi=this.restoreEntryNames(oi,ur);this.warnMissingDeps(On,pi,pr,rr);return{entryNameToFile:pi,chunkFiles:ai}}warnMissingDeps(St,On,rr,ir){const cr=St.filter((St=>!(St in On)));if(!cr.length)return;const ur=cr.filter((St=>!rr.includes(St)));const pr=ur.length?`;其中 ${ur.join(", ")} 并非因「未安装」被过滤,需查入口构建 / 缓存 / esbuild 产出匹配环节`:";均因「未安装」被过滤";this.ctx.logger.warn(`[precompileModule] 请求了但未产出映射: ${cr.join(", ")}${pr}(cwd=${ir})`)}restoreEntryNames(St,On){for(const[rr,ir]of Object.entries(St)){const cr=On[rr];if(cr&&cr!==rr){St[cr]=ir;delete St[rr]}}return St}resolveChunkFiles(St,On){const rr=new Set(Object.values(St));const ir=new Set;for(const[cr]of Object.entries(St)){const St=On?.[cr]?.chunkFiles;if(!St?.length)continue;for(const On of St){if(!rr.has(On))ir.add(On)}}return Array.from(ir)}};On.DepsService=Ur;ur([(0,br.App)(),fr("design:type",Object)],Ur.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",Object)],Ur.prototype,"ctx",void 0);ur([(0,br.Inject)(),fr("design:type",Br.ConfigService)],Ur.prototype,"configService",void 0);On.DepsService=Ur=ur([(0,br.Provide)()],Ur)},85984:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ModuleService=void 0;const br=rr(46123);const Sr=rr(63366);const Er=rr(23086);const kr=pr(rr(16928));const Pr=rr(87518);const Ir=pr(rr(79896));const Lr=rr(26815);let Br=class ModuleService{async getPreBuildModuleDir(){const{cwd:St}=this.configService.comphubConfig();const On=kr.join(St,Lr.KEYS.PREBUILD_MODULE_DIR);await Ir.promises.mkdir(On,{recursive:true});return On}async preBuild(St){const On=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.precompileModule(On,St,rr)}async buildTemplateCompiler(St){const On=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(St,rr,On)}async preBuildSize(){const St=await this.getPreBuildModuleDir();return await Pr.fileSys.dirSize(St)}async clearPreBuild(){const St=await this.getPreBuildModuleDir();await Ir.promises.rm(St,{recursive:true,force:true})}};On.ModuleService=Br;ur([(0,br.Inject)(),fr("design:type",Sr.ConfigService)],Br.prototype,"configService",void 0);ur([(0,br.Inject)(),fr("design:type",Er.DepsService)],Br.prototype,"depsService",void 0);ur([(0,br.App)(),fr("design:type",Object)],Br.prototype,"app",void 0);On.ModuleService=Br=ur([(0,br.Provide)()],Br)},80799:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.OssService=void 0;const Sr=rr(46123);const Er=br(rr(54504));const kr=br(rr(12593));const Pr=br(rr(18451));const Ir=pr(rr(16928));const Lr=pr(rr(79896));const Br=rr(96955);const jr=rr(4990);const Ur=br(rr(23046));const Vr=rr(45853);const Wr=rr(26815);const zr=rr(68255);let qr=class OssService{createOssClient(St){const On={endpoint:Wr.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...St};return new Pr.default(On)}getContentTypeWithCharset(St){const On=Ir.extname(St).toLowerCase();const rr={".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 rr[On]}createOssFormData(St,On,rr=false){const ir=new Er.default;const cr=St.dir+St.key;ir.append("success_action_status","200");ir.append("policy",St.policy);ir.append("x-oss-signature",St.signature);ir.append("x-oss-signature-version",St.x_oss_signature_version);ir.append("x-oss-credential",St.x_oss_credential);ir.append("x-oss-date",St.x_oss_date);ir.append("key",cr);ir.append("x-oss-security-token",St.security_token);ir.append("x-oss-forbid-overwrite",rr?"false":"true");ir.append("Cache-Control","public, max-age=31536000");const ur={};const pr=On.path?.toString();if(pr){const St=this.getContentTypeWithCharset(pr);if(St){ur.contentType=St}}ir.append("file",On,ur);return{host:St.host,filePath:cr,formData:ir}}async getDownloadSts(){const St=await this.cache.get(Wr.KEYS.CACHE_KEY_STS_TOKEN);if(St){return St}const On=await jr.remoteApi.v1Oss.osscontrollerGetsts();const rr=new Date(On.data.Expiration).getTime()-1*60*1e3;const ir=rr-Date.now();this.ctx.logger.debug("STS过期时间",(0,Ur.default)(rr).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(Wr.KEYS.CACHE_KEY_STS_TOKEN,On.data,ir);return On.data}async uploadFileToOss(St,On,rr=false){const{host:ir,formData:cr}=this.createOssFormData(St,On,rr);const ur=await kr.default.post(ir,cr,{headers:{...cr.getHeaders()}}).catch((async St=>{const On=St.response.data;const rr=await(0,Vr.parseStringPromise)(On);if(rr?.Error){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.Error.Message]}))}throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[St.message||St]}))}));if(ur.status!==200){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[ur.data]}))}}async downloadFileToPath(St,On,rr){const ir=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});const cr=On.map((async St=>{const{path:On}=St;const cr=Ir.join(rr,On);const ur=Ir.dirname(cr);if(!Lr.existsSync(ur)){Lr.mkdirSync(ur,{recursive:true})}return await ir.get(On,cr)}));return await Promise.all(cr)}};On.OssService=qr;ur([(0,Sr.Inject)(),fr("design:type",Object)],qr.prototype,"ctx",void 0);ur([(0,Sr.InjectClient)(Br.CachingFactory,"default"),fr("design:type",Object)],qr.prototype,"cache",void 0);ur([(0,Sr.Inject)(),fr("design:type",zr.MidwayI18nService)],qr.prototype,"i18nService",void 0);On.OssService=qr=ur([(0,Sr.Provide)()],qr)},61275:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.QueueService=void 0;const cr=rr(46123);let ur=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const St=this.queue.shift();if(St){await St()}this.isProcessing=false;this.processQueue()}async enqueue(St){return new Promise((On=>{this.queue.push((async()=>{try{await St()}finally{On()}}));this.processQueue()}))}};On.QueueService=ur;On.QueueService=ur=ir([(0,cr.Provide)(),(0,cr.Scope)(cr.ScopeEnum.Singleton)],ur)},19452:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.TerminalService=void 0;const Sr=rr(46123);const Er=rr(35317);const kr=rr(63366);const Pr=pr(rr(1999));const Ir=rr(73024);const Lr=rr(51455);const Br=rr(87518);const jr=br(rr(44644));let Ur=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(St){if(!St||St.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(St);return Pr.decode(St,"utf-8")}catch{return Pr.decode(St,"gbk")}}async folderExists(St){try{await(0,Lr.access)(St,Ir.constants.F_OK|Ir.constants.R_OK);return true}catch{return false}}async shutdown(St=5e3){const On=this.subprocess;if(!On||On.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((rr=>{let ir=false;const done=()=>{if(!ir){ir=true;rr(0)}};On.once("exit",done);(0,jr.default)(On.pid,"SIGTERM",(St=>{if(St){this.ctx.emit("output",{err:St.message})}}));const cr=setTimeout((()=>{(0,jr.default)(On.pid,"SIGKILL",(St=>{if(St){this.ctx.emit("output",{err:St.message})}done()}))}),St);On.once("exit",(()=>clearTimeout(cr)))}))}async execCmd({cwd:St,oldCwd:On,command:rr}){if(!await this.folderExists(St)){this.ctx.emit("output",{err:`${St} 路径不存在`});this.ctx.emit("output",{cwd:On});return}this.cwd=St;if(!rr.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(rr==="^C"){await this.shutdown();return}this.subprocess=(0,Er.spawn)(rr,{shell:true,cwd:St,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",(St=>{this.ctx.emit("output",{stdout:this.smartDecode(St)})}));this.subprocess.stderr?.on("data",(St=>{this.ctx.emit("output",{stderr:this.smartDecode(St)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:rr})}));this.subprocess.on("error",(St=>{this.ctx.emit("output",{err:St.message})}))}async cmdTab({cwd:St,lastWord:On}){let rr=await Br.fileSys.readDirFiles(St);if(On){rr=rr.filter((St=>St.name.startsWith(On)))}if(rr.length===0){return}this.tabIndex=(this.tabIndex+1)%rr.length;const ir=rr[this.tabIndex];this.ctx.emit("output",{tab:ir.name})}};On.TerminalService=Ur;ur([(0,Sr.Inject)(),fr("design:type",kr.ConfigService)],Ur.prototype,"configService",void 0);ur([(0,Sr.Inject)(),fr("design:type",Object)],Ur.prototype,"ctx",void 0);On.TerminalService=Ur=ur([(0,Sr.Provide)()],Ur)},5808:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.VuefinderService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(63366);const Pr=pr(rr(93900));const Ir=rr(26815);let Lr=class VuefinderService{async list({path:St}){const On=this.configService.comphubConfig();const{srcPath:rr}=On;const ir=St?.replace(Ir.KEYS.FILE_MANAGER_DIRNAME,"")||"";let cr=Sr.join(rr,ir);const ur=await Er.promises.access(cr).then((()=>true)).catch((()=>false));if(!ur){cr=rr;St=Ir.KEYS.FILE_MANAGER_DIRNAME}const pr=await Er.promises.readdir(cr);const fr=pr.map((async On=>{const rr=Sr.join(cr,On);const ir=await Er.promises.stat(rr);const ur=ir.isDirectory();const pr=St===Ir.KEYS.FILE_MANAGER_DIRNAME?`${St}${On}`:`${St}/${On}`;return{type:ur?"dir":"file",path:pr,file_size:ir.size,visibility:"public",last_modified:Math.floor(ir.mtimeMs/1e3),basename:On,extension:ur?"":Sr.extname(On).slice(1),mime_type:Pr.lookup(On)||""}}));const br=await Promise.all(fr);br.sort(((St,On)=>{if(St.type==="dir"&&On.type==="file"){return-1}else if(St.type==="file"&&On.type==="dir"){return 1}else{return 0}}));return{storages:pr,dirname:St,files:br}}};On.VuefinderService=Lr;ur([(0,br.App)(),fr("design:type",Object)],Lr.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",kr.ConfigService)],Lr.prototype,"configService",void 0);On.VuefinderService=Lr=ur([(0,br.Provide)()],Lr)},66593:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.TerminalSocketController=void 0;const ur=rr(46123);const pr=rr(19452);let fr=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(St){this.terminalService.execCmd(St)}async onTab(St){this.terminalService.cmdTab(St)}};On.TerminalSocketController=fr;ir([(0,ur.Inject)(),cr("design:type",Object)],fr.prototype,"ctx",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.TerminalService)],fr.prototype,"terminalService",void 0);ir([(0,ur.OnWSConnection)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"onConnection",null);ir([(0,ur.OnWSDisConnection)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"onDisConnection",null);ir([(0,ur.OnWSMessage)("command"),cr("design:type",Function),cr("design:paramtypes",[Object]),cr("design:returntype",Promise)],fr.prototype,"onCommand",null);ir([(0,ur.OnWSMessage)("tab"),cr("design:type",Function),cr("design:paramtypes",[Object]),cr("design:returntype",Promise)],fr.prototype,"onTab",null);On.TerminalSocketController=fr=ir([(0,ur.WSController)("/terminal")],fr)},58953:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();Object.defineProperty(On,"__esModule",{value:true});On.analyzeBuildOutputs=analyzeBuildOutputs;On.saveBuildMetadata=saveBuildMetadata;On.filterCachedModules=filterCachedModules;On.toSafeEntryKey=toSafeEntryKey;On.buildEntryPoints=buildEntryPoints;On.mergeSubPathEntries=mergeSubPathEntries;On.generateMergedWrapper=generateMergedWrapper;On.generateSubWrapper=generateSubWrapper;On.getSubWrapperFileName=getSubWrapperFileName;const pr=ur(rr(16928));const fr=ur(rr(79896));const br=rr(87518);const Sr=rr(18801);const Er=rr(26815);function resolveModuleEntry(St,On){if(St!=="vue")return St;const rr=Sr.versionKit.getMajorVersion(On);return rr==="3"?Er.KEYS.VUE_ESM_BUNDLER:St}function extractModuleName(St){const On=pr.extname(St);const rr=pr.basename(St,On);return rr.replace(/-[A-Za-z0-9_-]{8}$/,"")}function matchEntryKey(St,On){return St.find((St=>{const rr=St.split("/");const ir=rr[rr.length-1];return On===ir}))}function analyzeBuildOutputs(St,On,rr){const ir={};const cr={};const ur=Object.keys(On);const Sr=St.metafile?.outputs??{};const Er=new Set(Object.keys(Sr).map((St=>pr.basename(St))));for(const[St,On]of Object.entries(Sr)){const Sr=pr.basename(St);if(!On.entryPoint)continue;const kr=extractModuleName(St);const Pr=matchEntryKey(ur,kr);if(!Pr)continue;cr[Pr]=Sr;const Ir=pr.join(rr,Sr);const Lr=fr.readFileSync(Ir,"utf-8");const Br=br.digest.getStringHash(Lr).slice(0,8);ir[Pr]={src:On.entryPoint,file:Sr,fileHash:Br,needsInterop:false,chunkFiles:(On.imports??[]).map((St=>pr.basename(St.path))).filter((St=>St&&Er.has(St)&&St!==Sr))}}return{optimized:ir,entryNameToFile:cr}}async function saveBuildMetadata(St,On){await fr.promises.writeFile(St,JSON.stringify(On,null,2))}function filterCachedModules(St,On){if(!On){return{filteredEntryPoints:St,cachedMappings:{}}}const rr={};const ir={};for(const[cr,ur]of Object.entries(St)){if(On[cr]){ir[cr]=On[cr].file}else{rr[cr]=ur}}return{filteredEntryPoints:rr,cachedMappings:ir}}function toSafeEntryKey(St){if(St.startsWith("@")){const On=St.split("/");if(On.length===2&&!pr.extname(On[1])){return`__${On[0].slice(1)}_${On[1]}`}}if(St.includes("/")){return St.replace(/\//g,"_")}return St}async function buildEntryPoints(St,On,rr){const ir={};const cr={};const ur=[];for(const pr of St){const St=br.resolver.findDependencyVersion(On,pr);if(!St){const St=await br.resolver.findOwningPackage(pr,rr);if(!St){ur.push(pr);continue}}const fr=toSafeEntryKey(pr);ir[fr]=resolveModuleEntry(pr,St);cr[fr]=pr}return{entryPoints:ir,entryKeyToDepName:cr,skippedDeps:ur}}function extractPackageName(St){if(St.startsWith("@")){const On=St.split("/");return On.slice(0,2).join("/")}return St.split("/")[0]}function toSafeIdentifier(St){return St.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(St){const On={};const rr={};for(const[ir,cr]of Object.entries(St)){const St=extractPackageName(ir);if(ir!==St){const ur=!/\.(js|ts|jsx|tsx|mjs|cjs)$/.test(ir);if(ur){rr[ir]=cr;continue}if(!On[St])On[St]={};On[St][ir]=cr}else{rr[ir]=cr}}const ir={};for(const[St,cr]of Object.entries(On)){const On=Object.keys(cr);if(On.length<=1){Object.assign(rr,cr);continue}const ur=br.digest.getStringHash(On.slice().sort().join("|")).slice(0,8);const pr=`__merged__${St}-${ur}`;const fr={};const Sr=[];for(const St of Object.keys(cr)){const On=toSafeIdentifier(St);fr[St]=On;Sr.push(St)}rr[pr]=pr;ir[St]={entryKey:pr,subExportMap:fr,wrapperSubPaths:Sr}}return{entryPoints:rr,mergedPackages:ir}}function generateMergedWrapper(St){const On=[];const rr=[];const ir=[];const cr=new Set;for(const[ur,pr]of Object.entries(St)){if(cr.has(pr))continue;cr.add(pr);const St=`__imp_${pr}`;On.push(`import * as ${St} from '${ur}';`);rr.push(`export const ${pr} = ${St}.default || Object.assign({}, ${St});`);ir.push(`export * from '${ur}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...On,...rr,...ir,""].join("\n")}function generateSubWrapper(St,On){return[`// Auto-generated: sub-wrapper for ${St}`,`export { ${St} as default } from './${On}';`,`export * from './${On}';`,""].join("\n")}function getSubWrapperFileName(St,On){const rr=pr.basename(On,pr.extname(On));return`${St}-w-${rr}.js`}},49969:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getErrorMessage=getErrorMessage;function getErrorMessage(St){if(St instanceof Error)return St.message;if(typeof St==="string")return St;return String(St)}},4145:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.waitForIpcConfig=waitForIpcConfig;const cr=ir(rr(16928));const ur=rr(26815);function parseCwdArg(St){for(let On=0;On<St.length;On++){if(St[On]==="--cwd"&&On+1<St.length){return St[On+1]}if(St[On].startsWith("--cwd=")){return St[On].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const St=parseCwdArg(process.argv);if(St){return Promise.resolve({type:"config",port:0,cwd:cr.default.resolve(St),allowDebug:process.env.MIDWAY_SERVER_ENV===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((St,On)=>{const rr=setTimeout((()=>{On(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(On=>{if(On?.type==="config"){clearTimeout(rr);St(On)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},10778:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.remoteInstance=On.setHeader=void 0;const cr=rr(42552);const ur=rr(26815);const pr=ir(rr(65692));const fr=(0,cr.initInstance)(ur.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new pr.default.Agent({rejectUnauthorized:false})},(St=>St.replace(ur.KEYS.REMOTE_SERVICE_PREFIX,"")));On.remoteInstance=fr;let br=null;const setHeader=St=>{br=St};On.setHeader=setHeader;fr.interceptors.request.use((St=>{St.headers[ur.KEYS.AUTHORIZATION_HEADER_NAME]=br[ur.KEYS.AUTHORIZATION_HEADER_NAME];St.headers[ur.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=br[ur.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];St.headers["cookie"]=br.cookie;return St}),(St=>Promise.reject(St)));fr.interceptors.response.use((async St=>{if(St.data.code!==0){throw new Error(JSON.stringify(St.data))}return St.data}),(St=>Promise.reject(St)))},67872:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.createKoaProxy=createKoaProxy;const cr=ir(rr(58611));const ur=rr(31855);const pr=new cr.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const fr=new Map;function getOrCreateSubProxy(St,On){const rr=`${St}|${JSON.stringify(On)}`;if(!fr.has(rr)){fr.set(rr,(0,ur.createProxyMiddleware)({target:St,changeOrigin:true,secure:false,agent:pr,pathRewrite:On,on:{error:St=>{}}}))}return fr.get(rr)}async function createKoaProxy(St,On,rr){const ir=getOrCreateSubProxy(On,rr);return new Promise(((On,rr)=>{St.res.on("finish",On);St.res.on("close",On);St.res.on("error",rr);ir(St.req,St.res,(St=>{if(St)rr(St);else On()}))}))}},101:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.PackageJsonVO=On.LocalCompDetailVO=On.LocalCompsVO=On.CompFileHashVO=On.CompSimilarListVO=On.DownloadCompVO=On.LocalCompsByIdsVO=On.ImportScanResultVO=On.CompCheckVO=On.CompFileContentVO=On.CompFileVO=On.CompSimilarListItemVO=On.FileNode=void 0;const ur=rr(49179);const pr=rr(26815);class FileNode{}On.FileNode=FileNode;ir([(0,ur.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),cr("design:type",String)],FileNode.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),cr("design:type",String)],FileNode.prototype,"path",void 0);ir([(0,ur.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:pr.ENUM.FileType}),cr("design:type",String)],FileNode.prototype,"type",void 0);ir([(0,ur.ApiProperty)({description:"子节点",type:[FileNode]}),cr("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}On.CompSimilarListItemVO=CompSimilarListItemVO;ir([(0,ur.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),cr("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),cr("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}On.CompFileVO=CompFileVO;ir([(0,ur.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),cr("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);ir([(0,ur.ApiProperty)({type:[String],description:"组件文件列表",required:true}),cr("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}On.CompFileContentVO=CompFileContentVO;ir([(0,ur.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),cr("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}On.CompCheckVO=CompCheckVO;ir([(0,ur.ApiProperty)({description:"组件入口文件路径",required:false}),cr("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);ir([(0,ur.ApiProperty)({description:"组件配置文件路径",required:false}),cr("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);ir([(0,ur.ApiProperty)({description:"异常结果内容",required:true}),cr("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}ir([(0,ur.ApiProperty)({description:"父库名称",required:true,example:"vue"}),cr("design:type",String)],ParentVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),cr("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}ir([(0,ur.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),cr("design:type",String)],ImportDetailVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),cr("design:type",String)],ImportDetailVO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),cr("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}On.ImportScanResultVO=ImportScanResultVO;ir([(0,ur.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),cr("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}ir([(0,ur.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),cr("design:type",String)],CompInfoVO.prototype,"id",void 0);ir([(0,ur.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),cr("design:type",String)],CompInfoVO.prototype,"path",void 0);ir([(0,ur.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),cr("design:type",String)],CompInfoVO.prototype,"basename",void 0);ir([(0,ur.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),cr("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),cr("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}On.LocalCompsByIdsVO=LocalCompsByIdsVO;ir([(0,ur.ApiProperty)({type:[CompInfoVO],required:true}),cr("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}On.DownloadCompVO=DownloadCompVO;ir([(0,ur.ApiProperty)({description:"组件是否重复",example:true,required:true}),cr("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class CompSimilarListVO{}On.CompSimilarListVO=CompSimilarListVO;ir([(0,ur.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),cr("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}On.CompFileHashVO=CompFileHashVO;ir([(0,ur.ApiProperty)({example:"123",description:"组件哈希值",required:true}),cr("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}ir([(0,ur.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),cr("design:type",String)],PreviewItem.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),cr("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),cr("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),cr("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}On.LocalCompsVO=LocalCompsVO;ir([(0,ur.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"compId",void 0);ir([(0,ur.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:[PreviewItem],required:true}),cr("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);ir([(0,ur.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"path",void 0);ir([(0,ur.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),cr("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}On.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}On.PackageJsonVO=PackageJsonVO;ir([(0,ur.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),cr("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BuildTemplateCompilerVO=On.PreBuildSizeVO=On.PreBuildVO=void 0;const ur=rr(49179);class PreBuildVO{}On.PreBuildVO=PreBuildVO;ir([(0,ur.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),cr("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);ir([(0,ur.ApiProperty)({description:"esbuild code-splitting 生成的公共 chunk 文件列表,上传 OSS 时需要一并上传",required:false,example:["chunk-26KRECMG.js","chunk-3AE7QCN7.js"]}),cr("design:type",Array)],PreBuildVO.prototype,"chunkFiles",void 0);class PreBuildSizeVO{}On.PreBuildSizeVO=PreBuildSizeVO;ir([(0,ur.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),cr("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}On.BuildTemplateCompilerVO=BuildTemplateCompilerVO;ir([(0,ur.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名,通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_6_14.js"}),cr("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},15798:(St,On)=>{"use strict";const rr={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};On.parse=function(St,...ir){const cr=typeof ir[0]==="object"&&ir[0];const ur=ir.length>1||!cr?ir[0]:undefined;const pr=ir.length>1&&ir[1]||cr||{};const fr=JSON.parse(St,ur);if(pr.protoAction==="ignore"){return fr}if(!fr||typeof fr!=="object"){return fr}if(!St.match(rr.suspectRx)){return fr}On.scan(fr,pr);return fr};On.scan=function(St,On={}){let rr=[St];while(rr.length){const St=rr;rr=[];for(const ir of St){if(Object.prototype.hasOwnProperty.call(ir,"__proto__")){if(On.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete ir.__proto__}for(const St in ir){const On=ir[St];if(On&&typeof On==="object"){rr.push(ir[St])}}}}};On.safeParse=function(St,rr){try{return On.parse(St,rr)}catch(St){return null}}},35522:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(43700);const ur=rr(66621);const pr=rr(69322);const fr={};St.exports=function(St,On,rr={}){ir(St&&typeof St==="object","Invalid defaults value: must be an object");ir(!On||On===true||typeof On==="object","Invalid source value: must be true, falsy or an object");ir(typeof rr==="object","Invalid options: must be an object");if(!On){return null}if(rr.shallow){return fr.applyToDefaultsWithShallow(St,On,rr)}const pr=cr(St);if(On===true){return pr}const br=rr.nullOverride!==undefined?rr.nullOverride:false;return ur(pr,On,{nullOverride:br,mergeArrays:false})};fr.applyToDefaultsWithShallow=function(St,On,rr){const br=rr.shallow;ir(Array.isArray(br),"Invalid keys");const Sr=new Map;const Er=On===true?null:new Set;for(let rr of br){rr=Array.isArray(rr)?rr:rr.split(".");const ir=pr(St,rr);if(ir&&typeof ir==="object"){Sr.set(ir,Er&&pr(On,rr)||ir)}else if(Er){Er.add(rr)}}const kr=cr(St,{},Sr);if(!Er){return kr}for(const St of Er){fr.reachCopy(kr,On,St)}const Pr=rr.nullOverride!==undefined?rr.nullOverride:false;return ur(kr,On,{nullOverride:Pr,mergeArrays:false})};fr.reachCopy=function(St,On,rr){for(const St of rr){if(!(St in On)){return}const rr=On[St];if(typeof rr!=="object"||rr===null){return}On=rr}const ir=On;let cr=St;for(let St=0;St<rr.length-1;++St){const On=rr[St];if(typeof cr[On]!=="object"){cr[On]={}}cr=cr[On]}cr[rr[rr.length-1]]=ir}},99583:(St,On,rr)=>{"use strict";const ir=rr(16443);const cr={};St.exports=function(St,...On){if(St){return}if(On.length===1&&On[0]instanceof Error){throw On[0]}throw new ir(On)}},43700:(St,On,rr)=>{"use strict";const ir=rr(69322);const cr=rr(99704);const ur=rr(87492);const pr={needsProtoHack:new Set([cr.set,cr.map,cr.weakSet,cr.weakMap])};St.exports=pr.clone=function(St,On={},rr=null){if(typeof St!=="object"||St===null){return St}let ir=pr.clone;let fr=rr;if(On.shallow){if(On.shallow!==true){return pr.cloneWithShallow(St,On)}ir=St=>St}else if(fr){const On=fr.get(St);if(On){return On}}else{fr=new Map}const br=cr.getInternalProto(St);if(br===cr.buffer){return Buffer&&Buffer.from(St)}if(br===cr.date){return new Date(St.getTime())}if(br===cr.regex){return new RegExp(St)}const Sr=pr.base(St,br,On);if(Sr===St){return St}if(fr){fr.set(St,Sr)}if(br===cr.set){for(const rr of St){Sr.add(ir(rr,On,fr))}}else if(br===cr.map){for(const[rr,cr]of St){Sr.set(rr,ir(cr,On,fr))}}const Er=ur.keys(St,On);for(const rr of Er){if(rr==="__proto__"){continue}if(br===cr.array&&rr==="length"){Sr.length=St.length;continue}const ur=Object.getOwnPropertyDescriptor(St,rr);if(ur){if(ur.get||ur.set){Object.defineProperty(Sr,rr,ur)}else if(ur.enumerable){Sr[rr]=ir(St[rr],On,fr)}else{Object.defineProperty(Sr,rr,{enumerable:false,writable:true,configurable:true,value:ir(St[rr],On,fr)})}}else{Object.defineProperty(Sr,rr,{enumerable:true,writable:true,configurable:true,value:ir(St[rr],On,fr)})}}return Sr};pr.cloneWithShallow=function(St,On){const rr=On.shallow;On=Object.assign({},On);On.shallow=false;const cr=new Map;for(const On of rr){const rr=ir(St,On);if(typeof rr==="object"||typeof rr==="function"){cr.set(rr,rr)}}return pr.clone(St,On,cr)};pr.base=function(St,On,rr){if(rr.prototype===false){if(pr.needsProtoHack.has(On)){return new On.constructor}return On===cr.array?[]:{}}const ir=Object.getPrototypeOf(St);if(ir&&ir.isImmutable){return St}if(On===cr.array){const St=[];if(ir!==On){Object.setPrototypeOf(St,ir)}return St}if(pr.needsProtoHack.has(On)){const St=new ir.constructor;if(ir!==On){Object.setPrototypeOf(St,ir)}return St}return Object.create(ir)}},35879:(St,On,rr)=>{"use strict";const ir=rr(99704);const cr={mismatched:null};St.exports=function(St,On,rr){rr=Object.assign({prototype:true},rr);return!!cr.isDeepEqual(St,On,rr,[])};cr.isDeepEqual=function(St,On,rr,ur){if(St===On){return St!==0||1/St===1/On}const pr=typeof St;if(pr!==typeof On){return false}if(St===null||On===null){return false}if(pr==="function"){if(!rr.deepFunction||St.toString()!==On.toString()){return false}}else if(pr!=="object"){return St!==St&&On!==On}const fr=cr.getSharedType(St,On,!!rr.prototype);switch(fr){case ir.buffer:return Buffer&&Buffer.prototype.equals.call(St,On);case ir.promise:return St===On;case ir.regex:return St.toString()===On.toString();case cr.mismatched:return false}for(let rr=ur.length-1;rr>=0;--rr){if(ur[rr].isSame(St,On)){return true}}ur.push(new cr.SeenEntry(St,On));try{return!!cr.isDeepEqualObj(fr,St,On,rr,ur)}finally{ur.pop()}};cr.getSharedType=function(St,On,rr){if(rr){if(Object.getPrototypeOf(St)!==Object.getPrototypeOf(On)){return cr.mismatched}return ir.getInternalProto(St)}const ur=ir.getInternalProto(St);if(ur!==ir.getInternalProto(On)){return cr.mismatched}return ur};cr.valueOf=function(St){const On=St.valueOf;if(On===undefined){return St}try{return On.call(St)}catch(St){return St}};cr.hasOwnEnumerableProperty=function(St,On){return Object.prototype.propertyIsEnumerable.call(St,On)};cr.isSetSimpleEqual=function(St,On){for(const rr of Set.prototype.values.call(St)){if(!Set.prototype.has.call(On,rr)){return false}}return true};cr.isDeepEqualObj=function(St,On,rr,ur,pr){const{isDeepEqual:fr,valueOf:br,hasOwnEnumerableProperty:Sr}=cr;const{keys:Er,getOwnPropertySymbols:kr}=Object;if(St===ir.array){if(ur.part){for(const St of On){for(const On of rr){if(fr(St,On,ur,pr)){return true}}}}else{if(On.length!==rr.length){return false}for(let St=0;St<On.length;++St){if(!fr(On[St],rr[St],ur,pr)){return false}}return true}}else if(St===ir.set){if(On.size!==rr.size){return false}if(!cr.isSetSimpleEqual(On,rr)){const St=new Set(Set.prototype.values.call(rr));for(const rr of Set.prototype.values.call(On)){if(St.delete(rr)){continue}let On=false;for(const ir of St){if(fr(rr,ir,ur,pr)){St.delete(ir);On=true;break}}if(!On){return false}}}}else if(St===ir.map){if(On.size!==rr.size){return false}for(const[St,ir]of Map.prototype.entries.call(On)){if(ir===undefined&&!Map.prototype.has.call(rr,St)){return false}if(!fr(ir,Map.prototype.get.call(rr,St),ur,pr)){return false}}}else if(St===ir.error){if(On.name!==rr.name||On.message!==rr.message){return false}}const Pr=br(On);const Ir=br(rr);if((On!==Pr||rr!==Ir)&&!fr(Pr,Ir,ur,pr)){return false}const Lr=Er(On);if(!ur.part&&Lr.length!==Er(rr).length&&!ur.skip){return false}let Br=0;for(const St of Lr){if(ur.skip&&ur.skip.includes(St)){if(rr[St]===undefined){++Br}continue}if(!Sr(rr,St)){return false}if(!fr(On[St],rr[St],ur,pr)){return false}}if(!ur.part&&Lr.length-Br!==Er(rr).length){return false}if(ur.symbols!==false){const St=kr(On);const ir=new Set(kr(rr));for(const cr of St){if(!ur.skip||!ur.skip.includes(cr)){if(Sr(On,cr)){if(!Sr(rr,cr)){return false}if(!fr(On[cr],rr[cr],ur,pr)){return false}}else if(Sr(rr,cr)){return false}}ir.delete(cr)}for(const St of ir){if(Sr(rr,St)){return false}}}return true};cr.SeenEntry=class{constructor(St,On){this.obj=St;this.ref=On}isSame(St,On){return this.obj===St&&this.ref===On}}},16443:(St,On,rr)=>{"use strict";const ir=rr(72912);const cr={};St.exports=class extends Error{constructor(St){const rr=St.filter((St=>St!=="")).map((St=>typeof St==="string"?St:St instanceof Error?St.message:ir(St)));super(rr.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,On.assert)}}}},57391:St=>{"use strict";const On={};St.exports=function(St){if(!St){return""}let rr="";for(let ir=0;ir<St.length;++ir){const cr=St.charCodeAt(ir);if(On.isSafe(cr)){rr+=St[ir]}else{rr+=On.escapeHtmlChar(cr)}}return rr};On.escapeHtmlChar=function(St){const rr=On.namedHtml.get(St);if(rr){return rr}if(St>=256){return"&#"+St+";"}const ir=St.toString(16).padStart(2,"0");return`&#x${ir};`};On.isSafe=function(St){return On.safeCharCodes.has(St)};On.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);On.safeCharCodes=function(){const St=new Set;for(let On=32;On<123;++On){if(On>=97||On>=65&&On<=90||On>=48&&On<=57||On===32||On===46||On===44||On===45||On===58||On===95){St.add(On)}}return St}()},43935:St=>{"use strict";const On={};St.exports=function(St){return St.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:St=>{"use strict";const On={};St.exports=function(){}},66621:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(43700);const ur=rr(87492);const pr={};St.exports=pr.merge=function(St,On,rr){ir(St&&typeof St==="object","Invalid target value: must be an object");ir(On===null||On===undefined||typeof On==="object","Invalid source value: must be null, undefined, or an object");if(!On){return St}rr=Object.assign({nullOverride:true,mergeArrays:true},rr);if(Array.isArray(On)){ir(Array.isArray(St),"Cannot merge array onto an object");if(!rr.mergeArrays){St.length=0}for(let ir=0;ir<On.length;++ir){St.push(cr(On[ir],{symbols:rr.symbols}))}return St}const fr=ur.keys(On,rr);for(let ir=0;ir<fr.length;++ir){const ur=fr[ir];if(ur==="__proto__"||!Object.prototype.propertyIsEnumerable.call(On,ur)){continue}const br=On[ur];if(br&&typeof br==="object"){if(St[ur]===br){continue}if(!St[ur]||typeof St[ur]!=="object"||Array.isArray(St[ur])!==Array.isArray(br)||br instanceof Date||Buffer&&Buffer.isBuffer(br)||br instanceof RegExp){St[ur]=cr(br,{symbols:rr.symbols})}else{pr.merge(St[ur],br,rr)}}else{if(br!==null&&br!==undefined){St[ur]=br}else if(rr.nullOverride){St[ur]=br}}}return St}},69322:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr={};St.exports=function(St,On,rr){if(On===false||On===null||On===undefined){return St}rr=rr||{};if(typeof rr==="string"){rr={separator:rr}}const ur=Array.isArray(On);ir(!ur||!rr.separator,"Separator option is not valid for array-based chain");const pr=ur?On:On.split(rr.separator||".");let fr=St;for(let St=0;St<pr.length;++St){let ur=pr[St];const br=rr.iterables&&cr.iterables(fr);if(Array.isArray(fr)||br==="set"){const St=Number(ur);if(Number.isInteger(St)){ur=St<0?fr.length+St:St}}if(!fr||typeof fr==="function"&&rr.functions===false||!br&&fr[ur]===undefined){ir(!rr.strict||St+1===pr.length,"Missing segment",ur,"in reach path ",On);ir(typeof fr==="object"||rr.functions===true||typeof fr!=="function","Invalid segment",ur,"in reach path ",On);fr=rr.default;break}if(!br){fr=fr[ur]}else if(br==="set"){fr=[...fr][ur]}else{fr=fr.get(ur)}}return fr};cr.iterables=function(St){if(St instanceof Set){return"set"}if(St instanceof Map){return"map"}}},72912:St=>{"use strict";const On={};St.exports=function(...St){try{return JSON.stringify(...St)}catch(St){return"[Cannot display object: "+St.message+"]"}}},99704:(St,On)=>{"use strict";const rr={};On=St.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};rr.typeMap=new Map([["[object Error]",On.error],["[object Map]",On.map],["[object Promise]",On.promise],["[object Set]",On.set],["[object WeakMap]",On.weakMap],["[object WeakSet]",On.weakSet]]);On.getInternalProto=function(St){if(Array.isArray(St)){return On.array}if(Buffer&&St instanceof Buffer){return On.buffer}if(St instanceof Date){return On.date}if(St instanceof RegExp){return On.regex}if(St instanceof Error){return On.error}const ir=Object.prototype.toString.call(St);return rr.typeMap.get(ir)||On.generic}},87492:(St,On)=>{"use strict";const rr={};On.keys=function(St,On={}){return On.symbols!==false?Reflect.ownKeys(St):Object.getOwnPropertyNames(St)}},75663:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr={};On.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(St,On){On=On||{};const rr=[].concat(On.before||[]);const cr=[].concat(On.after||[]);const ur=On.group||"?";const pr=On.sort||0;ir(!rr.includes(ur),`Item cannot come before itself: ${ur}`);ir(!rr.includes("?"),"Item cannot come before unassociated items");ir(!cr.includes(ur),`Item cannot come after itself: ${ur}`);ir(!cr.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(St)){St=[St]}for(const On of St){const St={seq:this._items.length,sort:pr,before:rr,after:cr,group:ur,node:On};this._items.push(St)}if(!On.manual){const St=this._sort();ir(St,"item",ur!=="?"?`added into group ${ur}`:"","created a dependencies error")}return this.nodes}merge(St){if(!Array.isArray(St)){St=[St]}for(const On of St){if(On){for(const St of On._items){this._items.push(Object.assign({},St))}}}this._items.sort(cr.mergeSort);for(let St=0;St<this._items.length;++St){this._items[St].seq=St}const On=this._sort();ir(On,"merge created a dependencies error");return this.nodes}sort(){const St=this._sort();ir(St,"sort created a dependencies error");return this.nodes}_sort(){const St={};const On=Object.create(null);const rr=Object.create(null);for(const ir of this._items){const cr=ir.seq;const ur=ir.group;rr[ur]=rr[ur]||[];rr[ur].push(cr);St[cr]=ir.before;for(const St of ir.after){On[St]=On[St]||[];On[St].push(cr)}}for(const On in St){const ir=[];for(const cr in St[On]){const ur=St[On][cr];rr[ur]=rr[ur]||[];ir.push(...rr[ur])}St[On]=ir}for(const ir in On){if(rr[ir]){for(const cr of rr[ir]){St[cr].push(...On[ir])}}}const ir={};for(const On in St){const rr=St[On];for(const St of rr){ir[St]=ir[St]||[];ir[St].push(On)}}const cr={};const ur=[];for(let St=0;St<this._items.length;++St){let On=St;if(ir[St]){On=null;for(let St=0;St<this._items.length;++St){if(cr[St]===true){continue}if(!ir[St]){ir[St]=[]}const rr=ir[St].length;let ur=0;for(let On=0;On<rr;++On){if(cr[ir[St][On]]){++ur}}if(ur===rr){On=St;break}}}if(On!==null){cr[On]=true;ur.push(On)}}if(ur.length!==this._items.length){return false}const pr={};for(const St of this._items){pr[St.seq]=St}this._items=[];this.nodes=[];for(const St of ur){const On=pr[St];this.nodes.push(On.node);this._items.push(On)}return true}};cr.mergeSort=(St,On)=>St.sort===On.sort?0:St.sort<On.sort?-1:1},3563:(St,On,rr)=>{const{parse:ir,format:cr}=rr(87016);const{pathToRegexp:ur,compile:pr,parse:fr}=rr(44985);St.exports=Layer;function Layer(St,On,rr,ir={}){this.opts=ir;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(rr)?rr:[rr];for(const St of On){const On=this.methods.push(St.toUpperCase());if(this.methods[On-1]==="GET")this.methods.unshift("HEAD")}for(let rr=0;rr<this.stack.length;rr++){const ir=this.stack[rr];const cr=typeof ir;if(cr!=="function")throw new Error(`${On.toString()} \`${this.opts.name||St}\`: \`middleware\` must be a function, not \`${cr}\``)}this.path=St;this.regexp=ur(St,this.paramNames,this.opts)}Layer.prototype.match=function(St){return this.regexp.test(St)};Layer.prototype.params=function(St,On,rr={}){for(let St=On.length,ir=0;ir<St;ir++){if(this.paramNames[ir]){const St=On[ir];if(St&&St.length>0)rr[this.paramNames[ir].name]=St?safeDecodeURIComponent(St):St}}return rr};Layer.prototype.captures=function(St){return this.opts.ignoreCaptures?[]:St.match(this.regexp).slice(1)};Layer.prototype.url=function(St,On){let rr=St;const ur=this.path.replace(/\(\.\*\)/g,"");if(typeof St!=="object"){rr=Array.prototype.slice.call(arguments);if(typeof rr[rr.length-1]==="object"){On=rr[rr.length-1];rr=rr.slice(0,-1)}}const br=pr(ur,{encode:encodeURIComponent,...On});let Sr;const Er=fr(ur);let kr={};if(Array.isArray(rr)){for(let St=Er.length,On=0,ir=0;On<St;On++){if(Er[On].name)kr[Er[On].name]=rr[ir++]}}else if(Er.some((St=>St.name))){kr=St}else if(!On){On=St}Sr=br(kr);if(On&&On.query){Sr=ir(Sr);if(typeof On.query==="string"){Sr.search=On.query}else{Sr.search=undefined;Sr.query=On.query}return cr(Sr)}return Sr};Layer.prototype.param=function(St,On){const{stack:rr}=this;const ir=this.paramNames;const middleware=function(rr,ir){return On.call(this,rr.params[St],rr,ir)};middleware.param=St;const cr=ir.map((function(St){return St.name}));const ur=cr.indexOf(St);if(ur>-1){rr.some((function(St,On){if(!St.param||cr.indexOf(St.param)>ur){rr.splice(On,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(St){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${St}${this.path}`:St;this.paramNames=[];this.regexp=ur(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(St){try{return decodeURIComponent(St)}catch{return St}}},53777:(St,On,rr)=>{const ir=rr(77246);const cr=rr(58024);const ur=rr(93);const{pathToRegexp:pr}=rr(44985);const fr=rr(3563);const br=rr(26675)("koa-router");St.exports=Router;function Router(St={}){if(!(this instanceof Router))return new Router(St);this.opts=St;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 Sr of ur){function setMethodVerb(St){Router.prototype[St]=function(On,rr,ir){if(typeof rr==="string"||rr instanceof RegExp){ir=Array.prototype.slice.call(arguments,2)}else{ir=Array.prototype.slice.call(arguments,1);rr=On;On=null}if(typeof rr!=="string"&&!(rr instanceof RegExp)&&(!Array.isArray(rr)||rr.length===0))throw new Error(`You have to provide a path when adding a ${St} handler`);this.register(rr,[St],ir,{name:On});return this}}setMethodVerb(Sr)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const St=this;const On=Array.prototype.slice.call(arguments);let rr;if(Array.isArray(On[0])&&typeof On[0][0]==="string"){const cr=On[0];for(const ur of cr){St.use.apply(St,[ur].concat(On.slice(1)))}return this}const ir=typeof On[0]==="string";if(ir)rr=On.shift();for(const br of On){if(br.router){const Sr=Object.assign(Object.create(Router.prototype),br.router,{stack:[...br.router.stack]});for(let Er=0;Er<Sr.stack.length;Er++){const kr=Sr.stack[Er];const Pr=Object.assign(Object.create(fr.prototype),kr);if(rr)Pr.setPrefix(rr);if(St.opts.prefix)Pr.setPrefix(St.opts.prefix);St.stack.push(Pr);Sr.stack[Er]=Pr}if(St.params){function setRouterParams(On){const rr=On;for(const On of rr){Sr.param(On,St.params[On])}}setRouterParams(Object.keys(St.params))}}else{const Ir=[];pr(St.opts.prefix||"",Ir);const Lr=St.opts.prefix&&Ir.length;St.register(rr||"([^/]*)",[],br,{end:false,ignoreCaptures:!ir&&!Lr})}}return this};Router.prototype.prefix=function(St){St=St.replace(/\/$/,"");this.opts.prefix=St;for(let On=0;On<this.stack.length;On++){const rr=this.stack[On];rr.setPrefix(St)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const St=this;const On=function dispatch(On,rr){br("%s %s",On.method,On.path);const cr=St.matchHost(On.host);if(!cr){return rr()}const ur=St.opts.routerPath||On.newRouterPath||On.path||On.routerPath;const pr=St.match(ur,On.method);let fr;if(On.matched){On.matched.push.apply(On.matched,pr.path)}else{On.matched=pr.path}On.router=St;if(!pr.route)return rr();const Sr=pr.pathAndMethod;const Er=Sr[Sr.length-1];On._matchedRoute=Er.path;if(Er.name){On._matchedRouteName=Er.name}fr=(St.exclusive?[Er]:Sr).reduce((function(St,On){St.push((function(St,rr){St.captures=On.captures(ur,St.captures);St.params=St.request.params=On.params(ur,St.captures,St.params);St.routerPath=On.path;St.routerName=On.name;St._matchedRoute=On.path;if(On.name){St._matchedRouteName=On.name}return rr()}));return St.concat(On.stack)}),[]);return ir(fr)(On,rr)};On.router=this;return On};Router.prototype.allowedMethods=function(St={}){const On=this.methods;return function allowedMethods(rr,ir){return ir().then((function(){const ir={};if(!rr.status||rr.status===404){for(let St=0;St<rr.matched.length;St++){const On=rr.matched[St];for(let St=0;St<On.methods.length;St++){const rr=On.methods[St];ir[rr]=rr}}const ur=Object.keys(ir);if(!~On.indexOf(rr.method)){if(St.throw){const On=typeof St.notImplemented==="function"?St.notImplemented():new cr.NotImplemented;throw On}else{rr.status=501;rr.set("Allow",ur.join(", "))}}else if(ur.length>0){if(rr.method==="OPTIONS"){rr.status=200;rr.body="";rr.set("Allow",ur.join(", "))}else if(!ir[rr.method]){if(St.throw){const On=typeof St.methodNotAllowed==="function"?St.methodNotAllowed():new cr.MethodNotAllowed;throw On}else{rr.status=405;rr.set("Allow",ur.join(", "))}}}}}))}};Router.prototype.all=function(St,On,rr){if(typeof On==="string"){rr=Array.prototype.slice.call(arguments,2)}else{rr=Array.prototype.slice.call(arguments,1);On=St;St=null}if(typeof On!=="string"&&!(On instanceof RegExp)&&(!Array.isArray(On)||On.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(On,ur,rr,{name:St});return this};Router.prototype.redirect=function(St,On,rr){if(typeof St==="symbol"||St[0]!=="/"){St=this.url(St);if(St instanceof Error)throw St}if(typeof On==="symbol"||On[0]!=="/"&&!On.includes("://")){On=this.url(On);if(On instanceof Error)throw On}return this.all(St,(St=>{St.redirect(On);St.status=rr||301}))};Router.prototype.register=function(St,On,rr,ir={}){const cr=this;const{stack:ur}=this;if(Array.isArray(St)){for(const ur of St){cr.register.call(cr,ur,On,rr,ir)}return this}const pr=new fr(St,On,rr,{end:ir.end===false?ir.end:true,name:ir.name,sensitive:ir.sensitive||this.opts.sensitive||false,strict:ir.strict||this.opts.strict||false,prefix:ir.prefix||this.opts.prefix||"",ignoreCaptures:ir.ignoreCaptures});if(this.opts.prefix){pr.setPrefix(this.opts.prefix)}for(let St=0;St<Object.keys(this.params).length;St++){const On=Object.keys(this.params)[St];pr.param(On,this.params[On])}ur.push(pr);br("defined route %s %s",pr.methods,pr.path);return pr};Router.prototype.route=function(St){const On=this.stack;for(let rr=On.length,ir=0;ir<rr;ir++){if(On[ir].name&&On[ir].name===St)return On[ir]}return false};Router.prototype.url=function(St,On){const rr=this.route(St);if(rr){const St=Array.prototype.slice.call(arguments,1);return rr.url.apply(rr,St)}return new Error(`No route found for name: ${String(St)}`)};Router.prototype.match=function(St,On){const rr=this.stack;let ir;const cr={path:[],pathAndMethod:[],route:false};for(let ur=rr.length,pr=0;pr<ur;pr++){ir=rr[pr];br("test %s %s",ir.path,ir.regexp);if(ir.match(St)){cr.path.push(ir);if(ir.methods.length===0||~ir.methods.indexOf(On)){cr.pathAndMethod.push(ir);if(ir.methods.length>0)cr.route=true}}}return cr};Router.prototype.matchHost=function(St){const{host:On}=this;if(!On){return true}if(!St){return false}if(typeof On==="string"){return St===On}if(typeof On==="object"&&On instanceof RegExp){return On.test(St)}};Router.prototype.param=function(St,On){this.params[St]=On;for(let rr=0;rr<this.stack.length;rr++){const ir=this.stack[rr];ir.param(St,On)}return this};Router.url=function(St){const On=Array.prototype.slice.call(arguments,1);return fr.prototype.url.apply({path:St},On)}},86979:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AsyncHooksContextManager=void 0;const ir=rr(46123);const cr=rr(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=cr.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 St;return(St=this._stack[this._stack.length-1])!==null&&St!==void 0?St:ir.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){this._enterContext(St);try{return On.call(rr,...ir)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(St,On){if(On==="TIMERWRAP")return;const rr=this._stack[this._stack.length-1];if(rr!==undefined){this._contexts.set(St,rr)}}_destroy(St){this._contexts.delete(St)}_before(St){const On=this._contexts.get(St);if(On!==undefined){this._enterContext(On)}}_after(){this._exitContext()}_enterContext(St){this._stack.push(St)}_exitContext(){this._stack.pop()}bind(St,On){if(typeof On==="function"){const rr=this;const contextWrapper=function(...ir){return rr.with(St,(()=>On.apply(this,ir)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:On.length});return contextWrapper}return On}}On.AsyncHooksContextManager=AsyncHooksContextManager},63259:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AsyncLocalStorageContextManager=void 0;const ir=rr(46123);const cr=rr(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new cr.AsyncLocalStorage}active(){var St;return(St=this._asyncLocalStorage.getStore())!==null&&St!==void 0?St:ir.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){const cr=rr==null?On:On.bind(rr);return this._asyncLocalStorage.run(St,cr,...ir)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(St,On){if(typeof On==="function"){const rr=this;const contextWrapper=function(...ir){return rr.with(St,(()=>On.apply(this,ir)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:On.length});return contextWrapper}return On}}On.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.createContextManager=On.isSemverGreaterThanOrEqualTo=void 0;cr(rr(86979),On);cr(rr(63259),On);var ur=rr(43349);Object.defineProperty(On,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return ur.isSemverGreaterThanOrEqualTo}});Object.defineProperty(On,"createContextManager",{enumerable:true,get:function(){return ur.createContextManager}})},43349:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createContextManager=On.isSemverGreaterThanOrEqualTo=void 0;const ir=rr(63259);const cr=rr(86979);const ur=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(St,On){const rr=ur.exec(St);const ir=ur.exec(On);if(rr&&ir){if(rr[1]===ir[1]&&rr[2]===ir[2]&&rr[3]===ir[3]&&rr[4]===ir[4]){return true}return gteString(rr[1],ir[1])||rr[1]===ir[1]&&gteString(rr[2],ir[2])||rr[1]===ir[1]&&rr[2]===ir[2]&&gteString(rr[3],ir[3])||rr[1]===ir[1]&&rr[2]===ir[2]&&rr[3]===ir[3]&&gteString(rr[4],ir[4])}return false}On.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(St,On){const rr=parseInt(St,10);const ir=parseInt(On,10);return rr>ir}function createContextManager(){const St=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?ir.AsyncLocalStorageContextManager:cr.AsyncHooksContextManager;return new St}On.createContextManager=createContextManager},26733:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Bootstrap=On.BootstrapStarter=void 0;const ir=rr(46123);const cr=rr(16928);const ur=rr(51169);const pr=rr(44101);const fr=rr(5982);const br=rr(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(St={}){this.globalOptions=St;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 fr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new fr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const St=await(0,ir.loadModule)((0,cr.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(St===null||St===void 0?void 0:St.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,ir.initializeGlobalApplicationContext)({asyncContextManager:(0,pr.createContextManager)(),loggerFactory:ur.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 St=this.applicationContext.get(ir.MidwayApplicationManager);const On=St.getApplication("socketIO");(0,br.setupWorker)(On)}}const St=this.applicationContext.get(ir.MidwayFrameworkService);if(!St.getMainApp()){throw new ir.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,ir.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,ir.isTypeScriptEnvironment)()){return(0,cr.join)(this.appDir,"src")}else{return(0,cr.join)(this.appDir,"dist")}}}On.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(St={}){this.configured=true;if(!this.logger&&!St.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(St.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}St.logger=this.logger}else{this.logger=this.logger||St.logger}if(St.appDir&&St.appDir!==process.cwd()){process.chdir(St.appDir)}this.getStarter().configure(St);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((St=>{this.logger.error(St);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(St){this.logger.info("[midway:bootstrap] receive signal %s, closing",St);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(St){this.logger.error("[midway:bootstrap] close with error: ",St);process.exit(1)}}static onExit(St){this.logger.info("[midway:bootstrap] exit with code:%s",St)}static uncaughtExceptionHandler(St){if(!(St instanceof Error)){St=new Error(String(St))}if(St.name==="Error"){St.name="unhandledExceptionError"}this.logger.error(St)}static unhandledRejectionHandler(St){if(!(St instanceof Error)){const On=new Error(String(St));if(St){if(St.name)On.name=St.name;if(St.message)On.message=St.message;if(St.stack)On.stack=St.stack}St=On}if(St.name==="Error"){St.name="unhandledRejectionError"}this.logger.error(St)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}On.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new ur.MidwayLoggerContainer},84575:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.setupStickyMaster=On.AbstractForkManager=On.ClusterManager=On.BootstrapStarter=On.Bootstrap=void 0;cr(rr(82516),On);var ur=rr(26733);Object.defineProperty(On,"Bootstrap",{enumerable:true,get:function(){return ur.Bootstrap}});Object.defineProperty(On,"BootstrapStarter",{enumerable:true,get:function(){return ur.BootstrapStarter}});var pr=rr(93772);Object.defineProperty(On,"ClusterManager",{enumerable:true,get:function(){return pr.ClusterManager}});var fr=rr(84338);Object.defineProperty(On,"AbstractForkManager",{enumerable:true,get:function(){return fr.AbstractForkManager}});var br=rr(92364);Object.defineProperty(On,"setupStickyMaster",{enumerable:true,get:function(){return br.setupStickyMaster}})},82516:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},84338:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AbstractForkManager=void 0;const ir=rr(70857);const cr=rr(39023);const ur=rr(53599);const pr=rr(24434);const fr=rr(39023);const br=(0,fr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(St){this.options=St;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new pr.EventEmitter;this.workers=new Map;this.isClosing=false;St.count=St.count||ir.cpus().length-1;St.refork=St.refork!==false;St.limit=St.limit||60;St.duration=St.duration||6e4;St.logger=St.logger||console;St.workerInitTimeout=St.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:St.workerInitTimeout})}async start(){br("Start manager with options: %j",this.options);this.bindWorkerDisconnect((St=>{br(" - worker(%s): trigger event = disconnect",this.getWorkerId(St));const On=this.options.logger[St["disableRefork"]?"info":"error"];this.disconnectCount++;const rr=this.isWorkerDead(St);if(rr){br(" - worker(%s): worker is dead",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,ur.logDate)(),process.pid,this.getWorkerId(St));return}if(St["disableRefork"]){br(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(St));On("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,ur.logDate)(),process.pid,this.getWorkerId(St));return}this.disconnects[this.getWorkerId(St)]=(0,ur.logDate)();this.tryToRefork(St)}));this.bindWorkerExit(((St,On,rr)=>{br(" - worker(%s): trigger event = exit",this.getWorkerId(St));this.workers.delete(this.getWorkerId(St));if(St["disableRefork"]){return}const ir=!!this.disconnects[this.getWorkerId(St)];br(" - worker(%s): isExpected=%s",this.getWorkerId(St),ir);if(ir){delete this.disconnects[this.getWorkerId(St)];return}br(" - worker(%s): isWorkerDead=%s",this.getWorkerId(St),this.isWorkerDead(St));if(this.isWorkerDead(St)){return}br(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(St);this.onUnexpected(St,On,rr)}));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 St=0;St<this.options.count;St++){const St=this.createWorker();br(" - worker(%s) created",this.getWorkerId(St));this.eventBus.addWorker(St);this.workers.set(this.getWorkerId(St),St)}await this.eventBus.start()}tryToRefork(St){if(this.allowRefork()){br(" - worker(%s): allow refork and will fork new",this.getWorkerId(St));const On=this.createWorker(St);this.workers.set(this.getWorkerId(On),On);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,ur.logDate)(),process.pid,this.getWorkerId(On),On["state"]);this.eventBus.addWorker(On)}else{br(" - worker(%s): forbidden refork and will stop",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,ur.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const St=this.reforks.push(Date.now());if(St>this.options.limit){this.reforks.shift()}const On=this.reforks[this.reforks.length-1]-this.reforks[0];const rr=this.reforks.length<this.options.limit||On>this.options.duration;if(!rr){this.hub.emit("reachReforkLimit")}return rr}onerror(St){if(!St){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,ur.logDate)(),process.pid,St.stack);this.options.logger.error(St);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(St,On,rr){const ir=St.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const pr=new Error(cr.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(St),On,rr,ir,St[ir],St["state"]));pr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,ur.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,pr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,ur.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(St,On){await this.closeWorker(St);await Promise.race([(0,pr.once)(St,"exit"),(0,ur.sleep)(On)]);if(St.killed)return;(St.process||St).kill("SIGKILL")}async stop(St=2e3){br("run close");this.isClosing=true;await this.eventBus.stop();for(const On of this.workers.values()){On["disableRefork"]=true;await this.killWorker(On,St)}if(this.exitListener){await this.exitListener()}}hasWorker(St){return this.workers.has(St)}getWorker(St){return this.workers.get(St)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(St){this.exitListener=St}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(St){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",St);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(St){this.options.logger.error("[midway:master] close with error: ",St);process.exit(1)}}}onMasterExit(St){this.options.logger.info("[bootstrap:master] exit with code:%s",St)}}On.AbstractForkManager=AbstractForkManager},93772:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ClusterManager=void 0;const ir=rr(5982);const cr=rr(84338);const ur=rr(29907);const pr=rr(39023);const fr=rr(46123);const br=(0,pr.debuglog)("midway:bootstrap");class ClusterManager extends cr.AbstractForkManager{constructor(St={}){super(St);this.options=St;St.args=St.args||[];St.execArgv=St.execArgv||[];if((0,fr.isTypeScriptEnvironment)()){St.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(ur["setupPrimary"]){ur["setupPrimary"](this.options)}else if(ur["setupMaster"]){ur["setupMaster"](this.options)}return ur.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(St){br("Bind cluster.disconnect event");ur.on("disconnect",St)}bindWorkerExit(St){br("Bind cluster.exit event");ur.on("exit",St)}getWorkerId(St){return String(St.process.pid)}isWorkerDead(St){return St.isDead()}closeWorker(St){St.kill("SIGTERM")}createEventBus(St){return new ir.ChildProcessEventBus(St)}isPrimary(){return!ur.isWorker}}On.ClusterManager=ClusterManager},92364:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.setupWorker=On.setupStickyMaster=void 0;const ir=rr(29907);const cr=rr(76982);const randomId=()=>(0,cr.randomBytes)(8).toString("hex");function setupStickyMaster(St,On={}){const rr={loadBalancingMethod:"least-connection",...On};const cr=new Map;const ur=/sid=([\w-]{20})/;let pr=0;const computeWorkerId=St=>{const On=ur.exec(St);if(On){const St=On[1];const rr=cr.get(St);if(rr&&ir.workers[rr]){return rr}}switch(rr.loadBalancingMethod){case"random":{const St=Object.keys(ir.workers);return St[Math.floor(Math.random()*St.length)]}case"round-robin":{const St=Object.keys(ir.workers);pr++;if(pr>=St.length){pr=0}return St[pr]}case"least-connection":let St;for(const On in ir.workers){const rr=ir.workers[On];if(St===undefined){St=rr}else{const On=rr["clientsCount"]||0;const ir=St["clientsCount"]||0;if(On<ir){St=rr}}}return St.id}};St.on("connection",(St=>{let On,rr;const sendCallback=On=>{if(On){St.destroy()}};St.on("data",(cr=>{let ur="utf-8";let pr=cr.toString(ur);if(On&&rr){ir.workers[On].send({type:"sticky:http-chunk",data:pr,encoding:ur,connectionId:rr},sendCallback);return}On=computeWorkerId(pr);const fr=!(pr.startsWith("GET")||pr.substring(0,pr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(pr.startsWith("POST")&&pr.includes("multipart/form-data")){ur="base64";pr=cr.toString("base64")}St.pause();if(fr){rr=randomId()}ir.workers[On].send({type:"sticky:connection",data:pr,encoding:ur,connectionId:rr},St,{keepOpen:fr},sendCallback)}))}));St.on("request",(St=>{St.on("data",(()=>{}))}));ir.on("message",((St,{type:On,data:ir})=>{switch(On){case"sticky:connection":cr.set(ir,St.id);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]=(St["clientsCount"]||0)+1}break;case"sticky:disconnection":cr.delete(ir);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]--}break}}))}On.setupStickyMaster=setupStickyMaster;function setupWorker(St){const On=new Map;process.on("message",(({type:rr,data:ir,encoding:cr,connectionId:ur},pr)=>{switch(rr){case"sticky:connection":if(!pr){return}St.httpServer.emit("connection",pr);pr.emit("data",Buffer.from(ir,cr));pr.resume();if(ur){On.set(ur,pr);pr.on("close",(()=>{On.delete(ur)}))}break;case"sticky:http-chunk":{const St=On.get(ur);if(St){St.emit("data",Buffer.from(ir,cr))}}}}));const ignoreError=()=>{};St.engine.on("connection",(St=>{process.send({type:"sticky:connection",data:St.id},ignoreError);St.once("close",(()=>{process.send({type:"sticky:disconnection",data:St.id},ignoreError)}))}))}On.setupWorker=setupWorker},53599:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.sleep=On.logDate=void 0;function logDate(){const St=new Date;let On=St.getDate();if(On<10){On="0"+On}let rr=St.getMonth()+1;if(rr<10){rr="0"+rr}let ir=St.getHours();if(ir<10){ir="0"+ir}let cr=St.getMinutes();if(cr<10){cr="0"+cr}let ur=St.getSeconds();if(ur<10){ur="0"+ur}let pr=St.getMilliseconds();if(pr<10){pr="00"+pr}else if(pr<100){pr="0"+pr}return St.getFullYear()+"-"+rr+"-"+On+" "+ir+":"+cr+":"+ur+"."+pr}On.logDate=logDate;async function sleep(St){return new Promise((On=>{setTimeout(On,St)}))}On.sleep=sleep},64080:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.multiCaching=On.createCache=On.caching=void 0;const ir=rr(48851);const cr=rr(87932);async function caching(St,On){if(St==="memory"){const St=(0,cr.memoryStore)(On);return createCache(St,On)}if(typeof St==="function"){const rr=await St(On);return createCache(rr,On)}return createCache(St,On)}On.caching=caching;function createCache(St,On){return{wrap:async(rr,cr,ur)=>(0,ir.coalesceAsync)(rr,(async()=>{const pr=await St.get(rr);if(pr===undefined){const On=await cr();const ir=typeof ur==="function"?ur(On):ur;await St.set(rr,On,ir);return On}else if(On===null||On===void 0?void 0:On.refreshThreshold){const fr=typeof ur==="function"?ur(pr):ur;const br=await St.ttl(rr);if(br!==-1&&br<On.refreshThreshold){(0,ir.coalesceAsync)(`+++${rr}`,cr).then((On=>St.set(rr,On,fr)))}}return pr})),store:St,del:On=>St.del(On),get:On=>St.get(On),set:(On,rr,ir)=>St.set(On,rr,ir),reset:()=>St.reset(),methodWrap:async(rr,cr,ur,pr)=>(0,ir.coalesceAsync)(rr,(async()=>{const fr=await St.get(rr);if(fr===undefined){const On=await cr(...ur);const ir=typeof pr==="function"?pr(On):pr;await St.set(rr,On,ir);return On}else if(On===null||On===void 0?void 0:On.refreshThreshold){const br=typeof pr==="function"?pr(fr):pr;const Sr=await St.ttl(rr);if(Sr!==-1&&Sr<On.refreshThreshold){(0,ir.coalesceAsync)(`+++${rr}`,(()=>cr(...ur))).then((On=>St.set(rr,On,br)))}}return fr}))}}On.createCache=createCache;function multiCaching(St){const get=async On=>{for(const rr of St){try{const St=await rr.get(On);if(St!==undefined)return St}catch(St){}}};const set=async(On,rr,ir)=>{await Promise.all(St.map((St=>St.set(On,rr,ir))))};return{get:get,set:set,del:async On=>{await Promise.all(St.map((St=>St.del(On))))},async wrap(On,rr,ir){let cr;let ur=0;for(;ur<St.length;ur++){try{cr=await St[ur].get(On);if(cr!==undefined)break}catch(St){}}if(cr===undefined){const St=await rr();const cr=typeof ir==="function"?ir(St):ir;await set(On,St,cr);return St}else{const pr=typeof ir==="function"?ir(cr):ir;Promise.all(St.slice(0,ur).map((St=>St.set(On,cr,pr)))).then();St[ur].wrap(On,rr,ir).then()}return cr},reset:async()=>{await Promise.all(St.map((St=>St.reset())))},mget:async(...On)=>{const rr=new Array(On.length).fill(undefined);for(const ir of St){if(rr.every((St=>St!==undefined)))break;try{const St=await ir.store.mget(...On);St.forEach(((St,On)=>{if(rr[On]===undefined&&St!==undefined)rr[On]=St}))}catch(St){}}return rr},mset:async(On,rr)=>{await Promise.all(St.map((St=>St.store.mset(On,rr))))},mdel:async(...On)=>{await Promise.all(St.map((St=>St.store.mdel(...On))))},methodWrap:async(On,rr,ir,cr)=>{let ur;let pr=0;for(;pr<St.length;pr++){try{ur=await St[pr].get(On);if(ur!==undefined)break}catch(St){}}if(ur===undefined){const St=await rr(...ir);const ur=typeof cr==="function"?cr(St):cr;await set(On,St,ur);return St}else{const fr=typeof cr==="function"?cr(ur):cr;Promise.all(St.slice(0,pr).map((St=>St.set(On,ur,fr)))).then();St[pr].methodWrap(On,rr,ir,cr).then()}return ur}}}On.multiCaching=multiCaching},8869:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(64080),On);cr(rr(87932),On);cr(rr(91724),On)},48851:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.coalesceAsync=void 0;const rr=new Map;async function coalesceAsync(St,On){if(!hasKey(St)){addKey(St);try{const rr=await Promise.resolve(On());coalesce({key:St,result:rr});return rr}catch(On){coalesce({key:St,error:On});throw On}}return enqueue(St)}On.coalesceAsync=coalesceAsync;function hasKey(St){return rr.has(St)}function addKey(St){rr.set(St,[])}function removeKey(St){rr.delete(St)}function addCallbackToKey(St,On){const ir=getCallbacksByKey(St);ir.push(On);rr.set(St,ir)}function getCallbacksByKey(St){var On;return(On=rr.get(St))!==null&&On!==void 0?On:[]}function enqueue(St){return new Promise(((On,rr)=>{const ir={resolve:On,reject:rr};addCallbackToKey(St,ir)}))}function dequeue(St){const On=getCallbacksByKey(St);removeKey(St);return On}function coalesce(St){const{key:On,error:rr,result:ir}=St;dequeue(On).forEach((St=>{if(rr){St.reject(rr)}else{St.resolve(ir)}}))}},87932:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.memoryStore=void 0;const ir=rr(57223);const cr=rr(19944);function clone(St){if(typeof St==="object"&&St!==null){return cr(St)}return St}function memoryStore(St){var On;const rr=(St===null||St===void 0?void 0:St.shouldCloneBeforeSet)!==false;const cr=(On=St===null||St===void 0?void 0:St.isCacheable)!==null&&On!==void 0?On:St=>St!==undefined;const ur={ttlAutopurge:true,...St,max:(St===null||St===void 0?void 0:St.max)||500,ttl:(St===null||St===void 0?void 0:St.ttl)!==undefined?St.ttl:0};const pr=new ir(ur);return{async del(St){pr.delete(St)},get:async St=>pr.get(St),keys:async()=>[...pr.keys()],mget:async(...St)=>St.map((St=>pr.get(St))),async mset(St,On){const ir={ttl:On!==undefined?On:ur.ttl};for(const[On,ur]of St){if(!cr(ur))throw new Error(`no cacheable value ${JSON.stringify(ur)}`);if(rr)pr.set(On,clone(ur),ir);else pr.set(On,ur,ir)}},async mdel(...St){for(const On of St)pr.delete(On)},async reset(){pr.clear()},ttl:async St=>pr.getRemainingTTL(St),async set(St,On,ir){if(!cr(On))throw new Error(`no cacheable value ${JSON.stringify(On)}`);if(rr)On=clone(On);const fr=ir!==undefined?ir:ur.ttl;pr.set(St,On,{ttl:fr})},get calculatedSize(){return pr.calculatedSize},get size(){return pr.size},dump:()=>pr.dump(),load:(...St)=>pr.load(...St)}}On.memoryStore=memoryStore},91724:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},68805:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CacheConfiguration=On.getClassMethodDefaultCacheKey=void 0;const ur=rr(46123);const pr=rr(42696);const fr=rr(91761);function getClassMethodDefaultCacheKey(St,On){return St.name+"-"+(0,ur.getProviderUUId)(St)+"-"+On}On.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let br=class CacheConfiguration{async onReady(St){this.cacheService=await St.getAsync(fr.CachingFactory);this.decoratorService.registerMethodHandler(pr.CACHE_DECORATOR_KEY,(({target:St,propertyName:On,metadata:rr})=>{if(!rr.cacheKey){rr.cacheKey=getClassMethodDefaultCacheKey(St,On)}return{around:async St=>{let On=rr.cacheKey;const ir=this.cacheService.get(rr.cacheInstanceName);if(typeof On==="function"){On=await On({methodArgs:St.args,ctx:St.target[ur.REQUEST_OBJ_CTX_KEY],target:St.target})}if(typeof On==="string"){return ir.methodWrap(On,St.proceed,St.args,rr.ttl)}else{return St.proceed(...St.args)}}}}))}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayDecoratorService)],br.prototype,"decoratorService",void 0);br=ir([(0,ur.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],br);On.CacheConfiguration=br},42696:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Caching=On.CACHE_DECORATOR_KEY=void 0;const ir=rr(46123);On.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(St,rr,cr){if(typeof rr==="number"){cr=rr;rr=undefined}return(0,ir.createCustomMethodDecorator)(On.CACHE_DECORATOR_KEY,{cacheInstanceName:St,cacheKey:rr,ttl:cr})}On.Caching=Caching},91761:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CachingFactory=void 0;const ur=rr(46123);const pr=rr(8869);let fr=class CachingFactory extends ur.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(St,On){if(Array.isArray(St.store)){const rr=[];for(const ir of St.store){if(typeof ir==="string"){if(!this.has(ir)){throw new ur.MidwayCommonError(`cache instance "${ir}" not found in "${On}", please check your configuration.`)}rr.push(this.get(ir))}else if(typeof ir==="function"){rr.push(await ir())}else if(ir["wrap"]){rr.push(ir["wrap"])}else if(typeof ir==="object"){if(typeof ir.store==="function"){ir.store=await ir.store(ir["options"]||{},this.applicationContext)}if(!ir.store){throw new ur.MidwayCommonError(`cache instance "${On}" store is undefined, please check your configuration.`)}rr.push(await(0,pr.caching)(ir.store,ir["options"]))}else{throw new ur.MidwayCommonError("invalid cache config")}}return await(0,pr.multiCaching)(rr)}else{if(typeof St.store==="function"){St.store=await St.store(St["options"]||{},this.applicationContext)}if(!St.store){throw new ur.MidwayCommonError(`cache instance "${On}" store is undefined, please check your configuration.`)}return await(0,pr.caching)(St.store,St["options"])}}getName(){return"cache-manager"}getCaching(St){return this.get(St)}getMultiCaching(St){return this.get(St)}};ir([(0,ur.Config)("cacheManager"),cr("design:type",Object)],fr.prototype,"cacheManagerConfig",void 0);ir([(0,ur.ApplicationContext)(),cr("design:type",Object)],fr.prototype,"applicationContext",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"init",null);fr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],fr);On.CachingFactory=fr},96955:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.CacheManager=On.getClassMethodDefaultCacheKey=On.Configuration=void 0;var ur=rr(68805);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.CacheConfiguration}});Object.defineProperty(On,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return ur.getClassMethodDefaultCacheKey}});cr(rr(43488),On);cr(rr(91761),On);cr(rr(42696),On);On.CacheManager=rr(8869);cr(rr(93730),On)},43488:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},93730:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createRedisStore=void 0;const ir=rr(46123);const getVal=St=>JSON.stringify(St)||'"undefined"';function createRedisStore(St){return async(On,rr)=>{const{RedisServiceFactory:cr}=(0,ir.safeRequire)("@midwayjs/redis");const ur=await rr.getAsync(cr);const pr=ur.get(St);return createStore(pr,On)}}On.createRedisStore=createRedisStore;function createStore(St,On){const rr=(On===null||On===void 0?void 0:On.isCacheable)||(St=>St!==undefined&&St!==null);const keys=On=>St.keys(On);return{async get(On){const rr=await St.get(On);if(rr===undefined||rr===null)return undefined;else{try{return JSON.parse(rr)}catch(St){return rr}}},async set(cr,ur,pr){if(!rr(ur))throw new ir.MidwayCommonError(`"${ur}" is not a cacheable value`);const fr=pr===undefined?On===null||On===void 0?void 0:On.ttl:pr;if(fr!==undefined&&fr!==0)await St.set(cr,getVal(ur),"PX",fr);else await St.set(cr,getVal(ur))},async mset(cr,ur){const pr=ur===undefined?On===null||On===void 0?void 0:On.ttl:ur;if(pr!==undefined&&pr!==0){const On=St.multi();for(const[St,ur]of cr){if(!rr(ur))throw new ir.MidwayCommonError(`"${getVal(ur)}" is not a cacheable value`);On.set(St,getVal(ur),"PX",pr)}await On.exec()}else await St.mset(cr.flatMap((([St,On])=>{if(!rr(On))throw new Error(`"${getVal(On)}" is not a cacheable value`);return[St,getVal(On)]})))},mget:(...On)=>St.mget(On).then((St=>St.map((St=>{if(St===null||St===undefined){return undefined}else{try{return JSON.parse(St)}catch(On){return St}}})))),async mdel(...On){await St.del(On)},async del(On){await St.del(On)},ttl:async On=>St.pttl(On),keys:(St="*")=>keys(St),reset:()=>{throw new ir.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:rr}}},4074:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Cookie=void 0;const ir=rr(42613);const cr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const ur=/^(?:none|lax|strict)$/i;class Cookie{constructor(St,On,rr){ir(cr.test(St),"argument name is invalid");ir(!On||cr.test(On),"argument value is invalid");this.name=St;this.value=On||"";this.attrs=mergeDefaultAttrs(rr);ir(!this.attrs.path||cr.test(this.attrs.path),"argument option path is invalid");ir(!this.attrs.domain||cr.test(this.attrs.domain),"argument option domain is invalid");ir(!this.attrs.sameSite||this.attrs.sameSite===true||ur.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!On){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let St=this.toString();const On=this.attrs;if(On.path)St+="; path="+On.path;const rr=typeof On.maxAge==="string"?parseInt(On.maxAge,10):On.maxAge;if(rr){St+="; max-age="+Math.round(rr/1e3);On.expires=new Date(Date.now()+rr)}if(On.expires)St+="; expires="+On.expires.toUTCString();if(On.domain)St+="; domain="+On.domain;if(On.sameSite)St+="; samesite="+(On.sameSite===true?"strict":On.sameSite.toLowerCase());if(On.secure)St+="; secure";if(On.httpOnly)St+="; httponly";if(On.priority)St+="; priority="+On.priority;if(On.partitioned)St+="; partitioned";return St}}On.Cookie=Cookie;const pr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(St){const On={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!St)return On;for(let rr=0;rr<pr.length;rr++){const ir=pr[rr];if(ir in St)On[ir]=St[ir]}return On}},11033:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.urlSafeDecode=On.urlSafeEncode=On.Cookies=void 0;const ir=rr(42613);const cr=rr(4074);const ur=rr(5693);const pr=rr(86054);const fr=Symbol("midwayCookies:keysArray");const br=Symbol("midwayCookies:keys");const Sr=new Map;class Cookies{constructor(St,On,rr,ir){var cr;this[fr]=On?[].concat(On):On;this._defaultCookieOptions=rr;this._defaultGetCookieOptions=ir;this.ctx=St;this.secure=(cr=rr===null||rr===void 0?void 0:rr.secure)!==null&&cr!==void 0?cr:this.ctx.secure;this.app=St.app}get keys(){if(!this[br]){const St=this[fr];ir(Array.isArray(St),".keys required for encrypt/sign cookies");const On=Sr.get(St);if(On){this[br]=On}else{this[br]=new ur.Keygrip(this[fr]);Sr.set(St,this[br])}}return this[br]}get(St,On){On=Object.assign({},this._defaultGetCookieOptions||{},On);const rr=computeSigned(On);const ir=this.ctx.get("cookie");if(!ir)return;const cr=ir.match(getPattern(St));if(!cr)return;let ur=cr[1];if(!On.encrypt&&!rr)return ur;if(rr){const On=St+".sig";const rr=this.get(On,{signed:false});if(!rr)return;const ir=St+"="+ur;const cr=this.keys.verify(ir,rr);if(cr<0){this.set(On,null,{path:"/",signed:false});return}if(cr>0){this.set(On,this.keys.sign(ir),{signed:false})}return ur}ur=urlSafeDecode(ur);const pr=this.keys.decrypt(ur);if(pr===null||pr===void 0?void 0:pr.value){return pr.value.toString()}return undefined}set(St,On,rr){if(!rr&&typeof On!=="string"){rr=On;On=""}rr=Object.assign({},this._defaultCookieOptions,rr);const ir=computeSigned(rr);On=On||"";if(!this.secure&&rr.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let ur=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(ur))ur=[ur];if(rr.encrypt){On=On&&urlSafeEncode(this.keys.encrypt(On))}if(On.length>4093){this.app.emit("cookieLimitExceed",{name:St,value:On,ctx:this.ctx})}const pr=this.ctx.get("user-agent");if(rr.sameSite&&typeof rr.sameSite==="string"&&rr.sameSite.toLowerCase()==="none"){if(!this.secure||pr&&!this.isSameSiteNoneCompatible(pr)){rr.sameSite=false}}if(rr.partitioned){if(!this.secure||!pr||pr&&!this.isPartitionedCompatible(pr)){rr.partitioned=false}}if(rr.partitioned&&rr.removeUnpartitioned){const On=rr.overwrite;if(On){rr.overwrite=false;ur=ignoreCookiesByName(ur,St)}const pr=Object.assign({},rr,{partitioned:false});const fr=new cr.Cookie(St,"",pr);if(rr.secure===undefined)fr.attrs.secure=this.secure;ur=pushCookie(ur,fr);if(ir){fr.name+=".sig";ur=ignoreCookiesByName(ur,fr.name);ur=pushCookie(ur,fr)}}if(rr.priority){if(!pr||pr&&!this.isPriorityCompatible(pr)){rr.priority=undefined}}const fr=new cr.Cookie(St,On,rr);if(rr.secure===undefined)fr.attrs.secure=this.secure;ur=pushCookie(ur,fr);if(ir){fr.value=On&&this.keys.sign(fr.toString());fr.name+=".sig";ur=pushCookie(ur,fr)}this.ctx.set("set-cookie",ur);return this}isSameSiteNoneCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=80}return(0,pr.isSameSiteNoneCompatible)(St)}isPartitionedCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=114}return false}parseChromiumAndMajorVersion(St){if(!this.uaParseResult){const On=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(St);if(!On)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(On[1])}}return this.uaParseResult}isPriorityCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=81}return false}}On.Cookies=Cookies;const Er=new Map;function getPattern(St){const On=Er.get(St);if(On)return On;const rr=new RegExp("(?:^|;) *"+St.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");Er.set(St,rr);return rr}function computeSigned(St){if(St.encrypt)return false;return St.signed!==false}function pushCookie(St,On){if(On.attrs.overwrite){St=ignoreCookiesByName(St,On.name)}St.push(On.toHeader());return St}function ignoreCookiesByName(St,On){const rr=`${On}=`;return St.filter((St=>!St.startsWith(rr)))}function urlSafeEncode(St){return St.replace(/\+/g,"-").replace(/\//g,"_")}On.urlSafeEncode=urlSafeEncode;function urlSafeDecode(St){return St.replace(/-/g,"+").replace(/_/g,"/")}On.urlSafeDecode=urlSafeDecode},60990:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(33249),On);cr(rr(11033),On)},33249:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},5693:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Keygrip=void 0;const ir=rr(42613);const cr=rr(39023);const ur=rr(76982);const pr=rr(48978);const fr=(0,cr.debuglog)("midway:cookies");const br={"/":"_","+":"-","=":""};class Keygrip{constructor(St){ir(Array.isArray(St)&&St.length,"keys must be provided and should be an array");this.keys=St;this.hash="sha256"}encrypt(St,On){On=On||this.keys[0];try{St=String(St);const rr=getAlgorithm();const ir=(0,ur.randomBytes)(64);const cr=(0,ur.randomBytes)(16);const pr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const fr=deriveKeyFromPassword(On,ir,Math.floor(pr*.47+1337));const br=(0,ur.createCipheriv)(rr,fr,cr);const Sr=Buffer.concat([br.update(St,"utf8"),br.final()]);const Er=br.getAuthTag();const kr=Buffer.concat([ir,cr,Er,Buffer.from(pr.toString()),Sr]).toString("hex");return getEncryptedPrefix()+kr}catch(St){fr("crypt error",St.stack);return undefined}}decrypt(St,On){if(!On){const On=this.keys;for(let rr=0;rr<On.length;rr++){const ir=this.decrypt(St,On[rr]);if(ir!==false)return{value:ir,index:rr}}return false}try{const rr=getAlgorithm();const ir=St.split(getEncryptedPrefix());if(ir.length!==2){return void 0}else{St=ir[1]}const cr=Buffer.from(St,"hex");const pr=cr.slice(0,64);const fr=cr.slice(64,80);const br=cr.slice(80,96);const Sr=parseInt(cr.slice(96,101).toString("utf-8"),10);const Er=cr.slice(101);const kr=deriveKeyFromPassword(On,pr,Math.floor(Sr*.47+1337));const Pr=(0,ur.createDecipheriv)(rr,kr,fr);Pr.setAuthTag(br);return Pr.update(Er,"binary","utf-8")+Pr.final("utf-8")}catch(St){fr("crypt error",St.stack);return false}}sign(St,On){On=On||this.keys[0];return(0,ur.createHmac)(this.hash,On).update(St).digest("base64").replace(/\/|\+|=/g,(St=>br[St]))}verify(St,On){const rr=this.keys;for(let ir=0;ir<rr.length;ir++){if(pr(Buffer.from(On),Buffer.from(this.sign(St,rr[ir])))){fr("data %s match key %s",St,rr[ir]);return ir}}return-1}}On.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(St,On,rr){return(0,ur.pbkdf2Sync)(St,On,rr,32,"sha512")}},83872:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BaseFramework=void 0;const ur=rr(6192);const pr=rr(2222);const fr=rr(49757);const br=rr(97983);const Sr=rr(70275);const Er=rr(78842);const kr=rr(37482);const Pr=rr(34888);const Ir=rr(12738);const Lr=rr(68220);const Br=rr(39408);const jr=rr(77306);const Ur=rr(39023);const Vr=rr(75351);const Wr=rr(40581);const zr=Ur.debuglog("midway:debug");class BaseFramework{constructor(St){this.applicationContext=St;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var St,On;this.configurationOptions=(St=this.configure())!==null&&St!==void 0?St:{};this.contextLoggerApplyLogger=(On=this.configurationOptions.contextLoggerApplyLogger)!==null&&On!==void 0?On:"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(St){this.bootstrapOptions=St;await this.beforeContainerInitialize(St);await this.containerInitialize(St);await this.afterContainerInitialize(St);await this.containerDirectoryLoad(St);await this.afterContainerDirectoryLoad(St);await this.applicationInitialize(St);await this.containerReady(St);await this.afterContainerReady(St);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(St){}async containerDirectoryLoad(St){}async containerReady(St){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(St){return this.configService.getConfiguration(St)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(St,On){if(On&&On!=="appLogger"){const rr=this.getLogger(On);let ir=St.getAttr(pr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!ir){ir=new Map;St.setAttr(pr.REQUEST_CTX_LOGGER_CACHE_KEY,ir)}if(ir.has(On)){return ir.get(On)}const cr=this.loggerService.createContextLogger(St,rr);ir.set(On,cr);return cr}else{const rr=this.getLogger(On!==null&&On!==void 0?On:this.contextLoggerApplyLogger);if(St["_logger"]){return St["_logger"]}St["_logger"]=this.loggerService.createContextLogger(St,rr,{contextFormat:this.contextLoggerFormat});return St["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(St={},On=[]){const rr={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:St=>this.getConfiguration(St),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>ur.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:St=>this.getLogger(St),createLogger:(St,On={})=>this.createLogger(St,On),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:St=>{const On=St||Object.create(this.defaultContext);if(!On.startTime){On.startTime=Date.now()}if(!On.logger){On.logger=this.createContextLogger(On)}if(!On.requestContext){On.requestContext=new br.MidwayRequestContainer(On,this.getApplicationContext());On.requestContext.ready()}if(!On.getLogger){On.getLogger=St=>this.createContextLogger(On,St)}On.setAttr=(St,rr)=>{On.requestContext.setAttr(St,rr)};On.getAttr=St=>On.requestContext.getAttr(St);On.getApp=()=>this.getApplication();return On},addConfigObject:St=>{this.configService.addObject(St)},setAttr:(St,On)=>{this.getApplicationContext().setAttr(St,On)},getAttr:St=>this.getApplicationContext().getAttr(St),useMiddleware:St=>this.useMiddleware(St),getMiddleware:()=>this.getMiddleware(),useFilter:St=>this.useFilter(St),useGuard:St=>this.useGuard(St),getNamespace:()=>this.getNamespace()};for(const St of On){delete rr[St]}Object.assign(this.app,rr,St)}async beforeStop(){}async beforeContainerInitialize(St){}async afterContainerInitialize(St){}async afterContainerDirectoryLoad(St){}async afterContainerReady(St){}async applyMiddleware(St){var On;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(pr.ASYNC_CONTEXT_MANAGER_KEY)){const St=this.configService.getConfiguration("asyncContextManager.enable")||false;const rr=St?((On=this.bootstrapOptions)===null||On===void 0?void 0:On.asyncContextManager)||new Vr.NoopContextManager:new Vr.NoopContextManager;if(St){rr.enable()}this.applicationContext.registerObject(pr.ASYNC_CONTEXT_MANAGER_KEY,rr)}this.middlewareManager.insertFirst((async(St,On)=>{const rr=Vr.ASYNC_ROOT_CONTEXT.setValue(pr.ASYNC_CONTEXT_KEY,St);const ir=this.applicationContext.get(pr.ASYNC_CONTEXT_MANAGER_KEY);return await ir.with(rr,(async()=>{await this.mockService.runSimulatorContextSetup(St,this.app);this.mockService.applyContextMocks(this.app,St);let rr=undefined;try{const ir=await On();rr=await this.filterManager.runResultFilter(ir,St)}catch(On){rr=await this.filterManager.runErrorFilter(On,St)}finally{await this.mockService.runSimulatorContextTearDown(St,this.app)}if(rr.error){throw rr.error}return rr.result}))}));zr(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(St){St=Array.isArray(St)?St:[St];return await this.middlewareService.compose([this.composeMiddleware,...St],this.app)}return this.composeMiddleware}getLogger(St){var On;return(On=this.loggerService.getLogger(St))!==null&&On!==void 0?On:this.appLogger}getCoreLogger(){return this.logger}createLogger(St,On={}){return this.loggerService.createLogger(St,On)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(St){this.middlewareManager.insertLast(St)}getMiddleware(){return this.middlewareManager}useFilter(St){return this.filterManager.useFilter(St)}useGuard(St){return this.guardManager.addGlobalGuard(St)}async runGuard(St,On,rr){return this.guardManager.runGuard(St,On,rr)}createMiddlewareManager(){return new Ir.ContextMiddlewareManager}createFilterManager(){return new Br.FilterManager}createGuardManager(){return new Wr.GuardManager}setNamespace(St){this.namespace=St}getNamespace(){return this.namespace}}ir([(0,fr.Inject)(),cr("design:type",Pr.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);ir([(0,fr.Inject)(),cr("design:type",Sr.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);ir([(0,fr.Inject)(),cr("design:type",Er.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);ir([(0,fr.Inject)(),cr("design:type",kr.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);ir([(0,fr.Inject)(),cr("design:type",Lr.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);ir([(0,fr.Inject)(),cr("design:type",jr.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);ir([(0,fr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],BaseFramework.prototype,"init",null);On.BaseFramework=BaseFramework},43436:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayApplicationManager=void 0;const cr=rr(6192);const ur=rr(49757);let pr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(St,On){this.globalFrameworkMap.set(St,On);if(On["getFrameworkType"]){this.globalFrameworkTypeMap.set(On["getFrameworkType"](),On)}}getFramework(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St)}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St)}}}getApplication(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St).getApplication()}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St).getApplication()}}}getApplications(St){if(!St){return Array.from(this.globalFrameworkMap.values()).map((St=>St.getApplication())).filter((St=>!!St))}else{return St.map((St=>this.getApplication(St))).filter((St=>!!St))}}};pr=ir([(0,ur.Provide)(),(0,ur.Scope)(cr.ScopeEnum.Singleton)],pr);On.MidwayApplicationManager=pr},75351:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.NoopContextManager=On.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(St){const On=this;On._currentContext=St?new Map(St):new Map;On.getValue=St=>On._currentContext.get(St);On.setValue=(St,rr)=>{const ir=new AsyncBaseContext(On._currentContext);ir._currentContext.set(St,rr);return ir};On.deleteValue=St=>{const rr=new AsyncBaseContext(On._currentContext);rr._currentContext.delete(St);return rr}}}On.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return On.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){return On.call(rr,...ir)}bind(St,On){return On}enable(){return this}disable(){return this}}On.NoopContextManager=NoopContextManager},46673:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.DataListener=void 0;const ur=rr(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(St){this.innerData=St}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],DataListener.prototype,"init",null);ir([(0,ur.Destroy)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],DataListener.prototype,"stop",null);On.DataListener=DataListener},12849:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.globModels=On.formatGlobString=On.DataSourceManager=void 0;const ur=rr(83486);const pr=rr(86314);const fr=rr(62525);const br=rr(16928);const Sr=rr(63289);const Er=rr(2222);const kr=rr(39023);const Pr=rr(65308);const Ir=rr(49757);const Lr=rr(70275);const Br=rr(78842);const jr=rr(67934);const Ur=(0,kr.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(St,On){var rr,ir;this.options=St;if(!this.options.dataSource){throw new pr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof On==="string"){On={baseDir:On,entitiesConfigKey:"entities"}}const cr=On;const ur=(ir=(rr=this.configService)===null||rr===void 0?void 0:rr.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&ir!==void 0?ir:false;const processDataSource=async On=>{var rr;const ir=St.dataSource[On];const ur=ir[cr.entitiesConfigKey];if(ur){const St=new Set;for(const ir of ur){if(typeof ir==="string"){const ur=await globModels(ir,cr.baseDir,(rr=this.environmentService)===null||rr===void 0?void 0:rr.getModuleLoadType());for(const rr of ur){St.add(rr);this.modelMapping.set(rr,On)}}else{St.add(ir);this.modelMapping.set(ir,On)}}ir[cr.entitiesConfigKey]=Array.from(St);Ur(`[core]: DataManager load ${ir[cr.entitiesConfigKey].length} models from ${On}.`)}const pr={cacheInstance:St.cacheInstance,validateConnection:St.validateConnection};await this.createInstance(ir,On,pr)};const fr=Object.keys(St.dataSource);if(ur){await Promise.all(fr.map(processDataSource))}else{for(const St of fr){await processDataSource(St)}}}getDataSource(St){return this.dataSource.get(St)}hasDataSource(St){return this.dataSource.has(St)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(St){const On=this.getDataSource(St);return On?this.checkConnected(On):false}async createInstance(St,On,rr){const ir=rr&&typeof rr.cacheInstance==="boolean"?rr.cacheInstance:true;const cr=rr&&rr.validateConnection||false;const fr=(0,ur.extend)(true,{},this.options["default"],St);const br=await this.createDataSource(fr,On);if(ir&&On&&br){this.dataSource.set(On,br)}if(cr){if(!br){throw new pr.MidwayCommonError(`[DataSourceManager] ${On} initialization failed.`)}const St=await this.checkConnected(br);if(!St){throw new pr.MidwayCommonError(`[DataSourceManager] ${On} is not connected.`)}}return br}getDataSourceNameByModel(St){return this.modelMapping.get(St)}async stop(){const St=Array.from(this.dataSource.values());await Promise.all(St.map((St=>this.destroyDataSource(St))));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(St){return this.priorityManager.getPriority(this.dataSourcePriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.dataSourcePriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.dataSourcePriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.dataSourcePriority[St])}}ir([(0,Ir.Inject)(),cr("design:type",String)],DataSourceManager.prototype,"appDir",void 0);ir([(0,Ir.Inject)(),cr("design:type",Lr.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);ir([(0,Ir.Inject)(),cr("design:type",Br.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);ir([(0,Ir.Inject)(),cr("design:type",jr.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);On.DataSourceManager=DataSourceManager;function formatGlobString(St){let On;if(!/^\*/.test(St)){St="/"+St}const rr=(0,br.parse)(St);if(rr.base&&(/\*/.test(rr.base)||rr.ext)){On=[St]}else{On=[...Er.DEFAULT_PATTERN.map((On=>(0,br.join)(St,On)))]}return On}On.formatGlobString=formatGlobString;async function globModels(St,On,rr){const ir=formatGlobString(St);const cr=[];const ur=(0,fr.run)(ir,{cwd:On,ignore:Er.IGNORE_PATTERN});for(const St of ur){const On=await(0,Pr.loadModule)(St,{loadMode:rr});if(Sr.Types.isClass(On)){cr.push(On)}else{for(const St in On){const rr=On[St];if(Sr.Types.isClass(rr)){cr.push(rr)}}}}return cr}On.globModels=globModels},1845:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.CustomModuleDetector=On.ESModuleFileDetector=On.CommonJSFileDetector=On.AbstractFileDetector=void 0;const ir=rr(63289);const cr=rr(62525);const ur=rr(86314);const pr=rr(2222);const fr=rr(49757);const br=rr(65308);class AbstractFileDetector{constructor(St){this.options=St;this.extraDetectorOptions={}}setExtraDetectorOptions(St){this.extraDetectorOptions=St}}On.AbstractFileDetector=AbstractFileDetector;const Sr=["**/**.tsx"].concat(pr.DEFAULT_PATTERN);const Er=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(pr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(St){if(this.getType()==="commonjs"){return this.loadSync(St)}else{return this.loadAsync(St)}}loadSync(St){var On;this.options=this.options||{};const rr=[].concat((On=this.options.loadDir)!==null&&On!==void 0?On:St.get("baseDir"));for(const On of rr){const rr=(0,cr.run)(Sr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:On,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,On)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&ir.Types.isClass(St)){const rr=(0,fr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new ur.MidwayDuplicateClassNameError(rr,On.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,On.srcPath)}}}};for(const On of rr){const rr=require(On);St.bindClass(rr,{namespace:this.options.namespace,srcPath:On,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(St){var On;this.options=this.options||{};const rr=[].concat((On=this.options.loadDir)!==null&&On!==void 0?On:St.get("baseDir"));for(const On of rr){const rr=(0,cr.run)(Sr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:On,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,On)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&ir.Types.isClass(St)){const rr=(0,fr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new ur.MidwayDuplicateClassNameError(rr,On.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,On.srcPath)}}}};for(const On of rr){const rr=await(0,br.loadModule)(On,{loadMode:"esm"});St.bindClass(rr,{namespace:this.options.namespace,srcPath:On,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}On.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}On.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(St){for(const On of this.options.modules){St.bindClass(On,{namespace:this.options.namespace,createFrom:"module"})}}}On.CustomModuleDetector=CustomModuleDetector},39408:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FilterManager=void 0;const ir=rr(49757);const cr=rr(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(St){if(!Array.isArray(St)){St=[St]}for(const On of St){if((0,ir.getClassMetadata)(ir.CATCH_KEY,On)){this.errFilterList.push(On)}if((0,ir.getClassMetadata)(ir.MATCH_KEY,On)){this.successFilterList.push(On)}}}async init(St){for(const On of this.errFilterList){const rr=await St.getAsync(On);const cr=(0,ir.getClassMetadata)(ir.CATCH_KEY,On);if(cr&&cr.catchTargets){cr.catchOptions=cr.catchOptions||{};for(const St of cr.catchTargets){this.exceptionMap.set(St,{filter:rr,catchOptions:cr.catchOptions});if(cr.catchOptions["matchPrototype"]){this.protoMatchList.push((On=>{if(On instanceof St){return St}else{return false}}))}}}else{this.defaultErrFilter=rr}}for(const On of this.successFilterList){const rr=await St.getAsync(On);const ur=(0,ir.getClassMetadata)(ir.MATCH_KEY,On);if(ur&&ur.matchPattern){this.matchFnList.push({matchFn:(0,cr.toPathMatch)(ur.matchPattern),target:rr})}}}async runErrorFilter(St,On,rr,ir){let cr,ur;let pr=false;if(St&&this.exceptionMap.has(St.constructor)){pr=true;const ur=this.exceptionMap.get(St.constructor);cr=await ur.filter.catch(St,On,rr,ir)}if(!pr&&this.protoMatchList.length){let ur;for(const On of this.protoMatchList){ur=On(St);if(ur){break}}if(ur){pr=true;const fr=this.exceptionMap.get(ur);cr=await fr.filter.catch(St,On,rr,ir)}}if(!pr&&this.defaultErrFilter){pr=true;cr=await this.defaultErrFilter.catch(St,On,rr,ir)}if(!pr){ur=St}return{result:cr,error:ur}}async runResultFilter(St,On,rr,ir){let cr=St;for(const St of this.matchFnList){if(St.matchFn(On,rr)){cr=await St.target.match(cr,On,rr,ir)}}return{result:cr,error:undefined}}}On.FilterManager=FilterManager},40581:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.GuardManager=void 0;const ir=rr(49757);class GuardManager extends Array{addGlobalGuard(St){if(!Array.isArray(St)){this.push(St)}else{this.push(...St)}}async runGuard(St,On,rr){for(const ir of this){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}const cr=(0,ir.getClassMetadata)(ir.GUARD_KEY,On);if(cr){for(const ir of cr){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}}const ur=(0,ir.getPropertyMetadata)(ir.GUARD_KEY,On,rr);if(ur){for(const ir of ur){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}}return true}}On.GuardManager=GuardManager},82535:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DefaultConsoleLoggerFactory=On.LoggerFactory=void 0;class LoggerFactory{}On.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(St,On){this.instance.set(St,console);return console}getLogger(St){return this.instance.get(St)}close(St){}removeLogger(St){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(St,On,rr){return On}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}On.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createMiddleware=On.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(St){if(Array.isArray(St)){this.unshift(...St)}else{this.unshift(St)}}insertLast(St){if(Array.isArray(St)){this.push(...St)}else{this.push(St)}}insertBefore(St,On){if(typeof On!=="number"){On=this.findItemIndex(On)}if(Array.isArray(St)){this.splice(On,0,...St)}else{this.splice(On,0,St)}}insertAfter(St,On){if(typeof On!=="number"){On=this.findItemIndex(On)}if(Array.isArray(St)){this.splice(On+1,0,...St)}else{this.splice(On+1,0,St)}}findAndInsertAfter(St,On){St=this.findItem(St);On=this.findItem(On);if(!St||!On||St===On){return}if(On){const rr=this.remove(St);if(rr){this.insertAfter(rr,On)}}}findAndInsertBefore(St,On){St=this.findItem(St);On=this.findItem(On);if(!St||!On||St===On){return}if(On){const rr=this.remove(St);if(rr){this.insertBefore(rr,On)}}}findAndInsertFirst(St){const On=this.remove(St);if(On){this.insertFirst(On)}}findAndInsertLast(St){const On=this.remove(St);if(On){this.insertLast(On)}}findItemIndex(St){if(typeof St==="number"){return St}else if(typeof St==="string"){return this.findIndex((On=>this.getMiddlewareName(On)===St))}else{return this.findIndex((On=>On===St))}}findItem(St){if(typeof St==="number"){if(St>=0&&St<=this.length-1){return this[St]}}else if(typeof St==="string"){return this.find((On=>this.getMiddlewareName(On)===St))}else{return St}}getMiddlewareName(St){var On,rr,ir;if(St["middleware"]){return(On=St.name)!==null&&On!==void 0?On:this.getMiddlewareName(St["middleware"])}return(ir=(rr=St.getName&&St.getName())!==null&&rr!==void 0?rr:St._name)!==null&&ir!==void 0?ir:St.name}remove(St){if(typeof St==="number"&&St!==-1){return this.splice(St,1)[0]}else{const On=this.findItemIndex(St);if(On!==-1){return this.splice(On,1)[0]}}}push(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.push(...St)}unshift(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.unshift(...St)}getNames(){return this.map((St=>this.getMiddlewareName(St)))}}On.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(St,On,rr){return{middleware:St,options:On,name:rr}}On.createMiddleware=createMiddleware},70032:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayInitializerPerformanceManager=On.MidwayPerformanceManager=void 0;const ir=rr(82987);class MidwayPerformanceManager{constructor(St){this.group=St;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(St){if(!this.instances.has(St)){this.instances.set(St,new MidwayPerformanceManager(St))}return this.instances.get(St)}formatKey(St,On){return`${this.group}:${St}-${On}`}markStart(St){const On=this.formatKey(St,"start");ir.performance.mark(On);this.marks.add(On)}markEnd(St){const On=this.formatKey(St,"start");const rr=this.formatKey(St,"end");const cr=`${this.group}:${St}`;ir.performance.mark(rr);this.marks.add(rr);ir.performance.measure(cr,On,rr);this.measures.add(cr)}observeMeasure(St){if(this.observer){return}this.observer=new ir.PerformanceObserver((On=>{const rr=On.getEntries().filter((St=>St.name.startsWith(`${this.group}:`)));if(rr.length>0){St({getEntries:()=>rr})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((St=>{try{ir.performance.clearMarks(St)}catch(On){console.warn(`Failed to clear mark ${St}: ${On}`)}}));this.marks.clear();this.measures.forEach((St=>{try{ir.performance.clearMeasures(St)}catch(On){console.warn(`Failed to clear measure ${St}: ${On}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((St=>St.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const St=[];ir.performance===null||ir.performance===void 0?void 0:ir.performance.getEntries().forEach((On=>{if(On.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){St.push(On.toJSON())}}));return St}}On.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(St){const On=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);On.markStart(St)}static markEnd(St){const On=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);On.markEnd(St)}static frameworkInitializeStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkInitializeEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkRunStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static frameworkRunEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static lifecycleStart(St,On){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${On}`)}static lifecycleEnd(St,On){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${On}`)}}On.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(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayPriorityManager=On.DEFAULT_PRIORITY=void 0;const cr=rr(49757);const ur=rr(6192);On.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let pr=class MidwayPriorityManager{constructor(){this.priorityList=On.DEFAULT_PRIORITY;this.defaultPriority=On.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L1}isMediumPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L2}isLowPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L3}getPriority(St){return St||this.getDefaultPriority()}};pr=ir([(0,cr.Provide)(),(0,cr.Scope)(ur.ScopeEnum.Singleton)],pr);On.MidwayPriorityManager=pr},64842:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ServiceFactory=void 0;const ur=rr(83486);const pr=rr(67934);const fr=rr(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(St={}){this.options=St;if(St.client){St.clients=St.clients||{};St.clients["default"]=St.clients["default"]||{};(0,ur.extend)(true,St.clients["default"],St.client)}if(St.clients){for(const On of Object.keys(St.clients)){await this.createInstance(St.clients[On],On)}}this.clientPriority=St.priority||{}}get(St="default"){return this.clients.get(St)}has(St){return this.clients.has(St)}async createInstance(St,On){St=(0,ur.extend)(true,{},this.options["default"],St);const rr=await this.createClient(St,On);if(rr){if(On){this.clients.set(On,rr)}return rr}}async destroyClient(St,On){}async stop(){for(const[St,On]of this.clients.entries()){await this.destroyClient(On,St)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(St){return this.priorityManager.getPriority(this.clientPriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.clientPriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.clientPriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.clientPriority[St])}}ir([(0,fr.Inject)(),cr("design:type",pr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);On.ServiceFactory=ServiceFactory},11330:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TypedResourceManager=void 0;class TypedResourceManager{constructor(St){this.typedResourceInitializerOptions=St;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(St,On){const rr=await this.typedResourceInitializerOptions.resourceInitialize(On,St);this.resourceMap.set(St,rr);return rr}async init(){for(const St of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const On=this.typedResourceInitializerOptions.initializeValue[St];const rr=this.typedResourceInitializerOptions.initializeClzProvider[St];const ir=await this.createResource(St,On);const cr=await this.typedResourceInitializerOptions.resourceBinding(rr,On,ir,St);if(cr){this.resourceBindingMap.set(St,cr)}}}async startParallel(){const St=[];for(const[On,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceStart(rr,this.typedResourceInitializerOptions.initializeValue[On],this.resourceBindingMap.get(On)))}await Promise.all(St)}async start(){for(const[St,On]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(On,this.typedResourceInitializerOptions.initializeValue[St],this.resourceBindingMap.get(St))}}async destroyParallel(){const St=[];for(const[On,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceDestroy(rr,this.typedResourceInitializerOptions.initializeValue[On]))}await Promise.all(St)}async destroy(){for(const[St,On]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(On,this.typedResourceInitializerOptions.initializeValue[St])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(St){return this.resourceMap.get(St)}}On.TypedResourceManager=TypedResourceManager},11026:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.WebControllerGenerator=void 0;const ir=rr(49757);const cr=rr(39023);const ur=rr(6192);const pr=rr(86314);const fr=rr(68220);const br=cr.debuglog("midway:debug");class WebControllerGenerator{constructor(St,On){this.app=St;this.midwayWebRouterService=On}generateKoaController(St){return async(On,rr)=>{if(St.controllerClz&&typeof St.method==="string"){const rr=await this.app.getFramework().runGuard(On,St.controllerClz,St.method);if(!rr){throw new pr.httpError.ForbiddenError}}const cr=[On,rr];let ur;if(typeof St.method!=="string"){ur=await St.method(On,rr)}else{const rr=await On.requestContext.getAsync(St.id);ur=await rr[St.method].apply(rr,cr)}if(ur!==undefined){if(ur===null){On.response._body=null;On.response._midwayControllerNullBody=true}else{On.body=ur}}if(Array.isArray(St.responseMetadata)&&St.responseMetadata.length){for(const rr of St.responseMetadata){switch(rr.type){case ir.WEB_RESPONSE_HTTP_CODE:On.status=rr.code;break;case ir.WEB_RESPONSE_HEADER:for(const St in(rr===null||rr===void 0?void 0:rr.setHeaders)||{}){On.set(St,rr.setHeaders[St])}break;case ir.WEB_RESPONSE_CONTENT_TYPE:On.type=rr.contentType;break;case ir.WEB_RESPONSE_REDIRECT:On.status=rr.code;On.redirect(rr.url);return}}}}}async loadMidwayController(St){var On,rr;const ir=await this.midwayWebRouterService.getRouterTable();const cr=await this.midwayWebRouterService.getRoutePriorityList();const pr=this.app.getApplicationContext();const Sr=this.app.getCoreLogger();const Er=pr.get(fr.MidwayMiddlewareService);for(const fr of cr){pr.bindClass(fr.routerModule);Sr.debug(`Load Controller "${fr.controllerId}", prefix=${fr.prefix}`);br(`[core]: Load Controller "${fr.controllerId}", prefix=${fr.prefix}`);const cr=this.createRouter({prefix:fr.prefix,...fr.routerOptions});fr.middleware=(On=fr.middleware)!==null&&On!==void 0?On:[];if(fr.middleware.length){const St=await Er.compose(fr.middleware,this.app);cr.use(St)}const kr=ir.get(fr.prefix);for(const St of kr){const On=[];St.middleware=(rr=St.middleware)!==null&&rr!==void 0?rr:[];if(St.middleware.length){const rr=await Er.compose(St.middleware,this.app);On.push(rr)}if(this.app.getFrameworkType()===ur.MidwayFrameworkType.WEB_KOA){if(typeof St.url==="string"&&/\*$/.test(St.url)){St.url=St.url.replace("*","(.*)")}}const ir=[St.routerName,St.url,...On,this.generateController(St)];Sr.debug(`Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);br(`[core]: Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);cr[St.requestMethod.toLowerCase()].apply(cr,ir)}St&&St(cr)}}}On.WebControllerGenerator=WebControllerGenerator},42193:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});const ir=rr(65308);On["default"]=St=>{const On=(0,ir.isDevelopmentEnvironment)((0,ir.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:On?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:On}}}},2222:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.SINGLETON_CONTAINER_CTX=On.IGNORE_PATTERN=On.DEFAULT_PATTERN=On.ASYNC_CONTEXT_MANAGER_KEY=On.ASYNC_CONTEXT_KEY=On.REQUEST_CTX_LOGGER_CACHE_KEY=On.HTTP_SERVER_KEY=On.CONTAINER_OBJ_SCOPE=On.REQUEST_OBJ_CTX_KEY=On.REQUEST_CTX_KEY=On.MIDWAY_LOGGER_WRITEABLE_DIR=On.FUNCTION_INJECT_KEY=On.KEYS=void 0;On.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"};On.FUNCTION_INJECT_KEY="midway:function_inject_key";On.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";On.REQUEST_CTX_KEY="ctx";On.REQUEST_OBJ_CTX_KEY="_req_ctx";On.CONTAINER_OBJ_SCOPE="_obj_scope";On.HTTP_SERVER_KEY="_midway_http_server";On.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";On.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");On.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";On.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];On.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];On.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayContainer=void 0;const ir=rr(49757);const cr=rr(24451);const ur=rr(39023);const pr=rr(20873);const fr=rr(6192);const br=rr(2222);const Sr=rr(47698);const Er=rr(34881);const kr=rr(80932);const Pr=rr(70275);const Ir=rr(78842);const Lr=rr(24434);const Br=rr(86314);const jr=rr(63289);const Ur=rr(65308);const Vr=ur.debuglog("midway:debug");const Wr=ur.debuglog("midway:bind");const zr=9;class ContainerConfiguration{constructor(St){this.container=St;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(St){let On=ir.MAIN_MODULE_KEY;const rr=this.getConfigurationExport(St);if(!rr.length)return;for(let St=0;St<rr.length;St++){const ur=rr[St];if(this.loadedMap.get(ur)){continue}let pr;if(ur instanceof cr.FunctionalConfiguration){pr=ur.getConfigurationOptions()}else{pr=(0,ir.getClassMetadata)(ir.CONFIGURATION_KEY,ur)}this.loadedMap.set(ur,true);if(pr){if(pr.namespace!==undefined){On=pr.namespace;this.namespaceList.push(On)}this.configurationOptionsList.push(pr);Vr(`[core]: load configuration in namespace="${On}"`);this.addImports(pr.imports);this.addImportObjects(pr.importObjects);this.addImportConfigs(pr.importConfigs);this.addImportConfigFilter(pr.importConfigFilter);this.bindConfigurationClass(ur,On)}}this.container.bindClass(St,{namespace:On})}addImportConfigs(St){if(St){if(Array.isArray(St)){this.container.get(Ir.MidwayConfigService).add(St)}else{this.container.get(Ir.MidwayConfigService).addObject(St)}}}addImportConfigFilter(St){if(St){this.container.get(Ir.MidwayConfigService).addFilter(St)}}addImports(St=[]){var On;for(let rr of St){if(!rr)continue;if(typeof rr==="string"){rr=require(rr)}if("Configuration"in rr){this.load(rr)}else if("component"in rr){if(rr===null||rr===void 0?void 0:rr.enabledEnvironment){if((On=rr===null||rr===void 0?void 0:rr.enabledEnvironment)===null||On===void 0?void 0:On.includes(this.container.get(Pr.MidwayEnvironmentService).getCurrentEnvironment())){this.load(rr.component)}}else{this.load(rr.component)}}else{this.load(rr)}}}addImportObjects(St){if(St){const On=Object.keys(St);for(const rr of On){if(typeof St[rr]!==undefined){this.container.registerObject(rr,St[rr])}}}}bindConfigurationClass(St,On){if(St instanceof cr.FunctionalConfiguration){}else{(0,ir.saveProviderId)(undefined,St);const rr=(0,ir.getProviderUUId)(St);this.container.bind(rr,St,{namespace:On,scope:fr.ScopeEnum.Singleton})}const rr=(0,ir.listModule)(ir.CONFIGURATION_KEY);const ur=rr.find((On=>On.target===St));if(!ur){(0,ir.saveModule)(ir.CONFIGURATION_KEY,{target:St,namespace:On})}}getConfigurationExport(St){const On=[];if(jr.Types.isClass(St)||jr.Types.isFunction(St)||St instanceof cr.FunctionalConfiguration){On.push(St)}else{for(const rr in St){const ir=St[rr];if(jr.Types.isClass(ir)||jr.Types.isFunction(ir)||ir instanceof cr.FunctionalConfiguration){On.push(ir)}}}return On}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(St){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=br.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=St;this.init()}init(){this.registerObject(br.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Lr}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new pr.ObjectDefinitionRegistry}return this._registry}set registry(St){this._registry=St}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new kr.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(St){var On,rr,ir;if(!Array.isArray(St)){St=[St]}const cr=new ContainerConfiguration(this);for(const On of St){if(On){cr.load(On)}}for(const St of cr.getNamespaceList()){this.namespaceSet.add(St);Vr(`[core]: load configuration in namespace="${St}" complete`)}const ur=(On=cr.getConfigurationOptionsList())!==null&&On!==void 0?On:[];const pr=(rr=ur.find((St=>!St.namespace)))!==null&&rr!==void 0?rr:{};this.fileDetector=(ir=pr.detector)!==null&&ir!==void 0?ir:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:pr.conflictCheck,...pr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(St,On){if(jr.Types.isClass(St)||jr.Types.isFunction(St)){this.bindModule(St,On)}else{for(const rr in St){const ir=St[rr];if(jr.Types.isClass(ir)||jr.Types.isFunction(ir)){this.bindModule(ir,On)}}}}bind(St,On,rr){var cr;if(jr.Types.isClass(St)||jr.Types.isFunction(St)){return this.bindModule(St,On)}if(this.registry.hasDefinition(St)){return}if(rr===null||rr===void 0?void 0:rr.bindHook){rr.bindHook(On,rr)}let ur;if(jr.Types.isClass(On)){ur=new Sr.ObjectDefinition;ur.name=(0,ir.getProviderName)(On)}else{ur=new Er.FunctionDefinition;if(!jr.Types.isAsyncFunction(On)){ur.asynchronous=false}ur.name=ur.id}ur.path=On;ur.id=St;ur.srcPath=(rr===null||rr===void 0?void 0:rr.srcPath)||null;ur.namespace=(rr===null||rr===void 0?void 0:rr.namespace)||"";ur.scope=(rr===null||rr===void 0?void 0:rr.scope)||fr.ScopeEnum.Request;ur.createFrom=rr===null||rr===void 0?void 0:rr.createFrom;if(ur.srcPath){Vr(`[core]: bind id "${ur.name} (${ur.srcPath}) ${St}"`)}else{Vr(`[core]: bind id "${ur.name}" ${St}`)}const pr=(0,ir.getPropertyInject)(On);for(const St in pr){const On=pr[St];Wr(`${" ".repeat(zr)}inject properties => [${JSON.stringify(On)}]`);const rr=new kr.ManagedReference;rr.args=On.args;rr.name=On.value;rr.injectMode=On["injectMode"];ur.properties.set(On["targetKey"],rr)}const br=(0,ir.getClassExtendedMetadata)(ir.INJECT_CUSTOM_PROPERTY,On);for(const St in br){const On=br[St];ur.handlerProps.push(On)}const Pr=(cr=(0,ir.getObjectDefinition)(On))!==null&&cr!==void 0?cr:{};if(Pr.initMethod){Wr(`${" ".repeat(zr)}register initMethod = ${Pr.initMethod}`);ur.initMethod=Pr.initMethod}if(Pr.destroyMethod){Wr(`${" ".repeat(zr)}register destroyMethod = ${Pr.destroyMethod}`);ur.destroyMethod=Pr.destroyMethod}if(Pr.scope){Wr(`${" ".repeat(zr)}register scope = ${Pr.scope}`);ur.scope=Pr.scope}if(Pr.allowDowngrade){Wr(`${" ".repeat(zr)}register allowDowngrade = ${Pr.allowDowngrade}`);ur.allowDowngrade=Pr.allowDowngrade}this.objectCreateEventTarget.emit(fr.ObjectLifeCycleEvent.BEFORE_BIND,On,{context:this,definition:ur,replaceCallback:St=>{ur=St}});if(ur){this.registry.registerDefinition(ur.id,ur)}}bindModule(St,On){if(jr.Types.isClass(St)){const rr=(0,ir.getProviderUUId)(St);if(rr){this.identifierMapping.saveClassRelation(St,On===null||On===void 0?void 0:On.namespace);this.bind(rr,St,On)}else{}}else{const rr=St[br.FUNCTION_INJECT_KEY];if(rr&&rr.id){if(!rr.scope){rr.scope=fr.ScopeEnum.Request}const ir=Ur.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(rr.id,ir);this.bind(ir,St,{scope:rr.scope,namespace:On.namespace,srcPath:On.srcPath,createFrom:On.createFrom})}}}setFileDetector(St){this.fileDetector=St}createChild(){return new MidwayContainer(this)}setAttr(St,On){this.attrMap.set(St,On)}getAttr(St){return this.attrMap.get(St)}getIdentifier(St){return(0,ir.getProviderUUId)(St)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new kr.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(St,On,rr){var ir;On=On!==null&&On!==void 0?On:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const cr=this.registry.getDefinition(St);if(!cr&&this.parent){return this.parent.get(St,On)}if(!cr){throw new Br.MidwayDefinitionNotFoundError((ir=rr===null||rr===void 0?void 0:rr.originName)!==null&&ir!==void 0?ir:St)}return this.getManagedResolverFactory().create({definition:cr,args:On})}async getAsync(St,On,rr){var ir;On=On!==null&&On!==void 0?On:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const cr=this.registry.getDefinition(St);if(!cr&&this.parent){return this.parent.getAsync(St,On)}if(!cr){throw new Br.MidwayDefinitionNotFoundError((ir=rr===null||rr===void 0?void 0:rr.originName)!==null&&ir!==void 0?ir:St)}return this.getManagedResolverFactory().createAsync({definition:cr,args:On})}registerObject(St,On){this.registry.registerObject(St,On)}onBeforeBind(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_BIND,St)}onBeforeObjectCreated(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_CREATED,St)}onObjectCreated(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.AFTER_CREATED,St)}onObjectInit(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.AFTER_INIT,St)}onBeforeObjectDestroy(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_DESTROY,St)}saveModule(St,On){if(!this.moduleMap.has(St)){this.moduleMap.set(St,new Set)}this.moduleMap.get(St).add(On)}listModule(St){return Array.from(this.moduleMap.get(St)||{})}transformModule(St){this.moduleMap=new Map(St)}hasNamespace(St){return this.namespaceSet.has(St)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(St){return this.registry.hasDefinition(St)}hasObject(St){return this.registry.hasObject(St)}getInstanceScope(St){if(St[br.CONTAINER_OBJ_SCOPE]){return St[br.CONTAINER_OBJ_SCOPE]}return undefined}}On.MidwayContainer=MidwayContainer},20873:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectDefinitionRegistry=void 0;const ir=rr(49757);const cr="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(St,On){const rr=(0,ir.getProviderUUId)(St);this.set(rr,rr);if(rr){const cr=(0,ir.getProviderId)(St);if(cr){this.set(cr,rr)}this.set((0,ir.getProviderName)(St),rr);if(On){this.set(On+":"+(0,ir.getProviderName)(St),rr)}}}saveFunctionRelation(St,On){this.set(On,On);this.set(St,On)}hasRelation(St){return this.has(St)}getRelation(St){return this.get(St)}}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(St){this._identifierRelation=St}get identifiers(){const St=[];for(const On of this.keys()){if(On.indexOf(cr)===-1){St.push(On)}}return St}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(St){const On=[];for(const rr of this.values()){const ir=rr;if(ir.name===St){On.push(ir)}}return On}registerDefinition(St,On){if(On.isSingletonScope()){this.singletonIds.push(St)}this.set(St,On)}getDefinition(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.get(St)}removeDefinition(St){this.delete(St)}hasDefinition(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.has(St)}clearAll(){this.singletonIds=[];this.clear()}hasObject(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.has(cr+St)}registerObject(St,On){this.set(cr+St,On)}getObject(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.get(cr+St)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(St){this.identifierRelation=St}}On.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ManagedResolverFactory=On.ManagedReference=void 0;const ir=rr(2222);const cr=rr(6192);const ur=rr(39023);const pr=rr(86314);const fr=ur.debuglog("midway:managedresolver");const br=ur.debuglog("midway:debug");class ManagedReference{constructor(){this.type=ir.KEYS.REF_ELEMENT}}On.ManagedReference=ManagedReference;class RefResolver{constructor(St){this.factory=St}get type(){return ir.KEYS.REF_ELEMENT}resolve(St,On){var rr;const ir=St;if(ir.injectMode===cr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(ir.name)){if(On==="loggerService"){throw new pr.MidwayInconsistentVersionError}else{throw new pr.MidwayMissingImportComponentError(On)}}return this.factory.context.get(ir.name,ir.args,{originName:On})}async resolveAsync(St,On){var rr;const ir=St;if(ir.injectMode===cr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(ir.name)){if(On==="loggerService"){throw new pr.MidwayInconsistentVersionError}else{throw new pr.MidwayMissingImportComponentError(On)}}return this.factory.context.getAsync(ir.name,ir.args,{originName:On})}}class ManagedResolverFactory{constructor(St){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=St;this.resolvers={ref:new RefResolver(this)}}registerResolver(St){this.resolvers[St.type]=St}resolveManaged(St,On){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new pr.MidwayResolverMissingError(St.type)}return rr.resolve(St,On)}async resolveManagedAsync(St,On){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new pr.MidwayResolverMissingError(St.type)}return rr.resolveAsync(St,On)}create(St){const{definition:On,args:rr}=St;if(On.isSingletonScope()&&this.singletonCache.has(On.id)){return this.singletonCache.get(On.id)}let ur=this.createProxyReference(On);if(ur){return ur}this.compareAndSetCreateStatus(On);if(On.hasDependsOn()){for(const St of On.dependsOn){this.context.get(St,rr)}}br(`[core]: Create id = "${On.name}" ${On.id}.`);const fr=On.creator.load();let Sr=[];if(rr&&Array.isArray(rr)&&rr.length>0){Sr=rr}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_CREATED,fr,{constructorArgs:Sr,definition:On,context:this.context});ur=On.creator.doConstruct(fr,Sr,this.context);if(On.isRequestScope()&&On.constructor.name==="ObjectDefinition"){Object.defineProperty(ur,ir.REQUEST_OBJ_CTX_KEY,{value:this.context.get(ir.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(On.properties){const St=On.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(On,rr);try{ur[rr]=this.resolveManaged(On.properties.get(rr),rr)}catch(St){if(pr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=On.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(On,true);throw St}}}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_CREATED,ur,{context:this.context,definition:On,replaceCallback:St=>{ur=St}});On.creator.doInit(ur);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_INIT,ur,{context:this.context,definition:On});if(On.id){if(On.isSingletonScope()){this.singletonCache.set(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Singleton)}else if(On.isRequestScope()){this.context.registerObject(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Request)}else{this.setInstanceScope(ur,cr.ScopeEnum.Prototype)}}this.removeCreateStatus(On,true);return ur}async createAsync(St){const{definition:On,args:rr}=St;if(On.isSingletonScope()&&this.singletonCache.has(On.id)){fr(`id = ${On.id}(${On.name}) get from singleton cache.`);return this.singletonCache.get(On.id)}let ur=this.createProxyReference(On);if(ur){fr(`id = ${On.id}(${On.name}) from proxy reference.`);return ur}this.compareAndSetCreateStatus(On);if(On.hasDependsOn()){for(const St of On.dependsOn){fr("id = %s init depend %s.",On.id,St);await this.context.getAsync(St,rr)}}br(`[core]: Create id = "${On.name}" ${On.id}.`);const Sr=On.creator.load();let Er=[];if(rr&&Array.isArray(rr)&&rr.length>0){Er=rr}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_CREATED,Sr,{constructorArgs:Er,context:this.context});ur=await On.creator.doConstructAsync(Sr,Er,this.context);if(!ur){this.removeCreateStatus(On,false);throw new pr.MidwayCommonError(`${On.id} construct return undefined`)}if(On.isRequestScope()&&On.constructor.name==="ObjectDefinition"){fr("id = %s inject ctx",On.id);Object.defineProperty(ur,ir.REQUEST_OBJ_CTX_KEY,{value:this.context.get(ir.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(On.properties){const St=On.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(On,rr);try{ur[rr]=await this.resolveManagedAsync(On.properties.get(rr),rr)}catch(St){if(pr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=On.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(On,false);throw St}}}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_CREATED,ur,{context:this.context,definition:On,replaceCallback:St=>{ur=St}});await On.creator.doInitAsync(ur);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_INIT,ur,{context:this.context,definition:On});if(On.id){if(On.isSingletonScope()){fr(`id = ${On.id}(${On.name}) set to singleton cache`);this.singletonCache.set(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Singleton)}else if(On.isRequestScope()){fr(`id = ${On.id}(${On.name}) set to register object`);this.context.registerObject(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Request)}else{this.setInstanceScope(ur,cr.ScopeEnum.Prototype)}}this.removeCreateStatus(On,true);return ur}async destroyCache(){for(const St of this.singletonCache.keys()){const On=this.context.registry.getDefinition(St);if(On.creator){const rr=this.singletonCache.get(St);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_DESTROY,rr,{context:this.context,definition:On});await On.creator.doDestroyAsync(rr)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(St,On){if(this.creating.has(St.id)){this.creating.set(St.id,false)}return true}isCreating(St){return this.creating.has(St.id)&&this.creating.get(St.id)}compareAndSetCreateStatus(St){if(!this.creating.has(St.id)||!this.creating.get(St.id)){this.creating.set(St.id,true)}}createProxyReference(St){if(this.isCreating(St)){fr("create proxy for %s.",St.id);if(!this.depthFirstSearch(St.id,St)){fr("id = %s after dfs return null",St.id);return null}return new Proxy({__is_proxy__:true,__target_id__:St.id},{get:(On,rr)=>{let ir;if(St.isRequestScope()){ir=this.context.registry.getObject(St.id)}else if(St.isSingletonScope()){ir=this.singletonCache.get(St.id)}else{ir=this.context.get(St.id)}if(ir){if(typeof ir[rr]==="function"){return ir[rr].bind(ir)}return ir[rr]}return undefined}})}return null}depthFirstSearch(St,On,rr){var ir;if(On){fr("dfs for %s == %s start.",St,On.id);if(On.properties){const cr=On.properties.propertyKeys();if(cr.indexOf(St)>-1){fr("dfs exist in properties %s == %s.",St,On.id);return true}for(const ur of cr){if(!Array.isArray(rr)){rr=[St]}let cr=ur;const pr=On.properties.get(ur);if(pr&&pr.name){cr=(ir=this.context.identifierMapping.getRelation(pr.name))!==null&&ir!==void 0?ir:pr.name}if(cr===St){fr("dfs exist in properties key %s == %s.",St,On.id);return true}if(rr.indexOf(cr)>-1){fr("dfs depth circular %s == %s, %s, %j.",St,On.id,cr,rr);continue}else{rr.push(cr);fr("dfs depth push %s == %s, %j.",St,cr,rr)}let br=this.context.registry.getDefinition(cr);if(!br&&this.context.parent){br=this.context.parent.registry.getDefinition(cr)}if(this.depthFirstSearch(St,br,rr)){fr("dfs exist in sub tree %s == %s subId = %s.",St,On.id,br.id);return true}}}fr("dfs for %s == %s end.",St,On.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(St,On){if(St.isSingletonScope()){const rr=St.properties.get(On);if(this.context.hasDefinition(rr===null||rr===void 0?void 0:rr.name)){const On=this.context.registry.getDefinition(rr.name);if(On.isRequestScope()&&!On.allowDowngrade){throw new pr.MidwaySingletonInjectRequestError(St.path.name,On.path.name)}}}return true}setInstanceScope(St,On){if(typeof St==="object"){if(On===cr.ScopeEnum.Request&&St[ir.REQUEST_OBJ_CTX_KEY]===ir.SINGLETON_CONTAINER_CTX){On=cr.ScopeEnum.Singleton}Object.defineProperty(St,ir.CONTAINER_OBJ_SCOPE,{value:On,writable:false,enumerable:false,configurable:false})}}}On.ManagedResolverFactory=ManagedResolverFactory},28695:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.providerWrapper=void 0;const ir=rr(2222);function providerWrapper(St){for(const On of St){Object.defineProperty(On.provider,ir.FUNCTION_INJECT_KEY,{value:On,writable:false})}}On.providerWrapper=providerWrapper},97983:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayRequestContainer=void 0;const ir=rr(9288);const cr=rr(49757);const ur=rr(2222);class MidwayRequestContainer extends ir.MidwayContainer{constructor(St,On){super(On);this.applicationContext=On;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=St;this.registerObject(ur.REQUEST_CTX_KEY,St);this.registerObject("res",{});if(St.logger){this.registerObject("logger",St.logger)}}init(){}get(St,On){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===cr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:rr,args:On})}}if(this.parent){return this.parent.get(St,On)}}async getAsync(St,On){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===cr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:rr,args:On})}}if(this.parent){return this.parent.getAsync(St,On)}}async ready(){}getContext(){return this.ctx}}On.MidwayRequestContainer=MidwayRequestContainer},76271:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Aspect=void 0;const ir=rr(49757);const cr=rr(18025);const ur=rr(6192);function Aspect(St,On,rr){return function(pr){(0,ir.saveModule)(ir.ASPECT_KEY,pr);const fr=[].concat(St);for(const St of fr){(0,ir.attachClassMetadata)(ir.ASPECT_KEY,{aspectTarget:St,match:On,priority:rr},pr)}(0,cr.Scope)(ur.ScopeEnum.Singleton)(pr);(0,ir.Provide)()(pr)}}On.Aspect=Aspect},2940:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Autoload=void 0;const ir=rr(45317);const cr=rr(39990);function Autoload(){return function(St){(0,ir.savePreloadModule)(St);(0,cr.Provide)()(St)}}On.Autoload=Autoload},73821:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;const ir=rr(49757);function Configuration(St={}){return On=>{(0,ir.saveClassMetadata)(ir.CONFIGURATION_KEY,St,On)}}On.Configuration=Configuration},41573:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Match=On.Catch=void 0;const ir=rr(45317);const cr=rr(75105);const ur=rr(18025);const pr=rr(39990);const fr=rr(6192);function Catch(St,On={}){return function(rr){const br=St?[].concat(St):undefined;(0,ir.saveClassMetadata)(cr.CATCH_KEY,{catchTargets:br,catchOptions:On},rr);(0,ur.Scope)(fr.ScopeEnum.Singleton)(rr);(0,pr.Provide)()(rr)}}On.Catch=Catch;function Match(St=true){return function(On){(0,ir.saveClassMetadata)(cr.MATCH_KEY,{matchPattern:St},On);(0,ur.Scope)(fr.ScopeEnum.Singleton)(On);(0,pr.Provide)()(On)}}On.Match=Match},1623:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApplicationContext=On.Logger=On.App=On.Config=On.Plugin=On.Framework=void 0;const ir=rr(49757);const cr=rr(6192);function Framework(){return St=>{(0,ir.saveModule)(ir.FRAMEWORK_KEY,St);(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Framework=Framework;function Plugin(St){return(0,ir.createCustomPropertyDecorator)(ir.PLUGIN_KEY,{identifier:St})}On.Plugin=Plugin;function Config(St){return(0,ir.createCustomPropertyDecorator)(ir.CONFIG_KEY,{identifier:St})}On.Config=Config;function App(St){return(0,ir.createCustomPropertyDecorator)(ir.APPLICATION_KEY,{type:St})}On.App=App;function Logger(St){return(0,ir.createCustomPropertyDecorator)(ir.LOGGER_KEY,{identifier:St})}On.Logger=Logger;function ApplicationContext(){return(0,ir.createCustomPropertyDecorator)(ir.APPLICATION_CONTEXT_KEY,{})}On.ApplicationContext=ApplicationContext},41958:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Guard=On.UseGuard=void 0;const ir=rr(45317);const cr=rr(6192);const ur=rr(75105);const pr=rr(39990);const fr=rr(18025);function UseGuard(St){return(On,rr,cr)=>{if(!Array.isArray(St)){St=[St]}if(rr){(0,ir.savePropertyMetadata)(ur.GUARD_KEY,St,On,rr)}else{(0,ir.saveClassMetadata)(ur.GUARD_KEY,St,On)}}}On.UseGuard=UseGuard;function Guard(){return St=>{(0,pr.Provide)()(St);(0,fr.Scope)(cr.ScopeEnum.Singleton)(St)}}On.Guard=Guard},92922:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.InjectClient=On.Inject=void 0;const ir=rr(45317);const cr=rr(75105);function Inject(St){return function(On,rr){(0,ir.savePropertyInject)({target:On,targetKey:rr,identifier:St})}}On.Inject=Inject;function InjectClient(St,On){return(0,ir.createCustomPropertyDecorator)(cr.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:St,clientName:On})}On.InjectClient=InjectClient},17511:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Middleware=void 0;const ir=rr(49757);const cr=rr(6192);function Middleware(){return St=>{(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Middleware=Middleware},56329:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Mock=void 0;const ir=rr(49757);const cr=rr(6192);function Mock(){return St=>{(0,ir.saveModule)(ir.MOCK_KEY,St);(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Mock=Mock},18025:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Singleton=On.Scope=On.Destroy=On.Init=void 0;const ir=rr(45317);const cr=rr(39990);const ur=rr(6192);function Init(){return function(St,On){(0,ir.saveObjectDefinition)(St,{initMethod:On})}}On.Init=Init;function Destroy(){return function(St,On){(0,ir.saveObjectDefinition)(St,{destroyMethod:On})}}On.Destroy=Destroy;function Scope(St,On){return function(rr){(0,ir.saveObjectDefinition)(rr,{scope:St,...On})}}On.Scope=Scope;function Singleton(){return function(St){Scope(ur.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}On.Singleton=Singleton},64331:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Pipe=void 0;const ir=rr(49757);const cr=rr(6192);function Pipe(){return St=>{(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Pipe=Pipe},52953:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Pipeline=void 0;const ir=rr(45317);const cr=rr(75105);function Pipeline(St){return(0,ir.createCustomPropertyDecorator)(cr.PIPELINE_IDENTIFIER,{valves:St})}On.Pipeline=Pipeline},39990:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Provide=void 0;const ir=rr(45317);function Provide(St){return function(On){return(0,ir.saveProviderId)(St,On)}}On.Provide=Provide},75105:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TAGGED_CLS=On.INJECT_CUSTOM_PARAM=On.INJECT_CUSTOM_METHOD=On.INJECT_CUSTOM_PROPERTY=On.INJECT_TAG=On.NAMED_TAG=On.CLASS_KEY_CONSTRUCTOR=On.APPLICATION_CONTEXT_KEY=On.APPLICATION_KEY=On.LOGGER_KEY=On.PLUGIN_KEY=On.CONFIG_KEY=On.MS_HSF_METHOD_KEY=On.MS_DUBBO_METHOD_KEY=On.MS_GRPC_METHOD_KEY=On.MS_PROVIDER_KEY=On.MS_PRODUCER_KEY=On.MS_CONSUMER_KEY=On.RPC_DUBBO_KEY=On.RPC_GRPC_KEY=On.HSF_KEY=On.WS_EVENT_KEY=On.WS_CONTROLLER_KEY=On.MODULE_TASK_QUEUE_OPTIONS=On.MODULE_TASK_QUEUE_KEY=On.MODULE_TASK_TASK_LOCAL_OPTIONS=On.MODULE_TASK_TASK_LOCAL_KEY=On.MODULE_TASK_METADATA=On.MODULE_TASK_KEY=On.WEB_RESPONSE_RENDER=On.WEB_RESPONSE_CONTENT_TYPE=On.WEB_RESPONSE_HEADER=On.WEB_RESPONSE_REDIRECT=On.WEB_RESPONSE_HTTP_CODE=On.WEB_RESPONSE_KEY=On.WEB_ROUTER_PARAM_KEY=On.WEB_ROUTER_KEY=On.CONTROLLER_KEY=On.SERVERLESS_FUNC_KEY=On.FUNC_KEY=On.FACTORY_SERVICE_CLIENT_KEY=On.MOCK_KEY=On.GUARD_KEY=On.MATCH_KEY=On.CATCH_KEY=On.ASPECT_KEY=On.FRAMEWORK_KEY=On.CONFIGURATION_KEY=On.SCHEDULE_KEY=On.ALL=void 0;On.PRIVATE_META_DATA_KEY=On.MAIN_MODULE_KEY=On.LIFECYCLE_IDENTIFIER_PREFIX=On.PIPELINE_IDENTIFIER=On.OBJ_DEF_CLS=On.TAGGED_FUN=void 0;On.ALL="common:all_value_key";On.SCHEDULE_KEY="common:schedule";On.CONFIGURATION_KEY="common:configuration";On.FRAMEWORK_KEY="common:framework";On.ASPECT_KEY="common:aspect";On.CATCH_KEY="common:catch";On.MATCH_KEY="common:match";On.GUARD_KEY="common:guard";On.MOCK_KEY="common:mock";On.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";On.FUNC_KEY="faas:func";On.SERVERLESS_FUNC_KEY="faas:serverless:function";On.CONTROLLER_KEY="web:controller";On.WEB_ROUTER_KEY="web:router";On.WEB_ROUTER_PARAM_KEY="web:router_param";On.WEB_RESPONSE_KEY="web:response";On.WEB_RESPONSE_HTTP_CODE="web:response_http_code";On.WEB_RESPONSE_REDIRECT="web:response_redirect";On.WEB_RESPONSE_HEADER="web:response_header";On.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";On.WEB_RESPONSE_RENDER="web:response_render";On.MODULE_TASK_KEY="task:task";On.MODULE_TASK_METADATA="task:task:options";On.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";On.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";On.MODULE_TASK_QUEUE_KEY="task:task:queue";On.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";On.WS_CONTROLLER_KEY="ws:controller";On.WS_EVENT_KEY="ws:event";On.HSF_KEY="rpc:hsf";On.RPC_GRPC_KEY="rpc:grpc";On.RPC_DUBBO_KEY="rpc:dubbo";On.MS_CONSUMER_KEY="ms:consumer";On.MS_PRODUCER_KEY="ms:producer";On.MS_PROVIDER_KEY="ms:provider";On.MS_GRPC_METHOD_KEY="ms:grpc:method";On.MS_DUBBO_METHOD_KEY="ms:dubbo:method";On.MS_HSF_METHOD_KEY="ms:hsf:method";On.CONFIG_KEY="config";On.PLUGIN_KEY="plugin";On.LOGGER_KEY="logger";On.APPLICATION_KEY="__midway_framework_app__";On.APPLICATION_CONTEXT_KEY="__midway_application_context__";On.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";On.NAMED_TAG="named";On.INJECT_TAG="inject";On.INJECT_CUSTOM_PROPERTY="inject_custom_property";On.INJECT_CUSTOM_METHOD="inject_custom_method";On.INJECT_CUSTOM_PARAM="inject_custom_param";On.TAGGED_CLS="injection:tagged_class";On.TAGGED_FUN="injection:tagged_function";On.OBJ_DEF_CLS="injection:object_definition_class";On.PIPELINE_IDENTIFIER="__pipeline_identifier__";On.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";On.MAIN_MODULE_KEY="__main__";On.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createCustomParamDecorator=On.createCustomMethodDecorator=On.createCustomPropertyDecorator=On.getMethodReturnTypes=On.getPropertyType=On.getMethodParamTypes=On.BaseType=On.isProvide=On.getProviderUUId=On.getProviderName=On.getProviderId=On.saveProviderId=On.getObjectDefinition=On.saveObjectDefinition=On.getPropertyInject=On.savePropertyInject=On.transformTypeFromTSDesign=On.clearAllModule=On.resetModule=On.listModule=On.clearBindContainer=On.bindContainer=On.saveModule=On.listPreloadModule=On.savePreloadModule=On.getPropertyMetadata=On.attachPropertyMetadata=On.savePropertyMetadata=On.listPropertyDataFromClass=On.getPropertyDataFromClass=On.attachPropertyDataToClass=On.savePropertyDataToClass=On.getClassMetadata=On.getClassExtendedMetadata=On.attachClassMetadata=On.saveClassMetadata=On.DecoratorManager=On.INJECT_CLASS_KEY_PREFIX=On.PRELOAD_MODULE_KEY=void 0;rr(37159);const ir=rr(6192);const cr=rr(75105);const ur=rr(63289);const pr=rr(90406);const fr=rr(65308);const br=rr(61327);const Sr=rr(39023).debuglog("midway:core");On.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";On.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=On.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(St,On){if(this.container){return this.container.saveModule(St,On)}if(!this.has(St)){this.set(St,new Set)}this.get(St).add(On)}listModule(St){if(this.container){return this.container.listModule(St)}return Array.from(this.get(St)||{})}resetModule(St){this.set(St,new Set)}bindContainer(St){this.container=St;this.container.transformModule(this)}static getDecoratorClassKey(St){return St.toString()+"_CLS"}static removeDecoratorClassKeySuffix(St){return St.toString().replace("_CLS","")}static getDecoratorMethodKey(St){return St.toString()+"_METHOD"}static getDecoratorClsExtendedKey(St){return St.toString()+"_EXT"}static getDecoratorClsMethodPrefix(St){return St.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(St,On){return DecoratorManager.getDecoratorClsMethodPrefix(St)+":"+On.toString()}static getDecoratorMethod(St,On){return DecoratorManager.getDecoratorMethodKey(St)+"_"+On.toString()}static saveMetadata(St,On,rr,ir){if(typeof On==="object"&&On.constructor){On=On.constructor}let cr;if(Reflect.hasOwnMetadata(St,On)){cr=Reflect.getMetadata(St,On)}else{cr=new Map}cr.set(rr,ir);Reflect.defineMetadata(St,cr,On)}static attachMetadata(St,On,rr,ir,cr,ur="one"){if(typeof On==="object"&&On.constructor){On=On.constructor}let pr;if(Reflect.hasOwnMetadata(St,On)){pr=Reflect.getMetadata(St,On)}else{pr=new Map}if(!pr.has(rr)){if(cr){pr.set(rr,{})}else{pr.set(rr,[])}}if(cr){if(ur==="one"){pr.get(rr)[cr]=ir}else{if(pr.get(rr)[cr]){pr.get(rr)[cr].push(ir)}else{pr.get(rr)[cr]=[ir]}}}else{pr.get(rr).push(ir)}Reflect.defineMetadata(St,pr,On)}static getMetadata(St,On,rr){if(typeof On==="object"&&On.constructor){On=On.constructor}let ir;if(!Reflect.hasOwnMetadata(St,On)){ir=new Map;Reflect.defineMetadata(St,ir,On)}else{ir=Reflect.getMetadata(St,On)}if(!rr){return ir}return ir.get(rr)}saveMetadata(St,On,rr,ir){if(ir){const cr=DecoratorManager.getDecoratorMethod(St,ir);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,rr,cr,On)}else{const ir=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,rr,ir,On)}}attachMetadata(St,On,rr,ir,cr,ur){if(ir){const pr=DecoratorManager.getDecoratorMethod(St,ir);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,rr,pr,On,cr,ur)}else{const ir=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,rr,ir,On,cr,ur)}}getMetadata(St,On,rr){if(rr){const ir=DecoratorManager.getDecoratorMethod(St,rr);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,On,ir)}else{const rr=`${DecoratorManager.getDecoratorClassKey(St)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,On,rr)}}savePropertyDataToClass(St,On,rr,ir){const cr=DecoratorManager.getDecoratorClsMethodKey(St,ir);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,rr,cr,On)}attachPropertyDataToClass(St,On,rr,ir,cr){const ur=DecoratorManager.getDecoratorClsMethodKey(St,ir);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,rr,ur,On,cr)}getPropertyDataFromClass(St,On,rr){const ir=DecoratorManager.getDecoratorClsMethodKey(St,rr);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,On,ir)}listPropertyDataFromClass(St,On){const rr=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,On);const ir=[];for(const[On,cr]of rr){if(On.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(St))!==-1){ir.push(cr)}}return ir}}On.DecoratorManager=DecoratorManager;let Er=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 St=(0,br.getModuleRequirePathList)("@midwayjs/core");if(St.length){console.info("The module may be located in:");St.forEach(((St,On)=>{console.info(`${On+1}. ${St}`)}))}Er=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=Er}}function saveClassMetadata(St,On,rr,ir){if(ir&&typeof On==="object"){const ir=Er.getMetadata(St,rr);if(!ir){return Er.saveMetadata(St,On,rr)}if(Array.isArray(ir)){return Er.saveMetadata(St,ir.concat(On),rr)}else{return Er.saveMetadata(St,Object.assign(ir,On),rr)}}else{return Er.saveMetadata(St,On,rr)}}On.saveClassMetadata=saveClassMetadata;function attachClassMetadata(St,On,rr,ir,cr){return Er.attachMetadata(St,On,rr,undefined,ir,cr)}On.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(St,On,rr,ir){if(ir===undefined){ir=true}const cr=DecoratorManager.getDecoratorClsExtendedKey(St);let ur=Er.getMetadata(cr,On,rr);if(ir&&ur!==undefined){return ur}const pr=Reflect.getPrototypeOf(On);if(pr&&pr.constructor!==Object){ur=(0,fr.merge)(getClassExtendedMetadata(St,pr,rr,ir),Er.getMetadata(St,On,rr))}Er.saveMetadata(cr,ur||null,On,rr);return ur}On.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(St,On){return Er.getMetadata(St,On)}On.getClassMetadata=getClassMetadata;function savePropertyDataToClass(St,On,rr,ir){return Er.savePropertyDataToClass(St,On,rr,ir)}On.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(St,On,rr,ir,cr){return Er.attachPropertyDataToClass(St,On,rr,ir,cr)}On.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(St,On,rr){return Er.getPropertyDataFromClass(St,On,rr)}On.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(St,On){return Er.listPropertyDataFromClass(St,On)}On.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(St,On,rr,ir){return Er.saveMetadata(St,On,rr,ir)}On.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(St,On,rr,ir){return Er.attachMetadata(St,On,rr,ir)}On.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(St,On,rr){return Er.getMetadata(St,On,rr)}On.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(St){return saveModule(On.PRELOAD_MODULE_KEY,St)}On.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(On.PRELOAD_MODULE_KEY)}On.listPreloadModule=listPreloadModule;function saveModule(St,On){if((0,ur.isClass)(On)){saveProviderId(undefined,On)}return Er.saveModule(St,On)}On.saveModule=saveModule;function bindContainer(St){return Er.bindContainer(St)}On.bindContainer=bindContainer;function clearBindContainer(){return Er.container=null}On.clearBindContainer=clearBindContainer;function listModule(St,On){const rr=Er.listModule(St);if(On){return rr.filter(On)}else{return rr}}On.listModule=listModule;function resetModule(St){return Er.resetModule(St)}On.resetModule=resetModule;function clearAllModule(){Sr("--- clear all module here ---");return Er.clear()}On.clearAllModule=clearAllModule;function transformTypeFromTSDesign(St){if((0,ur.isNullOrUndefined)(St)){return{name:"undefined",isBaseType:true,originDesign:St}}switch(St.name){case"String":return{name:"string",isBaseType:true,originDesign:St};case"Number":return{name:"number",isBaseType:true,originDesign:St};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:St};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:St};case"Object":return{name:"object",isBaseType:true,originDesign:St};case"Function":return{name:"function",isBaseType:true,originDesign:St};default:return{name:St.name,isBaseType:false,originDesign:St}}}On.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(St){let On=St.identifier;let rr=ir.InjectModeEnum.Identifier;if(!On){const cr=getPropertyType(St.target,St.targetKey);if(!cr.isBaseType&&(0,ur.isClass)(cr.originDesign)&&isProvide(cr.originDesign)){On=getProviderUUId(cr.originDesign);rr=ir.InjectModeEnum.Class}if(!On){On=St.targetKey;rr=ir.InjectModeEnum.PropertyName}}attachClassMetadata(cr.INJECT_TAG,{targetKey:St.targetKey,value:On,args:St.args,injectMode:rr},St.target,St.targetKey)}On.savePropertyInject=savePropertyInject;function getPropertyInject(St,On){return getClassExtendedMetadata(cr.INJECT_TAG,St,undefined,On)}On.getPropertyInject=getPropertyInject;function saveObjectDefinition(St,On={}){saveClassMetadata(cr.OBJ_DEF_CLS,On,St,true);return St}On.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(St){return getClassExtendedMetadata(cr.OBJ_DEF_CLS,St)}On.getObjectDefinition=getObjectDefinition;function saveProviderId(St,On){if(isProvide(On)){if(St){const rr=getClassMetadata(cr.TAGGED_CLS,On);if(rr.id!==St){rr.id=St;saveClassMetadata(cr.TAGGED_CLS,rr,On);Sr(`update provide: ${On.name} -> ${rr.uuid}`)}}}else{const rr=(0,fr.generateRandomId)();saveClassMetadata(cr.TAGGED_CLS,{id:St,originName:On.name,uuid:rr,name:(0,pr.camelCase)(On.name)},On);Sr(`save provide: ${On.name} -> ${rr}`)}return On}On.saveProviderId=saveProviderId;function getProviderId(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.id){return On.id}}On.getProviderId=getProviderId;function getProviderName(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.name){return On.name}}On.getProviderName=getProviderName;function getProviderUUId(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.uuid){return On.uuid}}On.getProviderUUId=getProviderUUId;function isProvide(St){return!!getClassMetadata(cr.TAGGED_CLS,St)}On.isProvide=isProvide;var kr;(function(St){St["Boolean"]="boolean";St["Number"]="number";St["String"]="string"})(kr=On.BaseType||(On.BaseType={}));function getMethodParamTypes(St,On){if((0,ur.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:paramtypes",St,On)}On.getMethodParamTypes=getMethodParamTypes;function getPropertyType(St,On){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",St,On))}On.getPropertyType=getPropertyType;function getMethodReturnTypes(St,On){if((0,ur.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:returntype",St,On)}On.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(St,On,rr=true){return function(ir,ur){attachClassMetadata(cr.INJECT_CUSTOM_PROPERTY,{propertyName:ur,key:St,metadata:On,impl:rr},ir,ur)}}On.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(St,On,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(ir,ur,pr){attachClassMetadata(cr.INJECT_CUSTOM_METHOD,{propertyName:ur,key:St,metadata:On,options:rr},ir)}}On.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(St,On,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(ir,ur,pr){attachClassMetadata(cr.INJECT_CUSTOM_PARAM,{key:St,parameterIndex:pr,propertyName:ur,metadata:On,options:rr},ir,ur,"multi")}}On.createCustomParamDecorator=createCustomParamDecorator},69193:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerlessTrigger=On.ServerlessFunction=void 0;const ir=rr(49757);const cr=rr(6192);function ServerlessFunction(St){return(On,rr,cr)=>{(0,ir.savePropertyMetadata)(ir.SERVERLESS_FUNC_KEY,St,On,rr)}}On.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(St,On={}){return(rr,ur,pr)=>{var fr;if(St===cr.ServerlessTriggerType.HTTP||St===cr.ServerlessTriggerType.API_GATEWAY){On["method"]=(fr=On["method"])!==null&&fr!==void 0?fr:"get"}(0,ir.saveModule)(ir.FUNC_KEY,rr.constructor);On=On||{};(0,ir.attachClassMetadata)(ir.FUNC_KEY,{type:St,methodName:ur,metadata:On},rr)}}On.ServerlessTrigger=ServerlessTrigger},49757:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(39990),On);cr(rr(92922),On);cr(rr(52953),On);cr(rr(76271),On);cr(rr(2940),On);cr(rr(73821),On);cr(rr(18025),On);cr(rr(1623),On);cr(rr(41573),On);cr(rr(17511),On);cr(rr(41958),On);cr(rr(64331),On);cr(rr(56329),On);cr(rr(69193),On);cr(rr(86690),On);cr(rr(58843),On);cr(rr(29619),On);cr(rr(92233),On);cr(rr(75105),On);cr(rr(45317),On);cr(rr(573),On);cr(rr(4132),On);cr(rr(76543),On);cr(rr(64767),On);cr(rr(41684),On);cr(rr(17640),On);cr(rr(81970),On);cr(rr(52963),On);cr(rr(57706),On);cr(rr(67999),On);cr(rr(20551),On)},573:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Consumer=void 0;const ir=rr(49757);const cr=rr(6192);function Consumer(St,On={}){return rr=>{(0,ir.saveModule)(ir.MS_CONSUMER_KEY,rr);(0,ir.saveClassMetadata)(ir.MS_CONSUMER_KEY,{type:St,metadata:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Consumer=Consumer},64767:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.KafkaListener=void 0;const ir=rr(49757);function KafkaListener(St,On={}){return(rr,cr)=>{On.topic=St;On.propertyKey=cr;(0,ir.attachPropertyDataToClass)(ir.MS_CONSUMER_KEY,On,rr,cr)}}On.KafkaListener=KafkaListener},4132:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DubboMethod=On.GrpcMethod=On.GrpcStreamTypeEnum=On.Provider=void 0;const ir=rr(49757);const cr=rr(6192);function Provider(St,On={}){return rr=>{(0,ir.saveModule)(ir.MS_PROVIDER_KEY,rr);(0,ir.saveClassMetadata)(ir.MS_PROVIDER_KEY,{type:St,metadata:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Provider=Provider;var ur;(function(St){St["BASE"]="base";St["DUPLEX"]="ServerDuplexStream";St["READABLE"]="ServerReadableStream";St["WRITEABLE"]="ServerWritableStream"})(ur=On.GrpcStreamTypeEnum||(On.GrpcStreamTypeEnum={}));function GrpcMethod(St={}){return(On,rr,cr)=>{if(!St.type){St.type=ur.BASE}(0,ir.savePropertyMetadata)(ir.MS_GRPC_METHOD_KEY,{methodName:St.methodName||rr,type:St.type,onEnd:St.onEnd},On,rr);return cr}}On.GrpcMethod=GrpcMethod;function DubboMethod(St){return(On,rr,cr)=>{(0,ir.attachClassMetadata)(ir.MS_DUBBO_METHOD_KEY,{methodName:St||rr},On);return cr}}On.DubboMethod=DubboMethod},76543:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.RabbitMQListener=void 0;const ir=rr(49757);function RabbitMQListener(St,On={}){return(rr,cr)=>{On.queueName=St;On.propertyKey=cr;(0,ir.attachPropertyDataToClass)(ir.MS_CONSUMER_KEY,On,rr,cr)}}On.RabbitMQListener=RabbitMQListener},41684:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HSF=void 0;const ir=rr(49757);const cr=rr(6192);function HSF(St={}){return On=>{(0,ir.saveModule)(ir.HSF_KEY,On);(0,ir.saveClassMetadata)(ir.HSF_KEY,St,On);(0,ir.Scope)(cr.ScopeEnum.Request)(On);(0,ir.Provide)()(On)}}On.HSF=HSF},17640:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Queue=void 0;const ir=rr(49757);const cr=rr(75105);function Queue(St){return function(On){(0,ir.saveModule)(cr.MODULE_TASK_QUEUE_KEY,On);(0,ir.saveClassMetadata)(cr.MODULE_TASK_QUEUE_OPTIONS,{options:St,name:On.name},On);(0,ir.Provide)()(On)}}On.Queue=Queue},57706:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Schedule=void 0;const ir=rr(49757);const cr=rr(6192);function Schedule(St){return function(On){(0,ir.saveModule)(ir.SCHEDULE_KEY,On);(0,ir.saveClassMetadata)(ir.SCHEDULE_KEY,St,On);(0,ir.Scope)(cr.ScopeEnum.Request)(On);(0,ir.Provide)()(On)}}On.Schedule=Schedule},81970:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Task=void 0;const ir=rr(49757);const cr=rr(75105);function Task(St){return function(On,rr,ur){(0,ir.saveModule)(cr.MODULE_TASK_KEY,On.constructor);(0,ir.attachClassMetadata)(cr.MODULE_TASK_METADATA,{options:St,propertyKey:rr,value:ur.value,name:On.constructor.name},On)}}On.Task=Task},52963:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TaskLocal=void 0;const ir=rr(49757);const cr=rr(75105);function TaskLocal(St){return function(On,rr,ur){(0,ir.saveModule)(cr.MODULE_TASK_TASK_LOCAL_KEY,On.constructor);(0,ir.attachClassMetadata)(cr.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:St,propertyKey:rr,value:ur.value},On)}}On.TaskLocal=TaskLocal},86690:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Controller=void 0;const ir=rr(49757);const cr=rr(6192);function Controller(St="/",On={middleware:[],sensitive:true}){return rr=>{(0,ir.saveModule)(ir.CONTROLLER_KEY,rr);if(St)(0,ir.saveClassMetadata)(ir.CONTROLLER_KEY,{prefix:St,routerOptions:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Controller=Controller},58843:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Fields=On.Queries=On.RequestIP=On.RequestPath=On.Files=On.File=On.Headers=On.Param=On.Query=On.Body=On.Session=On.createRequestParamDecorator=On.RouteParamTypes=void 0;const ir=rr(49757);var cr;(function(St){St["QUERY"]="query";St["BODY"]="body";St["PARAM"]="param";St["HEADERS"]="headers";St["SESSION"]="session";St["FILESTREAM"]="file_stream";St["FILESSTREAM"]="files_stream";St["NEXT"]="next";St["REQUEST_PATH"]="request_path";St["REQUEST_IP"]="request_ip";St["QUERIES"]="queries";St["FIELDS"]="fields";St["CUSTOM"]="custom"})(cr=On.RouteParamTypes||(On.RouteParamTypes={}));const createParamMapping=function(St){return(On,rr={})=>{let cr=On;if(Array.isArray(On)&&rr.pipes===undefined){rr.pipes=On;cr=undefined}return(0,ir.createCustomParamDecorator)(ir.WEB_ROUTER_PARAM_KEY,{type:St,propertyData:cr},rr)}};const createRequestParamDecorator=function(St,On){On=On||{};if(Array.isArray(On)){On={pipes:On}}return createParamMapping(cr.CUSTOM)(St,On)};On.createRequestParamDecorator=createRequestParamDecorator;const Session=(St,On)=>createParamMapping(cr.SESSION)(St,{pipes:On});On.Session=Session;const Body=(St,On)=>createParamMapping(cr.BODY)(St,{pipes:On});On.Body=Body;const Query=(St,On)=>createParamMapping(cr.QUERY)(St,{pipes:On});On.Query=Query;const Param=(St,On)=>createParamMapping(cr.PARAM)(St,{pipes:On});On.Param=Param;const Headers=(St,On)=>createParamMapping(cr.HEADERS)(St,{pipes:On});On.Headers=Headers;const File=(St,On)=>createParamMapping(cr.FILESTREAM)(St,{pipes:On});On.File=File;const Files=(St,On)=>createParamMapping(cr.FILESSTREAM)(St,{pipes:On});On.Files=Files;const RequestPath=St=>createParamMapping(cr.REQUEST_PATH)(undefined,{pipes:St});On.RequestPath=RequestPath;const RequestIP=St=>createParamMapping(cr.REQUEST_IP)(undefined,{pipes:St});On.RequestIP=RequestIP;const Queries=(St,On)=>createParamMapping(cr.QUERIES)(St,{pipes:On});On.Queries=Queries;const Fields=(St,On)=>createParamMapping(cr.FIELDS)(St,{pipes:On});On.Fields=Fields},29619:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.All=On.Head=On.Options=On.Patch=On.Put=On.Del=On.Get=On.Post=On.RequestMapping=On.RequestMethod=void 0;const ir=rr(49757);On.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const cr={path:"/",requestMethod:On.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(St=cr)=>{const rr=St.path||"/";const ur=St.requestMethod||On.RequestMethod.GET;const pr=St.routerName;const fr=St.middleware;return(On,cr,br)=>{var Sr;(0,ir.attachClassMetadata)(ir.WEB_ROUTER_KEY,{path:rr,requestMethod:ur,routerName:pr,method:cr,middleware:fr,summary:(St===null||St===void 0?void 0:St.summary)||"",description:(St===null||St===void 0?void 0:St.description)||"",ignoreGlobalPrefix:(Sr=St===null||St===void 0?void 0:St.ignoreGlobalPrefix)!==null&&Sr!==void 0?Sr:false},On);return br}};On.RequestMapping=RequestMapping;const createMappingDecorator=St=>(rr,ir={middleware:[]})=>(0,On.RequestMapping)(Object.assign(ir,{requestMethod:St,path:rr}));On.Post=createMappingDecorator(On.RequestMethod.POST);On.Get=createMappingDecorator(On.RequestMethod.GET);On.Del=createMappingDecorator(On.RequestMethod.DELETE);On.Put=createMappingDecorator(On.RequestMethod.PUT);On.Patch=createMappingDecorator(On.RequestMethod.PATCH);On.Options=createMappingDecorator(On.RequestMethod.OPTIONS);On.Head=createMappingDecorator(On.RequestMethod.HEAD);On.All=createMappingDecorator(On.RequestMethod.ALL)},92233:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createRender=On.ContentType=On.SetHeader=On.HttpCode=On.Redirect=void 0;const ir=rr(49757);function Redirect(St,On=302){return(rr,cr,ur)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_REDIRECT,url:St,code:On},rr,cr);return ur}}On.Redirect=Redirect;function HttpCode(St){return(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_HTTP_CODE,code:St},On,rr);return cr}}On.HttpCode=HttpCode;function SetHeader(St,On){return(rr,cr,ur)=>{let pr={};if(On){pr[St]=On}else{pr=St}(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_HEADER,setHeaders:pr},rr,cr);return ur}}On.SetHeader=SetHeader;function ContentType(St){return(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_CONTENT_TYPE,contentType:St},On,rr);return cr}}On.ContentType=ContentType;function createRender(St){return St=>(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_RENDER,templateName:St},On,rr);return cr}}On.createRender=createRender},67999:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.WSController=void 0;const ir=rr(49757);const cr=rr(6192);function WSController(St="/",On={middleware:[],connectionMiddleware:[]}){return rr=>{(0,ir.saveModule)(ir.WS_CONTROLLER_KEY,rr);(0,ir.saveClassMetadata)(ir.WS_CONTROLLER_KEY,{namespace:St,routerOptions:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.WSController=WSController},20551:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.OnConnection=On.OnDisConnection=On.Emit=On.OnMessage=On.WSBroadCast=On.WSEmit=On.OnWSMessage=On.OnWSDisConnection=On.OnWSConnection=On.WSEventTypeEnum=void 0;const ir=rr(49757);var cr;(function(St){St["ON_CONNECTION"]="ws:onConnection";St["ON_DISCONNECTION"]="ws:onDisconnection";St["ON_MESSAGE"]="ws:onMessage";St["ON_SOCKET_ERROR"]="ws:onSocketError";St["EMIT"]="ws:Emit";St["BROADCAST"]="ws:broadcast"})(cr=On.WSEventTypeEnum||(On.WSEventTypeEnum={}));function OnWSConnection(St={}){return(On,rr,ur)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_CONNECTION,propertyName:rr,eventOptions:St,descriptor:ur},On.constructor)}}On.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(St,On,rr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_DISCONNECTION,propertyName:On,descriptor:rr},St.constructor)}}On.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(St,On={}){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_MESSAGE,messageEventName:St,propertyName:ur,eventOptions:On,descriptor:pr},rr.constructor)}}On.OnWSMessage=OnWSMessage;function WSEmit(St,On=[]){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.EMIT,propertyName:ur,messageEventName:St,roomName:[].concat(On),descriptor:pr},rr.constructor)}}On.WSEmit=WSEmit;function WSBroadCast(St="",On=[]){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.BROADCAST,propertyName:ur,messageEventName:St,roomName:[].concat(On),descriptor:pr},rr.constructor)}}On.WSBroadCast=WSBroadCast;On.OnMessage=OnWSMessage;On.Emit=WSEmit;On.OnDisConnection=OnWSDisConnection;On.OnConnection=OnWSConnection},34881:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FunctionDefinition=void 0;const ir=rr(6192);const cr=rr(59327);class FunctionWrapperCreator extends cr.ObjectCreator{doConstruct(St,On,rr){if(!St){return null}return St(rr,On)}async doConstructAsync(St,On,rr){if(!St){return null}return St(rr,On)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=ir.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(St){}hasAttr(St){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(St){this.innerScope=St}isSingletonScope(){return this.innerScope===ir.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===ir.ScopeEnum.Request}setAttr(St,On){}}On.FunctionDefinition=FunctionDefinition},59327:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectCreator=void 0;const ir=rr(86314);const cr=rr(63289);class ObjectCreator{constructor(St){this.definition=St}load(){let St=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return St}const On=this.definition.path;if(this.definition.export){St=require(On)[this.definition.export]}else{St=require(On)}}else{St=this.definition.path}return St}doConstruct(St,On){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){rr=St[this.definition.constructMethod].apply(St,On)}else{rr=Reflect.construct(St,On)}return rr}async doConstructAsync(St,On){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){const ir=St[this.definition.constructMethod];if(cr.Types.isAsyncFunction(ir)){rr=await ir.apply(St,On)}else{rr=ir.apply(St,On)}}else{rr=Reflect.construct(St,On)}return rr}doInit(St){const On=St;if(this.definition.initMethod&&On[this.definition.initMethod]){if(cr.Types.isGeneratorFunction(On[this.definition.initMethod])||cr.Types.isAsyncFunction(On[this.definition.initMethod])){throw new ir.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const St=On[this.definition.initMethod].call(On);if(cr.Types.isPromise(St)){throw new ir.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(St){const On=St;if(this.definition.initMethod&&On[this.definition.initMethod]){const St=On[this.definition.initMethod];if(cr.Types.isAsyncFunction(St)){await St.call(On)}else{if(St.length===1){await new Promise((rr=>{St.call(On,rr)}))}else{St.call(On)}}}}doDestroy(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){St[this.definition.destroyMethod].call(St)}}async doDestroyAsync(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){const On=St[this.definition.destroyMethod];if(cr.Types.isAsyncFunction(On)){await On.call(St)}else{if(On.length===1){await new Promise((rr=>{On.call(St,rr)}))}else{On.call(St)}}}}}On.ObjectCreator=ObjectCreator},47698:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectDefinition=void 0;const ir=rr(6192);const cr=rr(74701);const ur=rr(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=ir.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 cr.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new ur.ObjectCreator(this)}set asynchronous(St){this._asynchronous=St}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===ir.ScopeEnum.Singleton}isRequestScope(){return this.scope===ir.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(St){return this._attrs.get(St)}hasAttr(St){return this._attrs.has(St)}setAttr(St,On){this._attrs.set(St,On)}}On.ObjectDefinition=ObjectDefinition},74701:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(St,On){if(this.has(St)){return this.get(St)}return On}setProperty(St,On){return this.set(St,On)}}On.ObjectProperties=ObjectProperties},21769:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayHttpError=On.MidwayError=On.registerErrorCode=void 0;const ir=rr(58611);const cr=new Set;function registerErrorCode(St,On){if(cr.has(St)){throw new MidwayError(`Error group ${St} is duplicated, please check before adding.`)}else{cr.add(St)}const rr={};for(const ir in On){rr[ir]=St.toUpperCase()+"_"+String(On[ir]).toUpperCase()}return rr}On.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(St,On,rr){super(St);if(!On||typeof On==="object"){rr=On;On="MIDWAY_10000"}this.name=this.constructor.name;this.code=On;this.cause=rr===null||rr===void 0?void 0:rr.cause}}On.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(St,On,rr,cr){super(St?typeof St==="string"?St:St.message:ir.STATUS_CODES[On],rr!==null&&rr!==void 0?rr:String(On),cr);if(St&&St["stack"]){this.stack=St["stack"]}this.status=On}}On.MidwayHttpError=MidwayHttpError},37198:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayEmptyValueError=On.MidwayInvalidConfigPropertyError=On.MidwayMainFrameworkMissingError=On.MidwayCodeInvokeTimeoutError=On.MidwayInvokeForbiddenError=On.MidwayRetryExceededMaxTimesError=On.MidwayDuplicateControllerOptionsError=On.MidwayDuplicateClassNameError=On.MidwayInconsistentVersionError=On.MidwayUtilHttpClientTimeoutError=On.MidwayMissingImportComponentError=On.MidwaySingletonInjectRequestError=On.MidwayUseWrongMethodError=On.MidwayDuplicateRouteError=On.MidwayResolverMissingError=On.MidwayInvalidConfigError=On.MidwayConfigMissingError=On.MidwayFeatureNotImplementedError=On.MidwayFeatureNoLongerSupportedError=On.MidwayDefinitionNotFoundError=On.MidwayParameterError=On.MidwayCommonError=On.FrameworkErrorEnum=void 0;const ir=rr(21769);On.FrameworkErrorEnum=(0,ir.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 ir.MidwayError{constructor(St){super(St,On.FrameworkErrorEnum.COMMON)}}On.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends ir.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"Parameter type not match",On.FrameworkErrorEnum.PARAM_TYPE)}}On.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends ir.MidwayError{static isClosePrototypeOf(St){return St?St[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(St){super(`${St} is not valid in current context`,On.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(St){const On=this.message.split(" is not valid in current context")[0];this.message=`${On} in class ${St} is not valid in current context`}}On.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends ir.MidwayError{constructor(St){super("This feature no longer supported \n"+St,On.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}On.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends ir.MidwayError{constructor(St){super("This feature not implemented \n"+St,On.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}On.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends ir.MidwayError{constructor(St){super(`Can't found config key "${St}" in your config, please set it first`,On.FrameworkErrorEnum.MISSING_CONFIG)}}On.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends ir.MidwayError{constructor(St){super("Invalid config file \n"+St,On.FrameworkErrorEnum.INVALID_CONFIG)}}On.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends ir.MidwayError{constructor(St){super(`Resolver "${St}" is missing.`,On.FrameworkErrorEnum.MISSING_RESOLVER)}}On.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends ir.MidwayError{constructor(St,rr,ir){super(`Duplicate router "${St}" at "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_ROUTER)}}On.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends ir.MidwayError{constructor(St,rr,ir){const cr=ir?`${ir} not valid by ${St}, Use ${rr} instead!`:`You should not invoked by ${St}, Use ${rr} instead!`;super(cr,On.FrameworkErrorEnum.USE_WRONG_METHOD)}}On.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends ir.MidwayError{constructor(St,rr){const ir=`${St} with singleton scope can't implicitly inject ${rr} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${rr} or use "ctx.requestContext.getAsync(${rr})".`;super(ir,On.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}On.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends ir.MidwayError{constructor(St){const rr=`"${St}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(rr,On.FrameworkErrorEnum.MISSING_IMPORTS)}}On.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends ir.MidwayError{constructor(St){super(St,On.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}On.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends ir.MidwayError{constructor(){const St='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(St,On.FrameworkErrorEnum.INCONSISTENT_VERSION)}}On.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends ir.MidwayError{constructor(St,rr,ir){super(`"${St}" duplicated between "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}On.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends ir.MidwayError{constructor(St,rr,ir){super(`"Prefix ${St}" with duplicated controller options between "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}On.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends ir.MidwayError{constructor(St,rr,ir){super(`Invoke "${St}" retries exceeded the maximum number of times(${rr}), error: ${ir.message}`,On.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:ir})}}On.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends ir.MidwayError{constructor(St,rr){super(`Invoke "${rr?rr.name:"unknown"}.${St}" is forbidden.`,On.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}On.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends ir.MidwayError{constructor(St,rr){super(`Invoke "${St}" running timeout(${rr}ms)`,On.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}On.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends ir.MidwayError{constructor(){super("Main framework missing, please check your configuration.",On.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}On.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends ir.MidwayError{constructor(St,rr){super(`Invalid config property "${St}", ${rr?`only ${rr.join(",")} can be set`:"please check your configuration"}.`,On.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}On.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends ir.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"There is an empty value got and it is not allowed.",On.FrameworkErrorEnum.EMPTY_VALUE)}}On.MidwayEmptyValueError=MidwayEmptyValueError},9504:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.httpError=On.GatewayTimeoutError=On.ServiceUnavailableError=On.BadGatewayError=On.NotImplementedError=On.InternalServerErrorError=On.TooManyRequestsError=On.UnprocessableEntityError=On.UnsupportedMediaTypeError=On.PayloadTooLargeError=On.GoneError=On.ConflictError=On.RequestTimeoutError=On.NotAcceptableError=On.ForbiddenError=On.NotFoundError=On.UnauthorizedError=On.BadRequestError=On.HttpStatus=void 0;const ir=rr(21769);var cr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(cr=On.HttpStatus||(On.HttpStatus={}));class BadRequestError extends ir.MidwayHttpError{constructor(St){super(St,cr.BAD_REQUEST)}}On.BadRequestError=BadRequestError;class UnauthorizedError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNAUTHORIZED)}}On.UnauthorizedError=UnauthorizedError;class NotFoundError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_FOUND)}}On.NotFoundError=NotFoundError;class ForbiddenError extends ir.MidwayHttpError{constructor(St){super(St,cr.FORBIDDEN)}}On.ForbiddenError=ForbiddenError;class NotAcceptableError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_ACCEPTABLE)}}On.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends ir.MidwayHttpError{constructor(St){super(St,cr.REQUEST_TIMEOUT)}}On.RequestTimeoutError=RequestTimeoutError;class ConflictError extends ir.MidwayHttpError{constructor(St){super(St,cr.CONFLICT)}}On.ConflictError=ConflictError;class GoneError extends ir.MidwayHttpError{constructor(St){super(St,cr.GONE)}}On.GoneError=GoneError;class PayloadTooLargeError extends ir.MidwayHttpError{constructor(St){super(St,cr.PAYLOAD_TOO_LARGE)}}On.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNSUPPORTED_MEDIA_TYPE)}}On.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNPROCESSABLE_ENTITY)}}On.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends ir.MidwayHttpError{constructor(St){super(St,cr.TOO_MANY_REQUESTS)}}On.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends ir.MidwayHttpError{constructor(St){super(St,cr.INTERNAL_SERVER_ERROR)}}On.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_IMPLEMENTED)}}On.NotImplementedError=NotImplementedError;class BadGatewayError extends ir.MidwayHttpError{constructor(St){super(St,cr.BAD_GATEWAY)}}On.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends ir.MidwayHttpError{constructor(St){super(St,cr.SERVICE_UNAVAILABLE)}}On.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends ir.MidwayHttpError{constructor(St){super(St,cr.GATEWAY_TIMEOUT)}}On.GatewayTimeoutError=GatewayTimeoutError;On.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(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.httpError=On.HttpStatus=void 0;cr(rr(21769),On);var ur=rr(9504);Object.defineProperty(On,"HttpStatus",{enumerable:true,get:function(){return ur.HttpStatus}});Object.defineProperty(On,"httpError",{enumerable:true,get:function(){return ur.httpError}});cr(rr(37198),On)},24451:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createConfiguration=On.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(St){this.options=St;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(St,On){if(typeof St==="function"){this.configLoadHandler=St}else{return this.configLoadHandler(St,On)}return this}onReady(St,On){if(typeof St==="function"){this.readyHandler=St}else{return this.readyHandler(St,On)}return this}onServerReady(St,On){if(typeof St==="function"){this.serverReadyHandler=St}else{return this.serverReadyHandler(St,On)}return this}onStop(St,On){if(typeof St==="function"){this.stopHandler=St}else{return this.stopHandler(St,On)}return this}getConfigurationOptions(){return this.options}}On.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=St=>new FunctionalConfiguration(St);On.createConfiguration=createConfiguration},46123:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayPerformanceManager=On.TypedResourceManager=On.HttpServerResponse=On.ServerResponse=On.FORMAT=On.FileUtils=On.PathFileUtil=On.Types=On.retryWith=On.retryWithAsync=On.extend=On.Utils=On.sleep=On.isTypeScriptEnvironment=On.wrapAsync=On.wrapMiddleware=On.pathMatching=On.transformRequestObjectByType=On.deprecatedOutput=On.delegateTargetAllPrototypeMethod=On.delegateTargetProperties=On.delegateTargetMethod=On.delegateTargetPrototypeMethod=On.loadModule=On.safeRequire=On.safelyGet=On.ASYNC_ROOT_CONTEXT=On.MidwayPriorityManager=On.DEFAULT_PRIORITY=On.DataSourceManager=On.WebRouterCollector=On.MidwayServerlessFunctionService=On.MidwayWebRouterService=On.MidwayHealthService=On.MidwayMockService=On.MidwayDecoratorService=On.MidwayMiddlewareService=On.MidwayLifeCycleService=On.MidwayAspectService=On.MidwayFrameworkService=On.MidwayLoggerService=On.MidwayInformationService=On.MidwayEnvironmentService=On.MidwayConfigService=On.FunctionalConfiguration=On.createConfiguration=On.BaseFramework=On.MidwayRequestContainer=void 0;cr(rr(6192),On);cr(rr(9288),On);var ur=rr(97983);Object.defineProperty(On,"MidwayRequestContainer",{enumerable:true,get:function(){return ur.MidwayRequestContainer}});var pr=rr(83872);Object.defineProperty(On,"BaseFramework",{enumerable:true,get:function(){return pr.BaseFramework}});cr(rr(28695),On);cr(rr(2222),On);var fr=rr(24451);Object.defineProperty(On,"createConfiguration",{enumerable:true,get:function(){return fr.createConfiguration}});Object.defineProperty(On,"FunctionalConfiguration",{enumerable:true,get:function(){return fr.FunctionalConfiguration}});var br=rr(78842);Object.defineProperty(On,"MidwayConfigService",{enumerable:true,get:function(){return br.MidwayConfigService}});var Sr=rr(70275);Object.defineProperty(On,"MidwayEnvironmentService",{enumerable:true,get:function(){return Sr.MidwayEnvironmentService}});var Er=rr(37482);Object.defineProperty(On,"MidwayInformationService",{enumerable:true,get:function(){return Er.MidwayInformationService}});var kr=rr(34888);Object.defineProperty(On,"MidwayLoggerService",{enumerable:true,get:function(){return kr.MidwayLoggerService}});var Pr=rr(33332);Object.defineProperty(On,"MidwayFrameworkService",{enumerable:true,get:function(){return Pr.MidwayFrameworkService}});var Ir=rr(70812);Object.defineProperty(On,"MidwayAspectService",{enumerable:true,get:function(){return Ir.MidwayAspectService}});var Lr=rr(13328);Object.defineProperty(On,"MidwayLifeCycleService",{enumerable:true,get:function(){return Lr.MidwayLifeCycleService}});var Br=rr(68220);Object.defineProperty(On,"MidwayMiddlewareService",{enumerable:true,get:function(){return Br.MidwayMiddlewareService}});var jr=rr(96367);Object.defineProperty(On,"MidwayDecoratorService",{enumerable:true,get:function(){return jr.MidwayDecoratorService}});var Ur=rr(77306);Object.defineProperty(On,"MidwayMockService",{enumerable:true,get:function(){return Ur.MidwayMockService}});var Vr=rr(658);Object.defineProperty(On,"MidwayHealthService",{enumerable:true,get:function(){return Vr.MidwayHealthService}});var Wr=rr(19985);Object.defineProperty(On,"MidwayWebRouterService",{enumerable:true,get:function(){return Wr.MidwayWebRouterService}});var zr=rr(42592);Object.defineProperty(On,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return zr.MidwayServerlessFunctionService}});Object.defineProperty(On,"WebRouterCollector",{enumerable:true,get:function(){return zr.WebRouterCollector}});var qr=rr(12849);Object.defineProperty(On,"DataSourceManager",{enumerable:true,get:function(){return qr.DataSourceManager}});var Kr=rr(67934);Object.defineProperty(On,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Kr.DEFAULT_PRIORITY}});Object.defineProperty(On,"MidwayPriorityManager",{enumerable:true,get:function(){return Kr.MidwayPriorityManager}});cr(rr(28602),On);cr(rr(82535),On);cr(rr(64842),On);cr(rr(46673),On);cr(rr(1845),On);cr(rr(11026),On);cr(rr(12738),On);cr(rr(39408),On);cr(rr(43436),On);cr(rr(29222),On);cr(rr(86314),On);var Xr=rr(75351);Object.defineProperty(On,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Xr.ASYNC_ROOT_CONTEXT}});cr(rr(49757),On);cr(rr(45317),On);cr(rr(75105),On);var Yr=rr(65308);Object.defineProperty(On,"safelyGet",{enumerable:true,get:function(){return Yr.safelyGet}});Object.defineProperty(On,"safeRequire",{enumerable:true,get:function(){return Yr.safeRequire}});Object.defineProperty(On,"loadModule",{enumerable:true,get:function(){return Yr.loadModule}});Object.defineProperty(On,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Yr.delegateTargetPrototypeMethod}});Object.defineProperty(On,"delegateTargetMethod",{enumerable:true,get:function(){return Yr.delegateTargetMethod}});Object.defineProperty(On,"delegateTargetProperties",{enumerable:true,get:function(){return Yr.delegateTargetProperties}});Object.defineProperty(On,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Yr.delegateTargetAllPrototypeMethod}});Object.defineProperty(On,"deprecatedOutput",{enumerable:true,get:function(){return Yr.deprecatedOutput}});Object.defineProperty(On,"transformRequestObjectByType",{enumerable:true,get:function(){return Yr.transformRequestObjectByType}});Object.defineProperty(On,"pathMatching",{enumerable:true,get:function(){return Yr.pathMatching}});Object.defineProperty(On,"wrapMiddleware",{enumerable:true,get:function(){return Yr.wrapMiddleware}});Object.defineProperty(On,"wrapAsync",{enumerable:true,get:function(){return Yr.wrapAsync}});Object.defineProperty(On,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Yr.isTypeScriptEnvironment}});Object.defineProperty(On,"sleep",{enumerable:true,get:function(){return Yr.sleep}});Object.defineProperty(On,"Utils",{enumerable:true,get:function(){return Yr.Utils}});var ii=rr(83486);Object.defineProperty(On,"extend",{enumerable:true,get:function(){return ii.extend}});cr(rr(46422),On);cr(rr(50539),On);cr(rr(73861),On);cr(rr(87653),On);var oi=rr(25198);Object.defineProperty(On,"retryWithAsync",{enumerable:true,get:function(){return oi.retryWithAsync}});Object.defineProperty(On,"retryWith",{enumerable:true,get:function(){return oi.retryWith}});var ai=rr(63289);Object.defineProperty(On,"Types",{enumerable:true,get:function(){return ai.Types}});var pi=rr(61327);Object.defineProperty(On,"PathFileUtil",{enumerable:true,get:function(){return pi.PathFileUtil}});var mi=rr(7589);Object.defineProperty(On,"FileUtils",{enumerable:true,get:function(){return mi.FileUtils}});var bi=rr(30001);Object.defineProperty(On,"FORMAT",{enumerable:true,get:function(){return bi.FORMAT}});var xi=rr(89995);Object.defineProperty(On,"ServerResponse",{enumerable:true,get:function(){return xi.ServerResponse}});Object.defineProperty(On,"HttpServerResponse",{enumerable:true,get:function(){return xi.HttpServerResponse}});var wi=rr(11330);Object.defineProperty(On,"TypedResourceManager",{enumerable:true,get:function(){return wi.TypedResourceManager}});var Oi=rr(70032);Object.defineProperty(On,"MidwayPerformanceManager",{enumerable:true,get:function(){return Oi.MidwayPerformanceManager}})},6192:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayProcessTypeEnum=On.ObjectLifeCycleEvent=On.ServerlessTriggerType=On.MidwayFrameworkType=On.FrameworkType=On.MSListenerType=On.MSProviderType=On.InjectModeEnum=On.ScopeEnum=void 0;var rr;(function(St){St["Singleton"]="Singleton";St["Request"]="Request";St["Prototype"]="Prototype"})(rr=On.ScopeEnum||(On.ScopeEnum={}));var ir;(function(St){St["Identifier"]="Identifier";St["Class"]="Class";St["PropertyName"]="PropertyName"})(ir=On.InjectModeEnum||(On.InjectModeEnum={}));var cr;(function(St){St["DUBBO"]="dubbo";St["GRPC"]="gRPC"})(cr=On.MSProviderType||(On.MSProviderType={}));var ur;(function(St){St["RABBITMQ"]="rabbitmq";St["MQTT"]="mqtt";St["KAFKA"]="kafka";St["REDIS"]="redis"})(ur=On.MSListenerType||(On.MSListenerType={}));class FrameworkType{}On.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(St){super();this.name=St}}On.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 pr;(function(St){St["EVENT"]="event";St["HTTP"]="http";St["API_GATEWAY"]="apigw";St["OS"]="os";St["CDN"]="cdn";St["LOG"]="log";St["TIMER"]="timer";St["MQ"]="mq";St["KAFKA"]="kafka";St["HSF"]="hsf";St["MTOP"]="mtop";St["SSR"]="ssr"})(pr=On.ServerlessTriggerType||(On.ServerlessTriggerType={}));var fr;(function(St){St["BEFORE_BIND"]="beforeBind";St["BEFORE_CREATED"]="beforeObjectCreated";St["AFTER_CREATED"]="afterObjectCreated";St["AFTER_INIT"]="afterObjectInit";St["BEFORE_DESTROY"]="beforeObjectDestroy"})(fr=On.ObjectLifeCycleEvent||(On.ObjectLifeCycleEvent={}));var br;(function(St){St["APPLICATION"]="APPLICATION";St["AGENT"]="AGENT"})(br=On.MidwayProcessTypeEnum||(On.MidwayProcessTypeEnum={}))},72838:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerResponse=void 0;class ServerResponse{constructor(St){this.isSuccess=true;this.ctx=St}json(St){return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}blob(St){return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}On.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(St,On,rr)=>St;ServerResponse.JSON_TPL=(St,On,rr)=>{if(On){return{success:"true",data:St}}else{return{success:"false",message:St||"fail"}}};ServerResponse.BLOB_TPL=(St,On,rr)=>St},91959:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpServerResponse=void 0;const ir=rr(79896);const cr=rr(72838);const ur=rr(82738);const pr=rr(37407);const fr=rr(16928);class HttpServerResponse extends cr.ServerResponse{constructor(St){super(St)}status(St){this.ctx.res.statusCode=St;return this}header(St,On){this.ctx.res.setHeader(St,On);return this}headers(St){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(St)))}else{for(const On in St){this.header(On,St[On])}}return this}json(St){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}file(St,On){this.header("Content-Type",On||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,fr.basename)(St)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof St==="string"?(0,ir.createReadStream)(St):St,this.isSuccess,this.ctx)}blob(St,On){this.header("Content-Type",On||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}html(St){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(St,this.isSuccess,this.ctx)}redirect(St,On=302){this.status(On);if(this.ctx.redirect){return this.ctx.redirect(St)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(St)}else{this.header("Location",St)}}sse(St={}){return new ur.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...St})}stream(St={}){return new pr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...St})}}On.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(St,On,rr)=>St;HttpServerResponse.SSE_TPL=(St,On)=>St;HttpServerResponse.STREAM_TPL=(St,On)=>St;HttpServerResponse.HTML_TPL=(St,On,rr)=>St},89995:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpServerResponse=On.ServerResponse=void 0;var ir=rr(72838);Object.defineProperty(On,"ServerResponse",{enumerable:true,get:function(){return ir.ServerResponse}});var cr=rr(91959);Object.defineProperty(On,"HttpServerResponse",{enumerable:true,get:function(){return cr.HttpServerResponse}})},82738:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerSendEventStream=void 0;const ir=rr(2203);class ServerSendEventStream extends ir.Transform{constructor(St,On={}){super({objectMode:true,...On});this.isActive=false;this.ctx=St;this.closeEvent=On.closeEvent||"close";this.options=On;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(St,On,rr){try{let On,ir="data: ";const cr=/^\s*:\s*/;const ur=[];if(!this.isActive){this.isActive=true;const St={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const On in St){this.ctx.res.setHeader(On,St[On])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);ur.push(": ok")}const pr=St;if(pr.event)ur.push("event: "+pr.event);if(pr.retry)ur.push("retry: "+pr.retry);if(pr.id)ur.push("id: "+pr.id);if(typeof pr.data==="object"){On=JSON.stringify(pr.data);ur.push(ir+On)}else if(typeof pr.data==="undefined"){ur.push(ir)}else{pr.data=String(pr.data);if(pr.data.search(cr)!==-1){pr.data=pr.data.replace(cr,"");ir=": "}pr.data=pr.data.replace(/(\r\n|\r|\n)/g,"\n");On=pr.data.split(/\n/);for(let St=0,rr=On.length;St<rr;++St){const cr=On[St];if(St+1===rr){ur.push(ir+cr)}else{ur.push(ir+cr)}}}this.push(ur.join("\n")+"\n\n");rr()}catch(St){this.ctx.logger.error(St);this.sendError(St);this.end();rr(St)}}sendError(St){this.send({event:"error",data:St.message||"An error occurred"})}sendEnd(St){St.event=this.closeEvent;this.send(St)}send(St){super.write(this.options.tpl(St,this.ctx))}handleClose(){this.end()}}On.ServerSendEventStream=ServerSendEventStream},37407:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpStreamResponse=void 0;const ir=rr(2203);class HttpStreamResponse extends ir.Transform{constructor(St,On={}){super({objectMode:true,...On});this.isActive=false;this.ctx=St;this.options=On}_transform(St,On,rr){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 St==="string"){this.ctx.res.write(St)}else{this.ctx.res.write(JSON.stringify(St))}rr()}catch(St){this.ctx.logger.error(St);this.end();this.ctx.res.end();rr(St)}}send(St){if(!this.writable){return}this.write(this.options.tpl(St,this.ctx))}sendError(St){this.ctx.logger.error(St);this.end();this.ctx.res.end()}_flush(St){this.ctx.res.end();St()}}On.HttpStreamResponse=HttpStreamResponse},70812:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayAspectService=void 0;const ur=rr(65675);const pr=rr(6192);const fr=rr(49757);const br=rr(63289);let Sr=class MidwayAspectService{constructor(St){this.applicationContext=St}async loadAspect(){const St=(0,fr.listModule)(fr.ASPECT_KEY);let On=[];for(const rr of St){const St=(0,fr.getClassMetadata)(fr.ASPECT_KEY,rr);On=On.concat(St.map((St=>{St.aspectModule=rr;return St})))}On.sort(((St,On)=>(On.priority||0)-(St.priority||0)));for(const St of On){const On=await this.applicationContext.getAsync(St.aspectModule);await this.addAspect(On,St)}}async addAspect(St,On){const rr=On.aspectTarget;const ir=Object.getOwnPropertyNames(rr.prototype);const cr=On.match?ur(On.match):()=>true;for(const On of ir){if(On==="constructor"||!cr(On)){continue}const ir=Object.getOwnPropertyDescriptor(rr.prototype,On);if(!ir||ir.writable===false){continue}this.interceptPrototypeMethod(rr,On,St)}}interceptPrototypeMethod(St,On,rr){const ir=St.prototype[On];if(br.Types.isAsyncFunction(St.prototype[On])){St.prototype[On]=async function(...St){var cr,ur,pr;let fr,br;const newProceed=(...St)=>ir.apply(this,St);const Sr={methodName:On,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof rr==="function"){rr=rr()}try{await((cr=rr.before)===null||cr===void 0?void 0:cr.call(rr,Sr));if(rr.around){br=await rr.around(Sr)}else{br=await ir.call(this,...Sr.args)}Sr.proceed=undefined;const St=await((ur=rr.afterReturn)===null||ur===void 0?void 0:ur.call(rr,Sr,br));br=typeof St==="undefined"?br:St;return br}catch(St){Sr.proceed=undefined;fr=St;if(rr.afterThrow){await rr.afterThrow(Sr,fr)}else{throw St}}finally{await((pr=rr.after)===null||pr===void 0?void 0:pr.call(rr,Sr,br,fr))}}}else{St.prototype[On]=function(...St){var cr,ur,pr;let fr,br;const newProceed=(...St)=>ir.apply(this,St);const Sr={methodName:On,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof rr==="function"){rr=rr()}try{(cr=rr.before)===null||cr===void 0?void 0:cr.call(rr,Sr);if(rr.around){br=rr.around(Sr)}else{br=ir.call(this,...Sr.args)}Sr.proceed=undefined;const St=(ur=rr.afterReturn)===null||ur===void 0?void 0:ur.call(rr,Sr,br);br=typeof St==="undefined"?br:St;return br}catch(St){Sr.proceed=undefined;fr=St;if(rr.afterThrow){rr.afterThrow(Sr,fr)}else{throw St}}finally{(pr=rr.after)===null||pr===void 0?void 0:pr.call(rr,Sr,br,fr)}}}}};Sr=ir([(0,fr.Provide)(),(0,fr.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Sr);On.MidwayAspectService=Sr},78842:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayConfigService=void 0;const ur=rr(16928);const pr=rr(6192);const fr=rr(65308);const br=rr(79896);const Sr=rr(39023);const Er=rr(70275);const kr=rr(37482);const Pr=rr(83486);const Ir=rr(86314);const Lr=rr(49757);const Br=rr(63289);const jr=Sr.debuglog("midway:debug");let Ur=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(St){for(const On of St){if(typeof On==="string"){if(/\.\w+$/.test(On)){const St=this.getConfigEnv(On);const rr=this.getEnvSet(St);rr.add(On);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(On)}}else{const St=(0,br.statSync)(On);if(St.isDirectory()){const St=(0,br.readdirSync)(On);this.add(St.map((St=>(0,ur.join)(On,St))))}}}else{for(const St in On){this.getEnvSet(St).add(On[St]);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(On[St])}}}}}addObject(St,On=false){if(this.isReady){St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:St});if(On){this.configuration=(0,Pr.extend)(true,St,this.configuration)}else{(0,Pr.extend)(true,this.configuration,St)}}else{this.externalObject.push(St)}}getEnvSet(St){if(!this.envDirMap.has(St)){this.envDirMap.set(St,new Set)}return this.envDirMap.get(St)}getConfigEnv(St){const On=(0,ur.basename)(St);const rr=On.split(".");const ir=rr.pop();if(ir!=="js"&&ir!=="ts"){return ir}return rr.pop()}load(){if(this.isReady)return;const St=this.getEnvSet("default");const On=this.getEnvSet(this.environmentService.getCurrentEnvironment());const rr={};const ir=St.size;for(const[cr,ur]of[...St,...On].entries()){let St=this.loadConfig(ur);if(Br.Types.isFunction(St)){St=St.apply(null,[this.appInfo,rr])}if(!St){continue}St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");continue}if(typeof ur==="string"){jr("[config]: Loaded config %s, %j",ur,St)}else{jr("[config]: Loaded config %j",St)}this.configMergeOrder.push({env:cr<ir?"default":this.environmentService.getCurrentEnvironment(),extraPath:ur,value:St});(0,Pr.extend)(true,rr,St)}if(this.externalObject.length){for(let St of this.externalObject){if(St){St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");continue}jr("[config]: Loaded external object %j",St);(0,Pr.extend)(true,rr,St);this.configMergeOrder.push({env:"default",extraPath:"",value:St})}}}this.configuration=rr;this.isReady=true}getConfiguration(St){if(St){return(0,fr.safelyGet)(St,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(St){let On=typeof St==="string"?require(St):St;if(On&&On.__esModule){if(On&&On.default){if(Object.keys(On).length>1){throw new Ir.MidwayInvalidConfigError(`${St} should not have both a default export and named export`)}On=On.default}}return On}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(St){this.configFilterList.push(St)}runWithFilter(St){for(const On of this.configFilterList){jr(`[config]: Filter config by filter = "${On.name||"anonymous filter"}"`);St=On(St);jr("[config]: Filter config result = %j",St)}return St}getAppInfo(){return this.appInfo}};ir([(0,Lr.Inject)(),cr("design:type",Er.MidwayEnvironmentService)],Ur.prototype,"environmentService",void 0);ir([(0,Lr.Inject)(),cr("design:type",kr.MidwayInformationService)],Ur.prototype,"informationService",void 0);ir([(0,Lr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Ur.prototype,"init",null);Ur=ir([(0,Lr.Provide)(),(0,Lr.Scope)(pr.ScopeEnum.Singleton)],Ur);On.MidwayConfigService=Ur},96367:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayDecoratorService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(70812);const br=rr(86314);const Sr=rr(39023);const Er=rr(63289);const kr=Sr.debuglog("midway:debug");let Pr=class MidwayDecoratorService{constructor(St){this.applicationContext=St;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((St=>{const On=(0,ur.getClassMetadata)(ur.INJECT_CUSTOM_METHOD,St);if(On){for(const rr of On){const{propertyName:On,key:ir,metadata:cr,options:ur}=rr;if(!ur||!ur.impl){continue}this.aspectService.interceptPrototypeMethod(St,On,(()=>{const rr=this.methodDecoratorMap.get(ir);if(!rr){throw new br.MidwayCommonError(`Method Decorator "${ir}" handler not found, please register first.`)}return rr({target:St,propertyName:On,metadata:cr})}))}}const rr=(0,ur.getClassMetadata)(ur.INJECT_CUSTOM_PARAM,St);if(rr){for(const On of Object.keys(rr)){this.aspectService.interceptPrototypeMethod(St,On,(()=>({before:async ir=>{const cr=[...ir.args];for(const pr of rr[On]){const{propertyName:On,key:rr,metadata:fr,parameterIndex:Sr,options:Pr}=pr;let Ir;if(Pr&&Pr.impl){Ir=this.parameterDecoratorMap.get(rr);if(!Ir){throw new br.MidwayCommonError(`Parameter Decorator "${rr}" handler not found, please register first.`)}}else{Ir=async({parameterIndex:St,originArgs:On})=>On[St]}const Lr=(0,ur.getMethodParamTypes)(St,On);let Br=false;try{cr[Sr]=await Ir({metadata:fr,propertyName:On,parameterIndex:Sr,target:St,originArgs:cr,originParamType:Lr[Sr],instance:ir.target})}catch(St){Br=true;if((Pr===null||Pr===void 0?void 0:Pr.throwError)===true){throw St}else{kr(`[core]: Parameter decorator throw error and use origin args, ${St.stack}`)}}if(Br){continue}const jr=[...this.parameterDecoratorPipes.get(rr)||[],...(Pr===null||Pr===void 0?void 0:Pr.pipes)||[]];for(const St of jr){let On;if("transform"in St){On=St["transform"].bind(St)}else if((0,Er.isClass)(St)){const rr=await this.applicationContext.getAsync(St);On=rr.transform.bind(rr)}else if(typeof St==="function"){On=St}else{throw new br.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}cr[Sr]=await On(cr[Sr],{metaType:(0,ur.transformTypeFromTSDesign)(Lr[Sr]),metadata:fr,target:ir.target,methodName:ir.methodName})}}ir.args=cr}})))}}}));this.applicationContext.onObjectCreated(((St,On)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(On.definition.handlerProps)){for(const rr of On.definition.handlerProps){this.defineGetterPropertyValue(rr,St,this.getHandler(rr.key))}}}));this.registerPropertyHandler(ur.APPLICATION_CONTEXT_KEY,((St,On)=>this.applicationContext))}registerPropertyHandler(St,On){kr(`[core]: Register property decorator key="${St}"`);this.propertyHandlerMap.set(St,On)}registerMethodHandler(St,On){kr(`[core]: Register method decorator key="${St}"`);this.methodDecoratorMap.set(St,On)}registerParameterHandler(St,On){kr(`[core]: Register parameter decorator key="${St}"`);this.parameterDecoratorMap.set(St,On)}registerParameterPipes(St,On){if(!this.parameterDecoratorPipes.has(St)){this.parameterDecoratorPipes.set(St,[])}this.parameterDecoratorPipes.set(St,this.parameterDecoratorPipes.get(St).concat(On))}defineGetterPropertyValue(St,On,rr){if(St&&rr){if(St.propertyName){Object.defineProperty(On,St.propertyName,{get:()=>{var ir;return rr(St.propertyName,(ir=St.metadata)!==null&&ir!==void 0?ir:{},On)},configurable:true,enumerable:true})}}}getHandler(St){if(this.propertyHandlerMap.has(St)){return this.propertyHandlerMap.get(St)}}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayAspectService)],Pr.prototype,"aspectService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Pr.prototype,"init",null);Pr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Pr);On.MidwayDecoratorService=Pr},70275:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayEnvironmentService=void 0;const cr=rr(6192);const ur=rr(65308);const pr=rr(49757);let fr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,ur.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(St){this.environment=St}isDevelopmentEnvironment(){return(0,ur.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(St){this.moduleLoadType=St}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};fr=ir([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton)],fr);On.MidwayEnvironmentService=fr},33332:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayFrameworkService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(78842);const br=rr(34888);const Sr=rr(83872);const Er=rr(28602);const kr=rr(96367);const Pr=rr(70812);const Ir=rr(43436);const Lr=rr(39023);const Br=rr(86314);const jr=rr(2222);const Ur=rr(70032);const Vr=Lr.debuglog("midway:debug");let Wr=class MidwayFrameworkService{constructor(St,On){this.applicationContext=St;this.globalOptions=On;this.globalFrameworkList=[]}async init(){var St,On;this.decoratorService.registerPropertyHandler(ur.CONFIG_KEY,((St,On)=>{var rr;if(On.identifier===ur.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((rr=On.identifier)!==null&&rr!==void 0?rr:St)}}));this.decoratorService.registerPropertyHandler(ur.LOGGER_KEY,((St,On)=>{var rr;return this.loggerService.getLogger((rr=On.identifier)!==null&&rr!==void 0?rr:St)}));this.decoratorService.registerPropertyHandler(ur.PIPELINE_IDENTIFIER,((St,On,rr)=>{var ir,cr;return new Er.MidwayPipelineService((cr=(ir=rr[jr.REQUEST_OBJ_CTX_KEY])===null||ir===void 0?void 0:ir.requestContext)!==null&&cr!==void 0?cr:this.applicationContext,On.valves)}));this.decoratorService.registerPropertyHandler(ur.APPLICATION_KEY,((St,On)=>{if(On.type){const St=this.applicationManager.getApplication(On.type);if(!St){throw new Br.MidwayCommonError(`Framework ${On.type} not Found`)}return St}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(ur.PLUGIN_KEY,((St,On)=>{var rr;return this.getMainApp()[(rr=On.identifier)!==null&&rr!==void 0?rr:St]}));this.decoratorService.registerPropertyHandler(ur.FACTORY_SERVICE_CLIENT_KEY,((St,On)=>{const rr=this.applicationContext.get(On.serviceFactoryClz);const ir=On.clientName||rr.getDefaultClientName();if(ir&&rr.has(ir)){return rr.get(ir)}else{if(!ir){throw new Br.MidwayParameterError(`Please set clientName or options.defaultClientName for ${On.serviceFactoryClz.name}).`)}else{throw new Br.MidwayParameterError(`ClientName(${ir} not found in ${On.serviceFactoryClz.name}).`)}}}));let rr=(0,ur.listModule)(ur.FRAMEWORK_KEY);rr=filterProtoFramework(rr);Vr(`[core]: Found Framework length = ${rr.length}`);if(rr.length){for(const On of rr){if(!this.applicationContext.hasDefinition((0,ur.getProviderUUId)(On))){Vr(`[core]: Found Framework "${On.name}" but missing definition, skip initialize.`);continue}const rr=await this.applicationContext.getAsync(On,[this.applicationContext]);if(rr.isEnable()){Ur.MidwayInitializerPerformanceManager.frameworkInitializeStart(rr.getFrameworkName());await rr.initialize({applicationContext:this.applicationContext,namespace:rr.getNamespace(),...this.globalOptions});Ur.MidwayInitializerPerformanceManager.frameworkInitializeEnd(rr.getFrameworkName());Vr(`[core]: Found Framework "${rr.getFrameworkName()}" and initialize.`)}else{Vr(`[core]: Found Framework "${rr.getFrameworkName()}" and delay initialize.`)}const ir=this.applicationContext.registry.getDefinition((0,ur.getProviderUUId)(On));rr.setNamespace(ir===null||ir===void 0?void 0:ir.namespace);this.applicationManager.addFramework((St=ir===null||ir===void 0?void 0:ir.namespace)!==null&&St!==void 0?St:rr.getFrameworkName(),rr);this.globalFrameworkList.push(rr)}let ir;const cr=this.applicationContext.getNamespaceList();for(const St of cr){const On=this.applicationManager.getApplication(St);if(On){ir=St;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(On=this.applicationManager.getFramework(ir))!==null&&On!==void 0?On:this.globalFrameworkList[0];Vr(`[core]: Current main Framework is "${ir}".`)}await this.aspectService.loadAspect()}getMainApp(){var St;return(St=this.mainFramework)===null||St===void 0?void 0:St.getApplication()}getMainFramework(){return this.mainFramework}getFramework(St){return this.applicationManager.getFramework(St)}async runFramework(){const St=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((On,rr)=>St.indexOf(On.getNamespace())-St.indexOf(rr.getNamespace())));for(const St of this.globalFrameworkList){if(St.isEnable()){Ur.MidwayInitializerPerformanceManager.frameworkRunStart(St.getFrameworkName());await St.run();Vr(`[core]: Found Framework "${St.getFrameworkName()}" and run.`);Ur.MidwayInitializerPerformanceManager.frameworkRunEnd(St.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((St=>St.stop())))}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayConfigService)],Wr.prototype,"configService",void 0);ir([(0,ur.Inject)(),cr("design:type",br.MidwayLoggerService)],Wr.prototype,"loggerService",void 0);ir([(0,ur.Inject)(),cr("design:type",Pr.MidwayAspectService)],Wr.prototype,"aspectService",void 0);ir([(0,ur.Inject)(),cr("design:type",kr.MidwayDecoratorService)],Wr.prototype,"decoratorService",void 0);ir([(0,ur.Inject)(),cr("design:type",Ir.MidwayApplicationManager)],Wr.prototype,"applicationManager",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Wr.prototype,"init",null);Wr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object,Object])],Wr);On.MidwayFrameworkService=Wr;function filterProtoFramework(St){const On=[];for(const rr of St){let St=Object.getPrototypeOf(rr);while(St.name&&St.name!==Sr.BaseFramework.name){On.push(St);St=Object.getPrototypeOf(St)}}return St.filter((St=>!On.includes(St)))}},658:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayHealthService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(78842);const br=rr(65308);let Sr=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(St){const On=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(On);for(const On of St){if(On.instance&&On.instance["onHealthCheck"]){this.healthCheckMethods.push({item:On.instance["onHealthCheck"].bind(On.instance),meta:{namespace:On.namespace}})}}}async getStatus(){const St=await(0,br.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((St=>({item:St.item(this.applicationContext),meta:St.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(St,On)=>{if(St["status"]!==undefined){return{namespace:On.namespace,...St}}else{return{status:false,namespace:On.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(St,On)=>({status:false,namespace:On.namespace,reason:St.message})});const On=St.find((St=>!St.status));return{status:!On,namespace:On===null||On===void 0?void 0:On.namespace,reason:On===null||On===void 0?void 0:On.reason,results:St}}setCheckTimeout(St){this.healthCheckTimeout=St}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayConfigService)],Sr.prototype,"configService",void 0);ir([(0,ur.ApplicationContext)(),cr("design:type",Object)],Sr.prototype,"applicationContext",void 0);Sr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton)],Sr);On.MidwayHealthService=Sr},37482:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayInformationService=void 0;const ur=rr(6192);const pr=rr(65308);const fr=rr(16928);const br=rr(49757);const Sr=rr(79896);let Er=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,fr.dirname)(this.baseDir)}const St=(0,fr.join)(this.appDir,"package.json");if((0,Sr.existsSync)(St)){const On=(0,Sr.readFileSync)(St,{encoding:"utf-8"});this.pkg=JSON.parse(On)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,pr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var St;return((St=this.pkg)===null||St===void 0?void 0:St["name"])||""}getRoot(){const St=(0,pr.isDevelopmentEnvironment)((0,pr.getCurrentEnvironment)());return St?this.getAppDir():this.getHome()}};ir([(0,br.Inject)(),cr("design:type",String)],Er.prototype,"appDir",void 0);ir([(0,br.Inject)(),cr("design:type",String)],Er.prototype,"baseDir",void 0);ir([(0,br.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Er.prototype,"init",null);Er=ir([(0,br.Provide)(),(0,br.Scope)(ur.ScopeEnum.Singleton)],Er);On.MidwayInformationService=Er},13328:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayLifeCycleService=void 0;const ur=rr(6192);const pr=rr(49757);const fr=rr(24451);const br=rr(33332);const Sr=rr(78842);const Er=rr(39023);const kr=rr(77306);const Pr=rr(658);const Ir=rr(70032);const Lr=(0,Er.debuglog)("midway:debug");let Br=class MidwayLifeCycleService{constructor(St){this.applicationContext=St;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const St=(0,pr.listModule)(pr.CONFIGURATION_KEY);Lr(`[core]: Found Configuration length = ${St.length}`);for(const On of St){if(On.target instanceof fr.FunctionalConfiguration){On.instance=On.target}else{Lr(`[core]: Lifecycle run ${On.namespace} init`);On.instance=await this.applicationContext.getAsync(On.target)}On.instance&&this.lifecycleInstanceList.push(On)}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",(St=>{if(St){this.configService.addObject(St)}}));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 St=(0,pr.listModule)(pr.CONFIGURATION_KEY)||[];for(const On of St.reverse()){let St;if(On.target instanceof fr.FunctionalConfiguration){St=On.target}else{St=await this.applicationContext.getAsync(On.target)}await this.runContainerLifeCycle(St,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(St,On,rr){if(Array.isArray(St)){for(const ir of St){if(typeof ir.instance[On]==="function"){Lr(`[core]: Lifecycle run ${ir.instance.constructor.name} ${On}`);Ir.MidwayInitializerPerformanceManager.lifecycleStart(ir.namespace,On);const St=await ir.instance[On](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(St)}Ir.MidwayInitializerPerformanceManager.lifecycleEnd(ir.namespace,On)}}}else{if(typeof St[On]==="function"){const ir=St.constructor.name;Lr(`[core]: Lifecycle run ${ir} ${On}`);Ir.MidwayInitializerPerformanceManager.lifecycleStart(ir,On);const cr=await St[On](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(cr)}Ir.MidwayInitializerPerformanceManager.lifecycleEnd(ir,On)}}}async runObjectLifeCycle(St,On){for(const rr of St){if(typeof rr.instance[On]==="function"){Lr(`[core]: Lifecycle run ${rr.instance.constructor.name} ${On}`);return await this.applicationContext[On](rr.instance[On].bind(rr.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};ir([(0,pr.Inject)(),cr("design:type",br.MidwayFrameworkService)],Br.prototype,"frameworkService",void 0);ir([(0,pr.Inject)(),cr("design:type",Sr.MidwayConfigService)],Br.prototype,"configService",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.MidwayMockService)],Br.prototype,"mockService",void 0);ir([(0,pr.Inject)(),cr("design:type",Pr.MidwayHealthService)],Br.prototype,"healthService",void 0);ir([(0,pr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Br.prototype,"init",null);Br=ir([(0,pr.Provide)(),(0,pr.Scope)(ur.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Br);On.MidwayLifeCycleService=Br},34888:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayLoggerService=void 0;const ur=rr(49757);const pr=rr(78842);const fr=rr(64842);const br=rr(6192);const Sr=rr(82535);const Er=rr(86314);let kr=class MidwayLoggerService extends fr.ServiceFactory{constructor(St,On={}){super();this.applicationContext=St;this.globalOptions=On;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var St;const On=this.configService.getConfiguration("loggerFactory");this.loggerFactory=On||this.globalOptions["loggerFactory"]||new Sr.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new Er.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const rr=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(rr,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(St=this.applicationContext)===null||St===void 0?void 0:St.registerObject("logger",this.getLogger("appLogger"))}createClient(St,On){if(St.aliasName){this.aliasLoggerMap.set(St.aliasName,On)}if(!St.lazyLoad){this.loggerFactory.createLogger(On,St)}else{delete St["lazyLoad"];this.lazyLoggerConfigMap.set(On,St)}}getName(){return"logger"}createLogger(St,On){delete On["aliasName"];return this.loggerFactory.createLogger(St,On)}getLogger(St){if(this.aliasLoggerMap.has(St)){St=this.aliasLoggerMap.get(St)}const On=this.loggerFactory.getLogger(St);if(On){return On}if(this.lazyLoggerConfigMap.has(St)){this.createClient(this.lazyLoggerConfigMap.get(St),St);this.lazyLoggerConfigMap.delete(St)}return this.loggerFactory.getLogger(St)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(St,On,rr){return this.loggerFactory.createContextLogger(St,On,rr)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};ir([(0,ur.Inject)(),cr("design:type",pr.MidwayConfigService)],kr.prototype,"configService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],kr.prototype,"init",null);kr=ir([(0,ur.Provide)(),(0,ur.Scope)(br.ScopeEnum.Singleton),cr("design:paramtypes",[Object,Object])],kr);On.MidwayLoggerService=kr},68220:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayMiddlewareService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(86314);const br=rr(65308);const Sr=rr(63289);const Er=rr(39023);const kr=(0,Er.debuglog)("midway:debug");let Pr=class MidwayMiddlewareService{constructor(St){this.applicationContext=St}async compose(St,On,rr){var ir;if(!Array.isArray(St)){throw new fr.MidwayParameterError("Middleware stack must be an array")}const cr=[];for(let rr of St){if(Sr.Types.isClass(rr)||typeof rr==="string"||(rr===null||rr===void 0?void 0:rr["middleware"])){let St=(ir=rr===null||rr===void 0?void 0:rr["middleware"])!==null&&ir!==void 0?ir:rr;const ur=rr===null||rr===void 0?void 0:rr["options"];let pr=rr===null||rr===void 0?void 0:rr["name"];if(typeof St==="string"&&!this.applicationContext.hasDefinition(St)){throw new fr.MidwayCommonError(`Middleware definition of "${St}" not found in midway container`)}const Sr=await this.applicationContext.getAsync(St);if(Sr){pr=pr!==null&&pr!==void 0?pr:Sr.constructor.name;St=await Sr.resolve(On,ur);if(!St){continue}if(!Sr.match&&!Sr.ignore){if(!St.name){St._name=pr}cr.push(St)}else{const On=(0,br.pathMatching)({match:Sr.match,ignore:Sr.ignore,thisResolver:Sr});rr=(rr,ir,cr)=>{if(!On(rr))return ir();return St(rr,ir,cr)};rr._name=pr;cr.push(rr)}}else{throw new fr.MidwayCommonError("Middleware must have resolve method!")}}else{cr.push(rr)}}const composeFn=(St,On)=>{const ir=(0,br.isIncludeProperty)(St,"body");let ur=-1;return dispatch(0);function dispatch(pr){if(pr<=ur)return Promise.reject(new fr.MidwayCommonError("next() called multiple times"));ur=pr;let br=cr[pr];if(pr===cr.length)br=On;if(!br)return Promise.resolve();const Sr=`${rr?`${rr}.`:""}${ur} ${br._name||br.name||"anonymous"}`;const Er=Date.now();kr(`[middleware]: in ${Sr} +0`);try{if(ir){return Promise.resolve(br(St,dispatch.bind(null,pr+1),{index:ur})).then((On=>{if(On!==undefined&&On!==St["body"]){St["body"]=On}else if(St["body"]!==undefined){On=St["body"]}kr(`[middleware]: out ${Sr} +${Date.now()-Er} with body`);return On}))}else{return Promise.resolve(br(St,dispatch.bind(null,pr+1),{index:ur})).then((St=>{kr(`[middleware]: out ${Sr} +${Date.now()-Er}`);return St}))}}catch(St){kr(`[middleware]: out ${Sr} +${Date.now()-Er} with err ${St.message}`);return Promise.reject(St)}}};if(rr){composeFn._name=rr}return composeFn}};Pr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Pr);On.MidwayMiddlewareService=Pr},77306:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur;Object.defineProperty(On,"__esModule",{value:true});On.MidwayMockService=void 0;const pr=rr(6192);const fr=rr(49757);const br=rr(63289);let Sr=ur=class MidwayMockService{constructor(St){this.applicationContext=St;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(ur.prepareMocks.length>0){for(const St of ur.prepareMocks){this.mockProperty(St.obj,St.key,St.value,St.group)}ur.prepareMocks=[]}}static mockClassProperty(St,On,rr,ir="default"){this.mockProperty(St.prototype,On,rr,ir)}static mockProperty(St,On,rr,ir="default"){this.prepareMocks.push({obj:St,key:On,value:rr,group:ir})}mockClassProperty(St,On,rr,ir="default"){return this.mockProperty(St.prototype,On,rr,ir)}mockProperty(St,On,rr,ir="default"){const cr=St.hasOwnProperty(On);const ur={obj:St,key:On,descriptor:Object.getOwnPropertyDescriptor(St,On),hasOwnProperty:cr};if(!this.mocks.has(ir)){this.mocks.set(ir,[])}this.mocks.get(ir).push(ur);if(cr){delete St[On]}let pr=this.cache.get(ir);if(!pr){pr=new Map;this.cache.set(ir,pr)}let fr=pr.get(St);if(!fr){fr=new Set;pr.set(St,fr)}fr.add(On);const br=this.overridePropertyDescriptor(rr);Object.defineProperty(St,On,br)}mockContext(St,On,rr,ir="default"){if(!this.contextMocks.has(ir)){this.contextMocks.set(ir,[])}this.contextMocks.get(ir).push({app:St,key:On,value:rr})}restore(St="default"){this.restoreGroup(St)}restoreAll(){const St=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const On of St){this.restoreGroup(On)}this.simulatorList=[]}restoreGroup(St){const On=this.mocks.get(St)||[];for(let St=On.length-1;St>=0;St--){const rr=On[St];if(!rr.hasOwnProperty){delete rr.obj[rr.key]}else{Object.defineProperty(rr.obj,rr.key,rr.descriptor)}}this.mocks.delete(St);this.contextMocks.delete(St);this.cache.delete(St);this.simulatorList=this.simulatorList.filter((On=>On["group"]!==St))}isMocked(St,On,rr="default"){if((0,br.isClass)(St)){St=St.prototype}const ir=this.cache.get(rr);const cr=ir?ir.get(St):undefined;return cr?cr.has(On):false}applyContextMocks(St,On){for(const[,rr]of this.contextMocks){for(const ir of rr){if(ir.app===St){const St=this.overridePropertyDescriptor(ir.value);if(typeof ir.key==="string"){Object.defineProperty(On,ir.key,St)}else{ir.key(On)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((St,On)=>St+On.length),0)}overridePropertyDescriptor(St){const On={configurable:true,enumerable:true};if(St&&(St.get||St.set)){On.get=St.get;On.set=St.set}else{On.value=St;On.writable=true}return On}async initSimulation(St="default"){const On=(0,fr.listModule)(fr.MOCK_KEY);for(const rr of On){const On=await this.applicationContext.getAsync(rr);if(await On.enableCondition()){On["group"]=St;this.simulatorList.push(On)}}}async runSimulatorSetup(){var St;for(const On of this.simulatorList){await((St=On.setup)===null||St===void 0?void 0:St.call(On))}}async runSimulatorTearDown(){var St;for(let On=this.simulatorList.length-1;On>=0;On--){const rr=this.simulatorList[On];await((St=rr.tearDown)===null||St===void 0?void 0:St.call(rr))}}async runSimulatorAppSetup(St){var On;for(const rr of this.simulatorList){await((On=rr.appSetup)===null||On===void 0?void 0:On.call(rr,St))}}async runSimulatorAppTearDown(St){var On;for(let rr=this.simulatorList.length-1;rr>=0;rr--){const ir=this.simulatorList[rr];await((On=ir.appTearDown)===null||On===void 0?void 0:On.call(ir,St))}}async runSimulatorContextSetup(St,On){var rr;for(const ir of this.simulatorList){await((rr=ir.contextSetup)===null||rr===void 0?void 0:rr.call(ir,St,On))}}async runSimulatorContextTearDown(St,On){var rr;for(let ir=this.simulatorList.length-1;ir>=0;ir--){const cr=this.simulatorList[ir];await((rr=cr===null||cr===void 0?void 0:cr.contextTearDown)===null||rr===void 0?void 0:rr.call(cr,St,On))}}};Sr.prepareMocks=[];ir([(0,fr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Sr.prototype,"init",null);ir([(0,fr.Destroy)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Sr.prototype,"restoreAll",null);Sr=ur=ir([(0,fr.Provide)(),(0,fr.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Sr);On.MidwayMockService=Sr},28602:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayPipelineService=On.PipelineContext=void 0;const ir=rr(49757);class PipelineContext{constructor(St){this.info={current:null,currentName:null};this.data=new Map;this.args=St}get(St){return this.data.get(St)}set(St,On){this.data.set(St,On)}keys(){const St=[];const On=this.data.keys();for(const rr of On){St.push(rr)}return St}}On.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(St,On){this.applicationContext=St;this.valves=On}async parallel(St){const On=this.prepareParallelValves(St);const rr=await Promise.all(On);return this.packResult(rr,false)}async concat(St){const On=this.prepareParallelValves(St);const rr=await Promise.all(On);return this.packResult(rr,true)}async series(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const ir={success:true,result:null};const cr={};const ur={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let pr=1;for(const St of On){ur.prev=ur.current;ur.prevName=getName(ur.prev);ur.current=St;ur.currentName=getName(ur.current);if(pr<On.length){ur.next=On[pr];ur.nextName=getName(ur.next)}else{ur.next=undefined;ur.nextName=undefined}pr+=1;rr.info=ur;try{const On=await this.applicationContext.getAsync(St);const ir=await On.invoke(rr);let pr=St;if(On.alias){pr=On.alias}cr[pr]=ir;ur.prevValue=ir}catch(On){ir.success=false;ir.error={valveName:typeof St==="string"?St:St.name,message:On.message,error:On};return ir}}ir.result=cr;return ir}async concatSeries(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const ir={success:true,result:null};const cr=[];const ur={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let pr=1;for(const St of On){ur.prev=ur.current;ur.prevName=getName(ur.prev);ur.current=St;ur.currentName=getName(ur.current);if(pr<On.length){ur.next=On[pr];ur.nextName=getName(ur.next)}else{ur.next=undefined;ur.nextName=undefined}pr+=1;rr.info=ur;try{const On=await this.applicationContext.getAsync(St);const ir=await On.invoke(rr);cr.push(ir);ur.prevValue=ir}catch(On){ir.success=false;ir.error={valveName:typeof St==="string"?St:St.name,message:On.message,error:On};return ir}}ir.result=cr;return ir}async waterfall(St){const On=await this.concatSeries(St);if(On.success){const St=On.result;On.result=St[St.length-1]}return On}mergeValves(St){let On=[];if(this.valves&&this.valves.length>0){On=this.valves}let rr=[];if(St){for(const ir of St){if(On.includes(ir)){rr.push(ir)}}}else{rr=On}return rr}prepareParallelValves(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);return On.map((async St=>{const On={valveName:St,dataKey:St,data:null};try{const ir=await this.applicationContext.getAsync(St);if(ir.alias){On.dataKey=ir.alias}On.data=await ir.invoke(rr)}catch(St){On.error=St}return On}))}packResult(St,On=false){const rr={success:true,result:null};let ir;if(On){ir=[]}else{ir={}}for(const cr of St){if(cr.error){rr.success=false;rr.error={valveName:typeof cr.valveName==="string"?cr.valveName:cr.valveName.name,message:cr.error.message,error:cr.error};return rr}else{if(On){ir.push(cr.data)}else{ir[cr.dataKey]=cr.data}}}rr.result=ir;return rr}}On.MidwayPipelineService=MidwayPipelineService;function getName(St){if(St){if(typeof St==="string"){return St}else{return(0,ir.getProviderName)(St)}}return null}},42592:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.WebRouterCollector=On.MidwayServerlessFunctionService=void 0;const ur=rr(49757);const pr=rr(19985);const fr=rr(9288);const br=rr(1845);const Sr=rr(50539);const Er=rr(6192);let kr=class MidwayServerlessFunctionService extends pr.MidwayWebRouterService{constructor(St={}){super(Object.assign({},St,{includeFunctionRouter:true}));this.options=St}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const St of this.routes.values()){for(const On of St){if(On.requestMethod==="all"){On.functionTriggerMetadata=On.functionTriggerMetadata||{};On.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const St=(0,ur.listModule)(ur.FUNC_KEY);for(const On of St){this.collectFunctionRoute(On)}}collectFunctionRoute(St){var On,rr,ir,cr,pr,fr,br,Sr,Er,kr,Pr,Ir,Lr,Br,jr,Ur,Vr;const Wr=(0,ur.getClassMetadata)(ur.FUNC_KEY,St);const zr=(0,ur.getProviderName)(St);const qr=(0,ur.getProviderUUId)(St);const Kr="/";if(!this.routes.has(Kr)){this.routes.set(Kr,[]);this.routesPriority.push({prefix:Kr,priority:-999,middleware:[],routerOptions:{},controllerId:zr,routerModule:St})}for(const Xr of Wr){if((On=Xr["metadata"])===null||On===void 0?void 0:On["path"]){const On=(0,ur.getPropertyDataFromClass)(ur.WEB_ROUTER_PARAM_KEY,St,Xr["methodName"])||[];const Pr=(0,ur.getPropertyMetadata)(ur.WEB_RESPONSE_KEY,St,Xr["methodName"])||[];const Ir={id:qr,prefix:Kr,routerName:"",url:Xr["metadata"]["path"],requestMethod:(ir=(rr=Xr["metadata"])===null||rr===void 0?void 0:rr["method"])!==null&&ir!==void 0?ir:"get",method:Xr["methodName"],description:"",summary:"",handlerName:`${zr}.${Xr["methodName"]}`,funcHandlerName:`${zr}.${Xr["methodName"]}`,controllerId:zr,middleware:((cr=Xr["metadata"])===null||cr===void 0?void 0:cr["middleware"])||[],controllerMiddleware:[],requestMetadata:On,responseMetadata:Pr};const Lr=(0,ur.getPropertyMetadata)(ur.SERVERLESS_FUNC_KEY,St,Xr["methodName"])||{};const Br=(br=(pr=Lr["functionName"])!==null&&pr!==void 0?pr:(fr=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||fr===void 0?void 0:fr["functionName"])!==null&&br!==void 0?br:createFunctionName(St,Xr["methodName"]);const jr=(kr=(Sr=Lr["handlerName"])!==null&&Sr!==void 0?Sr:(Er=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||Er===void 0?void 0:Er["handlerName"])!==null&&kr!==void 0?kr:Ir.funcHandlerName;Ir.functionName=Br;Ir.funcHandlerName=jr;Ir.functionTriggerName=Xr["type"];Ir.functionTriggerMetadata=Xr["metadata"];Ir.functionMetadata={functionName:Br,...Lr};this.checkDuplicateAndPush(Kr,Ir)}else{const On=(0,ur.getPropertyMetadata)(ur.SERVERLESS_FUNC_KEY,St,Xr["methodName"])||{};const rr=(Lr=(Pr=On["functionName"])!==null&&Pr!==void 0?Pr:(Ir=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||Ir===void 0?void 0:Ir["functionName"])!==null&&Lr!==void 0?Lr:createFunctionName(St,Xr["methodName"]);const ir=(Ur=(Br=On["handlerName"])!==null&&Br!==void 0?Br:(jr=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||jr===void 0?void 0:jr["handlerName"])!==null&&Ur!==void 0?Ur:`${zr}.${Xr["methodName"]}`;this.checkDuplicateAndPush(Kr,{id:qr,prefix:Kr,routerName:"",url:"",requestMethod:"",method:Xr["methodName"],description:"",summary:"",handlerName:`${zr}.${Xr["methodName"]}`,funcHandlerName:ir,controllerId:zr,middleware:((Vr=Xr["metadata"])===null||Vr===void 0?void 0:Vr["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:rr,functionTriggerName:Xr["type"],functionTriggerMetadata:Xr["metadata"],functionMetadata:{functionName:rr,...On}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(St,On,rr={}){var ir,cr;const ur="";if(!this.routes.has(ur)){this.routes.set(ur,[]);this.routesPriority.push({prefix:ur,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const pr=(ir=On.functionName)!==null&&ir!==void 0?ir:rr.functionName;this.checkDuplicateAndPush(ur,{id:null,method:St,url:On.metadata["path"]||"",requestMethod:On.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:On.handlerName||rr.handlerName,controllerId:"",middleware:((cr=On.metadata)===null||cr===void 0?void 0:cr.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:pr,functionTriggerName:On.metadata.name,functionTriggerMetadata:On.metadata,functionMetadata:{functionName:pr,...rr}})}};kr=ir([(0,ur.Provide)(),(0,ur.Scope)(Er.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],kr);On.MidwayServerlessFunctionService=kr;function createFunctionName(St,On){return(0,ur.getProviderName)(St).replace(/[:#]/g,"-")+"-"+On}class WebRouterCollector{constructor(St="",On={}){this.baseDir=St;this.options=On}async init(){if(!this.proxy){if(this.baseDir){const St=new fr.MidwayContainer;(0,ur.bindContainer)(St);St.setFileDetector(new br.CommonJSFileDetector({loadDir:this.baseDir}));await St.ready()}if(this.options.includeFunctionRouter){if((0,Sr.getCurrentMainFramework)()){this.proxy=await(0,Sr.getCurrentMainFramework)().getApplicationContext().getAsync(kr,[this.options])}else{this.proxy=new kr(this.options)}}else{if((0,Sr.getCurrentMainFramework)()){this.proxy=await(0,Sr.getCurrentMainFramework)().getApplicationContext().getAsync(pr.MidwayWebRouterService,[this.options])}else{this.proxy=new pr.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()}}On.WebRouterCollector=WebRouterCollector},19985:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayWebRouterService=void 0;const ur=rr(49757);const pr=rr(65308);const fr=rr(86314);const br=rr(39023);const Sr=rr(73861);const Er=rr(63289);const kr=rr(6192);const Pr=br.debuglog("midway:debug");let Ir=class MidwayWebRouterService{constructor(St={}){this.options=St;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const St=(0,ur.listModule)(ur.CONTROLLER_KEY);for(const On of St){const St=(0,ur.getClassMetadata)(ur.CONTROLLER_KEY,On);this.addController(On,St,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((St=>{const On=this.routes.get(St.prefix);if(On.length>0){return true}else{this.routes.delete(St.prefix);return false}}));for(const St of this.routes.keys()){const On=this.routes.get(St);this.routes.set(St,this.sortRouter(On))}this.routesPriority=this.routesPriority.sort(((St,On)=>On.prefix.length-St.prefix.length))}addController(St,On,rr={},ir=false){var cr;if(rr&&typeof rr==="boolean"){ir=rr;rr=undefined}if(!rr){rr={}}const br=(0,ur.getProviderName)(St);Pr(`[core]: Found Controller ${br}.`);const Sr=(0,ur.getProviderUUId)(St);On.routerOptions=On.routerOptions||{};let Er;const Ir=On.routerOptions.middleware;const Lr=!!((cr=On.routerOptions)===null||cr===void 0?void 0:cr.ignoreGlobalPrefix);let Br=(0,pr.joinURLPath)(this.options.globalPrefix,On.prefix||"/");const jr=On.prefix||"/";if(Lr){Br=jr}if(/\*/.test(Br)){throw new fr.MidwayCommonError(`Router prefix ${Br} can't set string with *`)}if(!this.routes.has(Br)){this.routes.set(Br,[]);this.routesPriority.push({prefix:Br,priority:Br==="/"&&Er===undefined?-999:0,middleware:Ir,routerOptions:On.routerOptions,controllerId:br,routerModule:St})}else{if(Ir&&Ir.length>0){const St=this.routesPriority.filter((St=>St.prefix===Br))[0];throw new fr.MidwayDuplicateControllerOptionsError(Br,br,St.controllerId)}}if(!this.routes.has(jr)){this.routes.set(jr,[]);this.routesPriority.push({prefix:jr,priority:jr==="/"&&Er===undefined?-999:0,middleware:Ir,routerOptions:On.routerOptions,controllerId:br,routerModule:St})}const Ur=(0,ur.getClassMetadata)(ur.WEB_ROUTER_KEY,St);if(Ur&&typeof Ur[Symbol.iterator]==="function"){for(const On of Ur){const cr=(0,ur.getPropertyDataFromClass)(ur.WEB_ROUTER_PARAM_KEY,St,On.method)||[];const fr=(0,ur.getPropertyMetadata)(ur.WEB_RESPONSE_KEY,St,On.method)||[];const Er={id:Sr,prefix:On.ignoreGlobalPrefix?jr:Br,routerName:On.routerName||"",url:On.path,requestMethod:On.requestMethod,method:On.method,description:On.description||"",summary:On.summary||"",handlerName:`${br}.${On.method}`,funcHandlerName:`${br}.${On.method}`,controllerId:br,controllerClz:St,middleware:On.middleware||[],controllerMiddleware:Ir||[],requestMetadata:cr,responseMetadata:fr};if(ir){Er.functionName=br+"-"+On.method;Er.functionTriggerName=kr.ServerlessTriggerType.HTTP;Er.functionTriggerMetadata={path:(0,pr.joinURLPath)(Br,On.path.toString()),method:On.requestMethod};Er.functionMetadata={functionName:Er.functionName}}if(rr.resourceFilter&&!rr.resourceFilter(Er)){continue}this.checkDuplicateAndPush(Er.prefix,Er)}}}addRouter(St,On){const rr=On.prefix||"";On.requestMethod=(On.requestMethod||"GET").toUpperCase();if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(rr,Object.assign(On,{method:St}));this.sortPrefixAndRouter()}sortRouter(St){return St.map((St=>{const On=St.url.toString();const rr=Er.Types.isRegExp(St.url)?On.split("\\/"):On.split("/");let ir=0;for(const St of rr){if(St===""||St.includes(":")||St.includes("*")){ir+=0}else{ir+=1}}let cr=2;const ur=On.includes(":")?On.replace(/:.+$/,""):"";if(ur){cr=1}if(On.includes("*")){cr=0}return{...St,_pureRouter:On.replace(/\**$/,"").replace(/:\w+/,"123"),_level:On.split("/").length-1,_paramString:ur,_category:cr,_weight:ir}})).sort(((St,On)=>{if(St._category!==On._category){return On._category-St._category}if(St._weight!==On._weight){return On._weight-St._weight}if(St._level===On._level){if(On._pureRouter===St._pureRouter){return St.url.toString().length-On.url.toString().length}return On._pureRouter.length-St._pureRouter.length}return On._level-St._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(St={}){if(!this.isReady){await this.analyze();this.isReady=true}let On=[];for(const St of this.routesPriority){On=On.concat(this.routes.get(St.prefix))}if(St.compileUrlPattern){for(const St of On){if(St.fullUrlFlattenString){St.fullUrlCompiledRegexp=Sr.PathToRegexpUtil.toRegexp(St.fullUrlFlattenString)}}}return On}async getMatchedRouterInfo(St,On){const rr=await this.getFlattenRouterTable({compileUrlPattern:true});let ir;for(const cr of rr){if(cr.fullUrlCompiledRegexp){const rr=cr["requestMethod"].toUpperCase();if(("ALL"===rr||On.toUpperCase()===rr)&&cr.fullUrlCompiledRegexp.test(St)){ir=cr;break}}}return ir}checkDuplicateAndPush(St,On){const rr=this.routes.get(St);const ir=rr.filter((St=>On.url&&On.requestMethod&&St.url===On.url&&St.requestMethod===On.requestMethod));if(ir&&ir.length){throw new fr.MidwayDuplicateRouteError(`${On.requestMethod} ${On.url}`,`${ir[0].handlerName}`,`${On.handlerName}`)}if(!On.fullUrlFlattenString&&On.url&&typeof On.url==="string"){On.fullUrl=(0,pr.joinURLPath)(St,On.url);if(/\*$/.test(On.fullUrl)){On.fullUrlFlattenString=On.fullUrl.replace("*","(.*)")}else{On.fullUrlFlattenString=On.fullUrl}}rr.push(On)}};Ir=ir([(0,ur.Provide)(),(0,ur.Scope)(kr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Ir);On.MidwayWebRouterService=Ir},29222:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.prepareGlobalApplicationContext=On.prepareGlobalApplicationContextAsync=On.destroyGlobalApplicationContext=On.initializeGlobalApplicationContext=void 0;const ir=rr(46123);const cr=rr(42193);const ur=rr(49757);const pr=rr(39023);const fr=rr(42592);const br=rr(16928);const Sr=rr(658);const Er=rr(70032);const kr=pr.debuglog("midway:debug");let Pr=1;function printStepDebugInfo(St){kr(`\n\nStep ${Pr++}: ${St}\n`)}async function initializeGlobalApplicationContext(St){Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const On=await prepareGlobalApplicationContextAsync(St);printStepDebugInfo("Init logger");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const rr=await On.getAsync(ir.MidwayLoggerService,[On,St]);if(rr.getLogger("appLogger")){On.registerObject("logger",rr.getLogger("appLogger"))}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await On.getAsync(ir.MidwayMockService,[On]);printStepDebugInfo("Init framework");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await On.getAsync(ir.MidwayFrameworkService,[On,St]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await On.getAsync(ir.MidwayLifeCycleService,[On]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const cr=(0,ur.listPreloadModule)();for(const St of cr){await On.getAsync(St)}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return On}On.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(St){const On=await St.getAsync(ir.MidwayLoggerService);const rr=On.getCurrentLoggerFactory();const cr=await St.getAsync(ir.MidwayLifeCycleService);await cr.stop();await St.stop();(0,ur.clearBindContainer)();rr.close();Er.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}On.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(St){var On,rr,Pr,Ir,Lr;printStepDebugInfo("Ready to create applicationContext");kr('[core]: start "initializeGlobalApplicationContext"');kr(`[core]: bootstrap options = ${pr.inspect(St)}`);const Br=(On=St.appDir)!==null&&On!==void 0?On:"";const jr=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Ur=(Pr=St.applicationContext)!==null&&Pr!==void 0?Pr:new ir.MidwayContainer;kr("[core]: delegate module map from decoratorManager");(0,ur.bindContainer)(Ur);global["MIDWAY_APPLICATION_CONTEXT"]=Ur;Ur.registerObject("baseDir",jr);Ur.registerObject("appDir",Br);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);kr("[core]: set default file detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){kr("[core]: set module load type = %s",St.moduleLoadType);if(!St.imports){St.imports=[await(0,ir.loadModule)((0,br.join)(jr,`configuration${(0,ir.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:St.moduleLoadType,safeLoad:true})]}if(St.moduleDetector===undefined){if(St.moduleLoadType==="esm"){Ur.setFileDetector(new ir.ESModuleFileDetector({loadDir:jr,ignore:(Ir=St.ignore)!==null&&Ir!==void 0?Ir:[]}));St.moduleLoadType="esm"}else{Ur.setFileDetector(new ir.CommonJSFileDetector({loadDir:jr,ignore:(Lr=St.ignore)!==null&&Lr!==void 0?Lr:[]}))}}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Ur.bindClass(ir.MidwayEnvironmentService);Ur.bindClass(ir.MidwayInformationService);Ur.bindClass(ir.MidwayAspectService);Ur.bindClass(ir.MidwayDecoratorService);Ur.bindClass(ir.MidwayConfigService);Ur.bindClass(ir.MidwayLoggerService);Ur.bindClass(ir.MidwayApplicationManager);Ur.bindClass(ir.MidwayFrameworkService);Ur.bindClass(ir.MidwayMiddlewareService);Ur.bindClass(ir.MidwayLifeCycleService);Ur.bindClass(ir.MidwayMockService);Ur.bindClass(ir.MidwayWebRouterService);Ur.bindClass(fr.MidwayServerlessFunctionService);Ur.bindClass(Sr.MidwayHealthService);Ur.bindClass(ir.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const On of St.preloadModules){Ur.bindClass(On)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Vr=Ur.get(ir.MidwayEnvironmentService);Vr.setModuleLoadType(St.moduleLoadType);const Wr=Ur.get(ir.MidwayConfigService);Wr.add([{default:cr.default}]);Ur.get(ir.MidwayAspectService,[Ur]);Ur.get(ir.MidwayDecoratorService,[Ur]);printStepDebugInfo("Load imports(component) and user code configuration module");Ur.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await Ur.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){Wr.add(St.globalConfig)}else{Wr.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");Wr.load();kr("[core]: Current config = %j",Wr.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Ur.get(ir.MidwayMiddlewareService,[Ur]);return Ur}On.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(St){var On,rr,Pr,Ir;printStepDebugInfo("Ready to create applicationContext");kr('[core]: start "initializeGlobalApplicationContext"');kr(`[core]: bootstrap options = ${pr.inspect(St)}`);const Lr=(On=St.appDir)!==null&&On!==void 0?On:"";const Br=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const jr=(Pr=St.applicationContext)!==null&&Pr!==void 0?Pr:new ir.MidwayContainer;kr("[core]: delegate module map from decoratorManager");(0,ur.bindContainer)(jr);global["MIDWAY_APPLICATION_CONTEXT"]=jr;jr.registerObject("baseDir",Br);jr.registerObject("appDir",Lr);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){if(St.moduleDetector===undefined){jr.setFileDetector(new ir.CommonJSFileDetector({ignore:(Ir=St.ignore)!==null&&Ir!==void 0?Ir:[]}))}else if(St.moduleDetector){jr.setFileDetector(St.moduleDetector)}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");jr.bindClass(ir.MidwayEnvironmentService);jr.bindClass(ir.MidwayInformationService);jr.bindClass(ir.MidwayAspectService);jr.bindClass(ir.MidwayDecoratorService);jr.bindClass(ir.MidwayConfigService);jr.bindClass(ir.MidwayLoggerService);jr.bindClass(ir.MidwayApplicationManager);jr.bindClass(ir.MidwayFrameworkService);jr.bindClass(ir.MidwayMiddlewareService);jr.bindClass(ir.MidwayLifeCycleService);jr.bindClass(ir.MidwayMockService);jr.bindClass(ir.MidwayWebRouterService);jr.bindClass(fr.MidwayServerlessFunctionService);jr.bindClass(Sr.MidwayHealthService);jr.bindClass(ir.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const On of St.preloadModules){jr.bindClass(On)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Ur=jr.get(ir.MidwayEnvironmentService);Ur.setModuleLoadType(St.moduleLoadType);const Vr=jr.get(ir.MidwayConfigService);Vr.add([{default:cr.default}]);jr.get(ir.MidwayAspectService,[jr]);jr.get(ir.MidwayDecoratorService,[jr]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!St.imports){St.imports=[(0,ir.safeRequire)((0,br.join)(St.baseDir,"configuration"))]}jr.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);jr.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){Vr.add(St.globalConfig)}else{Vr.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");Vr.load();kr("[core]: Current config = %j",Vr.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);jr.get(ir.MidwayMiddlewareService,[jr]);return jr}On.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.pascalCase=On.camelCase=void 0;const rr=/[\p{Lu}]/u;const ir=/[\p{Ll}]/u;const cr=/([\p{Alpha}\p{N}_]|$)/u;const ur=/[_.\- ]+/;const pr=new RegExp("^"+ur.source);const fr=new RegExp(ur.source+cr.source,"gu");const br=new RegExp("\\d+"+cr.source,"gu");const preserveCamelCase=(St,On,cr)=>{let ur=false;let pr=false;let fr=false;for(let br=0;br<St.length;br++){const Sr=St[br];if(ur&&rr.test(Sr)){St=St.slice(0,br)+"-"+St.slice(br);ur=false;fr=pr;pr=true;br++}else if(pr&&fr&&ir.test(Sr)){St=St.slice(0,br-1)+"-"+St.slice(br-1);fr=pr;pr=false;ur=true}else{ur=On(Sr)===Sr&&cr(Sr)!==Sr;fr=pr;pr=cr(Sr)===Sr&&On(Sr)!==Sr}}return St};const postProcess=(St,On)=>{fr.lastIndex=0;br.lastIndex=0;return St.replace(fr,((St,rr)=>On(rr))).replace(br,(St=>On(St)))};function camelCaseOrigin(St,On){On={pascalCase:false,...On};St=St.trim();if(St.length===0){return""}const toLowerCase=St=>St.toLowerCase();const toUpperCase=St=>St.toUpperCase();if(St.length===1){if(ur.test(St)){return""}return On.pascalCase?toUpperCase(St):toLowerCase(St)}const rr=St!==toLowerCase(St);if(rr){St=preserveCamelCase(St,toLowerCase,toUpperCase)}St=St.replace(pr,"");St=toLowerCase(St);if(On.pascalCase){St=toUpperCase(St.charAt(0))+St.slice(1)}return postProcess(St,toUpperCase)}function camelCase(St){return camelCaseOrigin(St,{pascalCase:false})}On.camelCase=camelCase;function pascalCase(St){return camelCaseOrigin(St,{pascalCase:true})}On.pascalCase=pascalCase},50539:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getCurrentAsyncContextManager=On.getCurrentMainApp=On.getCurrentMainFramework=On.getCurrentApplicationContext=void 0;const ir=rr(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];On.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];On.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const St=(0,On.getCurrentMainFramework)();if(St){return St.getApplication()}return undefined};On.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,On.getCurrentApplicationContext)().get(ir.ASYNC_CONTEXT_MANAGER_KEY);On.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.extend=void 0;const ir=rr(63289);function extend(...St){let On,rr,cr,ur,pr;let fr=St[0];let br=1;const Sr=St.length;let Er=false;if(typeof fr==="boolean"){Er=fr;fr=St[1]||{};br=2}else if(typeof fr!=="object"&&typeof fr!=="function"||fr==null){fr={}}for(;br<Sr;++br){On=St[br];if(On==null)continue;for(rr in On){if(rr==="__proto__")continue;cr=fr[rr];ur=On[rr];if(fr===ur)continue;if(Er&&ur&&ir.Types.isPlainObject(ur)){pr=cr&&ir.Types.isPlainObject(cr)?cr:{};fr[rr]=extend(Er,pr,ur)}else if(typeof ur!=="undefined"){fr[rr]=ur}}}return fr}On.extend=extend},2764:(St,On)=>{"use strict";
1
+ (()=>{var __webpack_modules__={53196:St=>{function webpackEmptyAsyncContext(St){return Promise.resolve().then((()=>{var On=new Error("Cannot find module '"+St+"'");On.code="MODULE_NOT_FOUND";throw On}))}webpackEmptyAsyncContext.keys=()=>[];webpackEmptyAsyncContext.resolve=webpackEmptyAsyncContext;webpackEmptyAsyncContext.id=53196;St.exports=webpackEmptyAsyncContext},14071:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});const cr=ir(rr(22078));const ur=rr(23718);const{logLevel:pr=""}=(0,cr.default)(process.argv.slice(2));On["default"]={keys:"1755564797722_8890",koa:{globalPrefix:"/api"},midwayLogger:{default:{transports:{console:{level:"all"}}},clients:{appLogger:{level:pr||"warn"},coreLogger:{level:pr||"info"}}},cacheManager:{clients:{default:{store:"memory"}}},i18n:{defaultLocale:"zh",localeTable:{en:{default:ur.backendMessages.en},zh:{default:ur.backendMessages.zh},fr:{default:ur.backendMessages.fr},nl:{default:ur.backendMessages.nl},"zh-TW":{default:ur.backendMessages["zh-TW"]}},writeCookie:false}}},91921:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On["default"]={}},12799:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.MainConfiguration=void 0;const Sr=rr(46123);const Er=pr(rr(47453));const kr=pr(rr(99375));const Pr=pr(rr(65295));const Ir=pr(rr(2865));const Lr=pr(rr(49179));const Br=pr(rr(62487));const jr=pr(rr(96955));const Ur=pr(rr(87735));const Vr=pr(rr(16928));const Wr=pr(rr(79896));const zr=br(rr(76982));const qr=rr(79896);const Kr=rr(24434);const Xr=br(rr(99819));const Yr=br(rr(77036));const ii=rr(31855);const oi=rr(26815);const ai=rr(54633);const pi=rr(59416);const mi=rr(61142);const bi=rr(64754);const xi=rr(10778);const wi=rr(67872);const Oi=rr(15960);const Ii=rr(4145);const Ri=pr(rr(14071));const Li=pr(rr(91921));const Bi=rr(87518);const ji=rr(18801);const Ui=pr(rr(68255));const zi={DEFAULT_PORT:Number(Bi.uri.getUrlPort(oi.KEYS.LOCAL_SERVICE_URL_DEV)),MAX_SUB_PORT_RETRIES:20};let Ki=class MainConfiguration{constructor(){this.appConfig=null;this.subServer=null}get apiUrl(){const St=this.app.getEnv();return St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL?oi.KEYS.REMOTE_SERVICE_URL_DEV:oi.KEYS.REMOTE_SERVICE_URL_PROD}getVersion(){const St=this.app.getEnv();if(St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const St=Vr.join(__dirname,"../../cli/package.json");const On=JSON.parse((0,qr.readFileSync)(St,"utf8"));return On.version}return process.env.COMP_HUB_VERSION||"unknown"}createProxyConfig(St){const On=new Kr.EventEmitter;const rr={...St,on:{...St.on,error:St=>{this.logger.error("Proxy Error:",St.message);On.emit("error",St)},proxyRes:()=>On.emit("proxyRes"),proxyReq:St=>{const rr=`${St.protocol}//${St.host}${St.path}`;this.logger.debug("[Proxy] →",rr);On.emit("proxyReq",St)},proxyReqWs:(...St)=>On.emit("proxyReqWs",...St)}};const ir=St.pathRewrite;const cr=Object.keys(ir??{});if(cr.length>0){const[St]=cr;rr.pathRewrite=On=>{let rr=On.replace(oi.KEYS.PROXY_PATH_PREFIX,"");rr=rr.replace(new RegExp(St),ir[St]);return rr}}else{rr.pathRewrite=St=>St.replace(oi.KEYS.PROXY_PATH_PREFIX,"")}return{proxy:(0,ii.createProxyMiddleware)(rr),opt:rr,event:On}}createProxyMap(St){const On={};for(const[rr,ir]of Object.entries(St)){On[rr]=this.createProxyConfig(ir)}return On}setupProxy(){const St=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);if(bi.ProxyController.proxys){for(const St of Object.values(bi.ProxyController.proxys)){St.event.removeAllListeners()}}bi.ProxyController.proxys={};if(!St.proxy)return;bi.ProxyController.proxys=this.createProxyMap(St.proxy)}async buildConfig(St){const On=this.app.getEnv();const rr=St.cwd||process.cwd();this.logger.info("cwd:",rr);this.logger.info("env:",On);const ir={port:St.port||zi.DEFAULT_PORT,allowDebug:St.allowDebug??false,api:St.api||this.apiUrl,dir:St.dir||"",cwd:rr,proxy:St.proxy};const cr=Vr.join(rr,ir.dir||"").replace(/[\\/]$/,"");const ur=Vr.join(rr,oi.KEYS.PREBUILD_MODULE_DIR);const pr=Vr.join(rr,"node_modules");await Wr.promises.mkdir(ur,{recursive:true});const fr={prebuildModulePath:ur,cwd:rr,port:ir.port,srcPath:cr,remoteServer:ir.api,version:this.getVersion(),allowDebug:ir.allowDebug,proxy:ir.proxy,projectHash:zr.default.createHash("sha256").update(rr).digest("hex").slice(0,8),ossWebsite:(0,Oi.shouldUseOssMode)(On)?{main:process.env.WEBSITE_OSS_URL_MAIN||oi.KEYS.WEBSITE_OSS_URL_MAIN,iframe:process.env.WEBSITE_OSS_URL_IFRAME||oi.KEYS.WEBSITE_OSS_URL_IFRAME}:null};xi.remoteInstance.defaults.baseURL=fr.remoteServer;if(On===oi.KEYS.LOCAL_MIDWAY_ENV_PROD){fr.port=await(0,Yr.default)({port:Yr.default.makeRange(fr.port,fr.port+100)})}this.appConfig=fr;const br={[oi.KEYS.MODULE_LOAD_PREFIX]:{prefix:oi.KEYS.MODULE_LOAD_PREFIX,dir:ur,maxAge:0},[oi.KEYS.NODE_MODULES_LOAD_PREFIX]:{prefix:oi.KEYS.NODE_MODULES_LOAD_PREFIX,dir:pr,maxAge:0},[oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL]:{prefix:oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,dir:fr.srcPath,maxAge:0}};br.default={prefix:"/public",dir:ur};const Sr={dirs:br};if(On===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await Wr.promises.writeFile(Vr.join(__dirname,".comphubConfig.json"),JSON.stringify(fr,null,2))}return{koa:{port:fr.port},staticFile:Sr,httpProxy:{strategy:{[oi.KEYS.REMOTE_SERVICE_PREFIX]:{match:new RegExp(`^/${oi.KEYS.REMOTE_SERVICE_PREFIX}/(.*)$`),target:`${fr.remoteServer}/$1`}}}}}async startSubPort(){const St=this.app.getEnv();const On=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);const{port:rr,remoteServer:ir}=On;let cr=await(0,Yr.default)({port:Yr.default.makeRange(rr,rr+100)});const ur=new Xr.default;ur.use((async(St,cr)=>{if(St.path.startsWith(oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL)){const{srcPath:rr}=On;const ir=St.path[0];const cr=St.path.replace(oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,"");const ur=await Bi.locate.resolveBuildPath(cr,{baseDir:rr});if(ur){const On=ur.replace(rr,"");const pr=ji.textKit.replaceSlashWithSpecifiedSeparator(On,ir);if(cr!==pr){const On=pr.replace(cr,"");St.redirect(St.path+On);return}}}const ur=[{prefix:`/${oi.KEYS.REMOTE_SERVICE_PREFIX}`,target:ir,rewrite:{[`^/${oi.KEYS.REMOTE_SERVICE_PREFIX}`]:""}},{prefix:`/${oi.KEYS.LOCAL_SERVICE_PREFIX}`,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{[`^/${oi.KEYS.LOCAL_SERVICE_PREFIX}`]:""}},{prefix:oi.KEYS.MODULE_LOAD_PREFIX,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:oi.KEYS.NODE_MODULES_LOAD_PREFIX,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}},{prefix:oi.KEYS.COMP_PREVIEW_PREFIX_LOCAL,target:`${oi.KEYS.IFRAME_HOST}:${rr}`,rewrite:{}}];for(const On of ur){if(St.path.startsWith(On.prefix)){await(0,wi.createKoaProxy)(St,On.target,On.rewrite);return}}await cr()}));if((0,Oi.shouldUseOssMode)(St)){const St=On.ossWebsite;ur.use((0,Oi.createOssStaticMiddleware)({mainBaseUrl:St.main,iframeBaseUrl:St.iframe,htmlMode:"inject",injectHtml:(St,On)=>{const rr=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);const ir=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify({subPort:rr.subPort})};<\/script>`;return On.replace("\x3c!--GLOBAL_CONFIG--\x3e",ir)},logger:this.logger}))}await new Promise(((rr,ir)=>{let pr=0;const fr=ur.listen(cr,(()=>{this.subServer=fr;this.app.setAttr(oi.KEYS.COMPHUB_CONFIG_KEY,{...On,subPort:cr});if(process.send){process.send({type:"subPort",subPort:cr})}if(St===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){this.logger.info(`子端口 ${cr} 已启动`)}rr()}));fr.on("error",(St=>{if(St.code==="EADDRINUSE"&&pr<zi.MAX_SUB_PORT_RETRIES){pr++;this.logger.error(`子端口 ${cr} 被占用,正在尝试端口 ${++cr}`);fr.close();fr.listen(cr)}else{ir(St)}}))}))}async printAccessInfo(St){const On=await St.getAsync(Er.Framework);const rr=On.getServer();const ir=rr.address();const cr=this.app.getEnv();const ur=this.app.getAttr(oi.KEYS.COMPHUB_CONFIG_KEY);this.logger.info("cwd:",ur.cwd);this.logger.info("env:",cr);this.logger.info("port:",ur.port);if(ur.subPort)this.logger.info("subPort:",ur.subPort);if(ir&&typeof ir!=="string"){const St=ir.port;this.logger.info("Local Address:",`http://localhost:${St}`);if(cr===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){const On=Bi.network.getLocalIPv4();if(On)this.logger.info("Network Address:",`http://${On}:${St}`);this.logger.info("Swagger UI:",`http://localhost:${St}/swagger-ui/index.html`)}}}async onConfigLoad(){const St=await(0,Ii.waitForIpcConfig)();const On=await this.buildConfig(St);const rr=this.app.getEnv();if(rr===oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL){await Wr.promises.writeFile(Vr.join(__dirname,".start.json"),JSON.stringify(On,null,2))}return On}async onReady(){this.app.setAttr(oi.KEYS.COMPHUB_CONFIG_KEY,this.appConfig);this.app.useMiddleware([mi.ReportMiddleware]);const St=this.app.getEnv();if((0,Oi.shouldUseOssMode)(St)){const St=this.appConfig.ossWebsite;this.app.use((0,Oi.createOssStaticMiddleware)({mainBaseUrl:St.main,iframeBaseUrl:St.iframe,htmlMode:"passthrough",logger:this.logger}))}this.app.useFilter([pi.BadRequestErrorFilter,ai.DefaultErrorFilter]);process.on("disconnect",(()=>{this.logger.info("Master process exited, shutting down...");if(this.subServer){this.subServer.close()}process.exit(0)}))}async onServerReady(St){this.setupProxy();await this.startSubPort();await this.printAccessInfo(St)}async onStop(){if(this.subServer){await new Promise((St=>{this.subServer.close((()=>St()))}));this.logger.info("子服务已关闭")}}};On.MainConfiguration=Ki;ur([(0,Sr.Logger)("coreLogger"),fr("design:type",Object)],Ki.prototype,"logger",void 0);ur([(0,Sr.App)(),fr("design:type",Object)],Ki.prototype,"app",void 0);On.MainConfiguration=Ki=ur([(0,Sr.Configuration)({imports:[Er,kr,Ir,Br,jr,Ur,Ui,{component:Pr,enabledEnvironment:[oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL]},{component:Lr,enabledEnvironment:[oi.KEYS.LOCAL_MIDWAY_ENV_LOCAL]}],importConfigs:[{default:Ri,local:Li}]})],Ki)},83465:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.CompController=void 0;const pr=rr(46123);const fr=rr(48795);const br=rr(63366);const Sr=rr(49179);const Er=rr(8131);const kr=rr(101);const Pr=rr(19465);const Ir=rr(19385);const Lr=rr(4990);const Br=(0,Ir.createNoData)(Sr.ApiProperty);let jr=class CompController{async dir(St){const On=await this.compService.getCompDir(St.compPath);return Ir.resUtil.success(On)}async file(St){const{filePath:On}=St;const rr=await this.compService.getCompFile(On);return Ir.resUtil.success({content:rr})}async check(St){const On=await this.compService.checkCompConfig(St.compPath,St.framework);return Ir.resUtil.success(On)}async updateVersion(St){const{compPath:On,version:rr}=St;await this.compService.updateCompVersion(On,rr);return Ir.resUtil.noData()}async generateCompJson(St){const{compPath:On}=St;await this.compService.generateCompJson(On);return Ir.resUtil.noData()}async dep(St){const{compPath:On}=St;const rr=await this.compService.getCompDep(On);return Ir.resUtil.success({thirdParty:rr})}async checkCompRepeat(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();const On=await this.compService.checkCompRepeat(St);return Ir.resUtil.success(On)}async submit(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.submitComp(St);return Ir.resUtil.noData()}async update(St){await Lr.remoteApi.v1Token.tokencontrollerApproachexpire();await this.compService.updateComp(St);return Ir.resUtil.noData()}async download(St){const On=await this.compService.downloadComp(St);if(On?.isRepeat){return Ir.resUtil.success({isRepeat:true})}return Ir.resUtil.success({isRepeat:false})}async localCompsByIds(St){const{compIds:On}=St;const rr=await this.compService.getLocalCompsByIds(On);return Ir.resUtil.success({compInfos:rr})}async packageJson(){const St=await this.compService.getPackageJsonContent();return Ir.resUtil.success({packageJson:St})}async compFileHash(St){const On=await this.compService.getCompFileHash(St);return Ir.resUtil.success(On)}async localComps(St){const On=await this.compService.getLocalComps(St);return Ir.resUtil.success(On)}async openCompPathInVscode(St){await this.compService.openCompPathInVscode(St);return Ir.resUtil.noData()}async openCompPathInExplorer(St){await this.compService.openCompPathInExplorer(St);return Ir.resUtil.noData()}async localCompDetailByPathHash(St){const On=await this.compService.getLocalCompDetailByPathHash(St);return Ir.resUtil.success(On)}async writeFile(St){await this.compService.writeCompFile(St);return Ir.resUtil.noData()}async renameDir(St){await this.compService.renameCompDir(St);return Ir.resUtil.noData()}};On.CompController=jr;ir([(0,pr.App)(),cr("design:type",Object)],jr.prototype,"app",void 0);ir([(0,pr.Inject)(),cr("design:type",fr.CompService)],jr.prototype,"compService",void 0);ir([(0,pr.Inject)(),cr("design:type",br.ConfigService)],jr.prototype,"configService",void 0);ir([(0,Sr.ApiOperation)({summary:"获取组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileVO)}),(0,pr.Post)("/dir"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompDirDTO]),cr("design:returntype",Promise)],jr.prototype,"dir",null);ir([(0,Sr.ApiOperation)({summary:"获取组件目录内指定文件的内容"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileContentVO)}),(0,pr.Post)("/file"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompFileDTO]),cr("design:returntype",Promise)],jr.prototype,"file",null);ir([(0,Sr.ApiOperation)({summary:"检查组件配置是否符合规范"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompCheckVO)}),(0,pr.Post)("/check"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompCheckDTO]),cr("design:returntype",Promise)],jr.prototype,"check",null);ir([(0,Sr.ApiOperation)({summary:"更新组件版本号"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/updateVersion"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.UpdateVersionDTO]),cr("design:returntype",Promise)],jr.prototype,"updateVersion",null);ir([(0,Sr.ApiOperation)({summary:"生成组件指纹文件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/generateCompJson"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.GenerateCompJsonDTO]),cr("design:returntype",Promise)],jr.prototype,"generateCompJson",null);ir([(0,Sr.ApiOperation)({summary:"获取组件依赖关系"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.ImportScanResultVO)}),(0,pr.Post)("/dep"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.DepDTO]),cr("design:returntype",Promise)],jr.prototype,"dep",null);ir([(0,Sr.ApiOperation)({summary:"检查组件是否重复"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompSimilarListVO)}),(0,pr.Post)("/checkCompRepeat",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CheckCompRepeatDTO]),cr("design:returntype",Promise)],jr.prototype,"checkCompRepeat",null);ir([(0,Sr.ApiOperation)({summary:"提交组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/submit",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.SubmitCompDTO]),cr("design:returntype",Promise)],jr.prototype,"submit",null);ir([(0,Sr.ApiOperation)({summary:"更新组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/update",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.UpdateCompDTO]),cr("design:returntype",Promise)],jr.prototype,"update",null);ir([(0,Sr.ApiOperation)({summary:"下载组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.DownloadCompVO)}),(0,pr.Post)("/download",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.DownloadCompDTO]),cr("design:returntype",Promise)],jr.prototype,"download",null);ir([(0,Sr.ApiOperation)({summary:"通过ids在本地查询组件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.LocalCompsByIdsVO)}),(0,pr.Post)("/localCompsByIds"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompsByIdsDTO]),cr("design:returntype",Promise)],jr.prototype,"localCompsByIds",null);ir([(0,Sr.ApiOperation)({summary:"获取package.json"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.PackageJsonVO)}),(0,pr.Post)("/packageJson"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],jr.prototype,"packageJson",null);ir([(0,Sr.ApiOperation)({summary:"获取组件文件hash"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.CompFileHashVO)}),(0,pr.Post)("/compFileHash"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompFileHashDTO]),cr("design:returntype",Promise)],jr.prototype,"compFileHash",null);ir([(0,Sr.ApiOperation)({summary:"获取本地组件列表,分页查询"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,(0,Ir.createListWrapper)(Sr.ApiProperty,kr.LocalCompsVO))}),(0,pr.Post)("/localComps",{middleware:[Pr.TokenMiddleware]}),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompsDTO]),cr("design:returntype",Promise)],jr.prototype,"localComps",null);ir([(0,Sr.ApiOperation)({summary:"通过组件路径打开在vscode中打开所在文件夹"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/openCompPathInVscode"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.OpenCompPathInVscodeDTO]),cr("design:returntype",Promise)],jr.prototype,"openCompPathInVscode",null);ir([(0,Sr.ApiOperation)({summary:"在系统文件管理器中打开并选中组件文件"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/openCompPathInExplorer"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.OpenCompPathInExplorerDTO]),cr("design:returntype",Promise)],jr.prototype,"openCompPathInExplorer",null);ir([(0,Sr.ApiOperation)({summary:"通过组件完整文件路径hash获取组件信息"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:(0,Ir.createSuccessWrapper)(Sr.ApiProperty,kr.LocalCompDetailVO)}),(0,pr.Post)("/localCompDetailByPathHash"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.LocalCompDetailByPathHashDTO]),cr("design:returntype",Promise)],jr.prototype,"localCompDetailByPathHash",null);ir([(0,Sr.ApiOperation)({summary:"写入文件到组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/writeFile"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.CompWriteFileDTO]),cr("design:returntype",Promise)],jr.prototype,"writeFile",null);ir([(0,Sr.ApiOperation)({summary:"重命名组件目录"}),(0,Sr.ApiResponse)({status:200,description:"返回结果",type:Br}),(0,pr.Post)("/renameDir"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Er.RenameCompDirDTO]),cr("design:returntype",Promise)],jr.prototype,"renameDir",null);On.CompController=jr=ir([(0,Sr.ApiTags)(["comp"]),(0,pr.Controller)("/comp")],jr)},96736:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.ModuleController=void 0;const pr=rr(46123);const fr=rr(49179);const br=rr(85984);const Sr=rr(19428);const Er=rr(71692);const kr=rr(61275);const Pr=rr(19385);const Ir=(0,Pr.createNoData)(fr.ApiProperty);let Lr=class ModuleController{async preBuild(St){const{deps:On}=St;let rr=null;await this.queueService.enqueue((async()=>{rr=await this.moduleService.preBuild(On)}));return Pr.resUtil.success(rr)}async buildTemplateCompiler(St){let On=null;await this.queueService.enqueue((async()=>{On=await this.moduleService.buildTemplateCompiler(St.vueVersion)}));return Pr.resUtil.success(On)}async preBuildSize(){const St=await this.moduleService.preBuildSize();return Pr.resUtil.success({size:St})}async clearPreBuild(){await this.moduleService.clearPreBuild();return Pr.resUtil.noData()}};On.ModuleController=Lr;ir([(0,pr.Inject)(),cr("design:type",br.ModuleService)],Lr.prototype,"moduleService",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.QueueService)],Lr.prototype,"queueService",void 0);ir([(0,fr.ApiOperation)({summary:"模块预构建"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.PreBuildVO)}),(0,pr.Post)("/preBuild"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Sr.PreBuildDTO]),cr("design:returntype",Promise)],Lr.prototype,"preBuild",null);ir([(0,fr.ApiOperation)({summary:"构建 vue-template-compiler 浏览器 bundle"}),(0,fr.ApiResponse)({status:200,description:"返回 vue-template-compiler 浏览器 bundle 文件名",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.BuildTemplateCompilerVO)}),(0,pr.Post)("/buildTemplateCompiler"),ur(0,(0,pr.Body)()),cr("design:type",Function),cr("design:paramtypes",[Sr.BuildTemplateCompilerDTO]),cr("design:returntype",Promise)],Lr.prototype,"buildTemplateCompiler",null);ir([(0,fr.ApiOperation)({summary:"获取预构建模块文件总大小"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:(0,Pr.createSuccessWrapper)(fr.ApiProperty,Er.PreBuildSizeVO)}),(0,pr.Post)("/preBuildSize"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Lr.prototype,"preBuildSize",null);ir([(0,fr.ApiOperation)({summary:"清除预构建模块文件"}),(0,fr.ApiResponse)({status:200,description:"返回结果",type:Ir}),(0,pr.Post)("/clearPreBuild"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Lr.prototype,"clearPreBuild",null);On.ModuleController=Lr=ir([(0,fr.ApiTags)(["module"]),(0,pr.Controller)("/module")],Lr)},64754:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur;Object.defineProperty(On,"__esModule",{value:true});On.ProxyController=void 0;const pr=rr(46123);const fr=rr(26815);const br=fr.KEYS.PROXY_PATH_PREFIX;let Sr=ur=class ProxyController{async proxy(){const St=this.ctx.path.replace(br,"");let On=null;for(const[rr,ir]of Object.entries(ur.proxys)){const cr=new RegExp(rr);if(cr.test(St)||St.startsWith(rr)){On=ir;break}}if(!On){this.ctx.status=404;this.ctx.body={message:"Proxy not found"};return}const{proxy:rr,event:ir}=On;await new Promise(((St,On)=>{rr(this.ctx.req,this.ctx.res);ir.on("error",On);ir.on("proxyRes",St)}))}};On.ProxyController=Sr;ir([(0,pr.Inject)(),cr("design:type",Object)],Sr.prototype,"ctx",void 0);ir([(0,pr.All)("/*"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Sr.prototype,"proxy",null);On.ProxyController=Sr=ur=ir([(0,pr.Controller)(br,{ignoreGlobalPrefix:true})],Sr)},17076:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SpaController=void 0;const ur=rr(46123);const pr=rr(49179);const fr=rr(63366);const br=rr(26815);const Sr="无法连接 OSS 资源服务器,请检查网络后重试";let Er=class SpaController{async index(){this.ctx.redirect(`/${br.KEYS.WEBSITE_PATH_MAIN}/`)}async spa(){const St=this.configService.comphubConfig();const{ossWebsite:On}=St;if(!On){this.ctx.status=404;return}let rr;let ir;try{ir=await fetch(`${On.main}/${br.KEYS.WEBSITE_PATH_MAIN}/index.html`,{signal:AbortSignal.timeout(15e3)})}catch{this.ctx.status=502;this.ctx.body=Sr;return}if(!ir.ok){this.ctx.status=502;this.ctx.body=Sr;return}rr=await ir.text();this.ctx.set("Cache-Control","no-cache");const cr=this.configService.getGlobalConfig();const{projectHash:ur}=cr;if(ur){rr=rr.replace(/<base[^>]*>/gi,"");rr=rr.replace("\x3c!--BASE_HREF--\x3e",`<base href="/${ur}/${br.KEYS.WEBSITE_PATH_MAIN}/">`)}const pr=`<script>window.__GLOBAL_CONFIG__ = ${JSON.stringify(cr)};<\/script>`;rr=rr.replace("\x3c!--GLOBAL_CONFIG--\x3e",pr);return rr}async getGlobalConfig(){return this.configService.getGlobalConfig()}};On.SpaController=Er;ir([(0,ur.Inject)(),cr("design:type",Object)],Er.prototype,"ctx",void 0);ir([(0,ur.App)(),cr("design:type",Object)],Er.prototype,"app",void 0);ir([(0,ur.Inject)(),cr("design:type",fr.ConfigService)],Er.prototype,"configService",void 0);ir([(0,ur.Get)("/"),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"index",null);ir([(0,ur.Get)(`/${br.KEYS.WEBSITE_PATH_MAIN}/*`),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"spa",null);ir([(0,ur.Get)(br.KEYS.GLOBAL_CONFIG_PATH),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"getGlobalConfig",null);On.SpaController=Er=ir([(0,pr.ApiExcludeController)(),(0,ur.Controller)("/",{ignoreGlobalPrefix:true})],Er)},44734:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__param||function(St,On){return function(rr,ir){On(rr,ir,St)}};Object.defineProperty(On,"__esModule",{value:true});On.VuefinderController=void 0;const pr=rr(46123);const fr=rr(5808);const br=rr(49179);const Sr=rr(23444);let Er=class VuefinderController{async list(St){const On=await this.vuefinderService.list(St);return On}};On.VuefinderController=Er;ir([(0,pr.App)(),cr("design:type",Object)],Er.prototype,"app",void 0);ir([(0,pr.Inject)(),cr("design:type",fr.VuefinderService)],Er.prototype,"vuefinderService",void 0);ir([(0,br.ApiOperation)({summary:"list"}),(0,pr.Get)("/list"),ur(0,(0,pr.Query)()),cr("design:type",Function),cr("design:paramtypes",[Sr.VueFinderIndexDTO]),cr("design:returntype",Promise)],Er.prototype,"list",null);On.VuefinderController=Er=ir([(0,br.ApiTags)(["vuefinder"]),(0,pr.Controller)("/vuefinder")],Er)},60149:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BasePageDTO=void 0;const ur=rr(49179);const pr=rr(99375);class BasePageDTO{}On.BasePageDTO=BasePageDTO;ir([(0,ur.ApiProperty)({example:1,description:"当前页码",required:false}),(0,pr.Rule)(pr.RuleType.number().min(1)),cr("design:type",Number)],BasePageDTO.prototype,"page",void 0);ir([(0,ur.ApiProperty)({example:10,description:"每页数量",required:false}),(0,pr.Rule)(pr.RuleType.number().min(1).max(50)),cr("design:type",Number)],BasePageDTO.prototype,"pageSize",void 0);ir([(0,pr.Rule)(pr.RuleType.string().allow("").max(50).pattern(/\{\s*\$\w+:/i,{invert:true}).trim()),(0,ur.ApiProperty)({example:"小明",description:"关键词",required:false}),cr("design:type",String)],BasePageDTO.prototype,"keyword",void 0)},8131:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.RenameCompDirDTO=On.CompWriteFileDTO=On.LocalCompDetailByPathHashDTO=On.OpenCompPathInExplorerDTO=On.OpenCompPathInVscodeDTO=On.LocalCompsDTO=On.DownloadCompDTO=On.UpdateCompDTO=On.SubmitCompDTO=On.DepItemDTO=On.CompFileDTO=On.UpdateVersionDTO=On.CompFileHashDTO=On.CheckCompRepeatDTO=On.LocalCompsByIdsDTO=On.DepDTO=On.GenerateCompJsonDTO=On.CompCheckDTO=On.CompDirDTO=void 0;const ur=rr(49179);const pr=rr(99375);const fr=rr(26815);const br=rr(60149);class CompPathDTO{}ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompPathDTO.prototype,"compPath",void 0);class CompIdDTO{}ir([(0,ur.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompIdDTO.prototype,"compId",void 0);class CompDirDTO extends CompPathDTO{}On.CompDirDTO=CompDirDTO;class CompCheckDTO extends CompPathDTO{}On.CompCheckDTO=CompCheckDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件框架类型",example:"vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompCheckDTO.prototype,"framework",void 0);class GenerateCompJsonDTO extends CompPathDTO{}On.GenerateCompJsonDTO=GenerateCompJsonDTO;class DepDTO extends CompPathDTO{}On.DepDTO=DepDTO;class LocalCompsByIdsDTO{}On.LocalCompsByIdsDTO=LocalCompsByIdsDTO;ir([(0,ur.ApiProperty)({type:[String],required:true,description:"组件id列表",example:["123","456"]}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],LocalCompsByIdsDTO.prototype,"compIds",void 0);class CheckCompRepeatDTO extends CompPathDTO{}On.CheckCompRepeatDTO=CheckCompRepeatDTO;ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],CheckCompRepeatDTO.prototype,"teamId",void 0);class CompFileHashDTO extends CompPathDTO{}On.CompFileHashDTO=CompFileHashDTO;class UpdateVersionDTO extends CompPathDTO{}On.UpdateVersionDTO=UpdateVersionDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件版本号",example:"1.0.0"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],UpdateVersionDTO.prototype,"version",void 0);class CompFileDTO{}On.CompFileDTO=CompFileDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件路径",example:"/src/components/MyComp/index.vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompFileDTO.prototype,"filePath",void 0);class PreviewItemDTO{}ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],PreviewItemDTO.prototype,"miniPath",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),(0,pr.Rule)(pr.RuleType.array().optional().items(pr.RuleType.string())),cr("design:type",Array)],PreviewItemDTO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],PreviewItemDTO.prototype,"desc",void 0);class ParentDTO{}ir([(0,ur.ApiProperty)({description:"父库名称",required:true,example:"vue"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],ParentDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],ParentDTO.prototype,"version",void 0);class DepItemDTO{}On.DepItemDTO=DepItemDTO;ir([(0,ur.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DepItemDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DepItemDTO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:ParentDTO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),(0,pr.Rule)(pr.RuleType.object().optional()),cr("design:type",ParentDTO)],DepItemDTO.prototype,"parent",void 0);class SubmitCompDTO{}On.SubmitCompDTO=SubmitCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"compPath",void 0);ir([(0,ur.ApiProperty)({type:[DepItemDTO],required:true,description:"组件依赖"}),(0,pr.Rule)(pr.RuleType.array().required()),cr("design:type",Array)],SubmitCompDTO.prototype,"dep",void 0);ir([(0,ur.ApiProperty)({type:[PreviewItemDTO],required:true,description:"组件预览数据"}),(0,pr.Rule)(pr.RuleType.array().required()),cr("design:type",Array)],SubmitCompDTO.prototype,"previewConfigs",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件描述",example:"这是一个组件"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],SubmitCompDTO.prototype,"desc",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件背景颜色",example:"#f0f0f0"}),(0,pr.Rule)(pr.RuleType.string().empty("").default("")),cr("design:type",String)],SubmitCompDTO.prototype,"bgColor",void 0);ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],SubmitCompDTO.prototype,"teamId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件标签",example:["hooks","图表"],type:[String]}),(0,pr.Rule)(pr.RuleType.array().items(pr.RuleType.string())),cr("design:type",Array)],SubmitCompDTO.prototype,"tags",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件框架类型",example:"vue"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],SubmitCompDTO.prototype,"framework",void 0);class UpdateCompDTO extends SubmitCompDTO{}On.UpdateCompDTO=UpdateCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件id",example:"123"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],UpdateCompDTO.prototype,"compId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"团队id",example:"123"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],UpdateCompDTO.prototype,"teamId",void 0);ir([(0,ur.ApiProperty)({required:false,description:"组件升级描述",example:"升级组件描述"}),(0,pr.Rule)(pr.RuleType.string().allow("").max(200)),cr("design:type",String)],UpdateCompDTO.prototype,"upgradeDesc",void 0);class DownloadCompDTO extends CompIdDTO{}On.DownloadCompDTO=DownloadCompDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件下载路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"savePath",void 0);ir([(0,ur.ApiProperty)({required:false,description:"是否覆盖",example:true}),(0,pr.Rule)(pr.RuleType.boolean().default(false)),cr("design:type",Boolean)],DownloadCompDTO.prototype,"isCover",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件名称",example:"MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"compName",void 0);ir([(0,ur.ApiProperty)({required:true,description:"组件版本",example:"1.0.0"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],DownloadCompDTO.prototype,"version",void 0);class LocalCompsDTO extends br.BasePageDTO{}On.LocalCompsDTO=LocalCompsDTO;class OpenCompPathInVscodeDTO{}On.OpenCompPathInVscodeDTO=OpenCompPathInVscodeDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"folderPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInVscodeDTO.prototype,"relativeFilePath",void 0);class OpenCompPathInExplorerDTO{}On.OpenCompPathInExplorerDTO=OpenCompPathInExplorerDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件文件夹路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInExplorerDTO.prototype,"folderPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"目标文件相对于组件文件夹的路径",example:""}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],OpenCompPathInExplorerDTO.prototype,"relativeFilePath",void 0);class LocalCompDetailByPathHashDTO{}On.LocalCompDetailByPathHashDTO=LocalCompDetailByPathHashDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件完整文件路径hash",example:"1234567890"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],LocalCompDetailByPathHashDTO.prototype,"fullPathHash",void 0);class CompWriteFileDTO{}On.CompWriteFileDTO=CompWriteFileDTO;ir([(0,ur.ApiProperty)({required:true,description:"组件路径",example:"/src/components/MyComp"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"compPath",void 0);ir([(0,ur.ApiProperty)({required:true,description:"文件名",example:fr.KEYS.COMP_SCREENSHOT_MINI_FILENAME}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"filename",void 0);ir([(0,ur.ApiProperty)({required:true,description:"文件内容(base64,不含前缀)",example:"iVBORw0KGgo..."}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],CompWriteFileDTO.prototype,"content",void 0);class RenameCompDirDTO extends CompPathDTO{}On.RenameCompDirDTO=RenameCompDirDTO;ir([(0,ur.ApiProperty)({required:true,description:"新目录名称",example:"NewCompName"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],RenameCompDirDTO.prototype,"newName",void 0)},19428:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BuildTemplateCompilerDTO=On.PreBuildDTO=void 0;const ur=rr(49179);const pr=rr(99375);class PreBuildDTO{}On.PreBuildDTO=PreBuildDTO;ir([(0,ur.ApiProperty)({type:[String],required:true,description:"组件依赖",example:["axios","md5"]}),(0,pr.Rule)(pr.RuleType.array().required().items(pr.RuleType.string())),cr("design:type",Array)],PreBuildDTO.prototype,"deps",void 0);class BuildTemplateCompilerDTO{}On.BuildTemplateCompilerDTO=BuildTemplateCompilerDTO;ir([(0,ur.ApiProperty)({type:String,required:true,description:"Vue 版本号,如 2.6.14",example:"2.6.14"}),(0,pr.Rule)(pr.RuleType.string().required()),cr("design:type",String)],BuildTemplateCompilerDTO.prototype,"vueVersion",void 0)},23444:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.VueFinderIndexDTO=void 0;const ur=rr(49179);const pr=rr(99375);class VueFinderIndexDTO{}On.VueFinderIndexDTO=VueFinderIndexDTO;ir([(0,ur.ApiProperty)({required:false,description:"文件路径"}),(0,pr.Rule)(pr.RuleType.string()),cr("design:type",String)],VueFinderIndexDTO.prototype,"path",void 0)},59416:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.BadRequestErrorFilter=void 0;const cr=rr(46123);const ur=rr(19385);const pr=rr(26815);let fr=class BadRequestErrorFilter{async catch(St,On){const rr=On.app.getEnv();if(rr===pr.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("BadRequestErrorFilter==>",St)}return ur.resUtil.error(St.message,St.status)}};On.BadRequestErrorFilter=fr;On.BadRequestErrorFilter=fr=ir([(0,cr.Catch)(cr.httpError.BadRequestError)],fr)},54633:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.DefaultErrorFilter=void 0;const cr=rr(46123);const ur=rr(26815);let pr=class DefaultErrorFilter{async catch(St,On){const rr=On.app.getEnv();try{const On=JSON.parse(St.message);return{...On}}catch(St){if(rr===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("解析错误信息失败==>",St.message,"\n")}}finally{if(rr===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL){On.logger.error("原始错误==>",St)}}On.status=St.status??500;return{code:St.status??500,message:St.message??"未知错误"}}};On.DefaultErrorFilter=pr;On.DefaultErrorFilter=pr=ir([(0,cr.Catch)()],pr)},15545:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(12799);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.MainConfiguration}});cr(rr(14071),On);cr(rr(91921),On);cr(rr(83465),On);cr(rr(96736),On);cr(rr(64754),On);cr(rr(17076),On);cr(rr(44734),On);cr(rr(60149),On);cr(rr(8131),On);cr(rr(19428),On);cr(rr(23444),On);cr(rr(59416),On);cr(rr(54633),On);cr(rr(9711),On);cr(rr(53951),On);cr(rr(77523),On);cr(rr(15960),On);cr(rr(61142),On);cr(rr(19465),On);cr(rr(95637),On);cr(rr(48795),On);cr(rr(63366),On);cr(rr(23086),On);cr(rr(85984),On);cr(rr(80799),On);cr(rr(61275),On);cr(rr(19452),On);cr(rr(5808),On);cr(rr(66593),On);cr(rr(58953),On);cr(rr(49969),On);cr(rr(4145),On);cr(rr(5052),On);cr(rr(10778),On);cr(rr(67872),On);cr(rr(101),On);cr(rr(71692),On)},9711:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},53951:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},77523:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},15960:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.OSS_HTML_CACHE_CONTROL=void 0;On.shouldUseOssMode=shouldUseOssMode;On.resolveOssUrl=resolveOssUrl;On.isHtmlRequest=isHtmlRequest;On.toHtmlFileUrl=toHtmlFileUrl;On.createOssStaticMiddleware=createOssStaticMiddleware;const ir=rr(2203);const cr=rr(26815);On.OSS_HTML_CACHE_CONTROL="no-cache";function shouldUseOssMode(St){return St!==cr.KEYS.LOCAL_MIDWAY_ENV_LOCAL}function resolveOssUrl(St,On,rr){if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_MAIN}/`))return St+rr;if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_CONTAINER}/`))return On+rr;if(rr.startsWith(`/${cr.KEYS.WEBSITE_PATH_ITEM}/`))return On+rr;return null}function isHtmlRequest(St,On){if(St.endsWith("/")||/\.html$/i.test(St))return true;return/text\/html/i.test(On)}function toHtmlFileUrl(St,On){if(/\.html$/i.test(On))return St;const rr=On.split("/").filter(Boolean)[0]??"";return St.slice(0,St.length-On.length)+`/${rr}/index.html`}function createOssStaticMiddleware(St){return async(rr,cr)=>{const ur=resolveOssUrl(St.mainBaseUrl,St.iframeBaseUrl,rr.path);if(!ur){await cr();return}const pr=isHtmlRequest(rr.path,rr.headers.accept||"");if(pr&&St.htmlMode==="passthrough"){await cr();return}try{const cr=pr?toHtmlFileUrl(ur,rr.path):ur;const fr=await fetch(cr,{redirect:"follow",signal:AbortSignal.timeout(15e3)});if(pr){const ir=await fr.text();if(!fr.ok){rr.status=fr.status;rr.body=ir;return}rr.status=fr.status;rr.type="text/html; charset=utf-8";const cr=St.htmlHeaders??{"Cache-Control":On.OSS_HTML_CACHE_CONTROL};for(const[St,On]of Object.entries(cr))rr.set(St,On);rr.body=St.injectHtml?.(rr.path,ir)??ir;return}rr.status=fr.status;rr.set("content-type",fr.headers.get("content-type")||"application/octet-stream");const br=fr.headers.get("cache-control");if(br)rr.set("cache-control",br);rr.body=fr.body?ir.Readable.fromWeb(fr.body):""}catch(On){const ir=On instanceof Error?On.message:String(On);St.logger?.warn("[oss-static] 代理失败:",ir);rr.status=502;rr.body="无法连接 OSS 资源服务器,请检查网络后重试"}}}},61142:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.ReportMiddleware=void 0;const cr=rr(46123);let ur=class ReportMiddleware{resolve(){return async(St,On)=>{const rr=Date.now();const ir=await On();const cr=St.url;St.logger.info(`请求 ${St.method} ${cr} → ${St.status} (${Date.now()-rr}ms)`);return ir}}static getName(){return"report"}};On.ReportMiddleware=ur;On.ReportMiddleware=ur=ir([(0,cr.Middleware)()],ur)},19465:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.TokenMiddleware=void 0;const cr=rr(46123);const ur=rr(10778);let pr=class TokenMiddleware{resolve(){return async(St,On)=>{(0,ur.setHeader)(St.header);await On()}}static getName(){return"token"}};On.TokenMiddleware=pr;On.TokenMiddleware=pr=ir([(0,cr.Middleware)()],pr)},95637:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.CommandService=void 0;const pr=rr(46123);const fr=ur(rr(79896));const br=rr(63366);const Sr=rr(7455);const Er=ur(rr(16928));const kr=rr(68255);const Pr=rr(35317);const Ir=ur(rr(70857));let Lr=class CommandService{async revealInVSCode(St,On,rr=1,ir=1){const{cwd:cr}=this.configService.comphubConfig();if(!St||!fr.default.existsSync(St)||!fr.default.statSync(St).isDirectory()){throw new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist"))}const ur=Er.default.resolve(St,On);if(!fr.default.existsSync(ur)||fr.default.statSync(ur).isDirectory()){throw new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist"))}(0,Sr.launchIDE)({file:cr});(0,Sr.launchIDE)({file:ur,line:rr,column:ir})}revealInExplorer(St,On){return new Promise(((rr,ir)=>{if(!St||!fr.default.existsSync(St)||!fr.default.statSync(St).isDirectory()){ir(new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.folderPathNotExist")));return}const cr=Er.default.resolve(St,On);if(!fr.default.existsSync(cr)||fr.default.statSync(cr).isDirectory()){ir(new pr.httpError.BadRequestError(this.i18nService.translate("local.command.errors.filePathNotExist")));return}const ur=Ir.default.platform();if(ur==="win32"){(0,Pr.exec)(`explorer /select,"${cr}"`,(()=>{rr(cr)}))}else{(0,Pr.exec)(`open -R "${cr}"`,(St=>{if(St){ir(new pr.httpError.InternalServerErrorError(this.i18nService.translate("local.command.errors.openExplorerFailed",{args:[St.message]})));return}rr(cr)}))}}))}};On.CommandService=Lr;ir([(0,pr.Inject)(),cr("design:type",br.ConfigService)],Lr.prototype,"configService",void 0);ir([(0,pr.Inject)(),cr("design:type",Object)],Lr.prototype,"ctx",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.MidwayI18nService)],Lr.prototype,"i18nService",void 0);On.CommandService=Lr=ir([(0,pr.Provide)()],Lr)},48795:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CompService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(63366);const Pr=rr(23086);const Ir=rr(85984);const Lr=rr(80799);const Br=pr(rr(70857));const jr=pr(rr(10232));const Ur=rr(87518);const Vr=rr(84464);const Wr=rr(95637);const zr=rr(5052);const qr=rr(26815);const Kr=rr(18801);const Xr=rr(4990);const Yr=rr(68255);let ii=class CompService{getCompFullPath(St){const{srcPath:On}=this.configService.comphubConfig();St=St.replace(qr.KEYS.FILE_MANAGER_DIRNAME,"");const rr=Sr.join(On,St);return rr}checkCompEntryIndex(St,On=qr.KEYS.COMP_FRAMEWORK_VUE){if(On===qr.KEYS.COMP_FRAMEWORK_REACT){for(const On of qr.KEYS.COMP_USE_ENTRY_FILE_REACT){const rr=Sr.join(St,On);if(Er.existsSync(rr)){return On}}throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[qr.KEYS.COMP_USE_ENTRY_FILE_REACT.join(" / ")]}))}const rr=Sr.join(St,qr.KEYS.COMP_USE_ENTRY_FILE);if(!Er.existsSync(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.entryFileNotExist",{args:[qr.KEYS.COMP_USE_ENTRY_FILE]}))}return qr.KEYS.COMP_USE_ENTRY_FILE}checkCompJson(St){const On=this.getCompFullPath(St);const rr=Sr.join(On,qr.KEYS.COMP_CONFIG_FILENAME);if(!Er.existsSync(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.configFileNotExist"))}}checkCompJsonFormat(St){const On=Object.keys(St);const rr=qr.ARRAY.COMP_DEFAULT_FIELD.every((St=>!St.required||On.includes(St.name)));if(!rr)return false;return Kr.versionKit.validateVersion(St.version)}async updateCompJson(St,On){const rr=this.getCompFullPath(St);const ir=Sr.join(rr,qr.KEYS.COMP_CONFIG_FILENAME);const cr=await this.getCompFile(ir);const ur=On(JSON.parse(cr));await Er.promises.writeFile(ir,JSON.stringify(ur,null,4))}async readCompVersion(St){const On=Sr.join(St,qr.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(On);const ir=JSON.parse(rr);return ir.version}initCompJson(){return qr.ARRAY.COMP_DEFAULT_FIELD.reduce(((St,On)=>{const rr={};if(On.required){rr[On.name]=On.default}return{...St,...rr}}),{})}async uploadCompFolderToOss({compFullPath:St,version:On,ossData:rr}){const{files:ir}=await Ur.fileTree.generateTree(St);const cr=ir.map((({absolutePath:On,size:rr})=>{const ir=On.replace(St,"");return{filePath:ir,fileFullPath:On,size:rr??0}}));cr.sort(((St,On)=>On.size-St.size));for(let St=0;St<cr.length;St++){const{filePath:ir,fileFullPath:ur}=cr[St];const pr=Sr.join(rr.key,On,ir);const fr={...rr,key:pr.replace(new RegExp(Kr.textKit.escapeRegExp(Sr.sep),"g"),"/")};const br=Er.createReadStream(ur);await this.ossService.uploadFileToOss(fr,br)}}async uploadPreBuildFilesToOss(St){const On=Array.from(new Set(St));if(On.length===0)return;const rr=await Xr.remoteApi.v1Oss.osscontrollerPrebuildputpolicy();const ir=rr.data;const{cwd:cr}=this.configService.comphubConfig();const ur=Sr.join(cr,qr.KEYS.PREBUILD_MODULE_DIR);for(const St of On){const On=Sr.join(ur,St);if(!Er.existsSync(On)){this.ctx.logger.warn(`预编译产物文件不存在,跳过上传: ${On}`);continue}const rr=Er.createReadStream(On);const cr={...ir,key:St};await this.ossService.uploadFileToOss(cr,rr,true)}}async getCompHash(St){const On=await Ur.digest.getFileHashList(St);const rr=On.map((St=>`${St.relativePath}-${St.hash}`)).join(";");return Ur.digest.getStringHash(rr)}async getCompFeatures(St){const On=await Ur.digest.getFileHashAndSsdeepList(St);const rr=On.map((St=>{const On=(0,Vr.omit)(St,["relativePath"]);return{...On,path:St.relativePath}}));const ir=await Ur.digest.getRelativeDirList(St);const cr=JSON.stringify(ir);const ur=Ur.digest.getStringFuzzyHash(cr);const pr=await this.getCompHash(St);return{fileHashList:rr,compHash:pr,dirHash:Ur.digest.getStringHash(cr),dirSsdeep:Ur.digest.getSsdeepStruct(ur)}}async getCompFileList(St){const{files:On}=await Ur.fileTree.generateTree(St,{withStats:true,calculateSize:true});const rr=On.map((({name:On,size:rr,absolutePath:ir})=>({name:On,size:rr??0,path:ir.replace(St,"").replace(new RegExp(Kr.textKit.escapeRegExp(Sr.sep),"g"),"/")})));return rr}checkCompFileSize(St){if(St>qr.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSizeExceeded",{args:[Math.floor(qr.KEYS.COMP_SUBMIT_MAX_TOTAL_SIZE/1024/1024).toString()]}))}}checkCompFileNum(St){if(St>qr.KEYS.COMP_SUBMIT_MAX_FILE_COUNT){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitFileCountExceeded",{args:[qr.KEYS.COMP_SUBMIT_MAX_FILE_COUNT.toString()]}))}}checkCompSingleFileSize(St){const On=qr.KEYS.COMP_SUBMIT_MAX_SINGLE_FILE_SIZE;const rr=Math.floor(On/1024/1024);for(const ir of St){if(ir.size>On){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.submitSingleFileSizeExceeded",{args:[ir.path,rr.toString()]}))}}}async findCompJsonPath(St){const{files:On}=await Ur.fileTree.generateTree(St,{ignore:["node_modules"]});this.ctx.logger.debug("项目文件数量:",On.length);const rr=On.filter((({absolutePath:St})=>St.endsWith(qr.KEYS.COMP_CONFIG_FILENAME)));return rr}async getAllLocalCompIds(){const{srcPath:St}=this.configService.comphubConfig();const On=await this.findCompJsonPath(St);this.ctx.logger.debug("组件文件数量:",On.length);const rr=On.map((async({absolutePath:St})=>{const On=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(On);const ir=this.checkCompJsonFormat(rr);const cr=Sr.dirname(St);return{compjson:rr,isCompHub:ir,compPath:cr,pathHash:Ur.digest.getStringHash(cr)}}));const ir=await Promise.all(rr);return ir.filter((St=>St.isCompHub&&St.compjson[qr.KEYS.COMP_FIELD_COMP_ID]))}async getCompDir(St){const{srcPath:On}=this.configService.comphubConfig();const rr=Sr.join(St.replace(qr.KEYS.FILE_MANAGER_DIRNAME,`${On}${Sr.sep}`));const{tree:ir,files:cr}=await Ur.fileTree.generateTree(rr,{sortBy:"type"});const _handleTree=St=>{const On={name:St.name,path:St.absolutePath,type:St.type};if(St.children&&St.children.length>0){On.children=St.children.map((St=>_handleTree(St)))}return On};return{tree:_handleTree(ir),files:cr.map((St=>St.absolutePath))}}async getCompFile(St){const On=await Er.promises.readFile(St,"utf-8");return On}async checkCompConfig(St,On=qr.KEYS.COMP_FRAMEWORK_VUE){const rr=Sr.basename(St);const ir=this.getCompFullPath(St);let cr;try{const St=this.checkCompEntryIndex(ir,On);cr=Sr.join(rr,St)}catch(St){this.ctx.logger.error("检查组件入口文件失败",St);return{errorMsg:St.message}}try{this.checkCompJson(St)}catch(St){this.ctx.logger.error("检查组件配置文件comp.json失败",St);return{entryIndexPath:cr,errorMsg:St.message}}const ur=Sr.join(rr,qr.KEYS.COMP_CONFIG_FILENAME);try{const On=Sr.join(this.getCompFullPath(St),qr.KEYS.COMP_CONFIG_FILENAME);const rr=await this.getCompFile(On);const ir=this.checkCompJsonFormat(JSON.parse(rr));if(!ir){return{entryIndexPath:cr,compJsonPath:ur,errorMsg:this.i18nService.translate("local.comp.check.configJsonFormatError")}}}catch(St){this.ctx.logger.error("读取组件配置文件comp.json失败",St);return{entryIndexPath:cr,compJsonPath:ur,errorMsg:this.i18nService.translate("local.comp.check.configJsonReadError")}}return{entryIndexPath:cr,compJsonPath:ur,errorMsg:""}}async updateCompVersion(St,On){const rr=Kr.versionKit.validateVersion(On);if(!rr){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidVersionFormat"))}const ir=this.getCompFullPath(St);const cr=Sr.join(ir,qr.KEYS.COMP_CONFIG_FILENAME);const ur=await this.getCompFile(cr);const pr=JSON.parse(ur);pr.version=On;const fr=JSON.stringify(pr,null,2);await Er.promises.writeFile(cr,fr)}async generateCompJson(St){const On=this.getCompFullPath(St);const rr=Sr.basename(On);const ir=this.initCompJson();ir.name=rr;await Er.promises.writeFile(Sr.join(On,qr.KEYS.COMP_CONFIG_FILENAME),JSON.stringify(ir,null,4))}async getCompDep(St){const{cwd:On}=this.configService.comphubConfig();const rr=this.getCompFullPath(St);const ir=await this.depsService.getModuleEntry(rr,On);return ir}async getCompFileHash(St){const{compPath:On}=St;const rr=this.getCompFullPath(On);const ir=await this.getCompFeatures(rr);return{compHash:ir.compHash}}async checkCompRepeat(St){const{compPath:On,teamId:rr}=St;const ir=this.getCompFullPath(On);const cr=await this.getCompFeatures(ir);const ur=await Xr.remoteApi.v1Comp.compcontrollerCheckcompexistbyhash(cr,{headers:{"team-id":rr}});return ur.data}async submitComp(St){let On="";let rr={};try{const{compPath:ir,dep:cr,previewConfigs:ur,desc:pr,bgColor:fr,name:br,teamId:Sr,tags:Er,framework:kr}=St;rr={"team-id":Sr};this.checkCompJson(ir);const Pr=this.getCompFullPath(ir);const Ir=await this.getCompFeatures(Pr);this.checkCompEntryIndex(Pr,kr);const Lr=await this.readCompVersion(Pr);const Br=await this.getCompFileList(Pr);const jr=Br.reduce(((St,On)=>St+On.size),0);this.checkCompFileNum(Br.length);this.checkCompFileSize(jr);this.checkCompSingleFileSize(Br);const{entryNameToFile:Ur,chunkFiles:Vr,templateCompilerFile:Wr,uploadFiles:zr}=await this.getPreBuildInfo(cr);const Kr={entryNameToFile:Ur,chunkFiles:Vr,...Wr?{templateCompilerFile:Wr}:{}};const Yr={name:br,dep:cr,previewConfigs:ur,desc:pr,version:Lr,size:jr,files:Br,bgColor:fr,compFeatures:Ir,tags:Er,preBuildInfo:Kr,framework:kr};const ii=await Xr.remoteApi.v1Comp.compcontrollerUpload(Yr,{headers:rr});const oi=ii.data._id;On=oi;await this.updateCompJson(ir,(St=>({...St,name:br,[qr.KEYS.COMP_FIELD_COMP_ID]:oi})));const{data:{componentDir:ai}}=await Xr.remoteApi.v1Oss.osscontrollerCompossdir();const pi=await Xr.remoteApi.v1Oss.osscontrollerPutpolicy({type:ai});const mi={compFullPath:Pr,version:Lr,ossData:pi.data};await this.uploadCompFolderToOss(mi);await this.uploadPreBuildFilesToOss(zr);const{key:bi}=pi.data;const xi={compId:oi,objectId:`${ai}${bi}`};await Xr.remoteApi.v1Comp.compcontrollerUpdateobjectid(xi)}catch(St){if(On){await Xr.remoteApi.v1Comp.compcontrollerDeletefailedcomp({compId:On},{headers:rr})}if(St instanceof br.httpError.BadRequestError){throw new br.httpError.BadRequestError(St)}throw new Error(St.message)}}async updateComp(St){const{compId:On,compPath:rr,dep:ir,previewConfigs:cr,desc:ur,bgColor:pr,name:fr,upgradeDesc:br,teamId:kr,tags:Pr,framework:Ir}=St;const Lr=this.getCompFullPath(rr);const Br=await this.getCompFeatures(Lr);this.checkCompEntryIndex(Lr,Ir);const jr=await Xr.remoteApi.v1Comp.compcontrollerCompdetail({compId:On});const{objectId:Ur,version:Vr}=jr.data;const Wr=await this.readCompVersion(Lr);const zr=await this.getCompFileList(Lr);const Kr=zr.reduce(((St,On)=>St+On.size),0);this.checkCompFileNum(zr.length);this.checkCompFileSize(Kr);this.checkCompSingleFileSize(zr);const{entryNameToFile:Yr,chunkFiles:ii,templateCompilerFile:oi,uploadFiles:ai}=await this.getPreBuildInfo(ir,jr.data);const pi={entryNameToFile:Yr,chunkFiles:ii,...oi?{templateCompilerFile:oi}:{}};const mi={compId:On,name:fr,dep:ir,previewConfigs:cr,desc:ur,version:Wr,size:Kr,files:zr,bgColor:pr,compFeatures:Br,upgradeDesc:br,tags:Pr,preBuildInfo:pi,framework:Ir};const bi=await Xr.remoteApi.v1Comp.compcontrollerUpdate(mi,{headers:{"team-id":kr}});const{isFileChange:xi}=bi.data;if(!xi&&Vr===Wr){await this.uploadPreBuildFilesToOss(ai);const St=Sr.join(Lr,qr.KEYS.COMP_SCREENSHOT_MINI_FILENAME);if(Er.existsSync(St)){const On=await Xr.remoteApi.v1Oss.osscontrollerCompossdir();const rr=await Xr.remoteApi.v1Oss.osscontrollerPutpolicy({type:On.data.componentDir});const ir=Ur.replace(rr.data.dir,"");const cr=Sr.join(ir,Wr,qr.KEYS.COMP_SCREENSHOT_MINI_FILENAME).replace(/\\/g,"/");const ur=Er.createReadStream(St);const pr={...rr.data,key:cr};await this.ossService.uploadFileToOss(pr,ur,true)}return}const wi=await Xr.remoteApi.v1Oss.osscontrollerCompossdir();const{componentDir:Oi}=wi.data;const Ii=await Xr.remoteApi.v1Oss.osscontrollerPutpolicy({type:Oi});const Ri=Ur.replace(Ii.data.dir,"");const Li={...Ii.data,key:Ri};const Bi={compFullPath:Lr,version:Wr,ossData:Li};await this.uploadCompFolderToOss(Bi);await this.uploadPreBuildFilesToOss(ai);await this.updateCompJson(rr,(St=>({...St,name:fr,[qr.KEYS.COMP_FIELD_COMP_ID]:On})))}async getPreBuildInfo(St,On){const{reused:rr,localNames:ir}=(0,zr.splitReusableDeps)(St,On?.dep??[],On?.preBuildInfo?.entryNameToFile??{});const cr=ir.length?await this.moduleService.preBuild(ir):{entryNameToFile:{},chunkFiles:[]};const ur=await this.buildTemplateCompilerIfNeeded(St);return{entryNameToFile:{...cr.entryNameToFile,...rr},chunkFiles:cr.chunkFiles,...ur?{templateCompilerFile:ur}:{},uploadFiles:Array.from(new Set([...Object.values(cr.entryNameToFile),...cr.chunkFiles,...ur?[ur]:[]]))}}async buildTemplateCompilerIfNeeded(St){const On=(0,zr.resolveCompilerBuild)(St);if(On.action==="skip"){if(On.reason==="unparsable"){this.ctx.logger.warn(`[getPreBuildInfo] vue 版本号无法解析(${JSON.stringify(On.raw)}),跳过模板编译器构建,外网将回退到 loader 内置编译器`)}return undefined}const{fileName:rr}=await this.moduleService.buildTemplateCompiler(On.vueVersion);return rr}async downloadComp(St){const{compId:On,savePath:rr,isCover:ir,compName:cr,version:ur}=St;const{srcPath:pr}=this.configService.comphubConfig();const fr=qr.KEYS.FILE_MANAGER_DIRNAME;const kr=rr.replace(fr,"").replace(/[/\\]/g,Sr.sep);const Pr=Sr.join(pr,kr,cr);if(!ir&&Er.existsSync(Pr)){return{isRepeat:true}}const Ir=Br.tmpdir();const Lr=Sr.join(Ir,qr.KEYS.COMP_TEMP_DIR);this.ctx.logger.debug("组件下载到临时目录",Lr);const Vr=await Xr.remoteApi.v1Comp.compcontrollerCompdetail({compId:On,version:ur});if(!Vr?.data){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compNotExist"))}const{files:Wr,objectId:zr,name:Kr}=Vr.data;let Yr=[];const ii=Sr.join(Lr,zr,ur);if(Er.existsSync(ii)){const{files:St}=await Ur.fileTree.generateTree(ii);Yr=St}await Xr.remoteApi.v1Comp.compcontrollerUpdatecompdownloadcount({compId:On,version:ur});if(Wr.length===Yr.length){const St=Yr.find((({absolutePath:St})=>St.replace(ii,"").startsWith(`${Sr.sep}${qr.KEYS.COMP_CONFIG_FILENAME}`)));if(St){const On=await Er.promises.readFile(St.absolutePath,"utf8");const rr=JSON.parse(On);const{name:ir}=rr;if(Kr===ir){await jr.copy(ii,Pr);this.ctx.logger.debug("组件缓存文件和服务器文件一致,直接使用缓存文件");return}}}const oi=Wr.map((St=>{const On=Sr.join(zr,ur,St.path);return{path:On.replace(/[/\\]/g,"/")}}));const ai=await this.ossService.getDownloadSts();await this.ossService.downloadFileToPath(ai,oi,Lr);const pi=Sr.join(Lr,zr,ur);await jr.copy(pi,Pr)}async getLocalCompsByIds(St){const{srcPath:On}=this.configService.comphubConfig();const rr=await this.findCompJsonPath(On);this.ctx.logger.debug("组件文件数量:",rr.length);const ir=rr.map((async({absolutePath:St})=>{const On=await Er.promises.readFile(St,"utf8");const rr=JSON.parse(On);return{...rr,path:Sr.dirname(St)}}));const cr=await Promise.all(ir);const ur=cr.filter((On=>St.includes(On[qr.KEYS.COMP_FIELD_COMP_ID])));if(!ur){return[]}const pr=qr.KEYS.FILE_MANAGER_DIRNAME;const fr=new RegExp(Kr.textKit.escapeRegExp(Sr.sep),"g");const br=ur.map((St=>{const rr=St.path.replace(On,"").replace(fr,"/").slice(1);return{id:St[qr.KEYS.COMP_FIELD_COMP_ID],path:pr+rr,fullPath:St.path,fullPathHash:Ur.digest.getStringHash(St.path),basename:Sr.basename(St.path)}}));return br}async getPackageJsonContent(){const St=this.configService.comphubConfig();const On=Sr.join(St.cwd,"package.json");return await Ur.fileSys.readJsonFile(On)}async getLocalComps(St){const{page:On=1,pageSize:rr=10}=St;const{srcPath:ir}=this.configService.comphubConfig();const cr=await this.getAllLocalCompIds();const ur=cr.map((St=>({id:St.compjson[qr.KEYS.COMP_FIELD_COMP_ID],pathHash:St.pathHash})));ur.sort(((St,On)=>St.id.localeCompare(On.id)));const pr=[...new Set(ur.map((St=>St.id)))];const fr=await Xr.remoteApi.v1Comp.compcontrollerExistcompsbyids({compIds:pr});const{ids:Er=[]}=fr.data;const kr=ur.filter((St=>Er.includes(St.id)));const Pr=kr.length;const Ir=kr.slice((On-1)*rr,On*rr);const Lr=new Map(cr.map((St=>[`${St.compjson[qr.KEYS.COMP_FIELD_COMP_ID]}_${St.pathHash}`,St])));const Br=await Xr.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:Ir.map((St=>St.id))});const{rows:jr=[]}=Br.data;const Vr=new Map(jr.map((St=>[St._id,St])));const Wr=new RegExp(Kr.textKit.escapeRegExp(Sr.sep),"g");const zr=qr.KEYS.FILE_MANAGER_DIRNAME;const Yr=Ir.map((async({id:St,pathHash:On})=>{const rr=Lr.get(`${St}_${On}`);const cr=Vr.get(St);if(!cr||!rr){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithIdNotExist",{args:[St]}))}const ur=rr.compPath.replace(ir,"").replace(Wr,"/").slice(1);return{_id:Ur.digest.getStringHash(rr.compPath),name:cr.name,compId:St,version:rr.compjson.version,path:zr+ur,previewConfigs:cr.previewConfigs,bgColor:cr.bgColor,fullPath:rr.compPath}}));const ii=await Promise.all(Yr);return{total:Pr,page:On,pageSize:rr,rows:ii}}async getLocalCompDetailByPathHash(St){const{fullPathHash:On}=St;const rr=await this.getAllLocalCompIds();const ir=rr.find((St=>St.pathHash===On));if(!ir){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.compWithPathNotExist",{args:[On]}))}const{srcPath:cr}=this.configService.comphubConfig();const ur=ir.compjson[qr.KEYS.COMP_FIELD_COMP_ID];const{version:pr}=ir.compjson;const fr=await Xr.remoteApi.v1Comp.compcontrollerCompsbyids({compIds:[ur]});const{rows:Er=[]}=fr.data;const kr=Er[0];const Pr=new RegExp(Kr.textKit.escapeRegExp(Sr.sep),"g");const Ir=qr.KEYS.FILE_MANAGER_DIRNAME;const Lr=ir.compPath.replace(cr,"").replace(Pr,"/").slice(1);return{_id:On,name:kr.name,compId:ur,version:pr,path:Ir+Lr,previewConfigs:kr.previewConfigs,bgColor:kr.bgColor,fullPath:ir.compPath}}async openCompPathInVscode(St){const{folderPath:On,relativeFilePath:rr}=St;await this.commandService.revealInVSCode(On,rr)}async openCompPathInExplorer(St){const{folderPath:On,relativeFilePath:rr}=St;await this.commandService.revealInExplorer(On,rr)}async writeCompFile(St){const{compPath:On,filename:rr,content:ir}=St;const cr=this.getCompFullPath(On);const ur=Sr.join(cr,rr);Er.writeFileSync(ur,Buffer.from(ir,"base64"))}async renameCompDir(St){const{compPath:On,newName:rr}=St;if(!Kr.textKit.validateCompName(rr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.invalidCompName",{args:[rr]}))}const ir=this.getCompFullPath(On);const cr=Sr.basename(ir);if(cr===rr)return;const ur=Sr.dirname(ir);const pr=Sr.join(ur,rr);if(Er.existsSync(pr)){throw new br.httpError.BadRequestError(this.i18nService.translate("local.comp.errors.dirAlreadyExists",{args:[rr]}))}await Er.promises.rename(ir,pr)}};On.CompService=ii;ur([(0,br.App)(),fr("design:type",Object)],ii.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",kr.ConfigService)],ii.prototype,"configService",void 0);ur([(0,br.Inject)(),fr("design:type",Lr.OssService)],ii.prototype,"ossService",void 0);ur([(0,br.Inject)(),fr("design:type",Wr.CommandService)],ii.prototype,"commandService",void 0);ur([(0,br.Inject)(),fr("design:type",Pr.DepsService)],ii.prototype,"depsService",void 0);ur([(0,br.Inject)(),fr("design:type",Ir.ModuleService)],ii.prototype,"moduleService",void 0);ur([(0,br.Inject)(),fr("design:type",Object)],ii.prototype,"ctx",void 0);ur([(0,br.Inject)(),fr("design:type",Yr.MidwayI18nService)],ii.prototype,"i18nService",void 0);On.CompService=ii=ur([(0,br.Provide)()],ii)},63366:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ConfigService=void 0;const br=rr(46123);const Sr=rr(26815);const Er=pr(rr(16928));let kr=class ConfigService{comphubConfig(){const St=this.app.getAttr(Sr.KEYS.COMPHUB_CONFIG_KEY);return St}getGlobalConfig(){const St=this.comphubConfig();const{cwd:On,srcPath:rr,version:ir,allowDebug:cr,subPort:ur,projectHash:pr}=St;return{cwd:On,srcPath:rr,sep:Er.sep,version:ir,allowDebug:cr,subPort:ur,projectHash:pr}}};On.ConfigService=kr;ur([(0,br.App)(),fr("design:type",Object)],kr.prototype,"app",void 0);On.ConfigService=kr=ur([(0,br.Provide)()],kr)},23086:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.DepsService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(64713);const Pr=rr(87518);const Ir=rr(18801);const Lr=rr(26815);const Br=rr(63366);const jr=rr(58953);let Ur=0;let Vr=class DepsService{async getModuleEntry(St,On){const rr=await Pr.fileSys.readJsonFile(Sr.join(On,"package.json"));if(!rr){this.ctx.logger.error("未找到 package.json 文件");return[]}const ir=Pr.resolver.findDependencyVersion(rr,"vue");const cr=Pr.resolver.findDependencyVersion(rr,"react");const ur=await Pr.depGraph.detectImports(St,{pathAliases:["@"]});if(ir&&cr){throw new br.httpError.BadRequestError("组件同时依赖 vue 和 react,无法确定框架类型")}if(ir){ur.vue={version:ir}}if(cr){ur.react={version:cr};const St=Pr.resolver.findDependencyVersion(rr,"react-dom");if(St){const On=Number(Ir.versionKit.getMajorVersion(cr));if(On>=18){ur["react-dom/client"]={version:St}}else{ur["react-dom"]={version:St}}}}const pr={};for(const[St]of Object.entries(ur)){const ir=Pr.resolver.findDependencyVersion(rr,St);const cr={version:ir};const ur=await Pr.resolver.findOwningPackage(St,On);if(ur){cr.version=ur.version;if(!ir){cr.parent={name:ur.name,version:ur.version}}}pr[St]=cr}return Object.entries(pr).map((([St,On])=>({name:St,version:On.version,...On.parent&&{parent:On.parent}})))}async buildTemplateCompiler(St,On,rr){const ir=(await Pr.fileSys.readJsonFile(Sr.join(On,"node_modules","vue-template-compiler","package.json")))?.version;if(!ir){throw new Error(`未在 node_modules 中找到 vue-template-compiler,请确保项目已安装: npm install vue-template-compiler@${St}`)}this.ctx.logger.info(`[buildTemplateCompiler] 实装 vue-template-compiler@${ir},组件声明 Vue 版本: ${St}`);const cr=(await Pr.fileSys.readJsonFile(Sr.join(On,"node_modules","vue","package.json")))?.version;if(!cr){this.ctx.logger.warn(`[buildTemplateCompiler] 未在 node_modules 中找到 vue,跳过编译器一致性检查(cwd=${On})`)}else if(!(0,jr.isTemplateCompilerVersionMatched)(cr,ir)){this.ctx.logger.warn(`[buildTemplateCompiler] vue@${cr} 与 vue-template-compiler@${ir} 主次版本不一致:`+`编译产物取自实装的 ${ir},会喂给 ${cr} 的运行时,模板较复杂时可能出现编译异常。`+`如需消除告警: npm install vue-template-compiler@${cr}`)}const ur=`export * from 'vue-template-compiler';`;const pr=Sr.join(rr,"__compiler_entry__.js");await Er.promises.mkdir(rr,{recursive:true});await Er.promises.writeFile(pr,ur);const fr=Sr.join(rr,`__compiler_tmp__-${process.pid}-${++Ur}.js`);try{await(0,kr.build)({entryPoints:[pr],bundle:true,format:"iife",globalName:"VueTemplateCompiler",outfile:fr,platform:"browser",target:"es2015",absWorkingDir:On,nodePaths:[Sr.join(On,"node_modules")],external:[],sourcemap:false,minify:false})}catch(St){await Er.promises.unlink(pr).catch((()=>{}));await Er.promises.unlink(fr).catch((()=>{}));throw new Error(`esbuild 构建 vue-template-compiler 失败: ${St.message}`)}await Er.promises.unlink(pr).catch((()=>{}));const br=await Er.promises.readFile(fr,"utf-8");const Ir=Pr.digest.getStringHash(br).slice(0,8);const Lr=(0,jr.buildTemplateCompilerFileName)(ir,Ir);await Er.promises.rename(fr,Sr.join(rr,Lr));this.ctx.logger.info(`[buildTemplateCompiler] esbuild 构建完成: ${Lr}`);return{fileName:Lr}}async precompileModule(St,On,rr){const ir=await Pr.fileSys.readJsonFile(Sr.join(rr,"package.json"));if(!ir){this.ctx.logger.error("未找到 package.json 文件");return{entryNameToFile:{},chunkFiles:[]}}const{entryPoints:cr,entryKeyToDepName:ur,skippedDeps:pr}=await(0,jr.buildEntryPoints)(On,ir,rr);const{entryPoints:fr,mergedPackages:br}=(0,jr.mergeSubPathEntries)(cr);for(const[,On]of Object.entries(br)){const rr=(0,jr.generateMergedWrapper)(On.subExportMap);const ir=Sr.join(St,`${On.entryKey}.js`);fr[On.entryKey]=ir;await Er.promises.mkdir(Sr.dirname(ir),{recursive:true});await Er.promises.writeFile(ir,rr)}await Er.promises.mkdir(St,{recursive:true});const Ir={};const Br={};for(const[St,On]of Object.entries(fr)){const ir=ur[St]??St;if(St.startsWith("__merged__")||Pr.resolver.isModuleInstalled(ir,rr)){Ir[St]=On;const cr=await Pr.resolver.findOwningPackage(ir,rr);if(cr?.version)Br[St]=cr.version}else{pr.push(ir)}}const Ur={};const Vr=Sr.join(St,Lr.KEYS.META_FILE_NAME);const Wr=await Pr.fileSys.readJsonFile(Vr);const{filteredEntryPoints:zr,cachedMappings:qr}=(0,jr.filterCachedModules)(Ir,Wr,Br);for(const[,On]of Object.entries(br)){const rr=On.entryKey;if(Wr?.[rr]){const ir=Wr[rr].file;for(const rr of On.wrapperSubPaths){const cr=On.subExportMap[rr];const ur=(0,jr.getSubWrapperFileName)(cr,ir);const pr=Sr.join(St,ur);if(!Er.existsSync(pr)){await Er.promises.writeFile(pr,(0,jr.generateSubWrapper)(cr,ir))}qr[rr]=ur}qr[rr]=ir}}Object.assign(Ur,qr);if(Object.keys(zr).length===0){const St=this.resolveChunkFiles(Ur,Wr);const ir=this.restoreEntryNames(Ur,ur);this.warnMissingDeps(On,ir,pr,rr);return{entryNameToFile:ir,chunkFiles:St}}const Kr={entryPoints:zr,bundle:true,format:"esm",splitting:true,outdir:St,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:rr,nodePaths:[Sr.join(rr,"node_modules")]};const Xr=await(0,kr.build)(Kr);const{optimized:Yr,entryNameToFile:ii}=(0,jr.analyzeBuildOutputs)(Xr,zr,St,Br);for(const[,On]of Object.entries(br)){const rr=On.entryKey;if(!(rr in zr))continue;const ir=ii[rr];if(!ir)continue;for(const rr of On.wrapperSubPaths){const cr=On.subExportMap[rr];const ur=(0,jr.getSubWrapperFileName)(cr,ir);const pr=Sr.join(St,ur);await Er.promises.writeFile(pr,(0,jr.generateSubWrapper)(cr,ir));ii[rr]=ur}}const oi={...Wr,...Yr};await(0,jr.saveBuildMetadata)(Vr,oi);const ai={...Ur,...ii};const pi=this.resolveChunkFiles(ai,oi);const mi=this.restoreEntryNames(ai,ur);this.warnMissingDeps(On,mi,pr,rr);return{entryNameToFile:mi,chunkFiles:pi}}warnMissingDeps(St,On,rr,ir){const cr=St.filter((St=>!(St in On)));if(!cr.length)return;const ur=cr.filter((St=>!rr.includes(St)));const pr=ur.length?`;其中 ${ur.join(", ")} 并非因「未安装」被过滤,需查入口构建 / 缓存 / esbuild 产出匹配环节`:";均因「未安装」被过滤";this.ctx.logger.warn(`[precompileModule] 请求了但未产出映射: ${cr.join(", ")}${pr}(cwd=${ir})`)}restoreEntryNames(St,On){for(const[rr,ir]of Object.entries(St)){const cr=On[rr];if(cr&&cr!==rr){St[cr]=ir;delete St[rr]}}return St}resolveChunkFiles(St,On){const rr=new Set(Object.values(St));const ir=new Set;for(const[cr]of Object.entries(St)){const St=On?.[cr]?.chunkFiles;if(!St?.length)continue;for(const On of St){if(!rr.has(On))ir.add(On)}}return Array.from(ir)}};On.DepsService=Vr;ur([(0,br.App)(),fr("design:type",Object)],Vr.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",Object)],Vr.prototype,"ctx",void 0);ur([(0,br.Inject)(),fr("design:type",Br.ConfigService)],Vr.prototype,"configService",void 0);On.DepsService=Vr=ur([(0,br.Provide)()],Vr)},85984:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ModuleService=void 0;const br=rr(46123);const Sr=rr(63366);const Er=rr(23086);const kr=pr(rr(16928));const Pr=rr(87518);const Ir=pr(rr(79896));const Lr=rr(26815);let Br=class ModuleService{async getPreBuildModuleDir(){const{cwd:St}=this.configService.comphubConfig();const On=kr.join(St,Lr.KEYS.PREBUILD_MODULE_DIR);await Ir.promises.mkdir(On,{recursive:true});return On}async preBuild(St){const On=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.precompileModule(On,St,rr)}async buildTemplateCompiler(St){const On=await this.getPreBuildModuleDir();const{cwd:rr}=this.configService.comphubConfig();return await this.depsService.buildTemplateCompiler(St,rr,On)}async preBuildSize(){const St=await this.getPreBuildModuleDir();return await Pr.fileSys.dirSize(St)}async clearPreBuild(){const St=await this.getPreBuildModuleDir();await Ir.promises.rm(St,{recursive:true,force:true})}};On.ModuleService=Br;ur([(0,br.Inject)(),fr("design:type",Sr.ConfigService)],Br.prototype,"configService",void 0);ur([(0,br.Inject)(),fr("design:type",Er.DepsService)],Br.prototype,"depsService",void 0);ur([(0,br.App)(),fr("design:type",Object)],Br.prototype,"app",void 0);On.ModuleService=Br=ur([(0,br.Provide)()],Br)},80799:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.OssService=void 0;const Sr=rr(46123);const Er=br(rr(54504));const kr=br(rr(12593));const Pr=br(rr(18451));const Ir=pr(rr(16928));const Lr=pr(rr(79896));const Br=rr(96955);const jr=rr(4990);const Ur=br(rr(23046));const Vr=rr(45853);const Wr=rr(26815);const zr=rr(68255);let qr=class OssService{createOssClient(St){const On={endpoint:Wr.KEYS.OSS_CUSTOM_DOMAIN,authorizationV4:true,cname:true,...St};return new Pr.default(On)}getContentTypeWithCharset(St){const On=Ir.extname(St).toLowerCase();const rr={".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 rr[On]}createOssFormData(St,On,rr=false){const ir=new Er.default;const cr=St.dir+St.key;ir.append("success_action_status","200");ir.append("policy",St.policy);ir.append("x-oss-signature",St.signature);ir.append("x-oss-signature-version",St.x_oss_signature_version);ir.append("x-oss-credential",St.x_oss_credential);ir.append("x-oss-date",St.x_oss_date);ir.append("key",cr);ir.append("x-oss-security-token",St.security_token);ir.append("x-oss-forbid-overwrite",rr?"false":"true");ir.append("Cache-Control","public, max-age=31536000");const ur={};const pr=On.path?.toString();if(pr){const St=this.getContentTypeWithCharset(pr);if(St){ur.contentType=St}}ir.append("file",On,ur);return{host:St.host,filePath:cr,formData:ir}}async getDownloadSts(){const St=await this.cache.get(Wr.KEYS.CACHE_KEY_STS_TOKEN);if(St){return St}const On=await jr.remoteApi.v1Oss.osscontrollerGetsts();const rr=new Date(On.data.Expiration).getTime()-1*60*1e3;const ir=rr-Date.now();this.ctx.logger.debug("STS过期时间",(0,Ur.default)(rr).format("YYYY-MM-DD HH:mm:ss"));this.cache.set(Wr.KEYS.CACHE_KEY_STS_TOKEN,On.data,ir);return On.data}async uploadFileToOss(St,On,rr=false){const{host:ir,formData:cr}=this.createOssFormData(St,On,rr);const ur=await kr.default.post(ir,cr,{headers:{...cr.getHeaders()}}).catch((async St=>{const On=St.response.data;const rr=await(0,Vr.parseStringPromise)(On);if(rr?.Error){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[rr.Error.Message]}))}throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[St.message||St]}))}));if(ur.status!==200){throw new Sr.httpError.BadRequestError(this.i18nService.translate("local.oss.errors.requestFailed",{args:[ur.data]}))}}async downloadFileToPath(St,On,rr){const ir=this.createOssClient({region:St.region,accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken,bucket:St.bucket,refreshSTSToken:async()=>{const St=await this.getDownloadSts();return{accessKeyId:St.AccessKeyId,accessKeySecret:St.AccessKeySecret,stsToken:St.SecurityToken}}});const cr=On.map((async St=>{const{path:On}=St;const cr=Ir.join(rr,On);const ur=Ir.dirname(cr);if(!Lr.existsSync(ur)){Lr.mkdirSync(ur,{recursive:true})}return await ir.get(On,cr)}));return await Promise.all(cr)}};On.OssService=qr;ur([(0,Sr.Inject)(),fr("design:type",Object)],qr.prototype,"ctx",void 0);ur([(0,Sr.InjectClient)(Br.CachingFactory,"default"),fr("design:type",Object)],qr.prototype,"cache",void 0);ur([(0,Sr.Inject)(),fr("design:type",zr.MidwayI18nService)],qr.prototype,"i18nService",void 0);On.OssService=qr=ur([(0,Sr.Provide)()],qr)},61275:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.QueueService=void 0;const cr=rr(46123);let ur=class QueueService{constructor(){this.queue=[];this.isProcessing=false}async processQueue(){if(this.isProcessing||this.queue.length===0){return}this.isProcessing=true;const St=this.queue.shift();if(St){await St()}this.isProcessing=false;this.processQueue()}async enqueue(St){return new Promise((On=>{this.queue.push((async()=>{try{await St()}finally{On()}}));this.processQueue()}))}};On.QueueService=ur;On.QueueService=ur=ir([(0,cr.Provide)(),(0,cr.Scope)(cr.ScopeEnum.Singleton)],ur)},19452:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var br=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.TerminalService=void 0;const Sr=rr(46123);const Er=rr(35317);const kr=rr(63366);const Pr=pr(rr(1999));const Ir=rr(73024);const Lr=rr(51455);const Br=rr(87518);const jr=br(rr(44644));let Ur=class TerminalService{constructor(){this.subprocess=null;this.cwd="";this.tabIndex=0}getPrompt(){return`${this.cwd}`}smartDecode(St){if(!St||St.length===0)return"";try{new TextDecoder("utf-8",{fatal:true}).decode(St);return Pr.decode(St,"utf-8")}catch{return Pr.decode(St,"gbk")}}async folderExists(St){try{await(0,Lr.access)(St,Ir.constants.F_OK|Ir.constants.R_OK);return true}catch{return false}}async shutdown(St=5e3){const On=this.subprocess;if(!On||On.killed){this.ctx.emit("output",{cwd:this.getPrompt()});return}return new Promise((rr=>{let ir=false;const done=()=>{if(!ir){ir=true;rr(0)}};On.once("exit",done);(0,jr.default)(On.pid,"SIGTERM",(St=>{if(St){this.ctx.emit("output",{err:St.message})}}));const cr=setTimeout((()=>{(0,jr.default)(On.pid,"SIGKILL",(St=>{if(St){this.ctx.emit("output",{err:St.message})}done()}))}),St);On.once("exit",(()=>clearTimeout(cr)))}))}async execCmd({cwd:St,oldCwd:On,command:rr}){if(!await this.folderExists(St)){this.ctx.emit("output",{err:`${St} 路径不存在`});this.ctx.emit("output",{cwd:On});return}this.cwd=St;if(!rr.trim()){this.ctx.emit("output",{cwd:this.getPrompt()});return}if(rr==="^C"){await this.shutdown();return}this.subprocess=(0,Er.spawn)(rr,{shell:true,cwd:St,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",(St=>{this.ctx.emit("output",{stdout:this.smartDecode(St)})}));this.subprocess.stderr?.on("data",(St=>{this.ctx.emit("output",{stderr:this.smartDecode(St)})}));this.subprocess.on("close",(()=>{this.subprocess=null;this.ctx.emit("output",{cwd:this.getPrompt(),command:rr})}));this.subprocess.on("error",(St=>{this.ctx.emit("output",{err:St.message})}))}async cmdTab({cwd:St,lastWord:On}){let rr=await Br.fileSys.readDirFiles(St);if(On){rr=rr.filter((St=>St.name.startsWith(On)))}if(rr.length===0){return}this.tabIndex=(this.tabIndex+1)%rr.length;const ir=rr[this.tabIndex];this.ctx.emit("output",{tab:ir.name})}};On.TerminalService=Ur;ur([(0,Sr.Inject)(),fr("design:type",kr.ConfigService)],Ur.prototype,"configService",void 0);ur([(0,Sr.Inject)(),fr("design:type",Object)],Ur.prototype,"ctx",void 0);On.TerminalService=Ur=ur([(0,Sr.Provide)()],Ur)},5808:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var pr=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();var fr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.VuefinderService=void 0;const br=rr(46123);const Sr=pr(rr(16928));const Er=pr(rr(79896));const kr=rr(63366);const Pr=pr(rr(93900));const Ir=rr(26815);let Lr=class VuefinderService{async list({path:St}){const On=this.configService.comphubConfig();const{srcPath:rr}=On;const ir=St?.replace(Ir.KEYS.FILE_MANAGER_DIRNAME,"")||"";let cr=Sr.join(rr,ir);const ur=await Er.promises.access(cr).then((()=>true)).catch((()=>false));if(!ur){cr=rr;St=Ir.KEYS.FILE_MANAGER_DIRNAME}const pr=await Er.promises.readdir(cr);const fr=pr.map((async On=>{const rr=Sr.join(cr,On);const ir=await Er.promises.stat(rr);const ur=ir.isDirectory();const pr=St===Ir.KEYS.FILE_MANAGER_DIRNAME?`${St}${On}`:`${St}/${On}`;return{type:ur?"dir":"file",path:pr,file_size:ir.size,visibility:"public",last_modified:Math.floor(ir.mtimeMs/1e3),basename:On,extension:ur?"":Sr.extname(On).slice(1),mime_type:Pr.lookup(On)||""}}));const br=await Promise.all(fr);br.sort(((St,On)=>{if(St.type==="dir"&&On.type==="file"){return-1}else if(St.type==="file"&&On.type==="dir"){return 1}else{return 0}}));return{storages:pr,dirname:St,files:br}}};On.VuefinderService=Lr;ur([(0,br.App)(),fr("design:type",Object)],Lr.prototype,"app",void 0);ur([(0,br.Inject)(),fr("design:type",kr.ConfigService)],Lr.prototype,"configService",void 0);On.VuefinderService=Lr=ur([(0,br.Provide)()],Lr)},66593:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.TerminalSocketController=void 0;const ur=rr(46123);const pr=rr(19452);let fr=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(St){this.terminalService.execCmd(St)}async onTab(St){this.terminalService.cmdTab(St)}};On.TerminalSocketController=fr;ir([(0,ur.Inject)(),cr("design:type",Object)],fr.prototype,"ctx",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.TerminalService)],fr.prototype,"terminalService",void 0);ir([(0,ur.OnWSConnection)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"onConnection",null);ir([(0,ur.OnWSDisConnection)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"onDisConnection",null);ir([(0,ur.OnWSMessage)("command"),cr("design:type",Function),cr("design:paramtypes",[Object]),cr("design:returntype",Promise)],fr.prototype,"onCommand",null);ir([(0,ur.OnWSMessage)("tab"),cr("design:type",Function),cr("design:paramtypes",[Object]),cr("design:returntype",Promise)],fr.prototype,"onTab",null);On.TerminalSocketController=fr=ir([(0,ur.WSController)("/terminal")],fr)},58953:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__setModuleDefault||(Object.create?function(St,On){Object.defineProperty(St,"default",{enumerable:true,value:On})}:function(St,On){St["default"]=On});var ur=this&&this.__importStar||function(){var ownKeys=function(St){ownKeys=Object.getOwnPropertyNames||function(St){var On=[];for(var rr in St)if(Object.prototype.hasOwnProperty.call(St,rr))On[On.length]=rr;return On};return ownKeys(St)};return function(St){if(St&&St.__esModule)return St;var On={};if(St!=null)for(var rr=ownKeys(St),ur=0;ur<rr.length;ur++)if(rr[ur]!=="default")ir(On,St,rr[ur]);cr(On,St);return On}}();Object.defineProperty(On,"__esModule",{value:true});On.analyzeBuildOutputs=analyzeBuildOutputs;On.saveBuildMetadata=saveBuildMetadata;On.filterCachedModules=filterCachedModules;On.toSafeEntryKey=toSafeEntryKey;On.buildEntryPoints=buildEntryPoints;On.mergeSubPathEntries=mergeSubPathEntries;On.generateMergedWrapper=generateMergedWrapper;On.generateSubWrapper=generateSubWrapper;On.getSubWrapperFileName=getSubWrapperFileName;On.isTemplateCompilerVersionMatched=isTemplateCompilerVersionMatched;On.buildTemplateCompilerFileName=buildTemplateCompilerFileName;const pr=ur(rr(16928));const fr=ur(rr(79896));const br=rr(87518);const Sr=rr(18801);const Er=rr(26815);function resolveModuleEntry(St,On){if(St!=="vue")return St;const rr=Sr.versionKit.getMajorVersion(On);return rr==="3"?Er.KEYS.VUE_ESM_BUNDLER:St}function extractModuleName(St){const On=pr.extname(St);const rr=pr.basename(St,On);return rr.replace(/-[A-Za-z0-9_-]{8}$/,"")}function matchEntryKey(St,On){return St.find((St=>{const rr=St.split("/");const ir=rr[rr.length-1];return On===ir}))}function analyzeBuildOutputs(St,On,rr,ir={}){const cr={};const ur={};const Sr=Object.keys(On);const Er=St.metafile?.outputs??{};const kr=new Set(Object.keys(Er).map((St=>pr.basename(St))));for(const[St,On]of Object.entries(Er)){const Er=pr.basename(St);if(!On.entryPoint)continue;const Pr=extractModuleName(St);const Ir=matchEntryKey(Sr,Pr);if(!Ir)continue;ur[Ir]=Er;const Lr=pr.join(rr,Er);const Br=fr.readFileSync(Lr,"utf-8");const jr=br.digest.getStringHash(Br).slice(0,8);cr[Ir]={src:On.entryPoint,file:Er,fileHash:jr,needsInterop:false,version:ir[Ir],chunkFiles:(On.imports??[]).map((St=>pr.basename(St.path))).filter((St=>St&&kr.has(St)&&St!==Er))}}return{optimized:cr,entryNameToFile:ur}}async function saveBuildMetadata(St,On){await fr.promises.writeFile(St,JSON.stringify(On,null,2))}function isCacheEntryValid(St,On){return!!St.version&&St.version===On}function filterCachedModules(St,On,rr={}){if(!On){return{filteredEntryPoints:St,cachedMappings:{}}}const ir={};const cr={};for(const[ur,pr]of Object.entries(St)){const St=On[ur];if(St&&isCacheEntryValid(St,rr[ur])){cr[ur]=St.file}else{ir[ur]=pr}}return{filteredEntryPoints:ir,cachedMappings:cr}}function toSafeEntryKey(St){if(St.startsWith("@")){const On=St.split("/");if(On.length===2&&!pr.extname(On[1])){return`__${On[0].slice(1)}_${On[1]}`}}if(St.includes("/")){return St.replace(/\//g,"_")}return St}async function buildEntryPoints(St,On,rr){const ir={};const cr={};const ur=[];for(const pr of St){const St=br.resolver.findDependencyVersion(On,pr);if(!St){const St=await br.resolver.findOwningPackage(pr,rr);if(!St){ur.push(pr);continue}}const fr=toSafeEntryKey(pr);ir[fr]=resolveModuleEntry(pr,St);cr[fr]=pr}return{entryPoints:ir,entryKeyToDepName:cr,skippedDeps:ur}}function extractPackageName(St){if(St.startsWith("@")){const On=St.split("/");return On.slice(0,2).join("/")}return St.split("/")[0]}function toSafeIdentifier(St){return St.replace(/\.js$/,"").replace(/[./]/g,"_")}function mergeSubPathEntries(St){const On={};const rr={};for(const[ir,cr]of Object.entries(St)){const St=extractPackageName(ir);if(ir!==St){const ur=!/\.(js|ts|jsx|tsx|mjs|cjs)$/.test(ir);if(ur){rr[ir]=cr;continue}if(!On[St])On[St]={};On[St][ir]=cr}else{rr[ir]=cr}}const ir={};for(const[St,cr]of Object.entries(On)){const On=Object.keys(cr);if(On.length<=1){Object.assign(rr,cr);continue}const ur=br.digest.getStringHash(On.slice().sort().join("|")).slice(0,8);const pr=`__merged__${St}-${ur}`;const fr={};const Sr=[];for(const St of Object.keys(cr)){const On=toSafeIdentifier(St);fr[St]=On;Sr.push(St)}rr[pr]=pr;ir[St]={entryKey:pr,subExportMap:fr,wrapperSubPaths:Sr}}return{entryPoints:rr,mergedPackages:ir}}function generateMergedWrapper(St){const On=[];const rr=[];const ir=[];const cr=new Set;for(const[ur,pr]of Object.entries(St)){if(cr.has(pr))continue;cr.add(pr);const St=`__imp_${pr}`;On.push(`import * as ${St} from '${ur}';`);rr.push(`export const ${pr} = ${St}.default || Object.assign({}, ${St});`);ir.push(`export * from '${ur}';`)}return["// Auto-generated by comp-hub: merged entry for esbuild",...On,...rr,...ir,""].join("\n")}function generateSubWrapper(St,On){return[`// Auto-generated: sub-wrapper for ${St}`,`export { ${St} as default } from './${On}';`,`export * from './${On}';`,""].join("\n")}function getSubWrapperFileName(St,On){const rr=pr.basename(On,pr.extname(On));return`${St}-w-${rr}.js`}function isTemplateCompilerVersionMatched(St,On){const parse=St=>{try{return Sr.versionKit.parseVersion(St)}catch{return null}};const rr=parse(St);const ir=parse(On);if(!rr||!ir)return false;return rr.major===ir.major&&rr.minor===ir.minor}function buildTemplateCompilerFileName(St,On){return`vue2-template-compiler-${St.replace(/\./g,"_")}-${On}.js`}},49969:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getErrorMessage=getErrorMessage;function getErrorMessage(St){if(St instanceof Error)return St.message;if(typeof St==="string")return St;return String(St)}},4145:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.waitForIpcConfig=waitForIpcConfig;const cr=ir(rr(16928));const ur=rr(26815);function parseCwdArg(St){for(let On=0;On<St.length;On++){if(St[On]==="--cwd"&&On+1<St.length){return St[On+1]}if(St[On].startsWith("--cwd=")){return St[On].replace("--cwd=","")}}return undefined}function waitForIpcConfig(){const St=parseCwdArg(process.argv);if(St){return Promise.resolve({type:"config",port:0,cwd:cr.default.resolve(St),allowDebug:process.env.MIDWAY_SERVER_ENV===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}if(process.send){return new Promise(((St,On)=>{const rr=setTimeout((()=>{On(new Error("No IPC config received within 10s. MidwayJS must be started by master via fork."))}),1e4);process.once("message",(On=>{if(On?.type==="config"){clearTimeout(rr);St(On)}}))}))}return Promise.resolve({type:"config",port:0,cwd:process.cwd(),allowDebug:process.env.MIDWAY_SERVER_ENV===ur.KEYS.LOCAL_MIDWAY_ENV_LOCAL})}},5052:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.splitReusableDeps=splitReusableDeps;On.resolveCompilerBuild=resolveCompilerBuild;const ir=rr(18801);function splitReusableDeps(St,On=[],rr={}){const cr=new Map(On.map((St=>[St.name,St.version])));const ur={};const pr=[];for(const On of St){const St=rr[On.name];const fr=cr.get(On.name);if(St&&fr&&ir.versionKit.isVersionEqual(On.version,fr)){ur[On.name]=St}else{pr.push(On.name)}}return{reused:ur,localNames:pr}}function resolveCompilerBuild(St){const On=St.find((St=>St.name==="vue"))?.version;if(!On)return{action:"skip",reason:"no-vue"};try{return ir.versionKit.getMajorVersion(On)==="2"?{action:"build",vueVersion:On}:{action:"skip",reason:"not-vue2"}}catch{return{action:"skip",reason:"unparsable",raw:On}}}},10778:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.remoteInstance=On.setHeader=void 0;const cr=rr(42552);const ur=rr(26815);const pr=ir(rr(65692));const fr=(0,cr.initInstance)(ur.KEYS.REMOTE_SERVICE_PREFIX,{timeout:1e4,httpsAgent:new pr.default.Agent({rejectUnauthorized:false})},(St=>St.replace(ur.KEYS.REMOTE_SERVICE_PREFIX,"")));On.remoteInstance=fr;let br=null;const setHeader=St=>{br=St};On.setHeader=setHeader;fr.interceptors.request.use((St=>{St.headers[ur.KEYS.AUTHORIZATION_HEADER_NAME]=br[ur.KEYS.AUTHORIZATION_HEADER_NAME];St.headers[ur.KEYS.ACCEPT_LANGUAGE_HEADER_NAME]=br[ur.KEYS.ACCEPT_LANGUAGE_HEADER_NAME.toLowerCase()];St.headers["cookie"]=br.cookie;return St}),(St=>Promise.reject(St)));fr.interceptors.response.use((async St=>{if(St.data.code!==0){throw new Error(JSON.stringify(St.data))}return St.data}),(St=>Promise.reject(St)))},67872:function(St,On,rr){"use strict";var ir=this&&this.__importDefault||function(St){return St&&St.__esModule?St:{default:St}};Object.defineProperty(On,"__esModule",{value:true});On.createKoaProxy=createKoaProxy;const cr=ir(rr(58611));const ur=rr(31855);const pr=new cr.default.Agent({keepAlive:true,keepAliveMsecs:3e4,maxSockets:50,maxFreeSockets:10});const fr=new Map;function getOrCreateSubProxy(St,On){const rr=`${St}|${JSON.stringify(On)}`;if(!fr.has(rr)){fr.set(rr,(0,ur.createProxyMiddleware)({target:St,changeOrigin:true,secure:false,agent:pr,pathRewrite:On,on:{error:St=>{}}}))}return fr.get(rr)}async function createKoaProxy(St,On,rr){const ir=getOrCreateSubProxy(On,rr);return new Promise(((On,rr)=>{St.res.on("finish",On);St.res.on("close",On);St.res.on("error",rr);ir(St.req,St.res,(St=>{if(St)rr(St);else On()}))}))}},101:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.PackageJsonVO=On.LocalCompDetailVO=On.LocalCompsVO=On.CompFileHashVO=On.CompSimilarListVO=On.DownloadCompVO=On.LocalCompsByIdsVO=On.ImportScanResultVO=On.CompCheckVO=On.CompFileContentVO=On.CompFileVO=On.CompSimilarListItemVO=On.FileNode=void 0;const ur=rr(49179);const pr=rr(26815);class FileNode{}On.FileNode=FileNode;ir([(0,ur.ApiProperty)({description:"目录/文件名称",example:"index.vue",required:true}),cr("design:type",String)],FileNode.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"目录/文件路径",example:"/src/components/MyComp/index.vue",required:true}),cr("design:type",String)],FileNode.prototype,"path",void 0);ir([(0,ur.ApiProperty)({description:"目录/文件类型",example:"file",required:true,enum:pr.ENUM.FileType}),cr("design:type",String)],FileNode.prototype,"type",void 0);ir([(0,ur.ApiProperty)({description:"子节点",type:[FileNode]}),cr("design:type",Array)],FileNode.prototype,"children",void 0);class CompSimilarListItemVO{}On.CompSimilarListItemVO=CompSimilarListItemVO;ir([(0,ur.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),cr("design:type",String)],CompSimilarListItemVO.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({example:"组件名称",description:"组件名称",required:true}),cr("design:type",String)],CompSimilarListItemVO.prototype,"name",void 0);class CompFileVO{}On.CompFileVO=CompFileVO;ir([(0,ur.ApiProperty)({type:FileNode,description:"组件文件树",required:true}),cr("design:type",FileNode)],CompFileVO.prototype,"tree",void 0);ir([(0,ur.ApiProperty)({type:[String],description:"组件文件列表",required:true}),cr("design:type",Array)],CompFileVO.prototype,"files",void 0);class CompFileContentVO{}On.CompFileContentVO=CompFileContentVO;ir([(0,ur.ApiProperty)({description:"组件文件内容",example:"let a=123;",required:true}),cr("design:type",String)],CompFileContentVO.prototype,"content",void 0);class CompCheckVO{}On.CompCheckVO=CompCheckVO;ir([(0,ur.ApiProperty)({description:"组件入口文件路径",required:false}),cr("design:type",String)],CompCheckVO.prototype,"entryIndexPath",void 0);ir([(0,ur.ApiProperty)({description:"组件配置文件路径",required:false}),cr("design:type",String)],CompCheckVO.prototype,"compJsonPath",void 0);ir([(0,ur.ApiProperty)({description:"异常结果内容",required:true}),cr("design:type",String)],CompCheckVO.prototype,"errorMsg",void 0);class ParentVO{}ir([(0,ur.ApiProperty)({description:"父库名称",required:true,example:"vue"}),cr("design:type",String)],ParentVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"父库版本",required:true,example:"^2.10.5"}),cr("design:type",String)],ParentVO.prototype,"version",void 0);class ImportDetailVO{}ir([(0,ur.ApiProperty)({description:"库名称",required:true,example:"element-plus"}),cr("design:type",String)],ImportDetailVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({description:"库版本(仅第三方库存在)",required:true,example:"^2.10.5"}),cr("design:type",String)],ImportDetailVO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:ParentVO,description:"父库(仅第三方库存在),在子包导入的时候,需要指定父库,比如 ol/Map.js 就需要指定父库 ol",required:false}),cr("design:type",ParentVO)],ImportDetailVO.prototype,"parent",void 0);class ImportScanResultVO{}On.ImportScanResultVO=ImportScanResultVO;ir([(0,ur.ApiProperty)({type:[ImportDetailVO],required:true,description:"第三方库导入详情"}),cr("design:type",Array)],ImportScanResultVO.prototype,"thirdParty",void 0);class CompInfoVO{}ir([(0,ur.ApiProperty)({example:"60d21b4667d0d8992e610c85",description:"组件主键ID(自动生成)",required:true}),cr("design:type",String)],CompInfoVO.prototype,"id",void 0);ir([(0,ur.ApiProperty)({description:"组件文件路径",example:"local:///MyComp/index.vue",required:true}),cr("design:type",String)],CompInfoVO.prototype,"path",void 0);ir([(0,ur.ApiProperty)({description:"组件文件名称",example:"base-table",required:true}),cr("design:type",String)],CompInfoVO.prototype,"basename",void 0);ir([(0,ur.ApiProperty)({description:"组件文件完整路径",example:"/src/components/MyComp/index.vue",required:true}),cr("design:type",String)],CompInfoVO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({description:"组件文件完整路径哈希值",example:"123",required:true}),cr("design:type",String)],CompInfoVO.prototype,"fullPathHash",void 0);class LocalCompsByIdsVO{}On.LocalCompsByIdsVO=LocalCompsByIdsVO;ir([(0,ur.ApiProperty)({type:[CompInfoVO],required:true}),cr("design:type",Array)],LocalCompsByIdsVO.prototype,"compInfos",void 0);class DownloadCompVO{}On.DownloadCompVO=DownloadCompVO;ir([(0,ur.ApiProperty)({description:"组件是否重复",example:true,required:true}),cr("design:type",Boolean)],DownloadCompVO.prototype,"isRepeat",void 0);class CompSimilarListVO{}On.CompSimilarListVO=CompSimilarListVO;ir([(0,ur.ApiProperty)({type:[CompSimilarListItemVO],description:"相似组件列表",required:true}),cr("design:type",Array)],CompSimilarListVO.prototype,"similarList",void 0);class CompFileHashVO{}On.CompFileHashVO=CompFileHashVO;ir([(0,ur.ApiProperty)({example:"123",description:"组件哈希值",required:true}),cr("design:type",String)],CompFileHashVO.prototype,"compHash",void 0);class PreviewItem{}ir([(0,ur.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"预览配置项主键ID(自动生成)",required:false}),cr("design:type",String)],PreviewItem.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址",required:true}),cr("design:type",Array)],PreviewItem.prototype,"miniPath",void 0);ir([(0,ur.ApiProperty)({type:[String],example:["/index1.vue"],description:"组件预览入口地址(全屏窗口)",required:false}),cr("design:type",Array)],PreviewItem.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({example:"我是一个预览入口",description:"预览入口描述",required:false}),cr("design:type",String)],PreviewItem.prototype,"desc",void 0);class LocalCompsVO{}On.LocalCompsVO=LocalCompsVO;ir([(0,ur.ApiProperty)({type:String,example:"656f78a9b0c7e8d2e1f3a4b5",description:"内容id,这里用路径哈希值",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"_id",void 0);ir([(0,ur.ApiProperty)({type:String,example:"qin-table",description:"组件名称",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"name",void 0);ir([(0,ur.ApiProperty)({type:String,example:"123456",description:"组件ID",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"compId",void 0);ir([(0,ur.ApiProperty)({type:String,example:"1.0.0",description:"组件版本",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"version",void 0);ir([(0,ur.ApiProperty)({type:[PreviewItem],required:true}),cr("design:type",Array)],LocalCompsVO.prototype,"previewConfigs",void 0);ir([(0,ur.ApiProperty)({type:String,example:"local://components/QinTable",description:"组件文件路径",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"path",void 0);ir([(0,ur.ApiProperty)({type:String,example:"D:/src/components/QinTable/index.vue",description:"组件文件完整路径",required:true}),cr("design:type",String)],LocalCompsVO.prototype,"fullPath",void 0);ir([(0,ur.ApiProperty)({type:String,example:"#f0f0f0",description:"组件背景颜色",required:false}),cr("design:type",String)],LocalCompsVO.prototype,"bgColor",void 0);class LocalCompDetailVO extends LocalCompsVO{}On.LocalCompDetailVO=LocalCompDetailVO;class PackageJsonVO{}On.PackageJsonVO=PackageJsonVO;ir([(0,ur.ApiProperty)({type:Object,description:"组件package.json文件内容",required:true}),cr("design:type",Object)],PackageJsonVO.prototype,"packageJson",void 0)},71692:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BuildTemplateCompilerVO=On.PreBuildSizeVO=On.PreBuildVO=void 0;const ur=rr(49179);class PreBuildVO{}On.PreBuildVO=PreBuildVO;ir([(0,ur.ApiProperty)({description:"预构建模块对应文件",required:true,example:{vue:"vue-hash.js"}}),cr("design:type",Object)],PreBuildVO.prototype,"entryNameToFile",void 0);ir([(0,ur.ApiProperty)({description:"esbuild code-splitting 生成的公共 chunk 文件列表,上传 OSS 时需要一并上传",required:false,example:["chunk-26KRECMG.js","chunk-3AE7QCN7.js"]}),cr("design:type",Array)],PreBuildVO.prototype,"chunkFiles",void 0);class PreBuildSizeVO{}On.PreBuildSizeVO=PreBuildSizeVO;ir([(0,ur.ApiProperty)({description:"预构建模块文件总大小",required:true,example:1024}),cr("design:type",Number)],PreBuildSizeVO.prototype,"size",void 0);class BuildTemplateCompilerVO{}On.BuildTemplateCompilerVO=BuildTemplateCompilerVO;ir([(0,ur.ApiProperty)({description:"vue-template-compiler 浏览器 bundle 文件名(实装版本-内容 hash),通过 /_module_load_prefix_/ 前缀加载",required:true,example:"vue2-template-compiler-2_7_16-a1b2c3d4.js"}),cr("design:type",String)],BuildTemplateCompilerVO.prototype,"fileName",void 0)},15798:(St,On)=>{"use strict";const rr={suspectRx:/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*\:/};On.parse=function(St,...ir){const cr=typeof ir[0]==="object"&&ir[0];const ur=ir.length>1||!cr?ir[0]:undefined;const pr=ir.length>1&&ir[1]||cr||{};const fr=JSON.parse(St,ur);if(pr.protoAction==="ignore"){return fr}if(!fr||typeof fr!=="object"){return fr}if(!St.match(rr.suspectRx)){return fr}On.scan(fr,pr);return fr};On.scan=function(St,On={}){let rr=[St];while(rr.length){const St=rr;rr=[];for(const ir of St){if(Object.prototype.hasOwnProperty.call(ir,"__proto__")){if(On.protoAction!=="remove"){throw new SyntaxError("Object contains forbidden prototype property")}delete ir.__proto__}for(const St in ir){const On=ir[St];if(On&&typeof On==="object"){rr.push(ir[St])}}}}};On.safeParse=function(St,rr){try{return On.parse(St,rr)}catch(St){return null}}},35522:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(43700);const ur=rr(66621);const pr=rr(69322);const fr={};St.exports=function(St,On,rr={}){ir(St&&typeof St==="object","Invalid defaults value: must be an object");ir(!On||On===true||typeof On==="object","Invalid source value: must be true, falsy or an object");ir(typeof rr==="object","Invalid options: must be an object");if(!On){return null}if(rr.shallow){return fr.applyToDefaultsWithShallow(St,On,rr)}const pr=cr(St);if(On===true){return pr}const br=rr.nullOverride!==undefined?rr.nullOverride:false;return ur(pr,On,{nullOverride:br,mergeArrays:false})};fr.applyToDefaultsWithShallow=function(St,On,rr){const br=rr.shallow;ir(Array.isArray(br),"Invalid keys");const Sr=new Map;const Er=On===true?null:new Set;for(let rr of br){rr=Array.isArray(rr)?rr:rr.split(".");const ir=pr(St,rr);if(ir&&typeof ir==="object"){Sr.set(ir,Er&&pr(On,rr)||ir)}else if(Er){Er.add(rr)}}const kr=cr(St,{},Sr);if(!Er){return kr}for(const St of Er){fr.reachCopy(kr,On,St)}const Pr=rr.nullOverride!==undefined?rr.nullOverride:false;return ur(kr,On,{nullOverride:Pr,mergeArrays:false})};fr.reachCopy=function(St,On,rr){for(const St of rr){if(!(St in On)){return}const rr=On[St];if(typeof rr!=="object"||rr===null){return}On=rr}const ir=On;let cr=St;for(let St=0;St<rr.length-1;++St){const On=rr[St];if(typeof cr[On]!=="object"){cr[On]={}}cr=cr[On]}cr[rr[rr.length-1]]=ir}},99583:(St,On,rr)=>{"use strict";const ir=rr(16443);const cr={};St.exports=function(St,...On){if(St){return}if(On.length===1&&On[0]instanceof Error){throw On[0]}throw new ir(On)}},43700:(St,On,rr)=>{"use strict";const ir=rr(69322);const cr=rr(99704);const ur=rr(87492);const pr={needsProtoHack:new Set([cr.set,cr.map,cr.weakSet,cr.weakMap])};St.exports=pr.clone=function(St,On={},rr=null){if(typeof St!=="object"||St===null){return St}let ir=pr.clone;let fr=rr;if(On.shallow){if(On.shallow!==true){return pr.cloneWithShallow(St,On)}ir=St=>St}else if(fr){const On=fr.get(St);if(On){return On}}else{fr=new Map}const br=cr.getInternalProto(St);if(br===cr.buffer){return Buffer&&Buffer.from(St)}if(br===cr.date){return new Date(St.getTime())}if(br===cr.regex){return new RegExp(St)}const Sr=pr.base(St,br,On);if(Sr===St){return St}if(fr){fr.set(St,Sr)}if(br===cr.set){for(const rr of St){Sr.add(ir(rr,On,fr))}}else if(br===cr.map){for(const[rr,cr]of St){Sr.set(rr,ir(cr,On,fr))}}const Er=ur.keys(St,On);for(const rr of Er){if(rr==="__proto__"){continue}if(br===cr.array&&rr==="length"){Sr.length=St.length;continue}const ur=Object.getOwnPropertyDescriptor(St,rr);if(ur){if(ur.get||ur.set){Object.defineProperty(Sr,rr,ur)}else if(ur.enumerable){Sr[rr]=ir(St[rr],On,fr)}else{Object.defineProperty(Sr,rr,{enumerable:false,writable:true,configurable:true,value:ir(St[rr],On,fr)})}}else{Object.defineProperty(Sr,rr,{enumerable:true,writable:true,configurable:true,value:ir(St[rr],On,fr)})}}return Sr};pr.cloneWithShallow=function(St,On){const rr=On.shallow;On=Object.assign({},On);On.shallow=false;const cr=new Map;for(const On of rr){const rr=ir(St,On);if(typeof rr==="object"||typeof rr==="function"){cr.set(rr,rr)}}return pr.clone(St,On,cr)};pr.base=function(St,On,rr){if(rr.prototype===false){if(pr.needsProtoHack.has(On)){return new On.constructor}return On===cr.array?[]:{}}const ir=Object.getPrototypeOf(St);if(ir&&ir.isImmutable){return St}if(On===cr.array){const St=[];if(ir!==On){Object.setPrototypeOf(St,ir)}return St}if(pr.needsProtoHack.has(On)){const St=new ir.constructor;if(ir!==On){Object.setPrototypeOf(St,ir)}return St}return Object.create(ir)}},35879:(St,On,rr)=>{"use strict";const ir=rr(99704);const cr={mismatched:null};St.exports=function(St,On,rr){rr=Object.assign({prototype:true},rr);return!!cr.isDeepEqual(St,On,rr,[])};cr.isDeepEqual=function(St,On,rr,ur){if(St===On){return St!==0||1/St===1/On}const pr=typeof St;if(pr!==typeof On){return false}if(St===null||On===null){return false}if(pr==="function"){if(!rr.deepFunction||St.toString()!==On.toString()){return false}}else if(pr!=="object"){return St!==St&&On!==On}const fr=cr.getSharedType(St,On,!!rr.prototype);switch(fr){case ir.buffer:return Buffer&&Buffer.prototype.equals.call(St,On);case ir.promise:return St===On;case ir.regex:return St.toString()===On.toString();case cr.mismatched:return false}for(let rr=ur.length-1;rr>=0;--rr){if(ur[rr].isSame(St,On)){return true}}ur.push(new cr.SeenEntry(St,On));try{return!!cr.isDeepEqualObj(fr,St,On,rr,ur)}finally{ur.pop()}};cr.getSharedType=function(St,On,rr){if(rr){if(Object.getPrototypeOf(St)!==Object.getPrototypeOf(On)){return cr.mismatched}return ir.getInternalProto(St)}const ur=ir.getInternalProto(St);if(ur!==ir.getInternalProto(On)){return cr.mismatched}return ur};cr.valueOf=function(St){const On=St.valueOf;if(On===undefined){return St}try{return On.call(St)}catch(St){return St}};cr.hasOwnEnumerableProperty=function(St,On){return Object.prototype.propertyIsEnumerable.call(St,On)};cr.isSetSimpleEqual=function(St,On){for(const rr of Set.prototype.values.call(St)){if(!Set.prototype.has.call(On,rr)){return false}}return true};cr.isDeepEqualObj=function(St,On,rr,ur,pr){const{isDeepEqual:fr,valueOf:br,hasOwnEnumerableProperty:Sr}=cr;const{keys:Er,getOwnPropertySymbols:kr}=Object;if(St===ir.array){if(ur.part){for(const St of On){for(const On of rr){if(fr(St,On,ur,pr)){return true}}}}else{if(On.length!==rr.length){return false}for(let St=0;St<On.length;++St){if(!fr(On[St],rr[St],ur,pr)){return false}}return true}}else if(St===ir.set){if(On.size!==rr.size){return false}if(!cr.isSetSimpleEqual(On,rr)){const St=new Set(Set.prototype.values.call(rr));for(const rr of Set.prototype.values.call(On)){if(St.delete(rr)){continue}let On=false;for(const ir of St){if(fr(rr,ir,ur,pr)){St.delete(ir);On=true;break}}if(!On){return false}}}}else if(St===ir.map){if(On.size!==rr.size){return false}for(const[St,ir]of Map.prototype.entries.call(On)){if(ir===undefined&&!Map.prototype.has.call(rr,St)){return false}if(!fr(ir,Map.prototype.get.call(rr,St),ur,pr)){return false}}}else if(St===ir.error){if(On.name!==rr.name||On.message!==rr.message){return false}}const Pr=br(On);const Ir=br(rr);if((On!==Pr||rr!==Ir)&&!fr(Pr,Ir,ur,pr)){return false}const Lr=Er(On);if(!ur.part&&Lr.length!==Er(rr).length&&!ur.skip){return false}let Br=0;for(const St of Lr){if(ur.skip&&ur.skip.includes(St)){if(rr[St]===undefined){++Br}continue}if(!Sr(rr,St)){return false}if(!fr(On[St],rr[St],ur,pr)){return false}}if(!ur.part&&Lr.length-Br!==Er(rr).length){return false}if(ur.symbols!==false){const St=kr(On);const ir=new Set(kr(rr));for(const cr of St){if(!ur.skip||!ur.skip.includes(cr)){if(Sr(On,cr)){if(!Sr(rr,cr)){return false}if(!fr(On[cr],rr[cr],ur,pr)){return false}}else if(Sr(rr,cr)){return false}}ir.delete(cr)}for(const St of ir){if(Sr(rr,St)){return false}}}return true};cr.SeenEntry=class{constructor(St,On){this.obj=St;this.ref=On}isSame(St,On){return this.obj===St&&this.ref===On}}},16443:(St,On,rr)=>{"use strict";const ir=rr(72912);const cr={};St.exports=class extends Error{constructor(St){const rr=St.filter((St=>St!=="")).map((St=>typeof St==="string"?St:St instanceof Error?St.message:ir(St)));super(rr.join(" ")||"Unknown error");if(typeof Error.captureStackTrace==="function"){Error.captureStackTrace(this,On.assert)}}}},57391:St=>{"use strict";const On={};St.exports=function(St){if(!St){return""}let rr="";for(let ir=0;ir<St.length;++ir){const cr=St.charCodeAt(ir);if(On.isSafe(cr)){rr+=St[ir]}else{rr+=On.escapeHtmlChar(cr)}}return rr};On.escapeHtmlChar=function(St){const rr=On.namedHtml.get(St);if(rr){return rr}if(St>=256){return"&#"+St+";"}const ir=St.toString(16).padStart(2,"0");return`&#x${ir};`};On.isSafe=function(St){return On.safeCharCodes.has(St)};On.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]);On.safeCharCodes=function(){const St=new Set;for(let On=32;On<123;++On){if(On>=97||On>=65&&On<=90||On>=48&&On<=57||On===32||On===46||On===44||On===45||On===58||On===95){St.add(On)}}return St}()},43935:St=>{"use strict";const On={};St.exports=function(St){return St.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},85363:St=>{"use strict";const On={};St.exports=function(){}},66621:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(43700);const ur=rr(87492);const pr={};St.exports=pr.merge=function(St,On,rr){ir(St&&typeof St==="object","Invalid target value: must be an object");ir(On===null||On===undefined||typeof On==="object","Invalid source value: must be null, undefined, or an object");if(!On){return St}rr=Object.assign({nullOverride:true,mergeArrays:true},rr);if(Array.isArray(On)){ir(Array.isArray(St),"Cannot merge array onto an object");if(!rr.mergeArrays){St.length=0}for(let ir=0;ir<On.length;++ir){St.push(cr(On[ir],{symbols:rr.symbols}))}return St}const fr=ur.keys(On,rr);for(let ir=0;ir<fr.length;++ir){const ur=fr[ir];if(ur==="__proto__"||!Object.prototype.propertyIsEnumerable.call(On,ur)){continue}const br=On[ur];if(br&&typeof br==="object"){if(St[ur]===br){continue}if(!St[ur]||typeof St[ur]!=="object"||Array.isArray(St[ur])!==Array.isArray(br)||br instanceof Date||Buffer&&Buffer.isBuffer(br)||br instanceof RegExp){St[ur]=cr(br,{symbols:rr.symbols})}else{pr.merge(St[ur],br,rr)}}else{if(br!==null&&br!==undefined){St[ur]=br}else if(rr.nullOverride){St[ur]=br}}}return St}},69322:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr={};St.exports=function(St,On,rr){if(On===false||On===null||On===undefined){return St}rr=rr||{};if(typeof rr==="string"){rr={separator:rr}}const ur=Array.isArray(On);ir(!ur||!rr.separator,"Separator option is not valid for array-based chain");const pr=ur?On:On.split(rr.separator||".");let fr=St;for(let St=0;St<pr.length;++St){let ur=pr[St];const br=rr.iterables&&cr.iterables(fr);if(Array.isArray(fr)||br==="set"){const St=Number(ur);if(Number.isInteger(St)){ur=St<0?fr.length+St:St}}if(!fr||typeof fr==="function"&&rr.functions===false||!br&&fr[ur]===undefined){ir(!rr.strict||St+1===pr.length,"Missing segment",ur,"in reach path ",On);ir(typeof fr==="object"||rr.functions===true||typeof fr!=="function","Invalid segment",ur,"in reach path ",On);fr=rr.default;break}if(!br){fr=fr[ur]}else if(br==="set"){fr=[...fr][ur]}else{fr=fr.get(ur)}}return fr};cr.iterables=function(St){if(St instanceof Set){return"set"}if(St instanceof Map){return"map"}}},72912:St=>{"use strict";const On={};St.exports=function(...St){try{return JSON.stringify(...St)}catch(St){return"[Cannot display object: "+St.message+"]"}}},99704:(St,On)=>{"use strict";const rr={};On=St.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};rr.typeMap=new Map([["[object Error]",On.error],["[object Map]",On.map],["[object Promise]",On.promise],["[object Set]",On.set],["[object WeakMap]",On.weakMap],["[object WeakSet]",On.weakSet]]);On.getInternalProto=function(St){if(Array.isArray(St)){return On.array}if(Buffer&&St instanceof Buffer){return On.buffer}if(St instanceof Date){return On.date}if(St instanceof RegExp){return On.regex}if(St instanceof Error){return On.error}const ir=Object.prototype.toString.call(St);return rr.typeMap.get(ir)||On.generic}},87492:(St,On)=>{"use strict";const rr={};On.keys=function(St,On={}){return On.symbols!==false?Reflect.ownKeys(St):Object.getOwnPropertyNames(St)}},75663:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr={};On.Sorter=class{constructor(){this._items=[];this.nodes=[]}add(St,On){On=On||{};const rr=[].concat(On.before||[]);const cr=[].concat(On.after||[]);const ur=On.group||"?";const pr=On.sort||0;ir(!rr.includes(ur),`Item cannot come before itself: ${ur}`);ir(!rr.includes("?"),"Item cannot come before unassociated items");ir(!cr.includes(ur),`Item cannot come after itself: ${ur}`);ir(!cr.includes("?"),"Item cannot come after unassociated items");if(!Array.isArray(St)){St=[St]}for(const On of St){const St={seq:this._items.length,sort:pr,before:rr,after:cr,group:ur,node:On};this._items.push(St)}if(!On.manual){const St=this._sort();ir(St,"item",ur!=="?"?`added into group ${ur}`:"","created a dependencies error")}return this.nodes}merge(St){if(!Array.isArray(St)){St=[St]}for(const On of St){if(On){for(const St of On._items){this._items.push(Object.assign({},St))}}}this._items.sort(cr.mergeSort);for(let St=0;St<this._items.length;++St){this._items[St].seq=St}const On=this._sort();ir(On,"merge created a dependencies error");return this.nodes}sort(){const St=this._sort();ir(St,"sort created a dependencies error");return this.nodes}_sort(){const St={};const On=Object.create(null);const rr=Object.create(null);for(const ir of this._items){const cr=ir.seq;const ur=ir.group;rr[ur]=rr[ur]||[];rr[ur].push(cr);St[cr]=ir.before;for(const St of ir.after){On[St]=On[St]||[];On[St].push(cr)}}for(const On in St){const ir=[];for(const cr in St[On]){const ur=St[On][cr];rr[ur]=rr[ur]||[];ir.push(...rr[ur])}St[On]=ir}for(const ir in On){if(rr[ir]){for(const cr of rr[ir]){St[cr].push(...On[ir])}}}const ir={};for(const On in St){const rr=St[On];for(const St of rr){ir[St]=ir[St]||[];ir[St].push(On)}}const cr={};const ur=[];for(let St=0;St<this._items.length;++St){let On=St;if(ir[St]){On=null;for(let St=0;St<this._items.length;++St){if(cr[St]===true){continue}if(!ir[St]){ir[St]=[]}const rr=ir[St].length;let ur=0;for(let On=0;On<rr;++On){if(cr[ir[St][On]]){++ur}}if(ur===rr){On=St;break}}}if(On!==null){cr[On]=true;ur.push(On)}}if(ur.length!==this._items.length){return false}const pr={};for(const St of this._items){pr[St.seq]=St}this._items=[];this.nodes=[];for(const St of ur){const On=pr[St];this.nodes.push(On.node);this._items.push(On)}return true}};cr.mergeSort=(St,On)=>St.sort===On.sort?0:St.sort<On.sort?-1:1},3563:(St,On,rr)=>{const{parse:ir,format:cr}=rr(87016);const{pathToRegexp:ur,compile:pr,parse:fr}=rr(44985);St.exports=Layer;function Layer(St,On,rr,ir={}){this.opts=ir;this.name=this.opts.name||null;this.methods=[];this.paramNames=[];this.stack=Array.isArray(rr)?rr:[rr];for(const St of On){const On=this.methods.push(St.toUpperCase());if(this.methods[On-1]==="GET")this.methods.unshift("HEAD")}for(let rr=0;rr<this.stack.length;rr++){const ir=this.stack[rr];const cr=typeof ir;if(cr!=="function")throw new Error(`${On.toString()} \`${this.opts.name||St}\`: \`middleware\` must be a function, not \`${cr}\``)}this.path=St;this.regexp=ur(St,this.paramNames,this.opts)}Layer.prototype.match=function(St){return this.regexp.test(St)};Layer.prototype.params=function(St,On,rr={}){for(let St=On.length,ir=0;ir<St;ir++){if(this.paramNames[ir]){const St=On[ir];if(St&&St.length>0)rr[this.paramNames[ir].name]=St?safeDecodeURIComponent(St):St}}return rr};Layer.prototype.captures=function(St){return this.opts.ignoreCaptures?[]:St.match(this.regexp).slice(1)};Layer.prototype.url=function(St,On){let rr=St;const ur=this.path.replace(/\(\.\*\)/g,"");if(typeof St!=="object"){rr=Array.prototype.slice.call(arguments);if(typeof rr[rr.length-1]==="object"){On=rr[rr.length-1];rr=rr.slice(0,-1)}}const br=pr(ur,{encode:encodeURIComponent,...On});let Sr;const Er=fr(ur);let kr={};if(Array.isArray(rr)){for(let St=Er.length,On=0,ir=0;On<St;On++){if(Er[On].name)kr[Er[On].name]=rr[ir++]}}else if(Er.some((St=>St.name))){kr=St}else if(!On){On=St}Sr=br(kr);if(On&&On.query){Sr=ir(Sr);if(typeof On.query==="string"){Sr.search=On.query}else{Sr.search=undefined;Sr.query=On.query}return cr(Sr)}return Sr};Layer.prototype.param=function(St,On){const{stack:rr}=this;const ir=this.paramNames;const middleware=function(rr,ir){return On.call(this,rr.params[St],rr,ir)};middleware.param=St;const cr=ir.map((function(St){return St.name}));const ur=cr.indexOf(St);if(ur>-1){rr.some((function(St,On){if(!St.param||cr.indexOf(St.param)>ur){rr.splice(On,0,middleware);return true}}))}return this};Layer.prototype.setPrefix=function(St){if(this.path){this.path=this.path!=="/"||this.opts.strict===true?`${St}${this.path}`:St;this.paramNames=[];this.regexp=ur(this.path,this.paramNames,this.opts)}return this};function safeDecodeURIComponent(St){try{return decodeURIComponent(St)}catch{return St}}},53777:(St,On,rr)=>{const ir=rr(77246);const cr=rr(58024);const ur=rr(93);const{pathToRegexp:pr}=rr(44985);const fr=rr(3563);const br=rr(26675)("koa-router");St.exports=Router;function Router(St={}){if(!(this instanceof Router))return new Router(St);this.opts=St;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 Sr of ur){function setMethodVerb(St){Router.prototype[St]=function(On,rr,ir){if(typeof rr==="string"||rr instanceof RegExp){ir=Array.prototype.slice.call(arguments,2)}else{ir=Array.prototype.slice.call(arguments,1);rr=On;On=null}if(typeof rr!=="string"&&!(rr instanceof RegExp)&&(!Array.isArray(rr)||rr.length===0))throw new Error(`You have to provide a path when adding a ${St} handler`);this.register(rr,[St],ir,{name:On});return this}}setMethodVerb(Sr)}Router.prototype.del=Router.prototype["delete"];Router.prototype.use=function(){const St=this;const On=Array.prototype.slice.call(arguments);let rr;if(Array.isArray(On[0])&&typeof On[0][0]==="string"){const cr=On[0];for(const ur of cr){St.use.apply(St,[ur].concat(On.slice(1)))}return this}const ir=typeof On[0]==="string";if(ir)rr=On.shift();for(const br of On){if(br.router){const Sr=Object.assign(Object.create(Router.prototype),br.router,{stack:[...br.router.stack]});for(let Er=0;Er<Sr.stack.length;Er++){const kr=Sr.stack[Er];const Pr=Object.assign(Object.create(fr.prototype),kr);if(rr)Pr.setPrefix(rr);if(St.opts.prefix)Pr.setPrefix(St.opts.prefix);St.stack.push(Pr);Sr.stack[Er]=Pr}if(St.params){function setRouterParams(On){const rr=On;for(const On of rr){Sr.param(On,St.params[On])}}setRouterParams(Object.keys(St.params))}}else{const Ir=[];pr(St.opts.prefix||"",Ir);const Lr=St.opts.prefix&&Ir.length;St.register(rr||"([^/]*)",[],br,{end:false,ignoreCaptures:!ir&&!Lr})}}return this};Router.prototype.prefix=function(St){St=St.replace(/\/$/,"");this.opts.prefix=St;for(let On=0;On<this.stack.length;On++){const rr=this.stack[On];rr.setPrefix(St)}return this};Router.prototype.routes=Router.prototype.middleware=function(){const St=this;const On=function dispatch(On,rr){br("%s %s",On.method,On.path);const cr=St.matchHost(On.host);if(!cr){return rr()}const ur=St.opts.routerPath||On.newRouterPath||On.path||On.routerPath;const pr=St.match(ur,On.method);let fr;if(On.matched){On.matched.push.apply(On.matched,pr.path)}else{On.matched=pr.path}On.router=St;if(!pr.route)return rr();const Sr=pr.pathAndMethod;const Er=Sr[Sr.length-1];On._matchedRoute=Er.path;if(Er.name){On._matchedRouteName=Er.name}fr=(St.exclusive?[Er]:Sr).reduce((function(St,On){St.push((function(St,rr){St.captures=On.captures(ur,St.captures);St.params=St.request.params=On.params(ur,St.captures,St.params);St.routerPath=On.path;St.routerName=On.name;St._matchedRoute=On.path;if(On.name){St._matchedRouteName=On.name}return rr()}));return St.concat(On.stack)}),[]);return ir(fr)(On,rr)};On.router=this;return On};Router.prototype.allowedMethods=function(St={}){const On=this.methods;return function allowedMethods(rr,ir){return ir().then((function(){const ir={};if(!rr.status||rr.status===404){for(let St=0;St<rr.matched.length;St++){const On=rr.matched[St];for(let St=0;St<On.methods.length;St++){const rr=On.methods[St];ir[rr]=rr}}const ur=Object.keys(ir);if(!~On.indexOf(rr.method)){if(St.throw){const On=typeof St.notImplemented==="function"?St.notImplemented():new cr.NotImplemented;throw On}else{rr.status=501;rr.set("Allow",ur.join(", "))}}else if(ur.length>0){if(rr.method==="OPTIONS"){rr.status=200;rr.body="";rr.set("Allow",ur.join(", "))}else if(!ir[rr.method]){if(St.throw){const On=typeof St.methodNotAllowed==="function"?St.methodNotAllowed():new cr.MethodNotAllowed;throw On}else{rr.status=405;rr.set("Allow",ur.join(", "))}}}}}))}};Router.prototype.all=function(St,On,rr){if(typeof On==="string"){rr=Array.prototype.slice.call(arguments,2)}else{rr=Array.prototype.slice.call(arguments,1);On=St;St=null}if(typeof On!=="string"&&!(On instanceof RegExp)&&(!Array.isArray(On)||On.length===0))throw new Error("You have to provide a path when adding an all handler");this.register(On,ur,rr,{name:St});return this};Router.prototype.redirect=function(St,On,rr){if(typeof St==="symbol"||St[0]!=="/"){St=this.url(St);if(St instanceof Error)throw St}if(typeof On==="symbol"||On[0]!=="/"&&!On.includes("://")){On=this.url(On);if(On instanceof Error)throw On}return this.all(St,(St=>{St.redirect(On);St.status=rr||301}))};Router.prototype.register=function(St,On,rr,ir={}){const cr=this;const{stack:ur}=this;if(Array.isArray(St)){for(const ur of St){cr.register.call(cr,ur,On,rr,ir)}return this}const pr=new fr(St,On,rr,{end:ir.end===false?ir.end:true,name:ir.name,sensitive:ir.sensitive||this.opts.sensitive||false,strict:ir.strict||this.opts.strict||false,prefix:ir.prefix||this.opts.prefix||"",ignoreCaptures:ir.ignoreCaptures});if(this.opts.prefix){pr.setPrefix(this.opts.prefix)}for(let St=0;St<Object.keys(this.params).length;St++){const On=Object.keys(this.params)[St];pr.param(On,this.params[On])}ur.push(pr);br("defined route %s %s",pr.methods,pr.path);return pr};Router.prototype.route=function(St){const On=this.stack;for(let rr=On.length,ir=0;ir<rr;ir++){if(On[ir].name&&On[ir].name===St)return On[ir]}return false};Router.prototype.url=function(St,On){const rr=this.route(St);if(rr){const St=Array.prototype.slice.call(arguments,1);return rr.url.apply(rr,St)}return new Error(`No route found for name: ${String(St)}`)};Router.prototype.match=function(St,On){const rr=this.stack;let ir;const cr={path:[],pathAndMethod:[],route:false};for(let ur=rr.length,pr=0;pr<ur;pr++){ir=rr[pr];br("test %s %s",ir.path,ir.regexp);if(ir.match(St)){cr.path.push(ir);if(ir.methods.length===0||~ir.methods.indexOf(On)){cr.pathAndMethod.push(ir);if(ir.methods.length>0)cr.route=true}}}return cr};Router.prototype.matchHost=function(St){const{host:On}=this;if(!On){return true}if(!St){return false}if(typeof On==="string"){return St===On}if(typeof On==="object"&&On instanceof RegExp){return On.test(St)}};Router.prototype.param=function(St,On){this.params[St]=On;for(let rr=0;rr<this.stack.length;rr++){const ir=this.stack[rr];ir.param(St,On)}return this};Router.url=function(St){const On=Array.prototype.slice.call(arguments,1);return fr.prototype.url.apply({path:St},On)}},86979:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AsyncHooksContextManager=void 0;const ir=rr(46123);const cr=rr(90290);class AsyncHooksContextManager{constructor(){this._contexts=new Map;this._stack=[];this._asyncHook=cr.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 St;return(St=this._stack[this._stack.length-1])!==null&&St!==void 0?St:ir.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){this._enterContext(St);try{return On.call(rr,...ir)}finally{this._exitContext()}}enable(){this._asyncHook.enable();return this}disable(){this._asyncHook.disable();this._contexts.clear();this._stack=[];return this}_init(St,On){if(On==="TIMERWRAP")return;const rr=this._stack[this._stack.length-1];if(rr!==undefined){this._contexts.set(St,rr)}}_destroy(St){this._contexts.delete(St)}_before(St){const On=this._contexts.get(St);if(On!==undefined){this._enterContext(On)}}_after(){this._exitContext()}_enterContext(St){this._stack.push(St)}_exitContext(){this._stack.pop()}bind(St,On){if(typeof On==="function"){const rr=this;const contextWrapper=function(...ir){return rr.with(St,(()=>On.apply(this,ir)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:On.length});return contextWrapper}return On}}On.AsyncHooksContextManager=AsyncHooksContextManager},63259:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AsyncLocalStorageContextManager=void 0;const ir=rr(46123);const cr=rr(90290);class AsyncLocalStorageContextManager{constructor(){this._asyncLocalStorage=new cr.AsyncLocalStorage}active(){var St;return(St=this._asyncLocalStorage.getStore())!==null&&St!==void 0?St:ir.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){const cr=rr==null?On:On.bind(rr);return this._asyncLocalStorage.run(St,cr,...ir)}enable(){return this}disable(){this._asyncLocalStorage.disable();return this}bind(St,On){if(typeof On==="function"){const rr=this;const contextWrapper=function(...ir){return rr.with(St,(()=>On.apply(this,ir)))};Object.defineProperty(contextWrapper,"length",{enumerable:false,configurable:true,writable:false,value:On.length});return contextWrapper}return On}}On.AsyncLocalStorageContextManager=AsyncLocalStorageContextManager},44101:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.createContextManager=On.isSemverGreaterThanOrEqualTo=void 0;cr(rr(86979),On);cr(rr(63259),On);var ur=rr(43349);Object.defineProperty(On,"isSemverGreaterThanOrEqualTo",{enumerable:true,get:function(){return ur.isSemverGreaterThanOrEqualTo}});Object.defineProperty(On,"createContextManager",{enumerable:true,get:function(){return ur.createContextManager}})},43349:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createContextManager=On.isSemverGreaterThanOrEqualTo=void 0;const ir=rr(63259);const cr=rr(86979);const ur=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z-]+(?:\.[\da-z-]+)*))?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i;function isSemverGreaterThanOrEqualTo(St,On){const rr=ur.exec(St);const ir=ur.exec(On);if(rr&&ir){if(rr[1]===ir[1]&&rr[2]===ir[2]&&rr[3]===ir[3]&&rr[4]===ir[4]){return true}return gteString(rr[1],ir[1])||rr[1]===ir[1]&&gteString(rr[2],ir[2])||rr[1]===ir[1]&&rr[2]===ir[2]&&gteString(rr[3],ir[3])||rr[1]===ir[1]&&rr[2]===ir[2]&&rr[3]===ir[3]&&gteString(rr[4],ir[4])}return false}On.isSemverGreaterThanOrEqualTo=isSemverGreaterThanOrEqualTo;function gteString(St,On){const rr=parseInt(St,10);const ir=parseInt(On,10);return rr>ir}function createContextManager(){const St=isSemverGreaterThanOrEqualTo(process.version,"14.8.0")?ir.AsyncLocalStorageContextManager:cr.AsyncHooksContextManager;return new St}On.createContextManager=createContextManager},26733:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Bootstrap=On.BootstrapStarter=void 0;const ir=rr(46123);const cr=rr(16928);const ur=rr(51169);const pr=rr(44101);const fr=rr(5982);const br=rr(92364);class BootstrapStarter{constructor(){this.globalOptions={}}configure(St={}){this.globalOptions=St;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 fr.ChildProcessEventBus({isWorker:true})}else if(process.env["MIDWAY_FORK_MODE"]==="thread"){this.eventBus=new fr.ThreadEventBus({isWorker:true})}}if(!this.globalOptions.moduleLoadType){const St=await(0,ir.loadModule)((0,cr.join)(this.appDir,"package.json"),{safeLoad:true,enableCache:false});this.globalOptions.moduleLoadType=(St===null||St===void 0?void 0:St.type)==="module"?"esm":"commonjs"}this.applicationContext=await(0,ir.initializeGlobalApplicationContext)({asyncContextManager:(0,pr.createContextManager)(),loggerFactory:ur.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 St=this.applicationContext.get(ir.MidwayApplicationManager);const On=St.getApplication("socketIO");(0,br.setupWorker)(On)}}const St=this.applicationContext.get(ir.MidwayFrameworkService);if(!St.getMainApp()){throw new ir.MidwayMainFrameworkMissingError}}async stop(){if(this.applicationContext){await(0,ir.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,ir.isTypeScriptEnvironment)()){return(0,cr.join)(this.appDir,"src")}else{return(0,cr.join)(this.appDir,"dist")}}}On.BootstrapStarter=BootstrapStarter;class Bootstrap{static configure(St={}){this.configured=true;if(!this.logger&&!St.logger){this.logger=this.bootstrapLoggerFactory.createLogger("bootstrap",{enableError:false,enableFile:false,enableConsole:true});if(St.logger===false){if(this.logger["disableConsole"]){this.logger["disableConsole"]()}else{this.logger["level"]="none"}}St.logger=this.logger}else{this.logger=this.logger||St.logger}if(St.appDir&&St.appDir!==process.cwd()){process.chdir(St.appDir)}this.getStarter().configure(St);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((St=>{this.logger.error(St);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(St){this.logger.info("[midway:bootstrap] receive signal %s, closing",St);try{await this.stop();this.logger.info("[midway:bootstrap] close done, exiting with code:0");process.exit(0)}catch(St){this.logger.error("[midway:bootstrap] close with error: ",St);process.exit(1)}}static onExit(St){this.logger.info("[midway:bootstrap] exit with code:%s",St)}static uncaughtExceptionHandler(St){if(!(St instanceof Error)){St=new Error(String(St))}if(St.name==="Error"){St.name="unhandledExceptionError"}this.logger.error(St)}static unhandledRejectionHandler(St){if(!(St instanceof Error)){const On=new Error(String(St));if(St){if(St.name)On.name=St.name;if(St.message)On.message=St.message;if(St.stack)On.stack=St.stack}St=On}if(St.name==="Error"){St.name="unhandledRejectionError"}this.logger.error(St)}static getApplicationContext(){return this.getStarter().getApplicationContext()}}On.Bootstrap=Bootstrap;Bootstrap.configured=false;Bootstrap.bootstrapLoggerFactory=new ur.MidwayLoggerContainer},84575:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.setupStickyMaster=On.AbstractForkManager=On.ClusterManager=On.BootstrapStarter=On.Bootstrap=void 0;cr(rr(82516),On);var ur=rr(26733);Object.defineProperty(On,"Bootstrap",{enumerable:true,get:function(){return ur.Bootstrap}});Object.defineProperty(On,"BootstrapStarter",{enumerable:true,get:function(){return ur.BootstrapStarter}});var pr=rr(93772);Object.defineProperty(On,"ClusterManager",{enumerable:true,get:function(){return pr.ClusterManager}});var fr=rr(84338);Object.defineProperty(On,"AbstractForkManager",{enumerable:true,get:function(){return fr.AbstractForkManager}});var br=rr(92364);Object.defineProperty(On,"setupStickyMaster",{enumerable:true,get:function(){return br.setupStickyMaster}})},82516:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},84338:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AbstractForkManager=void 0;const ir=rr(70857);const cr=rr(39023);const ur=rr(53599);const pr=rr(24434);const fr=rr(39023);const br=(0,fr.debuglog)("midway:bootstrap");class AbstractForkManager{constructor(St){this.options=St;this.reforks=[];this.disconnectCount=0;this.unexpectedCount=0;this.disconnects={};this.hub=new pr.EventEmitter;this.workers=new Map;this.isClosing=false;St.count=St.count||ir.cpus().length-1;St.refork=St.refork!==false;St.limit=St.limit||60;St.duration=St.duration||6e4;St.logger=St.logger||console;St.workerInitTimeout=St.workerInitTimeout||3e4;this.eventBus=this.createEventBus({initTimeout:St.workerInitTimeout})}async start(){br("Start manager with options: %j",this.options);this.bindWorkerDisconnect((St=>{br(" - worker(%s): trigger event = disconnect",this.getWorkerId(St));const On=this.options.logger[St["disableRefork"]?"info":"error"];this.disconnectCount++;const rr=this.isWorkerDead(St);if(rr){br(" - worker(%s): worker is dead",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork, because worker:%s exit event emit before disconnect",(0,ur.logDate)(),process.pid,this.getWorkerId(St));return}if(St["disableRefork"]){br(" - worker(%s): worker is disableRefork(maybe terminated by master)",this.getWorkerId(St));On("[%s] [bootstrap:master:%s] don't fork, because worker:%s will be kill soon",(0,ur.logDate)(),process.pid,this.getWorkerId(St));return}this.disconnects[this.getWorkerId(St)]=(0,ur.logDate)();this.tryToRefork(St)}));this.bindWorkerExit(((St,On,rr)=>{br(" - worker(%s): trigger event = exit",this.getWorkerId(St));this.workers.delete(this.getWorkerId(St));if(St["disableRefork"]){return}const ir=!!this.disconnects[this.getWorkerId(St)];br(" - worker(%s): isExpected=%s",this.getWorkerId(St),ir);if(ir){delete this.disconnects[this.getWorkerId(St)];return}br(" - worker(%s): isWorkerDead=%s",this.getWorkerId(St),this.isWorkerDead(St));if(this.isWorkerDead(St)){return}br(" - worker(%s): unexpectedCount will add");this.unexpectedCount++;this.tryToRefork(St);this.onUnexpected(St,On,rr)}));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 St=0;St<this.options.count;St++){const St=this.createWorker();br(" - worker(%s) created",this.getWorkerId(St));this.eventBus.addWorker(St);this.workers.set(this.getWorkerId(St),St)}await this.eventBus.start()}tryToRefork(St){if(this.allowRefork()){br(" - worker(%s): allow refork and will fork new",this.getWorkerId(St));const On=this.createWorker(St);this.workers.set(this.getWorkerId(On),On);this.options.logger.info("[%s] [bootstrap:master:%s] new worker:%s fork (state: %s)",(0,ur.logDate)(),process.pid,this.getWorkerId(On),On["state"]);this.eventBus.addWorker(On)}else{br(" - worker(%s): forbidden refork and will stop",this.getWorkerId(St));this.options.logger.info("[%s] [bootstrap:master:%s] don't fork new work (refork: %s)",(0,ur.logDate)(),process.pid,this.options.refork)}}allowRefork(){if(!this.options.refork||this.isClosing){return false}const St=this.reforks.push(Date.now());if(St>this.options.limit){this.reforks.shift()}const On=this.reforks[this.reforks.length-1]-this.reforks[0];const rr=this.reforks.length<this.options.limit||On>this.options.duration;if(!rr){this.hub.emit("reachReforkLimit")}return rr}onerror(St){if(!St){return}this.options.logger.error("[%s] [bootstrap:master:%s] master uncaughtException: %s",(0,ur.logDate)(),process.pid,St.stack);this.options.logger.error(St);this.options.logger.error("(total %d disconnect, %d unexpected exit)",this.disconnectCount,this.unexpectedCount)}onUnexpected(St,On,rr){const ir=St.hasOwnProperty("exitedAfterDisconnect")?"exitedAfterDisconnect":"suicide";const pr=new Error(cr.format("worker:%s died unexpected (code: %s, signal: %s, %s: %s, state: %s)",this.getWorkerId(St),On,rr,ir,St[ir],St["state"]));pr.name="WorkerDiedUnexpectedError";this.options.logger.error("[%s] [bootstrap:master:%s] (total %d disconnect, %d unexpected exit) %s",(0,ur.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount,pr.stack)}onReachReforkLimit(){this.options.logger.error("[%s] [bootstrap:master:%s] worker died too fast (total %d disconnect, %d unexpected exit)",(0,ur.logDate)(),process.pid,this.disconnectCount,this.unexpectedCount)}async killWorker(St,On){await this.closeWorker(St);await Promise.race([(0,pr.once)(St,"exit"),(0,ur.sleep)(On)]);if(St.killed)return;(St.process||St).kill("SIGKILL")}async stop(St=2e3){br("run close");this.isClosing=true;await this.eventBus.stop();for(const On of this.workers.values()){On["disableRefork"]=true;await this.killWorker(On,St)}if(this.exitListener){await this.exitListener()}}hasWorker(St){return this.workers.has(St)}getWorker(St){return this.workers.get(St)}getWorkerIds(){return Array.from(this.workers.keys())}onStop(St){this.exitListener=St}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(St){if(!this.isClosing){this.options.logger.info("[bootstrap:master] receive signal %s, closing",St);try{await this.stop();this.options.logger.info("[bootstrap:master] close done, exiting with code:0");process.exit(0)}catch(St){this.options.logger.error("[midway:master] close with error: ",St);process.exit(1)}}}onMasterExit(St){this.options.logger.info("[bootstrap:master] exit with code:%s",St)}}On.AbstractForkManager=AbstractForkManager},93772:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ClusterManager=void 0;const ir=rr(5982);const cr=rr(84338);const ur=rr(29907);const pr=rr(39023);const fr=rr(46123);const br=(0,pr.debuglog)("midway:bootstrap");class ClusterManager extends cr.AbstractForkManager{constructor(St={}){super(St);this.options=St;St.args=St.args||[];St.execArgv=St.execArgv||[];if((0,fr.isTypeScriptEnvironment)()){St.execArgv.push(...["--require","ts-node/register"])}}createWorker(){if(ur["setupPrimary"]){ur["setupPrimary"](this.options)}else if(ur["setupMaster"]){ur["setupMaster"](this.options)}return ur.fork({MIDWAY_FORK_MODE:"cluster",MIDWAY_STICKY_MODE:this.options.sticky?"true":"false",...this.options.env})}bindWorkerDisconnect(St){br("Bind cluster.disconnect event");ur.on("disconnect",St)}bindWorkerExit(St){br("Bind cluster.exit event");ur.on("exit",St)}getWorkerId(St){return String(St.process.pid)}isWorkerDead(St){return St.isDead()}closeWorker(St){St.kill("SIGTERM")}createEventBus(St){return new ir.ChildProcessEventBus(St)}isPrimary(){return!ur.isWorker}}On.ClusterManager=ClusterManager},92364:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.setupWorker=On.setupStickyMaster=void 0;const ir=rr(29907);const cr=rr(76982);const randomId=()=>(0,cr.randomBytes)(8).toString("hex");function setupStickyMaster(St,On={}){const rr={loadBalancingMethod:"least-connection",...On};const cr=new Map;const ur=/sid=([\w-]{20})/;let pr=0;const computeWorkerId=St=>{const On=ur.exec(St);if(On){const St=On[1];const rr=cr.get(St);if(rr&&ir.workers[rr]){return rr}}switch(rr.loadBalancingMethod){case"random":{const St=Object.keys(ir.workers);return St[Math.floor(Math.random()*St.length)]}case"round-robin":{const St=Object.keys(ir.workers);pr++;if(pr>=St.length){pr=0}return St[pr]}case"least-connection":let St;for(const On in ir.workers){const rr=ir.workers[On];if(St===undefined){St=rr}else{const On=rr["clientsCount"]||0;const ir=St["clientsCount"]||0;if(On<ir){St=rr}}}return St.id}};St.on("connection",(St=>{let On,rr;const sendCallback=On=>{if(On){St.destroy()}};St.on("data",(cr=>{let ur="utf-8";let pr=cr.toString(ur);if(On&&rr){ir.workers[On].send({type:"sticky:http-chunk",data:pr,encoding:ur,connectionId:rr},sendCallback);return}On=computeWorkerId(pr);const fr=!(pr.startsWith("GET")||pr.substring(0,pr.indexOf("\r\n\r\n")).includes("pgrade: websocket"));if(pr.startsWith("POST")&&pr.includes("multipart/form-data")){ur="base64";pr=cr.toString("base64")}St.pause();if(fr){rr=randomId()}ir.workers[On].send({type:"sticky:connection",data:pr,encoding:ur,connectionId:rr},St,{keepOpen:fr},sendCallback)}))}));St.on("request",(St=>{St.on("data",(()=>{}))}));ir.on("message",((St,{type:On,data:ir})=>{switch(On){case"sticky:connection":cr.set(ir,St.id);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]=(St["clientsCount"]||0)+1}break;case"sticky:disconnection":cr.delete(ir);if(rr.loadBalancingMethod==="least-connection"){St["clientsCount"]--}break}}))}On.setupStickyMaster=setupStickyMaster;function setupWorker(St){const On=new Map;process.on("message",(({type:rr,data:ir,encoding:cr,connectionId:ur},pr)=>{switch(rr){case"sticky:connection":if(!pr){return}St.httpServer.emit("connection",pr);pr.emit("data",Buffer.from(ir,cr));pr.resume();if(ur){On.set(ur,pr);pr.on("close",(()=>{On.delete(ur)}))}break;case"sticky:http-chunk":{const St=On.get(ur);if(St){St.emit("data",Buffer.from(ir,cr))}}}}));const ignoreError=()=>{};St.engine.on("connection",(St=>{process.send({type:"sticky:connection",data:St.id},ignoreError);St.once("close",(()=>{process.send({type:"sticky:disconnection",data:St.id},ignoreError)}))}))}On.setupWorker=setupWorker},53599:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.sleep=On.logDate=void 0;function logDate(){const St=new Date;let On=St.getDate();if(On<10){On="0"+On}let rr=St.getMonth()+1;if(rr<10){rr="0"+rr}let ir=St.getHours();if(ir<10){ir="0"+ir}let cr=St.getMinutes();if(cr<10){cr="0"+cr}let ur=St.getSeconds();if(ur<10){ur="0"+ur}let pr=St.getMilliseconds();if(pr<10){pr="00"+pr}else if(pr<100){pr="0"+pr}return St.getFullYear()+"-"+rr+"-"+On+" "+ir+":"+cr+":"+ur+"."+pr}On.logDate=logDate;async function sleep(St){return new Promise((On=>{setTimeout(On,St)}))}On.sleep=sleep},64080:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.multiCaching=On.createCache=On.caching=void 0;const ir=rr(48851);const cr=rr(87932);async function caching(St,On){if(St==="memory"){const St=(0,cr.memoryStore)(On);return createCache(St,On)}if(typeof St==="function"){const rr=await St(On);return createCache(rr,On)}return createCache(St,On)}On.caching=caching;function createCache(St,On){return{wrap:async(rr,cr,ur)=>(0,ir.coalesceAsync)(rr,(async()=>{const pr=await St.get(rr);if(pr===undefined){const On=await cr();const ir=typeof ur==="function"?ur(On):ur;await St.set(rr,On,ir);return On}else if(On===null||On===void 0?void 0:On.refreshThreshold){const fr=typeof ur==="function"?ur(pr):ur;const br=await St.ttl(rr);if(br!==-1&&br<On.refreshThreshold){(0,ir.coalesceAsync)(`+++${rr}`,cr).then((On=>St.set(rr,On,fr)))}}return pr})),store:St,del:On=>St.del(On),get:On=>St.get(On),set:(On,rr,ir)=>St.set(On,rr,ir),reset:()=>St.reset(),methodWrap:async(rr,cr,ur,pr)=>(0,ir.coalesceAsync)(rr,(async()=>{const fr=await St.get(rr);if(fr===undefined){const On=await cr(...ur);const ir=typeof pr==="function"?pr(On):pr;await St.set(rr,On,ir);return On}else if(On===null||On===void 0?void 0:On.refreshThreshold){const br=typeof pr==="function"?pr(fr):pr;const Sr=await St.ttl(rr);if(Sr!==-1&&Sr<On.refreshThreshold){(0,ir.coalesceAsync)(`+++${rr}`,(()=>cr(...ur))).then((On=>St.set(rr,On,br)))}}return fr}))}}On.createCache=createCache;function multiCaching(St){const get=async On=>{for(const rr of St){try{const St=await rr.get(On);if(St!==undefined)return St}catch(St){}}};const set=async(On,rr,ir)=>{await Promise.all(St.map((St=>St.set(On,rr,ir))))};return{get:get,set:set,del:async On=>{await Promise.all(St.map((St=>St.del(On))))},async wrap(On,rr,ir){let cr;let ur=0;for(;ur<St.length;ur++){try{cr=await St[ur].get(On);if(cr!==undefined)break}catch(St){}}if(cr===undefined){const St=await rr();const cr=typeof ir==="function"?ir(St):ir;await set(On,St,cr);return St}else{const pr=typeof ir==="function"?ir(cr):ir;Promise.all(St.slice(0,ur).map((St=>St.set(On,cr,pr)))).then();St[ur].wrap(On,rr,ir).then()}return cr},reset:async()=>{await Promise.all(St.map((St=>St.reset())))},mget:async(...On)=>{const rr=new Array(On.length).fill(undefined);for(const ir of St){if(rr.every((St=>St!==undefined)))break;try{const St=await ir.store.mget(...On);St.forEach(((St,On)=>{if(rr[On]===undefined&&St!==undefined)rr[On]=St}))}catch(St){}}return rr},mset:async(On,rr)=>{await Promise.all(St.map((St=>St.store.mset(On,rr))))},mdel:async(...On)=>{await Promise.all(St.map((St=>St.store.mdel(...On))))},methodWrap:async(On,rr,ir,cr)=>{let ur;let pr=0;for(;pr<St.length;pr++){try{ur=await St[pr].get(On);if(ur!==undefined)break}catch(St){}}if(ur===undefined){const St=await rr(...ir);const ur=typeof cr==="function"?cr(St):cr;await set(On,St,ur);return St}else{const fr=typeof cr==="function"?cr(ur):cr;Promise.all(St.slice(0,pr).map((St=>St.set(On,ur,fr)))).then();St[pr].methodWrap(On,rr,ir,cr).then()}return ur}}}On.multiCaching=multiCaching},8869:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(64080),On);cr(rr(87932),On);cr(rr(91724),On)},48851:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.coalesceAsync=void 0;const rr=new Map;async function coalesceAsync(St,On){if(!hasKey(St)){addKey(St);try{const rr=await Promise.resolve(On());coalesce({key:St,result:rr});return rr}catch(On){coalesce({key:St,error:On});throw On}}return enqueue(St)}On.coalesceAsync=coalesceAsync;function hasKey(St){return rr.has(St)}function addKey(St){rr.set(St,[])}function removeKey(St){rr.delete(St)}function addCallbackToKey(St,On){const ir=getCallbacksByKey(St);ir.push(On);rr.set(St,ir)}function getCallbacksByKey(St){var On;return(On=rr.get(St))!==null&&On!==void 0?On:[]}function enqueue(St){return new Promise(((On,rr)=>{const ir={resolve:On,reject:rr};addCallbackToKey(St,ir)}))}function dequeue(St){const On=getCallbacksByKey(St);removeKey(St);return On}function coalesce(St){const{key:On,error:rr,result:ir}=St;dequeue(On).forEach((St=>{if(rr){St.reject(rr)}else{St.resolve(ir)}}))}},87932:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.memoryStore=void 0;const ir=rr(57223);const cr=rr(19944);function clone(St){if(typeof St==="object"&&St!==null){return cr(St)}return St}function memoryStore(St){var On;const rr=(St===null||St===void 0?void 0:St.shouldCloneBeforeSet)!==false;const cr=(On=St===null||St===void 0?void 0:St.isCacheable)!==null&&On!==void 0?On:St=>St!==undefined;const ur={ttlAutopurge:true,...St,max:(St===null||St===void 0?void 0:St.max)||500,ttl:(St===null||St===void 0?void 0:St.ttl)!==undefined?St.ttl:0};const pr=new ir(ur);return{async del(St){pr.delete(St)},get:async St=>pr.get(St),keys:async()=>[...pr.keys()],mget:async(...St)=>St.map((St=>pr.get(St))),async mset(St,On){const ir={ttl:On!==undefined?On:ur.ttl};for(const[On,ur]of St){if(!cr(ur))throw new Error(`no cacheable value ${JSON.stringify(ur)}`);if(rr)pr.set(On,clone(ur),ir);else pr.set(On,ur,ir)}},async mdel(...St){for(const On of St)pr.delete(On)},async reset(){pr.clear()},ttl:async St=>pr.getRemainingTTL(St),async set(St,On,ir){if(!cr(On))throw new Error(`no cacheable value ${JSON.stringify(On)}`);if(rr)On=clone(On);const fr=ir!==undefined?ir:ur.ttl;pr.set(St,On,{ttl:fr})},get calculatedSize(){return pr.calculatedSize},get size(){return pr.size},dump:()=>pr.dump(),load:(...St)=>pr.load(...St)}}On.memoryStore=memoryStore},91724:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},68805:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CacheConfiguration=On.getClassMethodDefaultCacheKey=void 0;const ur=rr(46123);const pr=rr(42696);const fr=rr(91761);function getClassMethodDefaultCacheKey(St,On){return St.name+"-"+(0,ur.getProviderUUId)(St)+"-"+On}On.getClassMethodDefaultCacheKey=getClassMethodDefaultCacheKey;let br=class CacheConfiguration{async onReady(St){this.cacheService=await St.getAsync(fr.CachingFactory);this.decoratorService.registerMethodHandler(pr.CACHE_DECORATOR_KEY,(({target:St,propertyName:On,metadata:rr})=>{if(!rr.cacheKey){rr.cacheKey=getClassMethodDefaultCacheKey(St,On)}return{around:async St=>{let On=rr.cacheKey;const ir=this.cacheService.get(rr.cacheInstanceName);if(typeof On==="function"){On=await On({methodArgs:St.args,ctx:St.target[ur.REQUEST_OBJ_CTX_KEY],target:St.target})}if(typeof On==="string"){return ir.methodWrap(On,St.proceed,St.args,rr.ttl)}else{return St.proceed(...St.args)}}}}))}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayDecoratorService)],br.prototype,"decoratorService",void 0);br=ir([(0,ur.Configuration)({namespace:"cacheManager",importConfigs:[{default:{cacheManager:{}}}]})],br);On.CacheConfiguration=br},42696:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Caching=On.CACHE_DECORATOR_KEY=void 0;const ir=rr(46123);On.CACHE_DECORATOR_KEY="cache-manager:caching";function Caching(St,rr,cr){if(typeof rr==="number"){cr=rr;rr=undefined}return(0,ir.createCustomMethodDecorator)(On.CACHE_DECORATOR_KEY,{cacheInstanceName:St,cacheKey:rr,ttl:cr})}On.Caching=Caching},91761:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.CachingFactory=void 0;const ur=rr(46123);const pr=rr(8869);let fr=class CachingFactory extends ur.ServiceFactory{async init(){await this.initClients(this.cacheManagerConfig)}async createClient(St,On){if(Array.isArray(St.store)){const rr=[];for(const ir of St.store){if(typeof ir==="string"){if(!this.has(ir)){throw new ur.MidwayCommonError(`cache instance "${ir}" not found in "${On}", please check your configuration.`)}rr.push(this.get(ir))}else if(typeof ir==="function"){rr.push(await ir())}else if(ir["wrap"]){rr.push(ir["wrap"])}else if(typeof ir==="object"){if(typeof ir.store==="function"){ir.store=await ir.store(ir["options"]||{},this.applicationContext)}if(!ir.store){throw new ur.MidwayCommonError(`cache instance "${On}" store is undefined, please check your configuration.`)}rr.push(await(0,pr.caching)(ir.store,ir["options"]))}else{throw new ur.MidwayCommonError("invalid cache config")}}return await(0,pr.multiCaching)(rr)}else{if(typeof St.store==="function"){St.store=await St.store(St["options"]||{},this.applicationContext)}if(!St.store){throw new ur.MidwayCommonError(`cache instance "${On}" store is undefined, please check your configuration.`)}return await(0,pr.caching)(St.store,St["options"])}}getName(){return"cache-manager"}getCaching(St){return this.get(St)}getMultiCaching(St){return this.get(St)}};ir([(0,ur.Config)("cacheManager"),cr("design:type",Object)],fr.prototype,"cacheManagerConfig",void 0);ir([(0,ur.ApplicationContext)(),cr("design:type",Object)],fr.prototype,"applicationContext",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"init",null);fr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],fr);On.CachingFactory=fr},96955:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.CacheManager=On.getClassMethodDefaultCacheKey=On.Configuration=void 0;var ur=rr(68805);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.CacheConfiguration}});Object.defineProperty(On,"getClassMethodDefaultCacheKey",{enumerable:true,get:function(){return ur.getClassMethodDefaultCacheKey}});cr(rr(43488),On);cr(rr(91761),On);cr(rr(42696),On);On.CacheManager=rr(8869);cr(rr(93730),On)},43488:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},93730:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createRedisStore=void 0;const ir=rr(46123);const getVal=St=>JSON.stringify(St)||'"undefined"';function createRedisStore(St){return async(On,rr)=>{const{RedisServiceFactory:cr}=(0,ir.safeRequire)("@midwayjs/redis");const ur=await rr.getAsync(cr);const pr=ur.get(St);return createStore(pr,On)}}On.createRedisStore=createRedisStore;function createStore(St,On){const rr=(On===null||On===void 0?void 0:On.isCacheable)||(St=>St!==undefined&&St!==null);const keys=On=>St.keys(On);return{async get(On){const rr=await St.get(On);if(rr===undefined||rr===null)return undefined;else{try{return JSON.parse(rr)}catch(St){return rr}}},async set(cr,ur,pr){if(!rr(ur))throw new ir.MidwayCommonError(`"${ur}" is not a cacheable value`);const fr=pr===undefined?On===null||On===void 0?void 0:On.ttl:pr;if(fr!==undefined&&fr!==0)await St.set(cr,getVal(ur),"PX",fr);else await St.set(cr,getVal(ur))},async mset(cr,ur){const pr=ur===undefined?On===null||On===void 0?void 0:On.ttl:ur;if(pr!==undefined&&pr!==0){const On=St.multi();for(const[St,ur]of cr){if(!rr(ur))throw new ir.MidwayCommonError(`"${getVal(ur)}" is not a cacheable value`);On.set(St,getVal(ur),"PX",pr)}await On.exec()}else await St.mset(cr.flatMap((([St,On])=>{if(!rr(On))throw new Error(`"${getVal(On)}" is not a cacheable value`);return[St,getVal(On)]})))},mget:(...On)=>St.mget(On).then((St=>St.map((St=>{if(St===null||St===undefined){return undefined}else{try{return JSON.parse(St)}catch(On){return St}}})))),async mdel(...On){await St.del(On)},async del(On){await St.del(On)},ttl:async On=>St.pttl(On),keys:(St="*")=>keys(St),reset:()=>{throw new ir.MidwayCommonError("flushdb() is too dangerous, if necessary, please use redisServiceFactory.get(client) to get the instance and call it manually.")},isCacheable:rr}}},4074:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Cookie=void 0;const ir=rr(42613);const cr=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;const ur=/^(?:none|lax|strict)$/i;class Cookie{constructor(St,On,rr){ir(cr.test(St),"argument name is invalid");ir(!On||cr.test(On),"argument value is invalid");this.name=St;this.value=On||"";this.attrs=mergeDefaultAttrs(rr);ir(!this.attrs.path||cr.test(this.attrs.path),"argument option path is invalid");ir(!this.attrs.domain||cr.test(this.attrs.domain),"argument option domain is invalid");ir(!this.attrs.sameSite||this.attrs.sameSite===true||ur.test(this.attrs.sameSite),"argument option sameSite is invalid");if(!On){this.attrs.expires=new Date(0);this.attrs.maxAge=null}}toString(){return this.name+"="+this.value}toHeader(){let St=this.toString();const On=this.attrs;if(On.path)St+="; path="+On.path;const rr=typeof On.maxAge==="string"?parseInt(On.maxAge,10):On.maxAge;if(rr){St+="; max-age="+Math.round(rr/1e3);On.expires=new Date(Date.now()+rr)}if(On.expires)St+="; expires="+On.expires.toUTCString();if(On.domain)St+="; domain="+On.domain;if(On.sameSite)St+="; samesite="+(On.sameSite===true?"strict":On.sameSite.toLowerCase());if(On.secure)St+="; secure";if(On.httpOnly)St+="; httponly";if(On.priority)St+="; priority="+On.priority;if(On.partitioned)St+="; partitioned";return St}}On.Cookie=Cookie;const pr=["path","expires","domain","httpOnly","secure","partitioned","maxAge","overwrite","sameSite","priority"];function mergeDefaultAttrs(St){const On={path:"/",httpOnly:true,secure:false,overwrite:false,sameSite:false,partitioned:false};if(!St)return On;for(let rr=0;rr<pr.length;rr++){const ir=pr[rr];if(ir in St)On[ir]=St[ir]}return On}},11033:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.urlSafeDecode=On.urlSafeEncode=On.Cookies=void 0;const ir=rr(42613);const cr=rr(4074);const ur=rr(5693);const pr=rr(86054);const fr=Symbol("midwayCookies:keysArray");const br=Symbol("midwayCookies:keys");const Sr=new Map;class Cookies{constructor(St,On,rr,ir){var cr;this[fr]=On?[].concat(On):On;this._defaultCookieOptions=rr;this._defaultGetCookieOptions=ir;this.ctx=St;this.secure=(cr=rr===null||rr===void 0?void 0:rr.secure)!==null&&cr!==void 0?cr:this.ctx.secure;this.app=St.app}get keys(){if(!this[br]){const St=this[fr];ir(Array.isArray(St),".keys required for encrypt/sign cookies");const On=Sr.get(St);if(On){this[br]=On}else{this[br]=new ur.Keygrip(this[fr]);Sr.set(St,this[br])}}return this[br]}get(St,On){On=Object.assign({},this._defaultGetCookieOptions||{},On);const rr=computeSigned(On);const ir=this.ctx.get("cookie");if(!ir)return;const cr=ir.match(getPattern(St));if(!cr)return;let ur=cr[1];if(!On.encrypt&&!rr)return ur;if(rr){const On=St+".sig";const rr=this.get(On,{signed:false});if(!rr)return;const ir=St+"="+ur;const cr=this.keys.verify(ir,rr);if(cr<0){this.set(On,null,{path:"/",signed:false});return}if(cr>0){this.set(On,this.keys.sign(ir),{signed:false})}return ur}ur=urlSafeDecode(ur);const pr=this.keys.decrypt(ur);if(pr===null||pr===void 0?void 0:pr.value){return pr.value.toString()}return undefined}set(St,On,rr){if(!rr&&typeof On!=="string"){rr=On;On=""}rr=Object.assign({},this._defaultCookieOptions,rr);const ir=computeSigned(rr);On=On||"";if(!this.secure&&rr.secure){throw new Error("Cannot send secure cookie over unencrypted connection")}let ur=this.ctx.response.get("set-cookie")||[];if(!Array.isArray(ur))ur=[ur];if(rr.encrypt){On=On&&urlSafeEncode(this.keys.encrypt(On))}if(On.length>4093){this.app.emit("cookieLimitExceed",{name:St,value:On,ctx:this.ctx})}const pr=this.ctx.get("user-agent");if(rr.sameSite&&typeof rr.sameSite==="string"&&rr.sameSite.toLowerCase()==="none"){if(!this.secure||pr&&!this.isSameSiteNoneCompatible(pr)){rr.sameSite=false}}if(rr.partitioned){if(!this.secure||!pr||pr&&!this.isPartitionedCompatible(pr)){rr.partitioned=false}}if(rr.partitioned&&rr.removeUnpartitioned){const On=rr.overwrite;if(On){rr.overwrite=false;ur=ignoreCookiesByName(ur,St)}const pr=Object.assign({},rr,{partitioned:false});const fr=new cr.Cookie(St,"",pr);if(rr.secure===undefined)fr.attrs.secure=this.secure;ur=pushCookie(ur,fr);if(ir){fr.name+=".sig";ur=ignoreCookiesByName(ur,fr.name);ur=pushCookie(ur,fr)}}if(rr.priority){if(!pr||pr&&!this.isPriorityCompatible(pr)){rr.priority=undefined}}const fr=new cr.Cookie(St,On,rr);if(rr.secure===undefined)fr.attrs.secure=this.secure;ur=pushCookie(ur,fr);if(ir){fr.value=On&&this.keys.sign(fr.toString());fr.name+=".sig";ur=pushCookie(ur,fr)}this.ctx.set("set-cookie",ur);return this}isSameSiteNoneCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=80}return(0,pr.isSameSiteNoneCompatible)(St)}isPartitionedCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=114}return false}parseChromiumAndMajorVersion(St){if(!this.uaParseResult){const On=/Chrom[^ /]+\/(\d+)[.\d]* /.exec(St);if(!On)return{chromium:false,majorVersion:undefined};this.uaParseResult={chromium:true,majorVersion:parseInt(On[1])}}return this.uaParseResult}isPriorityCompatible(St){const On=this.parseChromiumAndMajorVersion(St);if(On.chromium&&On.majorVersion){return On.majorVersion>=81}return false}}On.Cookies=Cookies;const Er=new Map;function getPattern(St){const On=Er.get(St);if(On)return On;const rr=new RegExp("(?:^|;) *"+St.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)");Er.set(St,rr);return rr}function computeSigned(St){if(St.encrypt)return false;return St.signed!==false}function pushCookie(St,On){if(On.attrs.overwrite){St=ignoreCookiesByName(St,On.name)}St.push(On.toHeader());return St}function ignoreCookiesByName(St,On){const rr=`${On}=`;return St.filter((St=>!St.startsWith(rr)))}function urlSafeEncode(St){return St.replace(/\+/g,"-").replace(/\//g,"_")}On.urlSafeEncode=urlSafeEncode;function urlSafeDecode(St){return St.replace(/-/g,"+").replace(/_/g,"/")}On.urlSafeDecode=urlSafeDecode},60990:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(33249),On);cr(rr(11033),On)},33249:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},5693:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Keygrip=void 0;const ir=rr(42613);const cr=rr(39023);const ur=rr(76982);const pr=rr(48978);const fr=(0,cr.debuglog)("midway:cookies");const br={"/":"_","+":"-","=":""};class Keygrip{constructor(St){ir(Array.isArray(St)&&St.length,"keys must be provided and should be an array");this.keys=St;this.hash="sha256"}encrypt(St,On){On=On||this.keys[0];try{St=String(St);const rr=getAlgorithm();const ir=(0,ur.randomBytes)(64);const cr=(0,ur.randomBytes)(16);const pr=Math.floor(Math.random()*(99999-1e4+1))+1e4;const fr=deriveKeyFromPassword(On,ir,Math.floor(pr*.47+1337));const br=(0,ur.createCipheriv)(rr,fr,cr);const Sr=Buffer.concat([br.update(St,"utf8"),br.final()]);const Er=br.getAuthTag();const kr=Buffer.concat([ir,cr,Er,Buffer.from(pr.toString()),Sr]).toString("hex");return getEncryptedPrefix()+kr}catch(St){fr("crypt error",St.stack);return undefined}}decrypt(St,On){if(!On){const On=this.keys;for(let rr=0;rr<On.length;rr++){const ir=this.decrypt(St,On[rr]);if(ir!==false)return{value:ir,index:rr}}return false}try{const rr=getAlgorithm();const ir=St.split(getEncryptedPrefix());if(ir.length!==2){return void 0}else{St=ir[1]}const cr=Buffer.from(St,"hex");const pr=cr.slice(0,64);const fr=cr.slice(64,80);const br=cr.slice(80,96);const Sr=parseInt(cr.slice(96,101).toString("utf-8"),10);const Er=cr.slice(101);const kr=deriveKeyFromPassword(On,pr,Math.floor(Sr*.47+1337));const Pr=(0,ur.createDecipheriv)(rr,kr,fr);Pr.setAuthTag(br);return Pr.update(Er,"binary","utf-8")+Pr.final("utf-8")}catch(St){fr("crypt error",St.stack);return false}}sign(St,On){On=On||this.keys[0];return(0,ur.createHmac)(this.hash,On).update(St).digest("base64").replace(/\/|\+|=/g,(St=>br[St]))}verify(St,On){const rr=this.keys;for(let ir=0;ir<rr.length;ir++){if(pr(Buffer.from(On),Buffer.from(this.sign(St,rr[ir])))){fr("data %s match key %s",St,rr[ir]);return ir}}return-1}}On.Keygrip=Keygrip;function getAlgorithm(){return"aes-256-gcm"}function getEncryptedPrefix(){return"enc::"}function deriveKeyFromPassword(St,On,rr){return(0,ur.pbkdf2Sync)(St,On,rr,32,"sha512")}},83872:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BaseFramework=void 0;const ur=rr(6192);const pr=rr(2222);const fr=rr(49757);const br=rr(97983);const Sr=rr(70275);const Er=rr(78842);const kr=rr(37482);const Pr=rr(34888);const Ir=rr(12738);const Lr=rr(68220);const Br=rr(39408);const jr=rr(77306);const Ur=rr(39023);const Vr=rr(75351);const Wr=rr(40581);const zr=Ur.debuglog("midway:debug");class BaseFramework{constructor(St){this.applicationContext=St;this.defaultContext={};this.middlewareManager=this.createMiddlewareManager();this.filterManager=this.createFilterManager();this.guardManager=this.createGuardManager();this.composeMiddleware=null}async init(){var St,On;this.configurationOptions=(St=this.configure())!==null&&St!==void 0?St:{};this.contextLoggerApplyLogger=(On=this.configurationOptions.contextLoggerApplyLogger)!==null&&On!==void 0?On:"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(St){this.bootstrapOptions=St;await this.beforeContainerInitialize(St);await this.containerInitialize(St);await this.afterContainerInitialize(St);await this.containerDirectoryLoad(St);await this.afterContainerDirectoryLoad(St);await this.applicationInitialize(St);await this.containerReady(St);await this.afterContainerReady(St);await this.mockService.runSimulatorAppSetup(this.app)}async containerInitialize(St){}async containerDirectoryLoad(St){}async containerReady(St){if(!this.app.getApplicationContext){this.defineApplicationProperties()}}getApplicationContext(){return this.applicationContext}getConfiguration(St){return this.configService.getConfiguration(St)}getCurrentEnvironment(){return this.environmentService.getCurrentEnvironment()}getApplication(){return this.app}createContextLogger(St,On){if(On&&On!=="appLogger"){const rr=this.getLogger(On);let ir=St.getAttr(pr.REQUEST_CTX_LOGGER_CACHE_KEY);if(!ir){ir=new Map;St.setAttr(pr.REQUEST_CTX_LOGGER_CACHE_KEY,ir)}if(ir.has(On)){return ir.get(On)}const cr=this.loggerService.createContextLogger(St,rr);ir.set(On,cr);return cr}else{const rr=this.getLogger(On!==null&&On!==void 0?On:this.contextLoggerApplyLogger);if(St["_logger"]){return St["_logger"]}St["_logger"]=this.loggerService.createContextLogger(St,rr,{contextFormat:this.contextLoggerFormat});return St["_logger"]}}async stop(){await this.mockService.runSimulatorAppTearDown(this.app);await this.beforeStop()}getAppDir(){return this.informationService.getAppDir()}getBaseDir(){return this.informationService.getBaseDir()}defineApplicationProperties(St={},On=[]){const rr={getBaseDir:()=>this.getBaseDir(),getAppDir:()=>this.getAppDir(),getEnv:()=>this.getCurrentEnvironment(),getApplicationContext:()=>this.getApplicationContext(),getConfig:St=>this.getConfiguration(St),getFrameworkType:()=>{if(this["getFrameworkType"]){return this["getFrameworkType"]()}},getProcessType:()=>ur.MidwayProcessTypeEnum.APPLICATION,getCoreLogger:()=>this.getCoreLogger(),getLogger:St=>this.getLogger(St),createLogger:(St,On={})=>this.createLogger(St,On),getFramework:()=>this,getProjectName:()=>this.getProjectName(),createAnonymousContext:St=>{const On=St||Object.create(this.defaultContext);if(!On.startTime){On.startTime=Date.now()}if(!On.logger){On.logger=this.createContextLogger(On)}if(!On.requestContext){On.requestContext=new br.MidwayRequestContainer(On,this.getApplicationContext());On.requestContext.ready()}if(!On.getLogger){On.getLogger=St=>this.createContextLogger(On,St)}On.setAttr=(St,rr)=>{On.requestContext.setAttr(St,rr)};On.getAttr=St=>On.requestContext.getAttr(St);On.getApp=()=>this.getApplication();return On},addConfigObject:St=>{this.configService.addObject(St)},setAttr:(St,On)=>{this.getApplicationContext().setAttr(St,On)},getAttr:St=>this.getApplicationContext().getAttr(St),useMiddleware:St=>this.useMiddleware(St),getMiddleware:()=>this.getMiddleware(),useFilter:St=>this.useFilter(St),useGuard:St=>this.useGuard(St),getNamespace:()=>this.getNamespace()};for(const St of On){delete rr[St]}Object.assign(this.app,rr,St)}async beforeStop(){}async beforeContainerInitialize(St){}async afterContainerInitialize(St){}async afterContainerDirectoryLoad(St){}async afterContainerReady(St){}async applyMiddleware(St){var On;if(!this.composeMiddleware){if(!this.applicationContext.hasObject(pr.ASYNC_CONTEXT_MANAGER_KEY)){const St=this.configService.getConfiguration("asyncContextManager.enable")||false;const rr=St?((On=this.bootstrapOptions)===null||On===void 0?void 0:On.asyncContextManager)||new Vr.NoopContextManager:new Vr.NoopContextManager;if(St){rr.enable()}this.applicationContext.registerObject(pr.ASYNC_CONTEXT_MANAGER_KEY,rr)}this.middlewareManager.insertFirst((async(St,On)=>{const rr=Vr.ASYNC_ROOT_CONTEXT.setValue(pr.ASYNC_CONTEXT_KEY,St);const ir=this.applicationContext.get(pr.ASYNC_CONTEXT_MANAGER_KEY);return await ir.with(rr,(async()=>{await this.mockService.runSimulatorContextSetup(St,this.app);this.mockService.applyContextMocks(this.app,St);let rr=undefined;try{const ir=await On();rr=await this.filterManager.runResultFilter(ir,St)}catch(On){rr=await this.filterManager.runErrorFilter(On,St)}finally{await this.mockService.runSimulatorContextTearDown(St,this.app)}if(rr.error){throw rr.error}return rr.result}))}));zr(`[core]: Compose middleware = [${this.middlewareManager.getNames()}]`);this.composeMiddleware=await this.middlewareService.compose(this.middlewareManager,this.app);await this.filterManager.init(this.applicationContext)}if(St){St=Array.isArray(St)?St:[St];return await this.middlewareService.compose([this.composeMiddleware,...St],this.app)}return this.composeMiddleware}getLogger(St){var On;return(On=this.loggerService.getLogger(St))!==null&&On!==void 0?On:this.appLogger}getCoreLogger(){return this.logger}createLogger(St,On={}){return this.loggerService.createLogger(St,On)}getProjectName(){return this.informationService.getProjectName()}getFrameworkName(){return this.constructor.name}useMiddleware(St){this.middlewareManager.insertLast(St)}getMiddleware(){return this.middlewareManager}useFilter(St){return this.filterManager.useFilter(St)}useGuard(St){return this.guardManager.addGlobalGuard(St)}async runGuard(St,On,rr){return this.guardManager.runGuard(St,On,rr)}createMiddlewareManager(){return new Ir.ContextMiddlewareManager}createFilterManager(){return new Br.FilterManager}createGuardManager(){return new Wr.GuardManager}setNamespace(St){this.namespace=St}getNamespace(){return this.namespace}}ir([(0,fr.Inject)(),cr("design:type",Pr.MidwayLoggerService)],BaseFramework.prototype,"loggerService",void 0);ir([(0,fr.Inject)(),cr("design:type",Sr.MidwayEnvironmentService)],BaseFramework.prototype,"environmentService",void 0);ir([(0,fr.Inject)(),cr("design:type",Er.MidwayConfigService)],BaseFramework.prototype,"configService",void 0);ir([(0,fr.Inject)(),cr("design:type",kr.MidwayInformationService)],BaseFramework.prototype,"informationService",void 0);ir([(0,fr.Inject)(),cr("design:type",Lr.MidwayMiddlewareService)],BaseFramework.prototype,"middlewareService",void 0);ir([(0,fr.Inject)(),cr("design:type",jr.MidwayMockService)],BaseFramework.prototype,"mockService",void 0);ir([(0,fr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],BaseFramework.prototype,"init",null);On.BaseFramework=BaseFramework},43436:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayApplicationManager=void 0;const cr=rr(6192);const ur=rr(49757);let pr=class MidwayApplicationManager{constructor(){this.globalFrameworkMap=new Map;this.globalFrameworkTypeMap=new WeakMap}addFramework(St,On){this.globalFrameworkMap.set(St,On);if(On["getFrameworkType"]){this.globalFrameworkTypeMap.set(On["getFrameworkType"](),On)}}getFramework(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St)}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St)}}}getApplication(St){if(typeof St==="string"){if(this.globalFrameworkMap.has(St)){return this.globalFrameworkMap.get(St).getApplication()}}else{if(this.globalFrameworkTypeMap.has(St)){return this.globalFrameworkTypeMap.get(St).getApplication()}}}getApplications(St){if(!St){return Array.from(this.globalFrameworkMap.values()).map((St=>St.getApplication())).filter((St=>!!St))}else{return St.map((St=>this.getApplication(St))).filter((St=>!!St))}}};pr=ir([(0,ur.Provide)(),(0,ur.Scope)(cr.ScopeEnum.Singleton)],pr);On.MidwayApplicationManager=pr},75351:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.NoopContextManager=On.ASYNC_ROOT_CONTEXT=void 0;class AsyncBaseContext{constructor(St){const On=this;On._currentContext=St?new Map(St):new Map;On.getValue=St=>On._currentContext.get(St);On.setValue=(St,rr)=>{const ir=new AsyncBaseContext(On._currentContext);ir._currentContext.set(St,rr);return ir};On.deleteValue=St=>{const rr=new AsyncBaseContext(On._currentContext);rr._currentContext.delete(St);return rr}}}On.ASYNC_ROOT_CONTEXT=new AsyncBaseContext;class NoopContextManager{active(){return On.ASYNC_ROOT_CONTEXT}with(St,On,rr,...ir){return On.call(rr,...ir)}bind(St,On){return On}enable(){return this}disable(){return this}}On.NoopContextManager=NoopContextManager},46673:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.DataListener=void 0;const ur=rr(49757);class DataListener{async init(){this.innerData=await this.initData();await this.onData(this.setData.bind(this))}setData(St){this.innerData=St}getData(){return this.innerData}async stop(){await this.destroyListener()}async destroyListener(){}}ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],DataListener.prototype,"init",null);ir([(0,ur.Destroy)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],DataListener.prototype,"stop",null);On.DataListener=DataListener},12849:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.globModels=On.formatGlobString=On.DataSourceManager=void 0;const ur=rr(83486);const pr=rr(86314);const fr=rr(62525);const br=rr(16928);const Sr=rr(63289);const Er=rr(2222);const kr=rr(39023);const Pr=rr(65308);const Ir=rr(49757);const Lr=rr(70275);const Br=rr(78842);const jr=rr(67934);const Ur=(0,kr.debuglog)("midway:debug");class DataSourceManager{constructor(){this.dataSource=new Map;this.options={};this.modelMapping=new WeakMap;this.dataSourcePriority={}}async initDataSource(St,On){var rr,ir;this.options=St;if(!this.options.dataSource){throw new pr.MidwayParameterError("[DataSourceManager] must set options.dataSource.")}if(typeof On==="string"){On={baseDir:On,entitiesConfigKey:"entities"}}const cr=On;const ur=(ir=(rr=this.configService)===null||rr===void 0?void 0:rr.getConfiguration("core.concurrentDataSourceInitialization"))!==null&&ir!==void 0?ir:false;const processDataSource=async On=>{var rr;const ir=St.dataSource[On];const ur=ir[cr.entitiesConfigKey];if(ur){const St=new Set;for(const ir of ur){if(typeof ir==="string"){const ur=await globModels(ir,cr.baseDir,(rr=this.environmentService)===null||rr===void 0?void 0:rr.getModuleLoadType());for(const rr of ur){St.add(rr);this.modelMapping.set(rr,On)}}else{St.add(ir);this.modelMapping.set(ir,On)}}ir[cr.entitiesConfigKey]=Array.from(St);Ur(`[core]: DataManager load ${ir[cr.entitiesConfigKey].length} models from ${On}.`)}const pr={cacheInstance:St.cacheInstance,validateConnection:St.validateConnection};await this.createInstance(ir,On,pr)};const fr=Object.keys(St.dataSource);if(ur){await Promise.all(fr.map(processDataSource))}else{for(const St of fr){await processDataSource(St)}}}getDataSource(St){return this.dataSource.get(St)}hasDataSource(St){return this.dataSource.has(St)}getDataSourceNames(){return Array.from(this.dataSource.keys())}getAllDataSources(){return this.dataSource}async isConnected(St){const On=this.getDataSource(St);return On?this.checkConnected(On):false}async createInstance(St,On,rr){const ir=rr&&typeof rr.cacheInstance==="boolean"?rr.cacheInstance:true;const cr=rr&&rr.validateConnection||false;const fr=(0,ur.extend)(true,{},this.options["default"],St);const br=await this.createDataSource(fr,On);if(ir&&On&&br){this.dataSource.set(On,br)}if(cr){if(!br){throw new pr.MidwayCommonError(`[DataSourceManager] ${On} initialization failed.`)}const St=await this.checkConnected(br);if(!St){throw new pr.MidwayCommonError(`[DataSourceManager] ${On} is not connected.`)}}return br}getDataSourceNameByModel(St){return this.modelMapping.get(St)}async stop(){const St=Array.from(this.dataSource.values());await Promise.all(St.map((St=>this.destroyDataSource(St))));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(St){return this.priorityManager.getPriority(this.dataSourcePriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.dataSourcePriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.dataSourcePriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.dataSourcePriority[St])}}ir([(0,Ir.Inject)(),cr("design:type",String)],DataSourceManager.prototype,"appDir",void 0);ir([(0,Ir.Inject)(),cr("design:type",Lr.MidwayEnvironmentService)],DataSourceManager.prototype,"environmentService",void 0);ir([(0,Ir.Inject)(),cr("design:type",Br.MidwayConfigService)],DataSourceManager.prototype,"configService",void 0);ir([(0,Ir.Inject)(),cr("design:type",jr.MidwayPriorityManager)],DataSourceManager.prototype,"priorityManager",void 0);On.DataSourceManager=DataSourceManager;function formatGlobString(St){let On;if(!/^\*/.test(St)){St="/"+St}const rr=(0,br.parse)(St);if(rr.base&&(/\*/.test(rr.base)||rr.ext)){On=[St]}else{On=[...Er.DEFAULT_PATTERN.map((On=>(0,br.join)(St,On)))]}return On}On.formatGlobString=formatGlobString;async function globModels(St,On,rr){const ir=formatGlobString(St);const cr=[];const ur=(0,fr.run)(ir,{cwd:On,ignore:Er.IGNORE_PATTERN});for(const St of ur){const On=await(0,Pr.loadModule)(St,{loadMode:rr});if(Sr.Types.isClass(On)){cr.push(On)}else{for(const St in On){const rr=On[St];if(Sr.Types.isClass(rr)){cr.push(rr)}}}}return cr}On.globModels=globModels},1845:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.CustomModuleDetector=On.ESModuleFileDetector=On.CommonJSFileDetector=On.AbstractFileDetector=void 0;const ir=rr(63289);const cr=rr(62525);const ur=rr(86314);const pr=rr(2222);const fr=rr(49757);const br=rr(65308);class AbstractFileDetector{constructor(St){this.options=St;this.extraDetectorOptions={}}setExtraDetectorOptions(St){this.extraDetectorOptions=St}}On.AbstractFileDetector=AbstractFileDetector;const Sr=["**/**.tsx"].concat(pr.DEFAULT_PATTERN);const Er=["**/logs/**","**/run/**","**/public/**","**/app/view/**","**/app/views/**","**/app/extend/**","**/node_modules/**","**/**.test.ts","**/**.test.js","**/__test__/**"].concat(pr.IGNORE_PATTERN);class CommonJSFileDetector extends AbstractFileDetector{constructor(){super(...arguments);this.duplicateModuleCheckSet=new Map}run(St){if(this.getType()==="commonjs"){return this.loadSync(St)}else{return this.loadAsync(St)}}loadSync(St){var On;this.options=this.options||{};const rr=[].concat((On=this.options.loadDir)!==null&&On!==void 0?On:St.get("baseDir"));for(const On of rr){const rr=(0,cr.run)(Sr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:On,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,On)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&ir.Types.isClass(St)){const rr=(0,fr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new ur.MidwayDuplicateClassNameError(rr,On.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,On.srcPath)}}}};for(const On of rr){const rr=require(On);St.bindClass(rr,{namespace:this.options.namespace,srcPath:On,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}async loadAsync(St){var On;this.options=this.options||{};const rr=[].concat((On=this.options.loadDir)!==null&&On!==void 0?On:St.get("baseDir"));for(const On of rr){const rr=(0,cr.run)(Sr.concat(this.options.pattern||[]).concat(this.extraDetectorOptions.pattern||[]),{cwd:On,ignore:Er.concat(this.options.ignore||[]).concat(this.extraDetectorOptions.ignore||[])});const checkDuplicatedHandler=(St,On)=>{if((this.options.conflictCheck||this.extraDetectorOptions.conflictCheck)&&ir.Types.isClass(St)){const rr=(0,fr.getProviderName)(St);if(rr){if(this.duplicateModuleCheckSet.has(rr)){throw new ur.MidwayDuplicateClassNameError(rr,On.srcPath,this.duplicateModuleCheckSet.get(rr))}else{this.duplicateModuleCheckSet.set(rr,On.srcPath)}}}};for(const On of rr){const rr=await(0,br.loadModule)(On,{loadMode:"esm"});St.bindClass(rr,{namespace:this.options.namespace,srcPath:On,createFrom:"file",bindHook:checkDuplicatedHandler})}}this.duplicateModuleCheckSet.clear()}getType(){return"commonjs"}}On.CommonJSFileDetector=CommonJSFileDetector;class ESModuleFileDetector extends CommonJSFileDetector{getType(){return"module"}}On.ESModuleFileDetector=ESModuleFileDetector;class CustomModuleDetector extends AbstractFileDetector{async run(St){for(const On of this.options.modules){St.bindClass(On,{namespace:this.options.namespace,createFrom:"module"})}}}On.CustomModuleDetector=CustomModuleDetector},39408:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FilterManager=void 0;const ir=rr(49757);const cr=rr(65308);class FilterManager{constructor(){this.errFilterList=[];this.successFilterList=[];this.exceptionMap=new WeakMap;this.defaultErrFilter=undefined;this.matchFnList=[];this.protoMatchList=[]}useFilter(St){if(!Array.isArray(St)){St=[St]}for(const On of St){if((0,ir.getClassMetadata)(ir.CATCH_KEY,On)){this.errFilterList.push(On)}if((0,ir.getClassMetadata)(ir.MATCH_KEY,On)){this.successFilterList.push(On)}}}async init(St){for(const On of this.errFilterList){const rr=await St.getAsync(On);const cr=(0,ir.getClassMetadata)(ir.CATCH_KEY,On);if(cr&&cr.catchTargets){cr.catchOptions=cr.catchOptions||{};for(const St of cr.catchTargets){this.exceptionMap.set(St,{filter:rr,catchOptions:cr.catchOptions});if(cr.catchOptions["matchPrototype"]){this.protoMatchList.push((On=>{if(On instanceof St){return St}else{return false}}))}}}else{this.defaultErrFilter=rr}}for(const On of this.successFilterList){const rr=await St.getAsync(On);const ur=(0,ir.getClassMetadata)(ir.MATCH_KEY,On);if(ur&&ur.matchPattern){this.matchFnList.push({matchFn:(0,cr.toPathMatch)(ur.matchPattern),target:rr})}}}async runErrorFilter(St,On,rr,ir){let cr,ur;let pr=false;if(St&&this.exceptionMap.has(St.constructor)){pr=true;const ur=this.exceptionMap.get(St.constructor);cr=await ur.filter.catch(St,On,rr,ir)}if(!pr&&this.protoMatchList.length){let ur;for(const On of this.protoMatchList){ur=On(St);if(ur){break}}if(ur){pr=true;const fr=this.exceptionMap.get(ur);cr=await fr.filter.catch(St,On,rr,ir)}}if(!pr&&this.defaultErrFilter){pr=true;cr=await this.defaultErrFilter.catch(St,On,rr,ir)}if(!pr){ur=St}return{result:cr,error:ur}}async runResultFilter(St,On,rr,ir){let cr=St;for(const St of this.matchFnList){if(St.matchFn(On,rr)){cr=await St.target.match(cr,On,rr,ir)}}return{result:cr,error:undefined}}}On.FilterManager=FilterManager},40581:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.GuardManager=void 0;const ir=rr(49757);class GuardManager extends Array{addGlobalGuard(St){if(!Array.isArray(St)){this.push(St)}else{this.push(...St)}}async runGuard(St,On,rr){for(const ir of this){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}const cr=(0,ir.getClassMetadata)(ir.GUARD_KEY,On);if(cr){for(const ir of cr){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}}const ur=(0,ir.getPropertyMetadata)(ir.GUARD_KEY,On,rr);if(ur){for(const ir of ur){const cr=await St.requestContext.getAsync(ir);const ur=await cr.canActivate(St,On,rr);if(!ur){return false}}}return true}}On.GuardManager=GuardManager},82535:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DefaultConsoleLoggerFactory=On.LoggerFactory=void 0;class LoggerFactory{}On.LoggerFactory=LoggerFactory;class DefaultConsoleLoggerFactory{constructor(){this.instance=new Map}createLogger(St,On){this.instance.set(St,console);return console}getLogger(St){return this.instance.get(St)}close(St){}removeLogger(St){}getDefaultMidwayLoggerConfig(){return{midwayLogger:{default:{},clients:{coreLogger:{},appLogger:{}}}}}createContextLogger(St,On,rr){return On}getClients(){return this.instance}getClientKeys(){return Array.from(this.instance.keys())}}On.DefaultConsoleLoggerFactory=DefaultConsoleLoggerFactory},12738:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createMiddleware=On.ContextMiddlewareManager=void 0;class ContextMiddlewareManager extends Array{insertFirst(St){if(Array.isArray(St)){this.unshift(...St)}else{this.unshift(St)}}insertLast(St){if(Array.isArray(St)){this.push(...St)}else{this.push(St)}}insertBefore(St,On){if(typeof On!=="number"){On=this.findItemIndex(On)}if(Array.isArray(St)){this.splice(On,0,...St)}else{this.splice(On,0,St)}}insertAfter(St,On){if(typeof On!=="number"){On=this.findItemIndex(On)}if(Array.isArray(St)){this.splice(On+1,0,...St)}else{this.splice(On+1,0,St)}}findAndInsertAfter(St,On){St=this.findItem(St);On=this.findItem(On);if(!St||!On||St===On){return}if(On){const rr=this.remove(St);if(rr){this.insertAfter(rr,On)}}}findAndInsertBefore(St,On){St=this.findItem(St);On=this.findItem(On);if(!St||!On||St===On){return}if(On){const rr=this.remove(St);if(rr){this.insertBefore(rr,On)}}}findAndInsertFirst(St){const On=this.remove(St);if(On){this.insertFirst(On)}}findAndInsertLast(St){const On=this.remove(St);if(On){this.insertLast(On)}}findItemIndex(St){if(typeof St==="number"){return St}else if(typeof St==="string"){return this.findIndex((On=>this.getMiddlewareName(On)===St))}else{return this.findIndex((On=>On===St))}}findItem(St){if(typeof St==="number"){if(St>=0&&St<=this.length-1){return this[St]}}else if(typeof St==="string"){return this.find((On=>this.getMiddlewareName(On)===St))}else{return St}}getMiddlewareName(St){var On,rr,ir;if(St["middleware"]){return(On=St.name)!==null&&On!==void 0?On:this.getMiddlewareName(St["middleware"])}return(ir=(rr=St.getName&&St.getName())!==null&&rr!==void 0?rr:St._name)!==null&&ir!==void 0?ir:St.name}remove(St){if(typeof St==="number"&&St!==-1){return this.splice(St,1)[0]}else{const On=this.findItemIndex(St);if(On!==-1){return this.splice(On,1)[0]}}}push(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.push(...St)}unshift(...St){St.forEach((St=>{if(typeof St!=="string"&&!this.getMiddlewareName(St)){St._name="anonymous"}}));return super.unshift(...St)}getNames(){return this.map((St=>this.getMiddlewareName(St)))}}On.ContextMiddlewareManager=ContextMiddlewareManager;function createMiddleware(St,On,rr){return{middleware:St,options:On,name:rr}}On.createMiddleware=createMiddleware},70032:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayInitializerPerformanceManager=On.MidwayPerformanceManager=void 0;const ir=rr(82987);class MidwayPerformanceManager{constructor(St){this.group=St;this.observer=null;this.marks=new Set;this.measures=new Set}static getInstance(St){if(!this.instances.has(St)){this.instances.set(St,new MidwayPerformanceManager(St))}return this.instances.get(St)}formatKey(St,On){return`${this.group}:${St}-${On}`}markStart(St){const On=this.formatKey(St,"start");ir.performance.mark(On);this.marks.add(On)}markEnd(St){const On=this.formatKey(St,"start");const rr=this.formatKey(St,"end");const cr=`${this.group}:${St}`;ir.performance.mark(rr);this.marks.add(rr);ir.performance.measure(cr,On,rr);this.measures.add(cr)}observeMeasure(St){if(this.observer){return}this.observer=new ir.PerformanceObserver((On=>{const rr=On.getEntries().filter((St=>St.name.startsWith(`${this.group}:`)));if(rr.length>0){St({getEntries:()=>rr})}}));this.observer.observe({entryTypes:["measure"]});return this.observer}disconnect(){if(this.observer){this.observer.disconnect();this.observer=null}}clean(){this.marks.forEach((St=>{try{ir.performance.clearMarks(St)}catch(On){console.warn(`Failed to clear mark ${St}: ${On}`)}}));this.marks.clear();this.measures.forEach((St=>{try{ir.performance.clearMeasures(St)}catch(On){console.warn(`Failed to clear measure ${St}: ${On}`)}}));this.measures.clear();this.disconnect()}static cleanAll(){this.instances.forEach((St=>St.clean()));this.instances.clear()}static getInitialPerformanceEntries(){const St=[];ir.performance===null||ir.performance===void 0?void 0:ir.performance.getEntries().forEach((On=>{if(On.name.startsWith(this.DEFAULT_GROUP.INITIALIZE)){St.push(On.toJSON())}}));return St}}On.MidwayPerformanceManager=MidwayPerformanceManager;MidwayPerformanceManager.instances=new Map;MidwayPerformanceManager.DEFAULT_GROUP={INITIALIZE:"MidwayInitialize"};class MidwayInitializerPerformanceManager{static markStart(St){const On=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);On.markStart(St)}static markEnd(St){const On=MidwayPerformanceManager.getInstance(MidwayPerformanceManager.DEFAULT_GROUP.INITIALIZE);On.markEnd(St)}static frameworkInitializeStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkInitializeEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_INITIALIZE}:${St}`)}static frameworkRunStart(St){this.markStart(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static frameworkRunEnd(St){this.markEnd(`${this.MEASURE_KEYS.FRAMEWORK_RUN}:${St}`)}static lifecycleStart(St,On){this.markStart(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${On}`)}static lifecycleEnd(St,On){this.markEnd(`${this.MEASURE_KEYS.LIFECYCLE_PREPARE}:${St}:${On}`)}}On.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(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayPriorityManager=On.DEFAULT_PRIORITY=void 0;const cr=rr(49757);const ur=rr(6192);On.DEFAULT_PRIORITY={L1:"High",L2:"Medium",L3:"Low"};let pr=class MidwayPriorityManager{constructor(){this.priorityList=On.DEFAULT_PRIORITY;this.defaultPriority=On.DEFAULT_PRIORITY.L2}getCurrentPriorityList(){return this.priorityList}getDefaultPriority(){return this.defaultPriority}isHighPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L1}isMediumPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L2}isLowPriority(St=On.DEFAULT_PRIORITY.L2){return St===On.DEFAULT_PRIORITY.L3}getPriority(St){return St||this.getDefaultPriority()}};pr=ir([(0,cr.Provide)(),(0,cr.Scope)(ur.ScopeEnum.Singleton)],pr);On.MidwayPriorityManager=pr},64842:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ServiceFactory=void 0;const ur=rr(83486);const pr=rr(67934);const fr=rr(49757);class ServiceFactory{constructor(){this.clients=new Map;this.options={}}async initClients(St={}){this.options=St;if(St.client){St.clients=St.clients||{};St.clients["default"]=St.clients["default"]||{};(0,ur.extend)(true,St.clients["default"],St.client)}if(St.clients){for(const On of Object.keys(St.clients)){await this.createInstance(St.clients[On],On)}}this.clientPriority=St.priority||{}}get(St="default"){return this.clients.get(St)}has(St){return this.clients.has(St)}async createInstance(St,On){St=(0,ur.extend)(true,{},this.options["default"],St);const rr=await this.createClient(St,On);if(rr){if(On){this.clients.set(On,rr)}return rr}}async destroyClient(St,On){}async stop(){for(const[St,On]of this.clients.entries()){await this.destroyClient(On,St)}}getDefaultClientName(){return this.options["defaultClientName"]}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}getClientPriority(St){return this.priorityManager.getPriority(this.clientPriority[St])}isHighPriority(St){return this.priorityManager.isHighPriority(this.clientPriority[St])}isMediumPriority(St){return this.priorityManager.isMediumPriority(this.clientPriority[St])}isLowPriority(St){return this.priorityManager.isLowPriority(this.clientPriority[St])}}ir([(0,fr.Inject)(),cr("design:type",pr.MidwayPriorityManager)],ServiceFactory.prototype,"priorityManager",void 0);On.ServiceFactory=ServiceFactory},11330:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TypedResourceManager=void 0;class TypedResourceManager{constructor(St){this.typedResourceInitializerOptions=St;this.resourceMap=new Map;this.resourceBindingMap=new Map}async createResource(St,On){const rr=await this.typedResourceInitializerOptions.resourceInitialize(On,St);this.resourceMap.set(St,rr);return rr}async init(){for(const St of Object.keys(this.typedResourceInitializerOptions.initializeValue)){const On=this.typedResourceInitializerOptions.initializeValue[St];const rr=this.typedResourceInitializerOptions.initializeClzProvider[St];const ir=await this.createResource(St,On);const cr=await this.typedResourceInitializerOptions.resourceBinding(rr,On,ir,St);if(cr){this.resourceBindingMap.set(St,cr)}}}async startParallel(){const St=[];for(const[On,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceStart(rr,this.typedResourceInitializerOptions.initializeValue[On],this.resourceBindingMap.get(On)))}await Promise.all(St)}async start(){for(const[St,On]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceStart(On,this.typedResourceInitializerOptions.initializeValue[St],this.resourceBindingMap.get(St))}}async destroyParallel(){const St=[];for(const[On,rr]of this.resourceMap.entries()){St.push(this.typedResourceInitializerOptions.resourceDestroy(rr,this.typedResourceInitializerOptions.initializeValue[On]))}await Promise.all(St)}async destroy(){for(const[St,On]of this.resourceMap.entries()){await this.typedResourceInitializerOptions.resourceDestroy(On,this.typedResourceInitializerOptions.initializeValue[St])}this.resourceMap.clear();this.resourceBindingMap.clear()}getResource(St){return this.resourceMap.get(St)}}On.TypedResourceManager=TypedResourceManager},11026:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.WebControllerGenerator=void 0;const ir=rr(49757);const cr=rr(39023);const ur=rr(6192);const pr=rr(86314);const fr=rr(68220);const br=cr.debuglog("midway:debug");class WebControllerGenerator{constructor(St,On){this.app=St;this.midwayWebRouterService=On}generateKoaController(St){return async(On,rr)=>{if(St.controllerClz&&typeof St.method==="string"){const rr=await this.app.getFramework().runGuard(On,St.controllerClz,St.method);if(!rr){throw new pr.httpError.ForbiddenError}}const cr=[On,rr];let ur;if(typeof St.method!=="string"){ur=await St.method(On,rr)}else{const rr=await On.requestContext.getAsync(St.id);ur=await rr[St.method].apply(rr,cr)}if(ur!==undefined){if(ur===null){On.response._body=null;On.response._midwayControllerNullBody=true}else{On.body=ur}}if(Array.isArray(St.responseMetadata)&&St.responseMetadata.length){for(const rr of St.responseMetadata){switch(rr.type){case ir.WEB_RESPONSE_HTTP_CODE:On.status=rr.code;break;case ir.WEB_RESPONSE_HEADER:for(const St in(rr===null||rr===void 0?void 0:rr.setHeaders)||{}){On.set(St,rr.setHeaders[St])}break;case ir.WEB_RESPONSE_CONTENT_TYPE:On.type=rr.contentType;break;case ir.WEB_RESPONSE_REDIRECT:On.status=rr.code;On.redirect(rr.url);return}}}}}async loadMidwayController(St){var On,rr;const ir=await this.midwayWebRouterService.getRouterTable();const cr=await this.midwayWebRouterService.getRoutePriorityList();const pr=this.app.getApplicationContext();const Sr=this.app.getCoreLogger();const Er=pr.get(fr.MidwayMiddlewareService);for(const fr of cr){pr.bindClass(fr.routerModule);Sr.debug(`Load Controller "${fr.controllerId}", prefix=${fr.prefix}`);br(`[core]: Load Controller "${fr.controllerId}", prefix=${fr.prefix}`);const cr=this.createRouter({prefix:fr.prefix,...fr.routerOptions});fr.middleware=(On=fr.middleware)!==null&&On!==void 0?On:[];if(fr.middleware.length){const St=await Er.compose(fr.middleware,this.app);cr.use(St)}const kr=ir.get(fr.prefix);for(const St of kr){const On=[];St.middleware=(rr=St.middleware)!==null&&rr!==void 0?rr:[];if(St.middleware.length){const rr=await Er.compose(St.middleware,this.app);On.push(rr)}if(this.app.getFrameworkType()===ur.MidwayFrameworkType.WEB_KOA){if(typeof St.url==="string"&&/\*$/.test(St.url)){St.url=St.url.replace("*","(.*)")}}const ir=[St.routerName,St.url,...On,this.generateController(St)];Sr.debug(`Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);br(`[core]: Load Router "${St.requestMethod.toUpperCase()} ${St.url}"`);cr[St.requestMethod.toLowerCase()].apply(cr,ir)}St&&St(cr)}}}On.WebControllerGenerator=WebControllerGenerator},42193:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});const ir=rr(65308);On["default"]=St=>{const On=(0,ir.isDevelopmentEnvironment)((0,ir.getCurrentEnvironment)());return{core:{healthCheckTimeout:1e3,concurrentDataSourceInitialization:false},asyncContextManager:{enable:false},midwayLogger:{default:{level:"info"},clients:{coreLogger:{level:On?"info":"warn"},appLogger:{aliasName:"logger"}}},debug:{recordConfigMergeOrder:On}}}},2222:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.SINGLETON_CONTAINER_CTX=On.IGNORE_PATTERN=On.DEFAULT_PATTERN=On.ASYNC_CONTEXT_MANAGER_KEY=On.ASYNC_CONTEXT_KEY=On.REQUEST_CTX_LOGGER_CACHE_KEY=On.HTTP_SERVER_KEY=On.CONTAINER_OBJ_SCOPE=On.REQUEST_OBJ_CTX_KEY=On.REQUEST_CTX_KEY=On.MIDWAY_LOGGER_WRITEABLE_DIR=On.FUNCTION_INJECT_KEY=On.KEYS=void 0;On.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"};On.FUNCTION_INJECT_KEY="midway:function_inject_key";On.MIDWAY_LOGGER_WRITEABLE_DIR="MIDWAY_LOGGER_WRITEABLE_DIR";On.REQUEST_CTX_KEY="ctx";On.REQUEST_OBJ_CTX_KEY="_req_ctx";On.CONTAINER_OBJ_SCOPE="_obj_scope";On.HTTP_SERVER_KEY="_midway_http_server";On.REQUEST_CTX_LOGGER_CACHE_KEY="_midway_ctx_logger_cache";On.ASYNC_CONTEXT_KEY=Symbol("ASYNC_CONTEXT_KEY");On.ASYNC_CONTEXT_MANAGER_KEY="MIDWAY_ASYNC_CONTEXT_MANAGER_KEY";On.DEFAULT_PATTERN=["**/**.ts","**/**.js","**/**.mts","**/**.mjs","**/**.cts","**/**.cjs"];On.IGNORE_PATTERN=["**/**.d.ts","**/**.d.mts","**/**.d.cts"];On.SINGLETON_CONTAINER_CTX={_MAIN_CTX_:true}},9288:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayContainer=void 0;const ir=rr(49757);const cr=rr(24451);const ur=rr(39023);const pr=rr(20873);const fr=rr(6192);const br=rr(2222);const Sr=rr(47698);const Er=rr(34881);const kr=rr(80932);const Pr=rr(70275);const Ir=rr(78842);const Lr=rr(24434);const Br=rr(86314);const jr=rr(63289);const Ur=rr(65308);const Vr=ur.debuglog("midway:debug");const Wr=ur.debuglog("midway:bind");const zr=9;class ContainerConfiguration{constructor(St){this.container=St;this.loadedMap=new WeakMap;this.namespaceList=[];this.configurationOptionsList=[]}load(St){let On=ir.MAIN_MODULE_KEY;const rr=this.getConfigurationExport(St);if(!rr.length)return;for(let St=0;St<rr.length;St++){const ur=rr[St];if(this.loadedMap.get(ur)){continue}let pr;if(ur instanceof cr.FunctionalConfiguration){pr=ur.getConfigurationOptions()}else{pr=(0,ir.getClassMetadata)(ir.CONFIGURATION_KEY,ur)}this.loadedMap.set(ur,true);if(pr){if(pr.namespace!==undefined){On=pr.namespace;this.namespaceList.push(On)}this.configurationOptionsList.push(pr);Vr(`[core]: load configuration in namespace="${On}"`);this.addImports(pr.imports);this.addImportObjects(pr.importObjects);this.addImportConfigs(pr.importConfigs);this.addImportConfigFilter(pr.importConfigFilter);this.bindConfigurationClass(ur,On)}}this.container.bindClass(St,{namespace:On})}addImportConfigs(St){if(St){if(Array.isArray(St)){this.container.get(Ir.MidwayConfigService).add(St)}else{this.container.get(Ir.MidwayConfigService).addObject(St)}}}addImportConfigFilter(St){if(St){this.container.get(Ir.MidwayConfigService).addFilter(St)}}addImports(St=[]){var On;for(let rr of St){if(!rr)continue;if(typeof rr==="string"){rr=require(rr)}if("Configuration"in rr){this.load(rr)}else if("component"in rr){if(rr===null||rr===void 0?void 0:rr.enabledEnvironment){if((On=rr===null||rr===void 0?void 0:rr.enabledEnvironment)===null||On===void 0?void 0:On.includes(this.container.get(Pr.MidwayEnvironmentService).getCurrentEnvironment())){this.load(rr.component)}}else{this.load(rr.component)}}else{this.load(rr)}}}addImportObjects(St){if(St){const On=Object.keys(St);for(const rr of On){if(typeof St[rr]!==undefined){this.container.registerObject(rr,St[rr])}}}}bindConfigurationClass(St,On){if(St instanceof cr.FunctionalConfiguration){}else{(0,ir.saveProviderId)(undefined,St);const rr=(0,ir.getProviderUUId)(St);this.container.bind(rr,St,{namespace:On,scope:fr.ScopeEnum.Singleton})}const rr=(0,ir.listModule)(ir.CONFIGURATION_KEY);const ur=rr.find((On=>On.target===St));if(!ur){(0,ir.saveModule)(ir.CONFIGURATION_KEY,{target:St,namespace:On})}}getConfigurationExport(St){const On=[];if(jr.Types.isClass(St)||jr.Types.isFunction(St)||St instanceof cr.FunctionalConfiguration){On.push(St)}else{for(const rr in St){const ir=St[rr];if(jr.Types.isClass(ir)||jr.Types.isFunction(ir)||ir instanceof cr.FunctionalConfiguration){On.push(ir)}}}return On}getNamespaceList(){return this.namespaceList}getConfigurationOptionsList(){return this.configurationOptionsList}}class MidwayContainer{constructor(St){this._resolverFactory=null;this._registry=null;this._identifierMapping=null;this.moduleMap=null;this.parent=null;this.ctx=br.SINGLETON_CONTAINER_CTX;this.attrMap=new Map;this._namespaceSet=null;this.parent=St;this.init()}init(){this.registerObject(br.REQUEST_CTX_KEY,this.ctx)}get objectCreateEventTarget(){if(!this._objectCreateEventTarget){this._objectCreateEventTarget=new Lr}return this._objectCreateEventTarget}get registry(){if(!this._registry){this._registry=new pr.ObjectDefinitionRegistry}return this._registry}set registry(St){this._registry=St}get managedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new kr.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(St){var On,rr,ir;if(!Array.isArray(St)){St=[St]}const cr=new ContainerConfiguration(this);for(const On of St){if(On){cr.load(On)}}for(const St of cr.getNamespaceList()){this.namespaceSet.add(St);Vr(`[core]: load configuration in namespace="${St}" complete`)}const ur=(On=cr.getConfigurationOptionsList())!==null&&On!==void 0?On:[];const pr=(rr=ur.find((St=>!St.namespace)))!==null&&rr!==void 0?rr:{};this.fileDetector=(ir=pr.detector)!==null&&ir!==void 0?ir:this.fileDetector;if(this.fileDetector){this.fileDetector.setExtraDetectorOptions({conflictCheck:pr.conflictCheck,...pr.detectorOptions})}}loadDefinitions(){if(this.fileDetector){return this.fileDetector.run(this)}}bindClass(St,On){if(jr.Types.isClass(St)||jr.Types.isFunction(St)){this.bindModule(St,On)}else{for(const rr in St){const ir=St[rr];if(jr.Types.isClass(ir)||jr.Types.isFunction(ir)){this.bindModule(ir,On)}}}}bind(St,On,rr){var cr;if(jr.Types.isClass(St)||jr.Types.isFunction(St)){return this.bindModule(St,On)}if(this.registry.hasDefinition(St)){return}if(rr===null||rr===void 0?void 0:rr.bindHook){rr.bindHook(On,rr)}let ur;if(jr.Types.isClass(On)){ur=new Sr.ObjectDefinition;ur.name=(0,ir.getProviderName)(On)}else{ur=new Er.FunctionDefinition;if(!jr.Types.isAsyncFunction(On)){ur.asynchronous=false}ur.name=ur.id}ur.path=On;ur.id=St;ur.srcPath=(rr===null||rr===void 0?void 0:rr.srcPath)||null;ur.namespace=(rr===null||rr===void 0?void 0:rr.namespace)||"";ur.scope=(rr===null||rr===void 0?void 0:rr.scope)||fr.ScopeEnum.Request;ur.createFrom=rr===null||rr===void 0?void 0:rr.createFrom;if(ur.srcPath){Vr(`[core]: bind id "${ur.name} (${ur.srcPath}) ${St}"`)}else{Vr(`[core]: bind id "${ur.name}" ${St}`)}const pr=(0,ir.getPropertyInject)(On);for(const St in pr){const On=pr[St];Wr(`${" ".repeat(zr)}inject properties => [${JSON.stringify(On)}]`);const rr=new kr.ManagedReference;rr.args=On.args;rr.name=On.value;rr.injectMode=On["injectMode"];ur.properties.set(On["targetKey"],rr)}const br=(0,ir.getClassExtendedMetadata)(ir.INJECT_CUSTOM_PROPERTY,On);for(const St in br){const On=br[St];ur.handlerProps.push(On)}const Pr=(cr=(0,ir.getObjectDefinition)(On))!==null&&cr!==void 0?cr:{};if(Pr.initMethod){Wr(`${" ".repeat(zr)}register initMethod = ${Pr.initMethod}`);ur.initMethod=Pr.initMethod}if(Pr.destroyMethod){Wr(`${" ".repeat(zr)}register destroyMethod = ${Pr.destroyMethod}`);ur.destroyMethod=Pr.destroyMethod}if(Pr.scope){Wr(`${" ".repeat(zr)}register scope = ${Pr.scope}`);ur.scope=Pr.scope}if(Pr.allowDowngrade){Wr(`${" ".repeat(zr)}register allowDowngrade = ${Pr.allowDowngrade}`);ur.allowDowngrade=Pr.allowDowngrade}this.objectCreateEventTarget.emit(fr.ObjectLifeCycleEvent.BEFORE_BIND,On,{context:this,definition:ur,replaceCallback:St=>{ur=St}});if(ur){this.registry.registerDefinition(ur.id,ur)}}bindModule(St,On){if(jr.Types.isClass(St)){const rr=(0,ir.getProviderUUId)(St);if(rr){this.identifierMapping.saveClassRelation(St,On===null||On===void 0?void 0:On.namespace);this.bind(rr,St,On)}else{}}else{const rr=St[br.FUNCTION_INJECT_KEY];if(rr&&rr.id){if(!rr.scope){rr.scope=fr.ScopeEnum.Request}const ir=Ur.Utils.generateRandomId();this.identifierMapping.saveFunctionRelation(rr.id,ir);this.bind(ir,St,{scope:rr.scope,namespace:On.namespace,srcPath:On.srcPath,createFrom:On.createFrom})}}}setFileDetector(St){this.fileDetector=St}createChild(){return new MidwayContainer(this)}setAttr(St,On){this.attrMap.set(St,On)}getAttr(St){return this.attrMap.get(St)}getIdentifier(St){return(0,ir.getProviderUUId)(St)}getManagedResolverFactory(){if(!this._resolverFactory){this._resolverFactory=new kr.ManagedResolverFactory(this)}return this._resolverFactory}async stop(){await this.getManagedResolverFactory().destroyCache();this.registry.clearAll()}ready(){return this.loadDefinitions()}get(St,On,rr){var ir;On=On!==null&&On!==void 0?On:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const cr=this.registry.getDefinition(St);if(!cr&&this.parent){return this.parent.get(St,On)}if(!cr){throw new Br.MidwayDefinitionNotFoundError((ir=rr===null||rr===void 0?void 0:rr.originName)!==null&&ir!==void 0?ir:St)}return this.getManagedResolverFactory().create({definition:cr,args:On})}async getAsync(St,On,rr){var ir;On=On!==null&&On!==void 0?On:[];rr=rr!==null&&rr!==void 0?rr:{originName:St};if(typeof St!=="string"){rr.originName=St.name;St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const cr=this.registry.getDefinition(St);if(!cr&&this.parent){return this.parent.getAsync(St,On)}if(!cr){throw new Br.MidwayDefinitionNotFoundError((ir=rr===null||rr===void 0?void 0:rr.originName)!==null&&ir!==void 0?ir:St)}return this.getManagedResolverFactory().createAsync({definition:cr,args:On})}registerObject(St,On){this.registry.registerObject(St,On)}onBeforeBind(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_BIND,St)}onBeforeObjectCreated(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_CREATED,St)}onObjectCreated(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.AFTER_CREATED,St)}onObjectInit(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.AFTER_INIT,St)}onBeforeObjectDestroy(St){this.objectCreateEventTarget.on(fr.ObjectLifeCycleEvent.BEFORE_DESTROY,St)}saveModule(St,On){if(!this.moduleMap.has(St)){this.moduleMap.set(St,new Set)}this.moduleMap.get(St).add(On)}listModule(St){return Array.from(this.moduleMap.get(St)||{})}transformModule(St){this.moduleMap=new Map(St)}hasNamespace(St){return this.namespaceSet.has(St)}getNamespaceList(){return Array.from(this.namespaceSet)}hasDefinition(St){return this.registry.hasDefinition(St)}hasObject(St){return this.registry.hasObject(St)}getInstanceScope(St){if(St[br.CONTAINER_OBJ_SCOPE]){return St[br.CONTAINER_OBJ_SCOPE]}return undefined}}On.MidwayContainer=MidwayContainer},20873:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectDefinitionRegistry=void 0;const ir=rr(49757);const cr="_id_default_";class LegacyIdentifierRelation extends Map{saveClassRelation(St,On){const rr=(0,ir.getProviderUUId)(St);this.set(rr,rr);if(rr){const cr=(0,ir.getProviderId)(St);if(cr){this.set(cr,rr)}this.set((0,ir.getProviderName)(St),rr);if(On){this.set(On+":"+(0,ir.getProviderName)(St),rr)}}}saveFunctionRelation(St,On){this.set(On,On);this.set(St,On)}hasRelation(St){return this.has(St)}getRelation(St){return this.get(St)}}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(St){this._identifierRelation=St}get identifiers(){const St=[];for(const On of this.keys()){if(On.indexOf(cr)===-1){St.push(On)}}return St}get count(){return this.size}getSingletonDefinitionIds(){return this.singletonIds}getDefinitionByName(St){const On=[];for(const rr of this.values()){const ir=rr;if(ir.name===St){On.push(ir)}}return On}registerDefinition(St,On){if(On.isSingletonScope()){this.singletonIds.push(St)}this.set(St,On)}getDefinition(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.get(St)}removeDefinition(St){this.delete(St)}hasDefinition(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.has(St)}clearAll(){this.singletonIds=[];this.clear()}hasObject(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.has(cr+St)}registerObject(St,On){this.set(cr+St,On)}getObject(St){var On;St=(On=this.identifierRelation.getRelation(St))!==null&&On!==void 0?On:St;return this.get(cr+St)}getIdentifierRelation(){return this.identifierRelation}setIdentifierRelation(St){this.identifierRelation=St}}On.ObjectDefinitionRegistry=ObjectDefinitionRegistry},80932:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ManagedResolverFactory=On.ManagedReference=void 0;const ir=rr(2222);const cr=rr(6192);const ur=rr(39023);const pr=rr(86314);const fr=ur.debuglog("midway:managedresolver");const br=ur.debuglog("midway:debug");class ManagedReference{constructor(){this.type=ir.KEYS.REF_ELEMENT}}On.ManagedReference=ManagedReference;class RefResolver{constructor(St){this.factory=St}get type(){return ir.KEYS.REF_ELEMENT}resolve(St,On){var rr;const ir=St;if(ir.injectMode===cr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(ir.name)){if(On==="loggerService"){throw new pr.MidwayInconsistentVersionError}else{throw new pr.MidwayMissingImportComponentError(On)}}return this.factory.context.get(ir.name,ir.args,{originName:On})}async resolveAsync(St,On){var rr;const ir=St;if(ir.injectMode===cr.InjectModeEnum.Class&&!((rr=this.factory.context.parent)!==null&&rr!==void 0?rr:this.factory.context).hasDefinition(ir.name)){if(On==="loggerService"){throw new pr.MidwayInconsistentVersionError}else{throw new pr.MidwayMissingImportComponentError(On)}}return this.factory.context.getAsync(ir.name,ir.args,{originName:On})}}class ManagedResolverFactory{constructor(St){this.resolvers={};this.creating=new Map;this.singletonCache=new Map;this.context=St;this.resolvers={ref:new RefResolver(this)}}registerResolver(St){this.resolvers[St.type]=St}resolveManaged(St,On){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new pr.MidwayResolverMissingError(St.type)}return rr.resolve(St,On)}async resolveManagedAsync(St,On){const rr=this.resolvers[St.type];if(!rr||rr.type!==St.type){throw new pr.MidwayResolverMissingError(St.type)}return rr.resolveAsync(St,On)}create(St){const{definition:On,args:rr}=St;if(On.isSingletonScope()&&this.singletonCache.has(On.id)){return this.singletonCache.get(On.id)}let ur=this.createProxyReference(On);if(ur){return ur}this.compareAndSetCreateStatus(On);if(On.hasDependsOn()){for(const St of On.dependsOn){this.context.get(St,rr)}}br(`[core]: Create id = "${On.name}" ${On.id}.`);const fr=On.creator.load();let Sr=[];if(rr&&Array.isArray(rr)&&rr.length>0){Sr=rr}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_CREATED,fr,{constructorArgs:Sr,definition:On,context:this.context});ur=On.creator.doConstruct(fr,Sr,this.context);if(On.isRequestScope()&&On.constructor.name==="ObjectDefinition"){Object.defineProperty(ur,ir.REQUEST_OBJ_CTX_KEY,{value:this.context.get(ir.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(On.properties){const St=On.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(On,rr);try{ur[rr]=this.resolveManaged(On.properties.get(rr),rr)}catch(St){if(pr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=On.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(On,true);throw St}}}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_CREATED,ur,{context:this.context,definition:On,replaceCallback:St=>{ur=St}});On.creator.doInit(ur);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_INIT,ur,{context:this.context,definition:On});if(On.id){if(On.isSingletonScope()){this.singletonCache.set(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Singleton)}else if(On.isRequestScope()){this.context.registerObject(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Request)}else{this.setInstanceScope(ur,cr.ScopeEnum.Prototype)}}this.removeCreateStatus(On,true);return ur}async createAsync(St){const{definition:On,args:rr}=St;if(On.isSingletonScope()&&this.singletonCache.has(On.id)){fr(`id = ${On.id}(${On.name}) get from singleton cache.`);return this.singletonCache.get(On.id)}let ur=this.createProxyReference(On);if(ur){fr(`id = ${On.id}(${On.name}) from proxy reference.`);return ur}this.compareAndSetCreateStatus(On);if(On.hasDependsOn()){for(const St of On.dependsOn){fr("id = %s init depend %s.",On.id,St);await this.context.getAsync(St,rr)}}br(`[core]: Create id = "${On.name}" ${On.id}.`);const Sr=On.creator.load();let Er=[];if(rr&&Array.isArray(rr)&&rr.length>0){Er=rr}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_CREATED,Sr,{constructorArgs:Er,context:this.context});ur=await On.creator.doConstructAsync(Sr,Er,this.context);if(!ur){this.removeCreateStatus(On,false);throw new pr.MidwayCommonError(`${On.id} construct return undefined`)}if(On.isRequestScope()&&On.constructor.name==="ObjectDefinition"){fr("id = %s inject ctx",On.id);Object.defineProperty(ur,ir.REQUEST_OBJ_CTX_KEY,{value:this.context.get(ir.REQUEST_CTX_KEY),writable:false,enumerable:false})}if(On.properties){const St=On.properties.propertyKeys();for(const rr of St){this.checkSingletonInvokeRequest(On,rr);try{ur[rr]=await this.resolveManagedAsync(On.properties.get(rr),rr)}catch(St){if(pr.MidwayDefinitionNotFoundError.isClosePrototypeOf(St)){const rr=On.path.name;St.updateErrorMsg(rr)}this.removeCreateStatus(On,false);throw St}}}this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_CREATED,ur,{context:this.context,definition:On,replaceCallback:St=>{ur=St}});await On.creator.doInitAsync(ur);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.AFTER_INIT,ur,{context:this.context,definition:On});if(On.id){if(On.isSingletonScope()){fr(`id = ${On.id}(${On.name}) set to singleton cache`);this.singletonCache.set(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Singleton)}else if(On.isRequestScope()){fr(`id = ${On.id}(${On.name}) set to register object`);this.context.registerObject(On.id,ur);this.setInstanceScope(ur,cr.ScopeEnum.Request)}else{this.setInstanceScope(ur,cr.ScopeEnum.Prototype)}}this.removeCreateStatus(On,true);return ur}async destroyCache(){for(const St of this.singletonCache.keys()){const On=this.context.registry.getDefinition(St);if(On.creator){const rr=this.singletonCache.get(St);this.getObjectEventTarget().emit(cr.ObjectLifeCycleEvent.BEFORE_DESTROY,rr,{context:this.context,definition:On});await On.creator.doDestroyAsync(rr)}}this.singletonCache.clear();this.creating.clear()}removeCreateStatus(St,On){if(this.creating.has(St.id)){this.creating.set(St.id,false)}return true}isCreating(St){return this.creating.has(St.id)&&this.creating.get(St.id)}compareAndSetCreateStatus(St){if(!this.creating.has(St.id)||!this.creating.get(St.id)){this.creating.set(St.id,true)}}createProxyReference(St){if(this.isCreating(St)){fr("create proxy for %s.",St.id);if(!this.depthFirstSearch(St.id,St)){fr("id = %s after dfs return null",St.id);return null}return new Proxy({__is_proxy__:true,__target_id__:St.id},{get:(On,rr)=>{let ir;if(St.isRequestScope()){ir=this.context.registry.getObject(St.id)}else if(St.isSingletonScope()){ir=this.singletonCache.get(St.id)}else{ir=this.context.get(St.id)}if(ir){if(typeof ir[rr]==="function"){return ir[rr].bind(ir)}return ir[rr]}return undefined}})}return null}depthFirstSearch(St,On,rr){var ir;if(On){fr("dfs for %s == %s start.",St,On.id);if(On.properties){const cr=On.properties.propertyKeys();if(cr.indexOf(St)>-1){fr("dfs exist in properties %s == %s.",St,On.id);return true}for(const ur of cr){if(!Array.isArray(rr)){rr=[St]}let cr=ur;const pr=On.properties.get(ur);if(pr&&pr.name){cr=(ir=this.context.identifierMapping.getRelation(pr.name))!==null&&ir!==void 0?ir:pr.name}if(cr===St){fr("dfs exist in properties key %s == %s.",St,On.id);return true}if(rr.indexOf(cr)>-1){fr("dfs depth circular %s == %s, %s, %j.",St,On.id,cr,rr);continue}else{rr.push(cr);fr("dfs depth push %s == %s, %j.",St,cr,rr)}let br=this.context.registry.getDefinition(cr);if(!br&&this.context.parent){br=this.context.parent.registry.getDefinition(cr)}if(this.depthFirstSearch(St,br,rr)){fr("dfs exist in sub tree %s == %s subId = %s.",St,On.id,br.id);return true}}}fr("dfs for %s == %s end.",St,On.id)}return false}getObjectEventTarget(){if(this.context.parent){return this.context.parent.objectCreateEventTarget}return this.context.objectCreateEventTarget}checkSingletonInvokeRequest(St,On){if(St.isSingletonScope()){const rr=St.properties.get(On);if(this.context.hasDefinition(rr===null||rr===void 0?void 0:rr.name)){const On=this.context.registry.getDefinition(rr.name);if(On.isRequestScope()&&!On.allowDowngrade){throw new pr.MidwaySingletonInjectRequestError(St.path.name,On.path.name)}}}return true}setInstanceScope(St,On){if(typeof St==="object"){if(On===cr.ScopeEnum.Request&&St[ir.REQUEST_OBJ_CTX_KEY]===ir.SINGLETON_CONTAINER_CTX){On=cr.ScopeEnum.Singleton}Object.defineProperty(St,ir.CONTAINER_OBJ_SCOPE,{value:On,writable:false,enumerable:false,configurable:false})}}}On.ManagedResolverFactory=ManagedResolverFactory},28695:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.providerWrapper=void 0;const ir=rr(2222);function providerWrapper(St){for(const On of St){Object.defineProperty(On.provider,ir.FUNCTION_INJECT_KEY,{value:On,writable:false})}}On.providerWrapper=providerWrapper},97983:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayRequestContainer=void 0;const ir=rr(9288);const cr=rr(49757);const ur=rr(2222);class MidwayRequestContainer extends ir.MidwayContainer{constructor(St,On){super(On);this.applicationContext=On;this.registry.setIdentifierRelation(this.applicationContext.registry.getIdentifierRelation());this.ctx=St;this.registerObject(ur.REQUEST_CTX_KEY,St);this.registerObject("res",{});if(St.logger){this.registerObject("logger",St.logger)}}init(){}get(St,On){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===cr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().create({definition:rr,args:On})}}if(this.parent){return this.parent.get(St,On)}}async getAsync(St,On){if(typeof St!=="string"){St=this.getIdentifier(St)}if(this.registry.hasObject(St)){return this.registry.getObject(St)}const rr=this.applicationContext.registry.getDefinition(St);if(rr){if(rr.isRequestScope()||rr.id===cr.PIPELINE_IDENTIFIER){return this.getManagedResolverFactory().createAsync({definition:rr,args:On})}}if(this.parent){return this.parent.getAsync(St,On)}}async ready(){}getContext(){return this.ctx}}On.MidwayRequestContainer=MidwayRequestContainer},76271:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Aspect=void 0;const ir=rr(49757);const cr=rr(18025);const ur=rr(6192);function Aspect(St,On,rr){return function(pr){(0,ir.saveModule)(ir.ASPECT_KEY,pr);const fr=[].concat(St);for(const St of fr){(0,ir.attachClassMetadata)(ir.ASPECT_KEY,{aspectTarget:St,match:On,priority:rr},pr)}(0,cr.Scope)(ur.ScopeEnum.Singleton)(pr);(0,ir.Provide)()(pr)}}On.Aspect=Aspect},2940:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Autoload=void 0;const ir=rr(45317);const cr=rr(39990);function Autoload(){return function(St){(0,ir.savePreloadModule)(St);(0,cr.Provide)()(St)}}On.Autoload=Autoload},73821:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;const ir=rr(49757);function Configuration(St={}){return On=>{(0,ir.saveClassMetadata)(ir.CONFIGURATION_KEY,St,On)}}On.Configuration=Configuration},41573:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Match=On.Catch=void 0;const ir=rr(45317);const cr=rr(75105);const ur=rr(18025);const pr=rr(39990);const fr=rr(6192);function Catch(St,On={}){return function(rr){const br=St?[].concat(St):undefined;(0,ir.saveClassMetadata)(cr.CATCH_KEY,{catchTargets:br,catchOptions:On},rr);(0,ur.Scope)(fr.ScopeEnum.Singleton)(rr);(0,pr.Provide)()(rr)}}On.Catch=Catch;function Match(St=true){return function(On){(0,ir.saveClassMetadata)(cr.MATCH_KEY,{matchPattern:St},On);(0,ur.Scope)(fr.ScopeEnum.Singleton)(On);(0,pr.Provide)()(On)}}On.Match=Match},1623:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApplicationContext=On.Logger=On.App=On.Config=On.Plugin=On.Framework=void 0;const ir=rr(49757);const cr=rr(6192);function Framework(){return St=>{(0,ir.saveModule)(ir.FRAMEWORK_KEY,St);(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Framework=Framework;function Plugin(St){return(0,ir.createCustomPropertyDecorator)(ir.PLUGIN_KEY,{identifier:St})}On.Plugin=Plugin;function Config(St){return(0,ir.createCustomPropertyDecorator)(ir.CONFIG_KEY,{identifier:St})}On.Config=Config;function App(St){return(0,ir.createCustomPropertyDecorator)(ir.APPLICATION_KEY,{type:St})}On.App=App;function Logger(St){return(0,ir.createCustomPropertyDecorator)(ir.LOGGER_KEY,{identifier:St})}On.Logger=Logger;function ApplicationContext(){return(0,ir.createCustomPropertyDecorator)(ir.APPLICATION_CONTEXT_KEY,{})}On.ApplicationContext=ApplicationContext},41958:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Guard=On.UseGuard=void 0;const ir=rr(45317);const cr=rr(6192);const ur=rr(75105);const pr=rr(39990);const fr=rr(18025);function UseGuard(St){return(On,rr,cr)=>{if(!Array.isArray(St)){St=[St]}if(rr){(0,ir.savePropertyMetadata)(ur.GUARD_KEY,St,On,rr)}else{(0,ir.saveClassMetadata)(ur.GUARD_KEY,St,On)}}}On.UseGuard=UseGuard;function Guard(){return St=>{(0,pr.Provide)()(St);(0,fr.Scope)(cr.ScopeEnum.Singleton)(St)}}On.Guard=Guard},92922:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.InjectClient=On.Inject=void 0;const ir=rr(45317);const cr=rr(75105);function Inject(St){return function(On,rr){(0,ir.savePropertyInject)({target:On,targetKey:rr,identifier:St})}}On.Inject=Inject;function InjectClient(St,On){return(0,ir.createCustomPropertyDecorator)(cr.FACTORY_SERVICE_CLIENT_KEY,{serviceFactoryClz:St,clientName:On})}On.InjectClient=InjectClient},17511:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Middleware=void 0;const ir=rr(49757);const cr=rr(6192);function Middleware(){return St=>{(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Middleware=Middleware},56329:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Mock=void 0;const ir=rr(49757);const cr=rr(6192);function Mock(){return St=>{(0,ir.saveModule)(ir.MOCK_KEY,St);(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Mock=Mock},18025:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Singleton=On.Scope=On.Destroy=On.Init=void 0;const ir=rr(45317);const cr=rr(39990);const ur=rr(6192);function Init(){return function(St,On){(0,ir.saveObjectDefinition)(St,{initMethod:On})}}On.Init=Init;function Destroy(){return function(St,On){(0,ir.saveObjectDefinition)(St,{destroyMethod:On})}}On.Destroy=Destroy;function Scope(St,On){return function(rr){(0,ir.saveObjectDefinition)(rr,{scope:St,...On})}}On.Scope=Scope;function Singleton(){return function(St){Scope(ur.ScopeEnum.Singleton)(St);(0,cr.Provide)()(St)}}On.Singleton=Singleton},64331:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Pipe=void 0;const ir=rr(49757);const cr=rr(6192);function Pipe(){return St=>{(0,ir.Scope)(cr.ScopeEnum.Singleton)(St);(0,ir.Provide)()(St)}}On.Pipe=Pipe},52953:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Pipeline=void 0;const ir=rr(45317);const cr=rr(75105);function Pipeline(St){return(0,ir.createCustomPropertyDecorator)(cr.PIPELINE_IDENTIFIER,{valves:St})}On.Pipeline=Pipeline},39990:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Provide=void 0;const ir=rr(45317);function Provide(St){return function(On){return(0,ir.saveProviderId)(St,On)}}On.Provide=Provide},75105:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TAGGED_CLS=On.INJECT_CUSTOM_PARAM=On.INJECT_CUSTOM_METHOD=On.INJECT_CUSTOM_PROPERTY=On.INJECT_TAG=On.NAMED_TAG=On.CLASS_KEY_CONSTRUCTOR=On.APPLICATION_CONTEXT_KEY=On.APPLICATION_KEY=On.LOGGER_KEY=On.PLUGIN_KEY=On.CONFIG_KEY=On.MS_HSF_METHOD_KEY=On.MS_DUBBO_METHOD_KEY=On.MS_GRPC_METHOD_KEY=On.MS_PROVIDER_KEY=On.MS_PRODUCER_KEY=On.MS_CONSUMER_KEY=On.RPC_DUBBO_KEY=On.RPC_GRPC_KEY=On.HSF_KEY=On.WS_EVENT_KEY=On.WS_CONTROLLER_KEY=On.MODULE_TASK_QUEUE_OPTIONS=On.MODULE_TASK_QUEUE_KEY=On.MODULE_TASK_TASK_LOCAL_OPTIONS=On.MODULE_TASK_TASK_LOCAL_KEY=On.MODULE_TASK_METADATA=On.MODULE_TASK_KEY=On.WEB_RESPONSE_RENDER=On.WEB_RESPONSE_CONTENT_TYPE=On.WEB_RESPONSE_HEADER=On.WEB_RESPONSE_REDIRECT=On.WEB_RESPONSE_HTTP_CODE=On.WEB_RESPONSE_KEY=On.WEB_ROUTER_PARAM_KEY=On.WEB_ROUTER_KEY=On.CONTROLLER_KEY=On.SERVERLESS_FUNC_KEY=On.FUNC_KEY=On.FACTORY_SERVICE_CLIENT_KEY=On.MOCK_KEY=On.GUARD_KEY=On.MATCH_KEY=On.CATCH_KEY=On.ASPECT_KEY=On.FRAMEWORK_KEY=On.CONFIGURATION_KEY=On.SCHEDULE_KEY=On.ALL=void 0;On.PRIVATE_META_DATA_KEY=On.MAIN_MODULE_KEY=On.LIFECYCLE_IDENTIFIER_PREFIX=On.PIPELINE_IDENTIFIER=On.OBJ_DEF_CLS=On.TAGGED_FUN=void 0;On.ALL="common:all_value_key";On.SCHEDULE_KEY="common:schedule";On.CONFIGURATION_KEY="common:configuration";On.FRAMEWORK_KEY="common:framework";On.ASPECT_KEY="common:aspect";On.CATCH_KEY="common:catch";On.MATCH_KEY="common:match";On.GUARD_KEY="common:guard";On.MOCK_KEY="common:mock";On.FACTORY_SERVICE_CLIENT_KEY="common:service_factory:client";On.FUNC_KEY="faas:func";On.SERVERLESS_FUNC_KEY="faas:serverless:function";On.CONTROLLER_KEY="web:controller";On.WEB_ROUTER_KEY="web:router";On.WEB_ROUTER_PARAM_KEY="web:router_param";On.WEB_RESPONSE_KEY="web:response";On.WEB_RESPONSE_HTTP_CODE="web:response_http_code";On.WEB_RESPONSE_REDIRECT="web:response_redirect";On.WEB_RESPONSE_HEADER="web:response_header";On.WEB_RESPONSE_CONTENT_TYPE="web:response_content_type";On.WEB_RESPONSE_RENDER="web:response_render";On.MODULE_TASK_KEY="task:task";On.MODULE_TASK_METADATA="task:task:options";On.MODULE_TASK_TASK_LOCAL_KEY="task:task:task_local";On.MODULE_TASK_TASK_LOCAL_OPTIONS="task:task:task_local:options";On.MODULE_TASK_QUEUE_KEY="task:task:queue";On.MODULE_TASK_QUEUE_OPTIONS="task:task:queue:options";On.WS_CONTROLLER_KEY="ws:controller";On.WS_EVENT_KEY="ws:event";On.HSF_KEY="rpc:hsf";On.RPC_GRPC_KEY="rpc:grpc";On.RPC_DUBBO_KEY="rpc:dubbo";On.MS_CONSUMER_KEY="ms:consumer";On.MS_PRODUCER_KEY="ms:producer";On.MS_PROVIDER_KEY="ms:provider";On.MS_GRPC_METHOD_KEY="ms:grpc:method";On.MS_DUBBO_METHOD_KEY="ms:dubbo:method";On.MS_HSF_METHOD_KEY="ms:hsf:method";On.CONFIG_KEY="config";On.PLUGIN_KEY="plugin";On.LOGGER_KEY="logger";On.APPLICATION_KEY="__midway_framework_app__";On.APPLICATION_CONTEXT_KEY="__midway_application_context__";On.CLASS_KEY_CONSTRUCTOR="midway:class_key_constructor";On.NAMED_TAG="named";On.INJECT_TAG="inject";On.INJECT_CUSTOM_PROPERTY="inject_custom_property";On.INJECT_CUSTOM_METHOD="inject_custom_method";On.INJECT_CUSTOM_PARAM="inject_custom_param";On.TAGGED_CLS="injection:tagged_class";On.TAGGED_FUN="injection:tagged_function";On.OBJ_DEF_CLS="injection:object_definition_class";On.PIPELINE_IDENTIFIER="__pipeline_identifier__";On.LIFECYCLE_IDENTIFIER_PREFIX="__lifecycle__";On.MAIN_MODULE_KEY="__main__";On.PRIVATE_META_DATA_KEY="__midway_private_meta_data__"},45317:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createCustomParamDecorator=On.createCustomMethodDecorator=On.createCustomPropertyDecorator=On.getMethodReturnTypes=On.getPropertyType=On.getMethodParamTypes=On.BaseType=On.isProvide=On.getProviderUUId=On.getProviderName=On.getProviderId=On.saveProviderId=On.getObjectDefinition=On.saveObjectDefinition=On.getPropertyInject=On.savePropertyInject=On.transformTypeFromTSDesign=On.clearAllModule=On.resetModule=On.listModule=On.clearBindContainer=On.bindContainer=On.saveModule=On.listPreloadModule=On.savePreloadModule=On.getPropertyMetadata=On.attachPropertyMetadata=On.savePropertyMetadata=On.listPropertyDataFromClass=On.getPropertyDataFromClass=On.attachPropertyDataToClass=On.savePropertyDataToClass=On.getClassMetadata=On.getClassExtendedMetadata=On.attachClassMetadata=On.saveClassMetadata=On.DecoratorManager=On.INJECT_CLASS_KEY_PREFIX=On.PRELOAD_MODULE_KEY=void 0;rr(37159);const ir=rr(6192);const cr=rr(75105);const ur=rr(63289);const pr=rr(90406);const fr=rr(65308);const br=rr(61327);const Sr=rr(39023).debuglog("midway:core");On.PRELOAD_MODULE_KEY="INJECTION_PRELOAD_MODULE_KEY";On.INJECT_CLASS_KEY_PREFIX="INJECTION_CLASS_META_DATA";class DecoratorManager extends Map{constructor(){super(...arguments);this.injectClassKeyPrefix=On.INJECT_CLASS_KEY_PREFIX;this.injectClassMethodKeyPrefix="INJECTION_CLASS_METHOD_META_DATA";this.injectMethodKeyPrefix="INJECTION_METHOD_META_DATA"}saveModule(St,On){if(this.container){return this.container.saveModule(St,On)}if(!this.has(St)){this.set(St,new Set)}this.get(St).add(On)}listModule(St){if(this.container){return this.container.listModule(St)}return Array.from(this.get(St)||{})}resetModule(St){this.set(St,new Set)}bindContainer(St){this.container=St;this.container.transformModule(this)}static getDecoratorClassKey(St){return St.toString()+"_CLS"}static removeDecoratorClassKeySuffix(St){return St.toString().replace("_CLS","")}static getDecoratorMethodKey(St){return St.toString()+"_METHOD"}static getDecoratorClsExtendedKey(St){return St.toString()+"_EXT"}static getDecoratorClsMethodPrefix(St){return St.toString()+"_CLS_METHOD"}static getDecoratorClsMethodKey(St,On){return DecoratorManager.getDecoratorClsMethodPrefix(St)+":"+On.toString()}static getDecoratorMethod(St,On){return DecoratorManager.getDecoratorMethodKey(St)+"_"+On.toString()}static saveMetadata(St,On,rr,ir){if(typeof On==="object"&&On.constructor){On=On.constructor}let cr;if(Reflect.hasOwnMetadata(St,On)){cr=Reflect.getMetadata(St,On)}else{cr=new Map}cr.set(rr,ir);Reflect.defineMetadata(St,cr,On)}static attachMetadata(St,On,rr,ir,cr,ur="one"){if(typeof On==="object"&&On.constructor){On=On.constructor}let pr;if(Reflect.hasOwnMetadata(St,On)){pr=Reflect.getMetadata(St,On)}else{pr=new Map}if(!pr.has(rr)){if(cr){pr.set(rr,{})}else{pr.set(rr,[])}}if(cr){if(ur==="one"){pr.get(rr)[cr]=ir}else{if(pr.get(rr)[cr]){pr.get(rr)[cr].push(ir)}else{pr.get(rr)[cr]=[ir]}}}else{pr.get(rr).push(ir)}Reflect.defineMetadata(St,pr,On)}static getMetadata(St,On,rr){if(typeof On==="object"&&On.constructor){On=On.constructor}let ir;if(!Reflect.hasOwnMetadata(St,On)){ir=new Map;Reflect.defineMetadata(St,ir,On)}else{ir=Reflect.getMetadata(St,On)}if(!rr){return ir}return ir.get(rr)}saveMetadata(St,On,rr,ir){if(ir){const cr=DecoratorManager.getDecoratorMethod(St,ir);DecoratorManager.saveMetadata(this.injectMethodKeyPrefix,rr,cr,On)}else{const ir=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.saveMetadata(this.injectClassKeyPrefix,rr,ir,On)}}attachMetadata(St,On,rr,ir,cr,ur){if(ir){const pr=DecoratorManager.getDecoratorMethod(St,ir);DecoratorManager.attachMetadata(this.injectMethodKeyPrefix,rr,pr,On,cr,ur)}else{const ir=DecoratorManager.getDecoratorClassKey(St);DecoratorManager.attachMetadata(this.injectClassKeyPrefix,rr,ir,On,cr,ur)}}getMetadata(St,On,rr){if(rr){const ir=DecoratorManager.getDecoratorMethod(St,rr);return DecoratorManager.getMetadata(this.injectMethodKeyPrefix,On,ir)}else{const rr=`${DecoratorManager.getDecoratorClassKey(St)}`;return DecoratorManager.getMetadata(this.injectClassKeyPrefix,On,rr)}}savePropertyDataToClass(St,On,rr,ir){const cr=DecoratorManager.getDecoratorClsMethodKey(St,ir);DecoratorManager.saveMetadata(this.injectClassMethodKeyPrefix,rr,cr,On)}attachPropertyDataToClass(St,On,rr,ir,cr){const ur=DecoratorManager.getDecoratorClsMethodKey(St,ir);DecoratorManager.attachMetadata(this.injectClassMethodKeyPrefix,rr,ur,On,cr)}getPropertyDataFromClass(St,On,rr){const ir=DecoratorManager.getDecoratorClsMethodKey(St,rr);return DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,On,ir)}listPropertyDataFromClass(St,On){const rr=DecoratorManager.getMetadata(this.injectClassMethodKeyPrefix,On);const ir=[];for(const[On,cr]of rr){if(On.indexOf(DecoratorManager.getDecoratorClsMethodPrefix(St))!==-1){ir.push(cr)}}return ir}}On.DecoratorManager=DecoratorManager;let Er=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 St=(0,br.getModuleRequirePathList)("@midwayjs/core");if(St.length){console.info("The module may be located in:");St.forEach(((St,On)=>{console.info(`${On+1}. ${St}`)}))}Er=global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]}else{global["MIDWAY_GLOBAL_DECORATOR_MANAGER"]=Er}}function saveClassMetadata(St,On,rr,ir){if(ir&&typeof On==="object"){const ir=Er.getMetadata(St,rr);if(!ir){return Er.saveMetadata(St,On,rr)}if(Array.isArray(ir)){return Er.saveMetadata(St,ir.concat(On),rr)}else{return Er.saveMetadata(St,Object.assign(ir,On),rr)}}else{return Er.saveMetadata(St,On,rr)}}On.saveClassMetadata=saveClassMetadata;function attachClassMetadata(St,On,rr,ir,cr){return Er.attachMetadata(St,On,rr,undefined,ir,cr)}On.attachClassMetadata=attachClassMetadata;function getClassExtendedMetadata(St,On,rr,ir){if(ir===undefined){ir=true}const cr=DecoratorManager.getDecoratorClsExtendedKey(St);let ur=Er.getMetadata(cr,On,rr);if(ir&&ur!==undefined){return ur}const pr=Reflect.getPrototypeOf(On);if(pr&&pr.constructor!==Object){ur=(0,fr.merge)(getClassExtendedMetadata(St,pr,rr,ir),Er.getMetadata(St,On,rr))}Er.saveMetadata(cr,ur||null,On,rr);return ur}On.getClassExtendedMetadata=getClassExtendedMetadata;function getClassMetadata(St,On){return Er.getMetadata(St,On)}On.getClassMetadata=getClassMetadata;function savePropertyDataToClass(St,On,rr,ir){return Er.savePropertyDataToClass(St,On,rr,ir)}On.savePropertyDataToClass=savePropertyDataToClass;function attachPropertyDataToClass(St,On,rr,ir,cr){return Er.attachPropertyDataToClass(St,On,rr,ir,cr)}On.attachPropertyDataToClass=attachPropertyDataToClass;function getPropertyDataFromClass(St,On,rr){return Er.getPropertyDataFromClass(St,On,rr)}On.getPropertyDataFromClass=getPropertyDataFromClass;function listPropertyDataFromClass(St,On){return Er.listPropertyDataFromClass(St,On)}On.listPropertyDataFromClass=listPropertyDataFromClass;function savePropertyMetadata(St,On,rr,ir){return Er.saveMetadata(St,On,rr,ir)}On.savePropertyMetadata=savePropertyMetadata;function attachPropertyMetadata(St,On,rr,ir){return Er.attachMetadata(St,On,rr,ir)}On.attachPropertyMetadata=attachPropertyMetadata;function getPropertyMetadata(St,On,rr){return Er.getMetadata(St,On,rr)}On.getPropertyMetadata=getPropertyMetadata;function savePreloadModule(St){return saveModule(On.PRELOAD_MODULE_KEY,St)}On.savePreloadModule=savePreloadModule;function listPreloadModule(){return listModule(On.PRELOAD_MODULE_KEY)}On.listPreloadModule=listPreloadModule;function saveModule(St,On){if((0,ur.isClass)(On)){saveProviderId(undefined,On)}return Er.saveModule(St,On)}On.saveModule=saveModule;function bindContainer(St){return Er.bindContainer(St)}On.bindContainer=bindContainer;function clearBindContainer(){return Er.container=null}On.clearBindContainer=clearBindContainer;function listModule(St,On){const rr=Er.listModule(St);if(On){return rr.filter(On)}else{return rr}}On.listModule=listModule;function resetModule(St){return Er.resetModule(St)}On.resetModule=resetModule;function clearAllModule(){Sr("--- clear all module here ---");return Er.clear()}On.clearAllModule=clearAllModule;function transformTypeFromTSDesign(St){if((0,ur.isNullOrUndefined)(St)){return{name:"undefined",isBaseType:true,originDesign:St}}switch(St.name){case"String":return{name:"string",isBaseType:true,originDesign:St};case"Number":return{name:"number",isBaseType:true,originDesign:St};case"Boolean":return{name:"boolean",isBaseType:true,originDesign:St};case"Symbol":return{name:"symbol",isBaseType:true,originDesign:St};case"Object":return{name:"object",isBaseType:true,originDesign:St};case"Function":return{name:"function",isBaseType:true,originDesign:St};default:return{name:St.name,isBaseType:false,originDesign:St}}}On.transformTypeFromTSDesign=transformTypeFromTSDesign;function savePropertyInject(St){let On=St.identifier;let rr=ir.InjectModeEnum.Identifier;if(!On){const cr=getPropertyType(St.target,St.targetKey);if(!cr.isBaseType&&(0,ur.isClass)(cr.originDesign)&&isProvide(cr.originDesign)){On=getProviderUUId(cr.originDesign);rr=ir.InjectModeEnum.Class}if(!On){On=St.targetKey;rr=ir.InjectModeEnum.PropertyName}}attachClassMetadata(cr.INJECT_TAG,{targetKey:St.targetKey,value:On,args:St.args,injectMode:rr},St.target,St.targetKey)}On.savePropertyInject=savePropertyInject;function getPropertyInject(St,On){return getClassExtendedMetadata(cr.INJECT_TAG,St,undefined,On)}On.getPropertyInject=getPropertyInject;function saveObjectDefinition(St,On={}){saveClassMetadata(cr.OBJ_DEF_CLS,On,St,true);return St}On.saveObjectDefinition=saveObjectDefinition;function getObjectDefinition(St){return getClassExtendedMetadata(cr.OBJ_DEF_CLS,St)}On.getObjectDefinition=getObjectDefinition;function saveProviderId(St,On){if(isProvide(On)){if(St){const rr=getClassMetadata(cr.TAGGED_CLS,On);if(rr.id!==St){rr.id=St;saveClassMetadata(cr.TAGGED_CLS,rr,On);Sr(`update provide: ${On.name} -> ${rr.uuid}`)}}}else{const rr=(0,fr.generateRandomId)();saveClassMetadata(cr.TAGGED_CLS,{id:St,originName:On.name,uuid:rr,name:(0,pr.camelCase)(On.name)},On);Sr(`save provide: ${On.name} -> ${rr}`)}return On}On.saveProviderId=saveProviderId;function getProviderId(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.id){return On.id}}On.getProviderId=getProviderId;function getProviderName(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.name){return On.name}}On.getProviderName=getProviderName;function getProviderUUId(St){const On=getClassMetadata(cr.TAGGED_CLS,St);if(On&&On.uuid){return On.uuid}}On.getProviderUUId=getProviderUUId;function isProvide(St){return!!getClassMetadata(cr.TAGGED_CLS,St)}On.isProvide=isProvide;var kr;(function(St){St["Boolean"]="boolean";St["Number"]="number";St["String"]="string"})(kr=On.BaseType||(On.BaseType={}));function getMethodParamTypes(St,On){if((0,ur.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:paramtypes",St,On)}On.getMethodParamTypes=getMethodParamTypes;function getPropertyType(St,On){return transformTypeFromTSDesign(Reflect.getMetadata("design:type",St,On))}On.getPropertyType=getPropertyType;function getMethodReturnTypes(St,On){if((0,ur.isClass)(St)){St=St.prototype}return Reflect.getMetadata("design:returntype",St,On)}On.getMethodReturnTypes=getMethodReturnTypes;function createCustomPropertyDecorator(St,On,rr=true){return function(ir,ur){attachClassMetadata(cr.INJECT_CUSTOM_PROPERTY,{propertyName:ur,key:St,metadata:On,impl:rr},ir,ur)}}On.createCustomPropertyDecorator=createCustomPropertyDecorator;function createCustomMethodDecorator(St,On,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(ir,ur,pr){attachClassMetadata(cr.INJECT_CUSTOM_METHOD,{propertyName:ur,key:St,metadata:On,options:rr},ir)}}On.createCustomMethodDecorator=createCustomMethodDecorator;function createCustomParamDecorator(St,On,rr={impl:true}){if(typeof rr==="boolean"){rr={impl:rr}}if(rr.impl===undefined){rr.impl=true}return function(ir,ur,pr){attachClassMetadata(cr.INJECT_CUSTOM_PARAM,{key:St,parameterIndex:pr,propertyName:ur,metadata:On,options:rr},ir,ur,"multi")}}On.createCustomParamDecorator=createCustomParamDecorator},69193:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerlessTrigger=On.ServerlessFunction=void 0;const ir=rr(49757);const cr=rr(6192);function ServerlessFunction(St){return(On,rr,cr)=>{(0,ir.savePropertyMetadata)(ir.SERVERLESS_FUNC_KEY,St,On,rr)}}On.ServerlessFunction=ServerlessFunction;function ServerlessTrigger(St,On={}){return(rr,ur,pr)=>{var fr;if(St===cr.ServerlessTriggerType.HTTP||St===cr.ServerlessTriggerType.API_GATEWAY){On["method"]=(fr=On["method"])!==null&&fr!==void 0?fr:"get"}(0,ir.saveModule)(ir.FUNC_KEY,rr.constructor);On=On||{};(0,ir.attachClassMetadata)(ir.FUNC_KEY,{type:St,methodName:ur,metadata:On},rr)}}On.ServerlessTrigger=ServerlessTrigger},49757:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(39990),On);cr(rr(92922),On);cr(rr(52953),On);cr(rr(76271),On);cr(rr(2940),On);cr(rr(73821),On);cr(rr(18025),On);cr(rr(1623),On);cr(rr(41573),On);cr(rr(17511),On);cr(rr(41958),On);cr(rr(64331),On);cr(rr(56329),On);cr(rr(69193),On);cr(rr(86690),On);cr(rr(58843),On);cr(rr(29619),On);cr(rr(92233),On);cr(rr(75105),On);cr(rr(45317),On);cr(rr(573),On);cr(rr(4132),On);cr(rr(76543),On);cr(rr(64767),On);cr(rr(41684),On);cr(rr(17640),On);cr(rr(81970),On);cr(rr(52963),On);cr(rr(57706),On);cr(rr(67999),On);cr(rr(20551),On)},573:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Consumer=void 0;const ir=rr(49757);const cr=rr(6192);function Consumer(St,On={}){return rr=>{(0,ir.saveModule)(ir.MS_CONSUMER_KEY,rr);(0,ir.saveClassMetadata)(ir.MS_CONSUMER_KEY,{type:St,metadata:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Consumer=Consumer},64767:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.KafkaListener=void 0;const ir=rr(49757);function KafkaListener(St,On={}){return(rr,cr)=>{On.topic=St;On.propertyKey=cr;(0,ir.attachPropertyDataToClass)(ir.MS_CONSUMER_KEY,On,rr,cr)}}On.KafkaListener=KafkaListener},4132:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DubboMethod=On.GrpcMethod=On.GrpcStreamTypeEnum=On.Provider=void 0;const ir=rr(49757);const cr=rr(6192);function Provider(St,On={}){return rr=>{(0,ir.saveModule)(ir.MS_PROVIDER_KEY,rr);(0,ir.saveClassMetadata)(ir.MS_PROVIDER_KEY,{type:St,metadata:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Provider=Provider;var ur;(function(St){St["BASE"]="base";St["DUPLEX"]="ServerDuplexStream";St["READABLE"]="ServerReadableStream";St["WRITEABLE"]="ServerWritableStream"})(ur=On.GrpcStreamTypeEnum||(On.GrpcStreamTypeEnum={}));function GrpcMethod(St={}){return(On,rr,cr)=>{if(!St.type){St.type=ur.BASE}(0,ir.savePropertyMetadata)(ir.MS_GRPC_METHOD_KEY,{methodName:St.methodName||rr,type:St.type,onEnd:St.onEnd},On,rr);return cr}}On.GrpcMethod=GrpcMethod;function DubboMethod(St){return(On,rr,cr)=>{(0,ir.attachClassMetadata)(ir.MS_DUBBO_METHOD_KEY,{methodName:St||rr},On);return cr}}On.DubboMethod=DubboMethod},76543:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.RabbitMQListener=void 0;const ir=rr(49757);function RabbitMQListener(St,On={}){return(rr,cr)=>{On.queueName=St;On.propertyKey=cr;(0,ir.attachPropertyDataToClass)(ir.MS_CONSUMER_KEY,On,rr,cr)}}On.RabbitMQListener=RabbitMQListener},41684:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HSF=void 0;const ir=rr(49757);const cr=rr(6192);function HSF(St={}){return On=>{(0,ir.saveModule)(ir.HSF_KEY,On);(0,ir.saveClassMetadata)(ir.HSF_KEY,St,On);(0,ir.Scope)(cr.ScopeEnum.Request)(On);(0,ir.Provide)()(On)}}On.HSF=HSF},17640:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Queue=void 0;const ir=rr(49757);const cr=rr(75105);function Queue(St){return function(On){(0,ir.saveModule)(cr.MODULE_TASK_QUEUE_KEY,On);(0,ir.saveClassMetadata)(cr.MODULE_TASK_QUEUE_OPTIONS,{options:St,name:On.name},On);(0,ir.Provide)()(On)}}On.Queue=Queue},57706:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Schedule=void 0;const ir=rr(49757);const cr=rr(6192);function Schedule(St){return function(On){(0,ir.saveModule)(ir.SCHEDULE_KEY,On);(0,ir.saveClassMetadata)(ir.SCHEDULE_KEY,St,On);(0,ir.Scope)(cr.ScopeEnum.Request)(On);(0,ir.Provide)()(On)}}On.Schedule=Schedule},81970:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Task=void 0;const ir=rr(49757);const cr=rr(75105);function Task(St){return function(On,rr,ur){(0,ir.saveModule)(cr.MODULE_TASK_KEY,On.constructor);(0,ir.attachClassMetadata)(cr.MODULE_TASK_METADATA,{options:St,propertyKey:rr,value:ur.value,name:On.constructor.name},On)}}On.Task=Task},52963:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.TaskLocal=void 0;const ir=rr(49757);const cr=rr(75105);function TaskLocal(St){return function(On,rr,ur){(0,ir.saveModule)(cr.MODULE_TASK_TASK_LOCAL_KEY,On.constructor);(0,ir.attachClassMetadata)(cr.MODULE_TASK_TASK_LOCAL_OPTIONS,{options:St,propertyKey:rr,value:ur.value},On)}}On.TaskLocal=TaskLocal},86690:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Controller=void 0;const ir=rr(49757);const cr=rr(6192);function Controller(St="/",On={middleware:[],sensitive:true}){return rr=>{(0,ir.saveModule)(ir.CONTROLLER_KEY,rr);if(St)(0,ir.saveClassMetadata)(ir.CONTROLLER_KEY,{prefix:St,routerOptions:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.Controller=Controller},58843:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Fields=On.Queries=On.RequestIP=On.RequestPath=On.Files=On.File=On.Headers=On.Param=On.Query=On.Body=On.Session=On.createRequestParamDecorator=On.RouteParamTypes=void 0;const ir=rr(49757);var cr;(function(St){St["QUERY"]="query";St["BODY"]="body";St["PARAM"]="param";St["HEADERS"]="headers";St["SESSION"]="session";St["FILESTREAM"]="file_stream";St["FILESSTREAM"]="files_stream";St["NEXT"]="next";St["REQUEST_PATH"]="request_path";St["REQUEST_IP"]="request_ip";St["QUERIES"]="queries";St["FIELDS"]="fields";St["CUSTOM"]="custom"})(cr=On.RouteParamTypes||(On.RouteParamTypes={}));const createParamMapping=function(St){return(On,rr={})=>{let cr=On;if(Array.isArray(On)&&rr.pipes===undefined){rr.pipes=On;cr=undefined}return(0,ir.createCustomParamDecorator)(ir.WEB_ROUTER_PARAM_KEY,{type:St,propertyData:cr},rr)}};const createRequestParamDecorator=function(St,On){On=On||{};if(Array.isArray(On)){On={pipes:On}}return createParamMapping(cr.CUSTOM)(St,On)};On.createRequestParamDecorator=createRequestParamDecorator;const Session=(St,On)=>createParamMapping(cr.SESSION)(St,{pipes:On});On.Session=Session;const Body=(St,On)=>createParamMapping(cr.BODY)(St,{pipes:On});On.Body=Body;const Query=(St,On)=>createParamMapping(cr.QUERY)(St,{pipes:On});On.Query=Query;const Param=(St,On)=>createParamMapping(cr.PARAM)(St,{pipes:On});On.Param=Param;const Headers=(St,On)=>createParamMapping(cr.HEADERS)(St,{pipes:On});On.Headers=Headers;const File=(St,On)=>createParamMapping(cr.FILESTREAM)(St,{pipes:On});On.File=File;const Files=(St,On)=>createParamMapping(cr.FILESSTREAM)(St,{pipes:On});On.Files=Files;const RequestPath=St=>createParamMapping(cr.REQUEST_PATH)(undefined,{pipes:St});On.RequestPath=RequestPath;const RequestIP=St=>createParamMapping(cr.REQUEST_IP)(undefined,{pipes:St});On.RequestIP=RequestIP;const Queries=(St,On)=>createParamMapping(cr.QUERIES)(St,{pipes:On});On.Queries=Queries;const Fields=(St,On)=>createParamMapping(cr.FIELDS)(St,{pipes:On});On.Fields=Fields},29619:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.All=On.Head=On.Options=On.Patch=On.Put=On.Del=On.Get=On.Post=On.RequestMapping=On.RequestMethod=void 0;const ir=rr(49757);On.RequestMethod={GET:"get",POST:"post",PUT:"put",DELETE:"delete",PATCH:"patch",ALL:"all",OPTIONS:"options",HEAD:"head"};const cr={path:"/",requestMethod:On.RequestMethod.GET,routerName:null,middleware:[]};const RequestMapping=(St=cr)=>{const rr=St.path||"/";const ur=St.requestMethod||On.RequestMethod.GET;const pr=St.routerName;const fr=St.middleware;return(On,cr,br)=>{var Sr;(0,ir.attachClassMetadata)(ir.WEB_ROUTER_KEY,{path:rr,requestMethod:ur,routerName:pr,method:cr,middleware:fr,summary:(St===null||St===void 0?void 0:St.summary)||"",description:(St===null||St===void 0?void 0:St.description)||"",ignoreGlobalPrefix:(Sr=St===null||St===void 0?void 0:St.ignoreGlobalPrefix)!==null&&Sr!==void 0?Sr:false},On);return br}};On.RequestMapping=RequestMapping;const createMappingDecorator=St=>(rr,ir={middleware:[]})=>(0,On.RequestMapping)(Object.assign(ir,{requestMethod:St,path:rr}));On.Post=createMappingDecorator(On.RequestMethod.POST);On.Get=createMappingDecorator(On.RequestMethod.GET);On.Del=createMappingDecorator(On.RequestMethod.DELETE);On.Put=createMappingDecorator(On.RequestMethod.PUT);On.Patch=createMappingDecorator(On.RequestMethod.PATCH);On.Options=createMappingDecorator(On.RequestMethod.OPTIONS);On.Head=createMappingDecorator(On.RequestMethod.HEAD);On.All=createMappingDecorator(On.RequestMethod.ALL)},92233:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createRender=On.ContentType=On.SetHeader=On.HttpCode=On.Redirect=void 0;const ir=rr(49757);function Redirect(St,On=302){return(rr,cr,ur)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_REDIRECT,url:St,code:On},rr,cr);return ur}}On.Redirect=Redirect;function HttpCode(St){return(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_HTTP_CODE,code:St},On,rr);return cr}}On.HttpCode=HttpCode;function SetHeader(St,On){return(rr,cr,ur)=>{let pr={};if(On){pr[St]=On}else{pr=St}(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_HEADER,setHeaders:pr},rr,cr);return ur}}On.SetHeader=SetHeader;function ContentType(St){return(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_CONTENT_TYPE,contentType:St},On,rr);return cr}}On.ContentType=ContentType;function createRender(St){return St=>(On,rr,cr)=>{(0,ir.attachPropertyMetadata)(ir.WEB_RESPONSE_KEY,{type:ir.WEB_RESPONSE_RENDER,templateName:St},On,rr);return cr}}On.createRender=createRender},67999:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.WSController=void 0;const ir=rr(49757);const cr=rr(6192);function WSController(St="/",On={middleware:[],connectionMiddleware:[]}){return rr=>{(0,ir.saveModule)(ir.WS_CONTROLLER_KEY,rr);(0,ir.saveClassMetadata)(ir.WS_CONTROLLER_KEY,{namespace:St,routerOptions:On},rr);(0,ir.Scope)(cr.ScopeEnum.Request)(rr);(0,ir.Provide)()(rr)}}On.WSController=WSController},20551:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.OnConnection=On.OnDisConnection=On.Emit=On.OnMessage=On.WSBroadCast=On.WSEmit=On.OnWSMessage=On.OnWSDisConnection=On.OnWSConnection=On.WSEventTypeEnum=void 0;const ir=rr(49757);var cr;(function(St){St["ON_CONNECTION"]="ws:onConnection";St["ON_DISCONNECTION"]="ws:onDisconnection";St["ON_MESSAGE"]="ws:onMessage";St["ON_SOCKET_ERROR"]="ws:onSocketError";St["EMIT"]="ws:Emit";St["BROADCAST"]="ws:broadcast"})(cr=On.WSEventTypeEnum||(On.WSEventTypeEnum={}));function OnWSConnection(St={}){return(On,rr,ur)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_CONNECTION,propertyName:rr,eventOptions:St,descriptor:ur},On.constructor)}}On.OnWSConnection=OnWSConnection;function OnWSDisConnection(){return(St,On,rr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_DISCONNECTION,propertyName:On,descriptor:rr},St.constructor)}}On.OnWSDisConnection=OnWSDisConnection;function OnWSMessage(St,On={}){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.ON_MESSAGE,messageEventName:St,propertyName:ur,eventOptions:On,descriptor:pr},rr.constructor)}}On.OnWSMessage=OnWSMessage;function WSEmit(St,On=[]){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.EMIT,propertyName:ur,messageEventName:St,roomName:[].concat(On),descriptor:pr},rr.constructor)}}On.WSEmit=WSEmit;function WSBroadCast(St="",On=[]){return(rr,ur,pr)=>{(0,ir.attachClassMetadata)(ir.WS_EVENT_KEY,{eventType:cr.BROADCAST,propertyName:ur,messageEventName:St,roomName:[].concat(On),descriptor:pr},rr.constructor)}}On.WSBroadCast=WSBroadCast;On.OnMessage=OnWSMessage;On.Emit=WSEmit;On.OnDisConnection=OnWSDisConnection;On.OnConnection=OnWSConnection},34881:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FunctionDefinition=void 0;const ir=rr(6192);const cr=rr(59327);class FunctionWrapperCreator extends cr.ObjectCreator{doConstruct(St,On,rr){if(!St){return null}return St(rr,On)}async doConstructAsync(St,On,rr){if(!St){return null}return St(rr,On)}}class FunctionDefinition{constructor(){this.constructorArgs=[];this.namespace="";this.asynchronous=true;this.handlerProps=[];this.allowDowngrade=false;this.innerAutowire=false;this.innerScope=ir.ScopeEnum.Singleton;this.creator=new FunctionWrapperCreator(this)}getAttr(St){}hasAttr(St){return false}hasConstructorArgs(){return false}hasDependsOn(){return false}isAsync(){return this.asynchronous}isDirect(){return false}isExternal(){return false}set scope(St){this.innerScope=St}isSingletonScope(){return this.innerScope===ir.ScopeEnum.Singleton}isRequestScope(){return this.innerScope===ir.ScopeEnum.Request}setAttr(St,On){}}On.FunctionDefinition=FunctionDefinition},59327:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectCreator=void 0;const ir=rr(86314);const cr=rr(63289);class ObjectCreator{constructor(St){this.definition=St}load(){let St=null;if(typeof this.definition.path==="string"){if(!this.definition.path){return St}const On=this.definition.path;if(this.definition.export){St=require(On)[this.definition.export]}else{St=require(On)}}else{St=this.definition.path}return St}doConstruct(St,On){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){rr=St[this.definition.constructMethod].apply(St,On)}else{rr=Reflect.construct(St,On)}return rr}async doConstructAsync(St,On){if(!St){return Object.create(null)}let rr;if(this.definition.constructMethod){const ir=St[this.definition.constructMethod];if(cr.Types.isAsyncFunction(ir)){rr=await ir.apply(St,On)}else{rr=ir.apply(St,On)}}else{rr=Reflect.construct(St,On)}return rr}doInit(St){const On=St;if(this.definition.initMethod&&On[this.definition.initMethod]){if(cr.Types.isGeneratorFunction(On[this.definition.initMethod])||cr.Types.isAsyncFunction(On[this.definition.initMethod])){throw new ir.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}else{const St=On[this.definition.initMethod].call(On);if(cr.Types.isPromise(St)){throw new ir.MidwayUseWrongMethodError("context.get","context.getAsync",this.definition.id)}}}}async doInitAsync(St){const On=St;if(this.definition.initMethod&&On[this.definition.initMethod]){const St=On[this.definition.initMethod];if(cr.Types.isAsyncFunction(St)){await St.call(On)}else{if(St.length===1){await new Promise((rr=>{St.call(On,rr)}))}else{St.call(On)}}}}doDestroy(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){St[this.definition.destroyMethod].call(St)}}async doDestroyAsync(St){if(this.definition.destroyMethod&&St[this.definition.destroyMethod]){const On=St[this.definition.destroyMethod];if(cr.Types.isAsyncFunction(On)){await On.call(St)}else{if(On.length===1){await new Promise((rr=>{On.call(St,rr)}))}else{On.call(St)}}}}}On.ObjectCreator=ObjectCreator},47698:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectDefinition=void 0;const ir=rr(6192);const cr=rr(74701);const ur=rr(59327);class ObjectDefinition{constructor(){this._attrs=new Map;this._asynchronous=false;this.scope=ir.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 cr.ObjectProperties;this.namespace="";this.handlerProps=[];this.allowDowngrade=false;this.creator=new ur.ObjectCreator(this)}set asynchronous(St){this._asynchronous=St}isAsync(){return this._asynchronous}isSingletonScope(){return this.scope===ir.ScopeEnum.Singleton}isRequestScope(){return this.scope===ir.ScopeEnum.Request}hasDependsOn(){return this.dependsOn.length>0}hasConstructorArgs(){return this.constructorArgs.length>0}getAttr(St){return this._attrs.get(St)}hasAttr(St){return this._attrs.has(St)}setAttr(St,On){this._attrs.set(St,On)}}On.ObjectDefinition=ObjectDefinition},74701:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ObjectProperties=void 0;class ObjectProperties extends Map{propertyKeys(){return Array.from(this.keys())}getProperty(St,On){if(this.has(St)){return this.get(St)}return On}setProperty(St,On){return this.set(St,On)}}On.ObjectProperties=ObjectProperties},21769:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayHttpError=On.MidwayError=On.registerErrorCode=void 0;const ir=rr(58611);const cr=new Set;function registerErrorCode(St,On){if(cr.has(St)){throw new MidwayError(`Error group ${St} is duplicated, please check before adding.`)}else{cr.add(St)}const rr={};for(const ir in On){rr[ir]=St.toUpperCase()+"_"+String(On[ir]).toUpperCase()}return rr}On.registerErrorCode=registerErrorCode;class MidwayError extends Error{constructor(St,On,rr){super(St);if(!On||typeof On==="object"){rr=On;On="MIDWAY_10000"}this.name=this.constructor.name;this.code=On;this.cause=rr===null||rr===void 0?void 0:rr.cause}}On.MidwayError=MidwayError;class MidwayHttpError extends MidwayError{constructor(St,On,rr,cr){super(St?typeof St==="string"?St:St.message:ir.STATUS_CODES[On],rr!==null&&rr!==void 0?rr:String(On),cr);if(St&&St["stack"]){this.stack=St["stack"]}this.status=On}}On.MidwayHttpError=MidwayHttpError},37198:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayEmptyValueError=On.MidwayInvalidConfigPropertyError=On.MidwayMainFrameworkMissingError=On.MidwayCodeInvokeTimeoutError=On.MidwayInvokeForbiddenError=On.MidwayRetryExceededMaxTimesError=On.MidwayDuplicateControllerOptionsError=On.MidwayDuplicateClassNameError=On.MidwayInconsistentVersionError=On.MidwayUtilHttpClientTimeoutError=On.MidwayMissingImportComponentError=On.MidwaySingletonInjectRequestError=On.MidwayUseWrongMethodError=On.MidwayDuplicateRouteError=On.MidwayResolverMissingError=On.MidwayInvalidConfigError=On.MidwayConfigMissingError=On.MidwayFeatureNotImplementedError=On.MidwayFeatureNoLongerSupportedError=On.MidwayDefinitionNotFoundError=On.MidwayParameterError=On.MidwayCommonError=On.FrameworkErrorEnum=void 0;const ir=rr(21769);On.FrameworkErrorEnum=(0,ir.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 ir.MidwayError{constructor(St){super(St,On.FrameworkErrorEnum.COMMON)}}On.MidwayCommonError=MidwayCommonError;class MidwayParameterError extends ir.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"Parameter type not match",On.FrameworkErrorEnum.PARAM_TYPE)}}On.MidwayParameterError=MidwayParameterError;class MidwayDefinitionNotFoundError extends ir.MidwayError{static isClosePrototypeOf(St){return St?St[MidwayDefinitionNotFoundError.type]===MidwayDefinitionNotFoundError.type:false}constructor(St){super(`${St} is not valid in current context`,On.FrameworkErrorEnum.DEFINITION_NOT_FOUND);this[MidwayDefinitionNotFoundError.type]=MidwayDefinitionNotFoundError.type}updateErrorMsg(St){const On=this.message.split(" is not valid in current context")[0];this.message=`${On} in class ${St} is not valid in current context`}}On.MidwayDefinitionNotFoundError=MidwayDefinitionNotFoundError;MidwayDefinitionNotFoundError.type=Symbol.for("#NotFoundError");class MidwayFeatureNoLongerSupportedError extends ir.MidwayError{constructor(St){super("This feature no longer supported \n"+St,On.FrameworkErrorEnum.FEATURE_NO_LONGER_SUPPORTED)}}On.MidwayFeatureNoLongerSupportedError=MidwayFeatureNoLongerSupportedError;class MidwayFeatureNotImplementedError extends ir.MidwayError{constructor(St){super("This feature not implemented \n"+St,On.FrameworkErrorEnum.FEATURE_NOT_IMPLEMENTED)}}On.MidwayFeatureNotImplementedError=MidwayFeatureNotImplementedError;class MidwayConfigMissingError extends ir.MidwayError{constructor(St){super(`Can't found config key "${St}" in your config, please set it first`,On.FrameworkErrorEnum.MISSING_CONFIG)}}On.MidwayConfigMissingError=MidwayConfigMissingError;class MidwayInvalidConfigError extends ir.MidwayError{constructor(St){super("Invalid config file \n"+St,On.FrameworkErrorEnum.INVALID_CONFIG)}}On.MidwayInvalidConfigError=MidwayInvalidConfigError;class MidwayResolverMissingError extends ir.MidwayError{constructor(St){super(`Resolver "${St}" is missing.`,On.FrameworkErrorEnum.MISSING_RESOLVER)}}On.MidwayResolverMissingError=MidwayResolverMissingError;class MidwayDuplicateRouteError extends ir.MidwayError{constructor(St,rr,ir){super(`Duplicate router "${St}" at "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_ROUTER)}}On.MidwayDuplicateRouteError=MidwayDuplicateRouteError;class MidwayUseWrongMethodError extends ir.MidwayError{constructor(St,rr,ir){const cr=ir?`${ir} not valid by ${St}, Use ${rr} instead!`:`You should not invoked by ${St}, Use ${rr} instead!`;super(cr,On.FrameworkErrorEnum.USE_WRONG_METHOD)}}On.MidwayUseWrongMethodError=MidwayUseWrongMethodError;class MidwaySingletonInjectRequestError extends ir.MidwayError{constructor(St,rr){const ir=`${St} with singleton scope can't implicitly inject ${rr} with request scope directly, please add "@Scope(ScopeEnum.Request, { allowDowngrade: true })" in ${rr} or use "ctx.requestContext.getAsync(${rr})".`;super(ir,On.FrameworkErrorEnum.SINGLETON_INJECT_REQUEST)}}On.MidwaySingletonInjectRequestError=MidwaySingletonInjectRequestError;class MidwayMissingImportComponentError extends ir.MidwayError{constructor(St){const rr=`"${St}" can't inject and maybe forgot add "{imports: [***]}" in @Configuration.`;super(rr,On.FrameworkErrorEnum.MISSING_IMPORTS)}}On.MidwayMissingImportComponentError=MidwayMissingImportComponentError;class MidwayUtilHttpClientTimeoutError extends ir.MidwayError{constructor(St){super(St,On.FrameworkErrorEnum.UTIL_HTTP_TIMEOUT)}}On.MidwayUtilHttpClientTimeoutError=MidwayUtilHttpClientTimeoutError;class MidwayInconsistentVersionError extends ir.MidwayError{constructor(){const St='We find a latest dependency package installed, please remove the lock file and use "npm update" to upgrade all dependencies first.';super(St,On.FrameworkErrorEnum.INCONSISTENT_VERSION)}}On.MidwayInconsistentVersionError=MidwayInconsistentVersionError;class MidwayDuplicateClassNameError extends ir.MidwayError{constructor(St,rr,ir){super(`"${St}" duplicated between "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_CLASS_NAME)}}On.MidwayDuplicateClassNameError=MidwayDuplicateClassNameError;class MidwayDuplicateControllerOptionsError extends ir.MidwayError{constructor(St,rr,ir){super(`"Prefix ${St}" with duplicated controller options between "${rr}" and "${ir}"`,On.FrameworkErrorEnum.DUPLICATE_CONTROLLER_PREFIX_OPTIONS)}}On.MidwayDuplicateControllerOptionsError=MidwayDuplicateControllerOptionsError;class MidwayRetryExceededMaxTimesError extends ir.MidwayError{constructor(St,rr,ir){super(`Invoke "${St}" retries exceeded the maximum number of times(${rr}), error: ${ir.message}`,On.FrameworkErrorEnum.RETRY_OVER_MAX_TIME,{cause:ir})}}On.MidwayRetryExceededMaxTimesError=MidwayRetryExceededMaxTimesError;class MidwayInvokeForbiddenError extends ir.MidwayError{constructor(St,rr){super(`Invoke "${rr?rr.name:"unknown"}.${St}" is forbidden.`,On.FrameworkErrorEnum.INVOKE_METHOD_FORBIDDEN)}}On.MidwayInvokeForbiddenError=MidwayInvokeForbiddenError;class MidwayCodeInvokeTimeoutError extends ir.MidwayError{constructor(St,rr){super(`Invoke "${St}" running timeout(${rr}ms)`,On.FrameworkErrorEnum.CODE_INVOKE_TIMEOUT)}}On.MidwayCodeInvokeTimeoutError=MidwayCodeInvokeTimeoutError;class MidwayMainFrameworkMissingError extends ir.MidwayError{constructor(){super("Main framework missing, please check your configuration.",On.FrameworkErrorEnum.MAIN_FRAMEWORK_MISSING)}}On.MidwayMainFrameworkMissingError=MidwayMainFrameworkMissingError;class MidwayInvalidConfigPropertyError extends ir.MidwayError{constructor(St,rr){super(`Invalid config property "${St}", ${rr?`only ${rr.join(",")} can be set`:"please check your configuration"}.`,On.FrameworkErrorEnum.INVALID_CONFIG_PROPERTY)}}On.MidwayInvalidConfigPropertyError=MidwayInvalidConfigPropertyError;class MidwayEmptyValueError extends ir.MidwayError{constructor(St){super(St!==null&&St!==void 0?St:"There is an empty value got and it is not allowed.",On.FrameworkErrorEnum.EMPTY_VALUE)}}On.MidwayEmptyValueError=MidwayEmptyValueError},9504:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.httpError=On.GatewayTimeoutError=On.ServiceUnavailableError=On.BadGatewayError=On.NotImplementedError=On.InternalServerErrorError=On.TooManyRequestsError=On.UnprocessableEntityError=On.UnsupportedMediaTypeError=On.PayloadTooLargeError=On.GoneError=On.ConflictError=On.RequestTimeoutError=On.NotAcceptableError=On.ForbiddenError=On.NotFoundError=On.UnauthorizedError=On.BadRequestError=On.HttpStatus=void 0;const ir=rr(21769);var cr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(cr=On.HttpStatus||(On.HttpStatus={}));class BadRequestError extends ir.MidwayHttpError{constructor(St){super(St,cr.BAD_REQUEST)}}On.BadRequestError=BadRequestError;class UnauthorizedError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNAUTHORIZED)}}On.UnauthorizedError=UnauthorizedError;class NotFoundError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_FOUND)}}On.NotFoundError=NotFoundError;class ForbiddenError extends ir.MidwayHttpError{constructor(St){super(St,cr.FORBIDDEN)}}On.ForbiddenError=ForbiddenError;class NotAcceptableError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_ACCEPTABLE)}}On.NotAcceptableError=NotAcceptableError;class RequestTimeoutError extends ir.MidwayHttpError{constructor(St){super(St,cr.REQUEST_TIMEOUT)}}On.RequestTimeoutError=RequestTimeoutError;class ConflictError extends ir.MidwayHttpError{constructor(St){super(St,cr.CONFLICT)}}On.ConflictError=ConflictError;class GoneError extends ir.MidwayHttpError{constructor(St){super(St,cr.GONE)}}On.GoneError=GoneError;class PayloadTooLargeError extends ir.MidwayHttpError{constructor(St){super(St,cr.PAYLOAD_TOO_LARGE)}}On.PayloadTooLargeError=PayloadTooLargeError;class UnsupportedMediaTypeError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNSUPPORTED_MEDIA_TYPE)}}On.UnsupportedMediaTypeError=UnsupportedMediaTypeError;class UnprocessableEntityError extends ir.MidwayHttpError{constructor(St){super(St,cr.UNPROCESSABLE_ENTITY)}}On.UnprocessableEntityError=UnprocessableEntityError;class TooManyRequestsError extends ir.MidwayHttpError{constructor(St){super(St,cr.TOO_MANY_REQUESTS)}}On.TooManyRequestsError=TooManyRequestsError;class InternalServerErrorError extends ir.MidwayHttpError{constructor(St){super(St,cr.INTERNAL_SERVER_ERROR)}}On.InternalServerErrorError=InternalServerErrorError;class NotImplementedError extends ir.MidwayHttpError{constructor(St){super(St,cr.NOT_IMPLEMENTED)}}On.NotImplementedError=NotImplementedError;class BadGatewayError extends ir.MidwayHttpError{constructor(St){super(St,cr.BAD_GATEWAY)}}On.BadGatewayError=BadGatewayError;class ServiceUnavailableError extends ir.MidwayHttpError{constructor(St){super(St,cr.SERVICE_UNAVAILABLE)}}On.ServiceUnavailableError=ServiceUnavailableError;class GatewayTimeoutError extends ir.MidwayHttpError{constructor(St){super(St,cr.GATEWAY_TIMEOUT)}}On.GatewayTimeoutError=GatewayTimeoutError;On.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(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.httpError=On.HttpStatus=void 0;cr(rr(21769),On);var ur=rr(9504);Object.defineProperty(On,"HttpStatus",{enumerable:true,get:function(){return ur.HttpStatus}});Object.defineProperty(On,"httpError",{enumerable:true,get:function(){return ur.httpError}});cr(rr(37198),On)},24451:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createConfiguration=On.FunctionalConfiguration=void 0;class FunctionalConfiguration{constructor(St){this.options=St;this.readyHandler=()=>{};this.stopHandler=()=>{};this.configLoadHandler=()=>{};this.serverReadyHandler=()=>{}}onConfigLoad(St,On){if(typeof St==="function"){this.configLoadHandler=St}else{return this.configLoadHandler(St,On)}return this}onReady(St,On){if(typeof St==="function"){this.readyHandler=St}else{return this.readyHandler(St,On)}return this}onServerReady(St,On){if(typeof St==="function"){this.serverReadyHandler=St}else{return this.serverReadyHandler(St,On)}return this}onStop(St,On){if(typeof St==="function"){this.stopHandler=St}else{return this.stopHandler(St,On)}return this}getConfigurationOptions(){return this.options}}On.FunctionalConfiguration=FunctionalConfiguration;const createConfiguration=St=>new FunctionalConfiguration(St);On.createConfiguration=createConfiguration},46123:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayPerformanceManager=On.TypedResourceManager=On.HttpServerResponse=On.ServerResponse=On.FORMAT=On.FileUtils=On.PathFileUtil=On.Types=On.retryWith=On.retryWithAsync=On.extend=On.Utils=On.sleep=On.isTypeScriptEnvironment=On.wrapAsync=On.wrapMiddleware=On.pathMatching=On.transformRequestObjectByType=On.deprecatedOutput=On.delegateTargetAllPrototypeMethod=On.delegateTargetProperties=On.delegateTargetMethod=On.delegateTargetPrototypeMethod=On.loadModule=On.safeRequire=On.safelyGet=On.ASYNC_ROOT_CONTEXT=On.MidwayPriorityManager=On.DEFAULT_PRIORITY=On.DataSourceManager=On.WebRouterCollector=On.MidwayServerlessFunctionService=On.MidwayWebRouterService=On.MidwayHealthService=On.MidwayMockService=On.MidwayDecoratorService=On.MidwayMiddlewareService=On.MidwayLifeCycleService=On.MidwayAspectService=On.MidwayFrameworkService=On.MidwayLoggerService=On.MidwayInformationService=On.MidwayEnvironmentService=On.MidwayConfigService=On.FunctionalConfiguration=On.createConfiguration=On.BaseFramework=On.MidwayRequestContainer=void 0;cr(rr(6192),On);cr(rr(9288),On);var ur=rr(97983);Object.defineProperty(On,"MidwayRequestContainer",{enumerable:true,get:function(){return ur.MidwayRequestContainer}});var pr=rr(83872);Object.defineProperty(On,"BaseFramework",{enumerable:true,get:function(){return pr.BaseFramework}});cr(rr(28695),On);cr(rr(2222),On);var fr=rr(24451);Object.defineProperty(On,"createConfiguration",{enumerable:true,get:function(){return fr.createConfiguration}});Object.defineProperty(On,"FunctionalConfiguration",{enumerable:true,get:function(){return fr.FunctionalConfiguration}});var br=rr(78842);Object.defineProperty(On,"MidwayConfigService",{enumerable:true,get:function(){return br.MidwayConfigService}});var Sr=rr(70275);Object.defineProperty(On,"MidwayEnvironmentService",{enumerable:true,get:function(){return Sr.MidwayEnvironmentService}});var Er=rr(37482);Object.defineProperty(On,"MidwayInformationService",{enumerable:true,get:function(){return Er.MidwayInformationService}});var kr=rr(34888);Object.defineProperty(On,"MidwayLoggerService",{enumerable:true,get:function(){return kr.MidwayLoggerService}});var Pr=rr(33332);Object.defineProperty(On,"MidwayFrameworkService",{enumerable:true,get:function(){return Pr.MidwayFrameworkService}});var Ir=rr(70812);Object.defineProperty(On,"MidwayAspectService",{enumerable:true,get:function(){return Ir.MidwayAspectService}});var Lr=rr(13328);Object.defineProperty(On,"MidwayLifeCycleService",{enumerable:true,get:function(){return Lr.MidwayLifeCycleService}});var Br=rr(68220);Object.defineProperty(On,"MidwayMiddlewareService",{enumerable:true,get:function(){return Br.MidwayMiddlewareService}});var jr=rr(96367);Object.defineProperty(On,"MidwayDecoratorService",{enumerable:true,get:function(){return jr.MidwayDecoratorService}});var Ur=rr(77306);Object.defineProperty(On,"MidwayMockService",{enumerable:true,get:function(){return Ur.MidwayMockService}});var Vr=rr(658);Object.defineProperty(On,"MidwayHealthService",{enumerable:true,get:function(){return Vr.MidwayHealthService}});var Wr=rr(19985);Object.defineProperty(On,"MidwayWebRouterService",{enumerable:true,get:function(){return Wr.MidwayWebRouterService}});var zr=rr(42592);Object.defineProperty(On,"MidwayServerlessFunctionService",{enumerable:true,get:function(){return zr.MidwayServerlessFunctionService}});Object.defineProperty(On,"WebRouterCollector",{enumerable:true,get:function(){return zr.WebRouterCollector}});var qr=rr(12849);Object.defineProperty(On,"DataSourceManager",{enumerable:true,get:function(){return qr.DataSourceManager}});var Kr=rr(67934);Object.defineProperty(On,"DEFAULT_PRIORITY",{enumerable:true,get:function(){return Kr.DEFAULT_PRIORITY}});Object.defineProperty(On,"MidwayPriorityManager",{enumerable:true,get:function(){return Kr.MidwayPriorityManager}});cr(rr(28602),On);cr(rr(82535),On);cr(rr(64842),On);cr(rr(46673),On);cr(rr(1845),On);cr(rr(11026),On);cr(rr(12738),On);cr(rr(39408),On);cr(rr(43436),On);cr(rr(29222),On);cr(rr(86314),On);var Xr=rr(75351);Object.defineProperty(On,"ASYNC_ROOT_CONTEXT",{enumerable:true,get:function(){return Xr.ASYNC_ROOT_CONTEXT}});cr(rr(49757),On);cr(rr(45317),On);cr(rr(75105),On);var Yr=rr(65308);Object.defineProperty(On,"safelyGet",{enumerable:true,get:function(){return Yr.safelyGet}});Object.defineProperty(On,"safeRequire",{enumerable:true,get:function(){return Yr.safeRequire}});Object.defineProperty(On,"loadModule",{enumerable:true,get:function(){return Yr.loadModule}});Object.defineProperty(On,"delegateTargetPrototypeMethod",{enumerable:true,get:function(){return Yr.delegateTargetPrototypeMethod}});Object.defineProperty(On,"delegateTargetMethod",{enumerable:true,get:function(){return Yr.delegateTargetMethod}});Object.defineProperty(On,"delegateTargetProperties",{enumerable:true,get:function(){return Yr.delegateTargetProperties}});Object.defineProperty(On,"delegateTargetAllPrototypeMethod",{enumerable:true,get:function(){return Yr.delegateTargetAllPrototypeMethod}});Object.defineProperty(On,"deprecatedOutput",{enumerable:true,get:function(){return Yr.deprecatedOutput}});Object.defineProperty(On,"transformRequestObjectByType",{enumerable:true,get:function(){return Yr.transformRequestObjectByType}});Object.defineProperty(On,"pathMatching",{enumerable:true,get:function(){return Yr.pathMatching}});Object.defineProperty(On,"wrapMiddleware",{enumerable:true,get:function(){return Yr.wrapMiddleware}});Object.defineProperty(On,"wrapAsync",{enumerable:true,get:function(){return Yr.wrapAsync}});Object.defineProperty(On,"isTypeScriptEnvironment",{enumerable:true,get:function(){return Yr.isTypeScriptEnvironment}});Object.defineProperty(On,"sleep",{enumerable:true,get:function(){return Yr.sleep}});Object.defineProperty(On,"Utils",{enumerable:true,get:function(){return Yr.Utils}});var ii=rr(83486);Object.defineProperty(On,"extend",{enumerable:true,get:function(){return ii.extend}});cr(rr(46422),On);cr(rr(50539),On);cr(rr(73861),On);cr(rr(87653),On);var oi=rr(25198);Object.defineProperty(On,"retryWithAsync",{enumerable:true,get:function(){return oi.retryWithAsync}});Object.defineProperty(On,"retryWith",{enumerable:true,get:function(){return oi.retryWith}});var ai=rr(63289);Object.defineProperty(On,"Types",{enumerable:true,get:function(){return ai.Types}});var pi=rr(61327);Object.defineProperty(On,"PathFileUtil",{enumerable:true,get:function(){return pi.PathFileUtil}});var mi=rr(7589);Object.defineProperty(On,"FileUtils",{enumerable:true,get:function(){return mi.FileUtils}});var bi=rr(30001);Object.defineProperty(On,"FORMAT",{enumerable:true,get:function(){return bi.FORMAT}});var xi=rr(89995);Object.defineProperty(On,"ServerResponse",{enumerable:true,get:function(){return xi.ServerResponse}});Object.defineProperty(On,"HttpServerResponse",{enumerable:true,get:function(){return xi.HttpServerResponse}});var wi=rr(11330);Object.defineProperty(On,"TypedResourceManager",{enumerable:true,get:function(){return wi.TypedResourceManager}});var Oi=rr(70032);Object.defineProperty(On,"MidwayPerformanceManager",{enumerable:true,get:function(){return Oi.MidwayPerformanceManager}})},6192:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayProcessTypeEnum=On.ObjectLifeCycleEvent=On.ServerlessTriggerType=On.MidwayFrameworkType=On.FrameworkType=On.MSListenerType=On.MSProviderType=On.InjectModeEnum=On.ScopeEnum=void 0;var rr;(function(St){St["Singleton"]="Singleton";St["Request"]="Request";St["Prototype"]="Prototype"})(rr=On.ScopeEnum||(On.ScopeEnum={}));var ir;(function(St){St["Identifier"]="Identifier";St["Class"]="Class";St["PropertyName"]="PropertyName"})(ir=On.InjectModeEnum||(On.InjectModeEnum={}));var cr;(function(St){St["DUBBO"]="dubbo";St["GRPC"]="gRPC"})(cr=On.MSProviderType||(On.MSProviderType={}));var ur;(function(St){St["RABBITMQ"]="rabbitmq";St["MQTT"]="mqtt";St["KAFKA"]="kafka";St["REDIS"]="redis"})(ur=On.MSListenerType||(On.MSListenerType={}));class FrameworkType{}On.FrameworkType=FrameworkType;class MidwayFrameworkType extends FrameworkType{constructor(St){super();this.name=St}}On.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 pr;(function(St){St["EVENT"]="event";St["HTTP"]="http";St["API_GATEWAY"]="apigw";St["OS"]="os";St["CDN"]="cdn";St["LOG"]="log";St["TIMER"]="timer";St["MQ"]="mq";St["KAFKA"]="kafka";St["HSF"]="hsf";St["MTOP"]="mtop";St["SSR"]="ssr"})(pr=On.ServerlessTriggerType||(On.ServerlessTriggerType={}));var fr;(function(St){St["BEFORE_BIND"]="beforeBind";St["BEFORE_CREATED"]="beforeObjectCreated";St["AFTER_CREATED"]="afterObjectCreated";St["AFTER_INIT"]="afterObjectInit";St["BEFORE_DESTROY"]="beforeObjectDestroy"})(fr=On.ObjectLifeCycleEvent||(On.ObjectLifeCycleEvent={}));var br;(function(St){St["APPLICATION"]="APPLICATION";St["AGENT"]="AGENT"})(br=On.MidwayProcessTypeEnum||(On.MidwayProcessTypeEnum={}))},72838:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerResponse=void 0;class ServerResponse{constructor(St){this.isSuccess=true;this.ctx=St}json(St){return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}blob(St){return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}success(){this.isSuccess=true;return this}fail(){this.isSuccess=false;return this}}On.ServerResponse=ServerResponse;ServerResponse.TEXT_TPL=(St,On,rr)=>St;ServerResponse.JSON_TPL=(St,On,rr)=>{if(On){return{success:"true",data:St}}else{return{success:"false",message:St||"fail"}}};ServerResponse.BLOB_TPL=(St,On,rr)=>St},91959:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpServerResponse=void 0;const ir=rr(79896);const cr=rr(72838);const ur=rr(82738);const pr=rr(37407);const fr=rr(16928);class HttpServerResponse extends cr.ServerResponse{constructor(St){super(St)}status(St){this.ctx.res.statusCode=St;return this}header(St,On){this.ctx.res.setHeader(St,On);return this}headers(St){if(this.ctx.res.setHeaders){this.ctx.res.setHeaders(new Map(Object.entries(St)))}else{for(const On in St){this.header(On,St[On])}}return this}json(St){this.header("Content-Type","application/json");return Object.getPrototypeOf(this).constructor.JSON_TPL(St,this.isSuccess,this.ctx)}text(St){this.header("Content-Type","text/plain");return Object.getPrototypeOf(this).constructor.TEXT_TPL(St,this.isSuccess,this.ctx)}file(St,On){this.header("Content-Type",On||"application/octet-stream");this.header("Content-Disposition",`attachment; filename=${(0,fr.basename)(St)}`);return Object.getPrototypeOf(this).constructor.FILE_TPL(typeof St==="string"?(0,ir.createReadStream)(St):St,this.isSuccess,this.ctx)}blob(St,On){this.header("Content-Type",On||"application/octet-stream");return Object.getPrototypeOf(this).constructor.BLOB_TPL(St,this.isSuccess,this.ctx)}html(St){this.header("Content-Type","text/html");return Object.getPrototypeOf(this).constructor.HTML_TPL(St,this.isSuccess,this.ctx)}redirect(St,On=302){this.status(On);if(this.ctx.redirect){return this.ctx.redirect(St)}else if(this.ctx.res.redirect){return this.ctx.res.redirect(St)}else{this.header("Location",St)}}sse(St={}){return new ur.ServerSendEventStream(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.SSE_TPL,...St})}stream(St={}){return new pr.HttpStreamResponse(this.ctx,{tpl:Object.getPrototypeOf(this).constructor.STREAM_TPL,...St})}}On.HttpServerResponse=HttpServerResponse;HttpServerResponse.FILE_TPL=(St,On,rr)=>St;HttpServerResponse.SSE_TPL=(St,On)=>St;HttpServerResponse.STREAM_TPL=(St,On)=>St;HttpServerResponse.HTML_TPL=(St,On,rr)=>St},89995:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpServerResponse=On.ServerResponse=void 0;var ir=rr(72838);Object.defineProperty(On,"ServerResponse",{enumerable:true,get:function(){return ir.ServerResponse}});var cr=rr(91959);Object.defineProperty(On,"HttpServerResponse",{enumerable:true,get:function(){return cr.HttpServerResponse}})},82738:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ServerSendEventStream=void 0;const ir=rr(2203);class ServerSendEventStream extends ir.Transform{constructor(St,On={}){super({objectMode:true,...On});this.isActive=false;this.ctx=St;this.closeEvent=On.closeEvent||"close";this.options=On;this.ctx.req.on("close",this.handleClose.bind(this))}_transform(St,On,rr){try{let On,ir="data: ";const cr=/^\s*:\s*/;const ur=[];if(!this.isActive){this.isActive=true;const St={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive","X-Accel-Buffering":"no"};for(const On in St){this.ctx.res.setHeader(On,St[On])}this.ctx.req.socket.setTimeout(0);this.ctx.req.socket.setNoDelay(true);this.ctx.req.socket.setKeepAlive(true);ur.push(": ok")}const pr=St;if(pr.event)ur.push("event: "+pr.event);if(pr.retry)ur.push("retry: "+pr.retry);if(pr.id)ur.push("id: "+pr.id);if(typeof pr.data==="object"){On=JSON.stringify(pr.data);ur.push(ir+On)}else if(typeof pr.data==="undefined"){ur.push(ir)}else{pr.data=String(pr.data);if(pr.data.search(cr)!==-1){pr.data=pr.data.replace(cr,"");ir=": "}pr.data=pr.data.replace(/(\r\n|\r|\n)/g,"\n");On=pr.data.split(/\n/);for(let St=0,rr=On.length;St<rr;++St){const cr=On[St];if(St+1===rr){ur.push(ir+cr)}else{ur.push(ir+cr)}}}this.push(ur.join("\n")+"\n\n");rr()}catch(St){this.ctx.logger.error(St);this.sendError(St);this.end();rr(St)}}sendError(St){this.send({event:"error",data:St.message||"An error occurred"})}sendEnd(St){St.event=this.closeEvent;this.send(St)}send(St){super.write(this.options.tpl(St,this.ctx))}handleClose(){this.end()}}On.ServerSendEventStream=ServerSendEventStream},37407:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpStreamResponse=void 0;const ir=rr(2203);class HttpStreamResponse extends ir.Transform{constructor(St,On={}){super({objectMode:true,...On});this.isActive=false;this.ctx=St;this.options=On}_transform(St,On,rr){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 St==="string"){this.ctx.res.write(St)}else{this.ctx.res.write(JSON.stringify(St))}rr()}catch(St){this.ctx.logger.error(St);this.end();this.ctx.res.end();rr(St)}}send(St){if(!this.writable){return}this.write(this.options.tpl(St,this.ctx))}sendError(St){this.ctx.logger.error(St);this.end();this.ctx.res.end()}_flush(St){this.ctx.res.end();St()}}On.HttpStreamResponse=HttpStreamResponse},70812:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayAspectService=void 0;const ur=rr(65675);const pr=rr(6192);const fr=rr(49757);const br=rr(63289);let Sr=class MidwayAspectService{constructor(St){this.applicationContext=St}async loadAspect(){const St=(0,fr.listModule)(fr.ASPECT_KEY);let On=[];for(const rr of St){const St=(0,fr.getClassMetadata)(fr.ASPECT_KEY,rr);On=On.concat(St.map((St=>{St.aspectModule=rr;return St})))}On.sort(((St,On)=>(On.priority||0)-(St.priority||0)));for(const St of On){const On=await this.applicationContext.getAsync(St.aspectModule);await this.addAspect(On,St)}}async addAspect(St,On){const rr=On.aspectTarget;const ir=Object.getOwnPropertyNames(rr.prototype);const cr=On.match?ur(On.match):()=>true;for(const On of ir){if(On==="constructor"||!cr(On)){continue}const ir=Object.getOwnPropertyDescriptor(rr.prototype,On);if(!ir||ir.writable===false){continue}this.interceptPrototypeMethod(rr,On,St)}}interceptPrototypeMethod(St,On,rr){const ir=St.prototype[On];if(br.Types.isAsyncFunction(St.prototype[On])){St.prototype[On]=async function(...St){var cr,ur,pr;let fr,br;const newProceed=(...St)=>ir.apply(this,St);const Sr={methodName:On,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:true};if(typeof rr==="function"){rr=rr()}try{await((cr=rr.before)===null||cr===void 0?void 0:cr.call(rr,Sr));if(rr.around){br=await rr.around(Sr)}else{br=await ir.call(this,...Sr.args)}Sr.proceed=undefined;const St=await((ur=rr.afterReturn)===null||ur===void 0?void 0:ur.call(rr,Sr,br));br=typeof St==="undefined"?br:St;return br}catch(St){Sr.proceed=undefined;fr=St;if(rr.afterThrow){await rr.afterThrow(Sr,fr)}else{throw St}}finally{await((pr=rr.after)===null||pr===void 0?void 0:pr.call(rr,Sr,br,fr))}}}else{St.prototype[On]=function(...St){var cr,ur,pr;let fr,br;const newProceed=(...St)=>ir.apply(this,St);const Sr={methodName:On,target:this,args:St,proceed:newProceed,proceedIsAsyncFunction:false};if(typeof rr==="function"){rr=rr()}try{(cr=rr.before)===null||cr===void 0?void 0:cr.call(rr,Sr);if(rr.around){br=rr.around(Sr)}else{br=ir.call(this,...Sr.args)}Sr.proceed=undefined;const St=(ur=rr.afterReturn)===null||ur===void 0?void 0:ur.call(rr,Sr,br);br=typeof St==="undefined"?br:St;return br}catch(St){Sr.proceed=undefined;fr=St;if(rr.afterThrow){rr.afterThrow(Sr,fr)}else{throw St}}finally{(pr=rr.after)===null||pr===void 0?void 0:pr.call(rr,Sr,br,fr)}}}}};Sr=ir([(0,fr.Provide)(),(0,fr.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Sr);On.MidwayAspectService=Sr},78842:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayConfigService=void 0;const ur=rr(16928);const pr=rr(6192);const fr=rr(65308);const br=rr(79896);const Sr=rr(39023);const Er=rr(70275);const kr=rr(37482);const Pr=rr(83486);const Ir=rr(86314);const Lr=rr(49757);const Br=rr(63289);const jr=Sr.debuglog("midway:debug");let Ur=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(St){for(const On of St){if(typeof On==="string"){if(/\.\w+$/.test(On)){const St=this.getConfigEnv(On);const rr=this.getEnvSet(St);rr.add(On);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(On)}}else{const St=(0,br.statSync)(On);if(St.isDirectory()){const St=(0,br.readdirSync)(On);this.add(St.map((St=>(0,ur.join)(On,St))))}}}else{for(const St in On){this.getEnvSet(St).add(On[St]);if(this.aliasMap[St]){this.getEnvSet(this.aliasMap[St]).add(On[St])}}}}}addObject(St,On=false){if(this.isReady){St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");return}this.configMergeOrder.push({env:"default",extraPath:"",value:St});if(On){this.configuration=(0,Pr.extend)(true,St,this.configuration)}else{(0,Pr.extend)(true,this.configuration,St)}}else{this.externalObject.push(St)}}getEnvSet(St){if(!this.envDirMap.has(St)){this.envDirMap.set(St,new Set)}return this.envDirMap.get(St)}getConfigEnv(St){const On=(0,ur.basename)(St);const rr=On.split(".");const ir=rr.pop();if(ir!=="js"&&ir!=="ts"){return ir}return rr.pop()}load(){if(this.isReady)return;const St=this.getEnvSet("default");const On=this.getEnvSet(this.environmentService.getCurrentEnvironment());const rr={};const ir=St.size;for(const[cr,ur]of[...St,...On].entries()){let St=this.loadConfig(ur);if(Br.Types.isFunction(St)){St=St.apply(null,[this.appInfo,rr])}if(!St){continue}St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");continue}if(typeof ur==="string"){jr("[config]: Loaded config %s, %j",ur,St)}else{jr("[config]: Loaded config %j",St)}this.configMergeOrder.push({env:cr<ir?"default":this.environmentService.getCurrentEnvironment(),extraPath:ur,value:St});(0,Pr.extend)(true,rr,St)}if(this.externalObject.length){for(let St of this.externalObject){if(St){St=this.runWithFilter(St);if(!St){jr("[config]: Filter config and got undefined will be drop it");continue}jr("[config]: Loaded external object %j",St);(0,Pr.extend)(true,rr,St);this.configMergeOrder.push({env:"default",extraPath:"",value:St})}}}this.configuration=rr;this.isReady=true}getConfiguration(St){if(St){return(0,fr.safelyGet)(St,this.configuration)}return this.configuration}getConfigMergeOrder(){return this.configMergeOrder}loadConfig(St){let On=typeof St==="string"?require(St):St;if(On&&On.__esModule){if(On&&On.default){if(Object.keys(On).length>1){throw new Ir.MidwayInvalidConfigError(`${St} should not have both a default export and named export`)}On=On.default}}return On}clearAllConfig(){this.configuration={}}clearConfigMergeOrder(){this.configMergeOrder.length=0}addFilter(St){this.configFilterList.push(St)}runWithFilter(St){for(const On of this.configFilterList){jr(`[config]: Filter config by filter = "${On.name||"anonymous filter"}"`);St=On(St);jr("[config]: Filter config result = %j",St)}return St}getAppInfo(){return this.appInfo}};ir([(0,Lr.Inject)(),cr("design:type",Er.MidwayEnvironmentService)],Ur.prototype,"environmentService",void 0);ir([(0,Lr.Inject)(),cr("design:type",kr.MidwayInformationService)],Ur.prototype,"informationService",void 0);ir([(0,Lr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Ur.prototype,"init",null);Ur=ir([(0,Lr.Provide)(),(0,Lr.Scope)(pr.ScopeEnum.Singleton)],Ur);On.MidwayConfigService=Ur},96367:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayDecoratorService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(70812);const br=rr(86314);const Sr=rr(39023);const Er=rr(63289);const kr=Sr.debuglog("midway:debug");let Pr=class MidwayDecoratorService{constructor(St){this.applicationContext=St;this.propertyHandlerMap=new Map;this.methodDecoratorMap=new Map;this.parameterDecoratorMap=new Map;this.parameterDecoratorPipes=new Map}init(){this.applicationContext.onBeforeBind((St=>{const On=(0,ur.getClassMetadata)(ur.INJECT_CUSTOM_METHOD,St);if(On){for(const rr of On){const{propertyName:On,key:ir,metadata:cr,options:ur}=rr;if(!ur||!ur.impl){continue}this.aspectService.interceptPrototypeMethod(St,On,(()=>{const rr=this.methodDecoratorMap.get(ir);if(!rr){throw new br.MidwayCommonError(`Method Decorator "${ir}" handler not found, please register first.`)}return rr({target:St,propertyName:On,metadata:cr})}))}}const rr=(0,ur.getClassMetadata)(ur.INJECT_CUSTOM_PARAM,St);if(rr){for(const On of Object.keys(rr)){this.aspectService.interceptPrototypeMethod(St,On,(()=>({before:async ir=>{const cr=[...ir.args];for(const pr of rr[On]){const{propertyName:On,key:rr,metadata:fr,parameterIndex:Sr,options:Pr}=pr;let Ir;if(Pr&&Pr.impl){Ir=this.parameterDecoratorMap.get(rr);if(!Ir){throw new br.MidwayCommonError(`Parameter Decorator "${rr}" handler not found, please register first.`)}}else{Ir=async({parameterIndex:St,originArgs:On})=>On[St]}const Lr=(0,ur.getMethodParamTypes)(St,On);let Br=false;try{cr[Sr]=await Ir({metadata:fr,propertyName:On,parameterIndex:Sr,target:St,originArgs:cr,originParamType:Lr[Sr],instance:ir.target})}catch(St){Br=true;if((Pr===null||Pr===void 0?void 0:Pr.throwError)===true){throw St}else{kr(`[core]: Parameter decorator throw error and use origin args, ${St.stack}`)}}if(Br){continue}const jr=[...this.parameterDecoratorPipes.get(rr)||[],...(Pr===null||Pr===void 0?void 0:Pr.pipes)||[]];for(const St of jr){let On;if("transform"in St){On=St["transform"].bind(St)}else if((0,Er.isClass)(St)){const rr=await this.applicationContext.getAsync(St);On=rr.transform.bind(rr)}else if(typeof St==="function"){On=St}else{throw new br.MidwayParameterError("Pipe must be a function or implement PipeTransform interface")}cr[Sr]=await On(cr[Sr],{metaType:(0,ur.transformTypeFromTSDesign)(Lr[Sr]),metadata:fr,target:ir.target,methodName:ir.methodName})}}ir.args=cr}})))}}}));this.applicationContext.onObjectCreated(((St,On)=>{if(this.propertyHandlerMap.size>0&&Array.isArray(On.definition.handlerProps)){for(const rr of On.definition.handlerProps){this.defineGetterPropertyValue(rr,St,this.getHandler(rr.key))}}}));this.registerPropertyHandler(ur.APPLICATION_CONTEXT_KEY,((St,On)=>this.applicationContext))}registerPropertyHandler(St,On){kr(`[core]: Register property decorator key="${St}"`);this.propertyHandlerMap.set(St,On)}registerMethodHandler(St,On){kr(`[core]: Register method decorator key="${St}"`);this.methodDecoratorMap.set(St,On)}registerParameterHandler(St,On){kr(`[core]: Register parameter decorator key="${St}"`);this.parameterDecoratorMap.set(St,On)}registerParameterPipes(St,On){if(!this.parameterDecoratorPipes.has(St)){this.parameterDecoratorPipes.set(St,[])}this.parameterDecoratorPipes.set(St,this.parameterDecoratorPipes.get(St).concat(On))}defineGetterPropertyValue(St,On,rr){if(St&&rr){if(St.propertyName){Object.defineProperty(On,St.propertyName,{get:()=>{var ir;return rr(St.propertyName,(ir=St.metadata)!==null&&ir!==void 0?ir:{},On)},configurable:true,enumerable:true})}}}getHandler(St){if(this.propertyHandlerMap.has(St)){return this.propertyHandlerMap.get(St)}}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayAspectService)],Pr.prototype,"aspectService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Pr.prototype,"init",null);Pr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Pr);On.MidwayDecoratorService=Pr},70275:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayEnvironmentService=void 0;const cr=rr(6192);const ur=rr(65308);const pr=rr(49757);let fr=class MidwayEnvironmentService{constructor(){this.moduleLoadType="commonjs"}getCurrentEnvironment(){if(!this.environment){this.environment=(0,ur.getCurrentEnvironment)()}return this.environment}setCurrentEnvironment(St){this.environment=St}isDevelopmentEnvironment(){return(0,ur.isDevelopmentEnvironment)(this.environment)}setModuleLoadType(St){this.moduleLoadType=St}getModuleLoadType(){return this.moduleLoadType}isPkgEnvironment(){return typeof process["pkg"]!=="undefined"}};fr=ir([(0,pr.Provide)(),(0,pr.Scope)(cr.ScopeEnum.Singleton)],fr);On.MidwayEnvironmentService=fr},33332:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayFrameworkService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(78842);const br=rr(34888);const Sr=rr(83872);const Er=rr(28602);const kr=rr(96367);const Pr=rr(70812);const Ir=rr(43436);const Lr=rr(39023);const Br=rr(86314);const jr=rr(2222);const Ur=rr(70032);const Vr=Lr.debuglog("midway:debug");let Wr=class MidwayFrameworkService{constructor(St,On){this.applicationContext=St;this.globalOptions=On;this.globalFrameworkList=[]}async init(){var St,On;this.decoratorService.registerPropertyHandler(ur.CONFIG_KEY,((St,On)=>{var rr;if(On.identifier===ur.ALL){return this.configService.getConfiguration()}else{return this.configService.getConfiguration((rr=On.identifier)!==null&&rr!==void 0?rr:St)}}));this.decoratorService.registerPropertyHandler(ur.LOGGER_KEY,((St,On)=>{var rr;return this.loggerService.getLogger((rr=On.identifier)!==null&&rr!==void 0?rr:St)}));this.decoratorService.registerPropertyHandler(ur.PIPELINE_IDENTIFIER,((St,On,rr)=>{var ir,cr;return new Er.MidwayPipelineService((cr=(ir=rr[jr.REQUEST_OBJ_CTX_KEY])===null||ir===void 0?void 0:ir.requestContext)!==null&&cr!==void 0?cr:this.applicationContext,On.valves)}));this.decoratorService.registerPropertyHandler(ur.APPLICATION_KEY,((St,On)=>{if(On.type){const St=this.applicationManager.getApplication(On.type);if(!St){throw new Br.MidwayCommonError(`Framework ${On.type} not Found`)}return St}else{return this.getMainApp()}}));this.decoratorService.registerPropertyHandler(ur.PLUGIN_KEY,((St,On)=>{var rr;return this.getMainApp()[(rr=On.identifier)!==null&&rr!==void 0?rr:St]}));this.decoratorService.registerPropertyHandler(ur.FACTORY_SERVICE_CLIENT_KEY,((St,On)=>{const rr=this.applicationContext.get(On.serviceFactoryClz);const ir=On.clientName||rr.getDefaultClientName();if(ir&&rr.has(ir)){return rr.get(ir)}else{if(!ir){throw new Br.MidwayParameterError(`Please set clientName or options.defaultClientName for ${On.serviceFactoryClz.name}).`)}else{throw new Br.MidwayParameterError(`ClientName(${ir} not found in ${On.serviceFactoryClz.name}).`)}}}));let rr=(0,ur.listModule)(ur.FRAMEWORK_KEY);rr=filterProtoFramework(rr);Vr(`[core]: Found Framework length = ${rr.length}`);if(rr.length){for(const On of rr){if(!this.applicationContext.hasDefinition((0,ur.getProviderUUId)(On))){Vr(`[core]: Found Framework "${On.name}" but missing definition, skip initialize.`);continue}const rr=await this.applicationContext.getAsync(On,[this.applicationContext]);if(rr.isEnable()){Ur.MidwayInitializerPerformanceManager.frameworkInitializeStart(rr.getFrameworkName());await rr.initialize({applicationContext:this.applicationContext,namespace:rr.getNamespace(),...this.globalOptions});Ur.MidwayInitializerPerformanceManager.frameworkInitializeEnd(rr.getFrameworkName());Vr(`[core]: Found Framework "${rr.getFrameworkName()}" and initialize.`)}else{Vr(`[core]: Found Framework "${rr.getFrameworkName()}" and delay initialize.`)}const ir=this.applicationContext.registry.getDefinition((0,ur.getProviderUUId)(On));rr.setNamespace(ir===null||ir===void 0?void 0:ir.namespace);this.applicationManager.addFramework((St=ir===null||ir===void 0?void 0:ir.namespace)!==null&&St!==void 0?St:rr.getFrameworkName(),rr);this.globalFrameworkList.push(rr)}let ir;const cr=this.applicationContext.getNamespaceList();for(const St of cr){const On=this.applicationManager.getApplication(St);if(On){ir=St;break}}global["MIDWAY_MAIN_FRAMEWORK"]=this.mainFramework=(On=this.applicationManager.getFramework(ir))!==null&&On!==void 0?On:this.globalFrameworkList[0];Vr(`[core]: Current main Framework is "${ir}".`)}await this.aspectService.loadAspect()}getMainApp(){var St;return(St=this.mainFramework)===null||St===void 0?void 0:St.getApplication()}getMainFramework(){return this.mainFramework}getFramework(St){return this.applicationManager.getFramework(St)}async runFramework(){const St=this.applicationContext.getNamespaceList();this.globalFrameworkList=this.globalFrameworkList.sort(((On,rr)=>St.indexOf(On.getNamespace())-St.indexOf(rr.getNamespace())));for(const St of this.globalFrameworkList){if(St.isEnable()){Ur.MidwayInitializerPerformanceManager.frameworkRunStart(St.getFrameworkName());await St.run();Vr(`[core]: Found Framework "${St.getFrameworkName()}" and run.`);Ur.MidwayInitializerPerformanceManager.frameworkRunEnd(St.getFrameworkName())}}}async stopFramework(){await Promise.all(Array.from(this.globalFrameworkList).map((St=>St.stop())))}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayConfigService)],Wr.prototype,"configService",void 0);ir([(0,ur.Inject)(),cr("design:type",br.MidwayLoggerService)],Wr.prototype,"loggerService",void 0);ir([(0,ur.Inject)(),cr("design:type",Pr.MidwayAspectService)],Wr.prototype,"aspectService",void 0);ir([(0,ur.Inject)(),cr("design:type",kr.MidwayDecoratorService)],Wr.prototype,"decoratorService",void 0);ir([(0,ur.Inject)(),cr("design:type",Ir.MidwayApplicationManager)],Wr.prototype,"applicationManager",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Wr.prototype,"init",null);Wr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object,Object])],Wr);On.MidwayFrameworkService=Wr;function filterProtoFramework(St){const On=[];for(const rr of St){let St=Object.getPrototypeOf(rr);while(St.name&&St.name!==Sr.BaseFramework.name){On.push(St);St=Object.getPrototypeOf(St)}}return St.filter((St=>!On.includes(St)))}},658:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayHealthService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(78842);const br=rr(65308);let Sr=class MidwayHealthService{constructor(){this.healthCheckTimeout=1e3;this.healthCheckMethods=[]}async init(St){const On=this.configService.getConfiguration("core.healthCheckTimeout")||1e3;this.setCheckTimeout(On);for(const On of St){if(On.instance&&On.instance["onHealthCheck"]){this.healthCheckMethods.push({item:On.instance["onHealthCheck"].bind(On.instance),meta:{namespace:On.namespace}})}}}async getStatus(){const St=await(0,br.createPromiseTimeoutInvokeChain)({promiseItems:this.healthCheckMethods.map((St=>({item:St.item(this.applicationContext),meta:St.meta}))),timeout:this.healthCheckTimeout,methodName:"configuration.onHealthCheck",onSuccess:(St,On)=>{if(St["status"]!==undefined){return{namespace:On.namespace,...St}}else{return{status:false,namespace:On.namespace,reason:"configuration.onHealthCheck return value must be object and contain status field"}}},onFail:(St,On)=>({status:false,namespace:On.namespace,reason:St.message})});const On=St.find((St=>!St.status));return{status:!On,namespace:On===null||On===void 0?void 0:On.namespace,reason:On===null||On===void 0?void 0:On.reason,results:St}}setCheckTimeout(St){this.healthCheckTimeout=St}};ir([(0,ur.Inject)(),cr("design:type",fr.MidwayConfigService)],Sr.prototype,"configService",void 0);ir([(0,ur.ApplicationContext)(),cr("design:type",Object)],Sr.prototype,"applicationContext",void 0);Sr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton)],Sr);On.MidwayHealthService=Sr},37482:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayInformationService=void 0;const ur=rr(6192);const pr=rr(65308);const fr=rr(16928);const br=rr(49757);const Sr=rr(79896);let Er=class MidwayInformationService{init(){if(this.baseDir){if(!this.appDir){this.appDir=(0,fr.dirname)(this.baseDir)}const St=(0,fr.join)(this.appDir,"package.json");if((0,Sr.existsSync)(St)){const On=(0,Sr.readFileSync)(St,{encoding:"utf-8"});this.pkg=JSON.parse(On)}else{this.pkg={}}}else{this.pkg={}}}getAppDir(){return this.appDir}getBaseDir(){return this.baseDir}getHome(){return(0,pr.getUserHome)()}getPkg(){return this.pkg}getProjectName(){var St;return((St=this.pkg)===null||St===void 0?void 0:St["name"])||""}getRoot(){const St=(0,pr.isDevelopmentEnvironment)((0,pr.getCurrentEnvironment)());return St?this.getAppDir():this.getHome()}};ir([(0,br.Inject)(),cr("design:type",String)],Er.prototype,"appDir",void 0);ir([(0,br.Inject)(),cr("design:type",String)],Er.prototype,"baseDir",void 0);ir([(0,br.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Er.prototype,"init",null);Er=ir([(0,br.Provide)(),(0,br.Scope)(ur.ScopeEnum.Singleton)],Er);On.MidwayInformationService=Er},13328:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayLifeCycleService=void 0;const ur=rr(6192);const pr=rr(49757);const fr=rr(24451);const br=rr(33332);const Sr=rr(78842);const Er=rr(39023);const kr=rr(77306);const Pr=rr(658);const Ir=rr(70032);const Lr=(0,Er.debuglog)("midway:debug");let Br=class MidwayLifeCycleService{constructor(St){this.applicationContext=St;this.lifecycleInstanceList=[]}async init(){await this.mockService.initSimulation();const St=(0,pr.listModule)(pr.CONFIGURATION_KEY);Lr(`[core]: Found Configuration length = ${St.length}`);for(const On of St){if(On.target instanceof fr.FunctionalConfiguration){On.instance=On.target}else{Lr(`[core]: Lifecycle run ${On.namespace} init`);On.instance=await this.applicationContext.getAsync(On.target)}On.instance&&this.lifecycleInstanceList.push(On)}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",(St=>{if(St){this.configService.addObject(St)}}));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 St=(0,pr.listModule)(pr.CONFIGURATION_KEY)||[];for(const On of St.reverse()){let St;if(On.target instanceof fr.FunctionalConfiguration){St=On.target}else{St=await this.applicationContext.getAsync(On.target)}await this.runContainerLifeCycle(St,"onStop")}await this.frameworkService.stopFramework()}async runContainerLifeCycle(St,On,rr){if(Array.isArray(St)){for(const ir of St){if(typeof ir.instance[On]==="function"){Lr(`[core]: Lifecycle run ${ir.instance.constructor.name} ${On}`);Ir.MidwayInitializerPerformanceManager.lifecycleStart(ir.namespace,On);const St=await ir.instance[On](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(St)}Ir.MidwayInitializerPerformanceManager.lifecycleEnd(ir.namespace,On)}}}else{if(typeof St[On]==="function"){const ir=St.constructor.name;Lr(`[core]: Lifecycle run ${ir} ${On}`);Ir.MidwayInitializerPerformanceManager.lifecycleStart(ir,On);const cr=await St[On](this.applicationContext,this.frameworkService.getMainApp());if(rr){rr(cr)}Ir.MidwayInitializerPerformanceManager.lifecycleEnd(ir,On)}}}async runObjectLifeCycle(St,On){for(const rr of St){if(typeof rr.instance[On]==="function"){Lr(`[core]: Lifecycle run ${rr.instance.constructor.name} ${On}`);return await this.applicationContext[On](rr.instance[On].bind(rr.instance))}}}getLifecycleInstanceList(){return this.lifecycleInstanceList}};ir([(0,pr.Inject)(),cr("design:type",br.MidwayFrameworkService)],Br.prototype,"frameworkService",void 0);ir([(0,pr.Inject)(),cr("design:type",Sr.MidwayConfigService)],Br.prototype,"configService",void 0);ir([(0,pr.Inject)(),cr("design:type",kr.MidwayMockService)],Br.prototype,"mockService",void 0);ir([(0,pr.Inject)(),cr("design:type",Pr.MidwayHealthService)],Br.prototype,"healthService",void 0);ir([(0,pr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Br.prototype,"init",null);Br=ir([(0,pr.Provide)(),(0,pr.Scope)(ur.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Br);On.MidwayLifeCycleService=Br},34888:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayLoggerService=void 0;const ur=rr(49757);const pr=rr(78842);const fr=rr(64842);const br=rr(6192);const Sr=rr(82535);const Er=rr(86314);let kr=class MidwayLoggerService extends fr.ServiceFactory{constructor(St,On={}){super();this.applicationContext=St;this.globalOptions=On;this.lazyLoggerConfigMap=new Map;this.aliasLoggerMap=new Map}init(){var St;const On=this.configService.getConfiguration("loggerFactory");this.loggerFactory=On||this.globalOptions["loggerFactory"]||new Sr.DefaultConsoleLoggerFactory;if(!this.loggerFactory.getDefaultMidwayLoggerConfig){throw new Er.MidwayFeatureNoLongerSupportedError("please upgrade your @midwayjs/logger to latest version")}const rr=this.loggerFactory.getDefaultMidwayLoggerConfig(this.configService.getAppInfo());this.configService.addObject(rr,true);this.initClients(this.configService.getConfiguration("midwayLogger"));(St=this.applicationContext)===null||St===void 0?void 0:St.registerObject("logger",this.getLogger("appLogger"))}createClient(St,On){if(St.aliasName){this.aliasLoggerMap.set(St.aliasName,On)}if(!St.lazyLoad){this.loggerFactory.createLogger(On,St)}else{delete St["lazyLoad"];this.lazyLoggerConfigMap.set(On,St)}}getName(){return"logger"}createLogger(St,On){delete On["aliasName"];return this.loggerFactory.createLogger(St,On)}getLogger(St){if(this.aliasLoggerMap.has(St)){St=this.aliasLoggerMap.get(St)}const On=this.loggerFactory.getLogger(St);if(On){return On}if(this.lazyLoggerConfigMap.has(St)){this.createClient(this.lazyLoggerConfigMap.get(St),St);this.lazyLoggerConfigMap.delete(St)}return this.loggerFactory.getLogger(St)}getCurrentLoggerFactory(){return this.loggerFactory}createContextLogger(St,On,rr){return this.loggerFactory.createContextLogger(St,On,rr)}getClients(){return this.clients}getClientKeys(){return Array.from(this.clients.keys())}};ir([(0,ur.Inject)(),cr("design:type",pr.MidwayConfigService)],kr.prototype,"configService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],kr.prototype,"init",null);kr=ir([(0,ur.Provide)(),(0,ur.Scope)(br.ScopeEnum.Singleton),cr("design:paramtypes",[Object,Object])],kr);On.MidwayLoggerService=kr},68220:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayMiddlewareService=void 0;const ur=rr(49757);const pr=rr(6192);const fr=rr(86314);const br=rr(65308);const Sr=rr(63289);const Er=rr(39023);const kr=(0,Er.debuglog)("midway:debug");let Pr=class MidwayMiddlewareService{constructor(St){this.applicationContext=St}async compose(St,On,rr){var ir;if(!Array.isArray(St)){throw new fr.MidwayParameterError("Middleware stack must be an array")}const cr=[];for(let rr of St){if(Sr.Types.isClass(rr)||typeof rr==="string"||(rr===null||rr===void 0?void 0:rr["middleware"])){let St=(ir=rr===null||rr===void 0?void 0:rr["middleware"])!==null&&ir!==void 0?ir:rr;const ur=rr===null||rr===void 0?void 0:rr["options"];let pr=rr===null||rr===void 0?void 0:rr["name"];if(typeof St==="string"&&!this.applicationContext.hasDefinition(St)){throw new fr.MidwayCommonError(`Middleware definition of "${St}" not found in midway container`)}const Sr=await this.applicationContext.getAsync(St);if(Sr){pr=pr!==null&&pr!==void 0?pr:Sr.constructor.name;St=await Sr.resolve(On,ur);if(!St){continue}if(!Sr.match&&!Sr.ignore){if(!St.name){St._name=pr}cr.push(St)}else{const On=(0,br.pathMatching)({match:Sr.match,ignore:Sr.ignore,thisResolver:Sr});rr=(rr,ir,cr)=>{if(!On(rr))return ir();return St(rr,ir,cr)};rr._name=pr;cr.push(rr)}}else{throw new fr.MidwayCommonError("Middleware must have resolve method!")}}else{cr.push(rr)}}const composeFn=(St,On)=>{const ir=(0,br.isIncludeProperty)(St,"body");let ur=-1;return dispatch(0);function dispatch(pr){if(pr<=ur)return Promise.reject(new fr.MidwayCommonError("next() called multiple times"));ur=pr;let br=cr[pr];if(pr===cr.length)br=On;if(!br)return Promise.resolve();const Sr=`${rr?`${rr}.`:""}${ur} ${br._name||br.name||"anonymous"}`;const Er=Date.now();kr(`[middleware]: in ${Sr} +0`);try{if(ir){return Promise.resolve(br(St,dispatch.bind(null,pr+1),{index:ur})).then((On=>{if(On!==undefined&&On!==St["body"]){St["body"]=On}else if(St["body"]!==undefined){On=St["body"]}kr(`[middleware]: out ${Sr} +${Date.now()-Er} with body`);return On}))}else{return Promise.resolve(br(St,dispatch.bind(null,pr+1),{index:ur})).then((St=>{kr(`[middleware]: out ${Sr} +${Date.now()-Er}`);return St}))}}catch(St){kr(`[middleware]: out ${Sr} +${Date.now()-Er} with err ${St.message}`);return Promise.reject(St)}}};if(rr){composeFn._name=rr}return composeFn}};Pr=ir([(0,ur.Provide)(),(0,ur.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Pr);On.MidwayMiddlewareService=Pr},77306:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};var ur;Object.defineProperty(On,"__esModule",{value:true});On.MidwayMockService=void 0;const pr=rr(6192);const fr=rr(49757);const br=rr(63289);let Sr=ur=class MidwayMockService{constructor(St){this.applicationContext=St;this.mocks=new Map;this.contextMocks=new Map;this.cache=new Map;this.simulatorList=[]}async init(){if(ur.prepareMocks.length>0){for(const St of ur.prepareMocks){this.mockProperty(St.obj,St.key,St.value,St.group)}ur.prepareMocks=[]}}static mockClassProperty(St,On,rr,ir="default"){this.mockProperty(St.prototype,On,rr,ir)}static mockProperty(St,On,rr,ir="default"){this.prepareMocks.push({obj:St,key:On,value:rr,group:ir})}mockClassProperty(St,On,rr,ir="default"){return this.mockProperty(St.prototype,On,rr,ir)}mockProperty(St,On,rr,ir="default"){const cr=St.hasOwnProperty(On);const ur={obj:St,key:On,descriptor:Object.getOwnPropertyDescriptor(St,On),hasOwnProperty:cr};if(!this.mocks.has(ir)){this.mocks.set(ir,[])}this.mocks.get(ir).push(ur);if(cr){delete St[On]}let pr=this.cache.get(ir);if(!pr){pr=new Map;this.cache.set(ir,pr)}let fr=pr.get(St);if(!fr){fr=new Set;pr.set(St,fr)}fr.add(On);const br=this.overridePropertyDescriptor(rr);Object.defineProperty(St,On,br)}mockContext(St,On,rr,ir="default"){if(!this.contextMocks.has(ir)){this.contextMocks.set(ir,[])}this.contextMocks.get(ir).push({app:St,key:On,value:rr})}restore(St="default"){this.restoreGroup(St)}restoreAll(){const St=new Set([...this.mocks.keys(),...this.contextMocks.keys(),...this.cache.keys()]);for(const On of St){this.restoreGroup(On)}this.simulatorList=[]}restoreGroup(St){const On=this.mocks.get(St)||[];for(let St=On.length-1;St>=0;St--){const rr=On[St];if(!rr.hasOwnProperty){delete rr.obj[rr.key]}else{Object.defineProperty(rr.obj,rr.key,rr.descriptor)}}this.mocks.delete(St);this.contextMocks.delete(St);this.cache.delete(St);this.simulatorList=this.simulatorList.filter((On=>On["group"]!==St))}isMocked(St,On,rr="default"){if((0,br.isClass)(St)){St=St.prototype}const ir=this.cache.get(rr);const cr=ir?ir.get(St):undefined;return cr?cr.has(On):false}applyContextMocks(St,On){for(const[,rr]of this.contextMocks){for(const ir of rr){if(ir.app===St){const St=this.overridePropertyDescriptor(ir.value);if(typeof ir.key==="string"){Object.defineProperty(On,ir.key,St)}else{ir.key(On)}}}}}getContextMocksSize(){return Array.from(this.contextMocks.values()).reduce(((St,On)=>St+On.length),0)}overridePropertyDescriptor(St){const On={configurable:true,enumerable:true};if(St&&(St.get||St.set)){On.get=St.get;On.set=St.set}else{On.value=St;On.writable=true}return On}async initSimulation(St="default"){const On=(0,fr.listModule)(fr.MOCK_KEY);for(const rr of On){const On=await this.applicationContext.getAsync(rr);if(await On.enableCondition()){On["group"]=St;this.simulatorList.push(On)}}}async runSimulatorSetup(){var St;for(const On of this.simulatorList){await((St=On.setup)===null||St===void 0?void 0:St.call(On))}}async runSimulatorTearDown(){var St;for(let On=this.simulatorList.length-1;On>=0;On--){const rr=this.simulatorList[On];await((St=rr.tearDown)===null||St===void 0?void 0:St.call(rr))}}async runSimulatorAppSetup(St){var On;for(const rr of this.simulatorList){await((On=rr.appSetup)===null||On===void 0?void 0:On.call(rr,St))}}async runSimulatorAppTearDown(St){var On;for(let rr=this.simulatorList.length-1;rr>=0;rr--){const ir=this.simulatorList[rr];await((On=ir.appTearDown)===null||On===void 0?void 0:On.call(ir,St))}}async runSimulatorContextSetup(St,On){var rr;for(const ir of this.simulatorList){await((rr=ir.contextSetup)===null||rr===void 0?void 0:rr.call(ir,St,On))}}async runSimulatorContextTearDown(St,On){var rr;for(let ir=this.simulatorList.length-1;ir>=0;ir--){const cr=this.simulatorList[ir];await((rr=cr===null||cr===void 0?void 0:cr.contextTearDown)===null||rr===void 0?void 0:rr.call(cr,St,On))}}};Sr.prepareMocks=[];ir([(0,fr.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Sr.prototype,"init",null);ir([(0,fr.Destroy)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],Sr.prototype,"restoreAll",null);Sr=ur=ir([(0,fr.Provide)(),(0,fr.Scope)(pr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Sr);On.MidwayMockService=Sr},28602:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayPipelineService=On.PipelineContext=void 0;const ir=rr(49757);class PipelineContext{constructor(St){this.info={current:null,currentName:null};this.data=new Map;this.args=St}get(St){return this.data.get(St)}set(St,On){this.data.set(St,On)}keys(){const St=[];const On=this.data.keys();for(const rr of On){St.push(rr)}return St}}On.PipelineContext=PipelineContext;class MidwayPipelineService{constructor(St,On){this.applicationContext=St;this.valves=On}async parallel(St){const On=this.prepareParallelValves(St);const rr=await Promise.all(On);return this.packResult(rr,false)}async concat(St){const On=this.prepareParallelValves(St);const rr=await Promise.all(On);return this.packResult(rr,true)}async series(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const ir={success:true,result:null};const cr={};const ur={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let pr=1;for(const St of On){ur.prev=ur.current;ur.prevName=getName(ur.prev);ur.current=St;ur.currentName=getName(ur.current);if(pr<On.length){ur.next=On[pr];ur.nextName=getName(ur.next)}else{ur.next=undefined;ur.nextName=undefined}pr+=1;rr.info=ur;try{const On=await this.applicationContext.getAsync(St);const ir=await On.invoke(rr);let pr=St;if(On.alias){pr=On.alias}cr[pr]=ir;ur.prevValue=ir}catch(On){ir.success=false;ir.error={valveName:typeof St==="string"?St:St.name,message:On.message,error:On};return ir}}ir.result=cr;return ir}async concatSeries(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);const ir={success:true,result:null};const cr=[];const ur={prevValue:null,current:null,currentName:null,prev:null,prevName:null,next:null,nextName:null};let pr=1;for(const St of On){ur.prev=ur.current;ur.prevName=getName(ur.prev);ur.current=St;ur.currentName=getName(ur.current);if(pr<On.length){ur.next=On[pr];ur.nextName=getName(ur.next)}else{ur.next=undefined;ur.nextName=undefined}pr+=1;rr.info=ur;try{const On=await this.applicationContext.getAsync(St);const ir=await On.invoke(rr);cr.push(ir);ur.prevValue=ir}catch(On){ir.success=false;ir.error={valveName:typeof St==="string"?St:St.name,message:On.message,error:On};return ir}}ir.result=cr;return ir}async waterfall(St){const On=await this.concatSeries(St);if(On.success){const St=On.result;On.result=St[St.length-1]}return On}mergeValves(St){let On=[];if(this.valves&&this.valves.length>0){On=this.valves}let rr=[];if(St){for(const ir of St){if(On.includes(ir)){rr.push(ir)}}}else{rr=On}return rr}prepareParallelValves(St){const On=this.mergeValves(St.valves);const rr=new PipelineContext(St.args);return On.map((async St=>{const On={valveName:St,dataKey:St,data:null};try{const ir=await this.applicationContext.getAsync(St);if(ir.alias){On.dataKey=ir.alias}On.data=await ir.invoke(rr)}catch(St){On.error=St}return On}))}packResult(St,On=false){const rr={success:true,result:null};let ir;if(On){ir=[]}else{ir={}}for(const cr of St){if(cr.error){rr.success=false;rr.error={valveName:typeof cr.valveName==="string"?cr.valveName:cr.valveName.name,message:cr.error.message,error:cr.error};return rr}else{if(On){ir.push(cr.data)}else{ir[cr.dataKey]=cr.data}}}rr.result=ir;return rr}}On.MidwayPipelineService=MidwayPipelineService;function getName(St){if(St){if(typeof St==="string"){return St}else{return(0,ir.getProviderName)(St)}}return null}},42592:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.WebRouterCollector=On.MidwayServerlessFunctionService=void 0;const ur=rr(49757);const pr=rr(19985);const fr=rr(9288);const br=rr(1845);const Sr=rr(50539);const Er=rr(6192);let kr=class MidwayServerlessFunctionService extends pr.MidwayWebRouterService{constructor(St={}){super(Object.assign({},St,{includeFunctionRouter:true}));this.options=St}async analyze(){this.analyzeController();this.analyzeFunction();this.sortPrefixAndRouter();for(const St of this.routes.values()){for(const On of St){if(On.requestMethod==="all"){On.functionTriggerMetadata=On.functionTriggerMetadata||{};On.functionTriggerMetadata.method=["get","post","put","delete","head","patch","options"]}}}}analyzeFunction(){const St=(0,ur.listModule)(ur.FUNC_KEY);for(const On of St){this.collectFunctionRoute(On)}}collectFunctionRoute(St){var On,rr,ir,cr,pr,fr,br,Sr,Er,kr,Pr,Ir,Lr,Br,jr,Ur,Vr;const Wr=(0,ur.getClassMetadata)(ur.FUNC_KEY,St);const zr=(0,ur.getProviderName)(St);const qr=(0,ur.getProviderUUId)(St);const Kr="/";if(!this.routes.has(Kr)){this.routes.set(Kr,[]);this.routesPriority.push({prefix:Kr,priority:-999,middleware:[],routerOptions:{},controllerId:zr,routerModule:St})}for(const Xr of Wr){if((On=Xr["metadata"])===null||On===void 0?void 0:On["path"]){const On=(0,ur.getPropertyDataFromClass)(ur.WEB_ROUTER_PARAM_KEY,St,Xr["methodName"])||[];const Pr=(0,ur.getPropertyMetadata)(ur.WEB_RESPONSE_KEY,St,Xr["methodName"])||[];const Ir={id:qr,prefix:Kr,routerName:"",url:Xr["metadata"]["path"],requestMethod:(ir=(rr=Xr["metadata"])===null||rr===void 0?void 0:rr["method"])!==null&&ir!==void 0?ir:"get",method:Xr["methodName"],description:"",summary:"",handlerName:`${zr}.${Xr["methodName"]}`,funcHandlerName:`${zr}.${Xr["methodName"]}`,controllerId:zr,middleware:((cr=Xr["metadata"])===null||cr===void 0?void 0:cr["middleware"])||[],controllerMiddleware:[],requestMetadata:On,responseMetadata:Pr};const Lr=(0,ur.getPropertyMetadata)(ur.SERVERLESS_FUNC_KEY,St,Xr["methodName"])||{};const Br=(br=(pr=Lr["functionName"])!==null&&pr!==void 0?pr:(fr=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||fr===void 0?void 0:fr["functionName"])!==null&&br!==void 0?br:createFunctionName(St,Xr["methodName"]);const jr=(kr=(Sr=Lr["handlerName"])!==null&&Sr!==void 0?Sr:(Er=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||Er===void 0?void 0:Er["handlerName"])!==null&&kr!==void 0?kr:Ir.funcHandlerName;Ir.functionName=Br;Ir.funcHandlerName=jr;Ir.functionTriggerName=Xr["type"];Ir.functionTriggerMetadata=Xr["metadata"];Ir.functionMetadata={functionName:Br,...Lr};this.checkDuplicateAndPush(Kr,Ir)}else{const On=(0,ur.getPropertyMetadata)(ur.SERVERLESS_FUNC_KEY,St,Xr["methodName"])||{};const rr=(Lr=(Pr=On["functionName"])!==null&&Pr!==void 0?Pr:(Ir=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||Ir===void 0?void 0:Ir["functionName"])!==null&&Lr!==void 0?Lr:createFunctionName(St,Xr["methodName"]);const ir=(Ur=(Br=On["handlerName"])!==null&&Br!==void 0?Br:(jr=Xr===null||Xr===void 0?void 0:Xr["metadata"])===null||jr===void 0?void 0:jr["handlerName"])!==null&&Ur!==void 0?Ur:`${zr}.${Xr["methodName"]}`;this.checkDuplicateAndPush(Kr,{id:qr,prefix:Kr,routerName:"",url:"",requestMethod:"",method:Xr["methodName"],description:"",summary:"",handlerName:`${zr}.${Xr["methodName"]}`,funcHandlerName:ir,controllerId:zr,middleware:((Vr=Xr["metadata"])===null||Vr===void 0?void 0:Vr["middleware"])||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:rr,functionTriggerName:Xr["type"],functionTriggerMetadata:Xr["metadata"],functionMetadata:{functionName:rr,...On}})}}}async getFunctionList(){return this.getFlattenRouterTable({compileUrlPattern:true})}addServerlessFunction(St,On,rr={}){var ir,cr;const ur="";if(!this.routes.has(ur)){this.routes.set(ur,[]);this.routesPriority.push({prefix:ur,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}const pr=(ir=On.functionName)!==null&&ir!==void 0?ir:rr.functionName;this.checkDuplicateAndPush(ur,{id:null,method:St,url:On.metadata["path"]||"",requestMethod:On.metadata["method"]||"",description:"",summary:"",handlerName:"",funcHandlerName:On.handlerName||rr.handlerName,controllerId:"",middleware:((cr=On.metadata)===null||cr===void 0?void 0:cr.middleware)||[],controllerMiddleware:[],requestMetadata:[],responseMetadata:[],functionName:pr,functionTriggerName:On.metadata.name,functionTriggerMetadata:On.metadata,functionMetadata:{functionName:pr,...rr}})}};kr=ir([(0,ur.Provide)(),(0,ur.Scope)(Er.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],kr);On.MidwayServerlessFunctionService=kr;function createFunctionName(St,On){return(0,ur.getProviderName)(St).replace(/[:#]/g,"-")+"-"+On}class WebRouterCollector{constructor(St="",On={}){this.baseDir=St;this.options=On}async init(){if(!this.proxy){if(this.baseDir){const St=new fr.MidwayContainer;(0,ur.bindContainer)(St);St.setFileDetector(new br.CommonJSFileDetector({loadDir:this.baseDir}));await St.ready()}if(this.options.includeFunctionRouter){if((0,Sr.getCurrentMainFramework)()){this.proxy=await(0,Sr.getCurrentMainFramework)().getApplicationContext().getAsync(kr,[this.options])}else{this.proxy=new kr(this.options)}}else{if((0,Sr.getCurrentMainFramework)()){this.proxy=await(0,Sr.getCurrentMainFramework)().getApplicationContext().getAsync(pr.MidwayWebRouterService,[this.options])}else{this.proxy=new pr.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()}}On.WebRouterCollector=WebRouterCollector},19985:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayWebRouterService=void 0;const ur=rr(49757);const pr=rr(65308);const fr=rr(86314);const br=rr(39023);const Sr=rr(73861);const Er=rr(63289);const kr=rr(6192);const Pr=br.debuglog("midway:debug");let Ir=class MidwayWebRouterService{constructor(St={}){this.options=St;this.isReady=false;this.routes=new Map;this.routesPriority=[]}async analyze(){this.analyzeController();this.sortPrefixAndRouter()}analyzeController(){const St=(0,ur.listModule)(ur.CONTROLLER_KEY);for(const On of St){const St=(0,ur.getClassMetadata)(ur.CONTROLLER_KEY,On);this.addController(On,St,this.options.includeFunctionRouter)}}sortPrefixAndRouter(){this.routesPriority=this.routesPriority.filter((St=>{const On=this.routes.get(St.prefix);if(On.length>0){return true}else{this.routes.delete(St.prefix);return false}}));for(const St of this.routes.keys()){const On=this.routes.get(St);this.routes.set(St,this.sortRouter(On))}this.routesPriority=this.routesPriority.sort(((St,On)=>On.prefix.length-St.prefix.length))}addController(St,On,rr={},ir=false){var cr;if(rr&&typeof rr==="boolean"){ir=rr;rr=undefined}if(!rr){rr={}}const br=(0,ur.getProviderName)(St);Pr(`[core]: Found Controller ${br}.`);const Sr=(0,ur.getProviderUUId)(St);On.routerOptions=On.routerOptions||{};let Er;const Ir=On.routerOptions.middleware;const Lr=!!((cr=On.routerOptions)===null||cr===void 0?void 0:cr.ignoreGlobalPrefix);let Br=(0,pr.joinURLPath)(this.options.globalPrefix,On.prefix||"/");const jr=On.prefix||"/";if(Lr){Br=jr}if(/\*/.test(Br)){throw new fr.MidwayCommonError(`Router prefix ${Br} can't set string with *`)}if(!this.routes.has(Br)){this.routes.set(Br,[]);this.routesPriority.push({prefix:Br,priority:Br==="/"&&Er===undefined?-999:0,middleware:Ir,routerOptions:On.routerOptions,controllerId:br,routerModule:St})}else{if(Ir&&Ir.length>0){const St=this.routesPriority.filter((St=>St.prefix===Br))[0];throw new fr.MidwayDuplicateControllerOptionsError(Br,br,St.controllerId)}}if(!this.routes.has(jr)){this.routes.set(jr,[]);this.routesPriority.push({prefix:jr,priority:jr==="/"&&Er===undefined?-999:0,middleware:Ir,routerOptions:On.routerOptions,controllerId:br,routerModule:St})}const Ur=(0,ur.getClassMetadata)(ur.WEB_ROUTER_KEY,St);if(Ur&&typeof Ur[Symbol.iterator]==="function"){for(const On of Ur){const cr=(0,ur.getPropertyDataFromClass)(ur.WEB_ROUTER_PARAM_KEY,St,On.method)||[];const fr=(0,ur.getPropertyMetadata)(ur.WEB_RESPONSE_KEY,St,On.method)||[];const Er={id:Sr,prefix:On.ignoreGlobalPrefix?jr:Br,routerName:On.routerName||"",url:On.path,requestMethod:On.requestMethod,method:On.method,description:On.description||"",summary:On.summary||"",handlerName:`${br}.${On.method}`,funcHandlerName:`${br}.${On.method}`,controllerId:br,controllerClz:St,middleware:On.middleware||[],controllerMiddleware:Ir||[],requestMetadata:cr,responseMetadata:fr};if(ir){Er.functionName=br+"-"+On.method;Er.functionTriggerName=kr.ServerlessTriggerType.HTTP;Er.functionTriggerMetadata={path:(0,pr.joinURLPath)(Br,On.path.toString()),method:On.requestMethod};Er.functionMetadata={functionName:Er.functionName}}if(rr.resourceFilter&&!rr.resourceFilter(Er)){continue}this.checkDuplicateAndPush(Er.prefix,Er)}}}addRouter(St,On){const rr=On.prefix||"";On.requestMethod=(On.requestMethod||"GET").toUpperCase();if(!this.routes.has(rr)){this.routes.set(rr,[]);this.routesPriority.push({prefix:rr,priority:0,middleware:[],routerOptions:{},controllerId:undefined,routerModule:undefined})}this.checkDuplicateAndPush(rr,Object.assign(On,{method:St}));this.sortPrefixAndRouter()}sortRouter(St){return St.map((St=>{const On=St.url.toString();const rr=Er.Types.isRegExp(St.url)?On.split("\\/"):On.split("/");let ir=0;for(const St of rr){if(St===""||St.includes(":")||St.includes("*")){ir+=0}else{ir+=1}}let cr=2;const ur=On.includes(":")?On.replace(/:.+$/,""):"";if(ur){cr=1}if(On.includes("*")){cr=0}return{...St,_pureRouter:On.replace(/\**$/,"").replace(/:\w+/,"123"),_level:On.split("/").length-1,_paramString:ur,_category:cr,_weight:ir}})).sort(((St,On)=>{if(St._category!==On._category){return On._category-St._category}if(St._weight!==On._weight){return On._weight-St._weight}if(St._level===On._level){if(On._pureRouter===St._pureRouter){return St.url.toString().length-On.url.toString().length}return On._pureRouter.length-St._pureRouter.length}return On._level-St._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(St={}){if(!this.isReady){await this.analyze();this.isReady=true}let On=[];for(const St of this.routesPriority){On=On.concat(this.routes.get(St.prefix))}if(St.compileUrlPattern){for(const St of On){if(St.fullUrlFlattenString){St.fullUrlCompiledRegexp=Sr.PathToRegexpUtil.toRegexp(St.fullUrlFlattenString)}}}return On}async getMatchedRouterInfo(St,On){const rr=await this.getFlattenRouterTable({compileUrlPattern:true});let ir;for(const cr of rr){if(cr.fullUrlCompiledRegexp){const rr=cr["requestMethod"].toUpperCase();if(("ALL"===rr||On.toUpperCase()===rr)&&cr.fullUrlCompiledRegexp.test(St)){ir=cr;break}}}return ir}checkDuplicateAndPush(St,On){const rr=this.routes.get(St);const ir=rr.filter((St=>On.url&&On.requestMethod&&St.url===On.url&&St.requestMethod===On.requestMethod));if(ir&&ir.length){throw new fr.MidwayDuplicateRouteError(`${On.requestMethod} ${On.url}`,`${ir[0].handlerName}`,`${On.handlerName}`)}if(!On.fullUrlFlattenString&&On.url&&typeof On.url==="string"){On.fullUrl=(0,pr.joinURLPath)(St,On.url);if(/\*$/.test(On.fullUrl)){On.fullUrlFlattenString=On.fullUrl.replace("*","(.*)")}else{On.fullUrlFlattenString=On.fullUrl}}rr.push(On)}};Ir=ir([(0,ur.Provide)(),(0,ur.Scope)(kr.ScopeEnum.Singleton),cr("design:paramtypes",[Object])],Ir);On.MidwayWebRouterService=Ir},29222:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.prepareGlobalApplicationContext=On.prepareGlobalApplicationContextAsync=On.destroyGlobalApplicationContext=On.initializeGlobalApplicationContext=void 0;const ir=rr(46123);const cr=rr(42193);const ur=rr(49757);const pr=rr(39023);const fr=rr(42592);const br=rr(16928);const Sr=rr(658);const Er=rr(70032);const kr=pr.debuglog("midway:debug");let Pr=1;function printStepDebugInfo(St){kr(`\n\nStep ${Pr++}: ${St}\n`)}async function initializeGlobalApplicationContext(St){Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);const On=await prepareGlobalApplicationContextAsync(St);printStepDebugInfo("Init logger");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);const rr=await On.getAsync(ir.MidwayLoggerService,[On,St]);if(rr.getLogger("appLogger")){On.registerObject("logger",rr.getLogger("appLogger"))}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LOGGER_PREPARE);printStepDebugInfo("Init MidwayMockService");await On.getAsync(ir.MidwayMockService,[On]);printStepDebugInfo("Init framework");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);await On.getAsync(ir.MidwayFrameworkService,[On,St]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.FRAMEWORK_PREPARE);printStepDebugInfo("Init lifecycle");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);await On.getAsync(ir.MidwayLifeCycleService,[On]);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.LIFECYCLE_PREPARE);printStepDebugInfo("Init preload modules");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);const cr=(0,ur.listPreloadModule)();for(const St of cr){await On.getAsync(St)}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.PRELOAD_MODULE_PREPARE);printStepDebugInfo("End of initialize and start");Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.INITIALIZE);return On}On.initializeGlobalApplicationContext=initializeGlobalApplicationContext;async function destroyGlobalApplicationContext(St){const On=await St.getAsync(ir.MidwayLoggerService);const rr=On.getCurrentLoggerFactory();const cr=await St.getAsync(ir.MidwayLifeCycleService);await cr.stop();await St.stop();(0,ur.clearBindContainer)();rr.close();Er.MidwayPerformanceManager.cleanAll();global["MIDWAY_APPLICATION_CONTEXT"]=undefined;global["MIDWAY_MAIN_FRAMEWORK"]=undefined}On.destroyGlobalApplicationContext=destroyGlobalApplicationContext;async function prepareGlobalApplicationContextAsync(St){var On,rr,Pr,Ir,Lr;printStepDebugInfo("Ready to create applicationContext");kr('[core]: start "initializeGlobalApplicationContext"');kr(`[core]: bootstrap options = ${pr.inspect(St)}`);const Br=(On=St.appDir)!==null&&On!==void 0?On:"";const jr=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const Ur=(Pr=St.applicationContext)!==null&&Pr!==void 0?Pr:new ir.MidwayContainer;kr("[core]: delegate module map from decoratorManager");(0,ur.bindContainer)(Ur);global["MIDWAY_APPLICATION_CONTEXT"]=Ur;Ur.registerObject("baseDir",jr);Ur.registerObject("appDir",Br);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);kr("[core]: set default file detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Ready module detector");if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){kr("[core]: set module load type = %s",St.moduleLoadType);if(!St.imports){St.imports=[await(0,ir.loadModule)((0,br.join)(jr,`configuration${(0,ir.isTypeScriptEnvironment)()?".ts":".js"}`),{loadMode:St.moduleLoadType,safeLoad:true})]}if(St.moduleDetector===undefined){if(St.moduleLoadType==="esm"){Ur.setFileDetector(new ir.ESModuleFileDetector({loadDir:jr,ignore:(Ir=St.ignore)!==null&&Ir!==void 0?Ir:[]}));St.moduleLoadType="esm"}else{Ur.setFileDetector(new ir.CommonJSFileDetector({loadDir:jr,ignore:(Lr=St.ignore)!==null&&Lr!==void 0?Lr:[]}))}}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");Ur.bindClass(ir.MidwayEnvironmentService);Ur.bindClass(ir.MidwayInformationService);Ur.bindClass(ir.MidwayAspectService);Ur.bindClass(ir.MidwayDecoratorService);Ur.bindClass(ir.MidwayConfigService);Ur.bindClass(ir.MidwayLoggerService);Ur.bindClass(ir.MidwayApplicationManager);Ur.bindClass(ir.MidwayFrameworkService);Ur.bindClass(ir.MidwayMiddlewareService);Ur.bindClass(ir.MidwayLifeCycleService);Ur.bindClass(ir.MidwayMockService);Ur.bindClass(ir.MidwayWebRouterService);Ur.bindClass(fr.MidwayServerlessFunctionService);Ur.bindClass(Sr.MidwayHealthService);Ur.bindClass(ir.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const On of St.preloadModules){Ur.bindClass(On)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Vr=Ur.get(ir.MidwayEnvironmentService);Vr.setModuleLoadType(St.moduleLoadType);const Wr=Ur.get(ir.MidwayConfigService);Wr.add([{default:cr.default}]);Ur.get(ir.MidwayAspectService,[Ur]);Ur.get(ir.MidwayDecoratorService,[Ur]);printStepDebugInfo("Load imports(component) and user code configuration module");Ur.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);await Ur.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){Wr.add(St.globalConfig)}else{Wr.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");Wr.load();kr("[core]: Current config = %j",Wr.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);Ur.get(ir.MidwayMiddlewareService,[Ur]);return Ur}On.prepareGlobalApplicationContextAsync=prepareGlobalApplicationContextAsync;function prepareGlobalApplicationContext(St){var On,rr,Pr,Ir;printStepDebugInfo("Ready to create applicationContext");kr('[core]: start "initializeGlobalApplicationContext"');kr(`[core]: bootstrap options = ${pr.inspect(St)}`);const Lr=(On=St.appDir)!==null&&On!==void 0?On:"";const Br=(rr=St.baseDir)!==null&&rr!==void 0?rr:"";Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);const jr=(Pr=St.applicationContext)!==null&&Pr!==void 0?Pr:new ir.MidwayContainer;kr("[core]: delegate module map from decoratorManager");(0,ur.bindContainer)(jr);global["MIDWAY_APPLICATION_CONTEXT"]=jr;jr.registerObject("baseDir",Br);jr.registerObject("appDir",Lr);Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.METADATA_PREPARE);printStepDebugInfo("Ready module detector");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);if(!St.moduleLoadType){St.moduleLoadType="commonjs"}if(St.moduleDetector!==false){if(St.moduleDetector===undefined){jr.setFileDetector(new ir.CommonJSFileDetector({ignore:(Ir=St.ignore)!==null&&Ir!==void 0?Ir:[]}))}else if(St.moduleDetector){jr.setFileDetector(St.moduleDetector)}}Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DETECTOR_PREPARE);printStepDebugInfo("Binding inner service");jr.bindClass(ir.MidwayEnvironmentService);jr.bindClass(ir.MidwayInformationService);jr.bindClass(ir.MidwayAspectService);jr.bindClass(ir.MidwayDecoratorService);jr.bindClass(ir.MidwayConfigService);jr.bindClass(ir.MidwayLoggerService);jr.bindClass(ir.MidwayApplicationManager);jr.bindClass(ir.MidwayFrameworkService);jr.bindClass(ir.MidwayMiddlewareService);jr.bindClass(ir.MidwayLifeCycleService);jr.bindClass(ir.MidwayMockService);jr.bindClass(ir.MidwayWebRouterService);jr.bindClass(fr.MidwayServerlessFunctionService);jr.bindClass(Sr.MidwayHealthService);jr.bindClass(ir.MidwayPriorityManager);printStepDebugInfo("Binding preload module");if(St.preloadModules&&St.preloadModules.length){for(const On of St.preloadModules){jr.bindClass(On)}}printStepDebugInfo("Init MidwayConfigService, MidwayAspectService and MidwayDecoratorService");const Ur=jr.get(ir.MidwayEnvironmentService);Ur.setModuleLoadType(St.moduleLoadType);const Vr=jr.get(ir.MidwayConfigService);Vr.add([{default:cr.default}]);jr.get(ir.MidwayAspectService,[jr]);jr.get(ir.MidwayDecoratorService,[jr]);printStepDebugInfo("Load imports(component) and user code configuration module");if(!St.imports){St.imports=[(0,ir.safeRequire)((0,br.join)(St.baseDir,"configuration"))]}jr.load([].concat(St.imports).concat(St.configurationModule));printStepDebugInfo("Run applicationContext ready method");Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);jr.ready();Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.DEFINITION_PREPARE);Er.MidwayInitializerPerformanceManager.markStart(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);if(St.globalConfig){if(Array.isArray(St.globalConfig)){Vr.add(St.globalConfig)}else{Vr.addObject(St.globalConfig)}}printStepDebugInfo("Load config file");Vr.load();kr("[core]: Current config = %j",Vr.getConfiguration());Er.MidwayInitializerPerformanceManager.markEnd(Er.MidwayInitializerPerformanceManager.MEASURE_KEYS.CONFIG_LOAD);jr.get(ir.MidwayMiddlewareService,[jr]);return jr}On.prepareGlobalApplicationContext=prepareGlobalApplicationContext},90406:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.pascalCase=On.camelCase=void 0;const rr=/[\p{Lu}]/u;const ir=/[\p{Ll}]/u;const cr=/([\p{Alpha}\p{N}_]|$)/u;const ur=/[_.\- ]+/;const pr=new RegExp("^"+ur.source);const fr=new RegExp(ur.source+cr.source,"gu");const br=new RegExp("\\d+"+cr.source,"gu");const preserveCamelCase=(St,On,cr)=>{let ur=false;let pr=false;let fr=false;for(let br=0;br<St.length;br++){const Sr=St[br];if(ur&&rr.test(Sr)){St=St.slice(0,br)+"-"+St.slice(br);ur=false;fr=pr;pr=true;br++}else if(pr&&fr&&ir.test(Sr)){St=St.slice(0,br-1)+"-"+St.slice(br-1);fr=pr;pr=false;ur=true}else{ur=On(Sr)===Sr&&cr(Sr)!==Sr;fr=pr;pr=cr(Sr)===Sr&&On(Sr)!==Sr}}return St};const postProcess=(St,On)=>{fr.lastIndex=0;br.lastIndex=0;return St.replace(fr,((St,rr)=>On(rr))).replace(br,(St=>On(St)))};function camelCaseOrigin(St,On){On={pascalCase:false,...On};St=St.trim();if(St.length===0){return""}const toLowerCase=St=>St.toLowerCase();const toUpperCase=St=>St.toUpperCase();if(St.length===1){if(ur.test(St)){return""}return On.pascalCase?toUpperCase(St):toLowerCase(St)}const rr=St!==toLowerCase(St);if(rr){St=preserveCamelCase(St,toLowerCase,toUpperCase)}St=St.replace(pr,"");St=toLowerCase(St);if(On.pascalCase){St=toUpperCase(St.charAt(0))+St.slice(1)}return postProcess(St,toUpperCase)}function camelCase(St){return camelCaseOrigin(St,{pascalCase:false})}On.camelCase=camelCase;function pascalCase(St){return camelCaseOrigin(St,{pascalCase:true})}On.pascalCase=pascalCase},50539:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getCurrentAsyncContextManager=On.getCurrentMainApp=On.getCurrentMainFramework=On.getCurrentApplicationContext=void 0;const ir=rr(2222);const getCurrentApplicationContext=()=>global["MIDWAY_APPLICATION_CONTEXT"];On.getCurrentApplicationContext=getCurrentApplicationContext;const getCurrentMainFramework=()=>global["MIDWAY_MAIN_FRAMEWORK"];On.getCurrentMainFramework=getCurrentMainFramework;const getCurrentMainApp=()=>{const St=(0,On.getCurrentMainFramework)();if(St){return St.getApplication()}return undefined};On.getCurrentMainApp=getCurrentMainApp;const getCurrentAsyncContextManager=()=>(0,On.getCurrentApplicationContext)().get(ir.ASYNC_CONTEXT_MANAGER_KEY);On.getCurrentAsyncContextManager=getCurrentAsyncContextManager},83486:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.extend=void 0;const ir=rr(63289);function extend(...St){let On,rr,cr,ur,pr;let fr=St[0];let br=1;const Sr=St.length;let Er=false;if(typeof fr==="boolean"){Er=fr;fr=St[1]||{};br=2}else if(typeof fr!=="object"&&typeof fr!=="function"||fr==null){fr={}}for(;br<Sr;++br){On=St[br];if(On==null)continue;for(rr in On){if(rr==="__proto__")continue;cr=fr[rr];ur=On[rr];if(fr===ur)continue;if(Er&&ur&&ir.Types.isPlainObject(ur)){pr=cr&&ir.Types.isPlainObject(cr)?cr:{};fr[rr]=extend(Er,pr,ur)}else if(typeof ur!=="undefined"){fr[rr]=ur}}}return fr}On.extend=extend},2764:(St,On)=>{"use strict";
2
2
  /*! (c) 2020 Andrea Giammarchi */Object.defineProperty(On,"__esModule",{value:true});On.safeStringify=On.safeParse=void 0;const{parse:rr,stringify:ir}=JSON;const{keys:cr}=Object;const ur=String;const pr="string";const fr={};const br="object";const noop=(St,On)=>On;const primitives=St=>St instanceof ur?ur(St):St;const Primitives=(St,On)=>typeof On===pr?new ur(On):On;const revive=(St,On,rr,ir)=>{const pr=[];for(let Sr=cr(rr),{length:Er}=Sr,kr=0;kr<Er;kr++){const cr=Sr[kr];const Er=rr[cr];if(Er instanceof ur){const ur=St[Er];if(typeof ur===br&&!On.has(ur)){On.add(ur);rr[cr]=fr;pr.push({k:cr,a:[St,On,ur,ir]})}else rr[cr]=ir.call(rr,cr,ur)}else if(rr[cr]!==fr)rr[cr]=ir.call(rr,cr,Er)}for(let{length:St}=pr,On=0;On<St;On++){const{k:St,a:cr}=pr[On];rr[St]=ir.call(rr,St,revive.apply(null,cr))}return rr};const set=(St,On,rr)=>{const ir=ur(On.push(rr)-1);St.set(rr,ir);return ir};function safeParse(St,On){const ir=rr(St,Primitives).map(primitives);const cr=ir[0];const ur=On||noop;const pr=typeof cr===br&&cr?revive(ir,new Set,cr,ur):cr;return ur.call({"":pr},"",pr)}On.safeParse=safeParse;function safeStringify(St,On,rr){const cr=On&&typeof On===br?(St,rr)=>St===""||-1<On.indexOf(St)?rr:void 0:On||noop;const ur=new Map;const fr=[];const Sr=[];let Er=+set(ur,fr,cr.call({"":St},"",St));let kr=!Er;while(Er<fr.length){kr=true;Sr[Er]=ir(fr[Er++],replace,rr)}return"["+Sr.join(",")+"]";function replace(St,On){if(kr){kr=!kr;return On}const rr=cr.call(this,St,On);switch(typeof rr){case br:if(rr===null)return rr;case pr:return ur.get(rr)||set(ur,fr,rr)}return rr}}On.safeStringify=safeStringify},30001:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FORMAT=void 0;const rr=1e3;const ir=rr*60;const cr=ir*60;const ur=cr*24;const pr=ur*7;const fr=ur*365.25;const br={ONE_SECOND:rr,ONE_MINUTE:ir,ONE_HOUR:cr,ONE_DAY:ur,ONE_WEEK:pr,ONE_YEAR:fr};const Sr={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 * * * *"};On.FORMAT={MS:br,CRONTAB:Sr}},7589:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FileUtils=On.exists=void 0;const ir=rr(79896);async function exists(St){return ir.promises.access(St,ir.constants.F_OK).then((()=>true)).catch((()=>false))}On.exists=exists;On.FileUtils={exists:exists}},87653:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpClient=On.makeHttpRequest=void 0;const ir=rr(58611);const cr=rr(65692);const ur=rr(87016);const pr=rr(39023);const fr=rr(86314);const br=(0,pr.debuglog)("request-client");const Sr=ur.URL;const Er={text:"application/text",json:"application/json",octet:"application/octet-stream"};function isHeaderExists(St,On){return St[On]||St[On.toLowerCase()]||St[On.toUpperCase()]}async function makeHttpRequest(St,On={}){br(`request '${St}'`);const rr=new Sr(St);const ur=rr.protocol==="https:"?cr:ir;On.method=(On.method||"GET").toUpperCase();const{contentType:pr,dataType:kr,method:Pr,timeout:Ir=5e3,headers:Lr,...Br}=On;const jr={Accept:Er[kr]||Er.octet,...Lr};let Ur;if(Pr==="GET"&&On.data){for(const St of Object.keys(On.data)){rr.searchParams.set(St,On.data[St])}jr["Content-Length"]=0}else if(On.data){Ur=Buffer.from(JSON.stringify(On.data));if(!isHeaderExists(jr,"Content-Type")){jr["Content-Type"]=Er[pr]||Er.octet}if(!isHeaderExists(jr,"Content-Length")){jr["Content-Length"]=Ur.byteLength}}return new Promise(((On,ir)=>{const cr=ur.request(rr.toString(),{method:Pr,headers:jr,...Br},(rr=>{rr.setTimeout(Ir,(()=>{rr.destroy(new Error("Response Timeout"))}));rr.on("error",(St=>{ir(St)}));const cr=[];rr.on("data",(St=>{cr.push(St)}));rr.on("end",(()=>{let ur=Buffer.concat(cr);if(kr==="text"||kr==="json"){ur=ur.toString("utf8")}if(kr==="json"){try{ur=JSON.parse(ur)}catch(St){return ir(new Error("[httpclient] Unable to parse response data"))}}Object.assign(rr,{status:rr.statusCode,data:ur});br(`request '${St}' resolved with status ${rr.statusCode}`);On(rr)}))}));cr.setTimeout(Ir,(()=>{cr.destroy(new fr.MidwayUtilHttpClientTimeoutError("Request Timeout"))}));cr.on("error",(St=>{ir(St)}));if(Pr!=="GET"){cr.end(Ur)}else{cr.end()}}))}On.makeHttpRequest=makeHttpRequest;class HttpClient{constructor(St={}){this.defaultOptions=St}async request(St,On){return makeHttpRequest(St,Object.assign({},this.defaultOptions,On))}}On.HttpClient=HttpClient},65308:(St,On,rr)=>{"use strict";St=rr.nmd(St);Object.defineProperty(On,"__esModule",{value:true});On.Utils=On.createPromiseTimeoutInvokeChain=On.isTypeScriptEnvironment=On.toAsyncFunction=On.merge=On.generateRandomId=On.getParamNames=On.sleep=On.wrapAsync=On.isIncludeProperty=On.wrapMiddleware=On.pathMatching=On.toPathMatch=On.transformRequestObjectByType=On.deprecatedOutput=On.getCurrentDateString=On.delegateTargetProperties=On.delegateTargetMethod=On.delegateTargetAllPrototypeMethod=On.delegateTargetPrototypeMethod=On.joinURLPath=On.getUserHome=On.parsePrefix=On.safelyGet=On.loadModule=On.safeRequire=On.getCurrentEnvironment=On.isDevelopmentEnvironment=void 0;const ir=rr(16928);const cr=rr(79896);const ur=rr(39023);const pr=rr(14142);const fr=rr(73861);const br=rr(86314);const Sr=rr(90406);const Er=rr(2897);const kr=rr(2764);const Pr=rr(76982);const Ir=rr(63289);const Lr=rr(87016);const Br=(0,ur.debuglog)("midway:debug");const isDevelopmentEnvironment=St=>["local","test","unittest"].includes(St);On.isDevelopmentEnvironment=isDevelopmentEnvironment;const getCurrentEnvironment=()=>process.env["MIDWAY_SERVER_ENV"]||process.env["NODE_ENV"]||"prod";On.getCurrentEnvironment=getCurrentEnvironment;const safeRequire=(On,rr=true)=>{if(On.startsWith(`.${ir.sep}`)||On.startsWith(`..${ir.sep}`)){On=(0,ir.resolve)((0,ir.dirname)(St.parent.filename),On)}try{if(rr){return require(On)}else{const St=(0,cr.readFileSync)(On,{encoding:"utf-8"});return JSON.parse(St)}}catch(St){Br(`[core]: SafeRequire Warning\n\n${St.message}\n`);return undefined}};On.safeRequire=safeRequire;const jr={};const loadModule=async(On,ur={})=>{var pr,fr,br;ur.enableCache=(pr=ur.enableCache)!==null&&pr!==void 0?pr:true;ur.safeLoad=(fr=ur.safeLoad)!==null&&fr!==void 0?fr:false;ur.loadMode=(br=ur.loadMode)!==null&&br!==void 0?br:"commonjs";if(On.startsWith(`.${ir.sep}`)||On.startsWith(`..${ir.sep}`)){On=(0,ir.resolve)((0,ir.dirname)(St.parent.filename),On)}Br(`[core]: load module ${On}, cache: ${ur.enableCache}, mode: ${ur.loadMode}, safeLoad: ${ur.safeLoad}`);try{if(ur.enableCache){if(ur.loadMode==="commonjs"){return require(On)}else{if(On.endsWith(".json")){if(!jr[On]){const St=(0,cr.readFileSync)(On,{encoding:"utf-8"});jr[On]=JSON.parse(St)}return jr[On]}else{return await rr(53196)((0,Lr.pathToFileURL)(On).href)}}}else{const St=(0,cr.readFileSync)(On,{encoding:"utf-8"});return JSON.parse(St)}}catch(St){if(!ur.safeLoad){throw St}else{Br(`[core]: SafeLoadModule Warning\n\n${St.message}\n`);return undefined}}};On.loadModule=loadModule;function safelyGet(St,On){if(arguments.length===1){return On=>safelyGet(St,On)}if(typeof On==="undefined"||typeof On!=="object"||On===null){return void 0}const rr=typeof St==="string"?St.split("."):St;let ir=On;for(const St of rr){if(typeof ir==="undefined"||ir===null){return void 0}else if(typeof ir!=="object"){return void 0}ir=ir[St]}return ir}On.safelyGet=safelyGet;function parsePrefix(St){if(St.includes("@")){return St.slice(1)}return St}On.parsePrefix=parsePrefix;function getUserHome(){return process.env[process.platform==="win32"?"USERPROFILE":"HOME"]}On.getUserHome=getUserHome;function joinURLPath(...St){St=St.filter((St=>!!St));if(St.length===0){return""}let On=ir.posix.join(...St);On=On.replace(/\/+$/,"");if(!/^\//.test(On)){On="/"+On}return On}On.joinURLPath=joinURLPath;function delegateTargetPrototypeMethod(St,On,rr){On.forEach((On=>{if(On.prototype){Object.getOwnPropertyNames(On.prototype).forEach((On=>{if(On!=="constructor"&&!/^_/.test(On)&&!St.prototype[On]){St.prototype[On]=function(...St){return this.instance[On](...St)}}}))}}));if(rr){delegateTargetMethod(St,rr)}}On.delegateTargetPrototypeMethod=delegateTargetPrototypeMethod;function delegateTargetAllPrototypeMethod(St,On){do{delegateTargetPrototypeMethod(St,[On]);On=Object.getPrototypeOf(On)}while(On)}On.delegateTargetAllPrototypeMethod=delegateTargetAllPrototypeMethod;function delegateTargetMethod(St,On){On.forEach((On=>{St.prototype[On]=function(...St){return this.instance[On](...St)}}))}On.delegateTargetMethod=delegateTargetMethod;function delegateTargetProperties(St,On){On.forEach((On=>{Object.defineProperty(St.prototype,On,{get(){return this.instance[On]}})}))}On.delegateTargetProperties=delegateTargetProperties;const getCurrentDateString=(St=Date.now())=>{const On=new Date(St);return`${On.getFullYear()}-${(On.getMonth()+1).toString().padStart(2,"0")}-${On.getDate().toString().padStart(2,"0")}`};On.getCurrentDateString=getCurrentDateString;const deprecatedOutput=St=>{console.warn("DeprecationWarning: "+St)};On.deprecatedOutput=deprecatedOutput;const transformRequestObjectByType=(St,On)=>{if(On===undefined||On===null||On===Object||typeof St==="undefined"){return St}switch(On){case Number:return Number(St);case String:return String(St);case Boolean:if(St==="0"||St==="false"){return false}return Boolean(St);default:if(St instanceof On){return St}else{const rr=pr["plainToClass"]||pr["plainToInstance"];return rr(On,St)}}};On.transformRequestObjectByType=transformRequestObjectByType;function toPathMatch(St){if(typeof St==="boolean"){return On=>St}if(typeof St==="string"){const On=fr.PathToRegexpUtil.toRegexp(St.replace("*","(.*)"));if(On.global)On.lastIndex=0;return St=>On.test(St.path)}if(St instanceof RegExp){return On=>{if(St.global)St.lastIndex=0;return St.test(On.path)}}if(typeof St==="function")return St;if(Array.isArray(St)){const On=St.map((St=>toPathMatch(St)));return St=>On.some((On=>On(St)))}throw new br.MidwayCommonError("match/ignore pattern must be RegExp, Array or String, but got "+St)}On.toPathMatch=toPathMatch;function pathMatching(St){St=St||{};if(St.match&&St.ignore)throw new br.MidwayCommonError("options.match and options.ignore can not both present");if(!St.match&&!St.ignore)return()=>true;if(St.match&&!Array.isArray(St.match)){St.match=[St.match]}if(St.ignore&&!Array.isArray(St.ignore)){St.ignore=[St.ignore]}const createMatch=On=>{const rr=On.map((On=>{if(St.thisResolver){return toPathMatch(On).bind(St.thisResolver)}return toPathMatch(On)}));return St=>{for(let On=0;On<rr.length;On++){const ir=rr[On](St);if(ir){return true}}return false}};const On=St.match?createMatch(St.match):createMatch(St.ignore);return function pathMatch(rr){const ir=On(rr);return St.match?ir:!ir}}On.pathMatching=pathMatching;function wrapMiddleware(St,On){if(On.enable===false)return null;if(!On.match&&!On.ignore)return St;const rr=pathMatching(On);const fn=(On,ir)=>{if(!rr(On))return ir();return St(On,ir)};fn._name=St._name+"middlewareWrapper";return fn}On.wrapMiddleware=wrapMiddleware;function isOwnPropertyWritable(St,On){if(St==null)return false;const rr=typeof St;if(rr!=="object"&&rr!=="function")return false;return!!Object.getOwnPropertyDescriptor(St,On)}function isIncludeProperty(St,On){while(St){if(isOwnPropertyWritable(St,On))return true;St=Object.getPrototypeOf(St)}return false}On.isIncludeProperty=isIncludeProperty;function wrapAsync(St){return(...On)=>{if(typeof On[On.length-1]==="function"){const rr=On.pop();if(St.constructor.name!=="AsyncFunction"){const St=new TypeError("Must be an AsyncFunction");return rr(St)}return St.apply(St,On).then((St=>{rr(null,St)}),(St=>{rr(St)}))}else{return St.apply(St,On)}}}On.wrapAsync=wrapAsync;function sleep(St=1e3){return new Promise((On=>{setTimeout((()=>{On()}),St)}))}On.sleep=sleep;const Ur=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;function getParamNames(St){const On=St.toString().replace(Ur,"");let rr=On.slice(On.indexOf("(")+1,On.indexOf(")")).split(",").map((St=>St.trim().replace(/\s?=.*$/,"")));if(rr.length===1&&rr[0]===""){rr=[]}return rr}On.getParamNames=getParamNames;function generateRandomId(){return Pr.randomBytes(16).toString("hex")}On.generateRandomId=generateRandomId;function merge(St,On){if(!St){St=On;On=null}if(!St){return null}if(Array.isArray(St)){return St.concat(On||[])}if(typeof St==="object"){return Object.assign({},St,On)}throw new Error("can not merge meta that type of "+typeof St)}On.merge=merge;function toAsyncFunction(St){if(Ir.Types.isAsyncFunction(St)){return St}else{return async function(...On){return Promise.resolve(St.call(this,...On))}}}On.toAsyncFunction=toAsyncFunction;function isTypeScriptEnvironment(){const St=process.env.MIDWAY_TS_MODE;if("false"===St){return false}return St==="true"||!!require.extensions[".ts"]}On.isTypeScriptEnvironment=isTypeScriptEnvironment;async function createPromiseTimeoutInvokeChain(St){var On;if(!St.onSuccess){St.onSuccess=async St=>St}St.isConcurrent=(On=St.isConcurrent)!==null&&On!==void 0?On:true;St.promiseItems=St.promiseItems.map((St=>{if(St instanceof Promise){return{item:St}}else{return St}}));St.promiseItems=St.promiseItems.filter((St=>St["item"]instanceof Promise));if(St.isConcurrent){const On=St.promiseItems.map((On=>{const rr=new Promise(((rr,ir)=>{var cr;setTimeout((()=>{var rr;return ir(new br.MidwayCodeInvokeTimeoutError(St.methodName,(rr=On["timeout"])!==null&&rr!==void 0?rr:St.timeout))}),(cr=On["timeout"])!==null&&cr!==void 0?cr:St.timeout)}));return Promise.race([On["item"],rr]).then((rr=>St.onSuccess(rr,On["meta"]))).catch((rr=>St.onFail(rr,On["meta"])))}));return Promise.all(On)}else{const On=[];for(const rr of St.promiseItems){const ir=new Promise(((On,ir)=>{var cr;setTimeout((()=>{var On;return ir(new br.MidwayCodeInvokeTimeoutError(St.methodName,(On=rr["timeout"])!==null&&On!==void 0?On:St.timeout))}),(cr=rr["timeout"])!==null&&cr!==void 0?cr:St.timeout)}));try{const cr=await Promise.race([rr["item"],ir]).then((On=>St.onSuccess(On,rr["meta"])));On.push(cr)}catch(ir){On.push(St.onFail(ir,rr["meta"]));break}}return On}}On.createPromiseTimeoutInvokeChain=createPromiseTimeoutInvokeChain;On.Utils={sleep:sleep,getParamNames:getParamNames,camelCase:Sr.camelCase,pascalCase:Sr.pascalCase,randomUUID:Er.randomUUID,generateRandomId:generateRandomId,toAsyncFunction:toAsyncFunction,safeStringify:kr.safeStringify,safeParse:kr.safeParse,isTypeScriptEnvironment:isTypeScriptEnvironment}},61327:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getModuleRequirePathList=On.PathFileUtil=On.getFileContentSync=On.isPathEqual=On.isPath=void 0;const ir=rr(16928);const cr=rr(79896);function isPath(St){if(/(^[\.\/])|:|\\/.test(St)){return true}return false}On.isPath=isPath;function isPathEqual(St,On){if(!St||!On){return false}const rr=(0,ir.extname)(St);return St.replace(rr,"")===On}On.isPathEqual=isPathEqual;function getFileContentSync(St,On){return typeof St==="string"?(0,cr.readFileSync)(St,{encoding:On}):St}On.getFileContentSync=getFileContentSync;On.PathFileUtil={isPath:isPath,isPathEqual:isPathEqual,getFileContentSync:getFileContentSync};function getModuleRequirePathList(St){const On=[St,St.replace(/\//g,"_")];let rr={};const ir=[];Object.keys(require.cache||{}).forEach((St=>{let cr=-1;for(const St of On){const On=St.indexOf(St);if(On!==-1){cr=On;break}}if(cr===-1){return}const ur=St.slice(0,cr);if(rr[ur]){return}rr[ur]=true;ir.push(ur)}));rr=undefined;return ir}On.getModuleRequirePathList=getModuleRequirePathList},73861:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.PathToRegexpUtil=void 0;function lexer(St){const On=[];let rr=0;while(rr<St.length){const ir=St[rr];if(ir==="*"||ir==="+"||ir==="?"){On.push({type:"MODIFIER",index:rr,value:St[rr++]});continue}if(ir==="\\"){On.push({type:"ESCAPED_CHAR",index:rr++,value:St[rr++]});continue}if(ir==="{"){On.push({type:"OPEN",index:rr,value:St[rr++]});continue}if(ir==="}"){On.push({type:"CLOSE",index:rr,value:St[rr++]});continue}if(ir===":"){let ir="";let cr=rr+1;while(cr<St.length){const On=St.charCodeAt(cr);if(On>=48&&On<=57||On>=65&&On<=90||On>=97&&On<=122||On===95){ir+=St[cr++];continue}break}if(!ir)throw new TypeError(`Missing parameter name at ${rr}`);On.push({type:"NAME",index:rr,value:ir});rr=cr;continue}if(ir==="("){let ir=1;let cr="";let ur=rr+1;if(St[ur]==="?"){throw new TypeError(`Pattern cannot start with "?" at ${ur}`)}while(ur<St.length){if(St[ur]==="\\"){cr+=St[ur++]+St[ur++];continue}if(St[ur]===")"){ir--;if(ir===0){ur++;break}}else if(St[ur]==="("){ir++;if(St[ur+1]!=="?"){throw new TypeError(`Capturing groups are not allowed at ${ur}`)}}cr+=St[ur++]}if(ir)throw new TypeError(`Unbalanced pattern at ${rr}`);if(!cr)throw new TypeError(`Missing pattern at ${rr}`);On.push({type:"PATTERN",index:rr,value:cr});rr=ur;continue}On.push({type:"CHAR",index:rr,value:St[rr++]})}On.push({type:"END",index:rr,value:""});return On}function parse(St,On={}){const rr=lexer(St);const{prefixes:ir="./"}=On;const cr=`[^${escapeString(On.delimiter||"/#?")}]+?`;const ur=[];let pr=0;let fr=0;let br="";const tryConsume=St=>{if(fr<rr.length&&rr[fr].type===St)return rr[fr++].value};const mustConsume=St=>{const On=tryConsume(St);if(On!==undefined)return On;const{type:ir,index:cr}=rr[fr];throw new TypeError(`Unexpected ${ir} at ${cr}, expected ${St}`)};const consumeText=()=>{let St="";let On;while(On=tryConsume("CHAR")||tryConsume("ESCAPED_CHAR")){St+=On}return St};while(fr<rr.length){const St=tryConsume("CHAR");const On=tryConsume("NAME");const rr=tryConsume("PATTERN");if(On||rr){let fr=St||"";if(ir.indexOf(fr)===-1){br+=fr;fr=""}if(br){ur.push(br);br=""}ur.push({name:On||pr++,prefix:fr,suffix:"",pattern:rr||cr,modifier:tryConsume("MODIFIER")||""});continue}const fr=St||tryConsume("ESCAPED_CHAR");if(fr){br+=fr;continue}if(br){ur.push(br);br=""}const Sr=tryConsume("OPEN");if(Sr){const St=consumeText();const On=tryConsume("NAME")||"";const rr=tryConsume("PATTERN")||"";const ir=consumeText();mustConsume("CLOSE");ur.push({name:On||(rr?pr++:""),pattern:On&&!rr?cr:rr,prefix:St,suffix:ir,modifier:tryConsume("MODIFIER")||""});continue}mustConsume("END")}return ur}function compile(St,On){return tokensToFunction(parse(St,On),On)}function tokensToFunction(St,On={}){const rr=flags(On);const{encode:ir=St=>St,validate:cr=true}=On;const ur=St.map((St=>{if(typeof St==="object"){return new RegExp(`^(?:${St.pattern})$`,rr)}}));return On=>{let rr="";for(let pr=0;pr<St.length;pr++){const fr=St[pr];if(typeof fr==="string"){rr+=fr;continue}const br=On?On[fr.name]:undefined;const Sr=fr.modifier==="?"||fr.modifier==="*";const Er=fr.modifier==="*"||fr.modifier==="+";if(Array.isArray(br)){if(!Er){throw new TypeError(`Expected "${fr.name}" to not repeat, but got an array`)}if(br.length===0){if(Sr)continue;throw new TypeError(`Expected "${fr.name}" to not be empty`)}for(let St=0;St<br.length;St++){const On=ir(br[St],fr);if(cr&&!ur[pr].test(On)){throw new TypeError(`Expected all "${fr.name}" to match "${fr.pattern}", but got "${On}"`)}rr+=fr.prefix+On+fr.suffix}continue}if(typeof br==="string"||typeof br==="number"){const St=ir(String(br),fr);if(cr&&!ur[pr].test(St)){throw new TypeError(`Expected "${fr.name}" to match "${fr.pattern}", but got "${St}"`)}rr+=fr.prefix+St+fr.suffix;continue}if(Sr)continue;const kr=Er?"an array":"a string";throw new TypeError(`Expected "${fr.name}" to be ${kr}`)}return rr}}function match(St,On){const rr=[];const ir=toRegexp(St,rr,On);return regexpToFunction(ir,rr,On)}function regexpToFunction(St,On,rr={}){const{decode:ir=St=>St}=rr;return function(rr){const cr=St.exec(rr);if(!cr)return false;const{0:ur,index:pr}=cr;const fr=Object.create(null);for(let St=1;St<cr.length;St++){if(cr[St]===undefined)continue;const rr=On[St-1];if(rr.modifier==="*"||rr.modifier==="+"){fr[rr.name]=cr[St].split(rr.prefix+rr.suffix).map((St=>ir(St,rr)))}else{fr[rr.name]=ir(cr[St],rr)}}return{path:ur,index:pr,params:fr}}}function escapeString(St){return St.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function flags(St){return St&&St.sensitive?"":"i"}function regexpToRegexp(St,On){if(!On)return St;const rr=/\((?:\?<(.*?)>)?(?!\?)/g;let ir=0;let cr=rr.exec(St.source);while(cr){On.push({name:cr[1]||ir++,prefix:"",suffix:"",modifier:"",pattern:""});cr=rr.exec(St.source)}return St}function arrayToRegexp(St,On,rr){const ir=St.map((St=>toRegexp(St,On,rr).source));return new RegExp(`(?:${ir.join("|")})`,flags(rr))}function stringToRegexp(St,On,rr){return tokensToRegexp(parse(St,rr),On,rr)}function tokensToRegexp(St,On,rr={}){const{strict:ir=false,start:cr=true,end:ur=true,encode:pr=St=>St,delimiter:fr="/#?",endsWith:br=""}=rr;const Sr=`[${escapeString(br)}]|$`;const Er=`[${escapeString(fr)}]`;let kr=cr?"^":"";for(const rr of St){if(typeof rr==="string"){kr+=escapeString(pr(rr))}else{const St=escapeString(pr(rr.prefix));const ir=escapeString(pr(rr.suffix));if(rr.pattern){if(On)On.push(rr);if(St||ir){if(rr.modifier==="+"||rr.modifier==="*"){const On=rr.modifier==="*"?"?":"";kr+=`(?:${St}((?:${rr.pattern})(?:${ir}${St}(?:${rr.pattern}))*)${ir})${On}`}else{kr+=`(?:${St}(${rr.pattern})${ir})${rr.modifier}`}}else{if(rr.modifier==="+"||rr.modifier==="*"){kr+=`((?:${rr.pattern})${rr.modifier})`}else{kr+=`(${rr.pattern})${rr.modifier}`}}}else{kr+=`(?:${St}${ir})${rr.modifier}`}}}if(ur){if(!ir)kr+=`${Er}?`;kr+=!rr.endsWith?"$":`(?=${Sr})`}else{const On=St[St.length-1];const rr=typeof On==="string"?Er.indexOf(On[On.length-1])>-1:On===undefined;if(!ir){kr+=`(?:${Er}(?=${Sr}))?`}if(!rr){kr+=`(?=${Er}|${Sr})`}}return new RegExp(kr,flags(rr))}function toRegexp(St,On,rr){if(St instanceof RegExp)return regexpToRegexp(St,On);if(Array.isArray(St))return arrayToRegexp(St,On,rr);return stringToRegexp(St,On,rr)}On.PathToRegexpUtil={toRegexp:toRegexp,compile:compile,parse:parse,match:match}},25198:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.retryWith=On.retryWithAsync=void 0;const ir=rr(65308);const cr=rr(86314);function retryWithAsync(St,On=1,rr={}){let ur=On;let pr;return async(...fr)=>{do{try{return await St.bind(rr.receiver||this)(...fr)}catch(St){pr=St}if(rr.retryInterval>=0){await(0,ir.sleep)(rr.retryInterval)}}while(ur-- >0);if(rr.throwOriginError){throw pr}else{throw new cr.MidwayRetryExceededMaxTimesError(St.name||"anonymous",On,pr)}}}On.retryWithAsync=retryWithAsync;function retryWith(St,On=1,rr={}){let ir=On;let ur;return(...pr)=>{do{try{return St.bind(rr.receiver||this)(...pr)}catch(St){ur=St}}while(ir-- >0);if(rr.throwOriginError){throw ur}else{throw new cr.MidwayRetryExceededMaxTimesError(St.name||"anonymous",On,ur)}}}On.retryWith=retryWith},63289:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Types=On.isNullOrUndefined=On.isNull=On.isUndefined=On.isRegExp=On.isSet=On.isMap=On.isProxy=On.isNumber=On.isPlainObject=On.isObject=On.isFunction=On.isPromise=On.isGeneratorFunction=On.isAsyncFunction=On.isClass=On.isString=void 0;const ir=rr(39023);const cr=Function.prototype.toString;const ur=Object.prototype.hasOwnProperty;const pr=Object.prototype.toString;function isString(St){return typeof St==="string"}On.isString=isString;function isClass(St){if(typeof St!=="function"){return false}if(/^class[\s{]/.test(cr.call(St))){return true}}On.isClass=isClass;function isAsyncFunction(St){return ir.types.isAsyncFunction(St)}On.isAsyncFunction=isAsyncFunction;function isGeneratorFunction(St){return ir.types.isGeneratorFunction(St)}On.isGeneratorFunction=isGeneratorFunction;function isPromise(St){return ir.types.isPromise(St)}On.isPromise=isPromise;function isFunction(St){return typeof St==="function"}On.isFunction=isFunction;function isObject(St){return St!==null&&typeof St==="object"}On.isObject=isObject;function isPlainObject(St){if(!St||pr.call(St)!=="[object Object]"){return false}const On=ur.call(St,"constructor");const rr=St.constructor&&St.constructor.prototype&&ur.call(St.constructor.prototype,"isPrototypeOf");if(St.constructor&&!On&&!rr){return false}let ir;for(ir in St){}return typeof ir==="undefined"||ur.call(St,ir)}On.isPlainObject=isPlainObject;function isNumber(St){return typeof St==="number"}On.isNumber=isNumber;function isProxy(St){return ir.types.isProxy(St)}On.isProxy=isProxy;function isMap(St){return ir.types.isMap(St)}On.isMap=isMap;function isSet(St){return ir.types.isSet(St)}On.isSet=isSet;function isRegExp(St){return ir.types.isRegExp(St)}On.isRegExp=isRegExp;function isUndefined(St){return St===undefined}On.isUndefined=isUndefined;function isNull(St){return St===null}On.isNull=isNull;function isNullOrUndefined(St){return isUndefined(St)||isNull(St)}On.isNullOrUndefined=isNullOrUndefined;On.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:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.randomUUID=void 0;const ir=rr(76982);const cr=new Uint8Array(256);let ur=cr.length;function rng(){if(ur>cr.length-16){ir.randomFillSync(cr);ur=0}return cr.slice(ur,ur+=16)}const pr=[];for(let St=0;St<256;++St){pr.push((St+256).toString(16).slice(1))}function unsafeStringify(St,On=0){return(pr[St[On+0]]+pr[St[On+1]]+pr[St[On+2]]+pr[St[On+3]]+"-"+pr[St[On+4]]+pr[St[On+5]]+"-"+pr[St[On+6]]+pr[St[On+7]]+"-"+pr[St[On+8]]+pr[St[On+9]]+"-"+pr[St[On+10]]+pr[St[On+11]]+pr[St[On+12]]+pr[St[On+13]]+pr[St[On+14]]+pr[St[On+15]]).toLowerCase()}function randomUUID(St){if(!St&&ir["randomUUID"]){return ir["randomUUID"]()}const On=rng();On[6]=On[6]&15|64;On[8]=On[8]&63|128;return unsafeStringify(On)}On.randomUUID=randomUUID},46422:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.extractExpressLikeValue=On.extractKoaLikeValue=void 0;const ir=rr(49757);const cr=rr(65308);const extractKoaLikeValue=(St,On,rr)=>{if(ir.ALL===On){On=undefined}return function(ur,pr){switch(St){case ir.RouteParamTypes.NEXT:return pr;case ir.RouteParamTypes.BODY:return(0,cr.transformRequestObjectByType)(On&&ur.request.body?ur.request.body[On]:ur.request.body,rr);case ir.RouteParamTypes.PARAM:return(0,cr.transformRequestObjectByType)(On?ur.params[On]:ur.params,rr);case ir.RouteParamTypes.QUERY:return(0,cr.transformRequestObjectByType)(On?ur.query[On]:ur.query,rr);case ir.RouteParamTypes.HEADERS:return(0,cr.transformRequestObjectByType)(On?ur.get(On):ur.headers,rr);case ir.RouteParamTypes.SESSION:return(0,cr.transformRequestObjectByType)(On?ur.session[On]:ur.session,rr);case ir.RouteParamTypes.FILESTREAM:if(ur.getFileStream){return ur.getFileStream(On)}else if(ur.files){if(Array.isArray(ur.files)){return ur.files[0]}else{return ur.files}}else{return undefined}case ir.RouteParamTypes.FILESSTREAM:if(ur.multipart){return ur.multipart(On)}else if(ur.files){return ur.files}else{return undefined}case ir.RouteParamTypes.REQUEST_PATH:return ur["path"];case ir.RouteParamTypes.REQUEST_IP:return ur["ip"];case ir.RouteParamTypes.QUERIES:if(ur.queries){return(0,cr.transformRequestObjectByType)(On?ur.queries[On]:ur.queries,rr)}else{return(0,cr.transformRequestObjectByType)(On?ur.query[On]:ur.query,rr)}case ir.RouteParamTypes.FIELDS:return On?ur.fields[On]:ur.fields;case ir.RouteParamTypes.CUSTOM:return On?On(ur):undefined;default:return null}}};On.extractKoaLikeValue=extractKoaLikeValue;const extractExpressLikeValue=(St,On,rr)=>{if(ir.ALL===On){On=undefined}return function(ur,pr,fr){switch(St){case ir.RouteParamTypes.NEXT:return fr;case ir.RouteParamTypes.BODY:return(0,cr.transformRequestObjectByType)(On&&ur.body?ur.body[On]:ur.body,rr);case ir.RouteParamTypes.PARAM:return(0,cr.transformRequestObjectByType)(On?ur.params[On]:ur.params,rr);case ir.RouteParamTypes.QUERY:return(0,cr.transformRequestObjectByType)(On?ur.query[On]:ur.query,rr);case ir.RouteParamTypes.HEADERS:return(0,cr.transformRequestObjectByType)(On?ur.get(On):ur.headers,rr);case ir.RouteParamTypes.SESSION:return(0,cr.transformRequestObjectByType)(On?ur.session[On]:ur.session,rr);case ir.RouteParamTypes.FILESTREAM:return ur.files?ur.files[0]:undefined;case ir.RouteParamTypes.FILESSTREAM:return ur.files;case ir.RouteParamTypes.REQUEST_PATH:return ur["baseUrl"];case ir.RouteParamTypes.REQUEST_IP:return ur["ip"];case ir.RouteParamTypes.QUERIES:if(ur.queries){return(0,cr.transformRequestObjectByType)(On?ur.queries[On]:ur.queries,rr)}else{return(0,cr.transformRequestObjectByType)(On?ur.query[On]:ur.query,rr)}case ir.RouteParamTypes.FIELDS:return On?ur.fields[On]:ur.fields;case ir.RouteParamTypes.CUSTOM:return On?On(ur,pr):undefined;default:return null}}};On.extractExpressLikeValue=extractExpressLikeValue},73317:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.AbstractEventBus=On.AckResponder=On.createWaitHandler=void 0;const ir=rr(48001);const cr=rr(39023);const ur=rr(68108);const pr="_default_";const fr=null;function revertError(St){const On=new Error;On.name=St.name;On.message=St.message;On.stack=St.stack;return On}class MessageLimitSet extends Set{constructor(St){super();this.limit=St}add(St){if(this.size<this.limit){return super.add(St)}}}async function createWaitHandler(St,On={}){await new Promise(((rr,ir)=>{const cr=setTimeout((()=>{clearInterval(pr);clearTimeout(cr);ir(new ur.EventBusTimeoutError)}),On.timeout||5e3);const pr=setInterval((()=>{if(St()){clearInterval(pr);clearTimeout(cr);rr(true)}}),On.timeoutCheckInterval||500)}))}On.createWaitHandler=createWaitHandler;class ChunkIterator{constructor(St){this.debugLogger=St;this.buffer=[]}publish(St){this.buffer.push(St);if(this.waitingPromiseDeferred){const St=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;St.resolve(this.buffer.shift())}}error(St){if(this.waitingPromiseDeferred){const On=this.waitingPromiseDeferred;this.waitingPromiseDeferred=null;On.reject(St)}else{this.errorRisen=St}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 St={};St.promise=new Promise(((On,rr)=>{St.resolve=On;St.reject=rr}));this.waitingPromiseDeferred=St;return St.promise}}async next(){this.debugLogger("1 ChunkIterator run next and wait data");const{data:St,isEnd:On}=await this.tryToGetNextData();this.debugLogger("2 ChunkIterator get data",St,On);if(On){this.clear();return{value:undefined,done:true}}else{return{value:St,done:false}}}clear(){this.buffer.length=0}}class AckResponder{constructor(){this.isEndFlag=false}onData(St){this.dataHandler=St}onError(St){this.errorHandler=St}end(St){if(!this.isEndFlag){this.isEndFlag=true;if(St){this.sendData(St)}this.sendData(fr)}}sendData(St){if(this.dataHandler){this.dataHandler(St)}}send(St){if(!this.isEndFlag){this.sendData(St)}}error(St){if(!this.isEndFlag){if(this.errorHandler){this.errorHandler(St)}}}isEnd(){return this.isEndFlag}}On.AckResponder=AckResponder;class AbstractEventBus{constructor(St={}){this.options=St;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(ir.ListenerType.Error,(St=>{console.error(St)}));this.listener=(St,On)=>{var rr,cr;const ur=this.topicListener.get(((rr=St.messageOptions)===null||rr===void 0?void 0:rr.topic)||pr);if(ur){for(const rr of ur){if(rr["_subscribeOnce"]){ur.delete(rr)}new Promise((async(ir,cr)=>{try{await ir(rr(St,On))}catch(St){cr(St)}})).catch((St=>{if(On){On.error(St)}else{this.eventListenerMap.get(ir.ListenerType.Error)(St)}}))}}else{const rr=((cr=St.messageOptions)===null||cr===void 0?void 0:cr.topic)||pr;if(!this.topicMessageCache.has(rr)){this.topicMessageCache.set(rr,new MessageLimitSet(10))}this.topicMessageCache.get(rr).add({message:St,responder:On})}};this.setupEventBind()}createDebugger(){return(0,cr.debuglog)(`midway:event-bus:${this.isWorker()?"worker":"main "}`)}debugDataflow(St){if(St.messageCategory===ir.MessageCategory.IN){if(this.isMain()){return`${St.message.type}|${St.messageCategory}: worker => main(△)`}else{return`${St.message.type}|${St.messageCategory}: main => worker(△)`}}else{if(this.isMain()){return`${St.message.type}|${St.messageCategory}: main(△) => worker`}else{return`${St.message.type}|${St.messageCategory}: worker(△) => main`}}}async start(St){this.isInited=true;if(this.isMain()){await createWaitHandler((()=>this.isAllWorkerReady()),{timeout:this.options.initTimeout,timeoutCheckInterval:this.options.initTimeoutCheckInterval})}else{this.workerSubscribeMessage((St=>{this.transit({messageCategory:ir.MessageCategory.IN,message:St})}));this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:ir.MessageType.Inited,body:this.isInited,error:St?{name:St.name,message:St.message,stack:St.stack}:undefined}})}}addWorker(St){this.debugLogger(`Add worker(${this.getWorkerId(St)})`);if(!this.workerReady.has(this.getWorkerId(St))){this.debugLogger(`Init worker(${this.getWorkerId(St)}) status = false`);this.workerReady.set(this.getWorkerId(St),{worker:St,ready:false})}else{this.debugLogger(`Skip init worker(${this.getWorkerId(St)}) status`)}St===null||St===void 0?void 0:St["on"]("exit",(async On=>{if(!this.stopping){this.workerReady.delete(this.getWorkerId(St));const On=this.workers.findIndex((On=>this.getWorkerId(On)===this.getWorkerId(St)));this.workers.splice(On,1)}}));this.workerListenMessage(St,(St=>{this.transit({messageCategory:ir.MessageCategory.IN,message:St})}));this.workers.push(St)}isAllWorkerReady(){for(const[St,On]of this.workerReady){if(!On||!On.ready){this.debugLogger(`Worker(${St}) not ready.`);return false}}if(this.workerReady.size>0){this.debugLogger(`All worker(size=${this.workerReady.size}) is ready.`)}return true}setupEventBind(){this.messageReceiver=St=>{var On,rr,cr,ur,pr,br,Sr,Er,kr,Pr,Ir,Lr,Br,jr,Ur;if(!St.message||!St.message.messageId){return}this.debugLogger("EventCenter(%s) message = %j",this.debugDataflow(St),St);const Vr=St.message;if(St.messageCategory===ir.MessageCategory.OUT){if(Vr.type===ir.MessageType.Invoke||Vr.type===ir.MessageType.Request||Vr.type===ir.MessageType.Response||Vr.type===ir.MessageType.Broadcast){this.postMessage(Vr);(On=this.eventListenerMap.get(ir.ListenerType.Request))===null||On===void 0?void 0:On(Vr)}else if(Vr.type===ir.MessageType.Inited){this.postMessage(Vr);(rr=this.eventListenerMap.get(ir.ListenerType.Inited))===null||rr===void 0?void 0:rr(Vr)}}else if(St.messageCategory===ir.MessageCategory.IN){if(Vr.type===ir.MessageType.Invoke){const St=((cr=Vr.messageOptions)===null||cr===void 0?void 0:cr["isChunk"])===true;const On=new AckResponder;On.onData((rr=>{var cr;this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:this.generateMessageId(),workerId:this.getWorkerId(),type:ir.MessageType.Response,body:rr,messageOptions:{relatedMessageId:Vr.messageId,isChunk:St,topic:(cr=Vr.messageOptions)===null||cr===void 0?void 0:cr.topic}}});if(!St){On.end()}}));On.onError((rr=>{this.publish(rr,{relatedMessageId:Vr.messageId,isChunk:St});On.end()}));(ur=this.listener)===null||ur===void 0?void 0:ur.call(this,Vr,On);(pr=this.eventListenerMap.get(ir.ListenerType.Subscribe))===null||pr===void 0?void 0:pr(Vr)}else if(Vr.type===ir.MessageType.Request){(br=this.listener)===null||br===void 0?void 0:br.call(this,Vr);(Sr=this.eventListenerMap.get(ir.ListenerType.Subscribe))===null||Sr===void 0?void 0:Sr(Vr)}else if(Vr.type===ir.MessageType.Broadcast){if(this.isMain()){if(Vr.messageOptions["includeMainFromWorker"]===true){(Er=this.listener)===null||Er===void 0?void 0:Er.call(this,Vr);(kr=this.eventListenerMap.get(ir.ListenerType.Subscribe))===null||kr===void 0?void 0:kr(Vr)}this.broadcast(Vr.body,{...Vr.messageOptions,relatedMessageId:Vr.messageId,relatedWorkerId:Vr.workerId})}else{(Pr=this.listener)===null||Pr===void 0?void 0:Pr.call(this,Vr);(Ir=this.eventListenerMap.get(ir.ListenerType.Subscribe))===null||Ir===void 0?void 0:Ir(Vr)}}else if(Vr.type===ir.MessageType.Response){if((Lr=Vr.messageOptions)===null||Lr===void 0?void 0:Lr.relatedMessageId){const St=this.asyncMessageMap.get(Vr.messageOptions.relatedMessageId);const On=Vr.messageOptions["isChunk"]===true;if(St){if(!On||On&&Vr.body===fr){this.asyncMessageMap.delete(Vr.messageOptions.relatedMessageId)}St(Vr.error?revertError(Vr.error):undefined,Vr.body,On?Vr.body===fr:true)}else{}}else{(Br=this.listener)===null||Br===void 0?void 0:Br.call(this,Vr);(jr=this.eventListenerMap.get(ir.ListenerType.Subscribe))===null||jr===void 0?void 0:jr(Vr)}}else if(Vr.type===ir.MessageType.Inited){if(this.isMain()){if(Vr.error){this.debugLogger(`got worker ${Vr.workerId} ready failed`);this.eventListenerMap.get(ir.ListenerType.Error)(revertError(Vr.error))}else{(Ur=this.eventListenerMap.get(ir.ListenerType.Inited))===null||Ur===void 0?void 0:Ur(Vr);this.workerReady.get(Vr.workerId).ready=true;this.debugLogger(`got worker ${Vr.workerId} ready`)}}else{}}}}}transit(St){this.messageReceiver(St)}subscribe(St,On={}){const rr=On.topic||pr;if(!this.topicListener.has(rr)){this.topicListener.set(rr,new Set)}if(On.subscribeOnce){St["_subscribeOnce"]=true}this.topicListener.get(rr).add(St);St["_abortController"]={abort:()=>{this.topicListener.get(rr).delete(St)}};if(this.topicMessageCache.has(rr)&&this.topicMessageCache.get(rr).size>0){for(const St of this.topicMessageCache.get(rr)){this.listener(St.message,St.responder);if(On.subscribeOnce){break}}this.topicMessageCache.get(rr).clear()}return St["_abortController"]}subscribeOnce(St,On={}){On.subscribeOnce=true;return this.subscribe(St,On)}publish(St,On={}){if(St instanceof Error){this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:On.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?ir.MessageType.Request:ir.MessageType.Response,body:undefined,error:{name:St.name,message:St.message,stack:St.stack},messageOptions:On}})}else{this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:On.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:this.isMain()?ir.MessageType.Request:ir.MessageType.Response,body:St,messageOptions:On}})}}publishAsync(St,On={}){return new Promise(((rr,cr)=>{const ur=On.relatedMessageId||this.generateMessageId();this.useTimeout(ur,On.timeout,rr,cr);this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:ur,workerId:this.getWorkerId(),type:ir.MessageType.Invoke,body:St,messageOptions:{topic:On.topic,dispatchToken:On.dispatchToken}}})}))}publishChunk(St,On={}){const rr=On.relatedMessageId||this.generateMessageId();const cr=new ChunkIterator(this.debugLogger);this.useTimeout(rr,On.timeout,((St,On)=>{cr.publish({data:St,isEnd:On})}),(St=>{cr.error(St)}));this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:rr,workerId:this.getWorkerId(),type:this.isMain()?ir.MessageType.Invoke:ir.MessageType.Response,body:St,messageOptions:{isChunk:true,topic:On.topic}}});return cr}useTimeout(St,On=5e3,rr,ir){const cr=setTimeout((()=>{clearTimeout(cr);this.asyncMessageMap.delete(St);ir(new ur.EventBusPublishTimeoutError(St))}),On);this.asyncMessageMap.set(St,((St,On,ur)=>{if(ur||St){clearTimeout(cr)}if(St){ir(St)}else{rr(On,ur)}}))}broadcast(St,On={}){if(this.isWorker()){On={includeMainFromWorker:false,includeSelfFromWorker:false,...On}}this.transit({messageCategory:ir.MessageCategory.OUT,message:{messageId:On.relatedMessageId||this.generateMessageId(),workerId:this.getWorkerId(),type:ir.MessageType.Broadcast,body:St,messageOptions:On}})}postMessage(St){var On,rr,cr,pr,fr,br,Sr,Er;if(this.isMain()){if(this.workers.length>0){if(St.type===ir.MessageType.Broadcast){if(St.messageOptions&&St.messageOptions["relatedWorkerId"]){this.workers.forEach((On=>{if(St.messageOptions["includeSelfFromWorker"]===false&&this.getWorkerId(On)===St.messageOptions["relatedWorkerId"]){return}else{this.mainSendMessage(On,St)}}))}else{this.workers.forEach((On=>this.mainSendMessage(On,St)))}}else if((On=St.messageOptions)===null||On===void 0?void 0:On["targetWorkerId"]){const On=(cr=this.workerReady.get((rr=St.messageOptions)===null||rr===void 0?void 0:rr["targetWorkerId"]))===null||cr===void 0?void 0:cr.worker;if(!On){throw new ur.EventBusPublishSpecifyWorkerError((pr=St.messageOptions)===null||pr===void 0?void 0:pr["targetWorkerId"])}this.mainSendMessage(On,St)}else{if(this.options.dispatchStrategy){const On=this.options.dispatchStrategy(this.workers,(fr=St.messageOptions)===null||fr===void 0?void 0:fr.dispatchToken);if(On){try{this.mainSendMessage(On,St)}catch(On){(br=this.eventListenerMap.get(ir.ListenerType.Error))===null||br===void 0?void 0:br(new ur.EventBusMainPostError(St,On))}}else{throw new ur.EventBusDispatchStrategyError}}else{const[On,...rr]=this.workers;try{this.mainSendMessage(On,St)}catch(On){(Sr=this.eventListenerMap.get(ir.ListenerType.Error))===null||Sr===void 0?void 0:Sr(new ur.EventBusMainPostError(St,On))}this.workers=[...rr,On]}}}}else{try{this.workerSendMessage(St)}catch(On){(Er=this.eventListenerMap.get(ir.ListenerType.Error))===null||Er===void 0?void 0:Er(new ur.EventBusWorkerPostError(St,On))}}}onInited(St){this.eventListenerMap.set(ir.ListenerType.Inited,St)}onPublish(St){this.eventListenerMap.set(ir.ListenerType.Request,St)}onSubscribe(St){this.eventListenerMap.set(ir.ListenerType.Subscribe,St)}onError(St){this.eventListenerMap.set(ir.ListenerType.Error,St)}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)}}On.AbstractEventBus=AbstractEventBus},4779:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ChildProcessEventBus=void 0;const ir=rr(73317);const cr=rr(29907);const ur=rr(932);class ChildProcessEventBus extends ir.AbstractEventBus{workerSubscribeMessage(St){ur.on("message",St)}workerListenMessage(St,On){St.on("message",On)}workerSendMessage(St){ur.send(St)}mainSendMessage(St,On){St.send(On)}isMain(){return!this.isWorker()}isWorker(){var St;return(St=this.options.isWorker)!==null&&St!==void 0?St:cr.isWorker}getWorkerId(St){var On;return String(St?(On=St.pid)!==null&&On!==void 0?On:St===null||St===void 0?void 0:St["process"].pid:ur.pid)}}On.ChildProcessEventBus=ChildProcessEventBus},68108:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.EventBusDispatchStrategyError=On.EventBusPublishSpecifyWorkerError=On.EventBusWorkerPostError=On.EventBusMainPostError=On.EventBusTimeoutError=On.EventBusPublishTimeoutError=void 0;const ir=rr(39023);class EventBusPublishTimeoutError extends Error{constructor(St){super(`Message(${St}) publish timeout.`);this.name="EventBusPublishTimeoutError"}}On.EventBusPublishTimeoutError=EventBusPublishTimeoutError;class EventBusTimeoutError extends Error{constructor(){super("Waiting for ready timeout throws this error.");this.name="EventBusTimeoutError"}}On.EventBusTimeoutError=EventBusTimeoutError;class EventBusMainPostError extends Error{constructor(St,On){super((0,ir.format)("Main thread post message [%j] error => %s.",St,On.stack));this.name="EventBusMainPostError"}}On.EventBusMainPostError=EventBusMainPostError;class EventBusWorkerPostError extends Error{constructor(St,On){super((0,ir.format)("Worker post message [%j] error => %j.",St,On.stack));this.name="EventBusWorkerPostError"}}On.EventBusWorkerPostError=EventBusWorkerPostError;class EventBusPublishSpecifyWorkerError extends Error{constructor(St){super((0,ir.format)("Worker(%s) not find in ready map, maybe it is a wrong pid.",St));this.name="EventBusPublishSpecifyWorkerError"}}On.EventBusPublishSpecifyWorkerError=EventBusPublishSpecifyWorkerError;class EventBusDispatchStrategyError extends Error{constructor(){super("Dispatch strategy not found a worker and stop post.");this.name="EventBusDispatchStrategyError"}}On.EventBusDispatchStrategyError=EventBusDispatchStrategyError},5982:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});cr(rr(41836),On);cr(rr(4779),On);cr(rr(97633),On);cr(rr(68108),On);cr(rr(48001),On)},48001:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MessageCategory=On.ListenerType=On.MessageType=void 0;var rr;(function(St){St["Inited"]="inited";St["Request"]="request";St["Response"]="response";St["Invoke"]="invoke";St["Broadcast"]="broadcast"})(rr=On.MessageType||(On.MessageType={}));var ir;(function(St){St["Inited"]="inited";St["Request"]="request";St["Subscribe"]="Subscribe";St["WorkerChanged"]="worker_changed";St["Error"]="error"})(ir=On.ListenerType||(On.ListenerType={}));var cr;(function(St){St["IN"]="in";St["OUT"]="out"})(cr=On.MessageCategory||(On.MessageCategory={}))},97633:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.LocalEventBus=void 0;const ir=rr(73317);class LocalDispatcher{constructor(){this.pidIdx=0;this.initMessageQueue=[]}clear(){this.mainWorker=null;this.childWorker=null;this.pidIdx=0}generatePid(){return this.pidIdx++}}const cr=new LocalDispatcher;class LocalWorker{constructor(St){this.pid=St}onMessage(St){this.handler=St}on(){}getWorkerId(){return this.pid}terminate(){}}class LocalEventBus extends ir.AbstractEventBus{constructor(St={}){super(St);this.worker=new LocalWorker(cr.generatePid());if(this.isMain()){this.debugLogger(`Main id=${this.worker.getWorkerId()}`);cr.mainWorker=this.worker}else{this.debugLogger(`Child id=${this.worker.getWorkerId()}`);cr.childWorker=this.worker}}workerSubscribeMessage(St){if(this.isWorker()){cr.childWorker.onMessage(St)}}workerListenMessage(St,On){if(this.isMain()){cr.mainWorker.onMessage(On)}}workerSendMessage(St){if(cr.mainWorker.handler){cr.mainWorker.handler(St)}else{cr.initMessageQueue.push({to:"main",message:St})}}mainSendMessage(St,On){if(cr.childWorker.handler){cr.childWorker.handler(On)}else{cr.initMessageQueue.push({to:"worker",message:On})}}getWorkerId(St){return String((St||this.worker).getWorkerId())}isMain(){return!this.isWorker()}isWorker(){return this.options.isWorker}async start(St){if(this.isMain()){await(0,ir.createWaitHandler)((()=>cr.childWorker!=null),{timeout:this.options.waitWorkerTimeout,timeoutCheckInterval:this.options.waitWorkerCheckInterval||200});this.addWorker(cr.childWorker);if(cr.initMessageQueue.length){cr.initMessageQueue.forEach((({to:St,message:On})=>{if(St==="worker"){this.mainSendMessage(cr.childWorker,On)}else{this.workerSendMessage(On)}}));cr.initMessageQueue=[]}}await super.start(St)}async stop(){cr.clear();await super.stop()}}On.LocalEventBus=LocalEventBus},41836:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ThreadEventBus=void 0;const ir=rr(28167);const cr=rr(73317);class ThreadEventBus extends cr.AbstractEventBus{constructor(St={}){super(St);if(!this.options.encoder){this.options.encoder=St=>St}if(!this.options.decoder){this.options.decoder=St=>St}}workerSubscribeMessage(St){ir.parentPort.on("message",(On=>{St(this.options.decoder(On))}))}workerListenMessage(St,On){St.on("message",(St=>{On(this.options.decoder(St))}))}workerSendMessage(St){ir.parentPort.postMessage(this.options.encoder(St))}mainSendMessage(St,On){St.postMessage(this.options.encoder(On))}isMain(){return!this.isWorker()}isWorker(){var St;return(St=this.options.isWorker)!==null&&St!==void 0?St:!ir.isMainThread}getWorkerId(St){return String(St?St.threadId:ir.threadId)}}On.ThreadEventBus=ThreadEventBus},62525:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.run=void 0;const ir=rr(79896);const cr=rr(16928);const ur=rr(63268);const pr=rr(39023);const fr=rr(70857);const br=(0,pr.debuglog)("midway:glob");function formatWindowsPath(St){if(fr.platform()==="win32"&&St){return St.map((St=>St.split(cr.sep).join(cr.posix.sep)))}return St}const run=(St,On={cwd:process.cwd(),ignore:[]})=>{br(`midway glob pattern = ${St}, options = ${JSON.stringify(On)}`);const rr=Date.now();const pr=On.cwd;St=formatWindowsPath(St)||[];br(`after format pattern = ${St}`);const fr=ur(St,{ignore:formatWindowsPath(On.ignore)||[]});const Sr=ur("**",{ignore:formatWindowsPath(On.ignore)||[]});function globDirectory(St,On,rr,ur){if(!(0,ir.existsSync)(St)){return[]}const fr=(0,ir.readdirSync)(St);const Sr=[];for(let Er of fr){const fr=(0,cr.resolve)(St,Er);br(`resolvePath = ${fr}`);const kr=(0,ir.statSync)(fr);if(kr.isDirectory()&&rr(fr.replace(pr,""))){const St=globDirectory(fr,On,rr,ur);Sr.push(...St)}else if(kr.isFile()&&On(fr.replace(pr,""))){Sr.push(fr)}}return Sr}const Er=globDirectory(pr,fr,Sr,On);br(`midway glob timing ${Date.now()-rr}ms`);return Er};On.run=run},18309:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.httpProxy=void 0;On.httpProxy={enable:true}},94713:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.HttpProxyConfiguration=void 0;const ur=rr(46123);const pr=rr(18309);const fr=rr(25747);let br=class HttpProxyConfiguration{async onReady(){if(this.httpProxy.enable){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((St=>{St.useMiddleware(fr.HttpProxyMiddleware)}))}}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);ir([(0,ur.Config)("httpProxy"),cr("design:type",Object)],br.prototype,"httpProxy",void 0);br=ir([(0,ur.Configuration)({namespace:"http-proxy",importConfigs:[{default:pr}]})],br);On.HttpProxyConfiguration=br},62487:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(94713);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.HttpProxyConfiguration}});cr(rr(93468),On);cr(rr(25747),On)},93468:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},25747:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.HttpProxyMiddleware=void 0;const ur=rr(46123);const pr=rr(12593);let fr=class HttpProxyMiddleware{resolve(St){if(St.getNamespace()==="express"){return async(St,On,rr)=>this.execProxy(St,St,On,rr,false)}else{const On=St.getNamespace()==="faas";return async(St,rr)=>{var ir;const cr=((ir=St.request)===null||ir===void 0?void 0:ir.req)||St.request;return this.execProxy(St,cr,St,rr,On)}}}async execProxy(St,On,rr,ir,cr){var ur,fr,br;const Sr=this.getProxyList(St.url);if(!Sr){return ir()}const{proxy:Er,url:kr}=Sr;const Pr={};for(const rr of Object.keys(On.headers)){if(((ur=Er.ignoreHeaders)===null||ur===void 0?void 0:ur[rr])||St.header[rr]===undefined){continue}Pr[rr.toLowerCase()]=St.header[rr]}const Ir=On.headers["x-forwarded-for"];Pr["x-forwarded-for"]=Ir?`${Ir}, ${St.ip}`:St.ip;Pr["host"]=kr.host;delete Pr["content-length"];const Lr=On.method.toUpperCase();const Br=rr.res||rr;const jr=!cr&&Br.on&&Br.writable;const Ur={method:Lr,url:kr.href,headers:Pr,responseType:jr?"stream":"arrayBuffer",timeout:this.httpProxy.proxyTimeout||0};if(Lr==="POST"||Lr==="PUT"){Ur.data=(fr=On.body)!==null&&fr!==void 0?fr:(br=St.request)===null||br===void 0?void 0:br.body;if(On.headers["content-type"]==="application/x-www-form-urlencoded"&&typeof Ur.data!=="string"){Ur.data=Object.keys(Ur.data).map((St=>`${encodeURIComponent(St)}=${encodeURIComponent(Ur.data[St])}`)).join("&")}}const Vr=await pr(Ur).catch((St=>{if(!St||!St.response){throw St||new Error("proxy unknown error")}return St.response}));rr.type=Vr.headers["content-type"];const Wr={"transfer-encoding":true};if(jr){Wr["content-length"]=true}Object.keys(Vr.headers).forEach((St=>{if(Wr[St.toLowerCase()]){return}rr.set(St,Vr.headers[St])}));rr.status=Vr.status;if(jr){await new Promise((St=>{Br.on("finish",(()=>{if(Br.end){Br.end()}St(void 0)}));Vr.data.pipe(Br)}))}else{rr.body=Vr.data}}getProxyList(St){if(!this.httpProxy){return}this.httpProxy.default=this.httpProxy.default||{};const On=this.httpProxy.match?[this.httpProxy]:this.httpProxy.strategy?Object.values(this.httpProxy.strategy).map((St=>Object.assign({},this.httpProxy.default,St))):[];for(const rr of On){if(!rr.match){continue}if(!rr.match.test(St)){continue}if(rr.host){if(St[0]==="/"){St=rr.host+St}const On=new URL(St);return{proxy:rr,url:On}}else if(rr.target){const On=St.replace(rr.match,rr.target);return{proxy:rr,url:new URL(On)}}}}static getName(){return"http-proxy"}};ir([(0,ur.Config)("httpProxy"),cr("design:type",Object)],fr.prototype,"httpProxy",void 0);ir([(0,ur.Logger)(),cr("design:type",Object)],fr.prototype,"logger",void 0);fr=ir([(0,ur.Middleware)()],fr);On.HttpProxyMiddleware=fr},84845:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.i18n=void 0;const ir=rr(46123);On.i18n={defaultLocale:"en_US",localeTable:{en_US:{}},fallbacks:{},writeCookie:true,resolver:{queryField:"locale",cookieField:{fieldName:"locale",cookieDomain:"",cookieMaxAge:ir.FORMAT.MS.ONE_YEAR}},localsField:"i18n",missingKeyHandler:St=>St}},30673:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.I18nConfiguration=void 0;const ur=rr(46123);const pr=rr(84845);const fr=rr(82027);let br=class I18nConfiguration{async onReady(){this.applicationManager.getApplications(["koa","egg","faas","express"]).forEach((St=>{St.useMiddleware(fr.I18nMiddleware)}))}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);br=ir([(0,ur.Configuration)({namespace:"i18n",importConfigs:[{default:pr}]})],br);On.I18nConfiguration=br},35632:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayI18nService=On.MidwayI18nServiceSingleton=void 0;const ur=rr(46123);const pr=rr(77460);const fr=rr(65675);const br=rr(15578);let Sr=class MidwayI18nServiceSingleton{constructor(){this.localeTextMap=new Map;this.fallbackMatch=[];this.localeMatchCache={}}async init(){this.defaultLocale=(0,br.formatLocale)(this.i18nConfig.defaultLocale);for(const St in this.i18nConfig.localeTable){this.addLocale(St,getES6Object(this.i18nConfig.localeTable[St]))}for(const St in this.i18nConfig.fallbacks){this.fallbackMatch.push({pattern:fr((0,br.formatLocale)(St)),locale:(0,br.formatLocale)(this.i18nConfig.fallbacks[St])})}}addLocale(St,On){const rr=getMap(this.localeTextMap,St,true);for(const St in On){if(typeof On[St]==="string"){getMap(rr,"default").set(St,On[St])}else{for(const ir in On[St]){getMap(rr,St).set(ir,On[St][ir])}}}}translate(St,On={}){var rr,ir,cr;const ur=(0,br.formatLocale)((rr=On.locale)!==null&&rr!==void 0?rr:this.defaultLocale);const pr=(ir=On.args)!==null&&ir!==void 0?ir:[];const fr=(cr=On.group)!==null&&cr!==void 0?cr:"default";let Sr=this.getLocaleMappingText(ur,St,fr,pr);if(!Sr&&ur!==this.defaultLocale){if(this.fallbackMatch.length){const On=this.fallbackMatch.find((St=>{if(St.pattern(ur)){return true}}));if(On){Sr=this.getLocaleMappingText(On.locale,St,fr,pr)}}if(!Sr){Sr=this.getLocaleMappingText(this.defaultLocale,St,fr,pr)}}if(!Sr&&this.i18nConfig.missingKeyHandler){Sr=this.i18nConfig.missingKeyHandler(St,On)}return Sr}getAvailableLocale(St,On="default"){St=(0,br.formatLocale)(St);if(this.localeMatchCache[St+"_"+On]){return this.localeMatchCache[St+"_"+On]}if(this.localeTextMap.has(St)&&this.localeTextMap.get(St).has(On)){this.localeMatchCache[St+"_"+On]=St;return St}if(this.fallbackMatch.length){const rr=this.fallbackMatch.find((rr=>{if(rr.pattern(St)){if(this.localeTextMap.has(rr.locale)&&this.localeTextMap.get(rr.locale).has(On)){this.localeMatchCache[St+"_"+On]=rr.locale;return true}}}));if(rr){return rr.locale}}this.localeMatchCache[St+"_"+On]=this.defaultLocale;return this.defaultLocale}hasAvailableLocale(St){St=(0,br.formatLocale)(St);if(this.localeTextMap.has(St)){return true}if(this.fallbackMatch.length){const On=this.fallbackMatch.find((On=>{if(On.pattern(St)){if(this.localeTextMap.has(On.locale)){return true}}}));if(On){return true}}return false}getLocaleMapping(St,On="default"){St=(0,br.formatLocale)(St);const rr=this.localeTextMap.get(St);if(rr){return rr.get(On)}}getDefaultLocale(){return this.defaultLocale}getLocaleMappingText(St,On,rr,ir){const cr=this.localeTextMap.get(St);if(cr){const St=cr.get(rr);if(St){const rr=St.get(On);if(rr){return formatText(rr,ir)}}}}};ir([(0,ur.Config)("i18n"),cr("design:type",Object)],Sr.prototype,"i18nConfig",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Sr.prototype,"init",null);Sr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],Sr);On.MidwayI18nServiceSingleton=Sr;let Er=class MidwayI18nService{translate(St,On={}){if(!On.locale){On.locale=this.ctx.getAttr&&this.ctx.getAttr(pr.I18N_ATTR_KEY)}return this.i18nServiceSingleton.translate(St,On)}addLocale(St,On){this.i18nServiceSingleton.addLocale(St,On)}getLocaleMapping(St,On="default"){return this.i18nServiceSingleton.getLocaleMapping(St,On)}getDefaultLocale(){return this.i18nServiceSingleton.getDefaultLocale()}saveRequestLocale(St){var On,rr;if(St){(On=this.ctx)===null||On===void 0?void 0:On.setAttr(pr.I18N_ATTR_KEY,(0,br.formatLocale)(St))}else{(rr=this.ctx)===null||rr===void 0?void 0:rr.setAttr(pr.I18N_ATTR_KEY,(0,br.formatLocale)(this.getDefaultLocale()))}}getAvailableLocale(St,On="default"){return this.i18nServiceSingleton.getAvailableLocale(St,On)}hasAvailableLocale(St){return this.i18nServiceSingleton.hasAvailableLocale(St)}};ir([(0,ur.Inject)(),cr("design:type",Sr)],Er.prototype,"i18nServiceSingleton",void 0);ir([(0,ur.Inject)(),cr("design:type",Object)],Er.prototype,"ctx",void 0);Er=ir([(0,ur.Provide)()],Er);On.MidwayI18nService=Er;function formatText(St,On){if(Array.isArray(On)){return(0,br.formatWithArray)(St,On)}else{return(0,br.formatWithObject)(St,On)}}function getES6Object(St){for(const On in St){if(St[On]["default"]&&Object.keys(St[On]).length===1){St[On]=St[On].default}}return St}function getMap(St,On,rr=false){On=rr?(0,br.formatLocale)(On):On;if(!St.has(On)){St.set(On,new Map)}return St.get(On)}},68255:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.formatLocale=On.Configuration=void 0;var ur=rr(30673);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.I18nConfiguration}});cr(rr(35632),On);cr(rr(82027),On);cr(rr(77460),On);var pr=rr(15578);Object.defineProperty(On,"formatLocale",{enumerable:true,get:function(){return pr.formatLocale}})},77460:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.I18N_ATTR_KEY=void 0;On.I18N_ATTR_KEY="i18n:locale"},82027:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.I18nMiddleware=On.I18nFilter=void 0;const ur=rr(46123);const pr=rr(77460);const fr=rr(35632);const br=rr(15578);let Sr=class I18nFilter{match(St,On,rr){const ir=On.getAttr(pr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&ir&&this.resolverConfig.cookieField){const St={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain};rr.cookie(this.resolverConfig.cookieField.fieldName,ir,St)}}return St}};ir([(0,ur.Config)("i18n.resolver"),cr("design:type",Object)],Sr.prototype,"resolverConfig",void 0);ir([(0,ur.Config)("i18n"),cr("design:type",Object)],Sr.prototype,"i18nConfig",void 0);Sr=ir([(0,ur.Match)()],Sr);On.I18nFilter=Sr;let Er=class I18nMiddleware{resolve(St){if(St.getFrameworkType()===ur.MidwayFrameworkType.WEB_EXPRESS){St.useFilter(Sr);return async(St,On,rr)=>{const ir=await St.requestContext.getAsync(fr.MidwayI18nService);let cr;if(this.resolverConfig){cr=St.query[this.resolverConfig.queryField]||St.cookies[this.resolverConfig.cookieField.fieldName];if(!cr){let On=St.acceptsLanguages();if(On){if(Array.isArray(On)){if(On[0]==="*"){On=On.slice(1)}if(On.length>0){for(let St=0;St<On.length;St++){const rr=(0,br.formatLocale)(On[St]);if(ir.hasAvailableLocale(rr)){cr=rr;break}}}}else{cr=On}}}}if(cr){ir.saveRequestLocale(cr)}else{ir.saveRequestLocale()}On.locals[this.i18nConfig.localsField]=(St,On)=>ir.translate(St,{args:On});return rr()}}else{return async(St,On)=>{if(this.resolverConfig){let On=St.query[this.resolverConfig.queryField]||St.cookies.get(this.resolverConfig.cookieField.fieldName,{signed:false});const rr=await St.requestContext.getAsync(fr.MidwayI18nService);if(!On){let ir=St.acceptsLanguages();if(ir){if(Array.isArray(ir)){if(ir[0]==="*"){ir=ir.slice(1)}if(ir.length>0){for(let St=0;St<ir.length;St++){const cr=(0,br.formatLocale)(ir[St]);if(rr.hasAvailableLocale(cr)){On=cr;break}}}}else{On=ir}}}if(On){rr.saveRequestLocale(On)}else{rr.saveRequestLocale()}if(St.locals){St.locals[this.i18nConfig.localsField]=(St,On)=>rr.translate(St,{args:On})}}await On();const rr=St.getAttr(pr.I18N_ATTR_KEY);if(this.resolverConfig){if(this.i18nConfig.writeCookie&&rr&&this.resolverConfig.cookieField){const On={httpOnly:false,maxAge:this.resolverConfig.cookieField.cookieMaxAge,signed:false,domain:this.resolverConfig.cookieField.cookieDomain,overwrite:true};St.cookies.set(this.resolverConfig.cookieField.fieldName,rr,On)}}}}}static getName(){return"i18n"}};ir([(0,ur.Config)("i18n.resolver"),cr("design:type",Object)],Er.prototype,"resolverConfig",void 0);ir([(0,ur.Config)("i18n"),cr("design:type",Object)],Er.prototype,"i18nConfig",void 0);Er=ir([(0,ur.Middleware)()],Er);On.I18nMiddleware=Er},15578:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.formatLocale=On.formatWithObject=On.formatWithArray=void 0;const rr=/\{(\d+)\}/g;function formatWithArray(St,On){return St.replace(rr,((St,rr)=>{const ir=parseInt(rr);if(ir<On.length){return On[ir]}return St}))}On.formatWithArray=formatWithArray;const ir=/\{(.+?)\}/g;function formatWithObject(St,On){return St.replace(ir,((St,rr)=>{const ir=On[rr];if(ir){return ir}return St}))}On.formatWithObject=formatWithObject;function formatLocale(St){return St.replace("_","-").toLowerCase()}On.formatLocale=formatLocale},87370:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.info=void 0;const ir=rr(772);On.info={title:"Midway Info",infoPath:"/_info",hiddenKey:ir.DefaultHiddenKey,ignoreKey:[]}},47265:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.InfoConfiguration=void 0;const ur=rr(46123);const pr=rr(82934);const fr=rr(87370);let br=class InfoConfiguration{async onReady(){this.applicationManager.getApplications(["koa","faas","express","egg"]).forEach((St=>{St.useMiddleware(pr.InfoMiddleware)}))}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);br=ir([(0,ur.Configuration)({namespace:"info",importConfigs:[{default:fr}]})],br);On.InfoConfiguration=br},65295:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(47265);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.InfoConfiguration}});cr(rr(44120),On);cr(rr(82934),On);cr(rr(772),On)},44120:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.InfoService=void 0;const ur=rr(46123);const pr=rr(46123);const fr=rr(772);const br=rr(6730);const Sr=rr(70857);const Er=rr(16928);const kr=rr(65675);let Pr=class InfoService{async init(){this.secretMatchList=Array.from(new Set(this.defaultHiddenKey)).map((St=>kr(St)))}info(St){const On=[];On.push(this.projectInfo());On.push(this.systemInfo());On.push(this.resourceOccupationInfo());On.push(this.softwareInfo());On.push(this.midwayConfig());On.push(this.midwayService());On.push(this.timeInfo());On.push(this.envInfo());On.push(this.dependenciesInfo());On.push(this.networkInfo());const rr=On.map((({type:St,info:On})=>{const rr=Object.keys(On);const ir=rr.filter((St=>!this.ignoreKey.includes(St)));const cr={};for(const St of ir){cr[St]=On[St]}return{type:St,info:cr}}));if(St==="html"){return(0,br.renderToHtml)(rr,this.titleConfig)}return rr}projectInfo(){return{type:fr.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 St=process.platform;return{type:fr.InfoType.SYSTEM,info:{Platform:St==="win32"?"Windows":St,Node:process.versions.node,V8:process.versions.v8,ProcessId:process.pid,Arch:process.arch,Hostname:(0,Sr.hostname)(),HomeDir:(0,Sr.homedir)(),CWD:process.cwd(),ExecCommand:[].concat(process.argv,process.execArgv).join(" ")}}}resourceOccupationInfo(){const St=process.memoryUsage();const On=(0,Sr.cpus)();return{type:fr.InfoType.MEMORY_CPU,info:{"Memory Total Occupy":(0,br.bitToMB)(St.rss),"Heap Total Occupy":(0,br.bitToMB)(St.heapTotal),"Heap Used":(0,br.bitToMB)(St.heapUsed),"V8 C++ Object Memory":(0,br.bitToMB)(St.external),"System Total Memory":(0,br.bitToMB)((0,Sr.totalmem)()),CPU:`${On[0]?`${On[0].model} ${On[0].speed}MHz`:""} ${On.length} core `,"CPU Usage":On.map((St=>{const On=St.times;return((1-On.idle/(On.idle+On.user+On.nice+On.sys+On.irq))*100).toFixed(2)+"%"})).join(" / ")}}}softwareInfo(){const St=["@midwayjs/core","@midwayjs/decorator","@midwayjs/faas"];const On={};for(const rr of St){const St=this.midwayInformationService.getPkg();if(St){On[rr]=St.version}}return{type:fr.InfoType.SOFTWARE,info:On}}envInfo(){const St={};Object.keys(process.env).forEach((On=>{St[On]=this.filterSecretContent(On,process.env[On])}));return{type:fr.InfoType.ENVIRONMENT_VARIABLE,info:St}}timeInfo(){const St=(new Date).toString().split(" ");return{type:fr.InfoType.TIME,info:{Current:Date.now(),Uptime:(0,Sr.uptime)(),Timezone:St.length>=7?St[5]:"",TimezoneName:St.length>=7?St.slice(6).join(" ").replace(/\(/g,"").replace(/\)/g,""):""}}}networkInfo(){const St=(0,Sr.networkInterfaces)();const On={};Object.keys(St).forEach((rr=>{const ir=St[rr];let cr=rr;if(rr[rr.length-1]==="0"){cr=rr.slice(0,-1)}if(cr==="lo"){return}On[cr]=ir.sort((St=>{if(St.family==="IPv4"){return-1}return 1})).map((St=>`${St.family} ${St.address}`)).join(" / ")}));return{type:fr.InfoType.NETWORK,info:On}}dependenciesInfo(){const St=this.midwayInformationService.getPkg();const On=St.dependencies||{};const rr={};Object.keys(On).forEach((St=>{const ir=(0,br.safeRequire)((0,Er.join)(St,"package.json"),{});rr[St]=`${ir.version||"Not Found"}(${On[St]})`}));return{type:fr.InfoType.DEPENDENCIES,info:rr}}midwayService(){var St;const On={};if((St=this.container)===null||St===void 0?void 0:St.registry){for(const St of this.container.registry){const[rr,ir]=St;const cr=ir?(ir===null||ir===void 0?void 0:ir.name)||ir:typeof ir;On[rr]=`${(ir===null||ir===void 0?void 0:ir.namespace)?`${ir===null||ir===void 0?void 0:ir.namespace}:`:""}${cr}${(ir===null||ir===void 0?void 0:ir.scope)?` [${ir===null||ir===void 0?void 0:ir.scope}]`:""}`}}return{type:fr.InfoType.MIDWAY_SERVICE,info:On}}midwayConfig(){const St={};const On=this.configService.getConfiguration()||{};Object.keys(On).forEach((rr=>{St[rr]=this.safeJson(this.filterSecretContent(rr,On[rr]))}));return{type:fr.InfoType.MIDWAY_CONFIG,info:St}}filterSecretContent(St,On){if(typeof On==="string"){const rr=this.secretMatchList.some((On=>On(St.toLowerCase())));if(rr){return(0,br.safeContent)(On)}}else if(Array.isArray(On)){return On.map((On=>this.filterSecretContent(St,On)))}return On}safeJson(St){switch(typeof St){case"string":return`"${St}"`;case"number":return`${St}`;case"boolean":return String(St);case"object":if(!St){return"null"}if(Array.isArray(St)){return`[${St.map((St=>this.safeJson(St))).join(",")}]`}if(St instanceof RegExp){return`"${St.toString()}"`}const On=[];for(const rr in St){On.push(`"${rr}":${this.safeJson(this.filterSecretContent(rr,St[rr]))}`)}return`{${On.join(",")}}`;case"function":return`function ${St.name}(${St.length} args)`}return""}};ir([(0,ur.Inject)(),cr("design:type",pr.MidwayInformationService)],Pr.prototype,"midwayInformationService",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.MidwayConfigService)],Pr.prototype,"configService",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.MidwayEnvironmentService)],Pr.prototype,"environment",void 0);ir([(0,ur.Config)("info.title"),cr("design:type",String)],Pr.prototype,"titleConfig",void 0);ir([(0,ur.Config)("info.hiddenKey"),cr("design:type",Array)],Pr.prototype,"defaultHiddenKey",void 0);ir([(0,ur.Config)("info.ignoreKey"),cr("design:type",Array)],Pr.prototype,"ignoreKey",void 0);ir([(0,ur.ApplicationContext)(),cr("design:type",Object)],Pr.prototype,"container",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Pr.prototype,"init",null);Pr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],Pr);On.InfoService=Pr},772:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.InfoType=On.DefaultHiddenKey=void 0;On.DefaultHiddenKey=["keys","*key","*token","*secret*","pass*"];var rr;(function(St){St["PROJECT"]="Project";St["SYSTEM"]="System";St["MEMORY_CPU"]="Memory & CPU";St["SOFTWARE"]="Software";St["ENVIRONMENT_VARIABLE"]="Environment Variable";St["TIME"]="Time";St["NETWORK"]="Network";St["RESOURCE"]="Resource";St["DEPENDENCIES"]="Dependencies";St["MIDWAY_SERVICE"]="Midway Service";St["MIDWAY_CONFIG"]="Midway Config"})(rr=On.InfoType||(On.InfoType={}))},82934:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.InfoMiddleware=void 0;const ur=rr(46123);const pr=rr(44120);let fr=class InfoMiddleware{resolve(St){if(St.getFrameworkType()===ur.MidwayFrameworkType.WEB_EXPRESS){return async(St,On,rr)=>{if(St.path===this.infoPath){On.type("html");On.send(this.infoService.info("html"))}else{rr()}}}else{return async(St,On)=>{if(St.path===this.infoPath){return this.infoService.info("html")}return await On()}}}static getName(){return"info"}};ir([(0,ur.Config)("info.infoPath"),cr("design:type",String)],fr.prototype,"infoPath",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.InfoService)],fr.prototype,"infoService",void 0);fr=ir([(0,ur.Middleware)()],fr);On.InfoMiddleware=fr},6730:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.safeContent=On.renderToHtml=On.bitToMB=On.safeRequire=void 0;const ir=rr(79896);function safeRequire(St,On){try{if(!(0,ir.existsSync)(St)){return On}return JSON.parse((0,ir.readFileSync)(St,"utf8"))}catch(St){return On}}On.safeRequire=safeRequire;function bitToMB(St){return Number((St||0)/1024/1024).toFixed(2)+" MB"}On.bitToMB=bitToMB;function renderToHtml(St,On){let rr=`<div style="padding: 24px; font-size: 36px;background: #9999cb;font-weight: bold;">${On}</div>`;rr+=St.map((St=>{const On=Object.keys(St.info||{});return`<div class="infoType">${St.type}</div>\n <table style="border-collapse: collapse;width: 100%;">${On.map((On=>`<tr style="border: 1px solid #666;"><td class="infoName">${On}</td><td class="infoValue">${St.info[On]}</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;">${rr}</div>`}On.renderToHtml=renderToHtml;function safeContent(St=""){if(St.length<3){return"*".repeat(St.length)}else if(St.length<6){return St[0]+"*".repeat(St.length-1)}else if(St.length<10){return St[0]+"*".repeat(St.length-2)+St[St.length-1]}else if(St.length<15){return St.slice(0,2)+"*".repeat(St.length-4)+St.slice(-2)}else{return St.slice(0,3)+"*".repeat(St.length-6)+St.slice(-3)}}On.safeContent=safeContent},89619:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.siteFile=On.bodyParser=On.onerror=On.cookiesExtra=On.cookies=On.keys=On.koa=void 0;On.koa={contextLoggerFormat:St=>{var On,rr,ir;const cr=St.ctx;const ur=cr.userId||"-";const pr=(ir=(On=cr.traceId)!==null&&On!==void 0?On:(rr=cr.tracer)===null||rr===void 0?void 0:rr.traceId)!==null&&ir!==void 0?ir:"-";const fr=Date.now()-cr.startTime;const br=ur+"/"+cr.ip+"/"+pr+"/"+fr+"ms "+cr.method+" "+cr.url;return`${St.timestamp} ${St.LEVEL} ${St.pid} [${br}] ${St.message}`},serverTimeout:2*60*1e3};On.keys="";On.cookies={};On.cookiesExtra={defaultGetOptions:{}};On.onerror={};On.bodyParser={enable:true,encoding:"utf8",formLimit:"1mb",jsonLimit:"1mb",textLimit:"1mb",strict:true,queryString:{arrayLimit:100,depth:5,parameterLimit:1e3},onerror(St){St.message+=", check bodyParser config";throw St}};On.siteFile={enable:true,favicon:undefined}},9867:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.KoaConfiguration=void 0;const ur=rr(46123);const pr=rr(65579);const fr=rr(62229);const br=rr(89619);const Sr=rr(18713);const Er=rr(67241);let kr=class KoaConfiguration{init(){this.decoratorService.registerParameterHandler(ur.WEB_ROUTER_PARAM_KEY,(St=>(0,ur.extractKoaLikeValue)(St.metadata.type,St.metadata.propertyData,St.originParamType)(St.originArgs[0],St.originArgs[1])))}async onReady(){this.koaFramework.useMiddleware([Er.SiteFileMiddleware,Sr.BodyParserMiddleware])}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayDecoratorService)],kr.prototype,"decoratorService",void 0);ir([(0,ur.Inject)(),cr("design:type",fr.MidwayKoaFramework)],kr.prototype,"koaFramework",void 0);ir([(0,ur.Inject)(),cr("design:type",ur.MidwayConfigService)],kr.prototype,"configService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",void 0)],kr.prototype,"init",null);kr=ir([(0,ur.Configuration)({namespace:"koa",imports:[pr],importConfigs:[{default:br}]})],kr);On.KoaConfiguration=kr},62229:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwayKoaFramework=void 0;const cr=rr(46123);const ur=rr(60990);const pr=rr(53777);const fr=rr(10800);const br=rr(81236);const Sr=rr(69502);const Er=rr(83480);const kr=rr(72040);const Pr=Symbol("context#cookies");class KoaControllerGenerator extends cr.WebControllerGenerator{constructor(St,On){super(St,On);this.app=St;this.webRouterService=On}createRouter(St){const On=new pr(St);On.prefix(St.prefix);return On}generateController(St){return this.generateKoaController(St)}}let Ir=class MidwayKoaFramework extends cr.BaseFramework{configure(){return this.configService.getConfiguration("koa")}async applicationInitialize(St){const On=this.configService.getConfiguration("keys")||this.configurationOptions["keys"];if(!On){throw new cr.MidwayConfigMissingError("config.keys")}const rr=this.configService.getConfiguration("cookies");const ir=this.configService.getConfiguration("cookiesExtra.defaultGetOptions");this.app=new fr({keys:[].concat(On),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[Pr]){this[Pr]=new ur.Cookies(this,this.app.keys,rr,ir)}return this[Pr]},enumerable:true});Object.defineProperty(this.app.context,"locals",{get(){return this.state},set(St){this.state=St}});Object.defineProperty(this.app.context,"forward",{get(){return async function(St){const On=this.requestContext.get(cr.MidwayWebRouterService);const rr=await On.getMatchedRouterInfo(St,this.method);if(rr){if(rr.controllerClz){const St=await this.requestContext.getAsync(rr.controllerClz);return St[rr.method](this)}else if(typeof rr.method==="function"){return rr.method(this)}}else{throw new cr.httpError.NotFoundError(`Forward url ${St} Not Found`)}}}});const pr=this.configurationOptions.queryParseMode==="strict"?function(St){return!Array.isArray(St)?[St]:St}:this.configurationOptions.queryParseMode==="first"?function(St){return Array.isArray(St)?St[0]:St}:undefined;const kr=this;Object.defineProperty(this.app.request,"query",{get(){const St=this.querystring;const On=this._querycache=this._querycache||{};if(On[St])return On[St];if(kr.configurationOptions.queryParseMode){On[St]=Sr.parse(St,kr.configurationOptions.queryParseOptions||{})}else{On[St]=Er.parse(St)}if(pr){for(const rr in On[St]){On[St][rr]=pr(On[St][rr])}}return On[St]},set(St){this._querycache=this._querycache||{};this._querycache[this.querystring]=St}});const Ir=this.configService.getConfiguration("onerror");(0,br.setupOnError)(this.app,Ir,this.logger);const notFound=async(St,On)=>{await On();if(!St._matchedRoute&&St.body===undefined){throw new cr.httpError.NotFoundError(`${St.path} Not Found`)}};const midwayRootMiddleware=async(St,On)=>{this.app.createAnonymousContext(St);await(await this.applyMiddleware(notFound))(St,On);if(St.body===undefined&&!St.response._explicitStatus&&St._matchedRoute){St.body=undefined}};this.app.use(midwayRootMiddleware);this.webRouterService=await this.applicationContext.getAsync(cr.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((St=>{var On;const rr=St.middleware();rr._name=`midwayController(${((On=St===null||St===void 0?void 0:St.opts)===null||On===void 0?void 0:On.prefix)||"/"})`;this.app.use(rr)}))}generateController(St){return this.generator.generateKoaController(St)}async generateMiddleware(St){const On=await this.getApplicationContext().getAsync(St);return On.resolve()}async run(){await this.loadMidwayController();this.app.use=this.app.originUse;const St={...this.configurationOptions,...this.configurationOptions.serverOptions};if(St.key&&St.cert){St.key=cr.PathFileUtil.getFileContentSync(St.key);St.cert=cr.PathFileUtil.getFileContentSync(St.cert);St.ca=cr.PathFileUtil.getFileContentSync(St.ca);process.env.MIDWAY_HTTP_SSL="true";if(St.http2){this.server=rr(85675).createSecureServer(St,this.app.callback())}else{this.server=rr(65692).createServer(St,this.app.callback())}}else{if(St.http2){this.server=rr(85675).createServer(St,this.app.callback())}else{this.server=rr(58611).createServer(St,this.app.callback())}}this.applicationContext.registerObject(cr.HTTP_SERVER_KEY,this.server);if(cr.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 On=process.env.MIDWAY_HTTP_PORT||this.configurationOptions.listenOptions.port;if(On===0||On==="0"){On=await(0,kr.getFreePort)();this.logger.info(`Midway koa is listening on port ${On} (auto assigned)`)}this.configurationOptions.listenOptions.port=Number(On);if(this.configurationOptions.listenOptions.port){new Promise((St=>{this.server.listen(this.configurationOptions.listenOptions,(()=>{St()}));process.env.MIDWAY_HTTP_PORT=String(this.configurationOptions.listenOptions.port)}))}}async beforeStop(){if(this.server){new Promise((St=>{this.server.close(St);process.env.MIDWAY_HTTP_PORT=""}))}}getFrameworkType(){return cr.MidwayFrameworkType.WEB_KOA}getFrameworkName(){return"web:koa"}getServer(){return this.server}getPort(){return process.env.MIDWAY_HTTP_PORT}useMiddleware(St){this.middlewareManager.insertLast(St)}useFilter(St){this.filterManager.useFilter(St)}};Ir=ir([(0,cr.Framework)()],Ir);On.MidwayKoaFramework=Ir},47453:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=On.Framework=void 0;var ur=rr(62229);Object.defineProperty(On,"Framework",{enumerable:true,get:function(){return ur.MidwayKoaFramework}});cr(rr(77678),On);var pr=rr(9867);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return pr.KoaConfiguration}});cr(rr(67241),On);cr(rr(18713),On)},77678:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},18713:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.BodyParserMiddleware=void 0;const ur=rr(36952);const pr=rr(46123);let fr=class BodyParserMiddleware{resolve(){if(this.bodyparserConfig.enable){return ur(this.bodyparserConfig)}}static getName(){return"bodyParser"}};ir([(0,pr.Config)("bodyParser"),cr("design:type",Object)],fr.prototype,"bodyparserConfig",void 0);fr=ir([(0,pr.Middleware)()],fr);On.BodyParserMiddleware=fr},67241:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SiteFileMiddleware=void 0;const ur=rr(46123);const pr=rr(16928);const fr="public, max-age=2592000";let br=class SiteFileMiddleware{resolve(){if(this.siteFileConfig.enable){return async(St,On)=>{if(St.method!=="HEAD"&&St.method!=="GET")return On();if(St.path[0]!=="/")return On();if(St.path!=="/favicon.ico"){return On()}let rr=this.siteFileConfig["favicon"];if(rr===undefined){rr=Buffer.from("")}if(!rr)return On();if(typeof rr==="string")return St.redirect(rr);if(Buffer.isBuffer(rr)){St.set("cache-control",fr);St.body=rr;St.type=pr.extname(St.path);return}return On()}}}static getName(){return"siteFile"}};ir([(0,ur.Config)("siteFile"),cr("design:type",Object)],br.prototype,"siteFileConfig",void 0);br=ir([(0,ur.Middleware)()],br);On.SiteFileMiddleware=br},81236:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.setupOnError=void 0;const ir=rr(58611);const cr=rr(72040);const ur=rr(46123);function setupOnError(St,On,rr){const pr=Object.assign({accepts(){const St=On.accepts||cr.accepts;return St(this)},text(On,rr){rr.res._headers={};rr.set(On.headers);if((0,cr.isProduction)(St)){rr.body=ir.STATUS_CODES[rr.status]}else{rr.body=On.message}},html(On,rr){const ur=(0,cr.detectStatus)(On);if((0,cr.isProduction)(St)){if(ur>=500){rr.status=500;rr.body=`<h2>Internal Server Error, real status: ${ur}</h2>`;return}else{rr.status=ur;rr.body=`<h2>${ur} ${ir.STATUS_CODES[ur]}</h2>`;return}}if(St.getEnv()==="unittest"||St.getEnv()==="test"){rr.status=ur;rr.body=`${On.name}: ${On.message}\n${On.stack}`;return}rr.body=cr.tpl.replace("{{status}}",(0,cr.escapeHtml)(On.status)).replace("{{errorCode}}",(0,cr.escapeHtml)(On.code)).replace("{{stack}}",(0,cr.escapeHtml)(On.stack));rr.type="html"},json(On,rr){const ur=(0,cr.detectStatus)(On);const pr=On.code||On.type;if((0,cr.isProduction)(St)){if(ur>=500){rr.body={code:pr,message:ir.STATUS_CODES[ur]}}else{rr.body={code:pr,message:On.message}}}else{rr.body={code:pr,message:On.message,stack:On.stack}}}},On);St.on("error",((On,ir)=>{ir=ir||St.createAnonymousContext();const ur=(0,cr.detectStatus)(On);if(ur>=500){try{ir.logger.error(On)}catch(St){rr.error(On);rr.error(St)}return}try{ir.logger.warn(On)}catch(St){rr.warn(On);rr.error(St)}}));St.context.onerror=function(On){if(On==null)return;if(this.req)(0,cr.sendToWormhole)(this.req);if(!(On instanceof Error)){let St=On;if(typeof On==="object"){try{St=ur.Utils.safeStringify(On)}catch(St){}}const rr=new Error("non-error thrown: "+St);if(On){if(On.name)rr.name=On.name;if(On.message)rr.message=On.message;if(On.stack)rr.stack=On.stack;if(On.status)rr["status"]=On.status;if(On.headers)rr["headers"]=On.headers}On=rr}const rr=this.headerSent||!this.writable;if(rr)On.headerSent=true;St.emit("error",On,this);if(rr)return;if(On.code==="ENOENT")On.status=404;if(typeof On.status!=="number"||!ir.STATUS_CODES[On.status]){On.status=500}this.status=On.status;this.set(On.headers);let fr="text";if(pr.accepts){fr=pr.accepts.call(this,"html","text","json")}else{fr=this.accepts("html","text","json")}fr=fr||"text";if(pr.all){pr.all.call(this,On,this)}else{if(pr.redirect&&fr!=="json"){this.redirect(pr.redirect)}else{pr[fr].call(this,On,this);this.type=fr}}if(fr==="json"){this.body=JSON.stringify(this.body)}this.res.end(this.body)}}On.setupOnError=setupOnError},72040:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getFreePort=On.escapeHtml=On.tpl=On.isProduction=On.sendToWormhole=On.accepts=On.detectStatus=void 0;const ir=rr(69278);function detectStatus(St){let On=St.status||500;if(On<200){On=500}return On}On.detectStatus=detectStatus;function accepts(St){if(acceptJSON(St))return"json";return"html"}On.accepts=accepts;function acceptJSON(St){if(St.path.endsWith(".json"))return true;if(St.response.type&&St.response.type.indexOf("json")>=0)return true;if(St.accepts("html","text","json")==="json")return true;return false}function sendToWormhole(St){return new Promise((On=>{if(typeof St.resume!=="function"){return On()}St.unpipe&&St.unpipe();St.resume();if(St._readableState&&St._readableState.ended){return On()}if(!St.readable||St.destroyed){return On()}function cleanup(){St.removeListener("end",onEnd);St.removeListener("close",onEnd);St.removeListener("error",onError)}function onEnd(){cleanup();On()}function onError(){cleanup();On()}St.on("end",onEnd);St.on("close",onEnd);St.on("error",onError)}))}On.sendToWormhole=sendToWormhole;function isProduction(St){return St.getEnv()!=="local"&&St.getEnv()!=="unittest"}On.isProduction=isProduction;On.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 cr=/["'&<>]/;function escapeHtml(St){const On=""+St;const rr=cr.exec(On);if(!rr){return On}let ir;let ur="";let pr=0;let fr=0;for(pr=rr.index;pr<On.length;pr++){switch(On.charCodeAt(pr)){case 34:ir="&quot;";break;case 38:ir="&amp;";break;case 39:ir="&#39;";break;case 60:ir="&lt;";break;case 62:ir="&gt;";break;default:continue}if(fr!==pr){ur+=On.substring(fr,pr)}fr=pr+1;ur+=ir}return fr!==pr?ur+On.substring(fr,pr):ur}On.escapeHtml=escapeHtml;async function getFreePort(){return new Promise(((St,On)=>{const rr=(0,ir.createServer)();rr.listen(0,(()=>{try{const On=rr.address().port;rr.close();St(On)}catch(St){On(St)}}))}))}On.getFreePort=getFreePort},28520:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.LEVEL=On.DefaultLogLevels=void 0;On.DefaultLogLevels={none:0,error:1,trace:2,warn:3,info:4,verbose:5,debug:6,silly:7,all:8};On.LEVEL={none:"NONE",error:"ERROR",trace:"TRACE",warn:"WARN",info:"INFO",verbose:"VERBOSE",debug:"DEBUG",silly:"SILLY",all:"ALL"}},62379:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.LoggerFactory=void 0;const ir=rr(8481);const cr=rr(39023);const ur=rr(16928);const pr=rr(4002);const fr=cr.debuglog("midway:debug");class LoggerFactory extends Map{constructor(St={}){super();this.factoryOptions=St}createLogger(St,On){if(!this.has(St)){fr('[logger]: Create logger "%s" with options %j',St,On);const rr=new ir.MidwayLogger(Object.assign(On,this.factoryOptions));this.addLogger(St,rr);return rr}return this.getLogger(St)}addLogger(St,On,rr=true){if(!rr||!this.has(St)){if(this.get(St)!==On){if(On["onClose"]){On["onClose"]((()=>{this.delete(St)}))}if(On["on"]){On.on("close",(()=>this.delete(St)))}this.set(St,On)}}else{throw new Error(`logger id ${St} has duplicate`)}return this.get(St)}getLogger(St){return this.get(St)}removeLogger(St){const On=this.get(St);On===null||On===void 0?void 0:On["close"]();this.delete(St)}get(St){return super.get(St)}close(St){if(St){return this.removeLogger(St)}Array.from(this.keys()).forEach((St=>this.removeLogger(St)))}getDefaultMidwayLoggerConfig(St){var On;const rr=(0,pr.isDevelopmentEnvironment)(St.env);const ir=(On=process.env["MIDWAY_LOGGER_WRITEABLE_DIR"])!==null&&On!==void 0?On:St.root;if(!ir){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,ur.join)(ir,"logs",St.name),auditFileDir:".audit",transports:{console:rr?{autoColors:rr}:false,file:{bufferWrite:!rr},error:{bufferWrite:!rr}}},clients:{coreLogger:{fileLogName:"midway-core.log"},appLogger:{}}}}}createContextLogger(St,On,rr={}){return On.createContextLogger(St,rr)}}On.LoggerFactory=LoggerFactory},51169:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.MidwayBaseLogger=On.MidwayLoggerContainer=On.createConsoleLogger=On.createFileLogger=On.createLogger=On.clearAllLoggers=On.loggers=void 0;const ur=rr(62379);const pr=rr(8481);cr(rr(51314),On);cr(rr(8481),On);cr(rr(19870),On);cr(rr(3993),On);cr(rr(96242),On);cr(rr(53828),On);cr(rr(62379),On);cr(rr(4002),On);On.loggers=new ur.LoggerFactory;const clearAllLoggers=()=>{On.loggers.close()};On.clearAllLoggers=clearAllLoggers;const createLogger=(St,rr={})=>On.loggers.createLogger(St,rr);On.createLogger=createLogger;const createFileLogger=(St,rr)=>On.loggers.createLogger(St,{transports:{file:{dir:__dirname,fileLogName:"custom-logger.log",...rr}}});On.createFileLogger=createFileLogger;const createConsoleLogger=(St,rr={})=>On.loggers.createLogger(St,{transports:{console:rr}});On.createConsoleLogger=createConsoleLogger;On.MidwayLoggerContainer=ur.LoggerFactory;On.MidwayBaseLogger=pr.MidwayLogger},51314:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},8481:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayChildLogger=On.MidwayContextLogger=On.MidwayLogger=On.TransportManager=void 0;const ir=rr(4002);const cr=rr(70857);const ur=rr(19870);const pr=rr(96242);const fr=rr(3993);On.TransportManager=new Map;On.TransportManager.set("console",pr.ConsoleTransport);On.TransportManager.set("file",fr.FileTransport);On.TransportManager.set("error",fr.ErrorTransport);On.TransportManager.set("json",fr.JSONTransport);class MidwayLogger{constructor(St={}){this.transports=new Map;this.closeHandlers=[];St=(0,ir.formatLegacyLoggerOptions)(St);this.options=St;this.options.level=this.options.level||"silly";this.options.eol=this.options.eol||cr.EOL;if(this.options.transports){for(const St in this.options.transports){this.add(St,this.options.transports[St])}}}get level(){return this.options.level}set level(St){this.options.level=St}log(St,...On){this.transit(St,{},...On)}debug(...St){this.transit("debug",{},...St)}info(...St){this.transit("info",{},...St)}warn(...St){this.transit("warn",{},...St)}error(...St){this.transit("error",{},...St)}verbose(...St){this.transit("verbose",{},...St)}write(...St){this.transit(false,{},...St)}silly(...St){this.transit("silly",{},...St)}add(St,rr){if(rr){let ir;if(!(rr instanceof ur.Transport)){if(!On.TransportManager.has(St)){throw new Error(`Transport ${St} is not supported`)}else{ir=new(On.TransportManager.get(St))(rr)}}else{ir=rr}ir.setLoggerOptions(this.options);this.transports.set(St,ir)}}get(St){return this.transports.get(St)}remove(St,On={}){if(this.transports.has(St)){if(On.close===undefined||On.close){this.transports.get(St).close()}this.transports.delete(St)}}close(){for(const St of this.transports.keys()){this.remove(St,{close:true})}for(const St of this.closeHandlers){St()}}onClose(St){this.closeHandlers.push(St)}createContextLogger(St,On={}){return new MidwayContextLogger(St,this,On)}transit(St,On={},...rr){if(St!==false&&!(0,ir.isEnableLevel)(St,this.level)){return}for(const ir of this.transports.values()){ir.log(St,On,...rr)}}getChild(St={}){return new MidwayChildLogger(this,St)}}On.MidwayLogger=MidwayLogger;class MidwayContextLogger{constructor(St,On,rr={}){this.ctx=St;this.parentLogger=On;this.options=rr}debug(...St){this.transit("debug",...St)}info(...St){this.transit("info",...St)}warn(...St){this.transit("warn",...St)}error(...St){this.transit("error",...St)}verbose(...St){this.transit("verbose",...St)}write(...St){this.transit(false,...St)}transit(St,...On){this.parentLogger.transit(St,{ctx:this.ctx,contextFormat:this.options.contextFormat},...On)}getContext(){return this.ctx}}On.MidwayContextLogger=MidwayContextLogger;class MidwayChildLogger{constructor(St,On={}){this.parentLogger=St;this.meta=On}debug(...St){this.transit("debug",...St)}info(...St){this.transit("info",...St)}warn(...St){this.transit("warn",...St)}error(...St){this.transit("error",...St)}verbose(...St){this.transit("verbose",...St)}write(...St){this.transit(false,...St)}transit(St,...On){this.parentLogger.transit(St,this.meta,...On)}}On.MidwayChildLogger=MidwayChildLogger},96242:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ConsoleTransport=void 0;const ir=rr(19870);const cr=rr(4002);const ur=rr(78997);const pr=ur.supportsColor.stdout;class ConsoleTransport extends ir.Transport{log(St,On,...rr){if(!(0,cr.isEnableLevel)(St,this.options.level)){return}let ir=this.format(St,On,rr);if(process.env.FORCE_ENABLE_COLOR||this.options.autoColors&&pr){const On=this.getColor(St);ir=(0,ur.colorizeAll)(ir,On)}ir+=this.options.eol;if(St==="error"){process.stderr.write(ir)}else{process.stdout.write(ir)}}getColor(St){switch(St){case"debug":return ur.Color.blue;case"info":return ur.Color.green;case"warn":return ur.Color.yellow;case"error":return ur.Color.red;default:return ur.Color.white}}close(){}}On.ConsoleTransport=ConsoleTransport},3993:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.JSONTransport=On.ErrorTransport=On.FileTransport=void 0;const ir=rr(19870);const cr=rr(53828);const ur=rr(16928);const pr=rr(43106);const fr=rr(79896);const br=rr(4002);const Sr=rr(61256);const Er=rr(74450);class FileTransport extends ir.Transport{constructor(St={}){super(St);this.options=St;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,br.isValidFileName)(this.options.fileLogName)||!(0,br.isValidDirName)(this.options.dir)){throw new Error("Your path or filename contain an invalid character.")}const On={frequency:"custom",dateFormat:"YYYY-MM-DD",endStream:true,fileOptions:{flags:"a"},utc:false,extension:"",createSymlink:!(0,br.isWin32)(),maxFiles:"7d",zippedArchive:false};if(!this.options.auditFileDir){St.auditFileDir=this.options.dir}if(!ur.isAbsolute(this.options.auditFileDir)){St.auditFileDir=ur.join(this.options.dir,St.auditFileDir)}this.logStream=cr.FileStreamRotatorManager.getStream({...On,filename:ur.join(this.options.dir,this.options.fileLogName),size:(0,br.getMaxSize)(this.options.maxSize||"200m"),symlinkName:this.options.fileLogName,auditFile:ur.join(St.auditFileDir,"."+(0,Sr.hash)(this.options)+"-audit.json"),...St});this.logStream.on("logRemoved",(On=>{if(St.zippedArchive){const St=On.name+".gz";if(fr.existsSync(St)){try{fr.unlinkSync(St)}catch(St){console.error(St)}return}}}));if(St.zippedArchive){this.logStream.on("rotate",(St=>{const On=fr.existsSync(St);const rr=fr.existsSync(St+".gz");if(!On||rr){return}const ir=pr.createGzip();const cr=fr.createReadStream(St);const ur=fr.createWriteStream(St+".gz");cr.pipe(ir).pipe(ur).on("finish",(()=>{if(fr.existsSync(St)){fr.unlinkSync(St)}}))}))}}log(St,On,...rr){if(!(0,br.isEnableLevel)(St,this.options.level)){return}let ir=this.format(St,On,rr);ir+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=ir.length;this.buf.push(ir);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(ir)}}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){cr.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()}}On.FileTransport=FileTransport;class ErrorTransport extends FileTransport{constructor(St){St.level="error";super(St)}}On.ErrorTransport=ErrorTransport;class JSONTransport extends FileTransport{log(St,On,...rr){if(!(0,br.isEnableLevel)(St,this.options.level)){return}let ir=this.format(St,On,rr);if(typeof ir==="string"||Buffer.isBuffer(ir)){ir=(0,Er.stringify)({message:ir.toString()})}else{ir=(0,Er.stringify)(ir)}ir+=this.options.eol;if(this.options.bufferWrite){this.bufSize+=ir.length;this.buf.push(ir);if(this.buf.length>this.options.bufferMaxLength){this.flush()}}else{this.logStream.write(ir)}}}On.JSONTransport=JSONTransport},53828:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.FileStreamRotatorManager=On.FileStreamRotator=void 0;const ir=rr(79896);const cr=rr(16928);const ur=rr(76982);const pr=rr(24434);const fr=rr(39023);const br=rr(23046);const Sr=rr(15419);const Er=rr(42613);const kr=rr(4002);const Pr=(0,fr.debuglog)("midway-logger");const Ir=["daily","test","s","m","h","custom"];const Lr="YYYYMMDDHHmm";br.extend(Sr);class FileStreamRotator{getFrequency(St){const On=St.toLowerCase().match(/^(\d+)([smh])$/);if(On){return(0,kr.checkNumAndType)(On[2],parseInt(On[1]))}const rr=(0,kr.checkDailyAndTest)(St);if(rr){return rr}return false}parseFileSize(St){if(St&&typeof St==="string"){const On=St.toLowerCase().match(/^((?:0\.)?\d+)([kmg])$/);if(On){switch(On[2]){case"k":return On[1]*1024;case"m":return On[1]*1024*1024;case"g":return On[1]*1024*1024*1024}}}return null}getDate(St,On,rr){On=On||Lr;const ir=rr?br.utc():br().local();if(St&&Ir.indexOf(St.type)!==-1){switch(St.type){case"s":const rr=Math.floor(ir.second()/St.digit)*St.digit;return ir.second(rr).format(On);case"m":const cr=Math.floor(ir.minute()/St.digit)*St.digit;return ir.minute(cr).format(On);case"h":const ur=Math.floor(ir.hour()/St.digit)*St.digit;return ir.hour(ur).format(On);case"daily":case"custom":case"test":return ir.format(On)}}return ir.format(On)}setAuditLog(St,On,rr){let ur=null;if(St){const pr=St.toString().substr(-1);const fr=St.toString().match(/^(\d+)/);if(Number(fr[1])>0){const St=cr.dirname(rr.replace(/%DATE%.+/,"_filename"));try{if(On){const St=cr.resolve(On);ur=JSON.parse(ir.readFileSync(St,{encoding:"utf-8"}))}else{const On=cr.resolve(St+"/"+".audit.json");ur=JSON.parse(ir.readFileSync(On,{encoding:"utf-8"}))}}catch(rr){if(rr.code!=="ENOENT"){return null}ur={keep:{days:false,amount:Number(fr[1])},auditLog:On||St+"/"+".audit.json",files:[]}}ur.keep={days:pr==="d",amount:Number(fr[1])}}}return ur}writeAuditLog(St){try{(0,kr.mkDirForFile)(St.auditLog);ir.writeFileSync(St.auditLog,JSON.stringify(St,null,2))}catch(On){Pr((new Date).toLocaleString(),"[FileStreamRotator] Failed to store log audit at:",St.auditLog,"Error:",On)}}addLogToAudit(St,On,rr){if(On&&On.files){const ir=On.files.findIndex((On=>On.name===St));if(ir!==-1){return On}const cr=Date.now();On.files.push({date:cr,name:St,hash:ur.createHash(On.hashType).update(St+"LOG_FILE"+cr).digest("hex")});if(On.keep.days){const St=br().subtract(On.keep.amount,"days").valueOf();On.files=On.files.filter((ir=>{if(ir.date>St){return true}ir.hashType=On.hashType;(0,kr.removeFile)(ir);rr.emit("logRemoved",ir);return false}))}else{const St=On.files.splice(-On.keep.amount);if(On.files.length>0){On.files.filter((St=>{St.hashType=On.hashType;(0,kr.removeFile)(St);rr.emit("logRemoved",St);return false}))}On.files=St}this.writeAuditLog(On)}return On}getStream(St){let On=null;let rr=null;Er(St.filename,"options.filename must be supplied");if(St.frequency){On=this.getFrequency(St.frequency)}const cr=this.setAuditLog(St.maxFiles,St.auditFile,St.filename);if(cr!=null){cr.hashType=St.auditHashType!==undefined?St.auditHashType:"md5"}let ur=null;let Sr=0;let Br=0;if(St.size){ur=this.parseFileSize(St.size)}let jr=St.dateFormat||Lr;if(On&&On.type==="daily"){if(!St.dateFormat){jr="YYYY-MM-DD"}if(br().format(jr)!==br().endOf("day").format(jr)||br().format(jr)===br().add(1,"day").format(jr)){Pr((new Date).toLocaleString(),"[FileStreamRotator] Changing type to custom as date format changes more often than once a day or not every day");On.type="custom"}}if(On){rr=St.frequency?this.getDate(On,jr,St.utc):""}St.createSymlink=St.createSymlink||false;St.extension=St.extension||"";const Ur=St.filename;let Vr=null;let Wr=Ur+(rr?"."+rr:"");if(Ur.match(/%DATE%/)){Wr=Ur.replace(/%DATE%/g,rr?rr:this.getDate(null,jr,St.utc))}if(ur){let On=null;let rr=Wr;if(cr&&cr.files&&cr.files instanceof Array&&cr.files.length>0){const St=cr.files[cr.files.length-1].name;if(St.match(rr)){const On=St.match(rr+"\\.(\\d+)");if(On){rr=St;Sr=On[1]}}}if(Sr===0&&rr===Wr){rr+=St.extension}while(ir.existsSync(rr)){On=rr;Sr++;rr=Wr+"."+Sr+St.extension}if(On){const St=ir.statSync(On);if(St.size<ur){rr=On;Sr--;Br=St.size}}Wr=rr}else{Wr+=St.extension}Pr((new Date).toLocaleString(),"[FileStreamRotator] Logging to: ",Wr);(0,kr.mkDirForFile)(Wr);const zr=St.fileOptions||{flags:"a"};let qr=ir.createWriteStream(Wr,zr);if(rr&&On&&Ir.indexOf(On.type)>-1||ur>0){Pr((new Date).toLocaleString(),"[FileStreamRotator] Rotating file: ",On?On.type:"",ur?"size: "+ur:"");const br=new pr;br.auditLog=cr;br.filename=St.filename;br.end=(...St)=>{qr.end(...St);Er.clear()};br.canWrite=()=>!qr.closed&&qr.writable&&!qr.destroyed;(0,kr.BubbleEvents)(qr,br);br.on("new",(On=>{br.auditLog=this.addLogToAudit(On,br.auditLog,br);if(St.createSymlink){(0,kr.createCurrentSymLink)(On,St.symlinkName)}}));const Er=(0,kr.debounce)((()=>{let St=false;try{const St=ir.statSync(Wr);if(St.size>Br){Br=St.size}}catch(On){St=true}return St}),1e3);br.write=(cr,pr)=>{const Ir=Er();const Lr=On?this.getDate(On,jr,St.utc):rr;if(Ir||rr&&Lr!==rr||ur&&Br>ur){let cr=Ur+(rr&&On?"."+Lr:"");if(Ur.match(/%DATE%/)&&rr){cr=Ur.replace(/%DATE%/g,Lr)}if(ur&&Br>ur){Sr++;cr+="."+Sr+St.extension}else{Sr=0;cr+=St.extension}Br=0;Pr((new Date).toLocaleString(),(0,fr.format)("[FileStreamRotator] Changing logs from %s to %s",Wr,cr));rr=Lr;Vr=Wr;Wr=cr;if(St.endStream===true){qr.end()}else{qr.destroy()}(0,kr.mkDirForFile)(Wr);qr=ir.createWriteStream(cr,zr);br.emit("new",cr);br.emit("rotate",Vr,cr);(0,kr.BubbleEvents)(qr,br)}qr.write(cr,pr);Br+=Buffer.byteLength(cr,pr)};process.nextTick((()=>{br.emit("new",Wr)}));br.emit("new",Wr);return br}else{Pr((new Date).toLocaleString(),"[FileStreamRotator] File won't be rotated: ",St.frequency,St.size);process.nextTick((()=>{qr.emit("new",Wr)}));return qr}}}On.FileStreamRotator=FileStreamRotator;class FileStreamRotatorManager{static getStream(St){let On;if(this.enabled){if(!this.streamPool.has(St.filename)){const On=(new FileStreamRotator).getStream(St);this.streamPool.set(St.filename,On);this.loggerRef.set(On,0)}On=this.streamPool.get(St.filename);let rr=this.loggerRef.get(On);this.loggerRef.set(On,rr++)}else{On=(new FileStreamRotator).getStream(St)}return On}static close(St){if(this.enabled){if(this.loggerRef.has(St)){let On=this.loggerRef.get(St);On--;if(On===0){St.end();this.streamPool.delete(St.filename);this.loggerRef.delete(St)}else if(On>0){this.loggerRef.set(St,On)}else{}}}else{St.end()}}static clear(){for(const St of this.streamPool.values()){St.end();if(this.loggerRef.has(St)){this.loggerRef.delete(St)}}this.streamPool.clear();this.loggerRef=new WeakMap}}On.FileStreamRotatorManager=FileStreamRotatorManager;FileStreamRotatorManager.streamPool=new Map;FileStreamRotatorManager.loggerRef=new WeakMap;FileStreamRotatorManager.enabled=true},19870:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.EmptyTransport=On.Transport=void 0;const ir=rr(39023);const cr=rr(4002);const ur=rr(28520);class Transport{constructor(St={}){this.options=St;this.pid=process.pid}setLoggerOptions(St){this.loggerOptions=St;this.options.level=this.options.level||St.level;this.options.format=this.options.format||St.format;this.options.contextFormat=this.options.contextFormat||St.contextFormat;this.options.eol=this.options.eol||St.eol}format(St,On,rr){const cr=this.getLoggerInfo(St,On,rr);if(Buffer.isBuffer(cr.args[0])){return cr.args[0]}if(St===false){return(0,ir.format)(cr.message)}const ur=On.contextFormat||this.options.contextFormat;if(On.ctx&&ur){return ur(cr)}const pr=On.format||this.options.format;if(pr){return pr(cr)}if(St){return(0,ir.format)("%s %s %s %s",cr.timestamp,cr.LEVEL,cr.pid,cr.message)}else{return(0,ir.format)(cr.message)}}getLoggerInfo(St,On,rr){const pr=St||"";const fr={level:pr,pid:this.pid};Object.defineProperties(fr,{timestamp:{get(){return(0,cr.getFormatDate)(new Date)},enumerable:false},LEVEL:{get(){return ur.LEVEL[pr]||""},enumerable:false},args:{get(){return rr},enumerable:false},originArgs:{get(){return rr},enumerable:false},message:{get(){return(0,ir.format)(...rr)},enumerable:false},ctx:{get(){return On.ctx},enumerable:false},originError:{get(){return rr.find((St=>St instanceof Error))},enumerable:false},meta:{get(){return On},enumerable:false}});return fr}get level(){return this.options.level}set level(St){this.options.level=St}}On.Transport=Transport;class EmptyTransport extends Transport{log(St,...On){}close(){}}On.EmptyTransport=EmptyTransport},78997:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.supportsColor=On.colorizeAll=On.colorize=On.Color=void 0;const ir=rr(932);const cr=rr(70857);const ur=rr(52018);On.Color={red:St=>`${St}`,green:St=>`${St}`,yellow:St=>`${St}`,blue:St=>`${St}`,magenta:St=>`${St}`,cyan:St=>`${St}`,white:St=>`${St}`,gray:St=>`${St}`,grey:St=>`${St}`,black:St=>`${St}`,bgRed:St=>`${St}`,bgGreen:St=>`${St}`,bgYellow:St=>`${St}`,bgBlue:St=>`${St}`,bgMagenta:St=>`${St}`,bgCyan:St=>`${St}`,bgWhite:St=>`${St}`,bgBlack:St=>`${St}`,bold:St=>`${St}`,dim:St=>`${St}`,italic:St=>`${St}`,underline:St=>`${St}`,inverse:St=>`${St}`,hidden:St=>`${St}`,strikethrough:St=>`${St}`};const colorize=(St,rr)=>{if(typeof rr==="function"){return rr(St)}else{return On.Color[rr](St)}};On.colorize=colorize;const colorizeAll=(St,rr)=>St.replace(/([^\s]+)/g,(St=>(0,On.colorize)(St,rr)));On.colorizeAll=colorizeAll;function hasFlag(St,On=process.argv){const rr=St.startsWith("-")?"":St.length===1?"-":"--";const ir=On.indexOf(rr+St);const cr=On.indexOf("--");return ir!==-1&&(cr===-1||ir<cr)}let pr;if(hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")){pr=0}else if(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always")){pr=1}function envForceColor(){if("FORCE_COLOR"in ir.env){if(ir.env.FORCE_COLOR==="true"){return 1}if(ir.env.FORCE_COLOR==="false"){return 0}return ir.env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(ir.env.FORCE_COLOR,10),3)}}function translateLevel(St){if(St===0){return false}return{level:St,hasBasic:true,has256:St>=2,has16m:St>=3}}function _supportsColor(St,On){const rr=On.streamIsTTY;const ur=true;const fr=envForceColor();if(fr!==undefined){pr=fr}const br=ur?pr:fr;if(br===0){return 0}if(ur){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor")){return 3}if(hasFlag("color=256")){return 2}}if("TF_BUILD"in ir.env&&"AGENT_NAME"in ir.env){return 1}if(St&&!rr&&br===undefined){return 0}const Sr=br||0;if(ir.env.TERM==="dumb"){return Sr}if(ir.platform==="win32"){const St=cr.release().split(".");if(Number(St[0])>=10&&Number(St[2])>=10586){return Number(St[2])>=14931?3:2}return 1}if("CI"in ir.env){if("GITHUB_ACTIONS"in ir.env||"GITEA_ACTIONS"in ir.env){return 3}if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((St=>St in ir.env))||ir.env.CI_NAME==="codeship"){return 1}return Sr}if("TEAMCITY_VERSION"in ir.env){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ir.env.TEAMCITY_VERSION)?1:0}if(ir.env.COLORTERM==="truecolor"){return 3}if(ir.env.TERM==="xterm-kitty"){return 3}if("TERM_PROGRAM"in ir.env){const St=Number.parseInt((ir.env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ir.env.TERM_PROGRAM){case"iTerm.app":{return St>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(ir.env.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ir.env.TERM)){return 1}if("COLORTERM"in ir.env){return 1}return Sr}function createSupportsColor(St){const On=_supportsColor(true,{streamIsTTY:St.isTTY});return translateLevel(On)}On.supportsColor={stdout:createSupportsColor({isTTY:ur.isatty(1)}),stderr:createSupportsColor({isTTY:ur.isatty(2)})}},61256:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.hash=void 0;const ir=rr(76982);const cr=rr(2203);function hash(St){const On={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 rr=ir.createHash(On.algorithm);const cr=typeHasher(On,rr);cr.dispatch(St);if(!rr.update){rr.end("")}return rr.digest(On.encoding)}On.hash=hash;function typeHasher(St,On,rr){rr=rr||[];const write=function(St){if(On.update){return On.update(St,"utf8")}else{return On.write(St,"utf8")}};return{dispatch:function(On){if(St.replacer){On=St.replacer(On)}let rr=typeof On;if(On===null){rr="null"}return this["_"+rr](On)},_object:function(On){const ir=/\[object (.*)\]/i;const cr=Object.prototype.toString.call(On);let ur=ir.exec(cr);if(!ur){ur="unknown:["+cr+"]"}else{ur=ur[1]}ur=ur.toLowerCase();let pr=null;if((pr=rr.indexOf(On))>=0){return this.dispatch("[CIRCULAR:"+pr+"]")}else{rr.push(On)}if(typeof Buffer!=="undefined"&&Buffer.isBuffer&&Buffer.isBuffer(On)){write("buffer:");return write(On)}if(ur!=="object"&&ur!=="function"&&ur!=="asyncfunction"){if(this["_"+ur]){this["_"+ur](On)}else if(St.ignoreUnknown){return write("["+ur+"]")}else{throw new Error('Unknown object type "'+ur+'"')}}else{let rr=Object.keys(On);if(St.unorderedObjects){rr=rr.sort()}if(St.respectType!==false&&!isNativeFunction(On)){rr.splice(0,0,"prototype","__proto__","constructor")}if(St.excludeKeys){rr=rr.filter((On=>!St.excludeKeys(On)))}write("object:"+rr.length+":");const ir=this;return rr.forEach((rr=>{ir.dispatch(rr);write(":");if(!St.excludeValues){ir.dispatch(On[rr])}write(",")}))}},_array:function(On,ir){ir=typeof ir!=="undefined"?ir:St.unorderedArrays!==false;const ur=this;write("array:"+On.length+":");if(!ir||On.length<=1){return On.forEach((St=>ur.dispatch(St)))}let pr=[];const fr=On.map((On=>{const ir=new cr.PassThrough;const ur=rr.slice();const fr=typeHasher(St,ir,ur);fr.dispatch(On);pr=pr.concat(ur.slice(rr.length));return ir.read().toString()}));rr=rr.concat(pr);fr.sort();return this._array(fr,false)},_date:function(St){return write("date:"+St.toJSON())},_symbol:function(St){return write("symbol:"+St.toString())},_error:function(St){return write("error:"+St.toString())},_boolean:function(St){return write("bool:"+St.toString())},_string:function(St){write("string:"+St.length+":");write(St.toString())},_function:function(On){write("fn:");if(isNativeFunction(On)){this.dispatch("[native]")}else{this.dispatch(On.toString())}if(St.respectFunctionNames!==false){this.dispatch("function-name:"+String(On.name))}if(St.respectFunctionProperties){this._object(On)}},_number:function(St){return write("number:"+St.toString())},_xml:function(St){return write("xml:"+St.toString())},_null:function(){return write("Null")},_undefined:function(){return write("Undefined")},_regexp:function(St){return write("regex:"+St.toString())},_uint8array:function(St){write("uint8array:");return this.dispatch(Array.prototype.slice.call(St))},_uint8clampedarray:function(St){write("uint8clampedarray:");return this.dispatch(Array.prototype.slice.call(St))},_int8array:function(St){write("int8array:");return this.dispatch(Array.prototype.slice.call(St))},_uint16array:function(St){write("uint16array:");return this.dispatch(Array.prototype.slice.call(St))},_int16array:function(St){write("int16array:");return this.dispatch(Array.prototype.slice.call(St))},_uint32array:function(St){write("uint32array:");return this.dispatch(Array.prototype.slice.call(St))},_int32array:function(St){write("int32array:");return this.dispatch(Array.prototype.slice.call(St))},_float32array:function(St){write("float32array:");return this.dispatch(Array.prototype.slice.call(St))},_float64array:function(St){write("float64array:");return this.dispatch(Array.prototype.slice.call(St))},_arraybuffer:function(St){write("arraybuffer:");return this.dispatch(new Uint8Array(St))},_url:function(St){return write("url:"+St.toString())},_map:function(On){write("map:");const rr=Array.from(On);return this._array(rr,St.unorderedSets!==false)},_set:function(On){write("set:");const rr=Array.from(On);return this._array(rr,St.unorderedSets!==false)},_file:function(St){write("file:");return this.dispatch([St.name,St.size,St.type,St.lastModfied])},_blob:function(){if(St.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(St){return write("bigint:"+St.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(St){if(typeof St!=="function"){return false}const On=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;return On.exec(Function.prototype.toString.call(St))!=null}},4002:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getFormatDate=On.isWin32=On.BubbleEvents=On.formatLegacyLoggerOptions=On.formatLoggerOptions=On.isDevelopmentEnvironment=On.debounce=On.throwIf=On.getMaxSize=On.isValidDirName=On.isValidFileName=On.removeFile=On.createCurrentSymLink=On.mkDirForFile=On.checkDailyAndTest=On.checkNumAndType=On.isEnableLevel=void 0;const ir=rr(28520);const cr=rr(79896);const ur=rr(16928);const pr=rr(76982);const fr=rr(16928);const br=rr(70857);const Sr=rr(19870);function isEnableLevel(St,On){if(!St||!On){return true}return ir.DefaultLogLevels[St]<=ir.DefaultLogLevels[On]}On.isEnableLevel=isEnableLevel;function checkNumAndType(St,On){if(typeof On==="number"){switch(St){case"s":case"m":if(On<0||On>60){return false}break;case"h":if(On<0||On>24){return false}break}return{type:St,digit:On}}}On.checkNumAndType=checkNumAndType;function checkDailyAndTest(St){switch(St){case"custom":case"daily":return{type:St,digit:undefined};case"test":return{type:St,digit:0}}return false}On.checkDailyAndTest=checkDailyAndTest;function mkDirForFile(St){const On=fr.dirname(St);On.split(fr.sep).reduce(((St,On)=>{St+=On+fr.sep;if(!cr.existsSync(St)){try{cr.mkdirSync(St)}catch(St){if(St.code!=="EEXIST"){throw St}}}return St}),"")}On.mkDirForFile=mkDirForFile;function createCurrentSymLink(St,On){const rr=On||"current.log";const ir=(0,ur.dirname)(St);const pr=(0,ur.basename)(St);const fr=ir+"/"+rr;try{const St=cr.lstatSync(fr);if(St.isSymbolicLink()){cr.unlinkSync(fr);cr.symlinkSync(pr,fr)}}catch(St){if(St&&St.code==="ENOENT"){try{cr.symlinkSync(pr,fr)}catch(St){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not create symlink file: ",fr," -> ",pr)}}}}On.createCurrentSymLink=createCurrentSymLink;function removeFile(St){if(St.hash===pr.createHash(St.hashType).update(St.name+"LOG_FILE"+St.date).digest("hex")){try{if(cr.existsSync(St.name)){cr.unlinkSync(St.name)}}catch(On){console.error((new Date).toLocaleString(),"[FileStreamRotator] Could not remove old log file: ",St.name)}}}On.removeFile=removeFile;function isValidFileName(St){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(St)}On.isValidFileName=isValidFileName;function isValidDirName(St){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(St)}On.isValidDirName=isValidDirName;function getMaxSize(St){if(St&&typeof St==="string"){const On=St.toLowerCase().match(/^((?:0\.)?\d+)([k|m|g])$/);if(On){return St}}else if(St&&Number.isInteger(St)){const On=Math.round(St/1024);return On===0?"1k":On+"k"}return null}On.getMaxSize=getMaxSize;function throwIf(St,...On){Array.prototype.slice.call(On,1).forEach((rr=>{if(St[rr]){throw new Error("Cannot set "+rr+" and "+On[0]+" together")}}))}On.throwIf=throwIf;function debounce(St,On,rr){let ir,cr,ur,pr,fr;if(null==On)On=100;function later(){const br=Date.now()-pr;if(br<On&&br>=0){ir=setTimeout(later,On-br)}else{ir=null;if(!rr){fr=St.apply(ur,cr);ur=cr=null}}}const debounced=(...cr)=>{ur=this;pr=Date.now();const br=rr&&!ir;if(!ir)ir=setTimeout(later,On);if(br){fr=St.apply(ur,cr);ur=cr=null}return fr};debounced.clear=()=>{if(ir){clearTimeout(ir);ir=null}};debounced.flush=()=>{if(ir){fr=St.apply(ur,cr);ur=cr=null;clearTimeout(ir);ir=null}};return debounced}On.debounce=debounce;const isDevelopmentEnvironment=St=>["local","test","unittest"].includes(St);On.isDevelopmentEnvironment=isDevelopmentEnvironment;const Er={enableConsole:true,disableConsole:true,enableFile:true,enableError:true,enableJSON:true,disableFile:true,disableError:true};function formatLoggerOptions(St){if(Object.keys(St).some((St=>Er[St]))){const On={transports:{}};for(const rr of Object.keys(St)){if(!Er[rr]){On[rr]=St[rr]}}if(On.transports["console"]&&(St["enableConsole"]===false||St["disableConsole"]===true)){On.transports["console"]=false}if(On.transports["file"]&&(St["enableFile"]===false||St["disableFile"]===true)){On.transports["file"]=false}if(On.transports["error"]&&(St["enableError"]===false||St["disableError"]===true)){On.transports["error"]=false}if(On.transports["json"]&&St["enableJSON"]===false){On.transports["json"]=false}return On}return St}On.formatLoggerOptions=formatLoggerOptions;const kr={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 Pr=Object.prototype.hasOwnProperty;const Ir=Object.prototype.toString;function formatLegacyLoggerOptions(St){var On,rr,ir,cr,ur,pr;function isPlainObject(St){if(!St||Ir.call(St)!=="[object Object]"){return false}const On=Pr.call(St,"constructor");const rr=St.constructor&&St.constructor.prototype&&Pr.call(St.constructor.prototype,"isPrototypeOf");if(St.constructor&&!On&&!rr){return false}let ir;for(ir in St){}return typeof ir==="undefined"||Pr.call(St,ir)}function deepMerge(St,On){if(!St){return On}if(On&&!isPlainObject(On)){return On}for(const rr of Object.keys(On)){if(On[rr]instanceof Object){Object.assign(On[rr],deepMerge(St[rr],On[rr]))}}Object.assign(St||{},On);return St}function setTransportOptions(On,rr,ir,cr=false){var ur,pr;if(!On.transports[ir]){On.transports[ir]={}}const fr=(ur=kr[rr].mappingKey)!==null&&ur!==void 0?ur:rr;if(cr){On.transports[ir][fr]=St[rr]}else{On.transports[ir][fr]=(pr=On.transports[ir][fr])!==null&&pr!==void 0?pr:St[rr]}}function isValidTransport(St){return St&&(St instanceof Sr.Transport||typeof St==="object"&&St["dir"]&&St["fileLogName"])}if(Object.keys(St).some((St=>{var On;return(On=kr[St])===null||On===void 0?void 0:On.isOld}))){const fr={transports:{}};for(const rr of Object.keys(St)){if(!kr[rr]){continue}else{if(kr[rr].ignore){continue}kr[rr].category=[].concat(kr[rr].category);for(const ir of kr[rr].category){if(ir==="all"){for(const St of Object.keys(fr.transports)){setTransportOptions(fr,rr,St,kr[rr].overwriteIfExists)}}else if(ir==="top"){fr[rr]=(On=fr[rr])!==null&&On!==void 0?On:St[kr[rr].mappingKey]}else{setTransportOptions(fr,rr,ir,kr[rr].overwriteIfExists)}}}}for(const On of Object.keys(St)){if(!kr[On]){deepMerge(fr[On],St[On])}}if(St["enableConsole"]===false||St["disableConsole"]===true){fr.transports["console"]=false}else{fr.transports["console"]=(rr=fr.transports["console"])!==null&&rr!==void 0?rr:{}}if(St["enableFile"]===false||St["disableFile"]===true){fr.transports["file"]=false}else{fr.transports["file"]=(ir=fr.transports["file"])!==null&&ir!==void 0?ir:{}}if(St["enableError"]===false||St["disableError"]===true){fr.transports["error"]=false}else{fr.transports["error"]=(cr=fr.transports["error"])!==null&&cr!==void 0?cr:{}}if(((ur=St===null||St===void 0?void 0:St.transports)===null||ur===void 0?void 0:ur["json"])===undefined&&(St["enableJSON"]===undefined||St["enableJSON"]===false)){fr.transports["json"]=false}else{}for(const St of["file","error","json"]){if((pr=fr===null||fr===void 0?void 0:fr.transports)===null||pr===void 0?void 0:pr[St]){if(!isValidTransport(fr.transports[St])){delete fr.transports[St]}}}return fr}return St}On.formatLegacyLoggerOptions=formatLegacyLoggerOptions;function BubbleEvents(St,On){St.on("close",(()=>{On.emit("close")}));St.on("finish",(()=>{On.emit("finish")}));St.on("error",(St=>{On.emit("error",St)}));St.on("open",(St=>{On.emit("open",St)}))}On.BubbleEvents=BubbleEvents;function isWin32(){return br.platform()==="win32"}On.isWin32=isWin32;function getFormatDate(St){function pad(St,On=2){const rr=St+"";return rr.padStart(On,"0")}const On=St.getFullYear();const rr=St.getMonth()+1;const ir=St.getDate();const cr=St.getHours();const ur=St.getMinutes();const pr=St.getSeconds();const fr=St.getMilliseconds();return`${On}-${pad(rr)}-${pad(ir)} ${pad(cr)}:${pad(ur)}:${pad(pr)}.${pad(fr,3)}`}On.getFormatDate=getFormatDate},74129:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.session=void 0;On.session={enable:true,maxAge:24*3600*1e3,key:"MW_SESS",httpOnly:true,logValue:true}},16885:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SessionConfiguration=void 0;const ur=rr(46123);const pr=rr(74129);const fr=rr(97628);let br=class SessionConfiguration{async onReady(){if(this.sessionConfig.enable){this.applicationManager.getApplications(["koa","faas"]).forEach((St=>{if(St.on){St.on("session:missed",(({ctx:St,key:On})=>{this.logger.warn("[session][missed] key(%s)",On)}));St.on("session:expired",(({ctx:St,key:On,value:rr})=>{this.logger.warn("[session][expired] key(%s) value(%j)",On,this.sessionConfig.logValue?rr:"")}));St.on("session:invalid",(({ctx:St,key:On,value:rr})=>{this.logger.warn("[session][invalid] key(%s) value(%j)",On,this.sessionConfig.logValue?rr:"")}))}St.useMiddleware(fr.SessionMiddleware)}))}}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);ir([(0,ur.Logger)("coreLogger"),cr("design:type",Object)],br.prototype,"logger",void 0);ir([(0,ur.Config)("session"),cr("design:type",Object)],br.prototype,"sessionConfig",void 0);br=ir([(0,ur.Configuration)({namespace:"session",importConfigs:[{default:pr}]})],br);On.SessionConfiguration=br},65579:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;cr(rr(58864),On);var ur=rr(16885);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.SessionConfiguration}});cr(rr(97628),On);cr(rr(11586),On)},58864:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.SessionStore=void 0;class SessionStore{}On.SessionStore=SessionStore},56720:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ContextSession=void 0;const ir=rr(39023);const cr=rr(92355);const ur=rr(16859);const pr=(0,ir.debuglog)("session:context");class ContextSession{constructor(St,On){this.ctx=St;this.app=St.app;this.opts=Object.assign({},On);this.store=this.opts.ContextStore?new this.opts.ContextStore(St):this.opts.store}get(){const St=this.session;if(St)return St;if(St===false)return null;this.store?this.create():this.initFromCookie();return this.session}set(St){if(St===null){this.session=false;return}if(typeof St==="object"){this.create(St,this.externalKey);return}throw new Error("this.session can only be set as null or an object.")}async initFromExternal(){pr("init from external");const St=this.ctx;const On=this.opts;let rr;if(On.externalKey){rr=On.externalKey.get(St);pr("get external key from custom %s",rr)}else{rr=St.cookies.get(On.key,On);pr("get external key from cookie %s",rr)}if(!rr){this.create();return}const ir=await this.store.get(rr,On.maxAge,{ctx:St,rolling:On.rolling});if(!this.valid(ir,rr)){this.create();return}this.create(ir,rr);this.prevHash=(0,cr.hash)(this.session.toJSON())}initFromCookie(){pr("init from cookie");const St=this.ctx;const On=this.opts;const rr=St.cookies.get(On.key,On);if(!rr){this.create();return}let ir;pr("parse %s",rr);try{ir=On.decode(rr)}catch(ir){pr("decode %j error: %s",rr,ir);if(!(ir instanceof SyntaxError)){St.cookies.set(On.key,"",On);ir.headers={"set-cookie":St.response.get("set-cookie")};throw ir}this.create();return}pr("parsed %j",ir);if(!this.valid(ir)){this.create();return}this.create(ir);this.prevHash=(0,cr.hash)(this.session.toJSON())}valid(St,On){const rr=this.ctx;if(!St){this.emit("missed",{key:On,value:St,ctx:rr});return false}if(St._expire&&St._expire<Date.now()){pr("expired session");this.emit("expired",{key:On,value:St,ctx:rr});return false}const ir=this.opts.valid;if(typeof ir==="function"&&!ir(rr,St)){pr("invalid session");this.emit("invalid",{key:On,value:St,ctx:rr});return false}return true}emit(St,On){setImmediate((()=>{this.app.emit(`session:${St}`,On)}))}create(St,On){pr("create session with val: %j externalKey: %s",St,On);if(this.store){this.externalKey=On||this.opts.genid&&this.opts.genid(this.ctx)}this.session=new ur.Session(this,St,this.externalKey)}async commit({save:St=false,regenerate:On=false}={}){const rr=this.session;const ir=this.opts;const cr=this.ctx;if(undefined===rr)return;if(rr===false){await this.remove();return}if(On){await this.remove();if(this.store)this.externalKey=ir.genid&&ir.genid(cr)}const ur=St||On||rr._requireSave?"force":this._shouldSaveSession();pr("should save session: %s",ur);if(!ur)return;if(typeof ir.beforeSave==="function"){pr("before save");ir.beforeSave(cr,rr)}const fr=ur==="changed";await this.save(fr)}_shouldSaveSession(){const St=this.prevHash;const On=this.session;const rr=On.toJSON();if(!St&&!Object.keys(rr).length)return"";const ir=St!==(0,cr.hash)(rr);if(ir)return"changed";if(this.opts.rolling)return"rolling";if(this.opts.renew){const St=On._expire;const rr=On.maxAge;if(St&&rr&&St-Date.now()<rr/2)return"renew"}return""}async remove(){const St=Object.assign({},this.opts,{expires:cr.COOKIE_EXP_DATE,maxAge:false});const On=this.ctx;const rr=St.key;const ir=this.externalKey;if(ir){await this.store.destroy(ir,{ctx:On})}On.cookies.set(rr,"",St)}async save(St){const On=this.opts;const rr=On.key;const ir=this.externalKey;let ur=this.session.toJSON();let fr=On.maxAge?On.maxAge:cr.ONE_DAY;if(fr==="session"){On.maxAge=undefined;ur._session=true}else{ur._expire=fr+Date.now();ur._maxAge=fr}if(ir){pr("save %j to external key %s",ur,ir);if(typeof fr==="number"){fr+=1e4}await this.store.set(ir,ur,fr,{changed:St,ctx:this.ctx,rolling:On.rolling});if(On.externalKey){On.externalKey.set(this.ctx,ir)}else{this.ctx.cookies.set(rr,ir,On)}return}pr("save %j to cookie",ur);ur=On.encode(ur);pr("save %s",ur);this.ctx.cookies.set(rr,ur,On)}}On.ContextSession=ContextSession},81361:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.crc32=void 0;const rr=[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(St,On=false){let ir=~0;for(let On=0,cr=St.length;On<cr;On++){ir=ir>>>8^rr[(ir^St.charCodeAt(On))&255]}ir=Math.abs(ir^-1);return On?ir.toString(16):ir}On.crc32=crc32},16859:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Session=void 0;class Session{constructor(St,On,rr){this.isNew=true;this._sessCtx=St;this._ctx=St.ctx;this._externalKey=rr;if(!On){this.isNew=true}else{for(const St in On){if(St==="_maxAge")this._ctx.sessionOptions.maxAge=On._maxAge;else if(St==="_session")this._ctx.sessionOptions.maxAge="session";else this[St]=On[St]}}}toJSON(){const St={};Object.keys(this).forEach((On=>{if(On==="isNew")return;if(On[0]==="_")return;St[On]=this[On]}));return St}get length(){return Object.keys(this.toJSON()).length}get populated(){return!!this.length}get maxAge(){return this._ctx.sessionOptions.maxAge}set maxAge(St){this._ctx.sessionOptions.maxAge=St;this._requireSave=true}get externalKey(){return this._externalKey}save(St){return this.commit({save:true},St)}regenerate(St){return this.commit({regenerate:true},St)}manuallyCommit(){return this.commit()}commit(St,On){if(typeof St==="function"){On=St;St={}}const rr=this._sessCtx.commit(St);if(On){rr.then((()=>On()),On)}else{return rr}}}On.Session=Session},11586:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.SessionStoreManager=void 0;const cr=rr(46123);let ur=class SessionStoreManager{setSessionStore(St){this.sessionStore=St}getSessionStore(){return this.sessionStore}};ur=ir([(0,cr.Provide)(),(0,cr.Scope)(cr.ScopeEnum.Singleton)],ur);On.SessionStoreManager=ur},92355:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ONE_DAY=On.COOKIE_EXP_DATE=On.hash=On.encode=On.decode=void 0;const ir=rr(81361);function decode(St){const On=Buffer.from(St,"base64").toString("utf8");return JSON.parse(On)}On.decode=decode;function encode(St){St=JSON.stringify(St);return Buffer.from(St).toString("base64")}On.encode=encode;function hash(St){return(0,ir.crc32)(JSON.stringify(St))}On.hash=hash;On.COOKIE_EXP_DATE=new Date("Thu, 01 Jan 1970 00:00:00 GMT");On.ONE_DAY=24*60*60*1e3},97628:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SessionMiddleware=void 0;const ur=rr(46123);const pr=rr(11586);const fr=rr(92355);const br=rr(42613);const Sr=rr(56720);const Er=Symbol("context#contextSession");const kr=Symbol("context#_contextSession");function formatOpts(St){St=St||{};St.key=St.key||"koa.sess";if(!("maxAge"in St))St.maxAge=St.maxage;if(St.overwrite==null)St.overwrite=true;if(St.httpOnly==null)St.httpOnly=true;if(St.sameSite==null)delete St.sameSite;if(St.signed==null)St.signed=true;if(St.autoCommit==null)St.autoCommit=true;if(typeof St.encode!=="function"){St.encode=fr.encode}if(typeof St.decode!=="function"){St.decode=fr.decode}const On=St.store;if(On){br(ur.Types.isFunction(On.get),"store.get must be function");br(ur.Types.isFunction(On.set),"store.set must be function");br(ur.Types.isFunction(On.destroy),"store.destroy must be function")}const rr=St.externalKey;if(rr){br(ur.Types.isFunction(rr.get),"externalKey.get must be function");br(ur.Types.isFunction(rr.set),"externalKey.set must be function")}const ir=St.ContextStore;if(ir){br(ur.Types.isClass(ir),"ContextStore must be a class");br(ur.Types.isFunction(ir.prototype.get),"ContextStore.prototype.get must be function");br(ur.Types.isFunction(ir.prototype.set),"ContextStore.prototype.set must be function");br(ur.Types.isFunction(ir.prototype.destroy),"ContextStore.prototype.destroy must be function")}if(!St.genid){if(St.prefix){St.genid=()=>`${St.prefix}${ur.Utils.randomUUID()}`}else{St.genid=ur.Utils.randomUUID}}return St}function extendContext(St,On){if(St.hasOwnProperty(Er)){return}Object.defineProperties(St,{[Er]:{get(){if(this[kr]){return this[kr]}this[kr]=new Sr.ContextSession(this,On);return this[kr]}},session:{get(){return this[Er].get()},set(St){this[Er].set(St)},configurable:true},sessionOptions:{get(){return this[Er].opts}}})}let Pr=class SessionMiddleware{resolve(St){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 On=this.sessionStoreManager.getSessionStore();if(On){this.sessionConfig.store=On}const rr=formatOpts(this.sessionConfig);extendContext(St.context,rr);return async function session(St,On){const ir=St[Er];if(ir.store){await ir.initFromExternal()}try{await On()}finally{if(rr.autoCommit){await ir.commit()}}}}static getName(){return"session"}};ir([(0,ur.Config)("session"),cr("design:type",Object)],Pr.prototype,"sessionConfig",void 0);ir([(0,ur.Logger)(),cr("design:type",Object)],Pr.prototype,"logger",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.SessionStoreManager)],Pr.prototype,"sessionStoreManager",void 0);Pr=ir([(0,ur.Middleware)()],Pr);On.SessionMiddleware=Pr},96313:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.SocketIOConfiguration=void 0;const cr=rr(46123);let ur=class SocketIOConfiguration{};ur=ir([(0,cr.Configuration)({namespace:"socketIO"})],ur);On.SocketIOConfiguration=ur},53739:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};Object.defineProperty(On,"__esModule",{value:true});On.MidwaySocketIOFramework=void 0;const cr=rr(46123);const ur=rr(39023);const pr=(0,ur.debuglog)("midway:socket.io");const fr=rr(46966);const br=rr(46123);let Sr=class MidwaySocketIOFramework extends cr.BaseFramework{constructor(){super(...arguments);this.namespaceList=[];this.connectionMiddlewareManager=this.createMiddlewareManager()}configure(){return this.configService.getConfiguration("socketIO")}applicationInitialize(){this.app=new fr.Server(this.configurationOptions);this.defineApplicationProperties({useConnectionMiddleware:St=>this.useConnectionMiddleware(St),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(cr.HTTP_SERVER_KEY)){this.app.attach(this.applicationContext.get(cr.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((St=>{this.app.close((()=>{setTimeout((()=>{St()}),1e3)}))}))}getFrameworkType(){return cr.MidwayFrameworkType.WS_IO}async loadMidwayController(){const St=(0,br.listModule)(br.WS_CONTROLLER_KEY);for(const On of St){await this.addNamespace(On)}}async addNamespace(St){var On,rr;const ir=(0,br.getClassMetadata)(br.WS_CONTROLLER_KEY,St);const ur=this.app.of(ir.namespace);this.namespaceList.push(ir.namespace);const fr=(On=ir.routerOptions.middleware)!==null&&On!==void 0?On:[];const Sr=(rr=ir.routerOptions.connectionMiddleware)!==null&&rr!==void 0?rr:[];ur.use(((St,On)=>{this.app.createAnonymousContext(St);St.requestContext.registerObject("socket",St);St.app=this.app;On()}));ur.on("connect",(On=>{let rr=this.middlewareService.compose([...this.connectionMiddlewareManager,...Sr],this.app).then((St=>St(On)));const ir=(0,br.getClassMetadata)(br.WS_EVENT_KEY,St);const ur={};const Er=ir.filter((St=>St.eventType===br.WSEventTypeEnum.ON_CONNECTION));if(Er.length){rr=rr.then((()=>Promise.all(Er.map((async rr=>{var ir;ur[rr.propertyName]=ur[rr.propertyName]||{responseEvents:[]};const cr=await On.requestContext.getAsync(St);try{const St=await this.middlewareService.compose([...((ir=rr===null||rr===void 0?void 0:rr.eventOptions)===null||ir===void 0?void 0:ir.middleware)||[],async(St,ir)=>cr[rr.propertyName].apply(cr,[On])],this.app);const pr=await St(On);await this.bindSocketResponse(pr,On,rr.propertyName,ur)}catch(St){this.logger.error(St)}})))))}const kr=ir.filter((St=>St.eventType!==br.WSEventTypeEnum.ON_CONNECTION));if(kr.length){for(const ir of kr){ur[ir.propertyName]=ur[ir.propertyName]||{responseEvents:[]};if(ir.eventType===br.WSEventTypeEnum.ON_MESSAGE){On.on(ir.messageEventName,(async(...br)=>{await rr;const Sr=await On.requestContext.getAsync(St);pr("got message",ir.messageEventName,br);try{const rr=await(await this.applyMiddleware((async(On,rr)=>{var ur;const pr=await this.middlewareService.compose([...fr,...((ur=ir===null||ir===void 0?void 0:ir.eventOptions)===null||ur===void 0?void 0:ur.middleware)||[],async(On,rr)=>{const ur=await this.app.getFramework().runGuard(On,St,ir.propertyName);if(!ur){throw new cr.MidwayInvokeForbiddenError(ir.propertyName,St)}return Sr[ir.propertyName].apply(Sr,br)}],this.app);return await pr(On,rr)})))(On);if(typeof br[br.length-1]==="function"){br[br.length-1](rr)}else{await this.bindSocketResponse(rr,On,ir.propertyName,ur)}}catch(St){this.logger.error(St)}}))}else if(ir.eventType===br.WSEventTypeEnum.ON_DISCONNECTION){On.on("disconnect",(async rr=>{const cr=await On.requestContext.getAsync(St);try{const St=await cr[ir.propertyName].apply(cr,[rr]);await this.bindSocketResponse(St,On,ir.propertyName,ur)}catch(St){this.logger.error(St)}}))}else{ur[ir.propertyName].responseEvents.push(ir)}}}}));if(ur.adapter&&ur.adapter.on){ur.adapter.on("error",(St=>{this.logger.error(St)}))}ur.on("error",(St=>{this.logger.error(St)}))}async bindSocketResponse(St,On,rr,ir){if(St&&ir[rr]){for(const cr of ir[rr].responseEvents){if(cr.eventType===br.WSEventTypeEnum.EMIT){if(cr.roomName.length){On=cr.roomName.reduce(((St,On)=>St.to(On)),On)}On.emit.apply(On,[cr.messageEventName].concat(St))}else if(cr.eventType===br.WSEventTypeEnum.BROADCAST){On.nsp.emit.apply(On.nsp,[].concat(St))}}}}getFrameworkName(){return"midway:socketIO"}useConnectionMiddleware(St){this.connectionMiddlewareManager.insertLast(St)}getConnectionMiddleware(){return this.connectionMiddlewareManager}};Sr=ir([(0,br.Framework)()],Sr);On.MidwaySocketIOFramework=Sr},87735:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=On.createRedisAdapter=On.Framework=void 0;var ur=rr(53739);Object.defineProperty(On,"Framework",{enumerable:true,get:function(){return ur.MidwaySocketIOFramework}});var pr=rr(47191);Object.defineProperty(On,"createRedisAdapter",{enumerable:true,get:function(){return pr.createRedisAdapter}});cr(rr(94460),On);var fr=rr(96313);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return fr.SocketIOConfiguration}})},94460:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},47191:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.createRedisAdapter=void 0;const ir=rr(56748);function createRedisAdapter(St){if(St.host&&St.port){return(0,ir.createAdapter)("redis://"+St.host+":"+St.port,St)}if(St.pubClient&&St.subClient){return(0,ir.createAdapter)(St)}throw new Error("error socket adapter options")}On.createRedisAdapter=createRedisAdapter},95567:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});const ir=rr(16928);On["default"]=St=>({staticFile:{dirs:{default:{prefix:"/public",dir:(0,ir.join)(St.appDir,"public")}},dynamic:true,preload:false,buffer:false,maxFiles:1e3}})},40647:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.StaticFileConfiguration=void 0;const ur=rr(46123);const pr=rr(88218);const fr=rr(95567);let br=class StaticFileConfiguration{async onConfigLoad(){if(this.applicationManager.getApplication("faas")){return{staticFile:{buffer:true}}}}async onReady(St){this.applicationManager.getApplications(["koa","faas","egg"]).forEach((On=>{if(St.hasNamespace("cross-domain")){On.getMiddleware().insertAfter(pr.StaticMiddleware,"cors")}else{On.getMiddleware().insertFirst(pr.StaticMiddleware)}}))}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);br=ir([(0,ur.Configuration)({namespace:"static-file",importConfigs:[{default:fr}]})],br);On.StaticFileConfiguration=br},44803:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DirectoryNotFoundError=On.StaticFileErrorEnum=void 0;const ir=rr(46123);On.StaticFileErrorEnum=(0,ir.registerErrorCode)("static_file",{DIRECTORY_NOT_EXISTS:1e4});class DirectoryNotFoundError extends ir.MidwayError{constructor(St){super(`Path ${St} not exist, please check it.`,On.StaticFileErrorEnum.DIRECTORY_NOT_EXISTS)}}On.DirectoryNotFoundError=DirectoryNotFoundError},2865:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(40647);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.StaticFileConfiguration}});cr(rr(88218),On);cr(rr(20066),On);cr(rr(44803),On)},20066:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},88218:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.StaticMiddleware=void 0;const ur=rr(46123);const pr=rr(42613);const fr=rr(4239);const br=rr(91404);const Sr=rr(93546);const Er=rr(44803);const kr=rr(79896);let Pr=class StaticMiddleware{async resolve(St){const On=Object.values(this.staticFileConfig.dirs);if(this.staticFileConfig.dir){On.push(this.staticFileConfig.dir)}const rr=[];function rangeMiddleware(St,On){const ir=rr.some((On=>St.path.startsWith(On)));if(ir){return Sr(St,On)}return On()}const ir=[rangeMiddleware];for(const St of On){pr(ur.Types.isObject(St)||ur.Types.isString(St),"`config.static.dir` must be `string | Array<string|object>`.");const On=Object.assign({},this.staticFileConfig,St);if(On.dynamic&&!On.files){On.files=new br(On.maxFiles)}if(On.prefix){rr.push(On.prefix)}if(this.environmentService.isPkgEnvironment()){if(!kr.existsSync(On.dir)){throw new Er.DirectoryNotFoundError(On.dir)}}else{if(!await ur.FileUtils.exists(On.dir)){throw new Er.DirectoryNotFoundError(On.dir)}}this.logger.info("[midway:static] starting static serve %s -> %s",On.prefix,On.dir);ir.push(fr(On))}return await this.middlewareService.compose(ir,St,"staticFile")}static getName(){return"staticFile"}};ir([(0,ur.Config)("staticFile"),cr("design:type",Object)],Pr.prototype,"staticFileConfig",void 0);ir([(0,ur.Inject)(),cr("design:type",ur.MidwayMiddlewareService)],Pr.prototype,"middlewareService",void 0);ir([(0,ur.Inject)(),cr("design:type",ur.MidwayEnvironmentService)],Pr.prototype,"environmentService",void 0);ir([(0,ur.Logger)("coreLogger"),cr("design:type",Object)],Pr.prototype,"logger",void 0);Pr=ir([(0,ur.Middleware)()],Pr);On.StaticMiddleware=Pr},73455:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.isEnumMetadata=On.isEnumDefined=On.isEnumArray=On.addEnumSchema=On.addEnumArraySchema=On.getEnumType=On.getEnumValues=void 0;function getEnumValues(St){if(Array.isArray(St)){return St}if(typeof St!=="object"){return[]}const On=Object.keys(St).filter((St=>isNaN(Number(St)))).map((On=>St[On]));return Array.from(new Set(On))}On.getEnumValues=getEnumValues;function getEnumType(St){const On=St.filter((St=>typeof St==="string")).length>0;return On?"string":"number"}On.getEnumType=getEnumType;function addEnumArraySchema(St,On){const rr=St.schema||{};St.schema=rr;rr.type="array";delete St.isArray;const ir=getEnumValues(On.enum);rr.items={type:getEnumType(ir),enum:ir};if(On.enumName){St.enumName=On.enumName}}On.addEnumArraySchema=addEnumArraySchema;function addEnumSchema(St,On){const rr=St.schema||{};const ir=getEnumValues(On.enum);St.schema=rr;rr.enum=ir;rr.type=getEnumType(ir);if(On.enumName){St.enumName=On.enumName}}On.addEnumSchema=addEnumSchema;const isEnumArray=St=>St.isArray&&St.enum;On.isEnumArray=isEnumArray;const isEnumDefined=St=>St.enum;On.isEnumDefined=isEnumDefined;const isEnumMetadata=St=>{var On;return St.enum||St.isArray&&((On=St.items)===null||On===void 0?void 0:On["enum"])};On.isEnumMetadata=isEnumMetadata},80163:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.HttpStatus=void 0;var rr;(function(St){St[St["CONTINUE"]=100]="CONTINUE";St[St["SWITCHING_PROTOCOLS"]=101]="SWITCHING_PROTOCOLS";St[St["PROCESSING"]=102]="PROCESSING";St[St["EARLYHINTS"]=103]="EARLYHINTS";St[St["OK"]=200]="OK";St[St["CREATED"]=201]="CREATED";St[St["ACCEPTED"]=202]="ACCEPTED";St[St["NON_AUTHORITATIVE_INFORMATION"]=203]="NON_AUTHORITATIVE_INFORMATION";St[St["NO_CONTENT"]=204]="NO_CONTENT";St[St["RESET_CONTENT"]=205]="RESET_CONTENT";St[St["PARTIAL_CONTENT"]=206]="PARTIAL_CONTENT";St[St["AMBIGUOUS"]=300]="AMBIGUOUS";St[St["MOVED_PERMANENTLY"]=301]="MOVED_PERMANENTLY";St[St["FOUND"]=302]="FOUND";St[St["SEE_OTHER"]=303]="SEE_OTHER";St[St["NOT_MODIFIED"]=304]="NOT_MODIFIED";St[St["TEMPORARY_REDIRECT"]=307]="TEMPORARY_REDIRECT";St[St["PERMANENT_REDIRECT"]=308]="PERMANENT_REDIRECT";St[St["BAD_REQUEST"]=400]="BAD_REQUEST";St[St["UNAUTHORIZED"]=401]="UNAUTHORIZED";St[St["PAYMENT_REQUIRED"]=402]="PAYMENT_REQUIRED";St[St["FORBIDDEN"]=403]="FORBIDDEN";St[St["NOT_FOUND"]=404]="NOT_FOUND";St[St["METHOD_NOT_ALLOWED"]=405]="METHOD_NOT_ALLOWED";St[St["NOT_ACCEPTABLE"]=406]="NOT_ACCEPTABLE";St[St["PROXY_AUTHENTICATION_REQUIRED"]=407]="PROXY_AUTHENTICATION_REQUIRED";St[St["REQUEST_TIMEOUT"]=408]="REQUEST_TIMEOUT";St[St["CONFLICT"]=409]="CONFLICT";St[St["GONE"]=410]="GONE";St[St["LENGTH_REQUIRED"]=411]="LENGTH_REQUIRED";St[St["PRECONDITION_FAILED"]=412]="PRECONDITION_FAILED";St[St["PAYLOAD_TOO_LARGE"]=413]="PAYLOAD_TOO_LARGE";St[St["URI_TOO_LONG"]=414]="URI_TOO_LONG";St[St["UNSUPPORTED_MEDIA_TYPE"]=415]="UNSUPPORTED_MEDIA_TYPE";St[St["REQUESTED_RANGE_NOT_SATISFIABLE"]=416]="REQUESTED_RANGE_NOT_SATISFIABLE";St[St["EXPECTATION_FAILED"]=417]="EXPECTATION_FAILED";St[St["I_AM_A_TEAPOT"]=418]="I_AM_A_TEAPOT";St[St["MISDIRECTED"]=421]="MISDIRECTED";St[St["UNPROCESSABLE_ENTITY"]=422]="UNPROCESSABLE_ENTITY";St[St["FAILED_DEPENDENCY"]=424]="FAILED_DEPENDENCY";St[St["PRECONDITION_REQUIRED"]=428]="PRECONDITION_REQUIRED";St[St["TOO_MANY_REQUESTS"]=429]="TOO_MANY_REQUESTS";St[St["INTERNAL_SERVER_ERROR"]=500]="INTERNAL_SERVER_ERROR";St[St["NOT_IMPLEMENTED"]=501]="NOT_IMPLEMENTED";St[St["BAD_GATEWAY"]=502]="BAD_GATEWAY";St[St["SERVICE_UNAVAILABLE"]=503]="SERVICE_UNAVAILABLE";St[St["GATEWAY_TIMEOUT"]=504]="GATEWAY_TIMEOUT";St[St["HTTP_VERSION_NOT_SUPPORTED"]=505]="HTTP_VERSION_NOT_SUPPORTED"})(rr=On.HttpStatus||(On.HttpStatus={}))},68641:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.swagger=void 0;const ir=rr(3376);const cr=rr(46123);const ur=(0,cr.safeRequire)("swagger-ui-dist");On.swagger={title:"My Project",description:"This is a swagger-ui for midwayjs project",version:"1.0.0",swaggerPath:"/swagger-ui",swaggerUIRender:ur&&ur.getAbsoluteFSPath?ir.renderSwaggerUIDist:ir.renderSwaggerUIRemote,swaggerUIRenderOptions:{},isGenerateTagForController:true}},9317:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SwaggerConfiguration=void 0;const ur=rr(46123);const pr=rr(49179);const fr=rr(68641);let br=class SwaggerConfiguration{async onReady(St){const On=this.applicationManager.getApplications(["express","koa","egg","faas"]);if(On.length){const rr=await St.getAsync(pr.SwaggerExplorer);rr.scanApp();let ir=this.configService.getConfiguration("globalPrefix")||this.configService.getConfiguration("koa.globalPrefix")||this.configService.getConfiguration("express.globalPrefix")||this.configService.getConfiguration("egg.globalPrefix");if(ir){if(!/^\//.test(ir)){ir="/"+ir}rr.addGlobalPrefix(ir)}On.forEach((St=>{St.useMiddleware(pr.SwaggerMiddleware)}))}}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayApplicationManager)],br.prototype,"applicationManager",void 0);ir([(0,ur.Inject)(),cr("design:type",ur.MidwayConfigService)],br.prototype,"configService",void 0);br=ir([(0,ur.Configuration)({importConfigs:[{default:fr}],namespace:"swagger"})],br);On.SwaggerConfiguration=br},48574:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.DECORATORS=On.DECORATORS_METHOD_METADATA=On.DECORATORS_CLASS_METADATA=On.DECORATORS_PREFIX=void 0;On.DECORATORS_PREFIX="swagger";On.DECORATORS_CLASS_METADATA="swagger:class_metadata";On.DECORATORS_METHOD_METADATA="swagger:method_metadata";On.DECORATORS={API_OPERATION:`${On.DECORATORS_PREFIX}/apiOperation`,API_RESPONSE:`${On.DECORATORS_PREFIX}/apiResponse`,API_TAGS:`${On.DECORATORS_PREFIX}/apiUseTags`,API_PARAMETERS:`${On.DECORATORS_PREFIX}/apiParameters`,API_HEADERS:`${On.DECORATORS_PREFIX}/apiHeaders`,API_MODEL_PROPERTIES:`${On.DECORATORS_PREFIX}/apiModelProperties`,API_EXTRA_MODEL:`${On.DECORATORS_PREFIX}/apiExtraModel`,API_MODEL_PROPERTIES_ARRAY:`${On.DECORATORS_PREFIX}/apiModelPropertiesArray`,API_SECURITY:`${On.DECORATORS_PREFIX}/apiSecurity`,API_EXCLUDE_SECURITY:`${On.DECORATORS_PREFIX}/apiExcludeSecurity`,API_EXCLUDE_ENDPOINT:`${On.DECORATORS_PREFIX}/apiExcludeEndpoint`,API_EXCLUDE_CONTROLLER:`${On.DECORATORS_PREFIX}/apiExcludeController`,API_EXTENSION:`${On.DECORATORS_PREFIX}/apiExtension`}},51102:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiBasicAuth=void 0;const ir=rr(55118);function ApiBasicAuth(St="basic"){return(0,ir.ApiSecurity)(St)}On.ApiBasicAuth=ApiBasicAuth},21873:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiBearerAuth=void 0;const ir=rr(55118);function ApiBearerAuth(St="bearer"){return(0,ir.ApiSecurity)(St)}On.ApiBearerAuth=ApiBearerAuth},65288:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiBody=On.BodyContentType=void 0;const ir=rr(73455);const cr=rr(15071);var ur;(function(St){St["FormUrlEncoded"]="application/x-www-form-urlencoded";St["JSON"]="application/json";St["Multipart"]="multipart/form-data";St["MultipartMixed"]="multipart/mixed";St["OctetStream"]="application/octet-stream"})(ur=On.BodyContentType||(On.BodyContentType={}));const pr={type:String,required:true};function ApiBody(St){const[On,rr]=(0,cr.getTypeIsArrayTuple)(St.type,St.isArray);const ur={in:"body",...St,type:On,isArray:rr};if((0,ir.isEnumArray)(St)){(0,ir.addEnumArraySchema)(ur,St)}else if((0,ir.isEnumDefined)(St)){(0,ir.addEnumSchema)(ur,St)}return(0,cr.createParamDecorator)(ur,pr)}On.ApiBody=ApiBody},80222:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiCookieAuth=void 0;const ir=rr(55118);function ApiCookieAuth(St="cookie"){return(0,ir.ApiSecurity)(St)}On.ApiCookieAuth=ApiCookieAuth},44097:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiExcludeController=void 0;const ir=rr(46123);const cr=rr(48574);function ApiExcludeController(St=true){return On=>{(0,ir.saveClassMetadata)(cr.DECORATORS.API_EXCLUDE_CONTROLLER,{disable:St},On)}}On.ApiExcludeController=ApiExcludeController},61944:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiExcludeEndpoint=void 0;const ir=rr(48574);const cr=rr(15071);function ApiExcludeEndpoint(St=true){return(0,cr.createMixedDecorator)(ir.DECORATORS.API_EXCLUDE_ENDPOINT,true)}On.ApiExcludeEndpoint=ApiExcludeEndpoint},70821:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiExtension=void 0;const ir=rr(48574);const cr=rr(15071);function ApiExtension(St,On){if(!St.startsWith("x-")){throw new Error("Extension key is not prefixed. Please ensure you prefix it with `x-`.")}const rr={[St]:JSON.parse(JSON.stringify(On))};return(0,cr.createMixedDecorator)(ir.DECORATORS.API_EXTENSION,rr)}On.ApiExtension=ApiExtension},91582:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiExtraModel=void 0;const ir=rr(48574);const cr=rr(15071);function ApiExtraModel(St){return(0,cr.createMixedDecorator)(ir.DECORATORS.API_EXTRA_MODEL,St)}On.ApiExtraModel=ApiExtraModel},40301:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiHeaders=On.ApiHeader=void 0;const ir=rr(48574);const cr=rr(73455);const ur=rr(15071);const pr={name:""};function ApiHeader(St){const On={name:!St.name?pr.name:St.name,in:"header",description:St.description,required:St.required,schema:{...St.schema||{},type:"string"}};if(St.enum){const rr=(0,cr.getEnumValues)(St.enum);On.schema={enum:rr,type:(0,cr.getEnumType)(rr)}}return(St,rr,cr)=>{if(cr){return(0,ur.createMixedDecorator)(ir.DECORATORS.API_HEADERS,On)(St,rr,cr)}return(0,ur.createMixedDecorator)(ir.DECORATORS.API_HEADERS,On)(St,undefined,undefined)}}On.ApiHeader=ApiHeader;const ApiHeaders=St=>(On,rr,ir)=>{St.forEach((St=>ApiHeader(St)(On,rr,ir)))};On.ApiHeaders=ApiHeaders},10555:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiOAuth2=void 0;const ir=rr(55118);function ApiOAuth2(St,On="oauth2"){return(0,ir.ApiSecurity)(On,St)}On.ApiOAuth2=ApiOAuth2},39025:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiOperation=void 0;const ir=rr(48574);const cr=rr(15071);const ur={summary:""};function ApiOperation(St){return(0,cr.createMixedDecorator)(ir.DECORATORS.API_OPERATION,{...ur,...St})}On.ApiOperation=ApiOperation},58729:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiParam=void 0;const ir=rr(15071);const cr=rr(73455);const ur={name:"",required:true};function ApiParam(St){const On={name:!St.name?ur.name:St.name,in:"path",...St};const rr=St;if(rr.enum){On.schema=On.schema||{};const St=On.schema;const ir=(0,cr.getEnumValues)(rr.enum);St.type=(0,cr.getEnumType)(ir);St.enum=ir;if(rr.enumName){On.enumName=rr.enumName}}return(0,ir.createParamDecorator)(On,ur)}On.ApiParam=ApiParam},13529:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiResponseProperty=On.ApiPropertyOptional=On.createApiPropertyDecorator=On.ApiProperty=void 0;const ir=rr(48574);const cr=rr(73455);const ur=rr(15071);const isEnumArray=St=>St.isArray&&!!St.enum;function ApiProperty(St={}){return createApiPropertyDecorator(St)}On.ApiProperty=ApiProperty;function createApiPropertyDecorator(St={}){const[On,rr]=(0,ur.getTypeIsArrayTuple)(St.type,St.isArray);St={...St,type:On};if(isEnumArray(St)){St.type="array";const On=(0,cr.getEnumValues)(St.enum);St.items={type:(0,cr.getEnumType)(On),enum:On};delete St.enum}else if(St.enum){const On=(0,cr.getEnumValues)(St.enum);St.enum=On;St.type=(0,cr.getEnumType)(On)}if(rr){St.type="array";St.items={type:On}}return(0,ur.createPropertyDecorator)(ir.DECORATORS.API_MODEL_PROPERTIES,St)}On.createApiPropertyDecorator=createApiPropertyDecorator;function ApiPropertyOptional(St={}){return ApiProperty({...St,required:false})}On.ApiPropertyOptional=ApiPropertyOptional;function ApiResponseProperty(St={}){return ApiProperty({readOnly:true,...St})}On.ApiResponseProperty=ApiResponseProperty},60360:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiQuery=void 0;const ir=rr(73455);const cr=rr(15071);const ur={name:"",required:true};function ApiQuery(St){const On=St;const[rr,pr]=(0,cr.getTypeIsArrayTuple)(On.type,On.isArray);const fr={name:!St.name?ur.name:St.name,in:"query",...St,type:rr};if((0,ir.isEnumArray)(St)){(0,ir.addEnumArraySchema)(fr,St)}else if((0,ir.isEnumDefined)(St)){(0,ir.addEnumSchema)(fr,St)}if(pr){fr.isArray=pr}return(0,cr.createParamDecorator)(fr,ur)}On.ApiQuery=ApiQuery},95555:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiDefaultResponse=On.ApiUnsupportedMediaTypeResponse=On.ApiUnprocessableEntityResponse=On.ApiServiceUnavailableResponse=On.ApiRequestTimeoutResponse=On.ApiPayloadTooLargeResponse=On.ApiPreconditionFailedResponse=On.ApiNotImplementedResponse=On.ApiNotAcceptableResponse=On.ApiMethodNotAllowedResponse=On.ApiGoneResponse=On.ApiGatewayTimeoutResponse=On.ApiForbiddenResponse=On.ApiConflictResponse=On.ApiBadGatewayResponse=On.ApiInternalServerErrorResponse=On.ApiNotFoundResponse=On.ApiTooManyRequestsResponse=On.ApiUnauthorizedResponse=On.ApiBadRequestResponse=On.ApiFoundResponse=On.ApiMovedPermanentlyResponse=On.ApiNoContentResponse=On.ApiAcceptedResponse=On.ApiCreatedResponse=On.ApiOkResponse=On.ApiResponse=void 0;const ir=rr(48574);const cr=rr(15071);const ur=rr(80163);function ApiResponse(St){const[On,rr]=(0,cr.getTypeIsArrayTuple)(St.type,St.isArray);St.type=On;St.isArray=rr;St.description=St.description?St.description:"";const ur={[St.status||"default"]:St};return(0,cr.createMixedDecorator)(ir.DECORATORS.API_RESPONSE,ur)}On.ApiResponse=ApiResponse;const ApiOkResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.OK});On.ApiOkResponse=ApiOkResponse;const ApiCreatedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.CREATED});On.ApiCreatedResponse=ApiCreatedResponse;const ApiAcceptedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.ACCEPTED});On.ApiAcceptedResponse=ApiAcceptedResponse;const ApiNoContentResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.NO_CONTENT});On.ApiNoContentResponse=ApiNoContentResponse;const ApiMovedPermanentlyResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.MOVED_PERMANENTLY});On.ApiMovedPermanentlyResponse=ApiMovedPermanentlyResponse;const ApiFoundResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.FOUND});On.ApiFoundResponse=ApiFoundResponse;const ApiBadRequestResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.BAD_REQUEST});On.ApiBadRequestResponse=ApiBadRequestResponse;const ApiUnauthorizedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.UNAUTHORIZED});On.ApiUnauthorizedResponse=ApiUnauthorizedResponse;const ApiTooManyRequestsResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.TOO_MANY_REQUESTS});On.ApiTooManyRequestsResponse=ApiTooManyRequestsResponse;const ApiNotFoundResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.NOT_FOUND});On.ApiNotFoundResponse=ApiNotFoundResponse;const ApiInternalServerErrorResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.INTERNAL_SERVER_ERROR});On.ApiInternalServerErrorResponse=ApiInternalServerErrorResponse;const ApiBadGatewayResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.BAD_GATEWAY});On.ApiBadGatewayResponse=ApiBadGatewayResponse;const ApiConflictResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.CONFLICT});On.ApiConflictResponse=ApiConflictResponse;const ApiForbiddenResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.FORBIDDEN});On.ApiForbiddenResponse=ApiForbiddenResponse;const ApiGatewayTimeoutResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.GATEWAY_TIMEOUT});On.ApiGatewayTimeoutResponse=ApiGatewayTimeoutResponse;const ApiGoneResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.GONE});On.ApiGoneResponse=ApiGoneResponse;const ApiMethodNotAllowedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.METHOD_NOT_ALLOWED});On.ApiMethodNotAllowedResponse=ApiMethodNotAllowedResponse;const ApiNotAcceptableResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.NOT_ACCEPTABLE});On.ApiNotAcceptableResponse=ApiNotAcceptableResponse;const ApiNotImplementedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.NOT_IMPLEMENTED});On.ApiNotImplementedResponse=ApiNotImplementedResponse;const ApiPreconditionFailedResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.PRECONDITION_FAILED});On.ApiPreconditionFailedResponse=ApiPreconditionFailedResponse;const ApiPayloadTooLargeResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.PAYLOAD_TOO_LARGE});On.ApiPayloadTooLargeResponse=ApiPayloadTooLargeResponse;const ApiRequestTimeoutResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.REQUEST_TIMEOUT});On.ApiRequestTimeoutResponse=ApiRequestTimeoutResponse;const ApiServiceUnavailableResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.SERVICE_UNAVAILABLE});On.ApiServiceUnavailableResponse=ApiServiceUnavailableResponse;const ApiUnprocessableEntityResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.UNPROCESSABLE_ENTITY});On.ApiUnprocessableEntityResponse=ApiUnprocessableEntityResponse;const ApiUnsupportedMediaTypeResponse=(St={})=>ApiResponse({...St,status:ur.HttpStatus.UNSUPPORTED_MEDIA_TYPE});On.ApiUnsupportedMediaTypeResponse=ApiUnsupportedMediaTypeResponse;const ApiDefaultResponse=(St={})=>ApiResponse({...St,status:"default"});On.ApiDefaultResponse=ApiDefaultResponse},55118:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiExcludeSecurity=On.ApiSecurity=void 0;const ir=rr(48574);const cr=rr(15071);function ApiSecurity(St,On=[]){let rr;if(typeof St==="string"){rr={[St]:On||[]}}else{rr=St}return(0,cr.createMixedDecorator)(ir.DECORATORS.API_SECURITY,rr)}On.ApiSecurity=ApiSecurity;function ApiExcludeSecurity(){return(0,cr.createMixedDecorator)(ir.DECORATORS.API_EXCLUDE_SECURITY,true)}On.ApiExcludeSecurity=ApiExcludeSecurity},37505:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.ApiTags=void 0;const ir=rr(48574);const cr=rr(15071);function ApiTags(St){return(0,cr.createMixedDecorator)(ir.DECORATORS.API_TAGS,St)}On.ApiTags=ApiTags},15071:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.getSchemaPath=On.getTypeIsArrayTuple=On.createParamDecorator=On.createMixedDecorator=On.createPropertyDecorator=void 0;const ir=rr(46123);const cr=rr(48574);function createPropertyDecorator(St,On){return(0,ir.createCustomPropertyDecorator)(St,On,false)}On.createPropertyDecorator=createPropertyDecorator;function createMixedDecorator(St,On){return(rr,ur)=>{if(ur){(0,ir.attachPropertyDataToClass)(cr.DECORATORS_METHOD_METADATA,{key:St,propertyName:ur,metadata:On},rr,ur)}else{(0,ir.attachClassMetadata)(cr.DECORATORS_CLASS_METADATA,{key:St,metadata:On},rr)}}}On.createMixedDecorator=createMixedDecorator;function createParamDecorator(St,On){return createMixedDecorator(cr.DECORATORS.API_PARAMETERS,{...On,...St})}On.createParamDecorator=createParamDecorator;function getTypeIsArrayTuple(St,On){if(!St){return[St,On]}if(On){return[St,On]}const rr=Array.isArray(St);const ir=rr?St[0]:St;return[ir,rr]}On.getTypeIsArrayTuple=getTypeIsArrayTuple;function getSchemaPath(St){let On=St;if(typeof St!=="string"){On=St?St.name:St}return`#/components/schemas/${On}`}On.getSchemaPath=getSchemaPath},74398:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.getSchemaPath=On.ApiResponseProperty=On.ApiPropertyOptional=On.ApiProperty=void 0;cr(rr(65288),On);cr(rr(61944),On);cr(rr(44097),On);cr(rr(40301),On);cr(rr(39025),On);cr(rr(58729),On);var ur=rr(13529);Object.defineProperty(On,"ApiProperty",{enumerable:true,get:function(){return ur.ApiProperty}});Object.defineProperty(On,"ApiPropertyOptional",{enumerable:true,get:function(){return ur.ApiPropertyOptional}});Object.defineProperty(On,"ApiResponseProperty",{enumerable:true,get:function(){return ur.ApiResponseProperty}});cr(rr(60360),On);cr(rr(95555),On);cr(rr(37505),On);cr(rr(70821),On);cr(rr(51102),On);cr(rr(21873),On);cr(rr(80222),On);cr(rr(10555),On);cr(rr(55118),On);cr(rr(91582),On);var pr=rr(15071);Object.defineProperty(On,"getSchemaPath",{enumerable:true,get:function(){return pr.getSchemaPath}})},2171:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.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(St){this.document.info.title=St;return this}setDescription(St){this.document.info.description=St;return this}setVersion(St){this.document.info.version=St;return this}setTermsOfService(St){this.document.info.termsOfService=St;return this}setContact(St,On,rr){this.document.info.contact={name:St,url:On,email:rr};return this}setLicense(St,On){this.document.info.license={name:St,url:On};return this}addServer(St,On,rr){this.document.servers.push({url:St,description:On,variables:rr});return this}setExternalDoc(St,On){this.document.externalDocs={description:St,url:On};return this}addPaths(St){Object.assign(this.document.paths,St);return this}getPaths(){return this.document.paths}setPaths(St){this.document.paths=St;return this}addSchema(St){if(!this.document.components.schemas){this.document.components.schemas={}}Object.assign(this.document.components.schemas,St);return this}getSchema(St){var On,rr;if((On=this.document.components)===null||On===void 0?void 0:On.schemas){return(rr=this.document.components)===null||rr===void 0?void 0:rr.schemas[St]}return undefined}addTag(St,On="",rr){const ir=this.document.tags||[];if(Array.isArray(St)){const On=St;for(const rr of On){if(!ir.find((On=>On.name===St))){ir.push({name:rr,description:""})}}return this}if(!ir.find((On=>On.name===St))){ir.push({name:St,description:On,externalDocs:rr})}else{ir.forEach((ir=>{if(ir.name===St){if(On){ir.description=On}if(rr){ir.externalDocs=rr}}}))}this.document.tags=ir;return this}addSecurity(St,On){this.document.components.securitySchemes={...this.document.components.securitySchemes||{},[St]:On};return this}addSecurityRequirements(St,On=[]){let rr;if(typeof St==="string"){rr={[St]:On}}else{rr=St}this.document.security=(this.document.security||[]).concat({...rr});return this}addBearerAuth(St={type:"http"},On="bearer"){this.addSecurity(On,{type:"http",scheme:"bearer",bearerFormat:"JWT",...St});return this}addOAuth2(St={type:"oauth2"},On="oauth2"){if(!On){On="oauth2"}this.addSecurity(On,{type:"oauth2",flows:{...St===null||St===void 0?void 0:St.flows}});return this}addApiKey(St={type:"apiKey"},On="api_key"){if(!On){On="api_key"}this.addSecurity(On,{type:"apiKey",in:"header",name:On,...St});return this}addBasicAuth(St={type:"http"},On="basic"){if(!On){On="basic"}this.addSecurity(On,{type:"http",scheme:"basic",...St});return this}addCookieAuth(St="connect.sid",On={type:"apiKey"},rr="cookie"){if(!St){St="connect.sid"}if(!rr){rr="cookie"}this.addSecurity(rr,{type:"apiKey",in:"cookie",name:St,...On});return this}sortTags(){const St=this.document.tags;this.document.tags=St.sort(((St,On)=>{const rr=St.name;const ir=On.name;const cr=rr.length>ir.length?ir.length:rr.length;for(let St=0;St<cr;St++){if(rr.charCodeAt(St)>ir.charCodeAt(St)){return 1}else if(rr.charCodeAt(St)<ir.charCodeAt(St)){return-1}}return 0}))}build(){return this.document}}On.DocumentBuilder=DocumentBuilder},49179:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.renderJSON=On.renderSwaggerUIDist=On.renderSwaggerUIRemote=On.SwaggerMiddleware=On.SwaggerExplorer=On.Configuration=void 0;cr(rr(74398),On);cr(rr(87448),On);var ur=rr(9317);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.SwaggerConfiguration}});var pr=rr(33984);Object.defineProperty(On,"SwaggerExplorer",{enumerable:true,get:function(){return pr.SwaggerExplorer}});var fr=rr(64811);Object.defineProperty(On,"SwaggerMiddleware",{enumerable:true,get:function(){return fr.SwaggerMiddleware}});var br=rr(3376);Object.defineProperty(On,"renderSwaggerUIRemote",{enumerable:true,get:function(){return br.renderSwaggerUIRemote}});Object.defineProperty(On,"renderSwaggerUIDist",{enumerable:true,get:function(){return br.renderSwaggerUIDist}});Object.defineProperty(On,"renderJSON",{enumerable:true,get:function(){return br.renderJSON}});cr(rr(48574),On)},87448:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true})},33984:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SwaggerExplorer=void 0;const ur=rr(46123);const pr=rr(48574);const fr=rr(2171);const br=rr(49179);const Sr=rr(73455);let Er=class SwaggerExplorer{constructor(){this.swaggerConfig={};this.documentBuilder=new fr.DocumentBuilder;this.operationIdFactory=(St,On)=>`${St.toLowerCase()}_${On.method.toLocaleLowerCase()}`}async init(){var St,On,rr,ir,cr,ur,pr,fr,br,Sr,Er,kr,Pr,Ir,Lr,Br,jr,Ur,Vr,Wr,zr,qr,Kr,Xr,Yr,ii,oi,ai,pi,mi,bi;this.documentBuilder.setTitle(this.swaggerConfig.title);this.documentBuilder.setVersion(this.swaggerConfig.version);this.documentBuilder.setDescription(this.swaggerConfig.description);if(((St=this.swaggerConfig)===null||St===void 0?void 0:St.contact)&&typeof((On=this.swaggerConfig)===null||On===void 0?void 0:On.contact)==="object"){this.documentBuilder.setContact((ir=(rr=this.swaggerConfig)===null||rr===void 0?void 0:rr.contact)===null||ir===void 0?void 0:ir.name,(ur=(cr=this.swaggerConfig)===null||cr===void 0?void 0:cr.contact)===null||ur===void 0?void 0:ur.url,(fr=(pr=this.swaggerConfig)===null||pr===void 0?void 0:pr.contact)===null||fr===void 0?void 0:fr.email)}if(((br=this.swaggerConfig)===null||br===void 0?void 0:br.license)&&typeof((Sr=this.swaggerConfig)===null||Sr===void 0?void 0:Sr.license)==="object"){this.documentBuilder.setLicense((kr=(Er=this.swaggerConfig)===null||Er===void 0?void 0:Er.license)===null||kr===void 0?void 0:kr.name,(Ir=(Pr=this.swaggerConfig)===null||Pr===void 0?void 0:Pr.license)===null||Ir===void 0?void 0:Ir.url)}if(this.swaggerConfig.termsOfService){this.documentBuilder.setTermsOfService(this.swaggerConfig.termsOfService)}if(((Lr=this.swaggerConfig)===null||Lr===void 0?void 0:Lr.externalDocs)&&typeof((Br=this.swaggerConfig)===null||Br===void 0?void 0:Br.externalDocs)==="object"){this.documentBuilder.setExternalDoc((Ur=(jr=this.swaggerConfig)===null||jr===void 0?void 0:jr.externalDocs)===null||Ur===void 0?void 0:Ur.description,(Wr=(Vr=this.swaggerConfig)===null||Vr===void 0?void 0:Vr.externalDocs)===null||Wr===void 0?void 0:Wr.url)}if(((zr=this.swaggerConfig)===null||zr===void 0?void 0:zr.servers)&&Array.isArray((qr=this.swaggerConfig)===null||qr===void 0?void 0:qr.servers)){for(const St of(Kr=this.swaggerConfig)===null||Kr===void 0?void 0:Kr.servers){this.documentBuilder.addServer(St===null||St===void 0?void 0:St.url,St===null||St===void 0?void 0:St.description,St===null||St===void 0?void 0:St.variables)}}if(((Xr=this.swaggerConfig)===null||Xr===void 0?void 0:Xr.tags)&&Array.isArray((Yr=this.swaggerConfig)===null||Yr===void 0?void 0:Yr.tags)){for(const St of(ii=this.swaggerConfig)===null||ii===void 0?void 0:ii.tags){this.documentBuilder.addTag(St.name,St.description,St.externalDocs)}}if((ai=(oi=this.swaggerConfig)===null||oi===void 0?void 0:oi.documentOptions)===null||ai===void 0?void 0:ai.operationIdFactory){this.operationIdFactory=this.swaggerConfig.documentOptions.operationIdFactory}if(Array.isArray((pi=this.swaggerConfig)===null||pi===void 0?void 0:pi.auth)){for(const St of(mi=this.swaggerConfig)===null||mi===void 0?void 0:mi.auth){this.setAuth(St)}}else{this.setAuth((bi=this.swaggerConfig)===null||bi===void 0?void 0:bi.auth)}}addGlobalPrefix(St){if(!St){return}const On=this.documentBuilder.getPaths();const rr={};for(const[ir,cr]of Object.entries(On)){if(!/^\//.test(ir)){rr[`${St}/${ir}`]=cr}else{rr[`${St}${ir}`]=cr}}this.documentBuilder.setPaths(rr)}scanApp(){var St;const On=(0,ur.listModule)(ur.CONTROLLER_KEY);for(const St of On){this.generatePath(St)}if((St=this.swaggerConfig)===null||St===void 0?void 0:St.tagSortable){this.documentBuilder.sortTags()}}getData(){return this.documentBuilder.build()}getDocumentBuilder(){return this.documentBuilder}generatePath(St){var On;const rr=(0,ur.getClassMetadata)(pr.DECORATORS.API_EXCLUDE_CONTROLLER,St);if(rr&&rr.disable){return}const ir=(On=this.swaggerConfig.isGenerateTagForController)!==null&&On!==void 0?On:true;this.parseExtraModel(St);const cr=(0,ur.getClassMetadata)(pr.DECORATORS_CLASS_METADATA,St)||[];const fr=(0,ur.getClassMetadata)(ur.INJECT_CUSTOM_PARAM,St)||[];const br=(0,ur.getClassMetadata)(ur.CONTROLLER_KEY,St);const Sr=br.prefix;const Er=cr.filter((St=>St.key===pr.DECORATORS.API_TAGS));let kr=[];const Pr=[];if(Er.length>0){kr=parseTags(Er);kr.forEach((St=>{addTag(St,Pr)}))}else{if(ir){const St={name:"",description:""};if(Sr!=="/"){St.name=(br===null||br===void 0?void 0:br.routerOptions.tagName)||(/^\//.test(Sr)?Sr.split("/")[1]:Sr);St.description=(br===null||br===void 0?void 0:br.routerOptions.description)||St.name}else{St.name=br===null||br===void 0?void 0:br.routerOptions.tagName;St.description=(br===null||br===void 0?void 0:br.routerOptions.description)||St.name}if(St.name){kr.push(St.name);addTag([St.name,St.description],Pr)}}else{}}const Ir=(0,ur.getClassMetadata)(ur.WEB_ROUTER_KEY,St);let Lr=cr.filter((St=>St.key===pr.DECORATORS.API_HEADERS));if(Lr.length>0){Lr=Lr.map((St=>St.metadata))}const Br=cr.filter((St=>St.key===pr.DECORATORS.API_SECURITY));const jr={};if(Ir&&typeof Ir[Symbol.iterator]==="function"){for(const On of Ir){let rr=(Sr+On.path).replace("//","/");rr=replaceUrl(rr,parseParamsInPath(rr));const ir=(0,ur.getPropertyDataFromClass)(pr.DECORATORS_METHOD_METADATA,St,On.method)||[];const br=ir.filter((St=>St.key===pr.DECORATORS.API_SECURITY));const Er=ir.filter((St=>St.key===pr.DECORATORS.API_EXCLUDE_ENDPOINT&&St.propertyName===On.method));if(Er[0]){continue}if(this.swaggerConfig.routerFilter){const St=this.swaggerConfig.routerFilter(rr,On);if(St){continue}}const Ir=fr[On.method]||[];const Ur=Ir.filter((St=>{var On;return St.key===ur.WEB_ROUTER_PARAM_KEY&&((On=St===null||St===void 0?void 0:St.metadata)===null||On===void 0?void 0:On.type)===ur.RouteParamTypes.BODY}));if(Ur.length>1){continue}this.generateRouteMethod(rr,On,jr,ir,Ir,Lr,St);if(jr[rr][On.requestMethod].tags.length===0){jr[rr][On.requestMethod].tags=kr}else{jr[rr][On.requestMethod].tags.forEach((St=>{addTag(St,Pr)}))}const Vr=ir.filter((St=>St.key===pr.DECORATORS.API_EXTENSION&&St.propertyName===On.method));for(const St of Vr){if(St.metadata){Object.assign(jr[rr][On.requestMethod],St.metadata)}}const Wr=ir.find((St=>St.key===pr.DECORATORS.API_EXCLUDE_SECURITY));const zr=br.length>0;const qr=cr.find((St=>St.key===pr.DECORATORS.API_EXCLUDE_SECURITY));const Kr=Br.length>0;if(Wr){jr[rr][On.requestMethod].security=[]}else if(zr){jr[rr][On.requestMethod].security=br.map((St=>St.metadata)).filter(Boolean)}else if(qr){jr[rr][On.requestMethod].security=[]}else if(Kr){jr[rr][On.requestMethod].security=Br.map((St=>St.metadata)).filter(Boolean)}}}this.documentBuilder.addPaths(jr);if(Object.keys(jr).length>0){Pr.forEach((St=>{if(Array.isArray(St)){this.documentBuilder.addTag(St[0],St[1])}else{this.documentBuilder.addTag(St)}}))}}generateRouteMethod(St,On,rr,ir,cr,fr,Sr){var Er,kr,Pr,Ir,Lr,Br,jr,Ur,Vr,Wr,zr,qr,Kr,Xr,Yr,ii,oi,ai,pi;const mi=ir.filter((St=>St.key===pr.DECORATORS.API_OPERATION&&St.propertyName===On.method))[0];const bi=ir.filter((St=>St.key===pr.DECORATORS.API_TAGS&&St.propertyName===On.method));const xi=parseTags(bi);let wi=rr[St];if(!wi){wi={}}const Oi=[];wi[On.requestMethod]={summary:getNotEmptyValue((Er=mi===null||mi===void 0?void 0:mi.metadata)===null||Er===void 0?void 0:Er.summary,On.summary),description:getNotEmptyValue((kr=mi===null||mi===void 0?void 0:mi.metadata)===null||kr===void 0?void 0:kr.description,On.description),operationId:((Pr=mi===null||mi===void 0?void 0:mi.metadata)===null||Pr===void 0?void 0:Pr.operationId)||this.getOperationId(Sr.name,On),tags:xi.length?xi:(Lr=(Ir=mi===null||mi===void 0?void 0:mi.metadata)===null||Ir===void 0?void 0:Ir.tags)!==null&&Lr!==void 0?Lr:[]};if(((Br=mi===null||mi===void 0?void 0:mi.metadata)===null||Br===void 0?void 0:Br.deprecated)!=null){wi[On.requestMethod].deprecated=!!((jr=mi===null||mi===void 0?void 0:mi.metadata)===null||jr===void 0?void 0:jr.deprecated)}const Ii=cr.filter((St=>{var On;return St.key===ur.WEB_ROUTER_PARAM_KEY&&((On=St===null||St===void 0?void 0:St.metadata)===null||On===void 0?void 0:On.type)!==ur.RouteParamTypes.CUSTOM}));const Ri=(0,ur.getMethodParamTypes)(Sr,On.method);const Li=ir.filter((St=>St.key===pr.DECORATORS.API_PARAMETERS&&St.propertyName===On.method));for(const St of Li){if(St.metadata.schema===undefined){St.metadata.schema={};if(St.metadata.type){St.metadata.schema["type"]=St.metadata.type;delete St.metadata.type}if(St.metadata.isArray){St.metadata.schema["items"]={type:St.metadata.schema["type"]};St.metadata.schema["type"]="array";delete St.metadata.isArray}if(St.metadata.enum!==undefined){St.metadata.schema.enum=St.metadata.enum;delete St.metadata.enum}}else{delete St.metadata.type;delete St.metadata.isArray;delete St.metadata.enum}const rr=St.metadata;rr.schema=this.formatType(St.metadata.schema);if(rr.in==="query"||rr.in==="path"||rr.in==="header"){Oi.push(rr)}else if(rr.in==="body"){rr.content=(Ur=rr.content)!==null&&Ur!==void 0?Ur:{};if(Object.keys(rr.content).length===0){rr.content[rr.contentType||"application/json"]=(Vr=rr.content[rr.contentType||"application/json"])!==null&&Vr!==void 0?Vr:{schema:rr.schema}}for(const St in rr.content){rr.content[St].schema=this.formatType(rr.content[St].schema)}wi[On.requestMethod].requestBody=(Wr=wi[On.requestMethod].requestBody)!==null&&Wr!==void 0?Wr:{};wi[On.requestMethod].requestBody.description=(zr=wi[On.requestMethod].requestBody.description)!==null&&zr!==void 0?zr:rr.description;wi[On.requestMethod].requestBody.content=(qr=wi[On.requestMethod].requestBody.content)!==null&&qr!==void 0?qr:rr.content;wi[On.requestMethod].requestBody.required=(Kr=wi[On.requestMethod].requestBody.required)!==null&&Kr!==void 0?Kr:rr.required}}for(const rr of Ii){const ir=Ri[rr.parameterIndex];const cr={name:(Xr=rr===null||rr===void 0?void 0:rr.metadata)===null||Xr===void 0?void 0:Xr.propertyData,in:convertTypeToString((Yr=rr.metadata)===null||Yr===void 0?void 0:Yr.type),required:false};const pr=Oi.find((St=>{var On;return St.name===((On=rr===null||rr===void 0?void 0:rr.metadata)===null||On===void 0?void 0:On.propertyData)&&St.in===cr.in}));if(pr){continue}if(cr.in==="path"){cr.required=true;if(St.indexOf("{"+cr.name+"}")===-1){continue}}if(ur.Types.isClass(ir)){this.parseClzz(ir)}if(cr.in==="query"||cr.in==="path"){if(ur.Types.isClass(ir)){const St=this.documentBuilder.getSchema(ir.name);Object.keys(St.properties).forEach((On=>{var rr,ir;const ur={name:On,in:cr.in,description:(rr=St.properties[On])===null||rr===void 0?void 0:rr.description,schema:St.properties[On],required:((ir=St.required)===null||ir===void 0?void 0:ir.includes(On))||false};Oi.push(ur)}));continue}else{if(!cr.name){continue}cr.schema={type:convertSchemaType((ii=ir===null||ir===void 0?void 0:ir.name)!==null&&ii!==void 0?ii:ir)}}}else if(cr.in==="body"){if(On.requestMethod===ur.RequestMethod.GET){continue}if(wi[On.requestMethod].requestBody){continue}if(((oi=rr.metadata)===null||oi===void 0?void 0:oi.type)===ur.RouteParamTypes.FILESSTREAM){cr.content={};cr.content[br.BodyContentType.Multipart]={schema:{type:"object",properties:{files:{type:"array",items:{type:"string",format:"binary"},description:cr.description}}}}}else if(((ai=rr.metadata)===null||ai===void 0?void 0:ai.type)===ur.RouteParamTypes.FILESTREAM){cr.content={};cr.content[br.BodyContentType.Multipart]={schema:{type:"object",properties:{file:{type:"string",format:"binary",description:cr.description}}}}}else{if(ur.Types.isClass(ir)){cr.content={"application/json":{schema:{$ref:"#/components/schemas/"+ir.name}}}}else{cr.content={"text/plain":{schema:{type:convertSchemaType((pi=ir===null||ir===void 0?void 0:ir.name)!==null&&pi!==void 0?pi:ir)}}}}}wi[On.requestMethod].requestBody={required:true,description:cr.description||cr.name,content:cr.content};continue}Oi.push(cr)}if(fr&&fr.length){fr.forEach((St=>Oi.unshift(St)))}const Bi=ir.filter((St=>St.key===pr.DECORATORS.API_HEADERS));if(Bi.length>0){Bi.forEach((St=>Oi.unshift(St.metadata)))}wi[On.requestMethod].parameters=Oi;const ji=ir.filter((St=>St.key===pr.DECORATORS.API_RESPONSE&&St.propertyName===On.method));const Ui={};for(const St of ji){const On=St.metadata;const rr=Object.keys(On);for(const St of rr){const rr=On[St];if(rr.schema){rr.content={"application/json":{schema:this.formatType(rr.schema)}};delete rr.schema}else if(rr.type){if(ur.Types.isClass(rr.type)){this.parseClzz(rr.type);if(rr.isArray){rr.content={"application/json":{schema:{type:"array",items:{$ref:"#/components/schemas/"+rr.type.name}}}}}else{rr.content={"application/json":{schema:{$ref:"#/components/schemas/"+rr.type.name}}}}}else{rr.content={"text/plain":{schema:{type:convertSchemaType(rr.type)}}}}}delete rr.status;delete rr.type;delete rr.isArray;delete rr.format}Object.assign(Ui,On)}if(Object.keys(Ui).length>0){wi[On.requestMethod].responses=Ui}else{wi[On.requestMethod].responses={200:{description:"OK"}}}rr[St]=wi}getOperationId(St,On){return this.operationIdFactory(St,On)}parseExtraModel(St){const On=(0,ur.getClassMetadata)(pr.DECORATORS_CLASS_METADATA,St)||[];const rr=On.filter((St=>St.key===pr.DECORATORS.API_EXTRA_MODEL));for(const St of rr){if(Array.isArray(St.metadata)){for(const On of St.metadata){this.parseClzz(On)}}else{this.parseClzz(St.metadata)}}}parseSubPropertyType(St){var On,rr,ir;let cr;if(St===null||St===void 0?void 0:St.enum){cr={type:St===null||St===void 0?void 0:St.type,enum:St===null||St===void 0?void 0:St.enum,default:St===null||St===void 0?void 0:St.default};if(St===null||St===void 0?void 0:St.description){cr.description=St===null||St===void 0?void 0:St.description}return cr}if((On=St===null||St===void 0?void 0:St.items)===null||On===void 0?void 0:On.enum){cr={type:St===null||St===void 0?void 0:St.type,items:St===null||St===void 0?void 0:St.items,default:St===null||St===void 0?void 0:St.default};if(St===null||St===void 0?void 0:St.description){cr.description=St===null||St===void 0?void 0:St.description}return cr}let pr=false;let fr=parseTypeSchema(St===null||St===void 0?void 0:St.type);St===null||St===void 0?true:delete St.type;if(fr==="array"){pr=true;fr=parseTypeSchema((rr=St===null||St===void 0?void 0:St.items)===null||rr===void 0?void 0:rr.type);St===null||St===void 0?true:delete St.items.type}if(St===null||St===void 0?void 0:St.oneOf){cr={oneOf:[]};St===null||St===void 0?void 0:St.oneOf.forEach((St=>{cr.push(this.parseSubPropertyType(St))}));St===null||St===void 0?true:delete St.oneOf}if(ur.Types.isClass(fr)){this.parseClzz(fr);if(pr){cr={type:"array",items:{$ref:"#/components/schemas/"+(fr===null||fr===void 0?void 0:fr.name)}}}else{cr={$ref:"#/components/schemas/"+(fr===null||fr===void 0?void 0:fr.name)}}delete St.items}else{if(pr){if(!fr){if((ir=St===null||St===void 0?void 0:St.items)===null||ir===void 0?void 0:ir["$ref"]){St.items["$ref"]=parseTypeSchema(St.items["$ref"])}cr={type:"array",items:St===null||St===void 0?void 0:St.items}}else{cr={type:"array",items:{type:convertSchemaType((fr===null||fr===void 0?void 0:fr.name)||fr)}}}delete St.items}else{cr={type:fr,format:St===null||St===void 0?void 0:St.format};if(cr.type==="Date"){cr.type="string";if(!cr.format){cr.format="date"}}delete St.format}}return Object.assign(cr,St)}formatType(St){if(St===null){return null}if(St.enum){if(Array.isArray(St.enum)){St.enum.map((St=>this.formatType(St)))}else{St.enum=(0,Sr.getEnumValues)(St.enum)}}if(St.not){St.not=this.formatType(St.not)}if(St["$ref"]&&typeof St["$ref"]==="function"){St["$ref"]=St["$ref"]()}if(St.oneOf){St.oneOf=St.oneOf.map((St=>this.formatType(St)))}else if(St.anyOf){St.anyOf=St.anyOf.map((St=>this.formatType(St)))}else if(St.allOf){St.allOf=St.allOf.map((St=>this.formatType(St)))}["not","$ref","oneOf","anyOf","allOf"].forEach((On=>{if(St[On]){delete St["type"]}}));if(St.properties){const On={};for(const rr in St.properties){On[rr]=this.formatType(St.properties[rr])}St.properties=On}if(St.additionalProperties){St.additionalProperties=this.formatType(St.additionalProperties)}if(["string","number","boolean","integer"].includes(St.type)){}else if(St.type===Number){St.type="number"}else if(St.type===String){St.type="string"}else if(St.type===Boolean){St.type="boolean"}else if(St.type==="date"||St.type==="Date"||St.type===Date){St.type="string";St.format="date-time"}else if(St.type===Array||St.type==="array"){St.type="array";if(St.items){St.items=this.formatType(St.items)}}else if(Array.isArray(St.type)){St.items=this.formatType({type:St.type[0]});St.type="array"}else if(St.type===Object||St.type==="object"){St.type="object"}else if(ur.Types.isClass(St.type)){this.parseClzz(St.type);St["$ref"]="#/components/schemas/"+St.type.name;delete St["type"]}else if(St.type instanceof Function){St.type=St.type();this.formatType(St)}return St}parseClzz(St){if(this.documentBuilder.getSchema(St.name)){return this.documentBuilder.getSchema(St.name)}this.parseExtraModel(St);const On=(0,ur.getClassExtendedMetadata)(ur.INJECT_CUSTOM_PROPERTY,St);const rr={type:"object",properties:{}};this.documentBuilder.addSchema({[St.name]:rr});if(On){for(const ir of Object.keys(On)){const cr=On[ir].metadata||{};if(!cr.type){cr.type=(0,ur.getPropertyType)(St.prototype,ir).name}rr.properties[ir]=rr.properties[ir]||{};for(const St in cr){if(St==="required"&&cr["required"]){if(!rr.required){rr.required=[]}rr.required.push(ir)}else if(["oneOf","anyOf","allOf"].includes(St)){rr.properties[ir][St]=[];cr[St].forEach((On=>{rr.properties[ir][St].push(this.formatType(On))}))}else if(St==="not"){rr.properties[ir][St]=this.formatType(cr[St])}else if(St==="type"){this.formatType(cr);if(cr.type){rr.properties[ir].type=cr.type}if(cr["$ref"]){rr.properties[ir].$ref=cr["$ref"]}if(cr.items){rr.properties[ir].items=cr.items}if(cr.format){rr.properties[ir].format=cr.format}if(cr.pattern){rr.properties[ir].pattern=cr.pattern}if(cr.enum){rr.properties[ir].enum=cr.enum}}else if(St==="items"||St==="pattern"||St==="format"||St==="enum"||St==="$ref"){}else{rr.properties[ir][St]=cr[St]}}}}return rr}setAuth(St){if(!St){return}const{authType:On,name:rr="",addSecurityRequirements:ir=false,...cr}=St;if(!On){return}switch(On){case"basic":{this.documentBuilder.addBasicAuth(cr,rr);break}case"bearer":{this.documentBuilder.addBearerAuth(cr,rr);break}case"cookie":{const{cookieName:St,securityName:On,...rr}=cr;this.documentBuilder.addCookieAuth(St,rr,On);break}case"oauth2":{this.documentBuilder.addOAuth2(cr,rr);break}case"apikey":{this.documentBuilder.addApiKey(cr,rr);break}case"custom":{this.documentBuilder.addSecurity(rr,cr);break}}if(ir){this.documentBuilder.addSecurityRequirements(rr)}}};ir([(0,ur.Config)("swagger"),cr("design:type",Object)],Er.prototype,"swaggerConfig",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],Er.prototype,"init",null);Er=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],Er);On.SwaggerExplorer=Er;function parseParamsInPath(St){const On=[];St.split("/").forEach((St=>{if(St.startsWith(":")){const rr=St.slice(1);On.push(rr)}}));return On}function replaceUrl(St,On){On.forEach((On=>{St=St.replace(`:${On}`,`{${On}}`)}));return St}function convertTypeToString(St){switch(St){case ur.RouteParamTypes.HEADERS:return"header";case ur.RouteParamTypes.QUERY:return"query";case ur.RouteParamTypes.PARAM:return"path";case ur.RouteParamTypes.BODY:case ur.RouteParamTypes.FIELDS:case ur.RouteParamTypes.FILESSTREAM:case ur.RouteParamTypes.FILESTREAM:return"body";default:return"header"}}function convertSchemaType(St){switch(St){case"Object":return"object";case"Boolean":return"boolean";case"Number":return"number";case"String":return"string";default:return"object"}}function getNotEmptyValue(...St){for(const On of St){if(On){return On}}}function parseTypeSchema(St){switch(St){case String:return"string";case Number:return"number";case Boolean:return"boolean";default:if(typeof St==="function"&&!ur.Types.isClass(St)){St=St()}return St}}function parseTags(St){let On=[];if(St.length>0){for(const rr of St){On=On.concat(rr.metadata)}}return On}function addTag(St,On=[]){if(On.find((On=>{if(Array.isArray(St)){return On===St[0]}else{return On===St}}))){}else{On.push(St)}}},64811:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.SwaggerMiddleware=void 0;const ur=rr(46123);const pr=rr(33984);let fr=class SwaggerMiddleware{async init(){if(typeof this.swaggerConfig.swaggerUIRender!=="function"){throw new ur.MidwayInvalidConfigPropertyError("swagger.swaggerRender")}this.swaggerRender=this.swaggerConfig.swaggerUIRender(this.swaggerConfig,this.swaggerExplorer)}resolve(St){if(St.getNamespace()==="express"){return async(St,On,rr)=>{const ir=St.path;const cr=await this.swaggerRender(ir);if(cr){const{ext:St,content:rr}=cr;if(St===".js"){On.type("application/javascript")}else if(St===".map"){On.type("application/json")}else if(St===".css"){On.type("text/css")}else if(St===".png"){On.type("image/png")}On.send(rr)}else{return rr()}}}else{return async(St,On)=>{const rr=St.path;const ir=await this.swaggerRender(rr);if(ir){const{ext:On,content:rr}=ir;if(On===".js"){St.set("Content-Type","application/javascript")}else if(On===".map"){St.set("Content-Type","application/json")}else if(On===".css"){St.set("Content-Type","text/css")}else if(On===".png"){St.set("Content-Type","image/png")}St.body=rr}else{return On()}}}}static getName(){return"swagger"}};ir([(0,ur.Config)("swagger"),cr("design:type",Object)],fr.prototype,"swaggerConfig",void 0);ir([(0,ur.Inject)(),cr("design:type",pr.SwaggerExplorer)],fr.prototype,"swaggerExplorer",void 0);ir([(0,ur.Inject)(),cr("design:type",ur.MidwayEnvironmentService)],fr.prototype,"environmentService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],fr.prototype,"init",null);fr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],fr);On.SwaggerMiddleware=fr},3376:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.renderSwaggerUIRemote=On.renderJSON=On.renderSwaggerUIDist=void 0;const ir=rr(46123);const cr=rr(79896);const ur=rr(16928);function renderSwaggerUIDist(St,On){const{getAbsoluteFSPath:rr}=(0,ir.safeRequire)("swagger-ui-dist");if(!rr){throw new ir.MidwayCommonError("swagger-ui-dist is not installed")}const pr=St.swaggerUIRenderOptions||{};if(pr.customInitializer){if((0,ur.isAbsolute)(pr.customInitializer)){pr.customInitializer=(0,cr.readFileSync)(pr.customInitializer)}else{throw new ir.MidwayInvalidConfigPropertyError("swagger.swaggerRenderOptions.customInitializer",["Buffer","String"])}}function replaceInfo(On){let rr=`location.href.replace('${St.swaggerPath}/index.html', '${St.swaggerPath}/index.json'),\n validatorUrl: null,`;if(St.displayOptions){Object.entries(St.displayOptions).forEach((([St,On])=>{const ir=typeof On==="string"?`'${On}'`:On;rr+=`\n${St}: ${ir},`}))}return On.replace('"https://petstore.swagger.io/v2/swagger.json",',rr)}const fr=rr();return async rr=>{if(!fr||rr.indexOf(St.swaggerPath)===-1){return}const ir=rr.split("/");let br=ir.pop();if(br==="index.json"){return{ext:"json",content:On.getData()}}if(!br){br="index.html"}let Sr=(0,cr.readFileSync)((0,ur.join)(fr,br));if(br==="swagger-initializer.js"&&(pr===null||pr===void 0?void 0:pr.customInitializer)){return{ext:"js",content:pr.customInitializer}}if(br==="index.html"||br==="swagger-initializer.js"){Sr=Sr.toString("utf8");Sr=replaceInfo(Sr)}const Er=(0,ur.extname)(br);return{ext:Er,content:Sr}}}On.renderSwaggerUIDist=renderSwaggerUIDist;function renderJSON(St,On){return async rr=>{if(rr.indexOf(St.swaggerPath)===-1){return}const ir=rr.split("/");const cr=ir.pop();if(cr==="index.json"){return{ext:"json",content:On.getData()}}return}}On.renderJSON=renderJSON;function renderSwaggerUIRemote(St,On){const rr=St.swaggerUIRenderOptions||{};const ir=(rr===null||rr===void 0?void 0:rr.indexPagePath)||(0,ur.join)(__dirname,"../../index.html");return async rr=>{if(rr.indexOf(St.swaggerPath)===-1){return}const ur=rr.split("/");let pr=ur.pop();if(pr==="index.json"){return{ext:"json",content:On.getData()}}if(!pr){pr="index.html"}if(pr==="index.html"){const St=(0,cr.readFileSync)(ir,"utf8");return{ext:"html",content:St}}return}}On.renderSwaggerUIRemote=renderSwaggerUIRemote},77053:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.i18n=On.validate=void 0;On.validate={validationOptions:{},errorStatus:422};On.i18n={localeTable:{en_US:{validate:rr(98044)},zh_CN:{validate:rr(62462)}}}},41601:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.ValidateConfiguration=void 0;const ur=rr(46123);const pr=rr(77053);const fr=rr(75284);const br=rr(68255);const Sr=rr(47215);const Er=rr(6482);let kr=class ValidateConfiguration{async init(){this.decoratorService.registerParameterHandler(Er.VALID_KEY,(({parameterIndex:St,originParamType:On,originArgs:rr,metadata:ir})=>{if(!ir.schema){ir.schema=this.validateService.getSchema(On)}return rr[St]}))}async onReady(St){await St.getAsync(Sr.ValidationPipe);await St.getAsync(Sr.ParseIntPipe);await St.getAsync(Sr.ParseBoolPipe);await St.getAsync(Sr.ParseFloatPipe);await St.getAsync(Sr.DecoratorValidPipe);this.decoratorService.registerParameterPipes(ur.WEB_ROUTER_PARAM_KEY,[Sr.ValidationPipe])}};ir([(0,ur.Inject)(),cr("design:type",ur.MidwayDecoratorService)],kr.prototype,"decoratorService",void 0);ir([(0,ur.Inject)(),cr("design:type",fr.ValidateService)],kr.prototype,"validateService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],kr.prototype,"init",null);kr=ir([(0,ur.Configuration)({namespace:"validate",imports:[br],importConfigs:[{default:pr}]})],kr);On.ValidateConfiguration=kr},6482:(St,On)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.VALID_KEY=On.VALIDATE_KEY=On.RULES_CLASS_KEY=On.RULES_KEY=void 0;On.RULES_KEY="common:rules";On.RULES_CLASS_KEY="common:class_rules";On.VALIDATE_KEY="common:validate";On.VALID_KEY="validate:valid"},61171:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.RuleType=On.Rule=void 0;const ir=rr(15192);On.RuleType=ir;const cr=rr(46123);const ur=rr(6482);function Rule(St,On={required:true}){return function(rr,pr){if(pr){if(!ir.isSchema(St)){St=ir.object((0,cr.getClassMetadata)(ur.RULES_KEY,St)).meta({id:St.name});if((0,cr.getPropertyType)(rr,pr).name==="Array"){St=ir.array().items(St);if(On.min){St=St.min(On.min)}if(On.max){St=St.max(On.max)}}if(On.required){St=St.required()}}(0,cr.attachClassMetadata)(ur.RULES_KEY,St,rr,pr)}else{if(ir.isSchema(St)){}}}}On.Rule=Rule},99419:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Valid=void 0;const ir=rr(46123);const cr=rr(6482);const ur=rr(47215);function Valid(St,On){if(Array.isArray(St)){On=St;St=undefined}else{On=On||[]}return(0,ir.createCustomParamDecorator)(cr.VALID_KEY,{schema:St},{pipes:[ur.DecoratorValidPipe,...On]})}On.Valid=Valid},75995:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.Validate=void 0;const ir=rr(46123);const cr=rr(6482);function Validate(St={}){return(On,rr,ur)=>{(0,ir.savePropertyMetadata)(cr.VALIDATE_KEY,St,On,rr)}}On.Validate=Validate},48698:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.OmitDto=On.PickDto=void 0;const ir=rr(46123);const cr=rr(6482);function PickDto(St,On){const pickedDto=function(){};pickedDto.prototype=St.prototype;const rr=(0,ir.getClassExtendedMetadata)(cr.RULES_KEY,St);const ur={};for(const St of On){if(rr[St]){ur[St]=rr[St]}}(0,ir.saveClassMetadata)(cr.RULES_KEY,ur,pickedDto);return pickedDto}On.PickDto=PickDto;function OmitDto(St,On){const pickedDto=function(){};pickedDto.prototype=St.prototype;const rr=(0,ir.getClassExtendedMetadata)(cr.RULES_KEY,St);const ur=Object.assign({},rr);for(const St of On){delete ur[St]}(0,ir.saveClassMetadata)(cr.RULES_KEY,ur,pickedDto);return pickedDto}On.OmitDto=OmitDto},42429:(St,On,rr)=>{"use strict";Object.defineProperty(On,"__esModule",{value:true});On.MidwayValidationError=void 0;const ir=rr(46123);const cr=(0,ir.registerErrorCode)("validate",{VALIDATE_FAIL:1e4});class MidwayValidationError extends ir.MidwayHttpError{constructor(St,On,rr){super(St,On,cr.VALIDATE_FAIL,{cause:rr})}}On.MidwayValidationError=MidwayValidationError},99375:function(St,On,rr){"use strict";var ir=this&&this.__createBinding||(Object.create?function(St,On,rr,ir){if(ir===undefined)ir=rr;var cr=Object.getOwnPropertyDescriptor(On,rr);if(!cr||("get"in cr?!On.__esModule:cr.writable||cr.configurable)){cr={enumerable:true,get:function(){return On[rr]}}}Object.defineProperty(St,ir,cr)}:function(St,On,rr,ir){if(ir===undefined)ir=rr;St[ir]=On[rr]});var cr=this&&this.__exportStar||function(St,On){for(var rr in St)if(rr!=="default"&&!Object.prototype.hasOwnProperty.call(On,rr))ir(On,St,rr)};Object.defineProperty(On,"__esModule",{value:true});On.Configuration=void 0;var ur=rr(41601);Object.defineProperty(On,"Configuration",{enumerable:true,get:function(){return ur.ValidateConfiguration}});cr(rr(61171),On);cr(rr(75995),On);cr(rr(99419),On);cr(rr(48698),On);cr(rr(75284),On);cr(rr(42429),On);cr(rr(47215),On)},47215:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.DefaultValuePipe=On.ParseFloatPipe=On.ParseBoolPipe=On.ParseIntPipe=On.DecoratorValidPipe=On.ParsePipe=On.ValidationPipe=On.AbstractValidationPipe=void 0;const ur=rr(46123);const pr=rr(75284);const fr=rr(68255);const br=rr(6482);const Sr=rr(15192);class AbstractValidationPipe{validateWithSchema(St,On,rr){const ir=this.parseValidationOptions(On);const cr=this.validateService.validateWithSchema(rr,St,ir);if(cr&&cr.value!==undefined){return cr.value}return St}validate(St,On){const rr=this.parseValidationOptions(On);if(On.metaType.isBaseType){return St}const ir=this.validateService.validate(On.metaType.originDesign,St,rr);if(ir&&ir.value){return ir.value}return St}parseValidationOptions(St){const On=(0,ur.getPropertyMetadata)(br.VALIDATE_KEY,St.target,St.methodName)||{};if(!On.locale){const rr=St.target[ur.REQUEST_OBJ_CTX_KEY];if(rr&&rr.getAttr){On.locale=rr.getAttr(fr.I18N_ATTR_KEY)}}return On}getSchema(){return undefined}}ir([(0,ur.Inject)(),cr("design:type",pr.ValidateService)],AbstractValidationPipe.prototype,"validateService",void 0);On.AbstractValidationPipe=AbstractValidationPipe;let Er=class ValidationPipe extends AbstractValidationPipe{transform(St,On){return this.validate(St,On)}};Er=ir([(0,ur.Pipe)()],Er);On.ValidationPipe=Er;class ParsePipe extends AbstractValidationPipe{transform(St,On){return this.validateWithSchema(St,On,On.metadata["schema"]||this.getSchema())}}On.ParsePipe=ParsePipe;let kr=class DecoratorValidPipe extends ParsePipe{};kr=ir([(0,ur.Pipe)()],kr);On.DecoratorValidPipe=kr;let Pr=class ParseIntPipe extends ParsePipe{getSchema(){return Sr.number().integer().required()}};Pr=ir([(0,ur.Pipe)()],Pr);On.ParseIntPipe=Pr;let Ir=class ParseBoolPipe extends ParsePipe{getSchema(){return Sr.boolean().required()}};Ir=ir([(0,ur.Pipe)()],Ir);On.ParseBoolPipe=Ir;let Lr=class ParseFloatPipe extends ParsePipe{getSchema(){return Sr.number().required()}};Lr=ir([(0,ur.Pipe)()],Lr);On.ParseFloatPipe=Lr;class DefaultValuePipe{constructor(St){this.defaultValue=St}transform(St,On){if(St===undefined||St===null||typeof St==="number"&&isNaN(St)){return this.defaultValue}return St}}On.DefaultValuePipe=DefaultValuePipe},75284:function(St,On,rr){"use strict";var ir=this&&this.__decorate||function(St,On,rr,ir){var cr=arguments.length,ur=cr<3?On:ir===null?ir=Object.getOwnPropertyDescriptor(On,rr):ir,pr;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")ur=Reflect.decorate(St,On,rr,ir);else for(var fr=St.length-1;fr>=0;fr--)if(pr=St[fr])ur=(cr<3?pr(ur):cr>3?pr(On,rr,ur):pr(On,rr))||ur;return cr>3&&ur&&Object.defineProperty(On,rr,ur),ur};var cr=this&&this.__metadata||function(St,On){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(St,On)};Object.defineProperty(On,"__esModule",{value:true});On.getSchema=On.ValidateService=void 0;const ur=rr(46123);const pr=rr(77053);const fr=rr(6482);const br=rr(15192);const Sr=rr(68255);const Er=rr(42429);let kr=class ValidateService{constructor(){this.messages={}}async init(){const St=Object.keys(pr.i18n.localeTable);St.forEach((St=>{this.messages[(0,Sr.formatLocale)(St)]=Object.fromEntries(this.i18nService.getLocaleMapping(St,"validate"))}))}validate(St,On,rr={}){const ir=this.getSchema(St);return this.validateWithSchema(ir,On,rr)}validateWithSchema(St,On,rr={}){var ir,cr,ur;if(!St){return undefined}rr.validationOptions=rr.validationOptions||{};rr.validationOptions.errors=rr.validationOptions.errors||{};rr.validationOptions.errors.language=(0,Sr.formatLocale)(this.i18nService.getAvailableLocale(rr.validationOptions.errors.language||rr.locale||this.i18nConfig.defaultLocale,"validate"));const pr=St.validate(On,Object.assign({},(ir=this.validateConfig.validationOptions)!==null&&ir!==void 0?ir:{},{messages:this.messages},(cr=rr.validationOptions)!==null&&cr!==void 0?cr:{}));if(pr.error){throw new Er.MidwayValidationError(pr.error.message,(ur=rr===null||rr===void 0?void 0:rr.errorStatus)!==null&&ur!==void 0?ur:this.validateConfig.errorStatus,pr.error)}else{return pr}}getSchema(St){return getSchema(St)}};ir([(0,ur.Config)("validate"),cr("design:type",Object)],kr.prototype,"validateConfig",void 0);ir([(0,ur.Config)("i18n"),cr("design:type",Object)],kr.prototype,"i18nConfig",void 0);ir([(0,ur.Inject)(),cr("design:type",Sr.MidwayI18nServiceSingleton)],kr.prototype,"i18nService",void 0);ir([(0,ur.Init)(),cr("design:type",Function),cr("design:paramtypes",[]),cr("design:returntype",Promise)],kr.prototype,"init",null);kr=ir([(0,ur.Provide)(),(0,ur.Scope)(ur.ScopeEnum.Singleton)],kr);On.ValidateService=kr;function getSchema(St){const On=(0,ur.getClassExtendedMetadata)(fr.RULES_KEY,St);if(On){return br.object(On)}}On.getSchema=getSchema},6647:(St,On,rr)=>{"use strict";const ir=rr(87016);const cr=rr(16480);const ur={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:ir.URL||URL};On.analyze=function(St,On={}){if(!St){return cr.code("DOMAIN_NON_EMPTY_STRING")}if(typeof St!=="string"){throw new Error("Invalid input: domain must be a string")}if(St.length>256){return cr.code("DOMAIN_TOO_LONG")}const rr=!ur.nonAsciiRx.test(St);if(!rr){if(On.allowUnicode===false){return cr.code("DOMAIN_INVALID_UNICODE_CHARS")}St=St.normalize("NFC")}if(ur.domainControlRx.test(St)){return cr.code("DOMAIN_INVALID_CHARS")}St=ur.punycode(St);if(On.allowFullyQualified&&St[St.length-1]==="."){St=St.slice(0,-1)}const ir=On.minDomainSegments||ur.minDomainSegments;const pr=St.split(".");if(pr.length<ir){return cr.code("DOMAIN_SEGMENTS_COUNT")}if(On.maxDomainSegments){if(pr.length>On.maxDomainSegments){return cr.code("DOMAIN_SEGMENTS_COUNT_MAX")}}const fr=On.tlds;if(fr){const St=pr[pr.length-1].toLowerCase();if(fr.deny&&fr.deny.has(St)||fr.allow&&!fr.allow.has(St)){return cr.code("DOMAIN_FORBIDDEN_TLDS")}}for(let St=0;St<pr.length;++St){const On=pr[St];if(!On.length){return cr.code("DOMAIN_EMPTY_SEGMENT")}if(On.length>63){return cr.code("DOMAIN_LONG_SEGMENT")}if(St<pr.length-1){if(!ur.domainSegmentRx.test(On)){return cr.code("DOMAIN_INVALID_CHARS")}}else{if(!ur.tldSegmentRx.test(On)){return cr.code("DOMAIN_INVALID_TLDS_CHARS")}}}return null};On.isValid=function(St,rr){return!On.analyze(St,rr)};ur.punycode=function(St){if(St.includes("%")){St=St.replace(/%/g,"%25")}try{return new ur.URL(`http://${St}`).host}catch(On){return St}}},71099:(St,On,rr)=>{"use strict";const ir=rr(39023);const cr=rr(6647);const ur=rr(16480);const pr={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(ir.TextEncoder||TextEncoder)};On.analyze=function(St,On){return pr.email(St,On)};On.isValid=function(St,On){return!pr.email(St,On)};pr.email=function(St,On={}){if(typeof St!=="string"){throw new Error("Invalid input: email must be a string")}if(!St){return ur.code("EMPTY_STRING")}const rr=!pr.nonAsciiRx.test(St);if(!rr){if(On.allowUnicode===false){return ur.code("FORBIDDEN_UNICODE")}St=St.normalize("NFC")}const ir=St.split("@");if(ir.length!==2){return ir.length>2?ur.code("MULTIPLE_AT_CHAR"):ur.code("MISSING_AT_CHAR")}const[fr,br]=ir;if(!fr){return ur.code("EMPTY_LOCAL")}if(!On.ignoreLength){if(St.length>254){return ur.code("ADDRESS_TOO_LONG")}if(pr.encoder.encode(fr).length>64){return ur.code("LOCAL_TOO_LONG")}}return pr.local(fr,rr)||cr.analyze(br,On)};pr.local=function(St,On){const rr=St.split(".");for(const St of rr){if(!St.length){return ur.code("EMPTY_LOCAL_SEGMENT")}if(On){if(!pr.atextRx.test(St)){return ur.code("INVALID_LOCAL_CHARS")}continue}for(const On of St){if(pr.atextRx.test(On)){continue}const St=pr.binary(On);if(!pr.atomRx.test(St)){return ur.code("INVALID_LOCAL_CHARS")}}}};pr.binary=function(St){return Array.from(pr.encoder.encode(St)).map((St=>String.fromCharCode(St))).join("")};pr.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/;pr.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:(St,On)=>{"use strict";On.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"};On.code=function(St){return{code:St,error:On.codes[St]}}},54990:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(63377);const ur={};On.regex=function(St={}){ir(St.cidr===undefined||typeof St.cidr==="string","options.cidr must be a string");const On=St.cidr?St.cidr.toLowerCase():"optional";ir(["required","optional","forbidden"].includes(On),"options.cidr must be one of required, optional, forbidden");ir(St.version===undefined||typeof St.version==="string"||Array.isArray(St.version),"options.version must be a string or an array of string");let rr=St.version||["ipv4","ipv6","ipvfuture"];if(!Array.isArray(rr)){rr=[rr]}ir(rr.length>=1,"options.version must have at least 1 version specified");for(let St=0;St<rr.length;++St){ir(typeof rr[St]==="string","options.version must only contain strings");rr[St]=rr[St].toLowerCase();ir(["ipv4","ipv6","ipvfuture"].includes(rr[St]),"options.version contains unknown version "+rr[St]+" - must be one of ipv4, ipv6, ipvfuture")}rr=Array.from(new Set(rr));const ur=rr.map((St=>{if(On==="forbidden"){return cr.ip[St]}const rr=`\\/${St==="ipv4"?cr.ip.v4Cidr:cr.ip.v6Cidr}`;if(On==="required"){return`${cr.ip[St]}${rr}`}return`${cr.ip[St]}(?:${rr})?`}));const pr=`(?:${ur.join("|")})`;const fr=new RegExp(`^${pr}$`);return{cidr:On,versions:rr,regex:fr,raw:pr}}},33618:St=>{"use strict";const On={};On.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"];St.exports=new Set(On.tlds.map((St=>St.toLowerCase())))},63377:(St,On,rr)=>{"use strict";const ir=rr(99583);const cr=rr(43935);const ur={};ur.generate=function(){const St={};const On="\\dA-Fa-f";const rr="["+On+"]";const ir="\\w-\\.~";const cr="!\\$&'\\(\\)\\*\\+,;=";const ur="%"+On;const pr=ir+ur+cr+":@";const fr="["+pr+"]";const br="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";St.ipv4address="(?:"+br+"\\.){3}"+br;const Sr=rr+"{1,4}";const Er="(?:"+Sr+":"+Sr+"|"+St.ipv4address+")";const kr="(?:"+Sr+":){6}"+Er;const Pr="::(?:"+Sr+":){5}"+Er;const Ir="(?:"+Sr+")?::(?:"+Sr+":){4}"+Er;const Lr="(?:(?:"+Sr+":){0,1}"+Sr+")?::(?:"+Sr+":){3}"+Er;const Br="(?:(?:"+Sr+":){0,2}"+Sr+")?::(?:"+Sr+":){2}"+Er;const jr="(?:(?:"+Sr+":){0,3}"+Sr+")?::"+Sr+":"+Er;const Ur="(?:(?:"+Sr+":){0,4}"+Sr+")?::"+Er;const Vr="(?:(?:"+Sr+":){0,5}"+Sr+")?::"+Sr;const Wr="(?:(?:"+Sr+":){0,6}"+Sr+")?::";St.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])";St.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])";St.ipv6address="(?:"+kr+"|"+Pr+"|"+Ir+"|"+Lr+"|"+Br+"|"+jr+"|"+Ur+"|"+Vr+"|"+Wr+")";St.ipvFuture="v"+rr+"+\\.["+ir+cr+":]+";St.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*";St.schemeRegex=new RegExp(St.scheme);const zr="["+ir+ur+cr+":]*";const qr="\\[(?:"+St.ipv6address+"|"+St.ipvFuture+")\\]";const Kr="["+ir+ur+cr+"]{1,255}";const Xr="(?:"+qr+"|"+St.ipv4address+"|"+Kr+")";const Yr="\\d*";const ii="(?:"+zr+"@)?"+Xr+"(?::"+Yr+")?";const oi="(?:"+zr+"@)?("+Xr+")(?::"+Yr+")?";const ai=fr+"*";const pi=fr+"+";const mi="["+ir+ur+cr+"@"+"]+";const bi="";const xi="(?:\\/"+ai+")*";const wi="\\/(?:"+pi+xi+")?";const Oi=pi+xi;const Ii=mi+xi;const Ri="(?:\\/\\/\\/"+ai+xi+")";St.hierPart="(?:"+"(?:\\/\\/"+ii+xi+")"+"|"+wi+"|"+Oi+"|"+Ri+")";St.hierPartCapture="(?:"+"(?:\\/\\/"+oi+xi+")"+"|"+wi+"|"+Oi+")";St.relativeRef="(?:"+"(?:\\/\\/"+ii+xi+")"+"|"+wi+"|"+Ii+"|"+bi+")";St.relativeRefCapture="(?:"+"(?:\\/\\/"+oi+xi+")"+"|"+wi+"|"+Ii+"|"+bi+")";St.query="["+pr+"\\/\\?]*(?=#|$)";St.queryWithSquareBrackets="["+pr+"\\[\\]\\/\\?]*(?=#|$)";St.fragment="["+pr+"\\/\\?]*";return St};ur.rfc3986=ur.generate();On.ip={v4Cidr:ur.rfc3986.ipv4Cidr,v6Cidr:ur.rfc3986.ipv6Cidr,ipv4:ur.rfc3986.ipv4address,ipv6:ur.rfc3986.ipv6address,ipvfuture:ur.rfc3986.ipvFuture};ur.createRegex=function(St){const On=ur.rfc3986;const rr=St.allowQuerySquareBrackets?On.queryWithSquareBrackets:On.query;const pr="(?:\\?"+rr+")?"+"(?:#"+On.fragment+")?";const fr=St.domain?On.relativeRefCapture:On.relativeRef;if(St.relativeOnly){return ur.wrap(fr+pr)}let br="";if(St.scheme){ir(St.scheme instanceof RegExp||typeof St.scheme==="string"||Array.isArray(St.scheme),"scheme must be a RegExp, String, or Array");const rr=[].concat(St.scheme);ir(rr.length>=1,"scheme must have at least 1 scheme specified");const ur=[];for(let St=0;St<rr.length;++St){const pr=rr[St];ir(pr instanceof RegExp||typeof pr==="string","scheme at position "+St+" must be a RegExp or String");if(pr instanceof RegExp){ur.push(pr.source.toString())}else{ir(On.schemeRegex.test(pr),"scheme at position "+St+" must be a valid scheme");ur.push(cr(pr))}}br=ur.join("|")}const Sr=br?"(?:"+br+")":On.scheme;const Er="(?:"+Sr+":"+(St.domain?On.hierPartCapture:On.hierPart)+")";const kr=St.allowRelative?"(?:"+Er+"|"+fr+")":Er;return ur.wrap(kr+pr,br)};ur.wrap=function(St,On){St=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${St}`;return{raw:St,regex:new RegExp(`^${St}$`),scheme:On}};ur.uriRegex=ur.createRegex({});On.regex=function(St={}){if(St.scheme||St.allowRelative||St.relativeOnly||St.allowQuerySquareBrackets||St.domain){return ur.createRegex(St)}return ur.uriRegex}},25673:(St,On)=>{"use strict";const rr={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};On.Parser=class{constructor(St,On={}){if(!On[rr.settings]&&On.constants){for(const St in On.constants){const rr=On.constants[St];if(rr!==null&&!["boolean","number","string"].includes(typeof rr)){throw new Error(`Formula constant ${St} contains invalid ${typeof rr} value type`)}}}this.settings=On[rr.settings]?On:Object.assign({[rr.settings]:true,constants:{},functions:{}},On);this.single=null;this._parts=null;this._parse(St)}_parse(St){let ir=[];let cr="";let ur=0;let pr=false;const flush=St=>{if(ur){throw new Error("Formula missing closing parenthesis")}const fr=ir.length?ir[ir.length-1]:null;if(!pr&&!cr&&!St){return}if(fr&&fr.type==="reference"&&St===")"){fr.type="function";fr.value=this._subFormula(cr,fr.value);cr="";return}if(St===")"){const St=new On.Parser(cr,this.settings);ir.push({type:"segment",value:St})}else if(pr){if(pr==="]"){ir.push({type:"reference",value:cr});cr="";return}ir.push({type:"literal",value:cr})}else if(rr.operatorCharacters.includes(cr)){if(fr&&fr.type==="operator"&&rr.operators.includes(fr.value+cr)){fr.value+=cr}else{ir.push({type:"operator",value:cr})}}else if(cr.match(rr.numberRx)){ir.push({type:"constant",value:parseFloat(cr)})}else if(this.settings.constants[cr]!==undefined){ir.push({type:"constant",value:this.settings.constants[cr]})}else{if(!cr.match(rr.tokenRx)){throw new Error(`Formula contains invalid token: ${cr}`)}ir.push({type:"reference",value:cr})}cr=""};for(const On of St){if(pr){if(On===pr){flush();pr=false}else{cr+=On}}else if(ur){if(On==="("){cr+=On;++ur}else if(On===")"){--ur;if(!ur){flush(On)}else{cr+=On}}else{cr+=On}}else if(On in rr.literals){pr=rr.literals[On]}else if(On==="("){flush();++ur}else if(rr.operatorCharacters.includes(On)){flush();cr=On;flush()}else if(On!==" "){cr+=On}else{flush()}}flush();ir=ir.map(((St,On)=>{if(St.type!=="operator"||St.value!=="-"||On&&ir[On-1].type!=="operator"){return St}return{type:"operator",value:"n"}}));let fr=false;for(const St of ir){if(St.type==="operator"){if(rr.operatorsPrefix.includes(St.value)){continue}if(!fr){throw new Error("Formula contains an operator in invalid position")}if(!rr.operators.includes(St.value)){throw new Error(`Formula contains an unknown operator ${St.value}`)}}else if(fr){throw new Error("Formula missing expected operator")}fr=!fr}if(!fr){throw new Error("Formula contains invalid trailing operator")}if(ir.length===1&&["reference","literal","constant"].includes(ir[0].type)){this.single={type:ir[0].type==="reference"?"reference":"value",value:ir[0].value}}this._parts=ir.map((St=>{if(St.type==="operator"){return rr.operatorsPrefix.includes(St.value)?St:St.value}if(St.type!=="reference"){return St.value}if(this.settings.tokenRx&&!this.settings.tokenRx.test(St.value)){throw new Error(`Formula contains invalid reference ${St.value}`)}if(this.settings.reference){return this.settings.reference(St.value)}return rr.reference(St.value)}))}_subFormula(St,ir){const cr=this.settings.functions[ir];if(typeof cr!=="function"){throw new Error(`Formula contains unknown function ${ir}`)}let ur=[];if(St){let On="";let cr=0;let pr=false;const flush=()=>{if(!On){throw new Error(`Formula contains function ${ir} with invalid arguments ${St}`)}ur.push(On);On=""};for(let ir=0;ir<St.length;++ir){const ur=St[ir];if(pr){On+=ur;if(ur===pr){pr=false}}else if(ur in rr.literals&&!cr){On+=ur;pr=rr.literals[ur]}else if(ur===","&&!cr){flush()}else{On+=ur;if(ur==="("){++cr}else if(ur===")"){--cr}}}flush()}ur=ur.map((St=>new On.Parser(St,this.settings)));return function(St){const On=[];for(const rr of ur){On.push(rr.evaluate(St))}return cr.call(St,...On)}}evaluate(St){const On=this._parts.slice();for(let ir=On.length-2;ir>=0;--ir){const cr=On[ir];if(cr&&cr.type==="operator"){const ur=On[ir+1];On.splice(ir+1,1);const pr=rr.evaluate(ur,St);On[ir]=rr.single(cr.value,pr)}}rr.operatorsOrder.forEach((ir=>{for(let cr=1;cr<On.length-1;){if(ir.includes(On[cr])){const ir=On[cr];const ur=rr.evaluate(On[cr-1],St);const pr=rr.evaluate(On[cr+1],St);On.splice(cr,2);const fr=rr.calculate(ir,ur,pr);On[cr-1]=fr===0?0:fr}else{cr+=2}}}));return rr.evaluate(On[0],St)}};On.Parser.prototype[rr.symbol]=true;rr.reference=function(St){return function(On){return On&&On[St]!==undefined?On[St]:null}};rr.evaluate=function(St,On){if(St===null){return null}if(typeof St==="function"){return St(On)}if(St[rr.symbol]){return St.evaluate(On)}return St};rr.single=function(St,On){if(St==="!"){return On?false:true}const rr=-On;if(rr===0){return 0}return rr};rr.calculate=function(St,On,ir){if(St==="??"){return rr.exists(On)?On:ir}if(typeof On==="string"||typeof ir==="string"){if(St==="+"){On=rr.exists(On)?On:"";ir=rr.exists(ir)?ir:"";return On+ir}}else{switch(St){case"^":return Math.pow(On,ir);case"*":return On*ir;case"/":return On/ir;case"%":return On%ir;case"+":return On+ir;case"-":return On-ir}}switch(St){case"<":return On<ir;case"<=":return On<=ir;case">":return On>ir;case">=":return On>=ir;case"==":return On===ir;case"!=":return On!==ir;case"&&":return On&&ir;case"||":return On||ir}return null};rr.exists=function(St){return St!==null&&St!==undefined}},533:(St,On)=>{"use strict";const rr={};On.location=function(St=0){const On=Error.prepareStackTrace;Error.prepareStackTrace=(St,On)=>On;const rr={};Error.captureStackTrace(rr,this);const ir=rr.stack[St+1];Error.prepareStackTrace=On;return{filename:ir.getFileName(),line:ir.getLineNumber()}}},90167:(St,On,rr)=>{"use strict";
3
3
  /*!
4
4
  * accepts